From: Andrea Bianco Date: Thu, 4 Jul 2019 17:07:38 +0000 (+0200) Subject: Built motion from commit (unavailable).|2.0.84 X-Git-Tag: 2.1.0~1 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=6a871c7fbfb86bd73982e6a5d20f4d6bd011135c;p=motion2.git Built motion from commit (unavailable).|2.0.84 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index a3580b9..2a6ddc2 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.0.84", "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.

\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 a xCALLY API token.

\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

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": "2019-07-04T16:54:33.088Z", "url": "http://apidocjs.com", "version": "0.17.7" } }); +define({ "name": "xCALLY Motion API", "version": "2.0.84", "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.

\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 a xCALLY API token.

\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

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": "2019-07-04T17:02:33.133Z", "url": "http://apidocjs.com", "version": "0.17.7" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index ba2fc53..d741466 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1 +1 @@ -{ "name": "xCALLY Motion API", "version": "2.0.84", "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.

\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 a xCALLY API token.

\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

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": "2019-07-04T16:54:33.088Z", "url": "http://apidocjs.com", "version": "0.17.7" } } +{ "name": "xCALLY Motion API", "version": "2.0.84", "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.

\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 a xCALLY API token.

\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

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": "2019-07-04T17:02:33.133Z", "url": "http://apidocjs.com", "version": "0.17.7" } } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index fe3ba67..8c31c48 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 _0xbd51=['urlForward','browser','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot','STRING','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','TEXT','sequelize','VIRTUAL','getDataValue','action','jscripty'];(function(_0x274bd4,_0x328e0c){var _0x1b5f20=function(_0x53eb38){while(--_0x53eb38){_0x274bd4['push'](_0x274bd4['shift']());}};_0x1b5f20(++_0x328e0c);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x44ae3f,_0x1dccc9){_0x44ae3f=_0x44ae3f-0x0;var _0x408a17=_0xbd51[_0x44ae3f];return _0x408a17;};'use strict';var Sequelize=require(_0x1bd5('0x0'));module['exports']={'name':{'type':Sequelize[_0x1bd5('0x1')],'get':function(_0x1c04fa){return this[_0x1bd5('0x2')](_0x1bd5('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager','integration','motionbar',_0x1bd5('0x4'),_0x1bd5('0x5'),_0x1bd5('0x6'),'bot']],'msg':_0x1bd5('0x7')}},'comment':_0x1bd5('0x7')},'data1':{'type':Sequelize[_0x1bd5('0x8')](0x1000),'comment':_0x1bd5('0x9')},'data2':{'type':Sequelize[_0x1bd5('0x8')](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize[_0x1bd5('0x8')](0x1000),'comment':'motionbar[NULL,NULL,WinAppArguments]'},'data4':{'type':Sequelize[_0x1bd5('0x8')](0x1000)},'data5':{'type':Sequelize[_0x1bd5('0x8')](0x1000)},'data6':{'type':Sequelize[_0x1bd5('0x8')]},'data7':{'type':Sequelize[_0x1bd5('0xa')]}}; \ No newline at end of file +var _0x8958=['Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','exports','STRING','integration','motionbar','jscripty','browser','bot'];(function(_0x31451d,_0x95b22){var _0x141229=function(_0x210484){while(--_0x210484){_0x31451d['push'](_0x31451d['shift']());}};_0x141229(++_0x95b22);}(_0x8958,0x93));var _0x8895=function(_0x15c617,_0x5de335){_0x15c617=_0x15c617-0x0;var _0x3c74e4=_0x8958[_0x15c617];return _0x3c74e4;};'use strict';var Sequelize=require('sequelize');module[_0x8895('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4eda63){return this['getDataValue']('action');}},'action':{'type':Sequelize[_0x8895('0x1')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x8895('0x2'),_0x8895('0x3'),_0x8895('0x4'),'urlForward',_0x8895('0x5'),_0x8895('0x6')]],'msg':_0x8895('0x7')}},'comment':_0x8895('0x7')},'data1':{'type':Sequelize[_0x8895('0x1')](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize[_0x8895('0x1')](0x1000),'comment':_0x8895('0x8')},'data3':{'type':Sequelize[_0x8895('0x1')](0x1000),'comment':_0x8895('0x9')},'data4':{'type':Sequelize[_0x8895('0x1')](0x1000)},'data5':{'type':Sequelize[_0x8895('0x1')](0x1000)},'data6':{'type':Sequelize[_0x8895('0x1')]},'data7':{'type':Sequelize[_0x8895('0xa')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 925e077..81249fc 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 _0x3d21=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','body','Action','find','params','destroy','html-pdf'];(function(_0x583a38,_0x4321ad){var _0x2973f2=function(_0x5b4c4e){while(--_0x5b4c4e){_0x583a38['push'](_0x583a38['shift']());}};_0x2973f2(++_0x4321ad);}(_0x3d21,0x11e));var _0x13d2=function(_0x4fd0d2,_0x1532fa){_0x4fd0d2=_0x4fd0d2-0x0;var _0x5ee0ce=_0x3d21[_0x4fd0d2];return _0x5ee0ce;};'use strict';var pdf=require(_0x13d2('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x13d2('0x1'));var jsonpatch=require(_0x13d2('0x2'));var rp=require(_0x13d2('0x3'));var moment=require(_0x13d2('0x4'));var BPromise=require(_0x13d2('0x5'));var Mustache=require(_0x13d2('0x6'));var util=require('util');var path=require('path');var sox=require(_0x13d2('0x7'));var csv=require(_0x13d2('0x8'));var ejs=require(_0x13d2('0x9'));var fs=require('fs');var _=require(_0x13d2('0xa'));var squel=require(_0x13d2('0xb'));var crypto=require(_0x13d2('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x13d2('0x8'));var querystring=require(_0x13d2('0xd'));var Papa=require(_0x13d2('0xe'));var Redis=require('ioredis');var qs=require(_0x13d2('0xf'));var logger=require(_0x13d2('0x10'))(_0x13d2('0x11'));var utils=require(_0x13d2('0x12'));var config=require('../../config/environment');var db=require(_0x13d2('0x13'))['db'];function respondWithStatusCode(_0x38ca33,_0x47934a){_0x47934a=_0x47934a||0xcc;return function(_0x31de79){if(_0x31de79){return _0x38ca33[_0x13d2('0x14')](_0x47934a);}return _0x38ca33[_0x13d2('0x15')](_0x47934a)[_0x13d2('0x16')]();};}function respondWithResult(_0x5edaf1,_0x56cd22){_0x56cd22=_0x56cd22||0xc8;return function(_0x5f5655){if(_0x5f5655){return _0x5edaf1[_0x13d2('0x15')](_0x56cd22)[_0x13d2('0x17')](_0x5f5655);}};}function respondWithFilteredResult(_0x170af2,_0xf44b7e){return function(_0x4cc1d6){if(_0x4cc1d6){var _0x55c6e8=_0x4cc1d6[_0x13d2('0x18')],_0x2e0ba4=_0xf44b7e['offset'],_0x324471=_0xf44b7e[_0x13d2('0x19')]+_0xf44b7e['limit'],_0x1f8117;if(_0x324471>=_0x55c6e8){_0x324471=_0x55c6e8;_0x1f8117=0xc8;}else{_0x1f8117=0xce;}_0x170af2[_0x13d2('0x15')](_0x1f8117);return _0x170af2[_0x13d2('0x1a')](_0x13d2('0x1b'),_0x2e0ba4+'-'+_0x324471+'/'+_0x55c6e8)['json'](_0x4cc1d6);}return null;};}function patchUpdates(_0x12bcbf){return function(_0x472cc2){try{jsonpatch[_0x13d2('0x1c')](_0x472cc2,_0x12bcbf,!![]);}catch(_0x2ea9b7){return BPromise[_0x13d2('0x1d')](_0x2ea9b7);}return _0x472cc2[_0x13d2('0x1e')]();};}function saveUpdates(_0x4b2ece,_0x1e21f4){return function(_0x15ede4){if(_0x15ede4){return _0x15ede4[_0x13d2('0x1f')](_0x4b2ece)[_0x13d2('0x20')](function(_0x52189d){return _0x52189d;});}return null;};}function removeEntity(_0x4936c7,_0x443d7e){return function(_0x284213){if(_0x284213){return _0x284213['destroy']()[_0x13d2('0x20')](function(){_0x4936c7[_0x13d2('0x15')](0xcc)[_0x13d2('0x16')]();});}};}function handleEntityNotFound(_0x5d42a7,_0x3166f5){return function(_0x5bee8c){if(!_0x5bee8c){_0x5d42a7['sendStatus'](0x194);}return _0x5bee8c;};}function handleError(_0x258bb6,_0x23660d){_0x23660d=_0x23660d||0x1f4;return function(_0x5620f6){logger[_0x13d2('0x21')](_0x5620f6[_0x13d2('0x22')]);if(_0x5620f6[_0x13d2('0x23')]){delete _0x5620f6[_0x13d2('0x23')];}_0x258bb6[_0x13d2('0x15')](_0x23660d)['send'](_0x5620f6);};}exports['update']=function(_0x5c4972,_0x5a0ae7){if(_0x5c4972[_0x13d2('0x24')]['id']){delete _0x5c4972[_0x13d2('0x24')]['id'];}return db[_0x13d2('0x25')][_0x13d2('0x26')]({'where':{'id':_0x5c4972[_0x13d2('0x27')]['id']}})['then'](handleEntityNotFound(_0x5a0ae7,null))[_0x13d2('0x20')](saveUpdates(_0x5c4972[_0x13d2('0x24')],null))[_0x13d2('0x20')](respondWithResult(_0x5a0ae7,null))['catch'](handleError(_0x5a0ae7,null));};exports[_0x13d2('0x28')]=function(_0x1c6056,_0x32d2dc){return db[_0x13d2('0x25')][_0x13d2('0x26')]({'where':{'id':_0x1c6056[_0x13d2('0x27')]['id']}})[_0x13d2('0x20')](handleEntityNotFound(_0x32d2dc,null))[_0x13d2('0x20')](removeEntity(_0x32d2dc,null))['catch'](handleError(_0x32d2dc,null));}; \ No newline at end of file +var _0x8053=['lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','apply','reject','save','update','destroy','then','end','name','send','body','find','params','catch','Action','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs'];(function(_0x4104d5,_0x4676e2){var _0x422243=function(_0x9386b1){while(--_0x9386b1){_0x4104d5['push'](_0x4104d5['shift']());}};_0x422243(++_0x4676e2);}(_0x8053,0x6e));var _0x3805=function(_0x176317,_0x4897b3){_0x176317=_0x176317-0x0;var _0xef2759=_0x8053[_0x176317];return _0xef2759;};'use strict';var pdf=require(_0x3805('0x0'));var emlformat=require(_0x3805('0x1'));var rimraf=require(_0x3805('0x2'));var zipdir=require(_0x3805('0x3'));var jsonpatch=require(_0x3805('0x4'));var rp=require(_0x3805('0x5'));var moment=require('moment');var BPromise=require(_0x3805('0x6'));var Mustache=require(_0x3805('0x7'));var util=require(_0x3805('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3805('0x9'));var fs=require('fs');var _=require(_0x3805('0xa'));var squel=require(_0x3805('0xb'));var crypto=require(_0x3805('0xc'));var jsforce=require(_0x3805('0xd'));var deskjs=require(_0x3805('0xe'));var toCsv=require(_0x3805('0xf'));var querystring=require(_0x3805('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x3805('0x11'));var utils=require(_0x3805('0x12'));var config=require(_0x3805('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7679b3,_0x164614){_0x164614=_0x164614||0xcc;return function(_0x19a35d){if(_0x19a35d){return _0x7679b3[_0x3805('0x14')](_0x164614);}return _0x7679b3[_0x3805('0x15')](_0x164614)['end']();};}function respondWithResult(_0x3676b7,_0x3e0455){_0x3e0455=_0x3e0455||0xc8;return function(_0xd28801){if(_0xd28801){return _0x3676b7[_0x3805('0x15')](_0x3e0455)[_0x3805('0x16')](_0xd28801);}};}function respondWithFilteredResult(_0x3b6777,_0x2b7565){return function(_0x54225b){if(_0x54225b){var _0x506d0c=_0x54225b[_0x3805('0x17')],_0x23c2b1=_0x2b7565['offset'],_0xd7eb2b=_0x2b7565[_0x3805('0x18')]+_0x2b7565[_0x3805('0x19')],_0x44ab95;if(_0xd7eb2b>=_0x506d0c){_0xd7eb2b=_0x506d0c;_0x44ab95=0xc8;}else{_0x44ab95=0xce;}_0x3b6777['status'](_0x44ab95);return _0x3b6777['set']('Content-Range',_0x23c2b1+'-'+_0xd7eb2b+'/'+_0x506d0c)[_0x3805('0x16')](_0x54225b);}return null;};}function patchUpdates(_0x4b6807){return function(_0x2607f7){try{jsonpatch[_0x3805('0x1a')](_0x2607f7,_0x4b6807,!![]);}catch(_0x488adc){return BPromise[_0x3805('0x1b')](_0x488adc);}return _0x2607f7[_0x3805('0x1c')]();};}function saveUpdates(_0x339c19,_0x48d31e){return function(_0x36a691){if(_0x36a691){return _0x36a691[_0x3805('0x1d')](_0x339c19)['then'](function(_0xe55597){return _0xe55597;});}return null;};}function removeEntity(_0x5f57d0,_0x3655c0){return function(_0x51b115){if(_0x51b115){return _0x51b115[_0x3805('0x1e')]()[_0x3805('0x1f')](function(){_0x5f57d0['status'](0xcc)[_0x3805('0x20')]();});}};}function handleEntityNotFound(_0x147e8b,_0xd14c52){return function(_0x41ba7a){if(!_0x41ba7a){_0x147e8b[_0x3805('0x14')](0x194);}return _0x41ba7a;};}function handleError(_0xe58514,_0x1ae5b6){_0x1ae5b6=_0x1ae5b6||0x1f4;return function(_0x463f44){logger['error'](_0x463f44['stack']);if(_0x463f44['name']){delete _0x463f44[_0x3805('0x21')];}_0xe58514[_0x3805('0x15')](_0x1ae5b6)[_0x3805('0x22')](_0x463f44);};}exports[_0x3805('0x1d')]=function(_0x372555,_0x45eb51){if(_0x372555[_0x3805('0x23')]['id']){delete _0x372555['body']['id'];}return db['Action'][_0x3805('0x24')]({'where':{'id':_0x372555[_0x3805('0x25')]['id']}})[_0x3805('0x1f')](handleEntityNotFound(_0x45eb51,null))[_0x3805('0x1f')](saveUpdates(_0x372555[_0x3805('0x23')],null))[_0x3805('0x1f')](respondWithResult(_0x45eb51,null))[_0x3805('0x26')](handleError(_0x45eb51,null));};exports[_0x3805('0x1e')]=function(_0x43b18e,_0x4fc4b9){return db[_0x3805('0x27')]['find']({'where':{'id':_0x43b18e[_0x3805('0x25')]['id']}})['then'](handleEntityNotFound(_0x4fc4b9,null))[_0x3805('0x1f')](removeEntity(_0x4fc4b9,null))[_0x3805('0x26')](handleError(_0x4fc4b9,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index c79c4b5..361e990 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 _0xcf00=['Action','tools_actions','lodash','util','../../config/logger','api','moment','request-promise','./action.attributes','exports','define'];(function(_0x15cb77,_0x593e7e){var _0x2e8b24=function(_0x23ddb1){while(--_0x23ddb1){_0x15cb77['push'](_0x15cb77['shift']());}};_0x2e8b24(++_0x593e7e);}(_0xcf00,0x86));var _0x0cf0=function(_0x506cbe,_0x818678){_0x506cbe=_0x506cbe-0x0;var _0x4fdaa7=_0xcf00[_0x506cbe];return _0x4fdaa7;};'use strict';var _=require(_0x0cf0('0x0'));var util=require(_0x0cf0('0x1'));var logger=require(_0x0cf0('0x2'))(_0x0cf0('0x3'));var moment=require(_0x0cf0('0x4'));var BPromise=require('bluebird');var rp=require(_0x0cf0('0x5'));var attributes=require(_0x0cf0('0x6'));module[_0x0cf0('0x7')]=function(_0x265042,_0x4218cf){return _0x265042[_0x0cf0('0x8')](_0x0cf0('0x9'),attributes,{'tableName':_0x0cf0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a32=['../../config/logger','api','request-promise','./action.attributes','exports','define','tools_actions','lodash','util'];(function(_0xa8780e,_0x592f9a){var _0x14df31=function(_0x43152a){while(--_0x43152a){_0xa8780e['push'](_0xa8780e['shift']());}};_0x14df31(++_0x592f9a);}(_0x5a32,0x154));var _0x25a3=function(_0x45fa71,_0x1262e8){_0x45fa71=_0x45fa71-0x0;var _0x75b909=_0x5a32[_0x45fa71];return _0x75b909;};'use strict';var _=require(_0x25a3('0x0'));var util=require(_0x25a3('0x1'));var logger=require(_0x25a3('0x2'))(_0x25a3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x25a3('0x4'));var attributes=require(_0x25a3('0x5'));module[_0x25a3('0x6')]=function(_0x3e30e9,_0xc59d9a){return _0x3e30e9[_0x25a3('0x7')]('Action',attributes,{'tableName':_0x25a3('0x8'),'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 5a5418b..4f7be56 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 _0xd382=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','info','Action,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x55b351,_0x1bb062){var _0x3f684f=function(_0x4aab3a){while(--_0x4aab3a){_0x55b351['push'](_0x55b351['shift']());}};_0x3f684f(++_0x1bb062);}(_0xd382,0x1b6));var _0x2d38=function(_0x5a2d90,_0xd5397b){_0x5a2d90=_0x5a2d90-0x0;var _0x358d5e=_0xd382[_0x5a2d90];return _0x358d5e;};'use strict';var _=require(_0x2d38('0x0'));var util=require(_0x2d38('0x1'));var moment=require(_0x2d38('0x2'));var BPromise=require(_0x2d38('0x3'));var rs=require(_0x2d38('0x4'));var fs=require('fs');var Redis=require(_0x2d38('0x5'));var db=require(_0x2d38('0x6'))['db'];var utils=require(_0x2d38('0x7'));var logger=require(_0x2d38('0x8'))(_0x2d38('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2d38('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e2919,_0x55ae65,_0x1296cb){return new BPromise(function(_0x3fb88f,_0x39ebfd){return client['request'](_0x1e2919,_0x1296cb)['then'](function(_0x5f20a4){logger[_0x2d38('0xb')](_0x2d38('0xc'),_0x55ae65,'request\x20sent');logger[_0x2d38('0xd')]('Action,\x20%s,\x20%s,\x20%s',_0x55ae65,_0x2d38('0xe'),JSON[_0x2d38('0xf')](_0x5f20a4));if(_0x5f20a4[_0x2d38('0x10')]){if(_0x5f20a4[_0x2d38('0x10')][_0x2d38('0x11')]===0x1f4){logger[_0x2d38('0x10')](_0x2d38('0xc'),_0x55ae65,_0x5f20a4['error'][_0x2d38('0x12')]);return _0x39ebfd(_0x5f20a4[_0x2d38('0x10')][_0x2d38('0x12')]);}logger[_0x2d38('0x10')](_0x2d38('0xc'),_0x55ae65,_0x5f20a4['error'][_0x2d38('0x12')]);return _0x3fb88f(_0x5f20a4[_0x2d38('0x10')][_0x2d38('0x12')]);}else{logger[_0x2d38('0xb')](_0x2d38('0xc'),_0x55ae65,_0x2d38('0xe'));_0x3fb88f(_0x5f20a4[_0x2d38('0x13')][_0x2d38('0x12')]);}})[_0x2d38('0x14')](function(_0x6d2a9a){logger[_0x2d38('0x10')](_0x2d38('0xc'),_0x55ae65,_0x6d2a9a);_0x39ebfd(_0x6d2a9a);});});} \ No newline at end of file +var _0xb0d9=['ioredis','../../config/utils','jayson/promise','client','http','request','info','Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x58ab22,_0x42c988){var _0x3bedba=function(_0x121f16){while(--_0x121f16){_0x58ab22['push'](_0x58ab22['shift']());}};_0x3bedba(++_0x42c988);}(_0xb0d9,0x10c));var _0x9b0d=function(_0x31c6fb,_0x1e3db7){_0x31c6fb=_0x31c6fb-0x0;var _0x414d8f=_0xb0d9[_0x31c6fb];return _0x414d8f;};'use strict';var _=require(_0x9b0d('0x0'));var util=require(_0x9b0d('0x1'));var moment=require(_0x9b0d('0x2'));var BPromise=require(_0x9b0d('0x3'));var rs=require(_0x9b0d('0x4'));var fs=require('fs');var Redis=require(_0x9b0d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9b0d('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9b0d('0x7'));var client=jayson[_0x9b0d('0x8')][_0x9b0d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x438e0a,_0x2c519d,_0x45c371){return new BPromise(function(_0x32ee67,_0x30cd11){return client[_0x9b0d('0xa')](_0x438e0a,_0x45c371)['then'](function(_0x479a06){logger[_0x9b0d('0xb')](_0x9b0d('0xc'),_0x2c519d,'request\x20sent');logger[_0x9b0d('0xd')](_0x9b0d('0xe'),_0x2c519d,'request\x20sent',JSON[_0x9b0d('0xf')](_0x479a06));if(_0x479a06[_0x9b0d('0x10')]){if(_0x479a06['error'][_0x9b0d('0x11')]===0x1f4){logger['error'](_0x9b0d('0xc'),_0x2c519d,_0x479a06[_0x9b0d('0x10')][_0x9b0d('0x12')]);return _0x30cd11(_0x479a06['error'][_0x9b0d('0x12')]);}logger['error'](_0x9b0d('0xc'),_0x2c519d,_0x479a06[_0x9b0d('0x10')]['message']);return _0x32ee67(_0x479a06[_0x9b0d('0x10')]['message']);}else{logger[_0x9b0d('0xb')](_0x9b0d('0xc'),_0x2c519d,_0x9b0d('0x13'));_0x32ee67(_0x479a06['result'][_0x9b0d('0x12')]);}})[_0x9b0d('0x14')](function(_0x49db91){logger['error']('Action,\x20%s,\x20%s',_0x2c519d,_0x49db91);_0x30cd11(_0x49db91);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 142d2a5..7b53860 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 _0x8c50=['exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','put','update','delete','isAuthenticated'];(function(_0x232a6c,_0x22572e){var _0x17cf55=function(_0x56fa84){while(--_0x56fa84){_0x232a6c['push'](_0x232a6c['shift']());}};_0x17cf55(++_0x22572e);}(_0x8c50,0xcd));var _0x08c5=function(_0x483606,_0x4e67dc){_0x483606=_0x483606-0x0;var _0x2c7b8a=_0x8c50[_0x483606];return _0x2c7b8a;};'use strict';var multer=require('multer');var util=require(_0x08c5('0x0'));var path=require(_0x08c5('0x1'));var timeout=require('connect-timeout');var express=require(_0x08c5('0x2'));var router=express[_0x08c5('0x3')]();var auth=require(_0x08c5('0x4'));var interaction=require(_0x08c5('0x5'));var config=require(_0x08c5('0x6'));var controller=require('./action.controller');router[_0x08c5('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x08c5('0x8')]);router[_0x08c5('0x9')]('/:id',auth[_0x08c5('0xa')](),controller['destroy']);module[_0x08c5('0xb')]=router; \ No newline at end of file +var _0x317b=['isAuthenticated','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id'];(function(_0x1347f8,_0x233feb){var _0x218368=function(_0x3f4ca3){while(--_0x3f4ca3){_0x1347f8['push'](_0x1347f8['shift']());}};_0x218368(++_0x233feb);}(_0x317b,0x1c7));var _0xb317=function(_0xfb28d8,_0xba70c){_0xfb28d8=_0xfb28d8-0x0;var _0x1296bd=_0x317b[_0xfb28d8];return _0x1296bd;};'use strict';var multer=require(_0xb317('0x0'));var util=require(_0xb317('0x1'));var path=require('path');var timeout=require(_0xb317('0x2'));var express=require(_0xb317('0x3'));var router=express['Router']();var auth=require(_0xb317('0x4'));var interaction=require(_0xb317('0x5'));var config=require(_0xb317('0x6'));var controller=require(_0xb317('0x7'));router[_0xb317('0x8')](_0xb317('0x9'),auth[_0xb317('0xa')](),controller[_0xb317('0xb')]);router[_0xb317('0xc')](_0xb317('0x9'),auth['isAuthenticated'](),controller[_0xb317('0xd')]);module[_0xb317('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index c740afb..7fb23a1 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 _0x24cb=['sequelize','exports','STRING','TEXT'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x24cb,0x9c));var _0xb24c=function(_0x11946c,_0x12152c){_0x11946c=_0x11946c-0x0;var _0x383935=_0x24cb[_0x11946c];return _0x383935;};'use strict';var Sequelize=require(_0xb24c('0x0'));module[_0xb24c('0x1')]={'name':{'type':Sequelize[_0xb24c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb24c('0x2')]},'parent':{'type':Sequelize[_0xb24c('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xb24c('0x3')]},'joins':{'type':Sequelize[_0xb24c('0x3')]}}; \ No newline at end of file +var _0x0939=['sequelize','STRING','TEXT'];(function(_0x14ea4c,_0x16710a){var _0x32328d=function(_0x6a5896){while(--_0x6a5896){_0x14ea4c['push'](_0x14ea4c['shift']());}};_0x32328d(++_0x16710a);}(_0x0939,0x87));var _0x9093=function(_0x215f1c,_0x22c333){_0x215f1c=_0x215f1c-0x0;var _0x5419c1=_0x0939[_0x215f1c];return _0x5419c1;};'use strict';var Sequelize=require(_0x9093('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x9093('0x1')]},'conditions':{'type':Sequelize[_0x9093('0x2')]},'joins':{'type':Sequelize[_0x9093('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index a085955..c1b4a9f 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 _0xa8b6=['clone','QueryTypes','No\x20available\x20data','web','fullPath','%s-%s.%s','randomstring','generate','output','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','run','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','update','then','destroy','end','error','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','day','add','merge','where','filter','map','options','AnalyticCustomReport','includeAll','include','findAll','rows','catch','show','params','create','body','find','preview','join','left_join','right_join','outer_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','condition','value','getFields','Sequelize','AnalyticMetric','keyBy','select','from','MetricId','metric','field','function','replace','groupBy','group','orderBy','order','DESC','alias','parse','joins','type','includes','parentKey','foreignTable','foreignKey','format','%s.%s\x20=\x20%s.%s','table','conditions','debug','Limited\x20Query:','toString','sequelize','SELECT','COUNT(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field'];(function(_0x5b9874,_0x327bd2){var _0x3c38ff=function(_0x44dd30){while(--_0x44dd30){_0x5b9874['push'](_0x5b9874['shift']());}};_0x3c38ff(++_0x327bd2);}(_0xa8b6,0xb7));var _0x6a8b=function(_0x107cd9,_0x83d61){_0x107cd9=_0x107cd9-0x0;var _0x253c22=_0xa8b6[_0x107cd9];return _0x253c22;};'use strict';var pdf=require(_0x6a8b('0x0'));var emlformat=require(_0x6a8b('0x1'));var rimraf=require(_0x6a8b('0x2'));var zipdir=require(_0x6a8b('0x3'));var jsonpatch=require(_0x6a8b('0x4'));var rp=require(_0x6a8b('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6a8b('0x6'));var util=require(_0x6a8b('0x7'));var path=require(_0x6a8b('0x8'));var sox=require('sox');var csv=require(_0x6a8b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x6a8b('0xa'));var crypto=require('crypto');var jsforce=require(_0x6a8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6a8b('0x9'));var querystring=require(_0x6a8b('0xc'));var Papa=require('papaparse');var Redis=require(_0x6a8b('0xd'));var qs=require(_0x6a8b('0xe'));var logger=require(_0x6a8b('0xf'))(_0x6a8b('0x10'));var utils=require(_0x6a8b('0x11'));var config=require(_0x6a8b('0x12'));var db=require(_0x6a8b('0x13'))['db'];function respondWithStatusCode(_0x47ddf0,_0x2ff446){_0x2ff446=_0x2ff446||0xcc;return function(_0x10bf36){if(_0x10bf36){return _0x47ddf0[_0x6a8b('0x14')](_0x2ff446);}return _0x47ddf0[_0x6a8b('0x15')](_0x2ff446)['end']();};}function respondWithResult(_0x53e854,_0x79a08e){_0x79a08e=_0x79a08e||0xc8;return function(_0x6c4a5){if(_0x6c4a5){return _0x53e854[_0x6a8b('0x15')](_0x79a08e)[_0x6a8b('0x16')](_0x6c4a5);}};}function respondWithFilteredResult(_0x47ae57,_0xb1cf9){return function(_0xcc7e79){if(_0xcc7e79){var _0x4e10e4=_0xcc7e79[_0x6a8b('0x17')],_0x539c7b=_0xb1cf9[_0x6a8b('0x18')],_0xd9ad5a=_0xb1cf9['offset']+_0xb1cf9[_0x6a8b('0x19')],_0x3a77dc;if(_0xd9ad5a>=_0x4e10e4){_0xd9ad5a=_0x4e10e4;_0x3a77dc=0xc8;}else{_0x3a77dc=0xce;}_0x47ae57[_0x6a8b('0x15')](_0x3a77dc);return _0x47ae57[_0x6a8b('0x1a')](_0x6a8b('0x1b'),_0x539c7b+'-'+_0xd9ad5a+'/'+_0x4e10e4)[_0x6a8b('0x16')](_0xcc7e79);}return null;};}function patchUpdates(_0x585254){return function(_0x175623){try{jsonpatch['apply'](_0x175623,_0x585254,!![]);}catch(_0x36a3a6){return BPromise['reject'](_0x36a3a6);}return _0x175623['save']();};}function saveUpdates(_0x2c82a2,_0x51b0a4){return function(_0x4089d4){if(_0x4089d4){return _0x4089d4[_0x6a8b('0x1c')](_0x2c82a2)[_0x6a8b('0x1d')](function(_0x2585be){return _0x2585be;});}return null;};}function removeEntity(_0x25e457,_0x4ad17c){return function(_0x199308){if(_0x199308){return _0x199308[_0x6a8b('0x1e')]()['then'](function(){_0x25e457['status'](0xcc)[_0x6a8b('0x1f')]();});}};}function handleEntityNotFound(_0x56df5f,_0x5ec402){return function(_0xe0cc0f){if(!_0xe0cc0f){_0x56df5f[_0x6a8b('0x14')](0x194);}return _0xe0cc0f;};}function handleError(_0x3d81e6,_0xc346c2){_0xc346c2=_0xc346c2||0x1f4;return function(_0x6aa0cd){logger[_0x6a8b('0x20')](_0x6aa0cd['stack']);if(_0x6aa0cd[_0x6a8b('0x21')]){delete _0x6aa0cd['name'];}_0x3d81e6[_0x6a8b('0x15')](_0xc346c2)[_0x6a8b('0x22')](_0x6aa0cd);};}exports[_0x6a8b('0x23')]=function(_0x25a467,_0x503a45){var _0x21186b={},_0x24e2c2={},_0xa96497={'count':0x0,'rows':[]};var _0x53d86a=db['AnalyticCustomReport'][_0x6a8b('0x24')];_0x24e2c2[_0x6a8b('0x25')]=_[_0x6a8b('0x26')](_0x53d86a);var _0x1e835a={'dateStart':_0x25a467[_0x6a8b('0x27')][_0x6a8b('0x28')],'dateEnd':_0x25a467[_0x6a8b('0x27')][_0x6a8b('0x29')]};delete _0x25a467['query'][_0x6a8b('0x28')];delete _0x25a467['query'][_0x6a8b('0x29')];_0x24e2c2[_0x6a8b('0x27')]=_[_0x6a8b('0x26')](_0x25a467[_0x6a8b('0x27')]);_0x24e2c2[_0x6a8b('0x2a')]=_[_0x6a8b('0x2b')](_0x24e2c2[_0x6a8b('0x25')],_0x24e2c2[_0x6a8b('0x27')]);_0x21186b[_0x6a8b('0x2c')]=_[_0x6a8b('0x2b')](_0x24e2c2[_0x6a8b('0x25')],qs[_0x6a8b('0x2d')](_0x25a467['query'][_0x6a8b('0x2d')]));_0x21186b['attributes']=_0x21186b['attributes'][_0x6a8b('0x2e')]?_0x21186b[_0x6a8b('0x2c')]:_0x24e2c2[_0x6a8b('0x25')];if(!_0x25a467[_0x6a8b('0x27')][_0x6a8b('0x2f')](_0x6a8b('0x30'))){_0x21186b[_0x6a8b('0x19')]=qs[_0x6a8b('0x19')](_0x25a467[_0x6a8b('0x27')]['limit']);_0x21186b[_0x6a8b('0x18')]=qs[_0x6a8b('0x18')](_0x25a467[_0x6a8b('0x27')][_0x6a8b('0x18')]);}_0x21186b['order']=qs['sort'](_0x25a467[_0x6a8b('0x27')][_0x6a8b('0x31')]);_0x21186b['where']=qs['filters'](_[_0x6a8b('0x32')](_0x25a467[_0x6a8b('0x27')],_0x24e2c2[_0x6a8b('0x2a')]));if(_0x1e835a[_0x6a8b('0x28')]){if(_0x1e835a[_0x6a8b('0x29')]){_0x1e835a['dateEnd']=moment(_0x1e835a[_0x6a8b('0x29')])['add'](0x1,_0x6a8b('0x33'));}else{_0x1e835a[_0x6a8b('0x29')]=moment(_0x1e835a['dateStart'])[_0x6a8b('0x34')](0x1,_0x6a8b('0x33'));}_[_0x6a8b('0x35')](_0x21186b[_0x6a8b('0x36')],{'createdAt':{'$gte':_0x1e835a[_0x6a8b('0x28')],'$lte':_0x1e835a[_0x6a8b('0x29')]}});}if(_0x25a467[_0x6a8b('0x27')][_0x6a8b('0x37')]){_0x21186b['where']=_[_0x6a8b('0x35')](_0x21186b[_0x6a8b('0x36')],{'$or':_[_0x6a8b('0x38')](_0x21186b[_0x6a8b('0x2c')],function(_0xdd4daf){var _0xbc9bd6={};_0xbc9bd6[_0xdd4daf]={'$like':'%'+_0x25a467[_0x6a8b('0x27')][_0x6a8b('0x37')]+'%'};return _0xbc9bd6;})});}_0x21186b=_[_0x6a8b('0x35')]({},_0x21186b,_0x25a467[_0x6a8b('0x39')]);var _0x1a98e9={'where':_0x21186b[_0x6a8b('0x36')]};return db[_0x6a8b('0x3a')][_0x6a8b('0x17')](_0x1a98e9)[_0x6a8b('0x1d')](function(_0x4569d5){_0xa96497['count']=_0x4569d5;if(_0x25a467[_0x6a8b('0x27')][_0x6a8b('0x3b')]){_0x21186b[_0x6a8b('0x3c')]=[{'all':!![]}];}return db[_0x6a8b('0x3a')][_0x6a8b('0x3d')](_0x21186b);})[_0x6a8b('0x1d')](function(_0xee62da){_0xa96497[_0x6a8b('0x3e')]=_0xee62da;return _0xa96497;})['then'](respondWithFilteredResult(_0x503a45,_0x21186b))[_0x6a8b('0x3f')](handleError(_0x503a45,null));};exports[_0x6a8b('0x40')]=function(_0xd8fd65,_0x39d5e5){var _0x460b4c={'raw':![],'where':{'id':_0xd8fd65[_0x6a8b('0x41')]['id']}},_0x590154={};_0x590154[_0x6a8b('0x25')]=_[_0x6a8b('0x26')](db[_0x6a8b('0x3a')][_0x6a8b('0x24')]);_0x590154[_0x6a8b('0x27')]=_[_0x6a8b('0x26')](_0xd8fd65[_0x6a8b('0x27')]);_0x590154['filters']=_[_0x6a8b('0x2b')](_0x590154[_0x6a8b('0x25')],_0x590154[_0x6a8b('0x27')]);_0x460b4c[_0x6a8b('0x2c')]=_['intersection'](_0x590154[_0x6a8b('0x25')],qs[_0x6a8b('0x2d')](_0xd8fd65[_0x6a8b('0x27')]['fields']));_0x460b4c['attributes']=_0x460b4c[_0x6a8b('0x2c')]['length']?_0x460b4c[_0x6a8b('0x2c')]:_0x590154[_0x6a8b('0x25')];if(_0xd8fd65['query'][_0x6a8b('0x3b')]){_0x460b4c['include']=[{'all':!![]}];}_0x460b4c=_[_0x6a8b('0x35')]({},_0x460b4c,_0xd8fd65[_0x6a8b('0x39')]);return db['AnalyticCustomReport']['find'](_0x460b4c)['then'](handleEntityNotFound(_0x39d5e5,null))[_0x6a8b('0x1d')](respondWithResult(_0x39d5e5,null))['catch'](handleError(_0x39d5e5,null));};exports['create']=function(_0xcbb678,_0x468d4d){return db[_0x6a8b('0x3a')][_0x6a8b('0x42')](_0xcbb678[_0x6a8b('0x43')],{})[_0x6a8b('0x1d')](respondWithResult(_0x468d4d,0xc9))['catch'](handleError(_0x468d4d,null));};exports['update']=function(_0x1e84b8,_0x47caf6){if(_0x1e84b8['body']['id']){delete _0x1e84b8[_0x6a8b('0x43')]['id'];}return db['AnalyticCustomReport'][_0x6a8b('0x44')]({'where':{'id':_0x1e84b8[_0x6a8b('0x41')]['id']}})['then'](handleEntityNotFound(_0x47caf6,null))[_0x6a8b('0x1d')](saveUpdates(_0x1e84b8[_0x6a8b('0x43')],null))['then'](respondWithResult(_0x47caf6,null))[_0x6a8b('0x3f')](handleError(_0x47caf6,null));};exports[_0x6a8b('0x1e')]=function(_0xf8ec73,_0x1ce8f1){return db[_0x6a8b('0x3a')]['find']({'where':{'id':_0xf8ec73[_0x6a8b('0x41')]['id']}})[_0x6a8b('0x1d')](handleEntityNotFound(_0x1ce8f1,null))['then'](removeEntity(_0x1ce8f1,null))[_0x6a8b('0x3f')](handleError(_0x1ce8f1,null));};exports[_0x6a8b('0x45')]=function(_0x688779,_0xd69da7){var _0x2fed2c=0xa;var _0x3ee284=[_0x6a8b('0x46'),_0x6a8b('0x47'),_0x6a8b('0x48'),_0x6a8b('0x49'),_0x6a8b('0x4a')];var _0x5e7a3f={'SUM':_0x6a8b('0x4b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x6a8b('0x4c'),'MAX':_0x6a8b('0x4d'),'MIN':_0x6a8b('0x4e'),'AVG':_0x6a8b('0x4f'),'GROUP_CONCAT':_0x6a8b('0x50'),'GROUP_CONCAT ASC':_0x6a8b('0x51'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5bd165={'SEC_TO_TIME':_0x6a8b('0x52'),'DATE':'DATE(%s)','HOUR':_0x6a8b('0x53'),'ROUND':_0x6a8b('0x54'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x85c0f1=function(_0x29cd84){return!_['includes']([_0x6a8b('0x55'),_0x6a8b('0x56'),_0x6a8b('0x57'),'IS\x20NOT\x20EMPTY'],_0x29cd84);};var _0x16d2a2=function(_0x17ed9a){if(!_0x17ed9a||!_0x17ed9a[_0x6a8b('0x58')][_0x6a8b('0x2e')]){return'';}for(var _0x20185a='(',_0x4d50b0=0x0;_0x4d50b0<_0x17ed9a[_0x6a8b('0x58')][_0x6a8b('0x2e')];_0x4d50b0+=0x1){_0x4d50b0>0x0&&(_0x20185a+='\x20'+_0x17ed9a[_0x6a8b('0x59')]+'\x20');_0x20185a+=_0x17ed9a[_0x6a8b('0x58')][_0x4d50b0]['group']?_0x16d2a2(_0x17ed9a[_0x6a8b('0x58')][_0x4d50b0]['group']):_0x17ed9a[_0x6a8b('0x58')][_0x4d50b0]['field']+'\x20'+_0x17ed9a[_0x6a8b('0x58')][_0x4d50b0][_0x6a8b('0x5a')]+(_0x85c0f1(_0x17ed9a[_0x6a8b('0x58')][_0x4d50b0]['condition'])?'\x20'+_0x17ed9a['rules'][_0x4d50b0][_0x6a8b('0x5b')]:'');}return _0x20185a+')';};var _0xf44945={'where':{'id':_0x688779[_0x6a8b('0x41')]['id']}},_0x144aeb,_0x5b7881,_0x43015c,_0x202c97,_0x4d318a;_0xf44945=_[_0x6a8b('0x35')]({},_0xf44945,_0x688779[_0x6a8b('0x39')]);return db['AnalyticCustomReport'][_0x6a8b('0x44')](_0xf44945)[_0x6a8b('0x1d')](function(_0xbc6a81){if(_0xbc6a81){_0x144aeb=_0xbc6a81;return _0xbc6a81[_0x6a8b('0x5c')]();}return null;})[_0x6a8b('0x1d')](function(_0xd419ab){if(_0xd419ab){if(!_0xd419ab[_0x6a8b('0x2e')]){throw new db[(_0x6a8b('0x5d'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5b7881=_0xd419ab;return db[_0x6a8b('0x5e')]['findAll']({'raw':!![]});}return null;})[_0x6a8b('0x1d')](function(_0x179db4){if(_0x179db4){_0x43015c=_[_0x6a8b('0x5f')](_0x179db4,'id');var _0x3a8895;var _0x3f4d6f=squel[_0x6a8b('0x60')]();_0x3f4d6f[_0x6a8b('0x61')](_0x144aeb['table']);for(var _0x5b1cf2=0x0;_0x5b1cf2<_0x5b7881['length'];_0x5b1cf2+=0x1){_0x3a8895=_0x5b7881[_0x5b1cf2]['MetricId']?_0x43015c[_0x5b7881[_0x5b1cf2][_0x6a8b('0x62')]][_0x6a8b('0x63')]:_0x5b7881[_0x5b1cf2][_0x6a8b('0x64')];_0x3a8895=_0x5b7881[_0x5b1cf2][_0x6a8b('0x65')]?_[_0x6a8b('0x66')](_0x5e7a3f[_0x5b7881[_0x5b1cf2][_0x6a8b('0x65')]],'%s',_0x3a8895):_0x3a8895;_0x3a8895=_0x5b7881[_0x5b1cf2]['format']?_[_0x6a8b('0x66')](_0x5bd165[_0x5b7881[_0x5b1cf2]['format']],'%s',_0x3a8895):_0x3a8895;if(_0x5b7881[_0x5b1cf2][_0x6a8b('0x67')]){_0x3f4d6f[_0x6a8b('0x68')](_0x3a8895);}_0x5b7881[_0x5b1cf2][_0x6a8b('0x69')]&&_0x3f4d6f[_0x6a8b('0x6a')](_0x3a8895,_0x5b7881[_0x5b1cf2][_0x6a8b('0x69')]===_0x6a8b('0x6b')?![]:!![]);_0x3f4d6f[_0x6a8b('0x64')](_0x3a8895,_0x5b7881[_0x5b1cf2][_0x6a8b('0x6c')]||_0x3a8895);}if(_0x144aeb['joins']){_0x144aeb['joins']=JSON[_0x6a8b('0x6d')](_0x144aeb[_0x6a8b('0x6e')]);for(var _0x2e952b=0x0;_0x2e952b<_0x144aeb[_0x6a8b('0x6e')][_0x6a8b('0x2e')];_0x2e952b+=0x1){if(_0x144aeb['joins'][_0x2e952b][_0x6a8b('0x6f')]&&_[_0x6a8b('0x70')](_0x3ee284,_0x144aeb[_0x6a8b('0x6e')][_0x2e952b][_0x6a8b('0x6f')])&&_0x144aeb['joins'][_0x2e952b][_0x6a8b('0x71')]&&_0x144aeb[_0x6a8b('0x6e')][_0x2e952b][_0x6a8b('0x72')]&&_0x144aeb[_0x6a8b('0x6e')][_0x2e952b][_0x6a8b('0x73')]){_0x3f4d6f[_0x144aeb[_0x6a8b('0x6e')][_0x2e952b]['type']](_0x144aeb[_0x6a8b('0x6e')][_0x2e952b][_0x6a8b('0x72')],null,util[_0x6a8b('0x74')](_0x6a8b('0x75'),_0x144aeb[_0x6a8b('0x76')],_0x144aeb[_0x6a8b('0x6e')][_0x2e952b]['parentKey'],_0x144aeb[_0x6a8b('0x6e')][_0x2e952b][_0x6a8b('0x72')],_0x144aeb[_0x6a8b('0x6e')][_0x2e952b][_0x6a8b('0x73')]));}}}if(_0x144aeb[_0x6a8b('0x77')]){_0x144aeb['conditions']=JSON[_0x6a8b('0x6d')](_0x144aeb['conditions']);_0x3f4d6f[_0x6a8b('0x36')](_0x16d2a2(_0x144aeb[_0x6a8b('0x77')][_0x6a8b('0x68')]));}_0x4d318a=_0x3f4d6f['clone']();_0x3f4d6f[_0x6a8b('0x19')](_0x2fed2c);_0x3f4d6f['offset'](0x0);logger[_0x6a8b('0x78')](_0x6a8b('0x79'),_0x3f4d6f[_0x6a8b('0x7a')]());return db[_0x6a8b('0x7b')]['query'](_0x3f4d6f['toString'](),{'type':db[_0x6a8b('0x7b')]['QueryTypes'][_0x6a8b('0x7c')]});}})['then'](respondWithResult(_0xd69da7,null))['catch'](handleError(_0xd69da7,null));};function runReport(_0x4de4c4,_0x3a328e,_0xaa3410){var _0x539dd9=_0x3a328e['name'];var _0x552c85=0xa;var _0x5394a3=[_0x6a8b('0x46'),'left_join',_0x6a8b('0x48'),_0x6a8b('0x49'),'cross_join'];var _0x5368ba={'SUM':_0x6a8b('0x4b'),'COUNT':_0x6a8b('0x7d'),'COUNT DISTINCT':_0x6a8b('0x4c'),'MAX':'MAX(%s)','MIN':_0x6a8b('0x4e'),'AVG':_0x6a8b('0x4f'),'GROUP_CONCAT':_0x6a8b('0x50'),'GROUP_CONCAT ASC':_0x6a8b('0x51'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3fcb5f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x6a8b('0x7e'),'HOUR':_0x6a8b('0x53'),'ROUND':_0x6a8b('0x54'),'UNIX_TIMESTAMP':_0x6a8b('0x7f')};var _0x2729b2=function(_0x3c0be5){return!_[_0x6a8b('0x70')]([_0x6a8b('0x55'),_0x6a8b('0x56'),_0x6a8b('0x57'),_0x6a8b('0x80')],_0x3c0be5);};var _0x215087=function(_0x5a10de){if(!_0x5a10de||!_0x5a10de['rules']['length']){return'';}for(var _0x56ff4f='(',_0x4007cc=0x0;_0x4007cc<_0x5a10de[_0x6a8b('0x58')][_0x6a8b('0x2e')];_0x4007cc+=0x1){_0x4007cc>0x0&&(_0x56ff4f+='\x20'+_0x5a10de[_0x6a8b('0x59')]+'\x20');_0x56ff4f+=_0x5a10de[_0x6a8b('0x58')][_0x4007cc][_0x6a8b('0x68')]?_0x215087(_0x5a10de[_0x6a8b('0x58')][_0x4007cc][_0x6a8b('0x68')]):_0x5a10de[_0x6a8b('0x58')][_0x4007cc][_0x6a8b('0x64')]+'\x20'+_0x5a10de[_0x6a8b('0x58')][_0x4007cc][_0x6a8b('0x5a')]+(_0x2729b2(_0x5a10de[_0x6a8b('0x58')][_0x4007cc][_0x6a8b('0x5a')])?'\x20'+_0x5a10de[_0x6a8b('0x58')][_0x4007cc][_0x6a8b('0x5b')]:'');}return _0x56ff4f+')';};var _0x2de745={'where':{'id':_0x4de4c4['id']}},_0x1c6e6c,_0x15c1ee,_0x305c5f,_0x4c5074,_0x40f830;_0x2de745=_[_0x6a8b('0x35')]({},_0x2de745,_0xaa3410);return db[_0x6a8b('0x3a')][_0x6a8b('0x44')](_0x2de745)[_0x6a8b('0x1d')](function(_0x17ad32){if(_0x17ad32){_0x1c6e6c=_0x17ad32;return _0x17ad32[_0x6a8b('0x5c')]();}return null;})[_0x6a8b('0x1d')](function(_0x39ef17){if(_0x39ef17){if(!_0x39ef17[_0x6a8b('0x2e')]){throw new db['Sequelize'][(_0x6a8b('0x81'))](_0x6a8b('0x82'),0x193);}_0x15c1ee=_0x39ef17;return db[_0x6a8b('0x5e')]['findAll']({'raw':!![]});}return null;})[_0x6a8b('0x1d')](function(_0x195b5c){if(_0x195b5c){_0x305c5f=_[_0x6a8b('0x5f')](_0x195b5c,'id');var _0x939371;var _0x388a6a=squel[_0x6a8b('0x60')]();_0x388a6a['from'](_0x1c6e6c['table']);for(var _0x43f45f=0x0;_0x43f45f<_0x15c1ee[_0x6a8b('0x2e')];_0x43f45f+=0x1){_0x939371=_0x15c1ee[_0x43f45f][_0x6a8b('0x62')]?_0x305c5f[_0x15c1ee[_0x43f45f]['MetricId']]['metric']:_0x15c1ee[_0x43f45f][_0x6a8b('0x64')];_0x939371=_0x15c1ee[_0x43f45f]['function']?_[_0x6a8b('0x66')](_0x5368ba[_0x15c1ee[_0x43f45f][_0x6a8b('0x65')]],'%s',_0x939371):_0x939371;_0x939371=_0x15c1ee[_0x43f45f]['format']?_[_0x6a8b('0x66')](_0x3fcb5f[_0x15c1ee[_0x43f45f]['format']],'%s',_0x939371):_0x939371;if(_0x15c1ee[_0x43f45f][_0x6a8b('0x67')]){_0x388a6a[_0x6a8b('0x68')](_0x939371);}_0x15c1ee[_0x43f45f]['orderBy']&&_0x388a6a[_0x6a8b('0x6a')](_0x939371,_0x15c1ee[_0x43f45f][_0x6a8b('0x69')]===_0x6a8b('0x6b')?![]:!![]);_0x388a6a[_0x6a8b('0x64')](_0x939371,_0x15c1ee[_0x43f45f]['alias']||_0x939371);}if(_0x1c6e6c['joins']){_0x1c6e6c[_0x6a8b('0x6e')]=JSON[_0x6a8b('0x6d')](_0x1c6e6c[_0x6a8b('0x6e')]);for(var _0x50aa90=0x0;_0x50aa90<_0x1c6e6c[_0x6a8b('0x6e')][_0x6a8b('0x2e')];_0x50aa90+=0x1){if(_0x1c6e6c[_0x6a8b('0x6e')][_0x50aa90][_0x6a8b('0x6f')]&&_['includes'](_0x5394a3,_0x1c6e6c['joins'][_0x50aa90][_0x6a8b('0x6f')])&&_0x1c6e6c[_0x6a8b('0x6e')][_0x50aa90][_0x6a8b('0x71')]&&_0x1c6e6c[_0x6a8b('0x6e')][_0x50aa90][_0x6a8b('0x72')]&&_0x1c6e6c[_0x6a8b('0x6e')][_0x50aa90][_0x6a8b('0x73')]){_0x388a6a[_0x1c6e6c[_0x6a8b('0x6e')][_0x50aa90][_0x6a8b('0x6f')]](_0x1c6e6c[_0x6a8b('0x6e')][_0x50aa90]['foreignTable'],null,util[_0x6a8b('0x74')](_0x6a8b('0x75'),_0x1c6e6c[_0x6a8b('0x76')],_0x1c6e6c[_0x6a8b('0x6e')][_0x50aa90]['parentKey'],_0x1c6e6c['joins'][_0x50aa90]['foreignTable'],_0x1c6e6c['joins'][_0x50aa90][_0x6a8b('0x73')]));}}}if(_0x1c6e6c[_0x6a8b('0x77')]){_0x1c6e6c[_0x6a8b('0x77')]=JSON[_0x6a8b('0x6d')](_0x1c6e6c[_0x6a8b('0x77')]);_0x388a6a['where'](_0x215087(_0x1c6e6c[_0x6a8b('0x77')]['group']));}_0x40f830=_0x388a6a[_0x6a8b('0x83')]();_0x388a6a[_0x6a8b('0x19')](_0x552c85);_0x388a6a[_0x6a8b('0x18')](0x0);logger[_0x6a8b('0x78')](_0x6a8b('0x79'),_0x388a6a['toString']());return db['sequelize']['query'](_0x388a6a[_0x6a8b('0x7a')](),{'type':db[_0x6a8b('0x7b')][_0x6a8b('0x84')][_0x6a8b('0x7c')]});}})[_0x6a8b('0x1d')](function(_0x19a731){if(!_0x19a731[_0x6a8b('0x2e')]){throw new db[(_0x6a8b('0x5d'))][(_0x6a8b('0x81'))](_0x6a8b('0x85'),0xcc);}if(_0x3a328e['output']===_0x6a8b('0x86')){return null;}var _0x15f03e=_['merge'](_0x3a328e,{'name':_0x3a328e[_0x6a8b('0x87')]||_0x3a328e[_0x6a8b('0x21')]||_0x1c6e6c[_0x6a8b('0x21')],'basename':_0x539dd9,'savename':util[_0x6a8b('0x74')](_0x6a8b('0x88'),_0x3a328e[_0x6a8b('0x21')]||_0x1c6e6c[_0x6a8b('0x21')],require(_0x6a8b('0x89'))[_0x6a8b('0x8a')](0x4),_0x3a328e[_0x6a8b('0x8b')]||_0x6a8b('0x8c'))});return db[_0x6a8b('0x8d')][_0x6a8b('0x42')](_0x15f03e,{'raw':!![]});})[_0x6a8b('0x1d')](function(_0xa27e82){if(_0x1c6e6c[_0x6a8b('0x76')]===_0x6a8b('0x8e')){_0x40f830[_0x6a8b('0x36')](_0x1c6e6c[_0x6a8b('0x76')]+_0x6a8b('0x8f'),_0x3a328e[_0x6a8b('0x90')],_0x3a328e['endDate']);}else{_0x40f830[_0x6a8b('0x36')](_0x1c6e6c[_0x6a8b('0x76')]+_0x6a8b('0x91'),_0x3a328e[_0x6a8b('0x90')],_0x3a328e[_0x6a8b('0x92')]);}if(_0xa27e82){logger[_0x6a8b('0x93')]('Run\x20Query:',_0x40f830['toString']());require(_0x6a8b('0x94'))[_0x6a8b('0x95')](path[_0x6a8b('0x46')](__dirname,_0x6a8b('0x96'),_0xa27e82['output']),[_0xa27e82['id'],_0x40f830[_0x6a8b('0x7a')](),path[_0x6a8b('0x46')](__dirname,'../../files/reports',_0xa27e82[_0x6a8b('0x97')]),_0x539dd9]);return _0xa27e82;}else{var _0x189b7d=squel[_0x6a8b('0x60')]();_0x189b7d[_0x6a8b('0x61')]('('+_0x40f830['toString']()+')',_0x6a8b('0x98'));_0x189b7d[_0x6a8b('0x64')](_0x6a8b('0x99'),_0x6a8b('0x17'));_0x40f830[_0x6a8b('0x19')](_0x3a328e[_0x6a8b('0x19')]||_0x552c85);_0x40f830[_0x6a8b('0x18')](_0x3a328e[_0x6a8b('0x18')]||0x0);return db[_0x6a8b('0x7b')][_0x6a8b('0x27')](_0x189b7d[_0x6a8b('0x7a')](),{'type':db[_0x6a8b('0x7b')]['QueryTypes'][_0x6a8b('0x7c')]})[_0x6a8b('0x1d')](function(_0x4ccb98){if(!_0x4ccb98[_0x6a8b('0x2e')]){_0x4c5074=0x0;}else{_0x4c5074=_0x4ccb98[0x0][_0x6a8b('0x17')]||0x0;}return db[_0x6a8b('0x7b')][_0x6a8b('0x27')](_0x40f830[_0x6a8b('0x7a')](),{'type':db[_0x6a8b('0x7b')][_0x6a8b('0x84')][_0x6a8b('0x7c')]});})[_0x6a8b('0x1d')](function(_0x275e60){return{'rows':_0x275e60||[],'count':_0x4c5074};});}});}exports[_0x6a8b('0x9a')]=function(_0x1f049e,_0x37260a){return runReport(_0x1f049e[_0x6a8b('0x41')],_0x1f049e['query'],_0x1f049e[_0x6a8b('0x39')])['then'](respondWithResult(_0x37260a,null))[_0x6a8b('0x3f')](handleError(_0x37260a,null));};exports[_0x6a8b('0x9b')]=runReport;exports[_0x6a8b('0x27')]=function(_0x478632,_0x340b24){var _0x5ee898=0xa;var _0x42962b=[_0x6a8b('0x46'),'left_join',_0x6a8b('0x48'),_0x6a8b('0x49'),_0x6a8b('0x4a')];var _0x463225={'SUM':_0x6a8b('0x4b'),'COUNT':_0x6a8b('0x7d'),'COUNT DISTINCT':_0x6a8b('0x4c'),'MAX':_0x6a8b('0x4d'),'MIN':_0x6a8b('0x4e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x6a8b('0x50'),'GROUP_CONCAT ASC':_0x6a8b('0x51'),'GROUP_CONCAT DESC':_0x6a8b('0x9c')};var _0x58d856={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x6a8b('0x53'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x6a8b('0x7f')};var _0x2a79ee=function(_0x2a7a52){return!_[_0x6a8b('0x70')](['IS\x20NULL',_0x6a8b('0x56'),_0x6a8b('0x57'),_0x6a8b('0x80')],_0x2a7a52);};var _0x587d5d=function(_0x35d12b){if(!_0x35d12b||!_0x35d12b[_0x6a8b('0x58')]['length']){return'';}for(var _0x1209cf='(',_0x35d0ad=0x0;_0x35d0ad<_0x35d12b[_0x6a8b('0x58')]['length'];_0x35d0ad+=0x1){_0x35d0ad>0x0&&(_0x1209cf+='\x20'+_0x35d12b[_0x6a8b('0x59')]+'\x20');_0x1209cf+=_0x35d12b[_0x6a8b('0x58')][_0x35d0ad][_0x6a8b('0x68')]?_0x587d5d(_0x35d12b[_0x6a8b('0x58')][_0x35d0ad]['group']):_0x35d12b[_0x6a8b('0x58')][_0x35d0ad][_0x6a8b('0x64')]+'\x20'+_0x35d12b[_0x6a8b('0x58')][_0x35d0ad][_0x6a8b('0x5a')]+(_0x2a79ee(_0x35d12b['rules'][_0x35d0ad][_0x6a8b('0x5a')])?'\x20'+_0x35d12b[_0x6a8b('0x58')][_0x35d0ad][_0x6a8b('0x5b')]:'');}return _0x1209cf+')';};var _0x1a500c={'where':{'id':_0x478632[_0x6a8b('0x41')]['id']}},_0x28ba20,_0x1f451c,_0x2dd955,_0x25ffd0,_0x44a300;_0x1a500c=_[_0x6a8b('0x35')]({},_0x1a500c,_0x478632[_0x6a8b('0x39')]);return db[_0x6a8b('0x3a')][_0x6a8b('0x44')](_0x1a500c)[_0x6a8b('0x1d')](function(_0x3be671){if(_0x3be671){_0x28ba20=_0x3be671;return _0x3be671[_0x6a8b('0x5c')]();}return null;})[_0x6a8b('0x1d')](function(_0x4fec8a){if(_0x4fec8a){if(!_0x4fec8a['length']){throw new db[(_0x6a8b('0x5d'))]['ValidationErrorItem'](_0x6a8b('0x82'),0x193);}_0x1f451c=_0x4fec8a;return db[_0x6a8b('0x5e')][_0x6a8b('0x3d')]({'raw':!![]});}return null;})[_0x6a8b('0x1d')](function(_0x1983a7){if(_0x1983a7){_0x2dd955=_[_0x6a8b('0x5f')](_0x1983a7,'id');var _0xdf3968;var _0x2de37d=squel['select']();_0x2de37d[_0x6a8b('0x61')](_0x28ba20[_0x6a8b('0x76')]);for(var _0x5218ea=0x0;_0x5218ea<_0x1f451c['length'];_0x5218ea+=0x1){_0xdf3968=_0x1f451c[_0x5218ea][_0x6a8b('0x62')]?_0x2dd955[_0x1f451c[_0x5218ea][_0x6a8b('0x62')]][_0x6a8b('0x63')]:_0x1f451c[_0x5218ea][_0x6a8b('0x64')];_0xdf3968=_0x1f451c[_0x5218ea][_0x6a8b('0x65')]?_[_0x6a8b('0x66')](_0x463225[_0x1f451c[_0x5218ea][_0x6a8b('0x65')]],'%s',_0xdf3968):_0xdf3968;_0xdf3968=_0x1f451c[_0x5218ea][_0x6a8b('0x74')]?_[_0x6a8b('0x66')](_0x58d856[_0x1f451c[_0x5218ea][_0x6a8b('0x74')]],'%s',_0xdf3968):_0xdf3968;if(_0x1f451c[_0x5218ea]['groupBy']){_0x2de37d[_0x6a8b('0x68')](_0xdf3968);}_0x1f451c[_0x5218ea][_0x6a8b('0x69')]&&_0x2de37d[_0x6a8b('0x6a')](_0xdf3968,_0x1f451c[_0x5218ea]['orderBy']===_0x6a8b('0x6b')?![]:!![]);_0x2de37d[_0x6a8b('0x64')](_0xdf3968,_0x1f451c[_0x5218ea][_0x6a8b('0x6c')]||_0xdf3968);}if(_0x28ba20[_0x6a8b('0x6e')]){_0x28ba20[_0x6a8b('0x6e')]=JSON[_0x6a8b('0x6d')](_0x28ba20['joins']);for(var _0x2f2544=0x0;_0x2f2544<_0x28ba20[_0x6a8b('0x6e')][_0x6a8b('0x2e')];_0x2f2544+=0x1){if(_0x28ba20[_0x6a8b('0x6e')][_0x2f2544][_0x6a8b('0x6f')]&&_[_0x6a8b('0x70')](_0x42962b,_0x28ba20[_0x6a8b('0x6e')][_0x2f2544][_0x6a8b('0x6f')])&&_0x28ba20[_0x6a8b('0x6e')][_0x2f2544][_0x6a8b('0x71')]&&_0x28ba20[_0x6a8b('0x6e')][_0x2f2544]['foreignTable']&&_0x28ba20['joins'][_0x2f2544][_0x6a8b('0x73')]){_0x2de37d[_0x28ba20[_0x6a8b('0x6e')][_0x2f2544][_0x6a8b('0x6f')]](_0x28ba20[_0x6a8b('0x6e')][_0x2f2544][_0x6a8b('0x72')],null,util['format'](_0x6a8b('0x75'),_0x28ba20['table'],_0x28ba20[_0x6a8b('0x6e')][_0x2f2544][_0x6a8b('0x71')],_0x28ba20[_0x6a8b('0x6e')][_0x2f2544]['foreignTable'],_0x28ba20[_0x6a8b('0x6e')][_0x2f2544][_0x6a8b('0x73')]));}}}if(_0x28ba20[_0x6a8b('0x77')]){_0x28ba20[_0x6a8b('0x77')]=JSON[_0x6a8b('0x6d')](_0x28ba20[_0x6a8b('0x77')]);_0x2de37d['where'](_0x587d5d(_0x28ba20[_0x6a8b('0x77')][_0x6a8b('0x68')]));}_0x44a300=_0x2de37d[_0x6a8b('0x83')]();_0x2de37d[_0x6a8b('0x19')](_0x5ee898);_0x2de37d[_0x6a8b('0x18')](0x0);logger[_0x6a8b('0x78')](_0x6a8b('0x79'),_0x2de37d[_0x6a8b('0x7a')]());return db['sequelize'][_0x6a8b('0x27')](_0x2de37d[_0x6a8b('0x7a')](),{'type':db[_0x6a8b('0x7b')][_0x6a8b('0x84')][_0x6a8b('0x7c')]});}})[_0x6a8b('0x1d')](function(){return{'sql':_0x44a300[_0x6a8b('0x7a')]()};})[_0x6a8b('0x1d')](respondWithResult(_0x340b24,null))[_0x6a8b('0x3f')](handleError(_0x340b24,null));}; \ No newline at end of file +var _0x86e0=['util','path','sox','squel','crypto','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','error','stack','name','send','index','AnalyticCustomReport','rawAttributes','model','keys','dateStart','query','dateEnd','filters','attributes','fields','hasOwnProperty','order','sort','where','add','day','merge','filter','map','options','rows','show','params','intersection','length','includeAll','find','catch','create','body','destroy','preview','left_join','right_join','outer_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','MetricId','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','includes','type','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','toString','sequelize','QueryTypes','join','cross_join','MAX(%s)','SEC_TO_TIME(%s)','DATE(%s)','metric','table','clone','Limited\x20Query:','SELECT','ValidationErrorItem','No\x20available\x20data','output','web','fullPath','generate','csv','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','run','COUNT(DISTINCT\x20%s)','ROUND(%s)','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x38b602,_0x57ccd5){var _0x310d16=function(_0x5aca1a){while(--_0x5aca1a){_0x38b602['push'](_0x38b602['shift']());}};_0x310d16(++_0x57ccd5);}(_0x86e0,0x90));var _0x086e=function(_0x116f35,_0x52aad5){_0x116f35=_0x116f35-0x0;var _0x28cf0a=_0x86e0[_0x116f35];return _0x28cf0a;};'use strict';var pdf=require(_0x086e('0x0'));var emlformat=require(_0x086e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x086e('0x2'));var jsonpatch=require(_0x086e('0x3'));var rp=require(_0x086e('0x4'));var moment=require(_0x086e('0x5'));var BPromise=require(_0x086e('0x6'));var Mustache=require(_0x086e('0x7'));var util=require(_0x086e('0x8'));var path=require(_0x086e('0x9'));var sox=require(_0x086e('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x086e('0xb'));var crypto=require(_0x086e('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x086e('0xd'));var querystring=require('querystring');var Papa=require(_0x086e('0xe'));var Redis=require(_0x086e('0xf'));var qs=require(_0x086e('0x10'));var logger=require(_0x086e('0x11'))(_0x086e('0x12'));var utils=require(_0x086e('0x13'));var config=require('../../config/environment');var db=require(_0x086e('0x14'))['db'];function respondWithStatusCode(_0x3b284e,_0x5f50b2){_0x5f50b2=_0x5f50b2||0xcc;return function(_0x57a9e0){if(_0x57a9e0){return _0x3b284e['sendStatus'](_0x5f50b2);}return _0x3b284e[_0x086e('0x15')](_0x5f50b2)[_0x086e('0x16')]();};}function respondWithResult(_0x25ce7a,_0x2e3864){_0x2e3864=_0x2e3864||0xc8;return function(_0x1b0908){if(_0x1b0908){return _0x25ce7a[_0x086e('0x15')](_0x2e3864)[_0x086e('0x17')](_0x1b0908);}};}function respondWithFilteredResult(_0x1943f2,_0x1541dc){return function(_0x4dc918){if(_0x4dc918){var _0x6346bc=_0x4dc918[_0x086e('0x18')],_0x7e016=_0x1541dc[_0x086e('0x19')],_0xeae2cb=_0x1541dc[_0x086e('0x19')]+_0x1541dc[_0x086e('0x1a')],_0x4153d4;if(_0xeae2cb>=_0x6346bc){_0xeae2cb=_0x6346bc;_0x4153d4=0xc8;}else{_0x4153d4=0xce;}_0x1943f2[_0x086e('0x15')](_0x4153d4);return _0x1943f2['set'](_0x086e('0x1b'),_0x7e016+'-'+_0xeae2cb+'/'+_0x6346bc)[_0x086e('0x17')](_0x4dc918);}return null;};}function patchUpdates(_0x4d085b){return function(_0xd25bd5){try{jsonpatch['apply'](_0xd25bd5,_0x4d085b,!![]);}catch(_0x2dcabc){return BPromise[_0x086e('0x1c')](_0x2dcabc);}return _0xd25bd5[_0x086e('0x1d')]();};}function saveUpdates(_0x17fc7d,_0xbaae90){return function(_0x37d413){if(_0x37d413){return _0x37d413[_0x086e('0x1e')](_0x17fc7d)[_0x086e('0x1f')](function(_0xf5d8ca){return _0xf5d8ca;});}return null;};}function removeEntity(_0x2ee3b8,_0x27b726){return function(_0x176593){if(_0x176593){return _0x176593['destroy']()[_0x086e('0x1f')](function(){_0x2ee3b8[_0x086e('0x15')](0xcc)[_0x086e('0x16')]();});}};}function handleEntityNotFound(_0xffda2f,_0x429a51){return function(_0x866a9a){if(!_0x866a9a){_0xffda2f['sendStatus'](0x194);}return _0x866a9a;};}function handleError(_0x2cfc36,_0x2e1694){_0x2e1694=_0x2e1694||0x1f4;return function(_0x3334ae){logger[_0x086e('0x20')](_0x3334ae[_0x086e('0x21')]);if(_0x3334ae['name']){delete _0x3334ae[_0x086e('0x22')];}_0x2cfc36['status'](_0x2e1694)[_0x086e('0x23')](_0x3334ae);};}exports[_0x086e('0x24')]=function(_0x52542e,_0x21cd97){var _0x462bc8={},_0x2918af={},_0x1d2dc5={'count':0x0,'rows':[]};var _0x4eeff3=db[_0x086e('0x25')][_0x086e('0x26')];_0x2918af[_0x086e('0x27')]=_[_0x086e('0x28')](_0x4eeff3);var _0x2a43a6={'dateStart':_0x52542e['query'][_0x086e('0x29')],'dateEnd':_0x52542e[_0x086e('0x2a')][_0x086e('0x2b')]};delete _0x52542e['query'][_0x086e('0x29')];delete _0x52542e[_0x086e('0x2a')][_0x086e('0x2b')];_0x2918af[_0x086e('0x2a')]=_[_0x086e('0x28')](_0x52542e[_0x086e('0x2a')]);_0x2918af[_0x086e('0x2c')]=_['intersection'](_0x2918af['model'],_0x2918af[_0x086e('0x2a')]);_0x462bc8[_0x086e('0x2d')]=_['intersection'](_0x2918af['model'],qs[_0x086e('0x2e')](_0x52542e[_0x086e('0x2a')][_0x086e('0x2e')]));_0x462bc8[_0x086e('0x2d')]=_0x462bc8['attributes']['length']?_0x462bc8[_0x086e('0x2d')]:_0x2918af[_0x086e('0x27')];if(!_0x52542e['query'][_0x086e('0x2f')]('nolimit')){_0x462bc8[_0x086e('0x1a')]=qs[_0x086e('0x1a')](_0x52542e[_0x086e('0x2a')]['limit']);_0x462bc8['offset']=qs[_0x086e('0x19')](_0x52542e[_0x086e('0x2a')][_0x086e('0x19')]);}_0x462bc8[_0x086e('0x30')]=qs['sort'](_0x52542e[_0x086e('0x2a')][_0x086e('0x31')]);_0x462bc8[_0x086e('0x32')]=qs[_0x086e('0x2c')](_['pick'](_0x52542e[_0x086e('0x2a')],_0x2918af['filters']));if(_0x2a43a6[_0x086e('0x29')]){if(_0x2a43a6[_0x086e('0x2b')]){_0x2a43a6[_0x086e('0x2b')]=moment(_0x2a43a6['dateEnd'])[_0x086e('0x33')](0x1,_0x086e('0x34'));}else{_0x2a43a6[_0x086e('0x2b')]=moment(_0x2a43a6[_0x086e('0x29')])[_0x086e('0x33')](0x1,_0x086e('0x34'));}_[_0x086e('0x35')](_0x462bc8['where'],{'createdAt':{'$gte':_0x2a43a6[_0x086e('0x29')],'$lte':_0x2a43a6[_0x086e('0x2b')]}});}if(_0x52542e['query'][_0x086e('0x36')]){_0x462bc8['where']=_[_0x086e('0x35')](_0x462bc8[_0x086e('0x32')],{'$or':_[_0x086e('0x37')](_0x462bc8['attributes'],function(_0x43cbe9){var _0x2387e8={};_0x2387e8[_0x43cbe9]={'$like':'%'+_0x52542e['query'][_0x086e('0x36')]+'%'};return _0x2387e8;})});}_0x462bc8=_[_0x086e('0x35')]({},_0x462bc8,_0x52542e[_0x086e('0x38')]);var _0x5b2978={'where':_0x462bc8[_0x086e('0x32')]};return db['AnalyticCustomReport'][_0x086e('0x18')](_0x5b2978)['then'](function(_0x3bfd9b){_0x1d2dc5[_0x086e('0x18')]=_0x3bfd9b;if(_0x52542e['query']['includeAll']){_0x462bc8['include']=[{'all':!![]}];}return db[_0x086e('0x25')]['findAll'](_0x462bc8);})[_0x086e('0x1f')](function(_0x5af635){_0x1d2dc5[_0x086e('0x39')]=_0x5af635;return _0x1d2dc5;})['then'](respondWithFilteredResult(_0x21cd97,_0x462bc8))['catch'](handleError(_0x21cd97,null));};exports[_0x086e('0x3a')]=function(_0x4465ee,_0x19e65a){var _0x44a686={'raw':![],'where':{'id':_0x4465ee[_0x086e('0x3b')]['id']}},_0x277a4e={};_0x277a4e[_0x086e('0x27')]=_[_0x086e('0x28')](db[_0x086e('0x25')]['rawAttributes']);_0x277a4e['query']=_[_0x086e('0x28')](_0x4465ee[_0x086e('0x2a')]);_0x277a4e[_0x086e('0x2c')]=_[_0x086e('0x3c')](_0x277a4e[_0x086e('0x27')],_0x277a4e[_0x086e('0x2a')]);_0x44a686[_0x086e('0x2d')]=_[_0x086e('0x3c')](_0x277a4e['model'],qs[_0x086e('0x2e')](_0x4465ee[_0x086e('0x2a')][_0x086e('0x2e')]));_0x44a686['attributes']=_0x44a686[_0x086e('0x2d')][_0x086e('0x3d')]?_0x44a686[_0x086e('0x2d')]:_0x277a4e[_0x086e('0x27')];if(_0x4465ee[_0x086e('0x2a')][_0x086e('0x3e')]){_0x44a686['include']=[{'all':!![]}];}_0x44a686=_[_0x086e('0x35')]({},_0x44a686,_0x4465ee['options']);return db[_0x086e('0x25')][_0x086e('0x3f')](_0x44a686)[_0x086e('0x1f')](handleEntityNotFound(_0x19e65a,null))[_0x086e('0x1f')](respondWithResult(_0x19e65a,null))[_0x086e('0x40')](handleError(_0x19e65a,null));};exports[_0x086e('0x41')]=function(_0x180f3a,_0xea22f7){return db[_0x086e('0x25')][_0x086e('0x41')](_0x180f3a[_0x086e('0x42')],{})[_0x086e('0x1f')](respondWithResult(_0xea22f7,0xc9))[_0x086e('0x40')](handleError(_0xea22f7,null));};exports[_0x086e('0x1e')]=function(_0x418a12,_0x24848d){if(_0x418a12[_0x086e('0x42')]['id']){delete _0x418a12[_0x086e('0x42')]['id'];}return db[_0x086e('0x25')]['find']({'where':{'id':_0x418a12[_0x086e('0x3b')]['id']}})[_0x086e('0x1f')](handleEntityNotFound(_0x24848d,null))[_0x086e('0x1f')](saveUpdates(_0x418a12[_0x086e('0x42')],null))[_0x086e('0x1f')](respondWithResult(_0x24848d,null))[_0x086e('0x40')](handleError(_0x24848d,null));};exports[_0x086e('0x43')]=function(_0x407b47,_0x52e706){return db[_0x086e('0x25')][_0x086e('0x3f')]({'where':{'id':_0x407b47[_0x086e('0x3b')]['id']}})[_0x086e('0x1f')](handleEntityNotFound(_0x52e706,null))[_0x086e('0x1f')](removeEntity(_0x52e706,null))[_0x086e('0x40')](handleError(_0x52e706,null));};exports[_0x086e('0x44')]=function(_0x55c918,_0x418c9d){var _0x33f784=0xa;var _0x206290=['join',_0x086e('0x45'),_0x086e('0x46'),_0x086e('0x47'),'cross_join'];var _0x58821c={'SUM':_0x086e('0x48'),'COUNT':_0x086e('0x49'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x086e('0x4a'),'AVG':_0x086e('0x4b'),'GROUP_CONCAT':_0x086e('0x4c'),'GROUP_CONCAT ASC':_0x086e('0x4d'),'GROUP_CONCAT DESC':_0x086e('0x4e')};var _0x332e7a={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x086e('0x4f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x086e('0x50')};var _0x128920=function(_0x3536f3){return!_['includes']([_0x086e('0x51'),_0x086e('0x52'),_0x086e('0x53'),_0x086e('0x54')],_0x3536f3);};var _0x28c2e1=function(_0x5dc61b){if(!_0x5dc61b||!_0x5dc61b[_0x086e('0x55')][_0x086e('0x3d')]){return'';}for(var _0x4d1443='(',_0xfd866c=0x0;_0xfd866c<_0x5dc61b[_0x086e('0x55')][_0x086e('0x3d')];_0xfd866c+=0x1){_0xfd866c>0x0&&(_0x4d1443+='\x20'+_0x5dc61b[_0x086e('0x56')]+'\x20');_0x4d1443+=_0x5dc61b['rules'][_0xfd866c][_0x086e('0x57')]?_0x28c2e1(_0x5dc61b[_0x086e('0x55')][_0xfd866c][_0x086e('0x57')]):_0x5dc61b[_0x086e('0x55')][_0xfd866c]['field']+'\x20'+_0x5dc61b[_0x086e('0x55')][_0xfd866c][_0x086e('0x58')]+(_0x128920(_0x5dc61b[_0x086e('0x55')][_0xfd866c][_0x086e('0x58')])?'\x20'+_0x5dc61b[_0x086e('0x55')][_0xfd866c][_0x086e('0x59')]:'');}return _0x4d1443+')';};var _0x490310={'where':{'id':_0x55c918[_0x086e('0x3b')]['id']}},_0x1c4b10,_0x60df4,_0x7abe9d,_0x14d7a2,_0xcd78f3;_0x490310=_['merge']({},_0x490310,_0x55c918[_0x086e('0x38')]);return db[_0x086e('0x25')][_0x086e('0x3f')](_0x490310)['then'](function(_0x3258df){if(_0x3258df){_0x1c4b10=_0x3258df;return _0x3258df[_0x086e('0x5a')]();}return null;})[_0x086e('0x1f')](function(_0x3bbfb2){if(_0x3bbfb2){if(!_0x3bbfb2[_0x086e('0x3d')]){throw new db[(_0x086e('0x5b'))]['ValidationErrorItem'](_0x086e('0x5c'),0x193);}_0x60df4=_0x3bbfb2;return db[_0x086e('0x5d')][_0x086e('0x5e')]({'raw':!![]});}return null;})[_0x086e('0x1f')](function(_0x306cd4){if(_0x306cd4){_0x7abe9d=_[_0x086e('0x5f')](_0x306cd4,'id');var _0x51af77;var _0x2edff9=squel[_0x086e('0x60')]();_0x2edff9[_0x086e('0x61')](_0x1c4b10['table']);for(var _0x3d288c=0x0;_0x3d288c<_0x60df4[_0x086e('0x3d')];_0x3d288c+=0x1){_0x51af77=_0x60df4[_0x3d288c][_0x086e('0x62')]?_0x7abe9d[_0x60df4[_0x3d288c][_0x086e('0x62')]]['metric']:_0x60df4[_0x3d288c][_0x086e('0x63')];_0x51af77=_0x60df4[_0x3d288c][_0x086e('0x64')]?_['replace'](_0x58821c[_0x60df4[_0x3d288c][_0x086e('0x64')]],'%s',_0x51af77):_0x51af77;_0x51af77=_0x60df4[_0x3d288c]['format']?_[_0x086e('0x65')](_0x332e7a[_0x60df4[_0x3d288c][_0x086e('0x66')]],'%s',_0x51af77):_0x51af77;if(_0x60df4[_0x3d288c][_0x086e('0x67')]){_0x2edff9['group'](_0x51af77);}_0x60df4[_0x3d288c][_0x086e('0x68')]&&_0x2edff9[_0x086e('0x30')](_0x51af77,_0x60df4[_0x3d288c]['orderBy']===_0x086e('0x69')?![]:!![]);_0x2edff9['field'](_0x51af77,_0x60df4[_0x3d288c][_0x086e('0x6a')]||_0x51af77);}if(_0x1c4b10[_0x086e('0x6b')]){_0x1c4b10[_0x086e('0x6b')]=JSON[_0x086e('0x6c')](_0x1c4b10[_0x086e('0x6b')]);for(var _0x4dd465=0x0;_0x4dd465<_0x1c4b10[_0x086e('0x6b')][_0x086e('0x3d')];_0x4dd465+=0x1){if(_0x1c4b10[_0x086e('0x6b')][_0x4dd465]['type']&&_[_0x086e('0x6d')](_0x206290,_0x1c4b10[_0x086e('0x6b')][_0x4dd465][_0x086e('0x6e')])&&_0x1c4b10['joins'][_0x4dd465][_0x086e('0x6f')]&&_0x1c4b10['joins'][_0x4dd465][_0x086e('0x70')]&&_0x1c4b10[_0x086e('0x6b')][_0x4dd465][_0x086e('0x71')]){_0x2edff9[_0x1c4b10[_0x086e('0x6b')][_0x4dd465]['type']](_0x1c4b10[_0x086e('0x6b')][_0x4dd465][_0x086e('0x70')],null,util[_0x086e('0x66')](_0x086e('0x72'),_0x1c4b10['table'],_0x1c4b10[_0x086e('0x6b')][_0x4dd465][_0x086e('0x6f')],_0x1c4b10[_0x086e('0x6b')][_0x4dd465]['foreignTable'],_0x1c4b10[_0x086e('0x6b')][_0x4dd465][_0x086e('0x71')]));}}}if(_0x1c4b10[_0x086e('0x73')]){_0x1c4b10['conditions']=JSON[_0x086e('0x6c')](_0x1c4b10[_0x086e('0x73')]);_0x2edff9[_0x086e('0x32')](_0x28c2e1(_0x1c4b10[_0x086e('0x73')][_0x086e('0x57')]));}_0xcd78f3=_0x2edff9['clone']();_0x2edff9[_0x086e('0x1a')](_0x33f784);_0x2edff9[_0x086e('0x19')](0x0);logger[_0x086e('0x74')]('Limited\x20Query:',_0x2edff9[_0x086e('0x75')]());return db[_0x086e('0x76')][_0x086e('0x2a')](_0x2edff9[_0x086e('0x75')](),{'type':db[_0x086e('0x76')][_0x086e('0x77')]['SELECT']});}})[_0x086e('0x1f')](respondWithResult(_0x418c9d,null))[_0x086e('0x40')](handleError(_0x418c9d,null));};function runReport(_0x481b1d,_0x4cd481,_0x1a767f){var _0x2913fb=_0x4cd481['name'];var _0x1b0f35=0xa;var _0x7b0969=[_0x086e('0x78'),_0x086e('0x45'),_0x086e('0x46'),_0x086e('0x47'),_0x086e('0x79')];var _0x55740e={'SUM':_0x086e('0x48'),'COUNT':_0x086e('0x49'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x086e('0x7a'),'MIN':_0x086e('0x4a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x086e('0x4c'),'GROUP_CONCAT ASC':_0x086e('0x4d'),'GROUP_CONCAT DESC':_0x086e('0x4e')};var _0x38aa6f={'SEC_TO_TIME':_0x086e('0x7b'),'DATE':_0x086e('0x7c'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1d9ebb=function(_0x173348){return!_[_0x086e('0x6d')]([_0x086e('0x51'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x086e('0x54')],_0x173348);};var _0x3f3f22=function(_0x355ce5){if(!_0x355ce5||!_0x355ce5[_0x086e('0x55')][_0x086e('0x3d')]){return'';}for(var _0x3a6cb4='(',_0x2ea637=0x0;_0x2ea637<_0x355ce5['rules'][_0x086e('0x3d')];_0x2ea637+=0x1){_0x2ea637>0x0&&(_0x3a6cb4+='\x20'+_0x355ce5[_0x086e('0x56')]+'\x20');_0x3a6cb4+=_0x355ce5[_0x086e('0x55')][_0x2ea637][_0x086e('0x57')]?_0x3f3f22(_0x355ce5[_0x086e('0x55')][_0x2ea637]['group']):_0x355ce5[_0x086e('0x55')][_0x2ea637][_0x086e('0x63')]+'\x20'+_0x355ce5['rules'][_0x2ea637][_0x086e('0x58')]+(_0x1d9ebb(_0x355ce5[_0x086e('0x55')][_0x2ea637][_0x086e('0x58')])?'\x20'+_0x355ce5[_0x086e('0x55')][_0x2ea637]['value']:'');}return _0x3a6cb4+')';};var _0x3abb16={'where':{'id':_0x481b1d['id']}},_0x1db3f4,_0x1ec2c8,_0xe4fb5b,_0x124d50,_0x3e3481;_0x3abb16=_[_0x086e('0x35')]({},_0x3abb16,_0x1a767f);return db[_0x086e('0x25')]['find'](_0x3abb16)[_0x086e('0x1f')](function(_0x32f648){if(_0x32f648){_0x1db3f4=_0x32f648;return _0x32f648[_0x086e('0x5a')]();}return null;})['then'](function(_0x431625){if(_0x431625){if(!_0x431625[_0x086e('0x3d')]){throw new db[(_0x086e('0x5b'))]['ValidationErrorItem'](_0x086e('0x5c'),0x193);}_0x1ec2c8=_0x431625;return db[_0x086e('0x5d')][_0x086e('0x5e')]({'raw':!![]});}return null;})['then'](function(_0x55807d){if(_0x55807d){_0xe4fb5b=_[_0x086e('0x5f')](_0x55807d,'id');var _0x4335a8;var _0x46754e=squel[_0x086e('0x60')]();_0x46754e[_0x086e('0x61')](_0x1db3f4['table']);for(var _0x28ae58=0x0;_0x28ae58<_0x1ec2c8[_0x086e('0x3d')];_0x28ae58+=0x1){_0x4335a8=_0x1ec2c8[_0x28ae58]['MetricId']?_0xe4fb5b[_0x1ec2c8[_0x28ae58][_0x086e('0x62')]][_0x086e('0x7d')]:_0x1ec2c8[_0x28ae58][_0x086e('0x63')];_0x4335a8=_0x1ec2c8[_0x28ae58]['function']?_[_0x086e('0x65')](_0x55740e[_0x1ec2c8[_0x28ae58][_0x086e('0x64')]],'%s',_0x4335a8):_0x4335a8;_0x4335a8=_0x1ec2c8[_0x28ae58][_0x086e('0x66')]?_[_0x086e('0x65')](_0x38aa6f[_0x1ec2c8[_0x28ae58]['format']],'%s',_0x4335a8):_0x4335a8;if(_0x1ec2c8[_0x28ae58][_0x086e('0x67')]){_0x46754e['group'](_0x4335a8);}_0x1ec2c8[_0x28ae58][_0x086e('0x68')]&&_0x46754e[_0x086e('0x30')](_0x4335a8,_0x1ec2c8[_0x28ae58][_0x086e('0x68')]===_0x086e('0x69')?![]:!![]);_0x46754e[_0x086e('0x63')](_0x4335a8,_0x1ec2c8[_0x28ae58]['alias']||_0x4335a8);}if(_0x1db3f4[_0x086e('0x6b')]){_0x1db3f4['joins']=JSON[_0x086e('0x6c')](_0x1db3f4[_0x086e('0x6b')]);for(var _0x55346b=0x0;_0x55346b<_0x1db3f4[_0x086e('0x6b')][_0x086e('0x3d')];_0x55346b+=0x1){if(_0x1db3f4[_0x086e('0x6b')][_0x55346b][_0x086e('0x6e')]&&_[_0x086e('0x6d')](_0x7b0969,_0x1db3f4['joins'][_0x55346b][_0x086e('0x6e')])&&_0x1db3f4[_0x086e('0x6b')][_0x55346b][_0x086e('0x6f')]&&_0x1db3f4[_0x086e('0x6b')][_0x55346b][_0x086e('0x70')]&&_0x1db3f4[_0x086e('0x6b')][_0x55346b][_0x086e('0x71')]){_0x46754e[_0x1db3f4[_0x086e('0x6b')][_0x55346b]['type']](_0x1db3f4[_0x086e('0x6b')][_0x55346b]['foreignTable'],null,util['format'](_0x086e('0x72'),_0x1db3f4[_0x086e('0x7e')],_0x1db3f4[_0x086e('0x6b')][_0x55346b][_0x086e('0x6f')],_0x1db3f4['joins'][_0x55346b][_0x086e('0x70')],_0x1db3f4[_0x086e('0x6b')][_0x55346b][_0x086e('0x71')]));}}}if(_0x1db3f4[_0x086e('0x73')]){_0x1db3f4[_0x086e('0x73')]=JSON['parse'](_0x1db3f4[_0x086e('0x73')]);_0x46754e[_0x086e('0x32')](_0x3f3f22(_0x1db3f4[_0x086e('0x73')][_0x086e('0x57')]));}_0x3e3481=_0x46754e[_0x086e('0x7f')]();_0x46754e['limit'](_0x1b0f35);_0x46754e['offset'](0x0);logger[_0x086e('0x74')](_0x086e('0x80'),_0x46754e[_0x086e('0x75')]());return db[_0x086e('0x76')][_0x086e('0x2a')](_0x46754e[_0x086e('0x75')](),{'type':db[_0x086e('0x76')][_0x086e('0x77')][_0x086e('0x81')]});}})['then'](function(_0x6a6a32){if(!_0x6a6a32[_0x086e('0x3d')]){throw new db['Sequelize'][(_0x086e('0x82'))](_0x086e('0x83'),0xcc);}if(_0x4cd481[_0x086e('0x84')]===_0x086e('0x85')){return null;}var _0x22985b=_['merge'](_0x4cd481,{'name':_0x4cd481[_0x086e('0x86')]||_0x4cd481[_0x086e('0x22')]||_0x1db3f4[_0x086e('0x22')],'basename':_0x2913fb,'savename':util[_0x086e('0x66')]('%s-%s.%s',_0x4cd481[_0x086e('0x22')]||_0x1db3f4[_0x086e('0x22')],require('randomstring')[_0x086e('0x87')](0x4),_0x4cd481[_0x086e('0x84')]||_0x086e('0x88'))});return db[_0x086e('0x89')]['create'](_0x22985b,{'raw':!![]});})[_0x086e('0x1f')](function(_0x3c6da6){if(_0x1db3f4[_0x086e('0x7e')]===_0x086e('0x8a')){_0x3e3481['where'](_0x1db3f4[_0x086e('0x7e')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x4cd481[_0x086e('0x8b')],_0x4cd481[_0x086e('0x8c')]);}else{_0x3e3481[_0x086e('0x32')](_0x1db3f4[_0x086e('0x7e')]+_0x086e('0x8d'),_0x4cd481[_0x086e('0x8b')],_0x4cd481[_0x086e('0x8c')]);}if(_0x3c6da6){logger[_0x086e('0x8e')]('Run\x20Query:',_0x3e3481['toString']());require(_0x086e('0x8f'))[_0x086e('0x90')](path[_0x086e('0x78')](__dirname,_0x086e('0x91'),_0x3c6da6[_0x086e('0x84')]),[_0x3c6da6['id'],_0x3e3481['toString'](),path[_0x086e('0x78')](__dirname,'../../files/reports',_0x3c6da6[_0x086e('0x92')]),_0x2913fb]);return _0x3c6da6;}else{var _0x1a8e8e=squel[_0x086e('0x60')]();_0x1a8e8e[_0x086e('0x61')]('('+_0x3e3481[_0x086e('0x75')]()+')',_0x086e('0x93'));_0x1a8e8e[_0x086e('0x63')](_0x086e('0x94'),_0x086e('0x18'));_0x3e3481[_0x086e('0x1a')](_0x4cd481[_0x086e('0x1a')]||_0x1b0f35);_0x3e3481[_0x086e('0x19')](_0x4cd481['offset']||0x0);return db[_0x086e('0x76')][_0x086e('0x2a')](_0x1a8e8e[_0x086e('0x75')](),{'type':db[_0x086e('0x76')]['QueryTypes'][_0x086e('0x81')]})[_0x086e('0x1f')](function(_0x25b6e1){if(!_0x25b6e1['length']){_0x124d50=0x0;}else{_0x124d50=_0x25b6e1[0x0][_0x086e('0x18')]||0x0;}return db['sequelize']['query'](_0x3e3481[_0x086e('0x75')](),{'type':db[_0x086e('0x76')][_0x086e('0x77')][_0x086e('0x81')]});})[_0x086e('0x1f')](function(_0x13bb08){return{'rows':_0x13bb08||[],'count':_0x124d50};});}});}exports[_0x086e('0x95')]=function(_0x51e812,_0x5d1461){return runReport(_0x51e812[_0x086e('0x3b')],_0x51e812[_0x086e('0x2a')],_0x51e812['options'])[_0x086e('0x1f')](respondWithResult(_0x5d1461,null))['catch'](handleError(_0x5d1461,null));};exports['runReport']=runReport;exports['query']=function(_0x11aba8,_0x1c4ac0){var _0x26d254=0xa;var _0xc4c3ac=[_0x086e('0x78'),_0x086e('0x45'),_0x086e('0x46'),_0x086e('0x47'),_0x086e('0x79')];var _0x3112d2={'SUM':_0x086e('0x48'),'COUNT':_0x086e('0x49'),'COUNT DISTINCT':_0x086e('0x96'),'MAX':'MAX(%s)','MIN':_0x086e('0x4a'),'AVG':_0x086e('0x4b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x086e('0x4d'),'GROUP_CONCAT DESC':_0x086e('0x4e')};var _0x18c6b5={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x086e('0x7c'),'HOUR':'HOUR(%s)','ROUND':_0x086e('0x97'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x566e3a=function(_0x2ad844){return!_[_0x086e('0x6d')]([_0x086e('0x51'),_0x086e('0x52'),_0x086e('0x53'),_0x086e('0x54')],_0x2ad844);};var _0xa1e35d=function(_0x527eec){if(!_0x527eec||!_0x527eec['rules'][_0x086e('0x3d')]){return'';}for(var _0x5adb8b='(',_0x289f6b=0x0;_0x289f6b<_0x527eec[_0x086e('0x55')][_0x086e('0x3d')];_0x289f6b+=0x1){_0x289f6b>0x0&&(_0x5adb8b+='\x20'+_0x527eec[_0x086e('0x56')]+'\x20');_0x5adb8b+=_0x527eec[_0x086e('0x55')][_0x289f6b][_0x086e('0x57')]?_0xa1e35d(_0x527eec[_0x086e('0x55')][_0x289f6b][_0x086e('0x57')]):_0x527eec[_0x086e('0x55')][_0x289f6b][_0x086e('0x63')]+'\x20'+_0x527eec[_0x086e('0x55')][_0x289f6b][_0x086e('0x58')]+(_0x566e3a(_0x527eec[_0x086e('0x55')][_0x289f6b][_0x086e('0x58')])?'\x20'+_0x527eec['rules'][_0x289f6b][_0x086e('0x59')]:'');}return _0x5adb8b+')';};var _0x572e9e={'where':{'id':_0x11aba8['params']['id']}},_0x62809c,_0x5dfca2,_0xa0fd07,_0x21b435,_0x4f27cb;_0x572e9e=_['merge']({},_0x572e9e,_0x11aba8[_0x086e('0x38')]);return db[_0x086e('0x25')]['find'](_0x572e9e)[_0x086e('0x1f')](function(_0x2f2feb){if(_0x2f2feb){_0x62809c=_0x2f2feb;return _0x2f2feb[_0x086e('0x5a')]();}return null;})['then'](function(_0x33aa88){if(_0x33aa88){if(!_0x33aa88[_0x086e('0x3d')]){throw new db[(_0x086e('0x5b'))][(_0x086e('0x82'))](_0x086e('0x5c'),0x193);}_0x5dfca2=_0x33aa88;return db[_0x086e('0x5d')][_0x086e('0x5e')]({'raw':!![]});}return null;})['then'](function(_0x25f83c){if(_0x25f83c){_0xa0fd07=_[_0x086e('0x5f')](_0x25f83c,'id');var _0x48c9a8;var _0x520ec7=squel['select']();_0x520ec7[_0x086e('0x61')](_0x62809c[_0x086e('0x7e')]);for(var _0x297de0=0x0;_0x297de0<_0x5dfca2[_0x086e('0x3d')];_0x297de0+=0x1){_0x48c9a8=_0x5dfca2[_0x297de0][_0x086e('0x62')]?_0xa0fd07[_0x5dfca2[_0x297de0][_0x086e('0x62')]]['metric']:_0x5dfca2[_0x297de0][_0x086e('0x63')];_0x48c9a8=_0x5dfca2[_0x297de0][_0x086e('0x64')]?_[_0x086e('0x65')](_0x3112d2[_0x5dfca2[_0x297de0][_0x086e('0x64')]],'%s',_0x48c9a8):_0x48c9a8;_0x48c9a8=_0x5dfca2[_0x297de0][_0x086e('0x66')]?_[_0x086e('0x65')](_0x18c6b5[_0x5dfca2[_0x297de0][_0x086e('0x66')]],'%s',_0x48c9a8):_0x48c9a8;if(_0x5dfca2[_0x297de0][_0x086e('0x67')]){_0x520ec7[_0x086e('0x57')](_0x48c9a8);}_0x5dfca2[_0x297de0][_0x086e('0x68')]&&_0x520ec7[_0x086e('0x30')](_0x48c9a8,_0x5dfca2[_0x297de0][_0x086e('0x68')]===_0x086e('0x69')?![]:!![]);_0x520ec7[_0x086e('0x63')](_0x48c9a8,_0x5dfca2[_0x297de0][_0x086e('0x6a')]||_0x48c9a8);}if(_0x62809c['joins']){_0x62809c[_0x086e('0x6b')]=JSON['parse'](_0x62809c[_0x086e('0x6b')]);for(var _0x34b287=0x0;_0x34b287<_0x62809c[_0x086e('0x6b')][_0x086e('0x3d')];_0x34b287+=0x1){if(_0x62809c[_0x086e('0x6b')][_0x34b287]['type']&&_[_0x086e('0x6d')](_0xc4c3ac,_0x62809c[_0x086e('0x6b')][_0x34b287]['type'])&&_0x62809c[_0x086e('0x6b')][_0x34b287][_0x086e('0x6f')]&&_0x62809c[_0x086e('0x6b')][_0x34b287]['foreignTable']&&_0x62809c[_0x086e('0x6b')][_0x34b287][_0x086e('0x71')]){_0x520ec7[_0x62809c[_0x086e('0x6b')][_0x34b287]['type']](_0x62809c[_0x086e('0x6b')][_0x34b287][_0x086e('0x70')],null,util[_0x086e('0x66')](_0x086e('0x72'),_0x62809c[_0x086e('0x7e')],_0x62809c['joins'][_0x34b287]['parentKey'],_0x62809c['joins'][_0x34b287][_0x086e('0x70')],_0x62809c[_0x086e('0x6b')][_0x34b287][_0x086e('0x71')]));}}}if(_0x62809c['conditions']){_0x62809c['conditions']=JSON[_0x086e('0x6c')](_0x62809c[_0x086e('0x73')]);_0x520ec7[_0x086e('0x32')](_0xa1e35d(_0x62809c[_0x086e('0x73')][_0x086e('0x57')]));}_0x4f27cb=_0x520ec7[_0x086e('0x7f')]();_0x520ec7[_0x086e('0x1a')](_0x26d254);_0x520ec7[_0x086e('0x19')](0x0);logger[_0x086e('0x74')](_0x086e('0x80'),_0x520ec7['toString']());return db['sequelize'][_0x086e('0x2a')](_0x520ec7['toString'](),{'type':db[_0x086e('0x76')][_0x086e('0x77')][_0x086e('0x81')]});}})[_0x086e('0x1f')](function(){return{'sql':_0x4f27cb['toString']()};})['then'](respondWithResult(_0x1c4ac0,null))[_0x086e('0x40')](handleError(_0x1c4ac0,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 31f2fe4..00d9a93 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 _0x30e9=['api','moment','bluebird','request-promise','exports','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x30e9,0xb1));var _0x930e=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x30e9[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0x930e('0x0'));var util=require(_0x930e('0x1'));var logger=require(_0x930e('0x2'))(_0x930e('0x3'));var moment=require(_0x930e('0x4'));var BPromise=require(_0x930e('0x5'));var rp=require(_0x930e('0x6'));var attributes=require('./analyticCustomReport.attributes');module[_0x930e('0x7')]=function(_0x365ae4,_0x2d269b){return _0x365ae4['define'](_0x930e('0x8'),attributes,{'tableName':_0x930e('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf215=['./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment'];(function(_0x20fbeb,_0x4f9781){var _0x1a2a0e=function(_0x451ea3){while(--_0x451ea3){_0x20fbeb['push'](_0x20fbeb['shift']());}};_0x1a2a0e(++_0x4f9781);}(_0xf215,0x91));var _0x5f21=function(_0x4d8449,_0x121f8f){_0x4d8449=_0x4d8449-0x0;var _0x160b0e=_0xf215[_0x4d8449];return _0x160b0e;};'use strict';var _=require(_0x5f21('0x0'));var util=require(_0x5f21('0x1'));var logger=require(_0x5f21('0x2'))(_0x5f21('0x3'));var moment=require(_0x5f21('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x5f21('0x5'));module[_0x5f21('0x6')]=function(_0x1abf51,_0x2ae5eb){return _0x1abf51[_0x5f21('0x7')](_0x5f21('0x8'),attributes,{'tableName':_0x5f21('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 6d1d58b..30cbe1e 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 _0xa9e0=['http','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\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(_0x410d4c,_0x4ab4a7){var _0x500407=function(_0x330740){while(--_0x330740){_0x410d4c['push'](_0x410d4c['shift']());}};_0x500407(++_0x4ab4a7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\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(_0x33d1fb,_0x3f5e83){var _0x427ac9=function(_0x2bb37d){while(--_0x2bb37d){_0x33d1fb['push'](_0x33d1fb['shift']());}};_0x427ac9(++_0x3f5e83);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index ec5787e..00855b1 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 _0x955f=['/:id/query','query','post','put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','./analyticCustomReport.controller','isAuthenticated','index','get','show','/:id/preview','preview','/:id/run','run'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x955f,0x1eb));var _0xf955=function(_0xde478b,_0x32bd54){_0xde478b=_0xde478b-0x0;var _0x25c5e2=_0x955f[_0xde478b];return _0x25c5e2;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var auth=require(_0xf955('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf955('0x6'));router['get']('/',auth[_0xf955('0x7')](),controller[_0xf955('0x8')]);router[_0xf955('0x9')]('/:id',auth[_0xf955('0x7')](),controller[_0xf955('0xa')]);router['get'](_0xf955('0xb'),auth[_0xf955('0x7')](),controller[_0xf955('0xc')]);router[_0xf955('0x9')](_0xf955('0xd'),auth[_0xf955('0x7')](),controller[_0xf955('0xe')]);router['get'](_0xf955('0xf'),auth['isAuthenticated'](),controller[_0xf955('0x10')]);router[_0xf955('0x11')]('/',auth[_0xf955('0x7')](),controller['create']);router[_0xf955('0x12')]('/:id',auth[_0xf955('0x7')](),controller['update']);router[_0xf955('0x13')](_0xf955('0x14'),auth[_0xf955('0x7')](),controller[_0xf955('0x15')]);module[_0xf955('0x16')]=router; \ No newline at end of file +var _0x236c=['Router','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','show','preview','/:id/run','run','/:id/query','query','post','create','put','/:id','destroy','exports','multer','path','connect-timeout','express'];(function(_0x20a761,_0x2ffd85){var _0x284a38=function(_0x27e1bd){while(--_0x27e1bd){_0x20a761['push'](_0x20a761['shift']());}};_0x284a38(++_0x2ffd85);}(_0x236c,0x155));var _0xc236=function(_0x1196d6,_0x246472){_0x1196d6=_0x1196d6-0x0;var _0x4fc461=_0x236c[_0x1196d6];return _0x4fc461;};'use strict';var multer=require(_0xc236('0x0'));var util=require('util');var path=require(_0xc236('0x1'));var timeout=require(_0xc236('0x2'));var express=require(_0xc236('0x3'));var router=express[_0xc236('0x4')]();var auth=require(_0xc236('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc236('0x6'));var controller=require(_0xc236('0x7'));router[_0xc236('0x8')]('/',auth[_0xc236('0x9')](),controller[_0xc236('0xa')]);router[_0xc236('0x8')]('/:id',auth[_0xc236('0x9')](),controller[_0xc236('0xb')]);router['get']('/:id/preview',auth['isAuthenticated'](),controller[_0xc236('0xc')]);router['get'](_0xc236('0xd'),auth[_0xc236('0x9')](),controller[_0xc236('0xe')]);router[_0xc236('0x8')](_0xc236('0xf'),auth['isAuthenticated'](),controller[_0xc236('0x10')]);router[_0xc236('0x11')]('/',auth['isAuthenticated'](),controller[_0xc236('0x12')]);router[_0xc236('0x13')]('/:id',auth[_0xc236('0x9')](),controller['update']);router['delete'](_0xc236('0x14'),auth[_0xc236('0x9')](),controller[_0xc236('0x15')]);module[_0xc236('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 41edf20..62c2f02 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 _0x7e80=['sequelize','STRING','TEXT'];(function(_0x75da4,_0x46732e){var _0x2e1687=function(_0xdb7705){while(--_0xdb7705){_0x75da4['push'](_0x75da4['shift']());}};_0x2e1687(++_0x46732e);}(_0x7e80,0xb1));var _0x07e8=function(_0xaf0996,_0x3ee642){_0xaf0996=_0xaf0996-0x0;var _0x8fde5a=_0x7e80[_0xaf0996];return _0x8fde5a;};'use strict';var Sequelize=require(_0x07e8('0x0'));module['exports']={'name':{'type':Sequelize[_0x07e8('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x07e8('0x1')]},'parent':{'type':Sequelize[_0x07e8('0x1')]},'table':{'type':Sequelize[_0x07e8('0x1')]},'conditions':{'type':Sequelize[_0x07e8('0x2')]},'joins':{'type':Sequelize[_0x07e8('0x2')]}}; \ No newline at end of file +var _0x345d=['sequelize','exports','STRING','TEXT'];(function(_0x546479,_0x5a85a8){var _0x3c391e=function(_0x43c84d){while(--_0x43c84d){_0x546479['push'](_0x546479['shift']());}};_0x3c391e(++_0x5a85a8);}(_0x345d,0x100));var _0xd345=function(_0x3967ff,_0x3f46fb){_0x3967ff=_0x3967ff-0x0;var _0x593abf=_0x345d[_0x3967ff];return _0x593abf;};'use strict';var Sequelize=require(_0xd345('0x0'));module[_0xd345('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xd345('0x2')]},'table':{'type':Sequelize[_0xd345('0x2')]},'conditions':{'type':Sequelize[_0xd345('0x3')]},'joins':{'type':Sequelize[_0xd345('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 678984f..d1e7b4f 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 _0x7a61=['add','dateStart','day','merge','where','filter','map','options','AnalyticDefaultReport','includeAll','include','findAll','rows','params','catch','create','body','update','find','preview','join','right_join','outer_join','cross_join','COUNT(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','type','parentKey','foreignKey','%s.%s\x20=\x20%s.%s','foreignTable','conditions','clone','debug','toString','sequelize','QueryTypes','SELECT','left_join','SUM(%s)','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','HOUR(%s)','UNIX_TIMESTAMP(%s)','getFields','select','Limited\x20Query:','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','from','countTable','MAX(%s)','SEC_TO_TIME(%s)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','destroy','then','error','stack','name','index','rawAttributes','model','query','dateEnd','keys','intersection','fields','attributes','length','nolimit','order','sort','filters','pick'];(function(_0x17b0d4,_0x377add){var _0x2d02c7=function(_0x56e627){while(--_0x56e627){_0x17b0d4['push'](_0x17b0d4['shift']());}};_0x2d02c7(++_0x377add);}(_0x7a61,0x67));var _0x17a6=function(_0x1fe4e2,_0x19f145){_0x1fe4e2=_0x1fe4e2-0x0;var _0x8d2d99=_0x7a61[_0x1fe4e2];return _0x8d2d99;};'use strict';var pdf=require(_0x17a6('0x0'));var emlformat=require(_0x17a6('0x1'));var rimraf=require(_0x17a6('0x2'));var zipdir=require(_0x17a6('0x3'));var jsonpatch=require(_0x17a6('0x4'));var rp=require(_0x17a6('0x5'));var moment=require(_0x17a6('0x6'));var BPromise=require(_0x17a6('0x7'));var Mustache=require('mustache');var util=require(_0x17a6('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x17a6('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x17a6('0xa'));var squel=require('squel');var crypto=require(_0x17a6('0xb'));var jsforce=require(_0x17a6('0xc'));var deskjs=require(_0x17a6('0xd'));var toCsv=require(_0x17a6('0x9'));var querystring=require('querystring');var Papa=require(_0x17a6('0xe'));var Redis=require(_0x17a6('0xf'));var qs=require(_0x17a6('0x10'));var logger=require('../../config/logger')(_0x17a6('0x11'));var utils=require(_0x17a6('0x12'));var config=require(_0x17a6('0x13'));var db=require(_0x17a6('0x14'))['db'];function respondWithStatusCode(_0x48b6e2,_0x555b32){_0x555b32=_0x555b32||0xcc;return function(_0x199393){if(_0x199393){return _0x48b6e2[_0x17a6('0x15')](_0x555b32);}return _0x48b6e2[_0x17a6('0x16')](_0x555b32)[_0x17a6('0x17')]();};}function respondWithResult(_0x32f1e6,_0x433bd9){_0x433bd9=_0x433bd9||0xc8;return function(_0x1a8410){if(_0x1a8410){return _0x32f1e6['status'](_0x433bd9)[_0x17a6('0x18')](_0x1a8410);}};}function respondWithFilteredResult(_0x49dff0,_0x5007dc){return function(_0x1bd129){if(_0x1bd129){var _0x5b5b6f=_0x1bd129[_0x17a6('0x19')],_0x4eaee6=_0x5007dc[_0x17a6('0x1a')],_0x4f131c=_0x5007dc[_0x17a6('0x1a')]+_0x5007dc[_0x17a6('0x1b')],_0xe51e73;if(_0x4f131c>=_0x5b5b6f){_0x4f131c=_0x5b5b6f;_0xe51e73=0xc8;}else{_0xe51e73=0xce;}_0x49dff0[_0x17a6('0x16')](_0xe51e73);return _0x49dff0[_0x17a6('0x1c')](_0x17a6('0x1d'),_0x4eaee6+'-'+_0x4f131c+'/'+_0x5b5b6f)[_0x17a6('0x18')](_0x1bd129);}return null;};}function patchUpdates(_0x1cfa19){return function(_0x56b96c){try{jsonpatch[_0x17a6('0x1e')](_0x56b96c,_0x1cfa19,!![]);}catch(_0x2878ad){return BPromise['reject'](_0x2878ad);}return _0x56b96c[_0x17a6('0x1f')]();};}function saveUpdates(_0x20774e,_0x5e5789){return function(_0x102a2a){if(_0x102a2a){return _0x102a2a['update'](_0x20774e)['then'](function(_0x4a97e3){return _0x4a97e3;});}return null;};}function removeEntity(_0xc0af51,_0x472a34){return function(_0x96e9c8){if(_0x96e9c8){return _0x96e9c8[_0x17a6('0x20')]()[_0x17a6('0x21')](function(){_0xc0af51['status'](0xcc)[_0x17a6('0x17')]();});}};}function handleEntityNotFound(_0x51ee6a,_0x359b01){return function(_0x338648){if(!_0x338648){_0x51ee6a[_0x17a6('0x15')](0x194);}return _0x338648;};}function handleError(_0x53bd70,_0x37abe2){_0x37abe2=_0x37abe2||0x1f4;return function(_0x21b8b0){logger[_0x17a6('0x22')](_0x21b8b0[_0x17a6('0x23')]);if(_0x21b8b0[_0x17a6('0x24')]){delete _0x21b8b0[_0x17a6('0x24')];}_0x53bd70[_0x17a6('0x16')](_0x37abe2)['send'](_0x21b8b0);};}exports[_0x17a6('0x25')]=function(_0x1e996b,_0x1a82d9){var _0xb6c99c={},_0x1c7741={},_0x3b15e7={'count':0x0,'rows':[]};var _0x39d1be=db['AnalyticDefaultReport'][_0x17a6('0x26')];_0x1c7741[_0x17a6('0x27')]=_['keys'](_0x39d1be);var _0x35e511={'dateStart':_0x1e996b[_0x17a6('0x28')]['dateStart'],'dateEnd':_0x1e996b[_0x17a6('0x28')]['dateEnd']};delete _0x1e996b[_0x17a6('0x28')]['dateStart'];delete _0x1e996b[_0x17a6('0x28')][_0x17a6('0x29')];_0x1c7741[_0x17a6('0x28')]=_[_0x17a6('0x2a')](_0x1e996b[_0x17a6('0x28')]);_0x1c7741['filters']=_[_0x17a6('0x2b')](_0x1c7741[_0x17a6('0x27')],_0x1c7741[_0x17a6('0x28')]);_0xb6c99c['attributes']=_[_0x17a6('0x2b')](_0x1c7741[_0x17a6('0x27')],qs[_0x17a6('0x2c')](_0x1e996b[_0x17a6('0x28')]['fields']));_0xb6c99c[_0x17a6('0x2d')]=_0xb6c99c[_0x17a6('0x2d')][_0x17a6('0x2e')]?_0xb6c99c[_0x17a6('0x2d')]:_0x1c7741[_0x17a6('0x27')];if(!_0x1e996b[_0x17a6('0x28')]['hasOwnProperty'](_0x17a6('0x2f'))){_0xb6c99c[_0x17a6('0x1b')]=qs[_0x17a6('0x1b')](_0x1e996b['query'][_0x17a6('0x1b')]);_0xb6c99c[_0x17a6('0x1a')]=qs[_0x17a6('0x1a')](_0x1e996b[_0x17a6('0x28')][_0x17a6('0x1a')]);}_0xb6c99c[_0x17a6('0x30')]=qs[_0x17a6('0x31')](_0x1e996b[_0x17a6('0x28')][_0x17a6('0x31')]);_0xb6c99c['where']=qs[_0x17a6('0x32')](_[_0x17a6('0x33')](_0x1e996b['query'],_0x1c7741[_0x17a6('0x32')]));if(_0x35e511['dateStart']){if(_0x35e511[_0x17a6('0x29')]){_0x35e511[_0x17a6('0x29')]=moment(_0x35e511[_0x17a6('0x29')])[_0x17a6('0x34')](0x1,'day');}else{_0x35e511['dateEnd']=moment(_0x35e511[_0x17a6('0x35')])[_0x17a6('0x34')](0x1,_0x17a6('0x36'));}_[_0x17a6('0x37')](_0xb6c99c[_0x17a6('0x38')],{'createdAt':{'$gte':_0x35e511[_0x17a6('0x35')],'$lte':_0x35e511['dateEnd']}});}if(_0x1e996b[_0x17a6('0x28')][_0x17a6('0x39')]){_0xb6c99c['where']=_[_0x17a6('0x37')](_0xb6c99c['where'],{'$or':_[_0x17a6('0x3a')](_0xb6c99c[_0x17a6('0x2d')],function(_0x1f102c){var _0x3c19c3={};_0x3c19c3[_0x1f102c]={'$like':'%'+_0x1e996b['query'][_0x17a6('0x39')]+'%'};return _0x3c19c3;})});}_0xb6c99c=_['merge']({},_0xb6c99c,_0x1e996b[_0x17a6('0x3b')]);var _0x5d0f82={'where':_0xb6c99c['where']};return db[_0x17a6('0x3c')][_0x17a6('0x19')](_0x5d0f82)[_0x17a6('0x21')](function(_0x4662c8){_0x3b15e7[_0x17a6('0x19')]=_0x4662c8;if(_0x1e996b[_0x17a6('0x28')][_0x17a6('0x3d')]){_0xb6c99c[_0x17a6('0x3e')]=[{'all':!![]}];}return db[_0x17a6('0x3c')][_0x17a6('0x3f')](_0xb6c99c);})[_0x17a6('0x21')](function(_0x885d9e){_0x3b15e7[_0x17a6('0x40')]=_0x885d9e;return _0x3b15e7;})[_0x17a6('0x21')](respondWithFilteredResult(_0x1a82d9,_0xb6c99c))['catch'](handleError(_0x1a82d9,null));};exports['show']=function(_0x2dcdea,_0x2e8355){var _0x2176aa={'raw':!![],'where':{'id':_0x2dcdea[_0x17a6('0x41')]['id']}},_0xc8cf3a={};_0xc8cf3a[_0x17a6('0x27')]=_[_0x17a6('0x2a')](db[_0x17a6('0x3c')][_0x17a6('0x26')]);_0xc8cf3a[_0x17a6('0x28')]=_['keys'](_0x2dcdea[_0x17a6('0x28')]);_0xc8cf3a['filters']=_['intersection'](_0xc8cf3a[_0x17a6('0x27')],_0xc8cf3a[_0x17a6('0x28')]);_0x2176aa[_0x17a6('0x2d')]=_[_0x17a6('0x2b')](_0xc8cf3a[_0x17a6('0x27')],qs['fields'](_0x2dcdea[_0x17a6('0x28')][_0x17a6('0x2c')]));_0x2176aa[_0x17a6('0x2d')]=_0x2176aa[_0x17a6('0x2d')]['length']?_0x2176aa['attributes']:_0xc8cf3a['model'];if(_0x2dcdea[_0x17a6('0x28')][_0x17a6('0x3d')]){_0x2176aa[_0x17a6('0x3e')]=[{'all':!![]}];}_0x2176aa=_['merge']({},_0x2176aa,_0x2dcdea[_0x17a6('0x3b')]);return db['AnalyticDefaultReport']['find'](_0x2176aa)[_0x17a6('0x21')](handleEntityNotFound(_0x2e8355,null))[_0x17a6('0x21')](respondWithResult(_0x2e8355,null))[_0x17a6('0x42')](handleError(_0x2e8355,null));};exports[_0x17a6('0x43')]=function(_0x16e93a,_0x54885e){return db[_0x17a6('0x3c')][_0x17a6('0x43')](_0x16e93a[_0x17a6('0x44')],{})['then'](respondWithResult(_0x54885e,0xc9))[_0x17a6('0x42')](handleError(_0x54885e,null));};exports[_0x17a6('0x45')]=function(_0x2cfb2d,_0x51d1a1){if(_0x2cfb2d[_0x17a6('0x44')]['id']){delete _0x2cfb2d[_0x17a6('0x44')]['id'];}return db['AnalyticDefaultReport'][_0x17a6('0x46')]({'where':{'id':_0x2cfb2d[_0x17a6('0x41')]['id']}})[_0x17a6('0x21')](handleEntityNotFound(_0x51d1a1,null))[_0x17a6('0x21')](saveUpdates(_0x2cfb2d[_0x17a6('0x44')],null))[_0x17a6('0x21')](respondWithResult(_0x51d1a1,null))[_0x17a6('0x42')](handleError(_0x51d1a1,null));};exports['destroy']=function(_0x86f39a,_0x475a5f){return db[_0x17a6('0x3c')][_0x17a6('0x46')]({'where':{'id':_0x86f39a[_0x17a6('0x41')]['id']}})[_0x17a6('0x21')](handleEntityNotFound(_0x475a5f,null))[_0x17a6('0x21')](removeEntity(_0x475a5f,null))['catch'](handleError(_0x475a5f,null));};exports[_0x17a6('0x47')]=function(_0x3d9aca,_0x39d4b5){var _0x447823=0xa;var _0x16f531=[_0x17a6('0x48'),'left_join',_0x17a6('0x49'),_0x17a6('0x4a'),_0x17a6('0x4b')];var _0x554ab3={'SUM':'SUM(%s)','COUNT':_0x17a6('0x4c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x17a6('0x4d'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x17a6('0x4e'),'GROUP_CONCAT ASC':_0x17a6('0x4f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x10980d={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x17a6('0x50'),'HOUR':'HOUR(%s)','ROUND':_0x17a6('0x51'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x49bdc2=function(_0x22d502){return!_[_0x17a6('0x52')]([_0x17a6('0x53'),_0x17a6('0x54'),_0x17a6('0x55'),_0x17a6('0x56')],_0x22d502);};var _0x19203c=function(_0x408ef7){if(!_0x408ef7||!_0x408ef7[_0x17a6('0x57')]['length']){return'';}for(var _0x1ec17d='(',_0xcc6b86=0x0;_0xcc6b86<_0x408ef7['rules'][_0x17a6('0x2e')];_0xcc6b86+=0x1){_0xcc6b86>0x0&&(_0x1ec17d+='\x20'+_0x408ef7[_0x17a6('0x58')]+'\x20');_0x1ec17d+=_0x408ef7[_0x17a6('0x57')][_0xcc6b86][_0x17a6('0x59')]?_0x19203c(_0x408ef7['rules'][_0xcc6b86][_0x17a6('0x59')]):_0x408ef7[_0x17a6('0x57')][_0xcc6b86][_0x17a6('0x5a')]+'\x20'+_0x408ef7[_0x17a6('0x57')][_0xcc6b86][_0x17a6('0x5b')]+(_0x49bdc2(_0x408ef7['rules'][_0xcc6b86]['condition'])?'\x20'+_0x408ef7[_0x17a6('0x57')][_0xcc6b86][_0x17a6('0x5c')]:'');}return _0x1ec17d+')';};var _0x275234={'where':{'id':_0x3d9aca[_0x17a6('0x41')]['id']}},_0x3b9c70,_0x12d1b2,_0x3ced79,_0x5cad3c,_0x4780ae;_0x275234=_[_0x17a6('0x37')]({},_0x275234,_0x3d9aca[_0x17a6('0x3b')]);return db['AnalyticDefaultReport']['find'](_0x275234)[_0x17a6('0x21')](function(_0xd99286){if(_0xd99286){_0x3b9c70=_0xd99286;return _0xd99286['getFields']();}return null;})['then'](function(_0x510046){if(_0x510046){if(!_0x510046['length']){throw new db[(_0x17a6('0x5d'))][(_0x17a6('0x5e'))](_0x17a6('0x5f'),0x193);}_0x12d1b2=_0x510046;return db[_0x17a6('0x60')][_0x17a6('0x3f')]({'raw':!![]});}return null;})['then'](function(_0x50792e){if(_0x50792e){_0x3ced79=_[_0x17a6('0x61')](_0x50792e,'id');var _0x40ebbd;var _0x4eed98=squel['select']();_0x4eed98['from'](_0x3b9c70[_0x17a6('0x62')]);for(var _0x1e9d92=0x0;_0x1e9d92<_0x12d1b2[_0x17a6('0x2e')];_0x1e9d92+=0x1){_0x40ebbd=_0x12d1b2[_0x1e9d92]['MetricId']?_0x3ced79[_0x12d1b2[_0x1e9d92][_0x17a6('0x63')]][_0x17a6('0x64')]:_0x12d1b2[_0x1e9d92][_0x17a6('0x5a')];_0x40ebbd=_0x12d1b2[_0x1e9d92][_0x17a6('0x65')]?_['replace'](_0x554ab3[_0x12d1b2[_0x1e9d92]['function']],'%s',_0x40ebbd):_0x40ebbd;_0x40ebbd=_0x12d1b2[_0x1e9d92]['format']?_[_0x17a6('0x66')](_0x10980d[_0x12d1b2[_0x1e9d92][_0x17a6('0x67')]],'%s',_0x40ebbd):_0x40ebbd;if(_0x12d1b2[_0x1e9d92][_0x17a6('0x68')]){_0x4eed98[_0x17a6('0x59')](_0x40ebbd);}_0x12d1b2[_0x1e9d92][_0x17a6('0x69')]&&_0x4eed98[_0x17a6('0x30')](_0x40ebbd,_0x12d1b2[_0x1e9d92][_0x17a6('0x69')]===_0x17a6('0x6a')?![]:!![]);_0x4eed98[_0x17a6('0x5a')](_0x40ebbd,_0x12d1b2[_0x1e9d92][_0x17a6('0x6b')]||_0x40ebbd);}if(_0x3b9c70[_0x17a6('0x6c')]){_0x3b9c70[_0x17a6('0x6c')]=JSON[_0x17a6('0x6d')](_0x3b9c70[_0x17a6('0x6c')]);for(var _0x5d794c=0x0;_0x5d794c<_0x3b9c70[_0x17a6('0x6c')][_0x17a6('0x2e')];_0x5d794c+=0x1){if(_0x3b9c70[_0x17a6('0x6c')][_0x5d794c][_0x17a6('0x6e')]&&_[_0x17a6('0x52')](_0x16f531,_0x3b9c70['joins'][_0x5d794c][_0x17a6('0x6e')])&&_0x3b9c70['joins'][_0x5d794c][_0x17a6('0x6f')]&&_0x3b9c70[_0x17a6('0x6c')][_0x5d794c]['foreignTable']&&_0x3b9c70[_0x17a6('0x6c')][_0x5d794c][_0x17a6('0x70')]){_0x4eed98[_0x3b9c70[_0x17a6('0x6c')][_0x5d794c][_0x17a6('0x6e')]](_0x3b9c70[_0x17a6('0x6c')][_0x5d794c]['foreignTable'],null,util[_0x17a6('0x67')](_0x17a6('0x71'),_0x3b9c70['table'],_0x3b9c70[_0x17a6('0x6c')][_0x5d794c][_0x17a6('0x6f')],_0x3b9c70[_0x17a6('0x6c')][_0x5d794c][_0x17a6('0x72')],_0x3b9c70[_0x17a6('0x6c')][_0x5d794c][_0x17a6('0x70')]));}}}if(_0x3b9c70[_0x17a6('0x73')]){_0x3b9c70[_0x17a6('0x73')]=JSON[_0x17a6('0x6d')](_0x3b9c70[_0x17a6('0x73')]);_0x4eed98[_0x17a6('0x38')](_0x19203c(_0x3b9c70['conditions'][_0x17a6('0x59')]));}_0x4780ae=_0x4eed98[_0x17a6('0x74')]();_0x4eed98[_0x17a6('0x1b')](_0x447823);_0x4eed98['offset'](0x0);logger[_0x17a6('0x75')]('Limited\x20Query:',_0x4eed98[_0x17a6('0x76')]());return db[_0x17a6('0x77')][_0x17a6('0x28')](_0x4eed98[_0x17a6('0x76')](),{'type':db['sequelize'][_0x17a6('0x78')][_0x17a6('0x79')]});}})['then'](respondWithResult(_0x39d4b5,null))['catch'](handleError(_0x39d4b5,null));};function runReport(_0x23ba5d,_0xbca962,_0x5e3145){var _0x4bfa82=_0xbca962[_0x17a6('0x24')];var _0x12ff44=0xa;var _0xff52d5=['join',_0x17a6('0x7a'),_0x17a6('0x49'),_0x17a6('0x4a'),_0x17a6('0x4b')];var _0x5baa1f={'SUM':_0x17a6('0x7b'),'COUNT':_0x17a6('0x4c'),'COUNT DISTINCT':_0x17a6('0x7c'),'MAX':'MAX(%s)','MIN':_0x17a6('0x4d'),'AVG':_0x17a6('0x7d'),'GROUP_CONCAT':_0x17a6('0x4e'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x17a6('0x7e')};var _0x2cadb={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x17a6('0x7f'),'ROUND':_0x17a6('0x51'),'UNIX_TIMESTAMP':_0x17a6('0x80')};var _0x667b44=function(_0x30d5c8){return!_[_0x17a6('0x52')]([_0x17a6('0x53'),_0x17a6('0x54'),_0x17a6('0x55'),_0x17a6('0x56')],_0x30d5c8);};var _0x2b64ff=function(_0x10380d){if(!_0x10380d||!_0x10380d[_0x17a6('0x57')][_0x17a6('0x2e')]){return'';}for(var _0x156a01='(',_0x57497d=0x0;_0x57497d<_0x10380d[_0x17a6('0x57')][_0x17a6('0x2e')];_0x57497d+=0x1){_0x57497d>0x0&&(_0x156a01+='\x20'+_0x10380d['operator']+'\x20');_0x156a01+=_0x10380d['rules'][_0x57497d]['group']?_0x2b64ff(_0x10380d[_0x17a6('0x57')][_0x57497d][_0x17a6('0x59')]):_0x10380d[_0x17a6('0x57')][_0x57497d][_0x17a6('0x5a')]+'\x20'+_0x10380d['rules'][_0x57497d][_0x17a6('0x5b')]+(_0x667b44(_0x10380d[_0x17a6('0x57')][_0x57497d]['condition'])?'\x20'+_0x10380d[_0x17a6('0x57')][_0x57497d][_0x17a6('0x5c')]:'');}return _0x156a01+')';};var _0xba1b2a={'where':{'id':_0x23ba5d['id']}},_0x58c80a,_0x3ca226,_0x4882c9,_0x3e7203,_0x41fab9;_0xba1b2a=_[_0x17a6('0x37')]({},_0xba1b2a,_0x5e3145);return db[_0x17a6('0x3c')][_0x17a6('0x46')](_0xba1b2a)['then'](function(_0x4d98e9){if(_0x4d98e9){_0x58c80a=_0x4d98e9;return _0x4d98e9[_0x17a6('0x81')]();}return null;})[_0x17a6('0x21')](function(_0x3356bc){if(_0x3356bc){if(!_0x3356bc['length']){throw new db['Sequelize'][(_0x17a6('0x5e'))](_0x17a6('0x5f'),0x193);}_0x3ca226=_0x3356bc;return db[_0x17a6('0x60')][_0x17a6('0x3f')]({'raw':!![]});}return null;})[_0x17a6('0x21')](function(_0x89fdb9){if(_0x89fdb9){_0x4882c9=_[_0x17a6('0x61')](_0x89fdb9,'id');var _0x3e9ad9;var _0x267b1f=squel[_0x17a6('0x82')]();_0x267b1f['from'](_0x58c80a['table']);for(var _0x4fb265=0x0;_0x4fb265<_0x3ca226['length'];_0x4fb265+=0x1){_0x3e9ad9=_0x3ca226[_0x4fb265][_0x17a6('0x63')]?_0x4882c9[_0x3ca226[_0x4fb265][_0x17a6('0x63')]][_0x17a6('0x64')]:_0x3ca226[_0x4fb265][_0x17a6('0x5a')];_0x3e9ad9=_0x3ca226[_0x4fb265][_0x17a6('0x65')]?_[_0x17a6('0x66')](_0x5baa1f[_0x3ca226[_0x4fb265][_0x17a6('0x65')]],'%s',_0x3e9ad9):_0x3e9ad9;_0x3e9ad9=_0x3ca226[_0x4fb265][_0x17a6('0x67')]?_[_0x17a6('0x66')](_0x2cadb[_0x3ca226[_0x4fb265][_0x17a6('0x67')]],'%s',_0x3e9ad9):_0x3e9ad9;if(_0x3ca226[_0x4fb265][_0x17a6('0x68')]){_0x267b1f[_0x17a6('0x59')](_0x3e9ad9);}_0x3ca226[_0x4fb265][_0x17a6('0x69')]&&_0x267b1f[_0x17a6('0x30')](_0x3e9ad9,_0x3ca226[_0x4fb265][_0x17a6('0x69')]===_0x17a6('0x6a')?![]:!![]);_0x267b1f[_0x17a6('0x5a')](_0x3e9ad9,_0x3ca226[_0x4fb265]['alias']||_0x3e9ad9);}if(_0x58c80a[_0x17a6('0x6c')]){_0x58c80a[_0x17a6('0x6c')]=JSON[_0x17a6('0x6d')](_0x58c80a['joins']);for(var _0x4226ba=0x0;_0x4226ba<_0x58c80a[_0x17a6('0x6c')]['length'];_0x4226ba+=0x1){if(_0x58c80a[_0x17a6('0x6c')][_0x4226ba][_0x17a6('0x6e')]&&_[_0x17a6('0x52')](_0xff52d5,_0x58c80a[_0x17a6('0x6c')][_0x4226ba][_0x17a6('0x6e')])&&_0x58c80a[_0x17a6('0x6c')][_0x4226ba][_0x17a6('0x6f')]&&_0x58c80a[_0x17a6('0x6c')][_0x4226ba][_0x17a6('0x72')]&&_0x58c80a['joins'][_0x4226ba][_0x17a6('0x70')]){_0x267b1f[_0x58c80a[_0x17a6('0x6c')][_0x4226ba][_0x17a6('0x6e')]](_0x58c80a['joins'][_0x4226ba]['foreignTable'],null,util[_0x17a6('0x67')](_0x17a6('0x71'),_0x58c80a[_0x17a6('0x62')],_0x58c80a[_0x17a6('0x6c')][_0x4226ba][_0x17a6('0x6f')],_0x58c80a[_0x17a6('0x6c')][_0x4226ba][_0x17a6('0x72')],_0x58c80a['joins'][_0x4226ba][_0x17a6('0x70')]));}}}if(_0x58c80a['conditions']){_0x58c80a[_0x17a6('0x73')]=JSON[_0x17a6('0x6d')](_0x58c80a[_0x17a6('0x73')]);_0x267b1f['where'](_0x2b64ff(_0x58c80a[_0x17a6('0x73')][_0x17a6('0x59')]));}_0x41fab9=_0x267b1f[_0x17a6('0x74')]();_0x267b1f[_0x17a6('0x1b')](_0x12ff44);_0x267b1f[_0x17a6('0x1a')](0x0);logger[_0x17a6('0x75')](_0x17a6('0x83'),_0x267b1f['toString']());return db[_0x17a6('0x77')][_0x17a6('0x28')](_0x267b1f['toString'](),{'type':db[_0x17a6('0x77')][_0x17a6('0x78')][_0x17a6('0x79')]});}})[_0x17a6('0x21')](function(_0x5a285a){if(!_0x5a285a[_0x17a6('0x2e')]){throw new db['Sequelize'][(_0x17a6('0x5e'))](_0x17a6('0x84'),0xcc);}if(_0xbca962[_0x17a6('0x85')]===_0x17a6('0x86')){return null;}var _0x642b07=_[_0x17a6('0x37')](_0xbca962,{'name':_0xbca962[_0x17a6('0x87')]||_0xbca962[_0x17a6('0x24')]||_0x58c80a[_0x17a6('0x24')],'basename':_0x4bfa82,'savename':util[_0x17a6('0x67')](_0x17a6('0x88'),_0xbca962[_0x17a6('0x24')]||_0x58c80a[_0x17a6('0x24')],require(_0x17a6('0x89'))[_0x17a6('0x8a')](0x4),_0xbca962['output']||_0x17a6('0x8b'))});return db[_0x17a6('0x8c')][_0x17a6('0x43')](_0x642b07,{'raw':!![]});})['then'](function(_0x4caaff){if(_0x58c80a[_0x17a6('0x62')]===_0x17a6('0x8d')){_0x41fab9[_0x17a6('0x38')](_0x58c80a[_0x17a6('0x62')]+_0x17a6('0x8e'),_0xbca962[_0x17a6('0x8f')],_0xbca962[_0x17a6('0x90')]);}else{_0x41fab9[_0x17a6('0x38')](_0x58c80a[_0x17a6('0x62')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xbca962['startDate'],_0xbca962[_0x17a6('0x90')]);}if(_0x4caaff){logger[_0x17a6('0x91')](_0x17a6('0x92'),_0x41fab9[_0x17a6('0x76')]());require(_0x17a6('0x93'))[_0x17a6('0x94')](path[_0x17a6('0x48')](__dirname,_0x17a6('0x95'),_0x4caaff[_0x17a6('0x85')]),[_0x4caaff['id'],_0x41fab9[_0x17a6('0x76')](),path[_0x17a6('0x48')](__dirname,_0x17a6('0x96'),_0x4caaff['savename']),_0x4bfa82]);return _0x4caaff;}else{var _0x4e6ecb=squel[_0x17a6('0x82')]();_0x4e6ecb[_0x17a6('0x97')]('('+_0x41fab9[_0x17a6('0x76')]()+')',_0x17a6('0x98'));_0x4e6ecb[_0x17a6('0x5a')]('COUNT(*)','count');_0x41fab9[_0x17a6('0x1b')](_0xbca962[_0x17a6('0x1b')]||_0x12ff44);_0x41fab9['offset'](_0xbca962[_0x17a6('0x1a')]||0x0);return db[_0x17a6('0x77')][_0x17a6('0x28')](_0x4e6ecb[_0x17a6('0x76')](),{'type':db['sequelize'][_0x17a6('0x78')][_0x17a6('0x79')]})[_0x17a6('0x21')](function(_0x4c2a49){if(!_0x4c2a49[_0x17a6('0x2e')]){_0x3e7203=0x0;}else{_0x3e7203=_0x4c2a49[0x0][_0x17a6('0x19')]||0x0;}return db[_0x17a6('0x77')][_0x17a6('0x28')](_0x41fab9['toString'](),{'type':db[_0x17a6('0x77')][_0x17a6('0x78')]['SELECT']});})['then'](function(_0x4c133b){return{'rows':_0x4c133b||[],'count':_0x3e7203};});}});}exports['run']=function(_0x4778d6,_0x5018c4){return runReport(_0x4778d6[_0x17a6('0x41')],_0x4778d6[_0x17a6('0x28')],_0x4778d6[_0x17a6('0x3b')])[_0x17a6('0x21')](respondWithResult(_0x5018c4,null))['catch'](handleError(_0x5018c4,null));};exports['runReport']=runReport;exports[_0x17a6('0x28')]=function(_0x2d6444,_0x33bf77){var _0x3ce1e2=0xa;var _0x5d3572=['join',_0x17a6('0x7a'),_0x17a6('0x49'),_0x17a6('0x4a'),_0x17a6('0x4b')];var _0x2ec45f={'SUM':_0x17a6('0x7b'),'COUNT':_0x17a6('0x4c'),'COUNT DISTINCT':_0x17a6('0x7c'),'MAX':_0x17a6('0x99'),'MIN':_0x17a6('0x4d'),'AVG':_0x17a6('0x7d'),'GROUP_CONCAT':_0x17a6('0x4e'),'GROUP_CONCAT ASC':_0x17a6('0x4f'),'GROUP_CONCAT DESC':_0x17a6('0x7e')};var _0x169ea6={'SEC_TO_TIME':_0x17a6('0x9a'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x17a6('0x51'),'UNIX_TIMESTAMP':_0x17a6('0x80')};var _0x2e510b=function(_0x293cf6){return!_[_0x17a6('0x52')]([_0x17a6('0x53'),'IS\x20NOT\x20NULL',_0x17a6('0x55'),_0x17a6('0x56')],_0x293cf6);};var _0x124d9f=function(_0x4b49ca){if(!_0x4b49ca||!_0x4b49ca['rules'][_0x17a6('0x2e')]){return'';}for(var _0x4c5751='(',_0x561f6a=0x0;_0x561f6a<_0x4b49ca['rules'][_0x17a6('0x2e')];_0x561f6a+=0x1){_0x561f6a>0x0&&(_0x4c5751+='\x20'+_0x4b49ca[_0x17a6('0x58')]+'\x20');_0x4c5751+=_0x4b49ca['rules'][_0x561f6a]['group']?_0x124d9f(_0x4b49ca['rules'][_0x561f6a][_0x17a6('0x59')]):_0x4b49ca['rules'][_0x561f6a][_0x17a6('0x5a')]+'\x20'+_0x4b49ca['rules'][_0x561f6a][_0x17a6('0x5b')]+(_0x2e510b(_0x4b49ca[_0x17a6('0x57')][_0x561f6a][_0x17a6('0x5b')])?'\x20'+_0x4b49ca[_0x17a6('0x57')][_0x561f6a][_0x17a6('0x5c')]:'');}return _0x4c5751+')';};var _0x28b831={'where':{'id':_0x2d6444['params']['id']}},_0xdb193f,_0x2fe496,_0x527a2b,_0x13d411,_0x466c23;_0x28b831=_[_0x17a6('0x37')]({},_0x28b831,_0x2d6444['options']);return db[_0x17a6('0x3c')][_0x17a6('0x46')](_0x28b831)[_0x17a6('0x21')](function(_0x5619e7){if(_0x5619e7){_0xdb193f=_0x5619e7;return _0x5619e7[_0x17a6('0x81')]();}return null;})[_0x17a6('0x21')](function(_0x1d85a5){if(_0x1d85a5){if(!_0x1d85a5['length']){throw new db['Sequelize'][(_0x17a6('0x5e'))](_0x17a6('0x5f'),0x193);}_0x2fe496=_0x1d85a5;return db[_0x17a6('0x60')][_0x17a6('0x3f')]({'raw':!![]});}return null;})['then'](function(_0x53bc29){if(_0x53bc29){_0x527a2b=_[_0x17a6('0x61')](_0x53bc29,'id');var _0x2ef1a7;var _0x513171=squel[_0x17a6('0x82')]();_0x513171[_0x17a6('0x97')](_0xdb193f[_0x17a6('0x62')]);for(var _0x31a082=0x0;_0x31a082<_0x2fe496[_0x17a6('0x2e')];_0x31a082+=0x1){_0x2ef1a7=_0x2fe496[_0x31a082][_0x17a6('0x63')]?_0x527a2b[_0x2fe496[_0x31a082]['MetricId']][_0x17a6('0x64')]:_0x2fe496[_0x31a082][_0x17a6('0x5a')];_0x2ef1a7=_0x2fe496[_0x31a082][_0x17a6('0x65')]?_[_0x17a6('0x66')](_0x2ec45f[_0x2fe496[_0x31a082][_0x17a6('0x65')]],'%s',_0x2ef1a7):_0x2ef1a7;_0x2ef1a7=_0x2fe496[_0x31a082][_0x17a6('0x67')]?_[_0x17a6('0x66')](_0x169ea6[_0x2fe496[_0x31a082][_0x17a6('0x67')]],'%s',_0x2ef1a7):_0x2ef1a7;if(_0x2fe496[_0x31a082][_0x17a6('0x68')]){_0x513171[_0x17a6('0x59')](_0x2ef1a7);}_0x2fe496[_0x31a082][_0x17a6('0x69')]&&_0x513171[_0x17a6('0x30')](_0x2ef1a7,_0x2fe496[_0x31a082][_0x17a6('0x69')]===_0x17a6('0x6a')?![]:!![]);_0x513171[_0x17a6('0x5a')](_0x2ef1a7,_0x2fe496[_0x31a082][_0x17a6('0x6b')]||_0x2ef1a7);}if(_0xdb193f[_0x17a6('0x6c')]){_0xdb193f[_0x17a6('0x6c')]=JSON[_0x17a6('0x6d')](_0xdb193f[_0x17a6('0x6c')]);for(var _0x4a132e=0x0;_0x4a132e<_0xdb193f['joins'][_0x17a6('0x2e')];_0x4a132e+=0x1){if(_0xdb193f[_0x17a6('0x6c')][_0x4a132e][_0x17a6('0x6e')]&&_[_0x17a6('0x52')](_0x5d3572,_0xdb193f[_0x17a6('0x6c')][_0x4a132e]['type'])&&_0xdb193f['joins'][_0x4a132e][_0x17a6('0x6f')]&&_0xdb193f[_0x17a6('0x6c')][_0x4a132e]['foreignTable']&&_0xdb193f[_0x17a6('0x6c')][_0x4a132e][_0x17a6('0x70')]){_0x513171[_0xdb193f[_0x17a6('0x6c')][_0x4a132e][_0x17a6('0x6e')]](_0xdb193f['joins'][_0x4a132e][_0x17a6('0x72')],null,util[_0x17a6('0x67')](_0x17a6('0x71'),_0xdb193f['table'],_0xdb193f['joins'][_0x4a132e]['parentKey'],_0xdb193f[_0x17a6('0x6c')][_0x4a132e][_0x17a6('0x72')],_0xdb193f[_0x17a6('0x6c')][_0x4a132e][_0x17a6('0x70')]));}}}if(_0xdb193f['conditions']){_0xdb193f[_0x17a6('0x73')]=JSON[_0x17a6('0x6d')](_0xdb193f[_0x17a6('0x73')]);_0x513171[_0x17a6('0x38')](_0x124d9f(_0xdb193f[_0x17a6('0x73')]['group']));}_0x466c23=_0x513171[_0x17a6('0x74')]();_0x513171[_0x17a6('0x1b')](_0x3ce1e2);_0x513171[_0x17a6('0x1a')](0x0);logger[_0x17a6('0x75')]('Limited\x20Query:',_0x513171[_0x17a6('0x76')]());return db[_0x17a6('0x77')][_0x17a6('0x28')](_0x513171[_0x17a6('0x76')](),{'type':db[_0x17a6('0x77')][_0x17a6('0x78')][_0x17a6('0x79')]});}})['then'](function(){return{'sql':_0x466c23[_0x17a6('0x76')]()};})[_0x17a6('0x21')](respondWithResult(_0x33bf77,null))[_0x17a6('0x42')](handleError(_0x33bf77,null));}; \ No newline at end of file +var _0xeb84=['path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','status','count','limit','set','apply','save','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','keys','query','dateStart','dateEnd','filters','model','fields','attributes','nolimit','offset','order','sort','pick','add','day','merge','where','filter','options','AnalyticDefaultReport','includeAll','include','findAll','rows','params','intersection','length','find','catch','create','body','update','preview','left_join','right_join','outer_join','cross_join','SUM(%s)','COUNT(%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)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','metric','replace','function','format','groupBy','orderBy','DESC','alias','joins','parse','type','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','sequelize','QueryTypes','SELECT','join','COUNT(DISTINCT\x20%s)','AVG(%s)','DATE(%s)','value','Please\x20insert\x20at\x20least\x20one\x20field','MetricId','toString','output','web','%s-%s.%s','generate','csv','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','child_process','savename','countTable','COUNT(*)','run','runReport','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x233e58,_0x4b0dc2){var _0x3c2db6=function(_0x382fa0){while(--_0x382fa0){_0x233e58['push'](_0x233e58['shift']());}};_0x3c2db6(++_0x4b0dc2);}(_0xeb84,0x11f));var _0x4eb8=function(_0x5e28c2,_0x1e48ab){_0x5e28c2=_0x5e28c2-0x0;var _0x1a8cc6=_0xeb84[_0x5e28c2];return _0x1a8cc6;};'use strict';var pdf=require(_0x4eb8('0x0'));var emlformat=require(_0x4eb8('0x1'));var rimraf=require(_0x4eb8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4eb8('0x3'));var rp=require(_0x4eb8('0x4'));var moment=require(_0x4eb8('0x5'));var BPromise=require(_0x4eb8('0x6'));var Mustache=require(_0x4eb8('0x7'));var util=require(_0x4eb8('0x8'));var path=require(_0x4eb8('0x9'));var sox=require('sox');var csv=require(_0x4eb8('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4eb8('0xb'));var squel=require(_0x4eb8('0xc'));var crypto=require(_0x4eb8('0xd'));var jsforce=require(_0x4eb8('0xe'));var deskjs=require(_0x4eb8('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4eb8('0x10'));var Papa=require(_0x4eb8('0x11'));var Redis=require(_0x4eb8('0x12'));var qs=require('../../components/parsers/qs');var logger=require(_0x4eb8('0x13'))(_0x4eb8('0x14'));var utils=require('../../config/utils');var config=require(_0x4eb8('0x15'));var db=require(_0x4eb8('0x16'))['db'];function respondWithStatusCode(_0x26aa51,_0x445bb3){_0x445bb3=_0x445bb3||0xcc;return function(_0x49e3bd){if(_0x49e3bd){return _0x26aa51['sendStatus'](_0x445bb3);}return _0x26aa51['status'](_0x445bb3)['end']();};}function respondWithResult(_0x254a1f,_0x36dda6){_0x36dda6=_0x36dda6||0xc8;return function(_0x46fe26){if(_0x46fe26){return _0x254a1f[_0x4eb8('0x17')](_0x36dda6)['json'](_0x46fe26);}};}function respondWithFilteredResult(_0x42fe6b,_0x56b0c8){return function(_0x29ad44){if(_0x29ad44){var _0x52ee95=_0x29ad44[_0x4eb8('0x18')],_0x4c34fe=_0x56b0c8['offset'],_0x19e672=_0x56b0c8['offset']+_0x56b0c8[_0x4eb8('0x19')],_0xc17ed3;if(_0x19e672>=_0x52ee95){_0x19e672=_0x52ee95;_0xc17ed3=0xc8;}else{_0xc17ed3=0xce;}_0x42fe6b['status'](_0xc17ed3);return _0x42fe6b[_0x4eb8('0x1a')]('Content-Range',_0x4c34fe+'-'+_0x19e672+'/'+_0x52ee95)['json'](_0x29ad44);}return null;};}function patchUpdates(_0x8d53c4){return function(_0x52a431){try{jsonpatch[_0x4eb8('0x1b')](_0x52a431,_0x8d53c4,!![]);}catch(_0x3743e9){return BPromise['reject'](_0x3743e9);}return _0x52a431[_0x4eb8('0x1c')]();};}function saveUpdates(_0x47cbf1,_0x2f4643){return function(_0x19c1f0){if(_0x19c1f0){return _0x19c1f0['update'](_0x47cbf1)[_0x4eb8('0x1d')](function(_0x3cd992){return _0x3cd992;});}return null;};}function removeEntity(_0x55b433,_0x1c35cc){return function(_0x5d98f9){if(_0x5d98f9){return _0x5d98f9[_0x4eb8('0x1e')]()[_0x4eb8('0x1d')](function(){_0x55b433[_0x4eb8('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e74bf,_0x389bf3){return function(_0x2b86d3){if(!_0x2b86d3){_0x3e74bf[_0x4eb8('0x1f')](0x194);}return _0x2b86d3;};}function handleError(_0x4f06d4,_0x47b484){_0x47b484=_0x47b484||0x1f4;return function(_0x17b62a){logger[_0x4eb8('0x20')](_0x17b62a[_0x4eb8('0x21')]);if(_0x17b62a['name']){delete _0x17b62a[_0x4eb8('0x22')];}_0x4f06d4[_0x4eb8('0x17')](_0x47b484)[_0x4eb8('0x23')](_0x17b62a);};}exports[_0x4eb8('0x24')]=function(_0x4dfe81,_0x4f6563){var _0x3e1541={},_0x1a272d={},_0x11a535={'count':0x0,'rows':[]};var _0x5eb27a=db['AnalyticDefaultReport'][_0x4eb8('0x25')];_0x1a272d['model']=_[_0x4eb8('0x26')](_0x5eb27a);var _0x4e30ee={'dateStart':_0x4dfe81[_0x4eb8('0x27')][_0x4eb8('0x28')],'dateEnd':_0x4dfe81[_0x4eb8('0x27')][_0x4eb8('0x29')]};delete _0x4dfe81['query'][_0x4eb8('0x28')];delete _0x4dfe81['query'][_0x4eb8('0x29')];_0x1a272d[_0x4eb8('0x27')]=_[_0x4eb8('0x26')](_0x4dfe81[_0x4eb8('0x27')]);_0x1a272d[_0x4eb8('0x2a')]=_['intersection'](_0x1a272d['model'],_0x1a272d['query']);_0x3e1541['attributes']=_['intersection'](_0x1a272d[_0x4eb8('0x2b')],qs[_0x4eb8('0x2c')](_0x4dfe81['query'][_0x4eb8('0x2c')]));_0x3e1541[_0x4eb8('0x2d')]=_0x3e1541[_0x4eb8('0x2d')]['length']?_0x3e1541['attributes']:_0x1a272d[_0x4eb8('0x2b')];if(!_0x4dfe81['query']['hasOwnProperty'](_0x4eb8('0x2e'))){_0x3e1541['limit']=qs[_0x4eb8('0x19')](_0x4dfe81[_0x4eb8('0x27')][_0x4eb8('0x19')]);_0x3e1541[_0x4eb8('0x2f')]=qs[_0x4eb8('0x2f')](_0x4dfe81[_0x4eb8('0x27')][_0x4eb8('0x2f')]);}_0x3e1541[_0x4eb8('0x30')]=qs[_0x4eb8('0x31')](_0x4dfe81[_0x4eb8('0x27')][_0x4eb8('0x31')]);_0x3e1541['where']=qs['filters'](_[_0x4eb8('0x32')](_0x4dfe81[_0x4eb8('0x27')],_0x1a272d[_0x4eb8('0x2a')]));if(_0x4e30ee[_0x4eb8('0x28')]){if(_0x4e30ee[_0x4eb8('0x29')]){_0x4e30ee[_0x4eb8('0x29')]=moment(_0x4e30ee[_0x4eb8('0x29')])[_0x4eb8('0x33')](0x1,'day');}else{_0x4e30ee[_0x4eb8('0x29')]=moment(_0x4e30ee[_0x4eb8('0x28')])[_0x4eb8('0x33')](0x1,_0x4eb8('0x34'));}_[_0x4eb8('0x35')](_0x3e1541[_0x4eb8('0x36')],{'createdAt':{'$gte':_0x4e30ee[_0x4eb8('0x28')],'$lte':_0x4e30ee[_0x4eb8('0x29')]}});}if(_0x4dfe81[_0x4eb8('0x27')]['filter']){_0x3e1541['where']=_[_0x4eb8('0x35')](_0x3e1541[_0x4eb8('0x36')],{'$or':_['map'](_0x3e1541[_0x4eb8('0x2d')],function(_0x2a6821){var _0x4f2554={};_0x4f2554[_0x2a6821]={'$like':'%'+_0x4dfe81[_0x4eb8('0x27')][_0x4eb8('0x37')]+'%'};return _0x4f2554;})});}_0x3e1541=_[_0x4eb8('0x35')]({},_0x3e1541,_0x4dfe81[_0x4eb8('0x38')]);var _0x3bb57c={'where':_0x3e1541['where']};return db[_0x4eb8('0x39')][_0x4eb8('0x18')](_0x3bb57c)[_0x4eb8('0x1d')](function(_0x37b373){_0x11a535[_0x4eb8('0x18')]=_0x37b373;if(_0x4dfe81[_0x4eb8('0x27')][_0x4eb8('0x3a')]){_0x3e1541[_0x4eb8('0x3b')]=[{'all':!![]}];}return db[_0x4eb8('0x39')][_0x4eb8('0x3c')](_0x3e1541);})[_0x4eb8('0x1d')](function(_0xcfa864){_0x11a535[_0x4eb8('0x3d')]=_0xcfa864;return _0x11a535;})[_0x4eb8('0x1d')](respondWithFilteredResult(_0x4f6563,_0x3e1541))['catch'](handleError(_0x4f6563,null));};exports['show']=function(_0x3f20fe,_0x21451a){var _0x2a2675={'raw':!![],'where':{'id':_0x3f20fe[_0x4eb8('0x3e')]['id']}},_0x57a88f={};_0x57a88f['model']=_[_0x4eb8('0x26')](db['AnalyticDefaultReport']['rawAttributes']);_0x57a88f['query']=_[_0x4eb8('0x26')](_0x3f20fe[_0x4eb8('0x27')]);_0x57a88f[_0x4eb8('0x2a')]=_[_0x4eb8('0x3f')](_0x57a88f[_0x4eb8('0x2b')],_0x57a88f['query']);_0x2a2675['attributes']=_[_0x4eb8('0x3f')](_0x57a88f[_0x4eb8('0x2b')],qs[_0x4eb8('0x2c')](_0x3f20fe[_0x4eb8('0x27')][_0x4eb8('0x2c')]));_0x2a2675[_0x4eb8('0x2d')]=_0x2a2675[_0x4eb8('0x2d')][_0x4eb8('0x40')]?_0x2a2675[_0x4eb8('0x2d')]:_0x57a88f['model'];if(_0x3f20fe[_0x4eb8('0x27')][_0x4eb8('0x3a')]){_0x2a2675[_0x4eb8('0x3b')]=[{'all':!![]}];}_0x2a2675=_['merge']({},_0x2a2675,_0x3f20fe[_0x4eb8('0x38')]);return db[_0x4eb8('0x39')][_0x4eb8('0x41')](_0x2a2675)[_0x4eb8('0x1d')](handleEntityNotFound(_0x21451a,null))[_0x4eb8('0x1d')](respondWithResult(_0x21451a,null))[_0x4eb8('0x42')](handleError(_0x21451a,null));};exports['create']=function(_0x1eb26e,_0x5f06de){return db[_0x4eb8('0x39')][_0x4eb8('0x43')](_0x1eb26e[_0x4eb8('0x44')],{})['then'](respondWithResult(_0x5f06de,0xc9))[_0x4eb8('0x42')](handleError(_0x5f06de,null));};exports[_0x4eb8('0x45')]=function(_0x142d23,_0x1b899a){if(_0x142d23[_0x4eb8('0x44')]['id']){delete _0x142d23[_0x4eb8('0x44')]['id'];}return db[_0x4eb8('0x39')]['find']({'where':{'id':_0x142d23[_0x4eb8('0x3e')]['id']}})[_0x4eb8('0x1d')](handleEntityNotFound(_0x1b899a,null))[_0x4eb8('0x1d')](saveUpdates(_0x142d23['body'],null))[_0x4eb8('0x1d')](respondWithResult(_0x1b899a,null))[_0x4eb8('0x42')](handleError(_0x1b899a,null));};exports[_0x4eb8('0x1e')]=function(_0x527495,_0xebd999){return db['AnalyticDefaultReport'][_0x4eb8('0x41')]({'where':{'id':_0x527495[_0x4eb8('0x3e')]['id']}})[_0x4eb8('0x1d')](handleEntityNotFound(_0xebd999,null))['then'](removeEntity(_0xebd999,null))[_0x4eb8('0x42')](handleError(_0xebd999,null));};exports[_0x4eb8('0x46')]=function(_0x4d9989,_0x5c158b){var _0x54c444=0xa;var _0x336ef6=['join',_0x4eb8('0x47'),_0x4eb8('0x48'),_0x4eb8('0x49'),_0x4eb8('0x4a')];var _0x3eebce={'SUM':_0x4eb8('0x4b'),'COUNT':_0x4eb8('0x4c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x4eb8('0x4d'),'MIN':_0x4eb8('0x4e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4eb8('0x4f'),'GROUP_CONCAT ASC':_0x4eb8('0x50'),'GROUP_CONCAT DESC':_0x4eb8('0x51')};var _0x34fbbe={'SEC_TO_TIME':_0x4eb8('0x52'),'DATE':'DATE(%s)','HOUR':_0x4eb8('0x53'),'ROUND':_0x4eb8('0x54'),'UNIX_TIMESTAMP':_0x4eb8('0x55')};var _0x32368d=function(_0x1732f8){return!_[_0x4eb8('0x56')]([_0x4eb8('0x57'),_0x4eb8('0x58'),_0x4eb8('0x59'),_0x4eb8('0x5a')],_0x1732f8);};var _0x55234d=function(_0x377739){if(!_0x377739||!_0x377739[_0x4eb8('0x5b')][_0x4eb8('0x40')]){return'';}for(var _0x38d1f5='(',_0x4e8b1d=0x0;_0x4e8b1d<_0x377739[_0x4eb8('0x5b')]['length'];_0x4e8b1d+=0x1){_0x4e8b1d>0x0&&(_0x38d1f5+='\x20'+_0x377739[_0x4eb8('0x5c')]+'\x20');_0x38d1f5+=_0x377739[_0x4eb8('0x5b')][_0x4e8b1d][_0x4eb8('0x5d')]?_0x55234d(_0x377739[_0x4eb8('0x5b')][_0x4e8b1d]['group']):_0x377739[_0x4eb8('0x5b')][_0x4e8b1d][_0x4eb8('0x5e')]+'\x20'+_0x377739[_0x4eb8('0x5b')][_0x4e8b1d][_0x4eb8('0x5f')]+(_0x32368d(_0x377739[_0x4eb8('0x5b')][_0x4e8b1d][_0x4eb8('0x5f')])?'\x20'+_0x377739[_0x4eb8('0x5b')][_0x4e8b1d]['value']:'');}return _0x38d1f5+')';};var _0x371e3b={'where':{'id':_0x4d9989['params']['id']}},_0x303d9e,_0x413182,_0xfc8cb1,_0x5d2fde,_0x57242a;_0x371e3b=_['merge']({},_0x371e3b,_0x4d9989[_0x4eb8('0x38')]);return db[_0x4eb8('0x39')][_0x4eb8('0x41')](_0x371e3b)[_0x4eb8('0x1d')](function(_0x2e8d39){if(_0x2e8d39){_0x303d9e=_0x2e8d39;return _0x2e8d39[_0x4eb8('0x60')]();}return null;})[_0x4eb8('0x1d')](function(_0x24b6c9){if(_0x24b6c9){if(!_0x24b6c9[_0x4eb8('0x40')]){throw new db[(_0x4eb8('0x61'))][(_0x4eb8('0x62'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x413182=_0x24b6c9;return db[_0x4eb8('0x63')][_0x4eb8('0x3c')]({'raw':!![]});}return null;})[_0x4eb8('0x1d')](function(_0x1f063f){if(_0x1f063f){_0xfc8cb1=_[_0x4eb8('0x64')](_0x1f063f,'id');var _0x423f17;var _0x31e595=squel[_0x4eb8('0x65')]();_0x31e595[_0x4eb8('0x66')](_0x303d9e[_0x4eb8('0x67')]);for(var _0x5533a9=0x0;_0x5533a9<_0x413182[_0x4eb8('0x40')];_0x5533a9+=0x1){_0x423f17=_0x413182[_0x5533a9]['MetricId']?_0xfc8cb1[_0x413182[_0x5533a9]['MetricId']][_0x4eb8('0x68')]:_0x413182[_0x5533a9][_0x4eb8('0x5e')];_0x423f17=_0x413182[_0x5533a9]['function']?_[_0x4eb8('0x69')](_0x3eebce[_0x413182[_0x5533a9][_0x4eb8('0x6a')]],'%s',_0x423f17):_0x423f17;_0x423f17=_0x413182[_0x5533a9][_0x4eb8('0x6b')]?_[_0x4eb8('0x69')](_0x34fbbe[_0x413182[_0x5533a9][_0x4eb8('0x6b')]],'%s',_0x423f17):_0x423f17;if(_0x413182[_0x5533a9][_0x4eb8('0x6c')]){_0x31e595[_0x4eb8('0x5d')](_0x423f17);}_0x413182[_0x5533a9]['orderBy']&&_0x31e595[_0x4eb8('0x30')](_0x423f17,_0x413182[_0x5533a9][_0x4eb8('0x6d')]===_0x4eb8('0x6e')?![]:!![]);_0x31e595[_0x4eb8('0x5e')](_0x423f17,_0x413182[_0x5533a9][_0x4eb8('0x6f')]||_0x423f17);}if(_0x303d9e[_0x4eb8('0x70')]){_0x303d9e[_0x4eb8('0x70')]=JSON[_0x4eb8('0x71')](_0x303d9e[_0x4eb8('0x70')]);for(var _0x22edd7=0x0;_0x22edd7<_0x303d9e[_0x4eb8('0x70')][_0x4eb8('0x40')];_0x22edd7+=0x1){if(_0x303d9e['joins'][_0x22edd7]['type']&&_[_0x4eb8('0x56')](_0x336ef6,_0x303d9e[_0x4eb8('0x70')][_0x22edd7][_0x4eb8('0x72')])&&_0x303d9e[_0x4eb8('0x70')][_0x22edd7]['parentKey']&&_0x303d9e[_0x4eb8('0x70')][_0x22edd7][_0x4eb8('0x73')]&&_0x303d9e[_0x4eb8('0x70')][_0x22edd7][_0x4eb8('0x74')]){_0x31e595[_0x303d9e[_0x4eb8('0x70')][_0x22edd7]['type']](_0x303d9e[_0x4eb8('0x70')][_0x22edd7][_0x4eb8('0x73')],null,util[_0x4eb8('0x6b')](_0x4eb8('0x75'),_0x303d9e[_0x4eb8('0x67')],_0x303d9e['joins'][_0x22edd7][_0x4eb8('0x76')],_0x303d9e['joins'][_0x22edd7][_0x4eb8('0x73')],_0x303d9e[_0x4eb8('0x70')][_0x22edd7][_0x4eb8('0x74')]));}}}if(_0x303d9e[_0x4eb8('0x77')]){_0x303d9e[_0x4eb8('0x77')]=JSON[_0x4eb8('0x71')](_0x303d9e[_0x4eb8('0x77')]);_0x31e595[_0x4eb8('0x36')](_0x55234d(_0x303d9e[_0x4eb8('0x77')][_0x4eb8('0x5d')]));}_0x57242a=_0x31e595[_0x4eb8('0x78')]();_0x31e595[_0x4eb8('0x19')](_0x54c444);_0x31e595[_0x4eb8('0x2f')](0x0);logger[_0x4eb8('0x79')]('Limited\x20Query:',_0x31e595['toString']());return db[_0x4eb8('0x7a')][_0x4eb8('0x27')](_0x31e595['toString'](),{'type':db[_0x4eb8('0x7a')][_0x4eb8('0x7b')][_0x4eb8('0x7c')]});}})[_0x4eb8('0x1d')](respondWithResult(_0x5c158b,null))[_0x4eb8('0x42')](handleError(_0x5c158b,null));};function runReport(_0x445515,_0x4b1092,_0x5e8131){var _0x561ef1=_0x4b1092[_0x4eb8('0x22')];var _0x133892=0xa;var _0x1f07fd=[_0x4eb8('0x7d'),_0x4eb8('0x47'),'right_join',_0x4eb8('0x49'),_0x4eb8('0x4a')];var _0x2c3377={'SUM':_0x4eb8('0x4b'),'COUNT':_0x4eb8('0x4c'),'COUNT DISTINCT':_0x4eb8('0x7e'),'MAX':'MAX(%s)','MIN':_0x4eb8('0x4e'),'AVG':_0x4eb8('0x7f'),'GROUP_CONCAT':_0x4eb8('0x4f'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4eb8('0x51')};var _0x5f5a9f={'SEC_TO_TIME':_0x4eb8('0x52'),'DATE':_0x4eb8('0x80'),'HOUR':_0x4eb8('0x53'),'ROUND':_0x4eb8('0x54'),'UNIX_TIMESTAMP':_0x4eb8('0x55')};var _0x36ff79=function(_0x6ccd36){return!_[_0x4eb8('0x56')]([_0x4eb8('0x57'),_0x4eb8('0x58'),_0x4eb8('0x59'),'IS\x20NOT\x20EMPTY'],_0x6ccd36);};var _0x1058b6=function(_0x517928){if(!_0x517928||!_0x517928[_0x4eb8('0x5b')][_0x4eb8('0x40')]){return'';}for(var _0x1a62ac='(',_0x4aaa68=0x0;_0x4aaa68<_0x517928[_0x4eb8('0x5b')][_0x4eb8('0x40')];_0x4aaa68+=0x1){_0x4aaa68>0x0&&(_0x1a62ac+='\x20'+_0x517928['operator']+'\x20');_0x1a62ac+=_0x517928[_0x4eb8('0x5b')][_0x4aaa68][_0x4eb8('0x5d')]?_0x1058b6(_0x517928[_0x4eb8('0x5b')][_0x4aaa68][_0x4eb8('0x5d')]):_0x517928[_0x4eb8('0x5b')][_0x4aaa68][_0x4eb8('0x5e')]+'\x20'+_0x517928[_0x4eb8('0x5b')][_0x4aaa68][_0x4eb8('0x5f')]+(_0x36ff79(_0x517928['rules'][_0x4aaa68][_0x4eb8('0x5f')])?'\x20'+_0x517928['rules'][_0x4aaa68][_0x4eb8('0x81')]:'');}return _0x1a62ac+')';};var _0x76cdad={'where':{'id':_0x445515['id']}},_0x246154,_0x260a27,_0x94ed4c,_0x5b62e7,_0x4fffb0;_0x76cdad=_[_0x4eb8('0x35')]({},_0x76cdad,_0x5e8131);return db['AnalyticDefaultReport'][_0x4eb8('0x41')](_0x76cdad)['then'](function(_0x4e3712){if(_0x4e3712){_0x246154=_0x4e3712;return _0x4e3712[_0x4eb8('0x60')]();}return null;})[_0x4eb8('0x1d')](function(_0x1f86b8){if(_0x1f86b8){if(!_0x1f86b8[_0x4eb8('0x40')]){throw new db['Sequelize']['ValidationErrorItem'](_0x4eb8('0x82'),0x193);}_0x260a27=_0x1f86b8;return db[_0x4eb8('0x63')][_0x4eb8('0x3c')]({'raw':!![]});}return null;})['then'](function(_0x582ba1){if(_0x582ba1){_0x94ed4c=_['keyBy'](_0x582ba1,'id');var _0x372dd5;var _0x59e53d=squel[_0x4eb8('0x65')]();_0x59e53d['from'](_0x246154[_0x4eb8('0x67')]);for(var _0x2ffce0=0x0;_0x2ffce0<_0x260a27['length'];_0x2ffce0+=0x1){_0x372dd5=_0x260a27[_0x2ffce0][_0x4eb8('0x83')]?_0x94ed4c[_0x260a27[_0x2ffce0][_0x4eb8('0x83')]][_0x4eb8('0x68')]:_0x260a27[_0x2ffce0][_0x4eb8('0x5e')];_0x372dd5=_0x260a27[_0x2ffce0]['function']?_[_0x4eb8('0x69')](_0x2c3377[_0x260a27[_0x2ffce0][_0x4eb8('0x6a')]],'%s',_0x372dd5):_0x372dd5;_0x372dd5=_0x260a27[_0x2ffce0][_0x4eb8('0x6b')]?_[_0x4eb8('0x69')](_0x5f5a9f[_0x260a27[_0x2ffce0][_0x4eb8('0x6b')]],'%s',_0x372dd5):_0x372dd5;if(_0x260a27[_0x2ffce0][_0x4eb8('0x6c')]){_0x59e53d[_0x4eb8('0x5d')](_0x372dd5);}_0x260a27[_0x2ffce0][_0x4eb8('0x6d')]&&_0x59e53d['order'](_0x372dd5,_0x260a27[_0x2ffce0][_0x4eb8('0x6d')]==='DESC'?![]:!![]);_0x59e53d[_0x4eb8('0x5e')](_0x372dd5,_0x260a27[_0x2ffce0]['alias']||_0x372dd5);}if(_0x246154[_0x4eb8('0x70')]){_0x246154[_0x4eb8('0x70')]=JSON[_0x4eb8('0x71')](_0x246154[_0x4eb8('0x70')]);for(var _0x7b5a21=0x0;_0x7b5a21<_0x246154[_0x4eb8('0x70')]['length'];_0x7b5a21+=0x1){if(_0x246154[_0x4eb8('0x70')][_0x7b5a21][_0x4eb8('0x72')]&&_[_0x4eb8('0x56')](_0x1f07fd,_0x246154[_0x4eb8('0x70')][_0x7b5a21][_0x4eb8('0x72')])&&_0x246154[_0x4eb8('0x70')][_0x7b5a21][_0x4eb8('0x76')]&&_0x246154['joins'][_0x7b5a21][_0x4eb8('0x73')]&&_0x246154[_0x4eb8('0x70')][_0x7b5a21][_0x4eb8('0x74')]){_0x59e53d[_0x246154[_0x4eb8('0x70')][_0x7b5a21]['type']](_0x246154['joins'][_0x7b5a21]['foreignTable'],null,util['format'](_0x4eb8('0x75'),_0x246154[_0x4eb8('0x67')],_0x246154[_0x4eb8('0x70')][_0x7b5a21][_0x4eb8('0x76')],_0x246154[_0x4eb8('0x70')][_0x7b5a21][_0x4eb8('0x73')],_0x246154['joins'][_0x7b5a21][_0x4eb8('0x74')]));}}}if(_0x246154[_0x4eb8('0x77')]){_0x246154[_0x4eb8('0x77')]=JSON[_0x4eb8('0x71')](_0x246154['conditions']);_0x59e53d[_0x4eb8('0x36')](_0x1058b6(_0x246154[_0x4eb8('0x77')]['group']));}_0x4fffb0=_0x59e53d['clone']();_0x59e53d['limit'](_0x133892);_0x59e53d[_0x4eb8('0x2f')](0x0);logger[_0x4eb8('0x79')]('Limited\x20Query:',_0x59e53d[_0x4eb8('0x84')]());return db[_0x4eb8('0x7a')][_0x4eb8('0x27')](_0x59e53d[_0x4eb8('0x84')](),{'type':db[_0x4eb8('0x7a')][_0x4eb8('0x7b')][_0x4eb8('0x7c')]});}})['then'](function(_0x38a743){if(!_0x38a743['length']){throw new db[(_0x4eb8('0x61'))]['ValidationErrorItem']('No\x20available\x20data',0xcc);}if(_0x4b1092[_0x4eb8('0x85')]===_0x4eb8('0x86')){return null;}var _0x2f1856=_[_0x4eb8('0x35')](_0x4b1092,{'name':_0x4b1092['fullPath']||_0x4b1092[_0x4eb8('0x22')]||_0x246154[_0x4eb8('0x22')],'basename':_0x561ef1,'savename':util['format'](_0x4eb8('0x87'),_0x4b1092[_0x4eb8('0x22')]||_0x246154[_0x4eb8('0x22')],require('randomstring')[_0x4eb8('0x88')](0x4),_0x4b1092['output']||_0x4eb8('0x89'))});return db[_0x4eb8('0x8a')][_0x4eb8('0x43')](_0x2f1856,{'raw':!![]});})[_0x4eb8('0x1d')](function(_0x1c75e7){if(_0x246154['table']==='cdr'){_0x4fffb0['where'](_0x246154[_0x4eb8('0x67')]+_0x4eb8('0x8b'),_0x4b1092[_0x4eb8('0x8c')],_0x4b1092['endDate']);}else{_0x4fffb0[_0x4eb8('0x36')](_0x246154[_0x4eb8('0x67')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4b1092['startDate'],_0x4b1092[_0x4eb8('0x8d')]);}if(_0x1c75e7){logger['info']('Run\x20Query:',_0x4fffb0['toString']());require(_0x4eb8('0x8e'))['fork'](path[_0x4eb8('0x7d')](__dirname,'../../components/export/',_0x1c75e7[_0x4eb8('0x85')]),[_0x1c75e7['id'],_0x4fffb0[_0x4eb8('0x84')](),path[_0x4eb8('0x7d')](__dirname,'../../files/reports',_0x1c75e7[_0x4eb8('0x8f')]),_0x561ef1]);return _0x1c75e7;}else{var _0x4eb2ff=squel[_0x4eb8('0x65')]();_0x4eb2ff[_0x4eb8('0x66')]('('+_0x4fffb0[_0x4eb8('0x84')]()+')',_0x4eb8('0x90'));_0x4eb2ff[_0x4eb8('0x5e')](_0x4eb8('0x91'),_0x4eb8('0x18'));_0x4fffb0[_0x4eb8('0x19')](_0x4b1092[_0x4eb8('0x19')]||_0x133892);_0x4fffb0[_0x4eb8('0x2f')](_0x4b1092[_0x4eb8('0x2f')]||0x0);return db[_0x4eb8('0x7a')]['query'](_0x4eb2ff[_0x4eb8('0x84')](),{'type':db[_0x4eb8('0x7a')][_0x4eb8('0x7b')]['SELECT']})[_0x4eb8('0x1d')](function(_0x9859ff){if(!_0x9859ff[_0x4eb8('0x40')]){_0x5b62e7=0x0;}else{_0x5b62e7=_0x9859ff[0x0][_0x4eb8('0x18')]||0x0;}return db[_0x4eb8('0x7a')][_0x4eb8('0x27')](_0x4fffb0['toString'](),{'type':db[_0x4eb8('0x7a')]['QueryTypes'][_0x4eb8('0x7c')]});})[_0x4eb8('0x1d')](function(_0xfe89cb){return{'rows':_0xfe89cb||[],'count':_0x5b62e7};});}});}exports[_0x4eb8('0x92')]=function(_0x54f353,_0x19d769){return runReport(_0x54f353[_0x4eb8('0x3e')],_0x54f353[_0x4eb8('0x27')],_0x54f353[_0x4eb8('0x38')])[_0x4eb8('0x1d')](respondWithResult(_0x19d769,null))[_0x4eb8('0x42')](handleError(_0x19d769,null));};exports[_0x4eb8('0x93')]=runReport;exports[_0x4eb8('0x27')]=function(_0x339400,_0x37b770){var _0x38cf35=0xa;var _0x6d7663=[_0x4eb8('0x7d'),_0x4eb8('0x47'),_0x4eb8('0x48'),_0x4eb8('0x49'),_0x4eb8('0x4a')];var _0x4da6f2={'SUM':_0x4eb8('0x4b'),'COUNT':_0x4eb8('0x4c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x4eb8('0x4f'),'GROUP_CONCAT ASC':_0x4eb8('0x50'),'GROUP_CONCAT DESC':_0x4eb8('0x51')};var _0x5d37df={'SEC_TO_TIME':_0x4eb8('0x52'),'DATE':_0x4eb8('0x80'),'HOUR':_0x4eb8('0x53'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4eb8('0x55')};var _0x31d083=function(_0x36033a){return!_[_0x4eb8('0x56')]([_0x4eb8('0x57'),_0x4eb8('0x58'),_0x4eb8('0x59'),_0x4eb8('0x5a')],_0x36033a);};var _0x5832d3=function(_0x510463){if(!_0x510463||!_0x510463[_0x4eb8('0x5b')][_0x4eb8('0x40')]){return'';}for(var _0x29c080='(',_0x1936bf=0x0;_0x1936bf<_0x510463[_0x4eb8('0x5b')]['length'];_0x1936bf+=0x1){_0x1936bf>0x0&&(_0x29c080+='\x20'+_0x510463[_0x4eb8('0x5c')]+'\x20');_0x29c080+=_0x510463[_0x4eb8('0x5b')][_0x1936bf][_0x4eb8('0x5d')]?_0x5832d3(_0x510463[_0x4eb8('0x5b')][_0x1936bf][_0x4eb8('0x5d')]):_0x510463[_0x4eb8('0x5b')][_0x1936bf][_0x4eb8('0x5e')]+'\x20'+_0x510463[_0x4eb8('0x5b')][_0x1936bf][_0x4eb8('0x5f')]+(_0x31d083(_0x510463['rules'][_0x1936bf][_0x4eb8('0x5f')])?'\x20'+_0x510463['rules'][_0x1936bf][_0x4eb8('0x81')]:'');}return _0x29c080+')';};var _0x3e7553={'where':{'id':_0x339400[_0x4eb8('0x3e')]['id']}},_0xdb5d56,_0x4101c8,_0x3ef22d,_0x140633,_0x33f96a;_0x3e7553=_['merge']({},_0x3e7553,_0x339400[_0x4eb8('0x38')]);return db[_0x4eb8('0x39')][_0x4eb8('0x41')](_0x3e7553)[_0x4eb8('0x1d')](function(_0x5d722b){if(_0x5d722b){_0xdb5d56=_0x5d722b;return _0x5d722b[_0x4eb8('0x60')]();}return null;})['then'](function(_0x58a375){if(_0x58a375){if(!_0x58a375[_0x4eb8('0x40')]){throw new db['Sequelize'][(_0x4eb8('0x62'))](_0x4eb8('0x82'),0x193);}_0x4101c8=_0x58a375;return db['AnalyticMetric'][_0x4eb8('0x3c')]({'raw':!![]});}return null;})[_0x4eb8('0x1d')](function(_0x2a0faf){if(_0x2a0faf){_0x3ef22d=_[_0x4eb8('0x64')](_0x2a0faf,'id');var _0x2b6262;var _0x5bdcd2=squel['select']();_0x5bdcd2[_0x4eb8('0x66')](_0xdb5d56['table']);for(var _0x5beea4=0x0;_0x5beea4<_0x4101c8['length'];_0x5beea4+=0x1){_0x2b6262=_0x4101c8[_0x5beea4]['MetricId']?_0x3ef22d[_0x4101c8[_0x5beea4][_0x4eb8('0x83')]][_0x4eb8('0x68')]:_0x4101c8[_0x5beea4][_0x4eb8('0x5e')];_0x2b6262=_0x4101c8[_0x5beea4][_0x4eb8('0x6a')]?_[_0x4eb8('0x69')](_0x4da6f2[_0x4101c8[_0x5beea4]['function']],'%s',_0x2b6262):_0x2b6262;_0x2b6262=_0x4101c8[_0x5beea4][_0x4eb8('0x6b')]?_[_0x4eb8('0x69')](_0x5d37df[_0x4101c8[_0x5beea4][_0x4eb8('0x6b')]],'%s',_0x2b6262):_0x2b6262;if(_0x4101c8[_0x5beea4][_0x4eb8('0x6c')]){_0x5bdcd2[_0x4eb8('0x5d')](_0x2b6262);}_0x4101c8[_0x5beea4][_0x4eb8('0x6d')]&&_0x5bdcd2['order'](_0x2b6262,_0x4101c8[_0x5beea4][_0x4eb8('0x6d')]===_0x4eb8('0x6e')?![]:!![]);_0x5bdcd2[_0x4eb8('0x5e')](_0x2b6262,_0x4101c8[_0x5beea4]['alias']||_0x2b6262);}if(_0xdb5d56['joins']){_0xdb5d56[_0x4eb8('0x70')]=JSON['parse'](_0xdb5d56[_0x4eb8('0x70')]);for(var _0x17d56b=0x0;_0x17d56b<_0xdb5d56['joins'][_0x4eb8('0x40')];_0x17d56b+=0x1){if(_0xdb5d56[_0x4eb8('0x70')][_0x17d56b][_0x4eb8('0x72')]&&_[_0x4eb8('0x56')](_0x6d7663,_0xdb5d56['joins'][_0x17d56b]['type'])&&_0xdb5d56[_0x4eb8('0x70')][_0x17d56b][_0x4eb8('0x76')]&&_0xdb5d56[_0x4eb8('0x70')][_0x17d56b]['foreignTable']&&_0xdb5d56[_0x4eb8('0x70')][_0x17d56b][_0x4eb8('0x74')]){_0x5bdcd2[_0xdb5d56[_0x4eb8('0x70')][_0x17d56b][_0x4eb8('0x72')]](_0xdb5d56[_0x4eb8('0x70')][_0x17d56b][_0x4eb8('0x73')],null,util[_0x4eb8('0x6b')](_0x4eb8('0x75'),_0xdb5d56[_0x4eb8('0x67')],_0xdb5d56[_0x4eb8('0x70')][_0x17d56b][_0x4eb8('0x76')],_0xdb5d56[_0x4eb8('0x70')][_0x17d56b][_0x4eb8('0x73')],_0xdb5d56[_0x4eb8('0x70')][_0x17d56b][_0x4eb8('0x74')]));}}}if(_0xdb5d56[_0x4eb8('0x77')]){_0xdb5d56['conditions']=JSON[_0x4eb8('0x71')](_0xdb5d56[_0x4eb8('0x77')]);_0x5bdcd2['where'](_0x5832d3(_0xdb5d56[_0x4eb8('0x77')]['group']));}_0x33f96a=_0x5bdcd2['clone']();_0x5bdcd2['limit'](_0x38cf35);_0x5bdcd2[_0x4eb8('0x2f')](0x0);logger['debug']('Limited\x20Query:',_0x5bdcd2[_0x4eb8('0x84')]());return db['sequelize']['query'](_0x5bdcd2[_0x4eb8('0x84')](),{'type':db[_0x4eb8('0x7a')][_0x4eb8('0x7b')][_0x4eb8('0x7c')]});}})[_0x4eb8('0x1d')](function(){return{'sql':_0x33f96a[_0x4eb8('0x84')]()};})[_0x4eb8('0x1d')](respondWithResult(_0x37b770,null))['catch'](handleError(_0x37b770,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index a17cb06..ceaad11 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 _0x799a=['bluebird','request-promise','exports','define','AnalyticDefaultReport','util','../../config/logger'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0x799a,0x194));var _0xa799=function(_0x33d962,_0x44e948){_0x33d962=_0x33d962-0x0;var _0x4fe04e=_0x799a[_0x33d962];return _0x4fe04e;};'use strict';var _=require('lodash');var util=require(_0xa799('0x0'));var logger=require(_0xa799('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa799('0x2'));var rp=require(_0xa799('0x3'));var attributes=require('./analyticDefaultReport.attributes');module[_0xa799('0x4')]=function(_0x52948a,_0x86efc4){return _0x52948a[_0xa799('0x5')](_0xa799('0x6'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7479=['exports','define','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','./analyticDefaultReport.attributes'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x7479,0x161));var _0x9747=function(_0x22b7b5,_0x40c6d7){_0x22b7b5=_0x22b7b5-0x0;var _0x42dec0=_0x7479[_0x22b7b5];return _0x42dec0;};'use strict';var _=require(_0x9747('0x0'));var util=require(_0x9747('0x1'));var logger=require(_0x9747('0x2'))(_0x9747('0x3'));var moment=require(_0x9747('0x4'));var BPromise=require(_0x9747('0x5'));var rp=require('request-promise');var attributes=require(_0x9747('0x6'));module[_0x9747('0x7')]=function(_0x1fab24,_0x4872a1){return _0x1fab24[_0x9747('0x8')]('AnalyticDefaultReport',attributes,{'tableName':_0x9747('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 6dfc550..3135c08 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 _0xa9e0=['http','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\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(_0x5532a1,_0x19372c){var _0xe118e9=function(_0x15f749){while(--_0x15f749){_0x5532a1['push'](_0x5532a1['shift']());}};_0xe118e9(++_0x19372c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 _0xbdb7=['request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','AnalyticDefaultReport,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x56f604,_0x31e0fc){_0x56f604=_0x56f604-0x0;var _0x5c3f23=_0xbdb7[_0x56f604];return _0x5c3f23;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 4efcdb8..9cb2c5d 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 _0x09ff=['../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','/:id','show','get','/:id/preview','preview','/:id/run','run','/:id/query','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1793de,_0x4d7233){var _0x4f0309=function(_0x229ee7){while(--_0x229ee7){_0x1793de['push'](_0x1793de['shift']());}};_0x4f0309(++_0x4d7233);}(_0x09ff,0x8a));var _0xf09f=function(_0x1f3cb3,_0x5e76d0){_0x1f3cb3=_0x1f3cb3-0x0;var _0x2829f8=_0x09ff[_0x1f3cb3];return _0x2829f8;};'use strict';var multer=require(_0xf09f('0x0'));var util=require(_0xf09f('0x1'));var path=require('path');var timeout=require(_0xf09f('0x2'));var express=require(_0xf09f('0x3'));var router=express[_0xf09f('0x4')]();var auth=require(_0xf09f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf09f('0x6'));var controller=require(_0xf09f('0x7'));router['get']('/',auth[_0xf09f('0x8')](),controller[_0xf09f('0x9')]);router['get'](_0xf09f('0xa'),auth[_0xf09f('0x8')](),controller[_0xf09f('0xb')]);router[_0xf09f('0xc')](_0xf09f('0xd'),auth[_0xf09f('0x8')](),controller[_0xf09f('0xe')]);router[_0xf09f('0xc')](_0xf09f('0xf'),auth['isAuthenticated'](),controller[_0xf09f('0x10')]);router[_0xf09f('0xc')](_0xf09f('0x11'),auth[_0xf09f('0x8')](),controller['query']);router[_0xf09f('0x12')]('/',auth[_0xf09f('0x8')](),controller['create']);router[_0xf09f('0x13')](_0xf09f('0xa'),auth['isAuthenticated'](),controller[_0xf09f('0x14')]);router[_0xf09f('0x15')](_0xf09f('0xa'),auth['isAuthenticated'](),controller[_0xf09f('0x16')]);module[_0xf09f('0x17')]=router; \ No newline at end of file +var _0x0f5f=['isAuthenticated','index','/:id','run','/:id/query','query','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get'];(function(_0x580e77,_0x39d942){var _0x36ff37=function(_0x3f2691){while(--_0x3f2691){_0x580e77['push'](_0x580e77['shift']());}};_0x36ff37(++_0x39d942);}(_0x0f5f,0x1af));var _0xf0f5=function(_0xaecb3e,_0x4b883f){_0xaecb3e=_0xaecb3e-0x0;var _0x4763c4=_0x0f5f[_0xaecb3e];return _0x4763c4;};'use strict';var multer=require(_0xf0f5('0x0'));var util=require(_0xf0f5('0x1'));var path=require(_0xf0f5('0x2'));var timeout=require(_0xf0f5('0x3'));var express=require(_0xf0f5('0x4'));var router=express[_0xf0f5('0x5')]();var auth=require(_0xf0f5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf0f5('0x7'));var controller=require('./analyticDefaultReport.controller');router[_0xf0f5('0x8')]('/',auth[_0xf0f5('0x9')](),controller[_0xf0f5('0xa')]);router[_0xf0f5('0x8')](_0xf0f5('0xb'),auth[_0xf0f5('0x9')](),controller['show']);router[_0xf0f5('0x8')]('/:id/preview',auth[_0xf0f5('0x9')](),controller['preview']);router[_0xf0f5('0x8')]('/:id/run',auth[_0xf0f5('0x9')](),controller[_0xf0f5('0xc')]);router[_0xf0f5('0x8')](_0xf0f5('0xd'),auth[_0xf0f5('0x9')](),controller[_0xf0f5('0xe')]);router[_0xf0f5('0xf')]('/',auth[_0xf0f5('0x9')](),controller[_0xf0f5('0x10')]);router['put'](_0xf0f5('0xb'),auth[_0xf0f5('0x9')](),controller[_0xf0f5('0x11')]);router['delete']('/:id',auth[_0xf0f5('0x9')](),controller[_0xf0f5('0x12')]);module[_0xf0f5('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index bed30ee..0551616 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 _0xc62f=['xlsx','STRING','DATE','Loading','ENUM','scheduled','manual','sequelize','moment','exports','csv','pdf'];(function(_0x58a4b5,_0x182439){var _0x51821d=function(_0x47c3c5){while(--_0x47c3c5){_0x58a4b5['push'](_0x58a4b5['shift']());}};_0x51821d(++_0x182439);}(_0xc62f,0x11b));var _0xfc62=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xc62f[_0x4243a3];return _0x1b2a33;};'use strict';var Sequelize=require(_0xfc62('0x0'));var moment=require(_0xfc62('0x1'));module[_0xfc62('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xfc62('0x3'),_0xfc62('0x4'),_0xfc62('0x5')),'allowNull':![],'defaultValue':_0xfc62('0x3')},'savename':{'type':Sequelize[_0xfc62('0x6')],'allowNull':![]},'startDate':{'type':Sequelize[_0xfc62('0x7')]},'endDate':{'type':Sequelize[_0xfc62('0x7')]},'status':{'type':Sequelize[_0xfc62('0x6')],'defaultValue':_0xfc62('0x8')},'type':{'type':Sequelize[_0xfc62('0x9')]('manual',_0xfc62('0xa')),'allowNull':![],'defaultValue':_0xfc62('0xb')}}; \ No newline at end of file +var _0xb5d3=['moment','STRING','ENUM','pdf','xlsx','DATE','Loading','scheduled','manual'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb5d3,0x7e));var _0x3b5d=function(_0x130209,_0x2cc129){_0x130209=_0x130209-0x0;var _0x155fb7=_0xb5d3[_0x130209];return _0x155fb7;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3b5d('0x0'));module['exports']={'name':{'type':Sequelize[_0x3b5d('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0x3b5d('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0x3b5d('0x2')]('csv',_0x3b5d('0x3'),_0x3b5d('0x4')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x3b5d('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0x3b5d('0x5')]},'endDate':{'type':Sequelize[_0x3b5d('0x5')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x3b5d('0x6')},'type':{'type':Sequelize[_0x3b5d('0x2')]('manual',_0x3b5d('0x7')),'allowNull':![],'defaultValue':_0x3b5d('0x8')}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 88b13c5..c2ad18a 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 _0x5ff2=['order','sort','where','add','day','merge','filter','map','includeAll','include','findAll','rows','params','options','find','catch','create','body','download','savename','output','existsSync','root','Sequelize','join','server/files/reports','format','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','then','destroy','error','stack','name','send','index','AnalyticExtractedReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','nolimit'];(function(_0x1b3fa7,_0x4d9b09){var _0x334e6f=function(_0x48d380){while(--_0x48d380){_0x1b3fa7['push'](_0x1b3fa7['shift']());}};_0x334e6f(++_0x4d9b09);}(_0x5ff2,0x6e));var _0x25ff=function(_0x3948ec,_0x3dfb10){_0x3948ec=_0x3948ec-0x0;var _0x2ad8f4=_0x5ff2[_0x3948ec];return _0x2ad8f4;};'use strict';var pdf=require(_0x25ff('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x25ff('0x1'));var zipdir=require(_0x25ff('0x2'));var jsonpatch=require(_0x25ff('0x3'));var rp=require(_0x25ff('0x4'));var moment=require(_0x25ff('0x5'));var BPromise=require(_0x25ff('0x6'));var Mustache=require(_0x25ff('0x7'));var util=require(_0x25ff('0x8'));var path=require(_0x25ff('0x9'));var sox=require(_0x25ff('0xa'));var csv=require(_0x25ff('0xb'));var ejs=require(_0x25ff('0xc'));var fs=require('fs');var _=require(_0x25ff('0xd'));var squel=require('squel');var crypto=require(_0x25ff('0xe'));var jsforce=require(_0x25ff('0xf'));var deskjs=require(_0x25ff('0x10'));var toCsv=require(_0x25ff('0xb'));var querystring=require(_0x25ff('0x11'));var Papa=require(_0x25ff('0x12'));var Redis=require('ioredis');var qs=require(_0x25ff('0x13'));var logger=require(_0x25ff('0x14'))(_0x25ff('0x15'));var utils=require(_0x25ff('0x16'));var config=require(_0x25ff('0x17'));var db=require(_0x25ff('0x18'))['db'];function respondWithStatusCode(_0x576de3,_0x11007a){_0x11007a=_0x11007a||0xcc;return function(_0x4e2ce5){if(_0x4e2ce5){return _0x576de3[_0x25ff('0x19')](_0x11007a);}return _0x576de3[_0x25ff('0x1a')](_0x11007a)[_0x25ff('0x1b')]();};}function respondWithResult(_0x47e720,_0x21698a){_0x21698a=_0x21698a||0xc8;return function(_0x4b82b8){if(_0x4b82b8){return _0x47e720[_0x25ff('0x1a')](_0x21698a)[_0x25ff('0x1c')](_0x4b82b8);}};}function respondWithFilteredResult(_0x5c9e68,_0x257b27){return function(_0x181957){if(_0x181957){var _0x454d29=_0x181957[_0x25ff('0x1d')],_0x27e115=_0x257b27[_0x25ff('0x1e')],_0xc7e34f=_0x257b27[_0x25ff('0x1e')]+_0x257b27[_0x25ff('0x1f')],_0x143f9f;if(_0xc7e34f>=_0x454d29){_0xc7e34f=_0x454d29;_0x143f9f=0xc8;}else{_0x143f9f=0xce;}_0x5c9e68[_0x25ff('0x1a')](_0x143f9f);return _0x5c9e68[_0x25ff('0x20')]('Content-Range',_0x27e115+'-'+_0xc7e34f+'/'+_0x454d29)[_0x25ff('0x1c')](_0x181957);}return null;};}function patchUpdates(_0xc07bed){return function(_0x1e4a4b){try{jsonpatch[_0x25ff('0x21')](_0x1e4a4b,_0xc07bed,!![]);}catch(_0x186279){return BPromise[_0x25ff('0x22')](_0x186279);}return _0x1e4a4b['save']();};}function saveUpdates(_0x1e0679,_0x57376e){return function(_0x51cda0){if(_0x51cda0){return _0x51cda0[_0x25ff('0x23')](_0x1e0679)[_0x25ff('0x24')](function(_0x5d6519){return _0x5d6519;});}return null;};}function removeEntity(_0x15c240,_0x4d2e9d){return function(_0x4946db){if(_0x4946db){return _0x4946db[_0x25ff('0x25')]()['then'](function(){_0x15c240[_0x25ff('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17b621,_0x5d0a78){return function(_0x2ac08f){if(!_0x2ac08f){_0x17b621[_0x25ff('0x19')](0x194);}return _0x2ac08f;};}function handleError(_0x3114a9,_0x5b8ec2){_0x5b8ec2=_0x5b8ec2||0x1f4;return function(_0x2eeb25){logger[_0x25ff('0x26')](_0x2eeb25[_0x25ff('0x27')]);if(_0x2eeb25[_0x25ff('0x28')]){delete _0x2eeb25['name'];}_0x3114a9[_0x25ff('0x1a')](_0x5b8ec2)[_0x25ff('0x29')](_0x2eeb25);};}exports[_0x25ff('0x2a')]=function(_0x1d495a,_0x17581f){var _0xf9548a={},_0x307f37={},_0x5d1ea8={'count':0x0,'rows':[]};var _0x2c07f2=db[_0x25ff('0x2b')][_0x25ff('0x2c')];_0x307f37[_0x25ff('0x2d')]=_[_0x25ff('0x2e')](_0x2c07f2);var _0x104c1e={'dateStart':_0x1d495a[_0x25ff('0x2f')][_0x25ff('0x30')],'dateEnd':_0x1d495a[_0x25ff('0x2f')][_0x25ff('0x31')]};delete _0x1d495a[_0x25ff('0x2f')]['dateStart'];delete _0x1d495a[_0x25ff('0x2f')]['dateEnd'];_0x307f37[_0x25ff('0x2f')]=_[_0x25ff('0x2e')](_0x1d495a[_0x25ff('0x2f')]);_0x307f37[_0x25ff('0x32')]=_[_0x25ff('0x33')](_0x307f37['model'],_0x307f37[_0x25ff('0x2f')]);_0xf9548a[_0x25ff('0x34')]=_['intersection'](_0x307f37[_0x25ff('0x2d')],qs['fields'](_0x1d495a['query'][_0x25ff('0x35')]));_0xf9548a[_0x25ff('0x34')]=_0xf9548a[_0x25ff('0x34')][_0x25ff('0x36')]?_0xf9548a[_0x25ff('0x34')]:_0x307f37['model'];if(!_0x1d495a[_0x25ff('0x2f')]['hasOwnProperty'](_0x25ff('0x37'))){_0xf9548a['limit']=qs[_0x25ff('0x1f')](_0x1d495a[_0x25ff('0x2f')][_0x25ff('0x1f')]);_0xf9548a[_0x25ff('0x1e')]=qs['offset'](_0x1d495a[_0x25ff('0x2f')]['offset']);}_0xf9548a[_0x25ff('0x38')]=qs[_0x25ff('0x39')](_0x1d495a[_0x25ff('0x2f')][_0x25ff('0x39')]);_0xf9548a[_0x25ff('0x3a')]=qs[_0x25ff('0x32')](_['pick'](_0x1d495a[_0x25ff('0x2f')],_0x307f37[_0x25ff('0x32')]));if(_0x104c1e['dateStart']){if(_0x104c1e[_0x25ff('0x31')]){_0x104c1e[_0x25ff('0x31')]=moment(_0x104c1e[_0x25ff('0x31')])[_0x25ff('0x3b')](0x1,_0x25ff('0x3c'));}else{_0x104c1e[_0x25ff('0x31')]=moment(_0x104c1e['dateStart'])['add'](0x1,_0x25ff('0x3c'));}_[_0x25ff('0x3d')](_0xf9548a[_0x25ff('0x3a')],{'createdAt':{'$gte':_0x104c1e[_0x25ff('0x30')],'$lte':_0x104c1e[_0x25ff('0x31')]}});}if(_0x1d495a[_0x25ff('0x2f')][_0x25ff('0x3e')]){_0xf9548a['where']=_['merge'](_0xf9548a[_0x25ff('0x3a')],{'$or':_[_0x25ff('0x3f')](_0xf9548a[_0x25ff('0x34')],function(_0x312714){var _0x289dfc={};_0x289dfc[_0x312714]={'$like':'%'+_0x1d495a[_0x25ff('0x2f')][_0x25ff('0x3e')]+'%'};return _0x289dfc;})});}_0xf9548a=_['merge']({},_0xf9548a,_0x1d495a['options']);var _0x29a594={'where':_0xf9548a[_0x25ff('0x3a')]};return db[_0x25ff('0x2b')][_0x25ff('0x1d')](_0x29a594)[_0x25ff('0x24')](function(_0x1025ef){_0x5d1ea8[_0x25ff('0x1d')]=_0x1025ef;if(_0x1d495a[_0x25ff('0x2f')][_0x25ff('0x40')]){_0xf9548a[_0x25ff('0x41')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x25ff('0x42')](_0xf9548a);})['then'](function(_0x359b96){_0x5d1ea8[_0x25ff('0x43')]=_0x359b96;return _0x5d1ea8;})['then'](respondWithFilteredResult(_0x17581f,_0xf9548a))['catch'](handleError(_0x17581f,null));};exports['show']=function(_0x522521,_0x537703){var _0xd584f={'raw':!![],'where':{'id':_0x522521[_0x25ff('0x44')]['id']}},_0x1c3a93={};_0x1c3a93[_0x25ff('0x2d')]=_[_0x25ff('0x2e')](db[_0x25ff('0x2b')][_0x25ff('0x2c')]);_0x1c3a93[_0x25ff('0x2f')]=_[_0x25ff('0x2e')](_0x522521[_0x25ff('0x2f')]);_0x1c3a93[_0x25ff('0x32')]=_['intersection'](_0x1c3a93[_0x25ff('0x2d')],_0x1c3a93[_0x25ff('0x2f')]);_0xd584f['attributes']=_[_0x25ff('0x33')](_0x1c3a93[_0x25ff('0x2d')],qs['fields'](_0x522521[_0x25ff('0x2f')][_0x25ff('0x35')]));_0xd584f[_0x25ff('0x34')]=_0xd584f[_0x25ff('0x34')][_0x25ff('0x36')]?_0xd584f['attributes']:_0x1c3a93['model'];if(_0x522521[_0x25ff('0x2f')][_0x25ff('0x40')]){_0xd584f[_0x25ff('0x41')]=[{'all':!![]}];}_0xd584f=_['merge']({},_0xd584f,_0x522521[_0x25ff('0x45')]);return db['AnalyticExtractedReport'][_0x25ff('0x46')](_0xd584f)[_0x25ff('0x24')](handleEntityNotFound(_0x537703,null))[_0x25ff('0x24')](respondWithResult(_0x537703,null))[_0x25ff('0x47')](handleError(_0x537703,null));};exports[_0x25ff('0x48')]=function(_0x3945df,_0x112b15){return db[_0x25ff('0x2b')][_0x25ff('0x48')](_0x3945df['body'],{})[_0x25ff('0x24')](respondWithResult(_0x112b15,0xc9))[_0x25ff('0x47')](handleError(_0x112b15,null));};exports[_0x25ff('0x23')]=function(_0x1d3c7c,_0x325bb3){if(_0x1d3c7c[_0x25ff('0x49')]['id']){delete _0x1d3c7c['body']['id'];}return db[_0x25ff('0x2b')]['find']({'where':{'id':_0x1d3c7c[_0x25ff('0x44')]['id']}})[_0x25ff('0x24')](handleEntityNotFound(_0x325bb3,null))['then'](saveUpdates(_0x1d3c7c[_0x25ff('0x49')],null))[_0x25ff('0x24')](respondWithResult(_0x325bb3,null))['catch'](handleError(_0x325bb3,null));};exports[_0x25ff('0x25')]=function(_0x200431,_0x47d482){return db[_0x25ff('0x2b')][_0x25ff('0x46')]({'where':{'id':_0x200431['params']['id']}})[_0x25ff('0x24')](handleEntityNotFound(_0x47d482,null))[_0x25ff('0x24')](removeEntity(_0x47d482,null))[_0x25ff('0x47')](handleError(_0x47d482,null));};exports[_0x25ff('0x4a')]=function(_0x1e004b,_0x224dab,_0x7f461c){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x1e004b[_0x25ff('0x44')]['id']},'attributes':[_0x25ff('0x28'),'basename',_0x25ff('0x4b'),_0x25ff('0x4c')],'raw':!![]})[_0x25ff('0x24')](handleEntityNotFound(_0x224dab,null))[_0x25ff('0x24')](function(_0x404078){if(_0x404078){if(!fs[_0x25ff('0x4d')](path['join'](config[_0x25ff('0x4e')],'server/files/reports',_0x404078[_0x25ff('0x4b')]))){throw new db[(_0x25ff('0x4f'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x1e004b['query']['exists']){return _0x224dab['sendStatus'](0xc8);}return _0x224dab[_0x25ff('0x4a')](path[_0x25ff('0x50')](config['root'],_0x25ff('0x51'),_0x404078[_0x25ff('0x4b')]),util[_0x25ff('0x52')]('%s.%s',_0x404078['basename']||_0x404078[_0x25ff('0x28')],_0x404078[_0x25ff('0x4c')]['toLowerCase']()));}})[_0x25ff('0x47')](handleError(_0x224dab,null));}; \ No newline at end of file +var _0x4457=['existsSync','join','root','server/files/reports','Report\x20not\x20found\x20or\x20empty','exists','sendStatus','format','%s.%s','toLowerCase','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','apply','then','error','stack','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','options','AnalyticExtractedReport','include','rows','show','params','includeAll','find','catch','create','body','destroy','download','basename','savename','output'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x4457,0x162));var _0x7445=function(_0x55de41,_0x29e5d1){_0x55de41=_0x55de41-0x0;var _0x1117e3=_0x4457[_0x55de41];return _0x1117e3;};'use strict';var pdf=require(_0x7445('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7445('0x1'));var zipdir=require(_0x7445('0x2'));var jsonpatch=require(_0x7445('0x3'));var rp=require(_0x7445('0x4'));var moment=require(_0x7445('0x5'));var BPromise=require(_0x7445('0x6'));var Mustache=require('mustache');var util=require(_0x7445('0x7'));var path=require(_0x7445('0x8'));var sox=require(_0x7445('0x9'));var csv=require(_0x7445('0xa'));var ejs=require(_0x7445('0xb'));var fs=require('fs');var _=require(_0x7445('0xc'));var squel=require(_0x7445('0xd'));var crypto=require(_0x7445('0xe'));var jsforce=require(_0x7445('0xf'));var deskjs=require(_0x7445('0x10'));var toCsv=require(_0x7445('0xa'));var querystring=require(_0x7445('0x11'));var Papa=require(_0x7445('0x12'));var Redis=require(_0x7445('0x13'));var qs=require(_0x7445('0x14'));var logger=require(_0x7445('0x15'))('api');var utils=require(_0x7445('0x16'));var config=require(_0x7445('0x17'));var db=require(_0x7445('0x18'))['db'];function respondWithStatusCode(_0xef43c1,_0x5caf92){_0x5caf92=_0x5caf92||0xcc;return function(_0x43e253){if(_0x43e253){return _0xef43c1['sendStatus'](_0x5caf92);}return _0xef43c1[_0x7445('0x19')](_0x5caf92)[_0x7445('0x1a')]();};}function respondWithResult(_0x2add0e,_0x497694){_0x497694=_0x497694||0xc8;return function(_0x1b2496){if(_0x1b2496){return _0x2add0e[_0x7445('0x19')](_0x497694)[_0x7445('0x1b')](_0x1b2496);}};}function respondWithFilteredResult(_0x141968,_0x13ddeb){return function(_0x3ce132){if(_0x3ce132){var _0x5a1a53=_0x3ce132[_0x7445('0x1c')],_0x330db5=_0x13ddeb[_0x7445('0x1d')],_0x543596=_0x13ddeb[_0x7445('0x1d')]+_0x13ddeb[_0x7445('0x1e')],_0x43c0d9;if(_0x543596>=_0x5a1a53){_0x543596=_0x5a1a53;_0x43c0d9=0xc8;}else{_0x43c0d9=0xce;}_0x141968[_0x7445('0x19')](_0x43c0d9);return _0x141968[_0x7445('0x1f')]('Content-Range',_0x330db5+'-'+_0x543596+'/'+_0x5a1a53)[_0x7445('0x1b')](_0x3ce132);}return null;};}function patchUpdates(_0x3b9ff8){return function(_0x28bfe2){try{jsonpatch[_0x7445('0x20')](_0x28bfe2,_0x3b9ff8,!![]);}catch(_0x2a8a08){return BPromise['reject'](_0x2a8a08);}return _0x28bfe2['save']();};}function saveUpdates(_0x5f1415,_0x2b70e2){return function(_0x3422c4){if(_0x3422c4){return _0x3422c4['update'](_0x5f1415)[_0x7445('0x21')](function(_0x2721b1){return _0x2721b1;});}return null;};}function removeEntity(_0x146024,_0x3af8ff){return function(_0x190e41){if(_0x190e41){return _0x190e41['destroy']()[_0x7445('0x21')](function(){_0x146024[_0x7445('0x19')](0xcc)[_0x7445('0x1a')]();});}};}function handleEntityNotFound(_0x5525ef,_0x5e13c1){return function(_0x59fecf){if(!_0x59fecf){_0x5525ef['sendStatus'](0x194);}return _0x59fecf;};}function handleError(_0x116e7d,_0x3b36de){_0x3b36de=_0x3b36de||0x1f4;return function(_0x2fe20d){logger[_0x7445('0x22')](_0x2fe20d[_0x7445('0x23')]);if(_0x2fe20d[_0x7445('0x24')]){delete _0x2fe20d['name'];}_0x116e7d[_0x7445('0x19')](_0x3b36de)[_0x7445('0x25')](_0x2fe20d);};}exports[_0x7445('0x26')]=function(_0x155d70,_0x36be32){var _0x58430a={},_0x385b1c={},_0xfaf482={'count':0x0,'rows':[]};var _0x320183=db['AnalyticExtractedReport'][_0x7445('0x27')];_0x385b1c[_0x7445('0x28')]=_[_0x7445('0x29')](_0x320183);var _0x3f3049={'dateStart':_0x155d70[_0x7445('0x2a')][_0x7445('0x2b')],'dateEnd':_0x155d70['query'][_0x7445('0x2c')]};delete _0x155d70[_0x7445('0x2a')][_0x7445('0x2b')];delete _0x155d70[_0x7445('0x2a')][_0x7445('0x2c')];_0x385b1c[_0x7445('0x2a')]=_['keys'](_0x155d70[_0x7445('0x2a')]);_0x385b1c[_0x7445('0x2d')]=_[_0x7445('0x2e')](_0x385b1c[_0x7445('0x28')],_0x385b1c['query']);_0x58430a[_0x7445('0x2f')]=_['intersection'](_0x385b1c[_0x7445('0x28')],qs[_0x7445('0x30')](_0x155d70[_0x7445('0x2a')][_0x7445('0x30')]));_0x58430a[_0x7445('0x2f')]=_0x58430a[_0x7445('0x2f')][_0x7445('0x31')]?_0x58430a[_0x7445('0x2f')]:_0x385b1c['model'];if(!_0x155d70[_0x7445('0x2a')][_0x7445('0x32')](_0x7445('0x33'))){_0x58430a[_0x7445('0x1e')]=qs[_0x7445('0x1e')](_0x155d70[_0x7445('0x2a')][_0x7445('0x1e')]);_0x58430a['offset']=qs[_0x7445('0x1d')](_0x155d70[_0x7445('0x2a')]['offset']);}_0x58430a[_0x7445('0x34')]=qs['sort'](_0x155d70[_0x7445('0x2a')][_0x7445('0x35')]);_0x58430a[_0x7445('0x36')]=qs[_0x7445('0x2d')](_[_0x7445('0x37')](_0x155d70[_0x7445('0x2a')],_0x385b1c[_0x7445('0x2d')]));if(_0x3f3049[_0x7445('0x2b')]){if(_0x3f3049['dateEnd']){_0x3f3049[_0x7445('0x2c')]=moment(_0x3f3049['dateEnd'])['add'](0x1,'day');}else{_0x3f3049['dateEnd']=moment(_0x3f3049[_0x7445('0x2b')])[_0x7445('0x38')](0x1,_0x7445('0x39'));}_[_0x7445('0x3a')](_0x58430a[_0x7445('0x36')],{'createdAt':{'$gte':_0x3f3049['dateStart'],'$lte':_0x3f3049[_0x7445('0x2c')]}});}if(_0x155d70['query'][_0x7445('0x3b')]){_0x58430a['where']=_[_0x7445('0x3a')](_0x58430a[_0x7445('0x36')],{'$or':_['map'](_0x58430a[_0x7445('0x2f')],function(_0x2a9062){var _0x2e20f9={};_0x2e20f9[_0x2a9062]={'$like':'%'+_0x155d70[_0x7445('0x2a')][_0x7445('0x3b')]+'%'};return _0x2e20f9;})});}_0x58430a=_[_0x7445('0x3a')]({},_0x58430a,_0x155d70[_0x7445('0x3c')]);var _0x23b647={'where':_0x58430a[_0x7445('0x36')]};return db[_0x7445('0x3d')]['count'](_0x23b647)['then'](function(_0x37f454){_0xfaf482[_0x7445('0x1c')]=_0x37f454;if(_0x155d70[_0x7445('0x2a')]['includeAll']){_0x58430a[_0x7445('0x3e')]=[{'all':!![]}];}return db[_0x7445('0x3d')]['findAll'](_0x58430a);})[_0x7445('0x21')](function(_0x1a1cda){_0xfaf482[_0x7445('0x3f')]=_0x1a1cda;return _0xfaf482;})[_0x7445('0x21')](respondWithFilteredResult(_0x36be32,_0x58430a))['catch'](handleError(_0x36be32,null));};exports[_0x7445('0x40')]=function(_0x44993a,_0xcae8e6){var _0x35af9d={'raw':!![],'where':{'id':_0x44993a[_0x7445('0x41')]['id']}},_0x1220e3={};_0x1220e3[_0x7445('0x28')]=_['keys'](db[_0x7445('0x3d')][_0x7445('0x27')]);_0x1220e3['query']=_[_0x7445('0x29')](_0x44993a[_0x7445('0x2a')]);_0x1220e3[_0x7445('0x2d')]=_[_0x7445('0x2e')](_0x1220e3[_0x7445('0x28')],_0x1220e3[_0x7445('0x2a')]);_0x35af9d['attributes']=_[_0x7445('0x2e')](_0x1220e3[_0x7445('0x28')],qs['fields'](_0x44993a[_0x7445('0x2a')]['fields']));_0x35af9d['attributes']=_0x35af9d[_0x7445('0x2f')][_0x7445('0x31')]?_0x35af9d[_0x7445('0x2f')]:_0x1220e3[_0x7445('0x28')];if(_0x44993a['query'][_0x7445('0x42')]){_0x35af9d['include']=[{'all':!![]}];}_0x35af9d=_['merge']({},_0x35af9d,_0x44993a[_0x7445('0x3c')]);return db[_0x7445('0x3d')][_0x7445('0x43')](_0x35af9d)['then'](handleEntityNotFound(_0xcae8e6,null))[_0x7445('0x21')](respondWithResult(_0xcae8e6,null))[_0x7445('0x44')](handleError(_0xcae8e6,null));};exports[_0x7445('0x45')]=function(_0x1eed00,_0x272fa6){return db[_0x7445('0x3d')][_0x7445('0x45')](_0x1eed00[_0x7445('0x46')],{})[_0x7445('0x21')](respondWithResult(_0x272fa6,0xc9))['catch'](handleError(_0x272fa6,null));};exports['update']=function(_0x9f4da1,_0x309e8c){if(_0x9f4da1[_0x7445('0x46')]['id']){delete _0x9f4da1[_0x7445('0x46')]['id'];}return db[_0x7445('0x3d')][_0x7445('0x43')]({'where':{'id':_0x9f4da1[_0x7445('0x41')]['id']}})['then'](handleEntityNotFound(_0x309e8c,null))[_0x7445('0x21')](saveUpdates(_0x9f4da1[_0x7445('0x46')],null))[_0x7445('0x21')](respondWithResult(_0x309e8c,null))[_0x7445('0x44')](handleError(_0x309e8c,null));};exports[_0x7445('0x47')]=function(_0xb33feb,_0x5c854f){return db[_0x7445('0x3d')][_0x7445('0x43')]({'where':{'id':_0xb33feb['params']['id']}})[_0x7445('0x21')](handleEntityNotFound(_0x5c854f,null))[_0x7445('0x21')](removeEntity(_0x5c854f,null))[_0x7445('0x44')](handleError(_0x5c854f,null));};exports[_0x7445('0x48')]=function(_0x9a181d,_0x4e579e,_0x5ee3ec){return db[_0x7445('0x3d')][_0x7445('0x43')]({'where':{'id':_0x9a181d[_0x7445('0x41')]['id']},'attributes':[_0x7445('0x24'),_0x7445('0x49'),_0x7445('0x4a'),_0x7445('0x4b')],'raw':!![]})[_0x7445('0x21')](handleEntityNotFound(_0x4e579e,null))[_0x7445('0x21')](function(_0x14dff6){if(_0x14dff6){if(!fs[_0x7445('0x4c')](path[_0x7445('0x4d')](config[_0x7445('0x4e')],_0x7445('0x4f'),_0x14dff6[_0x7445('0x4a')]))){throw new db['Sequelize']['ValidationError'](_0x7445('0x50'));}if(_0x9a181d[_0x7445('0x2a')][_0x7445('0x51')]){return _0x4e579e[_0x7445('0x52')](0xc8);}return _0x4e579e[_0x7445('0x48')](path[_0x7445('0x4d')](config[_0x7445('0x4e')],_0x7445('0x4f'),_0x14dff6[_0x7445('0x4a')]),util[_0x7445('0x53')](_0x7445('0x54'),_0x14dff6['basename']||_0x14dff6[_0x7445('0x24')],_0x14dff6[_0x7445('0x4b')][_0x7445('0x55')]()));}})[_0x7445('0x44')](handleError(_0x4e579e,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index d78b7a8..33bcf2d 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 _0x0999=['exports','define','analytics_extracted_reports','util','../../config/logger','api','moment','bluebird','request-promise','./analyticExtractedReport.attributes'];(function(_0x4a5760,_0x134c15){var _0x2994b=function(_0x9c3df8){while(--_0x9c3df8){_0x4a5760['push'](_0x4a5760['shift']());}};_0x2994b(++_0x134c15);}(_0x0999,0x85));var _0x9099=function(_0x2932cf,_0x362fd9){_0x2932cf=_0x2932cf-0x0;var _0x1711dd=_0x0999[_0x2932cf];return _0x1711dd;};'use strict';var _=require('lodash');var util=require(_0x9099('0x0'));var logger=require(_0x9099('0x1'))(_0x9099('0x2'));var moment=require(_0x9099('0x3'));var BPromise=require(_0x9099('0x4'));var rp=require(_0x9099('0x5'));var attributes=require(_0x9099('0x6'));module[_0x9099('0x7')]=function(_0x3ce29f,_0x2c745a){return _0x3ce29f[_0x9099('0x8')]('AnalyticExtractedReport',attributes,{'tableName':_0x9099('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa94f=['bluebird','request-promise','define','analytics_extracted_reports','lodash','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa94f,0x1bc));var _0xfa94=function(_0x4db6ae,_0x4442fc){_0x4db6ae=_0x4db6ae-0x0;var _0x1281e7=_0xa94f[_0x4db6ae];return _0x1281e7;};'use strict';var _=require(_0xfa94('0x0'));var util=require('util');var logger=require(_0xfa94('0x1'))(_0xfa94('0x2'));var moment=require(_0xfa94('0x3'));var BPromise=require(_0xfa94('0x4'));var rp=require(_0xfa94('0x5'));var attributes=require('./analyticExtractedReport.attributes');module['exports']=function(_0x3f91ff,_0x4efd04){return _0x3f91ff[_0xfa94('0x6')]('AnalyticExtractedReport',attributes,{'tableName':_0xfa94('0x7'),'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 b2fc54a..5099ac9 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 _0x1e33=['request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s'];(function(_0xa599e2,_0x3046be){var _0x122f49=function(_0x4f3d6d){while(--_0x4f3d6d){_0xa599e2['push'](_0xa599e2['shift']());}};_0x122f49(++_0x3046be);}(_0x1e33,0x1d6));var _0x31e3=function(_0x22bb88,_0x12b18a){_0x22bb88=_0x22bb88-0x0;var _0x3cdbd3=_0x1e33[_0x22bb88];return _0x3cdbd3;};'use strict';var _=require('lodash');var util=require(_0x31e3('0x0'));var moment=require(_0x31e3('0x1'));var BPromise=require(_0x31e3('0x2'));var rs=require(_0x31e3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x31e3('0x4'))['db'];var utils=require(_0x31e3('0x5'));var logger=require(_0x31e3('0x6'))('rpc');var config=require(_0x31e3('0x7'));var jayson=require(_0x31e3('0x8'));var client=jayson[_0x31e3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1669cb,_0x26a162,_0x1a81c4){return new BPromise(function(_0x48c1f8,_0x4859d3){return client[_0x31e3('0xa')](_0x1669cb,_0x1a81c4)[_0x31e3('0xb')](function(_0x22a971){logger[_0x31e3('0xc')](_0x31e3('0xd'),_0x26a162,_0x31e3('0xe'));logger[_0x31e3('0xf')](_0x31e3('0x10'),_0x26a162,_0x31e3('0xe'),JSON[_0x31e3('0x11')](_0x22a971));if(_0x22a971[_0x31e3('0x12')]){if(_0x22a971[_0x31e3('0x12')][_0x31e3('0x13')]===0x1f4){logger['error'](_0x31e3('0xd'),_0x26a162,_0x22a971[_0x31e3('0x12')][_0x31e3('0x14')]);return _0x4859d3(_0x22a971[_0x31e3('0x12')][_0x31e3('0x14')]);}logger[_0x31e3('0x12')](_0x31e3('0xd'),_0x26a162,_0x22a971[_0x31e3('0x12')][_0x31e3('0x14')]);return _0x48c1f8(_0x22a971[_0x31e3('0x12')][_0x31e3('0x14')]);}else{logger[_0x31e3('0xc')](_0x31e3('0xd'),_0x26a162,'request\x20sent');_0x48c1f8(_0x22a971['result'][_0x31e3('0x14')]);}})[_0x31e3('0x15')](function(_0x406afe){logger['error'](_0x31e3('0xd'),_0x26a162,_0x406afe);_0x4859d3(_0x406afe);});});} \ No newline at end of file +var _0x68c2=['../../config/environment','client','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x68c2,0x1e8));var _0x268c=function(_0x32a554,_0x37ad7b){_0x32a554=_0x32a554-0x0;var _0x5ce71c=_0x68c2[_0x32a554];return _0x5ce71c;};'use strict';var _=require('lodash');var util=require(_0x268c('0x0'));var moment=require(_0x268c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x268c('0x2'));var db=require(_0x268c('0x3'))['db'];var utils=require(_0x268c('0x4'));var logger=require(_0x268c('0x5'))('rpc');var config=require(_0x268c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x268c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c1236,_0x2a2590,_0x12263e){return new BPromise(function(_0x5a5e70,_0x175747){return client[_0x268c('0x8')](_0x2c1236,_0x12263e)['then'](function(_0x413697){logger[_0x268c('0x9')](_0x268c('0xa'),_0x2a2590,_0x268c('0xb'));logger[_0x268c('0xc')](_0x268c('0xd'),_0x2a2590,_0x268c('0xb'),JSON[_0x268c('0xe')](_0x413697));if(_0x413697['error']){if(_0x413697[_0x268c('0xf')][_0x268c('0x10')]===0x1f4){logger[_0x268c('0xf')](_0x268c('0xa'),_0x2a2590,_0x413697[_0x268c('0xf')][_0x268c('0x11')]);return _0x175747(_0x413697['error'][_0x268c('0x11')]);}logger['error'](_0x268c('0xa'),_0x2a2590,_0x413697[_0x268c('0xf')][_0x268c('0x11')]);return _0x5a5e70(_0x413697[_0x268c('0xf')][_0x268c('0x11')]);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x2a2590,_0x268c('0xb'));_0x5a5e70(_0x413697[_0x268c('0x12')][_0x268c('0x11')]);}})['catch'](function(_0x42bd64){logger[_0x268c('0xf')](_0x268c('0xa'),_0x2a2590,_0x42bd64);_0x175747(_0x42bd64);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 0b46c44..b8d3920 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 _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','download','post','create','put','update'];(function(_0x5e3701,_0x596265){var _0x345dcf=function(_0x5eb12a){while(--_0x5eb12a){_0x5e3701['push'](_0x5e3701['shift']());}};_0x345dcf(++_0x596265);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xc4aa[_0x21549c];return _0x426cbd;};'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')]('/',auth[_0xac4a('0x8')](),controller[_0xac4a('0x9')]);router[_0xac4a('0x7')](_0xac4a('0xa'),auth[_0xac4a('0x8')](),controller[_0xac4a('0xb')]);router['get']('/:id/download',auth[_0xac4a('0x8')](),controller[_0xac4a('0xc')]);router[_0xac4a('0xd')]('/',auth['isAuthenticated'](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')](_0xac4a('0xa'),auth['isAuthenticated'](),controller[_0xac4a('0x10')]);router['delete'](_0xac4a('0xa'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file +var _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','download','post','create','put','update'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xc4aa[_0x17b6e3];return _0x3906f3;};'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')]('/',auth[_0xac4a('0x8')](),controller[_0xac4a('0x9')]);router[_0xac4a('0x7')](_0xac4a('0xa'),auth[_0xac4a('0x8')](),controller[_0xac4a('0xb')]);router['get']('/:id/download',auth[_0xac4a('0x8')](),controller[_0xac4a('0xc')]);router[_0xac4a('0xd')]('/',auth['isAuthenticated'](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')](_0xac4a('0xa'),auth['isAuthenticated'](),controller[_0xac4a('0x10')]);router['delete'](_0xac4a('0xa'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 9ace2d2..f754247 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 _0x40d9=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x541170,_0x2d96b9){var _0x1d2b79=function(_0x449c68){while(--_0x449c68){_0x541170['push'](_0x541170['shift']());}};_0x1d2b79(++_0x2d96b9);}(_0x40d9,0x149));var _0x940d=function(_0x54b088,_0x4c1c20){_0x54b088=_0x54b088-0x0;var _0x9f0a52=_0x40d9[_0x54b088];return _0x9f0a52;};'use strict';var Sequelize=require(_0x940d('0x0'));module[_0x940d('0x1')]={'field':{'type':Sequelize[_0x940d('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x940d('0x3')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x940d('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x940d('0x3')]},'custom':{'type':Sequelize[_0x940d('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x2dd4=['exports','STRING','BOOLEAN'];(function(_0x4c3bba,_0x585ea1){var _0x24524d=function(_0x29aa76){while(--_0x29aa76){_0x4c3bba['push'](_0x4c3bba['shift']());}};_0x24524d(++_0x585ea1);}(_0x2dd4,0x12c));var _0x42dd=function(_0x1d7c53,_0x4226b6){_0x1d7c53=_0x1d7c53-0x0;var _0x3d57fc=_0x2dd4[_0x1d7c53];return _0x3d57fc;};'use strict';var Sequelize=require('sequelize');module[_0x42dd('0x0')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x42dd('0x1')]},'groupBy':{'type':Sequelize[_0x42dd('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x42dd('0x1')]},'custom':{'type':Sequelize[_0x42dd('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 49cb8bf..267537e 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 _0x1c9a=['moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','end','stack','name','send','AnalyticFieldReport','model','keys','query','dateEnd','dateStart','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','add','day','merge','where','filter','map','options','findAll','rows','catch','show','params','includeAll','include','create','bulkCreate','body','find','bulkDestroy','ids','findOne','sequelize','transaction','CustomReportId','html-pdf','rimraf','fast-json-patch','request-promise'];(function(_0x2c5693,_0x55a14f){var _0x26936f=function(_0x10f735){while(--_0x10f735){_0x2c5693['push'](_0x2c5693['shift']());}};_0x26936f(++_0x55a14f);}(_0x1c9a,0x98));var _0xa1c9=function(_0x102931,_0x387aa3){_0x102931=_0x102931-0x0;var _0x4c502a=_0x1c9a[_0x102931];return _0x4c502a;};'use strict';var pdf=require(_0xa1c9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa1c9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa1c9('0x2'));var rp=require(_0xa1c9('0x3'));var moment=require(_0xa1c9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa1c9('0x5'));var util=require(_0xa1c9('0x6'));var path=require(_0xa1c9('0x7'));var sox=require(_0xa1c9('0x8'));var csv=require('to-csv');var ejs=require(_0xa1c9('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa1c9('0xa'));var crypto=require(_0xa1c9('0xb'));var jsforce=require(_0xa1c9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa1c9('0xd'));var querystring=require(_0xa1c9('0xe'));var Papa=require(_0xa1c9('0xf'));var Redis=require(_0xa1c9('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0xa1c9('0x11'))(_0xa1c9('0x12'));var utils=require(_0xa1c9('0x13'));var config=require(_0xa1c9('0x14'));var db=require(_0xa1c9('0x15'))['db'];function respondWithStatusCode(_0xbb76ef,_0x1fe0e8){_0x1fe0e8=_0x1fe0e8||0xcc;return function(_0x112882){if(_0x112882){return _0xbb76ef[_0xa1c9('0x16')](_0x1fe0e8);}return _0xbb76ef[_0xa1c9('0x17')](_0x1fe0e8)['end']();};}function respondWithResult(_0x341233,_0x22ecfe){_0x22ecfe=_0x22ecfe||0xc8;return function(_0x2c0a8f){if(_0x2c0a8f){return _0x341233[_0xa1c9('0x17')](_0x22ecfe)[_0xa1c9('0x18')](_0x2c0a8f);}};}function respondWithFilteredResult(_0x4c70dd,_0x335dda){return function(_0x4b2fa5){if(_0x4b2fa5){var _0x2cba13=_0x4b2fa5[_0xa1c9('0x19')],_0xd9bca1=_0x335dda[_0xa1c9('0x1a')],_0x2d825c=_0x335dda[_0xa1c9('0x1a')]+_0x335dda[_0xa1c9('0x1b')],_0x1bbc94;if(_0x2d825c>=_0x2cba13){_0x2d825c=_0x2cba13;_0x1bbc94=0xc8;}else{_0x1bbc94=0xce;}_0x4c70dd['status'](_0x1bbc94);return _0x4c70dd[_0xa1c9('0x1c')](_0xa1c9('0x1d'),_0xd9bca1+'-'+_0x2d825c+'/'+_0x2cba13)[_0xa1c9('0x18')](_0x4b2fa5);}return null;};}function patchUpdates(_0x50db9b){return function(_0x2fb81e){try{jsonpatch['apply'](_0x2fb81e,_0x50db9b,!![]);}catch(_0x21cd35){return BPromise[_0xa1c9('0x1e')](_0x21cd35);}return _0x2fb81e[_0xa1c9('0x1f')]();};}function saveUpdates(_0x5121a7,_0x3a1110){return function(_0x46b1e4){if(_0x46b1e4){return _0x46b1e4[_0xa1c9('0x20')](_0x5121a7)['then'](function(_0x41e6d2){return _0x41e6d2;});}return null;};}function removeEntity(_0x426f66,_0x4c6dbb){return function(_0x2c0703){if(_0x2c0703){return _0x2c0703[_0xa1c9('0x21')]()[_0xa1c9('0x22')](function(){_0x426f66['status'](0xcc)[_0xa1c9('0x23')]();});}};}function handleEntityNotFound(_0x3dcec5,_0x15f754){return function(_0x23a461){if(!_0x23a461){_0x3dcec5[_0xa1c9('0x16')](0x194);}return _0x23a461;};}function handleError(_0x4a0a0c,_0x50b16b){_0x50b16b=_0x50b16b||0x1f4;return function(_0x200749){logger['error'](_0x200749[_0xa1c9('0x24')]);if(_0x200749[_0xa1c9('0x25')]){delete _0x200749[_0xa1c9('0x25')];}_0x4a0a0c[_0xa1c9('0x17')](_0x50b16b)[_0xa1c9('0x26')](_0x200749);};}exports['index']=function(_0x1925e7,_0x3ca2a8){var _0x20cbe1={},_0x4919af={},_0x133f80={'count':0x0,'rows':[]};var _0x1e7a97=db[_0xa1c9('0x27')]['rawAttributes'];_0x4919af[_0xa1c9('0x28')]=_[_0xa1c9('0x29')](_0x1e7a97);var _0x594137={'dateStart':_0x1925e7[_0xa1c9('0x2a')]['dateStart'],'dateEnd':_0x1925e7[_0xa1c9('0x2a')][_0xa1c9('0x2b')]};delete _0x1925e7[_0xa1c9('0x2a')][_0xa1c9('0x2c')];delete _0x1925e7[_0xa1c9('0x2a')][_0xa1c9('0x2b')];_0x4919af[_0xa1c9('0x2a')]=_[_0xa1c9('0x29')](_0x1925e7['query']);_0x4919af['filters']=_[_0xa1c9('0x2d')](_0x4919af[_0xa1c9('0x28')],_0x4919af[_0xa1c9('0x2a')]);_0x20cbe1[_0xa1c9('0x2e')]=_[_0xa1c9('0x2d')](_0x4919af['model'],qs['fields'](_0x1925e7['query'][_0xa1c9('0x2f')]));_0x20cbe1[_0xa1c9('0x2e')]=_0x20cbe1[_0xa1c9('0x2e')][_0xa1c9('0x30')]?_0x20cbe1[_0xa1c9('0x2e')]:_0x4919af[_0xa1c9('0x28')];if(!_0x1925e7[_0xa1c9('0x2a')]['hasOwnProperty'](_0xa1c9('0x31'))){_0x20cbe1['limit']=qs[_0xa1c9('0x1b')](_0x1925e7['query'][_0xa1c9('0x1b')]);_0x20cbe1[_0xa1c9('0x1a')]=qs[_0xa1c9('0x1a')](_0x1925e7['query'][_0xa1c9('0x1a')]);}_0x20cbe1[_0xa1c9('0x32')]=qs[_0xa1c9('0x33')](_0x1925e7[_0xa1c9('0x2a')]['sort']);_0x20cbe1['where']=qs[_0xa1c9('0x34')](_[_0xa1c9('0x35')](_0x1925e7[_0xa1c9('0x2a')],_0x4919af[_0xa1c9('0x34')]));if(_0x594137[_0xa1c9('0x2c')]){if(_0x594137[_0xa1c9('0x2b')]){_0x594137[_0xa1c9('0x2b')]=moment(_0x594137[_0xa1c9('0x2b')])[_0xa1c9('0x36')](0x1,_0xa1c9('0x37'));}else{_0x594137['dateEnd']=moment(_0x594137[_0xa1c9('0x2c')])[_0xa1c9('0x36')](0x1,_0xa1c9('0x37'));}_[_0xa1c9('0x38')](_0x20cbe1[_0xa1c9('0x39')],{'createdAt':{'$gte':_0x594137[_0xa1c9('0x2c')],'$lte':_0x594137['dateEnd']}});}if(_0x1925e7[_0xa1c9('0x2a')][_0xa1c9('0x3a')]){_0x20cbe1[_0xa1c9('0x39')]=_['merge'](_0x20cbe1[_0xa1c9('0x39')],{'$or':_[_0xa1c9('0x3b')](_0x20cbe1['attributes'],function(_0x58d877){var _0x25502f={};_0x25502f[_0x58d877]={'$like':'%'+_0x1925e7['query']['filter']+'%'};return _0x25502f;})});}_0x20cbe1=_[_0xa1c9('0x38')]({},_0x20cbe1,_0x1925e7[_0xa1c9('0x3c')]);var _0x34a6b8={'where':_0x20cbe1[_0xa1c9('0x39')]};return db[_0xa1c9('0x27')][_0xa1c9('0x19')](_0x34a6b8)[_0xa1c9('0x22')](function(_0x146e47){_0x133f80[_0xa1c9('0x19')]=_0x146e47;if(_0x1925e7[_0xa1c9('0x2a')]['includeAll']){_0x20cbe1['include']=[{'all':!![]}];}return db[_0xa1c9('0x27')][_0xa1c9('0x3d')](_0x20cbe1);})['then'](function(_0x30ce3b){_0x133f80[_0xa1c9('0x3e')]=_0x30ce3b;return _0x133f80;})[_0xa1c9('0x22')](respondWithFilteredResult(_0x3ca2a8,_0x20cbe1))[_0xa1c9('0x3f')](handleError(_0x3ca2a8,null));};exports[_0xa1c9('0x40')]=function(_0x3a6de6,_0x3e6dd0){var _0x2a2e0f={'raw':![],'where':{'id':_0x3a6de6[_0xa1c9('0x41')]['id']}},_0x1a32ff={};_0x1a32ff[_0xa1c9('0x28')]=_['keys'](db[_0xa1c9('0x27')]['rawAttributes']);_0x1a32ff[_0xa1c9('0x2a')]=_['keys'](_0x3a6de6[_0xa1c9('0x2a')]);_0x1a32ff['filters']=_[_0xa1c9('0x2d')](_0x1a32ff[_0xa1c9('0x28')],_0x1a32ff['query']);_0x2a2e0f[_0xa1c9('0x2e')]=_[_0xa1c9('0x2d')](_0x1a32ff['model'],qs[_0xa1c9('0x2f')](_0x3a6de6[_0xa1c9('0x2a')][_0xa1c9('0x2f')]));_0x2a2e0f[_0xa1c9('0x2e')]=_0x2a2e0f[_0xa1c9('0x2e')][_0xa1c9('0x30')]?_0x2a2e0f['attributes']:_0x1a32ff[_0xa1c9('0x28')];if(_0x3a6de6[_0xa1c9('0x2a')][_0xa1c9('0x42')]){_0x2a2e0f[_0xa1c9('0x43')]=[{'all':!![]}];}_0x2a2e0f=_[_0xa1c9('0x38')]({},_0x2a2e0f,_0x3a6de6['options']);return db['AnalyticFieldReport']['find'](_0x2a2e0f)[_0xa1c9('0x22')](handleEntityNotFound(_0x3e6dd0,null))[_0xa1c9('0x22')](respondWithResult(_0x3e6dd0,null))[_0xa1c9('0x3f')](handleError(_0x3e6dd0,null));};exports['create']=function(_0x63440,_0xc91f87){return db['AnalyticFieldReport'][_0xa1c9('0x44')](_0x63440['body'],{})['then'](respondWithResult(_0xc91f87,0xc9))[_0xa1c9('0x3f')](handleError(_0xc91f87,null));};exports[_0xa1c9('0x45')]=function(_0x36c3d0,_0x3b9a30){return db[_0xa1c9('0x27')][_0xa1c9('0x45')](_0x36c3d0[_0xa1c9('0x46')],{'raw':![],'individualHooks':!![]})[_0xa1c9('0x22')](respondWithResult(_0x3b9a30,0xc9))[_0xa1c9('0x3f')](handleError(_0x3b9a30,null));};exports[_0xa1c9('0x20')]=function(_0x2b2065,_0x1bed85){if(_0x2b2065[_0xa1c9('0x46')]['id']){delete _0x2b2065[_0xa1c9('0x46')]['id'];}return db[_0xa1c9('0x27')][_0xa1c9('0x47')]({'where':{'id':_0x2b2065[_0xa1c9('0x41')]['id']}})[_0xa1c9('0x22')](handleEntityNotFound(_0x1bed85,null))[_0xa1c9('0x22')](saveUpdates(_0x2b2065['body'],null))['then'](respondWithResult(_0x1bed85,null))[_0xa1c9('0x3f')](handleError(_0x1bed85,null));};exports[_0xa1c9('0x21')]=function(_0x66a5eb,_0xd67fe9){return db['AnalyticFieldReport'][_0xa1c9('0x47')]({'where':{'id':_0x66a5eb[_0xa1c9('0x41')]['id']}})[_0xa1c9('0x22')](handleEntityNotFound(_0xd67fe9,null))['then'](removeEntity(_0xd67fe9,null))[_0xa1c9('0x3f')](handleError(_0xd67fe9,null));};exports[_0xa1c9('0x48')]=function(_0x480326,_0x53d4e8){return db[_0xa1c9('0x27')]['destroy']({'where':{'id':_0x480326[_0xa1c9('0x2a')][_0xa1c9('0x49')]||[]},'raw':![],'individualHooks':!![]})[_0xa1c9('0x22')](respondWithResult(_0x53d4e8,0xcc))['catch'](handleError(_0x53d4e8,null));};exports['addFields']=function(_0x1e5c08,_0x5e0e85,_0x15f650){return db['AnalyticCustomReport'][_0xa1c9('0x4a')]({'where':{'id':_0x1e5c08[_0xa1c9('0x41')]['id']}})[_0xa1c9('0x22')](handleEntityNotFound(_0x5e0e85,null))[_0xa1c9('0x22')](function(_0x28fe57){if(_0x28fe57){return db[_0xa1c9('0x4b')][_0xa1c9('0x4c')](function(_0x59e235){return db[_0xa1c9('0x27')][_0xa1c9('0x21')]({'where':{'CustomReportId':_0x1e5c08['params']['id']},'transaction':_0x59e235})['then'](function(_0x498c0f){var _0x13eab0=_['map'](_0x1e5c08[_0xa1c9('0x46')],function(_0x325fae){delete _0x325fae['id'];_0x325fae[_0xa1c9('0x4d')]=_0x1e5c08[_0xa1c9('0x41')]['id'];return _0x325fae;});return db[_0xa1c9('0x27')]['bulkCreate'](_0x13eab0,{'transaction':_0x59e235});});})['then'](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x1e5c08[_0xa1c9('0x41')]['id']}});});}})[_0xa1c9('0x22')](respondWithResult(_0x5e0e85,null))[_0xa1c9('0x3f')](handleError(_0x5e0e85,null));}; \ No newline at end of file +var _0x236c=['order','sort','where','pick','add','day','merge','filter','options','includeAll','include','show','intersection','find','catch','create','bulkCreate','body','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','params','sequelize','transaction','map','CustomReportId','findAll','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','AnalyticFieldReport','model','query','dateEnd','dateStart','keys','filters','fields','attributes','length','limit'];(function(_0x6243bb,_0x269bd7){var _0x16ef17=function(_0x5771f1){while(--_0x5771f1){_0x6243bb['push'](_0x6243bb['shift']());}};_0x16ef17(++_0x269bd7);}(_0x236c,0x155));var _0xc236=function(_0x9adf7a,_0x47225c){_0x9adf7a=_0x9adf7a-0x0;var _0x2a1412=_0x236c[_0x9adf7a];return _0x2a1412;};'use strict';var pdf=require(_0xc236('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc236('0x1'));var zipdir=require(_0xc236('0x2'));var jsonpatch=require(_0xc236('0x3'));var rp=require(_0xc236('0x4'));var moment=require(_0xc236('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc236('0x6'));var util=require(_0xc236('0x7'));var path=require(_0xc236('0x8'));var sox=require(_0xc236('0x9'));var csv=require(_0xc236('0xa'));var ejs=require(_0xc236('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc236('0xc'));var crypto=require(_0xc236('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc236('0xe'));var Papa=require('papaparse');var Redis=require(_0xc236('0xf'));var qs=require(_0xc236('0x10'));var logger=require(_0xc236('0x11'))(_0xc236('0x12'));var utils=require(_0xc236('0x13'));var config=require('../../config/environment');var db=require(_0xc236('0x14'))['db'];function respondWithStatusCode(_0x3311f7,_0x58acb0){_0x58acb0=_0x58acb0||0xcc;return function(_0xcfe854){if(_0xcfe854){return _0x3311f7[_0xc236('0x15')](_0x58acb0);}return _0x3311f7['status'](_0x58acb0)[_0xc236('0x16')]();};}function respondWithResult(_0x5bce83,_0x599d36){_0x599d36=_0x599d36||0xc8;return function(_0x6db6b9){if(_0x6db6b9){return _0x5bce83[_0xc236('0x17')](_0x599d36)[_0xc236('0x18')](_0x6db6b9);}};}function respondWithFilteredResult(_0x71bce2,_0x5052db){return function(_0x13a42b){if(_0x13a42b){var _0x55b188=_0x13a42b[_0xc236('0x19')],_0x5221bf=_0x5052db[_0xc236('0x1a')],_0x9a65e8=_0x5052db[_0xc236('0x1a')]+_0x5052db['limit'],_0x32f2fd;if(_0x9a65e8>=_0x55b188){_0x9a65e8=_0x55b188;_0x32f2fd=0xc8;}else{_0x32f2fd=0xce;}_0x71bce2['status'](_0x32f2fd);return _0x71bce2['set'](_0xc236('0x1b'),_0x5221bf+'-'+_0x9a65e8+'/'+_0x55b188)[_0xc236('0x18')](_0x13a42b);}return null;};}function patchUpdates(_0x11ec65){return function(_0x541a20){try{jsonpatch[_0xc236('0x1c')](_0x541a20,_0x11ec65,!![]);}catch(_0x506974){return BPromise['reject'](_0x506974);}return _0x541a20[_0xc236('0x1d')]();};}function saveUpdates(_0x30adeb,_0x3a6183){return function(_0x46bc69){if(_0x46bc69){return _0x46bc69[_0xc236('0x1e')](_0x30adeb)[_0xc236('0x1f')](function(_0x3f0e2f){return _0x3f0e2f;});}return null;};}function removeEntity(_0x27c96a,_0x54ffac){return function(_0x32876d){if(_0x32876d){return _0x32876d[_0xc236('0x20')]()['then'](function(){_0x27c96a[_0xc236('0x17')](0xcc)[_0xc236('0x16')]();});}};}function handleEntityNotFound(_0x3bd41b,_0xd18bd0){return function(_0x27afba){if(!_0x27afba){_0x3bd41b[_0xc236('0x15')](0x194);}return _0x27afba;};}function handleError(_0x3a315b,_0xf921e6){_0xf921e6=_0xf921e6||0x1f4;return function(_0x1d65e2){logger[_0xc236('0x21')](_0x1d65e2[_0xc236('0x22')]);if(_0x1d65e2['name']){delete _0x1d65e2[_0xc236('0x23')];}_0x3a315b[_0xc236('0x17')](_0xf921e6)[_0xc236('0x24')](_0x1d65e2);};}exports[_0xc236('0x25')]=function(_0x561da1,_0x42f248){var _0x5da4b2={},_0x5351bc={},_0x15ead8={'count':0x0,'rows':[]};var _0x4eace8=db[_0xc236('0x26')]['rawAttributes'];_0x5351bc[_0xc236('0x27')]=_['keys'](_0x4eace8);var _0x423842={'dateStart':_0x561da1[_0xc236('0x28')]['dateStart'],'dateEnd':_0x561da1['query'][_0xc236('0x29')]};delete _0x561da1[_0xc236('0x28')][_0xc236('0x2a')];delete _0x561da1[_0xc236('0x28')]['dateEnd'];_0x5351bc['query']=_[_0xc236('0x2b')](_0x561da1['query']);_0x5351bc[_0xc236('0x2c')]=_['intersection'](_0x5351bc[_0xc236('0x27')],_0x5351bc[_0xc236('0x28')]);_0x5da4b2['attributes']=_['intersection'](_0x5351bc[_0xc236('0x27')],qs[_0xc236('0x2d')](_0x561da1[_0xc236('0x28')][_0xc236('0x2d')]));_0x5da4b2[_0xc236('0x2e')]=_0x5da4b2[_0xc236('0x2e')][_0xc236('0x2f')]?_0x5da4b2[_0xc236('0x2e')]:_0x5351bc[_0xc236('0x27')];if(!_0x561da1['query']['hasOwnProperty']('nolimit')){_0x5da4b2[_0xc236('0x30')]=qs[_0xc236('0x30')](_0x561da1[_0xc236('0x28')][_0xc236('0x30')]);_0x5da4b2[_0xc236('0x1a')]=qs[_0xc236('0x1a')](_0x561da1[_0xc236('0x28')]['offset']);}_0x5da4b2[_0xc236('0x31')]=qs[_0xc236('0x32')](_0x561da1[_0xc236('0x28')]['sort']);_0x5da4b2[_0xc236('0x33')]=qs[_0xc236('0x2c')](_[_0xc236('0x34')](_0x561da1[_0xc236('0x28')],_0x5351bc['filters']));if(_0x423842[_0xc236('0x2a')]){if(_0x423842[_0xc236('0x29')]){_0x423842[_0xc236('0x29')]=moment(_0x423842[_0xc236('0x29')])[_0xc236('0x35')](0x1,_0xc236('0x36'));}else{_0x423842[_0xc236('0x29')]=moment(_0x423842[_0xc236('0x2a')])[_0xc236('0x35')](0x1,_0xc236('0x36'));}_[_0xc236('0x37')](_0x5da4b2[_0xc236('0x33')],{'createdAt':{'$gte':_0x423842[_0xc236('0x2a')],'$lte':_0x423842[_0xc236('0x29')]}});}if(_0x561da1[_0xc236('0x28')][_0xc236('0x38')]){_0x5da4b2[_0xc236('0x33')]=_['merge'](_0x5da4b2['where'],{'$or':_['map'](_0x5da4b2['attributes'],function(_0x369a79){var _0x5c4739={};_0x5c4739[_0x369a79]={'$like':'%'+_0x561da1[_0xc236('0x28')][_0xc236('0x38')]+'%'};return _0x5c4739;})});}_0x5da4b2=_[_0xc236('0x37')]({},_0x5da4b2,_0x561da1[_0xc236('0x39')]);var _0xdf7897={'where':_0x5da4b2[_0xc236('0x33')]};return db[_0xc236('0x26')][_0xc236('0x19')](_0xdf7897)[_0xc236('0x1f')](function(_0x12a270){_0x15ead8[_0xc236('0x19')]=_0x12a270;if(_0x561da1[_0xc236('0x28')][_0xc236('0x3a')]){_0x5da4b2[_0xc236('0x3b')]=[{'all':!![]}];}return db[_0xc236('0x26')]['findAll'](_0x5da4b2);})[_0xc236('0x1f')](function(_0x24b851){_0x15ead8['rows']=_0x24b851;return _0x15ead8;})[_0xc236('0x1f')](respondWithFilteredResult(_0x42f248,_0x5da4b2))['catch'](handleError(_0x42f248,null));};exports[_0xc236('0x3c')]=function(_0x5e3910,_0x30f391){var _0x34c611={'raw':![],'where':{'id':_0x5e3910['params']['id']}},_0x8d04c9={};_0x8d04c9[_0xc236('0x27')]=_[_0xc236('0x2b')](db[_0xc236('0x26')]['rawAttributes']);_0x8d04c9[_0xc236('0x28')]=_[_0xc236('0x2b')](_0x5e3910[_0xc236('0x28')]);_0x8d04c9[_0xc236('0x2c')]=_[_0xc236('0x3d')](_0x8d04c9[_0xc236('0x27')],_0x8d04c9['query']);_0x34c611[_0xc236('0x2e')]=_['intersection'](_0x8d04c9[_0xc236('0x27')],qs[_0xc236('0x2d')](_0x5e3910[_0xc236('0x28')][_0xc236('0x2d')]));_0x34c611[_0xc236('0x2e')]=_0x34c611[_0xc236('0x2e')][_0xc236('0x2f')]?_0x34c611['attributes']:_0x8d04c9[_0xc236('0x27')];if(_0x5e3910['query'][_0xc236('0x3a')]){_0x34c611[_0xc236('0x3b')]=[{'all':!![]}];}_0x34c611=_['merge']({},_0x34c611,_0x5e3910[_0xc236('0x39')]);return db[_0xc236('0x26')][_0xc236('0x3e')](_0x34c611)[_0xc236('0x1f')](handleEntityNotFound(_0x30f391,null))[_0xc236('0x1f')](respondWithResult(_0x30f391,null))[_0xc236('0x3f')](handleError(_0x30f391,null));};exports[_0xc236('0x40')]=function(_0x5a904e,_0x50dd50){return db[_0xc236('0x26')][_0xc236('0x40')](_0x5a904e['body'],{})[_0xc236('0x1f')](respondWithResult(_0x50dd50,0xc9))[_0xc236('0x3f')](handleError(_0x50dd50,null));};exports[_0xc236('0x41')]=function(_0x7c856f,_0x45fa20){return db[_0xc236('0x26')][_0xc236('0x41')](_0x7c856f[_0xc236('0x42')],{'raw':![],'individualHooks':!![]})[_0xc236('0x1f')](respondWithResult(_0x45fa20,0xc9))['catch'](handleError(_0x45fa20,null));};exports[_0xc236('0x1e')]=function(_0x307663,_0x41b7d5){if(_0x307663[_0xc236('0x42')]['id']){delete _0x307663[_0xc236('0x42')]['id'];}return db[_0xc236('0x26')][_0xc236('0x3e')]({'where':{'id':_0x307663['params']['id']}})[_0xc236('0x1f')](handleEntityNotFound(_0x41b7d5,null))[_0xc236('0x1f')](saveUpdates(_0x307663[_0xc236('0x42')],null))[_0xc236('0x1f')](respondWithResult(_0x41b7d5,null))['catch'](handleError(_0x41b7d5,null));};exports[_0xc236('0x20')]=function(_0x3e6da6,_0xad71ea){return db[_0xc236('0x26')][_0xc236('0x3e')]({'where':{'id':_0x3e6da6['params']['id']}})[_0xc236('0x1f')](handleEntityNotFound(_0xad71ea,null))['then'](removeEntity(_0xad71ea,null))[_0xc236('0x3f')](handleError(_0xad71ea,null));};exports[_0xc236('0x43')]=function(_0x3f9e85,_0x15defc){return db[_0xc236('0x26')]['destroy']({'where':{'id':_0x3f9e85['query'][_0xc236('0x44')]||[]},'raw':![],'individualHooks':!![]})[_0xc236('0x1f')](respondWithResult(_0x15defc,0xcc))[_0xc236('0x3f')](handleError(_0x15defc,null));};exports[_0xc236('0x45')]=function(_0x3c4256,_0x22b929,_0x3fd22b){return db[_0xc236('0x46')][_0xc236('0x47')]({'where':{'id':_0x3c4256[_0xc236('0x48')]['id']}})['then'](handleEntityNotFound(_0x22b929,null))['then'](function(_0xd3bdff){if(_0xd3bdff){return db[_0xc236('0x49')][_0xc236('0x4a')](function(_0x659f37){return db['AnalyticFieldReport'][_0xc236('0x20')]({'where':{'CustomReportId':_0x3c4256[_0xc236('0x48')]['id']},'transaction':_0x659f37})['then'](function(_0x4524c1){var _0x3adb81=_[_0xc236('0x4b')](_0x3c4256[_0xc236('0x42')],function(_0x5801d6){delete _0x5801d6['id'];_0x5801d6[_0xc236('0x4c')]=_0x3c4256[_0xc236('0x48')]['id'];return _0x5801d6;});return db[_0xc236('0x26')][_0xc236('0x41')](_0x3adb81,{'transaction':_0x659f37});});})[_0xc236('0x1f')](function(){return db[_0xc236('0x26')][_0xc236('0x4d')]({'where':{'CustomReportId':_0x3c4256['params']['id']}});});}})[_0xc236('0x1f')](respondWithResult(_0x22b929,null))['catch'](handleError(_0x22b929,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 1761a83..f5de0c4 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 _0x1634=['exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','moment','bluebird','./analyticFieldReport.attributes'];(function(_0x9f7793,_0x299501){var _0x1902ee=function(_0x3ffe0d){while(--_0x3ffe0d){_0x9f7793['push'](_0x9f7793['shift']());}};_0x1902ee(++_0x299501);}(_0x1634,0x1e8));var _0x4163=function(_0x38497a,_0xf20fa9){_0x38497a=_0x38497a-0x0;var _0x3c27cf=_0x1634[_0x38497a];return _0x3c27cf;};'use strict';var _=require(_0x4163('0x0'));var util=require(_0x4163('0x1'));var logger=require(_0x4163('0x2'))(_0x4163('0x3'));var moment=require(_0x4163('0x4'));var BPromise=require(_0x4163('0x5'));var rp=require('request-promise');var attributes=require(_0x4163('0x6'));module[_0x4163('0x7')]=function(_0x5d393d,_0x637a0){return _0x5d393d[_0x4163('0x8')](_0x4163('0x9'),attributes,{'tableName':_0x4163('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6bf9=['exports','define','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','moment','request-promise'];(function(_0x9cce7f,_0x593089){var _0x3ebb6b=function(_0x507727){while(--_0x507727){_0x9cce7f['push'](_0x9cce7f['shift']());}};_0x3ebb6b(++_0x593089);}(_0x6bf9,0x1a4));var _0x96bf=function(_0x213518,_0x51e022){_0x213518=_0x213518-0x0;var _0x1baf75=_0x6bf9[_0x213518];return _0x1baf75;};'use strict';var _=require(_0x96bf('0x0'));var util=require('util');var logger=require(_0x96bf('0x1'))('api');var moment=require(_0x96bf('0x2'));var BPromise=require('bluebird');var rp=require(_0x96bf('0x3'));var attributes=require('./analyticFieldReport.attributes');module[_0x96bf('0x4')]=function(_0xed963a,_0x2c25f6){return _0xed963a[_0x96bf('0x5')](_0x96bf('0x6'),attributes,{'tableName':_0x96bf('0x7'),'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 bacdd9d..e8e0005 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 _0x8ca9=['info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','then'];(function(_0x336e05,_0x1ad469){var _0x1abc78=function(_0x4ddb2b){while(--_0x4ddb2b){_0x336e05['push'](_0x336e05['shift']());}};_0x1abc78(++_0x1ad469);}(_0x8ca9,0x9c));var _0x98ca=function(_0x489250,_0x5e9468){_0x489250=_0x489250-0x0;var _0x1283e5=_0x8ca9[_0x489250];return _0x1283e5;};'use strict';var _=require(_0x98ca('0x0'));var util=require(_0x98ca('0x1'));var moment=require(_0x98ca('0x2'));var BPromise=require(_0x98ca('0x3'));var rs=require(_0x98ca('0x4'));var fs=require('fs');var Redis=require(_0x98ca('0x5'));var db=require(_0x98ca('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x98ca('0x7'));var config=require('../../config/environment');var jayson=require(_0x98ca('0x8'));var client=jayson['client'][_0x98ca('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xca4097,_0x18c349,_0x2852a0){return new BPromise(function(_0x323c95,_0x28a37a){return client[_0x98ca('0xa')](_0xca4097,_0x2852a0)[_0x98ca('0xb')](function(_0x277c29){logger[_0x98ca('0xc')](_0x98ca('0xd'),_0x18c349,_0x98ca('0xe'));logger[_0x98ca('0xf')](_0x98ca('0x10'),_0x18c349,_0x98ca('0xe'),JSON[_0x98ca('0x11')](_0x277c29));if(_0x277c29[_0x98ca('0x12')]){if(_0x277c29[_0x98ca('0x12')]['code']===0x1f4){logger[_0x98ca('0x12')](_0x98ca('0xd'),_0x18c349,_0x277c29[_0x98ca('0x12')][_0x98ca('0x13')]);return _0x28a37a(_0x277c29['error'][_0x98ca('0x13')]);}logger[_0x98ca('0x12')](_0x98ca('0xd'),_0x18c349,_0x277c29[_0x98ca('0x12')][_0x98ca('0x13')]);return _0x323c95(_0x277c29[_0x98ca('0x12')][_0x98ca('0x13')]);}else{logger['info'](_0x98ca('0xd'),_0x18c349,_0x98ca('0xe'));_0x323c95(_0x277c29[_0x98ca('0x14')][_0x98ca('0x13')]);}})['catch'](function(_0x238c1a){logger[_0x98ca('0x12')](_0x98ca('0xd'),_0x18c349,_0x238c1a);_0x28a37a(_0x238c1a);});});} \ No newline at end of file +var _0x0cfe=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment','bluebird','randomstring'];(function(_0x340953,_0x1c9c11){var _0x5afc9d=function(_0x484a0f){while(--_0x484a0f){_0x340953['push'](_0x340953['shift']());}};_0x5afc9d(++_0x1c9c11);}(_0x0cfe,0x9c));var _0xe0cf=function(_0x2703d9,_0x13bdfc){_0x2703d9=_0x2703d9-0x0;var _0x3beb8e=_0x0cfe[_0x2703d9];return _0x3beb8e;};'use strict';var _=require(_0xe0cf('0x0'));var util=require('util');var moment=require(_0xe0cf('0x1'));var BPromise=require(_0xe0cf('0x2'));var rs=require(_0xe0cf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe0cf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe0cf('0x5'))(_0xe0cf('0x6'));var config=require(_0xe0cf('0x7'));var jayson=require(_0xe0cf('0x8'));var client=jayson['client'][_0xe0cf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2abd29,_0x1985b6,_0x518995){return new BPromise(function(_0x2c4c48,_0x2470c7){return client['request'](_0x2abd29,_0x518995)[_0xe0cf('0xa')](function(_0x2bd78b){logger[_0xe0cf('0xb')](_0xe0cf('0xc'),_0x1985b6,_0xe0cf('0xd'));logger[_0xe0cf('0xe')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x1985b6,_0xe0cf('0xd'),JSON[_0xe0cf('0xf')](_0x2bd78b));if(_0x2bd78b[_0xe0cf('0x10')]){if(_0x2bd78b[_0xe0cf('0x10')][_0xe0cf('0x11')]===0x1f4){logger[_0xe0cf('0x10')](_0xe0cf('0xc'),_0x1985b6,_0x2bd78b[_0xe0cf('0x10')][_0xe0cf('0x12')]);return _0x2470c7(_0x2bd78b[_0xe0cf('0x10')][_0xe0cf('0x12')]);}logger[_0xe0cf('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1985b6,_0x2bd78b[_0xe0cf('0x10')][_0xe0cf('0x12')]);return _0x2c4c48(_0x2bd78b[_0xe0cf('0x10')][_0xe0cf('0x12')]);}else{logger[_0xe0cf('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1985b6,'request\x20sent');_0x2c4c48(_0x2bd78b[_0xe0cf('0x13')]['message']);}})['catch'](function(_0x1fc244){logger[_0xe0cf('0x10')](_0xe0cf('0xc'),_0x1985b6,_0x1fc244);_0x2470c7(_0x1fc244);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index d7ab815..a6422d6 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 _0x5b02=['index','/:id','post','/create_many','/:id/create_many','addFields','put','update','delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./analyticFieldReport.controller','get','isAuthenticated'];(function(_0x5da28f,_0x135246){var _0x4fd5bd=function(_0x2edf56){while(--_0x2edf56){_0x5da28f['push'](_0x5da28f['shift']());}};_0x4fd5bd(++_0x135246);}(_0x5b02,0xe9));var _0x25b0=function(_0x71f8d1,_0x258291){_0x71f8d1=_0x71f8d1-0x0;var _0x49ae4f=_0x5b02[_0x71f8d1];return _0x49ae4f;};'use strict';var multer=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var path=require(_0x25b0('0x2'));var timeout=require(_0x25b0('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x25b0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x25b0('0x5'));var controller=require(_0x25b0('0x6'));router[_0x25b0('0x7')]('/',auth[_0x25b0('0x8')](),controller[_0x25b0('0x9')]);router['get'](_0x25b0('0xa'),auth[_0x25b0('0x8')](),controller['show']);router[_0x25b0('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x25b0('0xb')](_0x25b0('0xc'),auth[_0x25b0('0x8')](),controller['bulkCreate']);router[_0x25b0('0xb')](_0x25b0('0xd'),auth[_0x25b0('0x8')](),controller[_0x25b0('0xe')]);router[_0x25b0('0xf')](_0x25b0('0xa'),auth[_0x25b0('0x8')](),controller[_0x25b0('0x10')]);router[_0x25b0('0x11')](_0x25b0('0x12'),auth[_0x25b0('0x8')](),controller[_0x25b0('0x13')]);router[_0x25b0('0x11')](_0x25b0('0xa'),auth[_0x25b0('0x8')](),controller[_0x25b0('0x14')]);module[_0x25b0('0x15')]=router; \ No newline at end of file +var _0xb332=['Router','../../components/interaction/service','./analyticFieldReport.controller','isAuthenticated','index','get','/:id','post','create','/create_many','/:id/create_many','addFields','put','update','delete','/destroy_many','exports','multer','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb332,0xd9));var _0x2b33=function(_0x8ba19a,_0x1d2b2b){_0x8ba19a=_0x8ba19a-0x0;var _0x2bd8b4=_0xb332[_0x8ba19a];return _0x2bd8b4;};'use strict';var multer=require(_0x2b33('0x0'));var util=require('util');var path=require(_0x2b33('0x1'));var timeout=require(_0x2b33('0x2'));var express=require('express');var router=express[_0x2b33('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x2b33('0x4'));var config=require('../../config/environment');var controller=require(_0x2b33('0x5'));router['get']('/',auth[_0x2b33('0x6')](),controller[_0x2b33('0x7')]);router[_0x2b33('0x8')](_0x2b33('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x2b33('0xa')]('/',auth['isAuthenticated'](),controller[_0x2b33('0xb')]);router[_0x2b33('0xa')](_0x2b33('0xc'),auth[_0x2b33('0x6')](),controller['bulkCreate']);router[_0x2b33('0xa')](_0x2b33('0xd'),auth[_0x2b33('0x6')](),controller[_0x2b33('0xe')]);router[_0x2b33('0xf')](_0x2b33('0x9'),auth[_0x2b33('0x6')](),controller[_0x2b33('0x10')]);router[_0x2b33('0x11')](_0x2b33('0x12'),auth[_0x2b33('0x6')](),controller['bulkDestroy']);router[_0x2b33('0x11')](_0x2b33('0x9'),auth[_0x2b33('0x6')](),controller['destroy']);module[_0x2b33('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 690d582..2a33e0f 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 _0x1fff=['STRING','sequelize','exports'];(function(_0x522c6d,_0x4d250d){var _0x26300d=function(_0x3ab228){while(--_0x3ab228){_0x522c6d['push'](_0x522c6d['shift']());}};_0x26300d(++_0x4d250d);}(_0x1fff,0xb5));var _0xf1ff=function(_0x365f7d,_0x2fb3a0){_0x365f7d=_0x365f7d-0x0;var _0x1cb6f5=_0x1fff[_0x365f7d];return _0x1cb6f5;};'use strict';var Sequelize=require(_0xf1ff('0x0'));module[_0xf1ff('0x1')]={'name':{'type':Sequelize[_0xf1ff('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xf1ff('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xf1ff('0x2')]}}; \ No newline at end of file +var _0x21f6=['exports','STRING','name','TEXT','sequelize'];(function(_0x14e1cb,_0xd3465e){var _0x18a337=function(_0x3b97f3){while(--_0x3b97f3){_0x14e1cb['push'](_0x14e1cb['shift']());}};_0x18a337(++_0xd3465e);}(_0x21f6,0x11c));var _0x621f=function(_0x15e51c,_0x1eff92){_0x15e51c=_0x15e51c-0x0;var _0x16e2a4=_0x21f6[_0x15e51c];return _0x16e2a4;};'use strict';var Sequelize=require(_0x621f('0x0'));module[_0x621f('0x1')]={'name':{'type':Sequelize[_0x621f('0x2')],'allowNull':![],'unique':_0x621f('0x3')},'table':{'type':Sequelize[_0x621f('0x2')]},'metric':{'type':Sequelize[_0x621f('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index cf73f2a..b6f44ed 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 _0xfa20=['params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','Content-Range','apply','reject','then','sendStatus','error','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','add','day','merge','filter','options','AnalyticMetric','includeAll','findAll','rows','catch','show','intersection','include','find','create','update','body'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0xfa20,0x112));var _0x0fa2=function(_0x4adc6d,_0x11275c){_0x4adc6d=_0x4adc6d-0x0;var _0x4d42e5=_0xfa20[_0x4adc6d];return _0x4d42e5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0fa2('0x0'));var rimraf=require(_0x0fa2('0x1'));var zipdir=require(_0x0fa2('0x2'));var jsonpatch=require(_0x0fa2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0fa2('0x4'));var Mustache=require('mustache');var util=require(_0x0fa2('0x5'));var path=require(_0x0fa2('0x6'));var sox=require(_0x0fa2('0x7'));var csv=require(_0x0fa2('0x8'));var ejs=require(_0x0fa2('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0fa2('0xa'));var crypto=require(_0x0fa2('0xb'));var jsforce=require(_0x0fa2('0xc'));var deskjs=require(_0x0fa2('0xd'));var toCsv=require(_0x0fa2('0x8'));var querystring=require(_0x0fa2('0xe'));var Papa=require(_0x0fa2('0xf'));var Redis=require(_0x0fa2('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0x0fa2('0x11'))('api');var utils=require(_0x0fa2('0x12'));var config=require(_0x0fa2('0x13'));var db=require(_0x0fa2('0x14'))['db'];function respondWithStatusCode(_0x1bf315,_0x396366){_0x396366=_0x396366||0xcc;return function(_0x252e12){if(_0x252e12){return _0x1bf315['sendStatus'](_0x396366);}return _0x1bf315[_0x0fa2('0x15')](_0x396366)[_0x0fa2('0x16')]();};}function respondWithResult(_0x1cec76,_0x5e5054){_0x5e5054=_0x5e5054||0xc8;return function(_0x14d0e3){if(_0x14d0e3){return _0x1cec76[_0x0fa2('0x15')](_0x5e5054)['json'](_0x14d0e3);}};}function respondWithFilteredResult(_0x20165d,_0x16bf68){return function(_0x398f04){if(_0x398f04){var _0x212c40=_0x398f04[_0x0fa2('0x17')],_0x2de25f=_0x16bf68[_0x0fa2('0x18')],_0x101ab0=_0x16bf68['offset']+_0x16bf68['limit'],_0x484764;if(_0x101ab0>=_0x212c40){_0x101ab0=_0x212c40;_0x484764=0xc8;}else{_0x484764=0xce;}_0x20165d['status'](_0x484764);return _0x20165d['set'](_0x0fa2('0x19'),_0x2de25f+'-'+_0x101ab0+'/'+_0x212c40)['json'](_0x398f04);}return null;};}function patchUpdates(_0x2b8879){return function(_0x5b81db){try{jsonpatch[_0x0fa2('0x1a')](_0x5b81db,_0x2b8879,!![]);}catch(_0x41b6ad){return BPromise[_0x0fa2('0x1b')](_0x41b6ad);}return _0x5b81db['save']();};}function saveUpdates(_0x3a4656,_0x17b476){return function(_0x428cba){if(_0x428cba){return _0x428cba['update'](_0x3a4656)[_0x0fa2('0x1c')](function(_0x585045){return _0x585045;});}return null;};}function removeEntity(_0x532f58,_0x40854b){return function(_0x28f6cc){if(_0x28f6cc){return _0x28f6cc['destroy']()['then'](function(){_0x532f58[_0x0fa2('0x15')](0xcc)[_0x0fa2('0x16')]();});}};}function handleEntityNotFound(_0x2bf9ef,_0x3f6aea){return function(_0xf718a4){if(!_0xf718a4){_0x2bf9ef[_0x0fa2('0x1d')](0x194);}return _0xf718a4;};}function handleError(_0x4f68b2,_0x452933){_0x452933=_0x452933||0x1f4;return function(_0x112441){logger[_0x0fa2('0x1e')](_0x112441['stack']);if(_0x112441[_0x0fa2('0x1f')]){delete _0x112441[_0x0fa2('0x1f')];}_0x4f68b2[_0x0fa2('0x15')](_0x452933)[_0x0fa2('0x20')](_0x112441);};}exports[_0x0fa2('0x21')]=function(_0x30ab56,_0x2e0d95){var _0x465ae6={},_0x54cd67={},_0x589375={'count':0x0,'rows':[]};var _0x52da38=db['AnalyticMetric'][_0x0fa2('0x22')];_0x54cd67[_0x0fa2('0x23')]=_[_0x0fa2('0x24')](_0x52da38);var _0x2f2644={'dateStart':_0x30ab56[_0x0fa2('0x25')][_0x0fa2('0x26')],'dateEnd':_0x30ab56[_0x0fa2('0x25')]['dateEnd']};delete _0x30ab56[_0x0fa2('0x25')]['dateStart'];delete _0x30ab56['query'][_0x0fa2('0x27')];_0x54cd67['query']=_[_0x0fa2('0x24')](_0x30ab56[_0x0fa2('0x25')]);_0x54cd67[_0x0fa2('0x28')]=_['intersection'](_0x54cd67[_0x0fa2('0x23')],_0x54cd67[_0x0fa2('0x25')]);_0x465ae6[_0x0fa2('0x29')]=_['intersection'](_0x54cd67['model'],qs[_0x0fa2('0x2a')](_0x30ab56[_0x0fa2('0x25')][_0x0fa2('0x2a')]));_0x465ae6[_0x0fa2('0x29')]=_0x465ae6[_0x0fa2('0x29')][_0x0fa2('0x2b')]?_0x465ae6['attributes']:_0x54cd67[_0x0fa2('0x23')];if(!_0x30ab56[_0x0fa2('0x25')][_0x0fa2('0x2c')]('nolimit')){_0x465ae6[_0x0fa2('0x2d')]=qs[_0x0fa2('0x2d')](_0x30ab56['query']['limit']);_0x465ae6['offset']=qs[_0x0fa2('0x18')](_0x30ab56[_0x0fa2('0x25')][_0x0fa2('0x18')]);}_0x465ae6['order']=qs['sort'](_0x30ab56['query'][_0x0fa2('0x2e')]);_0x465ae6[_0x0fa2('0x2f')]=qs[_0x0fa2('0x28')](_[_0x0fa2('0x30')](_0x30ab56[_0x0fa2('0x25')],_0x54cd67[_0x0fa2('0x28')]));if(_0x2f2644['dateStart']){if(_0x2f2644['dateEnd']){_0x2f2644[_0x0fa2('0x27')]=moment(_0x2f2644['dateEnd'])[_0x0fa2('0x31')](0x1,_0x0fa2('0x32'));}else{_0x2f2644[_0x0fa2('0x27')]=moment(_0x2f2644[_0x0fa2('0x26')])['add'](0x1,_0x0fa2('0x32'));}_[_0x0fa2('0x33')](_0x465ae6[_0x0fa2('0x2f')],{'createdAt':{'$gte':_0x2f2644[_0x0fa2('0x26')],'$lte':_0x2f2644[_0x0fa2('0x27')]}});}if(_0x30ab56[_0x0fa2('0x25')][_0x0fa2('0x34')]){_0x465ae6[_0x0fa2('0x2f')]=_[_0x0fa2('0x33')](_0x465ae6['where'],{'$or':_['map'](_0x465ae6['attributes'],function(_0x34dd1d){var _0x134728={};_0x134728[_0x34dd1d]={'$like':'%'+_0x30ab56[_0x0fa2('0x25')][_0x0fa2('0x34')]+'%'};return _0x134728;})});}_0x465ae6=_[_0x0fa2('0x33')]({},_0x465ae6,_0x30ab56[_0x0fa2('0x35')]);var _0x1cdbb4={'where':_0x465ae6[_0x0fa2('0x2f')]};return db[_0x0fa2('0x36')]['count'](_0x1cdbb4)[_0x0fa2('0x1c')](function(_0x60eb1c){_0x589375[_0x0fa2('0x17')]=_0x60eb1c;if(_0x30ab56[_0x0fa2('0x25')][_0x0fa2('0x37')]){_0x465ae6['include']=[{'all':!![]}];}return db['AnalyticMetric'][_0x0fa2('0x38')](_0x465ae6);})[_0x0fa2('0x1c')](function(_0x39f547){_0x589375[_0x0fa2('0x39')]=_0x39f547;return _0x589375;})[_0x0fa2('0x1c')](respondWithFilteredResult(_0x2e0d95,_0x465ae6))[_0x0fa2('0x3a')](handleError(_0x2e0d95,null));};exports[_0x0fa2('0x3b')]=function(_0x8ee561,_0x478766){var _0x27e1ca={'raw':!![],'where':{'id':_0x8ee561['params']['id']}},_0xa4b206={};_0xa4b206['model']=_[_0x0fa2('0x24')](db[_0x0fa2('0x36')][_0x0fa2('0x22')]);_0xa4b206[_0x0fa2('0x25')]=_[_0x0fa2('0x24')](_0x8ee561[_0x0fa2('0x25')]);_0xa4b206['filters']=_[_0x0fa2('0x3c')](_0xa4b206[_0x0fa2('0x23')],_0xa4b206[_0x0fa2('0x25')]);_0x27e1ca[_0x0fa2('0x29')]=_[_0x0fa2('0x3c')](_0xa4b206[_0x0fa2('0x23')],qs['fields'](_0x8ee561[_0x0fa2('0x25')]['fields']));_0x27e1ca['attributes']=_0x27e1ca[_0x0fa2('0x29')]['length']?_0x27e1ca['attributes']:_0xa4b206['model'];if(_0x8ee561[_0x0fa2('0x25')][_0x0fa2('0x37')]){_0x27e1ca[_0x0fa2('0x3d')]=[{'all':!![]}];}_0x27e1ca=_['merge']({},_0x27e1ca,_0x8ee561[_0x0fa2('0x35')]);return db[_0x0fa2('0x36')][_0x0fa2('0x3e')](_0x27e1ca)[_0x0fa2('0x1c')](handleEntityNotFound(_0x478766,null))[_0x0fa2('0x1c')](respondWithResult(_0x478766,null))[_0x0fa2('0x3a')](handleError(_0x478766,null));};exports[_0x0fa2('0x3f')]=function(_0x240473,_0x47bb5e){return db[_0x0fa2('0x36')]['create'](_0x240473['body'],{})[_0x0fa2('0x1c')](respondWithResult(_0x47bb5e,0xc9))[_0x0fa2('0x3a')](handleError(_0x47bb5e,null));};exports[_0x0fa2('0x40')]=function(_0x3d3f03,_0x475855){if(_0x3d3f03['body']['id']){delete _0x3d3f03[_0x0fa2('0x41')]['id'];}return db[_0x0fa2('0x36')][_0x0fa2('0x3e')]({'where':{'id':_0x3d3f03[_0x0fa2('0x42')]['id']}})['then'](handleEntityNotFound(_0x475855,null))[_0x0fa2('0x1c')](saveUpdates(_0x3d3f03[_0x0fa2('0x41')],null))[_0x0fa2('0x1c')](respondWithResult(_0x475855,null))[_0x0fa2('0x3a')](handleError(_0x475855,null));};exports[_0x0fa2('0x43')]=function(_0x51ebe8,_0x41df2f){return db[_0x0fa2('0x36')][_0x0fa2('0x3e')]({'where':{'id':_0x51ebe8[_0x0fa2('0x42')]['id']}})[_0x0fa2('0x1c')](handleEntityNotFound(_0x41df2f,null))[_0x0fa2('0x1c')](removeEntity(_0x41df2f,null))[_0x0fa2('0x3a')](handleError(_0x41df2f,null));}; \ No newline at end of file +var _0xc53e=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','count','includeAll','include','findAll','rows','catch','show','find','create','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','index','AnalyticMetric','rawAttributes','model','query','dateStart','dateEnd','filters'];(function(_0xf34adf,_0xc4aeb0){var _0x13be6a=function(_0x38c35d){while(--_0x38c35d){_0xf34adf['push'](_0xf34adf['shift']());}};_0x13be6a(++_0xc4aeb0);}(_0xc53e,0x11b));var _0xec53=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xc53e[_0x8de54f];return _0x14cba4;};'use strict';var pdf=require(_0xec53('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xec53('0x1'));var zipdir=require(_0xec53('0x2'));var jsonpatch=require(_0xec53('0x3'));var rp=require(_0xec53('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xec53('0x5'));var util=require('util');var path=require(_0xec53('0x6'));var sox=require(_0xec53('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xec53('0x8'));var squel=require(_0xec53('0x9'));var crypto=require(_0xec53('0xa'));var jsforce=require(_0xec53('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xec53('0xc'));var Papa=require(_0xec53('0xd'));var Redis=require(_0xec53('0xe'));var qs=require(_0xec53('0xf'));var logger=require(_0xec53('0x10'))(_0xec53('0x11'));var utils=require(_0xec53('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c561,_0x10e5bf){_0x10e5bf=_0x10e5bf||0xcc;return function(_0x4fb531){if(_0x4fb531){return _0x5c561[_0xec53('0x13')](_0x10e5bf);}return _0x5c561[_0xec53('0x14')](_0x10e5bf)[_0xec53('0x15')]();};}function respondWithResult(_0x1e669a,_0xa274b1){_0xa274b1=_0xa274b1||0xc8;return function(_0x8d042d){if(_0x8d042d){return _0x1e669a[_0xec53('0x14')](_0xa274b1)[_0xec53('0x16')](_0x8d042d);}};}function respondWithFilteredResult(_0x704358,_0x5d9fa8){return function(_0x49e5bf){if(_0x49e5bf){var _0x45eab7=_0x49e5bf['count'],_0x56ba5c=_0x5d9fa8[_0xec53('0x17')],_0x148df4=_0x5d9fa8[_0xec53('0x17')]+_0x5d9fa8[_0xec53('0x18')],_0x59e27a;if(_0x148df4>=_0x45eab7){_0x148df4=_0x45eab7;_0x59e27a=0xc8;}else{_0x59e27a=0xce;}_0x704358[_0xec53('0x14')](_0x59e27a);return _0x704358['set'](_0xec53('0x19'),_0x56ba5c+'-'+_0x148df4+'/'+_0x45eab7)['json'](_0x49e5bf);}return null;};}function patchUpdates(_0x382efe){return function(_0x43e99b){try{jsonpatch[_0xec53('0x1a')](_0x43e99b,_0x382efe,!![]);}catch(_0x24e6fb){return BPromise[_0xec53('0x1b')](_0x24e6fb);}return _0x43e99b[_0xec53('0x1c')]();};}function saveUpdates(_0x38bd94,_0x2a3ff0){return function(_0x417e9a){if(_0x417e9a){return _0x417e9a[_0xec53('0x1d')](_0x38bd94)[_0xec53('0x1e')](function(_0x5ccb66){return _0x5ccb66;});}return null;};}function removeEntity(_0x4ed9e2,_0x271fdd){return function(_0x5e0013){if(_0x5e0013){return _0x5e0013[_0xec53('0x1f')]()[_0xec53('0x1e')](function(){_0x4ed9e2[_0xec53('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4434de,_0x4fb483){return function(_0x19edbf){if(!_0x19edbf){_0x4434de[_0xec53('0x13')](0x194);}return _0x19edbf;};}function handleError(_0x489f82,_0x3eceb0){_0x3eceb0=_0x3eceb0||0x1f4;return function(_0x133648){logger[_0xec53('0x20')](_0x133648['stack']);if(_0x133648['name']){delete _0x133648[_0xec53('0x21')];}_0x489f82[_0xec53('0x14')](_0x3eceb0)['send'](_0x133648);};}exports[_0xec53('0x22')]=function(_0x1ae514,_0x27247e){var _0x6f869a={},_0x3cc53f={},_0x2f2400={'count':0x0,'rows':[]};var _0x1ef72b=db[_0xec53('0x23')][_0xec53('0x24')];_0x3cc53f[_0xec53('0x25')]=_['keys'](_0x1ef72b);var _0x39a886={'dateStart':_0x1ae514[_0xec53('0x26')][_0xec53('0x27')],'dateEnd':_0x1ae514[_0xec53('0x26')][_0xec53('0x28')]};delete _0x1ae514[_0xec53('0x26')][_0xec53('0x27')];delete _0x1ae514[_0xec53('0x26')][_0xec53('0x28')];_0x3cc53f[_0xec53('0x26')]=_['keys'](_0x1ae514[_0xec53('0x26')]);_0x3cc53f[_0xec53('0x29')]=_[_0xec53('0x2a')](_0x3cc53f[_0xec53('0x25')],_0x3cc53f[_0xec53('0x26')]);_0x6f869a[_0xec53('0x2b')]=_[_0xec53('0x2a')](_0x3cc53f[_0xec53('0x25')],qs[_0xec53('0x2c')](_0x1ae514[_0xec53('0x26')][_0xec53('0x2c')]));_0x6f869a[_0xec53('0x2b')]=_0x6f869a[_0xec53('0x2b')][_0xec53('0x2d')]?_0x6f869a[_0xec53('0x2b')]:_0x3cc53f[_0xec53('0x25')];if(!_0x1ae514[_0xec53('0x26')][_0xec53('0x2e')](_0xec53('0x2f'))){_0x6f869a[_0xec53('0x18')]=qs[_0xec53('0x18')](_0x1ae514['query'][_0xec53('0x18')]);_0x6f869a[_0xec53('0x17')]=qs[_0xec53('0x17')](_0x1ae514[_0xec53('0x26')][_0xec53('0x17')]);}_0x6f869a[_0xec53('0x30')]=qs[_0xec53('0x31')](_0x1ae514['query'][_0xec53('0x31')]);_0x6f869a[_0xec53('0x32')]=qs['filters'](_[_0xec53('0x33')](_0x1ae514[_0xec53('0x26')],_0x3cc53f[_0xec53('0x29')]));if(_0x39a886[_0xec53('0x27')]){if(_0x39a886[_0xec53('0x28')]){_0x39a886[_0xec53('0x28')]=moment(_0x39a886[_0xec53('0x28')])['add'](0x1,'day');}else{_0x39a886[_0xec53('0x28')]=moment(_0x39a886['dateStart'])['add'](0x1,'day');}_[_0xec53('0x34')](_0x6f869a[_0xec53('0x32')],{'createdAt':{'$gte':_0x39a886[_0xec53('0x27')],'$lte':_0x39a886['dateEnd']}});}if(_0x1ae514[_0xec53('0x26')][_0xec53('0x35')]){_0x6f869a[_0xec53('0x32')]=_['merge'](_0x6f869a[_0xec53('0x32')],{'$or':_['map'](_0x6f869a[_0xec53('0x2b')],function(_0x591474){var _0x9d74e6={};_0x9d74e6[_0x591474]={'$like':'%'+_0x1ae514[_0xec53('0x26')][_0xec53('0x35')]+'%'};return _0x9d74e6;})});}_0x6f869a=_[_0xec53('0x34')]({},_0x6f869a,_0x1ae514['options']);var _0x91ecfd={'where':_0x6f869a[_0xec53('0x32')]};return db[_0xec53('0x23')][_0xec53('0x36')](_0x91ecfd)[_0xec53('0x1e')](function(_0x405889){_0x2f2400['count']=_0x405889;if(_0x1ae514[_0xec53('0x26')][_0xec53('0x37')]){_0x6f869a[_0xec53('0x38')]=[{'all':!![]}];}return db[_0xec53('0x23')][_0xec53('0x39')](_0x6f869a);})['then'](function(_0x5157ee){_0x2f2400[_0xec53('0x3a')]=_0x5157ee;return _0x2f2400;})[_0xec53('0x1e')](respondWithFilteredResult(_0x27247e,_0x6f869a))[_0xec53('0x3b')](handleError(_0x27247e,null));};exports[_0xec53('0x3c')]=function(_0x34cd29,_0x5e0eb6){var _0x22b213={'raw':!![],'where':{'id':_0x34cd29['params']['id']}},_0x55706c={};_0x55706c[_0xec53('0x25')]=_['keys'](db[_0xec53('0x23')][_0xec53('0x24')]);_0x55706c[_0xec53('0x26')]=_['keys'](_0x34cd29['query']);_0x55706c[_0xec53('0x29')]=_[_0xec53('0x2a')](_0x55706c[_0xec53('0x25')],_0x55706c[_0xec53('0x26')]);_0x22b213[_0xec53('0x2b')]=_[_0xec53('0x2a')](_0x55706c['model'],qs[_0xec53('0x2c')](_0x34cd29[_0xec53('0x26')][_0xec53('0x2c')]));_0x22b213['attributes']=_0x22b213[_0xec53('0x2b')][_0xec53('0x2d')]?_0x22b213[_0xec53('0x2b')]:_0x55706c[_0xec53('0x25')];if(_0x34cd29[_0xec53('0x26')][_0xec53('0x37')]){_0x22b213[_0xec53('0x38')]=[{'all':!![]}];}_0x22b213=_[_0xec53('0x34')]({},_0x22b213,_0x34cd29['options']);return db[_0xec53('0x23')][_0xec53('0x3d')](_0x22b213)[_0xec53('0x1e')](handleEntityNotFound(_0x5e0eb6,null))[_0xec53('0x1e')](respondWithResult(_0x5e0eb6,null))[_0xec53('0x3b')](handleError(_0x5e0eb6,null));};exports[_0xec53('0x3e')]=function(_0x2e5e0c,_0x524e1d){return db[_0xec53('0x23')][_0xec53('0x3e')](_0x2e5e0c[_0xec53('0x3f')],{})[_0xec53('0x1e')](respondWithResult(_0x524e1d,0xc9))[_0xec53('0x3b')](handleError(_0x524e1d,null));};exports[_0xec53('0x1d')]=function(_0x1b13c1,_0x15fb41){if(_0x1b13c1[_0xec53('0x3f')]['id']){delete _0x1b13c1[_0xec53('0x3f')]['id'];}return db[_0xec53('0x23')]['find']({'where':{'id':_0x1b13c1[_0xec53('0x40')]['id']}})[_0xec53('0x1e')](handleEntityNotFound(_0x15fb41,null))[_0xec53('0x1e')](saveUpdates(_0x1b13c1[_0xec53('0x3f')],null))[_0xec53('0x1e')](respondWithResult(_0x15fb41,null))[_0xec53('0x3b')](handleError(_0x15fb41,null));};exports['destroy']=function(_0x3f1c1c,_0x1b1d50){return db[_0xec53('0x23')][_0xec53('0x3d')]({'where':{'id':_0x3f1c1c[_0xec53('0x40')]['id']}})[_0xec53('0x1e')](handleEntityNotFound(_0x1b1d50,null))[_0xec53('0x1e')](removeEntity(_0x1b1d50,null))[_0xec53('0x3b')](handleError(_0x1b1d50,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 80b649e..a82e3d8 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 _0x87ee=['exports','define','AnalyticMetric','util','../../config/logger','api','moment','bluebird','request-promise','./analyticMetric.attributes'];(function(_0x55cb1a,_0x415291){var _0xd15365=function(_0x25b3ee){while(--_0x25b3ee){_0x55cb1a['push'](_0x55cb1a['shift']());}};_0xd15365(++_0x415291);}(_0x87ee,0x71));var _0xe87e=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x87ee[_0x1caf6a];return _0x1bf493;};'use strict';var _=require('lodash');var util=require(_0xe87e('0x0'));var logger=require(_0xe87e('0x1'))(_0xe87e('0x2'));var moment=require(_0xe87e('0x3'));var BPromise=require(_0xe87e('0x4'));var rp=require(_0xe87e('0x5'));var attributes=require(_0xe87e('0x6'));module[_0xe87e('0x7')]=function(_0x276ac8,_0x4ed75b){return _0x276ac8[_0xe87e('0x8')](_0xe87e('0x9'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf7c9=['api','moment','bluebird','request-promise','./analyticMetric.attributes','exports','define','AnalyticMetric','lodash'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xf7c9,0x7d));var _0x9f7c=function(_0x3b5c80,_0x345a41){_0x3b5c80=_0x3b5c80-0x0;var _0x490d6c=_0xf7c9[_0x3b5c80];return _0x490d6c;};'use strict';var _=require(_0x9f7c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9f7c('0x1'));var moment=require(_0x9f7c('0x2'));var BPromise=require(_0x9f7c('0x3'));var rp=require(_0x9f7c('0x4'));var attributes=require(_0x9f7c('0x5'));module[_0x9f7c('0x6')]=function(_0x58998d,_0x590335){return _0x58998d[_0x9f7c('0x7')](_0x9f7c('0x8'),attributes,{'tableName':'analytics_metrics','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 2f4f031..6a5e46c 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 _0xb790=['AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','AnalyticMetric,\x20%s,\x20%s','result','catch','util','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug'];(function(_0x19258b,_0x22e850){var _0x5be66a=function(_0x24e321){while(--_0x24e321){_0x19258b['push'](_0x19258b['shift']());}};_0x5be66a(++_0x22e850);}(_0xb790,0xe5));var _0x0b79=function(_0x37222f,_0x25a5ab){_0x37222f=_0x37222f-0x0;var _0x5c5a6d=_0xb790[_0x37222f];return _0x5c5a6d;};'use strict';var _=require('lodash');var util=require(_0x0b79('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b79('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0b79('0x2'))(_0x0b79('0x3'));var config=require('../../config/environment');var jayson=require(_0x0b79('0x4'));var client=jayson[_0x0b79('0x5')][_0x0b79('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x574c73,_0x69b376,_0x1e9124){return new BPromise(function(_0x3de006,_0x301de6){return client[_0x0b79('0x7')](_0x574c73,_0x1e9124)[_0x0b79('0x8')](function(_0x834937){logger[_0x0b79('0x9')]('AnalyticMetric,\x20%s,\x20%s',_0x69b376,'request\x20sent');logger[_0x0b79('0xa')](_0x0b79('0xb'),_0x69b376,_0x0b79('0xc'),JSON[_0x0b79('0xd')](_0x834937));if(_0x834937[_0x0b79('0xe')]){if(_0x834937['error'][_0x0b79('0xf')]===0x1f4){logger[_0x0b79('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x69b376,_0x834937[_0x0b79('0xe')][_0x0b79('0x10')]);return _0x301de6(_0x834937[_0x0b79('0xe')][_0x0b79('0x10')]);}logger['error'](_0x0b79('0x11'),_0x69b376,_0x834937[_0x0b79('0xe')][_0x0b79('0x10')]);return _0x3de006(_0x834937[_0x0b79('0xe')]['message']);}else{logger[_0x0b79('0x9')](_0x0b79('0x11'),_0x69b376,'request\x20sent');_0x3de006(_0x834937[_0x0b79('0x12')][_0x0b79('0x10')]);}})[_0x0b79('0x13')](function(_0x43259e){logger[_0x0b79('0xe')](_0x0b79('0x11'),_0x69b376,_0x43259e);_0x301de6(_0x43259e);});});} \ No newline at end of file +var _0xf873=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2466ec,_0x4260dc){var _0x450c0b=function(_0x6e7ab6){while(--_0x6e7ab6){_0x2466ec['push'](_0x2466ec['shift']());}};_0x450c0b(++_0x4260dc);}(_0xf873,0xb2));var _0x3f87=function(_0x358913,_0x2595a5){_0x358913=_0x358913-0x0;var _0x2fa463=_0xf873[_0x358913];return _0x2fa463;};'use strict';var _=require('lodash');var util=require(_0x3f87('0x0'));var moment=require(_0x3f87('0x1'));var BPromise=require(_0x3f87('0x2'));var rs=require(_0x3f87('0x3'));var fs=require('fs');var Redis=require(_0x3f87('0x4'));var db=require(_0x3f87('0x5'))['db'];var utils=require(_0x3f87('0x6'));var logger=require(_0x3f87('0x7'))(_0x3f87('0x8'));var config=require('../../config/environment');var jayson=require(_0x3f87('0x9'));var client=jayson[_0x3f87('0xa')][_0x3f87('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a5e37,_0x8bf89b,_0x2c7ccc){return new BPromise(function(_0x3b8e92,_0x41faf2){return client[_0x3f87('0xc')](_0x5a5e37,_0x2c7ccc)[_0x3f87('0xd')](function(_0x4c3ed4){logger[_0x3f87('0xe')](_0x3f87('0xf'),_0x8bf89b,_0x3f87('0x10'));logger[_0x3f87('0x11')](_0x3f87('0x12'),_0x8bf89b,_0x3f87('0x10'),JSON[_0x3f87('0x13')](_0x4c3ed4));if(_0x4c3ed4[_0x3f87('0x14')]){if(_0x4c3ed4[_0x3f87('0x14')][_0x3f87('0x15')]===0x1f4){logger[_0x3f87('0x14')](_0x3f87('0xf'),_0x8bf89b,_0x4c3ed4[_0x3f87('0x14')][_0x3f87('0x16')]);return _0x41faf2(_0x4c3ed4['error'][_0x3f87('0x16')]);}logger[_0x3f87('0x14')]('AnalyticMetric,\x20%s,\x20%s',_0x8bf89b,_0x4c3ed4[_0x3f87('0x14')][_0x3f87('0x16')]);return _0x3b8e92(_0x4c3ed4[_0x3f87('0x14')][_0x3f87('0x16')]);}else{logger[_0x3f87('0xe')](_0x3f87('0xf'),_0x8bf89b,_0x3f87('0x10'));_0x3b8e92(_0x4c3ed4[_0x3f87('0x17')]['message']);}})[_0x3f87('0x18')](function(_0x3ac7a7){logger[_0x3f87('0x14')]('AnalyticMetric,\x20%s,\x20%s',_0x8bf89b,_0x3ac7a7);_0x41faf2(_0x3ac7a7);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 757674a..b29be8a 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 _0xfcbb=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','index','get','/:id','isAuthenticated','show','post','put','delete','destroy','exports','multer'];(function(_0x11bc40,_0x537bbc){var _0x2b7a99=function(_0x50135b){while(--_0x50135b){_0x11bc40['push'](_0x11bc40['shift']());}};_0x2b7a99(++_0x537bbc);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x496caa,_0x3c323c){_0x496caa=_0x496caa-0x0;var _0x2a01ea=_0xfcbb[_0x496caa];return _0x2a01ea;};'use strict';var multer=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var path=require(_0xbfcb('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbfcb('0x3')]();var auth=require(_0xbfcb('0x4'));var interaction=require(_0xbfcb('0x5'));var config=require(_0xbfcb('0x6'));var controller=require(_0xbfcb('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xbfcb('0x8')]);router[_0xbfcb('0x9')](_0xbfcb('0xa'),auth[_0xbfcb('0xb')](),controller[_0xbfcb('0xc')]);router[_0xbfcb('0xd')]('/',auth[_0xbfcb('0xb')](),controller['create']);router[_0xbfcb('0xe')](_0xbfcb('0xa'),auth[_0xbfcb('0xb')](),controller['update']);router[_0xbfcb('0xf')](_0xbfcb('0xa'),auth[_0xbfcb('0xb')](),controller[_0xbfcb('0x10')]);module[_0xbfcb('0x11')]=router; \ No newline at end of file +var _0xed3c=['post','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x434573,_0x429b50){var _0x2e7e99=function(_0x28fa22){while(--_0x28fa22){_0x434573['push'](_0x434573['shift']());}};_0x2e7e99(++_0x429b50);}(_0xed3c,0x1a6));var _0xced3=function(_0x19c315,_0x2b2e84){_0x19c315=_0x19c315-0x0;var _0x3dc378=_0xed3c[_0x19c315];return _0x3dc378;};'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('./analyticMetric.controller');router[_0xced3('0x7')]('/',auth[_0xced3('0x8')](),controller[_0xced3('0x9')]);router[_0xced3('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xced3('0xa')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xced3('0xb'),auth[_0xced3('0x8')](),controller[_0xced3('0xc')]);router[_0xced3('0xd')](_0xced3('0xb'),auth['isAuthenticated'](),controller[_0xced3('0xe')]);module[_0xced3('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 1869897..cd3e225 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 _0x3bb4=['TEXT','sequelize','exports'];(function(_0x29c68c,_0x3d3616){var _0x3ba232=function(_0x1ddbf7){while(--_0x1ddbf7){_0x29c68c['push'](_0x29c68c['shift']());}};_0x3ba232(++_0x3d3616);}(_0x3bb4,0xdf));var _0x43bb=function(_0x16e648,_0x2b6fee){_0x16e648=_0x16e648-0x0;var _0x575bc7=_0x3bb4[_0x16e648];return _0x575bc7;};'use strict';var Sequelize=require(_0x43bb('0x0'));module[_0x43bb('0x1')]={'tree':{'type':Sequelize[_0x43bb('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x4252=['TEXT','sequelize'];(function(_0xdbcc55,_0x3048b1){var _0x1983b7=function(_0x397e1d){while(--_0x397e1d){_0xdbcc55['push'](_0xdbcc55['shift']());}};_0x1983b7(++_0x3048b1);}(_0x4252,0x77));var _0x2425=function(_0xb8abe2,_0xd5b90b){_0xb8abe2=_0xb8abe2-0x0;var _0x57d7de=_0x4252[_0xb8abe2];return _0x57d7de;};'use strict';var Sequelize=require(_0x2425('0x0'));module['exports']={'tree':{'type':Sequelize[_0x2425('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index d6c4650..a233c53 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 _0xbd50=['create','body','update','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','sendStatus','stack','name','send','AnalyticTreeReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','add','day','merge','filter','where','map','options','includeAll','include','findAll','catch','find'];(function(_0x591940,_0xa3f3c0){var _0x3fc57c=function(_0x31eae3){while(--_0x31eae3){_0x591940['push'](_0x591940['shift']());}};_0x3fc57c(++_0xa3f3c0);}(_0xbd50,0x196));var _0x0bd5=function(_0x524c2e,_0x165d16){_0x524c2e=_0x524c2e-0x0;var _0x4ce75d=_0xbd50[_0x524c2e];return _0x4ce75d;};'use strict';var pdf=require(_0x0bd5('0x0'));var emlformat=require(_0x0bd5('0x1'));var rimraf=require(_0x0bd5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0bd5('0x3'));var rp=require(_0x0bd5('0x4'));var moment=require(_0x0bd5('0x5'));var BPromise=require(_0x0bd5('0x6'));var Mustache=require(_0x0bd5('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x0bd5('0x8'));var ejs=require(_0x0bd5('0x9'));var fs=require('fs');var _=require(_0x0bd5('0xa'));var squel=require(_0x0bd5('0xb'));var crypto=require(_0x0bd5('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0bd5('0x8'));var querystring=require(_0x0bd5('0xd'));var Papa=require(_0x0bd5('0xe'));var Redis=require('ioredis');var qs=require(_0x0bd5('0xf'));var logger=require(_0x0bd5('0x10'))('api');var utils=require(_0x0bd5('0x11'));var config=require(_0x0bd5('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ce7dd,_0x130723){_0x130723=_0x130723||0xcc;return function(_0x1aa818){if(_0x1aa818){return _0x1ce7dd['sendStatus'](_0x130723);}return _0x1ce7dd[_0x0bd5('0x13')](_0x130723)[_0x0bd5('0x14')]();};}function respondWithResult(_0x2f9588,_0xc5b4cd){_0xc5b4cd=_0xc5b4cd||0xc8;return function(_0xfa1eed){if(_0xfa1eed){return _0x2f9588[_0x0bd5('0x13')](_0xc5b4cd)[_0x0bd5('0x15')](_0xfa1eed);}};}function respondWithFilteredResult(_0x1e961d,_0x4f485b){return function(_0x78f9b8){if(_0x78f9b8){var _0x325e43=_0x78f9b8[_0x0bd5('0x16')],_0x574315=_0x4f485b[_0x0bd5('0x17')],_0x31349f=_0x4f485b['offset']+_0x4f485b[_0x0bd5('0x18')],_0x23ef4e;if(_0x31349f>=_0x325e43){_0x31349f=_0x325e43;_0x23ef4e=0xc8;}else{_0x23ef4e=0xce;}_0x1e961d[_0x0bd5('0x13')](_0x23ef4e);return _0x1e961d[_0x0bd5('0x19')](_0x0bd5('0x1a'),_0x574315+'-'+_0x31349f+'/'+_0x325e43)[_0x0bd5('0x15')](_0x78f9b8);}return null;};}function patchUpdates(_0x23be38){return function(_0xc58e12){try{jsonpatch[_0x0bd5('0x1b')](_0xc58e12,_0x23be38,!![]);}catch(_0x29fa4c){return BPromise[_0x0bd5('0x1c')](_0x29fa4c);}return _0xc58e12[_0x0bd5('0x1d')]();};}function saveUpdates(_0x415d8f,_0x4008bd){return function(_0x2dc1e5){if(_0x2dc1e5){return _0x2dc1e5['update'](_0x415d8f)['then'](function(_0x596b6a){return _0x596b6a;});}return null;};}function removeEntity(_0x4ed64e,_0x47d74a){return function(_0x6c06bd){if(_0x6c06bd){return _0x6c06bd[_0x0bd5('0x1e')]()[_0x0bd5('0x1f')](function(){_0x4ed64e[_0x0bd5('0x13')](0xcc)[_0x0bd5('0x14')]();});}};}function handleEntityNotFound(_0x4c74c9,_0x440f85){return function(_0x3b235b){if(!_0x3b235b){_0x4c74c9[_0x0bd5('0x20')](0x194);}return _0x3b235b;};}function handleError(_0x5a8139,_0x5b6dde){_0x5b6dde=_0x5b6dde||0x1f4;return function(_0x4a8787){logger['error'](_0x4a8787[_0x0bd5('0x21')]);if(_0x4a8787[_0x0bd5('0x22')]){delete _0x4a8787[_0x0bd5('0x22')];}_0x5a8139['status'](_0x5b6dde)[_0x0bd5('0x23')](_0x4a8787);};}exports['index']=function(_0x456e87,_0x3ffb08){var _0x18cec3={},_0x2b6b53={},_0x3ff237={'count':0x0,'rows':[]};var _0x2023d5=db[_0x0bd5('0x24')][_0x0bd5('0x25')];_0x2b6b53[_0x0bd5('0x26')]=_[_0x0bd5('0x27')](_0x2023d5);var _0x15561b={'dateStart':_0x456e87[_0x0bd5('0x28')][_0x0bd5('0x29')],'dateEnd':_0x456e87[_0x0bd5('0x28')]['dateEnd']};delete _0x456e87[_0x0bd5('0x28')][_0x0bd5('0x29')];delete _0x456e87['query'][_0x0bd5('0x2a')];_0x2b6b53[_0x0bd5('0x28')]=_['keys'](_0x456e87[_0x0bd5('0x28')]);_0x2b6b53[_0x0bd5('0x2b')]=_[_0x0bd5('0x2c')](_0x2b6b53[_0x0bd5('0x26')],_0x2b6b53['query']);_0x18cec3[_0x0bd5('0x2d')]=_[_0x0bd5('0x2c')](_0x2b6b53[_0x0bd5('0x26')],qs[_0x0bd5('0x2e')](_0x456e87[_0x0bd5('0x28')][_0x0bd5('0x2e')]));_0x18cec3['attributes']=_0x18cec3[_0x0bd5('0x2d')]['length']?_0x18cec3[_0x0bd5('0x2d')]:_0x2b6b53[_0x0bd5('0x26')];if(!_0x456e87[_0x0bd5('0x28')][_0x0bd5('0x2f')](_0x0bd5('0x30'))){_0x18cec3[_0x0bd5('0x18')]=qs[_0x0bd5('0x18')](_0x456e87[_0x0bd5('0x28')][_0x0bd5('0x18')]);_0x18cec3[_0x0bd5('0x17')]=qs[_0x0bd5('0x17')](_0x456e87[_0x0bd5('0x28')][_0x0bd5('0x17')]);}_0x18cec3['order']=qs[_0x0bd5('0x31')](_0x456e87[_0x0bd5('0x28')]['sort']);_0x18cec3['where']=qs[_0x0bd5('0x2b')](_[_0x0bd5('0x32')](_0x456e87[_0x0bd5('0x28')],_0x2b6b53[_0x0bd5('0x2b')]));if(_0x15561b[_0x0bd5('0x29')]){if(_0x15561b[_0x0bd5('0x2a')]){_0x15561b[_0x0bd5('0x2a')]=moment(_0x15561b[_0x0bd5('0x2a')])[_0x0bd5('0x33')](0x1,_0x0bd5('0x34'));}else{_0x15561b[_0x0bd5('0x2a')]=moment(_0x15561b[_0x0bd5('0x29')])[_0x0bd5('0x33')](0x1,'day');}_[_0x0bd5('0x35')](_0x18cec3['where'],{'createdAt':{'$gte':_0x15561b[_0x0bd5('0x29')],'$lte':_0x15561b[_0x0bd5('0x2a')]}});}if(_0x456e87[_0x0bd5('0x28')][_0x0bd5('0x36')]){_0x18cec3[_0x0bd5('0x37')]=_[_0x0bd5('0x35')](_0x18cec3['where'],{'$or':_[_0x0bd5('0x38')](_0x18cec3[_0x0bd5('0x2d')],function(_0x11b1e1){var _0x1a9dda={};_0x1a9dda[_0x11b1e1]={'$like':'%'+_0x456e87[_0x0bd5('0x28')][_0x0bd5('0x36')]+'%'};return _0x1a9dda;})});}_0x18cec3=_[_0x0bd5('0x35')]({},_0x18cec3,_0x456e87[_0x0bd5('0x39')]);var _0x1c2ef8={'where':_0x18cec3['where']};return db[_0x0bd5('0x24')]['count'](_0x1c2ef8)[_0x0bd5('0x1f')](function(_0xc17464){_0x3ff237['count']=_0xc17464;if(_0x456e87[_0x0bd5('0x28')][_0x0bd5('0x3a')]){_0x18cec3[_0x0bd5('0x3b')]=[{'all':!![]}];}return db[_0x0bd5('0x24')][_0x0bd5('0x3c')](_0x18cec3);})[_0x0bd5('0x1f')](function(_0xf6e878){_0x3ff237['rows']=_0xf6e878;return _0x3ff237;})['then'](respondWithFilteredResult(_0x3ffb08,_0x18cec3))[_0x0bd5('0x3d')](handleError(_0x3ffb08,null));};exports['show']=function(_0x5dd42b,_0x28892e){var _0x3c6f2b={'raw':!![],'where':{'id':_0x5dd42b['params']['id']}},_0x480d1b={};_0x480d1b['model']=_[_0x0bd5('0x27')](db['AnalyticTreeReport']['rawAttributes']);_0x480d1b[_0x0bd5('0x28')]=_[_0x0bd5('0x27')](_0x5dd42b['query']);_0x480d1b['filters']=_[_0x0bd5('0x2c')](_0x480d1b[_0x0bd5('0x26')],_0x480d1b[_0x0bd5('0x28')]);_0x3c6f2b[_0x0bd5('0x2d')]=_['intersection'](_0x480d1b[_0x0bd5('0x26')],qs[_0x0bd5('0x2e')](_0x5dd42b[_0x0bd5('0x28')][_0x0bd5('0x2e')]));_0x3c6f2b[_0x0bd5('0x2d')]=_0x3c6f2b[_0x0bd5('0x2d')]['length']?_0x3c6f2b[_0x0bd5('0x2d')]:_0x480d1b[_0x0bd5('0x26')];if(_0x5dd42b[_0x0bd5('0x28')]['includeAll']){_0x3c6f2b[_0x0bd5('0x3b')]=[{'all':!![]}];}_0x3c6f2b=_[_0x0bd5('0x35')]({},_0x3c6f2b,_0x5dd42b[_0x0bd5('0x39')]);return db['AnalyticTreeReport'][_0x0bd5('0x3e')](_0x3c6f2b)[_0x0bd5('0x1f')](handleEntityNotFound(_0x28892e,null))[_0x0bd5('0x1f')](respondWithResult(_0x28892e,null))[_0x0bd5('0x3d')](handleError(_0x28892e,null));};exports[_0x0bd5('0x3f')]=function(_0x4d0db7,_0x205569){return db[_0x0bd5('0x24')]['create'](_0x4d0db7[_0x0bd5('0x40')],{})[_0x0bd5('0x1f')](respondWithResult(_0x205569,0xc9))[_0x0bd5('0x3d')](handleError(_0x205569,null));};exports[_0x0bd5('0x41')]=function(_0x2dbfe4,_0x508aa8){if(_0x2dbfe4[_0x0bd5('0x40')]['id']){delete _0x2dbfe4[_0x0bd5('0x40')]['id'];}return db['AnalyticTreeReport'][_0x0bd5('0x3e')]({'where':{'id':_0x2dbfe4['params']['id']}})[_0x0bd5('0x1f')](handleEntityNotFound(_0x508aa8,null))[_0x0bd5('0x1f')](saveUpdates(_0x2dbfe4[_0x0bd5('0x40')],null))[_0x0bd5('0x1f')](respondWithResult(_0x508aa8,null))['catch'](handleError(_0x508aa8,null));};exports[_0x0bd5('0x1e')]=function(_0x4cb674,_0x4db2ca){return db[_0x0bd5('0x24')][_0x0bd5('0x3e')]({'where':{'id':_0x4cb674[_0x0bd5('0x42')]['id']}})['then'](handleEntityNotFound(_0x4db2ca,null))[_0x0bd5('0x1f')](removeEntity(_0x4db2ca,null))['catch'](handleError(_0x4db2ca,null));}; \ No newline at end of file +var _0x7fbe=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','then','destroy','stack','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','options','AnalyticTreeReport','include','catch','show','params','includeAll','find','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x501047,_0x4ffc47){var _0x1d6209=function(_0x52902a){while(--_0x52902a){_0x501047['push'](_0x501047['shift']());}};_0x1d6209(++_0x4ffc47);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x47fd17,_0x4f7037){_0x47fd17=_0x47fd17-0x0;var _0x353a4b=_0x7fbe[_0x47fd17];return _0x353a4b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe7fb('0x0'));var zipdir=require(_0xe7fb('0x1'));var jsonpatch=require(_0xe7fb('0x2'));var rp=require(_0xe7fb('0x3'));var moment=require(_0xe7fb('0x4'));var BPromise=require(_0xe7fb('0x5'));var Mustache=require(_0xe7fb('0x6'));var util=require(_0xe7fb('0x7'));var path=require(_0xe7fb('0x8'));var sox=require(_0xe7fb('0x9'));var csv=require(_0xe7fb('0xa'));var ejs=require(_0xe7fb('0xb'));var fs=require('fs');var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0xa'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var qs=require(_0xe7fb('0x11'));var logger=require(_0xe7fb('0x12'))(_0xe7fb('0x13'));var utils=require(_0xe7fb('0x14'));var config=require(_0xe7fb('0x15'));var db=require(_0xe7fb('0x16'))['db'];function respondWithStatusCode(_0x3e934b,_0x3c07f3){_0x3c07f3=_0x3c07f3||0xcc;return function(_0x325035){if(_0x325035){return _0x3e934b[_0xe7fb('0x17')](_0x3c07f3);}return _0x3e934b[_0xe7fb('0x18')](_0x3c07f3)[_0xe7fb('0x19')]();};}function respondWithResult(_0xdf9760,_0x45fe75){_0x45fe75=_0x45fe75||0xc8;return function(_0x7fe4d3){if(_0x7fe4d3){return _0xdf9760['status'](_0x45fe75)[_0xe7fb('0x1a')](_0x7fe4d3);}};}function respondWithFilteredResult(_0x2225e5,_0x5573ab){return function(_0x30015a){if(_0x30015a){var _0x37eb9f=_0x30015a[_0xe7fb('0x1b')],_0x482f7d=_0x5573ab[_0xe7fb('0x1c')],_0xa76acf=_0x5573ab[_0xe7fb('0x1c')]+_0x5573ab[_0xe7fb('0x1d')],_0x559129;if(_0xa76acf>=_0x37eb9f){_0xa76acf=_0x37eb9f;_0x559129=0xc8;}else{_0x559129=0xce;}_0x2225e5['status'](_0x559129);return _0x2225e5[_0xe7fb('0x1e')]('Content-Range',_0x482f7d+'-'+_0xa76acf+'/'+_0x37eb9f)[_0xe7fb('0x1a')](_0x30015a);}return null;};}function patchUpdates(_0x546463){return function(_0x1e77fd){try{jsonpatch[_0xe7fb('0x1f')](_0x1e77fd,_0x546463,!![]);}catch(_0x3f96a7){return BPromise[_0xe7fb('0x20')](_0x3f96a7);}return _0x1e77fd['save']();};}function saveUpdates(_0x44466e,_0x5d1c87){return function(_0x11cae0){if(_0x11cae0){return _0x11cae0['update'](_0x44466e)[_0xe7fb('0x21')](function(_0x4ea664){return _0x4ea664;});}return null;};}function removeEntity(_0xa5af01,_0x135624){return function(_0x4a9994){if(_0x4a9994){return _0x4a9994[_0xe7fb('0x22')]()[_0xe7fb('0x21')](function(){_0xa5af01[_0xe7fb('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x469d50,_0x469ead){return function(_0x5da3d9){if(!_0x5da3d9){_0x469d50['sendStatus'](0x194);}return _0x5da3d9;};}function handleError(_0x52f08b,_0x35e4db){_0x35e4db=_0x35e4db||0x1f4;return function(_0x53c43a){logger['error'](_0x53c43a[_0xe7fb('0x23')]);if(_0x53c43a[_0xe7fb('0x24')]){delete _0x53c43a[_0xe7fb('0x24')];}_0x52f08b['status'](_0x35e4db)[_0xe7fb('0x25')](_0x53c43a);};}exports[_0xe7fb('0x26')]=function(_0x390f32,_0x1ceed8){var _0x392d75={},_0x16237a={},_0x380130={'count':0x0,'rows':[]};var _0x59e015=db['AnalyticTreeReport'][_0xe7fb('0x27')];_0x16237a[_0xe7fb('0x28')]=_[_0xe7fb('0x29')](_0x59e015);var _0x4fd290={'dateStart':_0x390f32[_0xe7fb('0x2a')][_0xe7fb('0x2b')],'dateEnd':_0x390f32[_0xe7fb('0x2a')][_0xe7fb('0x2c')]};delete _0x390f32[_0xe7fb('0x2a')][_0xe7fb('0x2b')];delete _0x390f32[_0xe7fb('0x2a')][_0xe7fb('0x2c')];_0x16237a['query']=_[_0xe7fb('0x29')](_0x390f32[_0xe7fb('0x2a')]);_0x16237a[_0xe7fb('0x2d')]=_['intersection'](_0x16237a['model'],_0x16237a[_0xe7fb('0x2a')]);_0x392d75['attributes']=_[_0xe7fb('0x2e')](_0x16237a[_0xe7fb('0x28')],qs[_0xe7fb('0x2f')](_0x390f32[_0xe7fb('0x2a')]['fields']));_0x392d75[_0xe7fb('0x30')]=_0x392d75[_0xe7fb('0x30')][_0xe7fb('0x31')]?_0x392d75[_0xe7fb('0x30')]:_0x16237a[_0xe7fb('0x28')];if(!_0x390f32['query'][_0xe7fb('0x32')](_0xe7fb('0x33'))){_0x392d75[_0xe7fb('0x1d')]=qs[_0xe7fb('0x1d')](_0x390f32[_0xe7fb('0x2a')][_0xe7fb('0x1d')]);_0x392d75[_0xe7fb('0x1c')]=qs[_0xe7fb('0x1c')](_0x390f32[_0xe7fb('0x2a')]['offset']);}_0x392d75[_0xe7fb('0x34')]=qs[_0xe7fb('0x35')](_0x390f32[_0xe7fb('0x2a')]['sort']);_0x392d75[_0xe7fb('0x36')]=qs[_0xe7fb('0x2d')](_[_0xe7fb('0x37')](_0x390f32[_0xe7fb('0x2a')],_0x16237a[_0xe7fb('0x2d')]));if(_0x4fd290[_0xe7fb('0x2b')]){if(_0x4fd290[_0xe7fb('0x2c')]){_0x4fd290[_0xe7fb('0x2c')]=moment(_0x4fd290[_0xe7fb('0x2c')])[_0xe7fb('0x38')](0x1,_0xe7fb('0x39'));}else{_0x4fd290[_0xe7fb('0x2c')]=moment(_0x4fd290[_0xe7fb('0x2b')])[_0xe7fb('0x38')](0x1,_0xe7fb('0x39'));}_[_0xe7fb('0x3a')](_0x392d75[_0xe7fb('0x36')],{'createdAt':{'$gte':_0x4fd290[_0xe7fb('0x2b')],'$lte':_0x4fd290[_0xe7fb('0x2c')]}});}if(_0x390f32['query'][_0xe7fb('0x3b')]){_0x392d75[_0xe7fb('0x36')]=_[_0xe7fb('0x3a')](_0x392d75[_0xe7fb('0x36')],{'$or':_['map'](_0x392d75[_0xe7fb('0x30')],function(_0x186418){var _0xd472d={};_0xd472d[_0x186418]={'$like':'%'+_0x390f32[_0xe7fb('0x2a')]['filter']+'%'};return _0xd472d;})});}_0x392d75=_[_0xe7fb('0x3a')]({},_0x392d75,_0x390f32[_0xe7fb('0x3c')]);var _0x34265f={'where':_0x392d75[_0xe7fb('0x36')]};return db[_0xe7fb('0x3d')][_0xe7fb('0x1b')](_0x34265f)['then'](function(_0x4362c2){_0x380130[_0xe7fb('0x1b')]=_0x4362c2;if(_0x390f32[_0xe7fb('0x2a')]['includeAll']){_0x392d75[_0xe7fb('0x3e')]=[{'all':!![]}];}return db[_0xe7fb('0x3d')]['findAll'](_0x392d75);})['then'](function(_0x5a01ae){_0x380130['rows']=_0x5a01ae;return _0x380130;})['then'](respondWithFilteredResult(_0x1ceed8,_0x392d75))[_0xe7fb('0x3f')](handleError(_0x1ceed8,null));};exports[_0xe7fb('0x40')]=function(_0xed62e9,_0x492f0f){var _0x34cdd8={'raw':!![],'where':{'id':_0xed62e9[_0xe7fb('0x41')]['id']}},_0x58d743={};_0x58d743[_0xe7fb('0x28')]=_['keys'](db[_0xe7fb('0x3d')][_0xe7fb('0x27')]);_0x58d743[_0xe7fb('0x2a')]=_[_0xe7fb('0x29')](_0xed62e9['query']);_0x58d743[_0xe7fb('0x2d')]=_[_0xe7fb('0x2e')](_0x58d743[_0xe7fb('0x28')],_0x58d743['query']);_0x34cdd8[_0xe7fb('0x30')]=_[_0xe7fb('0x2e')](_0x58d743[_0xe7fb('0x28')],qs[_0xe7fb('0x2f')](_0xed62e9[_0xe7fb('0x2a')]['fields']));_0x34cdd8[_0xe7fb('0x30')]=_0x34cdd8['attributes'][_0xe7fb('0x31')]?_0x34cdd8[_0xe7fb('0x30')]:_0x58d743[_0xe7fb('0x28')];if(_0xed62e9[_0xe7fb('0x2a')][_0xe7fb('0x42')]){_0x34cdd8['include']=[{'all':!![]}];}_0x34cdd8=_[_0xe7fb('0x3a')]({},_0x34cdd8,_0xed62e9['options']);return db['AnalyticTreeReport'][_0xe7fb('0x43')](_0x34cdd8)[_0xe7fb('0x21')](handleEntityNotFound(_0x492f0f,null))[_0xe7fb('0x21')](respondWithResult(_0x492f0f,null))['catch'](handleError(_0x492f0f,null));};exports[_0xe7fb('0x44')]=function(_0x4cefe7,_0x5ca94f){return db['AnalyticTreeReport'][_0xe7fb('0x44')](_0x4cefe7[_0xe7fb('0x45')],{})[_0xe7fb('0x21')](respondWithResult(_0x5ca94f,0xc9))[_0xe7fb('0x3f')](handleError(_0x5ca94f,null));};exports[_0xe7fb('0x46')]=function(_0x1f0533,_0x18a590){if(_0x1f0533[_0xe7fb('0x45')]['id']){delete _0x1f0533['body']['id'];}return db[_0xe7fb('0x3d')]['find']({'where':{'id':_0x1f0533[_0xe7fb('0x41')]['id']}})[_0xe7fb('0x21')](handleEntityNotFound(_0x18a590,null))['then'](saveUpdates(_0x1f0533[_0xe7fb('0x45')],null))['then'](respondWithResult(_0x18a590,null))[_0xe7fb('0x3f')](handleError(_0x18a590,null));};exports['destroy']=function(_0x68e723,_0x533e91){return db[_0xe7fb('0x3d')]['find']({'where':{'id':_0x68e723[_0xe7fb('0x41')]['id']}})[_0xe7fb('0x21')](handleEntityNotFound(_0x533e91,null))[_0xe7fb('0x21')](removeEntity(_0x533e91,null))[_0xe7fb('0x3f')](handleError(_0x533e91,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 4316059..8a52067 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 _0xc11e=['api','bluebird','request-promise','./analyticTreeReport.attributes','define','AnalyticTreeReport','../../config/logger'];(function(_0x15d59a,_0x4b13c2){var _0x575cd5=function(_0x5a6a3e){while(--_0x5a6a3e){_0x15d59a['push'](_0x15d59a['shift']());}};_0x575cd5(++_0x4b13c2);}(_0xc11e,0x7d));var _0xec11=function(_0x26faab,_0x3a15be){_0x26faab=_0x26faab-0x0;var _0x18bac1=_0xc11e[_0x26faab];return _0x18bac1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xec11('0x0'))(_0xec11('0x1'));var moment=require('moment');var BPromise=require(_0xec11('0x2'));var rp=require(_0xec11('0x3'));var attributes=require(_0xec11('0x4'));module['exports']=function(_0x531ac8,_0x177b07){return _0x531ac8[_0xec11('0x5')](_0xec11('0x6'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x996f=['api','moment','bluebird','request-promise','./analyticTreeReport.attributes','exports','analytics_report_trees','util','../../config/logger'];(function(_0x15df37,_0x403cce){var _0x26bee6=function(_0x3f97d5){while(--_0x3f97d5){_0x15df37['push'](_0x15df37['shift']());}};_0x26bee6(++_0x403cce);}(_0x996f,0x14b));var _0xf996=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x996f[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0xf996('0x0'));var logger=require(_0xf996('0x1'))(_0xf996('0x2'));var moment=require(_0xf996('0x3'));var BPromise=require(_0xf996('0x4'));var rp=require(_0xf996('0x5'));var attributes=require(_0xf996('0x6'));module[_0xf996('0x7')]=function(_0x4c5eca,_0x5ab403){return _0x4c5eca['define']('AnalyticTreeReport',attributes,{'tableName':_0xf996('0x8'),'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 684958b..ca898ed 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 _0x6791=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','moment','randomstring'];(function(_0x3598b0,_0x520a6f){var _0x1b6503=function(_0x11e00a){while(--_0x11e00a){_0x3598b0['push'](_0x3598b0['shift']());}};_0x1b6503(++_0x520a6f);}(_0x6791,0x1dc));var _0x1679=function(_0x55ec31,_0x3f1d64){_0x55ec31=_0x55ec31-0x0;var _0x47a20e=_0x6791[_0x55ec31];return _0x47a20e;};'use strict';var _=require(_0x1679('0x0'));var util=require(_0x1679('0x1'));var moment=require(_0x1679('0x2'));var BPromise=require('bluebird');var rs=require(_0x1679('0x3'));var fs=require('fs');var Redis=require(_0x1679('0x4'));var db=require(_0x1679('0x5'))['db'];var utils=require(_0x1679('0x6'));var logger=require(_0x1679('0x7'))(_0x1679('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1679('0x9')][_0x1679('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52f69b,_0x271b5f,_0x694a3e){return new BPromise(function(_0x368f22,_0x3faf61){return client['request'](_0x52f69b,_0x694a3e)[_0x1679('0xb')](function(_0x50778f){logger['info'](_0x1679('0xc'),_0x271b5f,_0x1679('0xd'));logger['debug'](_0x1679('0xe'),_0x271b5f,'request\x20sent',JSON[_0x1679('0xf')](_0x50778f));if(_0x50778f[_0x1679('0x10')]){if(_0x50778f[_0x1679('0x10')]['code']===0x1f4){logger[_0x1679('0x10')](_0x1679('0xc'),_0x271b5f,_0x50778f[_0x1679('0x10')][_0x1679('0x11')]);return _0x3faf61(_0x50778f[_0x1679('0x10')][_0x1679('0x11')]);}logger[_0x1679('0x10')]('AnalyticTreeReport,\x20%s,\x20%s',_0x271b5f,_0x50778f[_0x1679('0x10')][_0x1679('0x11')]);return _0x368f22(_0x50778f[_0x1679('0x10')][_0x1679('0x11')]);}else{logger[_0x1679('0x12')](_0x1679('0xc'),_0x271b5f,'request\x20sent');_0x368f22(_0x50778f[_0x1679('0x13')][_0x1679('0x11')]);}})['catch'](function(_0x40e83e){logger[_0x1679('0x10')](_0x1679('0xc'),_0x271b5f,_0x40e83e);_0x3faf61(_0x40e83e);});});} \ No newline at end of file +var _0x9f24=['debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','AnalyticTreeReport,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','request\x20sent'];(function(_0x45bfde,_0x3a8f98){var _0x598a10=function(_0xad767a){while(--_0xad767a){_0x45bfde['push'](_0x45bfde['shift']());}};_0x598a10(++_0x3a8f98);}(_0x9f24,0x77));var _0x49f2=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9f24[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x49f2('0x0'));var util=require('util');var moment=require(_0x49f2('0x1'));var BPromise=require(_0x49f2('0x2'));var rs=require(_0x49f2('0x3'));var fs=require('fs');var Redis=require(_0x49f2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x49f2('0x5'));var logger=require(_0x49f2('0x6'))('rpc');var config=require(_0x49f2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x49f2('0x8')][_0x49f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7ad398,_0x54ea0d,_0xa4e2f1){return new BPromise(function(_0x455f97,_0x505f21){return client[_0x49f2('0xa')](_0x7ad398,_0xa4e2f1)['then'](function(_0x93ed13){logger[_0x49f2('0xb')]('AnalyticTreeReport,\x20%s,\x20%s',_0x54ea0d,_0x49f2('0xc'));logger[_0x49f2('0xd')](_0x49f2('0xe'),_0x54ea0d,_0x49f2('0xc'),JSON[_0x49f2('0xf')](_0x93ed13));if(_0x93ed13[_0x49f2('0x10')]){if(_0x93ed13['error'][_0x49f2('0x11')]===0x1f4){logger[_0x49f2('0x10')]('AnalyticTreeReport,\x20%s,\x20%s',_0x54ea0d,_0x93ed13['error']['message']);return _0x505f21(_0x93ed13['error'][_0x49f2('0x12')]);}logger[_0x49f2('0x10')]('AnalyticTreeReport,\x20%s,\x20%s',_0x54ea0d,_0x93ed13[_0x49f2('0x10')][_0x49f2('0x12')]);return _0x455f97(_0x93ed13[_0x49f2('0x10')][_0x49f2('0x12')]);}else{logger[_0x49f2('0xb')](_0x49f2('0x13'),_0x54ea0d,'request\x20sent');_0x455f97(_0x93ed13[_0x49f2('0x14')][_0x49f2('0x12')]);}})[_0x49f2('0x15')](function(_0x1939f0){logger['error'](_0x49f2('0x13'),_0x54ea0d,_0x1939f0);_0x505f21(_0x1939f0);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 9777a5e..07685f0 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 _0x225f=['index','/:id','show','post','put','update','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated'];(function(_0x44705e,_0x382814){var _0x32ece7=function(_0x16d713){while(--_0x16d713){_0x44705e['push'](_0x44705e['shift']());}};_0x32ece7(++_0x382814);}(_0x225f,0x116));var _0xf225=function(_0x3acac0,_0x57712d){_0x3acac0=_0x3acac0-0x0;var _0x431b2c=_0x225f[_0x3acac0];return _0x431b2c;};'use strict';var multer=require(_0xf225('0x0'));var util=require('util');var path=require(_0xf225('0x1'));var timeout=require(_0xf225('0x2'));var express=require('express');var router=express[_0xf225('0x3')]();var auth=require(_0xf225('0x4'));var interaction=require(_0xf225('0x5'));var config=require(_0xf225('0x6'));var controller=require(_0xf225('0x7'));router[_0xf225('0x8')]('/',auth[_0xf225('0x9')](),controller[_0xf225('0xa')]);router[_0xf225('0x8')](_0xf225('0xb'),auth[_0xf225('0x9')](),controller[_0xf225('0xc')]);router[_0xf225('0xd')]('/',auth[_0xf225('0x9')](),controller['create']);router[_0xf225('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xf225('0xf')]);router['delete'](_0xf225('0xb'),auth[_0xf225('0x9')](),controller[_0xf225('0x10')]);module[_0xf225('0x11')]=router; \ No newline at end of file +var _0xa3df=['destroy','path','connect-timeout','express','../../config/environment','./analyticTreeReport.controller','index','/:id','isAuthenticated','show','post','create','put','update','delete'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa3df,0x12d));var _0xfa3d=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa3df[_0x2160a9];return _0xa88cf7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfa3d('0x0'));var timeout=require(_0xfa3d('0x1'));var express=require(_0xfa3d('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfa3d('0x3'));var controller=require(_0xfa3d('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0xfa3d('0x5')]);router['get'](_0xfa3d('0x6'),auth[_0xfa3d('0x7')](),controller[_0xfa3d('0x8')]);router[_0xfa3d('0x9')]('/',auth[_0xfa3d('0x7')](),controller[_0xfa3d('0xa')]);router[_0xfa3d('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xfa3d('0xc')]);router[_0xfa3d('0xd')](_0xfa3d('0x6'),auth[_0xfa3d('0x7')](),controller[_0xfa3d('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index b7237b6..14d3387 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 _0xb17e=['sequelize','exports','STRING'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0xb17e,0x156));var _0xeb17=function(_0x39f347,_0x2b652d){_0x39f347=_0x39f347-0x0;var _0x30d56e=_0xb17e[_0x39f347];return _0x30d56e;};'use strict';var Sequelize=require(_0xeb17('0x0'));module[_0xeb17('0x1')]={'name':{'type':Sequelize[_0xeb17('0x2')]},'basename':{'type':Sequelize[_0xeb17('0x2')]},'type':{'type':Sequelize[_0xeb17('0x2')]}}; \ No newline at end of file +var _0x219e=['exports','STRING','sequelize'];(function(_0xaa964e,_0x375e0d){var _0x110dd3=function(_0x240e06){while(--_0x240e06){_0xaa964e['push'](_0xaa964e['shift']());}};_0x110dd3(++_0x375e0d);}(_0x219e,0xc8));var _0xe219=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x219e[_0x243b59];return _0x3e1676;};'use strict';var Sequelize=require(_0xe219('0x0'));module[_0xe219('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xe219('0x2')]},'type':{'type':Sequelize[_0xe219('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index fb791d5..3489a98 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 _0x2bc3=['show','intersection','options','find','body','catch','params','file','originalname','basename','filename','type','create','findOne','download','join','root','server/files/attachments/','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','status','json','count','offset','limit','set','Content-Range','apply','update','destroy','then','end','sendStatus','name','index','Attachment','rawAttributes','keys','query','dateStart','dateEnd','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','map','includeAll','include','findAll','rows'];(function(_0x103277,_0x15a2a2){var _0x45c58f=function(_0xd91f6c){while(--_0xd91f6c){_0x103277['push'](_0x103277['shift']());}};_0x45c58f(++_0x15a2a2);}(_0x2bc3,0xb4));var _0x32bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bc3[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x32bc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x32bc('0x1'));var jsonpatch=require(_0x32bc('0x2'));var rp=require(_0x32bc('0x3'));var moment=require('moment');var BPromise=require(_0x32bc('0x4'));var Mustache=require(_0x32bc('0x5'));var util=require(_0x32bc('0x6'));var path=require(_0x32bc('0x7'));var sox=require(_0x32bc('0x8'));var csv=require('to-csv');var ejs=require(_0x32bc('0x9'));var fs=require('fs');var _=require(_0x32bc('0xa'));var squel=require(_0x32bc('0xb'));var crypto=require(_0x32bc('0xc'));var jsforce=require(_0x32bc('0xd'));var deskjs=require(_0x32bc('0xe'));var toCsv=require(_0x32bc('0xf'));var querystring=require('querystring');var Papa=require(_0x32bc('0x10'));var Redis=require(_0x32bc('0x11'));var qs=require('../../components/parsers/qs');var logger=require(_0x32bc('0x12'))(_0x32bc('0x13'));var utils=require(_0x32bc('0x14'));var config=require(_0x32bc('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a37bb,_0x1ec131){_0x1ec131=_0x1ec131||0xcc;return function(_0x483e97){if(_0x483e97){return _0x3a37bb['sendStatus'](_0x1ec131);}return _0x3a37bb[_0x32bc('0x16')](_0x1ec131)['end']();};}function respondWithResult(_0x151a0f,_0x22bdfb){_0x22bdfb=_0x22bdfb||0xc8;return function(_0x461dae){if(_0x461dae){return _0x151a0f[_0x32bc('0x16')](_0x22bdfb)[_0x32bc('0x17')](_0x461dae);}};}function respondWithFilteredResult(_0x4d9f2b,_0x15e81a){return function(_0x3ba427){if(_0x3ba427){var _0x5dc9e1=_0x3ba427[_0x32bc('0x18')],_0x5d0f13=_0x15e81a['offset'],_0x5c266f=_0x15e81a[_0x32bc('0x19')]+_0x15e81a[_0x32bc('0x1a')],_0x558713;if(_0x5c266f>=_0x5dc9e1){_0x5c266f=_0x5dc9e1;_0x558713=0xc8;}else{_0x558713=0xce;}_0x4d9f2b['status'](_0x558713);return _0x4d9f2b[_0x32bc('0x1b')](_0x32bc('0x1c'),_0x5d0f13+'-'+_0x5c266f+'/'+_0x5dc9e1)['json'](_0x3ba427);}return null;};}function patchUpdates(_0x44f107){return function(_0x570e11){try{jsonpatch[_0x32bc('0x1d')](_0x570e11,_0x44f107,!![]);}catch(_0x4e5080){return BPromise['reject'](_0x4e5080);}return _0x570e11['save']();};}function saveUpdates(_0x33b708,_0x2a1965){return function(_0x30e4d5){if(_0x30e4d5){return _0x30e4d5[_0x32bc('0x1e')](_0x33b708)['then'](function(_0x48c79c){return _0x48c79c;});}return null;};}function removeEntity(_0x3ea841,_0x13b36e){return function(_0x41a4b4){if(_0x41a4b4){return _0x41a4b4[_0x32bc('0x1f')]()[_0x32bc('0x20')](function(){_0x3ea841[_0x32bc('0x16')](0xcc)[_0x32bc('0x21')]();});}};}function handleEntityNotFound(_0x31773f,_0x1d62ef){return function(_0x481d91){if(!_0x481d91){_0x31773f[_0x32bc('0x22')](0x194);}return _0x481d91;};}function handleError(_0x3e27ca,_0x27c9ef){_0x27c9ef=_0x27c9ef||0x1f4;return function(_0x41ffbe){logger['error'](_0x41ffbe['stack']);if(_0x41ffbe[_0x32bc('0x23')]){delete _0x41ffbe[_0x32bc('0x23')];}_0x3e27ca[_0x32bc('0x16')](_0x27c9ef)['send'](_0x41ffbe);};}exports[_0x32bc('0x24')]=function(_0x114131,_0x466ffb){var _0x567168={},_0x88935b={},_0x4cd491={'count':0x0,'rows':[]};var _0x392042=db[_0x32bc('0x25')][_0x32bc('0x26')];_0x88935b['model']=_[_0x32bc('0x27')](_0x392042);var _0x4d9652={'dateStart':_0x114131[_0x32bc('0x28')][_0x32bc('0x29')],'dateEnd':_0x114131[_0x32bc('0x28')][_0x32bc('0x2a')]};delete _0x114131[_0x32bc('0x28')][_0x32bc('0x29')];delete _0x114131['query'][_0x32bc('0x2a')];_0x88935b['query']=_[_0x32bc('0x27')](_0x114131['query']);_0x88935b[_0x32bc('0x2b')]=_['intersection'](_0x88935b[_0x32bc('0x2c')],_0x88935b['query']);_0x567168['attributes']=_['intersection'](_0x88935b['model'],qs[_0x32bc('0x2d')](_0x114131[_0x32bc('0x28')][_0x32bc('0x2d')]));_0x567168['attributes']=_0x567168[_0x32bc('0x2e')][_0x32bc('0x2f')]?_0x567168[_0x32bc('0x2e')]:_0x88935b[_0x32bc('0x2c')];if(!_0x114131['query'][_0x32bc('0x30')](_0x32bc('0x31'))){_0x567168[_0x32bc('0x1a')]=qs[_0x32bc('0x1a')](_0x114131[_0x32bc('0x28')][_0x32bc('0x1a')]);_0x567168[_0x32bc('0x19')]=qs[_0x32bc('0x19')](_0x114131[_0x32bc('0x28')][_0x32bc('0x19')]);}_0x567168[_0x32bc('0x32')]=qs[_0x32bc('0x33')](_0x114131[_0x32bc('0x28')][_0x32bc('0x33')]);_0x567168[_0x32bc('0x34')]=qs[_0x32bc('0x2b')](_[_0x32bc('0x35')](_0x114131[_0x32bc('0x28')],_0x88935b[_0x32bc('0x2b')]));if(_0x4d9652[_0x32bc('0x29')]){if(_0x4d9652['dateEnd']){_0x4d9652[_0x32bc('0x2a')]=moment(_0x4d9652[_0x32bc('0x2a')])[_0x32bc('0x36')](0x1,_0x32bc('0x37'));}else{_0x4d9652[_0x32bc('0x2a')]=moment(_0x4d9652['dateStart'])['add'](0x1,_0x32bc('0x37'));}_[_0x32bc('0x38')](_0x567168[_0x32bc('0x34')],{'createdAt':{'$gte':_0x4d9652['dateStart'],'$lte':_0x4d9652[_0x32bc('0x2a')]}});}if(_0x114131[_0x32bc('0x28')][_0x32bc('0x39')]){_0x567168['where']=_[_0x32bc('0x38')](_0x567168[_0x32bc('0x34')],{'$or':_[_0x32bc('0x3a')](_0x567168[_0x32bc('0x2e')],function(_0x4b939a){var _0x50267c={};_0x50267c[_0x4b939a]={'$like':'%'+_0x114131[_0x32bc('0x28')]['filter']+'%'};return _0x50267c;})});}_0x567168=_[_0x32bc('0x38')]({},_0x567168,_0x114131['options']);var _0x35e845={'where':_0x567168[_0x32bc('0x34')]};return db[_0x32bc('0x25')][_0x32bc('0x18')](_0x35e845)[_0x32bc('0x20')](function(_0x521fd3){_0x4cd491[_0x32bc('0x18')]=_0x521fd3;if(_0x114131[_0x32bc('0x28')][_0x32bc('0x3b')]){_0x567168[_0x32bc('0x3c')]=[{'all':!![]}];}return db[_0x32bc('0x25')][_0x32bc('0x3d')](_0x567168);})[_0x32bc('0x20')](function(_0x2280f8){_0x4cd491[_0x32bc('0x3e')]=_0x2280f8;return _0x4cd491;})[_0x32bc('0x20')](respondWithFilteredResult(_0x466ffb,_0x567168))['catch'](handleError(_0x466ffb,null));};exports[_0x32bc('0x3f')]=function(_0x38680b,_0x5b68fc){var _0x4a1d0c={'raw':!![],'where':{'id':_0x38680b['params']['id']}},_0x23dcec={};_0x23dcec[_0x32bc('0x2c')]=_['keys'](db['Attachment'][_0x32bc('0x26')]);_0x23dcec[_0x32bc('0x28')]=_['keys'](_0x38680b['query']);_0x23dcec[_0x32bc('0x2b')]=_['intersection'](_0x23dcec[_0x32bc('0x2c')],_0x23dcec[_0x32bc('0x28')]);_0x4a1d0c[_0x32bc('0x2e')]=_[_0x32bc('0x40')](_0x23dcec['model'],qs[_0x32bc('0x2d')](_0x38680b['query'][_0x32bc('0x2d')]));_0x4a1d0c[_0x32bc('0x2e')]=_0x4a1d0c[_0x32bc('0x2e')]['length']?_0x4a1d0c[_0x32bc('0x2e')]:_0x23dcec[_0x32bc('0x2c')];if(_0x38680b[_0x32bc('0x28')][_0x32bc('0x3b')]){_0x4a1d0c[_0x32bc('0x3c')]=[{'all':!![]}];}_0x4a1d0c=_[_0x32bc('0x38')]({},_0x4a1d0c,_0x38680b[_0x32bc('0x41')]);return db['Attachment'][_0x32bc('0x42')](_0x4a1d0c)['then'](handleEntityNotFound(_0x5b68fc,null))['then'](respondWithResult(_0x5b68fc,null))['catch'](handleError(_0x5b68fc,null));};exports['update']=function(_0x541c02,_0x20fcf5){if(_0x541c02[_0x32bc('0x43')]['id']){delete _0x541c02['body']['id'];}return db[_0x32bc('0x25')][_0x32bc('0x42')]({'where':{'id':_0x541c02['params']['id']}})['then'](handleEntityNotFound(_0x20fcf5,null))[_0x32bc('0x20')](saveUpdates(_0x541c02[_0x32bc('0x43')],null))['then'](respondWithResult(_0x20fcf5,null))[_0x32bc('0x44')](handleError(_0x20fcf5,null));};exports[_0x32bc('0x1f')]=function(_0x57e442,_0x4f5103){return db[_0x32bc('0x25')]['find']({'where':{'id':_0x57e442[_0x32bc('0x45')]['id']}})[_0x32bc('0x20')](handleEntityNotFound(_0x4f5103,null))['then'](removeEntity(_0x4f5103,null))[_0x32bc('0x44')](handleError(_0x4f5103,null));};exports['create']=function(_0x1fc6a9,_0x1399a4,_0x246d4d){_0x1fc6a9[_0x32bc('0x43')]['name']=_0x1fc6a9[_0x32bc('0x46')][_0x32bc('0x47')];_0x1fc6a9[_0x32bc('0x43')][_0x32bc('0x48')]=_0x1fc6a9[_0x32bc('0x46')][_0x32bc('0x49')];_0x1fc6a9['body'][_0x32bc('0x4a')]=_0x1fc6a9[_0x32bc('0x46')]['mimetype'];return db['Attachment'][_0x32bc('0x4b')](_0x1fc6a9[_0x32bc('0x43')])[_0x32bc('0x20')](respondWithResult(_0x1399a4,0xc9))[_0x32bc('0x44')](handleError(_0x1399a4,null));};exports['download']=function(_0x1e4b72,_0x1ea16c,_0x5bcad9){return db['Attachment'][_0x32bc('0x4c')]({'where':{'id':_0x1e4b72[_0x32bc('0x45')]['id']},'raw':!![]})[_0x32bc('0x20')](handleEntityNotFound(_0x1ea16c,null))[_0x32bc('0x20')](function(_0x23c5c1){if(_0x23c5c1){return _0x1ea16c[_0x32bc('0x4d')](path[_0x32bc('0x4e')](config[_0x32bc('0x4f')],_0x32bc('0x50'),_0x23c5c1[_0x32bc('0x48')]));}})['catch'](handleError(_0x1ea16c,null));}; \ No newline at end of file +var _0x730a=['send','index','Attachment','model','dateStart','query','dateEnd','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','day','filter','merge','map','options','includeAll','include','rows','catch','params','rawAttributes','find','body','create','file','originalname','basename','filename','type','mimetype','download','findOne','join','root','rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','update','then','error','stack','name'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x730a,0x73));var _0xa730=function(_0x428774,_0x383962){_0x428774=_0x428774-0x0;var _0x53a01c=_0x730a[_0x428774];return _0x53a01c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xa730('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa730('0x1'));var rp=require('request-promise');var moment=require(_0xa730('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xa730('0x3'));var util=require(_0xa730('0x4'));var path=require('path');var sox=require(_0xa730('0x5'));var csv=require(_0xa730('0x6'));var ejs=require(_0xa730('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa730('0x8'));var crypto=require(_0xa730('0x9'));var jsforce=require(_0xa730('0xa'));var deskjs=require(_0xa730('0xb'));var toCsv=require('to-csv');var querystring=require(_0xa730('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xa730('0xd'))(_0xa730('0xe'));var utils=require(_0xa730('0xf'));var config=require(_0xa730('0x10'));var db=require(_0xa730('0x11'))['db'];function respondWithStatusCode(_0x4801c8,_0x37a02a){_0x37a02a=_0x37a02a||0xcc;return function(_0x1dc028){if(_0x1dc028){return _0x4801c8[_0xa730('0x12')](_0x37a02a);}return _0x4801c8[_0xa730('0x13')](_0x37a02a)[_0xa730('0x14')]();};}function respondWithResult(_0x4b5ff2,_0x43b850){_0x43b850=_0x43b850||0xc8;return function(_0x2c6217){if(_0x2c6217){return _0x4b5ff2[_0xa730('0x13')](_0x43b850)['json'](_0x2c6217);}};}function respondWithFilteredResult(_0x1ea060,_0x583d8f){return function(_0x3d2788){if(_0x3d2788){var _0x33eda2=_0x3d2788[_0xa730('0x15')],_0x4d292d=_0x583d8f[_0xa730('0x16')],_0x4e634c=_0x583d8f['offset']+_0x583d8f[_0xa730('0x17')],_0x3a70c;if(_0x4e634c>=_0x33eda2){_0x4e634c=_0x33eda2;_0x3a70c=0xc8;}else{_0x3a70c=0xce;}_0x1ea060['status'](_0x3a70c);return _0x1ea060['set'](_0xa730('0x18'),_0x4d292d+'-'+_0x4e634c+'/'+_0x33eda2)[_0xa730('0x19')](_0x3d2788);}return null;};}function patchUpdates(_0x835363){return function(_0x267f40){try{jsonpatch[_0xa730('0x1a')](_0x267f40,_0x835363,!![]);}catch(_0x485a5d){return BPromise[_0xa730('0x1b')](_0x485a5d);}return _0x267f40['save']();};}function saveUpdates(_0x1e7992,_0x2dc3b7){return function(_0x12120b){if(_0x12120b){return _0x12120b[_0xa730('0x1c')](_0x1e7992)[_0xa730('0x1d')](function(_0x576e7f){return _0x576e7f;});}return null;};}function removeEntity(_0x6acda6,_0x15dc3c){return function(_0x16a2a2){if(_0x16a2a2){return _0x16a2a2['destroy']()['then'](function(){_0x6acda6[_0xa730('0x13')](0xcc)[_0xa730('0x14')]();});}};}function handleEntityNotFound(_0x1ce804,_0x333e39){return function(_0xa9858e){if(!_0xa9858e){_0x1ce804[_0xa730('0x12')](0x194);}return _0xa9858e;};}function handleError(_0x1f2af5,_0x5dd320){_0x5dd320=_0x5dd320||0x1f4;return function(_0x30a90f){logger[_0xa730('0x1e')](_0x30a90f[_0xa730('0x1f')]);if(_0x30a90f[_0xa730('0x20')]){delete _0x30a90f['name'];}_0x1f2af5[_0xa730('0x13')](_0x5dd320)[_0xa730('0x21')](_0x30a90f);};}exports[_0xa730('0x22')]=function(_0xb6cb82,_0x3946d3){var _0x164c7b={},_0x202e1c={},_0x531220={'count':0x0,'rows':[]};var _0x2d78fb=db[_0xa730('0x23')]['rawAttributes'];_0x202e1c[_0xa730('0x24')]=_['keys'](_0x2d78fb);var _0x49b63d={'dateStart':_0xb6cb82['query'][_0xa730('0x25')],'dateEnd':_0xb6cb82[_0xa730('0x26')][_0xa730('0x27')]};delete _0xb6cb82['query']['dateStart'];delete _0xb6cb82['query'][_0xa730('0x27')];_0x202e1c[_0xa730('0x26')]=_[_0xa730('0x28')](_0xb6cb82[_0xa730('0x26')]);_0x202e1c['filters']=_[_0xa730('0x29')](_0x202e1c[_0xa730('0x24')],_0x202e1c[_0xa730('0x26')]);_0x164c7b[_0xa730('0x2a')]=_[_0xa730('0x29')](_0x202e1c[_0xa730('0x24')],qs[_0xa730('0x2b')](_0xb6cb82[_0xa730('0x26')][_0xa730('0x2b')]));_0x164c7b[_0xa730('0x2a')]=_0x164c7b[_0xa730('0x2a')][_0xa730('0x2c')]?_0x164c7b[_0xa730('0x2a')]:_0x202e1c[_0xa730('0x24')];if(!_0xb6cb82[_0xa730('0x26')][_0xa730('0x2d')]('nolimit')){_0x164c7b[_0xa730('0x17')]=qs['limit'](_0xb6cb82[_0xa730('0x26')]['limit']);_0x164c7b['offset']=qs[_0xa730('0x16')](_0xb6cb82[_0xa730('0x26')][_0xa730('0x16')]);}_0x164c7b[_0xa730('0x2e')]=qs[_0xa730('0x2f')](_0xb6cb82[_0xa730('0x26')][_0xa730('0x2f')]);_0x164c7b[_0xa730('0x30')]=qs[_0xa730('0x31')](_['pick'](_0xb6cb82['query'],_0x202e1c[_0xa730('0x31')]));if(_0x49b63d[_0xa730('0x25')]){if(_0x49b63d['dateEnd']){_0x49b63d[_0xa730('0x27')]=moment(_0x49b63d[_0xa730('0x27')])['add'](0x1,_0xa730('0x32'));}else{_0x49b63d[_0xa730('0x27')]=moment(_0x49b63d['dateStart'])['add'](0x1,'day');}_['merge'](_0x164c7b['where'],{'createdAt':{'$gte':_0x49b63d[_0xa730('0x25')],'$lte':_0x49b63d[_0xa730('0x27')]}});}if(_0xb6cb82[_0xa730('0x26')][_0xa730('0x33')]){_0x164c7b['where']=_[_0xa730('0x34')](_0x164c7b[_0xa730('0x30')],{'$or':_[_0xa730('0x35')](_0x164c7b[_0xa730('0x2a')],function(_0x12f6f1){var _0x3eede5={};_0x3eede5[_0x12f6f1]={'$like':'%'+_0xb6cb82[_0xa730('0x26')][_0xa730('0x33')]+'%'};return _0x3eede5;})});}_0x164c7b=_['merge']({},_0x164c7b,_0xb6cb82[_0xa730('0x36')]);var _0x46de51={'where':_0x164c7b[_0xa730('0x30')]};return db[_0xa730('0x23')][_0xa730('0x15')](_0x46de51)[_0xa730('0x1d')](function(_0x40b96d){_0x531220[_0xa730('0x15')]=_0x40b96d;if(_0xb6cb82[_0xa730('0x26')][_0xa730('0x37')]){_0x164c7b[_0xa730('0x38')]=[{'all':!![]}];}return db[_0xa730('0x23')]['findAll'](_0x164c7b);})[_0xa730('0x1d')](function(_0x33d59f){_0x531220[_0xa730('0x39')]=_0x33d59f;return _0x531220;})[_0xa730('0x1d')](respondWithFilteredResult(_0x3946d3,_0x164c7b))[_0xa730('0x3a')](handleError(_0x3946d3,null));};exports['show']=function(_0x496598,_0x480698){var _0x12c25b={'raw':!![],'where':{'id':_0x496598[_0xa730('0x3b')]['id']}},_0x11cab6={};_0x11cab6[_0xa730('0x24')]=_['keys'](db[_0xa730('0x23')][_0xa730('0x3c')]);_0x11cab6['query']=_['keys'](_0x496598[_0xa730('0x26')]);_0x11cab6[_0xa730('0x31')]=_[_0xa730('0x29')](_0x11cab6['model'],_0x11cab6[_0xa730('0x26')]);_0x12c25b['attributes']=_[_0xa730('0x29')](_0x11cab6[_0xa730('0x24')],qs[_0xa730('0x2b')](_0x496598[_0xa730('0x26')][_0xa730('0x2b')]));_0x12c25b[_0xa730('0x2a')]=_0x12c25b[_0xa730('0x2a')][_0xa730('0x2c')]?_0x12c25b[_0xa730('0x2a')]:_0x11cab6[_0xa730('0x24')];if(_0x496598[_0xa730('0x26')][_0xa730('0x37')]){_0x12c25b[_0xa730('0x38')]=[{'all':!![]}];}_0x12c25b=_[_0xa730('0x34')]({},_0x12c25b,_0x496598[_0xa730('0x36')]);return db[_0xa730('0x23')][_0xa730('0x3d')](_0x12c25b)['then'](handleEntityNotFound(_0x480698,null))[_0xa730('0x1d')](respondWithResult(_0x480698,null))[_0xa730('0x3a')](handleError(_0x480698,null));};exports[_0xa730('0x1c')]=function(_0x40cb35,_0x142d5f){if(_0x40cb35[_0xa730('0x3e')]['id']){delete _0x40cb35[_0xa730('0x3e')]['id'];}return db['Attachment'][_0xa730('0x3d')]({'where':{'id':_0x40cb35['params']['id']}})[_0xa730('0x1d')](handleEntityNotFound(_0x142d5f,null))[_0xa730('0x1d')](saveUpdates(_0x40cb35['body'],null))[_0xa730('0x1d')](respondWithResult(_0x142d5f,null))[_0xa730('0x3a')](handleError(_0x142d5f,null));};exports['destroy']=function(_0x1c9da1,_0x5f3ff3){return db[_0xa730('0x23')][_0xa730('0x3d')]({'where':{'id':_0x1c9da1[_0xa730('0x3b')]['id']}})['then'](handleEntityNotFound(_0x5f3ff3,null))['then'](removeEntity(_0x5f3ff3,null))['catch'](handleError(_0x5f3ff3,null));};exports[_0xa730('0x3f')]=function(_0x5dd95c,_0x18cc1a,_0x20fdd6){_0x5dd95c['body']['name']=_0x5dd95c[_0xa730('0x40')][_0xa730('0x41')];_0x5dd95c['body'][_0xa730('0x42')]=_0x5dd95c[_0xa730('0x40')][_0xa730('0x43')];_0x5dd95c['body'][_0xa730('0x44')]=_0x5dd95c['file'][_0xa730('0x45')];return db['Attachment']['create'](_0x5dd95c[_0xa730('0x3e')])['then'](respondWithResult(_0x18cc1a,0xc9))[_0xa730('0x3a')](handleError(_0x18cc1a,null));};exports[_0xa730('0x46')]=function(_0x2c2a3a,_0x5b7cc3,_0x5ba565){return db[_0xa730('0x23')][_0xa730('0x47')]({'where':{'id':_0x2c2a3a[_0xa730('0x3b')]['id']},'raw':!![]})[_0xa730('0x1d')](handleEntityNotFound(_0x5b7cc3,null))[_0xa730('0x1d')](function(_0x15c05b){if(_0x15c05b){return _0x5b7cc3[_0xa730('0x46')](path[_0xa730('0x48')](config[_0xa730('0x49')],'server/files/attachments/',_0x15c05b['basename']));}})[_0xa730('0x3a')](handleError(_0x5b7cc3,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 8c763e9..2deb015 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 _0xe14b=['define','Attachment','attachments','lodash','util','moment','bluebird','./attachment.attributes'];(function(_0x303310,_0x3d6211){var _0x1e4370=function(_0x1d648){while(--_0x1d648){_0x303310['push'](_0x303310['shift']());}};_0x1e4370(++_0x3d6211);}(_0xe14b,0x93));var _0xbe14=function(_0x448cac,_0x58df4f){_0x448cac=_0x448cac-0x0;var _0x1877a1=_0xe14b[_0x448cac];return _0x1877a1;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var attributes=require(_0xbe14('0x4'));module['exports']=function(_0x496c04,_0x1833e3){return _0x496c04[_0xbe14('0x5')](_0xbe14('0x6'),attributes,{'tableName':_0xbe14('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b84=['moment','./attachment.attributes','exports','attachments','lodash','util'];(function(_0x4f4747,_0x3cc242){var _0x4a8bd1=function(_0xa393fd){while(--_0xa393fd){_0x4f4747['push'](_0x4f4747['shift']());}};_0x4a8bd1(++_0x3cc242);}(_0x4b84,0x1cc));var _0x44b8=function(_0x44d869,_0x49425f){_0x44d869=_0x44d869-0x0;var _0x1ed521=_0x4b84[_0x44d869];return _0x1ed521;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x44b8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x44b8('0x3'));module[_0x44b8('0x4')]=function(_0x39ad16,_0x5766b0){return _0x39ad16['define']('Attachment',attributes,{'tableName':_0x44b8('0x5'),'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 0c4c1a7..3113f2c 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 _0x109b=['request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','CreateAttachment','Attachment','create','body','options','raw','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s'];(function(_0x161b65,_0x240b5f){var _0x40f770=function(_0x41c83e){while(--_0x41c83e){_0x161b65['push'](_0x161b65['shift']());}};_0x40f770(++_0x240b5f);}(_0x109b,0x159));var _0xb109=function(_0x3fbba8,_0x28c96a){_0x3fbba8=_0x3fbba8-0x0;var _0x5342de=_0x109b[_0x3fbba8];return _0x5342de;};'use strict';var _=require(_0xb109('0x0'));var util=require('util');var moment=require(_0xb109('0x1'));var BPromise=require(_0xb109('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb109('0x3'))['db'];var utils=require(_0xb109('0x4'));var logger=require(_0xb109('0x5'))(_0xb109('0x6'));var config=require(_0xb109('0x7'));var jayson=require(_0xb109('0x8'));var client=jayson[_0xb109('0x9')][_0xb109('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e8844,_0x4cddaa,_0x5ab771){return new BPromise(function(_0x5d9d87,_0x42f9b5){return client[_0xb109('0xb')](_0x4e8844,_0x5ab771)[_0xb109('0xc')](function(_0xfe9ee0){logger[_0xb109('0xd')](_0xb109('0xe'),_0x4cddaa,_0xb109('0xf'));logger[_0xb109('0x10')](_0xb109('0x11'),_0x4cddaa,_0xb109('0xf'),JSON[_0xb109('0x12')](_0xfe9ee0));if(_0xfe9ee0['error']){if(_0xfe9ee0['error'][_0xb109('0x13')]===0x1f4){logger[_0xb109('0x14')](_0xb109('0xe'),_0x4cddaa,_0xfe9ee0[_0xb109('0x14')]['message']);return _0x42f9b5(_0xfe9ee0[_0xb109('0x14')][_0xb109('0x15')]);}logger[_0xb109('0x14')](_0xb109('0xe'),_0x4cddaa,_0xfe9ee0[_0xb109('0x14')]['message']);return _0x5d9d87(_0xfe9ee0[_0xb109('0x14')][_0xb109('0x15')]);}else{logger['info'](_0xb109('0xe'),_0x4cddaa,_0xb109('0xf'));_0x5d9d87(_0xfe9ee0[_0xb109('0x16')][_0xb109('0x15')]);}})['catch'](function(_0x161844){logger[_0xb109('0x14')](_0xb109('0xe'),_0x4cddaa,_0x161844);_0x42f9b5(_0x161844);});});}exports[_0xb109('0x17')]=function(_0xc8eb5e){var _0xa0b5d4=this;return new Promise(function(_0x2d867b,_0x52628a){return db[_0xb109('0x18')][_0xb109('0x19')](_0xc8eb5e[_0xb109('0x1a')],{'raw':_0xc8eb5e[_0xb109('0x1b')]?_0xc8eb5e['options'][_0xb109('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x411867){logger[_0xb109('0xd')](_0xb109('0x17'),_0xc8eb5e);logger[_0xb109('0x10')](_0xb109('0x17'),_0xc8eb5e,JSON[_0xb109('0x12')](_0x411867));_0x2d867b(_0x411867);})[_0xb109('0x1d')](function(_0x3fc9e9){logger[_0xb109('0x14')](_0xb109('0x17'),_0x3fc9e9[_0xb109('0x15')],_0xc8eb5e);_0x52628a(_0xa0b5d4[_0xb109('0x14')](0x1f4,_0x3fc9e9[_0xb109('0x15')]));});});}; \ No newline at end of file +var _0x242f=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateAttachment','Attachment','create','body','options','raw','then','lodash','util','moment'];(function(_0x31df91,_0x37f4a7){var _0x5ad8b8=function(_0x2c1803){while(--_0x2c1803){_0x31df91['push'](_0x31df91['shift']());}};_0x5ad8b8(++_0x37f4a7);}(_0x242f,0x129));var _0xf242=function(_0x3d4ee2,_0x47f0fe){_0x3d4ee2=_0x3d4ee2-0x0;var _0x3ef288=_0x242f[_0x3d4ee2];return _0x3ef288;};'use strict';var _=require(_0xf242('0x0'));var util=require(_0xf242('0x1'));var moment=require(_0xf242('0x2'));var BPromise=require('bluebird');var rs=require(_0xf242('0x3'));var fs=require('fs');var Redis=require(_0xf242('0x4'));var db=require(_0xf242('0x5'))['db'];var utils=require(_0xf242('0x6'));var logger=require(_0xf242('0x7'))(_0xf242('0x8'));var config=require(_0xf242('0x9'));var jayson=require(_0xf242('0xa'));var client=jayson[_0xf242('0xb')][_0xf242('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ccd51,_0xbe6e16,_0x3550a7){return new BPromise(function(_0x2a5cf7,_0x4716be){return client[_0xf242('0xd')](_0x2ccd51,_0x3550a7)['then'](function(_0x28c686){logger[_0xf242('0xe')](_0xf242('0xf'),_0xbe6e16,_0xf242('0x10'));logger[_0xf242('0x11')](_0xf242('0x12'),_0xbe6e16,_0xf242('0x10'),JSON[_0xf242('0x13')](_0x28c686));if(_0x28c686['error']){if(_0x28c686[_0xf242('0x14')]['code']===0x1f4){logger[_0xf242('0x14')](_0xf242('0xf'),_0xbe6e16,_0x28c686['error'][_0xf242('0x15')]);return _0x4716be(_0x28c686[_0xf242('0x14')]['message']);}logger[_0xf242('0x14')](_0xf242('0xf'),_0xbe6e16,_0x28c686['error'][_0xf242('0x15')]);return _0x2a5cf7(_0x28c686['error'][_0xf242('0x15')]);}else{logger[_0xf242('0xe')](_0xf242('0xf'),_0xbe6e16,_0xf242('0x10'));_0x2a5cf7(_0x28c686['result'][_0xf242('0x15')]);}})[_0xf242('0x16')](function(_0x4473a1){logger[_0xf242('0x14')](_0xf242('0xf'),_0xbe6e16,_0x4473a1);_0x4716be(_0x4473a1);});});}exports[_0xf242('0x17')]=function(_0x1ba576){var _0x17cdd5=this;return new Promise(function(_0x36f410,_0xf94998){return db[_0xf242('0x18')][_0xf242('0x19')](_0x1ba576[_0xf242('0x1a')],{'raw':_0x1ba576[_0xf242('0x1b')]?_0x1ba576[_0xf242('0x1b')][_0xf242('0x1c')]===undefined?!![]:![]:!![]})[_0xf242('0x1d')](function(_0x1c3a86){logger['info'](_0xf242('0x17'),_0x1ba576);logger['debug'](_0xf242('0x17'),_0x1ba576,JSON[_0xf242('0x13')](_0x1c3a86));_0x36f410(_0x1c3a86);})[_0xf242('0x16')](function(_0x4856b4){logger[_0xf242('0x14')](_0xf242('0x17'),_0x4856b4[_0xf242('0x15')],_0x1ba576);_0xf94998(_0x17cdd5[_0xf242('0x14')](0x1f4,_0x4856b4['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 48f6338..2eb5e63 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 _0xa62c=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','/:id','/:id/download','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','replace','post','single','update','delete','destroy','exports'];(function(_0x6362d0,_0x5400b4){var _0x19bbce=function(_0x5f2bd5){while(--_0x5f2bd5){_0x6362d0['push'](_0x6362d0['shift']());}};_0x19bbce(++_0x5400b4);}(_0xa62c,0x70));var _0xca62=function(_0x450689,_0x3b857c){_0x450689=_0x450689-0x0;var _0x46ffb0=_0xa62c[_0x450689];return _0x46ffb0;};'use strict';var multer=require(_0xca62('0x0'));var util=require(_0xca62('0x1'));var path=require(_0xca62('0x2'));var timeout=require(_0xca62('0x3'));var express=require(_0xca62('0x4'));var router=express[_0xca62('0x5')]();var auth=require(_0xca62('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xca62('0x7'));var controller=require(_0xca62('0x8'));router[_0xca62('0x9')]('/',auth[_0xca62('0xa')](),controller[_0xca62('0xb')]);router[_0xca62('0x9')](_0xca62('0xc'),auth[_0xca62('0xa')](),controller['show']);router[_0xca62('0x9')](_0xca62('0xd'),auth[_0xca62('0xa')](),controller['download']);var upload=multer({'storage':multer[_0xca62('0xe')]({'destination':function(_0x3dd26b,_0x254a7b,_0x5bcb2d){_0x5bcb2d(null,path[_0xca62('0xf')](config[_0xca62('0x10')],_0xca62('0x11')));},'filename':function(_0x27f861,_0x10d507,_0x3e3228){_0x3e3228(null,util[_0xca62('0x12')](_0xca62('0x13'),Date[_0xca62('0x14')](),_0x10d507['originalname'][_0xca62('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xca62('0x16')]('/',upload[_0xca62('0x17')]('file'),controller['create']);router['put'](_0xca62('0xc'),auth['isAuthenticated'](),controller[_0xca62('0x18')]);router[_0xca62('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xca62('0x1a')]);module[_0xca62('0x1b')]=router; \ No newline at end of file +var _0xc368=['file','create','put','delete','/:id','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./attachment.controller','get','isAuthenticated','index','show','/:id/download','download','join','server/files/attachments/','format','%s-%s','now','originalname','replace','post','single'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xc368,0x7b));var _0x8c36=function(_0x1e9cb1,_0x3f2992){_0x1e9cb1=_0x1e9cb1-0x0;var _0x54a7f3=_0xc368[_0x1e9cb1];return _0x54a7f3;};'use strict';var multer=require('multer');var util=require(_0x8c36('0x0'));var path=require('path');var timeout=require(_0x8c36('0x1'));var express=require(_0x8c36('0x2'));var router=express[_0x8c36('0x3')]();var auth=require(_0x8c36('0x4'));var interaction=require(_0x8c36('0x5'));var config=require('../../config/environment');var controller=require(_0x8c36('0x6'));router[_0x8c36('0x7')]('/',auth[_0x8c36('0x8')](),controller[_0x8c36('0x9')]);router['get']('/:id',auth[_0x8c36('0x8')](),controller[_0x8c36('0xa')]);router[_0x8c36('0x7')](_0x8c36('0xb'),auth[_0x8c36('0x8')](),controller[_0x8c36('0xc')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5bfbdd,_0x49f227,_0x116d25){_0x116d25(null,path[_0x8c36('0xd')](config['root'],_0x8c36('0xe')));},'filename':function(_0x1c49a0,_0x1d5c61,_0xe7857e){_0xe7857e(null,util[_0x8c36('0xf')](_0x8c36('0x10'),Date[_0x8c36('0x11')](),_0x1d5c61[_0x8c36('0x12')][_0x8c36('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8c36('0x14')]('/',upload[_0x8c36('0x15')](_0x8c36('0x16')),controller[_0x8c36('0x17')]);router[_0x8c36('0x18')]('/:id',auth[_0x8c36('0x8')](),controller['update']);router[_0x8c36('0x19')](_0x8c36('0x1a'),auth[_0x8c36('0x8')](),controller[_0x8c36('0x1b')]);module[_0x8c36('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 6331f6b..ef7f10a 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 _0xf156=['clientSecret','secret','callbackURL','find','emails','value','admin','user','agent','then','User\x20email\x20not\x20found!','catch','passport','passport-google-oauth20','../../mysqldb','../../components/auth/service','signToken','login','authenticate','google','/login','callback','use'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xf156,0x137));var _0x6f15=function(_0x1e3548,_0xf5c08f){_0x1e3548=_0x1e3548-0x0;var _0xfd85ea=_0xf156[_0x1e3548];return _0xfd85ea;};'use strict';var _=require('lodash');var passport=require(_0x6f15('0x0'));var GoogleStrategy=require(_0x6f15('0x1'))['Strategy'];var db=require(_0x6f15('0x2'))['db'];var config=require('../../config/environment');var signToken=require(_0x6f15('0x3'))[_0x6f15('0x4')];exports[_0x6f15('0x5')]=passport[_0x6f15('0x6')](_0x6f15('0x7'),{'failureRedirect':_0x6f15('0x8'),'scope':['profile','email'],'session':![]});exports[_0x6f15('0x9')]=passport[_0x6f15('0x6')]('google',{'failureRedirect':_0x6f15('0x8'),'session':![]});passport[_0x6f15('0xa')](new GoogleStrategy({'clientID':config[_0x6f15('0x7')]?config[_0x6f15('0x7')]['clientID']:'id','clientSecret':config['google']?config[_0x6f15('0x7')][_0x6f15('0xb')]:_0x6f15('0xc'),'callbackURL':config[_0x6f15('0x7')]?config[_0x6f15('0x7')][_0x6f15('0xd')]:''},function(_0x20f597,_0x32ddbc,_0x34ef4e,_0xcf3763){db['User'][_0x6f15('0xe')]({'where':{'email':_['map'](_0x34ef4e[_0x6f15('0xf')],_0x6f15('0x10')),'role':{'$or':[_0x6f15('0x11'),_0x6f15('0x12'),_0x6f15('0x13')]}}})[_0x6f15('0x14')](function(_0x18e040){if(_0x18e040){return _0xcf3763(null,_0x18e040);}_0xcf3763(_0x6f15('0x15'));})[_0x6f15('0x16')](function(_0xa01f0){_0xcf3763(_0xa01f0);});})); \ No newline at end of file +var _0x90ad=['admin','agent','then','User\x20email\x20not\x20found!','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb','../../components/auth/service','signToken','login','google','profile','email','authenticate','/login','clientSecret','secret','User','find','map','emails','value'];(function(_0x4645d8,_0x3c9308){var _0xee6582=function(_0x515123){while(--_0x515123){_0x4645d8['push'](_0x4645d8['shift']());}};_0xee6582(++_0x3c9308);}(_0x90ad,0x195));var _0xd90a=function(_0x56fe98,_0x43dc16){_0x56fe98=_0x56fe98-0x0;var _0x212f4f=_0x90ad[_0x56fe98];return _0x212f4f;};'use strict';var _=require(_0xd90a('0x0'));var passport=require(_0xd90a('0x1'));var GoogleStrategy=require(_0xd90a('0x2'))[_0xd90a('0x3')];var db=require(_0xd90a('0x4'))['db'];var config=require('../../config/environment');var signToken=require(_0xd90a('0x5'))[_0xd90a('0x6')];exports[_0xd90a('0x7')]=passport['authenticate'](_0xd90a('0x8'),{'failureRedirect':'/login','scope':[_0xd90a('0x9'),_0xd90a('0xa')],'session':![]});exports['callback']=passport[_0xd90a('0xb')](_0xd90a('0x8'),{'failureRedirect':_0xd90a('0xc'),'session':![]});passport['use'](new GoogleStrategy({'clientID':config['google']?config[_0xd90a('0x8')]['clientID']:'id','clientSecret':config['google']?config['google'][_0xd90a('0xd')]:_0xd90a('0xe'),'callbackURL':config[_0xd90a('0x8')]?config[_0xd90a('0x8')]['callbackURL']:''},function(_0x2815e8,_0x237659,_0x464def,_0x2f4ad2){db[_0xd90a('0xf')][_0xd90a('0x10')]({'where':{'email':_[_0xd90a('0x11')](_0x464def[_0xd90a('0x12')],_0xd90a('0x13')),'role':{'$or':[_0xd90a('0x14'),'user',_0xd90a('0x15')]}}})[_0xd90a('0x16')](function(_0x7c9d03){if(_0x7c9d03){return _0x2f4ad2(null,_0x7c9d03);}_0x2f4ad2(_0xd90a('0x17'));})[_0xd90a('0x18')](function(_0x182baa){_0x2f4ad2(_0x182baa);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index ab3b1ae..5664d91 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 _0x8776=['./authGoogle.controller','../../components/auth/service','setTokenCookie','get','/callback','exports','express'];(function(_0x190417,_0x54dc0d){var _0x110e9c=function(_0x517b86){while(--_0x517b86){_0x190417['push'](_0x190417['shift']());}};_0x110e9c(++_0x54dc0d);}(_0x8776,0x15d));var _0x6877=function(_0x3cf206,_0x1e428b){_0x3cf206=_0x3cf206-0x0;var _0x23e885=_0x8776[_0x3cf206];return _0x23e885;};'use strict';var express=require(_0x6877('0x0'));var passport=require('passport');var router=express['Router']();var controller=require(_0x6877('0x1'));var setTokenCookie=require(_0x6877('0x2'))[_0x6877('0x3')];router[_0x6877('0x4')]('/',controller['login']);router[_0x6877('0x4')](_0x6877('0x5'),controller['callback'],setTokenCookie);module[_0x6877('0x6')]=router; \ No newline at end of file +var _0xff1e=['get','login','/callback','exports','express','passport','Router','./authGoogle.controller','setTokenCookie'];(function(_0x104f22,_0x4e0e5c){var _0x4cfba4=function(_0x289cee){while(--_0x289cee){_0x104f22['push'](_0x104f22['shift']());}};_0x4cfba4(++_0x4e0e5c);}(_0xff1e,0x94));var _0xeff1=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0xff1e[_0x3b5ad9];return _0x611ae9;};'use strict';var express=require(_0xeff1('0x0'));var passport=require(_0xeff1('0x1'));var router=express[_0xeff1('0x2')]();var controller=require(_0xeff1('0x3'));var setTokenCookie=require('../../components/auth/service')[_0xeff1('0x4')];router[_0xeff1('0x5')]('/',controller[_0xeff1('0x6')]);router[_0xeff1('0x5')](_0xeff1('0x7'),controller['callback'],setTokenCookie);module[_0xeff1('0x8')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index e57c158..71a2876 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 _0x8205=['host','port','secure','authentication','auth','pass','\x22%s\x22\x20<%s>','SendMail','error','format','message','stringify','status','send','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','body','Email\x20parameter\x20is\x20missing','generate','trim','This\x20email\x20is\x20not\x20registered.','resetPasswordToken','resetPasswordExpires','now','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','http://','headers','/reset/','catch','reset','User','token','password','save','Password\x20reset!','use','passport-local','Strategy','jayson/promise','lodash','api','../../mysqldb','../../components/auth/service','signToken','role','agent','count','then','../../config/license/util','agents','Maximum\x20login\x20has\x20been\x20reached','find','admin','user','name','This\x20name\x20is\x20not\x20registered','authenticate','MailAccount','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service'];(function(_0x5064d1,_0x490866){var _0x5717c5=function(_0x1fc197){while(--_0x1fc197){_0x5064d1['push'](_0x5064d1['shift']());}};_0x5717c5(++_0x490866);}(_0x8205,0x12f));var _0x5820=function(_0x121668,_0xe21d8c){_0x121668=_0x121668-0x0;var _0x5c4754=_0x8205[_0x121668];return _0x5c4754;};'use strict';var util=require('util');var passport=require('passport');var LocalStrategy=require(_0x5820('0x0'))[_0x5820('0x1')];var BPromise=require('bluebird');var jayson=require(_0x5820('0x2'));var _=require(_0x5820('0x3'));var logger=require('../../config/logger')(_0x5820('0x4'));var rs=require('randomstring');var db=require(_0x5820('0x5'))['db'];var signToken=require(_0x5820('0x6'))[_0x5820('0x7')];var client=jayson['client']['http']({'port':0x232b});var getLicense=function(_0x3612e3){return new BPromise(function(_0x23efcd,_0x2fbfba){var _0x2f4bf6=0x0;_0x3612e3[_0x5820('0x8')]!==_0x5820('0x9')&&_0x23efcd(_0x3612e3);return db['User'][_0x5820('0xa')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x3612e3['id']}}})[_0x5820('0xb')](function(_0x28a9bd){_0x2f4bf6=_0x28a9bd;return require(_0x5820('0xc'))['getLicense']();})[_0x5820('0xb')](function(_0x25e781){if(_0x25e781&&_0x25e781[_0x5820('0xd')]&&_0x2f4bf6>=_0x25e781[_0x5820('0xd')]){return _0x2fbfba({'message':_0x5820('0xe')});}return _0x23efcd(_0x3612e3);})['catch'](function(_0x939c12){return _0x2fbfba(_0x939c12);});});};function localAuthenticate(_0x2448a5,_0x3edccc,_0x3a7464,_0x5213bd){_0x2448a5[_0x5820('0xf')]({'where':{'name':_0x3edccc,'role':{'$or':[_0x5820('0x10'),_0x5820('0x11'),_0x5820('0x9')]}}})[_0x5820('0xb')](function(_0x5d279c){if(!_0x5d279c||_0x5d279c&&_0x5d279c[_0x5820('0x12')]!==_0x3edccc){return _0x5213bd(null,![],{'message':_0x5820('0x13')});}return getLicense(_0x5d279c);})['then'](function(_0x3cfe90){_0x3cfe90[_0x5820('0x14')](_0x3a7464,function(_0x11dfae,_0x25eea1){if(_0x11dfae){return _0x5213bd(_0x11dfae);}if(!_0x25eea1){return _0x5213bd(null,![],{'message':'This\x20password\x20is\x20not\x20correct'});}else{return _0x5213bd(null,_0x3cfe90);}});})['catch'](function(_0x219130){_0x5213bd(_0x219130);});}function sendServiceMail(_0x40c718){return db[_0x5820('0x15')][_0x5820('0xf')]({'where':{'service':!![]},'attributes':['id',_0x5820('0x12'),_0x5820('0x16')],'include':[{'model':db[_0x5820('0x17')],'as':_0x5820('0x18')}]})[_0x5820('0xb')](function(_0x2ed5cc){if(!_0x2ed5cc){throw new Error(_0x5820('0x19'));}var _0x44ab73={'tls':{'rejectUnauthorized':![]}};if(_0x2ed5cc[_0x5820('0x18')][_0x5820('0x1a')]){_0x44ab73[_0x5820('0x1a')]=_0x2ed5cc['Smtp'][_0x5820('0x1a')];}else{_0x44ab73['host']=_0x2ed5cc['Smtp'][_0x5820('0x1b')];_0x44ab73[_0x5820('0x1c')]=_0x2ed5cc[_0x5820('0x18')][_0x5820('0x1c')];_0x44ab73[_0x5820('0x1d')]=_0x2ed5cc[_0x5820('0x18')]['secure'];}if(_0x2ed5cc[_0x5820('0x18')][_0x5820('0x1e')]){_0x44ab73[_0x5820('0x1f')]={'user':_0x2ed5cc[_0x5820('0x18')][_0x5820('0x11')],'pass':_0x2ed5cc[_0x5820('0x18')][_0x5820('0x20')]};}var _0xda177c={'account':_0x44ab73,'message':_['merge']({'from':util['format'](_0x5820('0x21'),_0x2ed5cc[_0x5820('0x12')],_0x2ed5cc[_0x5820('0x16')]||_0x2ed5cc[_0x5820('0x18')][_0x5820('0x11')])},_0x40c718)};return client['request'](_0x5820('0x22'),_0xda177c);})['then'](function(_0x14168c){if(_0x14168c[_0x5820('0x23')]){throw new Error(util[_0x5820('0x24')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x14168c['error'][_0x5820('0x25')]||JSON[_0x5820('0x26')](_0x14168c[_0x5820('0x23')])));}return!![];});}function handleError(_0x4b9064,_0x578314,_0x1720c2){return _0x4b9064[_0x5820('0x27')](_0x578314||0x1f4)[_0x5820('0x28')]({'message':_0x1720c2?_0x1720c2[_0x5820('0x25')]||_0x1720c2:''});}exports[_0x5820('0x29')]=function(_0x42d1c2,_0x4fe46b,_0x2c2df7){passport[_0x5820('0x14')](_0x5820('0x2a'),function(_0x3f445b,_0x38e8b1,_0xf7249){var _0x443abc=_0x3f445b||_0xf7249;if(_0x443abc){return handleError(_0x4fe46b,0x191,_0x443abc);}if(!_0x38e8b1){return handleError(_0x4fe46b,0x194,{'message':_0x5820('0x2b')});}var _0x2bcca9=signToken(_0x38e8b1['id'],_0x38e8b1[_0x5820('0x8')]);_0x4fe46b[_0x5820('0x2c')]({'id':_0x38e8b1['id'],'token':_0x2bcca9,'statusCall':'','isAlreadyLogged':_0x38e8b1[_0x5820('0x2d')]});})(_0x42d1c2,_0x4fe46b,_0x2c2df7);};exports['forgot']=function(_0x4f3c0b,_0x20b5fc,_0x86da7b){if(!_0x4f3c0b[_0x5820('0x2e')][_0x5820('0x16')]){return handleError(_0x20b5fc,0x1f4,{'message':_0x5820('0x2f')});}var _0x240b9c=rs[_0x5820('0x30')]();_0x4f3c0b[_0x5820('0x2e')]['email']=_0x4f3c0b['body']['email'][_0x5820('0x31')]()['toLowerCase']();return db['User'][_0x5820('0xf')]({'where':{'email':_0x4f3c0b[_0x5820('0x2e')][_0x5820('0x16')]}})[_0x5820('0xb')](function(_0x387f3b){if(!_0x387f3b){throw new Error(_0x5820('0x32'));}_0x387f3b[_0x5820('0x33')]=_0x240b9c;_0x387f3b[_0x5820('0x34')]=Date[_0x5820('0x35')]()+0x36ee80;return _0x387f3b['save']();})[_0x5820('0xb')](function(){return sendServiceMail({'to':_0x4f3c0b[_0x5820('0x2e')]['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x5820('0x36')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x5820('0x37')+_0x4f3c0b[_0x5820('0x38')][_0x5820('0x1b')]+_0x5820('0x39')+_0x240b9c+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x5820('0xb')](function(){_0x20b5fc[_0x5820('0x27')](0xc8)['send']({'message':'Reset\x20Email\x20sent!'});})[_0x5820('0x3a')](function(_0x12c3a5){return handleError(_0x20b5fc,0x1f4,_0x12c3a5);});};exports[_0x5820('0x3b')]=function(_0x3f3b34,_0x3ff727,_0x43be46){return db[_0x5820('0x3c')][_0x5820('0xf')]({'where':{'resetPasswordToken':_0x3f3b34['params'][_0x5820('0x3d')],'resetPasswordExpires':{'$gt':Date[_0x5820('0x35')]()}}})[_0x5820('0xb')](function(_0x3498e0){if(!_0x3498e0){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}_0x3498e0[_0x5820('0x3e')]=_0x3f3b34[_0x5820('0x2e')][_0x5820('0x3e')];_0x3498e0['resetPasswordToken']=null;_0x3498e0['resetPasswordExpires']=null;return _0x3498e0[_0x5820('0x3f')]();})[_0x5820('0xb')](function(){_0x3ff727[_0x5820('0x27')](0xc8)[_0x5820('0x28')]({'message':_0x5820('0x40')});})[_0x5820('0x3a')](function(_0x517789){return handleError(_0x3ff727,0x1f4,_0x517789);});};passport[_0x5820('0x41')](new LocalStrategy({'usernameField':_0x5820('0x12'),'passwordField':_0x5820('0x3e')},function(_0xb0c475,_0x29ab5d,_0x1d6a14){return localAuthenticate(db['User'],_0xb0c475,_0x29ab5d,_0x1d6a14);})); \ No newline at end of file +var _0x56f8=['message','stringify','status','send','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','resetPasswordExpires','now','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','http://','headers','/reset/','Reset\x20Email\x20sent!','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','password','resetPasswordToken','save','Password\x20reset!','use','util','passport','passport-local','Strategy','bluebird','lodash','../../config/logger','api','randomstring','../../mysqldb','../../components/auth/service','signToken','client','http','agent','count','../../config/license/util','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','find','admin','name','This\x20name\x20is\x20not\x20registered','authenticate','This\x20password\x20is\x20not\x20correct','MailAccount','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','user','pass','merge','\x22%s\x22\x20<%s>','request','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!'];(function(_0x55cc1f,_0x278003){var _0x23ed31=function(_0x667f81){while(--_0x667f81){_0x55cc1f['push'](_0x55cc1f['shift']());}};_0x23ed31(++_0x278003);}(_0x56f8,0x1a0));var _0x856f=function(_0x2e3f4e,_0x11d821){_0x2e3f4e=_0x2e3f4e-0x0;var _0xda3988=_0x56f8[_0x2e3f4e];return _0xda3988;};'use strict';var util=require(_0x856f('0x0'));var passport=require(_0x856f('0x1'));var LocalStrategy=require(_0x856f('0x2'))[_0x856f('0x3')];var BPromise=require(_0x856f('0x4'));var jayson=require('jayson/promise');var _=require(_0x856f('0x5'));var logger=require(_0x856f('0x6'))(_0x856f('0x7'));var rs=require(_0x856f('0x8'));var db=require(_0x856f('0x9'))['db'];var signToken=require(_0x856f('0xa'))[_0x856f('0xb')];var client=jayson[_0x856f('0xc')][_0x856f('0xd')]({'port':0x232b});var getLicense=function(_0x24cc3a){return new BPromise(function(_0x49505f,_0x415b93){var _0x275f35=0x0;_0x24cc3a['role']!==_0x856f('0xe')&&_0x49505f(_0x24cc3a);return db['User'][_0x856f('0xf')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x24cc3a['id']}}})['then'](function(_0x516c93){_0x275f35=_0x516c93;return require(_0x856f('0x10'))['getLicense']();})[_0x856f('0x11')](function(_0x2b2352){if(_0x2b2352&&_0x2b2352[_0x856f('0x12')]&&_0x275f35>=_0x2b2352[_0x856f('0x12')]){return _0x415b93({'message':_0x856f('0x13')});}return _0x49505f(_0x24cc3a);})[_0x856f('0x14')](function(_0x55f9c1){return _0x415b93(_0x55f9c1);});});};function localAuthenticate(_0x2d9fcb,_0x1e3f6d,_0x45825e,_0x4644ea){_0x2d9fcb[_0x856f('0x15')]({'where':{'name':_0x1e3f6d,'role':{'$or':[_0x856f('0x16'),'user',_0x856f('0xe')]}}})[_0x856f('0x11')](function(_0x144a2e){if(!_0x144a2e||_0x144a2e&&_0x144a2e[_0x856f('0x17')]!==_0x1e3f6d){return _0x4644ea(null,![],{'message':_0x856f('0x18')});}return getLicense(_0x144a2e);})[_0x856f('0x11')](function(_0x34b4b8){_0x34b4b8[_0x856f('0x19')](_0x45825e,function(_0x22043a,_0x57be08){if(_0x22043a){return _0x4644ea(_0x22043a);}if(!_0x57be08){return _0x4644ea(null,![],{'message':_0x856f('0x1a')});}else{return _0x4644ea(null,_0x34b4b8);}});})['catch'](function(_0x49843a){_0x4644ea(_0x49843a);});}function sendServiceMail(_0x54f579){return db[_0x856f('0x1b')]['find']({'where':{'service':!![]},'attributes':['id',_0x856f('0x17'),_0x856f('0x1c')],'include':[{'model':db[_0x856f('0x1d')],'as':_0x856f('0x1e')}]})['then'](function(_0xbf70f8){if(!_0xbf70f8){throw new Error(_0x856f('0x1f'));}var _0x2c3fe2={'tls':{'rejectUnauthorized':![]}};if(_0xbf70f8[_0x856f('0x1e')]['service']){_0x2c3fe2[_0x856f('0x20')]=_0xbf70f8[_0x856f('0x1e')][_0x856f('0x20')];}else{_0x2c3fe2[_0x856f('0x21')]=_0xbf70f8[_0x856f('0x1e')][_0x856f('0x21')];_0x2c3fe2[_0x856f('0x22')]=_0xbf70f8[_0x856f('0x1e')]['port'];_0x2c3fe2[_0x856f('0x23')]=_0xbf70f8['Smtp'][_0x856f('0x23')];}if(_0xbf70f8[_0x856f('0x1e')][_0x856f('0x24')]){_0x2c3fe2[_0x856f('0x25')]={'user':_0xbf70f8[_0x856f('0x1e')][_0x856f('0x26')],'pass':_0xbf70f8[_0x856f('0x1e')][_0x856f('0x27')]};}var _0x5265ce={'account':_0x2c3fe2,'message':_[_0x856f('0x28')]({'from':util['format'](_0x856f('0x29'),_0xbf70f8[_0x856f('0x17')],_0xbf70f8['email']||_0xbf70f8[_0x856f('0x1e')][_0x856f('0x26')])},_0x54f579)};return client[_0x856f('0x2a')]('SendMail',_0x5265ce);})[_0x856f('0x11')](function(_0x133931){if(_0x133931[_0x856f('0x2b')]){throw new Error(util[_0x856f('0x2c')](_0x856f('0x2d'),_0x133931[_0x856f('0x2b')][_0x856f('0x2e')]||JSON[_0x856f('0x2f')](_0x133931[_0x856f('0x2b')])));}return!![];});}function handleError(_0x9bc33d,_0x49d26c,_0x324edc){return _0x9bc33d[_0x856f('0x30')](_0x49d26c||0x1f4)[_0x856f('0x31')]({'message':_0x324edc?_0x324edc[_0x856f('0x2e')]||_0x324edc:''});}exports['login']=function(_0x4c590d,_0x1748cd,_0x538658){passport[_0x856f('0x19')](_0x856f('0x32'),function(_0x4b0301,_0x3386e7,_0x4c2819){var _0x89ca0a=_0x4b0301||_0x4c2819;if(_0x89ca0a){return handleError(_0x1748cd,0x191,_0x89ca0a);}if(!_0x3386e7){return handleError(_0x1748cd,0x194,{'message':_0x856f('0x33')});}var _0x9d1103=signToken(_0x3386e7['id'],_0x3386e7[_0x856f('0x34')]);_0x1748cd['json']({'id':_0x3386e7['id'],'token':_0x9d1103,'statusCall':'','isAlreadyLogged':_0x3386e7[_0x856f('0x35')]});})(_0x4c590d,_0x1748cd,_0x538658);};exports[_0x856f('0x36')]=function(_0xb75443,_0x74ce06,_0x4a1d3a){if(!_0xb75443['body'][_0x856f('0x1c')]){return handleError(_0x74ce06,0x1f4,{'message':_0x856f('0x37')});}var _0x168e60=rs[_0x856f('0x38')]();_0xb75443['body'][_0x856f('0x1c')]=_0xb75443[_0x856f('0x39')]['email']['trim']()[_0x856f('0x3a')]();return db[_0x856f('0x3b')][_0x856f('0x15')]({'where':{'email':_0xb75443[_0x856f('0x39')][_0x856f('0x1c')]}})[_0x856f('0x11')](function(_0x3eb796){if(!_0x3eb796){throw new Error(_0x856f('0x3c'));}_0x3eb796['resetPasswordToken']=_0x168e60;_0x3eb796[_0x856f('0x3d')]=Date[_0x856f('0x3e')]()+0x36ee80;return _0x3eb796['save']();})['then'](function(){return sendServiceMail({'to':_0xb75443[_0x856f('0x39')][_0x856f('0x1c')],'subject':_0x856f('0x3f'),'text':_0x856f('0x40')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x856f('0x41')+_0xb75443[_0x856f('0x42')][_0x856f('0x21')]+_0x856f('0x43')+_0x168e60+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x856f('0x11')](function(){_0x74ce06[_0x856f('0x30')](0xc8)[_0x856f('0x31')]({'message':_0x856f('0x44')});})['catch'](function(_0x3324b5){return handleError(_0x74ce06,0x1f4,_0x3324b5);});};exports[_0x856f('0x45')]=function(_0x2c755c,_0x194151,_0x204bce){return db[_0x856f('0x3b')]['find']({'where':{'resetPasswordToken':_0x2c755c[_0x856f('0x46')]['token'],'resetPasswordExpires':{'$gt':Date[_0x856f('0x3e')]()}}})['then'](function(_0x32434f){if(!_0x32434f){throw new Error(_0x856f('0x47'));}_0x32434f['password']=_0x2c755c[_0x856f('0x39')][_0x856f('0x48')];_0x32434f[_0x856f('0x49')]=null;_0x32434f[_0x856f('0x3d')]=null;return _0x32434f[_0x856f('0x4a')]();})[_0x856f('0x11')](function(){_0x194151[_0x856f('0x30')](0xc8)[_0x856f('0x31')]({'message':_0x856f('0x4b')});})[_0x856f('0x14')](function(_0x36ed81){return handleError(_0x194151,0x1f4,_0x36ed81);});};passport[_0x856f('0x4c')](new LocalStrategy({'usernameField':_0x856f('0x17'),'passwordField':'password'},function(_0x275207,_0x186725,_0x21fbda){return localAuthenticate(db[_0x856f('0x3b')],_0x275207,_0x186725,_0x21fbda);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 63b549a..db6e4df 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 _0x8cb5=['exports','express','./authLocal.controller','post','login','/forgot','forgot','/reset/:token','reset'];(function(_0x4c208b,_0x4ec762){var _0x30ce72=function(_0x42583b){while(--_0x42583b){_0x4c208b['push'](_0x4c208b['shift']());}};_0x30ce72(++_0x4ec762);}(_0x8cb5,0x196));var _0x58cb=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x8cb5[_0x432682];return _0x463d05;};'use strict';var express=require(_0x58cb('0x0'));var router=express['Router']();var controller=require(_0x58cb('0x1'));router[_0x58cb('0x2')]('/',controller[_0x58cb('0x3')]);router[_0x58cb('0x2')](_0x58cb('0x4'),controller[_0x58cb('0x5')]);router['post'](_0x58cb('0x6'),controller[_0x58cb('0x7')]);module[_0x58cb('0x8')]=router; \ No newline at end of file +var _0x8a90=['express','Router','./authLocal.controller','post','login','/reset/:token','reset','exports'];(function(_0x2e06eb,_0x3f131c){var _0x5e56a0=function(_0x416050){while(--_0x416050){_0x2e06eb['push'](_0x2e06eb['shift']());}};_0x5e56a0(++_0x3f131c);}(_0x8a90,0x138));var _0x08a9=function(_0x380d03,_0x52a740){_0x380d03=_0x380d03-0x0;var _0x26edf0=_0x8a90[_0x380d03];return _0x26edf0;};'use strict';var express=require(_0x08a9('0x0'));var router=express[_0x08a9('0x1')]();var controller=require(_0x08a9('0x2'));router[_0x08a9('0x3')]('/',controller[_0x08a9('0x4')]);router['post']('/forgot',controller['forgot']);router[_0x08a9('0x3')](_0x08a9('0x5'),controller[_0x08a9('0x6')]);module[_0x08a9('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 2227c74..09d8fe9 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 _0x3c32=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x293bff,_0x4a9dc6){var _0x23572a=function(_0x2b6191){while(--_0x2b6191){_0x293bff['push'](_0x293bff['shift']());}};_0x23572a(++_0x4a9dc6);}(_0x3c32,0x161));var _0x23c3=function(_0x58f9ec,_0x46e2bb){_0x58f9ec=_0x58f9ec-0x0;var _0x4fd007=_0x3c32[_0x58f9ec];return _0x4fd007;};'use strict';var Sequelize=require(_0x23c3('0x0'));module[_0x23c3('0x1')]={'name':{'type':Sequelize[_0x23c3('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x23c3('0x2')]},'status':{'type':Sequelize[_0x23c3('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x23c3('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0xdd6e=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x150e9d,_0x1807db){var _0x54ff86=function(_0x486c05){while(--_0x486c05){_0x150e9d['push'](_0x150e9d['shift']());}};_0x54ff86(++_0x1807db);}(_0xdd6e,0xa5));var _0xedd6=function(_0x1e5d75,_0x4ca85e){_0x1e5d75=_0x1e5d75-0x0;var _0x1e19ba=_0xdd6e[_0x1e5d75];return _0x1e19ba;};'use strict';var Sequelize=require(_0xedd6('0x0'));module[_0xedd6('0x1')]={'name':{'type':Sequelize[_0xedd6('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xedd6('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xedd6('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xedd6('0x4')],'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 2e678f2..c453623 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 _0x71e2=['addConditions','Condition','ids','omit','getConditions','findOne','map','hasOwnProperty','addActions','Action','getActions','eml-format','rimraf','zip-dir','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../config/logger','api','../../config/utils','status','end','count','offset','limit','set','Content-Range','save','update','destroy','sendStatus','stack','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','fields','length','nolimit','order','sort','where','pick','add','day','merge','filter','options','Automation','then','includeAll','include','rows','catch','show','intersection','find','create','body','params'];(function(_0x4d7379,_0x4b4e63){var _0x46d7cf=function(_0x53f5f0){while(--_0x53f5f0){_0x4d7379['push'](_0x4d7379['shift']());}};_0x46d7cf(++_0x4b4e63);}(_0x71e2,0x1d9));var _0x271e=function(_0x18eaaa,_0x4e1562){_0x18eaaa=_0x18eaaa-0x0;var _0x18e4fd=_0x71e2[_0x18eaaa];return _0x18e4fd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x271e('0x0'));var rimraf=require(_0x271e('0x1'));var zipdir=require(_0x271e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x271e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x271e('0x4'));var util=require('util');var path=require(_0x271e('0x5'));var sox=require(_0x271e('0x6'));var csv=require(_0x271e('0x7'));var ejs=require(_0x271e('0x8'));var fs=require('fs');var _=require(_0x271e('0x9'));var squel=require(_0x271e('0xa'));var crypto=require(_0x271e('0xb'));var jsforce=require(_0x271e('0xc'));var deskjs=require(_0x271e('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x271e('0xe'));var Redis=require(_0x271e('0xf'));var qs=require('../../components/parsers/qs');var logger=require(_0x271e('0x10'))(_0x271e('0x11'));var utils=require(_0x271e('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a5d52,_0x26f0de){_0x26f0de=_0x26f0de||0xcc;return function(_0x317127){if(_0x317127){return _0x5a5d52['sendStatus'](_0x26f0de);}return _0x5a5d52[_0x271e('0x13')](_0x26f0de)[_0x271e('0x14')]();};}function respondWithResult(_0x34f621,_0x5d9aaa){_0x5d9aaa=_0x5d9aaa||0xc8;return function(_0x171d29){if(_0x171d29){return _0x34f621[_0x271e('0x13')](_0x5d9aaa)['json'](_0x171d29);}};}function respondWithFilteredResult(_0x3a1334,_0x46c30d){return function(_0x422d6e){if(_0x422d6e){var _0x5ed50c=_0x422d6e[_0x271e('0x15')],_0x1ae8ec=_0x46c30d[_0x271e('0x16')],_0x375bff=_0x46c30d[_0x271e('0x16')]+_0x46c30d[_0x271e('0x17')],_0x163e00;if(_0x375bff>=_0x5ed50c){_0x375bff=_0x5ed50c;_0x163e00=0xc8;}else{_0x163e00=0xce;}_0x3a1334[_0x271e('0x13')](_0x163e00);return _0x3a1334[_0x271e('0x18')](_0x271e('0x19'),_0x1ae8ec+'-'+_0x375bff+'/'+_0x5ed50c)['json'](_0x422d6e);}return null;};}function patchUpdates(_0x1dbec2){return function(_0x5d17de){try{jsonpatch['apply'](_0x5d17de,_0x1dbec2,!![]);}catch(_0x10fa8e){return BPromise['reject'](_0x10fa8e);}return _0x5d17de[_0x271e('0x1a')]();};}function saveUpdates(_0x438909,_0x5ee115){return function(_0x2da26d){if(_0x2da26d){return _0x2da26d[_0x271e('0x1b')](_0x438909)['then'](function(_0xea0526){return _0xea0526;});}return null;};}function removeEntity(_0xb8a0cb,_0x59bf79){return function(_0x16716d){if(_0x16716d){return _0x16716d[_0x271e('0x1c')]()['then'](function(){_0xb8a0cb[_0x271e('0x13')](0xcc)[_0x271e('0x14')]();});}};}function handleEntityNotFound(_0x452068,_0x2ef0f0){return function(_0x30cd4e){if(!_0x30cd4e){_0x452068[_0x271e('0x1d')](0x194);}return _0x30cd4e;};}function handleError(_0x247e94,_0x24e989){_0x24e989=_0x24e989||0x1f4;return function(_0x15552d){logger['error'](_0x15552d[_0x271e('0x1e')]);if(_0x15552d[_0x271e('0x1f')]){delete _0x15552d[_0x271e('0x1f')];}_0x247e94[_0x271e('0x13')](_0x24e989)[_0x271e('0x20')](_0x15552d);};}exports[_0x271e('0x21')]=function(_0x33a7ed,_0x3c7e8e){var _0xf88ddc={},_0x571d08={},_0x35e797={'count':0x0,'rows':[]};var _0x9cf2ca=db['Automation'][_0x271e('0x22')];_0x571d08[_0x271e('0x23')]=_[_0x271e('0x24')](_0x9cf2ca);var _0x2edb8d={'dateStart':_0x33a7ed[_0x271e('0x25')][_0x271e('0x26')],'dateEnd':_0x33a7ed['query'][_0x271e('0x27')]};delete _0x33a7ed['query'][_0x271e('0x26')];delete _0x33a7ed['query'][_0x271e('0x27')];_0x571d08['query']=_[_0x271e('0x24')](_0x33a7ed[_0x271e('0x25')]);_0x571d08[_0x271e('0x28')]=_['intersection'](_0x571d08[_0x271e('0x23')],_0x571d08[_0x271e('0x25')]);_0xf88ddc[_0x271e('0x29')]=_['intersection'](_0x571d08[_0x271e('0x23')],qs[_0x271e('0x2a')](_0x33a7ed[_0x271e('0x25')][_0x271e('0x2a')]));_0xf88ddc[_0x271e('0x29')]=_0xf88ddc[_0x271e('0x29')][_0x271e('0x2b')]?_0xf88ddc[_0x271e('0x29')]:_0x571d08['model'];if(!_0x33a7ed[_0x271e('0x25')]['hasOwnProperty'](_0x271e('0x2c'))){_0xf88ddc['limit']=qs['limit'](_0x33a7ed['query'][_0x271e('0x17')]);_0xf88ddc[_0x271e('0x16')]=qs[_0x271e('0x16')](_0x33a7ed[_0x271e('0x25')][_0x271e('0x16')]);}_0xf88ddc[_0x271e('0x2d')]=qs[_0x271e('0x2e')](_0x33a7ed['query'][_0x271e('0x2e')]);_0xf88ddc[_0x271e('0x2f')]=qs[_0x271e('0x28')](_[_0x271e('0x30')](_0x33a7ed[_0x271e('0x25')],_0x571d08[_0x271e('0x28')]));if(_0x2edb8d[_0x271e('0x26')]){if(_0x2edb8d['dateEnd']){_0x2edb8d[_0x271e('0x27')]=moment(_0x2edb8d[_0x271e('0x27')])[_0x271e('0x31')](0x1,_0x271e('0x32'));}else{_0x2edb8d[_0x271e('0x27')]=moment(_0x2edb8d[_0x271e('0x26')])['add'](0x1,_0x271e('0x32'));}_[_0x271e('0x33')](_0xf88ddc['where'],{'createdAt':{'$gte':_0x2edb8d[_0x271e('0x26')],'$lte':_0x2edb8d['dateEnd']}});}if(_0x33a7ed[_0x271e('0x25')]['filter']){_0xf88ddc[_0x271e('0x2f')]=_['merge'](_0xf88ddc[_0x271e('0x2f')],{'$or':_['map'](_0xf88ddc['attributes'],function(_0x54946a){var _0x2b9163={};_0x2b9163[_0x54946a]={'$like':'%'+_0x33a7ed[_0x271e('0x25')][_0x271e('0x34')]+'%'};return _0x2b9163;})});}_0xf88ddc=_[_0x271e('0x33')]({},_0xf88ddc,_0x33a7ed[_0x271e('0x35')]);var _0x26bf6f={'where':_0xf88ddc[_0x271e('0x2f')]};return db[_0x271e('0x36')]['count'](_0x26bf6f)[_0x271e('0x37')](function(_0x18adec){_0x35e797[_0x271e('0x15')]=_0x18adec;if(_0x33a7ed[_0x271e('0x25')][_0x271e('0x38')]){_0xf88ddc[_0x271e('0x39')]=[{'all':!![]}];}return db[_0x271e('0x36')]['findAll'](_0xf88ddc);})[_0x271e('0x37')](function(_0x3ae3ba){_0x35e797[_0x271e('0x3a')]=_0x3ae3ba;return _0x35e797;})[_0x271e('0x37')](respondWithFilteredResult(_0x3c7e8e,_0xf88ddc))[_0x271e('0x3b')](handleError(_0x3c7e8e,null));};exports[_0x271e('0x3c')]=function(_0x4f145e,_0x3f3de2){var _0x278caa={'raw':![],'where':{'id':_0x4f145e['params']['id']}},_0x47306b={};_0x47306b['model']=_[_0x271e('0x24')](db[_0x271e('0x36')][_0x271e('0x22')]);_0x47306b[_0x271e('0x25')]=_[_0x271e('0x24')](_0x4f145e[_0x271e('0x25')]);_0x47306b[_0x271e('0x28')]=_[_0x271e('0x3d')](_0x47306b[_0x271e('0x23')],_0x47306b[_0x271e('0x25')]);_0x278caa['attributes']=_[_0x271e('0x3d')](_0x47306b[_0x271e('0x23')],qs[_0x271e('0x2a')](_0x4f145e[_0x271e('0x25')]['fields']));_0x278caa[_0x271e('0x29')]=_0x278caa['attributes']['length']?_0x278caa[_0x271e('0x29')]:_0x47306b[_0x271e('0x23')];if(_0x4f145e['query'][_0x271e('0x38')]){_0x278caa[_0x271e('0x39')]=[{'all':!![]}];}_0x278caa=_[_0x271e('0x33')]({},_0x278caa,_0x4f145e['options']);return db[_0x271e('0x36')][_0x271e('0x3e')](_0x278caa)[_0x271e('0x37')](handleEntityNotFound(_0x3f3de2,null))[_0x271e('0x37')](respondWithResult(_0x3f3de2,null))[_0x271e('0x3b')](handleError(_0x3f3de2,null));};exports[_0x271e('0x3f')]=function(_0x138cd8,_0x2f40ba){return db[_0x271e('0x36')][_0x271e('0x3f')](_0x138cd8[_0x271e('0x40')],{})['then'](respondWithResult(_0x2f40ba,0xc9))[_0x271e('0x3b')](handleError(_0x2f40ba,null));};exports[_0x271e('0x1b')]=function(_0x11d3b5,_0xe6c235){if(_0x11d3b5['body']['id']){delete _0x11d3b5[_0x271e('0x40')]['id'];}return db['Automation'][_0x271e('0x3e')]({'where':{'id':_0x11d3b5[_0x271e('0x41')]['id']}})[_0x271e('0x37')](handleEntityNotFound(_0xe6c235,null))[_0x271e('0x37')](saveUpdates(_0x11d3b5[_0x271e('0x40')],null))['then'](respondWithResult(_0xe6c235,null))['catch'](handleError(_0xe6c235,null));};exports[_0x271e('0x1c')]=function(_0x9bce81,_0x197979){return db['Automation']['find']({'where':{'id':_0x9bce81[_0x271e('0x41')]['id']}})[_0x271e('0x37')](handleEntityNotFound(_0x197979,null))['then'](removeEntity(_0x197979,null))['catch'](handleError(_0x197979,null));};exports[_0x271e('0x42')]=function(_0x5ca6fd,_0x8da53c,_0xed0f49){return db[_0x271e('0x43')]['find']({'where':{'id':_0x5ca6fd[_0x271e('0x41')]['id']}})['then'](handleEntityNotFound(_0x8da53c,null))[_0x271e('0x37')](function(_0x9b7c0a){if(_0x9b7c0a){return _0x9b7c0a['addConditions'](_0x5ca6fd[_0x271e('0x40')][_0x271e('0x44')],_[_0x271e('0x45')](_0x5ca6fd[_0x271e('0x40')],['ids','id'])||{});}})['then'](respondWithResult(_0x8da53c,null))[_0x271e('0x3b')](handleError(_0x8da53c,null));};exports[_0x271e('0x46')]=function(_0x269df9,_0x53c47b,_0x1bc815){var _0x3b49e4={};var _0x11d523={};var _0xfa312f;var _0x39107b;return db['Automation'][_0x271e('0x47')]({'where':{'id':_0x269df9[_0x271e('0x41')]['id']}})['then'](handleEntityNotFound(_0x53c47b,null))[_0x271e('0x37')](function(_0x59ed22){if(_0x59ed22){_0xfa312f=_0x59ed22;_0x11d523['model']=_[_0x271e('0x24')](db[_0x271e('0x43')][_0x271e('0x22')]);_0x11d523[_0x271e('0x25')]=_['keys'](_0x269df9[_0x271e('0x25')]);_0x11d523[_0x271e('0x28')]=_[_0x271e('0x3d')](_0x11d523[_0x271e('0x23')],_0x11d523[_0x271e('0x25')]);_0x3b49e4[_0x271e('0x29')]=_['intersection'](_0x11d523[_0x271e('0x23')],qs['fields'](_0x269df9[_0x271e('0x25')][_0x271e('0x2a')]));_0x3b49e4['attributes']=_0x3b49e4[_0x271e('0x29')][_0x271e('0x2b')]?_0x3b49e4['attributes']:_0x11d523['model'];_0x3b49e4[_0x271e('0x2d')]=qs[_0x271e('0x2e')](_0x269df9[_0x271e('0x25')]['sort']);_0x3b49e4[_0x271e('0x2f')]=qs[_0x271e('0x28')](_[_0x271e('0x30')](_0x269df9['query'],_0x11d523[_0x271e('0x28')]));if(_0x269df9[_0x271e('0x25')][_0x271e('0x34')]){_0x3b49e4[_0x271e('0x2f')]=_['merge'](_0x3b49e4['where'],{'$or':_[_0x271e('0x48')](_0x3b49e4['attributes'],function(_0x5e04ef){var _0x42ee86={};_0x42ee86[_0x5e04ef]={'$like':'%'+_0x269df9[_0x271e('0x25')][_0x271e('0x34')]+'%'};return _0x42ee86;})});}_0x3b49e4=_[_0x271e('0x33')]({},_0x3b49e4,_0x269df9[_0x271e('0x35')]);return _0xfa312f[_0x271e('0x46')](_0x3b49e4);}})[_0x271e('0x37')](function(_0x34332d){if(_0x34332d){_0x39107b=_0x34332d[_0x271e('0x2b')];if(!_0x269df9['query'][_0x271e('0x49')](_0x271e('0x2c'))){_0x3b49e4[_0x271e('0x17')]=qs['limit'](_0x269df9[_0x271e('0x25')]['limit']);_0x3b49e4[_0x271e('0x16')]=qs[_0x271e('0x16')](_0x269df9[_0x271e('0x25')][_0x271e('0x16')]);}return _0xfa312f[_0x271e('0x46')](_0x3b49e4);}})[_0x271e('0x37')](function(_0x5aafa6){if(_0x5aafa6){return _0x5aafa6?{'count':_0x39107b,'rows':_0x5aafa6}:null;}})[_0x271e('0x37')](respondWithResult(_0x53c47b,null))[_0x271e('0x3b')](handleError(_0x53c47b,null));};exports[_0x271e('0x4a')]=function(_0x5c72eb,_0x4a0414,_0x3256f0){return db[_0x271e('0x4b')][_0x271e('0x3e')]({'where':{'id':_0x5c72eb[_0x271e('0x41')]['id']}})[_0x271e('0x37')](handleEntityNotFound(_0x4a0414,null))[_0x271e('0x37')](function(_0x4c4014){if(_0x4c4014){return _0x4c4014[_0x271e('0x4a')](_0x5c72eb[_0x271e('0x40')][_0x271e('0x44')],_[_0x271e('0x45')](_0x5c72eb['body'],[_0x271e('0x44'),'id'])||{});}})['then'](respondWithResult(_0x4a0414,null))[_0x271e('0x3b')](handleError(_0x4a0414,null));};exports[_0x271e('0x4c')]=function(_0x451034,_0x5084b6,_0x4bc06a){var _0x586df9={};var _0x408c7e={};var _0x10a6ad;var _0x1be3c9;return db[_0x271e('0x36')]['findOne']({'where':{'id':_0x451034[_0x271e('0x41')]['id']}})[_0x271e('0x37')](handleEntityNotFound(_0x5084b6,null))['then'](function(_0x16d50e){if(_0x16d50e){_0x10a6ad=_0x16d50e;_0x408c7e[_0x271e('0x23')]=_['keys'](db[_0x271e('0x4b')][_0x271e('0x22')]);_0x408c7e['query']=_['keys'](_0x451034[_0x271e('0x25')]);_0x408c7e[_0x271e('0x28')]=_[_0x271e('0x3d')](_0x408c7e[_0x271e('0x23')],_0x408c7e[_0x271e('0x25')]);_0x586df9[_0x271e('0x29')]=_[_0x271e('0x3d')](_0x408c7e[_0x271e('0x23')],qs[_0x271e('0x2a')](_0x451034[_0x271e('0x25')][_0x271e('0x2a')]));_0x586df9[_0x271e('0x29')]=_0x586df9[_0x271e('0x29')]['length']?_0x586df9['attributes']:_0x408c7e[_0x271e('0x23')];_0x586df9[_0x271e('0x2d')]=qs[_0x271e('0x2e')](_0x451034[_0x271e('0x25')][_0x271e('0x2e')]);_0x586df9[_0x271e('0x2f')]=qs[_0x271e('0x28')](_[_0x271e('0x30')](_0x451034['query'],_0x408c7e[_0x271e('0x28')]));if(_0x451034[_0x271e('0x25')][_0x271e('0x34')]){_0x586df9[_0x271e('0x2f')]=_[_0x271e('0x33')](_0x586df9[_0x271e('0x2f')],{'$or':_['map'](_0x586df9[_0x271e('0x29')],function(_0x4c7c12){var _0x5ee772={};_0x5ee772[_0x4c7c12]={'$like':'%'+_0x451034[_0x271e('0x25')][_0x271e('0x34')]+'%'};return _0x5ee772;})});}_0x586df9=_['merge']({},_0x586df9,_0x451034['options']);return _0x10a6ad[_0x271e('0x4c')](_0x586df9);}})['then'](function(_0x17fd70){if(_0x17fd70){_0x1be3c9=_0x17fd70[_0x271e('0x2b')];if(!_0x451034['query'][_0x271e('0x49')]('nolimit')){_0x586df9[_0x271e('0x17')]=qs[_0x271e('0x17')](_0x451034[_0x271e('0x25')]['limit']);_0x586df9[_0x271e('0x16')]=qs[_0x271e('0x16')](_0x451034['query']['offset']);}return _0x10a6ad[_0x271e('0x4c')](_0x586df9);}})['then'](function(_0x554c68){if(_0x554c68){return _0x554c68?{'count':_0x1be3c9,'rows':_0x554c68}:null;}})[_0x271e('0x37')](respondWithResult(_0x5084b6,null))[_0x271e('0x3b')](handleError(_0x5084b6,null));}; \ No newline at end of file +var _0xed8b=['name','Automation','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','add','day','merge','map','options','count','include','rows','catch','show','params','includeAll','find','then','create','body','addConditions','Condition','ids','getConditions','findOne','order','filter','Action','addActions','getActions','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','status','offset','limit','set','json','apply','update','destroy','end','stack'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xed8b,0x158));var _0xbed8=function(_0x5cd3be,_0xa21512){_0x5cd3be=_0x5cd3be-0x0;var _0x1af30c=_0xed8b[_0x5cd3be];return _0x1af30c;};'use strict';var pdf=require(_0xbed8('0x0'));var emlformat=require(_0xbed8('0x1'));var rimraf=require(_0xbed8('0x2'));var zipdir=require(_0xbed8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbed8('0x4'));var BPromise=require(_0xbed8('0x5'));var Mustache=require('mustache');var util=require(_0xbed8('0x6'));var path=require(_0xbed8('0x7'));var sox=require(_0xbed8('0x8'));var csv=require(_0xbed8('0x9'));var ejs=require(_0xbed8('0xa'));var fs=require('fs');var _=require(_0xbed8('0xb'));var squel=require(_0xbed8('0xc'));var crypto=require(_0xbed8('0xd'));var jsforce=require(_0xbed8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xbed8('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbed8('0xf'));var qs=require(_0xbed8('0x10'));var logger=require('../../config/logger')(_0xbed8('0x11'));var utils=require(_0xbed8('0x12'));var config=require(_0xbed8('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ce4c6,_0x45886c){_0x45886c=_0x45886c||0xcc;return function(_0x345837){if(_0x345837){return _0x5ce4c6[_0xbed8('0x14')](_0x45886c);}return _0x5ce4c6['status'](_0x45886c)['end']();};}function respondWithResult(_0x19c35b,_0xa383b7){_0xa383b7=_0xa383b7||0xc8;return function(_0x46446a){if(_0x46446a){return _0x19c35b[_0xbed8('0x15')](_0xa383b7)['json'](_0x46446a);}};}function respondWithFilteredResult(_0x395fe5,_0x533b18){return function(_0x211e66){if(_0x211e66){var _0x22d1c5=_0x211e66['count'],_0x12397e=_0x533b18['offset'],_0x414bba=_0x533b18[_0xbed8('0x16')]+_0x533b18[_0xbed8('0x17')],_0x4a90b1;if(_0x414bba>=_0x22d1c5){_0x414bba=_0x22d1c5;_0x4a90b1=0xc8;}else{_0x4a90b1=0xce;}_0x395fe5[_0xbed8('0x15')](_0x4a90b1);return _0x395fe5[_0xbed8('0x18')]('Content-Range',_0x12397e+'-'+_0x414bba+'/'+_0x22d1c5)[_0xbed8('0x19')](_0x211e66);}return null;};}function patchUpdates(_0x5e13b0){return function(_0x46bc2a){try{jsonpatch[_0xbed8('0x1a')](_0x46bc2a,_0x5e13b0,!![]);}catch(_0x11260a){return BPromise['reject'](_0x11260a);}return _0x46bc2a['save']();};}function saveUpdates(_0xf73d6e,_0xb34ca1){return function(_0x479ef1){if(_0x479ef1){return _0x479ef1[_0xbed8('0x1b')](_0xf73d6e)['then'](function(_0x1e07d3){return _0x1e07d3;});}return null;};}function removeEntity(_0x3c65be,_0x4724ec){return function(_0x1d8c0f){if(_0x1d8c0f){return _0x1d8c0f[_0xbed8('0x1c')]()['then'](function(){_0x3c65be['status'](0xcc)[_0xbed8('0x1d')]();});}};}function handleEntityNotFound(_0x42c0a,_0x51143c){return function(_0x8f5b68){if(!_0x8f5b68){_0x42c0a[_0xbed8('0x14')](0x194);}return _0x8f5b68;};}function handleError(_0x24688e,_0x37abd4){_0x37abd4=_0x37abd4||0x1f4;return function(_0x2171b4){logger['error'](_0x2171b4[_0xbed8('0x1e')]);if(_0x2171b4[_0xbed8('0x1f')]){delete _0x2171b4[_0xbed8('0x1f')];}_0x24688e[_0xbed8('0x15')](_0x37abd4)['send'](_0x2171b4);};}exports['index']=function(_0x696e53,_0x4d0a10){var _0x550783={},_0x5b68cb={},_0x489436={'count':0x0,'rows':[]};var _0x3079ed=db[_0xbed8('0x20')][_0xbed8('0x21')];_0x5b68cb[_0xbed8('0x22')]=_[_0xbed8('0x23')](_0x3079ed);var _0xa98dd2={'dateStart':_0x696e53[_0xbed8('0x24')][_0xbed8('0x25')],'dateEnd':_0x696e53['query'][_0xbed8('0x26')]};delete _0x696e53['query'][_0xbed8('0x25')];delete _0x696e53[_0xbed8('0x24')][_0xbed8('0x26')];_0x5b68cb[_0xbed8('0x24')]=_['keys'](_0x696e53[_0xbed8('0x24')]);_0x5b68cb[_0xbed8('0x27')]=_[_0xbed8('0x28')](_0x5b68cb[_0xbed8('0x22')],_0x5b68cb['query']);_0x550783[_0xbed8('0x29')]=_['intersection'](_0x5b68cb[_0xbed8('0x22')],qs['fields'](_0x696e53['query'][_0xbed8('0x2a')]));_0x550783[_0xbed8('0x29')]=_0x550783[_0xbed8('0x29')][_0xbed8('0x2b')]?_0x550783['attributes']:_0x5b68cb['model'];if(!_0x696e53['query'][_0xbed8('0x2c')](_0xbed8('0x2d'))){_0x550783[_0xbed8('0x17')]=qs['limit'](_0x696e53['query'][_0xbed8('0x17')]);_0x550783[_0xbed8('0x16')]=qs[_0xbed8('0x16')](_0x696e53[_0xbed8('0x24')][_0xbed8('0x16')]);}_0x550783['order']=qs[_0xbed8('0x2e')](_0x696e53[_0xbed8('0x24')]['sort']);_0x550783[_0xbed8('0x2f')]=qs[_0xbed8('0x27')](_[_0xbed8('0x30')](_0x696e53['query'],_0x5b68cb[_0xbed8('0x27')]));if(_0xa98dd2[_0xbed8('0x25')]){if(_0xa98dd2['dateEnd']){_0xa98dd2[_0xbed8('0x26')]=moment(_0xa98dd2[_0xbed8('0x26')])[_0xbed8('0x31')](0x1,_0xbed8('0x32'));}else{_0xa98dd2[_0xbed8('0x26')]=moment(_0xa98dd2[_0xbed8('0x25')])['add'](0x1,'day');}_[_0xbed8('0x33')](_0x550783[_0xbed8('0x2f')],{'createdAt':{'$gte':_0xa98dd2[_0xbed8('0x25')],'$lte':_0xa98dd2['dateEnd']}});}if(_0x696e53[_0xbed8('0x24')]['filter']){_0x550783[_0xbed8('0x2f')]=_[_0xbed8('0x33')](_0x550783['where'],{'$or':_[_0xbed8('0x34')](_0x550783[_0xbed8('0x29')],function(_0x37b5b0){var _0x585bef={};_0x585bef[_0x37b5b0]={'$like':'%'+_0x696e53[_0xbed8('0x24')]['filter']+'%'};return _0x585bef;})});}_0x550783=_['merge']({},_0x550783,_0x696e53[_0xbed8('0x35')]);var _0x4f4b86={'where':_0x550783['where']};return db[_0xbed8('0x20')][_0xbed8('0x36')](_0x4f4b86)['then'](function(_0x3e38a8){_0x489436[_0xbed8('0x36')]=_0x3e38a8;if(_0x696e53['query']['includeAll']){_0x550783[_0xbed8('0x37')]=[{'all':!![]}];}return db['Automation']['findAll'](_0x550783);})['then'](function(_0x11c106){_0x489436[_0xbed8('0x38')]=_0x11c106;return _0x489436;})['then'](respondWithFilteredResult(_0x4d0a10,_0x550783))[_0xbed8('0x39')](handleError(_0x4d0a10,null));};exports[_0xbed8('0x3a')]=function(_0x4c8296,_0x32f6e1){var _0x4aa910={'raw':![],'where':{'id':_0x4c8296[_0xbed8('0x3b')]['id']}},_0x24d93a={};_0x24d93a[_0xbed8('0x22')]=_[_0xbed8('0x23')](db['Automation'][_0xbed8('0x21')]);_0x24d93a['query']=_[_0xbed8('0x23')](_0x4c8296['query']);_0x24d93a['filters']=_[_0xbed8('0x28')](_0x24d93a[_0xbed8('0x22')],_0x24d93a[_0xbed8('0x24')]);_0x4aa910[_0xbed8('0x29')]=_[_0xbed8('0x28')](_0x24d93a[_0xbed8('0x22')],qs[_0xbed8('0x2a')](_0x4c8296[_0xbed8('0x24')][_0xbed8('0x2a')]));_0x4aa910[_0xbed8('0x29')]=_0x4aa910[_0xbed8('0x29')][_0xbed8('0x2b')]?_0x4aa910[_0xbed8('0x29')]:_0x24d93a[_0xbed8('0x22')];if(_0x4c8296['query'][_0xbed8('0x3c')]){_0x4aa910[_0xbed8('0x37')]=[{'all':!![]}];}_0x4aa910=_[_0xbed8('0x33')]({},_0x4aa910,_0x4c8296['options']);return db[_0xbed8('0x20')][_0xbed8('0x3d')](_0x4aa910)[_0xbed8('0x3e')](handleEntityNotFound(_0x32f6e1,null))[_0xbed8('0x3e')](respondWithResult(_0x32f6e1,null))[_0xbed8('0x39')](handleError(_0x32f6e1,null));};exports[_0xbed8('0x3f')]=function(_0x58e935,_0x3db917){return db[_0xbed8('0x20')][_0xbed8('0x3f')](_0x58e935[_0xbed8('0x40')],{})[_0xbed8('0x3e')](respondWithResult(_0x3db917,0xc9))[_0xbed8('0x39')](handleError(_0x3db917,null));};exports[_0xbed8('0x1b')]=function(_0x259c95,_0x53c112){if(_0x259c95[_0xbed8('0x40')]['id']){delete _0x259c95[_0xbed8('0x40')]['id'];}return db[_0xbed8('0x20')][_0xbed8('0x3d')]({'where':{'id':_0x259c95['params']['id']}})[_0xbed8('0x3e')](handleEntityNotFound(_0x53c112,null))[_0xbed8('0x3e')](saveUpdates(_0x259c95[_0xbed8('0x40')],null))['then'](respondWithResult(_0x53c112,null))[_0xbed8('0x39')](handleError(_0x53c112,null));};exports[_0xbed8('0x1c')]=function(_0x3d062f,_0x5828ef){return db[_0xbed8('0x20')]['find']({'where':{'id':_0x3d062f[_0xbed8('0x3b')]['id']}})['then'](handleEntityNotFound(_0x5828ef,null))[_0xbed8('0x3e')](removeEntity(_0x5828ef,null))[_0xbed8('0x39')](handleError(_0x5828ef,null));};exports[_0xbed8('0x41')]=function(_0x35c59b,_0x37c43f,_0x3da3ee){return db[_0xbed8('0x42')]['find']({'where':{'id':_0x35c59b[_0xbed8('0x3b')]['id']}})[_0xbed8('0x3e')](handleEntityNotFound(_0x37c43f,null))[_0xbed8('0x3e')](function(_0x1d781b){if(_0x1d781b){return _0x1d781b[_0xbed8('0x41')](_0x35c59b[_0xbed8('0x40')][_0xbed8('0x43')],_['omit'](_0x35c59b[_0xbed8('0x40')],[_0xbed8('0x43'),'id'])||{});}})['then'](respondWithResult(_0x37c43f,null))[_0xbed8('0x39')](handleError(_0x37c43f,null));};exports[_0xbed8('0x44')]=function(_0x226f4e,_0x1b2ce4,_0x52d538){var _0x42509a={};var _0x2e05b5={};var _0x49467d;var _0x238c1c;return db[_0xbed8('0x20')][_0xbed8('0x45')]({'where':{'id':_0x226f4e[_0xbed8('0x3b')]['id']}})[_0xbed8('0x3e')](handleEntityNotFound(_0x1b2ce4,null))[_0xbed8('0x3e')](function(_0x45739c){if(_0x45739c){_0x49467d=_0x45739c;_0x2e05b5[_0xbed8('0x22')]=_['keys'](db[_0xbed8('0x42')][_0xbed8('0x21')]);_0x2e05b5[_0xbed8('0x24')]=_[_0xbed8('0x23')](_0x226f4e[_0xbed8('0x24')]);_0x2e05b5[_0xbed8('0x27')]=_[_0xbed8('0x28')](_0x2e05b5['model'],_0x2e05b5[_0xbed8('0x24')]);_0x42509a[_0xbed8('0x29')]=_['intersection'](_0x2e05b5[_0xbed8('0x22')],qs[_0xbed8('0x2a')](_0x226f4e['query'][_0xbed8('0x2a')]));_0x42509a['attributes']=_0x42509a[_0xbed8('0x29')][_0xbed8('0x2b')]?_0x42509a[_0xbed8('0x29')]:_0x2e05b5['model'];_0x42509a[_0xbed8('0x46')]=qs[_0xbed8('0x2e')](_0x226f4e[_0xbed8('0x24')][_0xbed8('0x2e')]);_0x42509a[_0xbed8('0x2f')]=qs[_0xbed8('0x27')](_[_0xbed8('0x30')](_0x226f4e[_0xbed8('0x24')],_0x2e05b5[_0xbed8('0x27')]));if(_0x226f4e[_0xbed8('0x24')][_0xbed8('0x47')]){_0x42509a[_0xbed8('0x2f')]=_[_0xbed8('0x33')](_0x42509a[_0xbed8('0x2f')],{'$or':_[_0xbed8('0x34')](_0x42509a[_0xbed8('0x29')],function(_0x2a5bd9){var _0x1de838={};_0x1de838[_0x2a5bd9]={'$like':'%'+_0x226f4e['query'][_0xbed8('0x47')]+'%'};return _0x1de838;})});}_0x42509a=_[_0xbed8('0x33')]({},_0x42509a,_0x226f4e[_0xbed8('0x35')]);return _0x49467d[_0xbed8('0x44')](_0x42509a);}})[_0xbed8('0x3e')](function(_0xa31747){if(_0xa31747){_0x238c1c=_0xa31747[_0xbed8('0x2b')];if(!_0x226f4e['query'][_0xbed8('0x2c')](_0xbed8('0x2d'))){_0x42509a[_0xbed8('0x17')]=qs['limit'](_0x226f4e['query'][_0xbed8('0x17')]);_0x42509a['offset']=qs[_0xbed8('0x16')](_0x226f4e[_0xbed8('0x24')]['offset']);}return _0x49467d[_0xbed8('0x44')](_0x42509a);}})[_0xbed8('0x3e')](function(_0x37bf23){if(_0x37bf23){return _0x37bf23?{'count':_0x238c1c,'rows':_0x37bf23}:null;}})['then'](respondWithResult(_0x1b2ce4,null))[_0xbed8('0x39')](handleError(_0x1b2ce4,null));};exports['addActions']=function(_0x4aa1c3,_0x36b6a7,_0x487160){return db[_0xbed8('0x48')]['find']({'where':{'id':_0x4aa1c3[_0xbed8('0x3b')]['id']}})['then'](handleEntityNotFound(_0x36b6a7,null))[_0xbed8('0x3e')](function(_0x535802){if(_0x535802){return _0x535802[_0xbed8('0x49')](_0x4aa1c3[_0xbed8('0x40')][_0xbed8('0x43')],_['omit'](_0x4aa1c3['body'],[_0xbed8('0x43'),'id'])||{});}})['then'](respondWithResult(_0x36b6a7,null))['catch'](handleError(_0x36b6a7,null));};exports[_0xbed8('0x4a')]=function(_0x57bba9,_0x275bd4,_0x4c34c3){var _0x26fd66={};var _0x3aa7ed={};var _0xc55716;var _0x594545;return db[_0xbed8('0x20')][_0xbed8('0x45')]({'where':{'id':_0x57bba9[_0xbed8('0x3b')]['id']}})['then'](handleEntityNotFound(_0x275bd4,null))[_0xbed8('0x3e')](function(_0x4d12f6){if(_0x4d12f6){_0xc55716=_0x4d12f6;_0x3aa7ed[_0xbed8('0x22')]=_[_0xbed8('0x23')](db['Action'][_0xbed8('0x21')]);_0x3aa7ed[_0xbed8('0x24')]=_[_0xbed8('0x23')](_0x57bba9[_0xbed8('0x24')]);_0x3aa7ed[_0xbed8('0x27')]=_['intersection'](_0x3aa7ed[_0xbed8('0x22')],_0x3aa7ed[_0xbed8('0x24')]);_0x26fd66[_0xbed8('0x29')]=_['intersection'](_0x3aa7ed['model'],qs[_0xbed8('0x2a')](_0x57bba9['query']['fields']));_0x26fd66[_0xbed8('0x29')]=_0x26fd66[_0xbed8('0x29')][_0xbed8('0x2b')]?_0x26fd66[_0xbed8('0x29')]:_0x3aa7ed[_0xbed8('0x22')];_0x26fd66[_0xbed8('0x46')]=qs['sort'](_0x57bba9['query'][_0xbed8('0x2e')]);_0x26fd66[_0xbed8('0x2f')]=qs[_0xbed8('0x27')](_[_0xbed8('0x30')](_0x57bba9[_0xbed8('0x24')],_0x3aa7ed['filters']));if(_0x57bba9['query']['filter']){_0x26fd66[_0xbed8('0x2f')]=_[_0xbed8('0x33')](_0x26fd66[_0xbed8('0x2f')],{'$or':_[_0xbed8('0x34')](_0x26fd66[_0xbed8('0x29')],function(_0x37e716){var _0x416da8={};_0x416da8[_0x37e716]={'$like':'%'+_0x57bba9[_0xbed8('0x24')]['filter']+'%'};return _0x416da8;})});}_0x26fd66=_[_0xbed8('0x33')]({},_0x26fd66,_0x57bba9[_0xbed8('0x35')]);return _0xc55716[_0xbed8('0x4a')](_0x26fd66);}})[_0xbed8('0x3e')](function(_0x3f66f3){if(_0x3f66f3){_0x594545=_0x3f66f3[_0xbed8('0x2b')];if(!_0x57bba9[_0xbed8('0x24')][_0xbed8('0x2c')](_0xbed8('0x2d'))){_0x26fd66[_0xbed8('0x17')]=qs['limit'](_0x57bba9[_0xbed8('0x24')][_0xbed8('0x17')]);_0x26fd66['offset']=qs[_0xbed8('0x16')](_0x57bba9[_0xbed8('0x24')][_0xbed8('0x16')]);}return _0xc55716['getActions'](_0x26fd66);}})[_0xbed8('0x3e')](function(_0x22292c){if(_0x22292c){return _0x22292c?{'count':_0x594545,'rows':_0x22292c}:null;}})['then'](respondWithResult(_0x275bd4,null))['catch'](handleError(_0x275bd4,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 89dc783..a4f502c 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 _0xf609=['./automation.attributes','define','Automation','tools_automations','lodash','util','../../config/logger','api'];(function(_0x374065,_0x290259){var _0x139981=function(_0x3d7918){while(--_0x3d7918){_0x374065['push'](_0x374065['shift']());}};_0x139981(++_0x290259);}(_0xf609,0x114));var _0x9f60=function(_0x51c75f,_0x5ec43b){_0x51c75f=_0x51c75f-0x0;var _0x1bc405=_0xf609[_0x51c75f];return _0x1bc405;};'use strict';var _=require(_0x9f60('0x0'));var util=require(_0x9f60('0x1'));var logger=require(_0x9f60('0x2'))(_0x9f60('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x9f60('0x4'));module['exports']=function(_0x45db08,_0x6f4e4){return _0x45db08[_0x9f60('0x5')](_0x9f60('0x6'),attributes,{'tableName':_0x9f60('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11d1=['api','moment','request-promise','./automation.attributes','exports','define','Automation','tools_automations','lodash','../../config/logger'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x11d1,0x184));var _0x111d=function(_0x20e24c,_0x1aa135){_0x20e24c=_0x20e24c-0x0;var _0x4910d5=_0x11d1[_0x20e24c];return _0x4910d5;};'use strict';var _=require(_0x111d('0x0'));var util=require('util');var logger=require(_0x111d('0x1'))(_0x111d('0x2'));var moment=require(_0x111d('0x3'));var BPromise=require('bluebird');var rp=require(_0x111d('0x4'));var attributes=require(_0x111d('0x5'));module[_0x111d('0x6')]=function(_0x5657c6,_0x2cc0fb){return _0x5657c6[_0x111d('0x7')](_0x111d('0x8'),attributes,{'tableName':_0x111d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 008a167..867607d 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 _0xc401=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s','message','result','catch','util','moment','bluebird'];(function(_0x14cd13,_0x2a2097){var _0x13e84a=function(_0x4c1207){while(--_0x4c1207){_0x14cd13['push'](_0x14cd13['shift']());}};_0x13e84a(++_0x2a2097);}(_0xc401,0x15d));var _0x1c40=function(_0x2f7622,_0x53648e){_0x2f7622=_0x2f7622-0x0;var _0x32ccfb=_0xc401[_0x2f7622];return _0x32ccfb;};'use strict';var _=require('lodash');var util=require(_0x1c40('0x0'));var moment=require(_0x1c40('0x1'));var BPromise=require(_0x1c40('0x2'));var rs=require(_0x1c40('0x3'));var fs=require('fs');var Redis=require(_0x1c40('0x4'));var db=require(_0x1c40('0x5'))['db'];var utils=require(_0x1c40('0x6'));var logger=require(_0x1c40('0x7'))(_0x1c40('0x8'));var config=require('../../config/environment');var jayson=require(_0x1c40('0x9'));var client=jayson[_0x1c40('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4aa22f,_0x19cda7,_0x3f83d9){return new BPromise(function(_0x5c4550,_0xbc9ca3){return client[_0x1c40('0xb')](_0x4aa22f,_0x3f83d9)['then'](function(_0x1b2d27){logger[_0x1c40('0xc')]('Automation,\x20%s,\x20%s',_0x19cda7,_0x1c40('0xd'));logger['debug'](_0x1c40('0xe'),_0x19cda7,_0x1c40('0xd'),JSON[_0x1c40('0xf')](_0x1b2d27));if(_0x1b2d27[_0x1c40('0x10')]){if(_0x1b2d27[_0x1c40('0x10')][_0x1c40('0x11')]===0x1f4){logger[_0x1c40('0x10')](_0x1c40('0x12'),_0x19cda7,_0x1b2d27['error'][_0x1c40('0x13')]);return _0xbc9ca3(_0x1b2d27[_0x1c40('0x10')][_0x1c40('0x13')]);}logger[_0x1c40('0x10')]('Automation,\x20%s,\x20%s',_0x19cda7,_0x1b2d27[_0x1c40('0x10')]['message']);return _0x5c4550(_0x1b2d27['error'][_0x1c40('0x13')]);}else{logger[_0x1c40('0xc')]('Automation,\x20%s,\x20%s',_0x19cda7,_0x1c40('0xd'));_0x5c4550(_0x1b2d27[_0x1c40('0x14')][_0x1c40('0x13')]);}})[_0x1c40('0x15')](function(_0x1468cd){logger['error'](_0x1c40('0x12'),_0x19cda7,_0x1468cd);_0xbc9ca3(_0x1468cd);});});} \ No newline at end of file +var _0x0514=['client','then','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','Automation,\x20%s,\x20%s','message','info','result','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x10f68e,_0xf198ea){var _0x4c8372=function(_0x38517){while(--_0x38517){_0x10f68e['push'](_0x10f68e['shift']());}};_0x4c8372(++_0xf198ea);}(_0x0514,0x1f0));var _0x4051=function(_0x14ccbd,_0x51ab86){_0x14ccbd=_0x14ccbd-0x0;var _0x32f527=_0x0514[_0x14ccbd];return _0x32f527;};'use strict';var _=require(_0x4051('0x0'));var util=require('util');var moment=require(_0x4051('0x1'));var BPromise=require(_0x4051('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4051('0x3'));var db=require(_0x4051('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4051('0x5'));var config=require(_0x4051('0x6'));var jayson=require(_0x4051('0x7'));var client=jayson[_0x4051('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d5648,_0x394f4c,_0x2a17cd){return new BPromise(function(_0x4b9afb,_0x1df828){return client['request'](_0x5d5648,_0x2a17cd)[_0x4051('0x9')](function(_0x36754c){logger['info']('Automation,\x20%s,\x20%s',_0x394f4c,_0x4051('0xa'));logger[_0x4051('0xb')](_0x4051('0xc'),_0x394f4c,_0x4051('0xa'),JSON['stringify'](_0x36754c));if(_0x36754c[_0x4051('0xd')]){if(_0x36754c['error']['code']===0x1f4){logger[_0x4051('0xd')](_0x4051('0xe'),_0x394f4c,_0x36754c[_0x4051('0xd')][_0x4051('0xf')]);return _0x1df828(_0x36754c['error'][_0x4051('0xf')]);}logger['error'](_0x4051('0xe'),_0x394f4c,_0x36754c[_0x4051('0xd')]['message']);return _0x4b9afb(_0x36754c[_0x4051('0xd')][_0x4051('0xf')]);}else{logger[_0x4051('0x10')](_0x4051('0xe'),_0x394f4c,'request\x20sent');_0x4b9afb(_0x36754c[_0x4051('0x11')][_0x4051('0xf')]);}})['catch'](function(_0x3a5933){logger['error'](_0x4051('0xe'),_0x394f4c,_0x3a5933);_0x1df828(_0x3a5933);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index be1dbcd..e508961 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 _0x50ed=['./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','post','create','addConditions','addActions','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0xedea1f,_0x58e13e){var _0x563239=function(_0x2d2160){while(--_0x2d2160){_0xedea1f['push'](_0xedea1f['shift']());}};_0x563239(++_0x58e13e);}(_0x50ed,0x14a));var _0xd50e=function(_0x4c245d,_0x377ea5){_0x4c245d=_0x4c245d-0x0;var _0x33b513=_0x50ed[_0x4c245d];return _0x33b513;};'use strict';var multer=require(_0xd50e('0x0'));var util=require(_0xd50e('0x1'));var path=require('path');var timeout=require(_0xd50e('0x2'));var express=require(_0xd50e('0x3'));var router=express[_0xd50e('0x4')]();var auth=require(_0xd50e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd50e('0x6'));router[_0xd50e('0x7')]('/',auth[_0xd50e('0x8')](),controller[_0xd50e('0x9')]);router[_0xd50e('0x7')](_0xd50e('0xa'),auth[_0xd50e('0x8')](),controller[_0xd50e('0xb')]);router[_0xd50e('0x7')](_0xd50e('0xc'),auth['isAuthenticated'](),controller[_0xd50e('0xd')]);router[_0xd50e('0x7')](_0xd50e('0xe'),auth[_0xd50e('0x8')](),controller['getActions']);router[_0xd50e('0xf')]('/',auth[_0xd50e('0x8')](),controller[_0xd50e('0x10')]);router[_0xd50e('0xf')](_0xd50e('0xc'),auth['isAuthenticated'](),controller[_0xd50e('0x11')]);router['post'](_0xd50e('0xe'),auth[_0xd50e('0x8')](),controller[_0xd50e('0x12')]);router['put']('/:id',auth[_0xd50e('0x8')](),controller['update']);router[_0xd50e('0x13')](_0xd50e('0xa'),auth[_0xd50e('0x8')](),controller[_0xd50e('0x14')]);module['exports']=router; \ No newline at end of file +var _0x6659=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','/:id','isAuthenticated','get','/:id/conditions','post','/:id/actions','addActions','put','update','destroy','exports','util'];(function(_0x557023,_0x18ce5e){var _0x559f5e=function(_0xeb39ae){while(--_0xeb39ae){_0x557023['push'](_0x557023['shift']());}};_0x559f5e(++_0x18ce5e);}(_0x6659,0xbd));var _0x9665=function(_0x101e69,_0x25cc82){_0x101e69=_0x101e69-0x0;var _0xf26fba=_0x6659[_0x101e69];return _0xf26fba;};'use strict';var multer=require('multer');var util=require(_0x9665('0x0'));var path=require('path');var timeout=require(_0x9665('0x1'));var express=require(_0x9665('0x2'));var router=express[_0x9665('0x3')]();var auth=require(_0x9665('0x4'));var interaction=require(_0x9665('0x5'));var config=require(_0x9665('0x6'));var controller=require(_0x9665('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x9665('0x8'),auth[_0x9665('0x9')](),controller['show']);router[_0x9665('0xa')](_0x9665('0xb'),auth['isAuthenticated'](),controller['getConditions']);router['get']('/:id/actions',auth[_0x9665('0x9')](),controller['getActions']);router[_0x9665('0xc')]('/',auth[_0x9665('0x9')](),controller['create']);router[_0x9665('0xc')](_0x9665('0xb'),auth['isAuthenticated'](),controller['addConditions']);router['post'](_0x9665('0xd'),auth['isAuthenticated'](),controller[_0x9665('0xe')]);router[_0x9665('0xf')](_0x9665('0x8'),auth[_0x9665('0x9')](),controller[_0x9665('0x10')]);router['delete'](_0x9665('0x8'),auth[_0x9665('0x9')](),controller[_0x9665('0x11')]);module[_0x9665('0x12')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 8461a8f..d3a5f6a 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 _0x1e53=['#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','sequelize','exports','name','ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)'];(function(_0x4f5abd,_0x120942){var _0x28accb=function(_0x5e6ecc){while(--_0x5e6ecc){_0x4f5abd['push'](_0x4f5abd['shift']());}};_0x28accb(++_0x120942);}(_0x1e53,0x66));var _0x31e5=function(_0x498b80,_0x4a207c){_0x498b80=_0x498b80-0x0;var _0x368941=_0x1e53[_0x498b80];return _0x368941;};'use strict';var Sequelize=require(_0x31e5('0x0'));module[_0x31e5('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x31e5('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x31e5('0x3')](_0x31e5('0x4')),'allowNull':![],'defaultValue':_0x31e5('0x4')},'description':{'type':Sequelize[_0x31e5('0x5')]},'active':{'type':Sequelize[_0x31e5('0x6')],'defaultValue':0x0,'comment':_0x31e5('0x7')},'limitCalls':{'type':Sequelize[_0x31e5('0x8')](0x4)[_0x31e5('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x31e5('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x31e5('0x5')]},'dialOriginateTimeout':{'type':Sequelize[_0x31e5('0x8')](0x3)[_0x31e5('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x31e5('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x31e5('0x8')](0x3)[_0x31e5('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x31e5('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x31e5('0x8')](0x5)[_0x31e5('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x31e5('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x31e5('0x8')](0x3)[_0x31e5('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x31e5('0x8')](0x5)[_0x31e5('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x31e5('0x8')](0x3)[_0x31e5('0x9')],'defaultValue':0x3,'comment':_0x31e5('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x31e5('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x31e5('0x8')](0x3)[_0x31e5('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x31e5('0xe')},'dialTimezone':{'type':Sequelize[_0x31e5('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x31e5('0xf'),_0x31e5('0x10'),_0x31e5('0x11')),'defaultValue':_0x31e5('0xf')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x31e5('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x31e5('0x8')](0x9)[_0x31e5('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x31e5('0x13')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x31e5('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x31e5('0x8')](0x9)[_0x31e5('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x31e5('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x31e5('0x8')](0x9)[_0x31e5('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x31e5('0x8')](0x9)[_0x31e5('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x31e5('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x31e5('0x8')](0x9)[_0x31e5('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x31e5('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x31e5('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x31e5('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x31e5('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x31e5('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x31e5('0x8')](0x9)[_0x31e5('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x31e5('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x31e5('0x3')](_0x31e5('0x1a'),'ASC'),'defaultValue':_0x31e5('0x1a')},'dialPrefix':{'type':Sequelize[_0x31e5('0x5')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x31e5('0x1b')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x31e5('0x1c')}}; \ No newline at end of file +var _0x90e0=['#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','sequelize','exports','STRING','name','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','UNSIGNED','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting'];(function(_0x5c9d46,_0x49fb19){var _0x558e52=function(_0x24fbfb){while(--_0x24fbfb){_0x5c9d46['push'](_0x5c9d46['shift']());}};_0x558e52(++_0x49fb19);}(_0x90e0,0xd4));var _0x090e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x90e0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x090e('0x0'));module[_0x090e('0x1')]={'name':{'type':Sequelize[_0x090e('0x2')],'unique':_0x090e('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x090e('0x2')]},'active':{'type':Sequelize[_0x090e('0x4')],'defaultValue':0x0,'comment':_0x090e('0x5')},'limitCalls':{'type':Sequelize[_0x090e('0x6')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x090e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x090e('0x6')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x090e('0x7')},'dialCongestionMaxRetry':{'type':Sequelize[_0x090e('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x090e('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x090e('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0x090e('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x090e('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0x090e('0x6')](0x5)[_0x090e('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x090e('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x090e('0x6')](0x3)[_0x090e('0x8')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x090e('0x6')](0x5)[_0x090e('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x090e('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0x090e('0x6')](0x3)[_0x090e('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x090e('0xd')},'dialTimezone':{'type':Sequelize[_0x090e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x090e('0x2')],'defaultValue':_0x090e('0xe')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x090e('0xf'),_0x090e('0x10'),_0x090e('0x11')),'defaultValue':_0x090e('0xf')},'dialAMDActive':{'type':Sequelize[_0x090e('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x090e('0x12')},'dialAMDGreeting':{'type':Sequelize[_0x090e('0x6')](0x9)[_0x090e('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x090e('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x090e('0x6')](0x9)[_0x090e('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x090e('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x090e('0x6')](0x9)[_0x090e('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x090e('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x090e('0x6')](0x9)[_0x090e('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x090e('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x090e('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x090e('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x090e('0x6')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x090e('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x090e('0x6')](0x5)[_0x090e('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x090e('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x090e('0x6')](0x9)[_0x090e('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x090e('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x090e('0x1b')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x090e('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x090e('0x1c')},'dialCutDigit':{'type':Sequelize[_0x090e('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 83f9199..10687eb 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 _0xcac3=['calleridnum','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','onlyIfOpen','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','push','sequelize','all','removeLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','Campaign','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','day','add','merge','filter','where','map','includeAll','include','findAll','rows','catch','show','params','options','create','body','clone','omit','createdAt','updatedAt','find','findOne','CmHopper','getHopperHistories','hasOwnProperty','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','CampaignId','getLists','addLists','ids','spread','get','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','NOW()','field','CmListId','toString','from','deletedAt\x20IS\x20NULL'];(function(_0x5045d3,_0x636a8d){var _0x5b3860=function(_0x681a88){while(--_0x681a88){_0x5045d3['push'](_0x5045d3['shift']());}};_0x5b3860(++_0x636a8d);}(_0xcac3,0x193));var _0x3cac=function(_0x5f746f,_0x5b05ab){_0x5f746f=_0x5f746f-0x0;var _0x198d15=_0xcac3[_0x5f746f];return _0x198d15;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3cac('0x0'));var rimraf=require(_0x3cac('0x1'));var zipdir=require(_0x3cac('0x2'));var jsonpatch=require(_0x3cac('0x3'));var rp=require(_0x3cac('0x4'));var moment=require(_0x3cac('0x5'));var BPromise=require(_0x3cac('0x6'));var Mustache=require(_0x3cac('0x7'));var util=require(_0x3cac('0x8'));var path=require(_0x3cac('0x9'));var sox=require(_0x3cac('0xa'));var csv=require(_0x3cac('0xb'));var ejs=require(_0x3cac('0xc'));var fs=require('fs');var _=require(_0x3cac('0xd'));var squel=require(_0x3cac('0xe'));var crypto=require(_0x3cac('0xf'));var jsforce=require(_0x3cac('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x3cac('0xb'));var querystring=require(_0x3cac('0x11'));var Papa=require(_0x3cac('0x12'));var Redis=require(_0x3cac('0x13'));var qs=require(_0x3cac('0x14'));var logger=require('../../config/logger')(_0x3cac('0x15'));var utils=require(_0x3cac('0x16'));var config=require(_0x3cac('0x17'));var db=require(_0x3cac('0x18'))['db'];function respondWithStatusCode(_0x1c5c70,_0x586fcf){_0x586fcf=_0x586fcf||0xcc;return function(_0x56c64e){if(_0x56c64e){return _0x1c5c70[_0x3cac('0x19')](_0x586fcf);}return _0x1c5c70[_0x3cac('0x1a')](_0x586fcf)[_0x3cac('0x1b')]();};}function respondWithResult(_0x134b95,_0x1ad3bf){_0x1ad3bf=_0x1ad3bf||0xc8;return function(_0x2af505){if(_0x2af505){return _0x134b95[_0x3cac('0x1a')](_0x1ad3bf)['json'](_0x2af505);}};}function respondWithFilteredResult(_0x37a3b1,_0x2db008){return function(_0xf24623){if(_0xf24623){var _0x281dfd=_0xf24623[_0x3cac('0x1c')],_0x4680aa=_0x2db008[_0x3cac('0x1d')],_0x8d8927=_0x2db008[_0x3cac('0x1d')]+_0x2db008[_0x3cac('0x1e')],_0x202437;if(_0x8d8927>=_0x281dfd){_0x8d8927=_0x281dfd;_0x202437=0xc8;}else{_0x202437=0xce;}_0x37a3b1[_0x3cac('0x1a')](_0x202437);return _0x37a3b1[_0x3cac('0x1f')](_0x3cac('0x20'),_0x4680aa+'-'+_0x8d8927+'/'+_0x281dfd)[_0x3cac('0x21')](_0xf24623);}return null;};}function patchUpdates(_0x9c768f){return function(_0x752c5b){try{jsonpatch[_0x3cac('0x22')](_0x752c5b,_0x9c768f,!![]);}catch(_0x3cb08f){return BPromise[_0x3cac('0x23')](_0x3cb08f);}return _0x752c5b[_0x3cac('0x24')]();};}function saveUpdates(_0x1dab41,_0x4fa448){return function(_0x14d84b){if(_0x14d84b){return _0x14d84b[_0x3cac('0x25')](_0x1dab41)['then'](function(_0x1d5d41){return _0x1d5d41;});}return null;};}function removeEntity(_0x1ca857,_0x40a088){return function(_0x2f8165){if(_0x2f8165){return _0x2f8165[_0x3cac('0x26')]()[_0x3cac('0x27')](function(){_0x1ca857['status'](0xcc)[_0x3cac('0x1b')]();});}};}function handleEntityNotFound(_0x5baa90,_0x4ef42a){return function(_0x5a78ed){if(!_0x5a78ed){_0x5baa90[_0x3cac('0x19')](0x194);}return _0x5a78ed;};}function handleError(_0x842c3d,_0x2fe8a9){_0x2fe8a9=_0x2fe8a9||0x1f4;return function(_0x12640a){logger[_0x3cac('0x28')](_0x12640a[_0x3cac('0x29')]);if(_0x12640a[_0x3cac('0x2a')]){delete _0x12640a[_0x3cac('0x2a')];}_0x842c3d[_0x3cac('0x1a')](_0x2fe8a9)[_0x3cac('0x2b')](_0x12640a);};}exports[_0x3cac('0x2c')]=function(_0x407e8b,_0x5c60df){var _0x24c4fb={},_0x32cce5={},_0x1aa382={'count':0x0,'rows':[]};var _0x2e74df=db[_0x3cac('0x2d')][_0x3cac('0x2e')];_0x32cce5[_0x3cac('0x2f')]=_[_0x3cac('0x30')](_0x2e74df);var _0xbc5721={'dateStart':_0x407e8b[_0x3cac('0x31')][_0x3cac('0x32')],'dateEnd':_0x407e8b[_0x3cac('0x31')][_0x3cac('0x33')]};delete _0x407e8b[_0x3cac('0x31')][_0x3cac('0x32')];delete _0x407e8b[_0x3cac('0x31')][_0x3cac('0x33')];_0x32cce5[_0x3cac('0x31')]=_[_0x3cac('0x30')](_0x407e8b[_0x3cac('0x31')]);_0x32cce5[_0x3cac('0x34')]=_[_0x3cac('0x35')](_0x32cce5[_0x3cac('0x2f')],_0x32cce5['query']);_0x24c4fb[_0x3cac('0x36')]=_[_0x3cac('0x35')](_0x32cce5[_0x3cac('0x2f')],qs[_0x3cac('0x37')](_0x407e8b[_0x3cac('0x31')]['fields']));_0x24c4fb['attributes']=_0x24c4fb[_0x3cac('0x36')][_0x3cac('0x38')]?_0x24c4fb['attributes']:_0x32cce5[_0x3cac('0x2f')];if(!_0x407e8b['query']['hasOwnProperty'](_0x3cac('0x39'))){_0x24c4fb[_0x3cac('0x1e')]=qs['limit'](_0x407e8b[_0x3cac('0x31')][_0x3cac('0x1e')]);_0x24c4fb[_0x3cac('0x1d')]=qs[_0x3cac('0x1d')](_0x407e8b[_0x3cac('0x31')][_0x3cac('0x1d')]);}_0x24c4fb[_0x3cac('0x3a')]=qs[_0x3cac('0x3b')](_0x407e8b[_0x3cac('0x31')]['sort']);_0x24c4fb['where']=qs[_0x3cac('0x34')](_[_0x3cac('0x3c')](_0x407e8b[_0x3cac('0x31')],_0x32cce5[_0x3cac('0x34')]));if(_0xbc5721[_0x3cac('0x32')]){if(_0xbc5721[_0x3cac('0x33')]){_0xbc5721[_0x3cac('0x33')]=moment(_0xbc5721[_0x3cac('0x33')])['add'](0x1,_0x3cac('0x3d'));}else{_0xbc5721[_0x3cac('0x33')]=moment(_0xbc5721['dateStart'])[_0x3cac('0x3e')](0x1,_0x3cac('0x3d'));}_[_0x3cac('0x3f')](_0x24c4fb['where'],{'createdAt':{'$gte':_0xbc5721['dateStart'],'$lte':_0xbc5721[_0x3cac('0x33')]}});}if(_0x407e8b[_0x3cac('0x31')][_0x3cac('0x40')]){_0x24c4fb[_0x3cac('0x41')]=_[_0x3cac('0x3f')](_0x24c4fb[_0x3cac('0x41')],{'$or':_[_0x3cac('0x42')](_0x24c4fb[_0x3cac('0x36')],function(_0x3d3906){var _0x2cb2c0={};_0x2cb2c0[_0x3d3906]={'$like':'%'+_0x407e8b[_0x3cac('0x31')][_0x3cac('0x40')]+'%'};return _0x2cb2c0;})});}_0x24c4fb=_[_0x3cac('0x3f')]({},_0x24c4fb,_0x407e8b['options']);var _0x25b897={'where':_0x24c4fb['where']};return db[_0x3cac('0x2d')][_0x3cac('0x1c')](_0x25b897)[_0x3cac('0x27')](function(_0xcdabe0){_0x1aa382[_0x3cac('0x1c')]=_0xcdabe0;if(_0x407e8b['query'][_0x3cac('0x43')]){_0x24c4fb[_0x3cac('0x44')]=[{'all':!![]}];}return db[_0x3cac('0x2d')][_0x3cac('0x45')](_0x24c4fb);})[_0x3cac('0x27')](function(_0x455487){_0x1aa382[_0x3cac('0x46')]=_0x455487;return _0x1aa382;})[_0x3cac('0x27')](respondWithFilteredResult(_0x5c60df,_0x24c4fb))[_0x3cac('0x47')](handleError(_0x5c60df,null));};exports[_0x3cac('0x48')]=function(_0xb69c41,_0x435e6a){var _0x55b518={'raw':![],'where':{'id':_0xb69c41[_0x3cac('0x49')]['id']}},_0x5a5aa0={};_0x5a5aa0[_0x3cac('0x2f')]=_['keys'](db[_0x3cac('0x2d')][_0x3cac('0x2e')]);_0x5a5aa0['query']=_[_0x3cac('0x30')](_0xb69c41[_0x3cac('0x31')]);_0x5a5aa0[_0x3cac('0x34')]=_[_0x3cac('0x35')](_0x5a5aa0[_0x3cac('0x2f')],_0x5a5aa0[_0x3cac('0x31')]);_0x55b518[_0x3cac('0x36')]=_[_0x3cac('0x35')](_0x5a5aa0['model'],qs[_0x3cac('0x37')](_0xb69c41['query']['fields']));_0x55b518[_0x3cac('0x36')]=_0x55b518[_0x3cac('0x36')]['length']?_0x55b518[_0x3cac('0x36')]:_0x5a5aa0[_0x3cac('0x2f')];if(_0xb69c41[_0x3cac('0x31')][_0x3cac('0x43')]){_0x55b518[_0x3cac('0x44')]=[{'all':!![]}];}_0x55b518=_['merge']({},_0x55b518,_0xb69c41[_0x3cac('0x4a')]);return db[_0x3cac('0x2d')]['find'](_0x55b518)[_0x3cac('0x27')](handleEntityNotFound(_0x435e6a,null))[_0x3cac('0x27')](respondWithResult(_0x435e6a,null))[_0x3cac('0x47')](handleError(_0x435e6a,null));};exports[_0x3cac('0x4b')]=function(_0x566d46,_0x944fd5){return db[_0x3cac('0x2d')][_0x3cac('0x4b')](_0x566d46[_0x3cac('0x4c')],{})[_0x3cac('0x27')](respondWithResult(_0x944fd5,0xc9))['catch'](handleError(_0x944fd5,null));};exports[_0x3cac('0x4d')]=function(_0x38d7f7,_0x21e322){var _0x48da37={'raw':![],'where':{'id':_0x38d7f7[_0x3cac('0x49')]['id']}},_0xe0b563={};_0xe0b563[_0x3cac('0x2f')]=_[_0x3cac('0x30')](db['Campaign'][_0x3cac('0x2e')]);_0x48da37[_0x3cac('0x36')]=_['intersection'](_0xe0b563[_0x3cac('0x2f')],qs['fields'](_0x38d7f7[_0x3cac('0x31')][_0x3cac('0x37')]));_0x48da37[_0x3cac('0x36')]=_0x48da37['attributes'][_0x3cac('0x38')]?_0x48da37['attributes']:_0xe0b563[_0x3cac('0x2f')];if(_0x38d7f7[_0x3cac('0x31')]['includeAll']){_0x48da37[_0x3cac('0x44')]=[{'all':!![]}];}_0x48da37=_[_0x3cac('0x3f')]({},_0x48da37,_0x38d7f7[_0x3cac('0x4a')]);return db['Campaign']['find'](_0x48da37)['then'](handleEntityNotFound(_0x21e322,null))['then'](function(_0x23bcba){if(_0x23bcba){var _0x3d13b0=_0x23bcba['get']({'plain':!![]});_0x3d13b0=qs[_0x3cac('0x4e')](_0x3d13b0,['id',_0x3cac('0x4f'),_0x3cac('0x50')]);_0x38d7f7[_0x3cac('0x4c')]=_['omit'](_0x38d7f7[_0x3cac('0x4c')],['id','createdAt',_0x3cac('0x50')]);return db[_0x3cac('0x2d')]['create'](_['merge'](_0x3d13b0,_0x38d7f7[_0x3cac('0x4c')]),{'include':_0x38d7f7[_0x3cac('0x31')]['includeAll']?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x21e322,0xc9))[_0x3cac('0x47')](handleError(_0x21e322,null));};exports[_0x3cac('0x25')]=function(_0xfcddd4,_0x2607aa){if(_0xfcddd4[_0x3cac('0x4c')]['id']){delete _0xfcddd4[_0x3cac('0x4c')]['id'];}return db[_0x3cac('0x2d')]['find']({'where':{'id':_0xfcddd4[_0x3cac('0x49')]['id']}})[_0x3cac('0x27')](handleEntityNotFound(_0x2607aa,null))[_0x3cac('0x27')](saveUpdates(_0xfcddd4[_0x3cac('0x4c')],null))[_0x3cac('0x27')](respondWithResult(_0x2607aa,null))[_0x3cac('0x47')](handleError(_0x2607aa,null));};exports[_0x3cac('0x26')]=function(_0x3e8421,_0x465194){return db[_0x3cac('0x2d')][_0x3cac('0x51')]({'where':{'id':_0x3e8421[_0x3cac('0x49')]['id']}})[_0x3cac('0x27')](handleEntityNotFound(_0x465194,null))['then'](removeEntity(_0x465194,null))['catch'](handleError(_0x465194,null));};exports['getHoppers']=function(_0x10532a,_0x4f1fa3,_0xadecd){var _0x491da5={'raw':!![],'where':{}};var _0x9eed0b={};var _0x799f65={'count':0x0,'rows':[]};return db[_0x3cac('0x2d')][_0x3cac('0x52')]({'where':{'id':_0x10532a[_0x3cac('0x49')]['id']}})['then'](handleEntityNotFound(_0x4f1fa3,null))[_0x3cac('0x27')](function(_0x23f4bb){if(_0x23f4bb){_0x9eed0b[_0x3cac('0x2f')]=_[_0x3cac('0x30')](db[_0x3cac('0x53')][_0x3cac('0x2e')]);_0x9eed0b[_0x3cac('0x31')]=_[_0x3cac('0x30')](_0x10532a[_0x3cac('0x31')]);_0x9eed0b[_0x3cac('0x34')]=_['intersection'](_0x9eed0b['model'],_0x9eed0b[_0x3cac('0x31')]);_0x491da5[_0x3cac('0x36')]=_[_0x3cac('0x35')](_0x9eed0b[_0x3cac('0x2f')],qs[_0x3cac('0x37')](_0x10532a[_0x3cac('0x31')]['fields']));_0x491da5[_0x3cac('0x36')]=_0x491da5[_0x3cac('0x36')][_0x3cac('0x38')]?_0x491da5[_0x3cac('0x36')]:_0x9eed0b[_0x3cac('0x2f')];if(!_0x10532a['query']['hasOwnProperty']('nolimit')){_0x491da5['limit']=qs[_0x3cac('0x1e')](_0x10532a[_0x3cac('0x31')][_0x3cac('0x1e')]);_0x491da5['offset']=qs[_0x3cac('0x1d')](_0x10532a[_0x3cac('0x31')][_0x3cac('0x1d')]);}_0x491da5[_0x3cac('0x3a')]=qs[_0x3cac('0x3b')](_0x10532a[_0x3cac('0x31')]['sort']);_0x491da5[_0x3cac('0x41')]=qs['filters'](_[_0x3cac('0x3c')](_0x10532a[_0x3cac('0x31')],_0x9eed0b[_0x3cac('0x34')]));_0x491da5[_0x3cac('0x41')]['CampaignId']=_0x23f4bb['id'];if(_0x10532a[_0x3cac('0x31')]['filter']){_0x491da5[_0x3cac('0x41')]=_[_0x3cac('0x3f')](_0x491da5[_0x3cac('0x41')],{'$or':_[_0x3cac('0x42')](_0x491da5[_0x3cac('0x36')],function(_0x356ff0){var _0xba3d18={};_0xba3d18[_0x356ff0]={'$like':'%'+_0x10532a[_0x3cac('0x31')][_0x3cac('0x40')]+'%'};return _0xba3d18;})});}_0x491da5=_['merge']({},_0x491da5,_0x10532a['options']);return db[_0x3cac('0x53')][_0x3cac('0x1c')]({'where':_0x491da5['where']})[_0x3cac('0x27')](function(_0x109c5f){_0x799f65[_0x3cac('0x1c')]=_0x109c5f;if(_0x10532a['query']['includeAll']){_0x491da5[_0x3cac('0x44')]=[{'all':!![]}];}return db[_0x3cac('0x53')][_0x3cac('0x45')](_0x491da5);})[_0x3cac('0x27')](function(_0xeaf51e){_0x799f65[_0x3cac('0x46')]=_0xeaf51e;return _0x799f65;});}})[_0x3cac('0x27')](respondWithFilteredResult(_0x4f1fa3,_0x491da5))['catch'](handleError(_0x4f1fa3,null));};exports[_0x3cac('0x54')]=function(_0x162587,_0x21533b,_0x225709){var _0x224d52={'raw':!![],'where':{}};var _0x5310dc={};var _0x4428d2={'count':0x0,'rows':[]};return db['Campaign'][_0x3cac('0x52')]({'where':{'id':_0x162587['params']['id']}})['then'](handleEntityNotFound(_0x21533b,null))[_0x3cac('0x27')](function(_0x51cd8a){if(_0x51cd8a){_0x5310dc['model']=_[_0x3cac('0x30')](db['CmHopperHistory'][_0x3cac('0x2e')]);_0x5310dc[_0x3cac('0x31')]=_[_0x3cac('0x30')](_0x162587[_0x3cac('0x31')]);_0x5310dc[_0x3cac('0x34')]=_[_0x3cac('0x35')](_0x5310dc[_0x3cac('0x2f')],_0x5310dc['query']);_0x224d52[_0x3cac('0x36')]=_[_0x3cac('0x35')](_0x5310dc[_0x3cac('0x2f')],qs['fields'](_0x162587['query'][_0x3cac('0x37')]));_0x224d52[_0x3cac('0x36')]=_0x224d52[_0x3cac('0x36')]['length']?_0x224d52['attributes']:_0x5310dc[_0x3cac('0x2f')];if(!_0x162587['query'][_0x3cac('0x55')](_0x3cac('0x39'))){_0x224d52[_0x3cac('0x1e')]=qs[_0x3cac('0x1e')](_0x162587[_0x3cac('0x31')][_0x3cac('0x1e')]);_0x224d52[_0x3cac('0x1d')]=qs[_0x3cac('0x1d')](_0x162587[_0x3cac('0x31')][_0x3cac('0x1d')]);}_0x224d52[_0x3cac('0x3a')]=qs[_0x3cac('0x3b')](_0x162587[_0x3cac('0x31')][_0x3cac('0x3b')]);_0x224d52[_0x3cac('0x41')]=qs['filters'](_[_0x3cac('0x3c')](_0x162587[_0x3cac('0x31')],_0x5310dc[_0x3cac('0x34')]));_0x224d52['where']['CampaignId']=_0x51cd8a['id'];if(_0x162587[_0x3cac('0x31')]['filter']){_0x224d52[_0x3cac('0x41')]=_[_0x3cac('0x3f')](_0x224d52[_0x3cac('0x41')],{'$or':_[_0x3cac('0x42')](_0x224d52[_0x3cac('0x36')],function(_0x8d257a){var _0x4476ca={};_0x4476ca[_0x8d257a]={'$like':'%'+_0x162587[_0x3cac('0x31')][_0x3cac('0x40')]+'%'};return _0x4476ca;})});}_0x224d52=_[_0x3cac('0x3f')]({},_0x224d52,_0x162587[_0x3cac('0x4a')]);return db[_0x3cac('0x56')][_0x3cac('0x1c')]({'where':_0x224d52[_0x3cac('0x41')]})['then'](function(_0x2167e4){_0x4428d2['count']=_0x2167e4;if(_0x162587[_0x3cac('0x31')]['includeAll']){_0x224d52[_0x3cac('0x44')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x3cac('0x45')](_0x224d52);})['then'](function(_0x4f3a38){_0x4428d2[_0x3cac('0x46')]=_0x4f3a38;return _0x4428d2;});}})[_0x3cac('0x27')](respondWithFilteredResult(_0x21533b,_0x224d52))[_0x3cac('0x47')](handleError(_0x21533b,null));};exports['getHopperFinals']=function(_0x33e471,_0x50d449,_0xd2f32){var _0x5eec7={'raw':!![],'where':{}};var _0x381180={};var _0x49d7ca={'count':0x0,'rows':[]};return db[_0x3cac('0x2d')][_0x3cac('0x52')]({'where':{'id':_0x33e471[_0x3cac('0x49')]['id']}})[_0x3cac('0x27')](handleEntityNotFound(_0x50d449,null))[_0x3cac('0x27')](function(_0x1e1edf){if(_0x1e1edf){_0x381180[_0x3cac('0x2f')]=_['keys'](db[_0x3cac('0x57')][_0x3cac('0x2e')]);_0x381180[_0x3cac('0x31')]=_['keys'](_0x33e471[_0x3cac('0x31')]);_0x381180[_0x3cac('0x34')]=_[_0x3cac('0x35')](_0x381180[_0x3cac('0x2f')],_0x381180[_0x3cac('0x31')]);_0x5eec7[_0x3cac('0x36')]=_[_0x3cac('0x35')](_0x381180[_0x3cac('0x2f')],qs['fields'](_0x33e471[_0x3cac('0x31')][_0x3cac('0x37')]));_0x5eec7[_0x3cac('0x36')]=_0x5eec7[_0x3cac('0x36')]['length']?_0x5eec7['attributes']:_0x381180[_0x3cac('0x2f')];if(!_0x33e471[_0x3cac('0x31')]['hasOwnProperty'](_0x3cac('0x39'))){_0x5eec7[_0x3cac('0x1e')]=qs['limit'](_0x33e471[_0x3cac('0x31')][_0x3cac('0x1e')]);_0x5eec7['offset']=qs[_0x3cac('0x1d')](_0x33e471[_0x3cac('0x31')]['offset']);}_0x5eec7[_0x3cac('0x3a')]=qs['sort'](_0x33e471[_0x3cac('0x31')][_0x3cac('0x3b')]);_0x5eec7[_0x3cac('0x41')]=qs[_0x3cac('0x34')](_[_0x3cac('0x3c')](_0x33e471[_0x3cac('0x31')],_0x381180['filters']));_0x5eec7['where']['CampaignId']=_0x1e1edf['id'];if(_0x33e471[_0x3cac('0x31')][_0x3cac('0x40')]){_0x5eec7['where']=_[_0x3cac('0x3f')](_0x5eec7[_0x3cac('0x41')],{'$or':_[_0x3cac('0x42')](_0x5eec7[_0x3cac('0x36')],function(_0x3aee2b){var _0x43643f={};_0x43643f[_0x3aee2b]={'$like':'%'+_0x33e471[_0x3cac('0x31')][_0x3cac('0x40')]+'%'};return _0x43643f;})});}_0x5eec7=_[_0x3cac('0x3f')]({},_0x5eec7,_0x33e471[_0x3cac('0x4a')]);return db[_0x3cac('0x57')]['count']({'where':_0x5eec7[_0x3cac('0x41')]})[_0x3cac('0x27')](function(_0x59a8bc){_0x49d7ca[_0x3cac('0x1c')]=_0x59a8bc;if(_0x33e471[_0x3cac('0x31')][_0x3cac('0x43')]){_0x5eec7[_0x3cac('0x44')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x3cac('0x45')](_0x5eec7);})[_0x3cac('0x27')](function(_0x427ce5){_0x49d7ca[_0x3cac('0x46')]=_0x427ce5;return _0x49d7ca;});}})['then'](respondWithFilteredResult(_0x50d449,_0x5eec7))[_0x3cac('0x47')](handleError(_0x50d449,null));};exports[_0x3cac('0x58')]=function(_0x3556b7,_0x2bd686,_0x434a11){var _0x1c8dfa={'raw':!![],'where':{}};var _0x49dad6={};var _0x4fcca3={'count':0x0,'rows':[]};return db[_0x3cac('0x2d')][_0x3cac('0x52')]({'where':{'id':_0x3556b7[_0x3cac('0x49')]['id']}})[_0x3cac('0x27')](handleEntityNotFound(_0x2bd686,null))[_0x3cac('0x27')](function(_0x179a5a){if(_0x179a5a){_0x49dad6[_0x3cac('0x2f')]=_[_0x3cac('0x30')](db[_0x3cac('0x59')]['rawAttributes']);_0x49dad6[_0x3cac('0x31')]=_[_0x3cac('0x30')](_0x3556b7[_0x3cac('0x31')]);_0x49dad6[_0x3cac('0x34')]=_[_0x3cac('0x35')](_0x49dad6[_0x3cac('0x2f')],_0x49dad6['query']);_0x1c8dfa['attributes']=_['intersection'](_0x49dad6[_0x3cac('0x2f')],qs[_0x3cac('0x37')](_0x3556b7['query'][_0x3cac('0x37')]));_0x1c8dfa[_0x3cac('0x36')]=_0x1c8dfa[_0x3cac('0x36')][_0x3cac('0x38')]?_0x1c8dfa[_0x3cac('0x36')]:_0x49dad6[_0x3cac('0x2f')];if(!_0x3556b7['query'][_0x3cac('0x55')](_0x3cac('0x39'))){_0x1c8dfa[_0x3cac('0x1e')]=qs[_0x3cac('0x1e')](_0x3556b7[_0x3cac('0x31')][_0x3cac('0x1e')]);_0x1c8dfa[_0x3cac('0x1d')]=qs[_0x3cac('0x1d')](_0x3556b7[_0x3cac('0x31')]['offset']);}_0x1c8dfa[_0x3cac('0x3a')]=qs[_0x3cac('0x3b')](_0x3556b7[_0x3cac('0x31')][_0x3cac('0x3b')]);_0x1c8dfa[_0x3cac('0x41')]=qs[_0x3cac('0x34')](_[_0x3cac('0x3c')](_0x3556b7[_0x3cac('0x31')],_0x49dad6[_0x3cac('0x34')]));_0x1c8dfa['where'][_0x3cac('0x5a')]=_0x179a5a['id'];if(_0x3556b7[_0x3cac('0x31')][_0x3cac('0x40')]){_0x1c8dfa['where']=_[_0x3cac('0x3f')](_0x1c8dfa['where'],{'$or':_['map'](_0x1c8dfa[_0x3cac('0x36')],function(_0xd4cdb3){var _0x4a4a4c={};_0x4a4a4c[_0xd4cdb3]={'$like':'%'+_0x3556b7[_0x3cac('0x31')]['filter']+'%'};return _0x4a4a4c;})});}_0x1c8dfa=_[_0x3cac('0x3f')]({},_0x1c8dfa,_0x3556b7['options']);return db['CmHopperBlack'][_0x3cac('0x1c')]({'where':_0x1c8dfa[_0x3cac('0x41')]})[_0x3cac('0x27')](function(_0x2b6e90){_0x4fcca3[_0x3cac('0x1c')]=_0x2b6e90;if(_0x3556b7[_0x3cac('0x31')][_0x3cac('0x43')]){_0x1c8dfa['include']=[{'all':!![]}];}return db[_0x3cac('0x59')][_0x3cac('0x45')](_0x1c8dfa);})[_0x3cac('0x27')](function(_0x5081b6){_0x4fcca3[_0x3cac('0x46')]=_0x5081b6;return _0x4fcca3;});}})[_0x3cac('0x27')](respondWithFilteredResult(_0x2bd686,_0x1c8dfa))['catch'](handleError(_0x2bd686,null));};exports[_0x3cac('0x5b')]=function(_0x2251a9,_0x381a19,_0x3367d8){var _0x1eb56d={};var _0x3b1305={};var _0x2584c7;var _0x3aaa2d;return db['Campaign']['findOne']({'where':{'id':_0x2251a9['params']['id']}})[_0x3cac('0x27')](handleEntityNotFound(_0x381a19,null))[_0x3cac('0x27')](function(_0x45b404){if(_0x45b404){_0x2584c7=_0x45b404;_0x3b1305[_0x3cac('0x2f')]=_[_0x3cac('0x30')](db['CmList'][_0x3cac('0x2e')]);_0x3b1305['query']=_[_0x3cac('0x30')](_0x2251a9[_0x3cac('0x31')]);_0x3b1305[_0x3cac('0x34')]=_[_0x3cac('0x35')](_0x3b1305[_0x3cac('0x2f')],_0x3b1305['query']);_0x1eb56d[_0x3cac('0x36')]=_[_0x3cac('0x35')](_0x3b1305[_0x3cac('0x2f')],qs[_0x3cac('0x37')](_0x2251a9[_0x3cac('0x31')][_0x3cac('0x37')]));_0x1eb56d[_0x3cac('0x36')]=_0x1eb56d[_0x3cac('0x36')]['length']?_0x1eb56d[_0x3cac('0x36')]:_0x3b1305[_0x3cac('0x2f')];_0x1eb56d[_0x3cac('0x3a')]=qs[_0x3cac('0x3b')](_0x2251a9[_0x3cac('0x31')][_0x3cac('0x3b')]);_0x1eb56d[_0x3cac('0x41')]=qs[_0x3cac('0x34')](_[_0x3cac('0x3c')](_0x2251a9[_0x3cac('0x31')],_0x3b1305[_0x3cac('0x34')]));if(_0x2251a9[_0x3cac('0x31')][_0x3cac('0x40')]){_0x1eb56d['where']=_[_0x3cac('0x3f')](_0x1eb56d['where'],{'$or':_['map'](_0x1eb56d[_0x3cac('0x36')],function(_0x4897d0){var _0x2716e0={};_0x2716e0[_0x4897d0]={'$like':'%'+_0x2251a9[_0x3cac('0x31')][_0x3cac('0x40')]+'%'};return _0x2716e0;})});}_0x1eb56d=_[_0x3cac('0x3f')]({},_0x1eb56d,_0x2251a9[_0x3cac('0x4a')]);return _0x2584c7[_0x3cac('0x5b')](_0x1eb56d);}})[_0x3cac('0x27')](function(_0x5e7c7a){if(_0x5e7c7a){_0x3aaa2d=_0x5e7c7a[_0x3cac('0x38')];if(!_0x2251a9[_0x3cac('0x31')][_0x3cac('0x55')]('nolimit')){_0x1eb56d[_0x3cac('0x1e')]=qs[_0x3cac('0x1e')](_0x2251a9[_0x3cac('0x31')][_0x3cac('0x1e')]);_0x1eb56d[_0x3cac('0x1d')]=qs[_0x3cac('0x1d')](_0x2251a9[_0x3cac('0x31')][_0x3cac('0x1d')]);}return _0x2584c7[_0x3cac('0x5b')](_0x1eb56d);}})[_0x3cac('0x27')](function(_0x251306){if(_0x251306){return _0x251306?{'count':_0x3aaa2d,'rows':_0x251306}:null;}})[_0x3cac('0x27')](respondWithResult(_0x381a19,null))[_0x3cac('0x47')](handleError(_0x381a19,null));};exports[_0x3cac('0x5c')]=function(_0x1cdcde,_0x598e72,_0xc7da07){var _0x56df1e,_0x248b69;return db[_0x3cac('0x2d')][_0x3cac('0x51')]({'where':{'id':_0x1cdcde['params']['id']}})[_0x3cac('0x27')](handleEntityNotFound(_0x598e72,null))['then'](function(_0x1a2c99){if(_0x1a2c99){_0x248b69=_0x1a2c99;return _0x1a2c99[_0x3cac('0x5c')](_0x1cdcde['body'][_0x3cac('0x5d')],_[_0x3cac('0x4e')](_0x1cdcde[_0x3cac('0x4c')],[_0x3cac('0x5d'),'id'])||{});}return null;})[_0x3cac('0x5e')](function(_0x3a78e9){var _0x4cd5f0;_0x56df1e=_0x3a78e9||[];var _0x1b2d9=[];if(_0x3a78e9){for(var _0x5a2eb6=0x0;_0x5a2eb6<_0x3a78e9['length'];_0x5a2eb6+=0x1){var _0xb7cca0=_0x3a78e9[_0x5a2eb6][_0x3cac('0x5f')]({'plain':!![]});_0x248b69[_0x3cac('0x60')]=_0x1cdcde['body'][_0x3cac('0x60')]?_0x1cdcde[_0x3cac('0x4c')][_0x3cac('0x60')]:_0x248b69[_0x3cac('0x60')];switch(_0x248b69[_0x3cac('0x60')]){case _0x3cac('0x61'):_0x4cd5f0=squel[_0x3cac('0x62')]()[_0x3cac('0x63')](_0x3cac('0x64'))[_0x3cac('0x65')]([_0x3cac('0x66'),_0x3cac('0x67'),_0x3cac('0x68'),_0x3cac('0x69'),_0x3cac('0x5a'),_0x3cac('0x4f'),'updatedAt'],squel[_0x3cac('0x6a')]()['field']('phone',_0x3cac('0x66'))['field'](_0x3cac('0x6b'),_0x3cac('0x67'))[_0x3cac('0x6c')]('id','ContactId')[_0x3cac('0x6c')](_0xb7cca0[_0x3cac('0x6d')][_0x3cac('0x6e')](),_0x3cac('0x69'))[_0x3cac('0x6c')](_0x1cdcde['params']['id'][_0x3cac('0x6e')](),_0x3cac('0x5a'))[_0x3cac('0x6c')](_0x3cac('0x6b'),'createdAt')['field'](_0x3cac('0x6b'),_0x3cac('0x50'))[_0x3cac('0x6f')]('cm_contacts')['where'](_0x3cac('0x70'))[_0x3cac('0x41')]('ListId\x20=\x20?',_0xb7cca0[_0x3cac('0x6d')]['toString']())[_0x3cac('0x41')]('phone\x20IS\x20NOT\x20NULL')[_0x3cac('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3cac('0x6a')]()[_0x3cac('0x6c')](_0x3cac('0x71'))[_0x3cac('0x6f')](_0x3cac('0x72'))[_0x3cac('0x41')](_0x3cac('0x73'),_0x1cdcde[_0x3cac('0x49')]['id'][_0x3cac('0x6e')]()))['where'](_0x3cac('0x74'),squel['select']()[_0x3cac('0x6c')](_0x3cac('0x66'))[_0x3cac('0x6f')]('cm_hopper')[_0x3cac('0x41')](_0x3cac('0x73'),_0x1cdcde[_0x3cac('0x49')]['id']['toString']())))[_0x3cac('0x6e')]();break;case _0x3cac('0x75'):_0x4cd5f0=squel[_0x3cac('0x62')]()[_0x3cac('0x63')](_0x3cac('0x64'))[_0x3cac('0x65')]([_0x3cac('0x66'),'scheduledAt','ContactId',_0x3cac('0x69'),_0x3cac('0x5a'),_0x3cac('0x4f'),'updatedAt'],squel[_0x3cac('0x6a')]()[_0x3cac('0x6c')](_0x3cac('0x66'),_0x3cac('0x66'))['field'](_0x3cac('0x6b'),_0x3cac('0x67'))[_0x3cac('0x6c')]('id','ContactId')[_0x3cac('0x6c')](_0xb7cca0['CmListId'][_0x3cac('0x6e')](),'ListId')[_0x3cac('0x6c')](_0x1cdcde[_0x3cac('0x49')]['id'][_0x3cac('0x6e')](),'CampaignId')[_0x3cac('0x6c')](_0x3cac('0x6b'),_0x3cac('0x4f'))[_0x3cac('0x6c')](_0x3cac('0x6b'),_0x3cac('0x50'))[_0x3cac('0x6f')](_0x3cac('0x76'))[_0x3cac('0x41')](_0x3cac('0x70'))[_0x3cac('0x41')](_0x3cac('0x77'),_0xb7cca0[_0x3cac('0x6d')][_0x3cac('0x6e')]())[_0x3cac('0x41')](_0x3cac('0x78'))['where'](_0x3cac('0x74'),squel['select']()[_0x3cac('0x6c')](_0x3cac('0x66'))[_0x3cac('0x6f')]('cm_hopper')[_0x3cac('0x41')]('CampaignId\x20=\x20?',_0x1cdcde[_0x3cac('0x49')]['id'][_0x3cac('0x6e')]())))[_0x3cac('0x6e')]();break;default:_0x4cd5f0=squel['insert']()['into'](_0x3cac('0x64'))['fromQuery'](['phone',_0x3cac('0x67'),_0x3cac('0x68'),_0x3cac('0x69'),_0x3cac('0x5a'),_0x3cac('0x4f'),_0x3cac('0x50')],squel[_0x3cac('0x6a')]()[_0x3cac('0x6c')](_0x3cac('0x66'),_0x3cac('0x66'))[_0x3cac('0x6c')]('NOW()',_0x3cac('0x67'))[_0x3cac('0x6c')]('id',_0x3cac('0x68'))[_0x3cac('0x6c')](_0xb7cca0[_0x3cac('0x6d')][_0x3cac('0x6e')](),_0x3cac('0x69'))['field'](_0x1cdcde[_0x3cac('0x49')]['id'][_0x3cac('0x6e')](),'CampaignId')[_0x3cac('0x6c')](_0x3cac('0x6b'),'createdAt')[_0x3cac('0x6c')]('NOW()',_0x3cac('0x50'))[_0x3cac('0x6f')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x3cac('0x41')](_0x3cac('0x77'),_0xb7cca0[_0x3cac('0x6d')][_0x3cac('0x6e')]())[_0x3cac('0x41')](_0x3cac('0x78')))[_0x3cac('0x6e')]();}_0x1b2d9[_0x3cac('0x79')](db[_0x3cac('0x7a')][_0x3cac('0x31')](_0x4cd5f0));}return BPromise[_0x3cac('0x7b')](_0x1b2d9);}})[_0x3cac('0x27')](function(){return _0x56df1e;})[_0x3cac('0x27')](respondWithResult(_0x598e72,null))[_0x3cac('0x47')](handleError(_0x598e72,null));};exports[_0x3cac('0x7c')]=function(_0x3f108f,_0x2ca5ac,_0x6ed7a1){var _0x12a076;return db[_0x3cac('0x2d')][_0x3cac('0x51')]({'where':{'id':_0x3f108f[_0x3cac('0x49')]['id']}})[_0x3cac('0x27')](handleEntityNotFound(_0x2ca5ac,null))['then'](function(_0x4602d8){if(_0x4602d8){return _0x4602d8[_0x3cac('0x7c')](_0x3f108f['query'][_0x3cac('0x5d')]);}})['then'](function(_0x548674){if(_0x548674){_0x12a076=_0x548674;return db[_0x3cac('0x53')][_0x3cac('0x26')]({'where':{'ListId':_0x3f108f[_0x3cac('0x31')][_0x3cac('0x5d')],'CampaignId':_0x3f108f['params']['id']}})['then'](function(){return _0x12a076;});}})['then'](respondWithStatusCode(_0x2ca5ac,null))[_0x3cac('0x47')](handleError(_0x2ca5ac,null));};exports['getBlackLists']=function(_0x34c11f,_0x54c0e3,_0xc367ee){var _0x4de37e={'raw':!![],'where':{}};var _0x1e192e={};var _0x4ec851={'count':0x0,'rows':[]};return db[_0x3cac('0x2d')][_0x3cac('0x52')]({'where':{'id':_0x34c11f['params']['id']}})[_0x3cac('0x27')](handleEntityNotFound(_0x54c0e3,null))[_0x3cac('0x27')](function(_0x1ff7ca){if(_0x1ff7ca){_0x1e192e[_0x3cac('0x2f')]=_[_0x3cac('0x30')](db['CmList']['rawAttributes']);_0x1e192e[_0x3cac('0x31')]=_[_0x3cac('0x30')](_0x34c11f[_0x3cac('0x31')]);_0x1e192e[_0x3cac('0x34')]=_['intersection'](_0x1e192e[_0x3cac('0x2f')],_0x1e192e[_0x3cac('0x31')]);_0x4de37e[_0x3cac('0x36')]=_[_0x3cac('0x35')](_0x1e192e['model'],qs[_0x3cac('0x37')](_0x34c11f[_0x3cac('0x31')][_0x3cac('0x37')]));_0x4de37e[_0x3cac('0x36')]=_0x4de37e['attributes'][_0x3cac('0x38')]?_0x4de37e[_0x3cac('0x36')]:_0x1e192e[_0x3cac('0x2f')];if(!_0x34c11f[_0x3cac('0x31')][_0x3cac('0x55')]('nolimit')){_0x4de37e[_0x3cac('0x1e')]=qs[_0x3cac('0x1e')](_0x34c11f['query']['limit']);_0x4de37e['offset']=qs[_0x3cac('0x1d')](_0x34c11f[_0x3cac('0x31')][_0x3cac('0x1d')]);}_0x4de37e[_0x3cac('0x3a')]=qs[_0x3cac('0x3b')](_0x34c11f['query'][_0x3cac('0x3b')]);_0x4de37e['where']=qs[_0x3cac('0x34')](_[_0x3cac('0x3c')](_0x34c11f[_0x3cac('0x31')],_0x1e192e[_0x3cac('0x34')]));_0x4de37e[_0x3cac('0x41')][_0x3cac('0x5a')]=_0x1ff7ca['id'];if(_0x34c11f[_0x3cac('0x31')]['filter']){_0x4de37e[_0x3cac('0x41')]=_[_0x3cac('0x3f')](_0x4de37e['where'],{'$or':_[_0x3cac('0x42')](_0x4de37e[_0x3cac('0x36')],function(_0x4e66dc){var _0x461c85={};_0x461c85[_0x4e66dc]={'$like':'%'+_0x34c11f[_0x3cac('0x31')][_0x3cac('0x40')]+'%'};return _0x461c85;})});}_0x4de37e=_[_0x3cac('0x3f')]({},_0x4de37e,_0x34c11f[_0x3cac('0x4a')]);return db[_0x3cac('0x7d')][_0x3cac('0x1c')]({'where':_0x4de37e[_0x3cac('0x41')]})[_0x3cac('0x27')](function(_0x11ece8){_0x4ec851[_0x3cac('0x1c')]=_0x11ece8;if(_0x34c11f[_0x3cac('0x31')]['includeAll']){_0x4de37e[_0x3cac('0x44')]=[{'all':!![]}];}return db[_0x3cac('0x7d')][_0x3cac('0x45')](_0x4de37e);})['then'](function(_0xd6005e){_0x4ec851[_0x3cac('0x46')]=_0xd6005e;return _0x4ec851;});}})[_0x3cac('0x27')](respondWithFilteredResult(_0x54c0e3,_0x4de37e))[_0x3cac('0x47')](handleError(_0x54c0e3,null));};exports[_0x3cac('0x7e')]=function(_0x15aad3,_0xd1ba7f,_0x2f7e2c){var _0x4937cd,_0x1d247a;return db['Campaign'][_0x3cac('0x51')]({'where':{'id':_0x15aad3[_0x3cac('0x49')]['id']}})[_0x3cac('0x27')](handleEntityNotFound(_0xd1ba7f,null))[_0x3cac('0x27')](function(_0x4e31c9){if(_0x4e31c9){_0x1d247a=_0x4e31c9;return _0x4e31c9[_0x3cac('0x7e')](_0x15aad3['body']['ids'],_['omit'](_0x15aad3['body'],[_0x3cac('0x5d'),'id'])||{});}return null;})[_0x3cac('0x5e')](function(_0xac274d){var _0x390ad8;_0x4937cd=_0xac274d||[];var _0x2a07ab=[];if(_0xac274d){for(var _0x12b0ae=0x0;_0x12b0ae<_0xac274d['length'];_0x12b0ae+=0x1){var _0x1bf45a=_0xac274d[_0x12b0ae]['get']({'plain':!![]});_0x390ad8=squel['insert']()[_0x3cac('0x63')](_0x3cac('0x7f'))[_0x3cac('0x65')](['phone',_0x3cac('0x68'),_0x3cac('0x69'),_0x3cac('0x5a'),_0x3cac('0x4f'),'updatedAt'],squel[_0x3cac('0x6a')]()[_0x3cac('0x6c')]('phone',_0x3cac('0x66'))['field']('id',_0x3cac('0x68'))[_0x3cac('0x6c')](_0x1bf45a['CmListId'][_0x3cac('0x6e')](),_0x3cac('0x69'))[_0x3cac('0x6c')](_0x15aad3[_0x3cac('0x49')]['id'][_0x3cac('0x6e')](),_0x3cac('0x5a'))['field']('NOW()',_0x3cac('0x4f'))[_0x3cac('0x6c')](_0x3cac('0x6b'),_0x3cac('0x50'))[_0x3cac('0x6f')](_0x3cac('0x76'))[_0x3cac('0x41')]('deletedAt\x20IS\x20NULL')[_0x3cac('0x41')](_0x3cac('0x77'),_0x1bf45a['CmListId'][_0x3cac('0x6e')]())[_0x3cac('0x41')](_0x3cac('0x78')))[_0x3cac('0x6e')]();_0x2a07ab[_0x3cac('0x79')](db[_0x3cac('0x7a')]['query'](_0x390ad8));}return BPromise[_0x3cac('0x7b')](_0x2a07ab);}})[_0x3cac('0x27')](function(){return _0x4937cd;})[_0x3cac('0x27')](respondWithResult(_0xd1ba7f,null))['catch'](handleError(_0xd1ba7f,null));};exports['removeBlackLists']=function(_0x39cc09,_0x3f7a6b,_0x59ff92){var _0x2021be;return db['Campaign'][_0x3cac('0x51')]({'where':{'id':_0x39cc09[_0x3cac('0x49')]['id']}})[_0x3cac('0x27')](handleEntityNotFound(_0x3f7a6b,null))[_0x3cac('0x27')](function(_0x391984){if(_0x391984){return _0x391984[_0x3cac('0x80')](_0x39cc09[_0x3cac('0x31')]['ids']);}})[_0x3cac('0x27')](function(_0x50e242){if(_0x50e242){_0x2021be=_0x50e242;return db[_0x3cac('0x59')][_0x3cac('0x26')]({'where':{'ListId':_0x39cc09[_0x3cac('0x31')][_0x3cac('0x5d')],'CampaignId':_0x39cc09[_0x3cac('0x49')]['id']}})[_0x3cac('0x27')](function(){return _0x2021be;});}})[_0x3cac('0x27')](respondWithStatusCode(_0x3f7a6b,null))[_0x3cac('0x47')](handleError(_0x3f7a6b,null));}; \ No newline at end of file +var _0x6db4=['field','NOW()','CmListId','toString','phone\x20NOT\x20IN\x20(?)','from','cm_hopper_final','cm_hopper','CampaignId\x20=\x20?','onlyIfOpen','fromQuery','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','sequelize','all','removeLists','destroy','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','set','Content-Range','json','apply','save','error','name','send','index','Campaign','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','add','day','merge','filter','map','options','count','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','clone','get','omit','createdAt','updatedAt','getHoppers','findOne','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','dialCheckDuplicateType','always','insert','into','phone','scheduledAt','ContactId','ListId','select'];(function(_0x2f1cde,_0x46ced5){var _0x26fe11=function(_0x24897c){while(--_0x24897c){_0x2f1cde['push'](_0x2f1cde['shift']());}};_0x26fe11(++_0x46ced5);}(_0x6db4,0x111));var _0x46db=function(_0xb94b68,_0x30a90d){_0xb94b68=_0xb94b68-0x0;var _0x3e9fc8=_0x6db4[_0xb94b68];return _0x3e9fc8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x46db('0x0'));var rimraf=require(_0x46db('0x1'));var zipdir=require(_0x46db('0x2'));var jsonpatch=require(_0x46db('0x3'));var rp=require(_0x46db('0x4'));var moment=require(_0x46db('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x46db('0x6'));var util=require(_0x46db('0x7'));var path=require(_0x46db('0x8'));var sox=require(_0x46db('0x9'));var csv=require(_0x46db('0xa'));var ejs=require(_0x46db('0xb'));var fs=require('fs');var _=require(_0x46db('0xc'));var squel=require('squel');var crypto=require(_0x46db('0xd'));var jsforce=require(_0x46db('0xe'));var deskjs=require(_0x46db('0xf'));var toCsv=require(_0x46db('0xa'));var querystring=require(_0x46db('0x10'));var Papa=require(_0x46db('0x11'));var Redis=require(_0x46db('0x12'));var qs=require(_0x46db('0x13'));var logger=require(_0x46db('0x14'))(_0x46db('0x15'));var utils=require(_0x46db('0x16'));var config=require(_0x46db('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x334d40,_0x395ed9){_0x395ed9=_0x395ed9||0xcc;return function(_0x2aa269){if(_0x2aa269){return _0x334d40[_0x46db('0x18')](_0x395ed9);}return _0x334d40[_0x46db('0x19')](_0x395ed9)[_0x46db('0x1a')]();};}function respondWithResult(_0x44bd9a,_0x2af32c){_0x2af32c=_0x2af32c||0xc8;return function(_0x3da5ae){if(_0x3da5ae){return _0x44bd9a['status'](_0x2af32c)['json'](_0x3da5ae);}};}function respondWithFilteredResult(_0x5f3f69,_0x417caf){return function(_0xed8db9){if(_0xed8db9){var _0x5c982c=_0xed8db9['count'],_0x1a79a6=_0x417caf[_0x46db('0x1b')],_0x479544=_0x417caf[_0x46db('0x1b')]+_0x417caf['limit'],_0x30e5a9;if(_0x479544>=_0x5c982c){_0x479544=_0x5c982c;_0x30e5a9=0xc8;}else{_0x30e5a9=0xce;}_0x5f3f69[_0x46db('0x19')](_0x30e5a9);return _0x5f3f69[_0x46db('0x1c')](_0x46db('0x1d'),_0x1a79a6+'-'+_0x479544+'/'+_0x5c982c)[_0x46db('0x1e')](_0xed8db9);}return null;};}function patchUpdates(_0x1e24e6){return function(_0x34101d){try{jsonpatch[_0x46db('0x1f')](_0x34101d,_0x1e24e6,!![]);}catch(_0x40cf26){return BPromise['reject'](_0x40cf26);}return _0x34101d[_0x46db('0x20')]();};}function saveUpdates(_0x2d5af3,_0x1e0beb){return function(_0x53bf89){if(_0x53bf89){return _0x53bf89['update'](_0x2d5af3)['then'](function(_0x597a95){return _0x597a95;});}return null;};}function removeEntity(_0x399766,_0x270f8d){return function(_0x38ee0c){if(_0x38ee0c){return _0x38ee0c['destroy']()['then'](function(){_0x399766[_0x46db('0x19')](0xcc)[_0x46db('0x1a')]();});}};}function handleEntityNotFound(_0x1156c4,_0x3dc50b){return function(_0x443651){if(!_0x443651){_0x1156c4[_0x46db('0x18')](0x194);}return _0x443651;};}function handleError(_0x2bf7b4,_0x3a50dd){_0x3a50dd=_0x3a50dd||0x1f4;return function(_0x4708df){logger[_0x46db('0x21')](_0x4708df['stack']);if(_0x4708df[_0x46db('0x22')]){delete _0x4708df[_0x46db('0x22')];}_0x2bf7b4[_0x46db('0x19')](_0x3a50dd)[_0x46db('0x23')](_0x4708df);};}exports[_0x46db('0x24')]=function(_0x3134dd,_0x52de86){var _0x2b6dfe={},_0x1ed102={},_0x1a3855={'count':0x0,'rows':[]};var _0x4e9bf5=db[_0x46db('0x25')][_0x46db('0x26')];_0x1ed102[_0x46db('0x27')]=_[_0x46db('0x28')](_0x4e9bf5);var _0x367195={'dateStart':_0x3134dd[_0x46db('0x29')][_0x46db('0x2a')],'dateEnd':_0x3134dd[_0x46db('0x29')][_0x46db('0x2b')]};delete _0x3134dd[_0x46db('0x29')]['dateStart'];delete _0x3134dd[_0x46db('0x29')][_0x46db('0x2b')];_0x1ed102['query']=_[_0x46db('0x28')](_0x3134dd[_0x46db('0x29')]);_0x1ed102[_0x46db('0x2c')]=_[_0x46db('0x2d')](_0x1ed102[_0x46db('0x27')],_0x1ed102[_0x46db('0x29')]);_0x2b6dfe[_0x46db('0x2e')]=_[_0x46db('0x2d')](_0x1ed102[_0x46db('0x27')],qs[_0x46db('0x2f')](_0x3134dd[_0x46db('0x29')][_0x46db('0x2f')]));_0x2b6dfe['attributes']=_0x2b6dfe['attributes'][_0x46db('0x30')]?_0x2b6dfe[_0x46db('0x2e')]:_0x1ed102[_0x46db('0x27')];if(!_0x3134dd['query'][_0x46db('0x31')](_0x46db('0x32'))){_0x2b6dfe['limit']=qs[_0x46db('0x33')](_0x3134dd[_0x46db('0x29')][_0x46db('0x33')]);_0x2b6dfe[_0x46db('0x1b')]=qs[_0x46db('0x1b')](_0x3134dd['query']['offset']);}_0x2b6dfe[_0x46db('0x34')]=qs[_0x46db('0x35')](_0x3134dd[_0x46db('0x29')][_0x46db('0x35')]);_0x2b6dfe[_0x46db('0x36')]=qs['filters'](_[_0x46db('0x37')](_0x3134dd[_0x46db('0x29')],_0x1ed102[_0x46db('0x2c')]));if(_0x367195['dateStart']){if(_0x367195['dateEnd']){_0x367195[_0x46db('0x2b')]=moment(_0x367195[_0x46db('0x2b')])[_0x46db('0x38')](0x1,_0x46db('0x39'));}else{_0x367195[_0x46db('0x2b')]=moment(_0x367195[_0x46db('0x2a')])['add'](0x1,'day');}_[_0x46db('0x3a')](_0x2b6dfe[_0x46db('0x36')],{'createdAt':{'$gte':_0x367195['dateStart'],'$lte':_0x367195[_0x46db('0x2b')]}});}if(_0x3134dd['query'][_0x46db('0x3b')]){_0x2b6dfe['where']=_[_0x46db('0x3a')](_0x2b6dfe[_0x46db('0x36')],{'$or':_[_0x46db('0x3c')](_0x2b6dfe[_0x46db('0x2e')],function(_0x4a6894){var _0x4a5e3d={};_0x4a5e3d[_0x4a6894]={'$like':'%'+_0x3134dd['query'][_0x46db('0x3b')]+'%'};return _0x4a5e3d;})});}_0x2b6dfe=_[_0x46db('0x3a')]({},_0x2b6dfe,_0x3134dd[_0x46db('0x3d')]);var _0x4755c0={'where':_0x2b6dfe['where']};return db[_0x46db('0x25')][_0x46db('0x3e')](_0x4755c0)[_0x46db('0x3f')](function(_0x2c7ec1){_0x1a3855[_0x46db('0x3e')]=_0x2c7ec1;if(_0x3134dd[_0x46db('0x29')][_0x46db('0x40')]){_0x2b6dfe[_0x46db('0x41')]=[{'all':!![]}];}return db[_0x46db('0x25')][_0x46db('0x42')](_0x2b6dfe);})[_0x46db('0x3f')](function(_0xb94272){_0x1a3855[_0x46db('0x43')]=_0xb94272;return _0x1a3855;})[_0x46db('0x3f')](respondWithFilteredResult(_0x52de86,_0x2b6dfe))[_0x46db('0x44')](handleError(_0x52de86,null));};exports[_0x46db('0x45')]=function(_0x56d80c,_0x359532){var _0x780c29={'raw':![],'where':{'id':_0x56d80c[_0x46db('0x46')]['id']}},_0x1042b0={};_0x1042b0[_0x46db('0x27')]=_['keys'](db[_0x46db('0x25')][_0x46db('0x26')]);_0x1042b0[_0x46db('0x29')]=_[_0x46db('0x28')](_0x56d80c[_0x46db('0x29')]);_0x1042b0[_0x46db('0x2c')]=_[_0x46db('0x2d')](_0x1042b0[_0x46db('0x27')],_0x1042b0['query']);_0x780c29['attributes']=_[_0x46db('0x2d')](_0x1042b0[_0x46db('0x27')],qs[_0x46db('0x2f')](_0x56d80c[_0x46db('0x29')]['fields']));_0x780c29[_0x46db('0x2e')]=_0x780c29[_0x46db('0x2e')][_0x46db('0x30')]?_0x780c29[_0x46db('0x2e')]:_0x1042b0[_0x46db('0x27')];if(_0x56d80c[_0x46db('0x29')][_0x46db('0x40')]){_0x780c29[_0x46db('0x41')]=[{'all':!![]}];}_0x780c29=_[_0x46db('0x3a')]({},_0x780c29,_0x56d80c[_0x46db('0x3d')]);return db['Campaign'][_0x46db('0x47')](_0x780c29)['then'](handleEntityNotFound(_0x359532,null))[_0x46db('0x3f')](respondWithResult(_0x359532,null))[_0x46db('0x44')](handleError(_0x359532,null));};exports[_0x46db('0x48')]=function(_0x3ddbad,_0x4539ce){return db['Campaign'][_0x46db('0x48')](_0x3ddbad[_0x46db('0x49')],{})['then'](respondWithResult(_0x4539ce,0xc9))[_0x46db('0x44')](handleError(_0x4539ce,null));};exports[_0x46db('0x4a')]=function(_0x5df1ed,_0x3028eb){var _0x23b511={'raw':![],'where':{'id':_0x5df1ed['params']['id']}},_0x4c4892={};_0x4c4892['model']=_['keys'](db[_0x46db('0x25')]['rawAttributes']);_0x23b511[_0x46db('0x2e')]=_[_0x46db('0x2d')](_0x4c4892[_0x46db('0x27')],qs['fields'](_0x5df1ed[_0x46db('0x29')][_0x46db('0x2f')]));_0x23b511[_0x46db('0x2e')]=_0x23b511[_0x46db('0x2e')]['length']?_0x23b511[_0x46db('0x2e')]:_0x4c4892[_0x46db('0x27')];if(_0x5df1ed['query']['includeAll']){_0x23b511['include']=[{'all':!![]}];}_0x23b511=_[_0x46db('0x3a')]({},_0x23b511,_0x5df1ed['options']);return db[_0x46db('0x25')][_0x46db('0x47')](_0x23b511)[_0x46db('0x3f')](handleEntityNotFound(_0x3028eb,null))['then'](function(_0x1d43a5){if(_0x1d43a5){var _0x802f8b=_0x1d43a5[_0x46db('0x4b')]({'plain':!![]});_0x802f8b=qs[_0x46db('0x4c')](_0x802f8b,['id',_0x46db('0x4d'),'updatedAt']);_0x5df1ed[_0x46db('0x49')]=_['omit'](_0x5df1ed[_0x46db('0x49')],['id','createdAt',_0x46db('0x4e')]);return db[_0x46db('0x25')][_0x46db('0x48')](_[_0x46db('0x3a')](_0x802f8b,_0x5df1ed['body']),{'include':_0x5df1ed[_0x46db('0x29')][_0x46db('0x40')]?[{'all':!![]}]:undefined});}})[_0x46db('0x3f')](respondWithResult(_0x3028eb,0xc9))['catch'](handleError(_0x3028eb,null));};exports['update']=function(_0x219ae3,_0x3370d1){if(_0x219ae3['body']['id']){delete _0x219ae3['body']['id'];}return db[_0x46db('0x25')][_0x46db('0x47')]({'where':{'id':_0x219ae3[_0x46db('0x46')]['id']}})[_0x46db('0x3f')](handleEntityNotFound(_0x3370d1,null))['then'](saveUpdates(_0x219ae3[_0x46db('0x49')],null))[_0x46db('0x3f')](respondWithResult(_0x3370d1,null))[_0x46db('0x44')](handleError(_0x3370d1,null));};exports['destroy']=function(_0x42276d,_0x4d1e1a){return db[_0x46db('0x25')][_0x46db('0x47')]({'where':{'id':_0x42276d[_0x46db('0x46')]['id']}})[_0x46db('0x3f')](handleEntityNotFound(_0x4d1e1a,null))[_0x46db('0x3f')](removeEntity(_0x4d1e1a,null))[_0x46db('0x44')](handleError(_0x4d1e1a,null));};exports[_0x46db('0x4f')]=function(_0x3ceaed,_0x92438c,_0x434434){var _0x5c5826={'raw':!![],'where':{}};var _0x48ee68={};var _0x59c94a={'count':0x0,'rows':[]};return db['Campaign'][_0x46db('0x50')]({'where':{'id':_0x3ceaed[_0x46db('0x46')]['id']}})[_0x46db('0x3f')](handleEntityNotFound(_0x92438c,null))[_0x46db('0x3f')](function(_0x4acc5a){if(_0x4acc5a){_0x48ee68[_0x46db('0x27')]=_[_0x46db('0x28')](db['CmHopper'][_0x46db('0x26')]);_0x48ee68[_0x46db('0x29')]=_[_0x46db('0x28')](_0x3ceaed[_0x46db('0x29')]);_0x48ee68[_0x46db('0x2c')]=_['intersection'](_0x48ee68['model'],_0x48ee68[_0x46db('0x29')]);_0x5c5826[_0x46db('0x2e')]=_[_0x46db('0x2d')](_0x48ee68[_0x46db('0x27')],qs[_0x46db('0x2f')](_0x3ceaed['query'][_0x46db('0x2f')]));_0x5c5826[_0x46db('0x2e')]=_0x5c5826[_0x46db('0x2e')][_0x46db('0x30')]?_0x5c5826['attributes']:_0x48ee68[_0x46db('0x27')];if(!_0x3ceaed[_0x46db('0x29')][_0x46db('0x31')](_0x46db('0x32'))){_0x5c5826[_0x46db('0x33')]=qs['limit'](_0x3ceaed[_0x46db('0x29')][_0x46db('0x33')]);_0x5c5826[_0x46db('0x1b')]=qs[_0x46db('0x1b')](_0x3ceaed[_0x46db('0x29')][_0x46db('0x1b')]);}_0x5c5826[_0x46db('0x34')]=qs['sort'](_0x3ceaed[_0x46db('0x29')][_0x46db('0x35')]);_0x5c5826[_0x46db('0x36')]=qs[_0x46db('0x2c')](_['pick'](_0x3ceaed['query'],_0x48ee68['filters']));_0x5c5826['where'][_0x46db('0x51')]=_0x4acc5a['id'];if(_0x3ceaed[_0x46db('0x29')][_0x46db('0x3b')]){_0x5c5826[_0x46db('0x36')]=_[_0x46db('0x3a')](_0x5c5826[_0x46db('0x36')],{'$or':_['map'](_0x5c5826[_0x46db('0x2e')],function(_0x2013e4){var _0x56f4c8={};_0x56f4c8[_0x2013e4]={'$like':'%'+_0x3ceaed[_0x46db('0x29')]['filter']+'%'};return _0x56f4c8;})});}_0x5c5826=_[_0x46db('0x3a')]({},_0x5c5826,_0x3ceaed['options']);return db[_0x46db('0x52')][_0x46db('0x3e')]({'where':_0x5c5826[_0x46db('0x36')]})[_0x46db('0x3f')](function(_0x4f668e){_0x59c94a[_0x46db('0x3e')]=_0x4f668e;if(_0x3ceaed[_0x46db('0x29')]['includeAll']){_0x5c5826[_0x46db('0x41')]=[{'all':!![]}];}return db['CmHopper'][_0x46db('0x42')](_0x5c5826);})['then'](function(_0x3851a8){_0x59c94a[_0x46db('0x43')]=_0x3851a8;return _0x59c94a;});}})[_0x46db('0x3f')](respondWithFilteredResult(_0x92438c,_0x5c5826))[_0x46db('0x44')](handleError(_0x92438c,null));};exports[_0x46db('0x53')]=function(_0x47833b,_0x271687,_0x187b6b){var _0x3e6627={'raw':!![],'where':{}};var _0x1d539a={};var _0x28483b={'count':0x0,'rows':[]};return db[_0x46db('0x25')]['findOne']({'where':{'id':_0x47833b[_0x46db('0x46')]['id']}})['then'](handleEntityNotFound(_0x271687,null))[_0x46db('0x3f')](function(_0x4a65e7){if(_0x4a65e7){_0x1d539a[_0x46db('0x27')]=_[_0x46db('0x28')](db[_0x46db('0x54')][_0x46db('0x26')]);_0x1d539a[_0x46db('0x29')]=_[_0x46db('0x28')](_0x47833b[_0x46db('0x29')]);_0x1d539a[_0x46db('0x2c')]=_[_0x46db('0x2d')](_0x1d539a[_0x46db('0x27')],_0x1d539a[_0x46db('0x29')]);_0x3e6627[_0x46db('0x2e')]=_[_0x46db('0x2d')](_0x1d539a[_0x46db('0x27')],qs[_0x46db('0x2f')](_0x47833b['query']['fields']));_0x3e6627[_0x46db('0x2e')]=_0x3e6627[_0x46db('0x2e')]['length']?_0x3e6627[_0x46db('0x2e')]:_0x1d539a['model'];if(!_0x47833b[_0x46db('0x29')][_0x46db('0x31')](_0x46db('0x32'))){_0x3e6627['limit']=qs['limit'](_0x47833b[_0x46db('0x29')][_0x46db('0x33')]);_0x3e6627[_0x46db('0x1b')]=qs[_0x46db('0x1b')](_0x47833b[_0x46db('0x29')][_0x46db('0x1b')]);}_0x3e6627[_0x46db('0x34')]=qs[_0x46db('0x35')](_0x47833b[_0x46db('0x29')][_0x46db('0x35')]);_0x3e6627[_0x46db('0x36')]=qs['filters'](_[_0x46db('0x37')](_0x47833b['query'],_0x1d539a[_0x46db('0x2c')]));_0x3e6627[_0x46db('0x36')][_0x46db('0x51')]=_0x4a65e7['id'];if(_0x47833b[_0x46db('0x29')][_0x46db('0x3b')]){_0x3e6627['where']=_[_0x46db('0x3a')](_0x3e6627[_0x46db('0x36')],{'$or':_[_0x46db('0x3c')](_0x3e6627[_0x46db('0x2e')],function(_0x286c46){var _0x97f613={};_0x97f613[_0x286c46]={'$like':'%'+_0x47833b[_0x46db('0x29')][_0x46db('0x3b')]+'%'};return _0x97f613;})});}_0x3e6627=_['merge']({},_0x3e6627,_0x47833b[_0x46db('0x3d')]);return db[_0x46db('0x54')][_0x46db('0x3e')]({'where':_0x3e6627[_0x46db('0x36')]})[_0x46db('0x3f')](function(_0x4eb2b6){_0x28483b[_0x46db('0x3e')]=_0x4eb2b6;if(_0x47833b[_0x46db('0x29')][_0x46db('0x40')]){_0x3e6627[_0x46db('0x41')]=[{'all':!![]}];}return db[_0x46db('0x54')]['findAll'](_0x3e6627);})['then'](function(_0x3e8ad6){_0x28483b[_0x46db('0x43')]=_0x3e8ad6;return _0x28483b;});}})[_0x46db('0x3f')](respondWithFilteredResult(_0x271687,_0x3e6627))['catch'](handleError(_0x271687,null));};exports[_0x46db('0x55')]=function(_0x42086b,_0x4b3e85,_0xdeb43f){var _0x494cf7={'raw':!![],'where':{}};var _0x17994e={};var _0x179684={'count':0x0,'rows':[]};return db[_0x46db('0x25')][_0x46db('0x50')]({'where':{'id':_0x42086b['params']['id']}})[_0x46db('0x3f')](handleEntityNotFound(_0x4b3e85,null))[_0x46db('0x3f')](function(_0x4ab88a){if(_0x4ab88a){_0x17994e[_0x46db('0x27')]=_[_0x46db('0x28')](db[_0x46db('0x56')]['rawAttributes']);_0x17994e[_0x46db('0x29')]=_[_0x46db('0x28')](_0x42086b[_0x46db('0x29')]);_0x17994e[_0x46db('0x2c')]=_[_0x46db('0x2d')](_0x17994e[_0x46db('0x27')],_0x17994e['query']);_0x494cf7[_0x46db('0x2e')]=_[_0x46db('0x2d')](_0x17994e[_0x46db('0x27')],qs[_0x46db('0x2f')](_0x42086b[_0x46db('0x29')][_0x46db('0x2f')]));_0x494cf7[_0x46db('0x2e')]=_0x494cf7['attributes'][_0x46db('0x30')]?_0x494cf7[_0x46db('0x2e')]:_0x17994e[_0x46db('0x27')];if(!_0x42086b[_0x46db('0x29')]['hasOwnProperty'](_0x46db('0x32'))){_0x494cf7['limit']=qs['limit'](_0x42086b[_0x46db('0x29')][_0x46db('0x33')]);_0x494cf7[_0x46db('0x1b')]=qs['offset'](_0x42086b['query']['offset']);}_0x494cf7[_0x46db('0x34')]=qs[_0x46db('0x35')](_0x42086b[_0x46db('0x29')][_0x46db('0x35')]);_0x494cf7[_0x46db('0x36')]=qs[_0x46db('0x2c')](_[_0x46db('0x37')](_0x42086b[_0x46db('0x29')],_0x17994e[_0x46db('0x2c')]));_0x494cf7[_0x46db('0x36')]['CampaignId']=_0x4ab88a['id'];if(_0x42086b[_0x46db('0x29')][_0x46db('0x3b')]){_0x494cf7[_0x46db('0x36')]=_['merge'](_0x494cf7[_0x46db('0x36')],{'$or':_[_0x46db('0x3c')](_0x494cf7[_0x46db('0x2e')],function(_0x18afda){var _0x48c577={};_0x48c577[_0x18afda]={'$like':'%'+_0x42086b[_0x46db('0x29')][_0x46db('0x3b')]+'%'};return _0x48c577;})});}_0x494cf7=_[_0x46db('0x3a')]({},_0x494cf7,_0x42086b['options']);return db['CmHopperFinal'][_0x46db('0x3e')]({'where':_0x494cf7[_0x46db('0x36')]})[_0x46db('0x3f')](function(_0x3291ac){_0x179684[_0x46db('0x3e')]=_0x3291ac;if(_0x42086b[_0x46db('0x29')][_0x46db('0x40')]){_0x494cf7[_0x46db('0x41')]=[{'all':!![]}];}return db[_0x46db('0x56')][_0x46db('0x42')](_0x494cf7);})[_0x46db('0x3f')](function(_0xa10f69){_0x179684[_0x46db('0x43')]=_0xa10f69;return _0x179684;});}})['then'](respondWithFilteredResult(_0x4b3e85,_0x494cf7))[_0x46db('0x44')](handleError(_0x4b3e85,null));};exports[_0x46db('0x57')]=function(_0x1cb5ae,_0x3819f0,_0x5b6b50){var _0xfec849={'raw':!![],'where':{}};var _0x1bf5ee={};var _0x2ceb1d={'count':0x0,'rows':[]};return db[_0x46db('0x25')][_0x46db('0x50')]({'where':{'id':_0x1cb5ae[_0x46db('0x46')]['id']}})['then'](handleEntityNotFound(_0x3819f0,null))[_0x46db('0x3f')](function(_0x4ff40d){if(_0x4ff40d){_0x1bf5ee[_0x46db('0x27')]=_['keys'](db[_0x46db('0x58')]['rawAttributes']);_0x1bf5ee[_0x46db('0x29')]=_[_0x46db('0x28')](_0x1cb5ae[_0x46db('0x29')]);_0x1bf5ee[_0x46db('0x2c')]=_[_0x46db('0x2d')](_0x1bf5ee[_0x46db('0x27')],_0x1bf5ee[_0x46db('0x29')]);_0xfec849[_0x46db('0x2e')]=_[_0x46db('0x2d')](_0x1bf5ee[_0x46db('0x27')],qs[_0x46db('0x2f')](_0x1cb5ae[_0x46db('0x29')][_0x46db('0x2f')]));_0xfec849[_0x46db('0x2e')]=_0xfec849[_0x46db('0x2e')][_0x46db('0x30')]?_0xfec849[_0x46db('0x2e')]:_0x1bf5ee[_0x46db('0x27')];if(!_0x1cb5ae[_0x46db('0x29')][_0x46db('0x31')](_0x46db('0x32'))){_0xfec849[_0x46db('0x33')]=qs[_0x46db('0x33')](_0x1cb5ae[_0x46db('0x29')][_0x46db('0x33')]);_0xfec849['offset']=qs[_0x46db('0x1b')](_0x1cb5ae[_0x46db('0x29')][_0x46db('0x1b')]);}_0xfec849[_0x46db('0x34')]=qs['sort'](_0x1cb5ae[_0x46db('0x29')][_0x46db('0x35')]);_0xfec849['where']=qs['filters'](_['pick'](_0x1cb5ae[_0x46db('0x29')],_0x1bf5ee[_0x46db('0x2c')]));_0xfec849[_0x46db('0x36')]['CampaignId']=_0x4ff40d['id'];if(_0x1cb5ae[_0x46db('0x29')][_0x46db('0x3b')]){_0xfec849[_0x46db('0x36')]=_[_0x46db('0x3a')](_0xfec849[_0x46db('0x36')],{'$or':_[_0x46db('0x3c')](_0xfec849[_0x46db('0x2e')],function(_0x29f094){var _0x1990c2={};_0x1990c2[_0x29f094]={'$like':'%'+_0x1cb5ae[_0x46db('0x29')][_0x46db('0x3b')]+'%'};return _0x1990c2;})});}_0xfec849=_['merge']({},_0xfec849,_0x1cb5ae[_0x46db('0x3d')]);return db['CmHopperBlack']['count']({'where':_0xfec849[_0x46db('0x36')]})[_0x46db('0x3f')](function(_0x4c638a){_0x2ceb1d[_0x46db('0x3e')]=_0x4c638a;if(_0x1cb5ae[_0x46db('0x29')][_0x46db('0x40')]){_0xfec849[_0x46db('0x41')]=[{'all':!![]}];}return db[_0x46db('0x58')][_0x46db('0x42')](_0xfec849);})['then'](function(_0x27368a){_0x2ceb1d[_0x46db('0x43')]=_0x27368a;return _0x2ceb1d;});}})[_0x46db('0x3f')](respondWithFilteredResult(_0x3819f0,_0xfec849))[_0x46db('0x44')](handleError(_0x3819f0,null));};exports[_0x46db('0x59')]=function(_0xa34e05,_0x4e1f70,_0x30ea06){var _0x3dc793={};var _0x158de1={};var _0x1ac8c6;var _0x5e558e;return db[_0x46db('0x25')][_0x46db('0x50')]({'where':{'id':_0xa34e05[_0x46db('0x46')]['id']}})[_0x46db('0x3f')](handleEntityNotFound(_0x4e1f70,null))[_0x46db('0x3f')](function(_0x186c7d){if(_0x186c7d){_0x1ac8c6=_0x186c7d;_0x158de1[_0x46db('0x27')]=_[_0x46db('0x28')](db[_0x46db('0x5a')][_0x46db('0x26')]);_0x158de1['query']=_[_0x46db('0x28')](_0xa34e05[_0x46db('0x29')]);_0x158de1[_0x46db('0x2c')]=_[_0x46db('0x2d')](_0x158de1[_0x46db('0x27')],_0x158de1[_0x46db('0x29')]);_0x3dc793[_0x46db('0x2e')]=_[_0x46db('0x2d')](_0x158de1[_0x46db('0x27')],qs['fields'](_0xa34e05['query']['fields']));_0x3dc793[_0x46db('0x2e')]=_0x3dc793[_0x46db('0x2e')][_0x46db('0x30')]?_0x3dc793[_0x46db('0x2e')]:_0x158de1[_0x46db('0x27')];_0x3dc793['order']=qs[_0x46db('0x35')](_0xa34e05[_0x46db('0x29')][_0x46db('0x35')]);_0x3dc793[_0x46db('0x36')]=qs['filters'](_['pick'](_0xa34e05[_0x46db('0x29')],_0x158de1['filters']));if(_0xa34e05[_0x46db('0x29')]['filter']){_0x3dc793[_0x46db('0x36')]=_['merge'](_0x3dc793['where'],{'$or':_[_0x46db('0x3c')](_0x3dc793['attributes'],function(_0x2085f4){var _0x587fe4={};_0x587fe4[_0x2085f4]={'$like':'%'+_0xa34e05[_0x46db('0x29')][_0x46db('0x3b')]+'%'};return _0x587fe4;})});}_0x3dc793=_[_0x46db('0x3a')]({},_0x3dc793,_0xa34e05['options']);return _0x1ac8c6[_0x46db('0x59')](_0x3dc793);}})[_0x46db('0x3f')](function(_0x591d3c){if(_0x591d3c){_0x5e558e=_0x591d3c['length'];if(!_0xa34e05[_0x46db('0x29')][_0x46db('0x31')](_0x46db('0x32'))){_0x3dc793[_0x46db('0x33')]=qs[_0x46db('0x33')](_0xa34e05[_0x46db('0x29')][_0x46db('0x33')]);_0x3dc793[_0x46db('0x1b')]=qs[_0x46db('0x1b')](_0xa34e05[_0x46db('0x29')][_0x46db('0x1b')]);}return _0x1ac8c6[_0x46db('0x59')](_0x3dc793);}})[_0x46db('0x3f')](function(_0x48007a){if(_0x48007a){return _0x48007a?{'count':_0x5e558e,'rows':_0x48007a}:null;}})['then'](respondWithResult(_0x4e1f70,null))[_0x46db('0x44')](handleError(_0x4e1f70,null));};exports['addLists']=function(_0x1cdf1d,_0xfabd7b,_0x18ed2d){var _0x13b08e,_0x18786c;return db[_0x46db('0x25')]['find']({'where':{'id':_0x1cdf1d[_0x46db('0x46')]['id']}})['then'](handleEntityNotFound(_0xfabd7b,null))[_0x46db('0x3f')](function(_0x19d5dc){if(_0x19d5dc){_0x18786c=_0x19d5dc;return _0x19d5dc[_0x46db('0x5b')](_0x1cdf1d[_0x46db('0x49')][_0x46db('0x5c')],_[_0x46db('0x4c')](_0x1cdf1d[_0x46db('0x49')],[_0x46db('0x5c'),'id'])||{});}return null;})['spread'](function(_0xdb2d3e){var _0xbabdc4;_0x13b08e=_0xdb2d3e||[];var _0x29d71d=[];if(_0xdb2d3e){for(var _0x1d6f72=0x0;_0x1d6f72<_0xdb2d3e[_0x46db('0x30')];_0x1d6f72+=0x1){var _0xbaf263=_0xdb2d3e[_0x1d6f72][_0x46db('0x4b')]({'plain':!![]});_0x18786c['dialCheckDuplicateType']=_0x1cdf1d[_0x46db('0x49')][_0x46db('0x5d')]?_0x1cdf1d[_0x46db('0x49')][_0x46db('0x5d')]:_0x18786c[_0x46db('0x5d')];switch(_0x18786c[_0x46db('0x5d')]){case _0x46db('0x5e'):_0xbabdc4=squel[_0x46db('0x5f')]()[_0x46db('0x60')]('cm_hopper')['fromQuery']([_0x46db('0x61'),_0x46db('0x62'),_0x46db('0x63'),_0x46db('0x64'),_0x46db('0x51'),_0x46db('0x4d'),'updatedAt'],squel[_0x46db('0x65')]()[_0x46db('0x66')](_0x46db('0x61'),_0x46db('0x61'))[_0x46db('0x66')](_0x46db('0x67'),'scheduledAt')[_0x46db('0x66')]('id',_0x46db('0x63'))[_0x46db('0x66')](_0xbaf263[_0x46db('0x68')][_0x46db('0x69')](),_0x46db('0x64'))[_0x46db('0x66')](_0x1cdf1d[_0x46db('0x46')]['id'][_0x46db('0x69')](),'CampaignId')[_0x46db('0x66')]('NOW()',_0x46db('0x4d'))['field'](_0x46db('0x67'),_0x46db('0x4e'))['from']('cm_contacts')[_0x46db('0x36')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0xbaf263['CmListId'][_0x46db('0x69')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x46db('0x36')](_0x46db('0x6a'),squel[_0x46db('0x65')]()[_0x46db('0x66')]('calleridnum')[_0x46db('0x6b')](_0x46db('0x6c'))[_0x46db('0x36')]('CampaignId\x20=\x20?',_0x1cdf1d[_0x46db('0x46')]['id'][_0x46db('0x69')]()))[_0x46db('0x36')]('phone\x20NOT\x20IN\x20(?)',squel[_0x46db('0x65')]()['field'](_0x46db('0x61'))['from'](_0x46db('0x6d'))[_0x46db('0x36')](_0x46db('0x6e'),_0x1cdf1d[_0x46db('0x46')]['id'][_0x46db('0x69')]())))[_0x46db('0x69')]();break;case _0x46db('0x6f'):_0xbabdc4=squel['insert']()[_0x46db('0x60')](_0x46db('0x6d'))[_0x46db('0x70')]([_0x46db('0x61'),_0x46db('0x62'),_0x46db('0x63'),_0x46db('0x64'),_0x46db('0x51'),_0x46db('0x4d'),_0x46db('0x4e')],squel['select']()[_0x46db('0x66')]('phone','phone')[_0x46db('0x66')]('NOW()','scheduledAt')[_0x46db('0x66')]('id','ContactId')['field'](_0xbaf263[_0x46db('0x68')][_0x46db('0x69')](),_0x46db('0x64'))['field'](_0x1cdf1d[_0x46db('0x46')]['id']['toString'](),_0x46db('0x51'))[_0x46db('0x66')]('NOW()',_0x46db('0x4d'))['field'](_0x46db('0x67'),_0x46db('0x4e'))[_0x46db('0x6b')](_0x46db('0x71'))[_0x46db('0x36')](_0x46db('0x72'))['where'](_0x46db('0x73'),_0xbaf263[_0x46db('0x68')]['toString']())[_0x46db('0x36')](_0x46db('0x74'))[_0x46db('0x36')](_0x46db('0x6a'),squel['select']()[_0x46db('0x66')]('phone')[_0x46db('0x6b')]('cm_hopper')[_0x46db('0x36')]('CampaignId\x20=\x20?',_0x1cdf1d[_0x46db('0x46')]['id'][_0x46db('0x69')]())))[_0x46db('0x69')]();break;default:_0xbabdc4=squel['insert']()[_0x46db('0x60')](_0x46db('0x6d'))[_0x46db('0x70')]([_0x46db('0x61'),_0x46db('0x62'),_0x46db('0x63'),_0x46db('0x64'),'CampaignId',_0x46db('0x4d'),_0x46db('0x4e')],squel['select']()[_0x46db('0x66')](_0x46db('0x61'),_0x46db('0x61'))[_0x46db('0x66')](_0x46db('0x67'),_0x46db('0x62'))['field']('id',_0x46db('0x63'))[_0x46db('0x66')](_0xbaf263['CmListId']['toString'](),_0x46db('0x64'))[_0x46db('0x66')](_0x1cdf1d[_0x46db('0x46')]['id'][_0x46db('0x69')](),_0x46db('0x51'))[_0x46db('0x66')](_0x46db('0x67'),'createdAt')[_0x46db('0x66')]('NOW()','updatedAt')['from'](_0x46db('0x71'))['where'](_0x46db('0x72'))[_0x46db('0x36')]('ListId\x20=\x20?',_0xbaf263[_0x46db('0x68')][_0x46db('0x69')]())[_0x46db('0x36')](_0x46db('0x74')))[_0x46db('0x69')]();}_0x29d71d['push'](db[_0x46db('0x75')][_0x46db('0x29')](_0xbabdc4));}return BPromise[_0x46db('0x76')](_0x29d71d);}})['then'](function(){return _0x13b08e;})[_0x46db('0x3f')](respondWithResult(_0xfabd7b,null))['catch'](handleError(_0xfabd7b,null));};exports[_0x46db('0x77')]=function(_0x24ac10,_0x5e3fcc,_0x582337){var _0x4a9a0e;return db['Campaign'][_0x46db('0x47')]({'where':{'id':_0x24ac10['params']['id']}})['then'](handleEntityNotFound(_0x5e3fcc,null))[_0x46db('0x3f')](function(_0x26a7b2){if(_0x26a7b2){return _0x26a7b2[_0x46db('0x77')](_0x24ac10['query'][_0x46db('0x5c')]);}})[_0x46db('0x3f')](function(_0x16ac7a){if(_0x16ac7a){_0x4a9a0e=_0x16ac7a;return db[_0x46db('0x52')][_0x46db('0x78')]({'where':{'ListId':_0x24ac10['query'][_0x46db('0x5c')],'CampaignId':_0x24ac10[_0x46db('0x46')]['id']}})['then'](function(){return _0x4a9a0e;});}})[_0x46db('0x3f')](respondWithStatusCode(_0x5e3fcc,null))[_0x46db('0x44')](handleError(_0x5e3fcc,null));};exports[_0x46db('0x79')]=function(_0x3597e6,_0x531239,_0x53ca75){var _0x267219={'raw':!![],'where':{}};var _0xe039a6={};var _0x26dc23={'count':0x0,'rows':[]};return db[_0x46db('0x25')][_0x46db('0x50')]({'where':{'id':_0x3597e6[_0x46db('0x46')]['id']}})[_0x46db('0x3f')](handleEntityNotFound(_0x531239,null))[_0x46db('0x3f')](function(_0x121c49){if(_0x121c49){_0xe039a6[_0x46db('0x27')]=_[_0x46db('0x28')](db[_0x46db('0x5a')][_0x46db('0x26')]);_0xe039a6[_0x46db('0x29')]=_[_0x46db('0x28')](_0x3597e6[_0x46db('0x29')]);_0xe039a6[_0x46db('0x2c')]=_[_0x46db('0x2d')](_0xe039a6['model'],_0xe039a6[_0x46db('0x29')]);_0x267219['attributes']=_[_0x46db('0x2d')](_0xe039a6['model'],qs[_0x46db('0x2f')](_0x3597e6['query'][_0x46db('0x2f')]));_0x267219['attributes']=_0x267219['attributes'][_0x46db('0x30')]?_0x267219['attributes']:_0xe039a6[_0x46db('0x27')];if(!_0x3597e6[_0x46db('0x29')][_0x46db('0x31')]('nolimit')){_0x267219[_0x46db('0x33')]=qs[_0x46db('0x33')](_0x3597e6['query'][_0x46db('0x33')]);_0x267219[_0x46db('0x1b')]=qs[_0x46db('0x1b')](_0x3597e6['query']['offset']);}_0x267219[_0x46db('0x34')]=qs[_0x46db('0x35')](_0x3597e6[_0x46db('0x29')][_0x46db('0x35')]);_0x267219[_0x46db('0x36')]=qs[_0x46db('0x2c')](_['pick'](_0x3597e6[_0x46db('0x29')],_0xe039a6[_0x46db('0x2c')]));_0x267219[_0x46db('0x36')][_0x46db('0x51')]=_0x121c49['id'];if(_0x3597e6['query'][_0x46db('0x3b')]){_0x267219[_0x46db('0x36')]=_[_0x46db('0x3a')](_0x267219[_0x46db('0x36')],{'$or':_[_0x46db('0x3c')](_0x267219[_0x46db('0x2e')],function(_0x21b824){var _0x50b203={};_0x50b203[_0x21b824]={'$like':'%'+_0x3597e6[_0x46db('0x29')]['filter']+'%'};return _0x50b203;})});}_0x267219=_[_0x46db('0x3a')]({},_0x267219,_0x3597e6[_0x46db('0x3d')]);return db['CmList'][_0x46db('0x3e')]({'where':_0x267219[_0x46db('0x36')]})[_0x46db('0x3f')](function(_0xf6fa7d){_0x26dc23[_0x46db('0x3e')]=_0xf6fa7d;if(_0x3597e6['query'][_0x46db('0x40')]){_0x267219[_0x46db('0x41')]=[{'all':!![]}];}return db[_0x46db('0x5a')][_0x46db('0x42')](_0x267219);})['then'](function(_0x273496){_0x26dc23[_0x46db('0x43')]=_0x273496;return _0x26dc23;});}})[_0x46db('0x3f')](respondWithFilteredResult(_0x531239,_0x267219))[_0x46db('0x44')](handleError(_0x531239,null));};exports[_0x46db('0x7a')]=function(_0x24ba31,_0x2a9735,_0x36b8a9){var _0x4a6108,_0x1998bd;return db[_0x46db('0x25')][_0x46db('0x47')]({'where':{'id':_0x24ba31[_0x46db('0x46')]['id']}})['then'](handleEntityNotFound(_0x2a9735,null))[_0x46db('0x3f')](function(_0x5cca29){if(_0x5cca29){_0x1998bd=_0x5cca29;return _0x5cca29['addBlackLists'](_0x24ba31[_0x46db('0x49')][_0x46db('0x5c')],_['omit'](_0x24ba31[_0x46db('0x49')],['ids','id'])||{});}return null;})['spread'](function(_0x3751ca){var _0x4cb041;_0x4a6108=_0x3751ca||[];var _0x1a8c65=[];if(_0x3751ca){for(var _0x3bf24a=0x0;_0x3bf24a<_0x3751ca[_0x46db('0x30')];_0x3bf24a+=0x1){var _0x4b6441=_0x3751ca[_0x3bf24a]['get']({'plain':!![]});_0x4cb041=squel[_0x46db('0x5f')]()['into'](_0x46db('0x7b'))[_0x46db('0x70')]([_0x46db('0x61'),_0x46db('0x63'),_0x46db('0x64'),_0x46db('0x51'),_0x46db('0x4d'),_0x46db('0x4e')],squel[_0x46db('0x65')]()['field'](_0x46db('0x61'),_0x46db('0x61'))[_0x46db('0x66')]('id',_0x46db('0x63'))['field'](_0x4b6441['CmListId'][_0x46db('0x69')](),_0x46db('0x64'))[_0x46db('0x66')](_0x24ba31[_0x46db('0x46')]['id'][_0x46db('0x69')](),'CampaignId')[_0x46db('0x66')](_0x46db('0x67'),_0x46db('0x4d'))[_0x46db('0x66')]('NOW()',_0x46db('0x4e'))['from']('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x46db('0x36')]('ListId\x20=\x20?',_0x4b6441['CmListId'][_0x46db('0x69')]())[_0x46db('0x36')](_0x46db('0x74')))[_0x46db('0x69')]();_0x1a8c65['push'](db[_0x46db('0x75')][_0x46db('0x29')](_0x4cb041));}return BPromise[_0x46db('0x76')](_0x1a8c65);}})['then'](function(){return _0x4a6108;})[_0x46db('0x3f')](respondWithResult(_0x2a9735,null))[_0x46db('0x44')](handleError(_0x2a9735,null));};exports[_0x46db('0x7c')]=function(_0x730299,_0x449935,_0x235090){var _0x1119d9;return db[_0x46db('0x25')][_0x46db('0x47')]({'where':{'id':_0x730299[_0x46db('0x46')]['id']}})['then'](handleEntityNotFound(_0x449935,null))[_0x46db('0x3f')](function(_0x326a4b){if(_0x326a4b){return _0x326a4b['removeBlackLists'](_0x730299['query'][_0x46db('0x5c')]);}})['then'](function(_0x3eec36){if(_0x3eec36){_0x1119d9=_0x3eec36;return db[_0x46db('0x58')][_0x46db('0x78')]({'where':{'ListId':_0x730299['query']['ids'],'CampaignId':_0x730299['params']['id']}})[_0x46db('0x3f')](function(){return _0x1119d9;});}})[_0x46db('0x3f')](respondWithStatusCode(_0x449935,null))[_0x46db('0x44')](handleError(_0x449935,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 76acb60..35a2bea 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 _0x5b0d=['moment','bluebird','request-promise','exports','define','Campaign','campaigns','lodash','util','../../config/logger','api'];(function(_0x5484b4,_0x36e33d){var _0x205d0b=function(_0x5875fa){while(--_0x5875fa){_0x5484b4['push'](_0x5484b4['shift']());}};_0x205d0b(++_0x36e33d);}(_0x5b0d,0x172));var _0xd5b0=function(_0x78e22f,_0x4cbc19){_0x78e22f=_0x78e22f-0x0;var _0x434513=_0x5b0d[_0x78e22f];return _0x434513;};'use strict';var _=require(_0xd5b0('0x0'));var util=require(_0xd5b0('0x1'));var logger=require(_0xd5b0('0x2'))(_0xd5b0('0x3'));var moment=require(_0xd5b0('0x4'));var BPromise=require(_0xd5b0('0x5'));var rp=require(_0xd5b0('0x6'));var attributes=require('./campaign.attributes');module[_0xd5b0('0x7')]=function(_0x7aede2,_0x523386){return _0x7aede2[_0xd5b0('0x8')](_0xd5b0('0x9'),attributes,{'tableName':_0xd5b0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44b3=['moment','request-promise','exports','Campaign','campaigns','lodash','util','../../config/logger','api'];(function(_0x49e9bc,_0x12d7a6){var _0x5f0107=function(_0x5cde8c){while(--_0x5cde8c){_0x49e9bc['push'](_0x49e9bc['shift']());}};_0x5f0107(++_0x12d7a6);}(_0x44b3,0x137));var _0x344b=function(_0x286f21,_0x209a79){_0x286f21=_0x286f21-0x0;var _0x4fc554=_0x44b3[_0x286f21];return _0x4fc554;};'use strict';var _=require(_0x344b('0x0'));var util=require(_0x344b('0x1'));var logger=require(_0x344b('0x2'))(_0x344b('0x3'));var moment=require(_0x344b('0x4'));var BPromise=require('bluebird');var rp=require(_0x344b('0x5'));var attributes=require('./campaign.attributes');module[_0x344b('0x6')]=function(_0x48e945,_0x30ad3b){return _0x48e945['define'](_0x344b('0x7'),attributes,{'tableName':_0x344b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index c2885ce..a93a0c5 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 _0xbc21=['result','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','GetCampaign','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xbc21,0xc1));var _0x1bc2=function(_0x46f8c7,_0x521550){_0x46f8c7=_0x46f8c7-0x0;var _0x59cbaa=_0xbc21[_0x46f8c7];return _0x59cbaa;};'use strict';var _=require(_0x1bc2('0x0'));var util=require(_0x1bc2('0x1'));var moment=require(_0x1bc2('0x2'));var BPromise=require(_0x1bc2('0x3'));var rs=require(_0x1bc2('0x4'));var fs=require('fs');var Redis=require(_0x1bc2('0x5'));var db=require(_0x1bc2('0x6'))['db'];var utils=require(_0x1bc2('0x7'));var logger=require(_0x1bc2('0x8'))(_0x1bc2('0x9'));var config=require('../../config/environment');var jayson=require(_0x1bc2('0xa'));var client=jayson[_0x1bc2('0xb')][_0x1bc2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2a3f42,_0x288ae0,_0xb4c5f){return new BPromise(function(_0x443daa,_0xe628b6){return client['request'](_0x2a3f42,_0xb4c5f)[_0x1bc2('0xd')](function(_0x20502f){logger[_0x1bc2('0xe')](_0x1bc2('0xf'),_0x288ae0,'request\x20sent');logger[_0x1bc2('0x10')](_0x1bc2('0x11'),_0x288ae0,_0x1bc2('0x12'),JSON[_0x1bc2('0x13')](_0x20502f));if(_0x20502f[_0x1bc2('0x14')]){if(_0x20502f[_0x1bc2('0x14')][_0x1bc2('0x15')]===0x1f4){logger[_0x1bc2('0x14')](_0x1bc2('0xf'),_0x288ae0,_0x20502f[_0x1bc2('0x14')][_0x1bc2('0x16')]);return _0xe628b6(_0x20502f[_0x1bc2('0x14')][_0x1bc2('0x16')]);}logger[_0x1bc2('0x14')](_0x1bc2('0xf'),_0x288ae0,_0x20502f[_0x1bc2('0x14')][_0x1bc2('0x16')]);return _0x443daa(_0x20502f['error'][_0x1bc2('0x16')]);}else{logger[_0x1bc2('0xe')](_0x1bc2('0xf'),_0x288ae0,'request\x20sent');_0x443daa(_0x20502f[_0x1bc2('0x17')][_0x1bc2('0x16')]);}})['catch'](function(_0xf7df4f){logger[_0x1bc2('0x14')](_0x1bc2('0xf'),_0x288ae0,_0xf7df4f);_0xe628b6(_0xf7df4f);});});}exports['GetCampaign']=function(_0x11be0b){var _0x151552=this;return new Promise(function(_0xda57d9,_0x1d72ae){return db[_0x1bc2('0x18')][_0x1bc2('0x19')]({'raw':_0x11be0b['options']?_0x11be0b[_0x1bc2('0x1a')][_0x1bc2('0x1b')]===undefined?!![]:![]:!![],'where':_0x11be0b['options']?_0x11be0b[_0x1bc2('0x1a')][_0x1bc2('0x1c')]||null:null,'attributes':_0x11be0b[_0x1bc2('0x1a')]?_0x11be0b[_0x1bc2('0x1a')][_0x1bc2('0x1d')]||null:null,'limit':_0x11be0b[_0x1bc2('0x1a')]?_0x11be0b[_0x1bc2('0x1a')][_0x1bc2('0x1e')]||null:null,'include':_0x11be0b[_0x1bc2('0x1a')]?_0x11be0b[_0x1bc2('0x1a')][_0x1bc2('0x1f')]?_[_0x1bc2('0x20')](_0x11be0b[_0x1bc2('0x1a')][_0x1bc2('0x1f')],function(_0x4ecd42){return{'model':db[_0x4ecd42[_0x1bc2('0x21')]],'as':_0x4ecd42['as'],'attributes':_0x4ecd42[_0x1bc2('0x1d')],'include':_0x4ecd42[_0x1bc2('0x1f')]?_[_0x1bc2('0x20')](_0x4ecd42[_0x1bc2('0x1f')],function(_0x465023){return{'model':db[_0x465023[_0x1bc2('0x21')]],'as':_0x465023['as'],'attributes':_0x465023[_0x1bc2('0x1d')],'include':_0x465023['include']?_[_0x1bc2('0x20')](_0x465023['include'],function(_0x44b789){return{'model':db[_0x44b789[_0x1bc2('0x21')]],'as':_0x44b789['as'],'attributes':_0x44b789[_0x1bc2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1bc2('0xd')](function(_0x3af6b8){logger[_0x1bc2('0xe')](_0x1bc2('0x22'),_0x11be0b);logger['debug'](_0x1bc2('0x22'),_0x11be0b,JSON[_0x1bc2('0x13')](_0x3af6b8));_0xda57d9(_0x3af6b8);})[_0x1bc2('0x23')](function(_0xfcfdb){logger[_0x1bc2('0x14')](_0x1bc2('0x22'),_0xfcfdb[_0x1bc2('0x16')],_0x11be0b);_0x1d72ae(_0x151552[_0x1bc2('0x14')](0x1f4,_0xfcfdb[_0x1bc2('0x16')]));});});}; \ No newline at end of file +var _0x471c=['GetCampaign','Campaign','findAll','options','raw','attributes','limit','include','map','model','then','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error','message','result','catch'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x471c,0x6c));var _0xc471=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x471c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc471('0x0'));var util=require('util');var moment=require(_0xc471('0x1'));var BPromise=require(_0xc471('0x2'));var rs=require(_0xc471('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc471('0x4'))['db'];var utils=require(_0xc471('0x5'));var logger=require('../../config/logger')(_0xc471('0x6'));var config=require(_0xc471('0x7'));var jayson=require(_0xc471('0x8'));var client=jayson['client'][_0xc471('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4deb25,_0x5dcfd8,_0x2cc473){return new BPromise(function(_0x43a6ec,_0xde8ac2){return client[_0xc471('0xa')](_0x4deb25,_0x2cc473)['then'](function(_0x4696d5){logger[_0xc471('0xb')](_0xc471('0xc'),_0x5dcfd8,_0xc471('0xd'));logger[_0xc471('0xe')](_0xc471('0xf'),_0x5dcfd8,'request\x20sent',JSON['stringify'](_0x4696d5));if(_0x4696d5[_0xc471('0x10')]){if(_0x4696d5[_0xc471('0x10')]['code']===0x1f4){logger['error'](_0xc471('0xc'),_0x5dcfd8,_0x4696d5[_0xc471('0x10')][_0xc471('0x11')]);return _0xde8ac2(_0x4696d5[_0xc471('0x10')][_0xc471('0x11')]);}logger[_0xc471('0x10')](_0xc471('0xc'),_0x5dcfd8,_0x4696d5['error'][_0xc471('0x11')]);return _0x43a6ec(_0x4696d5['error'][_0xc471('0x11')]);}else{logger['info'](_0xc471('0xc'),_0x5dcfd8,_0xc471('0xd'));_0x43a6ec(_0x4696d5[_0xc471('0x12')]['message']);}})[_0xc471('0x13')](function(_0xb76056){logger[_0xc471('0x10')](_0xc471('0xc'),_0x5dcfd8,_0xb76056);_0xde8ac2(_0xb76056);});});}exports[_0xc471('0x14')]=function(_0x4e8448){var _0x4bef90=this;return new Promise(function(_0x5b1fa6,_0xc017dd){return db[_0xc471('0x15')][_0xc471('0x16')]({'raw':_0x4e8448[_0xc471('0x17')]?_0x4e8448['options'][_0xc471('0x18')]===undefined?!![]:![]:!![],'where':_0x4e8448[_0xc471('0x17')]?_0x4e8448[_0xc471('0x17')]['where']||null:null,'attributes':_0x4e8448[_0xc471('0x17')]?_0x4e8448[_0xc471('0x17')][_0xc471('0x19')]||null:null,'limit':_0x4e8448[_0xc471('0x17')]?_0x4e8448[_0xc471('0x17')][_0xc471('0x1a')]||null:null,'include':_0x4e8448['options']?_0x4e8448['options'][_0xc471('0x1b')]?_[_0xc471('0x1c')](_0x4e8448[_0xc471('0x17')][_0xc471('0x1b')],function(_0x52b85b){return{'model':db[_0x52b85b[_0xc471('0x1d')]],'as':_0x52b85b['as'],'attributes':_0x52b85b[_0xc471('0x19')],'include':_0x52b85b['include']?_[_0xc471('0x1c')](_0x52b85b[_0xc471('0x1b')],function(_0x4eb55c){return{'model':db[_0x4eb55c[_0xc471('0x1d')]],'as':_0x4eb55c['as'],'attributes':_0x4eb55c[_0xc471('0x19')],'include':_0x4eb55c[_0xc471('0x1b')]?_[_0xc471('0x1c')](_0x4eb55c[_0xc471('0x1b')],function(_0x1845a6){return{'model':db[_0x1845a6['model']],'as':_0x1845a6['as'],'attributes':_0x1845a6[_0xc471('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc471('0x1e')](function(_0x54c54e){logger[_0xc471('0xb')](_0xc471('0x14'),_0x4e8448);logger[_0xc471('0xe')](_0xc471('0x14'),_0x4e8448,JSON[_0xc471('0x1f')](_0x54c54e));_0x5b1fa6(_0x54c54e);})[_0xc471('0x13')](function(_0x56430f){logger[_0xc471('0x10')]('GetCampaign',_0x56430f[_0xc471('0x11')],_0x4e8448);_0xc017dd(_0x4bef90[_0xc471('0x10')](0x1f4,_0x56430f['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 19e0b6f..8637b7a 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 _0x2af1=['addLists','update','delete','destroy','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','getHopperHistories','getHopperFinals','/:id/lists','getLists','post','create','/:id/clone','clone'];(function(_0x472362,_0x57103a){var _0x514796=function(_0x37a078){while(--_0x37a078){_0x472362['push'](_0x472362['shift']());}};_0x514796(++_0x57103a);}(_0x2af1,0x68));var _0x12af=function(_0x36a0bb,_0x43156c){_0x36a0bb=_0x36a0bb-0x0;var _0xab61e8=_0x2af1[_0x36a0bb];return _0xab61e8;};'use strict';var multer=require(_0x12af('0x0'));var util=require('util');var path=require(_0x12af('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x12af('0x2')]();var auth=require(_0x12af('0x3'));var interaction=require(_0x12af('0x4'));var config=require(_0x12af('0x5'));var controller=require('./campaign.controller');router[_0x12af('0x6')]('/',auth[_0x12af('0x7')](),controller[_0x12af('0x8')]);router[_0x12af('0x6')](_0x12af('0x9'),auth[_0x12af('0x7')](),controller[_0x12af('0xa')]);router['get'](_0x12af('0xb'),auth[_0x12af('0x7')](),controller[_0x12af('0xc')]);router[_0x12af('0x6')]('/:id/hopper_histories',auth[_0x12af('0x7')](),controller[_0x12af('0xd')]);router[_0x12af('0x6')]('/:id/hopper_finals',auth[_0x12af('0x7')](),controller[_0x12af('0xe')]);router[_0x12af('0x6')]('/:id/hopper_black',auth['isAuthenticated'](),controller['getHopperBlacks']);router['get'](_0x12af('0xf'),auth['isAuthenticated'](),controller[_0x12af('0x10')]);router[_0x12af('0x6')]('/:id/blacklists',auth[_0x12af('0x7')](),controller['getBlackLists']);router[_0x12af('0x11')]('/',auth['isAuthenticated'](),controller[_0x12af('0x12')]);router[_0x12af('0x11')](_0x12af('0x13'),auth[_0x12af('0x7')](),controller[_0x12af('0x14')]);router[_0x12af('0x11')](_0x12af('0xf'),auth[_0x12af('0x7')](),controller[_0x12af('0x15')]);router['post']('/:id/blacklists',auth[_0x12af('0x7')](),controller['addBlackLists']);router['put'](_0x12af('0x9'),auth[_0x12af('0x7')](),controller[_0x12af('0x16')]);router[_0x12af('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x12af('0x18')]);router['delete'](_0x12af('0xf'),auth['isAuthenticated'](),controller['removeLists']);router[_0x12af('0x17')]('/:id/blacklists',auth[_0x12af('0x7')](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file +var _0x40f2=['post','/:id/lists','addLists','update','delete','destroy','removeLists','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','index','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','create','/:id/clone','clone'];(function(_0x49beea,_0x47add1){var _0x27693a=function(_0x192ed8){while(--_0x192ed8){_0x49beea['push'](_0x49beea['shift']());}};_0x27693a(++_0x47add1);}(_0x40f2,0x1ab));var _0x240f=function(_0x1a24c3,_0x5350d0){_0x1a24c3=_0x1a24c3-0x0;var _0x2c5c3c=_0x40f2[_0x1a24c3];return _0x2c5c3c;};'use strict';var multer=require(_0x240f('0x0'));var util=require(_0x240f('0x1'));var path=require('path');var timeout=require(_0x240f('0x2'));var express=require(_0x240f('0x3'));var router=express[_0x240f('0x4')]();var auth=require(_0x240f('0x5'));var interaction=require(_0x240f('0x6'));var config=require(_0x240f('0x7'));var controller=require(_0x240f('0x8'));router[_0x240f('0x9')]('/',auth['isAuthenticated'](),controller[_0x240f('0xa')]);router['get'](_0x240f('0xb'),auth[_0x240f('0xc')](),controller[_0x240f('0xd')]);router[_0x240f('0x9')](_0x240f('0xe'),auth[_0x240f('0xc')](),controller[_0x240f('0xf')]);router['get'](_0x240f('0x10'),auth['isAuthenticated'](),controller[_0x240f('0x11')]);router[_0x240f('0x9')](_0x240f('0x12'),auth[_0x240f('0xc')](),controller[_0x240f('0x13')]);router[_0x240f('0x9')](_0x240f('0x14'),auth[_0x240f('0xc')](),controller[_0x240f('0x15')]);router[_0x240f('0x9')]('/:id/lists',auth[_0x240f('0xc')](),controller[_0x240f('0x16')]);router['get'](_0x240f('0x17'),auth[_0x240f('0xc')](),controller[_0x240f('0x18')]);router['post']('/',auth[_0x240f('0xc')](),controller[_0x240f('0x19')]);router['post'](_0x240f('0x1a'),auth[_0x240f('0xc')](),controller[_0x240f('0x1b')]);router[_0x240f('0x1c')](_0x240f('0x1d'),auth[_0x240f('0xc')](),controller[_0x240f('0x1e')]);router['post'](_0x240f('0x17'),auth[_0x240f('0xc')](),controller['addBlackLists']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x240f('0x1f')]);router[_0x240f('0x20')](_0x240f('0xb'),auth[_0x240f('0xc')](),controller[_0x240f('0x21')]);router[_0x240f('0x20')](_0x240f('0x1d'),auth[_0x240f('0xc')](),controller[_0x240f('0x22')]);router[_0x240f('0x20')]('/:id/blacklists',auth[_0x240f('0xc')](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 6aee7a4..dd66d0c 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 _0x8958=['exports'];(function(_0xd22d95,_0xc59f8f){var _0x15d7a3=function(_0x3db95c){while(--_0x3db95c){_0xd22d95['push'](_0xd22d95['shift']());}};_0x15d7a3(++_0xc59f8f);}(_0x8958,0x93));var _0x8895=function(_0x3a72c5,_0x44dfa9){_0x3a72c5=_0x3a72c5-0x0;var _0x2ff06f=_0x8958[_0x3a72c5];return _0x2ff06f;};'use strict';var Sequelize=require('sequelize');module[_0x8895('0x0')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2eb2=['TEXT','exports','STRING'];(function(_0x143565,_0x54d887){var _0x4dc1d9=function(_0x5e8838){while(--_0x5e8838){_0x143565['push'](_0x143565['shift']());}};_0x4dc1d9(++_0x54d887);}(_0x2eb2,0x19f));var _0x22eb=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x2eb2[_0x4d07cc];return _0x42de3b;};'use strict';var Sequelize=require('sequelize');module[_0x22eb('0x0')]={'key':{'type':Sequelize[_0x22eb('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x22eb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x22eb('0x1')]}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 833ff47..42fff85 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 _0x21d1=['papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','stack','name','send','CannedAnswer','rawAttributes','model','keys','query','dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','dateEnd','add','day','merge','filter','map','options','include','rows','params','includeAll','catch','body','find','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x1147ab,_0x10e72b){var _0x55cb5a=function(_0x364bd6){while(--_0x364bd6){_0x1147ab['push'](_0x1147ab['shift']());}};_0x55cb5a(++_0x10e72b);}(_0x21d1,0x1c9));var _0x121d=function(_0x326782,_0x2403b8){_0x326782=_0x326782-0x0;var _0x533153=_0x21d1[_0x326782];return _0x533153;};'use strict';var pdf=require(_0x121d('0x0'));var emlformat=require(_0x121d('0x1'));var rimraf=require(_0x121d('0x2'));var zipdir=require(_0x121d('0x3'));var jsonpatch=require(_0x121d('0x4'));var rp=require(_0x121d('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x121d('0x6'));var util=require(_0x121d('0x7'));var path=require(_0x121d('0x8'));var sox=require(_0x121d('0x9'));var csv=require(_0x121d('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x121d('0xb'));var squel=require(_0x121d('0xc'));var crypto=require(_0x121d('0xd'));var jsforce=require(_0x121d('0xe'));var deskjs=require(_0x121d('0xf'));var toCsv=require(_0x121d('0xa'));var querystring=require(_0x121d('0x10'));var Papa=require(_0x121d('0x11'));var Redis=require(_0x121d('0x12'));var qs=require(_0x121d('0x13'));var logger=require('../../config/logger')(_0x121d('0x14'));var utils=require(_0x121d('0x15'));var config=require(_0x121d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54b308,_0x39e001){_0x39e001=_0x39e001||0xcc;return function(_0x94145){if(_0x94145){return _0x54b308[_0x121d('0x17')](_0x39e001);}return _0x54b308['status'](_0x39e001)['end']();};}function respondWithResult(_0x29dd8c,_0x54a257){_0x54a257=_0x54a257||0xc8;return function(_0x1bb2cb){if(_0x1bb2cb){return _0x29dd8c[_0x121d('0x18')](_0x54a257)[_0x121d('0x19')](_0x1bb2cb);}};}function respondWithFilteredResult(_0x48e4ce,_0x224e01){return function(_0x10786c){if(_0x10786c){var _0x8296ad=_0x10786c[_0x121d('0x1a')],_0x8dec86=_0x224e01[_0x121d('0x1b')],_0x13f76a=_0x224e01[_0x121d('0x1b')]+_0x224e01[_0x121d('0x1c')],_0x6bf5e6;if(_0x13f76a>=_0x8296ad){_0x13f76a=_0x8296ad;_0x6bf5e6=0xc8;}else{_0x6bf5e6=0xce;}_0x48e4ce[_0x121d('0x18')](_0x6bf5e6);return _0x48e4ce[_0x121d('0x1d')](_0x121d('0x1e'),_0x8dec86+'-'+_0x13f76a+'/'+_0x8296ad)['json'](_0x10786c);}return null;};}function patchUpdates(_0x5a0b2d){return function(_0x48e041){try{jsonpatch[_0x121d('0x1f')](_0x48e041,_0x5a0b2d,!![]);}catch(_0x1ca294){return BPromise['reject'](_0x1ca294);}return _0x48e041[_0x121d('0x20')]();};}function saveUpdates(_0x378872,_0x18b802){return function(_0x2adec8){if(_0x2adec8){return _0x2adec8[_0x121d('0x21')](_0x378872)[_0x121d('0x22')](function(_0x477485){return _0x477485;});}return null;};}function removeEntity(_0x25844d,_0x22225a){return function(_0x3c6ff2){if(_0x3c6ff2){return _0x3c6ff2[_0x121d('0x23')]()[_0x121d('0x22')](function(){_0x25844d[_0x121d('0x18')](0xcc)[_0x121d('0x24')]();});}};}function handleEntityNotFound(_0x368f20,_0x115e47){return function(_0x3880fd){if(!_0x3880fd){_0x368f20[_0x121d('0x17')](0x194);}return _0x3880fd;};}function handleError(_0x331e9c,_0x1de3f8){_0x1de3f8=_0x1de3f8||0x1f4;return function(_0x1b5ce6){logger['error'](_0x1b5ce6[_0x121d('0x25')]);if(_0x1b5ce6[_0x121d('0x26')]){delete _0x1b5ce6[_0x121d('0x26')];}_0x331e9c[_0x121d('0x18')](_0x1de3f8)[_0x121d('0x27')](_0x1b5ce6);};}exports['index']=function(_0x2255e7,_0x54eb38){var _0x2aa75c={},_0x2697f0={},_0x4762fb={'count':0x0,'rows':[]};var _0x485aae=db[_0x121d('0x28')][_0x121d('0x29')];_0x2697f0[_0x121d('0x2a')]=_[_0x121d('0x2b')](_0x485aae);var _0x309e30={'dateStart':_0x2255e7[_0x121d('0x2c')]['dateStart'],'dateEnd':_0x2255e7[_0x121d('0x2c')]['dateEnd']};delete _0x2255e7[_0x121d('0x2c')][_0x121d('0x2d')];delete _0x2255e7[_0x121d('0x2c')]['dateEnd'];_0x2697f0['query']=_[_0x121d('0x2b')](_0x2255e7[_0x121d('0x2c')]);_0x2697f0[_0x121d('0x2e')]=_[_0x121d('0x2f')](_0x2697f0[_0x121d('0x2a')],_0x2697f0[_0x121d('0x2c')]);_0x2aa75c[_0x121d('0x30')]=_['intersection'](_0x2697f0[_0x121d('0x2a')],qs[_0x121d('0x31')](_0x2255e7[_0x121d('0x2c')][_0x121d('0x31')]));_0x2aa75c[_0x121d('0x30')]=_0x2aa75c[_0x121d('0x30')][_0x121d('0x32')]?_0x2aa75c[_0x121d('0x30')]:_0x2697f0['model'];if(!_0x2255e7[_0x121d('0x2c')][_0x121d('0x33')](_0x121d('0x34'))){_0x2aa75c[_0x121d('0x1c')]=qs[_0x121d('0x1c')](_0x2255e7[_0x121d('0x2c')][_0x121d('0x1c')]);_0x2aa75c[_0x121d('0x1b')]=qs[_0x121d('0x1b')](_0x2255e7['query'][_0x121d('0x1b')]);}_0x2aa75c[_0x121d('0x35')]=qs[_0x121d('0x36')](_0x2255e7['query'][_0x121d('0x36')]);_0x2aa75c[_0x121d('0x37')]=qs[_0x121d('0x2e')](_[_0x121d('0x38')](_0x2255e7[_0x121d('0x2c')],_0x2697f0[_0x121d('0x2e')]));if(_0x309e30[_0x121d('0x2d')]){if(_0x309e30['dateEnd']){_0x309e30[_0x121d('0x39')]=moment(_0x309e30[_0x121d('0x39')])[_0x121d('0x3a')](0x1,_0x121d('0x3b'));}else{_0x309e30['dateEnd']=moment(_0x309e30[_0x121d('0x2d')])[_0x121d('0x3a')](0x1,_0x121d('0x3b'));}_[_0x121d('0x3c')](_0x2aa75c[_0x121d('0x37')],{'createdAt':{'$gte':_0x309e30[_0x121d('0x2d')],'$lte':_0x309e30[_0x121d('0x39')]}});}if(_0x2255e7['query'][_0x121d('0x3d')]){_0x2aa75c[_0x121d('0x37')]=_[_0x121d('0x3c')](_0x2aa75c[_0x121d('0x37')],{'$or':_[_0x121d('0x3e')](_0x2aa75c[_0x121d('0x30')],function(_0x2b2c4a){var _0x5c79f1={};_0x5c79f1[_0x2b2c4a]={'$like':'%'+_0x2255e7[_0x121d('0x2c')]['filter']+'%'};return _0x5c79f1;})});}_0x2aa75c=_['merge']({},_0x2aa75c,_0x2255e7[_0x121d('0x3f')]);var _0x2cd556={'where':_0x2aa75c[_0x121d('0x37')]};return db['CannedAnswer']['count'](_0x2cd556)[_0x121d('0x22')](function(_0x4aa6be){_0x4762fb[_0x121d('0x1a')]=_0x4aa6be;if(_0x2255e7[_0x121d('0x2c')]['includeAll']){_0x2aa75c[_0x121d('0x40')]=[{'all':!![]}];}return db[_0x121d('0x28')]['findAll'](_0x2aa75c);})['then'](function(_0x10598c){_0x4762fb[_0x121d('0x41')]=_0x10598c;return _0x4762fb;})['then'](respondWithFilteredResult(_0x54eb38,_0x2aa75c))['catch'](handleError(_0x54eb38,null));};exports['show']=function(_0x5ddfbc,_0x3f6c8d){var _0x171bbe={'raw':!![],'where':{'id':_0x5ddfbc[_0x121d('0x42')]['id']}},_0x344ba4={};_0x344ba4[_0x121d('0x2a')]=_[_0x121d('0x2b')](db[_0x121d('0x28')][_0x121d('0x29')]);_0x344ba4['query']=_[_0x121d('0x2b')](_0x5ddfbc[_0x121d('0x2c')]);_0x344ba4['filters']=_[_0x121d('0x2f')](_0x344ba4[_0x121d('0x2a')],_0x344ba4['query']);_0x171bbe[_0x121d('0x30')]=_[_0x121d('0x2f')](_0x344ba4[_0x121d('0x2a')],qs[_0x121d('0x31')](_0x5ddfbc[_0x121d('0x2c')][_0x121d('0x31')]));_0x171bbe['attributes']=_0x171bbe['attributes'][_0x121d('0x32')]?_0x171bbe[_0x121d('0x30')]:_0x344ba4[_0x121d('0x2a')];if(_0x5ddfbc[_0x121d('0x2c')][_0x121d('0x43')]){_0x171bbe[_0x121d('0x40')]=[{'all':!![]}];}_0x171bbe=_[_0x121d('0x3c')]({},_0x171bbe,_0x5ddfbc['options']);return db[_0x121d('0x28')]['find'](_0x171bbe)[_0x121d('0x22')](handleEntityNotFound(_0x3f6c8d,null))['then'](respondWithResult(_0x3f6c8d,null))[_0x121d('0x44')](handleError(_0x3f6c8d,null));};exports[_0x121d('0x21')]=function(_0x4fde9a,_0x2b5c6b){if(_0x4fde9a[_0x121d('0x45')]['id']){delete _0x4fde9a[_0x121d('0x45')]['id'];}return db[_0x121d('0x28')][_0x121d('0x46')]({'where':{'id':_0x4fde9a[_0x121d('0x42')]['id']}})[_0x121d('0x22')](handleEntityNotFound(_0x2b5c6b,null))['then'](saveUpdates(_0x4fde9a[_0x121d('0x45')],null))[_0x121d('0x22')](respondWithResult(_0x2b5c6b,null))[_0x121d('0x44')](handleError(_0x2b5c6b,null));};exports[_0x121d('0x23')]=function(_0x58bca2,_0x1397d1){return db['CannedAnswer'][_0x121d('0x46')]({'where':{'id':_0x58bca2[_0x121d('0x42')]['id']}})['then'](handleEntityNotFound(_0x1397d1,null))[_0x121d('0x22')](removeEntity(_0x1397d1,null))[_0x121d('0x44')](handleError(_0x1397d1,null));};exports['create']=function(_0x96578c,_0x1aa2d6){var _0x53c9b2={'key':_0x96578c['body'][_0x121d('0x47')]};if(_0x96578c['body'][_0x121d('0x48')]){_0x53c9b2[_0x121d('0x48')]=_0x96578c[_0x121d('0x45')]['MailAccountId'];}else if(_0x96578c['body'][_0x121d('0x49')]){_0x53c9b2['SmsAccountId']=_0x96578c[_0x121d('0x45')][_0x121d('0x49')];}else if(_0x96578c['body'][_0x121d('0x4a')]){_0x53c9b2[_0x121d('0x4a')]=_0x96578c[_0x121d('0x45')][_0x121d('0x4a')];}else if(_0x96578c[_0x121d('0x45')][_0x121d('0x4b')]){_0x53c9b2['ChatWebsiteId']=_0x96578c[_0x121d('0x45')][_0x121d('0x4b')];}return db[_0x121d('0x28')]['find']({'where':_0x53c9b2})[_0x121d('0x22')](function(_0x524358){if(_0x524358){throw new db['Sequelize'][(_0x121d('0x4c'))](_0x121d('0x4d'));}return db[_0x121d('0x28')][_0x121d('0x4e')](_0x96578c[_0x121d('0x45')]);})[_0x121d('0x22')](respondWithResult(_0x1aa2d6,0xc9))['catch'](handleError(_0x1aa2d6,null));}; \ No newline at end of file +var _0x9de3=['html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','apply','reject','then','destroy','sendStatus','error','stack','name','index','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','add','day','merge','filter','options','count','includeAll','include','CannedAnswer','findAll','rows','show','params','find','catch','update','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.'];(function(_0x15125d,_0x29f35d){var _0x16116c=function(_0x3aeeb2){while(--_0x3aeeb2){_0x15125d['push'](_0x15125d['shift']());}};_0x16116c(++_0x29f35d);}(_0x9de3,0xea));var _0x39de=function(_0x926c65,_0x46f739){_0x926c65=_0x926c65-0x0;var _0x39563f=_0x9de3[_0x926c65];return _0x39563f;};'use strict';var pdf=require(_0x39de('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x39de('0x1'));var zipdir=require(_0x39de('0x2'));var jsonpatch=require(_0x39de('0x3'));var rp=require('request-promise');var moment=require(_0x39de('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x39de('0x5'));var util=require(_0x39de('0x6'));var path=require(_0x39de('0x7'));var sox=require(_0x39de('0x8'));var csv=require('to-csv');var ejs=require(_0x39de('0x9'));var fs=require('fs');var _=require(_0x39de('0xa'));var squel=require(_0x39de('0xb'));var crypto=require(_0x39de('0xc'));var jsforce=require(_0x39de('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x39de('0xe'));var Redis=require(_0x39de('0xf'));var qs=require(_0x39de('0x10'));var logger=require(_0x39de('0x11'))(_0x39de('0x12'));var utils=require(_0x39de('0x13'));var config=require(_0x39de('0x14'));var db=require(_0x39de('0x15'))['db'];function respondWithStatusCode(_0x4f92a1,_0x27772d){_0x27772d=_0x27772d||0xcc;return function(_0x5b1705){if(_0x5b1705){return _0x4f92a1['sendStatus'](_0x27772d);}return _0x4f92a1[_0x39de('0x16')](_0x27772d)[_0x39de('0x17')]();};}function respondWithResult(_0x32d610,_0x494764){_0x494764=_0x494764||0xc8;return function(_0x1c60af){if(_0x1c60af){return _0x32d610[_0x39de('0x16')](_0x494764)[_0x39de('0x18')](_0x1c60af);}};}function respondWithFilteredResult(_0x905132,_0x38fe3b){return function(_0x3ebd39){if(_0x3ebd39){var _0x229ecc=_0x3ebd39['count'],_0x25ca17=_0x38fe3b[_0x39de('0x19')],_0xaff589=_0x38fe3b[_0x39de('0x19')]+_0x38fe3b[_0x39de('0x1a')],_0x316fdb;if(_0xaff589>=_0x229ecc){_0xaff589=_0x229ecc;_0x316fdb=0xc8;}else{_0x316fdb=0xce;}_0x905132[_0x39de('0x16')](_0x316fdb);return _0x905132['set']('Content-Range',_0x25ca17+'-'+_0xaff589+'/'+_0x229ecc)[_0x39de('0x18')](_0x3ebd39);}return null;};}function patchUpdates(_0x5e9e37){return function(_0x1fb6fa){try{jsonpatch[_0x39de('0x1b')](_0x1fb6fa,_0x5e9e37,!![]);}catch(_0x534059){return BPromise[_0x39de('0x1c')](_0x534059);}return _0x1fb6fa['save']();};}function saveUpdates(_0x440201,_0x250553){return function(_0x4933ff){if(_0x4933ff){return _0x4933ff['update'](_0x440201)[_0x39de('0x1d')](function(_0x5e4ab2){return _0x5e4ab2;});}return null;};}function removeEntity(_0x552590,_0x315e4a){return function(_0x423fe2){if(_0x423fe2){return _0x423fe2[_0x39de('0x1e')]()[_0x39de('0x1d')](function(){_0x552590[_0x39de('0x16')](0xcc)[_0x39de('0x17')]();});}};}function handleEntityNotFound(_0x510765,_0x368f4a){return function(_0x3baec4){if(!_0x3baec4){_0x510765[_0x39de('0x1f')](0x194);}return _0x3baec4;};}function handleError(_0x578eaa,_0x372564){_0x372564=_0x372564||0x1f4;return function(_0x483d49){logger[_0x39de('0x20')](_0x483d49[_0x39de('0x21')]);if(_0x483d49[_0x39de('0x22')]){delete _0x483d49[_0x39de('0x22')];}_0x578eaa[_0x39de('0x16')](_0x372564)['send'](_0x483d49);};}exports[_0x39de('0x23')]=function(_0x2bd7c6,_0x2c65b7){var _0x73b579={},_0x4c7cab={},_0x3fd91a={'count':0x0,'rows':[]};var _0x59e64f=db['CannedAnswer'][_0x39de('0x24')];_0x4c7cab[_0x39de('0x25')]=_[_0x39de('0x26')](_0x59e64f);var _0x3ff4d8={'dateStart':_0x2bd7c6[_0x39de('0x27')]['dateStart'],'dateEnd':_0x2bd7c6[_0x39de('0x27')][_0x39de('0x28')]};delete _0x2bd7c6[_0x39de('0x27')][_0x39de('0x29')];delete _0x2bd7c6[_0x39de('0x27')][_0x39de('0x28')];_0x4c7cab[_0x39de('0x27')]=_['keys'](_0x2bd7c6[_0x39de('0x27')]);_0x4c7cab[_0x39de('0x2a')]=_[_0x39de('0x2b')](_0x4c7cab[_0x39de('0x25')],_0x4c7cab['query']);_0x73b579[_0x39de('0x2c')]=_[_0x39de('0x2b')](_0x4c7cab[_0x39de('0x25')],qs[_0x39de('0x2d')](_0x2bd7c6['query'][_0x39de('0x2d')]));_0x73b579[_0x39de('0x2c')]=_0x73b579[_0x39de('0x2c')][_0x39de('0x2e')]?_0x73b579[_0x39de('0x2c')]:_0x4c7cab['model'];if(!_0x2bd7c6['query'][_0x39de('0x2f')](_0x39de('0x30'))){_0x73b579[_0x39de('0x1a')]=qs[_0x39de('0x1a')](_0x2bd7c6['query'][_0x39de('0x1a')]);_0x73b579['offset']=qs[_0x39de('0x19')](_0x2bd7c6[_0x39de('0x27')][_0x39de('0x19')]);}_0x73b579['order']=qs[_0x39de('0x31')](_0x2bd7c6[_0x39de('0x27')][_0x39de('0x31')]);_0x73b579[_0x39de('0x32')]=qs[_0x39de('0x2a')](_[_0x39de('0x33')](_0x2bd7c6[_0x39de('0x27')],_0x4c7cab[_0x39de('0x2a')]));if(_0x3ff4d8[_0x39de('0x29')]){if(_0x3ff4d8['dateEnd']){_0x3ff4d8[_0x39de('0x28')]=moment(_0x3ff4d8[_0x39de('0x28')])[_0x39de('0x34')](0x1,_0x39de('0x35'));}else{_0x3ff4d8[_0x39de('0x28')]=moment(_0x3ff4d8['dateStart'])[_0x39de('0x34')](0x1,'day');}_[_0x39de('0x36')](_0x73b579[_0x39de('0x32')],{'createdAt':{'$gte':_0x3ff4d8[_0x39de('0x29')],'$lte':_0x3ff4d8[_0x39de('0x28')]}});}if(_0x2bd7c6[_0x39de('0x27')][_0x39de('0x37')]){_0x73b579[_0x39de('0x32')]=_[_0x39de('0x36')](_0x73b579[_0x39de('0x32')],{'$or':_['map'](_0x73b579[_0x39de('0x2c')],function(_0x3dd32d){var _0x208f24={};_0x208f24[_0x3dd32d]={'$like':'%'+_0x2bd7c6['query'][_0x39de('0x37')]+'%'};return _0x208f24;})});}_0x73b579=_[_0x39de('0x36')]({},_0x73b579,_0x2bd7c6[_0x39de('0x38')]);var _0x19ba28={'where':_0x73b579['where']};return db['CannedAnswer'][_0x39de('0x39')](_0x19ba28)[_0x39de('0x1d')](function(_0x46a9b9){_0x3fd91a[_0x39de('0x39')]=_0x46a9b9;if(_0x2bd7c6['query'][_0x39de('0x3a')]){_0x73b579[_0x39de('0x3b')]=[{'all':!![]}];}return db[_0x39de('0x3c')][_0x39de('0x3d')](_0x73b579);})[_0x39de('0x1d')](function(_0x2d393a){_0x3fd91a[_0x39de('0x3e')]=_0x2d393a;return _0x3fd91a;})[_0x39de('0x1d')](respondWithFilteredResult(_0x2c65b7,_0x73b579))['catch'](handleError(_0x2c65b7,null));};exports[_0x39de('0x3f')]=function(_0x2e1c5d,_0x4c3355){var _0x4bfb31={'raw':!![],'where':{'id':_0x2e1c5d[_0x39de('0x40')]['id']}},_0x1bfc75={};_0x1bfc75[_0x39de('0x25')]=_['keys'](db[_0x39de('0x3c')][_0x39de('0x24')]);_0x1bfc75[_0x39de('0x27')]=_['keys'](_0x2e1c5d[_0x39de('0x27')]);_0x1bfc75[_0x39de('0x2a')]=_[_0x39de('0x2b')](_0x1bfc75[_0x39de('0x25')],_0x1bfc75['query']);_0x4bfb31[_0x39de('0x2c')]=_[_0x39de('0x2b')](_0x1bfc75['model'],qs['fields'](_0x2e1c5d['query'][_0x39de('0x2d')]));_0x4bfb31[_0x39de('0x2c')]=_0x4bfb31[_0x39de('0x2c')][_0x39de('0x2e')]?_0x4bfb31[_0x39de('0x2c')]:_0x1bfc75[_0x39de('0x25')];if(_0x2e1c5d['query'][_0x39de('0x3a')]){_0x4bfb31[_0x39de('0x3b')]=[{'all':!![]}];}_0x4bfb31=_[_0x39de('0x36')]({},_0x4bfb31,_0x2e1c5d['options']);return db[_0x39de('0x3c')][_0x39de('0x41')](_0x4bfb31)['then'](handleEntityNotFound(_0x4c3355,null))['then'](respondWithResult(_0x4c3355,null))[_0x39de('0x42')](handleError(_0x4c3355,null));};exports[_0x39de('0x43')]=function(_0x47e8ee,_0x3c3403){if(_0x47e8ee[_0x39de('0x44')]['id']){delete _0x47e8ee['body']['id'];}return db[_0x39de('0x3c')][_0x39de('0x41')]({'where':{'id':_0x47e8ee[_0x39de('0x40')]['id']}})[_0x39de('0x1d')](handleEntityNotFound(_0x3c3403,null))[_0x39de('0x1d')](saveUpdates(_0x47e8ee['body'],null))[_0x39de('0x1d')](respondWithResult(_0x3c3403,null))[_0x39de('0x42')](handleError(_0x3c3403,null));};exports['destroy']=function(_0x45a201,_0x137f94){return db['CannedAnswer']['find']({'where':{'id':_0x45a201[_0x39de('0x40')]['id']}})['then'](handleEntityNotFound(_0x137f94,null))[_0x39de('0x1d')](removeEntity(_0x137f94,null))['catch'](handleError(_0x137f94,null));};exports[_0x39de('0x45')]=function(_0x329b0a,_0x2d4b32){var _0x58a177={'key':_0x329b0a[_0x39de('0x44')][_0x39de('0x46')]};if(_0x329b0a[_0x39de('0x44')]['MailAccountId']){_0x58a177[_0x39de('0x47')]=_0x329b0a[_0x39de('0x44')]['MailAccountId'];}else if(_0x329b0a['body'][_0x39de('0x48')]){_0x58a177[_0x39de('0x48')]=_0x329b0a[_0x39de('0x44')][_0x39de('0x48')];}else if(_0x329b0a[_0x39de('0x44')][_0x39de('0x49')]){_0x58a177[_0x39de('0x49')]=_0x329b0a[_0x39de('0x44')][_0x39de('0x49')];}else if(_0x329b0a['body'][_0x39de('0x4a')]){_0x58a177['ChatWebsiteId']=_0x329b0a[_0x39de('0x44')][_0x39de('0x4a')];}return db[_0x39de('0x3c')][_0x39de('0x41')]({'where':_0x58a177})['then'](function(_0x453ae7){if(_0x453ae7){throw new db[(_0x39de('0x4b'))][(_0x39de('0x4c'))](_0x39de('0x4d'));}return db[_0x39de('0x3c')]['create'](_0x329b0a['body']);})[_0x39de('0x1d')](respondWithResult(_0x2d4b32,0xc9))['catch'](handleError(_0x2d4b32,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 0113619..03fec59 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 _0xb643=['exports','CannedAnswer','tools_canned_answers','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x16de68,_0x33d7ff){var _0x1c277e=function(_0x1d8549){while(--_0x1d8549){_0x16de68['push'](_0x16de68['shift']());}};_0x1c277e(++_0x33d7ff);}(_0xb643,0xdb));var _0x3b64=function(_0x14a8a2,_0xb18a69){_0x14a8a2=_0x14a8a2-0x0;var _0x53729c=_0xb643[_0x14a8a2];return _0x53729c;};'use strict';var _=require(_0x3b64('0x0'));var util=require(_0x3b64('0x1'));var logger=require(_0x3b64('0x2'))('api');var moment=require(_0x3b64('0x3'));var BPromise=require(_0x3b64('0x4'));var rp=require(_0x3b64('0x5'));var attributes=require('./cannedAnswer.attributes');module[_0x3b64('0x6')]=function(_0x5444b4,_0x591a5c){return _0x5444b4['define'](_0x3b64('0x7'),attributes,{'tableName':_0x3b64('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf68e=['define','tools_canned_answers','../../config/logger','moment','bluebird','request-promise','./cannedAnswer.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf68e,0xea));var _0xef68=function(_0x44caa0,_0x33ce72){_0x44caa0=_0x44caa0-0x0;var _0x6783f1=_0xf68e[_0x44caa0];return _0x6783f1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xef68('0x0'))('api');var moment=require(_0xef68('0x1'));var BPromise=require(_0xef68('0x2'));var rp=require(_0xef68('0x3'));var attributes=require(_0xef68('0x4'));module[_0xef68('0x5')]=function(_0x58c44e,_0x443573){return _0x58c44e[_0xef68('0x6')]('CannedAnswer',attributes,{'tableName':_0xef68('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 4541572..c428403 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 _0x2a97=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring'];(function(_0xe1b5f6,_0x210c09){var _0x44636e=function(_0x3a3212){while(--_0x3a3212){_0xe1b5f6['push'](_0xe1b5f6['shift']());}};_0x44636e(++_0x210c09);}(_0x2a97,0xca));var _0x72a9=function(_0x4bd3db,_0x4cd165){_0x4bd3db=_0x4bd3db-0x0;var _0x23e82a=_0x2a97[_0x4bd3db];return _0x23e82a;};'use strict';var _=require(_0x72a9('0x0'));var util=require(_0x72a9('0x1'));var moment=require(_0x72a9('0x2'));var BPromise=require(_0x72a9('0x3'));var rs=require(_0x72a9('0x4'));var fs=require('fs');var Redis=require(_0x72a9('0x5'));var db=require(_0x72a9('0x6'))['db'];var utils=require(_0x72a9('0x7'));var logger=require(_0x72a9('0x8'))(_0x72a9('0x9'));var config=require(_0x72a9('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x72a9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3949de,_0x211ffe,_0x158c4a){return new BPromise(function(_0x15aeea,_0x434fc0){return client[_0x72a9('0xc')](_0x3949de,_0x158c4a)[_0x72a9('0xd')](function(_0x1be223){logger[_0x72a9('0xe')](_0x72a9('0xf'),_0x211ffe,_0x72a9('0x10'));logger[_0x72a9('0x11')](_0x72a9('0x12'),_0x211ffe,'request\x20sent',JSON[_0x72a9('0x13')](_0x1be223));if(_0x1be223['error']){if(_0x1be223[_0x72a9('0x14')][_0x72a9('0x15')]===0x1f4){logger[_0x72a9('0x14')](_0x72a9('0xf'),_0x211ffe,_0x1be223[_0x72a9('0x14')]['message']);return _0x434fc0(_0x1be223[_0x72a9('0x14')][_0x72a9('0x16')]);}logger[_0x72a9('0x14')](_0x72a9('0xf'),_0x211ffe,_0x1be223[_0x72a9('0x14')][_0x72a9('0x16')]);return _0x15aeea(_0x1be223[_0x72a9('0x14')][_0x72a9('0x16')]);}else{logger[_0x72a9('0xe')](_0x72a9('0xf'),_0x211ffe,'request\x20sent');_0x15aeea(_0x1be223['result'][_0x72a9('0x16')]);}})['catch'](function(_0x4699e7){logger[_0x72a9('0x14')](_0x72a9('0xf'),_0x211ffe,_0x4699e7);_0x434fc0(_0x4699e7);});});} \ No newline at end of file +var _0xac8b=['CannedAnswer,\x20%s,\x20%s','request\x20sent','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info'];(function(_0x18a436,_0x1dbe06){var _0x5c2cf8=function(_0x4712d1){while(--_0x4712d1){_0x18a436['push'](_0x18a436['shift']());}};_0x5c2cf8(++_0x1dbe06);}(_0xac8b,0x190));var _0xbac8=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0xac8b[_0x710815];return _0x5b3b89;};'use strict';var _=require(_0xbac8('0x0'));var util=require(_0xbac8('0x1'));var moment=require(_0xbac8('0x2'));var BPromise=require(_0xbac8('0x3'));var rs=require(_0xbac8('0x4'));var fs=require('fs');var Redis=require(_0xbac8('0x5'));var db=require(_0xbac8('0x6'))['db'];var utils=require(_0xbac8('0x7'));var logger=require(_0xbac8('0x8'))(_0xbac8('0x9'));var config=require('../../config/environment');var jayson=require(_0xbac8('0xa'));var client=jayson[_0xbac8('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb3decd,_0x5059c8,_0x2ed4ec){return new BPromise(function(_0x525c3b,_0x164e5d){return client[_0xbac8('0xc')](_0xb3decd,_0x2ed4ec)['then'](function(_0x54c59d){logger[_0xbac8('0xd')](_0xbac8('0xe'),_0x5059c8,_0xbac8('0xf'));logger['debug'](_0xbac8('0x10'),_0x5059c8,_0xbac8('0xf'),JSON[_0xbac8('0x11')](_0x54c59d));if(_0x54c59d[_0xbac8('0x12')]){if(_0x54c59d[_0xbac8('0x12')][_0xbac8('0x13')]===0x1f4){logger[_0xbac8('0x12')](_0xbac8('0xe'),_0x5059c8,_0x54c59d[_0xbac8('0x12')]['message']);return _0x164e5d(_0x54c59d[_0xbac8('0x12')][_0xbac8('0x14')]);}logger['error'](_0xbac8('0xe'),_0x5059c8,_0x54c59d[_0xbac8('0x12')]['message']);return _0x525c3b(_0x54c59d[_0xbac8('0x12')][_0xbac8('0x14')]);}else{logger[_0xbac8('0xd')]('CannedAnswer,\x20%s,\x20%s',_0x5059c8,'request\x20sent');_0x525c3b(_0x54c59d[_0xbac8('0x15')][_0xbac8('0x14')]);}})[_0xbac8('0x16')](function(_0x2f3847){logger['error'](_0xbac8('0xe'),_0x5059c8,_0x2f3847);_0x164e5d(_0x2f3847);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 8589df5..dab22e5 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 _0x382c=['destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','./cannedAnswer.controller','get','isAuthenticated','index','post','create','put','/:id'];(function(_0x2d8864,_0x34171a){var _0x435a6a=function(_0x3deecd){while(--_0x3deecd){_0x2d8864['push'](_0x2d8864['shift']());}};_0x435a6a(++_0x34171a);}(_0x382c,0xa7));var _0xc382=function(_0x15542f,_0x3d79d6){_0x15542f=_0x15542f-0x0;var _0x3f2d03=_0x382c[_0x15542f];return _0x3f2d03;};'use strict';var multer=require(_0xc382('0x0'));var util=require(_0xc382('0x1'));var path=require('path');var timeout=require(_0xc382('0x2'));var express=require('express');var router=express[_0xc382('0x3')]();var auth=require(_0xc382('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc382('0x5'));router[_0xc382('0x6')]('/',auth[_0xc382('0x7')](),controller[_0xc382('0x8')]);router[_0xc382('0x6')]('/:id',auth[_0xc382('0x7')](),controller['show']);router[_0xc382('0x9')]('/',auth['isAuthenticated'](),controller[_0xc382('0xa')]);router[_0xc382('0xb')](_0xc382('0xc'),auth[_0xc382('0x7')](),controller['update']);router['delete']('/:id',auth[_0xc382('0x7')](),controller[_0xc382('0xd')]);module[_0xc382('0xe')]=router; \ No newline at end of file +var _0xd136=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','create','put','delete','util','path'];(function(_0x275bb9,_0x4f2c68){var _0x521091=function(_0x5036ae){while(--_0x5036ae){_0x275bb9['push'](_0x275bb9['shift']());}};_0x521091(++_0x4f2c68);}(_0xd136,0x94));var _0x6d13=function(_0x391ed5,_0x54b202){_0x391ed5=_0x391ed5-0x0;var _0x100ec0=_0xd136[_0x391ed5];return _0x100ec0;};'use strict';var multer=require('multer');var util=require(_0x6d13('0x0'));var path=require(_0x6d13('0x1'));var timeout=require('connect-timeout');var express=require(_0x6d13('0x2'));var router=express[_0x6d13('0x3')]();var auth=require(_0x6d13('0x4'));var interaction=require(_0x6d13('0x5'));var config=require(_0x6d13('0x6'));var controller=require(_0x6d13('0x7'));router[_0x6d13('0x8')]('/',auth[_0x6d13('0x9')](),controller[_0x6d13('0xa')]);router['get'](_0x6d13('0xb'),auth[_0x6d13('0x9')](),controller['show']);router['post']('/',auth[_0x6d13('0x9')](),controller[_0x6d13('0xc')]);router[_0x6d13('0xd')](_0x6d13('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x6d13('0xe')](_0x6d13('0xb'),auth[_0x6d13('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index b5eb44a..3efdc6a 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 _0x524d=['STRING','INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x50838a,_0x5f31da){var _0x5d6a70=function(_0x328416){while(--_0x328416){_0x50838a['push'](_0x50838a['shift']());}};_0x5d6a70(++_0x5f31da);}(_0x524d,0x7a));var _0xd524=function(_0x1dcb57,_0x2c50f2){_0x1dcb57=_0x1dcb57-0x0;var _0x20a23e=_0x524d[_0x1dcb57];return _0x20a23e;};'use strict';var Sequelize=require(_0xd524('0x0'));module[_0xd524('0x1')]={'calldate':{'type':Sequelize[_0xd524('0x2')],'allowNull':![],'defaultValue':_0xd524('0x3')},'clid':{'type':Sequelize[_0xd524('0x4')]},'src':{'type':Sequelize[_0xd524('0x4')]},'dst':{'type':Sequelize[_0xd524('0x4')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xd524('0x4')]},'lastapp':{'type':Sequelize[_0xd524('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xd524('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xd524('0x4')]},'amaflags':{'type':Sequelize[_0xd524('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xd524('0x4')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xd524('0x4')]},'type':{'type':Sequelize[_0xd524('0x4')]},'tag':{'type':Sequelize[_0xd524('0x4')]}}; \ No newline at end of file +var _0x2b49=['sequelize','exports','DATE','STRING','INTEGER'];(function(_0x1e8666,_0x2e000a){var _0x30bcf5=function(_0x21b7ed){while(--_0x21b7ed){_0x1e8666['push'](_0x1e8666['shift']());}};_0x30bcf5(++_0x2e000a);}(_0x2b49,0x15e));var _0x92b4=function(_0x56ae2e,_0x539b75){_0x56ae2e=_0x56ae2e-0x0;var _0x2d4ad5=_0x2b49[_0x56ae2e];return _0x2d4ad5;};'use strict';var Sequelize=require(_0x92b4('0x0'));module[_0x92b4('0x1')]={'calldate':{'type':Sequelize[_0x92b4('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x92b4('0x3')]},'src':{'type':Sequelize[_0x92b4('0x3')]},'dst':{'type':Sequelize[_0x92b4('0x3')]},'dcontext':{'type':Sequelize[_0x92b4('0x3')]},'channel':{'type':Sequelize[_0x92b4('0x3')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x92b4('0x3')]},'duration':{'type':Sequelize[_0x92b4('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x92b4('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x92b4('0x3')]},'amaflags':{'type':Sequelize[_0x92b4('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x92b4('0x3')]},'userfield':{'type':Sequelize[_0x92b4('0x3')]},'uniqueid':{'type':Sequelize[_0x92b4('0x3')]},'linkedid':{'type':Sequelize[_0x92b4('0x3')]},'sequence':{'type':Sequelize[_0x92b4('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x92b4('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 76439d0..c8bc13f 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 _0x1042=['save','update','then','error','stack','name','send','Cdr','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','add','day','merge','filter','where','map','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply'];(function(_0x484cfa,_0x541cf8){var _0x3ac4c9=function(_0xa2d47c){while(--_0xa2d47c){_0x484cfa['push'](_0x484cfa['shift']());}};_0x3ac4c9(++_0x541cf8);}(_0x1042,0x1de));var _0x2104=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1042[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x2104('0x0'));var emlformat=require(_0x2104('0x1'));var rimraf=require(_0x2104('0x2'));var zipdir=require(_0x2104('0x3'));var jsonpatch=require(_0x2104('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2104('0x5'));var Mustache=require(_0x2104('0x6'));var util=require(_0x2104('0x7'));var path=require(_0x2104('0x8'));var sox=require(_0x2104('0x9'));var csv=require(_0x2104('0xa'));var ejs=require(_0x2104('0xb'));var fs=require('fs');var _=require(_0x2104('0xc'));var squel=require('squel');var crypto=require(_0x2104('0xd'));var jsforce=require(_0x2104('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2104('0xa'));var querystring=require(_0x2104('0xf'));var Papa=require(_0x2104('0x10'));var Redis=require(_0x2104('0x11'));var qs=require('../../components/parsers/qs');var logger=require(_0x2104('0x12'))(_0x2104('0x13'));var utils=require(_0x2104('0x14'));var config=require(_0x2104('0x15'));var db=require(_0x2104('0x16'))['db'];function respondWithStatusCode(_0x5aa360,_0x3cd3e4){_0x3cd3e4=_0x3cd3e4||0xcc;return function(_0x2e7c2c){if(_0x2e7c2c){return _0x5aa360[_0x2104('0x17')](_0x3cd3e4);}return _0x5aa360['status'](_0x3cd3e4)[_0x2104('0x18')]();};}function respondWithResult(_0x5c1299,_0x33b95b){_0x33b95b=_0x33b95b||0xc8;return function(_0x5d5113){if(_0x5d5113){return _0x5c1299[_0x2104('0x19')](_0x33b95b)[_0x2104('0x1a')](_0x5d5113);}};}function respondWithFilteredResult(_0xfd91e9,_0x4c16d4){return function(_0x27ba74){if(_0x27ba74){var _0x433ae9=_0x27ba74[_0x2104('0x1b')],_0x42bb8e=_0x4c16d4[_0x2104('0x1c')],_0x528045=_0x4c16d4['offset']+_0x4c16d4[_0x2104('0x1d')],_0x2a1779;if(_0x528045>=_0x433ae9){_0x528045=_0x433ae9;_0x2a1779=0xc8;}else{_0x2a1779=0xce;}_0xfd91e9[_0x2104('0x19')](_0x2a1779);return _0xfd91e9[_0x2104('0x1e')](_0x2104('0x1f'),_0x42bb8e+'-'+_0x528045+'/'+_0x433ae9)[_0x2104('0x1a')](_0x27ba74);}return null;};}function patchUpdates(_0x4b5319){return function(_0x10e9c7){try{jsonpatch[_0x2104('0x20')](_0x10e9c7,_0x4b5319,!![]);}catch(_0x3332b1){return BPromise['reject'](_0x3332b1);}return _0x10e9c7[_0x2104('0x21')]();};}function saveUpdates(_0x5d705c,_0x31600a){return function(_0x4b72f3){if(_0x4b72f3){return _0x4b72f3[_0x2104('0x22')](_0x5d705c)[_0x2104('0x23')](function(_0x396435){return _0x396435;});}return null;};}function removeEntity(_0x541c1c,_0x1a2056){return function(_0x33d374){if(_0x33d374){return _0x33d374['destroy']()[_0x2104('0x23')](function(){_0x541c1c[_0x2104('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x312553,_0x2f0463){return function(_0x3ff645){if(!_0x3ff645){_0x312553[_0x2104('0x17')](0x194);}return _0x3ff645;};}function handleError(_0x56c3d9,_0x44a457){_0x44a457=_0x44a457||0x1f4;return function(_0x10045b){logger[_0x2104('0x24')](_0x10045b[_0x2104('0x25')]);if(_0x10045b[_0x2104('0x26')]){delete _0x10045b['name'];}_0x56c3d9['status'](_0x44a457)[_0x2104('0x27')](_0x10045b);};}exports['index']=function(_0x377f59,_0x2eb316){var _0x3a88bd={},_0x244d46={},_0x18eb37={'count':0x0,'rows':[]};var _0x185f44=db[_0x2104('0x28')][_0x2104('0x29')];_0x244d46[_0x2104('0x2a')]=_[_0x2104('0x2b')](_0x185f44);var _0x525723={'dateStart':_0x377f59[_0x2104('0x2c')][_0x2104('0x2d')],'dateEnd':_0x377f59['query'][_0x2104('0x2e')]};delete _0x377f59[_0x2104('0x2c')][_0x2104('0x2d')];delete _0x377f59['query'][_0x2104('0x2e')];_0x244d46[_0x2104('0x2c')]=_['keys'](_0x377f59[_0x2104('0x2c')]);_0x244d46[_0x2104('0x2f')]=_['intersection'](_0x244d46[_0x2104('0x2a')],_0x244d46['query']);_0x3a88bd[_0x2104('0x30')]=_[_0x2104('0x31')](_0x244d46[_0x2104('0x2a')],qs[_0x2104('0x32')](_0x377f59[_0x2104('0x2c')]['fields']));_0x3a88bd[_0x2104('0x30')]=_0x3a88bd['attributes'][_0x2104('0x33')]?_0x3a88bd[_0x2104('0x30')]:_0x244d46[_0x2104('0x2a')];if(!_0x377f59[_0x2104('0x2c')][_0x2104('0x34')](_0x2104('0x35'))){_0x3a88bd[_0x2104('0x1d')]=qs[_0x2104('0x1d')](_0x377f59[_0x2104('0x2c')]['limit']);_0x3a88bd[_0x2104('0x1c')]=qs['offset'](_0x377f59[_0x2104('0x2c')][_0x2104('0x1c')]);}_0x3a88bd[_0x2104('0x36')]=qs['sort'](_0x377f59[_0x2104('0x2c')]['sort']);_0x3a88bd['where']=qs[_0x2104('0x2f')](_['pick'](_0x377f59[_0x2104('0x2c')],_0x244d46['filters']));if(_0x525723['dateStart']){if(_0x525723[_0x2104('0x2e')]){_0x525723['dateEnd']=moment(_0x525723[_0x2104('0x2e')])[_0x2104('0x37')](0x1,_0x2104('0x38'));}else{_0x525723[_0x2104('0x2e')]=moment(_0x525723['dateStart'])['add'](0x1,_0x2104('0x38'));}_[_0x2104('0x39')](_0x3a88bd['where'],{'createdAt':{'$gte':_0x525723[_0x2104('0x2d')],'$lte':_0x525723['dateEnd']}});}if(_0x377f59[_0x2104('0x2c')][_0x2104('0x3a')]){_0x3a88bd[_0x2104('0x3b')]=_[_0x2104('0x39')](_0x3a88bd[_0x2104('0x3b')],{'$or':_[_0x2104('0x3c')](_0x3a88bd[_0x2104('0x30')],function(_0x38bb51){var _0x163d08={};_0x163d08[_0x38bb51]={'$like':'%'+_0x377f59[_0x2104('0x2c')][_0x2104('0x3a')]+'%'};return _0x163d08;})});}_0x3a88bd=_[_0x2104('0x39')]({},_0x3a88bd,_0x377f59['options']);var _0x1f2358={'where':_0x3a88bd['where']};return db[_0x2104('0x28')][_0x2104('0x1b')](_0x1f2358)[_0x2104('0x23')](function(_0x43d4e0){_0x18eb37[_0x2104('0x1b')]=_0x43d4e0;if(_0x377f59[_0x2104('0x2c')][_0x2104('0x3d')]){_0x3a88bd[_0x2104('0x3e')]=[{'all':!![]}];}return db['Cdr'][_0x2104('0x3f')](_0x3a88bd);})[_0x2104('0x23')](function(_0x4c412b){_0x18eb37[_0x2104('0x40')]=_0x4c412b;return _0x18eb37;})[_0x2104('0x23')](respondWithFilteredResult(_0x2eb316,_0x3a88bd))[_0x2104('0x41')](handleError(_0x2eb316,null));};exports[_0x2104('0x42')]=function(_0x4ad7ac,_0x19dc96){var _0x3e9a71={'raw':!![],'where':{'id':_0x4ad7ac[_0x2104('0x43')]['id']}},_0x23fcdd={};_0x23fcdd[_0x2104('0x2a')]=_['keys'](db[_0x2104('0x28')][_0x2104('0x29')]);_0x23fcdd[_0x2104('0x2c')]=_[_0x2104('0x2b')](_0x4ad7ac[_0x2104('0x2c')]);_0x23fcdd['filters']=_[_0x2104('0x31')](_0x23fcdd[_0x2104('0x2a')],_0x23fcdd[_0x2104('0x2c')]);_0x3e9a71[_0x2104('0x30')]=_['intersection'](_0x23fcdd['model'],qs[_0x2104('0x32')](_0x4ad7ac[_0x2104('0x2c')][_0x2104('0x32')]));_0x3e9a71[_0x2104('0x30')]=_0x3e9a71[_0x2104('0x30')]['length']?_0x3e9a71[_0x2104('0x30')]:_0x23fcdd['model'];if(_0x4ad7ac[_0x2104('0x2c')][_0x2104('0x3d')]){_0x3e9a71[_0x2104('0x3e')]=[{'all':!![]}];}_0x3e9a71=_['merge']({},_0x3e9a71,_0x4ad7ac['options']);return db[_0x2104('0x28')][_0x2104('0x44')](_0x3e9a71)[_0x2104('0x23')](handleEntityNotFound(_0x19dc96,null))['then'](respondWithResult(_0x19dc96,null))['catch'](handleError(_0x19dc96,null));};exports['create']=function(_0x48441d,_0x41cdb6){return db[_0x2104('0x28')][_0x2104('0x45')](_0x48441d['body'],{})[_0x2104('0x23')](respondWithResult(_0x41cdb6,0xc9))['catch'](handleError(_0x41cdb6,null));};exports[_0x2104('0x22')]=function(_0x5db048,_0x566a98){if(_0x5db048[_0x2104('0x46')]['id']){delete _0x5db048['body']['id'];}return db[_0x2104('0x28')][_0x2104('0x44')]({'where':{'id':_0x5db048[_0x2104('0x43')]['id']}})[_0x2104('0x23')](handleEntityNotFound(_0x566a98,null))['then'](saveUpdates(_0x5db048[_0x2104('0x46')],null))[_0x2104('0x23')](respondWithResult(_0x566a98,null))[_0x2104('0x41')](handleError(_0x566a98,null));};exports[_0x2104('0x47')]=function(_0x58eef4,_0xcc2880){return db[_0x2104('0x28')]['find']({'where':{'id':_0x58eef4[_0x2104('0x43')]['id']}})['then'](handleEntityNotFound(_0xcc2880,null))[_0x2104('0x23')](removeEntity(_0xcc2880,null))[_0x2104('0x41')](handleError(_0xcc2880,null));};exports[_0x2104('0x48')]=function(_0x491900,_0x42cb5c){return db[_0x2104('0x28')]['describe']()[_0x2104('0x23')](respondWithResult(_0x42cb5c,null))[_0x2104('0x41')](handleError(_0x42cb5c,null));}; \ No newline at end of file +var _0x5b89=['../../config/environment','../../mysqldb','status','json','count','offset','limit','set','apply','reject','update','destroy','then','end','sendStatus','error','stack','name','send','index','Cdr','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','map','includeAll','include','rows','catch','show','params','length','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','../../config/utils'];(function(_0x168a00,_0x855b73){var _0x45dc46=function(_0xcb1caf){while(--_0xcb1caf){_0x168a00['push'](_0x168a00['shift']());}};_0x45dc46(++_0x855b73);}(_0x5b89,0x1a3));var _0x95b8=function(_0x547ff4,_0x416fa1){_0x547ff4=_0x547ff4-0x0;var _0xe41057=_0x5b89[_0x547ff4];return _0xe41057;};'use strict';var pdf=require(_0x95b8('0x0'));var emlformat=require(_0x95b8('0x1'));var rimraf=require(_0x95b8('0x2'));var zipdir=require(_0x95b8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x95b8('0x4'));var moment=require(_0x95b8('0x5'));var BPromise=require(_0x95b8('0x6'));var Mustache=require('mustache');var util=require(_0x95b8('0x7'));var path=require(_0x95b8('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x95b8('0x9'));var fs=require('fs');var _=require(_0x95b8('0xa'));var squel=require(_0x95b8('0xb'));var crypto=require('crypto');var jsforce=require(_0x95b8('0xc'));var deskjs=require(_0x95b8('0xd'));var toCsv=require('to-csv');var querystring=require(_0x95b8('0xe'));var Papa=require(_0x95b8('0xf'));var Redis=require(_0x95b8('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0x95b8('0x11'))('api');var utils=require(_0x95b8('0x12'));var config=require(_0x95b8('0x13'));var db=require(_0x95b8('0x14'))['db'];function respondWithStatusCode(_0x10c5c0,_0x3ca396){_0x3ca396=_0x3ca396||0xcc;return function(_0x3e8ceb){if(_0x3e8ceb){return _0x10c5c0['sendStatus'](_0x3ca396);}return _0x10c5c0[_0x95b8('0x15')](_0x3ca396)['end']();};}function respondWithResult(_0x13234b,_0x39821b){_0x39821b=_0x39821b||0xc8;return function(_0x550cdf){if(_0x550cdf){return _0x13234b['status'](_0x39821b)[_0x95b8('0x16')](_0x550cdf);}};}function respondWithFilteredResult(_0x5a8ef3,_0xc5a439){return function(_0x413b2f){if(_0x413b2f){var _0x31470c=_0x413b2f[_0x95b8('0x17')],_0x2d41f2=_0xc5a439[_0x95b8('0x18')],_0x49e9f2=_0xc5a439[_0x95b8('0x18')]+_0xc5a439[_0x95b8('0x19')],_0x5aff02;if(_0x49e9f2>=_0x31470c){_0x49e9f2=_0x31470c;_0x5aff02=0xc8;}else{_0x5aff02=0xce;}_0x5a8ef3[_0x95b8('0x15')](_0x5aff02);return _0x5a8ef3[_0x95b8('0x1a')]('Content-Range',_0x2d41f2+'-'+_0x49e9f2+'/'+_0x31470c)[_0x95b8('0x16')](_0x413b2f);}return null;};}function patchUpdates(_0x334b66){return function(_0x27a304){try{jsonpatch[_0x95b8('0x1b')](_0x27a304,_0x334b66,!![]);}catch(_0x5522c4){return BPromise[_0x95b8('0x1c')](_0x5522c4);}return _0x27a304['save']();};}function saveUpdates(_0x115102,_0x19f4c1){return function(_0x35aad1){if(_0x35aad1){return _0x35aad1[_0x95b8('0x1d')](_0x115102)['then'](function(_0x132562){return _0x132562;});}return null;};}function removeEntity(_0x28e448,_0x476b12){return function(_0x313783){if(_0x313783){return _0x313783[_0x95b8('0x1e')]()[_0x95b8('0x1f')](function(){_0x28e448[_0x95b8('0x15')](0xcc)[_0x95b8('0x20')]();});}};}function handleEntityNotFound(_0x4767a2,_0x476db8){return function(_0x329910){if(!_0x329910){_0x4767a2[_0x95b8('0x21')](0x194);}return _0x329910;};}function handleError(_0x38876a,_0x4e417f){_0x4e417f=_0x4e417f||0x1f4;return function(_0x8050c7){logger[_0x95b8('0x22')](_0x8050c7[_0x95b8('0x23')]);if(_0x8050c7[_0x95b8('0x24')]){delete _0x8050c7[_0x95b8('0x24')];}_0x38876a[_0x95b8('0x15')](_0x4e417f)[_0x95b8('0x25')](_0x8050c7);};}exports[_0x95b8('0x26')]=function(_0x4ee4ab,_0x3b0419){var _0x2ea623={},_0xe1d1b={},_0x3eb1a6={'count':0x0,'rows':[]};var _0x48f424=db[_0x95b8('0x27')][_0x95b8('0x28')];_0xe1d1b[_0x95b8('0x29')]=_[_0x95b8('0x2a')](_0x48f424);var _0x2e374f={'dateStart':_0x4ee4ab[_0x95b8('0x2b')][_0x95b8('0x2c')],'dateEnd':_0x4ee4ab[_0x95b8('0x2b')][_0x95b8('0x2d')]};delete _0x4ee4ab[_0x95b8('0x2b')]['dateStart'];delete _0x4ee4ab['query'][_0x95b8('0x2d')];_0xe1d1b[_0x95b8('0x2b')]=_['keys'](_0x4ee4ab['query']);_0xe1d1b[_0x95b8('0x2e')]=_[_0x95b8('0x2f')](_0xe1d1b['model'],_0xe1d1b[_0x95b8('0x2b')]);_0x2ea623[_0x95b8('0x30')]=_['intersection'](_0xe1d1b[_0x95b8('0x29')],qs[_0x95b8('0x31')](_0x4ee4ab[_0x95b8('0x2b')]['fields']));_0x2ea623[_0x95b8('0x30')]=_0x2ea623[_0x95b8('0x30')]['length']?_0x2ea623['attributes']:_0xe1d1b[_0x95b8('0x29')];if(!_0x4ee4ab[_0x95b8('0x2b')][_0x95b8('0x32')](_0x95b8('0x33'))){_0x2ea623[_0x95b8('0x19')]=qs[_0x95b8('0x19')](_0x4ee4ab['query'][_0x95b8('0x19')]);_0x2ea623[_0x95b8('0x18')]=qs[_0x95b8('0x18')](_0x4ee4ab[_0x95b8('0x2b')][_0x95b8('0x18')]);}_0x2ea623[_0x95b8('0x34')]=qs[_0x95b8('0x35')](_0x4ee4ab[_0x95b8('0x2b')][_0x95b8('0x35')]);_0x2ea623[_0x95b8('0x36')]=qs['filters'](_[_0x95b8('0x37')](_0x4ee4ab[_0x95b8('0x2b')],_0xe1d1b[_0x95b8('0x2e')]));if(_0x2e374f[_0x95b8('0x2c')]){if(_0x2e374f[_0x95b8('0x2d')]){_0x2e374f[_0x95b8('0x2d')]=moment(_0x2e374f['dateEnd'])[_0x95b8('0x38')](0x1,_0x95b8('0x39'));}else{_0x2e374f[_0x95b8('0x2d')]=moment(_0x2e374f[_0x95b8('0x2c')])[_0x95b8('0x38')](0x1,_0x95b8('0x39'));}_[_0x95b8('0x3a')](_0x2ea623[_0x95b8('0x36')],{'createdAt':{'$gte':_0x2e374f[_0x95b8('0x2c')],'$lte':_0x2e374f[_0x95b8('0x2d')]}});}if(_0x4ee4ab[_0x95b8('0x2b')][_0x95b8('0x3b')]){_0x2ea623[_0x95b8('0x36')]=_['merge'](_0x2ea623[_0x95b8('0x36')],{'$or':_[_0x95b8('0x3c')](_0x2ea623['attributes'],function(_0x572930){var _0x459762={};_0x459762[_0x572930]={'$like':'%'+_0x4ee4ab[_0x95b8('0x2b')][_0x95b8('0x3b')]+'%'};return _0x459762;})});}_0x2ea623=_[_0x95b8('0x3a')]({},_0x2ea623,_0x4ee4ab['options']);var _0x52ea3c={'where':_0x2ea623[_0x95b8('0x36')]};return db[_0x95b8('0x27')][_0x95b8('0x17')](_0x52ea3c)[_0x95b8('0x1f')](function(_0xbde2c7){_0x3eb1a6[_0x95b8('0x17')]=_0xbde2c7;if(_0x4ee4ab[_0x95b8('0x2b')][_0x95b8('0x3d')]){_0x2ea623[_0x95b8('0x3e')]=[{'all':!![]}];}return db[_0x95b8('0x27')]['findAll'](_0x2ea623);})[_0x95b8('0x1f')](function(_0x27902a){_0x3eb1a6[_0x95b8('0x3f')]=_0x27902a;return _0x3eb1a6;})['then'](respondWithFilteredResult(_0x3b0419,_0x2ea623))[_0x95b8('0x40')](handleError(_0x3b0419,null));};exports[_0x95b8('0x41')]=function(_0xf79483,_0x239c81){var _0x44baf6={'raw':!![],'where':{'id':_0xf79483[_0x95b8('0x42')]['id']}},_0x2a9b02={};_0x2a9b02[_0x95b8('0x29')]=_['keys'](db[_0x95b8('0x27')][_0x95b8('0x28')]);_0x2a9b02['query']=_['keys'](_0xf79483[_0x95b8('0x2b')]);_0x2a9b02[_0x95b8('0x2e')]=_[_0x95b8('0x2f')](_0x2a9b02[_0x95b8('0x29')],_0x2a9b02['query']);_0x44baf6[_0x95b8('0x30')]=_[_0x95b8('0x2f')](_0x2a9b02[_0x95b8('0x29')],qs[_0x95b8('0x31')](_0xf79483[_0x95b8('0x2b')][_0x95b8('0x31')]));_0x44baf6['attributes']=_0x44baf6['attributes'][_0x95b8('0x43')]?_0x44baf6[_0x95b8('0x30')]:_0x2a9b02['model'];if(_0xf79483[_0x95b8('0x2b')][_0x95b8('0x3d')]){_0x44baf6[_0x95b8('0x3e')]=[{'all':!![]}];}_0x44baf6=_[_0x95b8('0x3a')]({},_0x44baf6,_0xf79483[_0x95b8('0x44')]);return db[_0x95b8('0x27')][_0x95b8('0x45')](_0x44baf6)['then'](handleEntityNotFound(_0x239c81,null))['then'](respondWithResult(_0x239c81,null))[_0x95b8('0x40')](handleError(_0x239c81,null));};exports[_0x95b8('0x46')]=function(_0x1e1600,_0x6a530a){return db['Cdr'][_0x95b8('0x46')](_0x1e1600[_0x95b8('0x47')],{})[_0x95b8('0x1f')](respondWithResult(_0x6a530a,0xc9))[_0x95b8('0x40')](handleError(_0x6a530a,null));};exports[_0x95b8('0x1d')]=function(_0x2dcf01,_0x4e7e3d){if(_0x2dcf01[_0x95b8('0x47')]['id']){delete _0x2dcf01[_0x95b8('0x47')]['id'];}return db[_0x95b8('0x27')][_0x95b8('0x45')]({'where':{'id':_0x2dcf01['params']['id']}})[_0x95b8('0x1f')](handleEntityNotFound(_0x4e7e3d,null))[_0x95b8('0x1f')](saveUpdates(_0x2dcf01['body'],null))['then'](respondWithResult(_0x4e7e3d,null))[_0x95b8('0x40')](handleError(_0x4e7e3d,null));};exports[_0x95b8('0x1e')]=function(_0x4695d1,_0x14de10){return db[_0x95b8('0x27')][_0x95b8('0x45')]({'where':{'id':_0x4695d1[_0x95b8('0x42')]['id']}})[_0x95b8('0x1f')](handleEntityNotFound(_0x14de10,null))[_0x95b8('0x1f')](removeEntity(_0x14de10,null))['catch'](handleError(_0x14de10,null));};exports[_0x95b8('0x48')]=function(_0x17bf43,_0x47ea9d){return db['Cdr'][_0x95b8('0x48')]()[_0x95b8('0x1f')](respondWithResult(_0x47ea9d,null))[_0x95b8('0x40')](handleError(_0x47ea9d,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index e4f1dd9..933bd19 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 _0x5651=['../../config/logger','api','./cdr.attributes','define','Cdr','cdr','accountcode','calldate','disposition','dst','uniqueid','lodash','util'];(function(_0x531140,_0x30056d){var _0x153e09=function(_0x5674b3){while(--_0x5674b3){_0x531140['push'](_0x531140['shift']());}};_0x153e09(++_0x30056d);}(_0x5651,0x73));var _0x1565=function(_0x3da612,_0x332456){_0x3da612=_0x3da612-0x0;var _0x1a9d1d=_0x5651[_0x3da612];return _0x1a9d1d;};'use strict';var _=require(_0x1565('0x0'));var util=require(_0x1565('0x1'));var logger=require(_0x1565('0x2'))(_0x1565('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x1565('0x4'));module['exports']=function(_0x2ccf91,_0x4d55c2){return _0x2ccf91[_0x1565('0x5')](_0x1565('0x6'),attributes,{'tableName':_0x1565('0x7'),'paranoid':![],'indexes':[{'name':_0x1565('0x8'),'fields':[_0x1565('0x8')]},{'name':_0x1565('0x9'),'fields':['calldate']},{'name':_0x1565('0xa'),'fields':['disposition']},{'name':_0x1565('0xb'),'fields':[_0x1565('0xb')]},{'name':'src','fields':['src']},{'name':_0x1565('0xc'),'fields':[_0x1565('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x0afb=['api','moment','bluebird','request-promise','./cdr.attributes','exports','define','Cdr','cdr','accountcode','calldate','disposition','dst','src','lodash','util','../../config/logger'];(function(_0x516927,_0xb4aad0){var _0x30749b=function(_0x2ca6cc){while(--_0x2ca6cc){_0x516927['push'](_0x516927['shift']());}};_0x30749b(++_0xb4aad0);}(_0x0afb,0x151));var _0xb0af=function(_0x3137ef,_0x2058dc){_0x3137ef=_0x3137ef-0x0;var _0x5a99a6=_0x0afb[_0x3137ef];return _0x5a99a6;};'use strict';var _=require(_0xb0af('0x0'));var util=require(_0xb0af('0x1'));var logger=require(_0xb0af('0x2'))(_0xb0af('0x3'));var moment=require(_0xb0af('0x4'));var BPromise=require(_0xb0af('0x5'));var rp=require(_0xb0af('0x6'));var attributes=require(_0xb0af('0x7'));module[_0xb0af('0x8')]=function(_0x4ac44e,_0x53dedc){return _0x4ac44e[_0xb0af('0x9')](_0xb0af('0xa'),attributes,{'tableName':_0xb0af('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0xb0af('0xc')]},{'name':'calldate','fields':[_0xb0af('0xd')]},{'name':_0xb0af('0xe'),'fields':['disposition']},{'name':_0xb0af('0xf'),'fields':[_0xb0af('0xf')]},{'name':_0xb0af('0x10'),'fields':[_0xb0af('0x10')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index ef2318a..99a3c8c 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 _0xfac5=['Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','http','request','then'];(function(_0x3358f1,_0x5d740){var _0x15bfd5=function(_0x5b5d01){while(--_0x5b5d01){_0x3358f1['push'](_0x3358f1['shift']());}};_0x15bfd5(++_0x5d740);}(_0xfac5,0x16f));var _0x5fac=function(_0x5a5acc,_0x363664){_0x5a5acc=_0x5a5acc-0x0;var _0x236363=_0xfac5[_0x5a5acc];return _0x236363;};'use strict';var _=require(_0x5fac('0x0'));var util=require('util');var moment=require(_0x5fac('0x1'));var BPromise=require(_0x5fac('0x2'));var rs=require(_0x5fac('0x3'));var fs=require('fs');var Redis=require(_0x5fac('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5fac('0x5'))('rpc');var config=require(_0x5fac('0x6'));var jayson=require(_0x5fac('0x7'));var client=jayson['client'][_0x5fac('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3eb0d2,_0x5b054f,_0x4add5e){return new BPromise(function(_0xb8071c,_0x40ac3f){return client[_0x5fac('0x9')](_0x3eb0d2,_0x4add5e)[_0x5fac('0xa')](function(_0x2de5e0){logger['info'](_0x5fac('0xb'),_0x5b054f,_0x5fac('0xc'));logger[_0x5fac('0xd')](_0x5fac('0xe'),_0x5b054f,_0x5fac('0xc'),JSON[_0x5fac('0xf')](_0x2de5e0));if(_0x2de5e0[_0x5fac('0x10')]){if(_0x2de5e0[_0x5fac('0x10')][_0x5fac('0x11')]===0x1f4){logger[_0x5fac('0x10')](_0x5fac('0xb'),_0x5b054f,_0x2de5e0[_0x5fac('0x10')][_0x5fac('0x12')]);return _0x40ac3f(_0x2de5e0[_0x5fac('0x10')][_0x5fac('0x12')]);}logger['error'](_0x5fac('0xb'),_0x5b054f,_0x2de5e0[_0x5fac('0x10')][_0x5fac('0x12')]);return _0xb8071c(_0x2de5e0[_0x5fac('0x10')]['message']);}else{logger[_0x5fac('0x13')](_0x5fac('0xb'),_0x5b054f,'request\x20sent');_0xb8071c(_0x2de5e0['result']['message']);}})[_0x5fac('0x14')](function(_0x1df47d){logger[_0x5fac('0x10')](_0x5fac('0xb'),_0x5b054f,_0x1df47d);_0x40ac3f(_0x1df47d);});});} \ No newline at end of file +var _0x726d=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x6dc234,_0x52e5d3){var _0xf6b2d1=function(_0x31fed0){while(--_0x31fed0){_0x6dc234['push'](_0x6dc234['shift']());}};_0xf6b2d1(++_0x52e5d3);}(_0x726d,0x1e1));var _0xd726=function(_0x4a575b,_0x3459b9){_0x4a575b=_0x4a575b-0x0;var _0x2b7ca4=_0x726d[_0x4a575b];return _0x2b7ca4;};'use strict';var _=require(_0xd726('0x0'));var util=require(_0xd726('0x1'));var moment=require('moment');var BPromise=require(_0xd726('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd726('0x3'));var db=require(_0xd726('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd726('0x5'))(_0xd726('0x6'));var config=require('../../config/environment');var jayson=require(_0xd726('0x7'));var client=jayson[_0xd726('0x8')][_0xd726('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d6c60,_0x4544d7,_0x32ed82){return new BPromise(function(_0xa8a2c6,_0x1cef8c){return client['request'](_0x2d6c60,_0x32ed82)[_0xd726('0xa')](function(_0x20abc4){logger[_0xd726('0xb')](_0xd726('0xc'),_0x4544d7,_0xd726('0xd'));logger[_0xd726('0xe')](_0xd726('0xf'),_0x4544d7,_0xd726('0xd'),JSON[_0xd726('0x10')](_0x20abc4));if(_0x20abc4[_0xd726('0x11')]){if(_0x20abc4['error'][_0xd726('0x12')]===0x1f4){logger[_0xd726('0x11')]('Cdr,\x20%s,\x20%s',_0x4544d7,_0x20abc4['error'][_0xd726('0x13')]);return _0x1cef8c(_0x20abc4[_0xd726('0x11')]['message']);}logger[_0xd726('0x11')](_0xd726('0xc'),_0x4544d7,_0x20abc4[_0xd726('0x11')][_0xd726('0x13')]);return _0xa8a2c6(_0x20abc4['error']['message']);}else{logger['info'](_0xd726('0xc'),_0x4544d7,_0xd726('0xd'));_0xa8a2c6(_0x20abc4[_0xd726('0x14')][_0xd726('0x13')]);}})['catch'](function(_0x593d71){logger[_0xd726('0x11')](_0xd726('0xc'),_0x4544d7,_0x593d71);_0x1cef8c(_0x593d71);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index ff46234..2c40512 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 _0x461c=['multer','connect-timeout','express','../../config/environment','./cdr.controller','get','isAuthenticated','index','/describe','/:id','show','post','delete','destroy'];(function(_0xd65edd,_0x1b6da2){var _0x16cf4d=function(_0x24341b){while(--_0x24341b){_0xd65edd['push'](_0xd65edd['shift']());}};_0x16cf4d(++_0x1b6da2);}(_0x461c,0x134));var _0xc461=function(_0x39e9ed,_0x24ebc0){_0x39e9ed=_0x39e9ed-0x0;var _0xfa8b4=_0x461c[_0x39e9ed];return _0xfa8b4;};'use strict';var multer=require(_0xc461('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc461('0x1'));var express=require(_0xc461('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc461('0x3'));var controller=require(_0xc461('0x4'));router[_0xc461('0x5')]('/',auth[_0xc461('0x6')](),controller[_0xc461('0x7')]);router[_0xc461('0x5')](_0xc461('0x8'),auth[_0xc461('0x6')](),controller['describe']);router[_0xc461('0x5')](_0xc461('0x9'),auth[_0xc461('0x6')](),controller[_0xc461('0xa')]);router[_0xc461('0xb')]('/',auth[_0xc461('0x6')](),controller['create']);router['put']('/:id',auth[_0xc461('0x6')](),controller['update']);router[_0xc461('0xc')]('/:id',auth[_0xc461('0x6')](),controller[_0xc461('0xd')]);module['exports']=router; \ No newline at end of file +var _0x1cb9=['isAuthenticated','index','/describe','post','create','put','/:id','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x1efa36,_0x444000){var _0x2b05d8=function(_0x2c7db8){while(--_0x2c7db8){_0x1efa36['push'](_0x1efa36['shift']());}};_0x2b05d8(++_0x444000);}(_0x1cb9,0x14e));var _0x91cb=function(_0x54156f,_0x258691){_0x54156f=_0x54156f-0x0;var _0x5aa48e=_0x1cb9[_0x54156f];return _0x5aa48e;};'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('./cdr.controller');router[_0x91cb('0x7')]('/',auth[_0x91cb('0x8')](),controller[_0x91cb('0x9')]);router[_0x91cb('0x7')](_0x91cb('0xa'),auth[_0x91cb('0x8')](),controller['describe']);router[_0x91cb('0x7')]('/:id',auth[_0x91cb('0x8')](),controller['show']);router[_0x91cb('0xb')]('/',auth[_0x91cb('0x8')](),controller[_0x91cb('0xc')]);router[_0x91cb('0xd')](_0x91cb('0xe'),auth[_0x91cb('0x8')](),controller[_0x91cb('0xf')]);router[_0x91cb('0x10')](_0x91cb('0xe'),auth[_0x91cb('0x8')](),controller['destroy']);module[_0x91cb('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index c11a924..96ed689 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 _0x5721=['*,*,*,*','INTEGER','STRING','noop'];(function(_0x2f202e,_0x5ed293){var _0x398ac6=function(_0x49bda9){while(--_0x49bda9){_0x2f202e['push'](_0x2f202e['shift']());}};_0x398ac6(++_0x5ed293);}(_0x5721,0x1f1));var _0x1572=function(_0x33a007,_0x486aa5){_0x33a007=_0x33a007-0x0;var _0x2674dd=_0x5721[_0x33a007];return _0x2674dd;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x1572('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x1572('0x1')],'allowNull':![],'defaultValue':_0x1572('0x2')},'appdata':{'type':Sequelize['STRING'](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0x1572('0x1')]},'interval':{'type':Sequelize[_0x1572('0x1')],'defaultValue':_0x1572('0x3')}}; \ No newline at end of file +var _0x1e6e=['noop','*,*,*,*','sequelize','exports','STRING'];(function(_0x3c1928,_0x35b748){var _0x465e03=function(_0x4aea5a){while(--_0x4aea5a){_0x3c1928['push'](_0x3c1928['shift']());}};_0x465e03(++_0x35b748);}(_0x1e6e,0x1dd));var _0xe1e6=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x1e6e[_0x599f41];return _0x2e4d58;};'use strict';var Sequelize=require(_0xe1e6('0x0'));module[_0xe1e6('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xe1e6('0x2')],'allowNull':![],'defaultValue':_0xe1e6('0x3')},'appdata':{'type':Sequelize[_0xe1e6('0x2')](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0xe1e6('0x2')]},'interval':{'type':Sequelize[_0xe1e6('0x2')],'defaultValue':_0xe1e6('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index b68c316..82b5b24 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 _0xa875=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','params','keys','rawAttributes','query','filters','intersection','model','attributes','fields','length','includeAll','include','options','find','catch','body','ChatApplication','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','sox','ejs','squel','crypto','jsforce'];(function(_0x2a0919,_0x5b0e23){var _0x3f11c6=function(_0x3c670d){while(--_0x3c670d){_0x2a0919['push'](_0x2a0919['shift']());}};_0x3f11c6(++_0x5b0e23);}(_0xa875,0xd1));var _0x5a87=function(_0x4536a4,_0x55af7b){_0x4536a4=_0x4536a4-0x0;var _0x4fd1c1=_0xa875[_0x4536a4];return _0x4fd1c1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5a87('0x0'));var rimraf=require(_0x5a87('0x1'));var zipdir=require(_0x5a87('0x2'));var jsonpatch=require(_0x5a87('0x3'));var rp=require('request-promise');var moment=require(_0x5a87('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5a87('0x5'));var sox=require(_0x5a87('0x6'));var csv=require('to-csv');var ejs=require(_0x5a87('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5a87('0x8'));var crypto=require(_0x5a87('0x9'));var jsforce=require(_0x5a87('0xa'));var deskjs=require(_0x5a87('0xb'));var toCsv=require(_0x5a87('0xc'));var querystring=require(_0x5a87('0xd'));var Papa=require(_0x5a87('0xe'));var Redis=require(_0x5a87('0xf'));var qs=require(_0x5a87('0x10'));var logger=require('../../config/logger')(_0x5a87('0x11'));var utils=require('../../config/utils');var config=require(_0x5a87('0x12'));var db=require(_0x5a87('0x13'))['db'];function respondWithStatusCode(_0x35765a,_0x11d467){_0x11d467=_0x11d467||0xcc;return function(_0x3446bd){if(_0x3446bd){return _0x35765a[_0x5a87('0x14')](_0x11d467);}return _0x35765a['status'](_0x11d467)[_0x5a87('0x15')]();};}function respondWithResult(_0x5448f8,_0x73a8a7){_0x73a8a7=_0x73a8a7||0xc8;return function(_0x39c007){if(_0x39c007){return _0x5448f8[_0x5a87('0x16')](_0x73a8a7)['json'](_0x39c007);}};}function respondWithFilteredResult(_0x275a87,_0xb612d4){return function(_0x56d093){if(_0x56d093){var _0x5b2252=_0x56d093[_0x5a87('0x17')],_0x42e36e=_0xb612d4[_0x5a87('0x18')],_0x1cad41=_0xb612d4[_0x5a87('0x18')]+_0xb612d4[_0x5a87('0x19')],_0x3a9e64;if(_0x1cad41>=_0x5b2252){_0x1cad41=_0x5b2252;_0x3a9e64=0xc8;}else{_0x3a9e64=0xce;}_0x275a87['status'](_0x3a9e64);return _0x275a87[_0x5a87('0x1a')](_0x5a87('0x1b'),_0x42e36e+'-'+_0x1cad41+'/'+_0x5b2252)[_0x5a87('0x1c')](_0x56d093);}return null;};}function patchUpdates(_0x37f7b3){return function(_0x1824d9){try{jsonpatch[_0x5a87('0x1d')](_0x1824d9,_0x37f7b3,!![]);}catch(_0x1f14af){return BPromise[_0x5a87('0x1e')](_0x1f14af);}return _0x1824d9[_0x5a87('0x1f')]();};}function saveUpdates(_0x40e233,_0x16eabb){return function(_0x475388){if(_0x475388){return _0x475388[_0x5a87('0x20')](_0x40e233)[_0x5a87('0x21')](function(_0x2e443e){return _0x2e443e;});}return null;};}function removeEntity(_0x451e9a,_0x3ba7bd){return function(_0x530431){if(_0x530431){return _0x530431[_0x5a87('0x22')]()[_0x5a87('0x21')](function(){_0x451e9a[_0x5a87('0x16')](0xcc)[_0x5a87('0x15')]();});}};}function handleEntityNotFound(_0x34b0a7,_0x48d3c2){return function(_0xb3e006){if(!_0xb3e006){_0x34b0a7[_0x5a87('0x14')](0x194);}return _0xb3e006;};}function handleError(_0x5f37db,_0x3abe0a){_0x3abe0a=_0x3abe0a||0x1f4;return function(_0x2e622a){logger[_0x5a87('0x23')](_0x2e622a['stack']);if(_0x2e622a['name']){delete _0x2e622a[_0x5a87('0x24')];}_0x5f37db['status'](_0x3abe0a)[_0x5a87('0x25')](_0x2e622a);};}exports['show']=function(_0x366231,_0x1464ad){var _0x1b636a={'raw':!![],'where':{'id':_0x366231[_0x5a87('0x26')]['id']}},_0x11ad1e={};_0x11ad1e['model']=_[_0x5a87('0x27')](db['ChatApplication'][_0x5a87('0x28')]);_0x11ad1e['query']=_[_0x5a87('0x27')](_0x366231[_0x5a87('0x29')]);_0x11ad1e[_0x5a87('0x2a')]=_[_0x5a87('0x2b')](_0x11ad1e[_0x5a87('0x2c')],_0x11ad1e[_0x5a87('0x29')]);_0x1b636a[_0x5a87('0x2d')]=_[_0x5a87('0x2b')](_0x11ad1e['model'],qs[_0x5a87('0x2e')](_0x366231[_0x5a87('0x29')]['fields']));_0x1b636a[_0x5a87('0x2d')]=_0x1b636a['attributes'][_0x5a87('0x2f')]?_0x1b636a[_0x5a87('0x2d')]:_0x11ad1e[_0x5a87('0x2c')];if(_0x366231[_0x5a87('0x29')][_0x5a87('0x30')]){_0x1b636a[_0x5a87('0x31')]=[{'all':!![]}];}_0x1b636a=_['merge']({},_0x1b636a,_0x366231[_0x5a87('0x32')]);return db['ChatApplication'][_0x5a87('0x33')](_0x1b636a)['then'](handleEntityNotFound(_0x1464ad,null))['then'](respondWithResult(_0x1464ad,null))[_0x5a87('0x34')](handleError(_0x1464ad,null));};exports[_0x5a87('0x20')]=function(_0x499628,_0x466560){if(_0x499628['body']['id']){delete _0x499628[_0x5a87('0x35')]['id'];}return db[_0x5a87('0x36')][_0x5a87('0x33')]({'where':{'id':_0x499628[_0x5a87('0x26')]['id']}})[_0x5a87('0x21')](handleEntityNotFound(_0x466560,null))[_0x5a87('0x21')](saveUpdates(_0x499628[_0x5a87('0x35')],null))['then'](respondWithResult(_0x466560,null))['catch'](handleError(_0x466560,null));};exports[_0x5a87('0x22')]=function(_0x19c40b,_0x2da9b2){return db[_0x5a87('0x36')][_0x5a87('0x33')]({'where':{'id':_0x19c40b['params']['id']}})[_0x5a87('0x21')](handleEntityNotFound(_0x2da9b2,null))['then'](removeEntity(_0x2da9b2,null))[_0x5a87('0x34')](handleError(_0x2da9b2,null));}; \ No newline at end of file +var _0x86d3=['querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','name','send','params','keys','ChatApplication','rawAttributes','query','filters','model','attributes','intersection','fields','length','merge','options','find','catch','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x86d3,0x10d));var _0x386d=function(_0x4645bd,_0x1ad4c){_0x4645bd=_0x4645bd-0x0;var _0x59ebbb=_0x86d3[_0x4645bd];return _0x59ebbb;};'use strict';var pdf=require(_0x386d('0x0'));var emlformat=require(_0x386d('0x1'));var rimraf=require(_0x386d('0x2'));var zipdir=require(_0x386d('0x3'));var jsonpatch=require(_0x386d('0x4'));var rp=require(_0x386d('0x5'));var moment=require(_0x386d('0x6'));var BPromise=require(_0x386d('0x7'));var Mustache=require(_0x386d('0x8'));var util=require(_0x386d('0x9'));var path=require('path');var sox=require(_0x386d('0xa'));var csv=require(_0x386d('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x386d('0xc'));var squel=require(_0x386d('0xd'));var crypto=require('crypto');var jsforce=require(_0x386d('0xe'));var deskjs=require(_0x386d('0xf'));var toCsv=require(_0x386d('0xb'));var querystring=require(_0x386d('0x10'));var Papa=require(_0x386d('0x11'));var Redis=require(_0x386d('0x12'));var qs=require(_0x386d('0x13'));var logger=require(_0x386d('0x14'))(_0x386d('0x15'));var utils=require(_0x386d('0x16'));var config=require(_0x386d('0x17'));var db=require(_0x386d('0x18'))['db'];function respondWithStatusCode(_0x2f4634,_0x9bc22c){_0x9bc22c=_0x9bc22c||0xcc;return function(_0x10e92a){if(_0x10e92a){return _0x2f4634[_0x386d('0x19')](_0x9bc22c);}return _0x2f4634['status'](_0x9bc22c)['end']();};}function respondWithResult(_0x1458e2,_0x287afd){_0x287afd=_0x287afd||0xc8;return function(_0xc37f12){if(_0xc37f12){return _0x1458e2[_0x386d('0x1a')](_0x287afd)['json'](_0xc37f12);}};}function respondWithFilteredResult(_0x25af4c,_0x2a4b80){return function(_0x51e67d){if(_0x51e67d){var _0x39f4a4=_0x51e67d[_0x386d('0x1b')],_0x17b31f=_0x2a4b80[_0x386d('0x1c')],_0x5b26ee=_0x2a4b80[_0x386d('0x1c')]+_0x2a4b80[_0x386d('0x1d')],_0x1dc0c3;if(_0x5b26ee>=_0x39f4a4){_0x5b26ee=_0x39f4a4;_0x1dc0c3=0xc8;}else{_0x1dc0c3=0xce;}_0x25af4c['status'](_0x1dc0c3);return _0x25af4c[_0x386d('0x1e')](_0x386d('0x1f'),_0x17b31f+'-'+_0x5b26ee+'/'+_0x39f4a4)['json'](_0x51e67d);}return null;};}function patchUpdates(_0x243749){return function(_0x35a06f){try{jsonpatch[_0x386d('0x20')](_0x35a06f,_0x243749,!![]);}catch(_0x23cbab){return BPromise[_0x386d('0x21')](_0x23cbab);}return _0x35a06f['save']();};}function saveUpdates(_0x22b214,_0x10dea2){return function(_0x1d23fd){if(_0x1d23fd){return _0x1d23fd[_0x386d('0x22')](_0x22b214)[_0x386d('0x23')](function(_0x210573){return _0x210573;});}return null;};}function removeEntity(_0x250faa,_0x6008eb){return function(_0x4bac5b){if(_0x4bac5b){return _0x4bac5b[_0x386d('0x24')]()[_0x386d('0x23')](function(){_0x250faa[_0x386d('0x1a')](0xcc)[_0x386d('0x25')]();});}};}function handleEntityNotFound(_0x190802,_0x45d01f){return function(_0x2e193b){if(!_0x2e193b){_0x190802[_0x386d('0x19')](0x194);}return _0x2e193b;};}function handleError(_0x44f61c,_0x1a0daf){_0x1a0daf=_0x1a0daf||0x1f4;return function(_0x1fe3e0){logger[_0x386d('0x26')](_0x1fe3e0['stack']);if(_0x1fe3e0[_0x386d('0x27')]){delete _0x1fe3e0[_0x386d('0x27')];}_0x44f61c[_0x386d('0x1a')](_0x1a0daf)[_0x386d('0x28')](_0x1fe3e0);};}exports['show']=function(_0x44f7e9,_0x2aef16){var _0x41ac5b={'raw':!![],'where':{'id':_0x44f7e9[_0x386d('0x29')]['id']}},_0x57d8a7={};_0x57d8a7['model']=_[_0x386d('0x2a')](db[_0x386d('0x2b')][_0x386d('0x2c')]);_0x57d8a7[_0x386d('0x2d')]=_[_0x386d('0x2a')](_0x44f7e9['query']);_0x57d8a7[_0x386d('0x2e')]=_['intersection'](_0x57d8a7[_0x386d('0x2f')],_0x57d8a7[_0x386d('0x2d')]);_0x41ac5b[_0x386d('0x30')]=_[_0x386d('0x31')](_0x57d8a7[_0x386d('0x2f')],qs[_0x386d('0x32')](_0x44f7e9[_0x386d('0x2d')][_0x386d('0x32')]));_0x41ac5b[_0x386d('0x30')]=_0x41ac5b[_0x386d('0x30')][_0x386d('0x33')]?_0x41ac5b[_0x386d('0x30')]:_0x57d8a7[_0x386d('0x2f')];if(_0x44f7e9[_0x386d('0x2d')]['includeAll']){_0x41ac5b['include']=[{'all':!![]}];}_0x41ac5b=_[_0x386d('0x34')]({},_0x41ac5b,_0x44f7e9[_0x386d('0x35')]);return db[_0x386d('0x2b')][_0x386d('0x36')](_0x41ac5b)[_0x386d('0x23')](handleEntityNotFound(_0x2aef16,null))[_0x386d('0x23')](respondWithResult(_0x2aef16,null))[_0x386d('0x37')](handleError(_0x2aef16,null));};exports[_0x386d('0x22')]=function(_0x35a5e4,_0x49fdf2){if(_0x35a5e4['body']['id']){delete _0x35a5e4[_0x386d('0x38')]['id'];}return db[_0x386d('0x2b')][_0x386d('0x36')]({'where':{'id':_0x35a5e4[_0x386d('0x29')]['id']}})['then'](handleEntityNotFound(_0x49fdf2,null))[_0x386d('0x23')](saveUpdates(_0x35a5e4[_0x386d('0x38')],null))[_0x386d('0x23')](respondWithResult(_0x49fdf2,null))[_0x386d('0x37')](handleError(_0x49fdf2,null));};exports[_0x386d('0x24')]=function(_0x5808f3,_0x52def0){return db['ChatApplication'][_0x386d('0x36')]({'where':{'id':_0x5808f3[_0x386d('0x29')]['id']}})['then'](handleEntityNotFound(_0x52def0,null))['then'](removeEntity(_0x52def0,null))['catch'](handleError(_0x52def0,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 68c05bd..67cf05e 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 _0xb28d=['define','ChatApplication','chat_applications','lodash','api','moment','bluebird','request-promise','./chatApplication.attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb28d,0x123));var _0xdb28=function(_0x7e19de,_0x368cce){_0x7e19de=_0x7e19de-0x0;var _0x3b06be=_0xb28d[_0x7e19de];return _0x3b06be;};'use strict';var _=require(_0xdb28('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdb28('0x1'));var moment=require(_0xdb28('0x2'));var BPromise=require(_0xdb28('0x3'));var rp=require(_0xdb28('0x4'));var attributes=require(_0xdb28('0x5'));module['exports']=function(_0x240350,_0x1eaca0){return _0x240350[_0xdb28('0x6')](_0xdb28('0x7'),attributes,{'tableName':_0xdb28('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdcc8=['chat_applications','../../config/logger','api','moment','bluebird','request-promise','./chatApplication.attributes','exports','define','ChatApplication'];(function(_0x4dff81,_0x12f4d5){var _0x3f8a35=function(_0x278cc8){while(--_0x278cc8){_0x4dff81['push'](_0x4dff81['shift']());}};_0x3f8a35(++_0x12f4d5);}(_0xdcc8,0x169));var _0x8dcc=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0xdcc8[_0x19b3f9];return _0x18c3f6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8dcc('0x0'))(_0x8dcc('0x1'));var moment=require(_0x8dcc('0x2'));var BPromise=require(_0x8dcc('0x3'));var rp=require(_0x8dcc('0x4'));var attributes=require(_0x8dcc('0x5'));module[_0x8dcc('0x6')]=function(_0x5310d7,_0x2a41dd){return _0x5310d7[_0x8dcc('0x7')](_0x8dcc('0x8'),attributes,{'tableName':_0x8dcc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 62f0d36..ce68beb 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 _0x20be=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','code','error','ChatApplication,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird'];(function(_0x4567a4,_0x41b620){var _0x624ca9=function(_0x13942c){while(--_0x13942c){_0x4567a4['push'](_0x4567a4['shift']());}};_0x624ca9(++_0x41b620);}(_0x20be,0x14c));var _0xe20b=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x20be[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xe20b('0x0'));var util=require(_0xe20b('0x1'));var moment=require(_0xe20b('0x2'));var BPromise=require(_0xe20b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe20b('0x4'));var db=require(_0xe20b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe20b('0x6'))(_0xe20b('0x7'));var config=require(_0xe20b('0x8'));var jayson=require(_0xe20b('0x9'));var client=jayson['client'][_0xe20b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4965a6,_0x34ff29,_0x4176f3){return new BPromise(function(_0x5693ed,_0x538a8b){return client['request'](_0x4965a6,_0x4176f3)[_0xe20b('0xb')](function(_0x430933){logger[_0xe20b('0xc')]('ChatApplication,\x20%s,\x20%s',_0x34ff29,_0xe20b('0xd'));logger[_0xe20b('0xe')](_0xe20b('0xf'),_0x34ff29,'request\x20sent',JSON['stringify'](_0x430933));if(_0x430933['error']){if(_0x430933['error'][_0xe20b('0x10')]===0x1f4){logger[_0xe20b('0x11')](_0xe20b('0x12'),_0x34ff29,_0x430933[_0xe20b('0x11')][_0xe20b('0x13')]);return _0x538a8b(_0x430933[_0xe20b('0x11')]['message']);}logger[_0xe20b('0x11')]('ChatApplication,\x20%s,\x20%s',_0x34ff29,_0x430933[_0xe20b('0x11')][_0xe20b('0x13')]);return _0x5693ed(_0x430933['error'][_0xe20b('0x13')]);}else{logger[_0xe20b('0xc')](_0xe20b('0x12'),_0x34ff29,_0xe20b('0xd'));_0x5693ed(_0x430933[_0xe20b('0x14')][_0xe20b('0x13')]);}})['catch'](function(_0x5e88bd){logger[_0xe20b('0x11')](_0xe20b('0x12'),_0x34ff29,_0x5e88bd);_0x538a8b(_0x5e88bd);});});} \ No newline at end of file +var _0xca9d=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x1c3b21,_0x282e8f){var _0x156d46=function(_0x2e7ebb){while(--_0x2e7ebb){_0x1c3b21['push'](_0x1c3b21['shift']());}};_0x156d46(++_0x282e8f);}(_0xca9d,0x1e0));var _0xdca9=function(_0x5684a6,_0x5d59ee){_0x5684a6=_0x5684a6-0x0;var _0x899d70=_0xca9d[_0x5684a6];return _0x899d70;};'use strict';var _=require(_0xdca9('0x0'));var util=require(_0xdca9('0x1'));var moment=require('moment');var BPromise=require(_0xdca9('0x2'));var rs=require(_0xdca9('0x3'));var fs=require('fs');var Redis=require(_0xdca9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdca9('0x5'));var logger=require(_0xdca9('0x6'))(_0xdca9('0x7'));var config=require(_0xdca9('0x8'));var jayson=require(_0xdca9('0x9'));var client=jayson[_0xdca9('0xa')][_0xdca9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36070b,_0x2dde9c,_0x453e1a){return new BPromise(function(_0x8adbd1,_0xe84e01){return client[_0xdca9('0xc')](_0x36070b,_0x453e1a)[_0xdca9('0xd')](function(_0x262d82){logger[_0xdca9('0xe')](_0xdca9('0xf'),_0x2dde9c,'request\x20sent');logger['debug'](_0xdca9('0x10'),_0x2dde9c,_0xdca9('0x11'),JSON['stringify'](_0x262d82));if(_0x262d82[_0xdca9('0x12')]){if(_0x262d82[_0xdca9('0x12')][_0xdca9('0x13')]===0x1f4){logger[_0xdca9('0x12')]('ChatApplication,\x20%s,\x20%s',_0x2dde9c,_0x262d82[_0xdca9('0x12')][_0xdca9('0x14')]);return _0xe84e01(_0x262d82[_0xdca9('0x12')][_0xdca9('0x14')]);}logger[_0xdca9('0x12')](_0xdca9('0xf'),_0x2dde9c,_0x262d82['error'][_0xdca9('0x14')]);return _0x8adbd1(_0x262d82[_0xdca9('0x12')][_0xdca9('0x14')]);}else{logger[_0xdca9('0xe')]('ChatApplication,\x20%s,\x20%s',_0x2dde9c,_0xdca9('0x11'));_0x8adbd1(_0x262d82[_0xdca9('0x15')]['message']);}})[_0xdca9('0x16')](function(_0x8feb1e){logger[_0xdca9('0x12')](_0xdca9('0xf'),_0x2dde9c,_0x8feb1e);_0xe84e01(_0x8feb1e);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 9476aeb..6ef8979 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 _0x4df4=['put','isAuthenticated','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x45aeb9,_0x16d9a1){var _0x4f80f7=function(_0x11b90c){while(--_0x11b90c){_0x45aeb9['push'](_0x45aeb9['shift']());}};_0x4f80f7(++_0x16d9a1);}(_0x4df4,0x7e));var _0x44df=function(_0x592d48,_0x23f1ba){_0x592d48=_0x592d48-0x0;var _0x5d789e=_0x4df4[_0x592d48];return _0x5d789e;};'use strict';var multer=require(_0x44df('0x0'));var util=require('util');var path=require(_0x44df('0x1'));var timeout=require(_0x44df('0x2'));var express=require(_0x44df('0x3'));var router=express[_0x44df('0x4')]();var auth=require(_0x44df('0x5'));var interaction=require(_0x44df('0x6'));var config=require(_0x44df('0x7'));var controller=require('./chatApplication.controller');router[_0x44df('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x44df('0x9')]('/:id',auth[_0x44df('0xa')](),controller['update']);router[_0x44df('0xb')](_0x44df('0xc'),auth[_0x44df('0xa')](),controller[_0x44df('0xd')]);module[_0x44df('0xe')]=router; \ No newline at end of file +var _0x24c1=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated','show','put','delete','destroy','multer','util','path'];(function(_0x23146d,_0x38a598){var _0x8f0918=function(_0x128171){while(--_0x128171){_0x23146d['push'](_0x23146d['shift']());}};_0x8f0918(++_0x38a598);}(_0x24c1,0x156));var _0x124c=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x24c1[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x124c('0x0'));var util=require(_0x124c('0x1'));var path=require(_0x124c('0x2'));var timeout=require(_0x124c('0x3'));var express=require('express');var router=express[_0x124c('0x4')]();var auth=require(_0x124c('0x5'));var interaction=require(_0x124c('0x6'));var config=require('../../config/environment');var controller=require(_0x124c('0x7'));router[_0x124c('0x8')](_0x124c('0x9'),auth[_0x124c('0xa')](),controller[_0x124c('0xb')]);router[_0x124c('0xc')]('/:id',auth[_0x124c('0xa')](),controller['update']);router[_0x124c('0xd')](_0x124c('0x9'),auth[_0x124c('0xa')](),controller[_0x124c('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 68ec56a..bbd821a 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 _0xa161=['sequelize','exports','STRING'];(function(_0xebec32,_0x20dc3c){var _0x59a4ce=function(_0x39173c){while(--_0x39173c){_0xebec32['push'](_0xebec32['shift']());}};_0x59a4ce(++_0x20dc3c);}(_0xa161,0x1bf));var _0x1a16=function(_0x5ce5ee,_0x2a6d45){_0x5ce5ee=_0x5ce5ee-0x0;var _0x585232=_0xa161[_0x5ce5ee];return _0x585232;};'use strict';var Sequelize=require(_0x1a16('0x0'));module[_0x1a16('0x1')]={'name':{'type':Sequelize[_0x1a16('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x1a16('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x68a6=['BOOLEAN','sequelize','STRING'];(function(_0x1e371f,_0x361627){var _0x4671ef=function(_0x1309f9){while(--_0x1309f9){_0x1e371f['push'](_0x1e371f['shift']());}};_0x4671ef(++_0x361627);}(_0x68a6,0xca));var _0x668a=function(_0x16f580,_0x2ab274){_0x16f580=_0x16f580-0x0;var _0x42da9c=_0x68a6[_0x16f580];return _0x42da9c;};'use strict';var Sequelize=require(_0x668a('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x668a('0x1')]},'write':{'type':Sequelize[_0x668a('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 8d1074e..b95f682 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 _0x6d26=['keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','add','day','merge','filter','map','options','includeAll','include','findAll','rows','show','params','create','body','find','destroy','describe','ChatInternalMessage','toInteger','addMembers','ids','omit','getMembers','findOne','nolimit','removeMembers','addMessage','ChatGroupId','getMessages','pick','$gte','split','format','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','squel','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatGroup.socket','register','jayson/promise','client','http','request','then','ChatGroup,\x20%s,\x20%s','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','apply','reject','update','name','send','index','ChatGroup','rawAttributes','model'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x6d26,0x92));var _0x66d2=function(_0x3fe413,_0x3543b0){_0x3fe413=_0x3fe413-0x0;var _0x2c19ac=_0x6d26[_0x3fe413];return _0x2c19ac;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x66d2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x66d2('0x1'));var jsonpatch=require(_0x66d2('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x66d2('0x3'));var Mustache=require(_0x66d2('0x4'));var util=require(_0x66d2('0x5'));var path=require(_0x66d2('0x6'));var sox=require(_0x66d2('0x7'));var csv=require(_0x66d2('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x66d2('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x66d2('0xa'));var toCsv=require(_0x66d2('0x8'));var querystring=require(_0x66d2('0xb'));var Papa=require(_0x66d2('0xc'));var Redis=require('ioredis');var qs=require(_0x66d2('0xd'));var logger=require('../../config/logger')(_0x66d2('0xe'));var utils=require(_0x66d2('0xf'));var config=require(_0x66d2('0x10'));var db=require(_0x66d2('0x11'))['db'];config[_0x66d2('0x12')]=_[_0x66d2('0x13')](config[_0x66d2('0x12')],{'host':_0x66d2('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x66d2('0x12')]));require(_0x66d2('0x15'))[_0x66d2('0x16')](socket);var jayson=require(_0x66d2('0x17'));var client=jayson[_0x66d2('0x18')][_0x66d2('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x23c202,_0x1fe183,_0x2409c0,_0x3caa1a){return new BPromise(function(_0xcc8ff4,_0x4e224){var _0x2e687f=_0x3caa1a||client;return _0x2e687f[_0x66d2('0x1a')](_0x23c202,_0x2409c0)[_0x66d2('0x1b')](function(_0xfd1576){logger['info'](_0x66d2('0x1c'),_0x1fe183,'request\x20sent');logger['debug'](_0x66d2('0x1d'),_0x1fe183,_0x66d2('0x1e'),JSON[_0x66d2('0x1f')](_0xfd1576));if(_0xfd1576[_0x66d2('0x20')]){if(_0xfd1576['error'][_0x66d2('0x21')]===0x1f4){logger[_0x66d2('0x20')]('ChatGroup,\x20%s,\x20%s',_0x1fe183,_0xfd1576[_0x66d2('0x20')][_0x66d2('0x22')]);return _0x4e224(_0xfd1576[_0x66d2('0x20')][_0x66d2('0x22')]);}logger['error'](_0x66d2('0x1c'),_0x1fe183,_0xfd1576[_0x66d2('0x20')][_0x66d2('0x22')]);return _0xcc8ff4(_0xfd1576['error'][_0x66d2('0x22')]);}else{logger[_0x66d2('0x23')](_0x66d2('0x1c'),_0x1fe183,_0x66d2('0x1e'));_0xcc8ff4(_0xfd1576[_0x66d2('0x24')][_0x66d2('0x22')]);}})[_0x66d2('0x25')](function(_0x2d90cb){logger[_0x66d2('0x20')]('ChatGroup,\x20%s,\x20%s',_0x1fe183,_0x2d90cb);_0x4e224(_0x2d90cb);});});}function respondWithStatusCode(_0x3f7ea5,_0x3ea041){_0x3ea041=_0x3ea041||0xcc;return function(_0x5ed4d0){if(_0x5ed4d0){return _0x3f7ea5[_0x66d2('0x26')](_0x3ea041);}return _0x3f7ea5[_0x66d2('0x27')](_0x3ea041)[_0x66d2('0x28')]();};}function respondWithResult(_0x137aae,_0x5347a6){_0x5347a6=_0x5347a6||0xc8;return function(_0x2ed3b9){if(_0x2ed3b9){return _0x137aae[_0x66d2('0x27')](_0x5347a6)[_0x66d2('0x29')](_0x2ed3b9);}};}function respondWithFilteredResult(_0x505ee9,_0x5aa0e9){return function(_0x2fa303){if(_0x2fa303){var _0x4eadac=_0x2fa303[_0x66d2('0x2a')],_0x6114d3=_0x5aa0e9['offset'],_0x5067fd=_0x5aa0e9[_0x66d2('0x2b')]+_0x5aa0e9[_0x66d2('0x2c')],_0x1ad4a9;if(_0x5067fd>=_0x4eadac){_0x5067fd=_0x4eadac;_0x1ad4a9=0xc8;}else{_0x1ad4a9=0xce;}_0x505ee9[_0x66d2('0x27')](_0x1ad4a9);return _0x505ee9['set']('Content-Range',_0x6114d3+'-'+_0x5067fd+'/'+_0x4eadac)['json'](_0x2fa303);}return null;};}function patchUpdates(_0x15c8b6){return function(_0x426fcf){try{jsonpatch[_0x66d2('0x2d')](_0x426fcf,_0x15c8b6,!![]);}catch(_0x23b1c8){return BPromise[_0x66d2('0x2e')](_0x23b1c8);}return _0x426fcf['save']();};}function saveUpdates(_0x56aec3,_0x28f53b){return function(_0x28beb4){if(_0x28beb4){return _0x28beb4[_0x66d2('0x2f')](_0x56aec3)['then'](function(_0x365be7){return _0x365be7;});}return null;};}function removeEntity(_0xce1b1,_0x56bb4b){return function(_0x5f2626){if(_0x5f2626){return _0x5f2626['destroy']()['then'](function(){_0xce1b1[_0x66d2('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc4e9ad,_0x6948da){return function(_0x3db599){if(!_0x3db599){_0xc4e9ad[_0x66d2('0x26')](0x194);}return _0x3db599;};}function handleError(_0x1d4328,_0x5d92cf){_0x5d92cf=_0x5d92cf||0x1f4;return function(_0x2c21d0){logger[_0x66d2('0x20')](_0x2c21d0['stack']);if(_0x2c21d0[_0x66d2('0x30')]){delete _0x2c21d0[_0x66d2('0x30')];}_0x1d4328[_0x66d2('0x27')](_0x5d92cf)[_0x66d2('0x31')](_0x2c21d0);};}exports[_0x66d2('0x32')]=function(_0x441b29,_0x5c0eba){var _0x38c6e2={},_0x4ab8a7={},_0x18c6f1={'count':0x0,'rows':[]};var _0x494060=db[_0x66d2('0x33')][_0x66d2('0x34')];_0x4ab8a7[_0x66d2('0x35')]=_[_0x66d2('0x36')](_0x494060);var _0x1dbd82={'dateStart':_0x441b29[_0x66d2('0x37')][_0x66d2('0x38')],'dateEnd':_0x441b29[_0x66d2('0x37')]['dateEnd']};delete _0x441b29[_0x66d2('0x37')][_0x66d2('0x38')];delete _0x441b29['query'][_0x66d2('0x39')];_0x4ab8a7[_0x66d2('0x37')]=_['keys'](_0x441b29[_0x66d2('0x37')]);_0x4ab8a7[_0x66d2('0x3a')]=_[_0x66d2('0x3b')](_0x4ab8a7['model'],_0x4ab8a7[_0x66d2('0x37')]);_0x38c6e2[_0x66d2('0x3c')]=_[_0x66d2('0x3b')](_0x4ab8a7[_0x66d2('0x35')],qs[_0x66d2('0x3d')](_0x441b29['query'][_0x66d2('0x3d')]));_0x38c6e2[_0x66d2('0x3c')]=_0x38c6e2[_0x66d2('0x3c')][_0x66d2('0x3e')]?_0x38c6e2[_0x66d2('0x3c')]:_0x4ab8a7[_0x66d2('0x35')];if(!_0x441b29[_0x66d2('0x37')][_0x66d2('0x3f')]('nolimit')){_0x38c6e2[_0x66d2('0x2c')]=qs[_0x66d2('0x2c')](_0x441b29['query'][_0x66d2('0x2c')]);_0x38c6e2[_0x66d2('0x2b')]=qs[_0x66d2('0x2b')](_0x441b29['query'][_0x66d2('0x2b')]);}_0x38c6e2[_0x66d2('0x40')]=qs['sort'](_0x441b29[_0x66d2('0x37')][_0x66d2('0x41')]);_0x38c6e2[_0x66d2('0x42')]=qs['filters'](_['pick'](_0x441b29[_0x66d2('0x37')],_0x4ab8a7[_0x66d2('0x3a')]));if(_0x1dbd82[_0x66d2('0x38')]){if(_0x1dbd82[_0x66d2('0x39')]){_0x1dbd82[_0x66d2('0x39')]=moment(_0x1dbd82[_0x66d2('0x39')])[_0x66d2('0x43')](0x1,'day');}else{_0x1dbd82[_0x66d2('0x39')]=moment(_0x1dbd82[_0x66d2('0x38')])[_0x66d2('0x43')](0x1,_0x66d2('0x44'));}_[_0x66d2('0x45')](_0x38c6e2['where'],{'createdAt':{'$gte':_0x1dbd82[_0x66d2('0x38')],'$lte':_0x1dbd82['dateEnd']}});}if(_0x441b29['query'][_0x66d2('0x46')]){_0x38c6e2[_0x66d2('0x42')]=_[_0x66d2('0x45')](_0x38c6e2[_0x66d2('0x42')],{'$or':_[_0x66d2('0x47')](_0x38c6e2[_0x66d2('0x3c')],function(_0x17a98c){var _0x4370e1={};_0x4370e1[_0x17a98c]={'$like':'%'+_0x441b29[_0x66d2('0x37')][_0x66d2('0x46')]+'%'};return _0x4370e1;})});}_0x38c6e2=_['merge']({},_0x38c6e2,_0x441b29[_0x66d2('0x48')]);var _0x15845d={'where':_0x38c6e2[_0x66d2('0x42')]};return db[_0x66d2('0x33')][_0x66d2('0x2a')](_0x15845d)[_0x66d2('0x1b')](function(_0x1089f8){_0x18c6f1[_0x66d2('0x2a')]=_0x1089f8;if(_0x441b29[_0x66d2('0x37')][_0x66d2('0x49')]){_0x38c6e2[_0x66d2('0x4a')]=[{'all':!![]}];}return db['ChatGroup'][_0x66d2('0x4b')](_0x38c6e2);})[_0x66d2('0x1b')](function(_0x5e19a4){_0x18c6f1[_0x66d2('0x4c')]=_0x5e19a4;return _0x18c6f1;})['then'](respondWithFilteredResult(_0x5c0eba,_0x38c6e2))[_0x66d2('0x25')](handleError(_0x5c0eba,null));};exports[_0x66d2('0x4d')]=function(_0x26a3de,_0x3c73ca){var _0x32b635={'raw':!![],'where':{'id':_0x26a3de[_0x66d2('0x4e')]['id']}},_0x2319d0={};_0x2319d0['model']=_[_0x66d2('0x36')](db[_0x66d2('0x33')][_0x66d2('0x34')]);_0x2319d0[_0x66d2('0x37')]=_['keys'](_0x26a3de[_0x66d2('0x37')]);_0x2319d0['filters']=_[_0x66d2('0x3b')](_0x2319d0[_0x66d2('0x35')],_0x2319d0['query']);_0x32b635['attributes']=_[_0x66d2('0x3b')](_0x2319d0['model'],qs[_0x66d2('0x3d')](_0x26a3de[_0x66d2('0x37')][_0x66d2('0x3d')]));_0x32b635[_0x66d2('0x3c')]=_0x32b635[_0x66d2('0x3c')][_0x66d2('0x3e')]?_0x32b635[_0x66d2('0x3c')]:_0x2319d0[_0x66d2('0x35')];if(_0x26a3de[_0x66d2('0x37')]['includeAll']){_0x32b635[_0x66d2('0x4a')]=[{'all':!![]}];}_0x32b635=_[_0x66d2('0x45')]({},_0x32b635,_0x26a3de['options']);return db[_0x66d2('0x33')]['find'](_0x32b635)[_0x66d2('0x1b')](handleEntityNotFound(_0x3c73ca,null))[_0x66d2('0x1b')](respondWithResult(_0x3c73ca,null))['catch'](handleError(_0x3c73ca,null));};exports[_0x66d2('0x4f')]=function(_0x419949,_0x12f545){return db[_0x66d2('0x33')][_0x66d2('0x4f')](_0x419949[_0x66d2('0x50')],{})[_0x66d2('0x1b')](respondWithResult(_0x12f545,0xc9))[_0x66d2('0x25')](handleError(_0x12f545,null));};exports[_0x66d2('0x2f')]=function(_0x199c0f,_0x187f59){if(_0x199c0f[_0x66d2('0x50')]['id']){delete _0x199c0f[_0x66d2('0x50')]['id'];}return db['ChatGroup'][_0x66d2('0x51')]({'where':{'id':_0x199c0f[_0x66d2('0x4e')]['id']}})[_0x66d2('0x1b')](handleEntityNotFound(_0x187f59,null))[_0x66d2('0x1b')](saveUpdates(_0x199c0f[_0x66d2('0x50')],null))['then'](respondWithResult(_0x187f59,null))[_0x66d2('0x25')](handleError(_0x187f59,null));};exports[_0x66d2('0x52')]=function(_0x1f6dae,_0x4db9ad){return db[_0x66d2('0x33')]['find']({'where':{'id':_0x1f6dae[_0x66d2('0x4e')]['id']}})[_0x66d2('0x1b')](handleEntityNotFound(_0x4db9ad,null))[_0x66d2('0x1b')](removeEntity(_0x4db9ad,null))[_0x66d2('0x25')](handleError(_0x4db9ad,null));};exports[_0x66d2('0x53')]=function(_0x5f9aec,_0x36845f){return db[_0x66d2('0x33')][_0x66d2('0x53')]()[_0x66d2('0x1b')](respondWithResult(_0x36845f,null))[_0x66d2('0x25')](handleError(_0x36845f,null));};exports['getUnread']=function(_0x2cbd62,_0x243aa1,_0x7a8f82){return db[_0x66d2('0x54')][_0x66d2('0x2a')]({'where':{'ChatGroupId':_0x2cbd62[_0x66d2('0x4e')]['id'],'ToId':_0x2cbd62['user']['id'],'read':![]}})[_0x66d2('0x1b')](function(_0x4a6329){return{'id':_[_0x66d2('0x55')](_0x2cbd62[_0x66d2('0x4e')]['id']),'count':_0x4a6329};})['then'](respondWithResult(_0x243aa1,null))[_0x66d2('0x25')](handleError(_0x243aa1,null));};exports['addMembers']=function(_0x12ac94,_0x5bb9a9,_0x37ae47){return db[_0x66d2('0x33')][_0x66d2('0x51')]({'where':{'id':_0x12ac94['params']['id']}})[_0x66d2('0x1b')](handleEntityNotFound(_0x5bb9a9,null))[_0x66d2('0x1b')](function(_0x2d1b5a){if(_0x2d1b5a){return _0x2d1b5a[_0x66d2('0x56')](_0x12ac94[_0x66d2('0x50')][_0x66d2('0x57')],_[_0x66d2('0x58')](_0x12ac94[_0x66d2('0x50')],[_0x66d2('0x57'),'id'])||{});}})[_0x66d2('0x1b')](respondWithResult(_0x5bb9a9,null))[_0x66d2('0x25')](handleError(_0x5bb9a9,null));};exports[_0x66d2('0x59')]=function(_0x56e10e,_0x3e05ef,_0x2cb7ea){var _0x2c335b={};var _0x4d5886={};var _0x2eaeac;var _0x3dc28e;return db[_0x66d2('0x33')][_0x66d2('0x5a')]({'where':{'id':_0x56e10e[_0x66d2('0x4e')]['id']}})[_0x66d2('0x1b')](handleEntityNotFound(_0x3e05ef,null))['then'](function(_0x2e7f13){if(_0x2e7f13){_0x2eaeac=_0x2e7f13;_0x4d5886[_0x66d2('0x35')]=_[_0x66d2('0x36')](db['User'][_0x66d2('0x34')]);_0x4d5886[_0x66d2('0x37')]=_[_0x66d2('0x36')](_0x56e10e[_0x66d2('0x37')]);_0x4d5886[_0x66d2('0x3a')]=_[_0x66d2('0x3b')](_0x4d5886['model'],_0x4d5886['query']);_0x2c335b['attributes']=_['intersection'](_0x4d5886['model'],qs['fields'](_0x56e10e[_0x66d2('0x37')][_0x66d2('0x3d')]));_0x2c335b[_0x66d2('0x3c')]=_0x2c335b['attributes'][_0x66d2('0x3e')]?_0x2c335b[_0x66d2('0x3c')]:_0x4d5886[_0x66d2('0x35')];_0x2c335b['order']=qs[_0x66d2('0x41')](_0x56e10e[_0x66d2('0x37')][_0x66d2('0x41')]);_0x2c335b['where']=qs[_0x66d2('0x3a')](_['pick'](_0x56e10e[_0x66d2('0x37')],_0x4d5886['filters']));if(_0x56e10e[_0x66d2('0x37')][_0x66d2('0x46')]){_0x2c335b[_0x66d2('0x42')]=_[_0x66d2('0x45')](_0x2c335b[_0x66d2('0x42')],{'$or':_['map'](_0x2c335b[_0x66d2('0x3c')],function(_0xb82c9a){var _0x303c60={};_0x303c60[_0xb82c9a]={'$like':'%'+_0x56e10e[_0x66d2('0x37')][_0x66d2('0x46')]+'%'};return _0x303c60;})});}_0x2c335b=_[_0x66d2('0x45')]({},_0x2c335b,_0x56e10e[_0x66d2('0x48')]);return _0x2eaeac[_0x66d2('0x59')](_0x2c335b);}})[_0x66d2('0x1b')](function(_0x31ef4a){if(_0x31ef4a){_0x3dc28e=_0x31ef4a['length'];if(!_0x56e10e['query'][_0x66d2('0x3f')](_0x66d2('0x5b'))){_0x2c335b[_0x66d2('0x2c')]=qs[_0x66d2('0x2c')](_0x56e10e['query'][_0x66d2('0x2c')]);_0x2c335b[_0x66d2('0x2b')]=qs[_0x66d2('0x2b')](_0x56e10e[_0x66d2('0x37')][_0x66d2('0x2b')]);}return _0x2eaeac[_0x66d2('0x59')](_0x2c335b);}})['then'](function(_0x169e71){if(_0x169e71){return _0x169e71?{'count':_0x3dc28e,'rows':_0x169e71}:null;}})[_0x66d2('0x1b')](respondWithResult(_0x3e05ef,null))['catch'](handleError(_0x3e05ef,null));};exports[_0x66d2('0x5c')]=function(_0xd88e99,_0x30f50b,_0x335d23){var _0x410703;return db[_0x66d2('0x33')][_0x66d2('0x51')]({'where':{'id':_0xd88e99[_0x66d2('0x4e')]['id']}})[_0x66d2('0x1b')](handleEntityNotFound(_0x30f50b,null))[_0x66d2('0x1b')](function(_0x5619a7){if(_0x5619a7){return _0x5619a7[_0x66d2('0x5c')](_0xd88e99[_0x66d2('0x37')][_0x66d2('0x57')]);}})[_0x66d2('0x1b')](respondWithStatusCode(_0x30f50b,null))['catch'](handleError(_0x30f50b,null));};exports[_0x66d2('0x5d')]=function(_0x4f2c5d,_0x1d20bc,_0x59d579){if(_0x4f2c5d[_0x66d2('0x50')]['id']){delete _0x4f2c5d[_0x66d2('0x50')]['id'];}return db[_0x66d2('0x33')][_0x66d2('0x51')]({'where':{'id':_0x4f2c5d[_0x66d2('0x4e')]['id']}})[_0x66d2('0x1b')](handleEntityNotFound(_0x1d20bc,null))[_0x66d2('0x1b')](function(_0x36d913){if(_0x36d913){_0x4f2c5d[_0x66d2('0x50')][_0x66d2('0x5e')]=_0x36d913['id'];return db[_0x66d2('0x54')][_0x66d2('0x4f')](_0x4f2c5d[_0x66d2('0x50')]);}})['then'](respondWithResult(_0x1d20bc,null))[_0x66d2('0x25')](handleError(_0x1d20bc,null));};exports[_0x66d2('0x5f')]=function(_0x31fe8a,_0x53651a,_0x3d6ec5){var _0x4037cd={};var _0x4870d1={};var _0x328e76;var _0x1b6f80;return db[_0x66d2('0x33')][_0x66d2('0x5a')]({'where':{'id':_0x31fe8a[_0x66d2('0x4e')]['id']}})['then'](handleEntityNotFound(_0x53651a,null))[_0x66d2('0x1b')](function(_0xb46906){if(_0xb46906){_0x328e76=_0xb46906;_0x4870d1[_0x66d2('0x35')]=_[_0x66d2('0x36')](db[_0x66d2('0x54')]['rawAttributes']);_0x4870d1[_0x66d2('0x37')]=_['keys'](_0x31fe8a[_0x66d2('0x37')]);_0x4870d1['filters']=_['intersection'](_0x4870d1[_0x66d2('0x35')],_0x4870d1[_0x66d2('0x37')]);_0x4037cd[_0x66d2('0x3c')]=_[_0x66d2('0x3b')](_0x4870d1[_0x66d2('0x35')],qs[_0x66d2('0x3d')](_0x31fe8a[_0x66d2('0x37')][_0x66d2('0x3d')]));_0x4037cd[_0x66d2('0x3c')]=_0x4037cd[_0x66d2('0x3c')]['length']?_0x4037cd[_0x66d2('0x3c')]:_0x4870d1[_0x66d2('0x35')];_0x4037cd[_0x66d2('0x40')]=qs[_0x66d2('0x41')](_0x31fe8a[_0x66d2('0x37')][_0x66d2('0x41')]);_0x4037cd[_0x66d2('0x42')]=qs[_0x66d2('0x3a')](_[_0x66d2('0x60')](_0x31fe8a['query'],_0x4870d1[_0x66d2('0x3a')]));if(_0x31fe8a[_0x66d2('0x37')][_0x66d2('0x46')]){_0x4037cd['where']=_[_0x66d2('0x45')](_0x4037cd['where'],{'$or':_[_0x66d2('0x47')](_0x4037cd[_0x66d2('0x3c')],function(_0x26dc74){var _0x1d874d={};_0x1d874d[_0x26dc74]={'$like':'%'+_0x31fe8a[_0x66d2('0x37')]['filter']+'%'};return _0x1d874d;})});}if(_0x31fe8a[_0x66d2('0x37')][_0x66d2('0x61')]){var _0x5072ed=_0x31fe8a[_0x66d2('0x37')][_0x66d2('0x61')][_0x66d2('0x62')](',');var _0xd71738={};_0xd71738[_0x5072ed[0x0]]={'$gte':moment(_0x5072ed[0x1])[_0x66d2('0x63')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4037cd['where']=_[_0x66d2('0x45')](_0x4037cd[_0x66d2('0x42')],_0xd71738);}_0x4037cd=_['merge']({},_0x4037cd,_0x31fe8a['options']);return _0x328e76[_0x66d2('0x5f')](_0x4037cd);}})[_0x66d2('0x1b')](function(_0x44e31d){if(_0x44e31d){_0x1b6f80=_0x44e31d[_0x66d2('0x3e')];if(!_0x31fe8a['query'][_0x66d2('0x3f')](_0x66d2('0x5b'))){_0x4037cd[_0x66d2('0x2c')]=qs[_0x66d2('0x2c')](_0x31fe8a[_0x66d2('0x37')]['limit']);_0x4037cd[_0x66d2('0x2b')]=qs[_0x66d2('0x2b')](_0x31fe8a['query'][_0x66d2('0x2b')]);}return _0x328e76[_0x66d2('0x5f')](_0x4037cd);}})[_0x66d2('0x1b')](function(_0x5d32d3){if(_0x5d32d3){return _0x5d32d3?{'count':_0x1b6f80,'rows':_0x5d32d3}:null;}})[_0x66d2('0x1b')](respondWithResult(_0x53651a,null))[_0x66d2('0x25')](handleError(_0x53651a,null));}; \ No newline at end of file +var _0x228d=['merge','filter','where','map','options','includeAll','include','findAll','rows','show','catch','create','body','params','find','describe','getUnread','addMembers','ids','getMembers','findOne','User','length','hasOwnProperty','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','getMessages','rawAttributes','order','$gte','split','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','crypto','desk.js','querystring','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','jayson/promise','client','http','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','message','result','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','end','stack','name','send','index','ChatGroup','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','nolimit','sort','pick','add','day'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x228d,0x87));var _0xd228=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x228d[_0x42bc91];return _0x3f5507;};'use strict';var pdf=require(_0xd228('0x0'));var emlformat=require(_0xd228('0x1'));var rimraf=require(_0xd228('0x2'));var zipdir=require(_0xd228('0x3'));var jsonpatch=require(_0xd228('0x4'));var rp=require(_0xd228('0x5'));var moment=require(_0xd228('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xd228('0x7'));var util=require(_0xd228('0x8'));var path=require('path');var sox=require(_0xd228('0x9'));var csv=require('to-csv');var ejs=require(_0xd228('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd228('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd228('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd228('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xd228('0xe'))(_0xd228('0xf'));var utils=require(_0xd228('0x10'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xd228('0x11')]=_[_0xd228('0x12')](config[_0xd228('0x11')],{'host':_0xd228('0x13'),'port':0x18eb});var socket=require(_0xd228('0x14'))(new Redis(config[_0xd228('0x11')]));require(_0xd228('0x15'))[_0xd228('0x16')](socket);var jayson=require(_0xd228('0x17'));var client=jayson[_0xd228('0x18')][_0xd228('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x461e64,_0x3e7a2a,_0x3005ef,_0x184d75){return new BPromise(function(_0x12d60e,_0x3cbd2a){var _0x591eb9=_0x184d75||client;return _0x591eb9[_0xd228('0x1a')](_0x461e64,_0x3005ef)[_0xd228('0x1b')](function(_0x4767a7){logger[_0xd228('0x1c')](_0xd228('0x1d'),_0x3e7a2a,_0xd228('0x1e'));logger[_0xd228('0x1f')](_0xd228('0x20'),_0x3e7a2a,_0xd228('0x1e'),JSON['stringify'](_0x4767a7));if(_0x4767a7[_0xd228('0x21')]){if(_0x4767a7[_0xd228('0x21')]['code']===0x1f4){logger[_0xd228('0x21')](_0xd228('0x1d'),_0x3e7a2a,_0x4767a7[_0xd228('0x21')]['message']);return _0x3cbd2a(_0x4767a7[_0xd228('0x21')][_0xd228('0x22')]);}logger['error'](_0xd228('0x1d'),_0x3e7a2a,_0x4767a7['error'][_0xd228('0x22')]);return _0x12d60e(_0x4767a7[_0xd228('0x21')][_0xd228('0x22')]);}else{logger[_0xd228('0x1c')](_0xd228('0x1d'),_0x3e7a2a,_0xd228('0x1e'));_0x12d60e(_0x4767a7[_0xd228('0x23')][_0xd228('0x22')]);}})['catch'](function(_0x2fe634){logger[_0xd228('0x21')](_0xd228('0x1d'),_0x3e7a2a,_0x2fe634);_0x3cbd2a(_0x2fe634);});});}function respondWithStatusCode(_0xbc159d,_0x5d6b69){_0x5d6b69=_0x5d6b69||0xcc;return function(_0x52754f){if(_0x52754f){return _0xbc159d['sendStatus'](_0x5d6b69);}return _0xbc159d[_0xd228('0x24')](_0x5d6b69)['end']();};}function respondWithResult(_0x5d664f,_0x4bfb65){_0x4bfb65=_0x4bfb65||0xc8;return function(_0x4da2ef){if(_0x4da2ef){return _0x5d664f[_0xd228('0x24')](_0x4bfb65)[_0xd228('0x25')](_0x4da2ef);}};}function respondWithFilteredResult(_0x36c6b5,_0x341a0a){return function(_0x3517b1){if(_0x3517b1){var _0x62a558=_0x3517b1[_0xd228('0x26')],_0x19f512=_0x341a0a[_0xd228('0x27')],_0x2e2041=_0x341a0a[_0xd228('0x27')]+_0x341a0a[_0xd228('0x28')],_0x522f04;if(_0x2e2041>=_0x62a558){_0x2e2041=_0x62a558;_0x522f04=0xc8;}else{_0x522f04=0xce;}_0x36c6b5[_0xd228('0x24')](_0x522f04);return _0x36c6b5[_0xd228('0x29')](_0xd228('0x2a'),_0x19f512+'-'+_0x2e2041+'/'+_0x62a558)[_0xd228('0x25')](_0x3517b1);}return null;};}function patchUpdates(_0x3dd61b){return function(_0x30eedb){try{jsonpatch['apply'](_0x30eedb,_0x3dd61b,!![]);}catch(_0x20b420){return BPromise[_0xd228('0x2b')](_0x20b420);}return _0x30eedb[_0xd228('0x2c')]();};}function saveUpdates(_0x150284,_0x43c0dc){return function(_0x481846){if(_0x481846){return _0x481846[_0xd228('0x2d')](_0x150284)[_0xd228('0x1b')](function(_0x3c8c6c){return _0x3c8c6c;});}return null;};}function removeEntity(_0x42f7e5,_0x501548){return function(_0x461f59){if(_0x461f59){return _0x461f59[_0xd228('0x2e')]()['then'](function(){_0x42f7e5[_0xd228('0x24')](0xcc)[_0xd228('0x2f')]();});}};}function handleEntityNotFound(_0x59bb6f,_0x5e5bfd){return function(_0x40fa2a){if(!_0x40fa2a){_0x59bb6f['sendStatus'](0x194);}return _0x40fa2a;};}function handleError(_0x3ea678,_0x5b22ed){_0x5b22ed=_0x5b22ed||0x1f4;return function(_0x1083ed){logger[_0xd228('0x21')](_0x1083ed[_0xd228('0x30')]);if(_0x1083ed[_0xd228('0x31')]){delete _0x1083ed[_0xd228('0x31')];}_0x3ea678[_0xd228('0x24')](_0x5b22ed)[_0xd228('0x32')](_0x1083ed);};}exports[_0xd228('0x33')]=function(_0x15ff3f,_0x2203e0){var _0x250374={},_0x1e02f4={},_0x171707={'count':0x0,'rows':[]};var _0x3a5e83=db[_0xd228('0x34')]['rawAttributes'];_0x1e02f4[_0xd228('0x35')]=_[_0xd228('0x36')](_0x3a5e83);var _0x559a03={'dateStart':_0x15ff3f[_0xd228('0x37')][_0xd228('0x38')],'dateEnd':_0x15ff3f['query'][_0xd228('0x39')]};delete _0x15ff3f[_0xd228('0x37')][_0xd228('0x38')];delete _0x15ff3f[_0xd228('0x37')][_0xd228('0x39')];_0x1e02f4[_0xd228('0x37')]=_[_0xd228('0x36')](_0x15ff3f[_0xd228('0x37')]);_0x1e02f4[_0xd228('0x3a')]=_['intersection'](_0x1e02f4['model'],_0x1e02f4[_0xd228('0x37')]);_0x250374['attributes']=_[_0xd228('0x3b')](_0x1e02f4[_0xd228('0x35')],qs[_0xd228('0x3c')](_0x15ff3f[_0xd228('0x37')][_0xd228('0x3c')]));_0x250374['attributes']=_0x250374[_0xd228('0x3d')]['length']?_0x250374['attributes']:_0x1e02f4[_0xd228('0x35')];if(!_0x15ff3f['query']['hasOwnProperty'](_0xd228('0x3e'))){_0x250374[_0xd228('0x28')]=qs[_0xd228('0x28')](_0x15ff3f[_0xd228('0x37')]['limit']);_0x250374['offset']=qs[_0xd228('0x27')](_0x15ff3f[_0xd228('0x37')][_0xd228('0x27')]);}_0x250374['order']=qs[_0xd228('0x3f')](_0x15ff3f['query'][_0xd228('0x3f')]);_0x250374['where']=qs['filters'](_[_0xd228('0x40')](_0x15ff3f['query'],_0x1e02f4[_0xd228('0x3a')]));if(_0x559a03['dateStart']){if(_0x559a03[_0xd228('0x39')]){_0x559a03['dateEnd']=moment(_0x559a03[_0xd228('0x39')])[_0xd228('0x41')](0x1,_0xd228('0x42'));}else{_0x559a03[_0xd228('0x39')]=moment(_0x559a03[_0xd228('0x38')])[_0xd228('0x41')](0x1,_0xd228('0x42'));}_[_0xd228('0x43')](_0x250374['where'],{'createdAt':{'$gte':_0x559a03[_0xd228('0x38')],'$lte':_0x559a03['dateEnd']}});}if(_0x15ff3f[_0xd228('0x37')][_0xd228('0x44')]){_0x250374[_0xd228('0x45')]=_['merge'](_0x250374['where'],{'$or':_[_0xd228('0x46')](_0x250374['attributes'],function(_0x1c270a){var _0x2e51c0={};_0x2e51c0[_0x1c270a]={'$like':'%'+_0x15ff3f[_0xd228('0x37')]['filter']+'%'};return _0x2e51c0;})});}_0x250374=_[_0xd228('0x43')]({},_0x250374,_0x15ff3f[_0xd228('0x47')]);var _0x7ae8f4={'where':_0x250374[_0xd228('0x45')]};return db[_0xd228('0x34')][_0xd228('0x26')](_0x7ae8f4)[_0xd228('0x1b')](function(_0x36f6b4){_0x171707['count']=_0x36f6b4;if(_0x15ff3f['query'][_0xd228('0x48')]){_0x250374[_0xd228('0x49')]=[{'all':!![]}];}return db[_0xd228('0x34')][_0xd228('0x4a')](_0x250374);})[_0xd228('0x1b')](function(_0x4f0cea){_0x171707[_0xd228('0x4b')]=_0x4f0cea;return _0x171707;})[_0xd228('0x1b')](respondWithFilteredResult(_0x2203e0,_0x250374))['catch'](handleError(_0x2203e0,null));};exports[_0xd228('0x4c')]=function(_0xa77e32,_0x585032){var _0x4816f9={'raw':!![],'where':{'id':_0xa77e32['params']['id']}},_0x39d897={};_0x39d897[_0xd228('0x35')]=_[_0xd228('0x36')](db[_0xd228('0x34')]['rawAttributes']);_0x39d897['query']=_['keys'](_0xa77e32[_0xd228('0x37')]);_0x39d897[_0xd228('0x3a')]=_[_0xd228('0x3b')](_0x39d897['model'],_0x39d897['query']);_0x4816f9[_0xd228('0x3d')]=_[_0xd228('0x3b')](_0x39d897[_0xd228('0x35')],qs[_0xd228('0x3c')](_0xa77e32[_0xd228('0x37')][_0xd228('0x3c')]));_0x4816f9[_0xd228('0x3d')]=_0x4816f9['attributes']['length']?_0x4816f9['attributes']:_0x39d897['model'];if(_0xa77e32[_0xd228('0x37')]['includeAll']){_0x4816f9[_0xd228('0x49')]=[{'all':!![]}];}_0x4816f9=_[_0xd228('0x43')]({},_0x4816f9,_0xa77e32[_0xd228('0x47')]);return db[_0xd228('0x34')]['find'](_0x4816f9)[_0xd228('0x1b')](handleEntityNotFound(_0x585032,null))[_0xd228('0x1b')](respondWithResult(_0x585032,null))[_0xd228('0x4d')](handleError(_0x585032,null));};exports[_0xd228('0x4e')]=function(_0x36b326,_0x4b0558){return db['ChatGroup']['create'](_0x36b326[_0xd228('0x4f')],{})[_0xd228('0x1b')](respondWithResult(_0x4b0558,0xc9))[_0xd228('0x4d')](handleError(_0x4b0558,null));};exports[_0xd228('0x2d')]=function(_0x2ac62e,_0x3a9e2e){if(_0x2ac62e[_0xd228('0x4f')]['id']){delete _0x2ac62e[_0xd228('0x4f')]['id'];}return db[_0xd228('0x34')]['find']({'where':{'id':_0x2ac62e[_0xd228('0x50')]['id']}})['then'](handleEntityNotFound(_0x3a9e2e,null))[_0xd228('0x1b')](saveUpdates(_0x2ac62e[_0xd228('0x4f')],null))[_0xd228('0x1b')](respondWithResult(_0x3a9e2e,null))['catch'](handleError(_0x3a9e2e,null));};exports['destroy']=function(_0x15b3fb,_0x483e36){return db['ChatGroup'][_0xd228('0x51')]({'where':{'id':_0x15b3fb[_0xd228('0x50')]['id']}})[_0xd228('0x1b')](handleEntityNotFound(_0x483e36,null))[_0xd228('0x1b')](removeEntity(_0x483e36,null))[_0xd228('0x4d')](handleError(_0x483e36,null));};exports[_0xd228('0x52')]=function(_0x13106d,_0x43334d){return db[_0xd228('0x34')]['describe']()['then'](respondWithResult(_0x43334d,null))[_0xd228('0x4d')](handleError(_0x43334d,null));};exports[_0xd228('0x53')]=function(_0xc04913,_0x12324d,_0x14b4ce){return db['ChatInternalMessage'][_0xd228('0x26')]({'where':{'ChatGroupId':_0xc04913[_0xd228('0x50')]['id'],'ToId':_0xc04913['user']['id'],'read':![]}})[_0xd228('0x1b')](function(_0x50156e){return{'id':_['toInteger'](_0xc04913[_0xd228('0x50')]['id']),'count':_0x50156e};})['then'](respondWithResult(_0x12324d,null))[_0xd228('0x4d')](handleError(_0x12324d,null));};exports['addMembers']=function(_0x39f329,_0x514b4d,_0x1f48f1){return db[_0xd228('0x34')][_0xd228('0x51')]({'where':{'id':_0x39f329['params']['id']}})[_0xd228('0x1b')](handleEntityNotFound(_0x514b4d,null))[_0xd228('0x1b')](function(_0x5630a3){if(_0x5630a3){return _0x5630a3[_0xd228('0x54')](_0x39f329[_0xd228('0x4f')][_0xd228('0x55')],_['omit'](_0x39f329['body'],[_0xd228('0x55'),'id'])||{});}})['then'](respondWithResult(_0x514b4d,null))[_0xd228('0x4d')](handleError(_0x514b4d,null));};exports[_0xd228('0x56')]=function(_0x3d1ff3,_0x481733,_0x1f54bc){var _0x49c125={};var _0x42b5b7={};var _0x15047f;var _0x541935;return db[_0xd228('0x34')][_0xd228('0x57')]({'where':{'id':_0x3d1ff3[_0xd228('0x50')]['id']}})[_0xd228('0x1b')](handleEntityNotFound(_0x481733,null))['then'](function(_0x3dc390){if(_0x3dc390){_0x15047f=_0x3dc390;_0x42b5b7[_0xd228('0x35')]=_['keys'](db[_0xd228('0x58')]['rawAttributes']);_0x42b5b7['query']=_['keys'](_0x3d1ff3['query']);_0x42b5b7['filters']=_[_0xd228('0x3b')](_0x42b5b7[_0xd228('0x35')],_0x42b5b7[_0xd228('0x37')]);_0x49c125[_0xd228('0x3d')]=_['intersection'](_0x42b5b7[_0xd228('0x35')],qs[_0xd228('0x3c')](_0x3d1ff3[_0xd228('0x37')][_0xd228('0x3c')]));_0x49c125[_0xd228('0x3d')]=_0x49c125[_0xd228('0x3d')]['length']?_0x49c125[_0xd228('0x3d')]:_0x42b5b7[_0xd228('0x35')];_0x49c125['order']=qs[_0xd228('0x3f')](_0x3d1ff3['query']['sort']);_0x49c125[_0xd228('0x45')]=qs['filters'](_['pick'](_0x3d1ff3[_0xd228('0x37')],_0x42b5b7[_0xd228('0x3a')]));if(_0x3d1ff3[_0xd228('0x37')][_0xd228('0x44')]){_0x49c125['where']=_[_0xd228('0x43')](_0x49c125[_0xd228('0x45')],{'$or':_[_0xd228('0x46')](_0x49c125[_0xd228('0x3d')],function(_0x450258){var _0x5679d4={};_0x5679d4[_0x450258]={'$like':'%'+_0x3d1ff3[_0xd228('0x37')][_0xd228('0x44')]+'%'};return _0x5679d4;})});}_0x49c125=_[_0xd228('0x43')]({},_0x49c125,_0x3d1ff3[_0xd228('0x47')]);return _0x15047f[_0xd228('0x56')](_0x49c125);}})[_0xd228('0x1b')](function(_0xbb251a){if(_0xbb251a){_0x541935=_0xbb251a[_0xd228('0x59')];if(!_0x3d1ff3[_0xd228('0x37')][_0xd228('0x5a')](_0xd228('0x3e'))){_0x49c125['limit']=qs[_0xd228('0x28')](_0x3d1ff3[_0xd228('0x37')]['limit']);_0x49c125['offset']=qs[_0xd228('0x27')](_0x3d1ff3[_0xd228('0x37')][_0xd228('0x27')]);}return _0x15047f['getMembers'](_0x49c125);}})['then'](function(_0x120b09){if(_0x120b09){return _0x120b09?{'count':_0x541935,'rows':_0x120b09}:null;}})['then'](respondWithResult(_0x481733,null))[_0xd228('0x4d')](handleError(_0x481733,null));};exports[_0xd228('0x5b')]=function(_0x5b4b42,_0x12d5d0,_0x7fa491){var _0x5afd8e;return db[_0xd228('0x34')][_0xd228('0x51')]({'where':{'id':_0x5b4b42['params']['id']}})['then'](handleEntityNotFound(_0x12d5d0,null))[_0xd228('0x1b')](function(_0xdc9eb5){if(_0xdc9eb5){return _0xdc9eb5[_0xd228('0x5b')](_0x5b4b42[_0xd228('0x37')]['ids']);}})[_0xd228('0x1b')](respondWithStatusCode(_0x12d5d0,null))[_0xd228('0x4d')](handleError(_0x12d5d0,null));};exports[_0xd228('0x5c')]=function(_0xbcdd56,_0x6cb7f,_0x30800d){if(_0xbcdd56['body']['id']){delete _0xbcdd56[_0xd228('0x4f')]['id'];}return db[_0xd228('0x34')][_0xd228('0x51')]({'where':{'id':_0xbcdd56[_0xd228('0x50')]['id']}})['then'](handleEntityNotFound(_0x6cb7f,null))[_0xd228('0x1b')](function(_0x9a2c50){if(_0x9a2c50){_0xbcdd56['body'][_0xd228('0x5d')]=_0x9a2c50['id'];return db[_0xd228('0x5e')][_0xd228('0x4e')](_0xbcdd56[_0xd228('0x4f')]);}})[_0xd228('0x1b')](respondWithResult(_0x6cb7f,null))[_0xd228('0x4d')](handleError(_0x6cb7f,null));};exports[_0xd228('0x5f')]=function(_0xb5929c,_0x4bdc15,_0x9abda){var _0x56b92f={};var _0x4a6c64={};var _0x24a6e0;var _0x2ce0de;return db['ChatGroup'][_0xd228('0x57')]({'where':{'id':_0xb5929c[_0xd228('0x50')]['id']}})['then'](handleEntityNotFound(_0x4bdc15,null))[_0xd228('0x1b')](function(_0x33708e){if(_0x33708e){_0x24a6e0=_0x33708e;_0x4a6c64[_0xd228('0x35')]=_[_0xd228('0x36')](db['ChatInternalMessage'][_0xd228('0x60')]);_0x4a6c64[_0xd228('0x37')]=_[_0xd228('0x36')](_0xb5929c[_0xd228('0x37')]);_0x4a6c64[_0xd228('0x3a')]=_[_0xd228('0x3b')](_0x4a6c64[_0xd228('0x35')],_0x4a6c64[_0xd228('0x37')]);_0x56b92f['attributes']=_[_0xd228('0x3b')](_0x4a6c64[_0xd228('0x35')],qs[_0xd228('0x3c')](_0xb5929c[_0xd228('0x37')][_0xd228('0x3c')]));_0x56b92f['attributes']=_0x56b92f['attributes'][_0xd228('0x59')]?_0x56b92f[_0xd228('0x3d')]:_0x4a6c64[_0xd228('0x35')];_0x56b92f[_0xd228('0x61')]=qs[_0xd228('0x3f')](_0xb5929c[_0xd228('0x37')][_0xd228('0x3f')]);_0x56b92f['where']=qs[_0xd228('0x3a')](_['pick'](_0xb5929c['query'],_0x4a6c64['filters']));if(_0xb5929c['query'][_0xd228('0x44')]){_0x56b92f[_0xd228('0x45')]=_[_0xd228('0x43')](_0x56b92f[_0xd228('0x45')],{'$or':_[_0xd228('0x46')](_0x56b92f[_0xd228('0x3d')],function(_0x1ab07a){var _0x37e368={};_0x37e368[_0x1ab07a]={'$like':'%'+_0xb5929c[_0xd228('0x37')]['filter']+'%'};return _0x37e368;})});}if(_0xb5929c[_0xd228('0x37')][_0xd228('0x62')]){var _0x948048=_0xb5929c['query'][_0xd228('0x62')][_0xd228('0x63')](',');var _0x253e72={};_0x253e72[_0x948048[0x0]]={'$gte':moment(_0x948048[0x1])['format'](_0xd228('0x64'))};_0x56b92f[_0xd228('0x45')]=_['merge'](_0x56b92f['where'],_0x253e72);}_0x56b92f=_[_0xd228('0x43')]({},_0x56b92f,_0xb5929c[_0xd228('0x47')]);return _0x24a6e0['getMessages'](_0x56b92f);}})[_0xd228('0x1b')](function(_0x56a662){if(_0x56a662){_0x2ce0de=_0x56a662[_0xd228('0x59')];if(!_0xb5929c['query'][_0xd228('0x5a')]('nolimit')){_0x56b92f[_0xd228('0x28')]=qs[_0xd228('0x28')](_0xb5929c['query'][_0xd228('0x28')]);_0x56b92f[_0xd228('0x27')]=qs[_0xd228('0x27')](_0xb5929c[_0xd228('0x37')][_0xd228('0x27')]);}return _0x24a6e0[_0xd228('0x5f')](_0x56b92f);}})[_0xd228('0x1b')](function(_0x460020){if(_0x460020){return _0x460020?{'count':_0x2ce0de,'rows':_0x460020}:null;}})[_0xd228('0x1b')](respondWithResult(_0x4bdc15,null))['catch'](handleError(_0x4bdc15,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index f62b0eb..e03fbd6 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 _0xa3d6=['remove','emit','hook','exports','events','../../mysqldb','ChatGroup','save'];(function(_0x5ec09b,_0x12d654){var _0x5a8482=function(_0x3e250f){while(--_0x3e250f){_0x5ec09b['push'](_0x5ec09b['shift']());}};_0x5a8482(++_0x12d654);}(_0xa3d6,0x17c));var _0x6a3d=function(_0x2b24e2,_0x5ac85c){_0x2b24e2=_0x2b24e2-0x0;var _0x11f592=_0xa3d6[_0x2b24e2];return _0x11f592;};'use strict';var EventEmitter=require(_0x6a3d('0x0'));var ChatGroup=require(_0x6a3d('0x1'))['db'][_0x6a3d('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6a3d('0x3'),'afterUpdate':'update','afterDestroy':_0x6a3d('0x4')};function emitEvent(_0x777238){return function(_0x5435fa,_0x26a26c,_0x5ccfd6){ChatGroupEvents['emit'](_0x777238+':'+_0x5435fa['id'],_0x5435fa);ChatGroupEvents[_0x6a3d('0x5')](_0x777238,_0x5435fa);_0x5ccfd6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x6a3d('0x6')](e,emitEvent(event));}}module[_0x6a3d('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0x0524=['exports','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x0524,0x1ed));var _0x4052=function(_0x77d286,_0x1ddc6d){_0x77d286=_0x77d286-0x0;var _0x5446a5=_0x0524[_0x77d286];return _0x5446a5;};'use strict';var EventEmitter=require('events');var ChatGroup=require('../../mysqldb')['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x4052('0x0')](0x0);var events={'afterCreate':_0x4052('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2dc3a9){return function(_0x223bce,_0x1669a3,_0x5c2501){ChatGroupEvents['emit'](_0x2dc3a9+':'+_0x223bce['id'],_0x223bce);ChatGroupEvents[_0x4052('0x2')](_0x2dc3a9,_0x223bce);_0x5c2501(null);};}for(var e in events){if(events[_0x4052('0x3')](e)){var event=events[e];ChatGroup[_0x4052('0x4')](e,emitEvent(event));}}module[_0x4052('0x5')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 97ab659..b026066 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 _0xa20e=['chat_groups','lodash','../../config/logger','api','moment','request-promise','exports','ChatGroup'];(function(_0x231b37,_0x3acfa1){var _0x5f1afd=function(_0x188ffe){while(--_0x188ffe){_0x231b37['push'](_0x231b37['shift']());}};_0x5f1afd(++_0x3acfa1);}(_0xa20e,0x81));var _0xea20=function(_0x3899cb,_0xb95555){_0x3899cb=_0x3899cb-0x0;var _0x3fe239=_0xa20e[_0x3899cb];return _0x3fe239;};'use strict';var _=require(_0xea20('0x0'));var util=require('util');var logger=require(_0xea20('0x1'))(_0xea20('0x2'));var moment=require(_0xea20('0x3'));var BPromise=require('bluebird');var rp=require(_0xea20('0x4'));var attributes=require('./chatGroup.attributes');module[_0xea20('0x5')]=function(_0x54d7e4,_0x805aef){return _0x54d7e4['define'](_0xea20('0x6'),attributes,{'tableName':_0xea20('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf542=['ChatGroup','lodash','util','../../config/logger','api','bluebird','./chatGroup.attributes','exports','define'];(function(_0x5cf541,_0x19ba00){var _0x1d0262=function(_0x50a856){while(--_0x50a856){_0x5cf541['push'](_0x5cf541['shift']());}};_0x1d0262(++_0x19ba00);}(_0xf542,0x184));var _0x2f54=function(_0x54bdd6,_0x364c86){_0x54bdd6=_0x54bdd6-0x0;var _0x4790d3=_0xf542[_0x54bdd6];return _0x4790d3;};'use strict';var _=require(_0x2f54('0x0'));var util=require(_0x2f54('0x1'));var logger=require(_0x2f54('0x2'))(_0x2f54('0x3'));var moment=require('moment');var BPromise=require(_0x2f54('0x4'));var rp=require('request-promise');var attributes=require(_0x2f54('0x5'));module[_0x2f54('0x6')]=function(_0x31da12,_0x3f3793){return _0x31da12[_0x2f54('0x7')](_0x2f54('0x8'),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 794a330..2969fc1 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 _0xc874=['defaults','localhost','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis'];(function(_0x577077,_0x52f056){var _0x370769=function(_0x34d109){while(--_0x34d109){_0x577077['push'](_0x577077['shift']());}};_0x370769(++_0x52f056);}(_0xc874,0x154));var _0x4c87=function(_0x545b71,_0x4f44eb){_0x545b71=_0x545b71-0x0;var _0x26e587=_0xc874[_0x545b71];return _0x26e587;};'use strict';var _=require(_0x4c87('0x0'));var util=require('util');var moment=require(_0x4c87('0x1'));var BPromise=require(_0x4c87('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c87('0x3'))['db'];var utils=require(_0x4c87('0x4'));var logger=require(_0x4c87('0x5'))('rpc');var config=require(_0x4c87('0x6'));var jayson=require(_0x4c87('0x7'));var client=jayson['client'][_0x4c87('0x8')]({'port':0x232a});config[_0x4c87('0x9')]=_[_0x4c87('0xa')](config[_0x4c87('0x9')],{'host':_0x4c87('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4c87('0x9')]));require('./chatGroup.socket')[_0x4c87('0xc')](socket);function respondWithRpcPromise(_0x42f471,_0x30e64f,_0x1a15a2){return new BPromise(function(_0x46c0bc,_0x548e1a){return client[_0x4c87('0xd')](_0x42f471,_0x1a15a2)[_0x4c87('0xe')](function(_0x527917){logger[_0x4c87('0xf')](_0x4c87('0x10'),_0x30e64f,_0x4c87('0x11'));logger[_0x4c87('0x12')](_0x4c87('0x13'),_0x30e64f,'request\x20sent',JSON['stringify'](_0x527917));if(_0x527917['error']){if(_0x527917[_0x4c87('0x14')][_0x4c87('0x15')]===0x1f4){logger[_0x4c87('0x14')](_0x4c87('0x10'),_0x30e64f,_0x527917[_0x4c87('0x14')][_0x4c87('0x16')]);return _0x548e1a(_0x527917[_0x4c87('0x14')][_0x4c87('0x16')]);}logger['error'](_0x4c87('0x10'),_0x30e64f,_0x527917[_0x4c87('0x14')]['message']);return _0x46c0bc(_0x527917['error'][_0x4c87('0x16')]);}else{logger[_0x4c87('0xf')](_0x4c87('0x10'),_0x30e64f,'request\x20sent');_0x46c0bc(_0x527917[_0x4c87('0x17')]['message']);}})[_0x4c87('0x18')](function(_0x2a6891){logger[_0x4c87('0x14')](_0x4c87('0x10'),_0x30e64f,_0x2a6891);_0x548e1a(_0x2a6891);});});} \ No newline at end of file +var _0x00bb=['then','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','ChatGroup,\x20%s,\x20%s','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x00bb,0x1d8));var _0xb00b=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x00bb[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xb00b('0x8')]=_[_0xb00b('0x9')](config[_0xb00b('0x8')],{'host':_0xb00b('0xa'),'port':0x18eb});var socket=require(_0xb00b('0xb'))(new Redis(config[_0xb00b('0x8')]));require('./chatGroup.socket')['register'](socket);function respondWithRpcPromise(_0x5154d9,_0x1e9b7b,_0x5851d4){return new BPromise(function(_0x46a25c,_0x28d3cc){return client['request'](_0x5154d9,_0x5851d4)[_0xb00b('0xc')](function(_0x5a63ed){logger['info']('ChatGroup,\x20%s,\x20%s',_0x1e9b7b,_0xb00b('0xd'));logger[_0xb00b('0xe')](_0xb00b('0xf'),_0x1e9b7b,_0xb00b('0xd'),JSON[_0xb00b('0x10')](_0x5a63ed));if(_0x5a63ed[_0xb00b('0x11')]){if(_0x5a63ed['error'][_0xb00b('0x12')]===0x1f4){logger[_0xb00b('0x11')]('ChatGroup,\x20%s,\x20%s',_0x1e9b7b,_0x5a63ed[_0xb00b('0x11')][_0xb00b('0x13')]);return _0x28d3cc(_0x5a63ed['error']['message']);}logger[_0xb00b('0x11')]('ChatGroup,\x20%s,\x20%s',_0x1e9b7b,_0x5a63ed['error'][_0xb00b('0x13')]);return _0x46a25c(_0x5a63ed[_0xb00b('0x11')][_0xb00b('0x13')]);}else{logger[_0xb00b('0x14')]('ChatGroup,\x20%s,\x20%s',_0x1e9b7b,_0xb00b('0xd'));_0x46a25c(_0x5a63ed['result'][_0xb00b('0x13')]);}})['catch'](function(_0x25d7a0){logger['error'](_0xb00b('0x15'),_0x1e9b7b,_0x25d7a0);_0x28d3cc(_0x25d7a0);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index c14caa6..ffb89eb 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 _0x7794=['update','emit','chatGroup:','save','remove'];(function(_0x3065cf,_0x1297e5){var _0x16e4fa=function(_0x139c2c){while(--_0x139c2c){_0x3065cf['push'](_0x3065cf['shift']());}};_0x16e4fa(++_0x1297e5);}(_0x7794,0x7b));var _0x4779=function(_0x143767,_0x4e217a){_0x143767=_0x143767-0x0;var _0x1cccbf=_0x7794[_0x143767];return _0x1cccbf;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x4779('0x0'),_0x4779('0x1'),_0x4779('0x2')];function createListener(_0xa47992,_0x493318){return function(_0x309b79){_0x493318[_0x4779('0x3')](_0xa47992,_0x309b79);};}function removeListener(_0x4d3b05,_0x40e5f9){return function(){ChatGroupEvents['removeListener'](_0x4d3b05,_0x40e5f9);};}exports['register']=function(_0x53fd58){for(var _0x45cd71=0x0,_0x339512=events['length'];_0x45cd71<_0x339512;_0x45cd71++){var _0xb3fe18=events[_0x45cd71];var _0x13bb66=createListener(_0x4779('0x4')+_0xb3fe18,_0x53fd58);ChatGroupEvents['on'](_0xb3fe18,_0x13bb66);}}; \ No newline at end of file +var _0x95c5=['register','length','chatGroup:','./chatGroup.events','save','update','emit','removeListener'];(function(_0x48cb60,_0xf11595){var _0xad4c94=function(_0x45ae34){while(--_0x45ae34){_0x48cb60['push'](_0x48cb60['shift']());}};_0xad4c94(++_0xf11595);}(_0x95c5,0x153));var _0x595c=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x95c5[_0x45f951];return _0x24756c;};'use strict';var ChatGroupEvents=require(_0x595c('0x0'));var events=[_0x595c('0x1'),'remove',_0x595c('0x2')];function createListener(_0x22a23d,_0x36a7da){return function(_0x1da8dc){_0x36a7da[_0x595c('0x3')](_0x22a23d,_0x1da8dc);};}function removeListener(_0x218d7b,_0xf4369b){return function(){ChatGroupEvents[_0x595c('0x4')](_0x218d7b,_0xf4369b);};}exports[_0x595c('0x5')]=function(_0x46be42){for(var _0x4ff80b=0x0,_0x49a115=events[_0x595c('0x6')];_0x4ff80b<_0x49a115;_0x4ff80b++){var _0xfcaf47=events[_0x4ff80b];var _0x218eca=createListener(_0x595c('0x7')+_0xfcaf47,_0x46be42);ChatGroupEvents['on'](_0xfcaf47,_0x218eca);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index d700dd2..abac33e 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 _0xdb71=['addMessage','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','/describe','describe','/:id','show','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','addMembers'];(function(_0x44feb5,_0x3f7964){var _0x45e3b8=function(_0x2848be){while(--_0x2848be){_0x44feb5['push'](_0x44feb5['shift']());}};_0x45e3b8(++_0x3f7964);}(_0xdb71,0x92));var _0x1db7=function(_0xf03f27,_0x26e303){_0xf03f27=_0xf03f27-0x0;var _0x329755=_0xdb71[_0xf03f27];return _0x329755;};'use strict';var multer=require(_0x1db7('0x0'));var util=require(_0x1db7('0x1'));var path=require(_0x1db7('0x2'));var timeout=require(_0x1db7('0x3'));var express=require(_0x1db7('0x4'));var router=express[_0x1db7('0x5')]();var auth=require(_0x1db7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1db7('0x7'));var controller=require(_0x1db7('0x8'));router[_0x1db7('0x9')]('/',auth[_0x1db7('0xa')](),controller['index']);router[_0x1db7('0x9')](_0x1db7('0xb'),auth[_0x1db7('0xa')](),controller[_0x1db7('0xc')]);router[_0x1db7('0x9')](_0x1db7('0xd'),auth[_0x1db7('0xa')](),controller[_0x1db7('0xe')]);router[_0x1db7('0x9')]('/:id/unread',auth['isAuthenticated'](),controller[_0x1db7('0xf')]);router[_0x1db7('0x9')](_0x1db7('0x10'),auth[_0x1db7('0xa')](),controller[_0x1db7('0x11')]);router['get'](_0x1db7('0x12'),auth[_0x1db7('0xa')](),controller[_0x1db7('0x13')]);router[_0x1db7('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1db7('0x14')]('/:id/members',auth[_0x1db7('0xa')](),controller[_0x1db7('0x15')]);router['post'](_0x1db7('0x12'),auth[_0x1db7('0xa')](),controller[_0x1db7('0x16')]);router[_0x1db7('0x17')]('/:id',auth[_0x1db7('0xa')](),controller[_0x1db7('0x18')]);router[_0x1db7('0x19')](_0x1db7('0xd'),auth[_0x1db7('0xa')](),controller[_0x1db7('0x1a')]);router[_0x1db7('0x19')](_0x1db7('0x10'),auth['isAuthenticated'](),controller['removeMembers']);module[_0x1db7('0x1b')]=router; \ No newline at end of file +var _0x27ec=['/:id','show','get','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','put','update','delete','destroy','removeMembers','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','isAuthenticated','index','/describe','describe'];(function(_0x312ef7,_0x4d2c26){var _0x20794b=function(_0x28e2c5){while(--_0x28e2c5){_0x312ef7['push'](_0x312ef7['shift']());}};_0x20794b(++_0x4d2c26);}(_0x27ec,0xc0));var _0xc27e=function(_0x21c8a2,_0x4f42a1){_0x21c8a2=_0x21c8a2-0x0;var _0x39d426=_0x27ec[_0x21c8a2];return _0x39d426;};'use strict';var multer=require(_0xc27e('0x0'));var util=require(_0xc27e('0x1'));var path=require(_0xc27e('0x2'));var timeout=require(_0xc27e('0x3'));var express=require(_0xc27e('0x4'));var router=express['Router']();var auth=require(_0xc27e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc27e('0x6'));var controller=require('./chatGroup.controller');router['get']('/',auth[_0xc27e('0x7')](),controller[_0xc27e('0x8')]);router['get'](_0xc27e('0x9'),auth[_0xc27e('0x7')](),controller[_0xc27e('0xa')]);router['get'](_0xc27e('0xb'),auth[_0xc27e('0x7')](),controller[_0xc27e('0xc')]);router[_0xc27e('0xd')](_0xc27e('0xe'),auth[_0xc27e('0x7')](),controller[_0xc27e('0xf')]);router[_0xc27e('0xd')](_0xc27e('0x10'),auth[_0xc27e('0x7')](),controller[_0xc27e('0x11')]);router[_0xc27e('0xd')](_0xc27e('0x12'),auth[_0xc27e('0x7')](),controller[_0xc27e('0x13')]);router[_0xc27e('0x14')]('/',auth[_0xc27e('0x7')](),controller[_0xc27e('0x15')]);router[_0xc27e('0x14')](_0xc27e('0x10'),auth[_0xc27e('0x7')](),controller[_0xc27e('0x16')]);router['post'](_0xc27e('0x12'),auth[_0xc27e('0x7')](),controller[_0xc27e('0x17')]);router[_0xc27e('0x18')](_0xc27e('0xb'),auth[_0xc27e('0x7')](),controller[_0xc27e('0x19')]);router[_0xc27e('0x1a')](_0xc27e('0xb'),auth[_0xc27e('0x7')](),controller[_0xc27e('0x1b')]);router[_0xc27e('0x1a')]('/:id/members',auth['isAuthenticated'](),controller[_0xc27e('0x1c')]);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 e99a055..c83b1a3 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 _0x6e6c=['TEXT','DATE','STRING','long','out','sequelize','exports','INTEGER','ENUM','star'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6e6c[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xc6e6('0x0'));module[_0xc6e6('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xc6e6('0x2')]},'ratingType':{'type':Sequelize[_0xc6e6('0x3')]('star','thumb'),'defaultValue':_0xc6e6('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xc6e6('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xc6e6('0x6')]},'disposition':{'type':Sequelize[_0xc6e6('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0xc6e6('0x7')]},'browserVersion':{'type':Sequelize[_0xc6e6('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0xc6e6('0x7')]},'deviceModel':{'type':Sequelize[_0xc6e6('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xc6e6('0x7')]},'referer':{'type':Sequelize['STRING']},'customerIp':{'type':Sequelize[_0xc6e6('0x7')]},'formData':{'type':Sequelize[_0xc6e6('0x5')](_0xc6e6('0x8'))},'read1stAt':{'type':Sequelize[_0xc6e6('0x6')]},'lastMsgAt':{'type':Sequelize[_0xc6e6('0x6')]},'lastMsgDirection':{'type':Sequelize[_0xc6e6('0x3')]('in',_0xc6e6('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xc6e6('0x7')]}}; \ No newline at end of file +var _0x96cc=['STRING','DATE','long','out','sequelize','BOOLEAN','ENUM','star','thumb','TEXT'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x96cc,0x16c));var _0xc96c=function(_0x2a9479,_0x394989){_0x2a9479=_0x2a9479-0x0;var _0x472b13=_0x96cc[_0x2a9479];return _0x472b13;};'use strict';var Sequelize=require(_0xc96c('0x0'));module['exports']={'closed':{'type':Sequelize[_0xc96c('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xc96c('0x2')](_0xc96c('0x3'),_0xc96c('0x4')),'defaultValue':_0xc96c('0x3')},'ratingMessage':{'type':Sequelize[_0xc96c('0x5')]},'pathTranscript':{'type':Sequelize[_0xc96c('0x5')]},'mailTranscript':{'type':Sequelize[_0xc96c('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xc96c('0x7')]},'disposition':{'type':Sequelize[_0xc96c('0x6')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0xc96c('0x6')]},'browserVersion':{'type':Sequelize[_0xc96c('0x6')]},'osName':{'type':Sequelize[_0xc96c('0x6')]},'osVersion':{'type':Sequelize[_0xc96c('0x6')]},'deviceModel':{'type':Sequelize[_0xc96c('0x6')]},'deviceVendor':{'type':Sequelize[_0xc96c('0x6')]},'deviceType':{'type':Sequelize[_0xc96c('0x6')]},'referer':{'type':Sequelize['STRING']},'customerIp':{'type':Sequelize[_0xc96c('0x6')]},'formData':{'type':Sequelize[_0xc96c('0x5')](_0xc96c('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0xc96c('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xc96c('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 136756b..bdc1ae5 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 _0xb458=['Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','order','pick','ChatInteractionId','$gte','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','getMyMessages','includeAgent','addTags','setTags','spread','emit','removeTags','download','unix','server','files','tmp','interaction-%s.zip','CmContact','Letter','1cm','mkdirSync','

Chat\x20Interaction:\x20#%d

','

Date:\x20%s

','MMMM\x20Do\x20YYYY,\x20HH:mm:ss','toString','
','','%s:\x20%s

','','existsSync','createReadStream','pipe','basename','toFile','interaction-','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','intersection','attributes','fields','nolimit','sort','filters','day','add','merge','where','filter','map','options','include','tag','push','Tags','distinct','read','ChatMessage','Messages','createdAt','ChatInteraction','User','Users','fullname','Contact','internal','ChatWebsite','Account','direction','Tag','color','ThroughTags','findAll','show','length','find','body','params','describe','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Sequelize','ValidationError','closed','closedAt','disposition','AbandonInteraction','attachmentUpload','originalname','filename','type','file','mimetype','Attachment','create','attachmentDownload','Unauthorized','findOne','attachId','join','server/files/attachments/','close','root','transcript-%s.txt','now','ChatWebsiteId','ContactId','format','%s%d','agentAlias','customer','Visitor','agentIdentifier','website_alias','System','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','secret','MailAccount','MailServerOut','Smtp','service','host','secure','authentication','auth','user','pass','SendMail','sendMail','\x22%s\x22\x20<%s>'];(function(_0xf2628e,_0x521bf7){var _0x13863a=function(_0x2b04ab){while(--_0x2b04ab){_0xf2628e['push'](_0xf2628e['shift']());}};_0x13863a(++_0x521bf7);}(_0xb458,0x103));var _0x8b45=function(_0x2ba7c4,_0x5a9a03){_0x2ba7c4=_0x2ba7c4-0x0;var _0x14da79=_0xb458[_0x2ba7c4];return _0x14da79;};'use strict';var pdf=require(_0x8b45('0x0'));var emlformat=require(_0x8b45('0x1'));var rimraf=require(_0x8b45('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8b45('0x3'));var moment=require(_0x8b45('0x4'));var BPromise=require(_0x8b45('0x5'));var Mustache=require(_0x8b45('0x6'));var util=require('util');var path=require(_0x8b45('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8b45('0x8'));var fs=require('fs');var _=require(_0x8b45('0x9'));var squel=require(_0x8b45('0xa'));var crypto=require(_0x8b45('0xb'));var jsforce=require(_0x8b45('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8b45('0xd'));var querystring=require(_0x8b45('0xe'));var Papa=require(_0x8b45('0xf'));var Redis=require(_0x8b45('0x10'));var qs=require(_0x8b45('0x11'));var logger=require('../../config/logger')(_0x8b45('0x12'));var utils=require(_0x8b45('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x8b45('0x14')],{'host':_0x8b45('0x15'),'port':0x18eb});var socket=require(_0x8b45('0x16'))(new Redis(config['redis']));require(_0x8b45('0x17'))[_0x8b45('0x18')](socket);var jayson=require(_0x8b45('0x19'));var client=jayson[_0x8b45('0x1a')][_0x8b45('0x1b')]({'port':0x232b});var client9004=jayson[_0x8b45('0x1a')]['http']({'port':0x232c});function respondWithRpcPromise(_0x5a14c1,_0x45881c,_0x23f1dd,_0x445170){return new BPromise(function(_0x39c1d1,_0x4781d7){var _0x27ebb3=_0x445170||client;return _0x27ebb3[_0x8b45('0x1c')](_0x5a14c1,_0x23f1dd)[_0x8b45('0x1d')](function(_0x33102e){logger[_0x8b45('0x1e')](_0x8b45('0x1f'),_0x45881c,_0x8b45('0x20'));logger[_0x8b45('0x21')](_0x8b45('0x22'),_0x45881c,_0x8b45('0x20'),JSON[_0x8b45('0x23')](_0x33102e));if(_0x33102e[_0x8b45('0x24')]){if(_0x33102e[_0x8b45('0x24')]['code']===0x1f4){logger[_0x8b45('0x24')](_0x8b45('0x1f'),_0x45881c,_0x33102e[_0x8b45('0x24')][_0x8b45('0x25')]);return _0x4781d7(_0x33102e[_0x8b45('0x24')][_0x8b45('0x25')]);}logger[_0x8b45('0x24')](_0x8b45('0x1f'),_0x45881c,_0x33102e['error']['message']);return _0x39c1d1(_0x33102e[_0x8b45('0x24')]['message']);}else{logger[_0x8b45('0x1e')](_0x8b45('0x1f'),_0x45881c,_0x8b45('0x20'));_0x39c1d1(_0x33102e[_0x8b45('0x26')][_0x8b45('0x25')]);}})[_0x8b45('0x27')](function(_0x32b12b){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x45881c,_0x32b12b);_0x4781d7(_0x32b12b);});});}function respondWithStatusCode(_0x11ffcc,_0x2c2c06){_0x2c2c06=_0x2c2c06||0xcc;return function(_0x500044){if(_0x500044){return _0x11ffcc['sendStatus'](_0x2c2c06);}return _0x11ffcc[_0x8b45('0x28')](_0x2c2c06)[_0x8b45('0x29')]();};}function respondWithResult(_0x2ca2d9,_0x2f37bc){_0x2f37bc=_0x2f37bc||0xc8;return function(_0x4e84cc){if(_0x4e84cc){return _0x2ca2d9[_0x8b45('0x28')](_0x2f37bc)[_0x8b45('0x2a')](_0x4e84cc);}};}function respondWithFilteredResult(_0x21b588,_0x9de2ad){return function(_0x395dc3){if(_0x395dc3){var _0xf334b2=_0x395dc3[_0x8b45('0x2b')],_0x461017=_0x9de2ad[_0x8b45('0x2c')],_0x234f62=_0x9de2ad[_0x8b45('0x2c')]+_0x9de2ad[_0x8b45('0x2d')],_0x1733a7;if(_0x234f62>=_0xf334b2){_0x234f62=_0xf334b2;_0x1733a7=0xc8;}else{_0x1733a7=0xce;}_0x21b588['status'](_0x1733a7);return _0x21b588[_0x8b45('0x2e')](_0x8b45('0x2f'),_0x461017+'-'+_0x234f62+'/'+_0xf334b2)[_0x8b45('0x2a')](_0x395dc3);}return null;};}function patchUpdates(_0x15107a){return function(_0x2eb4c2){try{jsonpatch[_0x8b45('0x30')](_0x2eb4c2,_0x15107a,!![]);}catch(_0x1a8974){return BPromise[_0x8b45('0x31')](_0x1a8974);}return _0x2eb4c2['save']();};}function saveUpdates(_0x3f5dd3,_0x3a5889){return function(_0x50302){if(_0x50302){return _0x50302[_0x8b45('0x32')](_0x3f5dd3)[_0x8b45('0x1d')](function(_0x502505){return _0x502505;});}return null;};}function removeEntity(_0x29fbec,_0x59f257){return function(_0x5a07de){if(_0x5a07de){return _0x5a07de[_0x8b45('0x33')]()[_0x8b45('0x1d')](function(){_0x29fbec[_0x8b45('0x28')](0xcc)[_0x8b45('0x29')]();});}};}function handleEntityNotFound(_0x1e72d2,_0x8fd345){return function(_0x522628){if(!_0x522628){_0x1e72d2[_0x8b45('0x34')](0x194);}return _0x522628;};}function handleError(_0x1d9c74,_0x264be7){_0x264be7=_0x264be7||0x1f4;return function(_0x1f66a3){logger['error'](_0x1f66a3[_0x8b45('0x35')]);if(_0x1f66a3[_0x8b45('0x36')]){delete _0x1f66a3[_0x8b45('0x36')];}_0x1d9c74['status'](_0x264be7)[_0x8b45('0x37')](_0x1f66a3);};}exports[_0x8b45('0x38')]=function(_0x1571b7,_0x58f32e){var _0x1adc4e={},_0x348a13={},_0x3452fb={'count':0x0,'rows':[]};var _0x4016b7=db['ChatInteraction'][_0x8b45('0x39')];_0x348a13[_0x8b45('0x3a')]=_[_0x8b45('0x3b')](_0x4016b7);var _0x15df7c={'dateStart':_0x1571b7[_0x8b45('0x3c')][_0x8b45('0x3d')],'dateEnd':_0x1571b7['query']['dateEnd']};delete _0x1571b7[_0x8b45('0x3c')][_0x8b45('0x3d')];delete _0x1571b7[_0x8b45('0x3c')][_0x8b45('0x3e')];_0x348a13[_0x8b45('0x3c')]=_['keys'](_0x1571b7[_0x8b45('0x3c')]);_0x348a13['filters']=_[_0x8b45('0x3f')](_0x348a13[_0x8b45('0x3a')],_0x348a13[_0x8b45('0x3c')]);_0x1adc4e[_0x8b45('0x40')]=_[_0x8b45('0x3f')](_0x348a13[_0x8b45('0x3a')],qs[_0x8b45('0x41')](_0x1571b7[_0x8b45('0x3c')][_0x8b45('0x41')]));_0x1adc4e[_0x8b45('0x40')]=_0x1adc4e[_0x8b45('0x40')]['length']?_0x1adc4e[_0x8b45('0x40')]:_0x348a13['model'];if(!_0x1571b7[_0x8b45('0x3c')]['hasOwnProperty'](_0x8b45('0x42'))){_0x1adc4e[_0x8b45('0x2d')]=qs[_0x8b45('0x2d')](_0x1571b7[_0x8b45('0x3c')][_0x8b45('0x2d')]);_0x1adc4e[_0x8b45('0x2c')]=qs['offset'](_0x1571b7[_0x8b45('0x3c')]['offset']);}_0x1adc4e['order']=qs[_0x8b45('0x43')](_0x1571b7[_0x8b45('0x3c')][_0x8b45('0x43')]);_0x1adc4e['where']=qs[_0x8b45('0x44')](_['pick'](_0x1571b7[_0x8b45('0x3c')],_0x348a13[_0x8b45('0x44')]));if(_0x15df7c[_0x8b45('0x3d')]){if(_0x15df7c[_0x8b45('0x3e')]){_0x15df7c[_0x8b45('0x3e')]=moment(_0x15df7c[_0x8b45('0x3e')])['add'](0x1,_0x8b45('0x45'));}else{_0x15df7c[_0x8b45('0x3e')]=moment(_0x15df7c[_0x8b45('0x3d')])[_0x8b45('0x46')](0x1,_0x8b45('0x45'));}_[_0x8b45('0x47')](_0x1adc4e[_0x8b45('0x48')],{'createdAt':{'$gte':_0x15df7c[_0x8b45('0x3d')],'$lte':_0x15df7c[_0x8b45('0x3e')]}});}if(_0x1571b7[_0x8b45('0x3c')][_0x8b45('0x49')]){_0x1adc4e[_0x8b45('0x48')]=_[_0x8b45('0x47')](_0x1adc4e[_0x8b45('0x48')],{'$or':_[_0x8b45('0x4a')](_0x1adc4e[_0x8b45('0x40')],function(_0x5e9499){var _0x5cc127={};_0x5cc127[_0x5e9499]={'$like':'%'+_0x1571b7['query'][_0x8b45('0x49')]+'%'};return _0x5cc127;})});}_0x1adc4e=_[_0x8b45('0x47')]({},_0x1adc4e,_0x1571b7[_0x8b45('0x4b')]);var _0x473530={'where':_0x1adc4e[_0x8b45('0x48')]};_0x473530[_0x8b45('0x4c')]=[];if(_0x1571b7[_0x8b45('0x3c')][_0x8b45('0x4d')]){_0x473530['include'][_0x8b45('0x4e')]({'model':db['Tag'],'as':_0x8b45('0x4f'),'attributes':['id'],'where':{'id':_0x1571b7[_0x8b45('0x3c')][_0x8b45('0x4d')]},'required':!![]});_0x473530[_0x8b45('0x50')]=!![];}if(_0x1571b7['query'][_0x8b45('0x51')]){_0x473530[_0x8b45('0x4c')]['push']({'model':db[_0x8b45('0x52')],'as':_0x8b45('0x53'),'attributes':['id','direction',_0x8b45('0x54'),_0x8b45('0x51')],'where':{'direction':'in','read':_0x1571b7[_0x8b45('0x3c')][_0x8b45('0x51')]||![]},'required':!![]});_0x473530[_0x8b45('0x50')]=!![];}return db[_0x8b45('0x55')]['count'](_0x473530)['then'](function(_0x3f7a16){_0x3452fb[_0x8b45('0x2b')]=_0x3f7a16;if(_0x1571b7[_0x8b45('0x3c')]['includeAll']){_0x1adc4e[_0x8b45('0x4c')]=[{'model':db[_0x8b45('0x56')],'as':_0x8b45('0x57'),'required':![],'attributes':['id',_0x8b45('0x36'),_0x8b45('0x58')]},{'model':db['CmContact'],'as':_0x8b45('0x59'),'required':![]},{'model':db[_0x8b45('0x56')],'as':'Owner','attributes':[_0x8b45('0x36'),'fullname',_0x8b45('0x5a')],'required':![]},{'model':db[_0x8b45('0x5b')],'as':_0x8b45('0x5c'),'attributes':[_0x8b45('0x36'),'key'],'required':![]},{'model':db[_0x8b45('0x52')],'as':_0x8b45('0x53'),'attributes':['id',_0x8b45('0x5d'),_0x8b45('0x54'),_0x8b45('0x51')],'where':{'direction':'in','read':_0x1571b7[_0x8b45('0x3c')][_0x8b45('0x51')]||![]},'required':_0x1571b7[_0x8b45('0x3c')][_0x8b45('0x51')]||![]},{'model':db[_0x8b45('0x5e')],'as':_0x8b45('0x4f'),'attributes':['id',_0x8b45('0x36'),_0x8b45('0x5f')],'required':_0x1571b7[_0x8b45('0x3c')][_0x8b45('0x4d')]?!![]:![]},{'model':db['Tag'],'as':_0x8b45('0x60'),'attributes':['id',_0x8b45('0x36'),_0x8b45('0x5f')],'through':_0x1571b7['query'][_0x8b45('0x4d')]?{'attributes':[],'where':{'TagId':_0x1571b7[_0x8b45('0x3c')][_0x8b45('0x4d')]||undefined}}:{},'required':_0x1571b7[_0x8b45('0x3c')]['tag']?!![]:![]}];}return db[_0x8b45('0x55')][_0x8b45('0x61')](_0x1adc4e);})[_0x8b45('0x1d')](function(_0xbb5e67){_0x3452fb['rows']=_0xbb5e67;return _0x3452fb;})[_0x8b45('0x1d')](respondWithFilteredResult(_0x58f32e,_0x1adc4e))[_0x8b45('0x27')](handleError(_0x58f32e,null));};exports[_0x8b45('0x62')]=function(_0x27503f,_0x3488d1){var _0x557473={'raw':![],'where':{'id':_0x27503f['params']['id']}},_0x7d0053={};_0x7d0053[_0x8b45('0x3a')]=_[_0x8b45('0x3b')](db[_0x8b45('0x55')][_0x8b45('0x39')]);_0x7d0053[_0x8b45('0x3c')]=_[_0x8b45('0x3b')](_0x27503f['query']);_0x7d0053['filters']=_[_0x8b45('0x3f')](_0x7d0053[_0x8b45('0x3a')],_0x7d0053['query']);_0x557473[_0x8b45('0x40')]=_[_0x8b45('0x3f')](_0x7d0053[_0x8b45('0x3a')],qs['fields'](_0x27503f['query'][_0x8b45('0x41')]));_0x557473[_0x8b45('0x40')]=_0x557473['attributes'][_0x8b45('0x63')]?_0x557473['attributes']:_0x7d0053[_0x8b45('0x3a')];if(_0x27503f['query']['includeAll']){_0x557473[_0x8b45('0x4c')]=[{'all':!![]}];}_0x557473=_[_0x8b45('0x47')]({},_0x557473,_0x27503f['options']);return db[_0x8b45('0x55')][_0x8b45('0x64')](_0x557473)[_0x8b45('0x1d')](handleEntityNotFound(_0x3488d1,null))[_0x8b45('0x1d')](respondWithResult(_0x3488d1,null))[_0x8b45('0x27')](handleError(_0x3488d1,null));};exports['create']=function(_0x37f580,_0x3b3d21){return db[_0x8b45('0x55')]['create'](_0x37f580['body'],{})[_0x8b45('0x1d')](respondWithResult(_0x3b3d21,0xc9))['catch'](handleError(_0x3b3d21,null));};exports[_0x8b45('0x32')]=function(_0x5a4834,_0x566637){if(_0x5a4834['body']['id']){delete _0x5a4834[_0x8b45('0x65')]['id'];}return db['ChatInteraction'][_0x8b45('0x64')]({'where':{'id':_0x5a4834[_0x8b45('0x66')]['id']}})['then'](handleEntityNotFound(_0x566637,null))[_0x8b45('0x1d')](saveUpdates(_0x5a4834[_0x8b45('0x65')],null))['then'](respondWithResult(_0x566637,null))[_0x8b45('0x27')](handleError(_0x566637,null));};exports[_0x8b45('0x33')]=function(_0x4367bb,_0x1acfd7){return db[_0x8b45('0x55')][_0x8b45('0x64')]({'where':{'id':_0x4367bb[_0x8b45('0x66')]['id']}})[_0x8b45('0x1d')](handleEntityNotFound(_0x1acfd7,null))[_0x8b45('0x1d')](removeEntity(_0x1acfd7,null))[_0x8b45('0x27')](handleError(_0x1acfd7,null));};exports[_0x8b45('0x67')]=function(_0x4232f1,_0x4a11ac){return db[_0x8b45('0x55')][_0x8b45('0x67')]()[_0x8b45('0x1d')](respondWithResult(_0x4a11ac,null))[_0x8b45('0x27')](handleError(_0x4a11ac,null));};exports[_0x8b45('0x68')]=function(_0x304e7d,_0x2f3e49){if(_0x304e7d[_0x8b45('0x65')]['id']){delete _0x304e7d[_0x8b45('0x65')]['id'];}return db[_0x8b45('0x55')][_0x8b45('0x64')]({'where':{'id':_0x304e7d[_0x8b45('0x66')]['id']}})[_0x8b45('0x1d')](handleEntityNotFound(_0x2f3e49,null))[_0x8b45('0x1d')](saveUpdates(_0x304e7d[_0x8b45('0x65')],null))['then'](respondWithResult(_0x2f3e49,null))[_0x8b45('0x27')](handleError(_0x2f3e49,null));};exports[_0x8b45('0x69')]=function(_0x1182fa,_0x1eb853,_0x3f662a){if(_0x1182fa[_0x8b45('0x65')]['id']){delete _0x1182fa[_0x8b45('0x65')]['id'];}return db[_0x8b45('0x55')]['find']({'where':{'id':_0x1182fa[_0x8b45('0x66')]['id']}})[_0x8b45('0x1d')](function(_0x1a3cfa){if(!_0x1a3cfa){logger[_0x8b45('0x24')](_0x8b45('0x6a'),_0x8b45('0x69'),0x194,_0x8b45('0x6b'));_0x1eb853[_0x8b45('0x34')](0x194);}else{if(_0x1a3cfa[_0x8b45('0x6c')]){throw new db[(_0x8b45('0x6d'))][(_0x8b45('0x6e'))]('Interaction\x20already\x20assigned');}}return _0x1a3cfa;})['then'](function(_0x3318a2){if(_0x3318a2){return _0x3318a2[_0x8b45('0x32')]({'closed':_0x1182fa[_0x8b45('0x65')][_0x8b45('0x6f')],'closedAt':_0x1182fa[_0x8b45('0x65')][_0x8b45('0x70')],'disposition':_0x1182fa[_0x8b45('0x65')][_0x8b45('0x71')]})[_0x8b45('0x1d')](function(_0x4b3fb3){return _0x4b3fb3;});}})['then'](function(_0x135e1f){return respondWithRpcPromise(_0x8b45('0x72'),_0x8b45('0x69'),_0x1182fa[_0x8b45('0x65')],client9004);})['then'](respondWithResult(_0x1eb853,null))[_0x8b45('0x27')](handleError(_0x1eb853,null));};exports[_0x8b45('0x73')]=function(_0x1939aa,_0xded1e,_0x1761d1){_0x1939aa[_0x8b45('0x65')]['name']=_0x1939aa['file'][_0x8b45('0x74')];_0x1939aa['body']['basename']=_0x1939aa['file'][_0x8b45('0x75')];_0x1939aa[_0x8b45('0x65')][_0x8b45('0x76')]=_0x1939aa[_0x8b45('0x77')][_0x8b45('0x78')];return db[_0x8b45('0x79')][_0x8b45('0x7a')](_0x1939aa[_0x8b45('0x65')])[_0x8b45('0x1d')](respondWithResult(_0xded1e,0xc9))[_0x8b45('0x27')](handleError(_0xded1e,null));};exports[_0x8b45('0x7b')]=function(_0x33b689,_0x324d93,_0x4769c2){return db[_0x8b45('0x55')]['findOne']({'where':{'id':_0x33b689[_0x8b45('0x66')]['id']},'raw':!![]})[_0x8b45('0x1d')](handleEntityNotFound(_0x324d93,null))[_0x8b45('0x1d')](function(_0x19a135){if(_0x19a135){if(_0x19a135[_0x8b45('0x6f')]){return _0x324d93[_0x8b45('0x28')](0x193)[_0x8b45('0x2a')]({'status':0x193,'message':_0x8b45('0x7c')});}return db[_0x8b45('0x79')][_0x8b45('0x7d')]({'where':{'id':_0x33b689['query'][_0x8b45('0x7e')]},'raw':!![]})[_0x8b45('0x1d')](handleEntityNotFound(_0x324d93,null));}})[_0x8b45('0x1d')](function(_0x3bb913){if(_0x3bb913){return _0x324d93['download'](path[_0x8b45('0x7f')](config['root'],_0x8b45('0x80'),_0x3bb913['basename']));}})[_0x8b45('0x27')](handleError(_0x324d93,null));};exports[_0x8b45('0x81')]=function(_0xdac6aa,_0x3e4437){var _0x16bb83=null;var _0x45beb9=null;var _0x51d6c4=null;var _0x3e0054=null;if(_0xdac6aa[_0x8b45('0x65')]['id']){delete _0xdac6aa[_0x8b45('0x65')]['id'];}if(_0xdac6aa[_0x8b45('0x65')]['mailTranscript']){_0x3e0054=path[_0x8b45('0x7f')](config[_0x8b45('0x82')],'server/files/chat/upload/',util['format'](_0x8b45('0x83'),Date[_0x8b45('0x84')]()));_0xdac6aa[_0x8b45('0x65')]['pathTranscript']=_0x3e0054;}return db[_0x8b45('0x55')]['find']({'where':{'id':_0xdac6aa[_0x8b45('0x66')]['id']},'include':[{'model':db[_0x8b45('0x52')],'as':'Messages','include':[{'model':db['User'],'as':_0x8b45('0x56')}]}]})[_0x8b45('0x1d')](handleEntityNotFound(_0x3e4437,null))[_0x8b45('0x1d')](saveUpdates(_0xdac6aa[_0x8b45('0x65')],null))['then'](function(_0x11d053){if(_0x11d053){_0x16bb83=_0x11d053;return db[_0x8b45('0x5b')][_0x8b45('0x64')]({'where':{'id':_0x16bb83[_0x8b45('0x85')]}});}})[_0x8b45('0x1d')](function(_0x1abe69){if(_0x1abe69){_0x51d6c4=_0x1abe69;return db['CmContact'][_0x8b45('0x64')]({'where':{'id':_0x16bb83[_0x8b45('0x86')]}});}})['then'](function(_0x10a91a){if(_0x10a91a){_0x45beb9=_0x10a91a;if(_0x3e0054){var _0x395997=null;for(var _0x569f98=0x1;_0x569f98<_0x16bb83['Messages']['length'];++_0x569f98){_0x395997=_0x16bb83[_0x8b45('0x53')][_0x569f98];var _0x31ab30=_0x395997[_0x8b45('0x6c')]?util[_0x8b45('0x87')](_0x8b45('0x88'),_0x51d6c4[_0x8b45('0x89')],_0x395997[_0x8b45('0x6c')]):'System';var _0x292d83=_0xdac6aa[_0x8b45('0x65')][_0x8b45('0x8a')]||util[_0x8b45('0x87')](_0x8b45('0x88'),_0x8b45('0x8b'),_0x395997['ContactId']);switch(_0x51d6c4[_0x8b45('0x8c')]){case _0x8b45('0x8d'):_0x31ab30=_0x395997[_0x8b45('0x6c')]?util[_0x8b45('0x87')](_0x8b45('0x88'),_0x51d6c4['agentAlias'],_0x395997['UserId']):_0x8b45('0x8e');break;case _0x8b45('0x8f'):_0x31ab30=_0x395997[_0x8b45('0x6c')]?_0x395997[_0x8b45('0x56')][_0x8b45('0x90')]||_0x395997['User'][_0x8b45('0x58')]:'System';break;case _0x8b45('0x91'):_0x31ab30=_0x395997['UserId']?_0x395997[_0x8b45('0x56')][_0x8b45('0x58')]:_0x8b45('0x8e');break;default:_0x31ab30=_0x395997[_0x8b45('0x6c')]?util[_0x8b45('0x87')](_0x8b45('0x88'),_0x51d6c4[_0x8b45('0x89')],_0x395997[_0x8b45('0x6c')]):_0x8b45('0x8e');}var _0xfff1e=util[_0x8b45('0x87')](_0x8b45('0x92'),moment(_0x395997[_0x8b45('0x54')])[_0x8b45('0x87')]('MM/DD/YYYY\x20HH:mm:ss'),_0x395997[_0x8b45('0x5d')]==='in'?_0x292d83:_0x31ab30,_0x395997[_0x8b45('0x65')]);if(!_0x395997[_0x8b45('0x93')]){fs['appendFileSync'](_0x3e0054,_0xfff1e);}}return db[_0x8b45('0x94')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x8b45('0x95')],'as':_0x8b45('0x96'),'raw':!![]}]});}}})['then'](function(_0x300fbc){if(_0x300fbc&&_0x300fbc['Smtp']&&_0xdac6aa[_0x8b45('0x65')]){var _0x152524={'tls':{'rejectUnauthorized':![]}};if(_0x300fbc[_0x8b45('0x96')][_0x8b45('0x97')]){_0x152524[_0x8b45('0x97')]=_0x300fbc[_0x8b45('0x96')]['service'];}else{_0x152524['host']=_0x300fbc[_0x8b45('0x96')][_0x8b45('0x98')];_0x152524['port']=_0x300fbc['Smtp']['port'];_0x152524[_0x8b45('0x99')]=_0x300fbc['Smtp'][_0x8b45('0x99')];}if(_0x300fbc[_0x8b45('0x96')][_0x8b45('0x9a')]){_0x152524[_0x8b45('0x9b')]={'user':_0x300fbc['Smtp'][_0x8b45('0x9c')],'pass':_0x300fbc[_0x8b45('0x96')][_0x8b45('0x9d')]};}return respondWithRpcPromise(_0x8b45('0x9e'),_0x8b45('0x9f'),{'account':_0x152524,'message':{'from':util[_0x8b45('0x87')](_0x8b45('0xa0'),_0x300fbc[_0x8b45('0x36')],_0x300fbc['email']||_0x300fbc[_0x8b45('0x96')]['user']),'to':_0xdac6aa[_0x8b45('0x65')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util['format'](_0x8b45('0xa1'),_0xdac6aa[_0x8b45('0x65')]['mailTranscript']),'attachments':[{'path':_0x3e0054}]}})[_0x8b45('0x1d')](function(){return _0x16bb83;})[_0x8b45('0x27')](function(_0x36332e){console[_0x8b45('0x24')](_0x36332e);});}else{return _0x16bb83;}})[_0x8b45('0x1d')](respondWithStatusCode(_0x3e4437,0xc8))[_0x8b45('0x27')](handleError(_0x3e4437,null));};exports[_0x8b45('0xa2')]=function(_0x113bea,_0x124469,_0x51121e){return db[_0x8b45('0x52')][_0x8b45('0x64')]({'where':{'id':_0x113bea[_0x8b45('0x66')]['id']}})[_0x8b45('0x1d')](handleEntityNotFound(_0x124469,null))['then'](function(_0x3cd8c5){if(_0x3cd8c5){return _0x3cd8c5[_0x8b45('0xa2')](_0x113bea[_0x8b45('0x65')][_0x8b45('0xa3')],_[_0x8b45('0xa4')](_0x113bea['body'],[_0x8b45('0xa3'),'id'])||{});}})['then'](respondWithResult(_0x124469,null))[_0x8b45('0x27')](handleError(_0x124469,null));};exports[_0x8b45('0xa5')]=function(_0x5c5f2f,_0x574d49,_0x4c13c3){var _0x5efb66={'raw':![],'where':{}};var _0x399401={};var _0x5006a6={'count':0x0,'rows':[]};return db[_0x8b45('0x55')][_0x8b45('0x7d')]({'where':{'id':_0x5c5f2f[_0x8b45('0x66')]['id']}})['then'](handleEntityNotFound(_0x574d49,null))[_0x8b45('0x1d')](function(_0x5f3acf){if(_0x5f3acf){_0x399401[_0x8b45('0x3a')]=_[_0x8b45('0x3b')](db[_0x8b45('0x52')][_0x8b45('0x39')]);_0x399401[_0x8b45('0x3c')]=_[_0x8b45('0x3b')](_0x5c5f2f[_0x8b45('0x3c')]);_0x399401[_0x8b45('0x44')]=_[_0x8b45('0x3f')](_0x399401[_0x8b45('0x3a')],_0x399401[_0x8b45('0x3c')]);_0x5efb66[_0x8b45('0x40')]=_[_0x8b45('0x3f')](_0x399401[_0x8b45('0x3a')],qs[_0x8b45('0x41')](_0x5c5f2f['query'][_0x8b45('0x41')]));_0x5efb66[_0x8b45('0x40')]=_0x5efb66['attributes']['length']?_0x5efb66[_0x8b45('0x40')]:_0x399401[_0x8b45('0x3a')];if(!_0x5c5f2f[_0x8b45('0x3c')][_0x8b45('0xa6')](_0x8b45('0x42'))){_0x5efb66[_0x8b45('0x2d')]=qs[_0x8b45('0x2d')](_0x5c5f2f[_0x8b45('0x3c')][_0x8b45('0x2d')]);_0x5efb66['offset']=qs[_0x8b45('0x2c')](_0x5c5f2f[_0x8b45('0x3c')]['offset']);}_0x5efb66[_0x8b45('0xa7')]=qs[_0x8b45('0x43')](_0x5c5f2f[_0x8b45('0x3c')][_0x8b45('0x43')]);_0x5efb66[_0x8b45('0x48')]=qs[_0x8b45('0x44')](_[_0x8b45('0xa8')](_0x5c5f2f[_0x8b45('0x3c')],_0x399401[_0x8b45('0x44')]));_0x5efb66[_0x8b45('0x48')][_0x8b45('0xa9')]=_0x5f3acf['id'];if(_0x5c5f2f[_0x8b45('0x3c')][_0x8b45('0x49')]){_0x5efb66['where']=_[_0x8b45('0x47')](_0x5efb66['where'],{'$or':_[_0x8b45('0x4a')](_0x5efb66[_0x8b45('0x40')],function(_0xbdb695){var _0x5c6620={};_0x5c6620[_0xbdb695]={'$like':'%'+_0x5c5f2f[_0x8b45('0x3c')][_0x8b45('0x49')]+'%'};return _0x5c6620;})});}if(_0x5c5f2f[_0x8b45('0x3c')][_0x8b45('0xaa')]){var _0x39b164=_0x5c5f2f[_0x8b45('0x3c')]['$gte'][_0x8b45('0xab')](',');var _0x92617c={};_0x92617c[_0x39b164[0x0]]={'$gte':moment(_0x39b164[0x1])[_0x8b45('0x87')](_0x8b45('0xac'))};_0x5efb66['where']=_[_0x8b45('0x47')](_0x5efb66[_0x8b45('0x48')],_0x92617c);}_0x5efb66=_[_0x8b45('0x47')]({},_0x5efb66,_0x5c5f2f[_0x8b45('0x4b')]);return db['ChatMessage'][_0x8b45('0x2b')]({'where':_0x5efb66[_0x8b45('0x48')]})[_0x8b45('0x1d')](function(_0x4d5539){_0x5006a6[_0x8b45('0x2b')]=_0x4d5539;if(_0x5c5f2f[_0x8b45('0x3c')][_0x8b45('0xad')]){_0x5efb66[_0x8b45('0x4c')]=[{'all':!![]}];}return db[_0x8b45('0x52')][_0x8b45('0x61')](_0x5efb66);})['then'](function(_0x3e1263){_0x5006a6[_0x8b45('0xae')]=_0x3e1263;return _0x5006a6;});}})['then'](respondWithFilteredResult(_0x574d49,_0x5efb66))[_0x8b45('0x27')](handleError(_0x574d49,null));};exports[_0x8b45('0xaf')]=function(_0x501148,_0x454eca,_0x248081){var _0x12fe1e={'where':{}},_0x2d60e9={},_0x1d5e77={'count':0x0,'rows':[]};return db[_0x8b45('0x55')][_0x8b45('0x7d')]({'where':{'id':_0x501148[_0x8b45('0x66')]['id']}})['then'](handleEntityNotFound(_0x454eca,null))[_0x8b45('0x1d')](function(_0x526b8b){if(_0x526b8b){_0x2d60e9[_0x8b45('0x3a')]=_[_0x8b45('0x3b')](db[_0x8b45('0x52')]['rawAttributes']);_0x2d60e9[_0x8b45('0x3c')]=_[_0x8b45('0x3b')](_0x501148['query']);_0x2d60e9[_0x8b45('0x44')]=_[_0x8b45('0x3f')](_0x2d60e9[_0x8b45('0x3a')],_0x2d60e9[_0x8b45('0x3c')]);_0x12fe1e[_0x8b45('0x40')]=_[_0x8b45('0x3f')](_0x2d60e9[_0x8b45('0x3a')],qs[_0x8b45('0x41')](_0x501148[_0x8b45('0x3c')]['fields']));_0x12fe1e[_0x8b45('0x40')]=_0x12fe1e[_0x8b45('0x40')][_0x8b45('0x63')]?_0x12fe1e['attributes']:_0x2d60e9[_0x8b45('0x3a')];if(!_0x501148['query'][_0x8b45('0xa6')]('nolimit')){_0x12fe1e['limit']=qs[_0x8b45('0x2d')](_0x501148[_0x8b45('0x3c')][_0x8b45('0x2d')]);_0x12fe1e['offset']=qs[_0x8b45('0x2c')](_0x501148[_0x8b45('0x3c')][_0x8b45('0x2c')]);}_0x12fe1e[_0x8b45('0xa7')]=qs[_0x8b45('0x43')](_0x501148[_0x8b45('0x3c')][_0x8b45('0x43')]);_0x12fe1e[_0x8b45('0x48')]=qs['filters'](_[_0x8b45('0xa8')](_0x501148[_0x8b45('0x3c')],_0x2d60e9[_0x8b45('0x44')]));_0x12fe1e[_0x8b45('0x48')][_0x8b45('0xa9')]=_0x526b8b['id'];if(_0x501148[_0x8b45('0x3c')]['filter']){_0x12fe1e['where']=_[_0x8b45('0x47')](_0x12fe1e['where'],{'$or':_['map'](_0x12fe1e[_0x8b45('0x40')],function(_0x230b36){var _0x2d51cc={};_0x2d51cc[_0x230b36]={'$like':'%'+_0x501148[_0x8b45('0x3c')][_0x8b45('0x49')]+'%'};return _0x2d51cc;})});}_0x12fe1e['where'][_0x8b45('0x93')]=![];if(_0x501148[_0x8b45('0x3c')]['id']){_0x12fe1e['where']['id']={'$gt':_0x501148['query']['id']};}_0x12fe1e=_[_0x8b45('0x47')]({},_0x12fe1e,_0x501148[_0x8b45('0x4b')]);return db[_0x8b45('0x52')][_0x8b45('0x2b')]({'where':_0x12fe1e[_0x8b45('0x48')]})[_0x8b45('0x1d')](function(_0x1ce69d){_0x1d5e77[_0x8b45('0x2b')]=_0x1ce69d;_0x12fe1e[_0x8b45('0x4c')]=[];if(_0x501148[_0x8b45('0x3c')][_0x8b45('0xb0')]){_0x12fe1e[_0x8b45('0x4c')]['push']({'model':db[_0x8b45('0x56')],'as':_0x8b45('0x56'),'attributes':['id',_0x8b45('0x58'),'alias']});}if(_0x501148[_0x8b45('0x3c')]['includeAll']){_0x12fe1e[_0x8b45('0x4c')]=[{'all':!![]}];}return db[_0x8b45('0x52')][_0x8b45('0x61')](_0x12fe1e);})[_0x8b45('0x1d')](function(_0x28d0de){_0x1d5e77[_0x8b45('0xae')]=_0x28d0de;return _0x1d5e77;});}})[_0x8b45('0x1d')](respondWithFilteredResult(_0x454eca,_0x12fe1e))[_0x8b45('0x27')](handleError(_0x454eca,null));};exports[_0x8b45('0xb1')]=function(_0x22eac9,_0x543f81,_0x40cb9d){return db[_0x8b45('0x55')]['find']({'where':{'id':_0x22eac9[_0x8b45('0x66')]['id']}})[_0x8b45('0x1d')](handleEntityNotFound(_0x543f81,null))[_0x8b45('0x1d')](function(_0x461169){if(_0x461169){return _0x461169[_0x8b45('0xb2')](_0x22eac9[_0x8b45('0x65')][_0x8b45('0xa3')],_['omit'](_0x22eac9[_0x8b45('0x65')],['ids','id'])||{})[_0x8b45('0xb3')](function(){return db[_0x8b45('0x5e')]['findAll']({'attributes':['id',_0x8b45('0x36'),_0x8b45('0x5f')],'where':{'id':_0x22eac9[_0x8b45('0x65')][_0x8b45('0xa3')]}});})[_0x8b45('0x1d')](function(_0x4f6c74){socket[_0x8b45('0xb4')]('chatInteractionTags:save',{'id':Number(_0x22eac9[_0x8b45('0x66')]['id']),'tags':_0x4f6c74||[]});return{'id':Number(_0x22eac9[_0x8b45('0x66')]['id']),'tags':_0x4f6c74||[]};});}})['then'](respondWithResult(_0x543f81,null))['catch'](handleError(_0x543f81,null));};exports[_0x8b45('0xb5')]=function(_0x57f4d4,_0x1f8c01,_0x5a0e0f){var _0x33194f;return db[_0x8b45('0x55')][_0x8b45('0x64')]({'where':{'id':_0x57f4d4[_0x8b45('0x66')]['id']}})[_0x8b45('0x1d')](handleEntityNotFound(_0x1f8c01,null))[_0x8b45('0x1d')](function(_0x2458eb){if(_0x2458eb){return _0x2458eb[_0x8b45('0xb5')](_0x57f4d4[_0x8b45('0x3c')][_0x8b45('0xa3')]);}})[_0x8b45('0x1d')](respondWithStatusCode(_0x1f8c01,null))[_0x8b45('0x27')](handleError(_0x1f8c01,null));};exports[_0x8b45('0xb6')]=function(_0x556900,_0x583fa0){var _0x3d43c9=moment()[_0x8b45('0xb7')]()['toString']();var _0x21fa3a=path[_0x8b45('0x7f')](config[_0x8b45('0x82')],_0x8b45('0xb8'),_0x8b45('0xb9'),_0x8b45('0xba'));var _0x4ede39=path[_0x8b45('0x7f')](config['root'],'server',_0x8b45('0xb9'),'attachments');var _0x24e354=path[_0x8b45('0x7f')](_0x21fa3a,_0x3d43c9);var _0x21ca34=util[_0x8b45('0x87')](_0x8b45('0xbb'),_0x3d43c9);var _0x71c642=path[_0x8b45('0x7f')](_0x21fa3a,_0x21ca34);var _0x17a940=![];return db[_0x8b45('0x55')][_0x8b45('0x64')]({'where':{'id':_0x556900[_0x8b45('0x66')]['id']},'include':[{'model':db[_0x8b45('0x52')],'as':_0x8b45('0x53'),'attributes':['id','body'],'include':[{'model':db[_0x8b45('0x56')],'as':_0x8b45('0x56'),'attributes':['id',_0x8b45('0x58')],'raw':!![]},{'model':db[_0x8b45('0xbc')],'as':_0x8b45('0x59'),'attributes':['id','firstName'],'raw':!![]},{'model':db[_0x8b45('0x79')],'as':_0x8b45('0x79'),'raw':!![]}]}]})[_0x8b45('0x1d')](handleEntityNotFound(_0x583fa0,null))[_0x8b45('0x1d')](function(_0x2e9237){if(_0x2e9237){_0x17a940=!![];var _0x3b117e='';var _0x2b0ef6={'format':_0x8b45('0xbd'),'border':_0x8b45('0xbe')};fs[_0x8b45('0xbf')](_0x24e354);_0x3b117e+=util[_0x8b45('0x87')](_0x8b45('0xc0'),_0x2e9237['id']);_0x3b117e+=util[_0x8b45('0x87')](_0x8b45('0xc1'),moment()[_0x8b45('0x87')](_0x8b45('0xc2'))[_0x8b45('0xc3')]());_0x3b117e+=_0x8b45('0xc4');for(var _0x18cf70=0x1;_0x18cf70<_0x2e9237[_0x8b45('0x53')][_0x8b45('0x63')];_0x18cf70++){var _0x50f31e=_0x2e9237[_0x8b45('0x53')][_0x18cf70];_0x3b117e+=_0x8b45('0xc5');_0x3b117e+=util['format'](_0x8b45('0xc6'),_0x50f31e[_0x8b45('0x56')]?_0x50f31e[_0x8b45('0x56')][_0x8b45('0x58')]:_0x50f31e[_0x8b45('0x59')]['firstName'],_0x50f31e[_0x8b45('0x65')]);_0x3b117e+=_0x8b45('0xc7');if(_0x50f31e[_0x8b45('0x79')]){var _0x184c0e=_0x50f31e[_0x8b45('0x79')];var _0x9afa67=path['join'](_0x4ede39,_0x184c0e['basename']);if(fs[_0x8b45('0xc8')](_0x9afa67)){fs[_0x8b45('0xc9')](_0x9afa67)[_0x8b45('0xca')](fs['createWriteStream'](path[_0x8b45('0x7f')](_0x24e354,_0x184c0e[_0x8b45('0xcb')])));}}}return new BPromise(function(_0x4e81a8,_0x3cb11b){pdf['create'](_0x3b117e,_0x2b0ef6)[_0x8b45('0xcc')](path[_0x8b45('0x7f')](_0x24e354,_0x8b45('0xcd')+_0x3d43c9+_0x8b45('0xce')),function(_0x5bf7cf,_0x7ea3d6){if(_0x5bf7cf)return _0x3cb11b(_0x5bf7cf);_0x4e81a8(_0x7ea3d6);});});}})[_0x8b45('0x1d')](function(){if(_0x17a940){return new BPromise(function(_0x38acf5,_0x443cf7){zipdir(_0x24e354,{'saveTo':_0x71c642},function(_0x5fa362,_0xe8acbe){if(_0x5fa362)return _0x443cf7(_0x5fa362);return _0x38acf5(_0xe8acbe);});});}})[_0x8b45('0x1d')](function(){if(_0x17a940){return new BPromise(function(_0x453e11,_0x25d9d5){rimraf(_0x24e354,function(_0x4eafeb){if(_0x4eafeb)_0x25d9d5(_0x4eafeb);return _0x453e11();});});}})[_0x8b45('0x1d')](function(){if(_0x17a940){return _0x583fa0['download'](_0x71c642,_0x21ca34,function(_0x278b11){if(_0x278b11){console[_0x8b45('0xcf')](_0x8b45('0xd0'),_0x278b11);}else{fs[_0x8b45('0xd1')](_0x71c642);}});}else{return _0x583fa0[_0x8b45('0x34')](0xc8);}})[_0x8b45('0x27')](handleError(_0x583fa0,null));}; \ No newline at end of file +var _0x9649=['YYYY-MM-DD\x20HH:mm:ss','nolimit','secret','includeAgent','addTags','setTags','chatInteractionTags:save','removeTags','unix','toString','files','server','attachments','interaction-%s.zip','firstName','1cm','mkdirSync','

Chat\x20Interaction:\x20#%d

','
','%s:\x20%s

','','existsSync','createReadStream','toFile','interaction-','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','jayson/promise','http','client','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','destroy','then','stack','name','ChatInteraction','rawAttributes','model','keys','query','dateStart','dateEnd','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','add','day','merge','include','tag','Tag','Tags','distinct','read','push','Messages','direction','createdAt','User','Users','fullname','CmContact','Contact','Owner','internal','ChatWebsite','ChatMessage','color','findAll','rows','show','params','includeAll','options','create','body','find','describe','customUpdate','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','UserId','Sequelize','Interaction\x20already\x20assigned','closed','closedAt','disposition','AbandonInteraction','attachmentUpload','file','basename','filename','Attachment','attachmentDownload','findOne','Unauthorized','download','join','root','server/files/attachments/','close','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','ChatWebsiteId','%s%d','agentAlias','System','customer','Visitor','ContactId','agentIdentifier','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','MailServerOut','Smtp','service','host','port','secure','authentication','auth','user','pass','sendMail','\x22%s\x22\x20<%s>','email','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','ChatInteractionId','filter','map','$gte','split'];(function(_0x5d2968,_0x3b9b1d){var _0x406078=function(_0x58465e){while(--_0x58465e){_0x5d2968['push'](_0x5d2968['shift']());}};_0x406078(++_0x3b9b1d);}(_0x9649,0x19f));var _0x9964=function(_0x33210b,_0x1d1f89){_0x33210b=_0x33210b-0x0;var _0x2714e3=_0x9649[_0x33210b];return _0x2714e3;};'use strict';var pdf=require(_0x9964('0x0'));var emlformat=require(_0x9964('0x1'));var rimraf=require(_0x9964('0x2'));var zipdir=require(_0x9964('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9964('0x4'));var moment=require(_0x9964('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9964('0x6'));var util=require('util');var path=require(_0x9964('0x7'));var sox=require(_0x9964('0x8'));var csv=require(_0x9964('0x9'));var ejs=require(_0x9964('0xa'));var fs=require('fs');var _=require(_0x9964('0xb'));var squel=require(_0x9964('0xc'));var crypto=require(_0x9964('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9964('0xe'));var toCsv=require(_0x9964('0x9'));var querystring=require('querystring');var Papa=require(_0x9964('0xf'));var Redis=require(_0x9964('0x10'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x9964('0x11'));var utils=require(_0x9964('0x12'));var config=require(_0x9964('0x13'));var db=require(_0x9964('0x14'))['db'];config[_0x9964('0x15')]=_['defaults'](config[_0x9964('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x9964('0x16'))(new Redis(config[_0x9964('0x15')]));require('./chatInteraction.socket')[_0x9964('0x17')](socket);var jayson=require(_0x9964('0x18'));var client=jayson['client'][_0x9964('0x19')]({'port':0x232b});var client9004=jayson[_0x9964('0x1a')][_0x9964('0x19')]({'port':0x232c});function respondWithRpcPromise(_0x46688a,_0x3b0386,_0x5f002e,_0x411544){return new BPromise(function(_0x226e78,_0x57b330){var _0x2fd50d=_0x411544||client;return _0x2fd50d[_0x9964('0x1b')](_0x46688a,_0x5f002e)['then'](function(_0x40178){logger[_0x9964('0x1c')](_0x9964('0x1d'),_0x3b0386,_0x9964('0x1e'));logger['debug'](_0x9964('0x1f'),_0x3b0386,_0x9964('0x1e'),JSON['stringify'](_0x40178));if(_0x40178[_0x9964('0x20')]){if(_0x40178[_0x9964('0x20')][_0x9964('0x21')]===0x1f4){logger[_0x9964('0x20')](_0x9964('0x1d'),_0x3b0386,_0x40178[_0x9964('0x20')][_0x9964('0x22')]);return _0x57b330(_0x40178[_0x9964('0x20')][_0x9964('0x22')]);}logger[_0x9964('0x20')]('ChatInteraction,\x20%s,\x20%s',_0x3b0386,_0x40178[_0x9964('0x20')][_0x9964('0x22')]);return _0x226e78(_0x40178['error'][_0x9964('0x22')]);}else{logger['info'](_0x9964('0x1d'),_0x3b0386,_0x9964('0x1e'));_0x226e78(_0x40178[_0x9964('0x23')][_0x9964('0x22')]);}})[_0x9964('0x24')](function(_0x62eda6){logger['error'](_0x9964('0x1d'),_0x3b0386,_0x62eda6);_0x57b330(_0x62eda6);});});}function respondWithStatusCode(_0x378e34,_0x5961e9){_0x5961e9=_0x5961e9||0xcc;return function(_0x1b05a8){if(_0x1b05a8){return _0x378e34[_0x9964('0x25')](_0x5961e9);}return _0x378e34[_0x9964('0x26')](_0x5961e9)[_0x9964('0x27')]();};}function respondWithResult(_0x26cd95,_0x5a5793){_0x5a5793=_0x5a5793||0xc8;return function(_0x13df3d){if(_0x13df3d){return _0x26cd95['status'](_0x5a5793)[_0x9964('0x28')](_0x13df3d);}};}function respondWithFilteredResult(_0x512f6b,_0x17b29f){return function(_0x5dc789){if(_0x5dc789){var _0x432f81=_0x5dc789[_0x9964('0x29')],_0x162b83=_0x17b29f[_0x9964('0x2a')],_0x46c104=_0x17b29f[_0x9964('0x2a')]+_0x17b29f[_0x9964('0x2b')],_0x44a38f;if(_0x46c104>=_0x432f81){_0x46c104=_0x432f81;_0x44a38f=0xc8;}else{_0x44a38f=0xce;}_0x512f6b[_0x9964('0x26')](_0x44a38f);return _0x512f6b['set']('Content-Range',_0x162b83+'-'+_0x46c104+'/'+_0x432f81)['json'](_0x5dc789);}return null;};}function patchUpdates(_0x483092){return function(_0x36220b){try{jsonpatch[_0x9964('0x2c')](_0x36220b,_0x483092,!![]);}catch(_0x4efb43){return BPromise[_0x9964('0x2d')](_0x4efb43);}return _0x36220b[_0x9964('0x2e')]();};}function saveUpdates(_0x3092b2,_0x17a244){return function(_0x9d4eaf){if(_0x9d4eaf){return _0x9d4eaf[_0x9964('0x2f')](_0x3092b2)['then'](function(_0x5f8cda){return _0x5f8cda;});}return null;};}function removeEntity(_0x2eae45,_0x59ab78){return function(_0xbd2537){if(_0xbd2537){return _0xbd2537[_0x9964('0x30')]()[_0x9964('0x31')](function(){_0x2eae45[_0x9964('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55b7a0,_0x445be2){return function(_0x4e517c){if(!_0x4e517c){_0x55b7a0['sendStatus'](0x194);}return _0x4e517c;};}function handleError(_0x193c9a,_0xca41d2){_0xca41d2=_0xca41d2||0x1f4;return function(_0x5d28d8){logger['error'](_0x5d28d8[_0x9964('0x32')]);if(_0x5d28d8[_0x9964('0x33')]){delete _0x5d28d8['name'];}_0x193c9a[_0x9964('0x26')](_0xca41d2)['send'](_0x5d28d8);};}exports['index']=function(_0x57f4ff,_0x469813){var _0x36626c={},_0x168f41={},_0x1df24e={'count':0x0,'rows':[]};var _0x2cdbbc=db[_0x9964('0x34')][_0x9964('0x35')];_0x168f41[_0x9964('0x36')]=_[_0x9964('0x37')](_0x2cdbbc);var _0x526c96={'dateStart':_0x57f4ff[_0x9964('0x38')][_0x9964('0x39')],'dateEnd':_0x57f4ff[_0x9964('0x38')][_0x9964('0x3a')]};delete _0x57f4ff['query']['dateStart'];delete _0x57f4ff[_0x9964('0x38')][_0x9964('0x3a')];_0x168f41[_0x9964('0x38')]=_[_0x9964('0x37')](_0x57f4ff[_0x9964('0x38')]);_0x168f41['filters']=_[_0x9964('0x3b')](_0x168f41[_0x9964('0x36')],_0x168f41[_0x9964('0x38')]);_0x36626c[_0x9964('0x3c')]=_[_0x9964('0x3b')](_0x168f41[_0x9964('0x36')],qs[_0x9964('0x3d')](_0x57f4ff[_0x9964('0x38')][_0x9964('0x3d')]));_0x36626c[_0x9964('0x3c')]=_0x36626c[_0x9964('0x3c')][_0x9964('0x3e')]?_0x36626c[_0x9964('0x3c')]:_0x168f41[_0x9964('0x36')];if(!_0x57f4ff[_0x9964('0x38')][_0x9964('0x3f')]('nolimit')){_0x36626c[_0x9964('0x2b')]=qs['limit'](_0x57f4ff[_0x9964('0x38')][_0x9964('0x2b')]);_0x36626c[_0x9964('0x2a')]=qs['offset'](_0x57f4ff[_0x9964('0x38')]['offset']);}_0x36626c[_0x9964('0x40')]=qs['sort'](_0x57f4ff[_0x9964('0x38')][_0x9964('0x41')]);_0x36626c[_0x9964('0x42')]=qs[_0x9964('0x43')](_[_0x9964('0x44')](_0x57f4ff[_0x9964('0x38')],_0x168f41[_0x9964('0x43')]));if(_0x526c96[_0x9964('0x39')]){if(_0x526c96['dateEnd']){_0x526c96[_0x9964('0x3a')]=moment(_0x526c96[_0x9964('0x3a')])[_0x9964('0x45')](0x1,_0x9964('0x46'));}else{_0x526c96[_0x9964('0x3a')]=moment(_0x526c96[_0x9964('0x39')])[_0x9964('0x45')](0x1,_0x9964('0x46'));}_[_0x9964('0x47')](_0x36626c[_0x9964('0x42')],{'createdAt':{'$gte':_0x526c96['dateStart'],'$lte':_0x526c96['dateEnd']}});}if(_0x57f4ff[_0x9964('0x38')]['filter']){_0x36626c[_0x9964('0x42')]=_['merge'](_0x36626c['where'],{'$or':_['map'](_0x36626c[_0x9964('0x3c')],function(_0x343b26){var _0x3e4a96={};_0x3e4a96[_0x343b26]={'$like':'%'+_0x57f4ff['query']['filter']+'%'};return _0x3e4a96;})});}_0x36626c=_[_0x9964('0x47')]({},_0x36626c,_0x57f4ff['options']);var _0x312175={'where':_0x36626c[_0x9964('0x42')]};_0x312175[_0x9964('0x48')]=[];if(_0x57f4ff[_0x9964('0x38')][_0x9964('0x49')]){_0x312175[_0x9964('0x48')]['push']({'model':db[_0x9964('0x4a')],'as':_0x9964('0x4b'),'attributes':['id'],'where':{'id':_0x57f4ff[_0x9964('0x38')][_0x9964('0x49')]},'required':!![]});_0x312175[_0x9964('0x4c')]=!![];}if(_0x57f4ff['query'][_0x9964('0x4d')]){_0x312175[_0x9964('0x48')][_0x9964('0x4e')]({'model':db['ChatMessage'],'as':_0x9964('0x4f'),'attributes':['id',_0x9964('0x50'),_0x9964('0x51'),_0x9964('0x4d')],'where':{'direction':'in','read':_0x57f4ff[_0x9964('0x38')][_0x9964('0x4d')]||![]},'required':!![]});_0x312175[_0x9964('0x4c')]=!![];}return db[_0x9964('0x34')]['count'](_0x312175)[_0x9964('0x31')](function(_0x52566e){_0x1df24e['count']=_0x52566e;if(_0x57f4ff[_0x9964('0x38')]['includeAll']){_0x36626c[_0x9964('0x48')]=[{'model':db[_0x9964('0x52')],'as':_0x9964('0x53'),'required':![],'attributes':['id','name',_0x9964('0x54')]},{'model':db[_0x9964('0x55')],'as':_0x9964('0x56'),'required':![]},{'model':db[_0x9964('0x52')],'as':_0x9964('0x57'),'attributes':[_0x9964('0x33'),_0x9964('0x54'),_0x9964('0x58')],'required':![]},{'model':db[_0x9964('0x59')],'as':'Account','attributes':[_0x9964('0x33'),'key'],'required':![]},{'model':db[_0x9964('0x5a')],'as':_0x9964('0x4f'),'attributes':['id',_0x9964('0x50'),'createdAt',_0x9964('0x4d')],'where':{'direction':'in','read':_0x57f4ff[_0x9964('0x38')][_0x9964('0x4d')]||![]},'required':_0x57f4ff[_0x9964('0x38')][_0x9964('0x4d')]||![]},{'model':db['Tag'],'as':_0x9964('0x4b'),'attributes':['id',_0x9964('0x33'),_0x9964('0x5b')],'required':_0x57f4ff[_0x9964('0x38')][_0x9964('0x49')]?!![]:![]},{'model':db['Tag'],'as':'ThroughTags','attributes':['id','name','color'],'through':_0x57f4ff[_0x9964('0x38')]['tag']?{'attributes':[],'where':{'TagId':_0x57f4ff['query']['tag']||undefined}}:{},'required':_0x57f4ff[_0x9964('0x38')]['tag']?!![]:![]}];}return db[_0x9964('0x34')][_0x9964('0x5c')](_0x36626c);})[_0x9964('0x31')](function(_0x4e0316){_0x1df24e[_0x9964('0x5d')]=_0x4e0316;return _0x1df24e;})['then'](respondWithFilteredResult(_0x469813,_0x36626c))['catch'](handleError(_0x469813,null));};exports[_0x9964('0x5e')]=function(_0x192a2c,_0x2ffa8e){var _0x4f039e={'raw':![],'where':{'id':_0x192a2c[_0x9964('0x5f')]['id']}},_0x29ab73={};_0x29ab73[_0x9964('0x36')]=_['keys'](db[_0x9964('0x34')][_0x9964('0x35')]);_0x29ab73[_0x9964('0x38')]=_['keys'](_0x192a2c['query']);_0x29ab73[_0x9964('0x43')]=_[_0x9964('0x3b')](_0x29ab73[_0x9964('0x36')],_0x29ab73[_0x9964('0x38')]);_0x4f039e[_0x9964('0x3c')]=_[_0x9964('0x3b')](_0x29ab73[_0x9964('0x36')],qs[_0x9964('0x3d')](_0x192a2c[_0x9964('0x38')][_0x9964('0x3d')]));_0x4f039e[_0x9964('0x3c')]=_0x4f039e[_0x9964('0x3c')][_0x9964('0x3e')]?_0x4f039e[_0x9964('0x3c')]:_0x29ab73[_0x9964('0x36')];if(_0x192a2c['query'][_0x9964('0x60')]){_0x4f039e[_0x9964('0x48')]=[{'all':!![]}];}_0x4f039e=_[_0x9964('0x47')]({},_0x4f039e,_0x192a2c[_0x9964('0x61')]);return db['ChatInteraction']['find'](_0x4f039e)['then'](handleEntityNotFound(_0x2ffa8e,null))['then'](respondWithResult(_0x2ffa8e,null))['catch'](handleError(_0x2ffa8e,null));};exports[_0x9964('0x62')]=function(_0xfb3f82,_0x58537e){return db[_0x9964('0x34')][_0x9964('0x62')](_0xfb3f82[_0x9964('0x63')],{})[_0x9964('0x31')](respondWithResult(_0x58537e,0xc9))[_0x9964('0x24')](handleError(_0x58537e,null));};exports['update']=function(_0x3446c8,_0x371bd1){if(_0x3446c8['body']['id']){delete _0x3446c8[_0x9964('0x63')]['id'];}return db['ChatInteraction'][_0x9964('0x64')]({'where':{'id':_0x3446c8['params']['id']}})[_0x9964('0x31')](handleEntityNotFound(_0x371bd1,null))[_0x9964('0x31')](saveUpdates(_0x3446c8['body'],null))[_0x9964('0x31')](respondWithResult(_0x371bd1,null))['catch'](handleError(_0x371bd1,null));};exports['destroy']=function(_0x1614ad,_0x5d5c55){return db[_0x9964('0x34')]['find']({'where':{'id':_0x1614ad[_0x9964('0x5f')]['id']}})['then'](handleEntityNotFound(_0x5d5c55,null))[_0x9964('0x31')](removeEntity(_0x5d5c55,null))[_0x9964('0x24')](handleError(_0x5d5c55,null));};exports[_0x9964('0x65')]=function(_0x41144f,_0x2d0b16){return db[_0x9964('0x34')]['describe']()[_0x9964('0x31')](respondWithResult(_0x2d0b16,null))[_0x9964('0x24')](handleError(_0x2d0b16,null));};exports[_0x9964('0x66')]=function(_0x5800ea,_0x439832){if(_0x5800ea[_0x9964('0x63')]['id']){delete _0x5800ea[_0x9964('0x63')]['id'];}return db[_0x9964('0x34')][_0x9964('0x64')]({'where':{'id':_0x5800ea[_0x9964('0x5f')]['id']}})[_0x9964('0x31')](handleEntityNotFound(_0x439832,null))[_0x9964('0x31')](saveUpdates(_0x5800ea[_0x9964('0x63')],null))[_0x9964('0x31')](respondWithResult(_0x439832,null))[_0x9964('0x24')](handleError(_0x439832,null));};exports['abandon']=function(_0x3ceecf,_0x587874,_0x1ed3e6){if(_0x3ceecf[_0x9964('0x63')]['id']){delete _0x3ceecf[_0x9964('0x63')]['id'];}return db[_0x9964('0x34')]['find']({'where':{'id':_0x3ceecf[_0x9964('0x5f')]['id']}})[_0x9964('0x31')](function(_0x888516){if(!_0x888516){logger[_0x9964('0x20')](_0x9964('0x67'),_0x9964('0x68'),0x194,_0x9964('0x69'));_0x587874[_0x9964('0x25')](0x194);}else{if(_0x888516[_0x9964('0x6a')]){throw new db[(_0x9964('0x6b'))]['ValidationError'](_0x9964('0x6c'));}}return _0x888516;})[_0x9964('0x31')](function(_0xc45929){if(_0xc45929){return _0xc45929[_0x9964('0x2f')]({'closed':_0x3ceecf[_0x9964('0x63')][_0x9964('0x6d')],'closedAt':_0x3ceecf['body'][_0x9964('0x6e')],'disposition':_0x3ceecf[_0x9964('0x63')][_0x9964('0x6f')]})[_0x9964('0x31')](function(_0x5d0a66){return _0x5d0a66;});}})['then'](function(_0x483f76){return respondWithRpcPromise(_0x9964('0x70'),_0x9964('0x68'),_0x3ceecf['body'],client9004);})[_0x9964('0x31')](respondWithResult(_0x587874,null))[_0x9964('0x24')](handleError(_0x587874,null));};exports[_0x9964('0x71')]=function(_0x49cff4,_0x379ada,_0x43964c){_0x49cff4['body'][_0x9964('0x33')]=_0x49cff4[_0x9964('0x72')]['originalname'];_0x49cff4[_0x9964('0x63')][_0x9964('0x73')]=_0x49cff4[_0x9964('0x72')][_0x9964('0x74')];_0x49cff4[_0x9964('0x63')]['type']=_0x49cff4[_0x9964('0x72')]['mimetype'];return db[_0x9964('0x75')][_0x9964('0x62')](_0x49cff4['body'])[_0x9964('0x31')](respondWithResult(_0x379ada,0xc9))[_0x9964('0x24')](handleError(_0x379ada,null));};exports[_0x9964('0x76')]=function(_0x243920,_0x52df1d,_0x43ecd6){return db[_0x9964('0x34')][_0x9964('0x77')]({'where':{'id':_0x243920[_0x9964('0x5f')]['id']},'raw':!![]})[_0x9964('0x31')](handleEntityNotFound(_0x52df1d,null))[_0x9964('0x31')](function(_0x128882){if(_0x128882){if(_0x128882[_0x9964('0x6d')]){return _0x52df1d[_0x9964('0x26')](0x193)[_0x9964('0x28')]({'status':0x193,'message':_0x9964('0x78')});}return db[_0x9964('0x75')]['findOne']({'where':{'id':_0x243920[_0x9964('0x38')]['attachId']},'raw':!![]})[_0x9964('0x31')](handleEntityNotFound(_0x52df1d,null));}})[_0x9964('0x31')](function(_0x4aec68){if(_0x4aec68){return _0x52df1d[_0x9964('0x79')](path[_0x9964('0x7a')](config[_0x9964('0x7b')],_0x9964('0x7c'),_0x4aec68[_0x9964('0x73')]));}})[_0x9964('0x24')](handleError(_0x52df1d,null));};exports[_0x9964('0x7d')]=function(_0x2767d0,_0x5a9695){var _0x400bff=null;var _0x14e6e8=null;var _0x342d35=null;var _0x4b462e=null;if(_0x2767d0[_0x9964('0x63')]['id']){delete _0x2767d0[_0x9964('0x63')]['id'];}if(_0x2767d0[_0x9964('0x63')]['mailTranscript']){_0x4b462e=path[_0x9964('0x7a')](config[_0x9964('0x7b')],_0x9964('0x7e'),util[_0x9964('0x7f')](_0x9964('0x80'),Date[_0x9964('0x81')]()));_0x2767d0[_0x9964('0x63')][_0x9964('0x82')]=_0x4b462e;}return db[_0x9964('0x34')]['find']({'where':{'id':_0x2767d0[_0x9964('0x5f')]['id']},'include':[{'model':db[_0x9964('0x5a')],'as':_0x9964('0x4f'),'include':[{'model':db['User'],'as':_0x9964('0x52')}]}]})['then'](handleEntityNotFound(_0x5a9695,null))[_0x9964('0x31')](saveUpdates(_0x2767d0[_0x9964('0x63')],null))[_0x9964('0x31')](function(_0x540bac){if(_0x540bac){_0x400bff=_0x540bac;return db[_0x9964('0x59')][_0x9964('0x64')]({'where':{'id':_0x400bff[_0x9964('0x83')]}});}})['then'](function(_0x6ecc6d){if(_0x6ecc6d){_0x342d35=_0x6ecc6d;return db[_0x9964('0x55')][_0x9964('0x64')]({'where':{'id':_0x400bff['ContactId']}});}})[_0x9964('0x31')](function(_0x22e298){if(_0x22e298){_0x14e6e8=_0x22e298;if(_0x4b462e){var _0x1bdedf=null;for(var _0x5e5ef7=0x1;_0x5e5ef7<_0x400bff[_0x9964('0x4f')][_0x9964('0x3e')];++_0x5e5ef7){_0x1bdedf=_0x400bff[_0x9964('0x4f')][_0x5e5ef7];var _0x511635=_0x1bdedf[_0x9964('0x6a')]?util[_0x9964('0x7f')](_0x9964('0x84'),_0x342d35[_0x9964('0x85')],_0x1bdedf[_0x9964('0x6a')]):_0x9964('0x86');var _0x5bdd6d=_0x2767d0[_0x9964('0x63')][_0x9964('0x87')]||util[_0x9964('0x7f')](_0x9964('0x84'),_0x9964('0x88'),_0x1bdedf[_0x9964('0x89')]);switch(_0x342d35[_0x9964('0x8a')]){case'website_alias':_0x511635=_0x1bdedf[_0x9964('0x6a')]?util[_0x9964('0x7f')](_0x9964('0x84'),_0x342d35[_0x9964('0x85')],_0x1bdedf[_0x9964('0x6a')]):_0x9964('0x86');break;case _0x9964('0x8b'):_0x511635=_0x1bdedf[_0x9964('0x6a')]?_0x1bdedf[_0x9964('0x52')][_0x9964('0x8c')]||_0x1bdedf['User']['fullname']:'System';break;case'agent_fullname':_0x511635=_0x1bdedf[_0x9964('0x6a')]?_0x1bdedf[_0x9964('0x52')][_0x9964('0x54')]:_0x9964('0x86');break;default:_0x511635=_0x1bdedf[_0x9964('0x6a')]?util[_0x9964('0x7f')](_0x9964('0x84'),_0x342d35['agentAlias'],_0x1bdedf['UserId']):_0x9964('0x86');}var _0x53d1e0=util[_0x9964('0x7f')](_0x9964('0x8d'),moment(_0x1bdedf[_0x9964('0x51')])[_0x9964('0x7f')](_0x9964('0x8e')),_0x1bdedf['direction']==='in'?_0x5bdd6d:_0x511635,_0x1bdedf['body']);if(!_0x1bdedf['secret']){fs['appendFileSync'](_0x4b462e,_0x53d1e0);}}return db['MailAccount'][_0x9964('0x77')]({'where':{'service':!![]},'include':[{'model':db[_0x9964('0x8f')],'as':_0x9964('0x90'),'raw':!![]}]});}}})[_0x9964('0x31')](function(_0x39d972){if(_0x39d972&&_0x39d972[_0x9964('0x90')]&&_0x2767d0[_0x9964('0x63')]){var _0x353abf={'tls':{'rejectUnauthorized':![]}};if(_0x39d972['Smtp'][_0x9964('0x91')]){_0x353abf['service']=_0x39d972[_0x9964('0x90')][_0x9964('0x91')];}else{_0x353abf[_0x9964('0x92')]=_0x39d972['Smtp'][_0x9964('0x92')];_0x353abf['port']=_0x39d972[_0x9964('0x90')][_0x9964('0x93')];_0x353abf[_0x9964('0x94')]=_0x39d972[_0x9964('0x90')][_0x9964('0x94')];}if(_0x39d972['Smtp'][_0x9964('0x95')]){_0x353abf[_0x9964('0x96')]={'user':_0x39d972[_0x9964('0x90')][_0x9964('0x97')],'pass':_0x39d972[_0x9964('0x90')][_0x9964('0x98')]};}return respondWithRpcPromise('SendMail',_0x9964('0x99'),{'account':_0x353abf,'message':{'from':util[_0x9964('0x7f')](_0x9964('0x9a'),_0x39d972[_0x9964('0x33')],_0x39d972[_0x9964('0x9b')]||_0x39d972[_0x9964('0x90')]['user']),'to':_0x2767d0[_0x9964('0x63')][_0x9964('0x9c')],'subject':_0x9964('0x9d'),'text':util[_0x9964('0x7f')](_0x9964('0x9e'),_0x2767d0['body'][_0x9964('0x9c')]),'attachments':[{'path':_0x4b462e}]}})[_0x9964('0x31')](function(){return _0x400bff;})[_0x9964('0x24')](function(_0x4ff3af){console[_0x9964('0x20')](_0x4ff3af);});}else{return _0x400bff;}})[_0x9964('0x31')](respondWithStatusCode(_0x5a9695,0xc8))[_0x9964('0x24')](handleError(_0x5a9695,null));};exports[_0x9964('0x9f')]=function(_0x5070ae,_0x2c0379,_0x420d45){return db[_0x9964('0x5a')]['find']({'where':{'id':_0x5070ae['params']['id']}})['then'](handleEntityNotFound(_0x2c0379,null))[_0x9964('0x31')](function(_0x1d0890){if(_0x1d0890){return _0x1d0890[_0x9964('0x9f')](_0x5070ae[_0x9964('0x63')][_0x9964('0xa0')],_[_0x9964('0xa1')](_0x5070ae[_0x9964('0x63')],[_0x9964('0xa0'),'id'])||{});}})[_0x9964('0x31')](respondWithResult(_0x2c0379,null))['catch'](handleError(_0x2c0379,null));};exports['getMessages']=function(_0x1cee08,_0x2515df,_0x7f15b8){var _0x53f345={'raw':![],'where':{}};var _0x38e38e={};var _0xc1cf5b={'count':0x0,'rows':[]};return db[_0x9964('0x34')][_0x9964('0x77')]({'where':{'id':_0x1cee08['params']['id']}})[_0x9964('0x31')](handleEntityNotFound(_0x2515df,null))[_0x9964('0x31')](function(_0x2ddaf6){if(_0x2ddaf6){_0x38e38e[_0x9964('0x36')]=_['keys'](db[_0x9964('0x5a')][_0x9964('0x35')]);_0x38e38e[_0x9964('0x38')]=_[_0x9964('0x37')](_0x1cee08[_0x9964('0x38')]);_0x38e38e[_0x9964('0x43')]=_[_0x9964('0x3b')](_0x38e38e['model'],_0x38e38e[_0x9964('0x38')]);_0x53f345[_0x9964('0x3c')]=_['intersection'](_0x38e38e[_0x9964('0x36')],qs[_0x9964('0x3d')](_0x1cee08[_0x9964('0x38')][_0x9964('0x3d')]));_0x53f345[_0x9964('0x3c')]=_0x53f345[_0x9964('0x3c')]['length']?_0x53f345[_0x9964('0x3c')]:_0x38e38e[_0x9964('0x36')];if(!_0x1cee08[_0x9964('0x38')][_0x9964('0x3f')]('nolimit')){_0x53f345[_0x9964('0x2b')]=qs[_0x9964('0x2b')](_0x1cee08[_0x9964('0x38')]['limit']);_0x53f345['offset']=qs[_0x9964('0x2a')](_0x1cee08[_0x9964('0x38')][_0x9964('0x2a')]);}_0x53f345['order']=qs[_0x9964('0x41')](_0x1cee08[_0x9964('0x38')][_0x9964('0x41')]);_0x53f345[_0x9964('0x42')]=qs[_0x9964('0x43')](_[_0x9964('0x44')](_0x1cee08[_0x9964('0x38')],_0x38e38e[_0x9964('0x43')]));_0x53f345[_0x9964('0x42')][_0x9964('0xa2')]=_0x2ddaf6['id'];if(_0x1cee08['query'][_0x9964('0xa3')]){_0x53f345[_0x9964('0x42')]=_['merge'](_0x53f345[_0x9964('0x42')],{'$or':_[_0x9964('0xa4')](_0x53f345['attributes'],function(_0x1f9f64){var _0x4d77f6={};_0x4d77f6[_0x1f9f64]={'$like':'%'+_0x1cee08['query']['filter']+'%'};return _0x4d77f6;})});}if(_0x1cee08['query'][_0x9964('0xa5')]){var _0x53e94f=_0x1cee08['query'][_0x9964('0xa5')][_0x9964('0xa6')](',');var _0x10a1d5={};_0x10a1d5[_0x53e94f[0x0]]={'$gte':moment(_0x53e94f[0x1])['format'](_0x9964('0xa7'))};_0x53f345[_0x9964('0x42')]=_[_0x9964('0x47')](_0x53f345['where'],_0x10a1d5);}_0x53f345=_[_0x9964('0x47')]({},_0x53f345,_0x1cee08[_0x9964('0x61')]);return db[_0x9964('0x5a')][_0x9964('0x29')]({'where':_0x53f345[_0x9964('0x42')]})['then'](function(_0x321a8e){_0xc1cf5b['count']=_0x321a8e;if(_0x1cee08[_0x9964('0x38')][_0x9964('0x60')]){_0x53f345[_0x9964('0x48')]=[{'all':!![]}];}return db[_0x9964('0x5a')][_0x9964('0x5c')](_0x53f345);})[_0x9964('0x31')](function(_0x2347da){_0xc1cf5b['rows']=_0x2347da;return _0xc1cf5b;});}})['then'](respondWithFilteredResult(_0x2515df,_0x53f345))[_0x9964('0x24')](handleError(_0x2515df,null));};exports['getMyMessages']=function(_0x3c108a,_0x2279c0,_0x51df90){var _0x2ee56f={'where':{}},_0x403040={},_0x4776fb={'count':0x0,'rows':[]};return db[_0x9964('0x34')][_0x9964('0x77')]({'where':{'id':_0x3c108a[_0x9964('0x5f')]['id']}})[_0x9964('0x31')](handleEntityNotFound(_0x2279c0,null))[_0x9964('0x31')](function(_0x33e826){if(_0x33e826){_0x403040['model']=_['keys'](db['ChatMessage']['rawAttributes']);_0x403040['query']=_[_0x9964('0x37')](_0x3c108a[_0x9964('0x38')]);_0x403040[_0x9964('0x43')]=_[_0x9964('0x3b')](_0x403040[_0x9964('0x36')],_0x403040[_0x9964('0x38')]);_0x2ee56f[_0x9964('0x3c')]=_[_0x9964('0x3b')](_0x403040['model'],qs[_0x9964('0x3d')](_0x3c108a[_0x9964('0x38')][_0x9964('0x3d')]));_0x2ee56f[_0x9964('0x3c')]=_0x2ee56f[_0x9964('0x3c')][_0x9964('0x3e')]?_0x2ee56f[_0x9964('0x3c')]:_0x403040['model'];if(!_0x3c108a['query'][_0x9964('0x3f')](_0x9964('0xa8'))){_0x2ee56f[_0x9964('0x2b')]=qs[_0x9964('0x2b')](_0x3c108a[_0x9964('0x38')][_0x9964('0x2b')]);_0x2ee56f[_0x9964('0x2a')]=qs['offset'](_0x3c108a['query'][_0x9964('0x2a')]);}_0x2ee56f[_0x9964('0x40')]=qs[_0x9964('0x41')](_0x3c108a['query'][_0x9964('0x41')]);_0x2ee56f[_0x9964('0x42')]=qs[_0x9964('0x43')](_[_0x9964('0x44')](_0x3c108a['query'],_0x403040[_0x9964('0x43')]));_0x2ee56f['where'][_0x9964('0xa2')]=_0x33e826['id'];if(_0x3c108a['query'][_0x9964('0xa3')]){_0x2ee56f[_0x9964('0x42')]=_[_0x9964('0x47')](_0x2ee56f[_0x9964('0x42')],{'$or':_[_0x9964('0xa4')](_0x2ee56f[_0x9964('0x3c')],function(_0x242e76){var _0x2d30a9={};_0x2d30a9[_0x242e76]={'$like':'%'+_0x3c108a['query'][_0x9964('0xa3')]+'%'};return _0x2d30a9;})});}_0x2ee56f[_0x9964('0x42')][_0x9964('0xa9')]=![];if(_0x3c108a[_0x9964('0x38')]['id']){_0x2ee56f[_0x9964('0x42')]['id']={'$gt':_0x3c108a[_0x9964('0x38')]['id']};}_0x2ee56f=_['merge']({},_0x2ee56f,_0x3c108a['options']);return db['ChatMessage']['count']({'where':_0x2ee56f[_0x9964('0x42')]})[_0x9964('0x31')](function(_0x53bff7){_0x4776fb[_0x9964('0x29')]=_0x53bff7;_0x2ee56f['include']=[];if(_0x3c108a[_0x9964('0x38')][_0x9964('0xaa')]){_0x2ee56f[_0x9964('0x48')][_0x9964('0x4e')]({'model':db[_0x9964('0x52')],'as':_0x9964('0x52'),'attributes':['id','fullname',_0x9964('0x8c')]});}if(_0x3c108a['query'][_0x9964('0x60')]){_0x2ee56f[_0x9964('0x48')]=[{'all':!![]}];}return db[_0x9964('0x5a')][_0x9964('0x5c')](_0x2ee56f);})[_0x9964('0x31')](function(_0x43a011){_0x4776fb['rows']=_0x43a011;return _0x4776fb;});}})[_0x9964('0x31')](respondWithFilteredResult(_0x2279c0,_0x2ee56f))[_0x9964('0x24')](handleError(_0x2279c0,null));};exports[_0x9964('0xab')]=function(_0x4a34cd,_0x205d6f,_0x11bdf3){return db[_0x9964('0x34')][_0x9964('0x64')]({'where':{'id':_0x4a34cd['params']['id']}})[_0x9964('0x31')](handleEntityNotFound(_0x205d6f,null))[_0x9964('0x31')](function(_0x20fadf){if(_0x20fadf){return _0x20fadf[_0x9964('0xac')](_0x4a34cd[_0x9964('0x63')]['ids'],_[_0x9964('0xa1')](_0x4a34cd[_0x9964('0x63')],[_0x9964('0xa0'),'id'])||{})['spread'](function(){return db[_0x9964('0x4a')][_0x9964('0x5c')]({'attributes':['id',_0x9964('0x33'),_0x9964('0x5b')],'where':{'id':_0x4a34cd[_0x9964('0x63')][_0x9964('0xa0')]}});})['then'](function(_0x30fa6f){socket['emit'](_0x9964('0xad'),{'id':Number(_0x4a34cd['params']['id']),'tags':_0x30fa6f||[]});return{'id':Number(_0x4a34cd[_0x9964('0x5f')]['id']),'tags':_0x30fa6f||[]};});}})['then'](respondWithResult(_0x205d6f,null))[_0x9964('0x24')](handleError(_0x205d6f,null));};exports[_0x9964('0xae')]=function(_0x41f300,_0x687d2a,_0x28e1c5){var _0x26c36f;return db['ChatInteraction'][_0x9964('0x64')]({'where':{'id':_0x41f300[_0x9964('0x5f')]['id']}})[_0x9964('0x31')](handleEntityNotFound(_0x687d2a,null))[_0x9964('0x31')](function(_0x571d12){if(_0x571d12){return _0x571d12[_0x9964('0xae')](_0x41f300[_0x9964('0x38')][_0x9964('0xa0')]);}})[_0x9964('0x31')](respondWithStatusCode(_0x687d2a,null))[_0x9964('0x24')](handleError(_0x687d2a,null));};exports['download']=function(_0x483b0e,_0x4acd58){var _0x3f5e4=moment()[_0x9964('0xaf')]()[_0x9964('0xb0')]();var _0x5972f6=path[_0x9964('0x7a')](config[_0x9964('0x7b')],'server',_0x9964('0xb1'),'tmp');var _0x42c2f3=path[_0x9964('0x7a')](config[_0x9964('0x7b')],_0x9964('0xb2'),_0x9964('0xb1'),_0x9964('0xb3'));var _0x5a9ed1=path[_0x9964('0x7a')](_0x5972f6,_0x3f5e4);var _0x78004c=util[_0x9964('0x7f')](_0x9964('0xb4'),_0x3f5e4);var _0x2d96a1=path[_0x9964('0x7a')](_0x5972f6,_0x78004c);var _0x35e4f8=![];return db[_0x9964('0x34')][_0x9964('0x64')]({'where':{'id':_0x483b0e[_0x9964('0x5f')]['id']},'include':[{'model':db[_0x9964('0x5a')],'as':_0x9964('0x4f'),'attributes':['id','body'],'include':[{'model':db[_0x9964('0x52')],'as':'User','attributes':['id','fullname'],'raw':!![]},{'model':db[_0x9964('0x55')],'as':_0x9964('0x56'),'attributes':['id',_0x9964('0xb5')],'raw':!![]},{'model':db[_0x9964('0x75')],'as':_0x9964('0x75'),'raw':!![]}]}]})[_0x9964('0x31')](handleEntityNotFound(_0x4acd58,null))[_0x9964('0x31')](function(_0x5ca24f){if(_0x5ca24f){_0x35e4f8=!![];var _0x48c35c='';var _0x5ae5b1={'format':'Letter','border':_0x9964('0xb6')};fs[_0x9964('0xb7')](_0x5a9ed1);_0x48c35c+=util[_0x9964('0x7f')](_0x9964('0xb8'),_0x5ca24f['id']);_0x48c35c+=util[_0x9964('0x7f')]('

Date:\x20%s

',moment()[_0x9964('0x7f')]('MMMM\x20Do\x20YYYY,\x20HH:mm:ss')[_0x9964('0xb0')]());_0x48c35c+=_0x9964('0xb9');for(var _0x2f0d60=0x1;_0x2f0d60<_0x5ca24f['Messages'][_0x9964('0x3e')];_0x2f0d60++){var _0x11a83a=_0x5ca24f[_0x9964('0x4f')][_0x2f0d60];_0x48c35c+='';_0x48c35c+=util[_0x9964('0x7f')](_0x9964('0xba'),_0x11a83a[_0x9964('0x52')]?_0x11a83a[_0x9964('0x52')][_0x9964('0x54')]:_0x11a83a[_0x9964('0x56')][_0x9964('0xb5')],_0x11a83a[_0x9964('0x63')]);_0x48c35c+=_0x9964('0xbb');if(_0x11a83a[_0x9964('0x75')]){var _0x106939=_0x11a83a[_0x9964('0x75')];var _0x3e13ec=path['join'](_0x42c2f3,_0x106939[_0x9964('0x73')]);if(fs[_0x9964('0xbc')](_0x3e13ec)){fs[_0x9964('0xbd')](_0x3e13ec)['pipe'](fs['createWriteStream'](path[_0x9964('0x7a')](_0x5a9ed1,_0x106939[_0x9964('0x73')])));}}}return new BPromise(function(_0x309300,_0x2a4897){pdf[_0x9964('0x62')](_0x48c35c,_0x5ae5b1)[_0x9964('0xbe')](path[_0x9964('0x7a')](_0x5a9ed1,_0x9964('0xbf')+_0x3f5e4+'.pdf'),function(_0x162c06,_0x3abed4){if(_0x162c06)return _0x2a4897(_0x162c06);_0x309300(_0x3abed4);});});}})[_0x9964('0x31')](function(){if(_0x35e4f8){return new BPromise(function(_0x4f1c94,_0xa7bdcc){zipdir(_0x5a9ed1,{'saveTo':_0x2d96a1},function(_0x225dee,_0xd46066){if(_0x225dee)return _0xa7bdcc(_0x225dee);return _0x4f1c94(_0xd46066);});});}})[_0x9964('0x31')](function(){if(_0x35e4f8){return new BPromise(function(_0x16edfa,_0x269aaa){rimraf(_0x5a9ed1,function(_0x48f856){if(_0x48f856)_0x269aaa(_0x48f856);return _0x16edfa();});});}})[_0x9964('0x31')](function(){if(_0x35e4f8){return _0x4acd58[_0x9964('0x79')](_0x2d96a1,_0x78004c,function(_0x5337ff){if(_0x5337ff){console['log'](_0x9964('0xc0'),_0x5337ff);}else{fs[_0x9964('0xc1')](_0x2d96a1);}});}else{return _0x4acd58[_0x9964('0x25')](0xc8);}})[_0x9964('0x24')](handleError(_0x4acd58,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 5fdf4b4..4c71fa0 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 _0xc7fd=['update','emit','hasOwnProperty','events','ChatInteraction','setMaxListeners','save'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc7fd,0x137));var _0xdc7f=function(_0x847376,_0x17b88c){_0x847376=_0x847376-0x0;var _0x1dd1a0=_0xc7fd[_0x847376];return _0x1dd1a0;};'use strict';var EventEmitter=require(_0xdc7f('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0xdc7f('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xdc7f('0x2')](0x0);var events={'afterCreate':_0xdc7f('0x3'),'afterUpdate':_0xdc7f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1c7ecc){return function(_0x25e059,_0x87c0e1,_0x47600b){ChatInteractionEvents[_0xdc7f('0x5')](_0x1c7ecc+':'+_0x25e059['id'],_0x25e059);ChatInteractionEvents[_0xdc7f('0x5')](_0x1c7ecc,_0x25e059);_0x47600b(null);};}for(var e in events){if(events[_0xdc7f('0x6')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0xcc7f=['exports','events','../../mysqldb','ChatInteraction','update','remove','emit','hook'];(function(_0x1757f2,_0x1b09fa){var _0x5e7212=function(_0x4f1794){while(--_0x4f1794){_0x1757f2['push'](_0x1757f2['shift']());}};_0x5e7212(++_0x1b09fa);}(_0xcc7f,0x1e9));var _0xfcc7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc7f[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xfcc7('0x0'));var ChatInteraction=require(_0xfcc7('0x1'))['db'][_0xfcc7('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xfcc7('0x3'),'afterDestroy':_0xfcc7('0x4')};function emitEvent(_0x2fa707){return function(_0x40dee,_0x3b8144,_0x508129){ChatInteractionEvents[_0xfcc7('0x5')](_0x2fa707+':'+_0x40dee['id'],_0x40dee);ChatInteractionEvents[_0xfcc7('0x5')](_0x2fa707,_0x40dee);_0x508129(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0xfcc7('0x6')](e,emitEvent(event));}}module[_0xfcc7('0x7')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 076663d..10a5550 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 _0x0504=['util','../../config/logger','api','bluebird','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x33c53b,_0x32000b){var _0x1f4b92=function(_0x1716a9){while(--_0x1716a9){_0x33c53b['push'](_0x33c53b['shift']());}};_0x1f4b92(++_0x32000b);}(_0x0504,0x173));var _0x4050=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x0504[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0x4050('0x0'));var util=require(_0x4050('0x1'));var logger=require(_0x4050('0x2'))(_0x4050('0x3'));var moment=require('moment');var BPromise=require(_0x4050('0x4'));var rp=require('request-promise');var attributes=require(_0x4050('0x5'));module[_0x4050('0x6')]=function(_0x3fefc4,_0x5f05a9){return _0x3fefc4[_0x4050('0x7')](_0x4050('0x8'),attributes,{'tableName':_0x4050('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4050('0xa'),'collate':_0x4050('0xb')});}; \ No newline at end of file +var _0xd022=['utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','ChatInteraction','utf8mb4'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd022,0x121));var _0x2d02=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xd022[_0x17b6e3];return _0x3906f3;};'use strict';var _=require('lodash');var util=require(_0x2d02('0x0'));var logger=require(_0x2d02('0x1'))(_0x2d02('0x2'));var moment=require(_0x2d02('0x3'));var BPromise=require('bluebird');var rp=require(_0x2d02('0x4'));var attributes=require('./chatInteraction.attributes');module['exports']=function(_0x117a93,_0x5a8aca){return _0x117a93['define'](_0x2d02('0x5'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2d02('0x6'),'collate':_0x2d02('0x7')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 3dd123e..cb019e5 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 _0x315a=['where','attributes','limit','debug','AddTagsToChatInteraction','find','addTags','body','ids','omit','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateChatInteraction','update','options','raw'];(function(_0x39a2d6,_0x477459){var _0x23af66=function(_0x2eb95e){while(--_0x2eb95e){_0x39a2d6['push'](_0x39a2d6['shift']());}};_0x23af66(++_0x477459);}(_0x315a,0x119));var _0xa315=function(_0x1b9b74,_0xd2ba13){_0x1b9b74=_0x1b9b74-0x0;var _0x33a515=_0x315a[_0x1b9b74];return _0x33a515;};'use strict';var _=require(_0xa315('0x0'));var util=require('util');var moment=require(_0xa315('0x1'));var BPromise=require(_0xa315('0x2'));var rs=require(_0xa315('0x3'));var fs=require('fs');var Redis=require(_0xa315('0x4'));var db=require(_0xa315('0x5'))['db'];var utils=require(_0xa315('0x6'));var logger=require(_0xa315('0x7'))(_0xa315('0x8'));var config=require(_0xa315('0x9'));var jayson=require(_0xa315('0xa'));var client=jayson[_0xa315('0xb')]['http']({'port':0x232a});config[_0xa315('0xc')]=_[_0xa315('0xd')](config['redis'],{'host':_0xa315('0xe'),'port':0x18eb});var socket=require(_0xa315('0xf'))(new Redis(config[_0xa315('0xc')]));require(_0xa315('0x10'))[_0xa315('0x11')](socket);function respondWithRpcPromise(_0x178265,_0x12c9ef,_0xbd5fcc){return new BPromise(function(_0x869480,_0x1d99fc){return client[_0xa315('0x12')](_0x178265,_0xbd5fcc)[_0xa315('0x13')](function(_0x59333f){logger[_0xa315('0x14')](_0xa315('0x15'),_0x12c9ef,_0xa315('0x16'));logger['debug'](_0xa315('0x17'),_0x12c9ef,_0xa315('0x16'),JSON[_0xa315('0x18')](_0x59333f));if(_0x59333f[_0xa315('0x19')]){if(_0x59333f['error'][_0xa315('0x1a')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x12c9ef,_0x59333f[_0xa315('0x19')][_0xa315('0x1b')]);return _0x1d99fc(_0x59333f['error'][_0xa315('0x1b')]);}logger[_0xa315('0x19')](_0xa315('0x15'),_0x12c9ef,_0x59333f['error'][_0xa315('0x1b')]);return _0x869480(_0x59333f[_0xa315('0x19')]['message']);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x12c9ef,_0xa315('0x16'));_0x869480(_0x59333f[_0xa315('0x1c')]['message']);}})[_0xa315('0x1d')](function(_0x35e1d9){logger[_0xa315('0x19')](_0xa315('0x15'),_0x12c9ef,_0x35e1d9);_0x1d99fc(_0x35e1d9);});});}exports[_0xa315('0x1e')]=function(_0x287073){var _0x2c342a=this;return new Promise(function(_0x1fa32f,_0xc9422f){return db['ChatInteraction'][_0xa315('0x1f')](_0x287073['body'],{'raw':_0x287073[_0xa315('0x20')]?_0x287073[_0xa315('0x20')][_0xa315('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287073['options']?_0x287073[_0xa315('0x20')][_0xa315('0x22')]||null:null,'attributes':_0x287073[_0xa315('0x20')]?_0x287073[_0xa315('0x20')][_0xa315('0x23')]||null:null,'limit':_0x287073[_0xa315('0x20')]?_0x287073[_0xa315('0x20')][_0xa315('0x24')]||null:null})[_0xa315('0x13')](function(_0x969c61){logger[_0xa315('0x14')](_0xa315('0x1e'),_0x287073);logger[_0xa315('0x25')]('UpdateChatInteraction',_0x287073,JSON['stringify'](_0x969c61));_0x1fa32f(_0x969c61);})[_0xa315('0x1d')](function(_0x31c217){logger[_0xa315('0x19')](_0xa315('0x1e'),_0x31c217[_0xa315('0x1b')],_0x287073);_0xc9422f(_0x2c342a[_0xa315('0x19')](0x1f4,_0x31c217[_0xa315('0x1b')]));});});};exports[_0xa315('0x26')]=function(_0x58886d){return new Promise(function(_0x439ea9,_0xea941e){return db['ChatInteraction'][_0xa315('0x27')]({'where':_0x58886d['options']?_0x58886d['options'][_0xa315('0x22')]||null:null})['then'](function(_0x5bb34e){if(_0x5bb34e){return _0x5bb34e[_0xa315('0x28')](_0x58886d[_0xa315('0x29')][_0xa315('0x2a')],_[_0xa315('0x2b')](_0x58886d[_0xa315('0x29')],['ids','id'])||{});}})['spread'](function(_0x1fa02f){logger[_0xa315('0x14')](_0xa315('0x2c'),_0x58886d);logger['debug'](_0xa315('0x2c'),_0x58886d,JSON[_0xa315('0x18')](_0x1fa02f));_0x439ea9(_0x1fa02f);})['catch'](function(_0x1d92b1){logger[_0xa315('0x19')](_0xa315('0x2c'),_0x1d92b1[_0xa315('0x1b')],_0x58886d);_0xea941e(_this[_0xa315('0x19')](0x1f4,_0x1d92b1['message']));});});}; \ No newline at end of file +var _0x7bcb=['body','options','where','attributes','limit','stringify','AddTagsToChatInteraction','find','addTags','ids','spread','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x7bcb,0x108));var _0xb7bc=function(_0x5a57cd,_0x498a68){_0x5a57cd=_0x5a57cd-0x0;var _0x3b9e9d=_0x7bcb[_0x5a57cd];return _0x3b9e9d;};'use strict';var _=require('lodash');var util=require(_0xb7bc('0x0'));var moment=require('moment');var BPromise=require(_0xb7bc('0x1'));var rs=require(_0xb7bc('0x2'));var fs=require('fs');var Redis=require(_0xb7bc('0x3'));var db=require(_0xb7bc('0x4'))['db'];var utils=require(_0xb7bc('0x5'));var logger=require(_0xb7bc('0x6'))(_0xb7bc('0x7'));var config=require(_0xb7bc('0x8'));var jayson=require(_0xb7bc('0x9'));var client=jayson[_0xb7bc('0xa')][_0xb7bc('0xb')]({'port':0x232a});config[_0xb7bc('0xc')]=_['defaults'](config[_0xb7bc('0xc')],{'host':_0xb7bc('0xd'),'port':0x18eb});var socket=require(_0xb7bc('0xe'))(new Redis(config[_0xb7bc('0xc')]));require(_0xb7bc('0xf'))[_0xb7bc('0x10')](socket);function respondWithRpcPromise(_0x1321cf,_0x225160,_0x196f16){return new BPromise(function(_0x3b1f5a,_0x46d051){return client['request'](_0x1321cf,_0x196f16)[_0xb7bc('0x11')](function(_0x512961){logger[_0xb7bc('0x12')](_0xb7bc('0x13'),_0x225160,_0xb7bc('0x14'));logger[_0xb7bc('0x15')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x225160,'request\x20sent',JSON['stringify'](_0x512961));if(_0x512961[_0xb7bc('0x16')]){if(_0x512961[_0xb7bc('0x16')][_0xb7bc('0x17')]===0x1f4){logger[_0xb7bc('0x16')](_0xb7bc('0x13'),_0x225160,_0x512961[_0xb7bc('0x16')]['message']);return _0x46d051(_0x512961['error'][_0xb7bc('0x18')]);}logger[_0xb7bc('0x16')](_0xb7bc('0x13'),_0x225160,_0x512961[_0xb7bc('0x16')]['message']);return _0x3b1f5a(_0x512961['error'][_0xb7bc('0x18')]);}else{logger[_0xb7bc('0x12')](_0xb7bc('0x13'),_0x225160,_0xb7bc('0x14'));_0x3b1f5a(_0x512961[_0xb7bc('0x19')][_0xb7bc('0x18')]);}})[_0xb7bc('0x1a')](function(_0x240926){logger[_0xb7bc('0x16')](_0xb7bc('0x13'),_0x225160,_0x240926);_0x46d051(_0x240926);});});}exports[_0xb7bc('0x1b')]=function(_0x29cae0){var _0x4265d7=this;return new Promise(function(_0x1dd95d,_0x3fafc0){return db[_0xb7bc('0x1c')][_0xb7bc('0x1d')](_0x29cae0[_0xb7bc('0x1e')],{'raw':_0x29cae0[_0xb7bc('0x1f')]?_0x29cae0[_0xb7bc('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29cae0[_0xb7bc('0x1f')]?_0x29cae0[_0xb7bc('0x1f')][_0xb7bc('0x20')]||null:null,'attributes':_0x29cae0[_0xb7bc('0x1f')]?_0x29cae0[_0xb7bc('0x1f')][_0xb7bc('0x21')]||null:null,'limit':_0x29cae0[_0xb7bc('0x1f')]?_0x29cae0[_0xb7bc('0x1f')][_0xb7bc('0x22')]||null:null})[_0xb7bc('0x11')](function(_0x4ad417){logger[_0xb7bc('0x12')](_0xb7bc('0x1b'),_0x29cae0);logger[_0xb7bc('0x15')](_0xb7bc('0x1b'),_0x29cae0,JSON[_0xb7bc('0x23')](_0x4ad417));_0x1dd95d(_0x4ad417);})[_0xb7bc('0x1a')](function(_0x3875ca){logger[_0xb7bc('0x16')](_0xb7bc('0x1b'),_0x3875ca[_0xb7bc('0x18')],_0x29cae0);_0x3fafc0(_0x4265d7[_0xb7bc('0x16')](0x1f4,_0x3875ca[_0xb7bc('0x18')]));});});};exports[_0xb7bc('0x24')]=function(_0xa588cf){return new Promise(function(_0x184594,_0x296c67){return db[_0xb7bc('0x1c')][_0xb7bc('0x25')]({'where':_0xa588cf[_0xb7bc('0x1f')]?_0xa588cf['options'][_0xb7bc('0x20')]||null:null})[_0xb7bc('0x11')](function(_0x35e21c){if(_0x35e21c){return _0x35e21c[_0xb7bc('0x26')](_0xa588cf[_0xb7bc('0x1e')][_0xb7bc('0x27')],_['omit'](_0xa588cf[_0xb7bc('0x1e')],[_0xb7bc('0x27'),'id'])||{});}})[_0xb7bc('0x28')](function(_0x59d245){logger[_0xb7bc('0x12')]('AddTags',_0xa588cf);logger['debug'](_0xb7bc('0x29'),_0xa588cf,JSON[_0xb7bc('0x23')](_0x59d245));_0x184594(_0x59d245);})['catch'](function(_0x37bc84){logger['error'](_0xb7bc('0x29'),_0x37bc84[_0xb7bc('0x18')],_0xa588cf);_0x296c67(_this['error'](0x1f4,_0x37bc84[_0xb7bc('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 5cbeb22..5435250 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 _0xf50c=['save','remove','removeListener','register','length'];(function(_0xc07e77,_0x131f5f){var _0x8a489e=function(_0x3cc02a){while(--_0x3cc02a){_0xc07e77['push'](_0xc07e77['shift']());}};_0x8a489e(++_0x131f5f);}(_0xf50c,0x1d6));var _0xcf50=function(_0x270037,_0xcb3091){_0x270037=_0x270037-0x0;var _0x4dc2b3=_0xf50c[_0x270037];return _0x4dc2b3;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0xcf50('0x0'),_0xcf50('0x1'),'update'];function createListener(_0x17a9f3,_0x2dec33){return function(_0x414d17){_0x2dec33['emit'](_0x17a9f3,_0x414d17);};}function removeListener(_0x4feed4,_0x26bfab){return function(){ChatInteractionEvents[_0xcf50('0x2')](_0x4feed4,_0x26bfab);};}exports[_0xcf50('0x3')]=function(_0x3c2c0){for(var _0x6e916c=0x0,_0x2bfa3e=events[_0xcf50('0x4')];_0x6e916c<_0x2bfa3e;_0x6e916c++){var _0x4f292c=events[_0x6e916c];var _0x3726b2=createListener('chatInteraction:'+_0x4f292c,_0x3c2c0);ChatInteractionEvents['on'](_0x4f292c,_0x3726b2);}}; \ No newline at end of file +var _0x4c25=['removeListener','chatInteraction:','./chatInteraction.events','save','remove','update','emit'];(function(_0x538333,_0x308de1){var _0x4f92b8=function(_0x289270){while(--_0x289270){_0x538333['push'](_0x538333['shift']());}};_0x4f92b8(++_0x308de1);}(_0x4c25,0x16e));var _0x54c2=function(_0x35f969,_0x2c03bd){_0x35f969=_0x35f969-0x0;var _0x373c46=_0x4c25[_0x35f969];return _0x373c46;};'use strict';var ChatInteractionEvents=require(_0x54c2('0x0'));var events=[_0x54c2('0x1'),_0x54c2('0x2'),_0x54c2('0x3')];function createListener(_0x221fb7,_0x9618c9){return function(_0x4f3795){_0x9618c9[_0x54c2('0x4')](_0x221fb7,_0x4f3795);};}function removeListener(_0x2c7c1b,_0x5a11f4){return function(){ChatInteractionEvents[_0x54c2('0x5')](_0x2c7c1b,_0x5a11f4);};}exports['register']=function(_0x4784f9){for(var _0x533d10=0x0,_0x5e7016=events['length'];_0x533d10<_0x5e7016;_0x533d10++){var _0xed1b05=events[_0x533d10];var _0x3c401a=createListener(_0x54c2('0x6')+_0xed1b05,_0x4784f9);ChatInteractionEvents['on'](_0xed1b05,_0x3c401a);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index fe32b84..b14bace 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 _0xefda=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','/describe','describe','/:id','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','create','diskStorage','join','root','server/files/attachments/','format','now','originalname','replace','post','/:id/attachment_upload','single','attachmentUpload','addMessage','tracked','chat','chatinteraction:addtags','addTags','chatinteraction:update','put','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','/:id/tags','removeTags','exports','multer','connect-timeout','express'];(function(_0x29d698,_0x2d63bc){var _0x493df3=function(_0x4bbe84){while(--_0x4bbe84){_0x29d698['push'](_0x29d698['shift']());}};_0x493df3(++_0x2d63bc);}(_0xefda,0x96));var _0xaefd=function(_0x4682ab,_0x47fc76){_0x4682ab=_0x4682ab-0x0;var _0x1043ac=_0xefda[_0x4682ab];return _0x1043ac;};'use strict';var multer=require(_0xaefd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaefd('0x1'));var express=require(_0xaefd('0x2'));var router=express['Router']();var auth=require(_0xaefd('0x3'));var interaction=require(_0xaefd('0x4'));var config=require(_0xaefd('0x5'));var controller=require(_0xaefd('0x6'));router[_0xaefd('0x7')]('/',auth[_0xaefd('0x8')](),controller['index']);router[_0xaefd('0x7')](_0xaefd('0x9'),auth[_0xaefd('0x8')](),controller[_0xaefd('0xa')]);router['get'](_0xaefd('0xb'),auth[_0xaefd('0xc')](),controller[_0xaefd('0xd')]);router['get']('/:id/attachment_download',auth['isChatInteractionAuthorized'](),controller[_0xaefd('0xe')]);router[_0xaefd('0x7')](_0xaefd('0xf'),auth[_0xaefd('0x8')](),controller[_0xaefd('0x10')]);router[_0xaefd('0x7')](_0xaefd('0x11'),auth[_0xaefd('0xc')](),controller[_0xaefd('0x12')]);router[_0xaefd('0x7')](_0xaefd('0x13'),auth['isAuthenticated'](),controller[_0xaefd('0x14')]);router['post']('/',auth[_0xaefd('0x8')](),controller[_0xaefd('0x15')]);var upload=multer({'storage':multer[_0xaefd('0x16')]({'destination':function(_0x43b82a,_0x4ec92a,_0x16e4f4){_0x16e4f4(null,path[_0xaefd('0x17')](config[_0xaefd('0x18')],_0xaefd('0x19')));},'filename':function(_0x10ee28,_0x32f75e,_0x277070){_0x277070(null,util[_0xaefd('0x1a')]('%s-%s',Date[_0xaefd('0x1b')](),_0x32f75e[_0xaefd('0x1c')][_0xaefd('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xaefd('0x1e')](_0xaefd('0x1f'),upload[_0xaefd('0x20')]('file'),controller[_0xaefd('0x21')]);router[_0xaefd('0x1e')](_0xaefd('0xf'),auth[_0xaefd('0xc')](),controller[_0xaefd('0x22')]);router[_0xaefd('0x1e')]('/:id/tags',auth[_0xaefd('0x8')](),interaction[_0xaefd('0x23')](_0xaefd('0x24'),_0xaefd('0x25')),controller[_0xaefd('0x26')]);router['put']('/:id',auth['isAuthenticated'](),interaction[_0xaefd('0x23')](_0xaefd('0x24'),_0xaefd('0x27')),controller['update']);router[_0xaefd('0x28')]('/:id/custom_update',controller[_0xaefd('0x29')]);router[_0xaefd('0x28')](_0xaefd('0x2a'),auth['isChatInteractionAuthorized'](),controller[_0xaefd('0x2b')]);router[_0xaefd('0x28')](_0xaefd('0x2c'),controller[_0xaefd('0x2d')]);router[_0xaefd('0x2e')]('/:id',auth[_0xaefd('0x8')](),interaction['tracked'](_0xaefd('0x24'),_0xaefd('0x2f')),controller['destroy']);router[_0xaefd('0x2e')](_0xaefd('0x30'),auth['isAuthenticated'](),controller[_0xaefd('0x31')]);module[_0xaefd('0x32')]=router; \ No newline at end of file +var _0x087b=['getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','diskStorage','join','root','format','%s-%s','now','replace','/:id/attachment_upload','single','attachmentUpload','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','/:id/abandon','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages'];(function(_0x5a9976,_0x3efed0){var _0x51cd51=function(_0x46ca2b){while(--_0x46ca2b){_0x5a9976['push'](_0x5a9976['shift']());}};_0x51cd51(++_0x3efed0);}(_0x087b,0x11a));var _0xb087=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x087b[_0x47fd36];return _0x21a0fc;};'use strict';var multer=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb087('0x2'));var router=express['Router']();var auth=require(_0xb087('0x3'));var interaction=require(_0xb087('0x4'));var config=require(_0xb087('0x5'));var controller=require(_0xb087('0x6'));router[_0xb087('0x7')]('/',auth[_0xb087('0x8')](),controller[_0xb087('0x9')]);router[_0xb087('0x7')](_0xb087('0xa'),auth[_0xb087('0x8')](),controller[_0xb087('0xb')]);router[_0xb087('0x7')](_0xb087('0xc'),auth[_0xb087('0xd')](),controller[_0xb087('0xe')]);router[_0xb087('0x7')](_0xb087('0xf'),auth['isChatInteractionAuthorized'](),controller[_0xb087('0x10')]);router[_0xb087('0x7')](_0xb087('0x11'),auth[_0xb087('0x8')](),controller[_0xb087('0x12')]);router[_0xb087('0x7')](_0xb087('0x13'),auth['isChatInteractionAuthorized'](),controller[_0xb087('0x14')]);router[_0xb087('0x7')](_0xb087('0x15'),auth['isAuthenticated'](),controller[_0xb087('0x16')]);router[_0xb087('0x17')]('/',auth[_0xb087('0x8')](),controller[_0xb087('0x18')]);var upload=multer({'storage':multer[_0xb087('0x19')]({'destination':function(_0x12d0db,_0x5e9757,_0x5147e3){_0x5147e3(null,path[_0xb087('0x1a')](config[_0xb087('0x1b')],'server/files/attachments/'));},'filename':function(_0x43e576,_0x412b48,_0x597478){_0x597478(null,util[_0xb087('0x1c')](_0xb087('0x1d'),Date[_0xb087('0x1e')](),_0x412b48['originalname'][_0xb087('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xb087('0x17')](_0xb087('0x20'),upload[_0xb087('0x21')]('file'),controller[_0xb087('0x22')]);router[_0xb087('0x17')](_0xb087('0x11'),auth[_0xb087('0xd')](),controller['addMessage']);router['post']('/:id/tags',auth['isAuthenticated'](),interaction[_0xb087('0x23')](_0xb087('0x24'),_0xb087('0x25')),controller[_0xb087('0x26')]);router[_0xb087('0x27')](_0xb087('0xc'),auth[_0xb087('0x8')](),interaction['tracked'](_0xb087('0x24'),_0xb087('0x28')),controller[_0xb087('0x29')]);router[_0xb087('0x27')](_0xb087('0x2a'),controller['customUpdate']);router[_0xb087('0x27')](_0xb087('0x2b'),auth['isChatInteractionAuthorized'](),controller['abandon']);router['put']('/:id/close',controller['close']);router[_0xb087('0x2c')](_0xb087('0xc'),auth[_0xb087('0x8')](),interaction[_0xb087('0x23')](_0xb087('0x24'),_0xb087('0x2d')),controller[_0xb087('0x2e')]);router[_0xb087('0x2c')](_0xb087('0x2f'),auth[_0xb087('0x8')](),controller[_0xb087('0x30')]);module[_0xb087('0x31')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index d65c9a9..4339988 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 _0x39e6=['TEXT','INTEGER','sequelize'];(function(_0x34f119,_0x22762c){var _0x1035df=function(_0x15a01b){while(--_0x15a01b){_0x34f119['push'](_0x34f119['shift']());}};_0x1035df(++_0x22762c);}(_0x39e6,0x9e));var _0x639e=function(_0x4e32bb,_0x5bf719){_0x4e32bb=_0x4e32bb-0x0;var _0x26e8b9=_0x39e6[_0x4e32bb];return _0x26e8b9;};'use strict';var Sequelize=require(_0x639e('0x0'));module['exports']={'body':{'type':Sequelize[_0x639e('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x639e('0x2')]}}; \ No newline at end of file +var _0x9fe7=['exports','medium','INTEGER','sequelize'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x9fe7,0x1df));var _0x79fe=function(_0x33b23d,_0x43052a){_0x33b23d=_0x33b23d-0x0;var _0x2eeb75=_0x9fe7[_0x33b23d];return _0x2eeb75;};'use strict';var Sequelize=require(_0x79fe('0x0'));module[_0x79fe('0x1')]={'body':{'type':Sequelize['TEXT'](_0x79fe('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x79fe('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index f548555..5529eb6 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 _0xcd87=['allowmessenger','showWebBar','-online','VoiceQueue','type','push','user','ToId','read','all','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','register','status','end','json','count','limit','set','Content-Range','apply','save','update','then','sendStatus','error','name','index','ChatInternalMessage','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','attributes','fields','length','nolimit','offset','sort','where','pick','add','day','merge','filter','map','includeAll','include','findAll','rows','catch','options','find','create','body','params','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','fullname','role','userpic','internal','online','lastLoginAt'];(function(_0x2d7223,_0x29deb1){var _0x54038d=function(_0x1aecd3){while(--_0x1aecd3){_0x2d7223['push'](_0x2d7223['shift']());}};_0x54038d(++_0x29deb1);}(_0xcd87,0x6e));var _0x7cd8=function(_0x33fe2b,_0x20705d){_0x33fe2b=_0x33fe2b-0x0;var _0x484bd6=_0xcd87[_0x33fe2b];return _0x484bd6;};'use strict';var pdf=require(_0x7cd8('0x0'));var emlformat=require(_0x7cd8('0x1'));var rimraf=require(_0x7cd8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7cd8('0x3'));var moment=require(_0x7cd8('0x4'));var BPromise=require(_0x7cd8('0x5'));var Mustache=require(_0x7cd8('0x6'));var util=require(_0x7cd8('0x7'));var path=require(_0x7cd8('0x8'));var sox=require(_0x7cd8('0x9'));var csv=require(_0x7cd8('0xa'));var ejs=require(_0x7cd8('0xb'));var fs=require('fs');var _=require(_0x7cd8('0xc'));var squel=require(_0x7cd8('0xd'));var crypto=require('crypto');var jsforce=require(_0x7cd8('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7cd8('0xf'));var Redis=require(_0x7cd8('0x10'));var qs=require(_0x7cd8('0x11'));var logger=require(_0x7cd8('0x12'))(_0x7cd8('0x13'));var utils=require(_0x7cd8('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x7cd8('0x15')]=_[_0x7cd8('0x16')](config[_0x7cd8('0x15')],{'host':_0x7cd8('0x17'),'port':0x18eb});var socket=require(_0x7cd8('0x18'))(new Redis(config[_0x7cd8('0x15')]));require('./chatInternalMessage.socket')[_0x7cd8('0x19')](socket);function respondWithStatusCode(_0x5c21bf,_0x5c9455){_0x5c9455=_0x5c9455||0xcc;return function(_0x3e4bcb){if(_0x3e4bcb){return _0x5c21bf['sendStatus'](_0x5c9455);}return _0x5c21bf[_0x7cd8('0x1a')](_0x5c9455)[_0x7cd8('0x1b')]();};}function respondWithResult(_0x559d3f,_0x564533){_0x564533=_0x564533||0xc8;return function(_0x17df7d){if(_0x17df7d){return _0x559d3f[_0x7cd8('0x1a')](_0x564533)[_0x7cd8('0x1c')](_0x17df7d);}};}function respondWithFilteredResult(_0x4d1017,_0x523aa9){return function(_0x4b7321){if(_0x4b7321){var _0x56b6e1=_0x4b7321[_0x7cd8('0x1d')],_0xf05a9a=_0x523aa9['offset'],_0x3314d8=_0x523aa9['offset']+_0x523aa9[_0x7cd8('0x1e')],_0x1733e6;if(_0x3314d8>=_0x56b6e1){_0x3314d8=_0x56b6e1;_0x1733e6=0xc8;}else{_0x1733e6=0xce;}_0x4d1017[_0x7cd8('0x1a')](_0x1733e6);return _0x4d1017[_0x7cd8('0x1f')](_0x7cd8('0x20'),_0xf05a9a+'-'+_0x3314d8+'/'+_0x56b6e1)[_0x7cd8('0x1c')](_0x4b7321);}return null;};}function patchUpdates(_0x49fba2){return function(_0x5f0bda){try{jsonpatch[_0x7cd8('0x21')](_0x5f0bda,_0x49fba2,!![]);}catch(_0x13cd96){return BPromise['reject'](_0x13cd96);}return _0x5f0bda[_0x7cd8('0x22')]();};}function saveUpdates(_0xbdee3b,_0x10f3e5){return function(_0x14e48a){if(_0x14e48a){return _0x14e48a[_0x7cd8('0x23')](_0xbdee3b)[_0x7cd8('0x24')](function(_0xcaaa9b){return _0xcaaa9b;});}return null;};}function removeEntity(_0x2f1089,_0x3df3d3){return function(_0x2a0993){if(_0x2a0993){return _0x2a0993['destroy']()[_0x7cd8('0x24')](function(){_0x2f1089[_0x7cd8('0x1a')](0xcc)[_0x7cd8('0x1b')]();});}};}function handleEntityNotFound(_0x17c76f,_0x279448){return function(_0x1a0601){if(!_0x1a0601){_0x17c76f[_0x7cd8('0x25')](0x194);}return _0x1a0601;};}function handleError(_0x22f781,_0x32f087){_0x32f087=_0x32f087||0x1f4;return function(_0xf68de){logger[_0x7cd8('0x26')](_0xf68de['stack']);if(_0xf68de[_0x7cd8('0x27')]){delete _0xf68de[_0x7cd8('0x27')];}_0x22f781[_0x7cd8('0x1a')](_0x32f087)['send'](_0xf68de);};}exports[_0x7cd8('0x28')]=function(_0x59f2a7,_0x1d33f4){var _0x3b22cd={},_0x580420={},_0x239399={'count':0x0,'rows':[]};var _0xa35203=db[_0x7cd8('0x29')][_0x7cd8('0x2a')];_0x580420[_0x7cd8('0x2b')]=_[_0x7cd8('0x2c')](_0xa35203);var _0x1bc33e={'dateStart':_0x59f2a7[_0x7cd8('0x2d')]['dateStart'],'dateEnd':_0x59f2a7[_0x7cd8('0x2d')][_0x7cd8('0x2e')]};delete _0x59f2a7['query'][_0x7cd8('0x2f')];delete _0x59f2a7[_0x7cd8('0x2d')][_0x7cd8('0x2e')];_0x580420[_0x7cd8('0x2d')]=_['keys'](_0x59f2a7[_0x7cd8('0x2d')]);_0x580420[_0x7cd8('0x30')]=_[_0x7cd8('0x31')](_0x580420[_0x7cd8('0x2b')],_0x580420[_0x7cd8('0x2d')]);_0x3b22cd[_0x7cd8('0x32')]=_['intersection'](_0x580420['model'],qs[_0x7cd8('0x33')](_0x59f2a7[_0x7cd8('0x2d')][_0x7cd8('0x33')]));_0x3b22cd[_0x7cd8('0x32')]=_0x3b22cd[_0x7cd8('0x32')][_0x7cd8('0x34')]?_0x3b22cd[_0x7cd8('0x32')]:_0x580420[_0x7cd8('0x2b')];if(!_0x59f2a7[_0x7cd8('0x2d')]['hasOwnProperty'](_0x7cd8('0x35'))){_0x3b22cd[_0x7cd8('0x1e')]=qs[_0x7cd8('0x1e')](_0x59f2a7['query'][_0x7cd8('0x1e')]);_0x3b22cd[_0x7cd8('0x36')]=qs[_0x7cd8('0x36')](_0x59f2a7[_0x7cd8('0x2d')][_0x7cd8('0x36')]);}_0x3b22cd['order']=qs[_0x7cd8('0x37')](_0x59f2a7[_0x7cd8('0x2d')][_0x7cd8('0x37')]);_0x3b22cd[_0x7cd8('0x38')]=qs[_0x7cd8('0x30')](_[_0x7cd8('0x39')](_0x59f2a7['query'],_0x580420[_0x7cd8('0x30')]));if(_0x1bc33e[_0x7cd8('0x2f')]){if(_0x1bc33e['dateEnd']){_0x1bc33e[_0x7cd8('0x2e')]=moment(_0x1bc33e[_0x7cd8('0x2e')])[_0x7cd8('0x3a')](0x1,_0x7cd8('0x3b'));}else{_0x1bc33e['dateEnd']=moment(_0x1bc33e[_0x7cd8('0x2f')])[_0x7cd8('0x3a')](0x1,_0x7cd8('0x3b'));}_[_0x7cd8('0x3c')](_0x3b22cd[_0x7cd8('0x38')],{'createdAt':{'$gte':_0x1bc33e['dateStart'],'$lte':_0x1bc33e['dateEnd']}});}if(_0x59f2a7[_0x7cd8('0x2d')][_0x7cd8('0x3d')]){_0x3b22cd[_0x7cd8('0x38')]=_['merge'](_0x3b22cd[_0x7cd8('0x38')],{'$or':_[_0x7cd8('0x3e')](_0x3b22cd[_0x7cd8('0x32')],function(_0x9b3534){var _0x41feed={};_0x41feed[_0x9b3534]={'$like':'%'+_0x59f2a7[_0x7cd8('0x2d')]['filter']+'%'};return _0x41feed;})});}_0x3b22cd=_[_0x7cd8('0x3c')]({},_0x3b22cd,_0x59f2a7['options']);var _0x5c6a94={'where':_0x3b22cd[_0x7cd8('0x38')]};return db[_0x7cd8('0x29')]['count'](_0x5c6a94)[_0x7cd8('0x24')](function(_0x1548b6){_0x239399[_0x7cd8('0x1d')]=_0x1548b6;if(_0x59f2a7['query'][_0x7cd8('0x3f')]){_0x3b22cd[_0x7cd8('0x40')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x7cd8('0x41')](_0x3b22cd);})[_0x7cd8('0x24')](function(_0x42dafd){_0x239399[_0x7cd8('0x42')]=_0x42dafd;return _0x239399;})['then'](respondWithFilteredResult(_0x1d33f4,_0x3b22cd))[_0x7cd8('0x43')](handleError(_0x1d33f4,null));};exports['show']=function(_0x11b64c,_0x376dc6){var _0x5aa110={'raw':!![],'where':{'id':_0x11b64c['params']['id']}},_0x105bac={};_0x105bac['model']=_[_0x7cd8('0x2c')](db[_0x7cd8('0x29')][_0x7cd8('0x2a')]);_0x105bac[_0x7cd8('0x2d')]=_[_0x7cd8('0x2c')](_0x11b64c[_0x7cd8('0x2d')]);_0x105bac[_0x7cd8('0x30')]=_[_0x7cd8('0x31')](_0x105bac['model'],_0x105bac[_0x7cd8('0x2d')]);_0x5aa110[_0x7cd8('0x32')]=_['intersection'](_0x105bac['model'],qs[_0x7cd8('0x33')](_0x11b64c[_0x7cd8('0x2d')][_0x7cd8('0x33')]));_0x5aa110[_0x7cd8('0x32')]=_0x5aa110[_0x7cd8('0x32')][_0x7cd8('0x34')]?_0x5aa110[_0x7cd8('0x32')]:_0x105bac['model'];if(_0x11b64c[_0x7cd8('0x2d')][_0x7cd8('0x3f')]){_0x5aa110[_0x7cd8('0x40')]=[{'all':!![]}];}_0x5aa110=_[_0x7cd8('0x3c')]({},_0x5aa110,_0x11b64c[_0x7cd8('0x44')]);return db[_0x7cd8('0x29')][_0x7cd8('0x45')](_0x5aa110)[_0x7cd8('0x24')](handleEntityNotFound(_0x376dc6,null))[_0x7cd8('0x24')](respondWithResult(_0x376dc6,null))[_0x7cd8('0x43')](handleError(_0x376dc6,null));};exports[_0x7cd8('0x46')]=function(_0x54c3af,_0x3f112c){return db[_0x7cd8('0x29')][_0x7cd8('0x46')](_0x54c3af[_0x7cd8('0x47')],{})[_0x7cd8('0x24')](respondWithResult(_0x3f112c,0xc9))[_0x7cd8('0x43')](handleError(_0x3f112c,null));};exports[_0x7cd8('0x23')]=function(_0x19655c,_0x501101){if(_0x19655c['body']['id']){delete _0x19655c[_0x7cd8('0x47')]['id'];}return db[_0x7cd8('0x29')][_0x7cd8('0x45')]({'where':{'id':_0x19655c['params']['id']}})[_0x7cd8('0x24')](handleEntityNotFound(_0x501101,null))['then'](saveUpdates(_0x19655c[_0x7cd8('0x47')],null))['then'](respondWithResult(_0x501101,null))[_0x7cd8('0x43')](handleError(_0x501101,null));};exports['destroy']=function(_0x403649,_0x5eec7d){return db[_0x7cd8('0x29')][_0x7cd8('0x45')]({'where':{'id':_0x403649[_0x7cd8('0x48')]['id']}})[_0x7cd8('0x24')](handleEntityNotFound(_0x5eec7d,null))[_0x7cd8('0x24')](removeEntity(_0x5eec7d,null))[_0x7cd8('0x43')](handleError(_0x5eec7d,null));};exports['describe']=function(_0x3f8e95,_0x2dc485){return db[_0x7cd8('0x29')]['describe']()[_0x7cd8('0x24')](respondWithResult(_0x2dc485,null))[_0x7cd8('0x43')](handleError(_0x2dc485,null));};function wrapUser(_0x248ff9){return function(_0x196f55){var _0x418a69=_0x248ff9[_0x7cd8('0x49')]({'plain':!![]});_0x418a69[_0x7cd8('0x4a')]=[];if(_0x196f55){_0x418a69[_0x7cd8('0x4b')]=_0x196f55[_0x7cd8('0x4c')];_0x418a69[_0x7cd8('0x4d')]=_0x196f55;}else{_0x418a69[_0x7cd8('0x4b')]=moment(0x0)[_0x7cd8('0x4e')](_0x7cd8('0x4f'));_0x418a69[_0x7cd8('0x4d')]={};}return _0x418a69;};}exports[_0x7cd8('0x50')]=function(_0x32f40d,_0x2fd36f,_0x2c9bf2){var _0xa816dd=[];return db[_0x7cd8('0x51')][_0x7cd8('0x41')]({'where':{'role':[_0x7cd8('0x52'),_0x7cd8('0x53'),'user']},'attributes':['id',_0x7cd8('0x54'),_0x7cd8('0x27'),_0x7cd8('0x55'),_0x7cd8('0x56'),_0x7cd8('0x57'),_0x7cd8('0x58'),_0x7cd8('0x59'),_0x7cd8('0x5a'),_0x7cd8('0x5b')],'order':qs[_0x7cd8('0x37')](_0x7cd8('0x5c')),'include':[{'model':db[_0x7cd8('0x5d')],'as':'VoiceQueues','attributes':['id',_0x7cd8('0x27'),_0x7cd8('0x5e')],'through':{'attributes':[]}}]})['then'](function(_0x551a97){var _0x484f49=[];if(_0x551a97){_0xa816dd=_0x551a97;for(var _0x13f779=0x0;_0x13f779<_0x551a97['length'];_0x13f779+=0x1){_0xa816dd[_0x13f779][_0x7cd8('0x4a')]=[];_0x484f49[_0x7cd8('0x5f')](db['ChatInternalMessage'][_0x7cd8('0x45')]({'where':{'FromId':[_0x32f40d[_0x7cd8('0x60')]['id'],_0x551a97[_0x13f779]['id']],'ToId':[_0x32f40d['user']['id'],_0x551a97[_0x13f779]['id']],'ChatGroupId':null},'attributes':['id',_0x7cd8('0x4c'),'FromId',_0x7cd8('0x61'),_0x7cd8('0x62'),'body'],'order':qs[_0x7cd8('0x37')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x7cd8('0x24')](wrapUser(_0x551a97[_0x13f779])));}return BPromise[_0x7cd8('0x63')](_0x484f49);}return[];})[_0x7cd8('0x24')](function(_0x4bd1f4){return{'rows':_0x4bd1f4,'count':_0x4bd1f4['length']};})['then'](respondWithResult(_0x2fd36f,null))[_0x7cd8('0x43')](handleError(_0x2fd36f,null));}; \ No newline at end of file +var _0x556e=['ToId','read','-createdAt','eml-format','rimraf','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','register','sendStatus','status','json','count','offset','limit','set','Content-Range','save','update','destroy','then','end','name','send','index','ChatInternalMessage','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','day','add','merge','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','body','describe','get','lastMessage','lastMessageAt','format','getUsers','agent','admin','user','fullname','internal','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','type','messages','push','createdAt','FromId'];(function(_0x36c7fe,_0x1dafe9){var _0x59119b=function(_0x31758f){while(--_0x31758f){_0x36c7fe['push'](_0x36c7fe['shift']());}};_0x59119b(++_0x1dafe9);}(_0x556e,0xc1));var _0xe556=function(_0x4553e8,_0x480e3c){_0x4553e8=_0x4553e8-0x0;var _0x99e41=_0x556e[_0x4553e8];return _0x99e41;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe556('0x0'));var rimraf=require(_0xe556('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe556('0x2'));var rp=require(_0xe556('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe556('0x4'));var util=require('util');var path=require('path');var sox=require(_0xe556('0x5'));var csv=require(_0xe556('0x6'));var ejs=require(_0xe556('0x7'));var fs=require('fs');var _=require(_0xe556('0x8'));var squel=require(_0xe556('0x9'));var crypto=require(_0xe556('0xa'));var jsforce=require(_0xe556('0xb'));var deskjs=require(_0xe556('0xc'));var toCsv=require(_0xe556('0x6'));var querystring=require(_0xe556('0xd'));var Papa=require('papaparse');var Redis=require(_0xe556('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0xe556('0xf'))(_0xe556('0x10'));var utils=require('../../config/utils');var config=require(_0xe556('0x11'));var db=require(_0xe556('0x12'))['db'];config['redis']=_[_0xe556('0x13')](config[_0xe556('0x14')],{'host':_0xe556('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe556('0x14')]));require('./chatInternalMessage.socket')[_0xe556('0x16')](socket);function respondWithStatusCode(_0x159b54,_0x2ffade){_0x2ffade=_0x2ffade||0xcc;return function(_0x1665dc){if(_0x1665dc){return _0x159b54[_0xe556('0x17')](_0x2ffade);}return _0x159b54[_0xe556('0x18')](_0x2ffade)['end']();};}function respondWithResult(_0x3e4fbb,_0x3e1137){_0x3e1137=_0x3e1137||0xc8;return function(_0x961681){if(_0x961681){return _0x3e4fbb[_0xe556('0x18')](_0x3e1137)[_0xe556('0x19')](_0x961681);}};}function respondWithFilteredResult(_0x22441a,_0x20cddc){return function(_0x11a64d){if(_0x11a64d){var _0x37ed8b=_0x11a64d[_0xe556('0x1a')],_0x4139c6=_0x20cddc[_0xe556('0x1b')],_0x37a7e3=_0x20cddc['offset']+_0x20cddc[_0xe556('0x1c')],_0x57c16b;if(_0x37a7e3>=_0x37ed8b){_0x37a7e3=_0x37ed8b;_0x57c16b=0xc8;}else{_0x57c16b=0xce;}_0x22441a['status'](_0x57c16b);return _0x22441a[_0xe556('0x1d')](_0xe556('0x1e'),_0x4139c6+'-'+_0x37a7e3+'/'+_0x37ed8b)[_0xe556('0x19')](_0x11a64d);}return null;};}function patchUpdates(_0xce794e){return function(_0x17ac0f){try{jsonpatch['apply'](_0x17ac0f,_0xce794e,!![]);}catch(_0x487779){return BPromise['reject'](_0x487779);}return _0x17ac0f[_0xe556('0x1f')]();};}function saveUpdates(_0xd49163,_0x313535){return function(_0x5ccfb5){if(_0x5ccfb5){return _0x5ccfb5[_0xe556('0x20')](_0xd49163)['then'](function(_0x35c401){return _0x35c401;});}return null;};}function removeEntity(_0x4a3cfc,_0x42424b){return function(_0x57df90){if(_0x57df90){return _0x57df90[_0xe556('0x21')]()[_0xe556('0x22')](function(){_0x4a3cfc[_0xe556('0x18')](0xcc)[_0xe556('0x23')]();});}};}function handleEntityNotFound(_0x4333b5,_0x423a06){return function(_0x5d4a15){if(!_0x5d4a15){_0x4333b5[_0xe556('0x17')](0x194);}return _0x5d4a15;};}function handleError(_0x99468,_0x665811){_0x665811=_0x665811||0x1f4;return function(_0x299324){logger['error'](_0x299324['stack']);if(_0x299324[_0xe556('0x24')]){delete _0x299324['name'];}_0x99468[_0xe556('0x18')](_0x665811)[_0xe556('0x25')](_0x299324);};}exports[_0xe556('0x26')]=function(_0x5b450d,_0xfd8d4f){var _0x4fd0fe={},_0x4f9f0e={},_0x132ad7={'count':0x0,'rows':[]};var _0x23f2db=db[_0xe556('0x27')]['rawAttributes'];_0x4f9f0e[_0xe556('0x28')]=_['keys'](_0x23f2db);var _0x20b12e={'dateStart':_0x5b450d[_0xe556('0x29')][_0xe556('0x2a')],'dateEnd':_0x5b450d[_0xe556('0x29')][_0xe556('0x2b')]};delete _0x5b450d['query'][_0xe556('0x2a')];delete _0x5b450d[_0xe556('0x29')][_0xe556('0x2b')];_0x4f9f0e[_0xe556('0x29')]=_[_0xe556('0x2c')](_0x5b450d[_0xe556('0x29')]);_0x4f9f0e[_0xe556('0x2d')]=_[_0xe556('0x2e')](_0x4f9f0e[_0xe556('0x28')],_0x4f9f0e[_0xe556('0x29')]);_0x4fd0fe[_0xe556('0x2f')]=_[_0xe556('0x2e')](_0x4f9f0e['model'],qs[_0xe556('0x30')](_0x5b450d[_0xe556('0x29')]['fields']));_0x4fd0fe['attributes']=_0x4fd0fe[_0xe556('0x2f')][_0xe556('0x31')]?_0x4fd0fe['attributes']:_0x4f9f0e[_0xe556('0x28')];if(!_0x5b450d[_0xe556('0x29')][_0xe556('0x32')](_0xe556('0x33'))){_0x4fd0fe[_0xe556('0x1c')]=qs['limit'](_0x5b450d[_0xe556('0x29')][_0xe556('0x1c')]);_0x4fd0fe[_0xe556('0x1b')]=qs[_0xe556('0x1b')](_0x5b450d['query'][_0xe556('0x1b')]);}_0x4fd0fe[_0xe556('0x34')]=qs[_0xe556('0x35')](_0x5b450d['query'][_0xe556('0x35')]);_0x4fd0fe[_0xe556('0x36')]=qs[_0xe556('0x2d')](_['pick'](_0x5b450d['query'],_0x4f9f0e[_0xe556('0x2d')]));if(_0x20b12e['dateStart']){if(_0x20b12e[_0xe556('0x2b')]){_0x20b12e['dateEnd']=moment(_0x20b12e[_0xe556('0x2b')])['add'](0x1,_0xe556('0x37'));}else{_0x20b12e[_0xe556('0x2b')]=moment(_0x20b12e[_0xe556('0x2a')])[_0xe556('0x38')](0x1,_0xe556('0x37'));}_[_0xe556('0x39')](_0x4fd0fe[_0xe556('0x36')],{'createdAt':{'$gte':_0x20b12e['dateStart'],'$lte':_0x20b12e['dateEnd']}});}if(_0x5b450d['query']['filter']){_0x4fd0fe[_0xe556('0x36')]=_['merge'](_0x4fd0fe[_0xe556('0x36')],{'$or':_['map'](_0x4fd0fe[_0xe556('0x2f')],function(_0x421c6a){var _0x765d14={};_0x765d14[_0x421c6a]={'$like':'%'+_0x5b450d[_0xe556('0x29')][_0xe556('0x3a')]+'%'};return _0x765d14;})});}_0x4fd0fe=_[_0xe556('0x39')]({},_0x4fd0fe,_0x5b450d['options']);var _0x29c831={'where':_0x4fd0fe[_0xe556('0x36')]};return db[_0xe556('0x27')][_0xe556('0x1a')](_0x29c831)['then'](function(_0x115b1b){_0x132ad7['count']=_0x115b1b;if(_0x5b450d[_0xe556('0x29')][_0xe556('0x3b')]){_0x4fd0fe[_0xe556('0x3c')]=[{'all':!![]}];}return db[_0xe556('0x27')][_0xe556('0x3d')](_0x4fd0fe);})['then'](function(_0x3ad3f1){_0x132ad7[_0xe556('0x3e')]=_0x3ad3f1;return _0x132ad7;})[_0xe556('0x22')](respondWithFilteredResult(_0xfd8d4f,_0x4fd0fe))[_0xe556('0x3f')](handleError(_0xfd8d4f,null));};exports[_0xe556('0x40')]=function(_0x359545,_0x37cddc){var _0x14fca2={'raw':!![],'where':{'id':_0x359545[_0xe556('0x41')]['id']}},_0x2aefaf={};_0x2aefaf[_0xe556('0x28')]=_[_0xe556('0x2c')](db[_0xe556('0x27')][_0xe556('0x42')]);_0x2aefaf[_0xe556('0x29')]=_[_0xe556('0x2c')](_0x359545[_0xe556('0x29')]);_0x2aefaf[_0xe556('0x2d')]=_[_0xe556('0x2e')](_0x2aefaf['model'],_0x2aefaf['query']);_0x14fca2[_0xe556('0x2f')]=_[_0xe556('0x2e')](_0x2aefaf[_0xe556('0x28')],qs[_0xe556('0x30')](_0x359545['query'][_0xe556('0x30')]));_0x14fca2[_0xe556('0x2f')]=_0x14fca2[_0xe556('0x2f')]['length']?_0x14fca2['attributes']:_0x2aefaf[_0xe556('0x28')];if(_0x359545['query'][_0xe556('0x3b')]){_0x14fca2[_0xe556('0x3c')]=[{'all':!![]}];}_0x14fca2=_['merge']({},_0x14fca2,_0x359545[_0xe556('0x43')]);return db['ChatInternalMessage'][_0xe556('0x44')](_0x14fca2)[_0xe556('0x22')](handleEntityNotFound(_0x37cddc,null))[_0xe556('0x22')](respondWithResult(_0x37cddc,null))[_0xe556('0x3f')](handleError(_0x37cddc,null));};exports['create']=function(_0x3bc536,_0x47a568){return db[_0xe556('0x27')]['create'](_0x3bc536[_0xe556('0x45')],{})['then'](respondWithResult(_0x47a568,0xc9))[_0xe556('0x3f')](handleError(_0x47a568,null));};exports[_0xe556('0x20')]=function(_0x57bf67,_0x2cf727){if(_0x57bf67[_0xe556('0x45')]['id']){delete _0x57bf67[_0xe556('0x45')]['id'];}return db[_0xe556('0x27')]['find']({'where':{'id':_0x57bf67[_0xe556('0x41')]['id']}})['then'](handleEntityNotFound(_0x2cf727,null))['then'](saveUpdates(_0x57bf67[_0xe556('0x45')],null))[_0xe556('0x22')](respondWithResult(_0x2cf727,null))[_0xe556('0x3f')](handleError(_0x2cf727,null));};exports[_0xe556('0x21')]=function(_0x11ed24,_0x2fa0e0){return db[_0xe556('0x27')][_0xe556('0x44')]({'where':{'id':_0x11ed24[_0xe556('0x41')]['id']}})[_0xe556('0x22')](handleEntityNotFound(_0x2fa0e0,null))[_0xe556('0x22')](removeEntity(_0x2fa0e0,null))[_0xe556('0x3f')](handleError(_0x2fa0e0,null));};exports[_0xe556('0x46')]=function(_0x348f80,_0x112c1d){return db['ChatInternalMessage'][_0xe556('0x46')]()['then'](respondWithResult(_0x112c1d,null))['catch'](handleError(_0x112c1d,null));};function wrapUser(_0x5c3e8c){return function(_0x18d61d){var _0x50165b=_0x5c3e8c[_0xe556('0x47')]({'plain':!![]});_0x50165b['messages']=[];if(_0x18d61d){_0x50165b['lastMessageAt']=_0x18d61d['createdAt'];_0x50165b[_0xe556('0x48')]=_0x18d61d;}else{_0x50165b[_0xe556('0x49')]=moment(0x0)[_0xe556('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x50165b[_0xe556('0x48')]={};}return _0x50165b;};}exports[_0xe556('0x4b')]=function(_0x39c886,_0x556a3e,_0x3bdf26){var _0x9e2601=[];return db['User'][_0xe556('0x3d')]({'where':{'role':[_0xe556('0x4c'),_0xe556('0x4d'),_0xe556('0x4e')]},'attributes':['id',_0xe556('0x4f'),'name','role','userpic',_0xe556('0x50'),'online',_0xe556('0x51'),_0xe556('0x52'),_0xe556('0x53')],'order':qs['sort'](_0xe556('0x54')),'include':[{'model':db[_0xe556('0x55')],'as':_0xe556('0x56'),'attributes':['id',_0xe556('0x24'),_0xe556('0x57')],'through':{'attributes':[]}}]})[_0xe556('0x22')](function(_0x2d9e59){var _0x5a4ec4=[];if(_0x2d9e59){_0x9e2601=_0x2d9e59;for(var _0x16ea0b=0x0;_0x16ea0b<_0x2d9e59[_0xe556('0x31')];_0x16ea0b+=0x1){_0x9e2601[_0x16ea0b][_0xe556('0x58')]=[];_0x5a4ec4[_0xe556('0x59')](db['ChatInternalMessage'][_0xe556('0x44')]({'where':{'FromId':[_0x39c886[_0xe556('0x4e')]['id'],_0x2d9e59[_0x16ea0b]['id']],'ToId':[_0x39c886[_0xe556('0x4e')]['id'],_0x2d9e59[_0x16ea0b]['id']],'ChatGroupId':null},'attributes':['id',_0xe556('0x5a'),_0xe556('0x5b'),_0xe556('0x5c'),_0xe556('0x5d'),'body'],'order':qs[_0xe556('0x35')](_0xe556('0x5e')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xe556('0x22')](wrapUser(_0x2d9e59[_0x16ea0b])));}return BPromise['all'](_0x5a4ec4);}return[];})['then'](function(_0x5ccac1){return{'rows':_0x5ccac1,'count':_0x5ccac1[_0xe556('0x31')]};})[_0xe556('0x22')](respondWithResult(_0x556a3e,null))['catch'](handleError(_0x556a3e,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 8afa2c2..c34458f 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 _0xa0ff=['save','update','remove','emit','exports','events','../../mysqldb','setMaxListeners'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa0ff,0xb5));var _0xfa0f=function(_0x122481,_0x4ab9ec){_0x122481=_0x122481-0x0;var _0x8f8026=_0xa0ff[_0x122481];return _0x8f8026;};'use strict';var EventEmitter=require(_0xfa0f('0x0'));var ChatInternalMessage=require(_0xfa0f('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xfa0f('0x2')](0x0);var events={'afterCreate':_0xfa0f('0x3'),'afterUpdate':_0xfa0f('0x4'),'afterDestroy':_0xfa0f('0x5')};function emitEvent(_0x406b52){return function(_0x6ac2d0,_0x3d6bac,_0xc115ec){ChatInternalMessageEvents[_0xfa0f('0x6')](_0x406b52+':'+_0x6ac2d0['id'],_0x6ac2d0);ChatInternalMessageEvents[_0xfa0f('0x6')](_0x406b52,_0x6ac2d0);_0xc115ec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xfa0f('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xb39e=['ChatInternalMessage','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x498202,_0x4c36e9){var _0x5c8508=function(_0x5ea374){while(--_0x5ea374){_0x498202['push'](_0x498202['shift']());}};_0x5c8508(++_0x4c36e9);}(_0xb39e,0x19c));var _0xeb39=function(_0xb7202,_0x4aa500){_0xb7202=_0xb7202-0x0;var _0x6488bb=_0xb39e[_0xb7202];return _0x6488bb;};'use strict';var EventEmitter=require(_0xeb39('0x0'));var ChatInternalMessage=require(_0xeb39('0x1'))['db'][_0xeb39('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xeb39('0x3'),'afterUpdate':_0xeb39('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1c260e){return function(_0x1fd242,_0x1d0ee1,_0x2322de){ChatInternalMessageEvents[_0xeb39('0x5')](_0x1c260e+':'+_0x1fd242['id'],_0x1fd242);ChatInternalMessageEvents['emit'](_0x1c260e,_0x1fd242);_0x2322de(null);};}for(var e in events){if(events[_0xeb39('0x6')](e)){var event=events[e];ChatInternalMessage[_0xeb39('0x7')](e,emitEvent(event));}}module[_0xeb39('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 6577255..11ebeb6 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 _0x3df1=['moment','bluebird','request-promise','./chatInternalMessage.attributes','define','ChatInternalMessage','chat_internal_messages','utf8mb4','lodash'];(function(_0x53634b,_0x214b9d){var _0x2faeef=function(_0x4a29f2){while(--_0x4a29f2){_0x53634b['push'](_0x53634b['shift']());}};_0x2faeef(++_0x214b9d);}(_0x3df1,0xe0));var _0x13df=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x3df1[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x13df('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x13df('0x1'));var BPromise=require(_0x13df('0x2'));var rp=require(_0x13df('0x3'));var attributes=require(_0x13df('0x4'));module['exports']=function(_0x330c5d,_0x37cce4){return _0x330c5d[_0x13df('0x5')](_0x13df('0x6'),attributes,{'tableName':_0x13df('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x13df('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x65b6=['moment','request-promise','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','lodash','../../config/logger','api'];(function(_0x3381bb,_0x1abf66){var _0x458589=function(_0x230fea){while(--_0x230fea){_0x3381bb['push'](_0x3381bb['shift']());}};_0x458589(++_0x1abf66);}(_0x65b6,0x8c));var _0x665b=function(_0x593190,_0x4c846c){_0x593190=_0x593190-0x0;var _0x1a62ed=_0x65b6[_0x593190];return _0x1a62ed;};'use strict';var _=require(_0x665b('0x0'));var util=require('util');var logger=require(_0x665b('0x1'))(_0x665b('0x2'));var moment=require(_0x665b('0x3'));var BPromise=require('bluebird');var rp=require(_0x665b('0x4'));var attributes=require(_0x665b('0x5'));module[_0x665b('0x6')]=function(_0x4c43e1,_0x145b74){return _0x4c43e1[_0x665b('0x7')](_0x665b('0x8'),attributes,{'tableName':_0x665b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x665b('0xa'),'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 d0361ac..cd0f064 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 _0x1657=['stringify','error','code','message','result','catch','util','moment','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x1657,0x6a));var _0x7165=function(_0x4e8e40,_0x2737b2){_0x4e8e40=_0x4e8e40-0x0;var _0x453fcb=_0x1657[_0x4e8e40];return _0x453fcb;};'use strict';var _=require('lodash');var util=require(_0x7165('0x0'));var moment=require(_0x7165('0x1'));var BPromise=require(_0x7165('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7165('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7165('0x4'));var config=require(_0x7165('0x5'));var jayson=require(_0x7165('0x6'));var client=jayson['client'][_0x7165('0x7')]({'port':0x232a});config['redis']=_[_0x7165('0x8')](config[_0x7165('0x9')],{'host':_0x7165('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7165('0x9')]));require(_0x7165('0xb'))[_0x7165('0xc')](socket);function respondWithRpcPromise(_0x32e50e,_0x1e7654,_0x4c4ee7){return new BPromise(function(_0x265f96,_0x1b0da3){return client[_0x7165('0xd')](_0x32e50e,_0x4c4ee7)[_0x7165('0xe')](function(_0x5aa6e0){logger[_0x7165('0xf')](_0x7165('0x10'),_0x1e7654,'request\x20sent');logger[_0x7165('0x11')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x1e7654,_0x7165('0x12'),JSON[_0x7165('0x13')](_0x5aa6e0));if(_0x5aa6e0[_0x7165('0x14')]){if(_0x5aa6e0['error'][_0x7165('0x15')]===0x1f4){logger[_0x7165('0x14')](_0x7165('0x10'),_0x1e7654,_0x5aa6e0[_0x7165('0x14')]['message']);return _0x1b0da3(_0x5aa6e0[_0x7165('0x14')][_0x7165('0x16')]);}logger[_0x7165('0x14')](_0x7165('0x10'),_0x1e7654,_0x5aa6e0['error'][_0x7165('0x16')]);return _0x265f96(_0x5aa6e0[_0x7165('0x14')]['message']);}else{logger[_0x7165('0xf')](_0x7165('0x10'),_0x1e7654,_0x7165('0x12'));_0x265f96(_0x5aa6e0[_0x7165('0x17')][_0x7165('0x16')]);}})[_0x7165('0x18')](function(_0x5298c7){logger['error'](_0x7165('0x10'),_0x1e7654,_0x5298c7);_0x1b0da3(_0x5298c7);});});} \ No newline at end of file +var _0x15a4=['rpc','../../config/environment','redis','defaults','localhost','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x17491b,_0x2bcf0a){var _0x144c44=function(_0x2d1d6e){while(--_0x2d1d6e){_0x17491b['push'](_0x17491b['shift']());}};_0x144c44(++_0x2bcf0a);}(_0x15a4,0x191));var _0x415a=function(_0x564033,_0x150b24){_0x564033=_0x564033-0x0;var _0x3d3329=_0x15a4[_0x564033];return _0x3d3329;};'use strict';var _=require(_0x415a('0x0'));var util=require(_0x415a('0x1'));var moment=require(_0x415a('0x2'));var BPromise=require(_0x415a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x415a('0x4'));var db=require(_0x415a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x415a('0x6'))(_0x415a('0x7'));var config=require(_0x415a('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x415a('0x9')]=_[_0x415a('0xa')](config[_0x415a('0x9')],{'host':_0x415a('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x415a('0x9')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2c3695,_0x553204,_0x2b3a91){return new BPromise(function(_0x15b097,_0x548159){return client[_0x415a('0xc')](_0x2c3695,_0x2b3a91)[_0x415a('0xd')](function(_0x4077a6){logger[_0x415a('0xe')](_0x415a('0xf'),_0x553204,'request\x20sent');logger[_0x415a('0x10')](_0x415a('0x11'),_0x553204,_0x415a('0x12'),JSON[_0x415a('0x13')](_0x4077a6));if(_0x4077a6['error']){if(_0x4077a6[_0x415a('0x14')][_0x415a('0x15')]===0x1f4){logger[_0x415a('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x553204,_0x4077a6['error'][_0x415a('0x16')]);return _0x548159(_0x4077a6[_0x415a('0x14')][_0x415a('0x16')]);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x553204,_0x4077a6['error'][_0x415a('0x16')]);return _0x15b097(_0x4077a6[_0x415a('0x14')]['message']);}else{logger[_0x415a('0xe')](_0x415a('0xf'),_0x553204,_0x415a('0x12'));_0x15b097(_0x4077a6[_0x415a('0x17')][_0x415a('0x16')]);}})['catch'](function(_0x22999c){logger[_0x415a('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x553204,_0x22999c);_0x548159(_0x22999c);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index ae77be3..aa431e3 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 _0x656a=['./chatInternalMessage.events','save','update','emit','removeListener','length'];(function(_0x821df7,_0x2eed7c){var _0x5bfc26=function(_0x3f2ed5){while(--_0x3f2ed5){_0x821df7['push'](_0x821df7['shift']());}};_0x5bfc26(++_0x2eed7c);}(_0x656a,0x78));var _0xa656=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0x656a[_0x57486e];return _0x5f110b;};'use strict';var ChatInternalMessageEvents=require(_0xa656('0x0'));var events=[_0xa656('0x1'),'remove',_0xa656('0x2')];function createListener(_0x154448,_0xbaa4ec){return function(_0x461df8){_0xbaa4ec[_0xa656('0x3')](_0x154448,_0x461df8);};}function removeListener(_0x2ba7f6,_0x38843e){return function(){ChatInternalMessageEvents[_0xa656('0x4')](_0x2ba7f6,_0x38843e);};}exports['register']=function(_0x4ae81f){for(var _0x41b986=0x0,_0x469513=events[_0xa656('0x5')];_0x41b986<_0x469513;_0x41b986++){var _0x4b3113=events[_0x41b986];var _0x160b62=createListener('chatInternalMessage:'+_0x4b3113,_0x4ae81f);ChatInternalMessageEvents['on'](_0x4b3113,_0x160b62);}}; \ No newline at end of file +var _0xbf22=['emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove','update'];(function(_0x5e07a7,_0x1438b3){var _0x22ced5=function(_0x7c975b){while(--_0x7c975b){_0x5e07a7['push'](_0x5e07a7['shift']());}};_0x22ced5(++_0x1438b3);}(_0xbf22,0xb9));var _0x2bf2=function(_0x469a3a,_0x283270){_0x469a3a=_0x469a3a-0x0;var _0xf8a8f8=_0xbf22[_0x469a3a];return _0xf8a8f8;};'use strict';var ChatInternalMessageEvents=require(_0x2bf2('0x0'));var events=[_0x2bf2('0x1'),_0x2bf2('0x2'),_0x2bf2('0x3')];function createListener(_0x594bfa,_0x43bbc3){return function(_0x208dc1){_0x43bbc3[_0x2bf2('0x4')](_0x594bfa,_0x208dc1);};}function removeListener(_0x4a8b7d,_0x7959d6){return function(){ChatInternalMessageEvents[_0x2bf2('0x5')](_0x4a8b7d,_0x7959d6);};}exports[_0x2bf2('0x6')]=function(_0x4bb87d){for(var _0x3729e8=0x0,_0x2e5f8a=events[_0x2bf2('0x7')];_0x3729e8<_0x2e5f8a;_0x3729e8++){var _0x90a86c=events[_0x3729e8];var _0x1c4866=createListener(_0x2bf2('0x8')+_0x90a86c,_0x4bb87d);ChatInternalMessageEvents['on'](_0x90a86c,_0x1c4866);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 7ae8570..fb632e8 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 _0x89d6=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','/:id','show','create','put','update'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x89d6,0x119));var _0x689d=function(_0x1a610b,_0x3f79a3){_0x1a610b=_0x1a610b-0x0;var _0x2c04fb=_0x89d6[_0x1a610b];return _0x2c04fb;};'use strict';var multer=require(_0x689d('0x0'));var util=require(_0x689d('0x1'));var path=require(_0x689d('0x2'));var timeout=require(_0x689d('0x3'));var express=require('express');var router=express[_0x689d('0x4')]();var auth=require(_0x689d('0x5'));var interaction=require(_0x689d('0x6'));var config=require('../../config/environment');var controller=require(_0x689d('0x7'));router[_0x689d('0x8')]('/',auth[_0x689d('0x9')](),controller[_0x689d('0xa')]);router[_0x689d('0x8')](_0x689d('0xb'),auth['isAuthenticated'](),controller[_0x689d('0xc')]);router[_0x689d('0x8')](_0x689d('0xd'),auth['isAuthenticated'](),controller['getUsers']);router[_0x689d('0x8')](_0x689d('0xe'),auth[_0x689d('0x9')](),controller[_0x689d('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x689d('0x10')]);router[_0x689d('0x11')](_0x689d('0xe'),controller[_0x689d('0x12')]);router['delete'](_0x689d('0xe'),auth[_0x689d('0x9')](),controller['destroy']);module[_0x689d('0x13')]=router; \ No newline at end of file +var _0x3cb7=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','describe','getUsers','/:id','show','post','create','put','update','delete','destroy','exports','path','express','Router'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x3cb7,0xcf));var _0x73cb=function(_0x142d3e,_0x353e86){_0x142d3e=_0x142d3e-0x0;var _0x493084=_0x3cb7[_0x142d3e];return _0x493084;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x73cb('0x0'));var timeout=require('connect-timeout');var express=require(_0x73cb('0x1'));var router=express[_0x73cb('0x2')]();var auth=require(_0x73cb('0x3'));var interaction=require(_0x73cb('0x4'));var config=require(_0x73cb('0x5'));var controller=require(_0x73cb('0x6'));router[_0x73cb('0x7')]('/',auth[_0x73cb('0x8')](),controller['index']);router[_0x73cb('0x7')](_0x73cb('0x9'),auth[_0x73cb('0x8')](),controller[_0x73cb('0xa')]);router[_0x73cb('0x7')]('/users',auth[_0x73cb('0x8')](),controller[_0x73cb('0xb')]);router[_0x73cb('0x7')](_0x73cb('0xc'),auth[_0x73cb('0x8')](),controller[_0x73cb('0xd')]);router[_0x73cb('0xe')]('/',auth['isAuthenticated'](),controller[_0x73cb('0xf')]);router[_0x73cb('0x10')](_0x73cb('0xc'),controller[_0x73cb('0x11')]);router[_0x73cb('0x12')](_0x73cb('0xc'),auth['isAuthenticated'](),controller[_0x73cb('0x13')]);module[_0x73cb('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index c804e89..fc290cf 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 _0x8165=['medium','BOOLEAN','ENUM','out'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x8165,0x1e8));var _0x5816=function(_0x121cb3,_0x126008){_0x121cb3=_0x121cb3-0x0;var _0x35e158=_0x8165[_0x121cb3];return _0x35e158;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0x5816('0x0')),'allowNull':![]},'read':{'type':Sequelize[_0x5816('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0x5816('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5816('0x2')]('in',_0x5816('0x3')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x8b60=['medium','BOOLEAN','out','DATE','sequelize','exports'];(function(_0x381608,_0x8b3166){var _0xb273a5=function(_0x531d11){while(--_0x531d11){_0x381608['push'](_0x381608['shift']());}};_0xb273a5(++_0x8b3166);}(_0x8b60,0xfa));var _0x08b6=function(_0x662ac5,_0x252644){_0x662ac5=_0x662ac5-0x0;var _0x39f25b=_0x8b60[_0x662ac5];return _0x39f25b;};'use strict';var Sequelize=require(_0x08b6('0x0'));module[_0x08b6('0x1')]={'body':{'type':Sequelize['TEXT'](_0x08b6('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x08b6('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x08b6('0x4')),'defaultValue':_0x08b6('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x08b6('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index d79ec13..b9f081c 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 _0xa457=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','ChatMessage','rawAttributes','model','keys','query','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','dateStart','add','day','merge','map','filter','includeAll','include','findAll','show','params','options','find','create','body','describe','chat-interactions','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','user','CmContact','Contact','UserId','read1stAt','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','interface','SIP/%s','channel','event','EventManager','parse','formData','chat','agent','ChatInteraction','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto'];(function(_0x555c49,_0x3f3a43){var _0x40aa09=function(_0x507959){while(--_0x507959){_0x555c49['push'](_0x555c49['shift']());}};_0x40aa09(++_0x3f3a43);}(_0xa457,0x1d2));var _0x7a45=function(_0x490fce,_0x1991ff){_0x490fce=_0x490fce-0x0;var _0x311322=_0xa457[_0x490fce];return _0x311322;};'use strict';var pdf=require(_0x7a45('0x0'));var emlformat=require(_0x7a45('0x1'));var rimraf=require(_0x7a45('0x2'));var zipdir=require(_0x7a45('0x3'));var jsonpatch=require(_0x7a45('0x4'));var rp=require('request-promise');var moment=require(_0x7a45('0x5'));var BPromise=require(_0x7a45('0x6'));var Mustache=require(_0x7a45('0x7'));var util=require(_0x7a45('0x8'));var path=require(_0x7a45('0x9'));var sox=require('sox');var csv=require(_0x7a45('0xa'));var ejs=require(_0x7a45('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7a45('0xc'));var crypto=require(_0x7a45('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7a45('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7a45('0xf'));var Papa=require(_0x7a45('0x10'));var Redis=require(_0x7a45('0x11'));var qs=require(_0x7a45('0x12'));var logger=require(_0x7a45('0x13'))(_0x7a45('0x14'));var utils=require(_0x7a45('0x15'));var config=require('../../config/environment');var db=require(_0x7a45('0x16'))['db'];config[_0x7a45('0x17')]=_[_0x7a45('0x18')](config[_0x7a45('0x17')],{'host':_0x7a45('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7a45('0x17')]));require(_0x7a45('0x1a'))[_0x7a45('0x1b')](socket);var jayson=require(_0x7a45('0x1c'));var client=jayson[_0x7a45('0x1d')][_0x7a45('0x1e')]({'port':0x232c});var client9002=jayson[_0x7a45('0x1d')][_0x7a45('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x16f3b1,_0x3ad3d5,_0x3c3d74,_0x58d6cb){return new BPromise(function(_0x36c4e2,_0x5e1b4c){var _0x203cd2=_0x58d6cb||client;return _0x203cd2['request'](_0x16f3b1,_0x3c3d74)['then'](function(_0x20d752){logger[_0x7a45('0x1f')](_0x7a45('0x20'),_0x3ad3d5,_0x7a45('0x21'));logger[_0x7a45('0x22')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x3ad3d5,_0x7a45('0x21'),JSON[_0x7a45('0x23')](_0x20d752));if(_0x20d752[_0x7a45('0x24')]){if(_0x20d752[_0x7a45('0x24')][_0x7a45('0x25')]===0x1f4){logger[_0x7a45('0x24')](_0x7a45('0x20'),_0x3ad3d5,_0x20d752[_0x7a45('0x24')]['message']);return _0x5e1b4c(_0x20d752[_0x7a45('0x24')]['message']);}logger[_0x7a45('0x24')](_0x7a45('0x20'),_0x3ad3d5,_0x20d752['error'][_0x7a45('0x26')]);return _0x36c4e2(_0x20d752[_0x7a45('0x24')][_0x7a45('0x26')]);}else{logger[_0x7a45('0x1f')](_0x7a45('0x20'),_0x3ad3d5,_0x7a45('0x21'));_0x36c4e2(_0x20d752[_0x7a45('0x27')][_0x7a45('0x26')]);}})[_0x7a45('0x28')](function(_0x1e74ad){logger[_0x7a45('0x24')](_0x7a45('0x20'),_0x3ad3d5,_0x1e74ad);_0x5e1b4c(_0x1e74ad);});});}function respondWithStatusCode(_0x38fb34,_0x337660){_0x337660=_0x337660||0xcc;return function(_0x527180){if(_0x527180){return _0x38fb34[_0x7a45('0x29')](_0x337660);}return _0x38fb34[_0x7a45('0x2a')](_0x337660)[_0x7a45('0x2b')]();};}function respondWithResult(_0x24b4f5,_0x2f9a48){_0x2f9a48=_0x2f9a48||0xc8;return function(_0x34c458){if(_0x34c458){return _0x24b4f5[_0x7a45('0x2a')](_0x2f9a48)[_0x7a45('0x2c')](_0x34c458);}};}function respondWithFilteredResult(_0x3668a3,_0x487536){return function(_0x393007){if(_0x393007){var _0x4baf8b=_0x393007[_0x7a45('0x2d')],_0x5769a7=_0x487536[_0x7a45('0x2e')],_0xe1d77d=_0x487536[_0x7a45('0x2e')]+_0x487536[_0x7a45('0x2f')],_0x1b8489;if(_0xe1d77d>=_0x4baf8b){_0xe1d77d=_0x4baf8b;_0x1b8489=0xc8;}else{_0x1b8489=0xce;}_0x3668a3[_0x7a45('0x2a')](_0x1b8489);return _0x3668a3[_0x7a45('0x30')](_0x7a45('0x31'),_0x5769a7+'-'+_0xe1d77d+'/'+_0x4baf8b)['json'](_0x393007);}return null;};}function patchUpdates(_0x102533){return function(_0x1d4f41){try{jsonpatch[_0x7a45('0x32')](_0x1d4f41,_0x102533,!![]);}catch(_0x4b1d1d){return BPromise[_0x7a45('0x33')](_0x4b1d1d);}return _0x1d4f41['save']();};}function saveUpdates(_0x1e1ee1,_0x5481e9){return function(_0x1e7d6c){if(_0x1e7d6c){return _0x1e7d6c[_0x7a45('0x34')](_0x1e1ee1)[_0x7a45('0x35')](function(_0x48f536){return _0x48f536;});}return null;};}function removeEntity(_0x66ba67,_0x43a318){return function(_0x3461e3){if(_0x3461e3){return _0x3461e3[_0x7a45('0x36')]()[_0x7a45('0x35')](function(){_0x66ba67['status'](0xcc)[_0x7a45('0x2b')]();});}};}function handleEntityNotFound(_0x5a6efa,_0x153439){return function(_0x4366f9){if(!_0x4366f9){_0x5a6efa[_0x7a45('0x29')](0x194);}return _0x4366f9;};}function handleError(_0x4ac629,_0x56e3a9){_0x56e3a9=_0x56e3a9||0x1f4;return function(_0x44f9d9){logger[_0x7a45('0x24')](_0x44f9d9[_0x7a45('0x37')]);if(_0x44f9d9[_0x7a45('0x38')]){delete _0x44f9d9[_0x7a45('0x38')];}_0x4ac629[_0x7a45('0x2a')](_0x56e3a9)['send'](_0x44f9d9);};}exports['index']=function(_0x385f10,_0x4b7385){var _0x530cd3={},_0x18f30f={},_0x48ef70={'count':0x0,'rows':[]};var _0xc1d5e0=db[_0x7a45('0x39')][_0x7a45('0x3a')];_0x18f30f[_0x7a45('0x3b')]=_[_0x7a45('0x3c')](_0xc1d5e0);var _0x226bb4={'dateStart':_0x385f10[_0x7a45('0x3d')]['dateStart'],'dateEnd':_0x385f10[_0x7a45('0x3d')]['dateEnd']};delete _0x385f10[_0x7a45('0x3d')]['dateStart'];delete _0x385f10[_0x7a45('0x3d')][_0x7a45('0x3e')];_0x18f30f[_0x7a45('0x3d')]=_[_0x7a45('0x3c')](_0x385f10[_0x7a45('0x3d')]);_0x18f30f[_0x7a45('0x3f')]=_[_0x7a45('0x40')](_0x18f30f[_0x7a45('0x3b')],_0x18f30f[_0x7a45('0x3d')]);_0x530cd3[_0x7a45('0x41')]=_['intersection'](_0x18f30f[_0x7a45('0x3b')],qs[_0x7a45('0x42')](_0x385f10['query'][_0x7a45('0x42')]));_0x530cd3[_0x7a45('0x41')]=_0x530cd3[_0x7a45('0x41')][_0x7a45('0x43')]?_0x530cd3['attributes']:_0x18f30f['model'];if(!_0x385f10[_0x7a45('0x3d')][_0x7a45('0x44')](_0x7a45('0x45'))){_0x530cd3[_0x7a45('0x2f')]=qs[_0x7a45('0x2f')](_0x385f10[_0x7a45('0x3d')][_0x7a45('0x2f')]);_0x530cd3['offset']=qs['offset'](_0x385f10[_0x7a45('0x3d')][_0x7a45('0x2e')]);}_0x530cd3[_0x7a45('0x46')]=qs['sort'](_0x385f10[_0x7a45('0x3d')][_0x7a45('0x47')]);_0x530cd3[_0x7a45('0x48')]=qs[_0x7a45('0x3f')](_[_0x7a45('0x49')](_0x385f10[_0x7a45('0x3d')],_0x18f30f['filters']));if(_0x226bb4[_0x7a45('0x4a')]){if(_0x226bb4[_0x7a45('0x3e')]){_0x226bb4[_0x7a45('0x3e')]=moment(_0x226bb4[_0x7a45('0x3e')])[_0x7a45('0x4b')](0x1,'day');}else{_0x226bb4[_0x7a45('0x3e')]=moment(_0x226bb4['dateStart'])[_0x7a45('0x4b')](0x1,_0x7a45('0x4c'));}_[_0x7a45('0x4d')](_0x530cd3[_0x7a45('0x48')],{'createdAt':{'$gte':_0x226bb4[_0x7a45('0x4a')],'$lte':_0x226bb4[_0x7a45('0x3e')]}});}if(_0x385f10[_0x7a45('0x3d')]['filter']){_0x530cd3[_0x7a45('0x48')]=_[_0x7a45('0x4d')](_0x530cd3[_0x7a45('0x48')],{'$or':_[_0x7a45('0x4e')](_0x530cd3[_0x7a45('0x41')],function(_0x5881d8){var _0x143b36={};_0x143b36[_0x5881d8]={'$like':'%'+_0x385f10[_0x7a45('0x3d')][_0x7a45('0x4f')]+'%'};return _0x143b36;})});}_0x530cd3=_['merge']({},_0x530cd3,_0x385f10['options']);var _0x479a0d={'where':_0x530cd3['where']};return db[_0x7a45('0x39')][_0x7a45('0x2d')](_0x479a0d)[_0x7a45('0x35')](function(_0x4fba2b){_0x48ef70['count']=_0x4fba2b;if(_0x385f10[_0x7a45('0x3d')][_0x7a45('0x50')]){_0x530cd3[_0x7a45('0x51')]=[{'all':!![]}];}return db[_0x7a45('0x39')][_0x7a45('0x52')](_0x530cd3);})['then'](function(_0x48bb52){_0x48ef70['rows']=_0x48bb52;return _0x48ef70;})[_0x7a45('0x35')](respondWithFilteredResult(_0x4b7385,_0x530cd3))['catch'](handleError(_0x4b7385,null));};exports[_0x7a45('0x53')]=function(_0x9de737,_0x357672){var _0x3707d3={'raw':!![],'where':{'id':_0x9de737[_0x7a45('0x54')]['id']}},_0x110aae={};_0x110aae['model']=_['keys'](db[_0x7a45('0x39')]['rawAttributes']);_0x110aae[_0x7a45('0x3d')]=_[_0x7a45('0x3c')](_0x9de737[_0x7a45('0x3d')]);_0x110aae['filters']=_['intersection'](_0x110aae[_0x7a45('0x3b')],_0x110aae[_0x7a45('0x3d')]);_0x3707d3[_0x7a45('0x41')]=_[_0x7a45('0x40')](_0x110aae[_0x7a45('0x3b')],qs['fields'](_0x9de737[_0x7a45('0x3d')][_0x7a45('0x42')]));_0x3707d3[_0x7a45('0x41')]=_0x3707d3['attributes'][_0x7a45('0x43')]?_0x3707d3[_0x7a45('0x41')]:_0x110aae[_0x7a45('0x3b')];if(_0x9de737['query'][_0x7a45('0x50')]){_0x3707d3[_0x7a45('0x51')]=[{'all':!![]}];}_0x3707d3=_[_0x7a45('0x4d')]({},_0x3707d3,_0x9de737[_0x7a45('0x55')]);return db['ChatMessage'][_0x7a45('0x56')](_0x3707d3)[_0x7a45('0x35')](handleEntityNotFound(_0x357672,null))[_0x7a45('0x35')](respondWithResult(_0x357672,null))[_0x7a45('0x28')](handleError(_0x357672,null));};exports[_0x7a45('0x57')]=function(_0x228bdc,_0x2d1ba3){return db['ChatMessage'][_0x7a45('0x57')](_0x228bdc['body'],{})[_0x7a45('0x35')](respondWithResult(_0x2d1ba3,0xc9))['catch'](handleError(_0x2d1ba3,null));};exports[_0x7a45('0x34')]=function(_0x4a321f,_0x25c594){if(_0x4a321f[_0x7a45('0x58')]['id']){delete _0x4a321f['body']['id'];}return db['ChatMessage'][_0x7a45('0x56')]({'where':{'id':_0x4a321f[_0x7a45('0x54')]['id']}})['then'](handleEntityNotFound(_0x25c594,null))[_0x7a45('0x35')](saveUpdates(_0x4a321f[_0x7a45('0x58')],null))[_0x7a45('0x35')](respondWithResult(_0x25c594,null))[_0x7a45('0x28')](handleError(_0x25c594,null));};exports[_0x7a45('0x36')]=function(_0x5e93af,_0x5cb307){return db[_0x7a45('0x39')][_0x7a45('0x56')]({'where':{'id':_0x5e93af['params']['id']}})[_0x7a45('0x35')](handleEntityNotFound(_0x5cb307,null))[_0x7a45('0x35')](removeEntity(_0x5cb307,null))[_0x7a45('0x28')](handleError(_0x5cb307,null));};exports[_0x7a45('0x59')]=function(_0x23b364,_0x12c68f){return db[_0x7a45('0x39')][_0x7a45('0x59')]()[_0x7a45('0x35')](respondWithResult(_0x12c68f,null))[_0x7a45('0x28')](handleError(_0x12c68f,null));};var interaction_log=require(_0x7a45('0x13'))(_0x7a45('0x5a'));exports[_0x7a45('0x5b')]=function(_0x430530,_0x127af1,_0x58fd22){var _0x4164aa={'channel':'chat'};if(_0x430530[_0x7a45('0x58')]['id']){delete _0x430530['body']['id'];}_0x430530[_0x7a45('0x58')][_0x7a45('0x5c')]=!![];_0x430530['body']['readAt']=moment()[_0x7a45('0x5d')](_0x7a45('0x5e'));_0x430530['body']['UserId']=_0x430530[_0x7a45('0x58')]['UserId']||_0x430530[_0x7a45('0x5f')]['id'];return db[_0x7a45('0x39')][_0x7a45('0x56')]({'where':{'id':_0x430530['params']['id'],'UserId':null},'include':[{'model':db[_0x7a45('0x60')],'as':_0x7a45('0x61')}]})[_0x7a45('0x35')](handleEntityNotFound(_0x127af1,null))['then'](saveUpdates(_0x430530[_0x7a45('0x58')],null))[_0x7a45('0x35')](function(_0x35b3e3){if(_0x35b3e3){_0x4164aa[_0x7a45('0x26')]=_0x35b3e3['get']({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x35b3e3['ChatInteractionId']}});}return null;})[_0x7a45('0x35')](handleEntityNotFound(_0x127af1,null))[_0x7a45('0x35')](function(_0x62040b){if(_0x62040b){return _0x62040b[_0x7a45('0x34')]({'UserId':_0x430530['body'][_0x7a45('0x62')],'read1stAt':_['isNil'](_0x62040b[_0x7a45('0x63')])?moment()['format'](_0x7a45('0x5e')):undefined});}return null;})[_0x7a45('0x35')](function(_0x5cfb18){if(_0x5cfb18){_0x4164aa[_0x7a45('0x64')]=_0x5cfb18[_0x7a45('0x65')]({'plain':!![]});interaction_log[_0x7a45('0x1f')](_0x7a45('0x66'),_0x430530[_0x7a45('0x5f')]['id'],_0x430530[_0x7a45('0x5f')][_0x7a45('0x38')],_0x430530[_0x7a45('0x5f')]['role'],_0x4164aa['interaction']['id'],_0x430530['body']?JSON[_0x7a45('0x23')](_0x430530[_0x7a45('0x58')]):_0x7a45('0x67'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x4164aa);}return null;})['then'](function(_0x2359cd){if(_0x2359cd){if(_0x430530['body']['manual']){_0x4164aa[_0x7a45('0x26')][_0x7a45('0x68')]=util['format'](_0x7a45('0x69'),_0x430530['user'][_0x7a45('0x38')]);_0x4164aa['message'][_0x7a45('0x6a')]=_0x4164aa[_0x7a45('0x6a')];_0x4164aa['message'][_0x7a45('0x6b')]='accept';return respondWithRpcPromise('EventManager',_0x7a45('0x6c'),{'event':'acceptmessage','message':_[_0x7a45('0x4d')](_0x4164aa['message'],JSON[_0x7a45('0x6d')](_0x4164aa[_0x7a45('0x64')][_0x7a45('0x6e')]))},client9002)['then'](function(){return _0x4164aa;});}return _0x4164aa;}return null;})['then'](respondWithResult(_0x127af1,null))[_0x7a45('0x28')](handleError(_0x127af1,null));};var interaction_log=require(_0x7a45('0x13'))(_0x7a45('0x5a'));exports[_0x7a45('0x33')]=function(_0x115875,_0x42a6e8,_0x1a9020){var _0x3954fb={'agent':{},'channel':_0x7a45('0x6f')};if(_0x115875[_0x7a45('0x58')]['id']){delete _0x115875[_0x7a45('0x58')]['id'];}_0x115875['body'][_0x7a45('0x62')]=_0x115875[_0x7a45('0x58')]['UserId']||_0x115875[_0x7a45('0x5f')]['id'];_0x3954fb[_0x7a45('0x70')]['id']=_0x115875['body'][_0x7a45('0x62')];return db['ChatMessage'][_0x7a45('0x56')]({'where':{'id':_0x115875[_0x7a45('0x54')]['id'],'UserId':null}})[_0x7a45('0x35')](handleEntityNotFound(_0x42a6e8,null))[_0x7a45('0x35')](function(_0x10cd9d){if(_0x10cd9d){_0x3954fb[_0x7a45('0x26')]=_0x10cd9d[_0x7a45('0x65')]({'plain':!![]});return db[_0x7a45('0x71')]['find']({'where':{'id':_0x10cd9d[_0x7a45('0x72')]}});}return null;})[_0x7a45('0x35')](handleEntityNotFound(_0x42a6e8,null))['then'](function(_0x3bd514){if(_0x3bd514){_0x3954fb[_0x7a45('0x64')]=_0x3bd514[_0x7a45('0x65')]({'plain':!![]});interaction_log['info'](_0x7a45('0x73'),_0x115875[_0x7a45('0x5f')]['id'],_0x115875['user']['name'],_0x115875[_0x7a45('0x5f')][_0x7a45('0x74')],_0x3954fb[_0x7a45('0x64')]['id'],_0x115875[_0x7a45('0x58')]?JSON[_0x7a45('0x23')](_0x115875[_0x7a45('0x58')]):_0x7a45('0x67'));return respondWithRpcPromise(_0x7a45('0x75'),_0x7a45('0x76'),_0x3954fb);}return null;})[_0x7a45('0x35')](function(_0xe6734e){if(_0xe6734e){_0xe6734e['message'][_0x7a45('0x68')]=util[_0x7a45('0x5d')](_0x7a45('0x69'),_0x115875[_0x7a45('0x5f')]['name']);_0xe6734e['message'][_0x7a45('0x6a')]=_0x3954fb['channel'];_0xe6734e[_0x7a45('0x26')][_0x7a45('0x6b')]=_0x7a45('0x33');respondWithRpcPromise('EventManager',_0x7a45('0x6c'),{'event':_0x7a45('0x77'),'message':_0xe6734e[_0x7a45('0x26')]},client9002);return _0x3954fb;}return null;})[_0x7a45('0x35')](respondWithResult(_0x42a6e8,null))[_0x7a45('0x28')](handleError(_0x42a6e8,null));}; \ No newline at end of file +var _0xe8ff=['set','apply','reject','save','destroy','stack','name','index','ChatMessage','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','map','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','update','describe','chat-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','ChatInteraction','isNil','read1stAt','format','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','interface','channel','event','EventManager','acceptmessage','formData','chat','agent','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','ChatMessage,\x20%s,\x20%s','message','catch','sendStatus','end','status','json','count','offset','limit'];(function(_0x5c8430,_0x228e3c){var _0x36455e=function(_0x1ed9c5){while(--_0x1ed9c5){_0x5c8430['push'](_0x5c8430['shift']());}};_0x36455e(++_0x228e3c);}(_0xe8ff,0x14f));var _0xfe8f=function(_0x5cbfed,_0x2b8ba5){_0x5cbfed=_0x5cbfed-0x0;var _0x462d98=_0xe8ff[_0x5cbfed];return _0x462d98;};'use strict';var pdf=require(_0xfe8f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfe8f('0x1'));var zipdir=require(_0xfe8f('0x2'));var jsonpatch=require(_0xfe8f('0x3'));var rp=require(_0xfe8f('0x4'));var moment=require(_0xfe8f('0x5'));var BPromise=require(_0xfe8f('0x6'));var Mustache=require(_0xfe8f('0x7'));var util=require(_0xfe8f('0x8'));var path=require('path');var sox=require(_0xfe8f('0x9'));var csv=require('to-csv');var ejs=require(_0xfe8f('0xa'));var fs=require('fs');var _=require(_0xfe8f('0xb'));var squel=require(_0xfe8f('0xc'));var crypto=require(_0xfe8f('0xd'));var jsforce=require(_0xfe8f('0xe'));var deskjs=require(_0xfe8f('0xf'));var toCsv=require(_0xfe8f('0x10'));var querystring=require(_0xfe8f('0x11'));var Papa=require(_0xfe8f('0x12'));var Redis=require(_0xfe8f('0x13'));var qs=require('../../components/parsers/qs');var logger=require(_0xfe8f('0x14'))(_0xfe8f('0x15'));var utils=require(_0xfe8f('0x16'));var config=require(_0xfe8f('0x17'));var db=require(_0xfe8f('0x18'))['db'];config[_0xfe8f('0x19')]=_[_0xfe8f('0x1a')](config[_0xfe8f('0x19')],{'host':_0xfe8f('0x1b'),'port':0x18eb});var socket=require(_0xfe8f('0x1c'))(new Redis(config[_0xfe8f('0x19')]));require(_0xfe8f('0x1d'))[_0xfe8f('0x1e')](socket);var jayson=require(_0xfe8f('0x1f'));var client=jayson[_0xfe8f('0x20')][_0xfe8f('0x21')]({'port':0x232c});var client9002=jayson[_0xfe8f('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x267e29,_0x24b46e,_0x4c99cf,_0x1d75e8){return new BPromise(function(_0xa78e30,_0x27f729){var _0x2d8c54=_0x1d75e8||client;return _0x2d8c54[_0xfe8f('0x22')](_0x267e29,_0x4c99cf)[_0xfe8f('0x23')](function(_0x1ddc54){logger[_0xfe8f('0x24')]('ChatMessage,\x20%s,\x20%s',_0x24b46e,_0xfe8f('0x25'));logger[_0xfe8f('0x26')](_0xfe8f('0x27'),_0x24b46e,_0xfe8f('0x25'),JSON['stringify'](_0x1ddc54));if(_0x1ddc54[_0xfe8f('0x28')]){if(_0x1ddc54['error'][_0xfe8f('0x29')]===0x1f4){logger['error'](_0xfe8f('0x2a'),_0x24b46e,_0x1ddc54[_0xfe8f('0x28')][_0xfe8f('0x2b')]);return _0x27f729(_0x1ddc54[_0xfe8f('0x28')][_0xfe8f('0x2b')]);}logger[_0xfe8f('0x28')](_0xfe8f('0x2a'),_0x24b46e,_0x1ddc54[_0xfe8f('0x28')][_0xfe8f('0x2b')]);return _0xa78e30(_0x1ddc54[_0xfe8f('0x28')][_0xfe8f('0x2b')]);}else{logger[_0xfe8f('0x24')]('ChatMessage,\x20%s,\x20%s',_0x24b46e,'request\x20sent');_0xa78e30(_0x1ddc54['result']['message']);}})[_0xfe8f('0x2c')](function(_0x10c30d){logger[_0xfe8f('0x28')](_0xfe8f('0x2a'),_0x24b46e,_0x10c30d);_0x27f729(_0x10c30d);});});}function respondWithStatusCode(_0x448bbe,_0x3feb0e){_0x3feb0e=_0x3feb0e||0xcc;return function(_0x172a5c){if(_0x172a5c){return _0x448bbe[_0xfe8f('0x2d')](_0x3feb0e);}return _0x448bbe['status'](_0x3feb0e)[_0xfe8f('0x2e')]();};}function respondWithResult(_0x5838da,_0x545c31){_0x545c31=_0x545c31||0xc8;return function(_0xd5aedb){if(_0xd5aedb){return _0x5838da[_0xfe8f('0x2f')](_0x545c31)[_0xfe8f('0x30')](_0xd5aedb);}};}function respondWithFilteredResult(_0x8f8917,_0x3c3263){return function(_0x51e24a){if(_0x51e24a){var _0x17fbd2=_0x51e24a[_0xfe8f('0x31')],_0x349e1f=_0x3c3263[_0xfe8f('0x32')],_0x32d94e=_0x3c3263[_0xfe8f('0x32')]+_0x3c3263[_0xfe8f('0x33')],_0x441061;if(_0x32d94e>=_0x17fbd2){_0x32d94e=_0x17fbd2;_0x441061=0xc8;}else{_0x441061=0xce;}_0x8f8917[_0xfe8f('0x2f')](_0x441061);return _0x8f8917[_0xfe8f('0x34')]('Content-Range',_0x349e1f+'-'+_0x32d94e+'/'+_0x17fbd2)[_0xfe8f('0x30')](_0x51e24a);}return null;};}function patchUpdates(_0x38f5cd){return function(_0x125b19){try{jsonpatch[_0xfe8f('0x35')](_0x125b19,_0x38f5cd,!![]);}catch(_0x1d3fe4){return BPromise[_0xfe8f('0x36')](_0x1d3fe4);}return _0x125b19[_0xfe8f('0x37')]();};}function saveUpdates(_0x55afe0,_0x22f90b){return function(_0x2bf6c5){if(_0x2bf6c5){return _0x2bf6c5['update'](_0x55afe0)[_0xfe8f('0x23')](function(_0x16cbd4){return _0x16cbd4;});}return null;};}function removeEntity(_0x3664d0,_0x5d6706){return function(_0x4e1963){if(_0x4e1963){return _0x4e1963[_0xfe8f('0x38')]()[_0xfe8f('0x23')](function(){_0x3664d0['status'](0xcc)[_0xfe8f('0x2e')]();});}};}function handleEntityNotFound(_0x4306e6,_0x45ca0f){return function(_0x3ac04d){if(!_0x3ac04d){_0x4306e6[_0xfe8f('0x2d')](0x194);}return _0x3ac04d;};}function handleError(_0x1ba792,_0x11405d){_0x11405d=_0x11405d||0x1f4;return function(_0x40d062){logger[_0xfe8f('0x28')](_0x40d062[_0xfe8f('0x39')]);if(_0x40d062[_0xfe8f('0x3a')]){delete _0x40d062[_0xfe8f('0x3a')];}_0x1ba792[_0xfe8f('0x2f')](_0x11405d)['send'](_0x40d062);};}exports[_0xfe8f('0x3b')]=function(_0x269a57,_0x4fee79){var _0x3631ce={},_0x410f97={},_0x51f0a3={'count':0x0,'rows':[]};var _0x3c3e0e=db[_0xfe8f('0x3c')]['rawAttributes'];_0x410f97[_0xfe8f('0x3d')]=_[_0xfe8f('0x3e')](_0x3c3e0e);var _0x6a9d73={'dateStart':_0x269a57[_0xfe8f('0x3f')][_0xfe8f('0x40')],'dateEnd':_0x269a57[_0xfe8f('0x3f')]['dateEnd']};delete _0x269a57[_0xfe8f('0x3f')][_0xfe8f('0x40')];delete _0x269a57[_0xfe8f('0x3f')][_0xfe8f('0x41')];_0x410f97['query']=_[_0xfe8f('0x3e')](_0x269a57[_0xfe8f('0x3f')]);_0x410f97[_0xfe8f('0x42')]=_[_0xfe8f('0x43')](_0x410f97['model'],_0x410f97['query']);_0x3631ce['attributes']=_[_0xfe8f('0x43')](_0x410f97[_0xfe8f('0x3d')],qs['fields'](_0x269a57['query'][_0xfe8f('0x44')]));_0x3631ce[_0xfe8f('0x45')]=_0x3631ce[_0xfe8f('0x45')][_0xfe8f('0x46')]?_0x3631ce[_0xfe8f('0x45')]:_0x410f97[_0xfe8f('0x3d')];if(!_0x269a57[_0xfe8f('0x3f')][_0xfe8f('0x47')](_0xfe8f('0x48'))){_0x3631ce[_0xfe8f('0x33')]=qs[_0xfe8f('0x33')](_0x269a57[_0xfe8f('0x3f')][_0xfe8f('0x33')]);_0x3631ce[_0xfe8f('0x32')]=qs[_0xfe8f('0x32')](_0x269a57['query'][_0xfe8f('0x32')]);}_0x3631ce[_0xfe8f('0x49')]=qs['sort'](_0x269a57['query'][_0xfe8f('0x4a')]);_0x3631ce[_0xfe8f('0x4b')]=qs['filters'](_[_0xfe8f('0x4c')](_0x269a57[_0xfe8f('0x3f')],_0x410f97[_0xfe8f('0x42')]));if(_0x6a9d73['dateStart']){if(_0x6a9d73[_0xfe8f('0x41')]){_0x6a9d73[_0xfe8f('0x41')]=moment(_0x6a9d73['dateEnd'])[_0xfe8f('0x4d')](0x1,'day');}else{_0x6a9d73['dateEnd']=moment(_0x6a9d73[_0xfe8f('0x40')])[_0xfe8f('0x4d')](0x1,_0xfe8f('0x4e'));}_[_0xfe8f('0x4f')](_0x3631ce['where'],{'createdAt':{'$gte':_0x6a9d73[_0xfe8f('0x40')],'$lte':_0x6a9d73[_0xfe8f('0x41')]}});}if(_0x269a57[_0xfe8f('0x3f')]['filter']){_0x3631ce[_0xfe8f('0x4b')]=_[_0xfe8f('0x4f')](_0x3631ce['where'],{'$or':_[_0xfe8f('0x50')](_0x3631ce['attributes'],function(_0x876b4f){var _0x2338e5={};_0x2338e5[_0x876b4f]={'$like':'%'+_0x269a57[_0xfe8f('0x3f')][_0xfe8f('0x51')]+'%'};return _0x2338e5;})});}_0x3631ce=_['merge']({},_0x3631ce,_0x269a57[_0xfe8f('0x52')]);var _0x1b469f={'where':_0x3631ce[_0xfe8f('0x4b')]};return db['ChatMessage'][_0xfe8f('0x31')](_0x1b469f)[_0xfe8f('0x23')](function(_0x2d174f){_0x51f0a3['count']=_0x2d174f;if(_0x269a57[_0xfe8f('0x3f')][_0xfe8f('0x53')]){_0x3631ce[_0xfe8f('0x54')]=[{'all':!![]}];}return db[_0xfe8f('0x3c')][_0xfe8f('0x55')](_0x3631ce);})[_0xfe8f('0x23')](function(_0x12fe65){_0x51f0a3[_0xfe8f('0x56')]=_0x12fe65;return _0x51f0a3;})[_0xfe8f('0x23')](respondWithFilteredResult(_0x4fee79,_0x3631ce))['catch'](handleError(_0x4fee79,null));};exports[_0xfe8f('0x57')]=function(_0x67f969,_0x3b64f7){var _0x45b16c={'raw':!![],'where':{'id':_0x67f969[_0xfe8f('0x58')]['id']}},_0x2fb3b7={};_0x2fb3b7[_0xfe8f('0x3d')]=_[_0xfe8f('0x3e')](db[_0xfe8f('0x3c')][_0xfe8f('0x59')]);_0x2fb3b7[_0xfe8f('0x3f')]=_[_0xfe8f('0x3e')](_0x67f969[_0xfe8f('0x3f')]);_0x2fb3b7[_0xfe8f('0x42')]=_[_0xfe8f('0x43')](_0x2fb3b7[_0xfe8f('0x3d')],_0x2fb3b7[_0xfe8f('0x3f')]);_0x45b16c[_0xfe8f('0x45')]=_[_0xfe8f('0x43')](_0x2fb3b7[_0xfe8f('0x3d')],qs[_0xfe8f('0x44')](_0x67f969[_0xfe8f('0x3f')]['fields']));_0x45b16c[_0xfe8f('0x45')]=_0x45b16c[_0xfe8f('0x45')]['length']?_0x45b16c[_0xfe8f('0x45')]:_0x2fb3b7[_0xfe8f('0x3d')];if(_0x67f969[_0xfe8f('0x3f')][_0xfe8f('0x53')]){_0x45b16c[_0xfe8f('0x54')]=[{'all':!![]}];}_0x45b16c=_['merge']({},_0x45b16c,_0x67f969[_0xfe8f('0x52')]);return db[_0xfe8f('0x3c')][_0xfe8f('0x5a')](_0x45b16c)['then'](handleEntityNotFound(_0x3b64f7,null))['then'](respondWithResult(_0x3b64f7,null))[_0xfe8f('0x2c')](handleError(_0x3b64f7,null));};exports['create']=function(_0x25b0f8,_0x160d7d){return db[_0xfe8f('0x3c')][_0xfe8f('0x5b')](_0x25b0f8[_0xfe8f('0x5c')],{})['then'](respondWithResult(_0x160d7d,0xc9))['catch'](handleError(_0x160d7d,null));};exports[_0xfe8f('0x5d')]=function(_0x381d51,_0x4647c1){if(_0x381d51['body']['id']){delete _0x381d51['body']['id'];}return db[_0xfe8f('0x3c')][_0xfe8f('0x5a')]({'where':{'id':_0x381d51[_0xfe8f('0x58')]['id']}})[_0xfe8f('0x23')](handleEntityNotFound(_0x4647c1,null))[_0xfe8f('0x23')](saveUpdates(_0x381d51[_0xfe8f('0x5c')],null))[_0xfe8f('0x23')](respondWithResult(_0x4647c1,null))[_0xfe8f('0x2c')](handleError(_0x4647c1,null));};exports['destroy']=function(_0x515d8d,_0x550908){return db[_0xfe8f('0x3c')][_0xfe8f('0x5a')]({'where':{'id':_0x515d8d[_0xfe8f('0x58')]['id']}})[_0xfe8f('0x23')](handleEntityNotFound(_0x550908,null))[_0xfe8f('0x23')](removeEntity(_0x550908,null))[_0xfe8f('0x2c')](handleError(_0x550908,null));};exports[_0xfe8f('0x5e')]=function(_0x577195,_0x4b2385){return db[_0xfe8f('0x3c')][_0xfe8f('0x5e')]()[_0xfe8f('0x23')](respondWithResult(_0x4b2385,null))[_0xfe8f('0x2c')](handleError(_0x4b2385,null));};var interaction_log=require('../../config/logger')(_0xfe8f('0x5f'));exports[_0xfe8f('0x60')]=function(_0x4a4407,_0x1b1f01,_0x529266){var _0x200177={'channel':'chat'};if(_0x4a4407[_0xfe8f('0x5c')]['id']){delete _0x4a4407['body']['id'];}_0x4a4407[_0xfe8f('0x5c')][_0xfe8f('0x61')]=!![];_0x4a4407[_0xfe8f('0x5c')][_0xfe8f('0x62')]=moment()['format'](_0xfe8f('0x63'));_0x4a4407[_0xfe8f('0x5c')][_0xfe8f('0x64')]=_0x4a4407[_0xfe8f('0x5c')]['UserId']||_0x4a4407[_0xfe8f('0x65')]['id'];return db['ChatMessage']['find']({'where':{'id':_0x4a4407[_0xfe8f('0x58')]['id'],'UserId':null},'include':[{'model':db[_0xfe8f('0x66')],'as':_0xfe8f('0x67')}]})['then'](handleEntityNotFound(_0x1b1f01,null))[_0xfe8f('0x23')](saveUpdates(_0x4a4407[_0xfe8f('0x5c')],null))[_0xfe8f('0x23')](function(_0x5351a6){if(_0x5351a6){_0x200177[_0xfe8f('0x2b')]=_0x5351a6[_0xfe8f('0x68')]({'plain':!![]});return db[_0xfe8f('0x69')][_0xfe8f('0x5a')]({'where':{'id':_0x5351a6['ChatInteractionId']}});}return null;})[_0xfe8f('0x23')](handleEntityNotFound(_0x1b1f01,null))[_0xfe8f('0x23')](function(_0x4b6deb){if(_0x4b6deb){return _0x4b6deb[_0xfe8f('0x5d')]({'UserId':_0x4a4407[_0xfe8f('0x5c')][_0xfe8f('0x64')],'read1stAt':_[_0xfe8f('0x6a')](_0x4b6deb[_0xfe8f('0x6b')])?moment()[_0xfe8f('0x6c')](_0xfe8f('0x63')):undefined});}return null;})[_0xfe8f('0x23')](function(_0x269728){if(_0x269728){_0x200177[_0xfe8f('0x6d')]=_0x269728[_0xfe8f('0x68')]({'plain':!![]});interaction_log['info'](_0xfe8f('0x6e'),_0x4a4407[_0xfe8f('0x65')]['id'],_0x4a4407['user'][_0xfe8f('0x3a')],_0x4a4407['user'][_0xfe8f('0x6f')],_0x200177[_0xfe8f('0x6d')]['id'],_0x4a4407['body']?JSON[_0xfe8f('0x70')](_0x4a4407['body']):_0xfe8f('0x71'));return respondWithRpcPromise(_0xfe8f('0x72'),_0xfe8f('0x73'),_0x200177);}return null;})[_0xfe8f('0x23')](function(_0x42e743){if(_0x42e743){if(_0x4a4407[_0xfe8f('0x5c')]['manual']){_0x200177['message'][_0xfe8f('0x74')]=util[_0xfe8f('0x6c')]('SIP/%s',_0x4a4407['user'][_0xfe8f('0x3a')]);_0x200177[_0xfe8f('0x2b')][_0xfe8f('0x75')]=_0x200177[_0xfe8f('0x75')];_0x200177[_0xfe8f('0x2b')][_0xfe8f('0x76')]=_0xfe8f('0x60');return respondWithRpcPromise(_0xfe8f('0x77'),'EventManager',{'event':_0xfe8f('0x78'),'message':_[_0xfe8f('0x4f')](_0x200177[_0xfe8f('0x2b')],JSON['parse'](_0x200177['interaction'][_0xfe8f('0x79')]))},client9002)[_0xfe8f('0x23')](function(){return _0x200177;});}return _0x200177;}return null;})[_0xfe8f('0x23')](respondWithResult(_0x1b1f01,null))[_0xfe8f('0x2c')](handleError(_0x1b1f01,null));};var interaction_log=require(_0xfe8f('0x14'))(_0xfe8f('0x5f'));exports[_0xfe8f('0x36')]=function(_0x2c36ce,_0x2279c4,_0x10a14f){var _0x227325={'agent':{},'channel':_0xfe8f('0x7a')};if(_0x2c36ce[_0xfe8f('0x5c')]['id']){delete _0x2c36ce[_0xfe8f('0x5c')]['id'];}_0x2c36ce[_0xfe8f('0x5c')][_0xfe8f('0x64')]=_0x2c36ce[_0xfe8f('0x5c')][_0xfe8f('0x64')]||_0x2c36ce['user']['id'];_0x227325[_0xfe8f('0x7b')]['id']=_0x2c36ce[_0xfe8f('0x5c')]['UserId'];return db[_0xfe8f('0x3c')][_0xfe8f('0x5a')]({'where':{'id':_0x2c36ce['params']['id'],'UserId':null}})[_0xfe8f('0x23')](handleEntityNotFound(_0x2279c4,null))['then'](function(_0x3c8f56){if(_0x3c8f56){_0x227325['message']=_0x3c8f56[_0xfe8f('0x68')]({'plain':!![]});return db[_0xfe8f('0x69')]['find']({'where':{'id':_0x3c8f56[_0xfe8f('0x7c')]}});}return null;})[_0xfe8f('0x23')](handleEntityNotFound(_0x2279c4,null))['then'](function(_0x259d2b){if(_0x259d2b){_0x227325[_0xfe8f('0x6d')]=_0x259d2b[_0xfe8f('0x68')]({'plain':!![]});interaction_log[_0xfe8f('0x24')](_0xfe8f('0x7d'),_0x2c36ce[_0xfe8f('0x65')]['id'],_0x2c36ce['user']['name'],_0x2c36ce[_0xfe8f('0x65')][_0xfe8f('0x6f')],_0x227325[_0xfe8f('0x6d')]['id'],_0x2c36ce[_0xfe8f('0x5c')]?JSON[_0xfe8f('0x70')](_0x2c36ce['body']):'null');return respondWithRpcPromise(_0xfe8f('0x7e'),_0xfe8f('0x7f'),_0x227325);}return null;})['then'](function(_0x3468af){if(_0x3468af){_0x3468af[_0xfe8f('0x2b')][_0xfe8f('0x74')]=util['format']('SIP/%s',_0x2c36ce['user'][_0xfe8f('0x3a')]);_0x3468af[_0xfe8f('0x2b')][_0xfe8f('0x75')]=_0x227325[_0xfe8f('0x75')];_0x3468af[_0xfe8f('0x2b')][_0xfe8f('0x76')]=_0xfe8f('0x36');respondWithRpcPromise(_0xfe8f('0x77'),_0xfe8f('0x77'),{'event':_0xfe8f('0x80'),'message':_0x3468af[_0xfe8f('0x2b')]},client9002);return _0x227325;}return null;})[_0xfe8f('0x23')](respondWithResult(_0x2279c4,null))[_0xfe8f('0x2c')](handleError(_0x2279c4,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 1d04ed6..35aa0ea 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 _0xa232=['exports','setMaxListeners','save','update','emit'];(function(_0x2cfa79,_0x440869){var _0x5cc721=function(_0x40f2a4){while(--_0x40f2a4){_0x2cfa79['push'](_0x2cfa79['shift']());}};_0x5cc721(++_0x440869);}(_0xa232,0x141));var _0x2a23=function(_0x2a9581,_0x469b30){_0x2a9581=_0x2a9581-0x0;var _0x1d5592=_0xa232[_0x2a9581];return _0x1d5592;};'use strict';var EventEmitter=require('events');var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x2a23('0x0')](0x0);var events={'afterCreate':_0x2a23('0x1'),'afterUpdate':_0x2a23('0x2'),'afterDestroy':'remove'};function emitEvent(_0xf6e9f7){return function(_0x3e1aa4,_0x48305a,_0x44cb6d){ChatMessageEvents[_0x2a23('0x3')](_0xf6e9f7+':'+_0x3e1aa4['id'],_0x3e1aa4);ChatMessageEvents[_0x2a23('0x3')](_0xf6e9f7,_0x3e1aa4);_0x44cb6d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x2a23('0x4')]=ChatMessageEvents; \ No newline at end of file +var _0xaf93=['exports','events','../../mysqldb','save','update','emit','hasOwnProperty'];(function(_0xd7daae,_0x5b4575){var _0x57dee8=function(_0x16d822){while(--_0x16d822){_0xd7daae['push'](_0xd7daae['shift']());}};_0x57dee8(++_0x5b4575);}(_0xaf93,0x151));var _0x3af9=function(_0xda18e5,_0x8ba7a5){_0xda18e5=_0xda18e5-0x0;var _0x2ed6de=_0xaf93[_0xda18e5];return _0x2ed6de;};'use strict';var EventEmitter=require(_0x3af9('0x0'));var ChatMessage=require(_0x3af9('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3af9('0x2'),'afterUpdate':_0x3af9('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1319bc){return function(_0x44ae6e,_0x5add3,_0x189013){ChatMessageEvents[_0x3af9('0x4')](_0x1319bc+':'+_0x44ae6e['id'],_0x44ae6e);ChatMessageEvents[_0x3af9('0x4')](_0x1319bc,_0x44ae6e);_0x189013(null);};}for(var e in events){if(events[_0x3af9('0x5')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x3af9('0x6')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 416c7e9..c343b50 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 _0x8316=['../../config/logger','api','moment','bluebird','request-promise','./chatMessage.attributes','define','ChatMessage','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','then','update','createdAt','catch','error','utf8mb4_unicode_ci','util'];(function(_0x2624c3,_0x56dcdf){var _0x1e0be3=function(_0x37f1b2){while(--_0x37f1b2){_0x2624c3['push'](_0x2624c3['shift']());}};_0x1e0be3(++_0x56dcdf);}(_0x8316,0x137));var _0x6831=function(_0x24a488,_0x332929){_0x24a488=_0x24a488-0x0;var _0xd618b=_0x8316[_0x24a488];return _0xd618b;};'use strict';var _=require('lodash');var util=require(_0x6831('0x0'));var logger=require(_0x6831('0x1'))(_0x6831('0x2'));var moment=require(_0x6831('0x3'));var BPromise=require(_0x6831('0x4'));var rp=require(_0x6831('0x5'));var attributes=require(_0x6831('0x6'));module['exports']=function(_0x1e99fd,_0x180e03){return _0x1e99fd[_0x6831('0x7')](_0x6831('0x8'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3ac4e1,_0x23a15a,_0x27890b){var _0x3b32cb=_0x1e99fd['models'];var _0x1896ea=_0x3ac4e1[_0x6831('0x9')]({'plain':!![]});if(_0x1896ea[_0x6831('0xa')][_0x6831('0xb')]()==='in'||_0x1896ea[_0x6831('0xa')]['toLowerCase']()===_0x6831('0xc')&&!_0x1896ea[_0x6831('0xd')]&&!_[_0x6831('0xe')](_0x1896ea[_0x6831('0xf')])){_0x3b32cb[_0x6831('0x10')][_0x6831('0x11')]({'where':{'id':_0x1896ea['ChatInteractionId']}})[_0x6831('0x12')](function(_0x5e5976){if(_0x5e5976){_0x5e5976[_0x6831('0x13')]({'lastMsgAt':_0x1896ea[_0x6831('0x14')],'lastMsgDirection':_0x1896ea[_0x6831('0xa')][_0x6831('0xb')](),'lastMsgBody':_0x1896ea['body']});}})[_0x6831('0x15')](function(_0x14c6f1){console[_0x6831('0x16')](_0x14c6f1);});}_0x27890b();}},'charset':'utf8mb4','collate':_0x6831('0x17')});}; \ No newline at end of file +var _0x012d=['findOne','ChatInteractionId','then','update','body','catch','error','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','models','get','toLowerCase','direction','out','secret','ChatInteraction'];(function(_0x418c70,_0x87f331){var _0x4243ff=function(_0x4effcb){while(--_0x4effcb){_0x418c70['push'](_0x418c70['shift']());}};_0x4243ff(++_0x87f331);}(_0x012d,0x18d));var _0xd012=function(_0x40ca0c,_0x1d3ce0){_0x40ca0c=_0x40ca0c-0x0;var _0x5a1c45=_0x012d[_0x40ca0c];return _0x5a1c45;};'use strict';var _=require(_0xd012('0x0'));var util=require(_0xd012('0x1'));var logger=require(_0xd012('0x2'))(_0xd012('0x3'));var moment=require(_0xd012('0x4'));var BPromise=require(_0xd012('0x5'));var rp=require(_0xd012('0x6'));var attributes=require(_0xd012('0x7'));module[_0xd012('0x8')]=function(_0x32b474,_0x1e1b6b){return _0x32b474[_0xd012('0x9')](_0xd012('0xa'),attributes,{'tableName':_0xd012('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1d74dd,_0x2f6b36,_0x1d6d9f){var _0x5986e0=_0x32b474[_0xd012('0xc')];var _0x23ff2d=_0x1d74dd[_0xd012('0xd')]({'plain':!![]});if(_0x23ff2d['direction'][_0xd012('0xe')]()==='in'||_0x23ff2d[_0xd012('0xf')][_0xd012('0xe')]()===_0xd012('0x10')&&!_0x23ff2d[_0xd012('0x11')]&&!_['isNil'](_0x23ff2d['UserId'])){_0x5986e0[_0xd012('0x12')][_0xd012('0x13')]({'where':{'id':_0x23ff2d[_0xd012('0x14')]}})[_0xd012('0x15')](function(_0xc4bed5){if(_0xc4bed5){_0xc4bed5[_0xd012('0x16')]({'lastMsgAt':_0x23ff2d['createdAt'],'lastMsgDirection':_0x23ff2d[_0xd012('0xf')][_0xd012('0xe')](),'lastMsgBody':_0x23ff2d[_0xd012('0x17')]});}})[_0xd012('0x18')](function(_0x37806b){console[_0xd012('0x19')](_0x37806b);});}_0x1d6d9f();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index abfeedb..0026b3b 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 _0x91a5=['socket.io-emitter','register','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','code','message','error','result','catch','ChatMessage','create','options','raw','CreateChatMessage','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','redis','defaults','localhost'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x91a5,0x186));var _0x591a=function(_0x2d486b,_0x5f213c){_0x2d486b=_0x2d486b-0x0;var _0x4291d1=_0x91a5[_0x2d486b];return _0x4291d1;};'use strict';var _=require(_0x591a('0x0'));var util=require(_0x591a('0x1'));var moment=require(_0x591a('0x2'));var BPromise=require(_0x591a('0x3'));var rs=require(_0x591a('0x4'));var fs=require('fs');var Redis=require(_0x591a('0x5'));var db=require(_0x591a('0x6'))['db'];var utils=require(_0x591a('0x7'));var logger=require('../../config/logger')(_0x591a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x591a('0x9')]['http']({'port':0x232a});config[_0x591a('0xa')]=_[_0x591a('0xb')](config[_0x591a('0xa')],{'host':_0x591a('0xc'),'port':0x18eb});var socket=require(_0x591a('0xd'))(new Redis(config['redis']));require('./chatMessage.socket')[_0x591a('0xe')](socket);function respondWithRpcPromise(_0x3e92d4,_0x584cce,_0x2b0154){return new BPromise(function(_0x222965,_0x4a209b){return client['request'](_0x3e92d4,_0x2b0154)[_0x591a('0xf')](function(_0x3c1cfb){logger[_0x591a('0x10')](_0x591a('0x11'),_0x584cce,_0x591a('0x12'));logger[_0x591a('0x13')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x584cce,'request\x20sent',JSON['stringify'](_0x3c1cfb));if(_0x3c1cfb['error']){if(_0x3c1cfb['error'][_0x591a('0x14')]===0x1f4){logger['error'](_0x591a('0x11'),_0x584cce,_0x3c1cfb['error'][_0x591a('0x15')]);return _0x4a209b(_0x3c1cfb[_0x591a('0x16')][_0x591a('0x15')]);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x584cce,_0x3c1cfb['error'][_0x591a('0x15')]);return _0x222965(_0x3c1cfb[_0x591a('0x16')][_0x591a('0x15')]);}else{logger[_0x591a('0x10')](_0x591a('0x11'),_0x584cce,'request\x20sent');_0x222965(_0x3c1cfb[_0x591a('0x17')][_0x591a('0x15')]);}})[_0x591a('0x18')](function(_0x57362a){logger[_0x591a('0x16')]('ChatMessage,\x20%s,\x20%s',_0x584cce,_0x57362a);_0x4a209b(_0x57362a);});});}exports['CreateChatMessage']=function(_0x4d53fb){var _0x185c5c=this;return new Promise(function(_0x40db38,_0x3d95b5){return db[_0x591a('0x19')][_0x591a('0x1a')](_0x4d53fb['body'],{'raw':_0x4d53fb['options']?_0x4d53fb[_0x591a('0x1b')][_0x591a('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x206f1b){logger[_0x591a('0x10')](_0x591a('0x1d'),_0x4d53fb);logger[_0x591a('0x13')]('CreateChatMessage',_0x4d53fb,JSON[_0x591a('0x1e')](_0x206f1b));_0x40db38(_0x206f1b);})[_0x591a('0x18')](function(_0x5a7541){logger[_0x591a('0x16')](_0x591a('0x1d'),_0x5a7541[_0x591a('0x15')],_0x4d53fb);_0x3d95b5(_0x185c5c['error'](0x1f4,_0x5a7541['message']));});});}; \ No newline at end of file +var _0x6334=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./chatMessage.socket','register','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateChatMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x6334,0x1a9));var _0x4633=function(_0x1d3892,_0x47d5fe){_0x1d3892=_0x1d3892-0x0;var _0x574ff2=_0x6334[_0x1d3892];return _0x574ff2;};'use strict';var _=require(_0x4633('0x0'));var util=require(_0x4633('0x1'));var moment=require(_0x4633('0x2'));var BPromise=require(_0x4633('0x3'));var rs=require(_0x4633('0x4'));var fs=require('fs');var Redis=require(_0x4633('0x5'));var db=require(_0x4633('0x6'))['db'];var utils=require(_0x4633('0x7'));var logger=require('../../config/logger')(_0x4633('0x8'));var config=require(_0x4633('0x9'));var jayson=require(_0x4633('0xa'));var client=jayson[_0x4633('0xb')][_0x4633('0xc')]({'port':0x232a});config[_0x4633('0xd')]=_['defaults'](config[_0x4633('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x4633('0xe'))(new Redis(config[_0x4633('0xd')]));require(_0x4633('0xf'))[_0x4633('0x10')](socket);function respondWithRpcPromise(_0x45f0ae,_0x57ab41,_0x14b80b){return new BPromise(function(_0x440738,_0x83c6f1){return client['request'](_0x45f0ae,_0x14b80b)[_0x4633('0x11')](function(_0x38341b){logger[_0x4633('0x12')](_0x4633('0x13'),_0x57ab41,_0x4633('0x14'));logger[_0x4633('0x15')](_0x4633('0x16'),_0x57ab41,_0x4633('0x14'),JSON['stringify'](_0x38341b));if(_0x38341b[_0x4633('0x17')]){if(_0x38341b[_0x4633('0x17')][_0x4633('0x18')]===0x1f4){logger[_0x4633('0x17')]('ChatMessage,\x20%s,\x20%s',_0x57ab41,_0x38341b['error']['message']);return _0x83c6f1(_0x38341b[_0x4633('0x17')][_0x4633('0x19')]);}logger['error'](_0x4633('0x13'),_0x57ab41,_0x38341b['error']['message']);return _0x440738(_0x38341b[_0x4633('0x17')][_0x4633('0x19')]);}else{logger[_0x4633('0x12')](_0x4633('0x13'),_0x57ab41,_0x4633('0x14'));_0x440738(_0x38341b['result'][_0x4633('0x19')]);}})[_0x4633('0x1a')](function(_0x4a83bf){logger['error']('ChatMessage,\x20%s,\x20%s',_0x57ab41,_0x4a83bf);_0x83c6f1(_0x4a83bf);});});}exports[_0x4633('0x1b')]=function(_0x5f660a){var _0x35f231=this;return new Promise(function(_0x44490a,_0x709adb){return db['ChatMessage'][_0x4633('0x1c')](_0x5f660a[_0x4633('0x1d')],{'raw':_0x5f660a[_0x4633('0x1e')]?_0x5f660a[_0x4633('0x1e')][_0x4633('0x1f')]===undefined?!![]:![]:!![]})[_0x4633('0x11')](function(_0x588df0){logger['info'](_0x4633('0x1b'),_0x5f660a);logger['debug'](_0x4633('0x1b'),_0x5f660a,JSON[_0x4633('0x20')](_0x588df0));_0x44490a(_0x588df0);})['catch'](function(_0x4406e2){logger[_0x4633('0x17')]('CreateChatMessage',_0x4406e2[_0x4633('0x19')],_0x5f660a);_0x709adb(_0x35f231[_0x4633('0x17')](0x1f4,_0x4406e2[_0x4633('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index df7daa5..185ca0e 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 _0x55ca=['removeListener','register','./chatMessage.events','save'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x55ca,0x126));var _0xa55c=function(_0x90a39a,_0x32020d){_0x90a39a=_0x90a39a-0x0;var _0x2b62f7=_0x55ca[_0x90a39a];return _0x2b62f7;};'use strict';var ChatMessageEvents=require(_0xa55c('0x0'));var events=[_0xa55c('0x1'),'remove','update'];function createListener(_0x49875a,_0x1c6ec3){return function(_0x267ea0){_0x1c6ec3['emit'](_0x49875a,_0x267ea0);};}function removeListener(_0x3b478a,_0x2db02a){return function(){ChatMessageEvents[_0xa55c('0x2')](_0x3b478a,_0x2db02a);};}exports[_0xa55c('0x3')]=function(_0x3c97c8){for(var _0x279caa=0x0,_0x36b623=events['length'];_0x279caa<_0x36b623;_0x279caa++){var _0x2121fd=events[_0x279caa];var _0x2537f0=createListener('chatMessage:'+_0x2121fd,_0x3c97c8);ChatMessageEvents['on'](_0x2121fd,_0x2537f0);}}; \ No newline at end of file +var _0x70e0=['chatMessage:','./chatMessage.events','save','remove','emit','removeListener'];(function(_0x175530,_0x419a58){var _0x22eba8=function(_0x1f4e01){while(--_0x1f4e01){_0x175530['push'](_0x175530['shift']());}};_0x22eba8(++_0x419a58);}(_0x70e0,0x17b));var _0x070e=function(_0x2e4a67,_0x28bf1f){_0x2e4a67=_0x2e4a67-0x0;var _0x3044ae=_0x70e0[_0x2e4a67];return _0x3044ae;};'use strict';var ChatMessageEvents=require(_0x070e('0x0'));var events=[_0x070e('0x1'),_0x070e('0x2'),'update'];function createListener(_0x579b83,_0x16e651){return function(_0xee173){_0x16e651[_0x070e('0x3')](_0x579b83,_0xee173);};}function removeListener(_0x2593e5,_0x5c90fc){return function(){ChatMessageEvents[_0x070e('0x4')](_0x2593e5,_0x5c90fc);};}exports['register']=function(_0x46fe68){for(var _0x4b041d=0x0,_0x56e420=events['length'];_0x4b041d<_0x56e420;_0x4b041d++){var _0x35ab0c=events[_0x4b041d];var _0x1e11f0=createListener(_0x070e('0x5')+_0x35ab0c,_0x46fe68);ChatMessageEvents['on'](_0x35ab0c,_0x1e11f0);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 10b0475..9c14d08 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 _0xa006=['Router','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','/:id/accept','accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x289db6,_0x4f1371){var _0x428adc=function(_0x18d0a6){while(--_0x18d0a6){_0x289db6['push'](_0x289db6['shift']());}};_0x428adc(++_0x4f1371);}(_0xa006,0x109));var _0x6a00=function(_0x4c7b17,_0x397523){_0x4c7b17=_0x4c7b17-0x0;var _0x3fe5d8=_0xa006[_0x4c7b17];return _0x3fe5d8;};'use strict';var multer=require(_0x6a00('0x0'));var util=require(_0x6a00('0x1'));var path=require(_0x6a00('0x2'));var timeout=require(_0x6a00('0x3'));var express=require(_0x6a00('0x4'));var router=express[_0x6a00('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x6a00('0x6'));var config=require(_0x6a00('0x7'));var controller=require(_0x6a00('0x8'));router[_0x6a00('0x9')]('/',auth[_0x6a00('0xa')](),controller['index']);router[_0x6a00('0x9')](_0x6a00('0xb'),auth[_0x6a00('0xa')](),controller[_0x6a00('0xc')]);router[_0x6a00('0x9')](_0x6a00('0xd'),auth['isAuthenticated'](),controller[_0x6a00('0xe')]);router[_0x6a00('0xf')]('/',auth[_0x6a00('0xa')](),interaction[_0x6a00('0x10')](_0x6a00('0x11'),_0x6a00('0x12')),controller[_0x6a00('0x13')]);router[_0x6a00('0x14')]('/:id',controller['update']);router[_0x6a00('0x14')](_0x6a00('0x15'),auth['isAuthenticated'](),controller[_0x6a00('0x16')]);router[_0x6a00('0x14')]('/:id/reject',auth[_0x6a00('0xa')](),controller[_0x6a00('0x17')]);router[_0x6a00('0x18')](_0x6a00('0xd'),auth[_0x6a00('0xa')](),controller[_0x6a00('0x19')]);module[_0x6a00('0x1a')]=router; \ No newline at end of file +var _0x41da=['tracked','chat','chatmessage:create','create','put','update','/:id/accept','reject','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x41da,0xb8));var _0xa41d=function(_0x23648b,_0x51a25f){_0x23648b=_0x23648b-0x0;var _0x2b5a63=_0x41da[_0x23648b];return _0x2b5a63;};'use strict';var multer=require(_0xa41d('0x0'));var util=require(_0xa41d('0x1'));var path=require('path');var timeout=require(_0xa41d('0x2'));var express=require(_0xa41d('0x3'));var router=express[_0xa41d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa41d('0x5'));var config=require(_0xa41d('0x6'));var controller=require(_0xa41d('0x7'));router[_0xa41d('0x8')]('/',auth[_0xa41d('0x9')](),controller[_0xa41d('0xa')]);router[_0xa41d('0x8')](_0xa41d('0xb'),auth[_0xa41d('0x9')](),controller[_0xa41d('0xc')]);router['get'](_0xa41d('0xd'),auth[_0xa41d('0x9')](),controller[_0xa41d('0xe')]);router[_0xa41d('0xf')]('/',auth[_0xa41d('0x9')](),interaction[_0xa41d('0x10')](_0xa41d('0x11'),_0xa41d('0x12')),controller[_0xa41d('0x13')]);router[_0xa41d('0x14')](_0xa41d('0xd'),controller[_0xa41d('0x15')]);router['put'](_0xa41d('0x16'),auth[_0xa41d('0x9')](),controller['accept']);router[_0xa41d('0x14')]('/:id/reject',auth[_0xa41d('0x9')](),controller[_0xa41d('0x17')]);router['delete']('/:id',auth[_0xa41d('0x9')](),controller['destroy']);module[_0xa41d('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index d41412f..de54166 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 _0x0cd2=['medium','sequelize'];(function(_0x4d2053,_0x34c00e){var _0x4e7cb7=function(_0x338f43){while(--_0x338f43){_0x4d2053['push'](_0x4d2053['shift']());}};_0x4e7cb7(++_0x34c00e);}(_0x0cd2,0x1cb));var _0x20cd=function(_0x20aaec,_0x4664d9){_0x20aaec=_0x20aaec-0x0;var _0x1c5d41=_0x0cd2[_0x20aaec];return _0x1c5d41;};'use strict';var Sequelize=require(_0x20cd('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x20cd('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x54a1=['medium','sequelize','TEXT'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x54a1,0xf1));var _0x154a=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x54a1[_0x413feb];return _0x40ee88;};'use strict';var Sequelize=require(_0x154a('0x0'));module['exports']={'body':{'type':Sequelize[_0x154a('0x1')](_0x154a('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 2c224b7..781b649 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 _0x1176=['order','sort','where','filters','pick','day','add','merge','filter','options','include','findAll','then','rows','catch','show','intersection','length','includeAll','find','create','body','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','to-csv','ejs','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','Content-Range','apply','reject','update','error','stack','name','send','index','ChatOfflineMessage','rawAttributes','dateStart','query','dateEnd','keys','model','attributes','fields','hasOwnProperty','nolimit'];(function(_0x3a3240,_0x4227ee){var _0x146d2b=function(_0x196d64){while(--_0x196d64){_0x3a3240['push'](_0x3a3240['shift']());}};_0x146d2b(++_0x4227ee);}(_0x1176,0xa3));var _0x6117=function(_0x4685c8,_0x314965){_0x4685c8=_0x4685c8-0x0;var _0x4dbd51=_0x1176[_0x4685c8];return _0x4dbd51;};'use strict';var pdf=require(_0x6117('0x0'));var emlformat=require(_0x6117('0x1'));var rimraf=require(_0x6117('0x2'));var zipdir=require(_0x6117('0x3'));var jsonpatch=require(_0x6117('0x4'));var rp=require('request-promise');var moment=require(_0x6117('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x6117('0x6'));var ejs=require(_0x6117('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6117('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6117('0x9'));var toCsv=require(_0x6117('0x6'));var querystring=require(_0x6117('0xa'));var Papa=require('papaparse');var Redis=require(_0x6117('0xb'));var qs=require(_0x6117('0xc'));var logger=require(_0x6117('0xd'))(_0x6117('0xe'));var utils=require(_0x6117('0xf'));var config=require(_0x6117('0x10'));var db=require(_0x6117('0x11'))['db'];function respondWithStatusCode(_0xa89381,_0x2ceb8b){_0x2ceb8b=_0x2ceb8b||0xcc;return function(_0x213581){if(_0x213581){return _0xa89381['sendStatus'](_0x2ceb8b);}return _0xa89381['status'](_0x2ceb8b)[_0x6117('0x12')]();};}function respondWithResult(_0x49f3bb,_0x51d3cd){_0x51d3cd=_0x51d3cd||0xc8;return function(_0x9898f5){if(_0x9898f5){return _0x49f3bb[_0x6117('0x13')](_0x51d3cd)[_0x6117('0x14')](_0x9898f5);}};}function respondWithFilteredResult(_0x2e521a,_0xc16565){return function(_0x17f688){if(_0x17f688){var _0x520ee1=_0x17f688[_0x6117('0x15')],_0x2192ab=_0xc16565[_0x6117('0x16')],_0x403469=_0xc16565[_0x6117('0x16')]+_0xc16565[_0x6117('0x17')],_0x4cb2d4;if(_0x403469>=_0x520ee1){_0x403469=_0x520ee1;_0x4cb2d4=0xc8;}else{_0x4cb2d4=0xce;}_0x2e521a[_0x6117('0x13')](_0x4cb2d4);return _0x2e521a['set'](_0x6117('0x18'),_0x2192ab+'-'+_0x403469+'/'+_0x520ee1)[_0x6117('0x14')](_0x17f688);}return null;};}function patchUpdates(_0x367958){return function(_0x463c08){try{jsonpatch[_0x6117('0x19')](_0x463c08,_0x367958,!![]);}catch(_0x31daed){return BPromise[_0x6117('0x1a')](_0x31daed);}return _0x463c08['save']();};}function saveUpdates(_0x3ea1e3,_0x267974){return function(_0x5074df){if(_0x5074df){return _0x5074df[_0x6117('0x1b')](_0x3ea1e3)['then'](function(_0x47c391){return _0x47c391;});}return null;};}function removeEntity(_0x116e1b,_0x724142){return function(_0x53e61c){if(_0x53e61c){return _0x53e61c['destroy']()['then'](function(){_0x116e1b[_0x6117('0x13')](0xcc)[_0x6117('0x12')]();});}};}function handleEntityNotFound(_0x3169c6,_0x2b7f50){return function(_0x124c94){if(!_0x124c94){_0x3169c6['sendStatus'](0x194);}return _0x124c94;};}function handleError(_0x2e6eb4,_0x40b147){_0x40b147=_0x40b147||0x1f4;return function(_0x5f1a04){logger[_0x6117('0x1c')](_0x5f1a04[_0x6117('0x1d')]);if(_0x5f1a04[_0x6117('0x1e')]){delete _0x5f1a04[_0x6117('0x1e')];}_0x2e6eb4[_0x6117('0x13')](_0x40b147)[_0x6117('0x1f')](_0x5f1a04);};}exports[_0x6117('0x20')]=function(_0x43731e,_0x14f509){var _0x5649ba={},_0x31e2de={},_0x3f59d9={'count':0x0,'rows':[]};var _0x518e99=db[_0x6117('0x21')][_0x6117('0x22')];_0x31e2de['model']=_['keys'](_0x518e99);var _0x5aa1f5={'dateStart':_0x43731e['query'][_0x6117('0x23')],'dateEnd':_0x43731e[_0x6117('0x24')][_0x6117('0x25')]};delete _0x43731e[_0x6117('0x24')][_0x6117('0x23')];delete _0x43731e[_0x6117('0x24')][_0x6117('0x25')];_0x31e2de[_0x6117('0x24')]=_[_0x6117('0x26')](_0x43731e[_0x6117('0x24')]);_0x31e2de['filters']=_['intersection'](_0x31e2de[_0x6117('0x27')],_0x31e2de['query']);_0x5649ba[_0x6117('0x28')]=_['intersection'](_0x31e2de[_0x6117('0x27')],qs[_0x6117('0x29')](_0x43731e[_0x6117('0x24')]['fields']));_0x5649ba[_0x6117('0x28')]=_0x5649ba['attributes']['length']?_0x5649ba[_0x6117('0x28')]:_0x31e2de[_0x6117('0x27')];if(!_0x43731e['query'][_0x6117('0x2a')](_0x6117('0x2b'))){_0x5649ba[_0x6117('0x17')]=qs[_0x6117('0x17')](_0x43731e[_0x6117('0x24')][_0x6117('0x17')]);_0x5649ba[_0x6117('0x16')]=qs[_0x6117('0x16')](_0x43731e[_0x6117('0x24')]['offset']);}_0x5649ba[_0x6117('0x2c')]=qs[_0x6117('0x2d')](_0x43731e[_0x6117('0x24')]['sort']);_0x5649ba[_0x6117('0x2e')]=qs[_0x6117('0x2f')](_[_0x6117('0x30')](_0x43731e['query'],_0x31e2de[_0x6117('0x2f')]));if(_0x5aa1f5[_0x6117('0x23')]){if(_0x5aa1f5[_0x6117('0x25')]){_0x5aa1f5['dateEnd']=moment(_0x5aa1f5[_0x6117('0x25')])['add'](0x1,_0x6117('0x31'));}else{_0x5aa1f5[_0x6117('0x25')]=moment(_0x5aa1f5['dateStart'])[_0x6117('0x32')](0x1,_0x6117('0x31'));}_[_0x6117('0x33')](_0x5649ba['where'],{'createdAt':{'$gte':_0x5aa1f5[_0x6117('0x23')],'$lte':_0x5aa1f5['dateEnd']}});}if(_0x43731e[_0x6117('0x24')][_0x6117('0x34')]){_0x5649ba[_0x6117('0x2e')]=_[_0x6117('0x33')](_0x5649ba['where'],{'$or':_['map'](_0x5649ba[_0x6117('0x28')],function(_0x5765c8){var _0x2d7908={};_0x2d7908[_0x5765c8]={'$like':'%'+_0x43731e['query'][_0x6117('0x34')]+'%'};return _0x2d7908;})});}_0x5649ba=_[_0x6117('0x33')]({},_0x5649ba,_0x43731e[_0x6117('0x35')]);var _0x3593b7={'where':_0x5649ba[_0x6117('0x2e')]};return db[_0x6117('0x21')][_0x6117('0x15')](_0x3593b7)['then'](function(_0x3888d5){_0x3f59d9[_0x6117('0x15')]=_0x3888d5;if(_0x43731e[_0x6117('0x24')]['includeAll']){_0x5649ba[_0x6117('0x36')]=[{'all':!![]}];}return db[_0x6117('0x21')][_0x6117('0x37')](_0x5649ba);})[_0x6117('0x38')](function(_0xff4a1c){_0x3f59d9[_0x6117('0x39')]=_0xff4a1c;return _0x3f59d9;})[_0x6117('0x38')](respondWithFilteredResult(_0x14f509,_0x5649ba))[_0x6117('0x3a')](handleError(_0x14f509,null));};exports[_0x6117('0x3b')]=function(_0x344141,_0x1a2f27){var _0x1aac40={'raw':!![],'where':{'id':_0x344141['params']['id']}},_0x508d6d={};_0x508d6d[_0x6117('0x27')]=_[_0x6117('0x26')](db[_0x6117('0x21')][_0x6117('0x22')]);_0x508d6d['query']=_[_0x6117('0x26')](_0x344141[_0x6117('0x24')]);_0x508d6d[_0x6117('0x2f')]=_[_0x6117('0x3c')](_0x508d6d['model'],_0x508d6d[_0x6117('0x24')]);_0x1aac40[_0x6117('0x28')]=_['intersection'](_0x508d6d['model'],qs[_0x6117('0x29')](_0x344141[_0x6117('0x24')][_0x6117('0x29')]));_0x1aac40['attributes']=_0x1aac40[_0x6117('0x28')][_0x6117('0x3d')]?_0x1aac40[_0x6117('0x28')]:_0x508d6d[_0x6117('0x27')];if(_0x344141['query'][_0x6117('0x3e')]){_0x1aac40[_0x6117('0x36')]=[{'all':!![]}];}_0x1aac40=_[_0x6117('0x33')]({},_0x1aac40,_0x344141[_0x6117('0x35')]);return db['ChatOfflineMessage'][_0x6117('0x3f')](_0x1aac40)[_0x6117('0x38')](handleEntityNotFound(_0x1a2f27,null))[_0x6117('0x38')](respondWithResult(_0x1a2f27,null))['catch'](handleError(_0x1a2f27,null));};exports['create']=function(_0x30c0bc,_0x554510){return db['ChatOfflineMessage'][_0x6117('0x40')](_0x30c0bc[_0x6117('0x41')],{})['then'](respondWithResult(_0x554510,0xc9))[_0x6117('0x3a')](handleError(_0x554510,null));};exports[_0x6117('0x1b')]=function(_0x5d8f05,_0x29c163){if(_0x5d8f05['body']['id']){delete _0x5d8f05[_0x6117('0x41')]['id'];}return db[_0x6117('0x21')]['find']({'where':{'id':_0x5d8f05[_0x6117('0x42')]['id']}})[_0x6117('0x38')](handleEntityNotFound(_0x29c163,null))[_0x6117('0x38')](saveUpdates(_0x5d8f05[_0x6117('0x41')],null))[_0x6117('0x38')](respondWithResult(_0x29c163,null))[_0x6117('0x3a')](handleError(_0x29c163,null));};exports[_0x6117('0x43')]=function(_0x41117a,_0x1a9a3a){return db[_0x6117('0x21')][_0x6117('0x3f')]({'where':{'id':_0x41117a[_0x6117('0x42')]['id']}})[_0x6117('0x38')](handleEntityNotFound(_0x1a9a3a,null))[_0x6117('0x38')](removeEntity(_0x1a9a3a,null))[_0x6117('0x3a')](handleError(_0x1a9a3a,null));};exports[_0x6117('0x44')]=function(_0x3b504a,_0x1c368c){return db[_0x6117('0x21')]['describe']()[_0x6117('0x38')](respondWithResult(_0x1c368c,null))[_0x6117('0x3a')](handleError(_0x1c368c,null));}; \ No newline at end of file +var _0xef1a=['query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','add','day','merge','where','filter','map','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','update','then','end','error','stack','name','index','ChatOfflineMessage','rawAttributes','model','keys'];(function(_0x10d6f2,_0x18ae62){var _0x59e5c7=function(_0x3edf41){while(--_0x3edf41){_0x10d6f2['push'](_0x10d6f2['shift']());}};_0x59e5c7(++_0x18ae62);}(_0xef1a,0xaf));var _0xaef1=function(_0x3954f0,_0x38ff5f){_0x3954f0=_0x3954f0-0x0;var _0x41fc13=_0xef1a[_0x3954f0];return _0x41fc13;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xaef1('0x0'));var zipdir=require(_0xaef1('0x1'));var jsonpatch=require(_0xaef1('0x2'));var rp=require(_0xaef1('0x3'));var moment=require('moment');var BPromise=require(_0xaef1('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xaef1('0x5'));var sox=require(_0xaef1('0x6'));var csv=require('to-csv');var ejs=require(_0xaef1('0x7'));var fs=require('fs');var _=require(_0xaef1('0x8'));var squel=require(_0xaef1('0x9'));var crypto=require(_0xaef1('0xa'));var jsforce=require(_0xaef1('0xb'));var deskjs=require(_0xaef1('0xc'));var toCsv=require(_0xaef1('0xd'));var querystring=require(_0xaef1('0xe'));var Papa=require(_0xaef1('0xf'));var Redis=require(_0xaef1('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0xaef1('0x11'))(_0xaef1('0x12'));var utils=require(_0xaef1('0x13'));var config=require(_0xaef1('0x14'));var db=require(_0xaef1('0x15'))['db'];function respondWithStatusCode(_0x2c141b,_0x465ce6){_0x465ce6=_0x465ce6||0xcc;return function(_0x4994af){if(_0x4994af){return _0x2c141b[_0xaef1('0x16')](_0x465ce6);}return _0x2c141b[_0xaef1('0x17')](_0x465ce6)['end']();};}function respondWithResult(_0x583672,_0x244f0d){_0x244f0d=_0x244f0d||0xc8;return function(_0x7879a9){if(_0x7879a9){return _0x583672[_0xaef1('0x17')](_0x244f0d)['json'](_0x7879a9);}};}function respondWithFilteredResult(_0x53e958,_0x5273ab){return function(_0x1ac899){if(_0x1ac899){var _0x5c47f1=_0x1ac899[_0xaef1('0x18')],_0x6ebe9a=_0x5273ab[_0xaef1('0x19')],_0x38a83b=_0x5273ab['offset']+_0x5273ab[_0xaef1('0x1a')],_0xf264d8;if(_0x38a83b>=_0x5c47f1){_0x38a83b=_0x5c47f1;_0xf264d8=0xc8;}else{_0xf264d8=0xce;}_0x53e958['status'](_0xf264d8);return _0x53e958[_0xaef1('0x1b')](_0xaef1('0x1c'),_0x6ebe9a+'-'+_0x38a83b+'/'+_0x5c47f1)[_0xaef1('0x1d')](_0x1ac899);}return null;};}function patchUpdates(_0x2a9052){return function(_0xcba1cd){try{jsonpatch['apply'](_0xcba1cd,_0x2a9052,!![]);}catch(_0x2beb13){return BPromise['reject'](_0x2beb13);}return _0xcba1cd['save']();};}function saveUpdates(_0x38399c,_0xb244c7){return function(_0x52e24b){if(_0x52e24b){return _0x52e24b[_0xaef1('0x1e')](_0x38399c)[_0xaef1('0x1f')](function(_0x67d3d5){return _0x67d3d5;});}return null;};}function removeEntity(_0x40a9c3,_0x310f67){return function(_0x40db30){if(_0x40db30){return _0x40db30['destroy']()['then'](function(){_0x40a9c3['status'](0xcc)[_0xaef1('0x20')]();});}};}function handleEntityNotFound(_0x5b499b,_0x4b789e){return function(_0x4c22cf){if(!_0x4c22cf){_0x5b499b[_0xaef1('0x16')](0x194);}return _0x4c22cf;};}function handleError(_0x3ac9c1,_0x2fb0b2){_0x2fb0b2=_0x2fb0b2||0x1f4;return function(_0x16a4ff){logger[_0xaef1('0x21')](_0x16a4ff[_0xaef1('0x22')]);if(_0x16a4ff[_0xaef1('0x23')]){delete _0x16a4ff['name'];}_0x3ac9c1[_0xaef1('0x17')](_0x2fb0b2)['send'](_0x16a4ff);};}exports[_0xaef1('0x24')]=function(_0x5cbc98,_0x113a69){var _0x39c48c={},_0x398941={},_0xace91f={'count':0x0,'rows':[]};var _0x4186b=db[_0xaef1('0x25')][_0xaef1('0x26')];_0x398941[_0xaef1('0x27')]=_[_0xaef1('0x28')](_0x4186b);var _0x597111={'dateStart':_0x5cbc98[_0xaef1('0x29')][_0xaef1('0x2a')],'dateEnd':_0x5cbc98[_0xaef1('0x29')][_0xaef1('0x2b')]};delete _0x5cbc98['query'][_0xaef1('0x2a')];delete _0x5cbc98[_0xaef1('0x29')][_0xaef1('0x2b')];_0x398941[_0xaef1('0x29')]=_[_0xaef1('0x28')](_0x5cbc98[_0xaef1('0x29')]);_0x398941[_0xaef1('0x2c')]=_[_0xaef1('0x2d')](_0x398941[_0xaef1('0x27')],_0x398941[_0xaef1('0x29')]);_0x39c48c[_0xaef1('0x2e')]=_['intersection'](_0x398941[_0xaef1('0x27')],qs[_0xaef1('0x2f')](_0x5cbc98[_0xaef1('0x29')]['fields']));_0x39c48c[_0xaef1('0x2e')]=_0x39c48c[_0xaef1('0x2e')][_0xaef1('0x30')]?_0x39c48c['attributes']:_0x398941[_0xaef1('0x27')];if(!_0x5cbc98[_0xaef1('0x29')][_0xaef1('0x31')](_0xaef1('0x32'))){_0x39c48c[_0xaef1('0x1a')]=qs[_0xaef1('0x1a')](_0x5cbc98[_0xaef1('0x29')][_0xaef1('0x1a')]);_0x39c48c['offset']=qs[_0xaef1('0x19')](_0x5cbc98[_0xaef1('0x29')]['offset']);}_0x39c48c[_0xaef1('0x33')]=qs[_0xaef1('0x34')](_0x5cbc98[_0xaef1('0x29')]['sort']);_0x39c48c['where']=qs[_0xaef1('0x2c')](_[_0xaef1('0x35')](_0x5cbc98[_0xaef1('0x29')],_0x398941[_0xaef1('0x2c')]));if(_0x597111[_0xaef1('0x2a')]){if(_0x597111[_0xaef1('0x2b')]){_0x597111['dateEnd']=moment(_0x597111['dateEnd'])[_0xaef1('0x36')](0x1,_0xaef1('0x37'));}else{_0x597111[_0xaef1('0x2b')]=moment(_0x597111[_0xaef1('0x2a')])['add'](0x1,_0xaef1('0x37'));}_[_0xaef1('0x38')](_0x39c48c[_0xaef1('0x39')],{'createdAt':{'$gte':_0x597111['dateStart'],'$lte':_0x597111[_0xaef1('0x2b')]}});}if(_0x5cbc98[_0xaef1('0x29')][_0xaef1('0x3a')]){_0x39c48c['where']=_[_0xaef1('0x38')](_0x39c48c['where'],{'$or':_[_0xaef1('0x3b')](_0x39c48c[_0xaef1('0x2e')],function(_0x3316df){var _0x124d57={};_0x124d57[_0x3316df]={'$like':'%'+_0x5cbc98[_0xaef1('0x29')]['filter']+'%'};return _0x124d57;})});}_0x39c48c=_[_0xaef1('0x38')]({},_0x39c48c,_0x5cbc98[_0xaef1('0x3c')]);var _0x685dd8={'where':_0x39c48c[_0xaef1('0x39')]};return db['ChatOfflineMessage']['count'](_0x685dd8)[_0xaef1('0x1f')](function(_0x32abfe){_0xace91f['count']=_0x32abfe;if(_0x5cbc98[_0xaef1('0x29')][_0xaef1('0x3d')]){_0x39c48c[_0xaef1('0x3e')]=[{'all':!![]}];}return db[_0xaef1('0x25')]['findAll'](_0x39c48c);})[_0xaef1('0x1f')](function(_0xb9f8bd){_0xace91f[_0xaef1('0x3f')]=_0xb9f8bd;return _0xace91f;})[_0xaef1('0x1f')](respondWithFilteredResult(_0x113a69,_0x39c48c))[_0xaef1('0x40')](handleError(_0x113a69,null));};exports[_0xaef1('0x41')]=function(_0x575501,_0x3e2040){var _0x36702a={'raw':!![],'where':{'id':_0x575501[_0xaef1('0x42')]['id']}},_0x50f1b6={};_0x50f1b6[_0xaef1('0x27')]=_[_0xaef1('0x28')](db[_0xaef1('0x25')]['rawAttributes']);_0x50f1b6[_0xaef1('0x29')]=_[_0xaef1('0x28')](_0x575501[_0xaef1('0x29')]);_0x50f1b6[_0xaef1('0x2c')]=_[_0xaef1('0x2d')](_0x50f1b6[_0xaef1('0x27')],_0x50f1b6[_0xaef1('0x29')]);_0x36702a[_0xaef1('0x2e')]=_['intersection'](_0x50f1b6['model'],qs[_0xaef1('0x2f')](_0x575501[_0xaef1('0x29')][_0xaef1('0x2f')]));_0x36702a['attributes']=_0x36702a[_0xaef1('0x2e')][_0xaef1('0x30')]?_0x36702a[_0xaef1('0x2e')]:_0x50f1b6[_0xaef1('0x27')];if(_0x575501[_0xaef1('0x29')][_0xaef1('0x3d')]){_0x36702a['include']=[{'all':!![]}];}_0x36702a=_[_0xaef1('0x38')]({},_0x36702a,_0x575501[_0xaef1('0x3c')]);return db['ChatOfflineMessage'][_0xaef1('0x43')](_0x36702a)[_0xaef1('0x1f')](handleEntityNotFound(_0x3e2040,null))['then'](respondWithResult(_0x3e2040,null))[_0xaef1('0x40')](handleError(_0x3e2040,null));};exports['create']=function(_0x588711,_0x3067f7){return db[_0xaef1('0x25')][_0xaef1('0x44')](_0x588711[_0xaef1('0x45')],{})[_0xaef1('0x1f')](respondWithResult(_0x3067f7,0xc9))[_0xaef1('0x40')](handleError(_0x3067f7,null));};exports[_0xaef1('0x1e')]=function(_0xf625f4,_0x3f2550){if(_0xf625f4[_0xaef1('0x45')]['id']){delete _0xf625f4[_0xaef1('0x45')]['id'];}return db[_0xaef1('0x25')][_0xaef1('0x43')]({'where':{'id':_0xf625f4['params']['id']}})[_0xaef1('0x1f')](handleEntityNotFound(_0x3f2550,null))[_0xaef1('0x1f')](saveUpdates(_0xf625f4[_0xaef1('0x45')],null))[_0xaef1('0x1f')](respondWithResult(_0x3f2550,null))[_0xaef1('0x40')](handleError(_0x3f2550,null));};exports[_0xaef1('0x46')]=function(_0xb407d,_0x31ecaf){return db[_0xaef1('0x25')][_0xaef1('0x43')]({'where':{'id':_0xb407d[_0xaef1('0x42')]['id']}})[_0xaef1('0x1f')](handleEntityNotFound(_0x31ecaf,null))[_0xaef1('0x1f')](removeEntity(_0x31ecaf,null))[_0xaef1('0x40')](handleError(_0x31ecaf,null));};exports[_0xaef1('0x47')]=function(_0x1c8bd0,_0x23cad1){return db[_0xaef1('0x25')][_0xaef1('0x47')]()[_0xaef1('0x1f')](respondWithResult(_0x23cad1,null))[_0xaef1('0x40')](handleError(_0x23cad1,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index c150163..3cd1606 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 _0x4e9e=['./chatOfflineMessage.attributes','exports','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4e9e,0xf9));var _0xe4e9=function(_0x2097e1,_0x4bce62){_0x2097e1=_0x2097e1-0x0;var _0x3e8963=_0x4e9e[_0x2097e1];return _0x3e8963;};'use strict';var _=require(_0xe4e9('0x0'));var util=require(_0xe4e9('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe4e9('0x2'));var attributes=require(_0xe4e9('0x3'));module[_0xe4e9('0x4')]=function(_0x3e387e,_0x5c8c8b){return _0x3e387e['define'](_0xe4e9('0x5'),attributes,{'tableName':_0xe4e9('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe4e9('0x7'),'collate':_0xe4e9('0x8')});}; \ No newline at end of file +var _0xda41=['ChatOfflineMessage','chat_offline_messages','utf8mb4','util','api','moment','bluebird','request-promise','exports','define'];(function(_0xf3fca6,_0x2fbf16){var _0x5ac9c1=function(_0x3a306f){while(--_0x3a306f){_0xf3fca6['push'](_0xf3fca6['shift']());}};_0x5ac9c1(++_0x2fbf16);}(_0xda41,0xcb));var _0x1da4=function(_0x45f111,_0x3a1a4a){_0x45f111=_0x45f111-0x0;var _0x483508=_0xda41[_0x45f111];return _0x483508;};'use strict';var _=require('lodash');var util=require(_0x1da4('0x0'));var logger=require('../../config/logger')(_0x1da4('0x1'));var moment=require(_0x1da4('0x2'));var BPromise=require(_0x1da4('0x3'));var rp=require(_0x1da4('0x4'));var attributes=require('./chatOfflineMessage.attributes');module[_0x1da4('0x5')]=function(_0x447763,_0x5db8f6){return _0x447763[_0x1da4('0x6')](_0x1da4('0x7'),attributes,{'tableName':_0x1da4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1da4('0x9'),'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 2890f14..3ea6391 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 _0xd5e5=['../../mysqldb','rpc','../../config/environment','client','request','then','request\x20sent','debug','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x4a96ca,_0x13754e){var _0x2aed48=function(_0x361330){while(--_0x361330){_0x4a96ca['push'](_0x4a96ca['shift']());}};_0x2aed48(++_0x13754e);}(_0xd5e5,0x136));var _0x5d5e=function(_0xf9373d,_0x5572c4){_0xf9373d=_0xf9373d-0x0;var _0x4fc99c=_0xd5e5[_0xf9373d];return _0x4fc99c;};'use strict';var _=require(_0x5d5e('0x0'));var util=require(_0x5d5e('0x1'));var moment=require(_0x5d5e('0x2'));var BPromise=require('bluebird');var rs=require(_0x5d5e('0x3'));var fs=require('fs');var Redis=require(_0x5d5e('0x4'));var db=require(_0x5d5e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5d5e('0x6'));var config=require(_0x5d5e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5d5e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b877a,_0x99825,_0x22231f){return new BPromise(function(_0x5d8fb5,_0x58d58d){return client[_0x5d5e('0x9')](_0x3b877a,_0x22231f)[_0x5d5e('0xa')](function(_0x56ba24){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x99825,_0x5d5e('0xb'));logger[_0x5d5e('0xc')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x99825,_0x5d5e('0xb'),JSON[_0x5d5e('0xd')](_0x56ba24));if(_0x56ba24[_0x5d5e('0xe')]){if(_0x56ba24['error'][_0x5d5e('0xf')]===0x1f4){logger[_0x5d5e('0xe')](_0x5d5e('0x10'),_0x99825,_0x56ba24[_0x5d5e('0xe')][_0x5d5e('0x11')]);return _0x58d58d(_0x56ba24[_0x5d5e('0xe')][_0x5d5e('0x11')]);}logger[_0x5d5e('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x99825,_0x56ba24[_0x5d5e('0xe')]['message']);return _0x5d8fb5(_0x56ba24[_0x5d5e('0xe')]['message']);}else{logger[_0x5d5e('0x12')](_0x5d5e('0x10'),_0x99825,_0x5d5e('0xb'));_0x5d8fb5(_0x56ba24[_0x5d5e('0x13')][_0x5d5e('0x11')]);}})[_0x5d5e('0x14')](function(_0x5dc440){logger['error'](_0x5d5e('0x10'),_0x99825,_0x5dc440);_0x58d58d(_0x5dc440);});});} \ No newline at end of file +var _0x820c=['code','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','rpc','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error'];(function(_0x2b04bf,_0x4703ae){var _0x176f42=function(_0x239096){while(--_0x239096){_0x2b04bf['push'](_0x2b04bf['shift']());}};_0x176f42(++_0x4703ae);}(_0x820c,0x1f1));var _0xc820=function(_0xa65d40,_0x34d73e){_0xa65d40=_0xa65d40-0x0;var _0x571eb4=_0x820c[_0xa65d40];return _0x571eb4;};'use strict';var _=require('lodash');var util=require(_0xc820('0x0'));var moment=require(_0xc820('0x1'));var BPromise=require(_0xc820('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc820('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc820('0x4'));var logger=require('../../config/logger')(_0xc820('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x11a29f,_0x19c95c,_0xdf9630){return new BPromise(function(_0x3b353d,_0x457ee3){return client['request'](_0x11a29f,_0xdf9630)[_0xc820('0x6')](function(_0x46749d){logger[_0xc820('0x7')](_0xc820('0x8'),_0x19c95c,_0xc820('0x9'));logger[_0xc820('0xa')](_0xc820('0xb'),_0x19c95c,'request\x20sent',JSON['stringify'](_0x46749d));if(_0x46749d[_0xc820('0xc')]){if(_0x46749d[_0xc820('0xc')][_0xc820('0xd')]===0x1f4){logger[_0xc820('0xc')](_0xc820('0x8'),_0x19c95c,_0x46749d[_0xc820('0xc')]['message']);return _0x457ee3(_0x46749d[_0xc820('0xc')][_0xc820('0xe')]);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x19c95c,_0x46749d[_0xc820('0xc')][_0xc820('0xe')]);return _0x3b353d(_0x46749d['error'][_0xc820('0xe')]);}else{logger[_0xc820('0x7')](_0xc820('0x8'),_0x19c95c,_0xc820('0x9'));_0x3b353d(_0x46749d[_0xc820('0xf')][_0xc820('0xe')]);}})[_0xc820('0x10')](function(_0x300e0c){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x19c95c,_0x300e0c);_0x457ee3(_0x300e0c);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 16cd72a..b950ffb 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 _0x3036=['path','connect-timeout','express','../../components/auth/service','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','delete','exports'];(function(_0x2467af,_0x54793c){var _0x19611f=function(_0x12fe1e){while(--_0x12fe1e){_0x2467af['push'](_0x2467af['shift']());}};_0x19611f(++_0x54793c);}(_0x3036,0x1a9));var _0x6303=function(_0x14fefb,_0x386c08){_0x14fefb=_0x14fefb-0x0;var _0x766dc1=_0x3036[_0x14fefb];return _0x766dc1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6303('0x0'));var timeout=require(_0x6303('0x1'));var express=require(_0x6303('0x2'));var router=express['Router']();var auth=require(_0x6303('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatOfflineMessage.controller');router[_0x6303('0x4')]('/',auth['isAuthenticated'](),controller[_0x6303('0x5')]);router[_0x6303('0x4')](_0x6303('0x6'),auth['isAuthenticated'](),controller[_0x6303('0x7')]);router[_0x6303('0x4')](_0x6303('0x8'),auth[_0x6303('0x9')](),controller[_0x6303('0xa')]);router[_0x6303('0xb')]('/',auth[_0x6303('0x9')](),controller[_0x6303('0xc')]);router[_0x6303('0xd')]('/:id',auth[_0x6303('0x9')](),controller[_0x6303('0xe')]);router[_0x6303('0xf')](_0x6303('0x8'),auth[_0x6303('0x9')](),controller['destroy']);module[_0x6303('0x10')]=router; \ No newline at end of file +var _0xb4e6=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','post','create','put','/:id','delete','destroy','exports'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x421eeb,_0x3d3e3e){_0x421eeb=_0x421eeb-0x0;var _0x2c7371=_0xb4e6[_0x421eeb];return _0x2c7371;};'use strict';var multer=require(_0x6b4e('0x0'));var util=require('util');var path=require(_0x6b4e('0x1'));var timeout=require(_0x6b4e('0x2'));var express=require(_0x6b4e('0x3'));var router=express[_0x6b4e('0x4')]();var auth=require(_0x6b4e('0x5'));var interaction=require(_0x6b4e('0x6'));var config=require(_0x6b4e('0x7'));var controller=require('./chatOfflineMessage.controller');router[_0x6b4e('0x8')]('/',auth[_0x6b4e('0x9')](),controller[_0x6b4e('0xa')]);router['get'](_0x6b4e('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x6b4e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x6b4e('0xc')]);router[_0x6b4e('0xd')]('/',auth[_0x6b4e('0x9')](),controller[_0x6b4e('0xe')]);router[_0x6b4e('0xf')](_0x6b4e('0x10'),auth[_0x6b4e('0x9')](),controller['update']);router[_0x6b4e('0x11')](_0x6b4e('0x10'),auth['isAuthenticated'](),controller[_0x6b4e('0x12')]);module[_0x6b4e('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 41cc14a..1d9f5e3 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 _0x79b5=['mouseOver','sequelize','exports','STRING','ENUM','timeout'];(function(_0xc47c57,_0x2ddfd0){var _0x453104=function(_0x48cce4){while(--_0x48cce4){_0xc47c57['push'](_0xc47c57['shift']());}};_0x453104(++_0x2ddfd0);}(_0x79b5,0x1bd));var _0x579b=function(_0x398d0f,_0x5dbf9d){_0x398d0f=_0x398d0f-0x0;var _0x1f54c2=_0x79b5[_0x398d0f];return _0x1f54c2;};'use strict';var Sequelize=require(_0x579b('0x0'));module[_0x579b('0x1')]={'name':{'type':Sequelize[_0x579b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x579b('0x3')]('mouseOver',_0x579b('0x4')),'defaultValue':_0x579b('0x5')},'selector':{'type':Sequelize[_0x579b('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xa302=['exports','STRING','ENUM','mouseOver','timeout','sequelize'];(function(_0x208bfb,_0x448855){var _0x2642df=function(_0x25cc64){while(--_0x25cc64){_0x208bfb['push'](_0x208bfb['shift']());}};_0x2642df(++_0x448855);}(_0xa302,0x1df));var _0x2a30=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xa302[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0x2a30('0x0'));module[_0x2a30('0x1')]={'name':{'type':Sequelize[_0x2a30('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2a30('0x3')](_0x2a30('0x4'),_0x2a30('0x5')),'defaultValue':_0x2a30('0x4')},'selector':{'type':Sequelize[_0x2a30('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index eaaf970..b8b9697 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 _0x8da1=['crypto','jsforce','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','end','json','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','show','params','model','keys','ChatProactiveAction','query','filters','intersection','attributes','fields','length','includeAll','include','merge','catch','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs'];(function(_0x192bc9,_0x4408c7){var _0x48397b=function(_0x2e03e6){while(--_0x2e03e6){_0x192bc9['push'](_0x192bc9['shift']());}};_0x48397b(++_0x4408c7);}(_0x8da1,0x1a6));var _0x18da=function(_0x119b4b,_0x322a87){_0x119b4b=_0x119b4b-0x0;var _0x2ca4d5=_0x8da1[_0x119b4b];return _0x2ca4d5;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x18da('0x0'));var zipdir=require(_0x18da('0x1'));var jsonpatch=require(_0x18da('0x2'));var rp=require(_0x18da('0x3'));var moment=require(_0x18da('0x4'));var BPromise=require(_0x18da('0x5'));var Mustache=require(_0x18da('0x6'));var util=require('util');var path=require(_0x18da('0x7'));var sox=require(_0x18da('0x8'));var csv=require('to-csv');var ejs=require(_0x18da('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x18da('0xa'));var jsforce=require(_0x18da('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x18da('0xc'));var Papa=require('papaparse');var Redis=require(_0x18da('0xd'));var qs=require(_0x18da('0xe'));var logger=require('../../config/logger')(_0x18da('0xf'));var utils=require(_0x18da('0x10'));var config=require(_0x18da('0x11'));var db=require(_0x18da('0x12'))['db'];function respondWithStatusCode(_0x51f0ba,_0x16cd67){_0x16cd67=_0x16cd67||0xcc;return function(_0x177755){if(_0x177755){return _0x51f0ba['sendStatus'](_0x16cd67);}return _0x51f0ba['status'](_0x16cd67)[_0x18da('0x13')]();};}function respondWithResult(_0x2c1032,_0x27ea5b){_0x27ea5b=_0x27ea5b||0xc8;return function(_0x455c48){if(_0x455c48){return _0x2c1032['status'](_0x27ea5b)[_0x18da('0x14')](_0x455c48);}};}function respondWithFilteredResult(_0x5f39aa,_0x4a5fe7){return function(_0x55c94c){if(_0x55c94c){var _0x54046c=_0x55c94c[_0x18da('0x15')],_0x1c42c8=_0x4a5fe7[_0x18da('0x16')],_0x99c0cf=_0x4a5fe7['offset']+_0x4a5fe7['limit'],_0x4120c2;if(_0x99c0cf>=_0x54046c){_0x99c0cf=_0x54046c;_0x4120c2=0xc8;}else{_0x4120c2=0xce;}_0x5f39aa[_0x18da('0x17')](_0x4120c2);return _0x5f39aa[_0x18da('0x18')](_0x18da('0x19'),_0x1c42c8+'-'+_0x99c0cf+'/'+_0x54046c)[_0x18da('0x14')](_0x55c94c);}return null;};}function patchUpdates(_0xeceffc){return function(_0x55b3a1){try{jsonpatch[_0x18da('0x1a')](_0x55b3a1,_0xeceffc,!![]);}catch(_0xb36a18){return BPromise[_0x18da('0x1b')](_0xb36a18);}return _0x55b3a1[_0x18da('0x1c')]();};}function saveUpdates(_0x41e645,_0x5ee2d4){return function(_0x1ac007){if(_0x1ac007){return _0x1ac007[_0x18da('0x1d')](_0x41e645)[_0x18da('0x1e')](function(_0x21a792){return _0x21a792;});}return null;};}function removeEntity(_0x2e97df,_0x3045f1){return function(_0x1d5329){if(_0x1d5329){return _0x1d5329[_0x18da('0x1f')]()[_0x18da('0x1e')](function(){_0x2e97df['status'](0xcc)[_0x18da('0x13')]();});}};}function handleEntityNotFound(_0x15b921,_0x52c194){return function(_0x183f63){if(!_0x183f63){_0x15b921[_0x18da('0x20')](0x194);}return _0x183f63;};}function handleError(_0x2f5429,_0x2d3cba){_0x2d3cba=_0x2d3cba||0x1f4;return function(_0x50ba73){logger[_0x18da('0x21')](_0x50ba73[_0x18da('0x22')]);if(_0x50ba73[_0x18da('0x23')]){delete _0x50ba73['name'];}_0x2f5429['status'](_0x2d3cba)['send'](_0x50ba73);};}exports[_0x18da('0x24')]=function(_0x4b7634,_0x4373df){var _0x1ccba3={'raw':!![],'where':{'id':_0x4b7634[_0x18da('0x25')]['id']}},_0x6957b8={};_0x6957b8[_0x18da('0x26')]=_[_0x18da('0x27')](db[_0x18da('0x28')]['rawAttributes']);_0x6957b8[_0x18da('0x29')]=_[_0x18da('0x27')](_0x4b7634[_0x18da('0x29')]);_0x6957b8[_0x18da('0x2a')]=_[_0x18da('0x2b')](_0x6957b8[_0x18da('0x26')],_0x6957b8['query']);_0x1ccba3[_0x18da('0x2c')]=_[_0x18da('0x2b')](_0x6957b8[_0x18da('0x26')],qs[_0x18da('0x2d')](_0x4b7634[_0x18da('0x29')][_0x18da('0x2d')]));_0x1ccba3[_0x18da('0x2c')]=_0x1ccba3[_0x18da('0x2c')][_0x18da('0x2e')]?_0x1ccba3[_0x18da('0x2c')]:_0x6957b8['model'];if(_0x4b7634[_0x18da('0x29')][_0x18da('0x2f')]){_0x1ccba3[_0x18da('0x30')]=[{'all':!![]}];}_0x1ccba3=_[_0x18da('0x31')]({},_0x1ccba3,_0x4b7634['options']);return db[_0x18da('0x28')]['find'](_0x1ccba3)[_0x18da('0x1e')](handleEntityNotFound(_0x4373df,null))[_0x18da('0x1e')](respondWithResult(_0x4373df,null))[_0x18da('0x32')](handleError(_0x4373df,null));};exports[_0x18da('0x33')]=function(_0x27bab4,_0x3c25e3){return db[_0x18da('0x28')]['create'](_0x27bab4[_0x18da('0x34')],{})['then'](respondWithResult(_0x3c25e3,0xc9))[_0x18da('0x32')](handleError(_0x3c25e3,null));};exports[_0x18da('0x1d')]=function(_0x3895fb,_0x239ff6){if(_0x3895fb[_0x18da('0x34')]['id']){delete _0x3895fb[_0x18da('0x34')]['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0x3895fb[_0x18da('0x25')]['id']}})['then'](handleEntityNotFound(_0x239ff6,null))[_0x18da('0x1e')](saveUpdates(_0x3895fb[_0x18da('0x34')],null))[_0x18da('0x1e')](respondWithResult(_0x239ff6,null))['catch'](handleError(_0x239ff6,null));};exports[_0x18da('0x1f')]=function(_0x5aba4f,_0x50f18f){return db[_0x18da('0x28')][_0x18da('0x35')]({'where':{'id':_0x5aba4f[_0x18da('0x25')]['id']}})[_0x18da('0x1e')](handleEntityNotFound(_0x50f18f,null))[_0x18da('0x1e')](removeEntity(_0x50f18f,null))[_0x18da('0x32')](handleError(_0x50f18f,null));}; \ No newline at end of file +var _0xb688=['request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','error','stack','name','send','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','model','attributes','fields','length','include','find','then','catch','create','body','destroy','params','html-pdf','rimraf','fast-json-patch'];(function(_0x3f9d5d,_0x4ee8dd){var _0x1b2cd7=function(_0x380e51){while(--_0x380e51){_0x3f9d5d['push'](_0x3f9d5d['shift']());}};_0x1b2cd7(++_0x4ee8dd);}(_0xb688,0xa5));var _0x8b68=function(_0x5a211a,_0x186387){_0x5a211a=_0x5a211a-0x0;var _0x507f31=_0xb688[_0x5a211a];return _0x507f31;};'use strict';var pdf=require(_0x8b68('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8b68('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8b68('0x2'));var rp=require(_0x8b68('0x3'));var moment=require(_0x8b68('0x4'));var BPromise=require(_0x8b68('0x5'));var Mustache=require(_0x8b68('0x6'));var util=require(_0x8b68('0x7'));var path=require(_0x8b68('0x8'));var sox=require(_0x8b68('0x9'));var csv=require('to-csv');var ejs=require(_0x8b68('0xa'));var fs=require('fs');var _=require(_0x8b68('0xb'));var squel=require(_0x8b68('0xc'));var crypto=require(_0x8b68('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8b68('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8b68('0xf'));var Redis=require(_0x8b68('0x10'));var qs=require(_0x8b68('0x11'));var logger=require(_0x8b68('0x12'))(_0x8b68('0x13'));var utils=require(_0x8b68('0x14'));var config=require('../../config/environment');var db=require(_0x8b68('0x15'))['db'];function respondWithStatusCode(_0x25e3e9,_0x38b605){_0x38b605=_0x38b605||0xcc;return function(_0x281c3e){if(_0x281c3e){return _0x25e3e9[_0x8b68('0x16')](_0x38b605);}return _0x25e3e9[_0x8b68('0x17')](_0x38b605)[_0x8b68('0x18')]();};}function respondWithResult(_0x15317d,_0x4f57fe){_0x4f57fe=_0x4f57fe||0xc8;return function(_0x4553da){if(_0x4553da){return _0x15317d['status'](_0x4f57fe)[_0x8b68('0x19')](_0x4553da);}};}function respondWithFilteredResult(_0x570b0d,_0x2c602c){return function(_0x246970){if(_0x246970){var _0x5a9585=_0x246970['count'],_0x578a14=_0x2c602c['offset'],_0x30029f=_0x2c602c[_0x8b68('0x1a')]+_0x2c602c[_0x8b68('0x1b')],_0x222f99;if(_0x30029f>=_0x5a9585){_0x30029f=_0x5a9585;_0x222f99=0xc8;}else{_0x222f99=0xce;}_0x570b0d[_0x8b68('0x17')](_0x222f99);return _0x570b0d[_0x8b68('0x1c')](_0x8b68('0x1d'),_0x578a14+'-'+_0x30029f+'/'+_0x5a9585)[_0x8b68('0x19')](_0x246970);}return null;};}function patchUpdates(_0x4bd2e7){return function(_0x40c2ea){try{jsonpatch[_0x8b68('0x1e')](_0x40c2ea,_0x4bd2e7,!![]);}catch(_0x42a225){return BPromise[_0x8b68('0x1f')](_0x42a225);}return _0x40c2ea[_0x8b68('0x20')]();};}function saveUpdates(_0x12cb82,_0x41a083){return function(_0x1a864b){if(_0x1a864b){return _0x1a864b[_0x8b68('0x21')](_0x12cb82)['then'](function(_0x17bed8){return _0x17bed8;});}return null;};}function removeEntity(_0x2bade5,_0x3d3f42){return function(_0x3aeebe){if(_0x3aeebe){return _0x3aeebe['destroy']()['then'](function(){_0x2bade5[_0x8b68('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20934c,_0x516855){return function(_0x538f55){if(!_0x538f55){_0x20934c[_0x8b68('0x16')](0x194);}return _0x538f55;};}function handleError(_0x57f2e0,_0x433270){_0x433270=_0x433270||0x1f4;return function(_0xdf0323){logger[_0x8b68('0x22')](_0xdf0323[_0x8b68('0x23')]);if(_0xdf0323[_0x8b68('0x24')]){delete _0xdf0323[_0x8b68('0x24')];}_0x57f2e0[_0x8b68('0x17')](_0x433270)[_0x8b68('0x25')](_0xdf0323);};}exports['show']=function(_0x383f69,_0x44c67){var _0x9893a2={'raw':!![],'where':{'id':_0x383f69['params']['id']}},_0x1ab09b={};_0x1ab09b['model']=_[_0x8b68('0x26')](db[_0x8b68('0x27')][_0x8b68('0x28')]);_0x1ab09b[_0x8b68('0x29')]=_['keys'](_0x383f69[_0x8b68('0x29')]);_0x1ab09b[_0x8b68('0x2a')]=_[_0x8b68('0x2b')](_0x1ab09b[_0x8b68('0x2c')],_0x1ab09b[_0x8b68('0x29')]);_0x9893a2[_0x8b68('0x2d')]=_[_0x8b68('0x2b')](_0x1ab09b[_0x8b68('0x2c')],qs[_0x8b68('0x2e')](_0x383f69['query'][_0x8b68('0x2e')]));_0x9893a2[_0x8b68('0x2d')]=_0x9893a2[_0x8b68('0x2d')][_0x8b68('0x2f')]?_0x9893a2[_0x8b68('0x2d')]:_0x1ab09b[_0x8b68('0x2c')];if(_0x383f69['query']['includeAll']){_0x9893a2[_0x8b68('0x30')]=[{'all':!![]}];}_0x9893a2=_['merge']({},_0x9893a2,_0x383f69['options']);return db[_0x8b68('0x27')][_0x8b68('0x31')](_0x9893a2)['then'](handleEntityNotFound(_0x44c67,null))[_0x8b68('0x32')](respondWithResult(_0x44c67,null))[_0x8b68('0x33')](handleError(_0x44c67,null));};exports[_0x8b68('0x34')]=function(_0x4b47d1,_0x38c0c2){return db[_0x8b68('0x27')]['create'](_0x4b47d1[_0x8b68('0x35')],{})[_0x8b68('0x32')](respondWithResult(_0x38c0c2,0xc9))[_0x8b68('0x33')](handleError(_0x38c0c2,null));};exports[_0x8b68('0x21')]=function(_0x3e86a2,_0xc2a1fb){if(_0x3e86a2[_0x8b68('0x35')]['id']){delete _0x3e86a2[_0x8b68('0x35')]['id'];}return db[_0x8b68('0x27')][_0x8b68('0x31')]({'where':{'id':_0x3e86a2['params']['id']}})[_0x8b68('0x32')](handleEntityNotFound(_0xc2a1fb,null))['then'](saveUpdates(_0x3e86a2[_0x8b68('0x35')],null))[_0x8b68('0x32')](respondWithResult(_0xc2a1fb,null))[_0x8b68('0x33')](handleError(_0xc2a1fb,null));};exports[_0x8b68('0x36')]=function(_0x348a5f,_0x19a45a){return db[_0x8b68('0x27')][_0x8b68('0x31')]({'where':{'id':_0x348a5f[_0x8b68('0x37')]['id']}})['then'](handleEntityNotFound(_0x19a45a,null))[_0x8b68('0x32')](removeEntity(_0x19a45a,null))[_0x8b68('0x33')](handleError(_0x19a45a,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 3c3bc9c..e58225e 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 _0x0b0e=['chat_proactive_actions','lodash','../../config/logger','moment','bluebird','request-promise','./chatProactiveAction.attributes','exports','define','ChatProactiveAction'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x0b0e,0x187));var _0xe0b0=function(_0x119b3e,_0x588d50){_0x119b3e=_0x119b3e-0x0;var _0x1169ae=_0x0b0e[_0x119b3e];return _0x1169ae;};'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 attributes=require(_0xe0b0('0x5'));module[_0xe0b0('0x6')]=function(_0x38a058,_0x399e67){return _0x38a058[_0xe0b0('0x7')](_0xe0b0('0x8'),attributes,{'tableName':_0xe0b0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1967=['chat_proactive_actions','util','../../config/logger','api','moment','bluebird','request-promise','./chatProactiveAction.attributes','exports','ChatProactiveAction'];(function(_0x5f58d1,_0x719880){var _0x5c40cf=function(_0x4c07de){while(--_0x4c07de){_0x5f58d1['push'](_0x5f58d1['shift']());}};_0x5c40cf(++_0x719880);}(_0x1967,0x173));var _0x7196=function(_0x2d69e9,_0x353548){_0x2d69e9=_0x2d69e9-0x0;var _0x244ee9=_0x1967[_0x2d69e9];return _0x244ee9;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var logger=require(_0x7196('0x1'))(_0x7196('0x2'));var moment=require(_0x7196('0x3'));var BPromise=require(_0x7196('0x4'));var rp=require(_0x7196('0x5'));var attributes=require(_0x7196('0x6'));module[_0x7196('0x7')]=function(_0x458ae8,_0x3ae43f){return _0x458ae8['define'](_0x7196('0x8'),attributes,{'tableName':_0x7196('0x9'),'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 12a47a0..e5a744b 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 _0xa9e0=['http','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\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(_0x459706,_0x12b3f0){var _0xbf3f1b=function(_0x1a17cd){while(--_0x1a17cd){_0x459706['push'](_0x459706['shift']());}};_0xbf3f1b(++_0x12b3f0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xeb7d91,_0x413bdd){var _0x366350=function(_0x5986b1){while(--_0x5986b1){_0xeb7d91['push'](_0xeb7d91['shift']());}};_0x366350(++_0x413bdd);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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']('ChatProactiveAction,\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);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index cde0191..68ef015 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 _0x8ed7=['post','create','update','destroy','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show'];(function(_0x13cab0,_0x14d825){var _0x38804f=function(_0x1bffaf){while(--_0x1bffaf){_0x13cab0['push'](_0x13cab0['shift']());}};_0x38804f(++_0x14d825);}(_0x8ed7,0x8b));var _0x78ed=function(_0xa98d02,_0x5423e2){_0xa98d02=_0xa98d02-0x0;var _0x198262=_0x8ed7[_0xa98d02];return _0x198262;};'use strict';var multer=require('multer');var util=require(_0x78ed('0x0'));var path=require(_0x78ed('0x1'));var timeout=require(_0x78ed('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x78ed('0x3'));var interaction=require(_0x78ed('0x4'));var config=require(_0x78ed('0x5'));var controller=require(_0x78ed('0x6'));router[_0x78ed('0x7')](_0x78ed('0x8'),auth[_0x78ed('0x9')](),controller[_0x78ed('0xa')]);router[_0x78ed('0xb')]('/',auth['isAuthenticated'](),controller[_0x78ed('0xc')]);router['put'](_0x78ed('0x8'),auth['isAuthenticated'](),controller[_0x78ed('0xd')]);router['delete']('/:id',auth[_0x78ed('0x9')](),controller[_0x78ed('0xe')]);module['exports']=router; \ No newline at end of file +var _0xef0f=['delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','put','update'];(function(_0x3c5312,_0x2470bb){var _0x36f59b=function(_0x9782f){while(--_0x9782f){_0x3c5312['push'](_0x3c5312['shift']());}};_0x36f59b(++_0x2470bb);}(_0xef0f,0x168));var _0xfef0=function(_0x3972e9,_0xdd1d03){_0x3972e9=_0x3972e9-0x0;var _0x4b87c0=_0xef0f[_0x3972e9];return _0x4b87c0;};'use strict';var multer=require(_0xfef0('0x0'));var util=require('util');var path=require(_0xfef0('0x1'));var timeout=require(_0xfef0('0x2'));var express=require(_0xfef0('0x3'));var router=express['Router']();var auth=require(_0xfef0('0x4'));var interaction=require(_0xfef0('0x5'));var config=require(_0xfef0('0x6'));var controller=require('./chatProactiveAction.controller');router[_0xfef0('0x7')](_0xfef0('0x8'),auth[_0xfef0('0x9')](),controller[_0xfef0('0xa')]);router[_0xfef0('0xb')]('/',auth[_0xfef0('0x9')](),controller['create']);router[_0xfef0('0xc')]('/:id',auth[_0xfef0('0x9')](),controller[_0xfef0('0xd')]);router[_0xfef0('0xe')](_0xfef0('0x8'),auth[_0xfef0('0x9')](),controller[_0xfef0('0xf')]);module[_0xfef0('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 462e1e2..3d9b6a8 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 _0x5804=['STRING','name','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x1eabe2,_0x24666c){var _0x39adc0=function(_0x3149e4){while(--_0x3149e4){_0x1eabe2['push'](_0x1eabe2['shift']());}};_0x39adc0(++_0x24666c);}(_0x5804,0x7e));var _0x4580=function(_0x4f025f,_0x274149){_0x4f025f=_0x4f025f-0x0;var _0x143048=_0x5804[_0x4f025f];return _0x143048;};'use strict';var Sequelize=require(_0x4580('0x0'));module[_0x4580('0x1')]={'name':{'type':Sequelize[_0x4580('0x2')],'unique':_0x4580('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4580('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4580('0x4')](_0x4580('0x5'),_0x4580('0x6'),_0x4580('0x7'))}}; \ No newline at end of file +var _0x65eb=['STRING','name','INTEGER','rrmemory','beepall','sequelize'];(function(_0x5133e0,_0xf3d92){var _0x19a707=function(_0x67ee0d){while(--_0x67ee0d){_0x5133e0['push'](_0x5133e0['shift']());}};_0x19a707(++_0xf3d92);}(_0x65eb,0xc5));var _0xb65e=function(_0x521b80,_0x159a64){_0x521b80=_0x521b80-0x0;var _0x30056a=_0x65eb[_0x521b80];return _0x30056a;};'use strict';var Sequelize=require(_0xb65e('0x0'));module['exports']={'name':{'type':Sequelize[_0xb65e('0x1')],'unique':_0xb65e('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb65e('0x1')]},'timeout':{'type':Sequelize[_0xb65e('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xb65e('0x4'),_0xb65e('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index d2ecd91..16f11a3 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 _0x7a54=['include','findAll','rows','show','params','find','create','body','update','describe','getMembers','UserChatQueue','order','ChatQueueId','UserId','agent','updatedAt','createdAt','format','%s/%s','getTeams','findOne','Team','addTeams','ids','User','Agents','penalty','removeTeams','union','removeAgents','addAgents','spread','emit','userChatQueue:save','isArray','userChatQueue:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/parsers/qs','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','info','result','catch','sendStatus','json','count','offset','limit','status','Content-Range','apply','reject','save','destroy','stack','name','index','ChatQueue','rawAttributes','model','keys','query','dateEnd','dateStart','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filters','add','day','merge','where','filter','map','options'];(function(_0xc72a72,_0xfaaf35){var _0x20f9a9=function(_0x341491){while(--_0x341491){_0xc72a72['push'](_0xc72a72['shift']());}};_0x20f9a9(++_0xfaaf35);}(_0x7a54,0x106));var _0x47a5=function(_0x4cab77,_0x490a38){_0x4cab77=_0x4cab77-0x0;var _0x400852=_0x7a54[_0x4cab77];return _0x400852;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var qs=require(_0x47a5('0xf'));var logger=require('../../config/logger')(_0x47a5('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x47a5('0x11'))['db'];config[_0x47a5('0x12')]=_[_0x47a5('0x13')](config[_0x47a5('0x12')],{'host':_0x47a5('0x14'),'port':0x18eb});var socket=require(_0x47a5('0x15'))(new Redis(config[_0x47a5('0x12')]));require('./chatQueue.socket')[_0x47a5('0x16')](socket);var jayson=require(_0x47a5('0x17'));var client=jayson[_0x47a5('0x18')][_0x47a5('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x139f25,_0x620ee9,_0x3c6c46,_0x190faa){return new BPromise(function(_0x4e99a8,_0x362359){var _0x11faf5=_0x190faa||client;return _0x11faf5[_0x47a5('0x1a')](_0x139f25,_0x3c6c46)[_0x47a5('0x1b')](function(_0x1ef44c){logger['info']('ChatQueue,\x20%s,\x20%s',_0x620ee9,_0x47a5('0x1c'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x620ee9,_0x47a5('0x1c'),JSON[_0x47a5('0x1d')](_0x1ef44c));if(_0x1ef44c[_0x47a5('0x1e')]){if(_0x1ef44c[_0x47a5('0x1e')][_0x47a5('0x1f')]===0x1f4){logger[_0x47a5('0x1e')](_0x47a5('0x20'),_0x620ee9,_0x1ef44c[_0x47a5('0x1e')][_0x47a5('0x21')]);return _0x362359(_0x1ef44c['error'][_0x47a5('0x21')]);}logger[_0x47a5('0x1e')]('ChatQueue,\x20%s,\x20%s',_0x620ee9,_0x1ef44c[_0x47a5('0x1e')][_0x47a5('0x21')]);return _0x4e99a8(_0x1ef44c[_0x47a5('0x1e')]['message']);}else{logger[_0x47a5('0x22')](_0x47a5('0x20'),_0x620ee9,_0x47a5('0x1c'));_0x4e99a8(_0x1ef44c[_0x47a5('0x23')]['message']);}})[_0x47a5('0x24')](function(_0x385687){logger['error'](_0x47a5('0x20'),_0x620ee9,_0x385687);_0x362359(_0x385687);});});}function respondWithStatusCode(_0xc4cd63,_0x4437f1){_0x4437f1=_0x4437f1||0xcc;return function(_0x129ce5){if(_0x129ce5){return _0xc4cd63[_0x47a5('0x25')](_0x4437f1);}return _0xc4cd63['status'](_0x4437f1)['end']();};}function respondWithResult(_0x136745,_0x5686db){_0x5686db=_0x5686db||0xc8;return function(_0x1ea9c8){if(_0x1ea9c8){return _0x136745['status'](_0x5686db)[_0x47a5('0x26')](_0x1ea9c8);}};}function respondWithFilteredResult(_0x378208,_0x36ad34){return function(_0x1dac65){if(_0x1dac65){var _0x21f296=_0x1dac65[_0x47a5('0x27')],_0x3ba0b7=_0x36ad34[_0x47a5('0x28')],_0x24b162=_0x36ad34[_0x47a5('0x28')]+_0x36ad34[_0x47a5('0x29')],_0x136b14;if(_0x24b162>=_0x21f296){_0x24b162=_0x21f296;_0x136b14=0xc8;}else{_0x136b14=0xce;}_0x378208[_0x47a5('0x2a')](_0x136b14);return _0x378208['set'](_0x47a5('0x2b'),_0x3ba0b7+'-'+_0x24b162+'/'+_0x21f296)['json'](_0x1dac65);}return null;};}function patchUpdates(_0x2ef875){return function(_0x9ac908){try{jsonpatch[_0x47a5('0x2c')](_0x9ac908,_0x2ef875,!![]);}catch(_0x4d6b57){return BPromise[_0x47a5('0x2d')](_0x4d6b57);}return _0x9ac908[_0x47a5('0x2e')]();};}function saveUpdates(_0x39b50b,_0x1f1c68){return function(_0x51cc81){if(_0x51cc81){return _0x51cc81['update'](_0x39b50b)[_0x47a5('0x1b')](function(_0xfb5ddb){return _0xfb5ddb;});}return null;};}function removeEntity(_0x5bd7eb,_0x4e1006){return function(_0x836303){if(_0x836303){return _0x836303[_0x47a5('0x2f')]()['then'](function(){_0x5bd7eb[_0x47a5('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x122ed6,_0xd972c){return function(_0x5c5162){if(!_0x5c5162){_0x122ed6['sendStatus'](0x194);}return _0x5c5162;};}function handleError(_0x274e34,_0x5910bb){_0x5910bb=_0x5910bb||0x1f4;return function(_0x403028){logger[_0x47a5('0x1e')](_0x403028[_0x47a5('0x30')]);if(_0x403028['name']){delete _0x403028[_0x47a5('0x31')];}_0x274e34['status'](_0x5910bb)['send'](_0x403028);};}exports[_0x47a5('0x32')]=function(_0x5a8a7c,_0x25cce0){var _0x5ef577={},_0x21ad34={},_0x3534cb={'count':0x0,'rows':[]};var _0x38c8d4=db[_0x47a5('0x33')][_0x47a5('0x34')];_0x21ad34[_0x47a5('0x35')]=_[_0x47a5('0x36')](_0x38c8d4);var _0x452be5={'dateStart':_0x5a8a7c[_0x47a5('0x37')]['dateStart'],'dateEnd':_0x5a8a7c[_0x47a5('0x37')][_0x47a5('0x38')]};delete _0x5a8a7c['query'][_0x47a5('0x39')];delete _0x5a8a7c[_0x47a5('0x37')][_0x47a5('0x38')];_0x21ad34['query']=_[_0x47a5('0x36')](_0x5a8a7c[_0x47a5('0x37')]);_0x21ad34['filters']=_[_0x47a5('0x3a')](_0x21ad34[_0x47a5('0x35')],_0x21ad34['query']);_0x5ef577['attributes']=_['intersection'](_0x21ad34[_0x47a5('0x35')],qs['fields'](_0x5a8a7c[_0x47a5('0x37')][_0x47a5('0x3b')]));_0x5ef577[_0x47a5('0x3c')]=_0x5ef577[_0x47a5('0x3c')][_0x47a5('0x3d')]?_0x5ef577[_0x47a5('0x3c')]:_0x21ad34[_0x47a5('0x35')];if(!_0x5a8a7c[_0x47a5('0x37')][_0x47a5('0x3e')](_0x47a5('0x3f'))){_0x5ef577[_0x47a5('0x29')]=qs[_0x47a5('0x29')](_0x5a8a7c[_0x47a5('0x37')]['limit']);_0x5ef577[_0x47a5('0x28')]=qs[_0x47a5('0x28')](_0x5a8a7c[_0x47a5('0x37')][_0x47a5('0x28')]);}_0x5ef577['order']=qs[_0x47a5('0x40')](_0x5a8a7c['query']['sort']);_0x5ef577['where']=qs['filters'](_[_0x47a5('0x41')](_0x5a8a7c['query'],_0x21ad34[_0x47a5('0x42')]));if(_0x452be5[_0x47a5('0x39')]){if(_0x452be5[_0x47a5('0x38')]){_0x452be5['dateEnd']=moment(_0x452be5[_0x47a5('0x38')])[_0x47a5('0x43')](0x1,'day');}else{_0x452be5['dateEnd']=moment(_0x452be5[_0x47a5('0x39')])['add'](0x1,_0x47a5('0x44'));}_[_0x47a5('0x45')](_0x5ef577[_0x47a5('0x46')],{'createdAt':{'$gte':_0x452be5[_0x47a5('0x39')],'$lte':_0x452be5[_0x47a5('0x38')]}});}if(_0x5a8a7c[_0x47a5('0x37')][_0x47a5('0x47')]){_0x5ef577[_0x47a5('0x46')]=_[_0x47a5('0x45')](_0x5ef577[_0x47a5('0x46')],{'$or':_[_0x47a5('0x48')](_0x5ef577[_0x47a5('0x3c')],function(_0xe28d76){var _0x3574d4={};_0x3574d4[_0xe28d76]={'$like':'%'+_0x5a8a7c[_0x47a5('0x37')][_0x47a5('0x47')]+'%'};return _0x3574d4;})});}_0x5ef577=_['merge']({},_0x5ef577,_0x5a8a7c[_0x47a5('0x49')]);var _0x23bb04={'where':_0x5ef577['where']};return db['ChatQueue'][_0x47a5('0x27')](_0x23bb04)['then'](function(_0x13750d){_0x3534cb[_0x47a5('0x27')]=_0x13750d;if(_0x5a8a7c['query']['includeAll']){_0x5ef577[_0x47a5('0x4a')]=[{'all':!![]}];}return db['ChatQueue'][_0x47a5('0x4b')](_0x5ef577);})[_0x47a5('0x1b')](function(_0x3548bc){_0x3534cb[_0x47a5('0x4c')]=_0x3548bc;return _0x3534cb;})[_0x47a5('0x1b')](respondWithFilteredResult(_0x25cce0,_0x5ef577))[_0x47a5('0x24')](handleError(_0x25cce0,null));};exports[_0x47a5('0x4d')]=function(_0x53e994,_0x48a0ef){var _0x2dd1db={'raw':!![],'where':{'id':_0x53e994[_0x47a5('0x4e')]['id']}},_0x411230={};_0x411230[_0x47a5('0x35')]=_[_0x47a5('0x36')](db[_0x47a5('0x33')][_0x47a5('0x34')]);_0x411230['query']=_[_0x47a5('0x36')](_0x53e994[_0x47a5('0x37')]);_0x411230[_0x47a5('0x42')]=_['intersection'](_0x411230[_0x47a5('0x35')],_0x411230['query']);_0x2dd1db[_0x47a5('0x3c')]=_[_0x47a5('0x3a')](_0x411230[_0x47a5('0x35')],qs[_0x47a5('0x3b')](_0x53e994['query'][_0x47a5('0x3b')]));_0x2dd1db[_0x47a5('0x3c')]=_0x2dd1db[_0x47a5('0x3c')][_0x47a5('0x3d')]?_0x2dd1db[_0x47a5('0x3c')]:_0x411230[_0x47a5('0x35')];if(_0x53e994[_0x47a5('0x37')]['includeAll']){_0x2dd1db[_0x47a5('0x4a')]=[{'all':!![]}];}_0x2dd1db=_[_0x47a5('0x45')]({},_0x2dd1db,_0x53e994[_0x47a5('0x49')]);return db[_0x47a5('0x33')][_0x47a5('0x4f')](_0x2dd1db)[_0x47a5('0x1b')](handleEntityNotFound(_0x48a0ef,null))['then'](respondWithResult(_0x48a0ef,null))[_0x47a5('0x24')](handleError(_0x48a0ef,null));};exports[_0x47a5('0x50')]=function(_0x1aa581,_0x53871e){return db[_0x47a5('0x33')][_0x47a5('0x50')](_0x1aa581[_0x47a5('0x51')],{})['then'](respondWithResult(_0x53871e,0xc9))['catch'](handleError(_0x53871e,null));};exports[_0x47a5('0x52')]=function(_0x376e1d,_0x4fa1da){if(_0x376e1d['body']['id']){delete _0x376e1d[_0x47a5('0x51')]['id'];}return db['ChatQueue'][_0x47a5('0x4f')]({'where':{'id':_0x376e1d['params']['id']}})['then'](handleEntityNotFound(_0x4fa1da,null))[_0x47a5('0x1b')](saveUpdates(_0x376e1d[_0x47a5('0x51')],null))['then'](respondWithResult(_0x4fa1da,null))[_0x47a5('0x24')](handleError(_0x4fa1da,null));};exports[_0x47a5('0x2f')]=function(_0x4b706a,_0x5b6127){return db[_0x47a5('0x33')][_0x47a5('0x4f')]({'where':{'id':_0x4b706a[_0x47a5('0x4e')]['id']}})[_0x47a5('0x1b')](handleEntityNotFound(_0x5b6127,null))['then'](removeEntity(_0x5b6127,null))[_0x47a5('0x24')](handleError(_0x5b6127,null));};exports[_0x47a5('0x53')]=function(_0x1af800,_0x5a33b8){return db[_0x47a5('0x33')]['describe']()[_0x47a5('0x1b')](respondWithResult(_0x5a33b8,null))[_0x47a5('0x24')](handleError(_0x5a33b8,null));};exports[_0x47a5('0x54')]=function(_0x1c485b,_0x3603b7,_0x4966af){var _0x144af9={'raw':!![],'where':{}},_0x5d1550={},_0x5cbe97;return db['ChatQueue']['findOne']({'where':{'id':_0x1c485b[_0x47a5('0x4e')]['id']}})[_0x47a5('0x1b')](handleEntityNotFound(_0x3603b7,null))[_0x47a5('0x1b')](function(_0x52e3ee){if(_0x52e3ee){_0x5cbe97=_0x52e3ee['get']({'plain':!![]});_0x5d1550[_0x47a5('0x35')]=_[_0x47a5('0x36')](db[_0x47a5('0x55')][_0x47a5('0x34')]);_0x5d1550[_0x47a5('0x37')]=_['keys'](_0x1c485b[_0x47a5('0x37')]);_0x5d1550['filters']=_[_0x47a5('0x3a')](_0x5d1550[_0x47a5('0x35')],_0x5d1550['query']);_0x144af9[_0x47a5('0x3c')]=_[_0x47a5('0x3a')](_0x5d1550[_0x47a5('0x35')],qs[_0x47a5('0x3b')](_0x1c485b[_0x47a5('0x37')][_0x47a5('0x3b')]));_0x144af9[_0x47a5('0x3c')]=_0x144af9[_0x47a5('0x3c')]['length']?_0x144af9[_0x47a5('0x3c')]:_0x5d1550[_0x47a5('0x35')];if(!_0x1c485b[_0x47a5('0x37')][_0x47a5('0x3e')](_0x47a5('0x3f'))){_0x144af9['limit']=qs[_0x47a5('0x29')](_0x1c485b[_0x47a5('0x37')][_0x47a5('0x29')]);_0x144af9[_0x47a5('0x28')]=qs[_0x47a5('0x28')](_0x1c485b[_0x47a5('0x37')][_0x47a5('0x28')]);}_0x144af9[_0x47a5('0x56')]=qs[_0x47a5('0x40')](_0x1c485b[_0x47a5('0x37')][_0x47a5('0x40')]);_0x144af9[_0x47a5('0x46')]=qs[_0x47a5('0x42')](_[_0x47a5('0x41')](_0x1c485b[_0x47a5('0x37')],_0x5d1550['filters']));_0x144af9[_0x47a5('0x46')][_0x47a5('0x57')]=_0x52e3ee['id'];if(_0x1c485b[_0x47a5('0x37')]['filter']){_0x144af9[_0x47a5('0x46')]=_[_0x47a5('0x45')](_0x144af9[_0x47a5('0x46')],{'$or':_[_0x47a5('0x48')](_0x144af9['attributes'],function(_0x3ac402){var _0x522ccf={};_0x522ccf[_0x3ac402]={'$like':'%'+_0x1c485b[_0x47a5('0x37')]['filter']+'%'};return _0x522ccf;})});}_0x144af9=_[_0x47a5('0x45')]({},_0x144af9,_0x1c485b['options']);return db[_0x47a5('0x55')][_0x47a5('0x4b')](_0x144af9);}})[_0x47a5('0x1b')](function(_0x58473b){if(_0x58473b){return db['User']['findAndCountAll']({'where':{'id':_[_0x47a5('0x48')](_0x58473b,_0x47a5('0x58')),'role':_0x47a5('0x59')},'attributes':['id',_0x47a5('0x31'),'chatPause',_0x47a5('0x5a'),_0x47a5('0x5b')]});}})[_0x47a5('0x1b')](function(_0xd5b23f){if(_0xd5b23f){return{'count':_0xd5b23f[_0x47a5('0x27')],'rows':_[_0x47a5('0x48')](_0xd5b23f[_0x47a5('0x4c')],function(_0x39939a){return{'membername':_0x39939a[_0x47a5('0x31')],'UserId':_0x39939a['id'],'queue_name':_0x5cbe97[_0x47a5('0x31')],'ChatQueueId':_0x5cbe97['id'],'interface':util[_0x47a5('0x5c')](_0x47a5('0x5d'),'SIP',_0x39939a[_0x47a5('0x31')]),'penalty':0x0,'paused':_0x39939a['chatPause'],'createdAt':_0x39939a[_0x47a5('0x5b')],'updatedAt':_0x39939a[_0x47a5('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x47a5('0x1b')](respondWithFilteredResult(_0x3603b7,_0x144af9))[_0x47a5('0x24')](handleError(_0x3603b7,null));};exports[_0x47a5('0x5e')]=function(_0xa9c853,_0x12025a,_0x448981){var _0x11c1db={};var _0x254049={};var _0x1cfb37;var _0x1f07ac;return db[_0x47a5('0x33')][_0x47a5('0x5f')]({'where':{'id':_0xa9c853[_0x47a5('0x4e')]['id']}})['then'](handleEntityNotFound(_0x12025a,null))['then'](function(_0x5ccc89){if(_0x5ccc89){_0x1cfb37=_0x5ccc89;_0x254049['model']=_[_0x47a5('0x36')](db[_0x47a5('0x60')]['rawAttributes']);_0x254049[_0x47a5('0x37')]=_[_0x47a5('0x36')](_0xa9c853[_0x47a5('0x37')]);_0x254049[_0x47a5('0x42')]=_[_0x47a5('0x3a')](_0x254049[_0x47a5('0x35')],_0x254049[_0x47a5('0x37')]);_0x11c1db[_0x47a5('0x3c')]=_[_0x47a5('0x3a')](_0x254049[_0x47a5('0x35')],qs[_0x47a5('0x3b')](_0xa9c853['query'][_0x47a5('0x3b')]));_0x11c1db[_0x47a5('0x3c')]=_0x11c1db[_0x47a5('0x3c')]['length']?_0x11c1db[_0x47a5('0x3c')]:_0x254049[_0x47a5('0x35')];_0x11c1db[_0x47a5('0x56')]=qs['sort'](_0xa9c853[_0x47a5('0x37')]['sort']);_0x11c1db['where']=qs[_0x47a5('0x42')](_[_0x47a5('0x41')](_0xa9c853[_0x47a5('0x37')],_0x254049[_0x47a5('0x42')]));if(_0xa9c853[_0x47a5('0x37')][_0x47a5('0x47')]){_0x11c1db['where']=_['merge'](_0x11c1db[_0x47a5('0x46')],{'$or':_['map'](_0x11c1db[_0x47a5('0x3c')],function(_0x3fffd1){var _0x175dab={};_0x175dab[_0x3fffd1]={'$like':'%'+_0xa9c853[_0x47a5('0x37')]['filter']+'%'};return _0x175dab;})});}_0x11c1db=_[_0x47a5('0x45')]({},_0x11c1db,_0xa9c853['options']);return _0x1cfb37['getTeams'](_0x11c1db);}})[_0x47a5('0x1b')](function(_0x391f8e){if(_0x391f8e){_0x1f07ac=_0x391f8e['length'];if(!_0xa9c853[_0x47a5('0x37')][_0x47a5('0x3e')](_0x47a5('0x3f'))){_0x11c1db['limit']=qs[_0x47a5('0x29')](_0xa9c853['query'][_0x47a5('0x29')]);_0x11c1db[_0x47a5('0x28')]=qs[_0x47a5('0x28')](_0xa9c853['query'][_0x47a5('0x28')]);}return _0x1cfb37[_0x47a5('0x5e')](_0x11c1db);}})[_0x47a5('0x1b')](function(_0x4b3fef){if(_0x4b3fef){return _0x4b3fef?{'count':_0x1f07ac,'rows':_0x4b3fef}:null;}})[_0x47a5('0x1b')](respondWithResult(_0x12025a,null))['catch'](handleError(_0x12025a,null));};exports[_0x47a5('0x61')]=function(_0x491bb4,_0x135d2e,_0x20d8bd){var _0x20a742=[];var _0x211fbf;return db['Team'][_0x47a5('0x4b')]({'where':{'id':_0x491bb4[_0x47a5('0x51')][_0x47a5('0x62')]},'attributes':['id'],'include':[{'model':db[_0x47a5('0x63')],'as':_0x47a5('0x64'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x56c35e){if(_0x56c35e){for(var _0x569550=0x0;_0x569550<_0x56c35e['length'];_0x569550+=0x1){for(var _0xd6c211=0x0;_0xd6c211<_0x56c35e[_0x569550][_0x47a5('0x64')][_0x47a5('0x3d')];_0xd6c211+=0x1){_0x20a742=_['union'](_0x20a742,[_0x56c35e[_0x569550][_0x47a5('0x64')][_0xd6c211]['id']]);}}return _0x20a742;}})[_0x47a5('0x1b')](function(_0x565fbe){if(_0x565fbe){return db[_0x47a5('0x33')][_0x47a5('0x4f')]({'where':{'id':_0x491bb4[_0x47a5('0x4e')]['id']}});}})[_0x47a5('0x1b')](function(_0x58dacd){if(_0x58dacd){_0x211fbf=_0x58dacd;return _0x211fbf['addAgents'](_0x20a742,{'penalty':_0x491bb4[_0x47a5('0x51')][_0x47a5('0x65')]});}})['then'](function(_0x27d422){if(_0x27d422){return _0x211fbf[_0x47a5('0x61')](_0x491bb4['body'][_0x47a5('0x62')]);}})[_0x47a5('0x1b')](handleEntityNotFound(_0x135d2e,null))[_0x47a5('0x1b')](respondWithStatusCode(_0x135d2e,null))['catch'](handleError(_0x135d2e,null));};exports[_0x47a5('0x66')]=function(_0x59b4a5,_0x663778,_0x5e2946){var _0x243c8b=[];var _0x3c620e;return db['Team'][_0x47a5('0x4b')]({'where':{'id':_0x59b4a5['query'][_0x47a5('0x62')]},'attributes':['id'],'include':[{'model':db[_0x47a5('0x63')],'as':_0x47a5('0x64'),'attributes':['id'],'raw':!![]}]})[_0x47a5('0x1b')](function(_0x49b76a){if(_0x49b76a){for(var _0x3eb5c1=0x0;_0x3eb5c1<_0x49b76a['length'];_0x3eb5c1+=0x1){for(var _0x52be82=0x0;_0x52be82<_0x49b76a[_0x3eb5c1][_0x47a5('0x64')][_0x47a5('0x3d')];_0x52be82+=0x1){_0x243c8b=_[_0x47a5('0x67')](_0x243c8b,[_0x49b76a[_0x3eb5c1][_0x47a5('0x64')][_0x52be82]['id']]);}}return _0x243c8b;}})[_0x47a5('0x1b')](function(_0x5b1f5e){if(_0x5b1f5e){return db[_0x47a5('0x33')][_0x47a5('0x4f')]({'where':{'id':_0x59b4a5[_0x47a5('0x4e')]['id']}});}})[_0x47a5('0x1b')](function(_0x50b98e){if(_0x50b98e){_0x3c620e=_0x50b98e;return _0x3c620e[_0x47a5('0x68')](_0x243c8b);}})['then'](function(_0x12891d){if(_0x3c620e){return _0x3c620e[_0x47a5('0x66')](_0x59b4a5[_0x47a5('0x37')][_0x47a5('0x62')]);}})[_0x47a5('0x1b')](handleEntityNotFound(_0x663778,null))[_0x47a5('0x1b')](respondWithStatusCode(_0x663778,null))[_0x47a5('0x24')](handleError(_0x663778,null));};exports[_0x47a5('0x69')]=function(_0x11eaf7,_0x583746,_0x36796e){return db[_0x47a5('0x33')]['find']({'where':{'id':_0x11eaf7[_0x47a5('0x4e')]['id']}})[_0x47a5('0x1b')](handleEntityNotFound(_0x583746,null))[_0x47a5('0x1b')](function(_0x5b85cd){if(_0x5b85cd){return _0x5b85cd['addAgents'](_0x11eaf7[_0x47a5('0x51')][_0x47a5('0x62')],_['omit'](_0x11eaf7['body'],[_0x47a5('0x62'),'id'])||{})[_0x47a5('0x6a')](function(_0x54eab1){for(var _0x29e384=0x0;_0x29e384<_0x11eaf7[_0x47a5('0x51')]['ids'][_0x47a5('0x3d')];_0x29e384+=0x1){socket[_0x47a5('0x6b')](_0x47a5('0x6c'),{'UserId':_0x11eaf7[_0x47a5('0x51')][_0x47a5('0x62')][_0x29e384],'ChatQueueId':_0x11eaf7[_0x47a5('0x4e')]['id']});}return _0x54eab1;});}})['then'](respondWithResult(_0x583746,null))['catch'](handleError(_0x583746,null));};exports['removeAgents']=function(_0x133b7a,_0xce5ada,_0x4e0f2b){var _0x2006cb;return db[_0x47a5('0x33')][_0x47a5('0x4f')]({'where':{'id':_0x133b7a[_0x47a5('0x4e')]['id']}})[_0x47a5('0x1b')](handleEntityNotFound(_0xce5ada,null))['then'](function(_0x3e7750){if(_0x3e7750){return _0x3e7750['removeAgents'](_0x133b7a['query']['ids'])[_0x47a5('0x1b')](function(_0x4d23c8){if(_[_0x47a5('0x6d')](_0x133b7a[_0x47a5('0x37')][_0x47a5('0x62')])){for(var _0x49f791=0x0;_0x49f791<_0x133b7a[_0x47a5('0x37')][_0x47a5('0x62')][_0x47a5('0x3d')];_0x49f791+=0x1){socket[_0x47a5('0x6b')](_0x47a5('0x6e'),{'UserId':_0x133b7a['query'][_0x47a5('0x62')][_0x49f791],'ChatQueueId':_0x133b7a[_0x47a5('0x4e')]['id']});}}else{socket['emit'](_0x47a5('0x6e'),{'UserId':_0x133b7a[_0x47a5('0x37')][_0x47a5('0x62')],'ChatQueueId':_0x133b7a[_0x47a5('0x4e')]['id']});}});}})[_0x47a5('0x1b')](respondWithStatusCode(_0xce5ada,null))[_0x47a5('0x24')](handleError(_0xce5ada,null));};exports['getAgents']=function(_0x6a8174,_0x2e418d,_0x50b236){var _0x263521={};var _0x9769b5={};var _0x52a1b5;var _0x12a1de;return db['ChatQueue']['findOne']({'where':{'id':_0x6a8174['params']['id']}})['then'](handleEntityNotFound(_0x2e418d,null))[_0x47a5('0x1b')](function(_0x27793e){if(_0x27793e){_0x52a1b5=_0x27793e;_0x9769b5[_0x47a5('0x35')]=_[_0x47a5('0x36')](db[_0x47a5('0x63')][_0x47a5('0x34')]);_0x9769b5[_0x47a5('0x37')]=_[_0x47a5('0x36')](_0x6a8174['query']);_0x9769b5[_0x47a5('0x42')]=_[_0x47a5('0x3a')](_0x9769b5[_0x47a5('0x35')],_0x9769b5[_0x47a5('0x37')]);_0x263521['attributes']=_['intersection'](_0x9769b5[_0x47a5('0x35')],qs['fields'](_0x6a8174['query'][_0x47a5('0x3b')]));_0x263521[_0x47a5('0x3c')]=_0x263521['attributes'][_0x47a5('0x3d')]?_0x263521[_0x47a5('0x3c')]:_0x9769b5[_0x47a5('0x35')];_0x263521['order']=qs[_0x47a5('0x40')](_0x6a8174[_0x47a5('0x37')]['sort']);_0x263521[_0x47a5('0x46')]=qs[_0x47a5('0x42')](_[_0x47a5('0x41')](_0x6a8174[_0x47a5('0x37')],_0x9769b5[_0x47a5('0x42')]));if(_0x6a8174[_0x47a5('0x37')]['filter']){_0x263521[_0x47a5('0x46')]=_['merge'](_0x263521[_0x47a5('0x46')],{'$or':_[_0x47a5('0x48')](_0x263521[_0x47a5('0x3c')],function(_0x25f188){var _0x522972={};_0x522972[_0x25f188]={'$like':'%'+_0x6a8174[_0x47a5('0x37')][_0x47a5('0x47')]+'%'};return _0x522972;})});}_0x263521=_[_0x47a5('0x45')]({},_0x263521,_0x6a8174[_0x47a5('0x49')]);return _0x52a1b5[_0x47a5('0x6f')](_0x263521);}})[_0x47a5('0x1b')](function(_0x31b8b1){if(_0x31b8b1){_0x12a1de=_0x31b8b1[_0x47a5('0x3d')];if(!_0x6a8174[_0x47a5('0x37')][_0x47a5('0x3e')](_0x47a5('0x3f'))){_0x263521[_0x47a5('0x29')]=qs['limit'](_0x6a8174[_0x47a5('0x37')][_0x47a5('0x29')]);_0x263521['offset']=qs[_0x47a5('0x28')](_0x6a8174[_0x47a5('0x37')][_0x47a5('0x28')]);}return _0x52a1b5[_0x47a5('0x6f')](_0x263521);}})[_0x47a5('0x1b')](function(_0x58fac0){if(_0x58fac0){return _0x58fac0?{'count':_0x12a1de,'rows':_0x58fac0}:null;}})[_0x47a5('0x1b')](respondWithResult(_0x2e418d,null))[_0x47a5('0x24')](handleError(_0x2e418d,null));}; \ No newline at end of file +var _0x814b=['index','ChatQueue','rawAttributes','model','keys','query','dateEnd','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','dateStart','add','day','filter','merge','map','options','includeAll','include','rows','show','params','find','create','body','describe','getMembers','findOne','UserChatQueue','ChatQueueId','findAll','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','SIP','getTeams','Team','ids','Agents','union','addAgents','penalty','addTeams','removeTeams','omit','spread','emit','isArray','userChatQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','sendStatus','status','json','count','offset','set','reject','destroy','end','name','send'];(function(_0x8560d3,_0x26a504){var _0x33b1b5=function(_0x3a2cad){while(--_0x3a2cad){_0x8560d3['push'](_0x8560d3['shift']());}};_0x33b1b5(++_0x26a504);}(_0x814b,0x1a2));var _0xb814=function(_0x28cbc0,_0x203516){_0x28cbc0=_0x28cbc0-0x0;var _0x4b3cf5=_0x814b[_0x28cbc0];return _0x4b3cf5;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var qs=require(_0xb814('0x13'));var logger=require(_0xb814('0x14'))(_0xb814('0x15'));var utils=require(_0xb814('0x16'));var config=require(_0xb814('0x17'));var db=require('../../mysqldb')['db'];config[_0xb814('0x18')]=_['defaults'](config[_0xb814('0x18')],{'host':_0xb814('0x19'),'port':0x18eb});var socket=require(_0xb814('0x1a'))(new Redis(config[_0xb814('0x18')]));require(_0xb814('0x1b'))[_0xb814('0x1c')](socket);var jayson=require(_0xb814('0x1d'));var client=jayson[_0xb814('0x1e')][_0xb814('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2ab627,_0x3f4881,_0x44fb96,_0x17f5bd){return new BPromise(function(_0x39bfcf,_0x303aca){var _0x3a71d6=_0x17f5bd||client;return _0x3a71d6[_0xb814('0x20')](_0x2ab627,_0x44fb96)[_0xb814('0x21')](function(_0x125ce2){logger[_0xb814('0x22')](_0xb814('0x23'),_0x3f4881,'request\x20sent');logger[_0xb814('0x24')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x3f4881,_0xb814('0x25'),JSON[_0xb814('0x26')](_0x125ce2));if(_0x125ce2['error']){if(_0x125ce2['error']['code']===0x1f4){logger[_0xb814('0x27')]('ChatQueue,\x20%s,\x20%s',_0x3f4881,_0x125ce2['error'][_0xb814('0x28')]);return _0x303aca(_0x125ce2[_0xb814('0x27')][_0xb814('0x28')]);}logger['error'](_0xb814('0x23'),_0x3f4881,_0x125ce2['error'][_0xb814('0x28')]);return _0x39bfcf(_0x125ce2[_0xb814('0x27')][_0xb814('0x28')]);}else{logger[_0xb814('0x22')](_0xb814('0x23'),_0x3f4881,_0xb814('0x25'));_0x39bfcf(_0x125ce2[_0xb814('0x29')]['message']);}})[_0xb814('0x2a')](function(_0x52b7a3){logger[_0xb814('0x27')](_0xb814('0x23'),_0x3f4881,_0x52b7a3);_0x303aca(_0x52b7a3);});});}function respondWithStatusCode(_0x31c7ec,_0x208927){_0x208927=_0x208927||0xcc;return function(_0x1c8a2e){if(_0x1c8a2e){return _0x31c7ec[_0xb814('0x2b')](_0x208927);}return _0x31c7ec[_0xb814('0x2c')](_0x208927)['end']();};}function respondWithResult(_0x392222,_0xc0ef66){_0xc0ef66=_0xc0ef66||0xc8;return function(_0x1c2625){if(_0x1c2625){return _0x392222[_0xb814('0x2c')](_0xc0ef66)[_0xb814('0x2d')](_0x1c2625);}};}function respondWithFilteredResult(_0x1d5965,_0x3f0150){return function(_0x1e4e89){if(_0x1e4e89){var _0x5a6291=_0x1e4e89[_0xb814('0x2e')],_0x271aa8=_0x3f0150[_0xb814('0x2f')],_0x328a08=_0x3f0150[_0xb814('0x2f')]+_0x3f0150['limit'],_0x52ed64;if(_0x328a08>=_0x5a6291){_0x328a08=_0x5a6291;_0x52ed64=0xc8;}else{_0x52ed64=0xce;}_0x1d5965[_0xb814('0x2c')](_0x52ed64);return _0x1d5965[_0xb814('0x30')]('Content-Range',_0x271aa8+'-'+_0x328a08+'/'+_0x5a6291)[_0xb814('0x2d')](_0x1e4e89);}return null;};}function patchUpdates(_0x526610){return function(_0x6efe9a){try{jsonpatch['apply'](_0x6efe9a,_0x526610,!![]);}catch(_0x4cfc58){return BPromise[_0xb814('0x31')](_0x4cfc58);}return _0x6efe9a['save']();};}function saveUpdates(_0x2431e2,_0x19469b){return function(_0x2b91bd){if(_0x2b91bd){return _0x2b91bd['update'](_0x2431e2)['then'](function(_0x26d3a9){return _0x26d3a9;});}return null;};}function removeEntity(_0x336e2b,_0x523566){return function(_0x2c8943){if(_0x2c8943){return _0x2c8943[_0xb814('0x32')]()[_0xb814('0x21')](function(){_0x336e2b[_0xb814('0x2c')](0xcc)[_0xb814('0x33')]();});}};}function handleEntityNotFound(_0x60024d,_0x3672f3){return function(_0x4df4e6){if(!_0x4df4e6){_0x60024d[_0xb814('0x2b')](0x194);}return _0x4df4e6;};}function handleError(_0x2263f6,_0x30de5a){_0x30de5a=_0x30de5a||0x1f4;return function(_0x424e2b){logger[_0xb814('0x27')](_0x424e2b['stack']);if(_0x424e2b[_0xb814('0x34')]){delete _0x424e2b['name'];}_0x2263f6[_0xb814('0x2c')](_0x30de5a)[_0xb814('0x35')](_0x424e2b);};}exports[_0xb814('0x36')]=function(_0x492d5e,_0x40b885){var _0xbdb3e9={},_0x4ea6f8={},_0x2fcd92={'count':0x0,'rows':[]};var _0x2d0e27=db[_0xb814('0x37')][_0xb814('0x38')];_0x4ea6f8[_0xb814('0x39')]=_[_0xb814('0x3a')](_0x2d0e27);var _0x4d81eb={'dateStart':_0x492d5e[_0xb814('0x3b')]['dateStart'],'dateEnd':_0x492d5e[_0xb814('0x3b')]['dateEnd']};delete _0x492d5e[_0xb814('0x3b')]['dateStart'];delete _0x492d5e[_0xb814('0x3b')][_0xb814('0x3c')];_0x4ea6f8['query']=_['keys'](_0x492d5e['query']);_0x4ea6f8['filters']=_[_0xb814('0x3d')](_0x4ea6f8[_0xb814('0x39')],_0x4ea6f8[_0xb814('0x3b')]);_0xbdb3e9[_0xb814('0x3e')]=_['intersection'](_0x4ea6f8['model'],qs[_0xb814('0x3f')](_0x492d5e['query'][_0xb814('0x3f')]));_0xbdb3e9[_0xb814('0x3e')]=_0xbdb3e9[_0xb814('0x3e')][_0xb814('0x40')]?_0xbdb3e9[_0xb814('0x3e')]:_0x4ea6f8[_0xb814('0x39')];if(!_0x492d5e[_0xb814('0x3b')][_0xb814('0x41')](_0xb814('0x42'))){_0xbdb3e9['limit']=qs['limit'](_0x492d5e['query'][_0xb814('0x43')]);_0xbdb3e9['offset']=qs[_0xb814('0x2f')](_0x492d5e['query'][_0xb814('0x2f')]);}_0xbdb3e9[_0xb814('0x44')]=qs[_0xb814('0x45')](_0x492d5e[_0xb814('0x3b')]['sort']);_0xbdb3e9[_0xb814('0x46')]=qs[_0xb814('0x47')](_[_0xb814('0x48')](_0x492d5e[_0xb814('0x3b')],_0x4ea6f8[_0xb814('0x47')]));if(_0x4d81eb[_0xb814('0x49')]){if(_0x4d81eb['dateEnd']){_0x4d81eb[_0xb814('0x3c')]=moment(_0x4d81eb[_0xb814('0x3c')])[_0xb814('0x4a')](0x1,_0xb814('0x4b'));}else{_0x4d81eb[_0xb814('0x3c')]=moment(_0x4d81eb[_0xb814('0x49')])[_0xb814('0x4a')](0x1,'day');}_['merge'](_0xbdb3e9[_0xb814('0x46')],{'createdAt':{'$gte':_0x4d81eb[_0xb814('0x49')],'$lte':_0x4d81eb[_0xb814('0x3c')]}});}if(_0x492d5e[_0xb814('0x3b')][_0xb814('0x4c')]){_0xbdb3e9[_0xb814('0x46')]=_[_0xb814('0x4d')](_0xbdb3e9[_0xb814('0x46')],{'$or':_[_0xb814('0x4e')](_0xbdb3e9[_0xb814('0x3e')],function(_0xe73300){var _0x5c7a49={};_0x5c7a49[_0xe73300]={'$like':'%'+_0x492d5e[_0xb814('0x3b')][_0xb814('0x4c')]+'%'};return _0x5c7a49;})});}_0xbdb3e9=_['merge']({},_0xbdb3e9,_0x492d5e[_0xb814('0x4f')]);var _0x55234d={'where':_0xbdb3e9[_0xb814('0x46')]};return db[_0xb814('0x37')][_0xb814('0x2e')](_0x55234d)[_0xb814('0x21')](function(_0x1d3833){_0x2fcd92[_0xb814('0x2e')]=_0x1d3833;if(_0x492d5e[_0xb814('0x3b')][_0xb814('0x50')]){_0xbdb3e9[_0xb814('0x51')]=[{'all':!![]}];}return db[_0xb814('0x37')]['findAll'](_0xbdb3e9);})['then'](function(_0x32eca6){_0x2fcd92[_0xb814('0x52')]=_0x32eca6;return _0x2fcd92;})[_0xb814('0x21')](respondWithFilteredResult(_0x40b885,_0xbdb3e9))[_0xb814('0x2a')](handleError(_0x40b885,null));};exports[_0xb814('0x53')]=function(_0x37ffc6,_0x135208){var _0x4a4f9a={'raw':!![],'where':{'id':_0x37ffc6[_0xb814('0x54')]['id']}},_0x26fd0b={};_0x26fd0b[_0xb814('0x39')]=_['keys'](db[_0xb814('0x37')]['rawAttributes']);_0x26fd0b[_0xb814('0x3b')]=_['keys'](_0x37ffc6[_0xb814('0x3b')]);_0x26fd0b[_0xb814('0x47')]=_['intersection'](_0x26fd0b[_0xb814('0x39')],_0x26fd0b[_0xb814('0x3b')]);_0x4a4f9a[_0xb814('0x3e')]=_['intersection'](_0x26fd0b[_0xb814('0x39')],qs['fields'](_0x37ffc6[_0xb814('0x3b')][_0xb814('0x3f')]));_0x4a4f9a['attributes']=_0x4a4f9a[_0xb814('0x3e')]['length']?_0x4a4f9a['attributes']:_0x26fd0b[_0xb814('0x39')];if(_0x37ffc6[_0xb814('0x3b')][_0xb814('0x50')]){_0x4a4f9a['include']=[{'all':!![]}];}_0x4a4f9a=_[_0xb814('0x4d')]({},_0x4a4f9a,_0x37ffc6['options']);return db[_0xb814('0x37')][_0xb814('0x55')](_0x4a4f9a)['then'](handleEntityNotFound(_0x135208,null))[_0xb814('0x21')](respondWithResult(_0x135208,null))['catch'](handleError(_0x135208,null));};exports[_0xb814('0x56')]=function(_0x1656ed,_0xb2bd82){return db[_0xb814('0x37')][_0xb814('0x56')](_0x1656ed[_0xb814('0x57')],{})[_0xb814('0x21')](respondWithResult(_0xb2bd82,0xc9))[_0xb814('0x2a')](handleError(_0xb2bd82,null));};exports['update']=function(_0x374532,_0x5441c5){if(_0x374532['body']['id']){delete _0x374532[_0xb814('0x57')]['id'];}return db[_0xb814('0x37')]['find']({'where':{'id':_0x374532[_0xb814('0x54')]['id']}})['then'](handleEntityNotFound(_0x5441c5,null))['then'](saveUpdates(_0x374532[_0xb814('0x57')],null))['then'](respondWithResult(_0x5441c5,null))[_0xb814('0x2a')](handleError(_0x5441c5,null));};exports[_0xb814('0x32')]=function(_0x2dec52,_0x586957){return db[_0xb814('0x37')]['find']({'where':{'id':_0x2dec52[_0xb814('0x54')]['id']}})[_0xb814('0x21')](handleEntityNotFound(_0x586957,null))[_0xb814('0x21')](removeEntity(_0x586957,null))[_0xb814('0x2a')](handleError(_0x586957,null));};exports[_0xb814('0x58')]=function(_0x3b374b,_0x2e5f99){return db[_0xb814('0x37')][_0xb814('0x58')]()['then'](respondWithResult(_0x2e5f99,null))[_0xb814('0x2a')](handleError(_0x2e5f99,null));};exports[_0xb814('0x59')]=function(_0x3852ae,_0x1ac6d0,_0x3b35a8){var _0x3d4843={'raw':!![],'where':{}},_0x52edfa={},_0x135e13;return db['ChatQueue'][_0xb814('0x5a')]({'where':{'id':_0x3852ae[_0xb814('0x54')]['id']}})[_0xb814('0x21')](handleEntityNotFound(_0x1ac6d0,null))['then'](function(_0x150e73){if(_0x150e73){_0x135e13=_0x150e73['get']({'plain':!![]});_0x52edfa[_0xb814('0x39')]=_['keys'](db[_0xb814('0x5b')][_0xb814('0x38')]);_0x52edfa[_0xb814('0x3b')]=_[_0xb814('0x3a')](_0x3852ae[_0xb814('0x3b')]);_0x52edfa[_0xb814('0x47')]=_[_0xb814('0x3d')](_0x52edfa['model'],_0x52edfa[_0xb814('0x3b')]);_0x3d4843['attributes']=_[_0xb814('0x3d')](_0x52edfa[_0xb814('0x39')],qs[_0xb814('0x3f')](_0x3852ae[_0xb814('0x3b')][_0xb814('0x3f')]));_0x3d4843[_0xb814('0x3e')]=_0x3d4843['attributes'][_0xb814('0x40')]?_0x3d4843[_0xb814('0x3e')]:_0x52edfa['model'];if(!_0x3852ae[_0xb814('0x3b')][_0xb814('0x41')](_0xb814('0x42'))){_0x3d4843[_0xb814('0x43')]=qs[_0xb814('0x43')](_0x3852ae['query'][_0xb814('0x43')]);_0x3d4843['offset']=qs[_0xb814('0x2f')](_0x3852ae[_0xb814('0x3b')][_0xb814('0x2f')]);}_0x3d4843[_0xb814('0x44')]=qs[_0xb814('0x45')](_0x3852ae[_0xb814('0x3b')]['sort']);_0x3d4843['where']=qs['filters'](_[_0xb814('0x48')](_0x3852ae['query'],_0x52edfa[_0xb814('0x47')]));_0x3d4843[_0xb814('0x46')][_0xb814('0x5c')]=_0x150e73['id'];if(_0x3852ae['query'][_0xb814('0x4c')]){_0x3d4843[_0xb814('0x46')]=_[_0xb814('0x4d')](_0x3d4843['where'],{'$or':_[_0xb814('0x4e')](_0x3d4843[_0xb814('0x3e')],function(_0x1f39c0){var _0x3564e0={};_0x3564e0[_0x1f39c0]={'$like':'%'+_0x3852ae['query']['filter']+'%'};return _0x3564e0;})});}_0x3d4843=_[_0xb814('0x4d')]({},_0x3d4843,_0x3852ae[_0xb814('0x4f')]);return db[_0xb814('0x5b')][_0xb814('0x5d')](_0x3d4843);}})[_0xb814('0x21')](function(_0xe5fc12){if(_0xe5fc12){return db[_0xb814('0x5e')][_0xb814('0x5f')]({'where':{'id':_[_0xb814('0x4e')](_0xe5fc12,_0xb814('0x60')),'role':_0xb814('0x61')},'attributes':['id',_0xb814('0x34'),_0xb814('0x62'),_0xb814('0x63'),_0xb814('0x64')]});}})['then'](function(_0x2332dc){if(_0x2332dc){return{'count':_0x2332dc[_0xb814('0x2e')],'rows':_[_0xb814('0x4e')](_0x2332dc[_0xb814('0x52')],function(_0xec821a){return{'membername':_0xec821a[_0xb814('0x34')],'UserId':_0xec821a['id'],'queue_name':_0x135e13['name'],'ChatQueueId':_0x135e13['id'],'interface':util[_0xb814('0x65')]('%s/%s',_0xb814('0x66'),_0xec821a[_0xb814('0x34')]),'penalty':0x0,'paused':_0xec821a[_0xb814('0x62')],'createdAt':_0xec821a[_0xb814('0x64')],'updatedAt':_0xec821a[_0xb814('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1ac6d0,_0x3d4843))['catch'](handleError(_0x1ac6d0,null));};exports[_0xb814('0x67')]=function(_0x1b502b,_0x1bca54,_0x1cbf0c){var _0x488ef2={};var _0x1ee95d={};var _0x478d37;var _0x39073c;return db[_0xb814('0x37')]['findOne']({'where':{'id':_0x1b502b['params']['id']}})[_0xb814('0x21')](handleEntityNotFound(_0x1bca54,null))['then'](function(_0x3e9222){if(_0x3e9222){_0x478d37=_0x3e9222;_0x1ee95d[_0xb814('0x39')]=_[_0xb814('0x3a')](db[_0xb814('0x68')][_0xb814('0x38')]);_0x1ee95d[_0xb814('0x3b')]=_[_0xb814('0x3a')](_0x1b502b['query']);_0x1ee95d[_0xb814('0x47')]=_['intersection'](_0x1ee95d[_0xb814('0x39')],_0x1ee95d['query']);_0x488ef2[_0xb814('0x3e')]=_[_0xb814('0x3d')](_0x1ee95d['model'],qs[_0xb814('0x3f')](_0x1b502b['query'][_0xb814('0x3f')]));_0x488ef2[_0xb814('0x3e')]=_0x488ef2['attributes']['length']?_0x488ef2[_0xb814('0x3e')]:_0x1ee95d[_0xb814('0x39')];_0x488ef2[_0xb814('0x44')]=qs[_0xb814('0x45')](_0x1b502b[_0xb814('0x3b')][_0xb814('0x45')]);_0x488ef2[_0xb814('0x46')]=qs[_0xb814('0x47')](_[_0xb814('0x48')](_0x1b502b[_0xb814('0x3b')],_0x1ee95d['filters']));if(_0x1b502b['query']['filter']){_0x488ef2['where']=_['merge'](_0x488ef2[_0xb814('0x46')],{'$or':_[_0xb814('0x4e')](_0x488ef2[_0xb814('0x3e')],function(_0x59f3ff){var _0x121330={};_0x121330[_0x59f3ff]={'$like':'%'+_0x1b502b[_0xb814('0x3b')][_0xb814('0x4c')]+'%'};return _0x121330;})});}_0x488ef2=_[_0xb814('0x4d')]({},_0x488ef2,_0x1b502b[_0xb814('0x4f')]);return _0x478d37[_0xb814('0x67')](_0x488ef2);}})[_0xb814('0x21')](function(_0x1d9f13){if(_0x1d9f13){_0x39073c=_0x1d9f13['length'];if(!_0x1b502b[_0xb814('0x3b')][_0xb814('0x41')](_0xb814('0x42'))){_0x488ef2[_0xb814('0x43')]=qs['limit'](_0x1b502b[_0xb814('0x3b')][_0xb814('0x43')]);_0x488ef2[_0xb814('0x2f')]=qs[_0xb814('0x2f')](_0x1b502b[_0xb814('0x3b')]['offset']);}return _0x478d37['getTeams'](_0x488ef2);}})[_0xb814('0x21')](function(_0x57b3f2){if(_0x57b3f2){return _0x57b3f2?{'count':_0x39073c,'rows':_0x57b3f2}:null;}})[_0xb814('0x21')](respondWithResult(_0x1bca54,null))[_0xb814('0x2a')](handleError(_0x1bca54,null));};exports['addTeams']=function(_0xc8f730,_0x486495,_0xe17e86){var _0x520d0f=[];var _0x44e668;return db[_0xb814('0x68')][_0xb814('0x5d')]({'where':{'id':_0xc8f730[_0xb814('0x57')][_0xb814('0x69')]},'attributes':['id'],'include':[{'model':db[_0xb814('0x5e')],'as':_0xb814('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x5a4e2e){if(_0x5a4e2e){for(var _0x21aa36=0x0;_0x21aa36<_0x5a4e2e['length'];_0x21aa36+=0x1){for(var _0x511e03=0x0;_0x511e03<_0x5a4e2e[_0x21aa36][_0xb814('0x6a')][_0xb814('0x40')];_0x511e03+=0x1){_0x520d0f=_[_0xb814('0x6b')](_0x520d0f,[_0x5a4e2e[_0x21aa36]['Agents'][_0x511e03]['id']]);}}return _0x520d0f;}})[_0xb814('0x21')](function(_0x5a25f2){if(_0x5a25f2){return db[_0xb814('0x37')][_0xb814('0x55')]({'where':{'id':_0xc8f730[_0xb814('0x54')]['id']}});}})[_0xb814('0x21')](function(_0x4c8a00){if(_0x4c8a00){_0x44e668=_0x4c8a00;return _0x44e668[_0xb814('0x6c')](_0x520d0f,{'penalty':_0xc8f730[_0xb814('0x57')][_0xb814('0x6d')]});}})['then'](function(_0x1ebbf6){if(_0x1ebbf6){return _0x44e668[_0xb814('0x6e')](_0xc8f730[_0xb814('0x57')]['ids']);}})[_0xb814('0x21')](handleEntityNotFound(_0x486495,null))[_0xb814('0x21')](respondWithStatusCode(_0x486495,null))[_0xb814('0x2a')](handleError(_0x486495,null));};exports[_0xb814('0x6f')]=function(_0x40b3c5,_0x1ae8e8,_0x37a7ab){var _0x472c38=[];var _0x37a8b1;return db[_0xb814('0x68')][_0xb814('0x5d')]({'where':{'id':_0x40b3c5[_0xb814('0x3b')][_0xb814('0x69')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb814('0x21')](function(_0x50697f){if(_0x50697f){for(var _0x320296=0x0;_0x320296<_0x50697f[_0xb814('0x40')];_0x320296+=0x1){for(var _0x43ab12=0x0;_0x43ab12<_0x50697f[_0x320296][_0xb814('0x6a')][_0xb814('0x40')];_0x43ab12+=0x1){_0x472c38=_[_0xb814('0x6b')](_0x472c38,[_0x50697f[_0x320296][_0xb814('0x6a')][_0x43ab12]['id']]);}}return _0x472c38;}})['then'](function(_0x4a460a){if(_0x4a460a){return db[_0xb814('0x37')]['find']({'where':{'id':_0x40b3c5[_0xb814('0x54')]['id']}});}})[_0xb814('0x21')](function(_0x1becf7){if(_0x1becf7){_0x37a8b1=_0x1becf7;return _0x37a8b1['removeAgents'](_0x472c38);}})[_0xb814('0x21')](function(_0x28c358){if(_0x37a8b1){return _0x37a8b1[_0xb814('0x6f')](_0x40b3c5[_0xb814('0x3b')][_0xb814('0x69')]);}})['then'](handleEntityNotFound(_0x1ae8e8,null))[_0xb814('0x21')](respondWithStatusCode(_0x1ae8e8,null))[_0xb814('0x2a')](handleError(_0x1ae8e8,null));};exports['addAgents']=function(_0x4530ed,_0x20f6ca,_0x3e3f69){return db['ChatQueue'][_0xb814('0x55')]({'where':{'id':_0x4530ed[_0xb814('0x54')]['id']}})['then'](handleEntityNotFound(_0x20f6ca,null))[_0xb814('0x21')](function(_0x171f83){if(_0x171f83){return _0x171f83['addAgents'](_0x4530ed[_0xb814('0x57')][_0xb814('0x69')],_[_0xb814('0x70')](_0x4530ed[_0xb814('0x57')],[_0xb814('0x69'),'id'])||{})[_0xb814('0x71')](function(_0x40ae0b){for(var _0x336a8f=0x0;_0x336a8f<_0x4530ed[_0xb814('0x57')][_0xb814('0x69')][_0xb814('0x40')];_0x336a8f+=0x1){socket[_0xb814('0x72')]('userChatQueue:save',{'UserId':_0x4530ed['body'][_0xb814('0x69')][_0x336a8f],'ChatQueueId':_0x4530ed['params']['id']});}return _0x40ae0b;});}})['then'](respondWithResult(_0x20f6ca,null))[_0xb814('0x2a')](handleError(_0x20f6ca,null));};exports['removeAgents']=function(_0x4f0427,_0x50cb34,_0x1044fa){var _0x2ce4de;return db[_0xb814('0x37')]['find']({'where':{'id':_0x4f0427[_0xb814('0x54')]['id']}})['then'](handleEntityNotFound(_0x50cb34,null))[_0xb814('0x21')](function(_0x2e6660){if(_0x2e6660){return _0x2e6660['removeAgents'](_0x4f0427[_0xb814('0x3b')]['ids'])[_0xb814('0x21')](function(_0x2cfedd){if(_[_0xb814('0x73')](_0x4f0427[_0xb814('0x3b')][_0xb814('0x69')])){for(var _0xaf705d=0x0;_0xaf705d<_0x4f0427[_0xb814('0x3b')][_0xb814('0x69')][_0xb814('0x40')];_0xaf705d+=0x1){socket[_0xb814('0x72')](_0xb814('0x74'),{'UserId':_0x4f0427[_0xb814('0x3b')][_0xb814('0x69')][_0xaf705d],'ChatQueueId':_0x4f0427[_0xb814('0x54')]['id']});}}else{socket[_0xb814('0x72')]('userChatQueue:remove',{'UserId':_0x4f0427[_0xb814('0x3b')][_0xb814('0x69')],'ChatQueueId':_0x4f0427['params']['id']});}});}})[_0xb814('0x21')](respondWithStatusCode(_0x50cb34,null))[_0xb814('0x2a')](handleError(_0x50cb34,null));};exports[_0xb814('0x75')]=function(_0x570191,_0x56b2aa,_0x473b30){var _0x4af71e={};var _0x2d40e6={};var _0x4eeee6;var _0xdf3e07;return db['ChatQueue']['findOne']({'where':{'id':_0x570191[_0xb814('0x54')]['id']}})[_0xb814('0x21')](handleEntityNotFound(_0x56b2aa,null))[_0xb814('0x21')](function(_0x21b286){if(_0x21b286){_0x4eeee6=_0x21b286;_0x2d40e6[_0xb814('0x39')]=_[_0xb814('0x3a')](db[_0xb814('0x5e')][_0xb814('0x38')]);_0x2d40e6[_0xb814('0x3b')]=_[_0xb814('0x3a')](_0x570191[_0xb814('0x3b')]);_0x2d40e6['filters']=_[_0xb814('0x3d')](_0x2d40e6['model'],_0x2d40e6[_0xb814('0x3b')]);_0x4af71e[_0xb814('0x3e')]=_[_0xb814('0x3d')](_0x2d40e6['model'],qs[_0xb814('0x3f')](_0x570191[_0xb814('0x3b')][_0xb814('0x3f')]));_0x4af71e[_0xb814('0x3e')]=_0x4af71e[_0xb814('0x3e')][_0xb814('0x40')]?_0x4af71e[_0xb814('0x3e')]:_0x2d40e6[_0xb814('0x39')];_0x4af71e[_0xb814('0x44')]=qs[_0xb814('0x45')](_0x570191[_0xb814('0x3b')][_0xb814('0x45')]);_0x4af71e[_0xb814('0x46')]=qs[_0xb814('0x47')](_[_0xb814('0x48')](_0x570191['query'],_0x2d40e6[_0xb814('0x47')]));if(_0x570191[_0xb814('0x3b')][_0xb814('0x4c')]){_0x4af71e['where']=_['merge'](_0x4af71e[_0xb814('0x46')],{'$or':_['map'](_0x4af71e['attributes'],function(_0x57181f){var _0x4b86c3={};_0x4b86c3[_0x57181f]={'$like':'%'+_0x570191[_0xb814('0x3b')][_0xb814('0x4c')]+'%'};return _0x4b86c3;})});}_0x4af71e=_['merge']({},_0x4af71e,_0x570191[_0xb814('0x4f')]);return _0x4eeee6[_0xb814('0x75')](_0x4af71e);}})[_0xb814('0x21')](function(_0x3d24c3){if(_0x3d24c3){_0xdf3e07=_0x3d24c3[_0xb814('0x40')];if(!_0x570191[_0xb814('0x3b')][_0xb814('0x41')](_0xb814('0x42'))){_0x4af71e[_0xb814('0x43')]=qs[_0xb814('0x43')](_0x570191[_0xb814('0x3b')]['limit']);_0x4af71e[_0xb814('0x2f')]=qs['offset'](_0x570191[_0xb814('0x3b')][_0xb814('0x2f')]);}return _0x4eeee6[_0xb814('0x75')](_0x4af71e);}})[_0xb814('0x21')](function(_0x1fd6c7){if(_0x1fd6c7){return _0x1fd6c7?{'count':_0xdf3e07,'rows':_0x1fd6c7}:null;}})[_0xb814('0x21')](respondWithResult(_0x56b2aa,null))[_0xb814('0x2a')](handleError(_0x56b2aa,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 67c4ce8..525e8d4 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 _0xdc64=['ChatQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x4c4423,_0x432576){var _0x3f6c45=function(_0x5f466f){while(--_0x5f466f){_0x4c4423['push'](_0x4c4423['shift']());}};_0x3f6c45(++_0x432576);}(_0xdc64,0x80));var _0x4dc6=function(_0x26923e,_0x3d39ff){_0x26923e=_0x26923e-0x0;var _0x4c728c=_0xdc64[_0x26923e];return _0x4c728c;};'use strict';var EventEmitter=require(_0x4dc6('0x0'));var ChatQueue=require(_0x4dc6('0x1'))['db'][_0x4dc6('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x4dc6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4dc6('0x4'),'afterDestroy':_0x4dc6('0x5')};function emitEvent(_0x31edee){return function(_0x6a357f,_0x425b2c,_0x45c35c){ChatQueueEvents[_0x4dc6('0x6')](_0x31edee+':'+_0x6a357f['id'],_0x6a357f);ChatQueueEvents[_0x4dc6('0x6')](_0x31edee,_0x6a357f);_0x45c35c(null);};}for(var e in events){if(events[_0x4dc6('0x7')](e)){var event=events[e];ChatQueue[_0x4dc6('0x8')](e,emitEvent(event));}}module[_0x4dc6('0x9')]=ChatQueueEvents; \ No newline at end of file +var _0x8bec=['ChatQueue','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x27f8f7,_0x1843fc){var _0x224167=function(_0x18f605){while(--_0x18f605){_0x27f8f7['push'](_0x27f8f7['shift']());}};_0x224167(++_0x1843fc);}(_0x8bec,0x6e));var _0xc8be=function(_0xf73cb6,_0x3a0976){_0xf73cb6=_0xf73cb6-0x0;var _0x4edfe3=_0x8bec[_0xf73cb6];return _0x4edfe3;};'use strict';var EventEmitter=require(_0xc8be('0x0'));var ChatQueue=require(_0xc8be('0x1'))['db'][_0xc8be('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xc8be('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc8be('0x4'),'afterDestroy':_0xc8be('0x5')};function emitEvent(_0x4289d5){return function(_0x2865d5,_0x2e58d4,_0x1b827b){ChatQueueEvents['emit'](_0x4289d5+':'+_0x2865d5['id'],_0x2865d5);ChatQueueEvents[_0xc8be('0x6')](_0x4289d5,_0x2865d5);_0x1b827b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0xc8be('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 0cd6bab..e3d2b86 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 _0x3baf=['bluebird','request-promise','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment'];(function(_0x246eeb,_0x149e6a){var _0x644aa=function(_0x57cd0a){while(--_0x57cd0a){_0x246eeb['push'](_0x246eeb['shift']());}};_0x644aa(++_0x149e6a);}(_0x3baf,0xf7));var _0xf3ba=function(_0x185f01,_0x3930e3){_0x185f01=_0x185f01-0x0;var _0x330844=_0x3baf[_0x185f01];return _0x330844;};'use strict';var _=require(_0xf3ba('0x0'));var util=require(_0xf3ba('0x1'));var logger=require(_0xf3ba('0x2'))(_0xf3ba('0x3'));var moment=require(_0xf3ba('0x4'));var BPromise=require(_0xf3ba('0x5'));var rp=require(_0xf3ba('0x6'));var attributes=require(_0xf3ba('0x7'));module[_0xf3ba('0x8')]=function(_0x1ae6e6,_0x57e17d){return _0x1ae6e6[_0xf3ba('0x9')](_0xf3ba('0xa'),attributes,{'tableName':_0xf3ba('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29d4=['moment','bluebird','request-promise','exports','define','ChatQueue','chat_queues','lodash','../../config/logger','api'];(function(_0x5c0178,_0x12c24f){var _0xba92b9=function(_0x1cfc5a){while(--_0x1cfc5a){_0x5c0178['push'](_0x5c0178['shift']());}};_0xba92b9(++_0x12c24f);}(_0x29d4,0x1a1));var _0x429d=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x29d4[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require(_0x429d('0x0'));var util=require('util');var logger=require(_0x429d('0x1'))(_0x429d('0x2'));var moment=require(_0x429d('0x3'));var BPromise=require(_0x429d('0x4'));var rp=require(_0x429d('0x5'));var attributes=require('./chatQueue.attributes');module[_0x429d('0x6')]=function(_0x3f43f5,_0x36a3d8){return _0x3f43f5[_0x429d('0x7')](_0x429d('0x8'),attributes,{'tableName':_0x429d('0x9'),'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 6c2cd25..eeb2a55 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 _0x84ad=['ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','ShowChatQueue','find','util','moment','../../mysqldb','../../config/utils','../../config/logger','http','redis','defaults','localhost','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x49db5c,_0x202443){var _0x261bec=function(_0x3070c4){while(--_0x3070c4){_0x49db5c['push'](_0x49db5c['shift']());}};_0x261bec(++_0x202443);}(_0x84ad,0x84));var _0xd84a=function(_0x361026,_0x2375e2){_0x361026=_0x361026-0x0;var _0x37028e=_0x84ad[_0x361026];return _0x37028e;};'use strict';var _=require('lodash');var util=require(_0xd84a('0x0'));var moment=require(_0xd84a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd84a('0x2'))['db'];var utils=require(_0xd84a('0x3'));var logger=require(_0xd84a('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd84a('0x5')]({'port':0x232a});config[_0xd84a('0x6')]=_[_0xd84a('0x7')](config[_0xd84a('0x6')],{'host':_0xd84a('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd84a('0x6')]));require(_0xd84a('0x9'))[_0xd84a('0xa')](socket);function respondWithRpcPromise(_0x561829,_0x47a316,_0x4735bb){return new BPromise(function(_0x5dbb83,_0x11b98f){return client[_0xd84a('0xb')](_0x561829,_0x4735bb)[_0xd84a('0xc')](function(_0x549b36){logger[_0xd84a('0xd')](_0xd84a('0xe'),_0x47a316,_0xd84a('0xf'));logger['debug'](_0xd84a('0x10'),_0x47a316,_0xd84a('0xf'),JSON['stringify'](_0x549b36));if(_0x549b36[_0xd84a('0x11')]){if(_0x549b36[_0xd84a('0x11')][_0xd84a('0x12')]===0x1f4){logger[_0xd84a('0x11')](_0xd84a('0xe'),_0x47a316,_0x549b36[_0xd84a('0x11')]['message']);return _0x11b98f(_0x549b36['error']['message']);}logger[_0xd84a('0x11')](_0xd84a('0xe'),_0x47a316,_0x549b36[_0xd84a('0x11')]['message']);return _0x5dbb83(_0x549b36[_0xd84a('0x11')][_0xd84a('0x13')]);}else{logger[_0xd84a('0xd')](_0xd84a('0xe'),_0x47a316,'request\x20sent');_0x5dbb83(_0x549b36[_0xd84a('0x14')]['message']);}})[_0xd84a('0x15')](function(_0x55204c){logger[_0xd84a('0x11')]('ChatQueue,\x20%s,\x20%s',_0x47a316,_0x55204c);_0x11b98f(_0x55204c);});});}exports[_0xd84a('0x16')]=function(_0x5e5964){var _0x497a17=this;return new Promise(function(_0x51fd68,_0x2666b7){return db[_0xd84a('0x17')][_0xd84a('0x18')]({'raw':_0x5e5964[_0xd84a('0x19')]?_0x5e5964[_0xd84a('0x19')][_0xd84a('0x1a')]===undefined?!![]:![]:!![],'where':_0x5e5964[_0xd84a('0x19')]?_0x5e5964[_0xd84a('0x19')][_0xd84a('0x1b')]||null:null,'attributes':_0x5e5964[_0xd84a('0x19')]?_0x5e5964[_0xd84a('0x19')][_0xd84a('0x1c')]||null:null,'limit':_0x5e5964[_0xd84a('0x19')]?_0x5e5964['options'][_0xd84a('0x1d')]||null:null,'include':_0x5e5964[_0xd84a('0x19')]?_0x5e5964[_0xd84a('0x19')][_0xd84a('0x1e')]?_[_0xd84a('0x1f')](_0x5e5964['options'][_0xd84a('0x1e')],function(_0x1c6565){return{'model':db[_0x1c6565[_0xd84a('0x20')]],'as':_0x1c6565['as'],'attributes':_0x1c6565[_0xd84a('0x1c')],'include':_0x1c6565[_0xd84a('0x1e')]?_['map'](_0x1c6565[_0xd84a('0x1e')],function(_0x4dbc6d){return{'model':db[_0x4dbc6d[_0xd84a('0x20')]],'as':_0x4dbc6d['as'],'attributes':_0x4dbc6d[_0xd84a('0x1c')],'include':_0x4dbc6d[_0xd84a('0x1e')]?_[_0xd84a('0x1f')](_0x4dbc6d['include'],function(_0x126b49){return{'model':db[_0x126b49['model']],'as':_0x126b49['as'],'attributes':_0x126b49[_0xd84a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd84a('0xc')](function(_0x2ecb70){logger[_0xd84a('0xd')](_0xd84a('0x16'),_0x5e5964);logger[_0xd84a('0x21')](_0xd84a('0x16'),_0x5e5964,JSON[_0xd84a('0x22')](_0x2ecb70));_0x51fd68(_0x2ecb70);})[_0xd84a('0x15')](function(_0x3627c8){logger[_0xd84a('0x11')]('GetChatQueue',_0x3627c8[_0xd84a('0x13')],_0x5e5964);_0x2666b7(_0x497a17[_0xd84a('0x11')](0x1f4,_0x3627c8[_0xd84a('0x13')]));});});};exports[_0xd84a('0x23')]=function(_0x38d721){var _0x4d2197=this;return new Promise(function(_0x24bb1e,_0x219347){return db[_0xd84a('0x17')][_0xd84a('0x24')]({'raw':_0x38d721[_0xd84a('0x19')]?_0x38d721[_0xd84a('0x19')][_0xd84a('0x1a')]===undefined?!![]:![]:!![],'where':_0x38d721[_0xd84a('0x19')]?_0x38d721[_0xd84a('0x19')]['where']||null:null,'attributes':_0x38d721['options']?_0x38d721[_0xd84a('0x19')][_0xd84a('0x1c')]||null:null,'include':_0x38d721[_0xd84a('0x19')]?_0x38d721[_0xd84a('0x19')][_0xd84a('0x1e')]?_[_0xd84a('0x1f')](_0x38d721[_0xd84a('0x19')][_0xd84a('0x1e')],function(_0x54f150){return{'model':db[_0x54f150[_0xd84a('0x20')]],'as':_0x54f150['as'],'attributes':_0x54f150[_0xd84a('0x1c')],'include':_0x54f150[_0xd84a('0x1e')]?_['map'](_0x54f150[_0xd84a('0x1e')],function(_0x53792b){return{'model':db[_0x53792b[_0xd84a('0x20')]],'as':_0x53792b['as'],'attributes':_0x53792b[_0xd84a('0x1c')],'include':_0x53792b[_0xd84a('0x1e')]?_['map'](_0x53792b['include'],function(_0x2f68be){return{'model':db[_0x2f68be[_0xd84a('0x20')]],'as':_0x2f68be['as'],'attributes':_0x2f68be[_0xd84a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd84a('0xc')](function(_0x1ad7f0){logger[_0xd84a('0xd')](_0xd84a('0x23'),_0x38d721);logger['debug'](_0xd84a('0x23'),_0x38d721,JSON[_0xd84a('0x22')](_0x1ad7f0));_0x24bb1e(_0x1ad7f0);})['catch'](function(_0x4feaaa){logger[_0xd84a('0x11')](_0xd84a('0x23'),_0x4feaaa['message'],_0x38d721);_0x219347(_0x4d2197[_0xd84a('0x11')](0x1f4,_0x4feaaa[_0xd84a('0x13')]));});});}; \ No newline at end of file +var _0xba0c=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','stringify','GetChatQueue','find','ShowChatQueue','lodash'];(function(_0x255d15,_0x3bcc0d){var _0xe0fe5c=function(_0x4def34){while(--_0x4def34){_0x255d15['push'](_0x255d15['shift']());}};_0xe0fe5c(++_0x3bcc0d);}(_0xba0c,0x14f));var _0xcba0=function(_0x11a15d,_0xe2846){_0x11a15d=_0x11a15d-0x0;var _0x297b28=_0xba0c[_0x11a15d];return _0x297b28;};'use strict';var _=require(_0xcba0('0x0'));var util=require(_0xcba0('0x1'));var moment=require(_0xcba0('0x2'));var BPromise=require(_0xcba0('0x3'));var rs=require(_0xcba0('0x4'));var fs=require('fs');var Redis=require(_0xcba0('0x5'));var db=require(_0xcba0('0x6'))['db'];var utils=require(_0xcba0('0x7'));var logger=require(_0xcba0('0x8'))('rpc');var config=require(_0xcba0('0x9'));var jayson=require(_0xcba0('0xa'));var client=jayson[_0xcba0('0xb')][_0xcba0('0xc')]({'port':0x232a});config[_0xcba0('0xd')]=_['defaults'](config[_0xcba0('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xcba0('0xe'))(new Redis(config['redis']));require(_0xcba0('0xf'))[_0xcba0('0x10')](socket);function respondWithRpcPromise(_0x382e03,_0x1a83c8,_0x292f2e){return new BPromise(function(_0x38bb55,_0x228d10){return client[_0xcba0('0x11')](_0x382e03,_0x292f2e)[_0xcba0('0x12')](function(_0x21eb9b){logger[_0xcba0('0x13')](_0xcba0('0x14'),_0x1a83c8,_0xcba0('0x15'));logger[_0xcba0('0x16')](_0xcba0('0x17'),_0x1a83c8,_0xcba0('0x15'),JSON['stringify'](_0x21eb9b));if(_0x21eb9b[_0xcba0('0x18')]){if(_0x21eb9b[_0xcba0('0x18')]['code']===0x1f4){logger[_0xcba0('0x18')](_0xcba0('0x14'),_0x1a83c8,_0x21eb9b[_0xcba0('0x18')][_0xcba0('0x19')]);return _0x228d10(_0x21eb9b['error'][_0xcba0('0x19')]);}logger[_0xcba0('0x18')](_0xcba0('0x14'),_0x1a83c8,_0x21eb9b[_0xcba0('0x18')][_0xcba0('0x19')]);return _0x38bb55(_0x21eb9b[_0xcba0('0x18')]['message']);}else{logger[_0xcba0('0x13')](_0xcba0('0x14'),_0x1a83c8,_0xcba0('0x15'));_0x38bb55(_0x21eb9b[_0xcba0('0x1a')][_0xcba0('0x19')]);}})[_0xcba0('0x1b')](function(_0x3fa0a6){logger['error'](_0xcba0('0x14'),_0x1a83c8,_0x3fa0a6);_0x228d10(_0x3fa0a6);});});}exports['GetChatQueue']=function(_0x5a73fe){var _0x5602c7=this;return new Promise(function(_0x2de461,_0x140547){return db[_0xcba0('0x1c')][_0xcba0('0x1d')]({'raw':_0x5a73fe[_0xcba0('0x1e')]?_0x5a73fe['options'][_0xcba0('0x1f')]===undefined?!![]:![]:!![],'where':_0x5a73fe[_0xcba0('0x1e')]?_0x5a73fe[_0xcba0('0x1e')][_0xcba0('0x20')]||null:null,'attributes':_0x5a73fe[_0xcba0('0x1e')]?_0x5a73fe[_0xcba0('0x1e')][_0xcba0('0x21')]||null:null,'limit':_0x5a73fe[_0xcba0('0x1e')]?_0x5a73fe[_0xcba0('0x1e')][_0xcba0('0x22')]||null:null,'include':_0x5a73fe[_0xcba0('0x1e')]?_0x5a73fe['options'][_0xcba0('0x23')]?_[_0xcba0('0x24')](_0x5a73fe[_0xcba0('0x1e')][_0xcba0('0x23')],function(_0x1ee0e0){return{'model':db[_0x1ee0e0[_0xcba0('0x25')]],'as':_0x1ee0e0['as'],'attributes':_0x1ee0e0['attributes'],'include':_0x1ee0e0[_0xcba0('0x23')]?_['map'](_0x1ee0e0[_0xcba0('0x23')],function(_0x51d160){return{'model':db[_0x51d160['model']],'as':_0x51d160['as'],'attributes':_0x51d160[_0xcba0('0x21')],'include':_0x51d160['include']?_[_0xcba0('0x24')](_0x51d160[_0xcba0('0x23')],function(_0x40ba50){return{'model':db[_0x40ba50[_0xcba0('0x25')]],'as':_0x40ba50['as'],'attributes':_0x40ba50[_0xcba0('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x6702b0){logger[_0xcba0('0x13')]('GetChatQueue',_0x5a73fe);logger['debug']('GetChatQueue',_0x5a73fe,JSON[_0xcba0('0x26')](_0x6702b0));_0x2de461(_0x6702b0);})[_0xcba0('0x1b')](function(_0x3f8f2d){logger[_0xcba0('0x18')](_0xcba0('0x27'),_0x3f8f2d['message'],_0x5a73fe);_0x140547(_0x5602c7[_0xcba0('0x18')](0x1f4,_0x3f8f2d[_0xcba0('0x19')]));});});};exports['ShowChatQueue']=function(_0x373271){var _0x469613=this;return new Promise(function(_0x4a0821,_0x4b4100){return db[_0xcba0('0x1c')][_0xcba0('0x28')]({'raw':_0x373271['options']?_0x373271[_0xcba0('0x1e')][_0xcba0('0x1f')]===undefined?!![]:![]:!![],'where':_0x373271[_0xcba0('0x1e')]?_0x373271['options'][_0xcba0('0x20')]||null:null,'attributes':_0x373271[_0xcba0('0x1e')]?_0x373271[_0xcba0('0x1e')][_0xcba0('0x21')]||null:null,'include':_0x373271[_0xcba0('0x1e')]?_0x373271[_0xcba0('0x1e')]['include']?_[_0xcba0('0x24')](_0x373271[_0xcba0('0x1e')][_0xcba0('0x23')],function(_0xeba2d2){return{'model':db[_0xeba2d2[_0xcba0('0x25')]],'as':_0xeba2d2['as'],'attributes':_0xeba2d2[_0xcba0('0x21')],'include':_0xeba2d2[_0xcba0('0x23')]?_[_0xcba0('0x24')](_0xeba2d2[_0xcba0('0x23')],function(_0x11c4a3){return{'model':db[_0x11c4a3[_0xcba0('0x25')]],'as':_0x11c4a3['as'],'attributes':_0x11c4a3['attributes'],'include':_0x11c4a3[_0xcba0('0x23')]?_['map'](_0x11c4a3[_0xcba0('0x23')],function(_0x3c1b03){return{'model':db[_0x3c1b03[_0xcba0('0x25')]],'as':_0x3c1b03['as'],'attributes':_0x3c1b03[_0xcba0('0x21')]};}):[]};}):[]};}):[]:[]})[_0xcba0('0x12')](function(_0x156cd6){logger[_0xcba0('0x13')](_0xcba0('0x29'),_0x373271);logger['debug'](_0xcba0('0x29'),_0x373271,JSON[_0xcba0('0x26')](_0x156cd6));_0x4a0821(_0x156cd6);})[_0xcba0('0x1b')](function(_0x2f79e6){logger[_0xcba0('0x18')](_0xcba0('0x29'),_0x2f79e6['message'],_0x373271);_0x4b4100(_0x469613['error'](0x1f4,_0x2f79e6[_0xcba0('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 8b59bf6..385b404 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 _0xa9e0=['register','length','chatQueue:','./chatQueue.events','save','remove','emit','removeListener'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var ChatQueueEvents=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(){ChatQueueEvents[_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);ChatQueueEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','chatQueue:','./chatQueue.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(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var ChatQueueEvents=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(){ChatQueueEvents[_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);ChatQueueEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 6c6aea9..90a0503 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 _0x3d4b=['put','update','destroy','delete','removeAgents','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents'];(function(_0x542893,_0x2edc64){var _0x503e20=function(_0x506e37){while(--_0x506e37){_0x542893['push'](_0x542893['shift']());}};_0x503e20(++_0x2edc64);}(_0x3d4b,0xd1));var _0xb3d4=function(_0x39a1d7,_0x4d037f){_0x39a1d7=_0x39a1d7-0x0;var _0x4742e2=_0x3d4b[_0x39a1d7];return _0x4742e2;};'use strict';var multer=require('multer');var util=require(_0xb3d4('0x0'));var path=require(_0xb3d4('0x1'));var timeout=require('connect-timeout');var express=require(_0xb3d4('0x2'));var router=express[_0xb3d4('0x3')]();var auth=require(_0xb3d4('0x4'));var interaction=require(_0xb3d4('0x5'));var config=require(_0xb3d4('0x6'));var controller=require(_0xb3d4('0x7'));router[_0xb3d4('0x8')]('/',auth[_0xb3d4('0x9')](),controller[_0xb3d4('0xa')]);router['get'](_0xb3d4('0xb'),auth[_0xb3d4('0x9')](),controller[_0xb3d4('0xc')]);router[_0xb3d4('0x8')](_0xb3d4('0xd'),auth[_0xb3d4('0x9')](),controller[_0xb3d4('0xe')]);router[_0xb3d4('0x8')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xb3d4('0x8')](_0xb3d4('0xf'),auth[_0xb3d4('0x9')](),controller[_0xb3d4('0x10')]);router[_0xb3d4('0x8')](_0xb3d4('0x11'),auth['isAuthenticated'](),controller[_0xb3d4('0x12')]);router[_0xb3d4('0x13')]('/',auth[_0xb3d4('0x9')](),controller[_0xb3d4('0x14')]);router[_0xb3d4('0x13')]('/:id/teams',auth[_0xb3d4('0x9')](),controller[_0xb3d4('0x15')]);router[_0xb3d4('0x13')](_0xb3d4('0x11'),auth['isAuthenticated'](),controller[_0xb3d4('0x16')]);router[_0xb3d4('0x17')]('/:id',auth[_0xb3d4('0x9')](),controller[_0xb3d4('0x18')]);router['delete'](_0xb3d4('0xd'),auth['isAuthenticated'](),controller[_0xb3d4('0x19')]);router[_0xb3d4('0x1a')](_0xb3d4('0xf'),auth[_0xb3d4('0x9')](),controller['removeTeams']);router[_0xb3d4('0x1a')](_0xb3d4('0x11'),auth[_0xb3d4('0x9')](),controller[_0xb3d4('0x1b')]);module[_0xb3d4('0x1c')]=router; \ No newline at end of file +var _0xc8d0=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x55b6a5,_0x22d125){var _0x492d89=function(_0x1873a7){while(--_0x1873a7){_0x55b6a5['push'](_0x55b6a5['shift']());}};_0x492d89(++_0x22d125);}(_0xc8d0,0x166));var _0x0c8d=function(_0x8d8917,_0x504e20){_0x8d8917=_0x8d8917-0x0;var _0x55bd93=_0xc8d0[_0x8d8917];return _0x55bd93;};'use strict';var multer=require(_0x0c8d('0x0'));var util=require(_0x0c8d('0x1'));var path=require(_0x0c8d('0x2'));var timeout=require(_0x0c8d('0x3'));var express=require(_0x0c8d('0x4'));var router=express['Router']();var auth=require(_0x0c8d('0x5'));var interaction=require(_0x0c8d('0x6'));var config=require(_0x0c8d('0x7'));var controller=require('./chatQueue.controller');router[_0x0c8d('0x8')]('/',auth[_0x0c8d('0x9')](),controller['index']);router[_0x0c8d('0x8')](_0x0c8d('0xa'),auth[_0x0c8d('0x9')](),controller[_0x0c8d('0xb')]);router[_0x0c8d('0x8')](_0x0c8d('0xc'),auth[_0x0c8d('0x9')](),controller[_0x0c8d('0xd')]);router[_0x0c8d('0x8')](_0x0c8d('0xe'),auth['isAuthenticated'](),controller[_0x0c8d('0xf')]);router[_0x0c8d('0x8')](_0x0c8d('0x10'),auth['isAuthenticated'](),controller[_0x0c8d('0x11')]);router['get'](_0x0c8d('0x12'),auth[_0x0c8d('0x9')](),controller[_0x0c8d('0x13')]);router[_0x0c8d('0x14')]('/',auth[_0x0c8d('0x9')](),controller[_0x0c8d('0x15')]);router[_0x0c8d('0x14')](_0x0c8d('0x10'),auth[_0x0c8d('0x9')](),controller[_0x0c8d('0x16')]);router[_0x0c8d('0x14')](_0x0c8d('0x12'),auth['isAuthenticated'](),controller[_0x0c8d('0x17')]);router[_0x0c8d('0x18')](_0x0c8d('0xc'),auth[_0x0c8d('0x9')](),controller[_0x0c8d('0x19')]);router[_0x0c8d('0x1a')](_0x0c8d('0xc'),auth[_0x0c8d('0x9')](),controller[_0x0c8d('0x1b')]);router[_0x0c8d('0x1a')](_0x0c8d('0x10'),auth[_0x0c8d('0x9')](),controller[_0x0c8d('0x1c')]);router[_0x0c8d('0x1a')](_0x0c8d('0x12'),auth[_0x0c8d('0x9')](),controller[_0x0c8d('0x1d')]);module[_0x0c8d('0x1e')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 647045c..c769e5d 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 _0x97b1=['DATE','exports','STRING'];(function(_0x3bc188,_0x5ed2bc){var _0x3ec594=function(_0x184868){while(--_0x184868){_0x3bc188['push'](_0x3bc188['shift']());}};_0x3ec594(++_0x5ed2bc);}(_0x97b1,0xd3));var _0x197b=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0x97b1[_0x100682];return _0xcb6e87;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x197b('0x0')]={'uniqueid':{'type':Sequelize[_0x197b('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x197b('0x1')]},'joinAt':{'type':Sequelize[_0x197b('0x2')]},'leaveAt':{'type':Sequelize[_0x197b('0x2')]},'acceptAt':{'type':Sequelize[_0x197b('0x2')]},'exitAt':{'type':Sequelize[_0x197b('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7e3b=['STRING','DATE','sequelize','exports'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x7e3b,0x1c2));var _0xb7e3=function(_0x6ee276,_0x3365d0){_0x6ee276=_0x6ee276-0x0;var _0x2930a4=_0x7e3b[_0x6ee276];return _0x2930a4;};'use strict';var moment=require('moment');var Sequelize=require(_0xb7e3('0x0'));module[_0xb7e3('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xb7e3('0x2')]},'joinAt':{'type':Sequelize[_0xb7e3('0x3')]},'leaveAt':{'type':Sequelize[_0xb7e3('0x3')]},'acceptAt':{'type':Sequelize[_0xb7e3('0x3')]},'exitAt':{'type':Sequelize[_0xb7e3('0x3')]},'reason':{'type':Sequelize[_0xb7e3('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 8e890c0..783acad 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 _0xe59d=['index','ChatQueueReport','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','add','day','merge','map','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send'];(function(_0xa2f58,_0x3ecb2e){var _0x4c60c8=function(_0x11e7ba){while(--_0x11e7ba){_0xa2f58['push'](_0xa2f58['shift']());}};_0x4c60c8(++_0x3ecb2e);}(_0xe59d,0x1d9));var _0xde59=function(_0x20b29c,_0xe22528){_0x20b29c=_0x20b29c-0x0;var _0x20d81b=_0xe59d[_0x20b29c];return _0x20d81b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xde59('0x0'));var rimraf=require(_0xde59('0x1'));var zipdir=require(_0xde59('0x2'));var jsonpatch=require(_0xde59('0x3'));var rp=require(_0xde59('0x4'));var moment=require(_0xde59('0x5'));var BPromise=require(_0xde59('0x6'));var Mustache=require('mustache');var util=require(_0xde59('0x7'));var path=require(_0xde59('0x8'));var sox=require('sox');var csv=require(_0xde59('0x9'));var ejs=require(_0xde59('0xa'));var fs=require('fs');var _=require(_0xde59('0xb'));var squel=require(_0xde59('0xc'));var crypto=require(_0xde59('0xd'));var jsforce=require(_0xde59('0xe'));var deskjs=require(_0xde59('0xf'));var toCsv=require(_0xde59('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var qs=require(_0xde59('0x10'));var logger=require(_0xde59('0x11'))(_0xde59('0x12'));var utils=require(_0xde59('0x13'));var config=require(_0xde59('0x14'));var db=require(_0xde59('0x15'))['db'];function respondWithStatusCode(_0x20a2dc,_0x3a8574){_0x3a8574=_0x3a8574||0xcc;return function(_0x3015ea){if(_0x3015ea){return _0x20a2dc['sendStatus'](_0x3a8574);}return _0x20a2dc[_0xde59('0x16')](_0x3a8574)[_0xde59('0x17')]();};}function respondWithResult(_0x5c85ab,_0x2f9187){_0x2f9187=_0x2f9187||0xc8;return function(_0x22f3d1){if(_0x22f3d1){return _0x5c85ab[_0xde59('0x16')](_0x2f9187)['json'](_0x22f3d1);}};}function respondWithFilteredResult(_0x4b64d2,_0x21a58c){return function(_0x16f890){if(_0x16f890){var _0x521b82=_0x16f890[_0xde59('0x18')],_0x2f563d=_0x21a58c['offset'],_0x3b58d0=_0x21a58c[_0xde59('0x19')]+_0x21a58c['limit'],_0x241c73;if(_0x3b58d0>=_0x521b82){_0x3b58d0=_0x521b82;_0x241c73=0xc8;}else{_0x241c73=0xce;}_0x4b64d2[_0xde59('0x16')](_0x241c73);return _0x4b64d2[_0xde59('0x1a')](_0xde59('0x1b'),_0x2f563d+'-'+_0x3b58d0+'/'+_0x521b82)['json'](_0x16f890);}return null;};}function patchUpdates(_0x5095f5){return function(_0x3d3f22){try{jsonpatch[_0xde59('0x1c')](_0x3d3f22,_0x5095f5,!![]);}catch(_0x50ac1a){return BPromise[_0xde59('0x1d')](_0x50ac1a);}return _0x3d3f22[_0xde59('0x1e')]();};}function saveUpdates(_0x4b55db,_0x46d3a4){return function(_0x4b1b2a){if(_0x4b1b2a){return _0x4b1b2a[_0xde59('0x1f')](_0x4b55db)[_0xde59('0x20')](function(_0x497a02){return _0x497a02;});}return null;};}function removeEntity(_0x17059a,_0x33b7f8){return function(_0x551a6a){if(_0x551a6a){return _0x551a6a[_0xde59('0x21')]()[_0xde59('0x20')](function(){_0x17059a[_0xde59('0x16')](0xcc)[_0xde59('0x17')]();});}};}function handleEntityNotFound(_0xd355b5,_0x1c6ad5){return function(_0x52d95c){if(!_0x52d95c){_0xd355b5[_0xde59('0x22')](0x194);}return _0x52d95c;};}function handleError(_0x4d5c53,_0x344f1d){_0x344f1d=_0x344f1d||0x1f4;return function(_0x5aaf65){logger['error'](_0x5aaf65[_0xde59('0x23')]);if(_0x5aaf65[_0xde59('0x24')]){delete _0x5aaf65[_0xde59('0x24')];}_0x4d5c53[_0xde59('0x16')](_0x344f1d)[_0xde59('0x25')](_0x5aaf65);};}exports[_0xde59('0x26')]=function(_0x2b2a68,_0xbe76c6){var _0x2ca468={},_0x1ee4d9={},_0x49466b={'count':0x0,'rows':[]};var _0x511a08=db[_0xde59('0x27')]['rawAttributes'];_0x1ee4d9[_0xde59('0x28')]=_[_0xde59('0x29')](_0x511a08);var _0x2d38c1={'dateStart':_0x2b2a68[_0xde59('0x2a')][_0xde59('0x2b')],'dateEnd':_0x2b2a68[_0xde59('0x2a')][_0xde59('0x2c')]};delete _0x2b2a68[_0xde59('0x2a')][_0xde59('0x2b')];delete _0x2b2a68[_0xde59('0x2a')][_0xde59('0x2c')];_0x1ee4d9[_0xde59('0x2a')]=_['keys'](_0x2b2a68[_0xde59('0x2a')]);_0x1ee4d9[_0xde59('0x2d')]=_['intersection'](_0x1ee4d9[_0xde59('0x28')],_0x1ee4d9['query']);_0x2ca468[_0xde59('0x2e')]=_[_0xde59('0x2f')](_0x1ee4d9[_0xde59('0x28')],qs[_0xde59('0x30')](_0x2b2a68[_0xde59('0x2a')]['fields']));_0x2ca468[_0xde59('0x2e')]=_0x2ca468[_0xde59('0x2e')][_0xde59('0x31')]?_0x2ca468[_0xde59('0x2e')]:_0x1ee4d9[_0xde59('0x28')];if(!_0x2b2a68[_0xde59('0x2a')]['hasOwnProperty'](_0xde59('0x32'))){_0x2ca468[_0xde59('0x33')]=qs[_0xde59('0x33')](_0x2b2a68[_0xde59('0x2a')]['limit']);_0x2ca468[_0xde59('0x19')]=qs[_0xde59('0x19')](_0x2b2a68[_0xde59('0x2a')][_0xde59('0x19')]);}_0x2ca468[_0xde59('0x34')]=qs[_0xde59('0x35')](_0x2b2a68[_0xde59('0x2a')][_0xde59('0x35')]);_0x2ca468[_0xde59('0x36')]=qs[_0xde59('0x2d')](_[_0xde59('0x37')](_0x2b2a68[_0xde59('0x2a')],_0x1ee4d9[_0xde59('0x2d')]));if(_0x2d38c1['dateStart']){if(_0x2d38c1[_0xde59('0x2c')]){_0x2d38c1[_0xde59('0x2c')]=moment(_0x2d38c1[_0xde59('0x2c')])[_0xde59('0x38')](0x1,'day');}else{_0x2d38c1[_0xde59('0x2c')]=moment(_0x2d38c1[_0xde59('0x2b')])[_0xde59('0x38')](0x1,_0xde59('0x39'));}_[_0xde59('0x3a')](_0x2ca468[_0xde59('0x36')],{'createdAt':{'$gte':_0x2d38c1[_0xde59('0x2b')],'$lte':_0x2d38c1[_0xde59('0x2c')]}});}if(_0x2b2a68[_0xde59('0x2a')]['filter']){_0x2ca468[_0xde59('0x36')]=_[_0xde59('0x3a')](_0x2ca468[_0xde59('0x36')],{'$or':_[_0xde59('0x3b')](_0x2ca468[_0xde59('0x2e')],function(_0x1c9467){var _0x1528a2={};_0x1528a2[_0x1c9467]={'$like':'%'+_0x2b2a68[_0xde59('0x2a')][_0xde59('0x3c')]+'%'};return _0x1528a2;})});}_0x2ca468=_['merge']({},_0x2ca468,_0x2b2a68[_0xde59('0x3d')]);var _0x3bd61d={'where':_0x2ca468['where']};return db[_0xde59('0x27')][_0xde59('0x18')](_0x3bd61d)[_0xde59('0x20')](function(_0x5dae11){_0x49466b[_0xde59('0x18')]=_0x5dae11;if(_0x2b2a68[_0xde59('0x2a')][_0xde59('0x3e')]){_0x2ca468[_0xde59('0x3f')]=[{'all':!![]}];}return db[_0xde59('0x27')][_0xde59('0x40')](_0x2ca468);})['then'](function(_0x310910){_0x49466b[_0xde59('0x41')]=_0x310910;return _0x49466b;})[_0xde59('0x20')](respondWithFilteredResult(_0xbe76c6,_0x2ca468))[_0xde59('0x42')](handleError(_0xbe76c6,null));};exports[_0xde59('0x43')]=function(_0xdca676,_0x537cd1){var _0xab5682={'raw':!![],'where':{'id':_0xdca676[_0xde59('0x44')]['id']}},_0x333b7f={};_0x333b7f[_0xde59('0x28')]=_[_0xde59('0x29')](db[_0xde59('0x27')][_0xde59('0x45')]);_0x333b7f[_0xde59('0x2a')]=_[_0xde59('0x29')](_0xdca676[_0xde59('0x2a')]);_0x333b7f[_0xde59('0x2d')]=_[_0xde59('0x2f')](_0x333b7f[_0xde59('0x28')],_0x333b7f[_0xde59('0x2a')]);_0xab5682[_0xde59('0x2e')]=_['intersection'](_0x333b7f[_0xde59('0x28')],qs[_0xde59('0x30')](_0xdca676[_0xde59('0x2a')][_0xde59('0x30')]));_0xab5682[_0xde59('0x2e')]=_0xab5682[_0xde59('0x2e')][_0xde59('0x31')]?_0xab5682['attributes']:_0x333b7f[_0xde59('0x28')];if(_0xdca676['query'][_0xde59('0x3e')]){_0xab5682[_0xde59('0x3f')]=[{'all':!![]}];}_0xab5682=_[_0xde59('0x3a')]({},_0xab5682,_0xdca676[_0xde59('0x3d')]);return db[_0xde59('0x27')]['find'](_0xab5682)[_0xde59('0x20')](handleEntityNotFound(_0x537cd1,null))['then'](respondWithResult(_0x537cd1,null))[_0xde59('0x42')](handleError(_0x537cd1,null));};exports[_0xde59('0x46')]=function(_0x48f252,_0x23d6b6){return db[_0xde59('0x27')][_0xde59('0x46')](_0x48f252[_0xde59('0x47')],{})[_0xde59('0x20')](respondWithResult(_0x23d6b6,0xc9))['catch'](handleError(_0x23d6b6,null));};exports[_0xde59('0x1f')]=function(_0x504578,_0x57f8b9){if(_0x504578[_0xde59('0x47')]['id']){delete _0x504578[_0xde59('0x47')]['id'];}return db['ChatQueueReport'][_0xde59('0x48')]({'where':{'id':_0x504578[_0xde59('0x44')]['id']}})[_0xde59('0x20')](handleEntityNotFound(_0x57f8b9,null))[_0xde59('0x20')](saveUpdates(_0x504578[_0xde59('0x47')],null))[_0xde59('0x20')](respondWithResult(_0x57f8b9,null))['catch'](handleError(_0x57f8b9,null));};exports[_0xde59('0x21')]=function(_0x2b671a,_0x49ae33){return db[_0xde59('0x27')][_0xde59('0x48')]({'where':{'id':_0x2b671a[_0xde59('0x44')]['id']}})[_0xde59('0x20')](handleEntityNotFound(_0x49ae33,null))[_0xde59('0x20')](removeEntity(_0x49ae33,null))[_0xde59('0x42')](handleError(_0x49ae33,null));};exports['describe']=function(_0x3d2c50,_0x4b76b1){return db[_0xde59('0x27')]['describe']()[_0xde59('0x20')](respondWithResult(_0x4b76b1,null))[_0xde59('0x42')](handleError(_0x4b76b1,null));}; \ No newline at end of file +var _0x8be6=['mustache','util','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','ChatQueueReport','rawAttributes','model','keys','dateStart','query','dateEnd','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','add','day','merge','filter','map','options','count','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','describe','html-pdf','eml-format','request-promise','moment','bluebird'];(function(_0x16447a,_0x2ae260){var _0x4ed290=function(_0x2288a2){while(--_0x2288a2){_0x16447a['push'](_0x16447a['shift']());}};_0x4ed290(++_0x2ae260);}(_0x8be6,0x11f));var _0x68be=function(_0x65fe8e,_0x59657e){_0x65fe8e=_0x65fe8e-0x0;var _0x204e65=_0x8be6[_0x65fe8e];return _0x204e65;};'use strict';var pdf=require(_0x68be('0x0'));var emlformat=require(_0x68be('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x68be('0x2'));var moment=require(_0x68be('0x3'));var BPromise=require(_0x68be('0x4'));var Mustache=require(_0x68be('0x5'));var util=require(_0x68be('0x6'));var path=require('path');var sox=require(_0x68be('0x7'));var csv=require(_0x68be('0x8'));var ejs=require(_0x68be('0x9'));var fs=require('fs');var _=require(_0x68be('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x68be('0xb'));var toCsv=require(_0x68be('0x8'));var querystring=require(_0x68be('0xc'));var Papa=require(_0x68be('0xd'));var Redis=require(_0x68be('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0x68be('0xf'))(_0x68be('0x10'));var utils=require(_0x68be('0x11'));var config=require(_0x68be('0x12'));var db=require(_0x68be('0x13'))['db'];function respondWithStatusCode(_0x455d26,_0x5442cc){_0x5442cc=_0x5442cc||0xcc;return function(_0x3fdda9){if(_0x3fdda9){return _0x455d26[_0x68be('0x14')](_0x5442cc);}return _0x455d26[_0x68be('0x15')](_0x5442cc)[_0x68be('0x16')]();};}function respondWithResult(_0x14bbfb,_0x3e2163){_0x3e2163=_0x3e2163||0xc8;return function(_0x5d1a85){if(_0x5d1a85){return _0x14bbfb[_0x68be('0x15')](_0x3e2163)[_0x68be('0x17')](_0x5d1a85);}};}function respondWithFilteredResult(_0x458769,_0x239808){return function(_0x36dd65){if(_0x36dd65){var _0x3d856d=_0x36dd65['count'],_0x56a181=_0x239808[_0x68be('0x18')],_0x3bef7d=_0x239808[_0x68be('0x18')]+_0x239808[_0x68be('0x19')],_0x42b3a9;if(_0x3bef7d>=_0x3d856d){_0x3bef7d=_0x3d856d;_0x42b3a9=0xc8;}else{_0x42b3a9=0xce;}_0x458769[_0x68be('0x15')](_0x42b3a9);return _0x458769[_0x68be('0x1a')](_0x68be('0x1b'),_0x56a181+'-'+_0x3bef7d+'/'+_0x3d856d)[_0x68be('0x17')](_0x36dd65);}return null;};}function patchUpdates(_0x35c7ba){return function(_0x42855a){try{jsonpatch[_0x68be('0x1c')](_0x42855a,_0x35c7ba,!![]);}catch(_0x5c8448){return BPromise[_0x68be('0x1d')](_0x5c8448);}return _0x42855a[_0x68be('0x1e')]();};}function saveUpdates(_0x44a6f8,_0x5d5fc6){return function(_0x232bc7){if(_0x232bc7){return _0x232bc7[_0x68be('0x1f')](_0x44a6f8)[_0x68be('0x20')](function(_0x6ae02){return _0x6ae02;});}return null;};}function removeEntity(_0x564ab3,_0x2d4c8d){return function(_0x46ba4d){if(_0x46ba4d){return _0x46ba4d[_0x68be('0x21')]()['then'](function(){_0x564ab3[_0x68be('0x15')](0xcc)[_0x68be('0x16')]();});}};}function handleEntityNotFound(_0x55bce4,_0x351e92){return function(_0xd3a216){if(!_0xd3a216){_0x55bce4[_0x68be('0x14')](0x194);}return _0xd3a216;};}function handleError(_0x367b33,_0x5d9390){_0x5d9390=_0x5d9390||0x1f4;return function(_0x557396){logger[_0x68be('0x22')](_0x557396[_0x68be('0x23')]);if(_0x557396[_0x68be('0x24')]){delete _0x557396[_0x68be('0x24')];}_0x367b33[_0x68be('0x15')](_0x5d9390)['send'](_0x557396);};}exports[_0x68be('0x25')]=function(_0x50f8f1,_0x1defee){var _0x403dc8={},_0x27a981={},_0x1e3368={'count':0x0,'rows':[]};var _0x410bb8=db[_0x68be('0x26')][_0x68be('0x27')];_0x27a981[_0x68be('0x28')]=_[_0x68be('0x29')](_0x410bb8);var _0x3ace07={'dateStart':_0x50f8f1['query'][_0x68be('0x2a')],'dateEnd':_0x50f8f1[_0x68be('0x2b')][_0x68be('0x2c')]};delete _0x50f8f1[_0x68be('0x2b')][_0x68be('0x2a')];delete _0x50f8f1[_0x68be('0x2b')][_0x68be('0x2c')];_0x27a981['query']=_[_0x68be('0x29')](_0x50f8f1[_0x68be('0x2b')]);_0x27a981[_0x68be('0x2d')]=_[_0x68be('0x2e')](_0x27a981['model'],_0x27a981[_0x68be('0x2b')]);_0x403dc8['attributes']=_[_0x68be('0x2e')](_0x27a981[_0x68be('0x28')],qs[_0x68be('0x2f')](_0x50f8f1[_0x68be('0x2b')][_0x68be('0x2f')]));_0x403dc8['attributes']=_0x403dc8['attributes']['length']?_0x403dc8[_0x68be('0x30')]:_0x27a981['model'];if(!_0x50f8f1[_0x68be('0x2b')][_0x68be('0x31')]('nolimit')){_0x403dc8[_0x68be('0x19')]=qs[_0x68be('0x19')](_0x50f8f1[_0x68be('0x2b')][_0x68be('0x19')]);_0x403dc8[_0x68be('0x18')]=qs[_0x68be('0x18')](_0x50f8f1[_0x68be('0x2b')][_0x68be('0x18')]);}_0x403dc8[_0x68be('0x32')]=qs['sort'](_0x50f8f1[_0x68be('0x2b')][_0x68be('0x33')]);_0x403dc8[_0x68be('0x34')]=qs[_0x68be('0x2d')](_[_0x68be('0x35')](_0x50f8f1[_0x68be('0x2b')],_0x27a981['filters']));if(_0x3ace07[_0x68be('0x2a')]){if(_0x3ace07['dateEnd']){_0x3ace07[_0x68be('0x2c')]=moment(_0x3ace07[_0x68be('0x2c')])[_0x68be('0x36')](0x1,_0x68be('0x37'));}else{_0x3ace07[_0x68be('0x2c')]=moment(_0x3ace07[_0x68be('0x2a')])['add'](0x1,_0x68be('0x37'));}_[_0x68be('0x38')](_0x403dc8[_0x68be('0x34')],{'createdAt':{'$gte':_0x3ace07[_0x68be('0x2a')],'$lte':_0x3ace07['dateEnd']}});}if(_0x50f8f1[_0x68be('0x2b')][_0x68be('0x39')]){_0x403dc8['where']=_[_0x68be('0x38')](_0x403dc8[_0x68be('0x34')],{'$or':_[_0x68be('0x3a')](_0x403dc8['attributes'],function(_0x53e339){var _0x2d08d1={};_0x2d08d1[_0x53e339]={'$like':'%'+_0x50f8f1['query']['filter']+'%'};return _0x2d08d1;})});}_0x403dc8=_[_0x68be('0x38')]({},_0x403dc8,_0x50f8f1[_0x68be('0x3b')]);var _0x2b0ab3={'where':_0x403dc8[_0x68be('0x34')]};return db[_0x68be('0x26')][_0x68be('0x3c')](_0x2b0ab3)[_0x68be('0x20')](function(_0x38866e){_0x1e3368[_0x68be('0x3c')]=_0x38866e;if(_0x50f8f1['query'][_0x68be('0x3d')]){_0x403dc8['include']=[{'all':!![]}];}return db[_0x68be('0x26')][_0x68be('0x3e')](_0x403dc8);})[_0x68be('0x20')](function(_0x52d407){_0x1e3368[_0x68be('0x3f')]=_0x52d407;return _0x1e3368;})[_0x68be('0x20')](respondWithFilteredResult(_0x1defee,_0x403dc8))[_0x68be('0x40')](handleError(_0x1defee,null));};exports[_0x68be('0x41')]=function(_0x6b8b0,_0x13f2a2){var _0x3cc6d3={'raw':!![],'where':{'id':_0x6b8b0[_0x68be('0x42')]['id']}},_0x3be460={};_0x3be460[_0x68be('0x28')]=_[_0x68be('0x29')](db[_0x68be('0x26')]['rawAttributes']);_0x3be460[_0x68be('0x2b')]=_[_0x68be('0x29')](_0x6b8b0[_0x68be('0x2b')]);_0x3be460[_0x68be('0x2d')]=_[_0x68be('0x2e')](_0x3be460[_0x68be('0x28')],_0x3be460[_0x68be('0x2b')]);_0x3cc6d3[_0x68be('0x30')]=_[_0x68be('0x2e')](_0x3be460[_0x68be('0x28')],qs[_0x68be('0x2f')](_0x6b8b0[_0x68be('0x2b')][_0x68be('0x2f')]));_0x3cc6d3['attributes']=_0x3cc6d3[_0x68be('0x30')][_0x68be('0x43')]?_0x3cc6d3['attributes']:_0x3be460[_0x68be('0x28')];if(_0x6b8b0[_0x68be('0x2b')][_0x68be('0x3d')]){_0x3cc6d3[_0x68be('0x44')]=[{'all':!![]}];}_0x3cc6d3=_[_0x68be('0x38')]({},_0x3cc6d3,_0x6b8b0[_0x68be('0x3b')]);return db[_0x68be('0x26')][_0x68be('0x45')](_0x3cc6d3)[_0x68be('0x20')](handleEntityNotFound(_0x13f2a2,null))['then'](respondWithResult(_0x13f2a2,null))[_0x68be('0x40')](handleError(_0x13f2a2,null));};exports[_0x68be('0x46')]=function(_0x4661cf,_0x1df9ca){return db[_0x68be('0x26')][_0x68be('0x46')](_0x4661cf[_0x68be('0x47')],{})[_0x68be('0x20')](respondWithResult(_0x1df9ca,0xc9))[_0x68be('0x40')](handleError(_0x1df9ca,null));};exports['update']=function(_0x2a05a4,_0x266fcf){if(_0x2a05a4[_0x68be('0x47')]['id']){delete _0x2a05a4[_0x68be('0x47')]['id'];}return db[_0x68be('0x26')][_0x68be('0x45')]({'where':{'id':_0x2a05a4[_0x68be('0x42')]['id']}})[_0x68be('0x20')](handleEntityNotFound(_0x266fcf,null))[_0x68be('0x20')](saveUpdates(_0x2a05a4['body'],null))[_0x68be('0x20')](respondWithResult(_0x266fcf,null))[_0x68be('0x40')](handleError(_0x266fcf,null));};exports[_0x68be('0x21')]=function(_0x2e7bf4,_0x8cc0de){return db['ChatQueueReport'][_0x68be('0x45')]({'where':{'id':_0x2e7bf4['params']['id']}})[_0x68be('0x20')](handleEntityNotFound(_0x8cc0de,null))['then'](removeEntity(_0x8cc0de,null))[_0x68be('0x40')](handleError(_0x8cc0de,null));};exports[_0x68be('0x48')]=function(_0x569245,_0x269cbe){return db[_0x68be('0x26')]['describe']()[_0x68be('0x20')](respondWithResult(_0x269cbe,null))[_0x68be('0x40')](handleError(_0x269cbe,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index a96c3f7..ea5b247 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 _0x55ca=['request-promise','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util','bluebird'];(function(_0x32b993,_0x1c5989){var _0x482780=function(_0x404179){while(--_0x404179){_0x32b993['push'](_0x32b993['shift']());}};_0x482780(++_0x1c5989);}(_0x55ca,0x126));var _0xa55c=function(_0x671369,_0x433da5){_0x671369=_0x671369-0x0;var _0x33f2b4=_0x55ca[_0x671369];return _0x33f2b4;};'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 attributes=require('./chatQueueReport.attributes');module[_0xa55c('0x4')]=function(_0x2db02a,_0xcb02e3){return _0x2db02a[_0xa55c('0x5')](_0xa55c('0x6'),attributes,{'tableName':_0xa55c('0x7'),'paranoid':![],'indexes':[{'name':_0xa55c('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['ChatQueueReport','report_chat_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','./chatQueueReport.attributes','exports','define'];(function(_0x345b70,_0x4dc245){var _0x23068c=function(_0x2ed4c7){while(--_0x2ed4c7){_0x345b70['push'](_0x345b70['shift']());}};_0x23068c(++_0x4dc245);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var attributes=require(_0x7995('0x6'));module[_0x7995('0x7')]=function(_0x576d89,_0x744bea){return _0x576d89[_0x7995('0x8')](_0x7995('0x9'),attributes,{'tableName':_0x7995('0xa'),'paranoid':![],'indexes':[{'name':_0x7995('0xb'),'fields':[_0x7995('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 41e3e77..1580bac 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 _0x52b3=['debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatQueueReport,\x20%s,\x20%s','info','result','CreateChatQueueReport','ChatQueueReport','body','options','catch','UpdateChatQueueReport','raw','where','attributes','limit','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','request\x20sent'];(function(_0x17b98b,_0x382995){var _0x59513f=function(_0x2c8d88){while(--_0x2c8d88){_0x17b98b['push'](_0x17b98b['shift']());}};_0x59513f(++_0x382995);}(_0x52b3,0x1f3));var _0x352b=function(_0x9b37c,_0x28c3e8){_0x9b37c=_0x9b37c-0x0;var _0x44c47b=_0x52b3[_0x9b37c];return _0x44c47b;};'use strict';var _=require('lodash');var util=require(_0x352b('0x0'));var moment=require('moment');var BPromise=require(_0x352b('0x1'));var rs=require(_0x352b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x352b('0x3'));var logger=require(_0x352b('0x4'))('rpc');var config=require(_0x352b('0x5'));var jayson=require(_0x352b('0x6'));var client=jayson[_0x352b('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16d4cc,_0x40a5c8,_0x1b51e6){return new BPromise(function(_0x24e525,_0xccad5f){return client[_0x352b('0x8')](_0x16d4cc,_0x1b51e6)[_0x352b('0x9')](function(_0x169c60){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x40a5c8,_0x352b('0xa'));logger[_0x352b('0xb')](_0x352b('0xc'),_0x40a5c8,_0x352b('0xa'),JSON[_0x352b('0xd')](_0x169c60));if(_0x169c60[_0x352b('0xe')]){if(_0x169c60[_0x352b('0xe')][_0x352b('0xf')]===0x1f4){logger[_0x352b('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x40a5c8,_0x169c60['error'][_0x352b('0x10')]);return _0xccad5f(_0x169c60['error'][_0x352b('0x10')]);}logger['error'](_0x352b('0x11'),_0x40a5c8,_0x169c60[_0x352b('0xe')][_0x352b('0x10')]);return _0x24e525(_0x169c60[_0x352b('0xe')]['message']);}else{logger[_0x352b('0x12')](_0x352b('0x11'),_0x40a5c8,'request\x20sent');_0x24e525(_0x169c60[_0x352b('0x13')][_0x352b('0x10')]);}})['catch'](function(_0x2cbda9){logger[_0x352b('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x40a5c8,_0x2cbda9);_0xccad5f(_0x2cbda9);});});}exports[_0x352b('0x14')]=function(_0x1cca8a){var _0x233769=this;return new Promise(function(_0x4bfa18,_0x16e396){return db[_0x352b('0x15')]['create'](_0x1cca8a[_0x352b('0x16')],{'raw':_0x1cca8a[_0x352b('0x17')]?_0x1cca8a[_0x352b('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x352b('0x9')](function(_0x2cc820){logger[_0x352b('0x12')](_0x352b('0x14'),_0x1cca8a);logger[_0x352b('0xb')](_0x352b('0x14'),_0x1cca8a,JSON[_0x352b('0xd')](_0x2cc820));_0x4bfa18(_0x2cc820);})[_0x352b('0x18')](function(_0x12c3f3){logger[_0x352b('0xe')]('CreateChatQueueReport',_0x12c3f3['message'],_0x1cca8a);_0x16e396(_0x233769[_0x352b('0xe')](0x1f4,_0x12c3f3[_0x352b('0x10')]));});});};exports[_0x352b('0x19')]=function(_0x577475){var _0x4ea9bf=this;return new Promise(function(_0xa7684f,_0x2b6faf){return db[_0x352b('0x15')]['update'](_0x577475['body'],{'raw':_0x577475[_0x352b('0x17')]?_0x577475[_0x352b('0x17')][_0x352b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x577475[_0x352b('0x17')]?_0x577475['options'][_0x352b('0x1b')]||null:null,'attributes':_0x577475['options']?_0x577475[_0x352b('0x17')][_0x352b('0x1c')]||null:null,'limit':_0x577475[_0x352b('0x17')]?_0x577475['options'][_0x352b('0x1d')]||null:null})[_0x352b('0x9')](function(_0x46fe58){logger[_0x352b('0x12')](_0x352b('0x19'),_0x577475);logger[_0x352b('0xb')](_0x352b('0x19'),_0x577475,JSON[_0x352b('0xd')](_0x46fe58));_0xa7684f(_0x46fe58);})[_0x352b('0x18')](function(_0x408bb9){logger[_0x352b('0xe')](_0x352b('0x19'),_0x408bb9['message'],_0x577475);_0x2b6faf(_0x4ea9bf[_0x352b('0xe')](0x1f4,_0x408bb9['message']));});});}; \ No newline at end of file +var _0x3b20=['result','message','CreateChatQueueReport','ChatQueueReport','body','options','raw','debug','catch','UpdateChatQueueReport','update','where','attributes','then','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ChatQueueReport,\x20%s,\x20%s','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x20b29c,_0xe22528){var _0x20d81b=function(_0xd63a71){while(--_0xd63a71){_0x20b29c['push'](_0x20b29c['shift']());}};_0x20d81b(++_0xe22528);}(_0x3b20,0x10e));var _0x03b2=function(_0xd382ae,_0x1f7b33){_0xd382ae=_0xd382ae-0x0;var _0x2fa1ef=_0x3b20[_0xd382ae];return _0x2fa1ef;};'use strict';var _=require(_0x03b2('0x0'));var util=require(_0x03b2('0x1'));var moment=require('moment');var BPromise=require(_0x03b2('0x2'));var rs=require(_0x03b2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x03b2('0x4'))['db'];var utils=require(_0x03b2('0x5'));var logger=require(_0x03b2('0x6'))(_0x03b2('0x7'));var config=require(_0x03b2('0x8'));var jayson=require(_0x03b2('0x9'));var client=jayson[_0x03b2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f25cf,_0x1ac0a2,_0xbae2af){return new BPromise(function(_0x59d84,_0x7db437){return client[_0x03b2('0xb')](_0x2f25cf,_0xbae2af)['then'](function(_0x78ea00){logger[_0x03b2('0xc')](_0x03b2('0xd'),_0x1ac0a2,'request\x20sent');logger['debug'](_0x03b2('0xe'),_0x1ac0a2,_0x03b2('0xf'),JSON[_0x03b2('0x10')](_0x78ea00));if(_0x78ea00[_0x03b2('0x11')]){if(_0x78ea00[_0x03b2('0x11')]['code']===0x1f4){logger[_0x03b2('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x1ac0a2,_0x78ea00[_0x03b2('0x11')]['message']);return _0x7db437(_0x78ea00[_0x03b2('0x11')]['message']);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x1ac0a2,_0x78ea00[_0x03b2('0x11')]['message']);return _0x59d84(_0x78ea00[_0x03b2('0x11')]['message']);}else{logger[_0x03b2('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0x1ac0a2,_0x03b2('0xf'));_0x59d84(_0x78ea00[_0x03b2('0x12')][_0x03b2('0x13')]);}})['catch'](function(_0x25ed86){logger['error'](_0x03b2('0xd'),_0x1ac0a2,_0x25ed86);_0x7db437(_0x25ed86);});});}exports[_0x03b2('0x14')]=function(_0x27974a){var _0x386667=this;return new Promise(function(_0xc88f1a,_0x52c563){return db[_0x03b2('0x15')]['create'](_0x27974a[_0x03b2('0x16')],{'raw':_0x27974a[_0x03b2('0x17')]?_0x27974a[_0x03b2('0x17')][_0x03b2('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x5eb04c){logger['info'](_0x03b2('0x14'),_0x27974a);logger[_0x03b2('0x19')]('CreateChatQueueReport',_0x27974a,JSON[_0x03b2('0x10')](_0x5eb04c));_0xc88f1a(_0x5eb04c);})[_0x03b2('0x1a')](function(_0x3566cb){logger['error'](_0x03b2('0x14'),_0x3566cb[_0x03b2('0x13')],_0x27974a);_0x52c563(_0x386667['error'](0x1f4,_0x3566cb[_0x03b2('0x13')]));});});};exports[_0x03b2('0x1b')]=function(_0x1f20cf){var _0xd29ae4=this;return new Promise(function(_0x204212,_0x2f65f0){return db[_0x03b2('0x15')][_0x03b2('0x1c')](_0x1f20cf[_0x03b2('0x16')],{'raw':_0x1f20cf[_0x03b2('0x17')]?_0x1f20cf[_0x03b2('0x17')][_0x03b2('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f20cf[_0x03b2('0x17')]?_0x1f20cf['options'][_0x03b2('0x1d')]||null:null,'attributes':_0x1f20cf[_0x03b2('0x17')]?_0x1f20cf[_0x03b2('0x17')][_0x03b2('0x1e')]||null:null,'limit':_0x1f20cf[_0x03b2('0x17')]?_0x1f20cf['options']['limit']||null:null})[_0x03b2('0x1f')](function(_0x2f6392){logger['info'](_0x03b2('0x1b'),_0x1f20cf);logger[_0x03b2('0x19')](_0x03b2('0x1b'),_0x1f20cf,JSON[_0x03b2('0x10')](_0x2f6392));_0x204212(_0x2f6392);})[_0x03b2('0x1a')](function(_0x59bc5a){logger[_0x03b2('0x11')](_0x03b2('0x1b'),_0x59bc5a[_0x03b2('0x13')],_0x1f20cf);_0x2f65f0(_0xd29ae4['error'](0x1f4,_0x59bc5a[_0x03b2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 5e63a93..4296a20 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 _0x62b4=['delete','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','update'];(function(_0x4c5bb1,_0x214355){var _0xb42016=function(_0x572376){while(--_0x572376){_0x4c5bb1['push'](_0x4c5bb1['shift']());}};_0xb42016(++_0x214355);}(_0x62b4,0xd3));var _0x462b=function(_0x5a26db,_0x2c5ccd){_0x5a26db=_0x5a26db-0x0;var _0x4619dd=_0x62b4[_0x5a26db];return _0x4619dd;};'use strict';var multer=require('multer');var util=require(_0x462b('0x0'));var path=require('path');var timeout=require(_0x462b('0x1'));var express=require(_0x462b('0x2'));var router=express['Router']();var auth=require(_0x462b('0x3'));var interaction=require(_0x462b('0x4'));var config=require(_0x462b('0x5'));var controller=require(_0x462b('0x6'));router[_0x462b('0x7')]('/',auth['isAuthenticated'](),controller[_0x462b('0x8')]);router[_0x462b('0x7')](_0x462b('0x9'),auth[_0x462b('0xa')](),controller[_0x462b('0xb')]);router[_0x462b('0x7')](_0x462b('0xc'),auth['isAuthenticated'](),controller[_0x462b('0xd')]);router[_0x462b('0xe')]('/',auth[_0x462b('0xa')](),controller['create']);router[_0x462b('0xf')](_0x462b('0xc'),auth['isAuthenticated'](),controller[_0x462b('0x10')]);router[_0x462b('0x11')]('/:id',auth[_0x462b('0xa')](),controller['destroy']);module[_0x462b('0x12')]=router; \ No newline at end of file +var _0x6d25=['put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x1e4150,_0x55b02a){var _0x1ce3ee=function(_0x59324e){while(--_0x59324e){_0x1e4150['push'](_0x1e4150['shift']());}};_0x1ce3ee(++_0x55b02a);}(_0x6d25,0x82));var _0x56d2=function(_0x18e14f,_0xf674e4){_0x18e14f=_0x18e14f-0x0;var _0x4957de=_0x6d25[_0x18e14f];return _0x4957de;};'use strict';var multer=require(_0x56d2('0x0'));var util=require(_0x56d2('0x1'));var path=require(_0x56d2('0x2'));var timeout=require(_0x56d2('0x3'));var express=require(_0x56d2('0x4'));var router=express[_0x56d2('0x5')]();var auth=require(_0x56d2('0x6'));var interaction=require(_0x56d2('0x7'));var config=require(_0x56d2('0x8'));var controller=require(_0x56d2('0x9'));router[_0x56d2('0xa')]('/',auth[_0x56d2('0xb')](),controller[_0x56d2('0xc')]);router[_0x56d2('0xa')](_0x56d2('0xd'),auth[_0x56d2('0xb')](),controller[_0x56d2('0xe')]);router[_0x56d2('0xa')](_0x56d2('0xf'),auth['isAuthenticated'](),controller[_0x56d2('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x56d2('0x11')](_0x56d2('0xf'),auth[_0x56d2('0xb')](),controller[_0x56d2('0x12')]);router[_0x56d2('0x13')](_0x56d2('0xf'),auth['isAuthenticated'](),controller[_0x56d2('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 6ae7fce..6cc266d 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 _0xf757=['queue','sequelize','STRING','ENUM','agent'];(function(_0xe551d5,_0x568ded){var _0xb60f69=function(_0x3d4722){while(--_0x3d4722){_0xe551d5['push'](_0xe551d5['shift']());}};_0xb60f69(++_0x568ded);}(_0xf757,0x178));var _0x7f75=function(_0x4ac60a,_0x503a99){_0x4ac60a=_0x4ac60a-0x0;var _0x4b22e8=_0xf757[_0x4ac60a];return _0x4b22e8;};'use strict';var moment=require('moment');var Sequelize=require(_0x7f75('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7f75('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x7f75('0x2')]('account',_0x7f75('0x3'),_0x7f75('0x4')),'allowNull':![],'defaultValue':_0x7f75('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xbb13=['ENUM','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xbb13,0xd4));var _0x3bb1=function(_0x47fc47,_0x448b5b){_0x47fc47=_0x47fc47-0x0;var _0x14ae0f=_0xbb13[_0x47fc47];return _0x14ae0f;};'use strict';var moment=require(_0x3bb1('0x0'));var Sequelize=require(_0x3bb1('0x1'));module[_0x3bb1('0x2')]={'uniqueid':{'type':Sequelize[_0x3bb1('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x3bb1('0x4')]('account','agent',_0x3bb1('0x5')),'allowNull':![],'defaultValue':_0x3bb1('0x5')},'transferredAt':{'type':Sequelize[_0x3bb1('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x3bb1('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 2149cd2..27431ca 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 _0xc810=['json','count','offset','limit','set','apply','reject','save','then','destroy','sendStatus','error','name','send','index','ChatTransferReport','model','keys','dateStart','query','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','add','day','merge','where','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','catch','create','body','update','describe','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','api','../../config/utils','../../config/environment','status','end'];(function(_0x390892,_0x4be772){var _0x55c17a=function(_0x4446e6){while(--_0x4446e6){_0x390892['push'](_0x390892['shift']());}};_0x55c17a(++_0x4be772);}(_0xc810,0x1d9));var _0x0c81=function(_0x4c37b3,_0x44c1f5){_0x4c37b3=_0x4c37b3-0x0;var _0x142279=_0xc810[_0x4c37b3];return _0x142279;};'use strict';var pdf=require(_0x0c81('0x0'));var emlformat=require(_0x0c81('0x1'));var rimraf=require(_0x0c81('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c81('0x3'));var rp=require('request-promise');var moment=require(_0x0c81('0x4'));var BPromise=require(_0x0c81('0x5'));var Mustache=require(_0x0c81('0x6'));var util=require(_0x0c81('0x7'));var path=require(_0x0c81('0x8'));var sox=require(_0x0c81('0x9'));var csv=require('to-csv');var ejs=require(_0x0c81('0xa'));var fs=require('fs');var _=require(_0x0c81('0xb'));var squel=require(_0x0c81('0xc'));var crypto=require(_0x0c81('0xd'));var jsforce=require(_0x0c81('0xe'));var deskjs=require(_0x0c81('0xf'));var toCsv=require(_0x0c81('0x10'));var querystring=require(_0x0c81('0x11'));var Papa=require('papaparse');var Redis=require(_0x0c81('0x12'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x0c81('0x13'));var utils=require(_0x0c81('0x14'));var config=require(_0x0c81('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x215091,_0x19eeec){_0x19eeec=_0x19eeec||0xcc;return function(_0x140de9){if(_0x140de9){return _0x215091['sendStatus'](_0x19eeec);}return _0x215091[_0x0c81('0x16')](_0x19eeec)[_0x0c81('0x17')]();};}function respondWithResult(_0x3238e9,_0x51480a){_0x51480a=_0x51480a||0xc8;return function(_0x6a4beb){if(_0x6a4beb){return _0x3238e9['status'](_0x51480a)[_0x0c81('0x18')](_0x6a4beb);}};}function respondWithFilteredResult(_0x2cf0c0,_0x4aa8b6){return function(_0x34ec76){if(_0x34ec76){var _0x1be97a=_0x34ec76[_0x0c81('0x19')],_0x2eb15e=_0x4aa8b6[_0x0c81('0x1a')],_0x251ae3=_0x4aa8b6[_0x0c81('0x1a')]+_0x4aa8b6[_0x0c81('0x1b')],_0x4dee65;if(_0x251ae3>=_0x1be97a){_0x251ae3=_0x1be97a;_0x4dee65=0xc8;}else{_0x4dee65=0xce;}_0x2cf0c0[_0x0c81('0x16')](_0x4dee65);return _0x2cf0c0[_0x0c81('0x1c')]('Content-Range',_0x2eb15e+'-'+_0x251ae3+'/'+_0x1be97a)[_0x0c81('0x18')](_0x34ec76);}return null;};}function patchUpdates(_0x4faad9){return function(_0x1f4d66){try{jsonpatch[_0x0c81('0x1d')](_0x1f4d66,_0x4faad9,!![]);}catch(_0x174e13){return BPromise[_0x0c81('0x1e')](_0x174e13);}return _0x1f4d66[_0x0c81('0x1f')]();};}function saveUpdates(_0xda393b,_0x172efd){return function(_0xbc1ddb){if(_0xbc1ddb){return _0xbc1ddb['update'](_0xda393b)[_0x0c81('0x20')](function(_0x3a7b78){return _0x3a7b78;});}return null;};}function removeEntity(_0x50ff56,_0xf5fe8a){return function(_0x437076){if(_0x437076){return _0x437076[_0x0c81('0x21')]()['then'](function(){_0x50ff56['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a60f,_0x5f023b){return function(_0x339949){if(!_0x339949){_0x51a60f[_0x0c81('0x22')](0x194);}return _0x339949;};}function handleError(_0x310f3c,_0x587198){_0x587198=_0x587198||0x1f4;return function(_0x353242){logger[_0x0c81('0x23')](_0x353242['stack']);if(_0x353242[_0x0c81('0x24')]){delete _0x353242[_0x0c81('0x24')];}_0x310f3c[_0x0c81('0x16')](_0x587198)[_0x0c81('0x25')](_0x353242);};}exports[_0x0c81('0x26')]=function(_0x4a003a,_0x4335ee){var _0x37a725={},_0x25e9bb={},_0x4c73b6={'count':0x0,'rows':[]};var _0x4fd209=db[_0x0c81('0x27')]['rawAttributes'];_0x25e9bb[_0x0c81('0x28')]=_[_0x0c81('0x29')](_0x4fd209);var _0x3a1e9f={'dateStart':_0x4a003a['query'][_0x0c81('0x2a')],'dateEnd':_0x4a003a[_0x0c81('0x2b')]['dateEnd']};delete _0x4a003a[_0x0c81('0x2b')][_0x0c81('0x2a')];delete _0x4a003a[_0x0c81('0x2b')][_0x0c81('0x2c')];_0x25e9bb[_0x0c81('0x2b')]=_[_0x0c81('0x29')](_0x4a003a['query']);_0x25e9bb[_0x0c81('0x2d')]=_[_0x0c81('0x2e')](_0x25e9bb['model'],_0x25e9bb['query']);_0x37a725['attributes']=_['intersection'](_0x25e9bb[_0x0c81('0x28')],qs[_0x0c81('0x2f')](_0x4a003a[_0x0c81('0x2b')][_0x0c81('0x2f')]));_0x37a725[_0x0c81('0x30')]=_0x37a725[_0x0c81('0x30')][_0x0c81('0x31')]?_0x37a725['attributes']:_0x25e9bb[_0x0c81('0x28')];if(!_0x4a003a[_0x0c81('0x2b')][_0x0c81('0x32')]('nolimit')){_0x37a725[_0x0c81('0x1b')]=qs[_0x0c81('0x1b')](_0x4a003a['query']['limit']);_0x37a725[_0x0c81('0x1a')]=qs[_0x0c81('0x1a')](_0x4a003a[_0x0c81('0x2b')][_0x0c81('0x1a')]);}_0x37a725[_0x0c81('0x33')]=qs[_0x0c81('0x34')](_0x4a003a[_0x0c81('0x2b')][_0x0c81('0x34')]);_0x37a725['where']=qs[_0x0c81('0x2d')](_['pick'](_0x4a003a[_0x0c81('0x2b')],_0x25e9bb[_0x0c81('0x2d')]));if(_0x3a1e9f[_0x0c81('0x2a')]){if(_0x3a1e9f[_0x0c81('0x2c')]){_0x3a1e9f[_0x0c81('0x2c')]=moment(_0x3a1e9f[_0x0c81('0x2c')])[_0x0c81('0x35')](0x1,'day');}else{_0x3a1e9f[_0x0c81('0x2c')]=moment(_0x3a1e9f[_0x0c81('0x2a')])[_0x0c81('0x35')](0x1,_0x0c81('0x36'));}_[_0x0c81('0x37')](_0x37a725[_0x0c81('0x38')],{'createdAt':{'$gte':_0x3a1e9f[_0x0c81('0x2a')],'$lte':_0x3a1e9f[_0x0c81('0x2c')]}});}if(_0x4a003a[_0x0c81('0x2b')][_0x0c81('0x39')]){_0x37a725['where']=_['merge'](_0x37a725[_0x0c81('0x38')],{'$or':_['map'](_0x37a725[_0x0c81('0x30')],function(_0x101afd){var _0x457197={};_0x457197[_0x101afd]={'$like':'%'+_0x4a003a[_0x0c81('0x2b')]['filter']+'%'};return _0x457197;})});}_0x37a725=_['merge']({},_0x37a725,_0x4a003a[_0x0c81('0x3a')]);var _0x3c7e00={'where':_0x37a725[_0x0c81('0x38')]};return db[_0x0c81('0x27')][_0x0c81('0x19')](_0x3c7e00)[_0x0c81('0x20')](function(_0x4210d0){_0x4c73b6['count']=_0x4210d0;if(_0x4a003a[_0x0c81('0x2b')][_0x0c81('0x3b')]){_0x37a725[_0x0c81('0x3c')]=[{'all':!![]}];}return db[_0x0c81('0x27')][_0x0c81('0x3d')](_0x37a725);})[_0x0c81('0x20')](function(_0x25b232){_0x4c73b6[_0x0c81('0x3e')]=_0x25b232;return _0x4c73b6;})[_0x0c81('0x20')](respondWithFilteredResult(_0x4335ee,_0x37a725))['catch'](handleError(_0x4335ee,null));};exports[_0x0c81('0x3f')]=function(_0x4f6433,_0x3fbaeb){var _0x2be108={'raw':!![],'where':{'id':_0x4f6433[_0x0c81('0x40')]['id']}},_0xb67fa7={};_0xb67fa7[_0x0c81('0x28')]=_[_0x0c81('0x29')](db['ChatTransferReport'][_0x0c81('0x41')]);_0xb67fa7[_0x0c81('0x2b')]=_[_0x0c81('0x29')](_0x4f6433['query']);_0xb67fa7['filters']=_[_0x0c81('0x2e')](_0xb67fa7['model'],_0xb67fa7[_0x0c81('0x2b')]);_0x2be108[_0x0c81('0x30')]=_[_0x0c81('0x2e')](_0xb67fa7['model'],qs[_0x0c81('0x2f')](_0x4f6433[_0x0c81('0x2b')][_0x0c81('0x2f')]));_0x2be108['attributes']=_0x2be108[_0x0c81('0x30')][_0x0c81('0x31')]?_0x2be108[_0x0c81('0x30')]:_0xb67fa7[_0x0c81('0x28')];if(_0x4f6433[_0x0c81('0x2b')][_0x0c81('0x3b')]){_0x2be108[_0x0c81('0x3c')]=[{'all':!![]}];}_0x2be108=_[_0x0c81('0x37')]({},_0x2be108,_0x4f6433[_0x0c81('0x3a')]);return db[_0x0c81('0x27')]['find'](_0x2be108)[_0x0c81('0x20')](handleEntityNotFound(_0x3fbaeb,null))[_0x0c81('0x20')](respondWithResult(_0x3fbaeb,null))[_0x0c81('0x42')](handleError(_0x3fbaeb,null));};exports['create']=function(_0x1a409d,_0x43ee70){return db[_0x0c81('0x27')][_0x0c81('0x43')](_0x1a409d[_0x0c81('0x44')],{})[_0x0c81('0x20')](respondWithResult(_0x43ee70,0xc9))[_0x0c81('0x42')](handleError(_0x43ee70,null));};exports[_0x0c81('0x45')]=function(_0x1695da,_0x1df571){if(_0x1695da['body']['id']){delete _0x1695da['body']['id'];}return db[_0x0c81('0x27')]['find']({'where':{'id':_0x1695da['params']['id']}})[_0x0c81('0x20')](handleEntityNotFound(_0x1df571,null))[_0x0c81('0x20')](saveUpdates(_0x1695da['body'],null))[_0x0c81('0x20')](respondWithResult(_0x1df571,null))[_0x0c81('0x42')](handleError(_0x1df571,null));};exports[_0x0c81('0x21')]=function(_0x5ed99d,_0x4a6416){return db['ChatTransferReport']['find']({'where':{'id':_0x5ed99d[_0x0c81('0x40')]['id']}})[_0x0c81('0x20')](handleEntityNotFound(_0x4a6416,null))[_0x0c81('0x20')](removeEntity(_0x4a6416,null))[_0x0c81('0x42')](handleError(_0x4a6416,null));};exports[_0x0c81('0x46')]=function(_0x4ba6c6,_0x3159e0){return db[_0x0c81('0x27')][_0x0c81('0x46')]()[_0x0c81('0x20')](respondWithResult(_0x3159e0,null))[_0x0c81('0x42')](handleError(_0x3159e0,null));}; \ No newline at end of file +var _0x9358=['rows','catch','show','params','filters','include','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','ChatTransferReport','rawAttributes','model','keys','query','dateEnd','dateStart','intersection','attributes','fields','length','nolimit','order','sort','pick','day','merge','filter','where','map','options','includeAll','findAll'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x9358,0xe2));var _0x8935=function(_0x490c76,_0x7d488a){_0x490c76=_0x490c76-0x0;var _0x42e1f8=_0x9358[_0x490c76];return _0x42e1f8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8935('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8935('0x1'));var jsonpatch=require(_0x8935('0x2'));var rp=require('request-promise');var moment=require(_0x8935('0x3'));var BPromise=require(_0x8935('0x4'));var Mustache=require(_0x8935('0x5'));var util=require(_0x8935('0x6'));var path=require(_0x8935('0x7'));var sox=require(_0x8935('0x8'));var csv=require('to-csv');var ejs=require(_0x8935('0x9'));var fs=require('fs');var _=require(_0x8935('0xa'));var squel=require(_0x8935('0xb'));var crypto=require(_0x8935('0xc'));var jsforce=require(_0x8935('0xd'));var deskjs=require(_0x8935('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8935('0xf'));var Papa=require(_0x8935('0x10'));var Redis=require(_0x8935('0x11'));var qs=require(_0x8935('0x12'));var logger=require(_0x8935('0x13'))(_0x8935('0x14'));var utils=require(_0x8935('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57229b,_0x20c0ef){_0x20c0ef=_0x20c0ef||0xcc;return function(_0x51b3da){if(_0x51b3da){return _0x57229b[_0x8935('0x16')](_0x20c0ef);}return _0x57229b[_0x8935('0x17')](_0x20c0ef)['end']();};}function respondWithResult(_0x41eb0d,_0x2b5b31){_0x2b5b31=_0x2b5b31||0xc8;return function(_0x41608a){if(_0x41608a){return _0x41eb0d['status'](_0x2b5b31)[_0x8935('0x18')](_0x41608a);}};}function respondWithFilteredResult(_0x216ce5,_0x37e669){return function(_0x31cb38){if(_0x31cb38){var _0x5d9166=_0x31cb38[_0x8935('0x19')],_0x402b8d=_0x37e669[_0x8935('0x1a')],_0x16bcec=_0x37e669[_0x8935('0x1a')]+_0x37e669[_0x8935('0x1b')],_0x2e9510;if(_0x16bcec>=_0x5d9166){_0x16bcec=_0x5d9166;_0x2e9510=0xc8;}else{_0x2e9510=0xce;}_0x216ce5[_0x8935('0x17')](_0x2e9510);return _0x216ce5['set'](_0x8935('0x1c'),_0x402b8d+'-'+_0x16bcec+'/'+_0x5d9166)[_0x8935('0x18')](_0x31cb38);}return null;};}function patchUpdates(_0x4c7629){return function(_0x59fd2c){try{jsonpatch[_0x8935('0x1d')](_0x59fd2c,_0x4c7629,!![]);}catch(_0x5dbf04){return BPromise[_0x8935('0x1e')](_0x5dbf04);}return _0x59fd2c[_0x8935('0x1f')]();};}function saveUpdates(_0x466336,_0x2ab6d2){return function(_0x516d96){if(_0x516d96){return _0x516d96[_0x8935('0x20')](_0x466336)[_0x8935('0x21')](function(_0x265c0e){return _0x265c0e;});}return null;};}function removeEntity(_0x2637e8,_0x322a68){return function(_0xb0079b){if(_0xb0079b){return _0xb0079b[_0x8935('0x22')]()[_0x8935('0x21')](function(){_0x2637e8[_0x8935('0x17')](0xcc)[_0x8935('0x23')]();});}};}function handleEntityNotFound(_0x1c81a4,_0x66e523){return function(_0x218896){if(!_0x218896){_0x1c81a4['sendStatus'](0x194);}return _0x218896;};}function handleError(_0x2dfa73,_0x571805){_0x571805=_0x571805||0x1f4;return function(_0x422e2e){logger[_0x8935('0x24')](_0x422e2e[_0x8935('0x25')]);if(_0x422e2e[_0x8935('0x26')]){delete _0x422e2e[_0x8935('0x26')];}_0x2dfa73[_0x8935('0x17')](_0x571805)['send'](_0x422e2e);};}exports['index']=function(_0x7670ce,_0x53e762){var _0x11bb4={},_0x1886ca={},_0x28ca4b={'count':0x0,'rows':[]};var _0x1ebb83=db[_0x8935('0x27')][_0x8935('0x28')];_0x1886ca[_0x8935('0x29')]=_[_0x8935('0x2a')](_0x1ebb83);var _0x5566eb={'dateStart':_0x7670ce['query']['dateStart'],'dateEnd':_0x7670ce[_0x8935('0x2b')][_0x8935('0x2c')]};delete _0x7670ce[_0x8935('0x2b')][_0x8935('0x2d')];delete _0x7670ce[_0x8935('0x2b')][_0x8935('0x2c')];_0x1886ca[_0x8935('0x2b')]=_[_0x8935('0x2a')](_0x7670ce[_0x8935('0x2b')]);_0x1886ca['filters']=_[_0x8935('0x2e')](_0x1886ca['model'],_0x1886ca[_0x8935('0x2b')]);_0x11bb4[_0x8935('0x2f')]=_[_0x8935('0x2e')](_0x1886ca[_0x8935('0x29')],qs[_0x8935('0x30')](_0x7670ce[_0x8935('0x2b')][_0x8935('0x30')]));_0x11bb4[_0x8935('0x2f')]=_0x11bb4[_0x8935('0x2f')][_0x8935('0x31')]?_0x11bb4[_0x8935('0x2f')]:_0x1886ca[_0x8935('0x29')];if(!_0x7670ce['query']['hasOwnProperty'](_0x8935('0x32'))){_0x11bb4['limit']=qs[_0x8935('0x1b')](_0x7670ce[_0x8935('0x2b')][_0x8935('0x1b')]);_0x11bb4[_0x8935('0x1a')]=qs[_0x8935('0x1a')](_0x7670ce[_0x8935('0x2b')]['offset']);}_0x11bb4[_0x8935('0x33')]=qs[_0x8935('0x34')](_0x7670ce[_0x8935('0x2b')][_0x8935('0x34')]);_0x11bb4['where']=qs['filters'](_[_0x8935('0x35')](_0x7670ce[_0x8935('0x2b')],_0x1886ca['filters']));if(_0x5566eb[_0x8935('0x2d')]){if(_0x5566eb[_0x8935('0x2c')]){_0x5566eb['dateEnd']=moment(_0x5566eb['dateEnd'])['add'](0x1,_0x8935('0x36'));}else{_0x5566eb[_0x8935('0x2c')]=moment(_0x5566eb['dateStart'])['add'](0x1,_0x8935('0x36'));}_[_0x8935('0x37')](_0x11bb4['where'],{'createdAt':{'$gte':_0x5566eb[_0x8935('0x2d')],'$lte':_0x5566eb[_0x8935('0x2c')]}});}if(_0x7670ce['query'][_0x8935('0x38')]){_0x11bb4[_0x8935('0x39')]=_['merge'](_0x11bb4[_0x8935('0x39')],{'$or':_[_0x8935('0x3a')](_0x11bb4[_0x8935('0x2f')],function(_0x4bb7c7){var _0xf44603={};_0xf44603[_0x4bb7c7]={'$like':'%'+_0x7670ce['query'][_0x8935('0x38')]+'%'};return _0xf44603;})});}_0x11bb4=_[_0x8935('0x37')]({},_0x11bb4,_0x7670ce[_0x8935('0x3b')]);var _0x40e09f={'where':_0x11bb4[_0x8935('0x39')]};return db[_0x8935('0x27')][_0x8935('0x19')](_0x40e09f)[_0x8935('0x21')](function(_0x41ae1a){_0x28ca4b[_0x8935('0x19')]=_0x41ae1a;if(_0x7670ce['query'][_0x8935('0x3c')]){_0x11bb4['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0x8935('0x3d')](_0x11bb4);})[_0x8935('0x21')](function(_0xc5dcff){_0x28ca4b[_0x8935('0x3e')]=_0xc5dcff;return _0x28ca4b;})[_0x8935('0x21')](respondWithFilteredResult(_0x53e762,_0x11bb4))[_0x8935('0x3f')](handleError(_0x53e762,null));};exports[_0x8935('0x40')]=function(_0x484fb9,_0x427b6d){var _0x49c142={'raw':!![],'where':{'id':_0x484fb9[_0x8935('0x41')]['id']}},_0x47f675={};_0x47f675[_0x8935('0x29')]=_[_0x8935('0x2a')](db[_0x8935('0x27')]['rawAttributes']);_0x47f675[_0x8935('0x2b')]=_['keys'](_0x484fb9['query']);_0x47f675[_0x8935('0x42')]=_[_0x8935('0x2e')](_0x47f675['model'],_0x47f675['query']);_0x49c142[_0x8935('0x2f')]=_[_0x8935('0x2e')](_0x47f675[_0x8935('0x29')],qs[_0x8935('0x30')](_0x484fb9['query']['fields']));_0x49c142['attributes']=_0x49c142[_0x8935('0x2f')][_0x8935('0x31')]?_0x49c142[_0x8935('0x2f')]:_0x47f675[_0x8935('0x29')];if(_0x484fb9['query'][_0x8935('0x3c')]){_0x49c142[_0x8935('0x43')]=[{'all':!![]}];}_0x49c142=_[_0x8935('0x37')]({},_0x49c142,_0x484fb9[_0x8935('0x3b')]);return db[_0x8935('0x27')][_0x8935('0x44')](_0x49c142)[_0x8935('0x21')](handleEntityNotFound(_0x427b6d,null))['then'](respondWithResult(_0x427b6d,null))[_0x8935('0x3f')](handleError(_0x427b6d,null));};exports[_0x8935('0x45')]=function(_0x527986,_0x3cc37a){return db[_0x8935('0x27')]['create'](_0x527986['body'],{})['then'](respondWithResult(_0x3cc37a,0xc9))['catch'](handleError(_0x3cc37a,null));};exports['update']=function(_0x2d3e31,_0x593df5){if(_0x2d3e31[_0x8935('0x46')]['id']){delete _0x2d3e31[_0x8935('0x46')]['id'];}return db[_0x8935('0x27')][_0x8935('0x44')]({'where':{'id':_0x2d3e31[_0x8935('0x41')]['id']}})['then'](handleEntityNotFound(_0x593df5,null))[_0x8935('0x21')](saveUpdates(_0x2d3e31[_0x8935('0x46')],null))['then'](respondWithResult(_0x593df5,null))[_0x8935('0x3f')](handleError(_0x593df5,null));};exports['destroy']=function(_0x401045,_0xe01ab6){return db[_0x8935('0x27')][_0x8935('0x44')]({'where':{'id':_0x401045[_0x8935('0x41')]['id']}})[_0x8935('0x21')](handleEntityNotFound(_0xe01ab6,null))[_0x8935('0x21')](removeEntity(_0xe01ab6,null))[_0x8935('0x3f')](handleError(_0xe01ab6,null));};exports[_0x8935('0x47')]=function(_0x4d98a8,_0x499b38){return db[_0x8935('0x27')][_0x8935('0x47')]()[_0x8935('0x21')](respondWithResult(_0x499b38,null))[_0x8935('0x3f')](handleError(_0x499b38,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index bb49b08..c4018bc 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 _0x127c=['define','uniqueid','lodash','../../config/logger','request-promise','./chatTransferReport.attributes','exports'];(function(_0x426281,_0xfe58ba){var _0x2d05b1=function(_0x478698){while(--_0x478698){_0x426281['push'](_0x426281['shift']());}};_0x2d05b1(++_0xfe58ba);}(_0x127c,0x121));var _0xc127=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x127c[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xc127('0x0'));var util=require('util');var logger=require(_0xc127('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc127('0x2'));var attributes=require(_0xc127('0x3'));module[_0xc127('0x4')]=function(_0x409c51,_0x1533f6){return _0x409c51[_0xc127('0x5')]('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xc127('0x6'),'fields':[_0xc127('0x6')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0a2f=['uniqueid','lodash','util','../../config/logger','api','moment','request-promise','./chatTransferReport.attributes','exports','define','report_chat_transfer'];(function(_0x7261e6,_0x3e3bf7){var _0x20d5ed=function(_0x522641){while(--_0x522641){_0x7261e6['push'](_0x7261e6['shift']());}};_0x20d5ed(++_0x3e3bf7);}(_0x0a2f,0x109));var _0xf0a2=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x0a2f[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xf0a2('0x0'));var util=require(_0xf0a2('0x1'));var logger=require(_0xf0a2('0x2'))(_0xf0a2('0x3'));var moment=require(_0xf0a2('0x4'));var BPromise=require('bluebird');var rp=require(_0xf0a2('0x5'));var attributes=require(_0xf0a2('0x6'));module[_0xf0a2('0x7')]=function(_0x121117,_0x4fa8b3){return _0x121117[_0xf0a2('0x8')]('ChatTransferReport',attributes,{'tableName':_0xf0a2('0x9'),'paranoid':![],'indexes':[{'name':_0xf0a2('0xa'),'fields':[_0xf0a2('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index bd5ed2e..1662882 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 _0xf0f4=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x572fed,_0x451a19){var _0x3d3cb9=function(_0x83ea08){while(--_0x83ea08){_0x572fed['push'](_0x572fed['shift']());}};_0x3d3cb9(++_0x451a19);}(_0xf0f4,0x1d3));var _0x4f0f=function(_0x4616b8,_0x1d196e){_0x4616b8=_0x4616b8-0x0;var _0x276802=_0xf0f4[_0x4616b8];return _0x276802;};'use strict';var _=require(_0x4f0f('0x0'));var util=require(_0x4f0f('0x1'));var moment=require(_0x4f0f('0x2'));var BPromise=require(_0x4f0f('0x3'));var rs=require(_0x4f0f('0x4'));var fs=require('fs');var Redis=require(_0x4f0f('0x5'));var db=require(_0x4f0f('0x6'))['db'];var utils=require(_0x4f0f('0x7'));var logger=require('../../config/logger')(_0x4f0f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4f0f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58f98f,_0x38d544,_0x253d9d){return new BPromise(function(_0x410095,_0x1f03f0){return client[_0x4f0f('0xa')](_0x58f98f,_0x253d9d)[_0x4f0f('0xb')](function(_0x3baf6b){logger[_0x4f0f('0xc')](_0x4f0f('0xd'),_0x38d544,_0x4f0f('0xe'));logger[_0x4f0f('0xf')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x38d544,_0x4f0f('0xe'),JSON[_0x4f0f('0x10')](_0x3baf6b));if(_0x3baf6b[_0x4f0f('0x11')]){if(_0x3baf6b['error'][_0x4f0f('0x12')]===0x1f4){logger[_0x4f0f('0x11')](_0x4f0f('0xd'),_0x38d544,_0x3baf6b[_0x4f0f('0x11')][_0x4f0f('0x13')]);return _0x1f03f0(_0x3baf6b[_0x4f0f('0x11')]['message']);}logger[_0x4f0f('0x11')](_0x4f0f('0xd'),_0x38d544,_0x3baf6b['error']['message']);return _0x410095(_0x3baf6b[_0x4f0f('0x11')][_0x4f0f('0x13')]);}else{logger[_0x4f0f('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x38d544,_0x4f0f('0xe'));_0x410095(_0x3baf6b[_0x4f0f('0x14')][_0x4f0f('0x13')]);}})[_0x4f0f('0x15')](function(_0x1ed1a6){logger[_0x4f0f('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x38d544,_0x1ed1a6);_0x1f03f0(_0x1ed1a6);});});} \ No newline at end of file +var _0x7ece=['lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x1b8b60,_0x43d03f){var _0x5ce741=function(_0x2063b5){while(--_0x2063b5){_0x1b8b60['push'](_0x1b8b60['shift']());}};_0x5ce741(++_0x43d03f);}(_0x7ece,0x1e3));var _0xe7ec=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x7ece[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0xe7ec('0x0'));var util=require(_0xe7ec('0x1'));var moment=require(_0xe7ec('0x2'));var BPromise=require(_0xe7ec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7ec('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe7ec('0x5'));var logger=require(_0xe7ec('0x6'))(_0xe7ec('0x7'));var config=require(_0xe7ec('0x8'));var jayson=require(_0xe7ec('0x9'));var client=jayson[_0xe7ec('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6e5a3a,_0xe84800,_0x536753){return new BPromise(function(_0x2e92d6,_0x52eca4){return client[_0xe7ec('0xb')](_0x6e5a3a,_0x536753)[_0xe7ec('0xc')](function(_0x11cd42){logger[_0xe7ec('0xd')](_0xe7ec('0xe'),_0xe84800,_0xe7ec('0xf'));logger['debug']('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0xe84800,'request\x20sent',JSON[_0xe7ec('0x10')](_0x11cd42));if(_0x11cd42[_0xe7ec('0x11')]){if(_0x11cd42[_0xe7ec('0x11')][_0xe7ec('0x12')]===0x1f4){logger[_0xe7ec('0x11')](_0xe7ec('0xe'),_0xe84800,_0x11cd42[_0xe7ec('0x11')][_0xe7ec('0x13')]);return _0x52eca4(_0x11cd42['error'][_0xe7ec('0x13')]);}logger[_0xe7ec('0x11')](_0xe7ec('0xe'),_0xe84800,_0x11cd42[_0xe7ec('0x11')][_0xe7ec('0x13')]);return _0x2e92d6(_0x11cd42[_0xe7ec('0x11')][_0xe7ec('0x13')]);}else{logger['info'](_0xe7ec('0xe'),_0xe84800,_0xe7ec('0xf'));_0x2e92d6(_0x11cd42[_0xe7ec('0x14')][_0xe7ec('0x13')]);}})['catch'](function(_0x1f79b7){logger[_0xe7ec('0x11')](_0xe7ec('0xe'),_0xe84800,_0x1f79b7);_0x52eca4(_0x1f79b7);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 6eee137..837f021 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 _0x063a=['show','post','create','put','update','delete','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/describe','/:id'];(function(_0x1c6c9f,_0xc74653){var _0x376376=function(_0x41fc4e){while(--_0x41fc4e){_0x1c6c9f['push'](_0x1c6c9f['shift']());}};_0x376376(++_0xc74653);}(_0x063a,0x17c));var _0xa063=function(_0x312c92,_0x4e72ba){_0x312c92=_0x312c92-0x0;var _0x5ce8f3=_0x063a[_0x312c92];return _0x5ce8f3;};'use strict';var multer=require(_0xa063('0x0'));var util=require(_0xa063('0x1'));var path=require(_0xa063('0x2'));var timeout=require('connect-timeout');var express=require(_0xa063('0x3'));var router=express[_0xa063('0x4')]();var auth=require(_0xa063('0x5'));var interaction=require(_0xa063('0x6'));var config=require('../../config/environment');var controller=require('./chatTransferReport.controller');router['get']('/',auth[_0xa063('0x7')](),controller['index']);router[_0xa063('0x8')](_0xa063('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xa063('0xa'),auth[_0xa063('0x7')](),controller[_0xa063('0xb')]);router[_0xa063('0xc')]('/',auth[_0xa063('0x7')](),controller[_0xa063('0xd')]);router[_0xa063('0xe')](_0xa063('0xa'),auth[_0xa063('0x7')](),controller[_0xa063('0xf')]);router[_0xa063('0x10')](_0xa063('0xa'),auth[_0xa063('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x57a5=['/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../config/environment','./chatTransferReport.controller','index','get'];(function(_0x59710f,_0x44c7f0){var _0xaae66a=function(_0x1c2397){while(--_0x1c2397){_0x59710f['push'](_0x59710f['shift']());}};_0xaae66a(++_0x44c7f0);}(_0x57a5,0x1eb));var _0x557a=function(_0x241b1e,_0x3718e8){_0x241b1e=_0x241b1e-0x0;var _0x387cc4=_0x57a5[_0x241b1e];return _0x387cc4;};'use strict';var multer=require(_0x557a('0x0'));var util=require('util');var path=require(_0x557a('0x1'));var timeout=require(_0x557a('0x2'));var express=require(_0x557a('0x3'));var router=express[_0x557a('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x557a('0x5'));var controller=require(_0x557a('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x557a('0x7')]);router[_0x557a('0x8')](_0x557a('0x9'),auth[_0x557a('0xa')](),controller[_0x557a('0xb')]);router[_0x557a('0x8')](_0x557a('0xc'),auth[_0x557a('0xa')](),controller[_0x557a('0xd')]);router[_0x557a('0xe')]('/',auth[_0x557a('0xa')](),controller[_0x557a('0xf')]);router[_0x557a('0x10')](_0x557a('0xc'),auth[_0x557a('0xa')](),controller[_0x557a('0x11')]);router[_0x557a('0x12')](_0x557a('0xc'),auth[_0x557a('0xa')](),controller['destroy']);module[_0x557a('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index f135393..0c2d4b1 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 _0xb19a=['name','input','getDataValue','parse','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Skip','website_alias','alternate','#fafafa','System','sequelize','STRING','email','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','star','stringify'];(function(_0x7025b0,_0x9533f1){var _0x6e444c=function(_0x258fe9){while(--_0x258fe9){_0x7025b0['push'](_0x7025b0['shift']());}};_0x6e444c(++_0x9533f1);}(_0xb19a,0xd0));var _0xab19=function(_0x2090dd,_0x553e55){_0x2090dd=_0x2090dd-0x0;var _0x43e41a=_0xb19a[_0x2090dd];return _0x43e41a;};'use strict';var Sequelize=require(_0xab19('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xab19('0x1')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xab19('0x1')]},'mapKey':{'type':Sequelize[_0xab19('0x1')],'defaultValue':_0xab19('0x2')},'mapKeyOffline':{'type':Sequelize[_0xab19('0x1')],'defaultValue':_0xab19('0x2')},'key':{'type':Sequelize[_0xab19('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xab19('0x1')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xab19('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xab19('0x1')],'allowNull':![],'defaultValue':'#9f946a','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xab19('0x1')],'allowNull':![],'defaultValue':'#9f946a','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xab19('0x1')],'allowNull':![],'defaultValue':_0xab19('0x3'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xab19('0x4')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xab19('0x1')]},'animation':{'type':Sequelize[_0xab19('0x5')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xab19('0x6')](_0xab19('0x7'),_0xab19('0x8')),'defaultValue':_0xab19('0x7')},'header_online':{'type':Sequelize[_0xab19('0x1')],'defaultValue':_0xab19('0x9')},'start_chat_button':{'type':Sequelize[_0xab19('0x1')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xab19('0xa')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xab19('0xb')},'download_transcript':{'type':Sequelize[_0xab19('0x5')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xab19('0x4')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xab19('0x1')],'defaultValue':_0xab19('0xc')},'defaultWhiteLabel':{'type':Sequelize[_0xab19('0x5')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xab19('0xd')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xab19('0xe')},'formSubmitSuccessMessage':{'type':Sequelize[_0xab19('0x1')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xab19('0x1')],'defaultValue':_0xab19('0xf')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xab19('0x1')],'defaultValue':_0xab19('0x10')},'closingMessage':{'type':Sequelize[_0xab19('0x1')],'defaultValue':_0xab19('0x11')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xab19('0xa')},'skipMessageButton':{'type':Sequelize[_0xab19('0x1')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xab19('0x5')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xab19('0x5')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xab19('0x5')],'defaultValue':![]},'ratingType':{'type':Sequelize['ENUM']('star','thumb'),'defaultValue':_0xab19('0x12')},'ratingStarsNumber':{'type':Sequelize[_0xab19('0x4')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xab19('0x13')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xab19('0x14'),'type':'text','required':!![]},'props':{'title':_0xab19('0x14'),'helpText':''}},{'type':_0xab19('0x15'),'props':{'title':_0xab19('0x2'),'helpText':''},'config':{'required':!![],'placeholder':_0xab19('0x2'),'type':_0xab19('0x2')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xab19('0x16')]('onlineForm')?JSON[_0xab19('0x17')](this[_0xab19('0x16')](_0xab19('0x18'))):{};},'set':function(_0x2e27d5){return this[_0xab19('0x19')](_0xab19('0x18'),JSON[_0xab19('0x13')](_0x2e27d5));}},'offlineForm':{'type':Sequelize[_0xab19('0xd')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xab19('0x15'),'props':{'title':_0xab19('0x2'),'helpText':''},'config':{'required':!![],'placeholder':_0xab19('0x2'),'type':_0xab19('0x2')},'variable':null},{'type':_0xab19('0x1a'),'config':{'placeholder':_0xab19('0x1b')},'props':{'title':_0xab19('0x1b'),'helpText':_0xab19('0x1c')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0xab19('0x1d'))?JSON[_0xab19('0x17')](this['getDataValue'](_0xab19('0x1d'))):{};},'set':function(_0x52f3f9){return this[_0xab19('0x19')](_0xab19('0x1d'),JSON['stringify'](_0x52f3f9));}},'token':{'type':Sequelize[_0xab19('0x1')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xab19('0x5')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xab19('0x5')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xab19('0x1')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xab19('0x1')]},'waitingTitle':{'type':Sequelize[_0xab19('0x1')],'defaultValue':_0xab19('0x1e')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xab19('0x1f')},'offlineMessageSubject':{'type':Sequelize[_0xab19('0x1')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xab19('0x1')],'defaultValue':_0xab19('0x20')},'enableUnmanagedNote':{'type':Sequelize[_0xab19('0x5')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xab19('0x1')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0xab19('0x1')],'defaultValue':_0xab19('0x21')},'sendUnmanaged':{'type':Sequelize[_0xab19('0x1')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xab19('0x5')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xab19('0xd')]},'showAgentAvatar':{'type':Sequelize[_0xab19('0x5')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xab19('0xd')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xab19('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xab19('0x5')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xab19('0x5')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0xab19('0x22')},'waitForTheAssignedAgent':{'type':Sequelize[_0xab19('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xab19('0x1')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xab19('0x1')],'defaultValue':_0xab19('0x23')},'defaultTitle':{'type':Sequelize[_0xab19('0x1')]},'customerAvatar':{'type':Sequelize[_0xab19('0xd')]},'showCustomerAvatar':{'type':Sequelize[_0xab19('0x5')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xab19('0x4')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xab19('0x1')],'allowNull':![],'defaultValue':_0xab19('0x24'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xab19('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xab19('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xab19('0x1')],'defaultValue':_0xab19('0x25')},'systemAvatar':{'type':Sequelize[_0xab19('0xd')]}}; \ No newline at end of file +var _0x8185=['Send','Skip','ENUM','thumb','star','TEXT','stringify','input','text','onlineForm','parse','getDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','alternate','#fafafa','System','sequelize','randomstring','STRING','address','email','Agent','#9f946a','#ffffff','INTEGER','BOOLEAN','rounded','squared','We\x20are\x20here!','Chat','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message'];(function(_0x3f56fb,_0x2c7050){var _0x4edbcc=function(_0x136358){while(--_0x136358){_0x3f56fb['push'](_0x3f56fb['shift']());}};_0x4edbcc(++_0x2c7050);}(_0x8185,0x127));var _0x5818=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x8185[_0x5f1391];return _0x50ebe3;};'use strict';var Sequelize=require(_0x5818('0x0'));var rs=require(_0x5818('0x1'));module['exports']={'name':{'type':Sequelize[_0x5818('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x5818('0x2')],'allowNull':![],'unique':_0x5818('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x5818('0x4')},'mapKeyOffline':{'type':Sequelize[_0x5818('0x2')],'defaultValue':_0x5818('0x4')},'key':{'type':Sequelize[_0x5818('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x5818('0x2')],'defaultValue':_0x5818('0x5')},'customerAlias':{'type':Sequelize[_0x5818('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x5818('0x2')],'allowNull':![],'defaultValue':_0x5818('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x5818('0x2')],'allowNull':![],'defaultValue':_0x5818('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x5818('0x2')],'allowNull':![],'defaultValue':_0x5818('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x5818('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x5818('0x2')]},'animation':{'type':Sequelize[_0x5818('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x5818('0xa'),_0x5818('0xb')),'defaultValue':_0x5818('0xa')},'header_online':{'type':Sequelize[_0x5818('0x2')],'defaultValue':_0x5818('0xc')},'start_chat_button':{'type':Sequelize[_0x5818('0x2')],'defaultValue':_0x5818('0xd')},'offline_chat_button':{'type':Sequelize[_0x5818('0x2')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x5818('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x5818('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x5818('0x2')],'defaultValue':_0x5818('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x5818('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x5818('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x5818('0x2')],'defaultValue':_0x5818('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x5818('0x2')],'defaultValue':_0x5818('0x11')},'noteTitle':{'type':Sequelize[_0x5818('0x2')],'defaultValue':_0x5818('0x12')},'placeholderMessage':{'type':Sequelize[_0x5818('0x2')],'defaultValue':_0x5818('0x13')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x5818('0x2')],'defaultValue':_0x5818('0x14')},'skipMessageButton':{'type':Sequelize[_0x5818('0x2')],'defaultValue':_0x5818('0x15')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x5818('0x9')],'defaultValue':![]},'ratingType':{'type':Sequelize[_0x5818('0x16')]('star',_0x5818('0x17')),'defaultValue':_0x5818('0x18')},'ratingStarsNumber':{'type':Sequelize[_0x5818('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x5818('0x19')],'defaultValue':function(){return JSON[_0x5818('0x1a')]({'items':[{'type':_0x5818('0x1b'),'variable':null,'config':{'placeholder':'name','type':_0x5818('0x1c'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x5818('0x1b'),'props':{'title':_0x5818('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x5818('0x4'),'type':_0x5818('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x5818('0x1d'))?JSON[_0x5818('0x1e')](this[_0x5818('0x1f')]('onlineForm')):{};},'set':function(_0x3302f3){return this['setDataValue'](_0x5818('0x1d'),JSON[_0x5818('0x1a')](_0x3302f3));}},'offlineForm':{'type':Sequelize[_0x5818('0x19')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x5818('0x1b'),'props':{'title':_0x5818('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null},{'type':_0x5818('0x20'),'config':{'placeholder':_0x5818('0x21')},'props':{'title':'Comments','helpText':_0x5818('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x5818('0x1f')](_0x5818('0x23'))?JSON[_0x5818('0x1e')](this[_0x5818('0x1f')](_0x5818('0x23'))):{};},'set':function(_0x571444){return this['setDataValue']('offlineForm',JSON[_0x5818('0x1a')](_0x571444));}},'token':{'type':Sequelize[_0x5818('0x2')],'defaultValue':function(){return rs[_0x5818('0x24')]();}},'autoclose':{'type':Sequelize[_0x5818('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x5818('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x5818('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x5818('0x2')]},'forwardOffline':{'type':Sequelize[_0x5818('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x5818('0x2')]},'waitingTitle':{'type':Sequelize[_0x5818('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x5818('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x5818('0x25')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x5818('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x5818('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x5818('0x27')},'skipUnmanaged':{'type':Sequelize[_0x5818('0x2')],'defaultValue':_0x5818('0x15')},'sendUnmanaged':{'type':Sequelize[_0x5818('0x2')],'defaultValue':_0x5818('0x14')},'enableCustomerAttachment':{'type':Sequelize[_0x5818('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x5818('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x5818('0x19')]},'showAgentAvatar':{'type':Sequelize[_0x5818('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x5818('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x5818('0x28');}},'notificationSound':{'type':Sequelize[_0x5818('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5818('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x5818('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x5818('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x5818('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x5818('0x2')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x5818('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x5818('0x2')],'defaultValue':_0x5818('0x2a')},'defaultTitle':{'type':Sequelize[_0x5818('0x2')]},'customerAvatar':{'type':Sequelize[_0x5818('0x19')]},'showCustomerAvatar':{'type':Sequelize[_0x5818('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x5818('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x5818('0x2')],'allowNull':![],'defaultValue':_0x5818('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x5818('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5818('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5818('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x5818('0x2c')},'systemAvatar':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 78f71c4..5992347 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 _0xcb91=['sitepic','file','filename','addAvatar','agentAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.png','../../config/license/util','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA','headers','user-agent','getResult','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','CmList','Contacts','DESC','Applications','List','account','applications','list','orderBy','priority','asc','ListId','contact','firstName','lastName','referer','browser','name','version','%s\x20%s','unknown','format','device','vendor','%s\x20%s\x20%s','type','threadId','externalUrl','ChatInteraction','interaction','spread','get','created','push','close','unmanaged','*,*,*,*','ChatMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','EventManager','notify','offline','from\x20is\x20mandatory','mapKeyOffline','includes','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','user','pass','offlineMessageSubject','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','Interval','Intervals','getProactiveActions','virtual','custom','readFileSync','remote','x-forwarded-for','x-real-ip','remoteAddress','replace','alignment','verticalAlignment','sequelize','ChatApplication','bulkCreate','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','request','then','info','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ChatWebsite,\x20%s,\x20%s','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','destroy','end','stack','send','index','ChatWebsite','rawAttributes','model','dateStart','dateEnd','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','add','day','merge','where','filter','map','options','count','includeAll','findAll','rows','catch','show','params','length','find','body','update','describe','addDisposition','ChatWebsiteId','Disposition','order','removeDispositions','ids','addAnswer','CannedAnswer','create','getAnswers','findOne','include','removeAnswers','addLogo'];(function(_0x39c5c0,_0x492776){var _0x10f81c=function(_0xbb5799){while(--_0xbb5799){_0x39c5c0['push'](_0x39c5c0['shift']());}};_0x10f81c(++_0x492776);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xcb91[_0x565c49];return _0x20ca34;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1cb9('0x0'));var zipdir=require(_0x1cb9('0x1'));var jsonpatch=require(_0x1cb9('0x2'));var rp=require(_0x1cb9('0x3'));var moment=require('moment');var BPromise=require(_0x1cb9('0x4'));var Mustache=require(_0x1cb9('0x5'));var util=require('util');var path=require(_0x1cb9('0x6'));var sox=require(_0x1cb9('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb9('0x8'));var fs=require('fs');var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var logger=require(_0x1cb9('0xf'))(_0x1cb9('0x10'));var utils=require(_0x1cb9('0x11'));var config=require('../../config/environment');var db=require(_0x1cb9('0x12'))['db'];config[_0x1cb9('0x13')]=_[_0x1cb9('0x14')](config[_0x1cb9('0x13')],{'host':_0x1cb9('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatWebsite.socket')[_0x1cb9('0x16')](socket);var jayson=require(_0x1cb9('0x17'));var client=jayson[_0x1cb9('0x18')][_0x1cb9('0x19')]({'port':0x232c});var client9002=jayson['client'][_0x1cb9('0x19')]({'port':0x232a});var client9003=jayson[_0x1cb9('0x18')][_0x1cb9('0x19')]({'port':0x232b});function respondWithRpcPromise(_0x8dfa55,_0x3e2d11,_0x5806d8,_0x5572cb){return new BPromise(function(_0xd446a3,_0x3cc765){var _0x3904b7=_0x5572cb||client;return _0x3904b7[_0x1cb9('0x1a')](_0x8dfa55,_0x5806d8)[_0x1cb9('0x1b')](function(_0xf22920){logger[_0x1cb9('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x3e2d11,'request\x20sent');logger[_0x1cb9('0x1d')](_0x1cb9('0x1e'),_0x3e2d11,_0x1cb9('0x1f'),JSON[_0x1cb9('0x20')](_0xf22920));if(_0xf22920[_0x1cb9('0x21')]){if(_0xf22920[_0x1cb9('0x21')][_0x1cb9('0x22')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x3e2d11,_0xf22920[_0x1cb9('0x21')]['message']);return _0x3cc765(_0xf22920[_0x1cb9('0x21')][_0x1cb9('0x23')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x3e2d11,_0xf22920[_0x1cb9('0x21')][_0x1cb9('0x23')]);return _0xd446a3(_0xf22920[_0x1cb9('0x21')][_0x1cb9('0x23')]);}else{logger[_0x1cb9('0x1c')](_0x1cb9('0x24'),_0x3e2d11,'request\x20sent');_0xd446a3(_0xf22920['result'][_0x1cb9('0x23')]);}})['catch'](function(_0x10a419){logger[_0x1cb9('0x21')](_0x1cb9('0x24'),_0x3e2d11,_0x10a419);_0x3cc765(_0x10a419);});});}function respondWithStatusCode(_0x44d3c4,_0x43a100){_0x43a100=_0x43a100||0xcc;return function(_0x53f9fa){if(_0x53f9fa){return _0x44d3c4[_0x1cb9('0x25')](_0x43a100);}return _0x44d3c4[_0x1cb9('0x26')](_0x43a100)['end']();};}function respondWithResult(_0xd6891c,_0x21effa){_0x21effa=_0x21effa||0xc8;return function(_0x41a9a0){if(_0x41a9a0){return _0xd6891c[_0x1cb9('0x26')](_0x21effa)[_0x1cb9('0x27')](_0x41a9a0);}};}function respondWithFilteredResult(_0x21d6f5,_0x2e28fe){return function(_0xb644b3){if(_0xb644b3){var _0x41e5c2=_0xb644b3['count'],_0x9de64b=_0x2e28fe[_0x1cb9('0x28')],_0x48888d=_0x2e28fe['offset']+_0x2e28fe[_0x1cb9('0x29')],_0x405a2f;if(_0x48888d>=_0x41e5c2){_0x48888d=_0x41e5c2;_0x405a2f=0xc8;}else{_0x405a2f=0xce;}_0x21d6f5[_0x1cb9('0x26')](_0x405a2f);return _0x21d6f5[_0x1cb9('0x2a')](_0x1cb9('0x2b'),_0x9de64b+'-'+_0x48888d+'/'+_0x41e5c2)['json'](_0xb644b3);}return null;};}function patchUpdates(_0x1c701f){return function(_0x4eba82){try{jsonpatch[_0x1cb9('0x2c')](_0x4eba82,_0x1c701f,!![]);}catch(_0x336a98){return BPromise[_0x1cb9('0x2d')](_0x336a98);}return _0x4eba82['save']();};}function saveUpdates(_0xae4c7a,_0x5e84fd){return function(_0x3a3543){if(_0x3a3543){return _0x3a3543['update'](_0xae4c7a)[_0x1cb9('0x1b')](function(_0x42a688){return _0x42a688;});}return null;};}function removeEntity(_0x3a2c60,_0xae910){return function(_0x56c3e0){if(_0x56c3e0){return _0x56c3e0[_0x1cb9('0x2e')]()[_0x1cb9('0x1b')](function(){_0x3a2c60[_0x1cb9('0x26')](0xcc)[_0x1cb9('0x2f')]();});}};}function handleEntityNotFound(_0xc6784c,_0x2794fa){return function(_0xc6d5fd){if(!_0xc6d5fd){_0xc6784c[_0x1cb9('0x25')](0x194);}return _0xc6d5fd;};}function handleError(_0x386e8b,_0x1de287){_0x1de287=_0x1de287||0x1f4;return function(_0x294eec){logger[_0x1cb9('0x21')](_0x294eec[_0x1cb9('0x30')]);if(_0x294eec['name']){delete _0x294eec['name'];}_0x386e8b[_0x1cb9('0x26')](_0x1de287)[_0x1cb9('0x31')](_0x294eec);};}exports[_0x1cb9('0x32')]=function(_0x29f451,_0x385daa){var _0x3a06e6={},_0x35f5e8={},_0x3f5637={'count':0x0,'rows':[]};var _0x4d3e39=db[_0x1cb9('0x33')][_0x1cb9('0x34')];_0x35f5e8[_0x1cb9('0x35')]=_['keys'](_0x4d3e39);var _0x2a5aac={'dateStart':_0x29f451['query'][_0x1cb9('0x36')],'dateEnd':_0x29f451['query'][_0x1cb9('0x37')]};delete _0x29f451[_0x1cb9('0x38')][_0x1cb9('0x36')];delete _0x29f451[_0x1cb9('0x38')][_0x1cb9('0x37')];_0x35f5e8[_0x1cb9('0x38')]=_[_0x1cb9('0x39')](_0x29f451['query']);_0x35f5e8['filters']=_[_0x1cb9('0x3a')](_0x35f5e8[_0x1cb9('0x35')],_0x35f5e8[_0x1cb9('0x38')]);_0x3a06e6[_0x1cb9('0x3b')]=_[_0x1cb9('0x3a')](_0x35f5e8[_0x1cb9('0x35')],qs[_0x1cb9('0x3c')](_0x29f451['query'][_0x1cb9('0x3c')]));_0x3a06e6['attributes']=_0x3a06e6['attributes']['length']?_0x3a06e6[_0x1cb9('0x3b')]:_0x35f5e8[_0x1cb9('0x35')];if(!_0x29f451[_0x1cb9('0x38')][_0x1cb9('0x3d')](_0x1cb9('0x3e'))){_0x3a06e6['limit']=qs[_0x1cb9('0x29')](_0x29f451['query'][_0x1cb9('0x29')]);_0x3a06e6[_0x1cb9('0x28')]=qs[_0x1cb9('0x28')](_0x29f451['query'][_0x1cb9('0x28')]);}_0x3a06e6['order']=qs[_0x1cb9('0x3f')](_0x29f451[_0x1cb9('0x38')]['sort']);_0x3a06e6['where']=qs[_0x1cb9('0x40')](_[_0x1cb9('0x41')](_0x29f451[_0x1cb9('0x38')],_0x35f5e8[_0x1cb9('0x40')]));if(_0x2a5aac[_0x1cb9('0x36')]){if(_0x2a5aac['dateEnd']){_0x2a5aac[_0x1cb9('0x37')]=moment(_0x2a5aac['dateEnd'])['add'](0x1,'day');}else{_0x2a5aac[_0x1cb9('0x37')]=moment(_0x2a5aac[_0x1cb9('0x36')])[_0x1cb9('0x42')](0x1,_0x1cb9('0x43'));}_[_0x1cb9('0x44')](_0x3a06e6[_0x1cb9('0x45')],{'createdAt':{'$gte':_0x2a5aac[_0x1cb9('0x36')],'$lte':_0x2a5aac[_0x1cb9('0x37')]}});}if(_0x29f451[_0x1cb9('0x38')][_0x1cb9('0x46')]){_0x3a06e6[_0x1cb9('0x45')]=_['merge'](_0x3a06e6[_0x1cb9('0x45')],{'$or':_[_0x1cb9('0x47')](_0x3a06e6[_0x1cb9('0x3b')],function(_0x55255c){var _0x179e81={};_0x179e81[_0x55255c]={'$like':'%'+_0x29f451[_0x1cb9('0x38')][_0x1cb9('0x46')]+'%'};return _0x179e81;})});}_0x3a06e6=_[_0x1cb9('0x44')]({},_0x3a06e6,_0x29f451[_0x1cb9('0x48')]);var _0x4791ee={'where':_0x3a06e6[_0x1cb9('0x45')]};return db['ChatWebsite'][_0x1cb9('0x49')](_0x4791ee)['then'](function(_0x1cf2ee){_0x3f5637[_0x1cb9('0x49')]=_0x1cf2ee;if(_0x29f451[_0x1cb9('0x38')][_0x1cb9('0x4a')]){_0x3a06e6['include']=[{'all':!![]}];}return db[_0x1cb9('0x33')][_0x1cb9('0x4b')](_0x3a06e6);})[_0x1cb9('0x1b')](function(_0x3561a5){_0x3f5637[_0x1cb9('0x4c')]=_0x3561a5;return _0x3f5637;})[_0x1cb9('0x1b')](respondWithFilteredResult(_0x385daa,_0x3a06e6))[_0x1cb9('0x4d')](handleError(_0x385daa,null));};exports[_0x1cb9('0x4e')]=function(_0xbb500e,_0x17f10e){var _0x48dd4a={'raw':![],'where':{'id':_0xbb500e[_0x1cb9('0x4f')]['id']}},_0x5092a6={};_0x5092a6[_0x1cb9('0x35')]=_[_0x1cb9('0x39')](db[_0x1cb9('0x33')][_0x1cb9('0x34')]);_0x5092a6[_0x1cb9('0x38')]=_[_0x1cb9('0x39')](_0xbb500e[_0x1cb9('0x38')]);_0x5092a6[_0x1cb9('0x40')]=_[_0x1cb9('0x3a')](_0x5092a6['model'],_0x5092a6[_0x1cb9('0x38')]);_0x48dd4a['attributes']=_[_0x1cb9('0x3a')](_0x5092a6['model'],qs[_0x1cb9('0x3c')](_0xbb500e['query']['fields']));_0x48dd4a[_0x1cb9('0x3b')]=_0x48dd4a[_0x1cb9('0x3b')][_0x1cb9('0x50')]?_0x48dd4a['attributes']:_0x5092a6[_0x1cb9('0x35')];if(_0xbb500e[_0x1cb9('0x38')]['includeAll']){_0x48dd4a['include']=[{'all':!![]}];}_0x48dd4a=_[_0x1cb9('0x44')]({},_0x48dd4a,_0xbb500e[_0x1cb9('0x48')]);return db[_0x1cb9('0x33')][_0x1cb9('0x51')](_0x48dd4a)[_0x1cb9('0x1b')](handleEntityNotFound(_0x17f10e,null))[_0x1cb9('0x1b')](respondWithResult(_0x17f10e,null))[_0x1cb9('0x4d')](handleError(_0x17f10e,null));};exports['create']=function(_0x345ddd,_0x2607c7){return db[_0x1cb9('0x33')]['create'](_0x345ddd[_0x1cb9('0x52')],{})[_0x1cb9('0x1b')](respondWithResult(_0x2607c7,0xc9))[_0x1cb9('0x4d')](handleError(_0x2607c7,null));};exports[_0x1cb9('0x53')]=function(_0x12d283,_0x3c4681){if(_0x12d283['body']['id']){delete _0x12d283[_0x1cb9('0x52')]['id'];}return db[_0x1cb9('0x33')][_0x1cb9('0x51')]({'where':{'id':_0x12d283[_0x1cb9('0x4f')]['id']}})[_0x1cb9('0x1b')](handleEntityNotFound(_0x3c4681,null))[_0x1cb9('0x1b')](saveUpdates(_0x12d283[_0x1cb9('0x52')],null))[_0x1cb9('0x1b')](respondWithResult(_0x3c4681,null))[_0x1cb9('0x4d')](handleError(_0x3c4681,null));};exports[_0x1cb9('0x2e')]=function(_0x370c97,_0x55fb51){return db[_0x1cb9('0x33')][_0x1cb9('0x51')]({'where':{'id':_0x370c97[_0x1cb9('0x4f')]['id']}})[_0x1cb9('0x1b')](handleEntityNotFound(_0x55fb51,null))['then'](removeEntity(_0x55fb51,null))['catch'](handleError(_0x55fb51,null));};exports[_0x1cb9('0x54')]=function(_0x2f8f27,_0x31eccc){return db[_0x1cb9('0x33')][_0x1cb9('0x54')]()[_0x1cb9('0x1b')](respondWithResult(_0x31eccc,null))[_0x1cb9('0x4d')](handleError(_0x31eccc,null));};exports[_0x1cb9('0x55')]=function(_0x478bba,_0x49f74c,_0x748140){if(_0x478bba['body']['id']){delete _0x478bba['body']['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x478bba['params']['id']}})[_0x1cb9('0x1b')](handleEntityNotFound(_0x49f74c,null))[_0x1cb9('0x1b')](function(_0xe21f20){if(_0xe21f20){_0x478bba[_0x1cb9('0x52')][_0x1cb9('0x56')]=_0xe21f20['id'];return db[_0x1cb9('0x57')]['create'](_0x478bba[_0x1cb9('0x52')]);}})[_0x1cb9('0x1b')](respondWithResult(_0x49f74c,null))['catch'](handleError(_0x49f74c,null));};exports['getDispositions']=function(_0x150441,_0x7b3380,_0x2e818f){var _0x2edf80={'raw':![],'where':{}};var _0x13ff8b={};var _0x51ce73={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x150441[_0x1cb9('0x4f')]['id']}})[_0x1cb9('0x1b')](handleEntityNotFound(_0x7b3380,null))[_0x1cb9('0x1b')](function(_0x2e83fe){if(_0x2e83fe){_0x13ff8b[_0x1cb9('0x35')]=_['keys'](db[_0x1cb9('0x57')][_0x1cb9('0x34')]);_0x13ff8b['query']=_['keys'](_0x150441[_0x1cb9('0x38')]);_0x13ff8b['filters']=_[_0x1cb9('0x3a')](_0x13ff8b[_0x1cb9('0x35')],_0x13ff8b[_0x1cb9('0x38')]);_0x2edf80[_0x1cb9('0x3b')]=_[_0x1cb9('0x3a')](_0x13ff8b[_0x1cb9('0x35')],qs['fields'](_0x150441[_0x1cb9('0x38')][_0x1cb9('0x3c')]));_0x2edf80[_0x1cb9('0x3b')]=_0x2edf80[_0x1cb9('0x3b')]['length']?_0x2edf80['attributes']:_0x13ff8b[_0x1cb9('0x35')];if(!_0x150441[_0x1cb9('0x38')][_0x1cb9('0x3d')](_0x1cb9('0x3e'))){_0x2edf80[_0x1cb9('0x29')]=qs[_0x1cb9('0x29')](_0x150441['query'][_0x1cb9('0x29')]);_0x2edf80['offset']=qs[_0x1cb9('0x28')](_0x150441[_0x1cb9('0x38')]['offset']);}_0x2edf80[_0x1cb9('0x58')]=qs[_0x1cb9('0x3f')](_0x150441[_0x1cb9('0x38')]['sort']);_0x2edf80[_0x1cb9('0x45')]=qs[_0x1cb9('0x40')](_[_0x1cb9('0x41')](_0x150441[_0x1cb9('0x38')],_0x13ff8b[_0x1cb9('0x40')]));_0x2edf80[_0x1cb9('0x45')]['ChatWebsiteId']=_0x2e83fe['id'];if(_0x150441[_0x1cb9('0x38')][_0x1cb9('0x46')]){_0x2edf80[_0x1cb9('0x45')]=_[_0x1cb9('0x44')](_0x2edf80[_0x1cb9('0x45')],{'$or':_[_0x1cb9('0x47')](_0x2edf80[_0x1cb9('0x3b')],function(_0x37bcd9){var _0x4cd544={};_0x4cd544[_0x37bcd9]={'$like':'%'+_0x150441[_0x1cb9('0x38')][_0x1cb9('0x46')]+'%'};return _0x4cd544;})});}_0x2edf80=_['merge']({},_0x2edf80,_0x150441[_0x1cb9('0x48')]);return db['Disposition'][_0x1cb9('0x49')]({'where':_0x2edf80['where']})['then'](function(_0x1618cb){_0x51ce73[_0x1cb9('0x49')]=_0x1618cb;if(_0x150441['query'][_0x1cb9('0x4a')]){_0x2edf80['include']=[{'all':!![]}];}return db[_0x1cb9('0x57')][_0x1cb9('0x4b')](_0x2edf80);})[_0x1cb9('0x1b')](function(_0xb1e45){_0x51ce73['rows']=_0xb1e45;return _0x51ce73;});}})[_0x1cb9('0x1b')](respondWithFilteredResult(_0x7b3380,_0x2edf80))[_0x1cb9('0x4d')](handleError(_0x7b3380,null));};exports[_0x1cb9('0x59')]=function(_0x27cc3c,_0x4f8d74,_0x14fc13){var _0x4cb014;return db[_0x1cb9('0x33')][_0x1cb9('0x51')]({'where':{'id':_0x27cc3c[_0x1cb9('0x4f')]['id']}})[_0x1cb9('0x1b')](handleEntityNotFound(_0x4f8d74,null))[_0x1cb9('0x1b')](function(_0x41ea70){if(_0x41ea70){return _0x41ea70['removeDispositions'](_0x27cc3c[_0x1cb9('0x38')][_0x1cb9('0x5a')]);}})['then'](respondWithStatusCode(_0x4f8d74,null))[_0x1cb9('0x4d')](handleError(_0x4f8d74,null));};exports[_0x1cb9('0x5b')]=function(_0x4765e3,_0x1aabfb,_0x2effa8){if(_0x4765e3[_0x1cb9('0x52')]['id']){delete _0x4765e3[_0x1cb9('0x52')]['id'];}return db['ChatWebsite'][_0x1cb9('0x51')]({'where':{'id':_0x4765e3['params']['id']}})[_0x1cb9('0x1b')](handleEntityNotFound(_0x1aabfb,null))[_0x1cb9('0x1b')](function(_0x50dd60){if(_0x50dd60){_0x4765e3[_0x1cb9('0x52')][_0x1cb9('0x56')]=_0x50dd60['id'];return db[_0x1cb9('0x5c')][_0x1cb9('0x5d')](_0x4765e3['body']);}})[_0x1cb9('0x1b')](respondWithResult(_0x1aabfb,null))[_0x1cb9('0x4d')](handleError(_0x1aabfb,null));};exports[_0x1cb9('0x5e')]=function(_0x5d0e8c,_0x10f13e,_0xe3ee8e){var _0x3b456a={'raw':![],'where':{}};var _0x3d287f={};var _0x10b508={'count':0x0,'rows':[]};return db[_0x1cb9('0x33')][_0x1cb9('0x5f')]({'where':{'id':_0x5d0e8c['params']['id']}})[_0x1cb9('0x1b')](handleEntityNotFound(_0x10f13e,null))['then'](function(_0x27f1d2){if(_0x27f1d2){_0x3d287f[_0x1cb9('0x35')]=_[_0x1cb9('0x39')](db[_0x1cb9('0x5c')]['rawAttributes']);_0x3d287f[_0x1cb9('0x38')]=_[_0x1cb9('0x39')](_0x5d0e8c['query']);_0x3d287f[_0x1cb9('0x40')]=_[_0x1cb9('0x3a')](_0x3d287f[_0x1cb9('0x35')],_0x3d287f[_0x1cb9('0x38')]);_0x3b456a[_0x1cb9('0x3b')]=_['intersection'](_0x3d287f['model'],qs['fields'](_0x5d0e8c['query'][_0x1cb9('0x3c')]));_0x3b456a[_0x1cb9('0x3b')]=_0x3b456a[_0x1cb9('0x3b')][_0x1cb9('0x50')]?_0x3b456a[_0x1cb9('0x3b')]:_0x3d287f[_0x1cb9('0x35')];if(!_0x5d0e8c[_0x1cb9('0x38')][_0x1cb9('0x3d')]('nolimit')){_0x3b456a[_0x1cb9('0x29')]=qs[_0x1cb9('0x29')](_0x5d0e8c[_0x1cb9('0x38')]['limit']);_0x3b456a[_0x1cb9('0x28')]=qs[_0x1cb9('0x28')](_0x5d0e8c['query'][_0x1cb9('0x28')]);}_0x3b456a[_0x1cb9('0x58')]=qs[_0x1cb9('0x3f')](_0x5d0e8c[_0x1cb9('0x38')]['sort']);_0x3b456a[_0x1cb9('0x45')]=qs[_0x1cb9('0x40')](_['pick'](_0x5d0e8c['query'],_0x3d287f[_0x1cb9('0x40')]));_0x3b456a[_0x1cb9('0x45')]['ChatWebsiteId']=_0x27f1d2['id'];if(_0x5d0e8c['query'][_0x1cb9('0x46')]){_0x3b456a[_0x1cb9('0x45')]=_['merge'](_0x3b456a['where'],{'$or':_[_0x1cb9('0x47')](_0x3b456a['attributes'],function(_0x5eeed6){var _0x548fc3={};_0x548fc3[_0x5eeed6]={'$like':'%'+_0x5d0e8c[_0x1cb9('0x38')]['filter']+'%'};return _0x548fc3;})});}_0x3b456a=_[_0x1cb9('0x44')]({},_0x3b456a,_0x5d0e8c[_0x1cb9('0x48')]);return db[_0x1cb9('0x5c')]['count']({'where':_0x3b456a[_0x1cb9('0x45')]})[_0x1cb9('0x1b')](function(_0x146a57){_0x10b508['count']=_0x146a57;if(_0x5d0e8c[_0x1cb9('0x38')][_0x1cb9('0x4a')]){_0x3b456a[_0x1cb9('0x60')]=[{'all':!![]}];}return db[_0x1cb9('0x5c')][_0x1cb9('0x4b')](_0x3b456a);})['then'](function(_0x19bd03){_0x10b508[_0x1cb9('0x4c')]=_0x19bd03;return _0x10b508;});}})[_0x1cb9('0x1b')](respondWithFilteredResult(_0x10f13e,_0x3b456a))['catch'](handleError(_0x10f13e,null));};exports[_0x1cb9('0x61')]=function(_0x81962d,_0x534378,_0x229182){var _0xea6f6c;return db['ChatWebsite'][_0x1cb9('0x51')]({'where':{'id':_0x81962d[_0x1cb9('0x4f')]['id']}})[_0x1cb9('0x1b')](handleEntityNotFound(_0x534378,null))[_0x1cb9('0x1b')](function(_0x2f19e5){if(_0x2f19e5){return _0x2f19e5[_0x1cb9('0x61')](_0x81962d[_0x1cb9('0x38')][_0x1cb9('0x5a')]);}})[_0x1cb9('0x1b')](respondWithStatusCode(_0x534378,null))[_0x1cb9('0x4d')](handleError(_0x534378,null));};exports[_0x1cb9('0x62')]=function(_0x2bb5a2,_0x2f334c,_0x1b2b1c){_0x2bb5a2[_0x1cb9('0x52')][_0x1cb9('0x63')]=_0x2bb5a2[_0x1cb9('0x64')][_0x1cb9('0x65')];return db['ChatWebsite']['find']({'where':{'id':_0x2bb5a2[_0x1cb9('0x4f')]['id']}})[_0x1cb9('0x1b')](handleEntityNotFound(_0x2f334c,null))[_0x1cb9('0x1b')](saveUpdates(_0x2bb5a2[_0x1cb9('0x52')],null))[_0x1cb9('0x1b')](respondWithResult(_0x2f334c,null))[_0x1cb9('0x4d')](handleError(_0x2f334c,null));};exports[_0x1cb9('0x66')]=function(_0x56251d,_0x4d8b0f,_0x1d14a4){_0x56251d[_0x1cb9('0x52')][_0x1cb9('0x67')]=_0x56251d[_0x1cb9('0x64')][_0x1cb9('0x65')];return db['ChatWebsite'][_0x1cb9('0x51')]({'where':{'id':_0x56251d[_0x1cb9('0x4f')]['id']}})[_0x1cb9('0x1b')](handleEntityNotFound(_0x4d8b0f,null))['then'](saveUpdates(_0x56251d[_0x1cb9('0x52')],null))[_0x1cb9('0x1b')](respondWithResult(_0x4d8b0f,null))[_0x1cb9('0x4d')](handleError(_0x4d8b0f,null));};exports['addCustomerAvatar']=function(_0x17fc5a,_0x407a2d,_0x21062b){_0x17fc5a['body']['customerAvatar']=_0x17fc5a['file'][_0x1cb9('0x65')];return db[_0x1cb9('0x33')][_0x1cb9('0x51')]({'where':{'id':_0x17fc5a['params']['id']}})[_0x1cb9('0x1b')](handleEntityNotFound(_0x407a2d,null))['then'](saveUpdates(_0x17fc5a['body'],null))[_0x1cb9('0x1b')](respondWithResult(_0x407a2d,null))[_0x1cb9('0x4d')](handleError(_0x407a2d,null));};exports[_0x1cb9('0x68')]=function(_0x2fa5b8,_0x2b31b7,_0x2ea265){_0x2fa5b8[_0x1cb9('0x52')][_0x1cb9('0x69')]=_0x2fa5b8[_0x1cb9('0x64')][_0x1cb9('0x65')];return db['ChatWebsite']['find']({'where':{'id':_0x2fa5b8[_0x1cb9('0x4f')]['id']}})[_0x1cb9('0x1b')](handleEntityNotFound(_0x2b31b7,null))['then'](saveUpdates(_0x2fa5b8['body'],null))['then'](respondWithResult(_0x2b31b7,null))['catch'](handleError(_0x2b31b7,null));};exports[_0x1cb9('0x6a')]=function(_0xd0e4eb,_0x58c0b5,_0x20066e){var _0x1d660e=path[_0x1cb9('0x6b')](config[_0x1cb9('0x6c')],_0x1cb9('0x6d'));var _0x5218ea={'where':{'id':_0xd0e4eb[_0x1cb9('0x4f')]['id']},'attributes':['id',_0x1cb9('0x63')],'raw':!![]};var _0x8f6197=![];return require(_0x1cb9('0x6e'))['getLicense']()[_0x1cb9('0x1b')](function(_0x3d82b0){if(_0x3d82b0){_0x8f6197=_0x3d82b0['custom'];}})['then'](function(){return db['ChatWebsite'][_0x1cb9('0x51')](_0x5218ea);})['then'](handleEntityNotFound(_0x58c0b5,null))[_0x1cb9('0x1b')](function(_0x3506d7){if(_0x3506d7){if(!_[_0x1cb9('0x6f')](_0x3506d7[_0x1cb9('0x63')])){if(fs[_0x1cb9('0x70')](path[_0x1cb9('0x6b')](config['root'],_0x1cb9('0x71'),_0x3506d7[_0x1cb9('0x63')]))&&_0x8f6197){_0x1d660e=path[_0x1cb9('0x6b')](config[_0x1cb9('0x6c')],_0x1cb9('0x71'),_0x3506d7[_0x1cb9('0x63')]);}}return _0x58c0b5[_0x1cb9('0x72')](_0x1d660e);}})[_0x1cb9('0x4d')](handleError(_0x58c0b5,null));};exports[_0x1cb9('0x73')]=function(_0x1674b1,_0xa2b077,_0x30ac63){var _0x44d2e2=path[_0x1cb9('0x6b')](config[_0x1cb9('0x6c')],'server/files/images/avatars/default_avatar.png');var _0x592c04={'where':{'id':_0x1674b1['params']['id']},'attributes':['id',_0x1cb9('0x67')],'raw':!![]};return db[_0x1cb9('0x33')]['find'](_0x592c04)[_0x1cb9('0x1b')](handleEntityNotFound(_0xa2b077,null))[_0x1cb9('0x1b')](function(_0x3cc39d){if(_0x3cc39d){if(!_['isNil'](_0x3cc39d[_0x1cb9('0x67')])){if(fs[_0x1cb9('0x70')](path[_0x1cb9('0x6b')](config[_0x1cb9('0x6c')],_0x1cb9('0x74'),_0x3cc39d['agentAvatar']))){_0x44d2e2=path[_0x1cb9('0x6b')](config['root'],'server/files/images/avatars/',_0x3cc39d[_0x1cb9('0x67')]);}}return _0xa2b077[_0x1cb9('0x72')](_0x44d2e2);}})[_0x1cb9('0x4d')](handleError(_0xa2b077,null));};exports[_0x1cb9('0x75')]=function(_0x35a487,_0x2b0ab9,_0x9a7b76){var _0x3104f4=path['join'](config[_0x1cb9('0x6c')],_0x1cb9('0x76'));var _0x370df9={'where':{'id':_0x35a487[_0x1cb9('0x4f')]['id']},'attributes':['id',_0x1cb9('0x77'),'showCustomerAvatar'],'raw':!![]};return db[_0x1cb9('0x33')][_0x1cb9('0x51')](_0x370df9)[_0x1cb9('0x1b')](handleEntityNotFound(_0x2b0ab9,null))[_0x1cb9('0x1b')](function(_0xd9459b){if(_0xd9459b){if(!_['isNil'](_0xd9459b[_0x1cb9('0x77')])){if(fs[_0x1cb9('0x70')](path[_0x1cb9('0x6b')](config['root'],_0x1cb9('0x74'),_0xd9459b[_0x1cb9('0x77')]))&&_0xd9459b[_0x1cb9('0x78')]){_0x3104f4=path[_0x1cb9('0x6b')](config[_0x1cb9('0x6c')],_0x1cb9('0x74'),_0xd9459b['customerAvatar']);}}return _0x2b0ab9[_0x1cb9('0x72')](_0x3104f4);}})[_0x1cb9('0x4d')](handleError(_0x2b0ab9,null));};exports[_0x1cb9('0x79')]=function(_0x5d230a,_0x142f08,_0x2485b9){var _0x507038=path['join'](config[_0x1cb9('0x6c')],_0x1cb9('0x7a'));var _0xe867bd={'where':{'id':_0x5d230a[_0x1cb9('0x4f')]['id']},'attributes':['id',_0x1cb9('0x69')],'raw':!![]};return db['ChatWebsite'][_0x1cb9('0x51')](_0xe867bd)[_0x1cb9('0x1b')](handleEntityNotFound(_0x142f08,null))[_0x1cb9('0x1b')](function(_0x3180dd){if(_0x3180dd){if(!_[_0x1cb9('0x6f')](_0x3180dd['systemAvatar'])){if(fs['existsSync'](path[_0x1cb9('0x6b')](config[_0x1cb9('0x6c')],_0x1cb9('0x74'),_0x3180dd['systemAvatar']))){_0x507038=path['join'](config[_0x1cb9('0x6c')],_0x1cb9('0x74'),_0x3180dd[_0x1cb9('0x69')]);}}return _0x142f08['download'](_0x507038);}})['catch'](handleError(_0x142f08,null));};exports['notify']=function(_0x3dde48,_0x194d6d,_0x27995f){var _0x5268fa=require(_0x1cb9('0x7b'));var _0x5311dd=new _0x5268fa();var _0xf571af=_0x5311dd[_0x1cb9('0x7c')](_0x3dde48[_0x1cb9('0x7d')][_0x1cb9('0x7e')])[_0x1cb9('0x7f')]();var _0x501799={'body':_0x3dde48[_0x1cb9('0x52')],'channel':'chat'};var _0xa6c674=[];var _0x2580b9=[];var _0x130136={};var _0x1d75d0=![];return db[_0x1cb9('0x80')]['describe']()[_0x1cb9('0x1b')](function(_0x174147){if(!_0x174147){throw new db[(_0x1cb9('0x81'))][(_0x1cb9('0x82'))](_0x1cb9('0x83'));}_0xa6c674=_[_0x1cb9('0x84')](_[_0x1cb9('0x39')](_0x174147),['createdAt','updatedAt']);_0x2580b9=_[_0x1cb9('0x84')](_[_0x1cb9('0x39')](_0x174147),[_0x1cb9('0x85'),_0x1cb9('0x86'),_0x1cb9('0x87'),'ListId']);if(_0x3dde48[_0x1cb9('0x52')]['id']){delete _0x3dde48[_0x1cb9('0x52')]['id'];}if(_['isNil'](_0x3dde48['body'][_0x1cb9('0x88')])){throw new db['Sequelize'][(_0x1cb9('0x82'))]('from\x20is\x20mandatory');}if(_[_0x1cb9('0x6f')](_0x3dde48[_0x1cb9('0x52')][_0x1cb9('0x52')])||_0x3dde48[_0x1cb9('0x52')][_0x1cb9('0x52')]===''){throw new db[(_0x1cb9('0x81'))][(_0x1cb9('0x82'))](_0x1cb9('0x89'));}if(_[_0x1cb9('0x6f')](_0x3dde48[_0x1cb9('0x52')][_0x1cb9('0x8a')])){throw new db[(_0x1cb9('0x81'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2580b9);}if(!_['includes'](_0x2580b9,_0x3dde48['body'][_0x1cb9('0x8a')])){throw new db[(_0x1cb9('0x81'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2580b9);}_0x130136[_0x3dde48['body'][_0x1cb9('0x8a')]]=_0x3dde48[_0x1cb9('0x52')][_0x1cb9('0x88')];})[_0x1cb9('0x1b')](function(){return db['ChatWebsite'][_0x1cb9('0x51')]({'where':{'id':_0x3dde48[_0x1cb9('0x4f')]['id']},'include':[{'model':db[_0x1cb9('0x8b')],'as':'List','include':[{'model':db[_0x1cb9('0x80')],'as':_0x1cb9('0x8c'),'where':_0x130136,'limit':0x1,'order':[['updatedAt',_0x1cb9('0x8d')]]}]},{'model':db['ChatApplication'],'as':_0x1cb9('0x8e')}]});})[_0x1cb9('0x1b')](handleEntityNotFound(_0x194d6d,null))[_0x1cb9('0x1b')](function(_0x308d5d){if(_0x308d5d&&_0x308d5d[_0x1cb9('0x8f')]){_0x501799[_0x1cb9('0x90')]=_0x308d5d;_0x501799[_0x1cb9('0x91')]=_0x308d5d['Applications'];_0x501799[_0x1cb9('0x92')]=_0x308d5d[_0x1cb9('0x8f')];_0x501799[_0x1cb9('0x91')]=_[_0x1cb9('0x93')](_0x501799[_0x1cb9('0x91')],[_0x1cb9('0x94')],[_0x1cb9('0x95')]);if(_0x501799[_0x1cb9('0x90')][_0x1cb9('0x8e')]){delete _0x501799[_0x1cb9('0x90')]['Applications'];}if(_0x501799[_0x1cb9('0x90')][_0x1cb9('0x8f')]&&_0x501799[_0x1cb9('0x90')][_0x1cb9('0x8f')][_0x1cb9('0x8c')]['length']){return _0x501799[_0x1cb9('0x90')]['List']['Contacts'][0x0];}var _0x44f38a=_[_0x1cb9('0x14')](_0x3dde48[_0x1cb9('0x52')],{'firstName':_0x3dde48[_0x1cb9('0x52')][_0x1cb9('0x88')],'ListId':_0x308d5d[_0x1cb9('0x96')]});_0x44f38a[_0x3dde48[_0x1cb9('0x52')][_0x1cb9('0x8a')]]=_0x3dde48[_0x1cb9('0x52')]['from'];return db['CmContact'][_0x1cb9('0x5d')](_0x44f38a,{'fields':_0xa6c674,'raw':!![]});}})[_0x1cb9('0x1b')](handleEntityNotFound(_0x194d6d,null))[_0x1cb9('0x1b')](function(_0x4516d1){_0x501799[_0x1cb9('0x97')]=_0x4516d1;if(_0x4516d1){var _0x2d65fe={'ContactId':_0x4516d1['id'],'ChatWebsiteId':_0x3dde48[_0x1cb9('0x4f')]['id'],'from':(_0x4516d1[_0x1cb9('0x98')]||'')+'\x20'+(_0x4516d1[_0x1cb9('0x99')]||''),'customerIp':_0x3dde48[_0x1cb9('0x52')]['customerIp'],'referer':_0x3dde48[_0x1cb9('0x52')][_0x1cb9('0x9a')],'browserName':_0xf571af[_0x1cb9('0x9b')][_0x1cb9('0x9c')]&&_0xf571af[_0x1cb9('0x9b')][_0x1cb9('0x9d')]?util['format'](_0x1cb9('0x9e'),_0xf571af[_0x1cb9('0x9b')][_0x1cb9('0x9c')],_0xf571af[_0x1cb9('0x9b')][_0x1cb9('0x9d')]):_0x1cb9('0x9f'),'browserVersion':_0xf571af[_0x1cb9('0x9b')]['version']||_0x1cb9('0x9f'),'osName':util[_0x1cb9('0xa0')](_0x1cb9('0x9e'),_0xf571af['os'][_0x1cb9('0x9c')],_0xf571af['os'][_0x1cb9('0x9d')]),'osVersion':_0xf571af['os'][_0x1cb9('0x9d')],'deviceModel':_0xf571af[_0x1cb9('0xa1')][_0x1cb9('0x35')]&&_0xf571af[_0x1cb9('0xa1')][_0x1cb9('0xa2')]?util[_0x1cb9('0xa0')](_0x1cb9('0xa3'),_0xf571af[_0x1cb9('0xa1')][_0x1cb9('0x35')],_0xf571af[_0x1cb9('0xa1')][_0x1cb9('0xa2')],_0xf571af[_0x1cb9('0xa1')][_0x1cb9('0xa4')]):null,'deviceVendor':_0xf571af[_0x1cb9('0xa1')][_0x1cb9('0xa2')],'deviceType':_0xf571af[_0x1cb9('0xa1')][_0x1cb9('0xa4')],'formData':JSON['stringify'](_0x3dde48[_0x1cb9('0x52')])};var _0xd823a1={'ChatWebsiteId':_0x3dde48[_0x1cb9('0x4f')]['id'],'closed':![]};if(_0x3dde48[_0x1cb9('0x52')][_0x1cb9('0xa5')]){_0xd823a1[_0x1cb9('0xa5')]=_0x3dde48['body'][_0x1cb9('0xa5')];return db['ChatInteraction'][_0x1cb9('0x51')]({'where':_0xd823a1})[_0x1cb9('0x1b')](function(_0x41634e){if(_0x41634e){return[_0x41634e,![]];}_0x2d65fe['threadId']=_0x3dde48[_0x1cb9('0x52')][_0x1cb9('0xa5')];_0x2d65fe[_0x1cb9('0xa6')]=_0x3dde48[_0x1cb9('0x52')]['externalUrl'];return db[_0x1cb9('0xa7')][_0x1cb9('0x5d')](_0x2d65fe)[_0x1cb9('0x1b')](function(_0x283900){return[_0x283900,!![]];});});}_0xd823a1['ContactId']=_0x4516d1['id'];if(_0x3dde48[_0x1cb9('0x52')][_0x1cb9('0xa8')]&&_0x3dde48['body'][_0x1cb9('0xa8')]['id']){_0xd823a1['id']=_0x3dde48[_0x1cb9('0x52')][_0x1cb9('0xa8')]['id'];return db[_0x1cb9('0xa7')][_0x1cb9('0x51')]({'where':_0xd823a1})[_0x1cb9('0x1b')](function(_0x27e331){if(_0x27e331){return[_0x27e331,![]];}return db[_0x1cb9('0xa7')][_0x1cb9('0x5d')](_0x2d65fe)[_0x1cb9('0x1b')](function(_0x2a6862){return[_0x2a6862,!![]];});});}return db['ChatInteraction'][_0x1cb9('0x5d')](_0x2d65fe)['then'](function(_0x330e74){return[_0x330e74,!![]];});}})[_0x1cb9('0xa9')](function(_0xc4ac8b,_0x2b647a){if(_0xc4ac8b){_0x1d75d0=_0x2b647a;if(!_0x2b647a){return _0xc4ac8b[_0x1cb9('0x53')]({'from':(_0x501799[_0x1cb9('0x97')][_0x1cb9('0x98')]||'')+'\x20'+(_0x501799[_0x1cb9('0x97')][_0x1cb9('0x99')]||'')});}else{return _0xc4ac8b;}}})[_0x1cb9('0x1b')](function(_0x2da3c4){_0x501799[_0x1cb9('0xa8')]=_0x2da3c4[_0x1cb9('0xaa')]({'plain':!![]});_0x501799['interaction'][_0x1cb9('0xab')]=_0x1d75d0;if(_0x501799[_0x1cb9('0xa8')][_0x1cb9('0xab')]){if(_0x501799['account']['autoclose']){_0x501799['applications'][_0x1cb9('0xac')]({'id':0x0,'priority':_0x501799[_0x1cb9('0x91')]['length']+0x1,'app':_0x1cb9('0xad'),'appdata':_0x1cb9('0xae'),'interval':_0x1cb9('0xaf')});}}return db[_0x1cb9('0xb0')][_0x1cb9('0x5d')]({'body':_0x3dde48['body'][_0x1cb9('0x52')],'ChatWebsiteId':_0x3dde48[_0x1cb9('0x4f')]['id'],'ChatInteractionId':_0x2da3c4['id'],'direction':'in','ContactId':_0x501799[_0x1cb9('0x97')]['id'],'AttachmentId':_0x3dde48[_0x1cb9('0x52')]['AttachmentId']});})[_0x1cb9('0x1b')](function(_0x27110c){_0x501799[_0x1cb9('0x23')]=_0x27110c;if(_0x501799[_0x1cb9('0xa8')][_0x1cb9('0xb1')]){return db[_0x1cb9('0xb2')]['find']({'attributes':['id',_0x1cb9('0x9c')],'where':{'id':_0x501799[_0x1cb9('0xa8')][_0x1cb9('0xb1')]}})[_0x1cb9('0x1b')](function(_0x339ed4){if(_0x339ed4){_0x501799[_0x1cb9('0x91')][_0x1cb9('0xb3')]({'id':0x0,'priority':0x0,'app':_0x1cb9('0xb4'),'appdata':_0x339ed4[_0x1cb9('0x9c')]+','+(_0x501799[_0x1cb9('0x90')][_0x1cb9('0xb5')]||0xa),'interval':'*,*,*,*'});_0x501799[_0x1cb9('0xb6')]=!![];}return respondWithRpcPromise(_0x1cb9('0xb7'),'startRouting',_0x501799);});}return respondWithRpcPromise(_0x1cb9('0xb7'),'startRouting',_0x501799);})[_0x1cb9('0x1b')](function(_0x28f70a){respondWithRpcPromise(_0x1cb9('0xb8'),_0x1cb9('0xb8'),{'event':_0x1cb9('0xb9'),'message':_0x28f70a},client9002);return _0x28f70a;})[_0x1cb9('0x1b')](respondWithResult(_0x194d6d,null))[_0x1cb9('0x4d')](handleError(_0x194d6d,null));};exports[_0x1cb9('0xba')]=function(_0x370931,_0x486150,_0x5c0339){var _0x51c15d,_0x3f7130,_0x343962;var _0x1b5d75=[];var _0x5d7c4b=[];var _0xbef03a={};return db[_0x1cb9('0x80')][_0x1cb9('0x54')]()[_0x1cb9('0x1b')](function(_0x4e225c){if(!_0x4e225c){throw new db['Sequelize'][(_0x1cb9('0x82'))](_0x1cb9('0x83'));}_0x5d7c4b=_['difference'](_[_0x1cb9('0x39')](_0x4e225c),[_0x1cb9('0x85'),'updatedAt']);_0x1b5d75=_[_0x1cb9('0x84')](_[_0x1cb9('0x39')](_0x4e225c),[_0x1cb9('0x85'),'updatedAt','CompanyId',_0x1cb9('0x96')]);if(_0x370931[_0x1cb9('0x52')]['id']){delete _0x370931['body']['id'];}if(_[_0x1cb9('0x6f')](_0x370931[_0x1cb9('0x52')][_0x1cb9('0x88')])){throw _0x486150[_0x1cb9('0x26')](0x1f4)['send'](new db[(_0x1cb9('0x81'))][(_0x1cb9('0x82'))](_0x1cb9('0xbb')));}if(_[_0x1cb9('0x6f')](_0x370931[_0x1cb9('0x52')]['body'])||_0x370931[_0x1cb9('0x52')]['body']===''){throw _0x486150[_0x1cb9('0x26')](0x1f4)['send'](new db[(_0x1cb9('0x81'))]['ValidationError'](_0x1cb9('0x89')));}if(_[_0x1cb9('0x6f')](_0x370931[_0x1cb9('0x52')][_0x1cb9('0xbc')])){throw _0x486150[_0x1cb9('0x26')](0x1f4)[_0x1cb9('0x31')](new db[(_0x1cb9('0x81'))][(_0x1cb9('0x82'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1b5d75));}if(!_[_0x1cb9('0xbd')](_0x1b5d75,_0x370931[_0x1cb9('0x52')][_0x1cb9('0xbc')])){throw _0x486150[_0x1cb9('0x26')](0x1f4)[_0x1cb9('0x31')](new db[(_0x1cb9('0x81'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1b5d75));}_0xbef03a[_0x370931[_0x1cb9('0x52')][_0x1cb9('0xbc')]]=_0x370931[_0x1cb9('0x52')][_0x1cb9('0x88')];})[_0x1cb9('0x1b')](function(){return db[_0x1cb9('0x33')]['find']({'where':{'id':_0x370931['params']['id']},'include':[{'model':db[_0x1cb9('0x8b')],'as':_0x1cb9('0x8f')}]});})[_0x1cb9('0x1b')](handleEntityNotFound(_0x486150,null))['then'](function(_0x41ee10){if(_0x41ee10&&_0x41ee10[_0x1cb9('0x8f')]){_0x3f7130=_0x41ee10;var _0x2f7144=_['defaults'](_0x370931[_0x1cb9('0x52')],{'firstName':_0x370931[_0x1cb9('0x52')][_0x1cb9('0x88')],'phone':_0x370931[_0x1cb9('0x52')][_0x1cb9('0x88')],'ListId':_0x41ee10[_0x1cb9('0x96')]});_0x2f7144[_0x370931[_0x1cb9('0x52')][_0x1cb9('0xbc')]]=_0x370931[_0x1cb9('0x52')][_0x1cb9('0x88')];return db[_0x1cb9('0x80')][_0x1cb9('0xbe')]({'where':_0xbef03a,'defaults':_0x2f7144});}})['spread'](function(_0x1ab1c7){if(_0x1ab1c7){_0x343962=_0x1ab1c7;var _0x5ce87d=fs['readFileSync'](path['join'](config['root'],_0x1cb9('0xbf')),_0x1cb9('0xc0'));var _0x4e9fd1=ejs[_0x1cb9('0xc1')](_0x5ce87d,{'body':_['toPairs'](_0x370931[_0x1cb9('0x52')][_0x1cb9('0x52')]),'bodyTitle':_0x3f7130[_0x1cb9('0xc2')]});return db['ChatOfflineMessage'][_0x1cb9('0x5d')]({'body':_0x4e9fd1,'ContactId':_0x1ab1c7['id'],'ChatWebsiteId':_0x3f7130['id']});}})[_0x1cb9('0x1b')](function(_0x216ac3){if(_0x216ac3){_0x51c15d=_0x216ac3;return db[_0x1cb9('0xc3')][_0x1cb9('0x5f')]({'where':{'service':!![]},'include':[{'model':db[_0x1cb9('0xc4')],'as':_0x1cb9('0xc5'),'raw':!![]}]});}})[_0x1cb9('0x1b')](function(_0x4fb8f9){if(_0x4fb8f9&&_0x4fb8f9[_0x1cb9('0xc5')]&&_0x3f7130['forwardOfflineAddress']){var _0x1415a2={'tls':{'rejectUnauthorized':![]}};if(_0x4fb8f9['Smtp'][_0x1cb9('0xc6')]){_0x1415a2[_0x1cb9('0xc6')]=_0x4fb8f9[_0x1cb9('0xc5')]['service'];}else{_0x1415a2[_0x1cb9('0xc7')]=_0x4fb8f9[_0x1cb9('0xc5')][_0x1cb9('0xc7')];_0x1415a2[_0x1cb9('0xc8')]=_0x4fb8f9[_0x1cb9('0xc5')]['port'];_0x1415a2[_0x1cb9('0xc9')]=_0x4fb8f9[_0x1cb9('0xc5')][_0x1cb9('0xc9')];}if(_0x4fb8f9['Smtp'][_0x1cb9('0xca')]){_0x1415a2[_0x1cb9('0xcb')]={'user':_0x4fb8f9[_0x1cb9('0xc5')][_0x1cb9('0xcc')],'pass':_0x4fb8f9['Smtp'][_0x1cb9('0xcd')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x1415a2,'message':{'from':util[_0x1cb9('0xa0')]('\x22%s\x22\x20<%s>',_0x4fb8f9[_0x1cb9('0x9c')],_0x4fb8f9['email']||_0x4fb8f9[_0x1cb9('0xc5')][_0x1cb9('0xcc')]),'to':_0x3f7130['forwardOfflineAddress'],'subject':_0x3f7130[_0x1cb9('0xce')],'text':_0x51c15d[_0x1cb9('0x52')]}},client9003)[_0x1cb9('0x1b')](function(){return _0x51c15d;})[_0x1cb9('0x4d')](function(_0x1effea){console[_0x1cb9('0x21')](_0x1effea);});}})['then'](function(){if(_0x51c15d){return _0x51c15d;}})[_0x1cb9('0x1b')](respondWithResult(_0x486150,null))[_0x1cb9('0x4d')](handleError(_0x486150,null));};exports[_0x1cb9('0xcf')]=function(_0x4067ae,_0xe6665b,_0x170033){return db['ChatInteraction']['find']({'where':{'id':_0x4067ae[_0x1cb9('0x4f')]['id']}})[_0x1cb9('0x1b')](handleEntityNotFound(_0xe6665b,null))[_0x1cb9('0x1b')](function(_0x33bfc1){if(_0x33bfc1){return _0x33bfc1['addInteraction'](_0x4067ae[_0x1cb9('0x52')][_0x1cb9('0x5a')],_[_0x1cb9('0xd0')](_0x4067ae['body'],[_0x1cb9('0x5a'),'id'])||{});}})[_0x1cb9('0x1b')](respondWithResult(_0xe6665b,null))['catch'](handleError(_0xe6665b,null));};exports[_0x1cb9('0xd1')]=function(_0x49b8cf,_0x5222dd,_0x22d179){var _0x13117a={'raw':![],'where':{}};var _0x25d7b0={};var _0x146ec2={'count':0x0,'rows':[]};return db[_0x1cb9('0x33')][_0x1cb9('0x5f')]({'where':{'id':_0x49b8cf[_0x1cb9('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5222dd,null))[_0x1cb9('0x1b')](function(_0x495fe6){if(_0x495fe6){_0x25d7b0[_0x1cb9('0x35')]=_[_0x1cb9('0x39')](db[_0x1cb9('0xa7')][_0x1cb9('0x34')]);_0x25d7b0['query']=_[_0x1cb9('0x39')](_0x49b8cf[_0x1cb9('0x38')]);_0x25d7b0[_0x1cb9('0x40')]=_['intersection'](_0x25d7b0[_0x1cb9('0x35')],_0x25d7b0['query']);_0x13117a['attributes']=_[_0x1cb9('0x3a')](_0x25d7b0['model'],qs[_0x1cb9('0x3c')](_0x49b8cf['query'][_0x1cb9('0x3c')]));_0x13117a[_0x1cb9('0x3b')]=_0x13117a[_0x1cb9('0x3b')][_0x1cb9('0x50')]?_0x13117a[_0x1cb9('0x3b')]:_0x25d7b0[_0x1cb9('0x35')];if(!_0x49b8cf[_0x1cb9('0x38')][_0x1cb9('0x3d')](_0x1cb9('0x3e'))){_0x13117a[_0x1cb9('0x29')]=qs[_0x1cb9('0x29')](_0x49b8cf[_0x1cb9('0x38')][_0x1cb9('0x29')]);_0x13117a['offset']=qs[_0x1cb9('0x28')](_0x49b8cf[_0x1cb9('0x38')]['offset']);}_0x13117a['order']=qs[_0x1cb9('0x3f')](_0x49b8cf[_0x1cb9('0x38')][_0x1cb9('0x3f')]);_0x13117a['where']=qs[_0x1cb9('0x40')](_[_0x1cb9('0x41')](_0x49b8cf['query'],_0x25d7b0[_0x1cb9('0x40')]));_0x13117a[_0x1cb9('0x45')][_0x1cb9('0x56')]=_0x495fe6['id'];if(_0x49b8cf[_0x1cb9('0x38')][_0x1cb9('0x46')]){_0x13117a[_0x1cb9('0x45')]=_['merge'](_0x13117a[_0x1cb9('0x45')],{'$or':_['map'](_0x13117a[_0x1cb9('0x3b')],function(_0x5ef01e){var _0x3680dd={};_0x3680dd[_0x5ef01e]={'$like':'%'+_0x49b8cf[_0x1cb9('0x38')][_0x1cb9('0x46')]+'%'};return _0x3680dd;})});}_0x13117a=_[_0x1cb9('0x44')]({},_0x13117a,_0x49b8cf[_0x1cb9('0x48')]);return db[_0x1cb9('0xa7')]['count']({'where':_0x13117a[_0x1cb9('0x45')]})[_0x1cb9('0x1b')](function(_0x4169d9){_0x146ec2['count']=_0x4169d9;if(_0x49b8cf['query'][_0x1cb9('0x4a')]){_0x13117a['include']=[{'model':db[_0x1cb9('0x80')],'as':_0x1cb9('0xd2'),'required':![]},{'model':db['User'],'as':_0x1cb9('0xd3'),'attributes':[_0x1cb9('0x9c'),_0x1cb9('0xd4'),_0x1cb9('0xd5')],'required':![]},{'model':db[_0x1cb9('0xd6')],'as':_0x1cb9('0xd7'),'attributes':['id',_0x1cb9('0x9c'),_0x1cb9('0xd8')],'where':_0x49b8cf[_0x1cb9('0x38')][_0x1cb9('0xd9')]?{'id':_0x49b8cf[_0x1cb9('0x38')][_0x1cb9('0xd9')]}:undefined,'required':_0x49b8cf['query'][_0x1cb9('0xd9')]?!![]:![]}];}return db[_0x1cb9('0xa7')][_0x1cb9('0x4b')](_0x13117a);})[_0x1cb9('0x1b')](function(_0xeab9b9){_0x146ec2['rows']=_0xeab9b9;return _0x146ec2;});}})[_0x1cb9('0x1b')](respondWithFilteredResult(_0x5222dd,_0x13117a))[_0x1cb9('0x4d')](handleError(_0x5222dd,null));};function iftimePromise(_0x557d95,_0x5d8a7b){return respondWithRpcPromise(_0x1cb9('0xda'),_0x1cb9('0xdb'),{'command':_0x5d8a7b[_0x1cb9('0xdc')]?util[_0x1cb9('0xa0')](_0x1cb9('0xdd'),_0x557d95['interval'],_0x5d8a7b[_0x1cb9('0xdc')]):util[_0x1cb9('0xa0')]('iftime\x20%s',_0x557d95[_0x1cb9('0xde')])},client9002)[_0x1cb9('0x1b')](function(_0x3d9dba){var _0x4d8cd0=_0x3d9dba&&_0x3d9dba['indexOf'](_0x1cb9('0xdf'))>=0x0?!![]:![];logger[_0x1cb9('0x1c')](_0x1cb9('0xe0'),_0x5d8a7b['id'],_0x557d95['id'],_0x557d95[_0x1cb9('0xde')],_0x4d8cd0?_0x1cb9('0xe1'):_0x1cb9('0xe2'),_0x5d8a7b[_0x1cb9('0xdc')]?_0x5d8a7b['timezone']:'No\x20timezone');return _0x4d8cd0;})['catch'](function(_0x272cbc){logger['error'](_0x1cb9('0xe0'),_0x5d8a7b['id'],_0x557d95['id'],_0x557d95[_0x1cb9('0xde')],util[_0x1cb9('0xe3')](_0x272cbc,{'showHidden':![],'depth':null}),_0x5d8a7b[_0x1cb9('0xdc')]?_0x5d8a7b[_0x1cb9('0xdc')]:'No\x20timezone');return![];});}exports[_0x1cb9('0xdb')]=function(_0x590374,_0x4ecf13,_0x2a4878){var _0x1eed9a=0x0;var _0x267b06=0x0;var _0x514b07=![];var _0x46c7fe;var _0x12b942;return db[_0x1cb9('0x33')][_0x1cb9('0x51')]({'where':{'id':_0x590374[_0x1cb9('0x4f')]['id']},'include':[{'model':db[_0x1cb9('0xe4')],'as':_0x1cb9('0xe4'),'include':[{'model':db[_0x1cb9('0xe4')],'as':_0x1cb9('0xe5'),'attributes':['id',_0x1cb9('0xde')],'raw':!![]}]}]})[_0x1cb9('0x1b')](handleEntityNotFound(_0x4ecf13,null))[_0x1cb9('0x1b')](function(_0x24d3ed){if(_0x24d3ed){_0x46c7fe=_0x24d3ed;return _0x24d3ed[_0x1cb9('0xe6')]({'raw':!![]});}})[_0x1cb9('0x1b')](function(_0x4b389b){if(_0x46c7fe){if(_0x4b389b){_0x12b942=_0x4b389b;}}return require(_0x1cb9('0x6e'))['getLicense']();})['then'](function(_0x1502f2){if(_0x1502f2){_0x267b06=_0x1502f2[_0x1cb9('0xe7')];_0x514b07=_0x1502f2[_0x1cb9('0xe8')];}})[_0x1cb9('0x1b')](function(){return db[_0x1cb9('0xa7')][_0x1cb9('0x49')]({'where':{'closed':![]}});})[_0x1cb9('0x1b')](function(_0x4f9c76){_0x1eed9a=_0x4f9c76;if(_0x267b06&&_0x4f9c76>_0x267b06){return db['License']['findOne']({'where':{'id':0x1}})[_0x1cb9('0x1b')](function(_0x1ae2e4){if(_0x1ae2e4){_0x1ae2e4['increment']('chatLicenseExceeded');}});}})[_0x1cb9('0x1b')](function(){if(_0x46c7fe[_0x1cb9('0xe4')]&&_0x46c7fe[_0x1cb9('0xe4')]['Intervals']){var _0x311d61=[];for(var _0xca23c6=0x0;_0xca23c6<_0x46c7fe['Interval'][_0x1cb9('0xe5')][_0x1cb9('0x50')];_0xca23c6++){var _0x144266=_0x46c7fe[_0x1cb9('0xe4')][_0x1cb9('0xe5')][_0xca23c6][_0x1cb9('0xaa')]({'plain':!![]});_0x311d61['push'](iftimePromise(_0x144266,_0x46c7fe));}return BPromise['all'](_0x311d61)['then'](function(_0x2eb672){return _['some'](_0x2eb672);});}else{return!![];}})['then'](function(_0x41e933){var _0x534209=fs[_0x1cb9('0xe9')](path['join'](config[_0x1cb9('0x6c')],'server/files/chat/iframe.js'),_0x1cb9('0xc0'));var _0x5df0ac={'remote':_0x46c7fe[_0x1cb9('0xea')],'query':querystring[_0x1cb9('0x20')](_['merge'](_0x46c7fe[_0x1cb9('0xaa')]({'plain':!![]}),{'customerIp':_0x590374[_0x1cb9('0x7d')][_0x1cb9('0xeb')]||_0x590374[_0x1cb9('0x7d')][_0x1cb9('0xec')]||_0x590374['connection'][_0x1cb9('0xed')]||_0x590374['ip'],'referer':_0x590374['headers'][_0x1cb9('0x9a')],'openedInteractions':_0x1eed9a,'maxInteractions':_0x267b06,'virtual':_0x514b07[_0x1cb9('0xe7')],'online':_0x41e933,'custom':_0x514b07}))[_0x1cb9('0xee')](/'/g,'\x5c\x27')};_0x4ecf13[_0x1cb9('0x31')](ejs[_0x1cb9('0xc1')](Mustache[_0x1cb9('0xc1')](_0x534209,_0x5df0ac),{'proactiveActions':_0x12b942,'alignment':_0x46c7fe[_0x1cb9('0xef')],'verticalAlignment':_0x46c7fe[_0x1cb9('0xf0')]}));})['catch'](handleError(_0x4ecf13,null));};exports['addApplications']=function(_0x56673a,_0xd3036b,_0x1e723e){return db[_0x1cb9('0x33')][_0x1cb9('0x5f')]({'where':{'id':_0x56673a[_0x1cb9('0x4f')]['id']}})[_0x1cb9('0x1b')](handleEntityNotFound(_0xd3036b,null))[_0x1cb9('0x1b')](function(_0x2bed6e){if(_0x2bed6e){return db[_0x1cb9('0xf1')]['transaction'](function(_0x4997ad){return db[_0x1cb9('0xf2')][_0x1cb9('0x2e')]({'where':{'ChatWebsiteId':_0x56673a[_0x1cb9('0x4f')]['id']},'transaction':_0x4997ad})[_0x1cb9('0x1b')](function(_0x3eb851){var _0x39dc3f=_[_0x1cb9('0x47')](_0x56673a[_0x1cb9('0x52')],function(_0x39fdfc){_0x39fdfc[_0x1cb9('0x56')]=_0x56673a['params']['id'];return _0x39fdfc;});return db[_0x1cb9('0xf2')][_0x1cb9('0xf3')](_0x39dc3f,{'transaction':_0x4997ad});});})[_0x1cb9('0x1b')](function(){return db[_0x1cb9('0xf2')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x56673a[_0x1cb9('0x4f')]['id']},'order':_0x1cb9('0x94')});});}})[_0x1cb9('0x1b')](respondWithResult(_0xd3036b,null))[_0x1cb9('0x4d')](handleError(_0xd3036b,null));};exports['getApplications']=function(_0x2cb251,_0x46e5c2,_0x272b2b){var _0x4583f9={};var _0x418cd4={};var _0x1a07f9;var _0x2a9632;return db[_0x1cb9('0x33')]['findOne']({'where':{'id':_0x2cb251['params']['id']}})['then'](handleEntityNotFound(_0x46e5c2,null))[_0x1cb9('0x1b')](function(_0x5eb198){if(_0x5eb198){_0x1a07f9=_0x5eb198;_0x418cd4['model']=_[_0x1cb9('0x39')](db[_0x1cb9('0xf2')]['rawAttributes']);_0x418cd4[_0x1cb9('0x38')]=_[_0x1cb9('0x39')](_0x2cb251['query']);_0x418cd4[_0x1cb9('0x40')]=_[_0x1cb9('0x3a')](_0x418cd4['model'],_0x418cd4[_0x1cb9('0x38')]);_0x4583f9[_0x1cb9('0x3b')]=_[_0x1cb9('0x3a')](_0x418cd4[_0x1cb9('0x35')],qs[_0x1cb9('0x3c')](_0x2cb251[_0x1cb9('0x38')]['fields']));_0x4583f9['attributes']=_0x4583f9[_0x1cb9('0x3b')][_0x1cb9('0x50')]?_0x4583f9['attributes']:_0x418cd4[_0x1cb9('0x35')];_0x4583f9[_0x1cb9('0x58')]=qs[_0x1cb9('0x3f')](_0x2cb251['query']['sort']);_0x4583f9[_0x1cb9('0x45')]=qs[_0x1cb9('0x40')](_['pick'](_0x2cb251[_0x1cb9('0x38')],_0x418cd4[_0x1cb9('0x40')]));if(_0x2cb251[_0x1cb9('0x38')]['filter']){_0x4583f9['where']=_[_0x1cb9('0x44')](_0x4583f9[_0x1cb9('0x45')],{'$or':_[_0x1cb9('0x47')](_0x4583f9[_0x1cb9('0x3b')],function(_0x511c7b){var _0x3153a2={};_0x3153a2[_0x511c7b]={'$like':'%'+_0x2cb251[_0x1cb9('0x38')][_0x1cb9('0x46')]+'%'};return _0x3153a2;})});}_0x4583f9=_[_0x1cb9('0x44')]({},_0x4583f9,_0x2cb251[_0x1cb9('0x48')]);return _0x1a07f9['getApplications'](_0x4583f9);}})['then'](function(_0x1d2143){if(_0x1d2143){_0x2a9632=_0x1d2143[_0x1cb9('0x50')];if(!_0x2cb251[_0x1cb9('0x38')][_0x1cb9('0x3d')](_0x1cb9('0x3e'))){_0x4583f9[_0x1cb9('0x29')]=qs['limit'](_0x2cb251[_0x1cb9('0x38')]['limit']);_0x4583f9[_0x1cb9('0x28')]=qs[_0x1cb9('0x28')](_0x2cb251['query']['offset']);}return _0x1a07f9[_0x1cb9('0xf4')](_0x4583f9);}})[_0x1cb9('0x1b')](function(_0x559423){if(_0x559423){return _0x559423?{'count':_0x2a9632,'rows':_0x559423}:null;}})[_0x1cb9('0x1b')](respondWithResult(_0x46e5c2,null))[_0x1cb9('0x4d')](handleError(_0x46e5c2,null));};exports[_0x1cb9('0xf5')]=function(_0x129466,_0x3ea026,_0x32f021){return db[_0x1cb9('0xf6')][_0x1cb9('0x51')]({'where':{'id':_0x129466[_0x1cb9('0x4f')]['id']}})[_0x1cb9('0x1b')](handleEntityNotFound(_0x3ea026,null))[_0x1cb9('0x1b')](function(_0x3cf954){if(_0x3cf954){return _0x3cf954[_0x1cb9('0xf5')](_0x129466['body'][_0x1cb9('0x5a')],_[_0x1cb9('0xd0')](_0x129466[_0x1cb9('0x52')],[_0x1cb9('0x5a'),'id'])||{});}})[_0x1cb9('0x1b')](respondWithResult(_0x3ea026,null))[_0x1cb9('0x4d')](handleError(_0x3ea026,null));};exports['getProactiveActions']=function(_0xd4ba25,_0x1a6c4c,_0x4f4e04){var _0x209197={};var _0x35e3f4={};var _0x593c0c;var _0x395ddb;return db[_0x1cb9('0x33')][_0x1cb9('0x5f')]({'where':{'id':_0xd4ba25[_0x1cb9('0x4f')]['id']}})[_0x1cb9('0x1b')](handleEntityNotFound(_0x1a6c4c,null))[_0x1cb9('0x1b')](function(_0x5a42a0){if(_0x5a42a0){_0x593c0c=_0x5a42a0;_0x35e3f4[_0x1cb9('0x35')]=_[_0x1cb9('0x39')](db[_0x1cb9('0xf7')]['rawAttributes']);_0x35e3f4[_0x1cb9('0x38')]=_['keys'](_0xd4ba25['query']);_0x35e3f4[_0x1cb9('0x40')]=_[_0x1cb9('0x3a')](_0x35e3f4[_0x1cb9('0x35')],_0x35e3f4[_0x1cb9('0x38')]);_0x209197['attributes']=_[_0x1cb9('0x3a')](_0x35e3f4[_0x1cb9('0x35')],qs[_0x1cb9('0x3c')](_0xd4ba25[_0x1cb9('0x38')][_0x1cb9('0x3c')]));_0x209197[_0x1cb9('0x3b')]=_0x209197[_0x1cb9('0x3b')]['length']?_0x209197[_0x1cb9('0x3b')]:_0x35e3f4[_0x1cb9('0x35')];_0x209197[_0x1cb9('0x58')]=qs['sort'](_0xd4ba25[_0x1cb9('0x38')]['sort']);_0x209197[_0x1cb9('0x45')]=qs[_0x1cb9('0x40')](_[_0x1cb9('0x41')](_0xd4ba25[_0x1cb9('0x38')],_0x35e3f4[_0x1cb9('0x40')]));if(_0xd4ba25['query']['filter']){_0x209197['where']=_['merge'](_0x209197[_0x1cb9('0x45')],{'$or':_['map'](_0x209197[_0x1cb9('0x3b')],function(_0x484305){var _0x31adab={};_0x31adab[_0x484305]={'$like':'%'+_0xd4ba25[_0x1cb9('0x38')][_0x1cb9('0x46')]+'%'};return _0x31adab;})});}_0x209197=_[_0x1cb9('0x44')]({},_0x209197,_0xd4ba25[_0x1cb9('0x48')]);return _0x593c0c[_0x1cb9('0xe6')](_0x209197);}})[_0x1cb9('0x1b')](function(_0x10082c){if(_0x10082c){_0x395ddb=_0x10082c['length'];if(!_0xd4ba25[_0x1cb9('0x38')][_0x1cb9('0x3d')](_0x1cb9('0x3e'))){_0x209197[_0x1cb9('0x29')]=qs[_0x1cb9('0x29')](_0xd4ba25['query']['limit']);_0x209197[_0x1cb9('0x28')]=qs['offset'](_0xd4ba25['query']['offset']);}return _0x593c0c[_0x1cb9('0xe6')](_0x209197);}})[_0x1cb9('0x1b')](function(_0x279062){if(_0x279062){return _0x279062?{'count':_0x395ddb,'rows':_0x279062}:null;}})[_0x1cb9('0x1b')](respondWithResult(_0x1a6c4c,null))[_0x1cb9('0x4d')](handleError(_0x1a6c4c,null));};exports['getFields']=function(_0x19ac33,_0x12e221,_0x5cd228){var _0x32fcdd=_0x19ac33[_0x1cb9('0x38')][_0x1cb9('0xf8')]===_0x1cb9('0xf9')?_0x1cb9('0xfa'):_0x1cb9('0xfb');return db[_0x1cb9('0x33')]['find']({'attributes':['id',_0x32fcdd],'where':{'id':_0x19ac33[_0x1cb9('0x4f')]['id']}})['then'](handleEntityNotFound(_0x12e221,null))['then'](function(_0x402c68){if(_0x402c68){var _0x4c81d8=_0x402c68[_0x32fcdd];var _0x2c9609=_0x4c81d8&&_0x4c81d8[_0x1cb9('0xfc')]?_0x4c81d8[_0x1cb9('0xfc')]:[];_0x12e221['send']({'fromKey':_[_0x1cb9('0x6f')](_0x4c81d8[_0x1cb9('0xfd')])?undefined:_0x4c81d8[_0x1cb9('0xfd')],'count':_0x2c9609[_0x1cb9('0x50')],'rows':_0x2c9609});}})[_0x1cb9('0x4d')](handleError(_0x12e221,null));};exports[_0x1cb9('0xfe')]=function(_0x4d4067,_0x78add,_0x3b723e){var _0x481bd0={'raw':!![],'where':{}};var _0x50ca5e={};var _0x216681={'count':0x0,'rows':[]};return db[_0x1cb9('0x33')][_0x1cb9('0x5f')]({'where':{'id':_0x4d4067[_0x1cb9('0x4f')]['id']}})[_0x1cb9('0x1b')](handleEntityNotFound(_0x78add,null))['then'](function(_0x329d38){if(_0x329d38){_0x50ca5e['model']=_[_0x1cb9('0x39')](db[_0x1cb9('0xff')][_0x1cb9('0x34')]);_0x50ca5e[_0x1cb9('0x38')]=_[_0x1cb9('0x39')](_0x4d4067['query']);_0x50ca5e[_0x1cb9('0x40')]=_['intersection'](_0x50ca5e[_0x1cb9('0x35')],_0x50ca5e['query']);_0x481bd0[_0x1cb9('0x3b')]=_[_0x1cb9('0x3a')](_0x50ca5e['model'],qs[_0x1cb9('0x3c')](_0x4d4067['query'][_0x1cb9('0x3c')]));_0x481bd0[_0x1cb9('0x3b')]=_0x481bd0['attributes'][_0x1cb9('0x50')]?_0x481bd0[_0x1cb9('0x3b')]:_0x50ca5e[_0x1cb9('0x35')];if(!_0x4d4067[_0x1cb9('0x38')]['hasOwnProperty']('nolimit')){_0x481bd0[_0x1cb9('0x29')]=qs[_0x1cb9('0x29')](_0x4d4067[_0x1cb9('0x38')][_0x1cb9('0x29')]);_0x481bd0['offset']=qs[_0x1cb9('0x28')](_0x4d4067[_0x1cb9('0x38')]['offset']);}_0x481bd0[_0x1cb9('0x58')]=qs[_0x1cb9('0x3f')](_0x4d4067[_0x1cb9('0x38')]['sort']);_0x481bd0[_0x1cb9('0x45')]=qs['filters'](_[_0x1cb9('0x41')](_0x4d4067[_0x1cb9('0x38')],_0x50ca5e['filters']));_0x481bd0[_0x1cb9('0x45')][_0x1cb9('0x56')]=_0x329d38['id'];if(_0x4d4067[_0x1cb9('0x38')]['filter']){_0x481bd0[_0x1cb9('0x45')]=_[_0x1cb9('0x44')](_0x481bd0['where'],{'$or':_[_0x1cb9('0x47')](_0x481bd0[_0x1cb9('0x3b')],function(_0xfa519){var _0x1a5039={};_0x1a5039[_0xfa519]={'$like':'%'+_0x4d4067['query'][_0x1cb9('0x46')]+'%'};return _0x1a5039;})});}_0x481bd0=_['merge']({},_0x481bd0,_0x4d4067['options']);return db[_0x1cb9('0xff')]['count']({'where':_0x481bd0[_0x1cb9('0x45')]})[_0x1cb9('0x1b')](function(_0x258190){_0x216681['count']=_0x258190;if(_0x4d4067[_0x1cb9('0x38')][_0x1cb9('0x4a')]){_0x481bd0[_0x1cb9('0x60')]=[{'all':!![]}];}return db[_0x1cb9('0xff')][_0x1cb9('0x4b')](_0x481bd0);})[_0x1cb9('0x1b')](function(_0x3183b5){_0x216681[_0x1cb9('0x4c')]=_0x3183b5;return _0x216681;});}})[_0x1cb9('0x1b')](respondWithFilteredResult(_0x78add,_0x481bd0))[_0x1cb9('0x4d')](handleError(_0x78add,null));};exports[_0x1cb9('0x100')]=function(_0x28625d,_0x4b51d1,_0x63e2c){return db[_0x1cb9('0x33')][_0x1cb9('0x51')]({'where':{'id':_0x28625d[_0x1cb9('0x4f')]['id']}})[_0x1cb9('0x1b')](handleEntityNotFound(_0x4b51d1,null))[_0x1cb9('0x1b')](function(_0x5a3971){if(_0x5a3971){return _0x5a3971[_0x1cb9('0x100')](_0x28625d[_0x1cb9('0x52')][_0x1cb9('0x5a')],_[_0x1cb9('0xd0')](_0x28625d[_0x1cb9('0x52')],['ids','id'])||{})[_0x1cb9('0xa9')](function(_0x595905){for(var _0x18186b=0x0;_0x18186b<_0x28625d[_0x1cb9('0x52')][_0x1cb9('0x5a')][_0x1cb9('0x50')];_0x18186b+=0x1){socket[_0x1cb9('0x101')](_0x1cb9('0x102'),{'UserId':_0x28625d[_0x1cb9('0x52')][_0x1cb9('0x5a')][_0x18186b],'ChatWebsiteId':_0x28625d[_0x1cb9('0x4f')]['id']});}return _0x595905;});}})['then'](respondWithResult(_0x4b51d1,null))['catch'](handleError(_0x4b51d1,null));};exports[_0x1cb9('0x103')]=function(_0x3a7fb3,_0x411704,_0x45479b){var _0x42ef93;return db[_0x1cb9('0x33')][_0x1cb9('0x51')]({'where':{'id':_0x3a7fb3['params']['id']}})[_0x1cb9('0x1b')](handleEntityNotFound(_0x411704,null))['then'](function(_0x1f791e){if(_0x1f791e){return _0x1f791e['removeAgents'](_0x3a7fb3[_0x1cb9('0x38')][_0x1cb9('0x5a')])[_0x1cb9('0x1b')](function(_0x50e87a){if(_['isArray'](_0x3a7fb3[_0x1cb9('0x38')]['ids'])){for(var _0x451b30=0x0;_0x451b30<_0x3a7fb3[_0x1cb9('0x38')][_0x1cb9('0x5a')][_0x1cb9('0x50')];_0x451b30+=0x1){socket[_0x1cb9('0x101')]('userChatWebsite:remove',{'UserId':_0x3a7fb3[_0x1cb9('0x38')][_0x1cb9('0x5a')][_0x451b30],'ChatWebsiteId':_0x3a7fb3[_0x1cb9('0x4f')]['id']});}}else{socket[_0x1cb9('0x101')](_0x1cb9('0x104'),{'UserId':_0x3a7fb3[_0x1cb9('0x38')][_0x1cb9('0x5a')],'ChatWebsiteId':_0x3a7fb3['params']['id']});}});}})[_0x1cb9('0x1b')](respondWithStatusCode(_0x411704,null))['catch'](handleError(_0x411704,null));};exports['getAgents']=function(_0x3f1ebf,_0x32b643,_0x5cf703){var _0xb79d5a={};var _0x416e95={};var _0x20a561;var _0x1d032b;return db[_0x1cb9('0x33')][_0x1cb9('0x5f')]({'where':{'id':_0x3f1ebf['params']['id']}})[_0x1cb9('0x1b')](handleEntityNotFound(_0x32b643,null))['then'](function(_0x5ee129){if(_0x5ee129){_0x20a561=_0x5ee129;_0x416e95[_0x1cb9('0x35')]=_[_0x1cb9('0x39')](db['User']['rawAttributes']);_0x416e95[_0x1cb9('0x38')]=_['keys'](_0x3f1ebf['query']);_0x416e95[_0x1cb9('0x40')]=_[_0x1cb9('0x3a')](_0x416e95['model'],_0x416e95[_0x1cb9('0x38')]);_0xb79d5a[_0x1cb9('0x3b')]=_[_0x1cb9('0x3a')](_0x416e95[_0x1cb9('0x35')],qs[_0x1cb9('0x3c')](_0x3f1ebf['query'][_0x1cb9('0x3c')]));_0xb79d5a[_0x1cb9('0x3b')]=_0xb79d5a[_0x1cb9('0x3b')][_0x1cb9('0x50')]?_0xb79d5a['attributes']:_0x416e95[_0x1cb9('0x35')];_0xb79d5a[_0x1cb9('0x58')]=qs['sort'](_0x3f1ebf[_0x1cb9('0x38')]['sort']);_0xb79d5a[_0x1cb9('0x45')]=qs[_0x1cb9('0x40')](_[_0x1cb9('0x41')](_0x3f1ebf[_0x1cb9('0x38')],_0x416e95['filters']));if(_0x3f1ebf[_0x1cb9('0x38')]['filter']){_0xb79d5a[_0x1cb9('0x45')]=_[_0x1cb9('0x44')](_0xb79d5a[_0x1cb9('0x45')],{'$or':_[_0x1cb9('0x47')](_0xb79d5a[_0x1cb9('0x3b')],function(_0x3b61f5){var _0x42baba={};_0x42baba[_0x3b61f5]={'$like':'%'+_0x3f1ebf[_0x1cb9('0x38')][_0x1cb9('0x46')]+'%'};return _0x42baba;})});}_0xb79d5a=_[_0x1cb9('0x44')]({},_0xb79d5a,_0x3f1ebf[_0x1cb9('0x48')]);return _0x20a561[_0x1cb9('0x105')](_0xb79d5a);}})['then'](function(_0xafdce2){if(_0xafdce2){_0x1d032b=_0xafdce2[_0x1cb9('0x50')];if(!_0x3f1ebf[_0x1cb9('0x38')][_0x1cb9('0x3d')](_0x1cb9('0x3e'))){_0xb79d5a[_0x1cb9('0x29')]=qs[_0x1cb9('0x29')](_0x3f1ebf[_0x1cb9('0x38')]['limit']);_0xb79d5a[_0x1cb9('0x28')]=qs[_0x1cb9('0x28')](_0x3f1ebf[_0x1cb9('0x38')]['offset']);}return _0x20a561[_0x1cb9('0x105')](_0xb79d5a);}})['then'](function(_0x34d4c5){if(_0x34d4c5){return _0x34d4c5?{'count':_0x1d032b,'rows':_0x34d4c5}:null;}})[_0x1cb9('0x1b')](respondWithResult(_0x32b643,null))['catch'](handleError(_0x32b643,null));}; \ No newline at end of file +var _0xedd9=['desk.js','querystring','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','http','client','then','info','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','message','ChatWebsite,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','send','index','ChatWebsite','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','filter','merge','map','options','count','includeAll','include','findAll','show','params','find','create','body','describe','addDisposition','Disposition','ChatWebsiteId','rows','removeDispositions','findOne','CannedAnswer','removeAnswers','ids','addLogo','sitepic','file','addAvatar','agentAvatar','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','join','root','server/files/images/logos/default_logo.png','getLicense','isNil','download','getAvatar','server/files/images/avatars/default_avatar.png','existsSync','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/','server/files/images/avatars/system_avatar.png','systemAvatar','notify','user-agent-parser','setUA','headers','user-agent','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','List','Contacts','DESC','applications','orderBy','priority','asc','account','contact','firstName','lastName','customerIp','referer','version','format','%s\x20%s','browser','unknown','device','vendor','%s\x20%s\x20%s','type','stringify','threadId','ChatInteraction','externalUrl','interaction','get','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','offline','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','spread','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','ChatOfflineMessage','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','user','pass','SendMail','sendMail','email','offlineMessageSubject','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tags','tag','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','Interval','Intervals','getProactiveActions','../../config/license/util','virtual','License','increment','chatLicenseExceeded','all','readFileSync','server/files/chat/iframe.js','remote','x-forwarded-for','x-real-ip','connection','remoteAddress','alignment','verticalAlignment','addApplications','sequelize','ChatApplication','bulkCreate','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','offlineForm','items','fromKey','getOfflineMessages','addAgents','emit','removeAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce'];(function(_0x3f2d4a,_0x15b363){var _0x5bc1ab=function(_0x5a8023){while(--_0x5a8023){_0x3f2d4a['push'](_0x3f2d4a['shift']());}};_0x5bc1ab(++_0x15b363);}(_0xedd9,0xfc));var _0x9edd=function(_0x904b24,_0x264ca0){_0x904b24=_0x904b24-0x0;var _0x3cd8d4=_0xedd9[_0x904b24];return _0x3cd8d4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9edd('0x0'));var rimraf=require(_0x9edd('0x1'));var zipdir=require(_0x9edd('0x2'));var jsonpatch=require(_0x9edd('0x3'));var rp=require(_0x9edd('0x4'));var moment=require(_0x9edd('0x5'));var BPromise=require(_0x9edd('0x6'));var Mustache=require(_0x9edd('0x7'));var util=require('util');var path=require(_0x9edd('0x8'));var sox=require(_0x9edd('0x9'));var csv=require(_0x9edd('0xa'));var ejs=require(_0x9edd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0xa'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0x9edd('0x11'))(_0x9edd('0x12'));var utils=require('../../config/utils');var config=require(_0x9edd('0x13'));var db=require(_0x9edd('0x14'))['db'];config['redis']=_[_0x9edd('0x15')](config[_0x9edd('0x16')],{'host':_0x9edd('0x17'),'port':0x18eb});var socket=require(_0x9edd('0x18'))(new Redis(config[_0x9edd('0x16')]));require(_0x9edd('0x19'))[_0x9edd('0x1a')](socket);var jayson=require(_0x9edd('0x1b'));var client=jayson['client'][_0x9edd('0x1c')]({'port':0x232c});var client9002=jayson[_0x9edd('0x1d')][_0x9edd('0x1c')]({'port':0x232a});var client9003=jayson[_0x9edd('0x1d')][_0x9edd('0x1c')]({'port':0x232b});function respondWithRpcPromise(_0x338f3c,_0x1042aa,_0x75a4ab,_0x4ea60f){return new BPromise(function(_0x5f5bf4,_0x448996){var _0x449cee=_0x4ea60f||client;return _0x449cee['request'](_0x338f3c,_0x75a4ab)[_0x9edd('0x1e')](function(_0x35f454){logger[_0x9edd('0x1f')]('ChatWebsite,\x20%s,\x20%s',_0x1042aa,_0x9edd('0x20'));logger['debug'](_0x9edd('0x21'),_0x1042aa,_0x9edd('0x20'),JSON['stringify'](_0x35f454));if(_0x35f454['error']){if(_0x35f454[_0x9edd('0x22')]['code']===0x1f4){logger[_0x9edd('0x22')]('ChatWebsite,\x20%s,\x20%s',_0x1042aa,_0x35f454['error'][_0x9edd('0x23')]);return _0x448996(_0x35f454[_0x9edd('0x22')]['message']);}logger['error'](_0x9edd('0x24'),_0x1042aa,_0x35f454[_0x9edd('0x22')][_0x9edd('0x23')]);return _0x5f5bf4(_0x35f454['error'][_0x9edd('0x23')]);}else{logger[_0x9edd('0x1f')](_0x9edd('0x24'),_0x1042aa,_0x9edd('0x20'));_0x5f5bf4(_0x35f454[_0x9edd('0x25')]['message']);}})[_0x9edd('0x26')](function(_0xeaf55a){logger[_0x9edd('0x22')](_0x9edd('0x24'),_0x1042aa,_0xeaf55a);_0x448996(_0xeaf55a);});});}function respondWithStatusCode(_0x310a4d,_0x4d507f){_0x4d507f=_0x4d507f||0xcc;return function(_0x4b3d1b){if(_0x4b3d1b){return _0x310a4d[_0x9edd('0x27')](_0x4d507f);}return _0x310a4d[_0x9edd('0x28')](_0x4d507f)[_0x9edd('0x29')]();};}function respondWithResult(_0x25e135,_0x3c2227){_0x3c2227=_0x3c2227||0xc8;return function(_0x4fe471){if(_0x4fe471){return _0x25e135['status'](_0x3c2227)[_0x9edd('0x2a')](_0x4fe471);}};}function respondWithFilteredResult(_0x257a26,_0x1c762c){return function(_0x52746a){if(_0x52746a){var _0x238b22=_0x52746a['count'],_0x28cfae=_0x1c762c[_0x9edd('0x2b')],_0x2ae8dd=_0x1c762c[_0x9edd('0x2b')]+_0x1c762c[_0x9edd('0x2c')],_0x41af53;if(_0x2ae8dd>=_0x238b22){_0x2ae8dd=_0x238b22;_0x41af53=0xc8;}else{_0x41af53=0xce;}_0x257a26[_0x9edd('0x28')](_0x41af53);return _0x257a26[_0x9edd('0x2d')](_0x9edd('0x2e'),_0x28cfae+'-'+_0x2ae8dd+'/'+_0x238b22)[_0x9edd('0x2a')](_0x52746a);}return null;};}function patchUpdates(_0x1fba7b){return function(_0x19b6c1){try{jsonpatch[_0x9edd('0x2f')](_0x19b6c1,_0x1fba7b,!![]);}catch(_0x4fd03f){return BPromise[_0x9edd('0x30')](_0x4fd03f);}return _0x19b6c1[_0x9edd('0x31')]();};}function saveUpdates(_0xa55906,_0x1a6c23){return function(_0x5af178){if(_0x5af178){return _0x5af178[_0x9edd('0x32')](_0xa55906)[_0x9edd('0x1e')](function(_0x267c74){return _0x267c74;});}return null;};}function removeEntity(_0x5d1707,_0x2d2f88){return function(_0x3990fb){if(_0x3990fb){return _0x3990fb[_0x9edd('0x33')]()[_0x9edd('0x1e')](function(){_0x5d1707[_0x9edd('0x28')](0xcc)[_0x9edd('0x29')]();});}};}function handleEntityNotFound(_0x473068,_0x438a5d){return function(_0xd0fd74){if(!_0xd0fd74){_0x473068[_0x9edd('0x27')](0x194);}return _0xd0fd74;};}function handleError(_0x29e789,_0x42c1d9){_0x42c1d9=_0x42c1d9||0x1f4;return function(_0x27eb7e){logger[_0x9edd('0x22')](_0x27eb7e['stack']);if(_0x27eb7e[_0x9edd('0x34')]){delete _0x27eb7e['name'];}_0x29e789[_0x9edd('0x28')](_0x42c1d9)[_0x9edd('0x35')](_0x27eb7e);};}exports[_0x9edd('0x36')]=function(_0x434d26,_0x16770e){var _0x4fa5ab={},_0x6de835={},_0x44dbfc={'count':0x0,'rows':[]};var _0x2b3469=db[_0x9edd('0x37')][_0x9edd('0x38')];_0x6de835[_0x9edd('0x39')]=_[_0x9edd('0x3a')](_0x2b3469);var _0x1cbbac={'dateStart':_0x434d26[_0x9edd('0x3b')][_0x9edd('0x3c')],'dateEnd':_0x434d26['query'][_0x9edd('0x3d')]};delete _0x434d26['query'][_0x9edd('0x3c')];delete _0x434d26['query'][_0x9edd('0x3d')];_0x6de835[_0x9edd('0x3b')]=_[_0x9edd('0x3a')](_0x434d26['query']);_0x6de835[_0x9edd('0x3e')]=_[_0x9edd('0x3f')](_0x6de835[_0x9edd('0x39')],_0x6de835['query']);_0x4fa5ab[_0x9edd('0x40')]=_['intersection'](_0x6de835[_0x9edd('0x39')],qs[_0x9edd('0x41')](_0x434d26['query'][_0x9edd('0x41')]));_0x4fa5ab[_0x9edd('0x40')]=_0x4fa5ab[_0x9edd('0x40')][_0x9edd('0x42')]?_0x4fa5ab['attributes']:_0x6de835[_0x9edd('0x39')];if(!_0x434d26['query'][_0x9edd('0x43')](_0x9edd('0x44'))){_0x4fa5ab['limit']=qs[_0x9edd('0x2c')](_0x434d26['query']['limit']);_0x4fa5ab[_0x9edd('0x2b')]=qs[_0x9edd('0x2b')](_0x434d26[_0x9edd('0x3b')][_0x9edd('0x2b')]);}_0x4fa5ab[_0x9edd('0x45')]=qs[_0x9edd('0x46')](_0x434d26[_0x9edd('0x3b')][_0x9edd('0x46')]);_0x4fa5ab[_0x9edd('0x47')]=qs[_0x9edd('0x3e')](_[_0x9edd('0x48')](_0x434d26[_0x9edd('0x3b')],_0x6de835[_0x9edd('0x3e')]));if(_0x1cbbac[_0x9edd('0x3c')]){if(_0x1cbbac[_0x9edd('0x3d')]){_0x1cbbac['dateEnd']=moment(_0x1cbbac[_0x9edd('0x3d')])[_0x9edd('0x49')](0x1,_0x9edd('0x4a'));}else{_0x1cbbac[_0x9edd('0x3d')]=moment(_0x1cbbac[_0x9edd('0x3c')])[_0x9edd('0x49')](0x1,_0x9edd('0x4a'));}_['merge'](_0x4fa5ab['where'],{'createdAt':{'$gte':_0x1cbbac['dateStart'],'$lte':_0x1cbbac[_0x9edd('0x3d')]}});}if(_0x434d26['query'][_0x9edd('0x4b')]){_0x4fa5ab[_0x9edd('0x47')]=_[_0x9edd('0x4c')](_0x4fa5ab[_0x9edd('0x47')],{'$or':_[_0x9edd('0x4d')](_0x4fa5ab['attributes'],function(_0x387fb8){var _0x35e63c={};_0x35e63c[_0x387fb8]={'$like':'%'+_0x434d26[_0x9edd('0x3b')]['filter']+'%'};return _0x35e63c;})});}_0x4fa5ab=_[_0x9edd('0x4c')]({},_0x4fa5ab,_0x434d26[_0x9edd('0x4e')]);var _0x2159aa={'where':_0x4fa5ab[_0x9edd('0x47')]};return db[_0x9edd('0x37')][_0x9edd('0x4f')](_0x2159aa)['then'](function(_0x441e4a){_0x44dbfc[_0x9edd('0x4f')]=_0x441e4a;if(_0x434d26['query'][_0x9edd('0x50')]){_0x4fa5ab[_0x9edd('0x51')]=[{'all':!![]}];}return db['ChatWebsite'][_0x9edd('0x52')](_0x4fa5ab);})[_0x9edd('0x1e')](function(_0x468239){_0x44dbfc['rows']=_0x468239;return _0x44dbfc;})[_0x9edd('0x1e')](respondWithFilteredResult(_0x16770e,_0x4fa5ab))[_0x9edd('0x26')](handleError(_0x16770e,null));};exports[_0x9edd('0x53')]=function(_0x28c7bd,_0x53f6e3){var _0x446443={'raw':![],'where':{'id':_0x28c7bd[_0x9edd('0x54')]['id']}},_0x527727={};_0x527727['model']=_[_0x9edd('0x3a')](db[_0x9edd('0x37')]['rawAttributes']);_0x527727[_0x9edd('0x3b')]=_['keys'](_0x28c7bd[_0x9edd('0x3b')]);_0x527727[_0x9edd('0x3e')]=_[_0x9edd('0x3f')](_0x527727[_0x9edd('0x39')],_0x527727[_0x9edd('0x3b')]);_0x446443[_0x9edd('0x40')]=_[_0x9edd('0x3f')](_0x527727[_0x9edd('0x39')],qs[_0x9edd('0x41')](_0x28c7bd[_0x9edd('0x3b')][_0x9edd('0x41')]));_0x446443['attributes']=_0x446443[_0x9edd('0x40')][_0x9edd('0x42')]?_0x446443[_0x9edd('0x40')]:_0x527727['model'];if(_0x28c7bd[_0x9edd('0x3b')]['includeAll']){_0x446443['include']=[{'all':!![]}];}_0x446443=_['merge']({},_0x446443,_0x28c7bd[_0x9edd('0x4e')]);return db[_0x9edd('0x37')][_0x9edd('0x55')](_0x446443)[_0x9edd('0x1e')](handleEntityNotFound(_0x53f6e3,null))['then'](respondWithResult(_0x53f6e3,null))['catch'](handleError(_0x53f6e3,null));};exports['create']=function(_0x71820f,_0x5f666b){return db[_0x9edd('0x37')][_0x9edd('0x56')](_0x71820f[_0x9edd('0x57')],{})[_0x9edd('0x1e')](respondWithResult(_0x5f666b,0xc9))[_0x9edd('0x26')](handleError(_0x5f666b,null));};exports[_0x9edd('0x32')]=function(_0x4eb780,_0x16dfdc){if(_0x4eb780['body']['id']){delete _0x4eb780[_0x9edd('0x57')]['id'];}return db[_0x9edd('0x37')]['find']({'where':{'id':_0x4eb780[_0x9edd('0x54')]['id']}})[_0x9edd('0x1e')](handleEntityNotFound(_0x16dfdc,null))[_0x9edd('0x1e')](saveUpdates(_0x4eb780['body'],null))[_0x9edd('0x1e')](respondWithResult(_0x16dfdc,null))[_0x9edd('0x26')](handleError(_0x16dfdc,null));};exports[_0x9edd('0x33')]=function(_0x15ebfa,_0x1720b1){return db[_0x9edd('0x37')]['find']({'where':{'id':_0x15ebfa['params']['id']}})[_0x9edd('0x1e')](handleEntityNotFound(_0x1720b1,null))['then'](removeEntity(_0x1720b1,null))[_0x9edd('0x26')](handleError(_0x1720b1,null));};exports[_0x9edd('0x58')]=function(_0x439083,_0x17d2f2){return db['ChatWebsite'][_0x9edd('0x58')]()['then'](respondWithResult(_0x17d2f2,null))[_0x9edd('0x26')](handleError(_0x17d2f2,null));};exports[_0x9edd('0x59')]=function(_0xc6bde6,_0x5ca123,_0x2651a2){if(_0xc6bde6['body']['id']){delete _0xc6bde6[_0x9edd('0x57')]['id'];}return db[_0x9edd('0x37')]['find']({'where':{'id':_0xc6bde6[_0x9edd('0x54')]['id']}})['then'](handleEntityNotFound(_0x5ca123,null))[_0x9edd('0x1e')](function(_0x134c9c){if(_0x134c9c){_0xc6bde6[_0x9edd('0x57')]['ChatWebsiteId']=_0x134c9c['id'];return db[_0x9edd('0x5a')][_0x9edd('0x56')](_0xc6bde6[_0x9edd('0x57')]);}})[_0x9edd('0x1e')](respondWithResult(_0x5ca123,null))[_0x9edd('0x26')](handleError(_0x5ca123,null));};exports['getDispositions']=function(_0x48f017,_0x2e1a96,_0x211526){var _0x5516c4={'raw':![],'where':{}};var _0x5496e9={};var _0x52afd7={'count':0x0,'rows':[]};return db[_0x9edd('0x37')]['findOne']({'where':{'id':_0x48f017['params']['id']}})[_0x9edd('0x1e')](handleEntityNotFound(_0x2e1a96,null))[_0x9edd('0x1e')](function(_0x589348){if(_0x589348){_0x5496e9[_0x9edd('0x39')]=_[_0x9edd('0x3a')](db[_0x9edd('0x5a')]['rawAttributes']);_0x5496e9[_0x9edd('0x3b')]=_['keys'](_0x48f017[_0x9edd('0x3b')]);_0x5496e9[_0x9edd('0x3e')]=_['intersection'](_0x5496e9[_0x9edd('0x39')],_0x5496e9[_0x9edd('0x3b')]);_0x5516c4['attributes']=_[_0x9edd('0x3f')](_0x5496e9[_0x9edd('0x39')],qs[_0x9edd('0x41')](_0x48f017[_0x9edd('0x3b')]['fields']));_0x5516c4[_0x9edd('0x40')]=_0x5516c4['attributes'][_0x9edd('0x42')]?_0x5516c4[_0x9edd('0x40')]:_0x5496e9[_0x9edd('0x39')];if(!_0x48f017['query'][_0x9edd('0x43')](_0x9edd('0x44'))){_0x5516c4[_0x9edd('0x2c')]=qs[_0x9edd('0x2c')](_0x48f017[_0x9edd('0x3b')][_0x9edd('0x2c')]);_0x5516c4[_0x9edd('0x2b')]=qs['offset'](_0x48f017['query'][_0x9edd('0x2b')]);}_0x5516c4[_0x9edd('0x45')]=qs[_0x9edd('0x46')](_0x48f017[_0x9edd('0x3b')][_0x9edd('0x46')]);_0x5516c4['where']=qs[_0x9edd('0x3e')](_[_0x9edd('0x48')](_0x48f017[_0x9edd('0x3b')],_0x5496e9['filters']));_0x5516c4[_0x9edd('0x47')][_0x9edd('0x5b')]=_0x589348['id'];if(_0x48f017['query'][_0x9edd('0x4b')]){_0x5516c4[_0x9edd('0x47')]=_['merge'](_0x5516c4[_0x9edd('0x47')],{'$or':_[_0x9edd('0x4d')](_0x5516c4['attributes'],function(_0x3f08ac){var _0x4b8cbc={};_0x4b8cbc[_0x3f08ac]={'$like':'%'+_0x48f017['query'][_0x9edd('0x4b')]+'%'};return _0x4b8cbc;})});}_0x5516c4=_[_0x9edd('0x4c')]({},_0x5516c4,_0x48f017[_0x9edd('0x4e')]);return db['Disposition'][_0x9edd('0x4f')]({'where':_0x5516c4[_0x9edd('0x47')]})['then'](function(_0x1832c0){_0x52afd7[_0x9edd('0x4f')]=_0x1832c0;if(_0x48f017[_0x9edd('0x3b')][_0x9edd('0x50')]){_0x5516c4['include']=[{'all':!![]}];}return db['Disposition'][_0x9edd('0x52')](_0x5516c4);})['then'](function(_0x350c15){_0x52afd7[_0x9edd('0x5c')]=_0x350c15;return _0x52afd7;});}})[_0x9edd('0x1e')](respondWithFilteredResult(_0x2e1a96,_0x5516c4))[_0x9edd('0x26')](handleError(_0x2e1a96,null));};exports[_0x9edd('0x5d')]=function(_0x4786f8,_0x1eabcd,_0x5a4d4b){var _0xef1397;return db['ChatWebsite'][_0x9edd('0x55')]({'where':{'id':_0x4786f8[_0x9edd('0x54')]['id']}})[_0x9edd('0x1e')](handleEntityNotFound(_0x1eabcd,null))[_0x9edd('0x1e')](function(_0x206131){if(_0x206131){return _0x206131[_0x9edd('0x5d')](_0x4786f8[_0x9edd('0x3b')]['ids']);}})[_0x9edd('0x1e')](respondWithStatusCode(_0x1eabcd,null))[_0x9edd('0x26')](handleError(_0x1eabcd,null));};exports['addAnswer']=function(_0x26c11a,_0x14b6b9,_0x57231c){if(_0x26c11a[_0x9edd('0x57')]['id']){delete _0x26c11a[_0x9edd('0x57')]['id'];}return db[_0x9edd('0x37')]['find']({'where':{'id':_0x26c11a[_0x9edd('0x54')]['id']}})[_0x9edd('0x1e')](handleEntityNotFound(_0x14b6b9,null))[_0x9edd('0x1e')](function(_0x5a7de3){if(_0x5a7de3){_0x26c11a['body']['ChatWebsiteId']=_0x5a7de3['id'];return db['CannedAnswer'][_0x9edd('0x56')](_0x26c11a[_0x9edd('0x57')]);}})[_0x9edd('0x1e')](respondWithResult(_0x14b6b9,null))['catch'](handleError(_0x14b6b9,null));};exports['getAnswers']=function(_0x49dc1d,_0x56d794,_0x388252){var _0x20762d={'raw':![],'where':{}};var _0x35c7d4={};var _0x4713ae={'count':0x0,'rows':[]};return db[_0x9edd('0x37')][_0x9edd('0x5e')]({'where':{'id':_0x49dc1d[_0x9edd('0x54')]['id']}})[_0x9edd('0x1e')](handleEntityNotFound(_0x56d794,null))[_0x9edd('0x1e')](function(_0x2523b5){if(_0x2523b5){_0x35c7d4[_0x9edd('0x39')]=_['keys'](db[_0x9edd('0x5f')][_0x9edd('0x38')]);_0x35c7d4[_0x9edd('0x3b')]=_[_0x9edd('0x3a')](_0x49dc1d[_0x9edd('0x3b')]);_0x35c7d4[_0x9edd('0x3e')]=_[_0x9edd('0x3f')](_0x35c7d4[_0x9edd('0x39')],_0x35c7d4['query']);_0x20762d['attributes']=_[_0x9edd('0x3f')](_0x35c7d4['model'],qs[_0x9edd('0x41')](_0x49dc1d['query'][_0x9edd('0x41')]));_0x20762d[_0x9edd('0x40')]=_0x20762d['attributes'][_0x9edd('0x42')]?_0x20762d[_0x9edd('0x40')]:_0x35c7d4['model'];if(!_0x49dc1d[_0x9edd('0x3b')][_0x9edd('0x43')](_0x9edd('0x44'))){_0x20762d[_0x9edd('0x2c')]=qs[_0x9edd('0x2c')](_0x49dc1d['query'][_0x9edd('0x2c')]);_0x20762d[_0x9edd('0x2b')]=qs[_0x9edd('0x2b')](_0x49dc1d[_0x9edd('0x3b')][_0x9edd('0x2b')]);}_0x20762d['order']=qs['sort'](_0x49dc1d['query']['sort']);_0x20762d['where']=qs[_0x9edd('0x3e')](_['pick'](_0x49dc1d['query'],_0x35c7d4[_0x9edd('0x3e')]));_0x20762d[_0x9edd('0x47')][_0x9edd('0x5b')]=_0x2523b5['id'];if(_0x49dc1d[_0x9edd('0x3b')][_0x9edd('0x4b')]){_0x20762d[_0x9edd('0x47')]=_[_0x9edd('0x4c')](_0x20762d[_0x9edd('0x47')],{'$or':_[_0x9edd('0x4d')](_0x20762d[_0x9edd('0x40')],function(_0x5b5ae9){var _0x14e003={};_0x14e003[_0x5b5ae9]={'$like':'%'+_0x49dc1d[_0x9edd('0x3b')][_0x9edd('0x4b')]+'%'};return _0x14e003;})});}_0x20762d=_[_0x9edd('0x4c')]({},_0x20762d,_0x49dc1d[_0x9edd('0x4e')]);return db[_0x9edd('0x5f')][_0x9edd('0x4f')]({'where':_0x20762d[_0x9edd('0x47')]})['then'](function(_0x49a69b){_0x4713ae[_0x9edd('0x4f')]=_0x49a69b;if(_0x49dc1d[_0x9edd('0x3b')][_0x9edd('0x50')]){_0x20762d[_0x9edd('0x51')]=[{'all':!![]}];}return db[_0x9edd('0x5f')][_0x9edd('0x52')](_0x20762d);})[_0x9edd('0x1e')](function(_0x22590d){_0x4713ae[_0x9edd('0x5c')]=_0x22590d;return _0x4713ae;});}})[_0x9edd('0x1e')](respondWithFilteredResult(_0x56d794,_0x20762d))[_0x9edd('0x26')](handleError(_0x56d794,null));};exports[_0x9edd('0x60')]=function(_0x103a61,_0xf418d,_0x55bc19){var _0x43b19e;return db[_0x9edd('0x37')]['find']({'where':{'id':_0x103a61[_0x9edd('0x54')]['id']}})[_0x9edd('0x1e')](handleEntityNotFound(_0xf418d,null))[_0x9edd('0x1e')](function(_0x2b4d4c){if(_0x2b4d4c){return _0x2b4d4c['removeAnswers'](_0x103a61[_0x9edd('0x3b')][_0x9edd('0x61')]);}})[_0x9edd('0x1e')](respondWithStatusCode(_0xf418d,null))[_0x9edd('0x26')](handleError(_0xf418d,null));};exports[_0x9edd('0x62')]=function(_0x5a23d0,_0x2fe939,_0x1c21d5){_0x5a23d0[_0x9edd('0x57')][_0x9edd('0x63')]=_0x5a23d0[_0x9edd('0x64')]['filename'];return db['ChatWebsite'][_0x9edd('0x55')]({'where':{'id':_0x5a23d0['params']['id']}})[_0x9edd('0x1e')](handleEntityNotFound(_0x2fe939,null))['then'](saveUpdates(_0x5a23d0[_0x9edd('0x57')],null))[_0x9edd('0x1e')](respondWithResult(_0x2fe939,null))[_0x9edd('0x26')](handleError(_0x2fe939,null));};exports[_0x9edd('0x65')]=function(_0x2c7245,_0x34d086,_0x5975f9){_0x2c7245[_0x9edd('0x57')][_0x9edd('0x66')]=_0x2c7245[_0x9edd('0x64')][_0x9edd('0x67')];return db[_0x9edd('0x37')][_0x9edd('0x55')]({'where':{'id':_0x2c7245[_0x9edd('0x54')]['id']}})[_0x9edd('0x1e')](handleEntityNotFound(_0x34d086,null))['then'](saveUpdates(_0x2c7245[_0x9edd('0x57')],null))[_0x9edd('0x1e')](respondWithResult(_0x34d086,null))[_0x9edd('0x26')](handleError(_0x34d086,null));};exports[_0x9edd('0x68')]=function(_0x385814,_0x2e75c6,_0x3ce64e){_0x385814[_0x9edd('0x57')][_0x9edd('0x69')]=_0x385814[_0x9edd('0x64')][_0x9edd('0x67')];return db[_0x9edd('0x37')][_0x9edd('0x55')]({'where':{'id':_0x385814[_0x9edd('0x54')]['id']}})[_0x9edd('0x1e')](handleEntityNotFound(_0x2e75c6,null))[_0x9edd('0x1e')](saveUpdates(_0x385814[_0x9edd('0x57')],null))[_0x9edd('0x1e')](respondWithResult(_0x2e75c6,null))[_0x9edd('0x26')](handleError(_0x2e75c6,null));};exports[_0x9edd('0x6a')]=function(_0x220701,_0x495db0,_0xa704eb){_0x220701['body']['systemAvatar']=_0x220701[_0x9edd('0x64')][_0x9edd('0x67')];return db[_0x9edd('0x37')][_0x9edd('0x55')]({'where':{'id':_0x220701[_0x9edd('0x54')]['id']}})[_0x9edd('0x1e')](handleEntityNotFound(_0x495db0,null))[_0x9edd('0x1e')](saveUpdates(_0x220701[_0x9edd('0x57')],null))[_0x9edd('0x1e')](respondWithResult(_0x495db0,null))[_0x9edd('0x26')](handleError(_0x495db0,null));};exports['getLogo']=function(_0x423df4,_0x3c2c2c,_0x48f1ae){var _0x568067=path[_0x9edd('0x6b')](config[_0x9edd('0x6c')],_0x9edd('0x6d'));var _0x28a8ff={'where':{'id':_0x423df4['params']['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x272623=![];return require('../../config/license/util')[_0x9edd('0x6e')]()[_0x9edd('0x1e')](function(_0x3e2404){if(_0x3e2404){_0x272623=_0x3e2404['custom'];}})['then'](function(){return db['ChatWebsite'][_0x9edd('0x55')](_0x28a8ff);})[_0x9edd('0x1e')](handleEntityNotFound(_0x3c2c2c,null))[_0x9edd('0x1e')](function(_0x5bfbfd){if(_0x5bfbfd){if(!_[_0x9edd('0x6f')](_0x5bfbfd[_0x9edd('0x63')])){if(fs['existsSync'](path[_0x9edd('0x6b')](config[_0x9edd('0x6c')],'server/files/images/logos/',_0x5bfbfd['sitepic']))&&_0x272623){_0x568067=path[_0x9edd('0x6b')](config[_0x9edd('0x6c')],'server/files/images/logos/',_0x5bfbfd[_0x9edd('0x63')]);}}return _0x3c2c2c[_0x9edd('0x70')](_0x568067);}})['catch'](handleError(_0x3c2c2c,null));};exports[_0x9edd('0x71')]=function(_0x479ccb,_0x308a0f,_0x293d05){var _0x23eb54=path[_0x9edd('0x6b')](config[_0x9edd('0x6c')],_0x9edd('0x72'));var _0x58bc3c={'where':{'id':_0x479ccb[_0x9edd('0x54')]['id']},'attributes':['id',_0x9edd('0x66')],'raw':!![]};return db[_0x9edd('0x37')]['find'](_0x58bc3c)[_0x9edd('0x1e')](handleEntityNotFound(_0x308a0f,null))['then'](function(_0x24ec69){if(_0x24ec69){if(!_[_0x9edd('0x6f')](_0x24ec69[_0x9edd('0x66')])){if(fs[_0x9edd('0x73')](path['join'](config['root'],'server/files/images/avatars/',_0x24ec69[_0x9edd('0x66')]))){_0x23eb54=path[_0x9edd('0x6b')](config[_0x9edd('0x6c')],'server/files/images/avatars/',_0x24ec69[_0x9edd('0x66')]);}}return _0x308a0f[_0x9edd('0x70')](_0x23eb54);}})[_0x9edd('0x26')](handleError(_0x308a0f,null));};exports[_0x9edd('0x74')]=function(_0x1aa77f,_0x4345eb,_0x558d0a){var _0x5e5cda=path[_0x9edd('0x6b')](config[_0x9edd('0x6c')],_0x9edd('0x75'));var _0x5c299a={'where':{'id':_0x1aa77f[_0x9edd('0x54')]['id']},'attributes':['id',_0x9edd('0x69'),_0x9edd('0x76')],'raw':!![]};return db[_0x9edd('0x37')]['find'](_0x5c299a)[_0x9edd('0x1e')](handleEntityNotFound(_0x4345eb,null))['then'](function(_0x3d8b18){if(_0x3d8b18){if(!_[_0x9edd('0x6f')](_0x3d8b18[_0x9edd('0x69')])){if(fs[_0x9edd('0x73')](path[_0x9edd('0x6b')](config['root'],_0x9edd('0x77'),_0x3d8b18['customerAvatar']))&&_0x3d8b18[_0x9edd('0x76')]){_0x5e5cda=path['join'](config[_0x9edd('0x6c')],'server/files/images/avatars/',_0x3d8b18[_0x9edd('0x69')]);}}return _0x4345eb[_0x9edd('0x70')](_0x5e5cda);}})[_0x9edd('0x26')](handleError(_0x4345eb,null));};exports['getSystemAvatar']=function(_0x244dce,_0x7512ea,_0x1c5038){var _0x2e7b0d=path[_0x9edd('0x6b')](config[_0x9edd('0x6c')],_0x9edd('0x78'));var _0x311f11={'where':{'id':_0x244dce[_0x9edd('0x54')]['id']},'attributes':['id',_0x9edd('0x79')],'raw':!![]};return db[_0x9edd('0x37')][_0x9edd('0x55')](_0x311f11)[_0x9edd('0x1e')](handleEntityNotFound(_0x7512ea,null))[_0x9edd('0x1e')](function(_0x33dbe8){if(_0x33dbe8){if(!_[_0x9edd('0x6f')](_0x33dbe8[_0x9edd('0x79')])){if(fs[_0x9edd('0x73')](path[_0x9edd('0x6b')](config[_0x9edd('0x6c')],_0x9edd('0x77'),_0x33dbe8[_0x9edd('0x79')]))){_0x2e7b0d=path['join'](config[_0x9edd('0x6c')],'server/files/images/avatars/',_0x33dbe8[_0x9edd('0x79')]);}}return _0x7512ea[_0x9edd('0x70')](_0x2e7b0d);}})[_0x9edd('0x26')](handleError(_0x7512ea,null));};exports[_0x9edd('0x7a')]=function(_0x126034,_0x5465fd,_0x2d7cff){var _0x515913=require(_0x9edd('0x7b'));var _0x438cc5=new _0x515913();var _0x3bd4cc=_0x438cc5[_0x9edd('0x7c')](_0x126034[_0x9edd('0x7d')][_0x9edd('0x7e')])['getResult']();var _0x2d5389={'body':_0x126034[_0x9edd('0x57')],'channel':'chat'};var _0x4f7350=[];var _0x4adea1=[];var _0x5e2be1={};var _0x2a8525=![];return db[_0x9edd('0x7f')][_0x9edd('0x58')]()[_0x9edd('0x1e')](function(_0x239774){if(!_0x239774){throw new db[(_0x9edd('0x80'))][(_0x9edd('0x81'))](_0x9edd('0x82'));}_0x4f7350=_[_0x9edd('0x83')](_[_0x9edd('0x3a')](_0x239774),['createdAt',_0x9edd('0x84')]);_0x4adea1=_['difference'](_['keys'](_0x239774),[_0x9edd('0x85'),_0x9edd('0x84'),_0x9edd('0x86'),_0x9edd('0x87')]);if(_0x126034[_0x9edd('0x57')]['id']){delete _0x126034['body']['id'];}if(_[_0x9edd('0x6f')](_0x126034[_0x9edd('0x57')][_0x9edd('0x88')])){throw new db[(_0x9edd('0x80'))]['ValidationError'](_0x9edd('0x89'));}if(_[_0x9edd('0x6f')](_0x126034[_0x9edd('0x57')][_0x9edd('0x57')])||_0x126034[_0x9edd('0x57')][_0x9edd('0x57')]===''){throw new db[(_0x9edd('0x80'))][(_0x9edd('0x81'))](_0x9edd('0x8a'));}if(_[_0x9edd('0x6f')](_0x126034[_0x9edd('0x57')]['mapKey'])){throw new db[(_0x9edd('0x80'))][(_0x9edd('0x81'))](_0x9edd('0x8b')+_0x4adea1);}if(!_[_0x9edd('0x8c')](_0x4adea1,_0x126034[_0x9edd('0x57')][_0x9edd('0x8d')])){throw new db[(_0x9edd('0x80'))][(_0x9edd('0x81'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4adea1);}_0x5e2be1[_0x126034['body']['mapKey']]=_0x126034[_0x9edd('0x57')][_0x9edd('0x88')];})[_0x9edd('0x1e')](function(){return db[_0x9edd('0x37')][_0x9edd('0x55')]({'where':{'id':_0x126034[_0x9edd('0x54')]['id']},'include':[{'model':db[_0x9edd('0x8e')],'as':_0x9edd('0x8f'),'include':[{'model':db[_0x9edd('0x7f')],'as':_0x9edd('0x90'),'where':_0x5e2be1,'limit':0x1,'order':[['updatedAt',_0x9edd('0x91')]]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})[_0x9edd('0x1e')](handleEntityNotFound(_0x5465fd,null))[_0x9edd('0x1e')](function(_0x2d2ce9){if(_0x2d2ce9&&_0x2d2ce9['List']){_0x2d5389['account']=_0x2d2ce9;_0x2d5389['applications']=_0x2d2ce9['Applications'];_0x2d5389['list']=_0x2d2ce9[_0x9edd('0x8f')];_0x2d5389[_0x9edd('0x92')]=_[_0x9edd('0x93')](_0x2d5389['applications'],[_0x9edd('0x94')],[_0x9edd('0x95')]);if(_0x2d5389[_0x9edd('0x96')]['Applications']){delete _0x2d5389[_0x9edd('0x96')]['Applications'];}if(_0x2d5389[_0x9edd('0x96')][_0x9edd('0x8f')]&&_0x2d5389[_0x9edd('0x96')][_0x9edd('0x8f')]['Contacts'][_0x9edd('0x42')]){return _0x2d5389[_0x9edd('0x96')]['List'][_0x9edd('0x90')][0x0];}var _0x36e825=_[_0x9edd('0x15')](_0x126034[_0x9edd('0x57')],{'firstName':_0x126034['body'][_0x9edd('0x88')],'ListId':_0x2d2ce9[_0x9edd('0x87')]});_0x36e825[_0x126034[_0x9edd('0x57')][_0x9edd('0x8d')]]=_0x126034[_0x9edd('0x57')][_0x9edd('0x88')];return db[_0x9edd('0x7f')]['create'](_0x36e825,{'fields':_0x4f7350,'raw':!![]});}})[_0x9edd('0x1e')](handleEntityNotFound(_0x5465fd,null))['then'](function(_0x27d830){_0x2d5389[_0x9edd('0x97')]=_0x27d830;if(_0x27d830){var _0x49cbc7={'ContactId':_0x27d830['id'],'ChatWebsiteId':_0x126034[_0x9edd('0x54')]['id'],'from':(_0x27d830[_0x9edd('0x98')]||'')+'\x20'+(_0x27d830[_0x9edd('0x99')]||''),'customerIp':_0x126034['body'][_0x9edd('0x9a')],'referer':_0x126034[_0x9edd('0x57')][_0x9edd('0x9b')],'browserName':_0x3bd4cc['browser'][_0x9edd('0x34')]&&_0x3bd4cc['browser'][_0x9edd('0x9c')]?util[_0x9edd('0x9d')](_0x9edd('0x9e'),_0x3bd4cc[_0x9edd('0x9f')]['name'],_0x3bd4cc['browser'][_0x9edd('0x9c')]):_0x9edd('0xa0'),'browserVersion':_0x3bd4cc[_0x9edd('0x9f')][_0x9edd('0x9c')]||_0x9edd('0xa0'),'osName':util['format'](_0x9edd('0x9e'),_0x3bd4cc['os'][_0x9edd('0x34')],_0x3bd4cc['os'][_0x9edd('0x9c')]),'osVersion':_0x3bd4cc['os'][_0x9edd('0x9c')],'deviceModel':_0x3bd4cc[_0x9edd('0xa1')][_0x9edd('0x39')]&&_0x3bd4cc[_0x9edd('0xa1')][_0x9edd('0xa2')]?util[_0x9edd('0x9d')](_0x9edd('0xa3'),_0x3bd4cc[_0x9edd('0xa1')][_0x9edd('0x39')],_0x3bd4cc[_0x9edd('0xa1')]['vendor'],_0x3bd4cc[_0x9edd('0xa1')][_0x9edd('0xa4')]):null,'deviceVendor':_0x3bd4cc[_0x9edd('0xa1')][_0x9edd('0xa2')],'deviceType':_0x3bd4cc['device'][_0x9edd('0xa4')],'formData':JSON[_0x9edd('0xa5')](_0x126034[_0x9edd('0x57')])};var _0x4d6002={'ChatWebsiteId':_0x126034[_0x9edd('0x54')]['id'],'closed':![]};if(_0x126034['body']['threadId']){_0x4d6002[_0x9edd('0xa6')]=_0x126034[_0x9edd('0x57')][_0x9edd('0xa6')];return db[_0x9edd('0xa7')]['find']({'where':_0x4d6002})[_0x9edd('0x1e')](function(_0x27e060){if(_0x27e060){return[_0x27e060,![]];}_0x49cbc7[_0x9edd('0xa6')]=_0x126034[_0x9edd('0x57')][_0x9edd('0xa6')];_0x49cbc7[_0x9edd('0xa8')]=_0x126034[_0x9edd('0x57')][_0x9edd('0xa8')];return db[_0x9edd('0xa7')][_0x9edd('0x56')](_0x49cbc7)[_0x9edd('0x1e')](function(_0x2f8376){return[_0x2f8376,!![]];});});}_0x4d6002['ContactId']=_0x27d830['id'];if(_0x126034[_0x9edd('0x57')][_0x9edd('0xa9')]&&_0x126034[_0x9edd('0x57')][_0x9edd('0xa9')]['id']){_0x4d6002['id']=_0x126034[_0x9edd('0x57')]['interaction']['id'];return db[_0x9edd('0xa7')]['find']({'where':_0x4d6002})[_0x9edd('0x1e')](function(_0x22fb1d){if(_0x22fb1d){return[_0x22fb1d,![]];}return db['ChatInteraction']['create'](_0x49cbc7)[_0x9edd('0x1e')](function(_0x3686c0){return[_0x3686c0,!![]];});});}return db[_0x9edd('0xa7')][_0x9edd('0x56')](_0x49cbc7)[_0x9edd('0x1e')](function(_0x53535e){return[_0x53535e,!![]];});}})['spread'](function(_0x2567c8,_0x2a10ba){if(_0x2567c8){_0x2a8525=_0x2a10ba;if(!_0x2a10ba){return _0x2567c8[_0x9edd('0x32')]({'from':(_0x2d5389[_0x9edd('0x97')]['firstName']||'')+'\x20'+(_0x2d5389[_0x9edd('0x97')][_0x9edd('0x99')]||'')});}else{return _0x2567c8;}}})[_0x9edd('0x1e')](function(_0xecf9b7){_0x2d5389[_0x9edd('0xa9')]=_0xecf9b7[_0x9edd('0xaa')]({'plain':!![]});_0x2d5389[_0x9edd('0xa9')]['created']=_0x2a8525;if(_0x2d5389[_0x9edd('0xa9')][_0x9edd('0xab')]){if(_0x2d5389[_0x9edd('0x96')][_0x9edd('0xac')]){_0x2d5389[_0x9edd('0x92')][_0x9edd('0xad')]({'id':0x0,'priority':_0x2d5389[_0x9edd('0x92')][_0x9edd('0x42')]+0x1,'app':_0x9edd('0xae'),'appdata':_0x9edd('0xaf'),'interval':_0x9edd('0xb0')});}}return db[_0x9edd('0xb1')][_0x9edd('0x56')]({'body':_0x126034['body'][_0x9edd('0x57')],'ChatWebsiteId':_0x126034[_0x9edd('0x54')]['id'],'ChatInteractionId':_0xecf9b7['id'],'direction':'in','ContactId':_0x2d5389[_0x9edd('0x97')]['id'],'AttachmentId':_0x126034[_0x9edd('0x57')]['AttachmentId']});})[_0x9edd('0x1e')](function(_0x2d340b){_0x2d5389[_0x9edd('0x23')]=_0x2d340b;if(_0x2d5389[_0x9edd('0xa9')][_0x9edd('0xb2')]){return db[_0x9edd('0xb3')][_0x9edd('0x55')]({'attributes':['id',_0x9edd('0x34')],'where':{'id':_0x2d5389[_0x9edd('0xa9')][_0x9edd('0xb2')]}})[_0x9edd('0x1e')](function(_0x524a47){if(_0x524a47){_0x2d5389[_0x9edd('0x92')][_0x9edd('0xb4')]({'id':0x0,'priority':0x0,'app':_0x9edd('0xb5'),'appdata':_0x524a47[_0x9edd('0x34')]+','+(_0x2d5389[_0x9edd('0x96')][_0x9edd('0xb6')]||0xa),'interval':_0x9edd('0xb0')});_0x2d5389['forcedOwnership']=!![];}return respondWithRpcPromise(_0x9edd('0xb7'),_0x9edd('0xb8'),_0x2d5389);});}return respondWithRpcPromise(_0x9edd('0xb7'),_0x9edd('0xb8'),_0x2d5389);})[_0x9edd('0x1e')](function(_0x116fcb){respondWithRpcPromise(_0x9edd('0xb9'),_0x9edd('0xb9'),{'event':_0x9edd('0x7a'),'message':_0x116fcb},client9002);return _0x116fcb;})[_0x9edd('0x1e')](respondWithResult(_0x5465fd,null))[_0x9edd('0x26')](handleError(_0x5465fd,null));};exports[_0x9edd('0xba')]=function(_0x2ef994,_0x35e0ce,_0x73985d){var _0xd227fe,_0x106889,_0x56a952;var _0xadc0be=[];var _0x300094=[];var _0x15fce6={};return db[_0x9edd('0x7f')][_0x9edd('0x58')]()[_0x9edd('0x1e')](function(_0x39a099){if(!_0x39a099){throw new db[(_0x9edd('0x80'))][(_0x9edd('0x81'))]('no\x20available\x20attributes');}_0x300094=_[_0x9edd('0x83')](_[_0x9edd('0x3a')](_0x39a099),[_0x9edd('0x85'),'updatedAt']);_0xadc0be=_[_0x9edd('0x83')](_['keys'](_0x39a099),[_0x9edd('0x85'),'updatedAt',_0x9edd('0x86'),_0x9edd('0x87')]);if(_0x2ef994['body']['id']){delete _0x2ef994[_0x9edd('0x57')]['id'];}if(_[_0x9edd('0x6f')](_0x2ef994[_0x9edd('0x57')][_0x9edd('0x88')])){throw _0x35e0ce[_0x9edd('0x28')](0x1f4)[_0x9edd('0x35')](new db[(_0x9edd('0x80'))]['ValidationError'](_0x9edd('0x89')));}if(_[_0x9edd('0x6f')](_0x2ef994['body'][_0x9edd('0x57')])||_0x2ef994['body'][_0x9edd('0x57')]===''){throw _0x35e0ce[_0x9edd('0x28')](0x1f4)[_0x9edd('0x35')](new db[(_0x9edd('0x80'))][(_0x9edd('0x81'))](_0x9edd('0x8a')));}if(_[_0x9edd('0x6f')](_0x2ef994[_0x9edd('0x57')][_0x9edd('0xbb')])){throw _0x35e0ce[_0x9edd('0x28')](0x1f4)[_0x9edd('0x35')](new db[(_0x9edd('0x80'))]['ValidationError']('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xadc0be));}if(!_[_0x9edd('0x8c')](_0xadc0be,_0x2ef994[_0x9edd('0x57')][_0x9edd('0xbb')])){throw _0x35e0ce[_0x9edd('0x28')](0x1f4)[_0x9edd('0x35')](new db[(_0x9edd('0x80'))][(_0x9edd('0x81'))](_0x9edd('0xbc')+_0xadc0be));}_0x15fce6[_0x2ef994[_0x9edd('0x57')]['mapKeyOffline']]=_0x2ef994[_0x9edd('0x57')]['from'];})[_0x9edd('0x1e')](function(){return db[_0x9edd('0x37')][_0x9edd('0x55')]({'where':{'id':_0x2ef994[_0x9edd('0x54')]['id']},'include':[{'model':db[_0x9edd('0x8e')],'as':_0x9edd('0x8f')}]});})[_0x9edd('0x1e')](handleEntityNotFound(_0x35e0ce,null))[_0x9edd('0x1e')](function(_0x39243e){if(_0x39243e&&_0x39243e[_0x9edd('0x8f')]){_0x106889=_0x39243e;var _0x77a00c=_[_0x9edd('0x15')](_0x2ef994[_0x9edd('0x57')],{'firstName':_0x2ef994[_0x9edd('0x57')][_0x9edd('0x88')],'phone':_0x2ef994[_0x9edd('0x57')][_0x9edd('0x88')],'ListId':_0x39243e[_0x9edd('0x87')]});_0x77a00c[_0x2ef994[_0x9edd('0x57')]['mapKeyOffline']]=_0x2ef994['body'][_0x9edd('0x88')];return db['CmContact'][_0x9edd('0xbd')]({'where':_0x15fce6,'defaults':_0x77a00c});}})[_0x9edd('0xbe')](function(_0x135452){if(_0x135452){_0x56a952=_0x135452;var _0x402108=fs['readFileSync'](path['join'](config[_0x9edd('0x6c')],_0x9edd('0xbf')),_0x9edd('0xc0'));var _0xf841b1=ejs[_0x9edd('0xc1')](_0x402108,{'body':_['toPairs'](_0x2ef994[_0x9edd('0x57')]['body']),'bodyTitle':_0x106889[_0x9edd('0xc2')]});return db[_0x9edd('0xc3')][_0x9edd('0x56')]({'body':_0xf841b1,'ContactId':_0x135452['id'],'ChatWebsiteId':_0x106889['id']});}})[_0x9edd('0x1e')](function(_0x5c8edb){if(_0x5c8edb){_0xd227fe=_0x5c8edb;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x9edd('0xc4')],'as':_0x9edd('0xc5'),'raw':!![]}]});}})[_0x9edd('0x1e')](function(_0x268e54){if(_0x268e54&&_0x268e54[_0x9edd('0xc5')]&&_0x106889[_0x9edd('0xc6')]){var _0x48632d={'tls':{'rejectUnauthorized':![]}};if(_0x268e54[_0x9edd('0xc5')][_0x9edd('0xc7')]){_0x48632d['service']=_0x268e54['Smtp'][_0x9edd('0xc7')];}else{_0x48632d[_0x9edd('0xc8')]=_0x268e54[_0x9edd('0xc5')]['host'];_0x48632d[_0x9edd('0xc9')]=_0x268e54[_0x9edd('0xc5')][_0x9edd('0xc9')];_0x48632d[_0x9edd('0xca')]=_0x268e54['Smtp'][_0x9edd('0xca')];}if(_0x268e54[_0x9edd('0xc5')][_0x9edd('0xcb')]){_0x48632d[_0x9edd('0xcc')]={'user':_0x268e54[_0x9edd('0xc5')][_0x9edd('0xcd')],'pass':_0x268e54['Smtp'][_0x9edd('0xce')]};}return respondWithRpcPromise(_0x9edd('0xcf'),_0x9edd('0xd0'),{'account':_0x48632d,'message':{'from':util[_0x9edd('0x9d')]('\x22%s\x22\x20<%s>',_0x268e54['name'],_0x268e54[_0x9edd('0xd1')]||_0x268e54[_0x9edd('0xc5')][_0x9edd('0xcd')]),'to':_0x106889[_0x9edd('0xc6')],'subject':_0x106889[_0x9edd('0xd2')],'text':_0xd227fe[_0x9edd('0x57')]}},client9003)[_0x9edd('0x1e')](function(){return _0xd227fe;})[_0x9edd('0x26')](function(_0xad1233){console[_0x9edd('0x22')](_0xad1233);});}})[_0x9edd('0x1e')](function(){if(_0xd227fe){return _0xd227fe;}})[_0x9edd('0x1e')](respondWithResult(_0x35e0ce,null))['catch'](handleError(_0x35e0ce,null));};exports['addInteraction']=function(_0x2fb82d,_0x12cb24,_0x3bbec8){return db[_0x9edd('0xa7')][_0x9edd('0x55')]({'where':{'id':_0x2fb82d[_0x9edd('0x54')]['id']}})[_0x9edd('0x1e')](handleEntityNotFound(_0x12cb24,null))[_0x9edd('0x1e')](function(_0x5b3603){if(_0x5b3603){return _0x5b3603[_0x9edd('0xd3')](_0x2fb82d[_0x9edd('0x57')][_0x9edd('0x61')],_[_0x9edd('0xd4')](_0x2fb82d[_0x9edd('0x57')],[_0x9edd('0x61'),'id'])||{});}})['then'](respondWithResult(_0x12cb24,null))['catch'](handleError(_0x12cb24,null));};exports[_0x9edd('0xd5')]=function(_0xd353c9,_0x4cab68,_0x50c328){var _0x4bafc8={'raw':![],'where':{}};var _0x301e25={};var _0x18b6b2={'count':0x0,'rows':[]};return db[_0x9edd('0x37')][_0x9edd('0x5e')]({'where':{'id':_0xd353c9[_0x9edd('0x54')]['id']}})[_0x9edd('0x1e')](handleEntityNotFound(_0x4cab68,null))[_0x9edd('0x1e')](function(_0x1a6fa2){if(_0x1a6fa2){_0x301e25[_0x9edd('0x39')]=_[_0x9edd('0x3a')](db[_0x9edd('0xa7')]['rawAttributes']);_0x301e25[_0x9edd('0x3b')]=_['keys'](_0xd353c9['query']);_0x301e25['filters']=_[_0x9edd('0x3f')](_0x301e25[_0x9edd('0x39')],_0x301e25['query']);_0x4bafc8['attributes']=_['intersection'](_0x301e25['model'],qs[_0x9edd('0x41')](_0xd353c9[_0x9edd('0x3b')][_0x9edd('0x41')]));_0x4bafc8['attributes']=_0x4bafc8[_0x9edd('0x40')][_0x9edd('0x42')]?_0x4bafc8[_0x9edd('0x40')]:_0x301e25[_0x9edd('0x39')];if(!_0xd353c9[_0x9edd('0x3b')]['hasOwnProperty'](_0x9edd('0x44'))){_0x4bafc8['limit']=qs[_0x9edd('0x2c')](_0xd353c9['query'][_0x9edd('0x2c')]);_0x4bafc8[_0x9edd('0x2b')]=qs[_0x9edd('0x2b')](_0xd353c9['query'][_0x9edd('0x2b')]);}_0x4bafc8[_0x9edd('0x45')]=qs[_0x9edd('0x46')](_0xd353c9['query']['sort']);_0x4bafc8[_0x9edd('0x47')]=qs[_0x9edd('0x3e')](_[_0x9edd('0x48')](_0xd353c9[_0x9edd('0x3b')],_0x301e25[_0x9edd('0x3e')]));_0x4bafc8[_0x9edd('0x47')][_0x9edd('0x5b')]=_0x1a6fa2['id'];if(_0xd353c9[_0x9edd('0x3b')][_0x9edd('0x4b')]){_0x4bafc8[_0x9edd('0x47')]=_['merge'](_0x4bafc8[_0x9edd('0x47')],{'$or':_[_0x9edd('0x4d')](_0x4bafc8['attributes'],function(_0x5b268b){var _0x25ec9f={};_0x25ec9f[_0x5b268b]={'$like':'%'+_0xd353c9[_0x9edd('0x3b')][_0x9edd('0x4b')]+'%'};return _0x25ec9f;})});}_0x4bafc8=_[_0x9edd('0x4c')]({},_0x4bafc8,_0xd353c9['options']);return db[_0x9edd('0xa7')][_0x9edd('0x4f')]({'where':_0x4bafc8[_0x9edd('0x47')]})[_0x9edd('0x1e')](function(_0x5d8749){_0x18b6b2[_0x9edd('0x4f')]=_0x5d8749;if(_0xd353c9[_0x9edd('0x3b')][_0x9edd('0x50')]){_0x4bafc8['include']=[{'model':db[_0x9edd('0x7f')],'as':_0x9edd('0xd6'),'required':![]},{'model':db[_0x9edd('0xb3')],'as':_0x9edd('0xd7'),'attributes':[_0x9edd('0x34'),_0x9edd('0xd8'),_0x9edd('0xd9')],'required':![]},{'model':db['Tag'],'as':_0x9edd('0xda'),'attributes':['id',_0x9edd('0x34'),'color'],'where':_0xd353c9[_0x9edd('0x3b')]['tag']?{'id':_0xd353c9['query'][_0x9edd('0xdb')]}:undefined,'required':_0xd353c9[_0x9edd('0x3b')][_0x9edd('0xdb')]?!![]:![]}];}return db[_0x9edd('0xa7')][_0x9edd('0x52')](_0x4bafc8);})[_0x9edd('0x1e')](function(_0xb6e59a){_0x18b6b2[_0x9edd('0x5c')]=_0xb6e59a;return _0x18b6b2;});}})[_0x9edd('0x1e')](respondWithFilteredResult(_0x4cab68,_0x4bafc8))[_0x9edd('0x26')](handleError(_0x4cab68,null));};function iftimePromise(_0x2f798f,_0x55753d){return respondWithRpcPromise('Command',_0x9edd('0xdc'),{'command':_0x55753d[_0x9edd('0xdd')]?util[_0x9edd('0x9d')](_0x9edd('0xde'),_0x2f798f[_0x9edd('0xdf')],_0x55753d[_0x9edd('0xdd')]):util['format'](_0x9edd('0xe0'),_0x2f798f[_0x9edd('0xdf')])},client9002)[_0x9edd('0x1e')](function(_0x4c06ed){var _0x3e9430=_0x4c06ed&&_0x4c06ed['indexOf']('true')>=0x0?!![]:![];logger['info'](_0x9edd('0xe1'),_0x55753d['id'],_0x2f798f['id'],_0x2f798f[_0x9edd('0xdf')],_0x3e9430?_0x9edd('0xe2'):_0x9edd('0xe3'),_0x55753d[_0x9edd('0xdd')]?_0x55753d[_0x9edd('0xdd')]:_0x9edd('0xe4'));return _0x3e9430;})[_0x9edd('0x26')](function(_0xefe1d2){logger['error'](_0x9edd('0xe1'),_0x55753d['id'],_0x2f798f['id'],_0x2f798f[_0x9edd('0xdf')],util['inspect'](_0xefe1d2,{'showHidden':![],'depth':null}),_0x55753d['timezone']?_0x55753d[_0x9edd('0xdd')]:_0x9edd('0xe4'));return![];});}exports['getSnippet']=function(_0x17c5a6,_0x42c24c,_0x9e245f){var _0xaa92b9=0x0;var _0x4f292d=0x0;var _0x2dce8d=![];var _0x460bdd;var _0x3864ea;return db['ChatWebsite'][_0x9edd('0x55')]({'where':{'id':_0x17c5a6[_0x9edd('0x54')]['id']},'include':[{'model':db[_0x9edd('0xe5')],'as':_0x9edd('0xe5'),'include':[{'model':db[_0x9edd('0xe5')],'as':_0x9edd('0xe6'),'attributes':['id',_0x9edd('0xdf')],'raw':!![]}]}]})[_0x9edd('0x1e')](handleEntityNotFound(_0x42c24c,null))['then'](function(_0x595102){if(_0x595102){_0x460bdd=_0x595102;return _0x595102[_0x9edd('0xe7')]({'raw':!![]});}})[_0x9edd('0x1e')](function(_0x17b547){if(_0x460bdd){if(_0x17b547){_0x3864ea=_0x17b547;}}return require(_0x9edd('0xe8'))[_0x9edd('0x6e')]();})[_0x9edd('0x1e')](function(_0x57845c){if(_0x57845c){_0x4f292d=_0x57845c[_0x9edd('0xe9')];_0x2dce8d=_0x57845c['custom'];}})['then'](function(){return db[_0x9edd('0xa7')][_0x9edd('0x4f')]({'where':{'closed':![]}});})['then'](function(_0x78ae7f){_0xaa92b9=_0x78ae7f;if(_0x4f292d&&_0x78ae7f>_0x4f292d){return db[_0x9edd('0xea')][_0x9edd('0x5e')]({'where':{'id':0x1}})['then'](function(_0x5b652a){if(_0x5b652a){_0x5b652a[_0x9edd('0xeb')](_0x9edd('0xec'));}});}})['then'](function(){if(_0x460bdd['Interval']&&_0x460bdd[_0x9edd('0xe5')][_0x9edd('0xe6')]){var _0x12d142=[];for(var _0x3e61fe=0x0;_0x3e61fe<_0x460bdd['Interval']['Intervals'][_0x9edd('0x42')];_0x3e61fe++){var _0x2f73f2=_0x460bdd['Interval'][_0x9edd('0xe6')][_0x3e61fe]['get']({'plain':!![]});_0x12d142[_0x9edd('0xad')](iftimePromise(_0x2f73f2,_0x460bdd));}return BPromise[_0x9edd('0xed')](_0x12d142)[_0x9edd('0x1e')](function(_0x7e6c2){return _['some'](_0x7e6c2);});}else{return!![];}})[_0x9edd('0x1e')](function(_0x367d84){var _0x4d2d1b=fs[_0x9edd('0xee')](path['join'](config[_0x9edd('0x6c')],_0x9edd('0xef')),_0x9edd('0xc0'));var _0x3e620a={'remote':_0x460bdd[_0x9edd('0xf0')],'query':querystring[_0x9edd('0xa5')](_['merge'](_0x460bdd[_0x9edd('0xaa')]({'plain':!![]}),{'customerIp':_0x17c5a6[_0x9edd('0x7d')][_0x9edd('0xf1')]||_0x17c5a6[_0x9edd('0x7d')][_0x9edd('0xf2')]||_0x17c5a6[_0x9edd('0xf3')][_0x9edd('0xf4')]||_0x17c5a6['ip'],'referer':_0x17c5a6[_0x9edd('0x7d')][_0x9edd('0x9b')],'openedInteractions':_0xaa92b9,'maxInteractions':_0x4f292d,'virtual':_0x2dce8d[_0x9edd('0xe9')],'online':_0x367d84,'custom':_0x2dce8d}))['replace'](/'/g,'\x5c\x27')};_0x42c24c[_0x9edd('0x35')](ejs[_0x9edd('0xc1')](Mustache[_0x9edd('0xc1')](_0x4d2d1b,_0x3e620a),{'proactiveActions':_0x3864ea,'alignment':_0x460bdd[_0x9edd('0xf5')],'verticalAlignment':_0x460bdd[_0x9edd('0xf6')]}));})[_0x9edd('0x26')](handleError(_0x42c24c,null));};exports[_0x9edd('0xf7')]=function(_0x2f5a6e,_0x114c95,_0x20f2a0){return db[_0x9edd('0x37')][_0x9edd('0x5e')]({'where':{'id':_0x2f5a6e[_0x9edd('0x54')]['id']}})[_0x9edd('0x1e')](handleEntityNotFound(_0x114c95,null))[_0x9edd('0x1e')](function(_0x55a9ae){if(_0x55a9ae){return db[_0x9edd('0xf8')]['transaction'](function(_0x48bbd8){return db[_0x9edd('0xf9')][_0x9edd('0x33')]({'where':{'ChatWebsiteId':_0x2f5a6e[_0x9edd('0x54')]['id']},'transaction':_0x48bbd8})['then'](function(_0x60607e){var _0xfc9c37=_['map'](_0x2f5a6e['body'],function(_0x3d9ec8){_0x3d9ec8[_0x9edd('0x5b')]=_0x2f5a6e['params']['id'];return _0x3d9ec8;});return db[_0x9edd('0xf9')][_0x9edd('0xfa')](_0xfc9c37,{'transaction':_0x48bbd8});});})['then'](function(){return db[_0x9edd('0xf9')][_0x9edd('0xfb')]({'where':{'ChatWebsiteId':_0x2f5a6e[_0x9edd('0x54')]['id']},'order':_0x9edd('0x94')});});}})[_0x9edd('0x1e')](respondWithResult(_0x114c95,null))[_0x9edd('0x26')](handleError(_0x114c95,null));};exports[_0x9edd('0xfc')]=function(_0x17ae65,_0x55aae3,_0x3f580c){var _0x15bffc={};var _0x24dba6={};var _0x159472;var _0xa8c9f9;return db[_0x9edd('0x37')]['findOne']({'where':{'id':_0x17ae65[_0x9edd('0x54')]['id']}})[_0x9edd('0x1e')](handleEntityNotFound(_0x55aae3,null))[_0x9edd('0x1e')](function(_0xf9f712){if(_0xf9f712){_0x159472=_0xf9f712;_0x24dba6[_0x9edd('0x39')]=_[_0x9edd('0x3a')](db[_0x9edd('0xf9')]['rawAttributes']);_0x24dba6[_0x9edd('0x3b')]=_[_0x9edd('0x3a')](_0x17ae65[_0x9edd('0x3b')]);_0x24dba6['filters']=_[_0x9edd('0x3f')](_0x24dba6[_0x9edd('0x39')],_0x24dba6[_0x9edd('0x3b')]);_0x15bffc[_0x9edd('0x40')]=_[_0x9edd('0x3f')](_0x24dba6['model'],qs[_0x9edd('0x41')](_0x17ae65[_0x9edd('0x3b')][_0x9edd('0x41')]));_0x15bffc[_0x9edd('0x40')]=_0x15bffc[_0x9edd('0x40')]['length']?_0x15bffc['attributes']:_0x24dba6['model'];_0x15bffc[_0x9edd('0x45')]=qs[_0x9edd('0x46')](_0x17ae65[_0x9edd('0x3b')][_0x9edd('0x46')]);_0x15bffc[_0x9edd('0x47')]=qs['filters'](_[_0x9edd('0x48')](_0x17ae65[_0x9edd('0x3b')],_0x24dba6[_0x9edd('0x3e')]));if(_0x17ae65[_0x9edd('0x3b')]['filter']){_0x15bffc[_0x9edd('0x47')]=_[_0x9edd('0x4c')](_0x15bffc['where'],{'$or':_[_0x9edd('0x4d')](_0x15bffc[_0x9edd('0x40')],function(_0x464aac){var _0x3e03c6={};_0x3e03c6[_0x464aac]={'$like':'%'+_0x17ae65[_0x9edd('0x3b')][_0x9edd('0x4b')]+'%'};return _0x3e03c6;})});}_0x15bffc=_[_0x9edd('0x4c')]({},_0x15bffc,_0x17ae65[_0x9edd('0x4e')]);return _0x159472[_0x9edd('0xfc')](_0x15bffc);}})[_0x9edd('0x1e')](function(_0x13e584){if(_0x13e584){_0xa8c9f9=_0x13e584['length'];if(!_0x17ae65[_0x9edd('0x3b')][_0x9edd('0x43')]('nolimit')){_0x15bffc[_0x9edd('0x2c')]=qs[_0x9edd('0x2c')](_0x17ae65[_0x9edd('0x3b')]['limit']);_0x15bffc[_0x9edd('0x2b')]=qs[_0x9edd('0x2b')](_0x17ae65[_0x9edd('0x3b')][_0x9edd('0x2b')]);}return _0x159472['getApplications'](_0x15bffc);}})[_0x9edd('0x1e')](function(_0x4ffed3){if(_0x4ffed3){return _0x4ffed3?{'count':_0xa8c9f9,'rows':_0x4ffed3}:null;}})[_0x9edd('0x1e')](respondWithResult(_0x55aae3,null))[_0x9edd('0x26')](handleError(_0x55aae3,null));};exports[_0x9edd('0xfd')]=function(_0x2fa6a4,_0x331526,_0x27913e){return db[_0x9edd('0xfe')][_0x9edd('0x55')]({'where':{'id':_0x2fa6a4['params']['id']}})[_0x9edd('0x1e')](handleEntityNotFound(_0x331526,null))[_0x9edd('0x1e')](function(_0x5c05db){if(_0x5c05db){return _0x5c05db[_0x9edd('0xfd')](_0x2fa6a4[_0x9edd('0x57')][_0x9edd('0x61')],_['omit'](_0x2fa6a4[_0x9edd('0x57')],[_0x9edd('0x61'),'id'])||{});}})[_0x9edd('0x1e')](respondWithResult(_0x331526,null))[_0x9edd('0x26')](handleError(_0x331526,null));};exports['getProactiveActions']=function(_0x1fc001,_0x219d8b,_0x17b5b3){var _0x196359={};var _0x36faef={};var _0x2c6e12;var _0x24c627;return db[_0x9edd('0x37')][_0x9edd('0x5e')]({'where':{'id':_0x1fc001[_0x9edd('0x54')]['id']}})['then'](handleEntityNotFound(_0x219d8b,null))[_0x9edd('0x1e')](function(_0x354ec9){if(_0x354ec9){_0x2c6e12=_0x354ec9;_0x36faef['model']=_['keys'](db[_0x9edd('0xff')][_0x9edd('0x38')]);_0x36faef[_0x9edd('0x3b')]=_[_0x9edd('0x3a')](_0x1fc001[_0x9edd('0x3b')]);_0x36faef[_0x9edd('0x3e')]=_['intersection'](_0x36faef[_0x9edd('0x39')],_0x36faef[_0x9edd('0x3b')]);_0x196359[_0x9edd('0x40')]=_[_0x9edd('0x3f')](_0x36faef[_0x9edd('0x39')],qs['fields'](_0x1fc001[_0x9edd('0x3b')][_0x9edd('0x41')]));_0x196359[_0x9edd('0x40')]=_0x196359[_0x9edd('0x40')][_0x9edd('0x42')]?_0x196359['attributes']:_0x36faef['model'];_0x196359[_0x9edd('0x45')]=qs[_0x9edd('0x46')](_0x1fc001[_0x9edd('0x3b')][_0x9edd('0x46')]);_0x196359[_0x9edd('0x47')]=qs['filters'](_[_0x9edd('0x48')](_0x1fc001[_0x9edd('0x3b')],_0x36faef[_0x9edd('0x3e')]));if(_0x1fc001[_0x9edd('0x3b')][_0x9edd('0x4b')]){_0x196359[_0x9edd('0x47')]=_[_0x9edd('0x4c')](_0x196359['where'],{'$or':_['map'](_0x196359[_0x9edd('0x40')],function(_0x47e5bb){var _0x4f19ec={};_0x4f19ec[_0x47e5bb]={'$like':'%'+_0x1fc001[_0x9edd('0x3b')][_0x9edd('0x4b')]+'%'};return _0x4f19ec;})});}_0x196359=_['merge']({},_0x196359,_0x1fc001['options']);return _0x2c6e12[_0x9edd('0xe7')](_0x196359);}})[_0x9edd('0x1e')](function(_0x1c0ad6){if(_0x1c0ad6){_0x24c627=_0x1c0ad6['length'];if(!_0x1fc001[_0x9edd('0x3b')][_0x9edd('0x43')](_0x9edd('0x44'))){_0x196359['limit']=qs[_0x9edd('0x2c')](_0x1fc001[_0x9edd('0x3b')]['limit']);_0x196359[_0x9edd('0x2b')]=qs[_0x9edd('0x2b')](_0x1fc001['query'][_0x9edd('0x2b')]);}return _0x2c6e12[_0x9edd('0xe7')](_0x196359);}})[_0x9edd('0x1e')](function(_0x43e587){if(_0x43e587){return _0x43e587?{'count':_0x24c627,'rows':_0x43e587}:null;}})[_0x9edd('0x1e')](respondWithResult(_0x219d8b,null))[_0x9edd('0x26')](handleError(_0x219d8b,null));};exports[_0x9edd('0x100')]=function(_0x39b3b6,_0x592771,_0x4b33c0){var _0x48bb80=_0x39b3b6[_0x9edd('0x3b')][_0x9edd('0x101')]==='false'?_0x9edd('0x102'):'onlineForm';return db[_0x9edd('0x37')]['find']({'attributes':['id',_0x48bb80],'where':{'id':_0x39b3b6[_0x9edd('0x54')]['id']}})['then'](handleEntityNotFound(_0x592771,null))[_0x9edd('0x1e')](function(_0x1a4c48){if(_0x1a4c48){var _0x4874fc=_0x1a4c48[_0x48bb80];var _0x28e39c=_0x4874fc&&_0x4874fc['items']?_0x4874fc[_0x9edd('0x103')]:[];_0x592771[_0x9edd('0x35')]({'fromKey':_['isNil'](_0x4874fc[_0x9edd('0x104')])?undefined:_0x4874fc['fromKey'],'count':_0x28e39c[_0x9edd('0x42')],'rows':_0x28e39c});}})[_0x9edd('0x26')](handleError(_0x592771,null));};exports[_0x9edd('0x105')]=function(_0x24050c,_0x452acb,_0x2599ab){var _0x479bc2={'raw':!![],'where':{}};var _0x1c44ad={};var _0x1f5bb0={'count':0x0,'rows':[]};return db[_0x9edd('0x37')][_0x9edd('0x5e')]({'where':{'id':_0x24050c[_0x9edd('0x54')]['id']}})[_0x9edd('0x1e')](handleEntityNotFound(_0x452acb,null))['then'](function(_0x3688dd){if(_0x3688dd){_0x1c44ad[_0x9edd('0x39')]=_[_0x9edd('0x3a')](db[_0x9edd('0xc3')]['rawAttributes']);_0x1c44ad[_0x9edd('0x3b')]=_[_0x9edd('0x3a')](_0x24050c['query']);_0x1c44ad[_0x9edd('0x3e')]=_[_0x9edd('0x3f')](_0x1c44ad[_0x9edd('0x39')],_0x1c44ad[_0x9edd('0x3b')]);_0x479bc2[_0x9edd('0x40')]=_['intersection'](_0x1c44ad[_0x9edd('0x39')],qs[_0x9edd('0x41')](_0x24050c[_0x9edd('0x3b')][_0x9edd('0x41')]));_0x479bc2[_0x9edd('0x40')]=_0x479bc2[_0x9edd('0x40')][_0x9edd('0x42')]?_0x479bc2[_0x9edd('0x40')]:_0x1c44ad['model'];if(!_0x24050c[_0x9edd('0x3b')][_0x9edd('0x43')]('nolimit')){_0x479bc2[_0x9edd('0x2c')]=qs[_0x9edd('0x2c')](_0x24050c[_0x9edd('0x3b')][_0x9edd('0x2c')]);_0x479bc2[_0x9edd('0x2b')]=qs[_0x9edd('0x2b')](_0x24050c[_0x9edd('0x3b')][_0x9edd('0x2b')]);}_0x479bc2[_0x9edd('0x45')]=qs[_0x9edd('0x46')](_0x24050c[_0x9edd('0x3b')][_0x9edd('0x46')]);_0x479bc2['where']=qs[_0x9edd('0x3e')](_[_0x9edd('0x48')](_0x24050c[_0x9edd('0x3b')],_0x1c44ad[_0x9edd('0x3e')]));_0x479bc2[_0x9edd('0x47')][_0x9edd('0x5b')]=_0x3688dd['id'];if(_0x24050c['query'][_0x9edd('0x4b')]){_0x479bc2[_0x9edd('0x47')]=_[_0x9edd('0x4c')](_0x479bc2[_0x9edd('0x47')],{'$or':_[_0x9edd('0x4d')](_0x479bc2[_0x9edd('0x40')],function(_0x212b0c){var _0x414c0a={};_0x414c0a[_0x212b0c]={'$like':'%'+_0x24050c[_0x9edd('0x3b')][_0x9edd('0x4b')]+'%'};return _0x414c0a;})});}_0x479bc2=_['merge']({},_0x479bc2,_0x24050c['options']);return db[_0x9edd('0xc3')][_0x9edd('0x4f')]({'where':_0x479bc2['where']})['then'](function(_0x550bd7){_0x1f5bb0[_0x9edd('0x4f')]=_0x550bd7;if(_0x24050c[_0x9edd('0x3b')][_0x9edd('0x50')]){_0x479bc2[_0x9edd('0x51')]=[{'all':!![]}];}return db[_0x9edd('0xc3')]['findAll'](_0x479bc2);})[_0x9edd('0x1e')](function(_0x438ce8){_0x1f5bb0[_0x9edd('0x5c')]=_0x438ce8;return _0x1f5bb0;});}})[_0x9edd('0x1e')](respondWithFilteredResult(_0x452acb,_0x479bc2))[_0x9edd('0x26')](handleError(_0x452acb,null));};exports[_0x9edd('0x106')]=function(_0x27130c,_0x2fc9d0,_0x3c217a){return db[_0x9edd('0x37')]['find']({'where':{'id':_0x27130c[_0x9edd('0x54')]['id']}})[_0x9edd('0x1e')](handleEntityNotFound(_0x2fc9d0,null))[_0x9edd('0x1e')](function(_0x35a143){if(_0x35a143){return _0x35a143[_0x9edd('0x106')](_0x27130c[_0x9edd('0x57')]['ids'],_[_0x9edd('0xd4')](_0x27130c[_0x9edd('0x57')],[_0x9edd('0x61'),'id'])||{})[_0x9edd('0xbe')](function(_0x4614c6){for(var _0x2e9241=0x0;_0x2e9241<_0x27130c[_0x9edd('0x57')][_0x9edd('0x61')]['length'];_0x2e9241+=0x1){socket[_0x9edd('0x107')]('userChatWebsite:save',{'UserId':_0x27130c['body'][_0x9edd('0x61')][_0x2e9241],'ChatWebsiteId':_0x27130c['params']['id']});}return _0x4614c6;});}})['then'](respondWithResult(_0x2fc9d0,null))[_0x9edd('0x26')](handleError(_0x2fc9d0,null));};exports[_0x9edd('0x108')]=function(_0x542a44,_0xd4d9f1,_0x144b36){var _0x4bfe3e;return db[_0x9edd('0x37')][_0x9edd('0x55')]({'where':{'id':_0x542a44[_0x9edd('0x54')]['id']}})[_0x9edd('0x1e')](handleEntityNotFound(_0xd4d9f1,null))['then'](function(_0xecab43){if(_0xecab43){return _0xecab43[_0x9edd('0x108')](_0x542a44[_0x9edd('0x3b')]['ids'])[_0x9edd('0x1e')](function(_0x5867fc){if(_['isArray'](_0x542a44['query'][_0x9edd('0x61')])){for(var _0x4d910c=0x0;_0x4d910c<_0x542a44[_0x9edd('0x3b')]['ids']['length'];_0x4d910c+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':_0x542a44['query'][_0x9edd('0x61')][_0x4d910c],'ChatWebsiteId':_0x542a44[_0x9edd('0x54')]['id']});}}else{socket[_0x9edd('0x107')]('userChatWebsite:remove',{'UserId':_0x542a44[_0x9edd('0x3b')][_0x9edd('0x61')],'ChatWebsiteId':_0x542a44['params']['id']});}});}})[_0x9edd('0x1e')](respondWithStatusCode(_0xd4d9f1,null))[_0x9edd('0x26')](handleError(_0xd4d9f1,null));};exports[_0x9edd('0x109')]=function(_0x35a945,_0x13df3a,_0x2bdc2a){var _0x49ebe5={};var _0x4c6418={};var _0x36dd14;var _0x323844;return db[_0x9edd('0x37')][_0x9edd('0x5e')]({'where':{'id':_0x35a945[_0x9edd('0x54')]['id']}})['then'](handleEntityNotFound(_0x13df3a,null))[_0x9edd('0x1e')](function(_0xfe4d45){if(_0xfe4d45){_0x36dd14=_0xfe4d45;_0x4c6418[_0x9edd('0x39')]=_[_0x9edd('0x3a')](db['User'][_0x9edd('0x38')]);_0x4c6418[_0x9edd('0x3b')]=_[_0x9edd('0x3a')](_0x35a945['query']);_0x4c6418[_0x9edd('0x3e')]=_[_0x9edd('0x3f')](_0x4c6418[_0x9edd('0x39')],_0x4c6418[_0x9edd('0x3b')]);_0x49ebe5[_0x9edd('0x40')]=_[_0x9edd('0x3f')](_0x4c6418[_0x9edd('0x39')],qs['fields'](_0x35a945[_0x9edd('0x3b')]['fields']));_0x49ebe5['attributes']=_0x49ebe5['attributes']['length']?_0x49ebe5[_0x9edd('0x40')]:_0x4c6418[_0x9edd('0x39')];_0x49ebe5[_0x9edd('0x45')]=qs[_0x9edd('0x46')](_0x35a945['query']['sort']);_0x49ebe5[_0x9edd('0x47')]=qs[_0x9edd('0x3e')](_['pick'](_0x35a945[_0x9edd('0x3b')],_0x4c6418[_0x9edd('0x3e')]));if(_0x35a945['query'][_0x9edd('0x4b')]){_0x49ebe5['where']=_[_0x9edd('0x4c')](_0x49ebe5[_0x9edd('0x47')],{'$or':_[_0x9edd('0x4d')](_0x49ebe5['attributes'],function(_0x1be813){var _0xfb49a4={};_0xfb49a4[_0x1be813]={'$like':'%'+_0x35a945[_0x9edd('0x3b')][_0x9edd('0x4b')]+'%'};return _0xfb49a4;})});}_0x49ebe5=_['merge']({},_0x49ebe5,_0x35a945[_0x9edd('0x4e')]);return _0x36dd14['getAgents'](_0x49ebe5);}})[_0x9edd('0x1e')](function(_0x1e7119){if(_0x1e7119){_0x323844=_0x1e7119[_0x9edd('0x42')];if(!_0x35a945[_0x9edd('0x3b')][_0x9edd('0x43')](_0x9edd('0x44'))){_0x49ebe5[_0x9edd('0x2c')]=qs[_0x9edd('0x2c')](_0x35a945[_0x9edd('0x3b')][_0x9edd('0x2c')]);_0x49ebe5[_0x9edd('0x2b')]=qs[_0x9edd('0x2b')](_0x35a945['query'][_0x9edd('0x2b')]);}return _0x36dd14[_0x9edd('0x109')](_0x49ebe5);}})[_0x9edd('0x1e')](function(_0x4bdd44){if(_0x4bdd44){return _0x4bdd44?{'count':_0x323844,'rows':_0x4bdd44}:null;}})['then'](respondWithResult(_0x13df3a,null))[_0x9edd('0x26')](handleError(_0x13df3a,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 5ab5398..ae49ca1 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 _0x1a6b=['update','remove','emit','hook','events','../../mysqldb','ChatWebsite','save'];(function(_0x51b088,_0x41bfa1){var _0x1213c2=function(_0x4afc28){while(--_0x4afc28){_0x51b088['push'](_0x51b088['shift']());}};_0x1213c2(++_0x41bfa1);}(_0x1a6b,0x94));var _0xb1a6=function(_0x3a03a7,_0x11f1a3){_0x3a03a7=_0x3a03a7-0x0;var _0xf11115=_0x1a6b[_0x3a03a7];return _0xf11115;};'use strict';var EventEmitter=require(_0xb1a6('0x0'));var ChatWebsite=require(_0xb1a6('0x1'))['db'][_0xb1a6('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb1a6('0x3'),'afterUpdate':_0xb1a6('0x4'),'afterDestroy':_0xb1a6('0x5')};function emitEvent(_0x362de5){return function(_0x599952,_0x1e0b74,_0x4b7f8a){ChatWebsiteEvents[_0xb1a6('0x6')](_0x362de5+':'+_0x599952['id'],_0x599952);ChatWebsiteEvents[_0xb1a6('0x6')](_0x362de5,_0x599952);_0x4b7f8a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xb1a6('0x7')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x8524=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save'];(function(_0x568938,_0x54fdc1){var _0x58cf74=function(_0x577f7a){while(--_0x577f7a){_0x568938['push'](_0x568938['shift']());}};_0x58cf74(++_0x54fdc1);}(_0x8524,0x1d4));var _0x4852=function(_0x3cca45,_0x37fcab){_0x3cca45=_0x3cca45-0x0;var _0x4c6285=_0x8524[_0x3cca45];return _0x4c6285;};'use strict';var EventEmitter=require(_0x4852('0x0'));var ChatWebsite=require(_0x4852('0x1'))['db'][_0x4852('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x4852('0x3')](0x0);var events={'afterCreate':_0x4852('0x4'),'afterUpdate':_0x4852('0x5'),'afterDestroy':_0x4852('0x6')};function emitEvent(_0x458b84){return function(_0x21b2bb,_0x32a57a,_0x333c3d){ChatWebsiteEvents['emit'](_0x458b84+':'+_0x21b2bb['id'],_0x21b2bb);ChatWebsiteEvents[_0x4852('0x7')](_0x458b84,_0x21b2bb);_0x333c3d(null);};}for(var e in events){if(events[_0x4852('0x8')](e)){var event=events[e];ChatWebsite[_0x4852('0x9')](e,emitEvent(event));}}module[_0x4852('0xa')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 4167a84..89a97b2 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 _0x524a=['define','ChatWebsite','lodash','util','../../config/logger','api','bluebird','request-promise','./chatWebsite.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x524a,0xf5));var _0xa524=function(_0x44d724,_0x5cb627){_0x44d724=_0x44d724-0x0;var _0x1c08b5=_0x524a[_0x44d724];return _0x1c08b5;};'use strict';var _=require(_0xa524('0x0'));var util=require(_0xa524('0x1'));var logger=require(_0xa524('0x2'))(_0xa524('0x3'));var moment=require('moment');var BPromise=require(_0xa524('0x4'));var rp=require(_0xa524('0x5'));var attributes=require(_0xa524('0x6'));module['exports']=function(_0x50ec75,_0x34a665){return _0x50ec75[_0xa524('0x7')](_0xa524('0x8'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfaa4=['./chatWebsite.attributes','exports','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3a7bae,_0x28d4b9){var _0x402712=function(_0x5a2afe){while(--_0x5a2afe){_0x3a7bae['push'](_0x3a7bae['shift']());}};_0x402712(++_0x28d4b9);}(_0xfaa4,0x1a8));var _0x4faa=function(_0x44921c,_0x37bdb4){_0x44921c=_0x44921c-0x0;var _0xe6125f=_0xfaa4[_0x44921c];return _0xe6125f;};'use strict';var _=require(_0x4faa('0x0'));var util=require(_0x4faa('0x1'));var logger=require(_0x4faa('0x2'))(_0x4faa('0x3'));var moment=require(_0x4faa('0x4'));var BPromise=require(_0x4faa('0x5'));var rp=require('request-promise');var attributes=require(_0x4faa('0x6'));module[_0x4faa('0x7')]=function(_0x144600,_0x349d09){return _0x144600['define'](_0x4faa('0x8'),attributes,{'tableName':_0x4faa('0x9'),'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 dae4331..845507a 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 _0x88ef=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x4ac0d3,_0x5a502f){var _0x2679de=function(_0x245447){while(--_0x245447){_0x4ac0d3['push'](_0x4ac0d3['shift']());}};_0x2679de(++_0x5a502f);}(_0x88ef,0xea));var _0xf88e=function(_0x3448e7,_0xa20dd7){_0x3448e7=_0x3448e7-0x0;var _0x4e5823=_0x88ef[_0x3448e7];return _0x4e5823;};'use strict';var _=require('lodash');var util=require(_0xf88e('0x0'));var moment=require(_0xf88e('0x1'));var BPromise=require(_0xf88e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf88e('0x3'));var db=require(_0xf88e('0x4'))['db'];var utils=require(_0xf88e('0x5'));var logger=require(_0xf88e('0x6'))(_0xf88e('0x7'));var config=require(_0xf88e('0x8'));var jayson=require(_0xf88e('0x9'));var client=jayson[_0xf88e('0xa')][_0xf88e('0xb')]({'port':0x232a});config[_0xf88e('0xc')]=_[_0xf88e('0xd')](config[_0xf88e('0xc')],{'host':_0xf88e('0xe'),'port':0x18eb});var socket=require(_0xf88e('0xf'))(new Redis(config[_0xf88e('0xc')]));require(_0xf88e('0x10'))[_0xf88e('0x11')](socket);function respondWithRpcPromise(_0x55b490,_0x466f54,_0x56af1e){return new BPromise(function(_0x30d4bd,_0x4e463f){return client[_0xf88e('0x12')](_0x55b490,_0x56af1e)[_0xf88e('0x13')](function(_0x4da0a0){logger[_0xf88e('0x14')](_0xf88e('0x15'),_0x466f54,_0xf88e('0x16'));logger[_0xf88e('0x17')](_0xf88e('0x18'),_0x466f54,_0xf88e('0x16'),JSON['stringify'](_0x4da0a0));if(_0x4da0a0['error']){if(_0x4da0a0['error'][_0xf88e('0x19')]===0x1f4){logger[_0xf88e('0x1a')](_0xf88e('0x15'),_0x466f54,_0x4da0a0[_0xf88e('0x1a')][_0xf88e('0x1b')]);return _0x4e463f(_0x4da0a0[_0xf88e('0x1a')]['message']);}logger[_0xf88e('0x1a')](_0xf88e('0x15'),_0x466f54,_0x4da0a0[_0xf88e('0x1a')][_0xf88e('0x1b')]);return _0x30d4bd(_0x4da0a0['error']['message']);}else{logger[_0xf88e('0x14')](_0xf88e('0x15'),_0x466f54,'request\x20sent');_0x30d4bd(_0x4da0a0[_0xf88e('0x1c')][_0xf88e('0x1b')]);}})[_0xf88e('0x1d')](function(_0x339fe6){logger[_0xf88e('0x1a')](_0xf88e('0x15'),_0x466f54,_0x339fe6);_0x4e463f(_0x339fe6);});});} \ No newline at end of file +var _0x40ca=['request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register'];(function(_0x37a512,_0x5b16cd){var _0x50b363=function(_0x194b84){while(--_0x194b84){_0x37a512['push'](_0x37a512['shift']());}};_0x50b363(++_0x5b16cd);}(_0x40ca,0x14e));var _0xa40c=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x40ca[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0xa40c('0x0'));var util=require(_0xa40c('0x1'));var moment=require(_0xa40c('0x2'));var BPromise=require('bluebird');var rs=require(_0xa40c('0x3'));var fs=require('fs');var Redis=require(_0xa40c('0x4'));var db=require(_0xa40c('0x5'))['db'];var utils=require(_0xa40c('0x6'));var logger=require(_0xa40c('0x7'))(_0xa40c('0x8'));var config=require(_0xa40c('0x9'));var jayson=require(_0xa40c('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xa40c('0xb')](config[_0xa40c('0xc')],{'host':_0xa40c('0xd'),'port':0x18eb});var socket=require(_0xa40c('0xe'))(new Redis(config[_0xa40c('0xc')]));require(_0xa40c('0xf'))[_0xa40c('0x10')](socket);function respondWithRpcPromise(_0x19f53c,_0x56033e,_0x556509){return new BPromise(function(_0x363d4e,_0x2ff664){return client[_0xa40c('0x11')](_0x19f53c,_0x556509)[_0xa40c('0x12')](function(_0x3bf882){logger[_0xa40c('0x13')](_0xa40c('0x14'),_0x56033e,'request\x20sent');logger[_0xa40c('0x15')](_0xa40c('0x16'),_0x56033e,'request\x20sent',JSON['stringify'](_0x3bf882));if(_0x3bf882['error']){if(_0x3bf882[_0xa40c('0x17')][_0xa40c('0x18')]===0x1f4){logger['error'](_0xa40c('0x14'),_0x56033e,_0x3bf882['error'][_0xa40c('0x19')]);return _0x2ff664(_0x3bf882[_0xa40c('0x17')][_0xa40c('0x19')]);}logger[_0xa40c('0x17')](_0xa40c('0x14'),_0x56033e,_0x3bf882['error'][_0xa40c('0x19')]);return _0x363d4e(_0x3bf882[_0xa40c('0x17')][_0xa40c('0x19')]);}else{logger[_0xa40c('0x13')](_0xa40c('0x14'),_0x56033e,'request\x20sent');_0x363d4e(_0x3bf882['result'][_0xa40c('0x19')]);}})[_0xa40c('0x1a')](function(_0x1fe838){logger['error'](_0xa40c('0x14'),_0x56033e,_0x1fe838);_0x2ff664(_0x1fe838);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 4f6ebd7..c35f6ef 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 _0xb1ad=['chatWebsite:','./chatWebsite.events','save','remove','update','emit','removeListener','register','length'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb1ad,0x184));var _0xdb1a=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xb1ad[_0x13ea00];return _0x1f7347;};'use strict';var ChatWebsiteEvents=require(_0xdb1a('0x0'));var events=[_0xdb1a('0x1'),_0xdb1a('0x2'),_0xdb1a('0x3')];function createListener(_0xdf4f79,_0x397cc6){return function(_0x4df6e2){_0x397cc6[_0xdb1a('0x4')](_0xdf4f79,_0x4df6e2);};}function removeListener(_0x15cb4f,_0x24b01f){return function(){ChatWebsiteEvents[_0xdb1a('0x5')](_0x15cb4f,_0x24b01f);};}exports[_0xdb1a('0x6')]=function(_0x3a19a1){for(var _0x368208=0x0,_0x12b8c5=events[_0xdb1a('0x7')];_0x368208<_0x12b8c5;_0x368208++){var _0x2a24f2=events[_0x368208];var _0x5fc831=createListener(_0xdb1a('0x8')+_0x2a24f2,_0x3a19a1);ChatWebsiteEvents['on'](_0x2a24f2,_0x5fc831);}}; \ No newline at end of file +var _0x07b6=['remove','update','emit','removeListener','length','chatWebsite:','./chatWebsite.events'];(function(_0x4f97bb,_0x3506c0){var _0x371e09=function(_0x439ffb){while(--_0x439ffb){_0x4f97bb['push'](_0x4f97bb['shift']());}};_0x371e09(++_0x3506c0);}(_0x07b6,0xb5));var _0x607b=function(_0x34412f,_0x116bea){_0x34412f=_0x34412f-0x0;var _0x4b4b5a=_0x07b6[_0x34412f];return _0x4b4b5a;};'use strict';var ChatWebsiteEvents=require(_0x607b('0x0'));var events=['save',_0x607b('0x1'),_0x607b('0x2')];function createListener(_0xf213c2,_0x2258b8){return function(_0x15168f){_0x2258b8[_0x607b('0x3')](_0xf213c2,_0x15168f);};}function removeListener(_0x58ac0b,_0x10e257){return function(){ChatWebsiteEvents[_0x607b('0x4')](_0x58ac0b,_0x10e257);};}exports['register']=function(_0x2ab52b){for(var _0x49163a=0x0,_0x5c58a8=events[_0x607b('0x5')];_0x49163a<_0x5c58a8;_0x49163a++){var _0xbdd5d1=events[_0x49163a];var _0x3b4d94=createListener(_0x607b('0x6')+_0xbdd5d1,_0x2ab52b);ChatWebsiteEvents['on'](_0xbdd5d1,_0x3b4d94);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 630e750..57055bb 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 _0x90b5=['delete','destroy','removeAgents','multer','path','connect-timeout','express','Router','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','diskStorage','join','server/files/images/logos/','format','now','originalname','single','addLogo','server/files/images/avatars/','%s-%s','file','addAvatar','root','addCustomerAvatar','addSystemAvatar','notify','addInteraction','addApplications','addProactiveActions','addAgents','update'];(function(_0x53c0a0,_0xaf30e9){var _0x366393=function(_0x1b1e21){while(--_0x1b1e21){_0x53c0a0['push'](_0x53c0a0['shift']());}};_0x366393(++_0xaf30e9);}(_0x90b5,0x139));var _0x590b=function(_0x4dd374,_0x2dfdde){_0x4dd374=_0x4dd374-0x0;var _0x5cc428=_0x90b5[_0x4dd374];return _0x5cc428;};'use strict';var multer=require(_0x590b('0x0'));var util=require('util');var path=require(_0x590b('0x1'));var timeout=require(_0x590b('0x2'));var express=require(_0x590b('0x3'));var router=express[_0x590b('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x590b('0x5'));var controller=require(_0x590b('0x6'));router['get']('/',auth[_0x590b('0x7')](),controller[_0x590b('0x8')]);router[_0x590b('0x9')]('/describe',auth[_0x590b('0x7')](),controller[_0x590b('0xa')]);router[_0x590b('0x9')](_0x590b('0xb'),auth[_0x590b('0x7')](),controller[_0x590b('0xc')]);router[_0x590b('0x9')](_0x590b('0xd'),auth[_0x590b('0x7')](),controller['getDispositions']);router[_0x590b('0x9')](_0x590b('0xe'),auth['isAuthenticated'](),controller[_0x590b('0xf')]);router['get'](_0x590b('0x10'),controller[_0x590b('0x11')]);router[_0x590b('0x9')](_0x590b('0x12'),controller['getAvatar']);router[_0x590b('0x9')](_0x590b('0x13'),controller[_0x590b('0x14')]);router[_0x590b('0x9')](_0x590b('0x15'),controller[_0x590b('0x16')]);router[_0x590b('0x9')](_0x590b('0x17'),auth[_0x590b('0x7')](),controller[_0x590b('0x18')]);router[_0x590b('0x9')](_0x590b('0x19'),controller[_0x590b('0x1a')]);router[_0x590b('0x9')](_0x590b('0x1b'),auth['isAuthenticated'](),controller[_0x590b('0x1c')]);router['get'](_0x590b('0x1d'),auth[_0x590b('0x7')](),controller[_0x590b('0x1e')]);router['get']('/:id/fields',controller[_0x590b('0x1f')]);router['get'](_0x590b('0x20'),auth[_0x590b('0x7')](),controller[_0x590b('0x21')]);router['get'](_0x590b('0x22'),auth[_0x590b('0x7')](),controller[_0x590b('0x23')]);router[_0x590b('0x24')]('/',auth['isAuthenticated'](),controller[_0x590b('0x25')]);router['post'](_0x590b('0xd'),auth[_0x590b('0x7')](),controller['addDisposition']);router['post'](_0x590b('0xe'),auth[_0x590b('0x7')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x590b('0x26')]({'destination':function(_0x1045d5,_0x5c79aa,_0x5ec97d){_0x5ec97d(null,path[_0x590b('0x27')](config['root'],_0x590b('0x28')));},'filename':function(_0x520095,_0x4d3ff9,_0x2314d0){_0x2314d0(null,util[_0x590b('0x29')]('%s-%s',Date[_0x590b('0x2a')](),_0x4d3ff9[_0x590b('0x2b')]));}})});router[_0x590b('0x24')](_0x590b('0x10'),upload[_0x590b('0x2c')]('file'),controller[_0x590b('0x2d')]);var upload=multer({'storage':multer[_0x590b('0x26')]({'destination':function(_0x333af8,_0x38a64a,_0x1ee769){_0x1ee769(null,path[_0x590b('0x27')](config['root'],_0x590b('0x2e')));},'filename':function(_0x4b912a,_0x191c76,_0x3f9fd0){_0x3f9fd0(null,util[_0x590b('0x29')](_0x590b('0x2f'),Date['now'](),_0x191c76[_0x590b('0x2b')]));}})});router['post'](_0x590b('0x12'),upload[_0x590b('0x2c')](_0x590b('0x30')),controller[_0x590b('0x31')]);var upload=multer({'storage':multer[_0x590b('0x26')]({'destination':function(_0x58fcd7,_0x3ef12c,_0x129516){_0x129516(null,path[_0x590b('0x27')](config[_0x590b('0x32')],'server/files/images/avatars/'));},'filename':function(_0x5c28ec,_0x3c6459,_0x125ee3){_0x125ee3(null,util[_0x590b('0x29')](_0x590b('0x2f'),Date['now'](),_0x3c6459['originalname']));}})});router[_0x590b('0x24')]('/:id/customer_avatar',upload[_0x590b('0x2c')](_0x590b('0x30')),controller[_0x590b('0x33')]);var upload=multer({'storage':multer[_0x590b('0x26')]({'destination':function(_0x35dcaf,_0x294688,_0x251cab){_0x251cab(null,path[_0x590b('0x27')](config[_0x590b('0x32')],_0x590b('0x2e')));},'filename':function(_0x58a110,_0x5d3fe6,_0x322940){_0x322940(null,util[_0x590b('0x29')](_0x590b('0x2f'),Date[_0x590b('0x2a')](),_0x5d3fe6[_0x590b('0x2b')]));}})});router['post'](_0x590b('0x15'),upload[_0x590b('0x2c')](_0x590b('0x30')),controller[_0x590b('0x34')]);router[_0x590b('0x24')]('/:id/notify',controller[_0x590b('0x35')]);router[_0x590b('0x24')]('/:id/offline',controller['offline']);router[_0x590b('0x24')]('/:id/interactions',auth[_0x590b('0x7')](),controller[_0x590b('0x36')]);router[_0x590b('0x24')](_0x590b('0x1b'),auth[_0x590b('0x7')](),controller[_0x590b('0x37')]);router[_0x590b('0x24')](_0x590b('0x1d'),auth[_0x590b('0x7')](),controller[_0x590b('0x38')]);router['post'](_0x590b('0x22'),auth[_0x590b('0x7')](),controller[_0x590b('0x39')]);router['put'](_0x590b('0xb'),auth[_0x590b('0x7')](),controller[_0x590b('0x3a')]);router[_0x590b('0x3b')](_0x590b('0xb'),auth[_0x590b('0x7')](),controller[_0x590b('0x3c')]);router[_0x590b('0x3b')]('/:id/dispositions',auth[_0x590b('0x7')](),controller['removeDispositions']);router[_0x590b('0x3b')](_0x590b('0xe'),auth[_0x590b('0x7')](),controller['removeAnswers']);router[_0x590b('0x3b')](_0x590b('0x22'),auth[_0x590b('0x7')](),controller[_0x590b('0x3d')]);module['exports']=router; \ No newline at end of file +var _0x2a07=['getDispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','getApplications','getProactiveActions','getFields','/:id/offline_messages','getAgents','post','create','/:id/dispositions','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','addAvatar','server/files/images/avatars/','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','/:id/notify','notify','offline','/:id/proactive_actions','addProactiveActions','put','update','delete','destroy','removeDispositions','removeAnswers','/:id/users','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x2a07,0x74));var _0x72a0=function(_0x560b33,_0x54a69c){_0x560b33=_0x560b33-0x0;var _0x15c35e=_0x2a07[_0x560b33];return _0x15c35e;};'use strict';var multer=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var path=require(_0x72a0('0x2'));var timeout=require(_0x72a0('0x3'));var express=require(_0x72a0('0x4'));var router=express['Router']();var auth=require(_0x72a0('0x5'));var interaction=require(_0x72a0('0x6'));var config=require(_0x72a0('0x7'));var controller=require(_0x72a0('0x8'));router[_0x72a0('0x9')]('/',auth[_0x72a0('0xa')](),controller[_0x72a0('0xb')]);router[_0x72a0('0x9')](_0x72a0('0xc'),auth[_0x72a0('0xa')](),controller[_0x72a0('0xd')]);router[_0x72a0('0x9')](_0x72a0('0xe'),auth[_0x72a0('0xa')](),controller[_0x72a0('0xf')]);router[_0x72a0('0x9')]('/:id/dispositions',auth[_0x72a0('0xa')](),controller[_0x72a0('0x10')]);router['get'](_0x72a0('0x11'),auth[_0x72a0('0xa')](),controller[_0x72a0('0x12')]);router[_0x72a0('0x9')](_0x72a0('0x13'),controller['getLogo']);router[_0x72a0('0x9')](_0x72a0('0x14'),controller[_0x72a0('0x15')]);router[_0x72a0('0x9')](_0x72a0('0x16'),controller[_0x72a0('0x17')]);router[_0x72a0('0x9')]('/:id/system_avatar',controller['getSystemAvatar']);router[_0x72a0('0x9')](_0x72a0('0x18'),auth[_0x72a0('0xa')](),controller[_0x72a0('0x19')]);router[_0x72a0('0x9')](_0x72a0('0x1a'),controller['getSnippet']);router[_0x72a0('0x9')](_0x72a0('0x1b'),auth[_0x72a0('0xa')](),controller[_0x72a0('0x1c')]);router[_0x72a0('0x9')]('/:id/proactive_actions',auth[_0x72a0('0xa')](),controller[_0x72a0('0x1d')]);router[_0x72a0('0x9')]('/:id/fields',controller[_0x72a0('0x1e')]);router[_0x72a0('0x9')](_0x72a0('0x1f'),auth[_0x72a0('0xa')](),controller['getOfflineMessages']);router[_0x72a0('0x9')]('/:id/users',auth[_0x72a0('0xa')](),controller[_0x72a0('0x20')]);router[_0x72a0('0x21')]('/',auth['isAuthenticated'](),controller[_0x72a0('0x22')]);router[_0x72a0('0x21')](_0x72a0('0x23'),auth[_0x72a0('0xa')](),controller['addDisposition']);router[_0x72a0('0x21')](_0x72a0('0x11'),auth[_0x72a0('0xa')](),controller[_0x72a0('0x24')]);var upload=multer({'storage':multer[_0x72a0('0x25')]({'destination':function(_0x174b1b,_0x5c4daf,_0x4dd1a6){_0x4dd1a6(null,path[_0x72a0('0x26')](config[_0x72a0('0x27')],_0x72a0('0x28')));},'filename':function(_0x1504ed,_0xf5cb49,_0x27ca5a){_0x27ca5a(null,util[_0x72a0('0x29')](_0x72a0('0x2a'),Date[_0x72a0('0x2b')](),_0xf5cb49[_0x72a0('0x2c')]));}})});router['post'](_0x72a0('0x13'),upload[_0x72a0('0x2d')](_0x72a0('0x2e')),controller[_0x72a0('0x2f')]);var upload=multer({'storage':multer[_0x72a0('0x25')]({'destination':function(_0x177a3a,_0x432179,_0x12eda2){_0x12eda2(null,path[_0x72a0('0x26')](config[_0x72a0('0x27')],'server/files/images/avatars/'));},'filename':function(_0x41efc1,_0x17e955,_0x39136d){_0x39136d(null,util[_0x72a0('0x29')](_0x72a0('0x2a'),Date[_0x72a0('0x2b')](),_0x17e955[_0x72a0('0x2c')]));}})});router['post'](_0x72a0('0x14'),upload[_0x72a0('0x2d')](_0x72a0('0x2e')),controller[_0x72a0('0x30')]);var upload=multer({'storage':multer[_0x72a0('0x25')]({'destination':function(_0x469c07,_0x7c5d43,_0x313287){_0x313287(null,path['join'](config[_0x72a0('0x27')],_0x72a0('0x31')));},'filename':function(_0x2959af,_0x560ec3,_0x2ae61c){_0x2ae61c(null,util['format'](_0x72a0('0x2a'),Date[_0x72a0('0x2b')](),_0x560ec3[_0x72a0('0x2c')]));}})});router[_0x72a0('0x21')](_0x72a0('0x16'),upload[_0x72a0('0x2d')](_0x72a0('0x2e')),controller[_0x72a0('0x32')]);var upload=multer({'storage':multer[_0x72a0('0x25')]({'destination':function(_0x171c1d,_0x2ee3f8,_0x3ff191){_0x3ff191(null,path['join'](config[_0x72a0('0x27')],'server/files/images/avatars/'));},'filename':function(_0x1d0fa8,_0x13c251,_0x446222){_0x446222(null,util[_0x72a0('0x29')](_0x72a0('0x2a'),Date[_0x72a0('0x2b')](),_0x13c251[_0x72a0('0x2c')]));}})});router[_0x72a0('0x21')](_0x72a0('0x33'),upload['single']('file'),controller[_0x72a0('0x34')]);router[_0x72a0('0x21')](_0x72a0('0x35'),controller[_0x72a0('0x36')]);router[_0x72a0('0x21')]('/:id/offline',controller[_0x72a0('0x37')]);router[_0x72a0('0x21')]('/:id/interactions',auth[_0x72a0('0xa')](),controller['addInteraction']);router['post']('/:id/applications',auth[_0x72a0('0xa')](),controller['addApplications']);router[_0x72a0('0x21')](_0x72a0('0x38'),auth[_0x72a0('0xa')](),controller[_0x72a0('0x39')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x72a0('0x3a')](_0x72a0('0xe'),auth['isAuthenticated'](),controller[_0x72a0('0x3b')]);router[_0x72a0('0x3c')]('/:id',auth[_0x72a0('0xa')](),controller[_0x72a0('0x3d')]);router[_0x72a0('0x3c')](_0x72a0('0x23'),auth[_0x72a0('0xa')](),controller[_0x72a0('0x3e')]);router['delete'](_0x72a0('0x11'),auth['isAuthenticated'](),controller[_0x72a0('0x3f')]);router['delete'](_0x72a0('0x40'),auth[_0x72a0('0xa')](),controller['removeAgents']);module[_0x72a0('0x41')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index d243a84..6f71cc2 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 _0x0a15=['STRING','name','sequelize','exports'];(function(_0x5daf4b,_0x30dd09){var _0xcbd596=function(_0x33b717){while(--_0x33b717){_0x5daf4b['push'](_0x5daf4b['shift']());}};_0xcbd596(++_0x30dd09);}(_0x0a15,0x15a));var _0x50a1=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x0a15[_0x12f688];return _0x59c3de;};'use strict';var Sequelize=require(_0x50a1('0x0'));module[_0x50a1('0x1')]={'name':{'type':Sequelize[_0x50a1('0x2')],'unique':_0x50a1('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x50a1('0x2')]},'website':{'type':Sequelize[_0x50a1('0x2')]},'phone':{'type':Sequelize[_0x50a1('0x2')]},'fax':{'type':Sequelize[_0x50a1('0x2')]},'type':{'type':Sequelize[_0x50a1('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x50a1('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x50a1('0x2')]},'sStreet':{'type':Sequelize[_0x50a1('0x2')]},'sPostalCode':{'type':Sequelize[_0x50a1('0x2')]},'sCity':{'type':Sequelize[_0x50a1('0x2')]},'sCountry':{'type':Sequelize[_0x50a1('0x2')]},'description':{'type':Sequelize[_0x50a1('0x2')]}}; \ No newline at end of file +var _0x8333=['STRING','name','exports'];(function(_0x5db434,_0x481fa7){var _0x2e4100=function(_0x1d267b){while(--_0x1d267b){_0x5db434['push'](_0x5db434['shift']());}};_0x2e4100(++_0x481fa7);}(_0x8333,0x18e));var _0x3833=function(_0x1b0c1a,_0xe30263){_0x1b0c1a=_0x1b0c1a-0x0;var _0x7bccf7=_0x8333[_0x1b0c1a];return _0x7bccf7;};'use strict';var Sequelize=require('sequelize');module[_0x3833('0x0')]={'name':{'type':Sequelize[_0x3833('0x1')],'unique':_0x3833('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x3833('0x1')]},'phone':{'type':Sequelize[_0x3833('0x1')]},'fax':{'type':Sequelize[_0x3833('0x1')]},'type':{'type':Sequelize[_0x3833('0x1')]},'street':{'type':Sequelize[_0x3833('0x1')]},'postalCode':{'type':Sequelize[_0x3833('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x3833('0x1')]},'email':{'type':Sequelize[_0x3833('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x3833('0x1')]},'sPostalCode':{'type':Sequelize[_0x3833('0x1')]},'sCity':{'type':Sequelize[_0x3833('0x1')]},'sCountry':{'type':Sequelize[_0x3833('0x1')]},'description':{'type':Sequelize[_0x3833('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 970b1c0..c516ade 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 _0x639d=['order','sort','where','filters','pick','add','day','filter','merge','options','includeAll','rows','catch','show','length','include','find','create','body','params','destroy','addContacts','CmContact','omit','ids','getContacts','map','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','CmCompany','rawAttributes','model','keys','query','dateStart','dateEnd','intersection','attributes','fields','hasOwnProperty','nolimit','limit'];(function(_0x51cd83,_0x3b9a4d){var _0xad5490=function(_0x2c678b){while(--_0x2c678b){_0x51cd83['push'](_0x51cd83['shift']());}};_0xad5490(++_0x3b9a4d);}(_0x639d,0xbb));var _0xd639=function(_0x5bd063,_0x3c5bd5){_0x5bd063=_0x5bd063-0x0;var _0x4df0d2=_0x639d[_0x5bd063];return _0x4df0d2;};'use strict';var pdf=require(_0xd639('0x0'));var emlformat=require(_0xd639('0x1'));var rimraf=require(_0xd639('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd639('0x3'));var rp=require(_0xd639('0x4'));var moment=require('moment');var BPromise=require(_0xd639('0x5'));var Mustache=require('mustache');var util=require(_0xd639('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xd639('0x7'));var ejs=require(_0xd639('0x8'));var fs=require('fs');var _=require(_0xd639('0x9'));var squel=require(_0xd639('0xa'));var crypto=require(_0xd639('0xb'));var jsforce=require(_0xd639('0xc'));var deskjs=require(_0xd639('0xd'));var toCsv=require(_0xd639('0x7'));var querystring=require('querystring');var Papa=require(_0xd639('0xe'));var Redis=require(_0xd639('0xf'));var qs=require(_0xd639('0x10'));var logger=require(_0xd639('0x11'))(_0xd639('0x12'));var utils=require(_0xd639('0x13'));var config=require(_0xd639('0x14'));var db=require(_0xd639('0x15'))['db'];function respondWithStatusCode(_0x3d93dc,_0x513b14){_0x513b14=_0x513b14||0xcc;return function(_0x2706aa){if(_0x2706aa){return _0x3d93dc[_0xd639('0x16')](_0x513b14);}return _0x3d93dc[_0xd639('0x17')](_0x513b14)['end']();};}function respondWithResult(_0x176d2a,_0x2d064e){_0x2d064e=_0x2d064e||0xc8;return function(_0x43d09b){if(_0x43d09b){return _0x176d2a['status'](_0x2d064e)[_0xd639('0x18')](_0x43d09b);}};}function respondWithFilteredResult(_0x406392,_0x5c58fa){return function(_0x2be37e){if(_0x2be37e){var _0x66d977=_0x2be37e[_0xd639('0x19')],_0x4c7671=_0x5c58fa[_0xd639('0x1a')],_0x3e4080=_0x5c58fa[_0xd639('0x1a')]+_0x5c58fa['limit'],_0x1cc87b;if(_0x3e4080>=_0x66d977){_0x3e4080=_0x66d977;_0x1cc87b=0xc8;}else{_0x1cc87b=0xce;}_0x406392[_0xd639('0x17')](_0x1cc87b);return _0x406392[_0xd639('0x1b')](_0xd639('0x1c'),_0x4c7671+'-'+_0x3e4080+'/'+_0x66d977)['json'](_0x2be37e);}return null;};}function patchUpdates(_0xe57a66){return function(_0x3235a7){try{jsonpatch[_0xd639('0x1d')](_0x3235a7,_0xe57a66,!![]);}catch(_0x5cc42a){return BPromise[_0xd639('0x1e')](_0x5cc42a);}return _0x3235a7[_0xd639('0x1f')]();};}function saveUpdates(_0x252b12,_0x4b0b3d){return function(_0x46c82b){if(_0x46c82b){return _0x46c82b[_0xd639('0x20')](_0x252b12)[_0xd639('0x21')](function(_0x6d3f77){return _0x6d3f77;});}return null;};}function removeEntity(_0x2fca8b,_0x273d30){return function(_0x88e43d){if(_0x88e43d){return _0x88e43d['destroy']()['then'](function(){_0x2fca8b[_0xd639('0x17')](0xcc)[_0xd639('0x22')]();});}};}function handleEntityNotFound(_0x8d42b2,_0x3d0ac6){return function(_0xe98559){if(!_0xe98559){_0x8d42b2[_0xd639('0x16')](0x194);}return _0xe98559;};}function handleError(_0x1f0265,_0x393c52){_0x393c52=_0x393c52||0x1f4;return function(_0x30b014){logger[_0xd639('0x23')](_0x30b014[_0xd639('0x24')]);if(_0x30b014['name']){delete _0x30b014[_0xd639('0x25')];}_0x1f0265[_0xd639('0x17')](_0x393c52)[_0xd639('0x26')](_0x30b014);};}exports[_0xd639('0x27')]=function(_0x136a1a,_0x21d350){var _0x5d026c={},_0x1b0638={},_0x2c40eb={'count':0x0,'rows':[]};var _0x547304=db[_0xd639('0x28')][_0xd639('0x29')];_0x1b0638[_0xd639('0x2a')]=_[_0xd639('0x2b')](_0x547304);var _0xbd387d={'dateStart':_0x136a1a[_0xd639('0x2c')][_0xd639('0x2d')],'dateEnd':_0x136a1a['query'][_0xd639('0x2e')]};delete _0x136a1a[_0xd639('0x2c')]['dateStart'];delete _0x136a1a['query'][_0xd639('0x2e')];_0x1b0638[_0xd639('0x2c')]=_[_0xd639('0x2b')](_0x136a1a[_0xd639('0x2c')]);_0x1b0638['filters']=_[_0xd639('0x2f')](_0x1b0638[_0xd639('0x2a')],_0x1b0638[_0xd639('0x2c')]);_0x5d026c[_0xd639('0x30')]=_[_0xd639('0x2f')](_0x1b0638['model'],qs['fields'](_0x136a1a['query'][_0xd639('0x31')]));_0x5d026c[_0xd639('0x30')]=_0x5d026c[_0xd639('0x30')]['length']?_0x5d026c[_0xd639('0x30')]:_0x1b0638[_0xd639('0x2a')];if(!_0x136a1a[_0xd639('0x2c')][_0xd639('0x32')](_0xd639('0x33'))){_0x5d026c[_0xd639('0x34')]=qs[_0xd639('0x34')](_0x136a1a[_0xd639('0x2c')][_0xd639('0x34')]);_0x5d026c[_0xd639('0x1a')]=qs[_0xd639('0x1a')](_0x136a1a['query'][_0xd639('0x1a')]);}_0x5d026c[_0xd639('0x35')]=qs[_0xd639('0x36')](_0x136a1a[_0xd639('0x2c')][_0xd639('0x36')]);_0x5d026c[_0xd639('0x37')]=qs[_0xd639('0x38')](_[_0xd639('0x39')](_0x136a1a[_0xd639('0x2c')],_0x1b0638[_0xd639('0x38')]));if(_0xbd387d[_0xd639('0x2d')]){if(_0xbd387d['dateEnd']){_0xbd387d[_0xd639('0x2e')]=moment(_0xbd387d[_0xd639('0x2e')])[_0xd639('0x3a')](0x1,_0xd639('0x3b'));}else{_0xbd387d[_0xd639('0x2e')]=moment(_0xbd387d['dateStart'])['add'](0x1,_0xd639('0x3b'));}_['merge'](_0x5d026c[_0xd639('0x37')],{'createdAt':{'$gte':_0xbd387d[_0xd639('0x2d')],'$lte':_0xbd387d[_0xd639('0x2e')]}});}if(_0x136a1a['query'][_0xd639('0x3c')]){_0x5d026c[_0xd639('0x37')]=_[_0xd639('0x3d')](_0x5d026c[_0xd639('0x37')],{'$or':_['map'](_0x5d026c[_0xd639('0x30')],function(_0x4c2edc){var _0x5413fb={};_0x5413fb[_0x4c2edc]={'$like':'%'+_0x136a1a['query'][_0xd639('0x3c')]+'%'};return _0x5413fb;})});}_0x5d026c=_[_0xd639('0x3d')]({},_0x5d026c,_0x136a1a[_0xd639('0x3e')]);var _0x26f52f={'where':_0x5d026c[_0xd639('0x37')]};return db[_0xd639('0x28')][_0xd639('0x19')](_0x26f52f)[_0xd639('0x21')](function(_0x3d696f){_0x2c40eb[_0xd639('0x19')]=_0x3d696f;if(_0x136a1a['query'][_0xd639('0x3f')]){_0x5d026c['include']=[{'all':!![]}];}return db['CmCompany']['findAll'](_0x5d026c);})[_0xd639('0x21')](function(_0xf01d51){_0x2c40eb[_0xd639('0x40')]=_0xf01d51;return _0x2c40eb;})[_0xd639('0x21')](respondWithFilteredResult(_0x21d350,_0x5d026c))[_0xd639('0x41')](handleError(_0x21d350,null));};exports[_0xd639('0x42')]=function(_0x5761f3,_0x19d563){var _0x8397ae={'raw':![],'where':{'id':_0x5761f3['params']['id']}},_0x4b2056={};_0x4b2056['model']=_[_0xd639('0x2b')](db['CmCompany'][_0xd639('0x29')]);_0x4b2056['query']=_['keys'](_0x5761f3[_0xd639('0x2c')]);_0x4b2056[_0xd639('0x38')]=_[_0xd639('0x2f')](_0x4b2056[_0xd639('0x2a')],_0x4b2056[_0xd639('0x2c')]);_0x8397ae[_0xd639('0x30')]=_[_0xd639('0x2f')](_0x4b2056['model'],qs[_0xd639('0x31')](_0x5761f3[_0xd639('0x2c')]['fields']));_0x8397ae[_0xd639('0x30')]=_0x8397ae[_0xd639('0x30')][_0xd639('0x43')]?_0x8397ae[_0xd639('0x30')]:_0x4b2056[_0xd639('0x2a')];if(_0x5761f3[_0xd639('0x2c')][_0xd639('0x3f')]){_0x8397ae[_0xd639('0x44')]=[{'all':!![]}];}_0x8397ae=_[_0xd639('0x3d')]({},_0x8397ae,_0x5761f3[_0xd639('0x3e')]);return db['CmCompany'][_0xd639('0x45')](_0x8397ae)[_0xd639('0x21')](handleEntityNotFound(_0x19d563,null))['then'](respondWithResult(_0x19d563,null))['catch'](handleError(_0x19d563,null));};exports[_0xd639('0x46')]=function(_0x4257d6,_0xa94cbb){return db['CmCompany'][_0xd639('0x46')](_0x4257d6[_0xd639('0x47')],{})[_0xd639('0x21')](respondWithResult(_0xa94cbb,0xc9))['catch'](handleError(_0xa94cbb,null));};exports['update']=function(_0x1aeb4f,_0x33ccd8){if(_0x1aeb4f['body']['id']){delete _0x1aeb4f[_0xd639('0x47')]['id'];}return db[_0xd639('0x28')]['find']({'where':{'id':_0x1aeb4f[_0xd639('0x48')]['id']}})[_0xd639('0x21')](handleEntityNotFound(_0x33ccd8,null))[_0xd639('0x21')](saveUpdates(_0x1aeb4f[_0xd639('0x47')],null))[_0xd639('0x21')](respondWithResult(_0x33ccd8,null))[_0xd639('0x41')](handleError(_0x33ccd8,null));};exports[_0xd639('0x49')]=function(_0x3c900a,_0x369a3c){return db[_0xd639('0x28')][_0xd639('0x45')]({'where':{'id':_0x3c900a[_0xd639('0x48')]['id']}})[_0xd639('0x21')](handleEntityNotFound(_0x369a3c,null))[_0xd639('0x21')](removeEntity(_0x369a3c,null))[_0xd639('0x41')](handleError(_0x369a3c,null));};exports[_0xd639('0x4a')]=function(_0x2ef93d,_0x3f77d8,_0x1c8ec0){return db[_0xd639('0x4b')][_0xd639('0x45')]({'where':{'id':_0x2ef93d[_0xd639('0x48')]['id']}})[_0xd639('0x21')](handleEntityNotFound(_0x3f77d8,null))['then'](function(_0x2670ec){if(_0x2670ec){return _0x2670ec['addContacts'](_0x2ef93d[_0xd639('0x47')]['ids'],_[_0xd639('0x4c')](_0x2ef93d[_0xd639('0x47')],[_0xd639('0x4d'),'id'])||{});}})[_0xd639('0x21')](respondWithResult(_0x3f77d8,null))[_0xd639('0x41')](handleError(_0x3f77d8,null));};exports[_0xd639('0x4e')]=function(_0x5db663,_0x18c62f,_0x4615d5){var _0x304cce={};var _0x2755d0={};var _0x2a8309;var _0x3c759e;return db[_0xd639('0x28')]['findOne']({'where':{'id':_0x5db663[_0xd639('0x48')]['id']}})[_0xd639('0x21')](handleEntityNotFound(_0x18c62f,null))[_0xd639('0x21')](function(_0x5bf1e4){if(_0x5bf1e4){_0x2a8309=_0x5bf1e4;_0x2755d0[_0xd639('0x2a')]=_[_0xd639('0x2b')](db[_0xd639('0x4b')]['rawAttributes']);_0x2755d0[_0xd639('0x2c')]=_[_0xd639('0x2b')](_0x5db663['query']);_0x2755d0[_0xd639('0x38')]=_[_0xd639('0x2f')](_0x2755d0[_0xd639('0x2a')],_0x2755d0[_0xd639('0x2c')]);_0x304cce['attributes']=_['intersection'](_0x2755d0['model'],qs['fields'](_0x5db663[_0xd639('0x2c')][_0xd639('0x31')]));_0x304cce[_0xd639('0x30')]=_0x304cce['attributes'][_0xd639('0x43')]?_0x304cce[_0xd639('0x30')]:_0x2755d0[_0xd639('0x2a')];_0x304cce[_0xd639('0x35')]=qs[_0xd639('0x36')](_0x5db663[_0xd639('0x2c')][_0xd639('0x36')]);_0x304cce[_0xd639('0x37')]=qs[_0xd639('0x38')](_[_0xd639('0x39')](_0x5db663[_0xd639('0x2c')],_0x2755d0[_0xd639('0x38')]));if(_0x5db663[_0xd639('0x2c')][_0xd639('0x3c')]){_0x304cce[_0xd639('0x37')]=_['merge'](_0x304cce[_0xd639('0x37')],{'$or':_[_0xd639('0x4f')](_0x304cce['attributes'],function(_0x5cf6e6){var _0x33903a={};_0x33903a[_0x5cf6e6]={'$like':'%'+_0x5db663[_0xd639('0x2c')]['filter']+'%'};return _0x33903a;})});}_0x304cce=_[_0xd639('0x3d')]({},_0x304cce,_0x5db663[_0xd639('0x3e')]);return _0x2a8309[_0xd639('0x4e')](_0x304cce);}})['then'](function(_0x39c0cf){if(_0x39c0cf){_0x3c759e=_0x39c0cf['length'];if(!_0x5db663[_0xd639('0x2c')][_0xd639('0x32')](_0xd639('0x33'))){_0x304cce[_0xd639('0x34')]=qs[_0xd639('0x34')](_0x5db663['query'][_0xd639('0x34')]);_0x304cce[_0xd639('0x1a')]=qs[_0xd639('0x1a')](_0x5db663[_0xd639('0x2c')][_0xd639('0x1a')]);}return _0x2a8309[_0xd639('0x4e')](_0x304cce);}})[_0xd639('0x21')](function(_0x33df56){if(_0x33df56){return _0x33df56?{'count':_0x3c759e,'rows':_0x33df56}:null;}})[_0xd639('0x21')](respondWithResult(_0x18c62f,null))[_0xd639('0x41')](handleError(_0x18c62f,null));}; \ No newline at end of file +var _0x8832=['omit','getContacts','findOne','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','stack','index','CmCompany','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','day','merge','filter','map','options','includeAll','include','findAll','rows','show','model','find','create','body','catch','params','CmContact','ids'];(function(_0x14a0a0,_0x45d0cf){var _0x56b651=function(_0x1fae09){while(--_0x1fae09){_0x14a0a0['push'](_0x14a0a0['shift']());}};_0x56b651(++_0x45d0cf);}(_0x8832,0x1f4));var _0x2883=function(_0x32f55f,_0x4a02e5){_0x32f55f=_0x32f55f-0x0;var _0xaa9dd4=_0x8832[_0x32f55f];return _0xaa9dd4;};'use strict';var pdf=require(_0x2883('0x0'));var emlformat=require(_0x2883('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2883('0x2'));var rp=require(_0x2883('0x3'));var moment=require(_0x2883('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2883('0x5'));var util=require('util');var path=require(_0x2883('0x6'));var sox=require(_0x2883('0x7'));var csv=require(_0x2883('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2883('0x9'));var squel=require('squel');var crypto=require(_0x2883('0xa'));var jsforce=require(_0x2883('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2883('0xc'));var Papa=require(_0x2883('0xd'));var Redis=require(_0x2883('0xe'));var qs=require(_0x2883('0xf'));var logger=require(_0x2883('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x2883('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f3fc1,_0x5a7e86){_0x5a7e86=_0x5a7e86||0xcc;return function(_0x44c481){if(_0x44c481){return _0x5f3fc1['sendStatus'](_0x5a7e86);}return _0x5f3fc1[_0x2883('0x12')](_0x5a7e86)[_0x2883('0x13')]();};}function respondWithResult(_0x1e4f8f,_0x1bc7e1){_0x1bc7e1=_0x1bc7e1||0xc8;return function(_0x40b62a){if(_0x40b62a){return _0x1e4f8f[_0x2883('0x12')](_0x1bc7e1)['json'](_0x40b62a);}};}function respondWithFilteredResult(_0x4a3a24,_0x85a4a5){return function(_0x426b37){if(_0x426b37){var _0x49685e=_0x426b37[_0x2883('0x14')],_0x42a879=_0x85a4a5[_0x2883('0x15')],_0x41062b=_0x85a4a5[_0x2883('0x15')]+_0x85a4a5[_0x2883('0x16')],_0x2a7291;if(_0x41062b>=_0x49685e){_0x41062b=_0x49685e;_0x2a7291=0xc8;}else{_0x2a7291=0xce;}_0x4a3a24[_0x2883('0x12')](_0x2a7291);return _0x4a3a24['set'](_0x2883('0x17'),_0x42a879+'-'+_0x41062b+'/'+_0x49685e)[_0x2883('0x18')](_0x426b37);}return null;};}function patchUpdates(_0x234972){return function(_0x1dec8a){try{jsonpatch[_0x2883('0x19')](_0x1dec8a,_0x234972,!![]);}catch(_0x2632eb){return BPromise[_0x2883('0x1a')](_0x2632eb);}return _0x1dec8a[_0x2883('0x1b')]();};}function saveUpdates(_0x35b5d1,_0x503bbb){return function(_0x477e40){if(_0x477e40){return _0x477e40[_0x2883('0x1c')](_0x35b5d1)[_0x2883('0x1d')](function(_0x56fa7f){return _0x56fa7f;});}return null;};}function removeEntity(_0x270237,_0x5b2ed0){return function(_0x34c8af){if(_0x34c8af){return _0x34c8af[_0x2883('0x1e')]()[_0x2883('0x1d')](function(){_0x270237['status'](0xcc)[_0x2883('0x13')]();});}};}function handleEntityNotFound(_0x2f6adf,_0x5525f8){return function(_0x1d9f9c){if(!_0x1d9f9c){_0x2f6adf['sendStatus'](0x194);}return _0x1d9f9c;};}function handleError(_0x76717b,_0x5556a1){_0x5556a1=_0x5556a1||0x1f4;return function(_0x49ce2e){logger['error'](_0x49ce2e[_0x2883('0x1f')]);if(_0x49ce2e['name']){delete _0x49ce2e['name'];}_0x76717b[_0x2883('0x12')](_0x5556a1)['send'](_0x49ce2e);};}exports[_0x2883('0x20')]=function(_0x327e4e,_0x3f6268){var _0x15c130={},_0x68dfd5={},_0x991139={'count':0x0,'rows':[]};var _0x53db6f=db[_0x2883('0x21')][_0x2883('0x22')];_0x68dfd5['model']=_[_0x2883('0x23')](_0x53db6f);var _0x1a2971={'dateStart':_0x327e4e[_0x2883('0x24')][_0x2883('0x25')],'dateEnd':_0x327e4e['query']['dateEnd']};delete _0x327e4e[_0x2883('0x24')]['dateStart'];delete _0x327e4e[_0x2883('0x24')][_0x2883('0x26')];_0x68dfd5[_0x2883('0x24')]=_['keys'](_0x327e4e[_0x2883('0x24')]);_0x68dfd5[_0x2883('0x27')]=_[_0x2883('0x28')](_0x68dfd5['model'],_0x68dfd5[_0x2883('0x24')]);_0x15c130[_0x2883('0x29')]=_[_0x2883('0x28')](_0x68dfd5['model'],qs[_0x2883('0x2a')](_0x327e4e['query'][_0x2883('0x2a')]));_0x15c130[_0x2883('0x29')]=_0x15c130[_0x2883('0x29')][_0x2883('0x2b')]?_0x15c130[_0x2883('0x29')]:_0x68dfd5['model'];if(!_0x327e4e[_0x2883('0x24')][_0x2883('0x2c')](_0x2883('0x2d'))){_0x15c130['limit']=qs[_0x2883('0x16')](_0x327e4e['query'][_0x2883('0x16')]);_0x15c130[_0x2883('0x15')]=qs[_0x2883('0x15')](_0x327e4e[_0x2883('0x24')]['offset']);}_0x15c130[_0x2883('0x2e')]=qs[_0x2883('0x2f')](_0x327e4e[_0x2883('0x24')][_0x2883('0x2f')]);_0x15c130[_0x2883('0x30')]=qs['filters'](_[_0x2883('0x31')](_0x327e4e[_0x2883('0x24')],_0x68dfd5[_0x2883('0x27')]));if(_0x1a2971[_0x2883('0x25')]){if(_0x1a2971[_0x2883('0x26')]){_0x1a2971[_0x2883('0x26')]=moment(_0x1a2971[_0x2883('0x26')])['add'](0x1,_0x2883('0x32'));}else{_0x1a2971[_0x2883('0x26')]=moment(_0x1a2971[_0x2883('0x25')])['add'](0x1,_0x2883('0x32'));}_[_0x2883('0x33')](_0x15c130[_0x2883('0x30')],{'createdAt':{'$gte':_0x1a2971[_0x2883('0x25')],'$lte':_0x1a2971[_0x2883('0x26')]}});}if(_0x327e4e[_0x2883('0x24')][_0x2883('0x34')]){_0x15c130[_0x2883('0x30')]=_['merge'](_0x15c130['where'],{'$or':_[_0x2883('0x35')](_0x15c130[_0x2883('0x29')],function(_0x588f89){var _0x808952={};_0x808952[_0x588f89]={'$like':'%'+_0x327e4e['query']['filter']+'%'};return _0x808952;})});}_0x15c130=_[_0x2883('0x33')]({},_0x15c130,_0x327e4e[_0x2883('0x36')]);var _0x25a9a7={'where':_0x15c130[_0x2883('0x30')]};return db[_0x2883('0x21')][_0x2883('0x14')](_0x25a9a7)['then'](function(_0x54c35f){_0x991139[_0x2883('0x14')]=_0x54c35f;if(_0x327e4e[_0x2883('0x24')][_0x2883('0x37')]){_0x15c130[_0x2883('0x38')]=[{'all':!![]}];}return db['CmCompany'][_0x2883('0x39')](_0x15c130);})['then'](function(_0x51921d){_0x991139[_0x2883('0x3a')]=_0x51921d;return _0x991139;})[_0x2883('0x1d')](respondWithFilteredResult(_0x3f6268,_0x15c130))['catch'](handleError(_0x3f6268,null));};exports[_0x2883('0x3b')]=function(_0x165d85,_0x27c0bd){var _0x159461={'raw':![],'where':{'id':_0x165d85['params']['id']}},_0x37d886={};_0x37d886[_0x2883('0x3c')]=_['keys'](db[_0x2883('0x21')]['rawAttributes']);_0x37d886[_0x2883('0x24')]=_['keys'](_0x165d85[_0x2883('0x24')]);_0x37d886[_0x2883('0x27')]=_['intersection'](_0x37d886[_0x2883('0x3c')],_0x37d886['query']);_0x159461['attributes']=_[_0x2883('0x28')](_0x37d886[_0x2883('0x3c')],qs['fields'](_0x165d85['query']['fields']));_0x159461[_0x2883('0x29')]=_0x159461['attributes'][_0x2883('0x2b')]?_0x159461['attributes']:_0x37d886[_0x2883('0x3c')];if(_0x165d85[_0x2883('0x24')][_0x2883('0x37')]){_0x159461[_0x2883('0x38')]=[{'all':!![]}];}_0x159461=_['merge']({},_0x159461,_0x165d85['options']);return db['CmCompany'][_0x2883('0x3d')](_0x159461)[_0x2883('0x1d')](handleEntityNotFound(_0x27c0bd,null))[_0x2883('0x1d')](respondWithResult(_0x27c0bd,null))['catch'](handleError(_0x27c0bd,null));};exports[_0x2883('0x3e')]=function(_0x258e70,_0x233afa){return db[_0x2883('0x21')][_0x2883('0x3e')](_0x258e70[_0x2883('0x3f')],{})['then'](respondWithResult(_0x233afa,0xc9))[_0x2883('0x40')](handleError(_0x233afa,null));};exports['update']=function(_0xc6a638,_0x3528ed){if(_0xc6a638[_0x2883('0x3f')]['id']){delete _0xc6a638[_0x2883('0x3f')]['id'];}return db[_0x2883('0x21')][_0x2883('0x3d')]({'where':{'id':_0xc6a638[_0x2883('0x41')]['id']}})[_0x2883('0x1d')](handleEntityNotFound(_0x3528ed,null))['then'](saveUpdates(_0xc6a638['body'],null))[_0x2883('0x1d')](respondWithResult(_0x3528ed,null))[_0x2883('0x40')](handleError(_0x3528ed,null));};exports['destroy']=function(_0x4eec31,_0x52d0ab){return db[_0x2883('0x21')]['find']({'where':{'id':_0x4eec31['params']['id']}})[_0x2883('0x1d')](handleEntityNotFound(_0x52d0ab,null))[_0x2883('0x1d')](removeEntity(_0x52d0ab,null))['catch'](handleError(_0x52d0ab,null));};exports['addContacts']=function(_0x18c6e1,_0x527360,_0x18b11b){return db[_0x2883('0x42')][_0x2883('0x3d')]({'where':{'id':_0x18c6e1[_0x2883('0x41')]['id']}})['then'](handleEntityNotFound(_0x527360,null))['then'](function(_0x907e3a){if(_0x907e3a){return _0x907e3a['addContacts'](_0x18c6e1[_0x2883('0x3f')][_0x2883('0x43')],_[_0x2883('0x44')](_0x18c6e1[_0x2883('0x3f')],[_0x2883('0x43'),'id'])||{});}})['then'](respondWithResult(_0x527360,null))[_0x2883('0x40')](handleError(_0x527360,null));};exports[_0x2883('0x45')]=function(_0xa1e8d2,_0x21c200,_0x80a3c0){var _0xed96b7={};var _0x42c19a={};var _0x4b38ec;var _0x4eb8ce;return db['CmCompany'][_0x2883('0x46')]({'where':{'id':_0xa1e8d2['params']['id']}})['then'](handleEntityNotFound(_0x21c200,null))[_0x2883('0x1d')](function(_0x461f18){if(_0x461f18){_0x4b38ec=_0x461f18;_0x42c19a[_0x2883('0x3c')]=_[_0x2883('0x23')](db[_0x2883('0x42')][_0x2883('0x22')]);_0x42c19a[_0x2883('0x24')]=_[_0x2883('0x23')](_0xa1e8d2[_0x2883('0x24')]);_0x42c19a[_0x2883('0x27')]=_[_0x2883('0x28')](_0x42c19a[_0x2883('0x3c')],_0x42c19a[_0x2883('0x24')]);_0xed96b7['attributes']=_[_0x2883('0x28')](_0x42c19a[_0x2883('0x3c')],qs[_0x2883('0x2a')](_0xa1e8d2[_0x2883('0x24')][_0x2883('0x2a')]));_0xed96b7[_0x2883('0x29')]=_0xed96b7['attributes'][_0x2883('0x2b')]?_0xed96b7[_0x2883('0x29')]:_0x42c19a[_0x2883('0x3c')];_0xed96b7[_0x2883('0x2e')]=qs[_0x2883('0x2f')](_0xa1e8d2['query'][_0x2883('0x2f')]);_0xed96b7['where']=qs['filters'](_[_0x2883('0x31')](_0xa1e8d2['query'],_0x42c19a[_0x2883('0x27')]));if(_0xa1e8d2[_0x2883('0x24')]['filter']){_0xed96b7[_0x2883('0x30')]=_[_0x2883('0x33')](_0xed96b7[_0x2883('0x30')],{'$or':_[_0x2883('0x35')](_0xed96b7[_0x2883('0x29')],function(_0x30c75d){var _0x394966={};_0x394966[_0x30c75d]={'$like':'%'+_0xa1e8d2[_0x2883('0x24')][_0x2883('0x34')]+'%'};return _0x394966;})});}_0xed96b7=_['merge']({},_0xed96b7,_0xa1e8d2[_0x2883('0x36')]);return _0x4b38ec['getContacts'](_0xed96b7);}})[_0x2883('0x1d')](function(_0x214c4c){if(_0x214c4c){_0x4eb8ce=_0x214c4c['length'];if(!_0xa1e8d2[_0x2883('0x24')][_0x2883('0x2c')](_0x2883('0x2d'))){_0xed96b7[_0x2883('0x16')]=qs[_0x2883('0x16')](_0xa1e8d2[_0x2883('0x24')][_0x2883('0x16')]);_0xed96b7[_0x2883('0x15')]=qs[_0x2883('0x15')](_0xa1e8d2[_0x2883('0x24')][_0x2883('0x15')]);}return _0x4b38ec[_0x2883('0x45')](_0xed96b7);}})[_0x2883('0x1d')](function(_0x4990b7){if(_0x4990b7){return _0x4990b7?{'count':_0x4eb8ce,'rows':_0x4990b7}:null;}})[_0x2883('0x1d')](respondWithResult(_0x21c200,null))[_0x2883('0x40')](handleError(_0x21c200,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 6572225..c3dcc2c 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 _0xa902=['api','moment','request-promise','define','CmCompany','cm_companies','lodash','util','../../config/logger'];(function(_0x1a48a0,_0x3c95f5){var _0x269714=function(_0x33d9e3){while(--_0x33d9e3){_0x1a48a0['push'](_0x1a48a0['shift']());}};_0x269714(++_0x3c95f5);}(_0xa902,0x8d));var _0x2a90=function(_0x26255f,_0x42fb1a){_0x26255f=_0x26255f-0x0;var _0x215b9a=_0xa902[_0x26255f];return _0x215b9a;};'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 attributes=require('./cmCompany.attributes');module['exports']=function(_0x169808,_0x2b40c0){return _0x169808[_0x2a90('0x6')](_0x2a90('0x7'),attributes,{'tableName':_0x2a90('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc874=['./cmCompany.attributes','exports','define','cm_companies','lodash','../../config/logger','api','request-promise'];(function(_0x38ae4f,_0x1d3180){var _0x1e92db=function(_0x1a1cb9){while(--_0x1a1cb9){_0x38ae4f['push'](_0x38ae4f['shift']());}};_0x1e92db(++_0x1d3180);}(_0xc874,0x154));var _0x4c87=function(_0x870b62,_0x2143f9){_0x870b62=_0x870b62-0x0;var _0x2dcb39=_0xc874[_0x870b62];return _0x2dcb39;};'use strict';var _=require(_0x4c87('0x0'));var util=require('util');var logger=require(_0x4c87('0x1'))(_0x4c87('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4c87('0x3'));var attributes=require(_0x4c87('0x4'));module[_0x4c87('0x5')]=function(_0x575a7c,_0x3fbf14){return _0x575a7c[_0x4c87('0x6')]('CmCompany',attributes,{'tableName':_0x4c87('0x7'),'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 d0e9bfb..f065640 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 _0x32d9=['rpc','../../config/environment','client','request','then','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x4c7717,_0x520a56){var _0x3cd802=function(_0x3f9dfb){while(--_0x3f9dfb){_0x4c7717['push'](_0x4c7717['shift']());}};_0x3cd802(++_0x520a56);}(_0x32d9,0x1c8));var _0x932d=function(_0xec597c,_0x1cf31d){_0xec597c=_0xec597c-0x0;var _0x141a71=_0x32d9[_0xec597c];return _0x141a71;};'use strict';var _=require('lodash');var util=require(_0x932d('0x0'));var moment=require(_0x932d('0x1'));var BPromise=require(_0x932d('0x2'));var rs=require(_0x932d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x932d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x932d('0x5'))(_0x932d('0x6'));var config=require(_0x932d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x932d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e14d2,_0x346e7c,_0x64bb21){return new BPromise(function(_0xe5718f,_0x13fa9d){return client[_0x932d('0x9')](_0x2e14d2,_0x64bb21)[_0x932d('0xa')](function(_0x41ff0b){logger['info'](_0x932d('0xb'),_0x346e7c,'request\x20sent');logger[_0x932d('0xc')](_0x932d('0xd'),_0x346e7c,'request\x20sent',JSON[_0x932d('0xe')](_0x41ff0b));if(_0x41ff0b[_0x932d('0xf')]){if(_0x41ff0b[_0x932d('0xf')][_0x932d('0x10')]===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0x346e7c,_0x41ff0b[_0x932d('0xf')][_0x932d('0x11')]);return _0x13fa9d(_0x41ff0b['error']['message']);}logger[_0x932d('0xf')](_0x932d('0xb'),_0x346e7c,_0x41ff0b[_0x932d('0xf')]['message']);return _0xe5718f(_0x41ff0b['error'][_0x932d('0x11')]);}else{logger[_0x932d('0x12')](_0x932d('0xb'),_0x346e7c,'request\x20sent');_0xe5718f(_0x41ff0b[_0x932d('0x13')][_0x932d('0x11')]);}})[_0x932d('0x14')](function(_0x268a07){logger['error']('CmCompany,\x20%s,\x20%s',_0x346e7c,_0x268a07);_0x13fa9d(_0x268a07);});});} \ No newline at end of file +var _0xa61f=['request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x1d5400,_0x567e3c){var _0x21d9fe=function(_0x23fb75){while(--_0x23fb75){_0x1d5400['push'](_0x1d5400['shift']());}};_0x21d9fe(++_0x567e3c);}(_0xa61f,0x70));var _0xfa61=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xa61f[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xfa61('0x0'));var util=require(_0xfa61('0x1'));var moment=require(_0xfa61('0x2'));var BPromise=require(_0xfa61('0x3'));var rs=require(_0xfa61('0x4'));var fs=require('fs');var Redis=require(_0xfa61('0x5'));var db=require(_0xfa61('0x6'))['db'];var utils=require(_0xfa61('0x7'));var logger=require(_0xfa61('0x8'))(_0xfa61('0x9'));var config=require('../../config/environment');var jayson=require(_0xfa61('0xa'));var client=jayson[_0xfa61('0xb')][_0xfa61('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x19bf77,_0x349ad5,_0x461c80){return new BPromise(function(_0x2ff552,_0x2470a0){return client[_0xfa61('0xd')](_0x19bf77,_0x461c80)[_0xfa61('0xe')](function(_0x500d7d){logger[_0xfa61('0xf')](_0xfa61('0x10'),_0x349ad5,_0xfa61('0x11'));logger[_0xfa61('0x12')](_0xfa61('0x13'),_0x349ad5,'request\x20sent',JSON[_0xfa61('0x14')](_0x500d7d));if(_0x500d7d[_0xfa61('0x15')]){if(_0x500d7d[_0xfa61('0x15')][_0xfa61('0x16')]===0x1f4){logger[_0xfa61('0x15')](_0xfa61('0x10'),_0x349ad5,_0x500d7d[_0xfa61('0x15')]['message']);return _0x2470a0(_0x500d7d[_0xfa61('0x15')]['message']);}logger[_0xfa61('0x15')](_0xfa61('0x10'),_0x349ad5,_0x500d7d[_0xfa61('0x15')][_0xfa61('0x17')]);return _0x2ff552(_0x500d7d[_0xfa61('0x15')][_0xfa61('0x17')]);}else{logger[_0xfa61('0xf')](_0xfa61('0x10'),_0x349ad5,'request\x20sent');_0x2ff552(_0x500d7d['result']['message']);}})[_0xfa61('0x18')](function(_0x514bf6){logger[_0xfa61('0x15')](_0xfa61('0x10'),_0x349ad5,_0x514bf6);_0x2470a0(_0x514bf6);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 16050e8..eb108e2 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 _0x890d=['path','express','Router','../../components/auth/service','../../config/environment','./cmCompany.controller','isAuthenticated','index','show','get','getContacts','post','create','/:id/contacts','addContacts','put','/:id','update','delete','destroy','util'];(function(_0x5e8c32,_0x1b1f3f){var _0x595f7b=function(_0x38840e){while(--_0x38840e){_0x5e8c32['push'](_0x5e8c32['shift']());}};_0x595f7b(++_0x1b1f3f);}(_0x890d,0xe6));var _0xd890=function(_0x171d60,_0x1e2095){_0x171d60=_0x171d60-0x0;var _0x491f35=_0x890d[_0x171d60];return _0x491f35;};'use strict';var multer=require('multer');var util=require(_0xd890('0x0'));var path=require(_0xd890('0x1'));var timeout=require('connect-timeout');var express=require(_0xd890('0x2'));var router=express[_0xd890('0x3')]();var auth=require(_0xd890('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd890('0x5'));var controller=require(_0xd890('0x6'));router['get']('/',auth[_0xd890('0x7')](),controller[_0xd890('0x8')]);router['get']('/:id',auth[_0xd890('0x7')](),controller[_0xd890('0x9')]);router[_0xd890('0xa')]('/:id/contacts',auth[_0xd890('0x7')](),controller[_0xd890('0xb')]);router[_0xd890('0xc')]('/',auth['isAuthenticated'](),controller[_0xd890('0xd')]);router[_0xd890('0xc')](_0xd890('0xe'),auth[_0xd890('0x7')](),controller[_0xd890('0xf')]);router[_0xd890('0x10')](_0xd890('0x11'),auth[_0xd890('0x7')](),controller[_0xd890('0x12')]);router[_0xd890('0x13')](_0xd890('0x11'),auth['isAuthenticated'](),controller[_0xd890('0x14')]);module['exports']=router; \ No newline at end of file +var _0xf70e=['create','addContacts','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/contacts','getContacts','post'];(function(_0x499d9a,_0x2e20c5){var _0x231927=function(_0x1e434c){while(--_0x1e434c){_0x499d9a['push'](_0x499d9a['shift']());}};_0x231927(++_0x2e20c5);}(_0xf70e,0xd9));var _0xef70=function(_0x57cc54,_0x6862b1){_0x57cc54=_0x57cc54-0x0;var _0xa93acc=_0xf70e[_0x57cc54];return _0xa93acc;};'use strict';var multer=require(_0xef70('0x0'));var util=require(_0xef70('0x1'));var path=require(_0xef70('0x2'));var timeout=require(_0xef70('0x3'));var express=require(_0xef70('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xef70('0x5'));var controller=require('./cmCompany.controller');router[_0xef70('0x6')]('/',auth['isAuthenticated'](),controller[_0xef70('0x7')]);router['get'](_0xef70('0x8'),auth[_0xef70('0x9')](),controller[_0xef70('0xa')]);router['get'](_0xef70('0xb'),auth['isAuthenticated'](),controller[_0xef70('0xc')]);router[_0xef70('0xd')]('/',auth[_0xef70('0x9')](),controller[_0xef70('0xe')]);router[_0xef70('0xd')](_0xef70('0xb'),auth[_0xef70('0x9')](),controller[_0xef70('0xf')]);router[_0xef70('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xef70('0x11')]);router[_0xef70('0x12')](_0xef70('0x8'),auth['isAuthenticated'](),controller[_0xef70('0x13')]);module[_0xef70('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 7ad1fd3..e01489c 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 _0x4210=['INTEGER','DATE','NOW','lodash','sequelize','exports','STRING','TEXT'];(function(_0x1e4f4e,_0x4eeee0){var _0x568fe2=function(_0x445694){while(--_0x445694){_0x1e4f4e['push'](_0x1e4f4e['shift']());}};_0x568fe2(++_0x4eeee0);}(_0x4210,0x12b));var _0x0421=function(_0x287478,_0x330516){_0x287478=_0x287478-0x0;var _0x5e4655=_0x4210[_0x287478];return _0x5e4655;};'use strict';var _=require(_0x0421('0x0'));var Sequelize=require(_0x0421('0x1'));module[_0x0421('0x2')]={'firstName':{'type':Sequelize[_0x0421('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x0421('0x3')]},'street':{'type':Sequelize[_0x0421('0x3')]},'postalCode':{'type':Sequelize[_0x0421('0x3')]},'city':{'type':Sequelize[_0x0421('0x3')]},'country':{'type':Sequelize[_0x0421('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0421('0x4')]},'phone':{'type':Sequelize[_0x0421('0x3')]},'mobile':{'type':Sequelize[_0x0421('0x3')]},'fax':{'type':Sequelize[_0x0421('0x3')]},'email':{'type':Sequelize[_0x0421('0x3')]},'url':{'type':Sequelize[_0x0421('0x3')]},'facebook':{'type':Sequelize[_0x0421('0x3')]},'fb_data':{'type':Sequelize[_0x0421('0x3')]},'twitter':{'type':Sequelize[_0x0421('0x3')]},'skype':{'type':Sequelize[_0x0421('0x3')]},'teams':{'type':Sequelize[_0x0421('0x3')]},'viber':{'type':Sequelize[_0x0421('0x3')]},'line':{'type':Sequelize[_0x0421('0x3')]},'wechat':{'type':Sequelize[_0x0421('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x0421('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x0421('0x6')],'defaultValue':Sequelize[_0x0421('0x7')]}}; \ No newline at end of file +var _0xc549=['INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize','exports','STRING','TEXT'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0xc549,0x82));var _0x9c54=function(_0x20e3dd,_0x561494){_0x20e3dd=_0x20e3dd-0x0;var _0x1a4008=_0xc549[_0x20e3dd];return _0x1a4008;};'use strict';var _=require(_0x9c54('0x0'));var Sequelize=require(_0x9c54('0x1'));module[_0x9c54('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x9c54('0x3')]},'street':{'type':Sequelize[_0x9c54('0x3')]},'postalCode':{'type':Sequelize[_0x9c54('0x3')]},'city':{'type':Sequelize[_0x9c54('0x3')]},'country':{'type':Sequelize[_0x9c54('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9c54('0x4')]},'phone':{'type':Sequelize[_0x9c54('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x9c54('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x9c54('0x3')]},'fb_data':{'type':Sequelize[_0x9c54('0x3')]},'twitter':{'type':Sequelize[_0x9c54('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x9c54('0x3')]},'viber':{'type':Sequelize[_0x9c54('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x9c54('0x3')]},'telegram':{'type':Sequelize[_0x9c54('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0x9c54('0x5')](0x2)[_0x9c54('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x9c54('0x7')],'defaultValue':Sequelize[_0x9c54('0x8')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index ddc3568..9918f5f 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 _0x8d99=['Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','child_process','fork','../../components/import/cm/csv','socket_timestamp','File\x20uploaded\x20correctly!','pid','createReadStream','parse','meta','import','User','agent','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','CmContact','model','dateStart','query','dateEnd','intersection','fields','attributes','hasOwnProperty','nolimit','sort','filters','pick','add','day','merge','where','filter','options','include','tag','push','Tag','includeAll','Tags','color','findAll','rows','params','describe','catch','body','get','mergeWith','length','isArray','tags','info','from','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','join','bulkCreate','keys','duplicates','$or','ListId','show','find','$and','CmCustomField','omit','map','format','cf_%d','pickBy','startsWith','cf_','cm_contacts','setFields','toParam','sequelize','text','phone','getTags','findOne','rawAttributes','setTags','ids','getHoppers','order','ContactId','getHopperFinals','getJscriptySessions','uploadCsv','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!'];(function(_0x5860ca,_0x5e7823){var _0x20adec=function(_0x766a0b){while(--_0x766a0b){_0x5860ca['push'](_0x5860ca['shift']());}};_0x20adec(++_0x5e7823);}(_0x8d99,0x186));var _0x98d9=function(_0x2848f6,_0x3c9a75){_0x2848f6=_0x2848f6-0x0;var _0x1f3869=_0x8d99[_0x2848f6];return _0x1f3869;};'use strict';var pdf=require(_0x98d9('0x0'));var emlformat=require(_0x98d9('0x1'));var rimraf=require(_0x98d9('0x2'));var zipdir=require(_0x98d9('0x3'));var jsonpatch=require(_0x98d9('0x4'));var rp=require(_0x98d9('0x5'));var moment=require('moment');var BPromise=require(_0x98d9('0x6'));var Mustache=require(_0x98d9('0x7'));var util=require(_0x98d9('0x8'));var path=require(_0x98d9('0x9'));var sox=require(_0x98d9('0xa'));var csv=require('to-csv');var ejs=require(_0x98d9('0xb'));var fs=require('fs');var _=require(_0x98d9('0xc'));var squel=require('squel');var crypto=require(_0x98d9('0xd'));var jsforce=require(_0x98d9('0xe'));var deskjs=require(_0x98d9('0xf'));var toCsv=require('to-csv');var querystring=require(_0x98d9('0x10'));var Papa=require(_0x98d9('0x11'));var Redis=require(_0x98d9('0x12'));var qs=require(_0x98d9('0x13'));var logger=require('../../config/logger')(_0x98d9('0x14'));var utils=require(_0x98d9('0x15'));var config=require(_0x98d9('0x16'));var db=require(_0x98d9('0x17'))['db'];config[_0x98d9('0x18')]=_[_0x98d9('0x19')](config['redis'],{'host':_0x98d9('0x1a'),'port':0x18eb});var socket=require(_0x98d9('0x1b'))(new Redis(config['redis']));require(_0x98d9('0x1c'))[_0x98d9('0x1d')](socket);function respondWithStatusCode(_0x543737,_0x1a03d6){_0x1a03d6=_0x1a03d6||0xcc;return function(_0x1a2e03){if(_0x1a2e03){return _0x543737[_0x98d9('0x1e')](_0x1a03d6);}return _0x543737[_0x98d9('0x1f')](_0x1a03d6)[_0x98d9('0x20')]();};}function respondWithResult(_0x466910,_0x21c5fb){_0x21c5fb=_0x21c5fb||0xc8;return function(_0x5e0890){if(_0x5e0890){return _0x466910['status'](_0x21c5fb)[_0x98d9('0x21')](_0x5e0890);}};}function respondWithFilteredResult(_0x2cbbda,_0x1a0c09){return function(_0x234c47){if(_0x234c47){var _0x498761=_0x234c47[_0x98d9('0x22')],_0x3b3335=_0x1a0c09[_0x98d9('0x23')],_0x731595=_0x1a0c09[_0x98d9('0x23')]+_0x1a0c09[_0x98d9('0x24')],_0x2ec945;if(_0x731595>=_0x498761){_0x731595=_0x498761;_0x2ec945=0xc8;}else{_0x2ec945=0xce;}_0x2cbbda['status'](_0x2ec945);return _0x2cbbda[_0x98d9('0x25')](_0x98d9('0x26'),_0x3b3335+'-'+_0x731595+'/'+_0x498761)[_0x98d9('0x21')](_0x234c47);}return null;};}function patchUpdates(_0x113831){return function(_0x503d67){try{jsonpatch[_0x98d9('0x27')](_0x503d67,_0x113831,!![]);}catch(_0x34f9d9){return BPromise[_0x98d9('0x28')](_0x34f9d9);}return _0x503d67[_0x98d9('0x29')]();};}function saveUpdates(_0x390202,_0x228fac){return function(_0x39d572){if(_0x39d572){return _0x39d572['update'](_0x390202)[_0x98d9('0x2a')](function(_0x142dee){return _0x142dee;});}return null;};}function removeEntity(_0xba8378,_0x31da21){return function(_0x3bfd0c){if(_0x3bfd0c){return _0x3bfd0c[_0x98d9('0x2b')]()[_0x98d9('0x2a')](function(){_0xba8378[_0x98d9('0x1f')](0xcc)[_0x98d9('0x20')]();});}};}function handleEntityNotFound(_0x53199d,_0x133982){return function(_0xc25a7e){if(!_0xc25a7e){_0x53199d[_0x98d9('0x1e')](0x194);}return _0xc25a7e;};}function handleError(_0x2e5742,_0x3bac57){_0x3bac57=_0x3bac57||0x1f4;return function(_0x30eb9f){logger[_0x98d9('0x2c')](_0x30eb9f['stack']);if(_0x30eb9f[_0x98d9('0x2d')]){delete _0x30eb9f[_0x98d9('0x2d')];}_0x2e5742[_0x98d9('0x1f')](_0x3bac57)[_0x98d9('0x2e')](_0x30eb9f);};}exports[_0x98d9('0x2f')]=function(_0x33265c,_0x4d001a){var _0x4666a2={},_0x23a0f9={},_0x180508={'count':0x0,'rows':[]};return db[_0x98d9('0x30')]['describe']()['then'](function(_0x3ebee2){_0x23a0f9[_0x98d9('0x31')]=_['keys'](_0x3ebee2);var _0x4c86cc={'dateStart':_0x33265c['query'][_0x98d9('0x32')],'dateEnd':_0x33265c[_0x98d9('0x33')][_0x98d9('0x34')]};delete _0x33265c[_0x98d9('0x33')][_0x98d9('0x32')];delete _0x33265c[_0x98d9('0x33')][_0x98d9('0x34')];_0x23a0f9[_0x98d9('0x33')]=_['keys'](_0x33265c[_0x98d9('0x33')]);_0x23a0f9['filters']=_[_0x98d9('0x35')](_0x23a0f9['model'],_0x23a0f9['query']);_0x4666a2['attributes']=_[_0x98d9('0x35')](_0x23a0f9[_0x98d9('0x31')],qs[_0x98d9('0x36')](_0x33265c[_0x98d9('0x33')][_0x98d9('0x36')]));_0x4666a2[_0x98d9('0x37')]=_0x4666a2[_0x98d9('0x37')]['length']?_0x4666a2[_0x98d9('0x37')]:_0x23a0f9[_0x98d9('0x31')];if(!_0x33265c[_0x98d9('0x33')][_0x98d9('0x38')](_0x98d9('0x39'))){_0x4666a2[_0x98d9('0x24')]=qs[_0x98d9('0x24')](_0x33265c[_0x98d9('0x33')]['limit']);_0x4666a2[_0x98d9('0x23')]=qs[_0x98d9('0x23')](_0x33265c[_0x98d9('0x33')][_0x98d9('0x23')]);}_0x4666a2['order']=qs[_0x98d9('0x3a')](_0x33265c[_0x98d9('0x33')][_0x98d9('0x3a')]);_0x4666a2['where']=qs[_0x98d9('0x3b')](_[_0x98d9('0x3c')](_0x33265c[_0x98d9('0x33')],_0x23a0f9[_0x98d9('0x3b')]));if(_0x4c86cc[_0x98d9('0x32')]){if(_0x4c86cc['dateEnd']){_0x4c86cc[_0x98d9('0x34')]=moment(_0x4c86cc['dateEnd'])[_0x98d9('0x3d')](0x1,_0x98d9('0x3e'));}else{_0x4c86cc[_0x98d9('0x34')]=moment(_0x4c86cc['dateStart'])['add'](0x1,_0x98d9('0x3e'));}_[_0x98d9('0x3f')](_0x4666a2['where'],{'createdAt':{'$gte':_0x4c86cc[_0x98d9('0x32')],'$lte':_0x4c86cc[_0x98d9('0x34')]}});}if(_0x33265c[_0x98d9('0x33')]['filter']){_0x4666a2[_0x98d9('0x40')]=_[_0x98d9('0x3f')](_0x4666a2[_0x98d9('0x40')],{'$or':_['map'](_0x4666a2['attributes'],function(_0x4d5fec){var _0x15fdc2={};_0x15fdc2[_0x4d5fec]={'$like':'%'+_0x33265c['query'][_0x98d9('0x41')]+'%'};return _0x15fdc2;})});}_0x4666a2=_['merge']({},_0x4666a2,_0x33265c[_0x98d9('0x42')]);var _0x282baa={'where':_0x4666a2[_0x98d9('0x40')]};_0x282baa[_0x98d9('0x43')]=[];if(_0x33265c['query'][_0x98d9('0x44')]){_0x282baa['include'][_0x98d9('0x45')]({'model':db[_0x98d9('0x46')],'as':'Tags','attributes':['id'],'where':{'id':_0x33265c['query']['tag']},'required':!![]});_0x282baa['distinct']=!![];}return db[_0x98d9('0x30')][_0x98d9('0x22')](_0x282baa)[_0x98d9('0x2a')](function(_0x2c4a99){_0x180508[_0x98d9('0x22')]=_0x2c4a99;if(_0x33265c[_0x98d9('0x33')][_0x98d9('0x47')]){_0x4666a2[_0x98d9('0x43')]=[{'model':db[_0x98d9('0x46')],'as':_0x98d9('0x48'),'attributes':['id','name','color'],'required':_0x33265c[_0x98d9('0x33')][_0x98d9('0x44')]?!![]:![]},{'model':db[_0x98d9('0x46')],'as':'ThroughTags','attributes':['id',_0x98d9('0x2d'),_0x98d9('0x49')],'through':_0x33265c['query']['tag']?{'attributes':[],'where':{'TagId':_0x33265c[_0x98d9('0x33')][_0x98d9('0x44')]||undefined}}:{},'required':_0x33265c[_0x98d9('0x33')]['tag']?!![]:![]}];}return db[_0x98d9('0x30')][_0x98d9('0x4a')](_0x4666a2);})['then'](function(_0x7bb0ce){_0x180508[_0x98d9('0x4b')]=_0x7bb0ce;return _0x180508;})[_0x98d9('0x2a')](respondWithFilteredResult(_0x4d001a,_0x4666a2))['catch'](handleError(_0x4d001a,null));});};exports['destroy']=function(_0x183e4e,_0x29e7c7){return db[_0x98d9('0x30')]['find']({'where':{'id':_0x183e4e[_0x98d9('0x4c')]['id']}})[_0x98d9('0x2a')](handleEntityNotFound(_0x29e7c7,null))[_0x98d9('0x2a')](removeEntity(_0x29e7c7,null))['catch'](handleError(_0x29e7c7,null));};exports[_0x98d9('0x4d')]=function(_0x44f260,_0x104bae){return db[_0x98d9('0x30')][_0x98d9('0x4d')]()[_0x98d9('0x2a')](respondWithResult(_0x104bae,null))[_0x98d9('0x4e')](handleError(_0x104bae,null));};exports['merge']=function(_0x2c44ce,_0x3dc9ba){var _0x4fd0cf;var _0x5ec230;var _0x10b40b;if(_0x2c44ce[_0x98d9('0x4f')]['id']){delete _0x2c44ce[_0x98d9('0x4f')]['id'];}return db[_0x98d9('0x30')][_0x98d9('0x4a')]({'where':{'id':[_0x2c44ce[_0x98d9('0x4f')]['to'],_0x2c44ce[_0x98d9('0x4f')]['from']]}})[_0x98d9('0x2a')](function(_0x5c6376){if(_0x5c6376){if(_0x5c6376['length']!==0x2){return null;}_0x5c6376[0x0]=_0x5c6376[0x0]['get']({'plain':!![]});_0x5c6376[0x1]=_0x5c6376[0x1][_0x98d9('0x50')]({'plain':!![]});delete _0x5c6376[0x0]['id'];delete _0x5c6376[0x1]['id'];return _[_0x98d9('0x51')](_0x5c6376[0x0],_0x5c6376[0x1],function(_0x514b9e,_0xae26b2){if(Array['isArray'](_0xae26b2)&&!_0xae26b2[_0x98d9('0x52')]){return _0x514b9e;}else if(!_0xae26b2){return _0x514b9e;}});}})[_0x98d9('0x2a')](handleEntityNotFound(_0x3dc9ba,null))['then'](function(_0x53d2b7){if(_0x53d2b7){if(_0x53d2b7['tags']&&_[_0x98d9('0x53')](_0x53d2b7[_0x98d9('0x54')])){_0x53d2b7['tags']=_0x53d2b7['tags']['join']();}logger[_0x98d9('0x55')]('[CmContact][merge]\x20to\x20%s\x20from\x20%s',_0x2c44ce[_0x98d9('0x4f')]['to'],_0x2c44ce[_0x98d9('0x4f')][_0x98d9('0x56')]);return db[_0x98d9('0x57')]['destroy']({'where':{'ContactId':[_0x2c44ce['body']['to'],_0x2c44ce[_0x98d9('0x4f')]['from']]}})[_0x98d9('0x2a')](function(_0x52c2cd){logger[_0x98d9('0x55')](_0x98d9('0x58'),_0x52c2cd);return db[_0x98d9('0x59')][_0x98d9('0x2b')]({'where':{'ContactId':[_0x2c44ce['body']['to'],_0x2c44ce[_0x98d9('0x4f')]['from']]}})[_0x98d9('0x2a')](function(_0x53b9c3){logger[_0x98d9('0x55')](_0x98d9('0x5a'),_0x53b9c3);return db['CmContact'][_0x98d9('0x5b')](_0x53d2b7);});});}})[_0x98d9('0x2a')](function(_0x1b5a42){if(_0x1b5a42){_0x4fd0cf=_0x1b5a42;_0x5ec230={'ContactId':_0x4fd0cf['id']};_0x10b40b={'where':{'ContactId':[_0x2c44ce[_0x98d9('0x4f')]['to'],_0x2c44ce['body'][_0x98d9('0x56')]]}};return db[_0x98d9('0x5c')]['update'](_0x5ec230,_0x10b40b);}})['then'](function(){if(_0x4fd0cf){return db['ChatMessage'][_0x98d9('0x5d')](_0x5ec230,_0x10b40b);}})[_0x98d9('0x2a')](function(){if(_0x4fd0cf){return db[_0x98d9('0x5e')]['update'](_0x5ec230,_0x10b40b);}})[_0x98d9('0x2a')](function(){if(_0x4fd0cf){return db[_0x98d9('0x5f')][_0x98d9('0x5d')](_0x5ec230,_0x10b40b);}})[_0x98d9('0x2a')](function(){if(_0x4fd0cf){return db[_0x98d9('0x60')][_0x98d9('0x5d')](_0x5ec230,_0x10b40b);}})[_0x98d9('0x2a')](function(){if(_0x4fd0cf){return db[_0x98d9('0x5f')][_0x98d9('0x5d')](_0x5ec230,_0x10b40b);}})[_0x98d9('0x2a')](function(){if(_0x4fd0cf){return db['MailMessage'][_0x98d9('0x5d')](_0x5ec230,_0x10b40b);}})['then'](function(){if(_0x4fd0cf){return db[_0x98d9('0x61')][_0x98d9('0x5d')](_0x5ec230,_0x10b40b);}})['then'](function(){if(_0x4fd0cf){return db[_0x98d9('0x62')]['update'](_0x5ec230,_0x10b40b);}})[_0x98d9('0x2a')](function(){if(_0x4fd0cf){return db[_0x98d9('0x63')][_0x98d9('0x5d')](_0x5ec230,_0x10b40b);}})['then'](function(){if(_0x4fd0cf){return db[_0x98d9('0x64')][_0x98d9('0x5d')](_0x5ec230,_0x10b40b);}})[_0x98d9('0x2a')](function(){if(_0x4fd0cf){return db[_0x98d9('0x65')][_0x98d9('0x5d')](_0x5ec230,_0x10b40b);}})[_0x98d9('0x2a')](function(){if(_0x4fd0cf){return db[_0x98d9('0x66')]['update'](_0x5ec230,_0x10b40b);}})[_0x98d9('0x2a')](function(){if(_0x4fd0cf){return db[_0x98d9('0x67')]['update'](_0x5ec230,_0x10b40b);}})[_0x98d9('0x2a')](function(){if(_0x4fd0cf){return db[_0x98d9('0x68')][_0x98d9('0x5d')](_0x5ec230,_0x10b40b);}})[_0x98d9('0x2a')](function(){if(_0x4fd0cf){return db[_0x98d9('0x69')][_0x98d9('0x5d')](_0x5ec230,_0x10b40b);}})[_0x98d9('0x2a')](function(){if(_0x4fd0cf){return db[_0x98d9('0x6a')][_0x98d9('0x5d')](_0x5ec230,_0x10b40b);}})[_0x98d9('0x2a')](function(){if(_0x4fd0cf){return db[_0x98d9('0x6b')][_0x98d9('0x5d')](_0x5ec230,_0x10b40b);}})[_0x98d9('0x2a')](function(){if(_0x4fd0cf){return db[_0x98d9('0x6c')][_0x98d9('0x5d')](_0x5ec230,_0x10b40b);}})[_0x98d9('0x2a')](function(){if(_0x4fd0cf){return db[_0x98d9('0x6d')][_0x98d9('0x5d')](_0x5ec230,_0x10b40b);}})[_0x98d9('0x2a')](function(){if(_0x4fd0cf){return db[_0x98d9('0x6e')][_0x98d9('0x5d')](_0x5ec230,_0x10b40b);}})['then'](function(){if(_0x4fd0cf){return db[_0x98d9('0x6f')]['update'](_0x5ec230,_0x10b40b);}})[_0x98d9('0x2a')](function(){if(_0x4fd0cf){return db[_0x98d9('0x70')][_0x98d9('0x5d')](_0x5ec230,_0x10b40b);}})['then'](function(){if(_0x4fd0cf){return db['CmContact'][_0x98d9('0x2b')]({'where':{'id':[_0x2c44ce['body']['to'],_0x2c44ce[_0x98d9('0x4f')]['from']]}});}})[_0x98d9('0x2a')](function(){if(_0x4fd0cf){return _0x4fd0cf;}})[_0x98d9('0x2a')](respondWithResult(_0x3dc9ba,null))[_0x98d9('0x4e')](handleError(_0x3dc9ba,null));};exports[_0x98d9('0x5b')]=function(_0x90cdb6,_0x99c2cd){return db[_0x98d9('0x30')][_0x98d9('0x4d')]()[_0x98d9('0x2a')](function(_0x5375ea){if(_0x90cdb6[_0x98d9('0x4f')][_0x98d9('0x54')]&&_[_0x98d9('0x53')](_0x90cdb6['body'][_0x98d9('0x54')])){if(_0x90cdb6[_0x98d9('0x4f')][_0x98d9('0x54')][_0x98d9('0x52')]){_0x90cdb6[_0x98d9('0x4f')]['tags']=_0x90cdb6[_0x98d9('0x4f')][_0x98d9('0x54')][_0x98d9('0x71')](';')+';';}else{_0x90cdb6[_0x98d9('0x4f')][_0x98d9('0x54')]=null;}}else{_0x90cdb6[_0x98d9('0x4f')]['tags']=null;}return db[_0x98d9('0x30')][_0x98d9('0x5b')](_0x90cdb6['body'],{'fields':_['keys'](_0x5375ea),'raw':!![]});})[_0x98d9('0x2a')](respondWithResult(_0x99c2cd,0xc9))[_0x98d9('0x4e')](handleError(_0x99c2cd,null));};exports[_0x98d9('0x72')]=function(_0x268485,_0x12fd2d){var _0x5f12b4=[];var _0x2a589d=0x0;var _0x3a552a=0x0;var _0x35248e=0x0;return db[_0x98d9('0x30')][_0x98d9('0x4d')]()['then'](function(_0x2d8737){return BPromise['each'](_0x268485[_0x98d9('0x4f')],function(_0x974d61){var _0x1dfb6b={'where':{'$or':[]},'defaults':_0x974d61,'fields':_[_0x98d9('0x73')](_0x2d8737),'raw':!![]};if(_0x974d61[_0x98d9('0x74')]){for(var _0xebcf14=0x0;_0xebcf14<_0x974d61[_0x98d9('0x74')][_0x98d9('0x52')];_0xebcf14++){var _0x24750c={};_0x24750c[_0x974d61[_0x98d9('0x74')][_0xebcf14]]=_0x974d61[_0x974d61[_0x98d9('0x74')][_0xebcf14]];_0x1dfb6b[_0x98d9('0x40')][_0x98d9('0x75')][_0x98d9('0x45')](_0x24750c);}_0x1dfb6b[_0x98d9('0x40')][_0x98d9('0x76')]=_0x974d61[_0x98d9('0x76')];}return db[_0x98d9('0x30')]['findOrCreate'](_0x1dfb6b)['spread'](function(_0x1d634d,_0x5c2c0a){if(_0x5c2c0a){_0x2a589d++;}else{_0x35248e++;}})['catch'](function(_0x579d69){console[_0x98d9('0x2c')](_0x579d69);_0x3a552a++;});});})['then'](function(_0xd0ca60){if(_0xd0ca60){return{'success':_0x2a589d,'failure':_0x3a552a,'duplicates':_0x35248e};}})['then'](respondWithResult(_0x12fd2d,0xc9))['catch'](handleError(_0x12fd2d,null));};exports[_0x98d9('0x77')]=function(_0x13a349,_0x4aca65,_0x458748){var _0x57aa4f;return db[_0x98d9('0x30')][_0x98d9('0x4d')]()[_0x98d9('0x2a')](function(_0x51ad4f){return db[_0x98d9('0x30')][_0x98d9('0x78')]({'where':{'id':_0x13a349[_0x98d9('0x4c')]['id']},'include':[{'model':db['Tag'],'as':_0x98d9('0x48'),'attributes':['id',_0x98d9('0x2d'),'color'],'required':_0x13a349['query'][_0x98d9('0x44')]?!![]:![]}],'attributes':_[_0x98d9('0x73')](_0x51ad4f)});})[_0x98d9('0x2a')](function(_0x1d7253){_0x57aa4f=_0x1d7253['get']({'plain':!![]});var _0x6251b4={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1d7253&&_0x1d7253[_0x98d9('0x76')]){if(_0x1d7253[_0x98d9('0x76')]){_0x6251b4[_0x98d9('0x40')][_0x98d9('0x79')][_0x98d9('0x45')]({'ListId':{'$ne':_0x1d7253[_0x98d9('0x76')]}});}}return db[_0x98d9('0x7a')][_0x98d9('0x4a')](_0x6251b4);})[_0x98d9('0x2a')](function(_0x3a759a){return _[_0x98d9('0x7b')](_0x57aa4f,_[_0x98d9('0x7c')](_0x3a759a,function(_0x35322b){return util[_0x98d9('0x7d')](_0x98d9('0x7e'),_0x35322b['id']);}));})[_0x98d9('0x2a')](handleEntityNotFound(_0x4aca65,null))[_0x98d9('0x2a')](respondWithResult(_0x4aca65,null))[_0x98d9('0x4e')](handleError(_0x4aca65,null));};exports[_0x98d9('0x5d')]=function(_0x369821,_0x181c68){var _0x2b2243;if(_0x369821[_0x98d9('0x4f')]['id']){delete _0x369821[_0x98d9('0x4f')]['id'];}return db[_0x98d9('0x30')][_0x98d9('0x78')]({'where':{'id':_0x369821[_0x98d9('0x4c')]['id']}})[_0x98d9('0x2a')](handleEntityNotFound(_0x181c68,null))[_0x98d9('0x2a')](saveUpdates(_0x369821['body'],null))['then'](function(_0x807be5){_0x2b2243=_0x807be5;var _0x3f9ffd={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x807be5&&_0x807be5[_0x98d9('0x76')]){if(_0x807be5['ListId']){_0x3f9ffd[_0x98d9('0x40')]['$and']['push']({'ListId':{'$ne':_0x807be5[_0x98d9('0x76')]}});}}return db[_0x98d9('0x7a')][_0x98d9('0x4a')](_0x3f9ffd);})['then'](function(_0x523688){if(_0x523688){return _[_0x98d9('0x7b')](_[_0x98d9('0x7f')](_0x369821[_0x98d9('0x4f')],function(_0x3fbbda,_0x397ae8){return _[_0x98d9('0x80')](_0x397ae8,_0x98d9('0x81'));}),_[_0x98d9('0x7c')](_0x523688,function(_0x1d9978){return util['format'](_0x98d9('0x7e'),_0x1d9978['id']);}));}})['then'](function(_0x32c23d){if(_0x32c23d&&!_['isEmpty'](_0x32c23d)){var _0xb8a75d=squel[_0x98d9('0x5d')]()['table'](_0x98d9('0x82'))[_0x98d9('0x83')](_0x32c23d)[_0x98d9('0x40')]('id\x20=\x20?',_0x369821[_0x98d9('0x4c')]['id'])[_0x98d9('0x84')]();return db[_0x98d9('0x85')][_0x98d9('0x33')](_0xb8a75d[_0x98d9('0x86')],{'replacements':_0xb8a75d['values']});}})[_0x98d9('0x2a')](function(){if(_0x369821[_0x98d9('0x4f')][_0x98d9('0x87')]&&_0x2b2243){return db[_0x98d9('0x57')][_0x98d9('0x5d')]({'phone':_0x369821['body'][_0x98d9('0x87')]},{'where':{'ContactId':_0x2b2243['id']}});}})[_0x98d9('0x2a')](function(){return _0x2b2243;})[_0x98d9('0x2a')](respondWithResult(_0x181c68,null))[_0x98d9('0x4e')](handleError(_0x181c68,null));};exports[_0x98d9('0x88')]=function(_0x520696,_0x1edd44,_0x51e358){var _0x32cb40={};var _0x4dfe48={};var _0x2bc37a;var _0x2bfba3;return db['CmContact'][_0x98d9('0x89')]({'where':{'id':_0x520696[_0x98d9('0x4c')]['id']}})[_0x98d9('0x2a')](handleEntityNotFound(_0x1edd44,null))[_0x98d9('0x2a')](function(_0x20c56a){if(_0x20c56a){_0x2bc37a=_0x20c56a;_0x4dfe48[_0x98d9('0x31')]=_[_0x98d9('0x73')](db[_0x98d9('0x46')][_0x98d9('0x8a')]);_0x4dfe48[_0x98d9('0x33')]=_[_0x98d9('0x73')](_0x520696['query']);_0x4dfe48['filters']=_[_0x98d9('0x35')](_0x4dfe48[_0x98d9('0x31')],_0x4dfe48[_0x98d9('0x33')]);_0x32cb40[_0x98d9('0x37')]=_['intersection'](_0x4dfe48[_0x98d9('0x31')],qs['fields'](_0x520696['query'][_0x98d9('0x36')]));_0x32cb40[_0x98d9('0x37')]=_0x32cb40[_0x98d9('0x37')][_0x98d9('0x52')]?_0x32cb40[_0x98d9('0x37')]:_0x4dfe48[_0x98d9('0x31')];_0x32cb40['order']=qs['sort'](_0x520696['query'][_0x98d9('0x3a')]);_0x32cb40[_0x98d9('0x40')]=qs[_0x98d9('0x3b')](_[_0x98d9('0x3c')](_0x520696[_0x98d9('0x33')],_0x4dfe48['filters']));if(_0x520696[_0x98d9('0x33')]['filter']){_0x32cb40[_0x98d9('0x40')]=_[_0x98d9('0x3f')](_0x32cb40[_0x98d9('0x40')],{'$or':_[_0x98d9('0x7c')](_0x32cb40[_0x98d9('0x37')],function(_0x35ee65){var _0x140b70={};_0x140b70[_0x35ee65]={'$like':'%'+_0x520696[_0x98d9('0x33')][_0x98d9('0x41')]+'%'};return _0x140b70;})});}_0x32cb40=_[_0x98d9('0x3f')]({},_0x32cb40,_0x520696[_0x98d9('0x42')]);return _0x2bc37a[_0x98d9('0x88')](_0x32cb40);}})[_0x98d9('0x2a')](function(_0x5e2cf0){if(_0x5e2cf0){_0x2bfba3=_0x5e2cf0['length'];if(!_0x520696[_0x98d9('0x33')]['hasOwnProperty'](_0x98d9('0x39'))){_0x32cb40['limit']=qs['limit'](_0x520696[_0x98d9('0x33')][_0x98d9('0x24')]);_0x32cb40[_0x98d9('0x23')]=qs['offset'](_0x520696[_0x98d9('0x33')]['offset']);}return _0x2bc37a[_0x98d9('0x88')](_0x32cb40);}})[_0x98d9('0x2a')](function(_0x56241f){if(_0x56241f){return _0x56241f?{'count':_0x2bfba3,'rows':_0x56241f}:null;}})[_0x98d9('0x2a')](respondWithResult(_0x1edd44,null))[_0x98d9('0x4e')](handleError(_0x1edd44,null));};exports[_0x98d9('0x8b')]=function(_0x44116e,_0x39db86,_0x369c87){if(_0x44116e[_0x98d9('0x4f')]['id']){delete _0x44116e[_0x98d9('0x4f')]['id'];}return db[_0x98d9('0x30')][_0x98d9('0x89')]({'where':{'id':_0x44116e[_0x98d9('0x4c')]['id']}})[_0x98d9('0x2a')](handleEntityNotFound(_0x39db86,null))[_0x98d9('0x2a')](function(_0x4d136f){if(_0x4d136f){return _0x4d136f[_0x98d9('0x8b')](_0x44116e[_0x98d9('0x4f')][_0x98d9('0x8c')]||[]);}return null;})[_0x98d9('0x2a')](respondWithResult(_0x39db86,null))[_0x98d9('0x4e')](handleError(_0x39db86,null));};exports[_0x98d9('0x8d')]=function(_0x2c1117,_0x2abb09,_0x45931b){var _0x1a0eca={'raw':![],'where':{}};var _0x113b3b={};var _0x40a5c1={'count':0x0,'rows':[]};return db[_0x98d9('0x30')][_0x98d9('0x89')]({'where':{'id':_0x2c1117[_0x98d9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2abb09,null))[_0x98d9('0x2a')](function(_0x26c982){if(_0x26c982){_0x113b3b['model']=_['keys'](db['CmHopper'][_0x98d9('0x8a')]);_0x113b3b[_0x98d9('0x33')]=_[_0x98d9('0x73')](_0x2c1117[_0x98d9('0x33')]);_0x113b3b['filters']=_[_0x98d9('0x35')](_0x113b3b['model'],_0x113b3b['query']);_0x1a0eca['attributes']=_[_0x98d9('0x35')](_0x113b3b[_0x98d9('0x31')],qs[_0x98d9('0x36')](_0x2c1117[_0x98d9('0x33')][_0x98d9('0x36')]));_0x1a0eca[_0x98d9('0x37')]=_0x1a0eca['attributes'][_0x98d9('0x52')]?_0x1a0eca[_0x98d9('0x37')]:_0x113b3b[_0x98d9('0x31')];if(!_0x2c1117[_0x98d9('0x33')][_0x98d9('0x38')](_0x98d9('0x39'))){_0x1a0eca[_0x98d9('0x24')]=qs[_0x98d9('0x24')](_0x2c1117['query'][_0x98d9('0x24')]);_0x1a0eca['offset']=qs[_0x98d9('0x23')](_0x2c1117[_0x98d9('0x33')][_0x98d9('0x23')]);}_0x1a0eca[_0x98d9('0x8e')]=qs[_0x98d9('0x3a')](_0x2c1117[_0x98d9('0x33')]['sort']);_0x1a0eca[_0x98d9('0x40')]=qs[_0x98d9('0x3b')](_[_0x98d9('0x3c')](_0x2c1117[_0x98d9('0x33')],_0x113b3b[_0x98d9('0x3b')]));_0x1a0eca['where'][_0x98d9('0x8f')]=_0x26c982['id'];if(_0x2c1117[_0x98d9('0x33')][_0x98d9('0x41')]){_0x1a0eca['where']=_[_0x98d9('0x3f')](_0x1a0eca['where'],{'$or':_[_0x98d9('0x7c')](_0x1a0eca['attributes'],function(_0x191bcf){var _0x134016={};_0x134016[_0x191bcf]={'$like':'%'+_0x2c1117[_0x98d9('0x33')]['filter']+'%'};return _0x134016;})});}_0x1a0eca=_[_0x98d9('0x3f')]({},_0x1a0eca,_0x2c1117['options']);return db[_0x98d9('0x57')][_0x98d9('0x22')]({'where':_0x1a0eca[_0x98d9('0x40')]})[_0x98d9('0x2a')](function(_0x731e07){_0x40a5c1[_0x98d9('0x22')]=_0x731e07;if(_0x2c1117[_0x98d9('0x33')][_0x98d9('0x47')]){_0x1a0eca['include']=[{'all':!![]}];}return db[_0x98d9('0x57')][_0x98d9('0x4a')](_0x1a0eca);})['then'](function(_0x429142){_0x40a5c1['rows']=_0x429142;return _0x40a5c1;});}})[_0x98d9('0x2a')](respondWithFilteredResult(_0x2abb09,_0x1a0eca))[_0x98d9('0x4e')](handleError(_0x2abb09,null));};exports['getHopperHistories']=function(_0xe9be92,_0x27bc39,_0x415d07){var _0xa4fc3d={'raw':!![],'where':{}};var _0x44d1eb={};var _0x4abb77={'count':0x0,'rows':[]};return db[_0x98d9('0x30')][_0x98d9('0x89')]({'where':{'id':_0xe9be92[_0x98d9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x27bc39,null))[_0x98d9('0x2a')](function(_0x50fd55){if(_0x50fd55){_0x44d1eb['model']=_[_0x98d9('0x73')](db[_0x98d9('0x68')][_0x98d9('0x8a')]);_0x44d1eb[_0x98d9('0x33')]=_[_0x98d9('0x73')](_0xe9be92[_0x98d9('0x33')]);_0x44d1eb[_0x98d9('0x3b')]=_[_0x98d9('0x35')](_0x44d1eb['model'],_0x44d1eb['query']);_0xa4fc3d[_0x98d9('0x37')]=_['intersection'](_0x44d1eb[_0x98d9('0x31')],qs['fields'](_0xe9be92['query'][_0x98d9('0x36')]));_0xa4fc3d['attributes']=_0xa4fc3d[_0x98d9('0x37')][_0x98d9('0x52')]?_0xa4fc3d[_0x98d9('0x37')]:_0x44d1eb[_0x98d9('0x31')];if(!_0xe9be92[_0x98d9('0x33')][_0x98d9('0x38')]('nolimit')){_0xa4fc3d[_0x98d9('0x24')]=qs['limit'](_0xe9be92[_0x98d9('0x33')][_0x98d9('0x24')]);_0xa4fc3d[_0x98d9('0x23')]=qs[_0x98d9('0x23')](_0xe9be92[_0x98d9('0x33')][_0x98d9('0x23')]);}_0xa4fc3d[_0x98d9('0x8e')]=qs['sort'](_0xe9be92[_0x98d9('0x33')][_0x98d9('0x3a')]);_0xa4fc3d['where']=qs['filters'](_[_0x98d9('0x3c')](_0xe9be92[_0x98d9('0x33')],_0x44d1eb[_0x98d9('0x3b')]));_0xa4fc3d[_0x98d9('0x40')][_0x98d9('0x8f')]=_0x50fd55['id'];if(_0xe9be92[_0x98d9('0x33')][_0x98d9('0x41')]){_0xa4fc3d[_0x98d9('0x40')]=_[_0x98d9('0x3f')](_0xa4fc3d[_0x98d9('0x40')],{'$or':_[_0x98d9('0x7c')](_0xa4fc3d[_0x98d9('0x37')],function(_0x1d784d){var _0x599061={};_0x599061[_0x1d784d]={'$like':'%'+_0xe9be92['query'][_0x98d9('0x41')]+'%'};return _0x599061;})});}_0xa4fc3d=_['merge']({},_0xa4fc3d,_0xe9be92['options']);return db['CmHopperHistory'][_0x98d9('0x22')]({'where':_0xa4fc3d['where']})[_0x98d9('0x2a')](function(_0x2482b8){_0x4abb77[_0x98d9('0x22')]=_0x2482b8;if(_0xe9be92[_0x98d9('0x33')]['includeAll']){_0xa4fc3d[_0x98d9('0x43')]=[{'all':!![]}];}return db[_0x98d9('0x68')]['findAll'](_0xa4fc3d);})[_0x98d9('0x2a')](function(_0x4bf933){_0x4abb77[_0x98d9('0x4b')]=_0x4bf933;return _0x4abb77;});}})[_0x98d9('0x2a')](respondWithFilteredResult(_0x27bc39,_0xa4fc3d))['catch'](handleError(_0x27bc39,null));};exports[_0x98d9('0x90')]=function(_0x451ed7,_0x312a0a,_0x5a5002){var _0x47dca6={'raw':!![],'where':{}};var _0x4a398d={};var _0x80445d={'count':0x0,'rows':[]};return db[_0x98d9('0x30')][_0x98d9('0x89')]({'where':{'id':_0x451ed7[_0x98d9('0x4c')]['id']}})[_0x98d9('0x2a')](handleEntityNotFound(_0x312a0a,null))[_0x98d9('0x2a')](function(_0x574014){if(_0x574014){_0x4a398d['model']=_[_0x98d9('0x73')](db['CmHopperFinal']['rawAttributes']);_0x4a398d[_0x98d9('0x33')]=_['keys'](_0x451ed7[_0x98d9('0x33')]);_0x4a398d[_0x98d9('0x3b')]=_['intersection'](_0x4a398d['model'],_0x4a398d['query']);_0x47dca6[_0x98d9('0x37')]=_['intersection'](_0x4a398d[_0x98d9('0x31')],qs['fields'](_0x451ed7[_0x98d9('0x33')][_0x98d9('0x36')]));_0x47dca6[_0x98d9('0x37')]=_0x47dca6[_0x98d9('0x37')][_0x98d9('0x52')]?_0x47dca6[_0x98d9('0x37')]:_0x4a398d[_0x98d9('0x31')];if(!_0x451ed7[_0x98d9('0x33')][_0x98d9('0x38')](_0x98d9('0x39'))){_0x47dca6[_0x98d9('0x24')]=qs[_0x98d9('0x24')](_0x451ed7[_0x98d9('0x33')][_0x98d9('0x24')]);_0x47dca6[_0x98d9('0x23')]=qs[_0x98d9('0x23')](_0x451ed7[_0x98d9('0x33')]['offset']);}_0x47dca6['order']=qs[_0x98d9('0x3a')](_0x451ed7[_0x98d9('0x33')][_0x98d9('0x3a')]);_0x47dca6[_0x98d9('0x40')]=qs[_0x98d9('0x3b')](_[_0x98d9('0x3c')](_0x451ed7[_0x98d9('0x33')],_0x4a398d['filters']));_0x47dca6[_0x98d9('0x40')]['ContactId']=_0x574014['id'];if(_0x451ed7[_0x98d9('0x33')][_0x98d9('0x41')]){_0x47dca6[_0x98d9('0x40')]=_['merge'](_0x47dca6[_0x98d9('0x40')],{'$or':_['map'](_0x47dca6[_0x98d9('0x37')],function(_0x360776){var _0x4f313b={};_0x4f313b[_0x360776]={'$like':'%'+_0x451ed7[_0x98d9('0x33')][_0x98d9('0x41')]+'%'};return _0x4f313b;})});}_0x47dca6=_['merge']({},_0x47dca6,_0x451ed7['options']);return db['CmHopperFinal'][_0x98d9('0x22')]({'where':_0x47dca6[_0x98d9('0x40')]})[_0x98d9('0x2a')](function(_0x1dfd09){_0x80445d[_0x98d9('0x22')]=_0x1dfd09;if(_0x451ed7[_0x98d9('0x33')][_0x98d9('0x47')]){_0x47dca6[_0x98d9('0x43')]=[{'all':!![]}];}return db[_0x98d9('0x67')][_0x98d9('0x4a')](_0x47dca6);})[_0x98d9('0x2a')](function(_0x53e6b7){_0x80445d[_0x98d9('0x4b')]=_0x53e6b7;return _0x80445d;});}})[_0x98d9('0x2a')](respondWithFilteredResult(_0x312a0a,_0x47dca6))[_0x98d9('0x4e')](handleError(_0x312a0a,null));};exports[_0x98d9('0x91')]=function(_0x46093e,_0x30d9ce,_0x23e382){var _0x3ea19f={'raw':!![],'where':{}};var _0xb3a7de={};var _0x55a268={'count':0x0,'rows':[]};return db[_0x98d9('0x30')][_0x98d9('0x89')]({'where':{'id':_0x46093e[_0x98d9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x30d9ce,null))[_0x98d9('0x2a')](function(_0x13cd97){if(_0x13cd97){_0xb3a7de[_0x98d9('0x31')]=_['keys'](db['JscriptySessionReport']['rawAttributes']);_0xb3a7de['query']=_[_0x98d9('0x73')](_0x46093e[_0x98d9('0x33')]);_0xb3a7de[_0x98d9('0x3b')]=_['intersection'](_0xb3a7de['model'],_0xb3a7de[_0x98d9('0x33')]);_0x3ea19f[_0x98d9('0x37')]=_['intersection'](_0xb3a7de['model'],qs[_0x98d9('0x36')](_0x46093e[_0x98d9('0x33')]['fields']));_0x3ea19f[_0x98d9('0x37')]=_0x3ea19f[_0x98d9('0x37')][_0x98d9('0x52')]?_0x3ea19f['attributes']:_0xb3a7de['model'];if(!_0x46093e['query']['hasOwnProperty']('nolimit')){_0x3ea19f[_0x98d9('0x24')]=qs[_0x98d9('0x24')](_0x46093e[_0x98d9('0x33')][_0x98d9('0x24')]);_0x3ea19f['offset']=qs[_0x98d9('0x23')](_0x46093e[_0x98d9('0x33')][_0x98d9('0x23')]);}_0x3ea19f['order']=qs[_0x98d9('0x3a')](_0x46093e[_0x98d9('0x33')][_0x98d9('0x3a')]);_0x3ea19f['where']=qs[_0x98d9('0x3b')](_[_0x98d9('0x3c')](_0x46093e[_0x98d9('0x33')],_0xb3a7de[_0x98d9('0x3b')]));_0x3ea19f['where'][_0x98d9('0x8f')]=_0x13cd97['id'];if(_0x46093e[_0x98d9('0x33')][_0x98d9('0x41')]){_0x3ea19f[_0x98d9('0x40')]=_[_0x98d9('0x3f')](_0x3ea19f[_0x98d9('0x40')],{'$or':_[_0x98d9('0x7c')](_0x3ea19f[_0x98d9('0x37')],function(_0x2b8775){var _0x41042a={};_0x41042a[_0x2b8775]={'$like':'%'+_0x46093e[_0x98d9('0x33')][_0x98d9('0x41')]+'%'};return _0x41042a;})});}_0x3ea19f=_['merge']({},_0x3ea19f,_0x46093e[_0x98d9('0x42')]);return db['JscriptySessionReport'][_0x98d9('0x22')]({'where':_0x3ea19f[_0x98d9('0x40')]})[_0x98d9('0x2a')](function(_0x36496e){_0x55a268[_0x98d9('0x22')]=_0x36496e;if(_0x46093e[_0x98d9('0x33')][_0x98d9('0x47')]){_0x3ea19f['include']=[{'all':!![]}];}return db[_0x98d9('0x70')][_0x98d9('0x4a')](_0x3ea19f);})['then'](function(_0x103e82){_0x55a268['rows']=_0x103e82;return _0x55a268;});}})['then'](respondWithFilteredResult(_0x30d9ce,_0x3ea19f))[_0x98d9('0x4e')](handleError(_0x30d9ce,null));};exports[_0x98d9('0x92')]=function(_0x2000d9,_0x2f895c,_0x23fad7){try{if(!_0x2000d9[_0x98d9('0x4f')][_0x98d9('0x76')]){throw new Error('No\x20ListId\x20specified');}if(!_0x2000d9[_0x98d9('0x4f')]['binding_keys']){throw new Error(_0x98d9('0x93'));}if(!_0x2000d9[_0x98d9('0x4f')][_0x98d9('0x94')]){throw new Error(_0x98d9('0x95'));}if(!_0x2000d9[_0x98d9('0x4f')]['socket_timestamp']){throw new Error(_0x98d9('0x96'));}var _0x4f276c=_0x2000d9[_0x98d9('0x4f')][_0x98d9('0x97')][_0x98d9('0x98')](',');var _0x2630d3=_0x2000d9[_0x98d9('0x4f')][_0x98d9('0x94')][_0x98d9('0x98')](',');if(!_0x4f276c['length']||!_0x2630d3[_0x98d9('0x52')]||_0x4f276c[_0x98d9('0x52')]!==_0x2630d3[_0x98d9('0x52')]){throw new Error(_0x98d9('0x99'));}_0x2000d9['body'][_0x98d9('0x36')]=_[_0x98d9('0x9a')](_0x4f276c,_0x2630d3);if(!_0x2000d9[_0x98d9('0x4f')][_0x98d9('0x36')][_0x98d9('0x87')]){throw new Error(_0x98d9('0x9b'));}if(!_0x2000d9['body'][_0x98d9('0x36')][_0x98d9('0x9c')]){throw new Error(_0x98d9('0x9d'));}var _0x954a4b=path[_0x98d9('0x71')](config[_0x98d9('0x9e')],_0x98d9('0x9f'),_0x2000d9[_0x98d9('0xa0')][_0x98d9('0xa1')]);fs['chmodSync'](_0x954a4b,parseInt('0777',0x8));var _0x6283d3=require(_0x98d9('0xa2'))[_0x98d9('0xa3')](path[_0x98d9('0x71')](__dirname,_0x98d9('0xa4')),[_0x954a4b,_0x2000d9[_0x98d9('0x4f')][_0x98d9('0x97')],_0x2000d9[_0x98d9('0x4f')][_0x98d9('0x94')],_0x2000d9['body'][_0x98d9('0x76')],_0x2000d9[_0x98d9('0x4f')]['CompanyId'],_0x2000d9[_0x98d9('0x4f')]['duplicates'],_0x2000d9['body'][_0x98d9('0xa5')]]);return _0x2f895c[_0x98d9('0x1f')](0xc8)[_0x98d9('0x21')]({'message':_0x98d9('0xa6'),'pid':_0x6283d3[_0x98d9('0xa7')]});}catch(_0x2d6fbe){return _0x2f895c['status'](0x1f4)[_0x98d9('0x2e')](_0x2d6fbe);}};exports['upload']=function(_0x558041,_0x59a50a,_0x26cea7){var _0x48d12c=fs[_0x98d9('0xa8')](_0x558041[_0x98d9('0xa0')]['path']);Papa[_0x98d9('0xa9')](_0x48d12c,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0xba4150){return _0x59a50a[_0x98d9('0x1f')](0xc8)['json']({'file':_0x558041[_0x98d9('0xa0')],'fields':_0xba4150[_0x98d9('0xaa')]['fields']});}});};exports[_0x98d9('0xab')]=function(_0x5ed790,_0x5a8ea8,_0x45828e){return db[_0x98d9('0xac')][_0x98d9('0x4a')]({'raw':!![],'attributes':['id'],'where':{'role':_0x98d9('0xad')}})[_0x98d9('0x2a')](function(_0x791732){var _0x4de22c=![];if(!_0x5ed790[_0x98d9('0x4f')][_0x98d9('0x76')]){throw new Error('No\x20ListId\x20specified');}if(!_0x5ed790[_0x98d9('0x4f')][_0x98d9('0xae')][_0x98d9('0x87')]){throw new Error(_0x98d9('0x9b'));}if(!_0x5ed790['body']['binding'][_0x98d9('0x9c')]){throw new Error(_0x98d9('0x9d'));}if(!_0x5ed790[_0x98d9('0x4f')][_0x98d9('0xa5')]){throw new Error(_0x98d9('0x96'));}var _0x396b7a=require(_0x98d9('0xa2'))[_0x98d9('0xa3')](path[_0x98d9('0x71')](__dirname,_0x98d9('0xaf')),[_0x5ed790[_0x98d9('0x4c')]['id'],JSON[_0x98d9('0xb0')](_0x5ed790[_0x98d9('0x4f')]),JSON[_0x98d9('0xb0')](_0x791732)]);_0x396b7a['on'](_0x98d9('0xb1'),function(_0x6355b0){_0x4de22c=!![];return _0x5a8ea8[_0x98d9('0x1f')](0xc8)['json']({'message':_0x98d9('0xb2'),'pid':_0x396b7a[_0x98d9('0xa7')]});});_0x396b7a['on'](_0x98d9('0xb3'),function(_0x52fc48){if(_0x52fc48&&!_0x4de22c){return _0x5a8ea8['status'](0x1f4)[_0x98d9('0x21')]({'message':'error\x20child\x20process','pid':_0x396b7a[_0x98d9('0xa7')]});}});})[_0x98d9('0x4e')](handleError(_0x5a8ea8,null));}; \ No newline at end of file +var _0x231c=['No\x20association\x20keys\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_values','split','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','child_process','fork','../../components/import/cm/csv','File\x20uploaded\x20correctly!','pid','upload','parse','import','User','agent','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmContact.socket','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','CmContact','describe','keys','query','dateEnd','dateStart','intersection','model','attributes','fields','length','order','sort','where','filters','pick','add','day','merge','filter','map','options','include','push','Tag','Tags','tag','distinct','includeAll','color','findAll','rows','catch','find','params','body','from','get','mergeWith','isArray','tags','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','create','ChatInteraction','ChatMessage','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','join','each','duplicates','$or','ListId','findOrCreate','error','show','CmCustomField','omit','format','cf_%d','pickBy','cf_','table','cm_contacts','setFields','id\x20=\x20?','toParam','sequelize','text','values','phone','getTags','findOne','rawAttributes','hasOwnProperty','nolimit','ids','getHoppers','ContactId','getHopperHistories','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys'];(function(_0x2a7b8e,_0x50ffce){var _0x29b5c8=function(_0x131fe0){while(--_0x131fe0){_0x2a7b8e['push'](_0x2a7b8e['shift']());}};_0x29b5c8(++_0x50ffce);}(_0x231c,0xca));var _0xc231=function(_0x4e1fdf,_0x1006cd){_0x4e1fdf=_0x4e1fdf-0x0;var _0x1373c9=_0x231c[_0x4e1fdf];return _0x1373c9;};'use strict';var pdf=require(_0xc231('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc231('0x1'));var zipdir=require(_0xc231('0x2'));var jsonpatch=require(_0xc231('0x3'));var rp=require(_0xc231('0x4'));var moment=require('moment');var BPromise=require(_0xc231('0x5'));var Mustache=require('mustache');var util=require(_0xc231('0x6'));var path=require(_0xc231('0x7'));var sox=require(_0xc231('0x8'));var csv=require(_0xc231('0x9'));var ejs=require(_0xc231('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc231('0xb'));var jsforce=require(_0xc231('0xc'));var deskjs=require(_0xc231('0xd'));var toCsv=require(_0xc231('0x9'));var querystring=require(_0xc231('0xe'));var Papa=require(_0xc231('0xf'));var Redis=require(_0xc231('0x10'));var qs=require(_0xc231('0x11'));var logger=require(_0xc231('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xc231('0x13'));var db=require(_0xc231('0x14'))['db'];config['redis']=_[_0xc231('0x15')](config[_0xc231('0x16')],{'host':_0xc231('0x17'),'port':0x18eb});var socket=require(_0xc231('0x18'))(new Redis(config[_0xc231('0x16')]));require(_0xc231('0x19'))['register'](socket);function respondWithStatusCode(_0x2e447e,_0xc0a8){_0xc0a8=_0xc0a8||0xcc;return function(_0x628a12){if(_0x628a12){return _0x2e447e['sendStatus'](_0xc0a8);}return _0x2e447e[_0xc231('0x1a')](_0xc0a8)[_0xc231('0x1b')]();};}function respondWithResult(_0x3cf59a,_0x363d57){_0x363d57=_0x363d57||0xc8;return function(_0x1e4bc1){if(_0x1e4bc1){return _0x3cf59a[_0xc231('0x1a')](_0x363d57)[_0xc231('0x1c')](_0x1e4bc1);}};}function respondWithFilteredResult(_0x2e2ffb,_0x4c250b){return function(_0x412126){if(_0x412126){var _0x22d665=_0x412126[_0xc231('0x1d')],_0x35f709=_0x4c250b[_0xc231('0x1e')],_0x5855af=_0x4c250b[_0xc231('0x1e')]+_0x4c250b[_0xc231('0x1f')],_0x5d5ebc;if(_0x5855af>=_0x22d665){_0x5855af=_0x22d665;_0x5d5ebc=0xc8;}else{_0x5d5ebc=0xce;}_0x2e2ffb['status'](_0x5d5ebc);return _0x2e2ffb[_0xc231('0x20')](_0xc231('0x21'),_0x35f709+'-'+_0x5855af+'/'+_0x22d665)[_0xc231('0x1c')](_0x412126);}return null;};}function patchUpdates(_0x531fb0){return function(_0x1b1b80){try{jsonpatch[_0xc231('0x22')](_0x1b1b80,_0x531fb0,!![]);}catch(_0x10c6c9){return BPromise[_0xc231('0x23')](_0x10c6c9);}return _0x1b1b80[_0xc231('0x24')]();};}function saveUpdates(_0x5c5d9d,_0x34e5ed){return function(_0x2ae232){if(_0x2ae232){return _0x2ae232[_0xc231('0x25')](_0x5c5d9d)[_0xc231('0x26')](function(_0x1142ad){return _0x1142ad;});}return null;};}function removeEntity(_0x21e496,_0x33dd85){return function(_0x7954eb){if(_0x7954eb){return _0x7954eb[_0xc231('0x27')]()['then'](function(){_0x21e496['status'](0xcc)[_0xc231('0x1b')]();});}};}function handleEntityNotFound(_0x255220,_0x426e99){return function(_0x3d6328){if(!_0x3d6328){_0x255220['sendStatus'](0x194);}return _0x3d6328;};}function handleError(_0x4ab310,_0x217a0c){_0x217a0c=_0x217a0c||0x1f4;return function(_0x8a8495){logger['error'](_0x8a8495[_0xc231('0x28')]);if(_0x8a8495[_0xc231('0x29')]){delete _0x8a8495[_0xc231('0x29')];}_0x4ab310[_0xc231('0x1a')](_0x217a0c)[_0xc231('0x2a')](_0x8a8495);};}exports[_0xc231('0x2b')]=function(_0x2a160f,_0x585719){var _0x379bfd={},_0x50168e={},_0x326b39={'count':0x0,'rows':[]};return db[_0xc231('0x2c')][_0xc231('0x2d')]()['then'](function(_0x72d1bd){_0x50168e['model']=_[_0xc231('0x2e')](_0x72d1bd);var _0x1489bf={'dateStart':_0x2a160f[_0xc231('0x2f')]['dateStart'],'dateEnd':_0x2a160f[_0xc231('0x2f')][_0xc231('0x30')]};delete _0x2a160f[_0xc231('0x2f')][_0xc231('0x31')];delete _0x2a160f['query'][_0xc231('0x30')];_0x50168e[_0xc231('0x2f')]=_[_0xc231('0x2e')](_0x2a160f['query']);_0x50168e['filters']=_[_0xc231('0x32')](_0x50168e[_0xc231('0x33')],_0x50168e[_0xc231('0x2f')]);_0x379bfd[_0xc231('0x34')]=_[_0xc231('0x32')](_0x50168e['model'],qs[_0xc231('0x35')](_0x2a160f[_0xc231('0x2f')][_0xc231('0x35')]));_0x379bfd[_0xc231('0x34')]=_0x379bfd[_0xc231('0x34')][_0xc231('0x36')]?_0x379bfd[_0xc231('0x34')]:_0x50168e[_0xc231('0x33')];if(!_0x2a160f[_0xc231('0x2f')]['hasOwnProperty']('nolimit')){_0x379bfd['limit']=qs[_0xc231('0x1f')](_0x2a160f['query'][_0xc231('0x1f')]);_0x379bfd[_0xc231('0x1e')]=qs[_0xc231('0x1e')](_0x2a160f[_0xc231('0x2f')][_0xc231('0x1e')]);}_0x379bfd[_0xc231('0x37')]=qs['sort'](_0x2a160f[_0xc231('0x2f')][_0xc231('0x38')]);_0x379bfd[_0xc231('0x39')]=qs[_0xc231('0x3a')](_[_0xc231('0x3b')](_0x2a160f[_0xc231('0x2f')],_0x50168e[_0xc231('0x3a')]));if(_0x1489bf[_0xc231('0x31')]){if(_0x1489bf[_0xc231('0x30')]){_0x1489bf['dateEnd']=moment(_0x1489bf[_0xc231('0x30')])[_0xc231('0x3c')](0x1,_0xc231('0x3d'));}else{_0x1489bf[_0xc231('0x30')]=moment(_0x1489bf[_0xc231('0x31')])['add'](0x1,_0xc231('0x3d'));}_[_0xc231('0x3e')](_0x379bfd[_0xc231('0x39')],{'createdAt':{'$gte':_0x1489bf[_0xc231('0x31')],'$lte':_0x1489bf[_0xc231('0x30')]}});}if(_0x2a160f[_0xc231('0x2f')][_0xc231('0x3f')]){_0x379bfd[_0xc231('0x39')]=_[_0xc231('0x3e')](_0x379bfd[_0xc231('0x39')],{'$or':_[_0xc231('0x40')](_0x379bfd['attributes'],function(_0x55c044){var _0x3db45a={};_0x3db45a[_0x55c044]={'$like':'%'+_0x2a160f[_0xc231('0x2f')][_0xc231('0x3f')]+'%'};return _0x3db45a;})});}_0x379bfd=_[_0xc231('0x3e')]({},_0x379bfd,_0x2a160f[_0xc231('0x41')]);var _0x5c17c4={'where':_0x379bfd[_0xc231('0x39')]};_0x5c17c4[_0xc231('0x42')]=[];if(_0x2a160f[_0xc231('0x2f')]['tag']){_0x5c17c4[_0xc231('0x42')][_0xc231('0x43')]({'model':db[_0xc231('0x44')],'as':_0xc231('0x45'),'attributes':['id'],'where':{'id':_0x2a160f['query'][_0xc231('0x46')]},'required':!![]});_0x5c17c4[_0xc231('0x47')]=!![];}return db['CmContact']['count'](_0x5c17c4)[_0xc231('0x26')](function(_0x4d2025){_0x326b39[_0xc231('0x1d')]=_0x4d2025;if(_0x2a160f[_0xc231('0x2f')][_0xc231('0x48')]){_0x379bfd['include']=[{'model':db[_0xc231('0x44')],'as':_0xc231('0x45'),'attributes':['id',_0xc231('0x29'),_0xc231('0x49')],'required':_0x2a160f[_0xc231('0x2f')][_0xc231('0x46')]?!![]:![]},{'model':db['Tag'],'as':'ThroughTags','attributes':['id',_0xc231('0x29'),'color'],'through':_0x2a160f[_0xc231('0x2f')]['tag']?{'attributes':[],'where':{'TagId':_0x2a160f['query'][_0xc231('0x46')]||undefined}}:{},'required':_0x2a160f[_0xc231('0x2f')][_0xc231('0x46')]?!![]:![]}];}return db[_0xc231('0x2c')][_0xc231('0x4a')](_0x379bfd);})[_0xc231('0x26')](function(_0x280024){_0x326b39[_0xc231('0x4b')]=_0x280024;return _0x326b39;})[_0xc231('0x26')](respondWithFilteredResult(_0x585719,_0x379bfd))[_0xc231('0x4c')](handleError(_0x585719,null));});};exports[_0xc231('0x27')]=function(_0x23ee82,_0x489f38){return db[_0xc231('0x2c')][_0xc231('0x4d')]({'where':{'id':_0x23ee82[_0xc231('0x4e')]['id']}})[_0xc231('0x26')](handleEntityNotFound(_0x489f38,null))[_0xc231('0x26')](removeEntity(_0x489f38,null))[_0xc231('0x4c')](handleError(_0x489f38,null));};exports[_0xc231('0x2d')]=function(_0x4d1921,_0x1bd081){return db[_0xc231('0x2c')][_0xc231('0x2d')]()[_0xc231('0x26')](respondWithResult(_0x1bd081,null))['catch'](handleError(_0x1bd081,null));};exports['merge']=function(_0x43716c,_0x2d4cea){var _0x33f39a;var _0x57c407;var _0x1e1adf;if(_0x43716c[_0xc231('0x4f')]['id']){delete _0x43716c[_0xc231('0x4f')]['id'];}return db[_0xc231('0x2c')]['findAll']({'where':{'id':[_0x43716c['body']['to'],_0x43716c[_0xc231('0x4f')][_0xc231('0x50')]]}})[_0xc231('0x26')](function(_0x264ba2){if(_0x264ba2){if(_0x264ba2[_0xc231('0x36')]!==0x2){return null;}_0x264ba2[0x0]=_0x264ba2[0x0]['get']({'plain':!![]});_0x264ba2[0x1]=_0x264ba2[0x1][_0xc231('0x51')]({'plain':!![]});delete _0x264ba2[0x0]['id'];delete _0x264ba2[0x1]['id'];return _[_0xc231('0x52')](_0x264ba2[0x0],_0x264ba2[0x1],function(_0x393954,_0x202a6b){if(Array[_0xc231('0x53')](_0x202a6b)&&!_0x202a6b['length']){return _0x393954;}else if(!_0x202a6b){return _0x393954;}});}})[_0xc231('0x26')](handleEntityNotFound(_0x2d4cea,null))[_0xc231('0x26')](function(_0x555bc1){if(_0x555bc1){if(_0x555bc1['tags']&&_[_0xc231('0x53')](_0x555bc1[_0xc231('0x54')])){_0x555bc1['tags']=_0x555bc1[_0xc231('0x54')]['join']();}logger[_0xc231('0x55')](_0xc231('0x56'),_0x43716c[_0xc231('0x4f')]['to'],_0x43716c[_0xc231('0x4f')][_0xc231('0x50')]);return db[_0xc231('0x57')][_0xc231('0x27')]({'where':{'ContactId':[_0x43716c[_0xc231('0x4f')]['to'],_0x43716c[_0xc231('0x4f')][_0xc231('0x50')]]}})['then'](function(_0x20d4ab){logger['info']('[CmContact][merge][destroy][CmHopper],\x20%s',_0x20d4ab);return db[_0xc231('0x58')][_0xc231('0x27')]({'where':{'ContactId':[_0x43716c[_0xc231('0x4f')]['to'],_0x43716c['body'][_0xc231('0x50')]]}})[_0xc231('0x26')](function(_0x37e88b){logger[_0xc231('0x55')]('[CmContact][merge][destroy][CmHopperBlack],\x20%s',_0x37e88b);return db['CmContact'][_0xc231('0x59')](_0x555bc1);});});}})[_0xc231('0x26')](function(_0x5baa8e){if(_0x5baa8e){_0x33f39a=_0x5baa8e;_0x57c407={'ContactId':_0x33f39a['id']};_0x1e1adf={'where':{'ContactId':[_0x43716c[_0xc231('0x4f')]['to'],_0x43716c[_0xc231('0x4f')][_0xc231('0x50')]]}};return db[_0xc231('0x5a')][_0xc231('0x25')](_0x57c407,_0x1e1adf);}})[_0xc231('0x26')](function(){if(_0x33f39a){return db[_0xc231('0x5b')][_0xc231('0x25')](_0x57c407,_0x1e1adf);}})[_0xc231('0x26')](function(){if(_0x33f39a){return db['ChatOfflineMessage'][_0xc231('0x25')](_0x57c407,_0x1e1adf);}})['then'](function(){if(_0x33f39a){return db['MailInteraction'][_0xc231('0x25')](_0x57c407,_0x1e1adf);}})[_0xc231('0x26')](function(){if(_0x33f39a){return db['MailMessage'][_0xc231('0x25')](_0x57c407,_0x1e1adf);}})[_0xc231('0x26')](function(){if(_0x33f39a){return db['MailInteraction'][_0xc231('0x25')](_0x57c407,_0x1e1adf);}})[_0xc231('0x26')](function(){if(_0x33f39a){return db[_0xc231('0x5c')]['update'](_0x57c407,_0x1e1adf);}})['then'](function(){if(_0x33f39a){return db[_0xc231('0x5d')][_0xc231('0x25')](_0x57c407,_0x1e1adf);}})[_0xc231('0x26')](function(){if(_0x33f39a){return db[_0xc231('0x5e')][_0xc231('0x25')](_0x57c407,_0x1e1adf);}})[_0xc231('0x26')](function(){if(_0x33f39a){return db[_0xc231('0x5f')][_0xc231('0x25')](_0x57c407,_0x1e1adf);}})[_0xc231('0x26')](function(){if(_0x33f39a){return db['FaxMessage']['update'](_0x57c407,_0x1e1adf);}})[_0xc231('0x26')](function(){if(_0x33f39a){return db[_0xc231('0x60')][_0xc231('0x25')](_0x57c407,_0x1e1adf);}})[_0xc231('0x26')](function(){if(_0x33f39a){return db[_0xc231('0x61')][_0xc231('0x25')](_0x57c407,_0x1e1adf);}})['then'](function(){if(_0x33f39a){return db[_0xc231('0x62')][_0xc231('0x25')](_0x57c407,_0x1e1adf);}})[_0xc231('0x26')](function(){if(_0x33f39a){return db[_0xc231('0x63')][_0xc231('0x25')](_0x57c407,_0x1e1adf);}})[_0xc231('0x26')](function(){if(_0x33f39a){return db[_0xc231('0x64')]['update'](_0x57c407,_0x1e1adf);}})[_0xc231('0x26')](function(){if(_0x33f39a){return db[_0xc231('0x65')][_0xc231('0x25')](_0x57c407,_0x1e1adf);}})[_0xc231('0x26')](function(){if(_0x33f39a){return db[_0xc231('0x66')][_0xc231('0x25')](_0x57c407,_0x1e1adf);}})[_0xc231('0x26')](function(){if(_0x33f39a){return db[_0xc231('0x67')][_0xc231('0x25')](_0x57c407,_0x1e1adf);}})[_0xc231('0x26')](function(){if(_0x33f39a){return db[_0xc231('0x68')][_0xc231('0x25')](_0x57c407,_0x1e1adf);}})[_0xc231('0x26')](function(){if(_0x33f39a){return db[_0xc231('0x69')]['update'](_0x57c407,_0x1e1adf);}})[_0xc231('0x26')](function(){if(_0x33f39a){return db[_0xc231('0x6a')]['update'](_0x57c407,_0x1e1adf);}})[_0xc231('0x26')](function(){if(_0x33f39a){return db['JscriptySessionReport'][_0xc231('0x25')](_0x57c407,_0x1e1adf);}})['then'](function(){if(_0x33f39a){return db[_0xc231('0x2c')][_0xc231('0x27')]({'where':{'id':[_0x43716c['body']['to'],_0x43716c[_0xc231('0x4f')][_0xc231('0x50')]]}});}})[_0xc231('0x26')](function(){if(_0x33f39a){return _0x33f39a;}})[_0xc231('0x26')](respondWithResult(_0x2d4cea,null))[_0xc231('0x4c')](handleError(_0x2d4cea,null));};exports[_0xc231('0x59')]=function(_0x1450af,_0x1e0258){return db[_0xc231('0x2c')]['describe']()['then'](function(_0x23d058){if(_0x1450af[_0xc231('0x4f')][_0xc231('0x54')]&&_[_0xc231('0x53')](_0x1450af[_0xc231('0x4f')][_0xc231('0x54')])){if(_0x1450af[_0xc231('0x4f')]['tags'][_0xc231('0x36')]){_0x1450af[_0xc231('0x4f')][_0xc231('0x54')]=_0x1450af['body'][_0xc231('0x54')][_0xc231('0x6b')](';')+';';}else{_0x1450af[_0xc231('0x4f')][_0xc231('0x54')]=null;}}else{_0x1450af[_0xc231('0x4f')]['tags']=null;}return db['CmContact']['create'](_0x1450af[_0xc231('0x4f')],{'fields':_[_0xc231('0x2e')](_0x23d058),'raw':!![]});})[_0xc231('0x26')](respondWithResult(_0x1e0258,0xc9))['catch'](handleError(_0x1e0258,null));};exports['bulkCreate']=function(_0x556886,_0x910186){var _0x3a7420=[];var _0x90ef76=0x0;var _0x230b69=0x0;var _0x33b9bd=0x0;return db[_0xc231('0x2c')][_0xc231('0x2d')]()[_0xc231('0x26')](function(_0x946ef7){return BPromise[_0xc231('0x6c')](_0x556886[_0xc231('0x4f')],function(_0x171abf){var _0x43de99={'where':{'$or':[]},'defaults':_0x171abf,'fields':_['keys'](_0x946ef7),'raw':!![]};if(_0x171abf[_0xc231('0x6d')]){for(var _0x528c3b=0x0;_0x528c3b<_0x171abf[_0xc231('0x6d')][_0xc231('0x36')];_0x528c3b++){var _0x1697df={};_0x1697df[_0x171abf[_0xc231('0x6d')][_0x528c3b]]=_0x171abf[_0x171abf[_0xc231('0x6d')][_0x528c3b]];_0x43de99[_0xc231('0x39')][_0xc231('0x6e')][_0xc231('0x43')](_0x1697df);}_0x43de99['where'][_0xc231('0x6f')]=_0x171abf[_0xc231('0x6f')];}return db[_0xc231('0x2c')][_0xc231('0x70')](_0x43de99)['spread'](function(_0xab1b67,_0x42c02e){if(_0x42c02e){_0x90ef76++;}else{_0x33b9bd++;}})[_0xc231('0x4c')](function(_0x9e252){console[_0xc231('0x71')](_0x9e252);_0x230b69++;});});})['then'](function(_0x141b4f){if(_0x141b4f){return{'success':_0x90ef76,'failure':_0x230b69,'duplicates':_0x33b9bd};}})[_0xc231('0x26')](respondWithResult(_0x910186,0xc9))[_0xc231('0x4c')](handleError(_0x910186,null));};exports[_0xc231('0x72')]=function(_0x5090ad,_0x1873cf,_0x553077){var _0x42c6c2;return db[_0xc231('0x2c')][_0xc231('0x2d')]()[_0xc231('0x26')](function(_0x559189){return db[_0xc231('0x2c')][_0xc231('0x4d')]({'where':{'id':_0x5090ad[_0xc231('0x4e')]['id']},'include':[{'model':db['Tag'],'as':_0xc231('0x45'),'attributes':['id',_0xc231('0x29'),'color'],'required':_0x5090ad[_0xc231('0x2f')][_0xc231('0x46')]?!![]:![]}],'attributes':_['keys'](_0x559189)});})[_0xc231('0x26')](function(_0x3e6b8f){_0x42c6c2=_0x3e6b8f[_0xc231('0x51')]({'plain':!![]});var _0x2fd328={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3e6b8f&&_0x3e6b8f[_0xc231('0x6f')]){if(_0x3e6b8f[_0xc231('0x6f')]){_0x2fd328[_0xc231('0x39')]['$and'][_0xc231('0x43')]({'ListId':{'$ne':_0x3e6b8f['ListId']}});}}return db[_0xc231('0x73')][_0xc231('0x4a')](_0x2fd328);})[_0xc231('0x26')](function(_0x11bdb7){return _[_0xc231('0x74')](_0x42c6c2,_['map'](_0x11bdb7,function(_0x35a049){return util[_0xc231('0x75')](_0xc231('0x76'),_0x35a049['id']);}));})['then'](handleEntityNotFound(_0x1873cf,null))[_0xc231('0x26')](respondWithResult(_0x1873cf,null))['catch'](handleError(_0x1873cf,null));};exports[_0xc231('0x25')]=function(_0x3d8fbc,_0x2065b4){var _0x5a9298;if(_0x3d8fbc[_0xc231('0x4f')]['id']){delete _0x3d8fbc[_0xc231('0x4f')]['id'];}return db['CmContact']['find']({'where':{'id':_0x3d8fbc['params']['id']}})['then'](handleEntityNotFound(_0x2065b4,null))[_0xc231('0x26')](saveUpdates(_0x3d8fbc['body'],null))[_0xc231('0x26')](function(_0x543424){_0x5a9298=_0x543424;var _0x2417b7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x543424&&_0x543424[_0xc231('0x6f')]){if(_0x543424[_0xc231('0x6f')]){_0x2417b7[_0xc231('0x39')]['$and']['push']({'ListId':{'$ne':_0x543424[_0xc231('0x6f')]}});}}return db[_0xc231('0x73')][_0xc231('0x4a')](_0x2417b7);})[_0xc231('0x26')](function(_0x5cd6bc){if(_0x5cd6bc){return _[_0xc231('0x74')](_[_0xc231('0x77')](_0x3d8fbc[_0xc231('0x4f')],function(_0x3bfb72,_0x305dde){return _['startsWith'](_0x305dde,_0xc231('0x78'));}),_[_0xc231('0x40')](_0x5cd6bc,function(_0x5610bf){return util['format'](_0xc231('0x76'),_0x5610bf['id']);}));}})[_0xc231('0x26')](function(_0xc9154a){if(_0xc9154a&&!_['isEmpty'](_0xc9154a)){var _0x546184=squel['update']()[_0xc231('0x79')](_0xc231('0x7a'))[_0xc231('0x7b')](_0xc9154a)['where'](_0xc231('0x7c'),_0x3d8fbc[_0xc231('0x4e')]['id'])[_0xc231('0x7d')]();return db[_0xc231('0x7e')][_0xc231('0x2f')](_0x546184[_0xc231('0x7f')],{'replacements':_0x546184[_0xc231('0x80')]});}})[_0xc231('0x26')](function(){if(_0x3d8fbc[_0xc231('0x4f')][_0xc231('0x81')]&&_0x5a9298){return db[_0xc231('0x57')][_0xc231('0x25')]({'phone':_0x3d8fbc[_0xc231('0x4f')][_0xc231('0x81')]},{'where':{'ContactId':_0x5a9298['id']}});}})[_0xc231('0x26')](function(){return _0x5a9298;})[_0xc231('0x26')](respondWithResult(_0x2065b4,null))[_0xc231('0x4c')](handleError(_0x2065b4,null));};exports[_0xc231('0x82')]=function(_0x33eaff,_0x41dbc0,_0x53b86a){var _0x20beed={};var _0x188d80={};var _0x39c325;var _0x326430;return db[_0xc231('0x2c')][_0xc231('0x83')]({'where':{'id':_0x33eaff[_0xc231('0x4e')]['id']}})[_0xc231('0x26')](handleEntityNotFound(_0x41dbc0,null))['then'](function(_0x4b494e){if(_0x4b494e){_0x39c325=_0x4b494e;_0x188d80[_0xc231('0x33')]=_[_0xc231('0x2e')](db['Tag'][_0xc231('0x84')]);_0x188d80[_0xc231('0x2f')]=_['keys'](_0x33eaff[_0xc231('0x2f')]);_0x188d80['filters']=_[_0xc231('0x32')](_0x188d80[_0xc231('0x33')],_0x188d80[_0xc231('0x2f')]);_0x20beed[_0xc231('0x34')]=_['intersection'](_0x188d80['model'],qs[_0xc231('0x35')](_0x33eaff['query'][_0xc231('0x35')]));_0x20beed[_0xc231('0x34')]=_0x20beed[_0xc231('0x34')][_0xc231('0x36')]?_0x20beed[_0xc231('0x34')]:_0x188d80[_0xc231('0x33')];_0x20beed[_0xc231('0x37')]=qs['sort'](_0x33eaff['query']['sort']);_0x20beed['where']=qs[_0xc231('0x3a')](_[_0xc231('0x3b')](_0x33eaff[_0xc231('0x2f')],_0x188d80[_0xc231('0x3a')]));if(_0x33eaff[_0xc231('0x2f')][_0xc231('0x3f')]){_0x20beed['where']=_[_0xc231('0x3e')](_0x20beed['where'],{'$or':_[_0xc231('0x40')](_0x20beed['attributes'],function(_0x3eec8c){var _0x1582e3={};_0x1582e3[_0x3eec8c]={'$like':'%'+_0x33eaff[_0xc231('0x2f')][_0xc231('0x3f')]+'%'};return _0x1582e3;})});}_0x20beed=_[_0xc231('0x3e')]({},_0x20beed,_0x33eaff['options']);return _0x39c325[_0xc231('0x82')](_0x20beed);}})['then'](function(_0x1f4133){if(_0x1f4133){_0x326430=_0x1f4133[_0xc231('0x36')];if(!_0x33eaff[_0xc231('0x2f')][_0xc231('0x85')](_0xc231('0x86'))){_0x20beed[_0xc231('0x1f')]=qs[_0xc231('0x1f')](_0x33eaff['query'][_0xc231('0x1f')]);_0x20beed[_0xc231('0x1e')]=qs[_0xc231('0x1e')](_0x33eaff['query'][_0xc231('0x1e')]);}return _0x39c325[_0xc231('0x82')](_0x20beed);}})[_0xc231('0x26')](function(_0x4a1c7e){if(_0x4a1c7e){return _0x4a1c7e?{'count':_0x326430,'rows':_0x4a1c7e}:null;}})[_0xc231('0x26')](respondWithResult(_0x41dbc0,null))[_0xc231('0x4c')](handleError(_0x41dbc0,null));};exports['setTags']=function(_0xd8d74a,_0x8adabd,_0x19fc9e){if(_0xd8d74a[_0xc231('0x4f')]['id']){delete _0xd8d74a['body']['id'];}return db['CmContact'][_0xc231('0x83')]({'where':{'id':_0xd8d74a['params']['id']}})[_0xc231('0x26')](handleEntityNotFound(_0x8adabd,null))['then'](function(_0x18137a){if(_0x18137a){return _0x18137a['setTags'](_0xd8d74a['body'][_0xc231('0x87')]||[]);}return null;})[_0xc231('0x26')](respondWithResult(_0x8adabd,null))['catch'](handleError(_0x8adabd,null));};exports[_0xc231('0x88')]=function(_0xda73cf,_0x214c20,_0x48e5b6){var _0x495b7a={'raw':![],'where':{}};var _0x13504d={};var _0x4602de={'count':0x0,'rows':[]};return db[_0xc231('0x2c')][_0xc231('0x83')]({'where':{'id':_0xda73cf['params']['id']}})[_0xc231('0x26')](handleEntityNotFound(_0x214c20,null))[_0xc231('0x26')](function(_0x44493b){if(_0x44493b){_0x13504d[_0xc231('0x33')]=_[_0xc231('0x2e')](db[_0xc231('0x57')][_0xc231('0x84')]);_0x13504d['query']=_[_0xc231('0x2e')](_0xda73cf[_0xc231('0x2f')]);_0x13504d['filters']=_[_0xc231('0x32')](_0x13504d[_0xc231('0x33')],_0x13504d[_0xc231('0x2f')]);_0x495b7a[_0xc231('0x34')]=_[_0xc231('0x32')](_0x13504d['model'],qs[_0xc231('0x35')](_0xda73cf[_0xc231('0x2f')]['fields']));_0x495b7a[_0xc231('0x34')]=_0x495b7a[_0xc231('0x34')][_0xc231('0x36')]?_0x495b7a[_0xc231('0x34')]:_0x13504d[_0xc231('0x33')];if(!_0xda73cf['query'][_0xc231('0x85')](_0xc231('0x86'))){_0x495b7a[_0xc231('0x1f')]=qs['limit'](_0xda73cf[_0xc231('0x2f')][_0xc231('0x1f')]);_0x495b7a[_0xc231('0x1e')]=qs[_0xc231('0x1e')](_0xda73cf[_0xc231('0x2f')][_0xc231('0x1e')]);}_0x495b7a['order']=qs[_0xc231('0x38')](_0xda73cf[_0xc231('0x2f')][_0xc231('0x38')]);_0x495b7a['where']=qs[_0xc231('0x3a')](_[_0xc231('0x3b')](_0xda73cf[_0xc231('0x2f')],_0x13504d[_0xc231('0x3a')]));_0x495b7a[_0xc231('0x39')][_0xc231('0x89')]=_0x44493b['id'];if(_0xda73cf['query'][_0xc231('0x3f')]){_0x495b7a[_0xc231('0x39')]=_[_0xc231('0x3e')](_0x495b7a['where'],{'$or':_[_0xc231('0x40')](_0x495b7a[_0xc231('0x34')],function(_0x58dd2f){var _0x5376ef={};_0x5376ef[_0x58dd2f]={'$like':'%'+_0xda73cf[_0xc231('0x2f')][_0xc231('0x3f')]+'%'};return _0x5376ef;})});}_0x495b7a=_[_0xc231('0x3e')]({},_0x495b7a,_0xda73cf[_0xc231('0x41')]);return db[_0xc231('0x57')][_0xc231('0x1d')]({'where':_0x495b7a[_0xc231('0x39')]})[_0xc231('0x26')](function(_0x816b2e){_0x4602de[_0xc231('0x1d')]=_0x816b2e;if(_0xda73cf[_0xc231('0x2f')][_0xc231('0x48')]){_0x495b7a['include']=[{'all':!![]}];}return db[_0xc231('0x57')]['findAll'](_0x495b7a);})['then'](function(_0x550897){_0x4602de['rows']=_0x550897;return _0x4602de;});}})['then'](respondWithFilteredResult(_0x214c20,_0x495b7a))[_0xc231('0x4c')](handleError(_0x214c20,null));};exports[_0xc231('0x8a')]=function(_0x3d68ef,_0x26cb86,_0xe6f0e0){var _0x5a4eb7={'raw':!![],'where':{}};var _0x170281={};var _0x44fe21={'count':0x0,'rows':[]};return db[_0xc231('0x2c')][_0xc231('0x83')]({'where':{'id':_0x3d68ef['params']['id']}})['then'](handleEntityNotFound(_0x26cb86,null))[_0xc231('0x26')](function(_0x52da93){if(_0x52da93){_0x170281[_0xc231('0x33')]=_[_0xc231('0x2e')](db[_0xc231('0x63')][_0xc231('0x84')]);_0x170281[_0xc231('0x2f')]=_['keys'](_0x3d68ef[_0xc231('0x2f')]);_0x170281['filters']=_[_0xc231('0x32')](_0x170281[_0xc231('0x33')],_0x170281[_0xc231('0x2f')]);_0x5a4eb7[_0xc231('0x34')]=_[_0xc231('0x32')](_0x170281[_0xc231('0x33')],qs[_0xc231('0x35')](_0x3d68ef[_0xc231('0x2f')][_0xc231('0x35')]));_0x5a4eb7[_0xc231('0x34')]=_0x5a4eb7[_0xc231('0x34')][_0xc231('0x36')]?_0x5a4eb7['attributes']:_0x170281[_0xc231('0x33')];if(!_0x3d68ef[_0xc231('0x2f')]['hasOwnProperty'](_0xc231('0x86'))){_0x5a4eb7[_0xc231('0x1f')]=qs[_0xc231('0x1f')](_0x3d68ef[_0xc231('0x2f')]['limit']);_0x5a4eb7[_0xc231('0x1e')]=qs[_0xc231('0x1e')](_0x3d68ef[_0xc231('0x2f')]['offset']);}_0x5a4eb7[_0xc231('0x37')]=qs[_0xc231('0x38')](_0x3d68ef['query'][_0xc231('0x38')]);_0x5a4eb7['where']=qs[_0xc231('0x3a')](_[_0xc231('0x3b')](_0x3d68ef['query'],_0x170281[_0xc231('0x3a')]));_0x5a4eb7['where'][_0xc231('0x89')]=_0x52da93['id'];if(_0x3d68ef['query'][_0xc231('0x3f')]){_0x5a4eb7[_0xc231('0x39')]=_[_0xc231('0x3e')](_0x5a4eb7[_0xc231('0x39')],{'$or':_['map'](_0x5a4eb7[_0xc231('0x34')],function(_0x5dc637){var _0x5385c5={};_0x5385c5[_0x5dc637]={'$like':'%'+_0x3d68ef[_0xc231('0x2f')][_0xc231('0x3f')]+'%'};return _0x5385c5;})});}_0x5a4eb7=_[_0xc231('0x3e')]({},_0x5a4eb7,_0x3d68ef['options']);return db[_0xc231('0x63')]['count']({'where':_0x5a4eb7[_0xc231('0x39')]})[_0xc231('0x26')](function(_0x7ee65){_0x44fe21['count']=_0x7ee65;if(_0x3d68ef[_0xc231('0x2f')][_0xc231('0x48')]){_0x5a4eb7[_0xc231('0x42')]=[{'all':!![]}];}return db[_0xc231('0x63')][_0xc231('0x4a')](_0x5a4eb7);})[_0xc231('0x26')](function(_0x4c6208){_0x44fe21['rows']=_0x4c6208;return _0x44fe21;});}})[_0xc231('0x26')](respondWithFilteredResult(_0x26cb86,_0x5a4eb7))[_0xc231('0x4c')](handleError(_0x26cb86,null));};exports['getHopperFinals']=function(_0x56944f,_0x34268b,_0x39b459){var _0xccaea0={'raw':!![],'where':{}};var _0x528857={};var _0x27f2c1={'count':0x0,'rows':[]};return db['CmContact'][_0xc231('0x83')]({'where':{'id':_0x56944f['params']['id']}})[_0xc231('0x26')](handleEntityNotFound(_0x34268b,null))[_0xc231('0x26')](function(_0x5c5273){if(_0x5c5273){_0x528857[_0xc231('0x33')]=_[_0xc231('0x2e')](db['CmHopperFinal'][_0xc231('0x84')]);_0x528857[_0xc231('0x2f')]=_[_0xc231('0x2e')](_0x56944f[_0xc231('0x2f')]);_0x528857[_0xc231('0x3a')]=_[_0xc231('0x32')](_0x528857['model'],_0x528857[_0xc231('0x2f')]);_0xccaea0[_0xc231('0x34')]=_[_0xc231('0x32')](_0x528857[_0xc231('0x33')],qs['fields'](_0x56944f[_0xc231('0x2f')]['fields']));_0xccaea0[_0xc231('0x34')]=_0xccaea0[_0xc231('0x34')][_0xc231('0x36')]?_0xccaea0[_0xc231('0x34')]:_0x528857[_0xc231('0x33')];if(!_0x56944f[_0xc231('0x2f')]['hasOwnProperty'](_0xc231('0x86'))){_0xccaea0[_0xc231('0x1f')]=qs[_0xc231('0x1f')](_0x56944f[_0xc231('0x2f')]['limit']);_0xccaea0[_0xc231('0x1e')]=qs[_0xc231('0x1e')](_0x56944f['query'][_0xc231('0x1e')]);}_0xccaea0[_0xc231('0x37')]=qs[_0xc231('0x38')](_0x56944f[_0xc231('0x2f')]['sort']);_0xccaea0[_0xc231('0x39')]=qs[_0xc231('0x3a')](_[_0xc231('0x3b')](_0x56944f['query'],_0x528857[_0xc231('0x3a')]));_0xccaea0['where'][_0xc231('0x89')]=_0x5c5273['id'];if(_0x56944f[_0xc231('0x2f')][_0xc231('0x3f')]){_0xccaea0['where']=_['merge'](_0xccaea0[_0xc231('0x39')],{'$or':_['map'](_0xccaea0[_0xc231('0x34')],function(_0x48473e){var _0x1700a4={};_0x1700a4[_0x48473e]={'$like':'%'+_0x56944f[_0xc231('0x2f')][_0xc231('0x3f')]+'%'};return _0x1700a4;})});}_0xccaea0=_[_0xc231('0x3e')]({},_0xccaea0,_0x56944f[_0xc231('0x41')]);return db[_0xc231('0x62')][_0xc231('0x1d')]({'where':_0xccaea0['where']})['then'](function(_0x378aba){_0x27f2c1[_0xc231('0x1d')]=_0x378aba;if(_0x56944f['query'][_0xc231('0x48')]){_0xccaea0[_0xc231('0x42')]=[{'all':!![]}];}return db[_0xc231('0x62')][_0xc231('0x4a')](_0xccaea0);})['then'](function(_0xfe1483){_0x27f2c1[_0xc231('0x4b')]=_0xfe1483;return _0x27f2c1;});}})['then'](respondWithFilteredResult(_0x34268b,_0xccaea0))[_0xc231('0x4c')](handleError(_0x34268b,null));};exports[_0xc231('0x8b')]=function(_0x2f5206,_0x40786d,_0x10f8a0){var _0x3de850={'raw':!![],'where':{}};var _0x20e154={};var _0x2e23a4={'count':0x0,'rows':[]};return db[_0xc231('0x2c')]['findOne']({'where':{'id':_0x2f5206[_0xc231('0x4e')]['id']}})[_0xc231('0x26')](handleEntityNotFound(_0x40786d,null))[_0xc231('0x26')](function(_0x515afa){if(_0x515afa){_0x20e154[_0xc231('0x33')]=_[_0xc231('0x2e')](db[_0xc231('0x8c')][_0xc231('0x84')]);_0x20e154[_0xc231('0x2f')]=_['keys'](_0x2f5206['query']);_0x20e154[_0xc231('0x3a')]=_[_0xc231('0x32')](_0x20e154[_0xc231('0x33')],_0x20e154[_0xc231('0x2f')]);_0x3de850['attributes']=_[_0xc231('0x32')](_0x20e154[_0xc231('0x33')],qs[_0xc231('0x35')](_0x2f5206[_0xc231('0x2f')][_0xc231('0x35')]));_0x3de850[_0xc231('0x34')]=_0x3de850[_0xc231('0x34')][_0xc231('0x36')]?_0x3de850['attributes']:_0x20e154[_0xc231('0x33')];if(!_0x2f5206[_0xc231('0x2f')]['hasOwnProperty'](_0xc231('0x86'))){_0x3de850[_0xc231('0x1f')]=qs[_0xc231('0x1f')](_0x2f5206[_0xc231('0x2f')]['limit']);_0x3de850['offset']=qs[_0xc231('0x1e')](_0x2f5206['query'][_0xc231('0x1e')]);}_0x3de850[_0xc231('0x37')]=qs[_0xc231('0x38')](_0x2f5206['query'][_0xc231('0x38')]);_0x3de850[_0xc231('0x39')]=qs[_0xc231('0x3a')](_[_0xc231('0x3b')](_0x2f5206[_0xc231('0x2f')],_0x20e154['filters']));_0x3de850[_0xc231('0x39')][_0xc231('0x89')]=_0x515afa['id'];if(_0x2f5206[_0xc231('0x2f')]['filter']){_0x3de850['where']=_[_0xc231('0x3e')](_0x3de850['where'],{'$or':_[_0xc231('0x40')](_0x3de850['attributes'],function(_0x1023f4){var _0x1dfeae={};_0x1dfeae[_0x1023f4]={'$like':'%'+_0x2f5206[_0xc231('0x2f')][_0xc231('0x3f')]+'%'};return _0x1dfeae;})});}_0x3de850=_[_0xc231('0x3e')]({},_0x3de850,_0x2f5206['options']);return db[_0xc231('0x8c')][_0xc231('0x1d')]({'where':_0x3de850[_0xc231('0x39')]})[_0xc231('0x26')](function(_0xdee0b5){_0x2e23a4[_0xc231('0x1d')]=_0xdee0b5;if(_0x2f5206['query'][_0xc231('0x48')]){_0x3de850[_0xc231('0x42')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xc231('0x4a')](_0x3de850);})['then'](function(_0x545bfd){_0x2e23a4['rows']=_0x545bfd;return _0x2e23a4;});}})[_0xc231('0x26')](respondWithFilteredResult(_0x40786d,_0x3de850))['catch'](handleError(_0x40786d,null));};exports[_0xc231('0x8d')]=function(_0x2ffc1e,_0x3ebb34,_0x249af9){try{if(!_0x2ffc1e[_0xc231('0x4f')][_0xc231('0x6f')]){throw new Error(_0xc231('0x8e'));}if(!_0x2ffc1e[_0xc231('0x4f')][_0xc231('0x8f')]){throw new Error(_0xc231('0x90'));}if(!_0x2ffc1e['body']['binding_values']){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x2ffc1e[_0xc231('0x4f')][_0xc231('0x91')]){throw new Error(_0xc231('0x92'));}var _0x3974a3=_0x2ffc1e[_0xc231('0x4f')][_0xc231('0x8f')]['split'](',');var _0x507080=_0x2ffc1e['body'][_0xc231('0x93')][_0xc231('0x94')](',');if(!_0x3974a3[_0xc231('0x36')]||!_0x507080[_0xc231('0x36')]||_0x3974a3[_0xc231('0x36')]!==_0x507080['length']){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x2ffc1e['body'][_0xc231('0x35')]=_[_0xc231('0x95')](_0x3974a3,_0x507080);if(!_0x2ffc1e['body']['fields'][_0xc231('0x81')]){throw new Error(_0xc231('0x96'));}if(!_0x2ffc1e[_0xc231('0x4f')][_0xc231('0x35')][_0xc231('0x97')]){throw new Error(_0xc231('0x98'));}var _0x1c63c7=path[_0xc231('0x6b')](config[_0xc231('0x99')],_0xc231('0x9a'),_0x2ffc1e[_0xc231('0x9b')][_0xc231('0x9c')]);fs['chmodSync'](_0x1c63c7,parseInt('0777',0x8));var _0x49bf0b=require(_0xc231('0x9d'))[_0xc231('0x9e')](path['join'](__dirname,_0xc231('0x9f')),[_0x1c63c7,_0x2ffc1e[_0xc231('0x4f')][_0xc231('0x8f')],_0x2ffc1e[_0xc231('0x4f')][_0xc231('0x93')],_0x2ffc1e[_0xc231('0x4f')][_0xc231('0x6f')],_0x2ffc1e[_0xc231('0x4f')]['CompanyId'],_0x2ffc1e[_0xc231('0x4f')][_0xc231('0x6d')],_0x2ffc1e[_0xc231('0x4f')][_0xc231('0x91')]]);return _0x3ebb34['status'](0xc8)[_0xc231('0x1c')]({'message':_0xc231('0xa0'),'pid':_0x49bf0b[_0xc231('0xa1')]});}catch(_0x2b2ab3){return _0x3ebb34[_0xc231('0x1a')](0x1f4)[_0xc231('0x2a')](_0x2b2ab3);}};exports[_0xc231('0xa2')]=function(_0x167955,_0x2fde35,_0xec04c5){var _0x3f0de1=fs['createReadStream'](_0x167955[_0xc231('0x9b')][_0xc231('0x7')]);Papa[_0xc231('0xa3')](_0x3f0de1,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0xa1ce39){return _0x2fde35[_0xc231('0x1a')](0xc8)[_0xc231('0x1c')]({'file':_0x167955[_0xc231('0x9b')],'fields':_0xa1ce39['meta'][_0xc231('0x35')]});}});};exports[_0xc231('0xa4')]=function(_0x3ebb27,_0x39387f,_0x2b40ff){return db[_0xc231('0xa5')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0xc231('0xa6')}})[_0xc231('0x26')](function(_0x589855){var _0x1a36d4=![];if(!_0x3ebb27[_0xc231('0x4f')][_0xc231('0x6f')]){throw new Error(_0xc231('0x8e'));}if(!_0x3ebb27['body'][_0xc231('0xa7')]['phone']){throw new Error(_0xc231('0x96'));}if(!_0x3ebb27[_0xc231('0x4f')][_0xc231('0xa7')][_0xc231('0x97')]){throw new Error(_0xc231('0x98'));}if(!_0x3ebb27[_0xc231('0x4f')]['socket_timestamp']){throw new Error(_0xc231('0x92'));}var _0x5c3691=require(_0xc231('0x9d'))[_0xc231('0x9e')](path[_0xc231('0x6b')](__dirname,_0xc231('0xa8')),[_0x3ebb27['params']['id'],JSON[_0xc231('0xa9')](_0x3ebb27['body']),JSON['stringify'](_0x589855)]);_0x5c3691['on'](_0xc231('0xaa'),function(_0x5834f2){_0x1a36d4=!![];return _0x39387f[_0xc231('0x1a')](0xc8)['json']({'message':_0xc231('0xab'),'pid':_0x5c3691[_0xc231('0xa1')]});});_0x5c3691['on']('exit',function(_0x975515){if(_0x975515&&!_0x1a36d4){return _0x39387f[_0xc231('0x1a')](0x1f4)[_0xc231('0x1c')]({'message':_0xc231('0xac'),'pid':_0x5c3691[_0xc231('0xa1')]});}});})[_0xc231('0x4c')](handleError(_0x39387f,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 5cc6718..1141b07 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc8a4=['events','../../mysqldb','CmContact','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0x4e3eeb,_0x12a8af){var _0x3b8d05=function(_0x4ffed1){while(--_0x4ffed1){_0x4e3eeb['push'](_0x4e3eeb['shift']());}};_0x3b8d05(++_0x12a8af);}(_0xc8a4,0x99));var _0x4c8a=function(_0x3fb3d5,_0xd0c827){_0x3fb3d5=_0x3fb3d5-0x0;var _0x2287c0=_0xc8a4[_0x3fb3d5];return _0x2287c0;};'use strict';var EventEmitter=require(_0x4c8a('0x0'));var CmContact=require(_0x4c8a('0x1'))['db'][_0x4c8a('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x4c8a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4c8a('0x4'),'afterDestroy':_0x4c8a('0x5')};function emitEvent(_0xed55fa){return function(_0x265b13,_0x333e61,_0x5a92e6){CmContactEvents['emit'](_0xed55fa+':'+_0x265b13['id'],_0x265b13);CmContactEvents[_0x4c8a('0x6')](_0xed55fa,_0x265b13);_0x5a92e6(null);};}for(var e in events){if(events[_0x4c8a('0x7')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x4c8a('0x8')]=CmContactEvents; \ No newline at end of file +var _0x8672=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x5a5b63,_0x421127){var _0x3de910=function(_0x358e02){while(--_0x358e02){_0x5a5b63['push'](_0x5a5b63['shift']());}};_0x3de910(++_0x421127);}(_0x8672,0x12c));var _0x2867=function(_0x1d3b65,_0x19a8f2){_0x1d3b65=_0x1d3b65-0x0;var _0x23cb53=_0x8672[_0x1d3b65];return _0x23cb53;};'use strict';var EventEmitter=require(_0x2867('0x0'));var CmContact=require(_0x2867('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0x2867('0x2')](0x0);var events={'afterCreate':_0x2867('0x3'),'afterUpdate':'update','afterDestroy':_0x2867('0x4')};function emitEvent(_0x251961){return function(_0x334297,_0x5be200,_0x2963df){CmContactEvents[_0x2867('0x5')](_0x251961+':'+_0x334297['id'],_0x334297);CmContactEvents[_0x2867('0x5')](_0x251961,_0x334297);_0x2963df(null);};}for(var e in events){if(events[_0x2867('0x6')](e)){var event=events[e];CmContact[_0x2867('0x7')](e,emitEvent(event));}}module[_0x2867('0x8')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 293e3e5..fd12cec 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1561=['VoiceQueueId','CampaignId','push','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','../../config/logger','api','moment','bluebird','request-promise','exports','define','cm_contacts','phone','error','afterCreate','isNil','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','create','priority','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','callbackUniqueid','catch','findOne','then','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','ListId','cmContact','inspect','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','VoiceQueue','outbound','dialCheckDuplicateType','CmList','Lists','get','length','CmHopperBlack','cmContact,\x20%s,\x20%s','message','Campaign','findAll','always','onlyIfOpen','BlackLists','List\x20not\x20found','isEmpty','ContactId'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1561,0x1bd));var _0x1156=function(_0x238a12,_0x5b7558){_0x238a12=_0x238a12-0x0;var _0x1709f8=_0x1561[_0x238a12];return _0x1709f8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1156('0x0'))(_0x1156('0x1'));var moment=require(_0x1156('0x2'));var BPromise=require(_0x1156('0x3'));var rp=require(_0x1156('0x4'));var attributes=require('./cmContact.attributes');module[_0x1156('0x5')]=function(_0x2b0b90,_0x1d831a){return _0x2b0b90[_0x1156('0x6')]('CmContact',attributes,{'tableName':_0x1156('0x7'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0x1156('0x8')]}],'timestamps':!![],'hooks':{'afterCreate':function(_0x6c3476,_0x273b53,_0x2a7693){var _0x36dc91=_0x2b0b90['models'];var _0x2a5914=_0x6c3476['get']({'plain':!![]});function _0x49b380(){return function(_0x30ab38){logger[_0x1156('0x9')]('cmContact',_0x1156('0xa'),util['inspect'](_0x30ab38,{'showHidden':![],'depth':null}));};}var _0x340673=function(_0x4f6c62){return new BPromise(function(_0x23379a,_0x39004f){_0x36dc91['CmHopper']['findOne']({'where':{'phone':_0x2a5914[_0x1156('0x8')],'VoiceQueueId':_0x4f6c62['id']}})['then'](function(_0x1c82c2){if(!_[_0x1156('0xb')](_0x1c82c2)){throw new Error('cmContact,\x20afterCreate\x20'+_0x2a5914['phone']+_0x1156('0xc')+_0x4f6c62['id']);}return _0x36dc91[_0x1156('0xd')][_0x1156('0xe')]({'phone':_0x2a5914['phone'],'ContactId':_0x2a5914['id'],'ListId':_0x2a5914['ListId'],'priority':_0x2a5914[_0x1156('0xf')]?_0x2a5914[_0x1156('0xf')]:0x2,'scheduledat':_0x2a5914[_0x1156('0x10')]?_0x2a5914[_0x1156('0x10')]:moment()[_0x1156('0x11')](_0x1156('0x12')),'callback':_0x2a5914[_0x1156('0x13')]?!![]:![],'callbackuniqueid':_0x2a5914[_0x1156('0x13')]?_0x2a5914[_0x1156('0x13')]:undefined,'callbackat':_0x2a5914[_0x1156('0x13')]?moment()[_0x1156('0x11')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x4f6c62['id']});})[_0x1156('0x14')](function(_0x14d3d7){_0x39004f(_0x14d3d7);});});};var _0x40eab4=function(_0x4ad077){return new BPromise(function(_0x30353b,_0x340fae){_0x36dc91[_0x1156('0xd')][_0x1156('0x15')]({'where':{'phone':_0x2a5914[_0x1156('0x8')],'VoiceQueueId':_0x4ad077['id']}})[_0x1156('0x16')](function(_0x3633ef){if(!_[_0x1156('0xb')](_0x3633ef)){throw new Error('cmContact,\x20afterCreate\x20'+_0x2a5914[_0x1156('0x8')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x4ad077['id']);}return _0x36dc91[_0x1156('0x17')][_0x1156('0x15')]({'where':{'calleridnum':_0x2a5914[_0x1156('0x8')],'VoiceQueueId':_0x4ad077['id']}});})['then'](function(_0x14fd17){if(!_[_0x1156('0xb')](_0x14fd17)){throw new Error(_0x1156('0x18')+_0x2a5914[_0x1156('0x8')]+_0x1156('0x19')+_0x4ad077['id']);}return _0x36dc91[_0x1156('0xd')]['create']({'phone':_0x2a5914[_0x1156('0x8')],'ContactId':_0x2a5914['id'],'ListId':_0x2a5914[_0x1156('0x1a')],'priority':_0x2a5914[_0x1156('0xf')]?_0x2a5914[_0x1156('0xf')]:0x2,'scheduledat':_0x2a5914[_0x1156('0x10')]?_0x2a5914[_0x1156('0x10')]:moment()[_0x1156('0x11')](_0x1156('0x12')),'callback':_0x2a5914[_0x1156('0x13')]?!![]:![],'callbackuniqueid':_0x2a5914[_0x1156('0x13')]?_0x2a5914[_0x1156('0x13')]:undefined,'callbackat':_0x2a5914[_0x1156('0x13')]?moment()[_0x1156('0x11')](_0x1156('0x12')):undefined,'VoiceQueueId':_0x4ad077['id']});})['catch'](function(_0x415bb1){_0x340fae(_0x415bb1);});});};function _0xca0e08(){return function(_0x4c44b3){logger[_0x1156('0x9')](_0x1156('0x1b'),'afterCreate',util[_0x1156('0x1c')](_0x4c44b3,{'showHidden':![],'depth':null}));};}var _0x3e4cc3=function(_0x5299d3){return new BPromise(function(_0x12a68e,_0x265406){_0x36dc91['CmHopper'][_0x1156('0x15')]({'where':{'phone':_0x2a5914[_0x1156('0x8')],'CampaignId':_0x5299d3['id']}})['then'](function(_0x364777){if(!_[_0x1156('0xb')](_0x364777)){throw new Error('cmContact,\x20afterCreate\x20'+_0x2a5914[_0x1156('0x8')]+_0x1156('0x1d')+_0x5299d3['id']);}return _0x36dc91[_0x1156('0xd')][_0x1156('0xe')]({'phone':_0x2a5914['phone'],'ContactId':_0x2a5914['id'],'ListId':_0x2a5914['ListId'],'priority':_0x2a5914[_0x1156('0xf')]?_0x2a5914[_0x1156('0xf')]:0x2,'scheduledat':_0x2a5914[_0x1156('0x10')]?_0x2a5914[_0x1156('0x10')]:moment()[_0x1156('0x11')](_0x1156('0x12')),'callback':_0x2a5914[_0x1156('0x13')]?!![]:![],'callbackuniqueid':_0x2a5914[_0x1156('0x13')]?_0x2a5914[_0x1156('0x13')]:undefined,'callbackat':_0x2a5914['callbackUniqueid']?moment()['format'](_0x1156('0x12')):undefined,'CampaignId':_0x5299d3['id']});})['catch'](function(_0x7918f1){_0x265406(_0x7918f1);});});};var _0x96f2fd=function(_0x5cd47b){return new BPromise(function(_0x3a70bb,_0x610415){_0x36dc91[_0x1156('0xd')][_0x1156('0x15')]({'where':{'phone':_0x2a5914['phone'],'CampaignId':_0x5cd47b['id']}})[_0x1156('0x16')](function(_0xa68f3d){if(!_['isNil'](_0xa68f3d)){throw new Error(_0x1156('0x1e')+_0x2a5914[_0x1156('0x8')]+_0x1156('0x1f')+_0x5cd47b['id']);}return _0x36dc91[_0x1156('0x17')]['findOne']({'where':{'calleridnum':_0x2a5914[_0x1156('0x8')],'CampaignId':_0x5cd47b['id']}});})['then'](function(_0x47cf0b){if(!_[_0x1156('0xb')](_0x47cf0b)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x2a5914[_0x1156('0x8')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x5cd47b['id']);}return _0x36dc91['CmHopper'][_0x1156('0xe')]({'phone':_0x2a5914[_0x1156('0x8')],'ContactId':_0x2a5914['id'],'ListId':_0x2a5914[_0x1156('0x1a')],'priority':_0x2a5914[_0x1156('0xf')]?_0x2a5914[_0x1156('0xf')]:0x2,'scheduledat':_0x2a5914[_0x1156('0x10')]?_0x2a5914[_0x1156('0x10')]:moment()['format'](_0x1156('0x12')),'callback':_0x2a5914['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x2a5914[_0x1156('0x13')]?_0x2a5914['callbackUniqueid']:undefined,'callbackat':_0x2a5914['callbackUniqueid']?moment()[_0x1156('0x11')](_0x1156('0x12')):undefined,'CampaignId':_0x5cd47b['id']});})[_0x1156('0x14')](function(_0x161227){_0x610415(_0x161227);});});};if(_0x2a5914[_0x1156('0x1a')]){_0x36dc91[_0x1156('0x20')]['findAll']({'where':{'type':_0x1156('0x21')},'attributes':['id',_0x1156('0x22')],'include':[{'model':_0x36dc91[_0x1156('0x23')],'as':_0x1156('0x24'),'where':{'id':_0x2a5914[_0x1156('0x1a')]}}]})[_0x1156('0x16')](function(_0x22fc3b){if(_0x22fc3b){var _0x53fa99=[];for(var _0x59694e=0x0,_0x5e37f2;_0x59694e<_0x22fc3b['length'];_0x59694e+=0x1){_0x5e37f2=_0x22fc3b[_0x59694e][_0x1156('0x25')]({'plain':!![]});switch(_0x5e37f2[_0x1156('0x22')]){case'always':_0x40eab4(_0x5e37f2)['catch'](_0x49b380());break;case'onlyIfOpen':_0x340673(_0x5e37f2)['catch'](_0x49b380());break;default:_0x36dc91['CmHopper'][_0x1156('0xe')]({'phone':_0x2a5914[_0x1156('0x8')],'ContactId':_0x2a5914['id'],'ListId':_0x2a5914[_0x1156('0x1a')],'scheduledat':_0x2a5914['scheduledat']?_0x2a5914[_0x1156('0x10')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x2a5914[_0x1156('0xf')]?_0x2a5914[_0x1156('0xf')]:0x2,'callback':_0x2a5914[_0x1156('0x13')]?!![]:![],'callbackuniqueid':_0x2a5914[_0x1156('0x13')]?_0x2a5914[_0x1156('0x13')]:undefined,'callbackat':_0x2a5914[_0x1156('0x13')]?moment()[_0x1156('0x11')](_0x1156('0x12')):undefined,'VoiceQueueId':_0x5e37f2['id']})['catch'](_0x49b380());}}}})[_0x1156('0x16')](function(){return _0x36dc91[_0x1156('0x20')]['findAll']({'where':{'type':_0x1156('0x21')},'attributes':['id'],'include':[{'model':_0x36dc91[_0x1156('0x23')],'as':'BlackLists','where':{'id':_0x2a5914[_0x1156('0x1a')]}}]})['then'](function(_0x32ef1d){if(_0x32ef1d){var _0x588ad2=[];for(var _0x4d259c=0x0,_0x2fdcf6;_0x4d259c<_0x32ef1d[_0x1156('0x26')];_0x4d259c+=0x1){_0x2fdcf6=_0x32ef1d[_0x4d259c][_0x1156('0x25')]({'plain':!![]});_0x36dc91[_0x1156('0x27')][_0x1156('0xe')]({'phone':_0x2a5914[_0x1156('0x8')],'ContactId':_0x2a5914['id'],'ListId':_0x2a5914['ListId'],'VoiceQueueId':_0x2fdcf6['id']})[_0x1156('0x14')](function(_0x55a5cc){logger[_0x1156('0x9')](_0x1156('0x28'),_0x1156('0xa'),_0x55a5cc[_0x1156('0x29')]);});}}});})[_0x1156('0x16')](function(){return _0x36dc91[_0x1156('0x2a')][_0x1156('0x2b')]({'attributes':['id',_0x1156('0x22')],'include':[{'model':_0x36dc91[_0x1156('0x23')],'as':'Lists','where':{'id':_0x2a5914[_0x1156('0x1a')]}}]})[_0x1156('0x16')](function(_0x2f4d49){if(_0x2f4d49){var _0x333874=[];for(var _0x522740=0x0,_0x1317d2;_0x522740<_0x2f4d49[_0x1156('0x26')];_0x522740+=0x1){_0x1317d2=_0x2f4d49[_0x522740][_0x1156('0x25')]({'plain':!![]});switch(_0x1317d2['dialCheckDuplicateType']){case _0x1156('0x2c'):_0x96f2fd(_0x1317d2)[_0x1156('0x14')](_0xca0e08());break;case _0x1156('0x2d'):_0x3e4cc3(_0x1317d2)[_0x1156('0x14')](_0xca0e08());break;default:_0x36dc91[_0x1156('0xd')][_0x1156('0xe')]({'phone':_0x2a5914['phone'],'ContactId':_0x2a5914['id'],'ListId':_0x2a5914[_0x1156('0x1a')],'scheduledat':_0x2a5914['scheduledat']?_0x2a5914['scheduledat']:moment()[_0x1156('0x11')](_0x1156('0x12')),'priority':_0x2a5914[_0x1156('0xf')]?_0x2a5914[_0x1156('0xf')]:0x2,'callback':_0x2a5914[_0x1156('0x13')]?!![]:![],'callbackuniqueid':_0x2a5914['callbackUniqueid']?_0x2a5914['callbackUniqueid']:undefined,'callbackat':_0x2a5914[_0x1156('0x13')]?moment()[_0x1156('0x11')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x1317d2['id']})[_0x1156('0x14')](_0xca0e08());}}}});})[_0x1156('0x16')](function(){return _0x36dc91[_0x1156('0x2a')][_0x1156('0x2b')]({'attributes':['id'],'include':[{'model':_0x36dc91[_0x1156('0x23')],'as':_0x1156('0x2e'),'where':{'id':_0x2a5914['ListId']}}]})[_0x1156('0x16')](function(_0x17f961){if(_0x17f961){var _0x47791e=[];for(var _0xf517ed=0x0,_0x59de0d;_0xf517ed<_0x17f961[_0x1156('0x26')];_0xf517ed+=0x1){_0x59de0d=_0x17f961[_0xf517ed]['get']({'plain':!![]});_0x36dc91['CmHopperBlack']['create']({'phone':_0x2a5914[_0x1156('0x8')],'ContactId':_0x2a5914['id'],'ListId':_0x2a5914[_0x1156('0x1a')],'CampaignId':_0x59de0d['id']})[_0x1156('0x14')](function(_0x142b9d){logger[_0x1156('0x9')](_0x1156('0x28'),_0x1156('0xa'),_0x142b9d['message']);});}}});})['then'](function(){_0x2a7693();})['catch'](function(_0x2b25a2){logger[_0x1156('0x9')](_0x1156('0x28'),_0x1156('0xa'),_0x2b25a2[_0x1156('0x29')]);_0x2a7693(_0x2b25a2);});}else{_0x2a7693(new Error(_0x1156('0x2f')));}},'afterDestroy':function(_0x3f3b60,_0x5ae820,_0x13075f){var _0x4da0b3=_0x2b0b90['models'];var _0x1e65cd=_0x3f3b60['get']({'plain':!![]});return _0x4da0b3[_0x1156('0xd')][_0x1156('0x2b')]({'raw':!![],'where':{'ListId':_0x1e65cd[_0x1156('0x1a')],'ContactId':_0x1e65cd['id']}})[_0x1156('0x16')](function(_0x5e6075){if(!_[_0x1156('0x30')](_0x5e6075)){var _0x5e6f89=[];for(var _0x4d049b=0x0;_0x4d049b<_0x5e6075['length'];_0x4d049b+=0x1){var _0x566385=_0x4da0b3[_0x1156('0xd')]['destroy']({'where':{'ListId':_0x5e6075[_0x4d049b][_0x1156('0x1a')],'ContactId':_0x5e6075[_0x4d049b][_0x1156('0x31')],'VoiceQueueId':_0x5e6075[_0x4d049b][_0x1156('0x32')],'CampaignId':_0x5e6075[_0x4d049b][_0x1156('0x33')]}});_0x5e6f89[_0x1156('0x34')](_0x566385);}return BPromise['all'](_0x5e6f89);}})['then'](function(_0x4ae951){logger['info'](_0x1156('0x35'),util['inspect'](_0x4ae951,{'showHidden':![],'depth':null}));_0x13075f();})[_0x1156('0x14')](function(_0x29d23a){logger[_0x1156('0x9')](_0x1156('0x36'),util[_0x1156('0x1c')](_0x29d23a,{'showHidden':![],'depth':null}));_0x13075f(_0x29d23a);});}}});}; \ No newline at end of file +var _0x5232=['inspect','CmHopper','then','isNil','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','findOne','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','findAll','outbound','get','dialCheckDuplicateType','always','onlyIfOpen','BlackLists','length','cmContact,\x20%s,\x20%s','message','Campaign','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','models','error','cmContact','afterCreate'];(function(_0x2797c6,_0x37421b){var _0x54809f=function(_0x2d100c){while(--_0x2d100c){_0x2797c6['push'](_0x2797c6['shift']());}};_0x54809f(++_0x37421b);}(_0x5232,0x1c9));var _0x2523=function(_0x421196,_0x1cbd94){_0x421196=_0x421196-0x0;var _0x2738af=_0x5232[_0x421196];return _0x2738af;};'use strict';var _=require(_0x2523('0x0'));var util=require(_0x2523('0x1'));var logger=require(_0x2523('0x2'))(_0x2523('0x3'));var moment=require(_0x2523('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x2523('0x5'));module[_0x2523('0x6')]=function(_0x582108,_0x1fe9de){return _0x582108[_0x2523('0x7')](_0x2523('0x8'),attributes,{'tableName':_0x2523('0x9'),'paranoid':!![],'indexes':[{'name':_0x2523('0xa'),'fields':[_0x2523('0xa')]}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3d8e51,_0x22440b,_0x251973){var _0x39dca8=_0x582108[_0x2523('0xb')];var _0x30f2cd=_0x3d8e51['get']({'plain':!![]});function _0x1e6087(){return function(_0x27d4fe){logger[_0x2523('0xc')](_0x2523('0xd'),_0x2523('0xe'),util[_0x2523('0xf')](_0x27d4fe,{'showHidden':![],'depth':null}));};}var _0x5856d2=function(_0x16e2c2){return new BPromise(function(_0x286480,_0x351a1f){_0x39dca8[_0x2523('0x10')]['findOne']({'where':{'phone':_0x30f2cd[_0x2523('0xa')],'VoiceQueueId':_0x16e2c2['id']}})[_0x2523('0x11')](function(_0x5e1e1d){if(!_[_0x2523('0x12')](_0x5e1e1d)){throw new Error(_0x2523('0x13')+_0x30f2cd[_0x2523('0xa')]+_0x2523('0x14')+_0x16e2c2['id']);}return _0x39dca8['CmHopper'][_0x2523('0x15')]({'phone':_0x30f2cd['phone'],'ContactId':_0x30f2cd['id'],'ListId':_0x30f2cd[_0x2523('0x16')],'priority':_0x30f2cd[_0x2523('0x17')]?_0x30f2cd[_0x2523('0x17')]:0x2,'scheduledat':_0x30f2cd[_0x2523('0x18')]?_0x30f2cd['scheduledat']:moment()[_0x2523('0x19')](_0x2523('0x1a')),'callback':_0x30f2cd[_0x2523('0x1b')]?!![]:![],'callbackuniqueid':_0x30f2cd[_0x2523('0x1b')]?_0x30f2cd[_0x2523('0x1b')]:undefined,'callbackat':_0x30f2cd[_0x2523('0x1b')]?moment()['format'](_0x2523('0x1a')):undefined,'VoiceQueueId':_0x16e2c2['id']});})[_0x2523('0x1c')](function(_0x540ec8){_0x351a1f(_0x540ec8);});});};var _0x2819aa=function(_0x189c94){return new BPromise(function(_0x3f29f6,_0xd2b9ab){_0x39dca8['CmHopper']['findOne']({'where':{'phone':_0x30f2cd['phone'],'VoiceQueueId':_0x189c94['id']}})['then'](function(_0x1d52dc){if(!_[_0x2523('0x12')](_0x1d52dc)){throw new Error(_0x2523('0x13')+_0x30f2cd[_0x2523('0xa')]+_0x2523('0x1d')+_0x189c94['id']);}return _0x39dca8['CmHopperFinal']['findOne']({'where':{'calleridnum':_0x30f2cd['phone'],'VoiceQueueId':_0x189c94['id']}});})[_0x2523('0x11')](function(_0x14a685){if(!_[_0x2523('0x12')](_0x14a685)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x30f2cd['phone']+_0x2523('0x1e')+_0x189c94['id']);}return _0x39dca8[_0x2523('0x10')][_0x2523('0x15')]({'phone':_0x30f2cd[_0x2523('0xa')],'ContactId':_0x30f2cd['id'],'ListId':_0x30f2cd[_0x2523('0x16')],'priority':_0x30f2cd['priority']?_0x30f2cd[_0x2523('0x17')]:0x2,'scheduledat':_0x30f2cd[_0x2523('0x18')]?_0x30f2cd[_0x2523('0x18')]:moment()[_0x2523('0x19')](_0x2523('0x1a')),'callback':_0x30f2cd[_0x2523('0x1b')]?!![]:![],'callbackuniqueid':_0x30f2cd[_0x2523('0x1b')]?_0x30f2cd[_0x2523('0x1b')]:undefined,'callbackat':_0x30f2cd[_0x2523('0x1b')]?moment()['format'](_0x2523('0x1a')):undefined,'VoiceQueueId':_0x189c94['id']});})[_0x2523('0x1c')](function(_0x53b772){_0xd2b9ab(_0x53b772);});});};function _0x304dd4(){return function(_0x52b25d){logger['error']('cmContact',_0x2523('0xe'),util['inspect'](_0x52b25d,{'showHidden':![],'depth':null}));};}var _0x3d8862=function(_0x577c90){return new BPromise(function(_0x42ea60,_0xb9cba8){_0x39dca8['CmHopper'][_0x2523('0x1f')]({'where':{'phone':_0x30f2cd['phone'],'CampaignId':_0x577c90['id']}})[_0x2523('0x11')](function(_0x2d9532){if(!_[_0x2523('0x12')](_0x2d9532)){throw new Error(_0x2523('0x13')+_0x30f2cd[_0x2523('0xa')]+_0x2523('0x20')+_0x577c90['id']);}return _0x39dca8['CmHopper'][_0x2523('0x15')]({'phone':_0x30f2cd[_0x2523('0xa')],'ContactId':_0x30f2cd['id'],'ListId':_0x30f2cd[_0x2523('0x16')],'priority':_0x30f2cd['priority']?_0x30f2cd[_0x2523('0x17')]:0x2,'scheduledat':_0x30f2cd['scheduledat']?_0x30f2cd[_0x2523('0x18')]:moment()[_0x2523('0x19')](_0x2523('0x1a')),'callback':_0x30f2cd[_0x2523('0x1b')]?!![]:![],'callbackuniqueid':_0x30f2cd[_0x2523('0x1b')]?_0x30f2cd[_0x2523('0x1b')]:undefined,'callbackat':_0x30f2cd[_0x2523('0x1b')]?moment()['format'](_0x2523('0x1a')):undefined,'CampaignId':_0x577c90['id']});})[_0x2523('0x1c')](function(_0x28846c){_0xb9cba8(_0x28846c);});});};var _0x1aeefb=function(_0x414c12){return new BPromise(function(_0x5b8e06,_0x44ab04){_0x39dca8[_0x2523('0x10')][_0x2523('0x1f')]({'where':{'phone':_0x30f2cd[_0x2523('0xa')],'CampaignId':_0x414c12['id']}})['then'](function(_0x79c2b2){if(!_['isNil'](_0x79c2b2)){throw new Error(_0x2523('0x13')+_0x30f2cd['phone']+_0x2523('0x21')+_0x414c12['id']);}return _0x39dca8[_0x2523('0x22')][_0x2523('0x1f')]({'where':{'calleridnum':_0x30f2cd[_0x2523('0xa')],'CampaignId':_0x414c12['id']}});})[_0x2523('0x11')](function(_0x3a4b37){if(!_[_0x2523('0x12')](_0x3a4b37)){throw new Error(_0x2523('0x23')+_0x30f2cd['phone']+_0x2523('0x24')+_0x414c12['id']);}return _0x39dca8[_0x2523('0x10')][_0x2523('0x15')]({'phone':_0x30f2cd[_0x2523('0xa')],'ContactId':_0x30f2cd['id'],'ListId':_0x30f2cd[_0x2523('0x16')],'priority':_0x30f2cd['priority']?_0x30f2cd[_0x2523('0x17')]:0x2,'scheduledat':_0x30f2cd[_0x2523('0x18')]?_0x30f2cd['scheduledat']:moment()['format'](_0x2523('0x1a')),'callback':_0x30f2cd['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x30f2cd[_0x2523('0x1b')]?_0x30f2cd[_0x2523('0x1b')]:undefined,'callbackat':_0x30f2cd[_0x2523('0x1b')]?moment()[_0x2523('0x19')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x414c12['id']});})['catch'](function(_0x1c694d){_0x44ab04(_0x1c694d);});});};if(_0x30f2cd[_0x2523('0x16')]){_0x39dca8[_0x2523('0x25')][_0x2523('0x26')]({'where':{'type':_0x2523('0x27')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':_0x39dca8['CmList'],'as':'Lists','where':{'id':_0x30f2cd[_0x2523('0x16')]}}]})[_0x2523('0x11')](function(_0xceff81){if(_0xceff81){var _0x574e6e=[];for(var _0x24e0e1=0x0,_0x2daaac;_0x24e0e1<_0xceff81['length'];_0x24e0e1+=0x1){_0x2daaac=_0xceff81[_0x24e0e1][_0x2523('0x28')]({'plain':!![]});switch(_0x2daaac[_0x2523('0x29')]){case _0x2523('0x2a'):_0x2819aa(_0x2daaac)[_0x2523('0x1c')](_0x1e6087());break;case _0x2523('0x2b'):_0x5856d2(_0x2daaac)['catch'](_0x1e6087());break;default:_0x39dca8[_0x2523('0x10')][_0x2523('0x15')]({'phone':_0x30f2cd[_0x2523('0xa')],'ContactId':_0x30f2cd['id'],'ListId':_0x30f2cd[_0x2523('0x16')],'scheduledat':_0x30f2cd['scheduledat']?_0x30f2cd[_0x2523('0x18')]:moment()[_0x2523('0x19')](_0x2523('0x1a')),'priority':_0x30f2cd[_0x2523('0x17')]?_0x30f2cd['priority']:0x2,'callback':_0x30f2cd['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x30f2cd[_0x2523('0x1b')]?_0x30f2cd['callbackUniqueid']:undefined,'callbackat':_0x30f2cd[_0x2523('0x1b')]?moment()[_0x2523('0x19')](_0x2523('0x1a')):undefined,'VoiceQueueId':_0x2daaac['id']})[_0x2523('0x1c')](_0x1e6087());}}}})[_0x2523('0x11')](function(){return _0x39dca8['VoiceQueue'][_0x2523('0x26')]({'where':{'type':_0x2523('0x27')},'attributes':['id'],'include':[{'model':_0x39dca8['CmList'],'as':_0x2523('0x2c'),'where':{'id':_0x30f2cd[_0x2523('0x16')]}}]})[_0x2523('0x11')](function(_0x52af8a){if(_0x52af8a){var _0x337993=[];for(var _0x1a1268=0x0,_0x2245df;_0x1a1268<_0x52af8a[_0x2523('0x2d')];_0x1a1268+=0x1){_0x2245df=_0x52af8a[_0x1a1268][_0x2523('0x28')]({'plain':!![]});_0x39dca8['CmHopperBlack'][_0x2523('0x15')]({'phone':_0x30f2cd[_0x2523('0xa')],'ContactId':_0x30f2cd['id'],'ListId':_0x30f2cd['ListId'],'VoiceQueueId':_0x2245df['id']})[_0x2523('0x1c')](function(_0x5778ae){logger['error'](_0x2523('0x2e'),_0x2523('0xe'),_0x5778ae[_0x2523('0x2f')]);});}}});})[_0x2523('0x11')](function(){return _0x39dca8[_0x2523('0x30')][_0x2523('0x26')]({'attributes':['id',_0x2523('0x29')],'include':[{'model':_0x39dca8['CmList'],'as':'Lists','where':{'id':_0x30f2cd['ListId']}}]})[_0x2523('0x11')](function(_0x12d72d){if(_0x12d72d){var _0x4a1a54=[];for(var _0x852e30=0x0,_0x3176ca;_0x852e30<_0x12d72d[_0x2523('0x2d')];_0x852e30+=0x1){_0x3176ca=_0x12d72d[_0x852e30]['get']({'plain':!![]});switch(_0x3176ca[_0x2523('0x29')]){case _0x2523('0x2a'):_0x1aeefb(_0x3176ca)[_0x2523('0x1c')](_0x304dd4());break;case'onlyIfOpen':_0x3d8862(_0x3176ca)['catch'](_0x304dd4());break;default:_0x39dca8[_0x2523('0x10')][_0x2523('0x15')]({'phone':_0x30f2cd['phone'],'ContactId':_0x30f2cd['id'],'ListId':_0x30f2cd[_0x2523('0x16')],'scheduledat':_0x30f2cd[_0x2523('0x18')]?_0x30f2cd[_0x2523('0x18')]:moment()[_0x2523('0x19')](_0x2523('0x1a')),'priority':_0x30f2cd[_0x2523('0x17')]?_0x30f2cd[_0x2523('0x17')]:0x2,'callback':_0x30f2cd[_0x2523('0x1b')]?!![]:![],'callbackuniqueid':_0x30f2cd[_0x2523('0x1b')]?_0x30f2cd[_0x2523('0x1b')]:undefined,'callbackat':_0x30f2cd[_0x2523('0x1b')]?moment()[_0x2523('0x19')](_0x2523('0x1a')):undefined,'CampaignId':_0x3176ca['id']})[_0x2523('0x1c')](_0x304dd4());}}}});})[_0x2523('0x11')](function(){return _0x39dca8['Campaign'][_0x2523('0x26')]({'attributes':['id'],'include':[{'model':_0x39dca8['CmList'],'as':_0x2523('0x2c'),'where':{'id':_0x30f2cd[_0x2523('0x16')]}}]})['then'](function(_0x53ed6d){if(_0x53ed6d){var _0x37616d=[];for(var _0x330f5b=0x0,_0x5c37ab;_0x330f5b<_0x53ed6d[_0x2523('0x2d')];_0x330f5b+=0x1){_0x5c37ab=_0x53ed6d[_0x330f5b][_0x2523('0x28')]({'plain':!![]});_0x39dca8['CmHopperBlack']['create']({'phone':_0x30f2cd[_0x2523('0xa')],'ContactId':_0x30f2cd['id'],'ListId':_0x30f2cd['ListId'],'CampaignId':_0x5c37ab['id']})[_0x2523('0x1c')](function(_0x2bf98e){logger[_0x2523('0xc')](_0x2523('0x2e'),_0x2523('0xe'),_0x2bf98e[_0x2523('0x2f')]);});}}});})['then'](function(){_0x251973();})[_0x2523('0x1c')](function(_0x4136f0){logger['error'](_0x2523('0x2e'),'afterCreate',_0x4136f0['message']);_0x251973(_0x4136f0);});}else{_0x251973(new Error(_0x2523('0x31')));}},'afterDestroy':function(_0x5902de,_0x50ec6e,_0x30a910){var _0x43de6f=_0x582108[_0x2523('0xb')];var _0xc32bf3=_0x5902de[_0x2523('0x28')]({'plain':!![]});return _0x43de6f[_0x2523('0x10')][_0x2523('0x26')]({'raw':!![],'where':{'ListId':_0xc32bf3['ListId'],'ContactId':_0xc32bf3['id']}})['then'](function(_0x26c881){if(!_[_0x2523('0x32')](_0x26c881)){var _0x3bcdf6=[];for(var _0x595cd5=0x0;_0x595cd5<_0x26c881[_0x2523('0x2d')];_0x595cd5+=0x1){var _0x2a2dac=_0x43de6f['CmHopper'][_0x2523('0x33')]({'where':{'ListId':_0x26c881[_0x595cd5][_0x2523('0x16')],'ContactId':_0x26c881[_0x595cd5][_0x2523('0x34')],'VoiceQueueId':_0x26c881[_0x595cd5][_0x2523('0x35')],'CampaignId':_0x26c881[_0x595cd5]['CampaignId']}});_0x3bcdf6[_0x2523('0x36')](_0x2a2dac);}return BPromise[_0x2523('0x37')](_0x3bcdf6);}})[_0x2523('0x11')](function(_0x26da00){logger[_0x2523('0x38')](_0x2523('0x39'),util[_0x2523('0xf')](_0x26da00,{'showHidden':![],'depth':null}));_0x30a910();})[_0x2523('0x1c')](function(_0x47078a){logger[_0x2523('0xc')](_0x2523('0x3a'),util[_0x2523('0xf')](_0x47078a,{'showHidden':![],'depth':null}));_0x30a910(_0x47078a);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 9e587d3..4bb12fe 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xccdc=['map','model','ShowCmContact','debug','stringify','CreateCmContact','create','body','raw','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CmContact','find','options','where','attributes','include'];(function(_0x59e821,_0x86c723){var _0x5333f6=function(_0x5dc2c9){while(--_0x5dc2c9){_0x59e821['push'](_0x59e821['shift']());}};_0x5333f6(++_0x86c723);}(_0xccdc,0x12f));var _0xcccd=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0xccdc[_0x4c440b];return _0x2d48cf;};'use strict';var _=require(_0xcccd('0x0'));var util=require('util');var moment=require(_0xcccd('0x1'));var BPromise=require('bluebird');var rs=require(_0xcccd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcccd('0x3'))['db'];var utils=require(_0xcccd('0x4'));var logger=require(_0xcccd('0x5'))(_0xcccd('0x6'));var config=require(_0xcccd('0x7'));var jayson=require(_0xcccd('0x8'));var client=jayson[_0xcccd('0x9')][_0xcccd('0xa')]({'port':0x232a});config['redis']=_[_0xcccd('0xb')](config[_0xcccd('0xc')],{'host':_0xcccd('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcccd('0xc')]));require(_0xcccd('0xe'))[_0xcccd('0xf')](socket);function respondWithRpcPromise(_0x2d3533,_0x3c1ac5,_0x126800){return new BPromise(function(_0x4a2c21,_0x56d431){return client[_0xcccd('0x10')](_0x2d3533,_0x126800)[_0xcccd('0x11')](function(_0xd08dd1){logger[_0xcccd('0x12')](_0xcccd('0x13'),_0x3c1ac5,_0xcccd('0x14'));logger['debug'](_0xcccd('0x15'),_0x3c1ac5,_0xcccd('0x14'),JSON['stringify'](_0xd08dd1));if(_0xd08dd1[_0xcccd('0x16')]){if(_0xd08dd1[_0xcccd('0x16')][_0xcccd('0x17')]===0x1f4){logger[_0xcccd('0x16')](_0xcccd('0x13'),_0x3c1ac5,_0xd08dd1[_0xcccd('0x16')][_0xcccd('0x18')]);return _0x56d431(_0xd08dd1[_0xcccd('0x16')][_0xcccd('0x18')]);}logger[_0xcccd('0x16')]('CmContact,\x20%s,\x20%s',_0x3c1ac5,_0xd08dd1[_0xcccd('0x16')][_0xcccd('0x18')]);return _0x4a2c21(_0xd08dd1[_0xcccd('0x16')][_0xcccd('0x18')]);}else{logger['info'](_0xcccd('0x13'),_0x3c1ac5,'request\x20sent');_0x4a2c21(_0xd08dd1[_0xcccd('0x19')][_0xcccd('0x18')]);}})[_0xcccd('0x1a')](function(_0x5165c2){logger['error'](_0xcccd('0x13'),_0x3c1ac5,_0x5165c2);_0x56d431(_0x5165c2);});});}exports['ShowCmContact']=function(_0x430355){var _0x476e48=this;return new Promise(function(_0x47212f,_0x1b1ec1){return db[_0xcccd('0x1b')][_0xcccd('0x1c')]({'raw':_0x430355[_0xcccd('0x1d')]?_0x430355[_0xcccd('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x430355[_0xcccd('0x1d')]?_0x430355['options'][_0xcccd('0x1e')]||null:null,'attributes':_0x430355[_0xcccd('0x1d')]?_0x430355[_0xcccd('0x1d')][_0xcccd('0x1f')]||null:null,'include':_0x430355['options']?_0x430355[_0xcccd('0x1d')][_0xcccd('0x20')]?_['map'](_0x430355[_0xcccd('0x1d')]['include'],function(_0x518739){return{'model':db[_0x518739['model']],'as':_0x518739['as'],'attributes':_0x518739['attributes'],'include':_0x518739[_0xcccd('0x20')]?_[_0xcccd('0x21')](_0x518739['include'],function(_0x4f21df){return{'model':db[_0x4f21df[_0xcccd('0x22')]],'as':_0x4f21df['as'],'attributes':_0x4f21df[_0xcccd('0x1f')],'include':_0x4f21df[_0xcccd('0x20')]?_[_0xcccd('0x21')](_0x4f21df['include'],function(_0x374cab){return{'model':db[_0x374cab[_0xcccd('0x22')]],'as':_0x374cab['as'],'attributes':_0x374cab[_0xcccd('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d9128){logger['info'](_0xcccd('0x23'),_0x430355);logger[_0xcccd('0x24')]('ShowCmContact',_0x430355,JSON[_0xcccd('0x25')](_0x3d9128));_0x47212f(_0x3d9128);})[_0xcccd('0x1a')](function(_0x6de5ee){logger['error'](_0xcccd('0x23'),_0x6de5ee[_0xcccd('0x18')],_0x430355);_0x1b1ec1(_0x476e48[_0xcccd('0x16')](0x1f4,_0x6de5ee[_0xcccd('0x18')]));});});};exports[_0xcccd('0x26')]=function(_0x1c1d8e){var _0x12216d=this;return new Promise(function(_0x3055cc,_0x163877){return db['CmContact'][_0xcccd('0x27')](_0x1c1d8e[_0xcccd('0x28')],{'raw':_0x1c1d8e[_0xcccd('0x1d')]?_0x1c1d8e[_0xcccd('0x1d')][_0xcccd('0x29')]===undefined?!![]:![]:!![]})[_0xcccd('0x11')](function(_0x31077e){logger[_0xcccd('0x12')](_0xcccd('0x26'),_0x1c1d8e);logger[_0xcccd('0x24')](_0xcccd('0x26'),_0x1c1d8e,JSON[_0xcccd('0x25')](_0x31077e));_0x3055cc(_0x31077e);})['catch'](function(_0x4fc4f6){logger['error'](_0xcccd('0x26'),_0x4fc4f6[_0xcccd('0x18')],_0x1c1d8e);_0x163877(_0x12216d[_0xcccd('0x16')](0x1f4,_0x4fc4f6[_0xcccd('0x18')]));});});}; \ No newline at end of file +var _0xc4c5=['then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CmContact','find','options','raw','where','attributes','include','model','map','ShowCmContact','CreateCmContact','create','body','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register'];(function(_0x276f74,_0x5431fc){var _0x1d1326=function(_0x307be8){while(--_0x307be8){_0x276f74['push'](_0x276f74['shift']());}};_0x1d1326(++_0x5431fc);}(_0xc4c5,0x1da));var _0x5c4c=function(_0x47afcc,_0x2c0f17){_0x47afcc=_0x47afcc-0x0;var _0x2ec2e0=_0xc4c5[_0x47afcc];return _0x2ec2e0;};'use strict';var _=require(_0x5c4c('0x0'));var util=require(_0x5c4c('0x1'));var moment=require(_0x5c4c('0x2'));var BPromise=require(_0x5c4c('0x3'));var rs=require(_0x5c4c('0x4'));var fs=require('fs');var Redis=require(_0x5c4c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5c4c('0x6'));var logger=require(_0x5c4c('0x7'))('rpc');var config=require(_0x5c4c('0x8'));var jayson=require(_0x5c4c('0x9'));var client=jayson[_0x5c4c('0xa')][_0x5c4c('0xb')]({'port':0x232a});config[_0x5c4c('0xc')]=_[_0x5c4c('0xd')](config[_0x5c4c('0xc')],{'host':_0x5c4c('0xe'),'port':0x18eb});var socket=require(_0x5c4c('0xf'))(new Redis(config[_0x5c4c('0xc')]));require(_0x5c4c('0x10'))[_0x5c4c('0x11')](socket);function respondWithRpcPromise(_0x43d093,_0x45f3b2,_0x335591){return new BPromise(function(_0x296b5c,_0x2698dc){return client['request'](_0x43d093,_0x335591)[_0x5c4c('0x12')](function(_0x43340b){logger[_0x5c4c('0x13')](_0x5c4c('0x14'),_0x45f3b2,_0x5c4c('0x15'));logger[_0x5c4c('0x16')](_0x5c4c('0x17'),_0x45f3b2,_0x5c4c('0x15'),JSON[_0x5c4c('0x18')](_0x43340b));if(_0x43340b[_0x5c4c('0x19')]){if(_0x43340b[_0x5c4c('0x19')]['code']===0x1f4){logger[_0x5c4c('0x19')](_0x5c4c('0x14'),_0x45f3b2,_0x43340b[_0x5c4c('0x19')][_0x5c4c('0x1a')]);return _0x2698dc(_0x43340b[_0x5c4c('0x19')][_0x5c4c('0x1a')]);}logger[_0x5c4c('0x19')]('CmContact,\x20%s,\x20%s',_0x45f3b2,_0x43340b[_0x5c4c('0x19')][_0x5c4c('0x1a')]);return _0x296b5c(_0x43340b[_0x5c4c('0x19')]['message']);}else{logger[_0x5c4c('0x13')](_0x5c4c('0x14'),_0x45f3b2,_0x5c4c('0x15'));_0x296b5c(_0x43340b['result'][_0x5c4c('0x1a')]);}})[_0x5c4c('0x1b')](function(_0x13949d){logger[_0x5c4c('0x19')](_0x5c4c('0x14'),_0x45f3b2,_0x13949d);_0x2698dc(_0x13949d);});});}exports['ShowCmContact']=function(_0xf60e86){var _0x31f0f8=this;return new Promise(function(_0x408963,_0xd15272){return db[_0x5c4c('0x1c')][_0x5c4c('0x1d')]({'raw':_0xf60e86['options']?_0xf60e86[_0x5c4c('0x1e')][_0x5c4c('0x1f')]===undefined?!![]:![]:!![],'where':_0xf60e86[_0x5c4c('0x1e')]?_0xf60e86['options'][_0x5c4c('0x20')]||null:null,'attributes':_0xf60e86['options']?_0xf60e86['options'][_0x5c4c('0x21')]||null:null,'include':_0xf60e86[_0x5c4c('0x1e')]?_0xf60e86[_0x5c4c('0x1e')][_0x5c4c('0x22')]?_['map'](_0xf60e86[_0x5c4c('0x1e')][_0x5c4c('0x22')],function(_0x557f26){return{'model':db[_0x557f26[_0x5c4c('0x23')]],'as':_0x557f26['as'],'attributes':_0x557f26[_0x5c4c('0x21')],'include':_0x557f26[_0x5c4c('0x22')]?_[_0x5c4c('0x24')](_0x557f26[_0x5c4c('0x22')],function(_0x40ba6c){return{'model':db[_0x40ba6c[_0x5c4c('0x23')]],'as':_0x40ba6c['as'],'attributes':_0x40ba6c[_0x5c4c('0x21')],'include':_0x40ba6c['include']?_[_0x5c4c('0x24')](_0x40ba6c[_0x5c4c('0x22')],function(_0x183a2b){return{'model':db[_0x183a2b['model']],'as':_0x183a2b['as'],'attributes':_0x183a2b[_0x5c4c('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5c4c('0x12')](function(_0x175a60){logger[_0x5c4c('0x13')](_0x5c4c('0x25'),_0xf60e86);logger[_0x5c4c('0x16')](_0x5c4c('0x25'),_0xf60e86,JSON['stringify'](_0x175a60));_0x408963(_0x175a60);})['catch'](function(_0x45d075){logger[_0x5c4c('0x19')](_0x5c4c('0x25'),_0x45d075[_0x5c4c('0x1a')],_0xf60e86);_0xd15272(_0x31f0f8[_0x5c4c('0x19')](0x1f4,_0x45d075[_0x5c4c('0x1a')]));});});};exports[_0x5c4c('0x26')]=function(_0x57ef88){var _0x1edd12=this;return new Promise(function(_0x4d5e7e,_0x327d93){return db[_0x5c4c('0x1c')][_0x5c4c('0x27')](_0x57ef88[_0x5c4c('0x28')],{'raw':_0x57ef88[_0x5c4c('0x1e')]?_0x57ef88['options']['raw']===undefined?!![]:![]:!![]})[_0x5c4c('0x12')](function(_0x5978c9){logger[_0x5c4c('0x13')]('CreateCmContact',_0x57ef88);logger[_0x5c4c('0x16')]('CreateCmContact',_0x57ef88,JSON[_0x5c4c('0x18')](_0x5978c9));_0x4d5e7e(_0x5978c9);})[_0x5c4c('0x1b')](function(_0xfc6b54){logger[_0x5c4c('0x19')](_0x5c4c('0x26'),_0xfc6b54[_0x5c4c('0x1a')],_0x57ef88);_0x327d93(_0x1edd12[_0x5c4c('0x19')](0x1f4,_0xfc6b54[_0x5c4c('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.socket.js b/server/api/cmContact/cmContact.socket.js index 4ff96aa..968fd6f 100644 --- a/server/api/cmContact/cmContact.socket.js +++ b/server/api/cmContact/cmContact.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b8f=['save','update','emit','removeListener','register','length'];(function(_0x3e32c2,_0x3c47f4){var _0x41e29f=function(_0x454020){while(--_0x454020){_0x3e32c2['push'](_0x3e32c2['shift']());}};_0x41e29f(++_0x3c47f4);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0xa95f61,_0x94e944){_0xa95f61=_0xa95f61-0x0;var _0x4d3049=_0x6b8f[_0xa95f61];return _0x4d3049;};'use strict';var CmContactEvents=require('./cmContact.events');var events=[_0xf6b8('0x0'),'remove',_0xf6b8('0x1')];function createListener(_0x4e006e,_0x5443a1){return function(_0x362c27){_0x5443a1[_0xf6b8('0x2')](_0x4e006e,_0x362c27);};}function removeListener(_0x4d0ee5,_0x2b5ca9){return function(){CmContactEvents[_0xf6b8('0x3')](_0x4d0ee5,_0x2b5ca9);};}exports[_0xf6b8('0x4')]=function(_0x549eac){for(var _0x2d035e=0x0,_0x79c66d=events[_0xf6b8('0x5')];_0x2d035e<_0x79c66d;_0x2d035e++){var _0x3c3430=events[_0x2d035e];var _0x557910=createListener('cmContact:'+_0x3c3430,_0x549eac);CmContactEvents['on'](_0x3c3430,_0x557910);}}; \ No newline at end of file +var _0x818f=['update','emit','removeListener','register','length','cmContact:','./cmContact.events','save','remove'];(function(_0x3671c8,_0x1893d1){var _0x22d8c1=function(_0x21eaf){while(--_0x21eaf){_0x3671c8['push'](_0x3671c8['shift']());}};_0x22d8c1(++_0x1893d1);}(_0x818f,0x1da));var _0xf818=function(_0x1d223a,_0x41fcad){_0x1d223a=_0x1d223a-0x0;var _0x9cd00f=_0x818f[_0x1d223a];return _0x9cd00f;};'use strict';var CmContactEvents=require(_0xf818('0x0'));var events=[_0xf818('0x1'),_0xf818('0x2'),_0xf818('0x3')];function createListener(_0x121db7,_0x39b430){return function(_0x58f142){_0x39b430[_0xf818('0x4')](_0x121db7,_0x58f142);};}function removeListener(_0xd6c86,_0x2c1bb0){return function(){CmContactEvents[_0xf818('0x5')](_0xd6c86,_0x2c1bb0);};}exports[_0xf818('0x6')]=function(_0x41310f){for(var _0x27119b=0x0,_0x42a23e=events[_0xf818('0x7')];_0x27119b<_0x42a23e;_0x27119b++){var _0x55540d=events[_0x27119b];var _0x1dbfc8=createListener(_0xf818('0x8')+_0x55540d,_0x41310f);CmContactEvents['on'](_0x55540d,_0x1dbfc8);}}; \ No newline at end of file diff --git a/server/api/cmContact/index.js b/server/api/cmContact/index.js index 1221861..a42a1fa 100644 --- a/server/api/cmContact/index.js +++ b/server/api/cmContact/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb9f1=['show','/:id/tags','getTags','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','post','/merge','merge','create','/create_many','setTags','diskStorage','originalname','replace','%s-%s%s','basename','extname','now','/csv','single','uploadCsv','join','root','format','/upload','file','/upload/:id','import','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb9f1,0x1cc));var _0x1b9f=function(_0x294983,_0x364113){_0x294983=_0x294983-0x0;var _0x34acd0=_0xb9f1[_0x294983];return _0x34acd0;};'use strict';var multer=require(_0x1b9f('0x0'));var util=require(_0x1b9f('0x1'));var path=require(_0x1b9f('0x2'));var timeout=require(_0x1b9f('0x3'));var express=require('express');var router=express[_0x1b9f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1b9f('0x5'));var config=require(_0x1b9f('0x6'));var controller=require('./cmContact.controller');router['get']('/',auth[_0x1b9f('0x7')](),controller['index']);router[_0x1b9f('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x1b9f('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x1b9f('0xa')]);router[_0x1b9f('0x8')](_0x1b9f('0xb'),auth[_0x1b9f('0x7')](),controller[_0x1b9f('0xc')]);router[_0x1b9f('0x8')](_0x1b9f('0xd'),auth[_0x1b9f('0x7')](),controller[_0x1b9f('0xe')]);router[_0x1b9f('0x8')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0x1b9f('0xf')]);router[_0x1b9f('0x8')](_0x1b9f('0x10'),auth[_0x1b9f('0x7')](),controller[_0x1b9f('0x11')]);router['get'](_0x1b9f('0x12'),auth[_0x1b9f('0x7')](),controller[_0x1b9f('0x13')]);router[_0x1b9f('0x14')](_0x1b9f('0x15'),auth[_0x1b9f('0x7')](),controller[_0x1b9f('0x16')]);router['post']('/',auth[_0x1b9f('0x7')](),controller[_0x1b9f('0x17')]);router[_0x1b9f('0x14')](_0x1b9f('0x18'),auth[_0x1b9f('0x7')](),controller['bulkCreate']);router[_0x1b9f('0x14')](_0x1b9f('0xb'),auth[_0x1b9f('0x7')](),controller[_0x1b9f('0x19')]);var upload=multer({'storage':multer[_0x1b9f('0x1a')]({'destination':function(_0x2f3c67,_0x50754e,_0x56d90f){_0x56d90f(null,path['join'](config['root'],'server/files/tmp'));},'filename':function(_0x4de464,_0x78fa3d,_0x20712a){_0x78fa3d[_0x1b9f('0x1b')]=_0x78fa3d[_0x1b9f('0x1b')][_0x1b9f('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x20712a(null,util['format'](_0x1b9f('0x1d'),path[_0x1b9f('0x1e')](_0x78fa3d[_0x1b9f('0x1b')],path[_0x1b9f('0x1f')](_0x78fa3d[_0x1b9f('0x1b')])),Date[_0x1b9f('0x20')](),path['extname'](_0x78fa3d[_0x1b9f('0x1b')])));}})});router['post'](_0x1b9f('0x21'),upload[_0x1b9f('0x22')]('file'),controller[_0x1b9f('0x23')]);var upload=multer({'storage':multer[_0x1b9f('0x1a')]({'destination':function(_0x5eec0b,_0x307f6b,_0x2e153d){_0x2e153d(null,path[_0x1b9f('0x24')](config[_0x1b9f('0x25')],'server/files/tmp'));},'filename':function(_0x36b69f,_0x8a66cc,_0x381d58){_0x8a66cc[_0x1b9f('0x1b')]=_0x8a66cc[_0x1b9f('0x1b')][_0x1b9f('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x381d58(null,util[_0x1b9f('0x26')](_0x1b9f('0x1d'),path[_0x1b9f('0x1e')](_0x8a66cc[_0x1b9f('0x1b')],path[_0x1b9f('0x1f')](_0x8a66cc[_0x1b9f('0x1b')])),Date['now'](),path[_0x1b9f('0x1f')](_0x8a66cc[_0x1b9f('0x1b')])));}})});router['post'](_0x1b9f('0x27'),upload['single'](_0x1b9f('0x28')),controller['upload']);router[_0x1b9f('0x14')](_0x1b9f('0x29'),auth[_0x1b9f('0x7')](),controller[_0x1b9f('0x2a')]);router['put'](_0x1b9f('0x2b'),auth['isAuthenticated'](),controller[_0x1b9f('0x2c')]);router[_0x1b9f('0x2d')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x1b9f('0x2e')]=router; \ No newline at end of file +var _0xa147=['format','%s-%s%s','basename','extname','now','/csv','single','file','/upload','upload','/upload/:id','import','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/jscripty_sessions','getJscriptySessions','/merge','merge','create','/create_many','post','setTags','diskStorage','join','root','server/files/tmp','originalname'];(function(_0x160cd5,_0x19c58e){var _0x366763=function(_0x3b8e31){while(--_0x3b8e31){_0x160cd5['push'](_0x160cd5['shift']());}};_0x366763(++_0x19c58e);}(_0xa147,0x79));var _0x7a14=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa147[_0x187ee1];return _0x388160;};'use strict';var multer=require('multer');var util=require(_0x7a14('0x0'));var path=require(_0x7a14('0x1'));var timeout=require(_0x7a14('0x2'));var express=require(_0x7a14('0x3'));var router=express[_0x7a14('0x4')]();var auth=require(_0x7a14('0x5'));var interaction=require(_0x7a14('0x6'));var config=require(_0x7a14('0x7'));var controller=require(_0x7a14('0x8'));router['get']('/',auth[_0x7a14('0x9')](),controller[_0x7a14('0xa')]);router[_0x7a14('0xb')](_0x7a14('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x7a14('0xb')](_0x7a14('0xd'),auth[_0x7a14('0x9')](),controller[_0x7a14('0xe')]);router['get'](_0x7a14('0xf'),auth[_0x7a14('0x9')](),controller[_0x7a14('0x10')]);router[_0x7a14('0xb')](_0x7a14('0x11'),auth[_0x7a14('0x9')](),controller[_0x7a14('0x12')]);router[_0x7a14('0xb')](_0x7a14('0x13'),auth[_0x7a14('0x9')](),controller[_0x7a14('0x14')]);router[_0x7a14('0xb')](_0x7a14('0x15'),auth[_0x7a14('0x9')](),controller['getHopperFinals']);router[_0x7a14('0xb')](_0x7a14('0x16'),auth[_0x7a14('0x9')](),controller[_0x7a14('0x17')]);router['post'](_0x7a14('0x18'),auth[_0x7a14('0x9')](),controller[_0x7a14('0x19')]);router['post']('/',auth[_0x7a14('0x9')](),controller[_0x7a14('0x1a')]);router['post'](_0x7a14('0x1b'),auth[_0x7a14('0x9')](),controller['bulkCreate']);router[_0x7a14('0x1c')](_0x7a14('0xf'),auth['isAuthenticated'](),controller[_0x7a14('0x1d')]);var upload=multer({'storage':multer[_0x7a14('0x1e')]({'destination':function(_0x960d0,_0x38fa3f,_0x45b363){_0x45b363(null,path[_0x7a14('0x1f')](config[_0x7a14('0x20')],_0x7a14('0x21')));},'filename':function(_0x3be3d0,_0xbc3fef,_0xa06edd){_0xbc3fef[_0x7a14('0x22')]=_0xbc3fef[_0x7a14('0x22')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xa06edd(null,util[_0x7a14('0x23')](_0x7a14('0x24'),path[_0x7a14('0x25')](_0xbc3fef[_0x7a14('0x22')],path[_0x7a14('0x26')](_0xbc3fef[_0x7a14('0x22')])),Date[_0x7a14('0x27')](),path[_0x7a14('0x26')](_0xbc3fef['originalname'])));}})});router[_0x7a14('0x1c')](_0x7a14('0x28'),upload[_0x7a14('0x29')](_0x7a14('0x2a')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x7a14('0x1e')]({'destination':function(_0x105233,_0x2088b1,_0x3b3d41){_0x3b3d41(null,path['join'](config[_0x7a14('0x20')],'server/files/tmp'));},'filename':function(_0x57d935,_0x321e10,_0x1f6bad){_0x321e10['originalname']=_0x321e10[_0x7a14('0x22')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1f6bad(null,util[_0x7a14('0x23')](_0x7a14('0x24'),path[_0x7a14('0x25')](_0x321e10[_0x7a14('0x22')],path['extname'](_0x321e10[_0x7a14('0x22')])),Date[_0x7a14('0x27')](),path[_0x7a14('0x26')](_0x321e10[_0x7a14('0x22')])));}})});router[_0x7a14('0x1c')](_0x7a14('0x2b'),upload['single'](_0x7a14('0x2a')),controller[_0x7a14('0x2c')]);router[_0x7a14('0x1c')](_0x7a14('0x2d'),auth['isAuthenticated'](),controller[_0x7a14('0x2e')]);router[_0x7a14('0x2f')]('/:id',auth[_0x7a14('0x9')](),controller[_0x7a14('0x30')]);router[_0x7a14('0x31')](_0x7a14('0xd'),auth[_0x7a14('0x9')](),controller[_0x7a14('0x32')]);module[_0x7a14('0x33')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 87dc95f..8a41525 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 _0xd32c=['getDataValue','alias','STRING','setDataValue','name','TEXT','long','type','select','parse','values','stringify','BOOLEAN','sequelize','lodash','exports','VIRTUAL'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0xd32c,0x150));var _0xcd32=function(_0x53174f,_0x986a3b){_0x53174f=_0x53174f-0x0;var _0x1cbd1c=_0xd32c[_0x53174f];return _0x1cbd1c;};'use strict';var Sequelize=require(_0xcd32('0x0'));var _=require(_0xcd32('0x1'));module[_0xcd32('0x2')]={'name':{'type':Sequelize[_0xcd32('0x3')],'get':function(_0x4c70a7){return this[_0xcd32('0x4')](_0xcd32('0x5'));}},'alias':{'type':Sequelize[_0xcd32('0x6')],'allowNull':![],'set':function(_0x5db4f1){this[_0xcd32('0x7')](_0xcd32('0x5'),_0x5db4f1?_0x5db4f1:this[_0xcd32('0x4')](_0xcd32('0x8')));}},'type':{'type':Sequelize[_0xcd32('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0xcd32('0x9')](_0xcd32('0xa')),'get':function(){if(this[_0xcd32('0x4')](_0xcd32('0xb'))===_0xcd32('0xc')){return JSON[_0xcd32('0xd')](this[_0xcd32('0x4')](_0xcd32('0xe')));}else{return this[_0xcd32('0x4')]('values');}},'set':function(_0x1ad8a9){if(Array['isArray'](_0x1ad8a9)){this[_0xcd32('0x7')]('values',JSON[_0xcd32('0xf')](_0x1ad8a9));}else{this[_0xcd32('0x7')](_0xcd32('0xe'),_0x1ad8a9);}}},'required':{'type':Sequelize[_0xcd32('0x10')],'defaultValue':![]}}; \ No newline at end of file +var _0x4d5c=['select','parse','values','isArray','setDataValue','stringify','BOOLEAN','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','name','TEXT','type'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x4d5c,0x8f));var _0xc4d5=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x4d5c[_0x3899d1];return _0xeb4a7d;};'use strict';var Sequelize=require(_0xc4d5('0x0'));var _=require(_0xc4d5('0x1'));module[_0xc4d5('0x2')]={'name':{'type':Sequelize[_0xc4d5('0x3')],'get':function(_0x7733f6){return this[_0xc4d5('0x4')](_0xc4d5('0x5'));}},'alias':{'type':Sequelize[_0xc4d5('0x6')],'allowNull':![],'set':function(_0x29899){this['setDataValue'](_0xc4d5('0x5'),_0x29899?_0x29899:this[_0xc4d5('0x4')](_0xc4d5('0x7')));}},'type':{'type':Sequelize[_0xc4d5('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0xc4d5('0x8')]('long'),'get':function(){if(this[_0xc4d5('0x4')](_0xc4d5('0x9'))===_0xc4d5('0xa')){return JSON[_0xc4d5('0xb')](this[_0xc4d5('0x4')](_0xc4d5('0xc')));}else{return this[_0xc4d5('0x4')](_0xc4d5('0xc'));}},'set':function(_0x4db799){if(Array[_0xc4d5('0xd')](_0x4db799)){this[_0xc4d5('0xe')](_0xc4d5('0xc'),JSON[_0xc4d5('0xf')](_0x4db799));}else{this[_0xc4d5('0xe')]('values',_0x4db799);}}},'required':{'type':Sequelize[_0xc4d5('0x10')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 68f3960..12fd695 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 _0xda65=['rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','status','end','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','CmCustomField','rawAttributes','differenceBy','keys','query','dateStart','dateEnd','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','add','day','filter','map','merge','include','findAll','rows','catch','includeAll','options','body','find','params','create','transaction','Sequelize','TEXT','type','number','INTEGER','switch','BOOLEAN','sequelize','queryInterface','addColumn','cm_contacts','format','cf_%d','html-pdf','eml-format'];(function(_0x5c49ec,_0xd3c93){var _0x2fe076=function(_0x3d3e53){while(--_0x3d3e53){_0x5c49ec['push'](_0x5c49ec['shift']());}};_0x2fe076(++_0xd3c93);}(_0xda65,0x162));var _0x5da6=function(_0x14466d,_0x26fa67){_0x14466d=_0x14466d-0x0;var _0x3e8b23=_0xda65[_0x14466d];return _0x3e8b23;};'use strict';var pdf=require(_0x5da6('0x0'));var emlformat=require(_0x5da6('0x1'));var rimraf=require(_0x5da6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5da6('0x3'));var rp=require(_0x5da6('0x4'));var moment=require(_0x5da6('0x5'));var BPromise=require(_0x5da6('0x6'));var Mustache=require(_0x5da6('0x7'));var util=require(_0x5da6('0x8'));var path=require(_0x5da6('0x9'));var sox=require(_0x5da6('0xa'));var csv=require(_0x5da6('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5da6('0xc'));var squel=require(_0x5da6('0xd'));var crypto=require(_0x5da6('0xe'));var jsforce=require(_0x5da6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x5da6('0xb'));var querystring=require(_0x5da6('0x10'));var Papa=require(_0x5da6('0x11'));var Redis=require(_0x5da6('0x12'));var qs=require(_0x5da6('0x13'));var logger=require('../../config/logger')(_0x5da6('0x14'));var utils=require('../../config/utils');var config=require(_0x5da6('0x15'));var db=require(_0x5da6('0x16'))['db'];function respondWithStatusCode(_0x204f66,_0x251af2){_0x251af2=_0x251af2||0xcc;return function(_0x4bed5a){if(_0x4bed5a){return _0x204f66['sendStatus'](_0x251af2);}return _0x204f66[_0x5da6('0x17')](_0x251af2)[_0x5da6('0x18')]();};}function respondWithResult(_0x4a689b,_0x56644a){_0x56644a=_0x56644a||0xc8;return function(_0x3e95c9){if(_0x3e95c9){return _0x4a689b[_0x5da6('0x17')](_0x56644a)['json'](_0x3e95c9);}};}function respondWithFilteredResult(_0x4f69d3,_0x585c61){return function(_0x113539){if(_0x113539){var _0x55984c=_0x113539[_0x5da6('0x19')],_0x32851b=_0x585c61[_0x5da6('0x1a')],_0x505324=_0x585c61[_0x5da6('0x1a')]+_0x585c61['limit'],_0x597a19;if(_0x505324>=_0x55984c){_0x505324=_0x55984c;_0x597a19=0xc8;}else{_0x597a19=0xce;}_0x4f69d3[_0x5da6('0x17')](_0x597a19);return _0x4f69d3[_0x5da6('0x1b')](_0x5da6('0x1c'),_0x32851b+'-'+_0x505324+'/'+_0x55984c)['json'](_0x113539);}return null;};}function patchUpdates(_0x37c950){return function(_0x58ea93){try{jsonpatch[_0x5da6('0x1d')](_0x58ea93,_0x37c950,!![]);}catch(_0x333951){return BPromise[_0x5da6('0x1e')](_0x333951);}return _0x58ea93[_0x5da6('0x1f')]();};}function saveUpdates(_0x3bd2c5,_0x4388cc){return function(_0x2a471e){if(_0x2a471e){return _0x2a471e[_0x5da6('0x20')](_0x3bd2c5)[_0x5da6('0x21')](function(_0x3cc374){return _0x3cc374;});}return null;};}function removeEntity(_0x4f4ded,_0x1be580){return function(_0xbebfce){if(_0xbebfce){return _0xbebfce[_0x5da6('0x22')]()[_0x5da6('0x21')](function(){_0x4f4ded[_0x5da6('0x17')](0xcc)[_0x5da6('0x18')]();});}};}function handleEntityNotFound(_0x10aafd,_0x62e9e5){return function(_0xe3c921){if(!_0xe3c921){_0x10aafd[_0x5da6('0x23')](0x194);}return _0xe3c921;};}function handleError(_0x35270f,_0x423b4f){_0x423b4f=_0x423b4f||0x1f4;return function(_0x1f95ff){logger[_0x5da6('0x24')](_0x1f95ff[_0x5da6('0x25')]);if(_0x1f95ff[_0x5da6('0x26')]){delete _0x1f95ff['name'];}_0x35270f[_0x5da6('0x17')](_0x423b4f)[_0x5da6('0x27')](_0x1f95ff);};}exports[_0x5da6('0x28')]=function(_0x47ba1f,_0x3bdccb){var _0x5ed07a={},_0x561dd7={},_0x513b76={'count':0x0,'rows':[]};var _0x317bdc=db[_0x5da6('0x29')][_0x5da6('0x2a')];_0x561dd7['model']=_[_0x5da6('0x2b')](_[_0x5da6('0x2c')](_0x317bdc),[_0x5da6('0x26')]);var _0x3cbdf2={'dateStart':_0x47ba1f[_0x5da6('0x2d')][_0x5da6('0x2e')],'dateEnd':_0x47ba1f[_0x5da6('0x2d')][_0x5da6('0x2f')]};delete _0x47ba1f[_0x5da6('0x2d')][_0x5da6('0x2e')];delete _0x47ba1f['query']['dateEnd'];_0x561dd7['query']=_[_0x5da6('0x2c')](_0x47ba1f['query']);_0x561dd7[_0x5da6('0x30')]=_[_0x5da6('0x31')](_0x561dd7['model'],_0x561dd7[_0x5da6('0x2d')]);_0x5ed07a['attributes']=_[_0x5da6('0x31')](_0x561dd7[_0x5da6('0x32')],qs[_0x5da6('0x33')](_0x47ba1f[_0x5da6('0x2d')][_0x5da6('0x33')]));_0x5ed07a[_0x5da6('0x34')]=_0x5ed07a[_0x5da6('0x34')][_0x5da6('0x35')]?_0x5ed07a[_0x5da6('0x34')]:_0x561dd7[_0x5da6('0x32')];if(!_0x47ba1f[_0x5da6('0x2d')][_0x5da6('0x36')](_0x5da6('0x37'))){_0x5ed07a['limit']=qs[_0x5da6('0x38')](_0x47ba1f[_0x5da6('0x2d')]['limit']);_0x5ed07a['offset']=qs[_0x5da6('0x1a')](_0x47ba1f['query']['offset']);}_0x5ed07a[_0x5da6('0x39')]=qs[_0x5da6('0x3a')](_0x47ba1f['query'][_0x5da6('0x3a')]);_0x5ed07a[_0x5da6('0x3b')]=qs[_0x5da6('0x30')](_['pick'](_0x47ba1f[_0x5da6('0x2d')],_0x561dd7['filters']));if(_0x3cbdf2[_0x5da6('0x2e')]){if(_0x3cbdf2[_0x5da6('0x2f')]){_0x3cbdf2[_0x5da6('0x2f')]=moment(_0x3cbdf2['dateEnd'])[_0x5da6('0x3c')](0x1,_0x5da6('0x3d'));}else{_0x3cbdf2[_0x5da6('0x2f')]=moment(_0x3cbdf2[_0x5da6('0x2e')])['add'](0x1,_0x5da6('0x3d'));}_['merge'](_0x5ed07a[_0x5da6('0x3b')],{'createdAt':{'$gte':_0x3cbdf2[_0x5da6('0x2e')],'$lte':_0x3cbdf2['dateEnd']}});}if(_0x47ba1f[_0x5da6('0x2d')][_0x5da6('0x3e')]){_0x5ed07a[_0x5da6('0x3b')]=_['merge'](_0x5ed07a[_0x5da6('0x3b')],{'$or':_[_0x5da6('0x3f')](_0x5ed07a[_0x5da6('0x34')],function(_0x2ca512){var _0x39e3b0={};_0x39e3b0[_0x2ca512]={'$like':'%'+_0x47ba1f[_0x5da6('0x2d')]['filter']+'%'};return _0x39e3b0;})});}_0x5ed07a=_[_0x5da6('0x40')]({},_0x5ed07a,_0x47ba1f['options']);var _0x4d331a={'where':_0x5ed07a[_0x5da6('0x3b')]};return db[_0x5da6('0x29')][_0x5da6('0x19')](_0x4d331a)[_0x5da6('0x21')](function(_0x24a4cf){_0x513b76[_0x5da6('0x19')]=_0x24a4cf;if(_0x47ba1f[_0x5da6('0x2d')]['includeAll']){_0x5ed07a[_0x5da6('0x41')]=[{'all':!![]}];}return db[_0x5da6('0x29')][_0x5da6('0x42')](_0x5ed07a);})['then'](function(_0x2021c4){_0x513b76[_0x5da6('0x43')]=_0x2021c4;return _0x513b76;})['then'](respondWithFilteredResult(_0x3bdccb,_0x5ed07a))[_0x5da6('0x44')](handleError(_0x3bdccb,null));};exports['show']=function(_0x378309,_0xafb1b6){var _0x22d7db={'raw':!![],'where':{'id':_0x378309['params']['id']}},_0x18aebe={};_0x18aebe[_0x5da6('0x32')]=_[_0x5da6('0x2c')](db['CmCustomField'][_0x5da6('0x2a')]);_0x18aebe[_0x5da6('0x2d')]=_['keys'](_0x378309['query']);_0x18aebe['filters']=_[_0x5da6('0x31')](_0x18aebe[_0x5da6('0x32')],_0x18aebe[_0x5da6('0x2d')]);_0x22d7db[_0x5da6('0x34')]=_[_0x5da6('0x31')](_0x18aebe[_0x5da6('0x32')],qs[_0x5da6('0x33')](_0x378309[_0x5da6('0x2d')][_0x5da6('0x33')]));_0x22d7db[_0x5da6('0x34')]=_0x22d7db[_0x5da6('0x34')][_0x5da6('0x35')]?_0x22d7db[_0x5da6('0x34')]:_0x18aebe[_0x5da6('0x32')];if(_0x378309[_0x5da6('0x2d')][_0x5da6('0x45')]){_0x22d7db['include']=[{'all':!![]}];}_0x22d7db=_['merge']({},_0x22d7db,_0x378309[_0x5da6('0x46')]);return db[_0x5da6('0x29')]['find'](_0x22d7db)[_0x5da6('0x21')](handleEntityNotFound(_0xafb1b6,null))['then'](respondWithResult(_0xafb1b6,null))['catch'](handleError(_0xafb1b6,null));};exports[_0x5da6('0x20')]=function(_0x478bd9,_0x5962d2){if(_0x478bd9['body']['id']){delete _0x478bd9[_0x5da6('0x47')]['id'];}return db[_0x5da6('0x29')]['find']({'where':{'id':_0x478bd9['params']['id']}})[_0x5da6('0x21')](handleEntityNotFound(_0x5962d2,null))[_0x5da6('0x21')](saveUpdates(_0x478bd9[_0x5da6('0x47')],null))[_0x5da6('0x21')](respondWithResult(_0x5962d2,null))[_0x5da6('0x44')](handleError(_0x5962d2,null));};exports['destroy']=function(_0x3e5343,_0x1372c8){return db[_0x5da6('0x29')][_0x5da6('0x48')]({'where':{'id':_0x3e5343[_0x5da6('0x49')]['id']}})['then'](handleEntityNotFound(_0x1372c8,null))[_0x5da6('0x21')](removeEntity(_0x1372c8,null))['catch'](handleError(_0x1372c8,null));};exports[_0x5da6('0x4a')]=function(_0x179dc5,_0x543f83){var _0x4e61aa;return db['sequelize'][_0x5da6('0x4b')](function(_0x590948){return db[_0x5da6('0x29')][_0x5da6('0x4a')](_0x179dc5[_0x5da6('0x47')],{'transaction':_0x590948})['then'](function(_0xf3c8a3){_0x4e61aa=_0xf3c8a3;var _0x53a565={'type':db[_0x5da6('0x4c')][_0x5da6('0x4d')],'transaction':_0x590948};switch(_0x179dc5['body'][_0x5da6('0x4e')]){case'text':_0x53a565[_0x5da6('0x4e')]=db[_0x5da6('0x4c')][_0x5da6('0x4d')];break;case _0x5da6('0x4f'):_0x53a565[_0x5da6('0x4e')]=db[_0x5da6('0x4c')][_0x5da6('0x50')];break;case _0x5da6('0x51'):_0x53a565[_0x5da6('0x4e')]=db[_0x5da6('0x4c')][_0x5da6('0x52')];_0x53a565['defaultValue']=![];break;default:}return db[_0x5da6('0x53')][_0x5da6('0x54')][_0x5da6('0x55')](_0x5da6('0x56'),util[_0x5da6('0x57')](_0x5da6('0x58'),_0x4e61aa['id']),_0x53a565);})[_0x5da6('0x21')](function(){return _0x4e61aa;});})[_0x5da6('0x21')](respondWithResult(_0x543f83,0xc9))[_0x5da6('0x44')](handleError(_0x543f83,null));}; \ No newline at end of file +var _0x0370=['Sequelize','TEXT','type','text','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','addColumn','format','cf_%d','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','limit','Content-Range','reject','save','update','then','destroy','end','stack','name','send','index','rawAttributes','model','differenceBy','keys','query','dateStart','dateEnd','filters','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','add','day','merge','filter','map','options','include','CmCustomField','findAll','rows','catch','intersection','includeAll','find','body','params','create'];(function(_0x43884a,_0x154135){var _0x55c82a=function(_0x44428f){while(--_0x44428f){_0x43884a['push'](_0x43884a['shift']());}};_0x55c82a(++_0x154135);}(_0x0370,0x1c5));var _0x0037=function(_0x9dd57e,_0x4a8fd9){_0x9dd57e=_0x9dd57e-0x0;var _0x533cf5=_0x0370[_0x9dd57e];return _0x533cf5;};'use strict';var pdf=require(_0x0037('0x0'));var emlformat=require(_0x0037('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0037('0x2'));var jsonpatch=require(_0x0037('0x3'));var rp=require(_0x0037('0x4'));var moment=require(_0x0037('0x5'));var BPromise=require(_0x0037('0x6'));var Mustache=require(_0x0037('0x7'));var util=require('util');var path=require('path');var sox=require(_0x0037('0x8'));var csv=require(_0x0037('0x9'));var ejs=require(_0x0037('0xa'));var fs=require('fs');var _=require(_0x0037('0xb'));var squel=require(_0x0037('0xc'));var crypto=require(_0x0037('0xd'));var jsforce=require(_0x0037('0xe'));var deskjs=require(_0x0037('0xf'));var toCsv=require(_0x0037('0x9'));var querystring=require(_0x0037('0x10'));var Papa=require(_0x0037('0x11'));var Redis=require(_0x0037('0x12'));var qs=require('../../components/parsers/qs');var logger=require(_0x0037('0x13'))(_0x0037('0x14'));var utils=require(_0x0037('0x15'));var config=require(_0x0037('0x16'));var db=require(_0x0037('0x17'))['db'];function respondWithStatusCode(_0x25f074,_0x545640){_0x545640=_0x545640||0xcc;return function(_0x393e8a){if(_0x393e8a){return _0x25f074[_0x0037('0x18')](_0x545640);}return _0x25f074[_0x0037('0x19')](_0x545640)['end']();};}function respondWithResult(_0x4f1c57,_0xce26af){_0xce26af=_0xce26af||0xc8;return function(_0x4f577d){if(_0x4f577d){return _0x4f1c57[_0x0037('0x19')](_0xce26af)[_0x0037('0x1a')](_0x4f577d);}};}function respondWithFilteredResult(_0x385de1,_0x1a1587){return function(_0x4de81b){if(_0x4de81b){var _0x9951e=_0x4de81b[_0x0037('0x1b')],_0x264a2c=_0x1a1587['offset'],_0x592c90=_0x1a1587['offset']+_0x1a1587[_0x0037('0x1c')],_0x141e40;if(_0x592c90>=_0x9951e){_0x592c90=_0x9951e;_0x141e40=0xc8;}else{_0x141e40=0xce;}_0x385de1[_0x0037('0x19')](_0x141e40);return _0x385de1['set'](_0x0037('0x1d'),_0x264a2c+'-'+_0x592c90+'/'+_0x9951e)[_0x0037('0x1a')](_0x4de81b);}return null;};}function patchUpdates(_0x55adc8){return function(_0x327209){try{jsonpatch['apply'](_0x327209,_0x55adc8,!![]);}catch(_0x15a479){return BPromise[_0x0037('0x1e')](_0x15a479);}return _0x327209[_0x0037('0x1f')]();};}function saveUpdates(_0x43d18e,_0x2dd2ce){return function(_0x345dee){if(_0x345dee){return _0x345dee[_0x0037('0x20')](_0x43d18e)[_0x0037('0x21')](function(_0x39772f){return _0x39772f;});}return null;};}function removeEntity(_0x36431d,_0x59a1e2){return function(_0x22097f){if(_0x22097f){return _0x22097f[_0x0037('0x22')]()['then'](function(){_0x36431d['status'](0xcc)[_0x0037('0x23')]();});}};}function handleEntityNotFound(_0x2fd86a,_0x1d156b){return function(_0x55c514){if(!_0x55c514){_0x2fd86a[_0x0037('0x18')](0x194);}return _0x55c514;};}function handleError(_0x35116f,_0x48d1a4){_0x48d1a4=_0x48d1a4||0x1f4;return function(_0x1a885a){logger['error'](_0x1a885a[_0x0037('0x24')]);if(_0x1a885a[_0x0037('0x25')]){delete _0x1a885a[_0x0037('0x25')];}_0x35116f[_0x0037('0x19')](_0x48d1a4)[_0x0037('0x26')](_0x1a885a);};}exports[_0x0037('0x27')]=function(_0x5b70ca,_0x488c22){var _0x43e32a={},_0x5f4ac3={},_0x2ee012={'count':0x0,'rows':[]};var _0x34c48a=db['CmCustomField'][_0x0037('0x28')];_0x5f4ac3[_0x0037('0x29')]=_[_0x0037('0x2a')](_[_0x0037('0x2b')](_0x34c48a),[_0x0037('0x25')]);var _0x40b550={'dateStart':_0x5b70ca[_0x0037('0x2c')][_0x0037('0x2d')],'dateEnd':_0x5b70ca[_0x0037('0x2c')][_0x0037('0x2e')]};delete _0x5b70ca[_0x0037('0x2c')]['dateStart'];delete _0x5b70ca[_0x0037('0x2c')]['dateEnd'];_0x5f4ac3[_0x0037('0x2c')]=_[_0x0037('0x2b')](_0x5b70ca[_0x0037('0x2c')]);_0x5f4ac3[_0x0037('0x2f')]=_['intersection'](_0x5f4ac3[_0x0037('0x29')],_0x5f4ac3['query']);_0x43e32a[_0x0037('0x30')]=_['intersection'](_0x5f4ac3[_0x0037('0x29')],qs[_0x0037('0x31')](_0x5b70ca['query'][_0x0037('0x31')]));_0x43e32a[_0x0037('0x30')]=_0x43e32a[_0x0037('0x30')][_0x0037('0x32')]?_0x43e32a[_0x0037('0x30')]:_0x5f4ac3[_0x0037('0x29')];if(!_0x5b70ca['query'][_0x0037('0x33')](_0x0037('0x34'))){_0x43e32a['limit']=qs[_0x0037('0x1c')](_0x5b70ca[_0x0037('0x2c')]['limit']);_0x43e32a[_0x0037('0x35')]=qs['offset'](_0x5b70ca[_0x0037('0x2c')][_0x0037('0x35')]);}_0x43e32a[_0x0037('0x36')]=qs[_0x0037('0x37')](_0x5b70ca['query'][_0x0037('0x37')]);_0x43e32a[_0x0037('0x38')]=qs[_0x0037('0x2f')](_[_0x0037('0x39')](_0x5b70ca[_0x0037('0x2c')],_0x5f4ac3[_0x0037('0x2f')]));if(_0x40b550[_0x0037('0x2d')]){if(_0x40b550['dateEnd']){_0x40b550[_0x0037('0x2e')]=moment(_0x40b550[_0x0037('0x2e')])[_0x0037('0x3a')](0x1,_0x0037('0x3b'));}else{_0x40b550[_0x0037('0x2e')]=moment(_0x40b550['dateStart'])[_0x0037('0x3a')](0x1,_0x0037('0x3b'));}_[_0x0037('0x3c')](_0x43e32a[_0x0037('0x38')],{'createdAt':{'$gte':_0x40b550[_0x0037('0x2d')],'$lte':_0x40b550[_0x0037('0x2e')]}});}if(_0x5b70ca['query'][_0x0037('0x3d')]){_0x43e32a['where']=_[_0x0037('0x3c')](_0x43e32a[_0x0037('0x38')],{'$or':_[_0x0037('0x3e')](_0x43e32a[_0x0037('0x30')],function(_0x213fe8){var _0x315d49={};_0x315d49[_0x213fe8]={'$like':'%'+_0x5b70ca[_0x0037('0x2c')][_0x0037('0x3d')]+'%'};return _0x315d49;})});}_0x43e32a=_[_0x0037('0x3c')]({},_0x43e32a,_0x5b70ca[_0x0037('0x3f')]);var _0x1108e0={'where':_0x43e32a[_0x0037('0x38')]};return db['CmCustomField']['count'](_0x1108e0)[_0x0037('0x21')](function(_0x8d9acd){_0x2ee012[_0x0037('0x1b')]=_0x8d9acd;if(_0x5b70ca['query']['includeAll']){_0x43e32a[_0x0037('0x40')]=[{'all':!![]}];}return db[_0x0037('0x41')][_0x0037('0x42')](_0x43e32a);})[_0x0037('0x21')](function(_0x214127){_0x2ee012[_0x0037('0x43')]=_0x214127;return _0x2ee012;})[_0x0037('0x21')](respondWithFilteredResult(_0x488c22,_0x43e32a))[_0x0037('0x44')](handleError(_0x488c22,null));};exports['show']=function(_0x166559,_0x42feec){var _0x1daccd={'raw':!![],'where':{'id':_0x166559['params']['id']}},_0x3609c0={};_0x3609c0[_0x0037('0x29')]=_[_0x0037('0x2b')](db[_0x0037('0x41')][_0x0037('0x28')]);_0x3609c0[_0x0037('0x2c')]=_[_0x0037('0x2b')](_0x166559['query']);_0x3609c0['filters']=_[_0x0037('0x45')](_0x3609c0[_0x0037('0x29')],_0x3609c0[_0x0037('0x2c')]);_0x1daccd['attributes']=_[_0x0037('0x45')](_0x3609c0['model'],qs['fields'](_0x166559[_0x0037('0x2c')][_0x0037('0x31')]));_0x1daccd[_0x0037('0x30')]=_0x1daccd[_0x0037('0x30')]['length']?_0x1daccd[_0x0037('0x30')]:_0x3609c0[_0x0037('0x29')];if(_0x166559[_0x0037('0x2c')][_0x0037('0x46')]){_0x1daccd['include']=[{'all':!![]}];}_0x1daccd=_['merge']({},_0x1daccd,_0x166559['options']);return db[_0x0037('0x41')][_0x0037('0x47')](_0x1daccd)[_0x0037('0x21')](handleEntityNotFound(_0x42feec,null))[_0x0037('0x21')](respondWithResult(_0x42feec,null))[_0x0037('0x44')](handleError(_0x42feec,null));};exports[_0x0037('0x20')]=function(_0xad0050,_0x4f396c){if(_0xad0050[_0x0037('0x48')]['id']){delete _0xad0050['body']['id'];}return db['CmCustomField'][_0x0037('0x47')]({'where':{'id':_0xad0050[_0x0037('0x49')]['id']}})['then'](handleEntityNotFound(_0x4f396c,null))[_0x0037('0x21')](saveUpdates(_0xad0050[_0x0037('0x48')],null))['then'](respondWithResult(_0x4f396c,null))[_0x0037('0x44')](handleError(_0x4f396c,null));};exports[_0x0037('0x22')]=function(_0x30d994,_0x38be96){return db[_0x0037('0x41')][_0x0037('0x47')]({'where':{'id':_0x30d994['params']['id']}})[_0x0037('0x21')](handleEntityNotFound(_0x38be96,null))['then'](removeEntity(_0x38be96,null))[_0x0037('0x44')](handleError(_0x38be96,null));};exports[_0x0037('0x4a')]=function(_0x4ba394,_0x30d011){var _0x34fe4c;return db['sequelize']['transaction'](function(_0x35ff33){return db['CmCustomField'][_0x0037('0x4a')](_0x4ba394[_0x0037('0x48')],{'transaction':_0x35ff33})[_0x0037('0x21')](function(_0x40cfbf){_0x34fe4c=_0x40cfbf;var _0x3f1a15={'type':db[_0x0037('0x4b')][_0x0037('0x4c')],'transaction':_0x35ff33};switch(_0x4ba394[_0x0037('0x48')][_0x0037('0x4d')]){case _0x0037('0x4e'):_0x3f1a15[_0x0037('0x4d')]=db[_0x0037('0x4b')][_0x0037('0x4c')];break;case _0x0037('0x4f'):_0x3f1a15[_0x0037('0x4d')]=db[_0x0037('0x4b')][_0x0037('0x50')];break;case _0x0037('0x51'):_0x3f1a15[_0x0037('0x4d')]=db[_0x0037('0x4b')][_0x0037('0x52')];_0x3f1a15[_0x0037('0x53')]=![];break;default:}return db[_0x0037('0x54')]['queryInterface'][_0x0037('0x55')]('cm_contacts',util[_0x0037('0x56')](_0x0037('0x57'),_0x34fe4c['id']),_0x3f1a15);})['then'](function(){return _0x34fe4c;});})[_0x0037('0x21')](respondWithResult(_0x30d011,0xc9))[_0x0037('0x44')](handleError(_0x30d011,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 641e613..ee471e2 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 _0xb1ba=['util','api','moment','bluebird','./cmCustomField.attributes','define','CmCustomField','cm_custom_fields'];(function(_0x2e8e5b,_0xc04c50){var _0x3e97c2=function(_0xb8cc69){while(--_0xb8cc69){_0x2e8e5b['push'](_0x2e8e5b['shift']());}};_0x3e97c2(++_0xc04c50);}(_0xb1ba,0x70));var _0xab1b=function(_0x34f63e,_0x23d549){_0x34f63e=_0x34f63e-0x0;var _0x3859df=_0xb1ba[_0x34f63e];return _0x3859df;};'use strict';var _=require('lodash');var util=require(_0xab1b('0x0'));var logger=require('../../config/logger')(_0xab1b('0x1'));var moment=require(_0xab1b('0x2'));var BPromise=require(_0xab1b('0x3'));var rp=require('request-promise');var attributes=require(_0xab1b('0x4'));module['exports']=function(_0x4ceb55,_0x3b6276){return _0x4ceb55[_0xab1b('0x5')](_0xab1b('0x6'),attributes,{'tableName':_0xab1b('0x7'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4daa=['bluebird','request-promise','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','api'];(function(_0x29d5fd,_0x4db50f){var _0x502df9=function(_0x45f8af){while(--_0x45f8af){_0x29d5fd['push'](_0x29d5fd['shift']());}};_0x502df9(++_0x4db50f);}(_0x4daa,0x17f));var _0xa4da=function(_0x503254,_0x29e551){_0x503254=_0x503254-0x0;var _0x383dcc=_0x4daa[_0x503254];return _0x383dcc;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xa4da('0x0'));var moment=require('moment');var BPromise=require(_0xa4da('0x1'));var rp=require(_0xa4da('0x2'));var attributes=require(_0xa4da('0x3'));module[_0xa4da('0x4')]=function(_0x58f4db,_0x2d3e2a){return _0x58f4db[_0xa4da('0x5')](_0xa4da('0x6'),attributes,{'tableName':_0xa4da('0x7'),'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 8454b8e..9beafb2 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 _0x63a3=['then','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmCustomField,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x63a3,0x1f0));var _0x363a=function(_0x4e5552,_0x19ec4e){_0x4e5552=_0x4e5552-0x0;var _0x60a338=_0x63a3[_0x4e5552];return _0x60a338;};'use strict';var _=require(_0x363a('0x0'));var util=require('util');var moment=require(_0x363a('0x1'));var BPromise=require(_0x363a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x363a('0x3'));var db=require(_0x363a('0x4'))['db'];var utils=require(_0x363a('0x5'));var logger=require('../../config/logger')(_0x363a('0x6'));var config=require(_0x363a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x363a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f79ad,_0xdcfa4b,_0x245b20){return new BPromise(function(_0x4d1860,_0x1b3538){return client[_0x363a('0x9')](_0x1f79ad,_0x245b20)[_0x363a('0xa')](function(_0x590aec){logger[_0x363a('0xb')]('CmCustomField,\x20%s,\x20%s',_0xdcfa4b,_0x363a('0xc'));logger[_0x363a('0xd')](_0x363a('0xe'),_0xdcfa4b,_0x363a('0xc'),JSON[_0x363a('0xf')](_0x590aec));if(_0x590aec['error']){if(_0x590aec[_0x363a('0x10')][_0x363a('0x11')]===0x1f4){logger[_0x363a('0x10')]('CmCustomField,\x20%s,\x20%s',_0xdcfa4b,_0x590aec[_0x363a('0x10')][_0x363a('0x12')]);return _0x1b3538(_0x590aec[_0x363a('0x10')]['message']);}logger[_0x363a('0x10')](_0x363a('0x13'),_0xdcfa4b,_0x590aec[_0x363a('0x10')][_0x363a('0x12')]);return _0x4d1860(_0x590aec[_0x363a('0x10')][_0x363a('0x12')]);}else{logger[_0x363a('0xb')](_0x363a('0x13'),_0xdcfa4b,_0x363a('0xc'));_0x4d1860(_0x590aec[_0x363a('0x14')]['message']);}})[_0x363a('0x15')](function(_0x18949f){logger['error']('CmCustomField,\x20%s,\x20%s',_0xdcfa4b,_0x18949f);_0x1b3538(_0x18949f);});});} \ No newline at end of file +var _0xee2a=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','util','moment'];(function(_0x47d2ee,_0x4b7340){var _0x54738f=function(_0x159c9f){while(--_0x159c9f){_0x47d2ee['push'](_0x47d2ee['shift']());}};_0x54738f(++_0x4b7340);}(_0xee2a,0x1cc));var _0xaee2=function(_0x480362,_0x247c11){_0x480362=_0x480362-0x0;var _0x10b755=_0xee2a[_0x480362];return _0x10b755;};'use strict';var _=require('lodash');var util=require(_0xaee2('0x0'));var moment=require(_0xaee2('0x1'));var BPromise=require(_0xaee2('0x2'));var rs=require(_0xaee2('0x3'));var fs=require('fs');var Redis=require(_0xaee2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xaee2('0x5'));var logger=require(_0xaee2('0x6'))(_0xaee2('0x7'));var config=require(_0xaee2('0x8'));var jayson=require(_0xaee2('0x9'));var client=jayson[_0xaee2('0xa')][_0xaee2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a6e11,_0x16899c,_0x36e0aa){return new BPromise(function(_0xd288cd,_0x242c57){return client[_0xaee2('0xc')](_0x2a6e11,_0x36e0aa)['then'](function(_0x296342){logger['info'](_0xaee2('0xd'),_0x16899c,_0xaee2('0xe'));logger[_0xaee2('0xf')](_0xaee2('0x10'),_0x16899c,'request\x20sent',JSON['stringify'](_0x296342));if(_0x296342[_0xaee2('0x11')]){if(_0x296342[_0xaee2('0x11')]['code']===0x1f4){logger['error'](_0xaee2('0xd'),_0x16899c,_0x296342[_0xaee2('0x11')][_0xaee2('0x12')]);return _0x242c57(_0x296342[_0xaee2('0x11')][_0xaee2('0x12')]);}logger[_0xaee2('0x11')](_0xaee2('0xd'),_0x16899c,_0x296342['error'][_0xaee2('0x12')]);return _0xd288cd(_0x296342[_0xaee2('0x11')][_0xaee2('0x12')]);}else{logger[_0xaee2('0x13')]('CmCustomField,\x20%s,\x20%s',_0x16899c,'request\x20sent');_0xd288cd(_0x296342[_0xaee2('0x14')][_0xaee2('0x12')]);}})[_0xaee2('0x15')](function(_0xa1ea53){logger[_0xaee2('0x11')]('CmCustomField,\x20%s,\x20%s',_0x16899c,_0xa1ea53);_0x242c57(_0xa1ea53);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 13d492f..7ca7926 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 _0xb205=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','/:id','show','post','put','update'];(function(_0x457b64,_0x49a219){var _0x437111=function(_0x3dad3d){while(--_0x3dad3d){_0x457b64['push'](_0x457b64['shift']());}};_0x437111(++_0x49a219);}(_0xb205,0x120));var _0x5b20=function(_0x47fb4e,_0x4c4fd5){_0x47fb4e=_0x47fb4e-0x0;var _0x5d7964=_0xb205[_0x47fb4e];return _0x5d7964;};'use strict';var multer=require(_0x5b20('0x0'));var util=require(_0x5b20('0x1'));var path=require(_0x5b20('0x2'));var timeout=require(_0x5b20('0x3'));var express=require(_0x5b20('0x4'));var router=express[_0x5b20('0x5')]();var auth=require(_0x5b20('0x6'));var interaction=require(_0x5b20('0x7'));var config=require('../../config/environment');var controller=require(_0x5b20('0x8'));router[_0x5b20('0x9')]('/',auth[_0x5b20('0xa')](),controller['index']);router[_0x5b20('0x9')](_0x5b20('0xb'),auth[_0x5b20('0xa')](),controller[_0x5b20('0xc')]);router[_0x5b20('0xd')]('/',auth[_0x5b20('0xa')](),controller['create']);router[_0x5b20('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x5b20('0xf')]);router[_0x5b20('0x10')](_0x5b20('0xb'),auth['isAuthenticated'](),controller[_0x5b20('0x11')]);module[_0x5b20('0x12')]=router; \ No newline at end of file +var _0x0e4a=['../../config/environment','./cmCustomField.controller','get','isAuthenticated','/:id','show','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1d040a,_0x375b4b){var _0x193b94=function(_0x41f424){while(--_0x41f424){_0x1d040a['push'](_0x1d040a['shift']());}};_0x193b94(++_0x375b4b);}(_0x0e4a,0xd8));var _0xa0e4=function(_0x219a59,_0x726a68){_0x219a59=_0x219a59-0x0;var _0x1a47b0=_0x0e4a[_0x219a59];return _0x1a47b0;};'use strict';var multer=require(_0xa0e4('0x0'));var util=require(_0xa0e4('0x1'));var path=require(_0xa0e4('0x2'));var timeout=require(_0xa0e4('0x3'));var express=require(_0xa0e4('0x4'));var router=express[_0xa0e4('0x5')]();var auth=require(_0xa0e4('0x6'));var interaction=require(_0xa0e4('0x7'));var config=require(_0xa0e4('0x8'));var controller=require(_0xa0e4('0x9'));router[_0xa0e4('0xa')]('/',auth[_0xa0e4('0xb')](),controller['index']);router['get'](_0xa0e4('0xc'),auth[_0xa0e4('0xb')](),controller[_0xa0e4('0xd')]);router['post']('/',auth[_0xa0e4('0xb')](),controller['create']);router['put'](_0xa0e4('0xc'),auth[_0xa0e4('0xb')](),controller[_0xa0e4('0xe')]);router[_0xa0e4('0xf')](_0xa0e4('0xc'),auth[_0xa0e4('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 4c28ca2..7bf766e 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 _0x7b71=['STRING','BOOLEAN','format','INTEGER','UNSIGNED','contactListQueue','sequelize'];(function(_0x217abb,_0x5cdb09){var _0x41b292=function(_0x3764d3){while(--_0x3764d3){_0x217abb['push'](_0x217abb['shift']());}};_0x41b292(++_0x5cdb09);}(_0x7b71,0xb5));var _0x17b7=function(_0x3fd275,_0xf0cd7){_0x3fd275=_0x3fd275-0x0;var _0xe4f14f=_0x7b71[_0x3fd275];return _0xe4f14f;};'use strict';var moment=require('moment');var Sequelize=require(_0x17b7('0x0'));module['exports']={'phone':{'type':Sequelize[_0x17b7('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x17b7('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x17b7('0x3')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x17b7('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x17b7('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x17b7('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x17b7('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x17b7('0x4')](0x2)[_0x17b7('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x17b7('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x17b7('0x6')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x17b7('0x6')},'UserId':{'type':Sequelize[_0x17b7('0x4')]},'VoiceQueueId':{'type':Sequelize[_0x17b7('0x4')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x17b7('0x4')]}}; \ No newline at end of file +var _0x42e5=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','contactListQueue','moment','sequelize','BOOLEAN'];(function(_0xbdc30f,_0xcd720a){var _0x3ffc99=function(_0x3bccd6){while(--_0x3bccd6){_0xbdc30f['push'](_0xbdc30f['shift']());}};_0x3ffc99(++_0xcd720a);}(_0x42e5,0x126));var _0x542e=function(_0x5f2668,_0x29630f){_0x5f2668=_0x5f2668-0x0;var _0x42df13=_0x42e5[_0x5f2668];return _0x42df13;};'use strict';var moment=require(_0x542e('0x0'));var Sequelize=require(_0x542e('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x542e('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x542e('0x3')],'defaultValue':moment()[_0x542e('0x4')](_0x542e('0x5'))},'countbusyretry':{'type':Sequelize[_0x542e('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x542e('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x542e('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x542e('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x542e('0x7')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x542e('0x6')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x542e('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x542e('0x8')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x542e('0x8')},'UserId':{'type':Sequelize[_0x542e('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x542e('0x6')],'unique':_0x542e('0x8')},'CampaignId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index c0eaf4d..343ee36 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 _0x56ce=['$eq','$not','$between','$in','$notIn','$like','$notLike','$notILike','$overlap','$any','attributes','fields','hasOwnProperty','nolimit','order','sort','where','add','day','merge','filter','map','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','update','params','Campaign','VoiceQueueId','CampaignId','dataValues','createdAt','updatedAt','state','deleted','campaign','membername','user','format','calleridnum','phone','campaigntype','queue','ivr','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','describe','getVoiceQueues','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','direction','isEmpty','hopperIds','priority','ASC','dialOrderByScheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','findOne','scheduledat','LOCK','UPDATE','CmContact','Contact','CmCompany','Company','CmList','Queue','dialActive','getOpenContacts','outbound','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','then','destroy','end','error','name','send','index','CmHopper','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','concat','$and','$or','$gt','$lte','$ne'];(function(_0xf5c66c,_0x2b59be){var _0x4cf978=function(_0xc84ef3){while(--_0xc84ef3){_0xf5c66c['push'](_0xf5c66c['shift']());}};_0x4cf978(++_0x2b59be);}(_0x56ce,0x178));var _0xe56c=function(_0x4eec41,_0x4af565){_0x4eec41=_0x4eec41-0x0;var _0x20b452=_0x56ce[_0x4eec41];return _0x20b452;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe56c('0x0'));var rimraf=require(_0xe56c('0x1'));var zipdir=require(_0xe56c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe56c('0x3'));var moment=require(_0xe56c('0x4'));var BPromise=require(_0xe56c('0x5'));var Mustache=require(_0xe56c('0x6'));var util=require(_0xe56c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xe56c('0x8'));var ejs=require(_0xe56c('0x9'));var fs=require('fs');var _=require(_0xe56c('0xa'));var squel=require(_0xe56c('0xb'));var crypto=require('crypto');var jsforce=require(_0xe56c('0xc'));var deskjs=require(_0xe56c('0xd'));var toCsv=require(_0xe56c('0x8'));var querystring=require(_0xe56c('0xe'));var Papa=require(_0xe56c('0xf'));var Redis=require(_0xe56c('0x10'));var qs=require(_0xe56c('0x11'));var logger=require(_0xe56c('0x12'))(_0xe56c('0x13'));var utils=require(_0xe56c('0x14'));var config=require('../../config/environment');var db=require(_0xe56c('0x15'))['db'];function respondWithStatusCode(_0x335a3e,_0xa19516){_0xa19516=_0xa19516||0xcc;return function(_0xe6d969){if(_0xe6d969){return _0x335a3e[_0xe56c('0x16')](_0xa19516);}return _0x335a3e[_0xe56c('0x17')](_0xa19516)['end']();};}function respondWithResult(_0x574861,_0x5c1e8){_0x5c1e8=_0x5c1e8||0xc8;return function(_0xf55718){if(_0xf55718){return _0x574861[_0xe56c('0x17')](_0x5c1e8)[_0xe56c('0x18')](_0xf55718);}};}function respondWithFilteredResult(_0x9e0bdb,_0x338f02){return function(_0x5d8e48){if(_0x5d8e48){var _0x27db35=_0x5d8e48[_0xe56c('0x19')],_0x3caef4=_0x338f02[_0xe56c('0x1a')],_0x2ae690=_0x338f02[_0xe56c('0x1a')]+_0x338f02[_0xe56c('0x1b')],_0x4b5396;if(_0x2ae690>=_0x27db35){_0x2ae690=_0x27db35;_0x4b5396=0xc8;}else{_0x4b5396=0xce;}_0x9e0bdb[_0xe56c('0x17')](_0x4b5396);return _0x9e0bdb['set'](_0xe56c('0x1c'),_0x3caef4+'-'+_0x2ae690+'/'+_0x27db35)[_0xe56c('0x18')](_0x5d8e48);}return null;};}function patchUpdates(_0x21f7b1){return function(_0x11fa9e){try{jsonpatch[_0xe56c('0x1d')](_0x11fa9e,_0x21f7b1,!![]);}catch(_0x4ba6a5){return BPromise[_0xe56c('0x1e')](_0x4ba6a5);}return _0x11fa9e['save']();};}function saveUpdates(_0x405340,_0x42caf6){return function(_0x1a4a7f){if(_0x1a4a7f){return _0x1a4a7f['update'](_0x405340)[_0xe56c('0x1f')](function(_0xe866d9){return _0xe866d9;});}return null;};}function removeEntity(_0x2f03f3,_0x306711){return function(_0x41c9b2){if(_0x41c9b2){return _0x41c9b2[_0xe56c('0x20')]()[_0xe56c('0x1f')](function(){_0x2f03f3['status'](0xcc)[_0xe56c('0x21')]();});}};}function handleEntityNotFound(_0x50d511,_0x9b7c7){return function(_0x430485){if(!_0x430485){_0x50d511[_0xe56c('0x16')](0x194);}return _0x430485;};}function handleError(_0x162fe2,_0x54e67c){_0x54e67c=_0x54e67c||0x1f4;return function(_0x298586){logger[_0xe56c('0x22')](_0x298586['stack']);if(_0x298586[_0xe56c('0x23')]){delete _0x298586['name'];}_0x162fe2['status'](_0x54e67c)[_0xe56c('0x24')](_0x298586);};}exports[_0xe56c('0x25')]=function(_0x86a3c0,_0xfbbdea){var _0x577a80={},_0x580534={},_0x151ca1={'count':0x0,'rows':[]};var _0x84bb0a=db[_0xe56c('0x26')][_0xe56c('0x27')];_0x580534[_0xe56c('0x28')]=_[_0xe56c('0x29')](_0x84bb0a);var _0x397d75={'dateStart':_0x86a3c0[_0xe56c('0x2a')][_0xe56c('0x2b')],'dateEnd':_0x86a3c0[_0xe56c('0x2a')][_0xe56c('0x2c')]};delete _0x86a3c0[_0xe56c('0x2a')][_0xe56c('0x2b')];delete _0x86a3c0[_0xe56c('0x2a')][_0xe56c('0x2c')];_0x580534[_0xe56c('0x2a')]=_[_0xe56c('0x29')](_0x86a3c0['query']);_0x580534[_0xe56c('0x2d')]=_[_0xe56c('0x2e')](_0x580534[_0xe56c('0x28')],_0x580534[_0xe56c('0x2a')]);_0x580534['filters']=_[_0xe56c('0x2f')](_0x580534['filters'],[_0xe56c('0x30'),_0xe56c('0x31'),_0xe56c('0x32'),'$gte','$lt',_0xe56c('0x33'),_0xe56c('0x34'),_0xe56c('0x35'),_0xe56c('0x36'),_0xe56c('0x37'),'$notBetween',_0xe56c('0x38'),_0xe56c('0x39'),_0xe56c('0x3a'),_0xe56c('0x3b'),'$iLike',_0xe56c('0x3c'),_0xe56c('0x3a'),_0xe56c('0x3d'),'$contains','$contained',_0xe56c('0x3e')]);_0x577a80[_0xe56c('0x3f')]=_[_0xe56c('0x2e')](_0x580534[_0xe56c('0x28')],qs[_0xe56c('0x40')](_0x86a3c0[_0xe56c('0x2a')]['fields']));_0x577a80['attributes']=_0x577a80['attributes']['length']?_0x577a80[_0xe56c('0x3f')]:_0x580534[_0xe56c('0x28')];if(!_0x86a3c0['query'][_0xe56c('0x41')](_0xe56c('0x42'))){_0x577a80[_0xe56c('0x1b')]=qs[_0xe56c('0x1b')](_0x86a3c0[_0xe56c('0x2a')][_0xe56c('0x1b')]);_0x577a80[_0xe56c('0x1a')]=qs['offset'](_0x86a3c0[_0xe56c('0x2a')][_0xe56c('0x1a')]);}_0x577a80[_0xe56c('0x43')]=qs[_0xe56c('0x44')](_0x86a3c0['query'][_0xe56c('0x44')]);_0x577a80[_0xe56c('0x45')]=qs[_0xe56c('0x2d')](_['pick'](_0x86a3c0['query'],_0x580534[_0xe56c('0x2d')]));if(_0x397d75['dateStart']){if(_0x397d75[_0xe56c('0x2c')]){_0x397d75[_0xe56c('0x2c')]=moment(_0x397d75[_0xe56c('0x2c')])[_0xe56c('0x46')](0x1,_0xe56c('0x47'));}else{_0x397d75['dateEnd']=moment(_0x397d75[_0xe56c('0x2b')])[_0xe56c('0x46')](0x1,_0xe56c('0x47'));}_[_0xe56c('0x48')](_0x577a80[_0xe56c('0x45')],{'createdAt':{'$gte':_0x397d75['dateStart'],'$lte':_0x397d75['dateEnd']}});}if(_0x86a3c0[_0xe56c('0x2a')][_0xe56c('0x49')]){_0x577a80['where']=_[_0xe56c('0x48')](_0x577a80[_0xe56c('0x45')],{'$or':_[_0xe56c('0x4a')](_0x577a80[_0xe56c('0x3f')],function(_0x407d97){var _0x35a013={};_0x35a013[_0x407d97]={'$like':'%'+_0x86a3c0[_0xe56c('0x2a')][_0xe56c('0x49')]+'%'};return _0x35a013;})});}_0x577a80=_[_0xe56c('0x48')]({},_0x577a80,_0x86a3c0[_0xe56c('0x4b')]);var _0xe6f023={'where':_0x577a80[_0xe56c('0x45')]};return db['CmHopper'][_0xe56c('0x19')](_0xe6f023)[_0xe56c('0x1f')](function(_0x2b6137){_0x151ca1[_0xe56c('0x19')]=_0x2b6137;if(_0x86a3c0['query'][_0xe56c('0x4c')]){_0x577a80[_0xe56c('0x4d')]=[{'all':!![]}];}return db[_0xe56c('0x26')][_0xe56c('0x4e')](_0x577a80);})[_0xe56c('0x1f')](function(_0x1e2655){_0x151ca1[_0xe56c('0x4f')]=_0x1e2655;return _0x151ca1;})[_0xe56c('0x1f')](respondWithFilteredResult(_0xfbbdea,_0x577a80))[_0xe56c('0x50')](handleError(_0xfbbdea,null));};exports[_0xe56c('0x51')]=function(_0x4356c9,_0x40beb7){var _0x32ca31={'raw':!![],'where':{'id':_0x4356c9['params']['id']}},_0x25b77a={};_0x25b77a[_0xe56c('0x28')]=_[_0xe56c('0x29')](db[_0xe56c('0x26')][_0xe56c('0x27')]);_0x25b77a[_0xe56c('0x2a')]=_['keys'](_0x4356c9['query']);_0x25b77a[_0xe56c('0x2d')]=_[_0xe56c('0x2e')](_0x25b77a[_0xe56c('0x28')],_0x25b77a['query']);_0x32ca31[_0xe56c('0x3f')]=_[_0xe56c('0x2e')](_0x25b77a[_0xe56c('0x28')],qs['fields'](_0x4356c9[_0xe56c('0x2a')]['fields']));_0x32ca31[_0xe56c('0x3f')]=_0x32ca31[_0xe56c('0x3f')][_0xe56c('0x52')]?_0x32ca31[_0xe56c('0x3f')]:_0x25b77a['model'];if(_0x4356c9[_0xe56c('0x2a')][_0xe56c('0x4c')]){_0x32ca31['include']=[{'all':!![]}];}_0x32ca31=_[_0xe56c('0x48')]({},_0x32ca31,_0x4356c9[_0xe56c('0x4b')]);return db['CmHopper'][_0xe56c('0x53')](_0x32ca31)[_0xe56c('0x1f')](handleEntityNotFound(_0x40beb7,null))[_0xe56c('0x1f')](respondWithResult(_0x40beb7,null))[_0xe56c('0x50')](handleError(_0x40beb7,null));};exports[_0xe56c('0x54')]=function(_0x4af636,_0x38df1e){return db[_0xe56c('0x26')][_0xe56c('0x54')](_0x4af636[_0xe56c('0x55')],{})[_0xe56c('0x1f')](respondWithResult(_0x38df1e,0xc9))[_0xe56c('0x50')](handleError(_0x38df1e,null));};exports[_0xe56c('0x56')]=function(_0xe7a3c2,_0x35f730){if(_0xe7a3c2['body']['id']){delete _0xe7a3c2[_0xe56c('0x55')]['id'];}return db[_0xe56c('0x26')][_0xe56c('0x53')]({'where':{'id':_0xe7a3c2['params']['id']}})['then'](handleEntityNotFound(_0x35f730,null))['then'](saveUpdates(_0xe7a3c2[_0xe56c('0x55')],null))[_0xe56c('0x1f')](respondWithResult(_0x35f730,null))['catch'](handleError(_0x35f730,null));};exports['describe']=function(_0x5c0f79,_0x336cb0){return db[_0xe56c('0x26')]['describe']()[_0xe56c('0x1f')](respondWithResult(_0x336cb0,null))[_0xe56c('0x50')](handleError(_0x336cb0,null));};exports[_0xe56c('0x20')]=function(_0x5b06a2,_0x4ae03c){var _0xfbcaf3;return db[_0xe56c('0x26')]['find']({'where':{'id':_0x5b06a2[_0xe56c('0x57')]['id']}})[_0xe56c('0x1f')](handleEntityNotFound(_0x4ae03c,null))['then'](function(_0x9cac58){if(_0x9cac58){return _0x9cac58[_0xe56c('0x20')]()[_0xe56c('0x1f')](function(_0x3f1fe3){return _0x3f1fe3;});}})['then'](function(_0x251c4d){_0xfbcaf3=_0x251c4d;if(_0x251c4d){if(_0x251c4d['VoiceQueueId']||_0x251c4d['CampaignId']){return db[_0x251c4d['VoiceQueueId']?'VoiceQueue':_0xe56c('0x58')]['find']({'where':{'id':_0x251c4d[_0xe56c('0x59')]?_0x251c4d[_0xe56c('0x59')]:_0x251c4d[_0xe56c('0x5a')]},'attributes':['id',_0xe56c('0x23')],'raw':!![]});}}})['then'](function(_0x40b104){var _0x328a6e={};if(_0x40b104){_[_0xe56c('0x48')](_0x328a6e,_['omit'](_0xfbcaf3[_0xe56c('0x5b')],[_0xe56c('0x5c'),_0xe56c('0x5d'),'id']));_0x328a6e[_0xe56c('0x5e')]=0x15;_0x328a6e['statedesc']=_0xe56c('0x5f');_0x328a6e[_0xe56c('0x60')]=_0x40b104[_0xe56c('0x23')];_0x328a6e[_0xe56c('0x61')]=_0x5b06a2['user'][_0xe56c('0x23')];_0x328a6e['UserId']=_0x5b06a2[_0xe56c('0x62')]['id'];_0x328a6e[_0xe56c('0x5f')]=!![];_0x328a6e['deletedat']=moment()[_0xe56c('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0x328a6e[_0xe56c('0x64')]=_0xfbcaf3[_0xe56c('0x65')];_0x328a6e[_0xe56c('0x66')]=_0xfbcaf3['VoiceQueueId']?_0xe56c('0x67'):_0xe56c('0x68');return db['CmContact'][_0xe56c('0x53')]({'where':{'id':_0x328a6e[_0xe56c('0x69')]},'attributes':[_0xe56c('0x6a'),_0xe56c('0x6b')]})[_0xe56c('0x1f')](function(_0x2c01c7){if(!_[_0xe56c('0x6c')](_0x4ae03c)&&!_[_0xe56c('0x6c')](_0x2c01c7['firstName'])){_0x328a6e[_0xe56c('0x6d')]=_0x2c01c7[_0xe56c('0x6a')];if(!_[_0xe56c('0x6c')](_0x2c01c7[_0xe56c('0x6b')])){_0x328a6e[_0xe56c('0x6d')]+='\x20'+_0x2c01c7[_0xe56c('0x6b')];}}})['finally'](function(){return db[_0xe56c('0x6e')][_0xe56c('0x54')](_0x328a6e);});}})[_0xe56c('0x1f')](function(){return _0x4ae03c[_0xe56c('0x17')](0xcc)[_0xe56c('0x21')]();})[_0xe56c('0x50')](handleError(_0x4ae03c,null));};exports['getPreview']=function(_0x2253dd,_0x13251f,_0x30d276){var _0x2119de=[];return db['CmContact'][_0xe56c('0x6f')]()[_0xe56c('0x1f')](function(_0xc26bd0){_0x2119de=_[_0xe56c('0x29')](_0xc26bd0);return _0x2253dd['user'][_0xe56c('0x70')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})[_0xe56c('0x1f')](function(_0x1c9314){if(_0x1c9314&&_0x1c9314['length']){return db[_0xe56c('0x71')][_0xe56c('0x72')](function(_0x375079){var _0xff5e0a={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xe56c('0x73'))},'VoiceQueueId':{'$in':_[_0xe56c('0x4a')](_0x1c9314,'id')},'$or':[{'UserId':null},{'UserId':_0x2253dd['user']['id']}]};var _0x3e1f47=[];if(_0x2253dd[_0xe56c('0x55')][_0xe56c('0x74')]&&_0x2253dd['body']['direction']==='prev'){if(!_[_0xe56c('0x75')](_0x2253dd[_0xe56c('0x55')][_0xe56c('0x76')])){_0xff5e0a['id']={'$in':_0x2253dd[_0xe56c('0x55')][_0xe56c('0x76')]};}_0x3e1f47=[[_0xe56c('0x77'),_0xe56c('0x78')],['scheduledAt',_0x1c9314[0x0][_0xe56c('0x79')]===_0xe56c('0x78')?_0xe56c('0x7a'):_0xe56c('0x78')],db[_0xe56c('0x71')][_0xe56c('0x7b')](_0xe56c('0x7c')),['id',_0xe56c('0x7a')]];}else{if(!_[_0xe56c('0x75')](_0x2253dd['body'][_0xe56c('0x76')])){_0xff5e0a['id']={'$notIn':_0x2253dd[_0xe56c('0x55')][_0xe56c('0x76')]};}_0x3e1f47=[['priority',_0xe56c('0x7a')],[_0xe56c('0x7d'),_0x1c9314[0x0][_0xe56c('0x79')]],db['sequelize'][_0xe56c('0x7b')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0xe56c('0x78')]];}return db[_0xe56c('0x26')][_0xe56c('0x7e')]({'attributes':['id',_0xe56c('0x7f')],'where':_0xff5e0a,'order':_0x3e1f47,'transaction':_0x375079,'lock':_0x375079[_0xe56c('0x80')][_0xe56c('0x81')],'include':[{'model':db[_0xe56c('0x82')],'as':_0xe56c('0x83'),'attributes':_0x2119de,'include':[{'model':db[_0xe56c('0x84')],'as':_0xe56c('0x85'),'attributes':['id','name']}]},{'model':db[_0xe56c('0x86')],'as':'List','attributes':['id',_0xe56c('0x23')]},{'model':db['VoiceQueue'],'as':_0xe56c('0x87'),'attributes':['id',_0xe56c('0x23'),_0xe56c('0x88')]}]})[_0xe56c('0x1f')](function(_0x54a41c){if(_0x54a41c){return _0x54a41c[_0xe56c('0x56')]({'UserId':_0x2253dd[_0xe56c('0x62')]['id']},{'transaction':_0x375079});}});});}})[_0xe56c('0x1f')](handleEntityNotFound(_0x13251f,null))['then'](respondWithResult(_0x13251f,null))[_0xe56c('0x50')](handleError(_0x13251f,null));};exports[_0xe56c('0x89')]=function(_0x2588f5,_0x2201d3,_0x1463ee){return _0x2588f5['user'][_0xe56c('0x70')]({'where':{'type':_0xe56c('0x8a'),'dialActive':!![],'dialMethod':_0xe56c('0x8b')},'attributes':['id'],'raw':!![]})[_0xe56c('0x1f')](function(_0x2b28f9){if(_0x2b28f9&&_0x2b28f9[_0xe56c('0x52')]){return db[_0xe56c('0x26')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xe56c('0x4a')](_0x2b28f9,'id')},'$or':[{'UserId':null},{'UserId':_0x2588f5['user']['id']}]}});}return 0x0;})[_0xe56c('0x1f')](function(_0x23685d){if(!_[_0xe56c('0x6c')](_0x23685d)&&_[_0xe56c('0x8c')](_0x23685d)){return _0x2201d3[_0xe56c('0x17')](0xc8)[_0xe56c('0x18')]({'contacts':_0x23685d});}else{logger[_0xe56c('0x22')](_0xe56c('0x8d'),_0xe56c('0x89'),0x194,_0xe56c('0x8e'));_0x2201d3[_0xe56c('0x16')](0x194);}})['catch'](handleError(_0x2201d3,null));}; \ No newline at end of file +var _0xdab1=['UserId','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','firstName','lastName','isNil','calleridname','finally','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','transaction','direction','isEmpty','hopperIds','priority','scheduledAt','ASC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','findOne','scheduledat','UPDATE','CmList','List','Queue','dialActive','getOpenContacts','preview','isNumber','entity\x20not\x20found','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','destroy','then','end','error','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','concat','$and','$or','$gte','$lt','$lte','$eq','$not','$between','$notBetween','$notIn','$notILike','$like','$overlap','$contains','$contained','fields','attributes','length','hasOwnProperty','order','sort','where','dateStart','dateEnd','add','day','merge','filter','map','options','CmHopper','includeAll','rows','catch','show','include','find','create','body','update','params','describe','CampaignId','VoiceQueueId','VoiceQueue','Campaign','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign'];(function(_0x57a670,_0x30e402){var _0x41ce21=function(_0x11bd34){while(--_0x11bd34){_0x57a670['push'](_0x57a670['shift']());}};_0x41ce21(++_0x30e402);}(_0xdab1,0x1d7));var _0x1dab=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xdab1[_0x3e5086];return _0xfeb102;};'use strict';var pdf=require(_0x1dab('0x0'));var emlformat=require(_0x1dab('0x1'));var rimraf=require(_0x1dab('0x2'));var zipdir=require(_0x1dab('0x3'));var jsonpatch=require(_0x1dab('0x4'));var rp=require(_0x1dab('0x5'));var moment=require(_0x1dab('0x6'));var BPromise=require(_0x1dab('0x7'));var Mustache=require(_0x1dab('0x8'));var util=require('util');var path=require(_0x1dab('0x9'));var sox=require(_0x1dab('0xa'));var csv=require(_0x1dab('0xb'));var ejs=require(_0x1dab('0xc'));var fs=require('fs');var _=require(_0x1dab('0xd'));var squel=require('squel');var crypto=require(_0x1dab('0xe'));var jsforce=require(_0x1dab('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1dab('0xb'));var querystring=require(_0x1dab('0x10'));var Papa=require(_0x1dab('0x11'));var Redis=require(_0x1dab('0x12'));var qs=require(_0x1dab('0x13'));var logger=require(_0x1dab('0x14'))(_0x1dab('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x1dab('0x16'))['db'];function respondWithStatusCode(_0x17144e,_0x300879){_0x300879=_0x300879||0xcc;return function(_0x7c348c){if(_0x7c348c){return _0x17144e[_0x1dab('0x17')](_0x300879);}return _0x17144e['status'](_0x300879)['end']();};}function respondWithResult(_0x3b0ca4,_0x5d06f0){_0x5d06f0=_0x5d06f0||0xc8;return function(_0x270c11){if(_0x270c11){return _0x3b0ca4[_0x1dab('0x18')](_0x5d06f0)[_0x1dab('0x19')](_0x270c11);}};}function respondWithFilteredResult(_0x279b1c,_0x332690){return function(_0x36d4e9){if(_0x36d4e9){var _0x447e23=_0x36d4e9[_0x1dab('0x1a')],_0x1f67ea=_0x332690[_0x1dab('0x1b')],_0x1dd3a4=_0x332690[_0x1dab('0x1b')]+_0x332690[_0x1dab('0x1c')],_0x53bc84;if(_0x1dd3a4>=_0x447e23){_0x1dd3a4=_0x447e23;_0x53bc84=0xc8;}else{_0x53bc84=0xce;}_0x279b1c[_0x1dab('0x18')](_0x53bc84);return _0x279b1c[_0x1dab('0x1d')](_0x1dab('0x1e'),_0x1f67ea+'-'+_0x1dd3a4+'/'+_0x447e23)['json'](_0x36d4e9);}return null;};}function patchUpdates(_0x172369){return function(_0x19229e){try{jsonpatch['apply'](_0x19229e,_0x172369,!![]);}catch(_0x410423){return BPromise[_0x1dab('0x1f')](_0x410423);}return _0x19229e[_0x1dab('0x20')]();};}function saveUpdates(_0x392a93,_0x17f284){return function(_0x591ca2){if(_0x591ca2){return _0x591ca2['update'](_0x392a93)['then'](function(_0x4a9c08){return _0x4a9c08;});}return null;};}function removeEntity(_0x2067c3,_0x2284a7){return function(_0x20239b){if(_0x20239b){return _0x20239b[_0x1dab('0x21')]()[_0x1dab('0x22')](function(){_0x2067c3[_0x1dab('0x18')](0xcc)[_0x1dab('0x23')]();});}};}function handleEntityNotFound(_0x15b309,_0x3bcab6){return function(_0x435fad){if(!_0x435fad){_0x15b309[_0x1dab('0x17')](0x194);}return _0x435fad;};}function handleError(_0xb0cc75,_0x5652e6){_0x5652e6=_0x5652e6||0x1f4;return function(_0x1d1d56){logger[_0x1dab('0x24')](_0x1d1d56[_0x1dab('0x25')]);if(_0x1d1d56[_0x1dab('0x26')]){delete _0x1d1d56[_0x1dab('0x26')];}_0xb0cc75[_0x1dab('0x18')](_0x5652e6)[_0x1dab('0x27')](_0x1d1d56);};}exports[_0x1dab('0x28')]=function(_0x435fc5,_0x548633){var _0x1e747a={},_0x4ca06f={},_0x5eec4e={'count':0x0,'rows':[]};var _0x17f522=db['CmHopper'][_0x1dab('0x29')];_0x4ca06f[_0x1dab('0x2a')]=_[_0x1dab('0x2b')](_0x17f522);var _0x5ad5b4={'dateStart':_0x435fc5['query']['dateStart'],'dateEnd':_0x435fc5[_0x1dab('0x2c')]['dateEnd']};delete _0x435fc5[_0x1dab('0x2c')]['dateStart'];delete _0x435fc5[_0x1dab('0x2c')]['dateEnd'];_0x4ca06f[_0x1dab('0x2c')]=_[_0x1dab('0x2b')](_0x435fc5['query']);_0x4ca06f[_0x1dab('0x2d')]=_[_0x1dab('0x2e')](_0x4ca06f[_0x1dab('0x2a')],_0x4ca06f[_0x1dab('0x2c')]);_0x4ca06f[_0x1dab('0x2d')]=_[_0x1dab('0x2f')](_0x4ca06f[_0x1dab('0x2d')],[_0x1dab('0x30'),_0x1dab('0x31'),'$gt',_0x1dab('0x32'),_0x1dab('0x33'),_0x1dab('0x34'),'$ne',_0x1dab('0x35'),_0x1dab('0x36'),_0x1dab('0x37'),_0x1dab('0x38'),'$in',_0x1dab('0x39'),'$like','$notLike','$iLike',_0x1dab('0x3a'),_0x1dab('0x3b'),_0x1dab('0x3c'),_0x1dab('0x3d'),_0x1dab('0x3e'),'$any']);_0x1e747a['attributes']=_[_0x1dab('0x2e')](_0x4ca06f[_0x1dab('0x2a')],qs[_0x1dab('0x3f')](_0x435fc5[_0x1dab('0x2c')][_0x1dab('0x3f')]));_0x1e747a[_0x1dab('0x40')]=_0x1e747a[_0x1dab('0x40')][_0x1dab('0x41')]?_0x1e747a[_0x1dab('0x40')]:_0x4ca06f[_0x1dab('0x2a')];if(!_0x435fc5[_0x1dab('0x2c')][_0x1dab('0x42')]('nolimit')){_0x1e747a[_0x1dab('0x1c')]=qs[_0x1dab('0x1c')](_0x435fc5[_0x1dab('0x2c')][_0x1dab('0x1c')]);_0x1e747a[_0x1dab('0x1b')]=qs[_0x1dab('0x1b')](_0x435fc5[_0x1dab('0x2c')][_0x1dab('0x1b')]);}_0x1e747a[_0x1dab('0x43')]=qs[_0x1dab('0x44')](_0x435fc5[_0x1dab('0x2c')]['sort']);_0x1e747a[_0x1dab('0x45')]=qs[_0x1dab('0x2d')](_['pick'](_0x435fc5[_0x1dab('0x2c')],_0x4ca06f['filters']));if(_0x5ad5b4[_0x1dab('0x46')]){if(_0x5ad5b4['dateEnd']){_0x5ad5b4['dateEnd']=moment(_0x5ad5b4[_0x1dab('0x47')])[_0x1dab('0x48')](0x1,_0x1dab('0x49'));}else{_0x5ad5b4['dateEnd']=moment(_0x5ad5b4[_0x1dab('0x46')])[_0x1dab('0x48')](0x1,_0x1dab('0x49'));}_[_0x1dab('0x4a')](_0x1e747a[_0x1dab('0x45')],{'createdAt':{'$gte':_0x5ad5b4['dateStart'],'$lte':_0x5ad5b4['dateEnd']}});}if(_0x435fc5['query'][_0x1dab('0x4b')]){_0x1e747a[_0x1dab('0x45')]=_['merge'](_0x1e747a[_0x1dab('0x45')],{'$or':_[_0x1dab('0x4c')](_0x1e747a[_0x1dab('0x40')],function(_0x30f96f){var _0x146c5a={};_0x146c5a[_0x30f96f]={'$like':'%'+_0x435fc5[_0x1dab('0x2c')][_0x1dab('0x4b')]+'%'};return _0x146c5a;})});}_0x1e747a=_['merge']({},_0x1e747a,_0x435fc5[_0x1dab('0x4d')]);var _0x1787c7={'where':_0x1e747a[_0x1dab('0x45')]};return db[_0x1dab('0x4e')][_0x1dab('0x1a')](_0x1787c7)[_0x1dab('0x22')](function(_0x34cb17){_0x5eec4e[_0x1dab('0x1a')]=_0x34cb17;if(_0x435fc5['query'][_0x1dab('0x4f')]){_0x1e747a['include']=[{'all':!![]}];}return db[_0x1dab('0x4e')]['findAll'](_0x1e747a);})['then'](function(_0x2d8cbc){_0x5eec4e[_0x1dab('0x50')]=_0x2d8cbc;return _0x5eec4e;})[_0x1dab('0x22')](respondWithFilteredResult(_0x548633,_0x1e747a))[_0x1dab('0x51')](handleError(_0x548633,null));};exports[_0x1dab('0x52')]=function(_0x180c76,_0x2f6cb3){var _0x5afb5a={'raw':!![],'where':{'id':_0x180c76['params']['id']}},_0x565270={};_0x565270[_0x1dab('0x2a')]=_[_0x1dab('0x2b')](db[_0x1dab('0x4e')][_0x1dab('0x29')]);_0x565270[_0x1dab('0x2c')]=_[_0x1dab('0x2b')](_0x180c76[_0x1dab('0x2c')]);_0x565270[_0x1dab('0x2d')]=_['intersection'](_0x565270['model'],_0x565270[_0x1dab('0x2c')]);_0x5afb5a[_0x1dab('0x40')]=_[_0x1dab('0x2e')](_0x565270[_0x1dab('0x2a')],qs[_0x1dab('0x3f')](_0x180c76[_0x1dab('0x2c')][_0x1dab('0x3f')]));_0x5afb5a[_0x1dab('0x40')]=_0x5afb5a['attributes'][_0x1dab('0x41')]?_0x5afb5a[_0x1dab('0x40')]:_0x565270[_0x1dab('0x2a')];if(_0x180c76[_0x1dab('0x2c')][_0x1dab('0x4f')]){_0x5afb5a[_0x1dab('0x53')]=[{'all':!![]}];}_0x5afb5a=_['merge']({},_0x5afb5a,_0x180c76['options']);return db[_0x1dab('0x4e')][_0x1dab('0x54')](_0x5afb5a)[_0x1dab('0x22')](handleEntityNotFound(_0x2f6cb3,null))[_0x1dab('0x22')](respondWithResult(_0x2f6cb3,null))[_0x1dab('0x51')](handleError(_0x2f6cb3,null));};exports[_0x1dab('0x55')]=function(_0x3feda5,_0x1389b8){return db[_0x1dab('0x4e')][_0x1dab('0x55')](_0x3feda5[_0x1dab('0x56')],{})[_0x1dab('0x22')](respondWithResult(_0x1389b8,0xc9))[_0x1dab('0x51')](handleError(_0x1389b8,null));};exports[_0x1dab('0x57')]=function(_0x383df8,_0x3b1bf8){if(_0x383df8[_0x1dab('0x56')]['id']){delete _0x383df8[_0x1dab('0x56')]['id'];}return db['CmHopper'][_0x1dab('0x54')]({'where':{'id':_0x383df8[_0x1dab('0x58')]['id']}})[_0x1dab('0x22')](handleEntityNotFound(_0x3b1bf8,null))[_0x1dab('0x22')](saveUpdates(_0x383df8['body'],null))[_0x1dab('0x22')](respondWithResult(_0x3b1bf8,null))[_0x1dab('0x51')](handleError(_0x3b1bf8,null));};exports[_0x1dab('0x59')]=function(_0x4e6353,_0x247842){return db[_0x1dab('0x4e')][_0x1dab('0x59')]()[_0x1dab('0x22')](respondWithResult(_0x247842,null))['catch'](handleError(_0x247842,null));};exports[_0x1dab('0x21')]=function(_0x503c5b,_0x2ef8de){var _0x5bd2fd;return db[_0x1dab('0x4e')]['find']({'where':{'id':_0x503c5b[_0x1dab('0x58')]['id']}})[_0x1dab('0x22')](handleEntityNotFound(_0x2ef8de,null))[_0x1dab('0x22')](function(_0x4f7a01){if(_0x4f7a01){return _0x4f7a01[_0x1dab('0x21')]()[_0x1dab('0x22')](function(_0x3e5dcc){return _0x3e5dcc;});}})['then'](function(_0x1b77ce){_0x5bd2fd=_0x1b77ce;if(_0x1b77ce){if(_0x1b77ce['VoiceQueueId']||_0x1b77ce[_0x1dab('0x5a')]){return db[_0x1b77ce[_0x1dab('0x5b')]?_0x1dab('0x5c'):_0x1dab('0x5d')][_0x1dab('0x54')]({'where':{'id':_0x1b77ce[_0x1dab('0x5b')]?_0x1b77ce[_0x1dab('0x5b')]:_0x1b77ce[_0x1dab('0x5a')]},'attributes':['id',_0x1dab('0x26')],'raw':!![]});}}})[_0x1dab('0x22')](function(_0xe3022a){var _0x1abcb5={};if(_0xe3022a){_['merge'](_0x1abcb5,_['omit'](_0x5bd2fd[_0x1dab('0x5e')],[_0x1dab('0x5f'),_0x1dab('0x60'),'id']));_0x1abcb5[_0x1dab('0x61')]=0x15;_0x1abcb5[_0x1dab('0x62')]=_0x1dab('0x63');_0x1abcb5[_0x1dab('0x64')]=_0xe3022a[_0x1dab('0x26')];_0x1abcb5['membername']=_0x503c5b['user']['name'];_0x1abcb5[_0x1dab('0x65')]=_0x503c5b[_0x1dab('0x66')]['id'];_0x1abcb5[_0x1dab('0x63')]=!![];_0x1abcb5[_0x1dab('0x67')]=moment()[_0x1dab('0x68')](_0x1dab('0x69'));_0x1abcb5[_0x1dab('0x6a')]=_0x5bd2fd[_0x1dab('0x6b')];_0x1abcb5[_0x1dab('0x6c')]=_0x5bd2fd['VoiceQueueId']?_0x1dab('0x6d'):_0x1dab('0x6e');return db[_0x1dab('0x6f')][_0x1dab('0x54')]({'where':{'id':_0x1abcb5['ContactId']},'attributes':[_0x1dab('0x70'),_0x1dab('0x71')]})['then'](function(_0x2f98e3){if(!_[_0x1dab('0x72')](_0x2ef8de)&&!_[_0x1dab('0x72')](_0x2f98e3[_0x1dab('0x70')])){_0x1abcb5['calleridname']=_0x2f98e3[_0x1dab('0x70')];if(!_[_0x1dab('0x72')](_0x2f98e3[_0x1dab('0x71')])){_0x1abcb5[_0x1dab('0x73')]+='\x20'+_0x2f98e3[_0x1dab('0x71')];}}})[_0x1dab('0x74')](function(){return db['CmHopperFinal'][_0x1dab('0x55')](_0x1abcb5);});}})[_0x1dab('0x22')](function(){return _0x2ef8de['status'](0xcc)['end']();})[_0x1dab('0x51')](handleError(_0x2ef8de,null));};exports[_0x1dab('0x75')]=function(_0x6a84a8,_0x5a642b,_0x20a85d){var _0x25ab2a=[];return db[_0x1dab('0x6f')]['describe']()[_0x1dab('0x22')](function(_0x2cd77a){_0x25ab2a=_[_0x1dab('0x2b')](_0x2cd77a);return _0x6a84a8['user'][_0x1dab('0x76')]({'where':{'type':_0x1dab('0x77'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x1dab('0x78')],'raw':!![]});})[_0x1dab('0x22')](function(_0x2aee89){if(_0x2aee89&&_0x2aee89[_0x1dab('0x41')]){return db['sequelize'][_0x1dab('0x79')](function(_0x2b4211){var _0x1a2be3={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x1dab('0x68')](_0x1dab('0x69'))},'VoiceQueueId':{'$in':_[_0x1dab('0x4c')](_0x2aee89,'id')},'$or':[{'UserId':null},{'UserId':_0x6a84a8[_0x1dab('0x66')]['id']}]};var _0x3309a3=[];if(_0x6a84a8['body'][_0x1dab('0x7a')]&&_0x6a84a8[_0x1dab('0x56')][_0x1dab('0x7a')]==='prev'){if(!_[_0x1dab('0x7b')](_0x6a84a8[_0x1dab('0x56')][_0x1dab('0x7c')])){_0x1a2be3['id']={'$in':_0x6a84a8[_0x1dab('0x56')][_0x1dab('0x7c')]};}_0x3309a3=[[_0x1dab('0x7d'),'ASC'],[_0x1dab('0x7e'),_0x2aee89[0x0]['dialOrderByScheduledAt']==='ASC'?'DESC':_0x1dab('0x7f')],db[_0x1dab('0x80')][_0x1dab('0x81')](_0x1dab('0x82')),['id',_0x1dab('0x83')]];}else{if(!_['isEmpty'](_0x6a84a8[_0x1dab('0x56')][_0x1dab('0x7c')])){_0x1a2be3['id']={'$notIn':_0x6a84a8[_0x1dab('0x56')][_0x1dab('0x7c')]};}_0x3309a3=[['priority',_0x1dab('0x83')],[_0x1dab('0x7e'),_0x2aee89[0x0]['dialOrderByScheduledAt']],db[_0x1dab('0x80')][_0x1dab('0x81')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x1dab('0x7f')]];}return db[_0x1dab('0x4e')][_0x1dab('0x84')]({'attributes':['id',_0x1dab('0x85')],'where':_0x1a2be3,'order':_0x3309a3,'transaction':_0x2b4211,'lock':_0x2b4211['LOCK'][_0x1dab('0x86')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x25ab2a,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0x1dab('0x26')]}]},{'model':db[_0x1dab('0x87')],'as':_0x1dab('0x88'),'attributes':['id',_0x1dab('0x26')]},{'model':db[_0x1dab('0x5c')],'as':_0x1dab('0x89'),'attributes':['id',_0x1dab('0x26'),_0x1dab('0x8a')]}]})[_0x1dab('0x22')](function(_0x2f5684){if(_0x2f5684){return _0x2f5684[_0x1dab('0x57')]({'UserId':_0x6a84a8[_0x1dab('0x66')]['id']},{'transaction':_0x2b4211});}});});}})[_0x1dab('0x22')](handleEntityNotFound(_0x5a642b,null))['then'](respondWithResult(_0x5a642b,null))['catch'](handleError(_0x5a642b,null));};exports[_0x1dab('0x8b')]=function(_0x2f18a2,_0x514408,_0x4aecc9){return _0x2f18a2[_0x1dab('0x66')][_0x1dab('0x76')]({'where':{'type':_0x1dab('0x77'),'dialActive':!![],'dialMethod':_0x1dab('0x8c')},'attributes':['id'],'raw':!![]})[_0x1dab('0x22')](function(_0x306659){if(_0x306659&&_0x306659[_0x1dab('0x41')]){return db[_0x1dab('0x4e')][_0x1dab('0x1a')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x1dab('0x68')](_0x1dab('0x69'))},'VoiceQueueId':{'$in':_[_0x1dab('0x4c')](_0x306659,'id')},'$or':[{'UserId':null},{'UserId':_0x2f18a2[_0x1dab('0x66')]['id']}]}});}return 0x0;})['then'](function(_0x2169f3){if(!_[_0x1dab('0x72')](_0x2169f3)&&_[_0x1dab('0x8d')](_0x2169f3)){return _0x514408[_0x1dab('0x18')](0xc8)[_0x1dab('0x19')]({'contacts':_0x2169f3});}else{logger['error']('CmHopper,\x20%s,\x20%s,\x20%s',_0x1dab('0x8b'),0x194,_0x1dab('0x8e'));_0x514408[_0x1dab('0x17')](0x194);}})[_0x1dab('0x51')](handleError(_0x514408,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index a08daa6..8ee0929 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 _0xc83f=['bluebird','request-promise','cm_hopper','phone','priority','util'];(function(_0x4442ff,_0x5e93e5){var _0x3bb5e2=function(_0xed83c0){while(--_0xed83c0){_0x4442ff['push'](_0x4442ff['shift']());}};_0x3bb5e2(++_0x5e93e5);}(_0xc83f,0x113));var _0xfc83=function(_0x19e3c2,_0x177a95){_0x19e3c2=_0x19e3c2-0x0;var _0x2bb88f=_0xc83f[_0x19e3c2];return _0x2bb88f;};'use strict';var _=require('lodash');var util=require(_0xfc83('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xfc83('0x1'));var rp=require(_0xfc83('0x2'));var attributes=require('./cmHopper.attributes');module['exports']=function(_0xcc64b4,_0x2e316c){return _0xcc64b4['define']('CmHopper',attributes,{'tableName':_0xfc83('0x3'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':['scheduledat']},{'name':_0xfc83('0x4'),'fields':['phone']},{'name':_0xfc83('0x5'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4397=['moment','bluebird','request-promise','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api'];(function(_0x26be9b,_0x17d406){var _0x5eadb7=function(_0x3d1b0b){while(--_0x3d1b0b){_0x26be9b['push'](_0x26be9b['shift']());}};_0x5eadb7(++_0x17d406);}(_0x4397,0x130));var _0x7439=function(_0x289e64,_0x5adb3c){_0x289e64=_0x289e64-0x0;var _0x30246c=_0x4397[_0x289e64];return _0x30246c;};'use strict';var _=require(_0x7439('0x0'));var util=require(_0x7439('0x1'));var logger=require(_0x7439('0x2'))(_0x7439('0x3'));var moment=require(_0x7439('0x4'));var BPromise=require(_0x7439('0x5'));var rp=require(_0x7439('0x6'));var attributes=require('./cmHopper.attributes');module[_0x7439('0x7')]=function(_0x5c18c9,_0x429fee){return _0x5c18c9[_0x7439('0x8')](_0x7439('0x9'),attributes,{'tableName':_0x7439('0xa'),'paranoid':![],'indexes':[{'name':_0x7439('0xb'),'fields':[_0x7439('0xb')]},{'name':_0x7439('0xc'),'fields':[_0x7439('0xc')]},{'name':_0x7439('0xd'),'fields':[_0x7439('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 2b2fc9b..88e0a5d 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 _0x6c59=['map','model','GetCmHopper','then','ShowCmHopper','create','body','CreateCmHopper','UpdateCmHopper','update','where','limit','DestroyCmHopper','describe','sequelize','transaction','LOCK','UPDATE','CmContact','keys','push','GetContactDialer','CmHopperFinal','destroy','MoveContactManagedDialer','CountReScheduled','COUNT','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','order','UserId','all','lodash','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','http','request','info','CmHopper,\x20%s,\x20%s','debug','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','CmHopper','findAll','options','raw','attributes','include'];(function(_0x590baf,_0x4adaee){var _0x3d5c17=function(_0x31434a){while(--_0x31434a){_0x590baf['push'](_0x590baf['shift']());}};_0x3d5c17(++_0x4adaee);}(_0x6c59,0xdb));var _0x96c5=function(_0x3b2991,_0x1fcba4){_0x3b2991=_0x3b2991-0x0;var _0x1317b0=_0x6c59[_0x3b2991];return _0x1317b0;};'use strict';var _=require(_0x96c5('0x0'));var util=require('util');var moment=require(_0x96c5('0x1'));var BPromise=require(_0x96c5('0x2'));var rs=require(_0x96c5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x96c5('0x4'));var logger=require('../../config/logger')(_0x96c5('0x5'));var config=require('../../config/environment');var jayson=require(_0x96c5('0x6'));var client=jayson[_0x96c5('0x7')][_0x96c5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bdcac,_0x8a5d23,_0x2dd22d){return new BPromise(function(_0x3fee1a,_0x259928){return client[_0x96c5('0x9')](_0x1bdcac,_0x2dd22d)['then'](function(_0x3c44f1){logger[_0x96c5('0xa')](_0x96c5('0xb'),_0x8a5d23,'request\x20sent');logger[_0x96c5('0xc')](_0x96c5('0xd'),_0x8a5d23,_0x96c5('0xe'),JSON[_0x96c5('0xf')](_0x3c44f1));if(_0x3c44f1[_0x96c5('0x10')]){if(_0x3c44f1[_0x96c5('0x10')]['code']===0x1f4){logger[_0x96c5('0x10')](_0x96c5('0xb'),_0x8a5d23,_0x3c44f1[_0x96c5('0x10')][_0x96c5('0x11')]);return _0x259928(_0x3c44f1[_0x96c5('0x10')][_0x96c5('0x11')]);}logger[_0x96c5('0x10')](_0x96c5('0xb'),_0x8a5d23,_0x3c44f1['error']['message']);return _0x3fee1a(_0x3c44f1[_0x96c5('0x10')][_0x96c5('0x11')]);}else{logger[_0x96c5('0xa')](_0x96c5('0xb'),_0x8a5d23,_0x96c5('0xe'));_0x3fee1a(_0x3c44f1['result']['message']);}})[_0x96c5('0x12')](function(_0x10de3e){logger['error'](_0x96c5('0xb'),_0x8a5d23,_0x10de3e);_0x259928(_0x10de3e);});});}exports['GetCmHopper']=function(_0x1e50c9){var _0x17ebbd=this;return new Promise(function(_0x48f300,_0x1fee5d){return db[_0x96c5('0x13')][_0x96c5('0x14')]({'raw':_0x1e50c9[_0x96c5('0x15')]?_0x1e50c9['options'][_0x96c5('0x16')]===undefined?!![]:![]:!![],'where':_0x1e50c9[_0x96c5('0x15')]?_0x1e50c9['options']['where']||null:null,'attributes':_0x1e50c9[_0x96c5('0x15')]?_0x1e50c9[_0x96c5('0x15')][_0x96c5('0x17')]||null:null,'limit':_0x1e50c9[_0x96c5('0x15')]?_0x1e50c9['options']['limit']||null:null,'include':_0x1e50c9[_0x96c5('0x15')]?_0x1e50c9['options'][_0x96c5('0x18')]?_[_0x96c5('0x19')](_0x1e50c9['options'][_0x96c5('0x18')],function(_0x16da27){return{'model':db[_0x16da27['model']],'as':_0x16da27['as'],'attributes':_0x16da27[_0x96c5('0x17')],'include':_0x16da27[_0x96c5('0x18')]?_[_0x96c5('0x19')](_0x16da27[_0x96c5('0x18')],function(_0xeedf61){return{'model':db[_0xeedf61[_0x96c5('0x1a')]],'as':_0xeedf61['as'],'attributes':_0xeedf61[_0x96c5('0x17')],'include':_0xeedf61[_0x96c5('0x18')]?_[_0x96c5('0x19')](_0xeedf61['include'],function(_0x3ef7c7){return{'model':db[_0x3ef7c7[_0x96c5('0x1a')]],'as':_0x3ef7c7['as'],'attributes':_0x3ef7c7[_0x96c5('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d1f24){logger[_0x96c5('0xa')]('GetCmHopper',_0x1e50c9);logger[_0x96c5('0xc')](_0x96c5('0x1b'),_0x1e50c9,JSON['stringify'](_0x4d1f24));_0x48f300(_0x4d1f24);})['catch'](function(_0x5a6395){logger['error'](_0x96c5('0x1b'),_0x5a6395[_0x96c5('0x11')],_0x1e50c9);_0x1fee5d(_0x17ebbd['error'](0x1f4,_0x5a6395[_0x96c5('0x11')]));});});};exports['ShowCmHopper']=function(_0x1f59c7){var _0x167a25=this;return new Promise(function(_0x54b91a,_0x23a357){return db[_0x96c5('0x13')]['find']({'raw':_0x1f59c7[_0x96c5('0x15')]?_0x1f59c7[_0x96c5('0x15')][_0x96c5('0x16')]===undefined?!![]:![]:!![],'where':_0x1f59c7[_0x96c5('0x15')]?_0x1f59c7[_0x96c5('0x15')]['where']||null:null,'attributes':_0x1f59c7[_0x96c5('0x15')]?_0x1f59c7[_0x96c5('0x15')]['attributes']||null:null,'include':_0x1f59c7[_0x96c5('0x15')]?_0x1f59c7[_0x96c5('0x15')]['include']?_['map'](_0x1f59c7[_0x96c5('0x15')][_0x96c5('0x18')],function(_0x11f526){return{'model':db[_0x11f526[_0x96c5('0x1a')]],'as':_0x11f526['as'],'attributes':_0x11f526['attributes'],'include':_0x11f526[_0x96c5('0x18')]?_[_0x96c5('0x19')](_0x11f526[_0x96c5('0x18')],function(_0xc98762){return{'model':db[_0xc98762['model']],'as':_0xc98762['as'],'attributes':_0xc98762[_0x96c5('0x17')],'include':_0xc98762[_0x96c5('0x18')]?_[_0x96c5('0x19')](_0xc98762[_0x96c5('0x18')],function(_0x14f770){return{'model':db[_0x14f770[_0x96c5('0x1a')]],'as':_0x14f770['as'],'attributes':_0x14f770['attributes']};}):[]};}):[]};}):[]:[]})[_0x96c5('0x1c')](function(_0xafcff4){logger[_0x96c5('0xa')](_0x96c5('0x1d'),_0x1f59c7);logger[_0x96c5('0xc')](_0x96c5('0x1d'),_0x1f59c7,JSON['stringify'](_0xafcff4));_0x54b91a(_0xafcff4);})['catch'](function(_0x4282fc){logger[_0x96c5('0x10')](_0x96c5('0x1d'),_0x4282fc[_0x96c5('0x11')],_0x1f59c7);_0x23a357(_0x167a25[_0x96c5('0x10')](0x1f4,_0x4282fc[_0x96c5('0x11')]));});});};exports['CreateCmHopper']=function(_0x37a55a){var _0x344acd=this;return new Promise(function(_0x2079ac,_0x18734a){return db[_0x96c5('0x13')][_0x96c5('0x1e')](_0x37a55a[_0x96c5('0x1f')],{'raw':_0x37a55a[_0x96c5('0x15')]?_0x37a55a[_0x96c5('0x15')][_0x96c5('0x16')]===undefined?!![]:![]:!![]})[_0x96c5('0x1c')](function(_0x6a8e1){logger[_0x96c5('0xa')]('CreateCmHopper',_0x37a55a);logger['debug'](_0x96c5('0x20'),_0x37a55a,JSON[_0x96c5('0xf')](_0x6a8e1));_0x2079ac(_0x6a8e1);})[_0x96c5('0x12')](function(_0x4eee7f){logger['error']('CreateCmHopper',_0x4eee7f[_0x96c5('0x11')],_0x37a55a);_0x18734a(_0x344acd[_0x96c5('0x10')](0x1f4,_0x4eee7f[_0x96c5('0x11')]));});});};exports[_0x96c5('0x21')]=function(_0x5a9aa2){var _0x363f9a=this;return new Promise(function(_0x47c8cd,_0x5c38f4){return db[_0x96c5('0x13')][_0x96c5('0x22')](_0x5a9aa2[_0x96c5('0x1f')],{'raw':_0x5a9aa2['options']?_0x5a9aa2[_0x96c5('0x15')][_0x96c5('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a9aa2['options']?_0x5a9aa2['options'][_0x96c5('0x23')]||null:null,'attributes':_0x5a9aa2[_0x96c5('0x15')]?_0x5a9aa2[_0x96c5('0x15')]['attributes']||null:null,'limit':_0x5a9aa2['options']?_0x5a9aa2['options'][_0x96c5('0x24')]||null:null})['then'](function(_0x563067){logger['info']('UpdateCmHopper',_0x5a9aa2);logger['debug'](_0x96c5('0x21'),_0x5a9aa2,JSON[_0x96c5('0xf')](_0x563067));_0x47c8cd(_0x563067);})[_0x96c5('0x12')](function(_0x27cd99){logger[_0x96c5('0x10')](_0x96c5('0x21'),_0x27cd99[_0x96c5('0x11')],_0x5a9aa2);_0x5c38f4(_0x363f9a[_0x96c5('0x10')](0x1f4,_0x27cd99['message']));});});};exports['DestroyCmHopper']=function(_0x4d9835){var _0x4b62e8=this;return new Promise(function(_0x22defe,_0x57464e){return db[_0x96c5('0x13')]['destroy']({'where':_0x4d9835['options']?_0x4d9835[_0x96c5('0x15')][_0x96c5('0x23')]||null:null})[_0x96c5('0x1c')](function(_0x5c9166){logger[_0x96c5('0xa')](_0x96c5('0x25'),_0x4d9835);logger[_0x96c5('0xc')](_0x96c5('0x25'),_0x4d9835,JSON[_0x96c5('0xf')](_0x5c9166));_0x22defe(_0x5c9166);})[_0x96c5('0x12')](function(_0x582ade){logger[_0x96c5('0x10')](_0x96c5('0x25'),_0x582ade[_0x96c5('0x11')],_0x4d9835);_0x57464e(_0x4b62e8[_0x96c5('0x10')](0x1f4,_0x582ade[_0x96c5('0x11')]));});});};exports['GetContactDialer']=function(_0x4e2aaa){var _0x26fb43=this;return new Promise(function(_0x35c8b9,_0x318645){return db['CmContact'][_0x96c5('0x26')]()[_0x96c5('0x1c')](function(_0x5c046a){return db[_0x96c5('0x27')][_0x96c5('0x28')](function(_0x2c5d76){return db[_0x96c5('0x13')]['findAll']({'where':_0x4e2aaa[_0x96c5('0x15')]?_0x4e2aaa[_0x96c5('0x15')]['where']||null:null,'attributes':_0x4e2aaa[_0x96c5('0x15')]?_0x4e2aaa[_0x96c5('0x15')][_0x96c5('0x17')]||null:null,'limit':_0x4e2aaa['options']?_0x4e2aaa[_0x96c5('0x15')]['limit']||null:null,'order':_0x4e2aaa[_0x96c5('0x15')]?_0x4e2aaa['options']['order']||null:null,'transaction':_0x2c5d76,'lock':_0x2c5d76[_0x96c5('0x29')][_0x96c5('0x2a')],'include':[{'model':db[_0x96c5('0x2b')],'as':'Contact','attributes':_[_0x96c5('0x2c')](_0x5c046a)}]})[_0x96c5('0x1c')](function(_0x260ce6){var _0x51f686=[];for(var _0x55b11=0x0;_0x55b11<_0x260ce6['length'];_0x55b11+=0x1){_0x51f686[_0x96c5('0x2d')](_0x260ce6[_0x55b11][_0x96c5('0x22')](_0x4e2aaa[_0x96c5('0x1f')],{'transaction':_0x2c5d76}));}return BPromise['all'](_0x51f686);});})[_0x96c5('0x1c')](function(_0x5e8736){logger[_0x96c5('0xa')](_0x96c5('0x2e'),_0x4e2aaa);logger[_0x96c5('0xc')](_0x96c5('0x2e'),_0x4e2aaa,JSON[_0x96c5('0xf')](_0x5e8736));_0x35c8b9(_0x5e8736);})[_0x96c5('0x12')](function(_0x4bac73){logger[_0x96c5('0x10')]('GetContactDialer',_0x4bac73['message'],_0x4e2aaa);_0x318645(_0x26fb43['error'](0x1f4,_0x4bac73[_0x96c5('0x11')]));});});});};exports['MoveContactManagedDialer']=function(_0x1959fb){var _0x21f7e0=this;return new Promise(function(_0x53d1f4,_0x4e9788){return db[_0x96c5('0x27')]['transaction'](function(_0xef3427){return db[_0x96c5('0x2f')]['create'](_0x1959fb[_0x96c5('0x1f')],{'raw':_0x1959fb[_0x96c5('0x15')]?_0x1959fb[_0x96c5('0x15')][_0x96c5('0x16')]===undefined?!![]:![]:!![],'transaction':_0xef3427})['then'](function(){return db[_0x96c5('0x13')][_0x96c5('0x30')]({'where':_0x1959fb[_0x96c5('0x15')]?_0x1959fb[_0x96c5('0x15')]['where']||null:null,'transaction':_0xef3427});});})['then'](function(_0x3d2f45){logger[_0x96c5('0xa')](_0x96c5('0x31'),_0x1959fb);logger[_0x96c5('0xc')]('MoveContactManagedDialer',_0x1959fb,JSON[_0x96c5('0xf')](_0x3d2f45));_0x53d1f4(_0x3d2f45);})[_0x96c5('0x12')](function(_0x3f06f7){logger[_0x96c5('0x10')](_0x96c5('0x31'),_0x3f06f7[_0x96c5('0x11')],_0x1959fb);_0x4e9788(_0x21f7e0[_0x96c5('0x10')](0x1f4,_0x3f06f7['message']));});});};exports[_0x96c5('0x32')]=function(_0x25526d){var _0x1a0c4e=this;return new Promise(function(_0x553957,_0x201fa3){return db[_0x96c5('0x13')][_0x96c5('0x14')]({'raw':_0x25526d[_0x96c5('0x15')]?_0x25526d['options'][_0x96c5('0x16')]===undefined?!![]:![]:!![],'where':_0x25526d[_0x96c5('0x15')]?_0x25526d[_0x96c5('0x15')][_0x96c5('0x23')]||null:null,'attributes':[[db[_0x96c5('0x27')]['fn'](_0x96c5('0x33'),db[_0x96c5('0x27')]['fn']('IF',db[_0x96c5('0x27')]['literal']('`scheduledat`\x20>=\x20'+util[_0x96c5('0x34')](_0x96c5('0x35'),moment()[_0x96c5('0x34')](_0x96c5('0x36')))+_0x96c5('0x37')))),_0x96c5('0x38')]]})[_0x96c5('0x1c')](function(_0x1f0423){logger[_0x96c5('0xa')]('CountReScheduled',_0x25526d);logger[_0x96c5('0xc')](_0x96c5('0x32'),_0x25526d,JSON['stringify'](_0x1f0423));_0x553957(_0x1f0423);})[_0x96c5('0x12')](function(_0x15baac){logger[_0x96c5('0x10')]('CountReScheduled',_0x15baac[_0x96c5('0x11')],_0x25526d);_0x201fa3(_0x1a0c4e[_0x96c5('0x10')](0x1f4,_0x15baac[_0x96c5('0x11')]));});});};exports[_0x96c5('0x39')]=function(_0x29a0df){var _0x209ac3=this;return new Promise(function(_0x5645fb,_0x22d7bc){return db[_0x96c5('0x2b')][_0x96c5('0x26')]()[_0x96c5('0x1c')](function(_0x59459a){return db['sequelize'][_0x96c5('0x28')](function(_0x267296){return db[_0x96c5('0x13')]['findAll']({'where':_0x29a0df['options']?_0x29a0df[_0x96c5('0x15')]['where']||null:null,'attributes':_0x29a0df[_0x96c5('0x15')]?_0x29a0df[_0x96c5('0x15')][_0x96c5('0x17')]||null:null,'limit':0x1,'order':_0x29a0df[_0x96c5('0x15')]?_0x29a0df[_0x96c5('0x15')][_0x96c5('0x3a')]||null:null,'group':db[_0x96c5('0x13')][_0x96c5('0x3b')],'transaction':_0x267296,'lock':_0x267296[_0x96c5('0x29')][_0x96c5('0x2a')],'include':_0x29a0df[_0x96c5('0x15')]?_0x29a0df['options'][_0x96c5('0x18')]?_[_0x96c5('0x19')](_0x29a0df[_0x96c5('0x15')][_0x96c5('0x18')],function(_0x499a27){return{'model':db[_0x499a27[_0x96c5('0x1a')]],'as':_0x499a27['as'],'attributes':_0x499a27[_0x96c5('0x17')],'include':_0x499a27[_0x96c5('0x18')]?_[_0x96c5('0x19')](_0x499a27[_0x96c5('0x18')],function(_0x317eee){return{'model':db[_0x317eee[_0x96c5('0x1a')]],'as':_0x317eee['as'],'attributes':_0x317eee['attributes'],'include':_0x317eee[_0x96c5('0x18')]?_[_0x96c5('0x19')](_0x317eee[_0x96c5('0x18')],function(_0x2a5272){return{'model':db[_0x2a5272['model']],'as':_0x2a5272['as'],'attributes':_0x2a5272[_0x96c5('0x17')]};}):[]};}):[]};}):[]:[]})[_0x96c5('0x1c')](function(_0x25cb30){var _0x579bac=[];for(var _0x5dba0c=0x0;_0x5dba0c<_0x25cb30['length'];_0x5dba0c+=0x1){_0x579bac[_0x96c5('0x2d')](_0x25cb30[_0x5dba0c][_0x96c5('0x22')](_0x29a0df[_0x96c5('0x1f')],{'transaction':_0x267296}));}return BPromise[_0x96c5('0x3c')](_0x579bac);});})[_0x96c5('0x1c')](function(_0x5c3a93){logger['info']('GetContactRecallMe',_0x29a0df);logger[_0x96c5('0xc')]('GetContactRecallMe',_0x29a0df,JSON[_0x96c5('0xf')](_0x5c3a93));_0x5645fb(_0x5c3a93);})['catch'](function(_0x10ea09){logger[_0x96c5('0x10')](_0x96c5('0x39'),_0x10ea09[_0x96c5('0x11')],_0x29a0df);_0x22d7bc(_0x209ac3[_0x96c5('0x10')](0x1f4,_0x10ea09[_0x96c5('0x11')]));});});});}; \ No newline at end of file +var _0x49b4=['code','message','result','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','map','include','model','debug','catch','find','ShowCmHopper','CreateCmHopper','body','UpdateCmHopper','limit','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','length','push','update','all','MoveContactManagedDialer','CmHopperFinal','create','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','UserId','GetContactRecallMe','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x49b4,0x13e));var _0x449b=function(_0x362d76,_0x28d06f){_0x362d76=_0x362d76-0x0;var _0x5ddbfb=_0x49b4[_0x362d76];return _0x5ddbfb;};'use strict';var _=require('lodash');var util=require(_0x449b('0x0'));var moment=require(_0x449b('0x1'));var BPromise=require(_0x449b('0x2'));var rs=require(_0x449b('0x3'));var fs=require('fs');var Redis=require(_0x449b('0x4'));var db=require(_0x449b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x449b('0x6'))(_0x449b('0x7'));var config=require(_0x449b('0x8'));var jayson=require(_0x449b('0x9'));var client=jayson['client'][_0x449b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3053a8,_0xbd44b2,_0x4129d0){return new BPromise(function(_0x20346d,_0xf073f4){return client['request'](_0x3053a8,_0x4129d0)[_0x449b('0xb')](function(_0x12d776){logger[_0x449b('0xc')](_0x449b('0xd'),_0xbd44b2,_0x449b('0xe'));logger['debug']('CmHopper,\x20%s,\x20%s,\x20%s',_0xbd44b2,_0x449b('0xe'),JSON[_0x449b('0xf')](_0x12d776));if(_0x12d776[_0x449b('0x10')]){if(_0x12d776[_0x449b('0x10')][_0x449b('0x11')]===0x1f4){logger['error'](_0x449b('0xd'),_0xbd44b2,_0x12d776['error'][_0x449b('0x12')]);return _0xf073f4(_0x12d776[_0x449b('0x10')][_0x449b('0x12')]);}logger[_0x449b('0x10')]('CmHopper,\x20%s,\x20%s',_0xbd44b2,_0x12d776['error']['message']);return _0x20346d(_0x12d776['error'][_0x449b('0x12')]);}else{logger[_0x449b('0xc')](_0x449b('0xd'),_0xbd44b2,_0x449b('0xe'));_0x20346d(_0x12d776[_0x449b('0x13')][_0x449b('0x12')]);}})['catch'](function(_0x2c7b94){logger['error'](_0x449b('0xd'),_0xbd44b2,_0x2c7b94);_0xf073f4(_0x2c7b94);});});}exports[_0x449b('0x14')]=function(_0xf805ff){var _0x1b9948=this;return new Promise(function(_0x35573e,_0x3f29da){return db[_0x449b('0x15')][_0x449b('0x16')]({'raw':_0xf805ff[_0x449b('0x17')]?_0xf805ff[_0x449b('0x17')][_0x449b('0x18')]===undefined?!![]:![]:!![],'where':_0xf805ff[_0x449b('0x17')]?_0xf805ff[_0x449b('0x17')][_0x449b('0x19')]||null:null,'attributes':_0xf805ff[_0x449b('0x17')]?_0xf805ff[_0x449b('0x17')][_0x449b('0x1a')]||null:null,'limit':_0xf805ff['options']?_0xf805ff[_0x449b('0x17')]['limit']||null:null,'include':_0xf805ff[_0x449b('0x17')]?_0xf805ff[_0x449b('0x17')]['include']?_[_0x449b('0x1b')](_0xf805ff['options'][_0x449b('0x1c')],function(_0x33f39c){return{'model':db[_0x33f39c[_0x449b('0x1d')]],'as':_0x33f39c['as'],'attributes':_0x33f39c[_0x449b('0x1a')],'include':_0x33f39c['include']?_[_0x449b('0x1b')](_0x33f39c['include'],function(_0x2fdf9d){return{'model':db[_0x2fdf9d[_0x449b('0x1d')]],'as':_0x2fdf9d['as'],'attributes':_0x2fdf9d[_0x449b('0x1a')],'include':_0x2fdf9d[_0x449b('0x1c')]?_[_0x449b('0x1b')](_0x2fdf9d[_0x449b('0x1c')],function(_0x5b339b){return{'model':db[_0x5b339b[_0x449b('0x1d')]],'as':_0x5b339b['as'],'attributes':_0x5b339b[_0x449b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x449b('0xb')](function(_0x34340d){logger['info']('GetCmHopper',_0xf805ff);logger[_0x449b('0x1e')](_0x449b('0x14'),_0xf805ff,JSON[_0x449b('0xf')](_0x34340d));_0x35573e(_0x34340d);})[_0x449b('0x1f')](function(_0x3d3501){logger[_0x449b('0x10')](_0x449b('0x14'),_0x3d3501['message'],_0xf805ff);_0x3f29da(_0x1b9948[_0x449b('0x10')](0x1f4,_0x3d3501[_0x449b('0x12')]));});});};exports['ShowCmHopper']=function(_0x28b784){var _0x4da607=this;return new Promise(function(_0x20d2a7,_0x2c7397){return db[_0x449b('0x15')][_0x449b('0x20')]({'raw':_0x28b784['options']?_0x28b784[_0x449b('0x17')][_0x449b('0x18')]===undefined?!![]:![]:!![],'where':_0x28b784[_0x449b('0x17')]?_0x28b784[_0x449b('0x17')][_0x449b('0x19')]||null:null,'attributes':_0x28b784['options']?_0x28b784[_0x449b('0x17')]['attributes']||null:null,'include':_0x28b784['options']?_0x28b784[_0x449b('0x17')][_0x449b('0x1c')]?_[_0x449b('0x1b')](_0x28b784['options'][_0x449b('0x1c')],function(_0x4a385e){return{'model':db[_0x4a385e[_0x449b('0x1d')]],'as':_0x4a385e['as'],'attributes':_0x4a385e[_0x449b('0x1a')],'include':_0x4a385e[_0x449b('0x1c')]?_['map'](_0x4a385e[_0x449b('0x1c')],function(_0x3054f6){return{'model':db[_0x3054f6[_0x449b('0x1d')]],'as':_0x3054f6['as'],'attributes':_0x3054f6['attributes'],'include':_0x3054f6[_0x449b('0x1c')]?_[_0x449b('0x1b')](_0x3054f6[_0x449b('0x1c')],function(_0x1237a9){return{'model':db[_0x1237a9[_0x449b('0x1d')]],'as':_0x1237a9['as'],'attributes':_0x1237a9[_0x449b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd7aceb){logger[_0x449b('0xc')](_0x449b('0x21'),_0x28b784);logger[_0x449b('0x1e')]('ShowCmHopper',_0x28b784,JSON['stringify'](_0xd7aceb));_0x20d2a7(_0xd7aceb);})[_0x449b('0x1f')](function(_0x30c83f){logger[_0x449b('0x10')](_0x449b('0x21'),_0x30c83f[_0x449b('0x12')],_0x28b784);_0x2c7397(_0x4da607[_0x449b('0x10')](0x1f4,_0x30c83f['message']));});});};exports[_0x449b('0x22')]=function(_0x80e200){var _0x163bb5=this;return new Promise(function(_0x335af8,_0x51a7d5){return db[_0x449b('0x15')]['create'](_0x80e200[_0x449b('0x23')],{'raw':_0x80e200[_0x449b('0x17')]?_0x80e200['options'][_0x449b('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x2b609d){logger[_0x449b('0xc')]('CreateCmHopper',_0x80e200);logger[_0x449b('0x1e')](_0x449b('0x22'),_0x80e200,JSON['stringify'](_0x2b609d));_0x335af8(_0x2b609d);})['catch'](function(_0x5d09fa){logger[_0x449b('0x10')](_0x449b('0x22'),_0x5d09fa[_0x449b('0x12')],_0x80e200);_0x51a7d5(_0x163bb5[_0x449b('0x10')](0x1f4,_0x5d09fa[_0x449b('0x12')]));});});};exports[_0x449b('0x24')]=function(_0x45e3d7){var _0x1c505c=this;return new Promise(function(_0x288e5d,_0xf138e7){return db[_0x449b('0x15')]['update'](_0x45e3d7['body'],{'raw':_0x45e3d7[_0x449b('0x17')]?_0x45e3d7[_0x449b('0x17')][_0x449b('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45e3d7[_0x449b('0x17')]?_0x45e3d7[_0x449b('0x17')][_0x449b('0x19')]||null:null,'attributes':_0x45e3d7[_0x449b('0x17')]?_0x45e3d7[_0x449b('0x17')][_0x449b('0x1a')]||null:null,'limit':_0x45e3d7[_0x449b('0x17')]?_0x45e3d7['options'][_0x449b('0x25')]||null:null})[_0x449b('0xb')](function(_0x33beb6){logger[_0x449b('0xc')]('UpdateCmHopper',_0x45e3d7);logger[_0x449b('0x1e')]('UpdateCmHopper',_0x45e3d7,JSON[_0x449b('0xf')](_0x33beb6));_0x288e5d(_0x33beb6);})[_0x449b('0x1f')](function(_0x4bb53a){logger[_0x449b('0x10')](_0x449b('0x24'),_0x4bb53a[_0x449b('0x12')],_0x45e3d7);_0xf138e7(_0x1c505c['error'](0x1f4,_0x4bb53a[_0x449b('0x12')]));});});};exports[_0x449b('0x26')]=function(_0x52175c){var _0x55f80f=this;return new Promise(function(_0x38065b,_0x5bdc76){return db['CmHopper'][_0x449b('0x27')]({'where':_0x52175c['options']?_0x52175c[_0x449b('0x17')][_0x449b('0x19')]||null:null})[_0x449b('0xb')](function(_0x27d0e8){logger[_0x449b('0xc')](_0x449b('0x26'),_0x52175c);logger[_0x449b('0x1e')](_0x449b('0x26'),_0x52175c,JSON['stringify'](_0x27d0e8));_0x38065b(_0x27d0e8);})[_0x449b('0x1f')](function(_0x27dfca){logger[_0x449b('0x10')](_0x449b('0x26'),_0x27dfca[_0x449b('0x12')],_0x52175c);_0x5bdc76(_0x55f80f[_0x449b('0x10')](0x1f4,_0x27dfca[_0x449b('0x12')]));});});};exports[_0x449b('0x28')]=function(_0x27a717){var _0x11f32f=this;return new Promise(function(_0x32c3ee,_0x22c2ff){return db[_0x449b('0x29')][_0x449b('0x2a')]()[_0x449b('0xb')](function(_0x599936){return db[_0x449b('0x2b')][_0x449b('0x2c')](function(_0x35c671){return db[_0x449b('0x15')][_0x449b('0x16')]({'where':_0x27a717[_0x449b('0x17')]?_0x27a717['options'][_0x449b('0x19')]||null:null,'attributes':_0x27a717[_0x449b('0x17')]?_0x27a717[_0x449b('0x17')][_0x449b('0x1a')]||null:null,'limit':_0x27a717[_0x449b('0x17')]?_0x27a717[_0x449b('0x17')]['limit']||null:null,'order':_0x27a717[_0x449b('0x17')]?_0x27a717['options'][_0x449b('0x2d')]||null:null,'transaction':_0x35c671,'lock':_0x35c671[_0x449b('0x2e')][_0x449b('0x2f')],'include':[{'model':db[_0x449b('0x29')],'as':_0x449b('0x30'),'attributes':_['keys'](_0x599936)}]})[_0x449b('0xb')](function(_0x1042ea){var _0x4ac41f=[];for(var _0x1ea55d=0x0;_0x1ea55d<_0x1042ea[_0x449b('0x31')];_0x1ea55d+=0x1){_0x4ac41f[_0x449b('0x32')](_0x1042ea[_0x1ea55d][_0x449b('0x33')](_0x27a717['body'],{'transaction':_0x35c671}));}return BPromise[_0x449b('0x34')](_0x4ac41f);});})[_0x449b('0xb')](function(_0x2bde3f){logger[_0x449b('0xc')](_0x449b('0x28'),_0x27a717);logger[_0x449b('0x1e')](_0x449b('0x28'),_0x27a717,JSON[_0x449b('0xf')](_0x2bde3f));_0x32c3ee(_0x2bde3f);})[_0x449b('0x1f')](function(_0x1e5b25){logger[_0x449b('0x10')]('GetContactDialer',_0x1e5b25['message'],_0x27a717);_0x22c2ff(_0x11f32f[_0x449b('0x10')](0x1f4,_0x1e5b25[_0x449b('0x12')]));});});});};exports[_0x449b('0x35')]=function(_0x25be6b){var _0x557b88=this;return new Promise(function(_0x432021,_0x5704d1){return db[_0x449b('0x2b')][_0x449b('0x2c')](function(_0x256e75){return db[_0x449b('0x36')][_0x449b('0x37')](_0x25be6b['body'],{'raw':_0x25be6b[_0x449b('0x17')]?_0x25be6b[_0x449b('0x17')]['raw']===undefined?!![]:![]:!![],'transaction':_0x256e75})[_0x449b('0xb')](function(){return db[_0x449b('0x15')][_0x449b('0x27')]({'where':_0x25be6b[_0x449b('0x17')]?_0x25be6b[_0x449b('0x17')][_0x449b('0x19')]||null:null,'transaction':_0x256e75});});})[_0x449b('0xb')](function(_0x40cc22){logger[_0x449b('0xc')](_0x449b('0x35'),_0x25be6b);logger['debug'](_0x449b('0x35'),_0x25be6b,JSON[_0x449b('0xf')](_0x40cc22));_0x432021(_0x40cc22);})[_0x449b('0x1f')](function(_0xaadc90){logger[_0x449b('0x10')]('MoveContactManagedDialer',_0xaadc90[_0x449b('0x12')],_0x25be6b);_0x5704d1(_0x557b88['error'](0x1f4,_0xaadc90['message']));});});};exports[_0x449b('0x38')]=function(_0x5196b2){var _0x4ebf0b=this;return new Promise(function(_0x245514,_0x3cec52){return db[_0x449b('0x15')][_0x449b('0x16')]({'raw':_0x5196b2[_0x449b('0x17')]?_0x5196b2[_0x449b('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5196b2[_0x449b('0x17')]?_0x5196b2[_0x449b('0x17')][_0x449b('0x19')]||null:null,'attributes':[[db[_0x449b('0x2b')]['fn'](_0x449b('0x39'),db['sequelize']['fn']('IF',db[_0x449b('0x2b')][_0x449b('0x3a')](_0x449b('0x3b')+util[_0x449b('0x3c')](_0x449b('0x3d'),moment()[_0x449b('0x3c')](_0x449b('0x3e')))+_0x449b('0x3f')))),_0x449b('0x40')]]})[_0x449b('0xb')](function(_0x30aea7){logger[_0x449b('0xc')](_0x449b('0x38'),_0x5196b2);logger[_0x449b('0x1e')](_0x449b('0x38'),_0x5196b2,JSON['stringify'](_0x30aea7));_0x245514(_0x30aea7);})['catch'](function(_0x57e9b8){logger[_0x449b('0x10')](_0x449b('0x38'),_0x57e9b8['message'],_0x5196b2);_0x3cec52(_0x4ebf0b['error'](0x1f4,_0x57e9b8['message']));});});};exports['GetContactRecallMe']=function(_0x534edb){var _0x5759c2=this;return new Promise(function(_0x56e793,_0x597562){return db[_0x449b('0x29')][_0x449b('0x2a')]()[_0x449b('0xb')](function(_0x2bb341){return db[_0x449b('0x2b')][_0x449b('0x2c')](function(_0x117972){return db[_0x449b('0x15')][_0x449b('0x16')]({'where':_0x534edb[_0x449b('0x17')]?_0x534edb[_0x449b('0x17')]['where']||null:null,'attributes':_0x534edb['options']?_0x534edb['options']['attributes']||null:null,'limit':0x1,'order':_0x534edb[_0x449b('0x17')]?_0x534edb[_0x449b('0x17')]['order']||null:null,'group':db[_0x449b('0x15')][_0x449b('0x41')],'transaction':_0x117972,'lock':_0x117972[_0x449b('0x2e')]['UPDATE'],'include':_0x534edb[_0x449b('0x17')]?_0x534edb[_0x449b('0x17')][_0x449b('0x1c')]?_['map'](_0x534edb[_0x449b('0x17')]['include'],function(_0x4e7097){return{'model':db[_0x4e7097['model']],'as':_0x4e7097['as'],'attributes':_0x4e7097[_0x449b('0x1a')],'include':_0x4e7097['include']?_[_0x449b('0x1b')](_0x4e7097[_0x449b('0x1c')],function(_0x336822){return{'model':db[_0x336822['model']],'as':_0x336822['as'],'attributes':_0x336822[_0x449b('0x1a')],'include':_0x336822[_0x449b('0x1c')]?_[_0x449b('0x1b')](_0x336822[_0x449b('0x1c')],function(_0x9a6e3e){return{'model':db[_0x9a6e3e['model']],'as':_0x9a6e3e['as'],'attributes':_0x9a6e3e[_0x449b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x576aab){var _0x3547cb=[];for(var _0x431e9d=0x0;_0x431e9d<_0x576aab[_0x449b('0x31')];_0x431e9d+=0x1){_0x3547cb['push'](_0x576aab[_0x431e9d][_0x449b('0x33')](_0x534edb[_0x449b('0x23')],{'transaction':_0x117972}));}return BPromise['all'](_0x3547cb);});})[_0x449b('0xb')](function(_0x37e89f){logger['info'](_0x449b('0x42'),_0x534edb);logger['debug'](_0x449b('0x42'),_0x534edb,JSON[_0x449b('0xf')](_0x37e89f));_0x56e793(_0x37e89f);})[_0x449b('0x1f')](function(_0xf6896c){logger[_0x449b('0x10')](_0x449b('0x42'),_0xf6896c[_0x449b('0x12')],_0x534edb);_0x597562(_0x5759c2[_0x449b('0x10')](0x1f4,_0xf6896c[_0x449b('0x12')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index c8b7c7c..0d055d4 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 _0x9957=['/:id','show','post','/preview','getPreview','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/opencontacts','getOpenContacts'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./cmHopper.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['describe']);router[_0x7995('0x8')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x8')](_0x7995('0xe'),auth[_0x7995('0x9')](),controller[_0x7995('0xf')]);router[_0x7995('0x10')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0x10')](_0x7995('0x11'),auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x13')](_0x7995('0xe'),auth[_0x7995('0x9')](),controller[_0x7995('0x14')]);router[_0x7995('0x15')](_0x7995('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('0x16')]=router; \ No newline at end of file +var _0x7a54=['destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','describe','/opencontacts','/:id','post','/preview','getPreview','put','delete'];(function(_0x48ebb7,_0x2debb8){var _0xc7447f=function(_0x4bab9e){while(--_0x4bab9e){_0x48ebb7['push'](_0x48ebb7['shift']());}};_0xc7447f(++_0x2debb8);}(_0x7a54,0x106));var _0x47a5=function(_0x6d26ed,_0x432dd9){_0x6d26ed=_0x6d26ed-0x0;var _0x2be43e=_0x7a54[_0x6d26ed];return _0x2be43e;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['getOpenContacts']);router['get'](_0x47a5('0xc'),auth[_0x47a5('0x9')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x47a5('0xd')](_0x47a5('0xe'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0xc'),auth[_0x47a5('0x9')](),controller['update']);router[_0x47a5('0x11')](_0x47a5('0xc'),auth[_0x47a5('0x9')](),controller[_0x47a5('0x12')]);module[_0x47a5('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 51b703f..06d3540 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 _0xb386=['exports','INTEGER','contactListQueue','sequelize'];(function(_0x5b4e3d,_0x252c8a){var _0x1e2554=function(_0x3f497c){while(--_0x3f497c){_0x5b4e3d['push'](_0x5b4e3d['shift']());}};_0x1e2554(++_0x252c8a);}(_0xb386,0x1d7));var _0x6b38=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xb386[_0x1caf6a];return _0x1bf493;};'use strict';var moment=require('moment');var Sequelize=require(_0x6b38('0x0'));module[_0x6b38('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x6b38('0x2')],'unique':_0x6b38('0x3')},'ListId':{'type':Sequelize[_0x6b38('0x2')],'unique':_0x6b38('0x3')},'VoiceQueueId':{'type':Sequelize[_0x6b38('0x2')],'unique':_0x6b38('0x3')}}; \ No newline at end of file +var _0x52cd=['sequelize','INTEGER','contactListQueue','moment'];(function(_0xcabaf9,_0x2914f7){var _0x5b7bf0=function(_0x41966f){while(--_0x41966f){_0xcabaf9['push'](_0xcabaf9['shift']());}};_0x5b7bf0(++_0x2914f7);}(_0x52cd,0x8b));var _0xd52c=function(_0x435fe0,_0x534018){_0x435fe0=_0x435fe0-0x0;var _0x4a8e54=_0x52cd[_0x435fe0];return _0x4a8e54;};'use strict';var moment=require(_0xd52c('0x0'));var Sequelize=require(_0xd52c('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xd52c('0x2')],'unique':_0xd52c('0x3')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xd52c('0x3')},'VoiceQueueId':{'type':Sequelize[_0xd52c('0x2')],'unique':_0xd52c('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 854f4b7..6948f69 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 _0x6349=['describe','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','then','error','stack','name','send','index','CmHopperBlack','rawAttributes','query','dateStart','dateEnd','keys','filters','attributes','intersection','model','fields','hasOwnProperty','order','sort','where','pick','add','day','merge','map','options','count','includeAll','include','findAll','show','length','update','body','find','params','catch','destroy'];(function(_0x2ebd5f,_0x2be310){var _0xcbb153=function(_0x254f0a){while(--_0x254f0a){_0x2ebd5f['push'](_0x2ebd5f['shift']());}};_0xcbb153(++_0x2be310);}(_0x6349,0x121));var _0x9634=function(_0x86ec0c,_0xb007d9){_0x86ec0c=_0x86ec0c-0x0;var _0x2855fa=_0x6349[_0x86ec0c];return _0x2855fa;};'use strict';var pdf=require(_0x9634('0x0'));var emlformat=require(_0x9634('0x1'));var rimraf=require(_0x9634('0x2'));var zipdir=require(_0x9634('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9634('0x4'));var BPromise=require(_0x9634('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9634('0x6'));var sox=require(_0x9634('0x7'));var csv=require('to-csv');var ejs=require(_0x9634('0x8'));var fs=require('fs');var _=require(_0x9634('0x9'));var squel=require(_0x9634('0xa'));var crypto=require(_0x9634('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9634('0xc'));var toCsv=require(_0x9634('0xd'));var querystring=require(_0x9634('0xe'));var Papa=require(_0x9634('0xf'));var Redis=require(_0x9634('0x10'));var qs=require(_0x9634('0x11'));var logger=require(_0x9634('0x12'))(_0x9634('0x13'));var utils=require(_0x9634('0x14'));var config=require(_0x9634('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xed7899,_0x575bf2){_0x575bf2=_0x575bf2||0xcc;return function(_0x45c85e){if(_0x45c85e){return _0xed7899[_0x9634('0x16')](_0x575bf2);}return _0xed7899[_0x9634('0x17')](_0x575bf2)[_0x9634('0x18')]();};}function respondWithResult(_0x555015,_0x253908){_0x253908=_0x253908||0xc8;return function(_0x4f49ef){if(_0x4f49ef){return _0x555015[_0x9634('0x17')](_0x253908)[_0x9634('0x19')](_0x4f49ef);}};}function respondWithFilteredResult(_0x290fa1,_0x2395fd){return function(_0x3d27a0){if(_0x3d27a0){var _0x58d40d=_0x3d27a0['count'],_0x2db26d=_0x2395fd[_0x9634('0x1a')],_0x261079=_0x2395fd[_0x9634('0x1a')]+_0x2395fd[_0x9634('0x1b')],_0x43f9cc;if(_0x261079>=_0x58d40d){_0x261079=_0x58d40d;_0x43f9cc=0xc8;}else{_0x43f9cc=0xce;}_0x290fa1[_0x9634('0x17')](_0x43f9cc);return _0x290fa1[_0x9634('0x1c')](_0x9634('0x1d'),_0x2db26d+'-'+_0x261079+'/'+_0x58d40d)['json'](_0x3d27a0);}return null;};}function patchUpdates(_0x312d29){return function(_0x5c6bac){try{jsonpatch['apply'](_0x5c6bac,_0x312d29,!![]);}catch(_0x5ea3c9){return BPromise[_0x9634('0x1e')](_0x5ea3c9);}return _0x5c6bac[_0x9634('0x1f')]();};}function saveUpdates(_0x3e8795,_0x3e4119){return function(_0x4956e7){if(_0x4956e7){return _0x4956e7['update'](_0x3e8795)[_0x9634('0x20')](function(_0xc0183b){return _0xc0183b;});}return null;};}function removeEntity(_0x292cee,_0x67e709){return function(_0x57e52d){if(_0x57e52d){return _0x57e52d['destroy']()[_0x9634('0x20')](function(){_0x292cee[_0x9634('0x17')](0xcc)[_0x9634('0x18')]();});}};}function handleEntityNotFound(_0x4c8e42,_0x145a43){return function(_0x13a538){if(!_0x13a538){_0x4c8e42['sendStatus'](0x194);}return _0x13a538;};}function handleError(_0x3d3fa3,_0x3ff856){_0x3ff856=_0x3ff856||0x1f4;return function(_0x56646e){logger[_0x9634('0x21')](_0x56646e[_0x9634('0x22')]);if(_0x56646e[_0x9634('0x23')]){delete _0x56646e[_0x9634('0x23')];}_0x3d3fa3[_0x9634('0x17')](_0x3ff856)[_0x9634('0x24')](_0x56646e);};}exports[_0x9634('0x25')]=function(_0x577c7f,_0x21a2e2){var _0x2b3e1f={},_0x1b302a={},_0x3ca6b0={'count':0x0,'rows':[]};var _0x3f4ba8=db[_0x9634('0x26')][_0x9634('0x27')];_0x1b302a['model']=_['keys'](_0x3f4ba8);var _0x103dda={'dateStart':_0x577c7f[_0x9634('0x28')][_0x9634('0x29')],'dateEnd':_0x577c7f[_0x9634('0x28')]['dateEnd']};delete _0x577c7f['query']['dateStart'];delete _0x577c7f[_0x9634('0x28')][_0x9634('0x2a')];_0x1b302a[_0x9634('0x28')]=_[_0x9634('0x2b')](_0x577c7f[_0x9634('0x28')]);_0x1b302a[_0x9634('0x2c')]=_['intersection'](_0x1b302a['model'],_0x1b302a['query']);_0x2b3e1f[_0x9634('0x2d')]=_[_0x9634('0x2e')](_0x1b302a[_0x9634('0x2f')],qs[_0x9634('0x30')](_0x577c7f[_0x9634('0x28')][_0x9634('0x30')]));_0x2b3e1f[_0x9634('0x2d')]=_0x2b3e1f['attributes']['length']?_0x2b3e1f[_0x9634('0x2d')]:_0x1b302a[_0x9634('0x2f')];if(!_0x577c7f[_0x9634('0x28')][_0x9634('0x31')]('nolimit')){_0x2b3e1f[_0x9634('0x1b')]=qs[_0x9634('0x1b')](_0x577c7f[_0x9634('0x28')]['limit']);_0x2b3e1f[_0x9634('0x1a')]=qs[_0x9634('0x1a')](_0x577c7f[_0x9634('0x28')][_0x9634('0x1a')]);}_0x2b3e1f[_0x9634('0x32')]=qs['sort'](_0x577c7f[_0x9634('0x28')][_0x9634('0x33')]);_0x2b3e1f[_0x9634('0x34')]=qs[_0x9634('0x2c')](_[_0x9634('0x35')](_0x577c7f[_0x9634('0x28')],_0x1b302a[_0x9634('0x2c')]));if(_0x103dda[_0x9634('0x29')]){if(_0x103dda[_0x9634('0x2a')]){_0x103dda[_0x9634('0x2a')]=moment(_0x103dda[_0x9634('0x2a')])[_0x9634('0x36')](0x1,_0x9634('0x37'));}else{_0x103dda['dateEnd']=moment(_0x103dda[_0x9634('0x29')])['add'](0x1,'day');}_[_0x9634('0x38')](_0x2b3e1f[_0x9634('0x34')],{'createdAt':{'$gte':_0x103dda['dateStart'],'$lte':_0x103dda[_0x9634('0x2a')]}});}if(_0x577c7f[_0x9634('0x28')]['filter']){_0x2b3e1f['where']=_[_0x9634('0x38')](_0x2b3e1f[_0x9634('0x34')],{'$or':_[_0x9634('0x39')](_0x2b3e1f[_0x9634('0x2d')],function(_0x44f5c5){var _0x483ea9={};_0x483ea9[_0x44f5c5]={'$like':'%'+_0x577c7f['query']['filter']+'%'};return _0x483ea9;})});}_0x2b3e1f=_[_0x9634('0x38')]({},_0x2b3e1f,_0x577c7f[_0x9634('0x3a')]);var _0x17b479={'where':_0x2b3e1f[_0x9634('0x34')]};return db[_0x9634('0x26')]['count'](_0x17b479)['then'](function(_0x4ac64c){_0x3ca6b0[_0x9634('0x3b')]=_0x4ac64c;if(_0x577c7f['query'][_0x9634('0x3c')]){_0x2b3e1f[_0x9634('0x3d')]=[{'all':!![]}];}return db[_0x9634('0x26')][_0x9634('0x3e')](_0x2b3e1f);})['then'](function(_0x27c2ef){_0x3ca6b0['rows']=_0x27c2ef;return _0x3ca6b0;})[_0x9634('0x20')](respondWithFilteredResult(_0x21a2e2,_0x2b3e1f))['catch'](handleError(_0x21a2e2,null));};exports[_0x9634('0x3f')]=function(_0x24f1c0,_0x15fdc9){var _0xfd223f={'raw':!![],'where':{'id':_0x24f1c0['params']['id']}},_0xb60fe4={};_0xb60fe4[_0x9634('0x2f')]=_[_0x9634('0x2b')](db[_0x9634('0x26')][_0x9634('0x27')]);_0xb60fe4[_0x9634('0x28')]=_[_0x9634('0x2b')](_0x24f1c0[_0x9634('0x28')]);_0xb60fe4[_0x9634('0x2c')]=_[_0x9634('0x2e')](_0xb60fe4[_0x9634('0x2f')],_0xb60fe4['query']);_0xfd223f[_0x9634('0x2d')]=_['intersection'](_0xb60fe4[_0x9634('0x2f')],qs[_0x9634('0x30')](_0x24f1c0[_0x9634('0x28')][_0x9634('0x30')]));_0xfd223f['attributes']=_0xfd223f[_0x9634('0x2d')][_0x9634('0x40')]?_0xfd223f['attributes']:_0xb60fe4[_0x9634('0x2f')];if(_0x24f1c0[_0x9634('0x28')]['includeAll']){_0xfd223f['include']=[{'all':!![]}];}_0xfd223f=_['merge']({},_0xfd223f,_0x24f1c0[_0x9634('0x3a')]);return db[_0x9634('0x26')]['find'](_0xfd223f)[_0x9634('0x20')](handleEntityNotFound(_0x15fdc9,null))['then'](respondWithResult(_0x15fdc9,null))['catch'](handleError(_0x15fdc9,null));};exports[_0x9634('0x41')]=function(_0x52d302,_0x869c05){if(_0x52d302['body']['id']){delete _0x52d302[_0x9634('0x42')]['id'];}return db[_0x9634('0x26')][_0x9634('0x43')]({'where':{'id':_0x52d302[_0x9634('0x44')]['id']}})['then'](handleEntityNotFound(_0x869c05,null))['then'](saveUpdates(_0x52d302[_0x9634('0x42')],null))[_0x9634('0x20')](respondWithResult(_0x869c05,null))[_0x9634('0x45')](handleError(_0x869c05,null));};exports[_0x9634('0x46')]=function(_0x3d1655,_0xba3561){return db['CmHopperBlack']['find']({'where':{'id':_0x3d1655[_0x9634('0x44')]['id']}})[_0x9634('0x20')](handleEntityNotFound(_0xba3561,null))[_0x9634('0x20')](removeEntity(_0xba3561,null))[_0x9634('0x45')](handleError(_0xba3561,null));};exports['describe']=function(_0x470f35,_0x3a9e4c){return db[_0x9634('0x26')][_0x9634('0x47')]()[_0x9634('0x20')](respondWithResult(_0x3a9e4c,null))[_0x9634('0x45')](handleError(_0x3a9e4c,null));}; \ No newline at end of file +var _0x0a0b=['add','filter','merge','map','options','includeAll','include','findAll','catch','show','params','body','find','destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','index','CmHopperBlack','rawAttributes','model','dateStart','query','dateEnd','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','day'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x0a0b,0xa3));var _0xb0a0=function(_0x530043,_0x316bae){_0x530043=_0x530043-0x0;var _0x4206e6=_0x0a0b[_0x530043];return _0x4206e6;};'use strict';var pdf=require(_0xb0a0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb0a0('0x1'));var zipdir=require(_0xb0a0('0x2'));var jsonpatch=require(_0xb0a0('0x3'));var rp=require(_0xb0a0('0x4'));var moment=require(_0xb0a0('0x5'));var BPromise=require(_0xb0a0('0x6'));var Mustache=require(_0xb0a0('0x7'));var util=require(_0xb0a0('0x8'));var path=require(_0xb0a0('0x9'));var sox=require(_0xb0a0('0xa'));var csv=require(_0xb0a0('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb0a0('0xc'));var squel=require(_0xb0a0('0xd'));var crypto=require(_0xb0a0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb0a0('0xf'));var toCsv=require(_0xb0a0('0xb'));var querystring=require('querystring');var Papa=require(_0xb0a0('0x10'));var Redis=require(_0xb0a0('0x11'));var qs=require(_0xb0a0('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xb0a0('0x13'));var config=require(_0xb0a0('0x14'));var db=require(_0xb0a0('0x15'))['db'];function respondWithStatusCode(_0x29db89,_0x1aa0e0){_0x1aa0e0=_0x1aa0e0||0xcc;return function(_0x297208){if(_0x297208){return _0x29db89[_0xb0a0('0x16')](_0x1aa0e0);}return _0x29db89['status'](_0x1aa0e0)['end']();};}function respondWithResult(_0x44f875,_0x2128cd){_0x2128cd=_0x2128cd||0xc8;return function(_0x520f18){if(_0x520f18){return _0x44f875[_0xb0a0('0x17')](_0x2128cd)[_0xb0a0('0x18')](_0x520f18);}};}function respondWithFilteredResult(_0x26baef,_0x306171){return function(_0x2f0bdf){if(_0x2f0bdf){var _0xc70e9d=_0x2f0bdf[_0xb0a0('0x19')],_0x3d4ea0=_0x306171[_0xb0a0('0x1a')],_0x431dd0=_0x306171[_0xb0a0('0x1a')]+_0x306171['limit'],_0x10b619;if(_0x431dd0>=_0xc70e9d){_0x431dd0=_0xc70e9d;_0x10b619=0xc8;}else{_0x10b619=0xce;}_0x26baef[_0xb0a0('0x17')](_0x10b619);return _0x26baef[_0xb0a0('0x1b')](_0xb0a0('0x1c'),_0x3d4ea0+'-'+_0x431dd0+'/'+_0xc70e9d)[_0xb0a0('0x18')](_0x2f0bdf);}return null;};}function patchUpdates(_0x28108f){return function(_0x127003){try{jsonpatch[_0xb0a0('0x1d')](_0x127003,_0x28108f,!![]);}catch(_0x4450c5){return BPromise[_0xb0a0('0x1e')](_0x4450c5);}return _0x127003[_0xb0a0('0x1f')]();};}function saveUpdates(_0xd3061d,_0x5fbc30){return function(_0x1cfd4b){if(_0x1cfd4b){return _0x1cfd4b[_0xb0a0('0x20')](_0xd3061d)[_0xb0a0('0x21')](function(_0x5eace9){return _0x5eace9;});}return null;};}function removeEntity(_0x4a3e2d,_0x40105d){return function(_0x3d344d){if(_0x3d344d){return _0x3d344d['destroy']()[_0xb0a0('0x21')](function(){_0x4a3e2d[_0xb0a0('0x17')](0xcc)[_0xb0a0('0x22')]();});}};}function handleEntityNotFound(_0x24cf57,_0x12aee7){return function(_0x896ded){if(!_0x896ded){_0x24cf57[_0xb0a0('0x16')](0x194);}return _0x896ded;};}function handleError(_0x3aa0ea,_0x420488){_0x420488=_0x420488||0x1f4;return function(_0x433543){logger[_0xb0a0('0x23')](_0x433543[_0xb0a0('0x24')]);if(_0x433543[_0xb0a0('0x25')]){delete _0x433543['name'];}_0x3aa0ea[_0xb0a0('0x17')](_0x420488)['send'](_0x433543);};}exports[_0xb0a0('0x26')]=function(_0x22243b,_0x587cb7){var _0x5be01a={},_0x3978cb={},_0x3641d4={'count':0x0,'rows':[]};var _0x45e586=db[_0xb0a0('0x27')][_0xb0a0('0x28')];_0x3978cb[_0xb0a0('0x29')]=_['keys'](_0x45e586);var _0x348d78={'dateStart':_0x22243b['query'][_0xb0a0('0x2a')],'dateEnd':_0x22243b[_0xb0a0('0x2b')][_0xb0a0('0x2c')]};delete _0x22243b[_0xb0a0('0x2b')][_0xb0a0('0x2a')];delete _0x22243b[_0xb0a0('0x2b')][_0xb0a0('0x2c')];_0x3978cb['query']=_[_0xb0a0('0x2d')](_0x22243b[_0xb0a0('0x2b')]);_0x3978cb[_0xb0a0('0x2e')]=_[_0xb0a0('0x2f')](_0x3978cb['model'],_0x3978cb[_0xb0a0('0x2b')]);_0x5be01a['attributes']=_['intersection'](_0x3978cb['model'],qs[_0xb0a0('0x30')](_0x22243b[_0xb0a0('0x2b')][_0xb0a0('0x30')]));_0x5be01a[_0xb0a0('0x31')]=_0x5be01a[_0xb0a0('0x31')][_0xb0a0('0x32')]?_0x5be01a[_0xb0a0('0x31')]:_0x3978cb[_0xb0a0('0x29')];if(!_0x22243b[_0xb0a0('0x2b')][_0xb0a0('0x33')](_0xb0a0('0x34'))){_0x5be01a[_0xb0a0('0x35')]=qs[_0xb0a0('0x35')](_0x22243b[_0xb0a0('0x2b')][_0xb0a0('0x35')]);_0x5be01a[_0xb0a0('0x1a')]=qs[_0xb0a0('0x1a')](_0x22243b[_0xb0a0('0x2b')][_0xb0a0('0x1a')]);}_0x5be01a[_0xb0a0('0x36')]=qs[_0xb0a0('0x37')](_0x22243b[_0xb0a0('0x2b')][_0xb0a0('0x37')]);_0x5be01a[_0xb0a0('0x38')]=qs[_0xb0a0('0x2e')](_[_0xb0a0('0x39')](_0x22243b['query'],_0x3978cb['filters']));if(_0x348d78[_0xb0a0('0x2a')]){if(_0x348d78[_0xb0a0('0x2c')]){_0x348d78['dateEnd']=moment(_0x348d78[_0xb0a0('0x2c')])['add'](0x1,_0xb0a0('0x3a'));}else{_0x348d78[_0xb0a0('0x2c')]=moment(_0x348d78[_0xb0a0('0x2a')])[_0xb0a0('0x3b')](0x1,_0xb0a0('0x3a'));}_['merge'](_0x5be01a[_0xb0a0('0x38')],{'createdAt':{'$gte':_0x348d78[_0xb0a0('0x2a')],'$lte':_0x348d78[_0xb0a0('0x2c')]}});}if(_0x22243b[_0xb0a0('0x2b')][_0xb0a0('0x3c')]){_0x5be01a['where']=_[_0xb0a0('0x3d')](_0x5be01a[_0xb0a0('0x38')],{'$or':_[_0xb0a0('0x3e')](_0x5be01a[_0xb0a0('0x31')],function(_0xff1170){var _0x4cea03={};_0x4cea03[_0xff1170]={'$like':'%'+_0x22243b[_0xb0a0('0x2b')][_0xb0a0('0x3c')]+'%'};return _0x4cea03;})});}_0x5be01a=_[_0xb0a0('0x3d')]({},_0x5be01a,_0x22243b[_0xb0a0('0x3f')]);var _0x27723e={'where':_0x5be01a[_0xb0a0('0x38')]};return db[_0xb0a0('0x27')]['count'](_0x27723e)[_0xb0a0('0x21')](function(_0x34a10a){_0x3641d4[_0xb0a0('0x19')]=_0x34a10a;if(_0x22243b['query'][_0xb0a0('0x40')]){_0x5be01a[_0xb0a0('0x41')]=[{'all':!![]}];}return db[_0xb0a0('0x27')][_0xb0a0('0x42')](_0x5be01a);})[_0xb0a0('0x21')](function(_0xe02b37){_0x3641d4['rows']=_0xe02b37;return _0x3641d4;})[_0xb0a0('0x21')](respondWithFilteredResult(_0x587cb7,_0x5be01a))[_0xb0a0('0x43')](handleError(_0x587cb7,null));};exports[_0xb0a0('0x44')]=function(_0x7513b6,_0x9e2a80){var _0x54d8b2={'raw':!![],'where':{'id':_0x7513b6[_0xb0a0('0x45')]['id']}},_0x51b676={};_0x51b676[_0xb0a0('0x29')]=_['keys'](db[_0xb0a0('0x27')][_0xb0a0('0x28')]);_0x51b676[_0xb0a0('0x2b')]=_[_0xb0a0('0x2d')](_0x7513b6[_0xb0a0('0x2b')]);_0x51b676[_0xb0a0('0x2e')]=_[_0xb0a0('0x2f')](_0x51b676[_0xb0a0('0x29')],_0x51b676[_0xb0a0('0x2b')]);_0x54d8b2[_0xb0a0('0x31')]=_['intersection'](_0x51b676['model'],qs['fields'](_0x7513b6[_0xb0a0('0x2b')][_0xb0a0('0x30')]));_0x54d8b2[_0xb0a0('0x31')]=_0x54d8b2['attributes'][_0xb0a0('0x32')]?_0x54d8b2[_0xb0a0('0x31')]:_0x51b676[_0xb0a0('0x29')];if(_0x7513b6[_0xb0a0('0x2b')]['includeAll']){_0x54d8b2['include']=[{'all':!![]}];}_0x54d8b2=_[_0xb0a0('0x3d')]({},_0x54d8b2,_0x7513b6[_0xb0a0('0x3f')]);return db[_0xb0a0('0x27')]['find'](_0x54d8b2)[_0xb0a0('0x21')](handleEntityNotFound(_0x9e2a80,null))[_0xb0a0('0x21')](respondWithResult(_0x9e2a80,null))[_0xb0a0('0x43')](handleError(_0x9e2a80,null));};exports[_0xb0a0('0x20')]=function(_0xaddb2e,_0x4d925d){if(_0xaddb2e[_0xb0a0('0x46')]['id']){delete _0xaddb2e[_0xb0a0('0x46')]['id'];}return db[_0xb0a0('0x27')][_0xb0a0('0x47')]({'where':{'id':_0xaddb2e[_0xb0a0('0x45')]['id']}})[_0xb0a0('0x21')](handleEntityNotFound(_0x4d925d,null))[_0xb0a0('0x21')](saveUpdates(_0xaddb2e[_0xb0a0('0x46')],null))[_0xb0a0('0x21')](respondWithResult(_0x4d925d,null))[_0xb0a0('0x43')](handleError(_0x4d925d,null));};exports[_0xb0a0('0x48')]=function(_0x7c81ac,_0x215520){return db[_0xb0a0('0x27')][_0xb0a0('0x47')]({'where':{'id':_0x7c81ac['params']['id']}})['then'](handleEntityNotFound(_0x215520,null))[_0xb0a0('0x21')](removeEntity(_0x215520,null))['catch'](handleError(_0x215520,null));};exports['describe']=function(_0x3d82f3,_0x104239){return db[_0xb0a0('0x27')][_0xb0a0('0x49')]()['then'](respondWithResult(_0x104239,null))[_0xb0a0('0x43')](handleError(_0x104239,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index e3364af..4696465 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 _0xcffb=['define','CmHopperBlack','util','../../config/logger','api','moment','request-promise','exports'];(function(_0x91dce9,_0x855fcb){var _0x10c24e=function(_0x295e1f){while(--_0x295e1f){_0x91dce9['push'](_0x91dce9['shift']());}};_0x10c24e(++_0x855fcb);}(_0xcffb,0x11a));var _0xbcff=function(_0xf285d1,_0x456a61){_0xf285d1=_0xf285d1-0x0;var _0x283723=_0xcffb[_0xf285d1];return _0x283723;};'use strict';var _=require('lodash');var util=require(_0xbcff('0x0'));var logger=require(_0xbcff('0x1'))(_0xbcff('0x2'));var moment=require(_0xbcff('0x3'));var BPromise=require('bluebird');var rp=require(_0xbcff('0x4'));var attributes=require('./cmHopperBlack.attributes');module[_0xbcff('0x5')]=function(_0x2d6812,_0x526261){return _0x2d6812[_0xbcff('0x6')](_0xbcff('0x7'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe11f=['../../config/logger','api','moment','exports','define','cm_hopper_black'];(function(_0x518b8f,_0x476de4){var _0x51cece=function(_0x13e53e){while(--_0x13e53e){_0x518b8f['push'](_0x518b8f['shift']());}};_0x51cece(++_0x476de4);}(_0xe11f,0x186));var _0xfe11=function(_0x7cf8ec,_0x57fd22){_0x7cf8ec=_0x7cf8ec-0x0;var _0x4a257a=_0xe11f[_0x7cf8ec];return _0x4a257a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfe11('0x0'))(_0xfe11('0x1'));var moment=require(_0xfe11('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./cmHopperBlack.attributes');module[_0xfe11('0x3')]=function(_0x1d4adc,_0xc65bdb){return _0x1d4adc[_0xfe11('0x4')]('CmHopperBlack',attributes,{'tableName':_0xfe11('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 2d5b3ff..6ca0320 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 _0xf8d3=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetCmHopperBlack','CmHopperBlack','options','where','attributes','include','map','model','catch','UpdateCmHopperBlack','update','body','limit','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xf8d3,0x95));var _0x3f8d=function(_0x3f2228,_0x3b27d5){_0x3f2228=_0x3f2228-0x0;var _0x285ae4=_0xf8d3[_0x3f2228];return _0x285ae4;};'use strict';var _=require(_0x3f8d('0x0'));var util=require(_0x3f8d('0x1'));var moment=require(_0x3f8d('0x2'));var BPromise=require(_0x3f8d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f8d('0x4'));var db=require(_0x3f8d('0x5'))['db'];var utils=require(_0x3f8d('0x6'));var logger=require(_0x3f8d('0x7'))(_0x3f8d('0x8'));var config=require(_0x3f8d('0x9'));var jayson=require(_0x3f8d('0xa'));var client=jayson[_0x3f8d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cfe14,_0x458c6b,_0xb9975c){return new BPromise(function(_0x171dc7,_0x201210){return client[_0x3f8d('0xc')](_0x1cfe14,_0xb9975c)[_0x3f8d('0xd')](function(_0x526312){logger[_0x3f8d('0xe')](_0x3f8d('0xf'),_0x458c6b,'request\x20sent');logger[_0x3f8d('0x10')](_0x3f8d('0x11'),_0x458c6b,_0x3f8d('0x12'),JSON[_0x3f8d('0x13')](_0x526312));if(_0x526312[_0x3f8d('0x14')]){if(_0x526312['error'][_0x3f8d('0x15')]===0x1f4){logger[_0x3f8d('0x14')](_0x3f8d('0xf'),_0x458c6b,_0x526312[_0x3f8d('0x14')][_0x3f8d('0x16')]);return _0x201210(_0x526312[_0x3f8d('0x14')][_0x3f8d('0x16')]);}logger[_0x3f8d('0x14')](_0x3f8d('0xf'),_0x458c6b,_0x526312['error'][_0x3f8d('0x16')]);return _0x171dc7(_0x526312[_0x3f8d('0x14')]['message']);}else{logger[_0x3f8d('0xe')](_0x3f8d('0xf'),_0x458c6b,_0x3f8d('0x12'));_0x171dc7(_0x526312[_0x3f8d('0x17')][_0x3f8d('0x16')]);}})['catch'](function(_0x424876){logger[_0x3f8d('0x14')]('CmHopperBlack,\x20%s,\x20%s',_0x458c6b,_0x424876);_0x201210(_0x424876);});});}exports[_0x3f8d('0x18')]=function(_0x5305ab){var _0x5cc8c1=this;return new Promise(function(_0x4cb1cb,_0x270d59){return db[_0x3f8d('0x19')]['findAll']({'raw':_0x5305ab[_0x3f8d('0x1a')]?_0x5305ab['options']['raw']===undefined?!![]:![]:!![],'where':_0x5305ab[_0x3f8d('0x1a')]?_0x5305ab[_0x3f8d('0x1a')][_0x3f8d('0x1b')]||null:null,'attributes':_0x5305ab[_0x3f8d('0x1a')]?_0x5305ab[_0x3f8d('0x1a')][_0x3f8d('0x1c')]||null:null,'limit':_0x5305ab[_0x3f8d('0x1a')]?_0x5305ab[_0x3f8d('0x1a')]['limit']||null:null,'include':_0x5305ab[_0x3f8d('0x1a')]?_0x5305ab[_0x3f8d('0x1a')][_0x3f8d('0x1d')]?_[_0x3f8d('0x1e')](_0x5305ab['options'][_0x3f8d('0x1d')],function(_0x58dbce){return{'model':db[_0x58dbce[_0x3f8d('0x1f')]],'as':_0x58dbce['as'],'attributes':_0x58dbce[_0x3f8d('0x1c')],'include':_0x58dbce[_0x3f8d('0x1d')]?_[_0x3f8d('0x1e')](_0x58dbce[_0x3f8d('0x1d')],function(_0x580cd6){return{'model':db[_0x580cd6[_0x3f8d('0x1f')]],'as':_0x580cd6['as'],'attributes':_0x580cd6[_0x3f8d('0x1c')],'include':_0x580cd6[_0x3f8d('0x1d')]?_['map'](_0x580cd6[_0x3f8d('0x1d')],function(_0x2b1e09){return{'model':db[_0x2b1e09[_0x3f8d('0x1f')]],'as':_0x2b1e09['as'],'attributes':_0x2b1e09[_0x3f8d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3f8d('0xd')](function(_0x3513ec){logger['info'](_0x3f8d('0x18'),_0x5305ab);logger[_0x3f8d('0x10')](_0x3f8d('0x18'),_0x5305ab,JSON[_0x3f8d('0x13')](_0x3513ec));_0x4cb1cb(_0x3513ec);})[_0x3f8d('0x20')](function(_0x397f69){logger[_0x3f8d('0x14')](_0x3f8d('0x18'),_0x397f69[_0x3f8d('0x16')],_0x5305ab);_0x270d59(_0x5cc8c1['error'](0x1f4,_0x397f69[_0x3f8d('0x16')]));});});};exports[_0x3f8d('0x21')]=function(_0x280996){var _0x80b3cc=this;return new Promise(function(_0x510494,_0xf2760e){return db['CmHopperBlack'][_0x3f8d('0x22')](_0x280996[_0x3f8d('0x23')],{'raw':_0x280996['options']?_0x280996['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x280996['options']?_0x280996[_0x3f8d('0x1a')]['where']||null:null,'attributes':_0x280996[_0x3f8d('0x1a')]?_0x280996[_0x3f8d('0x1a')][_0x3f8d('0x1c')]||null:null,'limit':_0x280996[_0x3f8d('0x1a')]?_0x280996['options'][_0x3f8d('0x24')]||null:null})['then'](function(_0x3402e7){logger[_0x3f8d('0xe')](_0x3f8d('0x21'),_0x280996);logger[_0x3f8d('0x10')](_0x3f8d('0x21'),_0x280996,JSON[_0x3f8d('0x13')](_0x3402e7));_0x510494(_0x3402e7);})[_0x3f8d('0x20')](function(_0x28a3af){logger[_0x3f8d('0x14')](_0x3f8d('0x21'),_0x28a3af[_0x3f8d('0x16')],_0x280996);_0xf2760e(_0x80b3cc[_0x3f8d('0x14')](0x1f4,_0x28a3af['message']));});});};exports[_0x3f8d('0x25')]=function(_0x2a7ce0){var _0x27f472=this;return new Promise(function(_0x4bbc0d,_0x200729){return db['CmHopperBlack'][_0x3f8d('0x26')]({'where':_0x2a7ce0['options']?_0x2a7ce0[_0x3f8d('0x1a')][_0x3f8d('0x1b')]||null:null})[_0x3f8d('0xd')](function(_0x26c3df){logger[_0x3f8d('0xe')]('DestroyCmHopperBlack',_0x2a7ce0);logger[_0x3f8d('0x10')](_0x3f8d('0x25'),_0x2a7ce0,JSON[_0x3f8d('0x13')](_0x26c3df));_0x4bbc0d(_0x26c3df);})[_0x3f8d('0x20')](function(_0x3957a8){logger[_0x3f8d('0x14')](_0x3f8d('0x25'),_0x3957a8[_0x3f8d('0x16')],_0x2a7ce0);_0x200729(_0x27f472[_0x3f8d('0x14')](0x1f4,_0x3957a8[_0x3f8d('0x16')]));});});}; \ No newline at end of file +var _0x510f=['error','message','result','catch','CmHopperBlack','findAll','options','raw','where','attributes','include','map','model','GetCmHopperBlack','stringify','limit','UpdateCmHopperBlack','destroy','DestroyCmHopperBlack','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s'];(function(_0x4207f4,_0x1f778b){var _0x29a621=function(_0xa6f5b7){while(--_0xa6f5b7){_0x4207f4['push'](_0x4207f4['shift']());}};_0x29a621(++_0x1f778b);}(_0x510f,0x1b7));var _0xf510=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x510f[_0x43d11d];return _0x38cd08;};'use strict';var _=require('lodash');var util=require(_0xf510('0x0'));var moment=require(_0xf510('0x1'));var BPromise=require(_0xf510('0x2'));var rs=require(_0xf510('0x3'));var fs=require('fs');var Redis=require(_0xf510('0x4'));var db=require(_0xf510('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf510('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf510('0x7'));var client=jayson[_0xf510('0x8')][_0xf510('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e681c,_0x56c037,_0x2fdecb){return new BPromise(function(_0x34c174,_0xdb10c6){return client['request'](_0x4e681c,_0x2fdecb)[_0xf510('0xa')](function(_0x1a15c9){logger[_0xf510('0xb')](_0xf510('0xc'),_0x56c037,_0xf510('0xd'));logger[_0xf510('0xe')](_0xf510('0xf'),_0x56c037,_0xf510('0xd'),JSON['stringify'](_0x1a15c9));if(_0x1a15c9['error']){if(_0x1a15c9[_0xf510('0x10')]['code']===0x1f4){logger['error'](_0xf510('0xc'),_0x56c037,_0x1a15c9[_0xf510('0x10')][_0xf510('0x11')]);return _0xdb10c6(_0x1a15c9[_0xf510('0x10')][_0xf510('0x11')]);}logger[_0xf510('0x10')](_0xf510('0xc'),_0x56c037,_0x1a15c9[_0xf510('0x10')][_0xf510('0x11')]);return _0x34c174(_0x1a15c9['error'][_0xf510('0x11')]);}else{logger[_0xf510('0xb')](_0xf510('0xc'),_0x56c037,_0xf510('0xd'));_0x34c174(_0x1a15c9[_0xf510('0x12')][_0xf510('0x11')]);}})[_0xf510('0x13')](function(_0x31fab6){logger[_0xf510('0x10')](_0xf510('0xc'),_0x56c037,_0x31fab6);_0xdb10c6(_0x31fab6);});});}exports['GetCmHopperBlack']=function(_0x24b2d5){var _0x513a8d=this;return new Promise(function(_0xa7d320,_0x38d714){return db[_0xf510('0x14')][_0xf510('0x15')]({'raw':_0x24b2d5[_0xf510('0x16')]?_0x24b2d5[_0xf510('0x16')][_0xf510('0x17')]===undefined?!![]:![]:!![],'where':_0x24b2d5[_0xf510('0x16')]?_0x24b2d5[_0xf510('0x16')][_0xf510('0x18')]||null:null,'attributes':_0x24b2d5[_0xf510('0x16')]?_0x24b2d5[_0xf510('0x16')][_0xf510('0x19')]||null:null,'limit':_0x24b2d5[_0xf510('0x16')]?_0x24b2d5[_0xf510('0x16')]['limit']||null:null,'include':_0x24b2d5[_0xf510('0x16')]?_0x24b2d5[_0xf510('0x16')][_0xf510('0x1a')]?_[_0xf510('0x1b')](_0x24b2d5[_0xf510('0x16')][_0xf510('0x1a')],function(_0x59c2f4){return{'model':db[_0x59c2f4[_0xf510('0x1c')]],'as':_0x59c2f4['as'],'attributes':_0x59c2f4[_0xf510('0x19')],'include':_0x59c2f4[_0xf510('0x1a')]?_[_0xf510('0x1b')](_0x59c2f4[_0xf510('0x1a')],function(_0x10b46b){return{'model':db[_0x10b46b['model']],'as':_0x10b46b['as'],'attributes':_0x10b46b[_0xf510('0x19')],'include':_0x10b46b[_0xf510('0x1a')]?_['map'](_0x10b46b[_0xf510('0x1a')],function(_0x5c25de){return{'model':db[_0x5c25de[_0xf510('0x1c')]],'as':_0x5c25de['as'],'attributes':_0x5c25de[_0xf510('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf510('0xa')](function(_0x4fc420){logger['info'](_0xf510('0x1d'),_0x24b2d5);logger['debug'](_0xf510('0x1d'),_0x24b2d5,JSON[_0xf510('0x1e')](_0x4fc420));_0xa7d320(_0x4fc420);})[_0xf510('0x13')](function(_0x18654b){logger[_0xf510('0x10')](_0xf510('0x1d'),_0x18654b[_0xf510('0x11')],_0x24b2d5);_0x38d714(_0x513a8d[_0xf510('0x10')](0x1f4,_0x18654b['message']));});});};exports['UpdateCmHopperBlack']=function(_0x5a6669){var _0x397080=this;return new Promise(function(_0x3ad65d,_0x385105){return db['CmHopperBlack']['update'](_0x5a6669['body'],{'raw':_0x5a6669['options']?_0x5a6669[_0xf510('0x16')][_0xf510('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a6669['options']?_0x5a6669[_0xf510('0x16')]['where']||null:null,'attributes':_0x5a6669[_0xf510('0x16')]?_0x5a6669['options'][_0xf510('0x19')]||null:null,'limit':_0x5a6669[_0xf510('0x16')]?_0x5a6669['options'][_0xf510('0x1f')]||null:null})[_0xf510('0xa')](function(_0x41ea7e){logger[_0xf510('0xb')](_0xf510('0x20'),_0x5a6669);logger['debug'](_0xf510('0x20'),_0x5a6669,JSON[_0xf510('0x1e')](_0x41ea7e));_0x3ad65d(_0x41ea7e);})[_0xf510('0x13')](function(_0x58b57e){logger[_0xf510('0x10')]('UpdateCmHopperBlack',_0x58b57e[_0xf510('0x11')],_0x5a6669);_0x385105(_0x397080[_0xf510('0x10')](0x1f4,_0x58b57e[_0xf510('0x11')]));});});};exports['DestroyCmHopperBlack']=function(_0x22309d){var _0xac8dc2=this;return new Promise(function(_0x3f5ad4,_0x7717d7){return db[_0xf510('0x14')][_0xf510('0x21')]({'where':_0x22309d[_0xf510('0x16')]?_0x22309d['options'][_0xf510('0x18')]||null:null})['then'](function(_0x4342ab){logger[_0xf510('0xb')](_0xf510('0x22'),_0x22309d);logger[_0xf510('0xe')](_0xf510('0x22'),_0x22309d,JSON[_0xf510('0x1e')](_0x4342ab));_0x3f5ad4(_0x4342ab);})[_0xf510('0x13')](function(_0xf5d95e){logger[_0xf510('0x10')](_0xf510('0x22'),_0xf5d95e['message'],_0x22309d);_0x7717d7(_0xac8dc2[_0xf510('0x10')](0x1f4,_0xf5d95e[_0xf510('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index ee29978..f83503c 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 _0x34e8=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','describe','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x2d1cf4,_0x2ea9ee){var _0x554a7c=function(_0x55cc39){while(--_0x55cc39){_0x2d1cf4['push'](_0x2d1cf4['shift']());}};_0x554a7c(++_0x2ea9ee);}(_0x34e8,0x12c));var _0x834e=function(_0x9ba2b7,_0x1184f2){_0x9ba2b7=_0x9ba2b7-0x0;var _0x15e1cb=_0x34e8[_0x9ba2b7];return _0x15e1cb;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var auth=require(_0x834e('0x5'));var interaction=require(_0x834e('0x6'));var config=require(_0x834e('0x7'));var controller=require(_0x834e('0x8'));router[_0x834e('0x9')]('/',auth[_0x834e('0xa')](),controller['index']);router[_0x834e('0x9')]('/describe',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0x9')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0xe')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0xf')]);router[_0x834e('0x10')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0x11')]);module[_0x834e('0x12')]=router; \ No newline at end of file +var _0x7f42=['exports','multer','path','connect-timeout','Router','../../components/interaction/service','./cmHopperBlack.controller','isAuthenticated','get','/describe','describe','/:id','show','put','update','delete','destroy'];(function(_0x2577f7,_0x4e4781){var _0x55d372=function(_0x59b397){while(--_0x59b397){_0x2577f7['push'](_0x2577f7['shift']());}};_0x55d372(++_0x4e4781);}(_0x7f42,0x1dd));var _0x27f4=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x7f42[_0x1cc8fe];return _0x230054;};'use strict';var multer=require(_0x27f4('0x0'));var util=require('util');var path=require(_0x27f4('0x1'));var timeout=require(_0x27f4('0x2'));var express=require('express');var router=express[_0x27f4('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x27f4('0x4'));var config=require('../../config/environment');var controller=require(_0x27f4('0x5'));router['get']('/',auth[_0x27f4('0x6')](),controller['index']);router[_0x27f4('0x7')](_0x27f4('0x8'),auth[_0x27f4('0x6')](),controller[_0x27f4('0x9')]);router[_0x27f4('0x7')](_0x27f4('0xa'),auth[_0x27f4('0x6')](),controller[_0x27f4('0xb')]);router[_0x27f4('0xc')](_0x27f4('0xa'),auth[_0x27f4('0x6')](),controller[_0x27f4('0xd')]);router[_0x27f4('0xe')](_0x27f4('0xa'),auth[_0x27f4('0x6')](),controller[_0x27f4('0xf')]);module[_0x27f4('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index f1808b6..050d515 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 _0x84e9=['STRING','endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER','DATE'];(function(_0x35bff5,_0x28fd80){var _0x45b497=function(_0x26753e){while(--_0x26753e){_0x35bff5['push'](_0x35bff5['shift']());}};_0x45b497(++_0x28fd80);}(_0x84e9,0x133));var _0x984e=function(_0x34979a,_0x169be9){_0x34979a=_0x34979a-0x0;var _0x16cab8=_0x84e9[_0x34979a];return _0x16cab8;};'use strict';var Sequelize=require(_0x984e('0x0'));var moment=require(_0x984e('0x1'));module[_0x984e('0x2')]={'state':{'type':Sequelize[_0x984e('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x984e('0x4')]},'countbusyretry':{'type':Sequelize[_0x984e('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x984e('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x984e('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x984e('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x984e('0x5')]},'originatecalleridnum':{'type':Sequelize[_0x984e('0x5')]},'originatecalleridname':{'type':Sequelize[_0x984e('0x5')]},'calleridnum':{'type':Sequelize[_0x984e('0x5')]},'calleridname':{'type':Sequelize[_0x984e('0x5')]},'starttime':{'type':Sequelize[_0x984e('0x4')]},'responsetime':{'type':Sequelize[_0x984e('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x984e('0x4')]},'endtime':{'type':Sequelize[_0x984e('0x4')]},'ringtime':{'type':Sequelize[_0x984e('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x984e('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x984e('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x984e('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x984e('0x5')]},'campaign':{'type':Sequelize[_0x984e('0x5')]},'campaigntype':{'type':Sequelize[_0x984e('0x5')]},'membername':{'type':Sequelize[_0x984e('0x5')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x984e('0x5')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x35bd02){var _0x509f68=this['getDataValue'](_0x984e('0x6'));if(_0x509f68&&_0x35bd02){this[_0x984e('0x7')](_0x984e('0x8'),moment(_0x35bd02)[_0x984e('0x9')](moment(_0x509f68),_0x984e('0xa')));}return this['setDataValue'](_0x984e('0xb'),_0x35bd02);}},'amd':{'type':Sequelize[_0x984e('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x984e('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x984e('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x984e('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x984e('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x984e('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x984e('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x984e('0x4')]},'recallme':{'type':Sequelize[_0x984e('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x984e('0x4')]}}; \ No newline at end of file +var _0x88a0=['followuptime','diff','seconds','dispositionat','BOOLEAN','sequelize','moment','exports','STRING','DATE','INTEGER','getDataValue','endtime','setDataValue'];(function(_0x1c9648,_0x19f34f){var _0x8be4fb=function(_0x57192c){while(--_0x57192c){_0x1c9648['push'](_0x1c9648['shift']());}};_0x8be4fb(++_0x19f34f);}(_0x88a0,0x12b));var _0x088a=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x88a0[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0x088a('0x0'));var moment=require(_0x088a('0x1'));module[_0x088a('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x088a('0x3')]},'scheduledat':{'type':Sequelize[_0x088a('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x088a('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x088a('0x5')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x088a('0x5')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x088a('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x088a('0x3')]},'originatecalleridname':{'type':Sequelize[_0x088a('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x088a('0x3')]},'starttime':{'type':Sequelize[_0x088a('0x4')]},'responsetime':{'type':Sequelize[_0x088a('0x4')]},'answertime':{'type':Sequelize[_0x088a('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x088a('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x088a('0x5')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x088a('0x5')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x088a('0x5')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x088a('0x3')]},'campaigntype':{'type':Sequelize[_0x088a('0x3')]},'membername':{'type':Sequelize[_0x088a('0x3')]},'reason':{'type':Sequelize[_0x088a('0x3')]},'disposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x1ea1c0){var _0x5c36c1=this[_0x088a('0x6')](_0x088a('0x7'));if(_0x5c36c1&&_0x1ea1c0){this[_0x088a('0x8')](_0x088a('0x9'),moment(_0x1ea1c0)[_0x088a('0xa')](moment(_0x5c36c1),_0x088a('0xb')));}return this['setDataValue'](_0x088a('0xc'),_0x1ea1c0);}},'amd':{'type':Sequelize[_0x088a('0xd')],'defaultValue':![]},'fax':{'type':Sequelize[_0x088a('0xd')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x088a('0xd')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x088a('0xd')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x088a('0x4')]},'callback':{'type':Sequelize[_0x088a('0xd')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x088a('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x088a('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x088a('0x4')]},'recallme':{'type':Sequelize[_0x088a('0xd')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x088a('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index d79176f..dab2066 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 _0xe1a3=['busyContacts','abandonedContacts','moveContactsQueueCampaignHopperFinal','insert','cm_hopper','phone','scheduledAt','ContactId','ListId','updatedAt','ANY_VALUE(calleridnum)','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','createdAt','from','cm_hopper_final','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','VoiceQueueId\x20=\x20?','calleridnum','state\x20=\x204','into','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','group','checkContactHopper','findOne','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','limit','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','CmHopperFinal','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','day','add','merge','filter','map','options','count','includeAll','include','rows','catch','show','params','find','describe','update','uniqueid','body','findAll','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','countContactsIvrCampaignHopperFinal','noSuchContacts','noAnswerContacts'];(function(_0x50e593,_0x3ae998){var _0x3821d0=function(_0x53c295){while(--_0x53c295){_0x50e593['push'](_0x50e593['shift']());}};_0x3821d0(++_0x3ae998);}(_0xe1a3,0x19b));var _0x3e1a=function(_0x54fe8f,_0x434bcc){_0x54fe8f=_0x54fe8f-0x0;var _0x5d2583=_0xe1a3[_0x54fe8f];return _0x5d2583;};'use strict';var pdf=require(_0x3e1a('0x0'));var emlformat=require(_0x3e1a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3e1a('0x2'));var jsonpatch=require(_0x3e1a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3e1a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x3e1a('0x5'));var csv=require(_0x3e1a('0x6'));var ejs=require(_0x3e1a('0x7'));var fs=require('fs');var _=require(_0x3e1a('0x8'));var squel=require(_0x3e1a('0x9'));var crypto=require(_0x3e1a('0xa'));var jsforce=require(_0x3e1a('0xb'));var deskjs=require(_0x3e1a('0xc'));var toCsv=require(_0x3e1a('0x6'));var querystring=require(_0x3e1a('0xd'));var Papa=require(_0x3e1a('0xe'));var Redis=require(_0x3e1a('0xf'));var qs=require(_0x3e1a('0x10'));var logger=require(_0x3e1a('0x11'))(_0x3e1a('0x12'));var utils=require(_0x3e1a('0x13'));var config=require(_0x3e1a('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44a554,_0x19a5af){_0x19a5af=_0x19a5af||0xcc;return function(_0x3a8614){if(_0x3a8614){return _0x44a554['sendStatus'](_0x19a5af);}return _0x44a554[_0x3e1a('0x15')](_0x19a5af)[_0x3e1a('0x16')]();};}function respondWithResult(_0x47de6b,_0x1a8838){_0x1a8838=_0x1a8838||0xc8;return function(_0x1f7986){if(_0x1f7986){return _0x47de6b[_0x3e1a('0x15')](_0x1a8838)[_0x3e1a('0x17')](_0x1f7986);}};}function respondWithFilteredResult(_0x20f00c,_0x2939d0){return function(_0x1758ab){if(_0x1758ab){var _0x1bddb9=_0x1758ab['count'],_0x17741a=_0x2939d0['offset'],_0x23b96a=_0x2939d0[_0x3e1a('0x18')]+_0x2939d0[_0x3e1a('0x19')],_0x289e68;if(_0x23b96a>=_0x1bddb9){_0x23b96a=_0x1bddb9;_0x289e68=0xc8;}else{_0x289e68=0xce;}_0x20f00c[_0x3e1a('0x15')](_0x289e68);return _0x20f00c[_0x3e1a('0x1a')](_0x3e1a('0x1b'),_0x17741a+'-'+_0x23b96a+'/'+_0x1bddb9)[_0x3e1a('0x17')](_0x1758ab);}return null;};}function patchUpdates(_0x3001fe){return function(_0x9d386a){try{jsonpatch[_0x3e1a('0x1c')](_0x9d386a,_0x3001fe,!![]);}catch(_0x176c50){return BPromise['reject'](_0x176c50);}return _0x9d386a[_0x3e1a('0x1d')]();};}function saveUpdates(_0x7f2c2f,_0x464f3f){return function(_0x18423c){if(_0x18423c){return _0x18423c['update'](_0x7f2c2f)[_0x3e1a('0x1e')](function(_0x33f7b5){return _0x33f7b5;});}return null;};}function removeEntity(_0x401aa,_0x2ed5a6){return function(_0x14aff7){if(_0x14aff7){return _0x14aff7[_0x3e1a('0x1f')]()[_0x3e1a('0x1e')](function(){_0x401aa[_0x3e1a('0x15')](0xcc)[_0x3e1a('0x16')]();});}};}function handleEntityNotFound(_0x3cd385,_0x471bce){return function(_0x21c6dd){if(!_0x21c6dd){_0x3cd385[_0x3e1a('0x20')](0x194);}return _0x21c6dd;};}function handleError(_0xe8bddf,_0x2fbbe6){_0x2fbbe6=_0x2fbbe6||0x1f4;return function(_0x468348){logger[_0x3e1a('0x21')](_0x468348[_0x3e1a('0x22')]);if(_0x468348['name']){delete _0x468348[_0x3e1a('0x23')];}_0xe8bddf[_0x3e1a('0x15')](_0x2fbbe6)[_0x3e1a('0x24')](_0x468348);};}exports[_0x3e1a('0x25')]=function(_0xe50af1,_0x24cc7b){var _0x5b137f={},_0x25e2b8={},_0x4a7ae4={'count':0x0,'rows':[]};var _0x22fe3d=db[_0x3e1a('0x26')][_0x3e1a('0x27')];_0x25e2b8['model']=_[_0x3e1a('0x28')](_0x22fe3d);var _0x121c43={'dateStart':_0xe50af1[_0x3e1a('0x29')][_0x3e1a('0x2a')],'dateEnd':_0xe50af1['query'][_0x3e1a('0x2b')]};delete _0xe50af1[_0x3e1a('0x29')][_0x3e1a('0x2a')];delete _0xe50af1[_0x3e1a('0x29')][_0x3e1a('0x2b')];_0x25e2b8[_0x3e1a('0x29')]=_[_0x3e1a('0x28')](_0xe50af1[_0x3e1a('0x29')]);_0x25e2b8[_0x3e1a('0x2c')]=_[_0x3e1a('0x2d')](_0x25e2b8[_0x3e1a('0x2e')],_0x25e2b8[_0x3e1a('0x29')]);_0x5b137f[_0x3e1a('0x2f')]=_[_0x3e1a('0x2d')](_0x25e2b8['model'],qs['fields'](_0xe50af1[_0x3e1a('0x29')][_0x3e1a('0x30')]));_0x5b137f[_0x3e1a('0x2f')]=_0x5b137f['attributes'][_0x3e1a('0x31')]?_0x5b137f['attributes']:_0x25e2b8[_0x3e1a('0x2e')];if(!_0xe50af1['query'][_0x3e1a('0x32')]('nolimit')){_0x5b137f[_0x3e1a('0x19')]=qs['limit'](_0xe50af1['query'][_0x3e1a('0x19')]);_0x5b137f['offset']=qs['offset'](_0xe50af1[_0x3e1a('0x29')][_0x3e1a('0x18')]);}_0x5b137f[_0x3e1a('0x33')]=qs['sort'](_0xe50af1[_0x3e1a('0x29')][_0x3e1a('0x34')]);_0x5b137f[_0x3e1a('0x35')]=qs[_0x3e1a('0x2c')](_[_0x3e1a('0x36')](_0xe50af1[_0x3e1a('0x29')],_0x25e2b8[_0x3e1a('0x2c')]));if(_0x121c43['dateStart']){if(_0x121c43['dateEnd']){_0x121c43['dateEnd']=moment(_0x121c43['dateEnd'])['add'](0x1,_0x3e1a('0x37'));}else{_0x121c43[_0x3e1a('0x2b')]=moment(_0x121c43['dateStart'])[_0x3e1a('0x38')](0x1,_0x3e1a('0x37'));}_[_0x3e1a('0x39')](_0x5b137f[_0x3e1a('0x35')],{'createdAt':{'$gte':_0x121c43[_0x3e1a('0x2a')],'$lte':_0x121c43[_0x3e1a('0x2b')]}});}if(_0xe50af1[_0x3e1a('0x29')][_0x3e1a('0x3a')]){_0x5b137f[_0x3e1a('0x35')]=_['merge'](_0x5b137f[_0x3e1a('0x35')],{'$or':_[_0x3e1a('0x3b')](_0x5b137f[_0x3e1a('0x2f')],function(_0x398426){var _0x2801b6={};_0x2801b6[_0x398426]={'$like':'%'+_0xe50af1[_0x3e1a('0x29')][_0x3e1a('0x3a')]+'%'};return _0x2801b6;})});}_0x5b137f=_[_0x3e1a('0x39')]({},_0x5b137f,_0xe50af1[_0x3e1a('0x3c')]);var _0x1b0637={'where':_0x5b137f[_0x3e1a('0x35')]};return db[_0x3e1a('0x26')][_0x3e1a('0x3d')](_0x1b0637)[_0x3e1a('0x1e')](function(_0x39251c){_0x4a7ae4[_0x3e1a('0x3d')]=_0x39251c;if(_0xe50af1[_0x3e1a('0x29')][_0x3e1a('0x3e')]){_0x5b137f[_0x3e1a('0x3f')]=[{'all':!![]}];}return db[_0x3e1a('0x26')]['findAll'](_0x5b137f);})[_0x3e1a('0x1e')](function(_0x2888ee){_0x4a7ae4[_0x3e1a('0x40')]=_0x2888ee;return _0x4a7ae4;})[_0x3e1a('0x1e')](respondWithFilteredResult(_0x24cc7b,_0x5b137f))[_0x3e1a('0x41')](handleError(_0x24cc7b,null));};exports[_0x3e1a('0x42')]=function(_0x343d34,_0x1e1824){var _0x3aab40={'raw':!![],'where':{'id':_0x343d34[_0x3e1a('0x43')]['id']}},_0x572125={};_0x572125[_0x3e1a('0x2e')]=_[_0x3e1a('0x28')](db[_0x3e1a('0x26')][_0x3e1a('0x27')]);_0x572125[_0x3e1a('0x29')]=_[_0x3e1a('0x28')](_0x343d34['query']);_0x572125[_0x3e1a('0x2c')]=_[_0x3e1a('0x2d')](_0x572125[_0x3e1a('0x2e')],_0x572125['query']);_0x3aab40['attributes']=_[_0x3e1a('0x2d')](_0x572125['model'],qs[_0x3e1a('0x30')](_0x343d34['query'][_0x3e1a('0x30')]));_0x3aab40[_0x3e1a('0x2f')]=_0x3aab40['attributes'][_0x3e1a('0x31')]?_0x3aab40[_0x3e1a('0x2f')]:_0x572125[_0x3e1a('0x2e')];if(_0x343d34[_0x3e1a('0x29')][_0x3e1a('0x3e')]){_0x3aab40[_0x3e1a('0x3f')]=[{'all':!![]}];}_0x3aab40=_[_0x3e1a('0x39')]({},_0x3aab40,_0x343d34['options']);return db[_0x3e1a('0x26')][_0x3e1a('0x44')](_0x3aab40)[_0x3e1a('0x1e')](handleEntityNotFound(_0x1e1824,null))['then'](respondWithResult(_0x1e1824,null))['catch'](handleError(_0x1e1824,null));};exports['describe']=function(_0x27d05f,_0x48d9b4){return db[_0x3e1a('0x26')][_0x3e1a('0x45')]()[_0x3e1a('0x1e')](respondWithResult(_0x48d9b4,null))[_0x3e1a('0x41')](handleError(_0x48d9b4,null));};exports[_0x3e1a('0x46')]=function(_0x474747,_0x2ee2b8){if(_0x474747['body'][_0x3e1a('0x47')]){delete _0x474747[_0x3e1a('0x48')][_0x3e1a('0x47')];}return db['CmHopperFinal']['find']({'where':{'uniqueid':_0x474747['params']['id']}})[_0x3e1a('0x1e')](handleEntityNotFound(_0x2ee2b8,null))[_0x3e1a('0x1e')](saveUpdates(_0x474747['body'],null))[_0x3e1a('0x1e')](respondWithResult(_0x2ee2b8,null))['catch'](handleError(_0x2ee2b8,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x585dda,_0x13c3f3,_0x175c24){return db['CmHopperFinal'][_0x3e1a('0x49')]({'raw':![],'where':{'VoiceQueueId':_0x585dda[_0x3e1a('0x43')]['id']},'attributes':[[db['sequelize']['fn'](_0x3e1a('0x4a'),db['sequelize']['fn']('IF',db[_0x3e1a('0x4b')][_0x3e1a('0x4c')](_0x3e1a('0x4d')))),'noSuchContacts'],[db['sequelize']['fn'](_0x3e1a('0x4a'),db[_0x3e1a('0x4b')]['fn']('IF',db['sequelize'][_0x3e1a('0x4c')]('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db['sequelize']['fn'](_0x3e1a('0x4a'),db[_0x3e1a('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x3e1a('0x4e')))),'busyContacts'],[db[_0x3e1a('0x4b')]['fn'](_0x3e1a('0x4a'),db['sequelize']['fn']('IF',db[_0x3e1a('0x4b')][_0x3e1a('0x4c')](_0x3e1a('0x4f')))),_0x3e1a('0x50')],[db[_0x3e1a('0x4b')]['fn'](_0x3e1a('0x4a'),db[_0x3e1a('0x4b')]['fn']('IF',db[_0x3e1a('0x4b')][_0x3e1a('0x4c')](_0x3e1a('0x51')))),_0x3e1a('0x52')],[db[_0x3e1a('0x4b')]['fn']('COUNT',db[_0x3e1a('0x4b')]['fn']('IF',db[_0x3e1a('0x4b')][_0x3e1a('0x4c')](_0x3e1a('0x53')))),'abandonedContacts'],[db['sequelize']['fn'](_0x3e1a('0x4a'),db[_0x3e1a('0x4b')]['fn']('IF',db[_0x3e1a('0x4b')][_0x3e1a('0x4c')](_0x3e1a('0x54')))),_0x3e1a('0x55')]]})[_0x3e1a('0x1e')](handleEntityNotFound(_0x13c3f3,null))['then'](respondWithResult(_0x13c3f3,null))[_0x3e1a('0x41')](handleError(_0x13c3f3,null));};exports[_0x3e1a('0x56')]=function(_0x11e986,_0x2482ff,_0xaec028){return db[_0x3e1a('0x26')][_0x3e1a('0x49')]({'raw':![],'where':{'CampaignId':_0x11e986['params']['id']},'attributes':[[db[_0x3e1a('0x4b')]['fn'](_0x3e1a('0x4a'),db[_0x3e1a('0x4b')]['fn']('IF',db[_0x3e1a('0x4b')][_0x3e1a('0x4c')](_0x3e1a('0x4d')))),_0x3e1a('0x57')],[db[_0x3e1a('0x4b')]['fn'](_0x3e1a('0x4a'),db[_0x3e1a('0x4b')]['fn']('IF',db[_0x3e1a('0x4b')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x3e1a('0x58')],[db['sequelize']['fn']('COUNT',db[_0x3e1a('0x4b')]['fn']('IF',db[_0x3e1a('0x4b')][_0x3e1a('0x4c')]('`state`\x20=\x205,\x201,\x20null'))),_0x3e1a('0x59')],[db[_0x3e1a('0x4b')]['fn'](_0x3e1a('0x4a'),db[_0x3e1a('0x4b')]['fn']('IF',db['sequelize'][_0x3e1a('0x4c')]('`state`\x20=\x208,\x201,\x20null'))),_0x3e1a('0x50')],[db[_0x3e1a('0x4b')]['fn'](_0x3e1a('0x4a'),db[_0x3e1a('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x3e1a('0x51')))),_0x3e1a('0x52')],[db[_0x3e1a('0x4b')]['fn'](_0x3e1a('0x4a'),db[_0x3e1a('0x4b')]['fn']('IF',db[_0x3e1a('0x4b')][_0x3e1a('0x4c')](_0x3e1a('0x53')))),_0x3e1a('0x5a')],[db['sequelize']['fn'](_0x3e1a('0x4a'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x3e1a('0x54')))),_0x3e1a('0x55')]]})[_0x3e1a('0x1e')](handleEntityNotFound(_0x2482ff,null))[_0x3e1a('0x1e')](respondWithResult(_0x2482ff,null))['catch'](handleError(_0x2482ff,null));};exports[_0x3e1a('0x5b')]=function(_0x18e04b,_0x24710d,_0x106fe8){return db['VoiceQueue'][_0x3e1a('0x44')]({'where':{'id':_0x18e04b[_0x3e1a('0x43')]['id']}})['then'](handleEntityNotFound(_0x24710d,null))['then'](function(_0x42c4f1){var _0x7f13e5;if(_0x42c4f1){_0x7f13e5=squel[_0x3e1a('0x5c')]()['into'](_0x3e1a('0x5d'))['fromQuery']([_0x3e1a('0x5e'),_0x3e1a('0x5f'),_0x3e1a('0x60'),_0x3e1a('0x61'),'VoiceQueueId','createdAt',_0x3e1a('0x62')],squel['select']()['field'](_0x3e1a('0x63'),'phone')[_0x3e1a('0x64')](_0x3e1a('0x65'),'scheduledAt')[_0x3e1a('0x64')](_0x3e1a('0x66'),_0x3e1a('0x60'))['field'](_0x3e1a('0x67'),_0x3e1a('0x61'))[_0x3e1a('0x64')](_0x3e1a('0x68'),_0x3e1a('0x69'))[_0x3e1a('0x64')](_0x3e1a('0x65'),_0x3e1a('0x6a'))[_0x3e1a('0x64')](_0x3e1a('0x65'),_0x3e1a('0x62'))[_0x3e1a('0x6b')](_0x3e1a('0x6c'))[_0x3e1a('0x35')]('VoiceQueueId\x20=\x20?',_0x18e04b[_0x3e1a('0x43')]['id'][_0x3e1a('0x6d')]())['where']('state\x20=\x20?',_0x18e04b['body'][_0x3e1a('0x6e')][_0x3e1a('0x6d')]())['where'](_0x3e1a('0x6f'))[_0x3e1a('0x35')](_0x3e1a('0x70'),squel[_0x3e1a('0x71')]()[_0x3e1a('0x64')]('phone')[_0x3e1a('0x6b')]('cm_hopper')['where'](_0x3e1a('0x72'),_0x18e04b[_0x3e1a('0x43')]['id'][_0x3e1a('0x6d')]()))[_0x3e1a('0x35')](_0x3e1a('0x70'),squel[_0x3e1a('0x71')]()[_0x3e1a('0x64')](_0x3e1a('0x73'))[_0x3e1a('0x6b')](_0x3e1a('0x6c'))['where']('VoiceQueueId\x20=\x20?',_0x18e04b['params']['id'][_0x3e1a('0x6d')]())[_0x3e1a('0x35')](_0x3e1a('0x74')))['group'](_0x3e1a('0x60')))[_0x3e1a('0x6d')]();return db[_0x3e1a('0x4b')][_0x3e1a('0x29')](_0x7f13e5);}return[];})[_0x3e1a('0x1e')](respondWithResult(_0x24710d,null))[_0x3e1a('0x41')](handleError(_0x24710d,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1d134c,_0xb32143,_0x3ca075){return db['Campaign'][_0x3e1a('0x44')]({'where':{'id':_0x1d134c[_0x3e1a('0x43')]['id']}})[_0x3e1a('0x1e')](handleEntityNotFound(_0xb32143,null))[_0x3e1a('0x1e')](function(_0x3c92d8){var _0x542d70;if(_0x3c92d8){_0x542d70=squel['insert']()[_0x3e1a('0x75')](_0x3e1a('0x5d'))['fromQuery']([_0x3e1a('0x5e'),_0x3e1a('0x5f'),_0x3e1a('0x60'),_0x3e1a('0x61'),_0x3e1a('0x76'),'createdAt',_0x3e1a('0x62')],squel[_0x3e1a('0x71')]()['field']('ANY_VALUE(calleridnum)','phone')['field']('NOW()','scheduledAt')['field']('ANY_VALUE(ContactId)','ContactId')['field']('ANY_VALUE(ListId)','ListId')[_0x3e1a('0x64')](_0x3e1a('0x77'),_0x3e1a('0x76'))[_0x3e1a('0x64')](_0x3e1a('0x65'),_0x3e1a('0x6a'))['field']('NOW()','updatedAt')[_0x3e1a('0x6b')](_0x3e1a('0x6c'))[_0x3e1a('0x35')](_0x3e1a('0x78'),_0x1d134c[_0x3e1a('0x43')]['id'][_0x3e1a('0x6d')]())['where'](_0x3e1a('0x79'),_0x1d134c[_0x3e1a('0x48')][_0x3e1a('0x6e')][_0x3e1a('0x6d')]())['where'](_0x3e1a('0x6f'))[_0x3e1a('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x3e1a('0x64')]('phone')[_0x3e1a('0x6b')]('cm_hopper')[_0x3e1a('0x35')]('CampaignId\x20=\x20?',_0x1d134c['params']['id'][_0x3e1a('0x6d')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x3e1a('0x71')]()[_0x3e1a('0x64')](_0x3e1a('0x73'))[_0x3e1a('0x6b')](_0x3e1a('0x6c'))[_0x3e1a('0x35')](_0x3e1a('0x78'),_0x1d134c[_0x3e1a('0x43')]['id']['toString']())[_0x3e1a('0x35')]('state\x20=\x204'))[_0x3e1a('0x7a')]('ContactId'))[_0x3e1a('0x6d')]();return db['sequelize']['query'](_0x542d70);}return[];})[_0x3e1a('0x1e')](respondWithResult(_0xb32143,null))[_0x3e1a('0x41')](handleError(_0xb32143,null));};exports[_0x3e1a('0x7b')]=function(_0xe8aa15,_0x55a327,_0x481bdb){return db['CmHopper'][_0x3e1a('0x7c')]({'where':{'VoiceQueueId':_0xe8aa15[_0x3e1a('0x48')][_0x3e1a('0x69')],'CampaignId':_0xe8aa15[_0x3e1a('0x48')][_0x3e1a('0x76')],'ContactId':_0xe8aa15[_0x3e1a('0x48')][_0x3e1a('0x60')]}})[_0x3e1a('0x1e')](handleEntityNotFound(_0x55a327,null))[_0x3e1a('0x1e')](function(_0x47408e){if(_0x47408e){return _0x47408e;}return null;})[_0x3e1a('0x1e')](respondWithResult(_0x55a327,null))[_0x3e1a('0x41')](handleError(_0x55a327,null));}; \ No newline at end of file +var _0x33ad=['show','describe','update','body','uniqueid','params','countContactsQueueCampaignHopperFinal','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','countContactsIvrCampaignHopperFinal','noAnswerContacts','`state`\x20=\x208,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','scheduledAt','ListId','VoiceQueueId','createdAt','select','phone','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','updatedAt','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','from','ContactId','Campaign','find','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state','calleridnum','group','CmHopper','findOne','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../mysqldb','status','end','count','offset','limit','json','apply','reject','save','destroy','then','stack','name','send','index','CmHopperFinal','rawAttributes','keys','query','dateEnd','dateStart','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','add','day','merge','filter','map','options','includeAll','include','findAll','rows','catch'];(function(_0x25e483,_0x2eedd8){var _0x117af9=function(_0x1705ec){while(--_0x1705ec){_0x25e483['push'](_0x25e483['shift']());}};_0x117af9(++_0x2eedd8);}(_0x33ad,0x13b));var _0xd33a=function(_0x36703a,_0x26ef88){_0x36703a=_0x36703a-0x0;var _0x35e756=_0x33ad[_0x36703a];return _0x35e756;};'use strict';var pdf=require(_0xd33a('0x0'));var emlformat=require(_0xd33a('0x1'));var rimraf=require(_0xd33a('0x2'));var zipdir=require(_0xd33a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd33a('0x4'));var moment=require(_0xd33a('0x5'));var BPromise=require(_0xd33a('0x6'));var Mustache=require('mustache');var util=require(_0xd33a('0x7'));var path=require(_0xd33a('0x8'));var sox=require(_0xd33a('0x9'));var csv=require(_0xd33a('0xa'));var ejs=require(_0xd33a('0xb'));var fs=require('fs');var _=require(_0xd33a('0xc'));var squel=require(_0xd33a('0xd'));var crypto=require(_0xd33a('0xe'));var jsforce=require(_0xd33a('0xf'));var deskjs=require(_0xd33a('0x10'));var toCsv=require(_0xd33a('0xa'));var querystring=require(_0xd33a('0x11'));var Papa=require(_0xd33a('0x12'));var Redis=require('ioredis');var qs=require(_0xd33a('0x13'));var logger=require('../../config/logger')(_0xd33a('0x14'));var utils=require(_0xd33a('0x15'));var config=require('../../config/environment');var db=require(_0xd33a('0x16'))['db'];function respondWithStatusCode(_0x5553ea,_0x42ee24){_0x42ee24=_0x42ee24||0xcc;return function(_0xf95c72){if(_0xf95c72){return _0x5553ea['sendStatus'](_0x42ee24);}return _0x5553ea[_0xd33a('0x17')](_0x42ee24)[_0xd33a('0x18')]();};}function respondWithResult(_0x342075,_0x48bfc3){_0x48bfc3=_0x48bfc3||0xc8;return function(_0x5dbec1){if(_0x5dbec1){return _0x342075[_0xd33a('0x17')](_0x48bfc3)['json'](_0x5dbec1);}};}function respondWithFilteredResult(_0x3e47a0,_0x4aba73){return function(_0x103ddc){if(_0x103ddc){var _0x39bcff=_0x103ddc[_0xd33a('0x19')],_0x25b350=_0x4aba73[_0xd33a('0x1a')],_0x37025e=_0x4aba73[_0xd33a('0x1a')]+_0x4aba73[_0xd33a('0x1b')],_0x8a1ab3;if(_0x37025e>=_0x39bcff){_0x37025e=_0x39bcff;_0x8a1ab3=0xc8;}else{_0x8a1ab3=0xce;}_0x3e47a0[_0xd33a('0x17')](_0x8a1ab3);return _0x3e47a0['set']('Content-Range',_0x25b350+'-'+_0x37025e+'/'+_0x39bcff)[_0xd33a('0x1c')](_0x103ddc);}return null;};}function patchUpdates(_0x15f492){return function(_0x5d9428){try{jsonpatch[_0xd33a('0x1d')](_0x5d9428,_0x15f492,!![]);}catch(_0xbd74be){return BPromise[_0xd33a('0x1e')](_0xbd74be);}return _0x5d9428[_0xd33a('0x1f')]();};}function saveUpdates(_0xffab69,_0x17f11a){return function(_0x532c56){if(_0x532c56){return _0x532c56['update'](_0xffab69)['then'](function(_0x209497){return _0x209497;});}return null;};}function removeEntity(_0x38d481,_0x144b50){return function(_0x348288){if(_0x348288){return _0x348288[_0xd33a('0x20')]()[_0xd33a('0x21')](function(){_0x38d481[_0xd33a('0x17')](0xcc)[_0xd33a('0x18')]();});}};}function handleEntityNotFound(_0x487d2b,_0x5c34f8){return function(_0x32fd7b){if(!_0x32fd7b){_0x487d2b['sendStatus'](0x194);}return _0x32fd7b;};}function handleError(_0x20a0be,_0x5cd063){_0x5cd063=_0x5cd063||0x1f4;return function(_0x17537c){logger['error'](_0x17537c[_0xd33a('0x22')]);if(_0x17537c[_0xd33a('0x23')]){delete _0x17537c[_0xd33a('0x23')];}_0x20a0be['status'](_0x5cd063)[_0xd33a('0x24')](_0x17537c);};}exports[_0xd33a('0x25')]=function(_0x2a5899,_0xe19552){var _0x5a4b15={},_0x3e94cb={},_0x25a949={'count':0x0,'rows':[]};var _0x2a1b0f=db[_0xd33a('0x26')][_0xd33a('0x27')];_0x3e94cb['model']=_[_0xd33a('0x28')](_0x2a1b0f);var _0x2bad1a={'dateStart':_0x2a5899[_0xd33a('0x29')]['dateStart'],'dateEnd':_0x2a5899[_0xd33a('0x29')][_0xd33a('0x2a')]};delete _0x2a5899[_0xd33a('0x29')][_0xd33a('0x2b')];delete _0x2a5899[_0xd33a('0x29')][_0xd33a('0x2a')];_0x3e94cb[_0xd33a('0x29')]=_['keys'](_0x2a5899['query']);_0x3e94cb['filters']=_[_0xd33a('0x2c')](_0x3e94cb[_0xd33a('0x2d')],_0x3e94cb[_0xd33a('0x29')]);_0x5a4b15[_0xd33a('0x2e')]=_['intersection'](_0x3e94cb[_0xd33a('0x2d')],qs[_0xd33a('0x2f')](_0x2a5899[_0xd33a('0x29')]['fields']));_0x5a4b15[_0xd33a('0x2e')]=_0x5a4b15[_0xd33a('0x2e')][_0xd33a('0x30')]?_0x5a4b15['attributes']:_0x3e94cb[_0xd33a('0x2d')];if(!_0x2a5899['query'][_0xd33a('0x31')](_0xd33a('0x32'))){_0x5a4b15[_0xd33a('0x1b')]=qs[_0xd33a('0x1b')](_0x2a5899[_0xd33a('0x29')][_0xd33a('0x1b')]);_0x5a4b15[_0xd33a('0x1a')]=qs['offset'](_0x2a5899[_0xd33a('0x29')][_0xd33a('0x1a')]);}_0x5a4b15['order']=qs[_0xd33a('0x33')](_0x2a5899['query'][_0xd33a('0x33')]);_0x5a4b15[_0xd33a('0x34')]=qs[_0xd33a('0x35')](_[_0xd33a('0x36')](_0x2a5899[_0xd33a('0x29')],_0x3e94cb[_0xd33a('0x35')]));if(_0x2bad1a[_0xd33a('0x2b')]){if(_0x2bad1a[_0xd33a('0x2a')]){_0x2bad1a['dateEnd']=moment(_0x2bad1a['dateEnd'])[_0xd33a('0x37')](0x1,_0xd33a('0x38'));}else{_0x2bad1a[_0xd33a('0x2a')]=moment(_0x2bad1a[_0xd33a('0x2b')])['add'](0x1,_0xd33a('0x38'));}_[_0xd33a('0x39')](_0x5a4b15[_0xd33a('0x34')],{'createdAt':{'$gte':_0x2bad1a[_0xd33a('0x2b')],'$lte':_0x2bad1a['dateEnd']}});}if(_0x2a5899[_0xd33a('0x29')][_0xd33a('0x3a')]){_0x5a4b15['where']=_[_0xd33a('0x39')](_0x5a4b15['where'],{'$or':_[_0xd33a('0x3b')](_0x5a4b15['attributes'],function(_0x1a3dbb){var _0x411ab8={};_0x411ab8[_0x1a3dbb]={'$like':'%'+_0x2a5899[_0xd33a('0x29')][_0xd33a('0x3a')]+'%'};return _0x411ab8;})});}_0x5a4b15=_[_0xd33a('0x39')]({},_0x5a4b15,_0x2a5899[_0xd33a('0x3c')]);var _0x563c34={'where':_0x5a4b15['where']};return db[_0xd33a('0x26')][_0xd33a('0x19')](_0x563c34)[_0xd33a('0x21')](function(_0x453ee3){_0x25a949[_0xd33a('0x19')]=_0x453ee3;if(_0x2a5899[_0xd33a('0x29')][_0xd33a('0x3d')]){_0x5a4b15[_0xd33a('0x3e')]=[{'all':!![]}];}return db[_0xd33a('0x26')][_0xd33a('0x3f')](_0x5a4b15);})[_0xd33a('0x21')](function(_0x1d24c1){_0x25a949[_0xd33a('0x40')]=_0x1d24c1;return _0x25a949;})[_0xd33a('0x21')](respondWithFilteredResult(_0xe19552,_0x5a4b15))[_0xd33a('0x41')](handleError(_0xe19552,null));};exports[_0xd33a('0x42')]=function(_0x2de7dd,_0x431e7e){var _0x330469={'raw':!![],'where':{'id':_0x2de7dd['params']['id']}},_0x773c48={};_0x773c48[_0xd33a('0x2d')]=_[_0xd33a('0x28')](db[_0xd33a('0x26')][_0xd33a('0x27')]);_0x773c48['query']=_['keys'](_0x2de7dd[_0xd33a('0x29')]);_0x773c48[_0xd33a('0x35')]=_[_0xd33a('0x2c')](_0x773c48[_0xd33a('0x2d')],_0x773c48[_0xd33a('0x29')]);_0x330469[_0xd33a('0x2e')]=_[_0xd33a('0x2c')](_0x773c48[_0xd33a('0x2d')],qs[_0xd33a('0x2f')](_0x2de7dd[_0xd33a('0x29')]['fields']));_0x330469['attributes']=_0x330469[_0xd33a('0x2e')][_0xd33a('0x30')]?_0x330469[_0xd33a('0x2e')]:_0x773c48[_0xd33a('0x2d')];if(_0x2de7dd[_0xd33a('0x29')]['includeAll']){_0x330469[_0xd33a('0x3e')]=[{'all':!![]}];}_0x330469=_['merge']({},_0x330469,_0x2de7dd[_0xd33a('0x3c')]);return db[_0xd33a('0x26')]['find'](_0x330469)['then'](handleEntityNotFound(_0x431e7e,null))[_0xd33a('0x21')](respondWithResult(_0x431e7e,null))[_0xd33a('0x41')](handleError(_0x431e7e,null));};exports[_0xd33a('0x43')]=function(_0x5f5773,_0x360722){return db[_0xd33a('0x26')]['describe']()['then'](respondWithResult(_0x360722,null))['catch'](handleError(_0x360722,null));};exports[_0xd33a('0x44')]=function(_0x174397,_0x817060){if(_0x174397[_0xd33a('0x45')][_0xd33a('0x46')]){delete _0x174397['body'][_0xd33a('0x46')];}return db[_0xd33a('0x26')]['find']({'where':{'uniqueid':_0x174397[_0xd33a('0x47')]['id']}})[_0xd33a('0x21')](handleEntityNotFound(_0x817060,null))[_0xd33a('0x21')](saveUpdates(_0x174397['body'],null))[_0xd33a('0x21')](respondWithResult(_0x817060,null))['catch'](handleError(_0x817060,null));};exports[_0xd33a('0x48')]=function(_0x219015,_0x12dd3c,_0x2f391){return db[_0xd33a('0x26')][_0xd33a('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x219015['params']['id']},'attributes':[[db[_0xd33a('0x49')]['fn'](_0xd33a('0x4a'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xd33a('0x4b')))),_0xd33a('0x4c')],[db[_0xd33a('0x49')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xd33a('0x49')][_0xd33a('0x4d')](_0xd33a('0x4e')))),'noAnswerContacts'],[db['sequelize']['fn'](_0xd33a('0x4a'),db[_0xd33a('0x49')]['fn']('IF',db[_0xd33a('0x49')]['literal'](_0xd33a('0x4f')))),_0xd33a('0x50')],[db[_0xd33a('0x49')]['fn'](_0xd33a('0x4a'),db[_0xd33a('0x49')]['fn']('IF',db[_0xd33a('0x49')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xd33a('0x51')],[db['sequelize']['fn'](_0xd33a('0x4a'),db[_0xd33a('0x49')]['fn']('IF',db[_0xd33a('0x49')][_0xd33a('0x4d')](_0xd33a('0x52')))),_0xd33a('0x53')],[db[_0xd33a('0x49')]['fn'](_0xd33a('0x4a'),db[_0xd33a('0x49')]['fn']('IF',db[_0xd33a('0x49')][_0xd33a('0x4d')](_0xd33a('0x54')))),_0xd33a('0x55')],[db['sequelize']['fn'](_0xd33a('0x4a'),db[_0xd33a('0x49')]['fn']('IF',db[_0xd33a('0x49')]['literal'](_0xd33a('0x56')))),_0xd33a('0x57')]]})[_0xd33a('0x21')](handleEntityNotFound(_0x12dd3c,null))['then'](respondWithResult(_0x12dd3c,null))[_0xd33a('0x41')](handleError(_0x12dd3c,null));};exports[_0xd33a('0x58')]=function(_0x40e9ff,_0x41a2d9,_0x3acc14){return db[_0xd33a('0x26')][_0xd33a('0x3f')]({'raw':![],'where':{'CampaignId':_0x40e9ff[_0xd33a('0x47')]['id']},'attributes':[[db[_0xd33a('0x49')]['fn'](_0xd33a('0x4a'),db[_0xd33a('0x49')]['fn']('IF',db[_0xd33a('0x49')][_0xd33a('0x4d')]('`state`\x20=\x200,\x201,\x20null'))),_0xd33a('0x4c')],[db[_0xd33a('0x49')]['fn'](_0xd33a('0x4a'),db[_0xd33a('0x49')]['fn']('IF',db[_0xd33a('0x49')][_0xd33a('0x4d')](_0xd33a('0x4e')))),_0xd33a('0x59')],[db[_0xd33a('0x49')]['fn']('COUNT',db[_0xd33a('0x49')]['fn']('IF',db[_0xd33a('0x49')][_0xd33a('0x4d')](_0xd33a('0x4f')))),'busyContacts'],[db[_0xd33a('0x49')]['fn'](_0xd33a('0x4a'),db[_0xd33a('0x49')]['fn']('IF',db[_0xd33a('0x49')]['literal'](_0xd33a('0x5a')))),'congestionContacts'],[db['sequelize']['fn'](_0xd33a('0x4a'),db[_0xd33a('0x49')]['fn']('IF',db['sequelize'][_0xd33a('0x4d')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xd33a('0x53')],[db[_0xd33a('0x49')]['fn'](_0xd33a('0x4a'),db['sequelize']['fn']('IF',db[_0xd33a('0x49')][_0xd33a('0x4d')](_0xd33a('0x54')))),'abandonedContacts'],[db[_0xd33a('0x49')]['fn'](_0xd33a('0x4a'),db[_0xd33a('0x49')]['fn']('IF',db[_0xd33a('0x49')][_0xd33a('0x4d')](_0xd33a('0x56')))),_0xd33a('0x57')]]})['then'](handleEntityNotFound(_0x41a2d9,null))[_0xd33a('0x21')](respondWithResult(_0x41a2d9,null))[_0xd33a('0x41')](handleError(_0x41a2d9,null));};exports[_0xd33a('0x5b')]=function(_0x137696,_0x5232ed,_0xd0dc25){return db[_0xd33a('0x5c')]['find']({'where':{'id':_0x137696[_0xd33a('0x47')]['id']}})['then'](handleEntityNotFound(_0x5232ed,null))[_0xd33a('0x21')](function(_0x1b1994){var _0xa21e9d;if(_0x1b1994){_0xa21e9d=squel[_0xd33a('0x5d')]()['into'](_0xd33a('0x5e'))[_0xd33a('0x5f')](['phone',_0xd33a('0x60'),'ContactId',_0xd33a('0x61'),_0xd33a('0x62'),_0xd33a('0x63'),'updatedAt'],squel[_0xd33a('0x64')]()['field']('ANY_VALUE(calleridnum)',_0xd33a('0x65'))[_0xd33a('0x66')](_0xd33a('0x67'),_0xd33a('0x60'))[_0xd33a('0x66')](_0xd33a('0x68'),'ContactId')[_0xd33a('0x66')](_0xd33a('0x69'),_0xd33a('0x61'))['field'](_0xd33a('0x6a'),_0xd33a('0x62'))[_0xd33a('0x66')](_0xd33a('0x67'),_0xd33a('0x63'))[_0xd33a('0x66')](_0xd33a('0x67'),_0xd33a('0x6b'))['from'](_0xd33a('0x6c'))[_0xd33a('0x34')](_0xd33a('0x6d'),_0x137696[_0xd33a('0x47')]['id']['toString']())['where'](_0xd33a('0x6e'),_0x137696['body']['state'][_0xd33a('0x6f')]())[_0xd33a('0x34')](_0xd33a('0x70'))[_0xd33a('0x34')](_0xd33a('0x71'),squel[_0xd33a('0x64')]()[_0xd33a('0x66')]('phone')[_0xd33a('0x72')](_0xd33a('0x5e'))[_0xd33a('0x34')](_0xd33a('0x6d'),_0x137696[_0xd33a('0x47')]['id'][_0xd33a('0x6f')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0xd33a('0x66')]('calleridnum')['from']('cm_hopper_final')[_0xd33a('0x34')](_0xd33a('0x6d'),_0x137696[_0xd33a('0x47')]['id'][_0xd33a('0x6f')]())[_0xd33a('0x34')]('state\x20=\x204'))['group'](_0xd33a('0x73')))[_0xd33a('0x6f')]();return db[_0xd33a('0x49')][_0xd33a('0x29')](_0xa21e9d);}return[];})['then'](respondWithResult(_0x5232ed,null))['catch'](handleError(_0x5232ed,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x16d1a3,_0x2559c1,_0xd4bd49){return db[_0xd33a('0x74')][_0xd33a('0x75')]({'where':{'id':_0x16d1a3['params']['id']}})['then'](handleEntityNotFound(_0x2559c1,null))[_0xd33a('0x21')](function(_0x33ece3){var _0x1cc839;if(_0x33ece3){_0x1cc839=squel[_0xd33a('0x5d')]()['into'](_0xd33a('0x5e'))['fromQuery']([_0xd33a('0x65'),_0xd33a('0x60'),_0xd33a('0x73'),'ListId',_0xd33a('0x76'),'createdAt',_0xd33a('0x6b')],squel[_0xd33a('0x64')]()['field'](_0xd33a('0x77'),'phone')[_0xd33a('0x66')](_0xd33a('0x67'),_0xd33a('0x60'))['field']('ANY_VALUE(ContactId)',_0xd33a('0x73'))[_0xd33a('0x66')](_0xd33a('0x69'),'ListId')['field'](_0xd33a('0x78'),'CampaignId')['field'](_0xd33a('0x67'),_0xd33a('0x63'))[_0xd33a('0x66')](_0xd33a('0x67'),_0xd33a('0x6b'))[_0xd33a('0x72')](_0xd33a('0x6c'))[_0xd33a('0x34')](_0xd33a('0x79'),_0x16d1a3[_0xd33a('0x47')]['id']['toString']())[_0xd33a('0x34')](_0xd33a('0x6e'),_0x16d1a3[_0xd33a('0x45')][_0xd33a('0x7a')]['toString']())[_0xd33a('0x34')](_0xd33a('0x70'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0xd33a('0x65'))[_0xd33a('0x72')](_0xd33a('0x5e'))['where'](_0xd33a('0x79'),_0x16d1a3[_0xd33a('0x47')]['id']['toString']()))[_0xd33a('0x34')](_0xd33a('0x71'),squel[_0xd33a('0x64')]()[_0xd33a('0x66')](_0xd33a('0x7b'))[_0xd33a('0x72')]('cm_hopper_final')['where'](_0xd33a('0x79'),_0x16d1a3[_0xd33a('0x47')]['id'][_0xd33a('0x6f')]())[_0xd33a('0x34')]('state\x20=\x204'))[_0xd33a('0x7c')](_0xd33a('0x73')))['toString']();return db[_0xd33a('0x49')][_0xd33a('0x29')](_0x1cc839);}return[];})[_0xd33a('0x21')](respondWithResult(_0x2559c1,null))[_0xd33a('0x41')](handleError(_0x2559c1,null));};exports['checkContactHopper']=function(_0x3cf2c8,_0x3ad7fd,_0xb5145c){return db[_0xd33a('0x7d')][_0xd33a('0x7e')]({'where':{'VoiceQueueId':_0x3cf2c8[_0xd33a('0x45')][_0xd33a('0x62')],'CampaignId':_0x3cf2c8[_0xd33a('0x45')][_0xd33a('0x76')],'ContactId':_0x3cf2c8[_0xd33a('0x45')]['ContactId']}})[_0xd33a('0x21')](handleEntityNotFound(_0x3ad7fd,null))['then'](function(_0x25011b){if(_0x25011b){return _0x25011b;}return null;})['then'](respondWithResult(_0x3ad7fd,null))[_0xd33a('0x41')](handleError(_0x3ad7fd,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index cb088f3..678593a 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 _0xadb5=['bluebird','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','util','api','moment'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xadb5,0xad));var _0x5adb=function(_0x5835ed,_0x2d7a12){_0x5835ed=_0x5835ed-0x0;var _0x51a09c=_0xadb5[_0x5835ed];return _0x51a09c;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rp=require('request-promise');var attributes=require(_0x5adb('0x4'));module[_0x5adb('0x5')]=function(_0x2e3ef4,_0x4cb1d1){return _0x2e3ef4[_0x5adb('0x6')](_0x5adb('0x7'),attributes,{'tableName':_0x5adb('0x8'),'paranoid':![],'indexes':[{'name':_0x5adb('0x9'),'fields':[_0x5adb('0x9')]},{'name':_0x5adb('0xa'),'fields':[_0x5adb('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5f66=['request-promise','./cmHopperFinal.attributes','define','CmHopperFinal','calleridnum','uniqueid','util','api','moment','bluebird'];(function(_0x1bf809,_0x536f55){var _0x1caa4e=function(_0x9f9636){while(--_0x9f9636){_0x1bf809['push'](_0x1bf809['shift']());}};_0x1caa4e(++_0x536f55);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var attributes=require(_0x65f6('0x5'));module['exports']=function(_0x3c5029,_0x5150c8){return _0x3c5029[_0x65f6('0x6')](_0x65f6('0x7'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x65f6('0x8')]},{'name':_0x65f6('0x9'),'fields':[_0x65f6('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 5202d65..44380bd 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 _0x54ef=['create','body','raw','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal'];(function(_0x342d44,_0x1e4423){var _0x6173d6=function(_0x16cc0c){while(--_0x16cc0c){_0x342d44['push'](_0x342d44['shift']());}};_0x6173d6(++_0x1e4423);}(_0x54ef,0x112));var _0xf54e=function(_0x1fa523,_0x5d5f58){_0x1fa523=_0x1fa523-0x0;var _0x1de6d0=_0x54ef[_0x1fa523];return _0x1de6d0;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x99cf9,_0x2464ae,_0x561870){return new BPromise(function(_0x27e69b,_0x57a1ce){return client[_0xf54e('0xb')](_0x99cf9,_0x561870)[_0xf54e('0xc')](function(_0x47c5e1){logger[_0xf54e('0xd')](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));logger[_0xf54e('0x10')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x2464ae,_0xf54e('0xf'),JSON[_0xf54e('0x11')](_0x47c5e1));if(_0x47c5e1[_0xf54e('0x12')]){if(_0x47c5e1[_0xf54e('0x12')]['code']===0x1f4){logger[_0xf54e('0x12')]('CmHopperFinal,\x20%s,\x20%s',_0x2464ae,_0x47c5e1['error'][_0xf54e('0x13')]);return _0x57a1ce(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}logger[_0xf54e('0x12')]('CmHopperFinal,\x20%s,\x20%s',_0x2464ae,_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);return _0x27e69b(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}else{logger['info'](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));_0x27e69b(_0x47c5e1[_0xf54e('0x14')]['message']);}})['catch'](function(_0xd87020){logger[_0xf54e('0x12')](_0xf54e('0xe'),_0x2464ae,_0xd87020);_0x57a1ce(_0xd87020);});});}exports[_0xf54e('0x15')]=function(_0x15cc48){var _0x3e7d96=this;return new Promise(function(_0x2e27b6,_0x1ef06e){return db[_0xf54e('0x16')][_0xf54e('0x17')](_0x15cc48[_0xf54e('0x18')],{'raw':_0x15cc48['options']?_0x15cc48['options'][_0xf54e('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3e1556){logger[_0xf54e('0xd')](_0xf54e('0x15'),_0x15cc48);logger[_0xf54e('0x10')](_0xf54e('0x15'),_0x15cc48,JSON[_0xf54e('0x11')](_0x3e1556));_0x2e27b6(_0x3e1556);})[_0xf54e('0x1a')](function(_0x11985e){logger[_0xf54e('0x12')](_0xf54e('0x15'),_0x11985e[_0xf54e('0x13')],_0x15cc48);_0x1ef06e(_0x3e7d96['error'](0x1f4,_0x11985e[_0xf54e('0x13')]));});});}; \ No newline at end of file +var _0xde2c=['raw','stringify','CreateCmHopperFinal','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CmHopperFinal','create','body','options'];(function(_0x2ba5e4,_0x426eba){var _0x5b1ac6=function(_0x3baace){while(--_0x3baace){_0x2ba5e4['push'](_0x2ba5e4['shift']());}};_0x5b1ac6(++_0x426eba);}(_0xde2c,0x7f));var _0xcde2=function(_0x30cd7e,_0x4db10a){_0x30cd7e=_0x30cd7e-0x0;var _0x462a02=_0xde2c[_0x30cd7e];return _0x462a02;};'use strict';var _=require(_0xcde2('0x0'));var util=require(_0xcde2('0x1'));var moment=require(_0xcde2('0x2'));var BPromise=require(_0xcde2('0x3'));var rs=require(_0xcde2('0x4'));var fs=require('fs');var Redis=require(_0xcde2('0x5'));var db=require(_0xcde2('0x6'))['db'];var utils=require(_0xcde2('0x7'));var logger=require('../../config/logger')(_0xcde2('0x8'));var config=require(_0xcde2('0x9'));var jayson=require(_0xcde2('0xa'));var client=jayson[_0xcde2('0xb')][_0xcde2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x53c558,_0x2b27ef,_0x385e83){return new BPromise(function(_0x9c7036,_0x544235){return client['request'](_0x53c558,_0x385e83)[_0xcde2('0xd')](function(_0x1c8b3c){logger['info'](_0xcde2('0xe'),_0x2b27ef,_0xcde2('0xf'));logger[_0xcde2('0x10')](_0xcde2('0x11'),_0x2b27ef,'request\x20sent',JSON['stringify'](_0x1c8b3c));if(_0x1c8b3c[_0xcde2('0x12')]){if(_0x1c8b3c[_0xcde2('0x12')][_0xcde2('0x13')]===0x1f4){logger[_0xcde2('0x12')](_0xcde2('0xe'),_0x2b27ef,_0x1c8b3c[_0xcde2('0x12')]['message']);return _0x544235(_0x1c8b3c[_0xcde2('0x12')]['message']);}logger[_0xcde2('0x12')]('CmHopperFinal,\x20%s,\x20%s',_0x2b27ef,_0x1c8b3c['error'][_0xcde2('0x14')]);return _0x9c7036(_0x1c8b3c[_0xcde2('0x12')][_0xcde2('0x14')]);}else{logger[_0xcde2('0x15')](_0xcde2('0xe'),_0x2b27ef,'request\x20sent');_0x9c7036(_0x1c8b3c[_0xcde2('0x16')]['message']);}})[_0xcde2('0x17')](function(_0x198840){logger[_0xcde2('0x12')](_0xcde2('0xe'),_0x2b27ef,_0x198840);_0x544235(_0x198840);});});}exports['CreateCmHopperFinal']=function(_0x4fd5aa){var _0x4fe586=this;return new Promise(function(_0x2b4468,_0x582e84){return db[_0xcde2('0x18')][_0xcde2('0x19')](_0x4fd5aa[_0xcde2('0x1a')],{'raw':_0x4fd5aa['options']?_0x4fd5aa[_0xcde2('0x1b')][_0xcde2('0x1c')]===undefined?!![]:![]:!![]})[_0xcde2('0xd')](function(_0x3c1d7e){logger[_0xcde2('0x15')]('CreateCmHopperFinal',_0x4fd5aa);logger['debug']('CreateCmHopperFinal',_0x4fd5aa,JSON[_0xcde2('0x1d')](_0x3c1d7e));_0x2b4468(_0x3c1d7e);})[_0xcde2('0x17')](function(_0x2c9562){logger[_0xcde2('0x12')](_0xcde2('0x1e'),_0x2c9562['message'],_0x4fd5aa);_0x582e84(_0x4fe586[_0xcde2('0x12')](0x1f4,_0x2c9562['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 1a53245..b8eaa9e 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 _0x34e8=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','update'];(function(_0x3f1ee4,_0x45a505){var _0x1e85a3=function(_0x538de8){while(--_0x538de8){_0x3f1ee4['push'](_0x3f1ee4['shift']());}};_0x1e85a3(++_0x45a505);}(_0x34e8,0x12c));var _0x834e=function(_0x1476bb,_0x496619){_0x1476bb=_0x1476bb-0x0;var _0x3807d9=_0x34e8[_0x1476bb];return _0x3807d9;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var auth=require(_0x834e('0x5'));var interaction=require(_0x834e('0x6'));var config=require(_0x834e('0x7'));var controller=require(_0x834e('0x8'));router[_0x834e('0x9')]('/',auth[_0x834e('0xa')](),controller['index']);router[_0x834e('0x9')]('/describe',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0x9')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0x9')](_0x834e('0xe'),auth[_0x834e('0xa')](),controller[_0x834e('0xf')]);router[_0x834e('0x9')](_0x834e('0x10'),auth[_0x834e('0xa')](),controller[_0x834e('0x11')]);router[_0x834e('0x12')](_0x834e('0x13'),auth[_0x834e('0xa')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x834e('0x12')](_0x834e('0x14'),auth['isAuthenticated'](),controller[_0x834e('0x15')]);router[_0x834e('0x12')](_0x834e('0x16'),auth[_0x834e('0xa')](),controller['checkContactHopper']);router[_0x834e('0x17')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x18')]);module['exports']=router; \ No newline at end of file +var _0x34e8=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','update'];(function(_0x51bfd8,_0x389e9e){var _0x25a740=function(_0x329ac4){while(--_0x329ac4){_0x51bfd8['push'](_0x51bfd8['shift']());}};_0x25a740(++_0x389e9e);}(_0x34e8,0x12c));var _0x834e=function(_0x56584a,_0x5a3522){_0x56584a=_0x56584a-0x0;var _0x4cc5cd=_0x34e8[_0x56584a];return _0x4cc5cd;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var auth=require(_0x834e('0x5'));var interaction=require(_0x834e('0x6'));var config=require(_0x834e('0x7'));var controller=require(_0x834e('0x8'));router[_0x834e('0x9')]('/',auth[_0x834e('0xa')](),controller['index']);router[_0x834e('0x9')]('/describe',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0x9')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0x9')](_0x834e('0xe'),auth[_0x834e('0xa')](),controller[_0x834e('0xf')]);router[_0x834e('0x9')](_0x834e('0x10'),auth[_0x834e('0xa')](),controller[_0x834e('0x11')]);router[_0x834e('0x12')](_0x834e('0x13'),auth[_0x834e('0xa')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x834e('0x12')](_0x834e('0x14'),auth['isAuthenticated'](),controller[_0x834e('0x15')]);router[_0x834e('0x12')](_0x834e('0x16'),auth[_0x834e('0xa')](),controller['checkContactHopper']);router[_0x834e('0x17')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 41017e9..563c13a 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 _0x861c=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x1f01a3,_0x201c35){var _0x2fad39=function(_0x46b164){while(--_0x46b164){_0x1f01a3['push'](_0x1f01a3['shift']());}};_0x2fad39(++_0x201c35);}(_0x861c,0xdb));var _0xc861=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x861c[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0xc861('0x0'));module[_0xc861('0x1')]={'state':{'type':Sequelize[_0xc861('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xc861('0x3')]},'scheduledat':{'type':Sequelize[_0xc861('0x4')]},'countbusyretry':{'type':Sequelize[_0xc861('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc861('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc861('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xc861('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xc861('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xc861('0x3')]},'originatecalleridname':{'type':Sequelize[_0xc861('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xc861('0x3')]},'starttime':{'type':Sequelize[_0xc861('0x4')]},'responsetime':{'type':Sequelize[_0xc861('0x4')]},'answertime':{'type':Sequelize[_0xc861('0x4')]},'droptime':{'type':Sequelize[_0xc861('0x4')]},'endtime':{'type':Sequelize[_0xc861('0x4')]},'ringtime':{'type':Sequelize[_0xc861('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xc861('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xc861('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xc861('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xc861('0x3')]},'campaign':{'type':Sequelize[_0xc861('0x3')]},'campaigntype':{'type':Sequelize[_0xc861('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xc861('0x3')]},'amd':{'type':Sequelize[_0xc861('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xc861('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xc861('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc861('0x4')]},'recallme':{'type':Sequelize[_0xc861('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xc861('0x4')]},'edited':{'type':Sequelize[_0xc861('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x6108=['STRING','DATE','BOOLEAN','sequelize','INTEGER'];(function(_0x4f9c46,_0x361afe){var _0x155365=function(_0x2e5c13){while(--_0x2e5c13){_0x4f9c46['push'](_0x4f9c46['shift']());}};_0x155365(++_0x361afe);}(_0x6108,0xbc));var _0x8610=function(_0x56b6b9,_0x2ae8ca){_0x56b6b9=_0x56b6b9-0x0;var _0x2b634d=_0x6108[_0x56b6b9];return _0x2b634d;};'use strict';var Sequelize=require(_0x8610('0x0'));module['exports']={'state':{'type':Sequelize[_0x8610('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x8610('0x2')]},'scheduledat':{'type':Sequelize[_0x8610('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8610('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x8610('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x8610('0x2')]},'calleridnum':{'type':Sequelize[_0x8610('0x2')]},'calleridname':{'type':Sequelize[_0x8610('0x2')]},'starttime':{'type':Sequelize[_0x8610('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x8610('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x8610('0x3')]},'ringtime':{'type':Sequelize[_0x8610('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8610('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8610('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8610('0x2')]},'campaign':{'type':Sequelize[_0x8610('0x2')]},'campaigntype':{'type':Sequelize[_0x8610('0x2')]},'membername':{'type':Sequelize[_0x8610('0x2')]},'reason':{'type':Sequelize[_0x8610('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x8610('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x8610('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8610('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x8610('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x8610('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 8fba639..5f3cbfe 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 _0x786f=['fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','add','day','merge','options','count','includeAll','rows','catch','show','params','include','find','create','body','describe','uniqueid','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','Content-Range','apply','save','update','then','destroy','error','stack','name','send','CmHopperHistory','rawAttributes','keys','dateStart','query','dateEnd','filters','intersection','model','attributes'];(function(_0xcd22a3,_0x33ae8f){var _0x1deacc=function(_0x2bd997){while(--_0x2bd997){_0xcd22a3['push'](_0xcd22a3['shift']());}};_0x1deacc(++_0x33ae8f);}(_0x786f,0x1c3));var _0xf786=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0x786f[_0x5a95fa];return _0x1a61b8;};'use strict';var pdf=require(_0xf786('0x0'));var emlformat=require(_0xf786('0x1'));var rimraf=require(_0xf786('0x2'));var zipdir=require(_0xf786('0x3'));var jsonpatch=require(_0xf786('0x4'));var rp=require(_0xf786('0x5'));var moment=require(_0xf786('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xf786('0x7'));var util=require(_0xf786('0x8'));var path=require(_0xf786('0x9'));var sox=require(_0xf786('0xa'));var csv=require(_0xf786('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf786('0xc'));var squel=require('squel');var crypto=require(_0xf786('0xd'));var jsforce=require(_0xf786('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf786('0xb'));var querystring=require(_0xf786('0xf'));var Papa=require(_0xf786('0x10'));var Redis=require(_0xf786('0x11'));var qs=require(_0xf786('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xf786('0x13'));var config=require(_0xf786('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x324bb0,_0x241318){_0x241318=_0x241318||0xcc;return function(_0xdb662d){if(_0xdb662d){return _0x324bb0[_0xf786('0x15')](_0x241318);}return _0x324bb0['status'](_0x241318)[_0xf786('0x16')]();};}function respondWithResult(_0x1786b9,_0x3c1cbc){_0x3c1cbc=_0x3c1cbc||0xc8;return function(_0x1b4419){if(_0x1b4419){return _0x1786b9[_0xf786('0x17')](_0x3c1cbc)[_0xf786('0x18')](_0x1b4419);}};}function respondWithFilteredResult(_0x536f20,_0x18d4f4){return function(_0x3feda8){if(_0x3feda8){var _0x2c58ba=_0x3feda8['count'],_0x53891a=_0x18d4f4[_0xf786('0x19')],_0x45a0bf=_0x18d4f4[_0xf786('0x19')]+_0x18d4f4['limit'],_0x344799;if(_0x45a0bf>=_0x2c58ba){_0x45a0bf=_0x2c58ba;_0x344799=0xc8;}else{_0x344799=0xce;}_0x536f20[_0xf786('0x17')](_0x344799);return _0x536f20['set'](_0xf786('0x1a'),_0x53891a+'-'+_0x45a0bf+'/'+_0x2c58ba)[_0xf786('0x18')](_0x3feda8);}return null;};}function patchUpdates(_0x2efdae){return function(_0x257f32){try{jsonpatch[_0xf786('0x1b')](_0x257f32,_0x2efdae,!![]);}catch(_0x29e38b){return BPromise['reject'](_0x29e38b);}return _0x257f32[_0xf786('0x1c')]();};}function saveUpdates(_0x1b4b29,_0x5c9555){return function(_0x381027){if(_0x381027){return _0x381027[_0xf786('0x1d')](_0x1b4b29)[_0xf786('0x1e')](function(_0x18fb80){return _0x18fb80;});}return null;};}function removeEntity(_0xb32eaf,_0x1750aa){return function(_0x26e780){if(_0x26e780){return _0x26e780[_0xf786('0x1f')]()['then'](function(){_0xb32eaf[_0xf786('0x17')](0xcc)[_0xf786('0x16')]();});}};}function handleEntityNotFound(_0x5d8d59,_0x47d692){return function(_0xdb3576){if(!_0xdb3576){_0x5d8d59[_0xf786('0x15')](0x194);}return _0xdb3576;};}function handleError(_0x27bac3,_0x4dd2a9){_0x4dd2a9=_0x4dd2a9||0x1f4;return function(_0x33e56c){logger[_0xf786('0x20')](_0x33e56c[_0xf786('0x21')]);if(_0x33e56c[_0xf786('0x22')]){delete _0x33e56c[_0xf786('0x22')];}_0x27bac3[_0xf786('0x17')](_0x4dd2a9)[_0xf786('0x23')](_0x33e56c);};}exports['index']=function(_0x34afec,_0x578b0d){var _0x536b44={},_0x2153d8={},_0x4a1b4a={'count':0x0,'rows':[]};var _0xf43f79=db[_0xf786('0x24')][_0xf786('0x25')];_0x2153d8['model']=_[_0xf786('0x26')](_0xf43f79);var _0x7e2ebc={'dateStart':_0x34afec['query'][_0xf786('0x27')],'dateEnd':_0x34afec[_0xf786('0x28')][_0xf786('0x29')]};delete _0x34afec[_0xf786('0x28')][_0xf786('0x27')];delete _0x34afec[_0xf786('0x28')][_0xf786('0x29')];_0x2153d8[_0xf786('0x28')]=_['keys'](_0x34afec[_0xf786('0x28')]);_0x2153d8[_0xf786('0x2a')]=_[_0xf786('0x2b')](_0x2153d8[_0xf786('0x2c')],_0x2153d8[_0xf786('0x28')]);_0x536b44[_0xf786('0x2d')]=_['intersection'](_0x2153d8[_0xf786('0x2c')],qs['fields'](_0x34afec[_0xf786('0x28')][_0xf786('0x2e')]));_0x536b44['attributes']=_0x536b44[_0xf786('0x2d')][_0xf786('0x2f')]?_0x536b44[_0xf786('0x2d')]:_0x2153d8['model'];if(!_0x34afec[_0xf786('0x28')][_0xf786('0x30')](_0xf786('0x31'))){_0x536b44[_0xf786('0x32')]=qs[_0xf786('0x32')](_0x34afec[_0xf786('0x28')][_0xf786('0x32')]);_0x536b44[_0xf786('0x19')]=qs[_0xf786('0x19')](_0x34afec['query']['offset']);}_0x536b44[_0xf786('0x33')]=qs[_0xf786('0x34')](_0x34afec[_0xf786('0x28')][_0xf786('0x34')]);_0x536b44[_0xf786('0x35')]=qs['filters'](_[_0xf786('0x36')](_0x34afec['query'],_0x2153d8[_0xf786('0x2a')]));if(_0x7e2ebc[_0xf786('0x27')]){if(_0x7e2ebc[_0xf786('0x29')]){_0x7e2ebc['dateEnd']=moment(_0x7e2ebc['dateEnd'])[_0xf786('0x37')](0x1,_0xf786('0x38'));}else{_0x7e2ebc['dateEnd']=moment(_0x7e2ebc['dateStart'])[_0xf786('0x37')](0x1,'day');}_[_0xf786('0x39')](_0x536b44['where'],{'createdAt':{'$gte':_0x7e2ebc['dateStart'],'$lte':_0x7e2ebc['dateEnd']}});}if(_0x34afec[_0xf786('0x28')]['filter']){_0x536b44[_0xf786('0x35')]=_[_0xf786('0x39')](_0x536b44[_0xf786('0x35')],{'$or':_['map'](_0x536b44[_0xf786('0x2d')],function(_0x2cf428){var _0x5f1f53={};_0x5f1f53[_0x2cf428]={'$like':'%'+_0x34afec[_0xf786('0x28')]['filter']+'%'};return _0x5f1f53;})});}_0x536b44=_[_0xf786('0x39')]({},_0x536b44,_0x34afec[_0xf786('0x3a')]);var _0x31ba0e={'where':_0x536b44['where']};return db[_0xf786('0x24')][_0xf786('0x3b')](_0x31ba0e)[_0xf786('0x1e')](function(_0x18773b){_0x4a1b4a[_0xf786('0x3b')]=_0x18773b;if(_0x34afec[_0xf786('0x28')][_0xf786('0x3c')]){_0x536b44['include']=[{'all':!![]}];}return db[_0xf786('0x24')]['findAll'](_0x536b44);})[_0xf786('0x1e')](function(_0x31881e){_0x4a1b4a[_0xf786('0x3d')]=_0x31881e;return _0x4a1b4a;})[_0xf786('0x1e')](respondWithFilteredResult(_0x578b0d,_0x536b44))[_0xf786('0x3e')](handleError(_0x578b0d,null));};exports[_0xf786('0x3f')]=function(_0x1a3e93,_0x5be3e9){var _0x5395dc={'raw':!![],'where':{'id':_0x1a3e93[_0xf786('0x40')]['id']}},_0x1c770a={};_0x1c770a[_0xf786('0x2c')]=_[_0xf786('0x26')](db[_0xf786('0x24')]['rawAttributes']);_0x1c770a[_0xf786('0x28')]=_[_0xf786('0x26')](_0x1a3e93[_0xf786('0x28')]);_0x1c770a[_0xf786('0x2a')]=_[_0xf786('0x2b')](_0x1c770a[_0xf786('0x2c')],_0x1c770a[_0xf786('0x28')]);_0x5395dc[_0xf786('0x2d')]=_['intersection'](_0x1c770a[_0xf786('0x2c')],qs[_0xf786('0x2e')](_0x1a3e93[_0xf786('0x28')][_0xf786('0x2e')]));_0x5395dc[_0xf786('0x2d')]=_0x5395dc[_0xf786('0x2d')][_0xf786('0x2f')]?_0x5395dc[_0xf786('0x2d')]:_0x1c770a[_0xf786('0x2c')];if(_0x1a3e93['query'][_0xf786('0x3c')]){_0x5395dc[_0xf786('0x41')]=[{'all':!![]}];}_0x5395dc=_[_0xf786('0x39')]({},_0x5395dc,_0x1a3e93[_0xf786('0x3a')]);return db[_0xf786('0x24')][_0xf786('0x42')](_0x5395dc)['then'](handleEntityNotFound(_0x5be3e9,null))['then'](respondWithResult(_0x5be3e9,null))[_0xf786('0x3e')](handleError(_0x5be3e9,null));};exports['create']=function(_0x1f1804,_0x44f6b7){return db[_0xf786('0x24')][_0xf786('0x43')](_0x1f1804[_0xf786('0x44')],{})[_0xf786('0x1e')](respondWithResult(_0x44f6b7,0xc9))[_0xf786('0x3e')](handleError(_0x44f6b7,null));};exports[_0xf786('0x45')]=function(_0x1b7af6,_0xacab63){return db[_0xf786('0x24')][_0xf786('0x45')]()['then'](respondWithResult(_0xacab63,null))['catch'](handleError(_0xacab63,null));};exports[_0xf786('0x1d')]=function(_0x589fb6,_0x2a7a8b){if(_0x589fb6[_0xf786('0x44')]['uniqueid']){delete _0x589fb6[_0xf786('0x44')][_0xf786('0x46')];}return db[_0xf786('0x24')][_0xf786('0x42')]({'where':{'uniqueid':_0x589fb6[_0xf786('0x40')]['id']}})[_0xf786('0x1e')](handleEntityNotFound(_0x2a7a8b,null))[_0xf786('0x1e')](saveUpdates(_0x589fb6[_0xf786('0x44')],null))['then'](respondWithResult(_0x2a7a8b,null))[_0xf786('0x3e')](handleError(_0x2a7a8b,null));}; \ No newline at end of file +var _0x9e9d=['api','../../config/utils','../../config/environment','end','status','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','CmHopperHistory','model','dateStart','query','dateEnd','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','limit','order','sort','pick','add','day','merge','filter','where','includeAll','include','findAll','rows','show','params','rawAttributes','fields','catch','create','body','describe','uniqueid','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../config/logger'];(function(_0xe6e78c,_0x582369){var _0x2a09c8=function(_0x470ccc){while(--_0x470ccc){_0xe6e78c['push'](_0xe6e78c['shift']());}};_0x2a09c8(++_0x582369);}(_0x9e9d,0x11c));var _0xd9e9=function(_0x378784,_0x467389){_0x378784=_0x378784-0x0;var _0x59fa15=_0x9e9d[_0x378784];return _0x59fa15;};'use strict';var pdf=require(_0xd9e9('0x0'));var emlformat=require(_0xd9e9('0x1'));var rimraf=require(_0xd9e9('0x2'));var zipdir=require(_0xd9e9('0x3'));var jsonpatch=require(_0xd9e9('0x4'));var rp=require(_0xd9e9('0x5'));var moment=require(_0xd9e9('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xd9e9('0x7'));var util=require(_0xd9e9('0x8'));var path=require(_0xd9e9('0x9'));var sox=require(_0xd9e9('0xa'));var csv=require('to-csv');var ejs=require(_0xd9e9('0xb'));var fs=require('fs');var _=require(_0xd9e9('0xc'));var squel=require(_0xd9e9('0xd'));var crypto=require(_0xd9e9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd9e9('0xf'));var toCsv=require(_0xd9e9('0x10'));var querystring=require(_0xd9e9('0x11'));var Papa=require('papaparse');var Redis=require(_0xd9e9('0x12'));var qs=require('../../components/parsers/qs');var logger=require(_0xd9e9('0x13'))(_0xd9e9('0x14'));var utils=require(_0xd9e9('0x15'));var config=require(_0xd9e9('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x517611,_0x5bc6bc){_0x5bc6bc=_0x5bc6bc||0xcc;return function(_0x3b6aa1){if(_0x3b6aa1){return _0x517611['sendStatus'](_0x5bc6bc);}return _0x517611['status'](_0x5bc6bc)[_0xd9e9('0x17')]();};}function respondWithResult(_0x521233,_0x1cf4ed){_0x1cf4ed=_0x1cf4ed||0xc8;return function(_0x5346e6){if(_0x5346e6){return _0x521233[_0xd9e9('0x18')](_0x1cf4ed)['json'](_0x5346e6);}};}function respondWithFilteredResult(_0x50df1e,_0x14f3e1){return function(_0x41dfdc){if(_0x41dfdc){var _0x5b4107=_0x41dfdc[_0xd9e9('0x19')],_0x5a4475=_0x14f3e1[_0xd9e9('0x1a')],_0x5227bf=_0x14f3e1['offset']+_0x14f3e1['limit'],_0xde2ad3;if(_0x5227bf>=_0x5b4107){_0x5227bf=_0x5b4107;_0xde2ad3=0xc8;}else{_0xde2ad3=0xce;}_0x50df1e[_0xd9e9('0x18')](_0xde2ad3);return _0x50df1e[_0xd9e9('0x1b')](_0xd9e9('0x1c'),_0x5a4475+'-'+_0x5227bf+'/'+_0x5b4107)[_0xd9e9('0x1d')](_0x41dfdc);}return null;};}function patchUpdates(_0x58fa4b){return function(_0xb00a93){try{jsonpatch[_0xd9e9('0x1e')](_0xb00a93,_0x58fa4b,!![]);}catch(_0x3505d9){return BPromise[_0xd9e9('0x1f')](_0x3505d9);}return _0xb00a93[_0xd9e9('0x20')]();};}function saveUpdates(_0x59fcda,_0x18a334){return function(_0x4d4568){if(_0x4d4568){return _0x4d4568[_0xd9e9('0x21')](_0x59fcda)[_0xd9e9('0x22')](function(_0x265d17){return _0x265d17;});}return null;};}function removeEntity(_0x33f038,_0x4364ab){return function(_0x53168e){if(_0x53168e){return _0x53168e[_0xd9e9('0x23')]()[_0xd9e9('0x22')](function(){_0x33f038[_0xd9e9('0x18')](0xcc)[_0xd9e9('0x17')]();});}};}function handleEntityNotFound(_0x2a4eed,_0x4c417a){return function(_0x340634){if(!_0x340634){_0x2a4eed[_0xd9e9('0x24')](0x194);}return _0x340634;};}function handleError(_0x5614bf,_0x3c33f8){_0x3c33f8=_0x3c33f8||0x1f4;return function(_0xd73e68){logger[_0xd9e9('0x25')](_0xd73e68[_0xd9e9('0x26')]);if(_0xd73e68[_0xd9e9('0x27')]){delete _0xd73e68[_0xd9e9('0x27')];}_0x5614bf['status'](_0x3c33f8)[_0xd9e9('0x28')](_0xd73e68);};}exports['index']=function(_0x2590b4,_0x1a93cb){var _0x1f1eda={},_0x4bfda4={},_0x3bebd3={'count':0x0,'rows':[]};var _0x3708d7=db[_0xd9e9('0x29')]['rawAttributes'];_0x4bfda4[_0xd9e9('0x2a')]=_['keys'](_0x3708d7);var _0x1f6ea4={'dateStart':_0x2590b4['query'][_0xd9e9('0x2b')],'dateEnd':_0x2590b4[_0xd9e9('0x2c')][_0xd9e9('0x2d')]};delete _0x2590b4['query'][_0xd9e9('0x2b')];delete _0x2590b4[_0xd9e9('0x2c')]['dateEnd'];_0x4bfda4[_0xd9e9('0x2c')]=_[_0xd9e9('0x2e')](_0x2590b4[_0xd9e9('0x2c')]);_0x4bfda4[_0xd9e9('0x2f')]=_['intersection'](_0x4bfda4[_0xd9e9('0x2a')],_0x4bfda4[_0xd9e9('0x2c')]);_0x1f1eda[_0xd9e9('0x30')]=_[_0xd9e9('0x31')](_0x4bfda4['model'],qs['fields'](_0x2590b4['query']['fields']));_0x1f1eda['attributes']=_0x1f1eda[_0xd9e9('0x30')][_0xd9e9('0x32')]?_0x1f1eda[_0xd9e9('0x30')]:_0x4bfda4[_0xd9e9('0x2a')];if(!_0x2590b4[_0xd9e9('0x2c')][_0xd9e9('0x33')](_0xd9e9('0x34'))){_0x1f1eda['limit']=qs[_0xd9e9('0x35')](_0x2590b4[_0xd9e9('0x2c')][_0xd9e9('0x35')]);_0x1f1eda['offset']=qs[_0xd9e9('0x1a')](_0x2590b4[_0xd9e9('0x2c')][_0xd9e9('0x1a')]);}_0x1f1eda[_0xd9e9('0x36')]=qs[_0xd9e9('0x37')](_0x2590b4[_0xd9e9('0x2c')][_0xd9e9('0x37')]);_0x1f1eda['where']=qs['filters'](_[_0xd9e9('0x38')](_0x2590b4[_0xd9e9('0x2c')],_0x4bfda4['filters']));if(_0x1f6ea4[_0xd9e9('0x2b')]){if(_0x1f6ea4['dateEnd']){_0x1f6ea4['dateEnd']=moment(_0x1f6ea4[_0xd9e9('0x2d')])[_0xd9e9('0x39')](0x1,_0xd9e9('0x3a'));}else{_0x1f6ea4[_0xd9e9('0x2d')]=moment(_0x1f6ea4[_0xd9e9('0x2b')])[_0xd9e9('0x39')](0x1,_0xd9e9('0x3a'));}_[_0xd9e9('0x3b')](_0x1f1eda['where'],{'createdAt':{'$gte':_0x1f6ea4[_0xd9e9('0x2b')],'$lte':_0x1f6ea4[_0xd9e9('0x2d')]}});}if(_0x2590b4['query'][_0xd9e9('0x3c')]){_0x1f1eda['where']=_[_0xd9e9('0x3b')](_0x1f1eda['where'],{'$or':_['map'](_0x1f1eda['attributes'],function(_0x40dcb1){var _0x1ec9bf={};_0x1ec9bf[_0x40dcb1]={'$like':'%'+_0x2590b4[_0xd9e9('0x2c')][_0xd9e9('0x3c')]+'%'};return _0x1ec9bf;})});}_0x1f1eda=_[_0xd9e9('0x3b')]({},_0x1f1eda,_0x2590b4['options']);var _0x465df6={'where':_0x1f1eda[_0xd9e9('0x3d')]};return db['CmHopperHistory']['count'](_0x465df6)[_0xd9e9('0x22')](function(_0x4dbed2){_0x3bebd3[_0xd9e9('0x19')]=_0x4dbed2;if(_0x2590b4['query'][_0xd9e9('0x3e')]){_0x1f1eda[_0xd9e9('0x3f')]=[{'all':!![]}];}return db[_0xd9e9('0x29')][_0xd9e9('0x40')](_0x1f1eda);})['then'](function(_0x5e006a){_0x3bebd3[_0xd9e9('0x41')]=_0x5e006a;return _0x3bebd3;})['then'](respondWithFilteredResult(_0x1a93cb,_0x1f1eda))['catch'](handleError(_0x1a93cb,null));};exports[_0xd9e9('0x42')]=function(_0x25e66c,_0x9d65d9){var _0x2673a1={'raw':!![],'where':{'id':_0x25e66c[_0xd9e9('0x43')]['id']}},_0x4f1d4b={};_0x4f1d4b['model']=_['keys'](db['CmHopperHistory'][_0xd9e9('0x44')]);_0x4f1d4b[_0xd9e9('0x2c')]=_['keys'](_0x25e66c[_0xd9e9('0x2c')]);_0x4f1d4b[_0xd9e9('0x2f')]=_['intersection'](_0x4f1d4b['model'],_0x4f1d4b['query']);_0x2673a1[_0xd9e9('0x30')]=_[_0xd9e9('0x31')](_0x4f1d4b['model'],qs['fields'](_0x25e66c[_0xd9e9('0x2c')][_0xd9e9('0x45')]));_0x2673a1['attributes']=_0x2673a1[_0xd9e9('0x30')][_0xd9e9('0x32')]?_0x2673a1['attributes']:_0x4f1d4b['model'];if(_0x25e66c[_0xd9e9('0x2c')][_0xd9e9('0x3e')]){_0x2673a1[_0xd9e9('0x3f')]=[{'all':!![]}];}_0x2673a1=_[_0xd9e9('0x3b')]({},_0x2673a1,_0x25e66c['options']);return db['CmHopperHistory']['find'](_0x2673a1)[_0xd9e9('0x22')](handleEntityNotFound(_0x9d65d9,null))[_0xd9e9('0x22')](respondWithResult(_0x9d65d9,null))[_0xd9e9('0x46')](handleError(_0x9d65d9,null));};exports[_0xd9e9('0x47')]=function(_0x25ebc4,_0x4d4329){return db[_0xd9e9('0x29')][_0xd9e9('0x47')](_0x25ebc4[_0xd9e9('0x48')],{})['then'](respondWithResult(_0x4d4329,0xc9))[_0xd9e9('0x46')](handleError(_0x4d4329,null));};exports[_0xd9e9('0x49')]=function(_0x410715,_0x455683){return db[_0xd9e9('0x29')][_0xd9e9('0x49')]()['then'](respondWithResult(_0x455683,null))[_0xd9e9('0x46')](handleError(_0x455683,null));};exports[_0xd9e9('0x21')]=function(_0x68298d,_0x1f7a43){if(_0x68298d[_0xd9e9('0x48')][_0xd9e9('0x4a')]){delete _0x68298d[_0xd9e9('0x48')][_0xd9e9('0x4a')];}return db[_0xd9e9('0x29')][_0xd9e9('0x4b')]({'where':{'uniqueid':_0x68298d[_0xd9e9('0x43')]['id']}})[_0xd9e9('0x22')](handleEntityNotFound(_0x1f7a43,null))[_0xd9e9('0x22')](saveUpdates(_0x68298d[_0xd9e9('0x48')],null))[_0xd9e9('0x22')](respondWithResult(_0x1f7a43,null))[_0xd9e9('0x46')](handleError(_0x1f7a43,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index e5c43c4..0ba0d4c 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 _0x9250=['bluebird','request-promise','./cmHopperHistory.attributes','exports','define','cm_hopper_history','endtime','uniqueid'];(function(_0x358913,_0x52ed94){var _0x41c913=function(_0x588f21){while(--_0x588f21){_0x358913['push'](_0x358913['shift']());}};_0x41c913(++_0x52ed94);}(_0x9250,0x80));var _0x0925=function(_0x42be17,_0x258cd6){_0x42be17=_0x42be17-0x0;var _0x55e991=_0x9250[_0x42be17];return _0x55e991;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0925('0x0'));var rp=require(_0x0925('0x1'));var attributes=require(_0x0925('0x2'));module[_0x0925('0x3')]=function(_0x589e8f,_0x50ec53){return _0x589e8f[_0x0925('0x4')]('CmHopperHistory',attributes,{'tableName':_0x0925('0x5'),'paranoid':![],'indexes':[{'name':_0x0925('0x6'),'fields':['endtime']},{'name':_0x0925('0x7'),'fields':[_0x0925('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1f43=['request-promise','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','uniqueid','util','../../config/logger','api','moment','bluebird'];(function(_0x2939cb,_0x3eca15){var _0x47c1b6=function(_0x254d27){while(--_0x254d27){_0x2939cb['push'](_0x2939cb['shift']());}};_0x47c1b6(++_0x3eca15);}(_0x1f43,0x119));var _0x31f4=function(_0x4c45e9,_0x273af8){_0x4c45e9=_0x4c45e9-0x0;var _0x459732=_0x1f43[_0x4c45e9];return _0x459732;};'use strict';var _=require('lodash');var util=require(_0x31f4('0x0'));var logger=require(_0x31f4('0x1'))(_0x31f4('0x2'));var moment=require(_0x31f4('0x3'));var BPromise=require(_0x31f4('0x4'));var rp=require(_0x31f4('0x5'));var attributes=require(_0x31f4('0x6'));module['exports']=function(_0x28cd9d,_0x31b765){return _0x28cd9d[_0x31f4('0x7')](_0x31f4('0x8'),attributes,{'tableName':_0x31f4('0x9'),'paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':_0x31f4('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index d77419d..89f8fb8 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 _0x222f=['literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','campaign','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrAnswerCallsDay','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','debug','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x222f,0x1a4));var _0xf222=function(_0x5df780,_0x3460c8){_0x5df780=_0x5df780-0x0;var _0x535f5b=_0x222f[_0x5df780];return _0x535f5b;};'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')]('CmHopperHistory,\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')]['create'](_0x8783ab[_0xf222('0x18')],{'raw':_0x8783ab[_0xf222('0x19')]?_0x8783ab[_0xf222('0x19')][_0xf222('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5cd899){logger[_0xf222('0xc')](_0xf222('0x16'),_0x8783ab);logger[_0xf222('0x1b')](_0xf222('0x16'),_0x8783ab,JSON[_0xf222('0x10')](_0x5cd899));_0x12a2e4(_0x5cd899);})[_0xf222('0x15')](function(_0x51b872){logger[_0xf222('0x11')](_0xf222('0x16'),_0x51b872[_0xf222('0x13')],_0x8783ab);_0x1e57ee(_0xfb4ddf[_0xf222('0x11')](0x1f4,_0x51b872[_0xf222('0x13')]));});});};exports[_0xf222('0x1c')]=function(_0x4616de){var _0x144775=this;return new Promise(function(_0x50407b,_0x145e2e){return db[_0xf222('0x17')][_0xf222('0x1d')]({'raw':_0x4616de[_0xf222('0x19')]?_0x4616de[_0xf222('0x19')][_0xf222('0x1a')]===undefined?!![]:![]:!![],'where':_0x4616de[_0xf222('0x19')]?_0x4616de[_0xf222('0x19')][_0xf222('0x1e')]||null:null,'attributes':[[db[_0xf222('0x1f')]['fn'](_0xf222('0x20'),db['sequelize'][_0xf222('0x21')]('id')),_0xf222('0x22')],[db[_0xf222('0x1f')]['fn'](_0xf222('0x20'),db[_0xf222('0x1f')]['fn']('IF',db[_0xf222('0x1f')][_0xf222('0x23')](_0xf222('0x24')))),_0xf222('0x25')],[db['sequelize']['fn'](_0xf222('0x20'),db[_0xf222('0x1f')]['fn']('IF',db[_0xf222('0x1f')]['literal'](_0xf222('0x26')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xf222('0x1f')]['fn'](_0xf222('0x20'),db[_0xf222('0x1f')]['fn']('IF',db[_0xf222('0x1f')][_0xf222('0x23')](_0xf222('0x27')))),_0xf222('0x28')],[db['sequelize']['fn']('AVG',db[_0xf222('0x1f')]['fn']('IF',db[_0xf222('0x1f')][_0xf222('0x23')](_0xf222('0x29')))),_0xf222('0x2a')],[db[_0xf222('0x1f')]['fn']('AVG',db[_0xf222('0x1f')]['fn']('IF',db[_0xf222('0x1f')][_0xf222('0x23')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0xf222('0x2b')]]})[_0xf222('0xb')](function(_0x104522){logger['info'](_0xf222('0x1c'),_0x4616de);logger[_0xf222('0x1b')](_0xf222('0x1c'),_0x4616de,JSON['stringify'](_0x104522));_0x50407b(_0x104522);})[_0xf222('0x15')](function(_0x23ed1d){logger[_0xf222('0x11')](_0xf222('0x1c'),_0x23ed1d[_0xf222('0x13')],_0x4616de);_0x145e2e(_0x144775['error'](0x1f4,_0x23ed1d[_0xf222('0x13')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x220214){var _0x38db1b=this;return new Promise(function(_0x29d6ff,_0x5eb639){return db[_0xf222('0x17')][_0xf222('0x1d')]({'raw':_0x220214['options']?_0x220214[_0xf222('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x220214[_0xf222('0x19')]?_0x220214[_0xf222('0x19')][_0xf222('0x1e')]||null:null,'attributes':[['campaign',_0xf222('0x2c')],[db[_0xf222('0x1f')]['fn'](_0xf222('0x20'),db[_0xf222('0x1f')]['fn']('IF',db[_0xf222('0x1f')][_0xf222('0x23')]('`state`\x20=\x200,\x201,\x20null'))),_0xf222('0x2d')],[db[_0xf222('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xf222('0x1f')]['literal'](_0xf222('0x2e')))),_0xf222('0x2f')],[db[_0xf222('0x1f')]['fn'](_0xf222('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0xf222('0x23')]('`state`\x20=\x204,\x201,\x20null'))),'outboundAnswerCallsDay'],[db[_0xf222('0x1f')]['fn'](_0xf222('0x20'),db[_0xf222('0x1f')]['fn']('IF',db[_0xf222('0x1f')][_0xf222('0x23')](_0xf222('0x30')))),'outboundBusyCallsDay'],[db[_0xf222('0x1f')]['fn'](_0xf222('0x20'),db['sequelize']['fn']('IF',db[_0xf222('0x1f')][_0xf222('0x23')]('`state`\x20=\x208,\x201,\x20null'))),_0xf222('0x31')],[db['sequelize']['fn'](_0xf222('0x20'),db[_0xf222('0x1f')]['fn']('IF',db[_0xf222('0x1f')][_0xf222('0x23')](_0xf222('0x32')))),_0xf222('0x33')],[db[_0xf222('0x1f')]['fn'](_0xf222('0x20'),db[_0xf222('0x1f')]['fn']('IF',db[_0xf222('0x1f')][_0xf222('0x23')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'outboundDropCallsDayCallersExit'],[db['sequelize']['fn'](_0xf222('0x20'),db[_0xf222('0x1f')]['fn']('IF',db[_0xf222('0x1f')][_0xf222('0x23')]('`state`\x20=\x2012,\x201,\x20null'))),_0xf222('0x34')],[db[_0xf222('0x1f')]['fn'](_0xf222('0x20'),db[_0xf222('0x1f')]['fn']('IF',db['sequelize'][_0xf222('0x23')](_0xf222('0x35')))),_0xf222('0x36')],[db[_0xf222('0x1f')]['fn'](_0xf222('0x20'),db[_0xf222('0x1f')]['fn']('IF',db[_0xf222('0x1f')][_0xf222('0x23')](_0xf222('0x37')))),_0xf222('0x38')],[db['sequelize']['fn']('COUNT',db[_0xf222('0x1f')]['fn']('IF',db['sequelize'][_0xf222('0x23')]('`state`\x20=\x2018,\x201,\x20null'))),_0xf222('0x39')],[db['sequelize']['fn'](_0xf222('0x20'),db[_0xf222('0x1f')]['fn']('IF',db[_0xf222('0x1f')][_0xf222('0x23')]('`state`\x20=\x2016,\x201,\x20null'))),_0xf222('0x3a')],[db[_0xf222('0x1f')]['fn'](_0xf222('0x20'),db[_0xf222('0x1f')]['fn']('IF',db[_0xf222('0x1f')][_0xf222('0x23')](_0xf222('0x3b')))),_0xf222('0x39')],[db[_0xf222('0x1f')]['fn'](_0xf222('0x20'),db[_0xf222('0x1f')]['fn']('IF',db[_0xf222('0x1f')]['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xf222('0x3c')]],'group':[_0xf222('0x3d')]})[_0xf222('0xb')](function(_0xfb75f0){logger[_0xf222('0xc')](_0xf222('0x3e'),_0x220214);logger[_0xf222('0x1b')](_0xf222('0x3e'),_0x220214,JSON[_0xf222('0x10')](_0xfb75f0));_0x29d6ff(_0xfb75f0);})[_0xf222('0x15')](function(_0x19d859){logger['error']('GetVoiceQueueHopperHistory',_0x19d859[_0xf222('0x13')],_0x220214);_0x5eb639(_0x38db1b[_0xf222('0x11')](0x1f4,_0x19d859[_0xf222('0x13')]));});});};exports[_0xf222('0x3f')]=function(_0x43dac3){var _0x6eb194=this;return new Promise(function(_0x22bc07,_0x2002e3){return db[_0xf222('0x17')][_0xf222('0x1d')]({'raw':_0x43dac3[_0xf222('0x19')]?_0x43dac3[_0xf222('0x19')][_0xf222('0x1a')]===undefined?!![]:![]:!![],'where':_0x43dac3[_0xf222('0x19')]?_0x43dac3['options'][_0xf222('0x1e')]||null:null,'attributes':[['campaign',_0xf222('0x2c')],[db[_0xf222('0x1f')]['fn'](_0xf222('0x20'),db[_0xf222('0x1f')]['col']('id')),'ivrTotalCallsDays'],[db[_0xf222('0x1f')]['fn'](_0xf222('0x20'),db[_0xf222('0x1f')]['fn']('IF',db[_0xf222('0x1f')][_0xf222('0x23')]('`state`\x20=\x204,\x201,\x20null'))),_0xf222('0x40')]],'group':['campaign']})[_0xf222('0xb')](function(_0x3f9b99){logger['info'](_0xf222('0x3f'),_0x43dac3);logger['debug'](_0xf222('0x3f'),_0x43dac3,JSON[_0xf222('0x10')](_0x3f9b99));_0x22bc07(_0x3f9b99);})[_0xf222('0x15')](function(_0x5c69be){logger[_0xf222('0x11')](_0xf222('0x3f'),_0x5c69be[_0xf222('0x13')],_0x43dac3);_0x2002e3(_0x6eb194[_0xf222('0x11')](0x1f4,_0x5c69be[_0xf222('0x13')]));});});}; \ No newline at end of file +var _0xfd3a=['col','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','campaign','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','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','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','name','ivrTotalCallsDays','`state`\x20=\x204,\x201,\x20null','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','raw','AvgHandleTime','findAll','sequelize','COUNT'];(function(_0x4d04a8,_0x347a08){var _0x4e2efe=function(_0x7aa995){while(--_0x7aa995){_0x4d04a8['push'](_0x4d04a8['shift']());}};_0x4e2efe(++_0x347a08);}(_0xfd3a,0x179));var _0xafd3=function(_0x556208,_0x2f5ac4){_0x556208=_0x556208-0x0;var _0xe4cb1b=_0xfd3a[_0x556208];return _0xe4cb1b;};'use strict';var _=require(_0xafd3('0x0'));var util=require(_0xafd3('0x1'));var moment=require(_0xafd3('0x2'));var BPromise=require(_0xafd3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xafd3('0x4'))['db'];var utils=require(_0xafd3('0x5'));var logger=require(_0xafd3('0x6'))(_0xafd3('0x7'));var config=require(_0xafd3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xafd3('0x9')][_0xafd3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f7e16,_0x3766aa,_0xd2d780){return new BPromise(function(_0x4c4dcd,_0x478d8a){return client[_0xafd3('0xb')](_0x1f7e16,_0xd2d780)[_0xafd3('0xc')](function(_0x4d8860){logger[_0xafd3('0xd')](_0xafd3('0xe'),_0x3766aa,_0xafd3('0xf'));logger[_0xafd3('0x10')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x3766aa,'request\x20sent',JSON[_0xafd3('0x11')](_0x4d8860));if(_0x4d8860[_0xafd3('0x12')]){if(_0x4d8860['error']['code']===0x1f4){logger[_0xafd3('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x3766aa,_0x4d8860[_0xafd3('0x12')][_0xafd3('0x13')]);return _0x478d8a(_0x4d8860[_0xafd3('0x12')]['message']);}logger[_0xafd3('0x12')](_0xafd3('0xe'),_0x3766aa,_0x4d8860[_0xafd3('0x12')][_0xafd3('0x13')]);return _0x4c4dcd(_0x4d8860[_0xafd3('0x12')][_0xafd3('0x13')]);}else{logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x3766aa,'request\x20sent');_0x4c4dcd(_0x4d8860[_0xafd3('0x14')][_0xafd3('0x13')]);}})[_0xafd3('0x15')](function(_0x8e25de){logger[_0xafd3('0x12')](_0xafd3('0xe'),_0x3766aa,_0x8e25de);_0x478d8a(_0x8e25de);});});}exports[_0xafd3('0x16')]=function(_0x4e65e2){var _0xb84b4f=this;return new Promise(function(_0x264a5b,_0x5d1301){return db[_0xafd3('0x17')][_0xafd3('0x18')](_0x4e65e2['body'],{'raw':_0x4e65e2[_0xafd3('0x19')]?_0x4e65e2['options'][_0xafd3('0x1a')]===undefined?!![]:![]:!![]})[_0xafd3('0xc')](function(_0x172d67){logger[_0xafd3('0xd')](_0xafd3('0x16'),_0x4e65e2);logger[_0xafd3('0x10')](_0xafd3('0x16'),_0x4e65e2,JSON[_0xafd3('0x11')](_0x172d67));_0x264a5b(_0x172d67);})[_0xafd3('0x15')](function(_0x151cb6){logger[_0xafd3('0x12')](_0xafd3('0x16'),_0x151cb6[_0xafd3('0x13')],_0x4e65e2);_0x5d1301(_0xb84b4f[_0xafd3('0x12')](0x1f4,_0x151cb6[_0xafd3('0x13')]));});});};exports[_0xafd3('0x1b')]=function(_0x248601){var _0x62906c=this;return new Promise(function(_0x196b67,_0x942191){return db['CmHopperHistory'][_0xafd3('0x1c')]({'raw':_0x248601[_0xafd3('0x19')]?_0x248601[_0xafd3('0x19')][_0xafd3('0x1a')]===undefined?!![]:![]:!![],'where':_0x248601[_0xafd3('0x19')]?_0x248601[_0xafd3('0x19')]['where']||null:null,'attributes':[[db[_0xafd3('0x1d')]['fn'](_0xafd3('0x1e'),db[_0xafd3('0x1d')][_0xafd3('0x1f')]('id')),'predictiveIntervalTotalCalls'],[db['sequelize']['fn']('COUNT',db[_0xafd3('0x1d')]['fn']('IF',db[_0xafd3('0x1d')][_0xafd3('0x20')]('`state`\x20=\x204,\x201,\x20null'))),_0xafd3('0x21')],[db['sequelize']['fn']('COUNT',db[_0xafd3('0x1d')]['fn']('IF',db[_0xafd3('0x1d')][_0xafd3('0x20')](_0xafd3('0x22')))),_0xafd3('0x23')],[db['sequelize']['fn']('COUNT',db[_0xafd3('0x1d')]['fn']('IF',db[_0xafd3('0x1d')][_0xafd3('0x20')](_0xafd3('0x24')))),_0xafd3('0x25')],[db[_0xafd3('0x1d')]['fn'](_0xafd3('0x26'),db[_0xafd3('0x1d')]['fn']('IF',db['sequelize'][_0xafd3('0x20')](_0xafd3('0x27')))),_0xafd3('0x28')],[db[_0xafd3('0x1d')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0xafd3('0x1d')][_0xafd3('0x20')](_0xafd3('0x29')))),_0xafd3('0x2a')]]})['then'](function(_0x5b49a3){logger[_0xafd3('0xd')](_0xafd3('0x1b'),_0x248601);logger[_0xafd3('0x10')]('AvgHandleTime',_0x248601,JSON['stringify'](_0x5b49a3));_0x196b67(_0x5b49a3);})[_0xafd3('0x15')](function(_0x293bb6){logger[_0xafd3('0x12')](_0xafd3('0x1b'),_0x293bb6[_0xafd3('0x13')],_0x248601);_0x942191(_0x62906c['error'](0x1f4,_0x293bb6[_0xafd3('0x13')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x429b75){var _0x3e5d51=this;return new Promise(function(_0xf79458,_0x456d7b){return db[_0xafd3('0x17')][_0xafd3('0x1c')]({'raw':_0x429b75[_0xafd3('0x19')]?_0x429b75[_0xafd3('0x19')][_0xafd3('0x1a')]===undefined?!![]:![]:!![],'where':_0x429b75[_0xafd3('0x19')]?_0x429b75[_0xafd3('0x19')]['where']||null:null,'attributes':[[_0xafd3('0x2b'),'name'],[db[_0xafd3('0x1d')]['fn'](_0xafd3('0x1e'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xafd3('0x2c')))),'outboundNoSuchCallsDay'],[db[_0xafd3('0x1d')]['fn'](_0xafd3('0x1e'),db[_0xafd3('0x1d')]['fn']('IF',db[_0xafd3('0x1d')]['literal'](_0xafd3('0x2d')))),'outboundNoAnswerCallsDay'],[db[_0xafd3('0x1d')]['fn'](_0xafd3('0x1e'),db['sequelize']['fn']('IF',db[_0xafd3('0x1d')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0xafd3('0x2e')],[db[_0xafd3('0x1d')]['fn'](_0xafd3('0x1e'),db[_0xafd3('0x1d')]['fn']('IF',db[_0xafd3('0x1d')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0xafd3('0x2f')],[db[_0xafd3('0x1d')]['fn']('COUNT',db[_0xafd3('0x1d')]['fn']('IF',db['sequelize']['literal'](_0xafd3('0x30')))),_0xafd3('0x31')],[db[_0xafd3('0x1d')]['fn'](_0xafd3('0x1e'),db[_0xafd3('0x1d')]['fn']('IF',db['sequelize'][_0xafd3('0x20')](_0xafd3('0x32')))),'outboundDropCallsDayTimeout'],[db[_0xafd3('0x1d')]['fn']('COUNT',db[_0xafd3('0x1d')]['fn']('IF',db[_0xafd3('0x1d')][_0xafd3('0x20')](_0xafd3('0x33')))),_0xafd3('0x34')],[db['sequelize']['fn'](_0xafd3('0x1e'),db[_0xafd3('0x1d')]['fn']('IF',db[_0xafd3('0x1d')][_0xafd3('0x20')](_0xafd3('0x35')))),_0xafd3('0x36')],[db[_0xafd3('0x1d')]['fn'](_0xafd3('0x1e'),db[_0xafd3('0x1d')]['fn']('IF',db[_0xafd3('0x1d')][_0xafd3('0x20')](_0xafd3('0x37')))),_0xafd3('0x38')],[db[_0xafd3('0x1d')]['fn'](_0xafd3('0x1e'),db[_0xafd3('0x1d')]['fn']('IF',db[_0xafd3('0x1d')][_0xafd3('0x20')]('`state`\x20=\x2014,\x201,\x20null'))),_0xafd3('0x39')],[db[_0xafd3('0x1d')]['fn']('COUNT',db[_0xafd3('0x1d')]['fn']('IF',db[_0xafd3('0x1d')][_0xafd3('0x20')](_0xafd3('0x3a')))),_0xafd3('0x3b')],[db[_0xafd3('0x1d')]['fn'](_0xafd3('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0xafd3('0x20')](_0xafd3('0x3c')))),'outboundAnswerAgiCallsDay'],[db[_0xafd3('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xafd3('0x1d')][_0xafd3('0x20')](_0xafd3('0x3d')))),_0xafd3('0x3b')],[db[_0xafd3('0x1d')]['fn'](_0xafd3('0x1e'),db[_0xafd3('0x1d')]['fn']('IF',db[_0xafd3('0x1d')][_0xafd3('0x20')](_0xafd3('0x3e')))),'outboundReCallsDay']],'group':['campaign']})['then'](function(_0x3e30c1){logger['info'](_0xafd3('0x3f'),_0x429b75);logger[_0xafd3('0x10')]('GetVoiceQueueHopperHistory',_0x429b75,JSON['stringify'](_0x3e30c1));_0xf79458(_0x3e30c1);})[_0xafd3('0x15')](function(_0x20f3b2){logger[_0xafd3('0x12')](_0xafd3('0x3f'),_0x20f3b2[_0xafd3('0x13')],_0x429b75);_0x456d7b(_0x3e5d51[_0xafd3('0x12')](0x1f4,_0x20f3b2[_0xafd3('0x13')]));});});};exports[_0xafd3('0x40')]=function(_0xd4b635){var _0x1df54b=this;return new Promise(function(_0x2f1f4a,_0x504406){return db[_0xafd3('0x17')]['findAll']({'raw':_0xd4b635[_0xafd3('0x19')]?_0xd4b635[_0xafd3('0x19')][_0xafd3('0x1a')]===undefined?!![]:![]:!![],'where':_0xd4b635['options']?_0xd4b635[_0xafd3('0x19')]['where']||null:null,'attributes':[[_0xafd3('0x2b'),_0xafd3('0x41')],[db[_0xafd3('0x1d')]['fn'](_0xafd3('0x1e'),db[_0xafd3('0x1d')][_0xafd3('0x1f')]('id')),_0xafd3('0x42')],[db[_0xafd3('0x1d')]['fn'](_0xafd3('0x1e'),db['sequelize']['fn']('IF',db[_0xafd3('0x1d')]['literal'](_0xafd3('0x43')))),'ivrAnswerCallsDay']],'group':[_0xafd3('0x2b')]})[_0xafd3('0xc')](function(_0x4113c5){logger[_0xafd3('0xd')](_0xafd3('0x40'),_0xd4b635);logger[_0xafd3('0x10')]('GetCampaignHopperHistory',_0xd4b635,JSON[_0xafd3('0x11')](_0x4113c5));_0x2f1f4a(_0x4113c5);})['catch'](function(_0x43cadd){logger['error'](_0xafd3('0x40'),_0x43cadd[_0xafd3('0x13')],_0xd4b635);_0x504406(_0x1df54b[_0xafd3('0x12')](0x1f4,_0x43cadd[_0xafd3('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 31e2cec..8c38fe6 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 _0x2bd8=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','create','multer','path','connect-timeout','express'];(function(_0x264d4d,_0x118fb5){var _0xc917e2=function(_0x21b9dc){while(--_0x21b9dc){_0x264d4d['push'](_0x264d4d['shift']());}};_0xc917e2(++_0x118fb5);}(_0x2bd8,0x130));var _0x82bd=function(_0x5b69eb,_0x4c7998){_0x5b69eb=_0x5b69eb-0x0;var _0x44df65=_0x2bd8[_0x5b69eb];return _0x44df65;};'use strict';var multer=require(_0x82bd('0x0'));var util=require('util');var path=require(_0x82bd('0x1'));var timeout=require(_0x82bd('0x2'));var express=require(_0x82bd('0x3'));var router=express[_0x82bd('0x4')]();var auth=require(_0x82bd('0x5'));var interaction=require(_0x82bd('0x6'));var config=require(_0x82bd('0x7'));var controller=require('./cmHopperHistory.controller');router[_0x82bd('0x8')]('/',auth[_0x82bd('0x9')](),controller[_0x82bd('0xa')]);router['get'](_0x82bd('0xb'),auth[_0x82bd('0x9')](),controller[_0x82bd('0xc')]);router[_0x82bd('0x8')]('/:id',auth[_0x82bd('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x82bd('0xd')]);router['put']('/:id',auth[_0x82bd('0x9')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0xf185=['Router','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','show','create','/:id','multer','path','connect-timeout','express'];(function(_0x56484f,_0x3efee6){var _0x26619d=function(_0x2089d9){while(--_0x2089d9){_0x56484f['push'](_0x56484f['shift']());}};_0x26619d(++_0x3efee6);}(_0xf185,0x1be));var _0x5f18=function(_0x1c0b44,_0x450015){_0x1c0b44=_0x1c0b44-0x0;var _0x4fa308=_0xf185[_0x1c0b44];return _0x4fa308;};'use strict';var multer=require(_0x5f18('0x0'));var util=require('util');var path=require(_0x5f18('0x1'));var timeout=require(_0x5f18('0x2'));var express=require(_0x5f18('0x3'));var router=express[_0x5f18('0x4')]();var auth=require(_0x5f18('0x5'));var interaction=require(_0x5f18('0x6'));var config=require('../../config/environment');var controller=require(_0x5f18('0x7'));router[_0x5f18('0x8')]('/',auth[_0x5f18('0x9')](),controller[_0x5f18('0xa')]);router['get'](_0x5f18('0xb'),auth[_0x5f18('0x9')](),controller['describe']);router[_0x5f18('0x8')]('/:id',auth[_0x5f18('0x9')](),controller[_0x5f18('0xc')]);router['post']('/',auth[_0x5f18('0x9')](),controller[_0x5f18('0xd')]);router['put'](_0x5f18('0xe'),auth[_0x5f18('0x9')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index ae76e07..4c88bab 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 _0xda19=['STRING','exports'];(function(_0x10ab6e,_0x9c8654){var _0x366650=function(_0x5508c8){while(--_0x5508c8){_0x10ab6e['push'](_0x10ab6e['shift']());}};_0x366650(++_0x9c8654);}(_0xda19,0xd5));var _0x9da1=function(_0x37e68f,_0x1d05c0){_0x37e68f=_0x37e68f-0x0;var _0x2d814b=_0xda19[_0x37e68f];return _0x2d814b;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'name':{'type':Sequelize[_0x9da1('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9da1('0x1')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x53ec=['STRING','name','sequelize','exports'];(function(_0x1b53b8,_0x2a39e7){var _0x2dc9d6=function(_0x327c99){while(--_0x327c99){_0x1b53b8['push'](_0x1b53b8['shift']());}};_0x2dc9d6(++_0x2a39e7);}(_0x53ec,0x192));var _0xc53e=function(_0x32c98a,_0x5e6eb0){_0x32c98a=_0x32c98a-0x0;var _0x1796d3=_0x53ec[_0x32c98a];return _0x1796d3;};'use strict';var Sequelize=require(_0xc53e('0x0'));module[_0xc53e('0x1')]={'name':{'type':Sequelize[_0xc53e('0x2')],'unique':_0xc53e('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc53e('0x2')]},'dialPrefix':{'type':Sequelize[_0xc53e('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index e4148bc..cc7a8cc 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 _0x40d8=['dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','dateEnd','add','day','filter','where','map','merge','then','includeAll','include','findAll','rows','show','options','catch','body','find','params','destroy','describe','addDisposition','Disposition','create','getDispositions','findOne','nolimit','ListId','removeDispositions','ids','CmContact','tags','isArray','push','each','omit','success','message','Malformed\x20request\x20syntax','CmCustomField','concat','CustomFields','format','raw','getContacts','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','Content-type','download','sequelize','transaction','addCustomFields','Sequelize','TEXT','type','text','number','INTEGER','switch','BOOLEAN','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','removeAgents','userCmList:remove','getAgents','User','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','./cmList.socket','register','status','json','count','offset','limit','set','Content-Range','apply','save','update','end','sendStatus','stack','name','index','CmList','rawAttributes','model','keys','query'];(function(_0x34085d,_0x456978){var _0x2d9832=function(_0x3e923e){while(--_0x3e923e){_0x34085d['push'](_0x34085d['shift']());}};_0x2d9832(++_0x456978);}(_0x40d8,0xd1));var _0x840d=function(_0x2f9467,_0x40576f){_0x2f9467=_0x2f9467-0x0;var _0x39894c=_0x40d8[_0x2f9467];return _0x39894c;};'use strict';var pdf=require(_0x840d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x840d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x840d('0x2'));var rp=require(_0x840d('0x3'));var moment=require(_0x840d('0x4'));var BPromise=require(_0x840d('0x5'));var Mustache=require(_0x840d('0x6'));var util=require(_0x840d('0x7'));var path=require(_0x840d('0x8'));var sox=require(_0x840d('0x9'));var csv=require(_0x840d('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x840d('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x840d('0xc'));var Papa=require('papaparse');var Redis=require(_0x840d('0xd'));var qs=require(_0x840d('0xe'));var logger=require(_0x840d('0xf'))(_0x840d('0x10'));var utils=require(_0x840d('0x11'));var config=require('../../config/environment');var db=require(_0x840d('0x12'))['db'];config[_0x840d('0x13')]=_[_0x840d('0x14')](config[_0x840d('0x13')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x840d('0x13')]));require(_0x840d('0x15'))[_0x840d('0x16')](socket);function respondWithStatusCode(_0x3d569f,_0x560743){_0x560743=_0x560743||0xcc;return function(_0xa2945d){if(_0xa2945d){return _0x3d569f['sendStatus'](_0x560743);}return _0x3d569f[_0x840d('0x17')](_0x560743)['end']();};}function respondWithResult(_0x3ecea6,_0x42f164){_0x42f164=_0x42f164||0xc8;return function(_0x22949c){if(_0x22949c){return _0x3ecea6['status'](_0x42f164)[_0x840d('0x18')](_0x22949c);}};}function respondWithFilteredResult(_0x4680b4,_0x4121d4){return function(_0x5b3fb0){if(_0x5b3fb0){var _0x2721ea=_0x5b3fb0[_0x840d('0x19')],_0xa01968=_0x4121d4[_0x840d('0x1a')],_0x34d27d=_0x4121d4['offset']+_0x4121d4[_0x840d('0x1b')],_0x4b77ea;if(_0x34d27d>=_0x2721ea){_0x34d27d=_0x2721ea;_0x4b77ea=0xc8;}else{_0x4b77ea=0xce;}_0x4680b4[_0x840d('0x17')](_0x4b77ea);return _0x4680b4[_0x840d('0x1c')](_0x840d('0x1d'),_0xa01968+'-'+_0x34d27d+'/'+_0x2721ea)[_0x840d('0x18')](_0x5b3fb0);}return null;};}function patchUpdates(_0x223fe2){return function(_0xfc27eb){try{jsonpatch[_0x840d('0x1e')](_0xfc27eb,_0x223fe2,!![]);}catch(_0x1d131c){return BPromise['reject'](_0x1d131c);}return _0xfc27eb[_0x840d('0x1f')]();};}function saveUpdates(_0x1e1c33,_0x576bb7){return function(_0x23fb2b){if(_0x23fb2b){return _0x23fb2b[_0x840d('0x20')](_0x1e1c33)['then'](function(_0x5521f6){return _0x5521f6;});}return null;};}function removeEntity(_0x43a4e9,_0x13061d){return function(_0x35f43e){if(_0x35f43e){return _0x35f43e['destroy']()['then'](function(){_0x43a4e9[_0x840d('0x17')](0xcc)[_0x840d('0x21')]();});}};}function handleEntityNotFound(_0x2653c6,_0x2bdd73){return function(_0x50f28e){if(!_0x50f28e){_0x2653c6[_0x840d('0x22')](0x194);}return _0x50f28e;};}function handleError(_0x4dc3f6,_0x794710){_0x794710=_0x794710||0x1f4;return function(_0x3befd3){logger['error'](_0x3befd3[_0x840d('0x23')]);if(_0x3befd3[_0x840d('0x24')]){delete _0x3befd3[_0x840d('0x24')];}_0x4dc3f6[_0x840d('0x17')](_0x794710)['send'](_0x3befd3);};}exports[_0x840d('0x25')]=function(_0x10d0fd,_0x2421ad){var _0x7be880={},_0x10e6bf={},_0x107309={'count':0x0,'rows':[]};var _0x33429=db[_0x840d('0x26')][_0x840d('0x27')];_0x10e6bf[_0x840d('0x28')]=_[_0x840d('0x29')](_0x33429);var _0x36158e={'dateStart':_0x10d0fd[_0x840d('0x2a')][_0x840d('0x2b')],'dateEnd':_0x10d0fd[_0x840d('0x2a')]['dateEnd']};delete _0x10d0fd[_0x840d('0x2a')]['dateStart'];delete _0x10d0fd[_0x840d('0x2a')]['dateEnd'];_0x10e6bf['query']=_[_0x840d('0x29')](_0x10d0fd[_0x840d('0x2a')]);_0x10e6bf[_0x840d('0x2c')]=_[_0x840d('0x2d')](_0x10e6bf[_0x840d('0x28')],_0x10e6bf[_0x840d('0x2a')]);_0x7be880[_0x840d('0x2e')]=_[_0x840d('0x2d')](_0x10e6bf['model'],qs[_0x840d('0x2f')](_0x10d0fd[_0x840d('0x2a')][_0x840d('0x2f')]));_0x7be880[_0x840d('0x2e')]=_0x7be880[_0x840d('0x2e')][_0x840d('0x30')]?_0x7be880[_0x840d('0x2e')]:_0x10e6bf[_0x840d('0x28')];if(!_0x10d0fd[_0x840d('0x2a')][_0x840d('0x31')]('nolimit')){_0x7be880['limit']=qs[_0x840d('0x1b')](_0x10d0fd[_0x840d('0x2a')]['limit']);_0x7be880[_0x840d('0x1a')]=qs['offset'](_0x10d0fd[_0x840d('0x2a')][_0x840d('0x1a')]);}_0x7be880[_0x840d('0x32')]=qs[_0x840d('0x33')](_0x10d0fd['query'][_0x840d('0x33')]);_0x7be880['where']=qs[_0x840d('0x2c')](_[_0x840d('0x34')](_0x10d0fd[_0x840d('0x2a')],_0x10e6bf[_0x840d('0x2c')]));if(_0x36158e['dateStart']){if(_0x36158e[_0x840d('0x35')]){_0x36158e['dateEnd']=moment(_0x36158e[_0x840d('0x35')])[_0x840d('0x36')](0x1,_0x840d('0x37'));}else{_0x36158e['dateEnd']=moment(_0x36158e['dateStart'])[_0x840d('0x36')](0x1,_0x840d('0x37'));}_['merge'](_0x7be880['where'],{'createdAt':{'$gte':_0x36158e[_0x840d('0x2b')],'$lte':_0x36158e[_0x840d('0x35')]}});}if(_0x10d0fd[_0x840d('0x2a')][_0x840d('0x38')]){_0x7be880['where']=_['merge'](_0x7be880[_0x840d('0x39')],{'$or':_[_0x840d('0x3a')](_0x7be880[_0x840d('0x2e')],function(_0x1bc60f){var _0x3a1dd3={};_0x3a1dd3[_0x1bc60f]={'$like':'%'+_0x10d0fd[_0x840d('0x2a')][_0x840d('0x38')]+'%'};return _0x3a1dd3;})});}_0x7be880=_[_0x840d('0x3b')]({},_0x7be880,_0x10d0fd['options']);var _0x579972={'where':_0x7be880[_0x840d('0x39')]};return db[_0x840d('0x26')][_0x840d('0x19')](_0x579972)[_0x840d('0x3c')](function(_0x312446){_0x107309['count']=_0x312446;if(_0x10d0fd[_0x840d('0x2a')][_0x840d('0x3d')]){_0x7be880[_0x840d('0x3e')]=[{'all':!![]}];}return db[_0x840d('0x26')][_0x840d('0x3f')](_0x7be880);})['then'](function(_0x51feb7){_0x107309[_0x840d('0x40')]=_0x51feb7;return _0x107309;})['then'](respondWithFilteredResult(_0x2421ad,_0x7be880))['catch'](handleError(_0x2421ad,null));};exports[_0x840d('0x41')]=function(_0x3334be,_0xd0127f){var _0x3854f6={'raw':![],'where':{'id':_0x3334be['params']['id']}},_0x29eaa1={};_0x29eaa1[_0x840d('0x28')]=_[_0x840d('0x29')](db[_0x840d('0x26')]['rawAttributes']);_0x29eaa1['query']=_['keys'](_0x3334be[_0x840d('0x2a')]);_0x29eaa1[_0x840d('0x2c')]=_['intersection'](_0x29eaa1[_0x840d('0x28')],_0x29eaa1[_0x840d('0x2a')]);_0x3854f6[_0x840d('0x2e')]=_[_0x840d('0x2d')](_0x29eaa1['model'],qs[_0x840d('0x2f')](_0x3334be[_0x840d('0x2a')][_0x840d('0x2f')]));_0x3854f6['attributes']=_0x3854f6['attributes'][_0x840d('0x30')]?_0x3854f6[_0x840d('0x2e')]:_0x29eaa1[_0x840d('0x28')];if(_0x3334be[_0x840d('0x2a')][_0x840d('0x3d')]){_0x3854f6['include']=[{'all':!![]}];}_0x3854f6=_[_0x840d('0x3b')]({},_0x3854f6,_0x3334be[_0x840d('0x42')]);return db[_0x840d('0x26')]['find'](_0x3854f6)[_0x840d('0x3c')](handleEntityNotFound(_0xd0127f,null))['then'](respondWithResult(_0xd0127f,null))[_0x840d('0x43')](handleError(_0xd0127f,null));};exports['create']=function(_0x151bb3,_0x5e9979){return db['CmList']['create'](_0x151bb3[_0x840d('0x44')],{})[_0x840d('0x3c')](respondWithResult(_0x5e9979,0xc9))[_0x840d('0x43')](handleError(_0x5e9979,null));};exports[_0x840d('0x20')]=function(_0x11ffa3,_0xe2b3d0){if(_0x11ffa3[_0x840d('0x44')]['id']){delete _0x11ffa3['body']['id'];}return db[_0x840d('0x26')][_0x840d('0x45')]({'where':{'id':_0x11ffa3[_0x840d('0x46')]['id']}})[_0x840d('0x3c')](handleEntityNotFound(_0xe2b3d0,null))[_0x840d('0x3c')](saveUpdates(_0x11ffa3[_0x840d('0x44')],null))[_0x840d('0x3c')](respondWithResult(_0xe2b3d0,null))['catch'](handleError(_0xe2b3d0,null));};exports[_0x840d('0x47')]=function(_0x1d4a26,_0x598388){return db[_0x840d('0x26')][_0x840d('0x45')]({'where':{'id':_0x1d4a26[_0x840d('0x46')]['id']}})[_0x840d('0x3c')](handleEntityNotFound(_0x598388,null))['then'](removeEntity(_0x598388,null))[_0x840d('0x43')](handleError(_0x598388,null));};exports['describe']=function(_0x442c41,_0x2900c5){return db['CmList'][_0x840d('0x48')]()['then'](respondWithResult(_0x2900c5,null))[_0x840d('0x43')](handleError(_0x2900c5,null));};exports[_0x840d('0x49')]=function(_0x51d1dd,_0x17aa62,_0x55e441){if(_0x51d1dd[_0x840d('0x44')]['id']){delete _0x51d1dd[_0x840d('0x44')]['id'];}return db[_0x840d('0x26')][_0x840d('0x45')]({'where':{'id':_0x51d1dd['params']['id']}})[_0x840d('0x3c')](handleEntityNotFound(_0x17aa62,null))[_0x840d('0x3c')](function(_0x22c5aa){if(_0x22c5aa){_0x51d1dd[_0x840d('0x44')]['ListId']=_0x22c5aa['id'];return db[_0x840d('0x4a')][_0x840d('0x4b')](_0x51d1dd['body']);}})['then'](respondWithResult(_0x17aa62,null))['catch'](handleError(_0x17aa62,null));};exports[_0x840d('0x4c')]=function(_0x90f6ca,_0x304838,_0x17d18d){var _0x23cfd3={'raw':![],'where':{}};var _0xb17049={};var _0x2037f8={'count':0x0,'rows':[]};return db[_0x840d('0x26')][_0x840d('0x4d')]({'where':{'id':_0x90f6ca[_0x840d('0x46')]['id']}})[_0x840d('0x3c')](handleEntityNotFound(_0x304838,null))[_0x840d('0x3c')](function(_0x4fb831){if(_0x4fb831){_0xb17049['model']=_[_0x840d('0x29')](db[_0x840d('0x4a')][_0x840d('0x27')]);_0xb17049[_0x840d('0x2a')]=_[_0x840d('0x29')](_0x90f6ca[_0x840d('0x2a')]);_0xb17049[_0x840d('0x2c')]=_[_0x840d('0x2d')](_0xb17049[_0x840d('0x28')],_0xb17049[_0x840d('0x2a')]);_0x23cfd3[_0x840d('0x2e')]=_[_0x840d('0x2d')](_0xb17049[_0x840d('0x28')],qs[_0x840d('0x2f')](_0x90f6ca[_0x840d('0x2a')]['fields']));_0x23cfd3['attributes']=_0x23cfd3[_0x840d('0x2e')][_0x840d('0x30')]?_0x23cfd3[_0x840d('0x2e')]:_0xb17049[_0x840d('0x28')];if(!_0x90f6ca[_0x840d('0x2a')][_0x840d('0x31')](_0x840d('0x4e'))){_0x23cfd3[_0x840d('0x1b')]=qs['limit'](_0x90f6ca[_0x840d('0x2a')][_0x840d('0x1b')]);_0x23cfd3[_0x840d('0x1a')]=qs[_0x840d('0x1a')](_0x90f6ca['query'][_0x840d('0x1a')]);}_0x23cfd3[_0x840d('0x32')]=qs['sort'](_0x90f6ca['query'][_0x840d('0x33')]);_0x23cfd3['where']=qs[_0x840d('0x2c')](_[_0x840d('0x34')](_0x90f6ca[_0x840d('0x2a')],_0xb17049[_0x840d('0x2c')]));_0x23cfd3[_0x840d('0x39')][_0x840d('0x4f')]=_0x4fb831['id'];if(_0x90f6ca[_0x840d('0x2a')][_0x840d('0x38')]){_0x23cfd3[_0x840d('0x39')]=_[_0x840d('0x3b')](_0x23cfd3['where'],{'$or':_['map'](_0x23cfd3[_0x840d('0x2e')],function(_0x531234){var _0x2a3b32={};_0x2a3b32[_0x531234]={'$like':'%'+_0x90f6ca[_0x840d('0x2a')][_0x840d('0x38')]+'%'};return _0x2a3b32;})});}_0x23cfd3=_['merge']({},_0x23cfd3,_0x90f6ca[_0x840d('0x42')]);return db[_0x840d('0x4a')][_0x840d('0x19')]({'where':_0x23cfd3[_0x840d('0x39')]})['then'](function(_0x4245fc){_0x2037f8[_0x840d('0x19')]=_0x4245fc;if(_0x90f6ca[_0x840d('0x2a')]['includeAll']){_0x23cfd3[_0x840d('0x3e')]=[{'all':!![]}];}return db[_0x840d('0x4a')][_0x840d('0x3f')](_0x23cfd3);})['then'](function(_0x17cfb3){_0x2037f8[_0x840d('0x40')]=_0x17cfb3;return _0x2037f8;});}})['then'](respondWithFilteredResult(_0x304838,_0x23cfd3))[_0x840d('0x43')](handleError(_0x304838,null));};exports[_0x840d('0x50')]=function(_0x42fe76,_0x599a90,_0x16bb7e){var _0x45b571;return db[_0x840d('0x26')][_0x840d('0x45')]({'where':{'id':_0x42fe76['params']['id']}})['then'](handleEntityNotFound(_0x599a90,null))[_0x840d('0x3c')](function(_0x4b76f3){if(_0x4b76f3){return _0x4b76f3[_0x840d('0x50')](_0x42fe76[_0x840d('0x2a')][_0x840d('0x51')]);}})['then'](respondWithStatusCode(_0x599a90,null))[_0x840d('0x43')](handleError(_0x599a90,null));};exports['addContacts']=function(_0xd455ad,_0x436ad4,_0x170f91){return db[_0x840d('0x26')][_0x840d('0x45')]({'where':{'id':_0xd455ad['params']['id']}})['then'](handleEntityNotFound(_0x436ad4,null))[_0x840d('0x3c')](function(_0x12d3a1){if(_0x12d3a1){var _0x39f1c7=[];var _0x2d4b93={'success':[],'errors':[]};return db[_0x840d('0x52')]['describe']()[_0x840d('0x3c')](function(_0x10253d){if(_0xd455ad[_0x840d('0x44')][_0x840d('0x53')]&&_[_0x840d('0x54')](_0xd455ad[_0x840d('0x44')][_0x840d('0x53')])){if(_0xd455ad[_0x840d('0x44')][_0x840d('0x53')][_0x840d('0x30')]){_0xd455ad['body'][_0x840d('0x53')]=_0xd455ad[_0x840d('0x44')][_0x840d('0x53')]['join'](';')+';';}else{_0xd455ad['body'][_0x840d('0x53')]=null;}}else{_0xd455ad[_0x840d('0x44')][_0x840d('0x53')]=null;}if(_0xd455ad[_0x840d('0x44')]&&_[_0x840d('0x54')](_0xd455ad[_0x840d('0x44')])){for(var _0x464677=0x0;_0x464677<_0xd455ad[_0x840d('0x44')]['length'];_0x464677+=0x1){_0xd455ad[_0x840d('0x44')][_0x464677][_0x840d('0x4f')]=_0xd455ad['params']['id'];_0x39f1c7[_0x840d('0x55')](_0xd455ad[_0x840d('0x44')][_0x464677]);}return BPromise[_0x840d('0x56')](_0x39f1c7,function(_0xed88ee){return db[_0x840d('0x52')][_0x840d('0x4b')](_[_0x840d('0x57')](_0xed88ee,['ids','id'])||{},{'fields':_[_0x840d('0x29')](_0x10253d),'raw':!![]})['then'](function(_0x57adfa){_0x2d4b93[_0x840d('0x58')]['push'](_0x57adfa['dataValues']);})['catch'](function(_0x2516a0){_0x2d4b93['errors']['push']({'data':_0xed88ee,'error':_0x2516a0[_0x840d('0x59')]});});})[_0x840d('0x3c')](function(_0x57ae44){return _0x2d4b93;})[_0x840d('0x43')](function(_0x2d04b6){return _0x2d04b6;});}else{_0x436ad4[_0x840d('0x17')](0x190)[_0x840d('0x18')]({'message':_0x840d('0x5a')});}});}})[_0x840d('0x3c')](respondWithResult(_0x436ad4,null))['catch'](handleError(_0x436ad4,null));};exports['getContacts']=function(_0x3d7a98,_0x588b5e,_0x560203){var _0x207aa8;return db[_0x840d('0x26')][_0x840d('0x45')]({'where':{'id':_0x3d7a98[_0x840d('0x46')]['id']},'include':[{'model':db[_0x840d('0x5b')],'as':'CustomFields'}]})[_0x840d('0x3c')](handleEntityNotFound(_0x588b5e,null))[_0x840d('0x3c')](function(_0x2a4f33){if(_0x2a4f33){_0x207aa8=_0x2a4f33;return db[_0x840d('0x52')]['rawAttributes'];}})[_0x840d('0x3c')](function(_0x1bb70e){if(_0x1bb70e){var _0x4870e9={};var _0x2fdee6={};_0x2fdee6['model']=_[_0x840d('0x5c')](_['keys'](_0x1bb70e),_[_0x840d('0x3a')](_0x207aa8[_0x840d('0x5d')],function(_0x537041){return util[_0x840d('0x5e')]('cf_%d',_0x537041['id']);}));_0x2fdee6[_0x840d('0x2a')]=_['keys'](_0x3d7a98[_0x840d('0x2a')]);_0x2fdee6[_0x840d('0x2c')]=_[_0x840d('0x2d')](_0x2fdee6[_0x840d('0x28')],_0x2fdee6[_0x840d('0x2a')]);_0x4870e9['attributes']=_[_0x840d('0x2d')](_0x2fdee6[_0x840d('0x28')],qs[_0x840d('0x2f')](_0x3d7a98[_0x840d('0x2a')][_0x840d('0x2f')]));_0x4870e9[_0x840d('0x2e')]=_0x4870e9['attributes']['length']?_0x4870e9['attributes']:_0x2fdee6[_0x840d('0x28')];if(!_0x3d7a98['query']['hasOwnProperty'](_0x840d('0x4e'))){_0x4870e9[_0x840d('0x1b')]=qs['limit'](_0x3d7a98['query'][_0x840d('0x1b')]);_0x4870e9[_0x840d('0x1a')]=qs[_0x840d('0x1a')](_0x3d7a98[_0x840d('0x2a')]['offset']);}_0x4870e9[_0x840d('0x32')]=qs['sort'](_0x3d7a98[_0x840d('0x2a')][_0x840d('0x33')]);_0x4870e9[_0x840d('0x39')]=qs['filters'](_[_0x840d('0x34')](_0x3d7a98['query'],_0x2fdee6[_0x840d('0x2c')]));_0x4870e9['raw']=!![];if(_0x3d7a98['query'][_0x840d('0x38')]){_0x4870e9[_0x840d('0x39')]=_[_0x840d('0x3b')](_0x4870e9[_0x840d('0x39')],{'$or':_[_0x840d('0x3a')](_0x4870e9['attributes'],function(_0x41a433){var _0x15ff3a={};_0x15ff3a[_0x41a433]={'$like':'%'+_0x3d7a98[_0x840d('0x2a')][_0x840d('0x38')]+'%'};return _0x15ff3a;})});}_0x4870e9=_[_0x840d('0x3b')]({},_0x4870e9,_0x3d7a98[_0x840d('0x42')]);return _0x207aa8['getContacts'](_0x4870e9);}})[_0x840d('0x3c')](respondWithResult(_0x588b5e,null))['catch'](handleError(_0x588b5e,null));};exports['getContactsCsv']=function(_0x6641a,_0x5afedb,_0x19cd0e){var _0x563fb2;return db['CmList']['find']({'where':{'id':_0x6641a['params']['id']},'include':[{'model':db[_0x840d('0x5b')],'as':_0x840d('0x5d')}]})[_0x840d('0x3c')](handleEntityNotFound(_0x5afedb,null))[_0x840d('0x3c')](function(_0x4e573d){if(_0x4e573d){_0x563fb2=_0x4e573d;return db[_0x840d('0x52')][_0x840d('0x27')];}})[_0x840d('0x3c')](function(_0x3ef2d8){if(_0x3ef2d8){var _0x32b2be={};var _0x39b03d={};_0x39b03d[_0x840d('0x28')]=_[_0x840d('0x5c')](_['keys'](_0x3ef2d8),_[_0x840d('0x3a')](_0x563fb2[_0x840d('0x5d')],function(_0xa5af57){return util[_0x840d('0x5e')]('cf_%d',_0xa5af57['id']);}));_0x39b03d[_0x840d('0x2a')]=_[_0x840d('0x29')](_0x6641a[_0x840d('0x2a')]);_0x39b03d[_0x840d('0x2c')]=_[_0x840d('0x2d')](_0x39b03d['model'],_0x39b03d['query']);_0x32b2be[_0x840d('0x2e')]=_[_0x840d('0x2d')](_0x39b03d[_0x840d('0x28')],qs[_0x840d('0x2f')](_0x6641a[_0x840d('0x2a')][_0x840d('0x2f')]));_0x32b2be['attributes']=_0x32b2be['attributes'][_0x840d('0x30')]?_0x32b2be[_0x840d('0x2e')]:_0x39b03d[_0x840d('0x28')];if(!_0x6641a[_0x840d('0x2a')][_0x840d('0x31')](_0x840d('0x4e'))){_0x32b2be[_0x840d('0x1b')]=qs['limit'](_0x6641a[_0x840d('0x2a')][_0x840d('0x1b')]);_0x32b2be[_0x840d('0x1a')]=qs[_0x840d('0x1a')](_0x6641a['query'][_0x840d('0x1a')]);}_0x32b2be[_0x840d('0x32')]=qs[_0x840d('0x33')](_0x6641a[_0x840d('0x2a')][_0x840d('0x33')]);_0x32b2be[_0x840d('0x39')]=qs[_0x840d('0x2c')](_[_0x840d('0x34')](_0x6641a[_0x840d('0x2a')],_0x39b03d[_0x840d('0x2c')]));_0x32b2be[_0x840d('0x5f')]=!![];if(_0x6641a[_0x840d('0x2a')][_0x840d('0x38')]){_0x32b2be[_0x840d('0x39')]=_['merge'](_0x32b2be[_0x840d('0x39')],{'$or':_[_0x840d('0x3a')](_0x32b2be[_0x840d('0x2e')],function(_0x4669c5){var _0x2f4e31={};_0x2f4e31[_0x4669c5]={'$like':'%'+_0x6641a[_0x840d('0x2a')]['filter']+'%'};return _0x2f4e31;})});}_0x32b2be=_[_0x840d('0x3b')]({},_0x32b2be,_0x6641a[_0x840d('0x42')]);return _0x563fb2[_0x840d('0x60')](_0x32b2be);}})['then'](function(_0x442afd){if(!_[_0x840d('0x61')](_0x442afd)){var _0x38fe87=toCsv(_0x442afd);var _0x7fbd0e=Date[_0x840d('0x62')]();fs[_0x840d('0x63')](util[_0x840d('0x5e')](_0x840d('0x64'),_0x563fb2['id'],_0x7fbd0e),_0x38fe87);_0x5afedb[_0x840d('0x65')](_0x840d('0x66'),'attachment;\x20filename='+util[_0x840d('0x5e')]('list_%d_%s.csv',_0x563fb2['id'],_0x7fbd0e));_0x5afedb['setHeader'](_0x840d('0x67'),'text/csv');return _0x5afedb[_0x840d('0x68')](util[_0x840d('0x5e')](_0x840d('0x64'),_0x563fb2['id'],_0x7fbd0e));}else{return _0x5afedb[_0x840d('0x22')](0xcc);}})[_0x840d('0x43')](handleError(_0x5afedb,null));};exports['addCustomField']=function(_0x5a0493,_0x2ef658,_0x33d8f6){var _0x41eab8;delete _0x5a0493[_0x840d('0x44')]['id'];return db[_0x840d('0x26')][_0x840d('0x4d')]({'where':{'id':_0x5a0493['params']['id']}})[_0x840d('0x3c')](handleEntityNotFound(_0x2ef658,null))[_0x840d('0x3c')](function(_0x479119){if(_0x479119){return db[_0x840d('0x69')][_0x840d('0x6a')](function(_0x4cbcea){return db[_0x840d('0x5b')]['create'](_0x5a0493[_0x840d('0x44')],{'transaction':_0x4cbcea})[_0x840d('0x3c')](function(_0x1ec3f0){_0x41eab8=_0x1ec3f0;return _0x479119[_0x840d('0x6b')](_0x1ec3f0,{'transaction':_0x4cbcea});})['then'](function(){var _0xb84843={'type':db[_0x840d('0x6c')][_0x840d('0x6d')],'transaction':_0x4cbcea};switch(_0x5a0493[_0x840d('0x44')][_0x840d('0x6e')]){case _0x840d('0x6f'):_0xb84843['type']=db[_0x840d('0x6c')][_0x840d('0x6d')];break;case _0x840d('0x70'):_0xb84843[_0x840d('0x6e')]=db[_0x840d('0x6c')][_0x840d('0x71')];break;case _0x840d('0x72'):_0xb84843[_0x840d('0x6e')]=db[_0x840d('0x6c')][_0x840d('0x73')];_0xb84843['defaultValue']=![];break;default:}return db['sequelize']['queryInterface']['addColumn']('cm_contacts',util[_0x840d('0x5e')](_0x840d('0x74'),_0x41eab8['id']),_0xb84843);})[_0x840d('0x3c')](function(){return _0x41eab8;});});}})['then'](respondWithResult(_0x2ef658,null))['catch'](handleError(_0x2ef658,null));};exports[_0x840d('0x75')]=function(_0x3f6d8b,_0x38710e,_0x44a319){var _0x3b59bf={};var _0x3286ea={};var _0x10558d;var _0x3fa78d;return db[_0x840d('0x26')]['findOne']({'where':{'id':_0x3f6d8b['params']['id']}})[_0x840d('0x3c')](handleEntityNotFound(_0x38710e,null))[_0x840d('0x3c')](function(_0xbe1e9e){if(_0xbe1e9e){_0x10558d=_0xbe1e9e;_0x3286ea['model']=_[_0x840d('0x29')](db[_0x840d('0x5b')][_0x840d('0x27')]);_0x3286ea[_0x840d('0x2a')]=_['keys'](_0x3f6d8b[_0x840d('0x2a')]);_0x3286ea[_0x840d('0x2c')]=_[_0x840d('0x2d')](_0x3286ea[_0x840d('0x28')],_0x3286ea[_0x840d('0x2a')]);_0x3b59bf['attributes']=_[_0x840d('0x2d')](_0x3286ea[_0x840d('0x28')],qs[_0x840d('0x2f')](_0x3f6d8b[_0x840d('0x2a')][_0x840d('0x2f')]));_0x3b59bf[_0x840d('0x2e')]=_0x3b59bf[_0x840d('0x2e')][_0x840d('0x30')]?_0x3b59bf[_0x840d('0x2e')]:_0x3286ea[_0x840d('0x28')];_0x3b59bf[_0x840d('0x32')]=qs[_0x840d('0x33')](_0x3f6d8b['query'][_0x840d('0x33')]);_0x3b59bf[_0x840d('0x39')]=qs[_0x840d('0x2c')](_[_0x840d('0x34')](_0x3f6d8b['query'],_0x3286ea[_0x840d('0x2c')]));_0x3b59bf[_0x840d('0x39')]=_['merge'](_0x3b59bf[_0x840d('0x39')],{'$or':[{'ListId':_0xbe1e9e['id']},{'ListId':null}]});if(_0x3f6d8b['query']['filter']){_0x3b59bf[_0x840d('0x39')]=_[_0x840d('0x3b')](_0x3b59bf[_0x840d('0x39')],{'$or':_[_0x840d('0x3a')](_0x3b59bf[_0x840d('0x2e')],function(_0x6d8526){var _0x4f5dd8={};_0x4f5dd8[_0x6d8526]={'$like':'%'+_0x3f6d8b[_0x840d('0x2a')][_0x840d('0x38')]+'%'};return _0x4f5dd8;})});}_0x3b59bf=_['merge']({},_0x3b59bf,_0x3f6d8b[_0x840d('0x42')]);return db[_0x840d('0x5b')][_0x840d('0x76')](_0x3b59bf);}})[_0x840d('0x3c')](respondWithResult(_0x38710e,null))[_0x840d('0x43')](handleError(_0x38710e,null));};exports[_0x840d('0x77')]=function(_0x58fd1b,_0x9f74f8,_0x17f65d){return db[_0x840d('0x26')][_0x840d('0x45')]({'where':{'id':_0x58fd1b['params']['id']}})[_0x840d('0x3c')](handleEntityNotFound(_0x9f74f8,null))[_0x840d('0x3c')](function(_0x368d87){if(_0x368d87){return _0x368d87[_0x840d('0x77')](_0x58fd1b[_0x840d('0x44')][_0x840d('0x51')],_['omit'](_0x58fd1b[_0x840d('0x44')],[_0x840d('0x51'),'id'])||{})[_0x840d('0x78')](function(_0x265507){for(var _0x3730fa=0x0;_0x3730fa<_0x58fd1b[_0x840d('0x44')][_0x840d('0x51')]['length'];_0x3730fa+=0x1){socket[_0x840d('0x79')]('userCmList:save',{'UserId':_0x58fd1b['body'][_0x840d('0x51')][_0x3730fa],'CmListId':_0x58fd1b['params']['id']});}return _0x265507;});}})['then'](respondWithResult(_0x9f74f8,null))[_0x840d('0x43')](handleError(_0x9f74f8,null));};exports[_0x840d('0x7a')]=function(_0x4b3b27,_0x112c8d,_0x2a0106){var _0x41f3ea;return db[_0x840d('0x26')]['find']({'where':{'id':_0x4b3b27[_0x840d('0x46')]['id']}})[_0x840d('0x3c')](handleEntityNotFound(_0x112c8d,null))[_0x840d('0x3c')](function(_0x2d3b85){if(_0x2d3b85){return _0x2d3b85[_0x840d('0x7a')](_0x4b3b27[_0x840d('0x2a')]['ids'])[_0x840d('0x3c')](function(_0x25b683){if(_['isArray'](_0x4b3b27[_0x840d('0x2a')][_0x840d('0x51')])){for(var _0x257249=0x0;_0x257249<_0x4b3b27[_0x840d('0x2a')][_0x840d('0x51')]['length'];_0x257249+=0x1){socket['emit'](_0x840d('0x7b'),{'UserId':_0x4b3b27[_0x840d('0x2a')][_0x840d('0x51')][_0x257249],'CmListId':_0x4b3b27[_0x840d('0x46')]['id']});}}else{socket['emit'](_0x840d('0x7b'),{'UserId':_0x4b3b27['query']['ids'],'CmListId':_0x4b3b27['params']['id']});}});}})[_0x840d('0x3c')](respondWithStatusCode(_0x112c8d,null))[_0x840d('0x43')](handleError(_0x112c8d,null));};exports[_0x840d('0x7c')]=function(_0x14ec06,_0x113d77,_0x4175b9){var _0x2f634f={};var _0x370e71={};var _0x34f0f6;var _0x483a9b;return db[_0x840d('0x26')][_0x840d('0x4d')]({'where':{'id':_0x14ec06[_0x840d('0x46')]['id']}})[_0x840d('0x3c')](handleEntityNotFound(_0x113d77,null))[_0x840d('0x3c')](function(_0x58c163){if(_0x58c163){_0x34f0f6=_0x58c163;_0x370e71[_0x840d('0x28')]=_['keys'](db[_0x840d('0x7d')][_0x840d('0x27')]);_0x370e71[_0x840d('0x2a')]=_['keys'](_0x14ec06[_0x840d('0x2a')]);_0x370e71[_0x840d('0x2c')]=_['intersection'](_0x370e71[_0x840d('0x28')],_0x370e71[_0x840d('0x2a')]);_0x2f634f[_0x840d('0x2e')]=_[_0x840d('0x2d')](_0x370e71['model'],qs[_0x840d('0x2f')](_0x14ec06[_0x840d('0x2a')][_0x840d('0x2f')]));_0x2f634f['attributes']=_0x2f634f[_0x840d('0x2e')][_0x840d('0x30')]?_0x2f634f[_0x840d('0x2e')]:_0x370e71['model'];_0x2f634f['order']=qs[_0x840d('0x33')](_0x14ec06['query'][_0x840d('0x33')]);_0x2f634f['where']=qs['filters'](_[_0x840d('0x34')](_0x14ec06['query'],_0x370e71['filters']));if(_0x14ec06[_0x840d('0x2a')][_0x840d('0x38')]){_0x2f634f[_0x840d('0x39')]=_[_0x840d('0x3b')](_0x2f634f['where'],{'$or':_['map'](_0x2f634f[_0x840d('0x2e')],function(_0x4c4b79){var _0x5f1f07={};_0x5f1f07[_0x4c4b79]={'$like':'%'+_0x14ec06[_0x840d('0x2a')][_0x840d('0x38')]+'%'};return _0x5f1f07;})});}_0x2f634f=_[_0x840d('0x3b')]({},_0x2f634f,_0x14ec06[_0x840d('0x42')]);return _0x34f0f6[_0x840d('0x7c')](_0x2f634f);}})['then'](function(_0x25b82e){if(_0x25b82e){_0x483a9b=_0x25b82e[_0x840d('0x30')];if(!_0x14ec06[_0x840d('0x2a')][_0x840d('0x31')]('nolimit')){_0x2f634f[_0x840d('0x1b')]=qs[_0x840d('0x1b')](_0x14ec06['query'][_0x840d('0x1b')]);_0x2f634f[_0x840d('0x1a')]=qs[_0x840d('0x1a')](_0x14ec06[_0x840d('0x2a')][_0x840d('0x1a')]);}return _0x34f0f6[_0x840d('0x7c')](_0x2f634f);}})[_0x840d('0x3c')](function(_0x3b5051){if(_0x3b5051){return _0x3b5051?{'count':_0x483a9b,'rows':_0x3b5051}:null;}})[_0x840d('0x3c')](respondWithResult(_0x113d77,null))[_0x840d('0x43')](handleError(_0x113d77,null));}; \ No newline at end of file +var _0xe228=['Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','addCustomField','sequelize','addCustomFields','TEXT','type','text','Sequelize','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','stack','name','send','CmList','rawAttributes','query','dateStart','dateEnd','filters','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','add','day','merge','where','filter','map','attributes','options','rows','catch','params','keys','includeAll','include','find','create','body','update','destroy','describe','addDisposition','ListId','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','tags','join','isArray','each','CmContact','omit','success','push','dataValues','errors'];(function(_0xbb8f3b,_0x53e75f){var _0x4e269a=function(_0x5623b4){while(--_0x5623b4){_0xbb8f3b['push'](_0xbb8f3b['shift']());}};_0x4e269a(++_0x53e75f);}(_0xe228,0xa7));var _0x8e22=function(_0x3a0aa7,_0x3cba01){_0x3a0aa7=_0x3a0aa7-0x0;var _0x23d491=_0xe228[_0x3a0aa7];return _0x23d491;};'use strict';var pdf=require(_0x8e22('0x0'));var emlformat=require(_0x8e22('0x1'));var rimraf=require(_0x8e22('0x2'));var zipdir=require(_0x8e22('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8e22('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8e22('0x5'));var util=require('util');var path=require(_0x8e22('0x6'));var sox=require(_0x8e22('0x7'));var csv=require(_0x8e22('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8e22('0x9'));var squel=require(_0x8e22('0xa'));var crypto=require('crypto');var jsforce=require(_0x8e22('0xb'));var deskjs=require(_0x8e22('0xc'));var toCsv=require(_0x8e22('0x8'));var querystring=require(_0x8e22('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var qs=require(_0x8e22('0xe'));var logger=require('../../config/logger')(_0x8e22('0xf'));var utils=require(_0x8e22('0x10'));var config=require(_0x8e22('0x11'));var db=require(_0x8e22('0x12'))['db'];config[_0x8e22('0x13')]=_[_0x8e22('0x14')](config[_0x8e22('0x13')],{'host':_0x8e22('0x15'),'port':0x18eb});var socket=require(_0x8e22('0x16'))(new Redis(config[_0x8e22('0x13')]));require(_0x8e22('0x17'))[_0x8e22('0x18')](socket);function respondWithStatusCode(_0x163b2d,_0x1a5add){_0x1a5add=_0x1a5add||0xcc;return function(_0x3c75ad){if(_0x3c75ad){return _0x163b2d[_0x8e22('0x19')](_0x1a5add);}return _0x163b2d[_0x8e22('0x1a')](_0x1a5add)[_0x8e22('0x1b')]();};}function respondWithResult(_0x194f3c,_0x361d96){_0x361d96=_0x361d96||0xc8;return function(_0x5525a7){if(_0x5525a7){return _0x194f3c[_0x8e22('0x1a')](_0x361d96)[_0x8e22('0x1c')](_0x5525a7);}};}function respondWithFilteredResult(_0x2f366a,_0x5e7ca4){return function(_0x262b74){if(_0x262b74){var _0x331968=_0x262b74[_0x8e22('0x1d')],_0x2949e0=_0x5e7ca4[_0x8e22('0x1e')],_0x51d65c=_0x5e7ca4[_0x8e22('0x1e')]+_0x5e7ca4[_0x8e22('0x1f')],_0x42029f;if(_0x51d65c>=_0x331968){_0x51d65c=_0x331968;_0x42029f=0xc8;}else{_0x42029f=0xce;}_0x2f366a[_0x8e22('0x1a')](_0x42029f);return _0x2f366a[_0x8e22('0x20')](_0x8e22('0x21'),_0x2949e0+'-'+_0x51d65c+'/'+_0x331968)[_0x8e22('0x1c')](_0x262b74);}return null;};}function patchUpdates(_0x4b47ad){return function(_0x24ea47){try{jsonpatch['apply'](_0x24ea47,_0x4b47ad,!![]);}catch(_0x9c0dca){return BPromise[_0x8e22('0x22')](_0x9c0dca);}return _0x24ea47[_0x8e22('0x23')]();};}function saveUpdates(_0x32d0e7,_0x1ba814){return function(_0x571d1b){if(_0x571d1b){return _0x571d1b['update'](_0x32d0e7)[_0x8e22('0x24')](function(_0x437245){return _0x437245;});}return null;};}function removeEntity(_0xd9f33c,_0x106447){return function(_0x1ee46e){if(_0x1ee46e){return _0x1ee46e['destroy']()[_0x8e22('0x24')](function(){_0xd9f33c['status'](0xcc)[_0x8e22('0x1b')]();});}};}function handleEntityNotFound(_0x238c4a,_0x29fa72){return function(_0x267226){if(!_0x267226){_0x238c4a[_0x8e22('0x19')](0x194);}return _0x267226;};}function handleError(_0x3cfeb2,_0x5c1399){_0x5c1399=_0x5c1399||0x1f4;return function(_0x2502d9){logger['error'](_0x2502d9[_0x8e22('0x25')]);if(_0x2502d9[_0x8e22('0x26')]){delete _0x2502d9[_0x8e22('0x26')];}_0x3cfeb2['status'](_0x5c1399)[_0x8e22('0x27')](_0x2502d9);};}exports['index']=function(_0x9c3c6a,_0x20fd1c){var _0x58728f={},_0xdd7db9={},_0x9fd350={'count':0x0,'rows':[]};var _0x50c96f=db[_0x8e22('0x28')][_0x8e22('0x29')];_0xdd7db9['model']=_['keys'](_0x50c96f);var _0x135c1f={'dateStart':_0x9c3c6a[_0x8e22('0x2a')][_0x8e22('0x2b')],'dateEnd':_0x9c3c6a[_0x8e22('0x2a')][_0x8e22('0x2c')]};delete _0x9c3c6a[_0x8e22('0x2a')][_0x8e22('0x2b')];delete _0x9c3c6a[_0x8e22('0x2a')][_0x8e22('0x2c')];_0xdd7db9[_0x8e22('0x2a')]=_['keys'](_0x9c3c6a[_0x8e22('0x2a')]);_0xdd7db9[_0x8e22('0x2d')]=_[_0x8e22('0x2e')](_0xdd7db9[_0x8e22('0x2f')],_0xdd7db9[_0x8e22('0x2a')]);_0x58728f['attributes']=_[_0x8e22('0x2e')](_0xdd7db9[_0x8e22('0x2f')],qs['fields'](_0x9c3c6a[_0x8e22('0x2a')][_0x8e22('0x30')]));_0x58728f['attributes']=_0x58728f['attributes'][_0x8e22('0x31')]?_0x58728f['attributes']:_0xdd7db9[_0x8e22('0x2f')];if(!_0x9c3c6a[_0x8e22('0x2a')][_0x8e22('0x32')](_0x8e22('0x33'))){_0x58728f[_0x8e22('0x1f')]=qs[_0x8e22('0x1f')](_0x9c3c6a['query'][_0x8e22('0x1f')]);_0x58728f[_0x8e22('0x1e')]=qs[_0x8e22('0x1e')](_0x9c3c6a[_0x8e22('0x2a')][_0x8e22('0x1e')]);}_0x58728f[_0x8e22('0x34')]=qs[_0x8e22('0x35')](_0x9c3c6a['query'][_0x8e22('0x35')]);_0x58728f['where']=qs[_0x8e22('0x2d')](_[_0x8e22('0x36')](_0x9c3c6a[_0x8e22('0x2a')],_0xdd7db9['filters']));if(_0x135c1f['dateStart']){if(_0x135c1f[_0x8e22('0x2c')]){_0x135c1f[_0x8e22('0x2c')]=moment(_0x135c1f[_0x8e22('0x2c')])[_0x8e22('0x37')](0x1,'day');}else{_0x135c1f[_0x8e22('0x2c')]=moment(_0x135c1f[_0x8e22('0x2b')])[_0x8e22('0x37')](0x1,_0x8e22('0x38'));}_[_0x8e22('0x39')](_0x58728f[_0x8e22('0x3a')],{'createdAt':{'$gte':_0x135c1f[_0x8e22('0x2b')],'$lte':_0x135c1f[_0x8e22('0x2c')]}});}if(_0x9c3c6a[_0x8e22('0x2a')][_0x8e22('0x3b')]){_0x58728f[_0x8e22('0x3a')]=_['merge'](_0x58728f['where'],{'$or':_[_0x8e22('0x3c')](_0x58728f[_0x8e22('0x3d')],function(_0x175ff5){var _0x358e32={};_0x358e32[_0x175ff5]={'$like':'%'+_0x9c3c6a[_0x8e22('0x2a')][_0x8e22('0x3b')]+'%'};return _0x358e32;})});}_0x58728f=_[_0x8e22('0x39')]({},_0x58728f,_0x9c3c6a[_0x8e22('0x3e')]);var _0x2b24ef={'where':_0x58728f[_0x8e22('0x3a')]};return db[_0x8e22('0x28')][_0x8e22('0x1d')](_0x2b24ef)['then'](function(_0x4b7501){_0x9fd350[_0x8e22('0x1d')]=_0x4b7501;if(_0x9c3c6a['query']['includeAll']){_0x58728f['include']=[{'all':!![]}];}return db[_0x8e22('0x28')]['findAll'](_0x58728f);})[_0x8e22('0x24')](function(_0x44d646){_0x9fd350[_0x8e22('0x3f')]=_0x44d646;return _0x9fd350;})[_0x8e22('0x24')](respondWithFilteredResult(_0x20fd1c,_0x58728f))[_0x8e22('0x40')](handleError(_0x20fd1c,null));};exports['show']=function(_0x1c499b,_0x1cc5f5){var _0xc68894={'raw':![],'where':{'id':_0x1c499b[_0x8e22('0x41')]['id']}},_0x45129f={};_0x45129f['model']=_['keys'](db['CmList']['rawAttributes']);_0x45129f[_0x8e22('0x2a')]=_[_0x8e22('0x42')](_0x1c499b['query']);_0x45129f[_0x8e22('0x2d')]=_['intersection'](_0x45129f['model'],_0x45129f[_0x8e22('0x2a')]);_0xc68894[_0x8e22('0x3d')]=_[_0x8e22('0x2e')](_0x45129f['model'],qs[_0x8e22('0x30')](_0x1c499b[_0x8e22('0x2a')][_0x8e22('0x30')]));_0xc68894['attributes']=_0xc68894[_0x8e22('0x3d')][_0x8e22('0x31')]?_0xc68894[_0x8e22('0x3d')]:_0x45129f[_0x8e22('0x2f')];if(_0x1c499b[_0x8e22('0x2a')][_0x8e22('0x43')]){_0xc68894[_0x8e22('0x44')]=[{'all':!![]}];}_0xc68894=_[_0x8e22('0x39')]({},_0xc68894,_0x1c499b[_0x8e22('0x3e')]);return db[_0x8e22('0x28')][_0x8e22('0x45')](_0xc68894)[_0x8e22('0x24')](handleEntityNotFound(_0x1cc5f5,null))[_0x8e22('0x24')](respondWithResult(_0x1cc5f5,null))[_0x8e22('0x40')](handleError(_0x1cc5f5,null));};exports[_0x8e22('0x46')]=function(_0x19e0ac,_0x2f013a){return db[_0x8e22('0x28')][_0x8e22('0x46')](_0x19e0ac[_0x8e22('0x47')],{})['then'](respondWithResult(_0x2f013a,0xc9))[_0x8e22('0x40')](handleError(_0x2f013a,null));};exports[_0x8e22('0x48')]=function(_0x3dfdff,_0x479995){if(_0x3dfdff['body']['id']){delete _0x3dfdff[_0x8e22('0x47')]['id'];}return db[_0x8e22('0x28')][_0x8e22('0x45')]({'where':{'id':_0x3dfdff['params']['id']}})[_0x8e22('0x24')](handleEntityNotFound(_0x479995,null))[_0x8e22('0x24')](saveUpdates(_0x3dfdff[_0x8e22('0x47')],null))[_0x8e22('0x24')](respondWithResult(_0x479995,null))[_0x8e22('0x40')](handleError(_0x479995,null));};exports[_0x8e22('0x49')]=function(_0xc098e7,_0x58e043){return db[_0x8e22('0x28')][_0x8e22('0x45')]({'where':{'id':_0xc098e7[_0x8e22('0x41')]['id']}})[_0x8e22('0x24')](handleEntityNotFound(_0x58e043,null))[_0x8e22('0x24')](removeEntity(_0x58e043,null))['catch'](handleError(_0x58e043,null));};exports[_0x8e22('0x4a')]=function(_0x3fdabd,_0x56fb1f){return db[_0x8e22('0x28')]['describe']()[_0x8e22('0x24')](respondWithResult(_0x56fb1f,null))[_0x8e22('0x40')](handleError(_0x56fb1f,null));};exports[_0x8e22('0x4b')]=function(_0x1f6608,_0x1acdd3,_0x7987ad){if(_0x1f6608[_0x8e22('0x47')]['id']){delete _0x1f6608[_0x8e22('0x47')]['id'];}return db['CmList'][_0x8e22('0x45')]({'where':{'id':_0x1f6608[_0x8e22('0x41')]['id']}})[_0x8e22('0x24')](handleEntityNotFound(_0x1acdd3,null))['then'](function(_0x5aec9d){if(_0x5aec9d){_0x1f6608[_0x8e22('0x47')][_0x8e22('0x4c')]=_0x5aec9d['id'];return db[_0x8e22('0x4d')][_0x8e22('0x46')](_0x1f6608[_0x8e22('0x47')]);}})[_0x8e22('0x24')](respondWithResult(_0x1acdd3,null))[_0x8e22('0x40')](handleError(_0x1acdd3,null));};exports[_0x8e22('0x4e')]=function(_0x1a79f6,_0x54489e,_0x5b9ba6){var _0x32f5ae={'raw':![],'where':{}};var _0x277b58={};var _0x4f79cf={'count':0x0,'rows':[]};return db['CmList'][_0x8e22('0x4f')]({'where':{'id':_0x1a79f6['params']['id']}})[_0x8e22('0x24')](handleEntityNotFound(_0x54489e,null))[_0x8e22('0x24')](function(_0x33981b){if(_0x33981b){_0x277b58['model']=_[_0x8e22('0x42')](db[_0x8e22('0x4d')]['rawAttributes']);_0x277b58['query']=_[_0x8e22('0x42')](_0x1a79f6[_0x8e22('0x2a')]);_0x277b58[_0x8e22('0x2d')]=_[_0x8e22('0x2e')](_0x277b58[_0x8e22('0x2f')],_0x277b58[_0x8e22('0x2a')]);_0x32f5ae[_0x8e22('0x3d')]=_[_0x8e22('0x2e')](_0x277b58[_0x8e22('0x2f')],qs[_0x8e22('0x30')](_0x1a79f6[_0x8e22('0x2a')][_0x8e22('0x30')]));_0x32f5ae[_0x8e22('0x3d')]=_0x32f5ae[_0x8e22('0x3d')]['length']?_0x32f5ae['attributes']:_0x277b58['model'];if(!_0x1a79f6[_0x8e22('0x2a')]['hasOwnProperty']('nolimit')){_0x32f5ae[_0x8e22('0x1f')]=qs[_0x8e22('0x1f')](_0x1a79f6[_0x8e22('0x2a')][_0x8e22('0x1f')]);_0x32f5ae['offset']=qs[_0x8e22('0x1e')](_0x1a79f6['query'][_0x8e22('0x1e')]);}_0x32f5ae[_0x8e22('0x34')]=qs['sort'](_0x1a79f6[_0x8e22('0x2a')]['sort']);_0x32f5ae[_0x8e22('0x3a')]=qs['filters'](_[_0x8e22('0x36')](_0x1a79f6[_0x8e22('0x2a')],_0x277b58[_0x8e22('0x2d')]));_0x32f5ae[_0x8e22('0x3a')]['ListId']=_0x33981b['id'];if(_0x1a79f6[_0x8e22('0x2a')][_0x8e22('0x3b')]){_0x32f5ae['where']=_['merge'](_0x32f5ae[_0x8e22('0x3a')],{'$or':_[_0x8e22('0x3c')](_0x32f5ae[_0x8e22('0x3d')],function(_0xf10a3e){var _0x3535d6={};_0x3535d6[_0xf10a3e]={'$like':'%'+_0x1a79f6['query'][_0x8e22('0x3b')]+'%'};return _0x3535d6;})});}_0x32f5ae=_[_0x8e22('0x39')]({},_0x32f5ae,_0x1a79f6[_0x8e22('0x3e')]);return db[_0x8e22('0x4d')][_0x8e22('0x1d')]({'where':_0x32f5ae[_0x8e22('0x3a')]})['then'](function(_0x26f5df){_0x4f79cf[_0x8e22('0x1d')]=_0x26f5df;if(_0x1a79f6[_0x8e22('0x2a')][_0x8e22('0x43')]){_0x32f5ae['include']=[{'all':!![]}];}return db['Disposition'][_0x8e22('0x50')](_0x32f5ae);})[_0x8e22('0x24')](function(_0x3346bc){_0x4f79cf[_0x8e22('0x3f')]=_0x3346bc;return _0x4f79cf;});}})[_0x8e22('0x24')](respondWithFilteredResult(_0x54489e,_0x32f5ae))['catch'](handleError(_0x54489e,null));};exports[_0x8e22('0x51')]=function(_0x502068,_0x3d06a6,_0xb28e7f){var _0x4605d7;return db[_0x8e22('0x28')][_0x8e22('0x45')]({'where':{'id':_0x502068[_0x8e22('0x41')]['id']}})['then'](handleEntityNotFound(_0x3d06a6,null))['then'](function(_0x5c79aa){if(_0x5c79aa){return _0x5c79aa['removeDispositions'](_0x502068[_0x8e22('0x2a')][_0x8e22('0x52')]);}})[_0x8e22('0x24')](respondWithStatusCode(_0x3d06a6,null))['catch'](handleError(_0x3d06a6,null));};exports['addContacts']=function(_0x789629,_0x45cd7f,_0xb9fc97){return db[_0x8e22('0x28')]['find']({'where':{'id':_0x789629[_0x8e22('0x41')]['id']}})[_0x8e22('0x24')](handleEntityNotFound(_0x45cd7f,null))[_0x8e22('0x24')](function(_0x2df53d){if(_0x2df53d){var _0x401264=[];var _0x544477={'success':[],'errors':[]};return db['CmContact']['describe']()['then'](function(_0x45fd37){if(_0x789629[_0x8e22('0x47')]['tags']&&_['isArray'](_0x789629[_0x8e22('0x47')][_0x8e22('0x53')])){if(_0x789629['body'][_0x8e22('0x53')][_0x8e22('0x31')]){_0x789629[_0x8e22('0x47')]['tags']=_0x789629['body'][_0x8e22('0x53')][_0x8e22('0x54')](';')+';';}else{_0x789629[_0x8e22('0x47')][_0x8e22('0x53')]=null;}}else{_0x789629[_0x8e22('0x47')][_0x8e22('0x53')]=null;}if(_0x789629[_0x8e22('0x47')]&&_[_0x8e22('0x55')](_0x789629[_0x8e22('0x47')])){for(var _0xe13848=0x0;_0xe13848<_0x789629['body'][_0x8e22('0x31')];_0xe13848+=0x1){_0x789629[_0x8e22('0x47')][_0xe13848][_0x8e22('0x4c')]=_0x789629[_0x8e22('0x41')]['id'];_0x401264['push'](_0x789629['body'][_0xe13848]);}return BPromise[_0x8e22('0x56')](_0x401264,function(_0x291cbd){return db[_0x8e22('0x57')][_0x8e22('0x46')](_[_0x8e22('0x58')](_0x291cbd,[_0x8e22('0x52'),'id'])||{},{'fields':_[_0x8e22('0x42')](_0x45fd37),'raw':!![]})[_0x8e22('0x24')](function(_0x55cf9a){_0x544477[_0x8e22('0x59')][_0x8e22('0x5a')](_0x55cf9a[_0x8e22('0x5b')]);})[_0x8e22('0x40')](function(_0x355559){_0x544477[_0x8e22('0x5c')][_0x8e22('0x5a')]({'data':_0x291cbd,'error':_0x355559['message']});});})[_0x8e22('0x24')](function(_0x49cbe5){return _0x544477;})[_0x8e22('0x40')](function(_0x290a2a){return _0x290a2a;});}else{_0x45cd7f[_0x8e22('0x1a')](0x190)[_0x8e22('0x1c')]({'message':_0x8e22('0x5d')});}});}})['then'](respondWithResult(_0x45cd7f,null))['catch'](handleError(_0x45cd7f,null));};exports[_0x8e22('0x5e')]=function(_0x30c9fd,_0x3fcc97,_0x2d24af){var _0x454e8b;return db[_0x8e22('0x28')][_0x8e22('0x45')]({'where':{'id':_0x30c9fd[_0x8e22('0x41')]['id']},'include':[{'model':db[_0x8e22('0x5f')],'as':_0x8e22('0x60')}]})[_0x8e22('0x24')](handleEntityNotFound(_0x3fcc97,null))[_0x8e22('0x24')](function(_0x5074cf){if(_0x5074cf){_0x454e8b=_0x5074cf;return db[_0x8e22('0x57')][_0x8e22('0x29')];}})[_0x8e22('0x24')](function(_0x31aa38){if(_0x31aa38){var _0x5ced00={};var _0xf8ce43={};_0xf8ce43['model']=_[_0x8e22('0x61')](_[_0x8e22('0x42')](_0x31aa38),_[_0x8e22('0x3c')](_0x454e8b[_0x8e22('0x60')],function(_0x56bfab){return util[_0x8e22('0x62')](_0x8e22('0x63'),_0x56bfab['id']);}));_0xf8ce43['query']=_['keys'](_0x30c9fd[_0x8e22('0x2a')]);_0xf8ce43['filters']=_[_0x8e22('0x2e')](_0xf8ce43[_0x8e22('0x2f')],_0xf8ce43['query']);_0x5ced00[_0x8e22('0x3d')]=_['intersection'](_0xf8ce43[_0x8e22('0x2f')],qs[_0x8e22('0x30')](_0x30c9fd[_0x8e22('0x2a')][_0x8e22('0x30')]));_0x5ced00[_0x8e22('0x3d')]=_0x5ced00[_0x8e22('0x3d')][_0x8e22('0x31')]?_0x5ced00[_0x8e22('0x3d')]:_0xf8ce43['model'];if(!_0x30c9fd['query']['hasOwnProperty'](_0x8e22('0x33'))){_0x5ced00['limit']=qs[_0x8e22('0x1f')](_0x30c9fd['query'][_0x8e22('0x1f')]);_0x5ced00[_0x8e22('0x1e')]=qs[_0x8e22('0x1e')](_0x30c9fd[_0x8e22('0x2a')][_0x8e22('0x1e')]);}_0x5ced00[_0x8e22('0x34')]=qs[_0x8e22('0x35')](_0x30c9fd['query'][_0x8e22('0x35')]);_0x5ced00[_0x8e22('0x3a')]=qs[_0x8e22('0x2d')](_[_0x8e22('0x36')](_0x30c9fd['query'],_0xf8ce43[_0x8e22('0x2d')]));_0x5ced00[_0x8e22('0x64')]=!![];if(_0x30c9fd[_0x8e22('0x2a')]['filter']){_0x5ced00[_0x8e22('0x3a')]=_[_0x8e22('0x39')](_0x5ced00['where'],{'$or':_['map'](_0x5ced00[_0x8e22('0x3d')],function(_0x1f6622){var _0x456c89={};_0x456c89[_0x1f6622]={'$like':'%'+_0x30c9fd['query']['filter']+'%'};return _0x456c89;})});}_0x5ced00=_['merge']({},_0x5ced00,_0x30c9fd[_0x8e22('0x3e')]);return _0x454e8b['getContacts'](_0x5ced00);}})['then'](respondWithResult(_0x3fcc97,null))[_0x8e22('0x40')](handleError(_0x3fcc97,null));};exports[_0x8e22('0x65')]=function(_0x52295c,_0x2ff8a6,_0x57af1f){var _0x226748;return db[_0x8e22('0x28')]['find']({'where':{'id':_0x52295c['params']['id']},'include':[{'model':db[_0x8e22('0x5f')],'as':_0x8e22('0x60')}]})['then'](handleEntityNotFound(_0x2ff8a6,null))[_0x8e22('0x24')](function(_0x5f6f39){if(_0x5f6f39){_0x226748=_0x5f6f39;return db[_0x8e22('0x57')]['rawAttributes'];}})[_0x8e22('0x24')](function(_0x2be6ef){if(_0x2be6ef){var _0xc6cfca={};var _0x5402f1={};_0x5402f1[_0x8e22('0x2f')]=_[_0x8e22('0x61')](_[_0x8e22('0x42')](_0x2be6ef),_[_0x8e22('0x3c')](_0x226748['CustomFields'],function(_0x4d2557){return util[_0x8e22('0x62')]('cf_%d',_0x4d2557['id']);}));_0x5402f1[_0x8e22('0x2a')]=_[_0x8e22('0x42')](_0x52295c[_0x8e22('0x2a')]);_0x5402f1[_0x8e22('0x2d')]=_[_0x8e22('0x2e')](_0x5402f1['model'],_0x5402f1[_0x8e22('0x2a')]);_0xc6cfca[_0x8e22('0x3d')]=_['intersection'](_0x5402f1['model'],qs[_0x8e22('0x30')](_0x52295c[_0x8e22('0x2a')][_0x8e22('0x30')]));_0xc6cfca[_0x8e22('0x3d')]=_0xc6cfca['attributes'][_0x8e22('0x31')]?_0xc6cfca[_0x8e22('0x3d')]:_0x5402f1[_0x8e22('0x2f')];if(!_0x52295c[_0x8e22('0x2a')]['hasOwnProperty'](_0x8e22('0x33'))){_0xc6cfca[_0x8e22('0x1f')]=qs[_0x8e22('0x1f')](_0x52295c[_0x8e22('0x2a')][_0x8e22('0x1f')]);_0xc6cfca[_0x8e22('0x1e')]=qs[_0x8e22('0x1e')](_0x52295c[_0x8e22('0x2a')][_0x8e22('0x1e')]);}_0xc6cfca[_0x8e22('0x34')]=qs['sort'](_0x52295c[_0x8e22('0x2a')][_0x8e22('0x35')]);_0xc6cfca[_0x8e22('0x3a')]=qs[_0x8e22('0x2d')](_[_0x8e22('0x36')](_0x52295c[_0x8e22('0x2a')],_0x5402f1[_0x8e22('0x2d')]));_0xc6cfca[_0x8e22('0x64')]=!![];if(_0x52295c[_0x8e22('0x2a')]['filter']){_0xc6cfca['where']=_[_0x8e22('0x39')](_0xc6cfca[_0x8e22('0x3a')],{'$or':_[_0x8e22('0x3c')](_0xc6cfca[_0x8e22('0x3d')],function(_0x2a0089){var _0x3988b1={};_0x3988b1[_0x2a0089]={'$like':'%'+_0x52295c[_0x8e22('0x2a')][_0x8e22('0x3b')]+'%'};return _0x3988b1;})});}_0xc6cfca=_['merge']({},_0xc6cfca,_0x52295c[_0x8e22('0x3e')]);return _0x226748['getContacts'](_0xc6cfca);}})['then'](function(_0x1fc817){if(!_[_0x8e22('0x66')](_0x1fc817)){var _0x42b093=toCsv(_0x1fc817);var _0x6bf027=Date[_0x8e22('0x67')]();fs[_0x8e22('0x68')](util[_0x8e22('0x62')](_0x8e22('0x69'),_0x226748['id'],_0x6bf027),_0x42b093);_0x2ff8a6[_0x8e22('0x6a')](_0x8e22('0x6b'),_0x8e22('0x6c')+util[_0x8e22('0x62')]('list_%d_%s.csv',_0x226748['id'],_0x6bf027));_0x2ff8a6[_0x8e22('0x6a')](_0x8e22('0x6d'),'text/csv');return _0x2ff8a6['download'](util[_0x8e22('0x62')](_0x8e22('0x69'),_0x226748['id'],_0x6bf027));}else{return _0x2ff8a6[_0x8e22('0x19')](0xcc);}})['catch'](handleError(_0x2ff8a6,null));};exports[_0x8e22('0x6e')]=function(_0x1ebceb,_0x2d7fb4,_0x259643){var _0x53f3af;delete _0x1ebceb[_0x8e22('0x47')]['id'];return db['CmList']['findOne']({'where':{'id':_0x1ebceb['params']['id']}})[_0x8e22('0x24')](handleEntityNotFound(_0x2d7fb4,null))[_0x8e22('0x24')](function(_0x53a2e9){if(_0x53a2e9){return db[_0x8e22('0x6f')]['transaction'](function(_0x35305a){return db[_0x8e22('0x5f')][_0x8e22('0x46')](_0x1ebceb['body'],{'transaction':_0x35305a})[_0x8e22('0x24')](function(_0xabf020){_0x53f3af=_0xabf020;return _0x53a2e9[_0x8e22('0x70')](_0xabf020,{'transaction':_0x35305a});})[_0x8e22('0x24')](function(){var _0xf23c20={'type':db['Sequelize'][_0x8e22('0x71')],'transaction':_0x35305a};switch(_0x1ebceb[_0x8e22('0x47')][_0x8e22('0x72')]){case _0x8e22('0x73'):_0xf23c20[_0x8e22('0x72')]=db[_0x8e22('0x74')][_0x8e22('0x71')];break;case'number':_0xf23c20[_0x8e22('0x72')]=db[_0x8e22('0x74')]['INTEGER'];break;case'switch':_0xf23c20[_0x8e22('0x72')]=db[_0x8e22('0x74')]['BOOLEAN'];_0xf23c20['defaultValue']=![];break;default:}return db[_0x8e22('0x6f')]['queryInterface'][_0x8e22('0x75')](_0x8e22('0x76'),util[_0x8e22('0x62')](_0x8e22('0x77'),_0x53f3af['id']),_0xf23c20);})[_0x8e22('0x24')](function(){return _0x53f3af;});});}})[_0x8e22('0x24')](respondWithResult(_0x2d7fb4,null))['catch'](handleError(_0x2d7fb4,null));};exports[_0x8e22('0x78')]=function(_0x182772,_0x19ae9b,_0x9417a6){var _0x5c2c00={};var _0x3b031e={};var _0x1d4262;var _0x209580;return db['CmList'][_0x8e22('0x4f')]({'where':{'id':_0x182772['params']['id']}})[_0x8e22('0x24')](handleEntityNotFound(_0x19ae9b,null))[_0x8e22('0x24')](function(_0x3d386c){if(_0x3d386c){_0x1d4262=_0x3d386c;_0x3b031e[_0x8e22('0x2f')]=_[_0x8e22('0x42')](db[_0x8e22('0x5f')][_0x8e22('0x29')]);_0x3b031e['query']=_['keys'](_0x182772['query']);_0x3b031e[_0x8e22('0x2d')]=_[_0x8e22('0x2e')](_0x3b031e[_0x8e22('0x2f')],_0x3b031e[_0x8e22('0x2a')]);_0x5c2c00[_0x8e22('0x3d')]=_[_0x8e22('0x2e')](_0x3b031e['model'],qs[_0x8e22('0x30')](_0x182772['query']['fields']));_0x5c2c00['attributes']=_0x5c2c00['attributes']['length']?_0x5c2c00['attributes']:_0x3b031e[_0x8e22('0x2f')];_0x5c2c00[_0x8e22('0x34')]=qs[_0x8e22('0x35')](_0x182772[_0x8e22('0x2a')]['sort']);_0x5c2c00[_0x8e22('0x3a')]=qs[_0x8e22('0x2d')](_['pick'](_0x182772[_0x8e22('0x2a')],_0x3b031e[_0x8e22('0x2d')]));_0x5c2c00[_0x8e22('0x3a')]=_[_0x8e22('0x39')](_0x5c2c00['where'],{'$or':[{'ListId':_0x3d386c['id']},{'ListId':null}]});if(_0x182772[_0x8e22('0x2a')][_0x8e22('0x3b')]){_0x5c2c00[_0x8e22('0x3a')]=_[_0x8e22('0x39')](_0x5c2c00[_0x8e22('0x3a')],{'$or':_[_0x8e22('0x3c')](_0x5c2c00[_0x8e22('0x3d')],function(_0x4217ef){var _0x212a3c={};_0x212a3c[_0x4217ef]={'$like':'%'+_0x182772[_0x8e22('0x2a')][_0x8e22('0x3b')]+'%'};return _0x212a3c;})});}_0x5c2c00=_[_0x8e22('0x39')]({},_0x5c2c00,_0x182772['options']);return db[_0x8e22('0x5f')][_0x8e22('0x79')](_0x5c2c00);}})[_0x8e22('0x24')](respondWithResult(_0x19ae9b,null))[_0x8e22('0x40')](handleError(_0x19ae9b,null));};exports[_0x8e22('0x7a')]=function(_0x2e15c0,_0x4d2295,_0xc19791){return db[_0x8e22('0x28')][_0x8e22('0x45')]({'where':{'id':_0x2e15c0['params']['id']}})[_0x8e22('0x24')](handleEntityNotFound(_0x4d2295,null))[_0x8e22('0x24')](function(_0x3aced4){if(_0x3aced4){return _0x3aced4[_0x8e22('0x7a')](_0x2e15c0[_0x8e22('0x47')][_0x8e22('0x52')],_[_0x8e22('0x58')](_0x2e15c0[_0x8e22('0x47')],[_0x8e22('0x52'),'id'])||{})[_0x8e22('0x7b')](function(_0x14253d){for(var _0x5cab7e=0x0;_0x5cab7e<_0x2e15c0[_0x8e22('0x47')][_0x8e22('0x52')][_0x8e22('0x31')];_0x5cab7e+=0x1){socket[_0x8e22('0x7c')](_0x8e22('0x7d'),{'UserId':_0x2e15c0[_0x8e22('0x47')][_0x8e22('0x52')][_0x5cab7e],'CmListId':_0x2e15c0['params']['id']});}return _0x14253d;});}})[_0x8e22('0x24')](respondWithResult(_0x4d2295,null))[_0x8e22('0x40')](handleError(_0x4d2295,null));};exports[_0x8e22('0x7e')]=function(_0x56d856,_0xb681ec,_0x4488c8){var _0x5dd886;return db[_0x8e22('0x28')][_0x8e22('0x45')]({'where':{'id':_0x56d856[_0x8e22('0x41')]['id']}})[_0x8e22('0x24')](handleEntityNotFound(_0xb681ec,null))['then'](function(_0x5558da){if(_0x5558da){return _0x5558da[_0x8e22('0x7e')](_0x56d856[_0x8e22('0x2a')][_0x8e22('0x52')])[_0x8e22('0x24')](function(_0x4dfb29){if(_[_0x8e22('0x55')](_0x56d856[_0x8e22('0x2a')][_0x8e22('0x52')])){for(var _0x5eef00=0x0;_0x5eef00<_0x56d856[_0x8e22('0x2a')][_0x8e22('0x52')]['length'];_0x5eef00+=0x1){socket[_0x8e22('0x7c')](_0x8e22('0x7f'),{'UserId':_0x56d856[_0x8e22('0x2a')][_0x8e22('0x52')][_0x5eef00],'CmListId':_0x56d856[_0x8e22('0x41')]['id']});}}else{socket[_0x8e22('0x7c')](_0x8e22('0x7f'),{'UserId':_0x56d856[_0x8e22('0x2a')][_0x8e22('0x52')],'CmListId':_0x56d856[_0x8e22('0x41')]['id']});}});}})[_0x8e22('0x24')](respondWithStatusCode(_0xb681ec,null))[_0x8e22('0x40')](handleError(_0xb681ec,null));};exports[_0x8e22('0x80')]=function(_0x4be5c6,_0x3a6022,_0x5d4b6b){var _0x4691b8={};var _0x3b739b={};var _0x516bcb;var _0x4cfa38;return db[_0x8e22('0x28')][_0x8e22('0x4f')]({'where':{'id':_0x4be5c6['params']['id']}})[_0x8e22('0x24')](handleEntityNotFound(_0x3a6022,null))['then'](function(_0x110875){if(_0x110875){_0x516bcb=_0x110875;_0x3b739b[_0x8e22('0x2f')]=_[_0x8e22('0x42')](db[_0x8e22('0x81')][_0x8e22('0x29')]);_0x3b739b[_0x8e22('0x2a')]=_['keys'](_0x4be5c6[_0x8e22('0x2a')]);_0x3b739b['filters']=_[_0x8e22('0x2e')](_0x3b739b[_0x8e22('0x2f')],_0x3b739b['query']);_0x4691b8[_0x8e22('0x3d')]=_['intersection'](_0x3b739b[_0x8e22('0x2f')],qs[_0x8e22('0x30')](_0x4be5c6[_0x8e22('0x2a')][_0x8e22('0x30')]));_0x4691b8['attributes']=_0x4691b8[_0x8e22('0x3d')][_0x8e22('0x31')]?_0x4691b8[_0x8e22('0x3d')]:_0x3b739b[_0x8e22('0x2f')];_0x4691b8['order']=qs['sort'](_0x4be5c6[_0x8e22('0x2a')][_0x8e22('0x35')]);_0x4691b8[_0x8e22('0x3a')]=qs[_0x8e22('0x2d')](_[_0x8e22('0x36')](_0x4be5c6[_0x8e22('0x2a')],_0x3b739b[_0x8e22('0x2d')]));if(_0x4be5c6[_0x8e22('0x2a')][_0x8e22('0x3b')]){_0x4691b8[_0x8e22('0x3a')]=_[_0x8e22('0x39')](_0x4691b8[_0x8e22('0x3a')],{'$or':_['map'](_0x4691b8[_0x8e22('0x3d')],function(_0x21f625){var _0x2c037f={};_0x2c037f[_0x21f625]={'$like':'%'+_0x4be5c6[_0x8e22('0x2a')][_0x8e22('0x3b')]+'%'};return _0x2c037f;})});}_0x4691b8=_['merge']({},_0x4691b8,_0x4be5c6['options']);return _0x516bcb[_0x8e22('0x80')](_0x4691b8);}})['then'](function(_0x4ec829){if(_0x4ec829){_0x4cfa38=_0x4ec829[_0x8e22('0x31')];if(!_0x4be5c6[_0x8e22('0x2a')]['hasOwnProperty'](_0x8e22('0x33'))){_0x4691b8[_0x8e22('0x1f')]=qs[_0x8e22('0x1f')](_0x4be5c6[_0x8e22('0x2a')]['limit']);_0x4691b8['offset']=qs[_0x8e22('0x1e')](_0x4be5c6['query']['offset']);}return _0x516bcb[_0x8e22('0x80')](_0x4691b8);}})[_0x8e22('0x24')](function(_0x5c1df6){if(_0x5c1df6){return _0x5c1df6?{'count':_0x4cfa38,'rows':_0x5c1df6}:null;}})[_0x8e22('0x24')](respondWithResult(_0x3a6022,null))['catch'](handleError(_0x3a6022,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 0287015..698e2ed 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 _0xb78c=['hasOwnProperty','hook','exports','events','../../mysqldb','CmList','save','update','remove','emit'];(function(_0x3e4a0c,_0x49faa6){var _0x5dbebf=function(_0x53b41f){while(--_0x53b41f){_0x3e4a0c['push'](_0x3e4a0c['shift']());}};_0x5dbebf(++_0x49faa6);}(_0xb78c,0x125));var _0xcb78=function(_0x435044,_0x36ab8e){_0x435044=_0x435044-0x0;var _0x33d4c6=_0xb78c[_0x435044];return _0x33d4c6;};'use strict';var EventEmitter=require(_0xcb78('0x0'));var CmList=require(_0xcb78('0x1'))['db'][_0xcb78('0x2')];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcb78('0x3'),'afterUpdate':_0xcb78('0x4'),'afterDestroy':_0xcb78('0x5')};function emitEvent(_0x1840cf){return function(_0x4f3ef0,_0x2f4231,_0xe8f3b2){CmListEvents[_0xcb78('0x6')](_0x1840cf+':'+_0x4f3ef0['id'],_0x4f3ef0);CmListEvents[_0xcb78('0x6')](_0x1840cf,_0x4f3ef0);_0xe8f3b2(null);};}for(var e in events){if(events[_0xcb78('0x7')](e)){var event=events[e];CmList[_0xcb78('0x8')](e,emitEvent(event));}}module[_0xcb78('0x9')]=CmListEvents; \ No newline at end of file +var _0x5916=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList','setMaxListeners'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5916,0x134));var _0x6591=function(_0x42df00,_0x66b867){_0x42df00=_0x42df00-0x0;var _0x42a97f=_0x5916[_0x42df00];return _0x42a97f;};'use strict';var EventEmitter=require(_0x6591('0x0'));var CmList=require(_0x6591('0x1'))['db'][_0x6591('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x6591('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4cd108){return function(_0x3d498b,_0x30cec2,_0x67ec20){CmListEvents['emit'](_0x4cd108+':'+_0x3d498b['id'],_0x3d498b);CmListEvents[_0x6591('0x4')](_0x4cd108,_0x3d498b);_0x67ec20(null);};}for(var e in events){if(events[_0x6591('0x5')](e)){var event=events[e];CmList[_0x6591('0x6')](e,emitEvent(event));}}module[_0x6591('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index affc788..9659a17 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 _0xe23d=['moment','request-promise','./cmList.attributes','exports','define','CmList','lodash','util','../../config/logger','api'];(function(_0x3adefa,_0x21b9e0){var _0x5d3132=function(_0x44fec4){while(--_0x44fec4){_0x3adefa['push'](_0x3adefa['shift']());}};_0x5d3132(++_0x21b9e0);}(_0xe23d,0x100));var _0xde23=function(_0x52356d,_0x4a0307){_0x52356d=_0x52356d-0x0;var _0x298480=_0xe23d[_0x52356d];return _0x298480;};'use strict';var _=require(_0xde23('0x0'));var util=require(_0xde23('0x1'));var logger=require(_0xde23('0x2'))(_0xde23('0x3'));var moment=require(_0xde23('0x4'));var BPromise=require('bluebird');var rp=require(_0xde23('0x5'));var attributes=require(_0xde23('0x6'));module[_0xde23('0x7')]=function(_0x54ad02,_0x5756cb){return _0x54ad02[_0xde23('0x8')](_0xde23('0x9'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5616=['request-promise','./cmList.attributes','define','CmList','cm_lists','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0x5616,0x7e));var _0x6561=function(_0x251421,_0x34bf49){_0x251421=_0x251421-0x0;var _0xe9bbff=_0x5616[_0x251421];return _0xe9bbff;};'use strict';var _=require(_0x6561('0x0'));var util=require(_0x6561('0x1'));var logger=require(_0x6561('0x2'))(_0x6561('0x3'));var moment=require(_0x6561('0x4'));var BPromise=require(_0x6561('0x5'));var rp=require(_0x6561('0x6'));var attributes=require(_0x6561('0x7'));module['exports']=function(_0x1476f7,_0x1879d1){return _0x1476f7[_0x6561('0x8')](_0x6561('0x9'),attributes,{'tableName':_0x6561('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 7eee29f..ec4d39d 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 _0x4a53=['then','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','register'];(function(_0x3a0968,_0x3bf2f9){var _0x47fe57=function(_0x30ff24){while(--_0x30ff24){_0x3a0968['push'](_0x3a0968['shift']());}};_0x47fe57(++_0x3bf2f9);}(_0x4a53,0x67));var _0x34a5=function(_0x4583f3,_0x3bcfd3){_0x4583f3=_0x4583f3-0x0;var _0x468eb6=_0x4a53[_0x4583f3];return _0x468eb6;};'use strict';var _=require('lodash');var util=require(_0x34a5('0x0'));var moment=require(_0x34a5('0x1'));var BPromise=require(_0x34a5('0x2'));var rs=require(_0x34a5('0x3'));var fs=require('fs');var Redis=require(_0x34a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x34a5('0x5'))(_0x34a5('0x6'));var config=require(_0x34a5('0x7'));var jayson=require(_0x34a5('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x34a5('0x9')],{'host':_0x34a5('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./cmList.socket')[_0x34a5('0xb')](socket);function respondWithRpcPromise(_0x4bb57a,_0x523ed2,_0x144943){return new BPromise(function(_0x5f745d,_0x34cf77){return client['request'](_0x4bb57a,_0x144943)[_0x34a5('0xc')](function(_0x52fc14){logger['info'](_0x34a5('0xd'),_0x523ed2,_0x34a5('0xe'));logger[_0x34a5('0xf')]('CmList,\x20%s,\x20%s,\x20%s',_0x523ed2,_0x34a5('0xe'),JSON[_0x34a5('0x10')](_0x52fc14));if(_0x52fc14['error']){if(_0x52fc14['error'][_0x34a5('0x11')]===0x1f4){logger[_0x34a5('0x12')](_0x34a5('0xd'),_0x523ed2,_0x52fc14[_0x34a5('0x12')][_0x34a5('0x13')]);return _0x34cf77(_0x52fc14['error']['message']);}logger[_0x34a5('0x12')]('CmList,\x20%s,\x20%s',_0x523ed2,_0x52fc14[_0x34a5('0x12')]['message']);return _0x5f745d(_0x52fc14[_0x34a5('0x12')]['message']);}else{logger[_0x34a5('0x14')](_0x34a5('0xd'),_0x523ed2,_0x34a5('0xe'));_0x5f745d(_0x52fc14[_0x34a5('0x15')][_0x34a5('0x13')]);}})[_0x34a5('0x16')](function(_0x267c3a){logger[_0x34a5('0x12')]('CmList,\x20%s,\x20%s',_0x523ed2,_0x267c3a);_0x34cf77(_0x267c3a);});});} \ No newline at end of file +var _0x347e=['http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','request','then','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x550fbe,_0x439dc1){var _0x582fe8=function(_0x376215){while(--_0x376215){_0x550fbe['push'](_0x550fbe['shift']());}};_0x582fe8(++_0x439dc1);}(_0x347e,0x1d3));var _0xe347=function(_0x3a54c1,_0x1b19a7){_0x3a54c1=_0x3a54c1-0x0;var _0x532e71=_0x347e[_0x3a54c1];return _0x532e71;};'use strict';var _=require(_0xe347('0x0'));var util=require(_0xe347('0x1'));var moment=require(_0xe347('0x2'));var BPromise=require(_0xe347('0x3'));var rs=require(_0xe347('0x4'));var fs=require('fs');var Redis=require(_0xe347('0x5'));var db=require(_0xe347('0x6'))['db'];var utils=require(_0xe347('0x7'));var logger=require(_0xe347('0x8'))(_0xe347('0x9'));var config=require(_0xe347('0xa'));var jayson=require(_0xe347('0xb'));var client=jayson[_0xe347('0xc')][_0xe347('0xd')]({'port':0x232a});config[_0xe347('0xe')]=_[_0xe347('0xf')](config[_0xe347('0xe')],{'host':_0xe347('0x10'),'port':0x18eb});var socket=require(_0xe347('0x11'))(new Redis(config['redis']));require(_0xe347('0x12'))['register'](socket);function respondWithRpcPromise(_0x30f9ac,_0x2b8d26,_0x4566b8){return new BPromise(function(_0x5e193a,_0x460ab3){return client[_0xe347('0x13')](_0x30f9ac,_0x4566b8)[_0xe347('0x14')](function(_0xac6544){logger['info'](_0xe347('0x15'),_0x2b8d26,'request\x20sent');logger[_0xe347('0x16')](_0xe347('0x17'),_0x2b8d26,'request\x20sent',JSON[_0xe347('0x18')](_0xac6544));if(_0xac6544[_0xe347('0x19')]){if(_0xac6544[_0xe347('0x19')][_0xe347('0x1a')]===0x1f4){logger[_0xe347('0x19')](_0xe347('0x15'),_0x2b8d26,_0xac6544[_0xe347('0x19')]['message']);return _0x460ab3(_0xac6544[_0xe347('0x19')]['message']);}logger[_0xe347('0x19')](_0xe347('0x15'),_0x2b8d26,_0xac6544[_0xe347('0x19')][_0xe347('0x1b')]);return _0x5e193a(_0xac6544[_0xe347('0x19')]['message']);}else{logger[_0xe347('0x1c')](_0xe347('0x15'),_0x2b8d26,_0xe347('0x1d'));_0x5e193a(_0xac6544[_0xe347('0x1e')][_0xe347('0x1b')]);}})[_0xe347('0x1f')](function(_0x51f3fc){logger['error']('CmList,\x20%s,\x20%s',_0x2b8d26,_0x51f3fc);_0x460ab3(_0x51f3fc);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 75d86f2..6ca9daa 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 _0xf1c5=['emit','removeListener','register','length','cmList:','./cmList.events','remove','update'];(function(_0x8c1005,_0x1f3f16){var _0x175354=function(_0xd0e9c4){while(--_0xd0e9c4){_0x8c1005['push'](_0x8c1005['shift']());}};_0x175354(++_0x1f3f16);}(_0xf1c5,0x6d));var _0x5f1c=function(_0x57ef93,_0x2cb41e){_0x57ef93=_0x57ef93-0x0;var _0x1c7696=_0xf1c5[_0x57ef93];return _0x1c7696;};'use strict';var CmListEvents=require(_0x5f1c('0x0'));var events=['save',_0x5f1c('0x1'),_0x5f1c('0x2')];function createListener(_0x326910,_0x578d5e){return function(_0x553429){_0x578d5e[_0x5f1c('0x3')](_0x326910,_0x553429);};}function removeListener(_0x4cb49c,_0xfa40fc){return function(){CmListEvents[_0x5f1c('0x4')](_0x4cb49c,_0xfa40fc);};}exports[_0x5f1c('0x5')]=function(_0xb7ac8b){for(var _0xbf2152=0x0,_0x23fd98=events[_0x5f1c('0x6')];_0xbf2152<_0x23fd98;_0xbf2152++){var _0x161294=events[_0xbf2152];var _0x3fdfba=createListener(_0x5f1c('0x7')+_0x161294,_0xb7ac8b);CmListEvents['on'](_0x161294,_0x3fdfba);}}; \ No newline at end of file +var _0xf8c3=['cmList:','./cmList.events','save','remove','emit','register'];(function(_0x3a93ae,_0x230320){var _0x57069a=function(_0x5ea047){while(--_0x5ea047){_0x3a93ae['push'](_0x3a93ae['shift']());}};_0x57069a(++_0x230320);}(_0xf8c3,0xcd));var _0x3f8c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf8c3[_0x3dd15e];return _0x231fd0;};'use strict';var CmListEvents=require(_0x3f8c('0x0'));var events=[_0x3f8c('0x1'),_0x3f8c('0x2'),'update'];function createListener(_0x851955,_0x7663ac){return function(_0x5e6bb5){_0x7663ac[_0x3f8c('0x3')](_0x851955,_0x5e6bb5);};}function removeListener(_0x4d8179,_0x18d381){return function(){CmListEvents['removeListener'](_0x4d8179,_0x18d381);};}exports[_0x3f8c('0x4')]=function(_0x8f88ec){for(var _0x21956d=0x0,_0x564ea1=events['length'];_0x21956d<_0x564ea1;_0x21956d++){var _0x424b92=events[_0x21956d];var _0x5ad2a3=createListener(_0x3f8c('0x5')+_0x424b92,_0x8f88ec);CmListEvents['on'](_0x424b92,_0x5ad2a3);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index ccddf25..28384ae 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 _0x7099=['isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','post','create','addDisposition','addContacts','addCustomField','/:id/users','addAgents','put','update','delete','destroy','removeAgents','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get'];(function(_0x84ce4d,_0x24c6d7){var _0x327d33=function(_0x5748f9){while(--_0x5748f9){_0x84ce4d['push'](_0x84ce4d['shift']());}};_0x327d33(++_0x24c6d7);}(_0x7099,0xf9));var _0x9709=function(_0x26c87d,_0x573652){_0x26c87d=_0x26c87d-0x0;var _0x37218d=_0x7099[_0x26c87d];return _0x37218d;};'use strict';var multer=require(_0x9709('0x0'));var util=require('util');var path=require(_0x9709('0x1'));var timeout=require(_0x9709('0x2'));var express=require(_0x9709('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x9709('0x4'));var config=require(_0x9709('0x5'));var controller=require('./cmList.controller');router[_0x9709('0x6')]('/',auth[_0x9709('0x7')](),controller[_0x9709('0x8')]);router[_0x9709('0x6')](_0x9709('0x9'),auth['isAuthenticated'](),controller[_0x9709('0xa')]);router[_0x9709('0x6')](_0x9709('0xb'),auth[_0x9709('0x7')](),controller[_0x9709('0xc')]);router['get'](_0x9709('0xd'),auth[_0x9709('0x7')](),controller[_0x9709('0xe')]);router[_0x9709('0x6')](_0x9709('0xf'),auth[_0x9709('0x7')](),controller[_0x9709('0x10')]);router[_0x9709('0x6')](_0x9709('0x11'),auth[_0x9709('0x7')](),controller['getContactsCsv']);router[_0x9709('0x6')](_0x9709('0x12'),auth[_0x9709('0x7')](),controller['getCustomFields']);router[_0x9709('0x6')]('/:id/users',auth[_0x9709('0x7')](),controller['getAgents']);router[_0x9709('0x13')]('/',auth['isAuthenticated'](),controller[_0x9709('0x14')]);router['post'](_0x9709('0xd'),auth['isAuthenticated'](),controller[_0x9709('0x15')]);router[_0x9709('0x13')]('/:id/contacts',auth[_0x9709('0x7')](),controller[_0x9709('0x16')]);router[_0x9709('0x13')]('/:id/fields',auth[_0x9709('0x7')](),controller[_0x9709('0x17')]);router['post'](_0x9709('0x18'),auth[_0x9709('0x7')](),controller[_0x9709('0x19')]);router[_0x9709('0x1a')](_0x9709('0xb'),auth[_0x9709('0x7')](),controller[_0x9709('0x1b')]);router[_0x9709('0x1c')](_0x9709('0xb'),auth[_0x9709('0x7')](),controller[_0x9709('0x1d')]);router[_0x9709('0x1c')]('/:id/dispositions',auth[_0x9709('0x7')](),controller['removeDispositions']);router['delete'](_0x9709('0x18'),auth[_0x9709('0x7')](),controller[_0x9709('0x1e')]);module[_0x9709('0x1f')]=router; \ No newline at end of file +var _0x7550=['./cmList.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','getAgents','create','post','addDisposition','addCustomField','/:id/users','addAgents','update','delete','destroy','removeDispositions','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2d45e9,_0x3713b2){var _0x13140a=function(_0x432e22){while(--_0x432e22){_0x2d45e9['push'](_0x2d45e9['shift']());}};_0x13140a(++_0x3713b2);}(_0x7550,0x158));var _0x0755=function(_0x3e4c06,_0x3ca07c){_0x3e4c06=_0x3e4c06-0x0;var _0x439df1=_0x7550[_0x3e4c06];return _0x439df1;};'use strict';var multer=require(_0x0755('0x0'));var util=require('util');var path=require(_0x0755('0x1'));var timeout=require(_0x0755('0x2'));var express=require(_0x0755('0x3'));var router=express[_0x0755('0x4')]();var auth=require(_0x0755('0x5'));var interaction=require(_0x0755('0x6'));var config=require(_0x0755('0x7'));var controller=require(_0x0755('0x8'));router[_0x0755('0x9')]('/',auth[_0x0755('0xa')](),controller[_0x0755('0xb')]);router[_0x0755('0x9')]('/describe',auth[_0x0755('0xa')](),controller[_0x0755('0xc')]);router['get'](_0x0755('0xd'),auth[_0x0755('0xa')](),controller[_0x0755('0xe')]);router['get'](_0x0755('0xf'),auth[_0x0755('0xa')](),controller['getDispositions']);router[_0x0755('0x9')](_0x0755('0x10'),auth[_0x0755('0xa')](),controller[_0x0755('0x11')]);router[_0x0755('0x9')](_0x0755('0x12'),auth[_0x0755('0xa')](),controller[_0x0755('0x13')]);router[_0x0755('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getCustomFields']);router[_0x0755('0x9')]('/:id/users',auth[_0x0755('0xa')](),controller[_0x0755('0x14')]);router['post']('/',auth[_0x0755('0xa')](),controller[_0x0755('0x15')]);router[_0x0755('0x16')](_0x0755('0xf'),auth[_0x0755('0xa')](),controller[_0x0755('0x17')]);router[_0x0755('0x16')](_0x0755('0x10'),auth[_0x0755('0xa')](),controller['addContacts']);router['post']('/:id/fields',auth['isAuthenticated'](),controller[_0x0755('0x18')]);router[_0x0755('0x16')](_0x0755('0x19'),auth[_0x0755('0xa')](),controller[_0x0755('0x1a')]);router['put'](_0x0755('0xd'),auth['isAuthenticated'](),controller[_0x0755('0x1b')]);router[_0x0755('0x1c')](_0x0755('0xd'),auth[_0x0755('0xa')](),controller[_0x0755('0x1d')]);router[_0x0755('0x1c')](_0x0755('0xf'),auth['isAuthenticated'](),controller[_0x0755('0x1e')]);router[_0x0755('0x1c')](_0x0755('0x19'),auth[_0x0755('0xa')](),controller['removeAgents']);module[_0x0755('0x1f')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 5c11801..ec65c66 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 _0x8c75=['field','STRING','exports','VIRTUAL','getDataValue'];(function(_0xe70ed5,_0x404aab){var _0x515cd9=function(_0x33a3d7){while(--_0x33a3d7){_0xe70ed5['push'](_0xe70ed5['shift']());}};_0x515cd9(++_0x404aab);}(_0x8c75,0x19c));var _0x58c7=function(_0x5a4c8c,_0x2b6cc7){_0x5a4c8c=_0x5a4c8c-0x0;var _0x51fd2c=_0x8c75[_0x5a4c8c];return _0x51fd2c;};'use strict';var Sequelize=require('sequelize');module[_0x58c7('0x0')]={'name':{'type':Sequelize[_0x58c7('0x1')],'get':function(_0x1aac3a){return this[_0x58c7('0x2')](_0x58c7('0x3'));}},'field':{'type':Sequelize[_0x58c7('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x58c7('0x4')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xbc70=['getDataValue','field','STRING','sequelize','VIRTUAL'];(function(_0x5a9ecd,_0xe1e62a){var _0x3e509c=function(_0x464c8a){while(--_0x464c8a){_0x5a9ecd['push'](_0x5a9ecd['shift']());}};_0x3e509c(++_0xe1e62a);}(_0xbc70,0xb2));var _0x0bc7=function(_0x3abbe8,_0x4200fc){_0x3abbe8=_0x3abbe8-0x0;var _0x32a1d2=_0xbc70[_0x3abbe8];return _0x32a1d2;};'use strict';var Sequelize=require(_0x0bc7('0x0'));module['exports']={'name':{'type':Sequelize[_0x0bc7('0x1')],'get':function(_0x15f6f3){return this[_0x0bc7('0x2')](_0x0bc7('0x3'));}},'field':{'type':Sequelize[_0x0bc7('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x0bc7('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0bc7('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 35c0691..354eaf5 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 _0xbe49=['../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','set','apply','reject','update','destroy','then','sendStatus','name','send','body','Condition','find','params','catch','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis'];(function(_0x5ed45d,_0xf5bf8){var _0x3317ce=function(_0x687f42){while(--_0x687f42){_0x5ed45d['push'](_0x5ed45d['shift']());}};_0x3317ce(++_0xf5bf8);}(_0xbe49,0x66));var _0x9be4=function(_0xf7cc8c,_0x1b2a26){_0xf7cc8c=_0xf7cc8c-0x0;var _0x5630d1=_0xbe49[_0xf7cc8c];return _0x5630d1;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9be4('0x0'));var zipdir=require(_0x9be4('0x1'));var jsonpatch=require(_0x9be4('0x2'));var rp=require('request-promise');var moment=require(_0x9be4('0x3'));var BPromise=require(_0x9be4('0x4'));var Mustache=require(_0x9be4('0x5'));var util=require(_0x9be4('0x6'));var path=require('path');var sox=require(_0x9be4('0x7'));var csv=require(_0x9be4('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9be4('0x9'));var squel=require(_0x9be4('0xa'));var crypto=require(_0x9be4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9be4('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9be4('0xd'));var Papa=require('papaparse');var Redis=require(_0x9be4('0xe'));var qs=require(_0x9be4('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x9be4('0x10'));var config=require(_0x9be4('0x11'));var db=require(_0x9be4('0x12'))['db'];function respondWithStatusCode(_0x4e94ad,_0x4ea7f2){_0x4ea7f2=_0x4ea7f2||0xcc;return function(_0x450dea){if(_0x450dea){return _0x4e94ad['sendStatus'](_0x4ea7f2);}return _0x4e94ad['status'](_0x4ea7f2)[_0x9be4('0x13')]();};}function respondWithResult(_0x405627,_0x19d4d8){_0x19d4d8=_0x19d4d8||0xc8;return function(_0x1a2005){if(_0x1a2005){return _0x405627[_0x9be4('0x14')](_0x19d4d8)[_0x9be4('0x15')](_0x1a2005);}};}function respondWithFilteredResult(_0x138e37,_0x442e86){return function(_0x466edd){if(_0x466edd){var _0x364734=_0x466edd[_0x9be4('0x16')],_0xebb9c=_0x442e86[_0x9be4('0x17')],_0x3cdd0d=_0x442e86[_0x9be4('0x17')]+_0x442e86[_0x9be4('0x18')],_0x4ff5ba;if(_0x3cdd0d>=_0x364734){_0x3cdd0d=_0x364734;_0x4ff5ba=0xc8;}else{_0x4ff5ba=0xce;}_0x138e37[_0x9be4('0x14')](_0x4ff5ba);return _0x138e37[_0x9be4('0x19')]('Content-Range',_0xebb9c+'-'+_0x3cdd0d+'/'+_0x364734)[_0x9be4('0x15')](_0x466edd);}return null;};}function patchUpdates(_0x46f76b){return function(_0x3a2b55){try{jsonpatch[_0x9be4('0x1a')](_0x3a2b55,_0x46f76b,!![]);}catch(_0x33d974){return BPromise[_0x9be4('0x1b')](_0x33d974);}return _0x3a2b55['save']();};}function saveUpdates(_0x5e1de7,_0x53678b){return function(_0x4ee83b){if(_0x4ee83b){return _0x4ee83b[_0x9be4('0x1c')](_0x5e1de7)['then'](function(_0x4d1495){return _0x4d1495;});}return null;};}function removeEntity(_0x3a25af,_0x3e541e){return function(_0x56a6c0){if(_0x56a6c0){return _0x56a6c0[_0x9be4('0x1d')]()[_0x9be4('0x1e')](function(){_0x3a25af[_0x9be4('0x14')](0xcc)[_0x9be4('0x13')]();});}};}function handleEntityNotFound(_0x1cad6d,_0x3b7195){return function(_0x5b9a65){if(!_0x5b9a65){_0x1cad6d[_0x9be4('0x1f')](0x194);}return _0x5b9a65;};}function handleError(_0x22bc1e,_0x28d6ba){_0x28d6ba=_0x28d6ba||0x1f4;return function(_0x58ef4c){logger['error'](_0x58ef4c['stack']);if(_0x58ef4c[_0x9be4('0x20')]){delete _0x58ef4c[_0x9be4('0x20')];}_0x22bc1e['status'](_0x28d6ba)[_0x9be4('0x21')](_0x58ef4c);};}exports[_0x9be4('0x1c')]=function(_0x5e69e9,_0x5b9493){if(_0x5e69e9[_0x9be4('0x22')]['id']){delete _0x5e69e9['body']['id'];}return db[_0x9be4('0x23')][_0x9be4('0x24')]({'where':{'id':_0x5e69e9[_0x9be4('0x25')]['id']}})['then'](handleEntityNotFound(_0x5b9493,null))['then'](saveUpdates(_0x5e69e9['body'],null))['then'](respondWithResult(_0x5b9493,null))[_0x9be4('0x26')](handleError(_0x5b9493,null));};exports[_0x9be4('0x1d')]=function(_0x3e6745,_0x707031){return db['Condition'][_0x9be4('0x24')]({'where':{'id':_0x3e6745[_0x9be4('0x25')]['id']}})[_0x9be4('0x1e')](handleEntityNotFound(_0x707031,null))[_0x9be4('0x1e')](removeEntity(_0x707031,null))[_0x9be4('0x26')](handleError(_0x707031,null));}; \ No newline at end of file +var _0x8450=['stack','name','send','body','params','catch','Condition','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','apply','reject','update','destroy','then','error'];(function(_0x313c96,_0x3cee6e){var _0x522f53=function(_0x8961e){while(--_0x8961e){_0x313c96['push'](_0x313c96['shift']());}};_0x522f53(++_0x3cee6e);}(_0x8450,0x86));var _0x0845=function(_0xeab6f1,_0x441142){_0xeab6f1=_0xeab6f1-0x0;var _0xcc956=_0x8450[_0xeab6f1];return _0xcc956;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0845('0x0'));var rimraf=require(_0x0845('0x1'));var zipdir=require(_0x0845('0x2'));var jsonpatch=require(_0x0845('0x3'));var rp=require(_0x0845('0x4'));var moment=require(_0x0845('0x5'));var BPromise=require(_0x0845('0x6'));var Mustache=require(_0x0845('0x7'));var util=require('util');var path=require('path');var sox=require(_0x0845('0x8'));var csv=require(_0x0845('0x9'));var ejs=require(_0x0845('0xa'));var fs=require('fs');var _=require(_0x0845('0xb'));var squel=require(_0x0845('0xc'));var crypto=require('crypto');var jsforce=require(_0x0845('0xd'));var deskjs=require(_0x0845('0xe'));var toCsv=require(_0x0845('0x9'));var querystring=require('querystring');var Papa=require(_0x0845('0xf'));var Redis=require(_0x0845('0x10'));var qs=require(_0x0845('0x11'));var logger=require('../../config/logger')(_0x0845('0x12'));var utils=require(_0x0845('0x13'));var config=require(_0x0845('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x103c49,_0x5bc21c){_0x5bc21c=_0x5bc21c||0xcc;return function(_0x451ec9){if(_0x451ec9){return _0x103c49[_0x0845('0x15')](_0x5bc21c);}return _0x103c49[_0x0845('0x16')](_0x5bc21c)[_0x0845('0x17')]();};}function respondWithResult(_0x53a6f2,_0x3134c0){_0x3134c0=_0x3134c0||0xc8;return function(_0x454945){if(_0x454945){return _0x53a6f2[_0x0845('0x16')](_0x3134c0)[_0x0845('0x18')](_0x454945);}};}function respondWithFilteredResult(_0x52442f,_0x28c3e7){return function(_0x2b3eaf){if(_0x2b3eaf){var _0x890879=_0x2b3eaf[_0x0845('0x19')],_0x48abb1=_0x28c3e7[_0x0845('0x1a')],_0xbd945=_0x28c3e7[_0x0845('0x1a')]+_0x28c3e7[_0x0845('0x1b')],_0x204a2a;if(_0xbd945>=_0x890879){_0xbd945=_0x890879;_0x204a2a=0xc8;}else{_0x204a2a=0xce;}_0x52442f['status'](_0x204a2a);return _0x52442f['set']('Content-Range',_0x48abb1+'-'+_0xbd945+'/'+_0x890879)[_0x0845('0x18')](_0x2b3eaf);}return null;};}function patchUpdates(_0x4ce121){return function(_0x5300bd){try{jsonpatch[_0x0845('0x1c')](_0x5300bd,_0x4ce121,!![]);}catch(_0x537328){return BPromise[_0x0845('0x1d')](_0x537328);}return _0x5300bd['save']();};}function saveUpdates(_0x43cf5c,_0xb2e929){return function(_0x11cc37){if(_0x11cc37){return _0x11cc37[_0x0845('0x1e')](_0x43cf5c)['then'](function(_0xb6c092){return _0xb6c092;});}return null;};}function removeEntity(_0x328102,_0x37fcdc){return function(_0x3c4efe){if(_0x3c4efe){return _0x3c4efe[_0x0845('0x1f')]()[_0x0845('0x20')](function(){_0x328102[_0x0845('0x16')](0xcc)[_0x0845('0x17')]();});}};}function handleEntityNotFound(_0x250590,_0xeab951){return function(_0x420c20){if(!_0x420c20){_0x250590[_0x0845('0x15')](0x194);}return _0x420c20;};}function handleError(_0x53c0fc,_0x27aa51){_0x27aa51=_0x27aa51||0x1f4;return function(_0x52fdb0){logger[_0x0845('0x21')](_0x52fdb0[_0x0845('0x22')]);if(_0x52fdb0[_0x0845('0x23')]){delete _0x52fdb0[_0x0845('0x23')];}_0x53c0fc[_0x0845('0x16')](_0x27aa51)[_0x0845('0x24')](_0x52fdb0);};}exports[_0x0845('0x1e')]=function(_0x23dff8,_0x4d5d1d){if(_0x23dff8[_0x0845('0x25')]['id']){delete _0x23dff8[_0x0845('0x25')]['id'];}return db['Condition']['find']({'where':{'id':_0x23dff8[_0x0845('0x26')]['id']}})[_0x0845('0x20')](handleEntityNotFound(_0x4d5d1d,null))[_0x0845('0x20')](saveUpdates(_0x23dff8[_0x0845('0x25')],null))['then'](respondWithResult(_0x4d5d1d,null))[_0x0845('0x27')](handleError(_0x4d5d1d,null));};exports[_0x0845('0x1f')]=function(_0x16549b,_0x144dc9){return db[_0x0845('0x28')][_0x0845('0x29')]({'where':{'id':_0x16549b[_0x0845('0x26')]['id']}})['then'](handleEntityNotFound(_0x144dc9,null))[_0x0845('0x20')](removeEntity(_0x144dc9,null))['catch'](handleError(_0x144dc9,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 4abc2af..c1e1b6f 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 _0xfcee=['bluebird','exports','define','tools_conditions','util','api','moment'];(function(_0x2977de,_0xb7fe61){var _0x201873=function(_0x5696fb){while(--_0x5696fb){_0x2977de['push'](_0x2977de['shift']());}};_0x201873(++_0xb7fe61);}(_0xfcee,0x97));var _0xefce=function(_0x9865dd,_0x156f1f){_0x9865dd=_0x9865dd-0x0;var _0x4f2c05=_0xfcee[_0x9865dd];return _0x4f2c05;};'use strict';var _=require('lodash');var util=require(_0xefce('0x0'));var logger=require('../../config/logger')(_0xefce('0x1'));var moment=require(_0xefce('0x2'));var BPromise=require(_0xefce('0x3'));var rp=require('request-promise');var attributes=require('./condition.attributes');module[_0xefce('0x4')]=function(_0x4f1786,_0x38a098){return _0x4f1786[_0xefce('0x5')]('Condition',attributes,{'tableName':_0xefce('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xada7=['define','tools_conditions','util','api','moment','request-promise','exports'];(function(_0x2a2b75,_0x52c39c){var _0x577f25=function(_0x1e995f){while(--_0x1e995f){_0x2a2b75['push'](_0x2a2b75['shift']());}};_0x577f25(++_0x52c39c);}(_0xada7,0x175));var _0x7ada=function(_0xb3187c,_0x2861e8){_0xb3187c=_0xb3187c-0x0;var _0x352ceb=_0xada7[_0xb3187c];return _0x352ceb;};'use strict';var _=require('lodash');var util=require(_0x7ada('0x0'));var logger=require('../../config/logger')(_0x7ada('0x1'));var moment=require(_0x7ada('0x2'));var BPromise=require('bluebird');var rp=require(_0x7ada('0x3'));var attributes=require('./condition.attributes');module[_0x7ada('0x4')]=function(_0x3119ae,_0x441e62){return _0x3119ae[_0x7ada('0x5')]('Condition',attributes,{'tableName':_0x7ada('0x6'),'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 19a93c4..05bd92e 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 _0x3a7c=['http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3a7c,0xaf));var _0xc3a7=function(_0x4f3207,_0x264c78){_0x4f3207=_0x4f3207-0x0;var _0x87adb6=_0x3a7c[_0x4f3207];return _0x87adb6;};'use strict';var _=require(_0xc3a7('0x0'));var util=require(_0xc3a7('0x1'));var moment=require(_0xc3a7('0x2'));var BPromise=require('bluebird');var rs=require(_0xc3a7('0x3'));var fs=require('fs');var Redis=require(_0xc3a7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc3a7('0x5'));var logger=require(_0xc3a7('0x6'))(_0xc3a7('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc3a7('0x8')][_0xc3a7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x345cc2,_0x2079dc,_0x94e6d2){return new BPromise(function(_0x115242,_0x116caf){return client[_0xc3a7('0xa')](_0x345cc2,_0x94e6d2)[_0xc3a7('0xb')](function(_0x227499){logger[_0xc3a7('0xc')](_0xc3a7('0xd'),_0x2079dc,_0xc3a7('0xe'));logger[_0xc3a7('0xf')](_0xc3a7('0x10'),_0x2079dc,'request\x20sent',JSON[_0xc3a7('0x11')](_0x227499));if(_0x227499[_0xc3a7('0x12')]){if(_0x227499[_0xc3a7('0x12')][_0xc3a7('0x13')]===0x1f4){logger[_0xc3a7('0x12')](_0xc3a7('0xd'),_0x2079dc,_0x227499[_0xc3a7('0x12')][_0xc3a7('0x14')]);return _0x116caf(_0x227499[_0xc3a7('0x12')]['message']);}logger['error'](_0xc3a7('0xd'),_0x2079dc,_0x227499['error'][_0xc3a7('0x14')]);return _0x115242(_0x227499[_0xc3a7('0x12')][_0xc3a7('0x14')]);}else{logger[_0xc3a7('0xc')](_0xc3a7('0xd'),_0x2079dc,_0xc3a7('0xe'));_0x115242(_0x227499[_0xc3a7('0x15')][_0xc3a7('0x14')]);}})[_0xc3a7('0x16')](function(_0x4c34a1){logger[_0xc3a7('0x12')](_0xc3a7('0xd'),_0x2079dc,_0x4c34a1);_0x116caf(_0x4c34a1);});});} \ No newline at end of file +var _0xf340=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','Condition,\x20%s,\x20%s','Condition,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','catch','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf340,0xb3));var _0x0f34=function(_0x146a5f,_0x96a7ec){_0x146a5f=_0x146a5f-0x0;var _0xff8f57=_0xf340[_0x146a5f];return _0xff8f57;};'use strict';var _=require(_0x0f34('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0f34('0x1'));var rs=require(_0x0f34('0x2'));var fs=require('fs');var Redis=require(_0x0f34('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0f34('0x4'));var logger=require(_0x0f34('0x5'))(_0x0f34('0x6'));var config=require(_0x0f34('0x7'));var jayson=require(_0x0f34('0x8'));var client=jayson['client'][_0x0f34('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a3b3d,_0x233930,_0x2413c7){return new BPromise(function(_0x551ba5,_0x20a7c6){return client[_0x0f34('0xa')](_0x2a3b3d,_0x2413c7)['then'](function(_0x26f69c){logger['info'](_0x0f34('0xb'),_0x233930,'request\x20sent');logger['debug'](_0x0f34('0xc'),_0x233930,'request\x20sent',JSON['stringify'](_0x26f69c));if(_0x26f69c['error']){if(_0x26f69c[_0x0f34('0xd')][_0x0f34('0xe')]===0x1f4){logger[_0x0f34('0xd')](_0x0f34('0xb'),_0x233930,_0x26f69c['error'][_0x0f34('0xf')]);return _0x20a7c6(_0x26f69c[_0x0f34('0xd')][_0x0f34('0xf')]);}logger[_0x0f34('0xd')](_0x0f34('0xb'),_0x233930,_0x26f69c[_0x0f34('0xd')][_0x0f34('0xf')]);return _0x551ba5(_0x26f69c[_0x0f34('0xd')]['message']);}else{logger[_0x0f34('0x10')](_0x0f34('0xb'),_0x233930,_0x0f34('0x11'));_0x551ba5(_0x26f69c[_0x0f34('0x12')]['message']);}})[_0x0f34('0x13')](function(_0x59fa20){logger[_0x0f34('0xd')](_0x0f34('0xb'),_0x233930,_0x59fa20);_0x20a7c6(_0x59fa20);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index c14d05d..2cd71f9 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 _0x98cb=['util','path','connect-timeout','express','Router','../../config/environment','./condition.controller','put','isAuthenticated','update','destroy','exports','multer'];(function(_0x4cd690,_0x4797cc){var _0x4a74a9=function(_0x4cbbc5){while(--_0x4cbbc5){_0x4cd690['push'](_0x4cd690['shift']());}};_0x4a74a9(++_0x4797cc);}(_0x98cb,0x81));var _0xb98c=function(_0x2741d2,_0x3a658c){_0x2741d2=_0x2741d2-0x0;var _0x171e9f=_0x98cb[_0x2741d2];return _0x171e9f;};'use strict';var multer=require(_0xb98c('0x0'));var util=require(_0xb98c('0x1'));var path=require(_0xb98c('0x2'));var timeout=require(_0xb98c('0x3'));var express=require(_0xb98c('0x4'));var router=express[_0xb98c('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb98c('0x6'));var controller=require(_0xb98c('0x7'));router[_0xb98c('0x8')]('/:id',auth[_0xb98c('0x9')](),controller[_0xb98c('0xa')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb98c('0xb')]);module[_0xb98c('0xc')]=router; \ No newline at end of file +var _0xa89e=['isAuthenticated','delete','destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id'];(function(_0x5b3b9b,_0x1c71b0){var _0x47c1d7=function(_0x34c20b){while(--_0x34c20b){_0x5b3b9b['push'](_0x5b3b9b['shift']());}};_0x47c1d7(++_0x1c71b0);}(_0xa89e,0x122));var _0xea89=function(_0x38d9e3,_0x2d4dd5){_0x38d9e3=_0x38d9e3-0x0;var _0x4fc3b5=_0xa89e[_0x38d9e3];return _0x4fc3b5;};'use strict';var multer=require(_0xea89('0x0'));var util=require(_0xea89('0x1'));var path=require(_0xea89('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xea89('0x3'));var interaction=require(_0xea89('0x4'));var config=require(_0xea89('0x5'));var controller=require(_0xea89('0x6'));router[_0xea89('0x7')](_0xea89('0x8'),auth[_0xea89('0x9')](),controller['update']);router[_0xea89('0xa')]('/:id',auth[_0xea89('0x9')](),controller[_0xea89('0xb')]);module[_0xea89('0xc')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 956353f..32e2c8b 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 _0xfe37=['exports','STRING','name','sequelize'];(function(_0x4cce80,_0x3b0f95){var _0x5c4473=function(_0x54cba7){while(--_0x54cba7){_0x4cce80['push'](_0x4cce80['shift']());}};_0x5c4473(++_0x3b0f95);}(_0xfe37,0x147));var _0x7fe3=function(_0x3ccb4c,_0x2cca1){_0x3ccb4c=_0x3ccb4c-0x0;var _0x3a9287=_0xfe37[_0x3ccb4c];return _0x3a9287;};'use strict';var Sequelize=require(_0x7fe3('0x0'));module[_0x7fe3('0x1')]={'name':{'type':Sequelize[_0x7fe3('0x2')],'allowNull':![],'unique':_0x7fe3('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x44f7=['STRING','name','sequelize'];(function(_0x46401e,_0x2a345b){var _0x447cba=function(_0x54ea97){while(--_0x54ea97){_0x46401e['push'](_0x46401e['shift']());}};_0x447cba(++_0x2a345b);}(_0x44f7,0x7a));var _0x744f=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x44f7[_0x3826ad];return _0x17b900;};'use strict';var Sequelize=require(_0x744f('0x0'));module['exports']={'name':{'type':Sequelize[_0x744f('0x1')],'allowNull':![],'unique':_0x744f('0x2')},'description':{'type':Sequelize[_0x744f('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 21bc5cf..fd76cab 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 _0xa639=['attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','findOne','order','sort','hasOwnProperty','html-pdf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','./dashboard.socket','register','sendStatus','status','json','count','offset','set','Content-Range','save','update','then','destroy','end','error','stack','name','index','Dashboard','rawAttributes','model','keys','query','dateEnd','dateStart','intersection','fields','attributes','nolimit','limit','where','filters','pick','add','day','filter','merge','map','options','includeAll','include','findAll','catch','show','params','length','create','body','find','get','createdAt','updatedAt','omit','type','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie3','web-report','attrReport','reportType'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa639,0x14e));var _0x9a63=function(_0x1f039e,_0x31a3df){_0x1f039e=_0x1f039e-0x0;var _0x5576b3=_0xa639[_0x1f039e];return _0x5576b3;};'use strict';var pdf=require(_0x9a63('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9a63('0x1'));var rp=require(_0x9a63('0x2'));var moment=require(_0x9a63('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9a63('0x4'));var util=require(_0x9a63('0x5'));var path=require(_0x9a63('0x6'));var sox=require('sox');var csv=require(_0x9a63('0x7'));var ejs=require(_0x9a63('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9a63('0x9'));var crypto=require(_0x9a63('0xa'));var jsforce=require(_0x9a63('0xb'));var deskjs=require(_0x9a63('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9a63('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var qs=require(_0x9a63('0xe'));var logger=require(_0x9a63('0xf'))('api');var utils=require(_0x9a63('0x10'));var config=require('../../config/environment');var db=require(_0x9a63('0x11'))['db'];config[_0x9a63('0x12')]=_[_0x9a63('0x13')](config[_0x9a63('0x12')],{'host':_0x9a63('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9a63('0x15'))[_0x9a63('0x16')](socket);function respondWithStatusCode(_0x5e51df,_0x405682){_0x405682=_0x405682||0xcc;return function(_0x208a4e){if(_0x208a4e){return _0x5e51df[_0x9a63('0x17')](_0x405682);}return _0x5e51df['status'](_0x405682)['end']();};}function respondWithResult(_0x3ae5e4,_0x1ad539){_0x1ad539=_0x1ad539||0xc8;return function(_0x5e8872){if(_0x5e8872){return _0x3ae5e4[_0x9a63('0x18')](_0x1ad539)[_0x9a63('0x19')](_0x5e8872);}};}function respondWithFilteredResult(_0x4082c5,_0x17aa89){return function(_0x3f9b97){if(_0x3f9b97){var _0xc3de83=_0x3f9b97[_0x9a63('0x1a')],_0x1984b8=_0x17aa89[_0x9a63('0x1b')],_0x37e9b8=_0x17aa89['offset']+_0x17aa89['limit'],_0x5c9de6;if(_0x37e9b8>=_0xc3de83){_0x37e9b8=_0xc3de83;_0x5c9de6=0xc8;}else{_0x5c9de6=0xce;}_0x4082c5['status'](_0x5c9de6);return _0x4082c5[_0x9a63('0x1c')](_0x9a63('0x1d'),_0x1984b8+'-'+_0x37e9b8+'/'+_0xc3de83)[_0x9a63('0x19')](_0x3f9b97);}return null;};}function patchUpdates(_0x2fe470){return function(_0x590ead){try{jsonpatch['apply'](_0x590ead,_0x2fe470,!![]);}catch(_0x1b126e){return BPromise['reject'](_0x1b126e);}return _0x590ead[_0x9a63('0x1e')]();};}function saveUpdates(_0x156f08,_0x34d0f8){return function(_0x55cbde){if(_0x55cbde){return _0x55cbde[_0x9a63('0x1f')](_0x156f08)[_0x9a63('0x20')](function(_0x2109b8){return _0x2109b8;});}return null;};}function removeEntity(_0xd7cdee,_0x5940be){return function(_0x1f3097){if(_0x1f3097){return _0x1f3097[_0x9a63('0x21')]()[_0x9a63('0x20')](function(){_0xd7cdee[_0x9a63('0x18')](0xcc)[_0x9a63('0x22')]();});}};}function handleEntityNotFound(_0x255c0f,_0x33a5ed){return function(_0x354114){if(!_0x354114){_0x255c0f['sendStatus'](0x194);}return _0x354114;};}function handleError(_0x3420f0,_0x4ef1a1){_0x4ef1a1=_0x4ef1a1||0x1f4;return function(_0x4ba567){logger[_0x9a63('0x23')](_0x4ba567[_0x9a63('0x24')]);if(_0x4ba567[_0x9a63('0x25')]){delete _0x4ba567['name'];}_0x3420f0[_0x9a63('0x18')](_0x4ef1a1)['send'](_0x4ba567);};}exports[_0x9a63('0x26')]=function(_0x463003,_0x39f177){var _0x252b6b={},_0x17085e={},_0x419eb0={'count':0x0,'rows':[]};var _0x22f697=db[_0x9a63('0x27')][_0x9a63('0x28')];_0x17085e[_0x9a63('0x29')]=_[_0x9a63('0x2a')](_0x22f697);var _0x1085b6={'dateStart':_0x463003[_0x9a63('0x2b')]['dateStart'],'dateEnd':_0x463003['query'][_0x9a63('0x2c')]};delete _0x463003[_0x9a63('0x2b')][_0x9a63('0x2d')];delete _0x463003[_0x9a63('0x2b')]['dateEnd'];_0x17085e['query']=_[_0x9a63('0x2a')](_0x463003[_0x9a63('0x2b')]);_0x17085e['filters']=_[_0x9a63('0x2e')](_0x17085e[_0x9a63('0x29')],_0x17085e[_0x9a63('0x2b')]);_0x252b6b['attributes']=_[_0x9a63('0x2e')](_0x17085e[_0x9a63('0x29')],qs[_0x9a63('0x2f')](_0x463003[_0x9a63('0x2b')][_0x9a63('0x2f')]));_0x252b6b[_0x9a63('0x30')]=_0x252b6b[_0x9a63('0x30')]['length']?_0x252b6b['attributes']:_0x17085e[_0x9a63('0x29')];if(!_0x463003[_0x9a63('0x2b')]['hasOwnProperty'](_0x9a63('0x31'))){_0x252b6b[_0x9a63('0x32')]=qs['limit'](_0x463003['query'][_0x9a63('0x32')]);_0x252b6b['offset']=qs['offset'](_0x463003[_0x9a63('0x2b')][_0x9a63('0x1b')]);}_0x252b6b['order']=qs['sort'](_0x463003[_0x9a63('0x2b')]['sort']);_0x252b6b[_0x9a63('0x33')]=qs[_0x9a63('0x34')](_[_0x9a63('0x35')](_0x463003[_0x9a63('0x2b')],_0x17085e['filters']));if(_0x1085b6[_0x9a63('0x2d')]){if(_0x1085b6['dateEnd']){_0x1085b6['dateEnd']=moment(_0x1085b6['dateEnd'])['add'](0x1,'day');}else{_0x1085b6['dateEnd']=moment(_0x1085b6['dateStart'])[_0x9a63('0x36')](0x1,_0x9a63('0x37'));}_['merge'](_0x252b6b['where'],{'createdAt':{'$gte':_0x1085b6[_0x9a63('0x2d')],'$lte':_0x1085b6[_0x9a63('0x2c')]}});}if(_0x463003[_0x9a63('0x2b')][_0x9a63('0x38')]){_0x252b6b[_0x9a63('0x33')]=_[_0x9a63('0x39')](_0x252b6b['where'],{'$or':_[_0x9a63('0x3a')](_0x252b6b['attributes'],function(_0x4dbce2){var _0x503d1f={};_0x503d1f[_0x4dbce2]={'$like':'%'+_0x463003[_0x9a63('0x2b')][_0x9a63('0x38')]+'%'};return _0x503d1f;})});}_0x252b6b=_[_0x9a63('0x39')]({},_0x252b6b,_0x463003[_0x9a63('0x3b')]);var _0x767eff={'where':_0x252b6b['where']};return db[_0x9a63('0x27')][_0x9a63('0x1a')](_0x767eff)['then'](function(_0x47d39d){_0x419eb0[_0x9a63('0x1a')]=_0x47d39d;if(_0x463003[_0x9a63('0x2b')][_0x9a63('0x3c')]){_0x252b6b[_0x9a63('0x3d')]=[{'all':!![]}];}return db['Dashboard'][_0x9a63('0x3e')](_0x252b6b);})[_0x9a63('0x20')](function(_0x1554bd){_0x419eb0['rows']=_0x1554bd;return _0x419eb0;})['then'](respondWithFilteredResult(_0x39f177,_0x252b6b))[_0x9a63('0x3f')](handleError(_0x39f177,null));};exports[_0x9a63('0x40')]=function(_0x336d50,_0x33b1a0){var _0x17faa5={'raw':![],'where':{'id':_0x336d50[_0x9a63('0x41')]['id']}},_0x20dda2={};_0x20dda2['model']=_[_0x9a63('0x2a')](db[_0x9a63('0x27')]['rawAttributes']);_0x20dda2['query']=_[_0x9a63('0x2a')](_0x336d50['query']);_0x20dda2[_0x9a63('0x34')]=_[_0x9a63('0x2e')](_0x20dda2[_0x9a63('0x29')],_0x20dda2[_0x9a63('0x2b')]);_0x17faa5[_0x9a63('0x30')]=_[_0x9a63('0x2e')](_0x20dda2[_0x9a63('0x29')],qs[_0x9a63('0x2f')](_0x336d50[_0x9a63('0x2b')][_0x9a63('0x2f')]));_0x17faa5[_0x9a63('0x30')]=_0x17faa5[_0x9a63('0x30')][_0x9a63('0x42')]?_0x17faa5['attributes']:_0x20dda2[_0x9a63('0x29')];if(_0x336d50['query'][_0x9a63('0x3c')]){_0x17faa5[_0x9a63('0x3d')]=[{'all':!![]}];}_0x17faa5=_[_0x9a63('0x39')]({},_0x17faa5,_0x336d50[_0x9a63('0x3b')]);return db[_0x9a63('0x27')]['find'](_0x17faa5)[_0x9a63('0x20')](handleEntityNotFound(_0x33b1a0,null))[_0x9a63('0x20')](respondWithResult(_0x33b1a0,null))[_0x9a63('0x3f')](handleError(_0x33b1a0,null));};exports[_0x9a63('0x43')]=function(_0x39e7c6,_0x364299){return db[_0x9a63('0x27')][_0x9a63('0x43')](_0x39e7c6[_0x9a63('0x44')],{})[_0x9a63('0x20')](respondWithResult(_0x364299,0xc9))['catch'](handleError(_0x364299,null));};exports['clone']=function(_0x46b422,_0x5907a0){var _0x32bb21={'raw':![],'where':{'id':_0x46b422[_0x9a63('0x41')]['id']}},_0x21e4f2={};_0x21e4f2['model']=_['keys'](db[_0x9a63('0x27')][_0x9a63('0x28')]);_0x32bb21[_0x9a63('0x30')]=_['intersection'](_0x21e4f2[_0x9a63('0x29')],qs[_0x9a63('0x2f')](_0x46b422[_0x9a63('0x2b')][_0x9a63('0x2f')]));_0x32bb21[_0x9a63('0x30')]=_0x32bb21[_0x9a63('0x30')][_0x9a63('0x42')]?_0x32bb21[_0x9a63('0x30')]:_0x21e4f2[_0x9a63('0x29')];if(_0x46b422[_0x9a63('0x2b')][_0x9a63('0x3c')]){_0x32bb21[_0x9a63('0x3d')]=[{'all':!![]}];}_0x32bb21=_[_0x9a63('0x39')]({},_0x32bb21,_0x46b422[_0x9a63('0x3b')]);return db[_0x9a63('0x27')][_0x9a63('0x45')](_0x32bb21)[_0x9a63('0x20')](handleEntityNotFound(_0x5907a0,null))['then'](function(_0x69598b){if(_0x69598b){var _0x176024=_0x69598b[_0x9a63('0x46')]({'plain':!![]});_0x176024=qs['omit'](_0x176024,['id',_0x9a63('0x47'),_0x9a63('0x48')]);_0x46b422[_0x9a63('0x44')]=_[_0x9a63('0x49')](_0x46b422[_0x9a63('0x44')],['id',_0x9a63('0x47'),_0x9a63('0x48')]);return db[_0x9a63('0x27')][_0x9a63('0x43')](_[_0x9a63('0x39')](_0x176024,_0x46b422[_0x9a63('0x44')]),{'include':_0x46b422[_0x9a63('0x2b')][_0x9a63('0x3c')]?[{'all':!![]}]:undefined});}})[_0x9a63('0x20')](respondWithResult(_0x5907a0,0xc9))[_0x9a63('0x3f')](handleError(_0x5907a0,null));};exports[_0x9a63('0x1f')]=function(_0xbab77,_0x14eb52){if(_0xbab77['body']['id']){delete _0xbab77[_0x9a63('0x44')]['id'];}return db['Dashboard'][_0x9a63('0x45')]({'where':{'id':_0xbab77[_0x9a63('0x41')]['id']}})[_0x9a63('0x20')](handleEntityNotFound(_0x14eb52,null))[_0x9a63('0x20')](saveUpdates(_0xbab77[_0x9a63('0x44')],null))['then'](respondWithResult(_0x14eb52,null))['catch'](handleError(_0x14eb52,null));};exports[_0x9a63('0x21')]=function(_0x1fca12,_0x521157){return db[_0x9a63('0x27')][_0x9a63('0x45')]({'where':{'id':_0x1fca12['params']['id']}})[_0x9a63('0x20')](handleEntityNotFound(_0x521157,null))[_0x9a63('0x20')](removeEntity(_0x521157,null))[_0x9a63('0x3f')](handleError(_0x521157,null));};function widgetAttributes(_0x1fcb3e){try{switch(_0x1fcb3e[_0x9a63('0x4a')]){case'iframe':return[{'name':_0x9a63('0x4b'),'value':_0x1fcb3e[_0x9a63('0x4b')]||(_0x1fcb3e[_0x9a63('0x4c')]&&_0x1fcb3e['attrs'][0x0]?_0x1fcb3e[_0x9a63('0x4c')][0x0][_0x9a63('0x4d')]:undefined)||_0x9a63('0x4e')}];case _0x9a63('0x4f'):return[{'name':_0x9a63('0x50'),'value':_0x1fcb3e[_0x9a63('0x50')]||(_0x1fcb3e[_0x9a63('0x4c')]&&_0x1fcb3e[_0x9a63('0x4c')][0x0]?_0x1fcb3e[_0x9a63('0x4c')][0x0]['value']:undefined)||''}];case _0x9a63('0x51'):return[{'name':_0x9a63('0x52'),'value':_0x1fcb3e['attrHourFormat']||(_0x1fcb3e[_0x9a63('0x4c')]&&_0x1fcb3e[_0x9a63('0x4c')][0x0]?_0x1fcb3e['attrs'][0x0]['value']:undefined)||_0x9a63('0x53')},{'name':'attrTimezone','value':_0x1fcb3e[_0x9a63('0x54')]||(_0x1fcb3e[_0x9a63('0x4c')]&&_0x1fcb3e[_0x9a63('0x4c')][0x1]?_0x1fcb3e[_0x9a63('0x4c')][0x1][_0x9a63('0x4d')]:undefined)||_0x9a63('0x55')},{'name':_0x9a63('0x56'),'value':_0x1fcb3e[_0x9a63('0x56')]||(_0x1fcb3e[_0x9a63('0x4c')]&&_0x1fcb3e[_0x9a63('0x4c')][0x2]?_0x1fcb3e[_0x9a63('0x4c')][0x2][_0x9a63('0x4d')]:undefined)||0xc}];case _0x9a63('0x57'):return[{'name':_0x9a63('0x58'),'value':_0x1fcb3e[_0x9a63('0x58')]||(_0x1fcb3e[_0x9a63('0x4c')]&&_0x1fcb3e['attrs'][0x0]?_0x1fcb3e['attrs'][0x0][_0x9a63('0x4d')]:undefined)||_0x9a63('0x59')},{'name':_0x9a63('0x5a'),'value':_0x1fcb3e['attrVoiceQueues']||(_0x1fcb3e[_0x9a63('0x4c')]&&_0x1fcb3e['attrs'][0x1]?_0x1fcb3e[_0x9a63('0x4c')][0x1][_0x9a63('0x4d')]:undefined)||[]},{'name':_0x9a63('0x56'),'value':_0x1fcb3e[_0x9a63('0x56')]||(_0x1fcb3e[_0x9a63('0x4c')]&&_0x1fcb3e[_0x9a63('0x4c')][0x2]?_0x1fcb3e[_0x9a63('0x4c')][0x2][_0x9a63('0x4d')]:undefined)||0x14}];case _0x9a63('0x5b'):case _0x9a63('0x5c'):return[{'name':_0x9a63('0x5d'),'value':_0x1fcb3e['attrSerie1']||(_0x1fcb3e[_0x9a63('0x4c')]&&_0x1fcb3e['attrs'][0x0]?_0x1fcb3e[_0x9a63('0x4c')][0x0]['value']:undefined)||_0x9a63('0x59')},{'name':'attrSerie2','value':_0x1fcb3e['attrSerie2']||(_0x1fcb3e[_0x9a63('0x4c')]&&_0x1fcb3e[_0x9a63('0x4c')][0x1]?_0x1fcb3e['attrs'][0x1]['value']:undefined)||null},{'name':_0x9a63('0x5e'),'value':_0x1fcb3e['attrSerie3']||(_0x1fcb3e[_0x9a63('0x4c')]&&_0x1fcb3e[_0x9a63('0x4c')][0x2]?_0x1fcb3e[_0x9a63('0x4c')][0x2][_0x9a63('0x4d')]:undefined)||null},{'name':_0x9a63('0x5a'),'value':_0x1fcb3e[_0x9a63('0x5a')]||(_0x1fcb3e[_0x9a63('0x4c')]&&_0x1fcb3e[_0x9a63('0x4c')][0x3]?_0x1fcb3e[_0x9a63('0x4c')][0x3][_0x9a63('0x4d')]:undefined)||[]}];case _0x9a63('0x5f'):return[{'name':_0x9a63('0x60'),'type':_0x1fcb3e[_0x9a63('0x61')]||null,'value':_0x1fcb3e[_0x9a63('0x60')]||(_0x1fcb3e[_0x9a63('0x4c')]&&_0x1fcb3e[_0x9a63('0x4c')][0x0]?_0x1fcb3e[_0x9a63('0x4c')][0x0][_0x9a63('0x4d')]:undefined)||null},{'name':_0x9a63('0x62'),'value':_0x1fcb3e[_0x9a63('0x62')]||(_0x1fcb3e[_0x9a63('0x4c')]&&_0x1fcb3e[_0x9a63('0x4c')][0x1]?_0x1fcb3e[_0x9a63('0x4c')][0x1][_0x9a63('0x4d')]:undefined)||0x0}];default:return[];}}catch(_0x18a3a8){logger[_0x9a63('0x23')](_0x9a63('0x63'),JSON['stringify'](_0x18a3a8));return[];}}exports[_0x9a63('0x64')]=function(_0x4b8e49,_0x1d16bb,_0x5c19af){if(_0x4b8e49[_0x9a63('0x44')]['id']){delete _0x4b8e49['body']['id'];}return db[_0x9a63('0x27')][_0x9a63('0x45')]({'where':{'id':_0x4b8e49[_0x9a63('0x41')]['id']}})[_0x9a63('0x20')](handleEntityNotFound(_0x1d16bb,null))[_0x9a63('0x20')](function(_0x248c63){if(_0x248c63){_0x4b8e49[_0x9a63('0x44')][_0x9a63('0x65')]=_0x248c63['id'];_0x4b8e49[_0x9a63('0x44')]['attrs']=widgetAttributes(_0x4b8e49[_0x9a63('0x44')]);return db[_0x9a63('0x66')][_0x9a63('0x43')](_0x4b8e49[_0x9a63('0x44')]);}})['then'](respondWithResult(_0x1d16bb,null))['catch'](handleError(_0x1d16bb,null));};exports[_0x9a63('0x67')]=function(_0x260667,_0x2fbe1a,_0x48f273){var _0x581075={};var _0x456996={};var _0x4d3d22;var _0x5cf1d4;return db[_0x9a63('0x27')][_0x9a63('0x68')]({'where':{'id':_0x260667[_0x9a63('0x41')]['id']}})[_0x9a63('0x20')](handleEntityNotFound(_0x2fbe1a,null))['then'](function(_0x3a0695){if(_0x3a0695){_0x4d3d22=_0x3a0695;_0x456996[_0x9a63('0x29')]=_['keys'](db[_0x9a63('0x66')][_0x9a63('0x28')]);_0x456996['query']=_['keys'](_0x260667[_0x9a63('0x2b')]);_0x456996[_0x9a63('0x34')]=_[_0x9a63('0x2e')](_0x456996[_0x9a63('0x29')],_0x456996[_0x9a63('0x2b')]);_0x581075[_0x9a63('0x30')]=_[_0x9a63('0x2e')](_0x456996[_0x9a63('0x29')],qs[_0x9a63('0x2f')](_0x260667[_0x9a63('0x2b')]['fields']));_0x581075['attributes']=_0x581075['attributes'][_0x9a63('0x42')]?_0x581075[_0x9a63('0x30')]:_0x456996['model'];_0x581075[_0x9a63('0x69')]=qs[_0x9a63('0x6a')](_0x260667[_0x9a63('0x2b')][_0x9a63('0x6a')]);_0x581075[_0x9a63('0x33')]=qs[_0x9a63('0x34')](_[_0x9a63('0x35')](_0x260667[_0x9a63('0x2b')],_0x456996[_0x9a63('0x34')]));if(_0x260667[_0x9a63('0x2b')][_0x9a63('0x38')]){_0x581075['where']=_['merge'](_0x581075[_0x9a63('0x33')],{'$or':_[_0x9a63('0x3a')](_0x581075[_0x9a63('0x30')],function(_0x130c9f){var _0x137ee8={};_0x137ee8[_0x130c9f]={'$like':'%'+_0x260667[_0x9a63('0x2b')][_0x9a63('0x38')]+'%'};return _0x137ee8;})});}_0x581075=_[_0x9a63('0x39')]({},_0x581075,_0x260667[_0x9a63('0x3b')]);return _0x4d3d22['getItems'](_0x581075);}})[_0x9a63('0x20')](function(_0x4d515b){if(_0x4d515b){_0x5cf1d4=_0x4d515b[_0x9a63('0x42')];if(!_0x260667[_0x9a63('0x2b')][_0x9a63('0x6b')](_0x9a63('0x31'))){_0x581075[_0x9a63('0x32')]=qs['limit'](_0x260667['query'][_0x9a63('0x32')]);_0x581075['offset']=qs['offset'](_0x260667['query'][_0x9a63('0x1b')]);}return _0x4d3d22[_0x9a63('0x67')](_0x581075);}})[_0x9a63('0x20')](function(_0x575793){if(_0x575793){return _0x575793?{'count':_0x5cf1d4,'rows':_0x575793}:null;}})[_0x9a63('0x20')](respondWithResult(_0x2fbe1a,null))['catch'](handleError(_0x2fbe1a,null));}; \ No newline at end of file +var _0xd738=['attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','stringify','addItem','getItems','findOne','DashboardItem','map','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./dashboard.socket','register','sendStatus','end','status','json','offset','limit','set','apply','reject','save','then','destroy','error','stack','name','send','index','Dashboard','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','add','day','merge','filter','options','count','include','findAll','rows','catch','show','params','includeAll','create','body','find','omit','createdAt','updatedAt','type','iframe','attrUrl','attrs','value','https://','custom'];(function(_0x5e3c37,_0x5ddb60){var _0xbc070b=function(_0x3302d8){while(--_0x3302d8){_0x5e3c37['push'](_0x5e3c37['shift']());}};_0xbc070b(++_0x5ddb60);}(_0xd738,0x8a));var _0x8d73=function(_0xafda3f,_0x409fe9){_0xafda3f=_0xafda3f-0x0;var _0x396890=_0xd738[_0xafda3f];return _0x396890;};'use strict';var pdf=require(_0x8d73('0x0'));var emlformat=require(_0x8d73('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8d73('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8d73('0x3'));var moment=require(_0x8d73('0x4'));var BPromise=require(_0x8d73('0x5'));var Mustache=require(_0x8d73('0x6'));var util=require(_0x8d73('0x7'));var path=require(_0x8d73('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8d73('0x9'));var fs=require('fs');var _=require(_0x8d73('0xa'));var squel=require(_0x8d73('0xb'));var crypto=require(_0x8d73('0xc'));var jsforce=require(_0x8d73('0xd'));var deskjs=require(_0x8d73('0xe'));var toCsv=require(_0x8d73('0xf'));var querystring=require(_0x8d73('0x10'));var Papa=require(_0x8d73('0x11'));var Redis=require(_0x8d73('0x12'));var qs=require(_0x8d73('0x13'));var logger=require(_0x8d73('0x14'))(_0x8d73('0x15'));var utils=require('../../config/utils');var config=require(_0x8d73('0x16'));var db=require(_0x8d73('0x17'))['db'];config[_0x8d73('0x18')]=_[_0x8d73('0x19')](config[_0x8d73('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x8d73('0x1a'))(new Redis(config[_0x8d73('0x18')]));require(_0x8d73('0x1b'))[_0x8d73('0x1c')](socket);function respondWithStatusCode(_0x50f1da,_0x477ee6){_0x477ee6=_0x477ee6||0xcc;return function(_0x461240){if(_0x461240){return _0x50f1da[_0x8d73('0x1d')](_0x477ee6);}return _0x50f1da['status'](_0x477ee6)[_0x8d73('0x1e')]();};}function respondWithResult(_0x468d84,_0x191c89){_0x191c89=_0x191c89||0xc8;return function(_0x24fb2f){if(_0x24fb2f){return _0x468d84[_0x8d73('0x1f')](_0x191c89)[_0x8d73('0x20')](_0x24fb2f);}};}function respondWithFilteredResult(_0x2d81d7,_0x57bf18){return function(_0x5e7b91){if(_0x5e7b91){var _0x522fc1=_0x5e7b91['count'],_0x59664e=_0x57bf18[_0x8d73('0x21')],_0x1a2702=_0x57bf18[_0x8d73('0x21')]+_0x57bf18[_0x8d73('0x22')],_0x4c3e20;if(_0x1a2702>=_0x522fc1){_0x1a2702=_0x522fc1;_0x4c3e20=0xc8;}else{_0x4c3e20=0xce;}_0x2d81d7[_0x8d73('0x1f')](_0x4c3e20);return _0x2d81d7[_0x8d73('0x23')]('Content-Range',_0x59664e+'-'+_0x1a2702+'/'+_0x522fc1)['json'](_0x5e7b91);}return null;};}function patchUpdates(_0x13554c){return function(_0x4d5ed7){try{jsonpatch[_0x8d73('0x24')](_0x4d5ed7,_0x13554c,!![]);}catch(_0x308da4){return BPromise[_0x8d73('0x25')](_0x308da4);}return _0x4d5ed7[_0x8d73('0x26')]();};}function saveUpdates(_0x437e92,_0x49e556){return function(_0x27d73d){if(_0x27d73d){return _0x27d73d['update'](_0x437e92)[_0x8d73('0x27')](function(_0x16ff9e){return _0x16ff9e;});}return null;};}function removeEntity(_0x3a460a,_0x32f3a4){return function(_0x2e5fd8){if(_0x2e5fd8){return _0x2e5fd8[_0x8d73('0x28')]()[_0x8d73('0x27')](function(){_0x3a460a['status'](0xcc)[_0x8d73('0x1e')]();});}};}function handleEntityNotFound(_0x251ab3,_0x47bbc7){return function(_0x3e2b26){if(!_0x3e2b26){_0x251ab3[_0x8d73('0x1d')](0x194);}return _0x3e2b26;};}function handleError(_0x2f2e46,_0x47ed1e){_0x47ed1e=_0x47ed1e||0x1f4;return function(_0x48fa6f){logger[_0x8d73('0x29')](_0x48fa6f[_0x8d73('0x2a')]);if(_0x48fa6f[_0x8d73('0x2b')]){delete _0x48fa6f['name'];}_0x2f2e46['status'](_0x47ed1e)[_0x8d73('0x2c')](_0x48fa6f);};}exports[_0x8d73('0x2d')]=function(_0x12066f,_0x511fec){var _0x3cc13d={},_0x1ec2e9={},_0x525f8b={'count':0x0,'rows':[]};var _0x52e1f8=db[_0x8d73('0x2e')][_0x8d73('0x2f')];_0x1ec2e9[_0x8d73('0x30')]=_[_0x8d73('0x31')](_0x52e1f8);var _0x3fc4ba={'dateStart':_0x12066f[_0x8d73('0x32')]['dateStart'],'dateEnd':_0x12066f['query'][_0x8d73('0x33')]};delete _0x12066f[_0x8d73('0x32')][_0x8d73('0x34')];delete _0x12066f['query'][_0x8d73('0x33')];_0x1ec2e9[_0x8d73('0x32')]=_['keys'](_0x12066f[_0x8d73('0x32')]);_0x1ec2e9[_0x8d73('0x35')]=_[_0x8d73('0x36')](_0x1ec2e9[_0x8d73('0x30')],_0x1ec2e9['query']);_0x3cc13d[_0x8d73('0x37')]=_[_0x8d73('0x36')](_0x1ec2e9[_0x8d73('0x30')],qs['fields'](_0x12066f[_0x8d73('0x32')][_0x8d73('0x38')]));_0x3cc13d[_0x8d73('0x37')]=_0x3cc13d[_0x8d73('0x37')][_0x8d73('0x39')]?_0x3cc13d[_0x8d73('0x37')]:_0x1ec2e9[_0x8d73('0x30')];if(!_0x12066f[_0x8d73('0x32')][_0x8d73('0x3a')]('nolimit')){_0x3cc13d[_0x8d73('0x22')]=qs[_0x8d73('0x22')](_0x12066f[_0x8d73('0x32')][_0x8d73('0x22')]);_0x3cc13d[_0x8d73('0x21')]=qs[_0x8d73('0x21')](_0x12066f['query'][_0x8d73('0x21')]);}_0x3cc13d['order']=qs['sort'](_0x12066f[_0x8d73('0x32')][_0x8d73('0x3b')]);_0x3cc13d[_0x8d73('0x3c')]=qs[_0x8d73('0x35')](_[_0x8d73('0x3d')](_0x12066f[_0x8d73('0x32')],_0x1ec2e9[_0x8d73('0x35')]));if(_0x3fc4ba[_0x8d73('0x34')]){if(_0x3fc4ba[_0x8d73('0x33')]){_0x3fc4ba['dateEnd']=moment(_0x3fc4ba[_0x8d73('0x33')])[_0x8d73('0x3e')](0x1,'day');}else{_0x3fc4ba[_0x8d73('0x33')]=moment(_0x3fc4ba[_0x8d73('0x34')])['add'](0x1,_0x8d73('0x3f'));}_[_0x8d73('0x40')](_0x3cc13d['where'],{'createdAt':{'$gte':_0x3fc4ba[_0x8d73('0x34')],'$lte':_0x3fc4ba['dateEnd']}});}if(_0x12066f[_0x8d73('0x32')][_0x8d73('0x41')]){_0x3cc13d['where']=_[_0x8d73('0x40')](_0x3cc13d[_0x8d73('0x3c')],{'$or':_['map'](_0x3cc13d[_0x8d73('0x37')],function(_0x4d194f){var _0x38eea0={};_0x38eea0[_0x4d194f]={'$like':'%'+_0x12066f[_0x8d73('0x32')][_0x8d73('0x41')]+'%'};return _0x38eea0;})});}_0x3cc13d=_['merge']({},_0x3cc13d,_0x12066f[_0x8d73('0x42')]);var _0x84de5f={'where':_0x3cc13d['where']};return db[_0x8d73('0x2e')]['count'](_0x84de5f)[_0x8d73('0x27')](function(_0x48177a){_0x525f8b[_0x8d73('0x43')]=_0x48177a;if(_0x12066f[_0x8d73('0x32')]['includeAll']){_0x3cc13d[_0x8d73('0x44')]=[{'all':!![]}];}return db['Dashboard'][_0x8d73('0x45')](_0x3cc13d);})[_0x8d73('0x27')](function(_0x3d8216){_0x525f8b[_0x8d73('0x46')]=_0x3d8216;return _0x525f8b;})[_0x8d73('0x27')](respondWithFilteredResult(_0x511fec,_0x3cc13d))[_0x8d73('0x47')](handleError(_0x511fec,null));};exports[_0x8d73('0x48')]=function(_0x29d781,_0x52f0e2){var _0x3844d0={'raw':![],'where':{'id':_0x29d781[_0x8d73('0x49')]['id']}},_0x463474={};_0x463474[_0x8d73('0x30')]=_[_0x8d73('0x31')](db[_0x8d73('0x2e')]['rawAttributes']);_0x463474[_0x8d73('0x32')]=_[_0x8d73('0x31')](_0x29d781['query']);_0x463474['filters']=_[_0x8d73('0x36')](_0x463474[_0x8d73('0x30')],_0x463474['query']);_0x3844d0[_0x8d73('0x37')]=_[_0x8d73('0x36')](_0x463474[_0x8d73('0x30')],qs[_0x8d73('0x38')](_0x29d781[_0x8d73('0x32')][_0x8d73('0x38')]));_0x3844d0[_0x8d73('0x37')]=_0x3844d0[_0x8d73('0x37')][_0x8d73('0x39')]?_0x3844d0[_0x8d73('0x37')]:_0x463474['model'];if(_0x29d781[_0x8d73('0x32')][_0x8d73('0x4a')]){_0x3844d0[_0x8d73('0x44')]=[{'all':!![]}];}_0x3844d0=_[_0x8d73('0x40')]({},_0x3844d0,_0x29d781[_0x8d73('0x42')]);return db[_0x8d73('0x2e')]['find'](_0x3844d0)[_0x8d73('0x27')](handleEntityNotFound(_0x52f0e2,null))[_0x8d73('0x27')](respondWithResult(_0x52f0e2,null))['catch'](handleError(_0x52f0e2,null));};exports[_0x8d73('0x4b')]=function(_0x21bb36,_0xb4051){return db['Dashboard'][_0x8d73('0x4b')](_0x21bb36[_0x8d73('0x4c')],{})[_0x8d73('0x27')](respondWithResult(_0xb4051,0xc9))[_0x8d73('0x47')](handleError(_0xb4051,null));};exports['clone']=function(_0x3395ab,_0x7c3b64){var _0x228109={'raw':![],'where':{'id':_0x3395ab['params']['id']}},_0x52ee11={};_0x52ee11[_0x8d73('0x30')]=_['keys'](db[_0x8d73('0x2e')][_0x8d73('0x2f')]);_0x228109['attributes']=_['intersection'](_0x52ee11[_0x8d73('0x30')],qs[_0x8d73('0x38')](_0x3395ab[_0x8d73('0x32')][_0x8d73('0x38')]));_0x228109[_0x8d73('0x37')]=_0x228109[_0x8d73('0x37')]['length']?_0x228109[_0x8d73('0x37')]:_0x52ee11['model'];if(_0x3395ab[_0x8d73('0x32')][_0x8d73('0x4a')]){_0x228109[_0x8d73('0x44')]=[{'all':!![]}];}_0x228109=_[_0x8d73('0x40')]({},_0x228109,_0x3395ab['options']);return db[_0x8d73('0x2e')][_0x8d73('0x4d')](_0x228109)[_0x8d73('0x27')](handleEntityNotFound(_0x7c3b64,null))[_0x8d73('0x27')](function(_0xfa7596){if(_0xfa7596){var _0x294bcb=_0xfa7596['get']({'plain':!![]});_0x294bcb=qs[_0x8d73('0x4e')](_0x294bcb,['id',_0x8d73('0x4f'),_0x8d73('0x50')]);_0x3395ab[_0x8d73('0x4c')]=_['omit'](_0x3395ab[_0x8d73('0x4c')],['id',_0x8d73('0x4f'),_0x8d73('0x50')]);return db['Dashboard'][_0x8d73('0x4b')](_[_0x8d73('0x40')](_0x294bcb,_0x3395ab['body']),{'include':_0x3395ab[_0x8d73('0x32')][_0x8d73('0x4a')]?[{'all':!![]}]:undefined});}})[_0x8d73('0x27')](respondWithResult(_0x7c3b64,0xc9))['catch'](handleError(_0x7c3b64,null));};exports['update']=function(_0x47817a,_0x25f767){if(_0x47817a[_0x8d73('0x4c')]['id']){delete _0x47817a[_0x8d73('0x4c')]['id'];}return db['Dashboard'][_0x8d73('0x4d')]({'where':{'id':_0x47817a[_0x8d73('0x49')]['id']}})[_0x8d73('0x27')](handleEntityNotFound(_0x25f767,null))['then'](saveUpdates(_0x47817a['body'],null))[_0x8d73('0x27')](respondWithResult(_0x25f767,null))[_0x8d73('0x47')](handleError(_0x25f767,null));};exports['destroy']=function(_0x12c6ff,_0x234931){return db[_0x8d73('0x2e')][_0x8d73('0x4d')]({'where':{'id':_0x12c6ff[_0x8d73('0x49')]['id']}})[_0x8d73('0x27')](handleEntityNotFound(_0x234931,null))[_0x8d73('0x27')](removeEntity(_0x234931,null))[_0x8d73('0x47')](handleError(_0x234931,null));};function widgetAttributes(_0x21d777){try{switch(_0x21d777[_0x8d73('0x51')]){case _0x8d73('0x52'):return[{'name':_0x8d73('0x53'),'value':_0x21d777[_0x8d73('0x53')]||(_0x21d777[_0x8d73('0x54')]&&_0x21d777['attrs'][0x0]?_0x21d777[_0x8d73('0x54')][0x0][_0x8d73('0x55')]:undefined)||_0x8d73('0x56')}];case _0x8d73('0x57'):return[{'name':'attrPath','value':_0x21d777[_0x8d73('0x58')]||(_0x21d777['attrs']&&_0x21d777[_0x8d73('0x54')][0x0]?_0x21d777[_0x8d73('0x54')][0x0]['value']:undefined)||''}];case _0x8d73('0x59'):return[{'name':_0x8d73('0x5a'),'value':_0x21d777[_0x8d73('0x5a')]||(_0x21d777[_0x8d73('0x54')]&&_0x21d777[_0x8d73('0x54')][0x0]?_0x21d777[_0x8d73('0x54')][0x0][_0x8d73('0x55')]:undefined)||_0x8d73('0x5b')},{'name':_0x8d73('0x5c'),'value':_0x21d777['attrTimezone']||(_0x21d777['attrs']&&_0x21d777[_0x8d73('0x54')][0x1]?_0x21d777['attrs'][0x1][_0x8d73('0x55')]:undefined)||_0x8d73('0x5d')},{'name':_0x8d73('0x5e'),'value':_0x21d777[_0x8d73('0x5e')]||(_0x21d777['attrs']&&_0x21d777['attrs'][0x2]?_0x21d777[_0x8d73('0x54')][0x2][_0x8d73('0x55')]:undefined)||0xc}];case _0x8d73('0x5f'):return[{'name':'attrMetric','value':_0x21d777[_0x8d73('0x60')]||(_0x21d777['attrs']&&_0x21d777[_0x8d73('0x54')][0x0]?_0x21d777[_0x8d73('0x54')][0x0][_0x8d73('0x55')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x21d777[_0x8d73('0x61')]||(_0x21d777[_0x8d73('0x54')]&&_0x21d777[_0x8d73('0x54')][0x1]?_0x21d777[_0x8d73('0x54')][0x1][_0x8d73('0x55')]:undefined)||[]},{'name':_0x8d73('0x5e'),'value':_0x21d777[_0x8d73('0x5e')]||(_0x21d777[_0x8d73('0x54')]&&_0x21d777['attrs'][0x2]?_0x21d777['attrs'][0x2][_0x8d73('0x55')]:undefined)||0x14}];case _0x8d73('0x62'):case _0x8d73('0x63'):return[{'name':_0x8d73('0x64'),'value':_0x21d777[_0x8d73('0x64')]||(_0x21d777['attrs']&&_0x21d777[_0x8d73('0x54')][0x0]?_0x21d777[_0x8d73('0x54')][0x0]['value']:undefined)||'total'},{'name':'attrSerie2','value':_0x21d777[_0x8d73('0x65')]||(_0x21d777['attrs']&&_0x21d777[_0x8d73('0x54')][0x1]?_0x21d777[_0x8d73('0x54')][0x1][_0x8d73('0x55')]:undefined)||null},{'name':_0x8d73('0x66'),'value':_0x21d777[_0x8d73('0x66')]||(_0x21d777[_0x8d73('0x54')]&&_0x21d777[_0x8d73('0x54')][0x2]?_0x21d777[_0x8d73('0x54')][0x2][_0x8d73('0x55')]:undefined)||null},{'name':_0x8d73('0x61'),'value':_0x21d777['attrVoiceQueues']||(_0x21d777['attrs']&&_0x21d777['attrs'][0x3]?_0x21d777['attrs'][0x3][_0x8d73('0x55')]:undefined)||[]}];case _0x8d73('0x67'):return[{'name':'attrReport','type':_0x21d777[_0x8d73('0x68')]||null,'value':_0x21d777[_0x8d73('0x69')]||(_0x21d777[_0x8d73('0x54')]&&_0x21d777[_0x8d73('0x54')][0x0]?_0x21d777[_0x8d73('0x54')][0x0][_0x8d73('0x55')]:undefined)||null},{'name':_0x8d73('0x6a'),'value':_0x21d777['attrRefresh']||(_0x21d777[_0x8d73('0x54')]&&_0x21d777[_0x8d73('0x54')][0x1]?_0x21d777[_0x8d73('0x54')][0x1][_0x8d73('0x55')]:undefined)||0x0}];default:return[];}}catch(_0x366438){logger['error']('widgetAttributes:\x20%s',JSON[_0x8d73('0x6b')](_0x366438));return[];}}exports[_0x8d73('0x6c')]=function(_0x24ec2f,_0x2425cf,_0x398acd){if(_0x24ec2f[_0x8d73('0x4c')]['id']){delete _0x24ec2f[_0x8d73('0x4c')]['id'];}return db[_0x8d73('0x2e')][_0x8d73('0x4d')]({'where':{'id':_0x24ec2f[_0x8d73('0x49')]['id']}})[_0x8d73('0x27')](handleEntityNotFound(_0x2425cf,null))[_0x8d73('0x27')](function(_0x29455d){if(_0x29455d){_0x24ec2f[_0x8d73('0x4c')]['DashboardId']=_0x29455d['id'];_0x24ec2f['body']['attrs']=widgetAttributes(_0x24ec2f[_0x8d73('0x4c')]);return db['DashboardItem'][_0x8d73('0x4b')](_0x24ec2f[_0x8d73('0x4c')]);}})[_0x8d73('0x27')](respondWithResult(_0x2425cf,null))[_0x8d73('0x47')](handleError(_0x2425cf,null));};exports[_0x8d73('0x6d')]=function(_0x25665a,_0x280c54,_0x2487cb){var _0x4306c3={};var _0x227eef={};var _0x273e5b;var _0x2ebc69;return db[_0x8d73('0x2e')][_0x8d73('0x6e')]({'where':{'id':_0x25665a[_0x8d73('0x49')]['id']}})[_0x8d73('0x27')](handleEntityNotFound(_0x280c54,null))['then'](function(_0x2f2c48){if(_0x2f2c48){_0x273e5b=_0x2f2c48;_0x227eef[_0x8d73('0x30')]=_[_0x8d73('0x31')](db[_0x8d73('0x6f')][_0x8d73('0x2f')]);_0x227eef[_0x8d73('0x32')]=_[_0x8d73('0x31')](_0x25665a[_0x8d73('0x32')]);_0x227eef[_0x8d73('0x35')]=_[_0x8d73('0x36')](_0x227eef[_0x8d73('0x30')],_0x227eef['query']);_0x4306c3[_0x8d73('0x37')]=_[_0x8d73('0x36')](_0x227eef[_0x8d73('0x30')],qs[_0x8d73('0x38')](_0x25665a['query']['fields']));_0x4306c3['attributes']=_0x4306c3[_0x8d73('0x37')][_0x8d73('0x39')]?_0x4306c3[_0x8d73('0x37')]:_0x227eef[_0x8d73('0x30')];_0x4306c3['order']=qs[_0x8d73('0x3b')](_0x25665a[_0x8d73('0x32')][_0x8d73('0x3b')]);_0x4306c3[_0x8d73('0x3c')]=qs[_0x8d73('0x35')](_[_0x8d73('0x3d')](_0x25665a['query'],_0x227eef[_0x8d73('0x35')]));if(_0x25665a[_0x8d73('0x32')]['filter']){_0x4306c3[_0x8d73('0x3c')]=_[_0x8d73('0x40')](_0x4306c3[_0x8d73('0x3c')],{'$or':_[_0x8d73('0x70')](_0x4306c3[_0x8d73('0x37')],function(_0x5a3d4a){var _0x415a44={};_0x415a44[_0x5a3d4a]={'$like':'%'+_0x25665a['query'][_0x8d73('0x41')]+'%'};return _0x415a44;})});}_0x4306c3=_[_0x8d73('0x40')]({},_0x4306c3,_0x25665a[_0x8d73('0x42')]);return _0x273e5b[_0x8d73('0x6d')](_0x4306c3);}})[_0x8d73('0x27')](function(_0x629305){if(_0x629305){_0x2ebc69=_0x629305['length'];if(!_0x25665a[_0x8d73('0x32')]['hasOwnProperty']('nolimit')){_0x4306c3[_0x8d73('0x22')]=qs['limit'](_0x25665a[_0x8d73('0x32')]['limit']);_0x4306c3['offset']=qs[_0x8d73('0x21')](_0x25665a[_0x8d73('0x32')][_0x8d73('0x21')]);}return _0x273e5b['getItems'](_0x4306c3);}})[_0x8d73('0x27')](function(_0x33b7aa){if(_0x33b7aa){return _0x33b7aa?{'count':_0x2ebc69,'rows':_0x33b7aa}:null;}})[_0x8d73('0x27')](respondWithResult(_0x280c54,null))[_0x8d73('0x47')](handleError(_0x280c54,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 561eef6..b7ef2f1 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 _0xefd6=['exports','events','../../mysqldb','save','update','emit','hasOwnProperty','hook'];(function(_0x46a50c,_0x3a7f4a){var _0x4274db=function(_0x213af1){while(--_0x213af1){_0x46a50c['push'](_0x46a50c['shift']());}};_0x4274db(++_0x3a7f4a);}(_0xefd6,0x171));var _0x6efd=function(_0x36c898,_0x28d445){_0x36c898=_0x36c898-0x0;var _0x5a8d95=_0xefd6[_0x36c898];return _0x5a8d95;};'use strict';var EventEmitter=require(_0x6efd('0x0'));var Dashboard=require(_0x6efd('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6efd('0x2'),'afterUpdate':_0x6efd('0x3'),'afterDestroy':'remove'};function emitEvent(_0x35b944){return function(_0xaf5579,_0x294a4d,_0x56b329){DashboardEvents[_0x6efd('0x4')](_0x35b944+':'+_0xaf5579['id'],_0xaf5579);DashboardEvents[_0x6efd('0x4')](_0x35b944,_0xaf5579);_0x56b329(null);};}for(var e in events){if(events[_0x6efd('0x5')](e)){var event=events[e];Dashboard[_0x6efd('0x6')](e,emitEvent(event));}}module[_0x6efd('0x7')]=DashboardEvents; \ No newline at end of file +var _0x6611=['save','update','remove','emit','exports','../../mysqldb','Dashboard','setMaxListeners'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6611,0xdd));var _0x1661=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x6611[_0x432682];return _0x463d05;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x1661('0x0'))['db'][_0x1661('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x1661('0x2')](0x0);var events={'afterCreate':_0x1661('0x3'),'afterUpdate':_0x1661('0x4'),'afterDestroy':_0x1661('0x5')};function emitEvent(_0x44e418){return function(_0x25bce6,_0x277da8,_0x28f924){DashboardEvents[_0x1661('0x6')](_0x44e418+':'+_0x25bce6['id'],_0x25bce6);DashboardEvents[_0x1661('0x6')](_0x44e418,_0x25bce6);_0x28f924(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x1661('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 5931006..379a002 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 _0x97db=['./dashboard.attributes','exports','define','Dashboard','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x4911ed,_0x476941){var _0x230288=function(_0xcaa9c0){while(--_0xcaa9c0){_0x4911ed['push'](_0x4911ed['shift']());}};_0x230288(++_0x476941);}(_0x97db,0x1b4));var _0xb97d=function(_0x9be6f8,_0x7947c1){_0x9be6f8=_0x9be6f8-0x0;var _0x191a87=_0x97db[_0x9be6f8];return _0x191a87;};'use strict';var _=require(_0xb97d('0x0'));var util=require(_0xb97d('0x1'));var logger=require(_0xb97d('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb97d('0x3'));var rp=require(_0xb97d('0x4'));var attributes=require(_0xb97d('0x5'));module[_0xb97d('0x6')]=function(_0x536ee5,_0x5c8e74){return _0x536ee5[_0xb97d('0x7')](_0xb97d('0x8'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x40ac=['api','moment','bluebird','request-promise','./dashboard.attributes','exports','define','Dashboard','lodash','../../config/logger'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0x40ac,0x1de));var _0xc40a=function(_0x40e39f,_0x13396a){_0x40e39f=_0x40e39f-0x0;var _0x5166bc=_0x40ac[_0x40e39f];return _0x5166bc;};'use strict';var _=require(_0xc40a('0x0'));var util=require('util');var logger=require(_0xc40a('0x1'))(_0xc40a('0x2'));var moment=require(_0xc40a('0x3'));var BPromise=require(_0xc40a('0x4'));var rp=require(_0xc40a('0x5'));var attributes=require(_0xc40a('0x6'));module[_0xc40a('0x7')]=function(_0x5b792a,_0x84de3d){return _0x5b792a[_0xc40a('0x8')](_0xc40a('0x9'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index b3116fb..49fb620 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 _0x6ee3=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','request','then','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','Dashboard,\x20%s,\x20%s','message','info','result','catch','moment','bluebird'];(function(_0x30d14d,_0x5b7cdc){var _0x47054e=function(_0x3535f2){while(--_0x3535f2){_0x30d14d['push'](_0x30d14d['shift']());}};_0x47054e(++_0x5b7cdc);}(_0x6ee3,0x142));var _0x36ee=function(_0x94d895,_0x5ef18c){_0x94d895=_0x94d895-0x0;var _0x3aee85=_0x6ee3[_0x94d895];return _0x3aee85;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x36ee('0x0'));var BPromise=require(_0x36ee('0x1'));var rs=require(_0x36ee('0x2'));var fs=require('fs');var Redis=require(_0x36ee('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x36ee('0x4'))(_0x36ee('0x5'));var config=require(_0x36ee('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x36ee('0x7')][_0x36ee('0x8')]({'port':0x232a});config[_0x36ee('0x9')]=_[_0x36ee('0xa')](config[_0x36ee('0x9')],{'host':_0x36ee('0xb'),'port':0x18eb});var socket=require(_0x36ee('0xc'))(new Redis(config[_0x36ee('0x9')]));require(_0x36ee('0xd'))['register'](socket);function respondWithRpcPromise(_0x5c7e6d,_0x3b2355,_0x52fb16){return new BPromise(function(_0x401009,_0x1ceb4f){return client[_0x36ee('0xe')](_0x5c7e6d,_0x52fb16)[_0x36ee('0xf')](function(_0x232119){logger['info']('Dashboard,\x20%s,\x20%s',_0x3b2355,_0x36ee('0x10'));logger[_0x36ee('0x11')](_0x36ee('0x12'),_0x3b2355,_0x36ee('0x10'),JSON[_0x36ee('0x13')](_0x232119));if(_0x232119[_0x36ee('0x14')]){if(_0x232119[_0x36ee('0x14')][_0x36ee('0x15')]===0x1f4){logger['error'](_0x36ee('0x16'),_0x3b2355,_0x232119[_0x36ee('0x14')]['message']);return _0x1ceb4f(_0x232119['error'][_0x36ee('0x17')]);}logger['error'](_0x36ee('0x16'),_0x3b2355,_0x232119['error']['message']);return _0x401009(_0x232119[_0x36ee('0x14')][_0x36ee('0x17')]);}else{logger[_0x36ee('0x18')](_0x36ee('0x16'),_0x3b2355,'request\x20sent');_0x401009(_0x232119[_0x36ee('0x19')][_0x36ee('0x17')]);}})[_0x36ee('0x1a')](function(_0x2825f9){logger[_0x36ee('0x14')]('Dashboard,\x20%s,\x20%s',_0x3b2355,_0x2825f9);_0x1ceb4f(_0x2825f9);});});} \ No newline at end of file +var _0x46ea=['request','Dashboard,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./dashboard.socket'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x46ea,0x158));var _0xa46e=function(_0x3f1229,_0x212bdb){_0x3f1229=_0x3f1229-0x0;var _0x1c7758=_0x46ea[_0x3f1229];return _0x1c7758;};'use strict';var _=require(_0xa46e('0x0'));var util=require(_0xa46e('0x1'));var moment=require(_0xa46e('0x2'));var BPromise=require(_0xa46e('0x3'));var rs=require(_0xa46e('0x4'));var fs=require('fs');var Redis=require(_0xa46e('0x5'));var db=require(_0xa46e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa46e('0x7'));var jayson=require(_0xa46e('0x8'));var client=jayson[_0xa46e('0x9')][_0xa46e('0xa')]({'port':0x232a});config['redis']=_[_0xa46e('0xb')](config[_0xa46e('0xc')],{'host':_0xa46e('0xd'),'port':0x18eb});var socket=require(_0xa46e('0xe'))(new Redis(config['redis']));require(_0xa46e('0xf'))['register'](socket);function respondWithRpcPromise(_0x27e071,_0x48398d,_0x2840af){return new BPromise(function(_0x2fa941,_0x405ea9){return client[_0xa46e('0x10')](_0x27e071,_0x2840af)['then'](function(_0x3bd48e){logger['info'](_0xa46e('0x11'),_0x48398d,_0xa46e('0x12'));logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x48398d,_0xa46e('0x12'),JSON[_0xa46e('0x13')](_0x3bd48e));if(_0x3bd48e[_0xa46e('0x14')]){if(_0x3bd48e[_0xa46e('0x14')]['code']===0x1f4){logger[_0xa46e('0x14')](_0xa46e('0x11'),_0x48398d,_0x3bd48e[_0xa46e('0x14')]['message']);return _0x405ea9(_0x3bd48e[_0xa46e('0x14')][_0xa46e('0x15')]);}logger[_0xa46e('0x14')](_0xa46e('0x11'),_0x48398d,_0x3bd48e[_0xa46e('0x14')]['message']);return _0x2fa941(_0x3bd48e['error'][_0xa46e('0x15')]);}else{logger[_0xa46e('0x16')](_0xa46e('0x11'),_0x48398d,_0xa46e('0x12'));_0x2fa941(_0x3bd48e['result'][_0xa46e('0x15')]);}})[_0xa46e('0x17')](function(_0x2cbc1a){logger[_0xa46e('0x14')](_0xa46e('0x11'),_0x48398d,_0x2cbc1a);_0x405ea9(_0x2cbc1a);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 4ee6ed2..bd8cc65 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 _0x4ee6=['length','dashboard:','./dashboard.events','save','remove','emit','removeListener'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x4ee6,0x17c));var _0x64ee=function(_0x38d30f,_0x2f7a7f){_0x38d30f=_0x38d30f-0x0;var _0xfddff0=_0x4ee6[_0x38d30f];return _0xfddff0;};'use strict';var DashboardEvents=require(_0x64ee('0x0'));var events=[_0x64ee('0x1'),_0x64ee('0x2'),'update'];function createListener(_0x290a6f,_0x598389){return function(_0x216e58){_0x598389[_0x64ee('0x3')](_0x290a6f,_0x216e58);};}function removeListener(_0x586849,_0x4e1363){return function(){DashboardEvents[_0x64ee('0x4')](_0x586849,_0x4e1363);};}exports['register']=function(_0x16719a){for(var _0x40b9f9=0x0,_0x502f7f=events[_0x64ee('0x5')];_0x40b9f9<_0x502f7f;_0x40b9f9++){var _0x854f4=events[_0x40b9f9];var _0xaee215=createListener(_0x64ee('0x6')+_0x854f4,_0x16719a);DashboardEvents['on'](_0x854f4,_0xaee215);}}; \ No newline at end of file +var _0x1a70=['length','dashboard:','./dashboard.events','save','remove','emit','removeListener'];(function(_0x1c617b,_0x55e4c5){var _0x53746f=function(_0x47b22c){while(--_0x47b22c){_0x1c617b['push'](_0x1c617b['shift']());}};_0x53746f(++_0x55e4c5);}(_0x1a70,0xaa));var _0x01a7=function(_0x26a9ad,_0x11a04f){_0x26a9ad=_0x26a9ad-0x0;var _0x31d9bc=_0x1a70[_0x26a9ad];return _0x31d9bc;};'use strict';var DashboardEvents=require(_0x01a7('0x0'));var events=[_0x01a7('0x1'),_0x01a7('0x2'),'update'];function createListener(_0x469834,_0x493efc){return function(_0x27559e){_0x493efc[_0x01a7('0x3')](_0x469834,_0x27559e);};}function removeListener(_0x1a6944,_0x480c67){return function(){DashboardEvents[_0x01a7('0x4')](_0x1a6944,_0x480c67);};}exports['register']=function(_0x2e2e8a){for(var _0x119c9f=0x0,_0x14379e=events[_0x01a7('0x5')];_0x119c9f<_0x14379e;_0x119c9f++){var _0x31ffb9=events[_0x119c9f];var _0x4592bd=createListener(_0x01a7('0x6')+_0x31ffb9,_0x2e2e8a);DashboardEvents['on'](_0x31ffb9,_0x4592bd);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 6935339..0aeac0f 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 _0xf7da=['addItem','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone'];(function(_0x4adbbf,_0xd3383b){var _0x530f27=function(_0x2ddb40){while(--_0x2ddb40){_0x4adbbf['push'](_0x4adbbf['shift']());}};_0x530f27(++_0xd3383b);}(_0xf7da,0x9c));var _0xaf7d=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf7da[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0xaf7d('0x0'));var path=require(_0xaf7d('0x1'));var timeout=require(_0xaf7d('0x2'));var express=require(_0xaf7d('0x3'));var router=express[_0xaf7d('0x4')]();var auth=require(_0xaf7d('0x5'));var interaction=require(_0xaf7d('0x6'));var config=require('../../config/environment');var controller=require(_0xaf7d('0x7'));router[_0xaf7d('0x8')]('/',auth[_0xaf7d('0x9')](),controller[_0xaf7d('0xa')]);router[_0xaf7d('0x8')](_0xaf7d('0xb'),auth[_0xaf7d('0x9')](),controller[_0xaf7d('0xc')]);router[_0xaf7d('0x8')](_0xaf7d('0xd'),auth[_0xaf7d('0x9')](),controller[_0xaf7d('0xe')]);router[_0xaf7d('0xf')]('/',auth[_0xaf7d('0x9')](),controller[_0xaf7d('0x10')]);router['post'](_0xaf7d('0x11'),auth['isAuthenticated'](),controller[_0xaf7d('0x12')]);router[_0xaf7d('0xf')]('/:id/items',auth[_0xaf7d('0x9')](),controller[_0xaf7d('0x13')]);router[_0xaf7d('0x14')](_0xaf7d('0xb'),auth[_0xaf7d('0x9')](),controller[_0xaf7d('0x15')]);router[_0xaf7d('0x16')](_0xaf7d('0xb'),auth[_0xaf7d('0x9')](),controller[_0xaf7d('0x17')]);module[_0xaf7d('0x18')]=router; \ No newline at end of file +var _0x45f9=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','getItems','post','create','/:id/clone','clone','update','delete','destroy','exports','connect-timeout'];(function(_0x40e7e6,_0x5529d5){var _0x15c906=function(_0x4ce6c4){while(--_0x4ce6c4){_0x40e7e6['push'](_0x40e7e6['shift']());}};_0x15c906(++_0x5529d5);}(_0x45f9,0x164));var _0x945f=function(_0x262a31,_0x559d3f){_0x262a31=_0x262a31-0x0;var _0x220d2e=_0x45f9[_0x262a31];return _0x220d2e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x945f('0x0'));var express=require(_0x945f('0x1'));var router=express[_0x945f('0x2')]();var auth=require(_0x945f('0x3'));var interaction=require(_0x945f('0x4'));var config=require(_0x945f('0x5'));var controller=require(_0x945f('0x6'));router[_0x945f('0x7')]('/',auth[_0x945f('0x8')](),controller[_0x945f('0x9')]);router[_0x945f('0x7')](_0x945f('0xa'),auth[_0x945f('0x8')](),controller[_0x945f('0xb')]);router[_0x945f('0x7')]('/:id/items',auth[_0x945f('0x8')](),controller[_0x945f('0xc')]);router[_0x945f('0xd')]('/',auth[_0x945f('0x8')](),controller[_0x945f('0xe')]);router[_0x945f('0xd')](_0x945f('0xf'),auth['isAuthenticated'](),controller[_0x945f('0x10')]);router[_0x945f('0xd')]('/:id/items',auth[_0x945f('0x8')](),controller['addItem']);router['put'](_0x945f('0xa'),auth[_0x945f('0x8')](),controller[_0x945f('0x11')]);router[_0x945f('0x12')](_0x945f('0xa'),auth[_0x945f('0x8')](),controller[_0x945f('0x13')]);module[_0x945f('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 005878b..fec4474 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 _0x3b32=['stringify','INTEGER','#ffffff','#2196f3','exports','STRING','TEXT','long','getDataValue','attrs','setDataValue'];(function(_0xdff763,_0x477c10){var _0x99390e=function(_0x344514){while(--_0x344514){_0xdff763['push'](_0xdff763['shift']());}};_0x99390e(++_0x477c10);}(_0x3b32,0x143));var _0x23b3=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x3b32[_0x1203f];return _0x365f0a;};'use strict';var Sequelize=require('sequelize');var squel=require('squel');var _=require('lodash');module[_0x23b3('0x0')]={'title':{'type':Sequelize[_0x23b3('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x23b3('0x1')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x23b3('0x2')](_0x23b3('0x3')),'get':function(){try{return JSON['parse'](this[_0x23b3('0x4')](_0x23b3('0x5')));}catch(_0x2d1355){return[];}},'set':function(_0x23004a){try{this[_0x23b3('0x6')](_0x23b3('0x5'),JSON[_0x23b3('0x7')](_0x23004a));}catch(_0x23fe8e){this[_0x23b3('0x6')]('attrs',JSON[_0x23b3('0x7')]([]));}}},'sizeX':{'type':Sequelize[_0x23b3('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x23b3('0x8')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x23b3('0x8')]},'col':{'type':Sequelize[_0x23b3('0x8')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x23b3('0x9'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x23b3('0x1')],'allowNull':![],'defaultValue':_0x23b3('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x23b3('0x1')]}}; \ No newline at end of file +var _0x1382=['attrs','setDataValue','stringify','INTEGER','#2196f3','squel','lodash','exports','STRING','TEXT','long','parse','getDataValue'];(function(_0x17c6b5,_0x584021){var _0x4d9623=function(_0x44eb12){while(--_0x44eb12){_0x17c6b5['push'](_0x17c6b5['shift']());}};_0x4d9623(++_0x584021);}(_0x1382,0xbb));var _0x2138=function(_0x2ec2d1,_0x13376b){_0x2ec2d1=_0x2ec2d1-0x0;var _0x14b759=_0x1382[_0x2ec2d1];return _0x14b759;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x2138('0x0'));var _=require(_0x2138('0x1'));module[_0x2138('0x2')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2138('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x2138('0x4')](_0x2138('0x5')),'get':function(){try{return JSON[_0x2138('0x6')](this[_0x2138('0x7')](_0x2138('0x8')));}catch(_0x3b7d79){return[];}},'set':function(_0x1fc676){try{this[_0x2138('0x9')](_0x2138('0x8'),JSON['stringify'](_0x1fc676));}catch(_0x3d0fc5){this[_0x2138('0x9')](_0x2138('0x8'),JSON[_0x2138('0xa')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x2138('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x2138('0xb')]},'col':{'type':Sequelize[_0x2138('0xb')]},'background':{'type':Sequelize[_0x2138('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2138('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x2138('0x3')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 6031b81..107d1bf 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 _0xb10b=['rawAttributes','filters','query','attributes','fields','length','includeAll','merge','options','find','catch','iframe','attrUrl','attrs','https://','custom','value','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./dashboardItem.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','error','name','send','show','params','model','keys','DashboardItem'];(function(_0x51ad9e,_0x3f979b){var _0x15064e=function(_0x436774){while(--_0x436774){_0x51ad9e['push'](_0x51ad9e['shift']());}};_0x15064e(++_0x3f979b);}(_0xb10b,0x12a));var _0xbb10=function(_0x57f785,_0x1b4f18){_0x57f785=_0x57f785-0x0;var _0x5a5eb4=_0xb10b[_0x57f785];return _0x5a5eb4;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var qs=require(_0xbb10('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xbb10('0x14'));var config=require(_0xbb10('0x15'));var db=require(_0xbb10('0x16'))['db'];config['redis']=_[_0xbb10('0x17')](config['redis'],{'host':_0xbb10('0x18'),'port':0x18eb});var socket=require(_0xbb10('0x19'))(new Redis(config[_0xbb10('0x1a')]));require(_0xbb10('0x1b'))[_0xbb10('0x1c')](socket);function respondWithStatusCode(_0x147230,_0x58a612){_0x58a612=_0x58a612||0xcc;return function(_0x26e021){if(_0x26e021){return _0x147230[_0xbb10('0x1d')](_0x58a612);}return _0x147230[_0xbb10('0x1e')](_0x58a612)[_0xbb10('0x1f')]();};}function respondWithResult(_0x3df17b,_0x2f2ebf){_0x2f2ebf=_0x2f2ebf||0xc8;return function(_0x24a57b){if(_0x24a57b){return _0x3df17b[_0xbb10('0x1e')](_0x2f2ebf)[_0xbb10('0x20')](_0x24a57b);}};}function respondWithFilteredResult(_0x2b184e,_0x4a2bfc){return function(_0x2eca0f){if(_0x2eca0f){var _0x1145f1=_0x2eca0f[_0xbb10('0x21')],_0x133ac2=_0x4a2bfc[_0xbb10('0x22')],_0x42db98=_0x4a2bfc[_0xbb10('0x22')]+_0x4a2bfc[_0xbb10('0x23')],_0x378da8;if(_0x42db98>=_0x1145f1){_0x42db98=_0x1145f1;_0x378da8=0xc8;}else{_0x378da8=0xce;}_0x2b184e[_0xbb10('0x1e')](_0x378da8);return _0x2b184e['set'](_0xbb10('0x24'),_0x133ac2+'-'+_0x42db98+'/'+_0x1145f1)[_0xbb10('0x20')](_0x2eca0f);}return null;};}function patchUpdates(_0x388fab){return function(_0x109908){try{jsonpatch[_0xbb10('0x25')](_0x109908,_0x388fab,!![]);}catch(_0x44e563){return BPromise['reject'](_0x44e563);}return _0x109908[_0xbb10('0x26')]();};}function saveUpdates(_0x12ef77,_0x50aea1){return function(_0x4c4b0d){if(_0x4c4b0d){return _0x4c4b0d[_0xbb10('0x27')](_0x12ef77)[_0xbb10('0x28')](function(_0x2e911d){return _0x2e911d;});}return null;};}function removeEntity(_0x317da4,_0x445761){return function(_0x1824b7){if(_0x1824b7){return _0x1824b7[_0xbb10('0x29')]()[_0xbb10('0x28')](function(){_0x317da4[_0xbb10('0x1e')](0xcc)[_0xbb10('0x1f')]();});}};}function handleEntityNotFound(_0x3ba6cd,_0x26ad93){return function(_0x537898){if(!_0x537898){_0x3ba6cd['sendStatus'](0x194);}return _0x537898;};}function handleError(_0x4fb5e0,_0xc93a04){_0xc93a04=_0xc93a04||0x1f4;return function(_0x3c5ae7){logger[_0xbb10('0x2a')](_0x3c5ae7['stack']);if(_0x3c5ae7[_0xbb10('0x2b')]){delete _0x3c5ae7[_0xbb10('0x2b')];}_0x4fb5e0[_0xbb10('0x1e')](_0xc93a04)[_0xbb10('0x2c')](_0x3c5ae7);};}exports[_0xbb10('0x2d')]=function(_0x20d946,_0x2a0e8b){var _0x4aabb9={'raw':![],'where':{'id':_0x20d946[_0xbb10('0x2e')]['id']}},_0x3796c7={};_0x3796c7[_0xbb10('0x2f')]=_[_0xbb10('0x30')](db[_0xbb10('0x31')][_0xbb10('0x32')]);_0x3796c7['query']=_[_0xbb10('0x30')](_0x20d946['query']);_0x3796c7[_0xbb10('0x33')]=_['intersection'](_0x3796c7[_0xbb10('0x2f')],_0x3796c7[_0xbb10('0x34')]);_0x4aabb9[_0xbb10('0x35')]=_['intersection'](_0x3796c7['model'],qs[_0xbb10('0x36')](_0x20d946[_0xbb10('0x34')]['fields']));_0x4aabb9[_0xbb10('0x35')]=_0x4aabb9[_0xbb10('0x35')][_0xbb10('0x37')]?_0x4aabb9[_0xbb10('0x35')]:_0x3796c7[_0xbb10('0x2f')];if(_0x20d946[_0xbb10('0x34')][_0xbb10('0x38')]){_0x4aabb9['include']=[{'all':!![]}];}_0x4aabb9=_[_0xbb10('0x39')]({},_0x4aabb9,_0x20d946[_0xbb10('0x3a')]);return db[_0xbb10('0x31')][_0xbb10('0x3b')](_0x4aabb9)[_0xbb10('0x28')](handleEntityNotFound(_0x2a0e8b,null))[_0xbb10('0x28')](respondWithResult(_0x2a0e8b,null))[_0xbb10('0x3c')](handleError(_0x2a0e8b,null));};exports[_0xbb10('0x29')]=function(_0x3c8d7d,_0x56943c){return db[_0xbb10('0x31')][_0xbb10('0x3b')]({'where':{'id':_0x3c8d7d[_0xbb10('0x2e')]['id']}})[_0xbb10('0x28')](handleEntityNotFound(_0x56943c,null))['then'](removeEntity(_0x56943c,null))[_0xbb10('0x3c')](handleError(_0x56943c,null));};function widgetAttributes(_0x5de37b){try{switch(_0x5de37b['type']){case _0xbb10('0x3d'):return[{'name':_0xbb10('0x3e'),'value':_0x5de37b[_0xbb10('0x3e')]||(_0x5de37b[_0xbb10('0x3f')]&&_0x5de37b[_0xbb10('0x3f')][0x0]?_0x5de37b[_0xbb10('0x3f')][0x0]['value']:undefined)||_0xbb10('0x40')}];case _0xbb10('0x41'):return[{'name':'attrPath','value':_0x5de37b['attrPath']||(_0x5de37b['attrs']&&_0x5de37b[_0xbb10('0x3f')][0x0]?_0x5de37b[_0xbb10('0x3f')][0x0][_0xbb10('0x42')]:undefined)||''}];case'clock':return[{'name':_0xbb10('0x43'),'value':_0x5de37b[_0xbb10('0x43')]||(_0x5de37b[_0xbb10('0x3f')]&&_0x5de37b['attrs'][0x0]?_0x5de37b[_0xbb10('0x3f')][0x0][_0xbb10('0x42')]:undefined)||_0xbb10('0x44')},{'name':_0xbb10('0x45'),'value':_0x5de37b['attrTimezone']||(_0x5de37b[_0xbb10('0x3f')]&&_0x5de37b[_0xbb10('0x3f')][0x1]?_0x5de37b['attrs'][0x1][_0xbb10('0x42')]:undefined)||_0xbb10('0x46')},{'name':_0xbb10('0x47'),'value':_0x5de37b[_0xbb10('0x47')]||(_0x5de37b[_0xbb10('0x3f')]&&_0x5de37b[_0xbb10('0x3f')][0x2]?_0x5de37b['attrs'][0x2][_0xbb10('0x42')]:undefined)||0xc}];case _0xbb10('0x48'):return[{'name':_0xbb10('0x49'),'value':_0x5de37b[_0xbb10('0x49')]||(_0x5de37b['attrs']&&_0x5de37b[_0xbb10('0x3f')][0x0]?_0x5de37b[_0xbb10('0x3f')][0x0][_0xbb10('0x42')]:undefined)||_0xbb10('0x4a')},{'name':'attrVoiceQueues','value':_0x5de37b[_0xbb10('0x4b')]||(_0x5de37b[_0xbb10('0x3f')]&&_0x5de37b['attrs'][0x1]?_0x5de37b['attrs'][0x1][_0xbb10('0x42')]:undefined)||[]},{'name':'attrFontSize','value':_0x5de37b[_0xbb10('0x47')]||(_0x5de37b[_0xbb10('0x3f')]&&_0x5de37b['attrs'][0x2]?_0x5de37b[_0xbb10('0x3f')][0x2][_0xbb10('0x42')]:undefined)||0x14}];case _0xbb10('0x4c'):case'pie-chart':return[{'name':_0xbb10('0x4d'),'value':_0x5de37b[_0xbb10('0x4d')]||(_0x5de37b[_0xbb10('0x3f')]&&_0x5de37b[_0xbb10('0x3f')][0x0]?_0x5de37b[_0xbb10('0x3f')][0x0][_0xbb10('0x42')]:undefined)||_0xbb10('0x4a')},{'name':_0xbb10('0x4e'),'value':_0x5de37b[_0xbb10('0x4e')]||(_0x5de37b[_0xbb10('0x3f')]&&_0x5de37b[_0xbb10('0x3f')][0x1]?_0x5de37b[_0xbb10('0x3f')][0x1]['value']:undefined)||null},{'name':_0xbb10('0x4f'),'value':_0x5de37b[_0xbb10('0x4f')]||(_0x5de37b['attrs']&&_0x5de37b[_0xbb10('0x3f')][0x2]?_0x5de37b[_0xbb10('0x3f')][0x2][_0xbb10('0x42')]:undefined)||null},{'name':_0xbb10('0x4b'),'value':_0x5de37b[_0xbb10('0x4b')]||(_0x5de37b[_0xbb10('0x3f')]&&_0x5de37b[_0xbb10('0x3f')][0x3]?_0x5de37b['attrs'][0x3]['value']:undefined)||[]}];case _0xbb10('0x50'):return[{'name':_0xbb10('0x51'),'type':_0x5de37b[_0xbb10('0x52')]||null,'value':_0x5de37b['attrReport']||(_0x5de37b['attrs']&&_0x5de37b[_0xbb10('0x3f')][0x0]?_0x5de37b[_0xbb10('0x3f')][0x0][_0xbb10('0x42')]:undefined)||null},{'name':_0xbb10('0x53'),'value':_0x5de37b[_0xbb10('0x53')]||(_0x5de37b[_0xbb10('0x3f')]&&_0x5de37b[_0xbb10('0x3f')][0x1]?_0x5de37b[_0xbb10('0x3f')][0x1][_0xbb10('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x3d7e7e){logger['error']('widgetAttributes:\x20%s',JSON[_0xbb10('0x54')](_0x3d7e7e));return[];}}exports[_0xbb10('0x55')]=function(_0x36ab7d,_0xb014b0){if(_0x36ab7d[_0xbb10('0x56')]){_0x36ab7d[_0xbb10('0x56')][_0xbb10('0x3f')]=widgetAttributes(_0x36ab7d[_0xbb10('0x56')]);}return db[_0xbb10('0x31')][_0xbb10('0x55')](_0x36ab7d[_0xbb10('0x56')],{})[_0xbb10('0x28')](respondWithResult(_0xb014b0,0xc9))[_0xbb10('0x3c')](handleError(_0xb014b0,null));};exports[_0xbb10('0x27')]=function(_0x1d15f4,_0x547a7a){if(_0x1d15f4[_0xbb10('0x56')]['id']){delete _0x1d15f4['body']['id'];}_0x1d15f4[_0xbb10('0x56')][_0xbb10('0x3f')]=widgetAttributes(_0x1d15f4[_0xbb10('0x56')]);return db[_0xbb10('0x31')][_0xbb10('0x3b')]({'where':{'id':_0x1d15f4[_0xbb10('0x2e')]['id']}})[_0xbb10('0x28')](handleEntityNotFound(_0x547a7a,null))[_0xbb10('0x28')](saveUpdates(_0x1d15f4[_0xbb10('0x56')],null))[_0xbb10('0x28')](respondWithResult(_0x547a7a,null))[_0xbb10('0x3c')](handleError(_0x547a7a,null));}; \ No newline at end of file +var _0xa9e0=['intersection','fields','length','includeAll','include','merge','find','catch','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','create','body','update','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','params','model','keys','DashboardItem','query','filters','attributes'];(function(_0x12c7a9,_0x58f1f3){var _0x534626=function(_0x1b4d1f){while(--_0x1b4d1f){_0x12c7a9['push'](_0x12c7a9['shift']());}};_0x534626(++_0x58f1f3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var qs=require(_0x0a9e('0xf'));var logger=require(_0x0a9e('0x10'))(_0x0a9e('0x11'));var utils=require(_0x0a9e('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x0a9e('0x13')],{'host':_0x0a9e('0x14'),'port':0x18eb});var socket=require(_0x0a9e('0x15'))(new Redis(config[_0x0a9e('0x13')]));require(_0x0a9e('0x16'))[_0x0a9e('0x17')](socket);function respondWithStatusCode(_0x5db4b0,_0x4283ce){_0x4283ce=_0x4283ce||0xcc;return function(_0x239b12){if(_0x239b12){return _0x5db4b0[_0x0a9e('0x18')](_0x4283ce);}return _0x5db4b0[_0x0a9e('0x19')](_0x4283ce)[_0x0a9e('0x1a')]();};}function respondWithResult(_0x4d5611,_0x52a03d){_0x52a03d=_0x52a03d||0xc8;return function(_0x22dccb){if(_0x22dccb){return _0x4d5611['status'](_0x52a03d)[_0x0a9e('0x1b')](_0x22dccb);}};}function respondWithFilteredResult(_0x519dfd,_0x16033c){return function(_0x12066b){if(_0x12066b){var _0x48f32d=_0x12066b[_0x0a9e('0x1c')],_0x225616=_0x16033c[_0x0a9e('0x1d')],_0x5a0a06=_0x16033c[_0x0a9e('0x1d')]+_0x16033c[_0x0a9e('0x1e')],_0x459eb1;if(_0x5a0a06>=_0x48f32d){_0x5a0a06=_0x48f32d;_0x459eb1=0xc8;}else{_0x459eb1=0xce;}_0x519dfd[_0x0a9e('0x19')](_0x459eb1);return _0x519dfd[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x225616+'-'+_0x5a0a06+'/'+_0x48f32d)[_0x0a9e('0x1b')](_0x12066b);}return null;};}function patchUpdates(_0x112016){return function(_0x1c696a){try{jsonpatch[_0x0a9e('0x21')](_0x1c696a,_0x112016,!![]);}catch(_0x4bb1e3){return BPromise[_0x0a9e('0x22')](_0x4bb1e3);}return _0x1c696a[_0x0a9e('0x23')]();};}function saveUpdates(_0x53682f,_0x20f109){return function(_0x5a09ef){if(_0x5a09ef){return _0x5a09ef['update'](_0x53682f)[_0x0a9e('0x24')](function(_0x432e56){return _0x432e56;});}return null;};}function removeEntity(_0x38e7c4,_0x30bae6){return function(_0x4abc77){if(_0x4abc77){return _0x4abc77[_0x0a9e('0x25')]()[_0x0a9e('0x24')](function(){_0x38e7c4[_0x0a9e('0x19')](0xcc)[_0x0a9e('0x1a')]();});}};}function handleEntityNotFound(_0x370d86,_0x42ac8f){return function(_0x16b1ca){if(!_0x16b1ca){_0x370d86['sendStatus'](0x194);}return _0x16b1ca;};}function handleError(_0x59181e,_0x197ec0){_0x197ec0=_0x197ec0||0x1f4;return function(_0x3a8e58){logger[_0x0a9e('0x26')](_0x3a8e58[_0x0a9e('0x27')]);if(_0x3a8e58['name']){delete _0x3a8e58[_0x0a9e('0x28')];}_0x59181e['status'](_0x197ec0)[_0x0a9e('0x29')](_0x3a8e58);};}exports['show']=function(_0x1dc186,_0x34dc65){var _0x25fba9={'raw':![],'where':{'id':_0x1dc186[_0x0a9e('0x2a')]['id']}},_0x14433c={};_0x14433c[_0x0a9e('0x2b')]=_[_0x0a9e('0x2c')](db[_0x0a9e('0x2d')]['rawAttributes']);_0x14433c[_0x0a9e('0x2e')]=_[_0x0a9e('0x2c')](_0x1dc186[_0x0a9e('0x2e')]);_0x14433c[_0x0a9e('0x2f')]=_['intersection'](_0x14433c[_0x0a9e('0x2b')],_0x14433c[_0x0a9e('0x2e')]);_0x25fba9[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x14433c[_0x0a9e('0x2b')],qs[_0x0a9e('0x32')](_0x1dc186[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x25fba9[_0x0a9e('0x30')]=_0x25fba9['attributes'][_0x0a9e('0x33')]?_0x25fba9['attributes']:_0x14433c[_0x0a9e('0x2b')];if(_0x1dc186[_0x0a9e('0x2e')][_0x0a9e('0x34')]){_0x25fba9[_0x0a9e('0x35')]=[{'all':!![]}];}_0x25fba9=_[_0x0a9e('0x36')]({},_0x25fba9,_0x1dc186['options']);return db[_0x0a9e('0x2d')][_0x0a9e('0x37')](_0x25fba9)[_0x0a9e('0x24')](handleEntityNotFound(_0x34dc65,null))[_0x0a9e('0x24')](respondWithResult(_0x34dc65,null))[_0x0a9e('0x38')](handleError(_0x34dc65,null));};exports[_0x0a9e('0x25')]=function(_0x332d35,_0x39e565){return db['DashboardItem'][_0x0a9e('0x37')]({'where':{'id':_0x332d35['params']['id']}})[_0x0a9e('0x24')](handleEntityNotFound(_0x39e565,null))[_0x0a9e('0x24')](removeEntity(_0x39e565,null))[_0x0a9e('0x38')](handleError(_0x39e565,null));};function widgetAttributes(_0x3f3d41){try{switch(_0x3f3d41['type']){case _0x0a9e('0x39'):return[{'name':_0x0a9e('0x3a'),'value':_0x3f3d41[_0x0a9e('0x3a')]||(_0x3f3d41[_0x0a9e('0x3b')]&&_0x3f3d41['attrs'][0x0]?_0x3f3d41['attrs'][0x0][_0x0a9e('0x3c')]:undefined)||'https://'}];case _0x0a9e('0x3d'):return[{'name':_0x0a9e('0x3e'),'value':_0x3f3d41[_0x0a9e('0x3e')]||(_0x3f3d41[_0x0a9e('0x3b')]&&_0x3f3d41['attrs'][0x0]?_0x3f3d41[_0x0a9e('0x3b')][0x0][_0x0a9e('0x3c')]:undefined)||''}];case _0x0a9e('0x3f'):return[{'name':'attrHourFormat','value':_0x3f3d41[_0x0a9e('0x40')]||(_0x3f3d41[_0x0a9e('0x3b')]&&_0x3f3d41[_0x0a9e('0x3b')][0x0]?_0x3f3d41['attrs'][0x0]['value']:undefined)||_0x0a9e('0x41')},{'name':_0x0a9e('0x42'),'value':_0x3f3d41['attrTimezone']||(_0x3f3d41[_0x0a9e('0x3b')]&&_0x3f3d41[_0x0a9e('0x3b')][0x1]?_0x3f3d41[_0x0a9e('0x3b')][0x1][_0x0a9e('0x3c')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x3f3d41[_0x0a9e('0x43')]||(_0x3f3d41[_0x0a9e('0x3b')]&&_0x3f3d41['attrs'][0x2]?_0x3f3d41[_0x0a9e('0x3b')][0x2][_0x0a9e('0x3c')]:undefined)||0xc}];case _0x0a9e('0x44'):return[{'name':'attrMetric','value':_0x3f3d41[_0x0a9e('0x45')]||(_0x3f3d41[_0x0a9e('0x3b')]&&_0x3f3d41[_0x0a9e('0x3b')][0x0]?_0x3f3d41[_0x0a9e('0x3b')][0x0][_0x0a9e('0x3c')]:undefined)||_0x0a9e('0x46')},{'name':_0x0a9e('0x47'),'value':_0x3f3d41[_0x0a9e('0x47')]||(_0x3f3d41[_0x0a9e('0x3b')]&&_0x3f3d41[_0x0a9e('0x3b')][0x1]?_0x3f3d41[_0x0a9e('0x3b')][0x1][_0x0a9e('0x3c')]:undefined)||[]},{'name':_0x0a9e('0x43'),'value':_0x3f3d41[_0x0a9e('0x43')]||(_0x3f3d41[_0x0a9e('0x3b')]&&_0x3f3d41['attrs'][0x2]?_0x3f3d41['attrs'][0x2][_0x0a9e('0x3c')]:undefined)||0x14}];case _0x0a9e('0x48'):case _0x0a9e('0x49'):return[{'name':_0x0a9e('0x4a'),'value':_0x3f3d41[_0x0a9e('0x4a')]||(_0x3f3d41[_0x0a9e('0x3b')]&&_0x3f3d41[_0x0a9e('0x3b')][0x0]?_0x3f3d41[_0x0a9e('0x3b')][0x0][_0x0a9e('0x3c')]:undefined)||_0x0a9e('0x46')},{'name':_0x0a9e('0x4b'),'value':_0x3f3d41[_0x0a9e('0x4b')]||(_0x3f3d41['attrs']&&_0x3f3d41[_0x0a9e('0x3b')][0x1]?_0x3f3d41[_0x0a9e('0x3b')][0x1][_0x0a9e('0x3c')]:undefined)||null},{'name':_0x0a9e('0x4c'),'value':_0x3f3d41[_0x0a9e('0x4c')]||(_0x3f3d41[_0x0a9e('0x3b')]&&_0x3f3d41[_0x0a9e('0x3b')][0x2]?_0x3f3d41[_0x0a9e('0x3b')][0x2]['value']:undefined)||null},{'name':_0x0a9e('0x47'),'value':_0x3f3d41['attrVoiceQueues']||(_0x3f3d41[_0x0a9e('0x3b')]&&_0x3f3d41[_0x0a9e('0x3b')][0x3]?_0x3f3d41[_0x0a9e('0x3b')][0x3]['value']:undefined)||[]}];case _0x0a9e('0x4d'):return[{'name':_0x0a9e('0x4e'),'type':_0x3f3d41[_0x0a9e('0x4f')]||null,'value':_0x3f3d41[_0x0a9e('0x4e')]||(_0x3f3d41[_0x0a9e('0x3b')]&&_0x3f3d41[_0x0a9e('0x3b')][0x0]?_0x3f3d41[_0x0a9e('0x3b')][0x0]['value']:undefined)||null},{'name':_0x0a9e('0x50'),'value':_0x3f3d41[_0x0a9e('0x50')]||(_0x3f3d41[_0x0a9e('0x3b')]&&_0x3f3d41[_0x0a9e('0x3b')][0x1]?_0x3f3d41[_0x0a9e('0x3b')][0x1][_0x0a9e('0x3c')]:undefined)||0x0}];default:return[];}}catch(_0x6054ee){logger[_0x0a9e('0x26')](_0x0a9e('0x51'),JSON['stringify'](_0x6054ee));return[];}}exports[_0x0a9e('0x52')]=function(_0x3fe430,_0x4f7240){if(_0x3fe430['body']){_0x3fe430['body'][_0x0a9e('0x3b')]=widgetAttributes(_0x3fe430[_0x0a9e('0x53')]);}return db[_0x0a9e('0x2d')][_0x0a9e('0x52')](_0x3fe430[_0x0a9e('0x53')],{})[_0x0a9e('0x24')](respondWithResult(_0x4f7240,0xc9))[_0x0a9e('0x38')](handleError(_0x4f7240,null));};exports[_0x0a9e('0x54')]=function(_0x5d38ae,_0x4b1b9f){if(_0x5d38ae['body']['id']){delete _0x5d38ae[_0x0a9e('0x53')]['id'];}_0x5d38ae[_0x0a9e('0x53')][_0x0a9e('0x3b')]=widgetAttributes(_0x5d38ae['body']);return db[_0x0a9e('0x2d')][_0x0a9e('0x37')]({'where':{'id':_0x5d38ae['params']['id']}})['then'](handleEntityNotFound(_0x4b1b9f,null))[_0x0a9e('0x24')](saveUpdates(_0x5d38ae['body'],null))[_0x0a9e('0x24')](respondWithResult(_0x4b1b9f,null))['catch'](handleError(_0x4b1b9f,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 646aea9..030b6f6 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 _0x8e82=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x44ca0c,_0x34c8e0){var _0x15ef12=function(_0x697eb8){while(--_0x697eb8){_0x44ca0c['push'](_0x44ca0c['shift']());}};_0x15ef12(++_0x34c8e0);}(_0x8e82,0x1b5));var _0x28e8=function(_0x1cfdc8,_0x3b59fa){_0x1cfdc8=_0x1cfdc8-0x0;var _0x4f0a53=_0x8e82[_0x1cfdc8];return _0x4f0a53;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x28e8('0x0'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x28e8('0x1')](0x0);var events={'afterCreate':_0x28e8('0x2'),'afterUpdate':_0x28e8('0x3'),'afterDestroy':_0x28e8('0x4')};function emitEvent(_0x4de889){return function(_0x1e156a,_0x4fdb0c,_0x33fd6a){DashboardItemEvents[_0x28e8('0x5')](_0x4de889+':'+_0x1e156a['id'],_0x1e156a);DashboardItemEvents[_0x28e8('0x5')](_0x4de889,_0x1e156a);_0x33fd6a(null);};}for(var e in events){if(events[_0x28e8('0x6')](e)){var event=events[e];DashboardItem[_0x28e8('0x7')](e,emitEvent(event));}}module[_0x28e8('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0xe02c=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x248e9a,_0x47451f){var _0x28b9d9=function(_0x41f4fc){while(--_0x41f4fc){_0x248e9a['push'](_0x248e9a['shift']());}};_0x28b9d9(++_0x47451f);}(_0xe02c,0x1aa));var _0xce02=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe02c[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xce02('0x0'));var DashboardItem=require(_0xce02('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xce02('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xce02('0x3'),'afterDestroy':_0xce02('0x4')};function emitEvent(_0x370d1f){return function(_0x4db24c,_0x3ca15f,_0x516b96){DashboardItemEvents[_0xce02('0x5')](_0x370d1f+':'+_0x4db24c['id'],_0x4db24c);DashboardItemEvents['emit'](_0x370d1f,_0x4db24c);_0x516b96(null);};}for(var e in events){if(events[_0xce02('0x6')](e)){var event=events[e];DashboardItem[_0xce02('0x7')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 0c6a473..a3e93a6 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 _0x7a54=['dashboard_items','lodash','util','../../config/logger','moment','bluebird','./dashboardItem.attributes','exports','define'];(function(_0x32d6fd,_0x2b6541){var _0x548066=function(_0x45798f){while(--_0x45798f){_0x32d6fd['push'](_0x32d6fd['shift']());}};_0x548066(++_0x2b6541);}(_0x7a54,0x106));var _0x47a5=function(_0x49e81b,_0x3e2a2b){_0x49e81b=_0x49e81b-0x0;var _0x5dd3bb=_0x7a54[_0x49e81b];return _0x5dd3bb;};'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 attributes=require(_0x47a5('0x5'));module[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){return _0x2a1a7e[_0x47a5('0x7')]('DashboardItem',attributes,{'tableName':_0x47a5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['dashboard_items','lodash','util','../../config/logger','moment','bluebird','./dashboardItem.attributes','exports','define'];(function(_0x1f0d02,_0x544507){var _0x7cb25=function(_0x12d57b){while(--_0x12d57b){_0x1f0d02['push'](_0x1f0d02['shift']());}};_0x7cb25(++_0x544507);}(_0x7a54,0x106));var _0x47a5=function(_0x2bb105,_0x1d7d6a){_0x2bb105=_0x2bb105-0x0;var _0x2d7328=_0x7a54[_0x2bb105];return _0x2d7328;};'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 attributes=require(_0x47a5('0x5'));module[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){return _0x2a1a7e[_0x47a5('0x7')]('DashboardItem',attributes,{'tableName':_0x47a5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 7664c54..ecf0ab1 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 _0x931f=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util'];(function(_0x2baca1,_0x2f3557){var _0x9aa62a=function(_0x5c47d5){while(--_0x5c47d5){_0x2baca1['push'](_0x2baca1['shift']());}};_0x9aa62a(++_0x2f3557);}(_0x931f,0x133));var _0xf931=function(_0x127187,_0x4f7f5c){_0x127187=_0x127187-0x0;var _0xcb9e8e=_0x931f[_0x127187];return _0xcb9e8e;};'use strict';var _=require('lodash');var util=require(_0xf931('0x0'));var moment=require(_0xf931('0x1'));var BPromise=require(_0xf931('0x2'));var rs=require(_0xf931('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf931('0x4'))['db'];var utils=require(_0xf931('0x5'));var logger=require(_0xf931('0x6'))(_0xf931('0x7'));var config=require(_0xf931('0x8'));var jayson=require(_0xf931('0x9'));var client=jayson['client'][_0xf931('0xa')]({'port':0x232a});config['redis']=_[_0xf931('0xb')](config[_0xf931('0xc')],{'host':_0xf931('0xd'),'port':0x18eb});var socket=require(_0xf931('0xe'))(new Redis(config[_0xf931('0xc')]));require(_0xf931('0xf'))[_0xf931('0x10')](socket);function respondWithRpcPromise(_0x1741b3,_0x32a3de,_0x15d675){return new BPromise(function(_0x4bf66c,_0x161084){return client[_0xf931('0x11')](_0x1741b3,_0x15d675)[_0xf931('0x12')](function(_0x48402b){logger[_0xf931('0x13')](_0xf931('0x14'),_0x32a3de,_0xf931('0x15'));logger[_0xf931('0x16')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x32a3de,_0xf931('0x15'),JSON[_0xf931('0x17')](_0x48402b));if(_0x48402b['error']){if(_0x48402b[_0xf931('0x18')]['code']===0x1f4){logger[_0xf931('0x18')]('DashboardItem,\x20%s,\x20%s',_0x32a3de,_0x48402b[_0xf931('0x18')][_0xf931('0x19')]);return _0x161084(_0x48402b['error'][_0xf931('0x19')]);}logger[_0xf931('0x18')](_0xf931('0x14'),_0x32a3de,_0x48402b['error'][_0xf931('0x19')]);return _0x4bf66c(_0x48402b['error'][_0xf931('0x19')]);}else{logger[_0xf931('0x13')](_0xf931('0x14'),_0x32a3de,_0xf931('0x15'));_0x4bf66c(_0x48402b[_0xf931('0x1a')][_0xf931('0x19')]);}})[_0xf931('0x1b')](function(_0x1820f0){logger[_0xf931('0x18')](_0xf931('0x14'),_0x32a3de,_0x1820f0);_0x161084(_0x1820f0);});});} \ No newline at end of file +var _0x310b=['request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','DashboardItem,\x20%s,\x20%s','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info'];(function(_0x27fb10,_0x1a125f){var _0x567e0c=function(_0x14e4d3){while(--_0x14e4d3){_0x27fb10['push'](_0x27fb10['shift']());}};_0x567e0c(++_0x1a125f);}(_0x310b,0x8f));var _0xb310=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x310b[_0x166742];return _0xb7814a;};'use strict';var _=require(_0xb310('0x0'));var util=require('util');var moment=require(_0xb310('0x1'));var BPromise=require('bluebird');var rs=require(_0xb310('0x2'));var fs=require('fs');var Redis=require(_0xb310('0x3'));var db=require(_0xb310('0x4'))['db'];var utils=require(_0xb310('0x5'));var logger=require('../../config/logger')(_0xb310('0x6'));var config=require(_0xb310('0x7'));var jayson=require(_0xb310('0x8'));var client=jayson[_0xb310('0x9')][_0xb310('0xa')]({'port':0x232a});config[_0xb310('0xb')]=_[_0xb310('0xc')](config[_0xb310('0xb')],{'host':_0xb310('0xd'),'port':0x18eb});var socket=require(_0xb310('0xe'))(new Redis(config[_0xb310('0xb')]));require('./dashboardItem.socket')[_0xb310('0xf')](socket);function respondWithRpcPromise(_0x290829,_0x2889e9,_0x545152){return new BPromise(function(_0x3a09bd,_0x30621b){return client[_0xb310('0x10')](_0x290829,_0x545152)[_0xb310('0x11')](function(_0x206574){logger[_0xb310('0x12')]('DashboardItem,\x20%s,\x20%s',_0x2889e9,_0xb310('0x13'));logger[_0xb310('0x14')](_0xb310('0x15'),_0x2889e9,_0xb310('0x13'),JSON[_0xb310('0x16')](_0x206574));if(_0x206574[_0xb310('0x17')]){if(_0x206574[_0xb310('0x17')]['code']===0x1f4){logger[_0xb310('0x17')](_0xb310('0x18'),_0x2889e9,_0x206574[_0xb310('0x17')][_0xb310('0x19')]);return _0x30621b(_0x206574['error'][_0xb310('0x19')]);}logger['error']('DashboardItem,\x20%s,\x20%s',_0x2889e9,_0x206574[_0xb310('0x17')][_0xb310('0x19')]);return _0x3a09bd(_0x206574[_0xb310('0x17')][_0xb310('0x19')]);}else{logger[_0xb310('0x12')](_0xb310('0x18'),_0x2889e9,_0xb310('0x13'));_0x3a09bd(_0x206574[_0xb310('0x1a')][_0xb310('0x19')]);}})['catch'](function(_0x57556e){logger[_0xb310('0x17')](_0xb310('0x18'),_0x2889e9,_0x57556e);_0x30621b(_0x57556e);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 55b1cc1..f8223a5 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 _0x9957=['register','length','dashboardItem:','./dashboardItem.events','save','remove','update','emit','removeListener'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var DashboardItemEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){DashboardItemEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);DashboardItemEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file +var _0x008c=['./dashboardItem.events','save','remove','update','emit','removeListener','register','dashboardItem:'];(function(_0x5b1f3b,_0x5f2dc3){var _0x216092=function(_0x4d910b){while(--_0x4d910b){_0x5b1f3b['push'](_0x5b1f3b['shift']());}};_0x216092(++_0x5f2dc3);}(_0x008c,0x188));var _0xc008=function(_0x567ad7,_0x4f55e0){_0x567ad7=_0x567ad7-0x0;var _0x338c0e=_0x008c[_0x567ad7];return _0x338c0e;};'use strict';var DashboardItemEvents=require(_0xc008('0x0'));var events=[_0xc008('0x1'),_0xc008('0x2'),_0xc008('0x3')];function createListener(_0x1d119a,_0x544fdf){return function(_0x3641af){_0x544fdf[_0xc008('0x4')](_0x1d119a,_0x3641af);};}function removeListener(_0x10b33c,_0x163bd9){return function(){DashboardItemEvents[_0xc008('0x5')](_0x10b33c,_0x163bd9);};}exports[_0xc008('0x6')]=function(_0x13aa7){for(var _0x39bb5e=0x0,_0x9c8cb2=events['length'];_0x39bb5e<_0x9c8cb2;_0x39bb5e++){var _0x428fa9=events[_0x39bb5e];var _0x5aa09b=createListener(_0xc008('0x7')+_0x428fa9,_0x13aa7);DashboardItemEvents['on'](_0x428fa9,_0x5aa09b);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index c3cf457..80ce4bc 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 _0x507a=['show','post','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','isAuthenticated'];(function(_0x1b3ed9,_0x24dc85){var _0x195485=function(_0xed3f40){while(--_0xed3f40){_0x1b3ed9['push'](_0x1b3ed9['shift']());}};_0x195485(++_0x24dc85);}(_0x507a,0x1a0));var _0xa507=function(_0x27fe9a,_0x2e5387){_0x27fe9a=_0x27fe9a-0x0;var _0x36ce07=_0x507a[_0x27fe9a];return _0x36ce07;};'use strict';var multer=require(_0xa507('0x0'));var util=require('util');var path=require(_0xa507('0x1'));var timeout=require(_0xa507('0x2'));var express=require('express');var router=express[_0xa507('0x3')]();var auth=require(_0xa507('0x4'));var interaction=require(_0xa507('0x5'));var config=require('../../config/environment');var controller=require(_0xa507('0x6'));router[_0xa507('0x7')]('/:id',auth[_0xa507('0x8')](),controller[_0xa507('0x9')]);router[_0xa507('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa507('0xb')](_0xa507('0xc'),auth[_0xa507('0x8')](),controller[_0xa507('0xd')]);router[_0xa507('0xe')](_0xa507('0xc'),auth[_0xa507('0x8')](),controller[_0xa507('0xf')]);module[_0xa507('0x10')]=router; \ No newline at end of file +var _0x39fa=['get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x39fa,0x13d));var _0xa39f=function(_0x2aeba7,_0x9b5e1e){_0x2aeba7=_0x2aeba7-0x0;var _0x4355f3=_0x39fa[_0x2aeba7];return _0x4355f3;};'use strict';var multer=require('multer');var util=require(_0xa39f('0x0'));var path=require(_0xa39f('0x1'));var timeout=require(_0xa39f('0x2'));var express=require(_0xa39f('0x3'));var router=express[_0xa39f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa39f('0x5'));var config=require(_0xa39f('0x6'));var controller=require('./dashboardItem.controller');router[_0xa39f('0x7')](_0xa39f('0x8'),auth[_0xa39f('0x9')](),controller[_0xa39f('0xa')]);router[_0xa39f('0xb')]('/',auth['isAuthenticated'](),controller[_0xa39f('0xc')]);router[_0xa39f('0xd')](_0xa39f('0x8'),auth[_0xa39f('0x9')](),controller[_0xa39f('0xe')]);router[_0xa39f('0xf')](_0xa39f('0x8'),auth[_0xa39f('0x9')](),controller[_0xa39f('0x10')]);module[_0xa39f('0x11')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 903d3d6..a2a7e2d 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 _0x99fe=['STRING','sequelize'];(function(_0x2c7996,_0x1e2bfd){var _0x588ee9=function(_0x3266b0){while(--_0x3266b0){_0x2c7996['push'](_0x2c7996['shift']());}};_0x588ee9(++_0x1e2bfd);}(_0x99fe,0x75));var _0xe99f=function(_0x5c3ea5,_0xa9ed0c){_0x5c3ea5=_0x5c3ea5-0x0;var _0x102b61=_0x99fe[_0x5c3ea5];return _0x102b61;};'use strict';var Sequelize=require(_0xe99f('0x0'));module['exports']={'name':{'type':Sequelize[_0xe99f('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x9810=['exports','sequelize'];(function(_0x14b4b2,_0x42aed0){var _0x2710fd=function(_0x2bb074){while(--_0x2bb074){_0x14b4b2['push'](_0x14b4b2['shift']());}};_0x2710fd(++_0x42aed0);}(_0x9810,0x1bf));var _0x0981=function(_0x3c858f,_0x235201){_0x3c858f=_0x3c858f-0x0;var _0x198090=_0x9810[_0x3c858f];return _0x198090;};'use strict';var Sequelize=require(_0x0981('0x0'));module[_0x0981('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index c600678..96abbc8 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 _0xdaed=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','status','error','stack','name','send','Disposition','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','day','add','merge','filter','count','include','findAll','rows','catch','show','length','options','find','create','body','params','eml-format'];(function(_0x49fc34,_0x119215){var _0x5f4815=function(_0x116b04){while(--_0x116b04){_0x49fc34['push'](_0x49fc34['shift']());}};_0x5f4815(++_0x119215);}(_0xdaed,0x113));var _0xddae=function(_0x548f8d,_0x5d2916){_0x548f8d=_0x548f8d-0x0;var _0x179b6b=_0xdaed[_0x548f8d];return _0x179b6b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xddae('0x0'));var rimraf=require(_0xddae('0x1'));var zipdir=require(_0xddae('0x2'));var jsonpatch=require(_0xddae('0x3'));var rp=require(_0xddae('0x4'));var moment=require(_0xddae('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xddae('0x6'));var util=require(_0xddae('0x7'));var path=require('path');var sox=require(_0xddae('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xddae('0x9'));var squel=require(_0xddae('0xa'));var crypto=require(_0xddae('0xb'));var jsforce=require(_0xddae('0xc'));var deskjs=require(_0xddae('0xd'));var toCsv=require(_0xddae('0xe'));var querystring=require(_0xddae('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xddae('0x10'))(_0xddae('0x11'));var utils=require('../../config/utils');var config=require(_0xddae('0x12'));var db=require(_0xddae('0x13'))['db'];function respondWithStatusCode(_0x3fbb41,_0x4b417f){_0x4b417f=_0x4b417f||0xcc;return function(_0x2d7af8){if(_0x2d7af8){return _0x3fbb41[_0xddae('0x14')](_0x4b417f);}return _0x3fbb41['status'](_0x4b417f)[_0xddae('0x15')]();};}function respondWithResult(_0x35e88f,_0x2e51da){_0x2e51da=_0x2e51da||0xc8;return function(_0x566753){if(_0x566753){return _0x35e88f['status'](_0x2e51da)[_0xddae('0x16')](_0x566753);}};}function respondWithFilteredResult(_0x89d7ad,_0x2fa397){return function(_0xf3b90a){if(_0xf3b90a){var _0x2b41c8=_0xf3b90a['count'],_0x33e985=_0x2fa397[_0xddae('0x17')],_0x37567a=_0x2fa397[_0xddae('0x17')]+_0x2fa397[_0xddae('0x18')],_0x4e29bd;if(_0x37567a>=_0x2b41c8){_0x37567a=_0x2b41c8;_0x4e29bd=0xc8;}else{_0x4e29bd=0xce;}_0x89d7ad['status'](_0x4e29bd);return _0x89d7ad[_0xddae('0x19')](_0xddae('0x1a'),_0x33e985+'-'+_0x37567a+'/'+_0x2b41c8)['json'](_0xf3b90a);}return null;};}function patchUpdates(_0x2c07b9){return function(_0x2ed2e2){try{jsonpatch[_0xddae('0x1b')](_0x2ed2e2,_0x2c07b9,!![]);}catch(_0xd41f6f){return BPromise[_0xddae('0x1c')](_0xd41f6f);}return _0x2ed2e2['save']();};}function saveUpdates(_0x3a8fb9,_0x58e93a){return function(_0x24cb3c){if(_0x24cb3c){return _0x24cb3c[_0xddae('0x1d')](_0x3a8fb9)[_0xddae('0x1e')](function(_0x7488cf){return _0x7488cf;});}return null;};}function removeEntity(_0x35b74c,_0x5c7357){return function(_0x454834){if(_0x454834){return _0x454834[_0xddae('0x1f')]()[_0xddae('0x1e')](function(){_0x35b74c[_0xddae('0x20')](0xcc)[_0xddae('0x15')]();});}};}function handleEntityNotFound(_0x2c555e,_0x27ded1){return function(_0xc7fc52){if(!_0xc7fc52){_0x2c555e[_0xddae('0x14')](0x194);}return _0xc7fc52;};}function handleError(_0x3ba2aa,_0x2c6890){_0x2c6890=_0x2c6890||0x1f4;return function(_0x325ff8){logger[_0xddae('0x21')](_0x325ff8[_0xddae('0x22')]);if(_0x325ff8[_0xddae('0x23')]){delete _0x325ff8[_0xddae('0x23')];}_0x3ba2aa[_0xddae('0x20')](_0x2c6890)[_0xddae('0x24')](_0x325ff8);};}exports['index']=function(_0x36148f,_0x540d75){var _0x26d19b={},_0x44aaf0={},_0x47e95a={'count':0x0,'rows':[]};var _0x466e29=db[_0xddae('0x25')][_0xddae('0x26')];_0x44aaf0[_0xddae('0x27')]=_[_0xddae('0x28')](_0x466e29);var _0x1458bf={'dateStart':_0x36148f[_0xddae('0x29')][_0xddae('0x2a')],'dateEnd':_0x36148f['query'][_0xddae('0x2b')]};delete _0x36148f['query'][_0xddae('0x2a')];delete _0x36148f[_0xddae('0x29')][_0xddae('0x2b')];_0x44aaf0[_0xddae('0x29')]=_[_0xddae('0x28')](_0x36148f[_0xddae('0x29')]);_0x44aaf0[_0xddae('0x2c')]=_[_0xddae('0x2d')](_0x44aaf0[_0xddae('0x27')],_0x44aaf0['query']);_0x26d19b[_0xddae('0x2e')]=_[_0xddae('0x2d')](_0x44aaf0[_0xddae('0x27')],qs[_0xddae('0x2f')](_0x36148f[_0xddae('0x29')][_0xddae('0x2f')]));_0x26d19b['attributes']=_0x26d19b['attributes']['length']?_0x26d19b[_0xddae('0x2e')]:_0x44aaf0[_0xddae('0x27')];if(!_0x36148f[_0xddae('0x29')][_0xddae('0x30')]('nolimit')){_0x26d19b['limit']=qs['limit'](_0x36148f[_0xddae('0x29')][_0xddae('0x18')]);_0x26d19b[_0xddae('0x17')]=qs[_0xddae('0x17')](_0x36148f[_0xddae('0x29')][_0xddae('0x17')]);}_0x26d19b[_0xddae('0x31')]=qs[_0xddae('0x32')](_0x36148f[_0xddae('0x29')][_0xddae('0x32')]);_0x26d19b[_0xddae('0x33')]=qs[_0xddae('0x2c')](_[_0xddae('0x34')](_0x36148f[_0xddae('0x29')],_0x44aaf0[_0xddae('0x2c')]));if(_0x1458bf[_0xddae('0x2a')]){if(_0x1458bf[_0xddae('0x2b')]){_0x1458bf[_0xddae('0x2b')]=moment(_0x1458bf['dateEnd'])['add'](0x1,_0xddae('0x35'));}else{_0x1458bf[_0xddae('0x2b')]=moment(_0x1458bf[_0xddae('0x2a')])[_0xddae('0x36')](0x1,'day');}_[_0xddae('0x37')](_0x26d19b[_0xddae('0x33')],{'createdAt':{'$gte':_0x1458bf[_0xddae('0x2a')],'$lte':_0x1458bf[_0xddae('0x2b')]}});}if(_0x36148f[_0xddae('0x29')][_0xddae('0x38')]){_0x26d19b[_0xddae('0x33')]=_['merge'](_0x26d19b[_0xddae('0x33')],{'$or':_['map'](_0x26d19b['attributes'],function(_0x338522){var _0x48d9dc={};_0x48d9dc[_0x338522]={'$like':'%'+_0x36148f[_0xddae('0x29')][_0xddae('0x38')]+'%'};return _0x48d9dc;})});}_0x26d19b=_[_0xddae('0x37')]({},_0x26d19b,_0x36148f['options']);var _0x33a835={'where':_0x26d19b['where']};return db[_0xddae('0x25')][_0xddae('0x39')](_0x33a835)[_0xddae('0x1e')](function(_0xfde833){_0x47e95a[_0xddae('0x39')]=_0xfde833;if(_0x36148f[_0xddae('0x29')]['includeAll']){_0x26d19b[_0xddae('0x3a')]=[{'all':!![]}];}return db[_0xddae('0x25')][_0xddae('0x3b')](_0x26d19b);})[_0xddae('0x1e')](function(_0x47c505){_0x47e95a[_0xddae('0x3c')]=_0x47c505;return _0x47e95a;})[_0xddae('0x1e')](respondWithFilteredResult(_0x540d75,_0x26d19b))[_0xddae('0x3d')](handleError(_0x540d75,null));};exports[_0xddae('0x3e')]=function(_0x2a8fdb,_0x1c5eed){var _0x614696={'raw':!![],'where':{'id':_0x2a8fdb['params']['id']}},_0x4660a0={};_0x4660a0['model']=_['keys'](db['Disposition'][_0xddae('0x26')]);_0x4660a0[_0xddae('0x29')]=_['keys'](_0x2a8fdb[_0xddae('0x29')]);_0x4660a0[_0xddae('0x2c')]=_[_0xddae('0x2d')](_0x4660a0[_0xddae('0x27')],_0x4660a0[_0xddae('0x29')]);_0x614696[_0xddae('0x2e')]=_[_0xddae('0x2d')](_0x4660a0[_0xddae('0x27')],qs[_0xddae('0x2f')](_0x2a8fdb[_0xddae('0x29')][_0xddae('0x2f')]));_0x614696[_0xddae('0x2e')]=_0x614696[_0xddae('0x2e')][_0xddae('0x3f')]?_0x614696[_0xddae('0x2e')]:_0x4660a0[_0xddae('0x27')];if(_0x2a8fdb[_0xddae('0x29')]['includeAll']){_0x614696[_0xddae('0x3a')]=[{'all':!![]}];}_0x614696=_['merge']({},_0x614696,_0x2a8fdb[_0xddae('0x40')]);return db['Disposition'][_0xddae('0x41')](_0x614696)['then'](handleEntityNotFound(_0x1c5eed,null))[_0xddae('0x1e')](respondWithResult(_0x1c5eed,null))[_0xddae('0x3d')](handleError(_0x1c5eed,null));};exports[_0xddae('0x42')]=function(_0xdf28b4,_0xe462d8){return db[_0xddae('0x25')][_0xddae('0x42')](_0xdf28b4[_0xddae('0x43')],{})[_0xddae('0x1e')](respondWithResult(_0xe462d8,0xc9))[_0xddae('0x3d')](handleError(_0xe462d8,null));};exports[_0xddae('0x1d')]=function(_0x599a5b,_0x4a89b8){if(_0x599a5b[_0xddae('0x43')]['id']){delete _0x599a5b[_0xddae('0x43')]['id'];}return db[_0xddae('0x25')][_0xddae('0x41')]({'where':{'id':_0x599a5b[_0xddae('0x44')]['id']}})[_0xddae('0x1e')](handleEntityNotFound(_0x4a89b8,null))[_0xddae('0x1e')](saveUpdates(_0x599a5b[_0xddae('0x43')],null))[_0xddae('0x1e')](respondWithResult(_0x4a89b8,null))[_0xddae('0x3d')](handleError(_0x4a89b8,null));};exports[_0xddae('0x1f')]=function(_0x51ecf8,_0x24a71c){return db[_0xddae('0x25')][_0xddae('0x41')]({'where':{'id':_0x51ecf8[_0xddae('0x44')]['id']}})['then'](handleEntityNotFound(_0x24a71c,null))['then'](removeEntity(_0x24a71c,null))['catch'](handleError(_0x24a71c,null));}; \ No newline at end of file +var _0xbda2=['squel','crypto','querystring','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','then','error','name','index','Disposition','rawAttributes','query','dateEnd','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','dateStart','day','add','merge','filter','map','options','include','rows','catch','params','includeAll','find','create','body','update','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash'];(function(_0x31e253,_0x529105){var _0x26fc29=function(_0x43816a){while(--_0x43816a){_0x31e253['push'](_0x31e253['shift']());}};_0x26fc29(++_0x529105);}(_0xbda2,0x142));var _0x2bda=function(_0x1345af,_0x1ed6ca){_0x1345af=_0x1345af-0x0;var _0x535983=_0xbda2[_0x1345af];return _0x535983;};'use strict';var pdf=require(_0x2bda('0x0'));var emlformat=require(_0x2bda('0x1'));var rimraf=require(_0x2bda('0x2'));var zipdir=require(_0x2bda('0x3'));var jsonpatch=require(_0x2bda('0x4'));var rp=require(_0x2bda('0x5'));var moment=require(_0x2bda('0x6'));var BPromise=require(_0x2bda('0x7'));var Mustache=require('mustache');var util=require(_0x2bda('0x8'));var path=require(_0x2bda('0x9'));var sox=require(_0x2bda('0xa'));var csv=require(_0x2bda('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2bda('0xc'));var squel=require(_0x2bda('0xd'));var crypto=require(_0x2bda('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2bda('0xb'));var querystring=require(_0x2bda('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var qs=require(_0x2bda('0x10'));var logger=require(_0x2bda('0x11'))('api');var utils=require(_0x2bda('0x12'));var config=require(_0x2bda('0x13'));var db=require(_0x2bda('0x14'))['db'];function respondWithStatusCode(_0x39bc3b,_0x8e60ba){_0x8e60ba=_0x8e60ba||0xcc;return function(_0x33f68e){if(_0x33f68e){return _0x39bc3b[_0x2bda('0x15')](_0x8e60ba);}return _0x39bc3b[_0x2bda('0x16')](_0x8e60ba)[_0x2bda('0x17')]();};}function respondWithResult(_0x10a803,_0x230d9a){_0x230d9a=_0x230d9a||0xc8;return function(_0x341a94){if(_0x341a94){return _0x10a803['status'](_0x230d9a)['json'](_0x341a94);}};}function respondWithFilteredResult(_0x1382fc,_0x504c18){return function(_0xcddf1d){if(_0xcddf1d){var _0x19f015=_0xcddf1d[_0x2bda('0x18')],_0x57ec8c=_0x504c18['offset'],_0x5a819b=_0x504c18[_0x2bda('0x19')]+_0x504c18[_0x2bda('0x1a')],_0x43948c;if(_0x5a819b>=_0x19f015){_0x5a819b=_0x19f015;_0x43948c=0xc8;}else{_0x43948c=0xce;}_0x1382fc[_0x2bda('0x16')](_0x43948c);return _0x1382fc[_0x2bda('0x1b')](_0x2bda('0x1c'),_0x57ec8c+'-'+_0x5a819b+'/'+_0x19f015)['json'](_0xcddf1d);}return null;};}function patchUpdates(_0x4882e6){return function(_0x47910d){try{jsonpatch['apply'](_0x47910d,_0x4882e6,!![]);}catch(_0x363138){return BPromise[_0x2bda('0x1d')](_0x363138);}return _0x47910d['save']();};}function saveUpdates(_0x370d3a,_0x15f8b7){return function(_0x4a6f54){if(_0x4a6f54){return _0x4a6f54['update'](_0x370d3a)[_0x2bda('0x1e')](function(_0x95ecc5){return _0x95ecc5;});}return null;};}function removeEntity(_0x4d8681,_0x2c04d8){return function(_0x572be0){if(_0x572be0){return _0x572be0['destroy']()[_0x2bda('0x1e')](function(){_0x4d8681[_0x2bda('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e40d4,_0x1b029e){return function(_0x4bc25c){if(!_0x4bc25c){_0x3e40d4[_0x2bda('0x15')](0x194);}return _0x4bc25c;};}function handleError(_0x2e4701,_0x49c1e2){_0x49c1e2=_0x49c1e2||0x1f4;return function(_0xcb93ef){logger[_0x2bda('0x1f')](_0xcb93ef['stack']);if(_0xcb93ef['name']){delete _0xcb93ef[_0x2bda('0x20')];}_0x2e4701[_0x2bda('0x16')](_0x49c1e2)['send'](_0xcb93ef);};}exports[_0x2bda('0x21')]=function(_0x400039,_0x53a3fd){var _0x2acab8={},_0x293838={},_0x15eb9b={'count':0x0,'rows':[]};var _0x4e595=db[_0x2bda('0x22')][_0x2bda('0x23')];_0x293838['model']=_['keys'](_0x4e595);var _0x5cd163={'dateStart':_0x400039[_0x2bda('0x24')]['dateStart'],'dateEnd':_0x400039[_0x2bda('0x24')][_0x2bda('0x25')]};delete _0x400039[_0x2bda('0x24')]['dateStart'];delete _0x400039[_0x2bda('0x24')][_0x2bda('0x25')];_0x293838[_0x2bda('0x24')]=_[_0x2bda('0x26')](_0x400039[_0x2bda('0x24')]);_0x293838[_0x2bda('0x27')]=_[_0x2bda('0x28')](_0x293838[_0x2bda('0x29')],_0x293838['query']);_0x2acab8[_0x2bda('0x2a')]=_[_0x2bda('0x28')](_0x293838[_0x2bda('0x29')],qs[_0x2bda('0x2b')](_0x400039[_0x2bda('0x24')][_0x2bda('0x2b')]));_0x2acab8[_0x2bda('0x2a')]=_0x2acab8[_0x2bda('0x2a')][_0x2bda('0x2c')]?_0x2acab8[_0x2bda('0x2a')]:_0x293838[_0x2bda('0x29')];if(!_0x400039['query']['hasOwnProperty'](_0x2bda('0x2d'))){_0x2acab8[_0x2bda('0x1a')]=qs[_0x2bda('0x1a')](_0x400039['query'][_0x2bda('0x1a')]);_0x2acab8[_0x2bda('0x19')]=qs[_0x2bda('0x19')](_0x400039[_0x2bda('0x24')][_0x2bda('0x19')]);}_0x2acab8[_0x2bda('0x2e')]=qs[_0x2bda('0x2f')](_0x400039[_0x2bda('0x24')][_0x2bda('0x2f')]);_0x2acab8[_0x2bda('0x30')]=qs['filters'](_[_0x2bda('0x31')](_0x400039[_0x2bda('0x24')],_0x293838[_0x2bda('0x27')]));if(_0x5cd163[_0x2bda('0x32')]){if(_0x5cd163['dateEnd']){_0x5cd163[_0x2bda('0x25')]=moment(_0x5cd163[_0x2bda('0x25')])['add'](0x1,_0x2bda('0x33'));}else{_0x5cd163[_0x2bda('0x25')]=moment(_0x5cd163[_0x2bda('0x32')])[_0x2bda('0x34')](0x1,_0x2bda('0x33'));}_[_0x2bda('0x35')](_0x2acab8['where'],{'createdAt':{'$gte':_0x5cd163[_0x2bda('0x32')],'$lte':_0x5cd163[_0x2bda('0x25')]}});}if(_0x400039['query'][_0x2bda('0x36')]){_0x2acab8['where']=_['merge'](_0x2acab8[_0x2bda('0x30')],{'$or':_[_0x2bda('0x37')](_0x2acab8[_0x2bda('0x2a')],function(_0xa36441){var _0x2ae068={};_0x2ae068[_0xa36441]={'$like':'%'+_0x400039[_0x2bda('0x24')]['filter']+'%'};return _0x2ae068;})});}_0x2acab8=_['merge']({},_0x2acab8,_0x400039[_0x2bda('0x38')]);var _0x30771e={'where':_0x2acab8[_0x2bda('0x30')]};return db[_0x2bda('0x22')][_0x2bda('0x18')](_0x30771e)[_0x2bda('0x1e')](function(_0x59b8e9){_0x15eb9b[_0x2bda('0x18')]=_0x59b8e9;if(_0x400039[_0x2bda('0x24')]['includeAll']){_0x2acab8[_0x2bda('0x39')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x2acab8);})['then'](function(_0xe9bf2d){_0x15eb9b[_0x2bda('0x3a')]=_0xe9bf2d;return _0x15eb9b;})[_0x2bda('0x1e')](respondWithFilteredResult(_0x53a3fd,_0x2acab8))[_0x2bda('0x3b')](handleError(_0x53a3fd,null));};exports['show']=function(_0x37c427,_0xb49532){var _0x3cc010={'raw':!![],'where':{'id':_0x37c427[_0x2bda('0x3c')]['id']}},_0x5881ef={};_0x5881ef[_0x2bda('0x29')]=_[_0x2bda('0x26')](db[_0x2bda('0x22')][_0x2bda('0x23')]);_0x5881ef[_0x2bda('0x24')]=_[_0x2bda('0x26')](_0x37c427[_0x2bda('0x24')]);_0x5881ef[_0x2bda('0x27')]=_[_0x2bda('0x28')](_0x5881ef[_0x2bda('0x29')],_0x5881ef[_0x2bda('0x24')]);_0x3cc010['attributes']=_[_0x2bda('0x28')](_0x5881ef[_0x2bda('0x29')],qs[_0x2bda('0x2b')](_0x37c427[_0x2bda('0x24')][_0x2bda('0x2b')]));_0x3cc010[_0x2bda('0x2a')]=_0x3cc010[_0x2bda('0x2a')][_0x2bda('0x2c')]?_0x3cc010['attributes']:_0x5881ef[_0x2bda('0x29')];if(_0x37c427['query'][_0x2bda('0x3d')]){_0x3cc010[_0x2bda('0x39')]=[{'all':!![]}];}_0x3cc010=_[_0x2bda('0x35')]({},_0x3cc010,_0x37c427[_0x2bda('0x38')]);return db[_0x2bda('0x22')][_0x2bda('0x3e')](_0x3cc010)[_0x2bda('0x1e')](handleEntityNotFound(_0xb49532,null))[_0x2bda('0x1e')](respondWithResult(_0xb49532,null))['catch'](handleError(_0xb49532,null));};exports[_0x2bda('0x3f')]=function(_0x534fb3,_0x4d6430){return db['Disposition'][_0x2bda('0x3f')](_0x534fb3[_0x2bda('0x40')],{})[_0x2bda('0x1e')](respondWithResult(_0x4d6430,0xc9))[_0x2bda('0x3b')](handleError(_0x4d6430,null));};exports[_0x2bda('0x41')]=function(_0x1e1f1b,_0x31f1cf){if(_0x1e1f1b[_0x2bda('0x40')]['id']){delete _0x1e1f1b[_0x2bda('0x40')]['id'];}return db[_0x2bda('0x22')][_0x2bda('0x3e')]({'where':{'id':_0x1e1f1b[_0x2bda('0x3c')]['id']}})[_0x2bda('0x1e')](handleEntityNotFound(_0x31f1cf,null))[_0x2bda('0x1e')](saveUpdates(_0x1e1f1b[_0x2bda('0x40')],null))[_0x2bda('0x1e')](respondWithResult(_0x31f1cf,null))[_0x2bda('0x3b')](handleError(_0x31f1cf,null));};exports[_0x2bda('0x42')]=function(_0xb60441,_0xcaf92c){return db[_0x2bda('0x22')]['find']({'where':{'id':_0xb60441[_0x2bda('0x3c')]['id']}})['then'](handleEntityNotFound(_0xcaf92c,null))['then'](removeEntity(_0xcaf92c,null))[_0x2bda('0x3b')](handleError(_0xcaf92c,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index e48f55f..28a3a6b 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 _0x5f2f=['name_voice','name','name_chat','ChatWebsiteId','MailAccountId','name_sms','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./disposition.attributes','define','Disposition','tools_dispositions'];(function(_0x33e0a4,_0x2901e1){var _0x162fc0=function(_0x39977b){while(--_0x39977b){_0x33e0a4['push'](_0x33e0a4['shift']());}};_0x162fc0(++_0x2901e1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1bfe7a,_0x134748){_0x1bfe7a=_0x1bfe7a-0x0;var _0x153a3f=_0x5f2f[_0x1bfe7a];return _0x153a3f;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var attributes=require(_0xf5f2('0x7'));module['exports']=function(_0x4854b6,_0x1665c7){return _0x4854b6[_0xf5f2('0x8')](_0xf5f2('0x9'),attributes,{'tableName':_0xf5f2('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xf5f2('0xb'),'fields':[_0xf5f2('0xc'),'ListId']},{'unique':!![],'name':_0xf5f2('0xd'),'fields':[_0xf5f2('0xc'),_0xf5f2('0xe')]},{'unique':!![],'name':'name_mail','fields':[_0xf5f2('0xc'),_0xf5f2('0xf')]},{'unique':!![],'name':_0xf5f2('0x10'),'fields':['name',_0xf5f2('0x11')]},{'unique':!![],'name':'name_fax','fields':['name',_0xf5f2('0x12')]},{'unique':!![],'name':_0xf5f2('0x13'),'fields':['name',_0xf5f2('0x14')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8603=['exports','Disposition','tools_dispositions','name_voice','name','ListId','name_mail','name_sms','name_fax','name_openchannel','util','../../config/logger','api','request-promise','./disposition.attributes'];(function(_0x1113b4,_0x3c4637){var _0x10e647=function(_0x426e42){while(--_0x426e42){_0x1113b4['push'](_0x1113b4['shift']());}};_0x10e647(++_0x3c4637);}(_0x8603,0x190));var _0x3860=function(_0x5edac0,_0x4140fb){_0x5edac0=_0x5edac0-0x0;var _0x194236=_0x8603[_0x5edac0];return _0x194236;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var logger=require(_0x3860('0x1'))(_0x3860('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3860('0x3'));var attributes=require(_0x3860('0x4'));module[_0x3860('0x5')]=function(_0x490262,_0x2fc97a){return _0x490262['define'](_0x3860('0x6'),attributes,{'tableName':_0x3860('0x7'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x3860('0x8'),'fields':[_0x3860('0x9'),_0x3860('0xa')]},{'unique':!![],'name':'name_chat','fields':['name','ChatWebsiteId']},{'unique':!![],'name':_0x3860('0xb'),'fields':[_0x3860('0x9'),'MailAccountId']},{'unique':!![],'name':_0x3860('0xc'),'fields':[_0x3860('0x9'),'SmsAccountId']},{'unique':!![],'name':_0x3860('0xd'),'fields':[_0x3860('0x9'),'FaxAccountId']},{'unique':!![],'name':_0x3860('0xe'),'fields':[_0x3860('0x9'),'OpenchannelAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index accf7ff..1692654 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 _0x2d17=['Disposition,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','info','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x334c50,_0x1f11d0){var _0x524766=function(_0x5066de){while(--_0x5066de){_0x334c50['push'](_0x334c50['shift']());}};_0x524766(++_0x1f11d0);}(_0x2d17,0x17e));var _0x72d1=function(_0x2dfb26,_0xec91dd){_0x2dfb26=_0x2dfb26-0x0;var _0x46c607=_0x2d17[_0x2dfb26];return _0x46c607;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var moment=require('moment');var BPromise=require(_0x72d1('0x2'));var rs=require(_0x72d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72d1('0x4'))['db'];var utils=require(_0x72d1('0x5'));var logger=require('../../config/logger')(_0x72d1('0x6'));var config=require('../../config/environment');var jayson=require(_0x72d1('0x7'));var client=jayson['client'][_0x72d1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x239d1f,_0x5b40a9,_0x477264){return new BPromise(function(_0x422f5a,_0x19e248){return client['request'](_0x239d1f,_0x477264)[_0x72d1('0x9')](function(_0x288362){logger[_0x72d1('0xa')]('Disposition,\x20%s,\x20%s',_0x5b40a9,_0x72d1('0xb'));logger[_0x72d1('0xc')](_0x72d1('0xd'),_0x5b40a9,_0x72d1('0xb'),JSON[_0x72d1('0xe')](_0x288362));if(_0x288362[_0x72d1('0xf')]){if(_0x288362[_0x72d1('0xf')][_0x72d1('0x10')]===0x1f4){logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x288362['error'][_0x72d1('0x12')]);return _0x19e248(_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);}logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);return _0x422f5a(_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);}else{logger[_0x72d1('0xa')](_0x72d1('0x11'),_0x5b40a9,_0x72d1('0xb'));_0x422f5a(_0x288362[_0x72d1('0x13')]['message']);}})[_0x72d1('0x14')](function(_0x5262b0){logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x5262b0);_0x19e248(_0x5262b0);});});} \ No newline at end of file +var _0xcca7=['request\x20sent','debug','stringify','error','code','message','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Disposition,\x20%s,\x20%s'];(function(_0x2e50a2,_0x27f31e){var _0x47e5de=function(_0x4e1f70){while(--_0x4e1f70){_0x2e50a2['push'](_0x2e50a2['shift']());}};_0x47e5de(++_0x27f31e);}(_0xcca7,0x1aa));var _0x7cca=function(_0x532961,_0x1520e6){_0x532961=_0x532961-0x0;var _0x332c72=_0xcca7[_0x532961];return _0x332c72;};'use strict';var _=require(_0x7cca('0x0'));var util=require(_0x7cca('0x1'));var moment=require(_0x7cca('0x2'));var BPromise=require(_0x7cca('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7cca('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7cca('0x5'))(_0x7cca('0x6'));var config=require(_0x7cca('0x7'));var jayson=require(_0x7cca('0x8'));var client=jayson[_0x7cca('0x9')][_0x7cca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5aec51,_0x508f29,_0x937fad){return new BPromise(function(_0xd7a28d,_0x1aed1b){return client[_0x7cca('0xb')](_0x5aec51,_0x937fad)[_0x7cca('0xc')](function(_0xe800a5){logger[_0x7cca('0xd')](_0x7cca('0xe'),_0x508f29,_0x7cca('0xf'));logger[_0x7cca('0x10')]('Disposition,\x20%s,\x20%s,\x20%s',_0x508f29,_0x7cca('0xf'),JSON[_0x7cca('0x11')](_0xe800a5));if(_0xe800a5[_0x7cca('0x12')]){if(_0xe800a5[_0x7cca('0x12')][_0x7cca('0x13')]===0x1f4){logger['error'](_0x7cca('0xe'),_0x508f29,_0xe800a5[_0x7cca('0x12')][_0x7cca('0x14')]);return _0x1aed1b(_0xe800a5['error']['message']);}logger[_0x7cca('0x12')](_0x7cca('0xe'),_0x508f29,_0xe800a5[_0x7cca('0x12')][_0x7cca('0x14')]);return _0xd7a28d(_0xe800a5[_0x7cca('0x12')][_0x7cca('0x14')]);}else{logger[_0x7cca('0xd')]('Disposition,\x20%s,\x20%s',_0x508f29,_0x7cca('0xf'));_0xd7a28d(_0xe800a5['result']['message']);}})['catch'](function(_0x33a466){logger[_0x7cca('0x12')](_0x7cca('0xe'),_0x508f29,_0x33a466);_0x1aed1b(_0x33a466);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index b609010..e3198e1 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 _0x1fe3=['show','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./disposition.controller','get','isAuthenticated','index'];(function(_0x330141,_0x1dd290){var _0x1b68a2=function(_0x4e7f3c){while(--_0x4e7f3c){_0x330141['push'](_0x330141['shift']());}};_0x1b68a2(++_0x1dd290);}(_0x1fe3,0x1d3));var _0x31fe=function(_0x160a2a,_0x217081){_0x160a2a=_0x160a2a-0x0;var _0x1cd990=_0x1fe3[_0x160a2a];return _0x1cd990;};'use strict';var multer=require('multer');var util=require(_0x31fe('0x0'));var path=require(_0x31fe('0x1'));var timeout=require(_0x31fe('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x31fe('0x3'));var interaction=require(_0x31fe('0x4'));var config=require('../../config/environment');var controller=require(_0x31fe('0x5'));router[_0x31fe('0x6')]('/',auth[_0x31fe('0x7')](),controller[_0x31fe('0x8')]);router[_0x31fe('0x6')]('/:id',auth[_0x31fe('0x7')](),controller[_0x31fe('0x9')]);router['post']('/',auth[_0x31fe('0x7')](),controller[_0x31fe('0xa')]);router[_0x31fe('0xb')](_0x31fe('0xc'),auth['isAuthenticated'](),controller[_0x31fe('0xd')]);router[_0x31fe('0xe')](_0x31fe('0xc'),auth['isAuthenticated'](),controller[_0x31fe('0xf')]);module[_0x31fe('0x10')]=router; \ No newline at end of file +var _0x3d82=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','put','destroy','multer','util','path'];(function(_0x543bef,_0x5a1568){var _0x65bdc4=function(_0x1c6c97){while(--_0x1c6c97){_0x543bef['push'](_0x543bef['shift']());}};_0x65bdc4(++_0x5a1568);}(_0x3d82,0x1ce));var _0x23d8=function(_0x182271,_0x120462){_0x182271=_0x182271-0x0;var _0xe03a38=_0x3d82[_0x182271];return _0xe03a38;};'use strict';var multer=require(_0x23d8('0x0'));var util=require(_0x23d8('0x1'));var path=require(_0x23d8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x23d8('0x3')]();var auth=require(_0x23d8('0x4'));var interaction=require(_0x23d8('0x5'));var config=require(_0x23d8('0x6'));var controller=require(_0x23d8('0x7'));router[_0x23d8('0x8')]('/',auth[_0x23d8('0x9')](),controller[_0x23d8('0xa')]);router['get'](_0x23d8('0xb'),auth[_0x23d8('0x9')](),controller[_0x23d8('0xc')]);router['post']('/',auth[_0x23d8('0x9')](),controller['create']);router[_0x23d8('0xd')]('/:id',auth[_0x23d8('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x23d8('0xe')]);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 2d371ff..b89b102 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 _0x77e2=['2400','4800','7200','9600','14400','12000','v17,v27,v29','SIP','DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x77e2,0x176));var _0x277e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x77e2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x277e('0x0'));module[_0x277e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x277e('0x2')]},'ecm':{'type':Sequelize[_0x277e('0x3')]('yes','no'),'defaultValue':_0x277e('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x277e('0x5')},'localstationid':{'type':Sequelize[_0x277e('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x277e('0x3')](_0x277e('0x6'),_0x277e('0x7'),_0x277e('0x8'),_0x277e('0x9'),'12000',_0x277e('0xa')),'defaultValue':_0x277e('0x7')},'maxrate':{'type':Sequelize[_0x277e('0x3')](_0x277e('0x6'),_0x277e('0x7'),_0x277e('0x8'),'9600',_0x277e('0xb'),_0x277e('0xa')),'defaultValue':_0x277e('0xa')},'modem':{'type':Sequelize[_0x277e('0x2')],'defaultValue':_0x277e('0xc')},'gateway':{'type':Sequelize[_0x277e('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x277e('0x3')](_0x277e('0xd'),'IAX',_0x277e('0xe'),_0x277e('0xf')),'defaultValue':_0x277e('0xd')},'key':{'type':Sequelize[_0x277e('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x277e('0x10');}},'notificationSound':{'type':Sequelize[_0x277e('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x277e('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x277e('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x277e('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x277e('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x277e('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x277e('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c}}; \ No newline at end of file +var _0x3854=['TEXT','BOOLEAN','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','9600','12000','14400','7200','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP'];(function(_0x593ef6,_0x567f6c){var _0x51b94e=function(_0x298541){while(--_0x298541){_0x593ef6['push'](_0x593ef6['shift']());}};_0x51b94e(++_0x567f6c);}(_0x3854,0x80));var _0x4385=function(_0x5e56fb,_0x59cb6d){_0x5e56fb=_0x5e56fb-0x0;var _0x2fcae9=_0x3854[_0x5e56fb];return _0x2fcae9;};'use strict';var Sequelize=require(_0x4385('0x0'));module[_0x4385('0x1')]={'name':{'type':Sequelize[_0x4385('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4385('0x2')]},'ecm':{'type':Sequelize[_0x4385('0x3')]('yes','no'),'defaultValue':_0x4385('0x4')},'headerinfo':{'type':Sequelize[_0x4385('0x2')],'defaultValue':_0x4385('0x5')},'localstationid':{'type':Sequelize[_0x4385('0x2')],'unique':_0x4385('0x6')},'minrate':{'type':Sequelize[_0x4385('0x3')](_0x4385('0x7'),_0x4385('0x8'),'7200',_0x4385('0x9'),_0x4385('0xa'),_0x4385('0xb')),'defaultValue':'4800'},'maxrate':{'type':Sequelize['ENUM'](_0x4385('0x7'),_0x4385('0x8'),_0x4385('0xc'),'9600',_0x4385('0xa'),_0x4385('0xb')),'defaultValue':_0x4385('0xb')},'modem':{'type':Sequelize[_0x4385('0x2')],'defaultValue':_0x4385('0xd')},'gateway':{'type':Sequelize[_0x4385('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x4385('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x4385('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x4385('0x3')](_0x4385('0xf'),_0x4385('0x10'),_0x4385('0x11'),_0x4385('0x12')),'defaultValue':_0x4385('0xf')},'key':{'type':Sequelize[_0x4385('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4385('0x13')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x4385('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4385('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4385('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4385('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4385('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index aa98e86..047d9af 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 _0xcdaf=['Contacts','DESC','attachments','root','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','user','Messages','Contact\x20not\x20found','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','client','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','update','then','destroy','end','stack','name','send','index','FaxAccount','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','day','add','merge','filter','map','options','includeAll','include','findAll','rows','show','params','find','create','body','describe','addDisposition','Disposition','getDispositions','findOne','order','FaxAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','FaxInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','findAndCountAll','getApplications','context','from-voip-provider','exten','app','type','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','ecm','localstationid','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Set','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','get','VoiceExtension','updateAccountApplications','bulkCreate','tech','createdAt','updatedAt','ListId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','List'];(function(_0x30787d,_0x3cb7cc){var _0x520f65=function(_0x360a34){while(--_0x360a34){_0x30787d['push'](_0x30787d['shift']());}};_0x520f65(++_0x3cb7cc);}(_0xcdaf,0xd7));var _0xfcda=function(_0x562e9e,_0x40c33d){_0x562e9e=_0x562e9e-0x0;var _0xfee662=_0xcdaf[_0x562e9e];return _0xfee662;};'use strict';var pdf=require(_0xfcda('0x0'));var emlformat=require(_0xfcda('0x1'));var rimraf=require(_0xfcda('0x2'));var zipdir=require(_0xfcda('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfcda('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfcda('0x5'));var util=require(_0xfcda('0x6'));var path=require(_0xfcda('0x7'));var sox=require(_0xfcda('0x8'));var csv=require(_0xfcda('0x9'));var ejs=require(_0xfcda('0xa'));var fs=require('fs');var _=require(_0xfcda('0xb'));var squel=require(_0xfcda('0xc'));var crypto=require(_0xfcda('0xd'));var jsforce=require(_0xfcda('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xfcda('0x9'));var querystring=require('querystring');var Papa=require(_0xfcda('0xf'));var Redis=require(_0xfcda('0x10'));var qs=require(_0xfcda('0x11'));var logger=require(_0xfcda('0x12'))(_0xfcda('0x13'));var utils=require(_0xfcda('0x14'));var config=require(_0xfcda('0x15'));var db=require(_0xfcda('0x16'))['db'];config[_0xfcda('0x17')]=_[_0xfcda('0x18')](config['redis'],{'host':_0xfcda('0x19'),'port':0x18eb});var socket=require(_0xfcda('0x1a'))(new Redis(config['redis']));require('./faxAccount.socket')[_0xfcda('0x1b')](socket);var jayson=require(_0xfcda('0x1c'));var client=jayson['client'][_0xfcda('0x1d')]({'port':0x232c});var client9002=jayson[_0xfcda('0x1e')][_0xfcda('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x175bf3,_0x341b78,_0x4c6a1b,_0x12d65a){return new BPromise(function(_0x403267,_0x4308b7){var _0x3e58b5=_0x12d65a||client;return _0x3e58b5['request'](_0x175bf3,_0x4c6a1b)['then'](function(_0x544a86){logger['info'](_0xfcda('0x1f'),_0x341b78,'request\x20sent');logger[_0xfcda('0x20')](_0xfcda('0x21'),_0x341b78,_0xfcda('0x22'),JSON[_0xfcda('0x23')](_0x544a86));if(_0x544a86['error']){if(_0x544a86['error']['code']===0x1f4){logger[_0xfcda('0x24')]('FaxAccount,\x20%s,\x20%s',_0x341b78,_0x544a86[_0xfcda('0x24')][_0xfcda('0x25')]);return _0x4308b7(_0x544a86[_0xfcda('0x24')]['message']);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x341b78,_0x544a86[_0xfcda('0x24')]['message']);return _0x403267(_0x544a86[_0xfcda('0x24')][_0xfcda('0x25')]);}else{logger[_0xfcda('0x26')]('FaxAccount,\x20%s,\x20%s',_0x341b78,_0xfcda('0x22'));_0x403267(_0x544a86[_0xfcda('0x27')][_0xfcda('0x25')]);}})[_0xfcda('0x28')](function(_0x351053){logger[_0xfcda('0x24')]('FaxAccount,\x20%s,\x20%s',_0x341b78,_0x351053);_0x4308b7(_0x351053);});});}function respondWithStatusCode(_0x1f1996,_0xa00064){_0xa00064=_0xa00064||0xcc;return function(_0xac3dc6){if(_0xac3dc6){return _0x1f1996[_0xfcda('0x29')](_0xa00064);}return _0x1f1996[_0xfcda('0x2a')](_0xa00064)['end']();};}function respondWithResult(_0x4825b8,_0x31e1e3){_0x31e1e3=_0x31e1e3||0xc8;return function(_0x48c0ca){if(_0x48c0ca){return _0x4825b8[_0xfcda('0x2a')](_0x31e1e3)[_0xfcda('0x2b')](_0x48c0ca);}};}function respondWithFilteredResult(_0xb0611f,_0x311f16){return function(_0x9c36d2){if(_0x9c36d2){var _0x2d8f46=_0x9c36d2[_0xfcda('0x2c')],_0xa150d5=_0x311f16[_0xfcda('0x2d')],_0x28cab7=_0x311f16['offset']+_0x311f16[_0xfcda('0x2e')],_0x4357c9;if(_0x28cab7>=_0x2d8f46){_0x28cab7=_0x2d8f46;_0x4357c9=0xc8;}else{_0x4357c9=0xce;}_0xb0611f[_0xfcda('0x2a')](_0x4357c9);return _0xb0611f['set'](_0xfcda('0x2f'),_0xa150d5+'-'+_0x28cab7+'/'+_0x2d8f46)[_0xfcda('0x2b')](_0x9c36d2);}return null;};}function patchUpdates(_0x4b52ee){return function(_0x27426f){try{jsonpatch[_0xfcda('0x30')](_0x27426f,_0x4b52ee,!![]);}catch(_0x2169fa){return BPromise['reject'](_0x2169fa);}return _0x27426f['save']();};}function saveUpdates(_0x3fcc46,_0xb0a7bc){return function(_0x3f54e0){if(_0x3f54e0){return _0x3f54e0[_0xfcda('0x31')](_0x3fcc46)[_0xfcda('0x32')](function(_0x4331b9){return _0x4331b9;});}return null;};}function removeEntity(_0xadd2c6,_0x29ca83){return function(_0xe01ff4){if(_0xe01ff4){return _0xe01ff4[_0xfcda('0x33')]()['then'](function(){_0xadd2c6['status'](0xcc)[_0xfcda('0x34')]();});}};}function handleEntityNotFound(_0x2d631f,_0x4a7544){return function(_0x58d23e){if(!_0x58d23e){_0x2d631f[_0xfcda('0x29')](0x194);}return _0x58d23e;};}function handleError(_0x43c12c,_0x234247){_0x234247=_0x234247||0x1f4;return function(_0x362e1f){logger['error'](_0x362e1f[_0xfcda('0x35')]);if(_0x362e1f[_0xfcda('0x36')]){delete _0x362e1f[_0xfcda('0x36')];}_0x43c12c[_0xfcda('0x2a')](_0x234247)[_0xfcda('0x37')](_0x362e1f);};}exports[_0xfcda('0x38')]=function(_0x153773,_0x3fba78){var _0x2b0ee3={},_0x58df60={},_0x4cf04f={'count':0x0,'rows':[]};var _0x443d4d=db[_0xfcda('0x39')][_0xfcda('0x3a')];_0x58df60['model']=_[_0xfcda('0x3b')](_0x443d4d);var _0x2799c3={'dateStart':_0x153773[_0xfcda('0x3c')][_0xfcda('0x3d')],'dateEnd':_0x153773[_0xfcda('0x3c')][_0xfcda('0x3e')]};delete _0x153773[_0xfcda('0x3c')]['dateStart'];delete _0x153773['query']['dateEnd'];_0x58df60[_0xfcda('0x3c')]=_[_0xfcda('0x3b')](_0x153773[_0xfcda('0x3c')]);_0x58df60[_0xfcda('0x3f')]=_[_0xfcda('0x40')](_0x58df60[_0xfcda('0x41')],_0x58df60[_0xfcda('0x3c')]);_0x2b0ee3[_0xfcda('0x42')]=_[_0xfcda('0x40')](_0x58df60[_0xfcda('0x41')],qs[_0xfcda('0x43')](_0x153773[_0xfcda('0x3c')]['fields']));_0x2b0ee3[_0xfcda('0x42')]=_0x2b0ee3['attributes'][_0xfcda('0x44')]?_0x2b0ee3[_0xfcda('0x42')]:_0x58df60['model'];if(!_0x153773[_0xfcda('0x3c')][_0xfcda('0x45')](_0xfcda('0x46'))){_0x2b0ee3[_0xfcda('0x2e')]=qs['limit'](_0x153773['query']['limit']);_0x2b0ee3[_0xfcda('0x2d')]=qs[_0xfcda('0x2d')](_0x153773[_0xfcda('0x3c')][_0xfcda('0x2d')]);}_0x2b0ee3['order']=qs[_0xfcda('0x47')](_0x153773[_0xfcda('0x3c')][_0xfcda('0x47')]);_0x2b0ee3[_0xfcda('0x48')]=qs['filters'](_[_0xfcda('0x49')](_0x153773[_0xfcda('0x3c')],_0x58df60[_0xfcda('0x3f')]));if(_0x2799c3['dateStart']){if(_0x2799c3[_0xfcda('0x3e')]){_0x2799c3['dateEnd']=moment(_0x2799c3[_0xfcda('0x3e')])['add'](0x1,_0xfcda('0x4a'));}else{_0x2799c3[_0xfcda('0x3e')]=moment(_0x2799c3[_0xfcda('0x3d')])[_0xfcda('0x4b')](0x1,_0xfcda('0x4a'));}_[_0xfcda('0x4c')](_0x2b0ee3['where'],{'createdAt':{'$gte':_0x2799c3['dateStart'],'$lte':_0x2799c3[_0xfcda('0x3e')]}});}if(_0x153773[_0xfcda('0x3c')][_0xfcda('0x4d')]){_0x2b0ee3[_0xfcda('0x48')]=_[_0xfcda('0x4c')](_0x2b0ee3['where'],{'$or':_[_0xfcda('0x4e')](_0x2b0ee3[_0xfcda('0x42')],function(_0x201284){var _0x4e5b15={};_0x4e5b15[_0x201284]={'$like':'%'+_0x153773[_0xfcda('0x3c')]['filter']+'%'};return _0x4e5b15;})});}_0x2b0ee3=_[_0xfcda('0x4c')]({},_0x2b0ee3,_0x153773[_0xfcda('0x4f')]);var _0x1d6463={'where':_0x2b0ee3['where']};return db[_0xfcda('0x39')]['count'](_0x1d6463)['then'](function(_0x429aac){_0x4cf04f[_0xfcda('0x2c')]=_0x429aac;if(_0x153773[_0xfcda('0x3c')][_0xfcda('0x50')]){_0x2b0ee3[_0xfcda('0x51')]=[{'all':!![]}];}return db[_0xfcda('0x39')][_0xfcda('0x52')](_0x2b0ee3);})[_0xfcda('0x32')](function(_0x196f7c){_0x4cf04f[_0xfcda('0x53')]=_0x196f7c;return _0x4cf04f;})[_0xfcda('0x32')](respondWithFilteredResult(_0x3fba78,_0x2b0ee3))[_0xfcda('0x28')](handleError(_0x3fba78,null));};exports[_0xfcda('0x54')]=function(_0x17b122,_0x1f09f8){var _0x32d58e={'raw':![],'where':{'id':_0x17b122[_0xfcda('0x55')]['id']}},_0x1338b0={};_0x1338b0['model']=_[_0xfcda('0x3b')](db[_0xfcda('0x39')][_0xfcda('0x3a')]);_0x1338b0['query']=_[_0xfcda('0x3b')](_0x17b122[_0xfcda('0x3c')]);_0x1338b0[_0xfcda('0x3f')]=_['intersection'](_0x1338b0[_0xfcda('0x41')],_0x1338b0[_0xfcda('0x3c')]);_0x32d58e[_0xfcda('0x42')]=_[_0xfcda('0x40')](_0x1338b0['model'],qs[_0xfcda('0x43')](_0x17b122['query'][_0xfcda('0x43')]));_0x32d58e[_0xfcda('0x42')]=_0x32d58e['attributes'][_0xfcda('0x44')]?_0x32d58e[_0xfcda('0x42')]:_0x1338b0['model'];if(_0x17b122[_0xfcda('0x3c')][_0xfcda('0x50')]){_0x32d58e[_0xfcda('0x51')]=[{'all':!![]}];}_0x32d58e=_[_0xfcda('0x4c')]({},_0x32d58e,_0x17b122[_0xfcda('0x4f')]);return db[_0xfcda('0x39')][_0xfcda('0x56')](_0x32d58e)[_0xfcda('0x32')](handleEntityNotFound(_0x1f09f8,null))[_0xfcda('0x32')](respondWithResult(_0x1f09f8,null))[_0xfcda('0x28')](handleError(_0x1f09f8,null));};exports['create']=function(_0x13ca19,_0x17728e){return db[_0xfcda('0x39')][_0xfcda('0x57')](_0x13ca19['body'],{})['then'](respondWithResult(_0x17728e,0xc9))['catch'](handleError(_0x17728e,null));};exports['update']=function(_0x709e,_0x17899c){if(_0x709e[_0xfcda('0x58')]['id']){delete _0x709e[_0xfcda('0x58')]['id'];}return db[_0xfcda('0x39')][_0xfcda('0x56')]({'where':{'id':_0x709e[_0xfcda('0x55')]['id']}})['then'](handleEntityNotFound(_0x17899c,null))[_0xfcda('0x32')](saveUpdates(_0x709e[_0xfcda('0x58')],null))['then'](respondWithResult(_0x17899c,null))[_0xfcda('0x28')](handleError(_0x17899c,null));};exports[_0xfcda('0x33')]=function(_0x3cdcee,_0x6d384e){return db[_0xfcda('0x39')][_0xfcda('0x56')]({'where':{'id':_0x3cdcee[_0xfcda('0x55')]['id']}})[_0xfcda('0x32')](handleEntityNotFound(_0x6d384e,null))[_0xfcda('0x32')](removeEntity(_0x6d384e,null))[_0xfcda('0x28')](handleError(_0x6d384e,null));};exports['describe']=function(_0xda8778,_0x57db56){return db[_0xfcda('0x39')][_0xfcda('0x59')]()[_0xfcda('0x32')](respondWithResult(_0x57db56,null))['catch'](handleError(_0x57db56,null));};exports[_0xfcda('0x5a')]=function(_0x25c4ba,_0x17064b,_0x4ea819){if(_0x25c4ba[_0xfcda('0x58')]['id']){delete _0x25c4ba[_0xfcda('0x58')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x25c4ba[_0xfcda('0x55')]['id']}})[_0xfcda('0x32')](handleEntityNotFound(_0x17064b,null))[_0xfcda('0x32')](function(_0x183270){if(_0x183270){_0x25c4ba[_0xfcda('0x58')]['FaxAccountId']=_0x183270['id'];return db[_0xfcda('0x5b')][_0xfcda('0x57')](_0x25c4ba[_0xfcda('0x58')]);}})[_0xfcda('0x32')](respondWithResult(_0x17064b,null))['catch'](handleError(_0x17064b,null));};exports[_0xfcda('0x5c')]=function(_0x29770e,_0x1f0e20,_0x25d925){var _0x273d93={'raw':![],'where':{}};var _0x35a3e2={};var _0xe059ec={'count':0x0,'rows':[]};return db[_0xfcda('0x39')][_0xfcda('0x5d')]({'where':{'id':_0x29770e['params']['id']}})[_0xfcda('0x32')](handleEntityNotFound(_0x1f0e20,null))[_0xfcda('0x32')](function(_0x3cc282){if(_0x3cc282){_0x35a3e2['model']=_['keys'](db[_0xfcda('0x5b')]['rawAttributes']);_0x35a3e2[_0xfcda('0x3c')]=_['keys'](_0x29770e['query']);_0x35a3e2['filters']=_['intersection'](_0x35a3e2[_0xfcda('0x41')],_0x35a3e2['query']);_0x273d93[_0xfcda('0x42')]=_[_0xfcda('0x40')](_0x35a3e2[_0xfcda('0x41')],qs[_0xfcda('0x43')](_0x29770e['query']['fields']));_0x273d93[_0xfcda('0x42')]=_0x273d93[_0xfcda('0x42')][_0xfcda('0x44')]?_0x273d93['attributes']:_0x35a3e2[_0xfcda('0x41')];if(!_0x29770e['query']['hasOwnProperty'](_0xfcda('0x46'))){_0x273d93['limit']=qs[_0xfcda('0x2e')](_0x29770e[_0xfcda('0x3c')]['limit']);_0x273d93[_0xfcda('0x2d')]=qs['offset'](_0x29770e[_0xfcda('0x3c')][_0xfcda('0x2d')]);}_0x273d93[_0xfcda('0x5e')]=qs[_0xfcda('0x47')](_0x29770e[_0xfcda('0x3c')][_0xfcda('0x47')]);_0x273d93[_0xfcda('0x48')]=qs[_0xfcda('0x3f')](_[_0xfcda('0x49')](_0x29770e[_0xfcda('0x3c')],_0x35a3e2['filters']));_0x273d93[_0xfcda('0x48')][_0xfcda('0x5f')]=_0x3cc282['id'];if(_0x29770e[_0xfcda('0x3c')][_0xfcda('0x4d')]){_0x273d93['where']=_[_0xfcda('0x4c')](_0x273d93[_0xfcda('0x48')],{'$or':_['map'](_0x273d93[_0xfcda('0x42')],function(_0x162630){var _0x210da8={};_0x210da8[_0x162630]={'$like':'%'+_0x29770e[_0xfcda('0x3c')][_0xfcda('0x4d')]+'%'};return _0x210da8;})});}_0x273d93=_[_0xfcda('0x4c')]({},_0x273d93,_0x29770e[_0xfcda('0x4f')]);return db['Disposition'][_0xfcda('0x2c')]({'where':_0x273d93[_0xfcda('0x48')]})[_0xfcda('0x32')](function(_0x9fbf42){_0xe059ec[_0xfcda('0x2c')]=_0x9fbf42;if(_0x29770e['query'][_0xfcda('0x50')]){_0x273d93['include']=[{'all':!![]}];}return db[_0xfcda('0x5b')][_0xfcda('0x52')](_0x273d93);})[_0xfcda('0x32')](function(_0x3663ab){_0xe059ec[_0xfcda('0x53')]=_0x3663ab;return _0xe059ec;});}})[_0xfcda('0x32')](respondWithFilteredResult(_0x1f0e20,_0x273d93))[_0xfcda('0x28')](handleError(_0x1f0e20,null));};exports[_0xfcda('0x60')]=function(_0x30b10b,_0x78de9b,_0xe4522){var _0x2a8a4b;return db['FaxAccount'][_0xfcda('0x56')]({'where':{'id':_0x30b10b[_0xfcda('0x55')]['id']}})[_0xfcda('0x32')](handleEntityNotFound(_0x78de9b,null))[_0xfcda('0x32')](function(_0x22e1ed){if(_0x22e1ed){return _0x22e1ed['removeDispositions'](_0x30b10b['query'][_0xfcda('0x61')]);}})[_0xfcda('0x32')](respondWithStatusCode(_0x78de9b,null))[_0xfcda('0x28')](handleError(_0x78de9b,null));};exports[_0xfcda('0x62')]=function(_0xe61f74,_0x46a304,_0x178283){if(_0xe61f74['body']['id']){delete _0xe61f74[_0xfcda('0x58')]['id'];}return db[_0xfcda('0x39')][_0xfcda('0x56')]({'where':{'id':_0xe61f74[_0xfcda('0x55')]['id']}})[_0xfcda('0x32')](handleEntityNotFound(_0x46a304,null))[_0xfcda('0x32')](function(_0xf36d21){if(_0xf36d21){_0xe61f74[_0xfcda('0x58')][_0xfcda('0x5f')]=_0xf36d21['id'];return db[_0xfcda('0x63')][_0xfcda('0x57')](_0xe61f74[_0xfcda('0x58')]);}})['then'](respondWithResult(_0x46a304,null))['catch'](handleError(_0x46a304,null));};exports[_0xfcda('0x64')]=function(_0x49fe79,_0xf0bdac,_0x3173a8){var _0x592283={'raw':![],'where':{}};var _0x518df9={};var _0x17ad01={'count':0x0,'rows':[]};return db['FaxAccount'][_0xfcda('0x5d')]({'where':{'id':_0x49fe79[_0xfcda('0x55')]['id']}})[_0xfcda('0x32')](handleEntityNotFound(_0xf0bdac,null))[_0xfcda('0x32')](function(_0x1f4f70){if(_0x1f4f70){_0x518df9[_0xfcda('0x41')]=_[_0xfcda('0x3b')](db[_0xfcda('0x63')]['rawAttributes']);_0x518df9[_0xfcda('0x3c')]=_['keys'](_0x49fe79[_0xfcda('0x3c')]);_0x518df9[_0xfcda('0x3f')]=_[_0xfcda('0x40')](_0x518df9[_0xfcda('0x41')],_0x518df9[_0xfcda('0x3c')]);_0x592283['attributes']=_[_0xfcda('0x40')](_0x518df9[_0xfcda('0x41')],qs[_0xfcda('0x43')](_0x49fe79['query'][_0xfcda('0x43')]));_0x592283[_0xfcda('0x42')]=_0x592283[_0xfcda('0x42')]['length']?_0x592283[_0xfcda('0x42')]:_0x518df9[_0xfcda('0x41')];if(!_0x49fe79[_0xfcda('0x3c')][_0xfcda('0x45')](_0xfcda('0x46'))){_0x592283['limit']=qs[_0xfcda('0x2e')](_0x49fe79[_0xfcda('0x3c')][_0xfcda('0x2e')]);_0x592283['offset']=qs['offset'](_0x49fe79[_0xfcda('0x3c')][_0xfcda('0x2d')]);}_0x592283['order']=qs[_0xfcda('0x47')](_0x49fe79[_0xfcda('0x3c')][_0xfcda('0x47')]);_0x592283['where']=qs['filters'](_[_0xfcda('0x49')](_0x49fe79[_0xfcda('0x3c')],_0x518df9[_0xfcda('0x3f')]));_0x592283[_0xfcda('0x48')][_0xfcda('0x5f')]=_0x1f4f70['id'];if(_0x49fe79[_0xfcda('0x3c')][_0xfcda('0x4d')]){_0x592283[_0xfcda('0x48')]=_[_0xfcda('0x4c')](_0x592283[_0xfcda('0x48')],{'$or':_[_0xfcda('0x4e')](_0x592283[_0xfcda('0x42')],function(_0x2ceaa0){var _0x3fd462={};_0x3fd462[_0x2ceaa0]={'$like':'%'+_0x49fe79['query']['filter']+'%'};return _0x3fd462;})});}_0x592283=_[_0xfcda('0x4c')]({},_0x592283,_0x49fe79[_0xfcda('0x4f')]);return db['CannedAnswer']['count']({'where':_0x592283[_0xfcda('0x48')]})[_0xfcda('0x32')](function(_0x5b9a4a){_0x17ad01[_0xfcda('0x2c')]=_0x5b9a4a;if(_0x49fe79[_0xfcda('0x3c')]['includeAll']){_0x592283[_0xfcda('0x51')]=[{'all':!![]}];}return db[_0xfcda('0x63')][_0xfcda('0x52')](_0x592283);})['then'](function(_0x370ff7){_0x17ad01[_0xfcda('0x53')]=_0x370ff7;return _0x17ad01;});}})[_0xfcda('0x32')](respondWithFilteredResult(_0xf0bdac,_0x592283))[_0xfcda('0x28')](handleError(_0xf0bdac,null));};exports[_0xfcda('0x65')]=function(_0x306a99,_0xdacaa,_0x4c2a22){var _0x11025e;return db[_0xfcda('0x39')]['find']({'where':{'id':_0x306a99[_0xfcda('0x55')]['id']}})[_0xfcda('0x32')](handleEntityNotFound(_0xdacaa,null))[_0xfcda('0x32')](function(_0x52ed6b){if(_0x52ed6b){return _0x52ed6b['removeAnswers'](_0x306a99['query'][_0xfcda('0x61')]);}})[_0xfcda('0x32')](respondWithStatusCode(_0xdacaa,null))[_0xfcda('0x28')](handleError(_0xdacaa,null));};exports['addInteraction']=function(_0x25b7f8,_0x1ff580,_0x54ed99){return db[_0xfcda('0x66')][_0xfcda('0x56')]({'where':{'id':_0x25b7f8[_0xfcda('0x55')]['id']}})[_0xfcda('0x32')](handleEntityNotFound(_0x1ff580,null))[_0xfcda('0x32')](function(_0x5eae64){if(_0x5eae64){return _0x5eae64[_0xfcda('0x67')](_0x25b7f8['body'][_0xfcda('0x61')],_[_0xfcda('0x68')](_0x25b7f8[_0xfcda('0x58')],[_0xfcda('0x61'),'id'])||{});}})[_0xfcda('0x32')](respondWithResult(_0x1ff580,null))['catch'](handleError(_0x1ff580,null));};exports[_0xfcda('0x69')]=function(_0x226cf6,_0x2a325e,_0x2fcc17){var _0x1c662e={'raw':![],'where':{}};var _0x16247d={};var _0x2e2bb6={'count':0x0,'rows':[]};return db[_0xfcda('0x39')][_0xfcda('0x5d')]({'where':{'id':_0x226cf6[_0xfcda('0x55')]['id']}})[_0xfcda('0x32')](handleEntityNotFound(_0x2a325e,null))[_0xfcda('0x32')](function(_0x5c8e25){if(_0x5c8e25){_0x16247d[_0xfcda('0x41')]=_[_0xfcda('0x3b')](db[_0xfcda('0x66')][_0xfcda('0x3a')]);_0x16247d[_0xfcda('0x3c')]=_['keys'](_0x226cf6['query']);_0x16247d['filters']=_[_0xfcda('0x40')](_0x16247d[_0xfcda('0x41')],_0x16247d[_0xfcda('0x3c')]);_0x1c662e[_0xfcda('0x42')]=_['intersection'](_0x16247d[_0xfcda('0x41')],qs['fields'](_0x226cf6[_0xfcda('0x3c')]['fields']));_0x1c662e['attributes']=_0x1c662e['attributes'][_0xfcda('0x44')]?_0x1c662e['attributes']:_0x16247d['model'];if(!_0x226cf6[_0xfcda('0x3c')][_0xfcda('0x45')](_0xfcda('0x46'))){_0x1c662e[_0xfcda('0x2e')]=qs['limit'](_0x226cf6[_0xfcda('0x3c')][_0xfcda('0x2e')]);_0x1c662e[_0xfcda('0x2d')]=qs[_0xfcda('0x2d')](_0x226cf6[_0xfcda('0x3c')][_0xfcda('0x2d')]);}_0x1c662e[_0xfcda('0x5e')]=qs[_0xfcda('0x47')](_0x226cf6[_0xfcda('0x3c')]['sort']);_0x1c662e[_0xfcda('0x48')]=qs[_0xfcda('0x3f')](_[_0xfcda('0x49')](_0x226cf6[_0xfcda('0x3c')],_0x16247d[_0xfcda('0x3f')]));_0x1c662e[_0xfcda('0x48')]['FaxAccountId']=_0x5c8e25['id'];if(_0x226cf6['query']['filter']){_0x1c662e['where']=_[_0xfcda('0x4c')](_0x1c662e['where'],{'$or':_[_0xfcda('0x4e')](_0x1c662e[_0xfcda('0x42')],function(_0x3115a7){var _0x459d16={};_0x459d16[_0x3115a7]={'$like':'%'+_0x226cf6[_0xfcda('0x3c')][_0xfcda('0x4d')]+'%'};return _0x459d16;})});}_0x1c662e=_[_0xfcda('0x4c')]({},_0x1c662e,_0x226cf6[_0xfcda('0x4f')]);return db['FaxInteraction'][_0xfcda('0x2c')]({'where':_0x1c662e[_0xfcda('0x48')]})['then'](function(_0x490fa4){_0x2e2bb6[_0xfcda('0x2c')]=_0x490fa4;if(_0x226cf6[_0xfcda('0x3c')]['includeAll']){_0x1c662e[_0xfcda('0x51')]=[{'model':db[_0xfcda('0x6a')],'as':_0xfcda('0x6b'),'required':![]},{'model':db[_0xfcda('0x6c')],'as':_0xfcda('0x6d'),'attributes':['name',_0xfcda('0x6e'),_0xfcda('0x6f')],'required':![]},{'model':db[_0xfcda('0x70')],'as':_0xfcda('0x71'),'attributes':['id',_0xfcda('0x36'),_0xfcda('0x72')],'where':_0x226cf6[_0xfcda('0x3c')][_0xfcda('0x73')]?{'id':_0x226cf6[_0xfcda('0x3c')][_0xfcda('0x73')]}:undefined,'required':_0x226cf6[_0xfcda('0x3c')]['tag']?!![]:![]}];}return db[_0xfcda('0x66')][_0xfcda('0x52')](_0x1c662e);})[_0xfcda('0x32')](function(_0x4cb218){_0x2e2bb6[_0xfcda('0x53')]=_0x4cb218;return _0x2e2bb6;});}})[_0xfcda('0x32')](respondWithFilteredResult(_0x2a325e,_0x1c662e))['catch'](handleError(_0x2a325e,null));};exports[_0xfcda('0x74')]=function(_0x4d1039,_0x597726,_0x5910f4){return db[_0xfcda('0x39')]['findOne']({'where':{'id':_0x4d1039[_0xfcda('0x55')]['id']}})[_0xfcda('0x32')](handleEntityNotFound(_0x597726,null))[_0xfcda('0x32')](function(_0x369f20){if(_0x369f20){return db[_0xfcda('0x75')][_0xfcda('0x76')](function(_0x3c1f93){return db[_0xfcda('0x77')][_0xfcda('0x33')]({'where':{'FaxAccountId':_0x4d1039[_0xfcda('0x55')]['id']},'transaction':_0x3c1f93})[_0xfcda('0x32')](function(_0x426879){var _0x5387d7=_['map'](_0x4d1039['body'],function(_0xf78b49){_0xf78b49[_0xfcda('0x5f')]=_0x4d1039[_0xfcda('0x55')]['id'];return _0xf78b49;});return db['FaxApplication']['bulkCreate'](_0x5387d7,{'transaction':_0x3c1f93});});})[_0xfcda('0x32')](function(){return db[_0xfcda('0x77')][_0xfcda('0x78')]({'where':{'FaxAccountId':_0x4d1039[_0xfcda('0x55')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x597726,null))[_0xfcda('0x28')](handleError(_0x597726,null));};exports[_0xfcda('0x79')]=function(_0x38f42b,_0x2f3e35,_0xf65dd){var _0xaa3733={};var _0x4dc389={};var _0x388404;var _0x2e751b;return db[_0xfcda('0x39')][_0xfcda('0x5d')]({'where':{'id':_0x38f42b[_0xfcda('0x55')]['id']}})[_0xfcda('0x32')](handleEntityNotFound(_0x2f3e35,null))[_0xfcda('0x32')](function(_0x17968f){if(_0x17968f){_0x388404=_0x17968f;_0x4dc389['model']=_[_0xfcda('0x3b')](db[_0xfcda('0x77')]['rawAttributes']);_0x4dc389['query']=_['keys'](_0x38f42b[_0xfcda('0x3c')]);_0x4dc389[_0xfcda('0x3f')]=_[_0xfcda('0x40')](_0x4dc389['model'],_0x4dc389[_0xfcda('0x3c')]);_0xaa3733[_0xfcda('0x42')]=_[_0xfcda('0x40')](_0x4dc389[_0xfcda('0x41')],qs[_0xfcda('0x43')](_0x38f42b[_0xfcda('0x3c')][_0xfcda('0x43')]));_0xaa3733[_0xfcda('0x42')]=_0xaa3733[_0xfcda('0x42')][_0xfcda('0x44')]?_0xaa3733[_0xfcda('0x42')]:_0x4dc389[_0xfcda('0x41')];_0xaa3733['order']=qs[_0xfcda('0x47')](_0x38f42b[_0xfcda('0x3c')]['sort']);_0xaa3733[_0xfcda('0x48')]=qs['filters'](_[_0xfcda('0x49')](_0x38f42b[_0xfcda('0x3c')],_0x4dc389[_0xfcda('0x3f')]));if(_0x38f42b[_0xfcda('0x3c')][_0xfcda('0x4d')]){_0xaa3733[_0xfcda('0x48')]=_[_0xfcda('0x4c')](_0xaa3733[_0xfcda('0x48')],{'$or':_[_0xfcda('0x4e')](_0xaa3733['attributes'],function(_0x376992){var _0xfa4c={};_0xfa4c[_0x376992]={'$like':'%'+_0x38f42b[_0xfcda('0x3c')][_0xfcda('0x4d')]+'%'};return _0xfa4c;})});}_0xaa3733=_[_0xfcda('0x4c')]({},_0xaa3733,_0x38f42b['options']);return _0x388404['getApplications'](_0xaa3733);}})[_0xfcda('0x32')](function(_0x1f71ad){if(_0x1f71ad){_0x2e751b=_0x1f71ad[_0xfcda('0x44')];if(!_0x38f42b[_0xfcda('0x3c')][_0xfcda('0x45')]('nolimit')){_0xaa3733[_0xfcda('0x2e')]=qs['limit'](_0x38f42b[_0xfcda('0x3c')][_0xfcda('0x2e')]);_0xaa3733[_0xfcda('0x2d')]=qs[_0xfcda('0x2d')](_0x38f42b[_0xfcda('0x3c')][_0xfcda('0x2d')]);}return _0x388404[_0xfcda('0x79')](_0xaa3733);}})[_0xfcda('0x32')](function(_0x1b19c5){if(_0x1b19c5){return _0x1b19c5?{'count':_0x2e751b,'rows':_0x1b19c5}:null;}})[_0xfcda('0x32')](respondWithResult(_0x2f3e35,null))[_0xfcda('0x28')](handleError(_0x2f3e35,null));};function Extension(_0x12219f,_0x412735,_0x55b9b7,_0x1aadcf){this[_0xfcda('0x7a')]=_0xfcda('0x7b');this[_0xfcda('0x7c')]=_0x12219f['localstationid'];this[_0xfcda('0x7d')]=_0x1aadcf;this[_0xfcda('0x7e')]='system';this['description']=_0xfcda('0x7f');this[_0xfcda('0x5f')]=_0x12219f['id'];this['priority']=_0x412735;this[_0xfcda('0x80')]=_0x55b9b7;}function createExtensionsReciveFax(_0x5815f4){var _0x302e34=0x1;var _0x3267a1=[];_0x3267a1[_0xfcda('0x81')](new Extension(_0x5815f4,_0x302e34,'',_0xfcda('0x82')));_0x302e34+=0x1;_0x3267a1['push'](new Extension(_0x5815f4,_0x302e34,_0xfcda('0x83'),'Set'));_0x302e34+=0x1;for(var _0x17a8b5 in _0x5815f4){if(_0x5815f4[_0xfcda('0x45')](_0x17a8b5)&&(_0x17a8b5===_0xfcda('0x84')||_0x17a8b5===_0xfcda('0x85')||_0x17a8b5===_0xfcda('0x86')||_0x17a8b5===_0xfcda('0x87')||_0x17a8b5===_0xfcda('0x88')||_0x17a8b5===_0xfcda('0x89')||_0x17a8b5===_0xfcda('0x8a')||_0x17a8b5===_0xfcda('0x8b')||_0x17a8b5===_0xfcda('0x8c'))){_0x3267a1[_0xfcda('0x81')](new Extension(_0x5815f4,_0x302e34,_0xfcda('0x8d')+_0x17a8b5+')='+_0x5815f4[_0x17a8b5],_0xfcda('0x8e')));_0x302e34+=0x1;}}_0x3267a1[_0xfcda('0x81')](new Extension(_0x5815f4,_0x302e34,'6','Wait'));_0x302e34+=0x1;_0x3267a1['push'](new Extension(_0x5815f4,_0x302e34,_0xfcda('0x8f'),'ReceiveFax'));_0x302e34=0x0;return _0x3267a1;}exports[_0xfcda('0x90')]=function(_0x370152,_0x4b0ac2,_0x21f544){var _0x9d8a57;return db[_0xfcda('0x75')][_0xfcda('0x76')](function(_0x3ce843){return db[_0xfcda('0x39')][_0xfcda('0x57')](_0x370152[_0xfcda('0x58')],{'transaction':_0x3ce843})[_0xfcda('0x32')](function(_0x415500){_0x9d8a57=_0x415500[_0xfcda('0x91')]({'plain':!![]});return db[_0xfcda('0x92')]['bulkCreate'](createExtensionsReciveFax(_0x9d8a57),{'transaction':_0x3ce843});});})[_0xfcda('0x32')](function(){return _0x9d8a57;})[_0xfcda('0x32')](respondWithResult(_0x4b0ac2,null))['catch'](handleError(_0x4b0ac2,null));};exports[_0xfcda('0x93')]=function(_0x2c4671,_0xb0ee44,_0x56d04a){var _0x533c44;return db[_0xfcda('0x75')][_0xfcda('0x76')](function(_0x4dc068){return db[_0xfcda('0x39')][_0xfcda('0x31')](_0x2c4671[_0xfcda('0x58')],{'where':{'id':_0x2c4671[_0xfcda('0x58')]['id']},'transaction':_0x4dc068})[_0xfcda('0x32')](function(_0x9b0c44){return db[_0xfcda('0x92')][_0xfcda('0x33')]({'where':{'FaxAccountId':_0x2c4671[_0xfcda('0x58')]['id']},'transaction':_0x4dc068})[_0xfcda('0x32')](function(_0x2a9d95){return db['VoiceExtension'][_0xfcda('0x94')](createExtensionsReciveFax(_[_0xfcda('0x68')](_0x2c4671[_0xfcda('0x58')],[_0xfcda('0x95'),'key',_0xfcda('0x96'),_0xfcda('0x97'),'TrunkId',_0xfcda('0x98')])),{'transaction':_0x4dc068});});});})[_0xfcda('0x32')](function(){return db[_0xfcda('0x39')][_0xfcda('0x99')](_0x2c4671[_0xfcda('0x58')]['id']);})['then'](respondWithResult(_0xb0ee44,null))[_0xfcda('0x28')](handleError(_0xb0ee44,null));};exports[_0xfcda('0x9a')]=function(_0x1c1dfe,_0x253d94,_0x5dca78){var _0x5eb044={'raw':!![],'where':{}};var _0x155e30={};var _0x19509d={'count':0x0,'rows':[]};return db[_0xfcda('0x39')][_0xfcda('0x5d')]({'where':{'id':_0x1c1dfe[_0xfcda('0x55')]['id']}})[_0xfcda('0x32')](handleEntityNotFound(_0x253d94,null))['then'](function(_0xf1f6cc){if(_0xf1f6cc){_0x155e30['model']=_['keys'](db['FaxMessage'][_0xfcda('0x3a')]);_0x155e30[_0xfcda('0x3c')]=_[_0xfcda('0x3b')](_0x1c1dfe['query']);_0x155e30[_0xfcda('0x3f')]=_[_0xfcda('0x40')](_0x155e30[_0xfcda('0x41')],_0x155e30[_0xfcda('0x3c')]);_0x5eb044['attributes']=_[_0xfcda('0x40')](_0x155e30[_0xfcda('0x41')],qs[_0xfcda('0x43')](_0x1c1dfe['query'][_0xfcda('0x43')]));_0x5eb044[_0xfcda('0x42')]=_0x5eb044['attributes'][_0xfcda('0x44')]?_0x5eb044[_0xfcda('0x42')]:_0x155e30['model'];if(!_0x1c1dfe[_0xfcda('0x3c')][_0xfcda('0x45')](_0xfcda('0x46'))){_0x5eb044[_0xfcda('0x2e')]=qs[_0xfcda('0x2e')](_0x1c1dfe['query'][_0xfcda('0x2e')]);_0x5eb044[_0xfcda('0x2d')]=qs[_0xfcda('0x2d')](_0x1c1dfe[_0xfcda('0x3c')][_0xfcda('0x2d')]);}_0x5eb044[_0xfcda('0x5e')]=qs[_0xfcda('0x47')](_0x1c1dfe['query'][_0xfcda('0x47')]);_0x5eb044[_0xfcda('0x48')]=qs[_0xfcda('0x3f')](_[_0xfcda('0x49')](_0x1c1dfe[_0xfcda('0x3c')],_0x155e30[_0xfcda('0x3f')]));_0x5eb044[_0xfcda('0x48')][_0xfcda('0x5f')]=_0xf1f6cc['id'];if(_0x1c1dfe[_0xfcda('0x3c')]['filter']){_0x5eb044[_0xfcda('0x48')]=_[_0xfcda('0x4c')](_0x5eb044['where'],{'$or':_[_0xfcda('0x4e')](_0x5eb044['attributes'],function(_0x2ebf56){var _0x308b92={};_0x308b92[_0x2ebf56]={'$like':'%'+_0x1c1dfe[_0xfcda('0x3c')][_0xfcda('0x4d')]+'%'};return _0x308b92;})});}if(_0x1c1dfe['query'][_0xfcda('0x9b')]){var _0xb7f40a=_0x1c1dfe[_0xfcda('0x3c')][_0xfcda('0x9b')][_0xfcda('0x9c')](',');var _0x42afe6={};_0x42afe6[_0xb7f40a[0x0]]={'$gte':moment(_0xb7f40a[0x1])[_0xfcda('0x9d')](_0xfcda('0x9e'))};_0x5eb044[_0xfcda('0x48')]=_[_0xfcda('0x4c')](_0x5eb044[_0xfcda('0x48')],_0x42afe6);}_0x5eb044=_[_0xfcda('0x4c')]({},_0x5eb044,_0x1c1dfe['options']);return db[_0xfcda('0x9f')][_0xfcda('0x2c')]({'where':_0x5eb044[_0xfcda('0x48')]})[_0xfcda('0x32')](function(_0x828fb2){_0x19509d[_0xfcda('0x2c')]=_0x828fb2;if(_0x1c1dfe[_0xfcda('0x3c')]['includeAll']){_0x5eb044[_0xfcda('0x51')]=[{'all':!![]}];}return db[_0xfcda('0x9f')]['findAll'](_0x5eb044);})[_0xfcda('0x32')](function(_0x5e66c1){_0x19509d[_0xfcda('0x53')]=_0x5e66c1;return _0x19509d;});}})['then'](respondWithFilteredResult(_0x253d94,_0x5eb044))[_0xfcda('0x28')](handleError(_0x253d94,null));};exports[_0xfcda('0x37')]=function(_0x552939,_0x131bc5,_0x3aa3a2){var _0x261ea3,_0x379fe2={},_0x4819e9;if(_0x552939[_0xfcda('0x58')]['to']){_0x4819e9=_0x552939[_0xfcda('0x58')]['to'][0x0];}return db[_0xfcda('0x39')][_0xfcda('0x56')]({'where':{'id':_0x552939[_0xfcda('0x55')]['id']},'include':[{'model':db['CmList'],'as':_0xfcda('0xa0'),'include':[{'model':db[_0xfcda('0x6a')],'as':_0xfcda('0xa1'),'where':{'fax':_0x4819e9},'limit':0x1,'order':[[_0xfcda('0x97'),_0xfcda('0xa2')]]}]}]})['then'](handleEntityNotFound(_0x131bc5,null))[_0xfcda('0x32')](function(_0x41276a){_0x261ea3=_0x41276a;if(_0x552939[_0xfcda('0x58')][_0xfcda('0xa3')]&&_0x552939[_0xfcda('0x58')]['attachments'][_0xfcda('0x44')]){for(var _0x11b770=0x0;_0x11b770<_0x552939[_0xfcda('0x58')][_0xfcda('0xa3')][_0xfcda('0x44')];_0x11b770+=0x1){_0x552939['body'][_0xfcda('0xa3')][_0x11b770]={'filename':_0x552939['body'][_0xfcda('0xa3')][_0x11b770][_0xfcda('0x36')],'id':_0x552939[_0xfcda('0x58')][_0xfcda('0xa3')][_0x11b770]['id'],'path':path['join'](config[_0xfcda('0xa4')],'server/files/attachments',_0x552939[_0xfcda('0x58')][_0xfcda('0xa3')][_0x11b770][_0xfcda('0xa5')])};}}return respondWithRpcPromise(_0xfcda('0xa6'),_0xfcda('0xa6'),{'FaxAccountId':_[_0xfcda('0xa7')](_0x552939[_0xfcda('0x55')]['id'])?undefined:_0x552939[_0xfcda('0x55')]['id'],'path':_['isNil'](_0x552939[_0xfcda('0x58')][_0xfcda('0xa3')][0x0][_0xfcda('0x7')])?undefined:_0x552939[_0xfcda('0x58')]['attachments'][0x0][_0xfcda('0x7')],'fax':_['isNil'](_0x552939[_0xfcda('0x58')]['to'][0x0])?undefined:_0x552939[_0xfcda('0x58')]['to'][0x0]},client9002);})[_0xfcda('0x32')](function(){if(_0x261ea3){if(_[_0xfcda('0xa7')](_0x552939['body'][_0xfcda('0xa8')])){_0x552939['body'][_0xfcda('0xa8')]=util[_0xfcda('0x9d')](_0xfcda('0xa9'),_0x261ea3[_0xfcda('0x36')],_0x261ea3['fax']);}if(_0x261ea3['List']){if(_0x261ea3[_0xfcda('0xa0')][_0xfcda('0xa1')][_0xfcda('0x44')]){return _0x261ea3[_0xfcda('0xa0')][_0xfcda('0xa1')][0x0];}else{return db['CmContact'][_0xfcda('0x57')](_[_0xfcda('0x18')](_0x552939[_0xfcda('0x58')],{'firstName':_0x552939['body']['to'][0x0],'phone':_0x552939['body']['to'][0x0],'fax':_0x552939[_0xfcda('0x58')]['to'][0x0],'ListId':_0x261ea3[_0xfcda('0x98')]}));}}else{throw new Error(_0xfcda('0xaa'));}}else{throw new Error(_0xfcda('0xab'));}})[_0xfcda('0x32')](function(_0x47db21){if(_0x47db21){return db[_0xfcda('0x66')]['find']({'where':{'ContactId':_0x47db21['id'],'closed':![],'FaxAccountId':_0x261ea3['id']}})[_0xfcda('0x32')](function(_0x38130d){if(_0x38130d){return[_0x38130d,![]];}return db[_0xfcda('0x66')][_0xfcda('0x57')]({'UserId':_0x552939['user']['id'],'ContactId':_0x47db21['id'],'FaxAccountId':_0x261ea3['id'],'fax':_0x552939['body']['to'][0x0],'firstMsgDirection':_0xfcda('0xac'),'Messages':[_[_0xfcda('0x4c')](_0x552939[_0xfcda('0x58')],{'read':![],'body':_0x552939[_0xfcda('0x58')][_0xfcda('0xa3')][0x0][_0xfcda('0xad')],'FaxAccountId':_0x261ea3['id'],'UserId':_0x552939[_0xfcda('0xae')]['id'],'ContactId':_0x47db21['id'],'AttachmentId':_0x552939[_0xfcda('0x58')][_0xfcda('0xa3')][0x0]['id']})]},{'include':[{'model':db[_0xfcda('0x9f')],'as':_0xfcda('0xaf')}]})[_0xfcda('0x32')](function(_0x414354){return[_0x414354,!![]];});});}else{throw new Error(_0xfcda('0xb0'));}})['spread'](function(_0x584c2a,_0x37bef5){if(_0x37bef5){return _0x584c2a;}return db[_0xfcda('0x9f')][_0xfcda('0x57')]({'direction':_0xfcda('0xac'),'read':![],'body':_0x552939[_0xfcda('0x58')]['attachments'][0x0][_0xfcda('0xad')],'FaxAccountId':_0x261ea3['id'],'FaxInteractionId':_0x584c2a['id'],'UserId':_0x552939[_0xfcda('0xae')]['id'],'ContactId':_0x584c2a['ContactId'],'AttachmentId':_0x552939['body'][_0xfcda('0xa3')][0x0]['id']})['then'](function(_0x5e642c){_0x584c2a[_0xfcda('0xb1')][_0xfcda('0xaf')]=[];_0x584c2a[_0xfcda('0xb1')][_0xfcda('0xaf')][_0xfcda('0x81')](_0x5e642c[_0xfcda('0xb1')]);return _0x584c2a;});})[_0xfcda('0x32')](function(_0x55b1c0){respondWithRpcPromise(_0xfcda('0xb2'),_0xfcda('0xb2'),{'FaxAccountId':_[_0xfcda('0xa7')](_0x552939[_0xfcda('0x55')]['id'])?undefined:_0x552939[_0xfcda('0x55')]['id'],'path':_[_0xfcda('0xa7')](_0x552939[_0xfcda('0x58')][_0xfcda('0xa3')][0x0][_0xfcda('0x7')])?undefined:_0x552939[_0xfcda('0x58')][_0xfcda('0xa3')][0x0][_0xfcda('0x7')],'fax':_[_0xfcda('0xa7')](_0x552939[_0xfcda('0x58')]['to'][0x0])?undefined:_0x552939[_0xfcda('0x58')]['to'][0x0],'AttachmentId':_0x552939['body'][_0xfcda('0xa3')][0x0]['id']},client9002)[_0xfcda('0x32')](function(_0x3d7bbe){logger['info']('SendFaxRpc,\x20%s',_0x3d7bbe);})['catch'](function(_0x2292ac){logger['info'](_0xfcda('0xb3'),_0x2292ac);});return _0x55b1c0;})['then'](respondWithResult(_0x131bc5,null))[_0xfcda('0x28')](handleError(_0x131bc5,null));};exports[_0xfcda('0xb4')]=function(_0x3973a5,_0x5c28eb,_0x40a139){return db[_0xfcda('0x39')]['find']({'where':{'id':_0x3973a5[_0xfcda('0x55')]['id']}})[_0xfcda('0x32')](handleEntityNotFound(_0x5c28eb,null))[_0xfcda('0x32')](function(_0x1b6b1f){if(_0x1b6b1f){return _0x1b6b1f[_0xfcda('0xb4')](_0x3973a5['body'][_0xfcda('0x61')],_['omit'](_0x3973a5[_0xfcda('0x58')],[_0xfcda('0x61'),'id'])||{})[_0xfcda('0xb5')](function(_0x3a8229){for(var _0x84276f=0x0;_0x84276f<_0x3973a5[_0xfcda('0x58')][_0xfcda('0x61')][_0xfcda('0x44')];_0x84276f+=0x1){socket[_0xfcda('0xb6')](_0xfcda('0xb7'),{'UserId':_0x3973a5[_0xfcda('0x58')]['ids'][_0x84276f],'FaxAccountId':_0x3973a5[_0xfcda('0x55')]['id']});}return _0x3a8229;});}})[_0xfcda('0x32')](respondWithResult(_0x5c28eb,null))[_0xfcda('0x28')](handleError(_0x5c28eb,null));};exports['removeAgents']=function(_0x36ea3d,_0x1962dd,_0x6d40a0){var _0x7bf014;return db[_0xfcda('0x39')][_0xfcda('0x56')]({'where':{'id':_0x36ea3d[_0xfcda('0x55')]['id']}})[_0xfcda('0x32')](handleEntityNotFound(_0x1962dd,null))[_0xfcda('0x32')](function(_0x1c7c88){if(_0x1c7c88){return _0x1c7c88[_0xfcda('0xb8')](_0x36ea3d['query'][_0xfcda('0x61')])[_0xfcda('0x32')](function(_0x40f14e){if(_[_0xfcda('0xb9')](_0x36ea3d['query'][_0xfcda('0x61')])){for(var _0x1439d5=0x0;_0x1439d5<_0x36ea3d[_0xfcda('0x3c')][_0xfcda('0x61')]['length'];_0x1439d5+=0x1){socket[_0xfcda('0xb6')](_0xfcda('0xba'),{'UserId':_0x36ea3d[_0xfcda('0x3c')][_0xfcda('0x61')][_0x1439d5],'FaxAccountId':_0x36ea3d[_0xfcda('0x55')]['id']});}}else{socket['emit']('userFaxAccount:remove',{'UserId':_0x36ea3d[_0xfcda('0x3c')][_0xfcda('0x61')],'FaxAccountId':_0x36ea3d[_0xfcda('0x55')]['id']});}});}})[_0xfcda('0x32')](respondWithStatusCode(_0x1962dd,null))[_0xfcda('0x28')](handleError(_0x1962dd,null));};exports['getAgents']=function(_0x41fcb4,_0x5f306f,_0x2d123e){var _0x5f3186={};var _0x429ae2={};var _0x2927fa;var _0x478c97;return db[_0xfcda('0x39')]['findOne']({'where':{'id':_0x41fcb4[_0xfcda('0x55')]['id']}})[_0xfcda('0x32')](handleEntityNotFound(_0x5f306f,null))['then'](function(_0x36adac){if(_0x36adac){_0x2927fa=_0x36adac;_0x429ae2['model']=_[_0xfcda('0x3b')](db[_0xfcda('0x6c')][_0xfcda('0x3a')]);_0x429ae2['query']=_[_0xfcda('0x3b')](_0x41fcb4[_0xfcda('0x3c')]);_0x429ae2[_0xfcda('0x3f')]=_[_0xfcda('0x40')](_0x429ae2[_0xfcda('0x41')],_0x429ae2['query']);_0x5f3186[_0xfcda('0x42')]=_[_0xfcda('0x40')](_0x429ae2[_0xfcda('0x41')],qs[_0xfcda('0x43')](_0x41fcb4[_0xfcda('0x3c')][_0xfcda('0x43')]));_0x5f3186[_0xfcda('0x42')]=_0x5f3186[_0xfcda('0x42')][_0xfcda('0x44')]?_0x5f3186[_0xfcda('0x42')]:_0x429ae2[_0xfcda('0x41')];_0x5f3186[_0xfcda('0x5e')]=qs[_0xfcda('0x47')](_0x41fcb4['query'][_0xfcda('0x47')]);_0x5f3186[_0xfcda('0x48')]=qs[_0xfcda('0x3f')](_[_0xfcda('0x49')](_0x41fcb4[_0xfcda('0x3c')],_0x429ae2[_0xfcda('0x3f')]));if(_0x41fcb4[_0xfcda('0x3c')]['filter']){_0x5f3186[_0xfcda('0x48')]=_[_0xfcda('0x4c')](_0x5f3186[_0xfcda('0x48')],{'$or':_[_0xfcda('0x4e')](_0x5f3186['attributes'],function(_0xb76e2b){var _0x1c7218={};_0x1c7218[_0xb76e2b]={'$like':'%'+_0x41fcb4['query'][_0xfcda('0x4d')]+'%'};return _0x1c7218;})});}_0x5f3186=_['merge']({},_0x5f3186,_0x41fcb4[_0xfcda('0x4f')]);return _0x2927fa['getAgents'](_0x5f3186);}})[_0xfcda('0x32')](function(_0x297139){if(_0x297139){_0x478c97=_0x297139[_0xfcda('0x44')];if(!_0x41fcb4[_0xfcda('0x3c')][_0xfcda('0x45')](_0xfcda('0x46'))){_0x5f3186[_0xfcda('0x2e')]=qs[_0xfcda('0x2e')](_0x41fcb4['query'][_0xfcda('0x2e')]);_0x5f3186[_0xfcda('0x2d')]=qs[_0xfcda('0x2d')](_0x41fcb4[_0xfcda('0x3c')][_0xfcda('0x2d')]);}return _0x2927fa[_0xfcda('0xbb')](_0x5f3186);}})[_0xfcda('0x32')](function(_0xd09195){if(_0xd09195){return _0xd09195?{'count':_0x478c97,'rows':_0xd09195}:null;}})[_0xfcda('0x32')](respondWithResult(_0x5f306f,null))[_0xfcda('0x28')](handleError(_0x5f306f,null));}; \ No newline at end of file +var _0x0dbd=['client','http','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','stack','name','index','FaxAccount','query','dateEnd','dateStart','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','add','day','merge','map','filter','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','create','body','destroy','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','order','removeAnswers','FaxInteraction','addInteraction','omit','getInteractions','User','Owner','fullname','Tag','Tags','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','from-voip-provider','exten','localstationid','app','type','system','description','Fax\x20Extension','appdata','Answer','push','CDR(type)=inbound-fax','Set','ecm','faxdetect','headerinfo','maxrate','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','addAccountApplications','get','VoiceExtension','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','send','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','CmContact','List\x20not\x20found','Send\x20Fax\x20failed','user','filename','Messages','Contact\x20not\x20found','spread','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxAccount.socket','register','jayson/promise'];(function(_0x1fa19c,_0x5c740b){var _0x5b332d=function(_0x289cb8){while(--_0x289cb8){_0x1fa19c['push'](_0x1fa19c['shift']());}};_0x5b332d(++_0x5c740b);}(_0x0dbd,0x166));var _0xd0db=function(_0x148918,_0x2b268d){_0x148918=_0x148918-0x0;var _0x5a2fae=_0x0dbd[_0x148918];return _0x5a2fae;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd0db('0x0'));var rimraf=require(_0xd0db('0x1'));var zipdir=require(_0xd0db('0x2'));var jsonpatch=require(_0xd0db('0x3'));var rp=require(_0xd0db('0x4'));var moment=require(_0xd0db('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd0db('0x6'));var path=require(_0xd0db('0x7'));var sox=require(_0xd0db('0x8'));var csv=require('to-csv');var ejs=require(_0xd0db('0x9'));var fs=require('fs');var _=require(_0xd0db('0xa'));var squel=require(_0xd0db('0xb'));var crypto=require('crypto');var jsforce=require(_0xd0db('0xc'));var deskjs=require(_0xd0db('0xd'));var toCsv=require(_0xd0db('0xe'));var querystring=require(_0xd0db('0xf'));var Papa=require(_0xd0db('0x10'));var Redis=require('ioredis');var qs=require(_0xd0db('0x11'));var logger=require(_0xd0db('0x12'))('api');var utils=require(_0xd0db('0x13'));var config=require(_0xd0db('0x14'));var db=require(_0xd0db('0x15'))['db'];config[_0xd0db('0x16')]=_[_0xd0db('0x17')](config[_0xd0db('0x16')],{'host':_0xd0db('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd0db('0x16')]));require(_0xd0db('0x19'))[_0xd0db('0x1a')](socket);var jayson=require(_0xd0db('0x1b'));var client=jayson[_0xd0db('0x1c')][_0xd0db('0x1d')]({'port':0x232c});var client9002=jayson[_0xd0db('0x1c')][_0xd0db('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x11541f,_0x1f1d6d,_0xcaaffd,_0x771756){return new BPromise(function(_0x37ef36,_0x128d84){var _0x4c3786=_0x771756||client;return _0x4c3786[_0xd0db('0x1e')](_0x11541f,_0xcaaffd)[_0xd0db('0x1f')](function(_0x37ecbb){logger[_0xd0db('0x20')]('FaxAccount,\x20%s,\x20%s',_0x1f1d6d,_0xd0db('0x21'));logger[_0xd0db('0x22')](_0xd0db('0x23'),_0x1f1d6d,_0xd0db('0x21'),JSON['stringify'](_0x37ecbb));if(_0x37ecbb['error']){if(_0x37ecbb[_0xd0db('0x24')][_0xd0db('0x25')]===0x1f4){logger[_0xd0db('0x24')](_0xd0db('0x26'),_0x1f1d6d,_0x37ecbb[_0xd0db('0x24')][_0xd0db('0x27')]);return _0x128d84(_0x37ecbb['error'][_0xd0db('0x27')]);}logger['error'](_0xd0db('0x26'),_0x1f1d6d,_0x37ecbb[_0xd0db('0x24')]['message']);return _0x37ef36(_0x37ecbb[_0xd0db('0x24')][_0xd0db('0x27')]);}else{logger['info'](_0xd0db('0x26'),_0x1f1d6d,_0xd0db('0x21'));_0x37ef36(_0x37ecbb[_0xd0db('0x28')]['message']);}})[_0xd0db('0x29')](function(_0x136eed){logger[_0xd0db('0x24')](_0xd0db('0x26'),_0x1f1d6d,_0x136eed);_0x128d84(_0x136eed);});});}function respondWithStatusCode(_0x4e6ecc,_0x4ac9a5){_0x4ac9a5=_0x4ac9a5||0xcc;return function(_0x3228af){if(_0x3228af){return _0x4e6ecc[_0xd0db('0x2a')](_0x4ac9a5);}return _0x4e6ecc[_0xd0db('0x2b')](_0x4ac9a5)[_0xd0db('0x2c')]();};}function respondWithResult(_0x1eaa1b,_0xaef94e){_0xaef94e=_0xaef94e||0xc8;return function(_0x3ca9f7){if(_0x3ca9f7){return _0x1eaa1b[_0xd0db('0x2b')](_0xaef94e)[_0xd0db('0x2d')](_0x3ca9f7);}};}function respondWithFilteredResult(_0x123879,_0x12df93){return function(_0x5824ac){if(_0x5824ac){var _0x40efd4=_0x5824ac[_0xd0db('0x2e')],_0x42c03e=_0x12df93[_0xd0db('0x2f')],_0x441321=_0x12df93[_0xd0db('0x2f')]+_0x12df93[_0xd0db('0x30')],_0x31af54;if(_0x441321>=_0x40efd4){_0x441321=_0x40efd4;_0x31af54=0xc8;}else{_0x31af54=0xce;}_0x123879['status'](_0x31af54);return _0x123879[_0xd0db('0x31')](_0xd0db('0x32'),_0x42c03e+'-'+_0x441321+'/'+_0x40efd4)[_0xd0db('0x2d')](_0x5824ac);}return null;};}function patchUpdates(_0x489832){return function(_0x2748ac){try{jsonpatch['apply'](_0x2748ac,_0x489832,!![]);}catch(_0x510233){return BPromise[_0xd0db('0x33')](_0x510233);}return _0x2748ac[_0xd0db('0x34')]();};}function saveUpdates(_0x48a594,_0x425aba){return function(_0x1333c9){if(_0x1333c9){return _0x1333c9[_0xd0db('0x35')](_0x48a594)[_0xd0db('0x1f')](function(_0x22bdba){return _0x22bdba;});}return null;};}function removeEntity(_0x46f456,_0x15aea5){return function(_0xdafe09){if(_0xdafe09){return _0xdafe09['destroy']()['then'](function(){_0x46f456[_0xd0db('0x2b')](0xcc)[_0xd0db('0x2c')]();});}};}function handleEntityNotFound(_0x12d2ed,_0x25cd5e){return function(_0x37b00e){if(!_0x37b00e){_0x12d2ed[_0xd0db('0x2a')](0x194);}return _0x37b00e;};}function handleError(_0x54b11f,_0x1f9905){_0x1f9905=_0x1f9905||0x1f4;return function(_0x3787d3){logger[_0xd0db('0x24')](_0x3787d3[_0xd0db('0x36')]);if(_0x3787d3['name']){delete _0x3787d3[_0xd0db('0x37')];}_0x54b11f[_0xd0db('0x2b')](_0x1f9905)['send'](_0x3787d3);};}exports[_0xd0db('0x38')]=function(_0x119212,_0x5f2e0c){var _0x3558ba={},_0x4ee5a7={},_0x507c65={'count':0x0,'rows':[]};var _0x5d2579=db[_0xd0db('0x39')]['rawAttributes'];_0x4ee5a7['model']=_['keys'](_0x5d2579);var _0x4de8af={'dateStart':_0x119212[_0xd0db('0x3a')]['dateStart'],'dateEnd':_0x119212[_0xd0db('0x3a')][_0xd0db('0x3b')]};delete _0x119212[_0xd0db('0x3a')][_0xd0db('0x3c')];delete _0x119212[_0xd0db('0x3a')][_0xd0db('0x3b')];_0x4ee5a7[_0xd0db('0x3a')]=_[_0xd0db('0x3d')](_0x119212[_0xd0db('0x3a')]);_0x4ee5a7['filters']=_[_0xd0db('0x3e')](_0x4ee5a7[_0xd0db('0x3f')],_0x4ee5a7[_0xd0db('0x3a')]);_0x3558ba['attributes']=_[_0xd0db('0x3e')](_0x4ee5a7[_0xd0db('0x3f')],qs[_0xd0db('0x40')](_0x119212[_0xd0db('0x3a')]['fields']));_0x3558ba[_0xd0db('0x41')]=_0x3558ba[_0xd0db('0x41')][_0xd0db('0x42')]?_0x3558ba[_0xd0db('0x41')]:_0x4ee5a7[_0xd0db('0x3f')];if(!_0x119212[_0xd0db('0x3a')][_0xd0db('0x43')](_0xd0db('0x44'))){_0x3558ba[_0xd0db('0x30')]=qs[_0xd0db('0x30')](_0x119212[_0xd0db('0x3a')][_0xd0db('0x30')]);_0x3558ba[_0xd0db('0x2f')]=qs[_0xd0db('0x2f')](_0x119212[_0xd0db('0x3a')][_0xd0db('0x2f')]);}_0x3558ba['order']=qs[_0xd0db('0x45')](_0x119212[_0xd0db('0x3a')][_0xd0db('0x45')]);_0x3558ba[_0xd0db('0x46')]=qs[_0xd0db('0x47')](_[_0xd0db('0x48')](_0x119212[_0xd0db('0x3a')],_0x4ee5a7[_0xd0db('0x47')]));if(_0x4de8af[_0xd0db('0x3c')]){if(_0x4de8af['dateEnd']){_0x4de8af['dateEnd']=moment(_0x4de8af['dateEnd'])[_0xd0db('0x49')](0x1,_0xd0db('0x4a'));}else{_0x4de8af[_0xd0db('0x3b')]=moment(_0x4de8af[_0xd0db('0x3c')])[_0xd0db('0x49')](0x1,_0xd0db('0x4a'));}_[_0xd0db('0x4b')](_0x3558ba[_0xd0db('0x46')],{'createdAt':{'$gte':_0x4de8af[_0xd0db('0x3c')],'$lte':_0x4de8af[_0xd0db('0x3b')]}});}if(_0x119212['query']['filter']){_0x3558ba[_0xd0db('0x46')]=_[_0xd0db('0x4b')](_0x3558ba['where'],{'$or':_[_0xd0db('0x4c')](_0x3558ba[_0xd0db('0x41')],function(_0x158e88){var _0x18e083={};_0x18e083[_0x158e88]={'$like':'%'+_0x119212['query'][_0xd0db('0x4d')]+'%'};return _0x18e083;})});}_0x3558ba=_[_0xd0db('0x4b')]({},_0x3558ba,_0x119212['options']);var _0x360fc5={'where':_0x3558ba['where']};return db['FaxAccount'][_0xd0db('0x2e')](_0x360fc5)[_0xd0db('0x1f')](function(_0x1eb066){_0x507c65[_0xd0db('0x2e')]=_0x1eb066;if(_0x119212['query'][_0xd0db('0x4e')]){_0x3558ba[_0xd0db('0x4f')]=[{'all':!![]}];}return db[_0xd0db('0x39')][_0xd0db('0x50')](_0x3558ba);})[_0xd0db('0x1f')](function(_0x558eb8){_0x507c65[_0xd0db('0x51')]=_0x558eb8;return _0x507c65;})[_0xd0db('0x1f')](respondWithFilteredResult(_0x5f2e0c,_0x3558ba))['catch'](handleError(_0x5f2e0c,null));};exports[_0xd0db('0x52')]=function(_0x20caf3,_0x8ecc05){var _0x2847f9={'raw':![],'where':{'id':_0x20caf3[_0xd0db('0x53')]['id']}},_0x24827c={};_0x24827c[_0xd0db('0x3f')]=_[_0xd0db('0x3d')](db[_0xd0db('0x39')][_0xd0db('0x54')]);_0x24827c[_0xd0db('0x3a')]=_[_0xd0db('0x3d')](_0x20caf3[_0xd0db('0x3a')]);_0x24827c[_0xd0db('0x47')]=_['intersection'](_0x24827c[_0xd0db('0x3f')],_0x24827c[_0xd0db('0x3a')]);_0x2847f9['attributes']=_[_0xd0db('0x3e')](_0x24827c['model'],qs[_0xd0db('0x40')](_0x20caf3[_0xd0db('0x3a')][_0xd0db('0x40')]));_0x2847f9[_0xd0db('0x41')]=_0x2847f9[_0xd0db('0x41')][_0xd0db('0x42')]?_0x2847f9[_0xd0db('0x41')]:_0x24827c[_0xd0db('0x3f')];if(_0x20caf3[_0xd0db('0x3a')][_0xd0db('0x4e')]){_0x2847f9[_0xd0db('0x4f')]=[{'all':!![]}];}_0x2847f9=_[_0xd0db('0x4b')]({},_0x2847f9,_0x20caf3[_0xd0db('0x55')]);return db[_0xd0db('0x39')][_0xd0db('0x56')](_0x2847f9)['then'](handleEntityNotFound(_0x8ecc05,null))[_0xd0db('0x1f')](respondWithResult(_0x8ecc05,null))[_0xd0db('0x29')](handleError(_0x8ecc05,null));};exports[_0xd0db('0x57')]=function(_0x254eac,_0x2933d3){return db[_0xd0db('0x39')][_0xd0db('0x57')](_0x254eac[_0xd0db('0x58')],{})[_0xd0db('0x1f')](respondWithResult(_0x2933d3,0xc9))[_0xd0db('0x29')](handleError(_0x2933d3,null));};exports['update']=function(_0x2027bc,_0x33175f){if(_0x2027bc[_0xd0db('0x58')]['id']){delete _0x2027bc[_0xd0db('0x58')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x2027bc[_0xd0db('0x53')]['id']}})[_0xd0db('0x1f')](handleEntityNotFound(_0x33175f,null))[_0xd0db('0x1f')](saveUpdates(_0x2027bc[_0xd0db('0x58')],null))['then'](respondWithResult(_0x33175f,null))[_0xd0db('0x29')](handleError(_0x33175f,null));};exports[_0xd0db('0x59')]=function(_0x3dd424,_0x201692){return db[_0xd0db('0x39')][_0xd0db('0x56')]({'where':{'id':_0x3dd424[_0xd0db('0x53')]['id']}})[_0xd0db('0x1f')](handleEntityNotFound(_0x201692,null))[_0xd0db('0x1f')](removeEntity(_0x201692,null))[_0xd0db('0x29')](handleError(_0x201692,null));};exports[_0xd0db('0x5a')]=function(_0x4c1fb6,_0x5a24cc){return db['FaxAccount'][_0xd0db('0x5a')]()[_0xd0db('0x1f')](respondWithResult(_0x5a24cc,null))[_0xd0db('0x29')](handleError(_0x5a24cc,null));};exports[_0xd0db('0x5b')]=function(_0x5b7ebb,_0x65d9d9,_0x5b5941){if(_0x5b7ebb['body']['id']){delete _0x5b7ebb[_0xd0db('0x58')]['id'];}return db[_0xd0db('0x39')][_0xd0db('0x56')]({'where':{'id':_0x5b7ebb[_0xd0db('0x53')]['id']}})['then'](handleEntityNotFound(_0x65d9d9,null))['then'](function(_0x138950){if(_0x138950){_0x5b7ebb['body'][_0xd0db('0x5c')]=_0x138950['id'];return db[_0xd0db('0x5d')][_0xd0db('0x57')](_0x5b7ebb[_0xd0db('0x58')]);}})[_0xd0db('0x1f')](respondWithResult(_0x65d9d9,null))[_0xd0db('0x29')](handleError(_0x65d9d9,null));};exports[_0xd0db('0x5e')]=function(_0x20bd58,_0x462714,_0x1bb60b){var _0x437b6e={'raw':![],'where':{}};var _0xe5e93c={};var _0x43238b={'count':0x0,'rows':[]};return db[_0xd0db('0x39')][_0xd0db('0x5f')]({'where':{'id':_0x20bd58[_0xd0db('0x53')]['id']}})['then'](handleEntityNotFound(_0x462714,null))[_0xd0db('0x1f')](function(_0x1962df){if(_0x1962df){_0xe5e93c[_0xd0db('0x3f')]=_['keys'](db[_0xd0db('0x5d')][_0xd0db('0x54')]);_0xe5e93c[_0xd0db('0x3a')]=_['keys'](_0x20bd58['query']);_0xe5e93c[_0xd0db('0x47')]=_[_0xd0db('0x3e')](_0xe5e93c['model'],_0xe5e93c['query']);_0x437b6e[_0xd0db('0x41')]=_[_0xd0db('0x3e')](_0xe5e93c['model'],qs[_0xd0db('0x40')](_0x20bd58['query'][_0xd0db('0x40')]));_0x437b6e[_0xd0db('0x41')]=_0x437b6e[_0xd0db('0x41')][_0xd0db('0x42')]?_0x437b6e[_0xd0db('0x41')]:_0xe5e93c[_0xd0db('0x3f')];if(!_0x20bd58[_0xd0db('0x3a')]['hasOwnProperty'](_0xd0db('0x44'))){_0x437b6e[_0xd0db('0x30')]=qs[_0xd0db('0x30')](_0x20bd58['query']['limit']);_0x437b6e['offset']=qs[_0xd0db('0x2f')](_0x20bd58['query']['offset']);}_0x437b6e['order']=qs['sort'](_0x20bd58['query'][_0xd0db('0x45')]);_0x437b6e['where']=qs['filters'](_['pick'](_0x20bd58[_0xd0db('0x3a')],_0xe5e93c[_0xd0db('0x47')]));_0x437b6e[_0xd0db('0x46')][_0xd0db('0x5c')]=_0x1962df['id'];if(_0x20bd58[_0xd0db('0x3a')]['filter']){_0x437b6e[_0xd0db('0x46')]=_[_0xd0db('0x4b')](_0x437b6e[_0xd0db('0x46')],{'$or':_[_0xd0db('0x4c')](_0x437b6e[_0xd0db('0x41')],function(_0x4d838b){var _0x5af800={};_0x5af800[_0x4d838b]={'$like':'%'+_0x20bd58['query'][_0xd0db('0x4d')]+'%'};return _0x5af800;})});}_0x437b6e=_['merge']({},_0x437b6e,_0x20bd58[_0xd0db('0x55')]);return db['Disposition'][_0xd0db('0x2e')]({'where':_0x437b6e[_0xd0db('0x46')]})[_0xd0db('0x1f')](function(_0x15e4e2){_0x43238b[_0xd0db('0x2e')]=_0x15e4e2;if(_0x20bd58[_0xd0db('0x3a')][_0xd0db('0x4e')]){_0x437b6e[_0xd0db('0x4f')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x437b6e);})[_0xd0db('0x1f')](function(_0x5d2159){_0x43238b['rows']=_0x5d2159;return _0x43238b;});}})[_0xd0db('0x1f')](respondWithFilteredResult(_0x462714,_0x437b6e))[_0xd0db('0x29')](handleError(_0x462714,null));};exports[_0xd0db('0x60')]=function(_0xc62d41,_0x93acfa,_0x233073){var _0x2b3518;return db['FaxAccount'][_0xd0db('0x56')]({'where':{'id':_0xc62d41[_0xd0db('0x53')]['id']}})['then'](handleEntityNotFound(_0x93acfa,null))['then'](function(_0x2ed40a){if(_0x2ed40a){return _0x2ed40a[_0xd0db('0x60')](_0xc62d41[_0xd0db('0x3a')][_0xd0db('0x61')]);}})[_0xd0db('0x1f')](respondWithStatusCode(_0x93acfa,null))[_0xd0db('0x29')](handleError(_0x93acfa,null));};exports[_0xd0db('0x62')]=function(_0x3c01fa,_0x1632b5,_0x1da366){if(_0x3c01fa[_0xd0db('0x58')]['id']){delete _0x3c01fa[_0xd0db('0x58')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x3c01fa[_0xd0db('0x53')]['id']}})[_0xd0db('0x1f')](handleEntityNotFound(_0x1632b5,null))[_0xd0db('0x1f')](function(_0x9f55d7){if(_0x9f55d7){_0x3c01fa['body']['FaxAccountId']=_0x9f55d7['id'];return db['CannedAnswer'][_0xd0db('0x57')](_0x3c01fa[_0xd0db('0x58')]);}})[_0xd0db('0x1f')](respondWithResult(_0x1632b5,null))[_0xd0db('0x29')](handleError(_0x1632b5,null));};exports[_0xd0db('0x63')]=function(_0x25da48,_0x25bb10,_0x5ea3a8){var _0x36b3f4={'raw':![],'where':{}};var _0x124189={};var _0x3f9162={'count':0x0,'rows':[]};return db[_0xd0db('0x39')][_0xd0db('0x5f')]({'where':{'id':_0x25da48[_0xd0db('0x53')]['id']}})[_0xd0db('0x1f')](handleEntityNotFound(_0x25bb10,null))[_0xd0db('0x1f')](function(_0x3620e4){if(_0x3620e4){_0x124189['model']=_['keys'](db[_0xd0db('0x64')][_0xd0db('0x54')]);_0x124189[_0xd0db('0x3a')]=_['keys'](_0x25da48[_0xd0db('0x3a')]);_0x124189['filters']=_[_0xd0db('0x3e')](_0x124189[_0xd0db('0x3f')],_0x124189[_0xd0db('0x3a')]);_0x36b3f4[_0xd0db('0x41')]=_[_0xd0db('0x3e')](_0x124189['model'],qs[_0xd0db('0x40')](_0x25da48[_0xd0db('0x3a')][_0xd0db('0x40')]));_0x36b3f4[_0xd0db('0x41')]=_0x36b3f4[_0xd0db('0x41')][_0xd0db('0x42')]?_0x36b3f4['attributes']:_0x124189[_0xd0db('0x3f')];if(!_0x25da48[_0xd0db('0x3a')][_0xd0db('0x43')](_0xd0db('0x44'))){_0x36b3f4['limit']=qs[_0xd0db('0x30')](_0x25da48[_0xd0db('0x3a')][_0xd0db('0x30')]);_0x36b3f4[_0xd0db('0x2f')]=qs[_0xd0db('0x2f')](_0x25da48['query'][_0xd0db('0x2f')]);}_0x36b3f4[_0xd0db('0x65')]=qs[_0xd0db('0x45')](_0x25da48['query']['sort']);_0x36b3f4['where']=qs[_0xd0db('0x47')](_['pick'](_0x25da48[_0xd0db('0x3a')],_0x124189[_0xd0db('0x47')]));_0x36b3f4['where'][_0xd0db('0x5c')]=_0x3620e4['id'];if(_0x25da48['query']['filter']){_0x36b3f4[_0xd0db('0x46')]=_[_0xd0db('0x4b')](_0x36b3f4[_0xd0db('0x46')],{'$or':_[_0xd0db('0x4c')](_0x36b3f4['attributes'],function(_0x55d886){var _0x47e6a0={};_0x47e6a0[_0x55d886]={'$like':'%'+_0x25da48[_0xd0db('0x3a')][_0xd0db('0x4d')]+'%'};return _0x47e6a0;})});}_0x36b3f4=_[_0xd0db('0x4b')]({},_0x36b3f4,_0x25da48[_0xd0db('0x55')]);return db['CannedAnswer'][_0xd0db('0x2e')]({'where':_0x36b3f4[_0xd0db('0x46')]})['then'](function(_0x578cab){_0x3f9162[_0xd0db('0x2e')]=_0x578cab;if(_0x25da48['query'][_0xd0db('0x4e')]){_0x36b3f4['include']=[{'all':!![]}];}return db[_0xd0db('0x64')]['findAll'](_0x36b3f4);})[_0xd0db('0x1f')](function(_0x42d6c3){_0x3f9162['rows']=_0x42d6c3;return _0x3f9162;});}})['then'](respondWithFilteredResult(_0x25bb10,_0x36b3f4))[_0xd0db('0x29')](handleError(_0x25bb10,null));};exports[_0xd0db('0x66')]=function(_0x1eeac8,_0x54f8b0,_0x15c74c){var _0x3e4a22;return db[_0xd0db('0x39')][_0xd0db('0x56')]({'where':{'id':_0x1eeac8[_0xd0db('0x53')]['id']}})[_0xd0db('0x1f')](handleEntityNotFound(_0x54f8b0,null))['then'](function(_0x4c251f){if(_0x4c251f){return _0x4c251f[_0xd0db('0x66')](_0x1eeac8['query'][_0xd0db('0x61')]);}})[_0xd0db('0x1f')](respondWithStatusCode(_0x54f8b0,null))[_0xd0db('0x29')](handleError(_0x54f8b0,null));};exports['addInteraction']=function(_0x157921,_0x2fc27f,_0x516b31){return db[_0xd0db('0x67')][_0xd0db('0x56')]({'where':{'id':_0x157921[_0xd0db('0x53')]['id']}})[_0xd0db('0x1f')](handleEntityNotFound(_0x2fc27f,null))[_0xd0db('0x1f')](function(_0xe96d0c){if(_0xe96d0c){return _0xe96d0c[_0xd0db('0x68')](_0x157921['body'][_0xd0db('0x61')],_[_0xd0db('0x69')](_0x157921[_0xd0db('0x58')],[_0xd0db('0x61'),'id'])||{});}})[_0xd0db('0x1f')](respondWithResult(_0x2fc27f,null))[_0xd0db('0x29')](handleError(_0x2fc27f,null));};exports[_0xd0db('0x6a')]=function(_0x4a588c,_0x47e60c,_0x118b6b){var _0x502aa6={'raw':![],'where':{}};var _0x3cdaa4={};var _0x4db3f2={'count':0x0,'rows':[]};return db[_0xd0db('0x39')][_0xd0db('0x5f')]({'where':{'id':_0x4a588c['params']['id']}})[_0xd0db('0x1f')](handleEntityNotFound(_0x47e60c,null))[_0xd0db('0x1f')](function(_0x153d72){if(_0x153d72){_0x3cdaa4[_0xd0db('0x3f')]=_['keys'](db[_0xd0db('0x67')][_0xd0db('0x54')]);_0x3cdaa4['query']=_[_0xd0db('0x3d')](_0x4a588c[_0xd0db('0x3a')]);_0x3cdaa4[_0xd0db('0x47')]=_[_0xd0db('0x3e')](_0x3cdaa4[_0xd0db('0x3f')],_0x3cdaa4['query']);_0x502aa6['attributes']=_[_0xd0db('0x3e')](_0x3cdaa4[_0xd0db('0x3f')],qs[_0xd0db('0x40')](_0x4a588c['query']['fields']));_0x502aa6['attributes']=_0x502aa6[_0xd0db('0x41')][_0xd0db('0x42')]?_0x502aa6[_0xd0db('0x41')]:_0x3cdaa4[_0xd0db('0x3f')];if(!_0x4a588c[_0xd0db('0x3a')][_0xd0db('0x43')](_0xd0db('0x44'))){_0x502aa6[_0xd0db('0x30')]=qs[_0xd0db('0x30')](_0x4a588c[_0xd0db('0x3a')]['limit']);_0x502aa6[_0xd0db('0x2f')]=qs[_0xd0db('0x2f')](_0x4a588c[_0xd0db('0x3a')]['offset']);}_0x502aa6[_0xd0db('0x65')]=qs[_0xd0db('0x45')](_0x4a588c[_0xd0db('0x3a')][_0xd0db('0x45')]);_0x502aa6[_0xd0db('0x46')]=qs['filters'](_[_0xd0db('0x48')](_0x4a588c[_0xd0db('0x3a')],_0x3cdaa4[_0xd0db('0x47')]));_0x502aa6['where']['FaxAccountId']=_0x153d72['id'];if(_0x4a588c[_0xd0db('0x3a')][_0xd0db('0x4d')]){_0x502aa6['where']=_[_0xd0db('0x4b')](_0x502aa6[_0xd0db('0x46')],{'$or':_['map'](_0x502aa6[_0xd0db('0x41')],function(_0x1f6206){var _0x51ff77={};_0x51ff77[_0x1f6206]={'$like':'%'+_0x4a588c[_0xd0db('0x3a')][_0xd0db('0x4d')]+'%'};return _0x51ff77;})});}_0x502aa6=_[_0xd0db('0x4b')]({},_0x502aa6,_0x4a588c['options']);return db['FaxInteraction'][_0xd0db('0x2e')]({'where':_0x502aa6[_0xd0db('0x46')]})[_0xd0db('0x1f')](function(_0x417707){_0x4db3f2[_0xd0db('0x2e')]=_0x417707;if(_0x4a588c[_0xd0db('0x3a')][_0xd0db('0x4e')]){_0x502aa6[_0xd0db('0x4f')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xd0db('0x6b')],'as':_0xd0db('0x6c'),'attributes':[_0xd0db('0x37'),_0xd0db('0x6d'),'internal'],'required':![]},{'model':db[_0xd0db('0x6e')],'as':_0xd0db('0x6f'),'attributes':['id',_0xd0db('0x37'),'color'],'where':_0x4a588c[_0xd0db('0x3a')]['tag']?{'id':_0x4a588c[_0xd0db('0x3a')]['tag']}:undefined,'required':_0x4a588c[_0xd0db('0x3a')][_0xd0db('0x70')]?!![]:![]}];}return db[_0xd0db('0x67')][_0xd0db('0x50')](_0x502aa6);})['then'](function(_0xbc1a66){_0x4db3f2[_0xd0db('0x51')]=_0xbc1a66;return _0x4db3f2;});}})[_0xd0db('0x1f')](respondWithFilteredResult(_0x47e60c,_0x502aa6))[_0xd0db('0x29')](handleError(_0x47e60c,null));};exports[_0xd0db('0x71')]=function(_0x596d55,_0x4ca52f,_0x593d4f){return db[_0xd0db('0x39')]['findOne']({'where':{'id':_0x596d55[_0xd0db('0x53')]['id']}})[_0xd0db('0x1f')](handleEntityNotFound(_0x4ca52f,null))[_0xd0db('0x1f')](function(_0x20b776){if(_0x20b776){return db[_0xd0db('0x72')][_0xd0db('0x73')](function(_0x2d1ba3){return db[_0xd0db('0x74')]['destroy']({'where':{'FaxAccountId':_0x596d55['params']['id']},'transaction':_0x2d1ba3})[_0xd0db('0x1f')](function(_0x53eecc){var _0x1d4f3e=_['map'](_0x596d55[_0xd0db('0x58')],function(_0xa301f8){_0xa301f8[_0xd0db('0x5c')]=_0x596d55[_0xd0db('0x53')]['id'];return _0xa301f8;});return db[_0xd0db('0x74')][_0xd0db('0x75')](_0x1d4f3e,{'transaction':_0x2d1ba3});});})[_0xd0db('0x1f')](function(){return db[_0xd0db('0x74')][_0xd0db('0x76')]({'where':{'FaxAccountId':_0x596d55['params']['id']},'order':_0xd0db('0x77')});});}})[_0xd0db('0x1f')](respondWithResult(_0x4ca52f,null))[_0xd0db('0x29')](handleError(_0x4ca52f,null));};exports[_0xd0db('0x78')]=function(_0x532c2a,_0x3f4442,_0x2e1351){var _0x5f0fb3={};var _0x4c1b41={};var _0x5b7935;var _0x47f695;return db[_0xd0db('0x39')]['findOne']({'where':{'id':_0x532c2a[_0xd0db('0x53')]['id']}})['then'](handleEntityNotFound(_0x3f4442,null))['then'](function(_0x5b8592){if(_0x5b8592){_0x5b7935=_0x5b8592;_0x4c1b41[_0xd0db('0x3f')]=_['keys'](db['FaxApplication'][_0xd0db('0x54')]);_0x4c1b41['query']=_['keys'](_0x532c2a['query']);_0x4c1b41['filters']=_[_0xd0db('0x3e')](_0x4c1b41[_0xd0db('0x3f')],_0x4c1b41[_0xd0db('0x3a')]);_0x5f0fb3[_0xd0db('0x41')]=_['intersection'](_0x4c1b41[_0xd0db('0x3f')],qs[_0xd0db('0x40')](_0x532c2a[_0xd0db('0x3a')][_0xd0db('0x40')]));_0x5f0fb3[_0xd0db('0x41')]=_0x5f0fb3['attributes']['length']?_0x5f0fb3[_0xd0db('0x41')]:_0x4c1b41[_0xd0db('0x3f')];_0x5f0fb3[_0xd0db('0x65')]=qs['sort'](_0x532c2a['query'][_0xd0db('0x45')]);_0x5f0fb3[_0xd0db('0x46')]=qs['filters'](_['pick'](_0x532c2a[_0xd0db('0x3a')],_0x4c1b41[_0xd0db('0x47')]));if(_0x532c2a[_0xd0db('0x3a')]['filter']){_0x5f0fb3[_0xd0db('0x46')]=_[_0xd0db('0x4b')](_0x5f0fb3[_0xd0db('0x46')],{'$or':_[_0xd0db('0x4c')](_0x5f0fb3[_0xd0db('0x41')],function(_0x576763){var _0x281a25={};_0x281a25[_0x576763]={'$like':'%'+_0x532c2a[_0xd0db('0x3a')][_0xd0db('0x4d')]+'%'};return _0x281a25;})});}_0x5f0fb3=_['merge']({},_0x5f0fb3,_0x532c2a['options']);return _0x5b7935['getApplications'](_0x5f0fb3);}})[_0xd0db('0x1f')](function(_0x4463ac){if(_0x4463ac){_0x47f695=_0x4463ac[_0xd0db('0x42')];if(!_0x532c2a['query'][_0xd0db('0x43')](_0xd0db('0x44'))){_0x5f0fb3[_0xd0db('0x30')]=qs[_0xd0db('0x30')](_0x532c2a['query'][_0xd0db('0x30')]);_0x5f0fb3[_0xd0db('0x2f')]=qs[_0xd0db('0x2f')](_0x532c2a[_0xd0db('0x3a')][_0xd0db('0x2f')]);}return _0x5b7935[_0xd0db('0x78')](_0x5f0fb3);}})[_0xd0db('0x1f')](function(_0x4515e9){if(_0x4515e9){return _0x4515e9?{'count':_0x47f695,'rows':_0x4515e9}:null;}})[_0xd0db('0x1f')](respondWithResult(_0x3f4442,null))[_0xd0db('0x29')](handleError(_0x3f4442,null));};function Extension(_0x457713,_0x5625b3,_0x276321,_0x57a305){this['context']=_0xd0db('0x79');this[_0xd0db('0x7a')]=_0x457713[_0xd0db('0x7b')];this[_0xd0db('0x7c')]=_0x57a305;this[_0xd0db('0x7d')]=_0xd0db('0x7e');this[_0xd0db('0x7f')]=_0xd0db('0x80');this[_0xd0db('0x5c')]=_0x457713['id'];this[_0xd0db('0x77')]=_0x5625b3;this[_0xd0db('0x81')]=_0x276321;}function createExtensionsReciveFax(_0x22464d){var _0x25e29a=0x1;var _0x387e78=[];_0x387e78['push'](new Extension(_0x22464d,_0x25e29a,'',_0xd0db('0x82')));_0x25e29a+=0x1;_0x387e78[_0xd0db('0x83')](new Extension(_0x22464d,_0x25e29a,_0xd0db('0x84'),_0xd0db('0x85')));_0x25e29a+=0x1;for(var _0x3aa066 in _0x22464d){if(_0x22464d[_0xd0db('0x43')](_0x3aa066)&&(_0x3aa066===_0xd0db('0x86')||_0x3aa066==='localstationid'||_0x3aa066==='gateway'||_0x3aa066===_0xd0db('0x87')||_0x3aa066===_0xd0db('0x88')||_0x3aa066===_0xd0db('0x89')||_0x3aa066==='minrate'||_0x3aa066===_0xd0db('0x8a')||_0x3aa066==='t38timeout')){_0x387e78[_0xd0db('0x83')](new Extension(_0x22464d,_0x25e29a,_0xd0db('0x8b')+_0x3aa066+')='+_0x22464d[_0x3aa066],'Set'));_0x25e29a+=0x1;}}_0x387e78['push'](new Extension(_0x22464d,_0x25e29a,'6',_0xd0db('0x8c')));_0x25e29a+=0x1;_0x387e78[_0xd0db('0x83')](new Extension(_0x22464d,_0x25e29a,_0xd0db('0x8d'),_0xd0db('0x8e')));_0x25e29a=0x0;return _0x387e78;}exports[_0xd0db('0x8f')]=function(_0x141361,_0x47304d,_0x5678ce){var _0x58caa3;return db['sequelize']['transaction'](function(_0x265fbf){return db[_0xd0db('0x39')][_0xd0db('0x57')](_0x141361[_0xd0db('0x58')],{'transaction':_0x265fbf})[_0xd0db('0x1f')](function(_0x57cf00){_0x58caa3=_0x57cf00[_0xd0db('0x90')]({'plain':!![]});return db[_0xd0db('0x91')][_0xd0db('0x75')](createExtensionsReciveFax(_0x58caa3),{'transaction':_0x265fbf});});})[_0xd0db('0x1f')](function(){return _0x58caa3;})['then'](respondWithResult(_0x47304d,null))[_0xd0db('0x29')](handleError(_0x47304d,null));};exports['updateAccountApplications']=function(_0x2229b1,_0x33badb,_0xa71c96){var _0x461cbc;return db[_0xd0db('0x72')]['transaction'](function(_0x7c7408){return db[_0xd0db('0x39')][_0xd0db('0x35')](_0x2229b1[_0xd0db('0x58')],{'where':{'id':_0x2229b1['body']['id']},'transaction':_0x7c7408})['then'](function(_0x44fb29){return db[_0xd0db('0x91')][_0xd0db('0x59')]({'where':{'FaxAccountId':_0x2229b1[_0xd0db('0x58')]['id']},'transaction':_0x7c7408})['then'](function(_0x2eeaca){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_[_0xd0db('0x69')](_0x2229b1['body'],[_0xd0db('0x92'),'key',_0xd0db('0x93'),_0xd0db('0x94'),_0xd0db('0x95'),_0xd0db('0x96')])),{'transaction':_0x7c7408});});});})[_0xd0db('0x1f')](function(){return db[_0xd0db('0x39')][_0xd0db('0x97')](_0x2229b1['body']['id']);})[_0xd0db('0x1f')](respondWithResult(_0x33badb,null))[_0xd0db('0x29')](handleError(_0x33badb,null));};exports[_0xd0db('0x98')]=function(_0xed7177,_0x55694a,_0x1be784){var _0x3b50b6={'raw':!![],'where':{}};var _0x3fe9a8={};var _0x2d0815={'count':0x0,'rows':[]};return db[_0xd0db('0x39')]['findOne']({'where':{'id':_0xed7177[_0xd0db('0x53')]['id']}})[_0xd0db('0x1f')](handleEntityNotFound(_0x55694a,null))[_0xd0db('0x1f')](function(_0x108ecf){if(_0x108ecf){_0x3fe9a8['model']=_[_0xd0db('0x3d')](db['FaxMessage'][_0xd0db('0x54')]);_0x3fe9a8[_0xd0db('0x3a')]=_['keys'](_0xed7177['query']);_0x3fe9a8[_0xd0db('0x47')]=_[_0xd0db('0x3e')](_0x3fe9a8['model'],_0x3fe9a8[_0xd0db('0x3a')]);_0x3b50b6[_0xd0db('0x41')]=_[_0xd0db('0x3e')](_0x3fe9a8['model'],qs[_0xd0db('0x40')](_0xed7177[_0xd0db('0x3a')][_0xd0db('0x40')]));_0x3b50b6[_0xd0db('0x41')]=_0x3b50b6[_0xd0db('0x41')][_0xd0db('0x42')]?_0x3b50b6[_0xd0db('0x41')]:_0x3fe9a8[_0xd0db('0x3f')];if(!_0xed7177['query'][_0xd0db('0x43')](_0xd0db('0x44'))){_0x3b50b6['limit']=qs['limit'](_0xed7177[_0xd0db('0x3a')][_0xd0db('0x30')]);_0x3b50b6[_0xd0db('0x2f')]=qs['offset'](_0xed7177[_0xd0db('0x3a')][_0xd0db('0x2f')]);}_0x3b50b6[_0xd0db('0x65')]=qs[_0xd0db('0x45')](_0xed7177[_0xd0db('0x3a')]['sort']);_0x3b50b6[_0xd0db('0x46')]=qs[_0xd0db('0x47')](_[_0xd0db('0x48')](_0xed7177[_0xd0db('0x3a')],_0x3fe9a8[_0xd0db('0x47')]));_0x3b50b6[_0xd0db('0x46')][_0xd0db('0x5c')]=_0x108ecf['id'];if(_0xed7177[_0xd0db('0x3a')][_0xd0db('0x4d')]){_0x3b50b6['where']=_[_0xd0db('0x4b')](_0x3b50b6[_0xd0db('0x46')],{'$or':_[_0xd0db('0x4c')](_0x3b50b6[_0xd0db('0x41')],function(_0x2bf779){var _0x143b14={};_0x143b14[_0x2bf779]={'$like':'%'+_0xed7177[_0xd0db('0x3a')]['filter']+'%'};return _0x143b14;})});}if(_0xed7177[_0xd0db('0x3a')][_0xd0db('0x99')]){var _0x61a926=_0xed7177[_0xd0db('0x3a')]['$gte'][_0xd0db('0x9a')](',');var _0x153ae2={};_0x153ae2[_0x61a926[0x0]]={'$gte':moment(_0x61a926[0x1])[_0xd0db('0x9b')](_0xd0db('0x9c'))};_0x3b50b6['where']=_[_0xd0db('0x4b')](_0x3b50b6[_0xd0db('0x46')],_0x153ae2);}_0x3b50b6=_[_0xd0db('0x4b')]({},_0x3b50b6,_0xed7177[_0xd0db('0x55')]);return db[_0xd0db('0x9d')][_0xd0db('0x2e')]({'where':_0x3b50b6[_0xd0db('0x46')]})[_0xd0db('0x1f')](function(_0x5bffdf){_0x2d0815[_0xd0db('0x2e')]=_0x5bffdf;if(_0xed7177['query'][_0xd0db('0x4e')]){_0x3b50b6[_0xd0db('0x4f')]=[{'all':!![]}];}return db['FaxMessage'][_0xd0db('0x50')](_0x3b50b6);})['then'](function(_0x528f91){_0x2d0815[_0xd0db('0x51')]=_0x528f91;return _0x2d0815;});}})[_0xd0db('0x1f')](respondWithFilteredResult(_0x55694a,_0x3b50b6))[_0xd0db('0x29')](handleError(_0x55694a,null));};exports[_0xd0db('0x9e')]=function(_0x3562f7,_0x3314b1,_0x51be7b){var _0x3c0331,_0x520183={},_0x425a2e;if(_0x3562f7['body']['to']){_0x425a2e=_0x3562f7[_0xd0db('0x58')]['to'][0x0];}return db[_0xd0db('0x39')][_0xd0db('0x56')]({'where':{'id':_0x3562f7[_0xd0db('0x53')]['id']},'include':[{'model':db[_0xd0db('0x9f')],'as':_0xd0db('0xa0'),'include':[{'model':db['CmContact'],'as':_0xd0db('0xa1'),'where':{'fax':_0x425a2e},'limit':0x1,'order':[[_0xd0db('0x94'),_0xd0db('0xa2')]]}]}]})[_0xd0db('0x1f')](handleEntityNotFound(_0x3314b1,null))[_0xd0db('0x1f')](function(_0xff69d9){_0x3c0331=_0xff69d9;if(_0x3562f7['body'][_0xd0db('0xa3')]&&_0x3562f7[_0xd0db('0x58')]['attachments'][_0xd0db('0x42')]){for(var _0x6e77a3=0x0;_0x6e77a3<_0x3562f7[_0xd0db('0x58')][_0xd0db('0xa3')][_0xd0db('0x42')];_0x6e77a3+=0x1){_0x3562f7['body'][_0xd0db('0xa3')][_0x6e77a3]={'filename':_0x3562f7[_0xd0db('0x58')]['attachments'][_0x6e77a3][_0xd0db('0x37')],'id':_0x3562f7['body'][_0xd0db('0xa3')][_0x6e77a3]['id'],'path':path[_0xd0db('0xa4')](config[_0xd0db('0xa5')],_0xd0db('0xa6'),_0x3562f7['body'][_0xd0db('0xa3')][_0x6e77a3][_0xd0db('0xa7')])};}}return respondWithRpcPromise(_0xd0db('0xa8'),_0xd0db('0xa8'),{'FaxAccountId':_[_0xd0db('0xa9')](_0x3562f7[_0xd0db('0x53')]['id'])?undefined:_0x3562f7[_0xd0db('0x53')]['id'],'path':_[_0xd0db('0xa9')](_0x3562f7[_0xd0db('0x58')][_0xd0db('0xa3')][0x0][_0xd0db('0x7')])?undefined:_0x3562f7[_0xd0db('0x58')][_0xd0db('0xa3')][0x0][_0xd0db('0x7')],'fax':_[_0xd0db('0xa9')](_0x3562f7[_0xd0db('0x58')]['to'][0x0])?undefined:_0x3562f7[_0xd0db('0x58')]['to'][0x0]},client9002);})[_0xd0db('0x1f')](function(){if(_0x3c0331){if(_[_0xd0db('0xa9')](_0x3562f7[_0xd0db('0x58')][_0xd0db('0xaa')])){_0x3562f7[_0xd0db('0x58')][_0xd0db('0xaa')]=util['format'](_0xd0db('0xab'),_0x3c0331[_0xd0db('0x37')],_0x3c0331[_0xd0db('0xac')]);}if(_0x3c0331[_0xd0db('0xa0')]){if(_0x3c0331[_0xd0db('0xa0')][_0xd0db('0xa1')][_0xd0db('0x42')]){return _0x3c0331[_0xd0db('0xa0')][_0xd0db('0xa1')][0x0];}else{return db[_0xd0db('0xad')][_0xd0db('0x57')](_[_0xd0db('0x17')](_0x3562f7[_0xd0db('0x58')],{'firstName':_0x3562f7['body']['to'][0x0],'phone':_0x3562f7['body']['to'][0x0],'fax':_0x3562f7[_0xd0db('0x58')]['to'][0x0],'ListId':_0x3c0331[_0xd0db('0x96')]}));}}else{throw new Error(_0xd0db('0xae'));}}else{throw new Error(_0xd0db('0xaf'));}})[_0xd0db('0x1f')](function(_0x45bcb7){if(_0x45bcb7){return db[_0xd0db('0x67')][_0xd0db('0x56')]({'where':{'ContactId':_0x45bcb7['id'],'closed':![],'FaxAccountId':_0x3c0331['id']}})['then'](function(_0x9461e5){if(_0x9461e5){return[_0x9461e5,![]];}return db[_0xd0db('0x67')][_0xd0db('0x57')]({'UserId':_0x3562f7[_0xd0db('0xb0')]['id'],'ContactId':_0x45bcb7['id'],'FaxAccountId':_0x3c0331['id'],'fax':_0x3562f7[_0xd0db('0x58')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xd0db('0x4b')](_0x3562f7['body'],{'read':![],'body':_0x3562f7[_0xd0db('0x58')][_0xd0db('0xa3')][0x0][_0xd0db('0xb1')],'FaxAccountId':_0x3c0331['id'],'UserId':_0x3562f7[_0xd0db('0xb0')]['id'],'ContactId':_0x45bcb7['id'],'AttachmentId':_0x3562f7['body']['attachments'][0x0]['id']})]},{'include':[{'model':db[_0xd0db('0x9d')],'as':_0xd0db('0xb2')}]})[_0xd0db('0x1f')](function(_0x505a56){return[_0x505a56,!![]];});});}else{throw new Error(_0xd0db('0xb3'));}})[_0xd0db('0xb4')](function(_0x4cd691,_0x4e797f){if(_0x4e797f){return _0x4cd691;}return db[_0xd0db('0x9d')]['create']({'direction':_0xd0db('0xb5'),'read':![],'body':_0x3562f7[_0xd0db('0x58')][_0xd0db('0xa3')][0x0][_0xd0db('0xb1')],'FaxAccountId':_0x3c0331['id'],'FaxInteractionId':_0x4cd691['id'],'UserId':_0x3562f7[_0xd0db('0xb0')]['id'],'ContactId':_0x4cd691[_0xd0db('0xb6')],'AttachmentId':_0x3562f7['body'][_0xd0db('0xa3')][0x0]['id']})[_0xd0db('0x1f')](function(_0x3f19fd){_0x4cd691[_0xd0db('0xb7')][_0xd0db('0xb2')]=[];_0x4cd691[_0xd0db('0xb7')][_0xd0db('0xb2')][_0xd0db('0x83')](_0x3f19fd[_0xd0db('0xb7')]);return _0x4cd691;});})[_0xd0db('0x1f')](function(_0x479b9e){respondWithRpcPromise(_0xd0db('0xb8'),'SendFax',{'FaxAccountId':_[_0xd0db('0xa9')](_0x3562f7['params']['id'])?undefined:_0x3562f7['params']['id'],'path':_[_0xd0db('0xa9')](_0x3562f7[_0xd0db('0x58')][_0xd0db('0xa3')][0x0]['path'])?undefined:_0x3562f7[_0xd0db('0x58')][_0xd0db('0xa3')][0x0]['path'],'fax':_[_0xd0db('0xa9')](_0x3562f7['body']['to'][0x0])?undefined:_0x3562f7[_0xd0db('0x58')]['to'][0x0],'AttachmentId':_0x3562f7[_0xd0db('0x58')][_0xd0db('0xa3')][0x0]['id']},client9002)[_0xd0db('0x1f')](function(_0x1a6e68){logger[_0xd0db('0x20')](_0xd0db('0xb9'),_0x1a6e68);})[_0xd0db('0x29')](function(_0x50039b){logger[_0xd0db('0x20')]('SendFaxRpc,\x20%s',_0x50039b);});return _0x479b9e;})[_0xd0db('0x1f')](respondWithResult(_0x3314b1,null))['catch'](handleError(_0x3314b1,null));};exports[_0xd0db('0xba')]=function(_0x214114,_0x42d5b0,_0x47fc42){return db[_0xd0db('0x39')]['find']({'where':{'id':_0x214114[_0xd0db('0x53')]['id']}})[_0xd0db('0x1f')](handleEntityNotFound(_0x42d5b0,null))[_0xd0db('0x1f')](function(_0x88d92a){if(_0x88d92a){return _0x88d92a[_0xd0db('0xba')](_0x214114[_0xd0db('0x58')]['ids'],_[_0xd0db('0x69')](_0x214114[_0xd0db('0x58')],[_0xd0db('0x61'),'id'])||{})[_0xd0db('0xb4')](function(_0x3d3eb7){for(var _0x1f1200=0x0;_0x1f1200<_0x214114[_0xd0db('0x58')][_0xd0db('0x61')][_0xd0db('0x42')];_0x1f1200+=0x1){socket[_0xd0db('0xbb')](_0xd0db('0xbc'),{'UserId':_0x214114['body'][_0xd0db('0x61')][_0x1f1200],'FaxAccountId':_0x214114[_0xd0db('0x53')]['id']});}return _0x3d3eb7;});}})[_0xd0db('0x1f')](respondWithResult(_0x42d5b0,null))[_0xd0db('0x29')](handleError(_0x42d5b0,null));};exports[_0xd0db('0xbd')]=function(_0x1be773,_0x58eba3,_0x5dfb98){var _0x1afae7;return db[_0xd0db('0x39')][_0xd0db('0x56')]({'where':{'id':_0x1be773['params']['id']}})[_0xd0db('0x1f')](handleEntityNotFound(_0x58eba3,null))[_0xd0db('0x1f')](function(_0x202fa7){if(_0x202fa7){return _0x202fa7[_0xd0db('0xbd')](_0x1be773[_0xd0db('0x3a')][_0xd0db('0x61')])['then'](function(_0x397af4){if(_[_0xd0db('0xbe')](_0x1be773[_0xd0db('0x3a')][_0xd0db('0x61')])){for(var _0x25744c=0x0;_0x25744c<_0x1be773[_0xd0db('0x3a')]['ids'][_0xd0db('0x42')];_0x25744c+=0x1){socket[_0xd0db('0xbb')]('userFaxAccount:remove',{'UserId':_0x1be773['query'][_0xd0db('0x61')][_0x25744c],'FaxAccountId':_0x1be773['params']['id']});}}else{socket[_0xd0db('0xbb')](_0xd0db('0xbf'),{'UserId':_0x1be773[_0xd0db('0x3a')][_0xd0db('0x61')],'FaxAccountId':_0x1be773[_0xd0db('0x53')]['id']});}});}})[_0xd0db('0x1f')](respondWithStatusCode(_0x58eba3,null))[_0xd0db('0x29')](handleError(_0x58eba3,null));};exports[_0xd0db('0xc0')]=function(_0x43e7c6,_0x4d61a2,_0x1d6ea8){var _0x4a8e25={};var _0x31918d={};var _0x1e0f16;var _0x1a4146;return db[_0xd0db('0x39')][_0xd0db('0x5f')]({'where':{'id':_0x43e7c6[_0xd0db('0x53')]['id']}})['then'](handleEntityNotFound(_0x4d61a2,null))[_0xd0db('0x1f')](function(_0x15269c){if(_0x15269c){_0x1e0f16=_0x15269c;_0x31918d[_0xd0db('0x3f')]=_[_0xd0db('0x3d')](db[_0xd0db('0x6b')][_0xd0db('0x54')]);_0x31918d[_0xd0db('0x3a')]=_['keys'](_0x43e7c6[_0xd0db('0x3a')]);_0x31918d['filters']=_[_0xd0db('0x3e')](_0x31918d[_0xd0db('0x3f')],_0x31918d[_0xd0db('0x3a')]);_0x4a8e25['attributes']=_['intersection'](_0x31918d[_0xd0db('0x3f')],qs[_0xd0db('0x40')](_0x43e7c6[_0xd0db('0x3a')][_0xd0db('0x40')]));_0x4a8e25[_0xd0db('0x41')]=_0x4a8e25[_0xd0db('0x41')][_0xd0db('0x42')]?_0x4a8e25[_0xd0db('0x41')]:_0x31918d['model'];_0x4a8e25[_0xd0db('0x65')]=qs[_0xd0db('0x45')](_0x43e7c6['query'][_0xd0db('0x45')]);_0x4a8e25['where']=qs[_0xd0db('0x47')](_[_0xd0db('0x48')](_0x43e7c6[_0xd0db('0x3a')],_0x31918d[_0xd0db('0x47')]));if(_0x43e7c6[_0xd0db('0x3a')][_0xd0db('0x4d')]){_0x4a8e25[_0xd0db('0x46')]=_[_0xd0db('0x4b')](_0x4a8e25['where'],{'$or':_[_0xd0db('0x4c')](_0x4a8e25['attributes'],function(_0x298f53){var _0x1349f3={};_0x1349f3[_0x298f53]={'$like':'%'+_0x43e7c6[_0xd0db('0x3a')]['filter']+'%'};return _0x1349f3;})});}_0x4a8e25=_[_0xd0db('0x4b')]({},_0x4a8e25,_0x43e7c6[_0xd0db('0x55')]);return _0x1e0f16[_0xd0db('0xc0')](_0x4a8e25);}})[_0xd0db('0x1f')](function(_0x5e8959){if(_0x5e8959){_0x1a4146=_0x5e8959[_0xd0db('0x42')];if(!_0x43e7c6[_0xd0db('0x3a')][_0xd0db('0x43')](_0xd0db('0x44'))){_0x4a8e25[_0xd0db('0x30')]=qs[_0xd0db('0x30')](_0x43e7c6[_0xd0db('0x3a')][_0xd0db('0x30')]);_0x4a8e25['offset']=qs['offset'](_0x43e7c6['query'][_0xd0db('0x2f')]);}return _0x1e0f16[_0xd0db('0xc0')](_0x4a8e25);}})[_0xd0db('0x1f')](function(_0x9b6ebc){if(_0x9b6ebc){return _0x9b6ebc?{'count':_0x1a4146,'rows':_0x9b6ebc}:null;}})['then'](respondWithResult(_0x4d61a2,null))[_0xd0db('0x29')](handleError(_0x4d61a2,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index f72121e..cd513f3 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 _0x24bf=['emit','hook','exports','../../mysqldb','FaxAccount','setMaxListeners','save','update','remove'];(function(_0x7ca18f,_0x11e069){var _0x5e0135=function(_0xd56668){while(--_0xd56668){_0x7ca18f['push'](_0x7ca18f['shift']());}};_0x5e0135(++_0x11e069);}(_0x24bf,0xed));var _0xf24b=function(_0x5ba9d1,_0x4ef651){_0x5ba9d1=_0x5ba9d1-0x0;var _0x1bb891=_0x24bf[_0x5ba9d1];return _0x1bb891;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xf24b('0x0'))['db'][_0xf24b('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xf24b('0x2')](0x0);var events={'afterCreate':_0xf24b('0x3'),'afterUpdate':_0xf24b('0x4'),'afterDestroy':_0xf24b('0x5')};function emitEvent(_0x5f2fc2){return function(_0x38ee14,_0x25198f,_0xa0e89e){FaxAccountEvents[_0xf24b('0x6')](_0x5f2fc2+':'+_0x38ee14['id'],_0x38ee14);FaxAccountEvents[_0xf24b('0x6')](_0x5f2fc2,_0x38ee14);_0xa0e89e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xf24b('0x7')](e,emitEvent(event));}}module[_0xf24b('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x4c4c=['hasOwnProperty','hook','exports','events','FaxAccount','setMaxListeners','save','update','remove','emit'];(function(_0x16c127,_0x54f7ef){var _0xcc6736=function(_0x23b18f){while(--_0x23b18f){_0x16c127['push'](_0x16c127['shift']());}};_0xcc6736(++_0x54f7ef);}(_0x4c4c,0x99));var _0xc4c4=function(_0x29d830,_0x3b62d7){_0x29d830=_0x29d830-0x0;var _0x322c08=_0x4c4c[_0x29d830];return _0x322c08;};'use strict';var EventEmitter=require(_0xc4c4('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xc4c4('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xc4c4('0x2')](0x0);var events={'afterCreate':_0xc4c4('0x3'),'afterUpdate':_0xc4c4('0x4'),'afterDestroy':_0xc4c4('0x5')};function emitEvent(_0x2f019f){return function(_0x48293d,_0x165b2b,_0x1760bd){FaxAccountEvents[_0xc4c4('0x6')](_0x2f019f+':'+_0x48293d['id'],_0x48293d);FaxAccountEvents[_0xc4c4('0x6')](_0x2f019f,_0x48293d);_0x1760bd(null);};}for(var e in events){if(events[_0xc4c4('0x7')](e)){var event=events[e];FaxAccount[_0xc4c4('0x8')](e,emitEvent(event));}}module[_0xc4c4('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index bdb39fd..8486e17 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 _0x1943=['./faxAccount.attributes','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','bluebird'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x1943,0x124));var _0x3194=function(_0x3cf4d3,_0x48065e){_0x3cf4d3=_0x3cf4d3-0x0;var _0x4e547b=_0x1943[_0x3cf4d3];return _0x4e547b;};'use strict';var _=require(_0x3194('0x0'));var util=require(_0x3194('0x1'));var logger=require(_0x3194('0x2'))(_0x3194('0x3'));var moment=require('moment');var BPromise=require(_0x3194('0x4'));var rp=require('request-promise');var attributes=require(_0x3194('0x5'));module['exports']=function(_0x4d62c9,_0x186d73){return _0x4d62c9[_0x3194('0x6')](_0x3194('0x7'),attributes,{'tableName':_0x3194('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8fa1=['lodash','../../config/logger','api','moment','bluebird','request-promise','./faxAccount.attributes','exports','FaxAccount','fax_accounts'];(function(_0x2f2964,_0x218d08){var _0x45ec5d=function(_0x1d6288){while(--_0x1d6288){_0x2f2964['push'](_0x2f2964['shift']());}};_0x45ec5d(++_0x218d08);}(_0x8fa1,0x15e));var _0x18fa=function(_0x3d5287,_0x1a3882){_0x3d5287=_0x3d5287-0x0;var _0x5d2dad=_0x8fa1[_0x3d5287];return _0x5d2dad;};'use strict';var _=require(_0x18fa('0x0'));var util=require('util');var logger=require(_0x18fa('0x1'))(_0x18fa('0x2'));var moment=require(_0x18fa('0x3'));var BPromise=require(_0x18fa('0x4'));var rp=require(_0x18fa('0x5'));var attributes=require(_0x18fa('0x6'));module[_0x18fa('0x7')]=function(_0x23dd93,_0x487b7e){return _0x23dd93['define'](_0x18fa('0x8'),attributes,{'tableName':_0x18fa('0x9'),'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 86898e3..dabe0ff 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 _0x36cd=['unshift','agent','waitForTheAssignedAgent','startRouting','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./faxAccount.socket','register','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','raw','options','where','attributes','limit','include','model','map','NotifyFaxAccount','fax','CmContact','describe','Sequelize','difference','keys','updatedAt','CompanyId','ListId','body','isNil','from\x20is\x20mandatory','ValidationError','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','DESC','FaxApplication','List','get','applications','Applications','list','priority','Contacts','from','create','FaxInteraction','Contact\x20not\x20found','length','close','unmanaged','created','interaction','FaxMessage','ContactId','User','name'];(function(_0x155c64,_0x26ff95){var _0x1f154a=function(_0xbc46e4){while(--_0xbc46e4){_0x155c64['push'](_0x155c64['shift']());}};_0x1f154a(++_0x26ff95);}(_0x36cd,0x1a3));var _0xd36c=function(_0x3aeb9b,_0x3f3ff2){_0x3aeb9b=_0x3aeb9b-0x0;var _0x5e318f=_0x36cd[_0x3aeb9b];return _0x5e318f;};'use strict';var _=require('lodash');var util=require(_0xd36c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd36c('0x1'));var fs=require('fs');var Redis=require(_0xd36c('0x2'));var db=require(_0xd36c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd36c('0x4'))(_0xd36c('0x5'));var config=require(_0xd36c('0x6'));var jayson=require(_0xd36c('0x7'));var client=jayson['client'][_0xd36c('0x8')]({'port':0x232c});config[_0xd36c('0x9')]=_[_0xd36c('0xa')](config[_0xd36c('0x9')],{'host':_0xd36c('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd36c('0x9')]));require(_0xd36c('0xc'))[_0xd36c('0xd')](socket);function respondWithRpcPromise(_0xae03a2,_0x5132d8,_0x3b044f){return new BPromise(function(_0x501d4f,_0x20c973){return client['request'](_0xae03a2,_0x3b044f)[_0xd36c('0xe')](function(_0x2d573f){logger[_0xd36c('0xf')](_0xd36c('0x10'),_0x5132d8,_0xd36c('0x11'));logger[_0xd36c('0x12')](_0xd36c('0x13'),_0x5132d8,_0xd36c('0x11'),JSON['stringify'](_0x2d573f));if(_0x2d573f[_0xd36c('0x14')]){if(_0x2d573f[_0xd36c('0x14')][_0xd36c('0x15')]===0x1f4){logger[_0xd36c('0x14')](_0xd36c('0x10'),_0x5132d8,_0x2d573f[_0xd36c('0x14')][_0xd36c('0x16')]);return _0x20c973(_0x2d573f['error'][_0xd36c('0x16')]);}logger[_0xd36c('0x14')]('FaxAccount,\x20%s,\x20%s',_0x5132d8,_0x2d573f[_0xd36c('0x14')][_0xd36c('0x16')]);return _0x501d4f(_0x2d573f[_0xd36c('0x14')]['message']);}else{logger[_0xd36c('0xf')](_0xd36c('0x10'),_0x5132d8,_0xd36c('0x11'));_0x501d4f(_0x2d573f[_0xd36c('0x17')][_0xd36c('0x16')]);}})[_0xd36c('0x18')](function(_0x41c8cd){logger['error'](_0xd36c('0x10'),_0x5132d8,_0x41c8cd);_0x20c973(_0x41c8cd);});});}exports[_0xd36c('0x19')]=function(_0x57b3b9){var _0x258cdd=this;return new Promise(function(_0x594231,_0x467d77){return db[_0xd36c('0x1a')][_0xd36c('0x1b')]({'raw':_0x57b3b9['options']?_0x57b3b9['options'][_0xd36c('0x1c')]===undefined?!![]:![]:!![],'where':_0x57b3b9['options']?_0x57b3b9[_0xd36c('0x1d')][_0xd36c('0x1e')]||null:null,'attributes':_0x57b3b9[_0xd36c('0x1d')]?_0x57b3b9[_0xd36c('0x1d')][_0xd36c('0x1f')]||null:null,'limit':_0x57b3b9[_0xd36c('0x1d')]?_0x57b3b9[_0xd36c('0x1d')][_0xd36c('0x20')]||null:null,'include':_0x57b3b9['options']?_0x57b3b9['options']['include']?_['map'](_0x57b3b9[_0xd36c('0x1d')][_0xd36c('0x21')],function(_0x542ed2){return{'model':db[_0x542ed2[_0xd36c('0x22')]],'as':_0x542ed2['as'],'attributes':_0x542ed2[_0xd36c('0x1f')],'include':_0x542ed2[_0xd36c('0x21')]?_[_0xd36c('0x23')](_0x542ed2[_0xd36c('0x21')],function(_0x1d697a){return{'model':db[_0x1d697a[_0xd36c('0x22')]],'as':_0x1d697a['as'],'attributes':_0x1d697a['attributes'],'include':_0x1d697a[_0xd36c('0x21')]?_['map'](_0x1d697a['include'],function(_0x3a0360){return{'model':db[_0x3a0360['model']],'as':_0x3a0360['as'],'attributes':_0x3a0360[_0xd36c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd36c('0xe')](function(_0x5239bd){logger[_0xd36c('0xf')](_0xd36c('0x19'),_0x57b3b9);logger['debug'](_0xd36c('0x19'),_0x57b3b9,JSON['stringify'](_0x5239bd));_0x594231(_0x5239bd);})[_0xd36c('0x18')](function(_0x58668b){logger['error'](_0xd36c('0x19'),_0x58668b[_0xd36c('0x16')],_0x57b3b9);_0x467d77(_0x258cdd[_0xd36c('0x14')](0x1f4,_0x58668b[_0xd36c('0x16')]));});});};exports[_0xd36c('0x24')]=function(_0xc2f4b0,_0x19a28d,_0x33a97a){var _0x4ada07=this;return new Promise(function(_0x43fdb5,_0x4a8542){var _0x5a0885={'body':_0xc2f4b0['body'],'channel':_0xd36c('0x25')};var _0x4c114a=[];var _0x251272=[];var _0x313e24={};return db[_0xd36c('0x26')][_0xd36c('0x27')]()[_0xd36c('0xe')](function(_0x1368fa){if(!_0x1368fa){throw new db[(_0xd36c('0x28'))]['ValidationError']('no\x20available\x20attributes');}_0x4c114a=_[_0xd36c('0x29')](_[_0xd36c('0x2a')](_0x1368fa),['createdAt',_0xd36c('0x2b')]);_0x251272=_[_0xd36c('0x29')](_[_0xd36c('0x2a')](_0x1368fa),['createdAt',_0xd36c('0x2b'),_0xd36c('0x2c'),_0xd36c('0x2d')]);if(_0xc2f4b0[_0xd36c('0x2e')]['id']){delete _0xc2f4b0[_0xd36c('0x2e')]['id'];}if(_[_0xd36c('0x2f')](_0xc2f4b0['body']['from'])){throw new db['Sequelize']['ValidationError'](_0xd36c('0x30'));}if(_[_0xd36c('0x2f')](_0xc2f4b0['body'][_0xd36c('0x2e')])||_0xc2f4b0[_0xd36c('0x2e')][_0xd36c('0x2e')]===''){throw new db[(_0xd36c('0x28'))][(_0xd36c('0x31'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0xc2f4b0[_0xd36c('0x2e')][_0xd36c('0x32')])){throw new db[(_0xd36c('0x28'))][(_0xd36c('0x31'))](_0xd36c('0x33')+_0x251272);}if(!_[_0xd36c('0x34')](_0x251272,_0xc2f4b0[_0xd36c('0x2e')]['mapKey'])){throw new db[(_0xd36c('0x28'))][(_0xd36c('0x31'))](_0xd36c('0x35')+_0x251272);}_0x313e24[_0xc2f4b0[_0xd36c('0x2e')][_0xd36c('0x32')]]=_0xc2f4b0[_0xd36c('0x2e')]['from'];})[_0xd36c('0xe')](function(){return db[_0xd36c('0x1a')][_0xd36c('0x36')]({'where':{'id':_0xc2f4b0[_0xd36c('0x37')]['id']},'include':[{'model':db[_0xd36c('0x38')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x313e24,'limit':0x1,'order':[[_0xd36c('0x2b'),_0xd36c('0x39')]]}]},{'model':db[_0xd36c('0x3a')],'as':'Applications'}]});})[_0xd36c('0xe')](function(_0x343a37){if(_0x343a37&&_0x343a37[_0xd36c('0x3b')]){var _0x35f223=_0x343a37[_0xd36c('0x3c')]({'plain':!![]});_0x5a0885[_0xd36c('0x37')]=_0x35f223;_0x5a0885[_0xd36c('0x3d')]=_0x35f223[_0xd36c('0x3e')];_0x5a0885[_0xd36c('0x3f')]=_0x35f223[_0xd36c('0x3b')];_0x5a0885[_0xd36c('0x3d')]=_['orderBy'](_0x5a0885[_0xd36c('0x3d')],[_0xd36c('0x40')],['asc']);if(_0x5a0885[_0xd36c('0x37')][_0xd36c('0x3e')]){delete _0x5a0885[_0xd36c('0x37')][_0xd36c('0x3e')];}if(_0x5a0885['account']['List']&&_0x5a0885[_0xd36c('0x37')][_0xd36c('0x3b')][_0xd36c('0x41')]['length']){return _0x5a0885[_0xd36c('0x37')]['List']['Contacts'][0x0];}var _0x2cd2f6=_[_0xd36c('0xa')](_0xc2f4b0[_0xd36c('0x2e')],{'firstName':_0xc2f4b0[_0xd36c('0x2e')][_0xd36c('0x42')],'ListId':_0x35f223[_0xd36c('0x2d')]});_0x2cd2f6[_0xc2f4b0['body'][_0xd36c('0x32')]]=_0xc2f4b0['body'][_0xd36c('0x42')];return db[_0xd36c('0x26')][_0xd36c('0x43')](_0x2cd2f6,{'fields':_0x4c114a,'raw':!![]});}})[_0xd36c('0xe')](function(_0x4aa639){_0x5a0885['contact']=_0x4aa639;if(_0x4aa639){var _0xfd42a0={'ContactId':_0x4aa639['id'],'FaxAccountId':_0xc2f4b0[_0xd36c('0x37')]['id'],'fax':_0x4aa639[_0xd36c('0x25')]};return db[_0xd36c('0x44')][_0xd36c('0x36')]({'where':{'ContactId':_0x4aa639['id'],'closed':![],'FaxAccountId':_0xc2f4b0[_0xd36c('0x37')]['id']}})[_0xd36c('0xe')](function(_0x36b3d6){if(_0x36b3d6){return[_0x36b3d6,![]];}return db['FaxInteraction']['create'](_0xfd42a0)[_0xd36c('0xe')](function(_0x2707b9){return[_0x2707b9,!![]];});});}else{throw new Error(_0xd36c('0x45'));}})['spread'](function(_0x4fb25c,_0x3cbb56){var _0x4a6f38=_0x4fb25c[_0xd36c('0x3c')]({'plain':!![]});if(_0x3cbb56){if(_0x5a0885[_0xd36c('0x37')]['autoclose']){_0x5a0885[_0xd36c('0x3d')]['push']({'id':0x0,'priority':_0x5a0885['applications'][_0xd36c('0x46')]+0x1,'app':_0xd36c('0x47'),'appdata':_0xd36c('0x48'),'interval':'*,*,*,*'});}_0x4a6f38['created']=!![];}else{_0x4a6f38[_0xd36c('0x49')]=![];}_0x5a0885[_0xd36c('0x4a')]=_0x4a6f38;return db[_0xd36c('0x4b')]['create']({'body':_0xc2f4b0[_0xd36c('0x2e')]['body'],'FaxAccountId':_0xc2f4b0[_0xd36c('0x37')]['id'],'FaxInteractionId':_0x4fb25c['id'],'direction':'in','ContactId':_0x4fb25c[_0xd36c('0x4c')],'AttachmentId':_0xc2f4b0[_0xd36c('0x2e')]['AttachmentId']});})[_0xd36c('0xe')](function(_0x14b995){_0x5a0885[_0xd36c('0x16')]=_0x14b995;if(_0x5a0885[_0xd36c('0x4a')]['UserId']){return db[_0xd36c('0x4d')][_0xd36c('0x36')]({'attributes':['id',_0xd36c('0x4e')],'where':{'id':_0x5a0885['interaction']['UserId']}})[_0xd36c('0xe')](function(_0x10286a){if(_0x10286a){_0x5a0885['applications'][_0xd36c('0x4f')]({'id':0x0,'priority':0x0,'app':_0xd36c('0x50'),'appdata':_0x10286a[_0xd36c('0x4e')]+','+(_0x5a0885[_0xd36c('0x37')][_0xd36c('0x51')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x5a0885);});}return respondWithRpcPromise('Start',_0xd36c('0x52'),_0x5a0885);})[_0xd36c('0xe')](function(_0x3d302a){_0x43fdb5(_0x3d302a);})['catch'](function(_0x1a7744){_0x4a8542(_0x4ada07[_0xd36c('0x14')](0x1f4,_0x1a7744[_0xd36c('0x16')]));});});}; \ No newline at end of file +var _0xea05=['push','close','unmanaged','*,*,*,*','created','FaxMessage','ContactId','interaction','UserId','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','FaxAccount','findAll','options','raw','attributes','include','map','model','GetFaxAccount','stringify','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','Contacts','DESC','FaxApplication','Applications','get','applications','list','priority','asc','length','defaults','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose'];(function(_0x1dc8fa,_0x48a6a1){var _0x373234=function(_0x2e0234){while(--_0x2e0234){_0x1dc8fa['push'](_0x1dc8fa['shift']());}};_0x373234(++_0x48a6a1);}(_0xea05,0x126));var _0x5ea0=function(_0x3a7c0c,_0x311589){_0x3a7c0c=_0x3a7c0c-0x0;var _0xc12fb6=_0xea05[_0x3a7c0c];return _0xc12fb6;};'use strict';var _=require(_0x5ea0('0x0'));var util=require(_0x5ea0('0x1'));var moment=require(_0x5ea0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ea0('0x3'))['db'];var utils=require(_0x5ea0('0x4'));var logger=require(_0x5ea0('0x5'))(_0x5ea0('0x6'));var config=require(_0x5ea0('0x7'));var jayson=require(_0x5ea0('0x8'));var client=jayson[_0x5ea0('0x9')][_0x5ea0('0xa')]({'port':0x232c});config[_0x5ea0('0xb')]=_['defaults'](config[_0x5ea0('0xb')],{'host':_0x5ea0('0xc'),'port':0x18eb});var socket=require(_0x5ea0('0xd'))(new Redis(config[_0x5ea0('0xb')]));require(_0x5ea0('0xe'))[_0x5ea0('0xf')](socket);function respondWithRpcPromise(_0x3a9bb7,_0x581094,_0x5827d6){return new BPromise(function(_0x5aa3f9,_0x1a83d9){return client[_0x5ea0('0x10')](_0x3a9bb7,_0x5827d6)[_0x5ea0('0x11')](function(_0x943bd9){logger['info'](_0x5ea0('0x12'),_0x581094,_0x5ea0('0x13'));logger[_0x5ea0('0x14')](_0x5ea0('0x15'),_0x581094,_0x5ea0('0x13'),JSON['stringify'](_0x943bd9));if(_0x943bd9[_0x5ea0('0x16')]){if(_0x943bd9['error'][_0x5ea0('0x17')]===0x1f4){logger[_0x5ea0('0x16')](_0x5ea0('0x12'),_0x581094,_0x943bd9['error'][_0x5ea0('0x18')]);return _0x1a83d9(_0x943bd9[_0x5ea0('0x16')][_0x5ea0('0x18')]);}logger[_0x5ea0('0x16')](_0x5ea0('0x12'),_0x581094,_0x943bd9[_0x5ea0('0x16')][_0x5ea0('0x18')]);return _0x5aa3f9(_0x943bd9[_0x5ea0('0x16')][_0x5ea0('0x18')]);}else{logger['info'](_0x5ea0('0x12'),_0x581094,_0x5ea0('0x13'));_0x5aa3f9(_0x943bd9[_0x5ea0('0x19')]['message']);}})[_0x5ea0('0x1a')](function(_0x509aa4){logger[_0x5ea0('0x16')]('FaxAccount,\x20%s,\x20%s',_0x581094,_0x509aa4);_0x1a83d9(_0x509aa4);});});}exports['GetFaxAccount']=function(_0x4fb45b){var _0x12246f=this;return new Promise(function(_0x4206b3,_0x30e25e){return db[_0x5ea0('0x1b')][_0x5ea0('0x1c')]({'raw':_0x4fb45b[_0x5ea0('0x1d')]?_0x4fb45b['options'][_0x5ea0('0x1e')]===undefined?!![]:![]:!![],'where':_0x4fb45b['options']?_0x4fb45b[_0x5ea0('0x1d')]['where']||null:null,'attributes':_0x4fb45b[_0x5ea0('0x1d')]?_0x4fb45b[_0x5ea0('0x1d')][_0x5ea0('0x1f')]||null:null,'limit':_0x4fb45b[_0x5ea0('0x1d')]?_0x4fb45b[_0x5ea0('0x1d')]['limit']||null:null,'include':_0x4fb45b[_0x5ea0('0x1d')]?_0x4fb45b[_0x5ea0('0x1d')][_0x5ea0('0x20')]?_[_0x5ea0('0x21')](_0x4fb45b['options'][_0x5ea0('0x20')],function(_0x49b259){return{'model':db[_0x49b259['model']],'as':_0x49b259['as'],'attributes':_0x49b259[_0x5ea0('0x1f')],'include':_0x49b259[_0x5ea0('0x20')]?_['map'](_0x49b259['include'],function(_0x2ac50c){return{'model':db[_0x2ac50c[_0x5ea0('0x22')]],'as':_0x2ac50c['as'],'attributes':_0x2ac50c[_0x5ea0('0x1f')],'include':_0x2ac50c[_0x5ea0('0x20')]?_[_0x5ea0('0x21')](_0x2ac50c['include'],function(_0x3fa828){return{'model':db[_0x3fa828[_0x5ea0('0x22')]],'as':_0x3fa828['as'],'attributes':_0x3fa828['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f1406){logger['info'](_0x5ea0('0x23'),_0x4fb45b);logger[_0x5ea0('0x14')](_0x5ea0('0x23'),_0x4fb45b,JSON[_0x5ea0('0x24')](_0x4f1406));_0x4206b3(_0x4f1406);})[_0x5ea0('0x1a')](function(_0xa0dd33){logger[_0x5ea0('0x16')]('GetFaxAccount',_0xa0dd33[_0x5ea0('0x18')],_0x4fb45b);_0x30e25e(_0x12246f['error'](0x1f4,_0xa0dd33['message']));});});};exports[_0x5ea0('0x25')]=function(_0x490e50,_0x45d5dd,_0x18ce61){var _0x5d0948=this;return new Promise(function(_0x5c0461,_0x1adccf){var _0x1e8d56={'body':_0x490e50[_0x5ea0('0x26')],'channel':_0x5ea0('0x27')};var _0x42d3f8=[];var _0x595bbf=[];var _0x48f2ca={};return db[_0x5ea0('0x28')][_0x5ea0('0x29')]()['then'](function(_0x556da0){if(!_0x556da0){throw new db[(_0x5ea0('0x2a'))][(_0x5ea0('0x2b'))](_0x5ea0('0x2c'));}_0x42d3f8=_[_0x5ea0('0x2d')](_[_0x5ea0('0x2e')](_0x556da0),[_0x5ea0('0x2f'),_0x5ea0('0x30')]);_0x595bbf=_[_0x5ea0('0x2d')](_[_0x5ea0('0x2e')](_0x556da0),[_0x5ea0('0x2f'),'updatedAt',_0x5ea0('0x31'),_0x5ea0('0x32')]);if(_0x490e50['body']['id']){delete _0x490e50[_0x5ea0('0x26')]['id'];}if(_[_0x5ea0('0x33')](_0x490e50[_0x5ea0('0x26')][_0x5ea0('0x34')])){throw new db[(_0x5ea0('0x2a'))][(_0x5ea0('0x2b'))](_0x5ea0('0x35'));}if(_[_0x5ea0('0x33')](_0x490e50[_0x5ea0('0x26')][_0x5ea0('0x26')])||_0x490e50[_0x5ea0('0x26')][_0x5ea0('0x26')]===''){throw new db['Sequelize']['ValidationError'](_0x5ea0('0x36'));}if(_[_0x5ea0('0x33')](_0x490e50[_0x5ea0('0x26')][_0x5ea0('0x37')])){throw new db['Sequelize']['ValidationError'](_0x5ea0('0x38')+_0x595bbf);}if(!_['includes'](_0x595bbf,_0x490e50[_0x5ea0('0x26')][_0x5ea0('0x37')])){throw new db[(_0x5ea0('0x2a'))][(_0x5ea0('0x2b'))](_0x5ea0('0x39')+_0x595bbf);}_0x48f2ca[_0x490e50['body'][_0x5ea0('0x37')]]=_0x490e50[_0x5ea0('0x26')]['from'];})[_0x5ea0('0x11')](function(){return db[_0x5ea0('0x1b')][_0x5ea0('0x3a')]({'where':{'id':_0x490e50[_0x5ea0('0x3b')]['id']},'include':[{'model':db[_0x5ea0('0x3c')],'as':'List','include':[{'model':db['CmContact'],'as':_0x5ea0('0x3d'),'where':_0x48f2ca,'limit':0x1,'order':[[_0x5ea0('0x30'),_0x5ea0('0x3e')]]}]},{'model':db[_0x5ea0('0x3f')],'as':_0x5ea0('0x40')}]});})[_0x5ea0('0x11')](function(_0x59bc2b){if(_0x59bc2b&&_0x59bc2b['List']){var _0x523206=_0x59bc2b[_0x5ea0('0x41')]({'plain':!![]});_0x1e8d56[_0x5ea0('0x3b')]=_0x523206;_0x1e8d56[_0x5ea0('0x42')]=_0x523206[_0x5ea0('0x40')];_0x1e8d56[_0x5ea0('0x43')]=_0x523206['List'];_0x1e8d56[_0x5ea0('0x42')]=_['orderBy'](_0x1e8d56['applications'],[_0x5ea0('0x44')],[_0x5ea0('0x45')]);if(_0x1e8d56[_0x5ea0('0x3b')][_0x5ea0('0x40')]){delete _0x1e8d56[_0x5ea0('0x3b')][_0x5ea0('0x40')];}if(_0x1e8d56[_0x5ea0('0x3b')]['List']&&_0x1e8d56[_0x5ea0('0x3b')]['List'][_0x5ea0('0x3d')][_0x5ea0('0x46')]){return _0x1e8d56['account']['List'][_0x5ea0('0x3d')][0x0];}var _0x505b73=_[_0x5ea0('0x47')](_0x490e50['body'],{'firstName':_0x490e50['body'][_0x5ea0('0x34')],'ListId':_0x523206[_0x5ea0('0x32')]});_0x505b73[_0x490e50[_0x5ea0('0x26')][_0x5ea0('0x37')]]=_0x490e50['body'][_0x5ea0('0x34')];return db['CmContact'][_0x5ea0('0x48')](_0x505b73,{'fields':_0x42d3f8,'raw':!![]});}})['then'](function(_0x46e231){_0x1e8d56[_0x5ea0('0x49')]=_0x46e231;if(_0x46e231){var _0x2e85d0={'ContactId':_0x46e231['id'],'FaxAccountId':_0x490e50[_0x5ea0('0x3b')]['id'],'fax':_0x46e231[_0x5ea0('0x27')]};return db['FaxInteraction']['find']({'where':{'ContactId':_0x46e231['id'],'closed':![],'FaxAccountId':_0x490e50[_0x5ea0('0x3b')]['id']}})[_0x5ea0('0x11')](function(_0x245631){if(_0x245631){return[_0x245631,![]];}return db[_0x5ea0('0x4a')]['create'](_0x2e85d0)[_0x5ea0('0x11')](function(_0x2f3be7){return[_0x2f3be7,!![]];});});}else{throw new Error(_0x5ea0('0x4b'));}})[_0x5ea0('0x4c')](function(_0x530074,_0x2626af){var _0x5ad03a=_0x530074[_0x5ea0('0x41')]({'plain':!![]});if(_0x2626af){if(_0x1e8d56[_0x5ea0('0x3b')][_0x5ea0('0x4d')]){_0x1e8d56[_0x5ea0('0x42')][_0x5ea0('0x4e')]({'id':0x0,'priority':_0x1e8d56[_0x5ea0('0x42')][_0x5ea0('0x46')]+0x1,'app':_0x5ea0('0x4f'),'appdata':_0x5ea0('0x50'),'interval':_0x5ea0('0x51')});}_0x5ad03a['created']=!![];}else{_0x5ad03a[_0x5ea0('0x52')]=![];}_0x1e8d56['interaction']=_0x5ad03a;return db[_0x5ea0('0x53')][_0x5ea0('0x48')]({'body':_0x490e50[_0x5ea0('0x26')][_0x5ea0('0x26')],'FaxAccountId':_0x490e50[_0x5ea0('0x3b')]['id'],'FaxInteractionId':_0x530074['id'],'direction':'in','ContactId':_0x530074[_0x5ea0('0x54')],'AttachmentId':_0x490e50[_0x5ea0('0x26')]['AttachmentId']});})[_0x5ea0('0x11')](function(_0x16b140){_0x1e8d56['message']=_0x16b140;if(_0x1e8d56[_0x5ea0('0x55')][_0x5ea0('0x56')]){return db['User'][_0x5ea0('0x3a')]({'attributes':['id',_0x5ea0('0x57')],'where':{'id':_0x1e8d56[_0x5ea0('0x55')][_0x5ea0('0x56')]}})['then'](function(_0x6aaa10){if(_0x6aaa10){_0x1e8d56[_0x5ea0('0x42')][_0x5ea0('0x58')]({'id':0x0,'priority':0x0,'app':_0x5ea0('0x59'),'appdata':_0x6aaa10[_0x5ea0('0x57')]+','+(_0x1e8d56[_0x5ea0('0x3b')][_0x5ea0('0x5a')]||0xa),'interval':_0x5ea0('0x51')});}return respondWithRpcPromise(_0x5ea0('0x5b'),_0x5ea0('0x5c'),_0x1e8d56);});}return respondWithRpcPromise(_0x5ea0('0x5b'),_0x5ea0('0x5c'),_0x1e8d56);})['then'](function(_0x2c9751){_0x5c0461(_0x2c9751);})[_0x5ea0('0x1a')](function(_0x4a39d1){_0x1adccf(_0x5d0948[_0x5ea0('0x16')](0x1f4,_0x4a39d1[_0x5ea0('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 5a3faef..7d16c3f 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 _0x46d1=['length','./faxAccount.events','save','update','emit','removeListener','register'];(function(_0x335f50,_0x1f2f1a){var _0x5803b6=function(_0x33a0f5){while(--_0x33a0f5){_0x335f50['push'](_0x335f50['shift']());}};_0x5803b6(++_0x1f2f1a);}(_0x46d1,0xef));var _0x146d=function(_0x552f7e,_0x3a0d88){_0x552f7e=_0x552f7e-0x0;var _0x1b611c=_0x46d1[_0x552f7e];return _0x1b611c;};'use strict';var FaxAccountEvents=require(_0x146d('0x0'));var events=[_0x146d('0x1'),'remove',_0x146d('0x2')];function createListener(_0x1d87be,_0x2bf19c){return function(_0x5a98ed){_0x2bf19c[_0x146d('0x3')](_0x1d87be,_0x5a98ed);};}function removeListener(_0x1a343e,_0x29f6c9){return function(){FaxAccountEvents[_0x146d('0x4')](_0x1a343e,_0x29f6c9);};}exports[_0x146d('0x5')]=function(_0x3260f7){for(var _0x201aae=0x0,_0x3cc8ef=events[_0x146d('0x6')];_0x201aae<_0x3cc8ef;_0x201aae++){var _0x337dbf=events[_0x201aae];var _0x16f299=createListener('faxAccount:'+_0x337dbf,_0x3260f7);FaxAccountEvents['on'](_0x337dbf,_0x16f299);}}; \ No newline at end of file +var _0x5637=['removeListener','register','length','faxAccount:','save','remove','update','emit'];(function(_0x3acf6a,_0x38783b){var _0x5e90bc=function(_0x4bc20){while(--_0x4bc20){_0x3acf6a['push'](_0x3acf6a['shift']());}};_0x5e90bc(++_0x38783b);}(_0x5637,0x19c));var _0x7563=function(_0x34913e,_0x4bac57){_0x34913e=_0x34913e-0x0;var _0x1bf7a0=_0x5637[_0x34913e];return _0x1bf7a0;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x7563('0x0'),_0x7563('0x1'),_0x7563('0x2')];function createListener(_0x40dd66,_0x33413e){return function(_0x216218){_0x33413e[_0x7563('0x3')](_0x40dd66,_0x216218);};}function removeListener(_0x2889c8,_0x29548d){return function(){FaxAccountEvents[_0x7563('0x4')](_0x2889c8,_0x29548d);};}exports[_0x7563('0x5')]=function(_0x3b51fe){for(var _0x465891=0x0,_0x4e235b=events[_0x7563('0x6')];_0x465891<_0x4e235b;_0x465891++){var _0x1539af=events[_0x465891];var _0x391fbe=createListener(_0x7563('0x7')+_0x1539af,_0x3b51fe);FaxAccountEvents['on'](_0x1539af,_0x391fbe);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 9288b93..43dc448 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 _0x419f=['removeAgents','util','path','connect-timeout','express','Router','../../components/interaction/service','./faxAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getInteractions','getApplications','/:id/messages','/:id/users','getAgents','post','addAnswer','addInteraction','/:id/applications','addApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers'];(function(_0x555291,_0x3430c){var _0x25fe76=function(_0x402adf){while(--_0x402adf){_0x555291['push'](_0x555291['shift']());}};_0x25fe76(++_0x3430c);}(_0x419f,0x104));var _0xf419=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x419f[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require('multer');var util=require(_0xf419('0x0'));var path=require(_0xf419('0x1'));var timeout=require(_0xf419('0x2'));var express=require(_0xf419('0x3'));var router=express[_0xf419('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xf419('0x5'));var config=require('../../config/environment');var controller=require(_0xf419('0x6'));router[_0xf419('0x7')]('/',auth['isAuthenticated'](),controller[_0xf419('0x8')]);router['get'](_0xf419('0x9'),auth[_0xf419('0xa')](),controller['describe']);router['get']('/:id',auth[_0xf419('0xa')](),controller['show']);router[_0xf419('0x7')](_0xf419('0xb'),auth[_0xf419('0xa')](),controller[_0xf419('0xc')]);router[_0xf419('0x7')](_0xf419('0xd'),auth['isAuthenticated'](),controller[_0xf419('0xe')]);router[_0xf419('0x7')]('/:id/interactions',auth[_0xf419('0xa')](),controller[_0xf419('0xf')]);router[_0xf419('0x7')]('/:id/applications',auth[_0xf419('0xa')](),controller[_0xf419('0x10')]);router[_0xf419('0x7')](_0xf419('0x11'),auth['isAuthenticated'](),controller['getMessages']);router[_0xf419('0x7')](_0xf419('0x12'),auth['isAuthenticated'](),controller[_0xf419('0x13')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xf419('0x14')](_0xf419('0xb'),auth[_0xf419('0xa')](),controller['addDisposition']);router['post'](_0xf419('0xd'),auth[_0xf419('0xa')](),controller[_0xf419('0x15')]);router['post']('/:id/interactions',auth[_0xf419('0xa')](),controller[_0xf419('0x16')]);router[_0xf419('0x14')](_0xf419('0x17'),auth[_0xf419('0xa')](),controller[_0xf419('0x18')]);router['post']('/addaccountapplications',auth['isAuthenticated'](),controller['addAccountApplications']);router['post'](_0xf419('0x19'),auth[_0xf419('0xa')](),controller[_0xf419('0x1a')]);router[_0xf419('0x14')](_0xf419('0x1b'),auth['isAuthenticated'](),controller[_0xf419('0x1c')]);router[_0xf419('0x14')]('/:id/users',auth[_0xf419('0xa')](),controller[_0xf419('0x1d')]);router['put'](_0xf419('0x1e'),auth[_0xf419('0xa')](),controller[_0xf419('0x1f')]);router[_0xf419('0x20')](_0xf419('0x1e'),auth['isAuthenticated'](),controller[_0xf419('0x21')]);router['delete']('/:id/dispositions',auth[_0xf419('0xa')](),controller[_0xf419('0x22')]);router[_0xf419('0x20')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xf419('0x23')]);router[_0xf419('0x20')](_0xf419('0x12'),auth['isAuthenticated'](),controller[_0xf419('0x24')]);module['exports']=router; \ No newline at end of file +var _0x9885=['/:id/interactions','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','update','delete','removeDispositions','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer'];(function(_0x2a882b,_0x306cfd){var _0x4643b3=function(_0x1f98b9){while(--_0x1f98b9){_0x2a882b['push'](_0x2a882b['shift']());}};_0x4643b3(++_0x306cfd);}(_0x9885,0x7f));var _0x5988=function(_0xa85999,_0x2b18fc){_0xa85999=_0xa85999-0x0;var _0x4ba730=_0x9885[_0xa85999];return _0x4ba730;};'use strict';var multer=require(_0x5988('0x0'));var util=require('util');var path=require(_0x5988('0x1'));var timeout=require(_0x5988('0x2'));var express=require(_0x5988('0x3'));var router=express['Router']();var auth=require(_0x5988('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5988('0x5'));var controller=require(_0x5988('0x6'));router[_0x5988('0x7')]('/',auth[_0x5988('0x8')](),controller['index']);router['get']('/describe',auth[_0x5988('0x8')](),controller[_0x5988('0x9')]);router[_0x5988('0x7')](_0x5988('0xa'),auth[_0x5988('0x8')](),controller[_0x5988('0xb')]);router[_0x5988('0x7')](_0x5988('0xc'),auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0x5988('0xd'),auth[_0x5988('0x8')](),controller[_0x5988('0xe')]);router['get']('/:id/interactions',auth['isAuthenticated'](),controller[_0x5988('0xf')]);router['get'](_0x5988('0x10'),auth['isAuthenticated'](),controller['getApplications']);router[_0x5988('0x7')](_0x5988('0x11'),auth[_0x5988('0x8')](),controller[_0x5988('0x12')]);router['get'](_0x5988('0x13'),auth[_0x5988('0x8')](),controller[_0x5988('0x14')]);router[_0x5988('0x15')]('/',auth[_0x5988('0x8')](),controller[_0x5988('0x16')]);router[_0x5988('0x15')](_0x5988('0xc'),auth[_0x5988('0x8')](),controller[_0x5988('0x17')]);router[_0x5988('0x15')](_0x5988('0xd'),auth[_0x5988('0x8')](),controller[_0x5988('0x18')]);router['post'](_0x5988('0x19'),auth[_0x5988('0x8')](),controller['addInteraction']);router[_0x5988('0x15')]('/:id/applications',auth[_0x5988('0x8')](),controller[_0x5988('0x1a')]);router[_0x5988('0x15')](_0x5988('0x1b'),auth[_0x5988('0x8')](),controller[_0x5988('0x1c')]);router[_0x5988('0x15')](_0x5988('0x1d'),auth[_0x5988('0x8')](),controller[_0x5988('0x1e')]);router[_0x5988('0x15')](_0x5988('0x1f'),auth[_0x5988('0x8')](),controller[_0x5988('0x20')]);router[_0x5988('0x15')]('/:id/users',auth[_0x5988('0x8')](),controller[_0x5988('0x21')]);router['put'](_0x5988('0xa'),auth[_0x5988('0x8')](),controller[_0x5988('0x22')]);router[_0x5988('0x23')]('/:id',auth[_0x5988('0x8')](),controller['destroy']);router[_0x5988('0x23')](_0x5988('0xc'),auth['isAuthenticated'](),controller[_0x5988('0x24')]);router[_0x5988('0x23')](_0x5988('0xd'),auth[_0x5988('0x8')](),controller['removeAnswers']);router[_0x5988('0x23')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x5988('0x25')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 2bf8daf..09f0d9b 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 _0x4c80=['INTEGER','noop','*,*,*,*','sequelize','exports'];(function(_0xec1a95,_0x1b4887){var _0x1438ea=function(_0x3bec5d){while(--_0x3bec5d){_0xec1a95['push'](_0xec1a95['shift']());}};_0x1438ea(++_0x1b4887);}(_0x4c80,0x17a));var _0x04c8=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x4c80[_0x474bc0];return _0x4b24cf;};'use strict';var Sequelize=require(_0x04c8('0x0'));module[_0x04c8('0x1')]={'priority':{'type':Sequelize[_0x04c8('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x04c8('0x3')},'appdata':{'type':Sequelize['STRING'](0x1000),'defaultValue':''},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x04c8('0x4')}}; \ No newline at end of file +var _0x362f=['STRING','noop','sequelize','exports','INTEGER'];(function(_0x1f4e28,_0x3b3ec0){var _0x527192=function(_0x56bab0){while(--_0x56bab0){_0x1f4e28['push'](_0x1f4e28['shift']());}};_0x527192(++_0x3b3ec0);}(_0x362f,0x179));var _0xf362=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x362f[_0x134c2e];return _0x2825db;};'use strict';var Sequelize=require(_0xf362('0x0'));module[_0xf362('0x1')]={'priority':{'type':Sequelize[_0xf362('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf362('0x3')],'allowNull':![],'defaultValue':_0xf362('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0xf362('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 980f4bb..ac76dc7 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 _0x93f4=['keys','dateStart','query','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','order','pick','add','day','merge','where','filter','map','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','destroy','then','error','stack','name','index','FaxApplication','model'];(function(_0x4435c2,_0x3c12f2){var _0x160402=function(_0x45e34b){while(--_0x45e34b){_0x4435c2['push'](_0x4435c2['shift']());}};_0x160402(++_0x3c12f2);}(_0x93f4,0x1b5));var _0x493f=function(_0x23c252,_0x2d0b0b){_0x23c252=_0x23c252-0x0;var _0x307210=_0x93f4[_0x23c252];return _0x307210;};'use strict';var pdf=require(_0x493f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x493f('0x1'));var zipdir=require(_0x493f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x493f('0x3'));var moment=require(_0x493f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x493f('0x5'));var util=require(_0x493f('0x6'));var path=require(_0x493f('0x7'));var sox=require('sox');var csv=require(_0x493f('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x493f('0x9'));var squel=require(_0x493f('0xa'));var crypto=require(_0x493f('0xb'));var jsforce=require(_0x493f('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x493f('0xd'));var Papa=require(_0x493f('0xe'));var Redis=require(_0x493f('0xf'));var qs=require('../../components/parsers/qs');var logger=require(_0x493f('0x10'))(_0x493f('0x11'));var utils=require(_0x493f('0x12'));var config=require(_0x493f('0x13'));var db=require(_0x493f('0x14'))['db'];function respondWithStatusCode(_0x203b09,_0x38b3a2){_0x38b3a2=_0x38b3a2||0xcc;return function(_0x58eeb6){if(_0x58eeb6){return _0x203b09[_0x493f('0x15')](_0x38b3a2);}return _0x203b09[_0x493f('0x16')](_0x38b3a2)[_0x493f('0x17')]();};}function respondWithResult(_0x423451,_0x58a361){_0x58a361=_0x58a361||0xc8;return function(_0x4d016a){if(_0x4d016a){return _0x423451['status'](_0x58a361)[_0x493f('0x18')](_0x4d016a);}};}function respondWithFilteredResult(_0x49ab86,_0x2af9d9){return function(_0x184ab5){if(_0x184ab5){var _0x49f3bb=_0x184ab5[_0x493f('0x19')],_0x1af56f=_0x2af9d9[_0x493f('0x1a')],_0x53601f=_0x2af9d9[_0x493f('0x1a')]+_0x2af9d9[_0x493f('0x1b')],_0x497923;if(_0x53601f>=_0x49f3bb){_0x53601f=_0x49f3bb;_0x497923=0xc8;}else{_0x497923=0xce;}_0x49ab86[_0x493f('0x16')](_0x497923);return _0x49ab86['set'](_0x493f('0x1c'),_0x1af56f+'-'+_0x53601f+'/'+_0x49f3bb)[_0x493f('0x18')](_0x184ab5);}return null;};}function patchUpdates(_0x3f2e87){return function(_0x5ac46f){try{jsonpatch['apply'](_0x5ac46f,_0x3f2e87,!![]);}catch(_0x5817f1){return BPromise[_0x493f('0x1d')](_0x5817f1);}return _0x5ac46f[_0x493f('0x1e')]();};}function saveUpdates(_0x13fd5d,_0x4d10e8){return function(_0x34a4f1){if(_0x34a4f1){return _0x34a4f1['update'](_0x13fd5d)['then'](function(_0x25609a){return _0x25609a;});}return null;};}function removeEntity(_0x39f882,_0x586e67){return function(_0x285881){if(_0x285881){return _0x285881[_0x493f('0x1f')]()[_0x493f('0x20')](function(){_0x39f882[_0x493f('0x16')](0xcc)[_0x493f('0x17')]();});}};}function handleEntityNotFound(_0x4b6c93,_0x4f70c4){return function(_0x566a9e){if(!_0x566a9e){_0x4b6c93[_0x493f('0x15')](0x194);}return _0x566a9e;};}function handleError(_0x35e72c,_0x198c1c){_0x198c1c=_0x198c1c||0x1f4;return function(_0x47a942){logger[_0x493f('0x21')](_0x47a942[_0x493f('0x22')]);if(_0x47a942[_0x493f('0x23')]){delete _0x47a942[_0x493f('0x23')];}_0x35e72c['status'](_0x198c1c)['send'](_0x47a942);};}exports[_0x493f('0x24')]=function(_0x24ba00,_0x455105){var _0x4036be={},_0x4d09a3={},_0x49c3ce={'count':0x0,'rows':[]};var _0x41fe4a=db[_0x493f('0x25')]['rawAttributes'];_0x4d09a3[_0x493f('0x26')]=_[_0x493f('0x27')](_0x41fe4a);var _0x37f825={'dateStart':_0x24ba00['query'][_0x493f('0x28')],'dateEnd':_0x24ba00['query']['dateEnd']};delete _0x24ba00[_0x493f('0x29')][_0x493f('0x28')];delete _0x24ba00[_0x493f('0x29')][_0x493f('0x2a')];_0x4d09a3[_0x493f('0x29')]=_[_0x493f('0x27')](_0x24ba00['query']);_0x4d09a3[_0x493f('0x2b')]=_[_0x493f('0x2c')](_0x4d09a3[_0x493f('0x26')],_0x4d09a3[_0x493f('0x29')]);_0x4036be[_0x493f('0x2d')]=_[_0x493f('0x2c')](_0x4d09a3[_0x493f('0x26')],qs[_0x493f('0x2e')](_0x24ba00[_0x493f('0x29')][_0x493f('0x2e')]));_0x4036be[_0x493f('0x2d')]=_0x4036be[_0x493f('0x2d')]['length']?_0x4036be['attributes']:_0x4d09a3['model'];if(!_0x24ba00[_0x493f('0x29')][_0x493f('0x2f')]('nolimit')){_0x4036be[_0x493f('0x1b')]=qs[_0x493f('0x1b')](_0x24ba00[_0x493f('0x29')]['limit']);_0x4036be[_0x493f('0x1a')]=qs[_0x493f('0x1a')](_0x24ba00[_0x493f('0x29')][_0x493f('0x1a')]);}_0x4036be[_0x493f('0x30')]=qs['sort'](_0x24ba00['query']['sort']);_0x4036be['where']=qs['filters'](_[_0x493f('0x31')](_0x24ba00['query'],_0x4d09a3[_0x493f('0x2b')]));if(_0x37f825[_0x493f('0x28')]){if(_0x37f825[_0x493f('0x2a')]){_0x37f825[_0x493f('0x2a')]=moment(_0x37f825[_0x493f('0x2a')])[_0x493f('0x32')](0x1,'day');}else{_0x37f825[_0x493f('0x2a')]=moment(_0x37f825[_0x493f('0x28')])[_0x493f('0x32')](0x1,_0x493f('0x33'));}_[_0x493f('0x34')](_0x4036be[_0x493f('0x35')],{'createdAt':{'$gte':_0x37f825[_0x493f('0x28')],'$lte':_0x37f825[_0x493f('0x2a')]}});}if(_0x24ba00[_0x493f('0x29')][_0x493f('0x36')]){_0x4036be['where']=_[_0x493f('0x34')](_0x4036be[_0x493f('0x35')],{'$or':_[_0x493f('0x37')](_0x4036be[_0x493f('0x2d')],function(_0x1c42df){var _0x57928b={};_0x57928b[_0x1c42df]={'$like':'%'+_0x24ba00[_0x493f('0x29')][_0x493f('0x36')]+'%'};return _0x57928b;})});}_0x4036be=_[_0x493f('0x34')]({},_0x4036be,_0x24ba00['options']);var _0x5c0307={'where':_0x4036be[_0x493f('0x35')]};return db[_0x493f('0x25')][_0x493f('0x19')](_0x5c0307)['then'](function(_0x522c10){_0x49c3ce[_0x493f('0x19')]=_0x522c10;if(_0x24ba00[_0x493f('0x29')][_0x493f('0x38')]){_0x4036be[_0x493f('0x39')]=[{'all':!![]}];}return db[_0x493f('0x25')][_0x493f('0x3a')](_0x4036be);})[_0x493f('0x20')](function(_0x4c0f3b){_0x49c3ce[_0x493f('0x3b')]=_0x4c0f3b;return _0x49c3ce;})['then'](respondWithFilteredResult(_0x455105,_0x4036be))[_0x493f('0x3c')](handleError(_0x455105,null));};exports[_0x493f('0x3d')]=function(_0x1531ea,_0x3cc1a0){var _0x542632={'raw':!![],'where':{'id':_0x1531ea[_0x493f('0x3e')]['id']}},_0x2d86a6={};_0x2d86a6[_0x493f('0x26')]=_['keys'](db[_0x493f('0x25')]['rawAttributes']);_0x2d86a6[_0x493f('0x29')]=_[_0x493f('0x27')](_0x1531ea[_0x493f('0x29')]);_0x2d86a6[_0x493f('0x2b')]=_[_0x493f('0x2c')](_0x2d86a6[_0x493f('0x26')],_0x2d86a6[_0x493f('0x29')]);_0x542632[_0x493f('0x2d')]=_[_0x493f('0x2c')](_0x2d86a6[_0x493f('0x26')],qs[_0x493f('0x2e')](_0x1531ea[_0x493f('0x29')][_0x493f('0x2e')]));_0x542632['attributes']=_0x542632[_0x493f('0x2d')]['length']?_0x542632[_0x493f('0x2d')]:_0x2d86a6[_0x493f('0x26')];if(_0x1531ea[_0x493f('0x29')]['includeAll']){_0x542632[_0x493f('0x39')]=[{'all':!![]}];}_0x542632=_['merge']({},_0x542632,_0x1531ea[_0x493f('0x3f')]);return db[_0x493f('0x25')][_0x493f('0x40')](_0x542632)[_0x493f('0x20')](handleEntityNotFound(_0x3cc1a0,null))['then'](respondWithResult(_0x3cc1a0,null))[_0x493f('0x3c')](handleError(_0x3cc1a0,null));};exports[_0x493f('0x41')]=function(_0x1fa6fc,_0xb858f){return db[_0x493f('0x25')]['create'](_0x1fa6fc[_0x493f('0x42')],{})[_0x493f('0x20')](respondWithResult(_0xb858f,0xc9))['catch'](handleError(_0xb858f,null));};exports[_0x493f('0x43')]=function(_0x1eeeaa,_0x1c770a){if(_0x1eeeaa[_0x493f('0x42')]['id']){delete _0x1eeeaa['body']['id'];}return db[_0x493f('0x25')][_0x493f('0x40')]({'where':{'id':_0x1eeeaa['params']['id']}})[_0x493f('0x20')](handleEntityNotFound(_0x1c770a,null))[_0x493f('0x20')](saveUpdates(_0x1eeeaa[_0x493f('0x42')],null))[_0x493f('0x20')](respondWithResult(_0x1c770a,null))[_0x493f('0x3c')](handleError(_0x1c770a,null));};exports[_0x493f('0x1f')]=function(_0x476fef,_0xebdee1){return db[_0x493f('0x25')][_0x493f('0x40')]({'where':{'id':_0x476fef[_0x493f('0x3e')]['id']}})[_0x493f('0x20')](handleEntityNotFound(_0xebdee1,null))[_0x493f('0x20')](removeEntity(_0xebdee1,null))[_0x493f('0x3c')](handleError(_0xebdee1,null));}; \ No newline at end of file +var _0x3841=['map','options','includeAll','include','findAll','catch','show','find','create','body','params','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','set','json','apply','save','then','destroy','error','stack','name','send','index','FaxApplication','rawAttributes','query','dateStart','dateEnd','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','add','day','merge','filter'];(function(_0x5698b6,_0x8831dd){var _0x561ce8=function(_0x342285){while(--_0x342285){_0x5698b6['push'](_0x5698b6['shift']());}};_0x561ce8(++_0x8831dd);}(_0x3841,0x123));var _0x1384=function(_0x5e31e2,_0x273090){_0x5e31e2=_0x5e31e2-0x0;var _0x294e2c=_0x3841[_0x5e31e2];return _0x294e2c;};'use strict';var pdf=require(_0x1384('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1384('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1384('0x2'));var moment=require(_0x1384('0x3'));var BPromise=require(_0x1384('0x4'));var Mustache=require(_0x1384('0x5'));var util=require(_0x1384('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x1384('0x7'));var ejs=require(_0x1384('0x8'));var fs=require('fs');var _=require(_0x1384('0x9'));var squel=require(_0x1384('0xa'));var crypto=require(_0x1384('0xb'));var jsforce=require(_0x1384('0xc'));var deskjs=require(_0x1384('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1384('0xe'));var Papa=require(_0x1384('0xf'));var Redis=require(_0x1384('0x10'));var qs=require(_0x1384('0x11'));var logger=require(_0x1384('0x12'))('api');var utils=require(_0x1384('0x13'));var config=require('../../config/environment');var db=require(_0x1384('0x14'))['db'];function respondWithStatusCode(_0x228502,_0x430f2c){_0x430f2c=_0x430f2c||0xcc;return function(_0x3f7edb){if(_0x3f7edb){return _0x228502[_0x1384('0x15')](_0x430f2c);}return _0x228502[_0x1384('0x16')](_0x430f2c)[_0x1384('0x17')]();};}function respondWithResult(_0x29cc5b,_0x3e6008){_0x3e6008=_0x3e6008||0xc8;return function(_0x1370a0){if(_0x1370a0){return _0x29cc5b[_0x1384('0x16')](_0x3e6008)['json'](_0x1370a0);}};}function respondWithFilteredResult(_0x3ad2d2,_0x413533){return function(_0x2eb39c){if(_0x2eb39c){var _0x56b85a=_0x2eb39c[_0x1384('0x18')],_0x8af794=_0x413533[_0x1384('0x19')],_0x171fac=_0x413533['offset']+_0x413533['limit'],_0x4dac55;if(_0x171fac>=_0x56b85a){_0x171fac=_0x56b85a;_0x4dac55=0xc8;}else{_0x4dac55=0xce;}_0x3ad2d2[_0x1384('0x16')](_0x4dac55);return _0x3ad2d2[_0x1384('0x1a')]('Content-Range',_0x8af794+'-'+_0x171fac+'/'+_0x56b85a)[_0x1384('0x1b')](_0x2eb39c);}return null;};}function patchUpdates(_0x1aabf8){return function(_0x3c6d56){try{jsonpatch[_0x1384('0x1c')](_0x3c6d56,_0x1aabf8,!![]);}catch(_0x11d8f0){return BPromise['reject'](_0x11d8f0);}return _0x3c6d56[_0x1384('0x1d')]();};}function saveUpdates(_0x361ec,_0x20cb48){return function(_0x2c5839){if(_0x2c5839){return _0x2c5839['update'](_0x361ec)[_0x1384('0x1e')](function(_0x519911){return _0x519911;});}return null;};}function removeEntity(_0x911afb,_0x356e39){return function(_0x482fc4){if(_0x482fc4){return _0x482fc4[_0x1384('0x1f')]()[_0x1384('0x1e')](function(){_0x911afb[_0x1384('0x16')](0xcc)[_0x1384('0x17')]();});}};}function handleEntityNotFound(_0x3637ab,_0x461d2e){return function(_0x521a09){if(!_0x521a09){_0x3637ab[_0x1384('0x15')](0x194);}return _0x521a09;};}function handleError(_0x1c4906,_0x2d158e){_0x2d158e=_0x2d158e||0x1f4;return function(_0x3819fe){logger[_0x1384('0x20')](_0x3819fe[_0x1384('0x21')]);if(_0x3819fe[_0x1384('0x22')]){delete _0x3819fe[_0x1384('0x22')];}_0x1c4906[_0x1384('0x16')](_0x2d158e)[_0x1384('0x23')](_0x3819fe);};}exports[_0x1384('0x24')]=function(_0x188fab,_0x3a603f){var _0x23cc15={},_0x22b996={},_0x278b88={'count':0x0,'rows':[]};var _0x15d114=db[_0x1384('0x25')][_0x1384('0x26')];_0x22b996['model']=_['keys'](_0x15d114);var _0x2e6aa5={'dateStart':_0x188fab[_0x1384('0x27')][_0x1384('0x28')],'dateEnd':_0x188fab[_0x1384('0x27')][_0x1384('0x29')]};delete _0x188fab[_0x1384('0x27')][_0x1384('0x28')];delete _0x188fab['query']['dateEnd'];_0x22b996[_0x1384('0x27')]=_[_0x1384('0x2a')](_0x188fab[_0x1384('0x27')]);_0x22b996[_0x1384('0x2b')]=_[_0x1384('0x2c')](_0x22b996[_0x1384('0x2d')],_0x22b996[_0x1384('0x27')]);_0x23cc15[_0x1384('0x2e')]=_[_0x1384('0x2c')](_0x22b996[_0x1384('0x2d')],qs[_0x1384('0x2f')](_0x188fab['query'][_0x1384('0x2f')]));_0x23cc15[_0x1384('0x2e')]=_0x23cc15[_0x1384('0x2e')][_0x1384('0x30')]?_0x23cc15[_0x1384('0x2e')]:_0x22b996[_0x1384('0x2d')];if(!_0x188fab[_0x1384('0x27')][_0x1384('0x31')](_0x1384('0x32'))){_0x23cc15['limit']=qs['limit'](_0x188fab['query'][_0x1384('0x33')]);_0x23cc15[_0x1384('0x19')]=qs[_0x1384('0x19')](_0x188fab[_0x1384('0x27')]['offset']);}_0x23cc15['order']=qs[_0x1384('0x34')](_0x188fab[_0x1384('0x27')][_0x1384('0x34')]);_0x23cc15[_0x1384('0x35')]=qs[_0x1384('0x2b')](_[_0x1384('0x36')](_0x188fab[_0x1384('0x27')],_0x22b996[_0x1384('0x2b')]));if(_0x2e6aa5[_0x1384('0x28')]){if(_0x2e6aa5[_0x1384('0x29')]){_0x2e6aa5[_0x1384('0x29')]=moment(_0x2e6aa5['dateEnd'])[_0x1384('0x37')](0x1,_0x1384('0x38'));}else{_0x2e6aa5[_0x1384('0x29')]=moment(_0x2e6aa5[_0x1384('0x28')])[_0x1384('0x37')](0x1,'day');}_[_0x1384('0x39')](_0x23cc15[_0x1384('0x35')],{'createdAt':{'$gte':_0x2e6aa5[_0x1384('0x28')],'$lte':_0x2e6aa5[_0x1384('0x29')]}});}if(_0x188fab[_0x1384('0x27')][_0x1384('0x3a')]){_0x23cc15[_0x1384('0x35')]=_[_0x1384('0x39')](_0x23cc15['where'],{'$or':_[_0x1384('0x3b')](_0x23cc15[_0x1384('0x2e')],function(_0xc6d8ac){var _0x32cf5b={};_0x32cf5b[_0xc6d8ac]={'$like':'%'+_0x188fab[_0x1384('0x27')][_0x1384('0x3a')]+'%'};return _0x32cf5b;})});}_0x23cc15=_[_0x1384('0x39')]({},_0x23cc15,_0x188fab[_0x1384('0x3c')]);var _0x24fdee={'where':_0x23cc15[_0x1384('0x35')]};return db[_0x1384('0x25')][_0x1384('0x18')](_0x24fdee)[_0x1384('0x1e')](function(_0x2356fc){_0x278b88[_0x1384('0x18')]=_0x2356fc;if(_0x188fab[_0x1384('0x27')][_0x1384('0x3d')]){_0x23cc15[_0x1384('0x3e')]=[{'all':!![]}];}return db['FaxApplication'][_0x1384('0x3f')](_0x23cc15);})[_0x1384('0x1e')](function(_0x4d0550){_0x278b88['rows']=_0x4d0550;return _0x278b88;})['then'](respondWithFilteredResult(_0x3a603f,_0x23cc15))[_0x1384('0x40')](handleError(_0x3a603f,null));};exports[_0x1384('0x41')]=function(_0x563edd,_0x441461){var _0x44b903={'raw':!![],'where':{'id':_0x563edd['params']['id']}},_0x3d89e2={};_0x3d89e2[_0x1384('0x2d')]=_[_0x1384('0x2a')](db[_0x1384('0x25')][_0x1384('0x26')]);_0x3d89e2[_0x1384('0x27')]=_[_0x1384('0x2a')](_0x563edd[_0x1384('0x27')]);_0x3d89e2[_0x1384('0x2b')]=_[_0x1384('0x2c')](_0x3d89e2['model'],_0x3d89e2[_0x1384('0x27')]);_0x44b903[_0x1384('0x2e')]=_[_0x1384('0x2c')](_0x3d89e2['model'],qs[_0x1384('0x2f')](_0x563edd[_0x1384('0x27')][_0x1384('0x2f')]));_0x44b903['attributes']=_0x44b903['attributes']['length']?_0x44b903[_0x1384('0x2e')]:_0x3d89e2[_0x1384('0x2d')];if(_0x563edd['query'][_0x1384('0x3d')]){_0x44b903[_0x1384('0x3e')]=[{'all':!![]}];}_0x44b903=_[_0x1384('0x39')]({},_0x44b903,_0x563edd['options']);return db[_0x1384('0x25')][_0x1384('0x42')](_0x44b903)[_0x1384('0x1e')](handleEntityNotFound(_0x441461,null))['then'](respondWithResult(_0x441461,null))[_0x1384('0x40')](handleError(_0x441461,null));};exports[_0x1384('0x43')]=function(_0x10930f,_0x426dfe){return db[_0x1384('0x25')][_0x1384('0x43')](_0x10930f[_0x1384('0x44')],{})['then'](respondWithResult(_0x426dfe,0xc9))['catch'](handleError(_0x426dfe,null));};exports['update']=function(_0x4420fe,_0x4b51a1){if(_0x4420fe[_0x1384('0x44')]['id']){delete _0x4420fe['body']['id'];}return db[_0x1384('0x25')][_0x1384('0x42')]({'where':{'id':_0x4420fe['params']['id']}})['then'](handleEntityNotFound(_0x4b51a1,null))['then'](saveUpdates(_0x4420fe[_0x1384('0x44')],null))['then'](respondWithResult(_0x4b51a1,null))[_0x1384('0x40')](handleError(_0x4b51a1,null));};exports[_0x1384('0x1f')]=function(_0x46fb6c,_0x3e426e){return db[_0x1384('0x25')][_0x1384('0x42')]({'where':{'id':_0x46fb6c[_0x1384('0x45')]['id']}})['then'](handleEntityNotFound(_0x3e426e,null))['then'](removeEntity(_0x3e426e,null))[_0x1384('0x40')](handleError(_0x3e426e,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index e30ed1c..4081468 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 _0x653c=['lodash','api','bluebird','request-promise','./faxApplication.attributes','exports','define','FaxApplication','fax_applications'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x653c,0xc6));var _0xc653=function(_0x2953a2,_0x32124b){_0x2953a2=_0x2953a2-0x0;var _0x97519a=_0x653c[_0x2953a2];return _0x97519a;};'use strict';var _=require(_0xc653('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc653('0x1'));var moment=require('moment');var BPromise=require(_0xc653('0x2'));var rp=require(_0xc653('0x3'));var attributes=require(_0xc653('0x4'));module[_0xc653('0x5')]=function(_0x5d511e,_0x5da243){return _0x5d511e[_0xc653('0x6')](_0xc653('0x7'),attributes,{'tableName':_0xc653('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x21c6=['../../config/logger','api','moment','bluebird','request-promise','./faxApplication.attributes','exports','define','fax_applications','util'];(function(_0x4c8890,_0x34c779){var _0x2e7ed5=function(_0x6ba2c6){while(--_0x6ba2c6){_0x4c8890['push'](_0x4c8890['shift']());}};_0x2e7ed5(++_0x34c779);}(_0x21c6,0x1cb));var _0x621c=function(_0x2b1b07,_0x4f8e0a){_0x2b1b07=_0x2b1b07-0x0;var _0x39a149=_0x21c6[_0x2b1b07];return _0x39a149;};'use strict';var _=require('lodash');var util=require(_0x621c('0x0'));var logger=require(_0x621c('0x1'))(_0x621c('0x2'));var moment=require(_0x621c('0x3'));var BPromise=require(_0x621c('0x4'));var rp=require(_0x621c('0x5'));var attributes=require(_0x621c('0x6'));module[_0x621c('0x7')]=function(_0x56dc1b,_0x58bdbb){return _0x56dc1b[_0x621c('0x8')]('FaxApplication',attributes,{'tableName':_0x621c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 8395801..f34aa09 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 _0xcefd=['limit','util','moment','randomstring','../../mysqldb','jayson/promise','client','request','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','body','options','raw','attributes'];(function(_0x1a1ee5,_0x5c2452){var _0x38a63d=function(_0x23c017){while(--_0x23c017){_0x1a1ee5['push'](_0x1a1ee5['shift']());}};_0x38a63d(++_0x5c2452);}(_0xcefd,0x145));var _0xdcef=function(_0x51f5c8,_0x2aa90d){_0x51f5c8=_0x51f5c8-0x0;var _0x30789e=_0xcefd[_0x51f5c8];return _0x30789e;};'use strict';var _=require('lodash');var util=require(_0xdcef('0x0'));var moment=require(_0xdcef('0x1'));var BPromise=require('bluebird');var rs=require(_0xdcef('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdcef('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xdcef('0x4'));var client=jayson[_0xdcef('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b1885,_0x404549,_0x411ffa){return new BPromise(function(_0x4beee5,_0x4e9791){return client[_0xdcef('0x6')](_0x3b1885,_0x411ffa)[_0xdcef('0x7')](function(_0x2826f7){logger[_0xdcef('0x8')](_0xdcef('0x9'),_0x404549,_0xdcef('0xa'));logger[_0xdcef('0xb')](_0xdcef('0xc'),_0x404549,_0xdcef('0xa'),JSON[_0xdcef('0xd')](_0x2826f7));if(_0x2826f7[_0xdcef('0xe')]){if(_0x2826f7[_0xdcef('0xe')][_0xdcef('0xf')]===0x1f4){logger[_0xdcef('0xe')](_0xdcef('0x9'),_0x404549,_0x2826f7['error'][_0xdcef('0x10')]);return _0x4e9791(_0x2826f7[_0xdcef('0xe')][_0xdcef('0x10')]);}logger[_0xdcef('0xe')](_0xdcef('0x9'),_0x404549,_0x2826f7[_0xdcef('0xe')]['message']);return _0x4beee5(_0x2826f7[_0xdcef('0xe')]['message']);}else{logger[_0xdcef('0x8')](_0xdcef('0x9'),_0x404549,_0xdcef('0xa'));_0x4beee5(_0x2826f7[_0xdcef('0x11')]['message']);}})[_0xdcef('0x12')](function(_0x31ff20){logger[_0xdcef('0xe')](_0xdcef('0x9'),_0x404549,_0x31ff20);_0x4e9791(_0x31ff20);});});}exports[_0xdcef('0x13')]=function(_0x482d3f){var _0x25b975=this;return new Promise(function(_0x2c7807,_0x418a7c){return db[_0xdcef('0x14')][_0xdcef('0x15')](_0x482d3f[_0xdcef('0x16')],{'raw':_0x482d3f[_0xdcef('0x17')]?_0x482d3f[_0xdcef('0x17')][_0xdcef('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x482d3f[_0xdcef('0x17')]?_0x482d3f[_0xdcef('0x17')]['where']||null:null,'attributes':_0x482d3f['options']?_0x482d3f[_0xdcef('0x17')][_0xdcef('0x19')]||null:null,'limit':_0x482d3f['options']?_0x482d3f[_0xdcef('0x17')][_0xdcef('0x1a')]||null:null})[_0xdcef('0x7')](function(_0x21d3bb){logger['info'](_0xdcef('0x13'),_0x482d3f);logger[_0xdcef('0xb')](_0xdcef('0x13'),_0x482d3f,JSON['stringify'](_0x21d3bb));_0x2c7807(_0x21d3bb);})[_0xdcef('0x12')](function(_0x41dff9){logger[_0xdcef('0xe')](_0xdcef('0x13'),_0x41dff9[_0xdcef('0x10')],_0x482d3f);_0x418a7c(_0x25b975[_0xdcef('0xe')](0x1f4,_0x41dff9[_0xdcef('0x10')]));});});}; \ No newline at end of file +var _0xc2e7=['info','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','FaxApplication','update','options','raw','where','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','then'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xc2e7,0x1c1));var _0x7c2e=function(_0x4a7a06,_0xba4bc6){_0x4a7a06=_0x4a7a06-0x0;var _0x3529db=_0xc2e7[_0x4a7a06];return _0x3529db;};'use strict';var _=require(_0x7c2e('0x0'));var util=require(_0x7c2e('0x1'));var moment=require('moment');var BPromise=require(_0x7c2e('0x2'));var rs=require(_0x7c2e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c2e('0x4'))['db'];var utils=require(_0x7c2e('0x5'));var logger=require('../../config/logger')(_0x7c2e('0x6'));var config=require(_0x7c2e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7c2e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40ff8e,_0x5ba740,_0x1cad45){return new BPromise(function(_0x5dc142,_0x15ffb4){return client['request'](_0x40ff8e,_0x1cad45)[_0x7c2e('0x9')](function(_0x440e26){logger[_0x7c2e('0xa')]('FaxApplication,\x20%s,\x20%s',_0x5ba740,'request\x20sent');logger[_0x7c2e('0xb')](_0x7c2e('0xc'),_0x5ba740,_0x7c2e('0xd'),JSON['stringify'](_0x440e26));if(_0x440e26[_0x7c2e('0xe')]){if(_0x440e26[_0x7c2e('0xe')][_0x7c2e('0xf')]===0x1f4){logger[_0x7c2e('0xe')](_0x7c2e('0x10'),_0x5ba740,_0x440e26[_0x7c2e('0xe')][_0x7c2e('0x11')]);return _0x15ffb4(_0x440e26['error'][_0x7c2e('0x11')]);}logger[_0x7c2e('0xe')]('FaxApplication,\x20%s,\x20%s',_0x5ba740,_0x440e26[_0x7c2e('0xe')][_0x7c2e('0x11')]);return _0x5dc142(_0x440e26[_0x7c2e('0xe')][_0x7c2e('0x11')]);}else{logger[_0x7c2e('0xa')](_0x7c2e('0x10'),_0x5ba740,_0x7c2e('0xd'));_0x5dc142(_0x440e26[_0x7c2e('0x12')][_0x7c2e('0x11')]);}})[_0x7c2e('0x13')](function(_0x2688b7){logger['error'](_0x7c2e('0x10'),_0x5ba740,_0x2688b7);_0x15ffb4(_0x2688b7);});});}exports[_0x7c2e('0x14')]=function(_0x1a374c){var _0x5cc37d=this;return new Promise(function(_0x309c85,_0x488971){return db[_0x7c2e('0x15')][_0x7c2e('0x16')](_0x1a374c['body'],{'raw':_0x1a374c['options']?_0x1a374c[_0x7c2e('0x17')][_0x7c2e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a374c['options']?_0x1a374c[_0x7c2e('0x17')][_0x7c2e('0x19')]||null:null,'attributes':_0x1a374c[_0x7c2e('0x17')]?_0x1a374c[_0x7c2e('0x17')]['attributes']||null:null,'limit':_0x1a374c[_0x7c2e('0x17')]?_0x1a374c[_0x7c2e('0x17')][_0x7c2e('0x1a')]||null:null})[_0x7c2e('0x9')](function(_0x45278e){logger[_0x7c2e('0xa')](_0x7c2e('0x14'),_0x1a374c);logger['debug'](_0x7c2e('0x14'),_0x1a374c,JSON['stringify'](_0x45278e));_0x309c85(_0x45278e);})[_0x7c2e('0x13')](function(_0x92593a){logger[_0x7c2e('0xe')](_0x7c2e('0x14'),_0x92593a[_0x7c2e('0x11')],_0x1a374c);_0x488971(_0x5cc37d[_0x7c2e('0xe')](0x1f4,_0x92593a[_0x7c2e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 1290cbe..9b19c36 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 _0xea11=['get','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','Router','./faxApplication.controller'];(function(_0x4031e5,_0x5d9cd0){var _0x25b248=function(_0x3f0d9a){while(--_0x3f0d9a){_0x4031e5['push'](_0x4031e5['shift']());}};_0x25b248(++_0x5d9cd0);}(_0xea11,0x9b));var _0x1ea1=function(_0x30d394,_0x185e4){_0x30d394=_0x30d394-0x0;var _0x37fe52=_0xea11[_0x30d394];return _0x37fe52;};'use strict';var multer=require(_0x1ea1('0x0'));var util=require(_0x1ea1('0x1'));var path=require('path');var timeout=require(_0x1ea1('0x2'));var express=require('express');var router=express[_0x1ea1('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1ea1('0x4'));router[_0x1ea1('0x5')]('/',auth[_0x1ea1('0x6')](),controller[_0x1ea1('0x7')]);router[_0x1ea1('0x5')]('/:id',auth[_0x1ea1('0x6')](),controller['show']);router[_0x1ea1('0x8')]('/',auth[_0x1ea1('0x6')](),controller[_0x1ea1('0x9')]);router[_0x1ea1('0xa')](_0x1ea1('0xb'),auth['isAuthenticated'](),controller[_0x1ea1('0xc')]);router[_0x1ea1('0xd')]('/:id',auth[_0x1ea1('0x6')](),controller[_0x1ea1('0xe')]);module[_0x1ea1('0xf')]=router; \ No newline at end of file +var _0xbc60=['show','create','put','/:id','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index'];(function(_0x10804e,_0x708da){var _0x54519b=function(_0x5a61d2){while(--_0x5a61d2){_0x10804e['push'](_0x10804e['shift']());}};_0x54519b(++_0x708da);}(_0xbc60,0xf1));var _0x0bc6=function(_0x1ecf49,_0x439492){_0x1ecf49=_0x1ecf49-0x0;var _0x5d9ef4=_0xbc60[_0x1ecf49];return _0x5d9ef4;};'use strict';var multer=require('multer');var util=require(_0x0bc6('0x0'));var path=require(_0x0bc6('0x1'));var timeout=require('connect-timeout');var express=require(_0x0bc6('0x2'));var router=express[_0x0bc6('0x3')]();var auth=require(_0x0bc6('0x4'));var interaction=require(_0x0bc6('0x5'));var config=require(_0x0bc6('0x6'));var controller=require(_0x0bc6('0x7'));router[_0x0bc6('0x8')]('/',auth[_0x0bc6('0x9')](),controller[_0x0bc6('0xa')]);router[_0x0bc6('0x8')]('/:id',auth[_0x0bc6('0x9')](),controller[_0x0bc6('0xb')]);router['post']('/',auth[_0x0bc6('0x9')](),controller[_0x0bc6('0xc')]);router[_0x0bc6('0xd')](_0x0bc6('0xe'),auth[_0x0bc6('0x9')](),controller['update']);router[_0x0bc6('0xf')](_0x0bc6('0xe'),auth['isAuthenticated'](),controller[_0x0bc6('0x10')]);module[_0x0bc6('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index e98de27..265de22 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 _0x91f3=['exports','STRING','DATE','ENUM','out','sequelize'];(function(_0x50a8ab,_0x2525fa){var _0x13f124=function(_0x15c86a){while(--_0x15c86a){_0x50a8ab['push'](_0x50a8ab['shift']());}};_0x13f124(++_0x2525fa);}(_0x91f3,0x19d));var _0x391f=function(_0x1d908b,_0x4abdba){_0x1d908b=_0x1d908b-0x0;var _0x13559a=_0x91f3[_0x1d908b];return _0x13559a;};'use strict';var Sequelize=require(_0x391f('0x0'));module[_0x391f('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x391f('0x2')]},'note':{'type':Sequelize[_0x391f('0x2')]},'read1stAt':{'type':Sequelize[_0x391f('0x3')]},'fax':{'type':Sequelize[_0x391f('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x391f('0x4')]('in',_0x391f('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x391f('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x391f('0x4')]('in',_0x391f('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x7da1=['STRING','ENUM','out','BOOLEAN','DATE'];(function(_0x3ed1c1,_0x45fe0a){var _0x11797d=function(_0x26bad3){while(--_0x26bad3){_0x3ed1c1['push'](_0x3ed1c1['shift']());}};_0x11797d(++_0x45fe0a);}(_0x7da1,0x1bb));var _0x17da=function(_0x8db66,_0x5b1229){_0x8db66=_0x8db66-0x0;var _0x201457=_0x7da1[_0x8db66];return _0x201457;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x17da('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x17da('0x1')]},'disposition':{'type':Sequelize[_0x17da('0x2')]},'note':{'type':Sequelize[_0x17da('0x2')]},'read1stAt':{'type':Sequelize[_0x17da('0x1')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x17da('0x3')]('in',_0x17da('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x17da('0x1')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x17da('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index f6dff84..7e17d97 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 _0xaaba=['removeTags','unix','toString','join','files','server','interaction-%s.zip','Attachment','mkdirSync','createReadStream','pipe','basename','download','log','err','html-pdf','zip-dir','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','FaxInteraction','rawAttributes','keys','query','dateStart','dateEnd','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','sort','filters','pick','add','day','merge','where','filter','map','include','tag','distinct','read','push','Messages','direction','createdAt','count','includeAll','Users','fullname','CmContact','Contact','User','Owner','internal','FaxAccount','Account','key','Tag','Tags','ThroughTags','color','findAll','rows','catch','show','params','options','find','create','body','describe','addMessage','ids','omit','getMessages','findOne','FaxInteractionId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','addTags','setTags','spread','emit'];(function(_0x4c05da,_0x414720){var _0x1614db=function(_0xa19cf6){while(--_0xa19cf6){_0x4c05da['push'](_0x4c05da['shift']());}};_0x1614db(++_0x414720);}(_0xaaba,0x10f));var _0xaaab=function(_0x1c852c,_0x1f4588){_0x1c852c=_0x1c852c-0x0;var _0x5ae3a6=_0xaaba[_0x1c852c];return _0x5ae3a6;};'use strict';var pdf=require(_0xaaab('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaaab('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaaab('0x2'));var moment=require(_0xaaab('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaaab('0x4'));var path=require(_0xaaab('0x5'));var sox=require('sox');var csv=require(_0xaaab('0x6'));var ejs=require(_0xaaab('0x7'));var fs=require('fs');var _=require(_0xaaab('0x8'));var squel=require(_0xaaab('0x9'));var crypto=require(_0xaaab('0xa'));var jsforce=require(_0xaaab('0xb'));var deskjs=require(_0xaaab('0xc'));var toCsv=require(_0xaaab('0x6'));var querystring=require(_0xaaab('0xd'));var Papa=require(_0xaaab('0xe'));var Redis=require(_0xaaab('0xf'));var qs=require(_0xaaab('0x10'));var logger=require(_0xaaab('0x11'))('api');var utils=require(_0xaaab('0x12'));var config=require(_0xaaab('0x13'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xaaab('0x14')](config[_0xaaab('0x15')],{'host':_0xaaab('0x16'),'port':0x18eb});var socket=require(_0xaaab('0x17'))(new Redis(config[_0xaaab('0x15')]));require('./faxInteraction.socket')['register'](socket);function respondWithStatusCode(_0x21c241,_0x387310){_0x387310=_0x387310||0xcc;return function(_0x2069f9){if(_0x2069f9){return _0x21c241['sendStatus'](_0x387310);}return _0x21c241[_0xaaab('0x18')](_0x387310)[_0xaaab('0x19')]();};}function respondWithResult(_0x4bb829,_0x5c5208){_0x5c5208=_0x5c5208||0xc8;return function(_0x14bcf1){if(_0x14bcf1){return _0x4bb829[_0xaaab('0x18')](_0x5c5208)[_0xaaab('0x1a')](_0x14bcf1);}};}function respondWithFilteredResult(_0x3a935a,_0xbe3007){return function(_0x554a44){if(_0x554a44){var _0x3d2589=_0x554a44['count'],_0x2f24fd=_0xbe3007[_0xaaab('0x1b')],_0x40aa5f=_0xbe3007[_0xaaab('0x1b')]+_0xbe3007[_0xaaab('0x1c')],_0x4f18ef;if(_0x40aa5f>=_0x3d2589){_0x40aa5f=_0x3d2589;_0x4f18ef=0xc8;}else{_0x4f18ef=0xce;}_0x3a935a['status'](_0x4f18ef);return _0x3a935a[_0xaaab('0x1d')](_0xaaab('0x1e'),_0x2f24fd+'-'+_0x40aa5f+'/'+_0x3d2589)['json'](_0x554a44);}return null;};}function patchUpdates(_0x57fc4b){return function(_0x57f3fb){try{jsonpatch[_0xaaab('0x1f')](_0x57f3fb,_0x57fc4b,!![]);}catch(_0x31e280){return BPromise['reject'](_0x31e280);}return _0x57f3fb[_0xaaab('0x20')]();};}function saveUpdates(_0x95e4a8,_0x211fc7){return function(_0x3d1fa4){if(_0x3d1fa4){return _0x3d1fa4[_0xaaab('0x21')](_0x95e4a8)[_0xaaab('0x22')](function(_0x57032d){return _0x57032d;});}return null;};}function removeEntity(_0x4ad601,_0x2feb4b){return function(_0x4b4eb5){if(_0x4b4eb5){return _0x4b4eb5[_0xaaab('0x23')]()[_0xaaab('0x22')](function(){_0x4ad601['status'](0xcc)[_0xaaab('0x19')]();});}};}function handleEntityNotFound(_0x2ff264,_0x2b1c0a){return function(_0x3acde9){if(!_0x3acde9){_0x2ff264[_0xaaab('0x24')](0x194);}return _0x3acde9;};}function handleError(_0x382f22,_0x468174){_0x468174=_0x468174||0x1f4;return function(_0x158120){logger[_0xaaab('0x25')](_0x158120[_0xaaab('0x26')]);if(_0x158120[_0xaaab('0x27')]){delete _0x158120[_0xaaab('0x27')];}_0x382f22[_0xaaab('0x18')](_0x468174)[_0xaaab('0x28')](_0x158120);};}exports[_0xaaab('0x29')]=function(_0x19d625,_0x5e7e03){var _0x1de23f={},_0x265f17={},_0x4a9118={'count':0x0,'rows':[]};var _0x233413=db[_0xaaab('0x2a')][_0xaaab('0x2b')];_0x265f17['model']=_[_0xaaab('0x2c')](_0x233413);var _0x5c31db={'dateStart':_0x19d625[_0xaaab('0x2d')][_0xaaab('0x2e')],'dateEnd':_0x19d625[_0xaaab('0x2d')][_0xaaab('0x2f')]};delete _0x19d625['query'][_0xaaab('0x2e')];delete _0x19d625[_0xaaab('0x2d')][_0xaaab('0x2f')];_0x265f17[_0xaaab('0x2d')]=_['keys'](_0x19d625[_0xaaab('0x2d')]);_0x265f17['filters']=_['intersection'](_0x265f17['model'],_0x265f17[_0xaaab('0x2d')]);_0x1de23f[_0xaaab('0x30')]=_[_0xaaab('0x31')](_0x265f17[_0xaaab('0x32')],qs['fields'](_0x19d625[_0xaaab('0x2d')][_0xaaab('0x33')]));_0x1de23f['attributes']=_0x1de23f[_0xaaab('0x30')][_0xaaab('0x34')]?_0x1de23f['attributes']:_0x265f17[_0xaaab('0x32')];if(!_0x19d625[_0xaaab('0x2d')][_0xaaab('0x35')](_0xaaab('0x36'))){_0x1de23f[_0xaaab('0x1c')]=qs[_0xaaab('0x1c')](_0x19d625[_0xaaab('0x2d')][_0xaaab('0x1c')]);_0x1de23f[_0xaaab('0x1b')]=qs[_0xaaab('0x1b')](_0x19d625[_0xaaab('0x2d')][_0xaaab('0x1b')]);}_0x1de23f['order']=qs[_0xaaab('0x37')](_0x19d625[_0xaaab('0x2d')][_0xaaab('0x37')]);_0x1de23f['where']=qs[_0xaaab('0x38')](_[_0xaaab('0x39')](_0x19d625[_0xaaab('0x2d')],_0x265f17[_0xaaab('0x38')]));if(_0x5c31db[_0xaaab('0x2e')]){if(_0x5c31db[_0xaaab('0x2f')]){_0x5c31db['dateEnd']=moment(_0x5c31db[_0xaaab('0x2f')])[_0xaaab('0x3a')](0x1,_0xaaab('0x3b'));}else{_0x5c31db['dateEnd']=moment(_0x5c31db['dateStart'])['add'](0x1,'day');}_[_0xaaab('0x3c')](_0x1de23f[_0xaaab('0x3d')],{'createdAt':{'$gte':_0x5c31db[_0xaaab('0x2e')],'$lte':_0x5c31db[_0xaaab('0x2f')]}});}if(_0x19d625[_0xaaab('0x2d')][_0xaaab('0x3e')]){_0x1de23f[_0xaaab('0x3d')]=_[_0xaaab('0x3c')](_0x1de23f[_0xaaab('0x3d')],{'$or':_[_0xaaab('0x3f')](_0x1de23f['attributes'],function(_0x14911b){var _0x4a3dc9={};_0x4a3dc9[_0x14911b]={'$like':'%'+_0x19d625[_0xaaab('0x2d')]['filter']+'%'};return _0x4a3dc9;})});}_0x1de23f=_[_0xaaab('0x3c')]({},_0x1de23f,_0x19d625['options']);var _0x334c6d={'where':_0x1de23f[_0xaaab('0x3d')]};_0x334c6d[_0xaaab('0x40')]=[];if(_0x19d625['query']['tag']){_0x334c6d[_0xaaab('0x40')]['push']({'model':db['Tag'],'as':'Tags','attributes':['id'],'where':{'id':_0x19d625[_0xaaab('0x2d')][_0xaaab('0x41')]},'required':!![]});_0x334c6d[_0xaaab('0x42')]=!![];}if(_0x19d625['query'][_0xaaab('0x43')]){_0x334c6d[_0xaaab('0x40')][_0xaaab('0x44')]({'model':db['FaxMessage'],'as':_0xaaab('0x45'),'attributes':['id',_0xaaab('0x46'),_0xaaab('0x47'),'read'],'where':{'direction':'in','read':_0x19d625[_0xaaab('0x2d')]['read']||![]},'required':!![]});_0x334c6d[_0xaaab('0x42')]=!![];}return db[_0xaaab('0x2a')][_0xaaab('0x48')](_0x334c6d)[_0xaaab('0x22')](function(_0x5ed91e){_0x4a9118[_0xaaab('0x48')]=_0x5ed91e;if(_0x19d625[_0xaaab('0x2d')][_0xaaab('0x49')]){_0x1de23f[_0xaaab('0x40')]=[{'model':db['User'],'as':_0xaaab('0x4a'),'required':![],'attributes':['id','name',_0xaaab('0x4b')]},{'model':db[_0xaaab('0x4c')],'as':_0xaaab('0x4d'),'required':![]},{'model':db[_0xaaab('0x4e')],'as':_0xaaab('0x4f'),'attributes':['name',_0xaaab('0x4b'),_0xaaab('0x50')],'required':![]},{'model':db[_0xaaab('0x51')],'as':_0xaaab('0x52'),'attributes':['name',_0xaaab('0x53')],'required':![]},{'model':db['FaxMessage'],'as':_0xaaab('0x45'),'attributes':['id','direction',_0xaaab('0x47'),_0xaaab('0x43')],'where':{'direction':'in','read':_0x19d625[_0xaaab('0x2d')][_0xaaab('0x43')]||![]},'required':_0x19d625[_0xaaab('0x2d')][_0xaaab('0x43')]||![]},{'model':db[_0xaaab('0x54')],'as':_0xaaab('0x55'),'attributes':['id',_0xaaab('0x27'),'color'],'required':_0x19d625['query']['tag']?!![]:![]},{'model':db[_0xaaab('0x54')],'as':_0xaaab('0x56'),'attributes':['id',_0xaaab('0x27'),_0xaaab('0x57')],'through':_0x19d625[_0xaaab('0x2d')][_0xaaab('0x41')]?{'attributes':[],'where':{'TagId':_0x19d625[_0xaaab('0x2d')]['tag']||undefined}}:{},'required':_0x19d625[_0xaaab('0x2d')][_0xaaab('0x41')]?!![]:![]}];}return db[_0xaaab('0x2a')][_0xaaab('0x58')](_0x1de23f);})[_0xaaab('0x22')](function(_0x2f768d){_0x4a9118[_0xaaab('0x59')]=_0x2f768d;return _0x4a9118;})['then'](respondWithFilteredResult(_0x5e7e03,_0x1de23f))[_0xaaab('0x5a')](handleError(_0x5e7e03,null));};exports[_0xaaab('0x5b')]=function(_0x1cc640,_0x596910){var _0x4294a4={'raw':![],'where':{'id':_0x1cc640[_0xaaab('0x5c')]['id']}},_0x489600={};_0x489600[_0xaaab('0x32')]=_[_0xaaab('0x2c')](db[_0xaaab('0x2a')]['rawAttributes']);_0x489600[_0xaaab('0x2d')]=_[_0xaaab('0x2c')](_0x1cc640[_0xaaab('0x2d')]);_0x489600[_0xaaab('0x38')]=_[_0xaaab('0x31')](_0x489600[_0xaaab('0x32')],_0x489600[_0xaaab('0x2d')]);_0x4294a4[_0xaaab('0x30')]=_['intersection'](_0x489600['model'],qs[_0xaaab('0x33')](_0x1cc640[_0xaaab('0x2d')][_0xaaab('0x33')]));_0x4294a4[_0xaaab('0x30')]=_0x4294a4[_0xaaab('0x30')][_0xaaab('0x34')]?_0x4294a4[_0xaaab('0x30')]:_0x489600[_0xaaab('0x32')];if(_0x1cc640[_0xaaab('0x2d')][_0xaaab('0x49')]){_0x4294a4[_0xaaab('0x40')]=[{'all':!![]}];}_0x4294a4=_[_0xaaab('0x3c')]({},_0x4294a4,_0x1cc640[_0xaaab('0x5d')]);return db[_0xaaab('0x2a')][_0xaaab('0x5e')](_0x4294a4)[_0xaaab('0x22')](handleEntityNotFound(_0x596910,null))[_0xaaab('0x22')](respondWithResult(_0x596910,null))[_0xaaab('0x5a')](handleError(_0x596910,null));};exports[_0xaaab('0x5f')]=function(_0x12044b,_0x140ec3){return db[_0xaaab('0x2a')]['create'](_0x12044b[_0xaaab('0x60')],{})[_0xaaab('0x22')](respondWithResult(_0x140ec3,0xc9))[_0xaaab('0x5a')](handleError(_0x140ec3,null));};exports[_0xaaab('0x21')]=function(_0x5f41f9,_0x1d3352){if(_0x5f41f9[_0xaaab('0x60')]['id']){delete _0x5f41f9[_0xaaab('0x60')]['id'];}return db['FaxInteraction'][_0xaaab('0x5e')]({'where':{'id':_0x5f41f9['params']['id']}})[_0xaaab('0x22')](handleEntityNotFound(_0x1d3352,null))['then'](saveUpdates(_0x5f41f9['body'],null))[_0xaaab('0x22')](respondWithResult(_0x1d3352,null))[_0xaaab('0x5a')](handleError(_0x1d3352,null));};exports[_0xaaab('0x23')]=function(_0x399221,_0xee5bd6){return db[_0xaaab('0x2a')]['find']({'where':{'id':_0x399221[_0xaaab('0x5c')]['id']}})[_0xaaab('0x22')](handleEntityNotFound(_0xee5bd6,null))[_0xaaab('0x22')](removeEntity(_0xee5bd6,null))['catch'](handleError(_0xee5bd6,null));};exports[_0xaaab('0x61')]=function(_0x5d609c,_0x31a9c4){return db[_0xaaab('0x2a')][_0xaaab('0x61')]()[_0xaaab('0x22')](respondWithResult(_0x31a9c4,null))[_0xaaab('0x5a')](handleError(_0x31a9c4,null));};exports[_0xaaab('0x62')]=function(_0x5be351,_0x5a4e3c,_0x555cd2){return db['FaxMessage']['find']({'where':{'id':_0x5be351['params']['id']}})[_0xaaab('0x22')](handleEntityNotFound(_0x5a4e3c,null))['then'](function(_0x3d2c5b){if(_0x3d2c5b){return _0x3d2c5b[_0xaaab('0x62')](_0x5be351[_0xaaab('0x60')][_0xaaab('0x63')],_[_0xaaab('0x64')](_0x5be351['body'],[_0xaaab('0x63'),'id'])||{});}})[_0xaaab('0x22')](respondWithResult(_0x5a4e3c,null))[_0xaaab('0x5a')](handleError(_0x5a4e3c,null));};exports[_0xaaab('0x65')]=function(_0x317750,_0x323aa9,_0x5bc579){var _0x12e7ca={'raw':![],'where':{}};var _0x555ec6={};var _0x3621d2={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xaaab('0x66')]({'where':{'id':_0x317750[_0xaaab('0x5c')]['id']}})[_0xaaab('0x22')](handleEntityNotFound(_0x323aa9,null))[_0xaaab('0x22')](function(_0x58808a){if(_0x58808a){_0x555ec6[_0xaaab('0x32')]=_[_0xaaab('0x2c')](db['FaxMessage'][_0xaaab('0x2b')]);_0x555ec6[_0xaaab('0x2d')]=_[_0xaaab('0x2c')](_0x317750['query']);_0x555ec6['filters']=_[_0xaaab('0x31')](_0x555ec6[_0xaaab('0x32')],_0x555ec6[_0xaaab('0x2d')]);_0x12e7ca[_0xaaab('0x30')]=_[_0xaaab('0x31')](_0x555ec6[_0xaaab('0x32')],qs[_0xaaab('0x33')](_0x317750['query'][_0xaaab('0x33')]));_0x12e7ca['attributes']=_0x12e7ca[_0xaaab('0x30')]['length']?_0x12e7ca['attributes']:_0x555ec6[_0xaaab('0x32')];if(!_0x317750[_0xaaab('0x2d')][_0xaaab('0x35')](_0xaaab('0x36'))){_0x12e7ca['limit']=qs[_0xaaab('0x1c')](_0x317750['query'][_0xaaab('0x1c')]);_0x12e7ca[_0xaaab('0x1b')]=qs[_0xaaab('0x1b')](_0x317750[_0xaaab('0x2d')][_0xaaab('0x1b')]);}_0x12e7ca['order']=qs[_0xaaab('0x37')](_0x317750['query'][_0xaaab('0x37')]);_0x12e7ca[_0xaaab('0x3d')]=qs[_0xaaab('0x38')](_['pick'](_0x317750['query'],_0x555ec6['filters']));_0x12e7ca[_0xaaab('0x3d')][_0xaaab('0x67')]=_0x58808a['id'];if(_0x317750[_0xaaab('0x2d')]['filter']){_0x12e7ca['where']=_[_0xaaab('0x3c')](_0x12e7ca[_0xaaab('0x3d')],{'$or':_[_0xaaab('0x3f')](_0x12e7ca[_0xaaab('0x30')],function(_0x301132){var _0x21f5d8={};_0x21f5d8[_0x301132]={'$like':'%'+_0x317750[_0xaaab('0x2d')]['filter']+'%'};return _0x21f5d8;})});}if(_0x317750['query'][_0xaaab('0x68')]){var _0x103574=_0x317750['query']['$gte'][_0xaaab('0x69')](',');var _0x485609={};_0x485609[_0x103574[0x0]]={'$gte':moment(_0x103574[0x1])[_0xaaab('0x6a')](_0xaaab('0x6b'))};_0x12e7ca[_0xaaab('0x3d')]=_['merge'](_0x12e7ca[_0xaaab('0x3d')],_0x485609);}_0x12e7ca=_[_0xaaab('0x3c')]({},_0x12e7ca,_0x317750['options']);return db[_0xaaab('0x6c')][_0xaaab('0x48')]({'where':_0x12e7ca[_0xaaab('0x3d')]})['then'](function(_0x3fdc5b){_0x3621d2[_0xaaab('0x48')]=_0x3fdc5b;if(_0x317750[_0xaaab('0x2d')][_0xaaab('0x49')]){_0x12e7ca['include']=[{'all':!![]}];}return db[_0xaaab('0x6c')][_0xaaab('0x58')](_0x12e7ca);})['then'](function(_0x16b796){_0x3621d2[_0xaaab('0x59')]=_0x16b796;return _0x3621d2;});}})[_0xaaab('0x22')](respondWithFilteredResult(_0x323aa9,_0x12e7ca))['catch'](handleError(_0x323aa9,null));};exports[_0xaaab('0x6d')]=function(_0x3cfc56,_0x7d4fe6,_0xf26f4b){return db[_0xaaab('0x2a')]['find']({'where':{'id':_0x3cfc56['params']['id']}})['then'](handleEntityNotFound(_0x7d4fe6,null))[_0xaaab('0x22')](function(_0x683873){if(_0x683873){return _0x683873[_0xaaab('0x6e')](_0x3cfc56[_0xaaab('0x60')][_0xaaab('0x63')],_[_0xaaab('0x64')](_0x3cfc56[_0xaaab('0x60')],['ids','id'])||{})[_0xaaab('0x6f')](function(){return db['Tag']['findAll']({'attributes':['id',_0xaaab('0x27'),'color'],'where':{'id':_0x3cfc56[_0xaaab('0x60')][_0xaaab('0x63')]}});})[_0xaaab('0x22')](function(_0x264390){socket[_0xaaab('0x70')]('faxInteractionTags:save',{'id':Number(_0x3cfc56['params']['id']),'tags':_0x264390||[]});return{'id':Number(_0x3cfc56['params']['id']),'tags':_0x264390||[]};});}})[_0xaaab('0x22')](respondWithResult(_0x7d4fe6,null))[_0xaaab('0x5a')](handleError(_0x7d4fe6,null));};exports[_0xaaab('0x71')]=function(_0x4943d6,_0x15337d,_0x5488ae){var _0x32a01e;return db[_0xaaab('0x2a')]['find']({'where':{'id':_0x4943d6['params']['id']}})['then'](handleEntityNotFound(_0x15337d,null))['then'](function(_0x2c3afd){if(_0x2c3afd){return _0x2c3afd[_0xaaab('0x71')](_0x4943d6[_0xaaab('0x2d')]['ids']);}})['then'](respondWithStatusCode(_0x15337d,null))[_0xaaab('0x5a')](handleError(_0x15337d,null));};exports['download']=function(_0x580726,_0x3d6bae){var _0x222eed=moment()[_0xaaab('0x72')]()[_0xaaab('0x73')]();var _0x3c0de6=path[_0xaaab('0x74')](config['root'],'server',_0xaaab('0x75'),'attachments');var _0x4944f5=path[_0xaaab('0x74')](config['root'],_0xaaab('0x76'),'files','tmp');var _0x350be4=path[_0xaaab('0x74')](_0x4944f5,_0x222eed);var _0x197b57=util[_0xaaab('0x6a')](_0xaaab('0x77'),_0x222eed);var _0x28282a=path[_0xaaab('0x74')](_0x4944f5,_0x197b57);var _0x1ad3af=![];return db['FaxInteraction']['find']({'where':{'id':_0x580726[_0xaaab('0x5c')]['id']}})[_0xaaab('0x22')](handleEntityNotFound(_0x3d6bae,null))[_0xaaab('0x22')](function(_0x153ca2){if(_0x153ca2){return _0x153ca2[_0xaaab('0x65')]({'attributes':['id',_0xaaab('0x60'),_0xaaab('0x47')],'include':[{'model':db[_0xaaab('0x78')],'as':_0xaaab('0x78')}]});}return[];})[_0xaaab('0x22')](function(_0x585886){_0x1ad3af=_0x585886[_0xaaab('0x34')];if(_0x585886[_0xaaab('0x34')]){fs[_0xaaab('0x79')](_0x350be4);for(var _0x408e74=0x0;_0x408e74<_0x585886[_0xaaab('0x34')];_0x408e74++){var _0x1e20e6=_0x585886[_0x408e74];var _0x207576=_0x1e20e6['Attachment'];if(_0x207576){var _0x10fc5f=path[_0xaaab('0x74')](_0x3c0de6,_0x207576['basename']);if(fs['existsSync'](_0x10fc5f)){fs[_0xaaab('0x7a')](_0x10fc5f)[_0xaaab('0x7b')](fs['createWriteStream'](path[_0xaaab('0x74')](_0x350be4,_0x207576[_0xaaab('0x7c')])));}}}}})[_0xaaab('0x22')](function(){if(_0x1ad3af){return new BPromise(function(_0x1bbfd6,_0x252b64){zipdir(_0x350be4,{'saveTo':_0x28282a},function(_0x13c6cd,_0x578f8e){if(_0x13c6cd)return _0x252b64(_0x13c6cd);return _0x1bbfd6(_0x578f8e);});});}})[_0xaaab('0x22')](function(){if(_0x1ad3af){return new BPromise(function(_0x257395,_0x295e2f){rimraf(_0x350be4,function(_0xdfc618){if(_0xdfc618)_0x295e2f(_0xdfc618);return _0x257395();});});}})['then'](function(){if(_0x1ad3af){return _0x3d6bae[_0xaaab('0x7d')](_0x28282a,_0x197b57,function(_0xe07f28){if(_0xe07f28){console[_0xaaab('0x7e')](_0xaaab('0x7f'),_0xe07f28);}else{fs['unlinkSync'](_0x28282a);}});}else{return _0x3d6bae[_0xaaab('0x24')](0xc8);}})['catch'](handleError(_0x3d6bae,null));}; \ No newline at end of file +var _0x1ce2=['findAll','faxInteractionTags:save','removeTags','download','unix','toString','join','root','files','attachments','server','format','Attachment','mkdirSync','basename','createReadStream','pipe','createWriteStream','log','err','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','localhost','register','sendStatus','status','json','count','offset','Content-Range','apply','reject','update','destroy','then','end','error','name','send','index','rawAttributes','model','query','dateStart','dateEnd','keys','attributes','intersection','fields','nolimit','limit','sort','where','filters','add','day','merge','filter','map','options','Tags','tag','read','include','FaxMessage','direction','createdAt','FaxInteraction','includeAll','User','fullname','Contact','Owner','internal','FaxAccount','key','Messages','Tag','color','ThroughTags','rows','catch','params','length','find','create','body','describe','addMessage','ids','getMessages','order','FaxInteractionId','$gte','split','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread'];(function(_0x3255d7,_0x2cecb7){var _0x13cd65=function(_0x5d1486){while(--_0x5d1486){_0x3255d7['push'](_0x3255d7['shift']());}};_0x13cd65(++_0x2cecb7);}(_0x1ce2,0x8d));var _0x21ce=function(_0x115d99,_0x503f5f){_0x115d99=_0x115d99-0x0;var _0x1928ae=_0x1ce2[_0x115d99];return _0x1928ae;};'use strict';var pdf=require(_0x21ce('0x0'));var emlformat=require(_0x21ce('0x1'));var rimraf=require(_0x21ce('0x2'));var zipdir=require(_0x21ce('0x3'));var jsonpatch=require(_0x21ce('0x4'));var rp=require(_0x21ce('0x5'));var moment=require(_0x21ce('0x6'));var BPromise=require(_0x21ce('0x7'));var Mustache=require(_0x21ce('0x8'));var util=require(_0x21ce('0x9'));var path=require(_0x21ce('0xa'));var sox=require(_0x21ce('0xb'));var csv=require(_0x21ce('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x21ce('0xd'));var squel=require('squel');var crypto=require(_0x21ce('0xe'));var jsforce=require(_0x21ce('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x21ce('0xc'));var querystring=require(_0x21ce('0x10'));var Papa=require(_0x21ce('0x11'));var Redis=require(_0x21ce('0x12'));var qs=require(_0x21ce('0x13'));var logger=require('../../config/logger')(_0x21ce('0x14'));var utils=require('../../config/utils');var config=require(_0x21ce('0x15'));var db=require('../../mysqldb')['db'];config[_0x21ce('0x16')]=_[_0x21ce('0x17')](config[_0x21ce('0x16')],{'host':_0x21ce('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x21ce('0x16')]));require('./faxInteraction.socket')[_0x21ce('0x19')](socket);function respondWithStatusCode(_0x4df673,_0x32a524){_0x32a524=_0x32a524||0xcc;return function(_0x52103b){if(_0x52103b){return _0x4df673[_0x21ce('0x1a')](_0x32a524);}return _0x4df673[_0x21ce('0x1b')](_0x32a524)['end']();};}function respondWithResult(_0x259490,_0x469f76){_0x469f76=_0x469f76||0xc8;return function(_0x13ed43){if(_0x13ed43){return _0x259490[_0x21ce('0x1b')](_0x469f76)[_0x21ce('0x1c')](_0x13ed43);}};}function respondWithFilteredResult(_0x24713c,_0x59dd8e){return function(_0x529188){if(_0x529188){var _0x246bb7=_0x529188[_0x21ce('0x1d')],_0x50c372=_0x59dd8e[_0x21ce('0x1e')],_0x2c6021=_0x59dd8e['offset']+_0x59dd8e['limit'],_0x225215;if(_0x2c6021>=_0x246bb7){_0x2c6021=_0x246bb7;_0x225215=0xc8;}else{_0x225215=0xce;}_0x24713c[_0x21ce('0x1b')](_0x225215);return _0x24713c['set'](_0x21ce('0x1f'),_0x50c372+'-'+_0x2c6021+'/'+_0x246bb7)[_0x21ce('0x1c')](_0x529188);}return null;};}function patchUpdates(_0x4d98de){return function(_0x87d12b){try{jsonpatch[_0x21ce('0x20')](_0x87d12b,_0x4d98de,!![]);}catch(_0x3c6987){return BPromise[_0x21ce('0x21')](_0x3c6987);}return _0x87d12b['save']();};}function saveUpdates(_0xabe63b,_0x5d89ea){return function(_0x558026){if(_0x558026){return _0x558026[_0x21ce('0x22')](_0xabe63b)['then'](function(_0x35cd9e){return _0x35cd9e;});}return null;};}function removeEntity(_0x2f7c2d,_0x25c893){return function(_0x49c270){if(_0x49c270){return _0x49c270[_0x21ce('0x23')]()[_0x21ce('0x24')](function(){_0x2f7c2d[_0x21ce('0x1b')](0xcc)[_0x21ce('0x25')]();});}};}function handleEntityNotFound(_0x4e63ee,_0x47d452){return function(_0x360e10){if(!_0x360e10){_0x4e63ee[_0x21ce('0x1a')](0x194);}return _0x360e10;};}function handleError(_0x11af1e,_0x5705aa){_0x5705aa=_0x5705aa||0x1f4;return function(_0x1947ab){logger[_0x21ce('0x26')](_0x1947ab['stack']);if(_0x1947ab[_0x21ce('0x27')]){delete _0x1947ab[_0x21ce('0x27')];}_0x11af1e['status'](_0x5705aa)[_0x21ce('0x28')](_0x1947ab);};}exports[_0x21ce('0x29')]=function(_0x5a9908,_0x255291){var _0x2b68c9={},_0x16af92={},_0x14b671={'count':0x0,'rows':[]};var _0x48644c=db['FaxInteraction'][_0x21ce('0x2a')];_0x16af92[_0x21ce('0x2b')]=_['keys'](_0x48644c);var _0x1b4300={'dateStart':_0x5a9908[_0x21ce('0x2c')][_0x21ce('0x2d')],'dateEnd':_0x5a9908['query'][_0x21ce('0x2e')]};delete _0x5a9908[_0x21ce('0x2c')][_0x21ce('0x2d')];delete _0x5a9908[_0x21ce('0x2c')]['dateEnd'];_0x16af92[_0x21ce('0x2c')]=_[_0x21ce('0x2f')](_0x5a9908[_0x21ce('0x2c')]);_0x16af92['filters']=_['intersection'](_0x16af92[_0x21ce('0x2b')],_0x16af92[_0x21ce('0x2c')]);_0x2b68c9[_0x21ce('0x30')]=_[_0x21ce('0x31')](_0x16af92[_0x21ce('0x2b')],qs[_0x21ce('0x32')](_0x5a9908['query'][_0x21ce('0x32')]));_0x2b68c9[_0x21ce('0x30')]=_0x2b68c9[_0x21ce('0x30')]['length']?_0x2b68c9[_0x21ce('0x30')]:_0x16af92['model'];if(!_0x5a9908['query']['hasOwnProperty'](_0x21ce('0x33'))){_0x2b68c9[_0x21ce('0x34')]=qs[_0x21ce('0x34')](_0x5a9908[_0x21ce('0x2c')][_0x21ce('0x34')]);_0x2b68c9[_0x21ce('0x1e')]=qs['offset'](_0x5a9908['query'][_0x21ce('0x1e')]);}_0x2b68c9['order']=qs[_0x21ce('0x35')](_0x5a9908[_0x21ce('0x2c')][_0x21ce('0x35')]);_0x2b68c9[_0x21ce('0x36')]=qs[_0x21ce('0x37')](_['pick'](_0x5a9908['query'],_0x16af92['filters']));if(_0x1b4300[_0x21ce('0x2d')]){if(_0x1b4300['dateEnd']){_0x1b4300['dateEnd']=moment(_0x1b4300[_0x21ce('0x2e')])[_0x21ce('0x38')](0x1,'day');}else{_0x1b4300[_0x21ce('0x2e')]=moment(_0x1b4300[_0x21ce('0x2d')])[_0x21ce('0x38')](0x1,_0x21ce('0x39'));}_[_0x21ce('0x3a')](_0x2b68c9[_0x21ce('0x36')],{'createdAt':{'$gte':_0x1b4300[_0x21ce('0x2d')],'$lte':_0x1b4300[_0x21ce('0x2e')]}});}if(_0x5a9908[_0x21ce('0x2c')][_0x21ce('0x3b')]){_0x2b68c9[_0x21ce('0x36')]=_[_0x21ce('0x3a')](_0x2b68c9[_0x21ce('0x36')],{'$or':_[_0x21ce('0x3c')](_0x2b68c9['attributes'],function(_0x524956){var _0x2d5920={};_0x2d5920[_0x524956]={'$like':'%'+_0x5a9908['query'][_0x21ce('0x3b')]+'%'};return _0x2d5920;})});}_0x2b68c9=_[_0x21ce('0x3a')]({},_0x2b68c9,_0x5a9908[_0x21ce('0x3d')]);var _0x5442ca={'where':_0x2b68c9[_0x21ce('0x36')]};_0x5442ca['include']=[];if(_0x5a9908['query']['tag']){_0x5442ca['include']['push']({'model':db['Tag'],'as':_0x21ce('0x3e'),'attributes':['id'],'where':{'id':_0x5a9908['query'][_0x21ce('0x3f')]},'required':!![]});_0x5442ca['distinct']=!![];}if(_0x5a9908['query'][_0x21ce('0x40')]){_0x5442ca[_0x21ce('0x41')]['push']({'model':db[_0x21ce('0x42')],'as':'Messages','attributes':['id',_0x21ce('0x43'),_0x21ce('0x44'),_0x21ce('0x40')],'where':{'direction':'in','read':_0x5a9908[_0x21ce('0x2c')]['read']||![]},'required':!![]});_0x5442ca['distinct']=!![];}return db[_0x21ce('0x45')]['count'](_0x5442ca)['then'](function(_0x22fd9f){_0x14b671['count']=_0x22fd9f;if(_0x5a9908['query'][_0x21ce('0x46')]){_0x2b68c9[_0x21ce('0x41')]=[{'model':db[_0x21ce('0x47')],'as':'Users','required':![],'attributes':['id','name',_0x21ce('0x48')]},{'model':db['CmContact'],'as':_0x21ce('0x49'),'required':![]},{'model':db[_0x21ce('0x47')],'as':_0x21ce('0x4a'),'attributes':[_0x21ce('0x27'),'fullname',_0x21ce('0x4b')],'required':![]},{'model':db[_0x21ce('0x4c')],'as':'Account','attributes':['name',_0x21ce('0x4d')],'required':![]},{'model':db[_0x21ce('0x42')],'as':_0x21ce('0x4e'),'attributes':['id',_0x21ce('0x43'),'createdAt',_0x21ce('0x40')],'where':{'direction':'in','read':_0x5a9908[_0x21ce('0x2c')][_0x21ce('0x40')]||![]},'required':_0x5a9908[_0x21ce('0x2c')]['read']||![]},{'model':db[_0x21ce('0x4f')],'as':_0x21ce('0x3e'),'attributes':['id',_0x21ce('0x27'),_0x21ce('0x50')],'required':_0x5a9908['query'][_0x21ce('0x3f')]?!![]:![]},{'model':db['Tag'],'as':_0x21ce('0x51'),'attributes':['id',_0x21ce('0x27'),_0x21ce('0x50')],'through':_0x5a9908[_0x21ce('0x2c')]['tag']?{'attributes':[],'where':{'TagId':_0x5a9908[_0x21ce('0x2c')][_0x21ce('0x3f')]||undefined}}:{},'required':_0x5a9908[_0x21ce('0x2c')][_0x21ce('0x3f')]?!![]:![]}];}return db[_0x21ce('0x45')]['findAll'](_0x2b68c9);})[_0x21ce('0x24')](function(_0x29b90c){_0x14b671[_0x21ce('0x52')]=_0x29b90c;return _0x14b671;})['then'](respondWithFilteredResult(_0x255291,_0x2b68c9))[_0x21ce('0x53')](handleError(_0x255291,null));};exports['show']=function(_0x5eb64d,_0xb1e1ff){var _0x4735db={'raw':![],'where':{'id':_0x5eb64d[_0x21ce('0x54')]['id']}},_0x2ec3a6={};_0x2ec3a6[_0x21ce('0x2b')]=_[_0x21ce('0x2f')](db[_0x21ce('0x45')][_0x21ce('0x2a')]);_0x2ec3a6['query']=_[_0x21ce('0x2f')](_0x5eb64d[_0x21ce('0x2c')]);_0x2ec3a6['filters']=_[_0x21ce('0x31')](_0x2ec3a6[_0x21ce('0x2b')],_0x2ec3a6[_0x21ce('0x2c')]);_0x4735db[_0x21ce('0x30')]=_[_0x21ce('0x31')](_0x2ec3a6[_0x21ce('0x2b')],qs['fields'](_0x5eb64d[_0x21ce('0x2c')][_0x21ce('0x32')]));_0x4735db[_0x21ce('0x30')]=_0x4735db[_0x21ce('0x30')][_0x21ce('0x55')]?_0x4735db['attributes']:_0x2ec3a6[_0x21ce('0x2b')];if(_0x5eb64d[_0x21ce('0x2c')][_0x21ce('0x46')]){_0x4735db[_0x21ce('0x41')]=[{'all':!![]}];}_0x4735db=_[_0x21ce('0x3a')]({},_0x4735db,_0x5eb64d[_0x21ce('0x3d')]);return db[_0x21ce('0x45')][_0x21ce('0x56')](_0x4735db)[_0x21ce('0x24')](handleEntityNotFound(_0xb1e1ff,null))[_0x21ce('0x24')](respondWithResult(_0xb1e1ff,null))[_0x21ce('0x53')](handleError(_0xb1e1ff,null));};exports[_0x21ce('0x57')]=function(_0x37bfbd,_0x5098c9){return db[_0x21ce('0x45')][_0x21ce('0x57')](_0x37bfbd['body'],{})[_0x21ce('0x24')](respondWithResult(_0x5098c9,0xc9))['catch'](handleError(_0x5098c9,null));};exports['update']=function(_0x5a00ca,_0x4a8831){if(_0x5a00ca[_0x21ce('0x58')]['id']){delete _0x5a00ca[_0x21ce('0x58')]['id'];}return db[_0x21ce('0x45')][_0x21ce('0x56')]({'where':{'id':_0x5a00ca[_0x21ce('0x54')]['id']}})[_0x21ce('0x24')](handleEntityNotFound(_0x4a8831,null))[_0x21ce('0x24')](saveUpdates(_0x5a00ca['body'],null))[_0x21ce('0x24')](respondWithResult(_0x4a8831,null))[_0x21ce('0x53')](handleError(_0x4a8831,null));};exports[_0x21ce('0x23')]=function(_0x2824cc,_0x589ac1){return db['FaxInteraction'][_0x21ce('0x56')]({'where':{'id':_0x2824cc[_0x21ce('0x54')]['id']}})[_0x21ce('0x24')](handleEntityNotFound(_0x589ac1,null))[_0x21ce('0x24')](removeEntity(_0x589ac1,null))[_0x21ce('0x53')](handleError(_0x589ac1,null));};exports[_0x21ce('0x59')]=function(_0x47b05f,_0x3b2fd1){return db[_0x21ce('0x45')][_0x21ce('0x59')]()[_0x21ce('0x24')](respondWithResult(_0x3b2fd1,null))[_0x21ce('0x53')](handleError(_0x3b2fd1,null));};exports[_0x21ce('0x5a')]=function(_0x254e69,_0x235e0e,_0x44a2d7){return db['FaxMessage'][_0x21ce('0x56')]({'where':{'id':_0x254e69[_0x21ce('0x54')]['id']}})[_0x21ce('0x24')](handleEntityNotFound(_0x235e0e,null))[_0x21ce('0x24')](function(_0x32665f){if(_0x32665f){return _0x32665f['addMessage'](_0x254e69[_0x21ce('0x58')][_0x21ce('0x5b')],_['omit'](_0x254e69[_0x21ce('0x58')],[_0x21ce('0x5b'),'id'])||{});}})[_0x21ce('0x24')](respondWithResult(_0x235e0e,null))[_0x21ce('0x53')](handleError(_0x235e0e,null));};exports[_0x21ce('0x5c')]=function(_0x2dca29,_0x14d0d6,_0x54b146){var _0x57c734={'raw':![],'where':{}};var _0x362e99={};var _0x343ae2={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x2dca29['params']['id']}})[_0x21ce('0x24')](handleEntityNotFound(_0x14d0d6,null))[_0x21ce('0x24')](function(_0x52c15e){if(_0x52c15e){_0x362e99[_0x21ce('0x2b')]=_[_0x21ce('0x2f')](db[_0x21ce('0x42')][_0x21ce('0x2a')]);_0x362e99[_0x21ce('0x2c')]=_[_0x21ce('0x2f')](_0x2dca29[_0x21ce('0x2c')]);_0x362e99[_0x21ce('0x37')]=_[_0x21ce('0x31')](_0x362e99['model'],_0x362e99[_0x21ce('0x2c')]);_0x57c734[_0x21ce('0x30')]=_[_0x21ce('0x31')](_0x362e99[_0x21ce('0x2b')],qs['fields'](_0x2dca29[_0x21ce('0x2c')][_0x21ce('0x32')]));_0x57c734[_0x21ce('0x30')]=_0x57c734[_0x21ce('0x30')][_0x21ce('0x55')]?_0x57c734[_0x21ce('0x30')]:_0x362e99[_0x21ce('0x2b')];if(!_0x2dca29[_0x21ce('0x2c')]['hasOwnProperty'](_0x21ce('0x33'))){_0x57c734['limit']=qs['limit'](_0x2dca29[_0x21ce('0x2c')]['limit']);_0x57c734[_0x21ce('0x1e')]=qs['offset'](_0x2dca29[_0x21ce('0x2c')]['offset']);}_0x57c734[_0x21ce('0x5d')]=qs[_0x21ce('0x35')](_0x2dca29['query']['sort']);_0x57c734[_0x21ce('0x36')]=qs['filters'](_['pick'](_0x2dca29['query'],_0x362e99[_0x21ce('0x37')]));_0x57c734['where'][_0x21ce('0x5e')]=_0x52c15e['id'];if(_0x2dca29[_0x21ce('0x2c')][_0x21ce('0x3b')]){_0x57c734['where']=_[_0x21ce('0x3a')](_0x57c734[_0x21ce('0x36')],{'$or':_['map'](_0x57c734['attributes'],function(_0x15d6af){var _0x3d6adf={};_0x3d6adf[_0x15d6af]={'$like':'%'+_0x2dca29['query'][_0x21ce('0x3b')]+'%'};return _0x3d6adf;})});}if(_0x2dca29[_0x21ce('0x2c')][_0x21ce('0x5f')]){var _0x501315=_0x2dca29[_0x21ce('0x2c')][_0x21ce('0x5f')][_0x21ce('0x60')](',');var _0x25b816={};_0x25b816[_0x501315[0x0]]={'$gte':moment(_0x501315[0x1])['format'](_0x21ce('0x61'))};_0x57c734['where']=_[_0x21ce('0x3a')](_0x57c734[_0x21ce('0x36')],_0x25b816);}_0x57c734=_[_0x21ce('0x3a')]({},_0x57c734,_0x2dca29[_0x21ce('0x3d')]);return db[_0x21ce('0x42')][_0x21ce('0x1d')]({'where':_0x57c734[_0x21ce('0x36')]})[_0x21ce('0x24')](function(_0x13a8e3){_0x343ae2[_0x21ce('0x1d')]=_0x13a8e3;if(_0x2dca29[_0x21ce('0x2c')]['includeAll']){_0x57c734[_0x21ce('0x41')]=[{'all':!![]}];}return db[_0x21ce('0x42')]['findAll'](_0x57c734);})[_0x21ce('0x24')](function(_0x397649){_0x343ae2[_0x21ce('0x52')]=_0x397649;return _0x343ae2;});}})[_0x21ce('0x24')](respondWithFilteredResult(_0x14d0d6,_0x57c734))[_0x21ce('0x53')](handleError(_0x14d0d6,null));};exports[_0x21ce('0x62')]=function(_0xaf2616,_0x5ba482,_0x38d529){return db['FaxInteraction'][_0x21ce('0x56')]({'where':{'id':_0xaf2616['params']['id']}})[_0x21ce('0x24')](handleEntityNotFound(_0x5ba482,null))['then'](function(_0x41295e){if(_0x41295e){return _0x41295e[_0x21ce('0x63')](_0xaf2616[_0x21ce('0x58')]['ids'],_['omit'](_0xaf2616[_0x21ce('0x58')],['ids','id'])||{})[_0x21ce('0x64')](function(){return db['Tag'][_0x21ce('0x65')]({'attributes':['id',_0x21ce('0x27'),_0x21ce('0x50')],'where':{'id':_0xaf2616[_0x21ce('0x58')][_0x21ce('0x5b')]}});})['then'](function(_0x1724c8){socket['emit'](_0x21ce('0x66'),{'id':Number(_0xaf2616['params']['id']),'tags':_0x1724c8||[]});return{'id':Number(_0xaf2616[_0x21ce('0x54')]['id']),'tags':_0x1724c8||[]};});}})['then'](respondWithResult(_0x5ba482,null))[_0x21ce('0x53')](handleError(_0x5ba482,null));};exports[_0x21ce('0x67')]=function(_0x5a117e,_0x1b710d,_0x1dfe8e){var _0x175460;return db[_0x21ce('0x45')]['find']({'where':{'id':_0x5a117e[_0x21ce('0x54')]['id']}})[_0x21ce('0x24')](handleEntityNotFound(_0x1b710d,null))['then'](function(_0x917ba5){if(_0x917ba5){return _0x917ba5[_0x21ce('0x67')](_0x5a117e[_0x21ce('0x2c')][_0x21ce('0x5b')]);}})[_0x21ce('0x24')](respondWithStatusCode(_0x1b710d,null))[_0x21ce('0x53')](handleError(_0x1b710d,null));};exports[_0x21ce('0x68')]=function(_0x4751d0,_0x19fc69){var _0x583c61=moment()[_0x21ce('0x69')]()[_0x21ce('0x6a')]();var _0x520857=path[_0x21ce('0x6b')](config[_0x21ce('0x6c')],'server',_0x21ce('0x6d'),_0x21ce('0x6e'));var _0x44eea6=path['join'](config[_0x21ce('0x6c')],_0x21ce('0x6f'),'files','tmp');var _0x4545c3=path[_0x21ce('0x6b')](_0x44eea6,_0x583c61);var _0x1b2869=util[_0x21ce('0x70')]('interaction-%s.zip',_0x583c61);var _0x487208=path['join'](_0x44eea6,_0x1b2869);var _0x4b6e34=![];return db[_0x21ce('0x45')][_0x21ce('0x56')]({'where':{'id':_0x4751d0[_0x21ce('0x54')]['id']}})['then'](handleEntityNotFound(_0x19fc69,null))[_0x21ce('0x24')](function(_0x5c2380){if(_0x5c2380){return _0x5c2380[_0x21ce('0x5c')]({'attributes':['id',_0x21ce('0x58'),'createdAt'],'include':[{'model':db[_0x21ce('0x71')],'as':_0x21ce('0x71')}]});}return[];})[_0x21ce('0x24')](function(_0x4d0493){_0x4b6e34=_0x4d0493['length'];if(_0x4d0493['length']){fs[_0x21ce('0x72')](_0x4545c3);for(var _0x59b6a4=0x0;_0x59b6a4<_0x4d0493[_0x21ce('0x55')];_0x59b6a4++){var _0x45c69c=_0x4d0493[_0x59b6a4];var _0xd8e711=_0x45c69c[_0x21ce('0x71')];if(_0xd8e711){var _0x2f0d89=path['join'](_0x520857,_0xd8e711[_0x21ce('0x73')]);if(fs['existsSync'](_0x2f0d89)){fs[_0x21ce('0x74')](_0x2f0d89)[_0x21ce('0x75')](fs[_0x21ce('0x76')](path['join'](_0x4545c3,_0xd8e711['basename'])));}}}}})[_0x21ce('0x24')](function(){if(_0x4b6e34){return new BPromise(function(_0x5184c7,_0xcbf9b6){zipdir(_0x4545c3,{'saveTo':_0x487208},function(_0x3931a1,_0x11d58e){if(_0x3931a1)return _0xcbf9b6(_0x3931a1);return _0x5184c7(_0x11d58e);});});}})[_0x21ce('0x24')](function(){if(_0x4b6e34){return new BPromise(function(_0x4c5cf9,_0x2316f7){rimraf(_0x4545c3,function(_0x45ba6f){if(_0x45ba6f)_0x2316f7(_0x45ba6f);return _0x4c5cf9();});});}})[_0x21ce('0x24')](function(){if(_0x4b6e34){return _0x19fc69[_0x21ce('0x68')](_0x487208,_0x1b2869,function(_0x38547){if(_0x38547){console[_0x21ce('0x77')](_0x21ce('0x78'),_0x38547);}else{fs['unlinkSync'](_0x487208);}});}else{return _0x19fc69['sendStatus'](0xc8);}})[_0x21ce('0x53')](handleError(_0x19fc69,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 89861f0..3318777 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 _0x878f=['hook','exports','../../mysqldb','FaxInteraction','setMaxListeners','save','update','remove','emit'];(function(_0xfb5413,_0x344320){var _0x38eb74=function(_0x12b720){while(--_0x12b720){_0xfb5413['push'](_0xfb5413['shift']());}};_0x38eb74(++_0x344320);}(_0x878f,0x173));var _0xf878=function(_0x200b38,_0x2613bd){_0x200b38=_0x200b38-0x0;var _0x5e1323=_0x878f[_0x200b38];return _0x5e1323;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0xf878('0x0'))['db'][_0xf878('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xf878('0x2')](0x0);var events={'afterCreate':_0xf878('0x3'),'afterUpdate':_0xf878('0x4'),'afterDestroy':_0xf878('0x5')};function emitEvent(_0x9e6783){return function(_0x45a37b,_0x240b48,_0xcf1927){FaxInteractionEvents[_0xf878('0x6')](_0x9e6783+':'+_0x45a37b['id'],_0x45a37b);FaxInteractionEvents['emit'](_0x9e6783,_0x45a37b);_0xcf1927(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0xf878('0x7')](e,emitEvent(event));}}module[_0xf878('0x8')]=FaxInteractionEvents; \ No newline at end of file +var _0xd523=['remove','emit','exports','events','../../mysqldb','FaxInteraction','setMaxListeners','update'];(function(_0x32b5d1,_0x480340){var _0x1cb9d4=function(_0x56804a){while(--_0x56804a){_0x32b5d1['push'](_0x32b5d1['shift']());}};_0x1cb9d4(++_0x480340);}(_0xd523,0x153));var _0x3d52=function(_0xe244c8,_0x35c420){_0xe244c8=_0xe244c8-0x0;var _0x29227b=_0xd523[_0xe244c8];return _0x29227b;};'use strict';var EventEmitter=require(_0x3d52('0x0'));var FaxInteraction=require(_0x3d52('0x1'))['db'][_0x3d52('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x3d52('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3d52('0x4'),'afterDestroy':_0x3d52('0x5')};function emitEvent(_0x2752e7){return function(_0x5103d8,_0x24d3af,_0x3dfd00){FaxInteractionEvents[_0x3d52('0x6')](_0x2752e7+':'+_0x5103d8['id'],_0x5103d8);FaxInteractionEvents[_0x3d52('0x6')](_0x2752e7,_0x5103d8);_0x3dfd00(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x3d52('0x7')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 200d965..f2a75db 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 _0xd0d4=['exports','FaxInteraction','lodash','util','../../config/logger','api','moment'];(function(_0x539fd3,_0x4256a5){var _0x33339d=function(_0x40c144){while(--_0x40c144){_0x539fd3['push'](_0x539fd3['shift']());}};_0x33339d(++_0x4256a5);}(_0xd0d4,0x128));var _0x4d0d=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xd0d4[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x4d0d('0x0'));var util=require(_0x4d0d('0x1'));var logger=require(_0x4d0d('0x2'))(_0x4d0d('0x3'));var moment=require(_0x4d0d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./faxInteraction.attributes');module[_0x4d0d('0x5')]=function(_0x7ce11a,_0x61b7c0){return _0x7ce11a['define'](_0x4d0d('0x6'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadfb=['FaxInteraction','fax_interactions','lodash','util','../../config/logger','api','moment','bluebird','./faxInteraction.attributes','exports','define'];(function(_0x561771,_0x554760){var _0x54d16e=function(_0x381c1f){while(--_0x381c1f){_0x561771['push'](_0x561771['shift']());}};_0x54d16e(++_0x554760);}(_0xadfb,0x1f1));var _0xbadf=function(_0x389f76,_0x2e2239){_0x389f76=_0x389f76-0x0;var _0x2afba7=_0xadfb[_0x389f76];return _0x2afba7;};'use strict';var _=require(_0xbadf('0x0'));var util=require(_0xbadf('0x1'));var logger=require(_0xbadf('0x2'))(_0xbadf('0x3'));var moment=require(_0xbadf('0x4'));var BPromise=require(_0xbadf('0x5'));var rp=require('request-promise');var attributes=require(_0xbadf('0x6'));module[_0xbadf('0x7')]=function(_0x168a65,_0x582b44){return _0x168a65[_0xbadf('0x8')](_0xbadf('0x9'),attributes,{'tableName':_0xbadf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 9cc9463..43398bb 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 _0x88a6=['catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message'];(function(_0x4eaf92,_0x921f17){var _0x5b5dbd=function(_0x14fa28){while(--_0x14fa28){_0x4eaf92['push'](_0x4eaf92['shift']());}};_0x5b5dbd(++_0x921f17);}(_0x88a6,0x161));var _0x688a=function(_0x1bd411,_0x2b2ca2){_0x1bd411=_0x1bd411-0x0;var _0x5dcc9f=_0x88a6[_0x1bd411];return _0x5dcc9f;};'use strict';var _=require(_0x688a('0x0'));var util=require('util');var moment=require(_0x688a('0x1'));var BPromise=require(_0x688a('0x2'));var rs=require(_0x688a('0x3'));var fs=require('fs');var Redis=require(_0x688a('0x4'));var db=require(_0x688a('0x5'))['db'];var utils=require(_0x688a('0x6'));var logger=require(_0x688a('0x7'))('rpc');var config=require(_0x688a('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x688a('0x9')]({'port':0x232a});config[_0x688a('0xa')]=_['defaults'](config[_0x688a('0xa')],{'host':_0x688a('0xb'),'port':0x18eb});var socket=require(_0x688a('0xc'))(new Redis(config[_0x688a('0xa')]));require(_0x688a('0xd'))[_0x688a('0xe')](socket);function respondWithRpcPromise(_0x19b6ed,_0x47693d,_0x5cf7da){return new BPromise(function(_0x1c9915,_0x1d36c1){return client[_0x688a('0xf')](_0x19b6ed,_0x5cf7da)[_0x688a('0x10')](function(_0x382873){logger[_0x688a('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x47693d,_0x688a('0x12'));logger[_0x688a('0x13')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x47693d,'request\x20sent',JSON[_0x688a('0x14')](_0x382873));if(_0x382873[_0x688a('0x15')]){if(_0x382873[_0x688a('0x15')][_0x688a('0x16')]===0x1f4){logger[_0x688a('0x15')](_0x688a('0x17'),_0x47693d,_0x382873['error'][_0x688a('0x18')]);return _0x1d36c1(_0x382873[_0x688a('0x15')][_0x688a('0x18')]);}logger['error'](_0x688a('0x17'),_0x47693d,_0x382873[_0x688a('0x15')][_0x688a('0x18')]);return _0x1c9915(_0x382873[_0x688a('0x15')][_0x688a('0x18')]);}else{logger[_0x688a('0x11')](_0x688a('0x17'),_0x47693d,'request\x20sent');_0x1c9915(_0x382873['result'][_0x688a('0x18')]);}})[_0x688a('0x19')](function(_0x18a419){logger[_0x688a('0x15')](_0x688a('0x17'),_0x47693d,_0x18a419);_0x1d36c1(_0x18a419);});});}exports[_0x688a('0x1a')]=function(_0x4d1bc6){var _0x5a97ed=this;return new Promise(function(_0x1d350b,_0x559763){return db[_0x688a('0x1b')][_0x688a('0x1c')](_0x4d1bc6[_0x688a('0x1d')],{'raw':_0x4d1bc6[_0x688a('0x1e')]?_0x4d1bc6[_0x688a('0x1e')][_0x688a('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d1bc6[_0x688a('0x1e')]?_0x4d1bc6['options'][_0x688a('0x20')]||null:null,'attributes':_0x4d1bc6[_0x688a('0x1e')]?_0x4d1bc6[_0x688a('0x1e')][_0x688a('0x21')]||null:null,'limit':_0x4d1bc6['options']?_0x4d1bc6['options'][_0x688a('0x22')]||null:null})[_0x688a('0x10')](function(_0x20bce9){logger[_0x688a('0x11')]('UpdateFaxInteraction',_0x4d1bc6);logger['debug'](_0x688a('0x1a'),_0x4d1bc6,JSON[_0x688a('0x14')](_0x20bce9));_0x1d350b(_0x20bce9);})[_0x688a('0x19')](function(_0x36be1a){logger[_0x688a('0x15')](_0x688a('0x1a'),_0x36be1a['message'],_0x4d1bc6);_0x559763(_0x5a97ed[_0x688a('0x15')](0x1f4,_0x36be1a[_0x688a('0x18')]));});});};exports[_0x688a('0x23')]=function(_0x4780db){return new Promise(function(_0x2ec186,_0x38ca03){return db['FaxInteraction'][_0x688a('0x24')]({'where':_0x4780db[_0x688a('0x1e')]?_0x4780db[_0x688a('0x1e')]['where']||null:null})['then'](function(_0x4e0c24){if(_0x4e0c24){return _0x4e0c24[_0x688a('0x25')](_0x4780db[_0x688a('0x1d')][_0x688a('0x26')],_[_0x688a('0x27')](_0x4780db[_0x688a('0x1d')],[_0x688a('0x26'),'id'])||{});}})[_0x688a('0x28')](function(_0x3d4318){logger['info'](_0x688a('0x29'),_0x4780db);logger[_0x688a('0x13')]('AddTags',_0x4780db,JSON[_0x688a('0x14')](_0x3d4318));_0x2ec186(_0x3d4318);})['catch'](function(_0x527257){logger[_0x688a('0x15')]('AddTags',_0x527257[_0x688a('0x18')],_0x4780db);_0x38ca03(_this[_0x688a('0x15')](0x1f4,_0x527257['message']));});});}; \ No newline at end of file +var _0x5f00=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','FaxInteraction','update','body','options','raw','attributes','limit','UpdateFaxInteraction','AddTagsToFaxInteraction','find','where','addTags','ids','spread','AddTags','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x55daf2,_0x1b48de){var _0x1c8500=function(_0x4686b5){while(--_0x4686b5){_0x55daf2['push'](_0x55daf2['shift']());}};_0x1c8500(++_0x1b48de);}(_0x5f00,0x1d4));var _0x05f0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f00[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x05f0('0x0'));var util=require(_0x05f0('0x1'));var moment=require('moment');var BPromise=require(_0x05f0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x05f0('0x3'));var db=require(_0x05f0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x05f0('0x5'))(_0x05f0('0x6'));var config=require(_0x05f0('0x7'));var jayson=require(_0x05f0('0x8'));var client=jayson[_0x05f0('0x9')][_0x05f0('0xa')]({'port':0x232a});config['redis']=_[_0x05f0('0xb')](config[_0x05f0('0xc')],{'host':_0x05f0('0xd'),'port':0x18eb});var socket=require(_0x05f0('0xe'))(new Redis(config[_0x05f0('0xc')]));require(_0x05f0('0xf'))[_0x05f0('0x10')](socket);function respondWithRpcPromise(_0x150720,_0xa79ca5,_0x560b14){return new BPromise(function(_0xae9ec0,_0x134930){return client['request'](_0x150720,_0x560b14)[_0x05f0('0x11')](function(_0x15bb54){logger[_0x05f0('0x12')](_0x05f0('0x13'),_0xa79ca5,_0x05f0('0x14'));logger[_0x05f0('0x15')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0xa79ca5,_0x05f0('0x14'),JSON[_0x05f0('0x16')](_0x15bb54));if(_0x15bb54[_0x05f0('0x17')]){if(_0x15bb54['error'][_0x05f0('0x18')]===0x1f4){logger[_0x05f0('0x17')](_0x05f0('0x13'),_0xa79ca5,_0x15bb54[_0x05f0('0x17')]['message']);return _0x134930(_0x15bb54['error'][_0x05f0('0x19')]);}logger[_0x05f0('0x17')]('FaxInteraction,\x20%s,\x20%s',_0xa79ca5,_0x15bb54[_0x05f0('0x17')]['message']);return _0xae9ec0(_0x15bb54['error'][_0x05f0('0x19')]);}else{logger[_0x05f0('0x12')](_0x05f0('0x13'),_0xa79ca5,'request\x20sent');_0xae9ec0(_0x15bb54[_0x05f0('0x1a')][_0x05f0('0x19')]);}})[_0x05f0('0x1b')](function(_0x46a916){logger[_0x05f0('0x17')](_0x05f0('0x13'),_0xa79ca5,_0x46a916);_0x134930(_0x46a916);});});}exports['UpdateFaxInteraction']=function(_0x22a9e0){var _0x257aa2=this;return new Promise(function(_0x3250a9,_0x475a50){return db[_0x05f0('0x1c')][_0x05f0('0x1d')](_0x22a9e0[_0x05f0('0x1e')],{'raw':_0x22a9e0['options']?_0x22a9e0[_0x05f0('0x1f')][_0x05f0('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22a9e0[_0x05f0('0x1f')]?_0x22a9e0['options']['where']||null:null,'attributes':_0x22a9e0[_0x05f0('0x1f')]?_0x22a9e0[_0x05f0('0x1f')][_0x05f0('0x21')]||null:null,'limit':_0x22a9e0[_0x05f0('0x1f')]?_0x22a9e0[_0x05f0('0x1f')][_0x05f0('0x22')]||null:null})[_0x05f0('0x11')](function(_0xb1fa61){logger[_0x05f0('0x12')]('UpdateFaxInteraction',_0x22a9e0);logger[_0x05f0('0x15')](_0x05f0('0x23'),_0x22a9e0,JSON[_0x05f0('0x16')](_0xb1fa61));_0x3250a9(_0xb1fa61);})[_0x05f0('0x1b')](function(_0x502f82){logger['error'](_0x05f0('0x23'),_0x502f82['message'],_0x22a9e0);_0x475a50(_0x257aa2[_0x05f0('0x17')](0x1f4,_0x502f82[_0x05f0('0x19')]));});});};exports[_0x05f0('0x24')]=function(_0x2533b9){return new Promise(function(_0x39930f,_0x4c2db4){return db[_0x05f0('0x1c')][_0x05f0('0x25')]({'where':_0x2533b9[_0x05f0('0x1f')]?_0x2533b9['options'][_0x05f0('0x26')]||null:null})[_0x05f0('0x11')](function(_0xc53ced){if(_0xc53ced){return _0xc53ced[_0x05f0('0x27')](_0x2533b9['body'][_0x05f0('0x28')],_['omit'](_0x2533b9[_0x05f0('0x1e')],[_0x05f0('0x28'),'id'])||{});}})[_0x05f0('0x29')](function(_0x1077e7){logger[_0x05f0('0x12')](_0x05f0('0x2a'),_0x2533b9);logger['debug']('AddTags',_0x2533b9,JSON[_0x05f0('0x16')](_0x1077e7));_0x39930f(_0x1077e7);})[_0x05f0('0x1b')](function(_0x113a4c){logger['error'](_0x05f0('0x2a'),_0x113a4c[_0x05f0('0x19')],_0x2533b9);_0x4c2db4(_this['error'](0x1f4,_0x113a4c[_0x05f0('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 003bbb2..daa020b 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 _0xc930=['save','remove','removeListener','length','faxInteraction:','./faxInteraction.events'];(function(_0x1218e1,_0x292a4a){var _0x37cb86=function(_0x4dbaf8){while(--_0x4dbaf8){_0x1218e1['push'](_0x1218e1['shift']());}};_0x37cb86(++_0x292a4a);}(_0xc930,0x125));var _0x0c93=function(_0x596a1b,_0x53ce62){_0x596a1b=_0x596a1b-0x0;var _0x43b5fc=_0xc930[_0x596a1b];return _0x43b5fc;};'use strict';var FaxInteractionEvents=require(_0x0c93('0x0'));var events=[_0x0c93('0x1'),_0x0c93('0x2'),'update'];function createListener(_0x5423a4,_0x22df62){return function(_0x134727){_0x22df62['emit'](_0x5423a4,_0x134727);};}function removeListener(_0x2b455b,_0xdf968e){return function(){FaxInteractionEvents[_0x0c93('0x3')](_0x2b455b,_0xdf968e);};}exports['register']=function(_0x2926e8){for(var _0x1fd991=0x0,_0x57647f=events[_0x0c93('0x4')];_0x1fd991<_0x57647f;_0x1fd991++){var _0x4cd04f=events[_0x1fd991];var _0x48a852=createListener(_0x0c93('0x5')+_0x4cd04f,_0x2926e8);FaxInteractionEvents['on'](_0x4cd04f,_0x48a852);}}; \ No newline at end of file +var _0xbe5f=['register','length','save'];(function(_0x403262,_0x32670f){var _0x358b70=function(_0x6bb646){while(--_0x6bb646){_0x403262['push'](_0x403262['shift']());}};_0x358b70(++_0x32670f);}(_0xbe5f,0x164));var _0xfbe5=function(_0x5411a5,_0x30164c){_0x5411a5=_0x5411a5-0x0;var _0xc52574=_0xbe5f[_0x5411a5];return _0xc52574;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0xfbe5('0x0'),'remove','update'];function createListener(_0x3b1257,_0x95f306){return function(_0x56029f){_0x95f306['emit'](_0x3b1257,_0x56029f);};}function removeListener(_0x4716e8,_0xc1980){return function(){FaxInteractionEvents['removeListener'](_0x4716e8,_0xc1980);};}exports[_0xfbe5('0x1')]=function(_0x42f92c){for(var _0x373f99=0x0,_0x210964=events[_0xfbe5('0x2')];_0x373f99<_0x210964;_0x373f99++){var _0x3b02cc=events[_0x373f99];var _0x7b6495=createListener('faxInteraction:'+_0x3b02cc,_0x42f92c);FaxInteractionEvents['on'](_0x3b02cc,_0x7b6495);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 32de104..e1c76f9 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 _0x242b=['addTags','faxinteraction:update','update','destroy','delete','removeTags','exports','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','describe','/:id','show','getMessages','/:id/download','post','create','/:id/tags','tracked','fax','faxinteraction:addtags'];(function(_0x5d7500,_0x2245bf){var _0x41de41=function(_0x2485f7){while(--_0x2485f7){_0x5d7500['push'](_0x5d7500['shift']());}};_0x41de41(++_0x2245bf);}(_0x242b,0x1ea));var _0xb242=function(_0x5837e7,_0x35de4f){_0x5837e7=_0x5837e7-0x0;var _0x537783=_0x242b[_0x5837e7];return _0x537783;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb242('0x0')]();var auth=require(_0xb242('0x1'));var interaction=require(_0xb242('0x2'));var config=require('../../config/environment');var controller=require('./faxInteraction.controller');router[_0xb242('0x3')]('/',auth[_0xb242('0x4')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xb242('0x5')]);router[_0xb242('0x3')](_0xb242('0x6'),auth[_0xb242('0x4')](),controller[_0xb242('0x7')]);router[_0xb242('0x3')]('/:id/messages',auth[_0xb242('0x4')](),controller[_0xb242('0x8')]);router['get'](_0xb242('0x9'),auth[_0xb242('0x4')](),controller['download']);router[_0xb242('0xa')]('/',auth[_0xb242('0x4')](),controller[_0xb242('0xb')]);router[_0xb242('0xa')]('/:id/messages',auth[_0xb242('0x4')](),controller['addMessage']);router[_0xb242('0xa')](_0xb242('0xc'),auth[_0xb242('0x4')](),interaction[_0xb242('0xd')](_0xb242('0xe'),_0xb242('0xf')),controller[_0xb242('0x10')]);router['put'](_0xb242('0x6'),auth[_0xb242('0x4')](),interaction[_0xb242('0xd')](_0xb242('0xe'),_0xb242('0x11')),controller[_0xb242('0x12')]);router['delete'](_0xb242('0x6'),auth['isAuthenticated'](),interaction['tracked']('fax','faxinteraction:destroy'),controller[_0xb242('0x13')]);router[_0xb242('0x14')](_0xb242('0xc'),auth['isAuthenticated'](),controller[_0xb242('0x15')]);module[_0xb242('0x16')]=router; \ No newline at end of file +var _0x72d0=['faxinteraction:destroy','removeTags','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','addTags','put','/:id','tracked','fax','delete'];(function(_0x7fc6c4,_0x35a4a2){var _0x42e491=function(_0x32d5a8){while(--_0x32d5a8){_0x7fc6c4['push'](_0x7fc6c4['shift']());}};_0x42e491(++_0x35a4a2);}(_0x72d0,0x1c5));var _0x072d=function(_0xc1a4cf,_0x17141b){_0xc1a4cf=_0xc1a4cf-0x0;var _0x2930d1=_0x72d0[_0xc1a4cf];return _0x2930d1;};'use strict';var multer=require(_0x072d('0x0'));var util=require('util');var path=require(_0x072d('0x1'));var timeout=require(_0x072d('0x2'));var express=require('express');var router=express[_0x072d('0x3')]();var auth=require(_0x072d('0x4'));var interaction=require(_0x072d('0x5'));var config=require('../../config/environment');var controller=require(_0x072d('0x6'));router[_0x072d('0x7')]('/',auth[_0x072d('0x8')](),controller[_0x072d('0x9')]);router[_0x072d('0x7')](_0x072d('0xa'),auth['isAuthenticated'](),controller[_0x072d('0xb')]);router['get']('/:id',auth[_0x072d('0x8')](),controller[_0x072d('0xc')]);router[_0x072d('0x7')](_0x072d('0xd'),auth[_0x072d('0x8')](),controller[_0x072d('0xe')]);router[_0x072d('0x7')](_0x072d('0xf'),auth['isAuthenticated'](),controller[_0x072d('0x10')]);router[_0x072d('0x11')]('/',auth[_0x072d('0x8')](),controller[_0x072d('0x12')]);router['post'](_0x072d('0xd'),auth['isAuthenticated'](),controller[_0x072d('0x13')]);router[_0x072d('0x11')](_0x072d('0x14'),auth[_0x072d('0x8')](),interaction['tracked']('fax','faxinteraction:addtags'),controller[_0x072d('0x15')]);router[_0x072d('0x16')](_0x072d('0x17'),auth[_0x072d('0x8')](),interaction[_0x072d('0x18')](_0x072d('0x19'),'faxinteraction:update'),controller['update']);router[_0x072d('0x1a')](_0x072d('0x17'),auth[_0x072d('0x8')](),interaction[_0x072d('0x18')](_0x072d('0x19'),_0x072d('0x1b')),controller['destroy']);router['delete'](_0x072d('0x14'),auth[_0x072d('0x8')](),controller[_0x072d('0x1c')]);module[_0x072d('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 22c9995..817f3ae 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 _0x3a57=['BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT','medium'];(function(_0x219e9b,_0x295d91){var _0x332e80=function(_0x567792){while(--_0x567792){_0x219e9b['push'](_0x219e9b['shift']());}};_0x332e80(++_0x295d91);}(_0x3a57,0xfc));var _0x73a5=function(_0x2e9a56,_0x16fb93){_0x2e9a56=_0x2e9a56-0x0;var _0x10c96b=_0x3a57[_0x2e9a56];return _0x10c96b;};'use strict';var Sequelize=require(_0x73a5('0x0'));module[_0x73a5('0x1')]={'body':{'type':Sequelize[_0x73a5('0x2')](_0x73a5('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x73a5('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x73a5('0x5')]('in',_0x73a5('0x6')),'defaultValue':_0x73a5('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x73a5('0x7')]}}; \ No newline at end of file +var _0xbbcf=['out','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x40fdca,_0x2fe232){var _0x1858da=function(_0x8f15b1){while(--_0x8f15b1){_0x40fdca['push'](_0x40fdca['shift']());}};_0x1858da(++_0x2fe232);}(_0xbbcf,0x121));var _0xfbbc=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xbbcf[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0xfbbc('0x0'));module[_0xfbbc('0x1')]={'body':{'type':Sequelize[_0xfbbc('0x2')](_0xfbbc('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xfbbc('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xfbbc('0x5')),'defaultValue':_0xfbbc('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xfbbc('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xfbbc('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 924fe9a..85810ac 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 _0x6189=['name','send','index','FaxMessage','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','add','merge','filter','map','findAll','show','params','includeAll','include','options','find','body','destroy','describe','../../config/logger','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','FaxInteractionId','read1stAt','get','user','role','interaction','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','fax','agent','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','reject','rejectmessage','create','findOne','ContactId','isNil','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','join','root','server','files','attachments','download','basename','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','desk.js','querystring','api','../../config/utils','../../config/environment','defaults','localhost','socket.io-emitter','redis','register','jayson/promise','client','http','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','end','json','count','offset','limit','set','Content-Range','save','update','sendStatus'];(function(_0x5ce105,_0x34f3ce){var _0x33d030=function(_0x3e64ef){while(--_0x3e64ef){_0x5ce105['push'](_0x5ce105['shift']());}};_0x33d030(++_0x34f3ce);}(_0x6189,0x1dc));var _0x9618=function(_0x13b045,_0x25daad){_0x13b045=_0x13b045-0x0;var _0x59b0f0=_0x6189[_0x13b045];return _0x59b0f0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9618('0x0'));var rimraf=require(_0x9618('0x1'));var zipdir=require(_0x9618('0x2'));var jsonpatch=require(_0x9618('0x3'));var rp=require(_0x9618('0x4'));var moment=require(_0x9618('0x5'));var BPromise=require(_0x9618('0x6'));var Mustache=require(_0x9618('0x7'));var util=require(_0x9618('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x9618('0x9'));var ejs=require(_0x9618('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9618('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9618('0xc'));var toCsv=require(_0x9618('0x9'));var querystring=require(_0x9618('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x9618('0xe'));var utils=require(_0x9618('0xf'));var config=require(_0x9618('0x10'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x9618('0x11')](config['redis'],{'host':_0x9618('0x12'),'port':0x18eb});var socket=require(_0x9618('0x13'))(new Redis(config[_0x9618('0x14')]));require('./faxMessage.socket')[_0x9618('0x15')](socket);var jayson=require(_0x9618('0x16'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x9618('0x17')][_0x9618('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x99cf22,_0x370b74,_0x22e733,_0x3cb76b){return new BPromise(function(_0x48eb2b,_0x9da2b7){var _0x12ab5e=_0x3cb76b||client;return _0x12ab5e['request'](_0x99cf22,_0x22e733)[_0x9618('0x19')](function(_0x5766f9){logger['info'](_0x9618('0x1a'),_0x370b74,_0x9618('0x1b'));logger[_0x9618('0x1c')](_0x9618('0x1d'),_0x370b74,'request\x20sent',JSON[_0x9618('0x1e')](_0x5766f9));if(_0x5766f9['error']){if(_0x5766f9[_0x9618('0x1f')][_0x9618('0x20')]===0x1f4){logger[_0x9618('0x1f')](_0x9618('0x1a'),_0x370b74,_0x5766f9['error'][_0x9618('0x21')]);return _0x9da2b7(_0x5766f9['error']['message']);}logger[_0x9618('0x1f')](_0x9618('0x1a'),_0x370b74,_0x5766f9[_0x9618('0x1f')][_0x9618('0x21')]);return _0x48eb2b(_0x5766f9['error'][_0x9618('0x21')]);}else{logger[_0x9618('0x22')](_0x9618('0x1a'),_0x370b74,'request\x20sent');_0x48eb2b(_0x5766f9[_0x9618('0x23')][_0x9618('0x21')]);}})[_0x9618('0x24')](function(_0x96cfcd){logger['error'](_0x9618('0x1a'),_0x370b74,_0x96cfcd);_0x9da2b7(_0x96cfcd);});});}function respondWithStatusCode(_0xbbab8e,_0x7a8faa){_0x7a8faa=_0x7a8faa||0xcc;return function(_0x306cb9){if(_0x306cb9){return _0xbbab8e['sendStatus'](_0x7a8faa);}return _0xbbab8e[_0x9618('0x25')](_0x7a8faa)[_0x9618('0x26')]();};}function respondWithResult(_0x4dc1fc,_0x489c17){_0x489c17=_0x489c17||0xc8;return function(_0x326585){if(_0x326585){return _0x4dc1fc[_0x9618('0x25')](_0x489c17)[_0x9618('0x27')](_0x326585);}};}function respondWithFilteredResult(_0x4c887a,_0x256242){return function(_0x4c05d8){if(_0x4c05d8){var _0x5be10c=_0x4c05d8[_0x9618('0x28')],_0x360a82=_0x256242[_0x9618('0x29')],_0x3d70ea=_0x256242[_0x9618('0x29')]+_0x256242[_0x9618('0x2a')],_0x3503c7;if(_0x3d70ea>=_0x5be10c){_0x3d70ea=_0x5be10c;_0x3503c7=0xc8;}else{_0x3503c7=0xce;}_0x4c887a['status'](_0x3503c7);return _0x4c887a[_0x9618('0x2b')](_0x9618('0x2c'),_0x360a82+'-'+_0x3d70ea+'/'+_0x5be10c)['json'](_0x4c05d8);}return null;};}function patchUpdates(_0xec0809){return function(_0x21ce0b){try{jsonpatch['apply'](_0x21ce0b,_0xec0809,!![]);}catch(_0xc21fe4){return BPromise['reject'](_0xc21fe4);}return _0x21ce0b[_0x9618('0x2d')]();};}function saveUpdates(_0x5dd89e,_0x132ca0){return function(_0x5b37eb){if(_0x5b37eb){return _0x5b37eb[_0x9618('0x2e')](_0x5dd89e)[_0x9618('0x19')](function(_0x36c3c6){return _0x36c3c6;});}return null;};}function removeEntity(_0x2bce5b,_0x28d03f){return function(_0x2a9345){if(_0x2a9345){return _0x2a9345['destroy']()[_0x9618('0x19')](function(){_0x2bce5b[_0x9618('0x25')](0xcc)[_0x9618('0x26')]();});}};}function handleEntityNotFound(_0x43464a,_0x5032b8){return function(_0x2267c6){if(!_0x2267c6){_0x43464a[_0x9618('0x2f')](0x194);}return _0x2267c6;};}function handleError(_0x4afb21,_0x4908aa){_0x4908aa=_0x4908aa||0x1f4;return function(_0x3b2168){logger[_0x9618('0x1f')](_0x3b2168['stack']);if(_0x3b2168[_0x9618('0x30')]){delete _0x3b2168[_0x9618('0x30')];}_0x4afb21[_0x9618('0x25')](_0x4908aa)[_0x9618('0x31')](_0x3b2168);};}exports[_0x9618('0x32')]=function(_0x557586,_0x120a05){var _0xb1d80e={},_0x11e039={},_0x10060a={'count':0x0,'rows':[]};var _0x1d0d6e=db[_0x9618('0x33')]['rawAttributes'];_0x11e039['model']=_[_0x9618('0x34')](_0x1d0d6e);var _0x3def5c={'dateStart':_0x557586[_0x9618('0x35')][_0x9618('0x36')],'dateEnd':_0x557586['query'][_0x9618('0x37')]};delete _0x557586[_0x9618('0x35')][_0x9618('0x36')];delete _0x557586[_0x9618('0x35')][_0x9618('0x37')];_0x11e039[_0x9618('0x35')]=_['keys'](_0x557586[_0x9618('0x35')]);_0x11e039[_0x9618('0x38')]=_[_0x9618('0x39')](_0x11e039['model'],_0x11e039['query']);_0xb1d80e[_0x9618('0x3a')]=_[_0x9618('0x39')](_0x11e039['model'],qs[_0x9618('0x3b')](_0x557586[_0x9618('0x35')]['fields']));_0xb1d80e[_0x9618('0x3a')]=_0xb1d80e[_0x9618('0x3a')][_0x9618('0x3c')]?_0xb1d80e[_0x9618('0x3a')]:_0x11e039[_0x9618('0x3d')];if(!_0x557586[_0x9618('0x35')][_0x9618('0x3e')](_0x9618('0x3f'))){_0xb1d80e[_0x9618('0x2a')]=qs[_0x9618('0x2a')](_0x557586[_0x9618('0x35')][_0x9618('0x2a')]);_0xb1d80e['offset']=qs[_0x9618('0x29')](_0x557586[_0x9618('0x35')][_0x9618('0x29')]);}_0xb1d80e[_0x9618('0x40')]=qs[_0x9618('0x41')](_0x557586[_0x9618('0x35')][_0x9618('0x41')]);_0xb1d80e[_0x9618('0x42')]=qs[_0x9618('0x38')](_[_0x9618('0x43')](_0x557586['query'],_0x11e039[_0x9618('0x38')]));if(_0x3def5c[_0x9618('0x36')]){if(_0x3def5c[_0x9618('0x37')]){_0x3def5c[_0x9618('0x37')]=moment(_0x3def5c['dateEnd'])[_0x9618('0x44')](0x1,'day');}else{_0x3def5c[_0x9618('0x37')]=moment(_0x3def5c[_0x9618('0x36')])[_0x9618('0x44')](0x1,'day');}_[_0x9618('0x45')](_0xb1d80e['where'],{'createdAt':{'$gte':_0x3def5c[_0x9618('0x36')],'$lte':_0x3def5c[_0x9618('0x37')]}});}if(_0x557586[_0x9618('0x35')][_0x9618('0x46')]){_0xb1d80e['where']=_[_0x9618('0x45')](_0xb1d80e[_0x9618('0x42')],{'$or':_[_0x9618('0x47')](_0xb1d80e['attributes'],function(_0xc6339b){var _0x32517d={};_0x32517d[_0xc6339b]={'$like':'%'+_0x557586[_0x9618('0x35')][_0x9618('0x46')]+'%'};return _0x32517d;})});}_0xb1d80e=_[_0x9618('0x45')]({},_0xb1d80e,_0x557586['options']);var _0x47896d={'where':_0xb1d80e['where']};return db[_0x9618('0x33')][_0x9618('0x28')](_0x47896d)[_0x9618('0x19')](function(_0xef737){_0x10060a[_0x9618('0x28')]=_0xef737;if(_0x557586[_0x9618('0x35')]['includeAll']){_0xb1d80e['include']=[{'all':!![]}];}return db['FaxMessage'][_0x9618('0x48')](_0xb1d80e);})[_0x9618('0x19')](function(_0x62d333){_0x10060a['rows']=_0x62d333;return _0x10060a;})[_0x9618('0x19')](respondWithFilteredResult(_0x120a05,_0xb1d80e))[_0x9618('0x24')](handleError(_0x120a05,null));};exports[_0x9618('0x49')]=function(_0x5a5bec,_0x2a3bfa){var _0x38d8e5={'raw':!![],'where':{'id':_0x5a5bec[_0x9618('0x4a')]['id']}},_0x4592d4={};_0x4592d4['model']=_[_0x9618('0x34')](db[_0x9618('0x33')]['rawAttributes']);_0x4592d4['query']=_[_0x9618('0x34')](_0x5a5bec[_0x9618('0x35')]);_0x4592d4[_0x9618('0x38')]=_['intersection'](_0x4592d4[_0x9618('0x3d')],_0x4592d4[_0x9618('0x35')]);_0x38d8e5[_0x9618('0x3a')]=_['intersection'](_0x4592d4[_0x9618('0x3d')],qs[_0x9618('0x3b')](_0x5a5bec[_0x9618('0x35')][_0x9618('0x3b')]));_0x38d8e5[_0x9618('0x3a')]=_0x38d8e5[_0x9618('0x3a')]['length']?_0x38d8e5[_0x9618('0x3a')]:_0x4592d4['model'];if(_0x5a5bec['query'][_0x9618('0x4b')]){_0x38d8e5[_0x9618('0x4c')]=[{'all':!![]}];}_0x38d8e5=_[_0x9618('0x45')]({},_0x38d8e5,_0x5a5bec[_0x9618('0x4d')]);return db[_0x9618('0x33')][_0x9618('0x4e')](_0x38d8e5)[_0x9618('0x19')](handleEntityNotFound(_0x2a3bfa,null))['then'](respondWithResult(_0x2a3bfa,null))[_0x9618('0x24')](handleError(_0x2a3bfa,null));};exports[_0x9618('0x2e')]=function(_0x3d53cb,_0xae2b31){if(_0x3d53cb[_0x9618('0x4f')]['id']){delete _0x3d53cb[_0x9618('0x4f')]['id'];}return db['FaxMessage'][_0x9618('0x4e')]({'where':{'id':_0x3d53cb[_0x9618('0x4a')]['id']}})[_0x9618('0x19')](handleEntityNotFound(_0xae2b31,null))['then'](saveUpdates(_0x3d53cb['body'],null))['then'](respondWithResult(_0xae2b31,null))[_0x9618('0x24')](handleError(_0xae2b31,null));};exports[_0x9618('0x50')]=function(_0x4d7f95,_0x8e0e14){return db['FaxMessage'][_0x9618('0x4e')]({'where':{'id':_0x4d7f95[_0x9618('0x4a')]['id']}})['then'](handleEntityNotFound(_0x8e0e14,null))[_0x9618('0x19')](removeEntity(_0x8e0e14,null))['catch'](handleError(_0x8e0e14,null));};exports[_0x9618('0x51')]=function(_0x3cb654,_0x232d01){return db[_0x9618('0x33')][_0x9618('0x51')]()[_0x9618('0x19')](respondWithResult(_0x232d01,null))[_0x9618('0x24')](handleError(_0x232d01,null));};var interaction_log=require(_0x9618('0x52'))('fax-interactions');exports[_0x9618('0x53')]=function(_0x49a01b,_0x1993f8,_0x27cd79){var _0x3e27c8={'channel':'fax'};if(_0x49a01b[_0x9618('0x4f')]['id']){delete _0x49a01b['body']['id'];}_0x49a01b[_0x9618('0x4f')][_0x9618('0x54')]=!![];_0x49a01b[_0x9618('0x4f')][_0x9618('0x55')]=moment()[_0x9618('0x56')](_0x9618('0x57'));_0x49a01b[_0x9618('0x4f')]['UserId']=_0x49a01b['body'][_0x9618('0x58')]||_0x49a01b['user']['id'];return db[_0x9618('0x33')][_0x9618('0x4e')]({'where':{'id':_0x49a01b[_0x9618('0x4a')]['id'],'UserId':null},'include':[{'model':db[_0x9618('0x59')],'as':_0x9618('0x5a')}]})[_0x9618('0x19')](handleEntityNotFound(_0x1993f8,null))['then'](saveUpdates(_0x49a01b[_0x9618('0x4f')],null))[_0x9618('0x19')](function(_0xb2c72c){if(_0xb2c72c){_0x3e27c8[_0x9618('0x21')]=_0xb2c72c['get']({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0xb2c72c[_0x9618('0x5b')]}});}return null;})[_0x9618('0x19')](handleEntityNotFound(_0x1993f8,null))['then'](function(_0x67e3c6){if(_0x67e3c6){return _0x67e3c6['update']({'UserId':_0x49a01b[_0x9618('0x4f')]['UserId'],'read1stAt':_['isNil'](_0x67e3c6[_0x9618('0x5c')])?moment()[_0x9618('0x56')](_0x9618('0x57')):undefined});}return null;})[_0x9618('0x19')](function(_0x2464c2){if(_0x2464c2){_0x3e27c8['interaction']=_0x2464c2[_0x9618('0x5d')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x49a01b[_0x9618('0x5e')]['id'],_0x49a01b[_0x9618('0x5e')][_0x9618('0x30')],_0x49a01b['user'][_0x9618('0x5f')],_0x3e27c8[_0x9618('0x60')]['id'],_0x49a01b[_0x9618('0x4f')]?JSON[_0x9618('0x1e')](_0x49a01b[_0x9618('0x4f')]):_0x9618('0x61'));return respondWithRpcPromise(_0x9618('0x62'),_0x9618('0x63'),_0x3e27c8);}return null;})[_0x9618('0x19')](function(_0x1cc3ba){if(_0x1cc3ba){if(_0x49a01b[_0x9618('0x4f')][_0x9618('0x64')]){_0x3e27c8[_0x9618('0x21')][_0x9618('0x65')]=util['format'](_0x9618('0x66'),_0x49a01b[_0x9618('0x5e')][_0x9618('0x30')]);_0x3e27c8['message'][_0x9618('0x67')]=_0x3e27c8[_0x9618('0x67')];_0x3e27c8['message'][_0x9618('0x68')]=_0x9618('0x53');return respondWithRpcPromise(_0x9618('0x69'),'EventManager',{'event':_0x9618('0x6a'),'message':_0x3e27c8['message']},client9002)['then'](function(){return _0x3e27c8;});}return _0x3e27c8;}return null;})[_0x9618('0x19')](respondWithResult(_0x1993f8,null))[_0x9618('0x24')](handleError(_0x1993f8,null));};var interaction_log=require(_0x9618('0x52'))('fax-interactions');exports['reject']=function(_0x5b0c2c,_0x4dc9be,_0x4ab6a4){var _0x4b4cb8={'agent':{},'channel':_0x9618('0x6b')};if(_0x5b0c2c[_0x9618('0x4f')]['id']){delete _0x5b0c2c[_0x9618('0x4f')]['id'];}_0x5b0c2c[_0x9618('0x4f')][_0x9618('0x58')]=_0x5b0c2c[_0x9618('0x4f')]['UserId']||_0x5b0c2c[_0x9618('0x5e')]['id'];_0x4b4cb8[_0x9618('0x6c')]['id']=_0x5b0c2c[_0x9618('0x4f')][_0x9618('0x58')];return db[_0x9618('0x33')][_0x9618('0x4e')]({'where':{'id':_0x5b0c2c[_0x9618('0x4a')]['id'],'UserId':null}})[_0x9618('0x19')](handleEntityNotFound(_0x4dc9be,null))[_0x9618('0x19')](function(_0x5ac892){if(_0x5ac892){_0x4b4cb8['message']=_0x5ac892[_0x9618('0x5d')]({'plain':!![]});return db[_0x9618('0x6d')][_0x9618('0x4e')]({'where':{'id':_0x5ac892['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4dc9be,null))[_0x9618('0x19')](function(_0x11560b){if(_0x11560b){_0x4b4cb8[_0x9618('0x60')]=_0x11560b[_0x9618('0x5d')]({'plain':!![]});interaction_log[_0x9618('0x22')](_0x9618('0x6e'),_0x5b0c2c[_0x9618('0x5e')]['id'],_0x5b0c2c[_0x9618('0x5e')][_0x9618('0x30')],_0x5b0c2c[_0x9618('0x5e')][_0x9618('0x5f')],_0x4b4cb8[_0x9618('0x60')]['id'],_0x5b0c2c[_0x9618('0x4f')]?JSON[_0x9618('0x1e')](_0x5b0c2c['body']):_0x9618('0x61'));return respondWithRpcPromise(_0x9618('0x6f'),_0x9618('0x70'),_0x4b4cb8);}return null;})['then'](function(_0x30153e){if(_0x30153e){_0x30153e[_0x9618('0x21')][_0x9618('0x65')]=util[_0x9618('0x56')](_0x9618('0x66'),_0x5b0c2c[_0x9618('0x5e')]['name']);_0x30153e['message'][_0x9618('0x67')]=_0x4b4cb8[_0x9618('0x67')];_0x30153e[_0x9618('0x21')][_0x9618('0x68')]=_0x9618('0x71');respondWithRpcPromise(_0x9618('0x69'),_0x9618('0x69'),{'event':_0x9618('0x72'),'message':_0x30153e['message']},client9002);return _0x4b4cb8;}return null;})['then'](respondWithResult(_0x4dc9be,null))['catch'](handleError(_0x4dc9be,null));};exports['create']=function(_0x27048c,_0x2f8155){var _0x2466ae;return db[_0x9618('0x33')][_0x9618('0x73')](_0x27048c[_0x9618('0x4f')],{})[_0x9618('0x19')](function(_0x12a819){_0x2466ae=_0x12a819;return db['CmContact'][_0x9618('0x74')]({'where':{'id':_0x2466ae[_0x9618('0x75')]}});})[_0x9618('0x19')](function(_0x5f3589){if(_[_0x9618('0x76')](_0x5f3589)){return;}else{_0x2466ae[_0x9618('0x6b')]=_0x5f3589[_0x9618('0x6b')];return db[_0x9618('0x77')][_0x9618('0x74')]({'where':{'id':_0x2466ae[_0x9618('0x78')]}});}})['then'](function(_0x5d4ea2){return respondWithRpcPromise(_0x9618('0x79'),_0x9618('0x79'),{'FaxAccountId':_[_0x9618('0x76')](_0x27048c[_0x9618('0x4f')])?undefined:_0x27048c[_0x9618('0x4f')][_0x9618('0x7a')],'path':_['isNil'](_0x5d4ea2)?undefined:util[_0x9618('0x56')](_0x9618('0x7b'),_0x5d4ea2['basename']),'fax':_[_0x9618('0x76')](_0x2466ae[_0x9618('0x6b')])?undefined:_0x2466ae[_0x9618('0x6b')],'AttachmentId':_0x2466ae[_0x9618('0x78')]},client9002);})['then'](respondWithResult(_0x2f8155,0xc9))[_0x9618('0x24')](handleError(_0x2f8155,null));};exports['download']=function(_0x272c67,_0x3b7b99){var _0x35319a=path[_0x9618('0x7c')](config[_0x9618('0x7d')],_0x9618('0x7e'),_0x9618('0x7f'),_0x9618('0x80'));return db[_0x9618('0x33')]['find']({'where':{'id':_0x272c67['params']['id']},'include':[{'model':db[_0x9618('0x77')],'as':'Attachment'}]})[_0x9618('0x19')](handleEntityNotFound(_0x3b7b99,null))['then'](function(_0x54e5f3){if(_0x54e5f3){return _0x3b7b99[_0x9618('0x81')](path[_0x9618('0x7c')](_0x35319a,_0x54e5f3[_0x9618('0x77')][_0x9618('0x82')]));}})['catch'](handleError(_0x3b7b99,null));}; \ No newline at end of file +var _0xc951=['to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','end','json','count','offset','limit','status','set','save','destroy','name','send','index','model','query','dateEnd','dateStart','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','add','day','merge','where','filter','map','options','FaxMessage','includeAll','include','findAll','rows','catch','rawAttributes','update','body','find','params','describe','fax-interactions','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteraction','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','reject','fax','agent','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','create','CmContact','findOne','ContactId','Attachment','AttachmentId','SendFax','FaxAccountId','basename','download','root','server','files','join','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox'];(function(_0x4362f4,_0xcd2f9b){var _0x21b110=function(_0x31a6ca){while(--_0x31a6ca){_0x4362f4['push'](_0x4362f4['shift']());}};_0x21b110(++_0xcd2f9b);}(_0xc951,0x181));var _0x1c95=function(_0x2840d7,_0x31c36e){_0x2840d7=_0x2840d7-0x0;var _0xd04285=_0xc951[_0x2840d7];return _0xd04285;};'use strict';var pdf=require(_0x1c95('0x0'));var emlformat=require(_0x1c95('0x1'));var rimraf=require(_0x1c95('0x2'));var zipdir=require(_0x1c95('0x3'));var jsonpatch=require(_0x1c95('0x4'));var rp=require(_0x1c95('0x5'));var moment=require(_0x1c95('0x6'));var BPromise=require(_0x1c95('0x7'));var Mustache=require(_0x1c95('0x8'));var util=require('util');var path=require(_0x1c95('0x9'));var sox=require(_0x1c95('0xa'));var csv=require(_0x1c95('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1c95('0xc'));var squel=require('squel');var crypto=require(_0x1c95('0xd'));var jsforce=require(_0x1c95('0xe'));var deskjs=require(_0x1c95('0xf'));var toCsv=require(_0x1c95('0xb'));var querystring=require(_0x1c95('0x10'));var Papa=require(_0x1c95('0x11'));var Redis=require(_0x1c95('0x12'));var qs=require(_0x1c95('0x13'));var logger=require(_0x1c95('0x14'))(_0x1c95('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x1c95('0x16'))['db'];config[_0x1c95('0x17')]=_[_0x1c95('0x18')](config[_0x1c95('0x17')],{'host':_0x1c95('0x19'),'port':0x18eb});var socket=require(_0x1c95('0x1a'))(new Redis(config[_0x1c95('0x17')]));require(_0x1c95('0x1b'))[_0x1c95('0x1c')](socket);var jayson=require(_0x1c95('0x1d'));var client=jayson[_0x1c95('0x1e')][_0x1c95('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x1c95('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2448d0,_0x20fe83,_0x540b2d,_0x4006d6){return new BPromise(function(_0x313bc2,_0x557c37){var _0x1444f5=_0x4006d6||client;return _0x1444f5[_0x1c95('0x20')](_0x2448d0,_0x540b2d)[_0x1c95('0x21')](function(_0xb5d294){logger[_0x1c95('0x22')](_0x1c95('0x23'),_0x20fe83,_0x1c95('0x24'));logger[_0x1c95('0x25')](_0x1c95('0x26'),_0x20fe83,'request\x20sent',JSON[_0x1c95('0x27')](_0xb5d294));if(_0xb5d294[_0x1c95('0x28')]){if(_0xb5d294[_0x1c95('0x28')]['code']===0x1f4){logger[_0x1c95('0x28')](_0x1c95('0x23'),_0x20fe83,_0xb5d294[_0x1c95('0x28')]['message']);return _0x557c37(_0xb5d294['error'][_0x1c95('0x29')]);}logger[_0x1c95('0x28')]('FaxMessage,\x20%s,\x20%s',_0x20fe83,_0xb5d294['error'][_0x1c95('0x29')]);return _0x313bc2(_0xb5d294[_0x1c95('0x28')][_0x1c95('0x29')]);}else{logger[_0x1c95('0x22')]('FaxMessage,\x20%s,\x20%s',_0x20fe83,_0x1c95('0x24'));_0x313bc2(_0xb5d294['result']['message']);}})['catch'](function(_0x1d4b3d){logger[_0x1c95('0x28')](_0x1c95('0x23'),_0x20fe83,_0x1d4b3d);_0x557c37(_0x1d4b3d);});});}function respondWithStatusCode(_0x154236,_0xe2c8a9){_0xe2c8a9=_0xe2c8a9||0xcc;return function(_0x1fa033){if(_0x1fa033){return _0x154236[_0x1c95('0x2a')](_0xe2c8a9);}return _0x154236['status'](_0xe2c8a9)[_0x1c95('0x2b')]();};}function respondWithResult(_0x55e3ea,_0x24c13c){_0x24c13c=_0x24c13c||0xc8;return function(_0xd0d3e5){if(_0xd0d3e5){return _0x55e3ea['status'](_0x24c13c)[_0x1c95('0x2c')](_0xd0d3e5);}};}function respondWithFilteredResult(_0x3e6e81,_0x4f951f){return function(_0x55948f){if(_0x55948f){var _0x213cce=_0x55948f[_0x1c95('0x2d')],_0x92138a=_0x4f951f['offset'],_0x2b551a=_0x4f951f[_0x1c95('0x2e')]+_0x4f951f[_0x1c95('0x2f')],_0x1695b6;if(_0x2b551a>=_0x213cce){_0x2b551a=_0x213cce;_0x1695b6=0xc8;}else{_0x1695b6=0xce;}_0x3e6e81[_0x1c95('0x30')](_0x1695b6);return _0x3e6e81[_0x1c95('0x31')]('Content-Range',_0x92138a+'-'+_0x2b551a+'/'+_0x213cce)[_0x1c95('0x2c')](_0x55948f);}return null;};}function patchUpdates(_0x594d93){return function(_0x5e7a10){try{jsonpatch['apply'](_0x5e7a10,_0x594d93,!![]);}catch(_0xc7f3b3){return BPromise['reject'](_0xc7f3b3);}return _0x5e7a10[_0x1c95('0x32')]();};}function saveUpdates(_0x4a6408,_0x2c604f){return function(_0x5664ad){if(_0x5664ad){return _0x5664ad['update'](_0x4a6408)[_0x1c95('0x21')](function(_0x5454bb){return _0x5454bb;});}return null;};}function removeEntity(_0x120ace,_0x247f18){return function(_0x494ed8){if(_0x494ed8){return _0x494ed8[_0x1c95('0x33')]()[_0x1c95('0x21')](function(){_0x120ace['status'](0xcc)[_0x1c95('0x2b')]();});}};}function handleEntityNotFound(_0x46b769,_0xc6a79){return function(_0x4ecfac){if(!_0x4ecfac){_0x46b769['sendStatus'](0x194);}return _0x4ecfac;};}function handleError(_0x210b39,_0x3c871b){_0x3c871b=_0x3c871b||0x1f4;return function(_0x184ac7){logger[_0x1c95('0x28')](_0x184ac7['stack']);if(_0x184ac7[_0x1c95('0x34')]){delete _0x184ac7[_0x1c95('0x34')];}_0x210b39[_0x1c95('0x30')](_0x3c871b)[_0x1c95('0x35')](_0x184ac7);};}exports[_0x1c95('0x36')]=function(_0x58b4a3,_0x254305){var _0x29aab3={},_0xf5827f={},_0x5add0d={'count':0x0,'rows':[]};var _0x3c8c5a=db['FaxMessage']['rawAttributes'];_0xf5827f[_0x1c95('0x37')]=_['keys'](_0x3c8c5a);var _0x46679d={'dateStart':_0x58b4a3[_0x1c95('0x38')]['dateStart'],'dateEnd':_0x58b4a3['query'][_0x1c95('0x39')]};delete _0x58b4a3[_0x1c95('0x38')][_0x1c95('0x3a')];delete _0x58b4a3['query'][_0x1c95('0x39')];_0xf5827f[_0x1c95('0x38')]=_[_0x1c95('0x3b')](_0x58b4a3[_0x1c95('0x38')]);_0xf5827f[_0x1c95('0x3c')]=_[_0x1c95('0x3d')](_0xf5827f['model'],_0xf5827f[_0x1c95('0x38')]);_0x29aab3[_0x1c95('0x3e')]=_['intersection'](_0xf5827f[_0x1c95('0x37')],qs[_0x1c95('0x3f')](_0x58b4a3[_0x1c95('0x38')][_0x1c95('0x3f')]));_0x29aab3[_0x1c95('0x3e')]=_0x29aab3['attributes']['length']?_0x29aab3[_0x1c95('0x3e')]:_0xf5827f[_0x1c95('0x37')];if(!_0x58b4a3[_0x1c95('0x38')][_0x1c95('0x40')](_0x1c95('0x41'))){_0x29aab3['limit']=qs['limit'](_0x58b4a3['query'][_0x1c95('0x2f')]);_0x29aab3[_0x1c95('0x2e')]=qs[_0x1c95('0x2e')](_0x58b4a3['query'][_0x1c95('0x2e')]);}_0x29aab3['order']=qs['sort'](_0x58b4a3[_0x1c95('0x38')][_0x1c95('0x42')]);_0x29aab3['where']=qs['filters'](_[_0x1c95('0x43')](_0x58b4a3['query'],_0xf5827f['filters']));if(_0x46679d[_0x1c95('0x3a')]){if(_0x46679d[_0x1c95('0x39')]){_0x46679d[_0x1c95('0x39')]=moment(_0x46679d['dateEnd'])[_0x1c95('0x44')](0x1,_0x1c95('0x45'));}else{_0x46679d[_0x1c95('0x39')]=moment(_0x46679d[_0x1c95('0x3a')])[_0x1c95('0x44')](0x1,'day');}_[_0x1c95('0x46')](_0x29aab3[_0x1c95('0x47')],{'createdAt':{'$gte':_0x46679d[_0x1c95('0x3a')],'$lte':_0x46679d[_0x1c95('0x39')]}});}if(_0x58b4a3[_0x1c95('0x38')][_0x1c95('0x48')]){_0x29aab3[_0x1c95('0x47')]=_['merge'](_0x29aab3[_0x1c95('0x47')],{'$or':_[_0x1c95('0x49')](_0x29aab3[_0x1c95('0x3e')],function(_0x5ec4ba){var _0xaba300={};_0xaba300[_0x5ec4ba]={'$like':'%'+_0x58b4a3[_0x1c95('0x38')][_0x1c95('0x48')]+'%'};return _0xaba300;})});}_0x29aab3=_[_0x1c95('0x46')]({},_0x29aab3,_0x58b4a3[_0x1c95('0x4a')]);var _0x21a559={'where':_0x29aab3[_0x1c95('0x47')]};return db[_0x1c95('0x4b')][_0x1c95('0x2d')](_0x21a559)[_0x1c95('0x21')](function(_0x588ad5){_0x5add0d[_0x1c95('0x2d')]=_0x588ad5;if(_0x58b4a3[_0x1c95('0x38')][_0x1c95('0x4c')]){_0x29aab3[_0x1c95('0x4d')]=[{'all':!![]}];}return db['FaxMessage'][_0x1c95('0x4e')](_0x29aab3);})['then'](function(_0x1c4452){_0x5add0d[_0x1c95('0x4f')]=_0x1c4452;return _0x5add0d;})['then'](respondWithFilteredResult(_0x254305,_0x29aab3))[_0x1c95('0x50')](handleError(_0x254305,null));};exports['show']=function(_0x1b1f0a,_0xdb69d3){var _0x1540e4={'raw':!![],'where':{'id':_0x1b1f0a['params']['id']}},_0x55c770={};_0x55c770[_0x1c95('0x37')]=_['keys'](db[_0x1c95('0x4b')][_0x1c95('0x51')]);_0x55c770[_0x1c95('0x38')]=_['keys'](_0x1b1f0a[_0x1c95('0x38')]);_0x55c770[_0x1c95('0x3c')]=_[_0x1c95('0x3d')](_0x55c770['model'],_0x55c770[_0x1c95('0x38')]);_0x1540e4['attributes']=_[_0x1c95('0x3d')](_0x55c770['model'],qs[_0x1c95('0x3f')](_0x1b1f0a['query']['fields']));_0x1540e4[_0x1c95('0x3e')]=_0x1540e4[_0x1c95('0x3e')]['length']?_0x1540e4[_0x1c95('0x3e')]:_0x55c770[_0x1c95('0x37')];if(_0x1b1f0a[_0x1c95('0x38')][_0x1c95('0x4c')]){_0x1540e4[_0x1c95('0x4d')]=[{'all':!![]}];}_0x1540e4=_[_0x1c95('0x46')]({},_0x1540e4,_0x1b1f0a[_0x1c95('0x4a')]);return db['FaxMessage']['find'](_0x1540e4)[_0x1c95('0x21')](handleEntityNotFound(_0xdb69d3,null))[_0x1c95('0x21')](respondWithResult(_0xdb69d3,null))[_0x1c95('0x50')](handleError(_0xdb69d3,null));};exports[_0x1c95('0x52')]=function(_0x304d79,_0x156208){if(_0x304d79[_0x1c95('0x53')]['id']){delete _0x304d79[_0x1c95('0x53')]['id'];}return db['FaxMessage'][_0x1c95('0x54')]({'where':{'id':_0x304d79[_0x1c95('0x55')]['id']}})[_0x1c95('0x21')](handleEntityNotFound(_0x156208,null))[_0x1c95('0x21')](saveUpdates(_0x304d79[_0x1c95('0x53')],null))[_0x1c95('0x21')](respondWithResult(_0x156208,null))[_0x1c95('0x50')](handleError(_0x156208,null));};exports[_0x1c95('0x33')]=function(_0x57777e,_0x5d4ab4){return db[_0x1c95('0x4b')][_0x1c95('0x54')]({'where':{'id':_0x57777e[_0x1c95('0x55')]['id']}})[_0x1c95('0x21')](handleEntityNotFound(_0x5d4ab4,null))['then'](removeEntity(_0x5d4ab4,null))[_0x1c95('0x50')](handleError(_0x5d4ab4,null));};exports[_0x1c95('0x56')]=function(_0x5f4e93,_0x23b46c){return db['FaxMessage'][_0x1c95('0x56')]()[_0x1c95('0x21')](respondWithResult(_0x23b46c,null))[_0x1c95('0x50')](handleError(_0x23b46c,null));};var interaction_log=require(_0x1c95('0x14'))(_0x1c95('0x57'));exports[_0x1c95('0x58')]=function(_0x5ed1df,_0xa219fe,_0x47b405){var _0x41829a={'channel':'fax'};if(_0x5ed1df['body']['id']){delete _0x5ed1df[_0x1c95('0x53')]['id'];}_0x5ed1df['body'][_0x1c95('0x59')]=!![];_0x5ed1df[_0x1c95('0x53')]['readAt']=moment()[_0x1c95('0x5a')](_0x1c95('0x5b'));_0x5ed1df['body']['UserId']=_0x5ed1df[_0x1c95('0x53')][_0x1c95('0x5c')]||_0x5ed1df[_0x1c95('0x5d')]['id'];return db['FaxMessage'][_0x1c95('0x54')]({'where':{'id':_0x5ed1df['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x1c95('0x21')](handleEntityNotFound(_0xa219fe,null))[_0x1c95('0x21')](saveUpdates(_0x5ed1df[_0x1c95('0x53')],null))[_0x1c95('0x21')](function(_0xf221d8){if(_0xf221d8){_0x41829a['message']=_0xf221d8[_0x1c95('0x5e')]({'plain':!![]});return db[_0x1c95('0x5f')][_0x1c95('0x54')]({'where':{'id':_0xf221d8['FaxInteractionId']}});}return null;})[_0x1c95('0x21')](handleEntityNotFound(_0xa219fe,null))[_0x1c95('0x21')](function(_0x8f022){if(_0x8f022){return _0x8f022['update']({'UserId':_0x5ed1df['body']['UserId'],'read1stAt':_[_0x1c95('0x60')](_0x8f022[_0x1c95('0x61')])?moment()[_0x1c95('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x1c95('0x21')](function(_0x4d9605){if(_0x4d9605){_0x41829a[_0x1c95('0x62')]=_0x4d9605['get']({'plain':!![]});interaction_log[_0x1c95('0x22')](_0x1c95('0x63'),_0x5ed1df[_0x1c95('0x5d')]['id'],_0x5ed1df[_0x1c95('0x5d')]['name'],_0x5ed1df[_0x1c95('0x5d')][_0x1c95('0x64')],_0x41829a[_0x1c95('0x62')]['id'],_0x5ed1df[_0x1c95('0x53')]?JSON[_0x1c95('0x27')](_0x5ed1df['body']):_0x1c95('0x65'));return respondWithRpcPromise(_0x1c95('0x66'),'acceptMessage',_0x41829a);}return null;})['then'](function(_0x4016ee){if(_0x4016ee){if(_0x5ed1df['body'][_0x1c95('0x67')]){_0x41829a['message'][_0x1c95('0x68')]=util['format'](_0x1c95('0x69'),_0x5ed1df['user'][_0x1c95('0x34')]);_0x41829a[_0x1c95('0x29')][_0x1c95('0x6a')]=_0x41829a['channel'];_0x41829a[_0x1c95('0x29')][_0x1c95('0x6b')]=_0x1c95('0x58');return respondWithRpcPromise('EventManager',_0x1c95('0x6c'),{'event':_0x1c95('0x6d'),'message':_0x41829a[_0x1c95('0x29')]},client9002)[_0x1c95('0x21')](function(){return _0x41829a;});}return _0x41829a;}return null;})['then'](respondWithResult(_0xa219fe,null))[_0x1c95('0x50')](handleError(_0xa219fe,null));};var interaction_log=require('../../config/logger')(_0x1c95('0x57'));exports[_0x1c95('0x6e')]=function(_0xe040ab,_0xdce1b0,_0x27b096){var _0x2236fb={'agent':{},'channel':_0x1c95('0x6f')};if(_0xe040ab[_0x1c95('0x53')]['id']){delete _0xe040ab[_0x1c95('0x53')]['id'];}_0xe040ab[_0x1c95('0x53')]['UserId']=_0xe040ab[_0x1c95('0x53')][_0x1c95('0x5c')]||_0xe040ab['user']['id'];_0x2236fb[_0x1c95('0x70')]['id']=_0xe040ab[_0x1c95('0x53')]['UserId'];return db[_0x1c95('0x4b')][_0x1c95('0x54')]({'where':{'id':_0xe040ab[_0x1c95('0x55')]['id'],'UserId':null}})[_0x1c95('0x21')](handleEntityNotFound(_0xdce1b0,null))[_0x1c95('0x21')](function(_0x5dd65b){if(_0x5dd65b){_0x2236fb[_0x1c95('0x29')]=_0x5dd65b[_0x1c95('0x5e')]({'plain':!![]});return db[_0x1c95('0x5f')][_0x1c95('0x54')]({'where':{'id':_0x5dd65b[_0x1c95('0x71')]}});}return null;})[_0x1c95('0x21')](handleEntityNotFound(_0xdce1b0,null))[_0x1c95('0x21')](function(_0x2d83f2){if(_0x2d83f2){_0x2236fb[_0x1c95('0x62')]=_0x2d83f2[_0x1c95('0x5e')]({'plain':!![]});interaction_log[_0x1c95('0x22')](_0x1c95('0x72'),_0xe040ab[_0x1c95('0x5d')]['id'],_0xe040ab[_0x1c95('0x5d')]['name'],_0xe040ab['user'][_0x1c95('0x64')],_0x2236fb['interaction']['id'],_0xe040ab[_0x1c95('0x53')]?JSON[_0x1c95('0x27')](_0xe040ab[_0x1c95('0x53')]):_0x1c95('0x65'));return respondWithRpcPromise(_0x1c95('0x73'),_0x1c95('0x74'),_0x2236fb);}return null;})[_0x1c95('0x21')](function(_0x48bc20){if(_0x48bc20){_0x48bc20[_0x1c95('0x29')][_0x1c95('0x68')]=util['format'](_0x1c95('0x69'),_0xe040ab['user'][_0x1c95('0x34')]);_0x48bc20[_0x1c95('0x29')][_0x1c95('0x6a')]=_0x2236fb[_0x1c95('0x6a')];_0x48bc20[_0x1c95('0x29')][_0x1c95('0x6b')]=_0x1c95('0x6e');respondWithRpcPromise('EventManager','EventManager',{'event':_0x1c95('0x75'),'message':_0x48bc20[_0x1c95('0x29')]},client9002);return _0x2236fb;}return null;})['then'](respondWithResult(_0xdce1b0,null))[_0x1c95('0x50')](handleError(_0xdce1b0,null));};exports['create']=function(_0x2f699b,_0x3e5187){var _0x1298e4;return db[_0x1c95('0x4b')][_0x1c95('0x76')](_0x2f699b['body'],{})[_0x1c95('0x21')](function(_0x1c2514){_0x1298e4=_0x1c2514;return db[_0x1c95('0x77')][_0x1c95('0x78')]({'where':{'id':_0x1298e4[_0x1c95('0x79')]}});})['then'](function(_0x353317){if(_[_0x1c95('0x60')](_0x353317)){return;}else{_0x1298e4[_0x1c95('0x6f')]=_0x353317[_0x1c95('0x6f')];return db[_0x1c95('0x7a')][_0x1c95('0x78')]({'where':{'id':_0x1298e4[_0x1c95('0x7b')]}});}})[_0x1c95('0x21')](function(_0x49f471){return respondWithRpcPromise(_0x1c95('0x7c'),_0x1c95('0x7c'),{'FaxAccountId':_[_0x1c95('0x60')](_0x2f699b['body'])?undefined:_0x2f699b['body'][_0x1c95('0x7d')],'path':_[_0x1c95('0x60')](_0x49f471)?undefined:util[_0x1c95('0x5a')]('/var/opt/motion2/server/files/attachments/%s',_0x49f471[_0x1c95('0x7e')]),'fax':_[_0x1c95('0x60')](_0x1298e4[_0x1c95('0x6f')])?undefined:_0x1298e4[_0x1c95('0x6f')],'AttachmentId':_0x1298e4['AttachmentId']},client9002);})[_0x1c95('0x21')](respondWithResult(_0x3e5187,0xc9))[_0x1c95('0x50')](handleError(_0x3e5187,null));};exports[_0x1c95('0x7f')]=function(_0x18de08,_0x4a656b){var _0x45d161=path['join'](config[_0x1c95('0x80')],_0x1c95('0x81'),_0x1c95('0x82'),'attachments');return db['FaxMessage'][_0x1c95('0x54')]({'where':{'id':_0x18de08['params']['id']},'include':[{'model':db[_0x1c95('0x7a')],'as':_0x1c95('0x7a')}]})[_0x1c95('0x21')](handleEntityNotFound(_0x4a656b,null))[_0x1c95('0x21')](function(_0x332639){if(_0x332639){return _0x4a656b[_0x1c95('0x7f')](path[_0x1c95('0x83')](_0x45d161,_0x332639[_0x1c95('0x7a')][_0x1c95('0x7e')]));}})[_0x1c95('0x50')](handleError(_0x4a656b,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index f8d601c..c1dac26 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 _0x9cd3=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update'];(function(_0x2abd24,_0x57b9db){var _0x27f6bb=function(_0x51d4b5){while(--_0x51d4b5){_0x2abd24['push'](_0x2abd24['shift']());}};_0x27f6bb(++_0x57b9db);}(_0x9cd3,0xb5));var _0x39cd=function(_0x4667b2,_0x135b67){_0x4667b2=_0x4667b2-0x0;var _0x1070f2=_0x9cd3[_0x4667b2];return _0x1070f2;};'use strict';var EventEmitter=require(_0x39cd('0x0'));var FaxMessage=require(_0x39cd('0x1'))['db'][_0x39cd('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x39cd('0x3')](0x0);var events={'afterCreate':_0x39cd('0x4'),'afterUpdate':_0x39cd('0x5'),'afterDestroy':_0x39cd('0x6')};function emitEvent(_0x50b94d){return function(_0x242a4d,_0x175a33,_0x521d70){FaxMessageEvents[_0x39cd('0x7')](_0x50b94d+':'+_0x242a4d['id'],_0x242a4d);FaxMessageEvents[_0x39cd('0x7')](_0x50b94d,_0x242a4d);_0x521d70(null);};}for(var e in events){if(events[_0x39cd('0x8')](e)){var event=events[e];FaxMessage[_0x39cd('0x9')](e,emitEvent(event));}}module[_0x39cd('0xa')]=FaxMessageEvents; \ No newline at end of file +var _0x67a5=['hasOwnProperty','hook','FaxMessage','save','update','emit'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x67a5,0x1ee));var _0x567a=function(_0x3969b9,_0x1d85a9){_0x3969b9=_0x3969b9-0x0;var _0x416f1c=_0x67a5[_0x3969b9];return _0x416f1c;};'use strict';var EventEmitter=require('events');var FaxMessage=require('../../mysqldb')['db'][_0x567a('0x0')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x567a('0x1'),'afterUpdate':_0x567a('0x2'),'afterDestroy':'remove'};function emitEvent(_0x597780){return function(_0x1c5c0d,_0x40bb10,_0x41249d){FaxMessageEvents[_0x567a('0x3')](_0x597780+':'+_0x1c5c0d['id'],_0x1c5c0d);FaxMessageEvents[_0x567a('0x3')](_0x597780,_0x1c5c0d);_0x41249d(null);};}for(var e in events){if(events[_0x567a('0x4')](e)){var event=events[e];FaxMessage[_0x567a('0x5')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index eb0e4c2..a1dd909 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 _0xd57d=['secret','isNil','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','body','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','exports','define','fax_messages','models','direction','toLowerCase','out'];(function(_0x1791c8,_0x261d1b){var _0x387052=function(_0x2f1caf){while(--_0x2f1caf){_0x1791c8['push'](_0x1791c8['shift']());}};_0x387052(++_0x261d1b);}(_0xd57d,0x11e));var _0xdd57=function(_0x37f2c2,_0x2ed200){_0x37f2c2=_0x37f2c2-0x0;var _0x424477=_0xd57d[_0x37f2c2];return _0x424477;};'use strict';var _=require(_0xdd57('0x0'));var util=require('util');var logger=require(_0xdd57('0x1'))(_0xdd57('0x2'));var moment=require(_0xdd57('0x3'));var BPromise=require(_0xdd57('0x4'));var rp=require(_0xdd57('0x5'));var attributes=require('./faxMessage.attributes');module[_0xdd57('0x6')]=function(_0x4dd87b,_0x1ef0e9){return _0x4dd87b[_0xdd57('0x7')]('FaxMessage',attributes,{'tableName':_0xdd57('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x510b29,_0x5af1a3,_0x345453){var _0x55b3c2=_0x4dd87b[_0xdd57('0x9')];var _0x4facb3=_0x510b29['get']({'plain':!![]});if(_0x4facb3[_0xdd57('0xa')][_0xdd57('0xb')]()==='in'||_0x4facb3[_0xdd57('0xa')][_0xdd57('0xb')]()===_0xdd57('0xc')&&!_0x4facb3[_0xdd57('0xd')]&&!_[_0xdd57('0xe')](_0x4facb3['UserId'])){_0x55b3c2[_0xdd57('0xf')][_0xdd57('0x10')]({'where':{'id':_0x4facb3[_0xdd57('0x11')]}})[_0xdd57('0x12')](function(_0x2df305){if(_0x2df305){_0x2df305[_0xdd57('0x13')]({'lastMsgAt':_0x4facb3[_0xdd57('0x14')],'lastMsgDirection':_0x4facb3[_0xdd57('0xa')][_0xdd57('0xb')](),'lastMsgBody':_0x4facb3[_0xdd57('0x15')]});}})['catch'](function(_0x479dfc){console['error'](_0x479dfc);});}_0x345453();}},'charset':'utf8mb4','collate':_0xdd57('0x16')});}; \ No newline at end of file +var _0xba31=['update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','./faxMessage.attributes','exports','FaxMessage','fax_messages','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','FaxInteractionId','then'];(function(_0x4a91ca,_0x9100de){var _0x186348=function(_0x211c38){while(--_0x211c38){_0x4a91ca['push'](_0x4a91ca['shift']());}};_0x186348(++_0x9100de);}(_0xba31,0xff));var _0x1ba3=function(_0x5c1345,_0x40116e){_0x5c1345=_0x5c1345-0x0;var _0x1c070d=_0xba31[_0x5c1345];return _0x1c070d;};'use strict';var _=require('lodash');var util=require(_0x1ba3('0x0'));var logger=require(_0x1ba3('0x1'))(_0x1ba3('0x2'));var moment=require(_0x1ba3('0x3'));var BPromise=require(_0x1ba3('0x4'));var rp=require(_0x1ba3('0x5'));var attributes=require(_0x1ba3('0x6'));module[_0x1ba3('0x7')]=function(_0x22cb82,_0x323e65){return _0x22cb82['define'](_0x1ba3('0x8'),attributes,{'tableName':_0x1ba3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3b3618,_0x18e203,_0x328cd2){var _0x595707=_0x22cb82['models'];var _0x2e1319=_0x3b3618[_0x1ba3('0xa')]({'plain':!![]});if(_0x2e1319[_0x1ba3('0xb')][_0x1ba3('0xc')]()==='in'||_0x2e1319[_0x1ba3('0xb')][_0x1ba3('0xc')]()===_0x1ba3('0xd')&&!_0x2e1319[_0x1ba3('0xe')]&&!_[_0x1ba3('0xf')](_0x2e1319[_0x1ba3('0x10')])){_0x595707['FaxInteraction'][_0x1ba3('0x11')]({'where':{'id':_0x2e1319[_0x1ba3('0x12')]}})[_0x1ba3('0x13')](function(_0x29860d){if(_0x29860d){_0x29860d[_0x1ba3('0x14')]({'lastMsgAt':_0x2e1319[_0x1ba3('0x15')],'lastMsgDirection':_0x2e1319[_0x1ba3('0xb')][_0x1ba3('0xc')](),'lastMsgBody':_0x2e1319['body']});}})['catch'](function(_0x50bfc7){console[_0x1ba3('0x16')](_0x50bfc7);});}_0x328cd2();}},'charset':_0x1ba3('0x17'),'collate':_0x1ba3('0x18')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 1d12b96..2aebd5d 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 _0x9576=['update','body','where','attributes','limit','UpdateFaxMessage','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateFaxMessage','FaxMessage','options','raw','debug'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x9576,0x182));var _0x6957=function(_0x54d11b,_0x5d79e9){_0x54d11b=_0x54d11b-0x0;var _0x50f46e=_0x9576[_0x54d11b];return _0x50f46e;};'use strict';var _=require(_0x6957('0x0'));var util=require(_0x6957('0x1'));var moment=require(_0x6957('0x2'));var BPromise=require(_0x6957('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6957('0x4'))['db'];var utils=require(_0x6957('0x5'));var logger=require(_0x6957('0x6'))(_0x6957('0x7'));var config=require(_0x6957('0x8'));var jayson=require(_0x6957('0x9'));var client=jayson[_0x6957('0xa')]['http']({'port':0x232a});config[_0x6957('0xb')]=_[_0x6957('0xc')](config[_0x6957('0xb')],{'host':_0x6957('0xd'),'port':0x18eb});var socket=require(_0x6957('0xe'))(new Redis(config[_0x6957('0xb')]));require('./faxMessage.socket')[_0x6957('0xf')](socket);function respondWithRpcPromise(_0x1dded8,_0x483af0,_0x55078f){return new BPromise(function(_0x3e0520,_0x25c338){return client[_0x6957('0x10')](_0x1dded8,_0x55078f)[_0x6957('0x11')](function(_0x3e2f16){logger[_0x6957('0x12')](_0x6957('0x13'),_0x483af0,'request\x20sent');logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x483af0,_0x6957('0x14'),JSON[_0x6957('0x15')](_0x3e2f16));if(_0x3e2f16[_0x6957('0x16')]){if(_0x3e2f16[_0x6957('0x16')][_0x6957('0x17')]===0x1f4){logger[_0x6957('0x16')](_0x6957('0x13'),_0x483af0,_0x3e2f16['error']['message']);return _0x25c338(_0x3e2f16['error'][_0x6957('0x18')]);}logger[_0x6957('0x16')](_0x6957('0x13'),_0x483af0,_0x3e2f16[_0x6957('0x16')]['message']);return _0x3e0520(_0x3e2f16[_0x6957('0x16')]['message']);}else{logger[_0x6957('0x12')](_0x6957('0x13'),_0x483af0,'request\x20sent');_0x3e0520(_0x3e2f16[_0x6957('0x19')][_0x6957('0x18')]);}})[_0x6957('0x1a')](function(_0x4c527c){logger[_0x6957('0x16')](_0x6957('0x13'),_0x483af0,_0x4c527c);_0x25c338(_0x4c527c);});});}exports[_0x6957('0x1b')]=function(_0x135893){var _0x1ce753=this;return new Promise(function(_0x26d3fd,_0x35ee5b){return db[_0x6957('0x1c')]['create'](_0x135893['body'],{'raw':_0x135893[_0x6957('0x1d')]?_0x135893[_0x6957('0x1d')][_0x6957('0x1e')]===undefined?!![]:![]:!![]})[_0x6957('0x11')](function(_0x3591fa){logger[_0x6957('0x12')](_0x6957('0x1b'),_0x135893);logger[_0x6957('0x1f')]('CreateFaxMessage',_0x135893,JSON[_0x6957('0x15')](_0x3591fa));_0x26d3fd(_0x3591fa);})[_0x6957('0x1a')](function(_0x1f1228){logger[_0x6957('0x16')]('CreateFaxMessage',_0x1f1228['message'],_0x135893);_0x35ee5b(_0x1ce753[_0x6957('0x16')](0x1f4,_0x1f1228[_0x6957('0x18')]));});});};exports['UpdateFaxMessage']=function(_0x5da47a){var _0x320e7d=this;return new Promise(function(_0xa2f92f,_0x3bc22f){return db['FaxMessage'][_0x6957('0x20')](_0x5da47a[_0x6957('0x21')],{'raw':_0x5da47a[_0x6957('0x1d')]?_0x5da47a[_0x6957('0x1d')][_0x6957('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5da47a[_0x6957('0x1d')]?_0x5da47a[_0x6957('0x1d')][_0x6957('0x22')]||null:null,'attributes':_0x5da47a['options']?_0x5da47a[_0x6957('0x1d')][_0x6957('0x23')]||null:null,'limit':_0x5da47a[_0x6957('0x1d')]?_0x5da47a[_0x6957('0x1d')][_0x6957('0x24')]||null:null})[_0x6957('0x11')](function(_0x3f8745){logger[_0x6957('0x12')](_0x6957('0x25'),_0x5da47a);logger[_0x6957('0x1f')](_0x6957('0x25'),_0x5da47a,JSON['stringify'](_0x3f8745));_0xa2f92f(_0x3f8745);})['catch'](function(_0x34a43d){logger[_0x6957('0x16')](_0x6957('0x25'),_0x34a43d[_0x6957('0x18')],_0x5da47a);_0x3bc22f(_0x320e7d['error'](0x1f4,_0x34a43d[_0x6957('0x18')]));});});}; \ No newline at end of file +var _0x9c5a=['../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxMessage','FaxMessage','create','options','raw','UpdateFaxMessage','update','body','where','attributes','lodash','util','bluebird','randomstring','ioredis'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x38be70,_0x5c6d2f){_0x38be70=_0x38be70-0x0;var _0x366ab7=_0x9c5a[_0x38be70];return _0x366ab7;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var moment=require('moment');var BPromise=require(_0xa9c5('0x2'));var rs=require(_0xa9c5('0x3'));var fs=require('fs');var Redis=require(_0xa9c5('0x4'));var db=require(_0xa9c5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa9c5('0x6'))(_0xa9c5('0x7'));var config=require('../../config/environment');var jayson=require(_0xa9c5('0x8'));var client=jayson['client'][_0xa9c5('0x9')]({'port':0x232a});config[_0xa9c5('0xa')]=_['defaults'](config['redis'],{'host':_0xa9c5('0xb'),'port':0x18eb});var socket=require(_0xa9c5('0xc'))(new Redis(config['redis']));require(_0xa9c5('0xd'))[_0xa9c5('0xe')](socket);function respondWithRpcPromise(_0x51c14c,_0x2e4f45,_0x40a79d){return new BPromise(function(_0x4a19c0,_0x4c55e9){return client[_0xa9c5('0xf')](_0x51c14c,_0x40a79d)[_0xa9c5('0x10')](function(_0x45f8d8){logger[_0xa9c5('0x11')](_0xa9c5('0x12'),_0x2e4f45,_0xa9c5('0x13'));logger[_0xa9c5('0x14')](_0xa9c5('0x15'),_0x2e4f45,_0xa9c5('0x13'),JSON[_0xa9c5('0x16')](_0x45f8d8));if(_0x45f8d8['error']){if(_0x45f8d8[_0xa9c5('0x17')][_0xa9c5('0x18')]===0x1f4){logger[_0xa9c5('0x17')](_0xa9c5('0x12'),_0x2e4f45,_0x45f8d8[_0xa9c5('0x17')][_0xa9c5('0x19')]);return _0x4c55e9(_0x45f8d8[_0xa9c5('0x17')][_0xa9c5('0x19')]);}logger[_0xa9c5('0x17')](_0xa9c5('0x12'),_0x2e4f45,_0x45f8d8['error'][_0xa9c5('0x19')]);return _0x4a19c0(_0x45f8d8[_0xa9c5('0x17')][_0xa9c5('0x19')]);}else{logger['info'](_0xa9c5('0x12'),_0x2e4f45,_0xa9c5('0x13'));_0x4a19c0(_0x45f8d8[_0xa9c5('0x1a')][_0xa9c5('0x19')]);}})[_0xa9c5('0x1b')](function(_0x349f27){logger[_0xa9c5('0x17')](_0xa9c5('0x12'),_0x2e4f45,_0x349f27);_0x4c55e9(_0x349f27);});});}exports[_0xa9c5('0x1c')]=function(_0x36c486){var _0x113c8f=this;return new Promise(function(_0x2d95f8,_0x54f8b9){return db[_0xa9c5('0x1d')][_0xa9c5('0x1e')](_0x36c486['body'],{'raw':_0x36c486['options']?_0x36c486[_0xa9c5('0x1f')][_0xa9c5('0x20')]===undefined?!![]:![]:!![]})[_0xa9c5('0x10')](function(_0x3b497a){logger[_0xa9c5('0x11')](_0xa9c5('0x1c'),_0x36c486);logger['debug']('CreateFaxMessage',_0x36c486,JSON[_0xa9c5('0x16')](_0x3b497a));_0x2d95f8(_0x3b497a);})[_0xa9c5('0x1b')](function(_0x4b0f05){logger[_0xa9c5('0x17')](_0xa9c5('0x1c'),_0x4b0f05[_0xa9c5('0x19')],_0x36c486);_0x54f8b9(_0x113c8f[_0xa9c5('0x17')](0x1f4,_0x4b0f05[_0xa9c5('0x19')]));});});};exports[_0xa9c5('0x21')]=function(_0xe44e6d){var _0x51b64a=this;return new Promise(function(_0x4e8a7f,_0x242771){return db['FaxMessage'][_0xa9c5('0x22')](_0xe44e6d[_0xa9c5('0x23')],{'raw':_0xe44e6d['options']?_0xe44e6d[_0xa9c5('0x1f')][_0xa9c5('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe44e6d['options']?_0xe44e6d[_0xa9c5('0x1f')][_0xa9c5('0x24')]||null:null,'attributes':_0xe44e6d[_0xa9c5('0x1f')]?_0xe44e6d[_0xa9c5('0x1f')][_0xa9c5('0x25')]||null:null,'limit':_0xe44e6d['options']?_0xe44e6d[_0xa9c5('0x1f')]['limit']||null:null})[_0xa9c5('0x10')](function(_0x1ef388){logger[_0xa9c5('0x11')]('UpdateFaxMessage',_0xe44e6d);logger[_0xa9c5('0x14')](_0xa9c5('0x21'),_0xe44e6d,JSON['stringify'](_0x1ef388));_0x4e8a7f(_0x1ef388);})[_0xa9c5('0x1b')](function(_0xc454fd){logger[_0xa9c5('0x17')](_0xa9c5('0x21'),_0xc454fd[_0xa9c5('0x19')],_0xe44e6d);_0x242771(_0x51b64a[_0xa9c5('0x17')](0x1f4,_0xc454fd[_0xa9c5('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 591da0a..ec226a9 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 _0x3c2a=['length','faxMessage:','./faxMessage.events','save','update','emit','removeListener','register'];(function(_0x20f4ba,_0x4ddd29){var _0x2f6570=function(_0x5a6ab9){while(--_0x5a6ab9){_0x20f4ba['push'](_0x20f4ba['shift']());}};_0x2f6570(++_0x4ddd29);}(_0x3c2a,0x1b2));var _0xa3c2=function(_0x4ad3fc,_0x5517e6){_0x4ad3fc=_0x4ad3fc-0x0;var _0x358d42=_0x3c2a[_0x4ad3fc];return _0x358d42;};'use strict';var FaxMessageEvents=require(_0xa3c2('0x0'));var events=[_0xa3c2('0x1'),'remove',_0xa3c2('0x2')];function createListener(_0x58cb53,_0x3cd18d){return function(_0x2377ab){_0x3cd18d[_0xa3c2('0x3')](_0x58cb53,_0x2377ab);};}function removeListener(_0x43db8e,_0x3ddc59){return function(){FaxMessageEvents[_0xa3c2('0x4')](_0x43db8e,_0x3ddc59);};}exports[_0xa3c2('0x5')]=function(_0x230a89){for(var _0x45a0b6=0x0,_0x113c67=events[_0xa3c2('0x6')];_0x45a0b6<_0x113c67;_0x45a0b6++){var _0x1975f3=events[_0x45a0b6];var _0x1d8df4=createListener(_0xa3c2('0x7')+_0x1975f3,_0x230a89);FaxMessageEvents['on'](_0x1975f3,_0x1d8df4);}}; \ No newline at end of file +var _0xde50=['remove','update','emit','length'];(function(_0x47c39a,_0x165a5d){var _0x590928=function(_0x20f3a5){while(--_0x20f3a5){_0x47c39a['push'](_0x47c39a['shift']());}};_0x590928(++_0x165a5d);}(_0xde50,0x140));var _0x0de5=function(_0x542fa6,_0x420772){_0x542fa6=_0x542fa6-0x0;var _0x409574=_0xde50[_0x542fa6];return _0x409574;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=['save',_0x0de5('0x0'),_0x0de5('0x1')];function createListener(_0x13190a,_0x3ae828){return function(_0x583809){_0x3ae828[_0x0de5('0x2')](_0x13190a,_0x583809);};}function removeListener(_0x5c22bc,_0x16fcda){return function(){FaxMessageEvents['removeListener'](_0x5c22bc,_0x16fcda);};}exports['register']=function(_0x5f05a1){for(var _0x444955=0x0,_0x2714e3=events[_0x0de5('0x3')];_0x444955<_0x2714e3;_0x444955++){var _0x57410e=events[_0x444955];var _0xe3ac44=createListener('faxMessage:'+_0x57410e,_0x5f05a1);FaxMessageEvents['on'](_0x57410e,_0xe3ac44);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index f002712..4d9024c 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 _0xeda8=['download','post','fax','create','put','update','/:id/accept','/:id/reject','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x1ea3aa,_0x33cef6){var _0x54535a=function(_0x195c95){while(--_0x195c95){_0x1ea3aa['push'](_0x1ea3aa['shift']());}};_0x54535a(++_0x33cef6);}(_0xeda8,0x104));var _0x8eda=function(_0x12d5cf,_0xaec32f){_0x12d5cf=_0x12d5cf-0x0;var _0x458920=_0xeda8[_0x12d5cf];return _0x458920;};'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('0x9')](_0x8eda('0xe'),auth[_0x8eda('0xa')](),controller['show']);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x8eda('0xf')]);router[_0x8eda('0x10')]('/',auth[_0x8eda('0xa')](),interaction['tracked'](_0x8eda('0x11'),'faxmessage:create'),controller[_0x8eda('0x12')]);router[_0x8eda('0x13')](_0x8eda('0xe'),auth[_0x8eda('0xa')](),controller[_0x8eda('0x14')]);router[_0x8eda('0x13')](_0x8eda('0x15'),auth[_0x8eda('0xa')](),controller['accept']);router['put'](_0x8eda('0x16'),auth[_0x8eda('0xa')](),controller['reject']);router[_0x8eda('0x17')](_0x8eda('0xe'),auth[_0x8eda('0xa')](),controller['destroy']);module[_0x8eda('0x18')]=router; \ No newline at end of file +var _0x5464=['show','/:id/download','post','tracked','faxmessage:create','create','put','reject','destroy','multer','util','path','express','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','describe','/:id'];(function(_0x412e27,_0x20a978){var _0x53da42=function(_0x43cae5){while(--_0x43cae5){_0x412e27['push'](_0x412e27['shift']());}};_0x53da42(++_0x20a978);}(_0x5464,0x15d));var _0x4546=function(_0xe2d0e5,_0x4d73dd){_0xe2d0e5=_0xe2d0e5-0x0;var _0x1dee2d=_0x5464[_0xe2d0e5];return _0x1dee2d;};'use strict';var multer=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var path=require(_0x4546('0x2'));var timeout=require('connect-timeout');var express=require(_0x4546('0x3'));var router=express['Router']();var auth=require(_0x4546('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4546('0x5'));var controller=require(_0x4546('0x6'));router[_0x4546('0x7')]('/',auth[_0x4546('0x8')](),controller['index']);router['get']('/describe',auth[_0x4546('0x8')](),controller[_0x4546('0x9')]);router[_0x4546('0x7')](_0x4546('0xa'),auth[_0x4546('0x8')](),controller[_0x4546('0xb')]);router[_0x4546('0x7')](_0x4546('0xc'),auth[_0x4546('0x8')](),controller['download']);router[_0x4546('0xd')]('/',auth[_0x4546('0x8')](),interaction[_0x4546('0xe')]('fax',_0x4546('0xf')),controller[_0x4546('0x10')]);router[_0x4546('0x11')](_0x4546('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x4546('0x11')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x4546('0x12')]);router['delete'](_0x4546('0xa'),auth['isAuthenticated'](),controller[_0x4546('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 9d5df6f..3072f8e 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 _0xbe1b=['beepall','roundrobin','sequelize','name','STRING','ENUM','rrmemory'];(function(_0x455e82,_0x522f6f){var _0x2d0520=function(_0x11556e){while(--_0x11556e){_0x455e82['push'](_0x455e82['shift']());}};_0x2d0520(++_0x522f6f);}(_0xbe1b,0x64));var _0xbbe1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbe1b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xbbe1('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xbbe1('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbbe1('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbbe1('0x3')](_0xbbe1('0x4'),_0xbbe1('0x5'),_0xbbe1('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7963=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','INTEGER'];(function(_0x3ee55a,_0x19aeea){var _0x581800=function(_0x636cb7){while(--_0x636cb7){_0x3ee55a['push'](_0x3ee55a['shift']());}};_0x581800(++_0x19aeea);}(_0x7963,0xbc));var _0x3796=function(_0x479722,_0x231cef){_0x479722=_0x479722-0x0;var _0x2310fe=_0x7963[_0x479722];return _0x2310fe;};'use strict';var Sequelize=require(_0x3796('0x0'));module[_0x3796('0x1')]={'name':{'type':Sequelize[_0x3796('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x3796('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3796('0x4')](_0x3796('0x5'),_0x3796('0x6'),_0x3796('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x3796('0x3')],'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 f432e58..1ec821a 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 _0xa2ed=['end','json','limit','set','Content-Range','apply','then','destroy','name','send','index','FaxQueue','rawAttributes','query','dateEnd','dateStart','keys','filters','intersection','attributes','fields','nolimit','offset','order','sort','where','add','day','merge','filter','options','count','include','findAll','rows','catch','show','params','model','length','includeAll','body','find','describe','getMembers','findOne','get','UserFaxQueue','hasOwnProperty','pick','FaxQueueId','map','User','agent','updatedAt','format','%s/%s','SIP','faxPause','createdAt','getTeams','Team','ids','Agents','union','addAgents','removeTeams','removeAgents','omit','spread','emit','userFaxQueue:save','isArray','userFaxQueue:remove','getAgents','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status'];(function(_0x40b3f3,_0x5eae3b){var _0x2f6852=function(_0x37eefe){while(--_0x37eefe){_0x40b3f3['push'](_0x40b3f3['shift']());}};_0x2f6852(++_0x5eae3b);}(_0xa2ed,0x113));var _0xda2e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa2ed[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xda2e('0x0'));var rp=require(_0xda2e('0x1'));var moment=require(_0xda2e('0x2'));var BPromise=require(_0xda2e('0x3'));var Mustache=require(_0xda2e('0x4'));var util=require(_0xda2e('0x5'));var path=require('path');var sox=require(_0xda2e('0x6'));var csv=require('to-csv');var ejs=require(_0xda2e('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xda2e('0x8'));var crypto=require(_0xda2e('0x9'));var jsforce=require(_0xda2e('0xa'));var deskjs=require(_0xda2e('0xb'));var toCsv=require(_0xda2e('0xc'));var querystring=require('querystring');var Papa=require(_0xda2e('0xd'));var Redis=require(_0xda2e('0xe'));var qs=require(_0xda2e('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xda2e('0x10'));var db=require(_0xda2e('0x11'))['db'];config[_0xda2e('0x12')]=_['defaults'](config[_0xda2e('0x12')],{'host':_0xda2e('0x13'),'port':0x18eb});var socket=require(_0xda2e('0x14'))(new Redis(config['redis']));require(_0xda2e('0x15'))[_0xda2e('0x16')](socket);function respondWithStatusCode(_0x4ded20,_0x2ad6ba){_0x2ad6ba=_0x2ad6ba||0xcc;return function(_0x18100d){if(_0x18100d){return _0x4ded20[_0xda2e('0x17')](_0x2ad6ba);}return _0x4ded20[_0xda2e('0x18')](_0x2ad6ba)[_0xda2e('0x19')]();};}function respondWithResult(_0xfe7c92,_0xe6bd80){_0xe6bd80=_0xe6bd80||0xc8;return function(_0x5499c6){if(_0x5499c6){return _0xfe7c92[_0xda2e('0x18')](_0xe6bd80)[_0xda2e('0x1a')](_0x5499c6);}};}function respondWithFilteredResult(_0x22510f,_0x104840){return function(_0x1ef313){if(_0x1ef313){var _0x18d884=_0x1ef313['count'],_0x1f7529=_0x104840['offset'],_0xaa9480=_0x104840['offset']+_0x104840[_0xda2e('0x1b')],_0x5e2671;if(_0xaa9480>=_0x18d884){_0xaa9480=_0x18d884;_0x5e2671=0xc8;}else{_0x5e2671=0xce;}_0x22510f[_0xda2e('0x18')](_0x5e2671);return _0x22510f[_0xda2e('0x1c')](_0xda2e('0x1d'),_0x1f7529+'-'+_0xaa9480+'/'+_0x18d884)['json'](_0x1ef313);}return null;};}function patchUpdates(_0x57deb2){return function(_0x2a344e){try{jsonpatch[_0xda2e('0x1e')](_0x2a344e,_0x57deb2,!![]);}catch(_0x3e2bd3){return BPromise['reject'](_0x3e2bd3);}return _0x2a344e['save']();};}function saveUpdates(_0x1c5f2e,_0x2bcd72){return function(_0x3c5a7b){if(_0x3c5a7b){return _0x3c5a7b['update'](_0x1c5f2e)[_0xda2e('0x1f')](function(_0x220083){return _0x220083;});}return null;};}function removeEntity(_0x4d8f9c,_0x24130f){return function(_0x3ec132){if(_0x3ec132){return _0x3ec132[_0xda2e('0x20')]()[_0xda2e('0x1f')](function(){_0x4d8f9c[_0xda2e('0x18')](0xcc)[_0xda2e('0x19')]();});}};}function handleEntityNotFound(_0x2a1716,_0x47465c){return function(_0x4c76db){if(!_0x4c76db){_0x2a1716['sendStatus'](0x194);}return _0x4c76db;};}function handleError(_0x50c9e7,_0x5b2e82){_0x5b2e82=_0x5b2e82||0x1f4;return function(_0x8a8c8d){logger['error'](_0x8a8c8d['stack']);if(_0x8a8c8d[_0xda2e('0x21')]){delete _0x8a8c8d[_0xda2e('0x21')];}_0x50c9e7[_0xda2e('0x18')](_0x5b2e82)[_0xda2e('0x22')](_0x8a8c8d);};}exports[_0xda2e('0x23')]=function(_0x97f909,_0xbe9ebf){var _0x4fbd62={},_0x14d5b9={},_0x342884={'count':0x0,'rows':[]};var _0x406887=db[_0xda2e('0x24')][_0xda2e('0x25')];_0x14d5b9['model']=_['keys'](_0x406887);var _0x5cf0d3={'dateStart':_0x97f909[_0xda2e('0x26')]['dateStart'],'dateEnd':_0x97f909['query'][_0xda2e('0x27')]};delete _0x97f909[_0xda2e('0x26')][_0xda2e('0x28')];delete _0x97f909[_0xda2e('0x26')]['dateEnd'];_0x14d5b9[_0xda2e('0x26')]=_[_0xda2e('0x29')](_0x97f909['query']);_0x14d5b9[_0xda2e('0x2a')]=_[_0xda2e('0x2b')](_0x14d5b9['model'],_0x14d5b9[_0xda2e('0x26')]);_0x4fbd62[_0xda2e('0x2c')]=_[_0xda2e('0x2b')](_0x14d5b9['model'],qs[_0xda2e('0x2d')](_0x97f909[_0xda2e('0x26')][_0xda2e('0x2d')]));_0x4fbd62[_0xda2e('0x2c')]=_0x4fbd62[_0xda2e('0x2c')]['length']?_0x4fbd62['attributes']:_0x14d5b9['model'];if(!_0x97f909[_0xda2e('0x26')]['hasOwnProperty'](_0xda2e('0x2e'))){_0x4fbd62['limit']=qs[_0xda2e('0x1b')](_0x97f909[_0xda2e('0x26')]['limit']);_0x4fbd62[_0xda2e('0x2f')]=qs[_0xda2e('0x2f')](_0x97f909['query']['offset']);}_0x4fbd62[_0xda2e('0x30')]=qs['sort'](_0x97f909[_0xda2e('0x26')][_0xda2e('0x31')]);_0x4fbd62[_0xda2e('0x32')]=qs[_0xda2e('0x2a')](_['pick'](_0x97f909['query'],_0x14d5b9[_0xda2e('0x2a')]));if(_0x5cf0d3[_0xda2e('0x28')]){if(_0x5cf0d3[_0xda2e('0x27')]){_0x5cf0d3[_0xda2e('0x27')]=moment(_0x5cf0d3[_0xda2e('0x27')])[_0xda2e('0x33')](0x1,_0xda2e('0x34'));}else{_0x5cf0d3[_0xda2e('0x27')]=moment(_0x5cf0d3[_0xda2e('0x28')])[_0xda2e('0x33')](0x1,_0xda2e('0x34'));}_[_0xda2e('0x35')](_0x4fbd62[_0xda2e('0x32')],{'createdAt':{'$gte':_0x5cf0d3[_0xda2e('0x28')],'$lte':_0x5cf0d3[_0xda2e('0x27')]}});}if(_0x97f909[_0xda2e('0x26')]['filter']){_0x4fbd62[_0xda2e('0x32')]=_[_0xda2e('0x35')](_0x4fbd62['where'],{'$or':_['map'](_0x4fbd62['attributes'],function(_0x3f13f4){var _0xedcf6d={};_0xedcf6d[_0x3f13f4]={'$like':'%'+_0x97f909[_0xda2e('0x26')][_0xda2e('0x36')]+'%'};return _0xedcf6d;})});}_0x4fbd62=_['merge']({},_0x4fbd62,_0x97f909[_0xda2e('0x37')]);var _0x2bee22={'where':_0x4fbd62[_0xda2e('0x32')]};return db[_0xda2e('0x24')][_0xda2e('0x38')](_0x2bee22)[_0xda2e('0x1f')](function(_0x371cc3){_0x342884[_0xda2e('0x38')]=_0x371cc3;if(_0x97f909[_0xda2e('0x26')]['includeAll']){_0x4fbd62[_0xda2e('0x39')]=[{'all':!![]}];}return db[_0xda2e('0x24')][_0xda2e('0x3a')](_0x4fbd62);})[_0xda2e('0x1f')](function(_0x36b4f0){_0x342884[_0xda2e('0x3b')]=_0x36b4f0;return _0x342884;})[_0xda2e('0x1f')](respondWithFilteredResult(_0xbe9ebf,_0x4fbd62))[_0xda2e('0x3c')](handleError(_0xbe9ebf,null));};exports[_0xda2e('0x3d')]=function(_0x21a142,_0x171eda){var _0x5a0948={'raw':!![],'where':{'id':_0x21a142[_0xda2e('0x3e')]['id']}},_0x168afb={};_0x168afb[_0xda2e('0x3f')]=_[_0xda2e('0x29')](db[_0xda2e('0x24')]['rawAttributes']);_0x168afb[_0xda2e('0x26')]=_[_0xda2e('0x29')](_0x21a142['query']);_0x168afb['filters']=_['intersection'](_0x168afb['model'],_0x168afb[_0xda2e('0x26')]);_0x5a0948['attributes']=_['intersection'](_0x168afb[_0xda2e('0x3f')],qs[_0xda2e('0x2d')](_0x21a142['query']['fields']));_0x5a0948[_0xda2e('0x2c')]=_0x5a0948[_0xda2e('0x2c')][_0xda2e('0x40')]?_0x5a0948[_0xda2e('0x2c')]:_0x168afb[_0xda2e('0x3f')];if(_0x21a142[_0xda2e('0x26')][_0xda2e('0x41')]){_0x5a0948['include']=[{'all':!![]}];}_0x5a0948=_['merge']({},_0x5a0948,_0x21a142['options']);return db[_0xda2e('0x24')]['find'](_0x5a0948)['then'](handleEntityNotFound(_0x171eda,null))[_0xda2e('0x1f')](respondWithResult(_0x171eda,null))['catch'](handleError(_0x171eda,null));};exports['create']=function(_0xb5d39e,_0x1e4e3c){return db[_0xda2e('0x24')]['create'](_0xb5d39e[_0xda2e('0x42')],{})[_0xda2e('0x1f')](respondWithResult(_0x1e4e3c,0xc9))['catch'](handleError(_0x1e4e3c,null));};exports['update']=function(_0x871dc6,_0x131576){if(_0x871dc6[_0xda2e('0x42')]['id']){delete _0x871dc6[_0xda2e('0x42')]['id'];}return db[_0xda2e('0x24')]['find']({'where':{'id':_0x871dc6[_0xda2e('0x3e')]['id']}})[_0xda2e('0x1f')](handleEntityNotFound(_0x131576,null))['then'](saveUpdates(_0x871dc6[_0xda2e('0x42')],null))[_0xda2e('0x1f')](respondWithResult(_0x131576,null))[_0xda2e('0x3c')](handleError(_0x131576,null));};exports[_0xda2e('0x20')]=function(_0x2f7426,_0x78b807){return db[_0xda2e('0x24')][_0xda2e('0x43')]({'where':{'id':_0x2f7426[_0xda2e('0x3e')]['id']}})['then'](handleEntityNotFound(_0x78b807,null))[_0xda2e('0x1f')](removeEntity(_0x78b807,null))['catch'](handleError(_0x78b807,null));};exports[_0xda2e('0x44')]=function(_0x189bdf,_0x405342){return db['FaxQueue'][_0xda2e('0x44')]()[_0xda2e('0x1f')](respondWithResult(_0x405342,null))[_0xda2e('0x3c')](handleError(_0x405342,null));};exports[_0xda2e('0x45')]=function(_0x11c724,_0xe21be2,_0x11882c){var _0x5c5e6f={'raw':!![],'where':{}},_0x537ff7={},_0x31fe15;return db[_0xda2e('0x24')][_0xda2e('0x46')]({'where':{'id':_0x11c724[_0xda2e('0x3e')]['id']}})[_0xda2e('0x1f')](handleEntityNotFound(_0xe21be2,null))['then'](function(_0x111068){if(_0x111068){_0x31fe15=_0x111068[_0xda2e('0x47')]({'plain':!![]});_0x537ff7['model']=_['keys'](db[_0xda2e('0x48')][_0xda2e('0x25')]);_0x537ff7[_0xda2e('0x26')]=_[_0xda2e('0x29')](_0x11c724['query']);_0x537ff7[_0xda2e('0x2a')]=_[_0xda2e('0x2b')](_0x537ff7['model'],_0x537ff7[_0xda2e('0x26')]);_0x5c5e6f[_0xda2e('0x2c')]=_[_0xda2e('0x2b')](_0x537ff7[_0xda2e('0x3f')],qs[_0xda2e('0x2d')](_0x11c724[_0xda2e('0x26')][_0xda2e('0x2d')]));_0x5c5e6f['attributes']=_0x5c5e6f[_0xda2e('0x2c')][_0xda2e('0x40')]?_0x5c5e6f['attributes']:_0x537ff7[_0xda2e('0x3f')];if(!_0x11c724['query'][_0xda2e('0x49')](_0xda2e('0x2e'))){_0x5c5e6f['limit']=qs[_0xda2e('0x1b')](_0x11c724['query'][_0xda2e('0x1b')]);_0x5c5e6f[_0xda2e('0x2f')]=qs['offset'](_0x11c724[_0xda2e('0x26')][_0xda2e('0x2f')]);}_0x5c5e6f['order']=qs['sort'](_0x11c724[_0xda2e('0x26')]['sort']);_0x5c5e6f[_0xda2e('0x32')]=qs['filters'](_[_0xda2e('0x4a')](_0x11c724[_0xda2e('0x26')],_0x537ff7[_0xda2e('0x2a')]));_0x5c5e6f['where'][_0xda2e('0x4b')]=_0x111068['id'];if(_0x11c724['query'][_0xda2e('0x36')]){_0x5c5e6f[_0xda2e('0x32')]=_['merge'](_0x5c5e6f[_0xda2e('0x32')],{'$or':_[_0xda2e('0x4c')](_0x5c5e6f[_0xda2e('0x2c')],function(_0x5b93f4){var _0x446cc6={};_0x446cc6[_0x5b93f4]={'$like':'%'+_0x11c724[_0xda2e('0x26')][_0xda2e('0x36')]+'%'};return _0x446cc6;})});}_0x5c5e6f=_['merge']({},_0x5c5e6f,_0x11c724[_0xda2e('0x37')]);return db[_0xda2e('0x48')][_0xda2e('0x3a')](_0x5c5e6f);}})[_0xda2e('0x1f')](function(_0x5b9120){if(_0x5b9120){return db[_0xda2e('0x4d')]['findAndCountAll']({'where':{'id':_[_0xda2e('0x4c')](_0x5b9120,'UserId'),'role':_0xda2e('0x4e')},'attributes':['id',_0xda2e('0x21'),'faxPause',_0xda2e('0x4f'),'createdAt']});}})[_0xda2e('0x1f')](function(_0x1d1215){if(_0x1d1215){return{'count':_0x1d1215[_0xda2e('0x38')],'rows':_[_0xda2e('0x4c')](_0x1d1215[_0xda2e('0x3b')],function(_0x535a7b){return{'membername':_0x535a7b[_0xda2e('0x21')],'UserId':_0x535a7b['id'],'queue_name':_0x31fe15['name'],'FaxQueueId':_0x31fe15['id'],'interface':util[_0xda2e('0x50')](_0xda2e('0x51'),_0xda2e('0x52'),_0x535a7b[_0xda2e('0x21')]),'penalty':0x0,'paused':_0x535a7b[_0xda2e('0x53')],'createdAt':_0x535a7b[_0xda2e('0x54')],'updatedAt':_0x535a7b[_0xda2e('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xda2e('0x1f')](respondWithFilteredResult(_0xe21be2,_0x5c5e6f))[_0xda2e('0x3c')](handleError(_0xe21be2,null));};exports[_0xda2e('0x55')]=function(_0x2b0ddd,_0x4591e2,_0x3d5e7b){var _0x92be18={};var _0x349bbd={};var _0x482a0f;var _0x5c9bc6;return db[_0xda2e('0x24')]['findOne']({'where':{'id':_0x2b0ddd[_0xda2e('0x3e')]['id']}})[_0xda2e('0x1f')](handleEntityNotFound(_0x4591e2,null))[_0xda2e('0x1f')](function(_0x4ae418){if(_0x4ae418){_0x482a0f=_0x4ae418;_0x349bbd[_0xda2e('0x3f')]=_[_0xda2e('0x29')](db[_0xda2e('0x56')][_0xda2e('0x25')]);_0x349bbd['query']=_[_0xda2e('0x29')](_0x2b0ddd[_0xda2e('0x26')]);_0x349bbd[_0xda2e('0x2a')]=_['intersection'](_0x349bbd['model'],_0x349bbd[_0xda2e('0x26')]);_0x92be18[_0xda2e('0x2c')]=_[_0xda2e('0x2b')](_0x349bbd[_0xda2e('0x3f')],qs[_0xda2e('0x2d')](_0x2b0ddd[_0xda2e('0x26')][_0xda2e('0x2d')]));_0x92be18[_0xda2e('0x2c')]=_0x92be18[_0xda2e('0x2c')][_0xda2e('0x40')]?_0x92be18['attributes']:_0x349bbd[_0xda2e('0x3f')];_0x92be18[_0xda2e('0x30')]=qs[_0xda2e('0x31')](_0x2b0ddd[_0xda2e('0x26')][_0xda2e('0x31')]);_0x92be18['where']=qs['filters'](_['pick'](_0x2b0ddd[_0xda2e('0x26')],_0x349bbd[_0xda2e('0x2a')]));if(_0x2b0ddd[_0xda2e('0x26')][_0xda2e('0x36')]){_0x92be18[_0xda2e('0x32')]=_[_0xda2e('0x35')](_0x92be18[_0xda2e('0x32')],{'$or':_['map'](_0x92be18['attributes'],function(_0x26e9c8){var _0x5489e4={};_0x5489e4[_0x26e9c8]={'$like':'%'+_0x2b0ddd[_0xda2e('0x26')]['filter']+'%'};return _0x5489e4;})});}_0x92be18=_[_0xda2e('0x35')]({},_0x92be18,_0x2b0ddd[_0xda2e('0x37')]);return _0x482a0f[_0xda2e('0x55')](_0x92be18);}})[_0xda2e('0x1f')](function(_0x5b0dd3){if(_0x5b0dd3){_0x5c9bc6=_0x5b0dd3[_0xda2e('0x40')];if(!_0x2b0ddd[_0xda2e('0x26')][_0xda2e('0x49')](_0xda2e('0x2e'))){_0x92be18['limit']=qs[_0xda2e('0x1b')](_0x2b0ddd[_0xda2e('0x26')][_0xda2e('0x1b')]);_0x92be18[_0xda2e('0x2f')]=qs[_0xda2e('0x2f')](_0x2b0ddd[_0xda2e('0x26')][_0xda2e('0x2f')]);}return _0x482a0f[_0xda2e('0x55')](_0x92be18);}})[_0xda2e('0x1f')](function(_0x4a068d){if(_0x4a068d){return _0x4a068d?{'count':_0x5c9bc6,'rows':_0x4a068d}:null;}})[_0xda2e('0x1f')](respondWithResult(_0x4591e2,null))['catch'](handleError(_0x4591e2,null));};exports['addTeams']=function(_0x51f406,_0x17808b,_0x14bfeb){var _0x417962=[];var _0x411b01;return db[_0xda2e('0x56')][_0xda2e('0x3a')]({'where':{'id':_0x51f406['body'][_0xda2e('0x57')]},'attributes':['id'],'include':[{'model':db[_0xda2e('0x4d')],'as':_0xda2e('0x58'),'attributes':['id'],'raw':!![]}]})[_0xda2e('0x1f')](function(_0x122a3c){if(_0x122a3c){for(var _0x226b88=0x0;_0x226b88<_0x122a3c['length'];_0x226b88+=0x1){for(var _0x48d7a5=0x0;_0x48d7a5<_0x122a3c[_0x226b88][_0xda2e('0x58')][_0xda2e('0x40')];_0x48d7a5+=0x1){_0x417962=_[_0xda2e('0x59')](_0x417962,[_0x122a3c[_0x226b88][_0xda2e('0x58')][_0x48d7a5]['id']]);}}return _0x417962;}})[_0xda2e('0x1f')](function(_0x4c63f1){if(_0x4c63f1){return db['FaxQueue'][_0xda2e('0x43')]({'where':{'id':_0x51f406[_0xda2e('0x3e')]['id']}});}})[_0xda2e('0x1f')](function(_0x1ae6eb){if(_0x1ae6eb){_0x411b01=_0x1ae6eb;return _0x411b01[_0xda2e('0x5a')](_0x417962,{'penalty':_0x51f406[_0xda2e('0x42')]['penalty']});}})[_0xda2e('0x1f')](function(_0x184280){if(_0x184280){return _0x411b01['addTeams'](_0x51f406[_0xda2e('0x42')]['ids']);}})[_0xda2e('0x1f')](handleEntityNotFound(_0x17808b,null))[_0xda2e('0x1f')](respondWithStatusCode(_0x17808b,null))[_0xda2e('0x3c')](handleError(_0x17808b,null));};exports[_0xda2e('0x5b')]=function(_0x42b183,_0x219dfd,_0x1bbae8){var _0x5295ce=[];var _0x34ca1f;return db['Team'][_0xda2e('0x3a')]({'where':{'id':_0x42b183['query'][_0xda2e('0x57')]},'attributes':['id'],'include':[{'model':db[_0xda2e('0x4d')],'as':_0xda2e('0x58'),'attributes':['id'],'raw':!![]}]})[_0xda2e('0x1f')](function(_0x21a061){if(_0x21a061){for(var _0x47bc6b=0x0;_0x47bc6b<_0x21a061[_0xda2e('0x40')];_0x47bc6b+=0x1){for(var _0x28d6e5=0x0;_0x28d6e5<_0x21a061[_0x47bc6b][_0xda2e('0x58')][_0xda2e('0x40')];_0x28d6e5+=0x1){_0x5295ce=_[_0xda2e('0x59')](_0x5295ce,[_0x21a061[_0x47bc6b][_0xda2e('0x58')][_0x28d6e5]['id']]);}}return _0x5295ce;}})[_0xda2e('0x1f')](function(_0x5ef573){if(_0x5ef573){return db['FaxQueue'][_0xda2e('0x43')]({'where':{'id':_0x42b183[_0xda2e('0x3e')]['id']}});}})['then'](function(_0x310e30){if(_0x310e30){_0x34ca1f=_0x310e30;return _0x34ca1f[_0xda2e('0x5c')](_0x5295ce);}})[_0xda2e('0x1f')](function(_0x2ee868){if(_0x34ca1f){return _0x34ca1f['removeTeams'](_0x42b183[_0xda2e('0x26')]['ids']);}})[_0xda2e('0x1f')](handleEntityNotFound(_0x219dfd,null))[_0xda2e('0x1f')](respondWithStatusCode(_0x219dfd,null))['catch'](handleError(_0x219dfd,null));};exports[_0xda2e('0x5a')]=function(_0xcb773,_0x155220,_0x3bd4d7){return db[_0xda2e('0x24')][_0xda2e('0x43')]({'where':{'id':_0xcb773['params']['id']}})[_0xda2e('0x1f')](handleEntityNotFound(_0x155220,null))[_0xda2e('0x1f')](function(_0x20173e){if(_0x20173e){return _0x20173e[_0xda2e('0x5a')](_0xcb773[_0xda2e('0x42')][_0xda2e('0x57')],_[_0xda2e('0x5d')](_0xcb773[_0xda2e('0x42')],[_0xda2e('0x57'),'id'])||{})[_0xda2e('0x5e')](function(_0x161bcd){for(var _0x1eee6e=0x0;_0x1eee6e<_0xcb773[_0xda2e('0x42')][_0xda2e('0x57')]['length'];_0x1eee6e+=0x1){socket[_0xda2e('0x5f')](_0xda2e('0x60'),{'UserId':_0xcb773[_0xda2e('0x42')][_0xda2e('0x57')][_0x1eee6e],'FaxQueueId':_0xcb773[_0xda2e('0x3e')]['id']});}return _0x161bcd;});}})['then'](respondWithResult(_0x155220,null))['catch'](handleError(_0x155220,null));};exports[_0xda2e('0x5c')]=function(_0x5db17d,_0x5c7cae,_0x2411c5){var _0x5b1f38;return db[_0xda2e('0x24')][_0xda2e('0x43')]({'where':{'id':_0x5db17d[_0xda2e('0x3e')]['id']}})[_0xda2e('0x1f')](handleEntityNotFound(_0x5c7cae,null))[_0xda2e('0x1f')](function(_0x17f2b6){if(_0x17f2b6){return _0x17f2b6[_0xda2e('0x5c')](_0x5db17d[_0xda2e('0x26')][_0xda2e('0x57')])['then'](function(_0x11200d){if(_[_0xda2e('0x61')](_0x5db17d['query'][_0xda2e('0x57')])){for(var _0x4c15e7=0x0;_0x4c15e7<_0x5db17d[_0xda2e('0x26')][_0xda2e('0x57')][_0xda2e('0x40')];_0x4c15e7+=0x1){socket['emit'](_0xda2e('0x62'),{'UserId':_0x5db17d[_0xda2e('0x26')][_0xda2e('0x57')][_0x4c15e7],'FaxQueueId':_0x5db17d[_0xda2e('0x3e')]['id']});}}else{socket[_0xda2e('0x5f')](_0xda2e('0x62'),{'UserId':_0x5db17d[_0xda2e('0x26')][_0xda2e('0x57')],'FaxQueueId':_0x5db17d[_0xda2e('0x3e')]['id']});}});}})[_0xda2e('0x1f')](respondWithStatusCode(_0x5c7cae,null))['catch'](handleError(_0x5c7cae,null));};exports[_0xda2e('0x63')]=function(_0x33d52e,_0x58622c,_0x3fb20c){var _0xc4f8c6={};var _0x759e3d={};var _0x305f98;var _0x588e89;return db[_0xda2e('0x24')][_0xda2e('0x46')]({'where':{'id':_0x33d52e['params']['id']}})['then'](handleEntityNotFound(_0x58622c,null))[_0xda2e('0x1f')](function(_0x2ed335){if(_0x2ed335){_0x305f98=_0x2ed335;_0x759e3d[_0xda2e('0x3f')]=_[_0xda2e('0x29')](db[_0xda2e('0x4d')][_0xda2e('0x25')]);_0x759e3d['query']=_[_0xda2e('0x29')](_0x33d52e[_0xda2e('0x26')]);_0x759e3d[_0xda2e('0x2a')]=_[_0xda2e('0x2b')](_0x759e3d['model'],_0x759e3d[_0xda2e('0x26')]);_0xc4f8c6[_0xda2e('0x2c')]=_[_0xda2e('0x2b')](_0x759e3d['model'],qs[_0xda2e('0x2d')](_0x33d52e[_0xda2e('0x26')]['fields']));_0xc4f8c6['attributes']=_0xc4f8c6[_0xda2e('0x2c')][_0xda2e('0x40')]?_0xc4f8c6[_0xda2e('0x2c')]:_0x759e3d['model'];_0xc4f8c6[_0xda2e('0x30')]=qs[_0xda2e('0x31')](_0x33d52e[_0xda2e('0x26')][_0xda2e('0x31')]);_0xc4f8c6['where']=qs[_0xda2e('0x2a')](_[_0xda2e('0x4a')](_0x33d52e[_0xda2e('0x26')],_0x759e3d[_0xda2e('0x2a')]));if(_0x33d52e[_0xda2e('0x26')]['filter']){_0xc4f8c6[_0xda2e('0x32')]=_[_0xda2e('0x35')](_0xc4f8c6['where'],{'$or':_['map'](_0xc4f8c6[_0xda2e('0x2c')],function(_0x2ab387){var _0x5da8b2={};_0x5da8b2[_0x2ab387]={'$like':'%'+_0x33d52e[_0xda2e('0x26')]['filter']+'%'};return _0x5da8b2;})});}_0xc4f8c6=_[_0xda2e('0x35')]({},_0xc4f8c6,_0x33d52e[_0xda2e('0x37')]);return _0x305f98[_0xda2e('0x63')](_0xc4f8c6);}})[_0xda2e('0x1f')](function(_0x39bfc4){if(_0x39bfc4){_0x588e89=_0x39bfc4[_0xda2e('0x40')];if(!_0x33d52e[_0xda2e('0x26')][_0xda2e('0x49')](_0xda2e('0x2e'))){_0xc4f8c6[_0xda2e('0x1b')]=qs[_0xda2e('0x1b')](_0x33d52e[_0xda2e('0x26')]['limit']);_0xc4f8c6[_0xda2e('0x2f')]=qs[_0xda2e('0x2f')](_0x33d52e[_0xda2e('0x26')]['offset']);}return _0x305f98[_0xda2e('0x63')](_0xc4f8c6);}})[_0xda2e('0x1f')](function(_0x32faa5){if(_0x32faa5){return _0x32faa5?{'count':_0x588e89,'rows':_0x32faa5}:null;}})[_0xda2e('0x1f')](respondWithResult(_0x58622c,null))[_0xda2e('0x3c')](handleError(_0x58622c,null));}; \ No newline at end of file +var _0xce1a=['moment','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','json','count','offset','limit','set','apply','save','update','then','destroy','end','error','stack','name','send','index','FaxQueue','model','keys','dateStart','query','dateEnd','filters','intersection','attributes','fields','nolimit','order','sort','where','add','day','merge','filter','map','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','describe','getMembers','findOne','UserFaxQueue','length','pick','FaxQueueId','User','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','hasOwnProperty','addTeams','ids','Agents','addAgents','penalty','removeTeams','union','removeAgents','omit','spread','emit','isArray','userFaxQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch'];(function(_0x3e889e,_0x1384d8){var _0x25c360=function(_0x3bc82a){while(--_0x3bc82a){_0x3e889e['push'](_0x3e889e['shift']());}};_0x25c360(++_0x1384d8);}(_0xce1a,0x1a9));var _0xace1=function(_0x119c38,_0xd4b3aa){_0x119c38=_0x119c38-0x0;var _0x5ba417=_0xce1a[_0x119c38];return _0x5ba417;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xace1('0x0'));var zipdir=require(_0xace1('0x1'));var jsonpatch=require(_0xace1('0x2'));var rp=require('request-promise');var moment=require(_0xace1('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xace1('0x4'));var path=require('path');var sox=require(_0xace1('0x5'));var csv=require(_0xace1('0x6'));var ejs=require(_0xace1('0x7'));var fs=require('fs');var _=require(_0xace1('0x8'));var squel=require(_0xace1('0x9'));var crypto=require('crypto');var jsforce=require(_0xace1('0xa'));var deskjs=require(_0xace1('0xb'));var toCsv=require(_0xace1('0x6'));var querystring=require(_0xace1('0xc'));var Papa=require('papaparse');var Redis=require(_0xace1('0xd'));var qs=require('../../components/parsers/qs');var logger=require(_0xace1('0xe'))(_0xace1('0xf'));var utils=require(_0xace1('0x10'));var config=require(_0xace1('0x11'));var db=require(_0xace1('0x12'))['db'];config[_0xace1('0x13')]=_[_0xace1('0x14')](config[_0xace1('0x13')],{'host':_0xace1('0x15'),'port':0x18eb});var socket=require(_0xace1('0x16'))(new Redis(config[_0xace1('0x13')]));require(_0xace1('0x17'))[_0xace1('0x18')](socket);function respondWithStatusCode(_0x57c6cb,_0x609559){_0x609559=_0x609559||0xcc;return function(_0x5ee30e){if(_0x5ee30e){return _0x57c6cb[_0xace1('0x19')](_0x609559);}return _0x57c6cb['status'](_0x609559)['end']();};}function respondWithResult(_0x2a8f9d,_0x493c7a){_0x493c7a=_0x493c7a||0xc8;return function(_0x3dc11d){if(_0x3dc11d){return _0x2a8f9d[_0xace1('0x1a')](_0x493c7a)[_0xace1('0x1b')](_0x3dc11d);}};}function respondWithFilteredResult(_0x130a50,_0xa4ca5b){return function(_0x2f24e5){if(_0x2f24e5){var _0x21771f=_0x2f24e5[_0xace1('0x1c')],_0x3da69e=_0xa4ca5b['offset'],_0x397b9e=_0xa4ca5b[_0xace1('0x1d')]+_0xa4ca5b[_0xace1('0x1e')],_0x316850;if(_0x397b9e>=_0x21771f){_0x397b9e=_0x21771f;_0x316850=0xc8;}else{_0x316850=0xce;}_0x130a50[_0xace1('0x1a')](_0x316850);return _0x130a50[_0xace1('0x1f')]('Content-Range',_0x3da69e+'-'+_0x397b9e+'/'+_0x21771f)['json'](_0x2f24e5);}return null;};}function patchUpdates(_0x3469cc){return function(_0x73164f){try{jsonpatch[_0xace1('0x20')](_0x73164f,_0x3469cc,!![]);}catch(_0x23c68c){return BPromise['reject'](_0x23c68c);}return _0x73164f[_0xace1('0x21')]();};}function saveUpdates(_0x21e083,_0x2529c3){return function(_0x38003d){if(_0x38003d){return _0x38003d[_0xace1('0x22')](_0x21e083)[_0xace1('0x23')](function(_0x59a738){return _0x59a738;});}return null;};}function removeEntity(_0x8722a5,_0x505db3){return function(_0x10426c){if(_0x10426c){return _0x10426c[_0xace1('0x24')]()[_0xace1('0x23')](function(){_0x8722a5[_0xace1('0x1a')](0xcc)[_0xace1('0x25')]();});}};}function handleEntityNotFound(_0x3739a1,_0x5c183d){return function(_0x6d82c0){if(!_0x6d82c0){_0x3739a1['sendStatus'](0x194);}return _0x6d82c0;};}function handleError(_0x555035,_0x5cfa06){_0x5cfa06=_0x5cfa06||0x1f4;return function(_0x58cfc5){logger[_0xace1('0x26')](_0x58cfc5[_0xace1('0x27')]);if(_0x58cfc5[_0xace1('0x28')]){delete _0x58cfc5[_0xace1('0x28')];}_0x555035[_0xace1('0x1a')](_0x5cfa06)[_0xace1('0x29')](_0x58cfc5);};}exports[_0xace1('0x2a')]=function(_0x37cc3c,_0x295d72){var _0x198f5c={},_0x3453a2={},_0x4a836d={'count':0x0,'rows':[]};var _0x25dd03=db[_0xace1('0x2b')]['rawAttributes'];_0x3453a2[_0xace1('0x2c')]=_[_0xace1('0x2d')](_0x25dd03);var _0x28adac={'dateStart':_0x37cc3c['query'][_0xace1('0x2e')],'dateEnd':_0x37cc3c[_0xace1('0x2f')][_0xace1('0x30')]};delete _0x37cc3c[_0xace1('0x2f')][_0xace1('0x2e')];delete _0x37cc3c[_0xace1('0x2f')][_0xace1('0x30')];_0x3453a2[_0xace1('0x2f')]=_[_0xace1('0x2d')](_0x37cc3c[_0xace1('0x2f')]);_0x3453a2[_0xace1('0x31')]=_[_0xace1('0x32')](_0x3453a2[_0xace1('0x2c')],_0x3453a2[_0xace1('0x2f')]);_0x198f5c[_0xace1('0x33')]=_[_0xace1('0x32')](_0x3453a2[_0xace1('0x2c')],qs['fields'](_0x37cc3c[_0xace1('0x2f')][_0xace1('0x34')]));_0x198f5c[_0xace1('0x33')]=_0x198f5c['attributes']['length']?_0x198f5c[_0xace1('0x33')]:_0x3453a2[_0xace1('0x2c')];if(!_0x37cc3c['query']['hasOwnProperty'](_0xace1('0x35'))){_0x198f5c['limit']=qs[_0xace1('0x1e')](_0x37cc3c[_0xace1('0x2f')][_0xace1('0x1e')]);_0x198f5c[_0xace1('0x1d')]=qs[_0xace1('0x1d')](_0x37cc3c['query'][_0xace1('0x1d')]);}_0x198f5c[_0xace1('0x36')]=qs['sort'](_0x37cc3c[_0xace1('0x2f')][_0xace1('0x37')]);_0x198f5c[_0xace1('0x38')]=qs['filters'](_['pick'](_0x37cc3c[_0xace1('0x2f')],_0x3453a2[_0xace1('0x31')]));if(_0x28adac['dateStart']){if(_0x28adac[_0xace1('0x30')]){_0x28adac[_0xace1('0x30')]=moment(_0x28adac['dateEnd'])[_0xace1('0x39')](0x1,_0xace1('0x3a'));}else{_0x28adac[_0xace1('0x30')]=moment(_0x28adac['dateStart'])[_0xace1('0x39')](0x1,_0xace1('0x3a'));}_[_0xace1('0x3b')](_0x198f5c['where'],{'createdAt':{'$gte':_0x28adac[_0xace1('0x2e')],'$lte':_0x28adac[_0xace1('0x30')]}});}if(_0x37cc3c[_0xace1('0x2f')][_0xace1('0x3c')]){_0x198f5c[_0xace1('0x38')]=_[_0xace1('0x3b')](_0x198f5c['where'],{'$or':_[_0xace1('0x3d')](_0x198f5c['attributes'],function(_0x511932){var _0x5e61fb={};_0x5e61fb[_0x511932]={'$like':'%'+_0x37cc3c[_0xace1('0x2f')][_0xace1('0x3c')]+'%'};return _0x5e61fb;})});}_0x198f5c=_[_0xace1('0x3b')]({},_0x198f5c,_0x37cc3c[_0xace1('0x3e')]);var _0x3b275a={'where':_0x198f5c[_0xace1('0x38')]};return db[_0xace1('0x2b')]['count'](_0x3b275a)[_0xace1('0x23')](function(_0x4b60bf){_0x4a836d[_0xace1('0x1c')]=_0x4b60bf;if(_0x37cc3c[_0xace1('0x2f')][_0xace1('0x3f')]){_0x198f5c['include']=[{'all':!![]}];}return db[_0xace1('0x2b')][_0xace1('0x40')](_0x198f5c);})['then'](function(_0x47f298){_0x4a836d[_0xace1('0x41')]=_0x47f298;return _0x4a836d;})[_0xace1('0x23')](respondWithFilteredResult(_0x295d72,_0x198f5c))[_0xace1('0x42')](handleError(_0x295d72,null));};exports[_0xace1('0x43')]=function(_0x4dfa49,_0x5f0e44){var _0x107b91={'raw':!![],'where':{'id':_0x4dfa49[_0xace1('0x44')]['id']}},_0x3a60a9={};_0x3a60a9[_0xace1('0x2c')]=_['keys'](db[_0xace1('0x2b')][_0xace1('0x45')]);_0x3a60a9[_0xace1('0x2f')]=_['keys'](_0x4dfa49[_0xace1('0x2f')]);_0x3a60a9['filters']=_[_0xace1('0x32')](_0x3a60a9[_0xace1('0x2c')],_0x3a60a9[_0xace1('0x2f')]);_0x107b91[_0xace1('0x33')]=_[_0xace1('0x32')](_0x3a60a9[_0xace1('0x2c')],qs['fields'](_0x4dfa49[_0xace1('0x2f')][_0xace1('0x34')]));_0x107b91[_0xace1('0x33')]=_0x107b91[_0xace1('0x33')]['length']?_0x107b91['attributes']:_0x3a60a9[_0xace1('0x2c')];if(_0x4dfa49['query']['includeAll']){_0x107b91[_0xace1('0x46')]=[{'all':!![]}];}_0x107b91=_[_0xace1('0x3b')]({},_0x107b91,_0x4dfa49[_0xace1('0x3e')]);return db['FaxQueue'][_0xace1('0x47')](_0x107b91)[_0xace1('0x23')](handleEntityNotFound(_0x5f0e44,null))[_0xace1('0x23')](respondWithResult(_0x5f0e44,null))[_0xace1('0x42')](handleError(_0x5f0e44,null));};exports['create']=function(_0x1bf4f6,_0x5de79a){return db[_0xace1('0x2b')][_0xace1('0x48')](_0x1bf4f6['body'],{})['then'](respondWithResult(_0x5de79a,0xc9))[_0xace1('0x42')](handleError(_0x5de79a,null));};exports[_0xace1('0x22')]=function(_0xe5e084,_0x3bd6fa){if(_0xe5e084[_0xace1('0x49')]['id']){delete _0xe5e084['body']['id'];}return db['FaxQueue'][_0xace1('0x47')]({'where':{'id':_0xe5e084['params']['id']}})[_0xace1('0x23')](handleEntityNotFound(_0x3bd6fa,null))[_0xace1('0x23')](saveUpdates(_0xe5e084[_0xace1('0x49')],null))[_0xace1('0x23')](respondWithResult(_0x3bd6fa,null))[_0xace1('0x42')](handleError(_0x3bd6fa,null));};exports[_0xace1('0x24')]=function(_0x349b27,_0x426e0f){return db[_0xace1('0x2b')][_0xace1('0x47')]({'where':{'id':_0x349b27[_0xace1('0x44')]['id']}})[_0xace1('0x23')](handleEntityNotFound(_0x426e0f,null))[_0xace1('0x23')](removeEntity(_0x426e0f,null))[_0xace1('0x42')](handleError(_0x426e0f,null));};exports[_0xace1('0x4a')]=function(_0x1795b4,_0x432772){return db[_0xace1('0x2b')]['describe']()[_0xace1('0x23')](respondWithResult(_0x432772,null))[_0xace1('0x42')](handleError(_0x432772,null));};exports[_0xace1('0x4b')]=function(_0x54f690,_0x503b4d,_0x2b3f76){var _0x4bc3cd={'raw':!![],'where':{}},_0x1f04a4={},_0x5c7018;return db['FaxQueue'][_0xace1('0x4c')]({'where':{'id':_0x54f690[_0xace1('0x44')]['id']}})['then'](handleEntityNotFound(_0x503b4d,null))[_0xace1('0x23')](function(_0x4b72e7){if(_0x4b72e7){_0x5c7018=_0x4b72e7['get']({'plain':!![]});_0x1f04a4[_0xace1('0x2c')]=_[_0xace1('0x2d')](db[_0xace1('0x4d')]['rawAttributes']);_0x1f04a4[_0xace1('0x2f')]=_[_0xace1('0x2d')](_0x54f690['query']);_0x1f04a4[_0xace1('0x31')]=_[_0xace1('0x32')](_0x1f04a4['model'],_0x1f04a4['query']);_0x4bc3cd[_0xace1('0x33')]=_[_0xace1('0x32')](_0x1f04a4[_0xace1('0x2c')],qs['fields'](_0x54f690[_0xace1('0x2f')]['fields']));_0x4bc3cd[_0xace1('0x33')]=_0x4bc3cd['attributes'][_0xace1('0x4e')]?_0x4bc3cd[_0xace1('0x33')]:_0x1f04a4['model'];if(!_0x54f690['query']['hasOwnProperty'](_0xace1('0x35'))){_0x4bc3cd[_0xace1('0x1e')]=qs['limit'](_0x54f690[_0xace1('0x2f')]['limit']);_0x4bc3cd[_0xace1('0x1d')]=qs[_0xace1('0x1d')](_0x54f690['query']['offset']);}_0x4bc3cd[_0xace1('0x36')]=qs[_0xace1('0x37')](_0x54f690[_0xace1('0x2f')][_0xace1('0x37')]);_0x4bc3cd['where']=qs[_0xace1('0x31')](_[_0xace1('0x4f')](_0x54f690['query'],_0x1f04a4[_0xace1('0x31')]));_0x4bc3cd[_0xace1('0x38')][_0xace1('0x50')]=_0x4b72e7['id'];if(_0x54f690['query'][_0xace1('0x3c')]){_0x4bc3cd['where']=_[_0xace1('0x3b')](_0x4bc3cd['where'],{'$or':_[_0xace1('0x3d')](_0x4bc3cd[_0xace1('0x33')],function(_0x43000e){var _0x10562c={};_0x10562c[_0x43000e]={'$like':'%'+_0x54f690[_0xace1('0x2f')]['filter']+'%'};return _0x10562c;})});}_0x4bc3cd=_[_0xace1('0x3b')]({},_0x4bc3cd,_0x54f690['options']);return db[_0xace1('0x4d')][_0xace1('0x40')](_0x4bc3cd);}})[_0xace1('0x23')](function(_0x36dc65){if(_0x36dc65){return db[_0xace1('0x51')]['findAndCountAll']({'where':{'id':_[_0xace1('0x3d')](_0x36dc65,_0xace1('0x52')),'role':_0xace1('0x53')},'attributes':['id',_0xace1('0x28'),_0xace1('0x54'),_0xace1('0x55'),_0xace1('0x56')]});}})['then'](function(_0x5cb6c1){if(_0x5cb6c1){return{'count':_0x5cb6c1['count'],'rows':_['map'](_0x5cb6c1[_0xace1('0x41')],function(_0x4dcebf){return{'membername':_0x4dcebf[_0xace1('0x28')],'UserId':_0x4dcebf['id'],'queue_name':_0x5c7018[_0xace1('0x28')],'FaxQueueId':_0x5c7018['id'],'interface':util[_0xace1('0x57')](_0xace1('0x58'),_0xace1('0x59'),_0x4dcebf[_0xace1('0x28')]),'penalty':0x0,'paused':_0x4dcebf[_0xace1('0x54')],'createdAt':_0x4dcebf[_0xace1('0x56')],'updatedAt':_0x4dcebf['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xace1('0x23')](respondWithFilteredResult(_0x503b4d,_0x4bc3cd))[_0xace1('0x42')](handleError(_0x503b4d,null));};exports[_0xace1('0x5a')]=function(_0x305a20,_0x1808a0,_0x1cf2ee){var _0x5265a2={};var _0x1ce21e={};var _0x5541c7;var _0x2941a4;return db[_0xace1('0x2b')][_0xace1('0x4c')]({'where':{'id':_0x305a20[_0xace1('0x44')]['id']}})[_0xace1('0x23')](handleEntityNotFound(_0x1808a0,null))[_0xace1('0x23')](function(_0x26a366){if(_0x26a366){_0x5541c7=_0x26a366;_0x1ce21e[_0xace1('0x2c')]=_[_0xace1('0x2d')](db[_0xace1('0x5b')][_0xace1('0x45')]);_0x1ce21e[_0xace1('0x2f')]=_[_0xace1('0x2d')](_0x305a20['query']);_0x1ce21e['filters']=_[_0xace1('0x32')](_0x1ce21e['model'],_0x1ce21e[_0xace1('0x2f')]);_0x5265a2[_0xace1('0x33')]=_[_0xace1('0x32')](_0x1ce21e[_0xace1('0x2c')],qs[_0xace1('0x34')](_0x305a20[_0xace1('0x2f')][_0xace1('0x34')]));_0x5265a2[_0xace1('0x33')]=_0x5265a2[_0xace1('0x33')]['length']?_0x5265a2['attributes']:_0x1ce21e['model'];_0x5265a2[_0xace1('0x36')]=qs[_0xace1('0x37')](_0x305a20['query'][_0xace1('0x37')]);_0x5265a2[_0xace1('0x38')]=qs[_0xace1('0x31')](_['pick'](_0x305a20[_0xace1('0x2f')],_0x1ce21e[_0xace1('0x31')]));if(_0x305a20[_0xace1('0x2f')]['filter']){_0x5265a2[_0xace1('0x38')]=_[_0xace1('0x3b')](_0x5265a2[_0xace1('0x38')],{'$or':_[_0xace1('0x3d')](_0x5265a2[_0xace1('0x33')],function(_0x395ac3){var _0xb35cce={};_0xb35cce[_0x395ac3]={'$like':'%'+_0x305a20['query'][_0xace1('0x3c')]+'%'};return _0xb35cce;})});}_0x5265a2=_[_0xace1('0x3b')]({},_0x5265a2,_0x305a20[_0xace1('0x3e')]);return _0x5541c7[_0xace1('0x5a')](_0x5265a2);}})[_0xace1('0x23')](function(_0x3dc553){if(_0x3dc553){_0x2941a4=_0x3dc553['length'];if(!_0x305a20[_0xace1('0x2f')][_0xace1('0x5c')](_0xace1('0x35'))){_0x5265a2[_0xace1('0x1e')]=qs[_0xace1('0x1e')](_0x305a20[_0xace1('0x2f')][_0xace1('0x1e')]);_0x5265a2[_0xace1('0x1d')]=qs[_0xace1('0x1d')](_0x305a20[_0xace1('0x2f')][_0xace1('0x1d')]);}return _0x5541c7[_0xace1('0x5a')](_0x5265a2);}})['then'](function(_0x41d9a1){if(_0x41d9a1){return _0x41d9a1?{'count':_0x2941a4,'rows':_0x41d9a1}:null;}})[_0xace1('0x23')](respondWithResult(_0x1808a0,null))['catch'](handleError(_0x1808a0,null));};exports[_0xace1('0x5d')]=function(_0x5d6c8b,_0x55b491,_0x1db00e){var _0x5b1744=[];var _0x144ebb;return db[_0xace1('0x5b')]['findAll']({'where':{'id':_0x5d6c8b[_0xace1('0x49')][_0xace1('0x5e')]},'attributes':['id'],'include':[{'model':db[_0xace1('0x51')],'as':_0xace1('0x5f'),'attributes':['id'],'raw':!![]}]})[_0xace1('0x23')](function(_0x58e8c6){if(_0x58e8c6){for(var _0x39bb88=0x0;_0x39bb88<_0x58e8c6[_0xace1('0x4e')];_0x39bb88+=0x1){for(var _0x19bdff=0x0;_0x19bdff<_0x58e8c6[_0x39bb88][_0xace1('0x5f')][_0xace1('0x4e')];_0x19bdff+=0x1){_0x5b1744=_['union'](_0x5b1744,[_0x58e8c6[_0x39bb88][_0xace1('0x5f')][_0x19bdff]['id']]);}}return _0x5b1744;}})[_0xace1('0x23')](function(_0x2b4b47){if(_0x2b4b47){return db[_0xace1('0x2b')][_0xace1('0x47')]({'where':{'id':_0x5d6c8b[_0xace1('0x44')]['id']}});}})[_0xace1('0x23')](function(_0x159002){if(_0x159002){_0x144ebb=_0x159002;return _0x144ebb[_0xace1('0x60')](_0x5b1744,{'penalty':_0x5d6c8b[_0xace1('0x49')][_0xace1('0x61')]});}})[_0xace1('0x23')](function(_0x15c44c){if(_0x15c44c){return _0x144ebb[_0xace1('0x5d')](_0x5d6c8b[_0xace1('0x49')][_0xace1('0x5e')]);}})[_0xace1('0x23')](handleEntityNotFound(_0x55b491,null))[_0xace1('0x23')](respondWithStatusCode(_0x55b491,null))[_0xace1('0x42')](handleError(_0x55b491,null));};exports[_0xace1('0x62')]=function(_0x47b778,_0x343d55,_0x294cfc){var _0x2b6167=[];var _0x24f714;return db[_0xace1('0x5b')][_0xace1('0x40')]({'where':{'id':_0x47b778['query'][_0xace1('0x5e')]},'attributes':['id'],'include':[{'model':db[_0xace1('0x51')],'as':_0xace1('0x5f'),'attributes':['id'],'raw':!![]}]})[_0xace1('0x23')](function(_0x1cf6b6){if(_0x1cf6b6){for(var _0x44cf2c=0x0;_0x44cf2c<_0x1cf6b6[_0xace1('0x4e')];_0x44cf2c+=0x1){for(var _0x3629cf=0x0;_0x3629cf<_0x1cf6b6[_0x44cf2c][_0xace1('0x5f')][_0xace1('0x4e')];_0x3629cf+=0x1){_0x2b6167=_[_0xace1('0x63')](_0x2b6167,[_0x1cf6b6[_0x44cf2c][_0xace1('0x5f')][_0x3629cf]['id']]);}}return _0x2b6167;}})[_0xace1('0x23')](function(_0x16e527){if(_0x16e527){return db[_0xace1('0x2b')][_0xace1('0x47')]({'where':{'id':_0x47b778[_0xace1('0x44')]['id']}});}})[_0xace1('0x23')](function(_0x5bf6da){if(_0x5bf6da){_0x24f714=_0x5bf6da;return _0x24f714[_0xace1('0x64')](_0x2b6167);}})['then'](function(_0x195c3a){if(_0x24f714){return _0x24f714['removeTeams'](_0x47b778[_0xace1('0x2f')][_0xace1('0x5e')]);}})[_0xace1('0x23')](handleEntityNotFound(_0x343d55,null))['then'](respondWithStatusCode(_0x343d55,null))[_0xace1('0x42')](handleError(_0x343d55,null));};exports[_0xace1('0x60')]=function(_0x5ebb09,_0x374f32,_0x198d35){return db[_0xace1('0x2b')][_0xace1('0x47')]({'where':{'id':_0x5ebb09[_0xace1('0x44')]['id']}})['then'](handleEntityNotFound(_0x374f32,null))[_0xace1('0x23')](function(_0x92820b){if(_0x92820b){return _0x92820b[_0xace1('0x60')](_0x5ebb09['body']['ids'],_[_0xace1('0x65')](_0x5ebb09[_0xace1('0x49')],['ids','id'])||{})[_0xace1('0x66')](function(_0x310afe){for(var _0x20aaa4=0x0;_0x20aaa4<_0x5ebb09[_0xace1('0x49')]['ids'][_0xace1('0x4e')];_0x20aaa4+=0x1){socket[_0xace1('0x67')]('userFaxQueue:save',{'UserId':_0x5ebb09['body'][_0xace1('0x5e')][_0x20aaa4],'FaxQueueId':_0x5ebb09['params']['id']});}return _0x310afe;});}})[_0xace1('0x23')](respondWithResult(_0x374f32,null))['catch'](handleError(_0x374f32,null));};exports[_0xace1('0x64')]=function(_0x26b01b,_0x427a40,_0x1f1fa7){var _0x5af3e1;return db[_0xace1('0x2b')][_0xace1('0x47')]({'where':{'id':_0x26b01b[_0xace1('0x44')]['id']}})[_0xace1('0x23')](handleEntityNotFound(_0x427a40,null))[_0xace1('0x23')](function(_0x10afb6){if(_0x10afb6){return _0x10afb6[_0xace1('0x64')](_0x26b01b[_0xace1('0x2f')]['ids'])[_0xace1('0x23')](function(_0x11bebb){if(_[_0xace1('0x68')](_0x26b01b[_0xace1('0x2f')]['ids'])){for(var _0x49df37=0x0;_0x49df37<_0x26b01b[_0xace1('0x2f')][_0xace1('0x5e')][_0xace1('0x4e')];_0x49df37+=0x1){socket[_0xace1('0x67')](_0xace1('0x69'),{'UserId':_0x26b01b[_0xace1('0x2f')]['ids'][_0x49df37],'FaxQueueId':_0x26b01b[_0xace1('0x44')]['id']});}}else{socket[_0xace1('0x67')]('userFaxQueue:remove',{'UserId':_0x26b01b[_0xace1('0x2f')]['ids'],'FaxQueueId':_0x26b01b[_0xace1('0x44')]['id']});}});}})[_0xace1('0x23')](respondWithStatusCode(_0x427a40,null))[_0xace1('0x42')](handleError(_0x427a40,null));};exports[_0xace1('0x6a')]=function(_0x55142d,_0x1790a8,_0x58c8dc){var _0x4bbc31={};var _0xcc8ace={};var _0xbdeaf1;var _0x4b61a9;return db[_0xace1('0x2b')][_0xace1('0x4c')]({'where':{'id':_0x55142d[_0xace1('0x44')]['id']}})[_0xace1('0x23')](handleEntityNotFound(_0x1790a8,null))[_0xace1('0x23')](function(_0xf93ed9){if(_0xf93ed9){_0xbdeaf1=_0xf93ed9;_0xcc8ace[_0xace1('0x2c')]=_[_0xace1('0x2d')](db[_0xace1('0x51')][_0xace1('0x45')]);_0xcc8ace[_0xace1('0x2f')]=_[_0xace1('0x2d')](_0x55142d[_0xace1('0x2f')]);_0xcc8ace[_0xace1('0x31')]=_[_0xace1('0x32')](_0xcc8ace[_0xace1('0x2c')],_0xcc8ace[_0xace1('0x2f')]);_0x4bbc31['attributes']=_['intersection'](_0xcc8ace['model'],qs['fields'](_0x55142d[_0xace1('0x2f')][_0xace1('0x34')]));_0x4bbc31[_0xace1('0x33')]=_0x4bbc31[_0xace1('0x33')][_0xace1('0x4e')]?_0x4bbc31[_0xace1('0x33')]:_0xcc8ace['model'];_0x4bbc31['order']=qs[_0xace1('0x37')](_0x55142d[_0xace1('0x2f')][_0xace1('0x37')]);_0x4bbc31[_0xace1('0x38')]=qs[_0xace1('0x31')](_[_0xace1('0x4f')](_0x55142d['query'],_0xcc8ace[_0xace1('0x31')]));if(_0x55142d[_0xace1('0x2f')][_0xace1('0x3c')]){_0x4bbc31[_0xace1('0x38')]=_['merge'](_0x4bbc31[_0xace1('0x38')],{'$or':_['map'](_0x4bbc31[_0xace1('0x33')],function(_0x121f87){var _0x6b7d5f={};_0x6b7d5f[_0x121f87]={'$like':'%'+_0x55142d['query'][_0xace1('0x3c')]+'%'};return _0x6b7d5f;})});}_0x4bbc31=_[_0xace1('0x3b')]({},_0x4bbc31,_0x55142d[_0xace1('0x3e')]);return _0xbdeaf1[_0xace1('0x6a')](_0x4bbc31);}})[_0xace1('0x23')](function(_0x5d5e37){if(_0x5d5e37){_0x4b61a9=_0x5d5e37[_0xace1('0x4e')];if(!_0x55142d[_0xace1('0x2f')][_0xace1('0x5c')](_0xace1('0x35'))){_0x4bbc31[_0xace1('0x1e')]=qs[_0xace1('0x1e')](_0x55142d[_0xace1('0x2f')][_0xace1('0x1e')]);_0x4bbc31[_0xace1('0x1d')]=qs['offset'](_0x55142d[_0xace1('0x2f')]['offset']);}return _0xbdeaf1[_0xace1('0x6a')](_0x4bbc31);}})['then'](function(_0x3acaa7){if(_0x3acaa7){return _0x3acaa7?{'count':_0x4b61a9,'rows':_0x3acaa7}:null;}})[_0xace1('0x23')](respondWithResult(_0x1790a8,null))[_0xace1('0x42')](handleError(_0x1790a8,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 21e3d6d..50347c7 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 _0xa8a8=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners'];(function(_0x1b5fd6,_0x101ec0){var _0x1288f0=function(_0x44a077){while(--_0x44a077){_0x1b5fd6['push'](_0x1b5fd6['shift']());}};_0x1288f0(++_0x101ec0);}(_0xa8a8,0xec));var _0x8a8a=function(_0x4b00fb,_0x4ba721){_0x4b00fb=_0x4b00fb-0x0;var _0x34061b=_0xa8a8[_0x4b00fb];return _0x34061b;};'use strict';var EventEmitter=require(_0x8a8a('0x0'));var FaxQueue=require(_0x8a8a('0x1'))['db'][_0x8a8a('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x8a8a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8a8a('0x4'),'afterDestroy':_0x8a8a('0x5')};function emitEvent(_0xf11a08){return function(_0x3ed1de,_0x45515d,_0x1cecd4){FaxQueueEvents[_0x8a8a('0x6')](_0xf11a08+':'+_0x3ed1de['id'],_0x3ed1de);FaxQueueEvents[_0x8a8a('0x6')](_0xf11a08,_0x3ed1de);_0x1cecd4(null);};}for(var e in events){if(events[_0x8a8a('0x7')](e)){var event=events[e];FaxQueue[_0x8a8a('0x8')](e,emitEvent(event));}}module[_0x8a8a('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0xac9d=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit'];(function(_0x30b094,_0x555417){var _0x4337f3=function(_0x593f40){while(--_0x593f40){_0x30b094['push'](_0x30b094['shift']());}};_0x4337f3(++_0x555417);}(_0xac9d,0x14d));var _0xdac9=function(_0x5887ec,_0x504c12){_0x5887ec=_0x5887ec-0x0;var _0x23b637=_0xac9d[_0x5887ec];return _0x23b637;};'use strict';var EventEmitter=require(_0xdac9('0x0'));var FaxQueue=require(_0xdac9('0x1'))['db'][_0xdac9('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xdac9('0x3')](0x0);var events={'afterCreate':_0xdac9('0x4'),'afterUpdate':_0xdac9('0x5'),'afterDestroy':_0xdac9('0x6')};function emitEvent(_0x1b967e){return function(_0x51a5d7,_0x1c17a6,_0x5a984a){FaxQueueEvents[_0xdac9('0x7')](_0x1b967e+':'+_0x51a5d7['id'],_0x51a5d7);FaxQueueEvents[_0xdac9('0x7')](_0x1b967e,_0x51a5d7);_0x5a984a(null);};}for(var e in events){if(events[_0xdac9('0x8')](e)){var event=events[e];FaxQueue[_0xdac9('0x9')](e,emitEvent(event));}}module[_0xdac9('0xa')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 437ff00..a5a4a2f 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 _0x5225=['moment','request-promise','./faxQueue.attributes','define','FaxQueue','lodash'];(function(_0x57ed46,_0x535c79){var _0x9f475c=function(_0x122c1b){while(--_0x122c1b){_0x57ed46['push'](_0x57ed46['shift']());}};_0x9f475c(++_0x535c79);}(_0x5225,0x77));var _0x5522=function(_0x7cdaf1,_0x40e620){_0x7cdaf1=_0x7cdaf1-0x0;var _0xf58e9a=_0x5225[_0x7cdaf1];return _0xf58e9a;};'use strict';var _=require(_0x5522('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5522('0x1'));var BPromise=require('bluebird');var rp=require(_0x5522('0x2'));var attributes=require(_0x5522('0x3'));module['exports']=function(_0x4098cd,_0xc3e164){return _0x4098cd[_0x5522('0x4')](_0x5522('0x5'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a09=['request-promise','exports','define','FaxQueue','fax_queues','lodash','../../config/logger','moment','bluebird'];(function(_0x213046,_0x292aeb){var _0x49dc60=function(_0x363f70){while(--_0x363f70){_0x213046['push'](_0x213046['shift']());}};_0x49dc60(++_0x292aeb);}(_0x4a09,0xe6));var _0x94a0=function(_0x205856,_0x2e42f6){_0x205856=_0x205856-0x0;var _0x204861=_0x4a09[_0x205856];return _0x204861;};'use strict';var _=require(_0x94a0('0x0'));var util=require('util');var logger=require(_0x94a0('0x1'))('api');var moment=require(_0x94a0('0x2'));var BPromise=require(_0x94a0('0x3'));var rp=require(_0x94a0('0x4'));var attributes=require('./faxQueue.attributes');module[_0x94a0('0x5')]=function(_0x35d73b,_0x5bee54){return _0x35d73b[_0x94a0('0x6')](_0x94a0('0x7'),attributes,{'tableName':_0x94a0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 81509d2..fc607c6 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 _0x2640=['FaxQueue','findAll','options','raw','attributes','limit','include','map','model','ShowFaxQueue','find','where','then','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','GetFaxQueue'];(function(_0x42dc2b,_0x2538a7){var _0x57b32e=function(_0x3455d5){while(--_0x3455d5){_0x42dc2b['push'](_0x42dc2b['shift']());}};_0x57b32e(++_0x2538a7);}(_0x2640,0x17f));var _0x0264=function(_0x5daa16,_0x536cde){_0x5daa16=_0x5daa16-0x0;var _0x3c712e=_0x2640[_0x5daa16];return _0x3c712e;};'use strict';var _=require(_0x0264('0x0'));var util=require('util');var moment=require(_0x0264('0x1'));var BPromise=require('bluebird');var rs=require(_0x0264('0x2'));var fs=require('fs');var Redis=require(_0x0264('0x3'));var db=require(_0x0264('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0264('0x5'))(_0x0264('0x6'));var config=require('../../config/environment');var jayson=require(_0x0264('0x7'));var client=jayson[_0x0264('0x8')][_0x0264('0x9')]({'port':0x232a});config[_0x0264('0xa')]=_[_0x0264('0xb')](config[_0x0264('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0264('0xc'))(new Redis(config[_0x0264('0xa')]));require('./faxQueue.socket')[_0x0264('0xd')](socket);function respondWithRpcPromise(_0x5a0f91,_0x4afb67,_0x20a371){return new BPromise(function(_0x3ff58f,_0x2e9899){return client['request'](_0x5a0f91,_0x20a371)['then'](function(_0x3555ea){logger['info'](_0x0264('0xe'),_0x4afb67,_0x0264('0xf'));logger[_0x0264('0x10')](_0x0264('0x11'),_0x4afb67,_0x0264('0xf'),JSON[_0x0264('0x12')](_0x3555ea));if(_0x3555ea['error']){if(_0x3555ea[_0x0264('0x13')]['code']===0x1f4){logger[_0x0264('0x13')](_0x0264('0xe'),_0x4afb67,_0x3555ea['error'][_0x0264('0x14')]);return _0x2e9899(_0x3555ea[_0x0264('0x13')][_0x0264('0x14')]);}logger['error'](_0x0264('0xe'),_0x4afb67,_0x3555ea['error'][_0x0264('0x14')]);return _0x3ff58f(_0x3555ea[_0x0264('0x13')][_0x0264('0x14')]);}else{logger[_0x0264('0x15')](_0x0264('0xe'),_0x4afb67,_0x0264('0xf'));_0x3ff58f(_0x3555ea['result'][_0x0264('0x14')]);}})[_0x0264('0x16')](function(_0x5c830e){logger[_0x0264('0x13')](_0x0264('0xe'),_0x4afb67,_0x5c830e);_0x2e9899(_0x5c830e);});});}exports[_0x0264('0x17')]=function(_0x5282a7){var _0x327448=this;return new Promise(function(_0x792ec7,_0x4c4f9e){return db[_0x0264('0x18')][_0x0264('0x19')]({'raw':_0x5282a7[_0x0264('0x1a')]?_0x5282a7[_0x0264('0x1a')][_0x0264('0x1b')]===undefined?!![]:![]:!![],'where':_0x5282a7['options']?_0x5282a7[_0x0264('0x1a')]['where']||null:null,'attributes':_0x5282a7['options']?_0x5282a7['options'][_0x0264('0x1c')]||null:null,'limit':_0x5282a7[_0x0264('0x1a')]?_0x5282a7[_0x0264('0x1a')][_0x0264('0x1d')]||null:null,'include':_0x5282a7['options']?_0x5282a7[_0x0264('0x1a')][_0x0264('0x1e')]?_[_0x0264('0x1f')](_0x5282a7[_0x0264('0x1a')][_0x0264('0x1e')],function(_0xc954d9){return{'model':db[_0xc954d9[_0x0264('0x20')]],'as':_0xc954d9['as'],'attributes':_0xc954d9['attributes'],'include':_0xc954d9[_0x0264('0x1e')]?_[_0x0264('0x1f')](_0xc954d9['include'],function(_0x55ba2c){return{'model':db[_0x55ba2c['model']],'as':_0x55ba2c['as'],'attributes':_0x55ba2c['attributes'],'include':_0x55ba2c[_0x0264('0x1e')]?_[_0x0264('0x1f')](_0x55ba2c[_0x0264('0x1e')],function(_0x5e9f73){return{'model':db[_0x5e9f73[_0x0264('0x20')]],'as':_0x5e9f73['as'],'attributes':_0x5e9f73[_0x0264('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x526501){logger[_0x0264('0x15')](_0x0264('0x17'),_0x5282a7);logger[_0x0264('0x10')](_0x0264('0x17'),_0x5282a7,JSON[_0x0264('0x12')](_0x526501));_0x792ec7(_0x526501);})[_0x0264('0x16')](function(_0x2ff558){logger['error'](_0x0264('0x17'),_0x2ff558[_0x0264('0x14')],_0x5282a7);_0x4c4f9e(_0x327448[_0x0264('0x13')](0x1f4,_0x2ff558['message']));});});};exports[_0x0264('0x21')]=function(_0x38b2ab){var _0x18600e=this;return new Promise(function(_0x315513,_0x346798){return db[_0x0264('0x18')][_0x0264('0x22')]({'raw':_0x38b2ab[_0x0264('0x1a')]?_0x38b2ab[_0x0264('0x1a')][_0x0264('0x1b')]===undefined?!![]:![]:!![],'where':_0x38b2ab['options']?_0x38b2ab[_0x0264('0x1a')][_0x0264('0x23')]||null:null,'attributes':_0x38b2ab[_0x0264('0x1a')]?_0x38b2ab['options']['attributes']||null:null,'include':_0x38b2ab['options']?_0x38b2ab[_0x0264('0x1a')][_0x0264('0x1e')]?_['map'](_0x38b2ab[_0x0264('0x1a')][_0x0264('0x1e')],function(_0x334d13){return{'model':db[_0x334d13[_0x0264('0x20')]],'as':_0x334d13['as'],'attributes':_0x334d13['attributes'],'include':_0x334d13['include']?_[_0x0264('0x1f')](_0x334d13[_0x0264('0x1e')],function(_0x3e1685){return{'model':db[_0x3e1685[_0x0264('0x20')]],'as':_0x3e1685['as'],'attributes':_0x3e1685[_0x0264('0x1c')],'include':_0x3e1685[_0x0264('0x1e')]?_[_0x0264('0x1f')](_0x3e1685[_0x0264('0x1e')],function(_0x4f6a6b){return{'model':db[_0x4f6a6b[_0x0264('0x20')]],'as':_0x4f6a6b['as'],'attributes':_0x4f6a6b['attributes']};}):[]};}):[]};}):[]:[]})[_0x0264('0x24')](function(_0x2addbe){logger[_0x0264('0x15')](_0x0264('0x21'),_0x38b2ab);logger['debug']('ShowFaxQueue',_0x38b2ab,JSON['stringify'](_0x2addbe));_0x315513(_0x2addbe);})[_0x0264('0x16')](function(_0x54fae2){logger['error'](_0x0264('0x21'),_0x54fae2[_0x0264('0x14')],_0x38b2ab);_0x346798(_0x18600e[_0x0264('0x13')](0x1f4,_0x54fae2[_0x0264('0x14')]));});});}; \ No newline at end of file +var _0xd939=['../../mysqldb','../../config/logger','../../config/environment','client','http','socket.io-emitter','redis','./faxQueue.socket','request','then','info','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','FaxQueue,\x20%s,\x20%s','GetFaxQueue','FaxQueue','options','raw','where','attributes','limit','include','model','map','ShowFaxQueue','find','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x3021ec,_0x1668c1){var _0x12f210=function(_0x4152ff){while(--_0x4152ff){_0x3021ec['push'](_0x3021ec['shift']());}};_0x12f210(++_0x1668c1);}(_0xd939,0x123));var _0x9d93=function(_0x276468,_0x29685a){_0x276468=_0x276468-0x0;var _0x36dc3a=_0xd939[_0x276468];return _0x36dc3a;};'use strict';var _=require(_0x9d93('0x0'));var util=require(_0x9d93('0x1'));var moment=require('moment');var BPromise=require(_0x9d93('0x2'));var rs=require(_0x9d93('0x3'));var fs=require('fs');var Redis=require(_0x9d93('0x4'));var db=require(_0x9d93('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9d93('0x6'))('rpc');var config=require(_0x9d93('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9d93('0x8')][_0x9d93('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9d93('0xa'))(new Redis(config[_0x9d93('0xb')]));require(_0x9d93('0xc'))['register'](socket);function respondWithRpcPromise(_0x184cc5,_0x2dff68,_0x4e4eaf){return new BPromise(function(_0x794cf3,_0x357044){return client[_0x9d93('0xd')](_0x184cc5,_0x4e4eaf)[_0x9d93('0xe')](function(_0x47f0bf){logger[_0x9d93('0xf')]('FaxQueue,\x20%s,\x20%s',_0x2dff68,'request\x20sent');logger[_0x9d93('0x10')](_0x9d93('0x11'),_0x2dff68,_0x9d93('0x12'),JSON[_0x9d93('0x13')](_0x47f0bf));if(_0x47f0bf['error']){if(_0x47f0bf[_0x9d93('0x14')][_0x9d93('0x15')]===0x1f4){logger[_0x9d93('0x14')]('FaxQueue,\x20%s,\x20%s',_0x2dff68,_0x47f0bf[_0x9d93('0x14')][_0x9d93('0x16')]);return _0x357044(_0x47f0bf[_0x9d93('0x14')][_0x9d93('0x16')]);}logger[_0x9d93('0x14')](_0x9d93('0x17'),_0x2dff68,_0x47f0bf[_0x9d93('0x14')][_0x9d93('0x16')]);return _0x794cf3(_0x47f0bf[_0x9d93('0x14')][_0x9d93('0x16')]);}else{logger['info'](_0x9d93('0x17'),_0x2dff68,'request\x20sent');_0x794cf3(_0x47f0bf['result']['message']);}})['catch'](function(_0x5d7434){logger[_0x9d93('0x14')](_0x9d93('0x17'),_0x2dff68,_0x5d7434);_0x357044(_0x5d7434);});});}exports[_0x9d93('0x18')]=function(_0x2596fb){var _0x6c6a68=this;return new Promise(function(_0x2c148d,_0x5925b7){return db[_0x9d93('0x19')]['findAll']({'raw':_0x2596fb[_0x9d93('0x1a')]?_0x2596fb[_0x9d93('0x1a')][_0x9d93('0x1b')]===undefined?!![]:![]:!![],'where':_0x2596fb[_0x9d93('0x1a')]?_0x2596fb[_0x9d93('0x1a')][_0x9d93('0x1c')]||null:null,'attributes':_0x2596fb[_0x9d93('0x1a')]?_0x2596fb[_0x9d93('0x1a')][_0x9d93('0x1d')]||null:null,'limit':_0x2596fb['options']?_0x2596fb[_0x9d93('0x1a')][_0x9d93('0x1e')]||null:null,'include':_0x2596fb['options']?_0x2596fb[_0x9d93('0x1a')][_0x9d93('0x1f')]?_['map'](_0x2596fb[_0x9d93('0x1a')][_0x9d93('0x1f')],function(_0x2d1c08){return{'model':db[_0x2d1c08[_0x9d93('0x20')]],'as':_0x2d1c08['as'],'attributes':_0x2d1c08[_0x9d93('0x1d')],'include':_0x2d1c08[_0x9d93('0x1f')]?_[_0x9d93('0x21')](_0x2d1c08['include'],function(_0x2f569f){return{'model':db[_0x2f569f[_0x9d93('0x20')]],'as':_0x2f569f['as'],'attributes':_0x2f569f['attributes'],'include':_0x2f569f[_0x9d93('0x1f')]?_['map'](_0x2f569f[_0x9d93('0x1f')],function(_0x105a89){return{'model':db[_0x105a89[_0x9d93('0x20')]],'as':_0x105a89['as'],'attributes':_0x105a89[_0x9d93('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9d93('0xe')](function(_0x265b7b){logger[_0x9d93('0xf')](_0x9d93('0x18'),_0x2596fb);logger[_0x9d93('0x10')](_0x9d93('0x18'),_0x2596fb,JSON[_0x9d93('0x13')](_0x265b7b));_0x2c148d(_0x265b7b);})['catch'](function(_0x48b3c1){logger['error']('GetFaxQueue',_0x48b3c1[_0x9d93('0x16')],_0x2596fb);_0x5925b7(_0x6c6a68[_0x9d93('0x14')](0x1f4,_0x48b3c1['message']));});});};exports[_0x9d93('0x22')]=function(_0x2cbae8){var _0x464444=this;return new Promise(function(_0x422349,_0x418360){return db[_0x9d93('0x19')][_0x9d93('0x23')]({'raw':_0x2cbae8[_0x9d93('0x1a')]?_0x2cbae8[_0x9d93('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2cbae8[_0x9d93('0x1a')]?_0x2cbae8[_0x9d93('0x1a')][_0x9d93('0x1c')]||null:null,'attributes':_0x2cbae8[_0x9d93('0x1a')]?_0x2cbae8[_0x9d93('0x1a')][_0x9d93('0x1d')]||null:null,'include':_0x2cbae8['options']?_0x2cbae8[_0x9d93('0x1a')][_0x9d93('0x1f')]?_['map'](_0x2cbae8[_0x9d93('0x1a')][_0x9d93('0x1f')],function(_0xaca6d8){return{'model':db[_0xaca6d8[_0x9d93('0x20')]],'as':_0xaca6d8['as'],'attributes':_0xaca6d8[_0x9d93('0x1d')],'include':_0xaca6d8[_0x9d93('0x1f')]?_[_0x9d93('0x21')](_0xaca6d8['include'],function(_0x10d70c){return{'model':db[_0x10d70c['model']],'as':_0x10d70c['as'],'attributes':_0x10d70c[_0x9d93('0x1d')],'include':_0x10d70c['include']?_[_0x9d93('0x21')](_0x10d70c['include'],function(_0x52da5d){return{'model':db[_0x52da5d['model']],'as':_0x52da5d['as'],'attributes':_0x52da5d[_0x9d93('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9d93('0xe')](function(_0x17b311){logger['info'](_0x9d93('0x22'),_0x2cbae8);logger[_0x9d93('0x10')](_0x9d93('0x22'),_0x2cbae8,JSON[_0x9d93('0x13')](_0x17b311));_0x422349(_0x17b311);})[_0x9d93('0x24')](function(_0x1d2d02){logger[_0x9d93('0x14')](_0x9d93('0x22'),_0x1d2d02[_0x9d93('0x16')],_0x2cbae8);_0x418360(_0x464444['error'](0x1f4,_0x1d2d02[_0x9d93('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 73bed0f..a9a8f8c 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 _0x714f=['faxQueue:','./faxQueue.events','save','remove','emit','removeListener','length'];(function(_0x707c2b,_0x4283c2){var _0x373ec0=function(_0x14a307){while(--_0x14a307){_0x707c2b['push'](_0x707c2b['shift']());}};_0x373ec0(++_0x4283c2);}(_0x714f,0xda));var _0xf714=function(_0x1e2321,_0x3ae1c5){_0x1e2321=_0x1e2321-0x0;var _0x1d346d=_0x714f[_0x1e2321];return _0x1d346d;};'use strict';var FaxQueueEvents=require(_0xf714('0x0'));var events=[_0xf714('0x1'),_0xf714('0x2'),'update'];function createListener(_0x581f41,_0x547432){return function(_0x1c01b4){_0x547432[_0xf714('0x3')](_0x581f41,_0x1c01b4);};}function removeListener(_0x21a26b,_0x4b930f){return function(){FaxQueueEvents[_0xf714('0x4')](_0x21a26b,_0x4b930f);};}exports['register']=function(_0x2c51eb){for(var _0x36ae59=0x0,_0x424060=events[_0xf714('0x5')];_0x36ae59<_0x424060;_0x36ae59++){var _0x5e58fc=events[_0x36ae59];var _0x3327e9=createListener(_0xf714('0x6')+_0x5e58fc,_0x2c51eb);FaxQueueEvents['on'](_0x5e58fc,_0x3327e9);}}; \ No newline at end of file +var _0xb4ad=['remove','update','emit','removeListener','register','faxQueue:','save'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb4ad,0x16b));var _0xdb4a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb4ad[_0x14add3];return _0x4a174f;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xdb4a('0x0'),_0xdb4a('0x1'),_0xdb4a('0x2')];function createListener(_0x3dfb3c,_0x28a23c){return function(_0x2b73f2){_0x28a23c[_0xdb4a('0x3')](_0x3dfb3c,_0x2b73f2);};}function removeListener(_0x2ed385,_0x3a78d8){return function(){FaxQueueEvents[_0xdb4a('0x4')](_0x2ed385,_0x3a78d8);};}exports[_0xdb4a('0x5')]=function(_0x175a30){for(var _0x4c2727=0x0,_0xe6104c=events['length'];_0x4c2727<_0xe6104c;_0x4c2727++){var _0x159ac6=events[_0x4c2727];var _0x119ddf=createListener(_0xdb4a('0x6')+_0x159ac6,_0x175a30);FaxQueueEvents['on'](_0x159ac6,_0x119ddf);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 1a77230..a0df383 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 _0x8eed=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','util','path','connect-timeout'];(function(_0x27f4fc,_0x59c527){var _0x427f92=function(_0x5e14d5){while(--_0x5e14d5){_0x27f4fc['push'](_0x27f4fc['shift']());}};_0x427f92(++_0x59c527);}(_0x8eed,0x8e));var _0xd8ee=function(_0x313191,_0x56b933){_0x313191=_0x313191-0x0;var _0x38456c=_0x8eed[_0x313191];return _0x38456c;};'use strict';var multer=require('multer');var util=require(_0xd8ee('0x0'));var path=require(_0xd8ee('0x1'));var timeout=require(_0xd8ee('0x2'));var express=require(_0xd8ee('0x3'));var router=express['Router']();var auth=require(_0xd8ee('0x4'));var interaction=require(_0xd8ee('0x5'));var config=require(_0xd8ee('0x6'));var controller=require(_0xd8ee('0x7'));router['get']('/',auth[_0xd8ee('0x8')](),controller['index']);router[_0xd8ee('0x9')](_0xd8ee('0xa'),auth[_0xd8ee('0x8')](),controller[_0xd8ee('0xb')]);router[_0xd8ee('0x9')](_0xd8ee('0xc'),auth['isAuthenticated'](),controller[_0xd8ee('0xd')]);router[_0xd8ee('0x9')](_0xd8ee('0xe'),auth['isAuthenticated'](),controller[_0xd8ee('0xf')]);router[_0xd8ee('0x9')](_0xd8ee('0x10'),auth[_0xd8ee('0x8')](),controller[_0xd8ee('0x11')]);router['get'](_0xd8ee('0x12'),auth[_0xd8ee('0x8')](),controller[_0xd8ee('0x13')]);router[_0xd8ee('0x14')]('/',auth['isAuthenticated'](),controller[_0xd8ee('0x15')]);router[_0xd8ee('0x14')](_0xd8ee('0x10'),auth[_0xd8ee('0x8')](),controller[_0xd8ee('0x16')]);router[_0xd8ee('0x14')](_0xd8ee('0x12'),auth[_0xd8ee('0x8')](),controller[_0xd8ee('0x17')]);router['put'](_0xd8ee('0xc'),auth[_0xd8ee('0x8')](),controller[_0xd8ee('0x18')]);router[_0xd8ee('0x19')](_0xd8ee('0xc'),auth[_0xd8ee('0x8')](),controller[_0xd8ee('0x1a')]);router[_0xd8ee('0x19')](_0xd8ee('0x10'),auth[_0xd8ee('0x8')](),controller[_0xd8ee('0x1b')]);router[_0xd8ee('0x19')]('/:id/users',auth['isAuthenticated'](),controller[_0xd8ee('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x755c=['index','/describe','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','put','delete','removeAgents','exports','util','path','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated'];(function(_0xe1b755,_0x4d6edf){var _0x11c1a9=function(_0x4ea61a){while(--_0x4ea61a){_0xe1b755['push'](_0xe1b755['shift']());}};_0x11c1a9(++_0x4d6edf);}(_0x755c,0xb1));var _0xc755=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x755c[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0xc755('0x0'));var path=require(_0xc755('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc755('0x2'));var config=require(_0xc755('0x3'));var controller=require(_0xc755('0x4'));router[_0xc755('0x5')]('/',auth[_0xc755('0x6')](),controller[_0xc755('0x7')]);router[_0xc755('0x5')](_0xc755('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0xc755('0x5')](_0xc755('0x9'),auth[_0xc755('0x6')](),controller['show']);router[_0xc755('0x5')](_0xc755('0xa'),auth[_0xc755('0x6')](),controller[_0xc755('0xb')]);router[_0xc755('0x5')]('/:id/teams',auth[_0xc755('0x6')](),controller[_0xc755('0xc')]);router['get'](_0xc755('0xd'),auth[_0xc755('0x6')](),controller[_0xc755('0xe')]);router[_0xc755('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc755('0xf')](_0xc755('0x10'),auth[_0xc755('0x6')](),controller[_0xc755('0x11')]);router[_0xc755('0xf')](_0xc755('0xd'),auth['isAuthenticated'](),controller[_0xc755('0x12')]);router[_0xc755('0x13')](_0xc755('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xc755('0x14')](_0xc755('0x9'),auth['isAuthenticated'](),controller['destroy']);router[_0xc755('0x14')]('/:id/teams',auth[_0xc755('0x6')](),controller['removeTeams']);router[_0xc755('0x14')](_0xc755('0xd'),auth[_0xc755('0x6')](),controller[_0xc755('0x15')]);module[_0xc755('0x16')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 75528d4..21b04f0 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 _0x38e4=['STRING','DATE','moment','sequelize','exports'];(function(_0x590acb,_0x4063af){var _0x54a230=function(_0x5d3ee6){while(--_0x5d3ee6){_0x590acb['push'](_0x590acb['shift']());}};_0x54a230(++_0x4063af);}(_0x38e4,0x1d8));var _0x438e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x38e4[_0x3bf83f];return _0x22c4a9;};'use strict';var moment=require(_0x438e('0x0'));var Sequelize=require(_0x438e('0x1'));module[_0x438e('0x2')]={'uniqueid':{'type':Sequelize[_0x438e('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x438e('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x438e('0x4')]},'acceptAt':{'type':Sequelize[_0x438e('0x4')]},'exitAt':{'type':Sequelize[_0x438e('0x4')]},'reason':{'type':Sequelize[_0x438e('0x3')]}}; \ No newline at end of file +var _0x83ec=['DATE','STRING'];(function(_0x1b98dc,_0x57df16){var _0x2c179e=function(_0x2d0ae8){while(--_0x2d0ae8){_0x1b98dc['push'](_0x1b98dc['shift']());}};_0x2c179e(++_0x57df16);}(_0x83ec,0x9b));var _0xc83e=function(_0xc34421,_0x184bee){_0xc34421=_0xc34421-0x0;var _0x486d72=_0x83ec[_0xc34421];return _0x486d72;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xc83e('0x0')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xc83e('0x1')]},'leaveAt':{'type':Sequelize[_0xc83e('0x1')]},'acceptAt':{'type':Sequelize[_0xc83e('0x1')]},'exitAt':{'type':Sequelize[_0xc83e('0x1')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index b4f28f5..1ee1162 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 _0xf9d3=['mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','index','FaxQueueReport','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x1ce938,_0x2d64d1){var _0x251f1e=function(_0x13e5a9){while(--_0x13e5a9){_0x1ce938['push'](_0x1ce938['shift']());}};_0x251f1e(++_0x2d64d1);}(_0xf9d3,0x8d));var _0x3f9d=function(_0x4c69e4,_0xe20b67){_0x4c69e4=_0x4c69e4-0x0;var _0x4e9b0a=_0xf9d3[_0x4c69e4];return _0x4e9b0a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3f9d('0x0'));var rimraf=require(_0x3f9d('0x1'));var zipdir=require(_0x3f9d('0x2'));var jsonpatch=require(_0x3f9d('0x3'));var rp=require(_0x3f9d('0x4'));var moment=require(_0x3f9d('0x5'));var BPromise=require(_0x3f9d('0x6'));var Mustache=require(_0x3f9d('0x7'));var util=require(_0x3f9d('0x8'));var path=require(_0x3f9d('0x9'));var sox=require(_0x3f9d('0xa'));var csv=require(_0x3f9d('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3f9d('0xc'));var squel=require(_0x3f9d('0xd'));var crypto=require(_0x3f9d('0xe'));var jsforce=require(_0x3f9d('0xf'));var deskjs=require(_0x3f9d('0x10'));var toCsv=require(_0x3f9d('0xb'));var querystring=require('querystring');var Papa=require(_0x3f9d('0x11'));var Redis=require(_0x3f9d('0x12'));var qs=require(_0x3f9d('0x13'));var logger=require(_0x3f9d('0x14'))(_0x3f9d('0x15'));var utils=require('../../config/utils');var config=require(_0x3f9d('0x16'));var db=require(_0x3f9d('0x17'))['db'];function respondWithStatusCode(_0x594a18,_0x15580f){_0x15580f=_0x15580f||0xcc;return function(_0x10f925){if(_0x10f925){return _0x594a18[_0x3f9d('0x18')](_0x15580f);}return _0x594a18[_0x3f9d('0x19')](_0x15580f)[_0x3f9d('0x1a')]();};}function respondWithResult(_0x5a7535,_0xbf853f){_0xbf853f=_0xbf853f||0xc8;return function(_0x5d0f80){if(_0x5d0f80){return _0x5a7535[_0x3f9d('0x19')](_0xbf853f)[_0x3f9d('0x1b')](_0x5d0f80);}};}function respondWithFilteredResult(_0xa310c8,_0x2089c1){return function(_0x544811){if(_0x544811){var _0x3427ac=_0x544811[_0x3f9d('0x1c')],_0x54bc71=_0x2089c1[_0x3f9d('0x1d')],_0x46bb1c=_0x2089c1['offset']+_0x2089c1[_0x3f9d('0x1e')],_0x209722;if(_0x46bb1c>=_0x3427ac){_0x46bb1c=_0x3427ac;_0x209722=0xc8;}else{_0x209722=0xce;}_0xa310c8[_0x3f9d('0x19')](_0x209722);return _0xa310c8[_0x3f9d('0x1f')](_0x3f9d('0x20'),_0x54bc71+'-'+_0x46bb1c+'/'+_0x3427ac)['json'](_0x544811);}return null;};}function patchUpdates(_0x23f8e1){return function(_0x4b8979){try{jsonpatch[_0x3f9d('0x21')](_0x4b8979,_0x23f8e1,!![]);}catch(_0x32107a){return BPromise[_0x3f9d('0x22')](_0x32107a);}return _0x4b8979[_0x3f9d('0x23')]();};}function saveUpdates(_0x1f63dd,_0x54eeb6){return function(_0x232c43){if(_0x232c43){return _0x232c43[_0x3f9d('0x24')](_0x1f63dd)[_0x3f9d('0x25')](function(_0x52f30e){return _0x52f30e;});}return null;};}function removeEntity(_0x195474,_0x60bb19){return function(_0x492108){if(_0x492108){return _0x492108['destroy']()[_0x3f9d('0x25')](function(){_0x195474[_0x3f9d('0x19')](0xcc)[_0x3f9d('0x1a')]();});}};}function handleEntityNotFound(_0x3ed932,_0xe583b7){return function(_0x53cf1f){if(!_0x53cf1f){_0x3ed932['sendStatus'](0x194);}return _0x53cf1f;};}function handleError(_0x5020e7,_0xfb9007){_0xfb9007=_0xfb9007||0x1f4;return function(_0x3f728b){logger['error'](_0x3f728b[_0x3f9d('0x26')]);if(_0x3f728b[_0x3f9d('0x27')]){delete _0x3f728b[_0x3f9d('0x27')];}_0x5020e7[_0x3f9d('0x19')](_0xfb9007)['send'](_0x3f728b);};}exports[_0x3f9d('0x28')]=function(_0x2355f5,_0x4d36ab){var _0x4d443e={},_0x336421={},_0xf5370d={'count':0x0,'rows':[]};var _0x1ac469=db[_0x3f9d('0x29')][_0x3f9d('0x2a')];_0x336421[_0x3f9d('0x2b')]=_[_0x3f9d('0x2c')](_0x1ac469);var _0x45f55b={'dateStart':_0x2355f5['query']['dateStart'],'dateEnd':_0x2355f5[_0x3f9d('0x2d')][_0x3f9d('0x2e')]};delete _0x2355f5['query'][_0x3f9d('0x2f')];delete _0x2355f5['query'][_0x3f9d('0x2e')];_0x336421[_0x3f9d('0x2d')]=_[_0x3f9d('0x2c')](_0x2355f5[_0x3f9d('0x2d')]);_0x336421[_0x3f9d('0x30')]=_[_0x3f9d('0x31')](_0x336421[_0x3f9d('0x2b')],_0x336421['query']);_0x4d443e[_0x3f9d('0x32')]=_[_0x3f9d('0x31')](_0x336421[_0x3f9d('0x2b')],qs[_0x3f9d('0x33')](_0x2355f5[_0x3f9d('0x2d')]['fields']));_0x4d443e[_0x3f9d('0x32')]=_0x4d443e[_0x3f9d('0x32')]['length']?_0x4d443e[_0x3f9d('0x32')]:_0x336421[_0x3f9d('0x2b')];if(!_0x2355f5[_0x3f9d('0x2d')][_0x3f9d('0x34')](_0x3f9d('0x35'))){_0x4d443e[_0x3f9d('0x1e')]=qs[_0x3f9d('0x1e')](_0x2355f5[_0x3f9d('0x2d')][_0x3f9d('0x1e')]);_0x4d443e['offset']=qs[_0x3f9d('0x1d')](_0x2355f5[_0x3f9d('0x2d')]['offset']);}_0x4d443e[_0x3f9d('0x36')]=qs[_0x3f9d('0x37')](_0x2355f5[_0x3f9d('0x2d')][_0x3f9d('0x37')]);_0x4d443e[_0x3f9d('0x38')]=qs[_0x3f9d('0x30')](_[_0x3f9d('0x39')](_0x2355f5[_0x3f9d('0x2d')],_0x336421[_0x3f9d('0x30')]));if(_0x45f55b['dateStart']){if(_0x45f55b[_0x3f9d('0x2e')]){_0x45f55b['dateEnd']=moment(_0x45f55b[_0x3f9d('0x2e')])[_0x3f9d('0x3a')](0x1,_0x3f9d('0x3b'));}else{_0x45f55b[_0x3f9d('0x2e')]=moment(_0x45f55b[_0x3f9d('0x2f')])[_0x3f9d('0x3a')](0x1,_0x3f9d('0x3b'));}_['merge'](_0x4d443e['where'],{'createdAt':{'$gte':_0x45f55b['dateStart'],'$lte':_0x45f55b[_0x3f9d('0x2e')]}});}if(_0x2355f5[_0x3f9d('0x2d')]['filter']){_0x4d443e['where']=_[_0x3f9d('0x3c')](_0x4d443e[_0x3f9d('0x38')],{'$or':_['map'](_0x4d443e[_0x3f9d('0x32')],function(_0x442842){var _0x87738b={};_0x87738b[_0x442842]={'$like':'%'+_0x2355f5[_0x3f9d('0x2d')]['filter']+'%'};return _0x87738b;})});}_0x4d443e=_['merge']({},_0x4d443e,_0x2355f5[_0x3f9d('0x3d')]);var _0x2cd074={'where':_0x4d443e[_0x3f9d('0x38')]};return db[_0x3f9d('0x29')][_0x3f9d('0x1c')](_0x2cd074)[_0x3f9d('0x25')](function(_0x13ba57){_0xf5370d[_0x3f9d('0x1c')]=_0x13ba57;if(_0x2355f5[_0x3f9d('0x2d')][_0x3f9d('0x3e')]){_0x4d443e[_0x3f9d('0x3f')]=[{'all':!![]}];}return db[_0x3f9d('0x29')][_0x3f9d('0x40')](_0x4d443e);})[_0x3f9d('0x25')](function(_0x291c71){_0xf5370d[_0x3f9d('0x41')]=_0x291c71;return _0xf5370d;})[_0x3f9d('0x25')](respondWithFilteredResult(_0x4d36ab,_0x4d443e))[_0x3f9d('0x42')](handleError(_0x4d36ab,null));};exports[_0x3f9d('0x43')]=function(_0x1e426d,_0x367b38){var _0x4ce097={'raw':!![],'where':{'id':_0x1e426d[_0x3f9d('0x44')]['id']}},_0x1601b7={};_0x1601b7[_0x3f9d('0x2b')]=_['keys'](db['FaxQueueReport'][_0x3f9d('0x2a')]);_0x1601b7[_0x3f9d('0x2d')]=_[_0x3f9d('0x2c')](_0x1e426d[_0x3f9d('0x2d')]);_0x1601b7[_0x3f9d('0x30')]=_[_0x3f9d('0x31')](_0x1601b7[_0x3f9d('0x2b')],_0x1601b7[_0x3f9d('0x2d')]);_0x4ce097[_0x3f9d('0x32')]=_[_0x3f9d('0x31')](_0x1601b7[_0x3f9d('0x2b')],qs[_0x3f9d('0x33')](_0x1e426d[_0x3f9d('0x2d')]['fields']));_0x4ce097[_0x3f9d('0x32')]=_0x4ce097['attributes'][_0x3f9d('0x45')]?_0x4ce097['attributes']:_0x1601b7['model'];if(_0x1e426d['query'][_0x3f9d('0x3e')]){_0x4ce097['include']=[{'all':!![]}];}_0x4ce097=_[_0x3f9d('0x3c')]({},_0x4ce097,_0x1e426d[_0x3f9d('0x3d')]);return db['FaxQueueReport'][_0x3f9d('0x46')](_0x4ce097)[_0x3f9d('0x25')](handleEntityNotFound(_0x367b38,null))['then'](respondWithResult(_0x367b38,null))['catch'](handleError(_0x367b38,null));};exports[_0x3f9d('0x47')]=function(_0x560c6a,_0xbfdc39){return db['FaxQueueReport'][_0x3f9d('0x47')](_0x560c6a[_0x3f9d('0x48')],{})[_0x3f9d('0x25')](respondWithResult(_0xbfdc39,0xc9))[_0x3f9d('0x42')](handleError(_0xbfdc39,null));};exports[_0x3f9d('0x24')]=function(_0x2d63d5,_0x3bd8ce){if(_0x2d63d5[_0x3f9d('0x48')]['id']){delete _0x2d63d5[_0x3f9d('0x48')]['id'];}return db[_0x3f9d('0x29')]['find']({'where':{'id':_0x2d63d5[_0x3f9d('0x44')]['id']}})['then'](handleEntityNotFound(_0x3bd8ce,null))[_0x3f9d('0x25')](saveUpdates(_0x2d63d5['body'],null))[_0x3f9d('0x25')](respondWithResult(_0x3bd8ce,null))[_0x3f9d('0x42')](handleError(_0x3bd8ce,null));};exports['destroy']=function(_0x4db372,_0x356f20){return db[_0x3f9d('0x29')][_0x3f9d('0x46')]({'where':{'id':_0x4db372[_0x3f9d('0x44')]['id']}})[_0x3f9d('0x25')](handleEntityNotFound(_0x356f20,null))[_0x3f9d('0x25')](removeEntity(_0x356f20,null))[_0x3f9d('0x42')](handleError(_0x356f20,null));};exports[_0x3f9d('0x49')]=function(_0x479c57,_0x3f6dce){return db[_0x3f9d('0x29')][_0x3f9d('0x49')]()['then'](respondWithResult(_0x3f6dce,null))[_0x3f9d('0x42')](handleError(_0x3f6dce,null));}; \ No newline at end of file +var _0xbc5a=['destroy','error','name','send','index','FaxQueueReport','model','keys','query','dateEnd','dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','add','day','merge','filter','map','options','includeAll','rows','catch','show','rawAttributes','include','create','body','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','update','then'];(function(_0x165d3c,_0x3ba20d){var _0xc27339=function(_0x1f279f){while(--_0x1f279f){_0x165d3c['push'](_0x165d3c['shift']());}};_0xc27339(++_0x3ba20d);}(_0xbc5a,0x199));var _0xabc5=function(_0x204a83,_0x794714){_0x204a83=_0x204a83-0x0;var _0x205a5e=_0xbc5a[_0x204a83];return _0x205a5e;};'use strict';var pdf=require(_0xabc5('0x0'));var emlformat=require(_0xabc5('0x1'));var rimraf=require(_0xabc5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xabc5('0x3'));var rp=require(_0xabc5('0x4'));var moment=require(_0xabc5('0x5'));var BPromise=require(_0xabc5('0x6'));var Mustache=require(_0xabc5('0x7'));var util=require(_0xabc5('0x8'));var path=require(_0xabc5('0x9'));var sox=require(_0xabc5('0xa'));var csv=require('to-csv');var ejs=require(_0xabc5('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xabc5('0xc'));var crypto=require(_0xabc5('0xd'));var jsforce=require(_0xabc5('0xe'));var deskjs=require(_0xabc5('0xf'));var toCsv=require(_0xabc5('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xabc5('0x11'));var qs=require(_0xabc5('0x12'));var logger=require(_0xabc5('0x13'))(_0xabc5('0x14'));var utils=require(_0xabc5('0x15'));var config=require(_0xabc5('0x16'));var db=require(_0xabc5('0x17'))['db'];function respondWithStatusCode(_0x5de030,_0xa7da3d){_0xa7da3d=_0xa7da3d||0xcc;return function(_0x5f3f6a){if(_0x5f3f6a){return _0x5de030[_0xabc5('0x18')](_0xa7da3d);}return _0x5de030[_0xabc5('0x19')](_0xa7da3d)[_0xabc5('0x1a')]();};}function respondWithResult(_0x386b4f,_0x3b0571){_0x3b0571=_0x3b0571||0xc8;return function(_0x3617b5){if(_0x3617b5){return _0x386b4f[_0xabc5('0x19')](_0x3b0571)[_0xabc5('0x1b')](_0x3617b5);}};}function respondWithFilteredResult(_0x33d952,_0x31c491){return function(_0x1656d8){if(_0x1656d8){var _0x28dc43=_0x1656d8[_0xabc5('0x1c')],_0x32de76=_0x31c491[_0xabc5('0x1d')],_0x23a3ef=_0x31c491[_0xabc5('0x1d')]+_0x31c491['limit'],_0x2309db;if(_0x23a3ef>=_0x28dc43){_0x23a3ef=_0x28dc43;_0x2309db=0xc8;}else{_0x2309db=0xce;}_0x33d952[_0xabc5('0x19')](_0x2309db);return _0x33d952[_0xabc5('0x1e')](_0xabc5('0x1f'),_0x32de76+'-'+_0x23a3ef+'/'+_0x28dc43)[_0xabc5('0x1b')](_0x1656d8);}return null;};}function patchUpdates(_0x31bf8e){return function(_0x46193a){try{jsonpatch[_0xabc5('0x20')](_0x46193a,_0x31bf8e,!![]);}catch(_0x2d2901){return BPromise['reject'](_0x2d2901);}return _0x46193a['save']();};}function saveUpdates(_0x484b29,_0x12759a){return function(_0x4a83a1){if(_0x4a83a1){return _0x4a83a1[_0xabc5('0x21')](_0x484b29)[_0xabc5('0x22')](function(_0x592da8){return _0x592da8;});}return null;};}function removeEntity(_0x1edb8c,_0x14706c){return function(_0x3bff9e){if(_0x3bff9e){return _0x3bff9e[_0xabc5('0x23')]()[_0xabc5('0x22')](function(){_0x1edb8c[_0xabc5('0x19')](0xcc)[_0xabc5('0x1a')]();});}};}function handleEntityNotFound(_0x52b8a1,_0xdac1b7){return function(_0x155256){if(!_0x155256){_0x52b8a1[_0xabc5('0x18')](0x194);}return _0x155256;};}function handleError(_0x8a2883,_0x1ff3e2){_0x1ff3e2=_0x1ff3e2||0x1f4;return function(_0x25f393){logger[_0xabc5('0x24')](_0x25f393['stack']);if(_0x25f393[_0xabc5('0x25')]){delete _0x25f393[_0xabc5('0x25')];}_0x8a2883[_0xabc5('0x19')](_0x1ff3e2)[_0xabc5('0x26')](_0x25f393);};}exports[_0xabc5('0x27')]=function(_0x3889f2,_0x4fb1bb){var _0xe738e1={},_0x5751a9={},_0xc4e86f={'count':0x0,'rows':[]};var _0x327dc2=db[_0xabc5('0x28')]['rawAttributes'];_0x5751a9[_0xabc5('0x29')]=_[_0xabc5('0x2a')](_0x327dc2);var _0x815d51={'dateStart':_0x3889f2[_0xabc5('0x2b')]['dateStart'],'dateEnd':_0x3889f2[_0xabc5('0x2b')][_0xabc5('0x2c')]};delete _0x3889f2[_0xabc5('0x2b')][_0xabc5('0x2d')];delete _0x3889f2[_0xabc5('0x2b')][_0xabc5('0x2c')];_0x5751a9[_0xabc5('0x2b')]=_['keys'](_0x3889f2['query']);_0x5751a9[_0xabc5('0x2e')]=_[_0xabc5('0x2f')](_0x5751a9[_0xabc5('0x29')],_0x5751a9[_0xabc5('0x2b')]);_0xe738e1[_0xabc5('0x30')]=_[_0xabc5('0x2f')](_0x5751a9['model'],qs['fields'](_0x3889f2[_0xabc5('0x2b')][_0xabc5('0x31')]));_0xe738e1[_0xabc5('0x30')]=_0xe738e1[_0xabc5('0x30')][_0xabc5('0x32')]?_0xe738e1['attributes']:_0x5751a9[_0xabc5('0x29')];if(!_0x3889f2[_0xabc5('0x2b')][_0xabc5('0x33')](_0xabc5('0x34'))){_0xe738e1[_0xabc5('0x35')]=qs[_0xabc5('0x35')](_0x3889f2[_0xabc5('0x2b')]['limit']);_0xe738e1[_0xabc5('0x1d')]=qs[_0xabc5('0x1d')](_0x3889f2['query'][_0xabc5('0x1d')]);}_0xe738e1[_0xabc5('0x36')]=qs[_0xabc5('0x37')](_0x3889f2[_0xabc5('0x2b')]['sort']);_0xe738e1[_0xabc5('0x38')]=qs['filters'](_[_0xabc5('0x39')](_0x3889f2[_0xabc5('0x2b')],_0x5751a9[_0xabc5('0x2e')]));if(_0x815d51['dateStart']){if(_0x815d51['dateEnd']){_0x815d51['dateEnd']=moment(_0x815d51[_0xabc5('0x2c')])[_0xabc5('0x3a')](0x1,_0xabc5('0x3b'));}else{_0x815d51[_0xabc5('0x2c')]=moment(_0x815d51[_0xabc5('0x2d')])['add'](0x1,_0xabc5('0x3b'));}_[_0xabc5('0x3c')](_0xe738e1[_0xabc5('0x38')],{'createdAt':{'$gte':_0x815d51[_0xabc5('0x2d')],'$lte':_0x815d51['dateEnd']}});}if(_0x3889f2[_0xabc5('0x2b')][_0xabc5('0x3d')]){_0xe738e1[_0xabc5('0x38')]=_[_0xabc5('0x3c')](_0xe738e1[_0xabc5('0x38')],{'$or':_[_0xabc5('0x3e')](_0xe738e1['attributes'],function(_0x344bb8){var _0x4c96d7={};_0x4c96d7[_0x344bb8]={'$like':'%'+_0x3889f2[_0xabc5('0x2b')]['filter']+'%'};return _0x4c96d7;})});}_0xe738e1=_['merge']({},_0xe738e1,_0x3889f2[_0xabc5('0x3f')]);var _0x5a9203={'where':_0xe738e1[_0xabc5('0x38')]};return db[_0xabc5('0x28')][_0xabc5('0x1c')](_0x5a9203)['then'](function(_0x39ee7f){_0xc4e86f['count']=_0x39ee7f;if(_0x3889f2[_0xabc5('0x2b')][_0xabc5('0x40')]){_0xe738e1['include']=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0xe738e1);})[_0xabc5('0x22')](function(_0x51975d){_0xc4e86f[_0xabc5('0x41')]=_0x51975d;return _0xc4e86f;})[_0xabc5('0x22')](respondWithFilteredResult(_0x4fb1bb,_0xe738e1))[_0xabc5('0x42')](handleError(_0x4fb1bb,null));};exports[_0xabc5('0x43')]=function(_0x563c46,_0xc36ddf){var _0x16c5cb={'raw':!![],'where':{'id':_0x563c46['params']['id']}},_0x27ecea={};_0x27ecea[_0xabc5('0x29')]=_[_0xabc5('0x2a')](db[_0xabc5('0x28')][_0xabc5('0x44')]);_0x27ecea[_0xabc5('0x2b')]=_[_0xabc5('0x2a')](_0x563c46[_0xabc5('0x2b')]);_0x27ecea['filters']=_[_0xabc5('0x2f')](_0x27ecea[_0xabc5('0x29')],_0x27ecea[_0xabc5('0x2b')]);_0x16c5cb[_0xabc5('0x30')]=_['intersection'](_0x27ecea['model'],qs[_0xabc5('0x31')](_0x563c46[_0xabc5('0x2b')][_0xabc5('0x31')]));_0x16c5cb['attributes']=_0x16c5cb[_0xabc5('0x30')]['length']?_0x16c5cb[_0xabc5('0x30')]:_0x27ecea['model'];if(_0x563c46[_0xabc5('0x2b')][_0xabc5('0x40')]){_0x16c5cb[_0xabc5('0x45')]=[{'all':!![]}];}_0x16c5cb=_[_0xabc5('0x3c')]({},_0x16c5cb,_0x563c46[_0xabc5('0x3f')]);return db[_0xabc5('0x28')]['find'](_0x16c5cb)[_0xabc5('0x22')](handleEntityNotFound(_0xc36ddf,null))[_0xabc5('0x22')](respondWithResult(_0xc36ddf,null))[_0xabc5('0x42')](handleError(_0xc36ddf,null));};exports['create']=function(_0x1bcc62,_0x48b4b5){return db['FaxQueueReport'][_0xabc5('0x46')](_0x1bcc62['body'],{})[_0xabc5('0x22')](respondWithResult(_0x48b4b5,0xc9))[_0xabc5('0x42')](handleError(_0x48b4b5,null));};exports[_0xabc5('0x21')]=function(_0x15f64a,_0x2c564a){if(_0x15f64a[_0xabc5('0x47')]['id']){delete _0x15f64a[_0xabc5('0x47')]['id'];}return db[_0xabc5('0x28')][_0xabc5('0x48')]({'where':{'id':_0x15f64a['params']['id']}})[_0xabc5('0x22')](handleEntityNotFound(_0x2c564a,null))[_0xabc5('0x22')](saveUpdates(_0x15f64a['body'],null))[_0xabc5('0x22')](respondWithResult(_0x2c564a,null))[_0xabc5('0x42')](handleError(_0x2c564a,null));};exports[_0xabc5('0x23')]=function(_0x797f0f,_0xa70da3){return db[_0xabc5('0x28')][_0xabc5('0x48')]({'where':{'id':_0x797f0f['params']['id']}})['then'](handleEntityNotFound(_0xa70da3,null))[_0xabc5('0x22')](removeEntity(_0xa70da3,null))[_0xabc5('0x42')](handleError(_0xa70da3,null));};exports[_0xabc5('0x49')]=function(_0x45c535,_0x1f3a11){return db[_0xabc5('0x28')][_0xabc5('0x49')]()[_0xabc5('0x22')](respondWithResult(_0x1f3a11,null))[_0xabc5('0x42')](handleError(_0x1f3a11,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 3848e8c..3948ecb 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 _0x1c57=['exports','FaxQueueReport','uniqueid','lodash','util','../../config/logger','moment','request-promise'];(function(_0x3aa233,_0x4e1b1c){var _0x86bd4d=function(_0x59e44d){while(--_0x59e44d){_0x3aa233['push'](_0x3aa233['shift']());}};_0x86bd4d(++_0x4e1b1c);}(_0x1c57,0x14b));var _0x71c5=function(_0x537629,_0x651cf5){_0x537629=_0x537629-0x0;var _0x3c4a3f=_0x1c57[_0x537629];return _0x3c4a3f;};'use strict';var _=require(_0x71c5('0x0'));var util=require(_0x71c5('0x1'));var logger=require(_0x71c5('0x2'))('api');var moment=require(_0x71c5('0x3'));var BPromise=require('bluebird');var rp=require(_0x71c5('0x4'));var attributes=require('./faxQueueReport.attributes');module[_0x71c5('0x5')]=function(_0x5480f7,_0x39f654){return _0x5480f7['define'](_0x71c5('0x6'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x71c5('0x7'),'fields':[_0x71c5('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4b2c=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid'];(function(_0x5a9653,_0x13625b){var _0xe26538=function(_0x2c4dc8){while(--_0x2c4dc8){_0x5a9653['push'](_0x5a9653['shift']());}};_0xe26538(++_0x13625b);}(_0x4b2c,0x152));var _0xc4b2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b2c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc4b2('0x0'));var util=require(_0xc4b2('0x1'));var logger=require(_0xc4b2('0x2'))(_0xc4b2('0x3'));var moment=require(_0xc4b2('0x4'));var BPromise=require(_0xc4b2('0x5'));var rp=require(_0xc4b2('0x6'));var attributes=require(_0xc4b2('0x7'));module[_0xc4b2('0x8')]=function(_0x486342,_0x20b4ff){return _0x486342[_0xc4b2('0x9')](_0xc4b2('0xa'),attributes,{'tableName':_0xc4b2('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc4b2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index f949202..29b946a 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 _0xceb0=['http','then','info','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FaxQueueReport,\x20%s,\x20%s','message','result','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','update','where','attributes','limit','catch','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x26960a,_0x2b3d66){var _0x17c84a=function(_0x1257bc){while(--_0x1257bc){_0x26960a['push'](_0x26960a['shift']());}};_0x17c84a(++_0x2b3d66);}(_0xceb0,0x173));var _0x0ceb=function(_0x2e97b0,_0x2a5a9b){_0x2e97b0=_0x2e97b0-0x0;var _0x6e14e3=_0xceb0[_0x2e97b0];return _0x6e14e3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0ceb('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ceb('0x1'))['db'];var utils=require(_0x0ceb('0x2'));var logger=require(_0x0ceb('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0ceb('0x4'));var client=jayson[_0x0ceb('0x5')][_0x0ceb('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x52e6bb,_0x448bf8,_0x19e438){return new BPromise(function(_0x4ec03a,_0x9e53b7){return client['request'](_0x52e6bb,_0x19e438)[_0x0ceb('0x7')](function(_0x3e71f4){logger[_0x0ceb('0x8')]('FaxQueueReport,\x20%s,\x20%s',_0x448bf8,'request\x20sent');logger[_0x0ceb('0x9')](_0x0ceb('0xa'),_0x448bf8,_0x0ceb('0xb'),JSON[_0x0ceb('0xc')](_0x3e71f4));if(_0x3e71f4[_0x0ceb('0xd')]){if(_0x3e71f4[_0x0ceb('0xd')]['code']===0x1f4){logger[_0x0ceb('0xd')](_0x0ceb('0xe'),_0x448bf8,_0x3e71f4[_0x0ceb('0xd')][_0x0ceb('0xf')]);return _0x9e53b7(_0x3e71f4[_0x0ceb('0xd')][_0x0ceb('0xf')]);}logger[_0x0ceb('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x448bf8,_0x3e71f4[_0x0ceb('0xd')]['message']);return _0x4ec03a(_0x3e71f4['error'][_0x0ceb('0xf')]);}else{logger[_0x0ceb('0x8')](_0x0ceb('0xe'),_0x448bf8,'request\x20sent');_0x4ec03a(_0x3e71f4[_0x0ceb('0x10')][_0x0ceb('0xf')]);}})['catch'](function(_0x1dc6f5){logger[_0x0ceb('0xd')](_0x0ceb('0xe'),_0x448bf8,_0x1dc6f5);_0x9e53b7(_0x1dc6f5);});});}exports[_0x0ceb('0x11')]=function(_0x18bed1){var _0x27fbeb=this;return new Promise(function(_0x2c5a89,_0x2a2eae){return db[_0x0ceb('0x12')][_0x0ceb('0x13')](_0x18bed1[_0x0ceb('0x14')],{'raw':_0x18bed1[_0x0ceb('0x15')]?_0x18bed1[_0x0ceb('0x15')][_0x0ceb('0x16')]===undefined?!![]:![]:!![]})[_0x0ceb('0x7')](function(_0x3dd970){logger[_0x0ceb('0x8')]('CreateFaxQueueReport',_0x18bed1);logger['debug'](_0x0ceb('0x11'),_0x18bed1,JSON[_0x0ceb('0xc')](_0x3dd970));_0x2c5a89(_0x3dd970);})['catch'](function(_0x2fd374){logger['error'](_0x0ceb('0x11'),_0x2fd374[_0x0ceb('0xf')],_0x18bed1);_0x2a2eae(_0x27fbeb[_0x0ceb('0xd')](0x1f4,_0x2fd374[_0x0ceb('0xf')]));});});};exports[_0x0ceb('0x17')]=function(_0x4a2b69){var _0x5c41dd=this;return new Promise(function(_0x4d29f5,_0x1a1ab3){return db['FaxQueueReport'][_0x0ceb('0x18')](_0x4a2b69['body'],{'raw':_0x4a2b69[_0x0ceb('0x15')]?_0x4a2b69[_0x0ceb('0x15')][_0x0ceb('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a2b69[_0x0ceb('0x15')]?_0x4a2b69['options'][_0x0ceb('0x19')]||null:null,'attributes':_0x4a2b69[_0x0ceb('0x15')]?_0x4a2b69[_0x0ceb('0x15')][_0x0ceb('0x1a')]||null:null,'limit':_0x4a2b69[_0x0ceb('0x15')]?_0x4a2b69['options'][_0x0ceb('0x1b')]||null:null})[_0x0ceb('0x7')](function(_0x3c934b){logger[_0x0ceb('0x8')](_0x0ceb('0x17'),_0x4a2b69);logger[_0x0ceb('0x9')]('UpdateFaxQueueReport',_0x4a2b69,JSON[_0x0ceb('0xc')](_0x3c934b));_0x4d29f5(_0x3c934b);})[_0x0ceb('0x1c')](function(_0x1b5337){logger[_0x0ceb('0xd')](_0x0ceb('0x17'),_0x1b5337[_0x0ceb('0xf')],_0x4a2b69);_0x1a1ab3(_0x5c41dd[_0x0ceb('0xd')](0x1f4,_0x1b5337[_0x0ceb('0xf')]));});});}; \ No newline at end of file +var _0x20df=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','attributes','limit','lodash','util','moment','bluebird'];(function(_0x2862d2,_0x22f4b0){var _0x1421bb=function(_0xeb9f67){while(--_0xeb9f67){_0x2862d2['push'](_0x2862d2['shift']());}};_0x1421bb(++_0x22f4b0);}(_0x20df,0x7c));var _0xf20d=function(_0x1a1b6e,_0x3a07a9){_0x1a1b6e=_0x1a1b6e-0x0;var _0x571e2c=_0x20df[_0x1a1b6e];return _0x571e2c;};'use strict';var _=require(_0xf20d('0x0'));var util=require(_0xf20d('0x1'));var moment=require(_0xf20d('0x2'));var BPromise=require(_0xf20d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf20d('0x4'));var db=require(_0xf20d('0x5'))['db'];var utils=require(_0xf20d('0x6'));var logger=require(_0xf20d('0x7'))(_0xf20d('0x8'));var config=require('../../config/environment');var jayson=require(_0xf20d('0x9'));var client=jayson['client'][_0xf20d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41d0da,_0x53a7b5,_0x184c8d){return new BPromise(function(_0x5f0353,_0x4f36d1){return client['request'](_0x41d0da,_0x184c8d)[_0xf20d('0xb')](function(_0x22b427){logger[_0xf20d('0xc')](_0xf20d('0xd'),_0x53a7b5,'request\x20sent');logger[_0xf20d('0xe')](_0xf20d('0xf'),_0x53a7b5,_0xf20d('0x10'),JSON[_0xf20d('0x11')](_0x22b427));if(_0x22b427[_0xf20d('0x12')]){if(_0x22b427[_0xf20d('0x12')][_0xf20d('0x13')]===0x1f4){logger[_0xf20d('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x53a7b5,_0x22b427[_0xf20d('0x12')]['message']);return _0x4f36d1(_0x22b427[_0xf20d('0x12')][_0xf20d('0x14')]);}logger['error'](_0xf20d('0xd'),_0x53a7b5,_0x22b427[_0xf20d('0x12')][_0xf20d('0x14')]);return _0x5f0353(_0x22b427[_0xf20d('0x12')][_0xf20d('0x14')]);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x53a7b5,_0xf20d('0x10'));_0x5f0353(_0x22b427[_0xf20d('0x15')][_0xf20d('0x14')]);}})[_0xf20d('0x16')](function(_0x53c164){logger[_0xf20d('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x53a7b5,_0x53c164);_0x4f36d1(_0x53c164);});});}exports[_0xf20d('0x17')]=function(_0x5322ba){var _0x55e0a7=this;return new Promise(function(_0x4b91bc,_0x2e696e){return db[_0xf20d('0x18')][_0xf20d('0x19')](_0x5322ba[_0xf20d('0x1a')],{'raw':_0x5322ba[_0xf20d('0x1b')]?_0x5322ba['options'][_0xf20d('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x41b8c8){logger['info'](_0xf20d('0x17'),_0x5322ba);logger[_0xf20d('0xe')]('CreateFaxQueueReport',_0x5322ba,JSON['stringify'](_0x41b8c8));_0x4b91bc(_0x41b8c8);})[_0xf20d('0x16')](function(_0x1f9a62){logger[_0xf20d('0x12')]('CreateFaxQueueReport',_0x1f9a62['message'],_0x5322ba);_0x2e696e(_0x55e0a7[_0xf20d('0x12')](0x1f4,_0x1f9a62[_0xf20d('0x14')]));});});};exports[_0xf20d('0x1d')]=function(_0x419b19){var _0xc57064=this;return new Promise(function(_0x24b1e5,_0x5a9385){return db[_0xf20d('0x18')]['update'](_0x419b19['body'],{'raw':_0x419b19[_0xf20d('0x1b')]?_0x419b19[_0xf20d('0x1b')][_0xf20d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x419b19['options']?_0x419b19['options']['where']||null:null,'attributes':_0x419b19[_0xf20d('0x1b')]?_0x419b19[_0xf20d('0x1b')][_0xf20d('0x1e')]||null:null,'limit':_0x419b19['options']?_0x419b19[_0xf20d('0x1b')][_0xf20d('0x1f')]||null:null})[_0xf20d('0xb')](function(_0x8372b2){logger[_0xf20d('0xc')](_0xf20d('0x1d'),_0x419b19);logger[_0xf20d('0xe')]('UpdateFaxQueueReport',_0x419b19,JSON['stringify'](_0x8372b2));_0x24b1e5(_0x8372b2);})[_0xf20d('0x16')](function(_0x3f9451){logger['error'](_0xf20d('0x1d'),_0x3f9451[_0xf20d('0x14')],_0x419b19);_0x5a9385(_0xc57064[_0xf20d('0x12')](0x1f4,_0x3f9451[_0xf20d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index b0bd652..dc462c6 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 _0xfad1=['delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update'];(function(_0x12833b,_0x26c1d2){var _0x3acad3=function(_0x2f9ec9){while(--_0x2f9ec9){_0x12833b['push'](_0x12833b['shift']());}};_0x3acad3(++_0x26c1d2);}(_0xfad1,0x8f));var _0x1fad=function(_0x5322cc,_0x428000){_0x5322cc=_0x5322cc-0x0;var _0x5daf96=_0xfad1[_0x5322cc];return _0x5daf96;};'use strict';var multer=require(_0x1fad('0x0'));var util=require(_0x1fad('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1fad('0x2')]();var auth=require(_0x1fad('0x3'));var interaction=require(_0x1fad('0x4'));var config=require(_0x1fad('0x5'));var controller=require(_0x1fad('0x6'));router[_0x1fad('0x7')]('/',auth[_0x1fad('0x8')](),controller[_0x1fad('0x9')]);router[_0x1fad('0x7')](_0x1fad('0xa'),auth['isAuthenticated'](),controller[_0x1fad('0xb')]);router['get'](_0x1fad('0xc'),auth[_0x1fad('0x8')](),controller[_0x1fad('0xd')]);router[_0x1fad('0xe')]('/',auth[_0x1fad('0x8')](),controller[_0x1fad('0xf')]);router['put'](_0x1fad('0xc'),auth[_0x1fad('0x8')](),controller[_0x1fad('0x10')]);router[_0x1fad('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x1fad('0x12')]);module[_0x1fad('0x13')]=router; \ No newline at end of file +var _0x3ba6=['util','express','../../components/auth/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','index','get','/describe','/:id','show','post','create','put','update','destroy','exports','multer'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3ba6,0x8f));var _0x63ba=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x3ba6[_0xd09668];return _0x68726;};'use strict';var multer=require(_0x63ba('0x0'));var util=require(_0x63ba('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x63ba('0x2'));var router=express['Router']();var auth=require(_0x63ba('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x63ba('0x4'));var controller=require(_0x63ba('0x5'));router['get']('/',auth[_0x63ba('0x6')](),controller[_0x63ba('0x7')]);router[_0x63ba('0x8')](_0x63ba('0x9'),auth[_0x63ba('0x6')](),controller['describe']);router['get'](_0x63ba('0xa'),auth[_0x63ba('0x6')](),controller[_0x63ba('0xb')]);router[_0x63ba('0xc')]('/',auth[_0x63ba('0x6')](),controller[_0x63ba('0xd')]);router[_0x63ba('0xe')](_0x63ba('0xa'),auth['isAuthenticated'](),controller[_0x63ba('0xf')]);router['delete'](_0x63ba('0xa'),auth[_0x63ba('0x6')](),controller[_0x63ba('0x10')]);module[_0x63ba('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 3f7dac7..ffb26fd 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 _0x3d45=['queue','DATE','NOW','moment','exports','STRING','ENUM','account','agent'];(function(_0x4ab42f,_0x437617){var _0xbdf43=function(_0x273a82){while(--_0x273a82){_0x4ab42f['push'](_0x4ab42f['shift']());}};_0xbdf43(++_0x437617);}(_0x3d45,0x18f));var _0x53d4=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x3d45[_0x5ddb1c];return _0x354adc;};'use strict';var moment=require(_0x53d4('0x0'));var Sequelize=require('sequelize');module[_0x53d4('0x1')]={'uniqueid':{'type':Sequelize[_0x53d4('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x53d4('0x3')](_0x53d4('0x4'),_0x53d4('0x5'),_0x53d4('0x6')),'allowNull':![],'defaultValue':_0x53d4('0x6')},'transferredAt':{'type':Sequelize[_0x53d4('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x53d4('0x8')]}}; \ No newline at end of file +var _0xfebf=['ENUM','account','agent','queue','DATE','moment','sequelize','exports','STRING'];(function(_0x4f37da,_0x49d4d3){var _0x3a8c81=function(_0x149538){while(--_0x149538){_0x4f37da['push'](_0x4f37da['shift']());}};_0x3a8c81(++_0x49d4d3);}(_0xfebf,0x176));var _0xffeb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfebf[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xffeb('0x0'));var Sequelize=require(_0xffeb('0x1'));module[_0xffeb('0x2')]={'uniqueid':{'type':Sequelize[_0xffeb('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xffeb('0x4')](_0xffeb('0x5'),_0xffeb('0x6'),_0xffeb('0x7')),'allowNull':![],'defaultValue':_0xffeb('0x7')},'transferredAt':{'type':Sequelize[_0xffeb('0x8')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 33d81ab..54f143f 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 _0x485d=['day','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','FaxTransferReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','offset','order','sort','where','pick','add'];(function(_0x1a80fd,_0x4c915c){var _0x2a30aa=function(_0x397df8){while(--_0x397df8){_0x1a80fd['push'](_0x1a80fd['shift']());}};_0x2a30aa(++_0x4c915c);}(_0x485d,0x137));var _0xd485=function(_0x65c903,_0x41e920){_0x65c903=_0x65c903-0x0;var _0x23e1d7=_0x485d[_0x65c903];return _0x23e1d7;};'use strict';var pdf=require(_0xd485('0x0'));var emlformat=require(_0xd485('0x1'));var rimraf=require(_0xd485('0x2'));var zipdir=require(_0xd485('0x3'));var jsonpatch=require(_0xd485('0x4'));var rp=require(_0xd485('0x5'));var moment=require(_0xd485('0x6'));var BPromise=require(_0xd485('0x7'));var Mustache=require(_0xd485('0x8'));var util=require('util');var path=require(_0xd485('0x9'));var sox=require('sox');var csv=require(_0xd485('0xa'));var ejs=require(_0xd485('0xb'));var fs=require('fs');var _=require(_0xd485('0xc'));var squel=require('squel');var crypto=require(_0xd485('0xd'));var jsforce=require(_0xd485('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd485('0xa'));var querystring=require(_0xd485('0xf'));var Papa=require(_0xd485('0x10'));var Redis=require('ioredis');var qs=require(_0xd485('0x11'));var logger=require(_0xd485('0x12'))(_0xd485('0x13'));var utils=require(_0xd485('0x14'));var config=require('../../config/environment');var db=require(_0xd485('0x15'))['db'];function respondWithStatusCode(_0x2849d6,_0x4284b4){_0x4284b4=_0x4284b4||0xcc;return function(_0x36b630){if(_0x36b630){return _0x2849d6[_0xd485('0x16')](_0x4284b4);}return _0x2849d6[_0xd485('0x17')](_0x4284b4)[_0xd485('0x18')]();};}function respondWithResult(_0x5e1d2b,_0x4d4316){_0x4d4316=_0x4d4316||0xc8;return function(_0x46a1b8){if(_0x46a1b8){return _0x5e1d2b[_0xd485('0x17')](_0x4d4316)[_0xd485('0x19')](_0x46a1b8);}};}function respondWithFilteredResult(_0x27f8d5,_0x34247a){return function(_0x1d7bf5){if(_0x1d7bf5){var _0x5da644=_0x1d7bf5[_0xd485('0x1a')],_0x34aa51=_0x34247a['offset'],_0x289993=_0x34247a['offset']+_0x34247a[_0xd485('0x1b')],_0x64e94e;if(_0x289993>=_0x5da644){_0x289993=_0x5da644;_0x64e94e=0xc8;}else{_0x64e94e=0xce;}_0x27f8d5['status'](_0x64e94e);return _0x27f8d5['set'](_0xd485('0x1c'),_0x34aa51+'-'+_0x289993+'/'+_0x5da644)[_0xd485('0x19')](_0x1d7bf5);}return null;};}function patchUpdates(_0x4f6219){return function(_0x59b201){try{jsonpatch[_0xd485('0x1d')](_0x59b201,_0x4f6219,!![]);}catch(_0x38cfda){return BPromise[_0xd485('0x1e')](_0x38cfda);}return _0x59b201[_0xd485('0x1f')]();};}function saveUpdates(_0x1c968b,_0x47913c){return function(_0x1320f7){if(_0x1320f7){return _0x1320f7[_0xd485('0x20')](_0x1c968b)[_0xd485('0x21')](function(_0x27313f){return _0x27313f;});}return null;};}function removeEntity(_0x295854,_0x13fb88){return function(_0x4a0877){if(_0x4a0877){return _0x4a0877[_0xd485('0x22')]()[_0xd485('0x21')](function(){_0x295854[_0xd485('0x17')](0xcc)[_0xd485('0x18')]();});}};}function handleEntityNotFound(_0x4de794,_0x36bcd6){return function(_0x50afbc){if(!_0x50afbc){_0x4de794[_0xd485('0x16')](0x194);}return _0x50afbc;};}function handleError(_0x2c2b41,_0x1e9778){_0x1e9778=_0x1e9778||0x1f4;return function(_0x35d77c){logger[_0xd485('0x23')](_0x35d77c[_0xd485('0x24')]);if(_0x35d77c[_0xd485('0x25')]){delete _0x35d77c['name'];}_0x2c2b41[_0xd485('0x17')](_0x1e9778)[_0xd485('0x26')](_0x35d77c);};}exports[_0xd485('0x27')]=function(_0x21da53,_0x1a91e7){var _0x51af1d={},_0x3de44e={},_0x399669={'count':0x0,'rows':[]};var _0x4075b2=db[_0xd485('0x28')][_0xd485('0x29')];_0x3de44e[_0xd485('0x2a')]=_[_0xd485('0x2b')](_0x4075b2);var _0x18d3ee={'dateStart':_0x21da53[_0xd485('0x2c')][_0xd485('0x2d')],'dateEnd':_0x21da53[_0xd485('0x2c')][_0xd485('0x2e')]};delete _0x21da53[_0xd485('0x2c')][_0xd485('0x2d')];delete _0x21da53[_0xd485('0x2c')][_0xd485('0x2e')];_0x3de44e['query']=_['keys'](_0x21da53[_0xd485('0x2c')]);_0x3de44e[_0xd485('0x2f')]=_['intersection'](_0x3de44e[_0xd485('0x2a')],_0x3de44e[_0xd485('0x2c')]);_0x51af1d[_0xd485('0x30')]=_[_0xd485('0x31')](_0x3de44e['model'],qs[_0xd485('0x32')](_0x21da53['query']['fields']));_0x51af1d['attributes']=_0x51af1d[_0xd485('0x30')][_0xd485('0x33')]?_0x51af1d[_0xd485('0x30')]:_0x3de44e['model'];if(!_0x21da53[_0xd485('0x2c')][_0xd485('0x34')]('nolimit')){_0x51af1d[_0xd485('0x1b')]=qs[_0xd485('0x1b')](_0x21da53[_0xd485('0x2c')][_0xd485('0x1b')]);_0x51af1d[_0xd485('0x35')]=qs[_0xd485('0x35')](_0x21da53[_0xd485('0x2c')][_0xd485('0x35')]);}_0x51af1d[_0xd485('0x36')]=qs[_0xd485('0x37')](_0x21da53[_0xd485('0x2c')]['sort']);_0x51af1d[_0xd485('0x38')]=qs[_0xd485('0x2f')](_[_0xd485('0x39')](_0x21da53[_0xd485('0x2c')],_0x3de44e[_0xd485('0x2f')]));if(_0x18d3ee[_0xd485('0x2d')]){if(_0x18d3ee['dateEnd']){_0x18d3ee[_0xd485('0x2e')]=moment(_0x18d3ee['dateEnd'])[_0xd485('0x3a')](0x1,_0xd485('0x3b'));}else{_0x18d3ee['dateEnd']=moment(_0x18d3ee['dateStart'])[_0xd485('0x3a')](0x1,_0xd485('0x3b'));}_['merge'](_0x51af1d[_0xd485('0x38')],{'createdAt':{'$gte':_0x18d3ee[_0xd485('0x2d')],'$lte':_0x18d3ee[_0xd485('0x2e')]}});}if(_0x21da53[_0xd485('0x2c')][_0xd485('0x3c')]){_0x51af1d[_0xd485('0x38')]=_[_0xd485('0x3d')](_0x51af1d[_0xd485('0x38')],{'$or':_[_0xd485('0x3e')](_0x51af1d[_0xd485('0x30')],function(_0x25964e){var _0x38c1d0={};_0x38c1d0[_0x25964e]={'$like':'%'+_0x21da53[_0xd485('0x2c')]['filter']+'%'};return _0x38c1d0;})});}_0x51af1d=_['merge']({},_0x51af1d,_0x21da53[_0xd485('0x3f')]);var _0x493f5e={'where':_0x51af1d[_0xd485('0x38')]};return db[_0xd485('0x28')][_0xd485('0x1a')](_0x493f5e)[_0xd485('0x21')](function(_0x452ff4){_0x399669[_0xd485('0x1a')]=_0x452ff4;if(_0x21da53[_0xd485('0x2c')][_0xd485('0x40')]){_0x51af1d[_0xd485('0x41')]=[{'all':!![]}];}return db[_0xd485('0x28')][_0xd485('0x42')](_0x51af1d);})[_0xd485('0x21')](function(_0xa9a36e){_0x399669[_0xd485('0x43')]=_0xa9a36e;return _0x399669;})[_0xd485('0x21')](respondWithFilteredResult(_0x1a91e7,_0x51af1d))[_0xd485('0x44')](handleError(_0x1a91e7,null));};exports[_0xd485('0x45')]=function(_0x429f25,_0x32eb1f){var _0x3ef616={'raw':!![],'where':{'id':_0x429f25['params']['id']}},_0x5e78e7={};_0x5e78e7['model']=_[_0xd485('0x2b')](db[_0xd485('0x28')][_0xd485('0x29')]);_0x5e78e7[_0xd485('0x2c')]=_['keys'](_0x429f25[_0xd485('0x2c')]);_0x5e78e7[_0xd485('0x2f')]=_[_0xd485('0x31')](_0x5e78e7[_0xd485('0x2a')],_0x5e78e7[_0xd485('0x2c')]);_0x3ef616[_0xd485('0x30')]=_[_0xd485('0x31')](_0x5e78e7[_0xd485('0x2a')],qs['fields'](_0x429f25[_0xd485('0x2c')][_0xd485('0x32')]));_0x3ef616['attributes']=_0x3ef616['attributes'][_0xd485('0x33')]?_0x3ef616['attributes']:_0x5e78e7['model'];if(_0x429f25[_0xd485('0x2c')][_0xd485('0x40')]){_0x3ef616['include']=[{'all':!![]}];}_0x3ef616=_[_0xd485('0x3d')]({},_0x3ef616,_0x429f25[_0xd485('0x3f')]);return db[_0xd485('0x28')][_0xd485('0x46')](_0x3ef616)[_0xd485('0x21')](handleEntityNotFound(_0x32eb1f,null))[_0xd485('0x21')](respondWithResult(_0x32eb1f,null))[_0xd485('0x44')](handleError(_0x32eb1f,null));};exports[_0xd485('0x47')]=function(_0x14606e,_0x492813){return db[_0xd485('0x28')][_0xd485('0x47')](_0x14606e[_0xd485('0x48')],{})['then'](respondWithResult(_0x492813,0xc9))[_0xd485('0x44')](handleError(_0x492813,null));};exports[_0xd485('0x20')]=function(_0x40f065,_0x31578e){if(_0x40f065[_0xd485('0x48')]['id']){delete _0x40f065[_0xd485('0x48')]['id'];}return db[_0xd485('0x28')][_0xd485('0x46')]({'where':{'id':_0x40f065[_0xd485('0x49')]['id']}})[_0xd485('0x21')](handleEntityNotFound(_0x31578e,null))[_0xd485('0x21')](saveUpdates(_0x40f065['body'],null))[_0xd485('0x21')](respondWithResult(_0x31578e,null))[_0xd485('0x44')](handleError(_0x31578e,null));};exports[_0xd485('0x22')]=function(_0x597ab1,_0x206324){return db[_0xd485('0x28')][_0xd485('0x46')]({'where':{'id':_0x597ab1['params']['id']}})[_0xd485('0x21')](handleEntityNotFound(_0x206324,null))[_0xd485('0x21')](removeEntity(_0x206324,null))[_0xd485('0x44')](handleError(_0x206324,null));};exports['describe']=function(_0x52244b,_0x4bbd15){return db[_0xd485('0x28')]['describe']()[_0xd485('0x21')](respondWithResult(_0x4bbd15,null))[_0xd485('0x44')](handleError(_0x4bbd15,null));}; \ No newline at end of file +var _0xed41=['keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','nolimit','order','sort','where','add','merge','filter','map','options','includeAll','rows','catch','show','params','include','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','FaxTransferReport','rawAttributes','model'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0xed41,0x188));var _0x1ed4=function(_0x45b2de,_0x3a1af6){_0x45b2de=_0x45b2de-0x0;var _0x264784=_0xed41[_0x45b2de];return _0x264784;};'use strict';var pdf=require(_0x1ed4('0x0'));var emlformat=require(_0x1ed4('0x1'));var rimraf=require(_0x1ed4('0x2'));var zipdir=require(_0x1ed4('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1ed4('0x4'));var moment=require(_0x1ed4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1ed4('0x6'));var path=require(_0x1ed4('0x7'));var sox=require(_0x1ed4('0x8'));var csv=require('to-csv');var ejs=require(_0x1ed4('0x9'));var fs=require('fs');var _=require(_0x1ed4('0xa'));var squel=require(_0x1ed4('0xb'));var crypto=require('crypto');var jsforce=require(_0x1ed4('0xc'));var deskjs=require(_0x1ed4('0xd'));var toCsv=require(_0x1ed4('0xe'));var querystring=require(_0x1ed4('0xf'));var Papa=require(_0x1ed4('0x10'));var Redis=require(_0x1ed4('0x11'));var qs=require(_0x1ed4('0x12'));var logger=require(_0x1ed4('0x13'))(_0x1ed4('0x14'));var utils=require(_0x1ed4('0x15'));var config=require(_0x1ed4('0x16'));var db=require(_0x1ed4('0x17'))['db'];function respondWithStatusCode(_0x2b820c,_0xd0979b){_0xd0979b=_0xd0979b||0xcc;return function(_0x44d78a){if(_0x44d78a){return _0x2b820c[_0x1ed4('0x18')](_0xd0979b);}return _0x2b820c[_0x1ed4('0x19')](_0xd0979b)[_0x1ed4('0x1a')]();};}function respondWithResult(_0x5a1079,_0x1a4734){_0x1a4734=_0x1a4734||0xc8;return function(_0x222e82){if(_0x222e82){return _0x5a1079[_0x1ed4('0x19')](_0x1a4734)[_0x1ed4('0x1b')](_0x222e82);}};}function respondWithFilteredResult(_0x24c9ec,_0x4e1d85){return function(_0x48ead4){if(_0x48ead4){var _0x4ad3c7=_0x48ead4[_0x1ed4('0x1c')],_0x8ed6a1=_0x4e1d85[_0x1ed4('0x1d')],_0xe0b463=_0x4e1d85[_0x1ed4('0x1d')]+_0x4e1d85[_0x1ed4('0x1e')],_0x12e50b;if(_0xe0b463>=_0x4ad3c7){_0xe0b463=_0x4ad3c7;_0x12e50b=0xc8;}else{_0x12e50b=0xce;}_0x24c9ec[_0x1ed4('0x19')](_0x12e50b);return _0x24c9ec[_0x1ed4('0x1f')]('Content-Range',_0x8ed6a1+'-'+_0xe0b463+'/'+_0x4ad3c7)['json'](_0x48ead4);}return null;};}function patchUpdates(_0x434aad){return function(_0x422420){try{jsonpatch[_0x1ed4('0x20')](_0x422420,_0x434aad,!![]);}catch(_0x5db71f){return BPromise[_0x1ed4('0x21')](_0x5db71f);}return _0x422420[_0x1ed4('0x22')]();};}function saveUpdates(_0x59b365,_0x425f51){return function(_0x3a07eb){if(_0x3a07eb){return _0x3a07eb[_0x1ed4('0x23')](_0x59b365)[_0x1ed4('0x24')](function(_0x4ee8bc){return _0x4ee8bc;});}return null;};}function removeEntity(_0x1ed7a8,_0x1c73d1){return function(_0x45dc43){if(_0x45dc43){return _0x45dc43[_0x1ed4('0x25')]()[_0x1ed4('0x24')](function(){_0x1ed7a8[_0x1ed4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d806a,_0x4d6a3c){return function(_0x2de7ad){if(!_0x2de7ad){_0x4d806a['sendStatus'](0x194);}return _0x2de7ad;};}function handleError(_0xf31923,_0x4221c1){_0x4221c1=_0x4221c1||0x1f4;return function(_0x21449d){logger[_0x1ed4('0x26')](_0x21449d[_0x1ed4('0x27')]);if(_0x21449d[_0x1ed4('0x28')]){delete _0x21449d[_0x1ed4('0x28')];}_0xf31923[_0x1ed4('0x19')](_0x4221c1)[_0x1ed4('0x29')](_0x21449d);};}exports[_0x1ed4('0x2a')]=function(_0x1d9eb5,_0x33f92d){var _0x2c7aed={},_0x4afc3d={},_0x42a93a={'count':0x0,'rows':[]};var _0x1aa6a7=db[_0x1ed4('0x2b')][_0x1ed4('0x2c')];_0x4afc3d[_0x1ed4('0x2d')]=_[_0x1ed4('0x2e')](_0x1aa6a7);var _0x5255fb={'dateStart':_0x1d9eb5[_0x1ed4('0x2f')][_0x1ed4('0x30')],'dateEnd':_0x1d9eb5[_0x1ed4('0x2f')][_0x1ed4('0x31')]};delete _0x1d9eb5[_0x1ed4('0x2f')][_0x1ed4('0x30')];delete _0x1d9eb5[_0x1ed4('0x2f')][_0x1ed4('0x31')];_0x4afc3d[_0x1ed4('0x2f')]=_[_0x1ed4('0x2e')](_0x1d9eb5[_0x1ed4('0x2f')]);_0x4afc3d[_0x1ed4('0x32')]=_[_0x1ed4('0x33')](_0x4afc3d['model'],_0x4afc3d[_0x1ed4('0x2f')]);_0x2c7aed[_0x1ed4('0x34')]=_[_0x1ed4('0x33')](_0x4afc3d[_0x1ed4('0x2d')],qs['fields'](_0x1d9eb5[_0x1ed4('0x2f')][_0x1ed4('0x35')]));_0x2c7aed['attributes']=_0x2c7aed['attributes'][_0x1ed4('0x36')]?_0x2c7aed[_0x1ed4('0x34')]:_0x4afc3d[_0x1ed4('0x2d')];if(!_0x1d9eb5['query']['hasOwnProperty'](_0x1ed4('0x37'))){_0x2c7aed['limit']=qs['limit'](_0x1d9eb5[_0x1ed4('0x2f')][_0x1ed4('0x1e')]);_0x2c7aed[_0x1ed4('0x1d')]=qs[_0x1ed4('0x1d')](_0x1d9eb5[_0x1ed4('0x2f')][_0x1ed4('0x1d')]);}_0x2c7aed[_0x1ed4('0x38')]=qs[_0x1ed4('0x39')](_0x1d9eb5[_0x1ed4('0x2f')][_0x1ed4('0x39')]);_0x2c7aed[_0x1ed4('0x3a')]=qs['filters'](_['pick'](_0x1d9eb5[_0x1ed4('0x2f')],_0x4afc3d[_0x1ed4('0x32')]));if(_0x5255fb[_0x1ed4('0x30')]){if(_0x5255fb[_0x1ed4('0x31')]){_0x5255fb[_0x1ed4('0x31')]=moment(_0x5255fb[_0x1ed4('0x31')])[_0x1ed4('0x3b')](0x1,'day');}else{_0x5255fb[_0x1ed4('0x31')]=moment(_0x5255fb[_0x1ed4('0x30')])['add'](0x1,'day');}_[_0x1ed4('0x3c')](_0x2c7aed['where'],{'createdAt':{'$gte':_0x5255fb[_0x1ed4('0x30')],'$lte':_0x5255fb[_0x1ed4('0x31')]}});}if(_0x1d9eb5[_0x1ed4('0x2f')][_0x1ed4('0x3d')]){_0x2c7aed[_0x1ed4('0x3a')]=_[_0x1ed4('0x3c')](_0x2c7aed['where'],{'$or':_[_0x1ed4('0x3e')](_0x2c7aed[_0x1ed4('0x34')],function(_0x260842){var _0x1bbf09={};_0x1bbf09[_0x260842]={'$like':'%'+_0x1d9eb5[_0x1ed4('0x2f')][_0x1ed4('0x3d')]+'%'};return _0x1bbf09;})});}_0x2c7aed=_[_0x1ed4('0x3c')]({},_0x2c7aed,_0x1d9eb5[_0x1ed4('0x3f')]);var _0x5bc480={'where':_0x2c7aed[_0x1ed4('0x3a')]};return db[_0x1ed4('0x2b')][_0x1ed4('0x1c')](_0x5bc480)['then'](function(_0x1daa30){_0x42a93a[_0x1ed4('0x1c')]=_0x1daa30;if(_0x1d9eb5[_0x1ed4('0x2f')][_0x1ed4('0x40')]){_0x2c7aed['include']=[{'all':!![]}];}return db['FaxTransferReport']['findAll'](_0x2c7aed);})[_0x1ed4('0x24')](function(_0x52f5c5){_0x42a93a[_0x1ed4('0x41')]=_0x52f5c5;return _0x42a93a;})[_0x1ed4('0x24')](respondWithFilteredResult(_0x33f92d,_0x2c7aed))[_0x1ed4('0x42')](handleError(_0x33f92d,null));};exports[_0x1ed4('0x43')]=function(_0x436b65,_0x3304d1){var _0x15abcc={'raw':!![],'where':{'id':_0x436b65[_0x1ed4('0x44')]['id']}},_0x776c3a={};_0x776c3a[_0x1ed4('0x2d')]=_[_0x1ed4('0x2e')](db[_0x1ed4('0x2b')][_0x1ed4('0x2c')]);_0x776c3a[_0x1ed4('0x2f')]=_['keys'](_0x436b65['query']);_0x776c3a[_0x1ed4('0x32')]=_[_0x1ed4('0x33')](_0x776c3a[_0x1ed4('0x2d')],_0x776c3a[_0x1ed4('0x2f')]);_0x15abcc[_0x1ed4('0x34')]=_[_0x1ed4('0x33')](_0x776c3a['model'],qs[_0x1ed4('0x35')](_0x436b65[_0x1ed4('0x2f')]['fields']));_0x15abcc[_0x1ed4('0x34')]=_0x15abcc[_0x1ed4('0x34')]['length']?_0x15abcc['attributes']:_0x776c3a[_0x1ed4('0x2d')];if(_0x436b65[_0x1ed4('0x2f')][_0x1ed4('0x40')]){_0x15abcc[_0x1ed4('0x45')]=[{'all':!![]}];}_0x15abcc=_[_0x1ed4('0x3c')]({},_0x15abcc,_0x436b65[_0x1ed4('0x3f')]);return db[_0x1ed4('0x2b')]['find'](_0x15abcc)['then'](handleEntityNotFound(_0x3304d1,null))[_0x1ed4('0x24')](respondWithResult(_0x3304d1,null))[_0x1ed4('0x42')](handleError(_0x3304d1,null));};exports[_0x1ed4('0x46')]=function(_0x4586a6,_0x5573bb){return db[_0x1ed4('0x2b')][_0x1ed4('0x46')](_0x4586a6[_0x1ed4('0x47')],{})[_0x1ed4('0x24')](respondWithResult(_0x5573bb,0xc9))[_0x1ed4('0x42')](handleError(_0x5573bb,null));};exports[_0x1ed4('0x23')]=function(_0x131e82,_0x5e63fb){if(_0x131e82[_0x1ed4('0x47')]['id']){delete _0x131e82[_0x1ed4('0x47')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x131e82[_0x1ed4('0x44')]['id']}})['then'](handleEntityNotFound(_0x5e63fb,null))[_0x1ed4('0x24')](saveUpdates(_0x131e82[_0x1ed4('0x47')],null))['then'](respondWithResult(_0x5e63fb,null))[_0x1ed4('0x42')](handleError(_0x5e63fb,null));};exports[_0x1ed4('0x25')]=function(_0x541a0c,_0x3a379c){return db[_0x1ed4('0x2b')]['find']({'where':{'id':_0x541a0c['params']['id']}})[_0x1ed4('0x24')](handleEntityNotFound(_0x3a379c,null))[_0x1ed4('0x24')](removeEntity(_0x3a379c,null))[_0x1ed4('0x42')](handleError(_0x3a379c,null));};exports[_0x1ed4('0x48')]=function(_0x186329,_0x4059f8){return db[_0x1ed4('0x2b')][_0x1ed4('0x48')]()[_0x1ed4('0x24')](respondWithResult(_0x4059f8,null))[_0x1ed4('0x42')](handleError(_0x4059f8,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 4034d80..151ea06 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 _0x97fd=['api','moment','bluebird','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x97fd,0x81));var _0xd97f=function(_0x2683e1,_0x1df41e){_0x2683e1=_0x2683e1-0x0;var _0x41ee61=_0x97fd[_0x2683e1];return _0x41ee61;};'use strict';var _=require(_0xd97f('0x0'));var util=require(_0xd97f('0x1'));var logger=require(_0xd97f('0x2'))(_0xd97f('0x3'));var moment=require(_0xd97f('0x4'));var BPromise=require(_0xd97f('0x5'));var rp=require('request-promise');var attributes=require(_0xd97f('0x6'));module[_0xd97f('0x7')]=function(_0x11d69c,_0x4b72ca){return _0x11d69c[_0xd97f('0x8')](_0xd97f('0x9'),attributes,{'tableName':_0xd97f('0xa'),'paranoid':![],'indexes':[{'name':_0xd97f('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd42b=['lodash','util','../../config/logger','moment','exports','define','report_fax_transfer','uniqueid'];(function(_0x4ccad7,_0x1a4e2c){var _0x5b769d=function(_0x54ecf0){while(--_0x54ecf0){_0x4ccad7['push'](_0x4ccad7['shift']());}};_0x5b769d(++_0x1a4e2c);}(_0xd42b,0x1c8));var _0xbd42=function(_0x305486,_0x24acd4){_0x305486=_0x305486-0x0;var _0xa04940=_0xd42b[_0x305486];return _0xa04940;};'use strict';var _=require(_0xbd42('0x0'));var util=require(_0xbd42('0x1'));var logger=require(_0xbd42('0x2'))('api');var moment=require(_0xbd42('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./faxTransferReport.attributes');module[_0xbd42('0x4')]=function(_0x29f774,_0x3f8dc2){return _0x29f774[_0xbd42('0x5')]('FaxTransferReport',attributes,{'tableName':_0xbd42('0x6'),'paranoid':![],'indexes':[{'name':_0xbd42('0x7'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index c319ba5..65ca186 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 _0xdb51=['randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment'];(function(_0x299926,_0x36c59b){var _0x28fa34=function(_0x27ad76){while(--_0x27ad76){_0x299926['push'](_0x299926['shift']());}};_0x28fa34(++_0x36c59b);}(_0xdb51,0x1b5));var _0x1db5=function(_0xf37618,_0x350774){_0xf37618=_0xf37618-0x0;var _0x5dc0ca=_0xdb51[_0xf37618];return _0x5dc0ca;};'use strict';var _=require(_0x1db5('0x0'));var util=require(_0x1db5('0x1'));var moment=require(_0x1db5('0x2'));var BPromise=require('bluebird');var rs=require(_0x1db5('0x3'));var fs=require('fs');var Redis=require(_0x1db5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1db5('0x5'))('rpc');var config=require(_0x1db5('0x6'));var jayson=require(_0x1db5('0x7'));var client=jayson[_0x1db5('0x8')][_0x1db5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x278385,_0x1a73ba,_0x8817fa){return new BPromise(function(_0x4e3f74,_0x35c249){return client[_0x1db5('0xa')](_0x278385,_0x8817fa)[_0x1db5('0xb')](function(_0xd09ab0){logger[_0x1db5('0xc')](_0x1db5('0xd'),_0x1a73ba,_0x1db5('0xe'));logger['debug'](_0x1db5('0xf'),_0x1a73ba,_0x1db5('0xe'),JSON[_0x1db5('0x10')](_0xd09ab0));if(_0xd09ab0['error']){if(_0xd09ab0['error'][_0x1db5('0x11')]===0x1f4){logger[_0x1db5('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x1a73ba,_0xd09ab0[_0x1db5('0x12')]['message']);return _0x35c249(_0xd09ab0[_0x1db5('0x12')][_0x1db5('0x13')]);}logger[_0x1db5('0x12')](_0x1db5('0xd'),_0x1a73ba,_0xd09ab0[_0x1db5('0x12')][_0x1db5('0x13')]);return _0x4e3f74(_0xd09ab0[_0x1db5('0x12')][_0x1db5('0x13')]);}else{logger[_0x1db5('0xc')](_0x1db5('0xd'),_0x1a73ba,_0x1db5('0xe'));_0x4e3f74(_0xd09ab0[_0x1db5('0x14')][_0x1db5('0x13')]);}})[_0x1db5('0x15')](function(_0x43ba91){logger['error'](_0x1db5('0xd'),_0x1a73ba,_0x43ba91);_0x35c249(_0x43ba91);});});} \ No newline at end of file +var _0x5fb5=['code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5fb5,0x1a8));var _0x55fb=function(_0x9bca53,_0x59b4f8){_0x9bca53=_0x9bca53-0x0;var _0x3894bc=_0x5fb5[_0x9bca53];return _0x3894bc;};'use strict';var _=require(_0x55fb('0x0'));var util=require(_0x55fb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x55fb('0x2'));var fs=require('fs');var Redis=require(_0x55fb('0x3'));var db=require(_0x55fb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x55fb('0x5'))(_0x55fb('0x6'));var config=require(_0x55fb('0x7'));var jayson=require(_0x55fb('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x283cee,_0x1b38ed,_0x5981d6){return new BPromise(function(_0x5b4ca8,_0x18e3eb){return client[_0x55fb('0x9')](_0x283cee,_0x5981d6)[_0x55fb('0xa')](function(_0x57c331){logger[_0x55fb('0xb')](_0x55fb('0xc'),_0x1b38ed,_0x55fb('0xd'));logger[_0x55fb('0xe')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x1b38ed,'request\x20sent',JSON[_0x55fb('0xf')](_0x57c331));if(_0x57c331['error']){if(_0x57c331[_0x55fb('0x10')][_0x55fb('0x11')]===0x1f4){logger['error'](_0x55fb('0xc'),_0x1b38ed,_0x57c331['error'][_0x55fb('0x12')]);return _0x18e3eb(_0x57c331[_0x55fb('0x10')]['message']);}logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x1b38ed,_0x57c331[_0x55fb('0x10')]['message']);return _0x5b4ca8(_0x57c331[_0x55fb('0x10')][_0x55fb('0x12')]);}else{logger[_0x55fb('0xb')](_0x55fb('0xc'),_0x1b38ed,_0x55fb('0xd'));_0x5b4ca8(_0x57c331[_0x55fb('0x13')][_0x55fb('0x12')]);}})[_0x55fb('0x14')](function(_0x3f5ad3){logger[_0x55fb('0x10')](_0x55fb('0xc'),_0x1b38ed,_0x3f5ad3);_0x18e3eb(_0x3f5ad3);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 2d252ac..12f3427 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 _0xae24=['isAuthenticated','index','/describe','/:id','post','put','update','destroy','multer','path','express','Router','../../config/environment','get'];(function(_0x23a3fa,_0x1cf13e){var _0x1104b1=function(_0x5b71e7){while(--_0x5b71e7){_0x23a3fa['push'](_0x23a3fa['shift']());}};_0x1104b1(++_0x1cf13e);}(_0xae24,0x182));var _0x4ae2=function(_0x4aba29,_0x52dde9){_0x4aba29=_0x4aba29-0x0;var _0x455a90=_0xae24[_0x4aba29];return _0x455a90;};'use strict';var multer=require(_0x4ae2('0x0'));var util=require('util');var path=require(_0x4ae2('0x1'));var timeout=require('connect-timeout');var express=require(_0x4ae2('0x2'));var router=express[_0x4ae2('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4ae2('0x4'));var controller=require('./faxTransferReport.controller');router[_0x4ae2('0x5')]('/',auth[_0x4ae2('0x6')](),controller[_0x4ae2('0x7')]);router[_0x4ae2('0x5')](_0x4ae2('0x8'),auth[_0x4ae2('0x6')](),controller['describe']);router['get'](_0x4ae2('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x4ae2('0xa')]('/',auth[_0x4ae2('0x6')](),controller['create']);router[_0x4ae2('0xb')](_0x4ae2('0x9'),auth[_0x4ae2('0x6')](),controller[_0x4ae2('0xc')]);router['delete'](_0x4ae2('0x9'),auth[_0x4ae2('0x6')](),controller[_0x4ae2('0xd')]);module['exports']=router; \ No newline at end of file +var _0x8ef6=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x53eb37,_0x5a7463){var _0x20743d=function(_0x418246){while(--_0x418246){_0x53eb37['push'](_0x53eb37['shift']());}};_0x20743d(++_0x5a7463);}(_0x8ef6,0xf2));var _0x68ef=function(_0x2c30e8,_0x40f8a6){_0x2c30e8=_0x2c30e8-0x0;var _0x191bab=_0x8ef6[_0x2c30e8];return _0x191bab;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var auth=require(_0x68ef('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x68ef('0x7'));var controller=require(_0x68ef('0x8'));router[_0x68ef('0x9')]('/',auth[_0x68ef('0xa')](),controller['index']);router['get'](_0x68ef('0xb'),auth[_0x68ef('0xa')](),controller[_0x68ef('0xc')]);router['get'](_0x68ef('0xd'),auth[_0x68ef('0xa')](),controller[_0x68ef('0xe')]);router[_0x68ef('0xf')]('/',auth[_0x68ef('0xa')](),controller[_0x68ef('0x10')]);router[_0x68ef('0x11')](_0x68ef('0xd'),auth[_0x68ef('0xa')](),controller[_0x68ef('0x12')]);router[_0x68ef('0x13')](_0x68ef('0xd'),auth['isAuthenticated'](),controller[_0x68ef('0x14')]);module[_0x68ef('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index ebba63f..31af94e 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 _0x8a45=['express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','get','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x3eedab,_0x7f4706){var _0x938080=function(_0x601793){while(--_0x601793){_0x3eedab['push'](_0x3eedab['shift']());}};_0x938080(++_0x7f4706);}(_0x8a45,0x110));var _0x58a4=function(_0x49d023,_0x4b166e){_0x49d023=_0x49d023-0x0;var _0x42ff76=_0x8a45[_0x49d023];return _0x42ff76;};'use strict';var multer=require(_0x58a4('0x0'));var util=require(_0x58a4('0x1'));var path=require(_0x58a4('0x2'));var timeout=require(_0x58a4('0x3'));var express=require(_0x58a4('0x4'));var router=express[_0x58a4('0x5')]();var auth=require(_0x58a4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x58a4('0x7'));var controller=require('./intDeskAccount.controller');router['get']('/',auth[_0x58a4('0x8')](),controller[_0x58a4('0x9')]);router['get'](_0x58a4('0xa'),auth[_0x58a4('0x8')](),controller[_0x58a4('0xb')]);router['get'](_0x58a4('0xc'),auth['isAuthenticated'](),controller[_0x58a4('0xd')]);router[_0x58a4('0xe')](_0x58a4('0xf'),auth[_0x58a4('0x8')](),controller['getFields']);router[_0x58a4('0x10')]('/',auth[_0x58a4('0x8')](),controller[_0x58a4('0x11')]);router[_0x58a4('0x10')](_0x58a4('0xc'),auth[_0x58a4('0x8')](),controller[_0x58a4('0x12')]);router[_0x58a4('0x13')](_0x58a4('0xa'),auth[_0x58a4('0x8')](),controller[_0x58a4('0x14')]);router[_0x58a4('0x15')](_0x58a4('0xa'),auth[_0x58a4('0x8')](),controller[_0x58a4('0x16')]);module['exports']=router; \ No newline at end of file +var _0xfcc6=['delete','destroy','exports','util','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration'];(function(_0x35c5a8,_0x8ecb48){var _0x34782c=function(_0x1b23ec){while(--_0x1b23ec){_0x35c5a8['push'](_0x35c5a8['shift']());}};_0x34782c(++_0x8ecb48);}(_0xfcc6,0x1f0));var _0x6fcc=function(_0x2fff83,_0x29d5fe){_0x2fff83=_0x2fff83-0x0;var _0xa2a722=_0xfcc6[_0x2fff83];return _0xa2a722;};'use strict';var multer=require('multer');var util=require(_0x6fcc('0x0'));var path=require('path');var timeout=require(_0x6fcc('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6fcc('0x2'));var config=require(_0x6fcc('0x3'));var controller=require('./intDeskAccount.controller');router[_0x6fcc('0x4')]('/',auth[_0x6fcc('0x5')](),controller[_0x6fcc('0x6')]);router[_0x6fcc('0x4')](_0x6fcc('0x7'),auth['isAuthenticated'](),controller['show']);router['get'](_0x6fcc('0x8'),auth[_0x6fcc('0x5')](),controller[_0x6fcc('0x9')]);router[_0x6fcc('0x4')](_0x6fcc('0xa'),auth['isAuthenticated'](),controller['getFields']);router[_0x6fcc('0xb')]('/',auth[_0x6fcc('0x5')](),controller[_0x6fcc('0xc')]);router[_0x6fcc('0xb')](_0x6fcc('0x8'),auth['isAuthenticated'](),controller[_0x6fcc('0xd')]);router['put']('/:id',auth[_0x6fcc('0x5')](),controller['update']);router[_0x6fcc('0xe')](_0x6fcc('0x7'),auth[_0x6fcc('0x5')](),controller[_0x6fcc('0xf')]);module[_0x6fcc('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 62863fd..5691b9d 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 _0x73f8=['exports','STRING','ENUM','basic','integrationTab','newTab','sequelize'];(function(_0x1aed80,_0x3ca6f6){var _0x43961e=function(_0x43bf2b){while(--_0x43bf2b){_0x1aed80['push'](_0x1aed80['shift']());}};_0x43961e(++_0x3ca6f6);}(_0x73f8,0x110));var _0x873f=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x73f8[_0x4baae2];return _0x1a2285;};'use strict';var Sequelize=require(_0x873f('0x0'));module[_0x873f('0x1')]={'name':{'type':Sequelize[_0x873f('0x2')]},'description':{'type':Sequelize[_0x873f('0x2')]},'username':{'type':Sequelize[_0x873f('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x873f('0x3')]('basic'),'defaultValue':_0x873f('0x4')},'password':{'type':Sequelize[_0x873f('0x2')]},'consumerKey':{'type':Sequelize[_0x873f('0x2')]},'consumerSecret':{'type':Sequelize[_0x873f('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x873f('0x2')]},'type':{'type':Sequelize[_0x873f('0x3')](_0x873f('0x5'),_0x873f('0x6')),'defaultValue':_0x873f('0x5')}}; \ No newline at end of file +var _0x8eb2=['ENUM','basic','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x56a061,_0x53fb1b){var _0x105fa0=function(_0x164d08){while(--_0x164d08){_0x56a061['push'](_0x56a061['shift']());}};_0x105fa0(++_0x53fb1b);}(_0x8eb2,0xd6));var _0x28eb=function(_0x536907,_0x4ef187){_0x536907=_0x536907-0x0;var _0x6d0484=_0x8eb2[_0x536907];return _0x6d0484;};'use strict';var Sequelize=require(_0x28eb('0x0'));module[_0x28eb('0x1')]={'name':{'type':Sequelize[_0x28eb('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x28eb('0x3')](_0x28eb('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x28eb('0x2')]},'consumerKey':{'type':Sequelize[_0x28eb('0x2')]},'consumerSecret':{'type':Sequelize[_0x28eb('0x2')]},'token':{'type':Sequelize[_0x28eb('0x2')]},'tokenSecret':{'type':Sequelize[_0x28eb('0x2')]},'serverUrl':{'type':Sequelize[_0x28eb('0x2')]},'type':{'type':Sequelize[_0x28eb('0x3')](_0x28eb('0x5'),_0x28eb('0x6')),'defaultValue':_0x28eb('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index ee75f6e..be97227 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 _0x7096=['findOne','AccountId','Subjects','channel','type','getDescriptions','DeskField','getFields','priority','username','password','consumerKey','consumerSecret','token','GET','format','%s/custom_fields','remoteUri','application/json','basic','Authorization','Basic\x20%s','toString','base64','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','status','end','json','offset','Content-Range','reject','update','destroy','then','sendStatus','stack','name','index','DeskAccount','rawAttributes','model','keys','query','dateEnd','dateStart','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','add','day','where','filter','map','merge','options','count','findAll','rows','show','params','includeAll','include','find','create','body','getConfigurations'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7096,0x10c));var _0x6709=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x7096[_0x2b5eae];return _0x5f3ac9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6709('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6709('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6709('0x2'));var moment=require(_0x6709('0x3'));var BPromise=require(_0x6709('0x4'));var Mustache=require(_0x6709('0x5'));var util=require(_0x6709('0x6'));var path=require(_0x6709('0x7'));var sox=require(_0x6709('0x8'));var csv=require(_0x6709('0x9'));var ejs=require(_0x6709('0xa'));var fs=require('fs');var _=require(_0x6709('0xb'));var squel=require(_0x6709('0xc'));var crypto=require(_0x6709('0xd'));var jsforce=require(_0x6709('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6709('0xf'));var Papa=require(_0x6709('0x10'));var Redis=require(_0x6709('0x11'));var qs=require(_0x6709('0x12'));var logger=require(_0x6709('0x13'))(_0x6709('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x6709('0x15'))['db'];var integrations=require(_0x6709('0x16'));var jayson=require(_0x6709('0x17'));var client=jayson[_0x6709('0x18')][_0x6709('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x288f51,_0x1d56a5,_0x1ac547,_0x5a8ebb){return new BPromise(function(_0x78ce3,_0xf59b6e){var _0x4d5255=_0x5a8ebb||client;return _0x4d5255[_0x6709('0x1a')](_0x288f51,_0x1ac547)['then'](function(_0xc728aa){logger['info'](_0x6709('0x1b'),_0x1d56a5,'request\x20sent');logger[_0x6709('0x1c')](_0x6709('0x1d'),_0x1d56a5,_0x6709('0x1e'),JSON[_0x6709('0x1f')](_0xc728aa));if(_0xc728aa['error']){if(_0xc728aa['error']['code']===0x1f4){logger[_0x6709('0x20')](_0x6709('0x1b'),_0x1d56a5,_0xc728aa['error'][_0x6709('0x21')]);return _0xf59b6e(_0xc728aa[_0x6709('0x20')][_0x6709('0x21')]);}logger['error'](_0x6709('0x1b'),_0x1d56a5,_0xc728aa[_0x6709('0x20')][_0x6709('0x21')]);return _0x78ce3(_0xc728aa[_0x6709('0x20')]['message']);}else{logger[_0x6709('0x22')](_0x6709('0x1b'),_0x1d56a5,_0x6709('0x1e'));_0x78ce3(_0xc728aa[_0x6709('0x23')][_0x6709('0x21')]);}})[_0x6709('0x24')](function(_0x45921e){logger[_0x6709('0x20')](_0x6709('0x1b'),_0x1d56a5,_0x45921e);_0xf59b6e(_0x45921e);});});}function respondWithStatusCode(_0x1c5153,_0x2f3415){_0x2f3415=_0x2f3415||0xcc;return function(_0xa36371){if(_0xa36371){return _0x1c5153['sendStatus'](_0x2f3415);}return _0x1c5153[_0x6709('0x25')](_0x2f3415)[_0x6709('0x26')]();};}function respondWithResult(_0x2bcc73,_0x5c7982){_0x5c7982=_0x5c7982||0xc8;return function(_0x2e3483){if(_0x2e3483){return _0x2bcc73[_0x6709('0x25')](_0x5c7982)[_0x6709('0x27')](_0x2e3483);}};}function respondWithFilteredResult(_0x44b465,_0x588e00){return function(_0x241428){if(_0x241428){var _0x3076fe=_0x241428['count'],_0x50f7d6=_0x588e00[_0x6709('0x28')],_0x585073=_0x588e00[_0x6709('0x28')]+_0x588e00['limit'],_0x39f6a9;if(_0x585073>=_0x3076fe){_0x585073=_0x3076fe;_0x39f6a9=0xc8;}else{_0x39f6a9=0xce;}_0x44b465[_0x6709('0x25')](_0x39f6a9);return _0x44b465['set'](_0x6709('0x29'),_0x50f7d6+'-'+_0x585073+'/'+_0x3076fe)[_0x6709('0x27')](_0x241428);}return null;};}function patchUpdates(_0x5b6906){return function(_0x137137){try{jsonpatch['apply'](_0x137137,_0x5b6906,!![]);}catch(_0xe066d8){return BPromise[_0x6709('0x2a')](_0xe066d8);}return _0x137137['save']();};}function saveUpdates(_0x1a9eea,_0x5deff5){return function(_0x138318){if(_0x138318){return _0x138318[_0x6709('0x2b')](_0x1a9eea)['then'](function(_0x564dcb){return _0x564dcb;});}return null;};}function removeEntity(_0x37b3ce,_0x2a0cb0){return function(_0xb59fb1){if(_0xb59fb1){return _0xb59fb1[_0x6709('0x2c')]()[_0x6709('0x2d')](function(){_0x37b3ce[_0x6709('0x25')](0xcc)[_0x6709('0x26')]();});}};}function handleEntityNotFound(_0x402e45,_0x1c4bb4){return function(_0x5d399b){if(!_0x5d399b){_0x402e45[_0x6709('0x2e')](0x194);}return _0x5d399b;};}function handleError(_0x231d96,_0x3cfbe6){_0x3cfbe6=_0x3cfbe6||0x1f4;return function(_0x27e929){logger['error'](_0x27e929[_0x6709('0x2f')]);if(_0x27e929[_0x6709('0x30')]){delete _0x27e929[_0x6709('0x30')];}_0x231d96[_0x6709('0x25')](_0x3cfbe6)['send'](_0x27e929);};}exports[_0x6709('0x31')]=function(_0x51ae41,_0x530973){var _0x8952f1={},_0x22e199={},_0x5aa83b={'count':0x0,'rows':[]};var _0x6863f9=db[_0x6709('0x32')][_0x6709('0x33')];_0x22e199[_0x6709('0x34')]=_[_0x6709('0x35')](_0x6863f9);var _0x43309a={'dateStart':_0x51ae41[_0x6709('0x36')]['dateStart'],'dateEnd':_0x51ae41[_0x6709('0x36')][_0x6709('0x37')]};delete _0x51ae41['query'][_0x6709('0x38')];delete _0x51ae41[_0x6709('0x36')][_0x6709('0x37')];_0x22e199[_0x6709('0x36')]=_[_0x6709('0x35')](_0x51ae41[_0x6709('0x36')]);_0x22e199['filters']=_[_0x6709('0x39')](_0x22e199['model'],_0x22e199[_0x6709('0x36')]);_0x8952f1[_0x6709('0x3a')]=_[_0x6709('0x39')](_0x22e199['model'],qs[_0x6709('0x3b')](_0x51ae41[_0x6709('0x36')][_0x6709('0x3b')]));_0x8952f1[_0x6709('0x3a')]=_0x8952f1[_0x6709('0x3a')][_0x6709('0x3c')]?_0x8952f1[_0x6709('0x3a')]:_0x22e199['model'];if(!_0x51ae41[_0x6709('0x36')][_0x6709('0x3d')](_0x6709('0x3e'))){_0x8952f1[_0x6709('0x3f')]=qs[_0x6709('0x3f')](_0x51ae41[_0x6709('0x36')][_0x6709('0x3f')]);_0x8952f1['offset']=qs['offset'](_0x51ae41[_0x6709('0x36')][_0x6709('0x28')]);}_0x8952f1[_0x6709('0x40')]=qs[_0x6709('0x41')](_0x51ae41['query']['sort']);_0x8952f1['where']=qs[_0x6709('0x42')](_[_0x6709('0x43')](_0x51ae41['query'],_0x22e199[_0x6709('0x42')]));if(_0x43309a[_0x6709('0x38')]){if(_0x43309a['dateEnd']){_0x43309a['dateEnd']=moment(_0x43309a[_0x6709('0x37')])[_0x6709('0x44')](0x1,_0x6709('0x45'));}else{_0x43309a[_0x6709('0x37')]=moment(_0x43309a[_0x6709('0x38')])['add'](0x1,_0x6709('0x45'));}_['merge'](_0x8952f1[_0x6709('0x46')],{'createdAt':{'$gte':_0x43309a[_0x6709('0x38')],'$lte':_0x43309a[_0x6709('0x37')]}});}if(_0x51ae41['query'][_0x6709('0x47')]){_0x8952f1['where']=_['merge'](_0x8952f1[_0x6709('0x46')],{'$or':_[_0x6709('0x48')](_0x8952f1[_0x6709('0x3a')],function(_0x7e38b9){var _0x195c9={};_0x195c9[_0x7e38b9]={'$like':'%'+_0x51ae41[_0x6709('0x36')][_0x6709('0x47')]+'%'};return _0x195c9;})});}_0x8952f1=_[_0x6709('0x49')]({},_0x8952f1,_0x51ae41[_0x6709('0x4a')]);var _0xe999aa={'where':_0x8952f1[_0x6709('0x46')]};return db[_0x6709('0x32')][_0x6709('0x4b')](_0xe999aa)[_0x6709('0x2d')](function(_0xe14e1d){_0x5aa83b['count']=_0xe14e1d;if(_0x51ae41[_0x6709('0x36')]['includeAll']){_0x8952f1['include']=[{'all':!![]}];}return db[_0x6709('0x32')][_0x6709('0x4c')](_0x8952f1);})[_0x6709('0x2d')](function(_0xe8dd1){_0x5aa83b[_0x6709('0x4d')]=_0xe8dd1;return _0x5aa83b;})[_0x6709('0x2d')](respondWithFilteredResult(_0x530973,_0x8952f1))[_0x6709('0x24')](handleError(_0x530973,null));};exports[_0x6709('0x4e')]=function(_0x47e631,_0x981ae6){var _0x3beadc={'raw':![],'where':{'id':_0x47e631[_0x6709('0x4f')]['id']}},_0x26d5fe={};_0x26d5fe['model']=_[_0x6709('0x35')](db['DeskAccount'][_0x6709('0x33')]);_0x26d5fe[_0x6709('0x36')]=_[_0x6709('0x35')](_0x47e631[_0x6709('0x36')]);_0x26d5fe[_0x6709('0x42')]=_['intersection'](_0x26d5fe[_0x6709('0x34')],_0x26d5fe[_0x6709('0x36')]);_0x3beadc[_0x6709('0x3a')]=_[_0x6709('0x39')](_0x26d5fe[_0x6709('0x34')],qs['fields'](_0x47e631['query'][_0x6709('0x3b')]));_0x3beadc['attributes']=_0x3beadc['attributes'][_0x6709('0x3c')]?_0x3beadc[_0x6709('0x3a')]:_0x26d5fe[_0x6709('0x34')];if(_0x47e631[_0x6709('0x36')][_0x6709('0x50')]){_0x3beadc[_0x6709('0x51')]=[{'all':!![]}];}_0x3beadc=_[_0x6709('0x49')]({},_0x3beadc,_0x47e631[_0x6709('0x4a')]);return db[_0x6709('0x32')][_0x6709('0x52')](_0x3beadc)[_0x6709('0x2d')](handleEntityNotFound(_0x981ae6,null))['then'](respondWithResult(_0x981ae6,null))[_0x6709('0x24')](handleError(_0x981ae6,null));};exports[_0x6709('0x53')]=function(_0x5ea29f,_0x4bec85){return db[_0x6709('0x32')][_0x6709('0x53')](_0x5ea29f[_0x6709('0x54')],{})[_0x6709('0x2d')](respondWithResult(_0x4bec85,0xc9))['catch'](handleError(_0x4bec85,null));};exports[_0x6709('0x2b')]=function(_0x492bca,_0x1f838d){if(_0x492bca[_0x6709('0x54')]['id']){delete _0x492bca[_0x6709('0x54')]['id'];}return db[_0x6709('0x32')][_0x6709('0x52')]({'where':{'id':_0x492bca['params']['id']}})['then'](handleEntityNotFound(_0x1f838d,null))[_0x6709('0x2d')](saveUpdates(_0x492bca[_0x6709('0x54')],null))['then'](respondWithResult(_0x1f838d,null))[_0x6709('0x24')](handleError(_0x1f838d,null));};exports[_0x6709('0x2c')]=function(_0x4f18c6,_0xbb78ba){return db[_0x6709('0x32')][_0x6709('0x52')]({'where':{'id':_0x4f18c6[_0x6709('0x4f')]['id']}})['then'](handleEntityNotFound(_0xbb78ba,null))['then'](removeEntity(_0xbb78ba,null))[_0x6709('0x24')](handleError(_0xbb78ba,null));};exports['getConfigurations']=function(_0x1f57f5,_0x32da54,_0x3c3df7){var _0x595329={};var _0x1d884f={};var _0x5aa2d0;var _0x50c812;return db[_0x6709('0x32')]['findOne']({'where':{'id':_0x1f57f5[_0x6709('0x4f')]['id']}})['then'](handleEntityNotFound(_0x32da54,null))[_0x6709('0x2d')](function(_0x34f790){if(_0x34f790){_0x5aa2d0=_0x34f790;_0x1d884f[_0x6709('0x34')]=_[_0x6709('0x35')](db['DeskConfiguration'][_0x6709('0x33')]);_0x1d884f[_0x6709('0x36')]=_[_0x6709('0x35')](_0x1f57f5[_0x6709('0x36')]);_0x1d884f[_0x6709('0x42')]=_[_0x6709('0x39')](_0x1d884f[_0x6709('0x34')],_0x1d884f['query']);_0x595329[_0x6709('0x3a')]=_[_0x6709('0x39')](_0x1d884f[_0x6709('0x34')],qs[_0x6709('0x3b')](_0x1f57f5[_0x6709('0x36')][_0x6709('0x3b')]));_0x595329[_0x6709('0x3a')]=_0x595329[_0x6709('0x3a')][_0x6709('0x3c')]?_0x595329['attributes']:_0x1d884f[_0x6709('0x34')];_0x595329[_0x6709('0x40')]=qs['sort'](_0x1f57f5[_0x6709('0x36')][_0x6709('0x41')]);_0x595329[_0x6709('0x46')]=qs[_0x6709('0x42')](_[_0x6709('0x43')](_0x1f57f5[_0x6709('0x36')],_0x1d884f[_0x6709('0x42')]));if(_0x1f57f5[_0x6709('0x36')][_0x6709('0x47')]){_0x595329['where']=_[_0x6709('0x49')](_0x595329[_0x6709('0x46')],{'$or':_[_0x6709('0x48')](_0x595329[_0x6709('0x3a')],function(_0x561c2){var _0x694dbe={};_0x694dbe[_0x561c2]={'$like':'%'+_0x1f57f5[_0x6709('0x36')][_0x6709('0x47')]+'%'};return _0x694dbe;})});}_0x595329=_[_0x6709('0x49')]({},_0x595329,_0x1f57f5[_0x6709('0x4a')]);return _0x5aa2d0[_0x6709('0x55')](_0x595329);}})['then'](function(_0x319b7e){if(_0x319b7e){_0x50c812=_0x319b7e['length'];if(!_0x1f57f5['query'][_0x6709('0x3d')](_0x6709('0x3e'))){_0x595329[_0x6709('0x3f')]=qs[_0x6709('0x3f')](_0x1f57f5[_0x6709('0x36')][_0x6709('0x3f')]);_0x595329[_0x6709('0x28')]=qs['offset'](_0x1f57f5['query'][_0x6709('0x28')]);}return _0x5aa2d0['getConfigurations'](_0x595329);}})[_0x6709('0x2d')](function(_0x47b7d9){if(_0x47b7d9){return _0x47b7d9?{'count':_0x50c812,'rows':_0x47b7d9}:null;}})[_0x6709('0x2d')](respondWithResult(_0x32da54,null))[_0x6709('0x24')](handleError(_0x32da54,null));};exports['addConfiguration']=function(_0x5c4277,_0x58c2ab,_0x278148){if(_0x5c4277[_0x6709('0x54')]['id']){delete _0x5c4277[_0x6709('0x54')]['id'];}return db[_0x6709('0x32')][_0x6709('0x56')]({'where':{'id':_0x5c4277[_0x6709('0x4f')]['id']}})[_0x6709('0x2d')](handleEntityNotFound(_0x58c2ab,null))[_0x6709('0x2d')](function(_0x38520c){if(_0x38520c){_0x5c4277[_0x6709('0x54')][_0x6709('0x57')]=_0x38520c['id'];_0x5c4277[_0x6709('0x54')][_0x6709('0x58')]=integrations['getSubjects'](_0x5c4277[_0x6709('0x54')][_0x6709('0x59')],_0x5c4277[_0x6709('0x54')][_0x6709('0x5a')]);_0x5c4277['body']['Descriptions']=integrations[_0x6709('0x5b')](_0x5c4277['body']['channel'],_0x5c4277[_0x6709('0x54')][_0x6709('0x5a')]);return db['DeskConfiguration'][_0x6709('0x53')](_0x5c4277[_0x6709('0x54')],{'include':[{'model':db[_0x6709('0x5c')],'as':_0x6709('0x58')},{'model':db[_0x6709('0x5c')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x58c2ab,null))[_0x6709('0x24')](handleError(_0x58c2ab,null));};exports[_0x6709('0x5d')]=function(_0x5906aa,_0x3cca8a,_0x1aaf1d){var _0x1c90d7=[{'name':'priority','label':_0x6709('0x5e'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];return db[_0x6709('0x32')][_0x6709('0x56')]({'where':{'id':_0x5906aa[_0x6709('0x4f')]['id']},'attributes':['id','remoteUri','authType',_0x6709('0x5f'),_0x6709('0x60'),_0x6709('0x61'),_0x6709('0x62'),_0x6709('0x63'),'tokenSecret']})[_0x6709('0x2d')](handleEntityNotFound(_0x3cca8a,null))[_0x6709('0x2d')](function(_0x48133a){if(_0x48133a){var _0xea6d7={'method':_0x6709('0x64'),'uri':util[_0x6709('0x65')](_0x6709('0x66'),_0x48133a[_0x6709('0x67')]),'headers':{'Content-Type':'application/json','Accept':_0x6709('0x68')},'json':!![]};if(_0x48133a['authType']===_0x6709('0x69')){_0xea6d7['headers'][_0x6709('0x6a')]=util[_0x6709('0x65')](_0x6709('0x6b'),new Buffer(util[_0x6709('0x65')]('%s:%s',_0x48133a[_0x6709('0x5f')],_0x48133a[_0x6709('0x60')]))[_0x6709('0x6c')](_0x6709('0x6d')));}return rp(_0xea6d7)[_0x6709('0x2d')](function(_0x2c1aa6){return _0x1c90d7['concat'](_[_0x6709('0x48')](_0x2c1aa6[_0x6709('0x6e')][_0x6709('0x6f')],function(_0x55675d){return{'id':_0x55675d[_0x6709('0x30')],'name':_0x55675d[_0x6709('0x30')],'type':_0x55675d['type'],'active':_0x55675d[_0x6709('0x70')],'label':_0x55675d[_0x6709('0x71')],'custom':!![]};}));});}})[_0x6709('0x2d')](function(_0x4c53e8){return{'count':_0x4c53e8[_0x6709('0x3c')],'rows':_0x4c53e8};})[_0x6709('0x2d')](respondWithResult(_0x3cca8a,null))[_0x6709('0x24')](function(_0x5c8564){var _0x2804aa=_0x5906aa[_0x6709('0x36')][_0x6709('0x72')]?0x1f4:_0x5c8564[_0x6709('0x73')]||0x1f4;logger[_0x6709('0x20')](_0x6709('0x74'),'getFields',_0x2804aa,JSON[_0x6709('0x1f')](_0x5c8564));delete _0x5c8564[_0x6709('0x30')];if(_0x2804aa===0x191){_0x2804aa=0x190;}_0x3cca8a['status'](_0x2804aa)[_0x6709('0x75')](_0x5906aa[_0x6709('0x36')][_0x6709('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x5c8564[_0x6709('0x73')]}:_0x5c8564);});}; \ No newline at end of file +var _0xf61e=['getDescriptions','DeskField','getFields','priority','remoteUri','username','consumerSecret','tokenSecret','format','application/json','authType','headers','Basic\x20%s','%s:%s','password','toString','base64','concat','_embedded','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','destroy','sendStatus','stack','name','send','index','DeskAccount','model','keys','dateEnd','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','dateStart','day','add','merge','map','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','update','body','getConfigurations','DeskConfiguration','order','findOne','Subjects','getSubjects','channel','Descriptions'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0xf61e,0x191));var _0xef61=function(_0x5dddef,_0x15959a){_0x5dddef=_0x5dddef-0x0;var _0x5a1f5e=_0xf61e[_0x5dddef];return _0x5a1f5e;};'use strict';var pdf=require(_0xef61('0x0'));var emlformat=require(_0xef61('0x1'));var rimraf=require(_0xef61('0x2'));var zipdir=require(_0xef61('0x3'));var jsonpatch=require(_0xef61('0x4'));var rp=require(_0xef61('0x5'));var moment=require(_0xef61('0x6'));var BPromise=require(_0xef61('0x7'));var Mustache=require(_0xef61('0x8'));var util=require(_0xef61('0x9'));var path=require(_0xef61('0xa'));var sox=require(_0xef61('0xb'));var csv=require('to-csv');var ejs=require(_0xef61('0xc'));var fs=require('fs');var _=require(_0xef61('0xd'));var squel=require('squel');var crypto=require(_0xef61('0xe'));var jsforce=require(_0xef61('0xf'));var deskjs=require(_0xef61('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef61('0x11'));var Redis=require(_0xef61('0x12'));var qs=require(_0xef61('0x13'));var logger=require(_0xef61('0x14'))(_0xef61('0x15'));var utils=require(_0xef61('0x16'));var config=require(_0xef61('0x17'));var db=require(_0xef61('0x18'))['db'];var integrations=require(_0xef61('0x19'));var jayson=require(_0xef61('0x1a'));var client=jayson[_0xef61('0x1b')][_0xef61('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x114e1f,_0x318f1c,_0x5de159,_0x2a6b04){return new BPromise(function(_0x58d9a0,_0x106472){var _0x1db2a9=_0x2a6b04||client;return _0x1db2a9[_0xef61('0x1d')](_0x114e1f,_0x5de159)[_0xef61('0x1e')](function(_0x4c64b5){logger[_0xef61('0x1f')](_0xef61('0x20'),_0x318f1c,_0xef61('0x21'));logger[_0xef61('0x22')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x318f1c,_0xef61('0x21'),JSON[_0xef61('0x23')](_0x4c64b5));if(_0x4c64b5['error']){if(_0x4c64b5[_0xef61('0x24')][_0xef61('0x25')]===0x1f4){logger[_0xef61('0x24')](_0xef61('0x20'),_0x318f1c,_0x4c64b5[_0xef61('0x24')][_0xef61('0x26')]);return _0x106472(_0x4c64b5[_0xef61('0x24')]['message']);}logger[_0xef61('0x24')](_0xef61('0x20'),_0x318f1c,_0x4c64b5['error'][_0xef61('0x26')]);return _0x58d9a0(_0x4c64b5[_0xef61('0x24')][_0xef61('0x26')]);}else{logger[_0xef61('0x1f')](_0xef61('0x20'),_0x318f1c,_0xef61('0x21'));_0x58d9a0(_0x4c64b5[_0xef61('0x27')]['message']);}})['catch'](function(_0x3d31c1){logger['error'](_0xef61('0x20'),_0x318f1c,_0x3d31c1);_0x106472(_0x3d31c1);});});}function respondWithStatusCode(_0x5ae7a2,_0x488b47){_0x488b47=_0x488b47||0xcc;return function(_0x2f0569){if(_0x2f0569){return _0x5ae7a2['sendStatus'](_0x488b47);}return _0x5ae7a2['status'](_0x488b47)[_0xef61('0x28')]();};}function respondWithResult(_0x3782c6,_0x3ceb14){_0x3ceb14=_0x3ceb14||0xc8;return function(_0x111bac){if(_0x111bac){return _0x3782c6['status'](_0x3ceb14)[_0xef61('0x29')](_0x111bac);}};}function respondWithFilteredResult(_0x4e738f,_0x2a6832){return function(_0xb00f83){if(_0xb00f83){var _0x2419a9=_0xb00f83[_0xef61('0x2a')],_0xf4c7c9=_0x2a6832[_0xef61('0x2b')],_0x2155f1=_0x2a6832[_0xef61('0x2b')]+_0x2a6832[_0xef61('0x2c')],_0x45ece2;if(_0x2155f1>=_0x2419a9){_0x2155f1=_0x2419a9;_0x45ece2=0xc8;}else{_0x45ece2=0xce;}_0x4e738f[_0xef61('0x2d')](_0x45ece2);return _0x4e738f[_0xef61('0x2e')](_0xef61('0x2f'),_0xf4c7c9+'-'+_0x2155f1+'/'+_0x2419a9)[_0xef61('0x29')](_0xb00f83);}return null;};}function patchUpdates(_0x1f3572){return function(_0x85978){try{jsonpatch[_0xef61('0x30')](_0x85978,_0x1f3572,!![]);}catch(_0x393ea9){return BPromise[_0xef61('0x31')](_0x393ea9);}return _0x85978[_0xef61('0x32')]();};}function saveUpdates(_0x43bc47,_0x53fa3b){return function(_0x4f35ad){if(_0x4f35ad){return _0x4f35ad['update'](_0x43bc47)[_0xef61('0x1e')](function(_0x36713e){return _0x36713e;});}return null;};}function removeEntity(_0x122176,_0x554ef4){return function(_0x2bd5b3){if(_0x2bd5b3){return _0x2bd5b3[_0xef61('0x33')]()['then'](function(){_0x122176[_0xef61('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c7fd3,_0x307b70){return function(_0x48b6db){if(!_0x48b6db){_0x4c7fd3[_0xef61('0x34')](0x194);}return _0x48b6db;};}function handleError(_0x5ee9e4,_0x41d9e9){_0x41d9e9=_0x41d9e9||0x1f4;return function(_0x4155a0){logger[_0xef61('0x24')](_0x4155a0[_0xef61('0x35')]);if(_0x4155a0[_0xef61('0x36')]){delete _0x4155a0[_0xef61('0x36')];}_0x5ee9e4[_0xef61('0x2d')](_0x41d9e9)[_0xef61('0x37')](_0x4155a0);};}exports[_0xef61('0x38')]=function(_0xb9d080,_0x5f15ef){var _0x569db6={},_0x4ce644={},_0x3dd5a2={'count':0x0,'rows':[]};var _0x1c1760=db[_0xef61('0x39')]['rawAttributes'];_0x4ce644[_0xef61('0x3a')]=_[_0xef61('0x3b')](_0x1c1760);var _0x291944={'dateStart':_0xb9d080['query']['dateStart'],'dateEnd':_0xb9d080['query'][_0xef61('0x3c')]};delete _0xb9d080['query']['dateStart'];delete _0xb9d080['query'][_0xef61('0x3c')];_0x4ce644[_0xef61('0x3d')]=_[_0xef61('0x3b')](_0xb9d080['query']);_0x4ce644['filters']=_['intersection'](_0x4ce644[_0xef61('0x3a')],_0x4ce644[_0xef61('0x3d')]);_0x569db6['attributes']=_[_0xef61('0x3e')](_0x4ce644[_0xef61('0x3a')],qs[_0xef61('0x3f')](_0xb9d080[_0xef61('0x3d')]['fields']));_0x569db6[_0xef61('0x40')]=_0x569db6[_0xef61('0x40')][_0xef61('0x41')]?_0x569db6[_0xef61('0x40')]:_0x4ce644['model'];if(!_0xb9d080['query'][_0xef61('0x42')](_0xef61('0x43'))){_0x569db6[_0xef61('0x2c')]=qs['limit'](_0xb9d080[_0xef61('0x3d')][_0xef61('0x2c')]);_0x569db6[_0xef61('0x2b')]=qs[_0xef61('0x2b')](_0xb9d080['query']['offset']);}_0x569db6['order']=qs[_0xef61('0x44')](_0xb9d080[_0xef61('0x3d')][_0xef61('0x44')]);_0x569db6[_0xef61('0x45')]=qs[_0xef61('0x46')](_[_0xef61('0x47')](_0xb9d080[_0xef61('0x3d')],_0x4ce644['filters']));if(_0x291944[_0xef61('0x48')]){if(_0x291944[_0xef61('0x3c')]){_0x291944[_0xef61('0x3c')]=moment(_0x291944[_0xef61('0x3c')])['add'](0x1,_0xef61('0x49'));}else{_0x291944[_0xef61('0x3c')]=moment(_0x291944[_0xef61('0x48')])[_0xef61('0x4a')](0x1,_0xef61('0x49'));}_[_0xef61('0x4b')](_0x569db6['where'],{'createdAt':{'$gte':_0x291944[_0xef61('0x48')],'$lte':_0x291944[_0xef61('0x3c')]}});}if(_0xb9d080[_0xef61('0x3d')]['filter']){_0x569db6[_0xef61('0x45')]=_[_0xef61('0x4b')](_0x569db6[_0xef61('0x45')],{'$or':_[_0xef61('0x4c')](_0x569db6[_0xef61('0x40')],function(_0x354ab1){var _0x4efe56={};_0x4efe56[_0x354ab1]={'$like':'%'+_0xb9d080[_0xef61('0x3d')][_0xef61('0x4d')]+'%'};return _0x4efe56;})});}_0x569db6=_['merge']({},_0x569db6,_0xb9d080[_0xef61('0x4e')]);var _0x37da22={'where':_0x569db6[_0xef61('0x45')]};return db[_0xef61('0x39')]['count'](_0x37da22)[_0xef61('0x1e')](function(_0x20e4f2){_0x3dd5a2[_0xef61('0x2a')]=_0x20e4f2;if(_0xb9d080['query'][_0xef61('0x4f')]){_0x569db6[_0xef61('0x50')]=[{'all':!![]}];}return db['DeskAccount'][_0xef61('0x51')](_0x569db6);})[_0xef61('0x1e')](function(_0x13d0f8){_0x3dd5a2[_0xef61('0x52')]=_0x13d0f8;return _0x3dd5a2;})[_0xef61('0x1e')](respondWithFilteredResult(_0x5f15ef,_0x569db6))[_0xef61('0x53')](handleError(_0x5f15ef,null));};exports[_0xef61('0x54')]=function(_0x57849d,_0x1ee108){var _0x505631={'raw':![],'where':{'id':_0x57849d[_0xef61('0x55')]['id']}},_0x89c04e={};_0x89c04e[_0xef61('0x3a')]=_[_0xef61('0x3b')](db[_0xef61('0x39')][_0xef61('0x56')]);_0x89c04e[_0xef61('0x3d')]=_[_0xef61('0x3b')](_0x57849d[_0xef61('0x3d')]);_0x89c04e['filters']=_[_0xef61('0x3e')](_0x89c04e[_0xef61('0x3a')],_0x89c04e['query']);_0x505631['attributes']=_[_0xef61('0x3e')](_0x89c04e[_0xef61('0x3a')],qs['fields'](_0x57849d[_0xef61('0x3d')]['fields']));_0x505631[_0xef61('0x40')]=_0x505631[_0xef61('0x40')][_0xef61('0x41')]?_0x505631[_0xef61('0x40')]:_0x89c04e[_0xef61('0x3a')];if(_0x57849d[_0xef61('0x3d')]['includeAll']){_0x505631[_0xef61('0x50')]=[{'all':!![]}];}_0x505631=_[_0xef61('0x4b')]({},_0x505631,_0x57849d['options']);return db[_0xef61('0x39')][_0xef61('0x57')](_0x505631)['then'](handleEntityNotFound(_0x1ee108,null))['then'](respondWithResult(_0x1ee108,null))[_0xef61('0x53')](handleError(_0x1ee108,null));};exports['create']=function(_0x5dcbbe,_0x51aacb){return db[_0xef61('0x39')][_0xef61('0x58')](_0x5dcbbe['body'],{})[_0xef61('0x1e')](respondWithResult(_0x51aacb,0xc9))[_0xef61('0x53')](handleError(_0x51aacb,null));};exports[_0xef61('0x59')]=function(_0x1e7f23,_0x71004){if(_0x1e7f23[_0xef61('0x5a')]['id']){delete _0x1e7f23[_0xef61('0x5a')]['id'];}return db[_0xef61('0x39')]['find']({'where':{'id':_0x1e7f23['params']['id']}})[_0xef61('0x1e')](handleEntityNotFound(_0x71004,null))[_0xef61('0x1e')](saveUpdates(_0x1e7f23[_0xef61('0x5a')],null))[_0xef61('0x1e')](respondWithResult(_0x71004,null))[_0xef61('0x53')](handleError(_0x71004,null));};exports['destroy']=function(_0x258d9d,_0x572d5f){return db['DeskAccount'][_0xef61('0x57')]({'where':{'id':_0x258d9d[_0xef61('0x55')]['id']}})[_0xef61('0x1e')](handleEntityNotFound(_0x572d5f,null))['then'](removeEntity(_0x572d5f,null))[_0xef61('0x53')](handleError(_0x572d5f,null));};exports[_0xef61('0x5b')]=function(_0x3f8f66,_0x824157,_0x156888){var _0x2946c6={};var _0x2984a7={};var _0x2aca89;var _0x3f2954;return db[_0xef61('0x39')]['findOne']({'where':{'id':_0x3f8f66[_0xef61('0x55')]['id']}})['then'](handleEntityNotFound(_0x824157,null))['then'](function(_0x4386a7){if(_0x4386a7){_0x2aca89=_0x4386a7;_0x2984a7[_0xef61('0x3a')]=_[_0xef61('0x3b')](db[_0xef61('0x5c')][_0xef61('0x56')]);_0x2984a7[_0xef61('0x3d')]=_['keys'](_0x3f8f66['query']);_0x2984a7[_0xef61('0x46')]=_[_0xef61('0x3e')](_0x2984a7[_0xef61('0x3a')],_0x2984a7[_0xef61('0x3d')]);_0x2946c6[_0xef61('0x40')]=_[_0xef61('0x3e')](_0x2984a7[_0xef61('0x3a')],qs[_0xef61('0x3f')](_0x3f8f66[_0xef61('0x3d')][_0xef61('0x3f')]));_0x2946c6[_0xef61('0x40')]=_0x2946c6['attributes'][_0xef61('0x41')]?_0x2946c6[_0xef61('0x40')]:_0x2984a7['model'];_0x2946c6[_0xef61('0x5d')]=qs[_0xef61('0x44')](_0x3f8f66[_0xef61('0x3d')][_0xef61('0x44')]);_0x2946c6[_0xef61('0x45')]=qs[_0xef61('0x46')](_[_0xef61('0x47')](_0x3f8f66[_0xef61('0x3d')],_0x2984a7['filters']));if(_0x3f8f66[_0xef61('0x3d')]['filter']){_0x2946c6['where']=_['merge'](_0x2946c6[_0xef61('0x45')],{'$or':_[_0xef61('0x4c')](_0x2946c6[_0xef61('0x40')],function(_0x4abf38){var _0x1fb591={};_0x1fb591[_0x4abf38]={'$like':'%'+_0x3f8f66[_0xef61('0x3d')][_0xef61('0x4d')]+'%'};return _0x1fb591;})});}_0x2946c6=_[_0xef61('0x4b')]({},_0x2946c6,_0x3f8f66[_0xef61('0x4e')]);return _0x2aca89[_0xef61('0x5b')](_0x2946c6);}})[_0xef61('0x1e')](function(_0x1181d7){if(_0x1181d7){_0x3f2954=_0x1181d7[_0xef61('0x41')];if(!_0x3f8f66[_0xef61('0x3d')][_0xef61('0x42')](_0xef61('0x43'))){_0x2946c6[_0xef61('0x2c')]=qs[_0xef61('0x2c')](_0x3f8f66[_0xef61('0x3d')][_0xef61('0x2c')]);_0x2946c6[_0xef61('0x2b')]=qs[_0xef61('0x2b')](_0x3f8f66['query'][_0xef61('0x2b')]);}return _0x2aca89[_0xef61('0x5b')](_0x2946c6);}})[_0xef61('0x1e')](function(_0x5ab4fe){if(_0x5ab4fe){return _0x5ab4fe?{'count':_0x3f2954,'rows':_0x5ab4fe}:null;}})[_0xef61('0x1e')](respondWithResult(_0x824157,null))[_0xef61('0x53')](handleError(_0x824157,null));};exports['addConfiguration']=function(_0xd7537e,_0x38d683,_0x582492){if(_0xd7537e[_0xef61('0x5a')]['id']){delete _0xd7537e['body']['id'];}return db[_0xef61('0x39')][_0xef61('0x5e')]({'where':{'id':_0xd7537e['params']['id']}})[_0xef61('0x1e')](handleEntityNotFound(_0x38d683,null))['then'](function(_0x3cba7f){if(_0x3cba7f){_0xd7537e[_0xef61('0x5a')]['AccountId']=_0x3cba7f['id'];_0xd7537e['body'][_0xef61('0x5f')]=integrations[_0xef61('0x60')](_0xd7537e[_0xef61('0x5a')][_0xef61('0x61')],_0xd7537e[_0xef61('0x5a')]['type']);_0xd7537e[_0xef61('0x5a')][_0xef61('0x62')]=integrations[_0xef61('0x63')](_0xd7537e[_0xef61('0x5a')][_0xef61('0x61')],_0xd7537e[_0xef61('0x5a')]['type']);return db[_0xef61('0x5c')]['create'](_0xd7537e[_0xef61('0x5a')],{'include':[{'model':db[_0xef61('0x64')],'as':_0xef61('0x5f')},{'model':db[_0xef61('0x64')],'as':_0xef61('0x62')}]});}return null;})[_0xef61('0x1e')](respondWithResult(_0x38d683,null))[_0xef61('0x53')](handleError(_0x38d683,null));};exports[_0xef61('0x65')]=function(_0x46576e,_0x471d16,_0x383409){var _0x253b51=[{'name':_0xef61('0x66'),'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}]}];return db[_0xef61('0x39')][_0xef61('0x5e')]({'where':{'id':_0x46576e[_0xef61('0x55')]['id']},'attributes':['id',_0xef61('0x67'),'authType',_0xef61('0x68'),'password','consumerKey',_0xef61('0x69'),'token',_0xef61('0x6a')]})['then'](handleEntityNotFound(_0x471d16,null))['then'](function(_0xab59f1){if(_0xab59f1){var _0x303829={'method':'GET','uri':util[_0xef61('0x6b')]('%s/custom_fields',_0xab59f1[_0xef61('0x67')]),'headers':{'Content-Type':_0xef61('0x6c'),'Accept':_0xef61('0x6c')},'json':!![]};if(_0xab59f1[_0xef61('0x6d')]==='basic'){_0x303829[_0xef61('0x6e')]['Authorization']=util[_0xef61('0x6b')](_0xef61('0x6f'),new Buffer(util[_0xef61('0x6b')](_0xef61('0x70'),_0xab59f1[_0xef61('0x68')],_0xab59f1[_0xef61('0x71')]))[_0xef61('0x72')](_0xef61('0x73')));}return rp(_0x303829)[_0xef61('0x1e')](function(_0x540b68){return _0x253b51[_0xef61('0x74')](_['map'](_0x540b68[_0xef61('0x75')][_0xef61('0x76')],function(_0x5db4a0){return{'id':_0x5db4a0[_0xef61('0x36')],'name':_0x5db4a0['name'],'type':_0x5db4a0['type'],'active':_0x5db4a0[_0xef61('0x77')],'label':_0x5db4a0[_0xef61('0x78')],'custom':!![]};}));});}})['then'](function(_0x1caf33){return{'count':_0x1caf33[_0xef61('0x41')],'rows':_0x1caf33};})['then'](respondWithResult(_0x471d16,null))[_0xef61('0x53')](function(_0x2cb8a8){var _0x4f9b70=_0x46576e[_0xef61('0x3d')]['test']?0x1f4:_0x2cb8a8[_0xef61('0x79')]||0x1f4;logger[_0xef61('0x24')](_0xef61('0x7a'),_0xef61('0x65'),_0x4f9b70,JSON['stringify'](_0x2cb8a8));delete _0x2cb8a8[_0xef61('0x36')];if(_0x4f9b70===0x191){_0x4f9b70=0x190;}_0x471d16[_0xef61('0x2d')](_0x4f9b70)[_0xef61('0x37')](_0x46576e['query'][_0xef61('0x7b')]?{'message':_0xef61('0x7c'),'statusCode':_0x2cb8a8['statusCode']}:_0x2cb8a8);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 236fee5..a555481 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 _0xc373=['../../config/logger','api','request-promise','./intDeskAccount.attributes','../../components/integrations/configuration','exports','int_desk_accounts','util'];(function(_0x1fa077,_0x1a9ec4){var _0x29c344=function(_0x501480){while(--_0x501480){_0x1fa077['push'](_0x1fa077['shift']());}};_0x29c344(++_0x1a9ec4);}(_0xc373,0x1c7));var _0x3c37=function(_0x813d0a,_0x4fd3d7){_0x813d0a=_0x813d0a-0x0;var _0x241352=_0xc373[_0x813d0a];return _0x241352;};'use strict';var _=require('lodash');var util=require(_0x3c37('0x0'));var logger=require(_0x3c37('0x1'))(_0x3c37('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3c37('0x3'));var attributes=require(_0x3c37('0x4'));var integrations=require(_0x3c37('0x5'));module[_0x3c37('0x6')]=function(_0x1417ac,_0x2e8816){return _0x1417ac['define']('DeskAccount',attributes,{'tableName':_0x3c37('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x794b=['lodash','util','api','moment','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts'];(function(_0xbc6705,_0x4ad91f){var _0x99954=function(_0x1df44a){while(--_0x1df44a){_0xbc6705['push'](_0xbc6705['shift']());}};_0x99954(++_0x4ad91f);}(_0x794b,0x1c2));var _0xb794=function(_0xc315f8,_0x22089e){_0xc315f8=_0xc315f8-0x0;var _0x52da0f=_0x794b[_0xc315f8];return _0x52da0f;};'use strict';var _=require(_0xb794('0x0'));var util=require(_0xb794('0x1'));var logger=require('../../config/logger')(_0xb794('0x2'));var moment=require(_0xb794('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xb794('0x4'));var integrations=require(_0xb794('0x5'));module['exports']=function(_0x5dc6dc,_0x323f52){return _0x5dc6dc[_0xb794('0x6')](_0xb794('0x7'),attributes,{'tableName':_0xb794('0x8'),'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 da86485..27a11fd 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 _0xe1c4=['result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','debug','stringify','ShowDeskAccount','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x48c93b,_0x2082b7){var _0x879386=function(_0x5d934f){while(--_0x5d934f){_0x48c93b['push'](_0x48c93b['shift']());}};_0x879386(++_0x2082b7);}(_0xe1c4,0x1ec));var _0x4e1c=function(_0x50451e,_0x124670){_0x50451e=_0x50451e-0x0;var _0x30524d=_0xe1c4[_0x50451e];return _0x30524d;};'use strict';var _=require(_0x4e1c('0x0'));var util=require(_0x4e1c('0x1'));var moment=require(_0x4e1c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4e1c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4e1c('0x4'));var logger=require(_0x4e1c('0x5'))(_0x4e1c('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4e1c('0x7')][_0x4e1c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44db21,_0x1c7e52,_0x460295){return new BPromise(function(_0x108830,_0x2622b4){return client[_0x4e1c('0x9')](_0x44db21,_0x460295)[_0x4e1c('0xa')](function(_0x60e98c){logger[_0x4e1c('0xb')](_0x4e1c('0xc'),_0x1c7e52,_0x4e1c('0xd'));logger['debug'](_0x4e1c('0xe'),_0x1c7e52,_0x4e1c('0xd'),JSON['stringify'](_0x60e98c));if(_0x60e98c[_0x4e1c('0xf')]){if(_0x60e98c[_0x4e1c('0xf')][_0x4e1c('0x10')]===0x1f4){logger[_0x4e1c('0xf')]('DeskAccount,\x20%s,\x20%s',_0x1c7e52,_0x60e98c[_0x4e1c('0xf')][_0x4e1c('0x11')]);return _0x2622b4(_0x60e98c[_0x4e1c('0xf')][_0x4e1c('0x11')]);}logger['error']('DeskAccount,\x20%s,\x20%s',_0x1c7e52,_0x60e98c['error'][_0x4e1c('0x11')]);return _0x108830(_0x60e98c[_0x4e1c('0xf')][_0x4e1c('0x11')]);}else{logger[_0x4e1c('0xb')]('DeskAccount,\x20%s,\x20%s',_0x1c7e52,_0x4e1c('0xd'));_0x108830(_0x60e98c[_0x4e1c('0x12')][_0x4e1c('0x11')]);}})[_0x4e1c('0x13')](function(_0x44a842){logger[_0x4e1c('0xf')]('DeskAccount,\x20%s,\x20%s',_0x1c7e52,_0x44a842);_0x2622b4(_0x44a842);});});}exports[_0x4e1c('0x14')]=function(_0x399bcc){var _0x2af3db=this;return new Promise(function(_0x46a887,_0x116a01){return db[_0x4e1c('0x15')][_0x4e1c('0x16')]({'raw':_0x399bcc['options']?_0x399bcc[_0x4e1c('0x17')][_0x4e1c('0x18')]===undefined?!![]:![]:!![],'where':_0x399bcc[_0x4e1c('0x17')]?_0x399bcc[_0x4e1c('0x17')][_0x4e1c('0x19')]||null:null,'attributes':_0x399bcc[_0x4e1c('0x17')]?_0x399bcc[_0x4e1c('0x17')]['attributes']||null:null,'limit':_0x399bcc[_0x4e1c('0x17')]?_0x399bcc[_0x4e1c('0x17')][_0x4e1c('0x1a')]||null:null,'include':_0x399bcc[_0x4e1c('0x17')]?_0x399bcc[_0x4e1c('0x17')][_0x4e1c('0x1b')]?_[_0x4e1c('0x1c')](_0x399bcc[_0x4e1c('0x17')][_0x4e1c('0x1b')],function(_0x5ada14){return{'model':db[_0x5ada14[_0x4e1c('0x1d')]],'as':_0x5ada14['as'],'attributes':_0x5ada14[_0x4e1c('0x1e')],'include':_0x5ada14[_0x4e1c('0x1b')]?_['map'](_0x5ada14['include'],function(_0x17f5a5){return{'model':db[_0x17f5a5['model']],'as':_0x17f5a5['as'],'attributes':_0x17f5a5[_0x4e1c('0x1e')],'include':_0x17f5a5[_0x4e1c('0x1b')]?_[_0x4e1c('0x1c')](_0x17f5a5[_0x4e1c('0x1b')],function(_0x12364d){return{'model':db[_0x12364d[_0x4e1c('0x1d')]],'as':_0x12364d['as'],'attributes':_0x12364d['attributes']};}):[]};}):[]};}):[]:[]})[_0x4e1c('0xa')](function(_0x2526a6){logger[_0x4e1c('0xb')](_0x4e1c('0x14'),_0x399bcc);logger[_0x4e1c('0x1f')]('GetDeskAccount',_0x399bcc,JSON[_0x4e1c('0x20')](_0x2526a6));_0x46a887(_0x2526a6);})[_0x4e1c('0x13')](function(_0x1b5ba8){logger[_0x4e1c('0xf')]('GetDeskAccount',_0x1b5ba8[_0x4e1c('0x11')],_0x399bcc);_0x116a01(_0x2af3db[_0x4e1c('0xf')](0x1f4,_0x1b5ba8['message']));});});};exports[_0x4e1c('0x21')]=function(_0x5ae521){var _0x88df92=this;return new Promise(function(_0x3c007f,_0x39f8fc){return db[_0x4e1c('0x15')]['find']({'raw':_0x5ae521[_0x4e1c('0x17')]?_0x5ae521['options'][_0x4e1c('0x18')]===undefined?!![]:![]:!![],'where':_0x5ae521['options']?_0x5ae521[_0x4e1c('0x17')][_0x4e1c('0x19')]||null:null,'attributes':_0x5ae521['options']?_0x5ae521[_0x4e1c('0x17')]['attributes']||null:null,'include':_0x5ae521[_0x4e1c('0x17')]?_0x5ae521[_0x4e1c('0x17')][_0x4e1c('0x1b')]?_[_0x4e1c('0x1c')](_0x5ae521[_0x4e1c('0x17')][_0x4e1c('0x1b')],function(_0x44477f){return{'model':db[_0x44477f[_0x4e1c('0x1d')]],'as':_0x44477f['as'],'attributes':_0x44477f[_0x4e1c('0x1e')],'include':_0x44477f[_0x4e1c('0x1b')]?_['map'](_0x44477f[_0x4e1c('0x1b')],function(_0x35763f){return{'model':db[_0x35763f[_0x4e1c('0x1d')]],'as':_0x35763f['as'],'attributes':_0x35763f[_0x4e1c('0x1e')],'include':_0x35763f[_0x4e1c('0x1b')]?_[_0x4e1c('0x1c')](_0x35763f['include'],function(_0x545d6b){return{'model':db[_0x545d6b[_0x4e1c('0x1d')]],'as':_0x545d6b['as'],'attributes':_0x545d6b[_0x4e1c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4e1c('0xa')](function(_0x4365eb){logger['info'](_0x4e1c('0x21'),_0x5ae521);logger[_0x4e1c('0x1f')]('ShowDeskAccount',_0x5ae521,JSON[_0x4e1c('0x20')](_0x4365eb));_0x3c007f(_0x4365eb);})[_0x4e1c('0x13')](function(_0x729915){logger['error'](_0x4e1c('0x21'),_0x729915[_0x4e1c('0x11')],_0x5ae521);_0x39f8fc(_0x88df92['error'](0x1f4,_0x729915[_0x4e1c('0x11')]));});});}; \ No newline at end of file +var _0x1410=['where','attributes','limit','include','map','model','ShowDeskAccount','find','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw'];(function(_0x425533,_0xdcdced){var _0x5ded85=function(_0x50f419){while(--_0x50f419){_0x425533['push'](_0x425533['shift']());}};_0x5ded85(++_0xdcdced);}(_0x1410,0x130));var _0x0141=function(_0x39ff3e,_0x3bf941){_0x39ff3e=_0x39ff3e-0x0;var _0x5684a3=_0x1410[_0x39ff3e];return _0x5684a3;};'use strict';var _=require(_0x0141('0x0'));var util=require(_0x0141('0x1'));var moment=require(_0x0141('0x2'));var BPromise=require(_0x0141('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0141('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0141('0x5'));var logger=require('../../config/logger')(_0x0141('0x6'));var config=require(_0x0141('0x7'));var jayson=require(_0x0141('0x8'));var client=jayson[_0x0141('0x9')][_0x0141('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24f701,_0x22b566,_0x25511f){return new BPromise(function(_0x2d8f15,_0x57cfbb){return client[_0x0141('0xb')](_0x24f701,_0x25511f)[_0x0141('0xc')](function(_0x2b4f13){logger[_0x0141('0xd')](_0x0141('0xe'),_0x22b566,_0x0141('0xf'));logger[_0x0141('0x10')](_0x0141('0x11'),_0x22b566,'request\x20sent',JSON[_0x0141('0x12')](_0x2b4f13));if(_0x2b4f13[_0x0141('0x13')]){if(_0x2b4f13[_0x0141('0x13')][_0x0141('0x14')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x22b566,_0x2b4f13[_0x0141('0x13')][_0x0141('0x15')]);return _0x57cfbb(_0x2b4f13['error'][_0x0141('0x15')]);}logger[_0x0141('0x13')](_0x0141('0xe'),_0x22b566,_0x2b4f13[_0x0141('0x13')][_0x0141('0x15')]);return _0x2d8f15(_0x2b4f13['error'][_0x0141('0x15')]);}else{logger['info'](_0x0141('0xe'),_0x22b566,_0x0141('0xf'));_0x2d8f15(_0x2b4f13[_0x0141('0x16')][_0x0141('0x15')]);}})[_0x0141('0x17')](function(_0x3c91e8){logger['error']('DeskAccount,\x20%s,\x20%s',_0x22b566,_0x3c91e8);_0x57cfbb(_0x3c91e8);});});}exports[_0x0141('0x18')]=function(_0x3720f6){var _0x4f9945=this;return new Promise(function(_0x9c1eec,_0x18808d){return db[_0x0141('0x19')][_0x0141('0x1a')]({'raw':_0x3720f6['options']?_0x3720f6[_0x0141('0x1b')][_0x0141('0x1c')]===undefined?!![]:![]:!![],'where':_0x3720f6['options']?_0x3720f6[_0x0141('0x1b')][_0x0141('0x1d')]||null:null,'attributes':_0x3720f6[_0x0141('0x1b')]?_0x3720f6[_0x0141('0x1b')][_0x0141('0x1e')]||null:null,'limit':_0x3720f6[_0x0141('0x1b')]?_0x3720f6['options'][_0x0141('0x1f')]||null:null,'include':_0x3720f6[_0x0141('0x1b')]?_0x3720f6[_0x0141('0x1b')][_0x0141('0x20')]?_[_0x0141('0x21')](_0x3720f6[_0x0141('0x1b')][_0x0141('0x20')],function(_0x20656b){return{'model':db[_0x20656b[_0x0141('0x22')]],'as':_0x20656b['as'],'attributes':_0x20656b[_0x0141('0x1e')],'include':_0x20656b[_0x0141('0x20')]?_[_0x0141('0x21')](_0x20656b['include'],function(_0x4247d){return{'model':db[_0x4247d[_0x0141('0x22')]],'as':_0x4247d['as'],'attributes':_0x4247d[_0x0141('0x1e')],'include':_0x4247d[_0x0141('0x20')]?_[_0x0141('0x21')](_0x4247d['include'],function(_0x59196f){return{'model':db[_0x59196f[_0x0141('0x22')]],'as':_0x59196f['as'],'attributes':_0x59196f[_0x0141('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29bec2){logger['info'](_0x0141('0x18'),_0x3720f6);logger[_0x0141('0x10')](_0x0141('0x18'),_0x3720f6,JSON[_0x0141('0x12')](_0x29bec2));_0x9c1eec(_0x29bec2);})[_0x0141('0x17')](function(_0x29f463){logger[_0x0141('0x13')](_0x0141('0x18'),_0x29f463[_0x0141('0x15')],_0x3720f6);_0x18808d(_0x4f9945[_0x0141('0x13')](0x1f4,_0x29f463[_0x0141('0x15')]));});});};exports[_0x0141('0x23')]=function(_0x19f25f){var _0x48e025=this;return new Promise(function(_0x4201ae,_0x555294){return db[_0x0141('0x19')][_0x0141('0x24')]({'raw':_0x19f25f[_0x0141('0x1b')]?_0x19f25f[_0x0141('0x1b')][_0x0141('0x1c')]===undefined?!![]:![]:!![],'where':_0x19f25f[_0x0141('0x1b')]?_0x19f25f['options'][_0x0141('0x1d')]||null:null,'attributes':_0x19f25f['options']?_0x19f25f[_0x0141('0x1b')][_0x0141('0x1e')]||null:null,'include':_0x19f25f[_0x0141('0x1b')]?_0x19f25f['options'][_0x0141('0x20')]?_[_0x0141('0x21')](_0x19f25f['options'][_0x0141('0x20')],function(_0x42dd83){return{'model':db[_0x42dd83[_0x0141('0x22')]],'as':_0x42dd83['as'],'attributes':_0x42dd83[_0x0141('0x1e')],'include':_0x42dd83[_0x0141('0x20')]?_['map'](_0x42dd83[_0x0141('0x20')],function(_0x40dfa1){return{'model':db[_0x40dfa1[_0x0141('0x22')]],'as':_0x40dfa1['as'],'attributes':_0x40dfa1[_0x0141('0x1e')],'include':_0x40dfa1[_0x0141('0x20')]?_[_0x0141('0x21')](_0x40dfa1['include'],function(_0x52437d){return{'model':db[_0x52437d[_0x0141('0x22')]],'as':_0x52437d['as'],'attributes':_0x52437d[_0x0141('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xcb5460){logger[_0x0141('0xd')](_0x0141('0x23'),_0x19f25f);logger['debug']('ShowDeskAccount',_0x19f25f,JSON['stringify'](_0xcb5460));_0x4201ae(_0xcb5460);})[_0x0141('0x17')](function(_0x2b428a){logger[_0x0141('0x13')](_0x0141('0x23'),_0x2b428a[_0x0141('0x15')],_0x19f25f);_0x555294(_0x48e025[_0x0141('0x13')](0x1f4,_0x2b428a[_0x0141('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 30b1ce8..fe6ea60 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 _0x0d22=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getDescriptions','/:id/tags','getTags','post','create','setTags','update','delete','multer','util','path','express','Router'];(function(_0x4e8210,_0x41820a){var _0x4431c1=function(_0x56d114){while(--_0x56d114){_0x4e8210['push'](_0x4e8210['shift']());}};_0x4431c1(++_0x41820a);}(_0x0d22,0x1b3));var _0x20d2=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x0d22[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0x20d2('0x0'));var util=require(_0x20d2('0x1'));var path=require(_0x20d2('0x2'));var timeout=require('connect-timeout');var express=require(_0x20d2('0x3'));var router=express[_0x20d2('0x4')]();var auth=require(_0x20d2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x20d2('0x6'));var controller=require('./intDeskConfiguration.controller');router[_0x20d2('0x7')]('/',auth[_0x20d2('0x8')](),controller[_0x20d2('0x9')]);router[_0x20d2('0x7')](_0x20d2('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x20d2('0x7')](_0x20d2('0xb'),auth['isAuthenticated'](),controller[_0x20d2('0xc')]);router[_0x20d2('0x7')](_0x20d2('0xd'),auth[_0x20d2('0x8')](),controller['getSubjects']);router[_0x20d2('0x7')]('/:id/descriptions',auth[_0x20d2('0x8')](),controller[_0x20d2('0xe')]);router[_0x20d2('0x7')](_0x20d2('0xf'),auth['isAuthenticated'](),controller[_0x20d2('0x10')]);router[_0x20d2('0x11')]('/',auth[_0x20d2('0x8')](),controller[_0x20d2('0x12')]);router[_0x20d2('0x11')](_0x20d2('0xf'),auth[_0x20d2('0x8')](),controller[_0x20d2('0x13')]);router['put']('/:id',auth[_0x20d2('0x8')](),controller[_0x20d2('0x14')]);router[_0x20d2('0x15')](_0x20d2('0xa'),auth[_0x20d2('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xcbdb=['/:id','isAuthenticated','show','get','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','put','update','destroy','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','index'];(function(_0x272642,_0x54d5fa){var _0x245a36=function(_0x5125d5){while(--_0x5125d5){_0x272642['push'](_0x272642['shift']());}};_0x245a36(++_0x54d5fa);}(_0xcbdb,0x1ae));var _0xbcbd=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0xcbdb[_0x34021d];return _0x16597b;};'use strict';var multer=require('multer');var util=require(_0xbcbd('0x0'));var path=require('path');var timeout=require(_0xbcbd('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0xbcbd('0x2'));var interaction=require(_0xbcbd('0x3'));var config=require(_0xbcbd('0x4'));var controller=require(_0xbcbd('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xbcbd('0x6')]);router['get'](_0xbcbd('0x7'),auth[_0xbcbd('0x8')](),controller[_0xbcbd('0x9')]);router[_0xbcbd('0xa')](_0xbcbd('0xb'),auth[_0xbcbd('0x8')](),controller[_0xbcbd('0xc')]);router['get'](_0xbcbd('0xd'),auth[_0xbcbd('0x8')](),controller[_0xbcbd('0xe')]);router[_0xbcbd('0xa')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xbcbd('0xf')]);router[_0xbcbd('0xa')](_0xbcbd('0x10'),auth[_0xbcbd('0x8')](),controller[_0xbcbd('0x11')]);router[_0xbcbd('0x12')]('/',auth['isAuthenticated'](),controller[_0xbcbd('0x13')]);router[_0xbcbd('0x12')](_0xbcbd('0x10'),auth[_0xbcbd('0x8')](),controller['setTags']);router[_0xbcbd('0x14')](_0xbcbd('0x7'),auth[_0xbcbd('0x8')](),controller[_0xbcbd('0x15')]);router['delete'](_0xbcbd('0x7'),auth['isAuthenticated'](),controller[_0xbcbd('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index fec4dfb..1f4e13c 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 _0xb202=['exports','STRING','sequelize'];(function(_0x136a49,_0x2e458f){var _0x491f6e=function(_0xe35842){while(--_0xe35842){_0x136a49['push'](_0x136a49['shift']());}};_0x491f6e(++_0x2e458f);}(_0xb202,0xd1));var _0x2b20=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xb202[_0x3c2a69];return _0x596bc8;};'use strict';var Sequelize=require(_0x2b20('0x0'));module[_0x2b20('0x1')]={'name':{'type':Sequelize[_0x2b20('0x2')]},'description':{'type':Sequelize[_0x2b20('0x2')]}}; \ No newline at end of file +var _0xb461=['STRING','exports'];(function(_0x24b609,_0x2753ca){var _0x2a3b09=function(_0x2c1d79){while(--_0x2c1d79){_0x24b609['push'](_0x24b609['shift']());}};_0x2a3b09(++_0x2753ca);}(_0xb461,0x6f));var _0x1b46=function(_0x507ef8,_0x14e400){_0x507ef8=_0x507ef8-0x0;var _0x313782=_0xb461[_0x507ef8];return _0x313782;};'use strict';var Sequelize=require('sequelize');module[_0x1b46('0x0')]={'name':{'type':Sequelize[_0x1b46('0x1')]},'description':{'type':Sequelize[_0x1b46('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 6b45c34..23d5626 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 _0x9957=['DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','update','name','index','DeskConfiguration','keys','dateStart','query','dateEnd','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','add','day','merge','filter','map','options','includeAll','include','show','params','rawAttributes','create','body','find','destroy','getFields','findOne','DeskField','order','getSubjects','getDescriptions','getTags','setTags','ids','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/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x16b0f8,_0x11e55b){var _0x40e23a=function(_0x30dbac){while(--_0x30dbac){_0x16b0f8['push'](_0x16b0f8['shift']());}};_0x40e23a(++_0x11e55b);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var qs=require(_0x7995('0x13'));var logger=require(_0x7995('0x14'))(_0x7995('0x15'));var utils=require(_0x7995('0x16'));var config=require('../../config/environment');var db=require(_0x7995('0x17'))['db'];var jayson=require(_0x7995('0x18'));var client=jayson['client'][_0x7995('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2cb37a,_0x19a27e,_0x385f00,_0x281576){return new BPromise(function(_0x23999f,_0x2bbe7a){var _0x4cc004=_0x281576||client;return _0x4cc004['request'](_0x2cb37a,_0x385f00)[_0x7995('0x1a')](function(_0x2233dd){logger[_0x7995('0x1b')](_0x7995('0x1c'),_0x19a27e,_0x7995('0x1d'));logger[_0x7995('0x1e')](_0x7995('0x1f'),_0x19a27e,_0x7995('0x1d'),JSON['stringify'](_0x2233dd));if(_0x2233dd[_0x7995('0x20')]){if(_0x2233dd['error'][_0x7995('0x21')]===0x1f4){logger[_0x7995('0x20')](_0x7995('0x1c'),_0x19a27e,_0x2233dd[_0x7995('0x20')][_0x7995('0x22')]);return _0x2bbe7a(_0x2233dd[_0x7995('0x20')]['message']);}logger['error'](_0x7995('0x1c'),_0x19a27e,_0x2233dd['error']['message']);return _0x23999f(_0x2233dd[_0x7995('0x20')][_0x7995('0x22')]);}else{logger['info'](_0x7995('0x1c'),_0x19a27e,'request\x20sent');_0x23999f(_0x2233dd['result'][_0x7995('0x22')]);}})[_0x7995('0x23')](function(_0x350fd9){logger[_0x7995('0x20')](_0x7995('0x1c'),_0x19a27e,_0x350fd9);_0x2bbe7a(_0x350fd9);});});}function respondWithStatusCode(_0x1c278a,_0x5d40ae){_0x5d40ae=_0x5d40ae||0xcc;return function(_0x32a09a){if(_0x32a09a){return _0x1c278a[_0x7995('0x24')](_0x5d40ae);}return _0x1c278a[_0x7995('0x25')](_0x5d40ae)[_0x7995('0x26')]();};}function respondWithResult(_0x563799,_0x13bc35){_0x13bc35=_0x13bc35||0xc8;return function(_0x475351){if(_0x475351){return _0x563799[_0x7995('0x25')](_0x13bc35)['json'](_0x475351);}};}function respondWithFilteredResult(_0x39df42,_0x34e70c){return function(_0x401dc3){if(_0x401dc3){var _0x268ce7=_0x401dc3[_0x7995('0x27')],_0x3a3fcf=_0x34e70c['offset'],_0x2a307e=_0x34e70c[_0x7995('0x28')]+_0x34e70c[_0x7995('0x29')],_0x56691a;if(_0x2a307e>=_0x268ce7){_0x2a307e=_0x268ce7;_0x56691a=0xc8;}else{_0x56691a=0xce;}_0x39df42[_0x7995('0x25')](_0x56691a);return _0x39df42[_0x7995('0x2a')](_0x7995('0x2b'),_0x3a3fcf+'-'+_0x2a307e+'/'+_0x268ce7)['json'](_0x401dc3);}return null;};}function patchUpdates(_0x9b2a15){return function(_0x514445){try{jsonpatch[_0x7995('0x2c')](_0x514445,_0x9b2a15,!![]);}catch(_0x3250e0){return BPromise[_0x7995('0x2d')](_0x3250e0);}return _0x514445['save']();};}function saveUpdates(_0x530611,_0x48e573){return function(_0x3573be){if(_0x3573be){return _0x3573be[_0x7995('0x2e')](_0x530611)[_0x7995('0x1a')](function(_0x2b874d){return _0x2b874d;});}return null;};}function removeEntity(_0x2e3493,_0x1ca460){return function(_0x538841){if(_0x538841){return _0x538841['destroy']()[_0x7995('0x1a')](function(){_0x2e3493['status'](0xcc)[_0x7995('0x26')]();});}};}function handleEntityNotFound(_0x3eb566,_0x29fac5){return function(_0x1e9fa4){if(!_0x1e9fa4){_0x3eb566[_0x7995('0x24')](0x194);}return _0x1e9fa4;};}function handleError(_0x510841,_0x44309d){_0x44309d=_0x44309d||0x1f4;return function(_0x33e24e){logger['error'](_0x33e24e['stack']);if(_0x33e24e['name']){delete _0x33e24e[_0x7995('0x2f')];}_0x510841[_0x7995('0x25')](_0x44309d)['send'](_0x33e24e);};}exports[_0x7995('0x30')]=function(_0x51b95d,_0x37917b){var _0x1cb058={},_0x177cb4={},_0x5014d2={'count':0x0,'rows':[]};var _0x52d76d=db[_0x7995('0x31')]['rawAttributes'];_0x177cb4['model']=_[_0x7995('0x32')](_0x52d76d);var _0xe328b1={'dateStart':_0x51b95d['query'][_0x7995('0x33')],'dateEnd':_0x51b95d[_0x7995('0x34')][_0x7995('0x35')]};delete _0x51b95d[_0x7995('0x34')][_0x7995('0x33')];delete _0x51b95d['query'][_0x7995('0x35')];_0x177cb4[_0x7995('0x34')]=_[_0x7995('0x32')](_0x51b95d[_0x7995('0x34')]);_0x177cb4['filters']=_[_0x7995('0x36')](_0x177cb4[_0x7995('0x37')],_0x177cb4[_0x7995('0x34')]);_0x1cb058[_0x7995('0x38')]=_[_0x7995('0x36')](_0x177cb4[_0x7995('0x37')],qs['fields'](_0x51b95d[_0x7995('0x34')][_0x7995('0x39')]));_0x1cb058[_0x7995('0x38')]=_0x1cb058[_0x7995('0x38')][_0x7995('0x3a')]?_0x1cb058[_0x7995('0x38')]:_0x177cb4[_0x7995('0x37')];if(!_0x51b95d[_0x7995('0x34')][_0x7995('0x3b')](_0x7995('0x3c'))){_0x1cb058[_0x7995('0x29')]=qs[_0x7995('0x29')](_0x51b95d[_0x7995('0x34')]['limit']);_0x1cb058['offset']=qs[_0x7995('0x28')](_0x51b95d[_0x7995('0x34')]['offset']);}_0x1cb058['order']=qs[_0x7995('0x3d')](_0x51b95d['query']['sort']);_0x1cb058[_0x7995('0x3e')]=qs[_0x7995('0x3f')](_[_0x7995('0x40')](_0x51b95d['query'],_0x177cb4[_0x7995('0x3f')]));if(_0xe328b1['dateStart']){if(_0xe328b1[_0x7995('0x35')]){_0xe328b1['dateEnd']=moment(_0xe328b1['dateEnd'])[_0x7995('0x41')](0x1,_0x7995('0x42'));}else{_0xe328b1[_0x7995('0x35')]=moment(_0xe328b1[_0x7995('0x33')])['add'](0x1,_0x7995('0x42'));}_[_0x7995('0x43')](_0x1cb058[_0x7995('0x3e')],{'createdAt':{'$gte':_0xe328b1[_0x7995('0x33')],'$lte':_0xe328b1['dateEnd']}});}if(_0x51b95d['query'][_0x7995('0x44')]){_0x1cb058['where']=_[_0x7995('0x43')](_0x1cb058['where'],{'$or':_[_0x7995('0x45')](_0x1cb058['attributes'],function(_0x1e795e){var _0x1b0373={};_0x1b0373[_0x1e795e]={'$like':'%'+_0x51b95d['query'][_0x7995('0x44')]+'%'};return _0x1b0373;})});}_0x1cb058=_[_0x7995('0x43')]({},_0x1cb058,_0x51b95d[_0x7995('0x46')]);var _0xb70a51={'where':_0x1cb058['where']};return db[_0x7995('0x31')][_0x7995('0x27')](_0xb70a51)[_0x7995('0x1a')](function(_0x491184){_0x5014d2[_0x7995('0x27')]=_0x491184;if(_0x51b95d[_0x7995('0x34')][_0x7995('0x47')]){_0x1cb058[_0x7995('0x48')]=[{'all':!![]}];}return db[_0x7995('0x31')]['findAll'](_0x1cb058);})[_0x7995('0x1a')](function(_0xfb72b2){_0x5014d2['rows']=_0xfb72b2;return _0x5014d2;})[_0x7995('0x1a')](respondWithFilteredResult(_0x37917b,_0x1cb058))['catch'](handleError(_0x37917b,null));};exports[_0x7995('0x49')]=function(_0x187735,_0x1afab4){var _0x30e220={'raw':![],'where':{'id':_0x187735[_0x7995('0x4a')]['id']}},_0xddf537={};_0xddf537[_0x7995('0x37')]=_['keys'](db[_0x7995('0x31')][_0x7995('0x4b')]);_0xddf537[_0x7995('0x34')]=_['keys'](_0x187735[_0x7995('0x34')]);_0xddf537[_0x7995('0x3f')]=_[_0x7995('0x36')](_0xddf537['model'],_0xddf537['query']);_0x30e220['attributes']=_[_0x7995('0x36')](_0xddf537[_0x7995('0x37')],qs['fields'](_0x187735[_0x7995('0x34')][_0x7995('0x39')]));_0x30e220[_0x7995('0x38')]=_0x30e220[_0x7995('0x38')][_0x7995('0x3a')]?_0x30e220['attributes']:_0xddf537[_0x7995('0x37')];if(_0x187735['query'][_0x7995('0x47')]){_0x30e220[_0x7995('0x48')]=[{'all':!![]}];}_0x30e220=_[_0x7995('0x43')]({},_0x30e220,_0x187735['options']);return db['DeskConfiguration']['find'](_0x30e220)['then'](handleEntityNotFound(_0x1afab4,null))[_0x7995('0x1a')](respondWithResult(_0x1afab4,null))[_0x7995('0x23')](handleError(_0x1afab4,null));};exports[_0x7995('0x4c')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x31')][_0x7995('0x4c')](_0x150261[_0x7995('0x4d')],{})[_0x7995('0x1a')](respondWithResult(_0x1d957e,0xc9))[_0x7995('0x23')](handleError(_0x1d957e,null));};exports[_0x7995('0x2e')]=function(_0x133c63,_0x3da72b){if(_0x133c63[_0x7995('0x4d')]['id']){delete _0x133c63[_0x7995('0x4d')]['id'];}return db[_0x7995('0x31')][_0x7995('0x4e')]({'where':{'id':_0x133c63[_0x7995('0x4a')]['id']}})[_0x7995('0x1a')](handleEntityNotFound(_0x3da72b,null))['then'](saveUpdates(_0x133c63[_0x7995('0x4d')],null))[_0x7995('0x1a')](respondWithResult(_0x3da72b,null))[_0x7995('0x23')](handleError(_0x3da72b,null));};exports[_0x7995('0x4f')]=function(_0x5d160d,_0x53125a){return db[_0x7995('0x31')][_0x7995('0x4e')]({'where':{'id':_0x5d160d[_0x7995('0x4a')]['id']}})[_0x7995('0x1a')](handleEntityNotFound(_0x53125a,null))['then'](removeEntity(_0x53125a,null))[_0x7995('0x23')](handleError(_0x53125a,null));};exports[_0x7995('0x50')]=function(_0xef5044,_0x33c49c,_0x502d43){var _0x5e2d97={};var _0x40e5fc={};var _0x398fac;var _0x6c0221;return db[_0x7995('0x31')][_0x7995('0x51')]({'where':{'id':_0xef5044[_0x7995('0x4a')]['id']}})[_0x7995('0x1a')](handleEntityNotFound(_0x33c49c,null))[_0x7995('0x1a')](function(_0x984c23){if(_0x984c23){_0x398fac=_0x984c23;_0x40e5fc['model']=_[_0x7995('0x32')](db[_0x7995('0x52')][_0x7995('0x4b')]);_0x40e5fc[_0x7995('0x34')]=_['keys'](_0xef5044['query']);_0x40e5fc[_0x7995('0x3f')]=_[_0x7995('0x36')](_0x40e5fc['model'],_0x40e5fc[_0x7995('0x34')]);_0x5e2d97[_0x7995('0x38')]=_[_0x7995('0x36')](_0x40e5fc[_0x7995('0x37')],qs[_0x7995('0x39')](_0xef5044['query'][_0x7995('0x39')]));_0x5e2d97['attributes']=_0x5e2d97[_0x7995('0x38')][_0x7995('0x3a')]?_0x5e2d97[_0x7995('0x38')]:_0x40e5fc[_0x7995('0x37')];_0x5e2d97[_0x7995('0x53')]=qs[_0x7995('0x3d')](_0xef5044[_0x7995('0x34')][_0x7995('0x3d')]);_0x5e2d97[_0x7995('0x3e')]=qs[_0x7995('0x3f')](_[_0x7995('0x40')](_0xef5044[_0x7995('0x34')],_0x40e5fc['filters']));if(_0xef5044[_0x7995('0x34')][_0x7995('0x44')]){_0x5e2d97[_0x7995('0x3e')]=_[_0x7995('0x43')](_0x5e2d97[_0x7995('0x3e')],{'$or':_['map'](_0x5e2d97['attributes'],function(_0x268fde){var _0x87e38d={};_0x87e38d[_0x268fde]={'$like':'%'+_0xef5044[_0x7995('0x34')][_0x7995('0x44')]+'%'};return _0x87e38d;})});}_0x5e2d97=_['merge']({},_0x5e2d97,_0xef5044[_0x7995('0x46')]);return _0x398fac['getFields'](_0x5e2d97);}})['then'](function(_0xca8238){if(_0xca8238){_0x6c0221=_0xca8238[_0x7995('0x3a')];if(!_0xef5044[_0x7995('0x34')][_0x7995('0x3b')](_0x7995('0x3c'))){_0x5e2d97[_0x7995('0x29')]=qs[_0x7995('0x29')](_0xef5044[_0x7995('0x34')][_0x7995('0x29')]);_0x5e2d97[_0x7995('0x28')]=qs['offset'](_0xef5044[_0x7995('0x34')][_0x7995('0x28')]);}return _0x398fac[_0x7995('0x50')](_0x5e2d97);}})['then'](function(_0x1fe1cb){if(_0x1fe1cb){return _0x1fe1cb?{'count':_0x6c0221,'rows':_0x1fe1cb}:null;}})[_0x7995('0x1a')](respondWithResult(_0x33c49c,null))[_0x7995('0x23')](handleError(_0x33c49c,null));};exports[_0x7995('0x54')]=function(_0x3b0d30,_0x51ab1e,_0x550a10){var _0x3adfd2={};var _0x2f94c4={};var _0x1fdff6;var _0x435a1b;return db['DeskConfiguration']['findOne']({'where':{'id':_0x3b0d30[_0x7995('0x4a')]['id']}})[_0x7995('0x1a')](handleEntityNotFound(_0x51ab1e,null))[_0x7995('0x1a')](function(_0x35aaec){if(_0x35aaec){_0x1fdff6=_0x35aaec;_0x2f94c4['model']=_[_0x7995('0x32')](db[_0x7995('0x52')]['rawAttributes']);_0x2f94c4['query']=_[_0x7995('0x32')](_0x3b0d30[_0x7995('0x34')]);_0x2f94c4['filters']=_[_0x7995('0x36')](_0x2f94c4['model'],_0x2f94c4[_0x7995('0x34')]);_0x3adfd2[_0x7995('0x38')]=_['intersection'](_0x2f94c4['model'],qs[_0x7995('0x39')](_0x3b0d30['query'][_0x7995('0x39')]));_0x3adfd2[_0x7995('0x38')]=_0x3adfd2[_0x7995('0x38')][_0x7995('0x3a')]?_0x3adfd2[_0x7995('0x38')]:_0x2f94c4[_0x7995('0x37')];_0x3adfd2[_0x7995('0x53')]=qs[_0x7995('0x3d')](_0x3b0d30[_0x7995('0x34')][_0x7995('0x3d')]);_0x3adfd2[_0x7995('0x3e')]=qs[_0x7995('0x3f')](_[_0x7995('0x40')](_0x3b0d30[_0x7995('0x34')],_0x2f94c4[_0x7995('0x3f')]));if(_0x3b0d30[_0x7995('0x34')][_0x7995('0x44')]){_0x3adfd2[_0x7995('0x3e')]=_[_0x7995('0x43')](_0x3adfd2[_0x7995('0x3e')],{'$or':_[_0x7995('0x45')](_0x3adfd2[_0x7995('0x38')],function(_0x11fe75){var _0x280fbb={};_0x280fbb[_0x11fe75]={'$like':'%'+_0x3b0d30[_0x7995('0x34')][_0x7995('0x44')]+'%'};return _0x280fbb;})});}_0x3adfd2=_[_0x7995('0x43')]({},_0x3adfd2,_0x3b0d30[_0x7995('0x46')]);return _0x1fdff6['getSubjects'](_0x3adfd2);}})[_0x7995('0x1a')](function(_0x10f4ca){if(_0x10f4ca){_0x435a1b=_0x10f4ca['length'];if(!_0x3b0d30['query'][_0x7995('0x3b')](_0x7995('0x3c'))){_0x3adfd2[_0x7995('0x29')]=qs[_0x7995('0x29')](_0x3b0d30[_0x7995('0x34')][_0x7995('0x29')]);_0x3adfd2['offset']=qs[_0x7995('0x28')](_0x3b0d30[_0x7995('0x34')][_0x7995('0x28')]);}return _0x1fdff6[_0x7995('0x54')](_0x3adfd2);}})[_0x7995('0x1a')](function(_0x3f0bff){if(_0x3f0bff){return _0x3f0bff?{'count':_0x435a1b,'rows':_0x3f0bff}:null;}})[_0x7995('0x1a')](respondWithResult(_0x51ab1e,null))[_0x7995('0x23')](handleError(_0x51ab1e,null));};exports['getDescriptions']=function(_0x1c8e7d,_0x2b8217,_0x5c04c9){var _0x479271={};var _0xd24c64={};var _0xf8c2ed;var _0x18e1a2;return db[_0x7995('0x31')][_0x7995('0x51')]({'where':{'id':_0x1c8e7d['params']['id']}})[_0x7995('0x1a')](handleEntityNotFound(_0x2b8217,null))[_0x7995('0x1a')](function(_0x528b22){if(_0x528b22){_0xf8c2ed=_0x528b22;_0xd24c64[_0x7995('0x37')]=_[_0x7995('0x32')](db['DeskField'][_0x7995('0x4b')]);_0xd24c64['query']=_[_0x7995('0x32')](_0x1c8e7d[_0x7995('0x34')]);_0xd24c64[_0x7995('0x3f')]=_[_0x7995('0x36')](_0xd24c64[_0x7995('0x37')],_0xd24c64['query']);_0x479271[_0x7995('0x38')]=_[_0x7995('0x36')](_0xd24c64[_0x7995('0x37')],qs['fields'](_0x1c8e7d[_0x7995('0x34')][_0x7995('0x39')]));_0x479271[_0x7995('0x38')]=_0x479271[_0x7995('0x38')]['length']?_0x479271[_0x7995('0x38')]:_0xd24c64[_0x7995('0x37')];_0x479271[_0x7995('0x53')]=qs['sort'](_0x1c8e7d['query'][_0x7995('0x3d')]);_0x479271[_0x7995('0x3e')]=qs['filters'](_['pick'](_0x1c8e7d[_0x7995('0x34')],_0xd24c64[_0x7995('0x3f')]));if(_0x1c8e7d[_0x7995('0x34')][_0x7995('0x44')]){_0x479271[_0x7995('0x3e')]=_['merge'](_0x479271['where'],{'$or':_[_0x7995('0x45')](_0x479271['attributes'],function(_0x588df7){var _0x208998={};_0x208998[_0x588df7]={'$like':'%'+_0x1c8e7d[_0x7995('0x34')][_0x7995('0x44')]+'%'};return _0x208998;})});}_0x479271=_['merge']({},_0x479271,_0x1c8e7d[_0x7995('0x46')]);return _0xf8c2ed[_0x7995('0x55')](_0x479271);}})[_0x7995('0x1a')](function(_0x27889a){if(_0x27889a){_0x18e1a2=_0x27889a[_0x7995('0x3a')];if(!_0x1c8e7d['query'][_0x7995('0x3b')](_0x7995('0x3c'))){_0x479271[_0x7995('0x29')]=qs[_0x7995('0x29')](_0x1c8e7d['query'][_0x7995('0x29')]);_0x479271[_0x7995('0x28')]=qs['offset'](_0x1c8e7d[_0x7995('0x34')][_0x7995('0x28')]);}return _0xf8c2ed['getDescriptions'](_0x479271);}})[_0x7995('0x1a')](function(_0x50efab){if(_0x50efab){return _0x50efab?{'count':_0x18e1a2,'rows':_0x50efab}:null;}})[_0x7995('0x1a')](respondWithResult(_0x2b8217,null))['catch'](handleError(_0x2b8217,null));};exports[_0x7995('0x56')]=function(_0x4d12fd,_0xa97c08,_0x20f48c){var _0x5bc982={};var _0x17d677={};var _0x5c63cc;var _0x4b4bdc;return db[_0x7995('0x31')][_0x7995('0x51')]({'where':{'id':_0x4d12fd[_0x7995('0x4a')]['id']}})[_0x7995('0x1a')](handleEntityNotFound(_0xa97c08,null))['then'](function(_0x1ea76d){if(_0x1ea76d){_0x5c63cc=_0x1ea76d;_0x17d677[_0x7995('0x37')]=_['keys'](db['Tag'][_0x7995('0x4b')]);_0x17d677['query']=_[_0x7995('0x32')](_0x4d12fd[_0x7995('0x34')]);_0x17d677[_0x7995('0x3f')]=_['intersection'](_0x17d677['model'],_0x17d677[_0x7995('0x34')]);_0x5bc982['attributes']=_[_0x7995('0x36')](_0x17d677[_0x7995('0x37')],qs[_0x7995('0x39')](_0x4d12fd[_0x7995('0x34')]['fields']));_0x5bc982['attributes']=_0x5bc982['attributes'][_0x7995('0x3a')]?_0x5bc982[_0x7995('0x38')]:_0x17d677[_0x7995('0x37')];_0x5bc982[_0x7995('0x53')]=qs[_0x7995('0x3d')](_0x4d12fd[_0x7995('0x34')]['sort']);_0x5bc982['where']=qs[_0x7995('0x3f')](_['pick'](_0x4d12fd['query'],_0x17d677[_0x7995('0x3f')]));if(_0x4d12fd['query']['filter']){_0x5bc982[_0x7995('0x3e')]=_[_0x7995('0x43')](_0x5bc982[_0x7995('0x3e')],{'$or':_['map'](_0x5bc982[_0x7995('0x38')],function(_0xf604d9){var _0x1c4d23={};_0x1c4d23[_0xf604d9]={'$like':'%'+_0x4d12fd[_0x7995('0x34')][_0x7995('0x44')]+'%'};return _0x1c4d23;})});}_0x5bc982=_[_0x7995('0x43')]({},_0x5bc982,_0x4d12fd[_0x7995('0x46')]);return _0x5c63cc[_0x7995('0x56')](_0x5bc982);}})[_0x7995('0x1a')](function(_0x570b71){if(_0x570b71){_0x4b4bdc=_0x570b71[_0x7995('0x3a')];if(!_0x4d12fd[_0x7995('0x34')][_0x7995('0x3b')](_0x7995('0x3c'))){_0x5bc982[_0x7995('0x29')]=qs['limit'](_0x4d12fd[_0x7995('0x34')][_0x7995('0x29')]);_0x5bc982[_0x7995('0x28')]=qs['offset'](_0x4d12fd['query']['offset']);}return _0x5c63cc[_0x7995('0x56')](_0x5bc982);}})[_0x7995('0x1a')](function(_0x9daa49){if(_0x9daa49){return _0x9daa49?{'count':_0x4b4bdc,'rows':_0x9daa49}:null;}})[_0x7995('0x1a')](respondWithResult(_0xa97c08,null))[_0x7995('0x23')](handleError(_0xa97c08,null));};exports[_0x7995('0x57')]=function(_0x4dd64a,_0x46d263,_0x554cf8){if(_0x4dd64a[_0x7995('0x4d')]['id']){delete _0x4dd64a[_0x7995('0x4d')]['id'];}return db[_0x7995('0x31')][_0x7995('0x51')]({'where':{'id':_0x4dd64a[_0x7995('0x4a')]['id']}})[_0x7995('0x1a')](handleEntityNotFound(_0x46d263,null))[_0x7995('0x1a')](function(_0x24a0e6){if(_0x24a0e6){return _0x24a0e6[_0x7995('0x57')](_0x4dd64a[_0x7995('0x4d')][_0x7995('0x58')]||[]);}return null;})['then'](respondWithResult(_0x46d263,null))[_0x7995('0x23')](handleError(_0x46d263,null));}; \ No newline at end of file +var _0x814b=['where','filter','map','options','include','findAll','rows','show','params','model','includeAll','create','body','find','getFields','findOne','DeskField','order','pick','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','DeskConfiguration','rawAttributes','keys','dateStart','query','dateEnd','intersection','attributes','fields','length','nolimit','sort','filters','add','day','merge'];(function(_0x1eb3df,_0x15c8dc){var _0x565fb6=function(_0x3a6b96){while(--_0x3a6b96){_0x1eb3df['push'](_0x1eb3df['shift']());}};_0x565fb6(++_0x15c8dc);}(_0x814b,0x1a2));var _0xb814=function(_0xa60623,_0x2d4e4f){_0xa60623=_0xa60623-0x0;var _0x4a6487=_0x814b[_0xa60623];return _0x4a6487;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var qs=require(_0xb814('0x13'));var logger=require(_0xb814('0x14'))(_0xb814('0x15'));var utils=require(_0xb814('0x16'));var config=require(_0xb814('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0xb814('0x18'));var client=jayson['client'][_0xb814('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x15d6ef,_0x35b10d,_0x2cc46b,_0x2ce718){return new BPromise(function(_0x3bde14,_0x1438e7){var _0x41ed7b=_0x2ce718||client;return _0x41ed7b[_0xb814('0x1a')](_0x15d6ef,_0x2cc46b)[_0xb814('0x1b')](function(_0x3f4881){logger[_0xb814('0x1c')](_0xb814('0x1d'),_0x35b10d,_0xb814('0x1e'));logger[_0xb814('0x1f')](_0xb814('0x20'),_0x35b10d,_0xb814('0x1e'),JSON[_0xb814('0x21')](_0x3f4881));if(_0x3f4881[_0xb814('0x22')]){if(_0x3f4881[_0xb814('0x22')][_0xb814('0x23')]===0x1f4){logger['error'](_0xb814('0x1d'),_0x35b10d,_0x3f4881['error'][_0xb814('0x24')]);return _0x1438e7(_0x3f4881[_0xb814('0x22')]['message']);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x35b10d,_0x3f4881[_0xb814('0x22')]['message']);return _0x3bde14(_0x3f4881['error'][_0xb814('0x24')]);}else{logger[_0xb814('0x1c')](_0xb814('0x1d'),_0x35b10d,'request\x20sent');_0x3bde14(_0x3f4881[_0xb814('0x25')]['message']);}})[_0xb814('0x26')](function(_0x1808a3){logger[_0xb814('0x22')](_0xb814('0x1d'),_0x35b10d,_0x1808a3);_0x1438e7(_0x1808a3);});});}function respondWithStatusCode(_0x27352e,_0x2bd039){_0x2bd039=_0x2bd039||0xcc;return function(_0x1f5d40){if(_0x1f5d40){return _0x27352e['sendStatus'](_0x2bd039);}return _0x27352e[_0xb814('0x27')](_0x2bd039)['end']();};}function respondWithResult(_0x3f81d0,_0x457dac){_0x457dac=_0x457dac||0xc8;return function(_0x31c7ec){if(_0x31c7ec){return _0x3f81d0[_0xb814('0x27')](_0x457dac)[_0xb814('0x28')](_0x31c7ec);}};}function respondWithFilteredResult(_0xb9e57d,_0x3d836c){return function(_0x5755ea){if(_0x5755ea){var _0x392222=_0x5755ea[_0xb814('0x29')],_0xc0ef66=_0x3d836c[_0xb814('0x2a')],_0x1c2625=_0x3d836c[_0xb814('0x2a')]+_0x3d836c[_0xb814('0x2b')],_0x349394;if(_0x1c2625>=_0x392222){_0x1c2625=_0x392222;_0x349394=0xc8;}else{_0x349394=0xce;}_0xb9e57d['status'](_0x349394);return _0xb9e57d[_0xb814('0x2c')](_0xb814('0x2d'),_0xc0ef66+'-'+_0x1c2625+'/'+_0x392222)['json'](_0x5755ea);}return null;};}function patchUpdates(_0x9008b2){return function(_0x37d24d){try{jsonpatch[_0xb814('0x2e')](_0x37d24d,_0x9008b2,!![]);}catch(_0x499f22){return BPromise[_0xb814('0x2f')](_0x499f22);}return _0x37d24d[_0xb814('0x30')]();};}function saveUpdates(_0x58c3ca,_0x338a28){return function(_0x526610){if(_0x526610){return _0x526610[_0xb814('0x31')](_0x58c3ca)['then'](function(_0x4cfc58){return _0x4cfc58;});}return null;};}function removeEntity(_0x419cd9,_0x4a4f27){return function(_0x2431e2){if(_0x2431e2){return _0x2431e2[_0xb814('0x32')]()[_0xb814('0x1b')](function(){_0x419cd9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x26d3a9,_0x336e2b){return function(_0x523566){if(!_0x523566){_0x26d3a9[_0xb814('0x33')](0x194);}return _0x523566;};}function handleError(_0xe558d5,_0x692c72){_0x692c72=_0x692c72||0x1f4;return function(_0x217b7e){logger[_0xb814('0x22')](_0x217b7e[_0xb814('0x34')]);if(_0x217b7e[_0xb814('0x35')]){delete _0x217b7e['name'];}_0xe558d5[_0xb814('0x27')](_0x692c72)[_0xb814('0x36')](_0x217b7e);};}exports[_0xb814('0x37')]=function(_0x424e2b,_0x14100d){var _0x4ff31a={},_0x16ef82={},_0x57e6e6={'count':0x0,'rows':[]};var _0x43db67=db[_0xb814('0x38')][_0xb814('0x39')];_0x16ef82['model']=_[_0xb814('0x3a')](_0x43db67);var _0xbdb3e9={'dateStart':_0x424e2b['query'][_0xb814('0x3b')],'dateEnd':_0x424e2b[_0xb814('0x3c')][_0xb814('0x3d')]};delete _0x424e2b[_0xb814('0x3c')][_0xb814('0x3b')];delete _0x424e2b[_0xb814('0x3c')]['dateEnd'];_0x16ef82[_0xb814('0x3c')]=_['keys'](_0x424e2b[_0xb814('0x3c')]);_0x16ef82['filters']=_[_0xb814('0x3e')](_0x16ef82['model'],_0x16ef82[_0xb814('0x3c')]);_0x4ff31a[_0xb814('0x3f')]=_['intersection'](_0x16ef82['model'],qs['fields'](_0x424e2b['query'][_0xb814('0x40')]));_0x4ff31a[_0xb814('0x3f')]=_0x4ff31a[_0xb814('0x3f')][_0xb814('0x41')]?_0x4ff31a['attributes']:_0x16ef82['model'];if(!_0x424e2b[_0xb814('0x3c')]['hasOwnProperty'](_0xb814('0x42'))){_0x4ff31a[_0xb814('0x2b')]=qs[_0xb814('0x2b')](_0x424e2b[_0xb814('0x3c')][_0xb814('0x2b')]);_0x4ff31a[_0xb814('0x2a')]=qs[_0xb814('0x2a')](_0x424e2b[_0xb814('0x3c')][_0xb814('0x2a')]);}_0x4ff31a['order']=qs['sort'](_0x424e2b['query'][_0xb814('0x43')]);_0x4ff31a['where']=qs[_0xb814('0x44')](_['pick'](_0x424e2b[_0xb814('0x3c')],_0x16ef82[_0xb814('0x44')]));if(_0xbdb3e9[_0xb814('0x3b')]){if(_0xbdb3e9[_0xb814('0x3d')]){_0xbdb3e9['dateEnd']=moment(_0xbdb3e9[_0xb814('0x3d')])[_0xb814('0x45')](0x1,_0xb814('0x46'));}else{_0xbdb3e9[_0xb814('0x3d')]=moment(_0xbdb3e9[_0xb814('0x3b')])[_0xb814('0x45')](0x1,'day');}_[_0xb814('0x47')](_0x4ff31a[_0xb814('0x48')],{'createdAt':{'$gte':_0xbdb3e9[_0xb814('0x3b')],'$lte':_0xbdb3e9[_0xb814('0x3d')]}});}if(_0x424e2b[_0xb814('0x3c')][_0xb814('0x49')]){_0x4ff31a[_0xb814('0x48')]=_['merge'](_0x4ff31a['where'],{'$or':_[_0xb814('0x4a')](_0x4ff31a[_0xb814('0x3f')],function(_0x4c08d6){var _0x2bf906={};_0x2bf906[_0x4c08d6]={'$like':'%'+_0x424e2b[_0xb814('0x3c')][_0xb814('0x49')]+'%'};return _0x2bf906;})});}_0x4ff31a=_[_0xb814('0x47')]({},_0x4ff31a,_0x424e2b[_0xb814('0x4b')]);var _0x2eb9b6={'where':_0x4ff31a[_0xb814('0x48')]};return db[_0xb814('0x38')]['count'](_0x2eb9b6)[_0xb814('0x1b')](function(_0x17510c){_0x57e6e6['count']=_0x17510c;if(_0x424e2b[_0xb814('0x3c')]['includeAll']){_0x4ff31a[_0xb814('0x4c')]=[{'all':!![]}];}return db[_0xb814('0x38')][_0xb814('0x4d')](_0x4ff31a);})[_0xb814('0x1b')](function(_0x1d3833){_0x57e6e6[_0xb814('0x4e')]=_0x1d3833;return _0x57e6e6;})[_0xb814('0x1b')](respondWithFilteredResult(_0x14100d,_0x4ff31a))[_0xb814('0x26')](handleError(_0x14100d,null));};exports[_0xb814('0x4f')]=function(_0x2a422a,_0x5e6df7){var _0x4d4a7e={'raw':![],'where':{'id':_0x2a422a[_0xb814('0x50')]['id']}},_0x32eca6={};_0x32eca6[_0xb814('0x51')]=_[_0xb814('0x3a')](db[_0xb814('0x38')][_0xb814('0x39')]);_0x32eca6[_0xb814('0x3c')]=_['keys'](_0x2a422a[_0xb814('0x3c')]);_0x32eca6[_0xb814('0x44')]=_[_0xb814('0x3e')](_0x32eca6['model'],_0x32eca6[_0xb814('0x3c')]);_0x4d4a7e['attributes']=_[_0xb814('0x3e')](_0x32eca6['model'],qs[_0xb814('0x40')](_0x2a422a[_0xb814('0x3c')]['fields']));_0x4d4a7e[_0xb814('0x3f')]=_0x4d4a7e[_0xb814('0x3f')][_0xb814('0x41')]?_0x4d4a7e['attributes']:_0x32eca6[_0xb814('0x51')];if(_0x2a422a['query'][_0xb814('0x52')]){_0x4d4a7e[_0xb814('0x4c')]=[{'all':!![]}];}_0x4d4a7e=_['merge']({},_0x4d4a7e,_0x2a422a[_0xb814('0x4b')]);return db['DeskConfiguration']['find'](_0x4d4a7e)[_0xb814('0x1b')](handleEntityNotFound(_0x5e6df7,null))[_0xb814('0x1b')](respondWithResult(_0x5e6df7,null))[_0xb814('0x26')](handleError(_0x5e6df7,null));};exports['create']=function(_0x28bbab,_0x538b0f){return db[_0xb814('0x38')][_0xb814('0x53')](_0x28bbab['body'],{})[_0xb814('0x1b')](respondWithResult(_0x538b0f,0xc9))['catch'](handleError(_0x538b0f,null));};exports[_0xb814('0x31')]=function(_0x1656ed,_0xb2bd82){if(_0x1656ed[_0xb814('0x54')]['id']){delete _0x1656ed[_0xb814('0x54')]['id'];}return db[_0xb814('0x38')][_0xb814('0x55')]({'where':{'id':_0x1656ed[_0xb814('0x50')]['id']}})['then'](handleEntityNotFound(_0xb2bd82,null))[_0xb814('0x1b')](saveUpdates(_0x1656ed[_0xb814('0x54')],null))['then'](respondWithResult(_0xb2bd82,null))[_0xb814('0x26')](handleError(_0xb2bd82,null));};exports[_0xb814('0x32')]=function(_0x4d13db,_0x371000){return db['DeskConfiguration']['find']({'where':{'id':_0x4d13db[_0xb814('0x50')]['id']}})['then'](handleEntityNotFound(_0x371000,null))[_0xb814('0x1b')](removeEntity(_0x371000,null))[_0xb814('0x26')](handleError(_0x371000,null));};exports[_0xb814('0x56')]=function(_0x586957,_0x1a0ef4,_0x4df65c){var _0x2ef77d={};var _0x1e9196={};var _0x1236d4;var _0x176585;return db[_0xb814('0x38')][_0xb814('0x57')]({'where':{'id':_0x586957[_0xb814('0x50')]['id']}})[_0xb814('0x1b')](handleEntityNotFound(_0x1a0ef4,null))[_0xb814('0x1b')](function(_0x4d611d){if(_0x4d611d){_0x1236d4=_0x4d611d;_0x1e9196[_0xb814('0x51')]=_[_0xb814('0x3a')](db[_0xb814('0x58')][_0xb814('0x39')]);_0x1e9196[_0xb814('0x3c')]=_[_0xb814('0x3a')](_0x586957['query']);_0x1e9196[_0xb814('0x44')]=_['intersection'](_0x1e9196[_0xb814('0x51')],_0x1e9196[_0xb814('0x3c')]);_0x2ef77d[_0xb814('0x3f')]=_['intersection'](_0x1e9196[_0xb814('0x51')],qs['fields'](_0x586957[_0xb814('0x3c')]['fields']));_0x2ef77d[_0xb814('0x3f')]=_0x2ef77d[_0xb814('0x3f')][_0xb814('0x41')]?_0x2ef77d[_0xb814('0x3f')]:_0x1e9196[_0xb814('0x51')];_0x2ef77d[_0xb814('0x59')]=qs[_0xb814('0x43')](_0x586957['query'][_0xb814('0x43')]);_0x2ef77d['where']=qs[_0xb814('0x44')](_[_0xb814('0x5a')](_0x586957[_0xb814('0x3c')],_0x1e9196[_0xb814('0x44')]));if(_0x586957[_0xb814('0x3c')][_0xb814('0x49')]){_0x2ef77d['where']=_[_0xb814('0x47')](_0x2ef77d[_0xb814('0x48')],{'$or':_['map'](_0x2ef77d[_0xb814('0x3f')],function(_0x32a37a){var _0x263699={};_0x263699[_0x32a37a]={'$like':'%'+_0x586957[_0xb814('0x3c')][_0xb814('0x49')]+'%'};return _0x263699;})});}_0x2ef77d=_['merge']({},_0x2ef77d,_0x586957[_0xb814('0x4b')]);return _0x1236d4['getFields'](_0x2ef77d);}})[_0xb814('0x1b')](function(_0x16f8f2){if(_0x16f8f2){_0x176585=_0x16f8f2[_0xb814('0x41')];if(!_0x586957[_0xb814('0x3c')][_0xb814('0x5b')](_0xb814('0x42'))){_0x2ef77d['limit']=qs['limit'](_0x586957['query'][_0xb814('0x2b')]);_0x2ef77d['offset']=qs[_0xb814('0x2a')](_0x586957[_0xb814('0x3c')][_0xb814('0x2a')]);}return _0x1236d4['getFields'](_0x2ef77d);}})[_0xb814('0x1b')](function(_0x3e5ce8){if(_0x3e5ce8){return _0x3e5ce8?{'count':_0x176585,'rows':_0x3e5ce8}:null;}})[_0xb814('0x1b')](respondWithResult(_0x1a0ef4,null))['catch'](handleError(_0x1a0ef4,null));};exports[_0xb814('0x5c')]=function(_0x1bf0b7,_0x1f39c0,_0x3564e0){var _0x555be0={};var _0x5dedd7={};var _0x28eaf8;var _0x295488;return db[_0xb814('0x38')][_0xb814('0x57')]({'where':{'id':_0x1bf0b7[_0xb814('0x50')]['id']}})[_0xb814('0x1b')](handleEntityNotFound(_0x1f39c0,null))[_0xb814('0x1b')](function(_0xe47442){if(_0xe47442){_0x28eaf8=_0xe47442;_0x5dedd7[_0xb814('0x51')]=_[_0xb814('0x3a')](db[_0xb814('0x58')][_0xb814('0x39')]);_0x5dedd7[_0xb814('0x3c')]=_[_0xb814('0x3a')](_0x1bf0b7[_0xb814('0x3c')]);_0x5dedd7['filters']=_[_0xb814('0x3e')](_0x5dedd7[_0xb814('0x51')],_0x5dedd7[_0xb814('0x3c')]);_0x555be0[_0xb814('0x3f')]=_[_0xb814('0x3e')](_0x5dedd7[_0xb814('0x51')],qs['fields'](_0x1bf0b7[_0xb814('0x3c')]['fields']));_0x555be0[_0xb814('0x3f')]=_0x555be0[_0xb814('0x3f')][_0xb814('0x41')]?_0x555be0[_0xb814('0x3f')]:_0x5dedd7[_0xb814('0x51')];_0x555be0['order']=qs['sort'](_0x1bf0b7[_0xb814('0x3c')][_0xb814('0x43')]);_0x555be0[_0xb814('0x48')]=qs[_0xb814('0x44')](_['pick'](_0x1bf0b7[_0xb814('0x3c')],_0x5dedd7['filters']));if(_0x1bf0b7[_0xb814('0x3c')][_0xb814('0x49')]){_0x555be0['where']=_['merge'](_0x555be0[_0xb814('0x48')],{'$or':_['map'](_0x555be0[_0xb814('0x3f')],function(_0x163c2b){var _0x3c770d={};_0x3c770d[_0x163c2b]={'$like':'%'+_0x1bf0b7[_0xb814('0x3c')][_0xb814('0x49')]+'%'};return _0x3c770d;})});}_0x555be0=_[_0xb814('0x47')]({},_0x555be0,_0x1bf0b7[_0xb814('0x4b')]);return _0x28eaf8['getSubjects'](_0x555be0);}})[_0xb814('0x1b')](function(_0x54413d){if(_0x54413d){_0x295488=_0x54413d[_0xb814('0x41')];if(!_0x1bf0b7['query'][_0xb814('0x5b')](_0xb814('0x42'))){_0x555be0['limit']=qs[_0xb814('0x2b')](_0x1bf0b7['query'][_0xb814('0x2b')]);_0x555be0[_0xb814('0x2a')]=qs['offset'](_0x1bf0b7['query'][_0xb814('0x2a')]);}return _0x28eaf8[_0xb814('0x5c')](_0x555be0);}})[_0xb814('0x1b')](function(_0x6f5e6a){if(_0x6f5e6a){return _0x6f5e6a?{'count':_0x295488,'rows':_0x6f5e6a}:null;}})[_0xb814('0x1b')](respondWithResult(_0x1f39c0,null))[_0xb814('0x26')](handleError(_0x1f39c0,null));};exports[_0xb814('0x5d')]=function(_0x314600,_0x8cb107,_0x34f49c){var _0x53e705={};var _0x5b0fcd={};var _0x5bee4d;var _0x5470e4;return db['DeskConfiguration'][_0xb814('0x57')]({'where':{'id':_0x314600[_0xb814('0x50')]['id']}})[_0xb814('0x1b')](handleEntityNotFound(_0x8cb107,null))['then'](function(_0x121330){if(_0x121330){_0x5bee4d=_0x121330;_0x5b0fcd[_0xb814('0x51')]=_[_0xb814('0x3a')](db[_0xb814('0x58')][_0xb814('0x39')]);_0x5b0fcd[_0xb814('0x3c')]=_[_0xb814('0x3a')](_0x314600[_0xb814('0x3c')]);_0x5b0fcd['filters']=_[_0xb814('0x3e')](_0x5b0fcd[_0xb814('0x51')],_0x5b0fcd[_0xb814('0x3c')]);_0x53e705[_0xb814('0x3f')]=_['intersection'](_0x5b0fcd[_0xb814('0x51')],qs[_0xb814('0x40')](_0x314600[_0xb814('0x3c')][_0xb814('0x40')]));_0x53e705[_0xb814('0x3f')]=_0x53e705['attributes']['length']?_0x53e705[_0xb814('0x3f')]:_0x5b0fcd['model'];_0x53e705[_0xb814('0x59')]=qs[_0xb814('0x43')](_0x314600['query'][_0xb814('0x43')]);_0x53e705['where']=qs[_0xb814('0x44')](_['pick'](_0x314600[_0xb814('0x3c')],_0x5b0fcd[_0xb814('0x44')]));if(_0x314600[_0xb814('0x3c')][_0xb814('0x49')]){_0x53e705[_0xb814('0x48')]=_[_0xb814('0x47')](_0x53e705[_0xb814('0x48')],{'$or':_['map'](_0x53e705['attributes'],function(_0x21aa36){var _0x50ed93={};_0x50ed93[_0x21aa36]={'$like':'%'+_0x314600['query'][_0xb814('0x49')]+'%'};return _0x50ed93;})});}_0x53e705=_[_0xb814('0x47')]({},_0x53e705,_0x314600[_0xb814('0x4b')]);return _0x5bee4d['getDescriptions'](_0x53e705);}})[_0xb814('0x1b')](function(_0x5a25f2){if(_0x5a25f2){_0x5470e4=_0x5a25f2[_0xb814('0x41')];if(!_0x314600[_0xb814('0x3c')][_0xb814('0x5b')](_0xb814('0x42'))){_0x53e705['limit']=qs[_0xb814('0x2b')](_0x314600[_0xb814('0x3c')][_0xb814('0x2b')]);_0x53e705['offset']=qs[_0xb814('0x2a')](_0x314600[_0xb814('0x3c')][_0xb814('0x2a')]);}return _0x5bee4d['getDescriptions'](_0x53e705);}})[_0xb814('0x1b')](function(_0x2d0651){if(_0x2d0651){return _0x2d0651?{'count':_0x5470e4,'rows':_0x2d0651}:null;}})[_0xb814('0x1b')](respondWithResult(_0x8cb107,null))[_0xb814('0x26')](handleError(_0x8cb107,null));};exports[_0xb814('0x5e')]=function(_0x1ae8e8,_0x37a7ab,_0x472c38){var _0x37a8b1={};var _0x31d300={};var _0x52a6e3;var _0x2569a5;return db[_0xb814('0x38')]['findOne']({'where':{'id':_0x1ae8e8['params']['id']}})[_0xb814('0x1b')](handleEntityNotFound(_0x37a7ab,null))['then'](function(_0x320296){if(_0x320296){_0x52a6e3=_0x320296;_0x31d300[_0xb814('0x51')]=_[_0xb814('0x3a')](db[_0xb814('0x5f')][_0xb814('0x39')]);_0x31d300[_0xb814('0x3c')]=_[_0xb814('0x3a')](_0x1ae8e8['query']);_0x31d300['filters']=_[_0xb814('0x3e')](_0x31d300['model'],_0x31d300[_0xb814('0x3c')]);_0x37a8b1[_0xb814('0x3f')]=_[_0xb814('0x3e')](_0x31d300['model'],qs[_0xb814('0x40')](_0x1ae8e8[_0xb814('0x3c')][_0xb814('0x40')]));_0x37a8b1[_0xb814('0x3f')]=_0x37a8b1[_0xb814('0x3f')]['length']?_0x37a8b1[_0xb814('0x3f')]:_0x31d300[_0xb814('0x51')];_0x37a8b1['order']=qs[_0xb814('0x43')](_0x1ae8e8[_0xb814('0x3c')][_0xb814('0x43')]);_0x37a8b1['where']=qs[_0xb814('0x44')](_[_0xb814('0x5a')](_0x1ae8e8['query'],_0x31d300[_0xb814('0x44')]));if(_0x1ae8e8[_0xb814('0x3c')]['filter']){_0x37a8b1[_0xb814('0x48')]=_[_0xb814('0x47')](_0x37a8b1[_0xb814('0x48')],{'$or':_[_0xb814('0x4a')](_0x37a8b1[_0xb814('0x3f')],function(_0x2ee22e){var _0x40ae0b={};_0x40ae0b[_0x2ee22e]={'$like':'%'+_0x1ae8e8[_0xb814('0x3c')][_0xb814('0x49')]+'%'};return _0x40ae0b;})});}_0x37a8b1=_[_0xb814('0x47')]({},_0x37a8b1,_0x1ae8e8[_0xb814('0x4b')]);return _0x52a6e3[_0xb814('0x5e')](_0x37a8b1);}})['then'](function(_0x579deb){if(_0x579deb){_0x2569a5=_0x579deb[_0xb814('0x41')];if(!_0x1ae8e8['query']['hasOwnProperty'](_0xb814('0x42'))){_0x37a8b1['limit']=qs['limit'](_0x1ae8e8['query'][_0xb814('0x2b')]);_0x37a8b1[_0xb814('0x2a')]=qs[_0xb814('0x2a')](_0x1ae8e8['query'][_0xb814('0x2a')]);}return _0x52a6e3['getTags'](_0x37a8b1);}})[_0xb814('0x1b')](function(_0x2e6660){if(_0x2e6660){return _0x2e6660?{'count':_0x2569a5,'rows':_0x2e6660}:null;}})['then'](respondWithResult(_0x37a7ab,null))[_0xb814('0x26')](handleError(_0x37a7ab,null));};exports['setTags']=function(_0x2ac753,_0x2cfedd,_0x21d6e5){if(_0x2ac753[_0xb814('0x54')]['id']){delete _0x2ac753[_0xb814('0x54')]['id'];}return db[_0xb814('0x38')][_0xb814('0x57')]({'where':{'id':_0x2ac753[_0xb814('0x50')]['id']}})[_0xb814('0x1b')](handleEntityNotFound(_0x2cfedd,null))[_0xb814('0x1b')](function(_0x3df3e9){if(_0x3df3e9){return _0x3df3e9[_0xb814('0x60')](_0x2ac753[_0xb814('0x54')][_0xb814('0x61')]||[]);}return null;})[_0xb814('0x1b')](respondWithResult(_0x2cfedd,null))['catch'](handleError(_0x2cfedd,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index b5a93d3..b3d666e 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 _0xb62e=['../../config/logger','api','bluebird','request-promise','./intDeskConfiguration.attributes','exports','DeskConfiguration','int_desk_configurations','lodash','util'];(function(_0x1fbc5c,_0x3897e9){var _0x50a63d=function(_0x4665c4){while(--_0x4665c4){_0x1fbc5c['push'](_0x1fbc5c['shift']());}};_0x50a63d(++_0x3897e9);}(_0xb62e,0x1de));var _0xeb62=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb62e[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var logger=require(_0xeb62('0x2'))(_0xeb62('0x3'));var moment=require('moment');var BPromise=require(_0xeb62('0x4'));var rp=require(_0xeb62('0x5'));var attributes=require(_0xeb62('0x6'));module[_0xeb62('0x7')]=function(_0x3c7ad5,_0x1ebdbb){return _0x3c7ad5['define'](_0xeb62('0x8'),attributes,{'tableName':_0xeb62('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4f4=['moment','bluebird','request-promise','./intDeskConfiguration.attributes','define','DeskConfiguration','int_desk_configurations','lodash','util','api'];(function(_0x5f3562,_0x212f41){var _0x1b39b4=function(_0x153e49){while(--_0x153e49){_0x5f3562['push'](_0x5f3562['shift']());}};_0x1b39b4(++_0x212f41);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x5afcbc,_0x98df37){_0x5afcbc=_0x5afcbc-0x0;var _0x469714=_0xf4f4[_0x5afcbc];return _0x469714;};'use strict';var _=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var logger=require('../../config/logger')(_0x4f4f('0x2'));var moment=require(_0x4f4f('0x3'));var BPromise=require(_0x4f4f('0x4'));var rp=require(_0x4f4f('0x5'));var attributes=require(_0x4f4f('0x6'));module['exports']=function(_0x5a752b,_0x593952){return _0x5a752b[_0x4f4f('0x7')](_0x4f4f('0x8'),attributes,{'tableName':_0x4f4f('0x9'),'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 5d152ea..c86b863 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 _0x9c5a=['http','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x32672a,_0x32ad0a){var _0x5c987b=function(_0x54f7cc){while(--_0x54f7cc){_0x32672a['push'](_0x32672a['shift']());}};_0x5c987b(++_0x32ad0a);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x2e5baf,_0x5be7e5){_0x2e5baf=_0x2e5baf-0x0;var _0x5fa5ad=_0x9c5a[_0x2e5baf];return _0x5fa5ad;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var moment=require('moment');var BPromise=require(_0xa9c5('0x2'));var rs=require(_0xa9c5('0x3'));var fs=require('fs');var Redis=require(_0xa9c5('0x4'));var db=require(_0xa9c5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa9c5('0x6'))(_0xa9c5('0x7'));var config=require('../../config/environment');var jayson=require(_0xa9c5('0x8'));var client=jayson['client'][_0xa9c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3df556,_0x4cb597,_0x4b6db6){return new BPromise(function(_0x3d6b50,_0x16f331){return client['request'](_0x3df556,_0x4b6db6)[_0xa9c5('0xa')](function(_0x97f9e2){logger['info'](_0xa9c5('0xb'),_0x4cb597,_0xa9c5('0xc'));logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4cb597,_0xa9c5('0xc'),JSON[_0xa9c5('0xd')](_0x97f9e2));if(_0x97f9e2[_0xa9c5('0xe')]){if(_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0xf')]===0x1f4){logger[_0xa9c5('0xe')](_0xa9c5('0xb'),_0x4cb597,_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);return _0x16f331(_0x97f9e2[_0xa9c5('0xe')]['message']);}logger[_0xa9c5('0xe')](_0xa9c5('0xb'),_0x4cb597,_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);return _0x3d6b50(_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);}else{logger[_0xa9c5('0x11')](_0xa9c5('0xb'),_0x4cb597,_0xa9c5('0xc'));_0x3d6b50(_0x97f9e2[_0xa9c5('0x12')]['message']);}})[_0xa9c5('0x13')](function(_0xd85c32){logger[_0xa9c5('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x4cb597,_0xd85c32);_0x16f331(_0xd85c32);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x5a7783,_0x41529c){var _0x4b43d1=function(_0x173611){while(--_0x173611){_0x5a7783['push'](_0x5a7783['shift']());}};_0x4b43d1(++_0x41529c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc4aa[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 81e5874..f6000dd 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 _0xbe39=['get','/:id','isAuthenticated','show','put','update','delete','destroy','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xbe39,0x80));var _0x9be3=function(_0x365251,_0x30efc7){_0x365251=_0x365251-0x0;var _0x4c9e29=_0xbe39[_0x365251];return _0x4c9e29;};'use strict';var multer=require(_0x9be3('0x0'));var util=require(_0x9be3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9be3('0x2'));var router=express['Router']();var auth=require(_0x9be3('0x3'));var interaction=require(_0x9be3('0x4'));var config=require(_0x9be3('0x5'));var controller=require(_0x9be3('0x6'));router[_0x9be3('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9be3('0x7')](_0x9be3('0x8'),auth[_0x9be3('0x9')](),controller[_0x9be3('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x9be3('0xb')](_0x9be3('0x8'),auth[_0x9be3('0x9')](),controller[_0x9be3('0xc')]);router[_0x9be3('0xd')](_0x9be3('0x8'),auth[_0x9be3('0x9')](),controller[_0x9be3('0xe')]);module['exports']=router; \ No newline at end of file +var _0xd4d3=['create','delete','destroy','exports','multer','util','connect-timeout','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','/:id','post'];(function(_0x2ae529,_0x2f7071){var _0x5e9735=function(_0x4413b0){while(--_0x4413b0){_0x2ae529['push'](_0x2ae529['shift']());}};_0x5e9735(++_0x2f7071);}(_0xd4d3,0x1d2));var _0x3d4d=function(_0x4d02ad,_0x402e44){_0x4d02ad=_0x4d02ad-0x0;var _0x4acb98=_0xd4d3[_0x4d02ad];return _0x4acb98;};'use strict';var multer=require(_0x3d4d('0x0'));var util=require(_0x3d4d('0x1'));var path=require('path');var timeout=require(_0x3d4d('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3d4d('0x3'));var config=require(_0x3d4d('0x4'));var controller=require(_0x3d4d('0x5'));router[_0x3d4d('0x6')]('/',auth[_0x3d4d('0x7')](),controller['index']);router[_0x3d4d('0x6')](_0x3d4d('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x3d4d('0x9')]('/',auth[_0x3d4d('0x7')](),controller[_0x3d4d('0xa')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x3d4d('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x3d4d('0xc')]);module[_0x3d4d('0xd')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index d94a061..5a31c6a 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 _0xa75b=['customVariable','keyValue','STRING','ENUM','sequelize','string','variable'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xa75b,0x170));var _0xba75=function(_0x1a3527,_0x20738b){_0x1a3527=_0x1a3527-0x0;var _0x2ea121=_0xa75b[_0x1a3527];return _0x2ea121;};'use strict';var Sequelize=require(_0xba75('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xba75('0x1'),_0xba75('0x2'),_0xba75('0x3'),_0xba75('0x4')),'defaultValue':_0xba75('0x1')},'content':{'type':Sequelize[_0xba75('0x5')]},'key':{'type':Sequelize[_0xba75('0x5')]},'keyType':{'type':Sequelize[_0xba75('0x6')](_0xba75('0x1'),_0xba75('0x2'),_0xba75('0x3'))},'keyContent':{'type':Sequelize[_0xba75('0x5')]},'idField':{'type':Sequelize[_0xba75('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xba75('0x5')]}}; \ No newline at end of file +var _0xb688=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','exports'];(function(_0x3ed7ff,_0x1b6657){var _0x1471b6=function(_0x122827){while(--_0x122827){_0x3ed7ff['push'](_0x3ed7ff['shift']());}};_0x1471b6(++_0x1b6657);}(_0xb688,0xcf));var _0x8b68=function(_0x470cbf,_0x4ab23a){_0x470cbf=_0x470cbf-0x0;var _0x3ba35c=_0xb688[_0x470cbf];return _0x3ba35c;};'use strict';var Sequelize=require('sequelize');module[_0x8b68('0x0')]={'type':{'type':Sequelize[_0x8b68('0x1')](_0x8b68('0x2'),_0x8b68('0x3'),_0x8b68('0x4'),_0x8b68('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x8b68('0x6')]},'key':{'type':Sequelize[_0x8b68('0x6')]},'keyType':{'type':Sequelize[_0x8b68('0x1')](_0x8b68('0x2'),'variable',_0x8b68('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8b68('0x6')]},'nameField':{'type':Sequelize[_0x8b68('0x6')]},'customField':{'type':Sequelize[_0x8b68('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8b68('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 962f5ed..f82a2c3 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 _0x76d2=['end','json','count','limit','Content-Range','reject','save','update','destroy','then','stack','name','send','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','offset','sort','where','pick','day','add','merge','filter','options','DeskField','includeAll','include','rows','catch','show','params','length','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','sendStatus','status'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x76d2,0xf8));var _0x276d=function(_0x1d4410,_0x16424c){_0x1d4410=_0x1d4410-0x0;var _0x1fcea9=_0x76d2[_0x1d4410];return _0x1fcea9;};'use strict';var pdf=require(_0x276d('0x0'));var emlformat=require(_0x276d('0x1'));var rimraf=require(_0x276d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x276d('0x3'));var rp=require(_0x276d('0x4'));var moment=require(_0x276d('0x5'));var BPromise=require(_0x276d('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x276d('0x7'));var sox=require(_0x276d('0x8'));var csv=require(_0x276d('0x9'));var ejs=require(_0x276d('0xa'));var fs=require('fs');var _=require(_0x276d('0xb'));var squel=require(_0x276d('0xc'));var crypto=require(_0x276d('0xd'));var jsforce=require(_0x276d('0xe'));var deskjs=require(_0x276d('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x276d('0x10'));var Redis=require(_0x276d('0x11'));var qs=require(_0x276d('0x12'));var logger=require(_0x276d('0x13'))(_0x276d('0x14'));var utils=require(_0x276d('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcdcf61,_0x2acfae){_0x2acfae=_0x2acfae||0xcc;return function(_0x2971d1){if(_0x2971d1){return _0xcdcf61[_0x276d('0x16')](_0x2acfae);}return _0xcdcf61[_0x276d('0x17')](_0x2acfae)[_0x276d('0x18')]();};}function respondWithResult(_0x4b9f5f,_0x52a319){_0x52a319=_0x52a319||0xc8;return function(_0x377bfe){if(_0x377bfe){return _0x4b9f5f[_0x276d('0x17')](_0x52a319)[_0x276d('0x19')](_0x377bfe);}};}function respondWithFilteredResult(_0x377540,_0x3166a2){return function(_0x276c25){if(_0x276c25){var _0x44f123=_0x276c25[_0x276d('0x1a')],_0x2c309f=_0x3166a2['offset'],_0x5b23b7=_0x3166a2['offset']+_0x3166a2[_0x276d('0x1b')],_0x2165c6;if(_0x5b23b7>=_0x44f123){_0x5b23b7=_0x44f123;_0x2165c6=0xc8;}else{_0x2165c6=0xce;}_0x377540[_0x276d('0x17')](_0x2165c6);return _0x377540['set'](_0x276d('0x1c'),_0x2c309f+'-'+_0x5b23b7+'/'+_0x44f123)['json'](_0x276c25);}return null;};}function patchUpdates(_0x501b7b){return function(_0xb75b36){try{jsonpatch['apply'](_0xb75b36,_0x501b7b,!![]);}catch(_0x413fe6){return BPromise[_0x276d('0x1d')](_0x413fe6);}return _0xb75b36[_0x276d('0x1e')]();};}function saveUpdates(_0x11d8d8,_0x5d2ad5){return function(_0x44798f){if(_0x44798f){return _0x44798f[_0x276d('0x1f')](_0x11d8d8)['then'](function(_0x5e8fee){return _0x5e8fee;});}return null;};}function removeEntity(_0x45709d,_0xead902){return function(_0x53e20e){if(_0x53e20e){return _0x53e20e[_0x276d('0x20')]()[_0x276d('0x21')](function(){_0x45709d['status'](0xcc)[_0x276d('0x18')]();});}};}function handleEntityNotFound(_0x5c6d44,_0xf0e0fb){return function(_0x152195){if(!_0x152195){_0x5c6d44['sendStatus'](0x194);}return _0x152195;};}function handleError(_0x476671,_0x3edb3b){_0x3edb3b=_0x3edb3b||0x1f4;return function(_0x58ea98){logger['error'](_0x58ea98[_0x276d('0x22')]);if(_0x58ea98[_0x276d('0x23')]){delete _0x58ea98[_0x276d('0x23')];}_0x476671[_0x276d('0x17')](_0x3edb3b)[_0x276d('0x24')](_0x58ea98);};}exports['index']=function(_0x40952b,_0x4b517f){var _0xc8b1cc={},_0x1f85d9={},_0x54c37c={'count':0x0,'rows':[]};var _0xaa77c7=db['DeskField']['rawAttributes'];_0x1f85d9['model']=_[_0x276d('0x25')](_0xaa77c7);var _0x3226f5={'dateStart':_0x40952b[_0x276d('0x26')][_0x276d('0x27')],'dateEnd':_0x40952b['query'][_0x276d('0x28')]};delete _0x40952b[_0x276d('0x26')][_0x276d('0x27')];delete _0x40952b[_0x276d('0x26')][_0x276d('0x28')];_0x1f85d9[_0x276d('0x26')]=_[_0x276d('0x25')](_0x40952b['query']);_0x1f85d9[_0x276d('0x29')]=_[_0x276d('0x2a')](_0x1f85d9[_0x276d('0x2b')],_0x1f85d9[_0x276d('0x26')]);_0xc8b1cc[_0x276d('0x2c')]=_[_0x276d('0x2a')](_0x1f85d9[_0x276d('0x2b')],qs['fields'](_0x40952b[_0x276d('0x26')][_0x276d('0x2d')]));_0xc8b1cc[_0x276d('0x2c')]=_0xc8b1cc[_0x276d('0x2c')]['length']?_0xc8b1cc[_0x276d('0x2c')]:_0x1f85d9['model'];if(!_0x40952b[_0x276d('0x26')][_0x276d('0x2e')](_0x276d('0x2f'))){_0xc8b1cc[_0x276d('0x1b')]=qs[_0x276d('0x1b')](_0x40952b[_0x276d('0x26')][_0x276d('0x1b')]);_0xc8b1cc[_0x276d('0x30')]=qs['offset'](_0x40952b['query'][_0x276d('0x30')]);}_0xc8b1cc['order']=qs[_0x276d('0x31')](_0x40952b[_0x276d('0x26')][_0x276d('0x31')]);_0xc8b1cc[_0x276d('0x32')]=qs[_0x276d('0x29')](_[_0x276d('0x33')](_0x40952b[_0x276d('0x26')],_0x1f85d9['filters']));if(_0x3226f5['dateStart']){if(_0x3226f5[_0x276d('0x28')]){_0x3226f5[_0x276d('0x28')]=moment(_0x3226f5['dateEnd'])['add'](0x1,_0x276d('0x34'));}else{_0x3226f5[_0x276d('0x28')]=moment(_0x3226f5['dateStart'])[_0x276d('0x35')](0x1,_0x276d('0x34'));}_[_0x276d('0x36')](_0xc8b1cc[_0x276d('0x32')],{'createdAt':{'$gte':_0x3226f5[_0x276d('0x27')],'$lte':_0x3226f5[_0x276d('0x28')]}});}if(_0x40952b['query'][_0x276d('0x37')]){_0xc8b1cc[_0x276d('0x32')]=_['merge'](_0xc8b1cc['where'],{'$or':_['map'](_0xc8b1cc[_0x276d('0x2c')],function(_0x4b9c99){var _0x4b2b73={};_0x4b2b73[_0x4b9c99]={'$like':'%'+_0x40952b['query'][_0x276d('0x37')]+'%'};return _0x4b2b73;})});}_0xc8b1cc=_[_0x276d('0x36')]({},_0xc8b1cc,_0x40952b[_0x276d('0x38')]);var _0x12ce4a={'where':_0xc8b1cc[_0x276d('0x32')]};return db[_0x276d('0x39')][_0x276d('0x1a')](_0x12ce4a)[_0x276d('0x21')](function(_0x2677c8){_0x54c37c[_0x276d('0x1a')]=_0x2677c8;if(_0x40952b[_0x276d('0x26')][_0x276d('0x3a')]){_0xc8b1cc[_0x276d('0x3b')]=[{'all':!![]}];}return db[_0x276d('0x39')]['findAll'](_0xc8b1cc);})[_0x276d('0x21')](function(_0x349563){_0x54c37c[_0x276d('0x3c')]=_0x349563;return _0x54c37c;})[_0x276d('0x21')](respondWithFilteredResult(_0x4b517f,_0xc8b1cc))[_0x276d('0x3d')](handleError(_0x4b517f,null));};exports[_0x276d('0x3e')]=function(_0x37fd0d,_0x3136f6){var _0x270106={'raw':!![],'where':{'id':_0x37fd0d[_0x276d('0x3f')]['id']}},_0x5d780e={};_0x5d780e[_0x276d('0x2b')]=_[_0x276d('0x25')](db[_0x276d('0x39')]['rawAttributes']);_0x5d780e[_0x276d('0x26')]=_[_0x276d('0x25')](_0x37fd0d[_0x276d('0x26')]);_0x5d780e[_0x276d('0x29')]=_[_0x276d('0x2a')](_0x5d780e[_0x276d('0x2b')],_0x5d780e['query']);_0x270106[_0x276d('0x2c')]=_['intersection'](_0x5d780e[_0x276d('0x2b')],qs[_0x276d('0x2d')](_0x37fd0d['query'][_0x276d('0x2d')]));_0x270106[_0x276d('0x2c')]=_0x270106['attributes'][_0x276d('0x40')]?_0x270106[_0x276d('0x2c')]:_0x5d780e['model'];if(_0x37fd0d[_0x276d('0x26')][_0x276d('0x3a')]){_0x270106[_0x276d('0x3b')]=[{'all':!![]}];}_0x270106=_[_0x276d('0x36')]({},_0x270106,_0x37fd0d[_0x276d('0x38')]);return db['DeskField'][_0x276d('0x41')](_0x270106)[_0x276d('0x21')](handleEntityNotFound(_0x3136f6,null))[_0x276d('0x21')](respondWithResult(_0x3136f6,null))['catch'](handleError(_0x3136f6,null));};exports[_0x276d('0x42')]=function(_0x1bfda0,_0x32f855){return db['DeskField'][_0x276d('0x42')](_0x1bfda0[_0x276d('0x43')],{})[_0x276d('0x21')](respondWithResult(_0x32f855,0xc9))[_0x276d('0x3d')](handleError(_0x32f855,null));};exports['update']=function(_0x5aa12d,_0x44f825){if(_0x5aa12d[_0x276d('0x43')]['id']){delete _0x5aa12d[_0x276d('0x43')]['id'];}return db[_0x276d('0x39')]['find']({'where':{'id':_0x5aa12d[_0x276d('0x3f')]['id']}})['then'](handleEntityNotFound(_0x44f825,null))['then'](saveUpdates(_0x5aa12d['body'],null))[_0x276d('0x21')](respondWithResult(_0x44f825,null))[_0x276d('0x3d')](handleError(_0x44f825,null));};exports[_0x276d('0x20')]=function(_0x260e93,_0x50c710){return db['DeskField']['find']({'where':{'id':_0x260e93[_0x276d('0x3f')]['id']}})[_0x276d('0x21')](handleEntityNotFound(_0x50c710,null))[_0x276d('0x21')](removeEntity(_0x50c710,null))[_0x276d('0x3d')](handleError(_0x50c710,null));}; \ No newline at end of file +var _0x594d=['intersection','include','find','create','body','update','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','limit','apply','reject','then','destroy','error','name','send','index','DeskField','rawAttributes','model','keys','query','dateStart','dateEnd','attributes','fields','length','nolimit','offset','order','sort','where','filters','pick','add','day','merge','filter','map','options','includeAll','findAll','rows','catch','show','params'];(function(_0x542793,_0x135624){var _0x21be7c=function(_0x8ee5f2){while(--_0x8ee5f2){_0x542793['push'](_0x542793['shift']());}};_0x21be7c(++_0x135624);}(_0x594d,0x92));var _0xd594=function(_0x560905,_0x5754c3){_0x560905=_0x560905-0x0;var _0x928ddf=_0x594d[_0x560905];return _0x928ddf;};'use strict';var pdf=require(_0xd594('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd594('0x1'));var jsonpatch=require(_0xd594('0x2'));var rp=require(_0xd594('0x3'));var moment=require('moment');var BPromise=require(_0xd594('0x4'));var Mustache=require(_0xd594('0x5'));var util=require(_0xd594('0x6'));var path=require(_0xd594('0x7'));var sox=require('sox');var csv=require(_0xd594('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd594('0x9'));var squel=require(_0xd594('0xa'));var crypto=require(_0xd594('0xb'));var jsforce=require(_0xd594('0xc'));var deskjs=require(_0xd594('0xd'));var toCsv=require(_0xd594('0x8'));var querystring=require(_0xd594('0xe'));var Papa=require(_0xd594('0xf'));var Redis=require(_0xd594('0x10'));var qs=require(_0xd594('0x11'));var logger=require('../../config/logger')(_0xd594('0x12'));var utils=require(_0xd594('0x13'));var config=require(_0xd594('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xeba835,_0xcc753d){_0xcc753d=_0xcc753d||0xcc;return function(_0x645835){if(_0x645835){return _0xeba835[_0xd594('0x15')](_0xcc753d);}return _0xeba835[_0xd594('0x16')](_0xcc753d)[_0xd594('0x17')]();};}function respondWithResult(_0x1aa88a,_0x551131){_0x551131=_0x551131||0xc8;return function(_0x51c339){if(_0x51c339){return _0x1aa88a[_0xd594('0x16')](_0x551131)[_0xd594('0x18')](_0x51c339);}};}function respondWithFilteredResult(_0x5ced58,_0x8da9ac){return function(_0x4d54d0){if(_0x4d54d0){var _0x470234=_0x4d54d0[_0xd594('0x19')],_0x21673c=_0x8da9ac['offset'],_0x14ea68=_0x8da9ac['offset']+_0x8da9ac[_0xd594('0x1a')],_0x4cb9ec;if(_0x14ea68>=_0x470234){_0x14ea68=_0x470234;_0x4cb9ec=0xc8;}else{_0x4cb9ec=0xce;}_0x5ced58[_0xd594('0x16')](_0x4cb9ec);return _0x5ced58['set']('Content-Range',_0x21673c+'-'+_0x14ea68+'/'+_0x470234)[_0xd594('0x18')](_0x4d54d0);}return null;};}function patchUpdates(_0x4ea0d5){return function(_0x54f640){try{jsonpatch[_0xd594('0x1b')](_0x54f640,_0x4ea0d5,!![]);}catch(_0x559962){return BPromise[_0xd594('0x1c')](_0x559962);}return _0x54f640['save']();};}function saveUpdates(_0x4003be,_0x4fa2c7){return function(_0x10585c){if(_0x10585c){return _0x10585c['update'](_0x4003be)[_0xd594('0x1d')](function(_0x55f83b){return _0x55f83b;});}return null;};}function removeEntity(_0x2cd721,_0x21eba5){return function(_0x1fce47){if(_0x1fce47){return _0x1fce47[_0xd594('0x1e')]()[_0xd594('0x1d')](function(){_0x2cd721[_0xd594('0x16')](0xcc)[_0xd594('0x17')]();});}};}function handleEntityNotFound(_0x15ece9,_0x28d586){return function(_0xf73000){if(!_0xf73000){_0x15ece9[_0xd594('0x15')](0x194);}return _0xf73000;};}function handleError(_0x3d83ce,_0x769cae){_0x769cae=_0x769cae||0x1f4;return function(_0x3a6a4e){logger[_0xd594('0x1f')](_0x3a6a4e['stack']);if(_0x3a6a4e[_0xd594('0x20')]){delete _0x3a6a4e[_0xd594('0x20')];}_0x3d83ce[_0xd594('0x16')](_0x769cae)[_0xd594('0x21')](_0x3a6a4e);};}exports[_0xd594('0x22')]=function(_0x40f87e,_0xc4a0f){var _0x3b9844={},_0x308d8a={},_0x578f6b={'count':0x0,'rows':[]};var _0x382f3a=db[_0xd594('0x23')][_0xd594('0x24')];_0x308d8a[_0xd594('0x25')]=_[_0xd594('0x26')](_0x382f3a);var _0x3ff7d8={'dateStart':_0x40f87e[_0xd594('0x27')][_0xd594('0x28')],'dateEnd':_0x40f87e[_0xd594('0x27')][_0xd594('0x29')]};delete _0x40f87e[_0xd594('0x27')][_0xd594('0x28')];delete _0x40f87e[_0xd594('0x27')][_0xd594('0x29')];_0x308d8a[_0xd594('0x27')]=_[_0xd594('0x26')](_0x40f87e[_0xd594('0x27')]);_0x308d8a['filters']=_['intersection'](_0x308d8a['model'],_0x308d8a[_0xd594('0x27')]);_0x3b9844[_0xd594('0x2a')]=_['intersection'](_0x308d8a['model'],qs[_0xd594('0x2b')](_0x40f87e['query']['fields']));_0x3b9844[_0xd594('0x2a')]=_0x3b9844[_0xd594('0x2a')][_0xd594('0x2c')]?_0x3b9844[_0xd594('0x2a')]:_0x308d8a[_0xd594('0x25')];if(!_0x40f87e[_0xd594('0x27')]['hasOwnProperty'](_0xd594('0x2d'))){_0x3b9844[_0xd594('0x1a')]=qs['limit'](_0x40f87e[_0xd594('0x27')][_0xd594('0x1a')]);_0x3b9844[_0xd594('0x2e')]=qs[_0xd594('0x2e')](_0x40f87e[_0xd594('0x27')][_0xd594('0x2e')]);}_0x3b9844[_0xd594('0x2f')]=qs[_0xd594('0x30')](_0x40f87e[_0xd594('0x27')][_0xd594('0x30')]);_0x3b9844[_0xd594('0x31')]=qs[_0xd594('0x32')](_[_0xd594('0x33')](_0x40f87e[_0xd594('0x27')],_0x308d8a[_0xd594('0x32')]));if(_0x3ff7d8[_0xd594('0x28')]){if(_0x3ff7d8[_0xd594('0x29')]){_0x3ff7d8[_0xd594('0x29')]=moment(_0x3ff7d8['dateEnd'])[_0xd594('0x34')](0x1,_0xd594('0x35'));}else{_0x3ff7d8['dateEnd']=moment(_0x3ff7d8[_0xd594('0x28')])[_0xd594('0x34')](0x1,_0xd594('0x35'));}_[_0xd594('0x36')](_0x3b9844[_0xd594('0x31')],{'createdAt':{'$gte':_0x3ff7d8['dateStart'],'$lte':_0x3ff7d8[_0xd594('0x29')]}});}if(_0x40f87e[_0xd594('0x27')][_0xd594('0x37')]){_0x3b9844[_0xd594('0x31')]=_['merge'](_0x3b9844[_0xd594('0x31')],{'$or':_[_0xd594('0x38')](_0x3b9844['attributes'],function(_0x297449){var _0x3bd57c={};_0x3bd57c[_0x297449]={'$like':'%'+_0x40f87e['query']['filter']+'%'};return _0x3bd57c;})});}_0x3b9844=_[_0xd594('0x36')]({},_0x3b9844,_0x40f87e[_0xd594('0x39')]);var _0xabbf19={'where':_0x3b9844[_0xd594('0x31')]};return db[_0xd594('0x23')][_0xd594('0x19')](_0xabbf19)['then'](function(_0x3b352e){_0x578f6b[_0xd594('0x19')]=_0x3b352e;if(_0x40f87e[_0xd594('0x27')][_0xd594('0x3a')]){_0x3b9844['include']=[{'all':!![]}];}return db[_0xd594('0x23')][_0xd594('0x3b')](_0x3b9844);})[_0xd594('0x1d')](function(_0x26af67){_0x578f6b[_0xd594('0x3c')]=_0x26af67;return _0x578f6b;})[_0xd594('0x1d')](respondWithFilteredResult(_0xc4a0f,_0x3b9844))[_0xd594('0x3d')](handleError(_0xc4a0f,null));};exports[_0xd594('0x3e')]=function(_0x5b784d,_0x4cdd36){var _0x5c06cc={'raw':!![],'where':{'id':_0x5b784d[_0xd594('0x3f')]['id']}},_0x32c7dc={};_0x32c7dc[_0xd594('0x25')]=_[_0xd594('0x26')](db['DeskField'][_0xd594('0x24')]);_0x32c7dc[_0xd594('0x27')]=_[_0xd594('0x26')](_0x5b784d[_0xd594('0x27')]);_0x32c7dc[_0xd594('0x32')]=_['intersection'](_0x32c7dc[_0xd594('0x25')],_0x32c7dc[_0xd594('0x27')]);_0x5c06cc['attributes']=_[_0xd594('0x40')](_0x32c7dc[_0xd594('0x25')],qs[_0xd594('0x2b')](_0x5b784d[_0xd594('0x27')]['fields']));_0x5c06cc[_0xd594('0x2a')]=_0x5c06cc[_0xd594('0x2a')][_0xd594('0x2c')]?_0x5c06cc[_0xd594('0x2a')]:_0x32c7dc[_0xd594('0x25')];if(_0x5b784d[_0xd594('0x27')][_0xd594('0x3a')]){_0x5c06cc[_0xd594('0x41')]=[{'all':!![]}];}_0x5c06cc=_['merge']({},_0x5c06cc,_0x5b784d[_0xd594('0x39')]);return db[_0xd594('0x23')][_0xd594('0x42')](_0x5c06cc)[_0xd594('0x1d')](handleEntityNotFound(_0x4cdd36,null))[_0xd594('0x1d')](respondWithResult(_0x4cdd36,null))['catch'](handleError(_0x4cdd36,null));};exports[_0xd594('0x43')]=function(_0x15f50e,_0x224ce3){return db['DeskField'][_0xd594('0x43')](_0x15f50e[_0xd594('0x44')],{})[_0xd594('0x1d')](respondWithResult(_0x224ce3,0xc9))[_0xd594('0x3d')](handleError(_0x224ce3,null));};exports[_0xd594('0x45')]=function(_0x407e21,_0x3ef2ba){if(_0x407e21['body']['id']){delete _0x407e21[_0xd594('0x44')]['id'];}return db['DeskField'][_0xd594('0x42')]({'where':{'id':_0x407e21[_0xd594('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3ef2ba,null))[_0xd594('0x1d')](saveUpdates(_0x407e21[_0xd594('0x44')],null))[_0xd594('0x1d')](respondWithResult(_0x3ef2ba,null))[_0xd594('0x3d')](handleError(_0x3ef2ba,null));};exports[_0xd594('0x1e')]=function(_0x6636f8,_0x5ba528){return db[_0xd594('0x23')][_0xd594('0x42')]({'where':{'id':_0x6636f8['params']['id']}})[_0xd594('0x1d')](handleEntityNotFound(_0x5ba528,null))['then'](removeEntity(_0x5ba528,null))[_0xd594('0x3d')](handleError(_0x5ba528,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 6402ea0..24a6edb 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 _0x9b9b=['request-promise','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','util','moment','bluebird'];(function(_0x4c2dfc,_0x4814c0){var _0xfd728d=function(_0x5b8d81){while(--_0x5b8d81){_0x4c2dfc['push'](_0x4c2dfc['shift']());}};_0xfd728d(++_0x4814c0);}(_0x9b9b,0x114));var _0xb9b9=function(_0x7f0a18,_0x3ccd89){_0x7f0a18=_0x7f0a18-0x0;var _0x348d54=_0x9b9b[_0x7f0a18];return _0x348d54;};'use strict';var _=require('lodash');var util=require(_0xb9b9('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb9b9('0x1'));var BPromise=require(_0xb9b9('0x2'));var rp=require(_0xb9b9('0x3'));var attributes=require(_0xb9b9('0x4'));module[_0xb9b9('0x5')]=function(_0x43c8ff,_0x23b016){return _0x43c8ff[_0xb9b9('0x6')](_0xb9b9('0x7'),attributes,{'tableName':_0xb9b9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb458=['./intDeskField.attributes','exports','int_desk_fields','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0xf04fcc,_0xdfae7d){var _0x3ef60f=function(_0x1b0e7d){while(--_0x1b0e7d){_0xf04fcc['push'](_0xf04fcc['shift']());}};_0x3ef60f(++_0xdfae7d);}(_0xb458,0x103));var _0x8b45=function(_0x3b0675,_0x17502a){_0x3b0675=_0x3b0675-0x0;var _0x11b775=_0xb458[_0x3b0675];return _0x11b775;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var logger=require(_0x8b45('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8b45('0x3'));var rp=require(_0x8b45('0x4'));var attributes=require(_0x8b45('0x5'));module[_0x8b45('0x6')]=function(_0x5d51e4,_0x333bc7){return _0x5d51e4['define']('DeskField',attributes,{'tableName':_0x8b45('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 6bfea5b..7a854f9 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 _0x84ab=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','DeskField,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x9c5775,_0x5d3504){var _0x5094f7=function(_0x2b3e04){while(--_0x2b3e04){_0x9c5775['push'](_0x9c5775['shift']());}};_0x5094f7(++_0x5d3504);}(_0x84ab,0x12f));var _0xb84a=function(_0x34933a,_0x327378){_0x34933a=_0x34933a-0x0;var _0x36abb4=_0x84ab[_0x34933a];return _0x36abb4;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var moment=require(_0xb84a('0x2'));var BPromise=require(_0xb84a('0x3'));var rs=require(_0xb84a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb84a('0x5'))['db'];var utils=require(_0xb84a('0x6'));var logger=require('../../config/logger')(_0xb84a('0x7'));var config=require(_0xb84a('0x8'));var jayson=require(_0xb84a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4dc496,_0xd445b5,_0x4fac4d){return new BPromise(function(_0x3e9086,_0x8d9dbe){return client['request'](_0x4dc496,_0x4fac4d)[_0xb84a('0xa')](function(_0x525cb7){logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,_0xb84a('0xd'));logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0xd445b5,'request\x20sent',JSON[_0xb84a('0xe')](_0x525cb7));if(_0x525cb7[_0xb84a('0xf')]){if(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x10')]===0x1f4){logger[_0xb84a('0xf')]('DeskField,\x20%s,\x20%s',_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x8d9dbe(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x3e9086(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}else{logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,'request\x20sent');_0x3e9086(_0x525cb7[_0xb84a('0x12')][_0xb84a('0x11')]);}})[_0xb84a('0x13')](function(_0x3c0b54){logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x3c0b54);_0x8d9dbe(_0x3c0b54);});});} \ No newline at end of file +var _0x55e0=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x55e0,0xdc));var _0x055e=function(_0xd04b50,_0x3d635d){_0xd04b50=_0xd04b50-0x0;var _0x5de236=_0x55e0[_0xd04b50];return _0x5de236;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var moment=require(_0x055e('0x2'));var BPromise=require(_0x055e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x055e('0x4'))['db'];var utils=require(_0x055e('0x5'));var logger=require(_0x055e('0x6'))(_0x055e('0x7'));var config=require(_0x055e('0x8'));var jayson=require(_0x055e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4384ff,_0x4a442e,_0x8e7824){return new BPromise(function(_0x3c4cf,_0x376618){return client[_0x055e('0xa')](_0x4384ff,_0x8e7824)[_0x055e('0xb')](function(_0x49540c){logger[_0x055e('0xc')](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));logger[_0x055e('0xf')](_0x055e('0x10'),_0x4a442e,'request\x20sent',JSON['stringify'](_0x49540c));if(_0x49540c[_0x055e('0x11')]){if(_0x49540c['error'][_0x055e('0x12')]===0x1f4){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x376618(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}logger['error'](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x3c4cf(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}else{logger['info'](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));_0x3c4cf(_0x49540c[_0x055e('0x14')]['message']);}})[_0x055e('0x15')](function(_0x2c377c){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x2c377c);_0x376618(_0x2c377c);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index a47a0cf..da9e0bc 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 _0x4324=['multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','post','create','addConfiguration','put','update','delete','destroy','exports'];(function(_0x360ffa,_0x1d9a6b){var _0x4395d5=function(_0x5653cd){while(--_0x5653cd){_0x360ffa['push'](_0x360ffa['shift']());}};_0x4395d5(++_0x1d9a6b);}(_0x4324,0xdc));var _0x4432=function(_0x1505e5,_0x5cc291){_0x1505e5=_0x1505e5-0x0;var _0x5b1dcd=_0x4324[_0x1505e5];return _0x5b1dcd;};'use strict';var multer=require(_0x4432('0x0'));var util=require(_0x4432('0x1'));var path=require(_0x4432('0x2'));var timeout=require('connect-timeout');var express=require(_0x4432('0x3'));var router=express['Router']();var auth=require(_0x4432('0x4'));var interaction=require(_0x4432('0x5'));var config=require(_0x4432('0x6'));var controller=require('./intFreshdeskAccount.controller');router[_0x4432('0x7')]('/',auth[_0x4432('0x8')](),controller[_0x4432('0x9')]);router[_0x4432('0x7')](_0x4432('0xa'),auth[_0x4432('0x8')](),controller[_0x4432('0xb')]);router[_0x4432('0x7')](_0x4432('0xc'),auth[_0x4432('0x8')](),controller[_0x4432('0xd')]);router[_0x4432('0x7')]('/:id/fields',auth[_0x4432('0x8')](),controller['getFields']);router[_0x4432('0xe')]('/',auth[_0x4432('0x8')](),controller[_0x4432('0xf')]);router[_0x4432('0xe')](_0x4432('0xc'),auth['isAuthenticated'](),controller[_0x4432('0x10')]);router[_0x4432('0x11')](_0x4432('0xa'),auth['isAuthenticated'](),controller[_0x4432('0x12')]);router[_0x4432('0x13')](_0x4432('0xa'),auth[_0x4432('0x8')](),controller[_0x4432('0x14')]);module[_0x4432('0x15')]=router; \ No newline at end of file +var _0x021a=['delete','destroy','exports','multer','util','path','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','show','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','/:id','update'];(function(_0x32d679,_0x4c4daa){var _0x5a4ea1=function(_0x39738d){while(--_0x39738d){_0x32d679['push'](_0x32d679['shift']());}};_0x5a4ea1(++_0x4c4daa);}(_0x021a,0xdf));var _0xa021=function(_0x1569fc,_0x115095){_0x1569fc=_0x1569fc-0x0;var _0x277783=_0x021a[_0x1569fc];return _0x277783;};'use strict';var multer=require(_0xa021('0x0'));var util=require(_0xa021('0x1'));var path=require(_0xa021('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xa021('0x3'));var config=require('../../config/environment');var controller=require(_0xa021('0x4'));router[_0xa021('0x5')]('/',auth[_0xa021('0x6')](),controller[_0xa021('0x7')]);router[_0xa021('0x5')]('/:id',auth[_0xa021('0x6')](),controller[_0xa021('0x8')]);router[_0xa021('0x5')]('/:id/configurations',auth[_0xa021('0x6')](),controller[_0xa021('0x9')]);router[_0xa021('0x5')]('/:id/fields',auth[_0xa021('0x6')](),controller[_0xa021('0xa')]);router[_0xa021('0xb')]('/',auth['isAuthenticated'](),controller[_0xa021('0xc')]);router[_0xa021('0xb')](_0xa021('0xd'),auth['isAuthenticated'](),controller[_0xa021('0xe')]);router['put'](_0xa021('0xf'),auth[_0xa021('0x6')](),controller[_0xa021('0x10')]);router[_0xa021('0x11')](_0xa021('0xf'),auth[_0xa021('0x6')](),controller[_0xa021('0x12')]);module[_0xa021('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 27afb01..aa43e21 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 _0x2502=['STRING','remoteUri','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2502,0x1df));var _0x2250=function(_0x38944a,_0x51e659){_0x38944a=_0x38944a-0x0;var _0x46528f=_0x2502[_0x38944a];return _0x46528f;};'use strict';var Sequelize=require(_0x2250('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2250('0x1')]},'username':{'type':Sequelize[_0x2250('0x1')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2250('0x1')],'unique':_0x2250('0x2')},'serverUrl':{'type':Sequelize[_0x2250('0x1')]}}; \ No newline at end of file +var _0xf365=['username','remoteUri','sequelize','exports','STRING'];(function(_0x1298ed,_0x39ba63){var _0x56b532=function(_0x46e1eb){while(--_0x46e1eb){_0x1298ed['push'](_0x1298ed['shift']());}};_0x56b532(++_0x39ba63);}(_0xf365,0xfc));var _0x5f36=function(_0x37bcd8,_0x27bed9){_0x37bcd8=_0x37bcd8-0x0;var _0x422480=_0xf365[_0x37bcd8];return _0x422480;};'use strict';var Sequelize=require(_0x5f36('0x0'));module[_0x5f36('0x1')]={'name':{'type':Sequelize[_0x5f36('0x2')]},'description':{'type':Sequelize[_0x5f36('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x5f36('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5f36('0x2')],'unique':_0x5f36('0x4')},'serverUrl':{'type':Sequelize[_0x5f36('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 4ee6c62..a0b5647 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 _0xae62=['../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','request','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','end','stack','name','index','FreshdeskAccount','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','day','add','merge','filter','map','then','include','findAll','rows','includeAll','options','create','body','find','params','getConfigurations','findOne','FreshdeskConfiguration','nolimit','addConfiguration','AccountId','Subjects','getDescriptions','channel','FreshdeskField','Descriptions','getFields','remoteUri','GET','format','%s%s','api/v2/ticket_fields','apiKey','toString','requester','subject','agent','description','priority','group','source','ticket_type','remove','includes','custom_text','label','default','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../config/logger'];(function(_0x3b1abf,_0x505d76){var _0x56dfab=function(_0xf39419){while(--_0xf39419){_0x3b1abf['push'](_0x3b1abf['shift']());}};_0x56dfab(++_0x505d76);}(_0xae62,0x67));var _0x2ae6=function(_0x422f20,_0x1c6b8c){_0x422f20=_0x422f20-0x0;var _0x2614bc=_0xae62[_0x422f20];return _0x2614bc;};'use strict';var pdf=require(_0x2ae6('0x0'));var emlformat=require(_0x2ae6('0x1'));var rimraf=require(_0x2ae6('0x2'));var zipdir=require(_0x2ae6('0x3'));var jsonpatch=require(_0x2ae6('0x4'));var rp=require(_0x2ae6('0x5'));var moment=require(_0x2ae6('0x6'));var BPromise=require(_0x2ae6('0x7'));var Mustache=require(_0x2ae6('0x8'));var util=require(_0x2ae6('0x9'));var path=require(_0x2ae6('0xa'));var sox=require(_0x2ae6('0xb'));var csv=require('to-csv');var ejs=require(_0x2ae6('0xc'));var fs=require('fs');var _=require(_0x2ae6('0xd'));var squel=require('squel');var crypto=require(_0x2ae6('0xe'));var jsforce=require(_0x2ae6('0xf'));var deskjs=require(_0x2ae6('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2ae6('0x11'));var Papa=require('papaparse');var Redis=require(_0x2ae6('0x12'));var qs=require('../../components/parsers/qs');var logger=require(_0x2ae6('0x13'))('api');var utils=require(_0x2ae6('0x14'));var config=require(_0x2ae6('0x15'));var db=require(_0x2ae6('0x16'))['db'];var integrations=require(_0x2ae6('0x17'));var jayson=require('jayson/promise');var client=jayson[_0x2ae6('0x18')][_0x2ae6('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x3b73fb,_0x35e552,_0x29e384,_0x13b5ee){return new BPromise(function(_0x3eef31,_0x1f0e97){var _0x4c4103=_0x13b5ee||client;return _0x4c4103[_0x2ae6('0x1a')](_0x3b73fb,_0x29e384)['then'](function(_0x32c749){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x35e552,_0x2ae6('0x1b'));logger['debug'](_0x2ae6('0x1c'),_0x35e552,'request\x20sent',JSON[_0x2ae6('0x1d')](_0x32c749));if(_0x32c749[_0x2ae6('0x1e')]){if(_0x32c749[_0x2ae6('0x1e')][_0x2ae6('0x1f')]===0x1f4){logger[_0x2ae6('0x1e')](_0x2ae6('0x20'),_0x35e552,_0x32c749['error'][_0x2ae6('0x21')]);return _0x1f0e97(_0x32c749[_0x2ae6('0x1e')][_0x2ae6('0x21')]);}logger[_0x2ae6('0x1e')](_0x2ae6('0x20'),_0x35e552,_0x32c749[_0x2ae6('0x1e')][_0x2ae6('0x21')]);return _0x3eef31(_0x32c749[_0x2ae6('0x1e')][_0x2ae6('0x21')]);}else{logger[_0x2ae6('0x22')]('FreshdeskAccount,\x20%s,\x20%s',_0x35e552,_0x2ae6('0x1b'));_0x3eef31(_0x32c749[_0x2ae6('0x23')][_0x2ae6('0x21')]);}})[_0x2ae6('0x24')](function(_0x595503){logger[_0x2ae6('0x1e')]('FreshdeskAccount,\x20%s,\x20%s',_0x35e552,_0x595503);_0x1f0e97(_0x595503);});});}function respondWithStatusCode(_0x5746a9,_0x2f7924){_0x2f7924=_0x2f7924||0xcc;return function(_0x4c1920){if(_0x4c1920){return _0x5746a9[_0x2ae6('0x25')](_0x2f7924);}return _0x5746a9[_0x2ae6('0x26')](_0x2f7924)['end']();};}function respondWithResult(_0x33d504,_0x2f09b1){_0x2f09b1=_0x2f09b1||0xc8;return function(_0x1b6db8){if(_0x1b6db8){return _0x33d504[_0x2ae6('0x26')](_0x2f09b1)[_0x2ae6('0x27')](_0x1b6db8);}};}function respondWithFilteredResult(_0x32f7ae,_0x4d122c){return function(_0x2e79a2){if(_0x2e79a2){var _0x14f577=_0x2e79a2[_0x2ae6('0x28')],_0x2cc1af=_0x4d122c[_0x2ae6('0x29')],_0x1aff61=_0x4d122c[_0x2ae6('0x29')]+_0x4d122c[_0x2ae6('0x2a')],_0x19d61d;if(_0x1aff61>=_0x14f577){_0x1aff61=_0x14f577;_0x19d61d=0xc8;}else{_0x19d61d=0xce;}_0x32f7ae[_0x2ae6('0x26')](_0x19d61d);return _0x32f7ae[_0x2ae6('0x2b')](_0x2ae6('0x2c'),_0x2cc1af+'-'+_0x1aff61+'/'+_0x14f577)[_0x2ae6('0x27')](_0x2e79a2);}return null;};}function patchUpdates(_0x342f16){return function(_0x58f2ef){try{jsonpatch[_0x2ae6('0x2d')](_0x58f2ef,_0x342f16,!![]);}catch(_0x17626c){return BPromise['reject'](_0x17626c);}return _0x58f2ef[_0x2ae6('0x2e')]();};}function saveUpdates(_0x26d883,_0x4f9a64){return function(_0x35234f){if(_0x35234f){return _0x35234f[_0x2ae6('0x2f')](_0x26d883)['then'](function(_0x411080){return _0x411080;});}return null;};}function removeEntity(_0x313183,_0x554e1a){return function(_0x6e74cb){if(_0x6e74cb){return _0x6e74cb['destroy']()['then'](function(){_0x313183[_0x2ae6('0x26')](0xcc)[_0x2ae6('0x30')]();});}};}function handleEntityNotFound(_0x3828b1,_0x3a2655){return function(_0x38417c){if(!_0x38417c){_0x3828b1[_0x2ae6('0x25')](0x194);}return _0x38417c;};}function handleError(_0x4387f0,_0x26c985){_0x26c985=_0x26c985||0x1f4;return function(_0x405ece){logger[_0x2ae6('0x1e')](_0x405ece[_0x2ae6('0x31')]);if(_0x405ece[_0x2ae6('0x32')]){delete _0x405ece[_0x2ae6('0x32')];}_0x4387f0[_0x2ae6('0x26')](_0x26c985)['send'](_0x405ece);};}exports[_0x2ae6('0x33')]=function(_0x572538,_0x375662){var _0x29916e={},_0x2b76b0={},_0x14c1e5={'count':0x0,'rows':[]};var _0x420bf9=db[_0x2ae6('0x34')][_0x2ae6('0x35')];_0x2b76b0[_0x2ae6('0x36')]=_[_0x2ae6('0x37')](_0x420bf9);var _0x409d89={'dateStart':_0x572538[_0x2ae6('0x38')][_0x2ae6('0x39')],'dateEnd':_0x572538[_0x2ae6('0x38')][_0x2ae6('0x3a')]};delete _0x572538[_0x2ae6('0x38')][_0x2ae6('0x39')];delete _0x572538[_0x2ae6('0x38')][_0x2ae6('0x3a')];_0x2b76b0[_0x2ae6('0x38')]=_['keys'](_0x572538[_0x2ae6('0x38')]);_0x2b76b0[_0x2ae6('0x3b')]=_[_0x2ae6('0x3c')](_0x2b76b0[_0x2ae6('0x36')],_0x2b76b0[_0x2ae6('0x38')]);_0x29916e['attributes']=_[_0x2ae6('0x3c')](_0x2b76b0['model'],qs['fields'](_0x572538[_0x2ae6('0x38')][_0x2ae6('0x3d')]));_0x29916e[_0x2ae6('0x3e')]=_0x29916e[_0x2ae6('0x3e')][_0x2ae6('0x3f')]?_0x29916e[_0x2ae6('0x3e')]:_0x2b76b0[_0x2ae6('0x36')];if(!_0x572538[_0x2ae6('0x38')][_0x2ae6('0x40')]('nolimit')){_0x29916e[_0x2ae6('0x2a')]=qs[_0x2ae6('0x2a')](_0x572538[_0x2ae6('0x38')][_0x2ae6('0x2a')]);_0x29916e['offset']=qs[_0x2ae6('0x29')](_0x572538[_0x2ae6('0x38')][_0x2ae6('0x29')]);}_0x29916e[_0x2ae6('0x41')]=qs[_0x2ae6('0x42')](_0x572538[_0x2ae6('0x38')][_0x2ae6('0x42')]);_0x29916e[_0x2ae6('0x43')]=qs[_0x2ae6('0x3b')](_[_0x2ae6('0x44')](_0x572538[_0x2ae6('0x38')],_0x2b76b0[_0x2ae6('0x3b')]));if(_0x409d89[_0x2ae6('0x39')]){if(_0x409d89[_0x2ae6('0x3a')]){_0x409d89[_0x2ae6('0x3a')]=moment(_0x409d89[_0x2ae6('0x3a')])['add'](0x1,_0x2ae6('0x45'));}else{_0x409d89[_0x2ae6('0x3a')]=moment(_0x409d89[_0x2ae6('0x39')])[_0x2ae6('0x46')](0x1,_0x2ae6('0x45'));}_[_0x2ae6('0x47')](_0x29916e[_0x2ae6('0x43')],{'createdAt':{'$gte':_0x409d89[_0x2ae6('0x39')],'$lte':_0x409d89[_0x2ae6('0x3a')]}});}if(_0x572538[_0x2ae6('0x38')][_0x2ae6('0x48')]){_0x29916e[_0x2ae6('0x43')]=_[_0x2ae6('0x47')](_0x29916e[_0x2ae6('0x43')],{'$or':_[_0x2ae6('0x49')](_0x29916e[_0x2ae6('0x3e')],function(_0x20e1da){var _0x46108e={};_0x46108e[_0x20e1da]={'$like':'%'+_0x572538['query'][_0x2ae6('0x48')]+'%'};return _0x46108e;})});}_0x29916e=_[_0x2ae6('0x47')]({},_0x29916e,_0x572538['options']);var _0x4517a5={'where':_0x29916e[_0x2ae6('0x43')]};return db[_0x2ae6('0x34')][_0x2ae6('0x28')](_0x4517a5)[_0x2ae6('0x4a')](function(_0x2ca55d){_0x14c1e5[_0x2ae6('0x28')]=_0x2ca55d;if(_0x572538['query']['includeAll']){_0x29916e[_0x2ae6('0x4b')]=[{'all':!![]}];}return db[_0x2ae6('0x34')][_0x2ae6('0x4c')](_0x29916e);})['then'](function(_0x5da99f){_0x14c1e5[_0x2ae6('0x4d')]=_0x5da99f;return _0x14c1e5;})['then'](respondWithFilteredResult(_0x375662,_0x29916e))[_0x2ae6('0x24')](handleError(_0x375662,null));};exports['show']=function(_0x406cd2,_0x3cc8ef){var _0x23d6f8={'raw':![],'where':{'id':_0x406cd2['params']['id']}},_0x54948b={};_0x54948b[_0x2ae6('0x36')]=_['keys'](db[_0x2ae6('0x34')][_0x2ae6('0x35')]);_0x54948b[_0x2ae6('0x38')]=_[_0x2ae6('0x37')](_0x406cd2[_0x2ae6('0x38')]);_0x54948b[_0x2ae6('0x3b')]=_['intersection'](_0x54948b[_0x2ae6('0x36')],_0x54948b[_0x2ae6('0x38')]);_0x23d6f8[_0x2ae6('0x3e')]=_[_0x2ae6('0x3c')](_0x54948b[_0x2ae6('0x36')],qs[_0x2ae6('0x3d')](_0x406cd2[_0x2ae6('0x38')][_0x2ae6('0x3d')]));_0x23d6f8['attributes']=_0x23d6f8[_0x2ae6('0x3e')][_0x2ae6('0x3f')]?_0x23d6f8[_0x2ae6('0x3e')]:_0x54948b[_0x2ae6('0x36')];if(_0x406cd2[_0x2ae6('0x38')][_0x2ae6('0x4e')]){_0x23d6f8[_0x2ae6('0x4b')]=[{'all':!![]}];}_0x23d6f8=_[_0x2ae6('0x47')]({},_0x23d6f8,_0x406cd2[_0x2ae6('0x4f')]);return db[_0x2ae6('0x34')]['find'](_0x23d6f8)[_0x2ae6('0x4a')](handleEntityNotFound(_0x3cc8ef,null))[_0x2ae6('0x4a')](respondWithResult(_0x3cc8ef,null))[_0x2ae6('0x24')](handleError(_0x3cc8ef,null));};exports['create']=function(_0x3083e1,_0x251ac6){return db[_0x2ae6('0x34')][_0x2ae6('0x50')](_0x3083e1[_0x2ae6('0x51')],{})[_0x2ae6('0x4a')](respondWithResult(_0x251ac6,0xc9))['catch'](handleError(_0x251ac6,null));};exports[_0x2ae6('0x2f')]=function(_0x53f7d6,_0x10171c){if(_0x53f7d6['body']['id']){delete _0x53f7d6[_0x2ae6('0x51')]['id'];}return db[_0x2ae6('0x34')][_0x2ae6('0x52')]({'where':{'id':_0x53f7d6['params']['id']}})['then'](handleEntityNotFound(_0x10171c,null))['then'](saveUpdates(_0x53f7d6[_0x2ae6('0x51')],null))['then'](respondWithResult(_0x10171c,null))[_0x2ae6('0x24')](handleError(_0x10171c,null));};exports['destroy']=function(_0x44e096,_0x55559c){return db[_0x2ae6('0x34')]['find']({'where':{'id':_0x44e096[_0x2ae6('0x53')]['id']}})[_0x2ae6('0x4a')](handleEntityNotFound(_0x55559c,null))[_0x2ae6('0x4a')](removeEntity(_0x55559c,null))[_0x2ae6('0x24')](handleError(_0x55559c,null));};exports[_0x2ae6('0x54')]=function(_0x43fdc0,_0x461eec,_0x1b2db8){var _0x8a6e60={};var _0x2bb64d={};var _0x384db0;var _0x42174f;return db[_0x2ae6('0x34')][_0x2ae6('0x55')]({'where':{'id':_0x43fdc0[_0x2ae6('0x53')]['id']}})[_0x2ae6('0x4a')](handleEntityNotFound(_0x461eec,null))[_0x2ae6('0x4a')](function(_0x22cf07){if(_0x22cf07){_0x384db0=_0x22cf07;_0x2bb64d['model']=_[_0x2ae6('0x37')](db[_0x2ae6('0x56')][_0x2ae6('0x35')]);_0x2bb64d[_0x2ae6('0x38')]=_[_0x2ae6('0x37')](_0x43fdc0[_0x2ae6('0x38')]);_0x2bb64d[_0x2ae6('0x3b')]=_[_0x2ae6('0x3c')](_0x2bb64d[_0x2ae6('0x36')],_0x2bb64d[_0x2ae6('0x38')]);_0x8a6e60[_0x2ae6('0x3e')]=_[_0x2ae6('0x3c')](_0x2bb64d[_0x2ae6('0x36')],qs[_0x2ae6('0x3d')](_0x43fdc0[_0x2ae6('0x38')][_0x2ae6('0x3d')]));_0x8a6e60[_0x2ae6('0x3e')]=_0x8a6e60[_0x2ae6('0x3e')][_0x2ae6('0x3f')]?_0x8a6e60[_0x2ae6('0x3e')]:_0x2bb64d['model'];_0x8a6e60[_0x2ae6('0x41')]=qs[_0x2ae6('0x42')](_0x43fdc0[_0x2ae6('0x38')][_0x2ae6('0x42')]);_0x8a6e60['where']=qs[_0x2ae6('0x3b')](_[_0x2ae6('0x44')](_0x43fdc0['query'],_0x2bb64d[_0x2ae6('0x3b')]));if(_0x43fdc0['query']['filter']){_0x8a6e60['where']=_['merge'](_0x8a6e60['where'],{'$or':_[_0x2ae6('0x49')](_0x8a6e60[_0x2ae6('0x3e')],function(_0x5190c6){var _0x3c9e5c={};_0x3c9e5c[_0x5190c6]={'$like':'%'+_0x43fdc0[_0x2ae6('0x38')][_0x2ae6('0x48')]+'%'};return _0x3c9e5c;})});}_0x8a6e60=_['merge']({},_0x8a6e60,_0x43fdc0[_0x2ae6('0x4f')]);return _0x384db0[_0x2ae6('0x54')](_0x8a6e60);}})[_0x2ae6('0x4a')](function(_0x2903b6){if(_0x2903b6){_0x42174f=_0x2903b6[_0x2ae6('0x3f')];if(!_0x43fdc0[_0x2ae6('0x38')]['hasOwnProperty'](_0x2ae6('0x57'))){_0x8a6e60['limit']=qs[_0x2ae6('0x2a')](_0x43fdc0['query'][_0x2ae6('0x2a')]);_0x8a6e60[_0x2ae6('0x29')]=qs[_0x2ae6('0x29')](_0x43fdc0['query'][_0x2ae6('0x29')]);}return _0x384db0['getConfigurations'](_0x8a6e60);}})['then'](function(_0x4b029c){if(_0x4b029c){return _0x4b029c?{'count':_0x42174f,'rows':_0x4b029c}:null;}})[_0x2ae6('0x4a')](respondWithResult(_0x461eec,null))['catch'](handleError(_0x461eec,null));};exports[_0x2ae6('0x58')]=function(_0x247a6a,_0x2440ec,_0x30c1b5){if(_0x247a6a[_0x2ae6('0x51')]['id']){delete _0x247a6a['body']['id'];}return db[_0x2ae6('0x34')][_0x2ae6('0x55')]({'where':{'id':_0x247a6a[_0x2ae6('0x53')]['id']}})[_0x2ae6('0x4a')](handleEntityNotFound(_0x2440ec,null))['then'](function(_0x87ce41){if(_0x87ce41){_0x247a6a[_0x2ae6('0x51')][_0x2ae6('0x59')]=_0x87ce41['id'];_0x247a6a[_0x2ae6('0x51')][_0x2ae6('0x5a')]=integrations['getSubjects'](_0x247a6a['body']['channel'],_0x247a6a[_0x2ae6('0x51')]['type']);_0x247a6a[_0x2ae6('0x51')]['Descriptions']=integrations[_0x2ae6('0x5b')](_0x247a6a[_0x2ae6('0x51')][_0x2ae6('0x5c')],_0x247a6a[_0x2ae6('0x51')]['type']);return db[_0x2ae6('0x56')][_0x2ae6('0x50')](_0x247a6a[_0x2ae6('0x51')],{'include':[{'model':db[_0x2ae6('0x5d')],'as':'Subjects'},{'model':db[_0x2ae6('0x5d')],'as':_0x2ae6('0x5e')}]});}return null;})[_0x2ae6('0x4a')](respondWithResult(_0x2440ec,null))[_0x2ae6('0x24')](handleError(_0x2440ec,null));};exports[_0x2ae6('0x5f')]=function(_0x291b63,_0x3918cd,_0xaa071b){return db[_0x2ae6('0x34')][_0x2ae6('0x55')]({'where':{'id':_0x291b63[_0x2ae6('0x53')]['id']},'attributes':['id',_0x2ae6('0x60'),'apiKey']})['then'](handleEntityNotFound(_0x3918cd,null))[_0x2ae6('0x4a')](function(_0x50e20b){if(_0x50e20b){return rp({'method':_0x2ae6('0x61'),'uri':util[_0x2ae6('0x62')](_0x2ae6('0x63'),_0x50e20b[_0x2ae6('0x60')],_0x2ae6('0x64')),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x2ae6('0x62')]('%s:X',_0x50e20b[_0x2ae6('0x65')]))[_0x2ae6('0x66')]('base64'))},'json':!![]});}})[_0x2ae6('0x4a')](function(_0x10aa84){if(_0x10aa84){var _0x5683c4=[_0x2ae6('0x67'),_0x2ae6('0x68'),_0x2ae6('0x69'),_0x2ae6('0x6a'),_0x2ae6('0x26'),_0x2ae6('0x6b'),_0x2ae6('0x6c'),_0x2ae6('0x6d'),_0x2ae6('0x6e'),_0x2ae6('0x6c'),'company'];_[_0x2ae6('0x6f')](_0x10aa84,function(_0xaa6980){return _0x5683c4[_0x2ae6('0x70')](_0xaa6980[_0x2ae6('0x32')])||!_0xaa6980['default']&&_0xaa6980['type']!==_0x2ae6('0x71');});return{'count':_0x10aa84[_0x2ae6('0x3f')],'rows':_['map'](_0x10aa84,function(_0x390835){return{'id':_0x390835['name'],'name':_0x390835[_0x2ae6('0x72')],'custom':!_0x390835[_0x2ae6('0x73')],'options':_0x390835['choices']?_['map'](_0x390835[_0x2ae6('0x74')],function(_0x2a6a55){return{'name':_[_0x2ae6('0x75')](_0x2a6a55),'value':_0x2a6a55};}):[]};})};}})['then'](respondWithResult(_0x3918cd,null))[_0x2ae6('0x24')](function(_0x3dda8c){var _0x6b29b=_0x291b63[_0x2ae6('0x38')][_0x2ae6('0x76')]?0x1f4:_0x3dda8c[_0x2ae6('0x77')]||0x1f4;logger[_0x2ae6('0x1e')](_0x2ae6('0x78'),'getFields',_0x6b29b,JSON[_0x2ae6('0x1d')](_0x3dda8c));delete _0x3dda8c[_0x2ae6('0x32')];if(_0x6b29b===0x191){_0x6b29b=0x190;}_0x3918cd['status'](_0x6b29b)[_0x2ae6('0x79')](_0x291b63[_0x2ae6('0x38')][_0x2ae6('0x76')]?{'message':_0x2ae6('0x7a'),'statusCode':_0x3dda8c[_0x2ae6('0x77')]}:_0x3dda8c);});}; \ No newline at end of file +var _0xe4da=['findAll','rows','catch','params','rawAttributes','options','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','type','Descriptions','getDescriptions','channel','Subjects','getFields','remoteUri','apiKey','format','%s%s','Basic\x20%s','toString','requester','subject','agent','description','priority','source','group','company','label','default','choices','capitalize','test','stringify','statusCode','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','client','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','status','end','count','offset','limit','set','json','apply','reject','save','update','destroy','sendStatus','name','send','index','FreshdeskAccount','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','map','includeAll','include'];(function(_0x4dfd8a,_0x476a02){var _0x5aeac9=function(_0x3aa276){while(--_0x3aa276){_0x4dfd8a['push'](_0x4dfd8a['shift']());}};_0x5aeac9(++_0x476a02);}(_0xe4da,0x109));var _0xae4d=function(_0x2beed1,_0x592f27){_0x2beed1=_0x2beed1-0x0;var _0x229fca=_0xe4da[_0x2beed1];return _0x229fca;};'use strict';var pdf=require(_0xae4d('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xae4d('0x1'));var jsonpatch=require(_0xae4d('0x2'));var rp=require(_0xae4d('0x3'));var moment=require('moment');var BPromise=require(_0xae4d('0x4'));var Mustache=require('mustache');var util=require(_0xae4d('0x5'));var path=require(_0xae4d('0x6'));var sox=require('sox');var csv=require(_0xae4d('0x7'));var ejs=require(_0xae4d('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xae4d('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xae4d('0xa'));var toCsv=require(_0xae4d('0x7'));var querystring=require(_0xae4d('0xb'));var Papa=require(_0xae4d('0xc'));var Redis=require('ioredis');var qs=require(_0xae4d('0xd'));var logger=require(_0xae4d('0xe'))(_0xae4d('0xf'));var utils=require(_0xae4d('0x10'));var config=require(_0xae4d('0x11'));var db=require('../../mysqldb')['db'];var integrations=require(_0xae4d('0x12'));var jayson=require('jayson/promise');var client=jayson[_0xae4d('0x13')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ae4ab,_0x3a4cbb,_0x5819f2,_0xcd48e2){return new BPromise(function(_0x198155,_0x5310af){var _0x2ce4bd=_0xcd48e2||client;return _0x2ce4bd[_0xae4d('0x14')](_0x2ae4ab,_0x5819f2)[_0xae4d('0x15')](function(_0x7ca9b0){logger[_0xae4d('0x16')](_0xae4d('0x17'),_0x3a4cbb,_0xae4d('0x18'));logger[_0xae4d('0x19')](_0xae4d('0x1a'),_0x3a4cbb,'request\x20sent',JSON['stringify'](_0x7ca9b0));if(_0x7ca9b0[_0xae4d('0x1b')]){if(_0x7ca9b0['error'][_0xae4d('0x1c')]===0x1f4){logger[_0xae4d('0x1b')](_0xae4d('0x17'),_0x3a4cbb,_0x7ca9b0[_0xae4d('0x1b')][_0xae4d('0x1d')]);return _0x5310af(_0x7ca9b0[_0xae4d('0x1b')]['message']);}logger[_0xae4d('0x1b')](_0xae4d('0x17'),_0x3a4cbb,_0x7ca9b0['error'][_0xae4d('0x1d')]);return _0x198155(_0x7ca9b0[_0xae4d('0x1b')][_0xae4d('0x1d')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x3a4cbb,_0xae4d('0x18'));_0x198155(_0x7ca9b0[_0xae4d('0x1e')]['message']);}})['catch'](function(_0x4c501e){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x3a4cbb,_0x4c501e);_0x5310af(_0x4c501e);});});}function respondWithStatusCode(_0x1d14d3,_0x3a980c){_0x3a980c=_0x3a980c||0xcc;return function(_0x2cabbd){if(_0x2cabbd){return _0x1d14d3['sendStatus'](_0x3a980c);}return _0x1d14d3[_0xae4d('0x1f')](_0x3a980c)[_0xae4d('0x20')]();};}function respondWithResult(_0x59556d,_0x4adc7b){_0x4adc7b=_0x4adc7b||0xc8;return function(_0x30f26c){if(_0x30f26c){return _0x59556d['status'](_0x4adc7b)['json'](_0x30f26c);}};}function respondWithFilteredResult(_0xfa4626,_0x5384fc){return function(_0x48354b){if(_0x48354b){var _0x3e3567=_0x48354b[_0xae4d('0x21')],_0xfc61=_0x5384fc['offset'],_0x212df4=_0x5384fc[_0xae4d('0x22')]+_0x5384fc[_0xae4d('0x23')],_0x5df95c;if(_0x212df4>=_0x3e3567){_0x212df4=_0x3e3567;_0x5df95c=0xc8;}else{_0x5df95c=0xce;}_0xfa4626[_0xae4d('0x1f')](_0x5df95c);return _0xfa4626[_0xae4d('0x24')]('Content-Range',_0xfc61+'-'+_0x212df4+'/'+_0x3e3567)[_0xae4d('0x25')](_0x48354b);}return null;};}function patchUpdates(_0xfff0fa){return function(_0x49089d){try{jsonpatch[_0xae4d('0x26')](_0x49089d,_0xfff0fa,!![]);}catch(_0xfe2e9e){return BPromise[_0xae4d('0x27')](_0xfe2e9e);}return _0x49089d[_0xae4d('0x28')]();};}function saveUpdates(_0x5807e2,_0x513bad){return function(_0x2f2240){if(_0x2f2240){return _0x2f2240[_0xae4d('0x29')](_0x5807e2)['then'](function(_0x3c759c){return _0x3c759c;});}return null;};}function removeEntity(_0x4b1f3a,_0x32fc71){return function(_0x267917){if(_0x267917){return _0x267917[_0xae4d('0x2a')]()[_0xae4d('0x15')](function(){_0x4b1f3a[_0xae4d('0x1f')](0xcc)[_0xae4d('0x20')]();});}};}function handleEntityNotFound(_0x596780,_0x37c02d){return function(_0x3435e4){if(!_0x3435e4){_0x596780[_0xae4d('0x2b')](0x194);}return _0x3435e4;};}function handleError(_0x3cbf7c,_0x37ee7b){_0x37ee7b=_0x37ee7b||0x1f4;return function(_0x19388b){logger[_0xae4d('0x1b')](_0x19388b['stack']);if(_0x19388b[_0xae4d('0x2c')]){delete _0x19388b[_0xae4d('0x2c')];}_0x3cbf7c[_0xae4d('0x1f')](_0x37ee7b)[_0xae4d('0x2d')](_0x19388b);};}exports[_0xae4d('0x2e')]=function(_0x7f04be,_0x134438){var _0x39679f={},_0x3aa3b5={},_0xb8288c={'count':0x0,'rows':[]};var _0x4e3003=db[_0xae4d('0x2f')]['rawAttributes'];_0x3aa3b5[_0xae4d('0x30')]=_[_0xae4d('0x31')](_0x4e3003);var _0x3bdbc7={'dateStart':_0x7f04be[_0xae4d('0x32')][_0xae4d('0x33')],'dateEnd':_0x7f04be[_0xae4d('0x32')]['dateEnd']};delete _0x7f04be[_0xae4d('0x32')]['dateStart'];delete _0x7f04be[_0xae4d('0x32')][_0xae4d('0x34')];_0x3aa3b5['query']=_['keys'](_0x7f04be['query']);_0x3aa3b5[_0xae4d('0x35')]=_[_0xae4d('0x36')](_0x3aa3b5[_0xae4d('0x30')],_0x3aa3b5[_0xae4d('0x32')]);_0x39679f[_0xae4d('0x37')]=_[_0xae4d('0x36')](_0x3aa3b5['model'],qs[_0xae4d('0x38')](_0x7f04be[_0xae4d('0x32')]['fields']));_0x39679f[_0xae4d('0x37')]=_0x39679f['attributes'][_0xae4d('0x39')]?_0x39679f[_0xae4d('0x37')]:_0x3aa3b5['model'];if(!_0x7f04be[_0xae4d('0x32')][_0xae4d('0x3a')](_0xae4d('0x3b'))){_0x39679f[_0xae4d('0x23')]=qs[_0xae4d('0x23')](_0x7f04be[_0xae4d('0x32')][_0xae4d('0x23')]);_0x39679f[_0xae4d('0x22')]=qs[_0xae4d('0x22')](_0x7f04be[_0xae4d('0x32')][_0xae4d('0x22')]);}_0x39679f[_0xae4d('0x3c')]=qs['sort'](_0x7f04be[_0xae4d('0x32')][_0xae4d('0x3d')]);_0x39679f[_0xae4d('0x3e')]=qs[_0xae4d('0x35')](_[_0xae4d('0x3f')](_0x7f04be['query'],_0x3aa3b5['filters']));if(_0x3bdbc7[_0xae4d('0x33')]){if(_0x3bdbc7[_0xae4d('0x34')]){_0x3bdbc7['dateEnd']=moment(_0x3bdbc7[_0xae4d('0x34')])[_0xae4d('0x40')](0x1,'day');}else{_0x3bdbc7[_0xae4d('0x34')]=moment(_0x3bdbc7[_0xae4d('0x33')])[_0xae4d('0x40')](0x1,_0xae4d('0x41'));}_[_0xae4d('0x42')](_0x39679f['where'],{'createdAt':{'$gte':_0x3bdbc7['dateStart'],'$lte':_0x3bdbc7['dateEnd']}});}if(_0x7f04be[_0xae4d('0x32')][_0xae4d('0x43')]){_0x39679f[_0xae4d('0x3e')]=_['merge'](_0x39679f[_0xae4d('0x3e')],{'$or':_[_0xae4d('0x44')](_0x39679f[_0xae4d('0x37')],function(_0x57a09b){var _0x35f3f8={};_0x35f3f8[_0x57a09b]={'$like':'%'+_0x7f04be[_0xae4d('0x32')]['filter']+'%'};return _0x35f3f8;})});}_0x39679f=_[_0xae4d('0x42')]({},_0x39679f,_0x7f04be['options']);var _0x5717b3={'where':_0x39679f[_0xae4d('0x3e')]};return db[_0xae4d('0x2f')][_0xae4d('0x21')](_0x5717b3)['then'](function(_0xd780ad){_0xb8288c[_0xae4d('0x21')]=_0xd780ad;if(_0x7f04be[_0xae4d('0x32')][_0xae4d('0x45')]){_0x39679f[_0xae4d('0x46')]=[{'all':!![]}];}return db[_0xae4d('0x2f')][_0xae4d('0x47')](_0x39679f);})['then'](function(_0x30b4a6){_0xb8288c[_0xae4d('0x48')]=_0x30b4a6;return _0xb8288c;})[_0xae4d('0x15')](respondWithFilteredResult(_0x134438,_0x39679f))[_0xae4d('0x49')](handleError(_0x134438,null));};exports['show']=function(_0x155a70,_0x23d6bd){var _0x32f69d={'raw':![],'where':{'id':_0x155a70[_0xae4d('0x4a')]['id']}},_0x49bc11={};_0x49bc11[_0xae4d('0x30')]=_[_0xae4d('0x31')](db[_0xae4d('0x2f')][_0xae4d('0x4b')]);_0x49bc11[_0xae4d('0x32')]=_[_0xae4d('0x31')](_0x155a70[_0xae4d('0x32')]);_0x49bc11[_0xae4d('0x35')]=_[_0xae4d('0x36')](_0x49bc11['model'],_0x49bc11['query']);_0x32f69d[_0xae4d('0x37')]=_[_0xae4d('0x36')](_0x49bc11[_0xae4d('0x30')],qs[_0xae4d('0x38')](_0x155a70[_0xae4d('0x32')]['fields']));_0x32f69d[_0xae4d('0x37')]=_0x32f69d[_0xae4d('0x37')][_0xae4d('0x39')]?_0x32f69d[_0xae4d('0x37')]:_0x49bc11[_0xae4d('0x30')];if(_0x155a70[_0xae4d('0x32')][_0xae4d('0x45')]){_0x32f69d[_0xae4d('0x46')]=[{'all':!![]}];}_0x32f69d=_[_0xae4d('0x42')]({},_0x32f69d,_0x155a70[_0xae4d('0x4c')]);return db[_0xae4d('0x2f')][_0xae4d('0x4d')](_0x32f69d)[_0xae4d('0x15')](handleEntityNotFound(_0x23d6bd,null))[_0xae4d('0x15')](respondWithResult(_0x23d6bd,null))[_0xae4d('0x49')](handleError(_0x23d6bd,null));};exports[_0xae4d('0x4e')]=function(_0x5e91a0,_0x45d629){return db[_0xae4d('0x2f')][_0xae4d('0x4e')](_0x5e91a0[_0xae4d('0x4f')],{})[_0xae4d('0x15')](respondWithResult(_0x45d629,0xc9))[_0xae4d('0x49')](handleError(_0x45d629,null));};exports[_0xae4d('0x29')]=function(_0x66517f,_0x5f3453){if(_0x66517f[_0xae4d('0x4f')]['id']){delete _0x66517f[_0xae4d('0x4f')]['id'];}return db[_0xae4d('0x2f')][_0xae4d('0x4d')]({'where':{'id':_0x66517f[_0xae4d('0x4a')]['id']}})[_0xae4d('0x15')](handleEntityNotFound(_0x5f3453,null))[_0xae4d('0x15')](saveUpdates(_0x66517f[_0xae4d('0x4f')],null))['then'](respondWithResult(_0x5f3453,null))[_0xae4d('0x49')](handleError(_0x5f3453,null));};exports['destroy']=function(_0x27e418,_0x1bf7c0){return db[_0xae4d('0x2f')][_0xae4d('0x4d')]({'where':{'id':_0x27e418[_0xae4d('0x4a')]['id']}})[_0xae4d('0x15')](handleEntityNotFound(_0x1bf7c0,null))['then'](removeEntity(_0x1bf7c0,null))[_0xae4d('0x49')](handleError(_0x1bf7c0,null));};exports[_0xae4d('0x50')]=function(_0x69d130,_0x31860b,_0x28fce1){var _0xa75b77={};var _0x219a11={};var _0x173415;var _0x4b476c;return db[_0xae4d('0x2f')][_0xae4d('0x51')]({'where':{'id':_0x69d130[_0xae4d('0x4a')]['id']}})[_0xae4d('0x15')](handleEntityNotFound(_0x31860b,null))[_0xae4d('0x15')](function(_0x55b79a){if(_0x55b79a){_0x173415=_0x55b79a;_0x219a11['model']=_[_0xae4d('0x31')](db[_0xae4d('0x52')][_0xae4d('0x4b')]);_0x219a11[_0xae4d('0x32')]=_[_0xae4d('0x31')](_0x69d130[_0xae4d('0x32')]);_0x219a11[_0xae4d('0x35')]=_[_0xae4d('0x36')](_0x219a11[_0xae4d('0x30')],_0x219a11['query']);_0xa75b77[_0xae4d('0x37')]=_['intersection'](_0x219a11[_0xae4d('0x30')],qs[_0xae4d('0x38')](_0x69d130[_0xae4d('0x32')][_0xae4d('0x38')]));_0xa75b77['attributes']=_0xa75b77[_0xae4d('0x37')][_0xae4d('0x39')]?_0xa75b77[_0xae4d('0x37')]:_0x219a11[_0xae4d('0x30')];_0xa75b77['order']=qs[_0xae4d('0x3d')](_0x69d130[_0xae4d('0x32')]['sort']);_0xa75b77['where']=qs[_0xae4d('0x35')](_[_0xae4d('0x3f')](_0x69d130['query'],_0x219a11['filters']));if(_0x69d130['query']['filter']){_0xa75b77[_0xae4d('0x3e')]=_[_0xae4d('0x42')](_0xa75b77[_0xae4d('0x3e')],{'$or':_[_0xae4d('0x44')](_0xa75b77['attributes'],function(_0x453097){var _0x3c178e={};_0x3c178e[_0x453097]={'$like':'%'+_0x69d130[_0xae4d('0x32')][_0xae4d('0x43')]+'%'};return _0x3c178e;})});}_0xa75b77=_[_0xae4d('0x42')]({},_0xa75b77,_0x69d130[_0xae4d('0x4c')]);return _0x173415[_0xae4d('0x50')](_0xa75b77);}})[_0xae4d('0x15')](function(_0x1f6a53){if(_0x1f6a53){_0x4b476c=_0x1f6a53[_0xae4d('0x39')];if(!_0x69d130[_0xae4d('0x32')][_0xae4d('0x3a')](_0xae4d('0x3b'))){_0xa75b77[_0xae4d('0x23')]=qs['limit'](_0x69d130['query'][_0xae4d('0x23')]);_0xa75b77[_0xae4d('0x22')]=qs[_0xae4d('0x22')](_0x69d130[_0xae4d('0x32')][_0xae4d('0x22')]);}return _0x173415[_0xae4d('0x50')](_0xa75b77);}})[_0xae4d('0x15')](function(_0x3ce90a){if(_0x3ce90a){return _0x3ce90a?{'count':_0x4b476c,'rows':_0x3ce90a}:null;}})[_0xae4d('0x15')](respondWithResult(_0x31860b,null))[_0xae4d('0x49')](handleError(_0x31860b,null));};exports[_0xae4d('0x53')]=function(_0x1a96ca,_0x406b7e,_0xf3fc46){if(_0x1a96ca[_0xae4d('0x4f')]['id']){delete _0x1a96ca[_0xae4d('0x4f')]['id'];}return db[_0xae4d('0x2f')][_0xae4d('0x51')]({'where':{'id':_0x1a96ca[_0xae4d('0x4a')]['id']}})[_0xae4d('0x15')](handleEntityNotFound(_0x406b7e,null))[_0xae4d('0x15')](function(_0x1c23eb){if(_0x1c23eb){_0x1a96ca[_0xae4d('0x4f')][_0xae4d('0x54')]=_0x1c23eb['id'];_0x1a96ca[_0xae4d('0x4f')]['Subjects']=integrations['getSubjects'](_0x1a96ca[_0xae4d('0x4f')]['channel'],_0x1a96ca[_0xae4d('0x4f')][_0xae4d('0x55')]);_0x1a96ca[_0xae4d('0x4f')][_0xae4d('0x56')]=integrations[_0xae4d('0x57')](_0x1a96ca['body'][_0xae4d('0x58')],_0x1a96ca[_0xae4d('0x4f')][_0xae4d('0x55')]);return db[_0xae4d('0x52')][_0xae4d('0x4e')](_0x1a96ca[_0xae4d('0x4f')],{'include':[{'model':db['FreshdeskField'],'as':_0xae4d('0x59')},{'model':db['FreshdeskField'],'as':_0xae4d('0x56')}]});}return null;})[_0xae4d('0x15')](respondWithResult(_0x406b7e,null))[_0xae4d('0x49')](handleError(_0x406b7e,null));};exports[_0xae4d('0x5a')]=function(_0x4aa169,_0x23b130,_0x5e78c3){return db[_0xae4d('0x2f')][_0xae4d('0x51')]({'where':{'id':_0x4aa169[_0xae4d('0x4a')]['id']},'attributes':['id',_0xae4d('0x5b'),_0xae4d('0x5c')]})[_0xae4d('0x15')](handleEntityNotFound(_0x23b130,null))[_0xae4d('0x15')](function(_0xa9d700){if(_0xa9d700){return rp({'method':'GET','uri':util[_0xae4d('0x5d')](_0xae4d('0x5e'),_0xa9d700[_0xae4d('0x5b')],'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xae4d('0x5d')](_0xae4d('0x5f'),new Buffer(util[_0xae4d('0x5d')]('%s:X',_0xa9d700[_0xae4d('0x5c')]))[_0xae4d('0x60')]('base64'))},'json':!![]});}})[_0xae4d('0x15')](function(_0x3af830){if(_0x3af830){var _0x4135f1=[_0xae4d('0x61'),_0xae4d('0x62'),_0xae4d('0x63'),_0xae4d('0x64'),_0xae4d('0x1f'),_0xae4d('0x65'),'group',_0xae4d('0x66'),'ticket_type',_0xae4d('0x67'),_0xae4d('0x68')];_['remove'](_0x3af830,function(_0x195ccd){return _0x4135f1['includes'](_0x195ccd['name'])||!_0x195ccd['default']&&_0x195ccd[_0xae4d('0x55')]!=='custom_text';});return{'count':_0x3af830[_0xae4d('0x39')],'rows':_['map'](_0x3af830,function(_0x24f140){return{'id':_0x24f140['name'],'name':_0x24f140[_0xae4d('0x69')],'custom':!_0x24f140[_0xae4d('0x6a')],'options':_0x24f140[_0xae4d('0x6b')]?_[_0xae4d('0x44')](_0x24f140['choices'],function(_0x413e76){return{'name':_[_0xae4d('0x6c')](_0x413e76),'value':_0x413e76};}):[]};})};}})[_0xae4d('0x15')](respondWithResult(_0x23b130,null))[_0xae4d('0x49')](function(_0x241f9f){var _0x57b1ce=_0x4aa169[_0xae4d('0x32')][_0xae4d('0x6d')]?0x1f4:_0x241f9f['statusCode']||0x1f4;logger[_0xae4d('0x1b')]('getFields,\x20%s,\x20%s,\x20%s',_0xae4d('0x5a'),_0x57b1ce,JSON[_0xae4d('0x6e')](_0x241f9f));delete _0x241f9f[_0xae4d('0x2c')];if(_0x57b1ce===0x191){_0x57b1ce=0x190;}_0x23b130[_0xae4d('0x1f')](_0x57b1ce)[_0xae4d('0x2d')](_0x4aa169[_0xae4d('0x32')][_0xae4d('0x6d')]?{'message':'Wrong\x20credentials','statusCode':_0x241f9f[_0xae4d('0x6f')]}:_0x241f9f);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 3a27529..8118afa 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 _0x6a55=['../../config/logger','api','bluebird','request-promise','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6a55,0x154));var _0x56a5=function(_0x4d8666,_0x2ff19d){_0x4d8666=_0x4d8666-0x0;var _0x37175b=_0x6a55[_0x4d8666];return _0x37175b;};'use strict';var _=require(_0x56a5('0x0'));var util=require('util');var logger=require(_0x56a5('0x1'))(_0x56a5('0x2'));var moment=require('moment');var BPromise=require(_0x56a5('0x3'));var rp=require(_0x56a5('0x4'));var attributes=require(_0x56a5('0x5'));var integrations=require(_0x56a5('0x6'));module[_0x56a5('0x7')]=function(_0x422dda,_0x3718df){return _0x422dda[_0x56a5('0x8')](_0x56a5('0x9'),attributes,{'tableName':_0x56a5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ffe=['lodash','util','../../config/logger','moment','bluebird','request-promise','../../components/integrations/configuration','exports','define','int_freshdesk_accounts'];(function(_0x26b80e,_0x5c9333){var _0x84a8a8=function(_0x2e5b4a){while(--_0x2e5b4a){_0x26b80e['push'](_0x26b80e['shift']());}};_0x84a8a8(++_0x5c9333);}(_0x4ffe,0x172));var _0xe4ff=function(_0x1b8bda,_0x43ad31){_0x1b8bda=_0x1b8bda-0x0;var _0x1f7050=_0x4ffe[_0x1b8bda];return _0x1f7050;};'use strict';var _=require(_0xe4ff('0x0'));var util=require(_0xe4ff('0x1'));var logger=require(_0xe4ff('0x2'))('api');var moment=require(_0xe4ff('0x3'));var BPromise=require(_0xe4ff('0x4'));var rp=require(_0xe4ff('0x5'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xe4ff('0x6'));module[_0xe4ff('0x7')]=function(_0x1397e1,_0x33a19a){return _0x1397e1[_0xe4ff('0x8')]('FreshdeskAccount',attributes,{'tableName':_0xe4ff('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 1180567..94ef80f 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 _0x59ca=['../../config/logger','../../config/environment','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetFreshdeskAccount','catch','ShowFreshdeskAccount','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x47a377,_0x5eec03){var _0x3139d5=function(_0x47a4df){while(--_0x47a4df){_0x47a377['push'](_0x47a377['shift']());}};_0x3139d5(++_0x5eec03);}(_0x59ca,0x144));var _0xa59c=function(_0x506f5b,_0x4d1fb8){_0x506f5b=_0x506f5b-0x0;var _0x48e6b0=_0x59ca[_0x506f5b];return _0x48e6b0;};'use strict';var _=require('lodash');var util=require(_0xa59c('0x0'));var moment=require(_0xa59c('0x1'));var BPromise=require(_0xa59c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa59c('0x3'));var db=require(_0xa59c('0x4'))['db'];var utils=require(_0xa59c('0x5'));var logger=require(_0xa59c('0x6'))('rpc');var config=require(_0xa59c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa59c('0x8')][_0xa59c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x418275,_0x10a1ca,_0x49bca8){return new BPromise(function(_0x5e6dc0,_0x44578c){return client[_0xa59c('0xa')](_0x418275,_0x49bca8)[_0xa59c('0xb')](function(_0x408c3a){logger[_0xa59c('0xc')](_0xa59c('0xd'),_0x10a1ca,_0xa59c('0xe'));logger[_0xa59c('0xf')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x10a1ca,'request\x20sent',JSON[_0xa59c('0x10')](_0x408c3a));if(_0x408c3a[_0xa59c('0x11')]){if(_0x408c3a[_0xa59c('0x11')][_0xa59c('0x12')]===0x1f4){logger[_0xa59c('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x10a1ca,_0x408c3a[_0xa59c('0x11')]['message']);return _0x44578c(_0x408c3a['error'][_0xa59c('0x13')]);}logger[_0xa59c('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x10a1ca,_0x408c3a[_0xa59c('0x11')][_0xa59c('0x13')]);return _0x5e6dc0(_0x408c3a[_0xa59c('0x11')][_0xa59c('0x13')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x10a1ca,_0xa59c('0xe'));_0x5e6dc0(_0x408c3a['result'][_0xa59c('0x13')]);}})['catch'](function(_0x3cf090){logger['error'](_0xa59c('0xd'),_0x10a1ca,_0x3cf090);_0x44578c(_0x3cf090);});});}exports['GetFreshdeskAccount']=function(_0x213052){var _0xffa72f=this;return new Promise(function(_0x11fdbc,_0x474413){return db[_0xa59c('0x14')][_0xa59c('0x15')]({'raw':_0x213052[_0xa59c('0x16')]?_0x213052[_0xa59c('0x16')][_0xa59c('0x17')]===undefined?!![]:![]:!![],'where':_0x213052['options']?_0x213052[_0xa59c('0x16')][_0xa59c('0x18')]||null:null,'attributes':_0x213052[_0xa59c('0x16')]?_0x213052[_0xa59c('0x16')][_0xa59c('0x19')]||null:null,'limit':_0x213052[_0xa59c('0x16')]?_0x213052[_0xa59c('0x16')][_0xa59c('0x1a')]||null:null,'include':_0x213052[_0xa59c('0x16')]?_0x213052[_0xa59c('0x16')][_0xa59c('0x1b')]?_[_0xa59c('0x1c')](_0x213052[_0xa59c('0x16')][_0xa59c('0x1b')],function(_0x3a8210){return{'model':db[_0x3a8210[_0xa59c('0x1d')]],'as':_0x3a8210['as'],'attributes':_0x3a8210[_0xa59c('0x19')],'include':_0x3a8210[_0xa59c('0x1b')]?_['map'](_0x3a8210['include'],function(_0x1794de){return{'model':db[_0x1794de['model']],'as':_0x1794de['as'],'attributes':_0x1794de[_0xa59c('0x19')],'include':_0x1794de[_0xa59c('0x1b')]?_[_0xa59c('0x1c')](_0x1794de[_0xa59c('0x1b')],function(_0x10ab1b){return{'model':db[_0x10ab1b[_0xa59c('0x1d')]],'as':_0x10ab1b['as'],'attributes':_0x10ab1b[_0xa59c('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa59c('0xb')](function(_0x15ee43){logger[_0xa59c('0xc')]('GetFreshdeskAccount',_0x213052);logger['debug'](_0xa59c('0x1e'),_0x213052,JSON[_0xa59c('0x10')](_0x15ee43));_0x11fdbc(_0x15ee43);})[_0xa59c('0x1f')](function(_0x4ba498){logger[_0xa59c('0x11')](_0xa59c('0x1e'),_0x4ba498[_0xa59c('0x13')],_0x213052);_0x474413(_0xffa72f[_0xa59c('0x11')](0x1f4,_0x4ba498[_0xa59c('0x13')]));});});};exports[_0xa59c('0x20')]=function(_0x5f2c9d){var _0x54fd85=this;return new Promise(function(_0x5020e4,_0xa1da24){return db[_0xa59c('0x14')]['find']({'raw':_0x5f2c9d[_0xa59c('0x16')]?_0x5f2c9d[_0xa59c('0x16')][_0xa59c('0x17')]===undefined?!![]:![]:!![],'where':_0x5f2c9d[_0xa59c('0x16')]?_0x5f2c9d['options'][_0xa59c('0x18')]||null:null,'attributes':_0x5f2c9d[_0xa59c('0x16')]?_0x5f2c9d[_0xa59c('0x16')][_0xa59c('0x19')]||null:null,'include':_0x5f2c9d['options']?_0x5f2c9d['options'][_0xa59c('0x1b')]?_[_0xa59c('0x1c')](_0x5f2c9d[_0xa59c('0x16')][_0xa59c('0x1b')],function(_0x2f40e4){return{'model':db[_0x2f40e4[_0xa59c('0x1d')]],'as':_0x2f40e4['as'],'attributes':_0x2f40e4[_0xa59c('0x19')],'include':_0x2f40e4['include']?_[_0xa59c('0x1c')](_0x2f40e4[_0xa59c('0x1b')],function(_0x36033a){return{'model':db[_0x36033a['model']],'as':_0x36033a['as'],'attributes':_0x36033a[_0xa59c('0x19')],'include':_0x36033a['include']?_[_0xa59c('0x1c')](_0x36033a['include'],function(_0x1c4bd6){return{'model':db[_0x1c4bd6[_0xa59c('0x1d')]],'as':_0x1c4bd6['as'],'attributes':_0x1c4bd6[_0xa59c('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa59c('0xb')](function(_0xe64865){logger['info'](_0xa59c('0x20'),_0x5f2c9d);logger[_0xa59c('0xf')](_0xa59c('0x20'),_0x5f2c9d,JSON[_0xa59c('0x10')](_0xe64865));_0x5020e4(_0xe64865);})[_0xa59c('0x1f')](function(_0x5c5604){logger[_0xa59c('0x11')](_0xa59c('0x20'),_0x5c5604['message'],_0x5f2c9d);_0xa1da24(_0x54fd85[_0xa59c('0x11')](0x1f4,_0x5c5604[_0xa59c('0x13')]));});});}; \ No newline at end of file +var _0xcfea=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFreshdeskAccount','FreshdeskAccount','options','limit','include','map','model','attributes','ShowFreshdeskAccount','raw','where','lodash','util','moment','bluebird'];(function(_0x584b11,_0x4bbe67){var _0x51fa14=function(_0x5515ce){while(--_0x5515ce){_0x584b11['push'](_0x584b11['shift']());}};_0x51fa14(++_0x4bbe67);}(_0xcfea,0x194));var _0xacfe=function(_0x2100e8,_0x3f37ca){_0x2100e8=_0x2100e8-0x0;var _0x3c97bf=_0xcfea[_0x2100e8];return _0x3c97bf;};'use strict';var _=require(_0xacfe('0x0'));var util=require(_0xacfe('0x1'));var moment=require(_0xacfe('0x2'));var BPromise=require(_0xacfe('0x3'));var rs=require(_0xacfe('0x4'));var fs=require('fs');var Redis=require(_0xacfe('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xacfe('0x6'));var logger=require(_0xacfe('0x7'))(_0xacfe('0x8'));var config=require('../../config/environment');var jayson=require(_0xacfe('0x9'));var client=jayson['client'][_0xacfe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26da43,_0x697267,_0x58da4b){return new BPromise(function(_0x4503b6,_0x2101b2){return client[_0xacfe('0xb')](_0x26da43,_0x58da4b)[_0xacfe('0xc')](function(_0x3644f3){logger[_0xacfe('0xd')](_0xacfe('0xe'),_0x697267,_0xacfe('0xf'));logger[_0xacfe('0x10')](_0xacfe('0x11'),_0x697267,_0xacfe('0xf'),JSON[_0xacfe('0x12')](_0x3644f3));if(_0x3644f3[_0xacfe('0x13')]){if(_0x3644f3[_0xacfe('0x13')][_0xacfe('0x14')]===0x1f4){logger['error'](_0xacfe('0xe'),_0x697267,_0x3644f3[_0xacfe('0x13')][_0xacfe('0x15')]);return _0x2101b2(_0x3644f3['error'][_0xacfe('0x15')]);}logger[_0xacfe('0x13')](_0xacfe('0xe'),_0x697267,_0x3644f3[_0xacfe('0x13')][_0xacfe('0x15')]);return _0x4503b6(_0x3644f3[_0xacfe('0x13')][_0xacfe('0x15')]);}else{logger['info'](_0xacfe('0xe'),_0x697267,'request\x20sent');_0x4503b6(_0x3644f3['result'][_0xacfe('0x15')]);}})[_0xacfe('0x16')](function(_0x257914){logger[_0xacfe('0x13')](_0xacfe('0xe'),_0x697267,_0x257914);_0x2101b2(_0x257914);});});}exports[_0xacfe('0x17')]=function(_0x373f0f){var _0x450217=this;return new Promise(function(_0x27248c,_0x2eef69){return db[_0xacfe('0x18')]['findAll']({'raw':_0x373f0f[_0xacfe('0x19')]?_0x373f0f[_0xacfe('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x373f0f[_0xacfe('0x19')]?_0x373f0f['options']['where']||null:null,'attributes':_0x373f0f[_0xacfe('0x19')]?_0x373f0f[_0xacfe('0x19')]['attributes']||null:null,'limit':_0x373f0f[_0xacfe('0x19')]?_0x373f0f[_0xacfe('0x19')][_0xacfe('0x1a')]||null:null,'include':_0x373f0f[_0xacfe('0x19')]?_0x373f0f[_0xacfe('0x19')][_0xacfe('0x1b')]?_[_0xacfe('0x1c')](_0x373f0f[_0xacfe('0x19')][_0xacfe('0x1b')],function(_0x32e74){return{'model':db[_0x32e74[_0xacfe('0x1d')]],'as':_0x32e74['as'],'attributes':_0x32e74[_0xacfe('0x1e')],'include':_0x32e74[_0xacfe('0x1b')]?_[_0xacfe('0x1c')](_0x32e74['include'],function(_0x32644b){return{'model':db[_0x32644b[_0xacfe('0x1d')]],'as':_0x32644b['as'],'attributes':_0x32644b['attributes'],'include':_0x32644b[_0xacfe('0x1b')]?_[_0xacfe('0x1c')](_0x32644b[_0xacfe('0x1b')],function(_0xd31418){return{'model':db[_0xd31418[_0xacfe('0x1d')]],'as':_0xd31418['as'],'attributes':_0xd31418[_0xacfe('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xacfe('0xc')](function(_0x4dfc21){logger[_0xacfe('0xd')](_0xacfe('0x17'),_0x373f0f);logger[_0xacfe('0x10')]('GetFreshdeskAccount',_0x373f0f,JSON[_0xacfe('0x12')](_0x4dfc21));_0x27248c(_0x4dfc21);})[_0xacfe('0x16')](function(_0x748e5b){logger[_0xacfe('0x13')](_0xacfe('0x17'),_0x748e5b[_0xacfe('0x15')],_0x373f0f);_0x2eef69(_0x450217[_0xacfe('0x13')](0x1f4,_0x748e5b[_0xacfe('0x15')]));});});};exports[_0xacfe('0x1f')]=function(_0x24439a){var _0x161406=this;return new Promise(function(_0x479303,_0x5d1422){return db[_0xacfe('0x18')]['find']({'raw':_0x24439a['options']?_0x24439a[_0xacfe('0x19')][_0xacfe('0x20')]===undefined?!![]:![]:!![],'where':_0x24439a[_0xacfe('0x19')]?_0x24439a[_0xacfe('0x19')][_0xacfe('0x21')]||null:null,'attributes':_0x24439a[_0xacfe('0x19')]?_0x24439a[_0xacfe('0x19')][_0xacfe('0x1e')]||null:null,'include':_0x24439a[_0xacfe('0x19')]?_0x24439a[_0xacfe('0x19')][_0xacfe('0x1b')]?_[_0xacfe('0x1c')](_0x24439a[_0xacfe('0x19')][_0xacfe('0x1b')],function(_0x5b63ab){return{'model':db[_0x5b63ab['model']],'as':_0x5b63ab['as'],'attributes':_0x5b63ab[_0xacfe('0x1e')],'include':_0x5b63ab[_0xacfe('0x1b')]?_['map'](_0x5b63ab[_0xacfe('0x1b')],function(_0xbc4b6b){return{'model':db[_0xbc4b6b[_0xacfe('0x1d')]],'as':_0xbc4b6b['as'],'attributes':_0xbc4b6b[_0xacfe('0x1e')],'include':_0xbc4b6b['include']?_[_0xacfe('0x1c')](_0xbc4b6b[_0xacfe('0x1b')],function(_0x5ca34e){return{'model':db[_0x5ca34e[_0xacfe('0x1d')]],'as':_0x5ca34e['as'],'attributes':_0x5ca34e[_0xacfe('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xacfe('0xc')](function(_0x5d7a21){logger[_0xacfe('0xd')](_0xacfe('0x1f'),_0x24439a);logger[_0xacfe('0x10')]('ShowFreshdeskAccount',_0x24439a,JSON[_0xacfe('0x12')](_0x5d7a21));_0x479303(_0x5d7a21);})[_0xacfe('0x16')](function(_0x149343){logger['error'](_0xacfe('0x1f'),_0x149343[_0xacfe('0x15')],_0x24439a);_0x5d1422(_0x161406[_0xacfe('0x13')](0x1f4,_0x149343[_0xacfe('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 4a5737b..49b99a6 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 _0x5fc3=['getDescriptions','/:id/tags','post','setTags','put','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x2ef44b,_0x553359){var _0x2405b9=function(_0x278290){while(--_0x278290){_0x2ef44b['push'](_0x2ef44b['shift']());}};_0x2405b9(++_0x553359);}(_0x5fc3,0xa8));var _0x35fc=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0x5fc3[_0x257642];return _0x3d813b;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var auth=require(_0x35fc('0x5'));var interaction=require(_0x35fc('0x6'));var config=require('../../config/environment');var controller=require(_0x35fc('0x7'));router[_0x35fc('0x8')]('/',auth[_0x35fc('0x9')](),controller['index']);router['get'](_0x35fc('0xa'),auth['isAuthenticated'](),controller[_0x35fc('0xb')]);router[_0x35fc('0x8')](_0x35fc('0xc'),auth[_0x35fc('0x9')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x8')](_0x35fc('0xe'),auth['isAuthenticated'](),controller[_0x35fc('0xf')]);router[_0x35fc('0x8')]('/:id/descriptions',auth[_0x35fc('0x9')](),controller[_0x35fc('0x10')]);router['get'](_0x35fc('0x11'),auth[_0x35fc('0x9')](),controller['getTags']);router['post']('/',auth[_0x35fc('0x9')](),controller['create']);router[_0x35fc('0x12')](_0x35fc('0x11'),auth[_0x35fc('0x9')](),controller[_0x35fc('0x13')]);router[_0x35fc('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x35fc('0xa'),auth[_0x35fc('0x9')](),controller[_0x35fc('0x15')]);module[_0x35fc('0x16')]=router; \ No newline at end of file +var _0x0309=['post','setTags','put','update','delete','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create'];(function(_0x47adb8,_0x591ccc){var _0x4689a8=function(_0x2ba76f){while(--_0x2ba76f){_0x47adb8['push'](_0x47adb8['shift']());}};_0x4689a8(++_0x591ccc);}(_0x0309,0x165));var _0x9030=function(_0x7386b6,_0x27b0d9){_0x7386b6=_0x7386b6-0x0;var _0x5dd632=_0x0309[_0x7386b6];return _0x5dd632;};'use strict';var multer=require(_0x9030('0x0'));var util=require('util');var path=require(_0x9030('0x1'));var timeout=require('connect-timeout');var express=require(_0x9030('0x2'));var router=express[_0x9030('0x3')]();var auth=require(_0x9030('0x4'));var interaction=require(_0x9030('0x5'));var config=require(_0x9030('0x6'));var controller=require(_0x9030('0x7'));router[_0x9030('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9030('0x8')](_0x9030('0x9'),auth['isAuthenticated'](),controller[_0x9030('0xa')]);router['get'](_0x9030('0xb'),auth[_0x9030('0xc')](),controller[_0x9030('0xd')]);router['get'](_0x9030('0xe'),auth[_0x9030('0xc')](),controller[_0x9030('0xf')]);router['get'](_0x9030('0x10'),auth[_0x9030('0xc')](),controller[_0x9030('0x11')]);router[_0x9030('0x8')](_0x9030('0x12'),auth[_0x9030('0xc')](),controller[_0x9030('0x13')]);router['post']('/',auth[_0x9030('0xc')](),controller[_0x9030('0x14')]);router[_0x9030('0x15')](_0x9030('0x12'),auth['isAuthenticated'](),controller[_0x9030('0x16')]);router[_0x9030('0x17')](_0x9030('0x9'),auth[_0x9030('0xc')](),controller[_0x9030('0x18')]);router[_0x9030('0x19')](_0x9030('0x9'),auth[_0x9030('0xc')](),controller[_0x9030('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 49fd229..bfabfc0 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 _0x8a20=['exports','STRING','sequelize'];(function(_0xbf8bc5,_0x21f45c){var _0x72af02=function(_0x5c5e46){while(--_0x5c5e46){_0xbf8bc5['push'](_0xbf8bc5['shift']());}};_0x72af02(++_0x21f45c);}(_0x8a20,0xdd));var _0x08a2=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x8a20[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require(_0x08a2('0x0'));module[_0x08a2('0x1')]={'name':{'type':Sequelize[_0x08a2('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb072=['exports','sequelize'];(function(_0x117a06,_0x3860e4){var _0x53bfc2=function(_0xe0458c){while(--_0xe0458c){_0x117a06['push'](_0x117a06['shift']());}};_0x53bfc2(++_0x3860e4);}(_0xb072,0x147));var _0x2b07=function(_0x50918c,_0x2801d6){_0x50918c=_0x50918c-0x0;var _0x3840ee=_0xb072[_0x50918c];return _0x3840ee;};'use strict';var Sequelize=require(_0x2b07('0x0'));module[_0x2b07('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index e1af36b..9700f65 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 _0xdddd=['rows','show','find','create','body','params','getFields','findOne','FreshdeskField','rawAttributes','sort','getSubjects','pick','getDescriptions','getTags','Tag','setTags','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','index','FreshdeskConfiguration','model','keys','dateStart','query','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','day','add','merge','map','filter','options','includeAll','include','findAll'];(function(_0x7af730,_0x4efd91){var _0x1b9c34=function(_0x5ddabd){while(--_0x5ddabd){_0x7af730['push'](_0x7af730['shift']());}};_0x1b9c34(++_0x4efd91);}(_0xdddd,0x17d));var _0xdddd=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xdddd[_0x3d42d8];return _0x27fc41;};'use strict';var pdf=require(_0xdddd('0x0'));var emlformat=require(_0xdddd('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xdddd('0x2'));var jsonpatch=require(_0xdddd('0x3'));var rp=require(_0xdddd('0x4'));var moment=require('moment');var BPromise=require(_0xdddd('0x5'));var Mustache=require(_0xdddd('0x6'));var util=require(_0xdddd('0x7'));var path=require(_0xdddd('0x8'));var sox=require(_0xdddd('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdddd('0xa'));var deskjs=require(_0xdddd('0xb'));var toCsv=require('to-csv');var querystring=require(_0xdddd('0xc'));var Papa=require(_0xdddd('0xd'));var Redis=require(_0xdddd('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0xdddd('0xf'))(_0xdddd('0x10'));var utils=require('../../config/utils');var config=require(_0xdddd('0x11'));var db=require(_0xdddd('0x12'))['db'];var jayson=require(_0xdddd('0x13'));var client=jayson[_0xdddd('0x14')][_0xdddd('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x2746a7,_0x2314fe,_0x340956,_0x49e43e){return new BPromise(function(_0x5cbc08,_0x39f087){var _0x513820=_0x49e43e||client;return _0x513820[_0xdddd('0x16')](_0x2746a7,_0x340956)[_0xdddd('0x17')](function(_0x1e3b74){logger['info'](_0xdddd('0x18'),_0x2314fe,_0xdddd('0x19'));logger[_0xdddd('0x1a')](_0xdddd('0x1b'),_0x2314fe,_0xdddd('0x19'),JSON[_0xdddd('0x1c')](_0x1e3b74));if(_0x1e3b74[_0xdddd('0x1d')]){if(_0x1e3b74['error'][_0xdddd('0x1e')]===0x1f4){logger[_0xdddd('0x1d')](_0xdddd('0x18'),_0x2314fe,_0x1e3b74[_0xdddd('0x1d')][_0xdddd('0x1f')]);return _0x39f087(_0x1e3b74['error'][_0xdddd('0x1f')]);}logger[_0xdddd('0x1d')](_0xdddd('0x18'),_0x2314fe,_0x1e3b74['error'][_0xdddd('0x1f')]);return _0x5cbc08(_0x1e3b74[_0xdddd('0x1d')][_0xdddd('0x1f')]);}else{logger[_0xdddd('0x20')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2314fe,'request\x20sent');_0x5cbc08(_0x1e3b74['result'][_0xdddd('0x1f')]);}})[_0xdddd('0x21')](function(_0xfad79f){logger[_0xdddd('0x1d')](_0xdddd('0x18'),_0x2314fe,_0xfad79f);_0x39f087(_0xfad79f);});});}function respondWithStatusCode(_0x4d93aa,_0x19a7da){_0x19a7da=_0x19a7da||0xcc;return function(_0x7ad7e4){if(_0x7ad7e4){return _0x4d93aa[_0xdddd('0x22')](_0x19a7da);}return _0x4d93aa[_0xdddd('0x23')](_0x19a7da)[_0xdddd('0x24')]();};}function respondWithResult(_0x3e665c,_0x1db73b){_0x1db73b=_0x1db73b||0xc8;return function(_0xa37187){if(_0xa37187){return _0x3e665c[_0xdddd('0x23')](_0x1db73b)[_0xdddd('0x25')](_0xa37187);}};}function respondWithFilteredResult(_0x1b106e,_0x5d5ade){return function(_0x5dbfa9){if(_0x5dbfa9){var _0x80c433=_0x5dbfa9[_0xdddd('0x26')],_0x24d626=_0x5d5ade[_0xdddd('0x27')],_0xb4f6d6=_0x5d5ade[_0xdddd('0x27')]+_0x5d5ade[_0xdddd('0x28')],_0x640254;if(_0xb4f6d6>=_0x80c433){_0xb4f6d6=_0x80c433;_0x640254=0xc8;}else{_0x640254=0xce;}_0x1b106e[_0xdddd('0x23')](_0x640254);return _0x1b106e[_0xdddd('0x29')](_0xdddd('0x2a'),_0x24d626+'-'+_0xb4f6d6+'/'+_0x80c433)[_0xdddd('0x25')](_0x5dbfa9);}return null;};}function patchUpdates(_0x5c052d){return function(_0x40b0db){try{jsonpatch[_0xdddd('0x2b')](_0x40b0db,_0x5c052d,!![]);}catch(_0x291593){return BPromise['reject'](_0x291593);}return _0x40b0db[_0xdddd('0x2c')]();};}function saveUpdates(_0x1f3b19,_0x49695d){return function(_0x2bbbae){if(_0x2bbbae){return _0x2bbbae[_0xdddd('0x2d')](_0x1f3b19)[_0xdddd('0x17')](function(_0x355f64){return _0x355f64;});}return null;};}function removeEntity(_0x2c11a8,_0x2082a4){return function(_0x30ff25){if(_0x30ff25){return _0x30ff25[_0xdddd('0x2e')]()[_0xdddd('0x17')](function(){_0x2c11a8[_0xdddd('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x248cd6,_0x180a0d){return function(_0xb4eded){if(!_0xb4eded){_0x248cd6[_0xdddd('0x22')](0x194);}return _0xb4eded;};}function handleError(_0x53db90,_0x52e3c8){_0x52e3c8=_0x52e3c8||0x1f4;return function(_0xb300f1){logger[_0xdddd('0x1d')](_0xb300f1[_0xdddd('0x2f')]);if(_0xb300f1[_0xdddd('0x30')]){delete _0xb300f1['name'];}_0x53db90['status'](_0x52e3c8)['send'](_0xb300f1);};}exports[_0xdddd('0x31')]=function(_0x35011a,_0x248b50){var _0x1aab66={},_0x40f9c7={},_0x9ae835={'count':0x0,'rows':[]};var _0x31524e=db[_0xdddd('0x32')]['rawAttributes'];_0x40f9c7[_0xdddd('0x33')]=_[_0xdddd('0x34')](_0x31524e);var _0x1fa5f6={'dateStart':_0x35011a['query'][_0xdddd('0x35')],'dateEnd':_0x35011a[_0xdddd('0x36')][_0xdddd('0x37')]};delete _0x35011a[_0xdddd('0x36')][_0xdddd('0x35')];delete _0x35011a[_0xdddd('0x36')]['dateEnd'];_0x40f9c7[_0xdddd('0x36')]=_[_0xdddd('0x34')](_0x35011a[_0xdddd('0x36')]);_0x40f9c7[_0xdddd('0x38')]=_['intersection'](_0x40f9c7[_0xdddd('0x33')],_0x40f9c7[_0xdddd('0x36')]);_0x1aab66[_0xdddd('0x39')]=_[_0xdddd('0x3a')](_0x40f9c7[_0xdddd('0x33')],qs[_0xdddd('0x3b')](_0x35011a[_0xdddd('0x36')]['fields']));_0x1aab66['attributes']=_0x1aab66[_0xdddd('0x39')][_0xdddd('0x3c')]?_0x1aab66[_0xdddd('0x39')]:_0x40f9c7[_0xdddd('0x33')];if(!_0x35011a[_0xdddd('0x36')][_0xdddd('0x3d')](_0xdddd('0x3e'))){_0x1aab66['limit']=qs[_0xdddd('0x28')](_0x35011a['query'][_0xdddd('0x28')]);_0x1aab66[_0xdddd('0x27')]=qs[_0xdddd('0x27')](_0x35011a[_0xdddd('0x36')][_0xdddd('0x27')]);}_0x1aab66[_0xdddd('0x3f')]=qs['sort'](_0x35011a['query']['sort']);_0x1aab66[_0xdddd('0x40')]=qs['filters'](_['pick'](_0x35011a[_0xdddd('0x36')],_0x40f9c7[_0xdddd('0x38')]));if(_0x1fa5f6[_0xdddd('0x35')]){if(_0x1fa5f6[_0xdddd('0x37')]){_0x1fa5f6[_0xdddd('0x37')]=moment(_0x1fa5f6[_0xdddd('0x37')])['add'](0x1,_0xdddd('0x41'));}else{_0x1fa5f6[_0xdddd('0x37')]=moment(_0x1fa5f6[_0xdddd('0x35')])[_0xdddd('0x42')](0x1,_0xdddd('0x41'));}_[_0xdddd('0x43')](_0x1aab66[_0xdddd('0x40')],{'createdAt':{'$gte':_0x1fa5f6[_0xdddd('0x35')],'$lte':_0x1fa5f6[_0xdddd('0x37')]}});}if(_0x35011a[_0xdddd('0x36')]['filter']){_0x1aab66[_0xdddd('0x40')]=_[_0xdddd('0x43')](_0x1aab66[_0xdddd('0x40')],{'$or':_[_0xdddd('0x44')](_0x1aab66[_0xdddd('0x39')],function(_0x371790){var _0x23911d={};_0x23911d[_0x371790]={'$like':'%'+_0x35011a[_0xdddd('0x36')][_0xdddd('0x45')]+'%'};return _0x23911d;})});}_0x1aab66=_[_0xdddd('0x43')]({},_0x1aab66,_0x35011a[_0xdddd('0x46')]);var _0x162b54={'where':_0x1aab66[_0xdddd('0x40')]};return db['FreshdeskConfiguration'][_0xdddd('0x26')](_0x162b54)['then'](function(_0x5a993d){_0x9ae835[_0xdddd('0x26')]=_0x5a993d;if(_0x35011a[_0xdddd('0x36')][_0xdddd('0x47')]){_0x1aab66[_0xdddd('0x48')]=[{'all':!![]}];}return db[_0xdddd('0x32')][_0xdddd('0x49')](_0x1aab66);})['then'](function(_0x59be6f){_0x9ae835[_0xdddd('0x4a')]=_0x59be6f;return _0x9ae835;})[_0xdddd('0x17')](respondWithFilteredResult(_0x248b50,_0x1aab66))[_0xdddd('0x21')](handleError(_0x248b50,null));};exports[_0xdddd('0x4b')]=function(_0xc9ee80,_0x3bec49){var _0xbdd3ef={'raw':![],'where':{'id':_0xc9ee80['params']['id']}},_0x1eeffa={};_0x1eeffa[_0xdddd('0x33')]=_[_0xdddd('0x34')](db[_0xdddd('0x32')]['rawAttributes']);_0x1eeffa[_0xdddd('0x36')]=_[_0xdddd('0x34')](_0xc9ee80['query']);_0x1eeffa[_0xdddd('0x38')]=_['intersection'](_0x1eeffa['model'],_0x1eeffa['query']);_0xbdd3ef[_0xdddd('0x39')]=_[_0xdddd('0x3a')](_0x1eeffa[_0xdddd('0x33')],qs[_0xdddd('0x3b')](_0xc9ee80[_0xdddd('0x36')][_0xdddd('0x3b')]));_0xbdd3ef[_0xdddd('0x39')]=_0xbdd3ef[_0xdddd('0x39')][_0xdddd('0x3c')]?_0xbdd3ef[_0xdddd('0x39')]:_0x1eeffa[_0xdddd('0x33')];if(_0xc9ee80[_0xdddd('0x36')][_0xdddd('0x47')]){_0xbdd3ef[_0xdddd('0x48')]=[{'all':!![]}];}_0xbdd3ef=_[_0xdddd('0x43')]({},_0xbdd3ef,_0xc9ee80[_0xdddd('0x46')]);return db['FreshdeskConfiguration'][_0xdddd('0x4c')](_0xbdd3ef)[_0xdddd('0x17')](handleEntityNotFound(_0x3bec49,null))[_0xdddd('0x17')](respondWithResult(_0x3bec49,null))[_0xdddd('0x21')](handleError(_0x3bec49,null));};exports[_0xdddd('0x4d')]=function(_0x40322f,_0x271a0b){return db[_0xdddd('0x32')][_0xdddd('0x4d')](_0x40322f[_0xdddd('0x4e')],{})[_0xdddd('0x17')](respondWithResult(_0x271a0b,0xc9))[_0xdddd('0x21')](handleError(_0x271a0b,null));};exports[_0xdddd('0x2d')]=function(_0x35f34c,_0xddaf7a){if(_0x35f34c[_0xdddd('0x4e')]['id']){delete _0x35f34c[_0xdddd('0x4e')]['id'];}return db[_0xdddd('0x32')][_0xdddd('0x4c')]({'where':{'id':_0x35f34c[_0xdddd('0x4f')]['id']}})[_0xdddd('0x17')](handleEntityNotFound(_0xddaf7a,null))[_0xdddd('0x17')](saveUpdates(_0x35f34c[_0xdddd('0x4e')],null))[_0xdddd('0x17')](respondWithResult(_0xddaf7a,null))[_0xdddd('0x21')](handleError(_0xddaf7a,null));};exports['destroy']=function(_0x2f2ea2,_0x431626){return db[_0xdddd('0x32')][_0xdddd('0x4c')]({'where':{'id':_0x2f2ea2[_0xdddd('0x4f')]['id']}})[_0xdddd('0x17')](handleEntityNotFound(_0x431626,null))[_0xdddd('0x17')](removeEntity(_0x431626,null))[_0xdddd('0x21')](handleError(_0x431626,null));};exports[_0xdddd('0x50')]=function(_0x42c7ac,_0x1f658c,_0x4e1cdb){var _0x5b9a81={};var _0x277f09={};var _0x33139f;var _0x8f2be;return db['FreshdeskConfiguration'][_0xdddd('0x51')]({'where':{'id':_0x42c7ac[_0xdddd('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1f658c,null))[_0xdddd('0x17')](function(_0x4c2b09){if(_0x4c2b09){_0x33139f=_0x4c2b09;_0x277f09[_0xdddd('0x33')]=_['keys'](db[_0xdddd('0x52')][_0xdddd('0x53')]);_0x277f09[_0xdddd('0x36')]=_[_0xdddd('0x34')](_0x42c7ac[_0xdddd('0x36')]);_0x277f09[_0xdddd('0x38')]=_[_0xdddd('0x3a')](_0x277f09[_0xdddd('0x33')],_0x277f09['query']);_0x5b9a81[_0xdddd('0x39')]=_[_0xdddd('0x3a')](_0x277f09[_0xdddd('0x33')],qs[_0xdddd('0x3b')](_0x42c7ac['query'][_0xdddd('0x3b')]));_0x5b9a81[_0xdddd('0x39')]=_0x5b9a81[_0xdddd('0x39')][_0xdddd('0x3c')]?_0x5b9a81['attributes']:_0x277f09[_0xdddd('0x33')];_0x5b9a81[_0xdddd('0x3f')]=qs[_0xdddd('0x54')](_0x42c7ac[_0xdddd('0x36')][_0xdddd('0x54')]);_0x5b9a81['where']=qs['filters'](_['pick'](_0x42c7ac['query'],_0x277f09[_0xdddd('0x38')]));if(_0x42c7ac[_0xdddd('0x36')][_0xdddd('0x45')]){_0x5b9a81[_0xdddd('0x40')]=_[_0xdddd('0x43')](_0x5b9a81[_0xdddd('0x40')],{'$or':_[_0xdddd('0x44')](_0x5b9a81[_0xdddd('0x39')],function(_0x17f21a){var _0x2ea8d4={};_0x2ea8d4[_0x17f21a]={'$like':'%'+_0x42c7ac['query'][_0xdddd('0x45')]+'%'};return _0x2ea8d4;})});}_0x5b9a81=_[_0xdddd('0x43')]({},_0x5b9a81,_0x42c7ac[_0xdddd('0x46')]);return _0x33139f['getFields'](_0x5b9a81);}})[_0xdddd('0x17')](function(_0x288edb){if(_0x288edb){_0x8f2be=_0x288edb[_0xdddd('0x3c')];if(!_0x42c7ac[_0xdddd('0x36')][_0xdddd('0x3d')](_0xdddd('0x3e'))){_0x5b9a81['limit']=qs[_0xdddd('0x28')](_0x42c7ac['query']['limit']);_0x5b9a81[_0xdddd('0x27')]=qs[_0xdddd('0x27')](_0x42c7ac[_0xdddd('0x36')][_0xdddd('0x27')]);}return _0x33139f[_0xdddd('0x50')](_0x5b9a81);}})[_0xdddd('0x17')](function(_0x39bf4d){if(_0x39bf4d){return _0x39bf4d?{'count':_0x8f2be,'rows':_0x39bf4d}:null;}})[_0xdddd('0x17')](respondWithResult(_0x1f658c,null))[_0xdddd('0x21')](handleError(_0x1f658c,null));};exports[_0xdddd('0x55')]=function(_0x51ade3,_0x121b74,_0x355953){var _0x54b0cb={};var _0x4774f8={};var _0x594710;var _0x3f0b12;return db['FreshdeskConfiguration'][_0xdddd('0x51')]({'where':{'id':_0x51ade3['params']['id']}})[_0xdddd('0x17')](handleEntityNotFound(_0x121b74,null))[_0xdddd('0x17')](function(_0x533528){if(_0x533528){_0x594710=_0x533528;_0x4774f8['model']=_[_0xdddd('0x34')](db[_0xdddd('0x52')]['rawAttributes']);_0x4774f8['query']=_['keys'](_0x51ade3['query']);_0x4774f8[_0xdddd('0x38')]=_[_0xdddd('0x3a')](_0x4774f8['model'],_0x4774f8[_0xdddd('0x36')]);_0x54b0cb[_0xdddd('0x39')]=_[_0xdddd('0x3a')](_0x4774f8[_0xdddd('0x33')],qs[_0xdddd('0x3b')](_0x51ade3[_0xdddd('0x36')][_0xdddd('0x3b')]));_0x54b0cb[_0xdddd('0x39')]=_0x54b0cb[_0xdddd('0x39')][_0xdddd('0x3c')]?_0x54b0cb[_0xdddd('0x39')]:_0x4774f8[_0xdddd('0x33')];_0x54b0cb['order']=qs['sort'](_0x51ade3[_0xdddd('0x36')][_0xdddd('0x54')]);_0x54b0cb[_0xdddd('0x40')]=qs['filters'](_[_0xdddd('0x56')](_0x51ade3[_0xdddd('0x36')],_0x4774f8[_0xdddd('0x38')]));if(_0x51ade3[_0xdddd('0x36')]['filter']){_0x54b0cb['where']=_[_0xdddd('0x43')](_0x54b0cb[_0xdddd('0x40')],{'$or':_[_0xdddd('0x44')](_0x54b0cb[_0xdddd('0x39')],function(_0x2de1e0){var _0x52f916={};_0x52f916[_0x2de1e0]={'$like':'%'+_0x51ade3['query']['filter']+'%'};return _0x52f916;})});}_0x54b0cb=_[_0xdddd('0x43')]({},_0x54b0cb,_0x51ade3[_0xdddd('0x46')]);return _0x594710[_0xdddd('0x55')](_0x54b0cb);}})['then'](function(_0x11a970){if(_0x11a970){_0x3f0b12=_0x11a970[_0xdddd('0x3c')];if(!_0x51ade3[_0xdddd('0x36')][_0xdddd('0x3d')]('nolimit')){_0x54b0cb[_0xdddd('0x28')]=qs[_0xdddd('0x28')](_0x51ade3[_0xdddd('0x36')][_0xdddd('0x28')]);_0x54b0cb[_0xdddd('0x27')]=qs[_0xdddd('0x27')](_0x51ade3[_0xdddd('0x36')][_0xdddd('0x27')]);}return _0x594710[_0xdddd('0x55')](_0x54b0cb);}})[_0xdddd('0x17')](function(_0x21e122){if(_0x21e122){return _0x21e122?{'count':_0x3f0b12,'rows':_0x21e122}:null;}})[_0xdddd('0x17')](respondWithResult(_0x121b74,null))['catch'](handleError(_0x121b74,null));};exports['getDescriptions']=function(_0x417710,_0x49a2c6,_0x25aa1b){var _0x2d8dad={};var _0x42b8d8={};var _0x9eeb19;var _0x2ba53a;return db[_0xdddd('0x32')][_0xdddd('0x51')]({'where':{'id':_0x417710[_0xdddd('0x4f')]['id']}})[_0xdddd('0x17')](handleEntityNotFound(_0x49a2c6,null))['then'](function(_0x5020f0){if(_0x5020f0){_0x9eeb19=_0x5020f0;_0x42b8d8[_0xdddd('0x33')]=_[_0xdddd('0x34')](db[_0xdddd('0x52')][_0xdddd('0x53')]);_0x42b8d8[_0xdddd('0x36')]=_[_0xdddd('0x34')](_0x417710[_0xdddd('0x36')]);_0x42b8d8[_0xdddd('0x38')]=_['intersection'](_0x42b8d8[_0xdddd('0x33')],_0x42b8d8[_0xdddd('0x36')]);_0x2d8dad[_0xdddd('0x39')]=_['intersection'](_0x42b8d8[_0xdddd('0x33')],qs[_0xdddd('0x3b')](_0x417710[_0xdddd('0x36')][_0xdddd('0x3b')]));_0x2d8dad[_0xdddd('0x39')]=_0x2d8dad[_0xdddd('0x39')][_0xdddd('0x3c')]?_0x2d8dad[_0xdddd('0x39')]:_0x42b8d8[_0xdddd('0x33')];_0x2d8dad[_0xdddd('0x3f')]=qs[_0xdddd('0x54')](_0x417710['query'][_0xdddd('0x54')]);_0x2d8dad[_0xdddd('0x40')]=qs[_0xdddd('0x38')](_[_0xdddd('0x56')](_0x417710['query'],_0x42b8d8['filters']));if(_0x417710['query'][_0xdddd('0x45')]){_0x2d8dad['where']=_[_0xdddd('0x43')](_0x2d8dad['where'],{'$or':_['map'](_0x2d8dad['attributes'],function(_0x11d2d5){var _0x23e494={};_0x23e494[_0x11d2d5]={'$like':'%'+_0x417710[_0xdddd('0x36')][_0xdddd('0x45')]+'%'};return _0x23e494;})});}_0x2d8dad=_[_0xdddd('0x43')]({},_0x2d8dad,_0x417710[_0xdddd('0x46')]);return _0x9eeb19[_0xdddd('0x57')](_0x2d8dad);}})[_0xdddd('0x17')](function(_0x261953){if(_0x261953){_0x2ba53a=_0x261953[_0xdddd('0x3c')];if(!_0x417710[_0xdddd('0x36')][_0xdddd('0x3d')]('nolimit')){_0x2d8dad[_0xdddd('0x28')]=qs[_0xdddd('0x28')](_0x417710['query'][_0xdddd('0x28')]);_0x2d8dad['offset']=qs[_0xdddd('0x27')](_0x417710['query']['offset']);}return _0x9eeb19['getDescriptions'](_0x2d8dad);}})[_0xdddd('0x17')](function(_0x40469f){if(_0x40469f){return _0x40469f?{'count':_0x2ba53a,'rows':_0x40469f}:null;}})[_0xdddd('0x17')](respondWithResult(_0x49a2c6,null))[_0xdddd('0x21')](handleError(_0x49a2c6,null));};exports[_0xdddd('0x58')]=function(_0x1313cb,_0x56d68b,_0x95bdb7){var _0x1509d1={};var _0x1dc0aa={};var _0x10f9cf;var _0x43911b;return db[_0xdddd('0x32')][_0xdddd('0x51')]({'where':{'id':_0x1313cb[_0xdddd('0x4f')]['id']}})[_0xdddd('0x17')](handleEntityNotFound(_0x56d68b,null))['then'](function(_0x441245){if(_0x441245){_0x10f9cf=_0x441245;_0x1dc0aa[_0xdddd('0x33')]=_[_0xdddd('0x34')](db[_0xdddd('0x59')][_0xdddd('0x53')]);_0x1dc0aa['query']=_[_0xdddd('0x34')](_0x1313cb['query']);_0x1dc0aa['filters']=_[_0xdddd('0x3a')](_0x1dc0aa[_0xdddd('0x33')],_0x1dc0aa[_0xdddd('0x36')]);_0x1509d1[_0xdddd('0x39')]=_['intersection'](_0x1dc0aa[_0xdddd('0x33')],qs['fields'](_0x1313cb[_0xdddd('0x36')]['fields']));_0x1509d1[_0xdddd('0x39')]=_0x1509d1[_0xdddd('0x39')]['length']?_0x1509d1[_0xdddd('0x39')]:_0x1dc0aa[_0xdddd('0x33')];_0x1509d1[_0xdddd('0x3f')]=qs[_0xdddd('0x54')](_0x1313cb[_0xdddd('0x36')][_0xdddd('0x54')]);_0x1509d1[_0xdddd('0x40')]=qs[_0xdddd('0x38')](_['pick'](_0x1313cb['query'],_0x1dc0aa[_0xdddd('0x38')]));if(_0x1313cb[_0xdddd('0x36')][_0xdddd('0x45')]){_0x1509d1[_0xdddd('0x40')]=_[_0xdddd('0x43')](_0x1509d1[_0xdddd('0x40')],{'$or':_[_0xdddd('0x44')](_0x1509d1[_0xdddd('0x39')],function(_0x385687){var _0x25961a={};_0x25961a[_0x385687]={'$like':'%'+_0x1313cb['query'][_0xdddd('0x45')]+'%'};return _0x25961a;})});}_0x1509d1=_[_0xdddd('0x43')]({},_0x1509d1,_0x1313cb[_0xdddd('0x46')]);return _0x10f9cf[_0xdddd('0x58')](_0x1509d1);}})[_0xdddd('0x17')](function(_0x2c1a1c){if(_0x2c1a1c){_0x43911b=_0x2c1a1c[_0xdddd('0x3c')];if(!_0x1313cb[_0xdddd('0x36')]['hasOwnProperty'](_0xdddd('0x3e'))){_0x1509d1[_0xdddd('0x28')]=qs[_0xdddd('0x28')](_0x1313cb[_0xdddd('0x36')][_0xdddd('0x28')]);_0x1509d1[_0xdddd('0x27')]=qs[_0xdddd('0x27')](_0x1313cb['query']['offset']);}return _0x10f9cf[_0xdddd('0x58')](_0x1509d1);}})[_0xdddd('0x17')](function(_0x1f1426){if(_0x1f1426){return _0x1f1426?{'count':_0x43911b,'rows':_0x1f1426}:null;}})[_0xdddd('0x17')](respondWithResult(_0x56d68b,null))[_0xdddd('0x21')](handleError(_0x56d68b,null));};exports[_0xdddd('0x5a')]=function(_0x569458,_0x16e1ef,_0xbe1fae){if(_0x569458['body']['id']){delete _0x569458[_0xdddd('0x4e')]['id'];}return db[_0xdddd('0x32')][_0xdddd('0x51')]({'where':{'id':_0x569458[_0xdddd('0x4f')]['id']}})['then'](handleEntityNotFound(_0x16e1ef,null))[_0xdddd('0x17')](function(_0x568ecb){if(_0x568ecb){return _0x568ecb[_0xdddd('0x5a')](_0x569458[_0xdddd('0x4e')]['ids']||[]);}return null;})['then'](respondWithResult(_0x16e1ef,null))[_0xdddd('0x21')](handleError(_0x16e1ef,null));}; \ No newline at end of file +var _0xd6f9=['params','intersection','includeAll','find','create','body','FreshdeskField','pick','getFields','hasOwnProperty','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','jayson/promise','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','reject','destroy','stack','name','send','index','rawAttributes','model','query','dateStart','dateEnd','keys','filters','attributes','fields','length','nolimit','order','sort','where','add','day','merge','filter','map','options','FreshdeskConfiguration','include','findAll','rows','show'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xd6f9,0x171));var _0x9d6f=function(_0x12ddb2,_0x5ad61e){_0x12ddb2=_0x12ddb2-0x0;var _0x10b6dd=_0xd6f9[_0x12ddb2];return _0x10b6dd;};'use strict';var pdf=require(_0x9d6f('0x0'));var emlformat=require(_0x9d6f('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9d6f('0x2'));var moment=require(_0x9d6f('0x3'));var BPromise=require(_0x9d6f('0x4'));var Mustache=require(_0x9d6f('0x5'));var util=require(_0x9d6f('0x6'));var path=require(_0x9d6f('0x7'));var sox=require(_0x9d6f('0x8'));var csv=require(_0x9d6f('0x9'));var ejs=require(_0x9d6f('0xa'));var fs=require('fs');var _=require(_0x9d6f('0xb'));var squel=require(_0x9d6f('0xc'));var crypto=require(_0x9d6f('0xd'));var jsforce=require(_0x9d6f('0xe'));var deskjs=require(_0x9d6f('0xf'));var toCsv=require(_0x9d6f('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9d6f('0x10'));var qs=require(_0x9d6f('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x9d6f('0x12'));var db=require(_0x9d6f('0x13'))['db'];var jayson=require(_0x9d6f('0x14'));var client=jayson['client'][_0x9d6f('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x1e00c2,_0x14b391,_0x593fc8,_0x2f6334){return new BPromise(function(_0x102f77,_0x336c6d){var _0x30f506=_0x2f6334||client;return _0x30f506[_0x9d6f('0x16')](_0x1e00c2,_0x593fc8)[_0x9d6f('0x17')](function(_0x3bdc7a){logger['info'](_0x9d6f('0x18'),_0x14b391,'request\x20sent');logger[_0x9d6f('0x19')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x14b391,_0x9d6f('0x1a'),JSON[_0x9d6f('0x1b')](_0x3bdc7a));if(_0x3bdc7a[_0x9d6f('0x1c')]){if(_0x3bdc7a[_0x9d6f('0x1c')]['code']===0x1f4){logger['error'](_0x9d6f('0x18'),_0x14b391,_0x3bdc7a[_0x9d6f('0x1c')][_0x9d6f('0x1d')]);return _0x336c6d(_0x3bdc7a[_0x9d6f('0x1c')]['message']);}logger[_0x9d6f('0x1c')](_0x9d6f('0x18'),_0x14b391,_0x3bdc7a[_0x9d6f('0x1c')][_0x9d6f('0x1d')]);return _0x102f77(_0x3bdc7a[_0x9d6f('0x1c')][_0x9d6f('0x1d')]);}else{logger['info'](_0x9d6f('0x18'),_0x14b391,_0x9d6f('0x1a'));_0x102f77(_0x3bdc7a[_0x9d6f('0x1e')][_0x9d6f('0x1d')]);}})[_0x9d6f('0x1f')](function(_0x376756){logger['error'](_0x9d6f('0x18'),_0x14b391,_0x376756);_0x336c6d(_0x376756);});});}function respondWithStatusCode(_0x1c7047,_0xb0d32){_0xb0d32=_0xb0d32||0xcc;return function(_0x16d180){if(_0x16d180){return _0x1c7047[_0x9d6f('0x20')](_0xb0d32);}return _0x1c7047[_0x9d6f('0x21')](_0xb0d32)[_0x9d6f('0x22')]();};}function respondWithResult(_0x1dfd27,_0x4afdea){_0x4afdea=_0x4afdea||0xc8;return function(_0x1c9123){if(_0x1c9123){return _0x1dfd27[_0x9d6f('0x21')](_0x4afdea)[_0x9d6f('0x23')](_0x1c9123);}};}function respondWithFilteredResult(_0x1adf60,_0x1fde08){return function(_0x324bdb){if(_0x324bdb){var _0x4f805c=_0x324bdb[_0x9d6f('0x24')],_0x5e2a05=_0x1fde08[_0x9d6f('0x25')],_0x2c4a74=_0x1fde08[_0x9d6f('0x25')]+_0x1fde08[_0x9d6f('0x26')],_0x268933;if(_0x2c4a74>=_0x4f805c){_0x2c4a74=_0x4f805c;_0x268933=0xc8;}else{_0x268933=0xce;}_0x1adf60[_0x9d6f('0x21')](_0x268933);return _0x1adf60[_0x9d6f('0x27')]('Content-Range',_0x5e2a05+'-'+_0x2c4a74+'/'+_0x4f805c)[_0x9d6f('0x23')](_0x324bdb);}return null;};}function patchUpdates(_0xe555e6){return function(_0x48d778){try{jsonpatch['apply'](_0x48d778,_0xe555e6,!![]);}catch(_0x38a2d5){return BPromise[_0x9d6f('0x28')](_0x38a2d5);}return _0x48d778['save']();};}function saveUpdates(_0x2a83ae,_0x20b9f1){return function(_0x3c9a5d){if(_0x3c9a5d){return _0x3c9a5d['update'](_0x2a83ae)[_0x9d6f('0x17')](function(_0xdb7241){return _0xdb7241;});}return null;};}function removeEntity(_0x2507cf,_0x3c9295){return function(_0x5886a5){if(_0x5886a5){return _0x5886a5[_0x9d6f('0x29')]()[_0x9d6f('0x17')](function(){_0x2507cf[_0x9d6f('0x21')](0xcc)[_0x9d6f('0x22')]();});}};}function handleEntityNotFound(_0x395193,_0x2a73d1){return function(_0x163f75){if(!_0x163f75){_0x395193[_0x9d6f('0x20')](0x194);}return _0x163f75;};}function handleError(_0x782875,_0x5e72fe){_0x5e72fe=_0x5e72fe||0x1f4;return function(_0x4bcdfc){logger[_0x9d6f('0x1c')](_0x4bcdfc[_0x9d6f('0x2a')]);if(_0x4bcdfc[_0x9d6f('0x2b')]){delete _0x4bcdfc[_0x9d6f('0x2b')];}_0x782875[_0x9d6f('0x21')](_0x5e72fe)[_0x9d6f('0x2c')](_0x4bcdfc);};}exports[_0x9d6f('0x2d')]=function(_0x178668,_0x50a5f9){var _0x51fc05={},_0x341671={},_0x4247ef={'count':0x0,'rows':[]};var _0x498567=db['FreshdeskConfiguration'][_0x9d6f('0x2e')];_0x341671[_0x9d6f('0x2f')]=_['keys'](_0x498567);var _0x5539ea={'dateStart':_0x178668[_0x9d6f('0x30')][_0x9d6f('0x31')],'dateEnd':_0x178668[_0x9d6f('0x30')][_0x9d6f('0x32')]};delete _0x178668[_0x9d6f('0x30')]['dateStart'];delete _0x178668[_0x9d6f('0x30')]['dateEnd'];_0x341671[_0x9d6f('0x30')]=_[_0x9d6f('0x33')](_0x178668[_0x9d6f('0x30')]);_0x341671[_0x9d6f('0x34')]=_['intersection'](_0x341671['model'],_0x341671[_0x9d6f('0x30')]);_0x51fc05[_0x9d6f('0x35')]=_['intersection'](_0x341671['model'],qs['fields'](_0x178668[_0x9d6f('0x30')][_0x9d6f('0x36')]));_0x51fc05['attributes']=_0x51fc05[_0x9d6f('0x35')][_0x9d6f('0x37')]?_0x51fc05[_0x9d6f('0x35')]:_0x341671[_0x9d6f('0x2f')];if(!_0x178668[_0x9d6f('0x30')]['hasOwnProperty'](_0x9d6f('0x38'))){_0x51fc05[_0x9d6f('0x26')]=qs['limit'](_0x178668['query'][_0x9d6f('0x26')]);_0x51fc05[_0x9d6f('0x25')]=qs[_0x9d6f('0x25')](_0x178668[_0x9d6f('0x30')][_0x9d6f('0x25')]);}_0x51fc05[_0x9d6f('0x39')]=qs[_0x9d6f('0x3a')](_0x178668[_0x9d6f('0x30')][_0x9d6f('0x3a')]);_0x51fc05[_0x9d6f('0x3b')]=qs[_0x9d6f('0x34')](_['pick'](_0x178668[_0x9d6f('0x30')],_0x341671[_0x9d6f('0x34')]));if(_0x5539ea[_0x9d6f('0x31')]){if(_0x5539ea['dateEnd']){_0x5539ea[_0x9d6f('0x32')]=moment(_0x5539ea['dateEnd'])[_0x9d6f('0x3c')](0x1,_0x9d6f('0x3d'));}else{_0x5539ea[_0x9d6f('0x32')]=moment(_0x5539ea[_0x9d6f('0x31')])[_0x9d6f('0x3c')](0x1,_0x9d6f('0x3d'));}_[_0x9d6f('0x3e')](_0x51fc05[_0x9d6f('0x3b')],{'createdAt':{'$gte':_0x5539ea['dateStart'],'$lte':_0x5539ea[_0x9d6f('0x32')]}});}if(_0x178668[_0x9d6f('0x30')][_0x9d6f('0x3f')]){_0x51fc05[_0x9d6f('0x3b')]=_['merge'](_0x51fc05[_0x9d6f('0x3b')],{'$or':_[_0x9d6f('0x40')](_0x51fc05[_0x9d6f('0x35')],function(_0x3ed045){var _0x4284bd={};_0x4284bd[_0x3ed045]={'$like':'%'+_0x178668[_0x9d6f('0x30')][_0x9d6f('0x3f')]+'%'};return _0x4284bd;})});}_0x51fc05=_[_0x9d6f('0x3e')]({},_0x51fc05,_0x178668[_0x9d6f('0x41')]);var _0x33ab3c={'where':_0x51fc05[_0x9d6f('0x3b')]};return db[_0x9d6f('0x42')]['count'](_0x33ab3c)[_0x9d6f('0x17')](function(_0x4a3708){_0x4247ef[_0x9d6f('0x24')]=_0x4a3708;if(_0x178668['query']['includeAll']){_0x51fc05[_0x9d6f('0x43')]=[{'all':!![]}];}return db[_0x9d6f('0x42')][_0x9d6f('0x44')](_0x51fc05);})[_0x9d6f('0x17')](function(_0x11e9de){_0x4247ef[_0x9d6f('0x45')]=_0x11e9de;return _0x4247ef;})[_0x9d6f('0x17')](respondWithFilteredResult(_0x50a5f9,_0x51fc05))[_0x9d6f('0x1f')](handleError(_0x50a5f9,null));};exports[_0x9d6f('0x46')]=function(_0x1fde4c,_0x2a2c60){var _0x19231d={'raw':![],'where':{'id':_0x1fde4c[_0x9d6f('0x47')]['id']}},_0x30426c={};_0x30426c[_0x9d6f('0x2f')]=_['keys'](db[_0x9d6f('0x42')]['rawAttributes']);_0x30426c['query']=_[_0x9d6f('0x33')](_0x1fde4c[_0x9d6f('0x30')]);_0x30426c[_0x9d6f('0x34')]=_[_0x9d6f('0x48')](_0x30426c[_0x9d6f('0x2f')],_0x30426c['query']);_0x19231d[_0x9d6f('0x35')]=_[_0x9d6f('0x48')](_0x30426c[_0x9d6f('0x2f')],qs[_0x9d6f('0x36')](_0x1fde4c[_0x9d6f('0x30')][_0x9d6f('0x36')]));_0x19231d[_0x9d6f('0x35')]=_0x19231d[_0x9d6f('0x35')][_0x9d6f('0x37')]?_0x19231d[_0x9d6f('0x35')]:_0x30426c[_0x9d6f('0x2f')];if(_0x1fde4c[_0x9d6f('0x30')][_0x9d6f('0x49')]){_0x19231d[_0x9d6f('0x43')]=[{'all':!![]}];}_0x19231d=_[_0x9d6f('0x3e')]({},_0x19231d,_0x1fde4c['options']);return db[_0x9d6f('0x42')][_0x9d6f('0x4a')](_0x19231d)[_0x9d6f('0x17')](handleEntityNotFound(_0x2a2c60,null))[_0x9d6f('0x17')](respondWithResult(_0x2a2c60,null))['catch'](handleError(_0x2a2c60,null));};exports[_0x9d6f('0x4b')]=function(_0x8d9a19,_0x5dc3f2){return db['FreshdeskConfiguration'][_0x9d6f('0x4b')](_0x8d9a19['body'],{})[_0x9d6f('0x17')](respondWithResult(_0x5dc3f2,0xc9))['catch'](handleError(_0x5dc3f2,null));};exports['update']=function(_0x153ba4,_0x555d29){if(_0x153ba4[_0x9d6f('0x4c')]['id']){delete _0x153ba4[_0x9d6f('0x4c')]['id'];}return db['FreshdeskConfiguration'][_0x9d6f('0x4a')]({'where':{'id':_0x153ba4[_0x9d6f('0x47')]['id']}})[_0x9d6f('0x17')](handleEntityNotFound(_0x555d29,null))[_0x9d6f('0x17')](saveUpdates(_0x153ba4[_0x9d6f('0x4c')],null))[_0x9d6f('0x17')](respondWithResult(_0x555d29,null))[_0x9d6f('0x1f')](handleError(_0x555d29,null));};exports[_0x9d6f('0x29')]=function(_0x392d42,_0x50b199){return db[_0x9d6f('0x42')][_0x9d6f('0x4a')]({'where':{'id':_0x392d42[_0x9d6f('0x47')]['id']}})[_0x9d6f('0x17')](handleEntityNotFound(_0x50b199,null))[_0x9d6f('0x17')](removeEntity(_0x50b199,null))[_0x9d6f('0x1f')](handleError(_0x50b199,null));};exports['getFields']=function(_0x58b299,_0x185d02,_0x1209a8){var _0x1a8784={};var _0x3844d9={};var _0x58665f;var _0x348968;return db[_0x9d6f('0x42')]['findOne']({'where':{'id':_0x58b299['params']['id']}})[_0x9d6f('0x17')](handleEntityNotFound(_0x185d02,null))[_0x9d6f('0x17')](function(_0x35039c){if(_0x35039c){_0x58665f=_0x35039c;_0x3844d9[_0x9d6f('0x2f')]=_[_0x9d6f('0x33')](db[_0x9d6f('0x4d')][_0x9d6f('0x2e')]);_0x3844d9[_0x9d6f('0x30')]=_[_0x9d6f('0x33')](_0x58b299[_0x9d6f('0x30')]);_0x3844d9[_0x9d6f('0x34')]=_['intersection'](_0x3844d9[_0x9d6f('0x2f')],_0x3844d9[_0x9d6f('0x30')]);_0x1a8784[_0x9d6f('0x35')]=_[_0x9d6f('0x48')](_0x3844d9[_0x9d6f('0x2f')],qs[_0x9d6f('0x36')](_0x58b299[_0x9d6f('0x30')][_0x9d6f('0x36')]));_0x1a8784[_0x9d6f('0x35')]=_0x1a8784[_0x9d6f('0x35')]['length']?_0x1a8784[_0x9d6f('0x35')]:_0x3844d9[_0x9d6f('0x2f')];_0x1a8784['order']=qs['sort'](_0x58b299[_0x9d6f('0x30')][_0x9d6f('0x3a')]);_0x1a8784[_0x9d6f('0x3b')]=qs[_0x9d6f('0x34')](_[_0x9d6f('0x4e')](_0x58b299['query'],_0x3844d9[_0x9d6f('0x34')]));if(_0x58b299[_0x9d6f('0x30')]['filter']){_0x1a8784[_0x9d6f('0x3b')]=_[_0x9d6f('0x3e')](_0x1a8784[_0x9d6f('0x3b')],{'$or':_[_0x9d6f('0x40')](_0x1a8784['attributes'],function(_0x5c4352){var _0x4a8759={};_0x4a8759[_0x5c4352]={'$like':'%'+_0x58b299['query']['filter']+'%'};return _0x4a8759;})});}_0x1a8784=_[_0x9d6f('0x3e')]({},_0x1a8784,_0x58b299[_0x9d6f('0x41')]);return _0x58665f[_0x9d6f('0x4f')](_0x1a8784);}})[_0x9d6f('0x17')](function(_0x21ec77){if(_0x21ec77){_0x348968=_0x21ec77[_0x9d6f('0x37')];if(!_0x58b299[_0x9d6f('0x30')][_0x9d6f('0x50')]('nolimit')){_0x1a8784[_0x9d6f('0x26')]=qs[_0x9d6f('0x26')](_0x58b299[_0x9d6f('0x30')][_0x9d6f('0x26')]);_0x1a8784[_0x9d6f('0x25')]=qs[_0x9d6f('0x25')](_0x58b299[_0x9d6f('0x30')][_0x9d6f('0x25')]);}return _0x58665f[_0x9d6f('0x4f')](_0x1a8784);}})[_0x9d6f('0x17')](function(_0x344867){if(_0x344867){return _0x344867?{'count':_0x348968,'rows':_0x344867}:null;}})[_0x9d6f('0x17')](respondWithResult(_0x185d02,null))[_0x9d6f('0x1f')](handleError(_0x185d02,null));};exports[_0x9d6f('0x51')]=function(_0x3ba2aa,_0x1a81f1,_0x57d041){var _0x599b0d={};var _0x4513b5={};var _0x1b0873;var _0x550f71;return db[_0x9d6f('0x42')][_0x9d6f('0x52')]({'where':{'id':_0x3ba2aa['params']['id']}})['then'](handleEntityNotFound(_0x1a81f1,null))['then'](function(_0x42b0e0){if(_0x42b0e0){_0x1b0873=_0x42b0e0;_0x4513b5[_0x9d6f('0x2f')]=_[_0x9d6f('0x33')](db[_0x9d6f('0x4d')][_0x9d6f('0x2e')]);_0x4513b5[_0x9d6f('0x30')]=_[_0x9d6f('0x33')](_0x3ba2aa[_0x9d6f('0x30')]);_0x4513b5[_0x9d6f('0x34')]=_[_0x9d6f('0x48')](_0x4513b5[_0x9d6f('0x2f')],_0x4513b5[_0x9d6f('0x30')]);_0x599b0d[_0x9d6f('0x35')]=_[_0x9d6f('0x48')](_0x4513b5[_0x9d6f('0x2f')],qs['fields'](_0x3ba2aa[_0x9d6f('0x30')][_0x9d6f('0x36')]));_0x599b0d['attributes']=_0x599b0d['attributes'][_0x9d6f('0x37')]?_0x599b0d[_0x9d6f('0x35')]:_0x4513b5[_0x9d6f('0x2f')];_0x599b0d[_0x9d6f('0x39')]=qs['sort'](_0x3ba2aa[_0x9d6f('0x30')][_0x9d6f('0x3a')]);_0x599b0d[_0x9d6f('0x3b')]=qs[_0x9d6f('0x34')](_[_0x9d6f('0x4e')](_0x3ba2aa['query'],_0x4513b5[_0x9d6f('0x34')]));if(_0x3ba2aa[_0x9d6f('0x30')][_0x9d6f('0x3f')]){_0x599b0d[_0x9d6f('0x3b')]=_[_0x9d6f('0x3e')](_0x599b0d['where'],{'$or':_['map'](_0x599b0d['attributes'],function(_0x5bdd55){var _0x427e29={};_0x427e29[_0x5bdd55]={'$like':'%'+_0x3ba2aa[_0x9d6f('0x30')][_0x9d6f('0x3f')]+'%'};return _0x427e29;})});}_0x599b0d=_[_0x9d6f('0x3e')]({},_0x599b0d,_0x3ba2aa[_0x9d6f('0x41')]);return _0x1b0873[_0x9d6f('0x51')](_0x599b0d);}})['then'](function(_0x4d2034){if(_0x4d2034){_0x550f71=_0x4d2034[_0x9d6f('0x37')];if(!_0x3ba2aa[_0x9d6f('0x30')][_0x9d6f('0x50')](_0x9d6f('0x38'))){_0x599b0d[_0x9d6f('0x26')]=qs['limit'](_0x3ba2aa[_0x9d6f('0x30')][_0x9d6f('0x26')]);_0x599b0d[_0x9d6f('0x25')]=qs[_0x9d6f('0x25')](_0x3ba2aa['query'][_0x9d6f('0x25')]);}return _0x1b0873['getSubjects'](_0x599b0d);}})['then'](function(_0x51c19f){if(_0x51c19f){return _0x51c19f?{'count':_0x550f71,'rows':_0x51c19f}:null;}})[_0x9d6f('0x17')](respondWithResult(_0x1a81f1,null))['catch'](handleError(_0x1a81f1,null));};exports['getDescriptions']=function(_0x1d4813,_0x458a73,_0x27112e){var _0x2a8c16={};var _0x36c2e1={};var _0x2f39fe;var _0x1f0863;return db[_0x9d6f('0x42')][_0x9d6f('0x52')]({'where':{'id':_0x1d4813[_0x9d6f('0x47')]['id']}})[_0x9d6f('0x17')](handleEntityNotFound(_0x458a73,null))[_0x9d6f('0x17')](function(_0x3dd5e7){if(_0x3dd5e7){_0x2f39fe=_0x3dd5e7;_0x36c2e1[_0x9d6f('0x2f')]=_[_0x9d6f('0x33')](db[_0x9d6f('0x4d')][_0x9d6f('0x2e')]);_0x36c2e1['query']=_[_0x9d6f('0x33')](_0x1d4813[_0x9d6f('0x30')]);_0x36c2e1[_0x9d6f('0x34')]=_[_0x9d6f('0x48')](_0x36c2e1['model'],_0x36c2e1[_0x9d6f('0x30')]);_0x2a8c16[_0x9d6f('0x35')]=_[_0x9d6f('0x48')](_0x36c2e1[_0x9d6f('0x2f')],qs[_0x9d6f('0x36')](_0x1d4813[_0x9d6f('0x30')]['fields']));_0x2a8c16[_0x9d6f('0x35')]=_0x2a8c16['attributes'][_0x9d6f('0x37')]?_0x2a8c16['attributes']:_0x36c2e1[_0x9d6f('0x2f')];_0x2a8c16[_0x9d6f('0x39')]=qs[_0x9d6f('0x3a')](_0x1d4813[_0x9d6f('0x30')][_0x9d6f('0x3a')]);_0x2a8c16[_0x9d6f('0x3b')]=qs[_0x9d6f('0x34')](_[_0x9d6f('0x4e')](_0x1d4813[_0x9d6f('0x30')],_0x36c2e1[_0x9d6f('0x34')]));if(_0x1d4813[_0x9d6f('0x30')]['filter']){_0x2a8c16['where']=_[_0x9d6f('0x3e')](_0x2a8c16[_0x9d6f('0x3b')],{'$or':_[_0x9d6f('0x40')](_0x2a8c16[_0x9d6f('0x35')],function(_0x2a69c3){var _0x5cdb2e={};_0x5cdb2e[_0x2a69c3]={'$like':'%'+_0x1d4813[_0x9d6f('0x30')]['filter']+'%'};return _0x5cdb2e;})});}_0x2a8c16=_[_0x9d6f('0x3e')]({},_0x2a8c16,_0x1d4813[_0x9d6f('0x41')]);return _0x2f39fe[_0x9d6f('0x53')](_0x2a8c16);}})[_0x9d6f('0x17')](function(_0xfebc6e){if(_0xfebc6e){_0x1f0863=_0xfebc6e['length'];if(!_0x1d4813[_0x9d6f('0x30')][_0x9d6f('0x50')](_0x9d6f('0x38'))){_0x2a8c16[_0x9d6f('0x26')]=qs[_0x9d6f('0x26')](_0x1d4813['query']['limit']);_0x2a8c16[_0x9d6f('0x25')]=qs['offset'](_0x1d4813[_0x9d6f('0x30')][_0x9d6f('0x25')]);}return _0x2f39fe['getDescriptions'](_0x2a8c16);}})[_0x9d6f('0x17')](function(_0x226821){if(_0x226821){return _0x226821?{'count':_0x1f0863,'rows':_0x226821}:null;}})[_0x9d6f('0x17')](respondWithResult(_0x458a73,null))[_0x9d6f('0x1f')](handleError(_0x458a73,null));};exports[_0x9d6f('0x54')]=function(_0x4698d8,_0x327983,_0x10d679){var _0x598e85={};var _0x291939={};var _0x210b38;var _0x5a57b5;return db[_0x9d6f('0x42')][_0x9d6f('0x52')]({'where':{'id':_0x4698d8[_0x9d6f('0x47')]['id']}})['then'](handleEntityNotFound(_0x327983,null))['then'](function(_0x5b6491){if(_0x5b6491){_0x210b38=_0x5b6491;_0x291939[_0x9d6f('0x2f')]=_[_0x9d6f('0x33')](db[_0x9d6f('0x55')][_0x9d6f('0x2e')]);_0x291939[_0x9d6f('0x30')]=_[_0x9d6f('0x33')](_0x4698d8[_0x9d6f('0x30')]);_0x291939[_0x9d6f('0x34')]=_[_0x9d6f('0x48')](_0x291939[_0x9d6f('0x2f')],_0x291939['query']);_0x598e85[_0x9d6f('0x35')]=_[_0x9d6f('0x48')](_0x291939[_0x9d6f('0x2f')],qs['fields'](_0x4698d8[_0x9d6f('0x30')][_0x9d6f('0x36')]));_0x598e85['attributes']=_0x598e85[_0x9d6f('0x35')][_0x9d6f('0x37')]?_0x598e85['attributes']:_0x291939[_0x9d6f('0x2f')];_0x598e85['order']=qs[_0x9d6f('0x3a')](_0x4698d8[_0x9d6f('0x30')][_0x9d6f('0x3a')]);_0x598e85['where']=qs[_0x9d6f('0x34')](_[_0x9d6f('0x4e')](_0x4698d8[_0x9d6f('0x30')],_0x291939[_0x9d6f('0x34')]));if(_0x4698d8[_0x9d6f('0x30')][_0x9d6f('0x3f')]){_0x598e85['where']=_[_0x9d6f('0x3e')](_0x598e85[_0x9d6f('0x3b')],{'$or':_[_0x9d6f('0x40')](_0x598e85['attributes'],function(_0x1fed77){var _0x59d3ef={};_0x59d3ef[_0x1fed77]={'$like':'%'+_0x4698d8['query']['filter']+'%'};return _0x59d3ef;})});}_0x598e85=_['merge']({},_0x598e85,_0x4698d8[_0x9d6f('0x41')]);return _0x210b38[_0x9d6f('0x54')](_0x598e85);}})[_0x9d6f('0x17')](function(_0x1e0870){if(_0x1e0870){_0x5a57b5=_0x1e0870[_0x9d6f('0x37')];if(!_0x4698d8[_0x9d6f('0x30')]['hasOwnProperty'](_0x9d6f('0x38'))){_0x598e85[_0x9d6f('0x26')]=qs[_0x9d6f('0x26')](_0x4698d8[_0x9d6f('0x30')]['limit']);_0x598e85[_0x9d6f('0x25')]=qs[_0x9d6f('0x25')](_0x4698d8[_0x9d6f('0x30')][_0x9d6f('0x25')]);}return _0x210b38['getTags'](_0x598e85);}})[_0x9d6f('0x17')](function(_0xc2d53a){if(_0xc2d53a){return _0xc2d53a?{'count':_0x5a57b5,'rows':_0xc2d53a}:null;}})[_0x9d6f('0x17')](respondWithResult(_0x327983,null))[_0x9d6f('0x1f')](handleError(_0x327983,null));};exports['setTags']=function(_0x44f119,_0x5abdf9,_0x39d2a2){if(_0x44f119[_0x9d6f('0x4c')]['id']){delete _0x44f119[_0x9d6f('0x4c')]['id'];}return db[_0x9d6f('0x42')][_0x9d6f('0x52')]({'where':{'id':_0x44f119[_0x9d6f('0x47')]['id']}})[_0x9d6f('0x17')](handleEntityNotFound(_0x5abdf9,null))[_0x9d6f('0x17')](function(_0x2bc6b2){if(_0x2bc6b2){return _0x2bc6b2[_0x9d6f('0x56')](_0x44f119[_0x9d6f('0x4c')][_0x9d6f('0x57')]||[]);}return null;})[_0x9d6f('0x17')](respondWithResult(_0x5abdf9,null))[_0x9d6f('0x1f')](handleError(_0x5abdf9,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 531033d..afde079 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 _0xca54=['./intFreshdeskConfiguration.attributes','define','int_freshdesk_configurations','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xca54,0x9c));var _0x4ca5=function(_0x85ef00,_0x40651f){_0x85ef00=_0x85ef00-0x0;var _0x414904=_0xca54[_0x85ef00];return _0x414904;};'use strict';var _=require('lodash');var util=require(_0x4ca5('0x0'));var logger=require(_0x4ca5('0x1'))(_0x4ca5('0x2'));var moment=require(_0x4ca5('0x3'));var BPromise=require(_0x4ca5('0x4'));var rp=require(_0x4ca5('0x5'));var attributes=require(_0x4ca5('0x6'));module['exports']=function(_0x44ec90,_0x4e3ca5){return _0x44ec90[_0x4ca5('0x7')]('FreshdeskConfiguration',attributes,{'tableName':_0x4ca5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2cde=['../../config/logger','api','moment','bluebird','request-promise','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','lodash','util'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x2cde,0x1ed));var _0xe2cd=function(_0x4a3168,_0x494f38){_0x4a3168=_0x4a3168-0x0;var _0x35c154=_0x2cde[_0x4a3168];return _0x35c154;};'use strict';var _=require(_0xe2cd('0x0'));var util=require(_0xe2cd('0x1'));var logger=require(_0xe2cd('0x2'))(_0xe2cd('0x3'));var moment=require(_0xe2cd('0x4'));var BPromise=require(_0xe2cd('0x5'));var rp=require(_0xe2cd('0x6'));var attributes=require(_0xe2cd('0x7'));module[_0xe2cd('0x8')]=function(_0xae6ee3,_0x4ff5ce){return _0xae6ee3[_0xe2cd('0x9')](_0xe2cd('0xa'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 8e24e03..8b5cd02 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 _0x6cc8=['rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x6cc8,0x13a));var _0x86cc=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x6cc8[_0x298ed3];return _0x5aad28;};'use strict';var _=require('lodash');var util=require(_0x86cc('0x0'));var moment=require(_0x86cc('0x1'));var BPromise=require('bluebird');var rs=require(_0x86cc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86cc('0x3'))['db'];var utils=require(_0x86cc('0x4'));var logger=require(_0x86cc('0x5'))(_0x86cc('0x6'));var config=require(_0x86cc('0x7'));var jayson=require(_0x86cc('0x8'));var client=jayson[_0x86cc('0x9')][_0x86cc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4269c5,_0x257dc5,_0x4922e4){return new BPromise(function(_0x6094b1,_0x6c868d){return client['request'](_0x4269c5,_0x4922e4)[_0x86cc('0xb')](function(_0x24e883){logger[_0x86cc('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x257dc5,_0x86cc('0xd'));logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x257dc5,_0x86cc('0xd'),JSON['stringify'](_0x24e883));if(_0x24e883[_0x86cc('0xe')]){if(_0x24e883[_0x86cc('0xe')][_0x86cc('0xf')]===0x1f4){logger[_0x86cc('0xe')](_0x86cc('0x10'),_0x257dc5,_0x24e883['error']['message']);return _0x6c868d(_0x24e883['error'][_0x86cc('0x11')]);}logger['error'](_0x86cc('0x10'),_0x257dc5,_0x24e883[_0x86cc('0xe')][_0x86cc('0x11')]);return _0x6094b1(_0x24e883[_0x86cc('0xe')][_0x86cc('0x11')]);}else{logger[_0x86cc('0xc')](_0x86cc('0x10'),_0x257dc5,_0x86cc('0xd'));_0x6094b1(_0x24e883[_0x86cc('0x12')]['message']);}})[_0x86cc('0x13')](function(_0x380aa1){logger[_0x86cc('0xe')](_0x86cc('0x10'),_0x257dc5,_0x380aa1);_0x6c868d(_0x380aa1);});});} \ No newline at end of file +var _0xa894=['client','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x648163,_0x241576){var _0x199d4d=function(_0x23055d){while(--_0x23055d){_0x648163['push'](_0x648163['shift']());}};_0x199d4d(++_0x241576);}(_0xa894,0x150));var _0x4a89=function(_0x21cc4e,_0x24a7ac){_0x21cc4e=_0x21cc4e-0x0;var _0x3b7125=_0xa894[_0x21cc4e];return _0x3b7125;};'use strict';var _=require(_0x4a89('0x0'));var util=require(_0x4a89('0x1'));var moment=require('moment');var BPromise=require(_0x4a89('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a89('0x3'))['db'];var utils=require(_0x4a89('0x4'));var logger=require(_0x4a89('0x5'))(_0x4a89('0x6'));var config=require(_0x4a89('0x7'));var jayson=require(_0x4a89('0x8'));var client=jayson[_0x4a89('0x9')][_0x4a89('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x232506,_0x29db63,_0x34832a){return new BPromise(function(_0x1a4db5,_0x580651){return client[_0x4a89('0xb')](_0x232506,_0x34832a)[_0x4a89('0xc')](function(_0x4dbf59){logger['info'](_0x4a89('0xd'),_0x29db63,_0x4a89('0xe'));logger[_0x4a89('0xf')](_0x4a89('0x10'),_0x29db63,_0x4a89('0xe'),JSON[_0x4a89('0x11')](_0x4dbf59));if(_0x4dbf59['error']){if(_0x4dbf59['error'][_0x4a89('0x12')]===0x1f4){logger[_0x4a89('0x13')](_0x4a89('0xd'),_0x29db63,_0x4dbf59[_0x4a89('0x13')][_0x4a89('0x14')]);return _0x580651(_0x4dbf59[_0x4a89('0x13')][_0x4a89('0x14')]);}logger[_0x4a89('0x13')](_0x4a89('0xd'),_0x29db63,_0x4dbf59['error'][_0x4a89('0x14')]);return _0x1a4db5(_0x4dbf59[_0x4a89('0x13')][_0x4a89('0x14')]);}else{logger[_0x4a89('0x15')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x29db63,_0x4a89('0xe'));_0x1a4db5(_0x4dbf59['result']['message']);}})[_0x4a89('0x16')](function(_0x15958a){logger[_0x4a89('0x13')](_0x4a89('0xd'),_0x29db63,_0x15958a);_0x580651(_0x15958a);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 402640e..ae9be8d 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 _0x55ec=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0xa7bc93,_0x443adb){var _0x443414=function(_0x3a05e5){while(--_0x3a05e5){_0xa7bc93['push'](_0xa7bc93['shift']());}};_0x443414(++_0x443adb);}(_0x55ec,0x9a));var _0xc55e=function(_0x50e40b,_0x338d17){_0x50e40b=_0x50e40b-0x0;var _0x2608b7=_0x55ec[_0x50e40b];return _0x2608b7;};'use strict';var multer=require(_0xc55e('0x0'));var util=require(_0xc55e('0x1'));var path=require(_0xc55e('0x2'));var timeout=require(_0xc55e('0x3'));var express=require(_0xc55e('0x4'));var router=express[_0xc55e('0x5')]();var auth=require(_0xc55e('0x6'));var interaction=require(_0xc55e('0x7'));var config=require(_0xc55e('0x8'));var controller=require('./intFreshdeskField.controller');router[_0xc55e('0x9')]('/',auth[_0xc55e('0xa')](),controller[_0xc55e('0xb')]);router['get'](_0xc55e('0xc'),auth[_0xc55e('0xa')](),controller[_0xc55e('0xd')]);router[_0xc55e('0xe')]('/',auth[_0xc55e('0xa')](),controller[_0xc55e('0xf')]);router[_0xc55e('0x10')](_0xc55e('0xc'),auth[_0xc55e('0xa')](),controller[_0xc55e('0x11')]);router[_0xc55e('0x12')](_0xc55e('0xc'),auth[_0xc55e('0xa')](),controller[_0xc55e('0x13')]);module[_0xc55e('0x14')]=router; \ No newline at end of file +var _0x24b7=['/:id','update','delete','destroy','multer','path','express','Router','../../components/interaction/service','./intFreshdeskField.controller','index','get','isAuthenticated','post','create'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x24b7,0x103));var _0x724b=function(_0x4f16ab,_0x530bee){_0x4f16ab=_0x4f16ab-0x0;var _0x406c4b=_0x24b7[_0x4f16ab];return _0x406c4b;};'use strict';var multer=require(_0x724b('0x0'));var util=require('util');var path=require(_0x724b('0x1'));var timeout=require('connect-timeout');var express=require(_0x724b('0x2'));var router=express[_0x724b('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x724b('0x4'));var config=require('../../config/environment');var controller=require(_0x724b('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x724b('0x6')]);router[_0x724b('0x7')]('/:id',auth[_0x724b('0x8')](),controller['show']);router[_0x724b('0x9')]('/',auth[_0x724b('0x8')](),controller[_0x724b('0xa')]);router['put'](_0x724b('0xb'),auth[_0x724b('0x8')](),controller[_0x724b('0xc')]);router[_0x724b('0xd')](_0x724b('0xb'),auth[_0x724b('0x8')](),controller[_0x724b('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 378d41b..a000195 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 _0x9bde=['BOOLEAN','exports','string','customVariable','keyValue','STRING','ENUM'];(function(_0x3f3bad,_0x193f06){var _0x4f0801=function(_0x5cfd32){while(--_0x5cfd32){_0x3f3bad['push'](_0x3f3bad['shift']());}};_0x4f0801(++_0x193f06);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4146eb,_0xf207){_0x4146eb=_0x4146eb-0x0;var _0x39e7b1=_0x9bde[_0x4146eb];return _0x39e7b1;};'use strict';var Sequelize=require('sequelize');module[_0xe9bd('0x0')]={'type':{'type':Sequelize['ENUM'](_0xe9bd('0x1'),'variable',_0xe9bd('0x2'),_0xe9bd('0x3')),'defaultValue':_0xe9bd('0x1')},'content':{'type':Sequelize[_0xe9bd('0x4')]},'key':{'type':Sequelize[_0xe9bd('0x4')]},'keyType':{'type':Sequelize[_0xe9bd('0x5')](_0xe9bd('0x1'),'variable',_0xe9bd('0x2'))},'keyContent':{'type':Sequelize[_0xe9bd('0x4')]},'idField':{'type':Sequelize[_0xe9bd('0x4')]},'nameField':{'type':Sequelize[_0xe9bd('0x4')]},'customField':{'type':Sequelize[_0xe9bd('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe9bd('0x4')]}}; \ No newline at end of file +var _0x5b02=['BOOLEAN','sequelize','exports','ENUM','string','keyValue','STRING','variable'];(function(_0x347a30,_0x318e1f){var _0x3ff2b5=function(_0xaca8e6){while(--_0xaca8e6){_0x347a30['push'](_0x347a30['shift']());}};_0x3ff2b5(++_0x318e1f);}(_0x5b02,0xe9));var _0x25b0=function(_0x253bee,_0x2b153c){_0x253bee=_0x253bee-0x0;var _0x1fde27=_0x5b02[_0x253bee];return _0x1fde27;};'use strict';var Sequelize=require(_0x25b0('0x0'));module[_0x25b0('0x1')]={'type':{'type':Sequelize[_0x25b0('0x2')](_0x25b0('0x3'),'variable','customVariable',_0x25b0('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x25b0('0x5')]},'key':{'type':Sequelize[_0x25b0('0x5')]},'keyType':{'type':Sequelize[_0x25b0('0x2')](_0x25b0('0x3'),_0x25b0('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x25b0('0x5')]},'idField':{'type':Sequelize[_0x25b0('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x25b0('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 92f69a8..4e32fdc 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 _0x9c2c=['index','FreshdeskField','rawAttributes','model','query','dateStart','dateEnd','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','add','day','merge','filter','map','options','includeAll','include','findAll','catch','show','params','filters','find','create','body','update','html-pdf','eml-format','request-promise','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','then','destroy','error','name','send'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x9c2c,0x1c0));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xc9c2('0x0'));var emlformat=require(_0xc9c2('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc9c2('0x2'));var moment=require('moment');var BPromise=require(_0xc9c2('0x3'));var Mustache=require(_0xc9c2('0x4'));var util=require('util');var path=require('path');var sox=require(_0xc9c2('0x5'));var csv=require('to-csv');var ejs=require(_0xc9c2('0x6'));var fs=require('fs');var _=require(_0xc9c2('0x7'));var squel=require(_0xc9c2('0x8'));var crypto=require(_0xc9c2('0x9'));var jsforce=require(_0xc9c2('0xa'));var deskjs=require(_0xc9c2('0xb'));var toCsv=require(_0xc9c2('0xc'));var querystring=require(_0xc9c2('0xd'));var Papa=require(_0xc9c2('0xe'));var Redis=require('ioredis');var qs=require(_0xc9c2('0xf'));var logger=require('../../config/logger')(_0xc9c2('0x10'));var utils=require(_0xc9c2('0x11'));var config=require(_0xc9c2('0x12'));var db=require(_0xc9c2('0x13'))['db'];function respondWithStatusCode(_0x5894a4,_0x4f8453){_0x4f8453=_0x4f8453||0xcc;return function(_0x10c97d){if(_0x10c97d){return _0x5894a4[_0xc9c2('0x14')](_0x4f8453);}return _0x5894a4['status'](_0x4f8453)[_0xc9c2('0x15')]();};}function respondWithResult(_0x1f08a7,_0x3e7cfb){_0x3e7cfb=_0x3e7cfb||0xc8;return function(_0x43d9bc){if(_0x43d9bc){return _0x1f08a7[_0xc9c2('0x16')](_0x3e7cfb)[_0xc9c2('0x17')](_0x43d9bc);}};}function respondWithFilteredResult(_0x33b288,_0x132702){return function(_0x264d1f){if(_0x264d1f){var _0x406c2e=_0x264d1f[_0xc9c2('0x18')],_0xf94209=_0x132702[_0xc9c2('0x19')],_0x383667=_0x132702[_0xc9c2('0x19')]+_0x132702[_0xc9c2('0x1a')],_0x480d7c;if(_0x383667>=_0x406c2e){_0x383667=_0x406c2e;_0x480d7c=0xc8;}else{_0x480d7c=0xce;}_0x33b288[_0xc9c2('0x16')](_0x480d7c);return _0x33b288['set'](_0xc9c2('0x1b'),_0xf94209+'-'+_0x383667+'/'+_0x406c2e)[_0xc9c2('0x17')](_0x264d1f);}return null;};}function patchUpdates(_0x273c08){return function(_0x4e4ded){try{jsonpatch[_0xc9c2('0x1c')](_0x4e4ded,_0x273c08,!![]);}catch(_0x7de09c){return BPromise[_0xc9c2('0x1d')](_0x7de09c);}return _0x4e4ded['save']();};}function saveUpdates(_0x3ed8d5,_0x2a0166){return function(_0x54bb8f){if(_0x54bb8f){return _0x54bb8f['update'](_0x3ed8d5)[_0xc9c2('0x1e')](function(_0x50f280){return _0x50f280;});}return null;};}function removeEntity(_0x1df09b,_0x140c8a){return function(_0x408d4b){if(_0x408d4b){return _0x408d4b[_0xc9c2('0x1f')]()[_0xc9c2('0x1e')](function(){_0x1df09b['status'](0xcc)[_0xc9c2('0x15')]();});}};}function handleEntityNotFound(_0x20cf26,_0x3b3b15){return function(_0x11cc07){if(!_0x11cc07){_0x20cf26[_0xc9c2('0x14')](0x194);}return _0x11cc07;};}function handleError(_0x385030,_0x56e515){_0x56e515=_0x56e515||0x1f4;return function(_0x38c957){logger[_0xc9c2('0x20')](_0x38c957['stack']);if(_0x38c957[_0xc9c2('0x21')]){delete _0x38c957['name'];}_0x385030[_0xc9c2('0x16')](_0x56e515)[_0xc9c2('0x22')](_0x38c957);};}exports[_0xc9c2('0x23')]=function(_0x2222e4,_0x484d55){var _0x2073ef={},_0x5bd3e8={},_0x2fcaa3={'count':0x0,'rows':[]};var _0x3bd8e8=db[_0xc9c2('0x24')][_0xc9c2('0x25')];_0x5bd3e8[_0xc9c2('0x26')]=_['keys'](_0x3bd8e8);var _0x3cedb5={'dateStart':_0x2222e4[_0xc9c2('0x27')][_0xc9c2('0x28')],'dateEnd':_0x2222e4[_0xc9c2('0x27')][_0xc9c2('0x29')]};delete _0x2222e4[_0xc9c2('0x27')][_0xc9c2('0x28')];delete _0x2222e4['query'][_0xc9c2('0x29')];_0x5bd3e8['query']=_[_0xc9c2('0x2a')](_0x2222e4[_0xc9c2('0x27')]);_0x5bd3e8['filters']=_[_0xc9c2('0x2b')](_0x5bd3e8[_0xc9c2('0x26')],_0x5bd3e8[_0xc9c2('0x27')]);_0x2073ef[_0xc9c2('0x2c')]=_['intersection'](_0x5bd3e8[_0xc9c2('0x26')],qs[_0xc9c2('0x2d')](_0x2222e4['query']['fields']));_0x2073ef[_0xc9c2('0x2c')]=_0x2073ef[_0xc9c2('0x2c')][_0xc9c2('0x2e')]?_0x2073ef['attributes']:_0x5bd3e8['model'];if(!_0x2222e4[_0xc9c2('0x27')][_0xc9c2('0x2f')]('nolimit')){_0x2073ef[_0xc9c2('0x1a')]=qs['limit'](_0x2222e4[_0xc9c2('0x27')][_0xc9c2('0x1a')]);_0x2073ef[_0xc9c2('0x19')]=qs[_0xc9c2('0x19')](_0x2222e4[_0xc9c2('0x27')][_0xc9c2('0x19')]);}_0x2073ef[_0xc9c2('0x30')]=qs[_0xc9c2('0x31')](_0x2222e4[_0xc9c2('0x27')]['sort']);_0x2073ef[_0xc9c2('0x32')]=qs['filters'](_[_0xc9c2('0x33')](_0x2222e4[_0xc9c2('0x27')],_0x5bd3e8['filters']));if(_0x3cedb5[_0xc9c2('0x28')]){if(_0x3cedb5[_0xc9c2('0x29')]){_0x3cedb5['dateEnd']=moment(_0x3cedb5[_0xc9c2('0x29')])[_0xc9c2('0x34')](0x1,_0xc9c2('0x35'));}else{_0x3cedb5['dateEnd']=moment(_0x3cedb5[_0xc9c2('0x28')])['add'](0x1,_0xc9c2('0x35'));}_[_0xc9c2('0x36')](_0x2073ef['where'],{'createdAt':{'$gte':_0x3cedb5[_0xc9c2('0x28')],'$lte':_0x3cedb5[_0xc9c2('0x29')]}});}if(_0x2222e4[_0xc9c2('0x27')][_0xc9c2('0x37')]){_0x2073ef[_0xc9c2('0x32')]=_[_0xc9c2('0x36')](_0x2073ef[_0xc9c2('0x32')],{'$or':_[_0xc9c2('0x38')](_0x2073ef[_0xc9c2('0x2c')],function(_0x42b8ec){var _0x8d6710={};_0x8d6710[_0x42b8ec]={'$like':'%'+_0x2222e4['query']['filter']+'%'};return _0x8d6710;})});}_0x2073ef=_[_0xc9c2('0x36')]({},_0x2073ef,_0x2222e4[_0xc9c2('0x39')]);var _0x4507c9={'where':_0x2073ef[_0xc9c2('0x32')]};return db[_0xc9c2('0x24')][_0xc9c2('0x18')](_0x4507c9)['then'](function(_0x8c1288){_0x2fcaa3[_0xc9c2('0x18')]=_0x8c1288;if(_0x2222e4[_0xc9c2('0x27')][_0xc9c2('0x3a')]){_0x2073ef[_0xc9c2('0x3b')]=[{'all':!![]}];}return db['FreshdeskField'][_0xc9c2('0x3c')](_0x2073ef);})[_0xc9c2('0x1e')](function(_0x2126f8){_0x2fcaa3['rows']=_0x2126f8;return _0x2fcaa3;})[_0xc9c2('0x1e')](respondWithFilteredResult(_0x484d55,_0x2073ef))[_0xc9c2('0x3d')](handleError(_0x484d55,null));};exports[_0xc9c2('0x3e')]=function(_0x903862,_0x2cef97){var _0x55c3de={'raw':!![],'where':{'id':_0x903862[_0xc9c2('0x3f')]['id']}},_0x54857b={};_0x54857b[_0xc9c2('0x26')]=_['keys'](db[_0xc9c2('0x24')][_0xc9c2('0x25')]);_0x54857b[_0xc9c2('0x27')]=_[_0xc9c2('0x2a')](_0x903862[_0xc9c2('0x27')]);_0x54857b[_0xc9c2('0x40')]=_[_0xc9c2('0x2b')](_0x54857b['model'],_0x54857b[_0xc9c2('0x27')]);_0x55c3de['attributes']=_[_0xc9c2('0x2b')](_0x54857b['model'],qs[_0xc9c2('0x2d')](_0x903862['query'][_0xc9c2('0x2d')]));_0x55c3de['attributes']=_0x55c3de[_0xc9c2('0x2c')][_0xc9c2('0x2e')]?_0x55c3de[_0xc9c2('0x2c')]:_0x54857b[_0xc9c2('0x26')];if(_0x903862[_0xc9c2('0x27')][_0xc9c2('0x3a')]){_0x55c3de[_0xc9c2('0x3b')]=[{'all':!![]}];}_0x55c3de=_['merge']({},_0x55c3de,_0x903862[_0xc9c2('0x39')]);return db[_0xc9c2('0x24')][_0xc9c2('0x41')](_0x55c3de)[_0xc9c2('0x1e')](handleEntityNotFound(_0x2cef97,null))[_0xc9c2('0x1e')](respondWithResult(_0x2cef97,null))[_0xc9c2('0x3d')](handleError(_0x2cef97,null));};exports['create']=function(_0x3f97b5,_0xd7267c){return db[_0xc9c2('0x24')][_0xc9c2('0x42')](_0x3f97b5[_0xc9c2('0x43')],{})[_0xc9c2('0x1e')](respondWithResult(_0xd7267c,0xc9))[_0xc9c2('0x3d')](handleError(_0xd7267c,null));};exports[_0xc9c2('0x44')]=function(_0x5dc6d9,_0x44d1bb){if(_0x5dc6d9[_0xc9c2('0x43')]['id']){delete _0x5dc6d9[_0xc9c2('0x43')]['id'];}return db[_0xc9c2('0x24')][_0xc9c2('0x41')]({'where':{'id':_0x5dc6d9['params']['id']}})[_0xc9c2('0x1e')](handleEntityNotFound(_0x44d1bb,null))[_0xc9c2('0x1e')](saveUpdates(_0x5dc6d9[_0xc9c2('0x43')],null))['then'](respondWithResult(_0x44d1bb,null))[_0xc9c2('0x3d')](handleError(_0x44d1bb,null));};exports['destroy']=function(_0x19fecc,_0x55be42){return db['FreshdeskField'][_0xc9c2('0x41')]({'where':{'id':_0x19fecc[_0xc9c2('0x3f')]['id']}})[_0xc9c2('0x1e')](handleEntityNotFound(_0x55be42,null))[_0xc9c2('0x1e')](removeEntity(_0x55be42,null))[_0xc9c2('0x3d')](handleError(_0x55be42,null));}; \ No newline at end of file +var _0x55e0=['sort','where','add','day','merge','filter','map','options','includeAll','include','rows','catch','params','create','body','find','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','FreshdeskField','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','length','order'];(function(_0x2faf9f,_0x23cf3a){var _0x708559=function(_0x4f0099){while(--_0x4f0099){_0x2faf9f['push'](_0x2faf9f['shift']());}};_0x708559(++_0x23cf3a);}(_0x55e0,0xdc));var _0x055e=function(_0x4b3358,_0x126389){_0x4b3358=_0x4b3358-0x0;var _0x58af89=_0x55e0[_0x4b3358];return _0x58af89;};'use strict';var pdf=require(_0x055e('0x0'));var emlformat=require(_0x055e('0x1'));var rimraf=require(_0x055e('0x2'));var zipdir=require(_0x055e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x055e('0x4'));var BPromise=require(_0x055e('0x5'));var Mustache=require(_0x055e('0x6'));var util=require(_0x055e('0x7'));var path=require(_0x055e('0x8'));var sox=require(_0x055e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x055e('0xa'));var squel=require('squel');var crypto=require(_0x055e('0xb'));var jsforce=require(_0x055e('0xc'));var deskjs=require(_0x055e('0xd'));var toCsv=require(_0x055e('0xe'));var querystring=require(_0x055e('0xf'));var Papa=require('papaparse');var Redis=require(_0x055e('0x10'));var qs=require(_0x055e('0x11'));var logger=require(_0x055e('0x12'))(_0x055e('0x13'));var utils=require(_0x055e('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x187cce,_0x51c524){_0x51c524=_0x51c524||0xcc;return function(_0x3c44b2){if(_0x3c44b2){return _0x187cce[_0x055e('0x15')](_0x51c524);}return _0x187cce[_0x055e('0x16')](_0x51c524)[_0x055e('0x17')]();};}function respondWithResult(_0xc98c6a,_0x31c649){_0x31c649=_0x31c649||0xc8;return function(_0x236a2b){if(_0x236a2b){return _0xc98c6a['status'](_0x31c649)[_0x055e('0x18')](_0x236a2b);}};}function respondWithFilteredResult(_0xb80d83,_0x3cfd14){return function(_0xe41bae){if(_0xe41bae){var _0x222817=_0xe41bae[_0x055e('0x19')],_0x56af18=_0x3cfd14['offset'],_0x230674=_0x3cfd14[_0x055e('0x1a')]+_0x3cfd14[_0x055e('0x1b')],_0x2fe55f;if(_0x230674>=_0x222817){_0x230674=_0x222817;_0x2fe55f=0xc8;}else{_0x2fe55f=0xce;}_0xb80d83[_0x055e('0x16')](_0x2fe55f);return _0xb80d83[_0x055e('0x1c')](_0x055e('0x1d'),_0x56af18+'-'+_0x230674+'/'+_0x222817)['json'](_0xe41bae);}return null;};}function patchUpdates(_0x36ef10){return function(_0x2cf3de){try{jsonpatch[_0x055e('0x1e')](_0x2cf3de,_0x36ef10,!![]);}catch(_0x2ed6fb){return BPromise['reject'](_0x2ed6fb);}return _0x2cf3de[_0x055e('0x1f')]();};}function saveUpdates(_0x3cdd68,_0x58e44a){return function(_0xe2b7b5){if(_0xe2b7b5){return _0xe2b7b5[_0x055e('0x20')](_0x3cdd68)[_0x055e('0x21')](function(_0x124d86){return _0x124d86;});}return null;};}function removeEntity(_0x4280cf,_0x4675ff){return function(_0x53b766){if(_0x53b766){return _0x53b766[_0x055e('0x22')]()[_0x055e('0x21')](function(){_0x4280cf[_0x055e('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f444a,_0x2da6b){return function(_0x32c64e){if(!_0x32c64e){_0x3f444a[_0x055e('0x15')](0x194);}return _0x32c64e;};}function handleError(_0x51df23,_0x71a6e1){_0x71a6e1=_0x71a6e1||0x1f4;return function(_0x56c372){logger[_0x055e('0x23')](_0x56c372[_0x055e('0x24')]);if(_0x56c372[_0x055e('0x25')]){delete _0x56c372[_0x055e('0x25')];}_0x51df23[_0x055e('0x16')](_0x71a6e1)[_0x055e('0x26')](_0x56c372);};}exports['index']=function(_0x2fb49b,_0x1f90a9){var _0x2a82f8={},_0x4b5891={},_0x408e38={'count':0x0,'rows':[]};var _0x29078a=db[_0x055e('0x27')][_0x055e('0x28')];_0x4b5891['model']=_[_0x055e('0x29')](_0x29078a);var _0x5958ef={'dateStart':_0x2fb49b[_0x055e('0x2a')][_0x055e('0x2b')],'dateEnd':_0x2fb49b[_0x055e('0x2a')][_0x055e('0x2c')]};delete _0x2fb49b[_0x055e('0x2a')]['dateStart'];delete _0x2fb49b[_0x055e('0x2a')][_0x055e('0x2c')];_0x4b5891[_0x055e('0x2a')]=_[_0x055e('0x29')](_0x2fb49b[_0x055e('0x2a')]);_0x4b5891[_0x055e('0x2d')]=_[_0x055e('0x2e')](_0x4b5891[_0x055e('0x2f')],_0x4b5891['query']);_0x2a82f8[_0x055e('0x30')]=_[_0x055e('0x2e')](_0x4b5891['model'],qs[_0x055e('0x31')](_0x2fb49b[_0x055e('0x2a')][_0x055e('0x31')]));_0x2a82f8[_0x055e('0x30')]=_0x2a82f8[_0x055e('0x30')][_0x055e('0x32')]?_0x2a82f8['attributes']:_0x4b5891['model'];if(!_0x2fb49b[_0x055e('0x2a')]['hasOwnProperty']('nolimit')){_0x2a82f8['limit']=qs[_0x055e('0x1b')](_0x2fb49b[_0x055e('0x2a')][_0x055e('0x1b')]);_0x2a82f8[_0x055e('0x1a')]=qs[_0x055e('0x1a')](_0x2fb49b[_0x055e('0x2a')][_0x055e('0x1a')]);}_0x2a82f8[_0x055e('0x33')]=qs[_0x055e('0x34')](_0x2fb49b[_0x055e('0x2a')][_0x055e('0x34')]);_0x2a82f8[_0x055e('0x35')]=qs['filters'](_['pick'](_0x2fb49b[_0x055e('0x2a')],_0x4b5891[_0x055e('0x2d')]));if(_0x5958ef[_0x055e('0x2b')]){if(_0x5958ef[_0x055e('0x2c')]){_0x5958ef[_0x055e('0x2c')]=moment(_0x5958ef[_0x055e('0x2c')])[_0x055e('0x36')](0x1,'day');}else{_0x5958ef[_0x055e('0x2c')]=moment(_0x5958ef[_0x055e('0x2b')])[_0x055e('0x36')](0x1,_0x055e('0x37'));}_[_0x055e('0x38')](_0x2a82f8['where'],{'createdAt':{'$gte':_0x5958ef[_0x055e('0x2b')],'$lte':_0x5958ef[_0x055e('0x2c')]}});}if(_0x2fb49b['query'][_0x055e('0x39')]){_0x2a82f8[_0x055e('0x35')]=_['merge'](_0x2a82f8[_0x055e('0x35')],{'$or':_[_0x055e('0x3a')](_0x2a82f8['attributes'],function(_0x473004){var _0x233423={};_0x233423[_0x473004]={'$like':'%'+_0x2fb49b['query'][_0x055e('0x39')]+'%'};return _0x233423;})});}_0x2a82f8=_[_0x055e('0x38')]({},_0x2a82f8,_0x2fb49b[_0x055e('0x3b')]);var _0x4ac128={'where':_0x2a82f8[_0x055e('0x35')]};return db[_0x055e('0x27')]['count'](_0x4ac128)[_0x055e('0x21')](function(_0x609444){_0x408e38[_0x055e('0x19')]=_0x609444;if(_0x2fb49b['query'][_0x055e('0x3c')]){_0x2a82f8[_0x055e('0x3d')]=[{'all':!![]}];}return db[_0x055e('0x27')]['findAll'](_0x2a82f8);})['then'](function(_0x27c49c){_0x408e38[_0x055e('0x3e')]=_0x27c49c;return _0x408e38;})['then'](respondWithFilteredResult(_0x1f90a9,_0x2a82f8))[_0x055e('0x3f')](handleError(_0x1f90a9,null));};exports['show']=function(_0x320426,_0x537bc7){var _0x1ca551={'raw':!![],'where':{'id':_0x320426[_0x055e('0x40')]['id']}},_0x31c57a={};_0x31c57a['model']=_['keys'](db[_0x055e('0x27')][_0x055e('0x28')]);_0x31c57a[_0x055e('0x2a')]=_[_0x055e('0x29')](_0x320426['query']);_0x31c57a['filters']=_[_0x055e('0x2e')](_0x31c57a[_0x055e('0x2f')],_0x31c57a['query']);_0x1ca551[_0x055e('0x30')]=_[_0x055e('0x2e')](_0x31c57a[_0x055e('0x2f')],qs[_0x055e('0x31')](_0x320426[_0x055e('0x2a')][_0x055e('0x31')]));_0x1ca551['attributes']=_0x1ca551[_0x055e('0x30')][_0x055e('0x32')]?_0x1ca551['attributes']:_0x31c57a[_0x055e('0x2f')];if(_0x320426[_0x055e('0x2a')][_0x055e('0x3c')]){_0x1ca551[_0x055e('0x3d')]=[{'all':!![]}];}_0x1ca551=_[_0x055e('0x38')]({},_0x1ca551,_0x320426[_0x055e('0x3b')]);return db[_0x055e('0x27')]['find'](_0x1ca551)[_0x055e('0x21')](handleEntityNotFound(_0x537bc7,null))['then'](respondWithResult(_0x537bc7,null))[_0x055e('0x3f')](handleError(_0x537bc7,null));};exports[_0x055e('0x41')]=function(_0x3a7772,_0x5d3e2a){return db['FreshdeskField'][_0x055e('0x41')](_0x3a7772[_0x055e('0x42')],{})[_0x055e('0x21')](respondWithResult(_0x5d3e2a,0xc9))[_0x055e('0x3f')](handleError(_0x5d3e2a,null));};exports[_0x055e('0x20')]=function(_0x1523f7,_0x128e11){if(_0x1523f7[_0x055e('0x42')]['id']){delete _0x1523f7[_0x055e('0x42')]['id'];}return db['FreshdeskField'][_0x055e('0x43')]({'where':{'id':_0x1523f7[_0x055e('0x40')]['id']}})[_0x055e('0x21')](handleEntityNotFound(_0x128e11,null))[_0x055e('0x21')](saveUpdates(_0x1523f7[_0x055e('0x42')],null))['then'](respondWithResult(_0x128e11,null))[_0x055e('0x3f')](handleError(_0x128e11,null));};exports[_0x055e('0x22')]=function(_0x3e7fa6,_0x4b7ba0){return db[_0x055e('0x27')]['find']({'where':{'id':_0x3e7fa6[_0x055e('0x40')]['id']}})[_0x055e('0x21')](handleEntityNotFound(_0x4b7ba0,null))['then'](removeEntity(_0x4b7ba0,null))[_0x055e('0x3f')](handleError(_0x4b7ba0,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index a60b9b5..0e60b5b 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 _0xfcbb=['util','../../config/logger','bluebird','request-promise','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','lodash'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x4ef7e2,_0x17ea24){_0x4ef7e2=_0x4ef7e2-0x0;var _0x1fd604=_0xfcbb[_0x4ef7e2];return _0x1fd604;};'use strict';var _=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var logger=require(_0xbfcb('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbfcb('0x3'));var rp=require(_0xbfcb('0x4'));var attributes=require(_0xbfcb('0x5'));module[_0xbfcb('0x6')]=function(_0x1d8b50,_0x5c5a1a){return _0x1d8b50['define'](_0xbfcb('0x7'),attributes,{'tableName':_0xbfcb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x77e6=['util','../../config/logger','api','moment','bluebird','request-promise','./intFreshdeskField.attributes','FreshdeskField','lodash'];(function(_0x1360c0,_0x50da6d){var _0x2777af=function(_0x554de2){while(--_0x554de2){_0x1360c0['push'](_0x1360c0['shift']());}};_0x2777af(++_0x50da6d);}(_0x77e6,0x1a6));var _0x677e=function(_0x462087,_0x31aa04){_0x462087=_0x462087-0x0;var _0x18c4d5=_0x77e6[_0x462087];return _0x18c4d5;};'use strict';var _=require(_0x677e('0x0'));var util=require(_0x677e('0x1'));var logger=require(_0x677e('0x2'))(_0x677e('0x3'));var moment=require(_0x677e('0x4'));var BPromise=require(_0x677e('0x5'));var rp=require(_0x677e('0x6'));var attributes=require(_0x677e('0x7'));module['exports']=function(_0x2f0307,_0x2560a6){return _0x2f0307['define'](_0x677e('0x8'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 6cc3377..1cd4d04 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 _0x524a=['request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x524a,0xf5));var _0xa524=function(_0x92b59,_0x1f5a11){_0x92b59=_0x92b59-0x0;var _0x13e480=_0x524a[_0x92b59];return _0x13e480;};'use strict';var _=require(_0xa524('0x0'));var util=require(_0xa524('0x1'));var moment=require(_0xa524('0x2'));var BPromise=require(_0xa524('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa524('0x4'));var db=require(_0xa524('0x5'))['db'];var utils=require(_0xa524('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xa524('0x7'));var jayson=require(_0xa524('0x8'));var client=jayson[_0xa524('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x460738,_0x56bd0e,_0x3a2dd6){return new BPromise(function(_0x11aa98,_0x56849e){return client[_0xa524('0xa')](_0x460738,_0x3a2dd6)[_0xa524('0xb')](function(_0x228ffe){logger[_0xa524('0xc')](_0xa524('0xd'),_0x56bd0e,'request\x20sent');logger[_0xa524('0xe')](_0xa524('0xf'),_0x56bd0e,'request\x20sent',JSON['stringify'](_0x228ffe));if(_0x228ffe[_0xa524('0x10')]){if(_0x228ffe[_0xa524('0x10')][_0xa524('0x11')]===0x1f4){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x56bd0e,_0x228ffe[_0xa524('0x10')]['message']);return _0x56849e(_0x228ffe[_0xa524('0x10')]['message']);}logger[_0xa524('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x56bd0e,_0x228ffe[_0xa524('0x10')][_0xa524('0x12')]);return _0x11aa98(_0x228ffe['error'][_0xa524('0x12')]);}else{logger[_0xa524('0xc')](_0xa524('0xd'),_0x56bd0e,_0xa524('0x13'));_0x11aa98(_0x228ffe[_0xa524('0x14')][_0xa524('0x12')]);}})[_0xa524('0x15')](function(_0x4fc42f){logger[_0xa524('0x10')](_0xa524('0xd'),_0x56bd0e,_0x4fc42f);_0x56849e(_0x4fc42f);});});} \ No newline at end of file +var _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskField,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x383d12,_0x2a3b30){var _0x21cc12=function(_0x513115){while(--_0x513115){_0x383d12['push'](_0x383d12['shift']());}};_0x21cc12(++_0x2a3b30);}(_0x4b84,0x1cc));var _0x44b8=function(_0xf1af27,_0x598bb1){_0xf1af27=_0xf1af27-0x0;var _0x46b274=_0x4b84[_0xf1af27];return _0x46b274;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('FreshdeskField,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('FreshdeskField,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 5b0d471..6fc6dc7 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 _0xe81f=['/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','isAuthenticated','get','/:id','show'];(function(_0x3367b7,_0x1e0234){var _0x52bb97=function(_0x2155f2){while(--_0x2155f2){_0x3367b7['push'](_0x3367b7['shift']());}};_0x52bb97(++_0x1e0234);}(_0xe81f,0x134));var _0xfe81=function(_0x47085a,_0x3de37b){_0x47085a=_0x47085a-0x0;var _0x148cce=_0xe81f[_0x47085a];return _0x148cce;};'use strict';var multer=require(_0xfe81('0x0'));var util=require(_0xfe81('0x1'));var path=require(_0xfe81('0x2'));var timeout=require(_0xfe81('0x3'));var express=require(_0xfe81('0x4'));var router=express[_0xfe81('0x5')]();var auth=require(_0xfe81('0x6'));var interaction=require(_0xfe81('0x7'));var config=require(_0xfe81('0x8'));var controller=require(_0xfe81('0x9'));router['get']('/',auth[_0xfe81('0xa')](),controller['index']);router[_0xfe81('0xb')](_0xfe81('0xc'),auth[_0xfe81('0xa')](),controller[_0xfe81('0xd')]);router[_0xfe81('0xb')](_0xfe81('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xfe81('0xb')](_0xfe81('0xf'),auth['isAuthenticated'](),controller[_0xfe81('0x10')]);router[_0xfe81('0x11')]('/',auth['isAuthenticated'](),controller[_0xfe81('0x12')]);router['post'](_0xfe81('0xe'),auth[_0xfe81('0xa')](),controller[_0xfe81('0x13')]);router[_0xfe81('0x14')](_0xfe81('0xc'),auth[_0xfe81('0xa')](),controller[_0xfe81('0x15')]);router[_0xfe81('0x16')](_0xfe81('0xc'),auth[_0xfe81('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd845=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','create','post','/:id/configurations','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0xebd63f,_0x5c5fb5){var _0x212b86=function(_0x3d22ab){while(--_0x3d22ab){_0xebd63f['push'](_0xebd63f['shift']());}};_0x212b86(++_0x5c5fb5);}(_0xd845,0x135));var _0x5d84=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xd845[_0x9df060];return _0x338dfe;};'use strict';var multer=require(_0x5d84('0x0'));var util=require(_0x5d84('0x1'));var path=require(_0x5d84('0x2'));var timeout=require(_0x5d84('0x3'));var express=require('express');var router=express[_0x5d84('0x4')]();var auth=require(_0x5d84('0x5'));var interaction=require(_0x5d84('0x6'));var config=require(_0x5d84('0x7'));var controller=require('./intSalesforceAccount.controller');router[_0x5d84('0x8')]('/',auth[_0x5d84('0x9')](),controller[_0x5d84('0xa')]);router[_0x5d84('0x8')](_0x5d84('0xb'),auth[_0x5d84('0x9')](),controller['show']);router[_0x5d84('0x8')]('/:id/configurations',auth[_0x5d84('0x9')](),controller[_0x5d84('0xc')]);router['get'](_0x5d84('0xd'),auth[_0x5d84('0x9')](),controller['getFields']);router['post']('/',auth[_0x5d84('0x9')](),controller[_0x5d84('0xe')]);router[_0x5d84('0xf')](_0x5d84('0x10'),auth[_0x5d84('0x9')](),controller['addConfiguration']);router[_0x5d84('0x11')](_0x5d84('0xb'),auth[_0x5d84('0x9')](),controller[_0x5d84('0x12')]);router[_0x5d84('0x13')](_0x5d84('0xb'),auth['isAuthenticated'](),controller[_0x5d84('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 4547aa9..6a0ef8c 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 _0x4a7b=['ENUM','integrationTab','newTab','sequelize','exports','STRING','username'];(function(_0x4f3193,_0x500f84){var _0x5f53fa=function(_0x4fcbec){while(--_0x4fcbec){_0x4f3193['push'](_0x4f3193['shift']());}};_0x5f53fa(++_0x500f84);}(_0x4a7b,0x81));var _0xb4a7=function(_0x1a6a81,_0x4d9b67){_0x1a6a81=_0x1a6a81-0x0;var _0x3365ff=_0x4a7b[_0x1a6a81];return _0x3365ff;};'use strict';var Sequelize=require(_0xb4a7('0x0'));module[_0xb4a7('0x1')]={'name':{'type':Sequelize[_0xb4a7('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb4a7('0x2')],'unique':_0xb4a7('0x3')},'remoteUri':{'type':Sequelize[_0xb4a7('0x2')]},'password':{'type':Sequelize[_0xb4a7('0x2')]},'clientId':{'type':Sequelize[_0xb4a7('0x2')]},'clientSecret':{'type':Sequelize[_0xb4a7('0x2')]},'securityToken':{'type':Sequelize[_0xb4a7('0x2')]},'serverUrl':{'type':Sequelize[_0xb4a7('0x2')]},'type':{'type':Sequelize[_0xb4a7('0x4')](_0xb4a7('0x5'),_0xb4a7('0x6')),'defaultValue':_0xb4a7('0x5')}}; \ No newline at end of file +var _0xaa71=['STRING','username','ENUM','newTab','integrationTab','exports'];(function(_0x38c652,_0x1ea1b7){var _0x218a37=function(_0x5dcb2a){while(--_0x5dcb2a){_0x38c652['push'](_0x38c652['shift']());}};_0x218a37(++_0x1ea1b7);}(_0xaa71,0x17f));var _0x1aa7=function(_0x429b62,_0x195d6f){_0x429b62=_0x429b62-0x0;var _0x1b9e8c=_0xaa71[_0x429b62];return _0x1b9e8c;};'use strict';var Sequelize=require('sequelize');module[_0x1aa7('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1aa7('0x1')]},'username':{'type':Sequelize[_0x1aa7('0x1')],'unique':_0x1aa7('0x2')},'remoteUri':{'type':Sequelize[_0x1aa7('0x1')]},'password':{'type':Sequelize[_0x1aa7('0x1')]},'clientId':{'type':Sequelize[_0x1aa7('0x1')]},'clientSecret':{'type':Sequelize[_0x1aa7('0x1')]},'securityToken':{'type':Sequelize[_0x1aa7('0x1')]},'serverUrl':{'type':Sequelize[_0x1aa7('0x1')]},'type':{'type':Sequelize[_0x1aa7('0x3')]('integrationTab',_0x1aa7('0x4')),'defaultValue':_0x1aa7('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 41503da..63fe4d4 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 _0xbc77=['../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','SalesforceAccount','rawAttributes','model','keys','query','dateStart','dateEnd','attributes','intersection','fields','length','hasOwnProperty','sort','where','filters','pick','add','day','merge','filter','map','includeAll','findAll','rows','show','params','include','find','create','body','getConfigurations','SalesforceConfiguration','order','nolimit','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','securityToken','Connection','login','password','concat','sobject','Task','CallDisposition','CallDurationInSeconds','CallObject','CallType','IsArchived','Priority','Status','Type','remove','custom','label','picklistValues','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs'];(function(_0x1c11a0,_0x22396d){var _0x2b0348=function(_0x1c8483){while(--_0x1c8483){_0x1c11a0['push'](_0x1c11a0['shift']());}};_0x2b0348(++_0x22396d);}(_0xbc77,0x15d));var _0x7bc7=function(_0x2f48cd,_0x46a75a){_0x2f48cd=_0x2f48cd-0x0;var _0x193ae2=_0xbc77[_0x2f48cd];return _0x193ae2;};'use strict';var pdf=require(_0x7bc7('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7bc7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7bc7('0x2'));var moment=require(_0x7bc7('0x3'));var BPromise=require(_0x7bc7('0x4'));var Mustache=require(_0x7bc7('0x5'));var util=require('util');var path=require(_0x7bc7('0x6'));var sox=require(_0x7bc7('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7bc7('0x8'));var squel=require(_0x7bc7('0x9'));var crypto=require(_0x7bc7('0xa'));var jsforce=require(_0x7bc7('0xb'));var deskjs=require(_0x7bc7('0xc'));var toCsv=require(_0x7bc7('0xd'));var querystring=require(_0x7bc7('0xe'));var Papa=require(_0x7bc7('0xf'));var Redis=require('ioredis');var qs=require(_0x7bc7('0x10'));var logger=require(_0x7bc7('0x11'))(_0x7bc7('0x12'));var utils=require('../../config/utils');var config=require(_0x7bc7('0x13'));var db=require(_0x7bc7('0x14'))['db'];var integrations=require(_0x7bc7('0x15'));var jayson=require(_0x7bc7('0x16'));var client=jayson[_0x7bc7('0x17')][_0x7bc7('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x587b25,_0x7f4ea7,_0x131b6a,_0x297248){return new BPromise(function(_0x1e44a8,_0x3272e5){var _0x5b41a1=_0x297248||client;return _0x5b41a1[_0x7bc7('0x19')](_0x587b25,_0x131b6a)[_0x7bc7('0x1a')](function(_0x1073e5){logger[_0x7bc7('0x1b')](_0x7bc7('0x1c'),_0x7f4ea7,_0x7bc7('0x1d'));logger[_0x7bc7('0x1e')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x7f4ea7,_0x7bc7('0x1d'),JSON[_0x7bc7('0x1f')](_0x1073e5));if(_0x1073e5[_0x7bc7('0x20')]){if(_0x1073e5['error'][_0x7bc7('0x21')]===0x1f4){logger[_0x7bc7('0x20')](_0x7bc7('0x1c'),_0x7f4ea7,_0x1073e5[_0x7bc7('0x20')][_0x7bc7('0x22')]);return _0x3272e5(_0x1073e5['error'][_0x7bc7('0x22')]);}logger['error'](_0x7bc7('0x1c'),_0x7f4ea7,_0x1073e5[_0x7bc7('0x20')]['message']);return _0x1e44a8(_0x1073e5['error'][_0x7bc7('0x22')]);}else{logger[_0x7bc7('0x1b')](_0x7bc7('0x1c'),_0x7f4ea7,_0x7bc7('0x1d'));_0x1e44a8(_0x1073e5['result'][_0x7bc7('0x22')]);}})[_0x7bc7('0x23')](function(_0x28816c){logger[_0x7bc7('0x20')](_0x7bc7('0x1c'),_0x7f4ea7,_0x28816c);_0x3272e5(_0x28816c);});});}function respondWithStatusCode(_0x15281c,_0x244753){_0x244753=_0x244753||0xcc;return function(_0xb900a7){if(_0xb900a7){return _0x15281c[_0x7bc7('0x24')](_0x244753);}return _0x15281c['status'](_0x244753)['end']();};}function respondWithResult(_0x3433ec,_0x5e69ca){_0x5e69ca=_0x5e69ca||0xc8;return function(_0x2a41a9){if(_0x2a41a9){return _0x3433ec[_0x7bc7('0x25')](_0x5e69ca)[_0x7bc7('0x26')](_0x2a41a9);}};}function respondWithFilteredResult(_0x4bb774,_0x390f72){return function(_0x13cf74){if(_0x13cf74){var _0x298565=_0x13cf74[_0x7bc7('0x27')],_0x1a7bb=_0x390f72[_0x7bc7('0x28')],_0x3abdd9=_0x390f72[_0x7bc7('0x28')]+_0x390f72[_0x7bc7('0x29')],_0x305006;if(_0x3abdd9>=_0x298565){_0x3abdd9=_0x298565;_0x305006=0xc8;}else{_0x305006=0xce;}_0x4bb774[_0x7bc7('0x25')](_0x305006);return _0x4bb774[_0x7bc7('0x2a')](_0x7bc7('0x2b'),_0x1a7bb+'-'+_0x3abdd9+'/'+_0x298565)[_0x7bc7('0x26')](_0x13cf74);}return null;};}function patchUpdates(_0x138c96){return function(_0x1d7dd2){try{jsonpatch[_0x7bc7('0x2c')](_0x1d7dd2,_0x138c96,!![]);}catch(_0x508fd8){return BPromise['reject'](_0x508fd8);}return _0x1d7dd2[_0x7bc7('0x2d')]();};}function saveUpdates(_0x3d611a,_0x485c7b){return function(_0x58c151){if(_0x58c151){return _0x58c151[_0x7bc7('0x2e')](_0x3d611a)[_0x7bc7('0x1a')](function(_0x15803a){return _0x15803a;});}return null;};}function removeEntity(_0x2749c1,_0x33a328){return function(_0x541c72){if(_0x541c72){return _0x541c72[_0x7bc7('0x2f')]()[_0x7bc7('0x1a')](function(){_0x2749c1[_0x7bc7('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35525a,_0x332e42){return function(_0x5eb484){if(!_0x5eb484){_0x35525a[_0x7bc7('0x24')](0x194);}return _0x5eb484;};}function handleError(_0x2313c2,_0xd321da){_0xd321da=_0xd321da||0x1f4;return function(_0x45fd38){logger[_0x7bc7('0x20')](_0x45fd38[_0x7bc7('0x30')]);if(_0x45fd38['name']){delete _0x45fd38[_0x7bc7('0x31')];}_0x2313c2[_0x7bc7('0x25')](_0xd321da)[_0x7bc7('0x32')](_0x45fd38);};}exports[_0x7bc7('0x33')]=function(_0x5101c4,_0x122385){var _0x5dc88f={},_0x1bd902={},_0x59c1a0={'count':0x0,'rows':[]};var _0x15425b=db[_0x7bc7('0x34')][_0x7bc7('0x35')];_0x1bd902[_0x7bc7('0x36')]=_[_0x7bc7('0x37')](_0x15425b);var _0x3e9d19={'dateStart':_0x5101c4[_0x7bc7('0x38')][_0x7bc7('0x39')],'dateEnd':_0x5101c4[_0x7bc7('0x38')][_0x7bc7('0x3a')]};delete _0x5101c4[_0x7bc7('0x38')][_0x7bc7('0x39')];delete _0x5101c4[_0x7bc7('0x38')][_0x7bc7('0x3a')];_0x1bd902[_0x7bc7('0x38')]=_[_0x7bc7('0x37')](_0x5101c4[_0x7bc7('0x38')]);_0x1bd902['filters']=_['intersection'](_0x1bd902[_0x7bc7('0x36')],_0x1bd902['query']);_0x5dc88f[_0x7bc7('0x3b')]=_[_0x7bc7('0x3c')](_0x1bd902['model'],qs[_0x7bc7('0x3d')](_0x5101c4[_0x7bc7('0x38')][_0x7bc7('0x3d')]));_0x5dc88f[_0x7bc7('0x3b')]=_0x5dc88f[_0x7bc7('0x3b')][_0x7bc7('0x3e')]?_0x5dc88f['attributes']:_0x1bd902['model'];if(!_0x5101c4[_0x7bc7('0x38')][_0x7bc7('0x3f')]('nolimit')){_0x5dc88f[_0x7bc7('0x29')]=qs['limit'](_0x5101c4[_0x7bc7('0x38')]['limit']);_0x5dc88f['offset']=qs[_0x7bc7('0x28')](_0x5101c4[_0x7bc7('0x38')][_0x7bc7('0x28')]);}_0x5dc88f['order']=qs[_0x7bc7('0x40')](_0x5101c4[_0x7bc7('0x38')][_0x7bc7('0x40')]);_0x5dc88f[_0x7bc7('0x41')]=qs[_0x7bc7('0x42')](_[_0x7bc7('0x43')](_0x5101c4['query'],_0x1bd902[_0x7bc7('0x42')]));if(_0x3e9d19[_0x7bc7('0x39')]){if(_0x3e9d19[_0x7bc7('0x3a')]){_0x3e9d19[_0x7bc7('0x3a')]=moment(_0x3e9d19[_0x7bc7('0x3a')])[_0x7bc7('0x44')](0x1,_0x7bc7('0x45'));}else{_0x3e9d19[_0x7bc7('0x3a')]=moment(_0x3e9d19[_0x7bc7('0x39')])[_0x7bc7('0x44')](0x1,_0x7bc7('0x45'));}_[_0x7bc7('0x46')](_0x5dc88f[_0x7bc7('0x41')],{'createdAt':{'$gte':_0x3e9d19[_0x7bc7('0x39')],'$lte':_0x3e9d19[_0x7bc7('0x3a')]}});}if(_0x5101c4[_0x7bc7('0x38')][_0x7bc7('0x47')]){_0x5dc88f['where']=_[_0x7bc7('0x46')](_0x5dc88f['where'],{'$or':_[_0x7bc7('0x48')](_0x5dc88f[_0x7bc7('0x3b')],function(_0x6912d9){var _0x55cf59={};_0x55cf59[_0x6912d9]={'$like':'%'+_0x5101c4['query'][_0x7bc7('0x47')]+'%'};return _0x55cf59;})});}_0x5dc88f=_[_0x7bc7('0x46')]({},_0x5dc88f,_0x5101c4['options']);var _0x19d77a={'where':_0x5dc88f[_0x7bc7('0x41')]};return db[_0x7bc7('0x34')][_0x7bc7('0x27')](_0x19d77a)[_0x7bc7('0x1a')](function(_0x1d85d5){_0x59c1a0['count']=_0x1d85d5;if(_0x5101c4[_0x7bc7('0x38')][_0x7bc7('0x49')]){_0x5dc88f['include']=[{'all':!![]}];}return db[_0x7bc7('0x34')][_0x7bc7('0x4a')](_0x5dc88f);})[_0x7bc7('0x1a')](function(_0x3de57){_0x59c1a0[_0x7bc7('0x4b')]=_0x3de57;return _0x59c1a0;})[_0x7bc7('0x1a')](respondWithFilteredResult(_0x122385,_0x5dc88f))[_0x7bc7('0x23')](handleError(_0x122385,null));};exports[_0x7bc7('0x4c')]=function(_0x285571,_0x25c13e){var _0x37e15f={'raw':![],'where':{'id':_0x285571[_0x7bc7('0x4d')]['id']}},_0x285c87={};_0x285c87[_0x7bc7('0x36')]=_[_0x7bc7('0x37')](db[_0x7bc7('0x34')][_0x7bc7('0x35')]);_0x285c87[_0x7bc7('0x38')]=_[_0x7bc7('0x37')](_0x285571[_0x7bc7('0x38')]);_0x285c87['filters']=_[_0x7bc7('0x3c')](_0x285c87[_0x7bc7('0x36')],_0x285c87['query']);_0x37e15f[_0x7bc7('0x3b')]=_['intersection'](_0x285c87[_0x7bc7('0x36')],qs[_0x7bc7('0x3d')](_0x285571[_0x7bc7('0x38')][_0x7bc7('0x3d')]));_0x37e15f[_0x7bc7('0x3b')]=_0x37e15f[_0x7bc7('0x3b')]['length']?_0x37e15f[_0x7bc7('0x3b')]:_0x285c87[_0x7bc7('0x36')];if(_0x285571[_0x7bc7('0x38')][_0x7bc7('0x49')]){_0x37e15f[_0x7bc7('0x4e')]=[{'all':!![]}];}_0x37e15f=_[_0x7bc7('0x46')]({},_0x37e15f,_0x285571['options']);return db[_0x7bc7('0x34')][_0x7bc7('0x4f')](_0x37e15f)[_0x7bc7('0x1a')](handleEntityNotFound(_0x25c13e,null))['then'](respondWithResult(_0x25c13e,null))[_0x7bc7('0x23')](handleError(_0x25c13e,null));};exports[_0x7bc7('0x50')]=function(_0x221169,_0x261cc0){return db[_0x7bc7('0x34')][_0x7bc7('0x50')](_0x221169[_0x7bc7('0x51')],{})['then'](respondWithResult(_0x261cc0,0xc9))['catch'](handleError(_0x261cc0,null));};exports['update']=function(_0x1241a5,_0x1f9694){if(_0x1241a5[_0x7bc7('0x51')]['id']){delete _0x1241a5[_0x7bc7('0x51')]['id'];}return db[_0x7bc7('0x34')][_0x7bc7('0x4f')]({'where':{'id':_0x1241a5['params']['id']}})[_0x7bc7('0x1a')](handleEntityNotFound(_0x1f9694,null))[_0x7bc7('0x1a')](saveUpdates(_0x1241a5[_0x7bc7('0x51')],null))[_0x7bc7('0x1a')](respondWithResult(_0x1f9694,null))[_0x7bc7('0x23')](handleError(_0x1f9694,null));};exports[_0x7bc7('0x2f')]=function(_0x4abe6f,_0xe45f3){return db[_0x7bc7('0x34')][_0x7bc7('0x4f')]({'where':{'id':_0x4abe6f[_0x7bc7('0x4d')]['id']}})[_0x7bc7('0x1a')](handleEntityNotFound(_0xe45f3,null))[_0x7bc7('0x1a')](removeEntity(_0xe45f3,null))[_0x7bc7('0x23')](handleError(_0xe45f3,null));};exports[_0x7bc7('0x52')]=function(_0xe388f0,_0x1d3f19,_0x3f3ef0){var _0x27b3fb={};var _0x361901={};var _0x3d6c0a;var _0x2a71f6;return db[_0x7bc7('0x34')]['findOne']({'where':{'id':_0xe388f0[_0x7bc7('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1d3f19,null))[_0x7bc7('0x1a')](function(_0x4aef8c){if(_0x4aef8c){_0x3d6c0a=_0x4aef8c;_0x361901[_0x7bc7('0x36')]=_[_0x7bc7('0x37')](db[_0x7bc7('0x53')][_0x7bc7('0x35')]);_0x361901[_0x7bc7('0x38')]=_[_0x7bc7('0x37')](_0xe388f0[_0x7bc7('0x38')]);_0x361901[_0x7bc7('0x42')]=_[_0x7bc7('0x3c')](_0x361901['model'],_0x361901[_0x7bc7('0x38')]);_0x27b3fb[_0x7bc7('0x3b')]=_[_0x7bc7('0x3c')](_0x361901[_0x7bc7('0x36')],qs[_0x7bc7('0x3d')](_0xe388f0[_0x7bc7('0x38')][_0x7bc7('0x3d')]));_0x27b3fb['attributes']=_0x27b3fb[_0x7bc7('0x3b')][_0x7bc7('0x3e')]?_0x27b3fb[_0x7bc7('0x3b')]:_0x361901[_0x7bc7('0x36')];_0x27b3fb[_0x7bc7('0x54')]=qs[_0x7bc7('0x40')](_0xe388f0[_0x7bc7('0x38')]['sort']);_0x27b3fb[_0x7bc7('0x41')]=qs['filters'](_['pick'](_0xe388f0['query'],_0x361901[_0x7bc7('0x42')]));if(_0xe388f0[_0x7bc7('0x38')][_0x7bc7('0x47')]){_0x27b3fb[_0x7bc7('0x41')]=_['merge'](_0x27b3fb[_0x7bc7('0x41')],{'$or':_['map'](_0x27b3fb[_0x7bc7('0x3b')],function(_0x3a8716){var _0x42dc0f={};_0x42dc0f[_0x3a8716]={'$like':'%'+_0xe388f0[_0x7bc7('0x38')][_0x7bc7('0x47')]+'%'};return _0x42dc0f;})});}_0x27b3fb=_[_0x7bc7('0x46')]({},_0x27b3fb,_0xe388f0['options']);return _0x3d6c0a['getConfigurations'](_0x27b3fb);}})[_0x7bc7('0x1a')](function(_0xfca72a){if(_0xfca72a){_0x2a71f6=_0xfca72a[_0x7bc7('0x3e')];if(!_0xe388f0[_0x7bc7('0x38')][_0x7bc7('0x3f')](_0x7bc7('0x55'))){_0x27b3fb['limit']=qs[_0x7bc7('0x29')](_0xe388f0[_0x7bc7('0x38')]['limit']);_0x27b3fb[_0x7bc7('0x28')]=qs[_0x7bc7('0x28')](_0xe388f0[_0x7bc7('0x38')][_0x7bc7('0x28')]);}return _0x3d6c0a[_0x7bc7('0x52')](_0x27b3fb);}})[_0x7bc7('0x1a')](function(_0x439309){if(_0x439309){return _0x439309?{'count':_0x2a71f6,'rows':_0x439309}:null;}})[_0x7bc7('0x1a')](respondWithResult(_0x1d3f19,null))['catch'](handleError(_0x1d3f19,null));};exports['addConfiguration']=function(_0x1be866,_0x65b6f7,_0x4ca0ca){if(_0x1be866[_0x7bc7('0x51')]['id']){delete _0x1be866[_0x7bc7('0x51')]['id'];}return db[_0x7bc7('0x34')][_0x7bc7('0x56')]({'where':{'id':_0x1be866['params']['id']}})[_0x7bc7('0x1a')](handleEntityNotFound(_0x65b6f7,null))[_0x7bc7('0x1a')](function(_0x43b66c){if(_0x43b66c){_0x1be866['body'][_0x7bc7('0x57')]=_0x43b66c['id'];_0x1be866[_0x7bc7('0x51')][_0x7bc7('0x58')]=integrations['getSubjects'](_0x1be866[_0x7bc7('0x51')][_0x7bc7('0x59')],_0x1be866['body']['type']);_0x1be866[_0x7bc7('0x51')][_0x7bc7('0x5a')]=integrations[_0x7bc7('0x5b')](_0x1be866[_0x7bc7('0x51')]['channel'],_0x1be866['body']['type']);return db[_0x7bc7('0x53')][_0x7bc7('0x50')](_0x1be866[_0x7bc7('0x51')],{'include':[{'model':db[_0x7bc7('0x5c')],'as':_0x7bc7('0x58')},{'model':db[_0x7bc7('0x5c')],'as':'Descriptions'}]});}return null;})[_0x7bc7('0x1a')](respondWithResult(_0x65b6f7,null))['catch'](handleError(_0x65b6f7,null));};exports[_0x7bc7('0x5d')]=function(_0x359ee1,_0x141c7d,_0x2468ab){var _0x17e012;return db[_0x7bc7('0x34')][_0x7bc7('0x56')]({'where':{'id':_0x359ee1['params']['id']},'attributes':['id',_0x7bc7('0x5e'),_0x7bc7('0x5f'),_0x7bc7('0x60'),_0x7bc7('0x61'),'password',_0x7bc7('0x62')]})[_0x7bc7('0x1a')](handleEntityNotFound(_0x141c7d,null))[_0x7bc7('0x1a')](function(_0x18156d){if(_0x18156d){_0x17e012=new jsforce[(_0x7bc7('0x63'))]({'oauth2':{'loginUrl':_0x18156d[_0x7bc7('0x5e')],'clientId':_0x18156d[_0x7bc7('0x5f')],'clientSecret':_0x18156d[_0x7bc7('0x60')]}});return _0x17e012[_0x7bc7('0x64')](_0x18156d['username'],_0x18156d[_0x7bc7('0x65')][_0x7bc7('0x66')](_0x18156d[_0x7bc7('0x62')]));}})['then'](function(_0x1a7ede){if(_0x1a7ede){return _0x17e012[_0x7bc7('0x67')](_0x7bc7('0x68'))['describe']();}})[_0x7bc7('0x1a')](function(_0xec11ec){var _0x28a728=[_0x7bc7('0x69'),_0x7bc7('0x6a'),_0x7bc7('0x6b'),_0x7bc7('0x6c'),_0x7bc7('0x6d'),_0x7bc7('0x6e'),_0x7bc7('0x6f'),_0x7bc7('0x70')];if(_0xec11ec){_[_0x7bc7('0x71')](_0xec11ec[_0x7bc7('0x3d')],function(_0x437e5b){return _0x437e5b[_0x7bc7('0x72')]===![]&&!_0x28a728['includes'](_0x437e5b[_0x7bc7('0x31')]);});return{'count':_0xec11ec[_0x7bc7('0x3d')][_0x7bc7('0x3e')],'rows':_[_0x7bc7('0x48')](_0xec11ec[_0x7bc7('0x3d')],function(_0x8958ec){return{'id':_0x8958ec['name'],'name':_0x8958ec[_0x7bc7('0x73')],'custom':_0x8958ec[_0x7bc7('0x72')],'options':_0x8958ec[_0x7bc7('0x74')]?_[_0x7bc7('0x48')](_0x8958ec[_0x7bc7('0x74')],function(_0x114405){return{'name':_0x114405[_0x7bc7('0x73')],'value':_0x114405[_0x7bc7('0x75')]};}):[]};})};}})['then'](respondWithResult(_0x141c7d,null))[_0x7bc7('0x23')](function(_0x2c4883){var _0x24c16f=_0x359ee1['query']['test']?0x1f4:_0x2c4883[_0x7bc7('0x76')]||0x1f4;logger['error'](_0x7bc7('0x77'),_0x7bc7('0x5d'),_0x24c16f,JSON[_0x7bc7('0x1f')](_0x2c4883));delete _0x2c4883['name'];if(_0x24c16f===0x191){_0x24c16f=0x190;}_0x141c7d['status'](_0x24c16f)[_0x7bc7('0x32')](_0x359ee1[_0x7bc7('0x38')][_0x7bc7('0x78')]?{'message':_0x7bc7('0x79'),'statusCode':_0x2c4883[_0x7bc7('0x76')]}:_0x2c4883);});}; \ No newline at end of file +var _0xd3d2=['findOne','pick','addConfiguration','AccountId','Subjects','getSubjects','type','channel','SalesforceConfiguration','SalesforceField','Descriptions','getFields','remoteUri','clientId','clientSecret','username','password','securityToken','Connection','sobject','Task','CallDisposition','CallObject','Priority','Status','Type','custom','includes','picklistValues','label','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','stack','name','send','rawAttributes','query','dateEnd','dateStart','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','add','day','merge','filter','map','SalesforceAccount','findAll','rows','params','length','includeAll','options','create','body','find','destroy','getConfigurations'];(function(_0x9e5d24,_0x4865dd){var _0x936898=function(_0x3f4275){while(--_0x3f4275){_0x9e5d24['push'](_0x9e5d24['shift']());}};_0x936898(++_0x4865dd);}(_0xd3d2,0x96));var _0x2d3d=function(_0x3f1dac,_0x8d94c8){_0x3f1dac=_0x3f1dac-0x0;var _0x34a2dc=_0xd3d2[_0x3f1dac];return _0x34a2dc;};'use strict';var pdf=require(_0x2d3d('0x0'));var emlformat=require(_0x2d3d('0x1'));var rimraf=require(_0x2d3d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d3d('0x3'));var rp=require('request-promise');var moment=require(_0x2d3d('0x4'));var BPromise=require(_0x2d3d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x2d3d('0x6'));var ejs=require(_0x2d3d('0x7'));var fs=require('fs');var _=require(_0x2d3d('0x8'));var squel=require(_0x2d3d('0x9'));var crypto=require('crypto');var jsforce=require(_0x2d3d('0xa'));var deskjs=require(_0x2d3d('0xb'));var toCsv=require(_0x2d3d('0x6'));var querystring=require(_0x2d3d('0xc'));var Papa=require(_0x2d3d('0xd'));var Redis=require(_0x2d3d('0xe'));var qs=require(_0x2d3d('0xf'));var logger=require(_0x2d3d('0x10'))(_0x2d3d('0x11'));var utils=require(_0x2d3d('0x12'));var config=require(_0x2d3d('0x13'));var db=require(_0x2d3d('0x14'))['db'];var integrations=require(_0x2d3d('0x15'));var jayson=require('jayson/promise');var client=jayson[_0x2d3d('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9bad45,_0xd83e5f,_0x2b8bad,_0x20d2ef){return new BPromise(function(_0x522543,_0x351ce7){var _0x59eb33=_0x20d2ef||client;return _0x59eb33[_0x2d3d('0x17')](_0x9bad45,_0x2b8bad)[_0x2d3d('0x18')](function(_0x58fee8){logger[_0x2d3d('0x19')](_0x2d3d('0x1a'),_0xd83e5f,_0x2d3d('0x1b'));logger['debug'](_0x2d3d('0x1c'),_0xd83e5f,_0x2d3d('0x1b'),JSON[_0x2d3d('0x1d')](_0x58fee8));if(_0x58fee8[_0x2d3d('0x1e')]){if(_0x58fee8[_0x2d3d('0x1e')][_0x2d3d('0x1f')]===0x1f4){logger[_0x2d3d('0x1e')](_0x2d3d('0x1a'),_0xd83e5f,_0x58fee8[_0x2d3d('0x1e')][_0x2d3d('0x20')]);return _0x351ce7(_0x58fee8[_0x2d3d('0x1e')][_0x2d3d('0x20')]);}logger[_0x2d3d('0x1e')](_0x2d3d('0x1a'),_0xd83e5f,_0x58fee8['error'][_0x2d3d('0x20')]);return _0x522543(_0x58fee8[_0x2d3d('0x1e')][_0x2d3d('0x20')]);}else{logger['info'](_0x2d3d('0x1a'),_0xd83e5f,_0x2d3d('0x1b'));_0x522543(_0x58fee8[_0x2d3d('0x21')]['message']);}})[_0x2d3d('0x22')](function(_0x2705c1){logger[_0x2d3d('0x1e')](_0x2d3d('0x1a'),_0xd83e5f,_0x2705c1);_0x351ce7(_0x2705c1);});});}function respondWithStatusCode(_0x595124,_0x485f36){_0x485f36=_0x485f36||0xcc;return function(_0x1a7718){if(_0x1a7718){return _0x595124[_0x2d3d('0x23')](_0x485f36);}return _0x595124[_0x2d3d('0x24')](_0x485f36)['end']();};}function respondWithResult(_0xe1935e,_0x4e5971){_0x4e5971=_0x4e5971||0xc8;return function(_0x40bd90){if(_0x40bd90){return _0xe1935e[_0x2d3d('0x24')](_0x4e5971)['json'](_0x40bd90);}};}function respondWithFilteredResult(_0x581c26,_0x422e38){return function(_0x10377a){if(_0x10377a){var _0x3aae8d=_0x10377a[_0x2d3d('0x25')],_0x4b42eb=_0x422e38[_0x2d3d('0x26')],_0x533887=_0x422e38['offset']+_0x422e38[_0x2d3d('0x27')],_0xbc69ac;if(_0x533887>=_0x3aae8d){_0x533887=_0x3aae8d;_0xbc69ac=0xc8;}else{_0xbc69ac=0xce;}_0x581c26[_0x2d3d('0x24')](_0xbc69ac);return _0x581c26[_0x2d3d('0x28')](_0x2d3d('0x29'),_0x4b42eb+'-'+_0x533887+'/'+_0x3aae8d)[_0x2d3d('0x2a')](_0x10377a);}return null;};}function patchUpdates(_0x39e192){return function(_0x5bd3b7){try{jsonpatch[_0x2d3d('0x2b')](_0x5bd3b7,_0x39e192,!![]);}catch(_0x2fae55){return BPromise[_0x2d3d('0x2c')](_0x2fae55);}return _0x5bd3b7[_0x2d3d('0x2d')]();};}function saveUpdates(_0x2125e4,_0x2dec22){return function(_0xb1205e){if(_0xb1205e){return _0xb1205e[_0x2d3d('0x2e')](_0x2125e4)[_0x2d3d('0x18')](function(_0x12ab0c){return _0x12ab0c;});}return null;};}function removeEntity(_0x46f0f7,_0x24405c){return function(_0x1fd6ac){if(_0x1fd6ac){return _0x1fd6ac['destroy']()[_0x2d3d('0x18')](function(){_0x46f0f7[_0x2d3d('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2471a2,_0x4fa4eb){return function(_0x2d167e){if(!_0x2d167e){_0x2471a2['sendStatus'](0x194);}return _0x2d167e;};}function handleError(_0x2869fa,_0x3fdc0d){_0x3fdc0d=_0x3fdc0d||0x1f4;return function(_0x4c9f3b){logger[_0x2d3d('0x1e')](_0x4c9f3b[_0x2d3d('0x2f')]);if(_0x4c9f3b[_0x2d3d('0x30')]){delete _0x4c9f3b[_0x2d3d('0x30')];}_0x2869fa[_0x2d3d('0x24')](_0x3fdc0d)[_0x2d3d('0x31')](_0x4c9f3b);};}exports['index']=function(_0x1d83b8,_0x41ae0e){var _0x23ae37={},_0x19be29={},_0x46bd63={'count':0x0,'rows':[]};var _0x321501=db['SalesforceAccount'][_0x2d3d('0x32')];_0x19be29['model']=_['keys'](_0x321501);var _0x3dfb09={'dateStart':_0x1d83b8[_0x2d3d('0x33')]['dateStart'],'dateEnd':_0x1d83b8[_0x2d3d('0x33')][_0x2d3d('0x34')]};delete _0x1d83b8[_0x2d3d('0x33')][_0x2d3d('0x35')];delete _0x1d83b8[_0x2d3d('0x33')][_0x2d3d('0x34')];_0x19be29[_0x2d3d('0x33')]=_[_0x2d3d('0x36')](_0x1d83b8[_0x2d3d('0x33')]);_0x19be29[_0x2d3d('0x37')]=_[_0x2d3d('0x38')](_0x19be29[_0x2d3d('0x39')],_0x19be29['query']);_0x23ae37[_0x2d3d('0x3a')]=_[_0x2d3d('0x38')](_0x19be29[_0x2d3d('0x39')],qs[_0x2d3d('0x3b')](_0x1d83b8[_0x2d3d('0x33')][_0x2d3d('0x3b')]));_0x23ae37[_0x2d3d('0x3a')]=_0x23ae37['attributes']['length']?_0x23ae37[_0x2d3d('0x3a')]:_0x19be29[_0x2d3d('0x39')];if(!_0x1d83b8[_0x2d3d('0x33')][_0x2d3d('0x3c')](_0x2d3d('0x3d'))){_0x23ae37[_0x2d3d('0x27')]=qs[_0x2d3d('0x27')](_0x1d83b8[_0x2d3d('0x33')][_0x2d3d('0x27')]);_0x23ae37[_0x2d3d('0x26')]=qs[_0x2d3d('0x26')](_0x1d83b8[_0x2d3d('0x33')]['offset']);}_0x23ae37[_0x2d3d('0x3e')]=qs[_0x2d3d('0x3f')](_0x1d83b8[_0x2d3d('0x33')][_0x2d3d('0x3f')]);_0x23ae37[_0x2d3d('0x40')]=qs[_0x2d3d('0x37')](_['pick'](_0x1d83b8[_0x2d3d('0x33')],_0x19be29[_0x2d3d('0x37')]));if(_0x3dfb09[_0x2d3d('0x35')]){if(_0x3dfb09['dateEnd']){_0x3dfb09['dateEnd']=moment(_0x3dfb09['dateEnd'])[_0x2d3d('0x41')](0x1,_0x2d3d('0x42'));}else{_0x3dfb09[_0x2d3d('0x34')]=moment(_0x3dfb09[_0x2d3d('0x35')])['add'](0x1,'day');}_[_0x2d3d('0x43')](_0x23ae37['where'],{'createdAt':{'$gte':_0x3dfb09[_0x2d3d('0x35')],'$lte':_0x3dfb09[_0x2d3d('0x34')]}});}if(_0x1d83b8[_0x2d3d('0x33')][_0x2d3d('0x44')]){_0x23ae37[_0x2d3d('0x40')]=_[_0x2d3d('0x43')](_0x23ae37[_0x2d3d('0x40')],{'$or':_[_0x2d3d('0x45')](_0x23ae37['attributes'],function(_0x199e3b){var _0x130417={};_0x130417[_0x199e3b]={'$like':'%'+_0x1d83b8[_0x2d3d('0x33')][_0x2d3d('0x44')]+'%'};return _0x130417;})});}_0x23ae37=_[_0x2d3d('0x43')]({},_0x23ae37,_0x1d83b8['options']);var _0x187692={'where':_0x23ae37[_0x2d3d('0x40')]};return db[_0x2d3d('0x46')][_0x2d3d('0x25')](_0x187692)[_0x2d3d('0x18')](function(_0x43ea82){_0x46bd63[_0x2d3d('0x25')]=_0x43ea82;if(_0x1d83b8[_0x2d3d('0x33')]['includeAll']){_0x23ae37['include']=[{'all':!![]}];}return db['SalesforceAccount'][_0x2d3d('0x47')](_0x23ae37);})[_0x2d3d('0x18')](function(_0x2a0ffa){_0x46bd63[_0x2d3d('0x48')]=_0x2a0ffa;return _0x46bd63;})[_0x2d3d('0x18')](respondWithFilteredResult(_0x41ae0e,_0x23ae37))[_0x2d3d('0x22')](handleError(_0x41ae0e,null));};exports['show']=function(_0x17c912,_0x2d00f5){var _0x17f5fd={'raw':![],'where':{'id':_0x17c912[_0x2d3d('0x49')]['id']}},_0x53e916={};_0x53e916[_0x2d3d('0x39')]=_['keys'](db[_0x2d3d('0x46')]['rawAttributes']);_0x53e916['query']=_[_0x2d3d('0x36')](_0x17c912[_0x2d3d('0x33')]);_0x53e916[_0x2d3d('0x37')]=_[_0x2d3d('0x38')](_0x53e916['model'],_0x53e916[_0x2d3d('0x33')]);_0x17f5fd[_0x2d3d('0x3a')]=_[_0x2d3d('0x38')](_0x53e916[_0x2d3d('0x39')],qs[_0x2d3d('0x3b')](_0x17c912['query']['fields']));_0x17f5fd['attributes']=_0x17f5fd[_0x2d3d('0x3a')][_0x2d3d('0x4a')]?_0x17f5fd['attributes']:_0x53e916['model'];if(_0x17c912['query'][_0x2d3d('0x4b')]){_0x17f5fd['include']=[{'all':!![]}];}_0x17f5fd=_[_0x2d3d('0x43')]({},_0x17f5fd,_0x17c912[_0x2d3d('0x4c')]);return db['SalesforceAccount']['find'](_0x17f5fd)[_0x2d3d('0x18')](handleEntityNotFound(_0x2d00f5,null))[_0x2d3d('0x18')](respondWithResult(_0x2d00f5,null))['catch'](handleError(_0x2d00f5,null));};exports[_0x2d3d('0x4d')]=function(_0x314eda,_0x541259){return db[_0x2d3d('0x46')]['create'](_0x314eda[_0x2d3d('0x4e')],{})[_0x2d3d('0x18')](respondWithResult(_0x541259,0xc9))[_0x2d3d('0x22')](handleError(_0x541259,null));};exports[_0x2d3d('0x2e')]=function(_0x4d9760,_0xa81bfe){if(_0x4d9760[_0x2d3d('0x4e')]['id']){delete _0x4d9760[_0x2d3d('0x4e')]['id'];}return db[_0x2d3d('0x46')][_0x2d3d('0x4f')]({'where':{'id':_0x4d9760['params']['id']}})[_0x2d3d('0x18')](handleEntityNotFound(_0xa81bfe,null))[_0x2d3d('0x18')](saveUpdates(_0x4d9760['body'],null))[_0x2d3d('0x18')](respondWithResult(_0xa81bfe,null))[_0x2d3d('0x22')](handleError(_0xa81bfe,null));};exports[_0x2d3d('0x50')]=function(_0x60511,_0x1fb7ee){return db[_0x2d3d('0x46')][_0x2d3d('0x4f')]({'where':{'id':_0x60511[_0x2d3d('0x49')]['id']}})['then'](handleEntityNotFound(_0x1fb7ee,null))[_0x2d3d('0x18')](removeEntity(_0x1fb7ee,null))['catch'](handleError(_0x1fb7ee,null));};exports[_0x2d3d('0x51')]=function(_0x76f8b6,_0x28d3f0,_0x1a5ec3){var _0x5e1f71={};var _0x57b2e7={};var _0x3da661;var _0xa0213d;return db[_0x2d3d('0x46')][_0x2d3d('0x52')]({'where':{'id':_0x76f8b6['params']['id']}})['then'](handleEntityNotFound(_0x28d3f0,null))[_0x2d3d('0x18')](function(_0x53e970){if(_0x53e970){_0x3da661=_0x53e970;_0x57b2e7[_0x2d3d('0x39')]=_[_0x2d3d('0x36')](db['SalesforceConfiguration'][_0x2d3d('0x32')]);_0x57b2e7[_0x2d3d('0x33')]=_[_0x2d3d('0x36')](_0x76f8b6['query']);_0x57b2e7['filters']=_[_0x2d3d('0x38')](_0x57b2e7[_0x2d3d('0x39')],_0x57b2e7[_0x2d3d('0x33')]);_0x5e1f71['attributes']=_[_0x2d3d('0x38')](_0x57b2e7['model'],qs['fields'](_0x76f8b6['query'][_0x2d3d('0x3b')]));_0x5e1f71[_0x2d3d('0x3a')]=_0x5e1f71[_0x2d3d('0x3a')][_0x2d3d('0x4a')]?_0x5e1f71[_0x2d3d('0x3a')]:_0x57b2e7[_0x2d3d('0x39')];_0x5e1f71[_0x2d3d('0x3e')]=qs[_0x2d3d('0x3f')](_0x76f8b6[_0x2d3d('0x33')][_0x2d3d('0x3f')]);_0x5e1f71['where']=qs['filters'](_[_0x2d3d('0x53')](_0x76f8b6['query'],_0x57b2e7['filters']));if(_0x76f8b6[_0x2d3d('0x33')]['filter']){_0x5e1f71[_0x2d3d('0x40')]=_[_0x2d3d('0x43')](_0x5e1f71['where'],{'$or':_[_0x2d3d('0x45')](_0x5e1f71['attributes'],function(_0x182a34){var _0xa80715={};_0xa80715[_0x182a34]={'$like':'%'+_0x76f8b6[_0x2d3d('0x33')][_0x2d3d('0x44')]+'%'};return _0xa80715;})});}_0x5e1f71=_[_0x2d3d('0x43')]({},_0x5e1f71,_0x76f8b6['options']);return _0x3da661[_0x2d3d('0x51')](_0x5e1f71);}})['then'](function(_0x1393b9){if(_0x1393b9){_0xa0213d=_0x1393b9['length'];if(!_0x76f8b6[_0x2d3d('0x33')]['hasOwnProperty'](_0x2d3d('0x3d'))){_0x5e1f71[_0x2d3d('0x27')]=qs[_0x2d3d('0x27')](_0x76f8b6[_0x2d3d('0x33')]['limit']);_0x5e1f71['offset']=qs[_0x2d3d('0x26')](_0x76f8b6[_0x2d3d('0x33')][_0x2d3d('0x26')]);}return _0x3da661[_0x2d3d('0x51')](_0x5e1f71);}})['then'](function(_0x4f8dc3){if(_0x4f8dc3){return _0x4f8dc3?{'count':_0xa0213d,'rows':_0x4f8dc3}:null;}})[_0x2d3d('0x18')](respondWithResult(_0x28d3f0,null))[_0x2d3d('0x22')](handleError(_0x28d3f0,null));};exports[_0x2d3d('0x54')]=function(_0x18795d,_0x39814e,_0x14e83d){if(_0x18795d[_0x2d3d('0x4e')]['id']){delete _0x18795d['body']['id'];}return db[_0x2d3d('0x46')][_0x2d3d('0x52')]({'where':{'id':_0x18795d[_0x2d3d('0x49')]['id']}})[_0x2d3d('0x18')](handleEntityNotFound(_0x39814e,null))[_0x2d3d('0x18')](function(_0x1cb22e){if(_0x1cb22e){_0x18795d[_0x2d3d('0x4e')][_0x2d3d('0x55')]=_0x1cb22e['id'];_0x18795d[_0x2d3d('0x4e')][_0x2d3d('0x56')]=integrations[_0x2d3d('0x57')](_0x18795d['body']['channel'],_0x18795d['body'][_0x2d3d('0x58')]);_0x18795d[_0x2d3d('0x4e')]['Descriptions']=integrations['getDescriptions'](_0x18795d[_0x2d3d('0x4e')][_0x2d3d('0x59')],_0x18795d['body'][_0x2d3d('0x58')]);return db[_0x2d3d('0x5a')][_0x2d3d('0x4d')](_0x18795d[_0x2d3d('0x4e')],{'include':[{'model':db['SalesforceField'],'as':_0x2d3d('0x56')},{'model':db[_0x2d3d('0x5b')],'as':_0x2d3d('0x5c')}]});}return null;})[_0x2d3d('0x18')](respondWithResult(_0x39814e,null))['catch'](handleError(_0x39814e,null));};exports[_0x2d3d('0x5d')]=function(_0x31b584,_0xc91087,_0x1b02c0){var _0x40f06e;return db[_0x2d3d('0x46')][_0x2d3d('0x52')]({'where':{'id':_0x31b584[_0x2d3d('0x49')]['id']},'attributes':['id',_0x2d3d('0x5e'),_0x2d3d('0x5f'),_0x2d3d('0x60'),_0x2d3d('0x61'),_0x2d3d('0x62'),_0x2d3d('0x63')]})[_0x2d3d('0x18')](handleEntityNotFound(_0xc91087,null))[_0x2d3d('0x18')](function(_0x40d8ec){if(_0x40d8ec){_0x40f06e=new jsforce[(_0x2d3d('0x64'))]({'oauth2':{'loginUrl':_0x40d8ec[_0x2d3d('0x5e')],'clientId':_0x40d8ec[_0x2d3d('0x5f')],'clientSecret':_0x40d8ec[_0x2d3d('0x60')]}});return _0x40f06e['login'](_0x40d8ec['username'],_0x40d8ec['password']['concat'](_0x40d8ec[_0x2d3d('0x63')]));}})[_0x2d3d('0x18')](function(_0x5b1f02){if(_0x5b1f02){return _0x40f06e[_0x2d3d('0x65')](_0x2d3d('0x66'))['describe']();}})['then'](function(_0x21697e){var _0x1868e2=[_0x2d3d('0x67'),'CallDurationInSeconds',_0x2d3d('0x68'),'CallType','IsArchived',_0x2d3d('0x69'),_0x2d3d('0x6a'),_0x2d3d('0x6b')];if(_0x21697e){_['remove'](_0x21697e[_0x2d3d('0x3b')],function(_0x5e6f69){return _0x5e6f69[_0x2d3d('0x6c')]===![]&&!_0x1868e2[_0x2d3d('0x6d')](_0x5e6f69[_0x2d3d('0x30')]);});return{'count':_0x21697e[_0x2d3d('0x3b')]['length'],'rows':_[_0x2d3d('0x45')](_0x21697e[_0x2d3d('0x3b')],function(_0x130b12){return{'id':_0x130b12[_0x2d3d('0x30')],'name':_0x130b12['label'],'custom':_0x130b12['custom'],'options':_0x130b12[_0x2d3d('0x6e')]?_[_0x2d3d('0x45')](_0x130b12[_0x2d3d('0x6e')],function(_0x48989d){return{'name':_0x48989d[_0x2d3d('0x6f')],'value':_0x48989d['value']};}):[]};})};}})[_0x2d3d('0x18')](respondWithResult(_0xc91087,null))[_0x2d3d('0x22')](function(_0xca4d00){var _0x3f4ce2=_0x31b584['query'][_0x2d3d('0x70')]?0x1f4:_0xca4d00['statusCode']||0x1f4;logger[_0x2d3d('0x1e')](_0x2d3d('0x71'),'getFields',_0x3f4ce2,JSON[_0x2d3d('0x1d')](_0xca4d00));delete _0xca4d00[_0x2d3d('0x30')];if(_0x3f4ce2===0x191){_0x3f4ce2=0x190;}_0xc91087[_0x2d3d('0x24')](_0x3f4ce2)[_0x2d3d('0x31')](_0x31b584['query'][_0x2d3d('0x70')]?{'message':_0x2d3d('0x72'),'statusCode':_0xca4d00[_0x2d3d('0x73')]}:_0xca4d00);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index ab48034..cf70ce5 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 _0x57a2=['../../config/logger','api','moment','request-promise','./intSalesforceAccount.attributes','exports','int_salesforce_accounts'];(function(_0x3f186c,_0x407d8c){var _0x16f766=function(_0x145a9f){while(--_0x145a9f){_0x3f186c['push'](_0x3f186c['shift']());}};_0x16f766(++_0x407d8c);}(_0x57a2,0x173));var _0x257a=function(_0x1b2159,_0x1bb625){_0x1b2159=_0x1b2159-0x0;var _0x46d4cf=_0x57a2[_0x1b2159];return _0x46d4cf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x257a('0x0'))(_0x257a('0x1'));var moment=require(_0x257a('0x2'));var BPromise=require('bluebird');var rp=require(_0x257a('0x3'));var attributes=require(_0x257a('0x4'));var integrations=require('../../components/integrations/configuration');module[_0x257a('0x5')]=function(_0x46e877,_0x2273f2){return _0x46e877['define']('SalesforceAccount',attributes,{'tableName':_0x257a('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c74=['int_salesforce_accounts','util','../../config/logger','api','moment','bluebird','request-promise','./intSalesforceAccount.attributes','exports','define'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0x0c74,0x1cd));var _0x40c7=function(_0x31c5fd,_0x33131f){_0x31c5fd=_0x31c5fd-0x0;var _0x3799ab=_0x0c74[_0x31c5fd];return _0x3799ab;};'use strict';var _=require('lodash');var util=require(_0x40c7('0x0'));var logger=require(_0x40c7('0x1'))(_0x40c7('0x2'));var moment=require(_0x40c7('0x3'));var BPromise=require(_0x40c7('0x4'));var rp=require(_0x40c7('0x5'));var attributes=require(_0x40c7('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x40c7('0x7')]=function(_0x985d0,_0x21c3f4){return _0x985d0[_0x40c7('0x8')]('SalesforceAccount',attributes,{'tableName':_0x40c7('0x9'),'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 77f5212..8e1b729 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 _0xad9c=['message','info','GetSalesforceAccount','SalesforceAccount','findAll','options','attributes','map','include','model','debug','catch','ShowSalesforceAccount','find','raw','where','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5ac3c1,_0x21d8e2){var _0xfcb2b6=function(_0x3fcf98){while(--_0x3fcf98){_0x5ac3c1['push'](_0x5ac3c1['shift']());}};_0xfcb2b6(++_0x21d8e2);}(_0xad9c,0x186));var _0xcad9=function(_0x2029f8,_0x1685e5){_0x2029f8=_0x2029f8-0x0;var _0x486eda=_0xad9c[_0x2029f8];return _0x486eda;};'use strict';var _=require('lodash');var util=require(_0xcad9('0x0'));var moment=require(_0xcad9('0x1'));var BPromise=require(_0xcad9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcad9('0x3'));var db=require(_0xcad9('0x4'))['db'];var utils=require(_0xcad9('0x5'));var logger=require('../../config/logger')(_0xcad9('0x6'));var config=require('../../config/environment');var jayson=require(_0xcad9('0x7'));var client=jayson[_0xcad9('0x8')][_0xcad9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e8d1e,_0x1c77b5,_0x45f007){return new BPromise(function(_0x25f4f6,_0x5ac69c){return client[_0xcad9('0xa')](_0x3e8d1e,_0x45f007)[_0xcad9('0xb')](function(_0x4976e3){logger['info'](_0xcad9('0xc'),_0x1c77b5,_0xcad9('0xd'));logger['debug'](_0xcad9('0xe'),_0x1c77b5,_0xcad9('0xd'),JSON[_0xcad9('0xf')](_0x4976e3));if(_0x4976e3[_0xcad9('0x10')]){if(_0x4976e3[_0xcad9('0x10')][_0xcad9('0x11')]===0x1f4){logger[_0xcad9('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x1c77b5,_0x4976e3[_0xcad9('0x10')][_0xcad9('0x12')]);return _0x5ac69c(_0x4976e3[_0xcad9('0x10')]['message']);}logger[_0xcad9('0x10')](_0xcad9('0xc'),_0x1c77b5,_0x4976e3[_0xcad9('0x10')][_0xcad9('0x12')]);return _0x25f4f6(_0x4976e3[_0xcad9('0x10')][_0xcad9('0x12')]);}else{logger[_0xcad9('0x13')](_0xcad9('0xc'),_0x1c77b5,'request\x20sent');_0x25f4f6(_0x4976e3['result'][_0xcad9('0x12')]);}})['catch'](function(_0x354e5a){logger['error'](_0xcad9('0xc'),_0x1c77b5,_0x354e5a);_0x5ac69c(_0x354e5a);});});}exports[_0xcad9('0x14')]=function(_0x1b7ac9){var _0x574797=this;return new Promise(function(_0x45d6ad,_0x3544dd){return db[_0xcad9('0x15')][_0xcad9('0x16')]({'raw':_0x1b7ac9[_0xcad9('0x17')]?_0x1b7ac9[_0xcad9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1b7ac9[_0xcad9('0x17')]?_0x1b7ac9['options']['where']||null:null,'attributes':_0x1b7ac9[_0xcad9('0x17')]?_0x1b7ac9['options'][_0xcad9('0x18')]||null:null,'limit':_0x1b7ac9['options']?_0x1b7ac9[_0xcad9('0x17')]['limit']||null:null,'include':_0x1b7ac9['options']?_0x1b7ac9['options']['include']?_[_0xcad9('0x19')](_0x1b7ac9[_0xcad9('0x17')][_0xcad9('0x1a')],function(_0x50e42e){return{'model':db[_0x50e42e[_0xcad9('0x1b')]],'as':_0x50e42e['as'],'attributes':_0x50e42e[_0xcad9('0x18')],'include':_0x50e42e['include']?_[_0xcad9('0x19')](_0x50e42e['include'],function(_0x4559c5){return{'model':db[_0x4559c5[_0xcad9('0x1b')]],'as':_0x4559c5['as'],'attributes':_0x4559c5[_0xcad9('0x18')],'include':_0x4559c5[_0xcad9('0x1a')]?_[_0xcad9('0x19')](_0x4559c5['include'],function(_0x1760b0){return{'model':db[_0x1760b0[_0xcad9('0x1b')]],'as':_0x1760b0['as'],'attributes':_0x1760b0['attributes']};}):[]};}):[]};}):[]:[]})[_0xcad9('0xb')](function(_0x3ccbbe){logger[_0xcad9('0x13')]('GetSalesforceAccount',_0x1b7ac9);logger[_0xcad9('0x1c')](_0xcad9('0x14'),_0x1b7ac9,JSON['stringify'](_0x3ccbbe));_0x45d6ad(_0x3ccbbe);})[_0xcad9('0x1d')](function(_0x3b4cb3){logger[_0xcad9('0x10')](_0xcad9('0x14'),_0x3b4cb3[_0xcad9('0x12')],_0x1b7ac9);_0x3544dd(_0x574797[_0xcad9('0x10')](0x1f4,_0x3b4cb3[_0xcad9('0x12')]));});});};exports[_0xcad9('0x1e')]=function(_0x505e33){var _0x176ec1=this;return new Promise(function(_0x4b8d28,_0x5618e1){return db[_0xcad9('0x15')][_0xcad9('0x1f')]({'raw':_0x505e33['options']?_0x505e33[_0xcad9('0x17')][_0xcad9('0x20')]===undefined?!![]:![]:!![],'where':_0x505e33[_0xcad9('0x17')]?_0x505e33['options'][_0xcad9('0x21')]||null:null,'attributes':_0x505e33['options']?_0x505e33['options'][_0xcad9('0x18')]||null:null,'include':_0x505e33[_0xcad9('0x17')]?_0x505e33[_0xcad9('0x17')][_0xcad9('0x1a')]?_[_0xcad9('0x19')](_0x505e33[_0xcad9('0x17')][_0xcad9('0x1a')],function(_0x376c1d){return{'model':db[_0x376c1d[_0xcad9('0x1b')]],'as':_0x376c1d['as'],'attributes':_0x376c1d[_0xcad9('0x18')],'include':_0x376c1d[_0xcad9('0x1a')]?_['map'](_0x376c1d[_0xcad9('0x1a')],function(_0x1bb64d){return{'model':db[_0x1bb64d[_0xcad9('0x1b')]],'as':_0x1bb64d['as'],'attributes':_0x1bb64d['attributes'],'include':_0x1bb64d[_0xcad9('0x1a')]?_[_0xcad9('0x19')](_0x1bb64d[_0xcad9('0x1a')],function(_0x3dd1e7){return{'model':db[_0x3dd1e7['model']],'as':_0x3dd1e7['as'],'attributes':_0x3dd1e7[_0xcad9('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xff995f){logger[_0xcad9('0x13')](_0xcad9('0x1e'),_0x505e33);logger[_0xcad9('0x1c')](_0xcad9('0x1e'),_0x505e33,JSON['stringify'](_0xff995f));_0x4b8d28(_0xff995f);})[_0xcad9('0x1d')](function(_0x5f119c){logger[_0xcad9('0x10')]('ShowSalesforceAccount',_0x5f119c[_0xcad9('0x12')],_0x505e33);_0x5618e1(_0x176ec1[_0xcad9('0x10')](0x1f4,_0x5f119c[_0xcad9('0x12')]));});});}; \ No newline at end of file +var _0x076d=['options','raw','where','attributes','limit','include','map','model','ShowSalesforceAccount','find','then','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetSalesforceAccount','findAll'];(function(_0x36baff,_0x428e9f){var _0x3ba722=function(_0x290707){while(--_0x290707){_0x36baff['push'](_0x36baff['shift']());}};_0x3ba722(++_0x428e9f);}(_0x076d,0x174));var _0xd076=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x076d[_0x173441];return _0x2423a8;};'use strict';var _=require(_0xd076('0x0'));var util=require(_0xd076('0x1'));var moment=require(_0xd076('0x2'));var BPromise=require(_0xd076('0x3'));var rs=require(_0xd076('0x4'));var fs=require('fs');var Redis=require(_0xd076('0x5'));var db=require(_0xd076('0x6'))['db'];var utils=require(_0xd076('0x7'));var logger=require(_0xd076('0x8'))(_0xd076('0x9'));var config=require(_0xd076('0xa'));var jayson=require(_0xd076('0xb'));var client=jayson[_0xd076('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x170ef6,_0x1af79e,_0x472a7c){return new BPromise(function(_0x23ceb8,_0x33cbbc){return client['request'](_0x170ef6,_0x472a7c)['then'](function(_0x3ce32a){logger[_0xd076('0xd')](_0xd076('0xe'),_0x1af79e,_0xd076('0xf'));logger[_0xd076('0x10')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x1af79e,_0xd076('0xf'),JSON['stringify'](_0x3ce32a));if(_0x3ce32a[_0xd076('0x11')]){if(_0x3ce32a[_0xd076('0x11')][_0xd076('0x12')]===0x1f4){logger[_0xd076('0x11')](_0xd076('0xe'),_0x1af79e,_0x3ce32a[_0xd076('0x11')]['message']);return _0x33cbbc(_0x3ce32a[_0xd076('0x11')][_0xd076('0x13')]);}logger['error'](_0xd076('0xe'),_0x1af79e,_0x3ce32a[_0xd076('0x11')][_0xd076('0x13')]);return _0x23ceb8(_0x3ce32a[_0xd076('0x11')]['message']);}else{logger['info'](_0xd076('0xe'),_0x1af79e,'request\x20sent');_0x23ceb8(_0x3ce32a[_0xd076('0x14')][_0xd076('0x13')]);}})[_0xd076('0x15')](function(_0x21bac2){logger['error'](_0xd076('0xe'),_0x1af79e,_0x21bac2);_0x33cbbc(_0x21bac2);});});}exports[_0xd076('0x16')]=function(_0x28bfaf){var _0x3bd9a8=this;return new Promise(function(_0x53d780,_0x568f83){return db['SalesforceAccount'][_0xd076('0x17')]({'raw':_0x28bfaf[_0xd076('0x18')]?_0x28bfaf[_0xd076('0x18')][_0xd076('0x19')]===undefined?!![]:![]:!![],'where':_0x28bfaf['options']?_0x28bfaf['options'][_0xd076('0x1a')]||null:null,'attributes':_0x28bfaf[_0xd076('0x18')]?_0x28bfaf[_0xd076('0x18')][_0xd076('0x1b')]||null:null,'limit':_0x28bfaf[_0xd076('0x18')]?_0x28bfaf[_0xd076('0x18')][_0xd076('0x1c')]||null:null,'include':_0x28bfaf[_0xd076('0x18')]?_0x28bfaf[_0xd076('0x18')][_0xd076('0x1d')]?_[_0xd076('0x1e')](_0x28bfaf['options'][_0xd076('0x1d')],function(_0x20aa43){return{'model':db[_0x20aa43[_0xd076('0x1f')]],'as':_0x20aa43['as'],'attributes':_0x20aa43[_0xd076('0x1b')],'include':_0x20aa43['include']?_[_0xd076('0x1e')](_0x20aa43['include'],function(_0x101b7f){return{'model':db[_0x101b7f['model']],'as':_0x101b7f['as'],'attributes':_0x101b7f[_0xd076('0x1b')],'include':_0x101b7f['include']?_[_0xd076('0x1e')](_0x101b7f[_0xd076('0x1d')],function(_0x3377ef){return{'model':db[_0x3377ef[_0xd076('0x1f')]],'as':_0x3377ef['as'],'attributes':_0x3377ef[_0xd076('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57a264){logger[_0xd076('0xd')](_0xd076('0x16'),_0x28bfaf);logger[_0xd076('0x10')](_0xd076('0x16'),_0x28bfaf,JSON['stringify'](_0x57a264));_0x53d780(_0x57a264);})[_0xd076('0x15')](function(_0xab34eb){logger[_0xd076('0x11')](_0xd076('0x16'),_0xab34eb[_0xd076('0x13')],_0x28bfaf);_0x568f83(_0x3bd9a8[_0xd076('0x11')](0x1f4,_0xab34eb[_0xd076('0x13')]));});});};exports[_0xd076('0x20')]=function(_0x1d8a35){var _0x2e0887=this;return new Promise(function(_0x247744,_0x5f4eac){return db['SalesforceAccount'][_0xd076('0x21')]({'raw':_0x1d8a35[_0xd076('0x18')]?_0x1d8a35['options'][_0xd076('0x19')]===undefined?!![]:![]:!![],'where':_0x1d8a35[_0xd076('0x18')]?_0x1d8a35[_0xd076('0x18')][_0xd076('0x1a')]||null:null,'attributes':_0x1d8a35[_0xd076('0x18')]?_0x1d8a35[_0xd076('0x18')][_0xd076('0x1b')]||null:null,'include':_0x1d8a35[_0xd076('0x18')]?_0x1d8a35[_0xd076('0x18')][_0xd076('0x1d')]?_[_0xd076('0x1e')](_0x1d8a35[_0xd076('0x18')]['include'],function(_0xe122e9){return{'model':db[_0xe122e9[_0xd076('0x1f')]],'as':_0xe122e9['as'],'attributes':_0xe122e9['attributes'],'include':_0xe122e9['include']?_[_0xd076('0x1e')](_0xe122e9[_0xd076('0x1d')],function(_0x390e46){return{'model':db[_0x390e46[_0xd076('0x1f')]],'as':_0x390e46['as'],'attributes':_0x390e46[_0xd076('0x1b')],'include':_0x390e46[_0xd076('0x1d')]?_[_0xd076('0x1e')](_0x390e46['include'],function(_0x1598a4){return{'model':db[_0x1598a4[_0xd076('0x1f')]],'as':_0x1598a4['as'],'attributes':_0x1598a4[_0xd076('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd076('0x22')](function(_0xd4b8ba){logger[_0xd076('0xd')](_0xd076('0x20'),_0x1d8a35);logger['debug'](_0xd076('0x20'),_0x1d8a35,JSON[_0xd076('0x23')](_0xd4b8ba));_0x247744(_0xd4b8ba);})[_0xd076('0x15')](function(_0x419be7){logger['error'](_0xd076('0x20'),_0x419be7['message'],_0x1d8a35);_0x5f4eac(_0x2e0887[_0xd076('0x11')](0x1f4,_0x419be7[_0xd076('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index ef635c3..8e6106d 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 _0xa0cf=['getFields','/:id/subjects','getSubjects','getDescriptions','post','put','update','delete','destroy','multer','util','path','express','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields'];(function(_0x5f382f,_0x3f1432){var _0x3bb11b=function(_0x4daf9b){while(--_0x4daf9b){_0x5f382f['push'](_0x5f382f['shift']());}};_0x3bb11b(++_0x3f1432);}(_0xa0cf,0xa9));var _0xfa0c=function(_0x4ab80f,_0x5ab227){_0x4ab80f=_0x4ab80f-0x0;var _0x4a5699=_0xa0cf[_0x4ab80f];return _0x4a5699;};'use strict';var multer=require(_0xfa0c('0x0'));var util=require(_0xfa0c('0x1'));var path=require(_0xfa0c('0x2'));var timeout=require('connect-timeout');var express=require(_0xfa0c('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xfa0c('0x4'));var config=require('../../config/environment');var controller=require(_0xfa0c('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xfa0c('0x6')](_0xfa0c('0x7'),auth[_0xfa0c('0x8')](),controller[_0xfa0c('0x9')]);router[_0xfa0c('0x6')](_0xfa0c('0xa'),auth[_0xfa0c('0x8')](),controller[_0xfa0c('0xb')]);router['get'](_0xfa0c('0xc'),auth['isAuthenticated'](),controller[_0xfa0c('0xd')]);router[_0xfa0c('0x6')]('/:id/descriptions',auth[_0xfa0c('0x8')](),controller[_0xfa0c('0xe')]);router[_0xfa0c('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfa0c('0x10')](_0xfa0c('0x7'),auth['isAuthenticated'](),controller[_0xfa0c('0x11')]);router[_0xfa0c('0x12')](_0xfa0c('0x7'),auth[_0xfa0c('0x8')](),controller[_0xfa0c('0x13')]);module['exports']=router; \ No newline at end of file +var _0x2511=['exports','multer','express','Router','../../components/auth/service','isAuthenticated','index','/:id','get','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','update','delete'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x2511,0x1f1));var _0x1251=function(_0x1506fc,_0x5ed6a2){_0x1506fc=_0x1506fc-0x0;var _0x4b6b57=_0x2511[_0x1506fc];return _0x4b6b57;};'use strict';var multer=require(_0x1251('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1251('0x1'));var router=express[_0x1251('0x2')]();var auth=require(_0x1251('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSalesforceConfiguration.controller');router['get']('/',auth[_0x1251('0x4')](),controller[_0x1251('0x5')]);router['get'](_0x1251('0x6'),auth[_0x1251('0x4')](),controller['show']);router[_0x1251('0x7')]('/:id/fields',auth[_0x1251('0x4')](),controller['getFields']);router[_0x1251('0x7')](_0x1251('0x8'),auth[_0x1251('0x4')](),controller[_0x1251('0x9')]);router[_0x1251('0x7')](_0x1251('0xa'),auth[_0x1251('0x4')](),controller[_0x1251('0xb')]);router[_0x1251('0xc')]('/',auth[_0x1251('0x4')](),controller['create']);router['put'](_0x1251('0x6'),auth[_0x1251('0x4')](),controller[_0x1251('0xd')]);router[_0x1251('0xe')](_0x1251('0x6'),auth[_0x1251('0x4')](),controller['destroy']);module[_0x1251('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index e11c478..1e6bb9d 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 _0xd27c=['ENUM','contact','lead','contact_lead','nothing','sequelize','exports','STRING'];(function(_0x2fb54c,_0x4e113f){var _0x6f4acd=function(_0x54ed8b){while(--_0x54ed8b){_0x2fb54c['push'](_0x2fb54c['shift']());}};_0x6f4acd(++_0x4e113f);}(_0xd27c,0x115));var _0xcd27=function(_0x54d52c,_0x55b8d9){_0x54d52c=_0x54d52c-0x0;var _0x28f99e=_0xd27c[_0x54d52c];return _0x28f99e;};'use strict';var Sequelize=require(_0xcd27('0x0'));module[_0xcd27('0x1')]={'name':{'type':Sequelize[_0xcd27('0x2')]},'description':{'type':Sequelize[_0xcd27('0x2')]},'moduleSearch':{'type':Sequelize[_0xcd27('0x3')]('contact_lead',_0xcd27('0x4'),_0xcd27('0x5')),'defaultValue':_0xcd27('0x6')},'moduleCreate':{'type':Sequelize['ENUM'](_0xcd27('0x7'),'contact','lead'),'defaultValue':_0xcd27('0x5')}}; \ No newline at end of file +var _0xce0d=['ENUM','contact_lead','lead','nothing','exports','STRING'];(function(_0x5ac1e5,_0x4b5012){var _0x1bccc6=function(_0x102562){while(--_0x102562){_0x5ac1e5['push'](_0x5ac1e5['shift']());}};_0x1bccc6(++_0x4b5012);}(_0xce0d,0xb2));var _0xdce0=function(_0x2e986d,_0x4b6b63){_0x2e986d=_0x2e986d-0x0;var _0x351c79=_0xce0d[_0x2e986d];return _0x351c79;};'use strict';var Sequelize=require('sequelize');module[_0xdce0('0x0')]={'name':{'type':Sequelize[_0xdce0('0x1')]},'description':{'type':Sequelize[_0xdce0('0x1')]},'moduleSearch':{'type':Sequelize[_0xdce0('0x2')](_0xdce0('0x3'),'contact',_0xdce0('0x4')),'defaultValue':_0xdce0('0x3')},'moduleCreate':{'type':Sequelize[_0xdce0('0x2')](_0xdce0('0x5'),'contact',_0xdce0('0x4')),'defaultValue':_0xdce0('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index d4c6035..1bd17ed 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 _0x31f0=['hasOwnProperty','getSubjects','findOne','rawAttributes','getDescriptions','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','request','then','info','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','end','json','offset','limit','set','Content-Range','apply','reject','save','update','status','sendStatus','stack','name','send','SalesforceConfiguration','keys','query','dateStart','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','dateEnd','add','day','merge','map','filter','options','count','includeAll','include','rows','show','params','find','body','destroy','SalesforceField','getFields'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x31f0,0xb7));var _0x031f=function(_0x5caa7f,_0x2cee8d){_0x5caa7f=_0x5caa7f-0x0;var _0x18c028=_0x31f0[_0x5caa7f];return _0x18c028;};'use strict';var pdf=require(_0x031f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x031f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x031f('0x2'));var rp=require(_0x031f('0x3'));var moment=require(_0x031f('0x4'));var BPromise=require(_0x031f('0x5'));var Mustache=require('mustache');var util=require(_0x031f('0x6'));var path=require(_0x031f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x031f('0x8'));var squel=require('squel');var crypto=require(_0x031f('0x9'));var jsforce=require(_0x031f('0xa'));var deskjs=require(_0x031f('0xb'));var toCsv=require(_0x031f('0xc'));var querystring=require('querystring');var Papa=require(_0x031f('0xd'));var Redis=require(_0x031f('0xe'));var qs=require(_0x031f('0xf'));var logger=require(_0x031f('0x10'))(_0x031f('0x11'));var utils=require(_0x031f('0x12'));var config=require(_0x031f('0x13'));var db=require(_0x031f('0x14'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x031f('0x15')][_0x031f('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x28da6e,_0x351052,_0x3819bb,_0x405896){return new BPromise(function(_0x1c230d,_0x5d0457){var _0x1614d6=_0x405896||client;return _0x1614d6[_0x031f('0x17')](_0x28da6e,_0x3819bb)[_0x031f('0x18')](function(_0x2e3dfe){logger[_0x031f('0x19')]('SalesforceConfiguration,\x20%s,\x20%s',_0x351052,'request\x20sent');logger[_0x031f('0x1a')](_0x031f('0x1b'),_0x351052,_0x031f('0x1c'),JSON[_0x031f('0x1d')](_0x2e3dfe));if(_0x2e3dfe['error']){if(_0x2e3dfe[_0x031f('0x1e')][_0x031f('0x1f')]===0x1f4){logger['error'](_0x031f('0x20'),_0x351052,_0x2e3dfe['error'][_0x031f('0x21')]);return _0x5d0457(_0x2e3dfe[_0x031f('0x1e')][_0x031f('0x21')]);}logger[_0x031f('0x1e')](_0x031f('0x20'),_0x351052,_0x2e3dfe[_0x031f('0x1e')][_0x031f('0x21')]);return _0x1c230d(_0x2e3dfe[_0x031f('0x1e')][_0x031f('0x21')]);}else{logger[_0x031f('0x19')](_0x031f('0x20'),_0x351052,'request\x20sent');_0x1c230d(_0x2e3dfe[_0x031f('0x22')][_0x031f('0x21')]);}})[_0x031f('0x23')](function(_0x4d6706){logger['error'](_0x031f('0x20'),_0x351052,_0x4d6706);_0x5d0457(_0x4d6706);});});}function respondWithStatusCode(_0x4d0f92,_0x3472a2){_0x3472a2=_0x3472a2||0xcc;return function(_0x57f6c4){if(_0x57f6c4){return _0x4d0f92['sendStatus'](_0x3472a2);}return _0x4d0f92['status'](_0x3472a2)[_0x031f('0x24')]();};}function respondWithResult(_0x12c406,_0x2920cd){_0x2920cd=_0x2920cd||0xc8;return function(_0x4c8126){if(_0x4c8126){return _0x12c406['status'](_0x2920cd)[_0x031f('0x25')](_0x4c8126);}};}function respondWithFilteredResult(_0x5a64c0,_0x40cb1c){return function(_0x1f5a14){if(_0x1f5a14){var _0xfa77b1=_0x1f5a14['count'],_0x567666=_0x40cb1c[_0x031f('0x26')],_0x35af16=_0x40cb1c[_0x031f('0x26')]+_0x40cb1c[_0x031f('0x27')],_0x3b2a51;if(_0x35af16>=_0xfa77b1){_0x35af16=_0xfa77b1;_0x3b2a51=0xc8;}else{_0x3b2a51=0xce;}_0x5a64c0['status'](_0x3b2a51);return _0x5a64c0[_0x031f('0x28')](_0x031f('0x29'),_0x567666+'-'+_0x35af16+'/'+_0xfa77b1)[_0x031f('0x25')](_0x1f5a14);}return null;};}function patchUpdates(_0xaf5bea){return function(_0xfaa36){try{jsonpatch[_0x031f('0x2a')](_0xfaa36,_0xaf5bea,!![]);}catch(_0x52b544){return BPromise[_0x031f('0x2b')](_0x52b544);}return _0xfaa36[_0x031f('0x2c')]();};}function saveUpdates(_0x34f249,_0x2ea861){return function(_0x428ec4){if(_0x428ec4){return _0x428ec4[_0x031f('0x2d')](_0x34f249)[_0x031f('0x18')](function(_0x87dc07){return _0x87dc07;});}return null;};}function removeEntity(_0x2034ac,_0xfc4a89){return function(_0x2cf3a8){if(_0x2cf3a8){return _0x2cf3a8['destroy']()[_0x031f('0x18')](function(){_0x2034ac[_0x031f('0x2e')](0xcc)[_0x031f('0x24')]();});}};}function handleEntityNotFound(_0x2f2616,_0x25a637){return function(_0xb774cf){if(!_0xb774cf){_0x2f2616[_0x031f('0x2f')](0x194);}return _0xb774cf;};}function handleError(_0x15067c,_0x217460){_0x217460=_0x217460||0x1f4;return function(_0xb7284d){logger[_0x031f('0x1e')](_0xb7284d[_0x031f('0x30')]);if(_0xb7284d[_0x031f('0x31')]){delete _0xb7284d['name'];}_0x15067c[_0x031f('0x2e')](_0x217460)[_0x031f('0x32')](_0xb7284d);};}exports['index']=function(_0x1cac0c,_0x1fde6b){var _0x4ec696={},_0x17b93c={},_0x22e486={'count':0x0,'rows':[]};var _0x41750a=db[_0x031f('0x33')]['rawAttributes'];_0x17b93c['model']=_[_0x031f('0x34')](_0x41750a);var _0x555b89={'dateStart':_0x1cac0c[_0x031f('0x35')][_0x031f('0x36')],'dateEnd':_0x1cac0c[_0x031f('0x35')]['dateEnd']};delete _0x1cac0c['query'][_0x031f('0x36')];delete _0x1cac0c['query']['dateEnd'];_0x17b93c[_0x031f('0x35')]=_[_0x031f('0x34')](_0x1cac0c[_0x031f('0x35')]);_0x17b93c[_0x031f('0x37')]=_[_0x031f('0x38')](_0x17b93c[_0x031f('0x39')],_0x17b93c[_0x031f('0x35')]);_0x4ec696['attributes']=_[_0x031f('0x38')](_0x17b93c[_0x031f('0x39')],qs[_0x031f('0x3a')](_0x1cac0c[_0x031f('0x35')]['fields']));_0x4ec696[_0x031f('0x3b')]=_0x4ec696[_0x031f('0x3b')][_0x031f('0x3c')]?_0x4ec696['attributes']:_0x17b93c[_0x031f('0x39')];if(!_0x1cac0c[_0x031f('0x35')]['hasOwnProperty'](_0x031f('0x3d'))){_0x4ec696[_0x031f('0x27')]=qs['limit'](_0x1cac0c['query'][_0x031f('0x27')]);_0x4ec696[_0x031f('0x26')]=qs[_0x031f('0x26')](_0x1cac0c[_0x031f('0x35')][_0x031f('0x26')]);}_0x4ec696[_0x031f('0x3e')]=qs[_0x031f('0x3f')](_0x1cac0c['query'][_0x031f('0x3f')]);_0x4ec696[_0x031f('0x40')]=qs['filters'](_[_0x031f('0x41')](_0x1cac0c['query'],_0x17b93c[_0x031f('0x37')]));if(_0x555b89[_0x031f('0x36')]){if(_0x555b89['dateEnd']){_0x555b89[_0x031f('0x42')]=moment(_0x555b89[_0x031f('0x42')])[_0x031f('0x43')](0x1,'day');}else{_0x555b89[_0x031f('0x42')]=moment(_0x555b89[_0x031f('0x36')])[_0x031f('0x43')](0x1,_0x031f('0x44'));}_[_0x031f('0x45')](_0x4ec696[_0x031f('0x40')],{'createdAt':{'$gte':_0x555b89[_0x031f('0x36')],'$lte':_0x555b89[_0x031f('0x42')]}});}if(_0x1cac0c[_0x031f('0x35')]['filter']){_0x4ec696[_0x031f('0x40')]=_[_0x031f('0x45')](_0x4ec696[_0x031f('0x40')],{'$or':_[_0x031f('0x46')](_0x4ec696[_0x031f('0x3b')],function(_0x2c879c){var _0x2111c5={};_0x2111c5[_0x2c879c]={'$like':'%'+_0x1cac0c[_0x031f('0x35')][_0x031f('0x47')]+'%'};return _0x2111c5;})});}_0x4ec696=_['merge']({},_0x4ec696,_0x1cac0c[_0x031f('0x48')]);var _0x5ec593={'where':_0x4ec696['where']};return db[_0x031f('0x33')][_0x031f('0x49')](_0x5ec593)[_0x031f('0x18')](function(_0x1dd8ce){_0x22e486[_0x031f('0x49')]=_0x1dd8ce;if(_0x1cac0c['query'][_0x031f('0x4a')]){_0x4ec696[_0x031f('0x4b')]=[{'all':!![]}];}return db[_0x031f('0x33')]['findAll'](_0x4ec696);})[_0x031f('0x18')](function(_0x2e7e35){_0x22e486[_0x031f('0x4c')]=_0x2e7e35;return _0x22e486;})[_0x031f('0x18')](respondWithFilteredResult(_0x1fde6b,_0x4ec696))[_0x031f('0x23')](handleError(_0x1fde6b,null));};exports[_0x031f('0x4d')]=function(_0x5caeb5,_0x569d8f){var _0xd28ade={'raw':![],'where':{'id':_0x5caeb5[_0x031f('0x4e')]['id']}},_0x579b17={};_0x579b17[_0x031f('0x39')]=_['keys'](db[_0x031f('0x33')]['rawAttributes']);_0x579b17['query']=_[_0x031f('0x34')](_0x5caeb5['query']);_0x579b17[_0x031f('0x37')]=_['intersection'](_0x579b17[_0x031f('0x39')],_0x579b17[_0x031f('0x35')]);_0xd28ade['attributes']=_[_0x031f('0x38')](_0x579b17[_0x031f('0x39')],qs['fields'](_0x5caeb5[_0x031f('0x35')]['fields']));_0xd28ade[_0x031f('0x3b')]=_0xd28ade['attributes'][_0x031f('0x3c')]?_0xd28ade[_0x031f('0x3b')]:_0x579b17[_0x031f('0x39')];if(_0x5caeb5[_0x031f('0x35')][_0x031f('0x4a')]){_0xd28ade['include']=[{'all':!![]}];}_0xd28ade=_[_0x031f('0x45')]({},_0xd28ade,_0x5caeb5['options']);return db[_0x031f('0x33')][_0x031f('0x4f')](_0xd28ade)['then'](handleEntityNotFound(_0x569d8f,null))[_0x031f('0x18')](respondWithResult(_0x569d8f,null))[_0x031f('0x23')](handleError(_0x569d8f,null));};exports['create']=function(_0x3b3632,_0x154ad2){return db[_0x031f('0x33')]['create'](_0x3b3632[_0x031f('0x50')],{})['then'](respondWithResult(_0x154ad2,0xc9))[_0x031f('0x23')](handleError(_0x154ad2,null));};exports['update']=function(_0x3bd6f4,_0x561a2b){if(_0x3bd6f4[_0x031f('0x50')]['id']){delete _0x3bd6f4[_0x031f('0x50')]['id'];}return db['SalesforceConfiguration']['find']({'where':{'id':_0x3bd6f4[_0x031f('0x4e')]['id']}})[_0x031f('0x18')](handleEntityNotFound(_0x561a2b,null))['then'](saveUpdates(_0x3bd6f4[_0x031f('0x50')],null))[_0x031f('0x18')](respondWithResult(_0x561a2b,null))[_0x031f('0x23')](handleError(_0x561a2b,null));};exports[_0x031f('0x51')]=function(_0x21a89d,_0x1a01fa){return db[_0x031f('0x33')][_0x031f('0x4f')]({'where':{'id':_0x21a89d['params']['id']}})[_0x031f('0x18')](handleEntityNotFound(_0x1a01fa,null))[_0x031f('0x18')](removeEntity(_0x1a01fa,null))[_0x031f('0x23')](handleError(_0x1a01fa,null));};exports['getFields']=function(_0x3937b7,_0x3e4414,_0x5b2c01){var _0xb86dcd={};var _0x14506b={};var _0xb7638b;var _0x198e2e;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x3937b7['params']['id']}})['then'](handleEntityNotFound(_0x3e4414,null))[_0x031f('0x18')](function(_0xcf8b7){if(_0xcf8b7){_0xb7638b=_0xcf8b7;_0x14506b['model']=_[_0x031f('0x34')](db[_0x031f('0x52')]['rawAttributes']);_0x14506b[_0x031f('0x35')]=_[_0x031f('0x34')](_0x3937b7[_0x031f('0x35')]);_0x14506b[_0x031f('0x37')]=_[_0x031f('0x38')](_0x14506b[_0x031f('0x39')],_0x14506b[_0x031f('0x35')]);_0xb86dcd[_0x031f('0x3b')]=_[_0x031f('0x38')](_0x14506b['model'],qs[_0x031f('0x3a')](_0x3937b7['query'][_0x031f('0x3a')]));_0xb86dcd[_0x031f('0x3b')]=_0xb86dcd[_0x031f('0x3b')]['length']?_0xb86dcd['attributes']:_0x14506b[_0x031f('0x39')];_0xb86dcd[_0x031f('0x3e')]=qs[_0x031f('0x3f')](_0x3937b7[_0x031f('0x35')]['sort']);_0xb86dcd[_0x031f('0x40')]=qs['filters'](_['pick'](_0x3937b7[_0x031f('0x35')],_0x14506b['filters']));if(_0x3937b7['query'][_0x031f('0x47')]){_0xb86dcd[_0x031f('0x40')]=_[_0x031f('0x45')](_0xb86dcd[_0x031f('0x40')],{'$or':_[_0x031f('0x46')](_0xb86dcd['attributes'],function(_0x56b573){var _0x214eec={};_0x214eec[_0x56b573]={'$like':'%'+_0x3937b7['query'][_0x031f('0x47')]+'%'};return _0x214eec;})});}_0xb86dcd=_[_0x031f('0x45')]({},_0xb86dcd,_0x3937b7['options']);return _0xb7638b[_0x031f('0x53')](_0xb86dcd);}})[_0x031f('0x18')](function(_0x439095){if(_0x439095){_0x198e2e=_0x439095[_0x031f('0x3c')];if(!_0x3937b7[_0x031f('0x35')][_0x031f('0x54')]('nolimit')){_0xb86dcd['limit']=qs[_0x031f('0x27')](_0x3937b7[_0x031f('0x35')][_0x031f('0x27')]);_0xb86dcd[_0x031f('0x26')]=qs[_0x031f('0x26')](_0x3937b7[_0x031f('0x35')][_0x031f('0x26')]);}return _0xb7638b['getFields'](_0xb86dcd);}})['then'](function(_0x4bd283){if(_0x4bd283){return _0x4bd283?{'count':_0x198e2e,'rows':_0x4bd283}:null;}})['then'](respondWithResult(_0x3e4414,null))[_0x031f('0x23')](handleError(_0x3e4414,null));};exports[_0x031f('0x55')]=function(_0x45977a,_0x4fb931,_0x262994){var _0x2e56e3={};var _0x5133a6={};var _0x76253;var _0x2c15f4;return db[_0x031f('0x33')][_0x031f('0x56')]({'where':{'id':_0x45977a[_0x031f('0x4e')]['id']}})[_0x031f('0x18')](handleEntityNotFound(_0x4fb931,null))[_0x031f('0x18')](function(_0x5ecbd6){if(_0x5ecbd6){_0x76253=_0x5ecbd6;_0x5133a6['model']=_[_0x031f('0x34')](db['SalesforceField'][_0x031f('0x57')]);_0x5133a6['query']=_[_0x031f('0x34')](_0x45977a[_0x031f('0x35')]);_0x5133a6[_0x031f('0x37')]=_['intersection'](_0x5133a6[_0x031f('0x39')],_0x5133a6['query']);_0x2e56e3[_0x031f('0x3b')]=_[_0x031f('0x38')](_0x5133a6[_0x031f('0x39')],qs['fields'](_0x45977a[_0x031f('0x35')][_0x031f('0x3a')]));_0x2e56e3[_0x031f('0x3b')]=_0x2e56e3[_0x031f('0x3b')][_0x031f('0x3c')]?_0x2e56e3['attributes']:_0x5133a6['model'];_0x2e56e3[_0x031f('0x3e')]=qs[_0x031f('0x3f')](_0x45977a['query'][_0x031f('0x3f')]);_0x2e56e3['where']=qs[_0x031f('0x37')](_[_0x031f('0x41')](_0x45977a[_0x031f('0x35')],_0x5133a6[_0x031f('0x37')]));if(_0x45977a['query'][_0x031f('0x47')]){_0x2e56e3[_0x031f('0x40')]=_[_0x031f('0x45')](_0x2e56e3['where'],{'$or':_[_0x031f('0x46')](_0x2e56e3[_0x031f('0x3b')],function(_0x4deefb){var _0x379564={};_0x379564[_0x4deefb]={'$like':'%'+_0x45977a[_0x031f('0x35')][_0x031f('0x47')]+'%'};return _0x379564;})});}_0x2e56e3=_[_0x031f('0x45')]({},_0x2e56e3,_0x45977a[_0x031f('0x48')]);return _0x76253[_0x031f('0x55')](_0x2e56e3);}})[_0x031f('0x18')](function(_0x596280){if(_0x596280){_0x2c15f4=_0x596280[_0x031f('0x3c')];if(!_0x45977a[_0x031f('0x35')][_0x031f('0x54')]('nolimit')){_0x2e56e3['limit']=qs[_0x031f('0x27')](_0x45977a['query']['limit']);_0x2e56e3[_0x031f('0x26')]=qs[_0x031f('0x26')](_0x45977a[_0x031f('0x35')][_0x031f('0x26')]);}return _0x76253[_0x031f('0x55')](_0x2e56e3);}})[_0x031f('0x18')](function(_0x188e9c){if(_0x188e9c){return _0x188e9c?{'count':_0x2c15f4,'rows':_0x188e9c}:null;}})[_0x031f('0x18')](respondWithResult(_0x4fb931,null))[_0x031f('0x23')](handleError(_0x4fb931,null));};exports[_0x031f('0x58')]=function(_0x3166bb,_0x49505e,_0x1a5fd2){var _0x2d867f={};var _0x1f4ecf={};var _0x8290bf;var _0x47bb04;return db[_0x031f('0x33')]['findOne']({'where':{'id':_0x3166bb['params']['id']}})[_0x031f('0x18')](handleEntityNotFound(_0x49505e,null))[_0x031f('0x18')](function(_0x528db4){if(_0x528db4){_0x8290bf=_0x528db4;_0x1f4ecf['model']=_[_0x031f('0x34')](db[_0x031f('0x52')][_0x031f('0x57')]);_0x1f4ecf[_0x031f('0x35')]=_[_0x031f('0x34')](_0x3166bb[_0x031f('0x35')]);_0x1f4ecf['filters']=_[_0x031f('0x38')](_0x1f4ecf[_0x031f('0x39')],_0x1f4ecf['query']);_0x2d867f[_0x031f('0x3b')]=_[_0x031f('0x38')](_0x1f4ecf[_0x031f('0x39')],qs[_0x031f('0x3a')](_0x3166bb[_0x031f('0x35')][_0x031f('0x3a')]));_0x2d867f[_0x031f('0x3b')]=_0x2d867f['attributes'][_0x031f('0x3c')]?_0x2d867f['attributes']:_0x1f4ecf[_0x031f('0x39')];_0x2d867f[_0x031f('0x3e')]=qs[_0x031f('0x3f')](_0x3166bb['query']['sort']);_0x2d867f['where']=qs[_0x031f('0x37')](_[_0x031f('0x41')](_0x3166bb[_0x031f('0x35')],_0x1f4ecf[_0x031f('0x37')]));if(_0x3166bb[_0x031f('0x35')][_0x031f('0x47')]){_0x2d867f[_0x031f('0x40')]=_['merge'](_0x2d867f['where'],{'$or':_[_0x031f('0x46')](_0x2d867f[_0x031f('0x3b')],function(_0x54d86e){var _0xc2d0b1={};_0xc2d0b1[_0x54d86e]={'$like':'%'+_0x3166bb['query'][_0x031f('0x47')]+'%'};return _0xc2d0b1;})});}_0x2d867f=_[_0x031f('0x45')]({},_0x2d867f,_0x3166bb['options']);return _0x8290bf[_0x031f('0x58')](_0x2d867f);}})[_0x031f('0x18')](function(_0x5e4dff){if(_0x5e4dff){_0x47bb04=_0x5e4dff[_0x031f('0x3c')];if(!_0x3166bb[_0x031f('0x35')][_0x031f('0x54')]('nolimit')){_0x2d867f[_0x031f('0x27')]=qs[_0x031f('0x27')](_0x3166bb[_0x031f('0x35')][_0x031f('0x27')]);_0x2d867f[_0x031f('0x26')]=qs[_0x031f('0x26')](_0x3166bb['query'][_0x031f('0x26')]);}return _0x8290bf[_0x031f('0x58')](_0x2d867f);}})[_0x031f('0x18')](function(_0x2db130){if(_0x2db130){return _0x2db130?{'count':_0x47bb04,'rows':_0x2db130}:null;}})['then'](respondWithResult(_0x49505e,null))[_0x031f('0x23')](handleError(_0x49505e,null));}; \ No newline at end of file +var _0x9c5a=['fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','add','day','merge','where','filter','options','SalesforceConfiguration','count','includeAll','catch','show','params','rawAttributes','create','body','find','getFields','pick','map','getSubjects','findOne','SalesforceField','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','end','status','json','offset','set','apply','save','update','destroy','sendStatus','stack','name','index','model','keys','query','dateEnd','dateStart','filters','intersection'];(function(_0x361e5a,_0x137d5c){var _0x4f5a00=function(_0x5c8ad7){while(--_0x5c8ad7){_0x361e5a['push'](_0x361e5a['shift']());}};_0x4f5a00(++_0x137d5c);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x11407f,_0x4bdda2){_0x11407f=_0x11407f-0x0;var _0x25cc32=_0x9c5a[_0x11407f];return _0x25cc32;};'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 qs=require(_0xa9c5('0xf'));var logger=require(_0xa9c5('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xa9c5('0x11'));var db=require(_0xa9c5('0x12'))['db'];var jayson=require(_0xa9c5('0x13'));var client=jayson[_0xa9c5('0x14')][_0xa9c5('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x4492a4,_0x51c8d,_0x42d5cf,_0x3c5ac7){return new BPromise(function(_0x1ea48,_0x5915ad){var _0x390ca2=_0x3c5ac7||client;return _0x390ca2[_0xa9c5('0x16')](_0x4492a4,_0x42d5cf)[_0xa9c5('0x17')](function(_0x3806c4){logger[_0xa9c5('0x18')](_0xa9c5('0x19'),_0x51c8d,_0xa9c5('0x1a'));logger[_0xa9c5('0x1b')](_0xa9c5('0x1c'),_0x51c8d,_0xa9c5('0x1a'),JSON['stringify'](_0x3806c4));if(_0x3806c4[_0xa9c5('0x1d')]){if(_0x3806c4[_0xa9c5('0x1d')][_0xa9c5('0x1e')]===0x1f4){logger['error'](_0xa9c5('0x19'),_0x51c8d,_0x3806c4[_0xa9c5('0x1d')][_0xa9c5('0x1f')]);return _0x5915ad(_0x3806c4[_0xa9c5('0x1d')][_0xa9c5('0x1f')]);}logger[_0xa9c5('0x1d')](_0xa9c5('0x19'),_0x51c8d,_0x3806c4[_0xa9c5('0x1d')][_0xa9c5('0x1f')]);return _0x1ea48(_0x3806c4[_0xa9c5('0x1d')][_0xa9c5('0x1f')]);}else{logger[_0xa9c5('0x18')]('SalesforceConfiguration,\x20%s,\x20%s',_0x51c8d,_0xa9c5('0x1a'));_0x1ea48(_0x3806c4[_0xa9c5('0x20')]['message']);}})['catch'](function(_0xce9af6){logger[_0xa9c5('0x1d')](_0xa9c5('0x19'),_0x51c8d,_0xce9af6);_0x5915ad(_0xce9af6);});});}function respondWithStatusCode(_0x3b497a,_0xc0bca3){_0xc0bca3=_0xc0bca3||0xcc;return function(_0xd4b8a1){if(_0xd4b8a1){return _0x3b497a['sendStatus'](_0xc0bca3);}return _0x3b497a['status'](_0xc0bca3)[_0xa9c5('0x21')]();};}function respondWithResult(_0x11d395,_0x4b0f05){_0x4b0f05=_0x4b0f05||0xc8;return function(_0x6819b3){if(_0x6819b3){return _0x11d395[_0xa9c5('0x22')](_0x4b0f05)[_0xa9c5('0x23')](_0x6819b3);}};}function respondWithFilteredResult(_0x32fc7d,_0x4cbba1){return function(_0x40f08b){if(_0x40f08b){var _0xe44e6d=_0x40f08b['count'],_0x51b64a=_0x4cbba1[_0xa9c5('0x24')],_0x4e8a7f=_0x4cbba1[_0xa9c5('0x24')]+_0x4cbba1['limit'],_0x242771;if(_0x4e8a7f>=_0xe44e6d){_0x4e8a7f=_0xe44e6d;_0x242771=0xc8;}else{_0x242771=0xce;}_0x32fc7d[_0xa9c5('0x22')](_0x242771);return _0x32fc7d[_0xa9c5('0x25')]('Content-Range',_0x51b64a+'-'+_0x4e8a7f+'/'+_0xe44e6d)[_0xa9c5('0x23')](_0x40f08b);}return null;};}function patchUpdates(_0x32baf9){return function(_0x198cdf){try{jsonpatch[_0xa9c5('0x26')](_0x198cdf,_0x32baf9,!![]);}catch(_0x325c65){return BPromise['reject'](_0x325c65);}return _0x198cdf[_0xa9c5('0x27')]();};}function saveUpdates(_0x4cee90,_0x3c3da7){return function(_0x1ef388){if(_0x1ef388){return _0x1ef388[_0xa9c5('0x28')](_0x4cee90)['then'](function(_0xc6d0c1){return _0xc6d0c1;});}return null;};}function removeEntity(_0xbe29c5,_0x5bc9bb){return function(_0x3f11a9){if(_0x3f11a9){return _0x3f11a9[_0xa9c5('0x29')]()[_0xa9c5('0x17')](function(){_0xbe29c5[_0xa9c5('0x22')](0xcc)[_0xa9c5('0x21')]();});}};}function handleEntityNotFound(_0x3392d0,_0x3a66d8){return function(_0x4b9104){if(!_0x4b9104){_0x3392d0[_0xa9c5('0x2a')](0x194);}return _0x4b9104;};}function handleError(_0x3bdf64,_0xf4a9f3){_0xf4a9f3=_0xf4a9f3||0x1f4;return function(_0x1c01f9){logger[_0xa9c5('0x1d')](_0x1c01f9[_0xa9c5('0x2b')]);if(_0x1c01f9[_0xa9c5('0x2c')]){delete _0x1c01f9[_0xa9c5('0x2c')];}_0x3bdf64['status'](_0xf4a9f3)['send'](_0x1c01f9);};}exports[_0xa9c5('0x2d')]=function(_0x30a0e8,_0xf2bebc){var _0x1313b2={},_0x296116={},_0x25121e={'count':0x0,'rows':[]};var _0x4dfdb5=db['SalesforceConfiguration']['rawAttributes'];_0x296116[_0xa9c5('0x2e')]=_[_0xa9c5('0x2f')](_0x4dfdb5);var _0x5087e4={'dateStart':_0x30a0e8[_0xa9c5('0x30')]['dateStart'],'dateEnd':_0x30a0e8[_0xa9c5('0x30')][_0xa9c5('0x31')]};delete _0x30a0e8[_0xa9c5('0x30')][_0xa9c5('0x32')];delete _0x30a0e8['query'][_0xa9c5('0x31')];_0x296116[_0xa9c5('0x30')]=_[_0xa9c5('0x2f')](_0x30a0e8[_0xa9c5('0x30')]);_0x296116[_0xa9c5('0x33')]=_[_0xa9c5('0x34')](_0x296116[_0xa9c5('0x2e')],_0x296116[_0xa9c5('0x30')]);_0x1313b2['attributes']=_[_0xa9c5('0x34')](_0x296116[_0xa9c5('0x2e')],qs[_0xa9c5('0x35')](_0x30a0e8[_0xa9c5('0x30')][_0xa9c5('0x35')]));_0x1313b2[_0xa9c5('0x36')]=_0x1313b2['attributes'][_0xa9c5('0x37')]?_0x1313b2['attributes']:_0x296116[_0xa9c5('0x2e')];if(!_0x30a0e8['query'][_0xa9c5('0x38')](_0xa9c5('0x39'))){_0x1313b2[_0xa9c5('0x3a')]=qs['limit'](_0x30a0e8[_0xa9c5('0x30')][_0xa9c5('0x3a')]);_0x1313b2[_0xa9c5('0x24')]=qs[_0xa9c5('0x24')](_0x30a0e8['query'][_0xa9c5('0x24')]);}_0x1313b2[_0xa9c5('0x3b')]=qs[_0xa9c5('0x3c')](_0x30a0e8[_0xa9c5('0x30')][_0xa9c5('0x3c')]);_0x1313b2['where']=qs[_0xa9c5('0x33')](_['pick'](_0x30a0e8[_0xa9c5('0x30')],_0x296116[_0xa9c5('0x33')]));if(_0x5087e4[_0xa9c5('0x32')]){if(_0x5087e4[_0xa9c5('0x31')]){_0x5087e4[_0xa9c5('0x31')]=moment(_0x5087e4[_0xa9c5('0x31')])[_0xa9c5('0x3d')](0x1,_0xa9c5('0x3e'));}else{_0x5087e4[_0xa9c5('0x31')]=moment(_0x5087e4[_0xa9c5('0x32')])['add'](0x1,_0xa9c5('0x3e'));}_[_0xa9c5('0x3f')](_0x1313b2[_0xa9c5('0x40')],{'createdAt':{'$gte':_0x5087e4[_0xa9c5('0x32')],'$lte':_0x5087e4[_0xa9c5('0x31')]}});}if(_0x30a0e8[_0xa9c5('0x30')]['filter']){_0x1313b2[_0xa9c5('0x40')]=_[_0xa9c5('0x3f')](_0x1313b2['where'],{'$or':_['map'](_0x1313b2['attributes'],function(_0x52ba9b){var _0x4e97bf={};_0x4e97bf[_0x52ba9b]={'$like':'%'+_0x30a0e8[_0xa9c5('0x30')][_0xa9c5('0x41')]+'%'};return _0x4e97bf;})});}_0x1313b2=_[_0xa9c5('0x3f')]({},_0x1313b2,_0x30a0e8[_0xa9c5('0x42')]);var _0x255402={'where':_0x1313b2[_0xa9c5('0x40')]};return db[_0xa9c5('0x43')][_0xa9c5('0x44')](_0x255402)[_0xa9c5('0x17')](function(_0x19727e){_0x25121e[_0xa9c5('0x44')]=_0x19727e;if(_0x30a0e8[_0xa9c5('0x30')][_0xa9c5('0x45')]){_0x1313b2['include']=[{'all':!![]}];}return db[_0xa9c5('0x43')]['findAll'](_0x1313b2);})[_0xa9c5('0x17')](function(_0x7a3690){_0x25121e['rows']=_0x7a3690;return _0x25121e;})['then'](respondWithFilteredResult(_0xf2bebc,_0x1313b2))[_0xa9c5('0x46')](handleError(_0xf2bebc,null));};exports[_0xa9c5('0x47')]=function(_0xeb0720,_0x4e41c7){var _0x584504={'raw':![],'where':{'id':_0xeb0720[_0xa9c5('0x48')]['id']}},_0x2333c4={};_0x2333c4['model']=_[_0xa9c5('0x2f')](db[_0xa9c5('0x43')][_0xa9c5('0x49')]);_0x2333c4[_0xa9c5('0x30')]=_[_0xa9c5('0x2f')](_0xeb0720[_0xa9c5('0x30')]);_0x2333c4['filters']=_['intersection'](_0x2333c4['model'],_0x2333c4[_0xa9c5('0x30')]);_0x584504[_0xa9c5('0x36')]=_[_0xa9c5('0x34')](_0x2333c4[_0xa9c5('0x2e')],qs[_0xa9c5('0x35')](_0xeb0720[_0xa9c5('0x30')]['fields']));_0x584504[_0xa9c5('0x36')]=_0x584504[_0xa9c5('0x36')][_0xa9c5('0x37')]?_0x584504[_0xa9c5('0x36')]:_0x2333c4[_0xa9c5('0x2e')];if(_0xeb0720[_0xa9c5('0x30')]['includeAll']){_0x584504['include']=[{'all':!![]}];}_0x584504=_[_0xa9c5('0x3f')]({},_0x584504,_0xeb0720['options']);return db[_0xa9c5('0x43')]['find'](_0x584504)[_0xa9c5('0x17')](handleEntityNotFound(_0x4e41c7,null))[_0xa9c5('0x17')](respondWithResult(_0x4e41c7,null))[_0xa9c5('0x46')](handleError(_0x4e41c7,null));};exports['create']=function(_0x344c7f,_0xe5390f){return db[_0xa9c5('0x43')][_0xa9c5('0x4a')](_0x344c7f['body'],{})['then'](respondWithResult(_0xe5390f,0xc9))[_0xa9c5('0x46')](handleError(_0xe5390f,null));};exports[_0xa9c5('0x28')]=function(_0x3205f2,_0x5b4323){if(_0x3205f2[_0xa9c5('0x4b')]['id']){delete _0x3205f2[_0xa9c5('0x4b')]['id'];}return db[_0xa9c5('0x43')][_0xa9c5('0x4c')]({'where':{'id':_0x3205f2[_0xa9c5('0x48')]['id']}})[_0xa9c5('0x17')](handleEntityNotFound(_0x5b4323,null))[_0xa9c5('0x17')](saveUpdates(_0x3205f2[_0xa9c5('0x4b')],null))['then'](respondWithResult(_0x5b4323,null))[_0xa9c5('0x46')](handleError(_0x5b4323,null));};exports['destroy']=function(_0x1c5aab,_0x2b9d39){return db[_0xa9c5('0x43')]['find']({'where':{'id':_0x1c5aab[_0xa9c5('0x48')]['id']}})[_0xa9c5('0x17')](handleEntityNotFound(_0x2b9d39,null))['then'](removeEntity(_0x2b9d39,null))[_0xa9c5('0x46')](handleError(_0x2b9d39,null));};exports[_0xa9c5('0x4d')]=function(_0x13a708,_0x3363fb,_0x49f91c){var _0x3505d3={};var _0x222091={};var _0x1f6fbc;var _0x35339c;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x13a708[_0xa9c5('0x48')]['id']}})[_0xa9c5('0x17')](handleEntityNotFound(_0x3363fb,null))[_0xa9c5('0x17')](function(_0x1b676e){if(_0x1b676e){_0x1f6fbc=_0x1b676e;_0x222091[_0xa9c5('0x2e')]=_[_0xa9c5('0x2f')](db['SalesforceField'][_0xa9c5('0x49')]);_0x222091[_0xa9c5('0x30')]=_[_0xa9c5('0x2f')](_0x13a708[_0xa9c5('0x30')]);_0x222091[_0xa9c5('0x33')]=_[_0xa9c5('0x34')](_0x222091[_0xa9c5('0x2e')],_0x222091[_0xa9c5('0x30')]);_0x3505d3[_0xa9c5('0x36')]=_[_0xa9c5('0x34')](_0x222091['model'],qs['fields'](_0x13a708[_0xa9c5('0x30')][_0xa9c5('0x35')]));_0x3505d3[_0xa9c5('0x36')]=_0x3505d3[_0xa9c5('0x36')]['length']?_0x3505d3[_0xa9c5('0x36')]:_0x222091['model'];_0x3505d3[_0xa9c5('0x3b')]=qs[_0xa9c5('0x3c')](_0x13a708[_0xa9c5('0x30')][_0xa9c5('0x3c')]);_0x3505d3[_0xa9c5('0x40')]=qs[_0xa9c5('0x33')](_[_0xa9c5('0x4e')](_0x13a708[_0xa9c5('0x30')],_0x222091[_0xa9c5('0x33')]));if(_0x13a708[_0xa9c5('0x30')][_0xa9c5('0x41')]){_0x3505d3[_0xa9c5('0x40')]=_['merge'](_0x3505d3[_0xa9c5('0x40')],{'$or':_[_0xa9c5('0x4f')](_0x3505d3[_0xa9c5('0x36')],function(_0xce9c8c){var _0x1e7ad8={};_0x1e7ad8[_0xce9c8c]={'$like':'%'+_0x13a708[_0xa9c5('0x30')][_0xa9c5('0x41')]+'%'};return _0x1e7ad8;})});}_0x3505d3=_['merge']({},_0x3505d3,_0x13a708['options']);return _0x1f6fbc[_0xa9c5('0x4d')](_0x3505d3);}})['then'](function(_0x2ae087){if(_0x2ae087){_0x35339c=_0x2ae087[_0xa9c5('0x37')];if(!_0x13a708['query'][_0xa9c5('0x38')](_0xa9c5('0x39'))){_0x3505d3['limit']=qs['limit'](_0x13a708[_0xa9c5('0x30')][_0xa9c5('0x3a')]);_0x3505d3[_0xa9c5('0x24')]=qs['offset'](_0x13a708['query'][_0xa9c5('0x24')]);}return _0x1f6fbc[_0xa9c5('0x4d')](_0x3505d3);}})['then'](function(_0xd0371c){if(_0xd0371c){return _0xd0371c?{'count':_0x35339c,'rows':_0xd0371c}:null;}})[_0xa9c5('0x17')](respondWithResult(_0x3363fb,null))[_0xa9c5('0x46')](handleError(_0x3363fb,null));};exports[_0xa9c5('0x50')]=function(_0x135791,_0x45b0a3,_0x4e2fb1){var _0x44d969={};var _0x3aeb3c={};var _0x4586ba;var _0xdc6836;return db['SalesforceConfiguration'][_0xa9c5('0x51')]({'where':{'id':_0x135791[_0xa9c5('0x48')]['id']}})['then'](handleEntityNotFound(_0x45b0a3,null))[_0xa9c5('0x17')](function(_0xbdc2d6){if(_0xbdc2d6){_0x4586ba=_0xbdc2d6;_0x3aeb3c[_0xa9c5('0x2e')]=_['keys'](db[_0xa9c5('0x52')][_0xa9c5('0x49')]);_0x3aeb3c[_0xa9c5('0x30')]=_[_0xa9c5('0x2f')](_0x135791[_0xa9c5('0x30')]);_0x3aeb3c[_0xa9c5('0x33')]=_[_0xa9c5('0x34')](_0x3aeb3c['model'],_0x3aeb3c[_0xa9c5('0x30')]);_0x44d969[_0xa9c5('0x36')]=_[_0xa9c5('0x34')](_0x3aeb3c[_0xa9c5('0x2e')],qs[_0xa9c5('0x35')](_0x135791[_0xa9c5('0x30')][_0xa9c5('0x35')]));_0x44d969[_0xa9c5('0x36')]=_0x44d969[_0xa9c5('0x36')][_0xa9c5('0x37')]?_0x44d969[_0xa9c5('0x36')]:_0x3aeb3c['model'];_0x44d969[_0xa9c5('0x3b')]=qs[_0xa9c5('0x3c')](_0x135791['query'][_0xa9c5('0x3c')]);_0x44d969[_0xa9c5('0x40')]=qs[_0xa9c5('0x33')](_['pick'](_0x135791[_0xa9c5('0x30')],_0x3aeb3c[_0xa9c5('0x33')]));if(_0x135791[_0xa9c5('0x30')][_0xa9c5('0x41')]){_0x44d969['where']=_[_0xa9c5('0x3f')](_0x44d969[_0xa9c5('0x40')],{'$or':_['map'](_0x44d969['attributes'],function(_0x4b2046){var _0x4bbe99={};_0x4bbe99[_0x4b2046]={'$like':'%'+_0x135791['query']['filter']+'%'};return _0x4bbe99;})});}_0x44d969=_['merge']({},_0x44d969,_0x135791['options']);return _0x4586ba[_0xa9c5('0x50')](_0x44d969);}})[_0xa9c5('0x17')](function(_0x19cc35){if(_0x19cc35){_0xdc6836=_0x19cc35[_0xa9c5('0x37')];if(!_0x135791[_0xa9c5('0x30')]['hasOwnProperty']('nolimit')){_0x44d969['limit']=qs['limit'](_0x135791[_0xa9c5('0x30')][_0xa9c5('0x3a')]);_0x44d969[_0xa9c5('0x24')]=qs[_0xa9c5('0x24')](_0x135791['query']['offset']);}return _0x4586ba[_0xa9c5('0x50')](_0x44d969);}})[_0xa9c5('0x17')](function(_0x144e97){if(_0x144e97){return _0x144e97?{'count':_0xdc6836,'rows':_0x144e97}:null;}})[_0xa9c5('0x17')](respondWithResult(_0x45b0a3,null))[_0xa9c5('0x46')](handleError(_0x45b0a3,null));};exports['getDescriptions']=function(_0x2b69b9,_0x43ae9,_0xd063cf){var _0x58de52={};var _0x26c81e={};var _0x2741df;var _0x29541b;return db[_0xa9c5('0x43')]['findOne']({'where':{'id':_0x2b69b9[_0xa9c5('0x48')]['id']}})[_0xa9c5('0x17')](handleEntityNotFound(_0x43ae9,null))['then'](function(_0x5deb88){if(_0x5deb88){_0x2741df=_0x5deb88;_0x26c81e[_0xa9c5('0x2e')]=_['keys'](db['SalesforceField'][_0xa9c5('0x49')]);_0x26c81e[_0xa9c5('0x30')]=_[_0xa9c5('0x2f')](_0x2b69b9[_0xa9c5('0x30')]);_0x26c81e[_0xa9c5('0x33')]=_['intersection'](_0x26c81e[_0xa9c5('0x2e')],_0x26c81e['query']);_0x58de52[_0xa9c5('0x36')]=_[_0xa9c5('0x34')](_0x26c81e[_0xa9c5('0x2e')],qs[_0xa9c5('0x35')](_0x2b69b9['query']['fields']));_0x58de52[_0xa9c5('0x36')]=_0x58de52['attributes']['length']?_0x58de52[_0xa9c5('0x36')]:_0x26c81e[_0xa9c5('0x2e')];_0x58de52['order']=qs['sort'](_0x2b69b9[_0xa9c5('0x30')][_0xa9c5('0x3c')]);_0x58de52[_0xa9c5('0x40')]=qs[_0xa9c5('0x33')](_['pick'](_0x2b69b9['query'],_0x26c81e[_0xa9c5('0x33')]));if(_0x2b69b9[_0xa9c5('0x30')][_0xa9c5('0x41')]){_0x58de52[_0xa9c5('0x40')]=_[_0xa9c5('0x3f')](_0x58de52[_0xa9c5('0x40')],{'$or':_[_0xa9c5('0x4f')](_0x58de52['attributes'],function(_0x23ee99){var _0x9f0200={};_0x9f0200[_0x23ee99]={'$like':'%'+_0x2b69b9['query'][_0xa9c5('0x41')]+'%'};return _0x9f0200;})});}_0x58de52=_[_0xa9c5('0x3f')]({},_0x58de52,_0x2b69b9['options']);return _0x2741df[_0xa9c5('0x53')](_0x58de52);}})[_0xa9c5('0x17')](function(_0x312033){if(_0x312033){_0x29541b=_0x312033[_0xa9c5('0x37')];if(!_0x2b69b9[_0xa9c5('0x30')][_0xa9c5('0x38')](_0xa9c5('0x39'))){_0x58de52[_0xa9c5('0x3a')]=qs[_0xa9c5('0x3a')](_0x2b69b9[_0xa9c5('0x30')][_0xa9c5('0x3a')]);_0x58de52[_0xa9c5('0x24')]=qs[_0xa9c5('0x24')](_0x2b69b9[_0xa9c5('0x30')][_0xa9c5('0x24')]);}return _0x2741df[_0xa9c5('0x53')](_0x58de52);}})[_0xa9c5('0x17')](function(_0x5f00ad){if(_0x5f00ad){return _0x5f00ad?{'count':_0x29541b,'rows':_0x5f00ad}:null;}})[_0xa9c5('0x17')](respondWithResult(_0x43ae9,null))[_0xa9c5('0x46')](handleError(_0x43ae9,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index bbffb97..ed76615 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 _0x582c=['api','moment','bluebird','request-promise','SalesforceConfiguration','lodash','util'];(function(_0x27d791,_0x42d18b){var _0x54f5eb=function(_0x266538){while(--_0x266538){_0x27d791['push'](_0x27d791['shift']());}};_0x54f5eb(++_0x42d18b);}(_0x582c,0x1b7));var _0xc582=function(_0x3a93b7,_0x658183){_0x3a93b7=_0x3a93b7-0x0;var _0x2ed891=_0x582c[_0x3a93b7];return _0x2ed891;};'use strict';var _=require(_0xc582('0x0'));var util=require(_0xc582('0x1'));var logger=require('../../config/logger')(_0xc582('0x2'));var moment=require(_0xc582('0x3'));var BPromise=require(_0xc582('0x4'));var rp=require(_0xc582('0x5'));var attributes=require('./intSalesforceConfiguration.attributes');module['exports']=function(_0x316460,_0x22a81d){return _0x316460['define'](_0xc582('0x6'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc021=['int_salesforce_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','exports','define','SalesforceConfiguration'];(function(_0x214572,_0x4a4f1f){var _0x36ab7b=function(_0x3cff60){while(--_0x3cff60){_0x214572['push'](_0x214572['shift']());}};_0x36ab7b(++_0x4a4f1f);}(_0xc021,0x19b));var _0x1c02=function(_0x4f7bc0,_0x144ed2){_0x4f7bc0=_0x4f7bc0-0x0;var _0x56b567=_0xc021[_0x4f7bc0];return _0x56b567;};'use strict';var _=require(_0x1c02('0x0'));var util=require(_0x1c02('0x1'));var logger=require(_0x1c02('0x2'))('api');var moment=require(_0x1c02('0x3'));var BPromise=require(_0x1c02('0x4'));var rp=require(_0x1c02('0x5'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x1c02('0x6')]=function(_0x49c79c,_0x3c60a2){return _0x49c79c[_0x1c02('0x7')](_0x1c02('0x8'),attributes,{'tableName':_0x1c02('0x9'),'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 9069f00..be2ba9b 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 _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x7217,0x19e));var _0x7721=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x7217[_0xf50820];return _0x2a9b10;};'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')]('SalesforceConfiguration,\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']('SalesforceConfiguration,\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);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x58dbe5,_0x1b27ca){var _0x4dab55=function(_0x1ad735){while(--_0x1ad735){_0x58dbe5['push'](_0x58dbe5['shift']());}};_0x4dab55(++_0x1b27ca);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xc4aa[_0x45d55e];return _0x29812a;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index c964cac..ebe8ff3 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 _0x2b0c=['show','put','update','delete','destroy','exports','multer','util','express','Router','../../config/environment','./intSalesforceField.controller','get','index','/:id','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2b0c,0x1a6));var _0xc2b0=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x2b0c[_0x39e84d];return _0x1991bc;};'use strict';var multer=require(_0xc2b0('0x0'));var util=require(_0xc2b0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc2b0('0x2'));var router=express[_0xc2b0('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc2b0('0x4'));var controller=require(_0xc2b0('0x5'));router[_0xc2b0('0x6')]('/',auth['isAuthenticated'](),controller[_0xc2b0('0x7')]);router[_0xc2b0('0x6')](_0xc2b0('0x8'),auth[_0xc2b0('0x9')](),controller[_0xc2b0('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xc2b0('0xb')]('/:id',auth[_0xc2b0('0x9')](),controller[_0xc2b0('0xc')]);router[_0xc2b0('0xd')](_0xc2b0('0x8'),auth[_0xc2b0('0x9')](),controller[_0xc2b0('0xe')]);module[_0xc2b0('0xf')]=router; \ No newline at end of file +var _0x14d4=['create','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x55f687,_0x31dfc9){var _0x4e0ccd=function(_0x2517e4){while(--_0x2517e4){_0x55f687['push'](_0x55f687['shift']());}};_0x4e0ccd(++_0x31dfc9);}(_0x14d4,0x15b));var _0x414d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x14d4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x414d('0x0'));var util=require(_0x414d('0x1'));var path=require(_0x414d('0x2'));var timeout=require('connect-timeout');var express=require(_0x414d('0x3'));var router=express[_0x414d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x414d('0x5'));var config=require(_0x414d('0x6'));var controller=require(_0x414d('0x7'));router[_0x414d('0x8')]('/',auth[_0x414d('0x9')](),controller[_0x414d('0xa')]);router[_0x414d('0x8')](_0x414d('0xb'),auth['isAuthenticated'](),controller[_0x414d('0xc')]);router[_0x414d('0xd')]('/',auth[_0x414d('0x9')](),controller[_0x414d('0xe')]);router['put'](_0x414d('0xb'),auth[_0x414d('0x9')](),controller[_0x414d('0xf')]);router[_0x414d('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x414d('0x11')]);module[_0x414d('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 8c5ad1a..e7a6e8d 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 _0xab2f=['STRING','sequelize','exports','ENUM','variable','customVariable','keyValue','string'];(function(_0x3c0ff6,_0x5aaead){var _0x5bcc9f=function(_0x432791){while(--_0x432791){_0x3c0ff6['push'](_0x3c0ff6['shift']());}};_0x5bcc9f(++_0x5aaead);}(_0xab2f,0x1d1));var _0xfab2=function(_0x5ab670,_0x4df6af){_0x5ab670=_0x5ab670-0x0;var _0x550f7a=_0xab2f[_0x5ab670];return _0x550f7a;};'use strict';var Sequelize=require(_0xfab2('0x0'));module[_0xfab2('0x1')]={'type':{'type':Sequelize[_0xfab2('0x2')]('string',_0xfab2('0x3'),_0xfab2('0x4'),_0xfab2('0x5')),'defaultValue':_0xfab2('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xfab2('0x2')](_0xfab2('0x6'),_0xfab2('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xfab2('0x7')]},'idField':{'type':Sequelize[_0xfab2('0x7')]},'variableName':{'type':Sequelize[_0xfab2('0x7')]}}; \ No newline at end of file +var _0xc011=['keyValue','string','STRING','variable','sequelize','ENUM','customVariable'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0xc011,0x66));var _0x1c01=function(_0x51b80a,_0x355fe3){_0x51b80a=_0x51b80a-0x0;var _0x22fdf0=_0xc011[_0x51b80a];return _0x22fdf0;};'use strict';var Sequelize=require(_0x1c01('0x0'));module['exports']={'type':{'type':Sequelize[_0x1c01('0x1')]('string','variable',_0x1c01('0x2'),_0x1c01('0x3')),'defaultValue':_0x1c01('0x4')},'content':{'type':Sequelize[_0x1c01('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1c01('0x1')](_0x1c01('0x4'),_0x1c01('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x1c01('0x5')]},'idField':{'type':Sequelize[_0x1c01('0x5')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 679e8d7..2438a7b 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 _0x68b1=['filter','includeAll','include','findAll','rows','catch','keys','options','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','index','SalesforceField','rawAttributes','model','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','sort','where','pick','add','day','merge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68b1,0xdb));var _0x168b=function(_0x1e9e54,_0x56bf22){_0x1e9e54=_0x1e9e54-0x0;var _0x259995=_0x68b1[_0x1e9e54];return _0x259995;};'use strict';var pdf=require(_0x168b('0x0'));var emlformat=require(_0x168b('0x1'));var rimraf=require(_0x168b('0x2'));var zipdir=require(_0x168b('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x168b('0x4'));var BPromise=require(_0x168b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x168b('0x6'));var csv=require('to-csv');var ejs=require(_0x168b('0x7'));var fs=require('fs');var _=require(_0x168b('0x8'));var squel=require(_0x168b('0x9'));var crypto=require(_0x168b('0xa'));var jsforce=require(_0x168b('0xb'));var deskjs=require(_0x168b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x168b('0xd'));var Papa=require(_0x168b('0xe'));var Redis=require(_0x168b('0xf'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x168b('0x10'));var utils=require(_0x168b('0x11'));var config=require(_0x168b('0x12'));var db=require(_0x168b('0x13'))['db'];function respondWithStatusCode(_0x4de05d,_0x5deb43){_0x5deb43=_0x5deb43||0xcc;return function(_0x132d2d){if(_0x132d2d){return _0x4de05d[_0x168b('0x14')](_0x5deb43);}return _0x4de05d[_0x168b('0x15')](_0x5deb43)['end']();};}function respondWithResult(_0x26f272,_0x99d04d){_0x99d04d=_0x99d04d||0xc8;return function(_0x57612b){if(_0x57612b){return _0x26f272[_0x168b('0x15')](_0x99d04d)[_0x168b('0x16')](_0x57612b);}};}function respondWithFilteredResult(_0xe76a5d,_0x36506b){return function(_0x6341c9){if(_0x6341c9){var _0x990f41=_0x6341c9[_0x168b('0x17')],_0x2f0a6a=_0x36506b['offset'],_0x225452=_0x36506b['offset']+_0x36506b['limit'],_0x47f7e1;if(_0x225452>=_0x990f41){_0x225452=_0x990f41;_0x47f7e1=0xc8;}else{_0x47f7e1=0xce;}_0xe76a5d[_0x168b('0x15')](_0x47f7e1);return _0xe76a5d[_0x168b('0x18')](_0x168b('0x19'),_0x2f0a6a+'-'+_0x225452+'/'+_0x990f41)[_0x168b('0x16')](_0x6341c9);}return null;};}function patchUpdates(_0x1de061){return function(_0x226310){try{jsonpatch['apply'](_0x226310,_0x1de061,!![]);}catch(_0x48e686){return BPromise[_0x168b('0x1a')](_0x48e686);}return _0x226310[_0x168b('0x1b')]();};}function saveUpdates(_0x38e822,_0x5dc754){return function(_0x50f1a5){if(_0x50f1a5){return _0x50f1a5[_0x168b('0x1c')](_0x38e822)[_0x168b('0x1d')](function(_0x2b816e){return _0x2b816e;});}return null;};}function removeEntity(_0x5cb9ef,_0x6c45b0){return function(_0x590c66){if(_0x590c66){return _0x590c66[_0x168b('0x1e')]()[_0x168b('0x1d')](function(){_0x5cb9ef[_0x168b('0x15')](0xcc)[_0x168b('0x1f')]();});}};}function handleEntityNotFound(_0x9fa78d,_0x38d8a1){return function(_0x438d5d){if(!_0x438d5d){_0x9fa78d[_0x168b('0x14')](0x194);}return _0x438d5d;};}function handleError(_0x136fef,_0xdc7229){_0xdc7229=_0xdc7229||0x1f4;return function(_0x33665a){logger[_0x168b('0x20')](_0x33665a[_0x168b('0x21')]);if(_0x33665a[_0x168b('0x22')]){delete _0x33665a['name'];}_0x136fef['status'](_0xdc7229)['send'](_0x33665a);};}exports[_0x168b('0x23')]=function(_0x1f6320,_0x438454){var _0x343a89={},_0x41d88b={},_0x88ac33={'count':0x0,'rows':[]};var _0x172e62=db[_0x168b('0x24')][_0x168b('0x25')];_0x41d88b[_0x168b('0x26')]=_['keys'](_0x172e62);var _0x29fd2d={'dateStart':_0x1f6320[_0x168b('0x27')][_0x168b('0x28')],'dateEnd':_0x1f6320[_0x168b('0x27')][_0x168b('0x29')]};delete _0x1f6320[_0x168b('0x27')][_0x168b('0x28')];delete _0x1f6320['query'][_0x168b('0x29')];_0x41d88b['query']=_['keys'](_0x1f6320['query']);_0x41d88b[_0x168b('0x2a')]=_[_0x168b('0x2b')](_0x41d88b['model'],_0x41d88b[_0x168b('0x27')]);_0x343a89[_0x168b('0x2c')]=_[_0x168b('0x2b')](_0x41d88b['model'],qs[_0x168b('0x2d')](_0x1f6320[_0x168b('0x27')]['fields']));_0x343a89[_0x168b('0x2c')]=_0x343a89[_0x168b('0x2c')][_0x168b('0x2e')]?_0x343a89['attributes']:_0x41d88b['model'];if(!_0x1f6320['query'][_0x168b('0x2f')](_0x168b('0x30'))){_0x343a89[_0x168b('0x31')]=qs['limit'](_0x1f6320['query'][_0x168b('0x31')]);_0x343a89[_0x168b('0x32')]=qs[_0x168b('0x32')](_0x1f6320[_0x168b('0x27')][_0x168b('0x32')]);}_0x343a89['order']=qs[_0x168b('0x33')](_0x1f6320['query'][_0x168b('0x33')]);_0x343a89[_0x168b('0x34')]=qs[_0x168b('0x2a')](_[_0x168b('0x35')](_0x1f6320[_0x168b('0x27')],_0x41d88b[_0x168b('0x2a')]));if(_0x29fd2d[_0x168b('0x28')]){if(_0x29fd2d[_0x168b('0x29')]){_0x29fd2d['dateEnd']=moment(_0x29fd2d[_0x168b('0x29')])[_0x168b('0x36')](0x1,_0x168b('0x37'));}else{_0x29fd2d[_0x168b('0x29')]=moment(_0x29fd2d['dateStart'])[_0x168b('0x36')](0x1,'day');}_[_0x168b('0x38')](_0x343a89[_0x168b('0x34')],{'createdAt':{'$gte':_0x29fd2d[_0x168b('0x28')],'$lte':_0x29fd2d[_0x168b('0x29')]}});}if(_0x1f6320[_0x168b('0x27')]['filter']){_0x343a89['where']=_[_0x168b('0x38')](_0x343a89[_0x168b('0x34')],{'$or':_['map'](_0x343a89[_0x168b('0x2c')],function(_0x59db85){var _0x51bfe8={};_0x51bfe8[_0x59db85]={'$like':'%'+_0x1f6320[_0x168b('0x27')][_0x168b('0x39')]+'%'};return _0x51bfe8;})});}_0x343a89=_[_0x168b('0x38')]({},_0x343a89,_0x1f6320['options']);var _0x3e4aae={'where':_0x343a89[_0x168b('0x34')]};return db[_0x168b('0x24')][_0x168b('0x17')](_0x3e4aae)[_0x168b('0x1d')](function(_0x175436){_0x88ac33[_0x168b('0x17')]=_0x175436;if(_0x1f6320['query'][_0x168b('0x3a')]){_0x343a89[_0x168b('0x3b')]=[{'all':!![]}];}return db[_0x168b('0x24')][_0x168b('0x3c')](_0x343a89);})[_0x168b('0x1d')](function(_0x248064){_0x88ac33[_0x168b('0x3d')]=_0x248064;return _0x88ac33;})[_0x168b('0x1d')](respondWithFilteredResult(_0x438454,_0x343a89))[_0x168b('0x3e')](handleError(_0x438454,null));};exports['show']=function(_0x382d62,_0xc7a92){var _0x1e4c7b={'raw':!![],'where':{'id':_0x382d62['params']['id']}},_0x17afce={};_0x17afce[_0x168b('0x26')]=_[_0x168b('0x3f')](db[_0x168b('0x24')][_0x168b('0x25')]);_0x17afce[_0x168b('0x27')]=_['keys'](_0x382d62['query']);_0x17afce[_0x168b('0x2a')]=_[_0x168b('0x2b')](_0x17afce[_0x168b('0x26')],_0x17afce['query']);_0x1e4c7b[_0x168b('0x2c')]=_[_0x168b('0x2b')](_0x17afce[_0x168b('0x26')],qs[_0x168b('0x2d')](_0x382d62[_0x168b('0x27')][_0x168b('0x2d')]));_0x1e4c7b[_0x168b('0x2c')]=_0x1e4c7b['attributes']['length']?_0x1e4c7b['attributes']:_0x17afce[_0x168b('0x26')];if(_0x382d62[_0x168b('0x27')][_0x168b('0x3a')]){_0x1e4c7b[_0x168b('0x3b')]=[{'all':!![]}];}_0x1e4c7b=_[_0x168b('0x38')]({},_0x1e4c7b,_0x382d62[_0x168b('0x40')]);return db['SalesforceField'][_0x168b('0x41')](_0x1e4c7b)[_0x168b('0x1d')](handleEntityNotFound(_0xc7a92,null))[_0x168b('0x1d')](respondWithResult(_0xc7a92,null))[_0x168b('0x3e')](handleError(_0xc7a92,null));};exports[_0x168b('0x42')]=function(_0x2b5eca,_0x25bd5d){return db[_0x168b('0x24')][_0x168b('0x42')](_0x2b5eca[_0x168b('0x43')],{})[_0x168b('0x1d')](respondWithResult(_0x25bd5d,0xc9))[_0x168b('0x3e')](handleError(_0x25bd5d,null));};exports[_0x168b('0x1c')]=function(_0x3566e6,_0x3cb9b4){if(_0x3566e6[_0x168b('0x43')]['id']){delete _0x3566e6['body']['id'];}return db[_0x168b('0x24')][_0x168b('0x41')]({'where':{'id':_0x3566e6[_0x168b('0x44')]['id']}})[_0x168b('0x1d')](handleEntityNotFound(_0x3cb9b4,null))[_0x168b('0x1d')](saveUpdates(_0x3566e6[_0x168b('0x43')],null))[_0x168b('0x1d')](respondWithResult(_0x3cb9b4,null))[_0x168b('0x3e')](handleError(_0x3cb9b4,null));};exports[_0x168b('0x1e')]=function(_0x546810,_0x52854c){return db[_0x168b('0x24')][_0x168b('0x41')]({'where':{'id':_0x546810[_0x168b('0x44')]['id']}})['then'](handleEntityNotFound(_0x52854c,null))[_0x168b('0x1d')](removeEntity(_0x52854c,null))[_0x168b('0x3e')](handleError(_0x52854c,null));}; \ No newline at end of file +var _0x4862=['where','pick','add','day','merge','filter','map','options','SalesforceField','includeAll','include','rows','catch','show','params','create','body','find','destroy','html-pdf','rimraf','fast-json-patch','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../mysqldb','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','nolimit','offset','order','sort'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4862,0x1e8));var _0x2486=function(_0x2ae8d6,_0x4d7876){_0x2ae8d6=_0x2ae8d6-0x0;var _0x3d5145=_0x4862[_0x2ae8d6];return _0x3d5145;};'use strict';var pdf=require(_0x2486('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2486('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2486('0x2'));var rp=require('request-promise');var moment=require(_0x2486('0x3'));var BPromise=require(_0x2486('0x4'));var Mustache=require('mustache');var util=require(_0x2486('0x5'));var path=require('path');var sox=require(_0x2486('0x6'));var csv=require(_0x2486('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2486('0x8'));var squel=require(_0x2486('0x9'));var crypto=require(_0x2486('0xa'));var jsforce=require(_0x2486('0xb'));var deskjs=require(_0x2486('0xc'));var toCsv=require(_0x2486('0x7'));var querystring=require(_0x2486('0xd'));var Papa=require(_0x2486('0xe'));var Redis=require('ioredis');var qs=require(_0x2486('0xf'));var logger=require('../../config/logger')(_0x2486('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x2486('0x11'))['db'];function respondWithStatusCode(_0x16e61d,_0x5277c4){_0x5277c4=_0x5277c4||0xcc;return function(_0xc9704b){if(_0xc9704b){return _0x16e61d['sendStatus'](_0x5277c4);}return _0x16e61d[_0x2486('0x12')](_0x5277c4)[_0x2486('0x13')]();};}function respondWithResult(_0x215a16,_0x589a84){_0x589a84=_0x589a84||0xc8;return function(_0x478fea){if(_0x478fea){return _0x215a16[_0x2486('0x12')](_0x589a84)[_0x2486('0x14')](_0x478fea);}};}function respondWithFilteredResult(_0x5c41ca,_0x5cc4f1){return function(_0x42a771){if(_0x42a771){var _0x309b45=_0x42a771[_0x2486('0x15')],_0x1397e9=_0x5cc4f1['offset'],_0x11bac2=_0x5cc4f1['offset']+_0x5cc4f1[_0x2486('0x16')],_0x253955;if(_0x11bac2>=_0x309b45){_0x11bac2=_0x309b45;_0x253955=0xc8;}else{_0x253955=0xce;}_0x5c41ca[_0x2486('0x12')](_0x253955);return _0x5c41ca[_0x2486('0x17')](_0x2486('0x18'),_0x1397e9+'-'+_0x11bac2+'/'+_0x309b45)[_0x2486('0x14')](_0x42a771);}return null;};}function patchUpdates(_0x4b8580){return function(_0x52ca45){try{jsonpatch[_0x2486('0x19')](_0x52ca45,_0x4b8580,!![]);}catch(_0x2977f3){return BPromise[_0x2486('0x1a')](_0x2977f3);}return _0x52ca45[_0x2486('0x1b')]();};}function saveUpdates(_0x2b8167,_0x258348){return function(_0x49d201){if(_0x49d201){return _0x49d201[_0x2486('0x1c')](_0x2b8167)[_0x2486('0x1d')](function(_0x32e4e6){return _0x32e4e6;});}return null;};}function removeEntity(_0x1d5e5a,_0x489335){return function(_0x2b52b3){if(_0x2b52b3){return _0x2b52b3['destroy']()[_0x2486('0x1d')](function(){_0x1d5e5a['status'](0xcc)[_0x2486('0x13')]();});}};}function handleEntityNotFound(_0xebbd93,_0x1b6432){return function(_0x16827e){if(!_0x16827e){_0xebbd93[_0x2486('0x1e')](0x194);}return _0x16827e;};}function handleError(_0x59c33a,_0x43fd7d){_0x43fd7d=_0x43fd7d||0x1f4;return function(_0x3ad066){logger['error'](_0x3ad066[_0x2486('0x1f')]);if(_0x3ad066[_0x2486('0x20')]){delete _0x3ad066['name'];}_0x59c33a[_0x2486('0x12')](_0x43fd7d)[_0x2486('0x21')](_0x3ad066);};}exports['index']=function(_0xdc02c8,_0x32e555){var _0x28324e={},_0x3ac76c={},_0x2e85f9={'count':0x0,'rows':[]};var _0x5083bc=db['SalesforceField'][_0x2486('0x22')];_0x3ac76c[_0x2486('0x23')]=_[_0x2486('0x24')](_0x5083bc);var _0x273f01={'dateStart':_0xdc02c8[_0x2486('0x25')][_0x2486('0x26')],'dateEnd':_0xdc02c8[_0x2486('0x25')][_0x2486('0x27')]};delete _0xdc02c8[_0x2486('0x25')]['dateStart'];delete _0xdc02c8[_0x2486('0x25')][_0x2486('0x27')];_0x3ac76c[_0x2486('0x25')]=_[_0x2486('0x24')](_0xdc02c8[_0x2486('0x25')]);_0x3ac76c[_0x2486('0x28')]=_[_0x2486('0x29')](_0x3ac76c[_0x2486('0x23')],_0x3ac76c[_0x2486('0x25')]);_0x28324e['attributes']=_[_0x2486('0x29')](_0x3ac76c[_0x2486('0x23')],qs[_0x2486('0x2a')](_0xdc02c8[_0x2486('0x25')][_0x2486('0x2a')]));_0x28324e[_0x2486('0x2b')]=_0x28324e[_0x2486('0x2b')]['length']?_0x28324e[_0x2486('0x2b')]:_0x3ac76c[_0x2486('0x23')];if(!_0xdc02c8[_0x2486('0x25')]['hasOwnProperty'](_0x2486('0x2c'))){_0x28324e[_0x2486('0x16')]=qs[_0x2486('0x16')](_0xdc02c8[_0x2486('0x25')][_0x2486('0x16')]);_0x28324e[_0x2486('0x2d')]=qs[_0x2486('0x2d')](_0xdc02c8['query'][_0x2486('0x2d')]);}_0x28324e[_0x2486('0x2e')]=qs[_0x2486('0x2f')](_0xdc02c8[_0x2486('0x25')][_0x2486('0x2f')]);_0x28324e[_0x2486('0x30')]=qs['filters'](_[_0x2486('0x31')](_0xdc02c8[_0x2486('0x25')],_0x3ac76c[_0x2486('0x28')]));if(_0x273f01[_0x2486('0x26')]){if(_0x273f01[_0x2486('0x27')]){_0x273f01[_0x2486('0x27')]=moment(_0x273f01[_0x2486('0x27')])[_0x2486('0x32')](0x1,_0x2486('0x33'));}else{_0x273f01[_0x2486('0x27')]=moment(_0x273f01[_0x2486('0x26')])[_0x2486('0x32')](0x1,_0x2486('0x33'));}_[_0x2486('0x34')](_0x28324e[_0x2486('0x30')],{'createdAt':{'$gte':_0x273f01[_0x2486('0x26')],'$lte':_0x273f01[_0x2486('0x27')]}});}if(_0xdc02c8[_0x2486('0x25')][_0x2486('0x35')]){_0x28324e[_0x2486('0x30')]=_['merge'](_0x28324e['where'],{'$or':_[_0x2486('0x36')](_0x28324e['attributes'],function(_0x5f2701){var _0x10e2a4={};_0x10e2a4[_0x5f2701]={'$like':'%'+_0xdc02c8[_0x2486('0x25')][_0x2486('0x35')]+'%'};return _0x10e2a4;})});}_0x28324e=_['merge']({},_0x28324e,_0xdc02c8[_0x2486('0x37')]);var _0x3f33fc={'where':_0x28324e[_0x2486('0x30')]};return db[_0x2486('0x38')][_0x2486('0x15')](_0x3f33fc)[_0x2486('0x1d')](function(_0x31ec7c){_0x2e85f9[_0x2486('0x15')]=_0x31ec7c;if(_0xdc02c8[_0x2486('0x25')][_0x2486('0x39')]){_0x28324e[_0x2486('0x3a')]=[{'all':!![]}];}return db[_0x2486('0x38')]['findAll'](_0x28324e);})[_0x2486('0x1d')](function(_0x2c23ea){_0x2e85f9[_0x2486('0x3b')]=_0x2c23ea;return _0x2e85f9;})[_0x2486('0x1d')](respondWithFilteredResult(_0x32e555,_0x28324e))[_0x2486('0x3c')](handleError(_0x32e555,null));};exports[_0x2486('0x3d')]=function(_0x5cda5f,_0x158773){var _0x5a4135={'raw':!![],'where':{'id':_0x5cda5f[_0x2486('0x3e')]['id']}},_0x16c5b7={};_0x16c5b7[_0x2486('0x23')]=_[_0x2486('0x24')](db[_0x2486('0x38')][_0x2486('0x22')]);_0x16c5b7[_0x2486('0x25')]=_[_0x2486('0x24')](_0x5cda5f[_0x2486('0x25')]);_0x16c5b7[_0x2486('0x28')]=_['intersection'](_0x16c5b7[_0x2486('0x23')],_0x16c5b7['query']);_0x5a4135[_0x2486('0x2b')]=_[_0x2486('0x29')](_0x16c5b7[_0x2486('0x23')],qs[_0x2486('0x2a')](_0x5cda5f[_0x2486('0x25')]['fields']));_0x5a4135[_0x2486('0x2b')]=_0x5a4135[_0x2486('0x2b')]['length']?_0x5a4135[_0x2486('0x2b')]:_0x16c5b7['model'];if(_0x5cda5f['query']['includeAll']){_0x5a4135[_0x2486('0x3a')]=[{'all':!![]}];}_0x5a4135=_[_0x2486('0x34')]({},_0x5a4135,_0x5cda5f[_0x2486('0x37')]);return db[_0x2486('0x38')]['find'](_0x5a4135)[_0x2486('0x1d')](handleEntityNotFound(_0x158773,null))[_0x2486('0x1d')](respondWithResult(_0x158773,null))['catch'](handleError(_0x158773,null));};exports[_0x2486('0x3f')]=function(_0x45b733,_0x13c788){return db[_0x2486('0x38')][_0x2486('0x3f')](_0x45b733['body'],{})[_0x2486('0x1d')](respondWithResult(_0x13c788,0xc9))[_0x2486('0x3c')](handleError(_0x13c788,null));};exports[_0x2486('0x1c')]=function(_0x1f71ee,_0x77bd93){if(_0x1f71ee['body']['id']){delete _0x1f71ee[_0x2486('0x40')]['id'];}return db[_0x2486('0x38')][_0x2486('0x41')]({'where':{'id':_0x1f71ee[_0x2486('0x3e')]['id']}})[_0x2486('0x1d')](handleEntityNotFound(_0x77bd93,null))[_0x2486('0x1d')](saveUpdates(_0x1f71ee[_0x2486('0x40')],null))[_0x2486('0x1d')](respondWithResult(_0x77bd93,null))[_0x2486('0x3c')](handleError(_0x77bd93,null));};exports[_0x2486('0x42')]=function(_0x884c9b,_0x5a2209){return db['SalesforceField'][_0x2486('0x41')]({'where':{'id':_0x884c9b[_0x2486('0x3e')]['id']}})[_0x2486('0x1d')](handleEntityNotFound(_0x5a2209,null))['then'](removeEntity(_0x5a2209,null))[_0x2486('0x3c')](handleError(_0x5a2209,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index afa6172..d5b154d 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 _0x20f5=['exports','SalesforceField','int_salesforce_fields','lodash','../../config/logger','api','moment','bluebird','request-promise','./intSalesforceField.attributes'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x20f5,0x19d));var _0x520f=function(_0x1f3411,_0x34d444){_0x1f3411=_0x1f3411-0x0;var _0x3d8fa9=_0x20f5[_0x1f3411];return _0x3d8fa9;};'use strict';var _=require(_0x520f('0x0'));var util=require('util');var logger=require(_0x520f('0x1'))(_0x520f('0x2'));var moment=require(_0x520f('0x3'));var BPromise=require(_0x520f('0x4'));var rp=require(_0x520f('0x5'));var attributes=require(_0x520f('0x6'));module[_0x520f('0x7')]=function(_0x32e60b,_0x485bfb){return _0x32e60b['define'](_0x520f('0x8'),attributes,{'tableName':_0x520f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2cf9=['../../config/logger','api','moment','request-promise','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','util'];(function(_0x57d740,_0x50be99){var _0x6607ef=function(_0x908bd0){while(--_0x908bd0){_0x57d740['push'](_0x57d740['shift']());}};_0x6607ef(++_0x50be99);}(_0x2cf9,0x149));var _0x92cf=function(_0x4c9408,_0x55f21f){_0x4c9408=_0x4c9408-0x0;var _0xea1e2d=_0x2cf9[_0x4c9408];return _0xea1e2d;};'use strict';var _=require('lodash');var util=require(_0x92cf('0x0'));var logger=require(_0x92cf('0x1'))(_0x92cf('0x2'));var moment=require(_0x92cf('0x3'));var BPromise=require('bluebird');var rp=require(_0x92cf('0x4'));var attributes=require(_0x92cf('0x5'));module[_0x92cf('0x6')]=function(_0xee2fce,_0x1e4aa3){return _0xee2fce[_0x92cf('0x7')](_0x92cf('0x8'),attributes,{'tableName':_0x92cf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 88134e0..b5683ad 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 _0x5a1a=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','SalesforceField,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2230fa,_0x3f73a5){var _0x361a67=function(_0x40a0d2){while(--_0x40a0d2){_0x2230fa['push'](_0x2230fa['shift']());}};_0x361a67(++_0x3f73a5);}(_0x5a1a,0x9b));var _0xa5a1=function(_0x15da5f,_0x3fce0e){_0x15da5f=_0x15da5f-0x0;var _0x1992f1=_0x5a1a[_0x15da5f];return _0x1992f1;};'use strict';var _=require(_0xa5a1('0x0'));var util=require(_0xa5a1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa5a1('0x2'));var fs=require('fs');var Redis=require(_0xa5a1('0x3'));var db=require(_0xa5a1('0x4'))['db'];var utils=require(_0xa5a1('0x5'));var logger=require(_0xa5a1('0x6'))(_0xa5a1('0x7'));var config=require(_0xa5a1('0x8'));var jayson=require(_0xa5a1('0x9'));var client=jayson['client'][_0xa5a1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46add9,_0x527eec,_0x376e76){return new BPromise(function(_0x4376d8,_0x21d230){return client[_0xa5a1('0xb')](_0x46add9,_0x376e76)[_0xa5a1('0xc')](function(_0x2ad6ef){logger[_0xa5a1('0xd')]('SalesforceField,\x20%s,\x20%s',_0x527eec,_0xa5a1('0xe'));logger[_0xa5a1('0xf')](_0xa5a1('0x10'),_0x527eec,'request\x20sent',JSON['stringify'](_0x2ad6ef));if(_0x2ad6ef[_0xa5a1('0x11')]){if(_0x2ad6ef[_0xa5a1('0x11')][_0xa5a1('0x12')]===0x1f4){logger['error'](_0xa5a1('0x13'),_0x527eec,_0x2ad6ef['error'][_0xa5a1('0x14')]);return _0x21d230(_0x2ad6ef['error'][_0xa5a1('0x14')]);}logger[_0xa5a1('0x11')](_0xa5a1('0x13'),_0x527eec,_0x2ad6ef[_0xa5a1('0x11')]['message']);return _0x4376d8(_0x2ad6ef[_0xa5a1('0x11')][_0xa5a1('0x14')]);}else{logger[_0xa5a1('0xd')](_0xa5a1('0x13'),_0x527eec,_0xa5a1('0xe'));_0x4376d8(_0x2ad6ef[_0xa5a1('0x15')][_0xa5a1('0x14')]);}})[_0xa5a1('0x16')](function(_0x2615f2){logger['error'](_0xa5a1('0x13'),_0x527eec,_0x2615f2);_0x21d230(_0x2615f2);});});} \ No newline at end of file +var _0xb113=['code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3f4f2b,_0x2a4d8a){var _0x31c48b=function(_0xa8ad0f){while(--_0xa8ad0f){_0x3f4f2b['push'](_0x3f4f2b['shift']());}};_0x31c48b(++_0x2a4d8a);}(_0xb113,0x15d));var _0x3b11=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xb113[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0x3b11('0x0'));var util=require(_0x3b11('0x1'));var moment=require('moment');var BPromise=require(_0x3b11('0x2'));var rs=require(_0x3b11('0x3'));var fs=require('fs');var Redis=require(_0x3b11('0x4'));var db=require(_0x3b11('0x5'))['db'];var utils=require(_0x3b11('0x6'));var logger=require(_0x3b11('0x7'))(_0x3b11('0x8'));var config=require(_0x3b11('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3b11('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a8198,_0xadee0c,_0x43e0c6){return new BPromise(function(_0x228741,_0x1544be){return client[_0x3b11('0xb')](_0x3a8198,_0x43e0c6)[_0x3b11('0xc')](function(_0x1aceac){logger[_0x3b11('0xd')](_0x3b11('0xe'),_0xadee0c,_0x3b11('0xf'));logger['debug'](_0x3b11('0x10'),_0xadee0c,'request\x20sent',JSON[_0x3b11('0x11')](_0x1aceac));if(_0x1aceac['error']){if(_0x1aceac[_0x3b11('0x12')][_0x3b11('0x13')]===0x1f4){logger[_0x3b11('0x12')](_0x3b11('0xe'),_0xadee0c,_0x1aceac['error'][_0x3b11('0x14')]);return _0x1544be(_0x1aceac['error']['message']);}logger['error'](_0x3b11('0xe'),_0xadee0c,_0x1aceac['error']['message']);return _0x228741(_0x1aceac[_0x3b11('0x12')]['message']);}else{logger[_0x3b11('0xd')](_0x3b11('0xe'),_0xadee0c,_0x3b11('0xf'));_0x228741(_0x1aceac[_0x3b11('0x15')]['message']);}})[_0x3b11('0x16')](function(_0xe94920){logger[_0x3b11('0x12')]('SalesforceField,\x20%s,\x20%s',_0xadee0c,_0xe94920);_0x1544be(_0xe94920);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index fa57511..96b7c40 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 _0xe272=['delete','destroy','exports','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','post','create','/:id/configurations','put'];(function(_0x1f9789,_0x248742){var _0x1eb5a4=function(_0x5d35da){while(--_0x5d35da){_0x1f9789['push'](_0x1f9789['shift']());}};_0x1eb5a4(++_0x248742);}(_0xe272,0xed));var _0x2e27=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xe272[_0x433a86];return _0x23000c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x2e27('0x0'));var express=require(_0x2e27('0x1'));var router=express['Router']();var auth=require(_0x2e27('0x2'));var interaction=require(_0x2e27('0x3'));var config=require('../../config/environment');var controller=require(_0x2e27('0x4'));router[_0x2e27('0x5')]('/',auth[_0x2e27('0x6')](),controller[_0x2e27('0x7')]);router['get'](_0x2e27('0x8'),auth['isAuthenticated'](),controller[_0x2e27('0x9')]);router[_0x2e27('0x5')]('/:id/configurations',auth[_0x2e27('0x6')](),controller[_0x2e27('0xa')]);router['get']('/:id/fields',auth[_0x2e27('0x6')](),controller['getFields']);router[_0x2e27('0xb')]('/',auth[_0x2e27('0x6')](),controller[_0x2e27('0xc')]);router['post'](_0x2e27('0xd'),auth[_0x2e27('0x6')](),controller['addConfiguration']);router[_0x2e27('0xe')](_0x2e27('0x8'),auth[_0x2e27('0x6')](),controller['update']);router[_0x2e27('0xf')](_0x2e27('0x8'),auth[_0x2e27('0x6')](),controller[_0x2e27('0x10')]);module[_0x2e27('0x11')]=router; \ No newline at end of file +var _0xec5f=['create','put','update','delete','destroy','util','path','express','Router','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post'];(function(_0x4de04f,_0x3b5f58){var _0x35d2f2=function(_0x44b8a1){while(--_0x44b8a1){_0x4de04f['push'](_0x4de04f['shift']());}};_0x35d2f2(++_0x3b5f58);}(_0xec5f,0x122));var _0xfec5=function(_0x3e1db2,_0x2d1965){_0x3e1db2=_0x3e1db2-0x0;var _0x108916=_0xec5f[_0x3e1db2];return _0x108916;};'use strict';var multer=require('multer');var util=require(_0xfec5('0x0'));var path=require(_0xfec5('0x1'));var timeout=require('connect-timeout');var express=require(_0xfec5('0x2'));var router=express[_0xfec5('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfec5('0x4'));var controller=require('./intSugarcrmAccount.controller');router[_0xfec5('0x5')]('/',auth[_0xfec5('0x6')](),controller[_0xfec5('0x7')]);router[_0xfec5('0x5')](_0xfec5('0x8'),auth[_0xfec5('0x6')](),controller[_0xfec5('0x9')]);router[_0xfec5('0x5')](_0xfec5('0xa'),auth[_0xfec5('0x6')](),controller[_0xfec5('0xb')]);router[_0xfec5('0x5')](_0xfec5('0xc'),auth[_0xfec5('0x6')](),controller['getFields']);router[_0xfec5('0xd')]('/',auth['isAuthenticated'](),controller[_0xfec5('0xe')]);router['post'](_0xfec5('0xa'),auth[_0xfec5('0x6')](),controller['addConfiguration']);router[_0xfec5('0xf')]('/:id',auth[_0xfec5('0x6')](),controller[_0xfec5('0x10')]);router[_0xfec5('0x11')](_0xfec5('0x8'),auth[_0xfec5('0x6')](),controller[_0xfec5('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 749280a..c0d72fc 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 _0x45aa=['username','remoteUri','exports','STRING'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0x45aa,0x176));var _0xa45a=function(_0x3d4369,_0x1701eb){_0x3d4369=_0x3d4369-0x0;var _0xfc21c0=_0x45aa[_0x3d4369];return _0xfc21c0;};'use strict';var Sequelize=require('sequelize');module[_0xa45a('0x0')]={'name':{'type':Sequelize[_0xa45a('0x1')]},'description':{'type':Sequelize[_0xa45a('0x1')]},'username':{'type':Sequelize[_0xa45a('0x1')],'unique':_0xa45a('0x2')},'password':{'type':Sequelize[_0xa45a('0x1')]},'remoteUri':{'type':Sequelize[_0xa45a('0x1')],'unique':_0xa45a('0x3')},'serverUrl':{'type':Sequelize[_0xa45a('0x1')]}}; \ No newline at end of file +var _0xd606=['STRING','username','remoteUri','sequelize'];(function(_0x431fbf,_0x2a2168){var _0x17a475=function(_0x3036d8){while(--_0x3036d8){_0x431fbf['push'](_0x431fbf['shift']());}};_0x17a475(++_0x2a2168);}(_0xd606,0x1bb));var _0x6d60=function(_0x4abc49,_0x8cd2cc){_0x4abc49=_0x4abc49-0x0;var _0x24b75b=_0xd606[_0x4abc49];return _0x24b75b;};'use strict';var Sequelize=require(_0x6d60('0x0'));module['exports']={'name':{'type':Sequelize[_0x6d60('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x6d60('0x1')],'unique':_0x6d60('0x2')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x6d60('0x1')],'unique':_0x6d60('0x3')},'serverUrl':{'type':Sequelize[_0x6d60('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index cc71c5a..ad8ec29 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 _0x248b=['bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','destroy','stack','name','send','index','SugarcrmAccount','rawAttributes','keys','query','dateStart','dateEnd','filters','model','intersection','fields','attributes','length','nolimit','sort','where','pick','add','filter','merge','map','includeAll','include','findAll','rows','params','options','find','create','body','getConfigurations','SugarcrmConfiguration','order','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','type','SugarcrmField','getFields','username','password','remoteUri','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','get_module_fields','Calls','module_fields','label','endsWith','values','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','request-promise','moment'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x248b,0x6f));var _0xb248=function(_0x4fe8ed,_0x44726a){_0x4fe8ed=_0x4fe8ed-0x0;var _0x3db2c2=_0x248b[_0x4fe8ed];return _0x3db2c2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb248('0x0'));var rimraf=require(_0xb248('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb248('0x2'));var moment=require(_0xb248('0x3'));var BPromise=require(_0xb248('0x4'));var Mustache=require('mustache');var util=require(_0xb248('0x5'));var path=require(_0xb248('0x6'));var sox=require(_0xb248('0x7'));var csv=require(_0xb248('0x8'));var ejs=require(_0xb248('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb248('0xa'));var crypto=require(_0xb248('0xb'));var jsforce=require(_0xb248('0xc'));var deskjs=require(_0xb248('0xd'));var toCsv=require(_0xb248('0x8'));var querystring=require(_0xb248('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var qs=require(_0xb248('0xf'));var logger=require(_0xb248('0x10'))(_0xb248('0x11'));var utils=require(_0xb248('0x12'));var config=require(_0xb248('0x13'));var db=require(_0xb248('0x14'))['db'];var integrations=require(_0xb248('0x15'));var jayson=require(_0xb248('0x16'));var client=jayson[_0xb248('0x17')][_0xb248('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x3f1083,_0x4dd090,_0x229831,_0x440c32){return new BPromise(function(_0x6790a8,_0x26ea8d){var _0x2038af=_0x440c32||client;return _0x2038af['request'](_0x3f1083,_0x229831)[_0xb248('0x19')](function(_0x3111c8){logger['info'](_0xb248('0x1a'),_0x4dd090,_0xb248('0x1b'));logger[_0xb248('0x1c')](_0xb248('0x1d'),_0x4dd090,'request\x20sent',JSON[_0xb248('0x1e')](_0x3111c8));if(_0x3111c8[_0xb248('0x1f')]){if(_0x3111c8[_0xb248('0x1f')][_0xb248('0x20')]===0x1f4){logger[_0xb248('0x1f')]('SugarcrmAccount,\x20%s,\x20%s',_0x4dd090,_0x3111c8[_0xb248('0x1f')][_0xb248('0x21')]);return _0x26ea8d(_0x3111c8[_0xb248('0x1f')][_0xb248('0x21')]);}logger['error'](_0xb248('0x1a'),_0x4dd090,_0x3111c8[_0xb248('0x1f')][_0xb248('0x21')]);return _0x6790a8(_0x3111c8[_0xb248('0x1f')][_0xb248('0x21')]);}else{logger[_0xb248('0x22')]('SugarcrmAccount,\x20%s,\x20%s',_0x4dd090,_0xb248('0x1b'));_0x6790a8(_0x3111c8['result']['message']);}})[_0xb248('0x23')](function(_0x1219c8){logger[_0xb248('0x1f')](_0xb248('0x1a'),_0x4dd090,_0x1219c8);_0x26ea8d(_0x1219c8);});});}function respondWithStatusCode(_0x115ca9,_0x2eccb0){_0x2eccb0=_0x2eccb0||0xcc;return function(_0x3f5955){if(_0x3f5955){return _0x115ca9[_0xb248('0x24')](_0x2eccb0);}return _0x115ca9[_0xb248('0x25')](_0x2eccb0)[_0xb248('0x26')]();};}function respondWithResult(_0x1440fc,_0x2a4506){_0x2a4506=_0x2a4506||0xc8;return function(_0x7797f1){if(_0x7797f1){return _0x1440fc['status'](_0x2a4506)[_0xb248('0x27')](_0x7797f1);}};}function respondWithFilteredResult(_0x2bdc45,_0x5020a4){return function(_0x112910){if(_0x112910){var _0x49b8d5=_0x112910[_0xb248('0x28')],_0x50fb0c=_0x5020a4['offset'],_0x51edd8=_0x5020a4[_0xb248('0x29')]+_0x5020a4[_0xb248('0x2a')],_0x439f96;if(_0x51edd8>=_0x49b8d5){_0x51edd8=_0x49b8d5;_0x439f96=0xc8;}else{_0x439f96=0xce;}_0x2bdc45[_0xb248('0x25')](_0x439f96);return _0x2bdc45[_0xb248('0x2b')]('Content-Range',_0x50fb0c+'-'+_0x51edd8+'/'+_0x49b8d5)[_0xb248('0x27')](_0x112910);}return null;};}function patchUpdates(_0x1b4f75){return function(_0x2676ab){try{jsonpatch[_0xb248('0x2c')](_0x2676ab,_0x1b4f75,!![]);}catch(_0x2af64e){return BPromise[_0xb248('0x2d')](_0x2af64e);}return _0x2676ab['save']();};}function saveUpdates(_0x52ab47,_0x1e470f){return function(_0x5b7784){if(_0x5b7784){return _0x5b7784[_0xb248('0x2e')](_0x52ab47)[_0xb248('0x19')](function(_0x5ef55e){return _0x5ef55e;});}return null;};}function removeEntity(_0x572e1b,_0x99a3aa){return function(_0x3a0be5){if(_0x3a0be5){return _0x3a0be5[_0xb248('0x2f')]()[_0xb248('0x19')](function(){_0x572e1b[_0xb248('0x25')](0xcc)[_0xb248('0x26')]();});}};}function handleEntityNotFound(_0x527fe4,_0x3ca662){return function(_0x36091){if(!_0x36091){_0x527fe4[_0xb248('0x24')](0x194);}return _0x36091;};}function handleError(_0x474fd3,_0x2c1a34){_0x2c1a34=_0x2c1a34||0x1f4;return function(_0x2b2ec9){logger['error'](_0x2b2ec9[_0xb248('0x30')]);if(_0x2b2ec9[_0xb248('0x31')]){delete _0x2b2ec9[_0xb248('0x31')];}_0x474fd3[_0xb248('0x25')](_0x2c1a34)[_0xb248('0x32')](_0x2b2ec9);};}exports[_0xb248('0x33')]=function(_0x460ffa,_0x1ea9ed){var _0x5932ad={},_0x56a0a2={},_0x442254={'count':0x0,'rows':[]};var _0xef2843=db[_0xb248('0x34')][_0xb248('0x35')];_0x56a0a2['model']=_[_0xb248('0x36')](_0xef2843);var _0x571495={'dateStart':_0x460ffa[_0xb248('0x37')][_0xb248('0x38')],'dateEnd':_0x460ffa[_0xb248('0x37')][_0xb248('0x39')]};delete _0x460ffa[_0xb248('0x37')][_0xb248('0x38')];delete _0x460ffa['query'][_0xb248('0x39')];_0x56a0a2['query']=_['keys'](_0x460ffa['query']);_0x56a0a2[_0xb248('0x3a')]=_['intersection'](_0x56a0a2[_0xb248('0x3b')],_0x56a0a2[_0xb248('0x37')]);_0x5932ad['attributes']=_[_0xb248('0x3c')](_0x56a0a2[_0xb248('0x3b')],qs[_0xb248('0x3d')](_0x460ffa[_0xb248('0x37')]['fields']));_0x5932ad[_0xb248('0x3e')]=_0x5932ad[_0xb248('0x3e')][_0xb248('0x3f')]?_0x5932ad[_0xb248('0x3e')]:_0x56a0a2['model'];if(!_0x460ffa[_0xb248('0x37')]['hasOwnProperty'](_0xb248('0x40'))){_0x5932ad[_0xb248('0x2a')]=qs['limit'](_0x460ffa[_0xb248('0x37')][_0xb248('0x2a')]);_0x5932ad['offset']=qs['offset'](_0x460ffa[_0xb248('0x37')]['offset']);}_0x5932ad['order']=qs[_0xb248('0x41')](_0x460ffa[_0xb248('0x37')][_0xb248('0x41')]);_0x5932ad[_0xb248('0x42')]=qs[_0xb248('0x3a')](_[_0xb248('0x43')](_0x460ffa['query'],_0x56a0a2[_0xb248('0x3a')]));if(_0x571495['dateStart']){if(_0x571495[_0xb248('0x39')]){_0x571495[_0xb248('0x39')]=moment(_0x571495[_0xb248('0x39')])[_0xb248('0x44')](0x1,'day');}else{_0x571495['dateEnd']=moment(_0x571495[_0xb248('0x38')])[_0xb248('0x44')](0x1,'day');}_['merge'](_0x5932ad[_0xb248('0x42')],{'createdAt':{'$gte':_0x571495['dateStart'],'$lte':_0x571495[_0xb248('0x39')]}});}if(_0x460ffa[_0xb248('0x37')][_0xb248('0x45')]){_0x5932ad[_0xb248('0x42')]=_[_0xb248('0x46')](_0x5932ad[_0xb248('0x42')],{'$or':_[_0xb248('0x47')](_0x5932ad['attributes'],function(_0x1340ab){var _0xded343={};_0xded343[_0x1340ab]={'$like':'%'+_0x460ffa[_0xb248('0x37')]['filter']+'%'};return _0xded343;})});}_0x5932ad=_[_0xb248('0x46')]({},_0x5932ad,_0x460ffa['options']);var _0x4ef1fe={'where':_0x5932ad[_0xb248('0x42')]};return db[_0xb248('0x34')]['count'](_0x4ef1fe)[_0xb248('0x19')](function(_0x574743){_0x442254['count']=_0x574743;if(_0x460ffa['query'][_0xb248('0x48')]){_0x5932ad[_0xb248('0x49')]=[{'all':!![]}];}return db[_0xb248('0x34')][_0xb248('0x4a')](_0x5932ad);})[_0xb248('0x19')](function(_0x60af1a){_0x442254[_0xb248('0x4b')]=_0x60af1a;return _0x442254;})[_0xb248('0x19')](respondWithFilteredResult(_0x1ea9ed,_0x5932ad))[_0xb248('0x23')](handleError(_0x1ea9ed,null));};exports['show']=function(_0x2ef61e,_0x16dee0){var _0x4438db={'raw':![],'where':{'id':_0x2ef61e[_0xb248('0x4c')]['id']}},_0x4d1918={};_0x4d1918[_0xb248('0x3b')]=_[_0xb248('0x36')](db[_0xb248('0x34')][_0xb248('0x35')]);_0x4d1918[_0xb248('0x37')]=_[_0xb248('0x36')](_0x2ef61e[_0xb248('0x37')]);_0x4d1918[_0xb248('0x3a')]=_[_0xb248('0x3c')](_0x4d1918[_0xb248('0x3b')],_0x4d1918[_0xb248('0x37')]);_0x4438db[_0xb248('0x3e')]=_[_0xb248('0x3c')](_0x4d1918[_0xb248('0x3b')],qs[_0xb248('0x3d')](_0x2ef61e[_0xb248('0x37')][_0xb248('0x3d')]));_0x4438db['attributes']=_0x4438db[_0xb248('0x3e')]['length']?_0x4438db[_0xb248('0x3e')]:_0x4d1918['model'];if(_0x2ef61e['query'][_0xb248('0x48')]){_0x4438db[_0xb248('0x49')]=[{'all':!![]}];}_0x4438db=_[_0xb248('0x46')]({},_0x4438db,_0x2ef61e[_0xb248('0x4d')]);return db[_0xb248('0x34')][_0xb248('0x4e')](_0x4438db)[_0xb248('0x19')](handleEntityNotFound(_0x16dee0,null))[_0xb248('0x19')](respondWithResult(_0x16dee0,null))[_0xb248('0x23')](handleError(_0x16dee0,null));};exports['create']=function(_0x213075,_0x2adf29){return db[_0xb248('0x34')][_0xb248('0x4f')](_0x213075[_0xb248('0x50')],{})['then'](respondWithResult(_0x2adf29,0xc9))[_0xb248('0x23')](handleError(_0x2adf29,null));};exports[_0xb248('0x2e')]=function(_0x3c7993,_0x73dd91){if(_0x3c7993['body']['id']){delete _0x3c7993['body']['id'];}return db[_0xb248('0x34')][_0xb248('0x4e')]({'where':{'id':_0x3c7993[_0xb248('0x4c')]['id']}})['then'](handleEntityNotFound(_0x73dd91,null))['then'](saveUpdates(_0x3c7993[_0xb248('0x50')],null))['then'](respondWithResult(_0x73dd91,null))['catch'](handleError(_0x73dd91,null));};exports['destroy']=function(_0x28a0a2,_0x18950d){return db[_0xb248('0x34')][_0xb248('0x4e')]({'where':{'id':_0x28a0a2['params']['id']}})[_0xb248('0x19')](handleEntityNotFound(_0x18950d,null))['then'](removeEntity(_0x18950d,null))['catch'](handleError(_0x18950d,null));};exports[_0xb248('0x51')]=function(_0x261699,_0x2dbb6a,_0x5c7472){var _0xb09e34={};var _0x3eb78b={};var _0x177be2;var _0x39b5c4;return db['SugarcrmAccount']['findOne']({'where':{'id':_0x261699['params']['id']}})[_0xb248('0x19')](handleEntityNotFound(_0x2dbb6a,null))['then'](function(_0x1ed67b){if(_0x1ed67b){_0x177be2=_0x1ed67b;_0x3eb78b['model']=_[_0xb248('0x36')](db[_0xb248('0x52')][_0xb248('0x35')]);_0x3eb78b[_0xb248('0x37')]=_[_0xb248('0x36')](_0x261699[_0xb248('0x37')]);_0x3eb78b[_0xb248('0x3a')]=_[_0xb248('0x3c')](_0x3eb78b[_0xb248('0x3b')],_0x3eb78b[_0xb248('0x37')]);_0xb09e34['attributes']=_[_0xb248('0x3c')](_0x3eb78b[_0xb248('0x3b')],qs[_0xb248('0x3d')](_0x261699['query']['fields']));_0xb09e34[_0xb248('0x3e')]=_0xb09e34[_0xb248('0x3e')]['length']?_0xb09e34[_0xb248('0x3e')]:_0x3eb78b['model'];_0xb09e34[_0xb248('0x53')]=qs[_0xb248('0x41')](_0x261699[_0xb248('0x37')][_0xb248('0x41')]);_0xb09e34[_0xb248('0x42')]=qs[_0xb248('0x3a')](_[_0xb248('0x43')](_0x261699[_0xb248('0x37')],_0x3eb78b[_0xb248('0x3a')]));if(_0x261699[_0xb248('0x37')][_0xb248('0x45')]){_0xb09e34[_0xb248('0x42')]=_[_0xb248('0x46')](_0xb09e34['where'],{'$or':_['map'](_0xb09e34[_0xb248('0x3e')],function(_0x27c9ba){var _0x37e955={};_0x37e955[_0x27c9ba]={'$like':'%'+_0x261699[_0xb248('0x37')][_0xb248('0x45')]+'%'};return _0x37e955;})});}_0xb09e34=_[_0xb248('0x46')]({},_0xb09e34,_0x261699[_0xb248('0x4d')]);return _0x177be2[_0xb248('0x51')](_0xb09e34);}})[_0xb248('0x19')](function(_0x163bba){if(_0x163bba){_0x39b5c4=_0x163bba[_0xb248('0x3f')];if(!_0x261699['query'][_0xb248('0x54')]('nolimit')){_0xb09e34[_0xb248('0x2a')]=qs[_0xb248('0x2a')](_0x261699['query'][_0xb248('0x2a')]);_0xb09e34[_0xb248('0x29')]=qs[_0xb248('0x29')](_0x261699['query'][_0xb248('0x29')]);}return _0x177be2[_0xb248('0x51')](_0xb09e34);}})['then'](function(_0xff07a1){if(_0xff07a1){return _0xff07a1?{'count':_0x39b5c4,'rows':_0xff07a1}:null;}})['then'](respondWithResult(_0x2dbb6a,null))[_0xb248('0x23')](handleError(_0x2dbb6a,null));};exports[_0xb248('0x55')]=function(_0x11c244,_0x3d9433,_0x37021e){if(_0x11c244['body']['id']){delete _0x11c244['body']['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x11c244['params']['id']}})[_0xb248('0x19')](handleEntityNotFound(_0x3d9433,null))['then'](function(_0x2bf3e1){if(_0x2bf3e1){_0x11c244[_0xb248('0x50')][_0xb248('0x56')]=_0x2bf3e1['id'];_0x11c244['body'][_0xb248('0x57')]=integrations[_0xb248('0x58')](_0x11c244[_0xb248('0x50')][_0xb248('0x59')],_0x11c244['body'][_0xb248('0x5a')]);_0x11c244[_0xb248('0x50')]['Descriptions']=integrations['getDescriptions'](_0x11c244[_0xb248('0x50')]['channel'],_0x11c244[_0xb248('0x50')][_0xb248('0x5a')]);return db[_0xb248('0x52')]['create'](_0x11c244['body'],{'include':[{'model':db[_0xb248('0x5b')],'as':_0xb248('0x57')},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})[_0xb248('0x19')](respondWithResult(_0x3d9433,null))[_0xb248('0x23')](handleError(_0x3d9433,null));};exports[_0xb248('0x5c')]=function(_0x3d25a1,_0xd5134c,_0x527e17){var _0x1edfe7;return db[_0xb248('0x34')]['findOne']({'where':{'id':_0x3d25a1['params']['id']},'attributes':['id',_0xb248('0x5d'),_0xb248('0x5e'),'remoteUri']})[_0xb248('0x19')](handleEntityNotFound(_0xd5134c,null))[_0xb248('0x19')](function(_0x44548b){if(_0x44548b){_0x1edfe7=_0x44548b[_0xb248('0x5f')];return rp({'method':_0xb248('0x60'),'uri':util[_0xb248('0x61')](_0xb248('0x62'),_0x1edfe7,_0xb248('0x63')),'json':!![],'form':{'method':_0xb248('0x64'),'input_type':'JSON','response_type':_0xb248('0x65'),'rest_data':JSON[_0xb248('0x1e')]({'user_auth':{'user_name':_0x44548b[_0xb248('0x5d')],'password':_0x44548b[_0xb248('0x5e')],'encryption':_0xb248('0x66')},'application':_0xb248('0x67')})}});}})['then'](function(_0x3880cd){if(_0x3880cd){return rp({'method':'POST','uri':util[_0xb248('0x61')](_0xb248('0x62'),_0x1edfe7,_0xb248('0x63')),'json':!![],'form':{'method':_0xb248('0x68'),'input_type':'JSON','response_type':_0xb248('0x65'),'rest_data':JSON['stringify']({'session':_0x3880cd['id'],'module_name':_0xb248('0x69')})}});}})['then'](function(_0x5cd740){if(_0x5cd740){var _0x4425ca=_['values'](_0x5cd740[_0xb248('0x6a')]);return{'count':_0x4425ca[_0xb248('0x3f')],'rows':_[_0xb248('0x47')](_0x4425ca,function(_0x131855){return{'id':_0x131855[_0xb248('0x31')],'name':_0x131855[_0xb248('0x6b')],'custom':_[_0xb248('0x6c')](_0x131855[_0xb248('0x31')],'_c')?!![]:![],'options':_0x131855[_0xb248('0x4d')]?_[_0xb248('0x47')](_[_0xb248('0x6d')](_0x131855[_0xb248('0x4d')]),function(_0x540ee8){return{'name':_0x540ee8[_0xb248('0x6e')],'value':_0x540ee8['name']};}):[]};})};}})['then'](respondWithResult(_0xd5134c,null))[_0xb248('0x23')](function(_0x25cc92){var _0x16f4b5=_0x3d25a1[_0xb248('0x37')][_0xb248('0x6f')]?0x1f4:_0x25cc92[_0xb248('0x70')]||0x1f4;logger['error'](_0xb248('0x71'),_0xb248('0x5c'),_0x16f4b5,JSON[_0xb248('0x1e')](_0x25cc92));delete _0x25cc92[_0xb248('0x31')];if(_0x16f4b5===0x191){_0x16f4b5=0x190;}_0xd5134c[_0xb248('0x25')](_0x16f4b5)['send'](_0x3d25a1[_0xb248('0x37')][_0xb248('0x6f')]?{'message':_0xb248('0x72'),'statusCode':_0x25cc92[_0xb248('0x70')]}:_0x25cc92);});}; \ No newline at end of file +var _0x0f4a=['rows','show','options','find','create','body','params','getConfigurations','findOne','SugarcrmConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','type','SugarcrmField','getFields','username','password','remoteUri','format','%s%s','login','PLAIN','xCALLY\x20Motion\x20Integration','POST','/service/v4_1/rest.php','get_module_fields','JSON','Calls','values','module_fields','endsWith','value','test','statusCode','send','Wrong\x20credentials','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','request','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','count','offset','Content-Range','save','destroy','stack','name','index','SugarcrmAccount','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','add','merge','filter','map','includeAll','include','findAll'];(function(_0x87574,_0x3f0cf2){var _0x1aba32=function(_0x26c47a){while(--_0x26c47a){_0x87574['push'](_0x87574['shift']());}};_0x1aba32(++_0x3f0cf2);}(_0x0f4a,0x186));var _0xa0f4=function(_0x3d51e4,_0x4f9794){_0x3d51e4=_0x3d51e4-0x0;var _0x2cb84a=_0x0f4a[_0x3d51e4];return _0x2cb84a;};'use strict';var pdf=require(_0xa0f4('0x0'));var emlformat=require(_0xa0f4('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa0f4('0x2'));var rp=require(_0xa0f4('0x3'));var moment=require('moment');var BPromise=require(_0xa0f4('0x4'));var Mustache=require(_0xa0f4('0x5'));var util=require(_0xa0f4('0x6'));var path=require(_0xa0f4('0x7'));var sox=require(_0xa0f4('0x8'));var csv=require('to-csv');var ejs=require(_0xa0f4('0x9'));var fs=require('fs');var _=require(_0xa0f4('0xa'));var squel=require(_0xa0f4('0xb'));var crypto=require('crypto');var jsforce=require(_0xa0f4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa0f4('0xd'));var querystring=require('querystring');var Papa=require(_0xa0f4('0xe'));var Redis=require(_0xa0f4('0xf'));var qs=require(_0xa0f4('0x10'));var logger=require(_0xa0f4('0x11'))(_0xa0f4('0x12'));var utils=require(_0xa0f4('0x13'));var config=require(_0xa0f4('0x14'));var db=require(_0xa0f4('0x15'))['db'];var integrations=require(_0xa0f4('0x16'));var jayson=require('jayson/promise');var client=jayson[_0xa0f4('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x539136,_0x2badd2,_0x1beaa4,_0x13dd40){return new BPromise(function(_0x49886f,_0x5b672e){var _0x42c012=_0x13dd40||client;return _0x42c012[_0xa0f4('0x18')](_0x539136,_0x1beaa4)[_0xa0f4('0x19')](function(_0x3b7bd1){logger[_0xa0f4('0x1a')]('SugarcrmAccount,\x20%s,\x20%s',_0x2badd2,_0xa0f4('0x1b'));logger[_0xa0f4('0x1c')](_0xa0f4('0x1d'),_0x2badd2,'request\x20sent',JSON[_0xa0f4('0x1e')](_0x3b7bd1));if(_0x3b7bd1[_0xa0f4('0x1f')]){if(_0x3b7bd1[_0xa0f4('0x1f')][_0xa0f4('0x20')]===0x1f4){logger[_0xa0f4('0x1f')](_0xa0f4('0x21'),_0x2badd2,_0x3b7bd1['error'][_0xa0f4('0x22')]);return _0x5b672e(_0x3b7bd1[_0xa0f4('0x1f')][_0xa0f4('0x22')]);}logger['error'](_0xa0f4('0x21'),_0x2badd2,_0x3b7bd1[_0xa0f4('0x1f')][_0xa0f4('0x22')]);return _0x49886f(_0x3b7bd1[_0xa0f4('0x1f')][_0xa0f4('0x22')]);}else{logger[_0xa0f4('0x1a')]('SugarcrmAccount,\x20%s,\x20%s',_0x2badd2,_0xa0f4('0x1b'));_0x49886f(_0x3b7bd1[_0xa0f4('0x23')][_0xa0f4('0x22')]);}})[_0xa0f4('0x24')](function(_0x2695b5){logger['error'](_0xa0f4('0x21'),_0x2badd2,_0x2695b5);_0x5b672e(_0x2695b5);});});}function respondWithStatusCode(_0x4acce2,_0x249f90){_0x249f90=_0x249f90||0xcc;return function(_0x5b2a6e){if(_0x5b2a6e){return _0x4acce2[_0xa0f4('0x25')](_0x249f90);}return _0x4acce2['status'](_0x249f90)[_0xa0f4('0x26')]();};}function respondWithResult(_0x5c2cf9,_0x405076){_0x405076=_0x405076||0xc8;return function(_0x50ed5c){if(_0x50ed5c){return _0x5c2cf9[_0xa0f4('0x27')](_0x405076)[_0xa0f4('0x28')](_0x50ed5c);}};}function respondWithFilteredResult(_0x26fb5a,_0x113ad7){return function(_0x567cea){if(_0x567cea){var _0x27c573=_0x567cea[_0xa0f4('0x29')],_0x1ac480=_0x113ad7[_0xa0f4('0x2a')],_0x2b9399=_0x113ad7['offset']+_0x113ad7['limit'],_0x3c51a5;if(_0x2b9399>=_0x27c573){_0x2b9399=_0x27c573;_0x3c51a5=0xc8;}else{_0x3c51a5=0xce;}_0x26fb5a[_0xa0f4('0x27')](_0x3c51a5);return _0x26fb5a['set'](_0xa0f4('0x2b'),_0x1ac480+'-'+_0x2b9399+'/'+_0x27c573)['json'](_0x567cea);}return null;};}function patchUpdates(_0x42f72a){return function(_0x26c567){try{jsonpatch['apply'](_0x26c567,_0x42f72a,!![]);}catch(_0x43981e){return BPromise['reject'](_0x43981e);}return _0x26c567[_0xa0f4('0x2c')]();};}function saveUpdates(_0x2747c1,_0x66e8b1){return function(_0xd16a72){if(_0xd16a72){return _0xd16a72['update'](_0x2747c1)[_0xa0f4('0x19')](function(_0x36259c){return _0x36259c;});}return null;};}function removeEntity(_0x4439cb,_0x1e6d32){return function(_0x4e8562){if(_0x4e8562){return _0x4e8562[_0xa0f4('0x2d')]()[_0xa0f4('0x19')](function(){_0x4439cb[_0xa0f4('0x27')](0xcc)[_0xa0f4('0x26')]();});}};}function handleEntityNotFound(_0x17bd2f,_0x869b9){return function(_0x20afb5){if(!_0x20afb5){_0x17bd2f[_0xa0f4('0x25')](0x194);}return _0x20afb5;};}function handleError(_0x2e60bb,_0x5a37fe){_0x5a37fe=_0x5a37fe||0x1f4;return function(_0x3a9558){logger[_0xa0f4('0x1f')](_0x3a9558[_0xa0f4('0x2e')]);if(_0x3a9558[_0xa0f4('0x2f')]){delete _0x3a9558[_0xa0f4('0x2f')];}_0x2e60bb[_0xa0f4('0x27')](_0x5a37fe)['send'](_0x3a9558);};}exports[_0xa0f4('0x30')]=function(_0x581213,_0xb01e51){var _0x2ca6db={},_0x557ebf={},_0x16661b={'count':0x0,'rows':[]};var _0xde2860=db[_0xa0f4('0x31')][_0xa0f4('0x32')];_0x557ebf[_0xa0f4('0x33')]=_[_0xa0f4('0x34')](_0xde2860);var _0x52b154={'dateStart':_0x581213[_0xa0f4('0x35')][_0xa0f4('0x36')],'dateEnd':_0x581213[_0xa0f4('0x35')]['dateEnd']};delete _0x581213['query']['dateStart'];delete _0x581213[_0xa0f4('0x35')][_0xa0f4('0x37')];_0x557ebf['query']=_['keys'](_0x581213[_0xa0f4('0x35')]);_0x557ebf[_0xa0f4('0x38')]=_['intersection'](_0x557ebf['model'],_0x557ebf[_0xa0f4('0x35')]);_0x2ca6db[_0xa0f4('0x39')]=_[_0xa0f4('0x3a')](_0x557ebf['model'],qs[_0xa0f4('0x3b')](_0x581213[_0xa0f4('0x35')][_0xa0f4('0x3b')]));_0x2ca6db[_0xa0f4('0x39')]=_0x2ca6db[_0xa0f4('0x39')][_0xa0f4('0x3c')]?_0x2ca6db['attributes']:_0x557ebf[_0xa0f4('0x33')];if(!_0x581213[_0xa0f4('0x35')][_0xa0f4('0x3d')](_0xa0f4('0x3e'))){_0x2ca6db[_0xa0f4('0x3f')]=qs['limit'](_0x581213[_0xa0f4('0x35')][_0xa0f4('0x3f')]);_0x2ca6db[_0xa0f4('0x2a')]=qs[_0xa0f4('0x2a')](_0x581213[_0xa0f4('0x35')][_0xa0f4('0x2a')]);}_0x2ca6db[_0xa0f4('0x40')]=qs[_0xa0f4('0x41')](_0x581213[_0xa0f4('0x35')][_0xa0f4('0x41')]);_0x2ca6db[_0xa0f4('0x42')]=qs['filters'](_['pick'](_0x581213['query'],_0x557ebf['filters']));if(_0x52b154[_0xa0f4('0x36')]){if(_0x52b154['dateEnd']){_0x52b154[_0xa0f4('0x37')]=moment(_0x52b154[_0xa0f4('0x37')])[_0xa0f4('0x43')](0x1,'day');}else{_0x52b154[_0xa0f4('0x37')]=moment(_0x52b154[_0xa0f4('0x36')])['add'](0x1,'day');}_[_0xa0f4('0x44')](_0x2ca6db[_0xa0f4('0x42')],{'createdAt':{'$gte':_0x52b154[_0xa0f4('0x36')],'$lte':_0x52b154[_0xa0f4('0x37')]}});}if(_0x581213['query'][_0xa0f4('0x45')]){_0x2ca6db[_0xa0f4('0x42')]=_[_0xa0f4('0x44')](_0x2ca6db['where'],{'$or':_[_0xa0f4('0x46')](_0x2ca6db[_0xa0f4('0x39')],function(_0x488280){var _0x282685={};_0x282685[_0x488280]={'$like':'%'+_0x581213[_0xa0f4('0x35')][_0xa0f4('0x45')]+'%'};return _0x282685;})});}_0x2ca6db=_[_0xa0f4('0x44')]({},_0x2ca6db,_0x581213['options']);var _0x43c490={'where':_0x2ca6db['where']};return db['SugarcrmAccount']['count'](_0x43c490)[_0xa0f4('0x19')](function(_0x7e9d5a){_0x16661b[_0xa0f4('0x29')]=_0x7e9d5a;if(_0x581213[_0xa0f4('0x35')][_0xa0f4('0x47')]){_0x2ca6db[_0xa0f4('0x48')]=[{'all':!![]}];}return db[_0xa0f4('0x31')][_0xa0f4('0x49')](_0x2ca6db);})[_0xa0f4('0x19')](function(_0x4f15df){_0x16661b[_0xa0f4('0x4a')]=_0x4f15df;return _0x16661b;})['then'](respondWithFilteredResult(_0xb01e51,_0x2ca6db))['catch'](handleError(_0xb01e51,null));};exports[_0xa0f4('0x4b')]=function(_0x36249f,_0x1ea937){var _0x291ef7={'raw':![],'where':{'id':_0x36249f['params']['id']}},_0x3369bc={};_0x3369bc[_0xa0f4('0x33')]=_[_0xa0f4('0x34')](db[_0xa0f4('0x31')][_0xa0f4('0x32')]);_0x3369bc['query']=_['keys'](_0x36249f['query']);_0x3369bc[_0xa0f4('0x38')]=_[_0xa0f4('0x3a')](_0x3369bc[_0xa0f4('0x33')],_0x3369bc[_0xa0f4('0x35')]);_0x291ef7[_0xa0f4('0x39')]=_['intersection'](_0x3369bc[_0xa0f4('0x33')],qs[_0xa0f4('0x3b')](_0x36249f[_0xa0f4('0x35')][_0xa0f4('0x3b')]));_0x291ef7[_0xa0f4('0x39')]=_0x291ef7[_0xa0f4('0x39')][_0xa0f4('0x3c')]?_0x291ef7[_0xa0f4('0x39')]:_0x3369bc['model'];if(_0x36249f['query'][_0xa0f4('0x47')]){_0x291ef7[_0xa0f4('0x48')]=[{'all':!![]}];}_0x291ef7=_[_0xa0f4('0x44')]({},_0x291ef7,_0x36249f[_0xa0f4('0x4c')]);return db['SugarcrmAccount'][_0xa0f4('0x4d')](_0x291ef7)['then'](handleEntityNotFound(_0x1ea937,null))[_0xa0f4('0x19')](respondWithResult(_0x1ea937,null))['catch'](handleError(_0x1ea937,null));};exports[_0xa0f4('0x4e')]=function(_0x589863,_0x226616){return db[_0xa0f4('0x31')][_0xa0f4('0x4e')](_0x589863[_0xa0f4('0x4f')],{})[_0xa0f4('0x19')](respondWithResult(_0x226616,0xc9))[_0xa0f4('0x24')](handleError(_0x226616,null));};exports['update']=function(_0x43f1ef,_0x122075){if(_0x43f1ef[_0xa0f4('0x4f')]['id']){delete _0x43f1ef[_0xa0f4('0x4f')]['id'];}return db[_0xa0f4('0x31')][_0xa0f4('0x4d')]({'where':{'id':_0x43f1ef[_0xa0f4('0x50')]['id']}})[_0xa0f4('0x19')](handleEntityNotFound(_0x122075,null))[_0xa0f4('0x19')](saveUpdates(_0x43f1ef[_0xa0f4('0x4f')],null))[_0xa0f4('0x19')](respondWithResult(_0x122075,null))[_0xa0f4('0x24')](handleError(_0x122075,null));};exports['destroy']=function(_0x2485ee,_0x3659da){return db[_0xa0f4('0x31')][_0xa0f4('0x4d')]({'where':{'id':_0x2485ee[_0xa0f4('0x50')]['id']}})[_0xa0f4('0x19')](handleEntityNotFound(_0x3659da,null))[_0xa0f4('0x19')](removeEntity(_0x3659da,null))[_0xa0f4('0x24')](handleError(_0x3659da,null));};exports[_0xa0f4('0x51')]=function(_0x56981f,_0x23a1a1,_0x5e7b18){var _0x433e5d={};var _0x3a6714={};var _0x1e584d;var _0xbaaa3;return db[_0xa0f4('0x31')][_0xa0f4('0x52')]({'where':{'id':_0x56981f['params']['id']}})[_0xa0f4('0x19')](handleEntityNotFound(_0x23a1a1,null))[_0xa0f4('0x19')](function(_0x3255f0){if(_0x3255f0){_0x1e584d=_0x3255f0;_0x3a6714[_0xa0f4('0x33')]=_[_0xa0f4('0x34')](db[_0xa0f4('0x53')][_0xa0f4('0x32')]);_0x3a6714['query']=_[_0xa0f4('0x34')](_0x56981f[_0xa0f4('0x35')]);_0x3a6714['filters']=_[_0xa0f4('0x3a')](_0x3a6714[_0xa0f4('0x33')],_0x3a6714[_0xa0f4('0x35')]);_0x433e5d[_0xa0f4('0x39')]=_[_0xa0f4('0x3a')](_0x3a6714['model'],qs[_0xa0f4('0x3b')](_0x56981f[_0xa0f4('0x35')][_0xa0f4('0x3b')]));_0x433e5d[_0xa0f4('0x39')]=_0x433e5d['attributes']['length']?_0x433e5d['attributes']:_0x3a6714[_0xa0f4('0x33')];_0x433e5d[_0xa0f4('0x40')]=qs[_0xa0f4('0x41')](_0x56981f[_0xa0f4('0x35')][_0xa0f4('0x41')]);_0x433e5d[_0xa0f4('0x42')]=qs[_0xa0f4('0x38')](_[_0xa0f4('0x54')](_0x56981f[_0xa0f4('0x35')],_0x3a6714[_0xa0f4('0x38')]));if(_0x56981f[_0xa0f4('0x35')][_0xa0f4('0x45')]){_0x433e5d[_0xa0f4('0x42')]=_[_0xa0f4('0x44')](_0x433e5d[_0xa0f4('0x42')],{'$or':_[_0xa0f4('0x46')](_0x433e5d['attributes'],function(_0x4e80e3){var _0x2368a1={};_0x2368a1[_0x4e80e3]={'$like':'%'+_0x56981f[_0xa0f4('0x35')][_0xa0f4('0x45')]+'%'};return _0x2368a1;})});}_0x433e5d=_[_0xa0f4('0x44')]({},_0x433e5d,_0x56981f[_0xa0f4('0x4c')]);return _0x1e584d[_0xa0f4('0x51')](_0x433e5d);}})[_0xa0f4('0x19')](function(_0x296788){if(_0x296788){_0xbaaa3=_0x296788[_0xa0f4('0x3c')];if(!_0x56981f[_0xa0f4('0x35')][_0xa0f4('0x3d')](_0xa0f4('0x3e'))){_0x433e5d['limit']=qs[_0xa0f4('0x3f')](_0x56981f[_0xa0f4('0x35')][_0xa0f4('0x3f')]);_0x433e5d[_0xa0f4('0x2a')]=qs[_0xa0f4('0x2a')](_0x56981f[_0xa0f4('0x35')][_0xa0f4('0x2a')]);}return _0x1e584d[_0xa0f4('0x51')](_0x433e5d);}})[_0xa0f4('0x19')](function(_0x427efe){if(_0x427efe){return _0x427efe?{'count':_0xbaaa3,'rows':_0x427efe}:null;}})[_0xa0f4('0x19')](respondWithResult(_0x23a1a1,null))[_0xa0f4('0x24')](handleError(_0x23a1a1,null));};exports[_0xa0f4('0x55')]=function(_0x126fe7,_0x117b6b,_0x4e806f){if(_0x126fe7['body']['id']){delete _0x126fe7[_0xa0f4('0x4f')]['id'];}return db[_0xa0f4('0x31')][_0xa0f4('0x52')]({'where':{'id':_0x126fe7['params']['id']}})[_0xa0f4('0x19')](handleEntityNotFound(_0x117b6b,null))['then'](function(_0x2092c5){if(_0x2092c5){_0x126fe7['body'][_0xa0f4('0x56')]=_0x2092c5['id'];_0x126fe7[_0xa0f4('0x4f')][_0xa0f4('0x57')]=integrations[_0xa0f4('0x58')](_0x126fe7[_0xa0f4('0x4f')][_0xa0f4('0x59')],_0x126fe7[_0xa0f4('0x4f')]['type']);_0x126fe7[_0xa0f4('0x4f')][_0xa0f4('0x5a')]=integrations[_0xa0f4('0x5b')](_0x126fe7[_0xa0f4('0x4f')][_0xa0f4('0x59')],_0x126fe7[_0xa0f4('0x4f')][_0xa0f4('0x5c')]);return db[_0xa0f4('0x53')][_0xa0f4('0x4e')](_0x126fe7[_0xa0f4('0x4f')],{'include':[{'model':db[_0xa0f4('0x5d')],'as':_0xa0f4('0x57')},{'model':db[_0xa0f4('0x5d')],'as':'Descriptions'}]});}return null;})[_0xa0f4('0x19')](respondWithResult(_0x117b6b,null))[_0xa0f4('0x24')](handleError(_0x117b6b,null));};exports[_0xa0f4('0x5e')]=function(_0x41df08,_0x233495,_0x5aec43){var _0x3b686b;return db['SugarcrmAccount'][_0xa0f4('0x52')]({'where':{'id':_0x41df08[_0xa0f4('0x50')]['id']},'attributes':['id',_0xa0f4('0x5f'),_0xa0f4('0x60'),_0xa0f4('0x61')]})[_0xa0f4('0x19')](handleEntityNotFound(_0x233495,null))[_0xa0f4('0x19')](function(_0x5e0c19){if(_0x5e0c19){_0x3b686b=_0x5e0c19[_0xa0f4('0x61')];return rp({'method':'POST','uri':util[_0xa0f4('0x62')](_0xa0f4('0x63'),_0x3b686b,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xa0f4('0x64'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xa0f4('0x1e')]({'user_auth':{'user_name':_0x5e0c19[_0xa0f4('0x5f')],'password':_0x5e0c19[_0xa0f4('0x60')],'encryption':_0xa0f4('0x65')},'application':_0xa0f4('0x66')})}});}})[_0xa0f4('0x19')](function(_0x38073b){if(_0x38073b){return rp({'method':_0xa0f4('0x67'),'uri':util[_0xa0f4('0x62')]('%s%s',_0x3b686b,_0xa0f4('0x68')),'json':!![],'form':{'method':_0xa0f4('0x69'),'input_type':_0xa0f4('0x6a'),'response_type':_0xa0f4('0x6a'),'rest_data':JSON[_0xa0f4('0x1e')]({'session':_0x38073b['id'],'module_name':_0xa0f4('0x6b')})}});}})[_0xa0f4('0x19')](function(_0x155661){if(_0x155661){var _0x1d8dfb=_[_0xa0f4('0x6c')](_0x155661[_0xa0f4('0x6d')]);return{'count':_0x1d8dfb[_0xa0f4('0x3c')],'rows':_[_0xa0f4('0x46')](_0x1d8dfb,function(_0x2495c7){return{'id':_0x2495c7['name'],'name':_0x2495c7['label'],'custom':_[_0xa0f4('0x6e')](_0x2495c7[_0xa0f4('0x2f')],'_c')?!![]:![],'options':_0x2495c7[_0xa0f4('0x4c')]?_['map'](_[_0xa0f4('0x6c')](_0x2495c7['options']),function(_0x22c914){return{'name':_0x22c914[_0xa0f4('0x6f')],'value':_0x22c914['name']};}):[]};})};}})['then'](respondWithResult(_0x233495,null))[_0xa0f4('0x24')](function(_0x229988){var _0x2ad6dd=_0x41df08[_0xa0f4('0x35')][_0xa0f4('0x70')]?0x1f4:_0x229988[_0xa0f4('0x71')]||0x1f4;logger[_0xa0f4('0x1f')]('getFields,\x20%s,\x20%s,\x20%s',_0xa0f4('0x5e'),_0x2ad6dd,JSON[_0xa0f4('0x1e')](_0x229988));delete _0x229988[_0xa0f4('0x2f')];if(_0x2ad6dd===0x191){_0x2ad6dd=0x190;}_0x233495['status'](_0x2ad6dd)[_0xa0f4('0x72')](_0x41df08[_0xa0f4('0x35')]['test']?{'message':_0xa0f4('0x73'),'statusCode':_0x229988['statusCode']}:_0x229988);});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 51481e7..f79cb6c 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 _0xf9fa=['moment','./intSugarcrmAccount.attributes','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','api'];(function(_0x31018c,_0x375aa0){var _0x5147e7=function(_0xc861e3){while(--_0xc861e3){_0x31018c['push'](_0x31018c['shift']());}};_0x5147e7(++_0x375aa0);}(_0xf9fa,0xd5));var _0xaf9f=function(_0x41b30c,_0x3074c2){_0x41b30c=_0x41b30c-0x0;var _0x5c8549=_0xf9fa[_0x41b30c];return _0x5c8549;};'use strict';var _=require(_0xaf9f('0x0'));var util=require('util');var logger=require(_0xaf9f('0x1'))(_0xaf9f('0x2'));var moment=require(_0xaf9f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xaf9f('0x4'));var integrations=require('../../components/integrations/configuration');module[_0xaf9f('0x5')]=function(_0x48d367,_0x2e117b){return _0x48d367['define'](_0xaf9f('0x6'),attributes,{'tableName':_0xaf9f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x45ce=['util','../../config/logger','api','moment','bluebird','request-promise','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','lodash'];(function(_0x172ed7,_0x3d08fd){var _0xfa8f61=function(_0xe07a21){while(--_0xe07a21){_0x172ed7['push'](_0x172ed7['shift']());}};_0xfa8f61(++_0x3d08fd);}(_0x45ce,0xfc));var _0xe45c=function(_0x397116,_0xbd0d0){_0x397116=_0x397116-0x0;var _0x3f9b9a=_0x45ce[_0x397116];return _0x3f9b9a;};'use strict';var _=require(_0xe45c('0x0'));var util=require(_0xe45c('0x1'));var logger=require(_0xe45c('0x2'))(_0xe45c('0x3'));var moment=require(_0xe45c('0x4'));var BPromise=require(_0xe45c('0x5'));var rp=require(_0xe45c('0x6'));var attributes=require(_0xe45c('0x7'));var integrations=require(_0xe45c('0x8'));module[_0xe45c('0x9')]=function(_0x428961,_0x2961d4){return _0x428961[_0xe45c('0xa')]('SugarcrmAccount',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 e17f2ab..ec9425e 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 _0x1d9c=['attributes','limit','include','map','model','GetSugarcrmAccount','ShowSugarcrmAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SugarcrmAccount','findAll','options','raw','where'];(function(_0x7b502,_0x3750c0){var _0xe0ae05=function(_0x41b076){while(--_0x41b076){_0x7b502['push'](_0x7b502['shift']());}};_0xe0ae05(++_0x3750c0);}(_0x1d9c,0x104));var _0xc1d9=function(_0x40643f,_0x5d13d8){_0x40643f=_0x40643f-0x0;var _0x352f35=_0x1d9c[_0x40643f];return _0x352f35;};'use strict';var _=require('lodash');var util=require(_0xc1d9('0x0'));var moment=require(_0xc1d9('0x1'));var BPromise=require(_0xc1d9('0x2'));var rs=require(_0xc1d9('0x3'));var fs=require('fs');var Redis=require(_0xc1d9('0x4'));var db=require(_0xc1d9('0x5'))['db'];var utils=require(_0xc1d9('0x6'));var logger=require(_0xc1d9('0x7'))('rpc');var config=require(_0xc1d9('0x8'));var jayson=require(_0xc1d9('0x9'));var client=jayson['client'][_0xc1d9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57bbff,_0x1114ef,_0x30e3bd){return new BPromise(function(_0x403eec,_0x4a0f10){return client['request'](_0x57bbff,_0x30e3bd)[_0xc1d9('0xb')](function(_0x124c2a){logger[_0xc1d9('0xc')](_0xc1d9('0xd'),_0x1114ef,'request\x20sent');logger[_0xc1d9('0xe')](_0xc1d9('0xf'),_0x1114ef,_0xc1d9('0x10'),JSON[_0xc1d9('0x11')](_0x124c2a));if(_0x124c2a['error']){if(_0x124c2a[_0xc1d9('0x12')][_0xc1d9('0x13')]===0x1f4){logger[_0xc1d9('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x1114ef,_0x124c2a['error']['message']);return _0x4a0f10(_0x124c2a[_0xc1d9('0x12')][_0xc1d9('0x14')]);}logger[_0xc1d9('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x1114ef,_0x124c2a[_0xc1d9('0x12')][_0xc1d9('0x14')]);return _0x403eec(_0x124c2a[_0xc1d9('0x12')][_0xc1d9('0x14')]);}else{logger['info'](_0xc1d9('0xd'),_0x1114ef,_0xc1d9('0x10'));_0x403eec(_0x124c2a[_0xc1d9('0x15')][_0xc1d9('0x14')]);}})[_0xc1d9('0x16')](function(_0x4da3d9){logger['error'](_0xc1d9('0xd'),_0x1114ef,_0x4da3d9);_0x4a0f10(_0x4da3d9);});});}exports['GetSugarcrmAccount']=function(_0x32f61d){var _0x4212a6=this;return new Promise(function(_0x405369,_0x585d56){return db[_0xc1d9('0x17')][_0xc1d9('0x18')]({'raw':_0x32f61d[_0xc1d9('0x19')]?_0x32f61d['options'][_0xc1d9('0x1a')]===undefined?!![]:![]:!![],'where':_0x32f61d[_0xc1d9('0x19')]?_0x32f61d[_0xc1d9('0x19')][_0xc1d9('0x1b')]||null:null,'attributes':_0x32f61d['options']?_0x32f61d[_0xc1d9('0x19')][_0xc1d9('0x1c')]||null:null,'limit':_0x32f61d['options']?_0x32f61d[_0xc1d9('0x19')][_0xc1d9('0x1d')]||null:null,'include':_0x32f61d[_0xc1d9('0x19')]?_0x32f61d[_0xc1d9('0x19')][_0xc1d9('0x1e')]?_[_0xc1d9('0x1f')](_0x32f61d[_0xc1d9('0x19')][_0xc1d9('0x1e')],function(_0x512767){return{'model':db[_0x512767[_0xc1d9('0x20')]],'as':_0x512767['as'],'attributes':_0x512767['attributes'],'include':_0x512767['include']?_[_0xc1d9('0x1f')](_0x512767[_0xc1d9('0x1e')],function(_0x3c1fab){return{'model':db[_0x3c1fab[_0xc1d9('0x20')]],'as':_0x3c1fab['as'],'attributes':_0x3c1fab[_0xc1d9('0x1c')],'include':_0x3c1fab[_0xc1d9('0x1e')]?_['map'](_0x3c1fab[_0xc1d9('0x1e')],function(_0x258e3e){return{'model':db[_0x258e3e[_0xc1d9('0x20')]],'as':_0x258e3e['as'],'attributes':_0x258e3e[_0xc1d9('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc1d9('0xb')](function(_0x3cfa57){logger['info'](_0xc1d9('0x21'),_0x32f61d);logger[_0xc1d9('0xe')](_0xc1d9('0x21'),_0x32f61d,JSON['stringify'](_0x3cfa57));_0x405369(_0x3cfa57);})['catch'](function(_0x1a1271){logger[_0xc1d9('0x12')](_0xc1d9('0x21'),_0x1a1271[_0xc1d9('0x14')],_0x32f61d);_0x585d56(_0x4212a6[_0xc1d9('0x12')](0x1f4,_0x1a1271['message']));});});};exports[_0xc1d9('0x22')]=function(_0x4acb90){var _0x47cdd4=this;return new Promise(function(_0xa3bd2c,_0x100eed){return db[_0xc1d9('0x17')][_0xc1d9('0x23')]({'raw':_0x4acb90[_0xc1d9('0x19')]?_0x4acb90['options'][_0xc1d9('0x1a')]===undefined?!![]:![]:!![],'where':_0x4acb90['options']?_0x4acb90['options'][_0xc1d9('0x1b')]||null:null,'attributes':_0x4acb90[_0xc1d9('0x19')]?_0x4acb90[_0xc1d9('0x19')][_0xc1d9('0x1c')]||null:null,'include':_0x4acb90[_0xc1d9('0x19')]?_0x4acb90[_0xc1d9('0x19')][_0xc1d9('0x1e')]?_[_0xc1d9('0x1f')](_0x4acb90[_0xc1d9('0x19')][_0xc1d9('0x1e')],function(_0x805f9b){return{'model':db[_0x805f9b['model']],'as':_0x805f9b['as'],'attributes':_0x805f9b[_0xc1d9('0x1c')],'include':_0x805f9b['include']?_[_0xc1d9('0x1f')](_0x805f9b[_0xc1d9('0x1e')],function(_0x54a5d5){return{'model':db[_0x54a5d5[_0xc1d9('0x20')]],'as':_0x54a5d5['as'],'attributes':_0x54a5d5[_0xc1d9('0x1c')],'include':_0x54a5d5[_0xc1d9('0x1e')]?_[_0xc1d9('0x1f')](_0x54a5d5[_0xc1d9('0x1e')],function(_0xa16655){return{'model':db[_0xa16655['model']],'as':_0xa16655['as'],'attributes':_0xa16655['attributes']};}):[]};}):[]};}):[]:[]})[_0xc1d9('0xb')](function(_0x197247){logger[_0xc1d9('0xc')](_0xc1d9('0x22'),_0x4acb90);logger[_0xc1d9('0xe')](_0xc1d9('0x22'),_0x4acb90,JSON[_0xc1d9('0x11')](_0x197247));_0xa3bd2c(_0x197247);})[_0xc1d9('0x16')](function(_0x2b81fb){logger[_0xc1d9('0x12')](_0xc1d9('0x22'),_0x2b81fb['message'],_0x4acb90);_0x100eed(_0x47cdd4[_0xc1d9('0x12')](0x1f4,_0x2b81fb['message']));});});}; \ No newline at end of file +var _0x7828=['jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','SugarcrmAccount','findAll','options','raw','where','attributes','map','include','model','GetSugarcrmAccount','ShowSugarcrmAccount','lodash','moment','bluebird','ioredis','../../config/logger','../../config/environment'];(function(_0x1c76a2,_0x2bb5b8){var _0x24b0ae=function(_0x39819d){while(--_0x39819d){_0x1c76a2['push'](_0x1c76a2['shift']());}};_0x24b0ae(++_0x2bb5b8);}(_0x7828,0x18d));var _0x8782=function(_0x22130b,_0x519b2c){_0x22130b=_0x22130b-0x0;var _0x47f7cb=_0x7828[_0x22130b];return _0x47f7cb;};'use strict';var _=require(_0x8782('0x0'));var util=require('util');var moment=require(_0x8782('0x1'));var BPromise=require(_0x8782('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8782('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8782('0x4'))('rpc');var config=require(_0x8782('0x5'));var jayson=require(_0x8782('0x6'));var client=jayson[_0x8782('0x7')][_0x8782('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x329ee3,_0x159892,_0x2bf20f){return new BPromise(function(_0x51a7e5,_0x1e2b31){return client[_0x8782('0x9')](_0x329ee3,_0x2bf20f)[_0x8782('0xa')](function(_0x5843f7){logger[_0x8782('0xb')](_0x8782('0xc'),_0x159892,'request\x20sent');logger[_0x8782('0xd')](_0x8782('0xe'),_0x159892,'request\x20sent',JSON[_0x8782('0xf')](_0x5843f7));if(_0x5843f7[_0x8782('0x10')]){if(_0x5843f7['error'][_0x8782('0x11')]===0x1f4){logger[_0x8782('0x10')](_0x8782('0xc'),_0x159892,_0x5843f7[_0x8782('0x10')]['message']);return _0x1e2b31(_0x5843f7['error'][_0x8782('0x12')]);}logger[_0x8782('0x10')](_0x8782('0xc'),_0x159892,_0x5843f7['error'][_0x8782('0x12')]);return _0x51a7e5(_0x5843f7['error'][_0x8782('0x12')]);}else{logger[_0x8782('0xb')](_0x8782('0xc'),_0x159892,'request\x20sent');_0x51a7e5(_0x5843f7['result']['message']);}})[_0x8782('0x13')](function(_0x4e986f){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x159892,_0x4e986f);_0x1e2b31(_0x4e986f);});});}exports['GetSugarcrmAccount']=function(_0x3b9f9f){var _0x3e90ae=this;return new Promise(function(_0x4e0fec,_0x9be53f){return db[_0x8782('0x14')][_0x8782('0x15')]({'raw':_0x3b9f9f[_0x8782('0x16')]?_0x3b9f9f[_0x8782('0x16')][_0x8782('0x17')]===undefined?!![]:![]:!![],'where':_0x3b9f9f[_0x8782('0x16')]?_0x3b9f9f[_0x8782('0x16')][_0x8782('0x18')]||null:null,'attributes':_0x3b9f9f[_0x8782('0x16')]?_0x3b9f9f[_0x8782('0x16')][_0x8782('0x19')]||null:null,'limit':_0x3b9f9f[_0x8782('0x16')]?_0x3b9f9f['options']['limit']||null:null,'include':_0x3b9f9f['options']?_0x3b9f9f[_0x8782('0x16')]['include']?_[_0x8782('0x1a')](_0x3b9f9f[_0x8782('0x16')][_0x8782('0x1b')],function(_0x55f097){return{'model':db[_0x55f097[_0x8782('0x1c')]],'as':_0x55f097['as'],'attributes':_0x55f097[_0x8782('0x19')],'include':_0x55f097[_0x8782('0x1b')]?_[_0x8782('0x1a')](_0x55f097['include'],function(_0x48747e){return{'model':db[_0x48747e['model']],'as':_0x48747e['as'],'attributes':_0x48747e['attributes'],'include':_0x48747e[_0x8782('0x1b')]?_[_0x8782('0x1a')](_0x48747e[_0x8782('0x1b')],function(_0x456a78){return{'model':db[_0x456a78[_0x8782('0x1c')]],'as':_0x456a78['as'],'attributes':_0x456a78[_0x8782('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8782('0xa')](function(_0x253ceb){logger['info'](_0x8782('0x1d'),_0x3b9f9f);logger[_0x8782('0xd')](_0x8782('0x1d'),_0x3b9f9f,JSON[_0x8782('0xf')](_0x253ceb));_0x4e0fec(_0x253ceb);})['catch'](function(_0x54dd96){logger[_0x8782('0x10')](_0x8782('0x1d'),_0x54dd96[_0x8782('0x12')],_0x3b9f9f);_0x9be53f(_0x3e90ae[_0x8782('0x10')](0x1f4,_0x54dd96['message']));});});};exports[_0x8782('0x1e')]=function(_0x24cab4){var _0xb32033=this;return new Promise(function(_0x49bf9a,_0x1e0819){return db[_0x8782('0x14')]['find']({'raw':_0x24cab4[_0x8782('0x16')]?_0x24cab4['options'][_0x8782('0x17')]===undefined?!![]:![]:!![],'where':_0x24cab4['options']?_0x24cab4[_0x8782('0x16')][_0x8782('0x18')]||null:null,'attributes':_0x24cab4[_0x8782('0x16')]?_0x24cab4[_0x8782('0x16')][_0x8782('0x19')]||null:null,'include':_0x24cab4[_0x8782('0x16')]?_0x24cab4['options'][_0x8782('0x1b')]?_[_0x8782('0x1a')](_0x24cab4[_0x8782('0x16')][_0x8782('0x1b')],function(_0x311f8e){return{'model':db[_0x311f8e[_0x8782('0x1c')]],'as':_0x311f8e['as'],'attributes':_0x311f8e[_0x8782('0x19')],'include':_0x311f8e[_0x8782('0x1b')]?_[_0x8782('0x1a')](_0x311f8e[_0x8782('0x1b')],function(_0x255ef9){return{'model':db[_0x255ef9[_0x8782('0x1c')]],'as':_0x255ef9['as'],'attributes':_0x255ef9[_0x8782('0x19')],'include':_0x255ef9[_0x8782('0x1b')]?_['map'](_0x255ef9['include'],function(_0x101779){return{'model':db[_0x101779['model']],'as':_0x101779['as'],'attributes':_0x101779[_0x8782('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2bdc3a){logger[_0x8782('0xb')](_0x8782('0x1e'),_0x24cab4);logger[_0x8782('0xd')](_0x8782('0x1e'),_0x24cab4,JSON[_0x8782('0xf')](_0x2bdc3a));_0x49bf9a(_0x2bdc3a);})[_0x8782('0x13')](function(_0x41551a){logger['error'](_0x8782('0x1e'),_0x41551a['message'],_0x24cab4);_0x1e0819(_0xb32033['error'](0x1f4,_0x41551a['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 5eed905..436dae7 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 _0xf6a9=['get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','put','update','delete','destroy','exports','path','express','Router','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller'];(function(_0x3b3a16,_0x1e0eee){var _0x45fc8a=function(_0x112aa8){while(--_0x112aa8){_0x3b3a16['push'](_0x3b3a16['shift']());}};_0x45fc8a(++_0x1e0eee);}(_0xf6a9,0x176));var _0x9f6a=function(_0x4a73d9,_0x1eb6e0){_0x4a73d9=_0x4a73d9-0x0;var _0x58e0fd=_0xf6a9[_0x4a73d9];return _0x58e0fd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9f6a('0x0'));var timeout=require('connect-timeout');var express=require(_0x9f6a('0x1'));var router=express[_0x9f6a('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x9f6a('0x3'));var config=require(_0x9f6a('0x4'));var controller=require(_0x9f6a('0x5'));router[_0x9f6a('0x6')]('/',auth[_0x9f6a('0x7')](),controller[_0x9f6a('0x8')]);router['get'](_0x9f6a('0x9'),auth[_0x9f6a('0x7')](),controller[_0x9f6a('0xa')]);router[_0x9f6a('0x6')](_0x9f6a('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0x9f6a('0x6')](_0x9f6a('0xc'),auth['isAuthenticated'](),controller[_0x9f6a('0xd')]);router['get']('/:id/descriptions',auth[_0x9f6a('0x7')](),controller[_0x9f6a('0xe')]);router['post']('/',auth[_0x9f6a('0x7')](),controller['create']);router[_0x9f6a('0xf')](_0x9f6a('0x9'),auth[_0x9f6a('0x7')](),controller[_0x9f6a('0x10')]);router[_0x9f6a('0x11')](_0x9f6a('0x9'),auth['isAuthenticated'](),controller[_0x9f6a('0x12')]);module[_0x9f6a('0x13')]=router; \ No newline at end of file +var _0xaa4a=['../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x4cb22d,_0x37c46e){var _0x216bdd=function(_0x307bfd){while(--_0x307bfd){_0x4cb22d['push'](_0x4cb22d['shift']());}};_0x216bdd(++_0x37c46e);}(_0xaa4a,0x9b));var _0xaaa4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaa4a[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xaaa4('0x0'));var util=require(_0xaaa4('0x1'));var path=require(_0xaaa4('0x2'));var timeout=require(_0xaaa4('0x3'));var express=require(_0xaaa4('0x4'));var router=express[_0xaaa4('0x5')]();var auth=require(_0xaaa4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xaaa4('0x7'));var controller=require(_0xaaa4('0x8'));router[_0xaaa4('0x9')]('/',auth['isAuthenticated'](),controller[_0xaaa4('0xa')]);router[_0xaaa4('0x9')](_0xaaa4('0xb'),auth[_0xaaa4('0xc')](),controller[_0xaaa4('0xd')]);router['get'](_0xaaa4('0xe'),auth[_0xaaa4('0xc')](),controller[_0xaaa4('0xf')]);router[_0xaaa4('0x9')](_0xaaa4('0x10'),auth[_0xaaa4('0xc')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0xaaa4('0xc')](),controller['getDescriptions']);router[_0xaaa4('0x11')]('/',auth[_0xaaa4('0xc')](),controller[_0xaaa4('0x12')]);router[_0xaaa4('0x13')]('/:id',auth[_0xaaa4('0xc')](),controller[_0xaaa4('0x14')]);router[_0xaaa4('0x15')]('/:id',auth[_0xaaa4('0xc')](),controller[_0xaaa4('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 81aff70..c46045e 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 _0xcff5=['STRING','sequelize'];(function(_0x576266,_0x4002b0){var _0x18234f=function(_0x4e9ad5){while(--_0x4e9ad5){_0x576266['push'](_0x576266['shift']());}};_0x18234f(++_0x4002b0);}(_0xcff5,0x1f1));var _0x5cff=function(_0x4a5f95,_0x1553d3){_0x4a5f95=_0x4a5f95-0x0;var _0x4dcfa5=_0xcff5[_0x4a5f95];return _0x4dcfa5;};'use strict';var Sequelize=require(_0x5cff('0x0'));module['exports']={'name':{'type':Sequelize[_0x5cff('0x1')]},'description':{'type':Sequelize[_0x5cff('0x1')]}}; \ No newline at end of file +var _0xe111=['sequelize','STRING'];(function(_0x5e8c38,_0x455b27){var _0x456a71=function(_0x174d86){while(--_0x174d86){_0x5e8c38['push'](_0x5e8c38['shift']());}};_0x456a71(++_0x455b27);}(_0xe111,0x1a6));var _0x1e11=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe111[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1e11('0x0'));module['exports']={'name':{'type':Sequelize[_0x1e11('0x1')]},'description':{'type':Sequelize[_0x1e11('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index fce6a1a..920a6fa 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 _0x8351=['catch','sendStatus','end','status','json','count','offset','set','apply','reject','save','update','stack','name','send','index','SugarcrmConfiguration','rawAttributes','model','keys','dateStart','dateEnd','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','add','day','merge','where','map','filter','options','includeAll','include','findAll','rows','show','find','create','body','params','destroy','getFields','SugarcrmField','pick','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x9ec45c,_0x2a2443){var _0x369ff7=function(_0x5438d7){while(--_0x5438d7){_0x9ec45c['push'](_0x9ec45c['shift']());}};_0x369ff7(++_0x2a2443);}(_0x8351,0x8f));var _0x1835=function(_0x5763cf,_0x2761d1){_0x5763cf=_0x5763cf-0x0;var _0x4410fb=_0x8351[_0x5763cf];return _0x4410fb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1835('0x0'));var rimraf=require(_0x1835('0x1'));var zipdir=require(_0x1835('0x2'));var jsonpatch=require(_0x1835('0x3'));var rp=require(_0x1835('0x4'));var moment=require('moment');var BPromise=require(_0x1835('0x5'));var Mustache=require(_0x1835('0x6'));var util=require(_0x1835('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x1835('0x8'));var ejs=require(_0x1835('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1835('0xa'));var crypto=require(_0x1835('0xb'));var jsforce=require(_0x1835('0xc'));var deskjs=require(_0x1835('0xd'));var toCsv=require(_0x1835('0x8'));var querystring=require(_0x1835('0xe'));var Papa=require(_0x1835('0xf'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x1835('0x10'))('api');var utils=require(_0x1835('0x11'));var config=require(_0x1835('0x12'));var db=require(_0x1835('0x13'))['db'];var jayson=require(_0x1835('0x14'));var client=jayson[_0x1835('0x15')][_0x1835('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x168494,_0x3e3a10,_0x4f2ef2,_0x443462){return new BPromise(function(_0x320604,_0x5a8e04){var _0x5bc7f6=_0x443462||client;return _0x5bc7f6[_0x1835('0x17')](_0x168494,_0x4f2ef2)[_0x1835('0x18')](function(_0x1a4e6f){logger[_0x1835('0x19')](_0x1835('0x1a'),_0x3e3a10,_0x1835('0x1b'));logger[_0x1835('0x1c')](_0x1835('0x1d'),_0x3e3a10,_0x1835('0x1b'),JSON[_0x1835('0x1e')](_0x1a4e6f));if(_0x1a4e6f[_0x1835('0x1f')]){if(_0x1a4e6f[_0x1835('0x1f')]['code']===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x3e3a10,_0x1a4e6f[_0x1835('0x1f')][_0x1835('0x20')]);return _0x5a8e04(_0x1a4e6f[_0x1835('0x1f')][_0x1835('0x20')]);}logger[_0x1835('0x1f')](_0x1835('0x1a'),_0x3e3a10,_0x1a4e6f[_0x1835('0x1f')][_0x1835('0x20')]);return _0x320604(_0x1a4e6f[_0x1835('0x1f')][_0x1835('0x20')]);}else{logger[_0x1835('0x19')](_0x1835('0x1a'),_0x3e3a10,_0x1835('0x1b'));_0x320604(_0x1a4e6f['result']['message']);}})[_0x1835('0x21')](function(_0x2a790b){logger[_0x1835('0x1f')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3e3a10,_0x2a790b);_0x5a8e04(_0x2a790b);});});}function respondWithStatusCode(_0xd69cfb,_0x250c33){_0x250c33=_0x250c33||0xcc;return function(_0x36130e){if(_0x36130e){return _0xd69cfb[_0x1835('0x22')](_0x250c33);}return _0xd69cfb['status'](_0x250c33)[_0x1835('0x23')]();};}function respondWithResult(_0x272c9a,_0xc4dbd1){_0xc4dbd1=_0xc4dbd1||0xc8;return function(_0x17ab80){if(_0x17ab80){return _0x272c9a[_0x1835('0x24')](_0xc4dbd1)[_0x1835('0x25')](_0x17ab80);}};}function respondWithFilteredResult(_0x25b169,_0x1b750f){return function(_0x2f06){if(_0x2f06){var _0x69a59f=_0x2f06[_0x1835('0x26')],_0x3b97d8=_0x1b750f[_0x1835('0x27')],_0x58b377=_0x1b750f['offset']+_0x1b750f['limit'],_0x3ca78c;if(_0x58b377>=_0x69a59f){_0x58b377=_0x69a59f;_0x3ca78c=0xc8;}else{_0x3ca78c=0xce;}_0x25b169['status'](_0x3ca78c);return _0x25b169[_0x1835('0x28')]('Content-Range',_0x3b97d8+'-'+_0x58b377+'/'+_0x69a59f)[_0x1835('0x25')](_0x2f06);}return null;};}function patchUpdates(_0x5354f8){return function(_0x39dfed){try{jsonpatch[_0x1835('0x29')](_0x39dfed,_0x5354f8,!![]);}catch(_0x594546){return BPromise[_0x1835('0x2a')](_0x594546);}return _0x39dfed[_0x1835('0x2b')]();};}function saveUpdates(_0x23b9ca,_0x525acb){return function(_0x5bf2a9){if(_0x5bf2a9){return _0x5bf2a9[_0x1835('0x2c')](_0x23b9ca)[_0x1835('0x18')](function(_0x455d8a){return _0x455d8a;});}return null;};}function removeEntity(_0x2cf04d,_0x2fcd37){return function(_0x1949fa){if(_0x1949fa){return _0x1949fa['destroy']()[_0x1835('0x18')](function(){_0x2cf04d['status'](0xcc)[_0x1835('0x23')]();});}};}function handleEntityNotFound(_0x78fb2c,_0x197236){return function(_0x6264bf){if(!_0x6264bf){_0x78fb2c['sendStatus'](0x194);}return _0x6264bf;};}function handleError(_0x46a61a,_0x189cd1){_0x189cd1=_0x189cd1||0x1f4;return function(_0x3d7800){logger[_0x1835('0x1f')](_0x3d7800[_0x1835('0x2d')]);if(_0x3d7800[_0x1835('0x2e')]){delete _0x3d7800[_0x1835('0x2e')];}_0x46a61a[_0x1835('0x24')](_0x189cd1)[_0x1835('0x2f')](_0x3d7800);};}exports[_0x1835('0x30')]=function(_0x426f61,_0x2169b6){var _0x3afa60={},_0x4ea9f6={},_0x7f63bf={'count':0x0,'rows':[]};var _0x9072f4=db[_0x1835('0x31')][_0x1835('0x32')];_0x4ea9f6[_0x1835('0x33')]=_[_0x1835('0x34')](_0x9072f4);var _0x1c2342={'dateStart':_0x426f61['query'][_0x1835('0x35')],'dateEnd':_0x426f61['query'][_0x1835('0x36')]};delete _0x426f61[_0x1835('0x37')][_0x1835('0x35')];delete _0x426f61[_0x1835('0x37')][_0x1835('0x36')];_0x4ea9f6[_0x1835('0x37')]=_[_0x1835('0x34')](_0x426f61[_0x1835('0x37')]);_0x4ea9f6[_0x1835('0x38')]=_[_0x1835('0x39')](_0x4ea9f6['model'],_0x4ea9f6['query']);_0x3afa60[_0x1835('0x3a')]=_[_0x1835('0x39')](_0x4ea9f6[_0x1835('0x33')],qs[_0x1835('0x3b')](_0x426f61[_0x1835('0x37')]['fields']));_0x3afa60[_0x1835('0x3a')]=_0x3afa60[_0x1835('0x3a')][_0x1835('0x3c')]?_0x3afa60[_0x1835('0x3a')]:_0x4ea9f6['model'];if(!_0x426f61[_0x1835('0x37')][_0x1835('0x3d')]('nolimit')){_0x3afa60[_0x1835('0x3e')]=qs[_0x1835('0x3e')](_0x426f61[_0x1835('0x37')]['limit']);_0x3afa60[_0x1835('0x27')]=qs[_0x1835('0x27')](_0x426f61[_0x1835('0x37')][_0x1835('0x27')]);}_0x3afa60[_0x1835('0x3f')]=qs['sort'](_0x426f61[_0x1835('0x37')][_0x1835('0x40')]);_0x3afa60['where']=qs[_0x1835('0x38')](_['pick'](_0x426f61[_0x1835('0x37')],_0x4ea9f6[_0x1835('0x38')]));if(_0x1c2342['dateStart']){if(_0x1c2342[_0x1835('0x36')]){_0x1c2342['dateEnd']=moment(_0x1c2342['dateEnd'])[_0x1835('0x41')](0x1,'day');}else{_0x1c2342[_0x1835('0x36')]=moment(_0x1c2342[_0x1835('0x35')])['add'](0x1,_0x1835('0x42'));}_[_0x1835('0x43')](_0x3afa60['where'],{'createdAt':{'$gte':_0x1c2342[_0x1835('0x35')],'$lte':_0x1c2342[_0x1835('0x36')]}});}if(_0x426f61[_0x1835('0x37')]['filter']){_0x3afa60[_0x1835('0x44')]=_[_0x1835('0x43')](_0x3afa60[_0x1835('0x44')],{'$or':_[_0x1835('0x45')](_0x3afa60[_0x1835('0x3a')],function(_0x3afe1a){var _0x4e6a7e={};_0x4e6a7e[_0x3afe1a]={'$like':'%'+_0x426f61['query'][_0x1835('0x46')]+'%'};return _0x4e6a7e;})});}_0x3afa60=_[_0x1835('0x43')]({},_0x3afa60,_0x426f61[_0x1835('0x47')]);var _0x5de677={'where':_0x3afa60[_0x1835('0x44')]};return db[_0x1835('0x31')][_0x1835('0x26')](_0x5de677)[_0x1835('0x18')](function(_0x42a6c2){_0x7f63bf[_0x1835('0x26')]=_0x42a6c2;if(_0x426f61[_0x1835('0x37')][_0x1835('0x48')]){_0x3afa60[_0x1835('0x49')]=[{'all':!![]}];}return db[_0x1835('0x31')][_0x1835('0x4a')](_0x3afa60);})[_0x1835('0x18')](function(_0x26d2dd){_0x7f63bf[_0x1835('0x4b')]=_0x26d2dd;return _0x7f63bf;})[_0x1835('0x18')](respondWithFilteredResult(_0x2169b6,_0x3afa60))[_0x1835('0x21')](handleError(_0x2169b6,null));};exports[_0x1835('0x4c')]=function(_0x1383ff,_0x43f5be){var _0x53effd={'raw':![],'where':{'id':_0x1383ff['params']['id']}},_0x96653c={};_0x96653c['model']=_['keys'](db[_0x1835('0x31')][_0x1835('0x32')]);_0x96653c[_0x1835('0x37')]=_['keys'](_0x1383ff[_0x1835('0x37')]);_0x96653c['filters']=_[_0x1835('0x39')](_0x96653c[_0x1835('0x33')],_0x96653c[_0x1835('0x37')]);_0x53effd[_0x1835('0x3a')]=_[_0x1835('0x39')](_0x96653c[_0x1835('0x33')],qs[_0x1835('0x3b')](_0x1383ff['query'][_0x1835('0x3b')]));_0x53effd[_0x1835('0x3a')]=_0x53effd[_0x1835('0x3a')][_0x1835('0x3c')]?_0x53effd[_0x1835('0x3a')]:_0x96653c['model'];if(_0x1383ff['query'][_0x1835('0x48')]){_0x53effd[_0x1835('0x49')]=[{'all':!![]}];}_0x53effd=_[_0x1835('0x43')]({},_0x53effd,_0x1383ff[_0x1835('0x47')]);return db[_0x1835('0x31')][_0x1835('0x4d')](_0x53effd)[_0x1835('0x18')](handleEntityNotFound(_0x43f5be,null))[_0x1835('0x18')](respondWithResult(_0x43f5be,null))[_0x1835('0x21')](handleError(_0x43f5be,null));};exports[_0x1835('0x4e')]=function(_0x1e9511,_0x357c8c){return db[_0x1835('0x31')][_0x1835('0x4e')](_0x1e9511['body'],{})[_0x1835('0x18')](respondWithResult(_0x357c8c,0xc9))[_0x1835('0x21')](handleError(_0x357c8c,null));};exports[_0x1835('0x2c')]=function(_0x1de007,_0x357e46){if(_0x1de007[_0x1835('0x4f')]['id']){delete _0x1de007['body']['id'];}return db[_0x1835('0x31')]['find']({'where':{'id':_0x1de007[_0x1835('0x50')]['id']}})[_0x1835('0x18')](handleEntityNotFound(_0x357e46,null))[_0x1835('0x18')](saveUpdates(_0x1de007['body'],null))[_0x1835('0x18')](respondWithResult(_0x357e46,null))[_0x1835('0x21')](handleError(_0x357e46,null));};exports[_0x1835('0x51')]=function(_0x107927,_0x25a75c){return db['SugarcrmConfiguration'][_0x1835('0x4d')]({'where':{'id':_0x107927[_0x1835('0x50')]['id']}})[_0x1835('0x18')](handleEntityNotFound(_0x25a75c,null))[_0x1835('0x18')](removeEntity(_0x25a75c,null))[_0x1835('0x21')](handleError(_0x25a75c,null));};exports[_0x1835('0x52')]=function(_0x8f3392,_0x29972c,_0x31421f){var _0x393eaf={};var _0x3a94d5={};var _0x3c0190;var _0x5365fc;return db[_0x1835('0x31')]['findOne']({'where':{'id':_0x8f3392[_0x1835('0x50')]['id']}})['then'](handleEntityNotFound(_0x29972c,null))['then'](function(_0x13fde8){if(_0x13fde8){_0x3c0190=_0x13fde8;_0x3a94d5[_0x1835('0x33')]=_['keys'](db[_0x1835('0x53')]['rawAttributes']);_0x3a94d5['query']=_['keys'](_0x8f3392['query']);_0x3a94d5[_0x1835('0x38')]=_[_0x1835('0x39')](_0x3a94d5['model'],_0x3a94d5['query']);_0x393eaf[_0x1835('0x3a')]=_[_0x1835('0x39')](_0x3a94d5[_0x1835('0x33')],qs[_0x1835('0x3b')](_0x8f3392[_0x1835('0x37')]['fields']));_0x393eaf[_0x1835('0x3a')]=_0x393eaf[_0x1835('0x3a')][_0x1835('0x3c')]?_0x393eaf['attributes']:_0x3a94d5[_0x1835('0x33')];_0x393eaf[_0x1835('0x3f')]=qs['sort'](_0x8f3392[_0x1835('0x37')][_0x1835('0x40')]);_0x393eaf[_0x1835('0x44')]=qs[_0x1835('0x38')](_[_0x1835('0x54')](_0x8f3392['query'],_0x3a94d5[_0x1835('0x38')]));if(_0x8f3392[_0x1835('0x37')][_0x1835('0x46')]){_0x393eaf[_0x1835('0x44')]=_[_0x1835('0x43')](_0x393eaf['where'],{'$or':_[_0x1835('0x45')](_0x393eaf[_0x1835('0x3a')],function(_0x5e2298){var _0x5da87e={};_0x5da87e[_0x5e2298]={'$like':'%'+_0x8f3392[_0x1835('0x37')][_0x1835('0x46')]+'%'};return _0x5da87e;})});}_0x393eaf=_[_0x1835('0x43')]({},_0x393eaf,_0x8f3392[_0x1835('0x47')]);return _0x3c0190[_0x1835('0x52')](_0x393eaf);}})[_0x1835('0x18')](function(_0x59fa70){if(_0x59fa70){_0x5365fc=_0x59fa70[_0x1835('0x3c')];if(!_0x8f3392['query'][_0x1835('0x3d')](_0x1835('0x55'))){_0x393eaf[_0x1835('0x3e')]=qs[_0x1835('0x3e')](_0x8f3392[_0x1835('0x37')][_0x1835('0x3e')]);_0x393eaf[_0x1835('0x27')]=qs['offset'](_0x8f3392[_0x1835('0x37')][_0x1835('0x27')]);}return _0x3c0190['getFields'](_0x393eaf);}})[_0x1835('0x18')](function(_0x5966e7){if(_0x5966e7){return _0x5966e7?{'count':_0x5365fc,'rows':_0x5966e7}:null;}})[_0x1835('0x18')](respondWithResult(_0x29972c,null))[_0x1835('0x21')](handleError(_0x29972c,null));};exports['getSubjects']=function(_0x41666b,_0x42296f,_0x4d793a){var _0x5a6579={};var _0x274ef0={};var _0x54b588;var _0x13fd7e;return db[_0x1835('0x31')]['findOne']({'where':{'id':_0x41666b[_0x1835('0x50')]['id']}})['then'](handleEntityNotFound(_0x42296f,null))[_0x1835('0x18')](function(_0x44cef5){if(_0x44cef5){_0x54b588=_0x44cef5;_0x274ef0[_0x1835('0x33')]=_['keys'](db[_0x1835('0x53')]['rawAttributes']);_0x274ef0[_0x1835('0x37')]=_['keys'](_0x41666b[_0x1835('0x37')]);_0x274ef0[_0x1835('0x38')]=_['intersection'](_0x274ef0[_0x1835('0x33')],_0x274ef0[_0x1835('0x37')]);_0x5a6579[_0x1835('0x3a')]=_[_0x1835('0x39')](_0x274ef0['model'],qs['fields'](_0x41666b[_0x1835('0x37')][_0x1835('0x3b')]));_0x5a6579['attributes']=_0x5a6579['attributes'][_0x1835('0x3c')]?_0x5a6579[_0x1835('0x3a')]:_0x274ef0['model'];_0x5a6579['order']=qs[_0x1835('0x40')](_0x41666b[_0x1835('0x37')][_0x1835('0x40')]);_0x5a6579[_0x1835('0x44')]=qs[_0x1835('0x38')](_['pick'](_0x41666b[_0x1835('0x37')],_0x274ef0[_0x1835('0x38')]));if(_0x41666b[_0x1835('0x37')][_0x1835('0x46')]){_0x5a6579[_0x1835('0x44')]=_['merge'](_0x5a6579['where'],{'$or':_[_0x1835('0x45')](_0x5a6579[_0x1835('0x3a')],function(_0xa2da9e){var _0x3d7b4e={};_0x3d7b4e[_0xa2da9e]={'$like':'%'+_0x41666b[_0x1835('0x37')][_0x1835('0x46')]+'%'};return _0x3d7b4e;})});}_0x5a6579=_['merge']({},_0x5a6579,_0x41666b[_0x1835('0x47')]);return _0x54b588[_0x1835('0x56')](_0x5a6579);}})[_0x1835('0x18')](function(_0x2daea1){if(_0x2daea1){_0x13fd7e=_0x2daea1['length'];if(!_0x41666b['query'][_0x1835('0x3d')]('nolimit')){_0x5a6579[_0x1835('0x3e')]=qs[_0x1835('0x3e')](_0x41666b[_0x1835('0x37')][_0x1835('0x3e')]);_0x5a6579[_0x1835('0x27')]=qs[_0x1835('0x27')](_0x41666b[_0x1835('0x37')]['offset']);}return _0x54b588[_0x1835('0x56')](_0x5a6579);}})[_0x1835('0x18')](function(_0x5d6fa4){if(_0x5d6fa4){return _0x5d6fa4?{'count':_0x13fd7e,'rows':_0x5d6fa4}:null;}})['then'](respondWithResult(_0x42296f,null))[_0x1835('0x21')](handleError(_0x42296f,null));};exports[_0x1835('0x57')]=function(_0x512f7a,_0x50dc59,_0x77e89){var _0x5c5a58={};var _0x5b9a8f={};var _0x355734;var _0x428041;return db[_0x1835('0x31')]['findOne']({'where':{'id':_0x512f7a[_0x1835('0x50')]['id']}})[_0x1835('0x18')](handleEntityNotFound(_0x50dc59,null))[_0x1835('0x18')](function(_0xc0732d){if(_0xc0732d){_0x355734=_0xc0732d;_0x5b9a8f['model']=_['keys'](db[_0x1835('0x53')][_0x1835('0x32')]);_0x5b9a8f[_0x1835('0x37')]=_['keys'](_0x512f7a['query']);_0x5b9a8f[_0x1835('0x38')]=_[_0x1835('0x39')](_0x5b9a8f[_0x1835('0x33')],_0x5b9a8f[_0x1835('0x37')]);_0x5c5a58[_0x1835('0x3a')]=_[_0x1835('0x39')](_0x5b9a8f['model'],qs[_0x1835('0x3b')](_0x512f7a['query']['fields']));_0x5c5a58[_0x1835('0x3a')]=_0x5c5a58[_0x1835('0x3a')][_0x1835('0x3c')]?_0x5c5a58[_0x1835('0x3a')]:_0x5b9a8f[_0x1835('0x33')];_0x5c5a58[_0x1835('0x3f')]=qs[_0x1835('0x40')](_0x512f7a[_0x1835('0x37')][_0x1835('0x40')]);_0x5c5a58['where']=qs[_0x1835('0x38')](_[_0x1835('0x54')](_0x512f7a[_0x1835('0x37')],_0x5b9a8f[_0x1835('0x38')]));if(_0x512f7a[_0x1835('0x37')][_0x1835('0x46')]){_0x5c5a58['where']=_[_0x1835('0x43')](_0x5c5a58[_0x1835('0x44')],{'$or':_['map'](_0x5c5a58[_0x1835('0x3a')],function(_0x428fd6){var _0xe10229={};_0xe10229[_0x428fd6]={'$like':'%'+_0x512f7a['query'][_0x1835('0x46')]+'%'};return _0xe10229;})});}_0x5c5a58=_[_0x1835('0x43')]({},_0x5c5a58,_0x512f7a[_0x1835('0x47')]);return _0x355734[_0x1835('0x57')](_0x5c5a58);}})[_0x1835('0x18')](function(_0x1e94f4){if(_0x1e94f4){_0x428041=_0x1e94f4[_0x1835('0x3c')];if(!_0x512f7a[_0x1835('0x37')]['hasOwnProperty'](_0x1835('0x55'))){_0x5c5a58[_0x1835('0x3e')]=qs[_0x1835('0x3e')](_0x512f7a[_0x1835('0x37')]['limit']);_0x5c5a58['offset']=qs[_0x1835('0x27')](_0x512f7a[_0x1835('0x37')][_0x1835('0x27')]);}return _0x355734[_0x1835('0x57')](_0x5c5a58);}})[_0x1835('0x18')](function(_0x12e451){if(_0x12e451){return _0x12e451?{'count':_0x428041,'rows':_0x12e451}:null;}})[_0x1835('0x18')](respondWithResult(_0x50dc59,null))[_0x1835('0x21')](handleError(_0x50dc59,null));}; \ No newline at end of file +var _0x14c8=['then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','message','info','catch','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','stack','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','add','day','merge','filter','options','SugarcrmConfiguration','includeAll','include','rows','params','find','create','body','update','destroy','findOne','SugarcrmField','getFields','getSubjects','map','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x14c8,0xf0));var _0x814c=function(_0x438f4a,_0x4ce216){_0x438f4a=_0x438f4a-0x0;var _0x1b345d=_0x14c8[_0x438f4a];return _0x1b345d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x814c('0x0'));var rimraf=require(_0x814c('0x1'));var zipdir=require(_0x814c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x814c('0x3'));var moment=require(_0x814c('0x4'));var BPromise=require(_0x814c('0x5'));var Mustache=require(_0x814c('0x6'));var util=require('util');var path=require(_0x814c('0x7'));var sox=require(_0x814c('0x8'));var csv=require('to-csv');var ejs=require(_0x814c('0x9'));var fs=require('fs');var _=require(_0x814c('0xa'));var squel=require(_0x814c('0xb'));var crypto=require('crypto');var jsforce=require(_0x814c('0xc'));var deskjs=require(_0x814c('0xd'));var toCsv=require(_0x814c('0xe'));var querystring=require(_0x814c('0xf'));var Papa=require(_0x814c('0x10'));var Redis=require(_0x814c('0x11'));var qs=require(_0x814c('0x12'));var logger=require(_0x814c('0x13'))(_0x814c('0x14'));var utils=require(_0x814c('0x15'));var config=require(_0x814c('0x16'));var db=require(_0x814c('0x17'))['db'];var jayson=require(_0x814c('0x18'));var client=jayson[_0x814c('0x19')][_0x814c('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x27d52f,_0x46eb1a,_0x467472,_0x4ed059){return new BPromise(function(_0xd00b50,_0x396d85){var _0x52b619=_0x4ed059||client;return _0x52b619['request'](_0x27d52f,_0x467472)[_0x814c('0x1b')](function(_0x162c63){logger['info'](_0x814c('0x1c'),_0x46eb1a,_0x814c('0x1d'));logger[_0x814c('0x1e')](_0x814c('0x1f'),_0x46eb1a,_0x814c('0x1d'),JSON['stringify'](_0x162c63));if(_0x162c63[_0x814c('0x20')]){if(_0x162c63[_0x814c('0x20')]['code']===0x1f4){logger['error'](_0x814c('0x1c'),_0x46eb1a,_0x162c63['error'][_0x814c('0x21')]);return _0x396d85(_0x162c63[_0x814c('0x20')][_0x814c('0x21')]);}logger['error'](_0x814c('0x1c'),_0x46eb1a,_0x162c63[_0x814c('0x20')][_0x814c('0x21')]);return _0xd00b50(_0x162c63[_0x814c('0x20')][_0x814c('0x21')]);}else{logger[_0x814c('0x22')](_0x814c('0x1c'),_0x46eb1a,'request\x20sent');_0xd00b50(_0x162c63['result'][_0x814c('0x21')]);}})[_0x814c('0x23')](function(_0x280c2f){logger[_0x814c('0x20')](_0x814c('0x1c'),_0x46eb1a,_0x280c2f);_0x396d85(_0x280c2f);});});}function respondWithStatusCode(_0x387f65,_0x3c9d34){_0x3c9d34=_0x3c9d34||0xcc;return function(_0xbdf568){if(_0xbdf568){return _0x387f65[_0x814c('0x24')](_0x3c9d34);}return _0x387f65[_0x814c('0x25')](_0x3c9d34)[_0x814c('0x26')]();};}function respondWithResult(_0x2c4616,_0x24c09a){_0x24c09a=_0x24c09a||0xc8;return function(_0x3b1b57){if(_0x3b1b57){return _0x2c4616[_0x814c('0x25')](_0x24c09a)[_0x814c('0x27')](_0x3b1b57);}};}function respondWithFilteredResult(_0x1250c1,_0x4cc24e){return function(_0x29c859){if(_0x29c859){var _0x129dcf=_0x29c859[_0x814c('0x28')],_0x265f4d=_0x4cc24e['offset'],_0x25578f=_0x4cc24e[_0x814c('0x29')]+_0x4cc24e['limit'],_0x3931d0;if(_0x25578f>=_0x129dcf){_0x25578f=_0x129dcf;_0x3931d0=0xc8;}else{_0x3931d0=0xce;}_0x1250c1[_0x814c('0x25')](_0x3931d0);return _0x1250c1[_0x814c('0x2a')](_0x814c('0x2b'),_0x265f4d+'-'+_0x25578f+'/'+_0x129dcf)['json'](_0x29c859);}return null;};}function patchUpdates(_0x2c5792){return function(_0x572ee8){try{jsonpatch['apply'](_0x572ee8,_0x2c5792,!![]);}catch(_0x2c8bcf){return BPromise[_0x814c('0x2c')](_0x2c8bcf);}return _0x572ee8[_0x814c('0x2d')]();};}function saveUpdates(_0x5b8fce,_0x58db4f){return function(_0x4c6c57){if(_0x4c6c57){return _0x4c6c57['update'](_0x5b8fce)[_0x814c('0x1b')](function(_0x496596){return _0x496596;});}return null;};}function removeEntity(_0x2a7584,_0x70ed9d){return function(_0x5265b6){if(_0x5265b6){return _0x5265b6['destroy']()[_0x814c('0x1b')](function(){_0x2a7584[_0x814c('0x25')](0xcc)[_0x814c('0x26')]();});}};}function handleEntityNotFound(_0x60a9a3,_0x9c5f5e){return function(_0x2149dd){if(!_0x2149dd){_0x60a9a3['sendStatus'](0x194);}return _0x2149dd;};}function handleError(_0x1f4530,_0x497889){_0x497889=_0x497889||0x1f4;return function(_0x190531){logger[_0x814c('0x20')](_0x190531[_0x814c('0x2e')]);if(_0x190531[_0x814c('0x2f')]){delete _0x190531[_0x814c('0x2f')];}_0x1f4530[_0x814c('0x25')](_0x497889)[_0x814c('0x30')](_0x190531);};}exports[_0x814c('0x31')]=function(_0x4f1ea0,_0xccc89a){var _0x5e6ac8={},_0x11ea6d={},_0x2bef9c={'count':0x0,'rows':[]};var _0x4e39b5=db['SugarcrmConfiguration'][_0x814c('0x32')];_0x11ea6d[_0x814c('0x33')]=_[_0x814c('0x34')](_0x4e39b5);var _0x4cd211={'dateStart':_0x4f1ea0[_0x814c('0x35')][_0x814c('0x36')],'dateEnd':_0x4f1ea0[_0x814c('0x35')][_0x814c('0x37')]};delete _0x4f1ea0[_0x814c('0x35')][_0x814c('0x36')];delete _0x4f1ea0[_0x814c('0x35')][_0x814c('0x37')];_0x11ea6d[_0x814c('0x35')]=_[_0x814c('0x34')](_0x4f1ea0[_0x814c('0x35')]);_0x11ea6d[_0x814c('0x38')]=_['intersection'](_0x11ea6d['model'],_0x11ea6d[_0x814c('0x35')]);_0x5e6ac8[_0x814c('0x39')]=_[_0x814c('0x3a')](_0x11ea6d['model'],qs['fields'](_0x4f1ea0[_0x814c('0x35')][_0x814c('0x3b')]));_0x5e6ac8[_0x814c('0x39')]=_0x5e6ac8['attributes'][_0x814c('0x3c')]?_0x5e6ac8[_0x814c('0x39')]:_0x11ea6d[_0x814c('0x33')];if(!_0x4f1ea0['query'][_0x814c('0x3d')](_0x814c('0x3e'))){_0x5e6ac8['limit']=qs[_0x814c('0x3f')](_0x4f1ea0[_0x814c('0x35')][_0x814c('0x3f')]);_0x5e6ac8[_0x814c('0x29')]=qs[_0x814c('0x29')](_0x4f1ea0[_0x814c('0x35')][_0x814c('0x29')]);}_0x5e6ac8[_0x814c('0x40')]=qs[_0x814c('0x41')](_0x4f1ea0[_0x814c('0x35')][_0x814c('0x41')]);_0x5e6ac8[_0x814c('0x42')]=qs[_0x814c('0x38')](_[_0x814c('0x43')](_0x4f1ea0[_0x814c('0x35')],_0x11ea6d[_0x814c('0x38')]));if(_0x4cd211[_0x814c('0x36')]){if(_0x4cd211[_0x814c('0x37')]){_0x4cd211[_0x814c('0x37')]=moment(_0x4cd211[_0x814c('0x37')])[_0x814c('0x44')](0x1,_0x814c('0x45'));}else{_0x4cd211['dateEnd']=moment(_0x4cd211[_0x814c('0x36')])[_0x814c('0x44')](0x1,_0x814c('0x45'));}_[_0x814c('0x46')](_0x5e6ac8[_0x814c('0x42')],{'createdAt':{'$gte':_0x4cd211['dateStart'],'$lte':_0x4cd211[_0x814c('0x37')]}});}if(_0x4f1ea0['query']['filter']){_0x5e6ac8['where']=_[_0x814c('0x46')](_0x5e6ac8['where'],{'$or':_['map'](_0x5e6ac8[_0x814c('0x39')],function(_0x5d78cb){var _0x46811d={};_0x46811d[_0x5d78cb]={'$like':'%'+_0x4f1ea0[_0x814c('0x35')][_0x814c('0x47')]+'%'};return _0x46811d;})});}_0x5e6ac8=_[_0x814c('0x46')]({},_0x5e6ac8,_0x4f1ea0[_0x814c('0x48')]);var _0x16474f={'where':_0x5e6ac8[_0x814c('0x42')]};return db[_0x814c('0x49')]['count'](_0x16474f)[_0x814c('0x1b')](function(_0x3f072d){_0x2bef9c[_0x814c('0x28')]=_0x3f072d;if(_0x4f1ea0['query'][_0x814c('0x4a')]){_0x5e6ac8[_0x814c('0x4b')]=[{'all':!![]}];}return db[_0x814c('0x49')]['findAll'](_0x5e6ac8);})[_0x814c('0x1b')](function(_0x313df6){_0x2bef9c[_0x814c('0x4c')]=_0x313df6;return _0x2bef9c;})[_0x814c('0x1b')](respondWithFilteredResult(_0xccc89a,_0x5e6ac8))[_0x814c('0x23')](handleError(_0xccc89a,null));};exports['show']=function(_0x226f48,_0x9f817){var _0xff30e8={'raw':![],'where':{'id':_0x226f48[_0x814c('0x4d')]['id']}},_0x3a3640={};_0x3a3640[_0x814c('0x33')]=_[_0x814c('0x34')](db[_0x814c('0x49')]['rawAttributes']);_0x3a3640[_0x814c('0x35')]=_[_0x814c('0x34')](_0x226f48[_0x814c('0x35')]);_0x3a3640['filters']=_['intersection'](_0x3a3640[_0x814c('0x33')],_0x3a3640[_0x814c('0x35')]);_0xff30e8['attributes']=_['intersection'](_0x3a3640['model'],qs[_0x814c('0x3b')](_0x226f48[_0x814c('0x35')]['fields']));_0xff30e8[_0x814c('0x39')]=_0xff30e8[_0x814c('0x39')][_0x814c('0x3c')]?_0xff30e8[_0x814c('0x39')]:_0x3a3640[_0x814c('0x33')];if(_0x226f48[_0x814c('0x35')][_0x814c('0x4a')]){_0xff30e8[_0x814c('0x4b')]=[{'all':!![]}];}_0xff30e8=_[_0x814c('0x46')]({},_0xff30e8,_0x226f48[_0x814c('0x48')]);return db[_0x814c('0x49')][_0x814c('0x4e')](_0xff30e8)[_0x814c('0x1b')](handleEntityNotFound(_0x9f817,null))[_0x814c('0x1b')](respondWithResult(_0x9f817,null))[_0x814c('0x23')](handleError(_0x9f817,null));};exports[_0x814c('0x4f')]=function(_0x259aa4,_0x393029){return db['SugarcrmConfiguration'][_0x814c('0x4f')](_0x259aa4[_0x814c('0x50')],{})['then'](respondWithResult(_0x393029,0xc9))['catch'](handleError(_0x393029,null));};exports[_0x814c('0x51')]=function(_0x481df3,_0x23933a){if(_0x481df3[_0x814c('0x50')]['id']){delete _0x481df3[_0x814c('0x50')]['id'];}return db[_0x814c('0x49')]['find']({'where':{'id':_0x481df3[_0x814c('0x4d')]['id']}})[_0x814c('0x1b')](handleEntityNotFound(_0x23933a,null))[_0x814c('0x1b')](saveUpdates(_0x481df3[_0x814c('0x50')],null))[_0x814c('0x1b')](respondWithResult(_0x23933a,null))[_0x814c('0x23')](handleError(_0x23933a,null));};exports[_0x814c('0x52')]=function(_0x1d4f15,_0x564e28){return db[_0x814c('0x49')][_0x814c('0x4e')]({'where':{'id':_0x1d4f15[_0x814c('0x4d')]['id']}})[_0x814c('0x1b')](handleEntityNotFound(_0x564e28,null))[_0x814c('0x1b')](removeEntity(_0x564e28,null))[_0x814c('0x23')](handleError(_0x564e28,null));};exports['getFields']=function(_0x37a2c1,_0x31fc7c,_0x5a75d9){var _0x1165ac={};var _0x19781d={};var _0x213695;var _0x4037dc;return db[_0x814c('0x49')][_0x814c('0x53')]({'where':{'id':_0x37a2c1['params']['id']}})[_0x814c('0x1b')](handleEntityNotFound(_0x31fc7c,null))[_0x814c('0x1b')](function(_0x4b45a3){if(_0x4b45a3){_0x213695=_0x4b45a3;_0x19781d['model']=_[_0x814c('0x34')](db[_0x814c('0x54')][_0x814c('0x32')]);_0x19781d[_0x814c('0x35')]=_[_0x814c('0x34')](_0x37a2c1[_0x814c('0x35')]);_0x19781d[_0x814c('0x38')]=_[_0x814c('0x3a')](_0x19781d[_0x814c('0x33')],_0x19781d['query']);_0x1165ac[_0x814c('0x39')]=_[_0x814c('0x3a')](_0x19781d[_0x814c('0x33')],qs[_0x814c('0x3b')](_0x37a2c1['query'][_0x814c('0x3b')]));_0x1165ac[_0x814c('0x39')]=_0x1165ac[_0x814c('0x39')][_0x814c('0x3c')]?_0x1165ac[_0x814c('0x39')]:_0x19781d['model'];_0x1165ac[_0x814c('0x40')]=qs['sort'](_0x37a2c1[_0x814c('0x35')][_0x814c('0x41')]);_0x1165ac[_0x814c('0x42')]=qs[_0x814c('0x38')](_[_0x814c('0x43')](_0x37a2c1[_0x814c('0x35')],_0x19781d['filters']));if(_0x37a2c1[_0x814c('0x35')][_0x814c('0x47')]){_0x1165ac[_0x814c('0x42')]=_['merge'](_0x1165ac[_0x814c('0x42')],{'$or':_['map'](_0x1165ac['attributes'],function(_0x13d48c){var _0x5d8d5={};_0x5d8d5[_0x13d48c]={'$like':'%'+_0x37a2c1[_0x814c('0x35')][_0x814c('0x47')]+'%'};return _0x5d8d5;})});}_0x1165ac=_[_0x814c('0x46')]({},_0x1165ac,_0x37a2c1['options']);return _0x213695[_0x814c('0x55')](_0x1165ac);}})[_0x814c('0x1b')](function(_0x2a0ae8){if(_0x2a0ae8){_0x4037dc=_0x2a0ae8[_0x814c('0x3c')];if(!_0x37a2c1[_0x814c('0x35')][_0x814c('0x3d')](_0x814c('0x3e'))){_0x1165ac['limit']=qs['limit'](_0x37a2c1['query'][_0x814c('0x3f')]);_0x1165ac[_0x814c('0x29')]=qs[_0x814c('0x29')](_0x37a2c1['query'][_0x814c('0x29')]);}return _0x213695['getFields'](_0x1165ac);}})[_0x814c('0x1b')](function(_0x51031d){if(_0x51031d){return _0x51031d?{'count':_0x4037dc,'rows':_0x51031d}:null;}})['then'](respondWithResult(_0x31fc7c,null))[_0x814c('0x23')](handleError(_0x31fc7c,null));};exports[_0x814c('0x56')]=function(_0x3ae93c,_0x3798fd,_0x59fefb){var _0x303e9e={};var _0x11e27c={};var _0x115103;var _0x54de87;return db[_0x814c('0x49')][_0x814c('0x53')]({'where':{'id':_0x3ae93c[_0x814c('0x4d')]['id']}})[_0x814c('0x1b')](handleEntityNotFound(_0x3798fd,null))['then'](function(_0x4ac844){if(_0x4ac844){_0x115103=_0x4ac844;_0x11e27c['model']=_[_0x814c('0x34')](db[_0x814c('0x54')][_0x814c('0x32')]);_0x11e27c[_0x814c('0x35')]=_['keys'](_0x3ae93c[_0x814c('0x35')]);_0x11e27c['filters']=_[_0x814c('0x3a')](_0x11e27c[_0x814c('0x33')],_0x11e27c[_0x814c('0x35')]);_0x303e9e[_0x814c('0x39')]=_[_0x814c('0x3a')](_0x11e27c[_0x814c('0x33')],qs[_0x814c('0x3b')](_0x3ae93c[_0x814c('0x35')][_0x814c('0x3b')]));_0x303e9e['attributes']=_0x303e9e[_0x814c('0x39')][_0x814c('0x3c')]?_0x303e9e['attributes']:_0x11e27c['model'];_0x303e9e['order']=qs['sort'](_0x3ae93c['query'][_0x814c('0x41')]);_0x303e9e[_0x814c('0x42')]=qs[_0x814c('0x38')](_['pick'](_0x3ae93c['query'],_0x11e27c['filters']));if(_0x3ae93c[_0x814c('0x35')][_0x814c('0x47')]){_0x303e9e['where']=_[_0x814c('0x46')](_0x303e9e[_0x814c('0x42')],{'$or':_[_0x814c('0x57')](_0x303e9e['attributes'],function(_0x44a35e){var _0xd4eed2={};_0xd4eed2[_0x44a35e]={'$like':'%'+_0x3ae93c[_0x814c('0x35')]['filter']+'%'};return _0xd4eed2;})});}_0x303e9e=_[_0x814c('0x46')]({},_0x303e9e,_0x3ae93c[_0x814c('0x48')]);return _0x115103[_0x814c('0x56')](_0x303e9e);}})[_0x814c('0x1b')](function(_0x575f48){if(_0x575f48){_0x54de87=_0x575f48[_0x814c('0x3c')];if(!_0x3ae93c[_0x814c('0x35')][_0x814c('0x3d')](_0x814c('0x3e'))){_0x303e9e[_0x814c('0x3f')]=qs[_0x814c('0x3f')](_0x3ae93c[_0x814c('0x35')][_0x814c('0x3f')]);_0x303e9e[_0x814c('0x29')]=qs['offset'](_0x3ae93c['query'][_0x814c('0x29')]);}return _0x115103[_0x814c('0x56')](_0x303e9e);}})[_0x814c('0x1b')](function(_0x2612d3){if(_0x2612d3){return _0x2612d3?{'count':_0x54de87,'rows':_0x2612d3}:null;}})['then'](respondWithResult(_0x3798fd,null))['catch'](handleError(_0x3798fd,null));};exports[_0x814c('0x58')]=function(_0x5a2f1b,_0x532872,_0x4f943e){var _0xb8e3d3={};var _0x2e0e5f={};var _0x4a99bd;var _0x1c7bba;return db[_0x814c('0x49')][_0x814c('0x53')]({'where':{'id':_0x5a2f1b['params']['id']}})[_0x814c('0x1b')](handleEntityNotFound(_0x532872,null))[_0x814c('0x1b')](function(_0x229877){if(_0x229877){_0x4a99bd=_0x229877;_0x2e0e5f[_0x814c('0x33')]=_[_0x814c('0x34')](db['SugarcrmField'][_0x814c('0x32')]);_0x2e0e5f['query']=_[_0x814c('0x34')](_0x5a2f1b[_0x814c('0x35')]);_0x2e0e5f[_0x814c('0x38')]=_['intersection'](_0x2e0e5f[_0x814c('0x33')],_0x2e0e5f[_0x814c('0x35')]);_0xb8e3d3[_0x814c('0x39')]=_[_0x814c('0x3a')](_0x2e0e5f[_0x814c('0x33')],qs[_0x814c('0x3b')](_0x5a2f1b[_0x814c('0x35')]['fields']));_0xb8e3d3[_0x814c('0x39')]=_0xb8e3d3[_0x814c('0x39')][_0x814c('0x3c')]?_0xb8e3d3[_0x814c('0x39')]:_0x2e0e5f[_0x814c('0x33')];_0xb8e3d3[_0x814c('0x40')]=qs[_0x814c('0x41')](_0x5a2f1b[_0x814c('0x35')][_0x814c('0x41')]);_0xb8e3d3[_0x814c('0x42')]=qs[_0x814c('0x38')](_[_0x814c('0x43')](_0x5a2f1b[_0x814c('0x35')],_0x2e0e5f['filters']));if(_0x5a2f1b['query'][_0x814c('0x47')]){_0xb8e3d3[_0x814c('0x42')]=_[_0x814c('0x46')](_0xb8e3d3[_0x814c('0x42')],{'$or':_[_0x814c('0x57')](_0xb8e3d3[_0x814c('0x39')],function(_0x3a5b09){var _0x33e696={};_0x33e696[_0x3a5b09]={'$like':'%'+_0x5a2f1b[_0x814c('0x35')]['filter']+'%'};return _0x33e696;})});}_0xb8e3d3=_['merge']({},_0xb8e3d3,_0x5a2f1b['options']);return _0x4a99bd[_0x814c('0x58')](_0xb8e3d3);}})[_0x814c('0x1b')](function(_0x3c4cc3){if(_0x3c4cc3){_0x1c7bba=_0x3c4cc3['length'];if(!_0x5a2f1b[_0x814c('0x35')][_0x814c('0x3d')](_0x814c('0x3e'))){_0xb8e3d3['limit']=qs['limit'](_0x5a2f1b[_0x814c('0x35')][_0x814c('0x3f')]);_0xb8e3d3['offset']=qs[_0x814c('0x29')](_0x5a2f1b[_0x814c('0x35')]['offset']);}return _0x4a99bd[_0x814c('0x58')](_0xb8e3d3);}})[_0x814c('0x1b')](function(_0x358864){if(_0x358864){return _0x358864?{'count':_0x1c7bba,'rows':_0x358864}:null;}})[_0x814c('0x1b')](respondWithResult(_0x532872,null))['catch'](handleError(_0x532872,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 8571471..292cd10 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 _0x25a9=['api','moment','bluebird','./intSugarcrmConfiguration.attributes','exports','define','int_sugarcrm_configurations','util','../../config/logger'];(function(_0x56aa66,_0x1ddf52){var _0xeba9ff=function(_0x5467b5){while(--_0x5467b5){_0x56aa66['push'](_0x56aa66['shift']());}};_0xeba9ff(++_0x1ddf52);}(_0x25a9,0xf1));var _0x925a=function(_0x2c921c,_0x3c6a85){_0x2c921c=_0x2c921c-0x0;var _0x440bf2=_0x25a9[_0x2c921c];return _0x440bf2;};'use strict';var _=require('lodash');var util=require(_0x925a('0x0'));var logger=require(_0x925a('0x1'))(_0x925a('0x2'));var moment=require(_0x925a('0x3'));var BPromise=require(_0x925a('0x4'));var rp=require('request-promise');var attributes=require(_0x925a('0x5'));module[_0x925a('0x6')]=function(_0x4c86fd,_0x53de6b){return _0x4c86fd[_0x925a('0x7')]('SugarcrmConfiguration',attributes,{'tableName':_0x925a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7bd=['lodash','util','../../config/logger','api','request-promise','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration'];(function(_0x82b0b4,_0x58dc11){var _0x5d3da3=function(_0x35f84a){while(--_0x35f84a){_0x82b0b4['push'](_0x82b0b4['shift']());}};_0x5d3da3(++_0x58dc11);}(_0xc7bd,0x170));var _0xdc7b=function(_0xe59feb,_0x46667b){_0xe59feb=_0xe59feb-0x0;var _0x176ba1=_0xc7bd[_0xe59feb];return _0x176ba1;};'use strict';var _=require(_0xdc7b('0x0'));var util=require(_0xdc7b('0x1'));var logger=require(_0xdc7b('0x2'))(_0xdc7b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdc7b('0x4'));var attributes=require(_0xdc7b('0x5'));module[_0xdc7b('0x6')]=function(_0x5e1219,_0x30d4a7){return _0x5e1219['define'](_0xdc7b('0x7'),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 a5e8db9..76e0b62 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 _0x14a9=['client','http','request','info','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','SugarcrmConfiguration,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','../../config/logger','jayson/promise'];(function(_0x64b31d,_0x393b36){var _0x42c45b=function(_0x2d2323){while(--_0x2d2323){_0x64b31d['push'](_0x64b31d['shift']());}};_0x42c45b(++_0x393b36);}(_0x14a9,0x1a2));var _0x914a=function(_0x392e52,_0x41196e){_0x392e52=_0x392e52-0x0;var _0x38ff9d=_0x14a9[_0x392e52];return _0x38ff9d;};'use strict';var _=require(_0x914a('0x0'));var util=require(_0x914a('0x1'));var moment=require(_0x914a('0x2'));var BPromise=require(_0x914a('0x3'));var rs=require(_0x914a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x914a('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x914a('0x6'));var client=jayson[_0x914a('0x7')][_0x914a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1af8cd,_0x596f03,_0x5c7032){return new BPromise(function(_0xa6e5d3,_0x26c0cd){return client[_0x914a('0x9')](_0x1af8cd,_0x5c7032)['then'](function(_0x3be491){logger[_0x914a('0xa')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x596f03,_0x914a('0xb'));logger['debug'](_0x914a('0xc'),_0x596f03,_0x914a('0xb'),JSON[_0x914a('0xd')](_0x3be491));if(_0x3be491['error']){if(_0x3be491['error']['code']===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x596f03,_0x3be491[_0x914a('0xe')][_0x914a('0xf')]);return _0x26c0cd(_0x3be491[_0x914a('0xe')][_0x914a('0xf')]);}logger[_0x914a('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x596f03,_0x3be491['error']['message']);return _0xa6e5d3(_0x3be491[_0x914a('0xe')]['message']);}else{logger[_0x914a('0xa')](_0x914a('0x10'),_0x596f03,_0x914a('0xb'));_0xa6e5d3(_0x3be491['result']['message']);}})['catch'](function(_0x4679fc){logger[_0x914a('0xe')](_0x914a('0x10'),_0x596f03,_0x4679fc);_0x26c0cd(_0x4679fc);});});} \ No newline at end of file +var _0x29f5=['../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2dbdcb,_0x27e2bd){var _0x4bdb33=function(_0x29c75a){while(--_0x29c75a){_0x2dbdcb['push'](_0x2dbdcb['shift']());}};_0x4bdb33(++_0x27e2bd);}(_0x29f5,0x124));var _0x529f=function(_0x268162,_0x100b1e){_0x268162=_0x268162-0x0;var _0x2f92c8=_0x29f5[_0x268162];return _0x2f92c8;};'use strict';var _=require(_0x529f('0x0'));var util=require(_0x529f('0x1'));var moment=require(_0x529f('0x2'));var BPromise=require(_0x529f('0x3'));var rs=require(_0x529f('0x4'));var fs=require('fs');var Redis=require(_0x529f('0x5'));var db=require(_0x529f('0x6'))['db'];var utils=require(_0x529f('0x7'));var logger=require(_0x529f('0x8'))('rpc');var config=require(_0x529f('0x9'));var jayson=require(_0x529f('0xa'));var client=jayson['client'][_0x529f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x564502,_0x484074,_0x119800){return new BPromise(function(_0x51bd35,_0x343773){return client[_0x529f('0xc')](_0x564502,_0x119800)[_0x529f('0xd')](function(_0x4ff618){logger[_0x529f('0xe')](_0x529f('0xf'),_0x484074,_0x529f('0x10'));logger[_0x529f('0x11')](_0x529f('0x12'),_0x484074,_0x529f('0x10'),JSON[_0x529f('0x13')](_0x4ff618));if(_0x4ff618[_0x529f('0x14')]){if(_0x4ff618['error'][_0x529f('0x15')]===0x1f4){logger[_0x529f('0x14')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x484074,_0x4ff618[_0x529f('0x14')]['message']);return _0x343773(_0x4ff618[_0x529f('0x14')][_0x529f('0x16')]);}logger[_0x529f('0x14')](_0x529f('0xf'),_0x484074,_0x4ff618[_0x529f('0x14')][_0x529f('0x16')]);return _0x51bd35(_0x4ff618[_0x529f('0x14')][_0x529f('0x16')]);}else{logger[_0x529f('0xe')](_0x529f('0xf'),_0x484074,_0x529f('0x10'));_0x51bd35(_0x4ff618[_0x529f('0x17')][_0x529f('0x16')]);}})[_0x529f('0x18')](function(_0x575b96){logger[_0x529f('0x14')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x484074,_0x575b96);_0x343773(_0x575b96);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 825c28b..81b45f4 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 _0x6306=['Router','../../config/environment','./intSugarcrmField.controller','get','index','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x3dc7cd,_0xa6f839){var _0x189281=function(_0x1a3812){while(--_0x1a3812){_0x3dc7cd['push'](_0x3dc7cd['shift']());}};_0x189281(++_0xa6f839);}(_0x6306,0xf8));var _0x6630=function(_0x2b45d9,_0x3f4e3e){_0x2b45d9=_0x2b45d9-0x0;var _0x26f957=_0x6306[_0x2b45d9];return _0x26f957;};'use strict';var multer=require(_0x6630('0x0'));var util=require(_0x6630('0x1'));var path=require(_0x6630('0x2'));var timeout=require('connect-timeout');var express=require(_0x6630('0x3'));var router=express[_0x6630('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6630('0x5'));var controller=require(_0x6630('0x6'));router[_0x6630('0x7')]('/',auth['isAuthenticated'](),controller[_0x6630('0x8')]);router[_0x6630('0x7')](_0x6630('0x9'),auth[_0x6630('0xa')](),controller['show']);router[_0x6630('0xb')]('/',auth[_0x6630('0xa')](),controller[_0x6630('0xc')]);router[_0x6630('0xd')](_0x6630('0x9'),auth[_0x6630('0xa')](),controller[_0x6630('0xe')]);router[_0x6630('0xf')]('/:id',auth[_0x6630('0xa')](),controller[_0x6630('0x10')]);module[_0x6630('0x11')]=router; \ No newline at end of file +var _0x157a=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','create','put','update','destroy','exports','multer','util'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x157a,0x7c));var _0xa157=function(_0x305bbf,_0x5647b3){_0x305bbf=_0x305bbf-0x0;var _0x4ed772=_0x157a[_0x305bbf];return _0x4ed772;};'use strict';var multer=require(_0xa157('0x0'));var util=require(_0xa157('0x1'));var path=require(_0xa157('0x2'));var timeout=require(_0xa157('0x3'));var express=require(_0xa157('0x4'));var router=express['Router']();var auth=require(_0xa157('0x5'));var interaction=require(_0xa157('0x6'));var config=require(_0xa157('0x7'));var controller=require(_0xa157('0x8'));router[_0xa157('0x9')]('/',auth[_0xa157('0xa')](),controller[_0xa157('0xb')]);router[_0xa157('0x9')](_0xa157('0xc'),auth[_0xa157('0xa')](),controller['show']);router['post']('/',auth[_0xa157('0xa')](),controller[_0xa157('0xd')]);router[_0xa157('0xe')](_0xa157('0xc'),auth[_0xa157('0xa')](),controller[_0xa157('0xf')]);router['delete'](_0xa157('0xc'),auth[_0xa157('0xa')](),controller[_0xa157('0x10')]);module[_0xa157('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 093c09a..0ae602b 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 _0x6f7a=['ENUM','string','customVariable','keyValue','STRING','variable','sequelize','exports'];(function(_0x5c6fa0,_0x28d1b5){var _0x4c0ace=function(_0x20856c){while(--_0x20856c){_0x5c6fa0['push'](_0x5c6fa0['shift']());}};_0x4c0ace(++_0x28d1b5);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x3e7819,_0x511e4f){_0x3e7819=_0x3e7819-0x0;var _0x329c13=_0x6f7a[_0x3e7819];return _0x329c13;};'use strict';var Sequelize=require(_0xa6f7('0x0'));module[_0xa6f7('0x1')]={'type':{'type':Sequelize[_0xa6f7('0x2')](_0xa6f7('0x3'),'variable',_0xa6f7('0x4'),_0xa6f7('0x5')),'defaultValue':_0xa6f7('0x3')},'content':{'type':Sequelize[_0xa6f7('0x6')]},'key':{'type':Sequelize[_0xa6f7('0x6')]},'keyType':{'type':Sequelize[_0xa6f7('0x2')](_0xa6f7('0x3'),_0xa6f7('0x7'),_0xa6f7('0x4'))},'keyContent':{'type':Sequelize[_0xa6f7('0x6')]},'idField':{'type':Sequelize[_0xa6f7('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa6f7('0x6')]}}; \ No newline at end of file +var _0xf4eb=['string','variable','sequelize','customVariable','STRING','ENUM'];(function(_0x1e00da,_0x4c1cf8){var _0x16e478=function(_0x2b06c0){while(--_0x2b06c0){_0x1e00da['push'](_0x1e00da['shift']());}};_0x16e478(++_0x4c1cf8);}(_0xf4eb,0xec));var _0xbf4e=function(_0x525f12,_0x57214a){_0x525f12=_0x525f12-0x0;var _0xc92921=_0xf4eb[_0x525f12];return _0xc92921;};'use strict';var Sequelize=require(_0xbf4e('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string','variable',_0xbf4e('0x1'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0xbf4e('0x2')]},'key':{'type':Sequelize[_0xbf4e('0x2')]},'keyType':{'type':Sequelize[_0xbf4e('0x3')](_0xbf4e('0x4'),_0xbf4e('0x5'),_0xbf4e('0x1'))},'keyContent':{'type':Sequelize[_0xbf4e('0x2')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xbf4e('0x2')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 49aa058..1ecde0c 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 _0x68ae=['attributes','fields','length','sort','filters','pick','add','day','merge','where','map','filter','options','findAll','rows','catch','show','keys','includeAll','include','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','SugarcrmField','rawAttributes','query','dateEnd','dateStart','intersection','model'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68ae,0xa6));var _0xe68a=function(_0x538b45,_0x52f9de){_0x538b45=_0x538b45-0x0;var _0x38cd0f=_0x68ae[_0x538b45];return _0x38cd0f;};'use strict';var pdf=require(_0xe68a('0x0'));var emlformat=require(_0xe68a('0x1'));var rimraf=require(_0xe68a('0x2'));var zipdir=require(_0xe68a('0x3'));var jsonpatch=require(_0xe68a('0x4'));var rp=require('request-promise');var moment=require(_0xe68a('0x5'));var BPromise=require(_0xe68a('0x6'));var Mustache=require('mustache');var util=require(_0xe68a('0x7'));var path=require(_0xe68a('0x8'));var sox=require(_0xe68a('0x9'));var csv=require(_0xe68a('0xa'));var ejs=require(_0xe68a('0xb'));var fs=require('fs');var _=require(_0xe68a('0xc'));var squel=require(_0xe68a('0xd'));var crypto=require('crypto');var jsforce=require(_0xe68a('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe68a('0xf'));var Papa=require('papaparse');var Redis=require(_0xe68a('0x10'));var qs=require(_0xe68a('0x11'));var logger=require(_0xe68a('0x12'))(_0xe68a('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xe68a('0x14'))['db'];function respondWithStatusCode(_0x573302,_0x178a7d){_0x178a7d=_0x178a7d||0xcc;return function(_0xf5ce02){if(_0xf5ce02){return _0x573302[_0xe68a('0x15')](_0x178a7d);}return _0x573302[_0xe68a('0x16')](_0x178a7d)[_0xe68a('0x17')]();};}function respondWithResult(_0x261077,_0x164cbb){_0x164cbb=_0x164cbb||0xc8;return function(_0xd415a8){if(_0xd415a8){return _0x261077[_0xe68a('0x16')](_0x164cbb)[_0xe68a('0x18')](_0xd415a8);}};}function respondWithFilteredResult(_0x176517,_0x384407){return function(_0x59a199){if(_0x59a199){var _0x47e32a=_0x59a199[_0xe68a('0x19')],_0x1b6ecd=_0x384407[_0xe68a('0x1a')],_0x27486d=_0x384407['offset']+_0x384407[_0xe68a('0x1b')],_0x47ccd6;if(_0x27486d>=_0x47e32a){_0x27486d=_0x47e32a;_0x47ccd6=0xc8;}else{_0x47ccd6=0xce;}_0x176517['status'](_0x47ccd6);return _0x176517[_0xe68a('0x1c')](_0xe68a('0x1d'),_0x1b6ecd+'-'+_0x27486d+'/'+_0x47e32a)[_0xe68a('0x18')](_0x59a199);}return null;};}function patchUpdates(_0x5e008c){return function(_0x1dd4db){try{jsonpatch[_0xe68a('0x1e')](_0x1dd4db,_0x5e008c,!![]);}catch(_0x4c59e4){return BPromise[_0xe68a('0x1f')](_0x4c59e4);}return _0x1dd4db[_0xe68a('0x20')]();};}function saveUpdates(_0x458003,_0x132c7b){return function(_0x46f91e){if(_0x46f91e){return _0x46f91e[_0xe68a('0x21')](_0x458003)['then'](function(_0x2b886c){return _0x2b886c;});}return null;};}function removeEntity(_0x3a688a,_0x47f6b7){return function(_0x1f5d56){if(_0x1f5d56){return _0x1f5d56[_0xe68a('0x22')]()[_0xe68a('0x23')](function(){_0x3a688a[_0xe68a('0x16')](0xcc)[_0xe68a('0x17')]();});}};}function handleEntityNotFound(_0x6a0c05,_0x2c8360){return function(_0x4325dc){if(!_0x4325dc){_0x6a0c05[_0xe68a('0x15')](0x194);}return _0x4325dc;};}function handleError(_0x3012a4,_0x1cfb38){_0x1cfb38=_0x1cfb38||0x1f4;return function(_0xa3f21f){logger[_0xe68a('0x24')](_0xa3f21f[_0xe68a('0x25')]);if(_0xa3f21f[_0xe68a('0x26')]){delete _0xa3f21f[_0xe68a('0x26')];}_0x3012a4[_0xe68a('0x16')](_0x1cfb38)['send'](_0xa3f21f);};}exports[_0xe68a('0x27')]=function(_0x2bc943,_0x474b54){var _0x88fe2e={},_0x2b2ec5={},_0x299fe2={'count':0x0,'rows':[]};var _0x4bcc03=db[_0xe68a('0x28')][_0xe68a('0x29')];_0x2b2ec5['model']=_['keys'](_0x4bcc03);var _0x2d7452={'dateStart':_0x2bc943[_0xe68a('0x2a')]['dateStart'],'dateEnd':_0x2bc943[_0xe68a('0x2a')][_0xe68a('0x2b')]};delete _0x2bc943['query'][_0xe68a('0x2c')];delete _0x2bc943['query'][_0xe68a('0x2b')];_0x2b2ec5[_0xe68a('0x2a')]=_['keys'](_0x2bc943[_0xe68a('0x2a')]);_0x2b2ec5['filters']=_[_0xe68a('0x2d')](_0x2b2ec5[_0xe68a('0x2e')],_0x2b2ec5[_0xe68a('0x2a')]);_0x88fe2e[_0xe68a('0x2f')]=_[_0xe68a('0x2d')](_0x2b2ec5[_0xe68a('0x2e')],qs[_0xe68a('0x30')](_0x2bc943[_0xe68a('0x2a')][_0xe68a('0x30')]));_0x88fe2e[_0xe68a('0x2f')]=_0x88fe2e[_0xe68a('0x2f')][_0xe68a('0x31')]?_0x88fe2e[_0xe68a('0x2f')]:_0x2b2ec5[_0xe68a('0x2e')];if(!_0x2bc943['query']['hasOwnProperty']('nolimit')){_0x88fe2e[_0xe68a('0x1b')]=qs['limit'](_0x2bc943[_0xe68a('0x2a')]['limit']);_0x88fe2e[_0xe68a('0x1a')]=qs[_0xe68a('0x1a')](_0x2bc943[_0xe68a('0x2a')][_0xe68a('0x1a')]);}_0x88fe2e['order']=qs[_0xe68a('0x32')](_0x2bc943[_0xe68a('0x2a')][_0xe68a('0x32')]);_0x88fe2e['where']=qs[_0xe68a('0x33')](_[_0xe68a('0x34')](_0x2bc943[_0xe68a('0x2a')],_0x2b2ec5['filters']));if(_0x2d7452[_0xe68a('0x2c')]){if(_0x2d7452[_0xe68a('0x2b')]){_0x2d7452['dateEnd']=moment(_0x2d7452[_0xe68a('0x2b')])[_0xe68a('0x35')](0x1,_0xe68a('0x36'));}else{_0x2d7452['dateEnd']=moment(_0x2d7452[_0xe68a('0x2c')])['add'](0x1,_0xe68a('0x36'));}_[_0xe68a('0x37')](_0x88fe2e[_0xe68a('0x38')],{'createdAt':{'$gte':_0x2d7452[_0xe68a('0x2c')],'$lte':_0x2d7452[_0xe68a('0x2b')]}});}if(_0x2bc943[_0xe68a('0x2a')]['filter']){_0x88fe2e[_0xe68a('0x38')]=_['merge'](_0x88fe2e[_0xe68a('0x38')],{'$or':_[_0xe68a('0x39')](_0x88fe2e['attributes'],function(_0x2206b3){var _0xb2d1c4={};_0xb2d1c4[_0x2206b3]={'$like':'%'+_0x2bc943[_0xe68a('0x2a')][_0xe68a('0x3a')]+'%'};return _0xb2d1c4;})});}_0x88fe2e=_[_0xe68a('0x37')]({},_0x88fe2e,_0x2bc943[_0xe68a('0x3b')]);var _0xd26e69={'where':_0x88fe2e[_0xe68a('0x38')]};return db[_0xe68a('0x28')][_0xe68a('0x19')](_0xd26e69)[_0xe68a('0x23')](function(_0x3425ea){_0x299fe2['count']=_0x3425ea;if(_0x2bc943[_0xe68a('0x2a')]['includeAll']){_0x88fe2e['include']=[{'all':!![]}];}return db[_0xe68a('0x28')][_0xe68a('0x3c')](_0x88fe2e);})[_0xe68a('0x23')](function(_0xe392d7){_0x299fe2[_0xe68a('0x3d')]=_0xe392d7;return _0x299fe2;})['then'](respondWithFilteredResult(_0x474b54,_0x88fe2e))[_0xe68a('0x3e')](handleError(_0x474b54,null));};exports[_0xe68a('0x3f')]=function(_0x2431ba,_0x48b40a){var _0x143b64={'raw':!![],'where':{'id':_0x2431ba['params']['id']}},_0x59dee6={};_0x59dee6[_0xe68a('0x2e')]=_[_0xe68a('0x40')](db[_0xe68a('0x28')][_0xe68a('0x29')]);_0x59dee6[_0xe68a('0x2a')]=_[_0xe68a('0x40')](_0x2431ba[_0xe68a('0x2a')]);_0x59dee6[_0xe68a('0x33')]=_[_0xe68a('0x2d')](_0x59dee6[_0xe68a('0x2e')],_0x59dee6[_0xe68a('0x2a')]);_0x143b64[_0xe68a('0x2f')]=_[_0xe68a('0x2d')](_0x59dee6[_0xe68a('0x2e')],qs[_0xe68a('0x30')](_0x2431ba['query'][_0xe68a('0x30')]));_0x143b64[_0xe68a('0x2f')]=_0x143b64[_0xe68a('0x2f')][_0xe68a('0x31')]?_0x143b64[_0xe68a('0x2f')]:_0x59dee6[_0xe68a('0x2e')];if(_0x2431ba[_0xe68a('0x2a')][_0xe68a('0x41')]){_0x143b64[_0xe68a('0x42')]=[{'all':!![]}];}_0x143b64=_[_0xe68a('0x37')]({},_0x143b64,_0x2431ba['options']);return db[_0xe68a('0x28')][_0xe68a('0x43')](_0x143b64)[_0xe68a('0x23')](handleEntityNotFound(_0x48b40a,null))[_0xe68a('0x23')](respondWithResult(_0x48b40a,null))[_0xe68a('0x3e')](handleError(_0x48b40a,null));};exports[_0xe68a('0x44')]=function(_0x34b923,_0x3be17c){return db[_0xe68a('0x28')][_0xe68a('0x44')](_0x34b923[_0xe68a('0x45')],{})['then'](respondWithResult(_0x3be17c,0xc9))[_0xe68a('0x3e')](handleError(_0x3be17c,null));};exports[_0xe68a('0x21')]=function(_0x43a7e6,_0x3869a4){if(_0x43a7e6[_0xe68a('0x45')]['id']){delete _0x43a7e6['body']['id'];}return db[_0xe68a('0x28')][_0xe68a('0x43')]({'where':{'id':_0x43a7e6['params']['id']}})[_0xe68a('0x23')](handleEntityNotFound(_0x3869a4,null))[_0xe68a('0x23')](saveUpdates(_0x43a7e6[_0xe68a('0x45')],null))[_0xe68a('0x23')](respondWithResult(_0x3869a4,null))['catch'](handleError(_0x3869a4,null));};exports[_0xe68a('0x22')]=function(_0x1d2b39,_0x4ef1d3){return db[_0xe68a('0x28')][_0xe68a('0x43')]({'where':{'id':_0x1d2b39[_0xe68a('0x46')]['id']}})[_0xe68a('0x23')](handleEntityNotFound(_0x4ef1d3,null))[_0xe68a('0x23')](removeEntity(_0x4ef1d3,null))[_0xe68a('0x3e')](handleError(_0x4ef1d3,null));}; \ No newline at end of file +var _0x9fde=['SugarcrmField','includeAll','include','findAll','catch','intersection','find','create','body','params','html-pdf','eml-format','rimraf','fast-json-patch','moment','util','sox','to-csv','ejs','squel','desk.js','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','model','keys','query','dateStart','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','dateEnd','add','day','filter','merge','options'];(function(_0x456e8b,_0x5854f8){var _0xa12bfd=function(_0x1b5072){while(--_0x1b5072){_0x456e8b['push'](_0x456e8b['shift']());}};_0xa12bfd(++_0x5854f8);}(_0x9fde,0x116));var _0xe9fd=function(_0x136619,_0x31c9b2){_0x136619=_0x136619-0x0;var _0x38c4a5=_0x9fde[_0x136619];return _0x38c4a5;};'use strict';var pdf=require(_0xe9fd('0x0'));var emlformat=require(_0xe9fd('0x1'));var rimraf=require(_0xe9fd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9fd('0x3'));var rp=require('request-promise');var moment=require(_0xe9fd('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe9fd('0x5'));var path=require('path');var sox=require(_0xe9fd('0x6'));var csv=require(_0xe9fd('0x7'));var ejs=require(_0xe9fd('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe9fd('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe9fd('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe9fd('0xb'));var qs=require(_0xe9fd('0xc'));var logger=require(_0xe9fd('0xd'))('api');var utils=require(_0xe9fd('0xe'));var config=require('../../config/environment');var db=require(_0xe9fd('0xf'))['db'];function respondWithStatusCode(_0x2ec3cb,_0x3aed8d){_0x3aed8d=_0x3aed8d||0xcc;return function(_0x32655e){if(_0x32655e){return _0x2ec3cb[_0xe9fd('0x10')](_0x3aed8d);}return _0x2ec3cb[_0xe9fd('0x11')](_0x3aed8d)[_0xe9fd('0x12')]();};}function respondWithResult(_0x205d38,_0x524c5f){_0x524c5f=_0x524c5f||0xc8;return function(_0x650f04){if(_0x650f04){return _0x205d38[_0xe9fd('0x11')](_0x524c5f)[_0xe9fd('0x13')](_0x650f04);}};}function respondWithFilteredResult(_0x8b7dc,_0x5b4011){return function(_0x5ebf75){if(_0x5ebf75){var _0x2b3fbe=_0x5ebf75[_0xe9fd('0x14')],_0x346130=_0x5b4011[_0xe9fd('0x15')],_0x5174e4=_0x5b4011[_0xe9fd('0x15')]+_0x5b4011[_0xe9fd('0x16')],_0x394efc;if(_0x5174e4>=_0x2b3fbe){_0x5174e4=_0x2b3fbe;_0x394efc=0xc8;}else{_0x394efc=0xce;}_0x8b7dc['status'](_0x394efc);return _0x8b7dc[_0xe9fd('0x17')](_0xe9fd('0x18'),_0x346130+'-'+_0x5174e4+'/'+_0x2b3fbe)[_0xe9fd('0x13')](_0x5ebf75);}return null;};}function patchUpdates(_0x34d294){return function(_0x4f5232){try{jsonpatch[_0xe9fd('0x19')](_0x4f5232,_0x34d294,!![]);}catch(_0x552b23){return BPromise[_0xe9fd('0x1a')](_0x552b23);}return _0x4f5232[_0xe9fd('0x1b')]();};}function saveUpdates(_0x5f30fb,_0x469a82){return function(_0x2e1bff){if(_0x2e1bff){return _0x2e1bff[_0xe9fd('0x1c')](_0x5f30fb)[_0xe9fd('0x1d')](function(_0x5045ea){return _0x5045ea;});}return null;};}function removeEntity(_0x3b1c4f,_0x4a2344){return function(_0x13c2d0){if(_0x13c2d0){return _0x13c2d0[_0xe9fd('0x1e')]()['then'](function(){_0x3b1c4f[_0xe9fd('0x11')](0xcc)[_0xe9fd('0x12')]();});}};}function handleEntityNotFound(_0x1f2b79,_0x71792a){return function(_0x49fd70){if(!_0x49fd70){_0x1f2b79[_0xe9fd('0x10')](0x194);}return _0x49fd70;};}function handleError(_0x5b901b,_0x464764){_0x464764=_0x464764||0x1f4;return function(_0x2e6cc7){logger[_0xe9fd('0x1f')](_0x2e6cc7[_0xe9fd('0x20')]);if(_0x2e6cc7['name']){delete _0x2e6cc7[_0xe9fd('0x21')];}_0x5b901b[_0xe9fd('0x11')](_0x464764)[_0xe9fd('0x22')](_0x2e6cc7);};}exports[_0xe9fd('0x23')]=function(_0x5e12a4,_0x266531){var _0x47bceb={},_0x29970b={},_0x20f57b={'count':0x0,'rows':[]};var _0x13be42=db['SugarcrmField'][_0xe9fd('0x24')];_0x29970b[_0xe9fd('0x25')]=_[_0xe9fd('0x26')](_0x13be42);var _0x502f6e={'dateStart':_0x5e12a4[_0xe9fd('0x27')][_0xe9fd('0x28')],'dateEnd':_0x5e12a4[_0xe9fd('0x27')]['dateEnd']};delete _0x5e12a4[_0xe9fd('0x27')][_0xe9fd('0x28')];delete _0x5e12a4[_0xe9fd('0x27')]['dateEnd'];_0x29970b[_0xe9fd('0x27')]=_[_0xe9fd('0x26')](_0x5e12a4[_0xe9fd('0x27')]);_0x29970b[_0xe9fd('0x29')]=_['intersection'](_0x29970b[_0xe9fd('0x25')],_0x29970b[_0xe9fd('0x27')]);_0x47bceb[_0xe9fd('0x2a')]=_['intersection'](_0x29970b['model'],qs[_0xe9fd('0x2b')](_0x5e12a4['query'][_0xe9fd('0x2b')]));_0x47bceb[_0xe9fd('0x2a')]=_0x47bceb[_0xe9fd('0x2a')][_0xe9fd('0x2c')]?_0x47bceb['attributes']:_0x29970b[_0xe9fd('0x25')];if(!_0x5e12a4[_0xe9fd('0x27')][_0xe9fd('0x2d')](_0xe9fd('0x2e'))){_0x47bceb[_0xe9fd('0x16')]=qs['limit'](_0x5e12a4[_0xe9fd('0x27')]['limit']);_0x47bceb['offset']=qs[_0xe9fd('0x15')](_0x5e12a4[_0xe9fd('0x27')][_0xe9fd('0x15')]);}_0x47bceb[_0xe9fd('0x2f')]=qs[_0xe9fd('0x30')](_0x5e12a4[_0xe9fd('0x27')]['sort']);_0x47bceb[_0xe9fd('0x31')]=qs[_0xe9fd('0x29')](_[_0xe9fd('0x32')](_0x5e12a4[_0xe9fd('0x27')],_0x29970b[_0xe9fd('0x29')]));if(_0x502f6e[_0xe9fd('0x28')]){if(_0x502f6e[_0xe9fd('0x33')]){_0x502f6e['dateEnd']=moment(_0x502f6e[_0xe9fd('0x33')])[_0xe9fd('0x34')](0x1,_0xe9fd('0x35'));}else{_0x502f6e[_0xe9fd('0x33')]=moment(_0x502f6e[_0xe9fd('0x28')])[_0xe9fd('0x34')](0x1,'day');}_['merge'](_0x47bceb['where'],{'createdAt':{'$gte':_0x502f6e[_0xe9fd('0x28')],'$lte':_0x502f6e[_0xe9fd('0x33')]}});}if(_0x5e12a4[_0xe9fd('0x27')][_0xe9fd('0x36')]){_0x47bceb['where']=_[_0xe9fd('0x37')](_0x47bceb[_0xe9fd('0x31')],{'$or':_['map'](_0x47bceb[_0xe9fd('0x2a')],function(_0x2ced80){var _0x10eb3f={};_0x10eb3f[_0x2ced80]={'$like':'%'+_0x5e12a4[_0xe9fd('0x27')][_0xe9fd('0x36')]+'%'};return _0x10eb3f;})});}_0x47bceb=_[_0xe9fd('0x37')]({},_0x47bceb,_0x5e12a4[_0xe9fd('0x38')]);var _0x241306={'where':_0x47bceb[_0xe9fd('0x31')]};return db[_0xe9fd('0x39')][_0xe9fd('0x14')](_0x241306)[_0xe9fd('0x1d')](function(_0xa7b75c){_0x20f57b[_0xe9fd('0x14')]=_0xa7b75c;if(_0x5e12a4[_0xe9fd('0x27')][_0xe9fd('0x3a')]){_0x47bceb[_0xe9fd('0x3b')]=[{'all':!![]}];}return db[_0xe9fd('0x39')][_0xe9fd('0x3c')](_0x47bceb);})[_0xe9fd('0x1d')](function(_0x2ff18a){_0x20f57b['rows']=_0x2ff18a;return _0x20f57b;})['then'](respondWithFilteredResult(_0x266531,_0x47bceb))[_0xe9fd('0x3d')](handleError(_0x266531,null));};exports['show']=function(_0x216ba9,_0x82926){var _0x2948d2={'raw':!![],'where':{'id':_0x216ba9['params']['id']}},_0x43c6a3={};_0x43c6a3[_0xe9fd('0x25')]=_[_0xe9fd('0x26')](db['SugarcrmField'][_0xe9fd('0x24')]);_0x43c6a3[_0xe9fd('0x27')]=_[_0xe9fd('0x26')](_0x216ba9['query']);_0x43c6a3[_0xe9fd('0x29')]=_[_0xe9fd('0x3e')](_0x43c6a3[_0xe9fd('0x25')],_0x43c6a3[_0xe9fd('0x27')]);_0x2948d2[_0xe9fd('0x2a')]=_['intersection'](_0x43c6a3[_0xe9fd('0x25')],qs[_0xe9fd('0x2b')](_0x216ba9[_0xe9fd('0x27')]['fields']));_0x2948d2[_0xe9fd('0x2a')]=_0x2948d2[_0xe9fd('0x2a')]['length']?_0x2948d2['attributes']:_0x43c6a3['model'];if(_0x216ba9[_0xe9fd('0x27')][_0xe9fd('0x3a')]){_0x2948d2[_0xe9fd('0x3b')]=[{'all':!![]}];}_0x2948d2=_[_0xe9fd('0x37')]({},_0x2948d2,_0x216ba9['options']);return db[_0xe9fd('0x39')][_0xe9fd('0x3f')](_0x2948d2)[_0xe9fd('0x1d')](handleEntityNotFound(_0x82926,null))[_0xe9fd('0x1d')](respondWithResult(_0x82926,null))['catch'](handleError(_0x82926,null));};exports[_0xe9fd('0x40')]=function(_0x1f689b,_0x1c3ca6){return db['SugarcrmField'][_0xe9fd('0x40')](_0x1f689b[_0xe9fd('0x41')],{})['then'](respondWithResult(_0x1c3ca6,0xc9))[_0xe9fd('0x3d')](handleError(_0x1c3ca6,null));};exports[_0xe9fd('0x1c')]=function(_0x29425f,_0x5bffb0){if(_0x29425f['body']['id']){delete _0x29425f[_0xe9fd('0x41')]['id'];}return db[_0xe9fd('0x39')][_0xe9fd('0x3f')]({'where':{'id':_0x29425f[_0xe9fd('0x42')]['id']}})[_0xe9fd('0x1d')](handleEntityNotFound(_0x5bffb0,null))[_0xe9fd('0x1d')](saveUpdates(_0x29425f[_0xe9fd('0x41')],null))[_0xe9fd('0x1d')](respondWithResult(_0x5bffb0,null))[_0xe9fd('0x3d')](handleError(_0x5bffb0,null));};exports[_0xe9fd('0x1e')]=function(_0xca534e,_0x55f887){return db['SugarcrmField'][_0xe9fd('0x3f')]({'where':{'id':_0xca534e[_0xe9fd('0x42')]['id']}})[_0xe9fd('0x1d')](handleEntityNotFound(_0x55f887,null))[_0xe9fd('0x1d')](removeEntity(_0x55f887,null))['catch'](handleError(_0x55f887,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 3cc3b72..e77d22e 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 _0x60bb=['bluebird','request-promise','./intSugarcrmField.attributes','define','SugarcrmField','int_sugarcrm_fields','lodash','util','../../config/logger','api','moment'];(function(_0x58189d,_0x2e60d0){var _0x5a356a=function(_0x91f4ae){while(--_0x91f4ae){_0x58189d['push'](_0x58189d['shift']());}};_0x5a356a(++_0x2e60d0);}(_0x60bb,0x1ea));var _0xb60b=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x60bb[_0x556bb1];return _0x45455f;};'use strict';var _=require(_0xb60b('0x0'));var util=require(_0xb60b('0x1'));var logger=require(_0xb60b('0x2'))(_0xb60b('0x3'));var moment=require(_0xb60b('0x4'));var BPromise=require(_0xb60b('0x5'));var rp=require(_0xb60b('0x6'));var attributes=require(_0xb60b('0x7'));module['exports']=function(_0x54a4b2,_0x501dfc){return _0x54a4b2[_0xb60b('0x8')](_0xb60b('0x9'),attributes,{'tableName':_0xb60b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a47=['moment','request-promise','./intSugarcrmField.attributes','define','SugarcrmField','int_sugarcrm_fields','lodash','util','../../config/logger','api'];(function(_0x36dced,_0x1df299){var _0x5b7fe8=function(_0x36ed16){while(--_0x36ed16){_0x36dced['push'](_0x36dced['shift']());}};_0x5b7fe8(++_0x1df299);}(_0x9a47,0xd8));var _0x79a4=function(_0x2124ee,_0x251257){_0x2124ee=_0x2124ee-0x0;var _0x48ad5b=_0x9a47[_0x2124ee];return _0x48ad5b;};'use strict';var _=require(_0x79a4('0x0'));var util=require(_0x79a4('0x1'));var logger=require(_0x79a4('0x2'))(_0x79a4('0x3'));var moment=require(_0x79a4('0x4'));var BPromise=require('bluebird');var rp=require(_0x79a4('0x5'));var attributes=require(_0x79a4('0x6'));module['exports']=function(_0x4aa0c1,_0x4650bd){return _0x4aa0c1[_0x79a4('0x7')](_0x79a4('0x8'),attributes,{'tableName':_0x79a4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index d5e3d15..7839b0d 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 _0xe360=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','result','catch','util','bluebird'];(function(_0x57f1a0,_0x383ddb){var _0x41d029=function(_0x11ae03){while(--_0x11ae03){_0x57f1a0['push'](_0x57f1a0['shift']());}};_0x41d029(++_0x383ddb);}(_0xe360,0x1b6));var _0x0e36=function(_0x3a7a9c,_0x24f7d6){_0x3a7a9c=_0x3a7a9c-0x0;var _0x59156e=_0xe360[_0x3a7a9c];return _0x59156e;};'use strict';var _=require('lodash');var util=require(_0x0e36('0x0'));var moment=require('moment');var BPromise=require(_0x0e36('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0e36('0x2'));var db=require(_0x0e36('0x3'))['db'];var utils=require(_0x0e36('0x4'));var logger=require(_0x0e36('0x5'))(_0x0e36('0x6'));var config=require(_0x0e36('0x7'));var jayson=require(_0x0e36('0x8'));var client=jayson[_0x0e36('0x9')][_0x0e36('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30bada,_0x38f0c9,_0xfb7068){return new BPromise(function(_0x3fcc0b,_0x5ee6e5){return client['request'](_0x30bada,_0xfb7068)[_0x0e36('0xb')](function(_0x1d2124){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x38f0c9,_0x0e36('0xc'));logger[_0x0e36('0xd')](_0x0e36('0xe'),_0x38f0c9,'request\x20sent',JSON[_0x0e36('0xf')](_0x1d2124));if(_0x1d2124['error']){if(_0x1d2124[_0x0e36('0x10')][_0x0e36('0x11')]===0x1f4){logger[_0x0e36('0x10')](_0x0e36('0x12'),_0x38f0c9,_0x1d2124[_0x0e36('0x10')]['message']);return _0x5ee6e5(_0x1d2124[_0x0e36('0x10')]['message']);}logger['error'](_0x0e36('0x12'),_0x38f0c9,_0x1d2124[_0x0e36('0x10')]['message']);return _0x3fcc0b(_0x1d2124[_0x0e36('0x10')][_0x0e36('0x13')]);}else{logger['info']('SugarcrmField,\x20%s,\x20%s',_0x38f0c9,_0x0e36('0xc'));_0x3fcc0b(_0x1d2124[_0x0e36('0x14')][_0x0e36('0x13')]);}})[_0x0e36('0x15')](function(_0x42db62){logger[_0x0e36('0x10')](_0x0e36('0x12'),_0x38f0c9,_0x42db62);_0x5ee6e5(_0x42db62);});});} \ No newline at end of file +var _0xffd4=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x1b06b4,_0x24571d){var _0x425537=function(_0x1383ed){while(--_0x1383ed){_0x1b06b4['push'](_0x1b06b4['shift']());}};_0x425537(++_0x24571d);}(_0xffd4,0x154));var _0x4ffd=function(_0x4f7280,_0x3f94b5){_0x4f7280=_0x4f7280-0x0;var _0x55d380=_0xffd4[_0x4f7280];return _0x55d380;};'use strict';var _=require(_0x4ffd('0x0'));var util=require(_0x4ffd('0x1'));var moment=require(_0x4ffd('0x2'));var BPromise=require('bluebird');var rs=require(_0x4ffd('0x3'));var fs=require('fs');var Redis=require(_0x4ffd('0x4'));var db=require(_0x4ffd('0x5'))['db'];var utils=require(_0x4ffd('0x6'));var logger=require(_0x4ffd('0x7'))(_0x4ffd('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4ffd('0x9')][_0x4ffd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfd1bd9,_0x2638ed,_0x2e9b67){return new BPromise(function(_0x586cef,_0x2ec08f){return client[_0x4ffd('0xb')](_0xfd1bd9,_0x2e9b67)['then'](function(_0x3d6b13){logger[_0x4ffd('0xc')](_0x4ffd('0xd'),_0x2638ed,_0x4ffd('0xe'));logger[_0x4ffd('0xf')](_0x4ffd('0x10'),_0x2638ed,'request\x20sent',JSON[_0x4ffd('0x11')](_0x3d6b13));if(_0x3d6b13['error']){if(_0x3d6b13[_0x4ffd('0x12')][_0x4ffd('0x13')]===0x1f4){logger[_0x4ffd('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x2638ed,_0x3d6b13['error'][_0x4ffd('0x14')]);return _0x2ec08f(_0x3d6b13[_0x4ffd('0x12')][_0x4ffd('0x14')]);}logger['error'](_0x4ffd('0xd'),_0x2638ed,_0x3d6b13[_0x4ffd('0x12')][_0x4ffd('0x14')]);return _0x586cef(_0x3d6b13['error']['message']);}else{logger[_0x4ffd('0xc')]('SugarcrmField,\x20%s,\x20%s',_0x2638ed,_0x4ffd('0xe'));_0x586cef(_0x3d6b13[_0x4ffd('0x15')][_0x4ffd('0x14')]);}})[_0x4ffd('0x16')](function(_0x9ae7cf){logger[_0x4ffd('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x2638ed,_0x9ae7cf);_0x2ec08f(_0x9ae7cf);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index bfcf2fd..cebc3fe 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 _0x6cad=['post','/:id/configurations','addConfiguration','put','/:id','update','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','show','getConfigurations','getFields'];(function(_0x1879a4,_0x581a4a){var _0x38e837=function(_0x699402){while(--_0x699402){_0x1879a4['push'](_0x1879a4['shift']());}};_0x38e837(++_0x581a4a);}(_0x6cad,0x168));var _0xd6ca=function(_0x234dcd,_0x2fc61e){_0x234dcd=_0x234dcd-0x0;var _0x1abe75=_0x6cad[_0x234dcd];return _0x1abe75;};'use strict';var multer=require(_0xd6ca('0x0'));var util=require(_0xd6ca('0x1'));var path=require(_0xd6ca('0x2'));var timeout=require('connect-timeout');var express=require(_0xd6ca('0x3'));var router=express['Router']();var auth=require(_0xd6ca('0x4'));var interaction=require(_0xd6ca('0x5'));var config=require(_0xd6ca('0x6'));var controller=require(_0xd6ca('0x7'));router[_0xd6ca('0x8')]('/',auth[_0xd6ca('0x9')](),controller[_0xd6ca('0xa')]);router[_0xd6ca('0x8')]('/:id',auth[_0xd6ca('0x9')](),controller[_0xd6ca('0xb')]);router[_0xd6ca('0x8')]('/:id/configurations',auth[_0xd6ca('0x9')](),controller[_0xd6ca('0xc')]);router[_0xd6ca('0x8')]('/:id/fields',auth[_0xd6ca('0x9')](),controller[_0xd6ca('0xd')]);router[_0xd6ca('0xe')]('/',auth[_0xd6ca('0x9')](),controller['create']);router['post'](_0xd6ca('0xf'),auth[_0xd6ca('0x9')](),controller[_0xd6ca('0x10')]);router[_0xd6ca('0x11')](_0xd6ca('0x12'),auth[_0xd6ca('0x9')](),controller[_0xd6ca('0x13')]);router['delete'](_0xd6ca('0x12'),auth[_0xd6ca('0x9')](),controller[_0xd6ca('0x14')]);module[_0xd6ca('0x15')]=router; \ No newline at end of file +var _0x6c1a=['/:id','show','/:id/configurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','path','express','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6c1a,0xfc));var _0xa6c1=function(_0x447681,_0x3f4cb7){_0x447681=_0x447681-0x0;var _0x4cfe01=_0x6c1a[_0x447681];return _0x4cfe01;};'use strict';var multer=require(_0xa6c1('0x0'));var util=require('util');var path=require(_0xa6c1('0x1'));var timeout=require('connect-timeout');var express=require(_0xa6c1('0x2'));var router=express['Router']();var auth=require(_0xa6c1('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa6c1('0x4'));var controller=require(_0xa6c1('0x5'));router[_0xa6c1('0x6')]('/',auth[_0xa6c1('0x7')](),controller['index']);router[_0xa6c1('0x6')](_0xa6c1('0x8'),auth[_0xa6c1('0x7')](),controller[_0xa6c1('0x9')]);router[_0xa6c1('0x6')](_0xa6c1('0xa'),auth[_0xa6c1('0x7')](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0xa6c1('0x7')](),controller[_0xa6c1('0xb')]);router[_0xa6c1('0xc')]('/',auth[_0xa6c1('0x7')](),controller[_0xa6c1('0xd')]);router[_0xa6c1('0xc')](_0xa6c1('0xa'),auth[_0xa6c1('0x7')](),controller[_0xa6c1('0xe')]);router[_0xa6c1('0xf')](_0xa6c1('0x8'),auth[_0xa6c1('0x7')](),controller[_0xa6c1('0x10')]);router[_0xa6c1('0x11')]('/:id',auth[_0xa6c1('0x7')](),controller[_0xa6c1('0x12')]);module[_0xa6c1('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 2630208..c6537d9 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 _0xfef0=['STRING','HelpDesk','sequelize'];(function(_0x457aa9,_0x2db9e3){var _0x2b090f=function(_0x2b2804){while(--_0x2b2804){_0x457aa9['push'](_0x457aa9['shift']());}};_0x2b090f(++_0x2db9e3);}(_0xfef0,0x65));var _0x0fef=function(_0x3a4ca3,_0x304192){_0x3a4ca3=_0x3a4ca3-0x0;var _0x590b08=_0xfef0[_0x3a4ca3];return _0x590b08;};'use strict';var Sequelize=require(_0x0fef('0x0'));module['exports']={'name':{'type':Sequelize[_0x0fef('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x0fef('0x1')]},'username':{'type':Sequelize[_0x0fef('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x0fef('0x1')],'allowNull':![],'defaultValue':_0x0fef('0x2')},'remoteUri':{'type':Sequelize[_0x0fef('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x0fef('0x1')]},'accessKey':{'type':Sequelize[_0x0fef('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xbb5e=['HelpDesk','STRING'];(function(_0x5e7baf,_0x11000c){var _0x9b1443=function(_0x199626){while(--_0x199626){_0x5e7baf['push'](_0x5e7baf['shift']());}};_0x9b1443(++_0x11000c);}(_0xbb5e,0xc7));var _0xebb5=function(_0x4a95f9,_0x227823){_0x4a95f9=_0x4a95f9-0x0;var _0x39a4a0=_0xbb5e[_0x4a95f9];return _0x39a4a0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xebb5('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xebb5('0x0')]},'username':{'type':Sequelize[_0xebb5('0x0')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xebb5('0x0')],'allowNull':![],'defaultValue':_0xebb5('0x1')},'remoteUri':{'type':Sequelize[_0xebb5('0x0')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xebb5('0x0')]},'accessKey':{'type':Sequelize[_0xebb5('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index b90ce60..4381029 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 _0x2a29=['html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','then','destroy','stack','name','model','query','dateEnd','dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','filter','merge','options','VtigerAccount','count','includeAll','findAll','catch','params','keys','rawAttributes','include','find','create','body','update','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','VtigerField','moduleName','remoteUri','serverUrl','accessKey','username','format','%s/webservice.php','POST','login','result','GET','describe','sessionName','success','autogenerated','owner','includes','remove','editable','false','map','label','cf_','picklistValues','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','test','Wrong\x20credentials'];(function(_0xe3f0b0,_0x43edc9){var _0x3a839e=function(_0x45e9cf){while(--_0x45e9cf){_0xe3f0b0['push'](_0xe3f0b0['shift']());}};_0x3a839e(++_0x43edc9);}(_0x2a29,0xf8));var _0x92a2=function(_0x4c608b,_0x5d073f){_0x4c608b=_0x4c608b-0x0;var _0x5af195=_0x2a29[_0x4c608b];return _0x5af195;};'use strict';var pdf=require(_0x92a2('0x0'));var emlformat=require(_0x92a2('0x1'));var rimraf=require(_0x92a2('0x2'));var zipdir=require(_0x92a2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x92a2('0x4'));var moment=require(_0x92a2('0x5'));var BPromise=require(_0x92a2('0x6'));var Mustache=require(_0x92a2('0x7'));var util=require(_0x92a2('0x8'));var path=require(_0x92a2('0x9'));var sox=require(_0x92a2('0xa'));var csv=require(_0x92a2('0xb'));var ejs=require(_0x92a2('0xc'));var fs=require('fs');var _=require(_0x92a2('0xd'));var squel=require('squel');var crypto=require(_0x92a2('0xe'));var jsforce=require(_0x92a2('0xf'));var deskjs=require(_0x92a2('0x10'));var toCsv=require(_0x92a2('0xb'));var querystring=require(_0x92a2('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var qs=require(_0x92a2('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x92a2('0x13'));var config=require('../../config/environment');var db=require(_0x92a2('0x14'))['db'];var integrations=require(_0x92a2('0x15'));var jayson=require(_0x92a2('0x16'));var client=jayson[_0x92a2('0x17')][_0x92a2('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x29eb79,_0x2ab8d9,_0x359e9c,_0x1e513a){return new BPromise(function(_0x3d34ec,_0x4143a7){var _0x1dc865=_0x1e513a||client;return _0x1dc865[_0x92a2('0x19')](_0x29eb79,_0x359e9c)['then'](function(_0x557dfa){logger[_0x92a2('0x1a')](_0x92a2('0x1b'),_0x2ab8d9,'request\x20sent');logger[_0x92a2('0x1c')](_0x92a2('0x1d'),_0x2ab8d9,_0x92a2('0x1e'),JSON[_0x92a2('0x1f')](_0x557dfa));if(_0x557dfa[_0x92a2('0x20')]){if(_0x557dfa[_0x92a2('0x20')]['code']===0x1f4){logger['error'](_0x92a2('0x1b'),_0x2ab8d9,_0x557dfa[_0x92a2('0x20')]['message']);return _0x4143a7(_0x557dfa[_0x92a2('0x20')][_0x92a2('0x21')]);}logger['error'](_0x92a2('0x1b'),_0x2ab8d9,_0x557dfa['error'][_0x92a2('0x21')]);return _0x3d34ec(_0x557dfa['error']['message']);}else{logger[_0x92a2('0x1a')](_0x92a2('0x1b'),_0x2ab8d9,_0x92a2('0x1e'));_0x3d34ec(_0x557dfa['result'][_0x92a2('0x21')]);}})['catch'](function(_0x5dd8e4){logger[_0x92a2('0x20')](_0x92a2('0x1b'),_0x2ab8d9,_0x5dd8e4);_0x4143a7(_0x5dd8e4);});});}function respondWithStatusCode(_0x48e519,_0x4823a1){_0x4823a1=_0x4823a1||0xcc;return function(_0x2a8849){if(_0x2a8849){return _0x48e519[_0x92a2('0x22')](_0x4823a1);}return _0x48e519[_0x92a2('0x23')](_0x4823a1)[_0x92a2('0x24')]();};}function respondWithResult(_0x108f9a,_0x199ed9){_0x199ed9=_0x199ed9||0xc8;return function(_0x15a8e0){if(_0x15a8e0){return _0x108f9a[_0x92a2('0x23')](_0x199ed9)[_0x92a2('0x25')](_0x15a8e0);}};}function respondWithFilteredResult(_0x47ed56,_0x71ac96){return function(_0x57fc0f){if(_0x57fc0f){var _0x104d10=_0x57fc0f['count'],_0x729883=_0x71ac96[_0x92a2('0x26')],_0x24044d=_0x71ac96[_0x92a2('0x26')]+_0x71ac96[_0x92a2('0x27')],_0x17785b;if(_0x24044d>=_0x104d10){_0x24044d=_0x104d10;_0x17785b=0xc8;}else{_0x17785b=0xce;}_0x47ed56[_0x92a2('0x23')](_0x17785b);return _0x47ed56['set'](_0x92a2('0x28'),_0x729883+'-'+_0x24044d+'/'+_0x104d10)[_0x92a2('0x25')](_0x57fc0f);}return null;};}function patchUpdates(_0x4d34f8){return function(_0x5637a5){try{jsonpatch[_0x92a2('0x29')](_0x5637a5,_0x4d34f8,!![]);}catch(_0x18e7a6){return BPromise[_0x92a2('0x2a')](_0x18e7a6);}return _0x5637a5[_0x92a2('0x2b')]();};}function saveUpdates(_0x2a2367,_0x1ea1b2){return function(_0x2ffb20){if(_0x2ffb20){return _0x2ffb20['update'](_0x2a2367)[_0x92a2('0x2c')](function(_0x5b524f){return _0x5b524f;});}return null;};}function removeEntity(_0x4dd79e,_0x11e54b){return function(_0x2fd102){if(_0x2fd102){return _0x2fd102[_0x92a2('0x2d')]()[_0x92a2('0x2c')](function(){_0x4dd79e[_0x92a2('0x23')](0xcc)[_0x92a2('0x24')]();});}};}function handleEntityNotFound(_0x16a970,_0x2ae591){return function(_0x5677e1){if(!_0x5677e1){_0x16a970[_0x92a2('0x22')](0x194);}return _0x5677e1;};}function handleError(_0x172de7,_0x457679){_0x457679=_0x457679||0x1f4;return function(_0x5aadc6){logger[_0x92a2('0x20')](_0x5aadc6[_0x92a2('0x2e')]);if(_0x5aadc6['name']){delete _0x5aadc6[_0x92a2('0x2f')];}_0x172de7['status'](_0x457679)['send'](_0x5aadc6);};}exports['index']=function(_0x14deb8,_0x1ed3aa){var _0x353127={},_0xb8fd29={},_0x120ca5={'count':0x0,'rows':[]};var _0x388cf2=db['VtigerAccount']['rawAttributes'];_0xb8fd29[_0x92a2('0x30')]=_['keys'](_0x388cf2);var _0x33ef39={'dateStart':_0x14deb8[_0x92a2('0x31')]['dateStart'],'dateEnd':_0x14deb8[_0x92a2('0x31')][_0x92a2('0x32')]};delete _0x14deb8[_0x92a2('0x31')][_0x92a2('0x33')];delete _0x14deb8[_0x92a2('0x31')]['dateEnd'];_0xb8fd29[_0x92a2('0x31')]=_['keys'](_0x14deb8[_0x92a2('0x31')]);_0xb8fd29[_0x92a2('0x34')]=_[_0x92a2('0x35')](_0xb8fd29['model'],_0xb8fd29[_0x92a2('0x31')]);_0x353127[_0x92a2('0x36')]=_['intersection'](_0xb8fd29[_0x92a2('0x30')],qs[_0x92a2('0x37')](_0x14deb8[_0x92a2('0x31')]['fields']));_0x353127[_0x92a2('0x36')]=_0x353127['attributes'][_0x92a2('0x38')]?_0x353127[_0x92a2('0x36')]:_0xb8fd29[_0x92a2('0x30')];if(!_0x14deb8[_0x92a2('0x31')][_0x92a2('0x39')](_0x92a2('0x3a'))){_0x353127[_0x92a2('0x27')]=qs[_0x92a2('0x27')](_0x14deb8[_0x92a2('0x31')][_0x92a2('0x27')]);_0x353127[_0x92a2('0x26')]=qs[_0x92a2('0x26')](_0x14deb8['query']['offset']);}_0x353127[_0x92a2('0x3b')]=qs[_0x92a2('0x3c')](_0x14deb8[_0x92a2('0x31')][_0x92a2('0x3c')]);_0x353127[_0x92a2('0x3d')]=qs[_0x92a2('0x34')](_[_0x92a2('0x3e')](_0x14deb8[_0x92a2('0x31')],_0xb8fd29['filters']));if(_0x33ef39[_0x92a2('0x33')]){if(_0x33ef39[_0x92a2('0x32')]){_0x33ef39[_0x92a2('0x32')]=moment(_0x33ef39[_0x92a2('0x32')])['add'](0x1,'day');}else{_0x33ef39['dateEnd']=moment(_0x33ef39['dateStart'])[_0x92a2('0x3f')](0x1,_0x92a2('0x40'));}_['merge'](_0x353127[_0x92a2('0x3d')],{'createdAt':{'$gte':_0x33ef39[_0x92a2('0x33')],'$lte':_0x33ef39[_0x92a2('0x32')]}});}if(_0x14deb8[_0x92a2('0x31')][_0x92a2('0x41')]){_0x353127['where']=_[_0x92a2('0x42')](_0x353127[_0x92a2('0x3d')],{'$or':_['map'](_0x353127[_0x92a2('0x36')],function(_0x57c745){var _0x1eb5a3={};_0x1eb5a3[_0x57c745]={'$like':'%'+_0x14deb8['query'][_0x92a2('0x41')]+'%'};return _0x1eb5a3;})});}_0x353127=_[_0x92a2('0x42')]({},_0x353127,_0x14deb8[_0x92a2('0x43')]);var _0x40010b={'where':_0x353127[_0x92a2('0x3d')]};return db[_0x92a2('0x44')]['count'](_0x40010b)['then'](function(_0x26b7e1){_0x120ca5[_0x92a2('0x45')]=_0x26b7e1;if(_0x14deb8[_0x92a2('0x31')][_0x92a2('0x46')]){_0x353127['include']=[{'all':!![]}];}return db[_0x92a2('0x44')][_0x92a2('0x47')](_0x353127);})['then'](function(_0x28278e){_0x120ca5['rows']=_0x28278e;return _0x120ca5;})[_0x92a2('0x2c')](respondWithFilteredResult(_0x1ed3aa,_0x353127))[_0x92a2('0x48')](handleError(_0x1ed3aa,null));};exports['show']=function(_0x19292e,_0x310f4f){var _0x141ef8={'raw':![],'where':{'id':_0x19292e[_0x92a2('0x49')]['id']}},_0x2040f4={};_0x2040f4[_0x92a2('0x30')]=_[_0x92a2('0x4a')](db[_0x92a2('0x44')][_0x92a2('0x4b')]);_0x2040f4[_0x92a2('0x31')]=_[_0x92a2('0x4a')](_0x19292e['query']);_0x2040f4[_0x92a2('0x34')]=_['intersection'](_0x2040f4[_0x92a2('0x30')],_0x2040f4[_0x92a2('0x31')]);_0x141ef8[_0x92a2('0x36')]=_['intersection'](_0x2040f4[_0x92a2('0x30')],qs['fields'](_0x19292e[_0x92a2('0x31')]['fields']));_0x141ef8['attributes']=_0x141ef8[_0x92a2('0x36')][_0x92a2('0x38')]?_0x141ef8[_0x92a2('0x36')]:_0x2040f4['model'];if(_0x19292e[_0x92a2('0x31')][_0x92a2('0x46')]){_0x141ef8[_0x92a2('0x4c')]=[{'all':!![]}];}_0x141ef8=_[_0x92a2('0x42')]({},_0x141ef8,_0x19292e[_0x92a2('0x43')]);return db[_0x92a2('0x44')][_0x92a2('0x4d')](_0x141ef8)[_0x92a2('0x2c')](handleEntityNotFound(_0x310f4f,null))[_0x92a2('0x2c')](respondWithResult(_0x310f4f,null))[_0x92a2('0x48')](handleError(_0x310f4f,null));};exports[_0x92a2('0x4e')]=function(_0x2987c3,_0x337dd8){return db[_0x92a2('0x44')]['create'](_0x2987c3[_0x92a2('0x4f')],{})['then'](respondWithResult(_0x337dd8,0xc9))['catch'](handleError(_0x337dd8,null));};exports[_0x92a2('0x50')]=function(_0x173b43,_0x20b5f4){if(_0x173b43[_0x92a2('0x4f')]['id']){delete _0x173b43[_0x92a2('0x4f')]['id'];}return db[_0x92a2('0x44')][_0x92a2('0x4d')]({'where':{'id':_0x173b43[_0x92a2('0x49')]['id']}})[_0x92a2('0x2c')](handleEntityNotFound(_0x20b5f4,null))['then'](saveUpdates(_0x173b43[_0x92a2('0x4f')],null))['then'](respondWithResult(_0x20b5f4,null))[_0x92a2('0x48')](handleError(_0x20b5f4,null));};exports[_0x92a2('0x2d')]=function(_0x175dba,_0x180a41){return db[_0x92a2('0x44')]['find']({'where':{'id':_0x175dba[_0x92a2('0x49')]['id']}})[_0x92a2('0x2c')](handleEntityNotFound(_0x180a41,null))[_0x92a2('0x2c')](removeEntity(_0x180a41,null))[_0x92a2('0x48')](handleError(_0x180a41,null));};exports[_0x92a2('0x51')]=function(_0x4ccf96,_0x38acc2,_0x32f2fe){var _0x5e895c={};var _0x45998a={};var _0x2c6917;var _0x385dab;return db[_0x92a2('0x44')][_0x92a2('0x52')]({'where':{'id':_0x4ccf96[_0x92a2('0x49')]['id']}})['then'](handleEntityNotFound(_0x38acc2,null))['then'](function(_0x58724f){if(_0x58724f){_0x2c6917=_0x58724f;_0x45998a[_0x92a2('0x30')]=_['keys'](db[_0x92a2('0x53')]['rawAttributes']);_0x45998a[_0x92a2('0x31')]=_[_0x92a2('0x4a')](_0x4ccf96['query']);_0x45998a['filters']=_['intersection'](_0x45998a[_0x92a2('0x30')],_0x45998a[_0x92a2('0x31')]);_0x5e895c['attributes']=_[_0x92a2('0x35')](_0x45998a[_0x92a2('0x30')],qs[_0x92a2('0x37')](_0x4ccf96[_0x92a2('0x31')][_0x92a2('0x37')]));_0x5e895c[_0x92a2('0x36')]=_0x5e895c[_0x92a2('0x36')][_0x92a2('0x38')]?_0x5e895c['attributes']:_0x45998a[_0x92a2('0x30')];_0x5e895c[_0x92a2('0x3b')]=qs['sort'](_0x4ccf96[_0x92a2('0x31')][_0x92a2('0x3c')]);_0x5e895c[_0x92a2('0x3d')]=qs[_0x92a2('0x34')](_[_0x92a2('0x3e')](_0x4ccf96['query'],_0x45998a[_0x92a2('0x34')]));if(_0x4ccf96[_0x92a2('0x31')][_0x92a2('0x41')]){_0x5e895c[_0x92a2('0x3d')]=_[_0x92a2('0x42')](_0x5e895c[_0x92a2('0x3d')],{'$or':_['map'](_0x5e895c[_0x92a2('0x36')],function(_0x2f4160){var _0x467866={};_0x467866[_0x2f4160]={'$like':'%'+_0x4ccf96[_0x92a2('0x31')]['filter']+'%'};return _0x467866;})});}_0x5e895c=_[_0x92a2('0x42')]({},_0x5e895c,_0x4ccf96[_0x92a2('0x43')]);return _0x2c6917[_0x92a2('0x51')](_0x5e895c);}})[_0x92a2('0x2c')](function(_0x11fc69){if(_0x11fc69){_0x385dab=_0x11fc69['length'];if(!_0x4ccf96[_0x92a2('0x31')][_0x92a2('0x39')](_0x92a2('0x3a'))){_0x5e895c[_0x92a2('0x27')]=qs['limit'](_0x4ccf96[_0x92a2('0x31')][_0x92a2('0x27')]);_0x5e895c[_0x92a2('0x26')]=qs[_0x92a2('0x26')](_0x4ccf96['query'][_0x92a2('0x26')]);}return _0x2c6917[_0x92a2('0x51')](_0x5e895c);}})[_0x92a2('0x2c')](function(_0x478eec){if(_0x478eec){return _0x478eec?{'count':_0x385dab,'rows':_0x478eec}:null;}})[_0x92a2('0x2c')](respondWithResult(_0x38acc2,null))['catch'](handleError(_0x38acc2,null));};exports[_0x92a2('0x54')]=function(_0x606a99,_0x32da8a,_0x18cab5){if(_0x606a99[_0x92a2('0x4f')]['id']){delete _0x606a99['body']['id'];}return db[_0x92a2('0x44')][_0x92a2('0x52')]({'where':{'id':_0x606a99[_0x92a2('0x49')]['id']}})[_0x92a2('0x2c')](handleEntityNotFound(_0x32da8a,null))[_0x92a2('0x2c')](function(_0x5123db){if(_0x5123db){_0x606a99['body'][_0x92a2('0x55')]=_0x5123db['id'];_0x606a99[_0x92a2('0x4f')][_0x92a2('0x56')]=integrations[_0x92a2('0x57')](_0x606a99[_0x92a2('0x4f')][_0x92a2('0x58')],_0x606a99[_0x92a2('0x4f')][_0x92a2('0x59')]);_0x606a99[_0x92a2('0x4f')][_0x92a2('0x5a')]=integrations[_0x92a2('0x5b')](_0x606a99[_0x92a2('0x4f')]['channel'],_0x606a99['body'][_0x92a2('0x59')]);return db[_0x92a2('0x53')][_0x92a2('0x4e')](_0x606a99['body'],{'include':[{'model':db[_0x92a2('0x5c')],'as':_0x92a2('0x56')},{'model':db[_0x92a2('0x5c')],'as':_0x92a2('0x5a')}]});}return null;})['then'](respondWithResult(_0x32da8a,null))[_0x92a2('0x48')](handleError(_0x32da8a,null));};var md5=require('md5');exports['getFields']=function(_0xcfb8a0,_0x44fc11,_0x2bf987){var _0x564bdd=null;var _0x5551dd=null;var _0x1ccf0a=null;var _0x47fa71=null;return db[_0x92a2('0x44')][_0x92a2('0x52')]({'where':{'id':_0xcfb8a0[_0x92a2('0x49')]['id']},'attributes':['id',_0x92a2('0x2f'),'username','description',_0x92a2('0x5d'),_0x92a2('0x5e'),_0x92a2('0x5f'),_0x92a2('0x60')]})[_0x92a2('0x2c')](handleEntityNotFound(_0x44fc11,null))['then'](function(_0x1eaf80){if(_0x1eaf80){_0x564bdd=_0x1eaf80[_0x92a2('0x61')];_0x5551dd=_0x1eaf80[_0x92a2('0x60')];_0x1ccf0a=_0x1eaf80[_0x92a2('0x5d')];_0x47fa71=util[_0x92a2('0x62')](_0x92a2('0x63'),_0x1eaf80[_0x92a2('0x5e')]);var _0x16bb81={'method':'GET','uri':_0x47fa71,'qs':{'operation':'getchallenge','username':_0x1eaf80[_0x92a2('0x61')]},'json':!![]};return rp(_0x16bb81);}})['then'](function(_0x4d3dc0){if(_0x4d3dc0['success']){var _0x148f44={'method':_0x92a2('0x64'),'uri':_0x47fa71,'form':{'operation':_0x92a2('0x65'),'username':_0x564bdd,'accessKey':md5(_0x4d3dc0[_0x92a2('0x66')]['token']+_0x5551dd)},'json':!![]};return rp(_0x148f44);}})['then'](function(_0x325b29){if(_0x325b29['success']){var _0xd9bb20={'method':_0x92a2('0x67'),'uri':_0x47fa71,'qs':{'operation':_0x92a2('0x68'),'username':_0x564bdd,'sessionName':_0x325b29['result'][_0x92a2('0x69')],'elementType':_0x1ccf0a},'json':!![]};return rp(_0xd9bb20);}})[_0x92a2('0x2c')](function(_0x2cedd1){if(_0x2cedd1[_0x92a2('0x6a')]){var _0x5d2dc8=[_0x92a2('0x6b'),'reference',_0x92a2('0x6c')];_['remove'](_0x2cedd1[_0x92a2('0x66')]['fields'],function(_0x7cb1a5){return _0x5d2dc8[_0x92a2('0x6d')](_0x7cb1a5['type'][_0x92a2('0x2f')]);});_[_0x92a2('0x6e')](_0x2cedd1[_0x92a2('0x66')]['fields'],function(_0xe14225){return _0xe14225[_0x92a2('0x6f')]===_0x92a2('0x70');});return{'count':_0x2cedd1[_0x92a2('0x66')][_0x92a2('0x37')]['length'],'rows':_[_0x92a2('0x71')](_0x2cedd1[_0x92a2('0x66')][_0x92a2('0x37')],function(_0x302de4){return{'id':_0x302de4[_0x92a2('0x2f')],'name':_0x302de4[_0x92a2('0x72')],'custom':_['startsWith'](_0x302de4[_0x92a2('0x2f')],_0x92a2('0x73'))?!![]:![],'options':_0x302de4[_0x92a2('0x59')][_0x92a2('0x2f')]==='picklist'&&_0x302de4[_0x92a2('0x59')]['picklistValues']['length']>0x0?_['map'](_0x302de4[_0x92a2('0x59')][_0x92a2('0x74')],function(_0x3af159){return{'name':_0x3af159[_0x92a2('0x72')],'value':_0x3af159['value']};}):[]};})};}})[_0x92a2('0x2c')](respondWithResult(_0x44fc11,null))[_0x92a2('0x48')](function(_0x381c3c){console['log'](_0x92a2('0x75')+_0x381c3c);var _0x957ae9=_0xcfb8a0['query']['test']?0x1f4:_0x381c3c[_0x92a2('0x76')]||0x1f4;logger['error'](_0x92a2('0x77'),_0x92a2('0x78'),_0x957ae9,JSON[_0x92a2('0x1f')](_0x381c3c));delete _0x381c3c['name'];if(_0x957ae9===0x191){_0x957ae9=0x190;}_0x44fc11[_0x92a2('0x23')](_0x957ae9)[_0x92a2('0x79')](_0xcfb8a0[_0x92a2('0x31')][_0x92a2('0x7a')]?{'message':_0x92a2('0x7b'),'statusCode':_0x381c3c['statusCode']}:_0x381c3c);});}; \ No newline at end of file +var _0x304d=['../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s','VtigerAccount,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','sendStatus','stack','name','rawAttributes','model','keys','query','dateStart','dateEnd','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','day','add','merge','map','filter','options','VtigerAccount','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','channel','type','Descriptions','getDescriptions','VtigerField','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','format','%s/webservice.php','GET','getchallenge','POST','login','result','token','sessionName','success','autogenerated','owner','remove','includes','editable','false','startsWith','picklist','picklistValues','label','value','log','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils'];(function(_0x2e8435,_0x329cc4){var _0x11fdca=function(_0x3c3059){while(--_0x3c3059){_0x2e8435['push'](_0x2e8435['shift']());}};_0x11fdca(++_0x329cc4);}(_0x304d,0xe9));var _0xd304=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x304d[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd304('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd304('0x1'));var jsonpatch=require(_0xd304('0x2'));var rp=require(_0xd304('0x3'));var moment=require(_0xd304('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd304('0x5'));var util=require(_0xd304('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xd304('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd304('0x8'));var crypto=require(_0xd304('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd304('0xa'));var Papa=require(_0xd304('0xb'));var Redis=require(_0xd304('0xc'));var qs=require(_0xd304('0xd'));var logger=require(_0xd304('0xe'))(_0xd304('0xf'));var utils=require(_0xd304('0x10'));var config=require(_0xd304('0x11'));var db=require(_0xd304('0x12'))['db'];var integrations=require(_0xd304('0x13'));var jayson=require(_0xd304('0x14'));var client=jayson[_0xd304('0x15')][_0xd304('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x4cfa5c,_0x29857e,_0x3b44fc,_0x170026){return new BPromise(function(_0x123c43,_0x7322f){var _0x3c06ed=_0x170026||client;return _0x3c06ed[_0xd304('0x17')](_0x4cfa5c,_0x3b44fc)['then'](function(_0x38f95a){logger[_0xd304('0x18')](_0xd304('0x19'),_0x29857e,'request\x20sent');logger['debug'](_0xd304('0x1a'),_0x29857e,'request\x20sent',JSON['stringify'](_0x38f95a));if(_0x38f95a[_0xd304('0x1b')]){if(_0x38f95a['error']['code']===0x1f4){logger['error'](_0xd304('0x19'),_0x29857e,_0x38f95a['error'][_0xd304('0x1c')]);return _0x7322f(_0x38f95a[_0xd304('0x1b')][_0xd304('0x1c')]);}logger[_0xd304('0x1b')](_0xd304('0x19'),_0x29857e,_0x38f95a[_0xd304('0x1b')][_0xd304('0x1c')]);return _0x123c43(_0x38f95a[_0xd304('0x1b')][_0xd304('0x1c')]);}else{logger[_0xd304('0x18')](_0xd304('0x19'),_0x29857e,_0xd304('0x1d'));_0x123c43(_0x38f95a['result']['message']);}})['catch'](function(_0x761a12){logger[_0xd304('0x1b')](_0xd304('0x19'),_0x29857e,_0x761a12);_0x7322f(_0x761a12);});});}function respondWithStatusCode(_0x9c67be,_0x2a4863){_0x2a4863=_0x2a4863||0xcc;return function(_0x5acafc){if(_0x5acafc){return _0x9c67be['sendStatus'](_0x2a4863);}return _0x9c67be[_0xd304('0x1e')](_0x2a4863)[_0xd304('0x1f')]();};}function respondWithResult(_0x232da0,_0x38eee0){_0x38eee0=_0x38eee0||0xc8;return function(_0x443d5f){if(_0x443d5f){return _0x232da0[_0xd304('0x1e')](_0x38eee0)[_0xd304('0x20')](_0x443d5f);}};}function respondWithFilteredResult(_0xce52ec,_0x51a99a){return function(_0x1bb471){if(_0x1bb471){var _0x5be920=_0x1bb471[_0xd304('0x21')],_0x4db597=_0x51a99a[_0xd304('0x22')],_0x4455ef=_0x51a99a['offset']+_0x51a99a[_0xd304('0x23')],_0x397657;if(_0x4455ef>=_0x5be920){_0x4455ef=_0x5be920;_0x397657=0xc8;}else{_0x397657=0xce;}_0xce52ec[_0xd304('0x1e')](_0x397657);return _0xce52ec[_0xd304('0x24')](_0xd304('0x25'),_0x4db597+'-'+_0x4455ef+'/'+_0x5be920)['json'](_0x1bb471);}return null;};}function patchUpdates(_0x46c89d){return function(_0x4af507){try{jsonpatch[_0xd304('0x26')](_0x4af507,_0x46c89d,!![]);}catch(_0xa5b3a6){return BPromise['reject'](_0xa5b3a6);}return _0x4af507[_0xd304('0x27')]();};}function saveUpdates(_0xe646bc,_0x468e41){return function(_0x6e194a){if(_0x6e194a){return _0x6e194a[_0xd304('0x28')](_0xe646bc)[_0xd304('0x29')](function(_0x46410e){return _0x46410e;});}return null;};}function removeEntity(_0x104afc,_0x5e7ed1){return function(_0x1cfb14){if(_0x1cfb14){return _0x1cfb14['destroy']()[_0xd304('0x29')](function(){_0x104afc[_0xd304('0x1e')](0xcc)[_0xd304('0x1f')]();});}};}function handleEntityNotFound(_0x5e03e,_0x4a998d){return function(_0x3ee182){if(!_0x3ee182){_0x5e03e[_0xd304('0x2a')](0x194);}return _0x3ee182;};}function handleError(_0x2b63a1,_0x523d92){_0x523d92=_0x523d92||0x1f4;return function(_0x2a720f){logger[_0xd304('0x1b')](_0x2a720f[_0xd304('0x2b')]);if(_0x2a720f[_0xd304('0x2c')]){delete _0x2a720f[_0xd304('0x2c')];}_0x2b63a1['status'](_0x523d92)['send'](_0x2a720f);};}exports['index']=function(_0x211e88,_0x1b0308){var _0x471198={},_0x3ae538={},_0x299c2b={'count':0x0,'rows':[]};var _0x21733b=db['VtigerAccount'][_0xd304('0x2d')];_0x3ae538[_0xd304('0x2e')]=_[_0xd304('0x2f')](_0x21733b);var _0x4dc6f2={'dateStart':_0x211e88[_0xd304('0x30')][_0xd304('0x31')],'dateEnd':_0x211e88[_0xd304('0x30')][_0xd304('0x32')]};delete _0x211e88[_0xd304('0x30')]['dateStart'];delete _0x211e88[_0xd304('0x30')][_0xd304('0x32')];_0x3ae538[_0xd304('0x30')]=_[_0xd304('0x2f')](_0x211e88[_0xd304('0x30')]);_0x3ae538['filters']=_[_0xd304('0x33')](_0x3ae538[_0xd304('0x2e')],_0x3ae538[_0xd304('0x30')]);_0x471198[_0xd304('0x34')]=_[_0xd304('0x33')](_0x3ae538[_0xd304('0x2e')],qs[_0xd304('0x35')](_0x211e88['query'][_0xd304('0x35')]));_0x471198[_0xd304('0x34')]=_0x471198[_0xd304('0x34')][_0xd304('0x36')]?_0x471198['attributes']:_0x3ae538[_0xd304('0x2e')];if(!_0x211e88[_0xd304('0x30')][_0xd304('0x37')](_0xd304('0x38'))){_0x471198[_0xd304('0x23')]=qs[_0xd304('0x23')](_0x211e88[_0xd304('0x30')]['limit']);_0x471198[_0xd304('0x22')]=qs[_0xd304('0x22')](_0x211e88[_0xd304('0x30')][_0xd304('0x22')]);}_0x471198[_0xd304('0x39')]=qs[_0xd304('0x3a')](_0x211e88[_0xd304('0x30')][_0xd304('0x3a')]);_0x471198[_0xd304('0x3b')]=qs[_0xd304('0x3c')](_[_0xd304('0x3d')](_0x211e88[_0xd304('0x30')],_0x3ae538['filters']));if(_0x4dc6f2[_0xd304('0x31')]){if(_0x4dc6f2['dateEnd']){_0x4dc6f2[_0xd304('0x32')]=moment(_0x4dc6f2[_0xd304('0x32')])['add'](0x1,_0xd304('0x3e'));}else{_0x4dc6f2[_0xd304('0x32')]=moment(_0x4dc6f2[_0xd304('0x31')])[_0xd304('0x3f')](0x1,_0xd304('0x3e'));}_[_0xd304('0x40')](_0x471198[_0xd304('0x3b')],{'createdAt':{'$gte':_0x4dc6f2['dateStart'],'$lte':_0x4dc6f2[_0xd304('0x32')]}});}if(_0x211e88[_0xd304('0x30')]['filter']){_0x471198[_0xd304('0x3b')]=_['merge'](_0x471198[_0xd304('0x3b')],{'$or':_[_0xd304('0x41')](_0x471198['attributes'],function(_0x4ff916){var _0xb2a1a3={};_0xb2a1a3[_0x4ff916]={'$like':'%'+_0x211e88[_0xd304('0x30')][_0xd304('0x42')]+'%'};return _0xb2a1a3;})});}_0x471198=_[_0xd304('0x40')]({},_0x471198,_0x211e88[_0xd304('0x43')]);var _0x29c287={'where':_0x471198['where']};return db[_0xd304('0x44')][_0xd304('0x21')](_0x29c287)[_0xd304('0x29')](function(_0x4700fc){_0x299c2b[_0xd304('0x21')]=_0x4700fc;if(_0x211e88[_0xd304('0x30')][_0xd304('0x45')]){_0x471198[_0xd304('0x46')]=[{'all':!![]}];}return db[_0xd304('0x44')][_0xd304('0x47')](_0x471198);})[_0xd304('0x29')](function(_0x11361a){_0x299c2b[_0xd304('0x48')]=_0x11361a;return _0x299c2b;})['then'](respondWithFilteredResult(_0x1b0308,_0x471198))[_0xd304('0x49')](handleError(_0x1b0308,null));};exports['show']=function(_0x4cf828,_0x3af208){var _0x34ef88={'raw':![],'where':{'id':_0x4cf828[_0xd304('0x4a')]['id']}},_0x1b96ad={};_0x1b96ad[_0xd304('0x2e')]=_[_0xd304('0x2f')](db['VtigerAccount']['rawAttributes']);_0x1b96ad[_0xd304('0x30')]=_[_0xd304('0x2f')](_0x4cf828['query']);_0x1b96ad[_0xd304('0x3c')]=_['intersection'](_0x1b96ad[_0xd304('0x2e')],_0x1b96ad['query']);_0x34ef88[_0xd304('0x34')]=_[_0xd304('0x33')](_0x1b96ad[_0xd304('0x2e')],qs[_0xd304('0x35')](_0x4cf828[_0xd304('0x30')][_0xd304('0x35')]));_0x34ef88['attributes']=_0x34ef88[_0xd304('0x34')][_0xd304('0x36')]?_0x34ef88[_0xd304('0x34')]:_0x1b96ad[_0xd304('0x2e')];if(_0x4cf828[_0xd304('0x30')]['includeAll']){_0x34ef88[_0xd304('0x46')]=[{'all':!![]}];}_0x34ef88=_[_0xd304('0x40')]({},_0x34ef88,_0x4cf828['options']);return db[_0xd304('0x44')][_0xd304('0x4b')](_0x34ef88)['then'](handleEntityNotFound(_0x3af208,null))[_0xd304('0x29')](respondWithResult(_0x3af208,null))[_0xd304('0x49')](handleError(_0x3af208,null));};exports[_0xd304('0x4c')]=function(_0xafdc6,_0x5b644b){return db[_0xd304('0x44')][_0xd304('0x4c')](_0xafdc6[_0xd304('0x4d')],{})[_0xd304('0x29')](respondWithResult(_0x5b644b,0xc9))[_0xd304('0x49')](handleError(_0x5b644b,null));};exports[_0xd304('0x28')]=function(_0x460109,_0x5b22ce){if(_0x460109[_0xd304('0x4d')]['id']){delete _0x460109[_0xd304('0x4d')]['id'];}return db[_0xd304('0x44')]['find']({'where':{'id':_0x460109[_0xd304('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5b22ce,null))[_0xd304('0x29')](saveUpdates(_0x460109[_0xd304('0x4d')],null))[_0xd304('0x29')](respondWithResult(_0x5b22ce,null))[_0xd304('0x49')](handleError(_0x5b22ce,null));};exports[_0xd304('0x4e')]=function(_0x2e9d5a,_0x116425){return db[_0xd304('0x44')][_0xd304('0x4b')]({'where':{'id':_0x2e9d5a[_0xd304('0x4a')]['id']}})[_0xd304('0x29')](handleEntityNotFound(_0x116425,null))[_0xd304('0x29')](removeEntity(_0x116425,null))[_0xd304('0x49')](handleError(_0x116425,null));};exports[_0xd304('0x4f')]=function(_0xd9fdaa,_0x20283f,_0x491225){var _0x2064c9={};var _0x5dade9={};var _0x2ea6a0;var _0x5d250c;return db['VtigerAccount'][_0xd304('0x50')]({'where':{'id':_0xd9fdaa[_0xd304('0x4a')]['id']}})[_0xd304('0x29')](handleEntityNotFound(_0x20283f,null))[_0xd304('0x29')](function(_0x45d721){if(_0x45d721){_0x2ea6a0=_0x45d721;_0x5dade9[_0xd304('0x2e')]=_[_0xd304('0x2f')](db[_0xd304('0x51')][_0xd304('0x2d')]);_0x5dade9['query']=_[_0xd304('0x2f')](_0xd9fdaa[_0xd304('0x30')]);_0x5dade9['filters']=_['intersection'](_0x5dade9[_0xd304('0x2e')],_0x5dade9[_0xd304('0x30')]);_0x2064c9['attributes']=_[_0xd304('0x33')](_0x5dade9[_0xd304('0x2e')],qs['fields'](_0xd9fdaa[_0xd304('0x30')][_0xd304('0x35')]));_0x2064c9['attributes']=_0x2064c9[_0xd304('0x34')][_0xd304('0x36')]?_0x2064c9[_0xd304('0x34')]:_0x5dade9[_0xd304('0x2e')];_0x2064c9[_0xd304('0x39')]=qs['sort'](_0xd9fdaa['query'][_0xd304('0x3a')]);_0x2064c9['where']=qs[_0xd304('0x3c')](_[_0xd304('0x3d')](_0xd9fdaa[_0xd304('0x30')],_0x5dade9[_0xd304('0x3c')]));if(_0xd9fdaa['query'][_0xd304('0x42')]){_0x2064c9[_0xd304('0x3b')]=_['merge'](_0x2064c9[_0xd304('0x3b')],{'$or':_[_0xd304('0x41')](_0x2064c9['attributes'],function(_0x2b1da0){var _0x4b0770={};_0x4b0770[_0x2b1da0]={'$like':'%'+_0xd9fdaa['query'][_0xd304('0x42')]+'%'};return _0x4b0770;})});}_0x2064c9=_[_0xd304('0x40')]({},_0x2064c9,_0xd9fdaa[_0xd304('0x43')]);return _0x2ea6a0[_0xd304('0x4f')](_0x2064c9);}})['then'](function(_0x18d500){if(_0x18d500){_0x5d250c=_0x18d500[_0xd304('0x36')];if(!_0xd9fdaa[_0xd304('0x30')][_0xd304('0x37')](_0xd304('0x38'))){_0x2064c9['limit']=qs[_0xd304('0x23')](_0xd9fdaa['query']['limit']);_0x2064c9['offset']=qs[_0xd304('0x22')](_0xd9fdaa[_0xd304('0x30')][_0xd304('0x22')]);}return _0x2ea6a0[_0xd304('0x4f')](_0x2064c9);}})[_0xd304('0x29')](function(_0x32dac8){if(_0x32dac8){return _0x32dac8?{'count':_0x5d250c,'rows':_0x32dac8}:null;}})[_0xd304('0x29')](respondWithResult(_0x20283f,null))[_0xd304('0x49')](handleError(_0x20283f,null));};exports[_0xd304('0x52')]=function(_0x62181f,_0x487bb5,_0x4d3d3e){if(_0x62181f[_0xd304('0x4d')]['id']){delete _0x62181f['body']['id'];}return db[_0xd304('0x44')][_0xd304('0x50')]({'where':{'id':_0x62181f[_0xd304('0x4a')]['id']}})[_0xd304('0x29')](handleEntityNotFound(_0x487bb5,null))[_0xd304('0x29')](function(_0x56870d){if(_0x56870d){_0x62181f[_0xd304('0x4d')][_0xd304('0x53')]=_0x56870d['id'];_0x62181f[_0xd304('0x4d')][_0xd304('0x54')]=integrations['getSubjects'](_0x62181f['body'][_0xd304('0x55')],_0x62181f['body'][_0xd304('0x56')]);_0x62181f[_0xd304('0x4d')][_0xd304('0x57')]=integrations[_0xd304('0x58')](_0x62181f[_0xd304('0x4d')][_0xd304('0x55')],_0x62181f[_0xd304('0x4d')][_0xd304('0x56')]);return db['VtigerConfiguration'][_0xd304('0x4c')](_0x62181f[_0xd304('0x4d')],{'include':[{'model':db[_0xd304('0x59')],'as':_0xd304('0x54')},{'model':db[_0xd304('0x59')],'as':'Descriptions'}]});}return null;})[_0xd304('0x29')](respondWithResult(_0x487bb5,null))['catch'](handleError(_0x487bb5,null));};var md5=require('md5');exports[_0xd304('0x5a')]=function(_0x36b5e5,_0x583ed8,_0x2478f0){var _0xfd029f=null;var _0x1a3885=null;var _0x51940d=null;var _0x4cf103=null;return db['VtigerAccount'][_0xd304('0x50')]({'where':{'id':_0x36b5e5['params']['id']},'attributes':['id','name',_0xd304('0x5b'),_0xd304('0x5c'),_0xd304('0x5d'),_0xd304('0x5e'),_0xd304('0x5f'),_0xd304('0x60')]})[_0xd304('0x29')](handleEntityNotFound(_0x583ed8,null))[_0xd304('0x29')](function(_0xb32efe){if(_0xb32efe){_0xfd029f=_0xb32efe['username'];_0x1a3885=_0xb32efe[_0xd304('0x60')];_0x51940d=_0xb32efe['moduleName'];_0x4cf103=util[_0xd304('0x61')](_0xd304('0x62'),_0xb32efe[_0xd304('0x5e')]);var _0x1bc161={'method':_0xd304('0x63'),'uri':_0x4cf103,'qs':{'operation':_0xd304('0x64'),'username':_0xb32efe[_0xd304('0x5b')]},'json':!![]};return rp(_0x1bc161);}})[_0xd304('0x29')](function(_0x375e8f){if(_0x375e8f['success']){var _0x158cb0={'method':_0xd304('0x65'),'uri':_0x4cf103,'form':{'operation':_0xd304('0x66'),'username':_0xfd029f,'accessKey':md5(_0x375e8f[_0xd304('0x67')][_0xd304('0x68')]+_0x1a3885)},'json':!![]};return rp(_0x158cb0);}})['then'](function(_0x46acca){if(_0x46acca['success']){var _0x581fad={'method':_0xd304('0x63'),'uri':_0x4cf103,'qs':{'operation':'describe','username':_0xfd029f,'sessionName':_0x46acca[_0xd304('0x67')][_0xd304('0x69')],'elementType':_0x51940d},'json':!![]};return rp(_0x581fad);}})[_0xd304('0x29')](function(_0x4bdcd5){if(_0x4bdcd5[_0xd304('0x6a')]){var _0x1c6626=[_0xd304('0x6b'),'reference',_0xd304('0x6c')];_[_0xd304('0x6d')](_0x4bdcd5[_0xd304('0x67')][_0xd304('0x35')],function(_0x51e87d){return _0x1c6626[_0xd304('0x6e')](_0x51e87d[_0xd304('0x56')][_0xd304('0x2c')]);});_['remove'](_0x4bdcd5[_0xd304('0x67')][_0xd304('0x35')],function(_0x57dec4){return _0x57dec4[_0xd304('0x6f')]===_0xd304('0x70');});return{'count':_0x4bdcd5[_0xd304('0x67')][_0xd304('0x35')][_0xd304('0x36')],'rows':_[_0xd304('0x41')](_0x4bdcd5[_0xd304('0x67')]['fields'],function(_0x4ec3a7){return{'id':_0x4ec3a7[_0xd304('0x2c')],'name':_0x4ec3a7['label'],'custom':_[_0xd304('0x71')](_0x4ec3a7[_0xd304('0x2c')],'cf_')?!![]:![],'options':_0x4ec3a7['type'][_0xd304('0x2c')]===_0xd304('0x72')&&_0x4ec3a7[_0xd304('0x56')][_0xd304('0x73')][_0xd304('0x36')]>0x0?_[_0xd304('0x41')](_0x4ec3a7[_0xd304('0x56')][_0xd304('0x73')],function(_0x2edac5){return{'name':_0x2edac5[_0xd304('0x74')],'value':_0x2edac5[_0xd304('0x75')]};}):[]};})};}})['then'](respondWithResult(_0x583ed8,null))[_0xd304('0x49')](function(_0x11d377){console[_0xd304('0x76')]('vTiger\x20error:\x20'+_0x11d377);var _0xc5a0ed=_0x36b5e5['query']['test']?0x1f4:_0x11d377[_0xd304('0x77')]||0x1f4;logger[_0xd304('0x1b')](_0xd304('0x78'),'getFields',_0xc5a0ed,JSON[_0xd304('0x79')](_0x11d377));delete _0x11d377[_0xd304('0x2c')];if(_0xc5a0ed===0x191){_0xc5a0ed=0x190;}_0x583ed8[_0xd304('0x1e')](_0xc5a0ed)[_0xd304('0x7a')](_0x36b5e5['query'][_0xd304('0x7b')]?{'message':_0xd304('0x7c'),'statusCode':_0x11d377[_0xd304('0x77')]}:_0x11d377);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 7f244d2..de01041 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 _0xb3e9=['exports','define','VtigerAccount','int_vtiger_accounts','util','../../config/logger','api','request-promise'];(function(_0x5f1fb0,_0x30b6da){var _0x2f116d=function(_0x5c96ad){while(--_0x5c96ad){_0x5f1fb0['push'](_0x5f1fb0['shift']());}};_0x2f116d(++_0x30b6da);}(_0xb3e9,0xc4));var _0x9b3e=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0xb3e9[_0x1a72f3];return _0x57ef47;};'use strict';var _=require('lodash');var util=require(_0x9b3e('0x0'));var logger=require(_0x9b3e('0x1'))(_0x9b3e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9b3e('0x3'));var attributes=require('./intVtigerAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x9b3e('0x4')]=function(_0x4ae2d4,_0x49445b){return _0x4ae2d4[_0x9b3e('0x5')](_0x9b3e('0x6'),attributes,{'tableName':_0x9b3e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f07=['exports','define','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird','../../components/integrations/configuration'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5f07,0x1e3));var _0x75f0=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x5f07[_0x3635ce];return _0x97ecd0;};'use strict';var _=require(_0x75f0('0x0'));var util=require(_0x75f0('0x1'));var logger=require(_0x75f0('0x2'))(_0x75f0('0x3'));var moment=require(_0x75f0('0x4'));var BPromise=require(_0x75f0('0x5'));var rp=require('request-promise');var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x75f0('0x6'));module[_0x75f0('0x7')]=function(_0x1fb096,_0x398af5){return _0x1fb096[_0x75f0('0x8')]('VtigerAccount',attributes,{'tableName':_0x75f0('0x9'),'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 d2c6698..a447fe9 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 _0xb361=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','map','include','model','stringify','ShowVtigerAccount','find','catch','lodash','util','moment','bluebird'];(function(_0x30e2bd,_0x3e61b6){var _0x1e9ca8=function(_0x551718){while(--_0x551718){_0x30e2bd['push'](_0x30e2bd['shift']());}};_0x1e9ca8(++_0x3e61b6);}(_0xb361,0x88));var _0x1b36=function(_0x15b1f5,_0x19b49d){_0x15b1f5=_0x15b1f5-0x0;var _0x4deac4=_0xb361[_0x15b1f5];return _0x4deac4;};'use strict';var _=require(_0x1b36('0x0'));var util=require(_0x1b36('0x1'));var moment=require(_0x1b36('0x2'));var BPromise=require(_0x1b36('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b36('0x4'))(_0x1b36('0x5'));var config=require(_0x1b36('0x6'));var jayson=require(_0x1b36('0x7'));var client=jayson[_0x1b36('0x8')][_0x1b36('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf27948,_0x574e9a,_0x14aeca){return new BPromise(function(_0x55ead7,_0x7e2f2e){return client[_0x1b36('0xa')](_0xf27948,_0x14aeca)[_0x1b36('0xb')](function(_0x5178f5){logger[_0x1b36('0xc')](_0x1b36('0xd'),_0x574e9a,_0x1b36('0xe'));logger[_0x1b36('0xf')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x574e9a,'request\x20sent',JSON['stringify'](_0x5178f5));if(_0x5178f5['error']){if(_0x5178f5[_0x1b36('0x10')][_0x1b36('0x11')]===0x1f4){logger[_0x1b36('0x10')](_0x1b36('0xd'),_0x574e9a,_0x5178f5['error'][_0x1b36('0x12')]);return _0x7e2f2e(_0x5178f5[_0x1b36('0x10')][_0x1b36('0x12')]);}logger[_0x1b36('0x10')](_0x1b36('0xd'),_0x574e9a,_0x5178f5['error'][_0x1b36('0x12')]);return _0x55ead7(_0x5178f5['error'][_0x1b36('0x12')]);}else{logger[_0x1b36('0xc')](_0x1b36('0xd'),_0x574e9a,_0x1b36('0xe'));_0x55ead7(_0x5178f5[_0x1b36('0x13')][_0x1b36('0x12')]);}})['catch'](function(_0x375db5){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x574e9a,_0x375db5);_0x7e2f2e(_0x375db5);});});}exports[_0x1b36('0x14')]=function(_0x594fe6){var _0x51b2c8=this;return new Promise(function(_0x4bb065,_0x439e0d){return db[_0x1b36('0x15')][_0x1b36('0x16')]({'raw':_0x594fe6[_0x1b36('0x17')]?_0x594fe6[_0x1b36('0x17')][_0x1b36('0x18')]===undefined?!![]:![]:!![],'where':_0x594fe6[_0x1b36('0x17')]?_0x594fe6[_0x1b36('0x17')][_0x1b36('0x19')]||null:null,'attributes':_0x594fe6[_0x1b36('0x17')]?_0x594fe6[_0x1b36('0x17')][_0x1b36('0x1a')]||null:null,'limit':_0x594fe6['options']?_0x594fe6[_0x1b36('0x17')][_0x1b36('0x1b')]||null:null,'include':_0x594fe6[_0x1b36('0x17')]?_0x594fe6[_0x1b36('0x17')]['include']?_[_0x1b36('0x1c')](_0x594fe6[_0x1b36('0x17')][_0x1b36('0x1d')],function(_0x35a09c){return{'model':db[_0x35a09c['model']],'as':_0x35a09c['as'],'attributes':_0x35a09c[_0x1b36('0x1a')],'include':_0x35a09c[_0x1b36('0x1d')]?_[_0x1b36('0x1c')](_0x35a09c[_0x1b36('0x1d')],function(_0x2b8092){return{'model':db[_0x2b8092[_0x1b36('0x1e')]],'as':_0x2b8092['as'],'attributes':_0x2b8092[_0x1b36('0x1a')],'include':_0x2b8092[_0x1b36('0x1d')]?_[_0x1b36('0x1c')](_0x2b8092['include'],function(_0x28468a){return{'model':db[_0x28468a[_0x1b36('0x1e')]],'as':_0x28468a['as'],'attributes':_0x28468a[_0x1b36('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1b36('0xb')](function(_0x3a6758){logger[_0x1b36('0xc')](_0x1b36('0x14'),_0x594fe6);logger[_0x1b36('0xf')](_0x1b36('0x14'),_0x594fe6,JSON[_0x1b36('0x1f')](_0x3a6758));_0x4bb065(_0x3a6758);})['catch'](function(_0x57825e){logger[_0x1b36('0x10')](_0x1b36('0x14'),_0x57825e[_0x1b36('0x12')],_0x594fe6);_0x439e0d(_0x51b2c8[_0x1b36('0x10')](0x1f4,_0x57825e[_0x1b36('0x12')]));});});};exports[_0x1b36('0x20')]=function(_0x5c3b98){var _0x19a18d=this;return new Promise(function(_0x4d4734,_0x489cca){return db['VtigerAccount'][_0x1b36('0x21')]({'raw':_0x5c3b98[_0x1b36('0x17')]?_0x5c3b98['options'][_0x1b36('0x18')]===undefined?!![]:![]:!![],'where':_0x5c3b98['options']?_0x5c3b98[_0x1b36('0x17')][_0x1b36('0x19')]||null:null,'attributes':_0x5c3b98[_0x1b36('0x17')]?_0x5c3b98[_0x1b36('0x17')]['attributes']||null:null,'include':_0x5c3b98[_0x1b36('0x17')]?_0x5c3b98[_0x1b36('0x17')][_0x1b36('0x1d')]?_[_0x1b36('0x1c')](_0x5c3b98['options'][_0x1b36('0x1d')],function(_0x572101){return{'model':db[_0x572101[_0x1b36('0x1e')]],'as':_0x572101['as'],'attributes':_0x572101[_0x1b36('0x1a')],'include':_0x572101['include']?_['map'](_0x572101[_0x1b36('0x1d')],function(_0x4008a9){return{'model':db[_0x4008a9[_0x1b36('0x1e')]],'as':_0x4008a9['as'],'attributes':_0x4008a9['attributes'],'include':_0x4008a9[_0x1b36('0x1d')]?_[_0x1b36('0x1c')](_0x4008a9['include'],function(_0x395842){return{'model':db[_0x395842['model']],'as':_0x395842['as'],'attributes':_0x395842[_0x1b36('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x25be49){logger[_0x1b36('0xc')](_0x1b36('0x20'),_0x5c3b98);logger[_0x1b36('0xf')]('ShowVtigerAccount',_0x5c3b98,JSON[_0x1b36('0x1f')](_0x25be49));_0x4d4734(_0x25be49);})[_0x1b36('0x22')](function(_0x559c52){logger[_0x1b36('0x10')](_0x1b36('0x20'),_0x559c52[_0x1b36('0x12')],_0x5c3b98);_0x489cca(_0x19a18d[_0x1b36('0x10')](0x1f4,_0x559c52[_0x1b36('0x12')]));});});}; \ No newline at end of file +var _0x5cbb=['moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','VtigerAccount','findAll','raw','options','where','attributes','limit','include','model','map','GetVtigerAccount','ShowVtigerAccount','find','then','lodash','util'];(function(_0x197a4b,_0x30de53){var _0x541327=function(_0x1d5c27){while(--_0x1d5c27){_0x197a4b['push'](_0x197a4b['shift']());}};_0x541327(++_0x30de53);}(_0x5cbb,0x67));var _0xb5cb=function(_0xd09dbe,_0x5dcb13){_0xd09dbe=_0xd09dbe-0x0;var _0x28d26a=_0x5cbb[_0xd09dbe];return _0x28d26a;};'use strict';var _=require(_0xb5cb('0x0'));var util=require(_0xb5cb('0x1'));var moment=require(_0xb5cb('0x2'));var BPromise=require(_0xb5cb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb5cb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb5cb('0x5'))(_0xb5cb('0x6'));var config=require(_0xb5cb('0x7'));var jayson=require(_0xb5cb('0x8'));var client=jayson[_0xb5cb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0849,_0x3f54ed,_0x3e7cca){return new BPromise(function(_0x3aa53e,_0x59404e){return client[_0xb5cb('0xa')](_0x3b0849,_0x3e7cca)['then'](function(_0x1fb83e){logger[_0xb5cb('0xb')](_0xb5cb('0xc'),_0x3f54ed,_0xb5cb('0xd'));logger[_0xb5cb('0xe')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x3f54ed,'request\x20sent',JSON[_0xb5cb('0xf')](_0x1fb83e));if(_0x1fb83e['error']){if(_0x1fb83e['error'][_0xb5cb('0x10')]===0x1f4){logger[_0xb5cb('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x3f54ed,_0x1fb83e[_0xb5cb('0x11')]['message']);return _0x59404e(_0x1fb83e[_0xb5cb('0x11')][_0xb5cb('0x12')]);}logger[_0xb5cb('0x11')](_0xb5cb('0xc'),_0x3f54ed,_0x1fb83e['error'][_0xb5cb('0x12')]);return _0x3aa53e(_0x1fb83e[_0xb5cb('0x11')][_0xb5cb('0x12')]);}else{logger[_0xb5cb('0xb')](_0xb5cb('0xc'),_0x3f54ed,_0xb5cb('0xd'));_0x3aa53e(_0x1fb83e[_0xb5cb('0x13')]['message']);}})[_0xb5cb('0x14')](function(_0x3d2953){logger[_0xb5cb('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x3f54ed,_0x3d2953);_0x59404e(_0x3d2953);});});}exports['GetVtigerAccount']=function(_0x2a14a8){var _0x2e0fa3=this;return new Promise(function(_0x2c3c93,_0x10ea15){return db[_0xb5cb('0x15')][_0xb5cb('0x16')]({'raw':_0x2a14a8['options']?_0x2a14a8['options'][_0xb5cb('0x17')]===undefined?!![]:![]:!![],'where':_0x2a14a8[_0xb5cb('0x18')]?_0x2a14a8[_0xb5cb('0x18')][_0xb5cb('0x19')]||null:null,'attributes':_0x2a14a8['options']?_0x2a14a8[_0xb5cb('0x18')][_0xb5cb('0x1a')]||null:null,'limit':_0x2a14a8[_0xb5cb('0x18')]?_0x2a14a8[_0xb5cb('0x18')][_0xb5cb('0x1b')]||null:null,'include':_0x2a14a8['options']?_0x2a14a8[_0xb5cb('0x18')][_0xb5cb('0x1c')]?_['map'](_0x2a14a8[_0xb5cb('0x18')]['include'],function(_0x1963c0){return{'model':db[_0x1963c0[_0xb5cb('0x1d')]],'as':_0x1963c0['as'],'attributes':_0x1963c0[_0xb5cb('0x1a')],'include':_0x1963c0[_0xb5cb('0x1c')]?_[_0xb5cb('0x1e')](_0x1963c0['include'],function(_0x10f450){return{'model':db[_0x10f450[_0xb5cb('0x1d')]],'as':_0x10f450['as'],'attributes':_0x10f450[_0xb5cb('0x1a')],'include':_0x10f450[_0xb5cb('0x1c')]?_[_0xb5cb('0x1e')](_0x10f450[_0xb5cb('0x1c')],function(_0x2078b4){return{'model':db[_0x2078b4[_0xb5cb('0x1d')]],'as':_0x2078b4['as'],'attributes':_0x2078b4[_0xb5cb('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x333d56){logger[_0xb5cb('0xb')](_0xb5cb('0x1f'),_0x2a14a8);logger[_0xb5cb('0xe')](_0xb5cb('0x1f'),_0x2a14a8,JSON['stringify'](_0x333d56));_0x2c3c93(_0x333d56);})['catch'](function(_0x13eace){logger['error']('GetVtigerAccount',_0x13eace[_0xb5cb('0x12')],_0x2a14a8);_0x10ea15(_0x2e0fa3[_0xb5cb('0x11')](0x1f4,_0x13eace['message']));});});};exports[_0xb5cb('0x20')]=function(_0x31522b){var _0x625417=this;return new Promise(function(_0x3b875e,_0x269408){return db[_0xb5cb('0x15')][_0xb5cb('0x21')]({'raw':_0x31522b[_0xb5cb('0x18')]?_0x31522b[_0xb5cb('0x18')][_0xb5cb('0x17')]===undefined?!![]:![]:!![],'where':_0x31522b['options']?_0x31522b[_0xb5cb('0x18')][_0xb5cb('0x19')]||null:null,'attributes':_0x31522b['options']?_0x31522b['options']['attributes']||null:null,'include':_0x31522b[_0xb5cb('0x18')]?_0x31522b[_0xb5cb('0x18')][_0xb5cb('0x1c')]?_['map'](_0x31522b[_0xb5cb('0x18')][_0xb5cb('0x1c')],function(_0x5c3248){return{'model':db[_0x5c3248[_0xb5cb('0x1d')]],'as':_0x5c3248['as'],'attributes':_0x5c3248[_0xb5cb('0x1a')],'include':_0x5c3248[_0xb5cb('0x1c')]?_[_0xb5cb('0x1e')](_0x5c3248[_0xb5cb('0x1c')],function(_0x24772d){return{'model':db[_0x24772d[_0xb5cb('0x1d')]],'as':_0x24772d['as'],'attributes':_0x24772d[_0xb5cb('0x1a')],'include':_0x24772d['include']?_[_0xb5cb('0x1e')](_0x24772d['include'],function(_0x3f230b){return{'model':db[_0x3f230b['model']],'as':_0x3f230b['as'],'attributes':_0x3f230b[_0xb5cb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb5cb('0x22')](function(_0x30b192){logger['info']('ShowVtigerAccount',_0x31522b);logger[_0xb5cb('0xe')](_0xb5cb('0x20'),_0x31522b,JSON['stringify'](_0x30b192));_0x3b875e(_0x30b192);})[_0xb5cb('0x14')](function(_0x376cdb){logger[_0xb5cb('0x11')](_0xb5cb('0x20'),_0x376cdb[_0xb5cb('0x12')],_0x31522b);_0x269408(_0x625417[_0xb5cb('0x11')](0x1f4,_0x376cdb['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 60d3941..4a9c571 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(_0x1ae946,_0x430f24){var _0x3974f7=function(_0x5ac291){while(--_0x5ac291){_0x1ae946['push'](_0x1ae946['shift']());}};_0x3974f7(++_0x430f24);}(_0xb10b,0x12a));var _0xbb10=function(_0x264545,_0x214037){_0x264545=_0x264545-0x0;var _0x114d10=_0xb10b[_0x264545];return _0x114d10;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file +var _0xd8b0=['isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','index','get','/:id','show'];(function(_0x5aa20c,_0x28b6ca){var _0x5d0a3a=function(_0x4b6cc8){while(--_0x4b6cc8){_0x5aa20c['push'](_0x5aa20c['shift']());}};_0x5d0a3a(++_0x28b6ca);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/fields',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x8')](_0x0d8b('0xf'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['post']('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);router[_0x0d8b('0x14')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x15')]);module[_0x0d8b('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index dc15257..21eb53b 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 _0x4175=['exports','STRING'];(function(_0x23e566,_0x352531){var _0x4827ed=function(_0x4cd80a){while(--_0x4cd80a){_0x23e566['push'](_0x23e566['shift']());}};_0x4827ed(++_0x352531);}(_0x4175,0x1e0));var _0x5417=function(_0x32652e,_0x57bac1){_0x32652e=_0x32652e-0x0;var _0xc0c13d=_0x4175[_0x32652e];return _0xc0c13d;};'use strict';var Sequelize=require('sequelize');module[_0x5417('0x0')]={'name':{'type':Sequelize[_0x5417('0x1')]},'description':{'type':Sequelize[_0x5417('0x1')]}}; \ No newline at end of file +var _0xae13=['STRING','exports'];(function(_0x21eae2,_0x130208){var _0x177d90=function(_0x3ecfaf){while(--_0x3ecfaf){_0x21eae2['push'](_0x21eae2['shift']());}};_0x177d90(++_0x130208);}(_0xae13,0x9d));var _0x3ae1=function(_0x302b9d,_0x27d2c2){_0x302b9d=_0x302b9d-0x0;var _0x2dfe33=_0xae13[_0x302b9d];return _0x2dfe33;};'use strict';var Sequelize=require('sequelize');module[_0x3ae1('0x0')]={'name':{'type':Sequelize[_0x3ae1('0x1')]},'description':{'type':Sequelize[_0x3ae1('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 0cf08ba..c5dcdff 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 _0x2c1c=['create','body','destroy','getFields','VtigerField','order','filter','getSubjects','getDescriptions','findOne','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','count','offset','limit','set','Content-Range','json','save','stack','name','send','index','VtigerConfiguration','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','pick','add','day','merge','where','map','options','include','findAll','rows','show','params','includeAll','find','catch'];(function(_0x9f359a,_0xbb0cdd){var _0x275821=function(_0x598796){while(--_0x598796){_0x9f359a['push'](_0x9f359a['shift']());}};_0x275821(++_0xbb0cdd);}(_0x2c1c,0x64));var _0xc2c1=function(_0x2390e5,_0x369025){_0x2390e5=_0x2390e5-0x0;var _0xa6038f=_0x2c1c[_0x2390e5];return _0xa6038f;};'use strict';var pdf=require(_0xc2c1('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc2c1('0x1'));var jsonpatch=require(_0xc2c1('0x2'));var rp=require(_0xc2c1('0x3'));var moment=require('moment');var BPromise=require(_0xc2c1('0x4'));var Mustache=require(_0xc2c1('0x5'));var util=require(_0xc2c1('0x6'));var path=require(_0xc2c1('0x7'));var sox=require(_0xc2c1('0x8'));var csv=require(_0xc2c1('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc2c1('0xa'));var squel=require(_0xc2c1('0xb'));var crypto=require('crypto');var jsforce=require(_0xc2c1('0xc'));var deskjs=require(_0xc2c1('0xd'));var toCsv=require(_0xc2c1('0x9'));var querystring=require('querystring');var Papa=require(_0xc2c1('0xe'));var Redis=require(_0xc2c1('0xf'));var qs=require(_0xc2c1('0x10'));var logger=require(_0xc2c1('0x11'))(_0xc2c1('0x12'));var utils=require(_0xc2c1('0x13'));var config=require('../../config/environment');var db=require(_0xc2c1('0x14'))['db'];var jayson=require(_0xc2c1('0x15'));var client=jayson[_0xc2c1('0x16')][_0xc2c1('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x8ee61a,_0x3dd10b,_0x71aea1,_0x224595){return new BPromise(function(_0x59dfc1,_0x361275){var _0x464f83=_0x224595||client;return _0x464f83[_0xc2c1('0x18')](_0x8ee61a,_0x71aea1)[_0xc2c1('0x19')](function(_0x2df583){logger[_0xc2c1('0x1a')](_0xc2c1('0x1b'),_0x3dd10b,'request\x20sent');logger[_0xc2c1('0x1c')](_0xc2c1('0x1d'),_0x3dd10b,_0xc2c1('0x1e'),JSON[_0xc2c1('0x1f')](_0x2df583));if(_0x2df583[_0xc2c1('0x20')]){if(_0x2df583['error'][_0xc2c1('0x21')]===0x1f4){logger[_0xc2c1('0x20')](_0xc2c1('0x1b'),_0x3dd10b,_0x2df583['error'][_0xc2c1('0x22')]);return _0x361275(_0x2df583['error'][_0xc2c1('0x22')]);}logger['error'](_0xc2c1('0x1b'),_0x3dd10b,_0x2df583['error']['message']);return _0x59dfc1(_0x2df583[_0xc2c1('0x20')]['message']);}else{logger[_0xc2c1('0x1a')](_0xc2c1('0x1b'),_0x3dd10b,_0xc2c1('0x1e'));_0x59dfc1(_0x2df583[_0xc2c1('0x23')][_0xc2c1('0x22')]);}})['catch'](function(_0x59d745){logger[_0xc2c1('0x20')](_0xc2c1('0x1b'),_0x3dd10b,_0x59d745);_0x361275(_0x59d745);});});}function respondWithStatusCode(_0x105119,_0x1c971b){_0x1c971b=_0x1c971b||0xcc;return function(_0x327426){if(_0x327426){return _0x105119[_0xc2c1('0x24')](_0x1c971b);}return _0x105119[_0xc2c1('0x25')](_0x1c971b)[_0xc2c1('0x26')]();};}function respondWithResult(_0x4b2f1e,_0x51e7d0){_0x51e7d0=_0x51e7d0||0xc8;return function(_0x2fad71){if(_0x2fad71){return _0x4b2f1e['status'](_0x51e7d0)['json'](_0x2fad71);}};}function respondWithFilteredResult(_0x19a852,_0x245a7d){return function(_0x536ba2){if(_0x536ba2){var _0x33b7b1=_0x536ba2[_0xc2c1('0x27')],_0x2878a2=_0x245a7d[_0xc2c1('0x28')],_0x1875d8=_0x245a7d[_0xc2c1('0x28')]+_0x245a7d[_0xc2c1('0x29')],_0x1a3461;if(_0x1875d8>=_0x33b7b1){_0x1875d8=_0x33b7b1;_0x1a3461=0xc8;}else{_0x1a3461=0xce;}_0x19a852[_0xc2c1('0x25')](_0x1a3461);return _0x19a852[_0xc2c1('0x2a')](_0xc2c1('0x2b'),_0x2878a2+'-'+_0x1875d8+'/'+_0x33b7b1)[_0xc2c1('0x2c')](_0x536ba2);}return null;};}function patchUpdates(_0x1e83f8){return function(_0x2bfaa0){try{jsonpatch['apply'](_0x2bfaa0,_0x1e83f8,!![]);}catch(_0x2588fd){return BPromise['reject'](_0x2588fd);}return _0x2bfaa0[_0xc2c1('0x2d')]();};}function saveUpdates(_0x441f65,_0x365b49){return function(_0x24da3e){if(_0x24da3e){return _0x24da3e['update'](_0x441f65)[_0xc2c1('0x19')](function(_0x2d7ac8){return _0x2d7ac8;});}return null;};}function removeEntity(_0x2a1d21,_0x2ebd01){return function(_0x5a8d17){if(_0x5a8d17){return _0x5a8d17['destroy']()['then'](function(){_0x2a1d21['status'](0xcc)[_0xc2c1('0x26')]();});}};}function handleEntityNotFound(_0x16c4c1,_0x11fd90){return function(_0x199214){if(!_0x199214){_0x16c4c1[_0xc2c1('0x24')](0x194);}return _0x199214;};}function handleError(_0x260841,_0x3ef857){_0x3ef857=_0x3ef857||0x1f4;return function(_0x25d299){logger[_0xc2c1('0x20')](_0x25d299[_0xc2c1('0x2e')]);if(_0x25d299[_0xc2c1('0x2f')]){delete _0x25d299[_0xc2c1('0x2f')];}_0x260841[_0xc2c1('0x25')](_0x3ef857)[_0xc2c1('0x30')](_0x25d299);};}exports[_0xc2c1('0x31')]=function(_0x29569d,_0x5c4376){var _0x260be1={},_0x483671={},_0xd0276f={'count':0x0,'rows':[]};var _0x275f0e=db[_0xc2c1('0x32')][_0xc2c1('0x33')];_0x483671['model']=_[_0xc2c1('0x34')](_0x275f0e);var _0x3e8143={'dateStart':_0x29569d[_0xc2c1('0x35')][_0xc2c1('0x36')],'dateEnd':_0x29569d[_0xc2c1('0x35')][_0xc2c1('0x37')]};delete _0x29569d[_0xc2c1('0x35')][_0xc2c1('0x36')];delete _0x29569d[_0xc2c1('0x35')]['dateEnd'];_0x483671[_0xc2c1('0x35')]=_['keys'](_0x29569d['query']);_0x483671[_0xc2c1('0x38')]=_[_0xc2c1('0x39')](_0x483671['model'],_0x483671[_0xc2c1('0x35')]);_0x260be1[_0xc2c1('0x3a')]=_[_0xc2c1('0x39')](_0x483671[_0xc2c1('0x3b')],qs[_0xc2c1('0x3c')](_0x29569d['query'][_0xc2c1('0x3c')]));_0x260be1['attributes']=_0x260be1[_0xc2c1('0x3a')][_0xc2c1('0x3d')]?_0x260be1['attributes']:_0x483671[_0xc2c1('0x3b')];if(!_0x29569d['query'][_0xc2c1('0x3e')](_0xc2c1('0x3f'))){_0x260be1[_0xc2c1('0x29')]=qs[_0xc2c1('0x29')](_0x29569d[_0xc2c1('0x35')][_0xc2c1('0x29')]);_0x260be1[_0xc2c1('0x28')]=qs[_0xc2c1('0x28')](_0x29569d['query']['offset']);}_0x260be1['order']=qs[_0xc2c1('0x40')](_0x29569d[_0xc2c1('0x35')][_0xc2c1('0x40')]);_0x260be1['where']=qs[_0xc2c1('0x38')](_[_0xc2c1('0x41')](_0x29569d[_0xc2c1('0x35')],_0x483671[_0xc2c1('0x38')]));if(_0x3e8143['dateStart']){if(_0x3e8143[_0xc2c1('0x37')]){_0x3e8143['dateEnd']=moment(_0x3e8143[_0xc2c1('0x37')])[_0xc2c1('0x42')](0x1,_0xc2c1('0x43'));}else{_0x3e8143['dateEnd']=moment(_0x3e8143['dateStart'])[_0xc2c1('0x42')](0x1,_0xc2c1('0x43'));}_[_0xc2c1('0x44')](_0x260be1['where'],{'createdAt':{'$gte':_0x3e8143[_0xc2c1('0x36')],'$lte':_0x3e8143[_0xc2c1('0x37')]}});}if(_0x29569d[_0xc2c1('0x35')]['filter']){_0x260be1[_0xc2c1('0x45')]=_[_0xc2c1('0x44')](_0x260be1['where'],{'$or':_[_0xc2c1('0x46')](_0x260be1['attributes'],function(_0x5272d0){var _0x41dd1e={};_0x41dd1e[_0x5272d0]={'$like':'%'+_0x29569d[_0xc2c1('0x35')]['filter']+'%'};return _0x41dd1e;})});}_0x260be1=_[_0xc2c1('0x44')]({},_0x260be1,_0x29569d[_0xc2c1('0x47')]);var _0x187979={'where':_0x260be1[_0xc2c1('0x45')]};return db[_0xc2c1('0x32')][_0xc2c1('0x27')](_0x187979)[_0xc2c1('0x19')](function(_0x30a14d){_0xd0276f[_0xc2c1('0x27')]=_0x30a14d;if(_0x29569d['query']['includeAll']){_0x260be1[_0xc2c1('0x48')]=[{'all':!![]}];}return db[_0xc2c1('0x32')][_0xc2c1('0x49')](_0x260be1);})[_0xc2c1('0x19')](function(_0x225f2b){_0xd0276f[_0xc2c1('0x4a')]=_0x225f2b;return _0xd0276f;})['then'](respondWithFilteredResult(_0x5c4376,_0x260be1))['catch'](handleError(_0x5c4376,null));};exports[_0xc2c1('0x4b')]=function(_0x4d61dc,_0x26b172){var _0x3139ed={'raw':![],'where':{'id':_0x4d61dc[_0xc2c1('0x4c')]['id']}},_0x5f4369={};_0x5f4369[_0xc2c1('0x3b')]=_[_0xc2c1('0x34')](db[_0xc2c1('0x32')][_0xc2c1('0x33')]);_0x5f4369[_0xc2c1('0x35')]=_['keys'](_0x4d61dc[_0xc2c1('0x35')]);_0x5f4369[_0xc2c1('0x38')]=_[_0xc2c1('0x39')](_0x5f4369[_0xc2c1('0x3b')],_0x5f4369[_0xc2c1('0x35')]);_0x3139ed[_0xc2c1('0x3a')]=_[_0xc2c1('0x39')](_0x5f4369['model'],qs[_0xc2c1('0x3c')](_0x4d61dc['query'][_0xc2c1('0x3c')]));_0x3139ed[_0xc2c1('0x3a')]=_0x3139ed[_0xc2c1('0x3a')][_0xc2c1('0x3d')]?_0x3139ed['attributes']:_0x5f4369[_0xc2c1('0x3b')];if(_0x4d61dc[_0xc2c1('0x35')][_0xc2c1('0x4d')]){_0x3139ed[_0xc2c1('0x48')]=[{'all':!![]}];}_0x3139ed=_['merge']({},_0x3139ed,_0x4d61dc[_0xc2c1('0x47')]);return db[_0xc2c1('0x32')][_0xc2c1('0x4e')](_0x3139ed)[_0xc2c1('0x19')](handleEntityNotFound(_0x26b172,null))[_0xc2c1('0x19')](respondWithResult(_0x26b172,null))[_0xc2c1('0x4f')](handleError(_0x26b172,null));};exports[_0xc2c1('0x50')]=function(_0x2f5ff4,_0x473094){return db[_0xc2c1('0x32')][_0xc2c1('0x50')](_0x2f5ff4[_0xc2c1('0x51')],{})[_0xc2c1('0x19')](respondWithResult(_0x473094,0xc9))['catch'](handleError(_0x473094,null));};exports['update']=function(_0x376b12,_0x2f3ff6){if(_0x376b12['body']['id']){delete _0x376b12[_0xc2c1('0x51')]['id'];}return db[_0xc2c1('0x32')][_0xc2c1('0x4e')]({'where':{'id':_0x376b12[_0xc2c1('0x4c')]['id']}})[_0xc2c1('0x19')](handleEntityNotFound(_0x2f3ff6,null))[_0xc2c1('0x19')](saveUpdates(_0x376b12[_0xc2c1('0x51')],null))[_0xc2c1('0x19')](respondWithResult(_0x2f3ff6,null))['catch'](handleError(_0x2f3ff6,null));};exports[_0xc2c1('0x52')]=function(_0x38e9a8,_0xf05c38){return db[_0xc2c1('0x32')][_0xc2c1('0x4e')]({'where':{'id':_0x38e9a8['params']['id']}})[_0xc2c1('0x19')](handleEntityNotFound(_0xf05c38,null))[_0xc2c1('0x19')](removeEntity(_0xf05c38,null))[_0xc2c1('0x4f')](handleError(_0xf05c38,null));};exports[_0xc2c1('0x53')]=function(_0x536077,_0xfc4cab,_0x34653a){var _0x5cc8e9={};var _0x3b302a={};var _0x46b67d;var _0x52f4b1;return db[_0xc2c1('0x32')]['findOne']({'where':{'id':_0x536077[_0xc2c1('0x4c')]['id']}})[_0xc2c1('0x19')](handleEntityNotFound(_0xfc4cab,null))[_0xc2c1('0x19')](function(_0x490b4d){if(_0x490b4d){_0x46b67d=_0x490b4d;_0x3b302a[_0xc2c1('0x3b')]=_['keys'](db[_0xc2c1('0x54')][_0xc2c1('0x33')]);_0x3b302a[_0xc2c1('0x35')]=_[_0xc2c1('0x34')](_0x536077['query']);_0x3b302a[_0xc2c1('0x38')]=_[_0xc2c1('0x39')](_0x3b302a[_0xc2c1('0x3b')],_0x3b302a['query']);_0x5cc8e9[_0xc2c1('0x3a')]=_[_0xc2c1('0x39')](_0x3b302a[_0xc2c1('0x3b')],qs[_0xc2c1('0x3c')](_0x536077['query']['fields']));_0x5cc8e9['attributes']=_0x5cc8e9['attributes'][_0xc2c1('0x3d')]?_0x5cc8e9[_0xc2c1('0x3a')]:_0x3b302a[_0xc2c1('0x3b')];_0x5cc8e9[_0xc2c1('0x55')]=qs['sort'](_0x536077[_0xc2c1('0x35')][_0xc2c1('0x40')]);_0x5cc8e9[_0xc2c1('0x45')]=qs['filters'](_[_0xc2c1('0x41')](_0x536077[_0xc2c1('0x35')],_0x3b302a[_0xc2c1('0x38')]));if(_0x536077[_0xc2c1('0x35')][_0xc2c1('0x56')]){_0x5cc8e9[_0xc2c1('0x45')]=_[_0xc2c1('0x44')](_0x5cc8e9[_0xc2c1('0x45')],{'$or':_[_0xc2c1('0x46')](_0x5cc8e9[_0xc2c1('0x3a')],function(_0x12c706){var _0x234139={};_0x234139[_0x12c706]={'$like':'%'+_0x536077[_0xc2c1('0x35')]['filter']+'%'};return _0x234139;})});}_0x5cc8e9=_[_0xc2c1('0x44')]({},_0x5cc8e9,_0x536077[_0xc2c1('0x47')]);return _0x46b67d[_0xc2c1('0x53')](_0x5cc8e9);}})[_0xc2c1('0x19')](function(_0x5e5573){if(_0x5e5573){_0x52f4b1=_0x5e5573[_0xc2c1('0x3d')];if(!_0x536077[_0xc2c1('0x35')]['hasOwnProperty'](_0xc2c1('0x3f'))){_0x5cc8e9['limit']=qs['limit'](_0x536077['query'][_0xc2c1('0x29')]);_0x5cc8e9[_0xc2c1('0x28')]=qs[_0xc2c1('0x28')](_0x536077[_0xc2c1('0x35')][_0xc2c1('0x28')]);}return _0x46b67d[_0xc2c1('0x53')](_0x5cc8e9);}})[_0xc2c1('0x19')](function(_0x2e8c38){if(_0x2e8c38){return _0x2e8c38?{'count':_0x52f4b1,'rows':_0x2e8c38}:null;}})[_0xc2c1('0x19')](respondWithResult(_0xfc4cab,null))[_0xc2c1('0x4f')](handleError(_0xfc4cab,null));};exports[_0xc2c1('0x57')]=function(_0x4dc98f,_0x3c7546,_0x4e325d){var _0xf78461={};var _0x869ff1={};var _0x75ad61;var _0x537750;return db[_0xc2c1('0x32')]['findOne']({'where':{'id':_0x4dc98f[_0xc2c1('0x4c')]['id']}})[_0xc2c1('0x19')](handleEntityNotFound(_0x3c7546,null))[_0xc2c1('0x19')](function(_0x21e280){if(_0x21e280){_0x75ad61=_0x21e280;_0x869ff1[_0xc2c1('0x3b')]=_[_0xc2c1('0x34')](db[_0xc2c1('0x54')][_0xc2c1('0x33')]);_0x869ff1[_0xc2c1('0x35')]=_['keys'](_0x4dc98f[_0xc2c1('0x35')]);_0x869ff1[_0xc2c1('0x38')]=_[_0xc2c1('0x39')](_0x869ff1[_0xc2c1('0x3b')],_0x869ff1[_0xc2c1('0x35')]);_0xf78461[_0xc2c1('0x3a')]=_['intersection'](_0x869ff1[_0xc2c1('0x3b')],qs[_0xc2c1('0x3c')](_0x4dc98f[_0xc2c1('0x35')][_0xc2c1('0x3c')]));_0xf78461[_0xc2c1('0x3a')]=_0xf78461[_0xc2c1('0x3a')]['length']?_0xf78461[_0xc2c1('0x3a')]:_0x869ff1['model'];_0xf78461[_0xc2c1('0x55')]=qs['sort'](_0x4dc98f['query'][_0xc2c1('0x40')]);_0xf78461[_0xc2c1('0x45')]=qs[_0xc2c1('0x38')](_[_0xc2c1('0x41')](_0x4dc98f['query'],_0x869ff1['filters']));if(_0x4dc98f[_0xc2c1('0x35')][_0xc2c1('0x56')]){_0xf78461[_0xc2c1('0x45')]=_[_0xc2c1('0x44')](_0xf78461[_0xc2c1('0x45')],{'$or':_[_0xc2c1('0x46')](_0xf78461['attributes'],function(_0x13c63a){var _0x5af348={};_0x5af348[_0x13c63a]={'$like':'%'+_0x4dc98f[_0xc2c1('0x35')][_0xc2c1('0x56')]+'%'};return _0x5af348;})});}_0xf78461=_['merge']({},_0xf78461,_0x4dc98f[_0xc2c1('0x47')]);return _0x75ad61[_0xc2c1('0x57')](_0xf78461);}})['then'](function(_0x36a59a){if(_0x36a59a){_0x537750=_0x36a59a[_0xc2c1('0x3d')];if(!_0x4dc98f[_0xc2c1('0x35')][_0xc2c1('0x3e')](_0xc2c1('0x3f'))){_0xf78461[_0xc2c1('0x29')]=qs['limit'](_0x4dc98f[_0xc2c1('0x35')]['limit']);_0xf78461[_0xc2c1('0x28')]=qs[_0xc2c1('0x28')](_0x4dc98f[_0xc2c1('0x35')]['offset']);}return _0x75ad61[_0xc2c1('0x57')](_0xf78461);}})['then'](function(_0x3d931a){if(_0x3d931a){return _0x3d931a?{'count':_0x537750,'rows':_0x3d931a}:null;}})[_0xc2c1('0x19')](respondWithResult(_0x3c7546,null))[_0xc2c1('0x4f')](handleError(_0x3c7546,null));};exports[_0xc2c1('0x58')]=function(_0x2cb444,_0x590976,_0x37d362){var _0x222e90={};var _0x11f391={};var _0x2a764a;var _0x30997f;return db[_0xc2c1('0x32')][_0xc2c1('0x59')]({'where':{'id':_0x2cb444[_0xc2c1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x590976,null))[_0xc2c1('0x19')](function(_0x23ce50){if(_0x23ce50){_0x2a764a=_0x23ce50;_0x11f391['model']=_[_0xc2c1('0x34')](db[_0xc2c1('0x54')][_0xc2c1('0x33')]);_0x11f391[_0xc2c1('0x35')]=_['keys'](_0x2cb444['query']);_0x11f391[_0xc2c1('0x38')]=_[_0xc2c1('0x39')](_0x11f391[_0xc2c1('0x3b')],_0x11f391[_0xc2c1('0x35')]);_0x222e90[_0xc2c1('0x3a')]=_[_0xc2c1('0x39')](_0x11f391['model'],qs['fields'](_0x2cb444[_0xc2c1('0x35')][_0xc2c1('0x3c')]));_0x222e90[_0xc2c1('0x3a')]=_0x222e90[_0xc2c1('0x3a')]['length']?_0x222e90['attributes']:_0x11f391['model'];_0x222e90[_0xc2c1('0x55')]=qs[_0xc2c1('0x40')](_0x2cb444['query'][_0xc2c1('0x40')]);_0x222e90[_0xc2c1('0x45')]=qs[_0xc2c1('0x38')](_[_0xc2c1('0x41')](_0x2cb444[_0xc2c1('0x35')],_0x11f391['filters']));if(_0x2cb444['query'][_0xc2c1('0x56')]){_0x222e90['where']=_[_0xc2c1('0x44')](_0x222e90[_0xc2c1('0x45')],{'$or':_[_0xc2c1('0x46')](_0x222e90[_0xc2c1('0x3a')],function(_0x5f5cf2){var _0x14d944={};_0x14d944[_0x5f5cf2]={'$like':'%'+_0x2cb444[_0xc2c1('0x35')][_0xc2c1('0x56')]+'%'};return _0x14d944;})});}_0x222e90=_[_0xc2c1('0x44')]({},_0x222e90,_0x2cb444['options']);return _0x2a764a[_0xc2c1('0x58')](_0x222e90);}})[_0xc2c1('0x19')](function(_0x543a0b){if(_0x543a0b){_0x30997f=_0x543a0b['length'];if(!_0x2cb444[_0xc2c1('0x35')]['hasOwnProperty'](_0xc2c1('0x3f'))){_0x222e90[_0xc2c1('0x29')]=qs['limit'](_0x2cb444[_0xc2c1('0x35')][_0xc2c1('0x29')]);_0x222e90['offset']=qs[_0xc2c1('0x28')](_0x2cb444['query'][_0xc2c1('0x28')]);}return _0x2a764a[_0xc2c1('0x58')](_0x222e90);}})[_0xc2c1('0x19')](function(_0x1d1a61){if(_0x1d1a61){return _0x1d1a61?{'count':_0x30997f,'rows':_0x1d1a61}:null;}})[_0xc2c1('0x19')](respondWithResult(_0x590976,null))['catch'](handleError(_0x590976,null));}; \ No newline at end of file +var _0x7860=['send','index','VtigerConfiguration','rawAttributes','model','keys','dateStart','query','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','add','day','filter','merge','include','findAll','rows','params','includeAll','options','find','create','body','destroy','findOne','VtigerField','map','getFields','nolimit','order','getSubjects','getDescriptions','html-pdf','zip-dir','mustache','util','path','lodash','to-csv','ioredis','../../config/utils','../../mysqldb','client','http','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','status','json','count','offset','limit','set','apply','reject','update','end','stack','name'];(function(_0x419aa4,_0x5926a7){var _0x557d9b=function(_0x43c9ac){while(--_0x43c9ac){_0x419aa4['push'](_0x419aa4['shift']());}};_0x557d9b(++_0x5926a7);}(_0x7860,0x74));var _0x0786=function(_0x58f956,_0x4dfa67){_0x58f956=_0x58f956-0x0;var _0x20102b=_0x7860[_0x58f956];return _0x20102b;};'use strict';var pdf=require(_0x0786('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0786('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0786('0x2'));var util=require(_0x0786('0x3'));var path=require(_0x0786('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x0786('0x5'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0786('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0786('0x7'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require(_0x0786('0x8'));var config=require('../../config/environment');var db=require(_0x0786('0x9'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x0786('0xa')][_0x0786('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55de70,_0x9d7f9e,_0x2cb33a,_0x537642){return new BPromise(function(_0x46f54f,_0x511eae){var _0x288503=_0x537642||client;return _0x288503[_0x0786('0xc')](_0x55de70,_0x2cb33a)[_0x0786('0xd')](function(_0xba25de){logger['info'](_0x0786('0xe'),_0x9d7f9e,_0x0786('0xf'));logger[_0x0786('0x10')](_0x0786('0x11'),_0x9d7f9e,'request\x20sent',JSON['stringify'](_0xba25de));if(_0xba25de[_0x0786('0x12')]){if(_0xba25de[_0x0786('0x12')]['code']===0x1f4){logger[_0x0786('0x12')](_0x0786('0xe'),_0x9d7f9e,_0xba25de[_0x0786('0x12')]['message']);return _0x511eae(_0xba25de[_0x0786('0x12')]['message']);}logger[_0x0786('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x9d7f9e,_0xba25de[_0x0786('0x12')][_0x0786('0x13')]);return _0x46f54f(_0xba25de[_0x0786('0x12')]['message']);}else{logger[_0x0786('0x14')](_0x0786('0xe'),_0x9d7f9e,_0x0786('0xf'));_0x46f54f(_0xba25de[_0x0786('0x15')][_0x0786('0x13')]);}})[_0x0786('0x16')](function(_0x1d3d7b){logger['error'](_0x0786('0xe'),_0x9d7f9e,_0x1d3d7b);_0x511eae(_0x1d3d7b);});});}function respondWithStatusCode(_0xa13689,_0x39421e){_0x39421e=_0x39421e||0xcc;return function(_0x5e9cd5){if(_0x5e9cd5){return _0xa13689[_0x0786('0x17')](_0x39421e);}return _0xa13689['status'](_0x39421e)['end']();};}function respondWithResult(_0xc5914e,_0x42e8cd){_0x42e8cd=_0x42e8cd||0xc8;return function(_0x1bb003){if(_0x1bb003){return _0xc5914e[_0x0786('0x18')](_0x42e8cd)[_0x0786('0x19')](_0x1bb003);}};}function respondWithFilteredResult(_0x5e581b,_0x500eba){return function(_0x397d1a){if(_0x397d1a){var _0x22a9b8=_0x397d1a[_0x0786('0x1a')],_0x2904cd=_0x500eba[_0x0786('0x1b')],_0x264510=_0x500eba[_0x0786('0x1b')]+_0x500eba[_0x0786('0x1c')],_0x185277;if(_0x264510>=_0x22a9b8){_0x264510=_0x22a9b8;_0x185277=0xc8;}else{_0x185277=0xce;}_0x5e581b[_0x0786('0x18')](_0x185277);return _0x5e581b[_0x0786('0x1d')]('Content-Range',_0x2904cd+'-'+_0x264510+'/'+_0x22a9b8)[_0x0786('0x19')](_0x397d1a);}return null;};}function patchUpdates(_0x23263e){return function(_0x4146eb){try{jsonpatch[_0x0786('0x1e')](_0x4146eb,_0x23263e,!![]);}catch(_0x4eaf4d){return BPromise[_0x0786('0x1f')](_0x4eaf4d);}return _0x4146eb['save']();};}function saveUpdates(_0x3cb74a,_0x5a5527){return function(_0x142b1f){if(_0x142b1f){return _0x142b1f[_0x0786('0x20')](_0x3cb74a)[_0x0786('0xd')](function(_0x1c8ca8){return _0x1c8ca8;});}return null;};}function removeEntity(_0x2122fa,_0x3e085b){return function(_0x55cd72){if(_0x55cd72){return _0x55cd72['destroy']()['then'](function(){_0x2122fa[_0x0786('0x18')](0xcc)[_0x0786('0x21')]();});}};}function handleEntityNotFound(_0x583619,_0xfd9b94){return function(_0x10490e){if(!_0x10490e){_0x583619['sendStatus'](0x194);}return _0x10490e;};}function handleError(_0x5beddb,_0x9b1a2b){_0x9b1a2b=_0x9b1a2b||0x1f4;return function(_0x3a146d){logger['error'](_0x3a146d[_0x0786('0x22')]);if(_0x3a146d[_0x0786('0x23')]){delete _0x3a146d[_0x0786('0x23')];}_0x5beddb[_0x0786('0x18')](_0x9b1a2b)[_0x0786('0x24')](_0x3a146d);};}exports[_0x0786('0x25')]=function(_0x126e73,_0x588fe3){var _0x561a7d={},_0x2f35e8={},_0x1cbfb0={'count':0x0,'rows':[]};var _0xda0d=db[_0x0786('0x26')][_0x0786('0x27')];_0x2f35e8[_0x0786('0x28')]=_[_0x0786('0x29')](_0xda0d);var _0x1df8ec={'dateStart':_0x126e73['query'][_0x0786('0x2a')],'dateEnd':_0x126e73['query']['dateEnd']};delete _0x126e73[_0x0786('0x2b')]['dateStart'];delete _0x126e73['query'][_0x0786('0x2c')];_0x2f35e8[_0x0786('0x2b')]=_[_0x0786('0x29')](_0x126e73[_0x0786('0x2b')]);_0x2f35e8[_0x0786('0x2d')]=_[_0x0786('0x2e')](_0x2f35e8['model'],_0x2f35e8[_0x0786('0x2b')]);_0x561a7d[_0x0786('0x2f')]=_[_0x0786('0x2e')](_0x2f35e8[_0x0786('0x28')],qs[_0x0786('0x30')](_0x126e73['query'][_0x0786('0x30')]));_0x561a7d['attributes']=_0x561a7d[_0x0786('0x2f')][_0x0786('0x31')]?_0x561a7d[_0x0786('0x2f')]:_0x2f35e8[_0x0786('0x28')];if(!_0x126e73[_0x0786('0x2b')][_0x0786('0x32')]('nolimit')){_0x561a7d[_0x0786('0x1c')]=qs[_0x0786('0x1c')](_0x126e73[_0x0786('0x2b')]['limit']);_0x561a7d[_0x0786('0x1b')]=qs[_0x0786('0x1b')](_0x126e73[_0x0786('0x2b')][_0x0786('0x1b')]);}_0x561a7d['order']=qs[_0x0786('0x33')](_0x126e73['query'][_0x0786('0x33')]);_0x561a7d[_0x0786('0x34')]=qs['filters'](_[_0x0786('0x35')](_0x126e73[_0x0786('0x2b')],_0x2f35e8[_0x0786('0x2d')]));if(_0x1df8ec[_0x0786('0x2a')]){if(_0x1df8ec[_0x0786('0x2c')]){_0x1df8ec[_0x0786('0x2c')]=moment(_0x1df8ec[_0x0786('0x2c')])[_0x0786('0x36')](0x1,_0x0786('0x37'));}else{_0x1df8ec[_0x0786('0x2c')]=moment(_0x1df8ec[_0x0786('0x2a')])[_0x0786('0x36')](0x1,'day');}_['merge'](_0x561a7d[_0x0786('0x34')],{'createdAt':{'$gte':_0x1df8ec[_0x0786('0x2a')],'$lte':_0x1df8ec[_0x0786('0x2c')]}});}if(_0x126e73[_0x0786('0x2b')][_0x0786('0x38')]){_0x561a7d[_0x0786('0x34')]=_[_0x0786('0x39')](_0x561a7d[_0x0786('0x34')],{'$or':_['map'](_0x561a7d[_0x0786('0x2f')],function(_0x2733ad){var _0x46cdd7={};_0x46cdd7[_0x2733ad]={'$like':'%'+_0x126e73['query'][_0x0786('0x38')]+'%'};return _0x46cdd7;})});}_0x561a7d=_[_0x0786('0x39')]({},_0x561a7d,_0x126e73['options']);var _0x23e9f8={'where':_0x561a7d[_0x0786('0x34')]};return db[_0x0786('0x26')][_0x0786('0x1a')](_0x23e9f8)[_0x0786('0xd')](function(_0x4d5f8a){_0x1cbfb0[_0x0786('0x1a')]=_0x4d5f8a;if(_0x126e73[_0x0786('0x2b')]['includeAll']){_0x561a7d[_0x0786('0x3a')]=[{'all':!![]}];}return db[_0x0786('0x26')][_0x0786('0x3b')](_0x561a7d);})[_0x0786('0xd')](function(_0x36e954){_0x1cbfb0[_0x0786('0x3c')]=_0x36e954;return _0x1cbfb0;})[_0x0786('0xd')](respondWithFilteredResult(_0x588fe3,_0x561a7d))[_0x0786('0x16')](handleError(_0x588fe3,null));};exports['show']=function(_0x10e8a6,_0x398970){var _0x4174ff={'raw':![],'where':{'id':_0x10e8a6[_0x0786('0x3d')]['id']}},_0x5b5e4e={};_0x5b5e4e[_0x0786('0x28')]=_[_0x0786('0x29')](db[_0x0786('0x26')][_0x0786('0x27')]);_0x5b5e4e[_0x0786('0x2b')]=_[_0x0786('0x29')](_0x10e8a6[_0x0786('0x2b')]);_0x5b5e4e[_0x0786('0x2d')]=_[_0x0786('0x2e')](_0x5b5e4e[_0x0786('0x28')],_0x5b5e4e['query']);_0x4174ff[_0x0786('0x2f')]=_[_0x0786('0x2e')](_0x5b5e4e[_0x0786('0x28')],qs[_0x0786('0x30')](_0x10e8a6[_0x0786('0x2b')][_0x0786('0x30')]));_0x4174ff[_0x0786('0x2f')]=_0x4174ff[_0x0786('0x2f')]['length']?_0x4174ff[_0x0786('0x2f')]:_0x5b5e4e[_0x0786('0x28')];if(_0x10e8a6[_0x0786('0x2b')][_0x0786('0x3e')]){_0x4174ff['include']=[{'all':!![]}];}_0x4174ff=_[_0x0786('0x39')]({},_0x4174ff,_0x10e8a6[_0x0786('0x3f')]);return db[_0x0786('0x26')][_0x0786('0x40')](_0x4174ff)[_0x0786('0xd')](handleEntityNotFound(_0x398970,null))['then'](respondWithResult(_0x398970,null))[_0x0786('0x16')](handleError(_0x398970,null));};exports[_0x0786('0x41')]=function(_0x5a26d1,_0x10a38e){return db[_0x0786('0x26')][_0x0786('0x41')](_0x5a26d1[_0x0786('0x42')],{})[_0x0786('0xd')](respondWithResult(_0x10a38e,0xc9))['catch'](handleError(_0x10a38e,null));};exports['update']=function(_0x4e3e60,_0x11ec80){if(_0x4e3e60[_0x0786('0x42')]['id']){delete _0x4e3e60[_0x0786('0x42')]['id'];}return db[_0x0786('0x26')][_0x0786('0x40')]({'where':{'id':_0x4e3e60[_0x0786('0x3d')]['id']}})[_0x0786('0xd')](handleEntityNotFound(_0x11ec80,null))[_0x0786('0xd')](saveUpdates(_0x4e3e60['body'],null))['then'](respondWithResult(_0x11ec80,null))['catch'](handleError(_0x11ec80,null));};exports[_0x0786('0x43')]=function(_0x127c78,_0x403b59){return db['VtigerConfiguration']['find']({'where':{'id':_0x127c78[_0x0786('0x3d')]['id']}})['then'](handleEntityNotFound(_0x403b59,null))[_0x0786('0xd')](removeEntity(_0x403b59,null))['catch'](handleError(_0x403b59,null));};exports['getFields']=function(_0x304c33,_0x181ccc,_0x4ee2d0){var _0x54d25b={};var _0x2c2251={};var _0x2c2478;var _0x5bb6e0;return db[_0x0786('0x26')][_0x0786('0x44')]({'where':{'id':_0x304c33[_0x0786('0x3d')]['id']}})[_0x0786('0xd')](handleEntityNotFound(_0x181ccc,null))['then'](function(_0x21b3da){if(_0x21b3da){_0x2c2478=_0x21b3da;_0x2c2251[_0x0786('0x28')]=_[_0x0786('0x29')](db[_0x0786('0x45')][_0x0786('0x27')]);_0x2c2251[_0x0786('0x2b')]=_['keys'](_0x304c33[_0x0786('0x2b')]);_0x2c2251[_0x0786('0x2d')]=_['intersection'](_0x2c2251[_0x0786('0x28')],_0x2c2251[_0x0786('0x2b')]);_0x54d25b[_0x0786('0x2f')]=_['intersection'](_0x2c2251[_0x0786('0x28')],qs['fields'](_0x304c33['query'][_0x0786('0x30')]));_0x54d25b[_0x0786('0x2f')]=_0x54d25b[_0x0786('0x2f')][_0x0786('0x31')]?_0x54d25b[_0x0786('0x2f')]:_0x2c2251[_0x0786('0x28')];_0x54d25b['order']=qs[_0x0786('0x33')](_0x304c33[_0x0786('0x2b')][_0x0786('0x33')]);_0x54d25b['where']=qs[_0x0786('0x2d')](_[_0x0786('0x35')](_0x304c33[_0x0786('0x2b')],_0x2c2251[_0x0786('0x2d')]));if(_0x304c33['query'][_0x0786('0x38')]){_0x54d25b[_0x0786('0x34')]=_[_0x0786('0x39')](_0x54d25b[_0x0786('0x34')],{'$or':_[_0x0786('0x46')](_0x54d25b[_0x0786('0x2f')],function(_0x3e7880){var _0xd6b944={};_0xd6b944[_0x3e7880]={'$like':'%'+_0x304c33['query'][_0x0786('0x38')]+'%'};return _0xd6b944;})});}_0x54d25b=_[_0x0786('0x39')]({},_0x54d25b,_0x304c33['options']);return _0x2c2478[_0x0786('0x47')](_0x54d25b);}})[_0x0786('0xd')](function(_0x57d0a0){if(_0x57d0a0){_0x5bb6e0=_0x57d0a0[_0x0786('0x31')];if(!_0x304c33[_0x0786('0x2b')]['hasOwnProperty'](_0x0786('0x48'))){_0x54d25b[_0x0786('0x1c')]=qs[_0x0786('0x1c')](_0x304c33[_0x0786('0x2b')][_0x0786('0x1c')]);_0x54d25b[_0x0786('0x1b')]=qs[_0x0786('0x1b')](_0x304c33[_0x0786('0x2b')][_0x0786('0x1b')]);}return _0x2c2478[_0x0786('0x47')](_0x54d25b);}})[_0x0786('0xd')](function(_0x1ebaa0){if(_0x1ebaa0){return _0x1ebaa0?{'count':_0x5bb6e0,'rows':_0x1ebaa0}:null;}})['then'](respondWithResult(_0x181ccc,null))[_0x0786('0x16')](handleError(_0x181ccc,null));};exports['getSubjects']=function(_0x2c68ac,_0x4f88ee,_0x275d02){var _0x1de9fa={};var _0x74116a={};var _0x10ea67;var _0x56a55a;return db[_0x0786('0x26')][_0x0786('0x44')]({'where':{'id':_0x2c68ac['params']['id']}})['then'](handleEntityNotFound(_0x4f88ee,null))[_0x0786('0xd')](function(_0x3f5d6b){if(_0x3f5d6b){_0x10ea67=_0x3f5d6b;_0x74116a[_0x0786('0x28')]=_['keys'](db[_0x0786('0x45')][_0x0786('0x27')]);_0x74116a[_0x0786('0x2b')]=_[_0x0786('0x29')](_0x2c68ac['query']);_0x74116a[_0x0786('0x2d')]=_[_0x0786('0x2e')](_0x74116a['model'],_0x74116a[_0x0786('0x2b')]);_0x1de9fa[_0x0786('0x2f')]=_[_0x0786('0x2e')](_0x74116a['model'],qs[_0x0786('0x30')](_0x2c68ac['query'][_0x0786('0x30')]));_0x1de9fa['attributes']=_0x1de9fa['attributes'][_0x0786('0x31')]?_0x1de9fa[_0x0786('0x2f')]:_0x74116a[_0x0786('0x28')];_0x1de9fa[_0x0786('0x49')]=qs[_0x0786('0x33')](_0x2c68ac['query'][_0x0786('0x33')]);_0x1de9fa[_0x0786('0x34')]=qs[_0x0786('0x2d')](_[_0x0786('0x35')](_0x2c68ac['query'],_0x74116a[_0x0786('0x2d')]));if(_0x2c68ac[_0x0786('0x2b')][_0x0786('0x38')]){_0x1de9fa[_0x0786('0x34')]=_[_0x0786('0x39')](_0x1de9fa[_0x0786('0x34')],{'$or':_[_0x0786('0x46')](_0x1de9fa['attributes'],function(_0x19408){var _0x43518c={};_0x43518c[_0x19408]={'$like':'%'+_0x2c68ac[_0x0786('0x2b')]['filter']+'%'};return _0x43518c;})});}_0x1de9fa=_['merge']({},_0x1de9fa,_0x2c68ac[_0x0786('0x3f')]);return _0x10ea67[_0x0786('0x4a')](_0x1de9fa);}})[_0x0786('0xd')](function(_0x260823){if(_0x260823){_0x56a55a=_0x260823[_0x0786('0x31')];if(!_0x2c68ac[_0x0786('0x2b')]['hasOwnProperty']('nolimit')){_0x1de9fa['limit']=qs[_0x0786('0x1c')](_0x2c68ac['query']['limit']);_0x1de9fa[_0x0786('0x1b')]=qs[_0x0786('0x1b')](_0x2c68ac['query'][_0x0786('0x1b')]);}return _0x10ea67[_0x0786('0x4a')](_0x1de9fa);}})[_0x0786('0xd')](function(_0x3d8e39){if(_0x3d8e39){return _0x3d8e39?{'count':_0x56a55a,'rows':_0x3d8e39}:null;}})[_0x0786('0xd')](respondWithResult(_0x4f88ee,null))[_0x0786('0x16')](handleError(_0x4f88ee,null));};exports[_0x0786('0x4b')]=function(_0xefcfaf,_0x55f40d,_0x4933c6){var _0x406fd4={};var _0x4e763d={};var _0x14f937;var _0x1fb682;return db[_0x0786('0x26')][_0x0786('0x44')]({'where':{'id':_0xefcfaf[_0x0786('0x3d')]['id']}})[_0x0786('0xd')](handleEntityNotFound(_0x55f40d,null))[_0x0786('0xd')](function(_0x41bfd6){if(_0x41bfd6){_0x14f937=_0x41bfd6;_0x4e763d[_0x0786('0x28')]=_[_0x0786('0x29')](db[_0x0786('0x45')][_0x0786('0x27')]);_0x4e763d['query']=_[_0x0786('0x29')](_0xefcfaf[_0x0786('0x2b')]);_0x4e763d[_0x0786('0x2d')]=_[_0x0786('0x2e')](_0x4e763d['model'],_0x4e763d[_0x0786('0x2b')]);_0x406fd4[_0x0786('0x2f')]=_['intersection'](_0x4e763d[_0x0786('0x28')],qs[_0x0786('0x30')](_0xefcfaf[_0x0786('0x2b')]['fields']));_0x406fd4[_0x0786('0x2f')]=_0x406fd4[_0x0786('0x2f')]['length']?_0x406fd4[_0x0786('0x2f')]:_0x4e763d[_0x0786('0x28')];_0x406fd4[_0x0786('0x49')]=qs[_0x0786('0x33')](_0xefcfaf[_0x0786('0x2b')][_0x0786('0x33')]);_0x406fd4[_0x0786('0x34')]=qs[_0x0786('0x2d')](_[_0x0786('0x35')](_0xefcfaf[_0x0786('0x2b')],_0x4e763d[_0x0786('0x2d')]));if(_0xefcfaf[_0x0786('0x2b')][_0x0786('0x38')]){_0x406fd4[_0x0786('0x34')]=_[_0x0786('0x39')](_0x406fd4[_0x0786('0x34')],{'$or':_[_0x0786('0x46')](_0x406fd4[_0x0786('0x2f')],function(_0x14b436){var _0x59d612={};_0x59d612[_0x14b436]={'$like':'%'+_0xefcfaf[_0x0786('0x2b')][_0x0786('0x38')]+'%'};return _0x59d612;})});}_0x406fd4=_['merge']({},_0x406fd4,_0xefcfaf['options']);return _0x14f937[_0x0786('0x4b')](_0x406fd4);}})['then'](function(_0x52614a){if(_0x52614a){_0x1fb682=_0x52614a[_0x0786('0x31')];if(!_0xefcfaf[_0x0786('0x2b')][_0x0786('0x32')]('nolimit')){_0x406fd4[_0x0786('0x1c')]=qs[_0x0786('0x1c')](_0xefcfaf[_0x0786('0x2b')][_0x0786('0x1c')]);_0x406fd4[_0x0786('0x1b')]=qs[_0x0786('0x1b')](_0xefcfaf[_0x0786('0x2b')][_0x0786('0x1b')]);}return _0x14f937[_0x0786('0x4b')](_0x406fd4);}})[_0x0786('0xd')](function(_0x4a3ad2){if(_0x4a3ad2){return _0x4a3ad2?{'count':_0x1fb682,'rows':_0x4a3ad2}:null;}})[_0x0786('0xd')](respondWithResult(_0x55f40d,null))[_0x0786('0x16')](handleError(_0x55f40d,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 1c4bbb4..1e09813 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 _0x5912=['moment','define','VtigerConfiguration','int_vtiger_configurations','lodash','../../config/logger','api'];(function(_0x474d97,_0x5909ce){var _0x1edf25=function(_0x2831df){while(--_0x2831df){_0x474d97['push'](_0x474d97['shift']());}};_0x1edf25(++_0x5909ce);}(_0x5912,0x177));var _0x2591=function(_0x42546b,_0xaff2c7){_0x42546b=_0x42546b-0x0;var _0x39ae30=_0x5912[_0x42546b];return _0x39ae30;};'use strict';var _=require(_0x2591('0x0'));var util=require('util');var logger=require(_0x2591('0x1'))(_0x2591('0x2'));var moment=require(_0x2591('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x46c4f4,_0x1d0fd2){return _0x46c4f4[_0x2591('0x4')](_0x2591('0x5'),attributes,{'tableName':_0x2591('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b04=['define','VtigerConfiguration','lodash','util','../../config/logger','api','moment','request-promise','exports'];(function(_0x2078d5,_0x4a6049){var _0x28e0b3=function(_0x2443ae){while(--_0x2443ae){_0x2078d5['push'](_0x2078d5['shift']());}};_0x28e0b3(++_0x4a6049);}(_0x4b04,0x1a9));var _0x44b0=function(_0x1342ea,_0x1533d4){_0x1342ea=_0x1342ea-0x0;var _0x34d11c=_0x4b04[_0x1342ea];return _0x34d11c;};'use strict';var _=require(_0x44b0('0x0'));var util=require(_0x44b0('0x1'));var logger=require(_0x44b0('0x2'))(_0x44b0('0x3'));var moment=require(_0x44b0('0x4'));var BPromise=require('bluebird');var rp=require(_0x44b0('0x5'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x44b0('0x6')]=function(_0x3fbf97,_0x319a92){return _0x3fbf97[_0x44b0('0x7')](_0x44b0('0x8'),attributes,{'tableName':'int_vtiger_configurations','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 6f24423..449b50c 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 _0xadda=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x54b283,_0x5eb8a6){var _0x2462b3=function(_0x13fca7){while(--_0x13fca7){_0x54b283['push'](_0x54b283['shift']());}};_0x2462b3(++_0x5eb8a6);}(_0xadda,0xb3));var _0xaadd=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xadda[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0xaadd('0x0'));var util=require(_0xaadd('0x1'));var moment=require(_0xaadd('0x2'));var BPromise=require(_0xaadd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaadd('0x4'));var db=require(_0xaadd('0x5'))['db'];var utils=require(_0xaadd('0x6'));var logger=require(_0xaadd('0x7'))(_0xaadd('0x8'));var config=require(_0xaadd('0x9'));var jayson=require(_0xaadd('0xa'));var client=jayson['client'][_0xaadd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e75db,_0x1d294e,_0x2ac282){return new BPromise(function(_0x1b8778,_0x35c416){return client[_0xaadd('0xc')](_0x3e75db,_0x2ac282)[_0xaadd('0xd')](function(_0x3d3da0){logger[_0xaadd('0xe')](_0xaadd('0xf'),_0x1d294e,_0xaadd('0x10'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x1d294e,_0xaadd('0x10'),JSON[_0xaadd('0x11')](_0x3d3da0));if(_0x3d3da0['error']){if(_0x3d3da0[_0xaadd('0x12')]['code']===0x1f4){logger[_0xaadd('0x12')](_0xaadd('0xf'),_0x1d294e,_0x3d3da0[_0xaadd('0x12')][_0xaadd('0x13')]);return _0x35c416(_0x3d3da0[_0xaadd('0x12')][_0xaadd('0x13')]);}logger[_0xaadd('0x12')](_0xaadd('0xf'),_0x1d294e,_0x3d3da0[_0xaadd('0x12')][_0xaadd('0x13')]);return _0x1b8778(_0x3d3da0[_0xaadd('0x12')][_0xaadd('0x13')]);}else{logger[_0xaadd('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x1d294e,_0xaadd('0x10'));_0x1b8778(_0x3d3da0[_0xaadd('0x14')]['message']);}})[_0xaadd('0x15')](function(_0x4edec6){logger[_0xaadd('0x12')](_0xaadd('0xf'),_0x1d294e,_0x4edec6);_0x35c416(_0x4edec6);});});} \ No newline at end of file +var _0x5f11=['VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug'];(function(_0x241b2c,_0x2f37c2){var _0x49981a=function(_0x508fac){while(--_0x508fac){_0x241b2c['push'](_0x241b2c['shift']());}};_0x49981a(++_0x2f37c2);}(_0x5f11,0x71));var _0x15f1=function(_0xf3045b,_0x59987b){_0xf3045b=_0xf3045b-0x0;var _0x2d0959=_0x5f11[_0xf3045b];return _0x2d0959;};'use strict';var _=require('lodash');var util=require(_0x15f1('0x0'));var moment=require('moment');var BPromise=require(_0x15f1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x15f1('0x2'))['db'];var utils=require(_0x15f1('0x3'));var logger=require(_0x15f1('0x4'))('rpc');var config=require(_0x15f1('0x5'));var jayson=require(_0x15f1('0x6'));var client=jayson['client'][_0x15f1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3e8aa1,_0x2bfd20,_0x4fcd5e){return new BPromise(function(_0x1264b1,_0x19c61c){return client[_0x15f1('0x8')](_0x3e8aa1,_0x4fcd5e)[_0x15f1('0x9')](function(_0x215128){logger[_0x15f1('0xa')](_0x15f1('0xb'),_0x2bfd20,'request\x20sent');logger[_0x15f1('0xc')](_0x15f1('0xd'),_0x2bfd20,'request\x20sent',JSON[_0x15f1('0xe')](_0x215128));if(_0x215128[_0x15f1('0xf')]){if(_0x215128[_0x15f1('0xf')][_0x15f1('0x10')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x2bfd20,_0x215128[_0x15f1('0xf')][_0x15f1('0x11')]);return _0x19c61c(_0x215128[_0x15f1('0xf')]['message']);}logger['error'](_0x15f1('0xb'),_0x2bfd20,_0x215128[_0x15f1('0xf')]['message']);return _0x1264b1(_0x215128[_0x15f1('0xf')][_0x15f1('0x11')]);}else{logger[_0x15f1('0xa')](_0x15f1('0xb'),_0x2bfd20,_0x15f1('0x12'));_0x1264b1(_0x215128[_0x15f1('0x13')]['message']);}})[_0x15f1('0x14')](function(_0x354bff){logger[_0x15f1('0xf')](_0x15f1('0xb'),_0x2bfd20,_0x354bff);_0x19c61c(_0x354bff);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index ce82ca2..7dc5074 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 _0xe0e0=['path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe0e0,0x11e));var _0x0e0e=function(_0x2adfb1,_0x1c2df0){_0x2adfb1=_0x2adfb1-0x0;var _0x45d77d=_0xe0e0[_0x2adfb1];return _0x45d77d;};'use strict';var multer=require(_0x0e0e('0x0'));var util=require(_0x0e0e('0x1'));var path=require(_0x0e0e('0x2'));var timeout=require('connect-timeout');var express=require(_0x0e0e('0x3'));var router=express['Router']();var auth=require(_0x0e0e('0x4'));var interaction=require(_0x0e0e('0x5'));var config=require(_0x0e0e('0x6'));var controller=require('./intVtigerField.controller');router[_0x0e0e('0x7')]('/',auth[_0x0e0e('0x8')](),controller[_0x0e0e('0x9')]);router[_0x0e0e('0x7')]('/:id',auth[_0x0e0e('0x8')](),controller['show']);router[_0x0e0e('0xa')]('/',auth[_0x0e0e('0x8')](),controller[_0x0e0e('0xb')]);router[_0x0e0e('0xc')](_0x0e0e('0xd'),auth['isAuthenticated'](),controller[_0x0e0e('0xe')]);router[_0x0e0e('0xf')](_0x0e0e('0xd'),auth[_0x0e0e('0x8')](),controller[_0x0e0e('0x10')]);module[_0x0e0e('0x11')]=router; \ No newline at end of file +var _0x47f9=['destroy','exports','path','express','../../components/auth/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','show','create','put','/:id'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x47f9,0x64));var _0x947f=function(_0x39a3f4,_0x7f4ae8){_0x39a3f4=_0x39a3f4-0x0;var _0x4a894d=_0x47f9[_0x39a3f4];return _0x4a894d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x947f('0x0'));var timeout=require('connect-timeout');var express=require(_0x947f('0x1'));var router=express['Router']();var auth=require(_0x947f('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x947f('0x3'));var controller=require(_0x947f('0x4'));router[_0x947f('0x5')]('/',auth[_0x947f('0x6')](),controller[_0x947f('0x7')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x947f('0x8')]);router['post']('/',auth[_0x947f('0x6')](),controller[_0x947f('0x9')]);router[_0x947f('0xa')](_0x947f('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x947f('0x6')](),controller[_0x947f('0xc')]);module[_0x947f('0xd')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index a726198..4fcc60b 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 _0xa571=['exports','ENUM','string','customVariable','keyValue','STRING','variable','sequelize'];(function(_0x31536b,_0x3f5bf6){var _0x3ef9f8=function(_0xf3f48a){while(--_0xf3f48a){_0x31536b['push'](_0x31536b['shift']());}};_0x3ef9f8(++_0x3f5bf6);}(_0xa571,0x107));var _0x1a57=function(_0x1f9ff4,_0x55068d){_0x1f9ff4=_0x1f9ff4-0x0;var _0x43759f=_0xa571[_0x1f9ff4];return _0x43759f;};'use strict';var Sequelize=require(_0x1a57('0x0'));module[_0x1a57('0x1')]={'type':{'type':Sequelize[_0x1a57('0x2')](_0x1a57('0x3'),'variable',_0x1a57('0x4'),_0x1a57('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1a57('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x1a57('0x3'),_0x1a57('0x7'),_0x1a57('0x4'))},'keyContent':{'type':Sequelize[_0x1a57('0x6')]},'idField':{'type':Sequelize[_0x1a57('0x6')]},'nameField':{'type':Sequelize[_0x1a57('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1a57('0x6')]}}; \ No newline at end of file +var _0xa75b=['customVariable','keyValue','STRING','ENUM','sequelize','string','variable'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa75b,0x170));var _0xba75=function(_0x576aa2,_0x4f3bb0){_0x576aa2=_0x576aa2-0x0;var _0x548ce8=_0xa75b[_0x576aa2];return _0x548ce8;};'use strict';var Sequelize=require(_0xba75('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xba75('0x1'),_0xba75('0x2'),_0xba75('0x3'),_0xba75('0x4')),'defaultValue':_0xba75('0x1')},'content':{'type':Sequelize[_0xba75('0x5')]},'key':{'type':Sequelize[_0xba75('0x5')]},'keyType':{'type':Sequelize[_0xba75('0x6')](_0xba75('0x1'),_0xba75('0x2'),_0xba75('0x3'))},'keyContent':{'type':Sequelize[_0xba75('0x5')]},'idField':{'type':Sequelize[_0xba75('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xba75('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 27f2163..8630737 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 _0x1eef=['length','hasOwnProperty','nolimit','order','sort','where','filters','day','add','merge','map','filter','VtigerField','count','includeAll','include','findAll','rows','show','params','options','create','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','model','keys','query','dateEnd','dateStart','attributes','intersection','fields'];(function(_0x187684,_0x131dd4){var _0x393c49=function(_0x5e21c7){while(--_0x5e21c7){_0x187684['push'](_0x187684['shift']());}};_0x393c49(++_0x131dd4);}(_0x1eef,0x195));var _0xf1ee=function(_0x2b49bc,_0x47b636){_0x2b49bc=_0x2b49bc-0x0;var _0x43cc65=_0x1eef[_0x2b49bc];return _0x43cc65;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf1ee('0x0'));var rimraf=require(_0xf1ee('0x1'));var zipdir=require(_0xf1ee('0x2'));var jsonpatch=require(_0xf1ee('0x3'));var rp=require(_0xf1ee('0x4'));var moment=require(_0xf1ee('0x5'));var BPromise=require(_0xf1ee('0x6'));var Mustache=require(_0xf1ee('0x7'));var util=require(_0xf1ee('0x8'));var path=require(_0xf1ee('0x9'));var sox=require('sox');var csv=require(_0xf1ee('0xa'));var ejs=require(_0xf1ee('0xb'));var fs=require('fs');var _=require(_0xf1ee('0xc'));var squel=require('squel');var crypto=require(_0xf1ee('0xd'));var jsforce=require(_0xf1ee('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf1ee('0xa'));var querystring=require(_0xf1ee('0xf'));var Papa=require('papaparse');var Redis=require(_0xf1ee('0x10'));var qs=require(_0xf1ee('0x11'));var logger=require(_0xf1ee('0x12'))(_0xf1ee('0x13'));var utils=require(_0xf1ee('0x14'));var config=require(_0xf1ee('0x15'));var db=require(_0xf1ee('0x16'))['db'];function respondWithStatusCode(_0x55ad2e,_0x4c9659){_0x4c9659=_0x4c9659||0xcc;return function(_0x1fb7fd){if(_0x1fb7fd){return _0x55ad2e[_0xf1ee('0x17')](_0x4c9659);}return _0x55ad2e[_0xf1ee('0x18')](_0x4c9659)[_0xf1ee('0x19')]();};}function respondWithResult(_0x53c5fe,_0x42d97e){_0x42d97e=_0x42d97e||0xc8;return function(_0x2b783b){if(_0x2b783b){return _0x53c5fe[_0xf1ee('0x18')](_0x42d97e)[_0xf1ee('0x1a')](_0x2b783b);}};}function respondWithFilteredResult(_0x148daa,_0x4f51fd){return function(_0x39c417){if(_0x39c417){var _0x35b62d=_0x39c417['count'],_0x55db7f=_0x4f51fd[_0xf1ee('0x1b')],_0x1caf02=_0x4f51fd[_0xf1ee('0x1b')]+_0x4f51fd[_0xf1ee('0x1c')],_0x48e7cc;if(_0x1caf02>=_0x35b62d){_0x1caf02=_0x35b62d;_0x48e7cc=0xc8;}else{_0x48e7cc=0xce;}_0x148daa['status'](_0x48e7cc);return _0x148daa[_0xf1ee('0x1d')](_0xf1ee('0x1e'),_0x55db7f+'-'+_0x1caf02+'/'+_0x35b62d)[_0xf1ee('0x1a')](_0x39c417);}return null;};}function patchUpdates(_0x1de043){return function(_0x144542){try{jsonpatch[_0xf1ee('0x1f')](_0x144542,_0x1de043,!![]);}catch(_0x355993){return BPromise[_0xf1ee('0x20')](_0x355993);}return _0x144542[_0xf1ee('0x21')]();};}function saveUpdates(_0x4f66cf,_0x282e2e){return function(_0x6bc6f3){if(_0x6bc6f3){return _0x6bc6f3[_0xf1ee('0x22')](_0x4f66cf)[_0xf1ee('0x23')](function(_0x3ce24b){return _0x3ce24b;});}return null;};}function removeEntity(_0x4385ac,_0x557357){return function(_0x19f2be){if(_0x19f2be){return _0x19f2be[_0xf1ee('0x24')]()['then'](function(){_0x4385ac['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x386a2b,_0x439eb6){return function(_0x51f279){if(!_0x51f279){_0x386a2b['sendStatus'](0x194);}return _0x51f279;};}function handleError(_0x44f719,_0x233450){_0x233450=_0x233450||0x1f4;return function(_0x98bfe1){logger[_0xf1ee('0x25')](_0x98bfe1[_0xf1ee('0x26')]);if(_0x98bfe1[_0xf1ee('0x27')]){delete _0x98bfe1[_0xf1ee('0x27')];}_0x44f719['status'](_0x233450)[_0xf1ee('0x28')](_0x98bfe1);};}exports[_0xf1ee('0x29')]=function(_0x42181b,_0x2723b5){var _0x19d4d9={},_0x142551={},_0x2f3daf={'count':0x0,'rows':[]};var _0x550475=db['VtigerField'][_0xf1ee('0x2a')];_0x142551[_0xf1ee('0x2b')]=_[_0xf1ee('0x2c')](_0x550475);var _0x5d3cc2={'dateStart':_0x42181b[_0xf1ee('0x2d')]['dateStart'],'dateEnd':_0x42181b[_0xf1ee('0x2d')][_0xf1ee('0x2e')]};delete _0x42181b[_0xf1ee('0x2d')][_0xf1ee('0x2f')];delete _0x42181b['query'][_0xf1ee('0x2e')];_0x142551['query']=_[_0xf1ee('0x2c')](_0x42181b[_0xf1ee('0x2d')]);_0x142551['filters']=_['intersection'](_0x142551[_0xf1ee('0x2b')],_0x142551[_0xf1ee('0x2d')]);_0x19d4d9[_0xf1ee('0x30')]=_[_0xf1ee('0x31')](_0x142551[_0xf1ee('0x2b')],qs[_0xf1ee('0x32')](_0x42181b[_0xf1ee('0x2d')][_0xf1ee('0x32')]));_0x19d4d9[_0xf1ee('0x30')]=_0x19d4d9[_0xf1ee('0x30')][_0xf1ee('0x33')]?_0x19d4d9[_0xf1ee('0x30')]:_0x142551[_0xf1ee('0x2b')];if(!_0x42181b[_0xf1ee('0x2d')][_0xf1ee('0x34')](_0xf1ee('0x35'))){_0x19d4d9[_0xf1ee('0x1c')]=qs[_0xf1ee('0x1c')](_0x42181b[_0xf1ee('0x2d')][_0xf1ee('0x1c')]);_0x19d4d9['offset']=qs['offset'](_0x42181b[_0xf1ee('0x2d')][_0xf1ee('0x1b')]);}_0x19d4d9[_0xf1ee('0x36')]=qs[_0xf1ee('0x37')](_0x42181b[_0xf1ee('0x2d')]['sort']);_0x19d4d9[_0xf1ee('0x38')]=qs[_0xf1ee('0x39')](_['pick'](_0x42181b[_0xf1ee('0x2d')],_0x142551['filters']));if(_0x5d3cc2[_0xf1ee('0x2f')]){if(_0x5d3cc2['dateEnd']){_0x5d3cc2['dateEnd']=moment(_0x5d3cc2['dateEnd'])['add'](0x1,_0xf1ee('0x3a'));}else{_0x5d3cc2['dateEnd']=moment(_0x5d3cc2[_0xf1ee('0x2f')])[_0xf1ee('0x3b')](0x1,_0xf1ee('0x3a'));}_['merge'](_0x19d4d9[_0xf1ee('0x38')],{'createdAt':{'$gte':_0x5d3cc2[_0xf1ee('0x2f')],'$lte':_0x5d3cc2[_0xf1ee('0x2e')]}});}if(_0x42181b[_0xf1ee('0x2d')]['filter']){_0x19d4d9['where']=_[_0xf1ee('0x3c')](_0x19d4d9[_0xf1ee('0x38')],{'$or':_[_0xf1ee('0x3d')](_0x19d4d9[_0xf1ee('0x30')],function(_0x547b66){var _0x2ba807={};_0x2ba807[_0x547b66]={'$like':'%'+_0x42181b[_0xf1ee('0x2d')][_0xf1ee('0x3e')]+'%'};return _0x2ba807;})});}_0x19d4d9=_[_0xf1ee('0x3c')]({},_0x19d4d9,_0x42181b['options']);var _0x20ccd1={'where':_0x19d4d9[_0xf1ee('0x38')]};return db[_0xf1ee('0x3f')]['count'](_0x20ccd1)[_0xf1ee('0x23')](function(_0x2de092){_0x2f3daf[_0xf1ee('0x40')]=_0x2de092;if(_0x42181b['query'][_0xf1ee('0x41')]){_0x19d4d9[_0xf1ee('0x42')]=[{'all':!![]}];}return db[_0xf1ee('0x3f')][_0xf1ee('0x43')](_0x19d4d9);})['then'](function(_0x1e014d){_0x2f3daf[_0xf1ee('0x44')]=_0x1e014d;return _0x2f3daf;})['then'](respondWithFilteredResult(_0x2723b5,_0x19d4d9))['catch'](handleError(_0x2723b5,null));};exports[_0xf1ee('0x45')]=function(_0x10fa0f,_0xf5e67e){var _0x1f18e8={'raw':!![],'where':{'id':_0x10fa0f[_0xf1ee('0x46')]['id']}},_0x4944d1={};_0x4944d1[_0xf1ee('0x2b')]=_[_0xf1ee('0x2c')](db['VtigerField'][_0xf1ee('0x2a')]);_0x4944d1[_0xf1ee('0x2d')]=_[_0xf1ee('0x2c')](_0x10fa0f[_0xf1ee('0x2d')]);_0x4944d1[_0xf1ee('0x39')]=_[_0xf1ee('0x31')](_0x4944d1['model'],_0x4944d1[_0xf1ee('0x2d')]);_0x1f18e8[_0xf1ee('0x30')]=_[_0xf1ee('0x31')](_0x4944d1[_0xf1ee('0x2b')],qs[_0xf1ee('0x32')](_0x10fa0f[_0xf1ee('0x2d')][_0xf1ee('0x32')]));_0x1f18e8[_0xf1ee('0x30')]=_0x1f18e8[_0xf1ee('0x30')][_0xf1ee('0x33')]?_0x1f18e8[_0xf1ee('0x30')]:_0x4944d1[_0xf1ee('0x2b')];if(_0x10fa0f[_0xf1ee('0x2d')][_0xf1ee('0x41')]){_0x1f18e8['include']=[{'all':!![]}];}_0x1f18e8=_[_0xf1ee('0x3c')]({},_0x1f18e8,_0x10fa0f[_0xf1ee('0x47')]);return db[_0xf1ee('0x3f')]['find'](_0x1f18e8)[_0xf1ee('0x23')](handleEntityNotFound(_0xf5e67e,null))[_0xf1ee('0x23')](respondWithResult(_0xf5e67e,null))['catch'](handleError(_0xf5e67e,null));};exports['create']=function(_0x5c34a7,_0x43ddd7){return db[_0xf1ee('0x3f')][_0xf1ee('0x48')](_0x5c34a7['body'],{})[_0xf1ee('0x23')](respondWithResult(_0x43ddd7,0xc9))[_0xf1ee('0x49')](handleError(_0x43ddd7,null));};exports[_0xf1ee('0x22')]=function(_0x22fd0c,_0x534e6b){if(_0x22fd0c[_0xf1ee('0x4a')]['id']){delete _0x22fd0c[_0xf1ee('0x4a')]['id'];}return db[_0xf1ee('0x3f')]['find']({'where':{'id':_0x22fd0c[_0xf1ee('0x46')]['id']}})[_0xf1ee('0x23')](handleEntityNotFound(_0x534e6b,null))[_0xf1ee('0x23')](saveUpdates(_0x22fd0c[_0xf1ee('0x4a')],null))['then'](respondWithResult(_0x534e6b,null))['catch'](handleError(_0x534e6b,null));};exports[_0xf1ee('0x24')]=function(_0x697372,_0x5211ea){return db[_0xf1ee('0x3f')][_0xf1ee('0x4b')]({'where':{'id':_0x697372['params']['id']}})[_0xf1ee('0x23')](handleEntityNotFound(_0x5211ea,null))[_0xf1ee('0x23')](removeEntity(_0x5211ea,null))[_0xf1ee('0x49')](handleError(_0x5211ea,null));}; \ No newline at end of file +var _0x39b8=['body','update','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','end','error','stack','name','send','index','VtigerField','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','add','merge','where','filter','map','options','includeAll','rows','catch','show','fields','include','find','create'];(function(_0x5aa5e0,_0x3a00e9){var _0x416564=function(_0x513c80){while(--_0x513c80){_0x5aa5e0['push'](_0x5aa5e0['shift']());}};_0x416564(++_0x3a00e9);}(_0x39b8,0xdb));var _0x839b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x39b8[_0x5b644e];return _0x49c6bf;};'use strict';var pdf=require(_0x839b('0x0'));var emlformat=require(_0x839b('0x1'));var rimraf=require(_0x839b('0x2'));var zipdir=require(_0x839b('0x3'));var jsonpatch=require(_0x839b('0x4'));var rp=require(_0x839b('0x5'));var moment=require(_0x839b('0x6'));var BPromise=require(_0x839b('0x7'));var Mustache=require(_0x839b('0x8'));var util=require(_0x839b('0x9'));var path=require(_0x839b('0xa'));var sox=require('sox');var csv=require(_0x839b('0xb'));var ejs=require(_0x839b('0xc'));var fs=require('fs');var _=require(_0x839b('0xd'));var squel=require(_0x839b('0xe'));var crypto=require('crypto');var jsforce=require(_0x839b('0xf'));var deskjs=require(_0x839b('0x10'));var toCsv=require(_0x839b('0xb'));var querystring=require('querystring');var Papa=require(_0x839b('0x11'));var Redis=require('ioredis');var qs=require(_0x839b('0x12'));var logger=require(_0x839b('0x13'))('api');var utils=require(_0x839b('0x14'));var config=require('../../config/environment');var db=require(_0x839b('0x15'))['db'];function respondWithStatusCode(_0x250c39,_0x28f7a7){_0x28f7a7=_0x28f7a7||0xcc;return function(_0x498b53){if(_0x498b53){return _0x250c39[_0x839b('0x16')](_0x28f7a7);}return _0x250c39[_0x839b('0x17')](_0x28f7a7)['end']();};}function respondWithResult(_0x58fe90,_0x478519){_0x478519=_0x478519||0xc8;return function(_0x511ba0){if(_0x511ba0){return _0x58fe90[_0x839b('0x17')](_0x478519)[_0x839b('0x18')](_0x511ba0);}};}function respondWithFilteredResult(_0x4eb995,_0x56b37c){return function(_0x55e932){if(_0x55e932){var _0x297fbe=_0x55e932[_0x839b('0x19')],_0x1d2d7f=_0x56b37c[_0x839b('0x1a')],_0x23b82b=_0x56b37c[_0x839b('0x1a')]+_0x56b37c[_0x839b('0x1b')],_0x5b4981;if(_0x23b82b>=_0x297fbe){_0x23b82b=_0x297fbe;_0x5b4981=0xc8;}else{_0x5b4981=0xce;}_0x4eb995[_0x839b('0x17')](_0x5b4981);return _0x4eb995[_0x839b('0x1c')](_0x839b('0x1d'),_0x1d2d7f+'-'+_0x23b82b+'/'+_0x297fbe)[_0x839b('0x18')](_0x55e932);}return null;};}function patchUpdates(_0x501a74){return function(_0x42d5b5){try{jsonpatch[_0x839b('0x1e')](_0x42d5b5,_0x501a74,!![]);}catch(_0xae4698){return BPromise[_0x839b('0x1f')](_0xae4698);}return _0x42d5b5['save']();};}function saveUpdates(_0x5f23e9,_0x10cf5f){return function(_0x5eab7c){if(_0x5eab7c){return _0x5eab7c['update'](_0x5f23e9)[_0x839b('0x20')](function(_0x294b05){return _0x294b05;});}return null;};}function removeEntity(_0x24cb1b,_0x35cf3a){return function(_0x400f0f){if(_0x400f0f){return _0x400f0f[_0x839b('0x21')]()[_0x839b('0x20')](function(){_0x24cb1b[_0x839b('0x17')](0xcc)[_0x839b('0x22')]();});}};}function handleEntityNotFound(_0x993b0f,_0x2ef08a){return function(_0x54b044){if(!_0x54b044){_0x993b0f['sendStatus'](0x194);}return _0x54b044;};}function handleError(_0x5697b9,_0x354889){_0x354889=_0x354889||0x1f4;return function(_0x5c2656){logger[_0x839b('0x23')](_0x5c2656[_0x839b('0x24')]);if(_0x5c2656[_0x839b('0x25')]){delete _0x5c2656[_0x839b('0x25')];}_0x5697b9[_0x839b('0x17')](_0x354889)[_0x839b('0x26')](_0x5c2656);};}exports[_0x839b('0x27')]=function(_0x598706,_0x178bb0){var _0x5d3af={},_0x42f1cf={},_0x544237={'count':0x0,'rows':[]};var _0x43a28d=db[_0x839b('0x28')][_0x839b('0x29')];_0x42f1cf[_0x839b('0x2a')]=_[_0x839b('0x2b')](_0x43a28d);var _0x376210={'dateStart':_0x598706[_0x839b('0x2c')][_0x839b('0x2d')],'dateEnd':_0x598706[_0x839b('0x2c')]['dateEnd']};delete _0x598706[_0x839b('0x2c')][_0x839b('0x2d')];delete _0x598706[_0x839b('0x2c')][_0x839b('0x2e')];_0x42f1cf[_0x839b('0x2c')]=_[_0x839b('0x2b')](_0x598706[_0x839b('0x2c')]);_0x42f1cf[_0x839b('0x2f')]=_[_0x839b('0x30')](_0x42f1cf[_0x839b('0x2a')],_0x42f1cf[_0x839b('0x2c')]);_0x5d3af[_0x839b('0x31')]=_[_0x839b('0x30')](_0x42f1cf['model'],qs['fields'](_0x598706[_0x839b('0x2c')]['fields']));_0x5d3af[_0x839b('0x31')]=_0x5d3af[_0x839b('0x31')][_0x839b('0x32')]?_0x5d3af[_0x839b('0x31')]:_0x42f1cf[_0x839b('0x2a')];if(!_0x598706['query'][_0x839b('0x33')](_0x839b('0x34'))){_0x5d3af[_0x839b('0x1b')]=qs[_0x839b('0x1b')](_0x598706[_0x839b('0x2c')][_0x839b('0x1b')]);_0x5d3af[_0x839b('0x1a')]=qs['offset'](_0x598706[_0x839b('0x2c')][_0x839b('0x1a')]);}_0x5d3af['order']=qs[_0x839b('0x35')](_0x598706['query']['sort']);_0x5d3af['where']=qs['filters'](_[_0x839b('0x36')](_0x598706['query'],_0x42f1cf[_0x839b('0x2f')]));if(_0x376210[_0x839b('0x2d')]){if(_0x376210[_0x839b('0x2e')]){_0x376210['dateEnd']=moment(_0x376210[_0x839b('0x2e')])[_0x839b('0x37')](0x1,'day');}else{_0x376210[_0x839b('0x2e')]=moment(_0x376210[_0x839b('0x2d')])[_0x839b('0x37')](0x1,'day');}_[_0x839b('0x38')](_0x5d3af[_0x839b('0x39')],{'createdAt':{'$gte':_0x376210[_0x839b('0x2d')],'$lte':_0x376210[_0x839b('0x2e')]}});}if(_0x598706[_0x839b('0x2c')][_0x839b('0x3a')]){_0x5d3af[_0x839b('0x39')]=_[_0x839b('0x38')](_0x5d3af[_0x839b('0x39')],{'$or':_[_0x839b('0x3b')](_0x5d3af[_0x839b('0x31')],function(_0x38af4){var _0x11dff4={};_0x11dff4[_0x38af4]={'$like':'%'+_0x598706[_0x839b('0x2c')][_0x839b('0x3a')]+'%'};return _0x11dff4;})});}_0x5d3af=_['merge']({},_0x5d3af,_0x598706[_0x839b('0x3c')]);var _0x3e959c={'where':_0x5d3af[_0x839b('0x39')]};return db[_0x839b('0x28')][_0x839b('0x19')](_0x3e959c)[_0x839b('0x20')](function(_0x1fc1d1){_0x544237[_0x839b('0x19')]=_0x1fc1d1;if(_0x598706[_0x839b('0x2c')][_0x839b('0x3d')]){_0x5d3af['include']=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x5d3af);})[_0x839b('0x20')](function(_0x3689a7){_0x544237[_0x839b('0x3e')]=_0x3689a7;return _0x544237;})[_0x839b('0x20')](respondWithFilteredResult(_0x178bb0,_0x5d3af))[_0x839b('0x3f')](handleError(_0x178bb0,null));};exports[_0x839b('0x40')]=function(_0x57d38d,_0x489dd4){var _0x4dfce2={'raw':!![],'where':{'id':_0x57d38d['params']['id']}},_0x58c694={};_0x58c694[_0x839b('0x2a')]=_[_0x839b('0x2b')](db[_0x839b('0x28')][_0x839b('0x29')]);_0x58c694[_0x839b('0x2c')]=_[_0x839b('0x2b')](_0x57d38d[_0x839b('0x2c')]);_0x58c694[_0x839b('0x2f')]=_[_0x839b('0x30')](_0x58c694[_0x839b('0x2a')],_0x58c694[_0x839b('0x2c')]);_0x4dfce2[_0x839b('0x31')]=_[_0x839b('0x30')](_0x58c694[_0x839b('0x2a')],qs['fields'](_0x57d38d[_0x839b('0x2c')][_0x839b('0x41')]));_0x4dfce2[_0x839b('0x31')]=_0x4dfce2[_0x839b('0x31')][_0x839b('0x32')]?_0x4dfce2[_0x839b('0x31')]:_0x58c694[_0x839b('0x2a')];if(_0x57d38d[_0x839b('0x2c')][_0x839b('0x3d')]){_0x4dfce2[_0x839b('0x42')]=[{'all':!![]}];}_0x4dfce2=_[_0x839b('0x38')]({},_0x4dfce2,_0x57d38d['options']);return db[_0x839b('0x28')][_0x839b('0x43')](_0x4dfce2)[_0x839b('0x20')](handleEntityNotFound(_0x489dd4,null))[_0x839b('0x20')](respondWithResult(_0x489dd4,null))['catch'](handleError(_0x489dd4,null));};exports[_0x839b('0x44')]=function(_0x183dc8,_0x36c590){return db['VtigerField'][_0x839b('0x44')](_0x183dc8[_0x839b('0x45')],{})['then'](respondWithResult(_0x36c590,0xc9))[_0x839b('0x3f')](handleError(_0x36c590,null));};exports[_0x839b('0x46')]=function(_0x36d029,_0x4a4801){if(_0x36d029[_0x839b('0x45')]['id']){delete _0x36d029[_0x839b('0x45')]['id'];}return db[_0x839b('0x28')][_0x839b('0x43')]({'where':{'id':_0x36d029['params']['id']}})['then'](handleEntityNotFound(_0x4a4801,null))['then'](saveUpdates(_0x36d029['body'],null))[_0x839b('0x20')](respondWithResult(_0x4a4801,null))[_0x839b('0x3f')](handleError(_0x4a4801,null));};exports['destroy']=function(_0x5e4ac3,_0x2a610c){return db['VtigerField']['find']({'where':{'id':_0x5e4ac3[_0x839b('0x47')]['id']}})[_0x839b('0x20')](handleEntityNotFound(_0x2a610c,null))['then'](removeEntity(_0x2a610c,null))[_0x839b('0x3f')](handleError(_0x2a610c,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index dc65e3a..d5c525e 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 _0x65cf=['int_vtiger_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','exports','VtigerField'];(function(_0x2834d5,_0x58e88a){var _0x491454=function(_0x48d9d8){while(--_0x48d9d8){_0x2834d5['push'](_0x2834d5['shift']());}};_0x491454(++_0x58e88a);}(_0x65cf,0xe7));var _0xf65c=function(_0x1ea67e,_0x3faec8){_0x1ea67e=_0x1ea67e-0x0;var _0x3b6742=_0x65cf[_0x1ea67e];return _0x3b6742;};'use strict';var _=require(_0xf65c('0x0'));var util=require(_0xf65c('0x1'));var logger=require(_0xf65c('0x2'))(_0xf65c('0x3'));var moment=require(_0xf65c('0x4'));var BPromise=require(_0xf65c('0x5'));var rp=require(_0xf65c('0x6'));var attributes=require('./intVtigerField.attributes');module[_0xf65c('0x7')]=function(_0x2edd0c,_0x36c386){return _0x2edd0c['define'](_0xf65c('0x8'),attributes,{'tableName':_0xf65c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf10b=['exports','define','VtigerField','int_vtiger_fields','lodash','util','api','moment','bluebird','./intVtigerField.attributes'];(function(_0x40b2d3,_0x50c7d5){var _0x4e796d=function(_0x3921f2){while(--_0x3921f2){_0x40b2d3['push'](_0x40b2d3['shift']());}};_0x4e796d(++_0x50c7d5);}(_0xf10b,0xcc));var _0xbf10=function(_0x6a34d7,_0x1b997a){_0x6a34d7=_0x6a34d7-0x0;var _0x383928=_0xf10b[_0x6a34d7];return _0x383928;};'use strict';var _=require(_0xbf10('0x0'));var util=require(_0xbf10('0x1'));var logger=require('../../config/logger')(_0xbf10('0x2'));var moment=require(_0xbf10('0x3'));var BPromise=require(_0xbf10('0x4'));var rp=require('request-promise');var attributes=require(_0xbf10('0x5'));module[_0xbf10('0x6')]=function(_0x1342f8,_0x1efec1){return _0x1342f8[_0xbf10('0x7')](_0xbf10('0x8'),attributes,{'tableName':_0xbf10('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index f3202df..01a9328 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 _0x6b11=['http','request','info','request\x20sent','debug','stringify','error','code','VtigerField,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1aab1e,_0x19840c){var _0x3a275d=function(_0x200ff5){while(--_0x200ff5){_0x1aab1e['push'](_0x1aab1e['shift']());}};_0x3a275d(++_0x19840c);}(_0x6b11,0xf2));var _0x16b1=function(_0x41b0a8,_0x1b05cc){_0x41b0a8=_0x41b0a8-0x0;var _0x3a83d4=_0x6b11[_0x41b0a8];return _0x3a83d4;};'use strict';var _=require(_0x16b1('0x0'));var util=require(_0x16b1('0x1'));var moment=require('moment');var BPromise=require(_0x16b1('0x2'));var rs=require(_0x16b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x16b1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x16b1('0x5'))(_0x16b1('0x6'));var config=require(_0x16b1('0x7'));var jayson=require(_0x16b1('0x8'));var client=jayson[_0x16b1('0x9')][_0x16b1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd2090a,_0x58bc10,_0x187b4a){return new BPromise(function(_0x1651a6,_0x41c1ec){return client[_0x16b1('0xb')](_0xd2090a,_0x187b4a)['then'](function(_0x1736b1){logger[_0x16b1('0xc')]('VtigerField,\x20%s,\x20%s',_0x58bc10,_0x16b1('0xd'));logger[_0x16b1('0xe')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x58bc10,_0x16b1('0xd'),JSON[_0x16b1('0xf')](_0x1736b1));if(_0x1736b1[_0x16b1('0x10')]){if(_0x1736b1['error'][_0x16b1('0x11')]===0x1f4){logger[_0x16b1('0x10')](_0x16b1('0x12'),_0x58bc10,_0x1736b1['error']['message']);return _0x41c1ec(_0x1736b1['error']['message']);}logger[_0x16b1('0x10')](_0x16b1('0x12'),_0x58bc10,_0x1736b1[_0x16b1('0x10')][_0x16b1('0x13')]);return _0x1651a6(_0x1736b1[_0x16b1('0x10')][_0x16b1('0x13')]);}else{logger[_0x16b1('0xc')](_0x16b1('0x12'),_0x58bc10,'request\x20sent');_0x1651a6(_0x1736b1[_0x16b1('0x14')][_0x16b1('0x13')]);}})['catch'](function(_0x224657){logger['error'](_0x16b1('0x12'),_0x58bc10,_0x224657);_0x41c1ec(_0x224657);});});} \ No newline at end of file +var _0xde39=['../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','error','code','message','VtigerField,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3380f0,_0x41a8e7){var _0x1fa64b=function(_0x393245){while(--_0x393245){_0x3380f0['push'](_0x3380f0['shift']());}};_0x1fa64b(++_0x41a8e7);}(_0xde39,0x15e));var _0x9de3=function(_0x10316a,_0x125dc8){_0x10316a=_0x10316a-0x0;var _0x36ac2e=_0xde39[_0x10316a];return _0x36ac2e;};'use strict';var _=require(_0x9de3('0x0'));var util=require(_0x9de3('0x1'));var moment=require('moment');var BPromise=require(_0x9de3('0x2'));var rs=require(_0x9de3('0x3'));var fs=require('fs');var Redis=require(_0x9de3('0x4'));var db=require(_0x9de3('0x5'))['db'];var utils=require(_0x9de3('0x6'));var logger=require(_0x9de3('0x7'))('rpc');var config=require(_0x9de3('0x8'));var jayson=require(_0x9de3('0x9'));var client=jayson[_0x9de3('0xa')][_0x9de3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e6096,_0x26f9f6,_0x3eb46b){return new BPromise(function(_0xd8741a,_0xeead2e){return client[_0x9de3('0xc')](_0x4e6096,_0x3eb46b)['then'](function(_0x197faa){logger[_0x9de3('0xd')]('VtigerField,\x20%s,\x20%s',_0x26f9f6,_0x9de3('0xe'));logger['debug']('VtigerField,\x20%s,\x20%s,\x20%s',_0x26f9f6,'request\x20sent',JSON['stringify'](_0x197faa));if(_0x197faa[_0x9de3('0xf')]){if(_0x197faa[_0x9de3('0xf')][_0x9de3('0x10')]===0x1f4){logger[_0x9de3('0xf')]('VtigerField,\x20%s,\x20%s',_0x26f9f6,_0x197faa[_0x9de3('0xf')][_0x9de3('0x11')]);return _0xeead2e(_0x197faa[_0x9de3('0xf')][_0x9de3('0x11')]);}logger[_0x9de3('0xf')]('VtigerField,\x20%s,\x20%s',_0x26f9f6,_0x197faa['error'][_0x9de3('0x11')]);return _0xd8741a(_0x197faa[_0x9de3('0xf')][_0x9de3('0x11')]);}else{logger[_0x9de3('0xd')](_0x9de3('0x12'),_0x26f9f6,_0x9de3('0xe'));_0xd8741a(_0x197faa[_0x9de3('0x13')][_0x9de3('0x11')]);}})[_0x9de3('0x14')](function(_0x138167){logger['error'](_0x9de3('0x12'),_0x26f9f6,_0x138167);_0xeead2e(_0x138167);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index c2ca0ed..ed03a6e 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 _0x7b25=['isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','/:id','show','/:id/configurations'];(function(_0x285b09,_0x15afd4){var _0x2251e0=function(_0x4a43de){while(--_0x4a43de){_0x285b09['push'](_0x285b09['shift']());}};_0x2251e0(++_0x15afd4);}(_0x7b25,0xc4));var _0x57b2=function(_0x3bd01a,_0x25e946){_0x3bd01a=_0x3bd01a-0x0;var _0x4b0324=_0x7b25[_0x3bd01a];return _0x4b0324;};'use strict';var multer=require('multer');var util=require(_0x57b2('0x0'));var path=require(_0x57b2('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x57b2('0x2')]();var auth=require(_0x57b2('0x3'));var interaction=require(_0x57b2('0x4'));var config=require(_0x57b2('0x5'));var controller=require(_0x57b2('0x6'));router[_0x57b2('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x57b2('0x7')](_0x57b2('0x8'),auth['isAuthenticated'](),controller[_0x57b2('0x9')]);router[_0x57b2('0x7')](_0x57b2('0xa'),auth[_0x57b2('0xb')](),controller[_0x57b2('0xc')]);router['get'](_0x57b2('0xd'),auth[_0x57b2('0xb')](),controller[_0x57b2('0xe')]);router[_0x57b2('0xf')]('/',auth['isAuthenticated'](),controller[_0x57b2('0x10')]);router[_0x57b2('0xf')](_0x57b2('0xa'),auth[_0x57b2('0xb')](),controller[_0x57b2('0x11')]);router[_0x57b2('0x12')](_0x57b2('0x8'),auth[_0x57b2('0xb')](),controller[_0x57b2('0x13')]);router[_0x57b2('0x14')](_0x57b2('0x8'),auth[_0x57b2('0xb')](),controller[_0x57b2('0x15')]);module[_0x57b2('0x16')]=router; \ No newline at end of file +var _0xd7f0=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','isAuthenticated','index','/:id','show','get','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','delete','exports','connect-timeout'];(function(_0x83e371,_0x55d8a5){var _0x5c87c3=function(_0x3f91ca){while(--_0x3f91ca){_0x83e371['push'](_0x83e371['shift']());}};_0x5c87c3(++_0x55d8a5);}(_0xd7f0,0x92));var _0x0d7f=function(_0x1f6868,_0x31f01c){_0x1f6868=_0x1f6868-0x0;var _0x51ea85=_0xd7f0[_0x1f6868];return _0x51ea85;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x0d7f('0x0'));var express=require(_0x0d7f('0x1'));var router=express[_0x0d7f('0x2')]();var auth=require(_0x0d7f('0x3'));var interaction=require(_0x0d7f('0x4'));var config=require(_0x0d7f('0x5'));var controller=require(_0x0d7f('0x6'));router['get']('/',auth[_0x0d7f('0x7')](),controller[_0x0d7f('0x8')]);router['get'](_0x0d7f('0x9'),auth[_0x0d7f('0x7')](),controller[_0x0d7f('0xa')]);router[_0x0d7f('0xb')](_0x0d7f('0xc'),auth[_0x0d7f('0x7')](),controller[_0x0d7f('0xd')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x0d7f('0xe')]);router[_0x0d7f('0xf')]('/',auth[_0x0d7f('0x7')](),controller[_0x0d7f('0x10')]);router[_0x0d7f('0xf')](_0x0d7f('0xc'),auth[_0x0d7f('0x7')](),controller[_0x0d7f('0x11')]);router[_0x0d7f('0x12')]('/:id',auth[_0x0d7f('0x7')](),controller['update']);router[_0x0d7f('0x13')](_0x0d7f('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x0d7f('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 3068cdd..eb77a0d 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 _0x14b6=['exports','STRING','remoteUri','password','newTab','sequelize'];(function(_0x95411e,_0x38b4c3){var _0x2c8718=function(_0x35c672){while(--_0x35c672){_0x95411e['push'](_0x95411e['shift']());}};_0x2c8718(++_0x38b4c3);}(_0x14b6,0xbf));var _0x614b=function(_0x49c4de,_0xac4172){_0x49c4de=_0x49c4de-0x0;var _0xdcc4d3=_0x14b6[_0x49c4de];return _0xdcc4d3;};'use strict';var Sequelize=require(_0x614b('0x0'));module[_0x614b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x614b('0x2')]},'username':{'type':Sequelize[_0x614b('0x2')],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x614b('0x2')],'unique':_0x614b('0x3')},'authType':{'type':Sequelize['ENUM'](_0x614b('0x4'),'token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x614b('0x2')]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x614b('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x9860=['exports','STRING','username','remoteUri','password','token','ENUM','integrationTab','newTab'];(function(_0x38caee,_0x2bb6b4){var _0x129566=function(_0x1fbee4){while(--_0x1fbee4){_0x38caee['push'](_0x38caee['shift']());}};_0x129566(++_0x2bb6b4);}(_0x9860,0x15f));var _0x0986=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9860[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x0986('0x0')]={'name':{'type':Sequelize[_0x0986('0x1')]},'description':{'type':Sequelize[_0x0986('0x1')]},'username':{'type':Sequelize[_0x0986('0x1')],'unique':_0x0986('0x2')},'password':{'type':Sequelize[_0x0986('0x1')]},'token':{'type':Sequelize[_0x0986('0x1')]},'remoteUri':{'type':Sequelize[_0x0986('0x1')],'unique':_0x0986('0x3')},'authType':{'type':Sequelize['ENUM'](_0x0986('0x4'),_0x0986('0x5')),'defaultValue':_0x0986('0x4')},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0986('0x6')](_0x0986('0x7'),_0x0986('0x8')),'defaultValue':_0x0986('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 03470e3..1954232 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 _0x6131=['ticket_fields','position','title','system_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','json','count','offset','status','Content-Range','apply','reject','save','destroy','end','stack','name','send','ZendeskAccount','rawAttributes','query','dateStart','dateEnd','filters','model','fields','attributes','length','hasOwnProperty','limit','sort','pick','add','day','where','merge','map','filter','options','includeAll','include','rows','show','params','keys','intersection','find','create','body','getConfigurations','findOne','order','AccountId','getSubjects','channel','type','ZendeskConfiguration','ZendeskField','Descriptions','token','authType','remoteUri','GET','format','%s%s','password','headers','Basic\x20%s','%s:%s','username','toString','%s/token:%s','base64','ValidationError','Unknown\x20authentication\x20type','group','assignee','remove'];(function(_0x37241e,_0x2820d5){var _0x4ce4f6=function(_0x5b2751){while(--_0x5b2751){_0x37241e['push'](_0x37241e['shift']());}};_0x4ce4f6(++_0x2820d5);}(_0x6131,0x81));var _0x1613=function(_0x25c53e,_0x2abe2f){_0x25c53e=_0x25c53e-0x0;var _0x486bed=_0x6131[_0x25c53e];return _0x486bed;};'use strict';var pdf=require(_0x1613('0x0'));var emlformat=require(_0x1613('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1613('0x2'));var rp=require(_0x1613('0x3'));var moment=require(_0x1613('0x4'));var BPromise=require(_0x1613('0x5'));var Mustache=require('mustache');var util=require(_0x1613('0x6'));var path=require(_0x1613('0x7'));var sox=require(_0x1613('0x8'));var csv=require(_0x1613('0x9'));var ejs=require(_0x1613('0xa'));var fs=require('fs');var _=require(_0x1613('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1613('0xc'));var deskjs=require(_0x1613('0xd'));var toCsv=require(_0x1613('0x9'));var querystring=require(_0x1613('0xe'));var Papa=require(_0x1613('0xf'));var Redis=require('ioredis');var qs=require(_0x1613('0x10'));var logger=require('../../config/logger')(_0x1613('0x11'));var utils=require(_0x1613('0x12'));var config=require('../../config/environment');var db=require(_0x1613('0x13'))['db'];var integrations=require(_0x1613('0x14'));var jayson=require(_0x1613('0x15'));var client=jayson[_0x1613('0x16')][_0x1613('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x5d57f4,_0x549a60,_0x32e6a7,_0x3a1259){return new BPromise(function(_0xbc0178,_0x51d686){var _0x5191da=_0x3a1259||client;return _0x5191da[_0x1613('0x18')](_0x5d57f4,_0x32e6a7)[_0x1613('0x19')](function(_0x3f9daa){logger[_0x1613('0x1a')](_0x1613('0x1b'),_0x549a60,'request\x20sent');logger[_0x1613('0x1c')](_0x1613('0x1d'),_0x549a60,_0x1613('0x1e'),JSON[_0x1613('0x1f')](_0x3f9daa));if(_0x3f9daa[_0x1613('0x20')]){if(_0x3f9daa[_0x1613('0x20')][_0x1613('0x21')]===0x1f4){logger['error'](_0x1613('0x1b'),_0x549a60,_0x3f9daa[_0x1613('0x20')]['message']);return _0x51d686(_0x3f9daa['error'][_0x1613('0x22')]);}logger[_0x1613('0x20')](_0x1613('0x1b'),_0x549a60,_0x3f9daa['error'][_0x1613('0x22')]);return _0xbc0178(_0x3f9daa[_0x1613('0x20')][_0x1613('0x22')]);}else{logger[_0x1613('0x1a')](_0x1613('0x1b'),_0x549a60,_0x1613('0x1e'));_0xbc0178(_0x3f9daa[_0x1613('0x23')][_0x1613('0x22')]);}})[_0x1613('0x24')](function(_0x59713b){logger[_0x1613('0x20')](_0x1613('0x1b'),_0x549a60,_0x59713b);_0x51d686(_0x59713b);});});}function respondWithStatusCode(_0x1d9490,_0x535796){_0x535796=_0x535796||0xcc;return function(_0x4ca472){if(_0x4ca472){return _0x1d9490[_0x1613('0x25')](_0x535796);}return _0x1d9490['status'](_0x535796)['end']();};}function respondWithResult(_0x3fdd5a,_0x535ac1){_0x535ac1=_0x535ac1||0xc8;return function(_0x245dcd){if(_0x245dcd){return _0x3fdd5a['status'](_0x535ac1)[_0x1613('0x26')](_0x245dcd);}};}function respondWithFilteredResult(_0x52685b,_0x28daab){return function(_0x52e948){if(_0x52e948){var _0x5e574e=_0x52e948[_0x1613('0x27')],_0x1d4bd1=_0x28daab[_0x1613('0x28')],_0x306d74=_0x28daab[_0x1613('0x28')]+_0x28daab['limit'],_0x393504;if(_0x306d74>=_0x5e574e){_0x306d74=_0x5e574e;_0x393504=0xc8;}else{_0x393504=0xce;}_0x52685b[_0x1613('0x29')](_0x393504);return _0x52685b['set'](_0x1613('0x2a'),_0x1d4bd1+'-'+_0x306d74+'/'+_0x5e574e)['json'](_0x52e948);}return null;};}function patchUpdates(_0x26986b){return function(_0x17b8cd){try{jsonpatch[_0x1613('0x2b')](_0x17b8cd,_0x26986b,!![]);}catch(_0x44b163){return BPromise[_0x1613('0x2c')](_0x44b163);}return _0x17b8cd[_0x1613('0x2d')]();};}function saveUpdates(_0x5d0ab8,_0x3211ee){return function(_0x5a6836){if(_0x5a6836){return _0x5a6836['update'](_0x5d0ab8)[_0x1613('0x19')](function(_0x24150){return _0x24150;});}return null;};}function removeEntity(_0x249f46,_0x2ee487){return function(_0x4e81ca){if(_0x4e81ca){return _0x4e81ca[_0x1613('0x2e')]()[_0x1613('0x19')](function(){_0x249f46[_0x1613('0x29')](0xcc)[_0x1613('0x2f')]();});}};}function handleEntityNotFound(_0x12e103,_0x3ddac8){return function(_0x42cb58){if(!_0x42cb58){_0x12e103['sendStatus'](0x194);}return _0x42cb58;};}function handleError(_0x370a4d,_0x3a681a){_0x3a681a=_0x3a681a||0x1f4;return function(_0x1e474f){logger[_0x1613('0x20')](_0x1e474f[_0x1613('0x30')]);if(_0x1e474f[_0x1613('0x31')]){delete _0x1e474f['name'];}_0x370a4d[_0x1613('0x29')](_0x3a681a)[_0x1613('0x32')](_0x1e474f);};}exports['index']=function(_0x239115,_0xe1b69c){var _0x17065e={},_0x1b35db={},_0x4dbc8c={'count':0x0,'rows':[]};var _0x42ffcd=db[_0x1613('0x33')][_0x1613('0x34')];_0x1b35db['model']=_['keys'](_0x42ffcd);var _0x1811ae={'dateStart':_0x239115[_0x1613('0x35')][_0x1613('0x36')],'dateEnd':_0x239115[_0x1613('0x35')][_0x1613('0x37')]};delete _0x239115[_0x1613('0x35')]['dateStart'];delete _0x239115[_0x1613('0x35')]['dateEnd'];_0x1b35db[_0x1613('0x35')]=_['keys'](_0x239115[_0x1613('0x35')]);_0x1b35db[_0x1613('0x38')]=_['intersection'](_0x1b35db['model'],_0x1b35db[_0x1613('0x35')]);_0x17065e['attributes']=_['intersection'](_0x1b35db[_0x1613('0x39')],qs[_0x1613('0x3a')](_0x239115[_0x1613('0x35')][_0x1613('0x3a')]));_0x17065e[_0x1613('0x3b')]=_0x17065e[_0x1613('0x3b')][_0x1613('0x3c')]?_0x17065e[_0x1613('0x3b')]:_0x1b35db['model'];if(!_0x239115['query'][_0x1613('0x3d')]('nolimit')){_0x17065e[_0x1613('0x3e')]=qs[_0x1613('0x3e')](_0x239115[_0x1613('0x35')][_0x1613('0x3e')]);_0x17065e[_0x1613('0x28')]=qs[_0x1613('0x28')](_0x239115[_0x1613('0x35')][_0x1613('0x28')]);}_0x17065e['order']=qs[_0x1613('0x3f')](_0x239115[_0x1613('0x35')][_0x1613('0x3f')]);_0x17065e['where']=qs['filters'](_[_0x1613('0x40')](_0x239115['query'],_0x1b35db['filters']));if(_0x1811ae[_0x1613('0x36')]){if(_0x1811ae[_0x1613('0x37')]){_0x1811ae[_0x1613('0x37')]=moment(_0x1811ae[_0x1613('0x37')])[_0x1613('0x41')](0x1,'day');}else{_0x1811ae['dateEnd']=moment(_0x1811ae['dateStart'])['add'](0x1,_0x1613('0x42'));}_['merge'](_0x17065e[_0x1613('0x43')],{'createdAt':{'$gte':_0x1811ae[_0x1613('0x36')],'$lte':_0x1811ae['dateEnd']}});}if(_0x239115[_0x1613('0x35')]['filter']){_0x17065e[_0x1613('0x43')]=_[_0x1613('0x44')](_0x17065e[_0x1613('0x43')],{'$or':_[_0x1613('0x45')](_0x17065e[_0x1613('0x3b')],function(_0x1569b0){var _0x1ed999={};_0x1ed999[_0x1569b0]={'$like':'%'+_0x239115[_0x1613('0x35')][_0x1613('0x46')]+'%'};return _0x1ed999;})});}_0x17065e=_[_0x1613('0x44')]({},_0x17065e,_0x239115[_0x1613('0x47')]);var _0x3c41bd={'where':_0x17065e[_0x1613('0x43')]};return db[_0x1613('0x33')][_0x1613('0x27')](_0x3c41bd)[_0x1613('0x19')](function(_0x558817){_0x4dbc8c['count']=_0x558817;if(_0x239115[_0x1613('0x35')][_0x1613('0x48')]){_0x17065e[_0x1613('0x49')]=[{'all':!![]}];}return db[_0x1613('0x33')]['findAll'](_0x17065e);})[_0x1613('0x19')](function(_0x4fb78d){_0x4dbc8c[_0x1613('0x4a')]=_0x4fb78d;return _0x4dbc8c;})[_0x1613('0x19')](respondWithFilteredResult(_0xe1b69c,_0x17065e))[_0x1613('0x24')](handleError(_0xe1b69c,null));};exports[_0x1613('0x4b')]=function(_0x118d13,_0x55732d){var _0x4e590a={'raw':![],'where':{'id':_0x118d13[_0x1613('0x4c')]['id']}},_0xbe884c={};_0xbe884c['model']=_[_0x1613('0x4d')](db[_0x1613('0x33')]['rawAttributes']);_0xbe884c[_0x1613('0x35')]=_['keys'](_0x118d13[_0x1613('0x35')]);_0xbe884c[_0x1613('0x38')]=_[_0x1613('0x4e')](_0xbe884c[_0x1613('0x39')],_0xbe884c[_0x1613('0x35')]);_0x4e590a['attributes']=_[_0x1613('0x4e')](_0xbe884c[_0x1613('0x39')],qs[_0x1613('0x3a')](_0x118d13[_0x1613('0x35')][_0x1613('0x3a')]));_0x4e590a[_0x1613('0x3b')]=_0x4e590a[_0x1613('0x3b')][_0x1613('0x3c')]?_0x4e590a['attributes']:_0xbe884c[_0x1613('0x39')];if(_0x118d13[_0x1613('0x35')][_0x1613('0x48')]){_0x4e590a[_0x1613('0x49')]=[{'all':!![]}];}_0x4e590a=_['merge']({},_0x4e590a,_0x118d13[_0x1613('0x47')]);return db[_0x1613('0x33')][_0x1613('0x4f')](_0x4e590a)[_0x1613('0x19')](handleEntityNotFound(_0x55732d,null))[_0x1613('0x19')](respondWithResult(_0x55732d,null))[_0x1613('0x24')](handleError(_0x55732d,null));};exports[_0x1613('0x50')]=function(_0x2729c6,_0x4752a9){return db[_0x1613('0x33')]['create'](_0x2729c6[_0x1613('0x51')],{})[_0x1613('0x19')](respondWithResult(_0x4752a9,0xc9))[_0x1613('0x24')](handleError(_0x4752a9,null));};exports['update']=function(_0x2fd36e,_0xc647cd){if(_0x2fd36e[_0x1613('0x51')]['id']){delete _0x2fd36e[_0x1613('0x51')]['id'];}return db[_0x1613('0x33')][_0x1613('0x4f')]({'where':{'id':_0x2fd36e[_0x1613('0x4c')]['id']}})['then'](handleEntityNotFound(_0xc647cd,null))[_0x1613('0x19')](saveUpdates(_0x2fd36e[_0x1613('0x51')],null))[_0x1613('0x19')](respondWithResult(_0xc647cd,null))['catch'](handleError(_0xc647cd,null));};exports[_0x1613('0x2e')]=function(_0x175213,_0x55b8ad){return db[_0x1613('0x33')][_0x1613('0x4f')]({'where':{'id':_0x175213[_0x1613('0x4c')]['id']}})['then'](handleEntityNotFound(_0x55b8ad,null))[_0x1613('0x19')](removeEntity(_0x55b8ad,null))[_0x1613('0x24')](handleError(_0x55b8ad,null));};exports[_0x1613('0x52')]=function(_0x2aa90b,_0x37b466,_0x486d3a){var _0x34eb98={};var _0x7e2afa={};var _0x12c5c5;var _0x34243e;return db[_0x1613('0x33')][_0x1613('0x53')]({'where':{'id':_0x2aa90b[_0x1613('0x4c')]['id']}})[_0x1613('0x19')](handleEntityNotFound(_0x37b466,null))[_0x1613('0x19')](function(_0xfa091b){if(_0xfa091b){_0x12c5c5=_0xfa091b;_0x7e2afa[_0x1613('0x39')]=_[_0x1613('0x4d')](db['ZendeskConfiguration'][_0x1613('0x34')]);_0x7e2afa[_0x1613('0x35')]=_[_0x1613('0x4d')](_0x2aa90b['query']);_0x7e2afa[_0x1613('0x38')]=_[_0x1613('0x4e')](_0x7e2afa[_0x1613('0x39')],_0x7e2afa['query']);_0x34eb98['attributes']=_[_0x1613('0x4e')](_0x7e2afa[_0x1613('0x39')],qs[_0x1613('0x3a')](_0x2aa90b[_0x1613('0x35')]['fields']));_0x34eb98[_0x1613('0x3b')]=_0x34eb98[_0x1613('0x3b')]['length']?_0x34eb98[_0x1613('0x3b')]:_0x7e2afa['model'];_0x34eb98[_0x1613('0x54')]=qs[_0x1613('0x3f')](_0x2aa90b['query']['sort']);_0x34eb98[_0x1613('0x43')]=qs[_0x1613('0x38')](_[_0x1613('0x40')](_0x2aa90b['query'],_0x7e2afa[_0x1613('0x38')]));if(_0x2aa90b['query'][_0x1613('0x46')]){_0x34eb98['where']=_['merge'](_0x34eb98[_0x1613('0x43')],{'$or':_[_0x1613('0x45')](_0x34eb98['attributes'],function(_0x3c7446){var _0x11ff1e={};_0x11ff1e[_0x3c7446]={'$like':'%'+_0x2aa90b[_0x1613('0x35')][_0x1613('0x46')]+'%'};return _0x11ff1e;})});}_0x34eb98=_[_0x1613('0x44')]({},_0x34eb98,_0x2aa90b[_0x1613('0x47')]);return _0x12c5c5[_0x1613('0x52')](_0x34eb98);}})[_0x1613('0x19')](function(_0x23ea89){if(_0x23ea89){_0x34243e=_0x23ea89[_0x1613('0x3c')];if(!_0x2aa90b[_0x1613('0x35')]['hasOwnProperty']('nolimit')){_0x34eb98['limit']=qs[_0x1613('0x3e')](_0x2aa90b[_0x1613('0x35')][_0x1613('0x3e')]);_0x34eb98[_0x1613('0x28')]=qs[_0x1613('0x28')](_0x2aa90b[_0x1613('0x35')][_0x1613('0x28')]);}return _0x12c5c5[_0x1613('0x52')](_0x34eb98);}})[_0x1613('0x19')](function(_0x5ba42b){if(_0x5ba42b){return _0x5ba42b?{'count':_0x34243e,'rows':_0x5ba42b}:null;}})[_0x1613('0x19')](respondWithResult(_0x37b466,null))[_0x1613('0x24')](handleError(_0x37b466,null));};exports['addConfiguration']=function(_0x337cd5,_0xe23df2,_0x22238a){if(_0x337cd5[_0x1613('0x51')]['id']){delete _0x337cd5[_0x1613('0x51')]['id'];}return db[_0x1613('0x33')][_0x1613('0x53')]({'where':{'id':_0x337cd5[_0x1613('0x4c')]['id']}})[_0x1613('0x19')](handleEntityNotFound(_0xe23df2,null))[_0x1613('0x19')](function(_0x34934f){if(_0x34934f){_0x337cd5[_0x1613('0x51')][_0x1613('0x55')]=_0x34934f['id'];_0x337cd5[_0x1613('0x51')]['Subjects']=integrations[_0x1613('0x56')](_0x337cd5['body'][_0x1613('0x57')],_0x337cd5[_0x1613('0x51')][_0x1613('0x58')]);_0x337cd5[_0x1613('0x51')]['Descriptions']=integrations['getDescriptions'](_0x337cd5[_0x1613('0x51')][_0x1613('0x57')],_0x337cd5[_0x1613('0x51')][_0x1613('0x58')]);return db[_0x1613('0x59')][_0x1613('0x50')](_0x337cd5['body'],{'include':[{'model':db[_0x1613('0x5a')],'as':'Subjects'},{'model':db[_0x1613('0x5a')],'as':_0x1613('0x5b')}]});}return null;})[_0x1613('0x19')](respondWithResult(_0xe23df2,null))[_0x1613('0x24')](handleError(_0xe23df2,null));};exports['getFields']=function(_0xac63aa,_0x25ff34,_0x2d55ea){return db['ZendeskAccount']['findOne']({'where':{'id':_0xac63aa[_0x1613('0x4c')]['id']},'attributes':['id','username','password',_0x1613('0x5c'),_0x1613('0x5d'),_0x1613('0x5e')]})[_0x1613('0x19')](handleEntityNotFound(_0x25ff34,null))['then'](function(_0x2b1146){if(_0x2b1146){var _0x553051={'method':_0x1613('0x5f'),'uri':util[_0x1613('0x60')](_0x1613('0x61'),_0x2b1146['remoteUri'],'ticket_fields'),'json':!![]};switch(_0x2b1146[_0x1613('0x5d')]){case _0x1613('0x62'):_0x553051[_0x1613('0x63')]={'Authorization':util['format'](_0x1613('0x64'),new Buffer(util[_0x1613('0x60')](_0x1613('0x65'),_0x2b1146[_0x1613('0x66')],_0x2b1146[_0x1613('0x62')]))[_0x1613('0x67')]('base64'))};break;case _0x1613('0x5c'):_0x553051['headers']={'Authorization':util['format'](_0x1613('0x64'),new Buffer(util[_0x1613('0x60')](_0x1613('0x68'),_0x2b1146[_0x1613('0x66')],_0x2b1146[_0x1613('0x5c')]))['toString'](_0x1613('0x69')))};break;default:throw new db['Sequelize'][(_0x1613('0x6a'))](_0x1613('0x6b'));}return rp(_0x553051);}})[_0x1613('0x19')](function(_0x442407){if(_0x442407){var _0x37f7f6=['subject','description',_0x1613('0x6c'),_0x1613('0x6d')];_[_0x1613('0x6e')](_0x442407[_0x1613('0x6f')],function(_0x1b4e0c){return _0x37f7f6['includes'](_0x1b4e0c[_0x1613('0x58')]);});return{'count':_0x442407[_0x1613('0x6f')][_0x1613('0x3c')],'rows':_[_0x1613('0x45')](_0x442407['ticket_fields'],function(_0x5eee97){return{'id':_0x5eee97['id'],'name':_0x5eee97[_0x1613('0x70')]>0x7?_0x5eee97[_0x1613('0x71')]:_0x5eee97[_0x1613('0x58')],'custom':_0x5eee97[_0x1613('0x70')]>0x7?!![]:![],'options':_0x5eee97[_0x1613('0x72')]?_0x5eee97[_0x1613('0x72')]:[]};})};}})[_0x1613('0x19')](respondWithResult(_0x25ff34,null))[_0x1613('0x24')](function(_0x397b54){var _0x21ff93=_0xac63aa[_0x1613('0x35')][_0x1613('0x73')]?0x1f4:_0x397b54[_0x1613('0x74')]||0x1f4;logger['error'](_0x1613('0x75'),_0x1613('0x76'),_0x21ff93,JSON[_0x1613('0x1f')](_0x397b54));delete _0x397b54[_0x1613('0x31')];if(_0x21ff93===0x191){_0x21ff93=0x190;}_0x25ff34['status'](_0x21ff93)[_0x1613('0x32')](_0xac63aa[_0x1613('0x35')][_0x1613('0x73')]?{'message':_0x1613('0x77'),'statusCode':_0x397b54[_0x1613('0x74')]}:_0x397b54);});}; \ No newline at end of file +var _0x2bc9=['create','body','update','getConfigurations','addConfiguration','findOne','getSubjects','type','Descriptions','ZendeskField','Subjects','getFields','password','token','authType','remoteUri','GET','format','%s%s','ticket_fields','headers','%s:%s','username','toString','base64','Basic\x20%s','%s/token:%s','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZendeskAccount,\x20%s,\x20%s','catch','end','json','offset','limit','Content-Range','apply','reject','save','destroy','status','sendStatus','stack','name','index','ZendeskAccount','rawAttributes','model','keys','dateStart','query','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','count','findAll','rows','params','includeAll','include','find'];(function(_0x5e3701,_0x596265){var _0x345dcf=function(_0x5eb12a){while(--_0x5eb12a){_0x5e3701['push'](_0x5e3701['shift']());}};_0x345dcf(++_0x596265);}(_0x2bc9,0xa7));var _0x92bc=function(_0x5df952,_0x3940da){_0x5df952=_0x5df952-0x0;var _0xf5400a=_0x2bc9[_0x5df952];return _0xf5400a;};'use strict';var pdf=require(_0x92bc('0x0'));var emlformat=require(_0x92bc('0x1'));var rimraf=require(_0x92bc('0x2'));var zipdir=require(_0x92bc('0x3'));var jsonpatch=require(_0x92bc('0x4'));var rp=require(_0x92bc('0x5'));var moment=require(_0x92bc('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x92bc('0x7'));var sox=require(_0x92bc('0x8'));var csv=require(_0x92bc('0x9'));var ejs=require(_0x92bc('0xa'));var fs=require('fs');var _=require(_0x92bc('0xb'));var squel=require(_0x92bc('0xc'));var crypto=require(_0x92bc('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x92bc('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x92bc('0xf'));var Redis=require(_0x92bc('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0x92bc('0x11'))(_0x92bc('0x12'));var utils=require(_0x92bc('0x13'));var config=require(_0x92bc('0x14'));var db=require(_0x92bc('0x15'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x92bc('0x16'));var client=jayson[_0x92bc('0x17')][_0x92bc('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x7ab672,_0x2de8fe,_0x44e85a,_0x474857){return new BPromise(function(_0x1b0920,_0x47e20b){var _0x94606e=_0x474857||client;return _0x94606e[_0x92bc('0x19')](_0x7ab672,_0x44e85a)[_0x92bc('0x1a')](function(_0x244672){logger[_0x92bc('0x1b')]('ZendeskAccount,\x20%s,\x20%s',_0x2de8fe,_0x92bc('0x1c'));logger['debug'](_0x92bc('0x1d'),_0x2de8fe,_0x92bc('0x1c'),JSON[_0x92bc('0x1e')](_0x244672));if(_0x244672['error']){if(_0x244672[_0x92bc('0x1f')][_0x92bc('0x20')]===0x1f4){logger[_0x92bc('0x1f')]('ZendeskAccount,\x20%s,\x20%s',_0x2de8fe,_0x244672[_0x92bc('0x1f')][_0x92bc('0x21')]);return _0x47e20b(_0x244672[_0x92bc('0x1f')][_0x92bc('0x21')]);}logger[_0x92bc('0x1f')](_0x92bc('0x22'),_0x2de8fe,_0x244672[_0x92bc('0x1f')][_0x92bc('0x21')]);return _0x1b0920(_0x244672['error']['message']);}else{logger[_0x92bc('0x1b')](_0x92bc('0x22'),_0x2de8fe,'request\x20sent');_0x1b0920(_0x244672['result'][_0x92bc('0x21')]);}})[_0x92bc('0x23')](function(_0x322985){logger[_0x92bc('0x1f')](_0x92bc('0x22'),_0x2de8fe,_0x322985);_0x47e20b(_0x322985);});});}function respondWithStatusCode(_0x331f15,_0x1531cc){_0x1531cc=_0x1531cc||0xcc;return function(_0x13eba9){if(_0x13eba9){return _0x331f15['sendStatus'](_0x1531cc);}return _0x331f15['status'](_0x1531cc)[_0x92bc('0x24')]();};}function respondWithResult(_0x38b6d3,_0x117fe9){_0x117fe9=_0x117fe9||0xc8;return function(_0x163927){if(_0x163927){return _0x38b6d3['status'](_0x117fe9)[_0x92bc('0x25')](_0x163927);}};}function respondWithFilteredResult(_0x13429c,_0x511d8d){return function(_0x3d7a55){if(_0x3d7a55){var _0x17c3d9=_0x3d7a55['count'],_0xa76502=_0x511d8d[_0x92bc('0x26')],_0x5240bf=_0x511d8d[_0x92bc('0x26')]+_0x511d8d[_0x92bc('0x27')],_0x5a8d60;if(_0x5240bf>=_0x17c3d9){_0x5240bf=_0x17c3d9;_0x5a8d60=0xc8;}else{_0x5a8d60=0xce;}_0x13429c['status'](_0x5a8d60);return _0x13429c['set'](_0x92bc('0x28'),_0xa76502+'-'+_0x5240bf+'/'+_0x17c3d9)[_0x92bc('0x25')](_0x3d7a55);}return null;};}function patchUpdates(_0x5a8ef3){return function(_0x2c108c){try{jsonpatch[_0x92bc('0x29')](_0x2c108c,_0x5a8ef3,!![]);}catch(_0x44af23){return BPromise[_0x92bc('0x2a')](_0x44af23);}return _0x2c108c[_0x92bc('0x2b')]();};}function saveUpdates(_0x53a412,_0x28df47){return function(_0x4cb0e2){if(_0x4cb0e2){return _0x4cb0e2['update'](_0x53a412)[_0x92bc('0x1a')](function(_0x2cf419){return _0x2cf419;});}return null;};}function removeEntity(_0x4bb58e,_0x353b59){return function(_0x364cb5){if(_0x364cb5){return _0x364cb5[_0x92bc('0x2c')]()[_0x92bc('0x1a')](function(){_0x4bb58e[_0x92bc('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25e9cb,_0xe05fdf){return function(_0x1b82f7){if(!_0x1b82f7){_0x25e9cb[_0x92bc('0x2e')](0x194);}return _0x1b82f7;};}function handleError(_0x2ea56b,_0x25b72c){_0x25b72c=_0x25b72c||0x1f4;return function(_0x3f2a04){logger[_0x92bc('0x1f')](_0x3f2a04[_0x92bc('0x2f')]);if(_0x3f2a04[_0x92bc('0x30')]){delete _0x3f2a04[_0x92bc('0x30')];}_0x2ea56b[_0x92bc('0x2d')](_0x25b72c)['send'](_0x3f2a04);};}exports[_0x92bc('0x31')]=function(_0x63b7f,_0x3c5b66){var _0x38c5fe={},_0x4dea1e={},_0x451183={'count':0x0,'rows':[]};var _0x9121cc=db[_0x92bc('0x32')][_0x92bc('0x33')];_0x4dea1e[_0x92bc('0x34')]=_[_0x92bc('0x35')](_0x9121cc);var _0x28eeca={'dateStart':_0x63b7f['query'][_0x92bc('0x36')],'dateEnd':_0x63b7f[_0x92bc('0x37')][_0x92bc('0x38')]};delete _0x63b7f[_0x92bc('0x37')]['dateStart'];delete _0x63b7f['query']['dateEnd'];_0x4dea1e[_0x92bc('0x37')]=_['keys'](_0x63b7f[_0x92bc('0x37')]);_0x4dea1e[_0x92bc('0x39')]=_[_0x92bc('0x3a')](_0x4dea1e['model'],_0x4dea1e[_0x92bc('0x37')]);_0x38c5fe[_0x92bc('0x3b')]=_['intersection'](_0x4dea1e[_0x92bc('0x34')],qs[_0x92bc('0x3c')](_0x63b7f[_0x92bc('0x37')][_0x92bc('0x3c')]));_0x38c5fe['attributes']=_0x38c5fe['attributes'][_0x92bc('0x3d')]?_0x38c5fe[_0x92bc('0x3b')]:_0x4dea1e[_0x92bc('0x34')];if(!_0x63b7f['query'][_0x92bc('0x3e')](_0x92bc('0x3f'))){_0x38c5fe['limit']=qs[_0x92bc('0x27')](_0x63b7f[_0x92bc('0x37')][_0x92bc('0x27')]);_0x38c5fe['offset']=qs[_0x92bc('0x26')](_0x63b7f[_0x92bc('0x37')][_0x92bc('0x26')]);}_0x38c5fe[_0x92bc('0x40')]=qs[_0x92bc('0x41')](_0x63b7f['query'][_0x92bc('0x41')]);_0x38c5fe[_0x92bc('0x42')]=qs[_0x92bc('0x39')](_[_0x92bc('0x43')](_0x63b7f['query'],_0x4dea1e['filters']));if(_0x28eeca['dateStart']){if(_0x28eeca[_0x92bc('0x38')]){_0x28eeca[_0x92bc('0x38')]=moment(_0x28eeca['dateEnd'])[_0x92bc('0x44')](0x1,_0x92bc('0x45'));}else{_0x28eeca[_0x92bc('0x38')]=moment(_0x28eeca[_0x92bc('0x36')])[_0x92bc('0x44')](0x1,_0x92bc('0x45'));}_[_0x92bc('0x46')](_0x38c5fe[_0x92bc('0x42')],{'createdAt':{'$gte':_0x28eeca[_0x92bc('0x36')],'$lte':_0x28eeca[_0x92bc('0x38')]}});}if(_0x63b7f[_0x92bc('0x37')][_0x92bc('0x47')]){_0x38c5fe[_0x92bc('0x42')]=_[_0x92bc('0x46')](_0x38c5fe[_0x92bc('0x42')],{'$or':_[_0x92bc('0x48')](_0x38c5fe[_0x92bc('0x3b')],function(_0x438bec){var _0x55e8dc={};_0x55e8dc[_0x438bec]={'$like':'%'+_0x63b7f[_0x92bc('0x37')][_0x92bc('0x47')]+'%'};return _0x55e8dc;})});}_0x38c5fe=_[_0x92bc('0x46')]({},_0x38c5fe,_0x63b7f[_0x92bc('0x49')]);var _0x20f7cf={'where':_0x38c5fe[_0x92bc('0x42')]};return db[_0x92bc('0x32')][_0x92bc('0x4a')](_0x20f7cf)[_0x92bc('0x1a')](function(_0x2de763){_0x451183[_0x92bc('0x4a')]=_0x2de763;if(_0x63b7f['query']['includeAll']){_0x38c5fe['include']=[{'all':!![]}];}return db[_0x92bc('0x32')][_0x92bc('0x4b')](_0x38c5fe);})[_0x92bc('0x1a')](function(_0x4d3e0f){_0x451183[_0x92bc('0x4c')]=_0x4d3e0f;return _0x451183;})['then'](respondWithFilteredResult(_0x3c5b66,_0x38c5fe))['catch'](handleError(_0x3c5b66,null));};exports['show']=function(_0x5988ab,_0x5ce32d){var _0x262fe0={'raw':![],'where':{'id':_0x5988ab[_0x92bc('0x4d')]['id']}},_0x17ef64={};_0x17ef64[_0x92bc('0x34')]=_[_0x92bc('0x35')](db[_0x92bc('0x32')]['rawAttributes']);_0x17ef64['query']=_[_0x92bc('0x35')](_0x5988ab[_0x92bc('0x37')]);_0x17ef64['filters']=_[_0x92bc('0x3a')](_0x17ef64[_0x92bc('0x34')],_0x17ef64[_0x92bc('0x37')]);_0x262fe0[_0x92bc('0x3b')]=_[_0x92bc('0x3a')](_0x17ef64[_0x92bc('0x34')],qs[_0x92bc('0x3c')](_0x5988ab[_0x92bc('0x37')][_0x92bc('0x3c')]));_0x262fe0[_0x92bc('0x3b')]=_0x262fe0['attributes'][_0x92bc('0x3d')]?_0x262fe0['attributes']:_0x17ef64[_0x92bc('0x34')];if(_0x5988ab[_0x92bc('0x37')][_0x92bc('0x4e')]){_0x262fe0[_0x92bc('0x4f')]=[{'all':!![]}];}_0x262fe0=_[_0x92bc('0x46')]({},_0x262fe0,_0x5988ab[_0x92bc('0x49')]);return db[_0x92bc('0x32')][_0x92bc('0x50')](_0x262fe0)['then'](handleEntityNotFound(_0x5ce32d,null))['then'](respondWithResult(_0x5ce32d,null))[_0x92bc('0x23')](handleError(_0x5ce32d,null));};exports[_0x92bc('0x51')]=function(_0xb2ccc9,_0x5ef29c){return db['ZendeskAccount']['create'](_0xb2ccc9[_0x92bc('0x52')],{})['then'](respondWithResult(_0x5ef29c,0xc9))[_0x92bc('0x23')](handleError(_0x5ef29c,null));};exports[_0x92bc('0x53')]=function(_0x3e6106,_0x3b66a0){if(_0x3e6106[_0x92bc('0x52')]['id']){delete _0x3e6106['body']['id'];}return db[_0x92bc('0x32')][_0x92bc('0x50')]({'where':{'id':_0x3e6106[_0x92bc('0x4d')]['id']}})[_0x92bc('0x1a')](handleEntityNotFound(_0x3b66a0,null))[_0x92bc('0x1a')](saveUpdates(_0x3e6106[_0x92bc('0x52')],null))[_0x92bc('0x1a')](respondWithResult(_0x3b66a0,null))[_0x92bc('0x23')](handleError(_0x3b66a0,null));};exports[_0x92bc('0x2c')]=function(_0x5aba3f,_0x289fdc){return db[_0x92bc('0x32')][_0x92bc('0x50')]({'where':{'id':_0x5aba3f[_0x92bc('0x4d')]['id']}})[_0x92bc('0x1a')](handleEntityNotFound(_0x289fdc,null))[_0x92bc('0x1a')](removeEntity(_0x289fdc,null))['catch'](handleError(_0x289fdc,null));};exports[_0x92bc('0x54')]=function(_0x62ce6e,_0x274f3c,_0x40df77){var _0x334bbe={};var _0x2a4fae={};var _0x10e474;var _0x28b4ba;return db[_0x92bc('0x32')]['findOne']({'where':{'id':_0x62ce6e[_0x92bc('0x4d')]['id']}})['then'](handleEntityNotFound(_0x274f3c,null))[_0x92bc('0x1a')](function(_0x29220c){if(_0x29220c){_0x10e474=_0x29220c;_0x2a4fae[_0x92bc('0x34')]=_['keys'](db['ZendeskConfiguration'][_0x92bc('0x33')]);_0x2a4fae[_0x92bc('0x37')]=_[_0x92bc('0x35')](_0x62ce6e['query']);_0x2a4fae[_0x92bc('0x39')]=_[_0x92bc('0x3a')](_0x2a4fae[_0x92bc('0x34')],_0x2a4fae['query']);_0x334bbe[_0x92bc('0x3b')]=_[_0x92bc('0x3a')](_0x2a4fae[_0x92bc('0x34')],qs['fields'](_0x62ce6e['query'][_0x92bc('0x3c')]));_0x334bbe[_0x92bc('0x3b')]=_0x334bbe[_0x92bc('0x3b')]['length']?_0x334bbe[_0x92bc('0x3b')]:_0x2a4fae['model'];_0x334bbe[_0x92bc('0x40')]=qs[_0x92bc('0x41')](_0x62ce6e[_0x92bc('0x37')][_0x92bc('0x41')]);_0x334bbe['where']=qs['filters'](_[_0x92bc('0x43')](_0x62ce6e[_0x92bc('0x37')],_0x2a4fae['filters']));if(_0x62ce6e[_0x92bc('0x37')][_0x92bc('0x47')]){_0x334bbe[_0x92bc('0x42')]=_[_0x92bc('0x46')](_0x334bbe[_0x92bc('0x42')],{'$or':_[_0x92bc('0x48')](_0x334bbe[_0x92bc('0x3b')],function(_0x578c9c){var _0x37668a={};_0x37668a[_0x578c9c]={'$like':'%'+_0x62ce6e['query'][_0x92bc('0x47')]+'%'};return _0x37668a;})});}_0x334bbe=_[_0x92bc('0x46')]({},_0x334bbe,_0x62ce6e[_0x92bc('0x49')]);return _0x10e474[_0x92bc('0x54')](_0x334bbe);}})['then'](function(_0x396f24){if(_0x396f24){_0x28b4ba=_0x396f24['length'];if(!_0x62ce6e[_0x92bc('0x37')][_0x92bc('0x3e')]('nolimit')){_0x334bbe[_0x92bc('0x27')]=qs[_0x92bc('0x27')](_0x62ce6e[_0x92bc('0x37')][_0x92bc('0x27')]);_0x334bbe[_0x92bc('0x26')]=qs[_0x92bc('0x26')](_0x62ce6e[_0x92bc('0x37')]['offset']);}return _0x10e474[_0x92bc('0x54')](_0x334bbe);}})[_0x92bc('0x1a')](function(_0x347c55){if(_0x347c55){return _0x347c55?{'count':_0x28b4ba,'rows':_0x347c55}:null;}})[_0x92bc('0x1a')](respondWithResult(_0x274f3c,null))[_0x92bc('0x23')](handleError(_0x274f3c,null));};exports[_0x92bc('0x55')]=function(_0x1c00d9,_0x57cb08,_0x55f623){if(_0x1c00d9['body']['id']){delete _0x1c00d9[_0x92bc('0x52')]['id'];}return db[_0x92bc('0x32')][_0x92bc('0x56')]({'where':{'id':_0x1c00d9['params']['id']}})[_0x92bc('0x1a')](handleEntityNotFound(_0x57cb08,null))['then'](function(_0x45d6cc){if(_0x45d6cc){_0x1c00d9[_0x92bc('0x52')]['AccountId']=_0x45d6cc['id'];_0x1c00d9[_0x92bc('0x52')]['Subjects']=integrations[_0x92bc('0x57')](_0x1c00d9[_0x92bc('0x52')]['channel'],_0x1c00d9['body'][_0x92bc('0x58')]);_0x1c00d9[_0x92bc('0x52')][_0x92bc('0x59')]=integrations['getDescriptions'](_0x1c00d9[_0x92bc('0x52')]['channel'],_0x1c00d9[_0x92bc('0x52')][_0x92bc('0x58')]);return db['ZendeskConfiguration'][_0x92bc('0x51')](_0x1c00d9[_0x92bc('0x52')],{'include':[{'model':db[_0x92bc('0x5a')],'as':_0x92bc('0x5b')},{'model':db[_0x92bc('0x5a')],'as':_0x92bc('0x59')}]});}return null;})[_0x92bc('0x1a')](respondWithResult(_0x57cb08,null))[_0x92bc('0x23')](handleError(_0x57cb08,null));};exports[_0x92bc('0x5c')]=function(_0x4a13a1,_0x433310,_0x259ac8){return db[_0x92bc('0x32')][_0x92bc('0x56')]({'where':{'id':_0x4a13a1['params']['id']},'attributes':['id','username',_0x92bc('0x5d'),_0x92bc('0x5e'),_0x92bc('0x5f'),_0x92bc('0x60')]})['then'](handleEntityNotFound(_0x433310,null))[_0x92bc('0x1a')](function(_0x17c0df){if(_0x17c0df){var _0x36dca5={'method':_0x92bc('0x61'),'uri':util[_0x92bc('0x62')](_0x92bc('0x63'),_0x17c0df[_0x92bc('0x60')],_0x92bc('0x64')),'json':!![]};switch(_0x17c0df[_0x92bc('0x5f')]){case'password':_0x36dca5[_0x92bc('0x65')]={'Authorization':util[_0x92bc('0x62')]('Basic\x20%s',new Buffer(util[_0x92bc('0x62')](_0x92bc('0x66'),_0x17c0df[_0x92bc('0x67')],_0x17c0df[_0x92bc('0x5d')]))[_0x92bc('0x68')](_0x92bc('0x69')))};break;case _0x92bc('0x5e'):_0x36dca5['headers']={'Authorization':util[_0x92bc('0x62')](_0x92bc('0x6a'),new Buffer(util[_0x92bc('0x62')](_0x92bc('0x6b'),_0x17c0df[_0x92bc('0x67')],_0x17c0df[_0x92bc('0x5e')]))['toString'](_0x92bc('0x69')))};break;default:throw new db['Sequelize'][(_0x92bc('0x6c'))](_0x92bc('0x6d'));}return rp(_0x36dca5);}})['then'](function(_0x23aef7){if(_0x23aef7){var _0x584dbc=[_0x92bc('0x6e'),_0x92bc('0x6f'),_0x92bc('0x70'),_0x92bc('0x71')];_[_0x92bc('0x72')](_0x23aef7[_0x92bc('0x64')],function(_0x1eb27e){return _0x584dbc[_0x92bc('0x73')](_0x1eb27e[_0x92bc('0x58')]);});return{'count':_0x23aef7[_0x92bc('0x64')][_0x92bc('0x3d')],'rows':_[_0x92bc('0x48')](_0x23aef7[_0x92bc('0x64')],function(_0x5d2872){return{'id':_0x5d2872['id'],'name':_0x5d2872[_0x92bc('0x74')]>0x7?_0x5d2872[_0x92bc('0x75')]:_0x5d2872[_0x92bc('0x58')],'custom':_0x5d2872['position']>0x7?!![]:![],'options':_0x5d2872[_0x92bc('0x76')]?_0x5d2872[_0x92bc('0x76')]:[]};})};}})[_0x92bc('0x1a')](respondWithResult(_0x433310,null))[_0x92bc('0x23')](function(_0x5d5051){var _0x82ff8f=_0x4a13a1[_0x92bc('0x37')]['test']?0x1f4:_0x5d5051[_0x92bc('0x77')]||0x1f4;logger['error'](_0x92bc('0x78'),_0x92bc('0x5c'),_0x82ff8f,JSON[_0x92bc('0x1e')](_0x5d5051));delete _0x5d5051['name'];if(_0x82ff8f===0x191){_0x82ff8f=0x190;}_0x433310[_0x92bc('0x2d')](_0x82ff8f)[_0x92bc('0x79')](_0x4a13a1['query'][_0x92bc('0x7a')]?{'message':_0x92bc('0x7b'),'statusCode':_0x5d5051[_0x92bc('0x77')]}:_0x5d5051);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index e25af04..7cd828a 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 _0x1e43=['int_zendesk_accounts','../../config/logger','api','moment','bluebird','request-promise','./intZendeskAccount.attributes','../../components/integrations/configuration','ZendeskAccount'];(function(_0x33849d,_0x484da9){var _0x288b1c=function(_0x9e3616){while(--_0x9e3616){_0x33849d['push'](_0x33849d['shift']());}};_0x288b1c(++_0x484da9);}(_0x1e43,0xc7));var _0x31e4=function(_0x16e0c8,_0x4861eb){_0x16e0c8=_0x16e0c8-0x0;var _0xe4b5af=_0x1e43[_0x16e0c8];return _0xe4b5af;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x31e4('0x0'))(_0x31e4('0x1'));var moment=require(_0x31e4('0x2'));var BPromise=require(_0x31e4('0x3'));var rp=require(_0x31e4('0x4'));var attributes=require(_0x31e4('0x5'));var integrations=require(_0x31e4('0x6'));module['exports']=function(_0xa83e97,_0x24c132){return _0xa83e97['define'](_0x31e4('0x7'),attributes,{'tableName':_0x31e4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4737=['api','moment','bluebird','./intZendeskAccount.attributes','define','ZendeskAccount','util'];(function(_0x58e897,_0x2a6884){var _0x2477d5=function(_0x1171ef){while(--_0x1171ef){_0x58e897['push'](_0x58e897['shift']());}};_0x2477d5(++_0x2a6884);}(_0x4737,0x19c));var _0x7473=function(_0x36c48d,_0x3862e1){_0x36c48d=_0x36c48d-0x0;var _0x5c2de6=_0x4737[_0x36c48d];return _0x5c2de6;};'use strict';var _=require('lodash');var util=require(_0x7473('0x0'));var logger=require('../../config/logger')(_0x7473('0x1'));var moment=require(_0x7473('0x2'));var BPromise=require(_0x7473('0x3'));var rp=require('request-promise');var attributes=require(_0x7473('0x4'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x47c2f3,_0x3a4d81){return _0x47c2f3[_0x7473('0x5')](_0x7473('0x6'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 5003af8..8d88202 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 _0x8338=['ZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','info','ShowZendeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','request','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetZendeskAccount'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x8338,0x140));var _0x8833=function(_0x294fdc,_0x527a61){_0x294fdc=_0x294fdc-0x0;var _0x4e5123=_0x8338[_0x294fdc];return _0x4e5123;};'use strict';var _=require(_0x8833('0x0'));var util=require(_0x8833('0x1'));var moment=require(_0x8833('0x2'));var BPromise=require(_0x8833('0x3'));var rs=require(_0x8833('0x4'));var fs=require('fs');var Redis=require(_0x8833('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8833('0x6'));var logger=require(_0x8833('0x7'))(_0x8833('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x8833('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32becf,_0x268112,_0x109df7){return new BPromise(function(_0xfa1094,_0x95330a){return client[_0x8833('0xa')](_0x32becf,_0x109df7)['then'](function(_0x436a61){logger['info'](_0x8833('0xb'),_0x268112,_0x8833('0xc'));logger[_0x8833('0xd')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x268112,_0x8833('0xc'),JSON[_0x8833('0xe')](_0x436a61));if(_0x436a61[_0x8833('0xf')]){if(_0x436a61['error']['code']===0x1f4){logger[_0x8833('0xf')](_0x8833('0xb'),_0x268112,_0x436a61[_0x8833('0xf')][_0x8833('0x10')]);return _0x95330a(_0x436a61[_0x8833('0xf')][_0x8833('0x10')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x268112,_0x436a61[_0x8833('0xf')]['message']);return _0xfa1094(_0x436a61[_0x8833('0xf')][_0x8833('0x10')]);}else{logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x268112,_0x8833('0xc'));_0xfa1094(_0x436a61[_0x8833('0x11')][_0x8833('0x10')]);}})[_0x8833('0x12')](function(_0x33e86c){logger['error'](_0x8833('0xb'),_0x268112,_0x33e86c);_0x95330a(_0x33e86c);});});}exports[_0x8833('0x13')]=function(_0x436d08){var _0x42a315=this;return new Promise(function(_0x34a553,_0x4ce9e1){return db[_0x8833('0x14')][_0x8833('0x15')]({'raw':_0x436d08[_0x8833('0x16')]?_0x436d08[_0x8833('0x16')][_0x8833('0x17')]===undefined?!![]:![]:!![],'where':_0x436d08[_0x8833('0x16')]?_0x436d08['options'][_0x8833('0x18')]||null:null,'attributes':_0x436d08[_0x8833('0x16')]?_0x436d08[_0x8833('0x16')][_0x8833('0x19')]||null:null,'limit':_0x436d08[_0x8833('0x16')]?_0x436d08[_0x8833('0x16')][_0x8833('0x1a')]||null:null,'include':_0x436d08[_0x8833('0x16')]?_0x436d08['options'][_0x8833('0x1b')]?_[_0x8833('0x1c')](_0x436d08[_0x8833('0x16')][_0x8833('0x1b')],function(_0x55f6ed){return{'model':db[_0x55f6ed['model']],'as':_0x55f6ed['as'],'attributes':_0x55f6ed['attributes'],'include':_0x55f6ed[_0x8833('0x1b')]?_[_0x8833('0x1c')](_0x55f6ed[_0x8833('0x1b')],function(_0x58178f){return{'model':db[_0x58178f[_0x8833('0x1d')]],'as':_0x58178f['as'],'attributes':_0x58178f[_0x8833('0x19')],'include':_0x58178f[_0x8833('0x1b')]?_[_0x8833('0x1c')](_0x58178f['include'],function(_0x2f6500){return{'model':db[_0x2f6500[_0x8833('0x1d')]],'as':_0x2f6500['as'],'attributes':_0x2f6500[_0x8833('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8833('0x1e')](function(_0x20158c){logger[_0x8833('0x1f')](_0x8833('0x13'),_0x436d08);logger[_0x8833('0xd')]('GetZendeskAccount',_0x436d08,JSON[_0x8833('0xe')](_0x20158c));_0x34a553(_0x20158c);})[_0x8833('0x12')](function(_0x479f77){logger['error'](_0x8833('0x13'),_0x479f77[_0x8833('0x10')],_0x436d08);_0x4ce9e1(_0x42a315[_0x8833('0xf')](0x1f4,_0x479f77[_0x8833('0x10')]));});});};exports[_0x8833('0x20')]=function(_0x213a23){var _0x5f53ee=this;return new Promise(function(_0x8472e3,_0x290dc3){return db[_0x8833('0x14')][_0x8833('0x21')]({'raw':_0x213a23[_0x8833('0x16')]?_0x213a23['options'][_0x8833('0x17')]===undefined?!![]:![]:!![],'where':_0x213a23[_0x8833('0x16')]?_0x213a23[_0x8833('0x16')][_0x8833('0x18')]||null:null,'attributes':_0x213a23[_0x8833('0x16')]?_0x213a23['options'][_0x8833('0x19')]||null:null,'include':_0x213a23['options']?_0x213a23[_0x8833('0x16')][_0x8833('0x1b')]?_[_0x8833('0x1c')](_0x213a23[_0x8833('0x16')][_0x8833('0x1b')],function(_0x2e5b06){return{'model':db[_0x2e5b06['model']],'as':_0x2e5b06['as'],'attributes':_0x2e5b06[_0x8833('0x19')],'include':_0x2e5b06['include']?_[_0x8833('0x1c')](_0x2e5b06[_0x8833('0x1b')],function(_0xf4e0bb){return{'model':db[_0xf4e0bb[_0x8833('0x1d')]],'as':_0xf4e0bb['as'],'attributes':_0xf4e0bb[_0x8833('0x19')],'include':_0xf4e0bb[_0x8833('0x1b')]?_[_0x8833('0x1c')](_0xf4e0bb[_0x8833('0x1b')],function(_0x20517f){return{'model':db[_0x20517f[_0x8833('0x1d')]],'as':_0x20517f['as'],'attributes':_0x20517f[_0x8833('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8833('0x1e')](function(_0x3ca679){logger[_0x8833('0x1f')](_0x8833('0x20'),_0x213a23);logger[_0x8833('0xd')](_0x8833('0x20'),_0x213a23,JSON[_0x8833('0xe')](_0x3ca679));_0x8472e3(_0x3ca679);})['catch'](function(_0x47b9a4){logger[_0x8833('0xf')](_0x8833('0x20'),_0x47b9a4[_0x8833('0x10')],_0x213a23);_0x290dc3(_0x5f53ee['error'](0x1f4,_0x47b9a4[_0x8833('0x10')]));});});}; \ No newline at end of file +var _0x119d=['client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','map','model','ShowZendeskAccount','find','raw','util','moment','../../config/utils','rpc','../../config/environment'];(function(_0x4dbba7,_0x34d6d1){var _0x43ef83=function(_0x27acf1){while(--_0x27acf1){_0x4dbba7['push'](_0x4dbba7['shift']());}};_0x43ef83(++_0x34d6d1);}(_0x119d,0x181));var _0xd119=function(_0x1af15f,_0x317832){_0x1af15f=_0x1af15f-0x0;var _0x6112f=_0x119d[_0x1af15f];return _0x6112f;};'use strict';var _=require('lodash');var util=require(_0xd119('0x0'));var moment=require(_0xd119('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(_0xd119('0x2'));var logger=require('../../config/logger')(_0xd119('0x3'));var config=require(_0xd119('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xd119('0x5')][_0xd119('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x72c210,_0x2fa420,_0x97ba2d){return new BPromise(function(_0x16e1d0,_0x3ea317){return client[_0xd119('0x7')](_0x72c210,_0x97ba2d)[_0xd119('0x8')](function(_0x2ec892){logger[_0xd119('0x9')](_0xd119('0xa'),_0x2fa420,_0xd119('0xb'));logger[_0xd119('0xc')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x2fa420,_0xd119('0xb'),JSON[_0xd119('0xd')](_0x2ec892));if(_0x2ec892[_0xd119('0xe')]){if(_0x2ec892[_0xd119('0xe')]['code']===0x1f4){logger[_0xd119('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0x2fa420,_0x2ec892[_0xd119('0xe')][_0xd119('0xf')]);return _0x3ea317(_0x2ec892['error'][_0xd119('0xf')]);}logger[_0xd119('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0x2fa420,_0x2ec892[_0xd119('0xe')][_0xd119('0xf')]);return _0x16e1d0(_0x2ec892[_0xd119('0xe')][_0xd119('0xf')]);}else{logger[_0xd119('0x9')](_0xd119('0xa'),_0x2fa420,_0xd119('0xb'));_0x16e1d0(_0x2ec892['result'][_0xd119('0xf')]);}})[_0xd119('0x10')](function(_0x10028e){logger['error'](_0xd119('0xa'),_0x2fa420,_0x10028e);_0x3ea317(_0x10028e);});});}exports[_0xd119('0x11')]=function(_0xac63d0){var _0x2a9aa9=this;return new Promise(function(_0x4f5028,_0x406efd){return db[_0xd119('0x12')][_0xd119('0x13')]({'raw':_0xac63d0[_0xd119('0x14')]?_0xac63d0[_0xd119('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0xac63d0[_0xd119('0x14')]?_0xac63d0[_0xd119('0x14')][_0xd119('0x15')]||null:null,'attributes':_0xac63d0[_0xd119('0x14')]?_0xac63d0[_0xd119('0x14')][_0xd119('0x16')]||null:null,'limit':_0xac63d0[_0xd119('0x14')]?_0xac63d0[_0xd119('0x14')][_0xd119('0x17')]||null:null,'include':_0xac63d0[_0xd119('0x14')]?_0xac63d0['options'][_0xd119('0x18')]?_[_0xd119('0x19')](_0xac63d0[_0xd119('0x14')][_0xd119('0x18')],function(_0x18969f){return{'model':db[_0x18969f[_0xd119('0x1a')]],'as':_0x18969f['as'],'attributes':_0x18969f[_0xd119('0x16')],'include':_0x18969f['include']?_['map'](_0x18969f[_0xd119('0x18')],function(_0x22c5c4){return{'model':db[_0x22c5c4[_0xd119('0x1a')]],'as':_0x22c5c4['as'],'attributes':_0x22c5c4[_0xd119('0x16')],'include':_0x22c5c4[_0xd119('0x18')]?_[_0xd119('0x19')](_0x22c5c4['include'],function(_0x126dfd){return{'model':db[_0x126dfd[_0xd119('0x1a')]],'as':_0x126dfd['as'],'attributes':_0x126dfd[_0xd119('0x16')]};}):[]};}):[]};}):[]:[]})[_0xd119('0x8')](function(_0x5582e5){logger[_0xd119('0x9')](_0xd119('0x11'),_0xac63d0);logger[_0xd119('0xc')](_0xd119('0x11'),_0xac63d0,JSON['stringify'](_0x5582e5));_0x4f5028(_0x5582e5);})['catch'](function(_0x12c116){logger['error'](_0xd119('0x11'),_0x12c116[_0xd119('0xf')],_0xac63d0);_0x406efd(_0x2a9aa9['error'](0x1f4,_0x12c116[_0xd119('0xf')]));});});};exports[_0xd119('0x1b')]=function(_0x4f9215){var _0x50b6b8=this;return new Promise(function(_0x11cdc5,_0x3560cc){return db[_0xd119('0x12')][_0xd119('0x1c')]({'raw':_0x4f9215['options']?_0x4f9215[_0xd119('0x14')][_0xd119('0x1d')]===undefined?!![]:![]:!![],'where':_0x4f9215[_0xd119('0x14')]?_0x4f9215[_0xd119('0x14')][_0xd119('0x15')]||null:null,'attributes':_0x4f9215[_0xd119('0x14')]?_0x4f9215['options'][_0xd119('0x16')]||null:null,'include':_0x4f9215[_0xd119('0x14')]?_0x4f9215[_0xd119('0x14')][_0xd119('0x18')]?_[_0xd119('0x19')](_0x4f9215[_0xd119('0x14')][_0xd119('0x18')],function(_0x372a3b){return{'model':db[_0x372a3b[_0xd119('0x1a')]],'as':_0x372a3b['as'],'attributes':_0x372a3b[_0xd119('0x16')],'include':_0x372a3b['include']?_['map'](_0x372a3b[_0xd119('0x18')],function(_0x27ac41){return{'model':db[_0x27ac41[_0xd119('0x1a')]],'as':_0x27ac41['as'],'attributes':_0x27ac41[_0xd119('0x16')],'include':_0x27ac41[_0xd119('0x18')]?_[_0xd119('0x19')](_0x27ac41[_0xd119('0x18')],function(_0xedf4d1){return{'model':db[_0xedf4d1[_0xd119('0x1a')]],'as':_0xedf4d1['as'],'attributes':_0xedf4d1[_0xd119('0x16')]};}):[]};}):[]};}):[]:[]})[_0xd119('0x8')](function(_0xb30068){logger['info'](_0xd119('0x1b'),_0x4f9215);logger[_0xd119('0xc')](_0xd119('0x1b'),_0x4f9215,JSON[_0xd119('0xd')](_0xb30068));_0x11cdc5(_0xb30068);})[_0xd119('0x10')](function(_0x3bdf8d){logger[_0xd119('0xe')]('ShowZendeskAccount',_0x3bdf8d[_0xd119('0xf')],_0x4f9215);_0x3560cc(_0x50b6b8['error'](0x1f4,_0x3bdf8d['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 3258d75..c7e6b4a 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 _0xdfab=['Router','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x4f0a3a,_0x14f8d9){var _0x430cca=function(_0x48ae46){while(--_0x48ae46){_0x4f0a3a['push'](_0x4f0a3a['shift']());}};_0x430cca(++_0x14f8d9);}(_0xdfab,0x18c));var _0xbdfa=function(_0x50e593,_0x3ae998){_0x50e593=_0x50e593-0x0;var _0x3821d0=_0xdfab[_0x50e593];return _0x3821d0;};'use strict';var multer=require(_0xbdfa('0x0'));var util=require('util');var path=require(_0xbdfa('0x1'));var timeout=require(_0xbdfa('0x2'));var express=require(_0xbdfa('0x3'));var router=express[_0xbdfa('0x4')]();var auth=require(_0xbdfa('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbdfa('0x6'));var controller=require(_0xbdfa('0x7'));router[_0xbdfa('0x8')]('/',auth[_0xbdfa('0x9')](),controller[_0xbdfa('0xa')]);router['get'](_0xbdfa('0xb'),auth['isAuthenticated'](),controller[_0xbdfa('0xc')]);router[_0xbdfa('0x8')]('/:id/fields',auth[_0xbdfa('0x9')](),controller['getFields']);router[_0xbdfa('0x8')](_0xbdfa('0xd'),auth['isAuthenticated'](),controller[_0xbdfa('0xe')]);router[_0xbdfa('0x8')](_0xbdfa('0xf'),auth['isAuthenticated'](),controller[_0xbdfa('0x10')]);router['get'](_0xbdfa('0x11'),auth[_0xbdfa('0x9')](),controller[_0xbdfa('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbdfa('0x13')]);router[_0xbdfa('0x14')](_0xbdfa('0x11'),auth['isAuthenticated'](),controller[_0xbdfa('0x15')]);router['put'](_0xbdfa('0xb'),auth[_0xbdfa('0x9')](),controller[_0xbdfa('0x16')]);router['delete']('/:id',auth[_0xbdfa('0x9')](),controller[_0xbdfa('0x17')]);module[_0xbdfa('0x18')]=router; \ No newline at end of file +var _0x71ed=['/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x1a4932,_0x27ece0){var _0x246d4d=function(_0xcaec17){while(--_0xcaec17){_0x1a4932['push'](_0x1a4932['shift']());}};_0x246d4d(++_0x27ece0);}(_0x71ed,0x1a3));var _0xd71e=function(_0x45f1db,_0x27a2c5){_0x45f1db=_0x45f1db-0x0;var _0x5fa7be=_0x71ed[_0x45f1db];return _0x5fa7be;};'use strict';var multer=require(_0xd71e('0x0'));var util=require(_0xd71e('0x1'));var path=require(_0xd71e('0x2'));var timeout=require(_0xd71e('0x3'));var express=require(_0xd71e('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xd71e('0x5'));var config=require(_0xd71e('0x6'));var controller=require(_0xd71e('0x7'));router[_0xd71e('0x8')]('/',auth[_0xd71e('0x9')](),controller[_0xd71e('0xa')]);router['get']('/:id',auth[_0xd71e('0x9')](),controller[_0xd71e('0xb')]);router['get'](_0xd71e('0xc'),auth['isAuthenticated'](),controller[_0xd71e('0xd')]);router['get'](_0xd71e('0xe'),auth[_0xd71e('0x9')](),controller[_0xd71e('0xf')]);router[_0xd71e('0x8')](_0xd71e('0x10'),auth[_0xd71e('0x9')](),controller[_0xd71e('0x11')]);router['get'](_0xd71e('0x12'),auth[_0xd71e('0x9')](),controller[_0xd71e('0x13')]);router[_0xd71e('0x14')]('/',auth['isAuthenticated'](),controller[_0xd71e('0x15')]);router[_0xd71e('0x14')](_0xd71e('0x12'),auth[_0xd71e('0x9')](),controller[_0xd71e('0x16')]);router[_0xd71e('0x17')](_0xd71e('0x18'),auth['isAuthenticated'](),controller[_0xd71e('0x19')]);router[_0xd71e('0x1a')](_0xd71e('0x18'),auth[_0xd71e('0x9')](),controller[_0xd71e('0x1b')]);module[_0xd71e('0x1c')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 39abda5..b0ed94f 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 _0xc50d=['exports','STRING','sequelize'];(function(_0x1d07d1,_0x2b2bd0){var _0x8496f9=function(_0x47c5e3){while(--_0x47c5e3){_0x1d07d1['push'](_0x1d07d1['shift']());}};_0x8496f9(++_0x2b2bd0);}(_0xc50d,0xb0));var _0xdc50=function(_0x58890f,_0x271c90){_0x58890f=_0x58890f-0x0;var _0x390bbd=_0xc50d[_0x58890f];return _0x390bbd;};'use strict';var Sequelize=require(_0xdc50('0x0'));module[_0xdc50('0x1')]={'name':{'type':Sequelize[_0xdc50('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7ae3=['STRING','sequelize','exports'];(function(_0x5209c0,_0x94dd9e){var _0x2add1a=function(_0x4b2b77){while(--_0x4b2b77){_0x5209c0['push'](_0x5209c0['shift']());}};_0x2add1a(++_0x94dd9e);}(_0x7ae3,0xb2));var _0x37ae=function(_0x4902d6,_0x3a2026){_0x4902d6=_0x4902d6-0x0;var _0xdd611c=_0x7ae3[_0x4902d6];return _0xdd611c;};'use strict';var Sequelize=require(_0x37ae('0x0'));module[_0x37ae('0x1')]={'name':{'type':Sequelize[_0x37ae('0x2')]},'description':{'type':Sequelize[_0x37ae('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 5854af7..d04d368 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 _0x7a54=['bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/parsers/qs','api','../../mysqldb','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','send','rawAttributes','keys','query','dateStart','dateEnd','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','day','add','filter','merge','map','options','ZendeskConfiguration','includeAll','findAll','rows','show','params','intersection','length','include','find','create','body','findOne','ZendeskField','getFields','getSubjects','getDescriptions','Tag','getTags','ids','html-pdf','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x169048,_0x30401b){var _0x2aa779=function(_0x1cdfe4){while(--_0x1cdfe4){_0x169048['push'](_0x169048['shift']());}};_0x2aa779(++_0x30401b);}(_0x7a54,0x106));var _0x47a5=function(_0x234d5f,_0xf6bd3e){_0x234d5f=_0x234d5f-0x0;var _0x574d05=_0x7a54[_0x234d5f];return _0x574d05;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var qs=require(_0x47a5('0xf'));var logger=require('../../config/logger')(_0x47a5('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x47a5('0x11'))['db'];var jayson=require(_0x47a5('0x12'));var client=jayson[_0x47a5('0x13')][_0x47a5('0x14')]({'port':0x232a});function respondWithRpcPromise(_0xd612dd,_0xd308b8,_0x1eae59,_0x5beb89){return new BPromise(function(_0x44bd3e,_0x221b54){var _0x1cf309=_0x5beb89||client;return _0x1cf309[_0x47a5('0x15')](_0xd612dd,_0x1eae59)[_0x47a5('0x16')](function(_0x620ee9){logger[_0x47a5('0x17')](_0x47a5('0x18'),_0xd308b8,'request\x20sent');logger[_0x47a5('0x19')](_0x47a5('0x1a'),_0xd308b8,_0x47a5('0x1b'),JSON[_0x47a5('0x1c')](_0x620ee9));if(_0x620ee9[_0x47a5('0x1d')]){if(_0x620ee9['error']['code']===0x1f4){logger[_0x47a5('0x1d')]('ZendeskConfiguration,\x20%s,\x20%s',_0xd308b8,_0x620ee9['error'][_0x47a5('0x1e')]);return _0x221b54(_0x620ee9[_0x47a5('0x1d')][_0x47a5('0x1e')]);}logger[_0x47a5('0x1d')](_0x47a5('0x18'),_0xd308b8,_0x620ee9[_0x47a5('0x1d')][_0x47a5('0x1e')]);return _0x44bd3e(_0x620ee9[_0x47a5('0x1d')][_0x47a5('0x1e')]);}else{logger['info'](_0x47a5('0x18'),_0xd308b8,_0x47a5('0x1b'));_0x44bd3e(_0x620ee9['result'][_0x47a5('0x1e')]);}})[_0x47a5('0x1f')](function(_0x36874d){logger['error'](_0x47a5('0x18'),_0xd308b8,_0x36874d);_0x221b54(_0x36874d);});});}function respondWithStatusCode(_0x2f142b,_0x23db32){_0x23db32=_0x23db32||0xcc;return function(_0x7a9f9e){if(_0x7a9f9e){return _0x2f142b['sendStatus'](_0x23db32);}return _0x2f142b[_0x47a5('0x20')](_0x23db32)[_0x47a5('0x21')]();};}function respondWithResult(_0x513981,_0x28747d){_0x28747d=_0x28747d||0xc8;return function(_0xc4cd63){if(_0xc4cd63){return _0x513981[_0x47a5('0x20')](_0x28747d)[_0x47a5('0x22')](_0xc4cd63);}};}function respondWithFilteredResult(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(_0x53078a){var _0x136745=_0x53078a[_0x47a5('0x23')],_0x5686db=_0x50bf17[_0x47a5('0x24')],_0x1ea9c8=_0x50bf17[_0x47a5('0x24')]+_0x50bf17[_0x47a5('0x25')],_0x5b6c4e;if(_0x1ea9c8>=_0x136745){_0x1ea9c8=_0x136745;_0x5b6c4e=0xc8;}else{_0x5b6c4e=0xce;}_0x3abd6a[_0x47a5('0x20')](_0x5b6c4e);return _0x3abd6a[_0x47a5('0x26')](_0x47a5('0x27'),_0x5686db+'-'+_0x1ea9c8+'/'+_0x136745)[_0x47a5('0x22')](_0x53078a);}return null;};}function patchUpdates(_0x16631f){return function(_0x361bfa){try{jsonpatch[_0x47a5('0x28')](_0x361bfa,_0x16631f,!![]);}catch(_0x11a4fa){return BPromise[_0x47a5('0x29')](_0x11a4fa);}return _0x361bfa['save']();};}function saveUpdates(_0x243210,_0x51833b){return function(_0x2ef875){if(_0x2ef875){return _0x2ef875[_0x47a5('0x2a')](_0x243210)[_0x47a5('0x16')](function(_0x4d6b57){return _0x4d6b57;});}return null;};}function removeEntity(_0x256650,_0x625952){return function(_0x39b50b){if(_0x39b50b){return _0x39b50b[_0x47a5('0x2b')]()['then'](function(){_0x256650['status'](0xcc)[_0x47a5('0x21')]();});}};}function handleEntityNotFound(_0xfb5ddb,_0x5bd7eb){return function(_0x4e1006){if(!_0x4e1006){_0xfb5ddb[_0x47a5('0x2c')](0x194);}return _0x4e1006;};}function handleError(_0x51544e,_0x57bff6){_0x57bff6=_0x57bff6||0x1f4;return function(_0x42f70c){logger['error'](_0x42f70c[_0x47a5('0x2d')]);if(_0x42f70c[_0x47a5('0x2e')]){delete _0x42f70c['name'];}_0x51544e['status'](_0x57bff6)[_0x47a5('0x2f')](_0x42f70c);};}exports['index']=function(_0x403028,_0x87e4c9){var _0xf269a8={},_0x52749b={},_0x18f7e9={'count':0x0,'rows':[]};var _0x50c086=db['ZendeskConfiguration'][_0x47a5('0x30')];_0x52749b['model']=_[_0x47a5('0x31')](_0x50c086);var _0x5ef577={'dateStart':_0x403028[_0x47a5('0x32')][_0x47a5('0x33')],'dateEnd':_0x403028[_0x47a5('0x32')][_0x47a5('0x34')]};delete _0x403028[_0x47a5('0x32')][_0x47a5('0x33')];delete _0x403028[_0x47a5('0x32')][_0x47a5('0x34')];_0x52749b[_0x47a5('0x32')]=_['keys'](_0x403028[_0x47a5('0x32')]);_0x52749b[_0x47a5('0x35')]=_['intersection'](_0x52749b[_0x47a5('0x36')],_0x52749b[_0x47a5('0x32')]);_0xf269a8[_0x47a5('0x37')]=_['intersection'](_0x52749b[_0x47a5('0x36')],qs[_0x47a5('0x38')](_0x403028['query'][_0x47a5('0x38')]));_0xf269a8[_0x47a5('0x37')]=_0xf269a8['attributes']['length']?_0xf269a8['attributes']:_0x52749b[_0x47a5('0x36')];if(!_0x403028['query'][_0x47a5('0x39')](_0x47a5('0x3a'))){_0xf269a8[_0x47a5('0x25')]=qs[_0x47a5('0x25')](_0x403028[_0x47a5('0x32')][_0x47a5('0x25')]);_0xf269a8[_0x47a5('0x24')]=qs[_0x47a5('0x24')](_0x403028[_0x47a5('0x32')][_0x47a5('0x24')]);}_0xf269a8[_0x47a5('0x3b')]=qs[_0x47a5('0x3c')](_0x403028[_0x47a5('0x32')]['sort']);_0xf269a8[_0x47a5('0x3d')]=qs[_0x47a5('0x35')](_[_0x47a5('0x3e')](_0x403028[_0x47a5('0x32')],_0x52749b['filters']));if(_0x5ef577[_0x47a5('0x33')]){if(_0x5ef577['dateEnd']){_0x5ef577['dateEnd']=moment(_0x5ef577['dateEnd'])['add'](0x1,_0x47a5('0x3f'));}else{_0x5ef577['dateEnd']=moment(_0x5ef577[_0x47a5('0x33')])[_0x47a5('0x40')](0x1,_0x47a5('0x3f'));}_['merge'](_0xf269a8[_0x47a5('0x3d')],{'createdAt':{'$gte':_0x5ef577[_0x47a5('0x33')],'$lte':_0x5ef577['dateEnd']}});}if(_0x403028['query'][_0x47a5('0x41')]){_0xf269a8['where']=_[_0x47a5('0x42')](_0xf269a8[_0x47a5('0x3d')],{'$or':_[_0x47a5('0x43')](_0xf269a8[_0x47a5('0x37')],function(_0x34a9ae){var _0xf0edbb={};_0xf0edbb[_0x34a9ae]={'$like':'%'+_0x403028[_0x47a5('0x32')][_0x47a5('0x41')]+'%'};return _0xf0edbb;})});}_0xf269a8=_[_0x47a5('0x42')]({},_0xf269a8,_0x403028[_0x47a5('0x44')]);var _0x24ecb1={'where':_0xf269a8[_0x47a5('0x3d')]};return db[_0x47a5('0x45')][_0x47a5('0x23')](_0x24ecb1)[_0x47a5('0x16')](function(_0x3a2b38){_0x18f7e9['count']=_0x3a2b38;if(_0x403028[_0x47a5('0x32')][_0x47a5('0x46')]){_0xf269a8['include']=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x47a5('0x47')](_0xf269a8);})['then'](function(_0x13750d){_0x18f7e9[_0x47a5('0x48')]=_0x13750d;return _0x18f7e9;})['then'](respondWithFilteredResult(_0x87e4c9,_0xf269a8))['catch'](handleError(_0x87e4c9,null));};exports[_0x47a5('0x49')]=function(_0x52d409,_0x2d147c){var _0x1d1039={'raw':![],'where':{'id':_0x52d409[_0x47a5('0x4a')]['id']}},_0x3548bc={};_0x3548bc[_0x47a5('0x36')]=_[_0x47a5('0x31')](db[_0x47a5('0x45')]['rawAttributes']);_0x3548bc['query']=_[_0x47a5('0x31')](_0x52d409[_0x47a5('0x32')]);_0x3548bc[_0x47a5('0x35')]=_[_0x47a5('0x4b')](_0x3548bc[_0x47a5('0x36')],_0x3548bc[_0x47a5('0x32')]);_0x1d1039[_0x47a5('0x37')]=_['intersection'](_0x3548bc[_0x47a5('0x36')],qs[_0x47a5('0x38')](_0x52d409[_0x47a5('0x32')]['fields']));_0x1d1039[_0x47a5('0x37')]=_0x1d1039['attributes'][_0x47a5('0x4c')]?_0x1d1039[_0x47a5('0x37')]:_0x3548bc[_0x47a5('0x36')];if(_0x52d409[_0x47a5('0x32')]['includeAll']){_0x1d1039[_0x47a5('0x4d')]=[{'all':!![]}];}_0x1d1039=_[_0x47a5('0x42')]({},_0x1d1039,_0x52d409[_0x47a5('0x44')]);return db[_0x47a5('0x45')][_0x47a5('0x4e')](_0x1d1039)[_0x47a5('0x16')](handleEntityNotFound(_0x2d147c,null))[_0x47a5('0x16')](respondWithResult(_0x2d147c,null))['catch'](handleError(_0x2d147c,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x45')][_0x47a5('0x4f')](_0x43721b[_0x47a5('0x50')],{})['then'](respondWithResult(_0x187d7e,0xc9))[_0x47a5('0x1f')](handleError(_0x187d7e,null));};exports[_0x47a5('0x2a')]=function(_0x1aa581,_0x53871e){if(_0x1aa581[_0x47a5('0x50')]['id']){delete _0x1aa581[_0x47a5('0x50')]['id'];}return db[_0x47a5('0x45')]['find']({'where':{'id':_0x1aa581['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x53871e,null))[_0x47a5('0x16')](saveUpdates(_0x1aa581['body'],null))['then'](respondWithResult(_0x53871e,null))[_0x47a5('0x1f')](handleError(_0x53871e,null));};exports['destroy']=function(_0x16bb8a,_0x5d383d){return db['ZendeskConfiguration'][_0x47a5('0x4e')]({'where':{'id':_0x16bb8a[_0x47a5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5d383d,null))[_0x47a5('0x16')](removeEntity(_0x5d383d,null))[_0x47a5('0x1f')](handleError(_0x5d383d,null));};exports['getFields']=function(_0x5b6127,_0x16b4fd,_0x30d482){var _0x867da0={};var _0x2931e4={};var _0x5996c4;var _0x199621;return db[_0x47a5('0x45')][_0x47a5('0x51')]({'where':{'id':_0x5b6127['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x16b4fd,null))['then'](function(_0x485e3c){if(_0x485e3c){_0x5996c4=_0x485e3c;_0x2931e4[_0x47a5('0x36')]=_[_0x47a5('0x31')](db[_0x47a5('0x52')][_0x47a5('0x30')]);_0x2931e4['query']=_[_0x47a5('0x31')](_0x5b6127['query']);_0x2931e4['filters']=_['intersection'](_0x2931e4['model'],_0x2931e4[_0x47a5('0x32')]);_0x867da0[_0x47a5('0x37')]=_[_0x47a5('0x4b')](_0x2931e4['model'],qs['fields'](_0x5b6127[_0x47a5('0x32')][_0x47a5('0x38')]));_0x867da0[_0x47a5('0x37')]=_0x867da0[_0x47a5('0x37')][_0x47a5('0x4c')]?_0x867da0['attributes']:_0x2931e4[_0x47a5('0x36')];_0x867da0['order']=qs[_0x47a5('0x3c')](_0x5b6127[_0x47a5('0x32')]['sort']);_0x867da0[_0x47a5('0x3d')]=qs[_0x47a5('0x35')](_[_0x47a5('0x3e')](_0x5b6127[_0x47a5('0x32')],_0x2931e4[_0x47a5('0x35')]));if(_0x5b6127[_0x47a5('0x32')][_0x47a5('0x41')]){_0x867da0[_0x47a5('0x3d')]=_['merge'](_0x867da0[_0x47a5('0x3d')],{'$or':_[_0x47a5('0x43')](_0x867da0[_0x47a5('0x37')],function(_0x26e7fc){var _0x396cb0={};_0x396cb0[_0x26e7fc]={'$like':'%'+_0x5b6127['query'][_0x47a5('0x41')]+'%'};return _0x396cb0;})});}_0x867da0=_[_0x47a5('0x42')]({},_0x867da0,_0x5b6127[_0x47a5('0x44')]);return _0x5996c4[_0x47a5('0x53')](_0x867da0);}})[_0x47a5('0x16')](function(_0x168329){if(_0x168329){_0x199621=_0x168329[_0x47a5('0x4c')];if(!_0x5b6127[_0x47a5('0x32')][_0x47a5('0x39')](_0x47a5('0x3a'))){_0x867da0[_0x47a5('0x25')]=qs[_0x47a5('0x25')](_0x5b6127[_0x47a5('0x32')][_0x47a5('0x25')]);_0x867da0[_0x47a5('0x24')]=qs['offset'](_0x5b6127[_0x47a5('0x32')][_0x47a5('0x24')]);}return _0x5996c4[_0x47a5('0x53')](_0x867da0);}})['then'](function(_0x37ac59){if(_0x37ac59){return _0x37ac59?{'count':_0x199621,'rows':_0x37ac59}:null;}})[_0x47a5('0x16')](respondWithResult(_0x16b4fd,null))[_0x47a5('0x1f')](handleError(_0x16b4fd,null));};exports[_0x47a5('0x54')]=function(_0x5d9822,_0x3ac402,_0x522ccf){var _0x2d5ee6={};var _0x487e21={};var _0x43f649;var _0x4cf7c5;return db[_0x47a5('0x45')][_0x47a5('0x51')]({'where':{'id':_0x5d9822[_0x47a5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3ac402,null))['then'](function(_0x4b8084){if(_0x4b8084){_0x43f649=_0x4b8084;_0x487e21[_0x47a5('0x36')]=_[_0x47a5('0x31')](db[_0x47a5('0x52')][_0x47a5('0x30')]);_0x487e21['query']=_[_0x47a5('0x31')](_0x5d9822[_0x47a5('0x32')]);_0x487e21[_0x47a5('0x35')]=_[_0x47a5('0x4b')](_0x487e21[_0x47a5('0x36')],_0x487e21[_0x47a5('0x32')]);_0x2d5ee6[_0x47a5('0x37')]=_[_0x47a5('0x4b')](_0x487e21[_0x47a5('0x36')],qs[_0x47a5('0x38')](_0x5d9822[_0x47a5('0x32')][_0x47a5('0x38')]));_0x2d5ee6['attributes']=_0x2d5ee6[_0x47a5('0x37')]['length']?_0x2d5ee6[_0x47a5('0x37')]:_0x487e21[_0x47a5('0x36')];_0x2d5ee6[_0x47a5('0x3b')]=qs[_0x47a5('0x3c')](_0x5d9822[_0x47a5('0x32')][_0x47a5('0x3c')]);_0x2d5ee6[_0x47a5('0x3d')]=qs[_0x47a5('0x35')](_[_0x47a5('0x3e')](_0x5d9822[_0x47a5('0x32')],_0x487e21[_0x47a5('0x35')]));if(_0x5d9822[_0x47a5('0x32')][_0x47a5('0x41')]){_0x2d5ee6[_0x47a5('0x3d')]=_[_0x47a5('0x42')](_0x2d5ee6['where'],{'$or':_['map'](_0x2d5ee6['attributes'],function(_0x4d09a4){var _0x490e28={};_0x490e28[_0x4d09a4]={'$like':'%'+_0x5d9822[_0x47a5('0x32')]['filter']+'%'};return _0x490e28;})});}_0x2d5ee6=_[_0x47a5('0x42')]({},_0x2d5ee6,_0x5d9822[_0x47a5('0x44')]);return _0x43f649[_0x47a5('0x54')](_0x2d5ee6);}})[_0x47a5('0x16')](function(_0x3cd335){if(_0x3cd335){_0x4cf7c5=_0x3cd335[_0x47a5('0x4c')];if(!_0x5d9822[_0x47a5('0x32')][_0x47a5('0x39')](_0x47a5('0x3a'))){_0x2d5ee6[_0x47a5('0x25')]=qs[_0x47a5('0x25')](_0x5d9822['query'][_0x47a5('0x25')]);_0x2d5ee6[_0x47a5('0x24')]=qs[_0x47a5('0x24')](_0x5d9822['query'][_0x47a5('0x24')]);}return _0x43f649[_0x47a5('0x54')](_0x2d5ee6);}})[_0x47a5('0x16')](function(_0x5d41d8){if(_0x5d41d8){return _0x5d41d8?{'count':_0x4cf7c5,'rows':_0x5d41d8}:null;}})[_0x47a5('0x16')](respondWithResult(_0x3ac402,null))['catch'](handleError(_0x3ac402,null));};exports['getDescriptions']=function(_0x356e16,_0x292d9c,_0x277486){var _0x27333e={};var _0x164d42={};var _0xea50f3;var _0x479a82;return db['ZendeskConfiguration'][_0x47a5('0x51')]({'where':{'id':_0x356e16['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x292d9c,null))[_0x47a5('0x16')](function(_0x175dab){if(_0x175dab){_0xea50f3=_0x175dab;_0x164d42[_0x47a5('0x36')]=_['keys'](db[_0x47a5('0x52')]['rawAttributes']);_0x164d42['query']=_[_0x47a5('0x31')](_0x356e16[_0x47a5('0x32')]);_0x164d42['filters']=_[_0x47a5('0x4b')](_0x164d42[_0x47a5('0x36')],_0x164d42[_0x47a5('0x32')]);_0x27333e['attributes']=_[_0x47a5('0x4b')](_0x164d42['model'],qs[_0x47a5('0x38')](_0x356e16[_0x47a5('0x32')][_0x47a5('0x38')]));_0x27333e['attributes']=_0x27333e[_0x47a5('0x37')][_0x47a5('0x4c')]?_0x27333e[_0x47a5('0x37')]:_0x164d42['model'];_0x27333e[_0x47a5('0x3b')]=qs['sort'](_0x356e16[_0x47a5('0x32')]['sort']);_0x27333e[_0x47a5('0x3d')]=qs[_0x47a5('0x35')](_[_0x47a5('0x3e')](_0x356e16[_0x47a5('0x32')],_0x164d42['filters']));if(_0x356e16[_0x47a5('0x32')][_0x47a5('0x41')]){_0x27333e[_0x47a5('0x3d')]=_[_0x47a5('0x42')](_0x27333e[_0x47a5('0x3d')],{'$or':_['map'](_0x27333e['attributes'],function(_0x569550){var _0x4ab01f={};_0x4ab01f[_0x569550]={'$like':'%'+_0x356e16[_0x47a5('0x32')][_0x47a5('0x41')]+'%'};return _0x4ab01f;})});}_0x27333e=_[_0x47a5('0x42')]({},_0x27333e,_0x356e16['options']);return _0xea50f3[_0x47a5('0x55')](_0x27333e);}})[_0x47a5('0x16')](function(_0x565fbe){if(_0x565fbe){_0x479a82=_0x565fbe[_0x47a5('0x4c')];if(!_0x356e16[_0x47a5('0x32')][_0x47a5('0x39')](_0x47a5('0x3a'))){_0x27333e['limit']=qs['limit'](_0x356e16[_0x47a5('0x32')][_0x47a5('0x25')]);_0x27333e['offset']=qs[_0x47a5('0x24')](_0x356e16[_0x47a5('0x32')]['offset']);}return _0xea50f3[_0x47a5('0x55')](_0x27333e);}})[_0x47a5('0x16')](function(_0x2930d9){if(_0x2930d9){return _0x2930d9?{'count':_0x479a82,'rows':_0x2930d9}:null;}})['then'](respondWithResult(_0x292d9c,null))[_0x47a5('0x1f')](handleError(_0x292d9c,null));};exports['getTags']=function(_0x663778,_0x5e2946,_0x243c8b){var _0x3c620e={};var _0x4995be={};var _0x35d9f0;var _0x597cb2;return db[_0x47a5('0x45')][_0x47a5('0x51')]({'where':{'id':_0x663778[_0x47a5('0x4a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x5e2946,null))['then'](function(_0x3eb5c1){if(_0x3eb5c1){_0x35d9f0=_0x3eb5c1;_0x4995be['model']=_['keys'](db[_0x47a5('0x56')][_0x47a5('0x30')]);_0x4995be[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x663778[_0x47a5('0x32')]);_0x4995be['filters']=_[_0x47a5('0x4b')](_0x4995be[_0x47a5('0x36')],_0x4995be[_0x47a5('0x32')]);_0x3c620e[_0x47a5('0x37')]=_['intersection'](_0x4995be[_0x47a5('0x36')],qs['fields'](_0x663778[_0x47a5('0x32')][_0x47a5('0x38')]));_0x3c620e[_0x47a5('0x37')]=_0x3c620e[_0x47a5('0x37')][_0x47a5('0x4c')]?_0x3c620e[_0x47a5('0x37')]:_0x4995be[_0x47a5('0x36')];_0x3c620e[_0x47a5('0x3b')]=qs[_0x47a5('0x3c')](_0x663778['query'][_0x47a5('0x3c')]);_0x3c620e[_0x47a5('0x3d')]=qs['filters'](_[_0x47a5('0x3e')](_0x663778[_0x47a5('0x32')],_0x4995be[_0x47a5('0x35')]));if(_0x663778['query']['filter']){_0x3c620e[_0x47a5('0x3d')]=_[_0x47a5('0x42')](_0x3c620e['where'],{'$or':_['map'](_0x3c620e[_0x47a5('0x37')],function(_0x17f82d){var _0x54eab1={};_0x54eab1[_0x17f82d]={'$like':'%'+_0x663778[_0x47a5('0x32')][_0x47a5('0x41')]+'%'};return _0x54eab1;})});}_0x3c620e=_['merge']({},_0x3c620e,_0x663778[_0x47a5('0x44')]);return _0x35d9f0[_0x47a5('0x57')](_0x3c620e);}})[_0x47a5('0x16')](function(_0x70c8a6){if(_0x70c8a6){_0x597cb2=_0x70c8a6[_0x47a5('0x4c')];if(!_0x663778[_0x47a5('0x32')]['hasOwnProperty']('nolimit')){_0x3c620e['limit']=qs[_0x47a5('0x25')](_0x663778[_0x47a5('0x32')]['limit']);_0x3c620e[_0x47a5('0x24')]=qs[_0x47a5('0x24')](_0x663778[_0x47a5('0x32')][_0x47a5('0x24')]);}return _0x35d9f0[_0x47a5('0x57')](_0x3c620e);}})['then'](function(_0x3e7750){if(_0x3e7750){return _0x3e7750?{'count':_0x597cb2,'rows':_0x3e7750}:null;}})['then'](respondWithResult(_0x5e2946,null))['catch'](handleError(_0x5e2946,null));};exports['setTags']=function(_0x21cb5f,_0x4d23c8,_0xe5fbf8){if(_0x21cb5f[_0x47a5('0x50')]['id']){delete _0x21cb5f[_0x47a5('0x50')]['id'];}return db['ZendeskConfiguration'][_0x47a5('0x51')]({'where':{'id':_0x21cb5f[_0x47a5('0x4a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x4d23c8,null))[_0x47a5('0x16')](function(_0x392ad7){if(_0x392ad7){return _0x392ad7['setTags'](_0x21cb5f[_0x47a5('0x50')][_0x47a5('0x58')]||[]);}return null;})['then'](respondWithResult(_0x4d23c8,null))[_0x47a5('0x1f')](handleError(_0x4d23c8,null));}; \ No newline at end of file +var _0x7a54=['bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/parsers/qs','api','../../mysqldb','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','send','rawAttributes','keys','query','dateStart','dateEnd','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','day','add','filter','merge','map','options','ZendeskConfiguration','includeAll','findAll','rows','show','params','intersection','length','include','find','create','body','findOne','ZendeskField','getFields','getSubjects','getDescriptions','Tag','getTags','ids','html-pdf','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x52e857,_0x4ebaf5){var _0x255933=function(_0x2a47ab){while(--_0x2a47ab){_0x52e857['push'](_0x52e857['shift']());}};_0x255933(++_0x4ebaf5);}(_0x7a54,0x106));var _0x47a5=function(_0x2d59be,_0x569376){_0x2d59be=_0x2d59be-0x0;var _0x4f010f=_0x7a54[_0x2d59be];return _0x4f010f;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var qs=require(_0x47a5('0xf'));var logger=require('../../config/logger')(_0x47a5('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x47a5('0x11'))['db'];var jayson=require(_0x47a5('0x12'));var client=jayson[_0x47a5('0x13')][_0x47a5('0x14')]({'port':0x232a});function respondWithRpcPromise(_0xd612dd,_0xd308b8,_0x1eae59,_0x5beb89){return new BPromise(function(_0x44bd3e,_0x221b54){var _0x1cf309=_0x5beb89||client;return _0x1cf309[_0x47a5('0x15')](_0xd612dd,_0x1eae59)[_0x47a5('0x16')](function(_0x620ee9){logger[_0x47a5('0x17')](_0x47a5('0x18'),_0xd308b8,'request\x20sent');logger[_0x47a5('0x19')](_0x47a5('0x1a'),_0xd308b8,_0x47a5('0x1b'),JSON[_0x47a5('0x1c')](_0x620ee9));if(_0x620ee9[_0x47a5('0x1d')]){if(_0x620ee9['error']['code']===0x1f4){logger[_0x47a5('0x1d')]('ZendeskConfiguration,\x20%s,\x20%s',_0xd308b8,_0x620ee9['error'][_0x47a5('0x1e')]);return _0x221b54(_0x620ee9[_0x47a5('0x1d')][_0x47a5('0x1e')]);}logger[_0x47a5('0x1d')](_0x47a5('0x18'),_0xd308b8,_0x620ee9[_0x47a5('0x1d')][_0x47a5('0x1e')]);return _0x44bd3e(_0x620ee9[_0x47a5('0x1d')][_0x47a5('0x1e')]);}else{logger['info'](_0x47a5('0x18'),_0xd308b8,_0x47a5('0x1b'));_0x44bd3e(_0x620ee9['result'][_0x47a5('0x1e')]);}})[_0x47a5('0x1f')](function(_0x36874d){logger['error'](_0x47a5('0x18'),_0xd308b8,_0x36874d);_0x221b54(_0x36874d);});});}function respondWithStatusCode(_0x2f142b,_0x23db32){_0x23db32=_0x23db32||0xcc;return function(_0x7a9f9e){if(_0x7a9f9e){return _0x2f142b['sendStatus'](_0x23db32);}return _0x2f142b[_0x47a5('0x20')](_0x23db32)[_0x47a5('0x21')]();};}function respondWithResult(_0x513981,_0x28747d){_0x28747d=_0x28747d||0xc8;return function(_0xc4cd63){if(_0xc4cd63){return _0x513981[_0x47a5('0x20')](_0x28747d)[_0x47a5('0x22')](_0xc4cd63);}};}function respondWithFilteredResult(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(_0x53078a){var _0x136745=_0x53078a[_0x47a5('0x23')],_0x5686db=_0x50bf17[_0x47a5('0x24')],_0x1ea9c8=_0x50bf17[_0x47a5('0x24')]+_0x50bf17[_0x47a5('0x25')],_0x5b6c4e;if(_0x1ea9c8>=_0x136745){_0x1ea9c8=_0x136745;_0x5b6c4e=0xc8;}else{_0x5b6c4e=0xce;}_0x3abd6a[_0x47a5('0x20')](_0x5b6c4e);return _0x3abd6a[_0x47a5('0x26')](_0x47a5('0x27'),_0x5686db+'-'+_0x1ea9c8+'/'+_0x136745)[_0x47a5('0x22')](_0x53078a);}return null;};}function patchUpdates(_0x16631f){return function(_0x361bfa){try{jsonpatch[_0x47a5('0x28')](_0x361bfa,_0x16631f,!![]);}catch(_0x11a4fa){return BPromise[_0x47a5('0x29')](_0x11a4fa);}return _0x361bfa['save']();};}function saveUpdates(_0x243210,_0x51833b){return function(_0x2ef875){if(_0x2ef875){return _0x2ef875[_0x47a5('0x2a')](_0x243210)[_0x47a5('0x16')](function(_0x4d6b57){return _0x4d6b57;});}return null;};}function removeEntity(_0x256650,_0x625952){return function(_0x39b50b){if(_0x39b50b){return _0x39b50b[_0x47a5('0x2b')]()['then'](function(){_0x256650['status'](0xcc)[_0x47a5('0x21')]();});}};}function handleEntityNotFound(_0xfb5ddb,_0x5bd7eb){return function(_0x4e1006){if(!_0x4e1006){_0xfb5ddb[_0x47a5('0x2c')](0x194);}return _0x4e1006;};}function handleError(_0x51544e,_0x57bff6){_0x57bff6=_0x57bff6||0x1f4;return function(_0x42f70c){logger['error'](_0x42f70c[_0x47a5('0x2d')]);if(_0x42f70c[_0x47a5('0x2e')]){delete _0x42f70c['name'];}_0x51544e['status'](_0x57bff6)[_0x47a5('0x2f')](_0x42f70c);};}exports['index']=function(_0x403028,_0x87e4c9){var _0xf269a8={},_0x52749b={},_0x18f7e9={'count':0x0,'rows':[]};var _0x50c086=db['ZendeskConfiguration'][_0x47a5('0x30')];_0x52749b['model']=_[_0x47a5('0x31')](_0x50c086);var _0x5ef577={'dateStart':_0x403028[_0x47a5('0x32')][_0x47a5('0x33')],'dateEnd':_0x403028[_0x47a5('0x32')][_0x47a5('0x34')]};delete _0x403028[_0x47a5('0x32')][_0x47a5('0x33')];delete _0x403028[_0x47a5('0x32')][_0x47a5('0x34')];_0x52749b[_0x47a5('0x32')]=_['keys'](_0x403028[_0x47a5('0x32')]);_0x52749b[_0x47a5('0x35')]=_['intersection'](_0x52749b[_0x47a5('0x36')],_0x52749b[_0x47a5('0x32')]);_0xf269a8[_0x47a5('0x37')]=_['intersection'](_0x52749b[_0x47a5('0x36')],qs[_0x47a5('0x38')](_0x403028['query'][_0x47a5('0x38')]));_0xf269a8[_0x47a5('0x37')]=_0xf269a8['attributes']['length']?_0xf269a8['attributes']:_0x52749b[_0x47a5('0x36')];if(!_0x403028['query'][_0x47a5('0x39')](_0x47a5('0x3a'))){_0xf269a8[_0x47a5('0x25')]=qs[_0x47a5('0x25')](_0x403028[_0x47a5('0x32')][_0x47a5('0x25')]);_0xf269a8[_0x47a5('0x24')]=qs[_0x47a5('0x24')](_0x403028[_0x47a5('0x32')][_0x47a5('0x24')]);}_0xf269a8[_0x47a5('0x3b')]=qs[_0x47a5('0x3c')](_0x403028[_0x47a5('0x32')]['sort']);_0xf269a8[_0x47a5('0x3d')]=qs[_0x47a5('0x35')](_[_0x47a5('0x3e')](_0x403028[_0x47a5('0x32')],_0x52749b['filters']));if(_0x5ef577[_0x47a5('0x33')]){if(_0x5ef577['dateEnd']){_0x5ef577['dateEnd']=moment(_0x5ef577['dateEnd'])['add'](0x1,_0x47a5('0x3f'));}else{_0x5ef577['dateEnd']=moment(_0x5ef577[_0x47a5('0x33')])[_0x47a5('0x40')](0x1,_0x47a5('0x3f'));}_['merge'](_0xf269a8[_0x47a5('0x3d')],{'createdAt':{'$gte':_0x5ef577[_0x47a5('0x33')],'$lte':_0x5ef577['dateEnd']}});}if(_0x403028['query'][_0x47a5('0x41')]){_0xf269a8['where']=_[_0x47a5('0x42')](_0xf269a8[_0x47a5('0x3d')],{'$or':_[_0x47a5('0x43')](_0xf269a8[_0x47a5('0x37')],function(_0x34a9ae){var _0xf0edbb={};_0xf0edbb[_0x34a9ae]={'$like':'%'+_0x403028[_0x47a5('0x32')][_0x47a5('0x41')]+'%'};return _0xf0edbb;})});}_0xf269a8=_[_0x47a5('0x42')]({},_0xf269a8,_0x403028[_0x47a5('0x44')]);var _0x24ecb1={'where':_0xf269a8[_0x47a5('0x3d')]};return db[_0x47a5('0x45')][_0x47a5('0x23')](_0x24ecb1)[_0x47a5('0x16')](function(_0x3a2b38){_0x18f7e9['count']=_0x3a2b38;if(_0x403028[_0x47a5('0x32')][_0x47a5('0x46')]){_0xf269a8['include']=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x47a5('0x47')](_0xf269a8);})['then'](function(_0x13750d){_0x18f7e9[_0x47a5('0x48')]=_0x13750d;return _0x18f7e9;})['then'](respondWithFilteredResult(_0x87e4c9,_0xf269a8))['catch'](handleError(_0x87e4c9,null));};exports[_0x47a5('0x49')]=function(_0x52d409,_0x2d147c){var _0x1d1039={'raw':![],'where':{'id':_0x52d409[_0x47a5('0x4a')]['id']}},_0x3548bc={};_0x3548bc[_0x47a5('0x36')]=_[_0x47a5('0x31')](db[_0x47a5('0x45')]['rawAttributes']);_0x3548bc['query']=_[_0x47a5('0x31')](_0x52d409[_0x47a5('0x32')]);_0x3548bc[_0x47a5('0x35')]=_[_0x47a5('0x4b')](_0x3548bc[_0x47a5('0x36')],_0x3548bc[_0x47a5('0x32')]);_0x1d1039[_0x47a5('0x37')]=_['intersection'](_0x3548bc[_0x47a5('0x36')],qs[_0x47a5('0x38')](_0x52d409[_0x47a5('0x32')]['fields']));_0x1d1039[_0x47a5('0x37')]=_0x1d1039['attributes'][_0x47a5('0x4c')]?_0x1d1039[_0x47a5('0x37')]:_0x3548bc[_0x47a5('0x36')];if(_0x52d409[_0x47a5('0x32')]['includeAll']){_0x1d1039[_0x47a5('0x4d')]=[{'all':!![]}];}_0x1d1039=_[_0x47a5('0x42')]({},_0x1d1039,_0x52d409[_0x47a5('0x44')]);return db[_0x47a5('0x45')][_0x47a5('0x4e')](_0x1d1039)[_0x47a5('0x16')](handleEntityNotFound(_0x2d147c,null))[_0x47a5('0x16')](respondWithResult(_0x2d147c,null))['catch'](handleError(_0x2d147c,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x45')][_0x47a5('0x4f')](_0x43721b[_0x47a5('0x50')],{})['then'](respondWithResult(_0x187d7e,0xc9))[_0x47a5('0x1f')](handleError(_0x187d7e,null));};exports[_0x47a5('0x2a')]=function(_0x1aa581,_0x53871e){if(_0x1aa581[_0x47a5('0x50')]['id']){delete _0x1aa581[_0x47a5('0x50')]['id'];}return db[_0x47a5('0x45')]['find']({'where':{'id':_0x1aa581['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x53871e,null))[_0x47a5('0x16')](saveUpdates(_0x1aa581['body'],null))['then'](respondWithResult(_0x53871e,null))[_0x47a5('0x1f')](handleError(_0x53871e,null));};exports['destroy']=function(_0x16bb8a,_0x5d383d){return db['ZendeskConfiguration'][_0x47a5('0x4e')]({'where':{'id':_0x16bb8a[_0x47a5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5d383d,null))[_0x47a5('0x16')](removeEntity(_0x5d383d,null))[_0x47a5('0x1f')](handleError(_0x5d383d,null));};exports['getFields']=function(_0x5b6127,_0x16b4fd,_0x30d482){var _0x867da0={};var _0x2931e4={};var _0x5996c4;var _0x199621;return db[_0x47a5('0x45')][_0x47a5('0x51')]({'where':{'id':_0x5b6127['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x16b4fd,null))['then'](function(_0x485e3c){if(_0x485e3c){_0x5996c4=_0x485e3c;_0x2931e4[_0x47a5('0x36')]=_[_0x47a5('0x31')](db[_0x47a5('0x52')][_0x47a5('0x30')]);_0x2931e4['query']=_[_0x47a5('0x31')](_0x5b6127['query']);_0x2931e4['filters']=_['intersection'](_0x2931e4['model'],_0x2931e4[_0x47a5('0x32')]);_0x867da0[_0x47a5('0x37')]=_[_0x47a5('0x4b')](_0x2931e4['model'],qs['fields'](_0x5b6127[_0x47a5('0x32')][_0x47a5('0x38')]));_0x867da0[_0x47a5('0x37')]=_0x867da0[_0x47a5('0x37')][_0x47a5('0x4c')]?_0x867da0['attributes']:_0x2931e4[_0x47a5('0x36')];_0x867da0['order']=qs[_0x47a5('0x3c')](_0x5b6127[_0x47a5('0x32')]['sort']);_0x867da0[_0x47a5('0x3d')]=qs[_0x47a5('0x35')](_[_0x47a5('0x3e')](_0x5b6127[_0x47a5('0x32')],_0x2931e4[_0x47a5('0x35')]));if(_0x5b6127[_0x47a5('0x32')][_0x47a5('0x41')]){_0x867da0[_0x47a5('0x3d')]=_['merge'](_0x867da0[_0x47a5('0x3d')],{'$or':_[_0x47a5('0x43')](_0x867da0[_0x47a5('0x37')],function(_0x26e7fc){var _0x396cb0={};_0x396cb0[_0x26e7fc]={'$like':'%'+_0x5b6127['query'][_0x47a5('0x41')]+'%'};return _0x396cb0;})});}_0x867da0=_[_0x47a5('0x42')]({},_0x867da0,_0x5b6127[_0x47a5('0x44')]);return _0x5996c4[_0x47a5('0x53')](_0x867da0);}})[_0x47a5('0x16')](function(_0x168329){if(_0x168329){_0x199621=_0x168329[_0x47a5('0x4c')];if(!_0x5b6127[_0x47a5('0x32')][_0x47a5('0x39')](_0x47a5('0x3a'))){_0x867da0[_0x47a5('0x25')]=qs[_0x47a5('0x25')](_0x5b6127[_0x47a5('0x32')][_0x47a5('0x25')]);_0x867da0[_0x47a5('0x24')]=qs['offset'](_0x5b6127[_0x47a5('0x32')][_0x47a5('0x24')]);}return _0x5996c4[_0x47a5('0x53')](_0x867da0);}})['then'](function(_0x37ac59){if(_0x37ac59){return _0x37ac59?{'count':_0x199621,'rows':_0x37ac59}:null;}})[_0x47a5('0x16')](respondWithResult(_0x16b4fd,null))[_0x47a5('0x1f')](handleError(_0x16b4fd,null));};exports[_0x47a5('0x54')]=function(_0x5d9822,_0x3ac402,_0x522ccf){var _0x2d5ee6={};var _0x487e21={};var _0x43f649;var _0x4cf7c5;return db[_0x47a5('0x45')][_0x47a5('0x51')]({'where':{'id':_0x5d9822[_0x47a5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3ac402,null))['then'](function(_0x4b8084){if(_0x4b8084){_0x43f649=_0x4b8084;_0x487e21[_0x47a5('0x36')]=_[_0x47a5('0x31')](db[_0x47a5('0x52')][_0x47a5('0x30')]);_0x487e21['query']=_[_0x47a5('0x31')](_0x5d9822[_0x47a5('0x32')]);_0x487e21[_0x47a5('0x35')]=_[_0x47a5('0x4b')](_0x487e21[_0x47a5('0x36')],_0x487e21[_0x47a5('0x32')]);_0x2d5ee6[_0x47a5('0x37')]=_[_0x47a5('0x4b')](_0x487e21[_0x47a5('0x36')],qs[_0x47a5('0x38')](_0x5d9822[_0x47a5('0x32')][_0x47a5('0x38')]));_0x2d5ee6['attributes']=_0x2d5ee6[_0x47a5('0x37')]['length']?_0x2d5ee6[_0x47a5('0x37')]:_0x487e21[_0x47a5('0x36')];_0x2d5ee6[_0x47a5('0x3b')]=qs[_0x47a5('0x3c')](_0x5d9822[_0x47a5('0x32')][_0x47a5('0x3c')]);_0x2d5ee6[_0x47a5('0x3d')]=qs[_0x47a5('0x35')](_[_0x47a5('0x3e')](_0x5d9822[_0x47a5('0x32')],_0x487e21[_0x47a5('0x35')]));if(_0x5d9822[_0x47a5('0x32')][_0x47a5('0x41')]){_0x2d5ee6[_0x47a5('0x3d')]=_[_0x47a5('0x42')](_0x2d5ee6['where'],{'$or':_['map'](_0x2d5ee6['attributes'],function(_0x4d09a4){var _0x490e28={};_0x490e28[_0x4d09a4]={'$like':'%'+_0x5d9822[_0x47a5('0x32')]['filter']+'%'};return _0x490e28;})});}_0x2d5ee6=_[_0x47a5('0x42')]({},_0x2d5ee6,_0x5d9822[_0x47a5('0x44')]);return _0x43f649[_0x47a5('0x54')](_0x2d5ee6);}})[_0x47a5('0x16')](function(_0x3cd335){if(_0x3cd335){_0x4cf7c5=_0x3cd335[_0x47a5('0x4c')];if(!_0x5d9822[_0x47a5('0x32')][_0x47a5('0x39')](_0x47a5('0x3a'))){_0x2d5ee6[_0x47a5('0x25')]=qs[_0x47a5('0x25')](_0x5d9822['query'][_0x47a5('0x25')]);_0x2d5ee6[_0x47a5('0x24')]=qs[_0x47a5('0x24')](_0x5d9822['query'][_0x47a5('0x24')]);}return _0x43f649[_0x47a5('0x54')](_0x2d5ee6);}})[_0x47a5('0x16')](function(_0x5d41d8){if(_0x5d41d8){return _0x5d41d8?{'count':_0x4cf7c5,'rows':_0x5d41d8}:null;}})[_0x47a5('0x16')](respondWithResult(_0x3ac402,null))['catch'](handleError(_0x3ac402,null));};exports['getDescriptions']=function(_0x356e16,_0x292d9c,_0x277486){var _0x27333e={};var _0x164d42={};var _0xea50f3;var _0x479a82;return db['ZendeskConfiguration'][_0x47a5('0x51')]({'where':{'id':_0x356e16['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x292d9c,null))[_0x47a5('0x16')](function(_0x175dab){if(_0x175dab){_0xea50f3=_0x175dab;_0x164d42[_0x47a5('0x36')]=_['keys'](db[_0x47a5('0x52')]['rawAttributes']);_0x164d42['query']=_[_0x47a5('0x31')](_0x356e16[_0x47a5('0x32')]);_0x164d42['filters']=_[_0x47a5('0x4b')](_0x164d42[_0x47a5('0x36')],_0x164d42[_0x47a5('0x32')]);_0x27333e['attributes']=_[_0x47a5('0x4b')](_0x164d42['model'],qs[_0x47a5('0x38')](_0x356e16[_0x47a5('0x32')][_0x47a5('0x38')]));_0x27333e['attributes']=_0x27333e[_0x47a5('0x37')][_0x47a5('0x4c')]?_0x27333e[_0x47a5('0x37')]:_0x164d42['model'];_0x27333e[_0x47a5('0x3b')]=qs['sort'](_0x356e16[_0x47a5('0x32')]['sort']);_0x27333e[_0x47a5('0x3d')]=qs[_0x47a5('0x35')](_[_0x47a5('0x3e')](_0x356e16[_0x47a5('0x32')],_0x164d42['filters']));if(_0x356e16[_0x47a5('0x32')][_0x47a5('0x41')]){_0x27333e[_0x47a5('0x3d')]=_[_0x47a5('0x42')](_0x27333e[_0x47a5('0x3d')],{'$or':_['map'](_0x27333e['attributes'],function(_0x569550){var _0x4ab01f={};_0x4ab01f[_0x569550]={'$like':'%'+_0x356e16[_0x47a5('0x32')][_0x47a5('0x41')]+'%'};return _0x4ab01f;})});}_0x27333e=_[_0x47a5('0x42')]({},_0x27333e,_0x356e16['options']);return _0xea50f3[_0x47a5('0x55')](_0x27333e);}})[_0x47a5('0x16')](function(_0x565fbe){if(_0x565fbe){_0x479a82=_0x565fbe[_0x47a5('0x4c')];if(!_0x356e16[_0x47a5('0x32')][_0x47a5('0x39')](_0x47a5('0x3a'))){_0x27333e['limit']=qs['limit'](_0x356e16[_0x47a5('0x32')][_0x47a5('0x25')]);_0x27333e['offset']=qs[_0x47a5('0x24')](_0x356e16[_0x47a5('0x32')]['offset']);}return _0xea50f3[_0x47a5('0x55')](_0x27333e);}})[_0x47a5('0x16')](function(_0x2930d9){if(_0x2930d9){return _0x2930d9?{'count':_0x479a82,'rows':_0x2930d9}:null;}})['then'](respondWithResult(_0x292d9c,null))[_0x47a5('0x1f')](handleError(_0x292d9c,null));};exports['getTags']=function(_0x663778,_0x5e2946,_0x243c8b){var _0x3c620e={};var _0x4995be={};var _0x35d9f0;var _0x597cb2;return db[_0x47a5('0x45')][_0x47a5('0x51')]({'where':{'id':_0x663778[_0x47a5('0x4a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x5e2946,null))['then'](function(_0x3eb5c1){if(_0x3eb5c1){_0x35d9f0=_0x3eb5c1;_0x4995be['model']=_['keys'](db[_0x47a5('0x56')][_0x47a5('0x30')]);_0x4995be[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x663778[_0x47a5('0x32')]);_0x4995be['filters']=_[_0x47a5('0x4b')](_0x4995be[_0x47a5('0x36')],_0x4995be[_0x47a5('0x32')]);_0x3c620e[_0x47a5('0x37')]=_['intersection'](_0x4995be[_0x47a5('0x36')],qs['fields'](_0x663778[_0x47a5('0x32')][_0x47a5('0x38')]));_0x3c620e[_0x47a5('0x37')]=_0x3c620e[_0x47a5('0x37')][_0x47a5('0x4c')]?_0x3c620e[_0x47a5('0x37')]:_0x4995be[_0x47a5('0x36')];_0x3c620e[_0x47a5('0x3b')]=qs[_0x47a5('0x3c')](_0x663778['query'][_0x47a5('0x3c')]);_0x3c620e[_0x47a5('0x3d')]=qs['filters'](_[_0x47a5('0x3e')](_0x663778[_0x47a5('0x32')],_0x4995be[_0x47a5('0x35')]));if(_0x663778['query']['filter']){_0x3c620e[_0x47a5('0x3d')]=_[_0x47a5('0x42')](_0x3c620e['where'],{'$or':_['map'](_0x3c620e[_0x47a5('0x37')],function(_0x17f82d){var _0x54eab1={};_0x54eab1[_0x17f82d]={'$like':'%'+_0x663778[_0x47a5('0x32')][_0x47a5('0x41')]+'%'};return _0x54eab1;})});}_0x3c620e=_['merge']({},_0x3c620e,_0x663778[_0x47a5('0x44')]);return _0x35d9f0[_0x47a5('0x57')](_0x3c620e);}})[_0x47a5('0x16')](function(_0x70c8a6){if(_0x70c8a6){_0x597cb2=_0x70c8a6[_0x47a5('0x4c')];if(!_0x663778[_0x47a5('0x32')]['hasOwnProperty']('nolimit')){_0x3c620e['limit']=qs[_0x47a5('0x25')](_0x663778[_0x47a5('0x32')]['limit']);_0x3c620e[_0x47a5('0x24')]=qs[_0x47a5('0x24')](_0x663778[_0x47a5('0x32')][_0x47a5('0x24')]);}return _0x35d9f0[_0x47a5('0x57')](_0x3c620e);}})['then'](function(_0x3e7750){if(_0x3e7750){return _0x3e7750?{'count':_0x597cb2,'rows':_0x3e7750}:null;}})['then'](respondWithResult(_0x5e2946,null))['catch'](handleError(_0x5e2946,null));};exports['setTags']=function(_0x21cb5f,_0x4d23c8,_0xe5fbf8){if(_0x21cb5f[_0x47a5('0x50')]['id']){delete _0x21cb5f[_0x47a5('0x50')]['id'];}return db['ZendeskConfiguration'][_0x47a5('0x51')]({'where':{'id':_0x21cb5f[_0x47a5('0x4a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x4d23c8,null))[_0x47a5('0x16')](function(_0x392ad7){if(_0x392ad7){return _0x392ad7['setTags'](_0x21cb5f[_0x47a5('0x50')][_0x47a5('0x58')]||[]);}return null;})['then'](respondWithResult(_0x4d23c8,null))[_0x47a5('0x1f')](handleError(_0x4d23c8,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 9e05ea3..e01927c 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 _0xf675=['exports','ZendeskConfiguration','lodash','util','../../config/logger','request-promise'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0xf675,0xa4));var _0x5f67=function(_0x10bf5d,_0x10a3a9){_0x10bf5d=_0x10bf5d-0x0;var _0x27f511=_0xf675[_0x10bf5d];return _0x27f511;};'use strict';var _=require(_0x5f67('0x0'));var util=require(_0x5f67('0x1'));var logger=require(_0x5f67('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5f67('0x3'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x5f67('0x4')]=function(_0x19107e,_0x2a7d2c){return _0x19107e['define'](_0x5f67('0x5'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b38=['./intZendeskConfiguration.attributes','define','ZendeskConfiguration','int_zendesk_configurations','util','../../config/logger','api','bluebird','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8b38,0xdc));var _0x88b3=function(_0x2317af,_0x1332d3){_0x2317af=_0x2317af-0x0;var _0x3cb58d=_0x8b38[_0x2317af];return _0x3cb58d;};'use strict';var _=require('lodash');var util=require(_0x88b3('0x0'));var logger=require(_0x88b3('0x1'))(_0x88b3('0x2'));var moment=require('moment');var BPromise=require(_0x88b3('0x3'));var rp=require(_0x88b3('0x4'));var attributes=require(_0x88b3('0x5'));module['exports']=function(_0x1028c4,_0x1b0a87){return _0x1028c4[_0x88b3('0x6')](_0x88b3('0x7'),attributes,{'tableName':_0x88b3('0x8'),'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 04bf0d9..bb633fb 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 _0x38eb=['result','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message'];(function(_0x1c80bd,_0x356976){var _0x15b7fc=function(_0x1ad2a){while(--_0x1ad2a){_0x1c80bd['push'](_0x1c80bd['shift']());}};_0x15b7fc(++_0x356976);}(_0x38eb,0x7f));var _0xb38e=function(_0x1bfa42,_0x591cbb){_0x1bfa42=_0x1bfa42-0x0;var _0x13e6e6=_0x38eb[_0x1bfa42];return _0x13e6e6;};'use strict';var _=require('lodash');var util=require(_0xb38e('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb38e('0x1'));var fs=require('fs');var Redis=require(_0xb38e('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xb38e('0x3'));var logger=require(_0xb38e('0x4'))(_0xb38e('0x5'));var config=require(_0xb38e('0x6'));var jayson=require(_0xb38e('0x7'));var client=jayson[_0xb38e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e70d4,_0x490b3c,_0x461a9f){return new BPromise(function(_0x5e82ee,_0x11d390){return client[_0xb38e('0x9')](_0x2e70d4,_0x461a9f)[_0xb38e('0xa')](function(_0x528a1c){logger[_0xb38e('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x490b3c,_0xb38e('0xc'));logger[_0xb38e('0xd')](_0xb38e('0xe'),_0x490b3c,'request\x20sent',JSON[_0xb38e('0xf')](_0x528a1c));if(_0x528a1c[_0xb38e('0x10')]){if(_0x528a1c[_0xb38e('0x10')][_0xb38e('0x11')]===0x1f4){logger[_0xb38e('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x490b3c,_0x528a1c[_0xb38e('0x10')]['message']);return _0x11d390(_0x528a1c[_0xb38e('0x10')]['message']);}logger[_0xb38e('0x10')](_0xb38e('0x12'),_0x490b3c,_0x528a1c[_0xb38e('0x10')][_0xb38e('0x13')]);return _0x5e82ee(_0x528a1c[_0xb38e('0x10')][_0xb38e('0x13')]);}else{logger[_0xb38e('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x490b3c,'request\x20sent');_0x5e82ee(_0x528a1c[_0xb38e('0x14')][_0xb38e('0x13')]);}})['catch'](function(_0x551291){logger[_0xb38e('0x10')](_0xb38e('0x12'),_0x490b3c,_0x551291);_0x11d390(_0x551291);});});} \ No newline at end of file +var _0x769e=['info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then'];(function(_0x2a1fc0,_0x5d8d63){var _0x2b805c=function(_0x3d5d40){while(--_0x3d5d40){_0x2a1fc0['push'](_0x2a1fc0['shift']());}};_0x2b805c(++_0x5d8d63);}(_0x769e,0xf0));var _0xe769=function(_0x355906,_0x4d3033){_0x355906=_0x355906-0x0;var _0x5cb182=_0x769e[_0x355906];return _0x5cb182;};'use strict';var _=require(_0xe769('0x0'));var util=require(_0xe769('0x1'));var moment=require(_0xe769('0x2'));var BPromise=require('bluebird');var rs=require(_0xe769('0x3'));var fs=require('fs');var Redis=require(_0xe769('0x4'));var db=require(_0xe769('0x5'))['db'];var utils=require(_0xe769('0x6'));var logger=require('../../config/logger')(_0xe769('0x7'));var config=require(_0xe769('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe769('0x9')][_0xe769('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bbb8b,_0x23813e,_0x2990dc){return new BPromise(function(_0x53b8ef,_0x23fc58){return client['request'](_0x4bbb8b,_0x2990dc)[_0xe769('0xb')](function(_0x48c555){logger[_0xe769('0xc')](_0xe769('0xd'),_0x23813e,_0xe769('0xe'));logger[_0xe769('0xf')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x23813e,'request\x20sent',JSON[_0xe769('0x10')](_0x48c555));if(_0x48c555[_0xe769('0x11')]){if(_0x48c555[_0xe769('0x11')][_0xe769('0x12')]===0x1f4){logger[_0xe769('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x23813e,_0x48c555[_0xe769('0x11')]['message']);return _0x23fc58(_0x48c555[_0xe769('0x11')][_0xe769('0x13')]);}logger[_0xe769('0x11')](_0xe769('0xd'),_0x23813e,_0x48c555[_0xe769('0x11')][_0xe769('0x13')]);return _0x53b8ef(_0x48c555[_0xe769('0x11')]['message']);}else{logger['info'](_0xe769('0xd'),_0x23813e,'request\x20sent');_0x53b8ef(_0x48c555['result'][_0xe769('0x13')]);}})[_0xe769('0x14')](function(_0x330a97){logger[_0xe769('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x23813e,_0x330a97);_0x23fc58(_0x330a97);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 5a867f5..a55eff3 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 _0x9957=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0xe8e2ad,_0x4df5f5){var _0x15f391=function(_0x2eb6fd){while(--_0x2eb6fd){_0xe8e2ad['push'](_0xe8e2ad['shift']());}};_0x15f391(++_0x4df5f5);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./intZendeskField.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['show']);router[_0x7995('0xc')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0xd')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller[_0x7995('0xe')]);router[_0x7995('0xf')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['destroy']);module[_0x7995('0x10')]=router; \ No newline at end of file +var _0x9957=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x13272c,_0x49b0e0){var _0x4f7b0b=function(_0x2bfe4){while(--_0x2bfe4){_0x13272c['push'](_0x13272c['shift']());}};_0x4f7b0b(++_0x49b0e0);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./intZendeskField.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['show']);router[_0x7995('0xc')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0xd')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller[_0x7995('0xe')]);router[_0x7995('0xf')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['destroy']);module[_0x7995('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index d57f91e..263efd0 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 _0xd8b0=['keyValue','string','STRING','variable','BOOLEAN','sequelize','exports','customVariable'];(function(_0x1e6d2d,_0x1a0c18){var _0x1739f0=function(_0x19c45a){while(--_0x19c45a){_0x1e6d2d['push'](_0x1e6d2d['shift']());}};_0x1739f0(++_0x1a0c18);}(_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')]={'type':{'type':Sequelize['ENUM']('string','variable',_0x0d8b('0x2'),_0x0d8b('0x3')),'defaultValue':_0x0d8b('0x4')},'content':{'type':Sequelize[_0x0d8b('0x5')]},'key':{'type':Sequelize[_0x0d8b('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0x0d8b('0x6'),_0x0d8b('0x2'))},'keyContent':{'type':Sequelize[_0x0d8b('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0d8b('0x5')]},'customField':{'type':Sequelize[_0x0d8b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdace=['variable','keyValue','STRING','customVariable','BOOLEAN','sequelize','ENUM','string'];(function(_0xe503bc,_0x34b5cf){var _0x1329ea=function(_0x38e31f){while(--_0x38e31f){_0xe503bc['push'](_0xe503bc['shift']());}};_0x1329ea(++_0x34b5cf);}(_0xdace,0xc5));var _0xedac=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0xdace[_0x42f009];return _0x22a1e0;};'use strict';var Sequelize=require(_0xedac('0x0'));module['exports']={'type':{'type':Sequelize[_0xedac('0x1')](_0xedac('0x2'),_0xedac('0x3'),'customVariable',_0xedac('0x4')),'defaultValue':_0xedac('0x2')},'content':{'type':Sequelize[_0xedac('0x5')]},'key':{'type':Sequelize[_0xedac('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xedac('0x2'),_0xedac('0x3'),_0xedac('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xedac('0x5')]},'nameField':{'type':Sequelize[_0xedac('0x5')]},'customField':{'type':Sequelize[_0xedac('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 131634e..b32eacb 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 _0x5e39=['limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','ZendeskField','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','add','day','merge','where','filter','map','options','includeAll','include','findAll','show','params','catch','create','update','body','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../mysqldb','end','status','json','offset'];(function(_0x4778a8,_0x4ad3fa){var _0x4d8ca7=function(_0x1c1829){while(--_0x1c1829){_0x4778a8['push'](_0x4778a8['shift']());}};_0x4d8ca7(++_0x4ad3fa);}(_0x5e39,0xbb));var _0x95e3=function(_0x4de5ed,_0x2ec37a){_0x4de5ed=_0x4de5ed-0x0;var _0x48ec56=_0x5e39[_0x4de5ed];return _0x48ec56;};'use strict';var pdf=require(_0x95e3('0x0'));var emlformat=require(_0x95e3('0x1'));var rimraf=require(_0x95e3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x95e3('0x3'));var rp=require(_0x95e3('0x4'));var moment=require(_0x95e3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x95e3('0x6'));var util=require(_0x95e3('0x7'));var path=require(_0x95e3('0x8'));var sox=require(_0x95e3('0x9'));var csv=require(_0x95e3('0xa'));var ejs=require(_0x95e3('0xb'));var fs=require('fs');var _=require(_0x95e3('0xc'));var squel=require(_0x95e3('0xd'));var crypto=require(_0x95e3('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x95e3('0xf'));var toCsv=require(_0x95e3('0xa'));var querystring=require(_0x95e3('0x10'));var Papa=require(_0x95e3('0x11'));var Redis=require(_0x95e3('0x12'));var qs=require(_0x95e3('0x13'));var logger=require('../../config/logger')(_0x95e3('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x95e3('0x15'))['db'];function respondWithStatusCode(_0x1c3b05,_0x545c29){_0x545c29=_0x545c29||0xcc;return function(_0x112084){if(_0x112084){return _0x1c3b05['sendStatus'](_0x545c29);}return _0x1c3b05['status'](_0x545c29)[_0x95e3('0x16')]();};}function respondWithResult(_0x3cce2b,_0x4c9181){_0x4c9181=_0x4c9181||0xc8;return function(_0x47ffab){if(_0x47ffab){return _0x3cce2b[_0x95e3('0x17')](_0x4c9181)[_0x95e3('0x18')](_0x47ffab);}};}function respondWithFilteredResult(_0x4ddc9c,_0x305e99){return function(_0x5bbafb){if(_0x5bbafb){var _0x2209d0=_0x5bbafb['count'],_0x4f8f0a=_0x305e99[_0x95e3('0x19')],_0x18f392=_0x305e99['offset']+_0x305e99[_0x95e3('0x1a')],_0x3d7188;if(_0x18f392>=_0x2209d0){_0x18f392=_0x2209d0;_0x3d7188=0xc8;}else{_0x3d7188=0xce;}_0x4ddc9c['status'](_0x3d7188);return _0x4ddc9c[_0x95e3('0x1b')](_0x95e3('0x1c'),_0x4f8f0a+'-'+_0x18f392+'/'+_0x2209d0)['json'](_0x5bbafb);}return null;};}function patchUpdates(_0x46bf68){return function(_0x33390e){try{jsonpatch[_0x95e3('0x1d')](_0x33390e,_0x46bf68,!![]);}catch(_0x13dc55){return BPromise[_0x95e3('0x1e')](_0x13dc55);}return _0x33390e[_0x95e3('0x1f')]();};}function saveUpdates(_0x1e5185,_0x45f4ae){return function(_0x45c22c){if(_0x45c22c){return _0x45c22c['update'](_0x1e5185)['then'](function(_0x3075d7){return _0x3075d7;});}return null;};}function removeEntity(_0x5303b9,_0x453223){return function(_0x39817e){if(_0x39817e){return _0x39817e[_0x95e3('0x20')]()[_0x95e3('0x21')](function(){_0x5303b9[_0x95e3('0x17')](0xcc)[_0x95e3('0x16')]();});}};}function handleEntityNotFound(_0x2cfdcf,_0x518cdb){return function(_0x15b7c1){if(!_0x15b7c1){_0x2cfdcf['sendStatus'](0x194);}return _0x15b7c1;};}function handleError(_0x378b99,_0x538239){_0x538239=_0x538239||0x1f4;return function(_0x32b429){logger[_0x95e3('0x22')](_0x32b429[_0x95e3('0x23')]);if(_0x32b429[_0x95e3('0x24')]){delete _0x32b429[_0x95e3('0x24')];}_0x378b99[_0x95e3('0x17')](_0x538239)[_0x95e3('0x25')](_0x32b429);};}exports['index']=function(_0x55942c,_0x44d70d){var _0x90150a={},_0x1b8838={},_0xc399be={'count':0x0,'rows':[]};var _0x5cbc41=db[_0x95e3('0x26')][_0x95e3('0x27')];_0x1b8838['model']=_[_0x95e3('0x28')](_0x5cbc41);var _0x4d1d26={'dateStart':_0x55942c[_0x95e3('0x29')][_0x95e3('0x2a')],'dateEnd':_0x55942c[_0x95e3('0x29')][_0x95e3('0x2b')]};delete _0x55942c['query'][_0x95e3('0x2a')];delete _0x55942c['query'][_0x95e3('0x2b')];_0x1b8838['query']=_['keys'](_0x55942c[_0x95e3('0x29')]);_0x1b8838[_0x95e3('0x2c')]=_[_0x95e3('0x2d')](_0x1b8838[_0x95e3('0x2e')],_0x1b8838[_0x95e3('0x29')]);_0x90150a['attributes']=_['intersection'](_0x1b8838[_0x95e3('0x2e')],qs['fields'](_0x55942c[_0x95e3('0x29')][_0x95e3('0x2f')]));_0x90150a[_0x95e3('0x30')]=_0x90150a['attributes']['length']?_0x90150a['attributes']:_0x1b8838[_0x95e3('0x2e')];if(!_0x55942c[_0x95e3('0x29')][_0x95e3('0x31')](_0x95e3('0x32'))){_0x90150a[_0x95e3('0x1a')]=qs['limit'](_0x55942c[_0x95e3('0x29')]['limit']);_0x90150a[_0x95e3('0x19')]=qs[_0x95e3('0x19')](_0x55942c[_0x95e3('0x29')]['offset']);}_0x90150a[_0x95e3('0x33')]=qs[_0x95e3('0x34')](_0x55942c['query'][_0x95e3('0x34')]);_0x90150a['where']=qs[_0x95e3('0x2c')](_[_0x95e3('0x35')](_0x55942c[_0x95e3('0x29')],_0x1b8838['filters']));if(_0x4d1d26[_0x95e3('0x2a')]){if(_0x4d1d26['dateEnd']){_0x4d1d26[_0x95e3('0x2b')]=moment(_0x4d1d26[_0x95e3('0x2b')])[_0x95e3('0x36')](0x1,'day');}else{_0x4d1d26[_0x95e3('0x2b')]=moment(_0x4d1d26['dateStart'])[_0x95e3('0x36')](0x1,_0x95e3('0x37'));}_[_0x95e3('0x38')](_0x90150a[_0x95e3('0x39')],{'createdAt':{'$gte':_0x4d1d26[_0x95e3('0x2a')],'$lte':_0x4d1d26['dateEnd']}});}if(_0x55942c['query'][_0x95e3('0x3a')]){_0x90150a['where']=_[_0x95e3('0x38')](_0x90150a[_0x95e3('0x39')],{'$or':_[_0x95e3('0x3b')](_0x90150a[_0x95e3('0x30')],function(_0x34f3d8){var _0x6d6944={};_0x6d6944[_0x34f3d8]={'$like':'%'+_0x55942c[_0x95e3('0x29')][_0x95e3('0x3a')]+'%'};return _0x6d6944;})});}_0x90150a=_[_0x95e3('0x38')]({},_0x90150a,_0x55942c[_0x95e3('0x3c')]);var _0x21c00f={'where':_0x90150a[_0x95e3('0x39')]};return db['ZendeskField']['count'](_0x21c00f)[_0x95e3('0x21')](function(_0x494aa9){_0xc399be['count']=_0x494aa9;if(_0x55942c['query'][_0x95e3('0x3d')]){_0x90150a[_0x95e3('0x3e')]=[{'all':!![]}];}return db[_0x95e3('0x26')][_0x95e3('0x3f')](_0x90150a);})[_0x95e3('0x21')](function(_0x3993df){_0xc399be['rows']=_0x3993df;return _0xc399be;})[_0x95e3('0x21')](respondWithFilteredResult(_0x44d70d,_0x90150a))['catch'](handleError(_0x44d70d,null));};exports[_0x95e3('0x40')]=function(_0x27f9f4,_0x1ba4f3){var _0x5c48c8={'raw':!![],'where':{'id':_0x27f9f4[_0x95e3('0x41')]['id']}},_0xa93a7e={};_0xa93a7e[_0x95e3('0x2e')]=_['keys'](db['ZendeskField'][_0x95e3('0x27')]);_0xa93a7e[_0x95e3('0x29')]=_[_0x95e3('0x28')](_0x27f9f4[_0x95e3('0x29')]);_0xa93a7e[_0x95e3('0x2c')]=_['intersection'](_0xa93a7e[_0x95e3('0x2e')],_0xa93a7e[_0x95e3('0x29')]);_0x5c48c8[_0x95e3('0x30')]=_[_0x95e3('0x2d')](_0xa93a7e['model'],qs[_0x95e3('0x2f')](_0x27f9f4[_0x95e3('0x29')][_0x95e3('0x2f')]));_0x5c48c8[_0x95e3('0x30')]=_0x5c48c8['attributes']['length']?_0x5c48c8[_0x95e3('0x30')]:_0xa93a7e[_0x95e3('0x2e')];if(_0x27f9f4[_0x95e3('0x29')][_0x95e3('0x3d')]){_0x5c48c8['include']=[{'all':!![]}];}_0x5c48c8=_[_0x95e3('0x38')]({},_0x5c48c8,_0x27f9f4['options']);return db[_0x95e3('0x26')]['find'](_0x5c48c8)[_0x95e3('0x21')](handleEntityNotFound(_0x1ba4f3,null))[_0x95e3('0x21')](respondWithResult(_0x1ba4f3,null))[_0x95e3('0x42')](handleError(_0x1ba4f3,null));};exports[_0x95e3('0x43')]=function(_0x3ef69b,_0x2ed302){return db[_0x95e3('0x26')][_0x95e3('0x43')](_0x3ef69b['body'],{})[_0x95e3('0x21')](respondWithResult(_0x2ed302,0xc9))[_0x95e3('0x42')](handleError(_0x2ed302,null));};exports[_0x95e3('0x44')]=function(_0x7f86c,_0x46bb00){if(_0x7f86c[_0x95e3('0x45')]['id']){delete _0x7f86c[_0x95e3('0x45')]['id'];}return db[_0x95e3('0x26')][_0x95e3('0x46')]({'where':{'id':_0x7f86c[_0x95e3('0x41')]['id']}})[_0x95e3('0x21')](handleEntityNotFound(_0x46bb00,null))['then'](saveUpdates(_0x7f86c[_0x95e3('0x45')],null))['then'](respondWithResult(_0x46bb00,null))[_0x95e3('0x42')](handleError(_0x46bb00,null));};exports[_0x95e3('0x20')]=function(_0x2d5568,_0x53c2e3){return db[_0x95e3('0x26')][_0x95e3('0x46')]({'where':{'id':_0x2d5568[_0x95e3('0x41')]['id']}})[_0x95e3('0x21')](handleEntityNotFound(_0x53c2e3,null))[_0x95e3('0x21')](removeEntity(_0x53c2e3,null))[_0x95e3('0x42')](handleError(_0x53c2e3,null));}; \ No newline at end of file +var _0x0b33=['filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','day','add','merge','where','filter','map','options','count','include','findAll','rows','catch','params','rawAttributes','includeAll','create','body','find','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../config/logger','api','../../config/environment','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','stack','name','send','index','ZendeskField','model','query','dateStart','dateEnd','keys'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x0b33,0xe9));var _0x30b3=function(_0x10dc64,_0x11bb29){_0x10dc64=_0x10dc64-0x0;var _0x9cf98d=_0x0b33[_0x10dc64];return _0x9cf98d;};'use strict';var pdf=require(_0x30b3('0x0'));var emlformat=require(_0x30b3('0x1'));var rimraf=require(_0x30b3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x30b3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x30b3('0x4'));var Mustache=require(_0x30b3('0x5'));var util=require(_0x30b3('0x6'));var path=require(_0x30b3('0x7'));var sox=require(_0x30b3('0x8'));var csv=require(_0x30b3('0x9'));var ejs=require(_0x30b3('0xa'));var fs=require('fs');var _=require(_0x30b3('0xb'));var squel=require('squel');var crypto=require(_0x30b3('0xc'));var jsforce=require(_0x30b3('0xd'));var deskjs=require(_0x30b3('0xe'));var toCsv=require(_0x30b3('0x9'));var querystring=require(_0x30b3('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x30b3('0x10'))(_0x30b3('0x11'));var utils=require('../../config/utils');var config=require(_0x30b3('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a210d,_0x2d6b64){_0x2d6b64=_0x2d6b64||0xcc;return function(_0xe104dc){if(_0xe104dc){return _0x5a210d['sendStatus'](_0x2d6b64);}return _0x5a210d['status'](_0x2d6b64)['end']();};}function respondWithResult(_0x32c693,_0x47df45){_0x47df45=_0x47df45||0xc8;return function(_0x2e5a10){if(_0x2e5a10){return _0x32c693[_0x30b3('0x13')](_0x47df45)[_0x30b3('0x14')](_0x2e5a10);}};}function respondWithFilteredResult(_0x2570b3,_0x295b6e){return function(_0x301c8c){if(_0x301c8c){var _0x5d9cd8=_0x301c8c['count'],_0x17295e=_0x295b6e[_0x30b3('0x15')],_0x5df28d=_0x295b6e['offset']+_0x295b6e[_0x30b3('0x16')],_0x57fd21;if(_0x5df28d>=_0x5d9cd8){_0x5df28d=_0x5d9cd8;_0x57fd21=0xc8;}else{_0x57fd21=0xce;}_0x2570b3['status'](_0x57fd21);return _0x2570b3[_0x30b3('0x17')](_0x30b3('0x18'),_0x17295e+'-'+_0x5df28d+'/'+_0x5d9cd8)['json'](_0x301c8c);}return null;};}function patchUpdates(_0x46e15a){return function(_0x3cfe44){try{jsonpatch[_0x30b3('0x19')](_0x3cfe44,_0x46e15a,!![]);}catch(_0x3cf812){return BPromise[_0x30b3('0x1a')](_0x3cf812);}return _0x3cfe44[_0x30b3('0x1b')]();};}function saveUpdates(_0x483889,_0x1fd631){return function(_0x4c92cd){if(_0x4c92cd){return _0x4c92cd[_0x30b3('0x1c')](_0x483889)['then'](function(_0x184704){return _0x184704;});}return null;};}function removeEntity(_0x4f98e6,_0x1ad72c){return function(_0x449a6d){if(_0x449a6d){return _0x449a6d[_0x30b3('0x1d')]()[_0x30b3('0x1e')](function(){_0x4f98e6[_0x30b3('0x13')](0xcc)[_0x30b3('0x1f')]();});}};}function handleEntityNotFound(_0x5910c1,_0x1040b6){return function(_0x370d9a){if(!_0x370d9a){_0x5910c1[_0x30b3('0x20')](0x194);}return _0x370d9a;};}function handleError(_0x16dece,_0x141639){_0x141639=_0x141639||0x1f4;return function(_0x2e1dea){logger['error'](_0x2e1dea[_0x30b3('0x21')]);if(_0x2e1dea[_0x30b3('0x22')]){delete _0x2e1dea['name'];}_0x16dece['status'](_0x141639)[_0x30b3('0x23')](_0x2e1dea);};}exports[_0x30b3('0x24')]=function(_0x117dae,_0x2de953){var _0x1ebe76={},_0x108da1={},_0x3c12fc={'count':0x0,'rows':[]};var _0x4c9994=db[_0x30b3('0x25')]['rawAttributes'];_0x108da1[_0x30b3('0x26')]=_['keys'](_0x4c9994);var _0x3968fc={'dateStart':_0x117dae[_0x30b3('0x27')][_0x30b3('0x28')],'dateEnd':_0x117dae[_0x30b3('0x27')][_0x30b3('0x29')]};delete _0x117dae['query'][_0x30b3('0x28')];delete _0x117dae[_0x30b3('0x27')][_0x30b3('0x29')];_0x108da1[_0x30b3('0x27')]=_[_0x30b3('0x2a')](_0x117dae[_0x30b3('0x27')]);_0x108da1[_0x30b3('0x2b')]=_[_0x30b3('0x2c')](_0x108da1[_0x30b3('0x26')],_0x108da1['query']);_0x1ebe76[_0x30b3('0x2d')]=_[_0x30b3('0x2c')](_0x108da1[_0x30b3('0x26')],qs['fields'](_0x117dae[_0x30b3('0x27')][_0x30b3('0x2e')]));_0x1ebe76['attributes']=_0x1ebe76[_0x30b3('0x2d')][_0x30b3('0x2f')]?_0x1ebe76['attributes']:_0x108da1[_0x30b3('0x26')];if(!_0x117dae[_0x30b3('0x27')][_0x30b3('0x30')]('nolimit')){_0x1ebe76[_0x30b3('0x16')]=qs['limit'](_0x117dae[_0x30b3('0x27')][_0x30b3('0x16')]);_0x1ebe76[_0x30b3('0x15')]=qs[_0x30b3('0x15')](_0x117dae[_0x30b3('0x27')][_0x30b3('0x15')]);}_0x1ebe76[_0x30b3('0x31')]=qs[_0x30b3('0x32')](_0x117dae['query']['sort']);_0x1ebe76['where']=qs[_0x30b3('0x2b')](_['pick'](_0x117dae[_0x30b3('0x27')],_0x108da1[_0x30b3('0x2b')]));if(_0x3968fc[_0x30b3('0x28')]){if(_0x3968fc[_0x30b3('0x29')]){_0x3968fc[_0x30b3('0x29')]=moment(_0x3968fc[_0x30b3('0x29')])['add'](0x1,_0x30b3('0x33'));}else{_0x3968fc['dateEnd']=moment(_0x3968fc['dateStart'])[_0x30b3('0x34')](0x1,_0x30b3('0x33'));}_[_0x30b3('0x35')](_0x1ebe76[_0x30b3('0x36')],{'createdAt':{'$gte':_0x3968fc[_0x30b3('0x28')],'$lte':_0x3968fc['dateEnd']}});}if(_0x117dae[_0x30b3('0x27')][_0x30b3('0x37')]){_0x1ebe76['where']=_['merge'](_0x1ebe76[_0x30b3('0x36')],{'$or':_[_0x30b3('0x38')](_0x1ebe76['attributes'],function(_0x27222f){var _0x50710b={};_0x50710b[_0x27222f]={'$like':'%'+_0x117dae['query']['filter']+'%'};return _0x50710b;})});}_0x1ebe76=_[_0x30b3('0x35')]({},_0x1ebe76,_0x117dae[_0x30b3('0x39')]);var _0x3af65d={'where':_0x1ebe76[_0x30b3('0x36')]};return db['ZendeskField'][_0x30b3('0x3a')](_0x3af65d)[_0x30b3('0x1e')](function(_0x2af6ba){_0x3c12fc[_0x30b3('0x3a')]=_0x2af6ba;if(_0x117dae['query']['includeAll']){_0x1ebe76[_0x30b3('0x3b')]=[{'all':!![]}];}return db[_0x30b3('0x25')][_0x30b3('0x3c')](_0x1ebe76);})['then'](function(_0x4916eb){_0x3c12fc[_0x30b3('0x3d')]=_0x4916eb;return _0x3c12fc;})[_0x30b3('0x1e')](respondWithFilteredResult(_0x2de953,_0x1ebe76))[_0x30b3('0x3e')](handleError(_0x2de953,null));};exports['show']=function(_0x5a45e4,_0x24bc09){var _0x54a310={'raw':!![],'where':{'id':_0x5a45e4[_0x30b3('0x3f')]['id']}},_0x1da17d={};_0x1da17d[_0x30b3('0x26')]=_[_0x30b3('0x2a')](db[_0x30b3('0x25')][_0x30b3('0x40')]);_0x1da17d['query']=_[_0x30b3('0x2a')](_0x5a45e4[_0x30b3('0x27')]);_0x1da17d[_0x30b3('0x2b')]=_[_0x30b3('0x2c')](_0x1da17d['model'],_0x1da17d[_0x30b3('0x27')]);_0x54a310[_0x30b3('0x2d')]=_[_0x30b3('0x2c')](_0x1da17d['model'],qs[_0x30b3('0x2e')](_0x5a45e4[_0x30b3('0x27')]['fields']));_0x54a310['attributes']=_0x54a310[_0x30b3('0x2d')][_0x30b3('0x2f')]?_0x54a310[_0x30b3('0x2d')]:_0x1da17d['model'];if(_0x5a45e4[_0x30b3('0x27')][_0x30b3('0x41')]){_0x54a310[_0x30b3('0x3b')]=[{'all':!![]}];}_0x54a310=_[_0x30b3('0x35')]({},_0x54a310,_0x5a45e4[_0x30b3('0x39')]);return db[_0x30b3('0x25')]['find'](_0x54a310)[_0x30b3('0x1e')](handleEntityNotFound(_0x24bc09,null))['then'](respondWithResult(_0x24bc09,null))['catch'](handleError(_0x24bc09,null));};exports[_0x30b3('0x42')]=function(_0x4a6ea2,_0x44f775){return db[_0x30b3('0x25')]['create'](_0x4a6ea2[_0x30b3('0x43')],{})[_0x30b3('0x1e')](respondWithResult(_0x44f775,0xc9))[_0x30b3('0x3e')](handleError(_0x44f775,null));};exports[_0x30b3('0x1c')]=function(_0x2287f6,_0x1597cc){if(_0x2287f6[_0x30b3('0x43')]['id']){delete _0x2287f6[_0x30b3('0x43')]['id'];}return db[_0x30b3('0x25')][_0x30b3('0x44')]({'where':{'id':_0x2287f6[_0x30b3('0x3f')]['id']}})[_0x30b3('0x1e')](handleEntityNotFound(_0x1597cc,null))[_0x30b3('0x1e')](saveUpdates(_0x2287f6[_0x30b3('0x43')],null))['then'](respondWithResult(_0x1597cc,null))['catch'](handleError(_0x1597cc,null));};exports[_0x30b3('0x1d')]=function(_0x188a52,_0x596a28){return db[_0x30b3('0x25')][_0x30b3('0x44')]({'where':{'id':_0x188a52['params']['id']}})['then'](handleEntityNotFound(_0x596a28,null))[_0x30b3('0x1e')](removeEntity(_0x596a28,null))[_0x30b3('0x3e')](handleError(_0x596a28,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 0aba48f..e6a138f 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 _0x3a75=['request-promise','define','ZendeskField','int_zendesk_fields','lodash','util','../../config/logger','api','moment'];(function(_0x3e6f59,_0x52cd35){var _0x129546=function(_0x520980){while(--_0x520980){_0x3e6f59['push'](_0x3e6f59['shift']());}};_0x129546(++_0x52cd35);}(_0x3a75,0x187));var _0x53a7=function(_0x3dda24,_0x3f8849){_0x3dda24=_0x3dda24-0x0;var _0x17faa5=_0x3a75[_0x3dda24];return _0x17faa5;};'use strict';var _=require(_0x53a7('0x0'));var util=require(_0x53a7('0x1'));var logger=require(_0x53a7('0x2'))(_0x53a7('0x3'));var moment=require(_0x53a7('0x4'));var BPromise=require('bluebird');var rp=require(_0x53a7('0x5'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x4bf415,_0x374da0){return _0x4bf415[_0x53a7('0x6')](_0x53a7('0x7'),attributes,{'tableName':_0x53a7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e15=['define','ZendeskField','int_zendesk_fields','lodash','util','../../config/logger','api','moment','request-promise','./intZendeskField.attributes','exports'];(function(_0x4a45b4,_0x59804f){var _0x1a99c9=function(_0x3aa517){while(--_0x3aa517){_0x4a45b4['push'](_0x4a45b4['shift']());}};_0x1a99c9(++_0x59804f);}(_0x8e15,0xa8));var _0x58e1=function(_0x28de32,_0x242d8b){_0x28de32=_0x28de32-0x0;var _0x5ec7a8=_0x8e15[_0x28de32];return _0x5ec7a8;};'use strict';var _=require(_0x58e1('0x0'));var util=require(_0x58e1('0x1'));var logger=require(_0x58e1('0x2'))(_0x58e1('0x3'));var moment=require(_0x58e1('0x4'));var BPromise=require('bluebird');var rp=require(_0x58e1('0x5'));var attributes=require(_0x58e1('0x6'));module[_0x58e1('0x7')]=function(_0x4a6364,_0x1fbd91){return _0x4a6364[_0x58e1('0x8')](_0x58e1('0x9'),attributes,{'tableName':_0x58e1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 1e232c0..3049c87 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 _0x6f2f=['lodash','util','ioredis','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','code','error','ZendeskField,\x20%s,\x20%s','message','result','catch'];(function(_0x1f9f5f,_0x509fb7){var _0x51d649=function(_0x4a5285){while(--_0x4a5285){_0x1f9f5f['push'](_0x1f9f5f['shift']());}};_0x51d649(++_0x509fb7);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x6f2f[_0x599e60];return _0x468e19;};'use strict';var _=require(_0xf6f2('0x0'));var util=require(_0xf6f2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf6f2('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf6f2('0x3'))(_0xf6f2('0x4'));var config=require(_0xf6f2('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf6f2('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1c94ad,_0x26cd28,_0x774922){return new BPromise(function(_0x15a71c,_0x1873c8){return client[_0xf6f2('0x7')](_0x1c94ad,_0x774922)[_0xf6f2('0x8')](function(_0x294a85){logger[_0xf6f2('0x9')]('ZendeskField,\x20%s,\x20%s',_0x26cd28,_0xf6f2('0xa'));logger[_0xf6f2('0xb')](_0xf6f2('0xc'),_0x26cd28,_0xf6f2('0xa'),JSON['stringify'](_0x294a85));if(_0x294a85['error']){if(_0x294a85['error'][_0xf6f2('0xd')]===0x1f4){logger[_0xf6f2('0xe')](_0xf6f2('0xf'),_0x26cd28,_0x294a85[_0xf6f2('0xe')][_0xf6f2('0x10')]);return _0x1873c8(_0x294a85[_0xf6f2('0xe')]['message']);}logger[_0xf6f2('0xe')](_0xf6f2('0xf'),_0x26cd28,_0x294a85[_0xf6f2('0xe')][_0xf6f2('0x10')]);return _0x15a71c(_0x294a85[_0xf6f2('0xe')]['message']);}else{logger[_0xf6f2('0x9')](_0xf6f2('0xf'),_0x26cd28,_0xf6f2('0xa'));_0x15a71c(_0x294a85[_0xf6f2('0x11')][_0xf6f2('0x10')]);}})[_0xf6f2('0x12')](function(_0x17dec3){logger[_0xf6f2('0xe')](_0xf6f2('0xf'),_0x26cd28,_0x17dec3);_0x1873c8(_0x17dec3);});});} \ No newline at end of file +var _0xbfcc=['ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','request','info'];(function(_0x1e0e97,_0x378507){var _0x2ce2d8=function(_0x52a3c7){while(--_0x52a3c7){_0x1e0e97['push'](_0x1e0e97['shift']());}};_0x2ce2d8(++_0x378507);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x264545,_0x214037){_0x264545=_0x264545-0x0;var _0x114d10=_0xbfcc[_0x264545];return _0x114d10;};'use strict';var _=require(_0xcbfc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcbfc('0x1'));var rs=require(_0xcbfc('0x2'));var fs=require('fs');var Redis=require(_0xcbfc('0x3'));var db=require(_0xcbfc('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xcbfc('0x5'));var client=jayson[_0xcbfc('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b3917,_0x5a2be0,_0x2ea130){return new BPromise(function(_0x1f8b71,_0x1b1377){return client[_0xcbfc('0x7')](_0x1b3917,_0x2ea130)['then'](function(_0x2e7097){logger[_0xcbfc('0x8')](_0xcbfc('0x9'),_0x5a2be0,_0xcbfc('0xa'));logger[_0xcbfc('0xb')](_0xcbfc('0xc'),_0x5a2be0,'request\x20sent',JSON[_0xcbfc('0xd')](_0x2e7097));if(_0x2e7097[_0xcbfc('0xe')]){if(_0x2e7097[_0xcbfc('0xe')][_0xcbfc('0xf')]===0x1f4){logger[_0xcbfc('0xe')]('ZendeskField,\x20%s,\x20%s',_0x5a2be0,_0x2e7097[_0xcbfc('0xe')][_0xcbfc('0x10')]);return _0x1b1377(_0x2e7097[_0xcbfc('0xe')]['message']);}logger[_0xcbfc('0xe')](_0xcbfc('0x9'),_0x5a2be0,_0x2e7097[_0xcbfc('0xe')][_0xcbfc('0x10')]);return _0x1f8b71(_0x2e7097[_0xcbfc('0xe')]['message']);}else{logger[_0xcbfc('0x8')](_0xcbfc('0x9'),_0x5a2be0,_0xcbfc('0xa'));_0x1f8b71(_0x2e7097[_0xcbfc('0x11')]['message']);}})['catch'](function(_0x418f18){logger[_0xcbfc('0xe')](_0xcbfc('0x9'),_0x5a2be0,_0x418f18);_0x1b1377(_0x418f18);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 4c1d4c1..756c236 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 _0xbaf0=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated'];(function(_0x170cbb,_0x9093e){var _0x39fae4=function(_0x120b6b){while(--_0x120b6b){_0x170cbb['push'](_0x170cbb['shift']());}};_0x39fae4(++_0x9093e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x11')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller['addConfiguration']);router['put'](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x13')]);router[_0x0baf('0x14')]('/:id',auth[_0x0baf('0x9')](),controller['destroy']);module[_0x0baf('0x15')]=router; \ No newline at end of file +var _0xd7d1=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','delete','exports','multer','util'];(function(_0x532634,_0x1963fa){var _0x4bc53f=function(_0x556801){while(--_0x556801){_0x532634['push'](_0x532634['shift']());}};_0x4bc53f(++_0x1963fa);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0xb5b9b8,_0x170d51){_0xb5b9b8=_0xb5b9b8-0x0;var _0x25b820=_0xd7d1[_0xb5b9b8];return _0x25b820;};'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('0xa')](_0x1d7d('0x11'),auth[_0x1d7d('0xb')](),controller[_0x1d7d('0x12')]);router['post']('/',auth[_0x1d7d('0xb')](),controller['create']);router[_0x1d7d('0x13')](_0x1d7d('0xf'),auth[_0x1d7d('0xb')](),controller[_0x1d7d('0x14')]);router['put'](_0x1d7d('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x1d7d('0x15')](_0x1d7d('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x1d7d('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index cb21848..251fcae 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 _0x10a5=['exports','STRING','sequelize'];(function(_0x51b0dc,_0x5307b7){var _0x13fa89=function(_0x2c880f){while(--_0x2c880f){_0x51b0dc['push'](_0x51b0dc['shift']());}};_0x13fa89(++_0x5307b7);}(_0x10a5,0x9e));var _0x510a=function(_0x174a72,_0x46034c){_0x174a72=_0x174a72-0x0;var _0x32cecd=_0x10a5[_0x174a72];return _0x32cecd;};'use strict';var Sequelize=require(_0x510a('0x0'));module[_0x510a('0x1')]={'name':{'type':Sequelize[_0x510a('0x2')]},'description':{'type':Sequelize[_0x510a('0x2')]},'authToken':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x510a('0x2')]},'serverUrl':{'type':Sequelize[_0x510a('0x2')]}}; \ No newline at end of file +var _0x7eef=['STRING','sequelize','exports'];(function(_0x4a4ca4,_0x5445df){var _0x294767=function(_0x42a036){while(--_0x42a036){_0x4a4ca4['push'](_0x4a4ca4['shift']());}};_0x294767(++_0x5445df);}(_0x7eef,0x1e1));var _0xf7ee=function(_0x372515,_0xdd11f){_0x372515=_0x372515-0x0;var _0xa3bf4e=_0x7eef[_0x372515];return _0xa3bf4e;};'use strict';var Sequelize=require(_0xf7ee('0x0'));module[_0xf7ee('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xf7ee('0x2')]},'host':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xf7ee('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 301f93f..78c5873 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 _0x2a59=['include','options','find','create','body','findOne','ZohoConfiguration','pick','filter','map','getConfigurations','nolimit','AccountId','Subjects','getSubjects','channel','type','Descriptions','ZohoField','getFields','host','format','https://crm.%s/crm/private/json/Calls/getFields','authToken','crmapi','response','Calls','section','Call\x20Purpose','push','label','customfield','val','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','jayson/promise','client','http','request','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','message','info','catch','status','end','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','ZohoAccount','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','add','day','merge','count','includeAll','findAll','rows','params','rawAttributes','length'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2a59,0x1e5));var _0x92a5=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x2a59[_0x2ec461];return _0x28603d;};'use strict';var pdf=require(_0x92a5('0x0'));var emlformat=require(_0x92a5('0x1'));var rimraf=require(_0x92a5('0x2'));var zipdir=require(_0x92a5('0x3'));var jsonpatch=require(_0x92a5('0x4'));var rp=require(_0x92a5('0x5'));var moment=require('moment');var BPromise=require(_0x92a5('0x6'));var Mustache=require(_0x92a5('0x7'));var util=require(_0x92a5('0x8'));var path=require('path');var sox=require(_0x92a5('0x9'));var csv=require(_0x92a5('0xa'));var ejs=require(_0x92a5('0xb'));var fs=require('fs');var _=require(_0x92a5('0xc'));var squel=require(_0x92a5('0xd'));var crypto=require(_0x92a5('0xe'));var jsforce=require(_0x92a5('0xf'));var deskjs=require(_0x92a5('0x10'));var toCsv=require(_0x92a5('0xa'));var querystring=require(_0x92a5('0x11'));var Papa=require(_0x92a5('0x12'));var Redis=require(_0x92a5('0x13'));var qs=require(_0x92a5('0x14'));var logger=require(_0x92a5('0x15'))(_0x92a5('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x92a5('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x92a5('0x18'));var client=jayson[_0x92a5('0x19')][_0x92a5('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x2c405b,_0x4ff4d0,_0x209882,_0x34b04e){return new BPromise(function(_0x22792f,_0x3de88f){var _0x32d4d9=_0x34b04e||client;return _0x32d4d9[_0x92a5('0x1b')](_0x2c405b,_0x209882)['then'](function(_0x30b682){logger['info'](_0x92a5('0x1c'),_0x4ff4d0,_0x92a5('0x1d'));logger[_0x92a5('0x1e')](_0x92a5('0x1f'),_0x4ff4d0,_0x92a5('0x1d'),JSON['stringify'](_0x30b682));if(_0x30b682[_0x92a5('0x20')]){if(_0x30b682['error']['code']===0x1f4){logger[_0x92a5('0x20')](_0x92a5('0x1c'),_0x4ff4d0,_0x30b682['error']['message']);return _0x3de88f(_0x30b682[_0x92a5('0x20')][_0x92a5('0x21')]);}logger['error'](_0x92a5('0x1c'),_0x4ff4d0,_0x30b682[_0x92a5('0x20')][_0x92a5('0x21')]);return _0x22792f(_0x30b682['error'][_0x92a5('0x21')]);}else{logger[_0x92a5('0x22')]('ZohoAccount,\x20%s,\x20%s',_0x4ff4d0,'request\x20sent');_0x22792f(_0x30b682['result'][_0x92a5('0x21')]);}})[_0x92a5('0x23')](function(_0x402e0e){logger[_0x92a5('0x20')](_0x92a5('0x1c'),_0x4ff4d0,_0x402e0e);_0x3de88f(_0x402e0e);});});}function respondWithStatusCode(_0x1ef687,_0x303787){_0x303787=_0x303787||0xcc;return function(_0x52f12e){if(_0x52f12e){return _0x1ef687['sendStatus'](_0x303787);}return _0x1ef687[_0x92a5('0x24')](_0x303787)[_0x92a5('0x25')]();};}function respondWithResult(_0x4d7530,_0x4a8014){_0x4a8014=_0x4a8014||0xc8;return function(_0xeb68a0){if(_0xeb68a0){return _0x4d7530[_0x92a5('0x24')](_0x4a8014)['json'](_0xeb68a0);}};}function respondWithFilteredResult(_0x5b120f,_0xbbe9f4){return function(_0x3c4bd0){if(_0x3c4bd0){var _0x1a11b9=_0x3c4bd0['count'],_0x531d06=_0xbbe9f4[_0x92a5('0x26')],_0x44da6e=_0xbbe9f4[_0x92a5('0x26')]+_0xbbe9f4[_0x92a5('0x27')],_0x3645ba;if(_0x44da6e>=_0x1a11b9){_0x44da6e=_0x1a11b9;_0x3645ba=0xc8;}else{_0x3645ba=0xce;}_0x5b120f[_0x92a5('0x24')](_0x3645ba);return _0x5b120f[_0x92a5('0x28')](_0x92a5('0x29'),_0x531d06+'-'+_0x44da6e+'/'+_0x1a11b9)['json'](_0x3c4bd0);}return null;};}function patchUpdates(_0x49d292){return function(_0x193e80){try{jsonpatch[_0x92a5('0x2a')](_0x193e80,_0x49d292,!![]);}catch(_0x3eab67){return BPromise['reject'](_0x3eab67);}return _0x193e80[_0x92a5('0x2b')]();};}function saveUpdates(_0x440e13,_0x201842){return function(_0x17a850){if(_0x17a850){return _0x17a850[_0x92a5('0x2c')](_0x440e13)[_0x92a5('0x2d')](function(_0x2d0ef0){return _0x2d0ef0;});}return null;};}function removeEntity(_0x326ddf,_0x209ac7){return function(_0x48c111){if(_0x48c111){return _0x48c111[_0x92a5('0x2e')]()[_0x92a5('0x2d')](function(){_0x326ddf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x54f90d,_0x524131){return function(_0x42000e){if(!_0x42000e){_0x54f90d['sendStatus'](0x194);}return _0x42000e;};}function handleError(_0x581d3a,_0x310fab){_0x310fab=_0x310fab||0x1f4;return function(_0x2f68fd){logger[_0x92a5('0x20')](_0x2f68fd[_0x92a5('0x2f')]);if(_0x2f68fd['name']){delete _0x2f68fd[_0x92a5('0x30')];}_0x581d3a['status'](_0x310fab)[_0x92a5('0x31')](_0x2f68fd);};}exports[_0x92a5('0x32')]=function(_0x4b7d73,_0x4f57e6){var _0x5b7481={},_0x3a9d12={},_0x5e0bfc={'count':0x0,'rows':[]};var _0x51e108=db[_0x92a5('0x33')]['rawAttributes'];_0x3a9d12[_0x92a5('0x34')]=_[_0x92a5('0x35')](_0x51e108);var _0x588d58={'dateStart':_0x4b7d73[_0x92a5('0x36')][_0x92a5('0x37')],'dateEnd':_0x4b7d73[_0x92a5('0x36')][_0x92a5('0x38')]};delete _0x4b7d73['query'][_0x92a5('0x37')];delete _0x4b7d73[_0x92a5('0x36')][_0x92a5('0x38')];_0x3a9d12[_0x92a5('0x36')]=_[_0x92a5('0x35')](_0x4b7d73[_0x92a5('0x36')]);_0x3a9d12[_0x92a5('0x39')]=_[_0x92a5('0x3a')](_0x3a9d12[_0x92a5('0x34')],_0x3a9d12[_0x92a5('0x36')]);_0x5b7481[_0x92a5('0x3b')]=_[_0x92a5('0x3a')](_0x3a9d12['model'],qs[_0x92a5('0x3c')](_0x4b7d73['query']['fields']));_0x5b7481[_0x92a5('0x3b')]=_0x5b7481[_0x92a5('0x3b')]['length']?_0x5b7481['attributes']:_0x3a9d12[_0x92a5('0x34')];if(!_0x4b7d73[_0x92a5('0x36')][_0x92a5('0x3d')]('nolimit')){_0x5b7481[_0x92a5('0x27')]=qs['limit'](_0x4b7d73[_0x92a5('0x36')][_0x92a5('0x27')]);_0x5b7481['offset']=qs['offset'](_0x4b7d73['query'][_0x92a5('0x26')]);}_0x5b7481[_0x92a5('0x3e')]=qs[_0x92a5('0x3f')](_0x4b7d73['query'][_0x92a5('0x3f')]);_0x5b7481[_0x92a5('0x40')]=qs[_0x92a5('0x39')](_['pick'](_0x4b7d73[_0x92a5('0x36')],_0x3a9d12['filters']));if(_0x588d58[_0x92a5('0x37')]){if(_0x588d58[_0x92a5('0x38')]){_0x588d58[_0x92a5('0x38')]=moment(_0x588d58[_0x92a5('0x38')])[_0x92a5('0x41')](0x1,_0x92a5('0x42'));}else{_0x588d58[_0x92a5('0x38')]=moment(_0x588d58[_0x92a5('0x37')])[_0x92a5('0x41')](0x1,'day');}_[_0x92a5('0x43')](_0x5b7481[_0x92a5('0x40')],{'createdAt':{'$gte':_0x588d58[_0x92a5('0x37')],'$lte':_0x588d58[_0x92a5('0x38')]}});}if(_0x4b7d73[_0x92a5('0x36')]['filter']){_0x5b7481[_0x92a5('0x40')]=_['merge'](_0x5b7481['where'],{'$or':_['map'](_0x5b7481[_0x92a5('0x3b')],function(_0x15e036){var _0x518147={};_0x518147[_0x15e036]={'$like':'%'+_0x4b7d73[_0x92a5('0x36')]['filter']+'%'};return _0x518147;})});}_0x5b7481=_[_0x92a5('0x43')]({},_0x5b7481,_0x4b7d73['options']);var _0x5d2ae5={'where':_0x5b7481[_0x92a5('0x40')]};return db[_0x92a5('0x33')][_0x92a5('0x44')](_0x5d2ae5)[_0x92a5('0x2d')](function(_0x2b3411){_0x5e0bfc['count']=_0x2b3411;if(_0x4b7d73[_0x92a5('0x36')][_0x92a5('0x45')]){_0x5b7481['include']=[{'all':!![]}];}return db[_0x92a5('0x33')][_0x92a5('0x46')](_0x5b7481);})[_0x92a5('0x2d')](function(_0x3ea142){_0x5e0bfc[_0x92a5('0x47')]=_0x3ea142;return _0x5e0bfc;})[_0x92a5('0x2d')](respondWithFilteredResult(_0x4f57e6,_0x5b7481))[_0x92a5('0x23')](handleError(_0x4f57e6,null));};exports['show']=function(_0x3c43f6,_0x2a4a3f){var _0xf8dad2={'raw':![],'where':{'id':_0x3c43f6[_0x92a5('0x48')]['id']}},_0xcf58a1={};_0xcf58a1[_0x92a5('0x34')]=_[_0x92a5('0x35')](db[_0x92a5('0x33')][_0x92a5('0x49')]);_0xcf58a1[_0x92a5('0x36')]=_[_0x92a5('0x35')](_0x3c43f6[_0x92a5('0x36')]);_0xcf58a1[_0x92a5('0x39')]=_[_0x92a5('0x3a')](_0xcf58a1[_0x92a5('0x34')],_0xcf58a1[_0x92a5('0x36')]);_0xf8dad2[_0x92a5('0x3b')]=_[_0x92a5('0x3a')](_0xcf58a1[_0x92a5('0x34')],qs[_0x92a5('0x3c')](_0x3c43f6[_0x92a5('0x36')][_0x92a5('0x3c')]));_0xf8dad2[_0x92a5('0x3b')]=_0xf8dad2[_0x92a5('0x3b')][_0x92a5('0x4a')]?_0xf8dad2[_0x92a5('0x3b')]:_0xcf58a1[_0x92a5('0x34')];if(_0x3c43f6[_0x92a5('0x36')]['includeAll']){_0xf8dad2[_0x92a5('0x4b')]=[{'all':!![]}];}_0xf8dad2=_[_0x92a5('0x43')]({},_0xf8dad2,_0x3c43f6[_0x92a5('0x4c')]);return db[_0x92a5('0x33')][_0x92a5('0x4d')](_0xf8dad2)[_0x92a5('0x2d')](handleEntityNotFound(_0x2a4a3f,null))[_0x92a5('0x2d')](respondWithResult(_0x2a4a3f,null))['catch'](handleError(_0x2a4a3f,null));};exports['create']=function(_0x3d99ed,_0x672856){return db[_0x92a5('0x33')][_0x92a5('0x4e')](_0x3d99ed[_0x92a5('0x4f')],{})[_0x92a5('0x2d')](respondWithResult(_0x672856,0xc9))[_0x92a5('0x23')](handleError(_0x672856,null));};exports[_0x92a5('0x2c')]=function(_0x2b8f6d,_0x2cee86){if(_0x2b8f6d['body']['id']){delete _0x2b8f6d['body']['id'];}return db[_0x92a5('0x33')][_0x92a5('0x4d')]({'where':{'id':_0x2b8f6d[_0x92a5('0x48')]['id']}})['then'](handleEntityNotFound(_0x2cee86,null))[_0x92a5('0x2d')](saveUpdates(_0x2b8f6d[_0x92a5('0x4f')],null))[_0x92a5('0x2d')](respondWithResult(_0x2cee86,null))[_0x92a5('0x23')](handleError(_0x2cee86,null));};exports['destroy']=function(_0x38fed5,_0x10318b){return db[_0x92a5('0x33')][_0x92a5('0x4d')]({'where':{'id':_0x38fed5[_0x92a5('0x48')]['id']}})[_0x92a5('0x2d')](handleEntityNotFound(_0x10318b,null))['then'](removeEntity(_0x10318b,null))[_0x92a5('0x23')](handleError(_0x10318b,null));};exports['getConfigurations']=function(_0x33673d,_0xe8111d,_0x3192c6){var _0xcb89a7={};var _0x743d18={};var _0x440bd2;var _0x334613;return db[_0x92a5('0x33')][_0x92a5('0x50')]({'where':{'id':_0x33673d[_0x92a5('0x48')]['id']}})[_0x92a5('0x2d')](handleEntityNotFound(_0xe8111d,null))[_0x92a5('0x2d')](function(_0x45b655){if(_0x45b655){_0x440bd2=_0x45b655;_0x743d18['model']=_[_0x92a5('0x35')](db[_0x92a5('0x51')][_0x92a5('0x49')]);_0x743d18[_0x92a5('0x36')]=_[_0x92a5('0x35')](_0x33673d[_0x92a5('0x36')]);_0x743d18[_0x92a5('0x39')]=_[_0x92a5('0x3a')](_0x743d18['model'],_0x743d18[_0x92a5('0x36')]);_0xcb89a7[_0x92a5('0x3b')]=_[_0x92a5('0x3a')](_0x743d18[_0x92a5('0x34')],qs[_0x92a5('0x3c')](_0x33673d[_0x92a5('0x36')][_0x92a5('0x3c')]));_0xcb89a7['attributes']=_0xcb89a7[_0x92a5('0x3b')]['length']?_0xcb89a7[_0x92a5('0x3b')]:_0x743d18['model'];_0xcb89a7[_0x92a5('0x3e')]=qs[_0x92a5('0x3f')](_0x33673d[_0x92a5('0x36')][_0x92a5('0x3f')]);_0xcb89a7[_0x92a5('0x40')]=qs[_0x92a5('0x39')](_[_0x92a5('0x52')](_0x33673d[_0x92a5('0x36')],_0x743d18[_0x92a5('0x39')]));if(_0x33673d[_0x92a5('0x36')][_0x92a5('0x53')]){_0xcb89a7[_0x92a5('0x40')]=_['merge'](_0xcb89a7[_0x92a5('0x40')],{'$or':_[_0x92a5('0x54')](_0xcb89a7[_0x92a5('0x3b')],function(_0x8ea8db){var _0x127ca9={};_0x127ca9[_0x8ea8db]={'$like':'%'+_0x33673d[_0x92a5('0x36')][_0x92a5('0x53')]+'%'};return _0x127ca9;})});}_0xcb89a7=_[_0x92a5('0x43')]({},_0xcb89a7,_0x33673d[_0x92a5('0x4c')]);return _0x440bd2[_0x92a5('0x55')](_0xcb89a7);}})[_0x92a5('0x2d')](function(_0x12d4e0){if(_0x12d4e0){_0x334613=_0x12d4e0[_0x92a5('0x4a')];if(!_0x33673d[_0x92a5('0x36')]['hasOwnProperty'](_0x92a5('0x56'))){_0xcb89a7['limit']=qs['limit'](_0x33673d[_0x92a5('0x36')][_0x92a5('0x27')]);_0xcb89a7[_0x92a5('0x26')]=qs[_0x92a5('0x26')](_0x33673d['query'][_0x92a5('0x26')]);}return _0x440bd2['getConfigurations'](_0xcb89a7);}})[_0x92a5('0x2d')](function(_0x2018f1){if(_0x2018f1){return _0x2018f1?{'count':_0x334613,'rows':_0x2018f1}:null;}})[_0x92a5('0x2d')](respondWithResult(_0xe8111d,null))[_0x92a5('0x23')](handleError(_0xe8111d,null));};exports['addConfiguration']=function(_0x115862,_0x43e786,_0x51fc65){if(_0x115862['body']['id']){delete _0x115862[_0x92a5('0x4f')]['id'];}return db[_0x92a5('0x33')][_0x92a5('0x50')]({'where':{'id':_0x115862['params']['id']}})[_0x92a5('0x2d')](handleEntityNotFound(_0x43e786,null))[_0x92a5('0x2d')](function(_0x441189){if(_0x441189){_0x115862[_0x92a5('0x4f')][_0x92a5('0x57')]=_0x441189['id'];_0x115862[_0x92a5('0x4f')][_0x92a5('0x58')]=integrations[_0x92a5('0x59')](_0x115862[_0x92a5('0x4f')][_0x92a5('0x5a')],_0x115862[_0x92a5('0x4f')][_0x92a5('0x5b')]);_0x115862[_0x92a5('0x4f')][_0x92a5('0x5c')]=integrations['getDescriptions'](_0x115862[_0x92a5('0x4f')]['channel'],_0x115862[_0x92a5('0x4f')][_0x92a5('0x5b')]);return db[_0x92a5('0x51')][_0x92a5('0x4e')](_0x115862[_0x92a5('0x4f')],{'include':[{'model':db[_0x92a5('0x5d')],'as':_0x92a5('0x58')},{'model':db[_0x92a5('0x5d')],'as':_0x92a5('0x5c')}]});}return null;})['then'](respondWithResult(_0x43e786,null))[_0x92a5('0x23')](handleError(_0x43e786,null));};exports[_0x92a5('0x5e')]=function(_0xdb7e14,_0x222d6d,_0xbf4b55){return db[_0x92a5('0x33')][_0x92a5('0x50')]({'where':{'id':_0xdb7e14[_0x92a5('0x48')]['id']},'attributes':['id',_0x92a5('0x5f'),'authToken']})[_0x92a5('0x2d')](handleEntityNotFound(_0x222d6d,null))['then'](function(_0x14576d){if(_0x14576d){return rp({'method':'GET','uri':util[_0x92a5('0x60')](_0x92a5('0x61'),_0x14576d[_0x92a5('0x5f')]),'qs':{'authtoken':_0x14576d[_0x92a5('0x62')],'scope':_0x92a5('0x63')},'json':!![]});}})['then'](function(_0x2f037b){if(_0x2f037b){if(_0x2f037b[_0x92a5('0x64')]&&_0x2f037b[_0x92a5('0x64')]['error']){throw new Error(_0x2f037b[_0x92a5('0x64')]['error'][_0x92a5('0x21')]);}var _0x4649b7=[];if(_0x2f037b[_0x92a5('0x65')]&&_0x2f037b['Calls'][_0x92a5('0x66')]){if(_0x2f037b[_0x92a5('0x65')][_0x92a5('0x66')]['FL']){var _0x19ec0f=[_0x92a5('0x67')];for(var _0x823a88=0x0,_0x252ba1=_0x2f037b['Calls'][_0x92a5('0x66')]['FL'][_0x92a5('0x4a')];_0x823a88<_0x252ba1;_0x823a88++){if(_['includes'](_0x19ec0f,_0x2f037b[_0x92a5('0x65')][_0x92a5('0x66')]['FL'][_0x823a88]['dv'])){_0x4649b7[_0x92a5('0x68')]({'id':_0x2f037b[_0x92a5('0x65')][_0x92a5('0x66')]['FL'][_0x823a88]['dv'],'name':_0x2f037b[_0x92a5('0x65')][_0x92a5('0x66')]['FL'][_0x823a88][_0x92a5('0x69')],'custom':_0x2f037b[_0x92a5('0x65')][_0x92a5('0x66')]['FL'][_0x823a88][_0x92a5('0x6a')]==='true'?!![]:![],'options':_0x2f037b['Calls'][_0x92a5('0x66')]['FL'][_0x823a88][_0x92a5('0x5b')]==='Pick\x20List'&&_0x2f037b[_0x92a5('0x65')][_0x92a5('0x66')]['FL'][_0x823a88]['val']?_[_0x92a5('0x54')](_0x2f037b[_0x92a5('0x65')][_0x92a5('0x66')]['FL'][_0x823a88][_0x92a5('0x6b')],function(_0xe9ff6f){return{'name':_0xe9ff6f,'value':_0xe9ff6f};}):[]});}}}}return{'count':_0x4649b7[_0x92a5('0x4a')],'rows':_0x4649b7};}})[_0x92a5('0x2d')](respondWithResult(_0x222d6d,null))[_0x92a5('0x23')](function(_0x122c37){var _0x4f3d7e=_0xdb7e14[_0x92a5('0x36')]['test']?0x1f4:_0x122c37[_0x92a5('0x6c')]||0x1f4;logger[_0x92a5('0x20')](_0x92a5('0x6d'),_0x92a5('0x5e'),_0x4f3d7e,JSON[_0x92a5('0x6e')](_0x122c37));delete _0x122c37[_0x92a5('0x30')];if(_0x4f3d7e===0x191){_0x4f3d7e=0x190;}_0x222d6d[_0x92a5('0x24')](_0x4f3d7e)[_0x92a5('0x31')](_0xdb7e14[_0x92a5('0x36')]['test']?{'message':_0x92a5('0x6f'),'statusCode':_0x122c37[_0x92a5('0x6c')]}:_0x122c37);});}; \ No newline at end of file +var _0x5b95=['query','dateEnd','keys','model','intersection','fields','attributes','length','nolimit','offset','sort','where','filters','add','day','merge','filter','map','options','includeAll','findAll','rows','params','include','find','create','body','getConfigurations','findOne','pick','hasOwnProperty','addConfiguration','type','getDescriptions','channel','ZohoConfiguration','ZohoField','Subjects','Descriptions','host','authToken','GET','format','https://crm.%s/crm/private/json/Calls/getFields','crmapi','response','Calls','section','Call\x20Purpose','includes','label','customfield','val','test','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','desk.js','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','ZohoAccount,\x20%s,\x20%s','message','catch','status','end','count','limit','set','Content-Range','json','apply','reject','update','destroy','sendStatus','stack','name','send','index','ZohoAccount','rawAttributes','dateStart'];(function(_0x2ac4a3,_0x5e5c66){var _0x330bcc=function(_0x5e2201){while(--_0x5e2201){_0x2ac4a3['push'](_0x2ac4a3['shift']());}};_0x330bcc(++_0x5e5c66);}(_0x5b95,0x186));var _0x55b9=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x5b95[_0x38537f];return _0x141e23;};'use strict';var pdf=require(_0x55b9('0x0'));var emlformat=require(_0x55b9('0x1'));var rimraf=require(_0x55b9('0x2'));var zipdir=require(_0x55b9('0x3'));var jsonpatch=require(_0x55b9('0x4'));var rp=require(_0x55b9('0x5'));var moment=require(_0x55b9('0x6'));var BPromise=require(_0x55b9('0x7'));var Mustache=require(_0x55b9('0x8'));var util=require(_0x55b9('0x9'));var path=require(_0x55b9('0xa'));var sox=require('sox');var csv=require(_0x55b9('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x55b9('0xc'));var squel=require('squel');var crypto=require(_0x55b9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x55b9('0xe'));var toCsv=require(_0x55b9('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x55b9('0xf'));var qs=require(_0x55b9('0x10'));var logger=require('../../config/logger')(_0x55b9('0x11'));var utils=require(_0x55b9('0x12'));var config=require(_0x55b9('0x13'));var db=require(_0x55b9('0x14'))['db'];var integrations=require(_0x55b9('0x15'));var jayson=require(_0x55b9('0x16'));var client=jayson[_0x55b9('0x17')][_0x55b9('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x409be9,_0x2cbab0,_0x3ad137,_0x3bb676){return new BPromise(function(_0x4b3535,_0x53d449){var _0x5ed764=_0x3bb676||client;return _0x5ed764[_0x55b9('0x19')](_0x409be9,_0x3ad137)[_0x55b9('0x1a')](function(_0x59379a){logger[_0x55b9('0x1b')]('ZohoAccount,\x20%s,\x20%s',_0x2cbab0,'request\x20sent');logger[_0x55b9('0x1c')](_0x55b9('0x1d'),_0x2cbab0,_0x55b9('0x1e'),JSON['stringify'](_0x59379a));if(_0x59379a[_0x55b9('0x1f')]){if(_0x59379a[_0x55b9('0x1f')]['code']===0x1f4){logger[_0x55b9('0x1f')](_0x55b9('0x20'),_0x2cbab0,_0x59379a[_0x55b9('0x1f')][_0x55b9('0x21')]);return _0x53d449(_0x59379a[_0x55b9('0x1f')][_0x55b9('0x21')]);}logger[_0x55b9('0x1f')](_0x55b9('0x20'),_0x2cbab0,_0x59379a['error'][_0x55b9('0x21')]);return _0x4b3535(_0x59379a[_0x55b9('0x1f')][_0x55b9('0x21')]);}else{logger['info'](_0x55b9('0x20'),_0x2cbab0,_0x55b9('0x1e'));_0x4b3535(_0x59379a['result'][_0x55b9('0x21')]);}})[_0x55b9('0x22')](function(_0x51b172){logger['error'](_0x55b9('0x20'),_0x2cbab0,_0x51b172);_0x53d449(_0x51b172);});});}function respondWithStatusCode(_0x148a51,_0x2d5204){_0x2d5204=_0x2d5204||0xcc;return function(_0x5b4672){if(_0x5b4672){return _0x148a51['sendStatus'](_0x2d5204);}return _0x148a51[_0x55b9('0x23')](_0x2d5204)[_0x55b9('0x24')]();};}function respondWithResult(_0x55509c,_0x21fccf){_0x21fccf=_0x21fccf||0xc8;return function(_0x293b84){if(_0x293b84){return _0x55509c[_0x55b9('0x23')](_0x21fccf)['json'](_0x293b84);}};}function respondWithFilteredResult(_0x5ec868,_0x39d65b){return function(_0x4ca4dd){if(_0x4ca4dd){var _0x100e15=_0x4ca4dd[_0x55b9('0x25')],_0x44b094=_0x39d65b['offset'],_0x553bd1=_0x39d65b['offset']+_0x39d65b[_0x55b9('0x26')],_0x1ea65f;if(_0x553bd1>=_0x100e15){_0x553bd1=_0x100e15;_0x1ea65f=0xc8;}else{_0x1ea65f=0xce;}_0x5ec868['status'](_0x1ea65f);return _0x5ec868[_0x55b9('0x27')](_0x55b9('0x28'),_0x44b094+'-'+_0x553bd1+'/'+_0x100e15)[_0x55b9('0x29')](_0x4ca4dd);}return null;};}function patchUpdates(_0x21f0f1){return function(_0x45bc18){try{jsonpatch[_0x55b9('0x2a')](_0x45bc18,_0x21f0f1,!![]);}catch(_0x2f3a59){return BPromise[_0x55b9('0x2b')](_0x2f3a59);}return _0x45bc18['save']();};}function saveUpdates(_0x3824b5,_0x51a100){return function(_0x2aab2b){if(_0x2aab2b){return _0x2aab2b[_0x55b9('0x2c')](_0x3824b5)[_0x55b9('0x1a')](function(_0x4302b7){return _0x4302b7;});}return null;};}function removeEntity(_0x178a3d,_0x60d742){return function(_0x26bbb9){if(_0x26bbb9){return _0x26bbb9[_0x55b9('0x2d')]()[_0x55b9('0x1a')](function(){_0x178a3d['status'](0xcc)[_0x55b9('0x24')]();});}};}function handleEntityNotFound(_0x134568,_0x621d90){return function(_0x4c6dd9){if(!_0x4c6dd9){_0x134568[_0x55b9('0x2e')](0x194);}return _0x4c6dd9;};}function handleError(_0x3a1ea3,_0x556d82){_0x556d82=_0x556d82||0x1f4;return function(_0x2c37ca){logger[_0x55b9('0x1f')](_0x2c37ca[_0x55b9('0x2f')]);if(_0x2c37ca[_0x55b9('0x30')]){delete _0x2c37ca[_0x55b9('0x30')];}_0x3a1ea3['status'](_0x556d82)[_0x55b9('0x31')](_0x2c37ca);};}exports[_0x55b9('0x32')]=function(_0x9a4fbf,_0x1e44a2){var _0x4312b8={},_0x16cad7={},_0x4894e5={'count':0x0,'rows':[]};var _0x157449=db[_0x55b9('0x33')][_0x55b9('0x34')];_0x16cad7['model']=_['keys'](_0x157449);var _0x3a3fae={'dateStart':_0x9a4fbf['query'][_0x55b9('0x35')],'dateEnd':_0x9a4fbf[_0x55b9('0x36')][_0x55b9('0x37')]};delete _0x9a4fbf['query'][_0x55b9('0x35')];delete _0x9a4fbf[_0x55b9('0x36')]['dateEnd'];_0x16cad7[_0x55b9('0x36')]=_[_0x55b9('0x38')](_0x9a4fbf[_0x55b9('0x36')]);_0x16cad7['filters']=_['intersection'](_0x16cad7[_0x55b9('0x39')],_0x16cad7[_0x55b9('0x36')]);_0x4312b8['attributes']=_[_0x55b9('0x3a')](_0x16cad7[_0x55b9('0x39')],qs[_0x55b9('0x3b')](_0x9a4fbf['query']['fields']));_0x4312b8['attributes']=_0x4312b8[_0x55b9('0x3c')][_0x55b9('0x3d')]?_0x4312b8[_0x55b9('0x3c')]:_0x16cad7[_0x55b9('0x39')];if(!_0x9a4fbf[_0x55b9('0x36')]['hasOwnProperty'](_0x55b9('0x3e'))){_0x4312b8[_0x55b9('0x26')]=qs[_0x55b9('0x26')](_0x9a4fbf[_0x55b9('0x36')][_0x55b9('0x26')]);_0x4312b8['offset']=qs[_0x55b9('0x3f')](_0x9a4fbf[_0x55b9('0x36')][_0x55b9('0x3f')]);}_0x4312b8['order']=qs[_0x55b9('0x40')](_0x9a4fbf[_0x55b9('0x36')][_0x55b9('0x40')]);_0x4312b8[_0x55b9('0x41')]=qs[_0x55b9('0x42')](_['pick'](_0x9a4fbf['query'],_0x16cad7[_0x55b9('0x42')]));if(_0x3a3fae[_0x55b9('0x35')]){if(_0x3a3fae['dateEnd']){_0x3a3fae[_0x55b9('0x37')]=moment(_0x3a3fae[_0x55b9('0x37')])['add'](0x1,'day');}else{_0x3a3fae[_0x55b9('0x37')]=moment(_0x3a3fae[_0x55b9('0x35')])[_0x55b9('0x43')](0x1,_0x55b9('0x44'));}_[_0x55b9('0x45')](_0x4312b8[_0x55b9('0x41')],{'createdAt':{'$gte':_0x3a3fae[_0x55b9('0x35')],'$lte':_0x3a3fae['dateEnd']}});}if(_0x9a4fbf['query'][_0x55b9('0x46')]){_0x4312b8[_0x55b9('0x41')]=_[_0x55b9('0x45')](_0x4312b8[_0x55b9('0x41')],{'$or':_[_0x55b9('0x47')](_0x4312b8[_0x55b9('0x3c')],function(_0x4a978c){var _0x1cc61c={};_0x1cc61c[_0x4a978c]={'$like':'%'+_0x9a4fbf['query']['filter']+'%'};return _0x1cc61c;})});}_0x4312b8=_[_0x55b9('0x45')]({},_0x4312b8,_0x9a4fbf[_0x55b9('0x48')]);var _0x2b00a6={'where':_0x4312b8[_0x55b9('0x41')]};return db[_0x55b9('0x33')]['count'](_0x2b00a6)[_0x55b9('0x1a')](function(_0x187a2b){_0x4894e5['count']=_0x187a2b;if(_0x9a4fbf[_0x55b9('0x36')][_0x55b9('0x49')]){_0x4312b8['include']=[{'all':!![]}];}return db[_0x55b9('0x33')][_0x55b9('0x4a')](_0x4312b8);})['then'](function(_0x50eaa5){_0x4894e5[_0x55b9('0x4b')]=_0x50eaa5;return _0x4894e5;})[_0x55b9('0x1a')](respondWithFilteredResult(_0x1e44a2,_0x4312b8))[_0x55b9('0x22')](handleError(_0x1e44a2,null));};exports['show']=function(_0x4c8f7e,_0x41a5fd){var _0x208113={'raw':![],'where':{'id':_0x4c8f7e[_0x55b9('0x4c')]['id']}},_0x2d20d0={};_0x2d20d0[_0x55b9('0x39')]=_[_0x55b9('0x38')](db['ZohoAccount'][_0x55b9('0x34')]);_0x2d20d0['query']=_[_0x55b9('0x38')](_0x4c8f7e[_0x55b9('0x36')]);_0x2d20d0[_0x55b9('0x42')]=_['intersection'](_0x2d20d0[_0x55b9('0x39')],_0x2d20d0['query']);_0x208113['attributes']=_[_0x55b9('0x3a')](_0x2d20d0['model'],qs[_0x55b9('0x3b')](_0x4c8f7e['query'][_0x55b9('0x3b')]));_0x208113[_0x55b9('0x3c')]=_0x208113[_0x55b9('0x3c')][_0x55b9('0x3d')]?_0x208113[_0x55b9('0x3c')]:_0x2d20d0[_0x55b9('0x39')];if(_0x4c8f7e[_0x55b9('0x36')]['includeAll']){_0x208113[_0x55b9('0x4d')]=[{'all':!![]}];}_0x208113=_[_0x55b9('0x45')]({},_0x208113,_0x4c8f7e['options']);return db[_0x55b9('0x33')][_0x55b9('0x4e')](_0x208113)[_0x55b9('0x1a')](handleEntityNotFound(_0x41a5fd,null))[_0x55b9('0x1a')](respondWithResult(_0x41a5fd,null))[_0x55b9('0x22')](handleError(_0x41a5fd,null));};exports[_0x55b9('0x4f')]=function(_0xc35db4,_0x5e284c){return db[_0x55b9('0x33')][_0x55b9('0x4f')](_0xc35db4[_0x55b9('0x50')],{})[_0x55b9('0x1a')](respondWithResult(_0x5e284c,0xc9))[_0x55b9('0x22')](handleError(_0x5e284c,null));};exports['update']=function(_0x5e2a8b,_0x2a1e36){if(_0x5e2a8b[_0x55b9('0x50')]['id']){delete _0x5e2a8b[_0x55b9('0x50')]['id'];}return db[_0x55b9('0x33')][_0x55b9('0x4e')]({'where':{'id':_0x5e2a8b[_0x55b9('0x4c')]['id']}})[_0x55b9('0x1a')](handleEntityNotFound(_0x2a1e36,null))[_0x55b9('0x1a')](saveUpdates(_0x5e2a8b['body'],null))[_0x55b9('0x1a')](respondWithResult(_0x2a1e36,null))['catch'](handleError(_0x2a1e36,null));};exports[_0x55b9('0x2d')]=function(_0x51b33e,_0x4143a8){return db[_0x55b9('0x33')]['find']({'where':{'id':_0x51b33e[_0x55b9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4143a8,null))[_0x55b9('0x1a')](removeEntity(_0x4143a8,null))[_0x55b9('0x22')](handleError(_0x4143a8,null));};exports[_0x55b9('0x51')]=function(_0x273076,_0x668491,_0x1f6c50){var _0x91a8aa={};var _0x1d3a50={};var _0x26cc6c;var _0x87439e;return db[_0x55b9('0x33')][_0x55b9('0x52')]({'where':{'id':_0x273076[_0x55b9('0x4c')]['id']}})[_0x55b9('0x1a')](handleEntityNotFound(_0x668491,null))[_0x55b9('0x1a')](function(_0x542b75){if(_0x542b75){_0x26cc6c=_0x542b75;_0x1d3a50['model']=_[_0x55b9('0x38')](db['ZohoConfiguration'][_0x55b9('0x34')]);_0x1d3a50[_0x55b9('0x36')]=_[_0x55b9('0x38')](_0x273076['query']);_0x1d3a50[_0x55b9('0x42')]=_['intersection'](_0x1d3a50[_0x55b9('0x39')],_0x1d3a50['query']);_0x91a8aa[_0x55b9('0x3c')]=_[_0x55b9('0x3a')](_0x1d3a50[_0x55b9('0x39')],qs['fields'](_0x273076[_0x55b9('0x36')][_0x55b9('0x3b')]));_0x91a8aa[_0x55b9('0x3c')]=_0x91a8aa[_0x55b9('0x3c')][_0x55b9('0x3d')]?_0x91a8aa[_0x55b9('0x3c')]:_0x1d3a50[_0x55b9('0x39')];_0x91a8aa['order']=qs[_0x55b9('0x40')](_0x273076[_0x55b9('0x36')]['sort']);_0x91a8aa[_0x55b9('0x41')]=qs['filters'](_[_0x55b9('0x53')](_0x273076[_0x55b9('0x36')],_0x1d3a50[_0x55b9('0x42')]));if(_0x273076['query'][_0x55b9('0x46')]){_0x91a8aa[_0x55b9('0x41')]=_[_0x55b9('0x45')](_0x91a8aa['where'],{'$or':_[_0x55b9('0x47')](_0x91a8aa[_0x55b9('0x3c')],function(_0x3a227f){var _0x3f41db={};_0x3f41db[_0x3a227f]={'$like':'%'+_0x273076[_0x55b9('0x36')][_0x55b9('0x46')]+'%'};return _0x3f41db;})});}_0x91a8aa=_[_0x55b9('0x45')]({},_0x91a8aa,_0x273076[_0x55b9('0x48')]);return _0x26cc6c['getConfigurations'](_0x91a8aa);}})[_0x55b9('0x1a')](function(_0x1e893d){if(_0x1e893d){_0x87439e=_0x1e893d[_0x55b9('0x3d')];if(!_0x273076['query'][_0x55b9('0x54')]('nolimit')){_0x91a8aa[_0x55b9('0x26')]=qs[_0x55b9('0x26')](_0x273076[_0x55b9('0x36')]['limit']);_0x91a8aa[_0x55b9('0x3f')]=qs['offset'](_0x273076[_0x55b9('0x36')][_0x55b9('0x3f')]);}return _0x26cc6c[_0x55b9('0x51')](_0x91a8aa);}})[_0x55b9('0x1a')](function(_0x99c891){if(_0x99c891){return _0x99c891?{'count':_0x87439e,'rows':_0x99c891}:null;}})[_0x55b9('0x1a')](respondWithResult(_0x668491,null))[_0x55b9('0x22')](handleError(_0x668491,null));};exports[_0x55b9('0x55')]=function(_0x59c95c,_0x1daefb,_0x38ef86){if(_0x59c95c[_0x55b9('0x50')]['id']){delete _0x59c95c[_0x55b9('0x50')]['id'];}return db[_0x55b9('0x33')][_0x55b9('0x52')]({'where':{'id':_0x59c95c['params']['id']}})[_0x55b9('0x1a')](handleEntityNotFound(_0x1daefb,null))[_0x55b9('0x1a')](function(_0x55390a){if(_0x55390a){_0x59c95c[_0x55b9('0x50')]['AccountId']=_0x55390a['id'];_0x59c95c[_0x55b9('0x50')]['Subjects']=integrations['getSubjects'](_0x59c95c[_0x55b9('0x50')]['channel'],_0x59c95c[_0x55b9('0x50')][_0x55b9('0x56')]);_0x59c95c[_0x55b9('0x50')]['Descriptions']=integrations[_0x55b9('0x57')](_0x59c95c['body'][_0x55b9('0x58')],_0x59c95c[_0x55b9('0x50')][_0x55b9('0x56')]);return db[_0x55b9('0x59')]['create'](_0x59c95c['body'],{'include':[{'model':db[_0x55b9('0x5a')],'as':_0x55b9('0x5b')},{'model':db[_0x55b9('0x5a')],'as':_0x55b9('0x5c')}]});}return null;})[_0x55b9('0x1a')](respondWithResult(_0x1daefb,null))[_0x55b9('0x22')](handleError(_0x1daefb,null));};exports['getFields']=function(_0x494123,_0x49a8d3,_0xa2d062){return db[_0x55b9('0x33')][_0x55b9('0x52')]({'where':{'id':_0x494123['params']['id']},'attributes':['id',_0x55b9('0x5d'),_0x55b9('0x5e')]})['then'](handleEntityNotFound(_0x49a8d3,null))[_0x55b9('0x1a')](function(_0x559e03){if(_0x559e03){return rp({'method':_0x55b9('0x5f'),'uri':util[_0x55b9('0x60')](_0x55b9('0x61'),_0x559e03[_0x55b9('0x5d')]),'qs':{'authtoken':_0x559e03['authToken'],'scope':_0x55b9('0x62')},'json':!![]});}})[_0x55b9('0x1a')](function(_0xbd8ca3){if(_0xbd8ca3){if(_0xbd8ca3['response']&&_0xbd8ca3[_0x55b9('0x63')]['error']){throw new Error(_0xbd8ca3['response'][_0x55b9('0x1f')][_0x55b9('0x21')]);}var _0x313f51=[];if(_0xbd8ca3['Calls']&&_0xbd8ca3[_0x55b9('0x64')][_0x55b9('0x65')]){if(_0xbd8ca3[_0x55b9('0x64')][_0x55b9('0x65')]['FL']){var _0x4b0b45=[_0x55b9('0x66')];for(var _0x543009=0x0,_0x327d2e=_0xbd8ca3[_0x55b9('0x64')][_0x55b9('0x65')]['FL'][_0x55b9('0x3d')];_0x543009<_0x327d2e;_0x543009++){if(_[_0x55b9('0x67')](_0x4b0b45,_0xbd8ca3[_0x55b9('0x64')]['section']['FL'][_0x543009]['dv'])){_0x313f51['push']({'id':_0xbd8ca3['Calls'][_0x55b9('0x65')]['FL'][_0x543009]['dv'],'name':_0xbd8ca3[_0x55b9('0x64')]['section']['FL'][_0x543009][_0x55b9('0x68')],'custom':_0xbd8ca3['Calls'][_0x55b9('0x65')]['FL'][_0x543009][_0x55b9('0x69')]==='true'?!![]:![],'options':_0xbd8ca3[_0x55b9('0x64')][_0x55b9('0x65')]['FL'][_0x543009]['type']==='Pick\x20List'&&_0xbd8ca3[_0x55b9('0x64')][_0x55b9('0x65')]['FL'][_0x543009]['val']?_[_0x55b9('0x47')](_0xbd8ca3[_0x55b9('0x64')]['section']['FL'][_0x543009][_0x55b9('0x6a')],function(_0x3c47b6){return{'name':_0x3c47b6,'value':_0x3c47b6};}):[]});}}}}return{'count':_0x313f51['length'],'rows':_0x313f51};}})[_0x55b9('0x1a')](respondWithResult(_0x49a8d3,null))[_0x55b9('0x22')](function(_0x4ce8d2){var _0x12a5ab=_0x494123['query'][_0x55b9('0x6b')]?0x1f4:_0x4ce8d2['statusCode']||0x1f4;logger['error'](_0x55b9('0x6c'),_0x55b9('0x6d'),_0x12a5ab,JSON['stringify'](_0x4ce8d2));delete _0x4ce8d2[_0x55b9('0x30')];if(_0x12a5ab===0x191){_0x12a5ab=0x190;}_0x49a8d3[_0x55b9('0x23')](_0x12a5ab)['send'](_0x494123['query']['test']?{'message':_0x55b9('0x6e'),'statusCode':_0x4ce8d2['statusCode']}:_0x4ce8d2);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 61e5910..5f5f234 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 _0x2a25=['../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','lodash','api','moment','./intZohoAccount.attributes'];(function(_0x5dc637,_0x563e1b){var _0x34c8fa=function(_0x1094da){while(--_0x1094da){_0x5dc637['push'](_0x5dc637['shift']());}};_0x34c8fa(++_0x563e1b);}(_0x2a25,0x149));var _0x52a2=function(_0x65af11,_0x32a798){_0x65af11=_0x65af11-0x0;var _0x51dc6b=_0x2a25[_0x65af11];return _0x51dc6b;};'use strict';var _=require(_0x52a2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x52a2('0x1'));var moment=require(_0x52a2('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x52a2('0x3'));var integrations=require(_0x52a2('0x4'));module[_0x52a2('0x5')]=function(_0x132463,_0x3f3948){return _0x132463[_0x52a2('0x6')](_0x52a2('0x7'),attributes,{'tableName':_0x52a2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7ca=['moment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','ZohoAccount','../../config/logger'];(function(_0x27431c,_0x5d28a1){var _0x4bd29b=function(_0x3c1685){while(--_0x3c1685){_0x27431c['push'](_0x27431c['shift']());}};_0x4bd29b(++_0x5d28a1);}(_0xc7ca,0x101));var _0xac7c=function(_0x3bd3e4,_0x45f09a){_0x3bd3e4=_0x3bd3e4-0x0;var _0x4c9e53=_0xc7ca[_0x3bd3e4];return _0x4c9e53;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xac7c('0x0'))('api');var moment=require(_0xac7c('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xac7c('0x2'));var integrations=require(_0xac7c('0x3'));module[_0xac7c('0x4')]=function(_0xda0a2,_0x415196){return _0xda0a2['define'](_0xac7c('0x5'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 82605cf..fb2d455 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 _0x88b5=['error','code','message','result','catch','GetZohoAccount','findAll','options','where','attributes','limit','map','model','include','ZohoAccount','raw','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x6a10fa,_0x1712fe){var _0x3b703a=function(_0x47c98d){while(--_0x47c98d){_0x6a10fa['push'](_0x6a10fa['shift']());}};_0x3b703a(++_0x1712fe);}(_0x88b5,0x167));var _0x588b=function(_0x343abc,_0x3cccf9){_0x343abc=_0x343abc-0x0;var _0x2d8620=_0x88b5[_0x343abc];return _0x2d8620;};'use strict';var _=require(_0x588b('0x0'));var util=require(_0x588b('0x1'));var moment=require(_0x588b('0x2'));var BPromise=require(_0x588b('0x3'));var rs=require(_0x588b('0x4'));var fs=require('fs');var Redis=require(_0x588b('0x5'));var db=require(_0x588b('0x6'))['db'];var utils=require(_0x588b('0x7'));var logger=require(_0x588b('0x8'))(_0x588b('0x9'));var config=require(_0x588b('0xa'));var jayson=require(_0x588b('0xb'));var client=jayson[_0x588b('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21d767,_0x25d650,_0x256ee7){return new BPromise(function(_0x2048cb,_0x3aff03){return client[_0x588b('0xd')](_0x21d767,_0x256ee7)[_0x588b('0xe')](function(_0x588bf2){logger[_0x588b('0xf')](_0x588b('0x10'),_0x25d650,_0x588b('0x11'));logger[_0x588b('0x12')](_0x588b('0x13'),_0x25d650,'request\x20sent',JSON[_0x588b('0x14')](_0x588bf2));if(_0x588bf2[_0x588b('0x15')]){if(_0x588bf2['error'][_0x588b('0x16')]===0x1f4){logger[_0x588b('0x15')](_0x588b('0x10'),_0x25d650,_0x588bf2[_0x588b('0x15')][_0x588b('0x17')]);return _0x3aff03(_0x588bf2['error'][_0x588b('0x17')]);}logger[_0x588b('0x15')](_0x588b('0x10'),_0x25d650,_0x588bf2[_0x588b('0x15')][_0x588b('0x17')]);return _0x2048cb(_0x588bf2['error'][_0x588b('0x17')]);}else{logger['info'](_0x588b('0x10'),_0x25d650,_0x588b('0x11'));_0x2048cb(_0x588bf2[_0x588b('0x18')][_0x588b('0x17')]);}})[_0x588b('0x19')](function(_0x4b2da4){logger[_0x588b('0x15')](_0x588b('0x10'),_0x25d650,_0x4b2da4);_0x3aff03(_0x4b2da4);});});}exports[_0x588b('0x1a')]=function(_0x429b9b){var _0x20cd17=this;return new Promise(function(_0x252355,_0x4c35d1){return db['ZohoAccount'][_0x588b('0x1b')]({'raw':_0x429b9b[_0x588b('0x1c')]?_0x429b9b[_0x588b('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x429b9b[_0x588b('0x1c')]?_0x429b9b[_0x588b('0x1c')][_0x588b('0x1d')]||null:null,'attributes':_0x429b9b[_0x588b('0x1c')]?_0x429b9b[_0x588b('0x1c')][_0x588b('0x1e')]||null:null,'limit':_0x429b9b[_0x588b('0x1c')]?_0x429b9b[_0x588b('0x1c')][_0x588b('0x1f')]||null:null,'include':_0x429b9b[_0x588b('0x1c')]?_0x429b9b[_0x588b('0x1c')]['include']?_[_0x588b('0x20')](_0x429b9b['options']['include'],function(_0x5da9c7){return{'model':db[_0x5da9c7[_0x588b('0x21')]],'as':_0x5da9c7['as'],'attributes':_0x5da9c7[_0x588b('0x1e')],'include':_0x5da9c7[_0x588b('0x22')]?_[_0x588b('0x20')](_0x5da9c7['include'],function(_0x2723e1){return{'model':db[_0x2723e1['model']],'as':_0x2723e1['as'],'attributes':_0x2723e1[_0x588b('0x1e')],'include':_0x2723e1[_0x588b('0x22')]?_[_0x588b('0x20')](_0x2723e1['include'],function(_0x230996){return{'model':db[_0x230996[_0x588b('0x21')]],'as':_0x230996['as'],'attributes':_0x230996[_0x588b('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a8787){logger[_0x588b('0xf')](_0x588b('0x1a'),_0x429b9b);logger[_0x588b('0x12')](_0x588b('0x1a'),_0x429b9b,JSON[_0x588b('0x14')](_0x2a8787));_0x252355(_0x2a8787);})[_0x588b('0x19')](function(_0x4506c7){logger[_0x588b('0x15')](_0x588b('0x1a'),_0x4506c7['message'],_0x429b9b);_0x4c35d1(_0x20cd17[_0x588b('0x15')](0x1f4,_0x4506c7['message']));});});};exports['ShowZohoAccount']=function(_0x3331a7){var _0x40ccc6=this;return new Promise(function(_0x253e7a,_0x9c2322){return db[_0x588b('0x23')]['find']({'raw':_0x3331a7['options']?_0x3331a7['options'][_0x588b('0x24')]===undefined?!![]:![]:!![],'where':_0x3331a7['options']?_0x3331a7[_0x588b('0x1c')][_0x588b('0x1d')]||null:null,'attributes':_0x3331a7['options']?_0x3331a7[_0x588b('0x1c')]['attributes']||null:null,'include':_0x3331a7['options']?_0x3331a7['options'][_0x588b('0x22')]?_[_0x588b('0x20')](_0x3331a7[_0x588b('0x1c')][_0x588b('0x22')],function(_0x5361cf){return{'model':db[_0x5361cf[_0x588b('0x21')]],'as':_0x5361cf['as'],'attributes':_0x5361cf[_0x588b('0x1e')],'include':_0x5361cf[_0x588b('0x22')]?_[_0x588b('0x20')](_0x5361cf[_0x588b('0x22')],function(_0x2e5aa7){return{'model':db[_0x2e5aa7[_0x588b('0x21')]],'as':_0x2e5aa7['as'],'attributes':_0x2e5aa7[_0x588b('0x1e')],'include':_0x2e5aa7['include']?_['map'](_0x2e5aa7[_0x588b('0x22')],function(_0x32276e){return{'model':db[_0x32276e[_0x588b('0x21')]],'as':_0x32276e['as'],'attributes':_0x32276e[_0x588b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x588b('0xe')](function(_0x31bcdb){logger[_0x588b('0xf')](_0x588b('0x25'),_0x3331a7);logger[_0x588b('0x12')](_0x588b('0x25'),_0x3331a7,JSON[_0x588b('0x14')](_0x31bcdb));_0x253e7a(_0x31bcdb);})[_0x588b('0x19')](function(_0x470a83){logger[_0x588b('0x15')]('ShowZohoAccount',_0x470a83[_0x588b('0x17')],_0x3331a7);_0x9c2322(_0x40ccc6[_0x588b('0x15')](0x1f4,_0x470a83[_0x588b('0x17')]));});});}; \ No newline at end of file +var _0x498d=['ShowZohoAccount','ZohoAccount','find','raw','where','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','ZohoAccount,\x20%s,\x20%s','message','GetZohoAccount','findAll','options','attributes','limit','include','map','model','catch'];(function(_0x26848a,_0x33a3b4){var _0x236eeb=function(_0x524c3f){while(--_0x524c3f){_0x26848a['push'](_0x26848a['shift']());}};_0x236eeb(++_0x33a3b4);}(_0x498d,0x191));var _0xd498=function(_0x13e300,_0x1bcb41){_0x13e300=_0x13e300-0x0;var _0x5a3eea=_0x498d[_0x13e300];return _0x5a3eea;};'use strict';var _=require('lodash');var util=require(_0xd498('0x0'));var moment=require('moment');var BPromise=require(_0xd498('0x1'));var rs=require(_0xd498('0x2'));var fs=require('fs');var Redis=require(_0xd498('0x3'));var db=require(_0xd498('0x4'))['db'];var utils=require(_0xd498('0x5'));var logger=require('../../config/logger')(_0xd498('0x6'));var config=require(_0xd498('0x7'));var jayson=require(_0xd498('0x8'));var client=jayson[_0xd498('0x9')][_0xd498('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53c78a,_0x9952b4,_0x307747){return new BPromise(function(_0x48aa3e,_0x5cf39e){return client[_0xd498('0xb')](_0x53c78a,_0x307747)[_0xd498('0xc')](function(_0x1365ec){logger[_0xd498('0xd')]('ZohoAccount,\x20%s,\x20%s',_0x9952b4,'request\x20sent');logger[_0xd498('0xe')](_0xd498('0xf'),_0x9952b4,_0xd498('0x10'),JSON[_0xd498('0x11')](_0x1365ec));if(_0x1365ec['error']){if(_0x1365ec['error'][_0xd498('0x12')]===0x1f4){logger[_0xd498('0x13')]('ZohoAccount,\x20%s,\x20%s',_0x9952b4,_0x1365ec[_0xd498('0x13')]['message']);return _0x5cf39e(_0x1365ec['error']['message']);}logger[_0xd498('0x13')](_0xd498('0x14'),_0x9952b4,_0x1365ec[_0xd498('0x13')][_0xd498('0x15')]);return _0x48aa3e(_0x1365ec[_0xd498('0x13')][_0xd498('0x15')]);}else{logger[_0xd498('0xd')](_0xd498('0x14'),_0x9952b4,_0xd498('0x10'));_0x48aa3e(_0x1365ec['result'][_0xd498('0x15')]);}})['catch'](function(_0x598522){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x9952b4,_0x598522);_0x5cf39e(_0x598522);});});}exports[_0xd498('0x16')]=function(_0x6adcdb){var _0x5c7715=this;return new Promise(function(_0x29d8d7,_0x2792e9){return db['ZohoAccount'][_0xd498('0x17')]({'raw':_0x6adcdb[_0xd498('0x18')]?_0x6adcdb['options']['raw']===undefined?!![]:![]:!![],'where':_0x6adcdb['options']?_0x6adcdb[_0xd498('0x18')]['where']||null:null,'attributes':_0x6adcdb['options']?_0x6adcdb['options'][_0xd498('0x19')]||null:null,'limit':_0x6adcdb[_0xd498('0x18')]?_0x6adcdb[_0xd498('0x18')][_0xd498('0x1a')]||null:null,'include':_0x6adcdb[_0xd498('0x18')]?_0x6adcdb[_0xd498('0x18')][_0xd498('0x1b')]?_[_0xd498('0x1c')](_0x6adcdb[_0xd498('0x18')]['include'],function(_0xd0e7dd){return{'model':db[_0xd0e7dd[_0xd498('0x1d')]],'as':_0xd0e7dd['as'],'attributes':_0xd0e7dd[_0xd498('0x19')],'include':_0xd0e7dd[_0xd498('0x1b')]?_[_0xd498('0x1c')](_0xd0e7dd['include'],function(_0x2b5d88){return{'model':db[_0x2b5d88[_0xd498('0x1d')]],'as':_0x2b5d88['as'],'attributes':_0x2b5d88['attributes'],'include':_0x2b5d88[_0xd498('0x1b')]?_['map'](_0x2b5d88[_0xd498('0x1b')],function(_0x287320){return{'model':db[_0x287320[_0xd498('0x1d')]],'as':_0x287320['as'],'attributes':_0x287320[_0xd498('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x381ece){logger['info']('GetZohoAccount',_0x6adcdb);logger[_0xd498('0xe')](_0xd498('0x16'),_0x6adcdb,JSON[_0xd498('0x11')](_0x381ece));_0x29d8d7(_0x381ece);})[_0xd498('0x1e')](function(_0x21b6e7){logger[_0xd498('0x13')]('GetZohoAccount',_0x21b6e7['message'],_0x6adcdb);_0x2792e9(_0x5c7715[_0xd498('0x13')](0x1f4,_0x21b6e7[_0xd498('0x15')]));});});};exports[_0xd498('0x1f')]=function(_0x524568){var _0x308e03=this;return new Promise(function(_0x5d7e17,_0x4eb2f2){return db[_0xd498('0x20')][_0xd498('0x21')]({'raw':_0x524568[_0xd498('0x18')]?_0x524568[_0xd498('0x18')][_0xd498('0x22')]===undefined?!![]:![]:!![],'where':_0x524568[_0xd498('0x18')]?_0x524568[_0xd498('0x18')][_0xd498('0x23')]||null:null,'attributes':_0x524568[_0xd498('0x18')]?_0x524568['options'][_0xd498('0x19')]||null:null,'include':_0x524568['options']?_0x524568['options'][_0xd498('0x1b')]?_[_0xd498('0x1c')](_0x524568[_0xd498('0x18')][_0xd498('0x1b')],function(_0x1bb613){return{'model':db[_0x1bb613[_0xd498('0x1d')]],'as':_0x1bb613['as'],'attributes':_0x1bb613[_0xd498('0x19')],'include':_0x1bb613[_0xd498('0x1b')]?_['map'](_0x1bb613['include'],function(_0xf201e9){return{'model':db[_0xf201e9['model']],'as':_0xf201e9['as'],'attributes':_0xf201e9[_0xd498('0x19')],'include':_0xf201e9['include']?_[_0xd498('0x1c')](_0xf201e9[_0xd498('0x1b')],function(_0x5e9955){return{'model':db[_0x5e9955[_0xd498('0x1d')]],'as':_0x5e9955['as'],'attributes':_0x5e9955[_0xd498('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd498('0xc')](function(_0x53c7ac){logger[_0xd498('0xd')](_0xd498('0x1f'),_0x524568);logger['debug'](_0xd498('0x1f'),_0x524568,JSON[_0xd498('0x11')](_0x53c7ac));_0x5d7e17(_0x53c7ac);})['catch'](function(_0x415007){logger[_0xd498('0x13')](_0xd498('0x1f'),_0x415007[_0xd498('0x15')],_0x524568);_0x4eb2f2(_0x308e03[_0xd498('0x13')](0x1f4,_0x415007[_0xd498('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 2519a7e..54cfc63 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 _0xf296=['../../components/interaction/service','./intZohoConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getDescriptions','create','put','update','delete','exports','multer','util','connect-timeout','../../components/auth/service'];(function(_0x128c01,_0xb89187){var _0x3f06ff=function(_0x46dc25){while(--_0x46dc25){_0x128c01['push'](_0x128c01['shift']());}};_0x3f06ff(++_0xb89187);}(_0xf296,0x94));var _0x6f29=function(_0x3f6b67,_0x2736d1){_0x3f6b67=_0x3f6b67-0x0;var _0x3d2b4c=_0xf296[_0x3f6b67];return _0x3d2b4c;};'use strict';var multer=require(_0x6f29('0x0'));var util=require(_0x6f29('0x1'));var path=require('path');var timeout=require(_0x6f29('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x6f29('0x3'));var interaction=require(_0x6f29('0x4'));var config=require('../../config/environment');var controller=require(_0x6f29('0x5'));router[_0x6f29('0x6')]('/',auth[_0x6f29('0x7')](),controller['index']);router[_0x6f29('0x6')](_0x6f29('0x8'),auth['isAuthenticated'](),controller[_0x6f29('0x9')]);router[_0x6f29('0x6')](_0x6f29('0xa'),auth[_0x6f29('0x7')](),controller[_0x6f29('0xb')]);router[_0x6f29('0x6')](_0x6f29('0xc'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x6f29('0x6')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x6f29('0xd')]);router['post']('/',auth[_0x6f29('0x7')](),controller[_0x6f29('0xe')]);router[_0x6f29('0xf')]('/:id',auth[_0x6f29('0x7')](),controller[_0x6f29('0x10')]);router[_0x6f29('0x11')](_0x6f29('0x8'),auth[_0x6f29('0x7')](),controller['destroy']);module[_0x6f29('0x12')]=router; \ No newline at end of file +var _0x0f93=['./intZohoConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4e93a9,_0x413f30){var _0x43013c=function(_0x3a0cf3){while(--_0x3a0cf3){_0x4e93a9['push'](_0x4e93a9['shift']());}};_0x43013c(++_0x413f30);}(_0x0f93,0x66));var _0x30f9=function(_0x1e1d8a,_0x2773ac){_0x1e1d8a=_0x1e1d8a-0x0;var _0xfa9c7c=_0x0f93[_0x1e1d8a];return _0xfa9c7c;};'use strict';var multer=require('multer');var util=require(_0x30f9('0x0'));var path=require(_0x30f9('0x1'));var timeout=require(_0x30f9('0x2'));var express=require(_0x30f9('0x3'));var router=express[_0x30f9('0x4')]();var auth=require(_0x30f9('0x5'));var interaction=require(_0x30f9('0x6'));var config=require(_0x30f9('0x7'));var controller=require(_0x30f9('0x8'));router[_0x30f9('0x9')]('/',auth[_0x30f9('0xa')](),controller['index']);router[_0x30f9('0x9')](_0x30f9('0xb'),auth[_0x30f9('0xa')](),controller['show']);router['get'](_0x30f9('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0x30f9('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x30f9('0xd')]);router[_0x30f9('0x9')](_0x30f9('0xe'),auth['isAuthenticated'](),controller[_0x30f9('0xf')]);router[_0x30f9('0x10')]('/',auth[_0x30f9('0xa')](),controller[_0x30f9('0x11')]);router[_0x30f9('0x12')](_0x30f9('0xb'),auth[_0x30f9('0xa')](),controller[_0x30f9('0x13')]);router['delete'](_0x30f9('0xb'),auth[_0x30f9('0xa')](),controller[_0x30f9('0x14')]);module[_0x30f9('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 9d6ea6e..f6d7ab8 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 _0xa40a=['STRING','sequelize'];(function(_0x33a90b,_0x3d0e78){var _0x17739b=function(_0x9c56ce){while(--_0x9c56ce){_0x33a90b['push'](_0x33a90b['shift']());}};_0x17739b(++_0x3d0e78);}(_0xa40a,0x1bb));var _0xaa40=function(_0x388ad9,_0x4d2ac2){_0x388ad9=_0x388ad9-0x0;var _0x341a79=_0xa40a[_0x388ad9];return _0x341a79;};'use strict';var Sequelize=require(_0xaa40('0x0'));module['exports']={'name':{'type':Sequelize[_0xaa40('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3b39=['exports','STRING','sequelize'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x3b39,0x1a6));var _0x93b3=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x3b39[_0x4b7b62];return _0x2280df;};'use strict';var Sequelize=require(_0x93b3('0x0'));module[_0x93b3('0x1')]={'name':{'type':Sequelize[_0x93b3('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index b8919fb..ce8c2ac 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 _0xffb1=['code','ZohoConfiguration,\x20%s,\x20%s','message','info','result','catch','sendStatus','json','count','offset','limit','status','set','reject','save','update','then','destroy','end','stack','name','index','ZohoConfiguration','rawAttributes','keys','query','dateEnd','dateStart','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','where','pick','add','day','filter','merge','map','options','includeAll','include','rows','show','params','find','create','body','getFields','findOne','sort','getSubjects','ZohoField','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','api','../../config/utils','../../mysqldb','client','http','request','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x39dfce,_0x37f996){var _0x496ab3=function(_0x4f22e7){while(--_0x4f22e7){_0x39dfce['push'](_0x39dfce['shift']());}};_0x496ab3(++_0x37f996);}(_0xffb1,0x93));var _0x1ffb=function(_0x2637ac,_0x377857){_0x2637ac=_0x2637ac-0x0;var _0x4a5758=_0xffb1[_0x2637ac];return _0x4a5758;};'use strict';var pdf=require(_0x1ffb('0x0'));var emlformat=require(_0x1ffb('0x1'));var rimraf=require(_0x1ffb('0x2'));var zipdir=require(_0x1ffb('0x3'));var jsonpatch=require(_0x1ffb('0x4'));var rp=require(_0x1ffb('0x5'));var moment=require(_0x1ffb('0x6'));var BPromise=require(_0x1ffb('0x7'));var Mustache=require(_0x1ffb('0x8'));var util=require(_0x1ffb('0x9'));var path=require('path');var sox=require(_0x1ffb('0xa'));var csv=require(_0x1ffb('0xb'));var ejs=require(_0x1ffb('0xc'));var fs=require('fs');var _=require(_0x1ffb('0xd'));var squel=require(_0x1ffb('0xe'));var crypto=require('crypto');var jsforce=require(_0x1ffb('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1ffb('0x10'));var Papa=require(_0x1ffb('0x11'));var Redis=require(_0x1ffb('0x12'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x1ffb('0x13'));var utils=require(_0x1ffb('0x14'));var config=require('../../config/environment');var db=require(_0x1ffb('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x1ffb('0x16')][_0x1ffb('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x327ef0,_0x351de7,_0x46c1ec,_0x121651){return new BPromise(function(_0x5b1141,_0x192a16){var _0x308bbf=_0x121651||client;return _0x308bbf[_0x1ffb('0x18')](_0x327ef0,_0x46c1ec)['then'](function(_0x208c0b){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x351de7,'request\x20sent');logger[_0x1ffb('0x19')](_0x1ffb('0x1a'),_0x351de7,'request\x20sent',JSON[_0x1ffb('0x1b')](_0x208c0b));if(_0x208c0b[_0x1ffb('0x1c')]){if(_0x208c0b[_0x1ffb('0x1c')][_0x1ffb('0x1d')]===0x1f4){logger['error'](_0x1ffb('0x1e'),_0x351de7,_0x208c0b['error'][_0x1ffb('0x1f')]);return _0x192a16(_0x208c0b[_0x1ffb('0x1c')][_0x1ffb('0x1f')]);}logger[_0x1ffb('0x1c')](_0x1ffb('0x1e'),_0x351de7,_0x208c0b['error'][_0x1ffb('0x1f')]);return _0x5b1141(_0x208c0b['error'][_0x1ffb('0x1f')]);}else{logger[_0x1ffb('0x20')](_0x1ffb('0x1e'),_0x351de7,'request\x20sent');_0x5b1141(_0x208c0b[_0x1ffb('0x21')]['message']);}})[_0x1ffb('0x22')](function(_0x4eee72){logger[_0x1ffb('0x1c')]('ZohoConfiguration,\x20%s,\x20%s',_0x351de7,_0x4eee72);_0x192a16(_0x4eee72);});});}function respondWithStatusCode(_0x3be561,_0x5ac526){_0x5ac526=_0x5ac526||0xcc;return function(_0x42a515){if(_0x42a515){return _0x3be561[_0x1ffb('0x23')](_0x5ac526);}return _0x3be561['status'](_0x5ac526)['end']();};}function respondWithResult(_0x5186fe,_0x16e288){_0x16e288=_0x16e288||0xc8;return function(_0x4c9380){if(_0x4c9380){return _0x5186fe['status'](_0x16e288)[_0x1ffb('0x24')](_0x4c9380);}};}function respondWithFilteredResult(_0x391085,_0x5b7ff5){return function(_0x142ae0){if(_0x142ae0){var _0x4298fd=_0x142ae0[_0x1ffb('0x25')],_0x10b8ea=_0x5b7ff5[_0x1ffb('0x26')],_0x458f6f=_0x5b7ff5['offset']+_0x5b7ff5[_0x1ffb('0x27')],_0x18dbba;if(_0x458f6f>=_0x4298fd){_0x458f6f=_0x4298fd;_0x18dbba=0xc8;}else{_0x18dbba=0xce;}_0x391085[_0x1ffb('0x28')](_0x18dbba);return _0x391085[_0x1ffb('0x29')]('Content-Range',_0x10b8ea+'-'+_0x458f6f+'/'+_0x4298fd)[_0x1ffb('0x24')](_0x142ae0);}return null;};}function patchUpdates(_0x471eaf){return function(_0x1c9771){try{jsonpatch['apply'](_0x1c9771,_0x471eaf,!![]);}catch(_0x58275b){return BPromise[_0x1ffb('0x2a')](_0x58275b);}return _0x1c9771[_0x1ffb('0x2b')]();};}function saveUpdates(_0x146f3c,_0x12e31f){return function(_0x95e337){if(_0x95e337){return _0x95e337[_0x1ffb('0x2c')](_0x146f3c)[_0x1ffb('0x2d')](function(_0x5da00a){return _0x5da00a;});}return null;};}function removeEntity(_0x15eec7,_0x3c2c89){return function(_0x482341){if(_0x482341){return _0x482341[_0x1ffb('0x2e')]()['then'](function(){_0x15eec7['status'](0xcc)[_0x1ffb('0x2f')]();});}};}function handleEntityNotFound(_0x3f8331,_0x24b062){return function(_0x4afe67){if(!_0x4afe67){_0x3f8331[_0x1ffb('0x23')](0x194);}return _0x4afe67;};}function handleError(_0x38688a,_0xd6d6f3){_0xd6d6f3=_0xd6d6f3||0x1f4;return function(_0x3d6eda){logger[_0x1ffb('0x1c')](_0x3d6eda[_0x1ffb('0x30')]);if(_0x3d6eda[_0x1ffb('0x31')]){delete _0x3d6eda[_0x1ffb('0x31')];}_0x38688a[_0x1ffb('0x28')](_0xd6d6f3)['send'](_0x3d6eda);};}exports[_0x1ffb('0x32')]=function(_0x398c3c,_0x1bcd96){var _0x2b7c26={},_0x2f58b5={},_0x2b3969={'count':0x0,'rows':[]};var _0x17e481=db[_0x1ffb('0x33')][_0x1ffb('0x34')];_0x2f58b5['model']=_[_0x1ffb('0x35')](_0x17e481);var _0x493fff={'dateStart':_0x398c3c[_0x1ffb('0x36')]['dateStart'],'dateEnd':_0x398c3c[_0x1ffb('0x36')][_0x1ffb('0x37')]};delete _0x398c3c[_0x1ffb('0x36')][_0x1ffb('0x38')];delete _0x398c3c[_0x1ffb('0x36')][_0x1ffb('0x37')];_0x2f58b5['query']=_[_0x1ffb('0x35')](_0x398c3c[_0x1ffb('0x36')]);_0x2f58b5[_0x1ffb('0x39')]=_[_0x1ffb('0x3a')](_0x2f58b5['model'],_0x2f58b5['query']);_0x2b7c26[_0x1ffb('0x3b')]=_[_0x1ffb('0x3a')](_0x2f58b5[_0x1ffb('0x3c')],qs[_0x1ffb('0x3d')](_0x398c3c[_0x1ffb('0x36')]['fields']));_0x2b7c26[_0x1ffb('0x3b')]=_0x2b7c26[_0x1ffb('0x3b')][_0x1ffb('0x3e')]?_0x2b7c26[_0x1ffb('0x3b')]:_0x2f58b5[_0x1ffb('0x3c')];if(!_0x398c3c[_0x1ffb('0x36')][_0x1ffb('0x3f')](_0x1ffb('0x40'))){_0x2b7c26[_0x1ffb('0x27')]=qs[_0x1ffb('0x27')](_0x398c3c['query'][_0x1ffb('0x27')]);_0x2b7c26[_0x1ffb('0x26')]=qs[_0x1ffb('0x26')](_0x398c3c[_0x1ffb('0x36')]['offset']);}_0x2b7c26[_0x1ffb('0x41')]=qs['sort'](_0x398c3c['query']['sort']);_0x2b7c26[_0x1ffb('0x42')]=qs[_0x1ffb('0x39')](_[_0x1ffb('0x43')](_0x398c3c[_0x1ffb('0x36')],_0x2f58b5[_0x1ffb('0x39')]));if(_0x493fff['dateStart']){if(_0x493fff['dateEnd']){_0x493fff[_0x1ffb('0x37')]=moment(_0x493fff[_0x1ffb('0x37')])[_0x1ffb('0x44')](0x1,_0x1ffb('0x45'));}else{_0x493fff[_0x1ffb('0x37')]=moment(_0x493fff['dateStart'])[_0x1ffb('0x44')](0x1,_0x1ffb('0x45'));}_['merge'](_0x2b7c26[_0x1ffb('0x42')],{'createdAt':{'$gte':_0x493fff['dateStart'],'$lte':_0x493fff[_0x1ffb('0x37')]}});}if(_0x398c3c[_0x1ffb('0x36')][_0x1ffb('0x46')]){_0x2b7c26[_0x1ffb('0x42')]=_[_0x1ffb('0x47')](_0x2b7c26['where'],{'$or':_[_0x1ffb('0x48')](_0x2b7c26[_0x1ffb('0x3b')],function(_0x30e4cc){var _0x452945={};_0x452945[_0x30e4cc]={'$like':'%'+_0x398c3c['query']['filter']+'%'};return _0x452945;})});}_0x2b7c26=_[_0x1ffb('0x47')]({},_0x2b7c26,_0x398c3c[_0x1ffb('0x49')]);var _0x5dc298={'where':_0x2b7c26['where']};return db[_0x1ffb('0x33')]['count'](_0x5dc298)[_0x1ffb('0x2d')](function(_0x7eaa84){_0x2b3969[_0x1ffb('0x25')]=_0x7eaa84;if(_0x398c3c[_0x1ffb('0x36')][_0x1ffb('0x4a')]){_0x2b7c26[_0x1ffb('0x4b')]=[{'all':!![]}];}return db[_0x1ffb('0x33')]['findAll'](_0x2b7c26);})[_0x1ffb('0x2d')](function(_0x1dd866){_0x2b3969[_0x1ffb('0x4c')]=_0x1dd866;return _0x2b3969;})[_0x1ffb('0x2d')](respondWithFilteredResult(_0x1bcd96,_0x2b7c26))['catch'](handleError(_0x1bcd96,null));};exports[_0x1ffb('0x4d')]=function(_0x17ca4a,_0x1c9eda){var _0x247bc0={'raw':![],'where':{'id':_0x17ca4a[_0x1ffb('0x4e')]['id']}},_0x399993={};_0x399993[_0x1ffb('0x3c')]=_[_0x1ffb('0x35')](db[_0x1ffb('0x33')][_0x1ffb('0x34')]);_0x399993[_0x1ffb('0x36')]=_[_0x1ffb('0x35')](_0x17ca4a[_0x1ffb('0x36')]);_0x399993[_0x1ffb('0x39')]=_[_0x1ffb('0x3a')](_0x399993[_0x1ffb('0x3c')],_0x399993[_0x1ffb('0x36')]);_0x247bc0[_0x1ffb('0x3b')]=_['intersection'](_0x399993[_0x1ffb('0x3c')],qs['fields'](_0x17ca4a[_0x1ffb('0x36')]['fields']));_0x247bc0[_0x1ffb('0x3b')]=_0x247bc0[_0x1ffb('0x3b')][_0x1ffb('0x3e')]?_0x247bc0['attributes']:_0x399993['model'];if(_0x17ca4a['query'][_0x1ffb('0x4a')]){_0x247bc0[_0x1ffb('0x4b')]=[{'all':!![]}];}_0x247bc0=_[_0x1ffb('0x47')]({},_0x247bc0,_0x17ca4a[_0x1ffb('0x49')]);return db[_0x1ffb('0x33')][_0x1ffb('0x4f')](_0x247bc0)[_0x1ffb('0x2d')](handleEntityNotFound(_0x1c9eda,null))[_0x1ffb('0x2d')](respondWithResult(_0x1c9eda,null))[_0x1ffb('0x22')](handleError(_0x1c9eda,null));};exports[_0x1ffb('0x50')]=function(_0x5c65dc,_0x2c7d36){return db[_0x1ffb('0x33')][_0x1ffb('0x50')](_0x5c65dc['body'],{})['then'](respondWithResult(_0x2c7d36,0xc9))[_0x1ffb('0x22')](handleError(_0x2c7d36,null));};exports[_0x1ffb('0x2c')]=function(_0x2488c5,_0x553283){if(_0x2488c5[_0x1ffb('0x51')]['id']){delete _0x2488c5[_0x1ffb('0x51')]['id'];}return db['ZohoConfiguration']['find']({'where':{'id':_0x2488c5['params']['id']}})[_0x1ffb('0x2d')](handleEntityNotFound(_0x553283,null))['then'](saveUpdates(_0x2488c5['body'],null))[_0x1ffb('0x2d')](respondWithResult(_0x553283,null))[_0x1ffb('0x22')](handleError(_0x553283,null));};exports[_0x1ffb('0x2e')]=function(_0x2487f0,_0x2252c1){return db[_0x1ffb('0x33')]['find']({'where':{'id':_0x2487f0['params']['id']}})['then'](handleEntityNotFound(_0x2252c1,null))[_0x1ffb('0x2d')](removeEntity(_0x2252c1,null))[_0x1ffb('0x22')](handleError(_0x2252c1,null));};exports[_0x1ffb('0x52')]=function(_0x4c2679,_0xbeaaaf,_0x54c960){var _0x4e5706={};var _0x13a502={};var _0x56d05a;var _0x370c2b;return db[_0x1ffb('0x33')][_0x1ffb('0x53')]({'where':{'id':_0x4c2679[_0x1ffb('0x4e')]['id']}})[_0x1ffb('0x2d')](handleEntityNotFound(_0xbeaaaf,null))['then'](function(_0x336a1e){if(_0x336a1e){_0x56d05a=_0x336a1e;_0x13a502[_0x1ffb('0x3c')]=_[_0x1ffb('0x35')](db['ZohoField'][_0x1ffb('0x34')]);_0x13a502[_0x1ffb('0x36')]=_[_0x1ffb('0x35')](_0x4c2679[_0x1ffb('0x36')]);_0x13a502['filters']=_[_0x1ffb('0x3a')](_0x13a502[_0x1ffb('0x3c')],_0x13a502[_0x1ffb('0x36')]);_0x4e5706['attributes']=_['intersection'](_0x13a502[_0x1ffb('0x3c')],qs[_0x1ffb('0x3d')](_0x4c2679[_0x1ffb('0x36')][_0x1ffb('0x3d')]));_0x4e5706[_0x1ffb('0x3b')]=_0x4e5706[_0x1ffb('0x3b')][_0x1ffb('0x3e')]?_0x4e5706['attributes']:_0x13a502[_0x1ffb('0x3c')];_0x4e5706[_0x1ffb('0x41')]=qs[_0x1ffb('0x54')](_0x4c2679[_0x1ffb('0x36')][_0x1ffb('0x54')]);_0x4e5706[_0x1ffb('0x42')]=qs[_0x1ffb('0x39')](_['pick'](_0x4c2679[_0x1ffb('0x36')],_0x13a502[_0x1ffb('0x39')]));if(_0x4c2679[_0x1ffb('0x36')][_0x1ffb('0x46')]){_0x4e5706[_0x1ffb('0x42')]=_[_0x1ffb('0x47')](_0x4e5706[_0x1ffb('0x42')],{'$or':_['map'](_0x4e5706[_0x1ffb('0x3b')],function(_0x1d81f2){var _0x263da7={};_0x263da7[_0x1d81f2]={'$like':'%'+_0x4c2679[_0x1ffb('0x36')][_0x1ffb('0x46')]+'%'};return _0x263da7;})});}_0x4e5706=_['merge']({},_0x4e5706,_0x4c2679['options']);return _0x56d05a[_0x1ffb('0x52')](_0x4e5706);}})[_0x1ffb('0x2d')](function(_0x5e524a){if(_0x5e524a){_0x370c2b=_0x5e524a[_0x1ffb('0x3e')];if(!_0x4c2679[_0x1ffb('0x36')][_0x1ffb('0x3f')](_0x1ffb('0x40'))){_0x4e5706[_0x1ffb('0x27')]=qs[_0x1ffb('0x27')](_0x4c2679[_0x1ffb('0x36')]['limit']);_0x4e5706[_0x1ffb('0x26')]=qs[_0x1ffb('0x26')](_0x4c2679[_0x1ffb('0x36')][_0x1ffb('0x26')]);}return _0x56d05a[_0x1ffb('0x52')](_0x4e5706);}})[_0x1ffb('0x2d')](function(_0x470d36){if(_0x470d36){return _0x470d36?{'count':_0x370c2b,'rows':_0x470d36}:null;}})[_0x1ffb('0x2d')](respondWithResult(_0xbeaaaf,null))[_0x1ffb('0x22')](handleError(_0xbeaaaf,null));};exports[_0x1ffb('0x55')]=function(_0x1db54d,_0x588c0f,_0x544dff){var _0x3656b4={};var _0x351865={};var _0x4ab215;var _0x179d40;return db[_0x1ffb('0x33')][_0x1ffb('0x53')]({'where':{'id':_0x1db54d['params']['id']}})[_0x1ffb('0x2d')](handleEntityNotFound(_0x588c0f,null))[_0x1ffb('0x2d')](function(_0x28eed0){if(_0x28eed0){_0x4ab215=_0x28eed0;_0x351865[_0x1ffb('0x3c')]=_[_0x1ffb('0x35')](db[_0x1ffb('0x56')]['rawAttributes']);_0x351865[_0x1ffb('0x36')]=_[_0x1ffb('0x35')](_0x1db54d['query']);_0x351865['filters']=_['intersection'](_0x351865[_0x1ffb('0x3c')],_0x351865['query']);_0x3656b4[_0x1ffb('0x3b')]=_[_0x1ffb('0x3a')](_0x351865[_0x1ffb('0x3c')],qs[_0x1ffb('0x3d')](_0x1db54d[_0x1ffb('0x36')]['fields']));_0x3656b4['attributes']=_0x3656b4['attributes'][_0x1ffb('0x3e')]?_0x3656b4[_0x1ffb('0x3b')]:_0x351865['model'];_0x3656b4['order']=qs[_0x1ffb('0x54')](_0x1db54d[_0x1ffb('0x36')][_0x1ffb('0x54')]);_0x3656b4['where']=qs['filters'](_[_0x1ffb('0x43')](_0x1db54d['query'],_0x351865[_0x1ffb('0x39')]));if(_0x1db54d[_0x1ffb('0x36')][_0x1ffb('0x46')]){_0x3656b4[_0x1ffb('0x42')]=_[_0x1ffb('0x47')](_0x3656b4[_0x1ffb('0x42')],{'$or':_[_0x1ffb('0x48')](_0x3656b4[_0x1ffb('0x3b')],function(_0x371a8b){var _0x4cb7ea={};_0x4cb7ea[_0x371a8b]={'$like':'%'+_0x1db54d[_0x1ffb('0x36')]['filter']+'%'};return _0x4cb7ea;})});}_0x3656b4=_['merge']({},_0x3656b4,_0x1db54d[_0x1ffb('0x49')]);return _0x4ab215[_0x1ffb('0x55')](_0x3656b4);}})[_0x1ffb('0x2d')](function(_0x561629){if(_0x561629){_0x179d40=_0x561629[_0x1ffb('0x3e')];if(!_0x1db54d[_0x1ffb('0x36')][_0x1ffb('0x3f')]('nolimit')){_0x3656b4[_0x1ffb('0x27')]=qs[_0x1ffb('0x27')](_0x1db54d[_0x1ffb('0x36')][_0x1ffb('0x27')]);_0x3656b4[_0x1ffb('0x26')]=qs[_0x1ffb('0x26')](_0x1db54d[_0x1ffb('0x36')]['offset']);}return _0x4ab215[_0x1ffb('0x55')](_0x3656b4);}})[_0x1ffb('0x2d')](function(_0x33d452){if(_0x33d452){return _0x33d452?{'count':_0x179d40,'rows':_0x33d452}:null;}})['then'](respondWithResult(_0x588c0f,null))[_0x1ffb('0x22')](handleError(_0x588c0f,null));};exports[_0x1ffb('0x57')]=function(_0x1c243f,_0x5f490d,_0x52ecb3){var _0x2b3009={};var _0x481139={};var _0x298a6c;var _0x2b24be;return db[_0x1ffb('0x33')][_0x1ffb('0x53')]({'where':{'id':_0x1c243f[_0x1ffb('0x4e')]['id']}})[_0x1ffb('0x2d')](handleEntityNotFound(_0x5f490d,null))[_0x1ffb('0x2d')](function(_0x39ef03){if(_0x39ef03){_0x298a6c=_0x39ef03;_0x481139[_0x1ffb('0x3c')]=_[_0x1ffb('0x35')](db[_0x1ffb('0x56')][_0x1ffb('0x34')]);_0x481139[_0x1ffb('0x36')]=_[_0x1ffb('0x35')](_0x1c243f[_0x1ffb('0x36')]);_0x481139['filters']=_['intersection'](_0x481139[_0x1ffb('0x3c')],_0x481139[_0x1ffb('0x36')]);_0x2b3009[_0x1ffb('0x3b')]=_[_0x1ffb('0x3a')](_0x481139[_0x1ffb('0x3c')],qs[_0x1ffb('0x3d')](_0x1c243f[_0x1ffb('0x36')][_0x1ffb('0x3d')]));_0x2b3009['attributes']=_0x2b3009[_0x1ffb('0x3b')][_0x1ffb('0x3e')]?_0x2b3009[_0x1ffb('0x3b')]:_0x481139[_0x1ffb('0x3c')];_0x2b3009[_0x1ffb('0x41')]=qs[_0x1ffb('0x54')](_0x1c243f[_0x1ffb('0x36')][_0x1ffb('0x54')]);_0x2b3009['where']=qs['filters'](_[_0x1ffb('0x43')](_0x1c243f['query'],_0x481139[_0x1ffb('0x39')]));if(_0x1c243f[_0x1ffb('0x36')]['filter']){_0x2b3009[_0x1ffb('0x42')]=_[_0x1ffb('0x47')](_0x2b3009[_0x1ffb('0x42')],{'$or':_['map'](_0x2b3009[_0x1ffb('0x3b')],function(_0x2c9d0c){var _0x4eeb20={};_0x4eeb20[_0x2c9d0c]={'$like':'%'+_0x1c243f[_0x1ffb('0x36')][_0x1ffb('0x46')]+'%'};return _0x4eeb20;})});}_0x2b3009=_[_0x1ffb('0x47')]({},_0x2b3009,_0x1c243f[_0x1ffb('0x49')]);return _0x298a6c['getDescriptions'](_0x2b3009);}})[_0x1ffb('0x2d')](function(_0x3d7e2a){if(_0x3d7e2a){_0x2b24be=_0x3d7e2a[_0x1ffb('0x3e')];if(!_0x1c243f[_0x1ffb('0x36')][_0x1ffb('0x3f')](_0x1ffb('0x40'))){_0x2b3009[_0x1ffb('0x27')]=qs[_0x1ffb('0x27')](_0x1c243f[_0x1ffb('0x36')]['limit']);_0x2b3009[_0x1ffb('0x26')]=qs[_0x1ffb('0x26')](_0x1c243f['query'][_0x1ffb('0x26')]);}return _0x298a6c['getDescriptions'](_0x2b3009);}})[_0x1ffb('0x2d')](function(_0x2c6187){if(_0x2c6187){return _0x2c6187?{'count':_0x2b24be,'rows':_0x2c6187}:null;}})[_0x1ffb('0x2d')](respondWithResult(_0x5f490d,null))[_0x1ffb('0x22')](handleError(_0x5f490d,null));}; \ No newline at end of file +var _0xa93e=['../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','sendStatus','status','end','count','offset','limit','Content-Range','json','reject','save','name','send','index','ZohoConfiguration','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','destroy','getFields','ZohoField','map','findOne','getDescriptions','rimraf','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis'];(function(_0x50d6e3,_0x31145f){var _0x21e087=function(_0x4f7bc9){while(--_0x4f7bc9){_0x50d6e3['push'](_0x50d6e3['shift']());}};_0x21e087(++_0x31145f);}(_0xa93e,0x1df));var _0xea93=function(_0x40048c,_0x4eea84){_0x40048c=_0x40048c-0x0;var _0x4f8784=_0xa93e[_0x40048c];return _0x4f8784;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xea93('0x0'));var zipdir=require(_0xea93('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xea93('0x2'));var moment=require('moment');var BPromise=require(_0xea93('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xea93('0x4'));var sox=require(_0xea93('0x5'));var csv=require(_0xea93('0x6'));var ejs=require(_0xea93('0x7'));var fs=require('fs');var _=require(_0xea93('0x8'));var squel=require(_0xea93('0x9'));var crypto=require('crypto');var jsforce=require(_0xea93('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xea93('0xb'));var Redis=require(_0xea93('0xc'));var qs=require('../../components/parsers/qs');var logger=require(_0xea93('0xd'))(_0xea93('0xe'));var utils=require('../../config/utils');var config=require(_0xea93('0xf'));var db=require(_0xea93('0x10'))['db'];var jayson=require(_0xea93('0x11'));var client=jayson[_0xea93('0x12')][_0xea93('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x313114,_0x515cb9,_0x32664f,_0x4b42ef){return new BPromise(function(_0x495c28,_0x14e49b){var _0x1b3cf8=_0x4b42ef||client;return _0x1b3cf8[_0xea93('0x14')](_0x313114,_0x32664f)[_0xea93('0x15')](function(_0x21584a){logger[_0xea93('0x16')]('ZohoConfiguration,\x20%s,\x20%s',_0x515cb9,_0xea93('0x17'));logger['debug'](_0xea93('0x18'),_0x515cb9,_0xea93('0x17'),JSON[_0xea93('0x19')](_0x21584a));if(_0x21584a[_0xea93('0x1a')]){if(_0x21584a[_0xea93('0x1a')][_0xea93('0x1b')]===0x1f4){logger[_0xea93('0x1a')](_0xea93('0x1c'),_0x515cb9,_0x21584a[_0xea93('0x1a')][_0xea93('0x1d')]);return _0x14e49b(_0x21584a[_0xea93('0x1a')][_0xea93('0x1d')]);}logger[_0xea93('0x1a')]('ZohoConfiguration,\x20%s,\x20%s',_0x515cb9,_0x21584a[_0xea93('0x1a')]['message']);return _0x495c28(_0x21584a[_0xea93('0x1a')][_0xea93('0x1d')]);}else{logger[_0xea93('0x16')](_0xea93('0x1c'),_0x515cb9,_0xea93('0x17'));_0x495c28(_0x21584a['result'][_0xea93('0x1d')]);}})['catch'](function(_0x4b4b62){logger[_0xea93('0x1a')](_0xea93('0x1c'),_0x515cb9,_0x4b4b62);_0x14e49b(_0x4b4b62);});});}function respondWithStatusCode(_0x622e1b,_0x1fc88a){_0x1fc88a=_0x1fc88a||0xcc;return function(_0x562a1c){if(_0x562a1c){return _0x622e1b[_0xea93('0x1e')](_0x1fc88a);}return _0x622e1b[_0xea93('0x1f')](_0x1fc88a)[_0xea93('0x20')]();};}function respondWithResult(_0x404b74,_0x3d3a6e){_0x3d3a6e=_0x3d3a6e||0xc8;return function(_0x127a85){if(_0x127a85){return _0x404b74[_0xea93('0x1f')](_0x3d3a6e)['json'](_0x127a85);}};}function respondWithFilteredResult(_0x2c6a71,_0x5e88de){return function(_0x46ef0e){if(_0x46ef0e){var _0x46ab73=_0x46ef0e[_0xea93('0x21')],_0x589260=_0x5e88de[_0xea93('0x22')],_0x3966f6=_0x5e88de['offset']+_0x5e88de[_0xea93('0x23')],_0x3173c8;if(_0x3966f6>=_0x46ab73){_0x3966f6=_0x46ab73;_0x3173c8=0xc8;}else{_0x3173c8=0xce;}_0x2c6a71[_0xea93('0x1f')](_0x3173c8);return _0x2c6a71['set'](_0xea93('0x24'),_0x589260+'-'+_0x3966f6+'/'+_0x46ab73)[_0xea93('0x25')](_0x46ef0e);}return null;};}function patchUpdates(_0x273ecc){return function(_0x3ca98b){try{jsonpatch['apply'](_0x3ca98b,_0x273ecc,!![]);}catch(_0x2ca687){return BPromise[_0xea93('0x26')](_0x2ca687);}return _0x3ca98b[_0xea93('0x27')]();};}function saveUpdates(_0x29fd79,_0x198dc2){return function(_0x11c35e){if(_0x11c35e){return _0x11c35e['update'](_0x29fd79)[_0xea93('0x15')](function(_0x360e21){return _0x360e21;});}return null;};}function removeEntity(_0x2a048b,_0x2cec24){return function(_0x2d2e2e){if(_0x2d2e2e){return _0x2d2e2e['destroy']()[_0xea93('0x15')](function(){_0x2a048b[_0xea93('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35f7a9,_0x42bd0b){return function(_0x1cf6c5){if(!_0x1cf6c5){_0x35f7a9[_0xea93('0x1e')](0x194);}return _0x1cf6c5;};}function handleError(_0x524be4,_0x35f904){_0x35f904=_0x35f904||0x1f4;return function(_0x1ca182){logger[_0xea93('0x1a')](_0x1ca182['stack']);if(_0x1ca182[_0xea93('0x28')]){delete _0x1ca182[_0xea93('0x28')];}_0x524be4['status'](_0x35f904)[_0xea93('0x29')](_0x1ca182);};}exports[_0xea93('0x2a')]=function(_0x5afc8f,_0x3cee10){var _0x1712b8={},_0x53385e={},_0x2bc25a={'count':0x0,'rows':[]};var _0xb288a2=db[_0xea93('0x2b')][_0xea93('0x2c')];_0x53385e[_0xea93('0x2d')]=_[_0xea93('0x2e')](_0xb288a2);var _0x2e45bb={'dateStart':_0x5afc8f[_0xea93('0x2f')][_0xea93('0x30')],'dateEnd':_0x5afc8f[_0xea93('0x2f')]['dateEnd']};delete _0x5afc8f[_0xea93('0x2f')][_0xea93('0x30')];delete _0x5afc8f['query'][_0xea93('0x31')];_0x53385e[_0xea93('0x2f')]=_[_0xea93('0x2e')](_0x5afc8f[_0xea93('0x2f')]);_0x53385e[_0xea93('0x32')]=_[_0xea93('0x33')](_0x53385e[_0xea93('0x2d')],_0x53385e['query']);_0x1712b8[_0xea93('0x34')]=_[_0xea93('0x33')](_0x53385e[_0xea93('0x2d')],qs[_0xea93('0x35')](_0x5afc8f[_0xea93('0x2f')][_0xea93('0x35')]));_0x1712b8[_0xea93('0x34')]=_0x1712b8['attributes'][_0xea93('0x36')]?_0x1712b8['attributes']:_0x53385e['model'];if(!_0x5afc8f[_0xea93('0x2f')][_0xea93('0x37')](_0xea93('0x38'))){_0x1712b8[_0xea93('0x23')]=qs[_0xea93('0x23')](_0x5afc8f[_0xea93('0x2f')][_0xea93('0x23')]);_0x1712b8['offset']=qs['offset'](_0x5afc8f[_0xea93('0x2f')][_0xea93('0x22')]);}_0x1712b8[_0xea93('0x39')]=qs[_0xea93('0x3a')](_0x5afc8f[_0xea93('0x2f')][_0xea93('0x3a')]);_0x1712b8[_0xea93('0x3b')]=qs[_0xea93('0x32')](_[_0xea93('0x3c')](_0x5afc8f[_0xea93('0x2f')],_0x53385e[_0xea93('0x32')]));if(_0x2e45bb['dateStart']){if(_0x2e45bb['dateEnd']){_0x2e45bb[_0xea93('0x31')]=moment(_0x2e45bb[_0xea93('0x31')])['add'](0x1,'day');}else{_0x2e45bb['dateEnd']=moment(_0x2e45bb[_0xea93('0x30')])[_0xea93('0x3d')](0x1,_0xea93('0x3e'));}_['merge'](_0x1712b8[_0xea93('0x3b')],{'createdAt':{'$gte':_0x2e45bb[_0xea93('0x30')],'$lte':_0x2e45bb['dateEnd']}});}if(_0x5afc8f[_0xea93('0x2f')]['filter']){_0x1712b8[_0xea93('0x3b')]=_[_0xea93('0x3f')](_0x1712b8[_0xea93('0x3b')],{'$or':_['map'](_0x1712b8[_0xea93('0x34')],function(_0x155aeb){var _0x3e6a66={};_0x3e6a66[_0x155aeb]={'$like':'%'+_0x5afc8f[_0xea93('0x2f')][_0xea93('0x40')]+'%'};return _0x3e6a66;})});}_0x1712b8=_[_0xea93('0x3f')]({},_0x1712b8,_0x5afc8f[_0xea93('0x41')]);var _0x52f783={'where':_0x1712b8[_0xea93('0x3b')]};return db[_0xea93('0x2b')][_0xea93('0x21')](_0x52f783)['then'](function(_0x14db28){_0x2bc25a[_0xea93('0x21')]=_0x14db28;if(_0x5afc8f['query']['includeAll']){_0x1712b8[_0xea93('0x42')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0xea93('0x43')](_0x1712b8);})[_0xea93('0x15')](function(_0x24b42f){_0x2bc25a[_0xea93('0x44')]=_0x24b42f;return _0x2bc25a;})[_0xea93('0x15')](respondWithFilteredResult(_0x3cee10,_0x1712b8))['catch'](handleError(_0x3cee10,null));};exports[_0xea93('0x45')]=function(_0x3da824,_0x4cecee){var _0x43b05f={'raw':![],'where':{'id':_0x3da824[_0xea93('0x46')]['id']}},_0x2bfa5a={};_0x2bfa5a[_0xea93('0x2d')]=_['keys'](db['ZohoConfiguration'][_0xea93('0x2c')]);_0x2bfa5a['query']=_[_0xea93('0x2e')](_0x3da824[_0xea93('0x2f')]);_0x2bfa5a['filters']=_['intersection'](_0x2bfa5a[_0xea93('0x2d')],_0x2bfa5a[_0xea93('0x2f')]);_0x43b05f['attributes']=_['intersection'](_0x2bfa5a[_0xea93('0x2d')],qs[_0xea93('0x35')](_0x3da824[_0xea93('0x2f')][_0xea93('0x35')]));_0x43b05f[_0xea93('0x34')]=_0x43b05f[_0xea93('0x34')][_0xea93('0x36')]?_0x43b05f[_0xea93('0x34')]:_0x2bfa5a[_0xea93('0x2d')];if(_0x3da824[_0xea93('0x2f')][_0xea93('0x47')]){_0x43b05f['include']=[{'all':!![]}];}_0x43b05f=_['merge']({},_0x43b05f,_0x3da824[_0xea93('0x41')]);return db[_0xea93('0x2b')][_0xea93('0x48')](_0x43b05f)['then'](handleEntityNotFound(_0x4cecee,null))[_0xea93('0x15')](respondWithResult(_0x4cecee,null))[_0xea93('0x49')](handleError(_0x4cecee,null));};exports[_0xea93('0x4a')]=function(_0x593d6b,_0x285ea3){return db[_0xea93('0x2b')]['create'](_0x593d6b[_0xea93('0x4b')],{})[_0xea93('0x15')](respondWithResult(_0x285ea3,0xc9))[_0xea93('0x49')](handleError(_0x285ea3,null));};exports['update']=function(_0x469e02,_0x3785d6){if(_0x469e02[_0xea93('0x4b')]['id']){delete _0x469e02[_0xea93('0x4b')]['id'];}return db['ZohoConfiguration'][_0xea93('0x48')]({'where':{'id':_0x469e02[_0xea93('0x46')]['id']}})[_0xea93('0x15')](handleEntityNotFound(_0x3785d6,null))[_0xea93('0x15')](saveUpdates(_0x469e02['body'],null))[_0xea93('0x15')](respondWithResult(_0x3785d6,null))['catch'](handleError(_0x3785d6,null));};exports[_0xea93('0x4c')]=function(_0x40c846,_0x1f83c4){return db['ZohoConfiguration'][_0xea93('0x48')]({'where':{'id':_0x40c846[_0xea93('0x46')]['id']}})[_0xea93('0x15')](handleEntityNotFound(_0x1f83c4,null))[_0xea93('0x15')](removeEntity(_0x1f83c4,null))[_0xea93('0x49')](handleError(_0x1f83c4,null));};exports[_0xea93('0x4d')]=function(_0x49a66e,_0x59fbf1,_0x201c52){var _0x4e45ef={};var _0x16d974={};var _0x41f607;var _0xb1ae89;return db[_0xea93('0x2b')]['findOne']({'where':{'id':_0x49a66e[_0xea93('0x46')]['id']}})[_0xea93('0x15')](handleEntityNotFound(_0x59fbf1,null))[_0xea93('0x15')](function(_0x6a8185){if(_0x6a8185){_0x41f607=_0x6a8185;_0x16d974['model']=_['keys'](db[_0xea93('0x4e')][_0xea93('0x2c')]);_0x16d974[_0xea93('0x2f')]=_['keys'](_0x49a66e[_0xea93('0x2f')]);_0x16d974[_0xea93('0x32')]=_['intersection'](_0x16d974[_0xea93('0x2d')],_0x16d974[_0xea93('0x2f')]);_0x4e45ef[_0xea93('0x34')]=_['intersection'](_0x16d974[_0xea93('0x2d')],qs[_0xea93('0x35')](_0x49a66e[_0xea93('0x2f')][_0xea93('0x35')]));_0x4e45ef['attributes']=_0x4e45ef[_0xea93('0x34')][_0xea93('0x36')]?_0x4e45ef['attributes']:_0x16d974[_0xea93('0x2d')];_0x4e45ef[_0xea93('0x39')]=qs[_0xea93('0x3a')](_0x49a66e[_0xea93('0x2f')][_0xea93('0x3a')]);_0x4e45ef[_0xea93('0x3b')]=qs[_0xea93('0x32')](_['pick'](_0x49a66e['query'],_0x16d974[_0xea93('0x32')]));if(_0x49a66e[_0xea93('0x2f')][_0xea93('0x40')]){_0x4e45ef[_0xea93('0x3b')]=_[_0xea93('0x3f')](_0x4e45ef[_0xea93('0x3b')],{'$or':_[_0xea93('0x4f')](_0x4e45ef[_0xea93('0x34')],function(_0x533c72){var _0x2174ab={};_0x2174ab[_0x533c72]={'$like':'%'+_0x49a66e['query']['filter']+'%'};return _0x2174ab;})});}_0x4e45ef=_[_0xea93('0x3f')]({},_0x4e45ef,_0x49a66e[_0xea93('0x41')]);return _0x41f607['getFields'](_0x4e45ef);}})['then'](function(_0x4c3309){if(_0x4c3309){_0xb1ae89=_0x4c3309[_0xea93('0x36')];if(!_0x49a66e[_0xea93('0x2f')][_0xea93('0x37')](_0xea93('0x38'))){_0x4e45ef['limit']=qs['limit'](_0x49a66e[_0xea93('0x2f')]['limit']);_0x4e45ef[_0xea93('0x22')]=qs[_0xea93('0x22')](_0x49a66e['query'][_0xea93('0x22')]);}return _0x41f607[_0xea93('0x4d')](_0x4e45ef);}})['then'](function(_0x476ea0){if(_0x476ea0){return _0x476ea0?{'count':_0xb1ae89,'rows':_0x476ea0}:null;}})[_0xea93('0x15')](respondWithResult(_0x59fbf1,null))[_0xea93('0x49')](handleError(_0x59fbf1,null));};exports['getSubjects']=function(_0xff87a8,_0x3ca3a0,_0x45af13){var _0x314f4e={};var _0x45d475={};var _0x407e2c;var _0x432cf4;return db['ZohoConfiguration'][_0xea93('0x50')]({'where':{'id':_0xff87a8[_0xea93('0x46')]['id']}})[_0xea93('0x15')](handleEntityNotFound(_0x3ca3a0,null))[_0xea93('0x15')](function(_0x413025){if(_0x413025){_0x407e2c=_0x413025;_0x45d475[_0xea93('0x2d')]=_[_0xea93('0x2e')](db[_0xea93('0x4e')][_0xea93('0x2c')]);_0x45d475[_0xea93('0x2f')]=_['keys'](_0xff87a8[_0xea93('0x2f')]);_0x45d475[_0xea93('0x32')]=_[_0xea93('0x33')](_0x45d475[_0xea93('0x2d')],_0x45d475[_0xea93('0x2f')]);_0x314f4e[_0xea93('0x34')]=_['intersection'](_0x45d475[_0xea93('0x2d')],qs[_0xea93('0x35')](_0xff87a8[_0xea93('0x2f')][_0xea93('0x35')]));_0x314f4e['attributes']=_0x314f4e[_0xea93('0x34')][_0xea93('0x36')]?_0x314f4e[_0xea93('0x34')]:_0x45d475[_0xea93('0x2d')];_0x314f4e[_0xea93('0x39')]=qs[_0xea93('0x3a')](_0xff87a8[_0xea93('0x2f')][_0xea93('0x3a')]);_0x314f4e[_0xea93('0x3b')]=qs[_0xea93('0x32')](_[_0xea93('0x3c')](_0xff87a8[_0xea93('0x2f')],_0x45d475[_0xea93('0x32')]));if(_0xff87a8[_0xea93('0x2f')][_0xea93('0x40')]){_0x314f4e[_0xea93('0x3b')]=_[_0xea93('0x3f')](_0x314f4e['where'],{'$or':_[_0xea93('0x4f')](_0x314f4e['attributes'],function(_0x1c4cfd){var _0x156805={};_0x156805[_0x1c4cfd]={'$like':'%'+_0xff87a8[_0xea93('0x2f')][_0xea93('0x40')]+'%'};return _0x156805;})});}_0x314f4e=_[_0xea93('0x3f')]({},_0x314f4e,_0xff87a8[_0xea93('0x41')]);return _0x407e2c['getSubjects'](_0x314f4e);}})[_0xea93('0x15')](function(_0x233411){if(_0x233411){_0x432cf4=_0x233411[_0xea93('0x36')];if(!_0xff87a8[_0xea93('0x2f')][_0xea93('0x37')]('nolimit')){_0x314f4e[_0xea93('0x23')]=qs[_0xea93('0x23')](_0xff87a8['query'][_0xea93('0x23')]);_0x314f4e['offset']=qs['offset'](_0xff87a8[_0xea93('0x2f')][_0xea93('0x22')]);}return _0x407e2c['getSubjects'](_0x314f4e);}})[_0xea93('0x15')](function(_0x1be241){if(_0x1be241){return _0x1be241?{'count':_0x432cf4,'rows':_0x1be241}:null;}})[_0xea93('0x15')](respondWithResult(_0x3ca3a0,null))[_0xea93('0x49')](handleError(_0x3ca3a0,null));};exports[_0xea93('0x51')]=function(_0x554499,_0x5f37b6,_0x2eadd9){var _0x1c5fc8={};var _0x99c236={};var _0x2987ee;var _0x7e3070;return db[_0xea93('0x2b')][_0xea93('0x50')]({'where':{'id':_0x554499[_0xea93('0x46')]['id']}})['then'](handleEntityNotFound(_0x5f37b6,null))['then'](function(_0x11cd30){if(_0x11cd30){_0x2987ee=_0x11cd30;_0x99c236[_0xea93('0x2d')]=_[_0xea93('0x2e')](db['ZohoField'][_0xea93('0x2c')]);_0x99c236[_0xea93('0x2f')]=_['keys'](_0x554499[_0xea93('0x2f')]);_0x99c236[_0xea93('0x32')]=_['intersection'](_0x99c236[_0xea93('0x2d')],_0x99c236[_0xea93('0x2f')]);_0x1c5fc8[_0xea93('0x34')]=_[_0xea93('0x33')](_0x99c236['model'],qs[_0xea93('0x35')](_0x554499['query']['fields']));_0x1c5fc8[_0xea93('0x34')]=_0x1c5fc8[_0xea93('0x34')]['length']?_0x1c5fc8[_0xea93('0x34')]:_0x99c236['model'];_0x1c5fc8[_0xea93('0x39')]=qs[_0xea93('0x3a')](_0x554499[_0xea93('0x2f')][_0xea93('0x3a')]);_0x1c5fc8['where']=qs[_0xea93('0x32')](_[_0xea93('0x3c')](_0x554499[_0xea93('0x2f')],_0x99c236[_0xea93('0x32')]));if(_0x554499[_0xea93('0x2f')]['filter']){_0x1c5fc8[_0xea93('0x3b')]=_['merge'](_0x1c5fc8['where'],{'$or':_[_0xea93('0x4f')](_0x1c5fc8[_0xea93('0x34')],function(_0x1b08b4){var _0x605b97={};_0x605b97[_0x1b08b4]={'$like':'%'+_0x554499['query'][_0xea93('0x40')]+'%'};return _0x605b97;})});}_0x1c5fc8=_[_0xea93('0x3f')]({},_0x1c5fc8,_0x554499[_0xea93('0x41')]);return _0x2987ee[_0xea93('0x51')](_0x1c5fc8);}})[_0xea93('0x15')](function(_0x5d2676){if(_0x5d2676){_0x7e3070=_0x5d2676[_0xea93('0x36')];if(!_0x554499[_0xea93('0x2f')][_0xea93('0x37')](_0xea93('0x38'))){_0x1c5fc8[_0xea93('0x23')]=qs[_0xea93('0x23')](_0x554499[_0xea93('0x2f')][_0xea93('0x23')]);_0x1c5fc8[_0xea93('0x22')]=qs[_0xea93('0x22')](_0x554499[_0xea93('0x2f')][_0xea93('0x22')]);}return _0x2987ee[_0xea93('0x51')](_0x1c5fc8);}})['then'](function(_0x23477d){if(_0x23477d){return _0x23477d?{'count':_0x7e3070,'rows':_0x23477d}:null;}})[_0xea93('0x15')](respondWithResult(_0x5f37b6,null))[_0xea93('0x49')](handleError(_0x5f37b6,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 453eb80..bf0f17c 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 _0x4156=['ZohoConfiguration','lodash','util','../../config/logger','api','moment','request-promise','./intZohoConfiguration.attributes','exports','define'];(function(_0x3d9981,_0x16e7ad){var _0x28d37a=function(_0x55eaeb){while(--_0x55eaeb){_0x3d9981['push'](_0x3d9981['shift']());}};_0x28d37a(++_0x16e7ad);}(_0x4156,0xf1));var _0x6415=function(_0x19309e,_0x23335e){_0x19309e=_0x19309e-0x0;var _0x50fdd0=_0x4156[_0x19309e];return _0x50fdd0;};'use strict';var _=require(_0x6415('0x0'));var util=require(_0x6415('0x1'));var logger=require(_0x6415('0x2'))(_0x6415('0x3'));var moment=require(_0x6415('0x4'));var BPromise=require('bluebird');var rp=require(_0x6415('0x5'));var attributes=require(_0x6415('0x6'));module[_0x6415('0x7')]=function(_0x25732f,_0x2c70cf){return _0x25732f[_0x6415('0x8')](_0x6415('0x9'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c64=['../../config/logger','api','moment','bluebird','request-promise','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','util'];(function(_0x20c289,_0x19374c){var _0x235ab5=function(_0x2dceb7){while(--_0x2dceb7){_0x20c289['push'](_0x20c289['shift']());}};_0x235ab5(++_0x19374c);}(_0x9c64,0x16a));var _0x49c6=function(_0x3bdd0d,_0xe20367){_0x3bdd0d=_0x3bdd0d-0x0;var _0x22e368=_0x9c64[_0x3bdd0d];return _0x22e368;};'use strict';var _=require('lodash');var util=require(_0x49c6('0x0'));var logger=require(_0x49c6('0x1'))(_0x49c6('0x2'));var moment=require(_0x49c6('0x3'));var BPromise=require(_0x49c6('0x4'));var rp=require(_0x49c6('0x5'));var attributes=require(_0x49c6('0x6'));module[_0x49c6('0x7')]=function(_0x90d380,_0x3a393a){return _0x90d380[_0x49c6('0x8')](_0x49c6('0x9'),attributes,{'tableName':_0x49c6('0xa'),'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 14ba287..866a354 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 _0xa1fb=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xa1fb,0x13b));var _0xba1f=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0xa1fb[_0x5a95fa];return _0x1a61b8;};'use strict';var _=require(_0xba1f('0x0'));var util=require(_0xba1f('0x1'));var moment=require(_0xba1f('0x2'));var BPromise=require(_0xba1f('0x3'));var rs=require(_0xba1f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xba1f('0x5'));var logger=require(_0xba1f('0x6'))(_0xba1f('0x7'));var config=require(_0xba1f('0x8'));var jayson=require(_0xba1f('0x9'));var client=jayson[_0xba1f('0xa')][_0xba1f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25bcd5,_0x3344f2,_0x339e02){return new BPromise(function(_0x155066,_0x560d91){return client[_0xba1f('0xc')](_0x25bcd5,_0x339e02)['then'](function(_0x28d102){logger[_0xba1f('0xd')](_0xba1f('0xe'),_0x3344f2,_0xba1f('0xf'));logger[_0xba1f('0x10')](_0xba1f('0x11'),_0x3344f2,'request\x20sent',JSON[_0xba1f('0x12')](_0x28d102));if(_0x28d102[_0xba1f('0x13')]){if(_0x28d102[_0xba1f('0x13')][_0xba1f('0x14')]===0x1f4){logger[_0xba1f('0x13')](_0xba1f('0xe'),_0x3344f2,_0x28d102[_0xba1f('0x13')][_0xba1f('0x15')]);return _0x560d91(_0x28d102[_0xba1f('0x13')][_0xba1f('0x15')]);}logger[_0xba1f('0x13')]('ZohoConfiguration,\x20%s,\x20%s',_0x3344f2,_0x28d102[_0xba1f('0x13')][_0xba1f('0x15')]);return _0x155066(_0x28d102[_0xba1f('0x13')][_0xba1f('0x15')]);}else{logger[_0xba1f('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x3344f2,_0xba1f('0xf'));_0x155066(_0x28d102[_0xba1f('0x16')][_0xba1f('0x15')]);}})[_0xba1f('0x17')](function(_0x10751a){logger[_0xba1f('0x13')](_0xba1f('0xe'),_0x3344f2,_0x10751a);_0x560d91(_0x10751a);});});} \ No newline at end of file +var _0x45a8=['ZohoConfiguration,\x20%s,\x20%s','message','info','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x4536d7,_0x2c14bd){var _0x268280=function(_0x36b137){while(--_0x36b137){_0x4536d7['push'](_0x4536d7['shift']());}};_0x268280(++_0x2c14bd);}(_0x45a8,0x174));var _0x845a=function(_0x3450c8,_0xba4146){_0x3450c8=_0x3450c8-0x0;var _0x14b34=_0x45a8[_0x3450c8];return _0x14b34;};'use strict';var _=require('lodash');var util=require(_0x845a('0x0'));var moment=require(_0x845a('0x1'));var BPromise=require(_0x845a('0x2'));var rs=require(_0x845a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x845a('0x4'))['db'];var utils=require(_0x845a('0x5'));var logger=require(_0x845a('0x6'))(_0x845a('0x7'));var config=require(_0x845a('0x8'));var jayson=require(_0x845a('0x9'));var client=jayson[_0x845a('0xa')][_0x845a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ed69a,_0x2502f3,_0x136a7d){return new BPromise(function(_0x214561,_0x1e8d97){return client['request'](_0x1ed69a,_0x136a7d)[_0x845a('0xc')](function(_0x3dfaf5){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x2502f3,_0x845a('0xd'));logger[_0x845a('0xe')](_0x845a('0xf'),_0x2502f3,_0x845a('0xd'),JSON[_0x845a('0x10')](_0x3dfaf5));if(_0x3dfaf5['error']){if(_0x3dfaf5['error'][_0x845a('0x11')]===0x1f4){logger[_0x845a('0x12')](_0x845a('0x13'),_0x2502f3,_0x3dfaf5[_0x845a('0x12')][_0x845a('0x14')]);return _0x1e8d97(_0x3dfaf5[_0x845a('0x12')][_0x845a('0x14')]);}logger[_0x845a('0x12')](_0x845a('0x13'),_0x2502f3,_0x3dfaf5[_0x845a('0x12')][_0x845a('0x14')]);return _0x214561(_0x3dfaf5[_0x845a('0x12')][_0x845a('0x14')]);}else{logger[_0x845a('0x15')](_0x845a('0x13'),_0x2502f3,_0x845a('0xd'));_0x214561(_0x3dfaf5[_0x845a('0x16')]['message']);}})['catch'](function(_0x517c14){logger[_0x845a('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x2502f3,_0x517c14);_0x1e8d97(_0x517c14);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 2f541f7..7ed3c55 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 _0x9376=['post','create','put','delete','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x3a6955,_0x17ebb4){var _0x1c773a=function(_0x157268){while(--_0x157268){_0x3a6955['push'](_0x3a6955['shift']());}};_0x1c773a(++_0x17ebb4);}(_0x9376,0x138));var _0x6937=function(_0x7d380,_0x4cfc67){_0x7d380=_0x7d380-0x0;var _0x385807=_0x9376[_0x7d380];return _0x385807;};'use strict';var multer=require('multer');var util=require(_0x6937('0x0'));var path=require(_0x6937('0x1'));var timeout=require('connect-timeout');var express=require(_0x6937('0x2'));var router=express['Router']();var auth=require(_0x6937('0x3'));var interaction=require(_0x6937('0x4'));var config=require(_0x6937('0x5'));var controller=require(_0x6937('0x6'));router[_0x6937('0x7')]('/',auth[_0x6937('0x8')](),controller[_0x6937('0x9')]);router[_0x6937('0x7')](_0x6937('0xa'),auth[_0x6937('0x8')](),controller[_0x6937('0xb')]);router[_0x6937('0xc')]('/',auth[_0x6937('0x8')](),controller[_0x6937('0xd')]);router[_0x6937('0xe')]('/:id',auth[_0x6937('0x8')](),controller['update']);router[_0x6937('0xf')]('/:id',auth[_0x6937('0x8')](),controller[_0x6937('0x10')]);module[_0x6937('0x11')]=router; \ No newline at end of file +var _0xfe31=['../../config/environment','./intZohoField.controller','get','isAuthenticated','/:id','post','create','put','delete','destroy','util','path','connect-timeout','express','../../components/interaction/service'];(function(_0x52ab0a,_0xf641d5){var _0x1d2cab=function(_0x47d5a1){while(--_0x47d5a1){_0x52ab0a['push'](_0x52ab0a['shift']());}};_0x1d2cab(++_0xf641d5);}(_0xfe31,0xbe));var _0x1fe3=function(_0x2f0e0e,_0x3a0741){_0x2f0e0e=_0x2f0e0e-0x0;var _0x589bd1=_0xfe31[_0x2f0e0e];return _0x589bd1;};'use strict';var multer=require('multer');var util=require(_0x1fe3('0x0'));var path=require(_0x1fe3('0x1'));var timeout=require(_0x1fe3('0x2'));var express=require(_0x1fe3('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x1fe3('0x4'));var config=require(_0x1fe3('0x5'));var controller=require(_0x1fe3('0x6'));router[_0x1fe3('0x7')]('/',auth[_0x1fe3('0x8')](),controller['index']);router['get'](_0x1fe3('0x9'),auth[_0x1fe3('0x8')](),controller['show']);router[_0x1fe3('0xa')]('/',auth[_0x1fe3('0x8')](),controller[_0x1fe3('0xb')]);router[_0x1fe3('0xc')]('/:id',auth[_0x1fe3('0x8')](),controller['update']);router[_0x1fe3('0xd')]('/:id',auth[_0x1fe3('0x8')](),controller[_0x1fe3('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 6a0dd6e..2a4b13d 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 _0xd8b0=['keyValue','string','STRING','variable','BOOLEAN','sequelize','exports','customVariable'];(function(_0x461180,_0x48f1ff){var _0x668b94=function(_0x16236b){while(--_0x16236b){_0x461180['push'](_0x461180['shift']());}};_0x668b94(++_0x48f1ff);}(_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')]={'type':{'type':Sequelize['ENUM']('string','variable',_0x0d8b('0x2'),_0x0d8b('0x3')),'defaultValue':_0x0d8b('0x4')},'content':{'type':Sequelize[_0x0d8b('0x5')]},'key':{'type':Sequelize[_0x0d8b('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0x0d8b('0x6'),_0x0d8b('0x2'))},'keyContent':{'type':Sequelize[_0x0d8b('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0d8b('0x5')]},'customField':{'type':Sequelize[_0x0d8b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9bde=['BOOLEAN','exports','string','customVariable','keyValue','STRING','ENUM'];(function(_0x9d14e3,_0x5a6072){var _0x19bf32=function(_0x19da07){while(--_0x19da07){_0x9d14e3['push'](_0x9d14e3['shift']());}};_0x19bf32(++_0x5a6072);}(_0x9bde,0xe1));var _0xe9bd=function(_0x114f45,_0x49ac1b){_0x114f45=_0x114f45-0x0;var _0x4501c9=_0x9bde[_0x114f45];return _0x4501c9;};'use strict';var Sequelize=require('sequelize');module[_0xe9bd('0x0')]={'type':{'type':Sequelize['ENUM'](_0xe9bd('0x1'),'variable',_0xe9bd('0x2'),_0xe9bd('0x3')),'defaultValue':_0xe9bd('0x1')},'content':{'type':Sequelize[_0xe9bd('0x4')]},'key':{'type':Sequelize[_0xe9bd('0x4')]},'keyType':{'type':Sequelize[_0xe9bd('0x5')](_0xe9bd('0x1'),'variable',_0xe9bd('0x2'))},'keyContent':{'type':Sequelize[_0xe9bd('0x4')]},'idField':{'type':Sequelize[_0xe9bd('0x4')]},'nameField':{'type':Sequelize[_0xe9bd('0x4')]},'customField':{'type':Sequelize[_0xe9bd('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe9bd('0x4')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 487f1ee..e327e4f 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 _0xeb7e=['params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','ZohoField','rawAttributes','query','dateStart','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','dateEnd','add','day','merge','map','filter','options','includeAll','catch','show','find','create','body'];(function(_0x3d4f90,_0x476820){var _0x58a603=function(_0x49d9fc){while(--_0x49d9fc){_0x3d4f90['push'](_0x3d4f90['shift']());}};_0x58a603(++_0x476820);}(_0xeb7e,0x1f2));var _0xeeb7=function(_0x1e5ebb,_0xc814e0){_0x1e5ebb=_0x1e5ebb-0x0;var _0x5ce1dd=_0xeb7e[_0x1e5ebb];return _0x5ce1dd;};'use strict';var pdf=require(_0xeeb7('0x0'));var emlformat=require(_0xeeb7('0x1'));var rimraf=require(_0xeeb7('0x2'));var zipdir=require(_0xeeb7('0x3'));var jsonpatch=require(_0xeeb7('0x4'));var rp=require(_0xeeb7('0x5'));var moment=require('moment');var BPromise=require(_0xeeb7('0x6'));var Mustache=require(_0xeeb7('0x7'));var util=require(_0xeeb7('0x8'));var path=require(_0xeeb7('0x9'));var sox=require(_0xeeb7('0xa'));var csv=require(_0xeeb7('0xb'));var ejs=require(_0xeeb7('0xc'));var fs=require('fs');var _=require(_0xeeb7('0xd'));var squel=require('squel');var crypto=require(_0xeeb7('0xe'));var jsforce=require(_0xeeb7('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xeeb7('0xb'));var querystring=require('querystring');var Papa=require(_0xeeb7('0x10'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xeeb7('0x11'));var utils=require(_0xeeb7('0x12'));var config=require(_0xeeb7('0x13'));var db=require(_0xeeb7('0x14'))['db'];function respondWithStatusCode(_0x28efd9,_0x4a175f){_0x4a175f=_0x4a175f||0xcc;return function(_0x158e8e){if(_0x158e8e){return _0x28efd9[_0xeeb7('0x15')](_0x4a175f);}return _0x28efd9['status'](_0x4a175f)['end']();};}function respondWithResult(_0x231a5f,_0x2b8a77){_0x2b8a77=_0x2b8a77||0xc8;return function(_0x73e27d){if(_0x73e27d){return _0x231a5f[_0xeeb7('0x16')](_0x2b8a77)[_0xeeb7('0x17')](_0x73e27d);}};}function respondWithFilteredResult(_0xa69c9d,_0x778a3c){return function(_0x4fd20e){if(_0x4fd20e){var _0x30de55=_0x4fd20e[_0xeeb7('0x18')],_0x116aa5=_0x778a3c[_0xeeb7('0x19')],_0x5581a2=_0x778a3c[_0xeeb7('0x19')]+_0x778a3c[_0xeeb7('0x1a')],_0x300988;if(_0x5581a2>=_0x30de55){_0x5581a2=_0x30de55;_0x300988=0xc8;}else{_0x300988=0xce;}_0xa69c9d[_0xeeb7('0x16')](_0x300988);return _0xa69c9d[_0xeeb7('0x1b')](_0xeeb7('0x1c'),_0x116aa5+'-'+_0x5581a2+'/'+_0x30de55)[_0xeeb7('0x17')](_0x4fd20e);}return null;};}function patchUpdates(_0x3b1ce2){return function(_0x1e6d93){try{jsonpatch[_0xeeb7('0x1d')](_0x1e6d93,_0x3b1ce2,!![]);}catch(_0xee87b1){return BPromise[_0xeeb7('0x1e')](_0xee87b1);}return _0x1e6d93['save']();};}function saveUpdates(_0x1bafa9,_0x1fa22e){return function(_0x229912){if(_0x229912){return _0x229912[_0xeeb7('0x1f')](_0x1bafa9)[_0xeeb7('0x20')](function(_0x53329d){return _0x53329d;});}return null;};}function removeEntity(_0x5050f3,_0x23571b){return function(_0x5951c3){if(_0x5951c3){return _0x5951c3[_0xeeb7('0x21')]()[_0xeeb7('0x20')](function(){_0x5050f3[_0xeeb7('0x16')](0xcc)[_0xeeb7('0x22')]();});}};}function handleEntityNotFound(_0x126bf0,_0x183c81){return function(_0xfcf47a){if(!_0xfcf47a){_0x126bf0[_0xeeb7('0x15')](0x194);}return _0xfcf47a;};}function handleError(_0x277209,_0x53fe29){_0x53fe29=_0x53fe29||0x1f4;return function(_0x80db94){logger[_0xeeb7('0x23')](_0x80db94[_0xeeb7('0x24')]);if(_0x80db94['name']){delete _0x80db94[_0xeeb7('0x25')];}_0x277209[_0xeeb7('0x16')](_0x53fe29)[_0xeeb7('0x26')](_0x80db94);};}exports[_0xeeb7('0x27')]=function(_0x5581f0,_0x1956f8){var _0x1953c8={},_0x24d338={},_0x152104={'count':0x0,'rows':[]};var _0x468ea8=db[_0xeeb7('0x28')][_0xeeb7('0x29')];_0x24d338['model']=_['keys'](_0x468ea8);var _0x4debcf={'dateStart':_0x5581f0['query']['dateStart'],'dateEnd':_0x5581f0[_0xeeb7('0x2a')]['dateEnd']};delete _0x5581f0[_0xeeb7('0x2a')][_0xeeb7('0x2b')];delete _0x5581f0[_0xeeb7('0x2a')]['dateEnd'];_0x24d338[_0xeeb7('0x2a')]=_[_0xeeb7('0x2c')](_0x5581f0[_0xeeb7('0x2a')]);_0x24d338[_0xeeb7('0x2d')]=_[_0xeeb7('0x2e')](_0x24d338[_0xeeb7('0x2f')],_0x24d338[_0xeeb7('0x2a')]);_0x1953c8[_0xeeb7('0x30')]=_[_0xeeb7('0x2e')](_0x24d338[_0xeeb7('0x2f')],qs[_0xeeb7('0x31')](_0x5581f0[_0xeeb7('0x2a')][_0xeeb7('0x31')]));_0x1953c8[_0xeeb7('0x30')]=_0x1953c8[_0xeeb7('0x30')][_0xeeb7('0x32')]?_0x1953c8[_0xeeb7('0x30')]:_0x24d338['model'];if(!_0x5581f0[_0xeeb7('0x2a')][_0xeeb7('0x33')](_0xeeb7('0x34'))){_0x1953c8[_0xeeb7('0x1a')]=qs[_0xeeb7('0x1a')](_0x5581f0[_0xeeb7('0x2a')][_0xeeb7('0x1a')]);_0x1953c8['offset']=qs[_0xeeb7('0x19')](_0x5581f0[_0xeeb7('0x2a')][_0xeeb7('0x19')]);}_0x1953c8[_0xeeb7('0x35')]=qs[_0xeeb7('0x36')](_0x5581f0['query'][_0xeeb7('0x36')]);_0x1953c8[_0xeeb7('0x37')]=qs[_0xeeb7('0x2d')](_[_0xeeb7('0x38')](_0x5581f0['query'],_0x24d338['filters']));if(_0x4debcf['dateStart']){if(_0x4debcf[_0xeeb7('0x39')]){_0x4debcf[_0xeeb7('0x39')]=moment(_0x4debcf[_0xeeb7('0x39')])[_0xeeb7('0x3a')](0x1,_0xeeb7('0x3b'));}else{_0x4debcf[_0xeeb7('0x39')]=moment(_0x4debcf[_0xeeb7('0x2b')])['add'](0x1,_0xeeb7('0x3b'));}_[_0xeeb7('0x3c')](_0x1953c8[_0xeeb7('0x37')],{'createdAt':{'$gte':_0x4debcf[_0xeeb7('0x2b')],'$lte':_0x4debcf[_0xeeb7('0x39')]}});}if(_0x5581f0['query']['filter']){_0x1953c8[_0xeeb7('0x37')]=_[_0xeeb7('0x3c')](_0x1953c8['where'],{'$or':_[_0xeeb7('0x3d')](_0x1953c8[_0xeeb7('0x30')],function(_0x1c9d3b){var _0x12d8b8={};_0x12d8b8[_0x1c9d3b]={'$like':'%'+_0x5581f0['query'][_0xeeb7('0x3e')]+'%'};return _0x12d8b8;})});}_0x1953c8=_[_0xeeb7('0x3c')]({},_0x1953c8,_0x5581f0[_0xeeb7('0x3f')]);var _0x4b0159={'where':_0x1953c8[_0xeeb7('0x37')]};return db[_0xeeb7('0x28')][_0xeeb7('0x18')](_0x4b0159)[_0xeeb7('0x20')](function(_0x42e0f5){_0x152104[_0xeeb7('0x18')]=_0x42e0f5;if(_0x5581f0['query'][_0xeeb7('0x40')]){_0x1953c8['include']=[{'all':!![]}];}return db['ZohoField']['findAll'](_0x1953c8);})[_0xeeb7('0x20')](function(_0x14f8f1){_0x152104['rows']=_0x14f8f1;return _0x152104;})[_0xeeb7('0x20')](respondWithFilteredResult(_0x1956f8,_0x1953c8))[_0xeeb7('0x41')](handleError(_0x1956f8,null));};exports[_0xeeb7('0x42')]=function(_0x1d150b,_0x51769c){var _0x2817f1={'raw':!![],'where':{'id':_0x1d150b['params']['id']}},_0x3aa9e6={};_0x3aa9e6[_0xeeb7('0x2f')]=_['keys'](db['ZohoField']['rawAttributes']);_0x3aa9e6[_0xeeb7('0x2a')]=_[_0xeeb7('0x2c')](_0x1d150b[_0xeeb7('0x2a')]);_0x3aa9e6[_0xeeb7('0x2d')]=_[_0xeeb7('0x2e')](_0x3aa9e6[_0xeeb7('0x2f')],_0x3aa9e6[_0xeeb7('0x2a')]);_0x2817f1[_0xeeb7('0x30')]=_['intersection'](_0x3aa9e6['model'],qs[_0xeeb7('0x31')](_0x1d150b[_0xeeb7('0x2a')][_0xeeb7('0x31')]));_0x2817f1[_0xeeb7('0x30')]=_0x2817f1[_0xeeb7('0x30')][_0xeeb7('0x32')]?_0x2817f1[_0xeeb7('0x30')]:_0x3aa9e6['model'];if(_0x1d150b[_0xeeb7('0x2a')][_0xeeb7('0x40')]){_0x2817f1['include']=[{'all':!![]}];}_0x2817f1=_[_0xeeb7('0x3c')]({},_0x2817f1,_0x1d150b[_0xeeb7('0x3f')]);return db[_0xeeb7('0x28')][_0xeeb7('0x43')](_0x2817f1)[_0xeeb7('0x20')](handleEntityNotFound(_0x51769c,null))[_0xeeb7('0x20')](respondWithResult(_0x51769c,null))[_0xeeb7('0x41')](handleError(_0x51769c,null));};exports['create']=function(_0x20629f,_0x45bc0c){return db[_0xeeb7('0x28')][_0xeeb7('0x44')](_0x20629f['body'],{})[_0xeeb7('0x20')](respondWithResult(_0x45bc0c,0xc9))[_0xeeb7('0x41')](handleError(_0x45bc0c,null));};exports['update']=function(_0x32a96f,_0x461980){if(_0x32a96f[_0xeeb7('0x45')]['id']){delete _0x32a96f[_0xeeb7('0x45')]['id'];}return db[_0xeeb7('0x28')][_0xeeb7('0x43')]({'where':{'id':_0x32a96f[_0xeeb7('0x46')]['id']}})[_0xeeb7('0x20')](handleEntityNotFound(_0x461980,null))[_0xeeb7('0x20')](saveUpdates(_0x32a96f[_0xeeb7('0x45')],null))[_0xeeb7('0x20')](respondWithResult(_0x461980,null))['catch'](handleError(_0x461980,null));};exports['destroy']=function(_0x1f28be,_0xdeab2b){return db['ZohoField']['find']({'where':{'id':_0x1f28be['params']['id']}})[_0xeeb7('0x20')](handleEntityNotFound(_0xdeab2b,null))[_0xeeb7('0x20')](removeEntity(_0xdeab2b,null))[_0xeeb7('0x41')](handleError(_0xdeab2b,null));}; \ No newline at end of file +var _0xc316=['sendStatus','error','name','send','ZohoField','model','keys','dateStart','dateEnd','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','day','add','where','filter','merge','map','options','includeAll','include','rows','show','params','rawAttributes','find','create','body','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','reject','save','update','destroy','then'];(function(_0x12c136,_0x3b6328){var _0x27cd6b=function(_0xd49d5c){while(--_0xd49d5c){_0x12c136['push'](_0x12c136['shift']());}};_0x27cd6b(++_0x3b6328);}(_0xc316,0x6e));var _0x6c31=function(_0x46a197,_0xbab470){_0x46a197=_0x46a197-0x0;var _0x441b75=_0xc316[_0x46a197];return _0x441b75;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6c31('0x0'));var zipdir=require(_0x6c31('0x1'));var jsonpatch=require(_0x6c31('0x2'));var rp=require(_0x6c31('0x3'));var moment=require(_0x6c31('0x4'));var BPromise=require(_0x6c31('0x5'));var Mustache=require(_0x6c31('0x6'));var util=require(_0x6c31('0x7'));var path=require(_0x6c31('0x8'));var sox=require(_0x6c31('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6c31('0xa'));var squel=require(_0x6c31('0xb'));var crypto=require(_0x6c31('0xc'));var jsforce=require(_0x6c31('0xd'));var deskjs=require(_0x6c31('0xe'));var toCsv=require(_0x6c31('0xf'));var querystring=require(_0x6c31('0x10'));var Papa=require(_0x6c31('0x11'));var Redis=require(_0x6c31('0x12'));var qs=require(_0x6c31('0x13'));var logger=require(_0x6c31('0x14'))('api');var utils=require(_0x6c31('0x15'));var config=require(_0x6c31('0x16'));var db=require(_0x6c31('0x17'))['db'];function respondWithStatusCode(_0x1b9770,_0x233e6d){_0x233e6d=_0x233e6d||0xcc;return function(_0x1af530){if(_0x1af530){return _0x1b9770['sendStatus'](_0x233e6d);}return _0x1b9770[_0x6c31('0x18')](_0x233e6d)[_0x6c31('0x19')]();};}function respondWithResult(_0x1911d3,_0x3af6d0){_0x3af6d0=_0x3af6d0||0xc8;return function(_0x4e9b8d){if(_0x4e9b8d){return _0x1911d3[_0x6c31('0x18')](_0x3af6d0)[_0x6c31('0x1a')](_0x4e9b8d);}};}function respondWithFilteredResult(_0x1f7d47,_0x249c04){return function(_0x331cd0){if(_0x331cd0){var _0x23673f=_0x331cd0[_0x6c31('0x1b')],_0x23e61b=_0x249c04[_0x6c31('0x1c')],_0x5ce275=_0x249c04[_0x6c31('0x1c')]+_0x249c04['limit'],_0x3195dc;if(_0x5ce275>=_0x23673f){_0x5ce275=_0x23673f;_0x3195dc=0xc8;}else{_0x3195dc=0xce;}_0x1f7d47[_0x6c31('0x18')](_0x3195dc);return _0x1f7d47['set']('Content-Range',_0x23e61b+'-'+_0x5ce275+'/'+_0x23673f)[_0x6c31('0x1a')](_0x331cd0);}return null;};}function patchUpdates(_0x3bf865){return function(_0x51bd9c){try{jsonpatch['apply'](_0x51bd9c,_0x3bf865,!![]);}catch(_0x1eed2e){return BPromise[_0x6c31('0x1d')](_0x1eed2e);}return _0x51bd9c[_0x6c31('0x1e')]();};}function saveUpdates(_0x33f54d,_0x8bc9fb){return function(_0x550217){if(_0x550217){return _0x550217[_0x6c31('0x1f')](_0x33f54d)['then'](function(_0x34b636){return _0x34b636;});}return null;};}function removeEntity(_0x1d984d,_0x582c00){return function(_0x1673d6){if(_0x1673d6){return _0x1673d6[_0x6c31('0x20')]()[_0x6c31('0x21')](function(){_0x1d984d['status'](0xcc)[_0x6c31('0x19')]();});}};}function handleEntityNotFound(_0x1b4ef7,_0x364b78){return function(_0x4c5f5f){if(!_0x4c5f5f){_0x1b4ef7[_0x6c31('0x22')](0x194);}return _0x4c5f5f;};}function handleError(_0x1255f1,_0x3f7116){_0x3f7116=_0x3f7116||0x1f4;return function(_0x36b588){logger[_0x6c31('0x23')](_0x36b588['stack']);if(_0x36b588[_0x6c31('0x24')]){delete _0x36b588[_0x6c31('0x24')];}_0x1255f1['status'](_0x3f7116)[_0x6c31('0x25')](_0x36b588);};}exports['index']=function(_0x372b68,_0x2baacd){var _0x3e25cc={},_0x513d1b={},_0x5e2c39={'count':0x0,'rows':[]};var _0xf7da56=db[_0x6c31('0x26')]['rawAttributes'];_0x513d1b[_0x6c31('0x27')]=_[_0x6c31('0x28')](_0xf7da56);var _0x18be46={'dateStart':_0x372b68['query'][_0x6c31('0x29')],'dateEnd':_0x372b68['query'][_0x6c31('0x2a')]};delete _0x372b68[_0x6c31('0x2b')]['dateStart'];delete _0x372b68[_0x6c31('0x2b')]['dateEnd'];_0x513d1b[_0x6c31('0x2b')]=_[_0x6c31('0x28')](_0x372b68[_0x6c31('0x2b')]);_0x513d1b[_0x6c31('0x2c')]=_[_0x6c31('0x2d')](_0x513d1b['model'],_0x513d1b[_0x6c31('0x2b')]);_0x3e25cc[_0x6c31('0x2e')]=_['intersection'](_0x513d1b['model'],qs['fields'](_0x372b68[_0x6c31('0x2b')][_0x6c31('0x2f')]));_0x3e25cc[_0x6c31('0x2e')]=_0x3e25cc[_0x6c31('0x2e')][_0x6c31('0x30')]?_0x3e25cc[_0x6c31('0x2e')]:_0x513d1b[_0x6c31('0x27')];if(!_0x372b68[_0x6c31('0x2b')][_0x6c31('0x31')](_0x6c31('0x32'))){_0x3e25cc['limit']=qs[_0x6c31('0x33')](_0x372b68[_0x6c31('0x2b')][_0x6c31('0x33')]);_0x3e25cc[_0x6c31('0x1c')]=qs['offset'](_0x372b68['query'][_0x6c31('0x1c')]);}_0x3e25cc[_0x6c31('0x34')]=qs[_0x6c31('0x35')](_0x372b68[_0x6c31('0x2b')][_0x6c31('0x35')]);_0x3e25cc['where']=qs['filters'](_[_0x6c31('0x36')](_0x372b68[_0x6c31('0x2b')],_0x513d1b[_0x6c31('0x2c')]));if(_0x18be46[_0x6c31('0x29')]){if(_0x18be46[_0x6c31('0x2a')]){_0x18be46[_0x6c31('0x2a')]=moment(_0x18be46['dateEnd'])['add'](0x1,_0x6c31('0x37'));}else{_0x18be46['dateEnd']=moment(_0x18be46[_0x6c31('0x29')])[_0x6c31('0x38')](0x1,_0x6c31('0x37'));}_['merge'](_0x3e25cc[_0x6c31('0x39')],{'createdAt':{'$gte':_0x18be46[_0x6c31('0x29')],'$lte':_0x18be46[_0x6c31('0x2a')]}});}if(_0x372b68[_0x6c31('0x2b')][_0x6c31('0x3a')]){_0x3e25cc['where']=_[_0x6c31('0x3b')](_0x3e25cc['where'],{'$or':_[_0x6c31('0x3c')](_0x3e25cc[_0x6c31('0x2e')],function(_0xed0e71){var _0x5d4c0a={};_0x5d4c0a[_0xed0e71]={'$like':'%'+_0x372b68[_0x6c31('0x2b')][_0x6c31('0x3a')]+'%'};return _0x5d4c0a;})});}_0x3e25cc=_[_0x6c31('0x3b')]({},_0x3e25cc,_0x372b68[_0x6c31('0x3d')]);var _0x5a230a={'where':_0x3e25cc[_0x6c31('0x39')]};return db[_0x6c31('0x26')][_0x6c31('0x1b')](_0x5a230a)['then'](function(_0x5af598){_0x5e2c39[_0x6c31('0x1b')]=_0x5af598;if(_0x372b68[_0x6c31('0x2b')][_0x6c31('0x3e')]){_0x3e25cc[_0x6c31('0x3f')]=[{'all':!![]}];}return db[_0x6c31('0x26')]['findAll'](_0x3e25cc);})[_0x6c31('0x21')](function(_0x220f5d){_0x5e2c39[_0x6c31('0x40')]=_0x220f5d;return _0x5e2c39;})[_0x6c31('0x21')](respondWithFilteredResult(_0x2baacd,_0x3e25cc))['catch'](handleError(_0x2baacd,null));};exports[_0x6c31('0x41')]=function(_0x39339a,_0x7be384){var _0x3144ed={'raw':!![],'where':{'id':_0x39339a[_0x6c31('0x42')]['id']}},_0x3150f6={};_0x3150f6[_0x6c31('0x27')]=_[_0x6c31('0x28')](db['ZohoField'][_0x6c31('0x43')]);_0x3150f6[_0x6c31('0x2b')]=_[_0x6c31('0x28')](_0x39339a['query']);_0x3150f6['filters']=_[_0x6c31('0x2d')](_0x3150f6[_0x6c31('0x27')],_0x3150f6[_0x6c31('0x2b')]);_0x3144ed[_0x6c31('0x2e')]=_['intersection'](_0x3150f6[_0x6c31('0x27')],qs[_0x6c31('0x2f')](_0x39339a[_0x6c31('0x2b')]['fields']));_0x3144ed['attributes']=_0x3144ed[_0x6c31('0x2e')]['length']?_0x3144ed[_0x6c31('0x2e')]:_0x3150f6[_0x6c31('0x27')];if(_0x39339a['query']['includeAll']){_0x3144ed['include']=[{'all':!![]}];}_0x3144ed=_[_0x6c31('0x3b')]({},_0x3144ed,_0x39339a['options']);return db[_0x6c31('0x26')][_0x6c31('0x44')](_0x3144ed)['then'](handleEntityNotFound(_0x7be384,null))[_0x6c31('0x21')](respondWithResult(_0x7be384,null))['catch'](handleError(_0x7be384,null));};exports['create']=function(_0x149f28,_0x2027b7){return db[_0x6c31('0x26')][_0x6c31('0x45')](_0x149f28[_0x6c31('0x46')],{})[_0x6c31('0x21')](respondWithResult(_0x2027b7,0xc9))['catch'](handleError(_0x2027b7,null));};exports[_0x6c31('0x1f')]=function(_0x39709b,_0x55d4bf){if(_0x39709b['body']['id']){delete _0x39709b[_0x6c31('0x46')]['id'];}return db[_0x6c31('0x26')][_0x6c31('0x44')]({'where':{'id':_0x39709b[_0x6c31('0x42')]['id']}})['then'](handleEntityNotFound(_0x55d4bf,null))[_0x6c31('0x21')](saveUpdates(_0x39709b[_0x6c31('0x46')],null))[_0x6c31('0x21')](respondWithResult(_0x55d4bf,null))['catch'](handleError(_0x55d4bf,null));};exports[_0x6c31('0x20')]=function(_0x401470,_0x2a6c3f){return db[_0x6c31('0x26')][_0x6c31('0x44')]({'where':{'id':_0x401470[_0x6c31('0x42')]['id']}})[_0x6c31('0x21')](handleEntityNotFound(_0x2a6c3f,null))[_0x6c31('0x21')](removeEntity(_0x2a6c3f,null))[_0x6c31('0x47')](handleError(_0x2a6c3f,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 3ef7fd1..eab0f4e 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 _0x67e1=['int_zoho_fields','util','../../config/logger','api','moment','request-promise','exports','define','ZohoField'];(function(_0x29ee89,_0x14a9e3){var _0x58d509=function(_0x5872d1){while(--_0x5872d1){_0x29ee89['push'](_0x29ee89['shift']());}};_0x58d509(++_0x14a9e3);}(_0x67e1,0x10f));var _0x167e=function(_0x3ae21f,_0x5cf9e5){_0x3ae21f=_0x3ae21f-0x0;var _0x11aa19=_0x67e1[_0x3ae21f];return _0x11aa19;};'use strict';var _=require('lodash');var util=require(_0x167e('0x0'));var logger=require(_0x167e('0x1'))(_0x167e('0x2'));var moment=require(_0x167e('0x3'));var BPromise=require('bluebird');var rp=require(_0x167e('0x4'));var attributes=require('./intZohoField.attributes');module[_0x167e('0x5')]=function(_0x1aa8c5,_0x16ccef){return _0x1aa8c5[_0x167e('0x6')](_0x167e('0x7'),attributes,{'tableName':_0x167e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fda=['../../config/logger','api','moment','bluebird','request-promise','exports','define','ZohoField','int_zoho_fields','lodash'];(function(_0x6b6b12,_0x438868){var _0x2bf806=function(_0x3f2ca6){while(--_0x3f2ca6){_0x6b6b12['push'](_0x6b6b12['shift']());}};_0x2bf806(++_0x438868);}(_0x5fda,0x10d));var _0xa5fd=function(_0x38e901,_0x19814e){_0x38e901=_0x38e901-0x0;var _0x1366dc=_0x5fda[_0x38e901];return _0x1366dc;};'use strict';var _=require(_0xa5fd('0x0'));var util=require('util');var logger=require(_0xa5fd('0x1'))(_0xa5fd('0x2'));var moment=require(_0xa5fd('0x3'));var BPromise=require(_0xa5fd('0x4'));var rp=require(_0xa5fd('0x5'));var attributes=require('./intZohoField.attributes');module[_0xa5fd('0x6')]=function(_0x4b9d4c,_0x424060){return _0x4b9d4c[_0xa5fd('0x7')](_0xa5fd('0x8'),attributes,{'tableName':_0xa5fd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 0d85289..ace6c45 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 _0xf5ee=['ZohoField,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x29272f,_0x166a7a){var _0x677a00=function(_0x419a0d){while(--_0x419a0d){_0x29272f['push'](_0x29272f['shift']());}};_0x677a00(++_0x166a7a);}(_0xf5ee,0xb7));var _0xef5e=function(_0x385ba1,_0x380b3c){_0x385ba1=_0x385ba1-0x0;var _0x5472b6=_0xf5ee[_0x385ba1];return _0x5472b6;};'use strict';var _=require('lodash');var util=require(_0xef5e('0x0'));var moment=require(_0xef5e('0x1'));var BPromise=require(_0xef5e('0x2'));var rs=require(_0xef5e('0x3'));var fs=require('fs');var Redis=require(_0xef5e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xef5e('0x5'))(_0xef5e('0x6'));var config=require('../../config/environment');var jayson=require(_0xef5e('0x7'));var client=jayson[_0xef5e('0x8')][_0xef5e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5383ae,_0x4167fa,_0x45a25e){return new BPromise(function(_0x73e5e1,_0x56fa3d){return client['request'](_0x5383ae,_0x45a25e)[_0xef5e('0xa')](function(_0x39e1ee){logger[_0xef5e('0xb')]('ZohoField,\x20%s,\x20%s',_0x4167fa,_0xef5e('0xc'));logger[_0xef5e('0xd')](_0xef5e('0xe'),_0x4167fa,'request\x20sent',JSON['stringify'](_0x39e1ee));if(_0x39e1ee[_0xef5e('0xf')]){if(_0x39e1ee[_0xef5e('0xf')][_0xef5e('0x10')]===0x1f4){logger[_0xef5e('0xf')](_0xef5e('0x11'),_0x4167fa,_0x39e1ee[_0xef5e('0xf')][_0xef5e('0x12')]);return _0x56fa3d(_0x39e1ee[_0xef5e('0xf')][_0xef5e('0x12')]);}logger[_0xef5e('0xf')](_0xef5e('0x11'),_0x4167fa,_0x39e1ee[_0xef5e('0xf')][_0xef5e('0x12')]);return _0x73e5e1(_0x39e1ee[_0xef5e('0xf')]['message']);}else{logger[_0xef5e('0xb')](_0xef5e('0x11'),_0x4167fa,_0xef5e('0xc'));_0x73e5e1(_0x39e1ee['result'][_0xef5e('0x12')]);}})[_0xef5e('0x13')](function(_0x12d35d){logger['error'](_0xef5e('0x11'),_0x4167fa,_0x12d35d);_0x56fa3d(_0x12d35d);});});} \ No newline at end of file +var _0xa1cc=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x507354,_0x436093){var _0x56bc5b=function(_0x28767d){while(--_0x28767d){_0x507354['push'](_0x507354['shift']());}};_0x56bc5b(++_0x436093);}(_0xa1cc,0x120));var _0xca1c=function(_0x3c45be,_0x47a6b2){_0x3c45be=_0x3c45be-0x0;var _0x35ed2e=_0xa1cc[_0x3c45be];return _0x35ed2e;};'use strict';var _=require(_0xca1c('0x0'));var util=require(_0xca1c('0x1'));var moment=require(_0xca1c('0x2'));var BPromise=require('bluebird');var rs=require(_0xca1c('0x3'));var fs=require('fs');var Redis=require(_0xca1c('0x4'));var db=require(_0xca1c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xca1c('0x6'))(_0xca1c('0x7'));var config=require(_0xca1c('0x8'));var jayson=require(_0xca1c('0x9'));var client=jayson[_0xca1c('0xa')][_0xca1c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28b7dd,_0x3335f7,_0x5abcc0){return new BPromise(function(_0x1183a1,_0x5c941e){return client[_0xca1c('0xc')](_0x28b7dd,_0x5abcc0)[_0xca1c('0xd')](function(_0x19f0fd){logger[_0xca1c('0xe')](_0xca1c('0xf'),_0x3335f7,_0xca1c('0x10'));logger['debug'](_0xca1c('0x11'),_0x3335f7,'request\x20sent',JSON[_0xca1c('0x12')](_0x19f0fd));if(_0x19f0fd[_0xca1c('0x13')]){if(_0x19f0fd[_0xca1c('0x13')][_0xca1c('0x14')]===0x1f4){logger[_0xca1c('0x13')]('ZohoField,\x20%s,\x20%s',_0x3335f7,_0x19f0fd[_0xca1c('0x13')][_0xca1c('0x15')]);return _0x5c941e(_0x19f0fd[_0xca1c('0x13')][_0xca1c('0x15')]);}logger[_0xca1c('0x13')](_0xca1c('0xf'),_0x3335f7,_0x19f0fd[_0xca1c('0x13')][_0xca1c('0x15')]);return _0x1183a1(_0x19f0fd[_0xca1c('0x13')][_0xca1c('0x15')]);}else{logger['info']('ZohoField,\x20%s,\x20%s',_0x3335f7,'request\x20sent');_0x1183a1(_0x19f0fd[_0xca1c('0x16')][_0xca1c('0x15')]);}})[_0xca1c('0x17')](function(_0x3d44f4){logger[_0xca1c('0x13')](_0xca1c('0xf'),_0x3335f7,_0x3d44f4);_0x5c941e(_0x3d44f4);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index db59a8f..6fdc1ec 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 _0xc1db=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xc1db,0x120));var _0xbc1d=function(_0x240434,_0x35d8c0){_0x240434=_0x240434-0x0;var _0xfde221=_0xc1db[_0x240434];return _0xfde221;};'use strict';var multer=require(_0xbc1d('0x0'));var util=require('util');var path=require(_0xbc1d('0x1'));var timeout=require(_0xbc1d('0x2'));var express=require(_0xbc1d('0x3'));var router=express[_0xbc1d('0x4')]();var auth=require(_0xbc1d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbc1d('0x6'));module[_0xbc1d('0x7')]=router; \ No newline at end of file +var _0xcf98=['exports','util','path','connect-timeout','express','Router','../../config/environment'];(function(_0x4c7252,_0x49ba2c){var _0x483069=function(_0x3d487a){while(--_0x3d487a){_0x4c7252['push'](_0x4c7252['shift']());}};_0x483069(++_0x49ba2c);}(_0xcf98,0x8d));var _0x8cf9=function(_0x2d6db4,_0x2e8aaf){_0x2d6db4=_0x2d6db4-0x0;var _0x2d2db2=_0xcf98[_0x2d6db4];return _0x2d2db2;};'use strict';var multer=require('multer');var util=require(_0x8cf9('0x0'));var path=require(_0x8cf9('0x1'));var timeout=require(_0x8cf9('0x2'));var express=require(_0x8cf9('0x3'));var router=express[_0x8cf9('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8cf9('0x5'));module[_0x8cf9('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 584b7a5..d520ab0 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 _0x6671=['unique_name_and_version','app.js','BOOLEAN','state','sequelize','exports','STRING'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x6671,0x170));var _0x1667=function(_0x1d541e,_0x83d56){_0x1d541e=_0x1d541e-0x0;var _0x47f916=_0x6671[_0x1d541e];return _0x47f916;};'use strict';var Sequelize=require(_0x1667('0x0'));module[_0x1667('0x1')]={'name':{'type':Sequelize[_0x1667('0x2')],'allowNull':![],'unique':_0x1667('0x3')},'version':{'type':Sequelize[_0x1667('0x2')],'allowNull':![],'unique':_0x1667('0x3')},'main':{'type':Sequelize[_0x1667('0x2')],'defaultValue':_0x1667('0x4')},'filename':{'type':Sequelize[_0x1667('0x2')]},'path':{'type':Sequelize[_0x1667('0x2')]},'type':{'type':Sequelize[_0x1667('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x1667('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x1667('0x2')]},'logo':{'type':Sequelize[_0x1667('0x2')]},'state':{'type':Sequelize[_0x1667('0x2')],'unique':_0x1667('0x6')},'description':{'type':Sequelize[_0x1667('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1667('0x2')]},'link':{'type':Sequelize[_0x1667('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x8e05=['unique_name_and_version','STRING','app.js','INTEGER','BOOLEAN','state','sequelize','exports'];(function(_0x30c7cf,_0x4265b0){var _0x270af4=function(_0x29125c){while(--_0x29125c){_0x30c7cf['push'](_0x30c7cf['shift']());}};_0x270af4(++_0x4265b0);}(_0x8e05,0x12e));var _0x58e0=function(_0x575b72,_0x1a7eb1){_0x575b72=_0x575b72-0x0;var _0x561c57=_0x8e05[_0x575b72];return _0x561c57;};'use strict';var Sequelize=require(_0x58e0('0x0'));module[_0x58e0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x58e0('0x2')},'version':{'type':Sequelize[_0x58e0('0x3')],'allowNull':![],'unique':_0x58e0('0x2')},'main':{'type':Sequelize[_0x58e0('0x3')],'defaultValue':_0x58e0('0x4')},'filename':{'type':Sequelize[_0x58e0('0x3')]},'path':{'type':Sequelize[_0x58e0('0x3')]},'type':{'type':Sequelize[_0x58e0('0x3')]},'size':{'type':Sequelize[_0x58e0('0x5')]},'active':{'type':Sequelize[_0x58e0('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x58e0('0x3')],'unique':_0x58e0('0x7')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x58e0('0x3')]},'remoteUri':{'type':Sequelize[_0x58e0('0x3')]},'link':{'type':Sequelize[_0x58e0('0x3')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 4000f2d..39d423d 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 _0x28a2=['name','index','keys','dateStart','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','dateEnd','add','day','merge','map','filter','Integration','includeAll','include','findAll','rows','params','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','error','stack'];(function(_0x49bbd0,_0x112058){var _0x520690=function(_0x5d0c1f){while(--_0x5d0c1f){_0x49bbd0['push'](_0x49bbd0['shift']());}};_0x520690(++_0x112058);}(_0x28a2,0x141));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x228a('0x0'));var emlformat=require(_0x228a('0x1'));var rimraf=require(_0x228a('0x2'));var zipdir=require(_0x228a('0x3'));var jsonpatch=require(_0x228a('0x4'));var rp=require(_0x228a('0x5'));var moment=require(_0x228a('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x228a('0x7'));var util=require('util');var path=require(_0x228a('0x8'));var sox=require(_0x228a('0x9'));var csv=require(_0x228a('0xa'));var ejs=require(_0x228a('0xb'));var fs=require('fs');var _=require(_0x228a('0xc'));var squel=require('squel');var crypto=require(_0x228a('0xd'));var jsforce=require(_0x228a('0xe'));var deskjs=require(_0x228a('0xf'));var toCsv=require(_0x228a('0xa'));var querystring=require('querystring');var Papa=require(_0x228a('0x10'));var Redis=require(_0x228a('0x11'));var qs=require(_0x228a('0x12'));var logger=require(_0x228a('0x13'))(_0x228a('0x14'));var utils=require(_0x228a('0x15'));var config=require(_0x228a('0x16'));var db=require(_0x228a('0x17'))['db'];function respondWithStatusCode(_0x5b74cb,_0x4e685c){_0x4e685c=_0x4e685c||0xcc;return function(_0x560cfd){if(_0x560cfd){return _0x5b74cb[_0x228a('0x18')](_0x4e685c);}return _0x5b74cb[_0x228a('0x19')](_0x4e685c)[_0x228a('0x1a')]();};}function respondWithResult(_0x128af1,_0x23d138){_0x23d138=_0x23d138||0xc8;return function(_0x561324){if(_0x561324){return _0x128af1[_0x228a('0x19')](_0x23d138)[_0x228a('0x1b')](_0x561324);}};}function respondWithFilteredResult(_0x45f1b2,_0x53ff6d){return function(_0x515e79){if(_0x515e79){var _0x2956a9=_0x515e79[_0x228a('0x1c')],_0xdcc2c3=_0x53ff6d[_0x228a('0x1d')],_0x11ffa3=_0x53ff6d[_0x228a('0x1d')]+_0x53ff6d[_0x228a('0x1e')],_0x2e4f17;if(_0x11ffa3>=_0x2956a9){_0x11ffa3=_0x2956a9;_0x2e4f17=0xc8;}else{_0x2e4f17=0xce;}_0x45f1b2['status'](_0x2e4f17);return _0x45f1b2[_0x228a('0x1f')]('Content-Range',_0xdcc2c3+'-'+_0x11ffa3+'/'+_0x2956a9)[_0x228a('0x1b')](_0x515e79);}return null;};}function patchUpdates(_0x2c764e){return function(_0x16c281){try{jsonpatch[_0x228a('0x20')](_0x16c281,_0x2c764e,!![]);}catch(_0x492595){return BPromise['reject'](_0x492595);}return _0x16c281[_0x228a('0x21')]();};}function saveUpdates(_0x34a7cf,_0x4d12ce){return function(_0x2d12c6){if(_0x2d12c6){return _0x2d12c6[_0x228a('0x22')](_0x34a7cf)[_0x228a('0x23')](function(_0x1b0f7e){return _0x1b0f7e;});}return null;};}function removeEntity(_0x256cb9,_0x2f0f30){return function(_0x52c33a){if(_0x52c33a){return _0x52c33a[_0x228a('0x24')]()['then'](function(){_0x256cb9[_0x228a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b138f,_0x2925){return function(_0x3c14ca){if(!_0x3c14ca){_0x1b138f[_0x228a('0x18')](0x194);}return _0x3c14ca;};}function handleError(_0x1c2b93,_0x386a66){_0x386a66=_0x386a66||0x1f4;return function(_0x104c80){logger[_0x228a('0x25')](_0x104c80[_0x228a('0x26')]);if(_0x104c80[_0x228a('0x27')]){delete _0x104c80[_0x228a('0x27')];}_0x1c2b93['status'](_0x386a66)['send'](_0x104c80);};}exports[_0x228a('0x28')]=function(_0x2f5ce3,_0x2c1ef1){var _0x4c893e={},_0x22b499={},_0x148a62={'count':0x0,'rows':[]};var _0x28e4d6=db['Integration']['rawAttributes'];_0x22b499['model']=_[_0x228a('0x29')](_0x28e4d6);var _0x196f7={'dateStart':_0x2f5ce3['query'][_0x228a('0x2a')],'dateEnd':_0x2f5ce3[_0x228a('0x2b')]['dateEnd']};delete _0x2f5ce3['query'][_0x228a('0x2a')];delete _0x2f5ce3[_0x228a('0x2b')]['dateEnd'];_0x22b499['query']=_[_0x228a('0x29')](_0x2f5ce3['query']);_0x22b499[_0x228a('0x2c')]=_[_0x228a('0x2d')](_0x22b499[_0x228a('0x2e')],_0x22b499[_0x228a('0x2b')]);_0x4c893e['attributes']=_[_0x228a('0x2d')](_0x22b499[_0x228a('0x2e')],qs['fields'](_0x2f5ce3[_0x228a('0x2b')][_0x228a('0x2f')]));_0x4c893e[_0x228a('0x30')]=_0x4c893e[_0x228a('0x30')][_0x228a('0x31')]?_0x4c893e[_0x228a('0x30')]:_0x22b499[_0x228a('0x2e')];if(!_0x2f5ce3[_0x228a('0x2b')][_0x228a('0x32')](_0x228a('0x33'))){_0x4c893e['limit']=qs[_0x228a('0x1e')](_0x2f5ce3[_0x228a('0x2b')][_0x228a('0x1e')]);_0x4c893e['offset']=qs[_0x228a('0x1d')](_0x2f5ce3[_0x228a('0x2b')][_0x228a('0x1d')]);}_0x4c893e[_0x228a('0x34')]=qs['sort'](_0x2f5ce3['query'][_0x228a('0x35')]);_0x4c893e[_0x228a('0x36')]=qs['filters'](_[_0x228a('0x37')](_0x2f5ce3['query'],_0x22b499[_0x228a('0x2c')]));if(_0x196f7[_0x228a('0x2a')]){if(_0x196f7[_0x228a('0x38')]){_0x196f7['dateEnd']=moment(_0x196f7[_0x228a('0x38')])[_0x228a('0x39')](0x1,_0x228a('0x3a'));}else{_0x196f7['dateEnd']=moment(_0x196f7[_0x228a('0x2a')])[_0x228a('0x39')](0x1,_0x228a('0x3a'));}_[_0x228a('0x3b')](_0x4c893e[_0x228a('0x36')],{'createdAt':{'$gte':_0x196f7[_0x228a('0x2a')],'$lte':_0x196f7['dateEnd']}});}if(_0x2f5ce3['query']['filter']){_0x4c893e['where']=_[_0x228a('0x3b')](_0x4c893e[_0x228a('0x36')],{'$or':_[_0x228a('0x3c')](_0x4c893e[_0x228a('0x30')],function(_0x685351){var _0x48e81e={};_0x48e81e[_0x685351]={'$like':'%'+_0x2f5ce3['query'][_0x228a('0x3d')]+'%'};return _0x48e81e;})});}_0x4c893e=_['merge']({},_0x4c893e,_0x2f5ce3['options']);var _0xa0664d={'where':_0x4c893e['where']};return db[_0x228a('0x3e')][_0x228a('0x1c')](_0xa0664d)[_0x228a('0x23')](function(_0x639ca8){_0x148a62[_0x228a('0x1c')]=_0x639ca8;if(_0x2f5ce3[_0x228a('0x2b')][_0x228a('0x3f')]){_0x4c893e[_0x228a('0x40')]=[{'all':!![]}];}return db[_0x228a('0x3e')][_0x228a('0x41')](_0x4c893e);})[_0x228a('0x23')](function(_0x393952){_0x148a62[_0x228a('0x42')]=_0x393952;return _0x148a62;})[_0x228a('0x23')](respondWithFilteredResult(_0x2c1ef1,_0x4c893e))['catch'](handleError(_0x2c1ef1,null));};exports['show']=function(_0x442200,_0x3d221d){var _0x1b8a3c={'raw':![],'where':{'id':_0x442200[_0x228a('0x43')]['id']}},_0x346011={};_0x346011[_0x228a('0x2e')]=_[_0x228a('0x29')](db[_0x228a('0x3e')]['rawAttributes']);_0x346011[_0x228a('0x2b')]=_[_0x228a('0x29')](_0x442200[_0x228a('0x2b')]);_0x346011[_0x228a('0x2c')]=_['intersection'](_0x346011['model'],_0x346011['query']);_0x1b8a3c[_0x228a('0x30')]=_[_0x228a('0x2d')](_0x346011[_0x228a('0x2e')],qs[_0x228a('0x2f')](_0x442200[_0x228a('0x2b')][_0x228a('0x2f')]));_0x1b8a3c[_0x228a('0x30')]=_0x1b8a3c[_0x228a('0x30')]['length']?_0x1b8a3c['attributes']:_0x346011['model'];if(_0x442200[_0x228a('0x2b')][_0x228a('0x3f')]){_0x1b8a3c[_0x228a('0x40')]=[{'all':!![]}];}_0x1b8a3c=_[_0x228a('0x3b')]({},_0x1b8a3c,_0x442200['options']);return db[_0x228a('0x3e')][_0x228a('0x44')](_0x1b8a3c)[_0x228a('0x23')](handleEntityNotFound(_0x3d221d,null))['then'](respondWithResult(_0x3d221d,null))[_0x228a('0x45')](handleError(_0x3d221d,null));};exports['create']=function(_0xce8ab9,_0x7a539){return db[_0x228a('0x3e')][_0x228a('0x46')](_0xce8ab9['body'],{})[_0x228a('0x23')](respondWithResult(_0x7a539,0xc9))[_0x228a('0x45')](handleError(_0x7a539,null));};exports[_0x228a('0x22')]=function(_0x56e717,_0x3e3603){if(_0x56e717[_0x228a('0x47')]['id']){delete _0x56e717[_0x228a('0x47')]['id'];}return db[_0x228a('0x3e')][_0x228a('0x44')]({'where':{'id':_0x56e717['params']['id']}})['then'](handleEntityNotFound(_0x3e3603,null))[_0x228a('0x23')](saveUpdates(_0x56e717['body'],null))[_0x228a('0x23')](respondWithResult(_0x3e3603,null))['catch'](handleError(_0x3e3603,null));};exports[_0x228a('0x24')]=function(_0x28b415,_0x4fa2cd){return db['Integration'][_0x228a('0x44')]({'where':{'id':_0x28b415[_0x228a('0x43')]['id']}})[_0x228a('0x23')](handleEntityNotFound(_0x4fa2cd,null))['then'](removeEntity(_0x4fa2cd,null))['catch'](handleError(_0x4fa2cd,null));}; \ No newline at end of file +var _0x119a=['reject','save','update','then','destroy','error','stack','name','send','rawAttributes','model','keys','dateStart','dateEnd','query','filters','intersection','attributes','offset','sort','where','pick','add','day','merge','filter','map','Integration','include','catch','show','fields','includeAll','options','find','create','body','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','Content-Range','apply'];(function(_0x3e46d6,_0x5c7601){var _0xb9b834=function(_0x293423){while(--_0x293423){_0x3e46d6['push'](_0x3e46d6['shift']());}};_0xb9b834(++_0x5c7601);}(_0x119a,0x69));var _0xa119=function(_0x14ef4d,_0x4834df){_0x14ef4d=_0x14ef4d-0x0;var _0xe6fb37=_0x119a[_0x14ef4d];return _0xe6fb37;};'use strict';var pdf=require(_0xa119('0x0'));var emlformat=require(_0xa119('0x1'));var rimraf=require(_0xa119('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa119('0x3'));var rp=require(_0xa119('0x4'));var moment=require(_0xa119('0x5'));var BPromise=require(_0xa119('0x6'));var Mustache=require('mustache');var util=require(_0xa119('0x7'));var path=require(_0xa119('0x8'));var sox=require(_0xa119('0x9'));var csv=require(_0xa119('0xa'));var ejs=require(_0xa119('0xb'));var fs=require('fs');var _=require(_0xa119('0xc'));var squel=require(_0xa119('0xd'));var crypto=require(_0xa119('0xe'));var jsforce=require(_0xa119('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa119('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa119('0x10'));var qs=require(_0xa119('0x11'));var logger=require('../../config/logger')(_0xa119('0x12'));var utils=require('../../config/utils');var config=require(_0xa119('0x13'));var db=require(_0xa119('0x14'))['db'];function respondWithStatusCode(_0x302d01,_0x4b998f){_0x4b998f=_0x4b998f||0xcc;return function(_0x52175c){if(_0x52175c){return _0x302d01[_0xa119('0x15')](_0x4b998f);}return _0x302d01[_0xa119('0x16')](_0x4b998f)[_0xa119('0x17')]();};}function respondWithResult(_0xddc38a,_0x4dc9a4){_0x4dc9a4=_0x4dc9a4||0xc8;return function(_0x1402d2){if(_0x1402d2){return _0xddc38a['status'](_0x4dc9a4)[_0xa119('0x18')](_0x1402d2);}};}function respondWithFilteredResult(_0x255a2d,_0x4f2d45){return function(_0x22dfa0){if(_0x22dfa0){var _0x19ac1d=_0x22dfa0[_0xa119('0x19')],_0x4dc3f1=_0x4f2d45['offset'],_0x4c8d2d=_0x4f2d45['offset']+_0x4f2d45[_0xa119('0x1a')],_0x42bc4c;if(_0x4c8d2d>=_0x19ac1d){_0x4c8d2d=_0x19ac1d;_0x42bc4c=0xc8;}else{_0x42bc4c=0xce;}_0x255a2d[_0xa119('0x16')](_0x42bc4c);return _0x255a2d['set'](_0xa119('0x1b'),_0x4dc3f1+'-'+_0x4c8d2d+'/'+_0x19ac1d)['json'](_0x22dfa0);}return null;};}function patchUpdates(_0x195ba2){return function(_0x440863){try{jsonpatch[_0xa119('0x1c')](_0x440863,_0x195ba2,!![]);}catch(_0x496c97){return BPromise[_0xa119('0x1d')](_0x496c97);}return _0x440863[_0xa119('0x1e')]();};}function saveUpdates(_0x168d2f,_0x2b4a1a){return function(_0x28e98b){if(_0x28e98b){return _0x28e98b[_0xa119('0x1f')](_0x168d2f)[_0xa119('0x20')](function(_0x17acd4){return _0x17acd4;});}return null;};}function removeEntity(_0x55bd1d,_0x3169e3){return function(_0x583818){if(_0x583818){return _0x583818[_0xa119('0x21')]()[_0xa119('0x20')](function(){_0x55bd1d['status'](0xcc)[_0xa119('0x17')]();});}};}function handleEntityNotFound(_0x2ee5ef,_0x594df2){return function(_0x291495){if(!_0x291495){_0x2ee5ef[_0xa119('0x15')](0x194);}return _0x291495;};}function handleError(_0x40927c,_0xabe727){_0xabe727=_0xabe727||0x1f4;return function(_0x91de34){logger[_0xa119('0x22')](_0x91de34[_0xa119('0x23')]);if(_0x91de34[_0xa119('0x24')]){delete _0x91de34[_0xa119('0x24')];}_0x40927c[_0xa119('0x16')](_0xabe727)[_0xa119('0x25')](_0x91de34);};}exports['index']=function(_0xcfed5e,_0xab60d){var _0x24efca={},_0x27288e={},_0x8088b0={'count':0x0,'rows':[]};var _0x8c9586=db['Integration'][_0xa119('0x26')];_0x27288e[_0xa119('0x27')]=_[_0xa119('0x28')](_0x8c9586);var _0x349e4d={'dateStart':_0xcfed5e['query'][_0xa119('0x29')],'dateEnd':_0xcfed5e['query']['dateEnd']};delete _0xcfed5e['query']['dateStart'];delete _0xcfed5e['query'][_0xa119('0x2a')];_0x27288e['query']=_['keys'](_0xcfed5e[_0xa119('0x2b')]);_0x27288e[_0xa119('0x2c')]=_[_0xa119('0x2d')](_0x27288e['model'],_0x27288e['query']);_0x24efca[_0xa119('0x2e')]=_[_0xa119('0x2d')](_0x27288e[_0xa119('0x27')],qs['fields'](_0xcfed5e[_0xa119('0x2b')]['fields']));_0x24efca[_0xa119('0x2e')]=_0x24efca[_0xa119('0x2e')]['length']?_0x24efca[_0xa119('0x2e')]:_0x27288e[_0xa119('0x27')];if(!_0xcfed5e[_0xa119('0x2b')]['hasOwnProperty']('nolimit')){_0x24efca[_0xa119('0x1a')]=qs[_0xa119('0x1a')](_0xcfed5e[_0xa119('0x2b')][_0xa119('0x1a')]);_0x24efca[_0xa119('0x2f')]=qs[_0xa119('0x2f')](_0xcfed5e[_0xa119('0x2b')][_0xa119('0x2f')]);}_0x24efca['order']=qs['sort'](_0xcfed5e[_0xa119('0x2b')][_0xa119('0x30')]);_0x24efca[_0xa119('0x31')]=qs[_0xa119('0x2c')](_[_0xa119('0x32')](_0xcfed5e[_0xa119('0x2b')],_0x27288e[_0xa119('0x2c')]));if(_0x349e4d[_0xa119('0x29')]){if(_0x349e4d[_0xa119('0x2a')]){_0x349e4d['dateEnd']=moment(_0x349e4d[_0xa119('0x2a')])[_0xa119('0x33')](0x1,_0xa119('0x34'));}else{_0x349e4d[_0xa119('0x2a')]=moment(_0x349e4d[_0xa119('0x29')])[_0xa119('0x33')](0x1,_0xa119('0x34'));}_[_0xa119('0x35')](_0x24efca['where'],{'createdAt':{'$gte':_0x349e4d[_0xa119('0x29')],'$lte':_0x349e4d[_0xa119('0x2a')]}});}if(_0xcfed5e['query'][_0xa119('0x36')]){_0x24efca[_0xa119('0x31')]=_[_0xa119('0x35')](_0x24efca[_0xa119('0x31')],{'$or':_[_0xa119('0x37')](_0x24efca[_0xa119('0x2e')],function(_0x5eace9){var _0x14ab04={};_0x14ab04[_0x5eace9]={'$like':'%'+_0xcfed5e[_0xa119('0x2b')]['filter']+'%'};return _0x14ab04;})});}_0x24efca=_[_0xa119('0x35')]({},_0x24efca,_0xcfed5e['options']);var _0xd5f1ad={'where':_0x24efca[_0xa119('0x31')]};return db[_0xa119('0x38')][_0xa119('0x19')](_0xd5f1ad)[_0xa119('0x20')](function(_0x5d2d14){_0x8088b0['count']=_0x5d2d14;if(_0xcfed5e[_0xa119('0x2b')]['includeAll']){_0x24efca[_0xa119('0x39')]=[{'all':!![]}];}return db[_0xa119('0x38')]['findAll'](_0x24efca);})[_0xa119('0x20')](function(_0x20ede8){_0x8088b0['rows']=_0x20ede8;return _0x8088b0;})[_0xa119('0x20')](respondWithFilteredResult(_0xab60d,_0x24efca))[_0xa119('0x3a')](handleError(_0xab60d,null));};exports[_0xa119('0x3b')]=function(_0x525d40,_0x2e5493){var _0x12444d={'raw':![],'where':{'id':_0x525d40['params']['id']}},_0x446d55={};_0x446d55[_0xa119('0x27')]=_[_0xa119('0x28')](db[_0xa119('0x38')][_0xa119('0x26')]);_0x446d55[_0xa119('0x2b')]=_[_0xa119('0x28')](_0x525d40['query']);_0x446d55[_0xa119('0x2c')]=_['intersection'](_0x446d55[_0xa119('0x27')],_0x446d55[_0xa119('0x2b')]);_0x12444d[_0xa119('0x2e')]=_[_0xa119('0x2d')](_0x446d55['model'],qs[_0xa119('0x3c')](_0x525d40[_0xa119('0x2b')][_0xa119('0x3c')]));_0x12444d['attributes']=_0x12444d[_0xa119('0x2e')]['length']?_0x12444d[_0xa119('0x2e')]:_0x446d55[_0xa119('0x27')];if(_0x525d40[_0xa119('0x2b')][_0xa119('0x3d')]){_0x12444d[_0xa119('0x39')]=[{'all':!![]}];}_0x12444d=_[_0xa119('0x35')]({},_0x12444d,_0x525d40[_0xa119('0x3e')]);return db[_0xa119('0x38')][_0xa119('0x3f')](_0x12444d)[_0xa119('0x20')](handleEntityNotFound(_0x2e5493,null))['then'](respondWithResult(_0x2e5493,null))['catch'](handleError(_0x2e5493,null));};exports[_0xa119('0x40')]=function(_0x5d3485,_0xb306be){return db['Integration'][_0xa119('0x40')](_0x5d3485[_0xa119('0x41')],{})[_0xa119('0x20')](respondWithResult(_0xb306be,0xc9))[_0xa119('0x3a')](handleError(_0xb306be,null));};exports[_0xa119('0x1f')]=function(_0xe71de4,_0x4371c4){if(_0xe71de4['body']['id']){delete _0xe71de4[_0xa119('0x41')]['id'];}return db['Integration']['find']({'where':{'id':_0xe71de4[_0xa119('0x42')]['id']}})['then'](handleEntityNotFound(_0x4371c4,null))[_0xa119('0x20')](saveUpdates(_0xe71de4[_0xa119('0x41')],null))['then'](respondWithResult(_0x4371c4,null))[_0xa119('0x3a')](handleError(_0x4371c4,null));};exports[_0xa119('0x21')]=function(_0x4b3af5,_0x10f4a7){return db[_0xa119('0x38')][_0xa119('0x3f')]({'where':{'id':_0x4b3af5[_0xa119('0x42')]['id']}})['then'](handleEntityNotFound(_0x10f4a7,null))[_0xa119('0x20')](removeEntity(_0x10f4a7,null))[_0xa119('0x3a')](handleError(_0x10f4a7,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 114f8e2..a8916b5 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 _0x57ca=['exports','define','Integration','integrations','util','../../config/logger','moment','bluebird','request-promise','./integration.attributes'];(function(_0x78d11b,_0x1c2611){var _0x5f2e27=function(_0x58e6ce){while(--_0x58e6ce){_0x78d11b['push'](_0x78d11b['shift']());}};_0x5f2e27(++_0x1c2611);}(_0x57ca,0x108));var _0xa57c=function(_0x93a0f0,_0x497d27){_0x93a0f0=_0x93a0f0-0x0;var _0x1b71e4=_0x57ca[_0x93a0f0];return _0x1b71e4;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var logger=require(_0xa57c('0x1'))('api');var moment=require(_0xa57c('0x2'));var BPromise=require(_0xa57c('0x3'));var rp=require(_0xa57c('0x4'));var attributes=require(_0xa57c('0x5'));module[_0xa57c('0x6')]=function(_0x48be2d,_0x40ba22){return _0x48be2d[_0xa57c('0x7')](_0xa57c('0x8'),attributes,{'tableName':_0xa57c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb28=['define','Integration','lodash','util','../../config/logger','api','bluebird','request-promise','./integration.attributes','exports'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xdb28,0x106));var _0x8db2=function(_0x5ab726,_0x4e97ea){_0x5ab726=_0x5ab726-0x0;var _0x133d70=_0xdb28[_0x5ab726];return _0x133d70;};'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 attributes=require(_0x8db2('0x6'));module[_0x8db2('0x7')]=function(_0x11109e,_0x52bf99){return _0x11109e[_0x8db2('0x8')](_0x8db2('0x9'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index f44514b..dbb824c 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 _0x13e4=['error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x56d591,_0x3191a3){var _0x4bf0ff=function(_0x2312cd){while(--_0x2312cd){_0x56d591['push'](_0x56d591['shift']());}};_0x4bf0ff(++_0x3191a3);}(_0x13e4,0x1b8));var _0x413e=function(_0x15f36f,_0x467d02){_0x15f36f=_0x15f36f-0x0;var _0x15b5bc=_0x13e4[_0x15f36f];return _0x15b5bc;};'use strict';var _=require(_0x413e('0x0'));var util=require(_0x413e('0x1'));var moment=require(_0x413e('0x2'));var BPromise=require(_0x413e('0x3'));var rs=require(_0x413e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x413e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x413e('0x6'))('rpc');var config=require(_0x413e('0x7'));var jayson=require(_0x413e('0x8'));var client=jayson[_0x413e('0x9')][_0x413e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4819e1,_0x32a2de,_0x144556){return new BPromise(function(_0x3acefb,_0x1accbf){return client[_0x413e('0xb')](_0x4819e1,_0x144556)[_0x413e('0xc')](function(_0x4ab538){logger[_0x413e('0xd')](_0x413e('0xe'),_0x32a2de,_0x413e('0xf'));logger[_0x413e('0x10')](_0x413e('0x11'),_0x32a2de,'request\x20sent',JSON[_0x413e('0x12')](_0x4ab538));if(_0x4ab538['error']){if(_0x4ab538['error'][_0x413e('0x13')]===0x1f4){logger['error'](_0x413e('0xe'),_0x32a2de,_0x4ab538[_0x413e('0x14')][_0x413e('0x15')]);return _0x1accbf(_0x4ab538[_0x413e('0x14')][_0x413e('0x15')]);}logger['error'](_0x413e('0xe'),_0x32a2de,_0x4ab538[_0x413e('0x14')][_0x413e('0x15')]);return _0x3acefb(_0x4ab538['error']['message']);}else{logger[_0x413e('0xd')](_0x413e('0xe'),_0x32a2de,_0x413e('0xf'));_0x3acefb(_0x4ab538['result'][_0x413e('0x15')]);}})[_0x413e('0x16')](function(_0x2e9b2c){logger[_0x413e('0x14')]('Integration,\x20%s,\x20%s',_0x32a2de,_0x2e9b2c);_0x1accbf(_0x2e9b2c);});});} \ No newline at end of file +var _0xfa2d=['jayson/promise','client','http','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x116095,_0x327d96){var _0x2a8c92=function(_0x3058b2){while(--_0x3058b2){_0x116095['push'](_0x116095['shift']());}};_0x2a8c92(++_0x327d96);}(_0xfa2d,0x142));var _0xdfa2=function(_0x299ccd,_0x1c5aa0){_0x299ccd=_0x299ccd-0x0;var _0x42fad6=_0xfa2d[_0x299ccd];return _0x42fad6;};'use strict';var _=require('lodash');var util=require(_0xdfa2('0x0'));var moment=require(_0xdfa2('0x1'));var BPromise=require('bluebird');var rs=require(_0xdfa2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdfa2('0x3'))['db'];var utils=require(_0xdfa2('0x4'));var logger=require(_0xdfa2('0x5'))(_0xdfa2('0x6'));var config=require(_0xdfa2('0x7'));var jayson=require(_0xdfa2('0x8'));var client=jayson[_0xdfa2('0x9')][_0xdfa2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x199488,_0x2ba121,_0x513d35){return new BPromise(function(_0x35564c,_0x372dfa){return client['request'](_0x199488,_0x513d35)[_0xdfa2('0xb')](function(_0x3a1e90){logger[_0xdfa2('0xc')](_0xdfa2('0xd'),_0x2ba121,_0xdfa2('0xe'));logger[_0xdfa2('0xf')](_0xdfa2('0x10'),_0x2ba121,_0xdfa2('0xe'),JSON[_0xdfa2('0x11')](_0x3a1e90));if(_0x3a1e90[_0xdfa2('0x12')]){if(_0x3a1e90['error'][_0xdfa2('0x13')]===0x1f4){logger[_0xdfa2('0x12')]('Integration,\x20%s,\x20%s',_0x2ba121,_0x3a1e90[_0xdfa2('0x12')][_0xdfa2('0x14')]);return _0x372dfa(_0x3a1e90[_0xdfa2('0x12')][_0xdfa2('0x14')]);}logger[_0xdfa2('0x12')](_0xdfa2('0xd'),_0x2ba121,_0x3a1e90[_0xdfa2('0x12')][_0xdfa2('0x14')]);return _0x35564c(_0x3a1e90['error']['message']);}else{logger['info']('Integration,\x20%s,\x20%s',_0x2ba121,_0xdfa2('0xe'));_0x35564c(_0x3a1e90[_0xdfa2('0x15')][_0xdfa2('0x14')]);}})['catch'](function(_0xf8c435){logger[_0xdfa2('0x12')](_0xdfa2('0xd'),_0x2ba121,_0xf8c435);_0x372dfa(_0xf8c435);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 01f3d80..c87f19f 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 _0xae64=['destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','delete'];(function(_0x2a99ee,_0x2adb3d){var _0x4d2ae3=function(_0x5d5c10){while(--_0x5d5c10){_0x2a99ee['push'](_0x2a99ee['shift']());}};_0x4d2ae3(++_0x2adb3d);}(_0xae64,0x1ef));var _0x4ae6=function(_0x56c5c0,_0x2901e6){_0x56c5c0=_0x56c5c0-0x0;var _0x3610b8=_0xae64[_0x56c5c0];return _0x3610b8;};'use strict';var multer=require(_0x4ae6('0x0'));var util=require(_0x4ae6('0x1'));var path=require('path');var timeout=require(_0x4ae6('0x2'));var express=require(_0x4ae6('0x3'));var router=express[_0x4ae6('0x4')]();var auth=require(_0x4ae6('0x5'));var interaction=require(_0x4ae6('0x6'));var config=require(_0x4ae6('0x7'));var controller=require(_0x4ae6('0x8'));router[_0x4ae6('0x9')]('/',auth[_0x4ae6('0xa')](),controller[_0x4ae6('0xb')]);router[_0x4ae6('0x9')](_0x4ae6('0xc'),auth[_0x4ae6('0xa')](),controller[_0x4ae6('0xd')]);router[_0x4ae6('0x9')](_0x4ae6('0xe'),auth[_0x4ae6('0xa')](),controller[_0x4ae6('0xf')]);router['post']('/',auth[_0x4ae6('0xa')](),controller['create']);router[_0x4ae6('0x10')](_0x4ae6('0xe'),auth[_0x4ae6('0xa')](),controller['update']);router[_0x4ae6('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x4ae6('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4ecf=['describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','index','/describe','isAuthenticated'];(function(_0x8112af,_0x1cba9e){var _0x3650dd=function(_0x1a3861){while(--_0x1a3861){_0x8112af['push'](_0x8112af['shift']());}};_0x3650dd(++_0x1cba9e);}(_0x4ecf,0x186));var _0xf4ec=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x4ecf[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require(_0xf4ec('0x0'));var util=require(_0xf4ec('0x1'));var path=require('path');var timeout=require(_0xf4ec('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xf4ec('0x3'));var interaction=require(_0xf4ec('0x4'));var config=require('../../config/environment');var controller=require(_0xf4ec('0x5'));router[_0xf4ec('0x6')]('/',auth['isAuthenticated'](),controller[_0xf4ec('0x7')]);router['get'](_0xf4ec('0x8'),auth[_0xf4ec('0x9')](),controller[_0xf4ec('0xa')]);router[_0xf4ec('0x6')](_0xf4ec('0xb'),auth[_0xf4ec('0x9')](),controller[_0xf4ec('0xc')]);router[_0xf4ec('0xd')]('/',auth[_0xf4ec('0x9')](),controller[_0xf4ec('0xe')]);router[_0xf4ec('0xf')](_0xf4ec('0xb'),auth[_0xf4ec('0x9')](),controller[_0xf4ec('0x10')]);router[_0xf4ec('0x11')]('/:id',auth[_0xf4ec('0x9')](),controller[_0xf4ec('0x12')]);module[_0xf4ec('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index f3def26..442c1ca 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 _0xd9e9=['INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','FAILED','STRING'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xd9e9,0x179));var _0x9d9e=function(_0x29d4c8,_0x5224d7){_0x29d4c8=_0x29d4c8-0x0;var _0x19b489=_0xd9e9[_0x29d4c8];return _0x19b489;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize[_0x9d9e('0x0')]},'eventChannel':{'type':Sequelize[_0x9d9e('0x0')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x9d9e('0x1')]},'contacts':{'type':Sequelize[_0x9d9e('0x0')]},'uniqueid':{'type':Sequelize[_0x9d9e('0x0')]},'calleridnum':{'type':Sequelize[_0x9d9e('0x0')]},'calleridname':{'type':Sequelize[_0x9d9e('0x0')]},'queue':{'type':Sequelize[_0x9d9e('0x0')]},'interface':{'type':Sequelize[_0x9d9e('0x0')]},'membername':{'type':Sequelize[_0x9d9e('0x0')]},'agentcalledAt':{'type':Sequelize[_0x9d9e('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x9d9e('0x2')]},'talktime':{'type':Sequelize[_0x9d9e('0x1')]},'agentacw':{'type':Sequelize[_0x9d9e('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x9d9e('0x1')]},'reason':{'type':Sequelize[_0x9d9e('0x0')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x9d9e('0x2')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x9d9e('0x2')]},'lastevent':{'type':Sequelize[_0x9d9e('0x0')]},'channel':{'type':Sequelize[_0x9d9e('0x0')]},'channelstate':{'type':Sequelize[_0x9d9e('0x1')]},'channelstatedesc':{'type':Sequelize[_0x9d9e('0x0')]},'connectedlinenum':{'type':Sequelize[_0x9d9e('0x0')]},'connectedlinename':{'type':Sequelize[_0x9d9e('0x0')]},'language':{'type':Sequelize[_0x9d9e('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x9d9e('0x0')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x9d9e('0x0')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x9d9e('0x1')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x9d9e('0x0')]},'destcalleridname':{'type':Sequelize[_0x9d9e('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0x9d9e('0x0')]},'destconnectedlinename':{'type':Sequelize[_0x9d9e('0x0')]},'destlanguage':{'type':Sequelize[_0x9d9e('0x0')]},'destaccountcode':{'type':Sequelize[_0x9d9e('0x0')]},'destcontext':{'type':Sequelize[_0x9d9e('0x0')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x9d9e('0x0')]},'destuniqueid':{'type':Sequelize[_0x9d9e('0x0')]},'messageId':{'type':Sequelize[_0x9d9e('0x0')]},'inReplyTo':{'type':Sequelize[_0x9d9e('0x0')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x9d9e('0x0')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x9d9e('0x4')]},'html':{'type':Sequelize[_0x9d9e('0x4')]},'text':{'type':Sequelize[_0x9d9e('0x4')]},'status':{'type':Sequelize[_0x9d9e('0x5')](_0x9d9e('0x6'),_0x9d9e('0x7'),'RECEIVED',_0x9d9e('0x8'))},'url':{'type':Sequelize[_0x9d9e('0x0')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x9d9e('0x0')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x761e=['INTEGER','BOOLEAN','TEXT','SENT','SENDING','RECEIVED','FAILED','exports','STRING','DATE'];(function(_0x576df3,_0x3c6218){var _0x5c39db=function(_0x540a92){while(--_0x540a92){_0x576df3['push'](_0x576df3['shift']());}};_0x5c39db(++_0x3c6218);}(_0x761e,0x115));var _0xe761=function(_0x3747ae,_0x408e61){_0x3747ae=_0x3747ae-0x0;var _0x339035=_0x761e[_0x3747ae];return _0x339035;};'use strict';var Sequelize=require('sequelize');module[_0xe761('0x0')]={'integration':{'type':Sequelize[_0xe761('0x1')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xe761('0x1')]},'ticketId':{'type':Sequelize[_0xe761('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xe761('0x1')]},'uniqueid':{'type':Sequelize[_0xe761('0x1')]},'calleridnum':{'type':Sequelize[_0xe761('0x1')]},'calleridname':{'type':Sequelize[_0xe761('0x1')]},'queue':{'type':Sequelize[_0xe761('0x1')]},'interface':{'type':Sequelize[_0xe761('0x1')]},'membername':{'type':Sequelize[_0xe761('0x1')]},'agentcalledAt':{'type':Sequelize[_0xe761('0x2')]},'agentconnectAt':{'type':Sequelize[_0xe761('0x2')]},'holdtime':{'type':Sequelize[_0xe761('0x3')]},'agentcomplete':{'type':Sequelize[_0xe761('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xe761('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xe761('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xe761('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xe761('0x2')]},'agentdump':{'type':Sequelize[_0xe761('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xe761('0x2')]},'lastevent':{'type':Sequelize[_0xe761('0x1')]},'channel':{'type':Sequelize[_0xe761('0x1')]},'channelstate':{'type':Sequelize[_0xe761('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xe761('0x1')]},'connectedlinename':{'type':Sequelize[_0xe761('0x1')]},'language':{'type':Sequelize[_0xe761('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xe761('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xe761('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xe761('0x1')]},'destcalleridnum':{'type':Sequelize[_0xe761('0x1')]},'destcalleridname':{'type':Sequelize[_0xe761('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xe761('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xe761('0x1')]},'destaccountcode':{'type':Sequelize[_0xe761('0x1')]},'destcontext':{'type':Sequelize[_0xe761('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xe761('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xe761('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xe761('0x1')]},'to':{'type':Sequelize[_0xe761('0x1')]},'cc':{'type':Sequelize[_0xe761('0x1')]},'attachment':{'type':Sequelize[_0xe761('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xe761('0x5')]},'status':{'type':Sequelize['ENUM'](_0xe761('0x6'),_0xe761('0x7'),_0xe761('0x8'),_0xe761('0x9'))},'url':{'type':Sequelize[_0xe761('0x1')]},'app':{'type':Sequelize[_0xe761('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index a9fb0eb..1f00275 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 _0x2d23=['Content-Range','json','apply','reject','save','update','then','error','stack','name','index','IntegrationReport','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','day','merge','filter','map','includeAll','include','findAll','catch','show','params','length','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../mysqldb','sendStatus','status','count','offset','set'];(function(_0x4e4a30,_0x3a952c){var _0x208200=function(_0x4b0f08){while(--_0x4b0f08){_0x4e4a30['push'](_0x4e4a30['shift']());}};_0x208200(++_0x3a952c);}(_0x2d23,0x1e1));var _0x32d2=function(_0x2ffd05,_0x1840e3){_0x2ffd05=_0x2ffd05-0x0;var _0x5038bf=_0x2d23[_0x2ffd05];return _0x5038bf;};'use strict';var pdf=require(_0x32d2('0x0'));var emlformat=require(_0x32d2('0x1'));var rimraf=require(_0x32d2('0x2'));var zipdir=require(_0x32d2('0x3'));var jsonpatch=require(_0x32d2('0x4'));var rp=require(_0x32d2('0x5'));var moment=require('moment');var BPromise=require(_0x32d2('0x6'));var Mustache=require(_0x32d2('0x7'));var util=require(_0x32d2('0x8'));var path=require(_0x32d2('0x9'));var sox=require(_0x32d2('0xa'));var csv=require(_0x32d2('0xb'));var ejs=require(_0x32d2('0xc'));var fs=require('fs');var _=require(_0x32d2('0xd'));var squel=require(_0x32d2('0xe'));var crypto=require(_0x32d2('0xf'));var jsforce=require(_0x32d2('0x10'));var deskjs=require(_0x32d2('0x11'));var toCsv=require(_0x32d2('0xb'));var querystring=require(_0x32d2('0x12'));var Papa=require(_0x32d2('0x13'));var Redis=require(_0x32d2('0x14'));var qs=require(_0x32d2('0x15'));var logger=require('../../config/logger')(_0x32d2('0x16'));var utils=require(_0x32d2('0x17'));var config=require('../../config/environment');var db=require(_0x32d2('0x18'))['db'];function respondWithStatusCode(_0x502af7,_0x326a5f){_0x326a5f=_0x326a5f||0xcc;return function(_0x217934){if(_0x217934){return _0x502af7[_0x32d2('0x19')](_0x326a5f);}return _0x502af7[_0x32d2('0x1a')](_0x326a5f)['end']();};}function respondWithResult(_0x1ce69b,_0x1298c7){_0x1298c7=_0x1298c7||0xc8;return function(_0x5f35d5){if(_0x5f35d5){return _0x1ce69b[_0x32d2('0x1a')](_0x1298c7)['json'](_0x5f35d5);}};}function respondWithFilteredResult(_0x5d1cb2,_0x2b3120){return function(_0x197822){if(_0x197822){var _0x428b5e=_0x197822[_0x32d2('0x1b')],_0x48e13a=_0x2b3120[_0x32d2('0x1c')],_0x8de2d7=_0x2b3120[_0x32d2('0x1c')]+_0x2b3120['limit'],_0x193704;if(_0x8de2d7>=_0x428b5e){_0x8de2d7=_0x428b5e;_0x193704=0xc8;}else{_0x193704=0xce;}_0x5d1cb2['status'](_0x193704);return _0x5d1cb2[_0x32d2('0x1d')](_0x32d2('0x1e'),_0x48e13a+'-'+_0x8de2d7+'/'+_0x428b5e)[_0x32d2('0x1f')](_0x197822);}return null;};}function patchUpdates(_0x407bba){return function(_0x51223f){try{jsonpatch[_0x32d2('0x20')](_0x51223f,_0x407bba,!![]);}catch(_0x4edef9){return BPromise[_0x32d2('0x21')](_0x4edef9);}return _0x51223f[_0x32d2('0x22')]();};}function saveUpdates(_0x326231,_0x5bad7e){return function(_0x101ffc){if(_0x101ffc){return _0x101ffc[_0x32d2('0x23')](_0x326231)[_0x32d2('0x24')](function(_0x390ffe){return _0x390ffe;});}return null;};}function removeEntity(_0xef4ac4,_0x432878){return function(_0x31a7c6){if(_0x31a7c6){return _0x31a7c6['destroy']()[_0x32d2('0x24')](function(){_0xef4ac4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d2586,_0x18fb0d){return function(_0xedb832){if(!_0xedb832){_0x3d2586[_0x32d2('0x19')](0x194);}return _0xedb832;};}function handleError(_0xc25623,_0x5e0075){_0x5e0075=_0x5e0075||0x1f4;return function(_0x1b0623){logger[_0x32d2('0x25')](_0x1b0623[_0x32d2('0x26')]);if(_0x1b0623[_0x32d2('0x27')]){delete _0x1b0623['name'];}_0xc25623['status'](_0x5e0075)['send'](_0x1b0623);};}exports[_0x32d2('0x28')]=function(_0xeccf3,_0x4e383b){var _0x3a56f0={},_0x161170={},_0x55af5e={'count':0x0,'rows':[]};var _0x300183=db[_0x32d2('0x29')][_0x32d2('0x2a')];_0x161170[_0x32d2('0x2b')]=_[_0x32d2('0x2c')](_0x300183);var _0x1d6619={'dateStart':_0xeccf3[_0x32d2('0x2d')]['dateStart'],'dateEnd':_0xeccf3[_0x32d2('0x2d')][_0x32d2('0x2e')]};delete _0xeccf3[_0x32d2('0x2d')][_0x32d2('0x2f')];delete _0xeccf3['query']['dateEnd'];_0x161170['query']=_[_0x32d2('0x2c')](_0xeccf3[_0x32d2('0x2d')]);_0x161170[_0x32d2('0x30')]=_[_0x32d2('0x31')](_0x161170[_0x32d2('0x2b')],_0x161170[_0x32d2('0x2d')]);_0x3a56f0[_0x32d2('0x32')]=_[_0x32d2('0x31')](_0x161170[_0x32d2('0x2b')],qs['fields'](_0xeccf3['query'][_0x32d2('0x33')]));_0x3a56f0[_0x32d2('0x32')]=_0x3a56f0[_0x32d2('0x32')]['length']?_0x3a56f0[_0x32d2('0x32')]:_0x161170[_0x32d2('0x2b')];if(!_0xeccf3[_0x32d2('0x2d')][_0x32d2('0x34')](_0x32d2('0x35'))){_0x3a56f0[_0x32d2('0x36')]=qs[_0x32d2('0x36')](_0xeccf3[_0x32d2('0x2d')][_0x32d2('0x36')]);_0x3a56f0['offset']=qs['offset'](_0xeccf3[_0x32d2('0x2d')]['offset']);}_0x3a56f0[_0x32d2('0x37')]=qs[_0x32d2('0x38')](_0xeccf3[_0x32d2('0x2d')][_0x32d2('0x38')]);_0x3a56f0['where']=qs[_0x32d2('0x30')](_['pick'](_0xeccf3[_0x32d2('0x2d')],_0x161170[_0x32d2('0x30')]));if(_0x1d6619[_0x32d2('0x2f')]){if(_0x1d6619[_0x32d2('0x2e')]){_0x1d6619[_0x32d2('0x2e')]=moment(_0x1d6619[_0x32d2('0x2e')])['add'](0x1,'day');}else{_0x1d6619[_0x32d2('0x2e')]=moment(_0x1d6619[_0x32d2('0x2f')])['add'](0x1,_0x32d2('0x39'));}_[_0x32d2('0x3a')](_0x3a56f0['where'],{'createdAt':{'$gte':_0x1d6619['dateStart'],'$lte':_0x1d6619[_0x32d2('0x2e')]}});}if(_0xeccf3['query'][_0x32d2('0x3b')]){_0x3a56f0['where']=_[_0x32d2('0x3a')](_0x3a56f0['where'],{'$or':_[_0x32d2('0x3c')](_0x3a56f0[_0x32d2('0x32')],function(_0x361e63){var _0x54ae2e={};_0x54ae2e[_0x361e63]={'$like':'%'+_0xeccf3[_0x32d2('0x2d')]['filter']+'%'};return _0x54ae2e;})});}_0x3a56f0=_[_0x32d2('0x3a')]({},_0x3a56f0,_0xeccf3['options']);var _0x5485e0={'where':_0x3a56f0['where']};return db[_0x32d2('0x29')][_0x32d2('0x1b')](_0x5485e0)[_0x32d2('0x24')](function(_0x422e2f){_0x55af5e[_0x32d2('0x1b')]=_0x422e2f;if(_0xeccf3[_0x32d2('0x2d')][_0x32d2('0x3d')]){_0x3a56f0[_0x32d2('0x3e')]=[{'all':!![]}];}return db[_0x32d2('0x29')][_0x32d2('0x3f')](_0x3a56f0);})[_0x32d2('0x24')](function(_0x5ced34){_0x55af5e['rows']=_0x5ced34;return _0x55af5e;})[_0x32d2('0x24')](respondWithFilteredResult(_0x4e383b,_0x3a56f0))[_0x32d2('0x40')](handleError(_0x4e383b,null));};exports[_0x32d2('0x41')]=function(_0x53c5a6,_0x425d06){var _0x3e379f={'raw':![],'where':{'id':_0x53c5a6[_0x32d2('0x42')]['id']}},_0x4cd2b7={};_0x4cd2b7[_0x32d2('0x2b')]=_[_0x32d2('0x2c')](db[_0x32d2('0x29')]['rawAttributes']);_0x4cd2b7[_0x32d2('0x2d')]=_['keys'](_0x53c5a6[_0x32d2('0x2d')]);_0x4cd2b7[_0x32d2('0x30')]=_[_0x32d2('0x31')](_0x4cd2b7['model'],_0x4cd2b7['query']);_0x3e379f[_0x32d2('0x32')]=_['intersection'](_0x4cd2b7[_0x32d2('0x2b')],qs[_0x32d2('0x33')](_0x53c5a6['query'][_0x32d2('0x33')]));_0x3e379f['attributes']=_0x3e379f[_0x32d2('0x32')][_0x32d2('0x43')]?_0x3e379f[_0x32d2('0x32')]:_0x4cd2b7['model'];if(_0x53c5a6['query'][_0x32d2('0x3d')]){_0x3e379f['include']=[{'all':!![]}];}_0x3e379f=_[_0x32d2('0x3a')]({},_0x3e379f,_0x53c5a6['options']);return db[_0x32d2('0x29')][_0x32d2('0x44')](_0x3e379f)['then'](handleEntityNotFound(_0x425d06,null))['then'](respondWithResult(_0x425d06,null))[_0x32d2('0x40')](handleError(_0x425d06,null));};exports[_0x32d2('0x45')]=function(_0x3402dc,_0x1b4c15){return db[_0x32d2('0x29')][_0x32d2('0x45')](_0x3402dc[_0x32d2('0x46')],{})[_0x32d2('0x24')](respondWithResult(_0x1b4c15,0xc9))[_0x32d2('0x40')](handleError(_0x1b4c15,null));};exports['update']=function(_0x3c589f,_0xc986de){if(_0x3c589f['body']['id']){delete _0x3c589f[_0x32d2('0x46')]['id'];}return db[_0x32d2('0x29')][_0x32d2('0x44')]({'where':{'id':_0x3c589f['params']['id']}})[_0x32d2('0x24')](handleEntityNotFound(_0xc986de,null))[_0x32d2('0x24')](saveUpdates(_0x3c589f[_0x32d2('0x46')],null))[_0x32d2('0x24')](respondWithResult(_0xc986de,null))[_0x32d2('0x40')](handleError(_0xc986de,null));};exports[_0x32d2('0x47')]=function(_0x3f8959,_0x34786c){return db[_0x32d2('0x29')][_0x32d2('0x44')]({'where':{'id':_0x3f8959[_0x32d2('0x42')]['id']}})[_0x32d2('0x24')](handleEntityNotFound(_0x34786c,null))['then'](removeEntity(_0x34786c,null))[_0x32d2('0x40')](handleError(_0x34786c,null));};exports[_0x32d2('0x48')]=function(_0x1b885c,_0x4c652e){return db[_0x32d2('0x29')][_0x32d2('0x48')]()[_0x32d2('0x24')](respondWithResult(_0x4c652e,null))[_0x32d2('0x40')](handleError(_0x4c652e,null));}; \ No newline at end of file +var _0x4ee1=['intersection','fields','attributes','length','nolimit','sort','where','dateEnd','add','day','merge','filter','map','options','includeAll','include','findAll','rows','catch','keys','rawAttributes','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','update','then','destroy','end','error','stack','name','send','IntegrationReport','model','query','dateStart','filters'];(function(_0x200827,_0x4af951){var _0x120047=function(_0x4431de){while(--_0x4431de){_0x200827['push'](_0x200827['shift']());}};_0x120047(++_0x4af951);}(_0x4ee1,0x17d));var _0x14ee=function(_0x3ae898,_0x5e75dc){_0x3ae898=_0x3ae898-0x0;var _0x157dcd=_0x4ee1[_0x3ae898];return _0x157dcd;};'use strict';var pdf=require(_0x14ee('0x0'));var emlformat=require(_0x14ee('0x1'));var rimraf=require(_0x14ee('0x2'));var zipdir=require(_0x14ee('0x3'));var jsonpatch=require(_0x14ee('0x4'));var rp=require(_0x14ee('0x5'));var moment=require(_0x14ee('0x6'));var BPromise=require(_0x14ee('0x7'));var Mustache=require('mustache');var util=require(_0x14ee('0x8'));var path=require(_0x14ee('0x9'));var sox=require(_0x14ee('0xa'));var csv=require(_0x14ee('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x14ee('0xc'));var squel=require(_0x14ee('0xd'));var crypto=require(_0x14ee('0xe'));var jsforce=require(_0x14ee('0xf'));var deskjs=require(_0x14ee('0x10'));var toCsv=require('to-csv');var querystring=require(_0x14ee('0x11'));var Papa=require(_0x14ee('0x12'));var Redis=require(_0x14ee('0x13'));var qs=require('../../components/parsers/qs');var logger=require(_0x14ee('0x14'))(_0x14ee('0x15'));var utils=require(_0x14ee('0x16'));var config=require(_0x14ee('0x17'));var db=require(_0x14ee('0x18'))['db'];function respondWithStatusCode(_0x5f0284,_0x5db3dd){_0x5db3dd=_0x5db3dd||0xcc;return function(_0x1f6677){if(_0x1f6677){return _0x5f0284[_0x14ee('0x19')](_0x5db3dd);}return _0x5f0284[_0x14ee('0x1a')](_0x5db3dd)['end']();};}function respondWithResult(_0x19d864,_0x3e64a8){_0x3e64a8=_0x3e64a8||0xc8;return function(_0x56e0ef){if(_0x56e0ef){return _0x19d864[_0x14ee('0x1a')](_0x3e64a8)[_0x14ee('0x1b')](_0x56e0ef);}};}function respondWithFilteredResult(_0x10a5a6,_0x57a83d){return function(_0x2c920f){if(_0x2c920f){var _0x2601eb=_0x2c920f[_0x14ee('0x1c')],_0xb8280f=_0x57a83d[_0x14ee('0x1d')],_0x3d8b99=_0x57a83d[_0x14ee('0x1d')]+_0x57a83d[_0x14ee('0x1e')],_0x1d56e1;if(_0x3d8b99>=_0x2601eb){_0x3d8b99=_0x2601eb;_0x1d56e1=0xc8;}else{_0x1d56e1=0xce;}_0x10a5a6[_0x14ee('0x1a')](_0x1d56e1);return _0x10a5a6['set']('Content-Range',_0xb8280f+'-'+_0x3d8b99+'/'+_0x2601eb)[_0x14ee('0x1b')](_0x2c920f);}return null;};}function patchUpdates(_0x17aa73){return function(_0x47729d){try{jsonpatch[_0x14ee('0x1f')](_0x47729d,_0x17aa73,!![]);}catch(_0x1a2254){return BPromise['reject'](_0x1a2254);}return _0x47729d['save']();};}function saveUpdates(_0x120117,_0x24d279){return function(_0x5dddd8){if(_0x5dddd8){return _0x5dddd8[_0x14ee('0x20')](_0x120117)[_0x14ee('0x21')](function(_0x5204d0){return _0x5204d0;});}return null;};}function removeEntity(_0x492155,_0x22aba5){return function(_0x1987ff){if(_0x1987ff){return _0x1987ff[_0x14ee('0x22')]()[_0x14ee('0x21')](function(){_0x492155[_0x14ee('0x1a')](0xcc)[_0x14ee('0x23')]();});}};}function handleEntityNotFound(_0x22a417,_0x5a10b4){return function(_0x1ea4d8){if(!_0x1ea4d8){_0x22a417['sendStatus'](0x194);}return _0x1ea4d8;};}function handleError(_0x525ba6,_0x8906f1){_0x8906f1=_0x8906f1||0x1f4;return function(_0x1b0bce){logger[_0x14ee('0x24')](_0x1b0bce[_0x14ee('0x25')]);if(_0x1b0bce[_0x14ee('0x26')]){delete _0x1b0bce['name'];}_0x525ba6['status'](_0x8906f1)[_0x14ee('0x27')](_0x1b0bce);};}exports['index']=function(_0x13449b,_0x46ff53){var _0x148682={},_0x23a0ea={},_0x1542bb={'count':0x0,'rows':[]};var _0x37ad7d=db[_0x14ee('0x28')]['rawAttributes'];_0x23a0ea[_0x14ee('0x29')]=_['keys'](_0x37ad7d);var _0x9d8e91={'dateStart':_0x13449b['query']['dateStart'],'dateEnd':_0x13449b['query']['dateEnd']};delete _0x13449b[_0x14ee('0x2a')][_0x14ee('0x2b')];delete _0x13449b['query']['dateEnd'];_0x23a0ea[_0x14ee('0x2a')]=_['keys'](_0x13449b['query']);_0x23a0ea[_0x14ee('0x2c')]=_[_0x14ee('0x2d')](_0x23a0ea[_0x14ee('0x29')],_0x23a0ea['query']);_0x148682['attributes']=_[_0x14ee('0x2d')](_0x23a0ea['model'],qs[_0x14ee('0x2e')](_0x13449b[_0x14ee('0x2a')]['fields']));_0x148682['attributes']=_0x148682[_0x14ee('0x2f')][_0x14ee('0x30')]?_0x148682[_0x14ee('0x2f')]:_0x23a0ea[_0x14ee('0x29')];if(!_0x13449b['query']['hasOwnProperty'](_0x14ee('0x31'))){_0x148682[_0x14ee('0x1e')]=qs[_0x14ee('0x1e')](_0x13449b[_0x14ee('0x2a')][_0x14ee('0x1e')]);_0x148682[_0x14ee('0x1d')]=qs[_0x14ee('0x1d')](_0x13449b[_0x14ee('0x2a')][_0x14ee('0x1d')]);}_0x148682['order']=qs[_0x14ee('0x32')](_0x13449b[_0x14ee('0x2a')]['sort']);_0x148682[_0x14ee('0x33')]=qs['filters'](_['pick'](_0x13449b[_0x14ee('0x2a')],_0x23a0ea[_0x14ee('0x2c')]));if(_0x9d8e91['dateStart']){if(_0x9d8e91[_0x14ee('0x34')]){_0x9d8e91[_0x14ee('0x34')]=moment(_0x9d8e91['dateEnd'])[_0x14ee('0x35')](0x1,_0x14ee('0x36'));}else{_0x9d8e91[_0x14ee('0x34')]=moment(_0x9d8e91[_0x14ee('0x2b')])[_0x14ee('0x35')](0x1,_0x14ee('0x36'));}_[_0x14ee('0x37')](_0x148682['where'],{'createdAt':{'$gte':_0x9d8e91[_0x14ee('0x2b')],'$lte':_0x9d8e91[_0x14ee('0x34')]}});}if(_0x13449b['query'][_0x14ee('0x38')]){_0x148682[_0x14ee('0x33')]=_['merge'](_0x148682[_0x14ee('0x33')],{'$or':_[_0x14ee('0x39')](_0x148682[_0x14ee('0x2f')],function(_0x40c6c5){var _0x1badab={};_0x1badab[_0x40c6c5]={'$like':'%'+_0x13449b['query'][_0x14ee('0x38')]+'%'};return _0x1badab;})});}_0x148682=_[_0x14ee('0x37')]({},_0x148682,_0x13449b[_0x14ee('0x3a')]);var _0x302043={'where':_0x148682['where']};return db[_0x14ee('0x28')][_0x14ee('0x1c')](_0x302043)[_0x14ee('0x21')](function(_0x5df7fd){_0x1542bb[_0x14ee('0x1c')]=_0x5df7fd;if(_0x13449b[_0x14ee('0x2a')][_0x14ee('0x3b')]){_0x148682[_0x14ee('0x3c')]=[{'all':!![]}];}return db['IntegrationReport'][_0x14ee('0x3d')](_0x148682);})[_0x14ee('0x21')](function(_0x29e296){_0x1542bb[_0x14ee('0x3e')]=_0x29e296;return _0x1542bb;})[_0x14ee('0x21')](respondWithFilteredResult(_0x46ff53,_0x148682))[_0x14ee('0x3f')](handleError(_0x46ff53,null));};exports['show']=function(_0x40db98,_0x3da9e9){var _0x178f61={'raw':![],'where':{'id':_0x40db98['params']['id']}},_0x416ccb={};_0x416ccb['model']=_[_0x14ee('0x40')](db[_0x14ee('0x28')][_0x14ee('0x41')]);_0x416ccb[_0x14ee('0x2a')]=_[_0x14ee('0x40')](_0x40db98['query']);_0x416ccb[_0x14ee('0x2c')]=_[_0x14ee('0x2d')](_0x416ccb[_0x14ee('0x29')],_0x416ccb[_0x14ee('0x2a')]);_0x178f61[_0x14ee('0x2f')]=_['intersection'](_0x416ccb[_0x14ee('0x29')],qs['fields'](_0x40db98[_0x14ee('0x2a')][_0x14ee('0x2e')]));_0x178f61[_0x14ee('0x2f')]=_0x178f61[_0x14ee('0x2f')]['length']?_0x178f61[_0x14ee('0x2f')]:_0x416ccb[_0x14ee('0x29')];if(_0x40db98[_0x14ee('0x2a')][_0x14ee('0x3b')]){_0x178f61[_0x14ee('0x3c')]=[{'all':!![]}];}_0x178f61=_['merge']({},_0x178f61,_0x40db98[_0x14ee('0x3a')]);return db[_0x14ee('0x28')][_0x14ee('0x42')](_0x178f61)[_0x14ee('0x21')](handleEntityNotFound(_0x3da9e9,null))[_0x14ee('0x21')](respondWithResult(_0x3da9e9,null))[_0x14ee('0x3f')](handleError(_0x3da9e9,null));};exports[_0x14ee('0x43')]=function(_0x4b5e12,_0x45acb8){return db[_0x14ee('0x28')][_0x14ee('0x43')](_0x4b5e12['body'],{})['then'](respondWithResult(_0x45acb8,0xc9))[_0x14ee('0x3f')](handleError(_0x45acb8,null));};exports[_0x14ee('0x20')]=function(_0xcffbb7,_0xa93292){if(_0xcffbb7[_0x14ee('0x44')]['id']){delete _0xcffbb7[_0x14ee('0x44')]['id'];}return db['IntegrationReport']['find']({'where':{'id':_0xcffbb7[_0x14ee('0x45')]['id']}})[_0x14ee('0x21')](handleEntityNotFound(_0xa93292,null))['then'](saveUpdates(_0xcffbb7['body'],null))[_0x14ee('0x21')](respondWithResult(_0xa93292,null))[_0x14ee('0x3f')](handleError(_0xa93292,null));};exports[_0x14ee('0x22')]=function(_0x3313b6,_0x4a5458){return db[_0x14ee('0x28')][_0x14ee('0x42')]({'where':{'id':_0x3313b6[_0x14ee('0x45')]['id']}})[_0x14ee('0x21')](handleEntityNotFound(_0x4a5458,null))[_0x14ee('0x21')](removeEntity(_0x4a5458,null))['catch'](handleError(_0x4a5458,null));};exports[_0x14ee('0x46')]=function(_0x5827e8,_0x5d3c81){return db['IntegrationReport'][_0x14ee('0x46')]()[_0x14ee('0x21')](respondWithResult(_0x5d3c81,null))[_0x14ee('0x3f')](handleError(_0x5d3c81,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index d9bfda6..d277f30 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 _0x1cb9=['exports','define','IntegrationReport','report_integration','lodash','../../config/logger','api','moment','bluebird','./integrationReport.attributes'];(function(_0x391c55,_0x168617){var _0xa434e0=function(_0x51fa5c){while(--_0x51fa5c){_0x391c55['push'](_0x391c55['shift']());}};_0xa434e0(++_0x168617);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3f8fd6,_0x3c64a9){_0x3f8fd6=_0x3f8fd6-0x0;var _0x446415=_0x1cb9[_0x3f8fd6];return _0x446415;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var attributes=require(_0x91cb('0x5'));module[_0x91cb('0x6')]=function(_0x5652cd,_0x17c21c){return _0x5652cd[_0x91cb('0x7')](_0x91cb('0x8'),attributes,{'tableName':_0x91cb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['define','IntegrationReport','report_integration','lodash','util','moment','bluebird','./integrationReport.attributes'];(function(_0x38f7b1,_0x3d6c11){var _0x25a9fd=function(_0x2bb939){while(--_0x2bb939){_0x38f7b1['push'](_0x38f7b1['shift']());}};_0x25a9fd(++_0x3d6c11);}(_0xe14b,0x93));var _0xbe14=function(_0x2a74b6,_0x4d6bcc){_0x2a74b6=_0x2a74b6-0x0;var _0x252b0d=_0xe14b[_0x2a74b6];return _0x252b0d;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var attributes=require(_0xbe14('0x4'));module['exports']=function(_0x496c04,_0x1833e3){return _0x496c04[_0xbe14('0x5')](_0xbe14('0x6'),attributes,{'tableName':_0xbe14('0x7'),'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 4edac7b..f06ec13 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 _0xcaf7=['bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','IntegrationReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','util','moment'];(function(_0x5f4388,_0x52061e){var _0x596203=function(_0x39de0b){while(--_0x39de0b){_0x5f4388['push'](_0x5f4388['shift']());}};_0x596203(++_0x52061e);}(_0xcaf7,0x1d9));var _0x7caf=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0xcaf7[_0x53cf8e];return _0x459197;};'use strict';var _=require('lodash');var util=require(_0x7caf('0x0'));var moment=require(_0x7caf('0x1'));var BPromise=require(_0x7caf('0x2'));var rs=require(_0x7caf('0x3'));var fs=require('fs');var Redis=require(_0x7caf('0x4'));var db=require(_0x7caf('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7caf('0x6'));var config=require('../../config/environment');var jayson=require(_0x7caf('0x7'));var client=jayson[_0x7caf('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b3526,_0x164918,_0x5d311){return new BPromise(function(_0x4021bd,_0x25f24e){return client[_0x7caf('0x9')](_0x4b3526,_0x5d311)[_0x7caf('0xa')](function(_0x14c08c){logger['info'](_0x7caf('0xb'),_0x164918,'request\x20sent');logger[_0x7caf('0xc')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x164918,_0x7caf('0xd'),JSON['stringify'](_0x14c08c));if(_0x14c08c[_0x7caf('0xe')]){if(_0x14c08c['error'][_0x7caf('0xf')]===0x1f4){logger[_0x7caf('0xe')](_0x7caf('0xb'),_0x164918,_0x14c08c[_0x7caf('0xe')][_0x7caf('0x10')]);return _0x25f24e(_0x14c08c[_0x7caf('0xe')]['message']);}logger[_0x7caf('0xe')](_0x7caf('0xb'),_0x164918,_0x14c08c['error'][_0x7caf('0x10')]);return _0x4021bd(_0x14c08c[_0x7caf('0xe')][_0x7caf('0x10')]);}else{logger[_0x7caf('0x11')]('IntegrationReport,\x20%s,\x20%s',_0x164918,_0x7caf('0xd'));_0x4021bd(_0x14c08c['result'][_0x7caf('0x10')]);}})[_0x7caf('0x12')](function(_0x121f83){logger[_0x7caf('0xe')](_0x7caf('0xb'),_0x164918,_0x121f83);_0x25f24e(_0x121f83);});});} \ No newline at end of file +var _0x7785=['result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x114eb8,_0x3b8e86){var _0x1ce961=function(_0x159bd3){while(--_0x159bd3){_0x114eb8['push'](_0x114eb8['shift']());}};_0x1ce961(++_0x3b8e86);}(_0x7785,0x7a));var _0x5778=function(_0x47ce2a,_0x25cdb6){_0x47ce2a=_0x47ce2a-0x0;var _0x1a6a9d=_0x7785[_0x47ce2a];return _0x1a6a9d;};'use strict';var _=require('lodash');var util=require(_0x5778('0x0'));var moment=require(_0x5778('0x1'));var BPromise=require(_0x5778('0x2'));var rs=require(_0x5778('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5778('0x4'))['db'];var utils=require(_0x5778('0x5'));var logger=require(_0x5778('0x6'))('rpc');var config=require(_0x5778('0x7'));var jayson=require(_0x5778('0x8'));var client=jayson[_0x5778('0x9')][_0x5778('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58c53e,_0x44cc54,_0x356477){return new BPromise(function(_0x4887a9,_0x98aa3d){return client[_0x5778('0xb')](_0x58c53e,_0x356477)[_0x5778('0xc')](function(_0x37b993){logger['info'](_0x5778('0xd'),_0x44cc54,_0x5778('0xe'));logger[_0x5778('0xf')](_0x5778('0x10'),_0x44cc54,_0x5778('0xe'),JSON[_0x5778('0x11')](_0x37b993));if(_0x37b993[_0x5778('0x12')]){if(_0x37b993['error'][_0x5778('0x13')]===0x1f4){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x44cc54,_0x37b993['error'][_0x5778('0x14')]);return _0x98aa3d(_0x37b993['error'][_0x5778('0x14')]);}logger[_0x5778('0x12')](_0x5778('0xd'),_0x44cc54,_0x37b993['error'][_0x5778('0x14')]);return _0x4887a9(_0x37b993['error'][_0x5778('0x14')]);}else{logger[_0x5778('0x15')](_0x5778('0xd'),_0x44cc54,_0x5778('0xe'));_0x4887a9(_0x37b993[_0x5778('0x16')][_0x5778('0x14')]);}})[_0x5778('0x17')](function(_0x546132){logger[_0x5778('0x12')](_0x5778('0xd'),_0x44cc54,_0x546132);_0x98aa3d(_0x546132);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index cdf6de4..d5c1149 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 _0x1794=['../../components/interaction/service','get','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','create','/:id/sub_intervals/create_many','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x511ad2,_0x2d982a){var _0xb3dc1c=function(_0x5460dc){while(--_0x5460dc){_0x511ad2['push'](_0x511ad2['shift']());}};_0xb3dc1c(++_0x2d982a);}(_0x1794,0xc2));var _0x4179=function(_0x4df592,_0x5a4b74){_0x4df592=_0x4df592-0x0;var _0x49804a=_0x1794[_0x4df592];return _0x49804a;};'use strict';var multer=require('multer');var util=require(_0x4179('0x0'));var path=require(_0x4179('0x1'));var timeout=require(_0x4179('0x2'));var express=require(_0x4179('0x3'));var router=express[_0x4179('0x4')]();var auth=require(_0x4179('0x5'));var interaction=require(_0x4179('0x6'));var config=require('../../config/environment');var controller=require('./interval.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x4179('0x7')](_0x4179('0x8'),auth[_0x4179('0x9')](),controller[_0x4179('0xa')]);router[_0x4179('0x7')](_0x4179('0xb'),auth[_0x4179('0x9')](),controller[_0x4179('0xc')]);router[_0x4179('0xd')]('/',auth[_0x4179('0x9')](),controller[_0x4179('0xe')]);router['post'](_0x4179('0xb'),auth['isAuthenticated'](),controller['addInterval']);router[_0x4179('0xd')](_0x4179('0xf'),auth[_0x4179('0x9')](),controller['addIntervals']);router[_0x4179('0x10')](_0x4179('0x8'),auth['isAuthenticated'](),controller[_0x4179('0x11')]);router[_0x4179('0x12')](_0x4179('0x8'),auth['isAuthenticated'](),controller[_0x4179('0x13')]);module['exports']=router; \ No newline at end of file +var _0xfb11=['getIntervals','post','create','addIntervals','put','/:id','update','destroy','exports','multer','path','connect-timeout','Router','../../components/interaction/service','./interval.controller','get','index','isAuthenticated','show','/:id/sub_intervals'];(function(_0x101579,_0x3ab1dd){var _0xe4c21=function(_0x5c4187){while(--_0x5c4187){_0x101579['push'](_0x101579['shift']());}};_0xe4c21(++_0x3ab1dd);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xfb11[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require(_0x1fb1('0x0'));var util=require('util');var path=require(_0x1fb1('0x1'));var timeout=require(_0x1fb1('0x2'));var express=require('express');var router=express[_0x1fb1('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1fb1('0x4'));var config=require('../../config/environment');var controller=require(_0x1fb1('0x5'));router[_0x1fb1('0x6')]('/',auth['isAuthenticated'](),controller[_0x1fb1('0x7')]);router[_0x1fb1('0x6')]('/:id',auth[_0x1fb1('0x8')](),controller[_0x1fb1('0x9')]);router[_0x1fb1('0x6')](_0x1fb1('0xa'),auth[_0x1fb1('0x8')](),controller[_0x1fb1('0xb')]);router[_0x1fb1('0xc')]('/',auth[_0x1fb1('0x8')](),controller[_0x1fb1('0xd')]);router[_0x1fb1('0xc')]('/:id/sub_intervals',auth[_0x1fb1('0x8')](),controller['addInterval']);router[_0x1fb1('0xc')]('/:id/sub_intervals/create_many',auth[_0x1fb1('0x8')](),controller[_0x1fb1('0xe')]);router[_0x1fb1('0xf')](_0x1fb1('0x10'),auth[_0x1fb1('0x8')](),controller[_0x1fb1('0x11')]);router['delete'](_0x1fb1('0x10'),auth[_0x1fb1('0x8')](),controller[_0x1fb1('0x12')]);module[_0x1fb1('0x13')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index e5f1e9e..e87f4cd 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 _0x893c=['exports','STRING','sequelize'];(function(_0x4fa291,_0x56e289){var _0x506d9b=function(_0x24c31f){while(--_0x24c31f){_0x4fa291['push'](_0x4fa291['shift']());}};_0x506d9b(++_0x56e289);}(_0x893c,0x1be));var _0xc893=function(_0x19c1c8,_0x2f0b5d){_0x19c1c8=_0x19c1c8-0x0;var _0x39a68a=_0x893c[_0x19c1c8];return _0x39a68a;};'use strict';var Sequelize=require(_0xc893('0x0'));module[_0xc893('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc893('0x2')]},'interval':{'type':Sequelize[_0xc893('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xedc4=['exports','STRING','sequelize'];(function(_0x52222b,_0x10120d){var _0x310942=function(_0x667557){while(--_0x667557){_0x52222b['push'](_0x52222b['shift']());}};_0x310942(++_0x10120d);}(_0xedc4,0x13a));var _0x4edc=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xedc4[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x4edc('0x0'));module[_0x4edc('0x1')]={'name':{'type':Sequelize[_0x4edc('0x2')]},'description':{'type':Sequelize[_0x4edc('0x2')]},'interval':{'type':Sequelize[_0x4edc('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index d92a8dd..48a0c02 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 _0x2ddd=['util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','then','end','error','stack','name','send','index','Interval','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','add','day','merge','filter','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','update','params','destroy','IntervalId','getIntervals','findOne','order','map','hasOwnProperty','addIntervals','sequelize','transaction','bulkCreate','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x4586c3,_0x4f9003){var _0x561cdf=function(_0x2caee5){while(--_0x2caee5){_0x4586c3['push'](_0x4586c3['shift']());}};_0x561cdf(++_0x4f9003);}(_0x2ddd,0x197));var _0xd2dd=function(_0x58fc2f,_0x111399){_0x58fc2f=_0x58fc2f-0x0;var _0x3a1312=_0x2ddd[_0x58fc2f];return _0x3a1312;};'use strict';var pdf=require(_0xd2dd('0x0'));var emlformat=require(_0xd2dd('0x1'));var rimraf=require(_0xd2dd('0x2'));var zipdir=require(_0xd2dd('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd2dd('0x4'));var moment=require(_0xd2dd('0x5'));var BPromise=require(_0xd2dd('0x6'));var Mustache=require(_0xd2dd('0x7'));var util=require(_0xd2dd('0x8'));var path=require(_0xd2dd('0x9'));var sox=require(_0xd2dd('0xa'));var csv=require(_0xd2dd('0xb'));var ejs=require(_0xd2dd('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd2dd('0xd'));var crypto=require(_0xd2dd('0xe'));var jsforce=require(_0xd2dd('0xf'));var deskjs=require(_0xd2dd('0x10'));var toCsv=require(_0xd2dd('0xb'));var querystring=require('querystring');var Papa=require(_0xd2dd('0x11'));var Redis=require('ioredis');var qs=require(_0xd2dd('0x12'));var logger=require(_0xd2dd('0x13'))('api');var utils=require(_0xd2dd('0x14'));var config=require(_0xd2dd('0x15'));var db=require(_0xd2dd('0x16'))['db'];var extensions=require(_0xd2dd('0x17'));function respondWithStatusCode(_0x23c3db,_0x3952e6){_0x3952e6=_0x3952e6||0xcc;return function(_0x587765){if(_0x587765){return _0x23c3db[_0xd2dd('0x18')](_0x3952e6);}return _0x23c3db[_0xd2dd('0x19')](_0x3952e6)['end']();};}function respondWithResult(_0x496e5a,_0x2c2135){_0x2c2135=_0x2c2135||0xc8;return function(_0x1faee6){if(_0x1faee6){return _0x496e5a[_0xd2dd('0x19')](_0x2c2135)[_0xd2dd('0x1a')](_0x1faee6);}};}function respondWithFilteredResult(_0xda4bf2,_0x3da992){return function(_0x446bbe){if(_0x446bbe){var _0x118c4e=_0x446bbe['count'],_0x21eb93=_0x3da992[_0xd2dd('0x1b')],_0x161544=_0x3da992[_0xd2dd('0x1b')]+_0x3da992[_0xd2dd('0x1c')],_0x196a15;if(_0x161544>=_0x118c4e){_0x161544=_0x118c4e;_0x196a15=0xc8;}else{_0x196a15=0xce;}_0xda4bf2[_0xd2dd('0x19')](_0x196a15);return _0xda4bf2[_0xd2dd('0x1d')](_0xd2dd('0x1e'),_0x21eb93+'-'+_0x161544+'/'+_0x118c4e)[_0xd2dd('0x1a')](_0x446bbe);}return null;};}function patchUpdates(_0x35dd0e){return function(_0x22b08f){try{jsonpatch[_0xd2dd('0x1f')](_0x22b08f,_0x35dd0e,!![]);}catch(_0x2ff046){return BPromise[_0xd2dd('0x20')](_0x2ff046);}return _0x22b08f['save']();};}function saveUpdates(_0x5e7d8f,_0x58bf67){return function(_0x45503e){if(_0x45503e){return _0x45503e['update'](_0x5e7d8f)[_0xd2dd('0x21')](function(_0x495c3c){return _0x495c3c;});}return null;};}function removeEntity(_0x5b5e1e,_0x3c04a0){return function(_0x41e68d){if(_0x41e68d){return _0x41e68d['destroy']()[_0xd2dd('0x21')](function(){_0x5b5e1e[_0xd2dd('0x19')](0xcc)[_0xd2dd('0x22')]();});}};}function handleEntityNotFound(_0x555a51,_0x395bf8){return function(_0x2a701e){if(!_0x2a701e){_0x555a51[_0xd2dd('0x18')](0x194);}return _0x2a701e;};}function handleError(_0x47e46c,_0x12d36d){_0x12d36d=_0x12d36d||0x1f4;return function(_0xdf5736){logger[_0xd2dd('0x23')](_0xdf5736[_0xd2dd('0x24')]);if(_0xdf5736[_0xd2dd('0x25')]){delete _0xdf5736[_0xd2dd('0x25')];}_0x47e46c['status'](_0x12d36d)[_0xd2dd('0x26')](_0xdf5736);};}exports[_0xd2dd('0x27')]=function(_0x8505b5,_0x4a5c01){var _0x49dbc6={},_0x3ef1c1={},_0x21ad38={'count':0x0,'rows':[]};var _0x3e0267=db[_0xd2dd('0x28')]['rawAttributes'];_0x3ef1c1['model']=_[_0xd2dd('0x29')](_0x3e0267);var _0x3b80d5={'dateStart':_0x8505b5[_0xd2dd('0x2a')][_0xd2dd('0x2b')],'dateEnd':_0x8505b5['query'][_0xd2dd('0x2c')]};delete _0x8505b5['query'][_0xd2dd('0x2b')];delete _0x8505b5['query'][_0xd2dd('0x2c')];_0x3ef1c1['query']=_[_0xd2dd('0x29')](_0x8505b5[_0xd2dd('0x2a')]);_0x3ef1c1[_0xd2dd('0x2d')]=_[_0xd2dd('0x2e')](_0x3ef1c1[_0xd2dd('0x2f')],_0x3ef1c1['query']);_0x49dbc6[_0xd2dd('0x30')]=_[_0xd2dd('0x2e')](_0x3ef1c1[_0xd2dd('0x2f')],qs[_0xd2dd('0x31')](_0x8505b5['query']['fields']));_0x49dbc6[_0xd2dd('0x30')]=_0x49dbc6[_0xd2dd('0x30')][_0xd2dd('0x32')]?_0x49dbc6[_0xd2dd('0x30')]:_0x3ef1c1[_0xd2dd('0x2f')];if(!_0x8505b5[_0xd2dd('0x2a')]['hasOwnProperty'](_0xd2dd('0x33'))){_0x49dbc6[_0xd2dd('0x1c')]=qs[_0xd2dd('0x1c')](_0x8505b5[_0xd2dd('0x2a')][_0xd2dd('0x1c')]);_0x49dbc6['offset']=qs[_0xd2dd('0x1b')](_0x8505b5[_0xd2dd('0x2a')]['offset']);}_0x49dbc6['order']=qs[_0xd2dd('0x34')](_0x8505b5[_0xd2dd('0x2a')][_0xd2dd('0x34')]);_0x49dbc6[_0xd2dd('0x35')]=qs['filters'](_[_0xd2dd('0x36')](_0x8505b5[_0xd2dd('0x2a')],_0x3ef1c1[_0xd2dd('0x2d')]));if(_0x3b80d5[_0xd2dd('0x2b')]){if(_0x3b80d5[_0xd2dd('0x2c')]){_0x3b80d5[_0xd2dd('0x2c')]=moment(_0x3b80d5[_0xd2dd('0x2c')])[_0xd2dd('0x37')](0x1,_0xd2dd('0x38'));}else{_0x3b80d5[_0xd2dd('0x2c')]=moment(_0x3b80d5['dateStart'])[_0xd2dd('0x37')](0x1,_0xd2dd('0x38'));}_[_0xd2dd('0x39')](_0x49dbc6[_0xd2dd('0x35')],{'createdAt':{'$gte':_0x3b80d5[_0xd2dd('0x2b')],'$lte':_0x3b80d5[_0xd2dd('0x2c')]}});}if(_0x8505b5['query'][_0xd2dd('0x3a')]){_0x49dbc6[_0xd2dd('0x35')]=_[_0xd2dd('0x39')](_0x49dbc6['where'],{'$or':_['map'](_0x49dbc6[_0xd2dd('0x30')],function(_0x2bb63d){var _0x2e53e7={};_0x2e53e7[_0x2bb63d]={'$like':'%'+_0x8505b5[_0xd2dd('0x2a')]['filter']+'%'};return _0x2e53e7;})});}_0x49dbc6=_['merge']({},_0x49dbc6,_0x8505b5[_0xd2dd('0x3b')]);var _0x2b594d={'where':_0x49dbc6[_0xd2dd('0x35')]};return db[_0xd2dd('0x28')]['count'](_0x2b594d)[_0xd2dd('0x21')](function(_0x7f0a48){_0x21ad38['count']=_0x7f0a48;if(_0x8505b5['query'][_0xd2dd('0x3c')]){_0x49dbc6[_0xd2dd('0x3d')]=[{'all':!![]}];}return db[_0xd2dd('0x28')][_0xd2dd('0x3e')](_0x49dbc6);})['then'](function(_0x3c5349){_0x21ad38[_0xd2dd('0x3f')]=_0x3c5349;return _0x21ad38;})[_0xd2dd('0x21')](respondWithFilteredResult(_0x4a5c01,_0x49dbc6))[_0xd2dd('0x40')](handleError(_0x4a5c01,null));};exports[_0xd2dd('0x41')]=function(_0x37421b,_0x4a147a){var _0x5c2c93={'raw':!![],'where':{'id':_0x37421b['params']['id']}},_0x28c5e9={};_0x28c5e9[_0xd2dd('0x2f')]=_[_0xd2dd('0x29')](db['Interval'][_0xd2dd('0x42')]);_0x28c5e9[_0xd2dd('0x2a')]=_[_0xd2dd('0x29')](_0x37421b[_0xd2dd('0x2a')]);_0x28c5e9[_0xd2dd('0x2d')]=_[_0xd2dd('0x2e')](_0x28c5e9[_0xd2dd('0x2f')],_0x28c5e9[_0xd2dd('0x2a')]);_0x5c2c93['attributes']=_['intersection'](_0x28c5e9[_0xd2dd('0x2f')],qs['fields'](_0x37421b[_0xd2dd('0x2a')][_0xd2dd('0x31')]));_0x5c2c93['attributes']=_0x5c2c93[_0xd2dd('0x30')]['length']?_0x5c2c93['attributes']:_0x28c5e9[_0xd2dd('0x2f')];if(_0x37421b['query']['includeAll']){_0x5c2c93['include']=[{'all':!![]}];}_0x5c2c93=_[_0xd2dd('0x39')]({},_0x5c2c93,_0x37421b['options']);return db[_0xd2dd('0x28')][_0xd2dd('0x43')](_0x5c2c93)[_0xd2dd('0x21')](handleEntityNotFound(_0x4a147a,null))[_0xd2dd('0x21')](respondWithResult(_0x4a147a,null))[_0xd2dd('0x40')](handleError(_0x4a147a,null));};exports[_0xd2dd('0x44')]=function(_0x4a9232,_0x479e23){return db[_0xd2dd('0x28')][_0xd2dd('0x44')](_0x4a9232[_0xd2dd('0x45')],{})[_0xd2dd('0x21')](respondWithResult(_0x479e23,0xc9))[_0xd2dd('0x40')](handleError(_0x479e23,null));};exports[_0xd2dd('0x46')]=function(_0x4ec10e,_0x4653ed){if(_0x4ec10e[_0xd2dd('0x45')]['id']){delete _0x4ec10e[_0xd2dd('0x45')]['id'];}return db[_0xd2dd('0x28')]['find']({'where':{'id':_0x4ec10e[_0xd2dd('0x47')]['id']}})['then'](handleEntityNotFound(_0x4653ed,null))['then'](saveUpdates(_0x4ec10e[_0xd2dd('0x45')],null))[_0xd2dd('0x21')](respondWithResult(_0x4653ed,null))[_0xd2dd('0x40')](handleError(_0x4653ed,null));};exports[_0xd2dd('0x48')]=function(_0x471c5a,_0x5cbffa){return db['Interval'][_0xd2dd('0x43')]({'where':{'id':_0x471c5a[_0xd2dd('0x47')]['id']}})['then'](handleEntityNotFound(_0x5cbffa,null))[_0xd2dd('0x21')](removeEntity(_0x5cbffa,null))['catch'](handleError(_0x5cbffa,null));};exports['addInterval']=function(_0x49c0ce,_0x4a5d57,_0x1257d0){if(_0x49c0ce[_0xd2dd('0x45')]['id']){delete _0x49c0ce[_0xd2dd('0x45')]['id'];}return db[_0xd2dd('0x28')][_0xd2dd('0x43')]({'where':{'id':_0x49c0ce[_0xd2dd('0x47')]['id']}})[_0xd2dd('0x21')](handleEntityNotFound(_0x4a5d57,null))[_0xd2dd('0x21')](function(_0x26ea21){if(_0x26ea21){_0x49c0ce['body'][_0xd2dd('0x49')]=_0x26ea21['id'];return db[_0xd2dd('0x28')][_0xd2dd('0x44')](_0x49c0ce[_0xd2dd('0x45')]);}})['then'](respondWithResult(_0x4a5d57,null))['catch'](handleError(_0x4a5d57,null));};exports[_0xd2dd('0x4a')]=function(_0x4f5be8,_0x4f49b2,_0x5974a6){var _0x48534c={};var _0x3641aa={};var _0x551e4c;var _0x59e17e;return db[_0xd2dd('0x28')][_0xd2dd('0x4b')]({'where':{'id':_0x4f5be8[_0xd2dd('0x47')]['id']}})[_0xd2dd('0x21')](handleEntityNotFound(_0x4f49b2,null))[_0xd2dd('0x21')](function(_0x3f95e4){if(_0x3f95e4){_0x551e4c=_0x3f95e4;_0x3641aa[_0xd2dd('0x2f')]=_['keys'](db['Interval'][_0xd2dd('0x42')]);_0x3641aa[_0xd2dd('0x2a')]=_[_0xd2dd('0x29')](_0x4f5be8[_0xd2dd('0x2a')]);_0x3641aa[_0xd2dd('0x2d')]=_[_0xd2dd('0x2e')](_0x3641aa[_0xd2dd('0x2f')],_0x3641aa[_0xd2dd('0x2a')]);_0x48534c['attributes']=_['intersection'](_0x3641aa[_0xd2dd('0x2f')],qs[_0xd2dd('0x31')](_0x4f5be8['query']['fields']));_0x48534c[_0xd2dd('0x30')]=_0x48534c[_0xd2dd('0x30')]['length']?_0x48534c[_0xd2dd('0x30')]:_0x3641aa[_0xd2dd('0x2f')];_0x48534c[_0xd2dd('0x4c')]=qs[_0xd2dd('0x34')](_0x4f5be8[_0xd2dd('0x2a')][_0xd2dd('0x34')]);_0x48534c[_0xd2dd('0x35')]=qs[_0xd2dd('0x2d')](_[_0xd2dd('0x36')](_0x4f5be8['query'],_0x3641aa[_0xd2dd('0x2d')]));if(_0x4f5be8[_0xd2dd('0x2a')]['filter']){_0x48534c[_0xd2dd('0x35')]=_[_0xd2dd('0x39')](_0x48534c[_0xd2dd('0x35')],{'$or':_[_0xd2dd('0x4d')](_0x48534c['attributes'],function(_0x5a4db4){var _0x106fb6={};_0x106fb6[_0x5a4db4]={'$like':'%'+_0x4f5be8[_0xd2dd('0x2a')][_0xd2dd('0x3a')]+'%'};return _0x106fb6;})});}_0x48534c=_[_0xd2dd('0x39')]({},_0x48534c,_0x4f5be8[_0xd2dd('0x3b')]);return _0x551e4c[_0xd2dd('0x4a')](_0x48534c);}})['then'](function(_0x59de18){if(_0x59de18){_0x59e17e=_0x59de18['length'];if(!_0x4f5be8[_0xd2dd('0x2a')][_0xd2dd('0x4e')](_0xd2dd('0x33'))){_0x48534c[_0xd2dd('0x1c')]=qs['limit'](_0x4f5be8[_0xd2dd('0x2a')]['limit']);_0x48534c[_0xd2dd('0x1b')]=qs['offset'](_0x4f5be8[_0xd2dd('0x2a')]['offset']);}return _0x551e4c[_0xd2dd('0x4a')](_0x48534c);}})['then'](function(_0x431ece){if(_0x431ece){return _0x431ece?{'count':_0x59e17e,'rows':_0x431ece}:null;}})[_0xd2dd('0x21')](respondWithResult(_0x4f49b2,null))[_0xd2dd('0x40')](handleError(_0x4f49b2,null));};exports[_0xd2dd('0x4f')]=function(_0x49e8f3,_0x4906cd,_0x59b696){return db[_0xd2dd('0x28')][_0xd2dd('0x4b')]({'where':{'id':_0x49e8f3[_0xd2dd('0x47')]['id']}})[_0xd2dd('0x21')](handleEntityNotFound(_0x4906cd,null))[_0xd2dd('0x21')](function(_0x54d08b){if(_0x54d08b){return db[_0xd2dd('0x50')][_0xd2dd('0x51')](function(_0x289e8a){return db[_0xd2dd('0x28')][_0xd2dd('0x48')]({'where':{'IntervalId':_0x49e8f3[_0xd2dd('0x47')]['id']},'transaction':_0x289e8a})[_0xd2dd('0x21')](function(_0xd8915b){var _0x1fa47f=_[_0xd2dd('0x4d')](_0x49e8f3[_0xd2dd('0x45')],function(_0x5e62bc){delete _0x5e62bc['id'];_0x5e62bc[_0xd2dd('0x49')]=_0x49e8f3[_0xd2dd('0x47')]['id'];return _0x5e62bc;});return db[_0xd2dd('0x28')][_0xd2dd('0x52')](_0x1fa47f,{'transaction':_0x289e8a});});})['then'](function(){return db[_0xd2dd('0x28')][_0xd2dd('0x3e')]({'where':{'IntervalId':_0x49e8f3[_0xd2dd('0x47')]['id']}});});}})[_0xd2dd('0x21')](respondWithResult(_0x4906cd,null))[_0xd2dd('0x40')](handleError(_0x4906cd,null));}; \ No newline at end of file +var _0xa679=['destroy','end','error','stack','name','send','index','Interval','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','options','includeAll','findAll','catch','show','params','find','create','body','addInterval','getIntervals','findOne','addIntervals','sequelize','map','IntervalId','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','count','offset','limit','set','apply','reject','save','update','then'];(function(_0x314b4e,_0x13bbc9){var _0x41b54a=function(_0x1557da){while(--_0x1557da){_0x314b4e['push'](_0x314b4e['shift']());}};_0x41b54a(++_0x13bbc9);}(_0xa679,0x7d));var _0x9a67=function(_0x3edad9,_0x3f80f6){_0x3edad9=_0x3edad9-0x0;var _0x4d6271=_0xa679[_0x3edad9];return _0x4d6271;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9a67('0x0'));var rimraf=require(_0x9a67('0x1'));var zipdir=require(_0x9a67('0x2'));var jsonpatch=require(_0x9a67('0x3'));var rp=require(_0x9a67('0x4'));var moment=require(_0x9a67('0x5'));var BPromise=require(_0x9a67('0x6'));var Mustache=require(_0x9a67('0x7'));var util=require('util');var path=require(_0x9a67('0x8'));var sox=require(_0x9a67('0x9'));var csv=require(_0x9a67('0xa'));var ejs=require(_0x9a67('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9a67('0xc'));var deskjs=require(_0x9a67('0xd'));var toCsv=require(_0x9a67('0xa'));var querystring=require(_0x9a67('0xe'));var Papa=require(_0x9a67('0xf'));var Redis=require(_0x9a67('0x10'));var qs=require(_0x9a67('0x11'));var logger=require('../../config/logger')(_0x9a67('0x12'));var utils=require('../../config/utils');var config=require(_0x9a67('0x13'));var db=require(_0x9a67('0x14'))['db'];var extensions=require(_0x9a67('0x15'));function respondWithStatusCode(_0x295295,_0x29d98f){_0x29d98f=_0x29d98f||0xcc;return function(_0x44b6c3){if(_0x44b6c3){return _0x295295[_0x9a67('0x16')](_0x29d98f);}return _0x295295[_0x9a67('0x17')](_0x29d98f)['end']();};}function respondWithResult(_0x3fd504,_0x473914){_0x473914=_0x473914||0xc8;return function(_0x21063c){if(_0x21063c){return _0x3fd504[_0x9a67('0x17')](_0x473914)['json'](_0x21063c);}};}function respondWithFilteredResult(_0x33834b,_0x3fee51){return function(_0x18a97f){if(_0x18a97f){var _0x51e6c0=_0x18a97f[_0x9a67('0x18')],_0x54e6b5=_0x3fee51['offset'],_0x4d5f2d=_0x3fee51[_0x9a67('0x19')]+_0x3fee51[_0x9a67('0x1a')],_0x5a6e74;if(_0x4d5f2d>=_0x51e6c0){_0x4d5f2d=_0x51e6c0;_0x5a6e74=0xc8;}else{_0x5a6e74=0xce;}_0x33834b['status'](_0x5a6e74);return _0x33834b[_0x9a67('0x1b')]('Content-Range',_0x54e6b5+'-'+_0x4d5f2d+'/'+_0x51e6c0)['json'](_0x18a97f);}return null;};}function patchUpdates(_0x412ef2){return function(_0x39318a){try{jsonpatch[_0x9a67('0x1c')](_0x39318a,_0x412ef2,!![]);}catch(_0x574735){return BPromise[_0x9a67('0x1d')](_0x574735);}return _0x39318a[_0x9a67('0x1e')]();};}function saveUpdates(_0x362e27,_0x2d65c5){return function(_0x256098){if(_0x256098){return _0x256098[_0x9a67('0x1f')](_0x362e27)[_0x9a67('0x20')](function(_0x31c039){return _0x31c039;});}return null;};}function removeEntity(_0x110f66,_0x4dafc8){return function(_0x54796a){if(_0x54796a){return _0x54796a[_0x9a67('0x21')]()[_0x9a67('0x20')](function(){_0x110f66[_0x9a67('0x17')](0xcc)[_0x9a67('0x22')]();});}};}function handleEntityNotFound(_0xc9de7b,_0x216e45){return function(_0x35bdf1){if(!_0x35bdf1){_0xc9de7b[_0x9a67('0x16')](0x194);}return _0x35bdf1;};}function handleError(_0x5e082b,_0x1a4204){_0x1a4204=_0x1a4204||0x1f4;return function(_0x165265){logger[_0x9a67('0x23')](_0x165265[_0x9a67('0x24')]);if(_0x165265[_0x9a67('0x25')]){delete _0x165265[_0x9a67('0x25')];}_0x5e082b['status'](_0x1a4204)[_0x9a67('0x26')](_0x165265);};}exports[_0x9a67('0x27')]=function(_0x34ef73,_0x4de59f){var _0x39f00b={},_0x2a88b9={},_0x1bacdb={'count':0x0,'rows':[]};var _0x4cbf2e=db[_0x9a67('0x28')][_0x9a67('0x29')];_0x2a88b9[_0x9a67('0x2a')]=_[_0x9a67('0x2b')](_0x4cbf2e);var _0x2fdc6c={'dateStart':_0x34ef73['query']['dateStart'],'dateEnd':_0x34ef73[_0x9a67('0x2c')][_0x9a67('0x2d')]};delete _0x34ef73[_0x9a67('0x2c')][_0x9a67('0x2e')];delete _0x34ef73[_0x9a67('0x2c')][_0x9a67('0x2d')];_0x2a88b9['query']=_[_0x9a67('0x2b')](_0x34ef73[_0x9a67('0x2c')]);_0x2a88b9[_0x9a67('0x2f')]=_[_0x9a67('0x30')](_0x2a88b9[_0x9a67('0x2a')],_0x2a88b9[_0x9a67('0x2c')]);_0x39f00b[_0x9a67('0x31')]=_[_0x9a67('0x30')](_0x2a88b9[_0x9a67('0x2a')],qs[_0x9a67('0x32')](_0x34ef73[_0x9a67('0x2c')][_0x9a67('0x32')]));_0x39f00b[_0x9a67('0x31')]=_0x39f00b[_0x9a67('0x31')][_0x9a67('0x33')]?_0x39f00b[_0x9a67('0x31')]:_0x2a88b9[_0x9a67('0x2a')];if(!_0x34ef73[_0x9a67('0x2c')][_0x9a67('0x34')](_0x9a67('0x35'))){_0x39f00b[_0x9a67('0x1a')]=qs[_0x9a67('0x1a')](_0x34ef73[_0x9a67('0x2c')][_0x9a67('0x1a')]);_0x39f00b[_0x9a67('0x19')]=qs['offset'](_0x34ef73[_0x9a67('0x2c')]['offset']);}_0x39f00b[_0x9a67('0x36')]=qs[_0x9a67('0x37')](_0x34ef73[_0x9a67('0x2c')][_0x9a67('0x37')]);_0x39f00b[_0x9a67('0x38')]=qs[_0x9a67('0x2f')](_[_0x9a67('0x39')](_0x34ef73[_0x9a67('0x2c')],_0x2a88b9['filters']));if(_0x2fdc6c[_0x9a67('0x2e')]){if(_0x2fdc6c['dateEnd']){_0x2fdc6c[_0x9a67('0x2d')]=moment(_0x2fdc6c[_0x9a67('0x2d')])[_0x9a67('0x3a')](0x1,_0x9a67('0x3b'));}else{_0x2fdc6c[_0x9a67('0x2d')]=moment(_0x2fdc6c['dateStart'])[_0x9a67('0x3a')](0x1,_0x9a67('0x3b'));}_[_0x9a67('0x3c')](_0x39f00b[_0x9a67('0x38')],{'createdAt':{'$gte':_0x2fdc6c[_0x9a67('0x2e')],'$lte':_0x2fdc6c['dateEnd']}});}if(_0x34ef73[_0x9a67('0x2c')][_0x9a67('0x3d')]){_0x39f00b[_0x9a67('0x38')]=_[_0x9a67('0x3c')](_0x39f00b[_0x9a67('0x38')],{'$or':_['map'](_0x39f00b[_0x9a67('0x31')],function(_0x540378){var _0x3e3c1d={};_0x3e3c1d[_0x540378]={'$like':'%'+_0x34ef73[_0x9a67('0x2c')][_0x9a67('0x3d')]+'%'};return _0x3e3c1d;})});}_0x39f00b=_[_0x9a67('0x3c')]({},_0x39f00b,_0x34ef73[_0x9a67('0x3e')]);var _0x498e12={'where':_0x39f00b['where']};return db['Interval'][_0x9a67('0x18')](_0x498e12)[_0x9a67('0x20')](function(_0x4b0380){_0x1bacdb[_0x9a67('0x18')]=_0x4b0380;if(_0x34ef73['query'][_0x9a67('0x3f')]){_0x39f00b['include']=[{'all':!![]}];}return db['Interval'][_0x9a67('0x40')](_0x39f00b);})[_0x9a67('0x20')](function(_0xc1bf47){_0x1bacdb['rows']=_0xc1bf47;return _0x1bacdb;})[_0x9a67('0x20')](respondWithFilteredResult(_0x4de59f,_0x39f00b))[_0x9a67('0x41')](handleError(_0x4de59f,null));};exports[_0x9a67('0x42')]=function(_0x22ae33,_0x5501c3){var _0x5dde54={'raw':!![],'where':{'id':_0x22ae33[_0x9a67('0x43')]['id']}},_0x332fc2={};_0x332fc2[_0x9a67('0x2a')]=_[_0x9a67('0x2b')](db[_0x9a67('0x28')]['rawAttributes']);_0x332fc2['query']=_[_0x9a67('0x2b')](_0x22ae33[_0x9a67('0x2c')]);_0x332fc2[_0x9a67('0x2f')]=_[_0x9a67('0x30')](_0x332fc2[_0x9a67('0x2a')],_0x332fc2[_0x9a67('0x2c')]);_0x5dde54[_0x9a67('0x31')]=_[_0x9a67('0x30')](_0x332fc2[_0x9a67('0x2a')],qs[_0x9a67('0x32')](_0x22ae33[_0x9a67('0x2c')]['fields']));_0x5dde54[_0x9a67('0x31')]=_0x5dde54[_0x9a67('0x31')]['length']?_0x5dde54[_0x9a67('0x31')]:_0x332fc2['model'];if(_0x22ae33[_0x9a67('0x2c')][_0x9a67('0x3f')]){_0x5dde54['include']=[{'all':!![]}];}_0x5dde54=_[_0x9a67('0x3c')]({},_0x5dde54,_0x22ae33[_0x9a67('0x3e')]);return db[_0x9a67('0x28')][_0x9a67('0x44')](_0x5dde54)[_0x9a67('0x20')](handleEntityNotFound(_0x5501c3,null))[_0x9a67('0x20')](respondWithResult(_0x5501c3,null))[_0x9a67('0x41')](handleError(_0x5501c3,null));};exports[_0x9a67('0x45')]=function(_0x20f99c,_0x4c4a2d){return db[_0x9a67('0x28')][_0x9a67('0x45')](_0x20f99c[_0x9a67('0x46')],{})[_0x9a67('0x20')](respondWithResult(_0x4c4a2d,0xc9))['catch'](handleError(_0x4c4a2d,null));};exports[_0x9a67('0x1f')]=function(_0x48368a,_0x2d0ef4){if(_0x48368a[_0x9a67('0x46')]['id']){delete _0x48368a['body']['id'];}return db[_0x9a67('0x28')][_0x9a67('0x44')]({'where':{'id':_0x48368a[_0x9a67('0x43')]['id']}})[_0x9a67('0x20')](handleEntityNotFound(_0x2d0ef4,null))[_0x9a67('0x20')](saveUpdates(_0x48368a[_0x9a67('0x46')],null))['then'](respondWithResult(_0x2d0ef4,null))[_0x9a67('0x41')](handleError(_0x2d0ef4,null));};exports[_0x9a67('0x21')]=function(_0x519afd,_0x48f07b){return db[_0x9a67('0x28')][_0x9a67('0x44')]({'where':{'id':_0x519afd[_0x9a67('0x43')]['id']}})[_0x9a67('0x20')](handleEntityNotFound(_0x48f07b,null))[_0x9a67('0x20')](removeEntity(_0x48f07b,null))['catch'](handleError(_0x48f07b,null));};exports[_0x9a67('0x47')]=function(_0x2c0728,_0x4d8f59,_0x267c4d){if(_0x2c0728[_0x9a67('0x46')]['id']){delete _0x2c0728['body']['id'];}return db[_0x9a67('0x28')]['find']({'where':{'id':_0x2c0728['params']['id']}})['then'](handleEntityNotFound(_0x4d8f59,null))[_0x9a67('0x20')](function(_0x32ac64){if(_0x32ac64){_0x2c0728[_0x9a67('0x46')]['IntervalId']=_0x32ac64['id'];return db[_0x9a67('0x28')][_0x9a67('0x45')](_0x2c0728[_0x9a67('0x46')]);}})[_0x9a67('0x20')](respondWithResult(_0x4d8f59,null))[_0x9a67('0x41')](handleError(_0x4d8f59,null));};exports[_0x9a67('0x48')]=function(_0x3aa0d1,_0x3ca26e,_0x307acc){var _0x105c81={};var _0x500c18={};var _0x55482e;var _0x37f53c;return db[_0x9a67('0x28')][_0x9a67('0x49')]({'where':{'id':_0x3aa0d1['params']['id']}})[_0x9a67('0x20')](handleEntityNotFound(_0x3ca26e,null))['then'](function(_0x224f86){if(_0x224f86){_0x55482e=_0x224f86;_0x500c18[_0x9a67('0x2a')]=_[_0x9a67('0x2b')](db[_0x9a67('0x28')][_0x9a67('0x29')]);_0x500c18[_0x9a67('0x2c')]=_[_0x9a67('0x2b')](_0x3aa0d1[_0x9a67('0x2c')]);_0x500c18[_0x9a67('0x2f')]=_[_0x9a67('0x30')](_0x500c18[_0x9a67('0x2a')],_0x500c18[_0x9a67('0x2c')]);_0x105c81['attributes']=_[_0x9a67('0x30')](_0x500c18[_0x9a67('0x2a')],qs[_0x9a67('0x32')](_0x3aa0d1['query']['fields']));_0x105c81[_0x9a67('0x31')]=_0x105c81[_0x9a67('0x31')][_0x9a67('0x33')]?_0x105c81[_0x9a67('0x31')]:_0x500c18[_0x9a67('0x2a')];_0x105c81[_0x9a67('0x36')]=qs[_0x9a67('0x37')](_0x3aa0d1['query']['sort']);_0x105c81[_0x9a67('0x38')]=qs[_0x9a67('0x2f')](_['pick'](_0x3aa0d1['query'],_0x500c18[_0x9a67('0x2f')]));if(_0x3aa0d1[_0x9a67('0x2c')][_0x9a67('0x3d')]){_0x105c81[_0x9a67('0x38')]=_[_0x9a67('0x3c')](_0x105c81['where'],{'$or':_['map'](_0x105c81[_0x9a67('0x31')],function(_0x1270eb){var _0x369110={};_0x369110[_0x1270eb]={'$like':'%'+_0x3aa0d1[_0x9a67('0x2c')][_0x9a67('0x3d')]+'%'};return _0x369110;})});}_0x105c81=_[_0x9a67('0x3c')]({},_0x105c81,_0x3aa0d1[_0x9a67('0x3e')]);return _0x55482e[_0x9a67('0x48')](_0x105c81);}})[_0x9a67('0x20')](function(_0x568b6a){if(_0x568b6a){_0x37f53c=_0x568b6a['length'];if(!_0x3aa0d1['query'][_0x9a67('0x34')](_0x9a67('0x35'))){_0x105c81[_0x9a67('0x1a')]=qs[_0x9a67('0x1a')](_0x3aa0d1['query'][_0x9a67('0x1a')]);_0x105c81[_0x9a67('0x19')]=qs[_0x9a67('0x19')](_0x3aa0d1[_0x9a67('0x2c')]['offset']);}return _0x55482e['getIntervals'](_0x105c81);}})[_0x9a67('0x20')](function(_0x43eb1e){if(_0x43eb1e){return _0x43eb1e?{'count':_0x37f53c,'rows':_0x43eb1e}:null;}})[_0x9a67('0x20')](respondWithResult(_0x3ca26e,null))['catch'](handleError(_0x3ca26e,null));};exports[_0x9a67('0x4a')]=function(_0x5daefe,_0xee7aa6,_0x315c08){return db[_0x9a67('0x28')][_0x9a67('0x49')]({'where':{'id':_0x5daefe[_0x9a67('0x43')]['id']}})[_0x9a67('0x20')](handleEntityNotFound(_0xee7aa6,null))[_0x9a67('0x20')](function(_0x48a3a4){if(_0x48a3a4){return db[_0x9a67('0x4b')]['transaction'](function(_0x188a3e){return db['Interval'][_0x9a67('0x21')]({'where':{'IntervalId':_0x5daefe[_0x9a67('0x43')]['id']},'transaction':_0x188a3e})[_0x9a67('0x20')](function(_0x3632f1){var _0x3177c8=_[_0x9a67('0x4c')](_0x5daefe[_0x9a67('0x46')],function(_0x3ce44b){delete _0x3ce44b['id'];_0x3ce44b[_0x9a67('0x4d')]=_0x5daefe[_0x9a67('0x43')]['id'];return _0x3ce44b;});return db[_0x9a67('0x28')][_0x9a67('0x4e')](_0x3177c8,{'transaction':_0x188a3e});});})['then'](function(){return db[_0x9a67('0x28')][_0x9a67('0x40')]({'where':{'IntervalId':_0x5daefe[_0x9a67('0x43')]['id']}});});}})[_0x9a67('0x20')](respondWithResult(_0xee7aa6,null))[_0x9a67('0x41')](handleError(_0xee7aa6,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 74bdb10..6d13753 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 _0xb71c=['util','../../config/logger','api','moment','bluebird','request-promise','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','lodash'];(function(_0x3c4a7c,_0x2f4e3c){var _0xf13d1e=function(_0x24cb78){while(--_0x24cb78){_0x3c4a7c['push'](_0x3c4a7c['shift']());}};_0xf13d1e(++_0x2f4e3c);}(_0xb71c,0x14f));var _0xcb71=function(_0x474e16,_0x18192d){_0x474e16=_0x474e16-0x0;var _0x2ae59b=_0xb71c[_0x474e16];return _0x2ae59b;};'use strict';var _=require(_0xcb71('0x0'));var util=require(_0xcb71('0x1'));var logger=require(_0xcb71('0x2'))(_0xcb71('0x3'));var moment=require(_0xcb71('0x4'));var BPromise=require(_0xcb71('0x5'));var rp=require(_0xcb71('0x6'));var attributes=require(_0xcb71('0x7'));var extensions=require(_0xcb71('0x8'));module[_0xcb71('0x9')]=function(_0x416139,_0x3b3f81){return _0x416139[_0xcb71('0xa')](_0xcb71('0xb'),attributes,{'tableName':_0xcb71('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1e3716,_0xa8d14a){extensions[_0xcb71('0xd')](_0x416139,_0x1e3716);},'afterBulkCreate':function(_0x4a3960,_0x445a21,_0x41f217){_0x41f217();extensions[_0xcb71('0xd')](_0x416139,_0x4a3960[0x0]);},'afterUpdate':function(_0x1a72f1,_0x1aa9ef){extensions[_0xcb71('0xd')](_0x416139,_0x1a72f1);},'afterDestroy':function(_0x492c9f,_0x4c6ab1){extensions[_0xcb71('0xd')](_0x416139,_0x492c9f);}}});}; \ No newline at end of file +var _0xa78c=['Interval','tools_intervals','rewrite','util','../../config/logger','api','bluebird','request-promise','./interval.attributes','../../components/extensions/rewrite','exports','define'];(function(_0x1f960e,_0x39c1ac){var _0x5e9c73=function(_0x2776bb){while(--_0x2776bb){_0x1f960e['push'](_0x1f960e['shift']());}};_0x5e9c73(++_0x39c1ac);}(_0xa78c,0x18f));var _0xca78=function(_0x1891a0,_0x2727de){_0x1891a0=_0x1891a0-0x0;var _0x1965f5=_0xa78c[_0x1891a0];return _0x1965f5;};'use strict';var _=require('lodash');var util=require(_0xca78('0x0'));var logger=require(_0xca78('0x1'))(_0xca78('0x2'));var moment=require('moment');var BPromise=require(_0xca78('0x3'));var rp=require(_0xca78('0x4'));var attributes=require(_0xca78('0x5'));var extensions=require(_0xca78('0x6'));module[_0xca78('0x7')]=function(_0x39f488,_0x56da7f){return _0x39f488[_0xca78('0x8')](_0xca78('0x9'),attributes,{'tableName':_0xca78('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x12ab43,_0x18be9c){extensions[_0xca78('0xb')](_0x39f488,_0x12ab43);},'afterBulkCreate':function(_0x758f53,_0x51f2b1,_0x2c5e5a){_0x2c5e5a();extensions[_0xca78('0xb')](_0x39f488,_0x758f53[0x0]);},'afterUpdate':function(_0x1bc24f,_0x36c664){extensions['rewrite'](_0x39f488,_0x1bc24f);},'afterDestroy':function(_0x2317a2,_0x311cb7){extensions[_0xca78('0xb')](_0x39f488,_0x2317a2);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index d179173..899627a 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 _0x7c09=['../../config/logger','rpc','../../config/environment','then','info','Interval,\x20%s,\x20%s','Interval,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Interval','findAll','options','raw','attributes','limit','include','map','model','GetInterval','debug','ShowInterval','where','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x32bbeb,_0x572c88){var _0x1c1517=function(_0x494592){while(--_0x494592){_0x32bbeb['push'](_0x32bbeb['shift']());}};_0x1c1517(++_0x572c88);}(_0x7c09,0x102));var _0x97c0=function(_0x3da8d6,_0x5c47f1){_0x3da8d6=_0x3da8d6-0x0;var _0x49ca7f=_0x7c09[_0x3da8d6];return _0x49ca7f;};'use strict';var _=require('lodash');var util=require(_0x97c0('0x0'));var moment=require(_0x97c0('0x1'));var BPromise=require('bluebird');var rs=require(_0x97c0('0x2'));var fs=require('fs');var Redis=require(_0x97c0('0x3'));var db=require(_0x97c0('0x4'))['db'];var utils=require(_0x97c0('0x5'));var logger=require(_0x97c0('0x6'))(_0x97c0('0x7'));var config=require(_0x97c0('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46fdd9,_0x42c6c7,_0x2c19fa){return new BPromise(function(_0x109bc8,_0x293785){return client['request'](_0x46fdd9,_0x2c19fa)[_0x97c0('0x9')](function(_0x4ac5f1){logger[_0x97c0('0xa')](_0x97c0('0xb'),_0x42c6c7,'request\x20sent');logger['debug'](_0x97c0('0xc'),_0x42c6c7,_0x97c0('0xd'),JSON[_0x97c0('0xe')](_0x4ac5f1));if(_0x4ac5f1[_0x97c0('0xf')]){if(_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x10')]===0x1f4){logger[_0x97c0('0xf')](_0x97c0('0xb'),_0x42c6c7,_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x11')]);return _0x293785(_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x11')]);}logger[_0x97c0('0xf')]('Interval,\x20%s,\x20%s',_0x42c6c7,_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x11')]);return _0x109bc8(_0x4ac5f1[_0x97c0('0xf')]['message']);}else{logger[_0x97c0('0xa')](_0x97c0('0xb'),_0x42c6c7,_0x97c0('0xd'));_0x109bc8(_0x4ac5f1[_0x97c0('0x12')][_0x97c0('0x11')]);}})[_0x97c0('0x13')](function(_0x49c0d9){logger[_0x97c0('0xf')](_0x97c0('0xb'),_0x42c6c7,_0x49c0d9);_0x293785(_0x49c0d9);});});}exports['GetInterval']=function(_0x560ac0){var _0x16918b=this;return new Promise(function(_0x179d43,_0xe81408){return db[_0x97c0('0x14')][_0x97c0('0x15')]({'raw':_0x560ac0[_0x97c0('0x16')]?_0x560ac0[_0x97c0('0x16')][_0x97c0('0x17')]===undefined?!![]:![]:!![],'where':_0x560ac0[_0x97c0('0x16')]?_0x560ac0['options']['where']||null:null,'attributes':_0x560ac0[_0x97c0('0x16')]?_0x560ac0[_0x97c0('0x16')][_0x97c0('0x18')]||null:null,'limit':_0x560ac0['options']?_0x560ac0[_0x97c0('0x16')][_0x97c0('0x19')]||null:null,'include':_0x560ac0[_0x97c0('0x16')]?_0x560ac0[_0x97c0('0x16')][_0x97c0('0x1a')]?_[_0x97c0('0x1b')](_0x560ac0[_0x97c0('0x16')]['include'],function(_0x60ab00){return{'model':db[_0x60ab00[_0x97c0('0x1c')]],'as':_0x60ab00['as'],'attributes':_0x60ab00[_0x97c0('0x18')],'include':_0x60ab00[_0x97c0('0x1a')]?_['map'](_0x60ab00[_0x97c0('0x1a')],function(_0x14cada){return{'model':db[_0x14cada['model']],'as':_0x14cada['as'],'attributes':_0x14cada[_0x97c0('0x18')],'include':_0x14cada[_0x97c0('0x1a')]?_[_0x97c0('0x1b')](_0x14cada['include'],function(_0x4f11ba){return{'model':db[_0x4f11ba['model']],'as':_0x4f11ba['as'],'attributes':_0x4f11ba[_0x97c0('0x18')]};}):[]};}):[]};}):[]:[]})[_0x97c0('0x9')](function(_0x3a744c){logger[_0x97c0('0xa')](_0x97c0('0x1d'),_0x560ac0);logger[_0x97c0('0x1e')]('GetInterval',_0x560ac0,JSON[_0x97c0('0xe')](_0x3a744c));_0x179d43(_0x3a744c);})[_0x97c0('0x13')](function(_0x325090){logger['error'](_0x97c0('0x1d'),_0x325090[_0x97c0('0x11')],_0x560ac0);_0xe81408(_0x16918b[_0x97c0('0xf')](0x1f4,_0x325090[_0x97c0('0x11')]));});});};exports[_0x97c0('0x1f')]=function(_0x5c4e4e){var _0x59abbb=this;return new Promise(function(_0x29ad98,_0x353fc9){return db[_0x97c0('0x14')]['find']({'raw':_0x5c4e4e[_0x97c0('0x16')]?_0x5c4e4e[_0x97c0('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5c4e4e[_0x97c0('0x16')]?_0x5c4e4e[_0x97c0('0x16')][_0x97c0('0x20')]||null:null,'attributes':_0x5c4e4e[_0x97c0('0x16')]?_0x5c4e4e[_0x97c0('0x16')][_0x97c0('0x18')]||null:null,'include':_0x5c4e4e[_0x97c0('0x16')]?_0x5c4e4e[_0x97c0('0x16')][_0x97c0('0x1a')]?_[_0x97c0('0x1b')](_0x5c4e4e[_0x97c0('0x16')][_0x97c0('0x1a')],function(_0x1de938){return{'model':db[_0x1de938[_0x97c0('0x1c')]],'as':_0x1de938['as'],'attributes':_0x1de938[_0x97c0('0x18')],'include':_0x1de938['include']?_[_0x97c0('0x1b')](_0x1de938[_0x97c0('0x1a')],function(_0x2b7f9a){return{'model':db[_0x2b7f9a[_0x97c0('0x1c')]],'as':_0x2b7f9a['as'],'attributes':_0x2b7f9a[_0x97c0('0x18')],'include':_0x2b7f9a[_0x97c0('0x1a')]?_[_0x97c0('0x1b')](_0x2b7f9a[_0x97c0('0x1a')],function(_0x582828){return{'model':db[_0x582828[_0x97c0('0x1c')]],'as':_0x582828['as'],'attributes':_0x582828['attributes']};}):[]};}):[]};}):[]:[]})[_0x97c0('0x9')](function(_0x20291){logger[_0x97c0('0xa')](_0x97c0('0x1f'),_0x5c4e4e);logger[_0x97c0('0x1e')](_0x97c0('0x1f'),_0x5c4e4e,JSON[_0x97c0('0xe')](_0x20291));_0x29ad98(_0x20291);})[_0x97c0('0x13')](function(_0x38f37a){logger[_0x97c0('0xf')](_0x97c0('0x1f'),_0x38f37a['message'],_0x5c4e4e);_0x353fc9(_0x59abbb[_0x97c0('0xf')](0x1f4,_0x38f37a[_0x97c0('0x11')]));});});}; \ No newline at end of file +var _0x5292=['info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetInterval','Interval','findAll','options','where','attributes','include','map','model','then','catch','raw','ShowInterval','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request'];(function(_0x150265,_0x4d3911){var _0x5502cb=function(_0x3a1f44){while(--_0x3a1f44){_0x150265['push'](_0x150265['shift']());}};_0x5502cb(++_0x4d3911);}(_0x5292,0xf7));var _0x2529=function(_0x13844e,_0x14d041){_0x13844e=_0x13844e-0x0;var _0x5183b0=_0x5292[_0x13844e];return _0x5183b0;};'use strict';var _=require(_0x2529('0x0'));var util=require(_0x2529('0x1'));var moment=require('moment');var BPromise=require(_0x2529('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2529('0x3'));var db=require(_0x2529('0x4'))['db'];var utils=require(_0x2529('0x5'));var logger=require(_0x2529('0x6'))('rpc');var config=require(_0x2529('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x407277,_0x43cbef,_0x5bb8a1){return new BPromise(function(_0x5c3355,_0x395ba9){return client[_0x2529('0x8')](_0x407277,_0x5bb8a1)['then'](function(_0xa234ac){logger[_0x2529('0x9')](_0x2529('0xa'),_0x43cbef,_0x2529('0xb'));logger[_0x2529('0xc')](_0x2529('0xd'),_0x43cbef,_0x2529('0xb'),JSON[_0x2529('0xe')](_0xa234ac));if(_0xa234ac['error']){if(_0xa234ac[_0x2529('0xf')][_0x2529('0x10')]===0x1f4){logger['error'](_0x2529('0xa'),_0x43cbef,_0xa234ac[_0x2529('0xf')][_0x2529('0x11')]);return _0x395ba9(_0xa234ac[_0x2529('0xf')][_0x2529('0x11')]);}logger[_0x2529('0xf')](_0x2529('0xa'),_0x43cbef,_0xa234ac['error'][_0x2529('0x11')]);return _0x5c3355(_0xa234ac[_0x2529('0xf')][_0x2529('0x11')]);}else{logger[_0x2529('0x9')](_0x2529('0xa'),_0x43cbef,_0x2529('0xb'));_0x5c3355(_0xa234ac[_0x2529('0x12')][_0x2529('0x11')]);}})['catch'](function(_0x163bf4){logger['error'](_0x2529('0xa'),_0x43cbef,_0x163bf4);_0x395ba9(_0x163bf4);});});}exports[_0x2529('0x13')]=function(_0x89be58){var _0x49aa27=this;return new Promise(function(_0x5b4d0d,_0xed24cf){return db[_0x2529('0x14')][_0x2529('0x15')]({'raw':_0x89be58[_0x2529('0x16')]?_0x89be58[_0x2529('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x89be58[_0x2529('0x16')]?_0x89be58[_0x2529('0x16')][_0x2529('0x17')]||null:null,'attributes':_0x89be58[_0x2529('0x16')]?_0x89be58['options'][_0x2529('0x18')]||null:null,'limit':_0x89be58[_0x2529('0x16')]?_0x89be58[_0x2529('0x16')]['limit']||null:null,'include':_0x89be58[_0x2529('0x16')]?_0x89be58[_0x2529('0x16')][_0x2529('0x19')]?_[_0x2529('0x1a')](_0x89be58['options'][_0x2529('0x19')],function(_0x2d0c6d){return{'model':db[_0x2d0c6d[_0x2529('0x1b')]],'as':_0x2d0c6d['as'],'attributes':_0x2d0c6d[_0x2529('0x18')],'include':_0x2d0c6d[_0x2529('0x19')]?_[_0x2529('0x1a')](_0x2d0c6d['include'],function(_0x5539ef){return{'model':db[_0x5539ef[_0x2529('0x1b')]],'as':_0x5539ef['as'],'attributes':_0x5539ef[_0x2529('0x18')],'include':_0x5539ef[_0x2529('0x19')]?_[_0x2529('0x1a')](_0x5539ef[_0x2529('0x19')],function(_0x2a8371){return{'model':db[_0x2a8371[_0x2529('0x1b')]],'as':_0x2a8371['as'],'attributes':_0x2a8371[_0x2529('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2529('0x1c')](function(_0x113df6){logger['info'](_0x2529('0x13'),_0x89be58);logger[_0x2529('0xc')]('GetInterval',_0x89be58,JSON[_0x2529('0xe')](_0x113df6));_0x5b4d0d(_0x113df6);})[_0x2529('0x1d')](function(_0x5bea2d){logger[_0x2529('0xf')](_0x2529('0x13'),_0x5bea2d['message'],_0x89be58);_0xed24cf(_0x49aa27[_0x2529('0xf')](0x1f4,_0x5bea2d[_0x2529('0x11')]));});});};exports['ShowInterval']=function(_0x96bd62){var _0x24e437=this;return new Promise(function(_0x3c2dba,_0x203acb){return db[_0x2529('0x14')]['find']({'raw':_0x96bd62[_0x2529('0x16')]?_0x96bd62[_0x2529('0x16')][_0x2529('0x1e')]===undefined?!![]:![]:!![],'where':_0x96bd62[_0x2529('0x16')]?_0x96bd62[_0x2529('0x16')][_0x2529('0x17')]||null:null,'attributes':_0x96bd62[_0x2529('0x16')]?_0x96bd62['options']['attributes']||null:null,'include':_0x96bd62[_0x2529('0x16')]?_0x96bd62['options'][_0x2529('0x19')]?_['map'](_0x96bd62['options']['include'],function(_0x30cdfb){return{'model':db[_0x30cdfb[_0x2529('0x1b')]],'as':_0x30cdfb['as'],'attributes':_0x30cdfb[_0x2529('0x18')],'include':_0x30cdfb['include']?_[_0x2529('0x1a')](_0x30cdfb['include'],function(_0x585ab5){return{'model':db[_0x585ab5['model']],'as':_0x585ab5['as'],'attributes':_0x585ab5[_0x2529('0x18')],'include':_0x585ab5[_0x2529('0x19')]?_[_0x2529('0x1a')](_0x585ab5[_0x2529('0x19')],function(_0x42551b){return{'model':db[_0x42551b[_0x2529('0x1b')]],'as':_0x42551b['as'],'attributes':_0x42551b[_0x2529('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2529('0x1c')](function(_0xd6e419){logger[_0x2529('0x9')](_0x2529('0x1f'),_0x96bd62);logger[_0x2529('0xc')](_0x2529('0x1f'),_0x96bd62,JSON['stringify'](_0xd6e419));_0x3c2dba(_0xd6e419);})['catch'](function(_0xadb4a2){logger[_0x2529('0xf')]('ShowInterval',_0xadb4a2[_0x2529('0x11')],_0x96bd62);_0x203acb(_0x24e437[_0x2529('0xf')](0x1f4,_0xadb4a2[_0x2529('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 9ed882e..4a7a579 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 _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x2ad0b5,_0x5882c9){var _0x4b3c0d=function(_0x11a2d2){while(--_0x11a2d2){_0x2ad0b5['push'](_0x2ad0b5['shift']());}};_0x4b3c0d(++_0x5882c9);}(_0x2ef3,0xba));var _0x32ef=function(_0x5deed2,_0x563cfe){_0x5deed2=_0x5deed2-0x0;var _0x3657b2=_0x2ef3[_0x5deed2];return _0x3657b2;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file +var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x30e60d,_0x40d067){var _0x2fd339=function(_0x2538ac){while(--_0x2538ac){_0x30e60d['push'](_0x30e60d['shift']());}};_0x2fd339(++_0x40d067);}(_0x2032,0xd9));var _0x2203=function(_0x14ffe0,_0x3c086e){_0x14ffe0=_0x14ffe0-0x0;var _0xb1909d=_0x2032[_0x14ffe0];return _0xb1909d;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('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 7225a24..e518e9c 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 _0xb7e7=['reason','track.xcallymotion.com','POST','toString','base64','setEncoding','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','../../config/logger','support','key','MOTGUI','\x20from\x20','description','stringify','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xb7e7[_0x2aec52];return _0x3b8835;};'use strict';var BPromise=require(_0x7b7e('0x0'));var https=require('https');var logger=require(_0x7b7e('0x1'))('api');var USERNAME=_0x7b7e('0x2');var PASSWORD='3eAmWpBVP0';function openIssue(_0x3f5804,_0x556d68){var _0x31d0ed={'fields':{'project':{'key':_0x3f5804[_0x7b7e('0x3')]||_0x7b7e('0x4')},'summary':(_0x3f5804['summary']||'Report')+_0x7b7e('0x5')+_0x3f5804['ip'],'description':_0x3f5804[_0x7b7e('0x6')]||JSON[_0x7b7e('0x7')](_0x3f5804),'issuetype':{'name':_0x3f5804['issuetype']||_0x7b7e('0x8')}}};_0x31d0ed[_0x7b7e('0x9')][_0x7b7e('0xa')]=_0x3f5804[_0x7b7e('0xb')];_0x31d0ed[_0x7b7e('0x9')][_0x7b7e('0xc')]=_0x3f5804[_0x7b7e('0xd')];_0x31d0ed['fields'][_0x7b7e('0xe')]=_0x3f5804[_0x7b7e('0xf')];_0x31d0ed[_0x7b7e('0x9')][_0x7b7e('0x10')]=_0x3f5804[_0x7b7e('0x11')];_0x31d0ed[_0x7b7e('0x9')][_0x7b7e('0x12')]=_0x3f5804[_0x7b7e('0x13')];_0x31d0ed[_0x7b7e('0x9')]['customfield_10102']=_0x3f5804['ip'];var _0x267446={'host':_0x7b7e('0x14'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x7b7e('0x15'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x7b7e('0x16')](_0x7b7e('0x17'))}};var _0xf067da=JSON[_0x7b7e('0x7')](_0x31d0ed);var _0x3d2fb2=https['request'](_0x267446,function(_0x51baf6){_0x51baf6[_0x7b7e('0x18')](_0x7b7e('0x19'));var _0x27f999='';_0x51baf6['on'](_0x7b7e('0x1a'),function(_0x2cc400){_0x27f999+=_0x2cc400;});_0x51baf6['on'](_0x7b7e('0x1b'),function(){if(_0x556d68){return _0x556d68[_0x7b7e('0x1c')](_0x51baf6[_0x7b7e('0x1d')])[_0x7b7e('0x1e')](JSON[_0x7b7e('0x1f')](_0x27f999));}});});_0x3d2fb2['on'](_0x7b7e('0x20'),function(_0x14f4fe){if(_0x556d68){return _0x556d68[_0x7b7e('0x1c')](0x1f4)[_0x7b7e('0x1e')]({'errors':[{'message':_0x7b7e('0x21'),'type':_0x7b7e('0x22')}]});}});_0x3d2fb2[_0x7b7e('0x23')](_0xf067da);_0x3d2fb2['end']();}exports[_0x7b7e('0x24')]=openIssue;exports[_0x7b7e('0x25')]=function(_0x24718c,_0x4c0647){_0x24718c[_0x7b7e('0x26')]['ip']=_0x24718c[_0x7b7e('0x27')][_0x7b7e('0x28')]||_0x24718c[_0x7b7e('0x29')][_0x7b7e('0x2a')]||_0x24718c[_0x7b7e('0x2b')][_0x7b7e('0x2a')]||_0x24718c[_0x7b7e('0x29')]['socket']['remoteAddress'];return openIssue(_0x24718c['body'],_0x4c0647);}; \ No newline at end of file +var _0xe706=['key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','toString','utf8','end','statusCode','json','status','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','remoteAddress','socket','bluebird','https','../../config/logger','support','3eAmWpBVP0'];(function(_0x2de9fb,_0x2fc7f8){var _0x1eb7d0=function(_0x26be8a){while(--_0x26be8a){_0x2de9fb['push'](_0x2de9fb['shift']());}};_0x1eb7d0(++_0x2fc7f8);}(_0xe706,0xa3));var _0x6e70=function(_0x5c3432,_0x46c2b2){_0x5c3432=_0x5c3432-0x0;var _0x2985cd=_0xe706[_0x5c3432];return _0x2985cd;};'use strict';var BPromise=require(_0x6e70('0x0'));var https=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var USERNAME=_0x6e70('0x3');var PASSWORD=_0x6e70('0x4');function openIssue(_0x2ca810,_0x7dfbc3){var _0x142c27={'fields':{'project':{'key':_0x2ca810[_0x6e70('0x5')]||_0x6e70('0x6')},'summary':(_0x2ca810[_0x6e70('0x7')]||_0x6e70('0x8'))+_0x6e70('0x9')+_0x2ca810['ip'],'description':_0x2ca810[_0x6e70('0xa')]||JSON[_0x6e70('0xb')](_0x2ca810),'issuetype':{'name':_0x2ca810[_0x6e70('0xc')]||_0x6e70('0xd')}}};_0x142c27[_0x6e70('0xe')][_0x6e70('0xf')]=_0x2ca810[_0x6e70('0x10')];_0x142c27[_0x6e70('0xe')][_0x6e70('0x11')]=_0x2ca810[_0x6e70('0x12')];_0x142c27[_0x6e70('0xe')][_0x6e70('0x13')]=_0x2ca810[_0x6e70('0x14')];_0x142c27[_0x6e70('0xe')]['customfield_11503']=_0x2ca810['name'];_0x142c27[_0x6e70('0xe')][_0x6e70('0x15')]=_0x2ca810[_0x6e70('0x16')];_0x142c27[_0x6e70('0xe')][_0x6e70('0x17')]=_0x2ca810['ip'];var _0x310eb7={'host':_0x6e70('0x18'),'port':0x1bb,'path':_0x6e70('0x19'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x6e70('0x1a')]('base64')}};var _0x53aed0=JSON[_0x6e70('0xb')](_0x142c27);var _0x22c50c=https['request'](_0x310eb7,function(_0x24f3ac){_0x24f3ac['setEncoding'](_0x6e70('0x1b'));var _0x161f23='';_0x24f3ac['on']('data',function(_0x49029f){_0x161f23+=_0x49029f;});_0x24f3ac['on'](_0x6e70('0x1c'),function(){if(_0x7dfbc3){return _0x7dfbc3['status'](_0x24f3ac[_0x6e70('0x1d')])[_0x6e70('0x1e')](JSON['parse'](_0x161f23));}});});_0x22c50c['on']('error',function(_0xc238ba){if(_0x7dfbc3){return _0x7dfbc3[_0x6e70('0x1f')](0x1f4)[_0x6e70('0x1e')]({'errors':[{'message':_0x6e70('0x20'),'type':_0x6e70('0x21')}]});}});_0x22c50c[_0x6e70('0x22')](_0x53aed0);_0x22c50c[_0x6e70('0x1c')]();}exports[_0x6e70('0x23')]=openIssue;exports[_0x6e70('0x24')]=function(_0xb29a2a,_0x4a0cfe){_0xb29a2a[_0x6e70('0x25')]['ip']=_0xb29a2a[_0x6e70('0x26')][_0x6e70('0x27')]||_0xb29a2a['connection'][_0x6e70('0x28')]||_0xb29a2a[_0x6e70('0x29')][_0x6e70('0x28')]||_0xb29a2a['connection'][_0x6e70('0x29')]['remoteAddress'];return openIssue(_0xb29a2a['body'],_0x4a0cfe);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 387d618..f680059 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 _0xb605=['delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','isAuthenticated','index','/describe','get','/:id','show','post','put'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0xb605,0xe7));var _0x5b60=function(_0x35a140,_0x3aeac6){_0x35a140=_0x35a140-0x0;var _0x30ab82=_0xb605[_0x35a140];return _0x30ab82;};'use strict';var multer=require('multer');var util=require(_0x5b60('0x0'));var path=require(_0x5b60('0x1'));var timeout=require(_0x5b60('0x2'));var express=require(_0x5b60('0x3'));var router=express[_0x5b60('0x4')]();var auth=require(_0x5b60('0x5'));var interaction=require(_0x5b60('0x6'));var config=require('../../config/environment');var controller=require(_0x5b60('0x7'));router['get']('/',auth[_0x5b60('0x8')](),controller[_0x5b60('0x9')]);router['get'](_0x5b60('0xa'),auth[_0x5b60('0x8')](),controller['describe']);router[_0x5b60('0xb')](_0x5b60('0xc'),auth[_0x5b60('0x8')](),controller[_0x5b60('0xd')]);router[_0x5b60('0xe')]('/',auth[_0x5b60('0x8')](),controller['create']);router[_0x5b60('0xf')](_0x5b60('0xc'),auth[_0x5b60('0x8')](),controller['update']);router[_0x5b60('0x10')](_0x5b60('0xc'),auth[_0x5b60('0x8')](),controller[_0x5b60('0x11')]);module[_0x5b60('0x12')]=router; \ No newline at end of file +var _0x96b4=['destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete'];(function(_0x3b7a0c,_0xf1a4c2){var _0x3bb70f=function(_0x248b52){while(--_0x248b52){_0x3b7a0c['push'](_0x3b7a0c['shift']());}};_0x3bb70f(++_0xf1a4c2);}(_0x96b4,0xd3));var _0x496b=function(_0x21dcff,_0x3cdde0){_0x21dcff=_0x21dcff-0x0;var _0x48778f=_0x96b4[_0x21dcff];return _0x48778f;};'use strict';var multer=require('multer');var util=require(_0x496b('0x0'));var path=require(_0x496b('0x1'));var timeout=require(_0x496b('0x2'));var express=require('express');var router=express[_0x496b('0x3')]();var auth=require(_0x496b('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x496b('0x5'));router[_0x496b('0x6')]('/',auth[_0x496b('0x7')](),controller[_0x496b('0x8')]);router[_0x496b('0x6')](_0x496b('0x9'),auth[_0x496b('0x7')](),controller['describe']);router[_0x496b('0x6')](_0x496b('0xa'),auth[_0x496b('0x7')](),controller[_0x496b('0xb')]);router[_0x496b('0xc')]('/',auth[_0x496b('0x7')](),controller[_0x496b('0xd')]);router[_0x496b('0xe')]('/:id',auth[_0x496b('0x7')](),controller[_0x496b('0xf')]);router[_0x496b('0x10')](_0x496b('0xa'),auth['isAuthenticated'](),controller[_0x496b('0x11')]);module[_0x496b('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 9fac2bb..0dcc0be 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 _0x00b3=['TEXT','long','exports','STRING'];(function(_0x316e00,_0x409c7b){var _0x3cbda9=function(_0x307bd7){while(--_0x307bd7){_0x316e00['push'](_0x316e00['shift']());}};_0x3cbda9(++_0x409c7b);}(_0x00b3,0x17a));var _0x300b=function(_0x41bf9b,_0x5c9d21){_0x41bf9b=_0x41bf9b-0x0;var _0x295c57=_0x00b3[_0x41bf9b];return _0x295c57;};'use strict';var Sequelize=require('sequelize');module[_0x300b('0x0')]={'question':{'type':Sequelize[_0x300b('0x1')]},'answer':{'type':Sequelize[_0x300b('0x2')](_0x300b('0x3'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x300b('0x1')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x300b('0x1')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x300b('0x1')]},'questionId':{'type':Sequelize[_0x300b('0x1')]}}; \ No newline at end of file +var _0xbe45=['sequelize','exports','TEXT','long','STRING'];(function(_0x16e4b7,_0x3ede8c){var _0x56d7bd=function(_0x336b55){while(--_0x336b55){_0x16e4b7['push'](_0x16e4b7['shift']());}};_0x56d7bd(++_0x3ede8c);}(_0xbe45,0xf0));var _0x5be4=function(_0x70327a,_0x3ca3df){_0x70327a=_0x70327a-0x0;var _0x255206=_0xbe45[_0x70327a];return _0x255206;};'use strict';var Sequelize=require(_0x5be4('0x0'));module[_0x5be4('0x1')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0x5be4('0x2')](_0x5be4('0x3'))},'membername':{'type':Sequelize[_0x5be4('0x4')]},'projectname':{'type':Sequelize[_0x5be4('0x4')]},'queue':{'type':Sequelize[_0x5be4('0x4')]},'uniqueid':{'type':Sequelize[_0x5be4('0x4')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x5be4('0x4')]},'questionId':{'type':Sequelize[_0x5be4('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 3a4a4c6..e901c42 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 _0x348e=['rawAttributes','model','keys','query','dateStart','dateEnd','attributes','fields','length','hasOwnProperty','sort','where','pick','filters','add','day','merge','filter','options','includeAll','include','rows','catch','intersection','create','body','find','params','describe','html-pdf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','status','end','count','offset','limit','set','Content-Range','update','then','destroy','sendStatus','name','send','index','JscriptyAnswerReport'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x348e,0x9f));var _0xe348=function(_0x17ec37,_0x2c3cb8){_0x17ec37=_0x17ec37-0x0;var _0x13cc2b=_0x348e[_0x17ec37];return _0x13cc2b;};'use strict';var pdf=require(_0xe348('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe348('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe348('0x2'));var BPromise=require(_0xe348('0x3'));var Mustache=require('mustache');var util=require(_0xe348('0x4'));var path=require(_0xe348('0x5'));var sox=require(_0xe348('0x6'));var csv=require(_0xe348('0x7'));var ejs=require(_0xe348('0x8'));var fs=require('fs');var _=require(_0xe348('0x9'));var squel=require(_0xe348('0xa'));var crypto=require('crypto');var jsforce=require(_0xe348('0xb'));var deskjs=require(_0xe348('0xc'));var toCsv=require(_0xe348('0x7'));var querystring=require(_0xe348('0xd'));var Papa=require(_0xe348('0xe'));var Redis=require(_0xe348('0xf'));var qs=require(_0xe348('0x10'));var logger=require(_0xe348('0x11'))(_0xe348('0x12'));var utils=require(_0xe348('0x13'));var config=require(_0xe348('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x115583,_0x3210b6){_0x3210b6=_0x3210b6||0xcc;return function(_0x473b7f){if(_0x473b7f){return _0x115583['sendStatus'](_0x3210b6);}return _0x115583[_0xe348('0x15')](_0x3210b6)[_0xe348('0x16')]();};}function respondWithResult(_0x3ab751,_0xc646b7){_0xc646b7=_0xc646b7||0xc8;return function(_0x1afbed){if(_0x1afbed){return _0x3ab751[_0xe348('0x15')](_0xc646b7)['json'](_0x1afbed);}};}function respondWithFilteredResult(_0x2abc70,_0x1d605c){return function(_0xd5e9be){if(_0xd5e9be){var _0x6f25b6=_0xd5e9be[_0xe348('0x17')],_0x13abed=_0x1d605c[_0xe348('0x18')],_0x1a29e9=_0x1d605c[_0xe348('0x18')]+_0x1d605c[_0xe348('0x19')],_0x724966;if(_0x1a29e9>=_0x6f25b6){_0x1a29e9=_0x6f25b6;_0x724966=0xc8;}else{_0x724966=0xce;}_0x2abc70['status'](_0x724966);return _0x2abc70[_0xe348('0x1a')](_0xe348('0x1b'),_0x13abed+'-'+_0x1a29e9+'/'+_0x6f25b6)['json'](_0xd5e9be);}return null;};}function patchUpdates(_0x5c0d2a){return function(_0xf2015e){try{jsonpatch['apply'](_0xf2015e,_0x5c0d2a,!![]);}catch(_0xc2f644){return BPromise['reject'](_0xc2f644);}return _0xf2015e['save']();};}function saveUpdates(_0x44f27e,_0x5cf6a8){return function(_0x4c1a18){if(_0x4c1a18){return _0x4c1a18[_0xe348('0x1c')](_0x44f27e)[_0xe348('0x1d')](function(_0x391a62){return _0x391a62;});}return null;};}function removeEntity(_0x3f59f3,_0x5e823b){return function(_0x2b60f4){if(_0x2b60f4){return _0x2b60f4[_0xe348('0x1e')]()[_0xe348('0x1d')](function(){_0x3f59f3[_0xe348('0x15')](0xcc)[_0xe348('0x16')]();});}};}function handleEntityNotFound(_0x409d5a,_0x2ade03){return function(_0x5423fd){if(!_0x5423fd){_0x409d5a[_0xe348('0x1f')](0x194);}return _0x5423fd;};}function handleError(_0x3e53f3,_0x17c728){_0x17c728=_0x17c728||0x1f4;return function(_0x196b3c){logger['error'](_0x196b3c['stack']);if(_0x196b3c[_0xe348('0x20')]){delete _0x196b3c[_0xe348('0x20')];}_0x3e53f3[_0xe348('0x15')](_0x17c728)[_0xe348('0x21')](_0x196b3c);};}exports[_0xe348('0x22')]=function(_0x29a709,_0x31045e){var _0x40e4c0={},_0x24618e={},_0x540e74={'count':0x0,'rows':[]};var _0x3b2130=db[_0xe348('0x23')][_0xe348('0x24')];_0x24618e[_0xe348('0x25')]=_[_0xe348('0x26')](_0x3b2130);var _0x56f382={'dateStart':_0x29a709[_0xe348('0x27')][_0xe348('0x28')],'dateEnd':_0x29a709[_0xe348('0x27')][_0xe348('0x29')]};delete _0x29a709[_0xe348('0x27')][_0xe348('0x28')];delete _0x29a709[_0xe348('0x27')][_0xe348('0x29')];_0x24618e['query']=_[_0xe348('0x26')](_0x29a709[_0xe348('0x27')]);_0x24618e['filters']=_['intersection'](_0x24618e[_0xe348('0x25')],_0x24618e[_0xe348('0x27')]);_0x40e4c0[_0xe348('0x2a')]=_['intersection'](_0x24618e[_0xe348('0x25')],qs['fields'](_0x29a709[_0xe348('0x27')][_0xe348('0x2b')]));_0x40e4c0['attributes']=_0x40e4c0[_0xe348('0x2a')][_0xe348('0x2c')]?_0x40e4c0[_0xe348('0x2a')]:_0x24618e[_0xe348('0x25')];if(!_0x29a709[_0xe348('0x27')][_0xe348('0x2d')]('nolimit')){_0x40e4c0[_0xe348('0x19')]=qs[_0xe348('0x19')](_0x29a709[_0xe348('0x27')][_0xe348('0x19')]);_0x40e4c0[_0xe348('0x18')]=qs[_0xe348('0x18')](_0x29a709[_0xe348('0x27')][_0xe348('0x18')]);}_0x40e4c0['order']=qs[_0xe348('0x2e')](_0x29a709[_0xe348('0x27')][_0xe348('0x2e')]);_0x40e4c0[_0xe348('0x2f')]=qs['filters'](_[_0xe348('0x30')](_0x29a709['query'],_0x24618e[_0xe348('0x31')]));if(_0x56f382[_0xe348('0x28')]){if(_0x56f382['dateEnd']){_0x56f382[_0xe348('0x29')]=moment(_0x56f382[_0xe348('0x29')])[_0xe348('0x32')](0x1,_0xe348('0x33'));}else{_0x56f382[_0xe348('0x29')]=moment(_0x56f382[_0xe348('0x28')])[_0xe348('0x32')](0x1,'day');}_[_0xe348('0x34')](_0x40e4c0['where'],{'createdAt':{'$gte':_0x56f382[_0xe348('0x28')],'$lte':_0x56f382['dateEnd']}});}if(_0x29a709[_0xe348('0x27')][_0xe348('0x35')]){_0x40e4c0[_0xe348('0x2f')]=_[_0xe348('0x34')](_0x40e4c0['where'],{'$or':_['map'](_0x40e4c0['attributes'],function(_0x1949fd){var _0x403ecf={};_0x403ecf[_0x1949fd]={'$like':'%'+_0x29a709[_0xe348('0x27')][_0xe348('0x35')]+'%'};return _0x403ecf;})});}_0x40e4c0=_[_0xe348('0x34')]({},_0x40e4c0,_0x29a709[_0xe348('0x36')]);var _0x2c2b2e={'where':_0x40e4c0['where']};return db[_0xe348('0x23')]['count'](_0x2c2b2e)[_0xe348('0x1d')](function(_0x40f9ce){_0x540e74[_0xe348('0x17')]=_0x40f9ce;if(_0x29a709[_0xe348('0x27')][_0xe348('0x37')]){_0x40e4c0[_0xe348('0x38')]=[{'all':!![]}];}return db[_0xe348('0x23')]['findAll'](_0x40e4c0);})[_0xe348('0x1d')](function(_0x5e2f54){_0x540e74[_0xe348('0x39')]=_0x5e2f54;return _0x540e74;})['then'](respondWithFilteredResult(_0x31045e,_0x40e4c0))[_0xe348('0x3a')](handleError(_0x31045e,null));};exports['show']=function(_0x1b03c2,_0x22689c){var _0x318cad={'raw':!![],'where':{'id':_0x1b03c2['params']['id']}},_0x4b7d43={};_0x4b7d43[_0xe348('0x25')]=_[_0xe348('0x26')](db[_0xe348('0x23')]['rawAttributes']);_0x4b7d43[_0xe348('0x27')]=_['keys'](_0x1b03c2['query']);_0x4b7d43[_0xe348('0x31')]=_[_0xe348('0x3b')](_0x4b7d43[_0xe348('0x25')],_0x4b7d43[_0xe348('0x27')]);_0x318cad[_0xe348('0x2a')]=_[_0xe348('0x3b')](_0x4b7d43[_0xe348('0x25')],qs[_0xe348('0x2b')](_0x1b03c2[_0xe348('0x27')][_0xe348('0x2b')]));_0x318cad[_0xe348('0x2a')]=_0x318cad[_0xe348('0x2a')][_0xe348('0x2c')]?_0x318cad['attributes']:_0x4b7d43[_0xe348('0x25')];if(_0x1b03c2['query'][_0xe348('0x37')]){_0x318cad[_0xe348('0x38')]=[{'all':!![]}];}_0x318cad=_[_0xe348('0x34')]({},_0x318cad,_0x1b03c2['options']);return db['JscriptyAnswerReport']['find'](_0x318cad)['then'](handleEntityNotFound(_0x22689c,null))[_0xe348('0x1d')](respondWithResult(_0x22689c,null))[_0xe348('0x3a')](handleError(_0x22689c,null));};exports[_0xe348('0x3c')]=function(_0x4e35b0,_0x92d900){return db[_0xe348('0x23')]['create'](_0x4e35b0[_0xe348('0x3d')],{})['then'](respondWithResult(_0x92d900,0xc9))[_0xe348('0x3a')](handleError(_0x92d900,null));};exports['update']=function(_0x4a4e53,_0x13aa35){if(_0x4a4e53[_0xe348('0x3d')]['id']){delete _0x4a4e53[_0xe348('0x3d')]['id'];}return db['JscriptyAnswerReport'][_0xe348('0x3e')]({'where':{'id':_0x4a4e53[_0xe348('0x3f')]['id']}})[_0xe348('0x1d')](handleEntityNotFound(_0x13aa35,null))[_0xe348('0x1d')](saveUpdates(_0x4a4e53[_0xe348('0x3d')],null))['then'](respondWithResult(_0x13aa35,null))[_0xe348('0x3a')](handleError(_0x13aa35,null));};exports[_0xe348('0x1e')]=function(_0x101e07,_0x23bda2){return db[_0xe348('0x23')]['find']({'where':{'id':_0x101e07[_0xe348('0x3f')]['id']}})['then'](handleEntityNotFound(_0x23bda2,null))[_0xe348('0x1d')](removeEntity(_0x23bda2,null))['catch'](handleError(_0x23bda2,null));};exports[_0xe348('0x40')]=function(_0x17acef,_0x1ce352){return db[_0xe348('0x23')][_0xe348('0x40')]()['then'](respondWithResult(_0x1ce352,null))[_0xe348('0x3a')](handleError(_0x1ce352,null));}; \ No newline at end of file +var _0x8a42=['include','findAll','rows','catch','show','length','find','body','params','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','status','end','offset','set','Content-Range','json','apply','reject','save','then','sendStatus','name','send','index','JscriptyAnswerReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','add','day','merge','map','filter','options','count','includeAll'];(function(_0x1ef796,_0x279a91){var _0x363f09=function(_0x56f058){while(--_0x56f058){_0x1ef796['push'](_0x1ef796['shift']());}};_0x363f09(++_0x279a91);}(_0x8a42,0xe3));var _0x28a4=function(_0x5c0b13,_0x63fd29){_0x5c0b13=_0x5c0b13-0x0;var _0x1337fb=_0x8a42[_0x5c0b13];return _0x1337fb;};'use strict';var pdf=require(_0x28a4('0x0'));var emlformat=require(_0x28a4('0x1'));var rimraf=require(_0x28a4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x28a4('0x3'));var rp=require('request-promise');var moment=require(_0x28a4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x28a4('0x5'));var util=require(_0x28a4('0x6'));var path=require(_0x28a4('0x7'));var sox=require(_0x28a4('0x8'));var csv=require(_0x28a4('0x9'));var ejs=require(_0x28a4('0xa'));var fs=require('fs');var _=require(_0x28a4('0xb'));var squel=require(_0x28a4('0xc'));var crypto=require(_0x28a4('0xd'));var jsforce=require(_0x28a4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x28a4('0x9'));var querystring=require(_0x28a4('0xf'));var Papa=require(_0x28a4('0x10'));var Redis=require('ioredis');var qs=require(_0x28a4('0x11'));var logger=require(_0x28a4('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x28a4('0x13'));var db=require(_0x28a4('0x14'))['db'];function respondWithStatusCode(_0x5cdd92,_0x579f10){_0x579f10=_0x579f10||0xcc;return function(_0x3721f2){if(_0x3721f2){return _0x5cdd92['sendStatus'](_0x579f10);}return _0x5cdd92[_0x28a4('0x15')](_0x579f10)[_0x28a4('0x16')]();};}function respondWithResult(_0x3577fd,_0x3c700f){_0x3c700f=_0x3c700f||0xc8;return function(_0x23f634){if(_0x23f634){return _0x3577fd[_0x28a4('0x15')](_0x3c700f)['json'](_0x23f634);}};}function respondWithFilteredResult(_0x1944e8,_0x4cdc05){return function(_0x17f22b){if(_0x17f22b){var _0x84e126=_0x17f22b['count'],_0x17b8ca=_0x4cdc05['offset'],_0x1f0b1d=_0x4cdc05[_0x28a4('0x17')]+_0x4cdc05['limit'],_0x1a07b3;if(_0x1f0b1d>=_0x84e126){_0x1f0b1d=_0x84e126;_0x1a07b3=0xc8;}else{_0x1a07b3=0xce;}_0x1944e8[_0x28a4('0x15')](_0x1a07b3);return _0x1944e8[_0x28a4('0x18')](_0x28a4('0x19'),_0x17b8ca+'-'+_0x1f0b1d+'/'+_0x84e126)[_0x28a4('0x1a')](_0x17f22b);}return null;};}function patchUpdates(_0x1b65e7){return function(_0x1b0bc7){try{jsonpatch[_0x28a4('0x1b')](_0x1b0bc7,_0x1b65e7,!![]);}catch(_0x176914){return BPromise[_0x28a4('0x1c')](_0x176914);}return _0x1b0bc7[_0x28a4('0x1d')]();};}function saveUpdates(_0x658301,_0x3b371a){return function(_0x40c363){if(_0x40c363){return _0x40c363['update'](_0x658301)[_0x28a4('0x1e')](function(_0x21c073){return _0x21c073;});}return null;};}function removeEntity(_0x4c5732,_0x396983){return function(_0x79190){if(_0x79190){return _0x79190['destroy']()[_0x28a4('0x1e')](function(){_0x4c5732['status'](0xcc)[_0x28a4('0x16')]();});}};}function handleEntityNotFound(_0x2cc680,_0x135cc2){return function(_0x4c3985){if(!_0x4c3985){_0x2cc680[_0x28a4('0x1f')](0x194);}return _0x4c3985;};}function handleError(_0x456d99,_0x40ee1f){_0x40ee1f=_0x40ee1f||0x1f4;return function(_0x3ca3b9){logger['error'](_0x3ca3b9['stack']);if(_0x3ca3b9[_0x28a4('0x20')]){delete _0x3ca3b9[_0x28a4('0x20')];}_0x456d99[_0x28a4('0x15')](_0x40ee1f)[_0x28a4('0x21')](_0x3ca3b9);};}exports[_0x28a4('0x22')]=function(_0x55dfa6,_0x5b3868){var _0x33333a={},_0x4c60ae={},_0x1d5537={'count':0x0,'rows':[]};var _0x3caf91=db[_0x28a4('0x23')][_0x28a4('0x24')];_0x4c60ae[_0x28a4('0x25')]=_[_0x28a4('0x26')](_0x3caf91);var _0x8cf917={'dateStart':_0x55dfa6[_0x28a4('0x27')][_0x28a4('0x28')],'dateEnd':_0x55dfa6[_0x28a4('0x27')][_0x28a4('0x29')]};delete _0x55dfa6[_0x28a4('0x27')][_0x28a4('0x28')];delete _0x55dfa6[_0x28a4('0x27')][_0x28a4('0x29')];_0x4c60ae[_0x28a4('0x27')]=_[_0x28a4('0x26')](_0x55dfa6[_0x28a4('0x27')]);_0x4c60ae[_0x28a4('0x2a')]=_['intersection'](_0x4c60ae[_0x28a4('0x25')],_0x4c60ae['query']);_0x33333a['attributes']=_[_0x28a4('0x2b')](_0x4c60ae[_0x28a4('0x25')],qs[_0x28a4('0x2c')](_0x55dfa6[_0x28a4('0x27')][_0x28a4('0x2c')]));_0x33333a[_0x28a4('0x2d')]=_0x33333a['attributes']['length']?_0x33333a['attributes']:_0x4c60ae[_0x28a4('0x25')];if(!_0x55dfa6[_0x28a4('0x27')][_0x28a4('0x2e')](_0x28a4('0x2f'))){_0x33333a[_0x28a4('0x30')]=qs['limit'](_0x55dfa6['query'][_0x28a4('0x30')]);_0x33333a[_0x28a4('0x17')]=qs[_0x28a4('0x17')](_0x55dfa6[_0x28a4('0x27')][_0x28a4('0x17')]);}_0x33333a[_0x28a4('0x31')]=qs[_0x28a4('0x32')](_0x55dfa6[_0x28a4('0x27')][_0x28a4('0x32')]);_0x33333a[_0x28a4('0x33')]=qs['filters'](_[_0x28a4('0x34')](_0x55dfa6[_0x28a4('0x27')],_0x4c60ae[_0x28a4('0x2a')]));if(_0x8cf917['dateStart']){if(_0x8cf917[_0x28a4('0x29')]){_0x8cf917[_0x28a4('0x29')]=moment(_0x8cf917['dateEnd'])[_0x28a4('0x35')](0x1,_0x28a4('0x36'));}else{_0x8cf917[_0x28a4('0x29')]=moment(_0x8cf917[_0x28a4('0x28')])['add'](0x1,_0x28a4('0x36'));}_['merge'](_0x33333a[_0x28a4('0x33')],{'createdAt':{'$gte':_0x8cf917[_0x28a4('0x28')],'$lte':_0x8cf917['dateEnd']}});}if(_0x55dfa6['query']['filter']){_0x33333a[_0x28a4('0x33')]=_[_0x28a4('0x37')](_0x33333a[_0x28a4('0x33')],{'$or':_[_0x28a4('0x38')](_0x33333a[_0x28a4('0x2d')],function(_0x35fe1c){var _0x36f21c={};_0x36f21c[_0x35fe1c]={'$like':'%'+_0x55dfa6['query'][_0x28a4('0x39')]+'%'};return _0x36f21c;})});}_0x33333a=_[_0x28a4('0x37')]({},_0x33333a,_0x55dfa6[_0x28a4('0x3a')]);var _0x10ad72={'where':_0x33333a[_0x28a4('0x33')]};return db[_0x28a4('0x23')]['count'](_0x10ad72)[_0x28a4('0x1e')](function(_0x2750f8){_0x1d5537[_0x28a4('0x3b')]=_0x2750f8;if(_0x55dfa6[_0x28a4('0x27')][_0x28a4('0x3c')]){_0x33333a[_0x28a4('0x3d')]=[{'all':!![]}];}return db[_0x28a4('0x23')][_0x28a4('0x3e')](_0x33333a);})[_0x28a4('0x1e')](function(_0x1330c4){_0x1d5537[_0x28a4('0x3f')]=_0x1330c4;return _0x1d5537;})[_0x28a4('0x1e')](respondWithFilteredResult(_0x5b3868,_0x33333a))[_0x28a4('0x40')](handleError(_0x5b3868,null));};exports[_0x28a4('0x41')]=function(_0x383d0e,_0x2cdde6){var _0x3992fa={'raw':!![],'where':{'id':_0x383d0e['params']['id']}},_0x3231fd={};_0x3231fd[_0x28a4('0x25')]=_[_0x28a4('0x26')](db[_0x28a4('0x23')][_0x28a4('0x24')]);_0x3231fd[_0x28a4('0x27')]=_[_0x28a4('0x26')](_0x383d0e['query']);_0x3231fd[_0x28a4('0x2a')]=_['intersection'](_0x3231fd[_0x28a4('0x25')],_0x3231fd[_0x28a4('0x27')]);_0x3992fa[_0x28a4('0x2d')]=_[_0x28a4('0x2b')](_0x3231fd[_0x28a4('0x25')],qs[_0x28a4('0x2c')](_0x383d0e['query']['fields']));_0x3992fa[_0x28a4('0x2d')]=_0x3992fa[_0x28a4('0x2d')][_0x28a4('0x42')]?_0x3992fa[_0x28a4('0x2d')]:_0x3231fd[_0x28a4('0x25')];if(_0x383d0e['query'][_0x28a4('0x3c')]){_0x3992fa['include']=[{'all':!![]}];}_0x3992fa=_[_0x28a4('0x37')]({},_0x3992fa,_0x383d0e[_0x28a4('0x3a')]);return db['JscriptyAnswerReport'][_0x28a4('0x43')](_0x3992fa)['then'](handleEntityNotFound(_0x2cdde6,null))['then'](respondWithResult(_0x2cdde6,null))[_0x28a4('0x40')](handleError(_0x2cdde6,null));};exports['create']=function(_0x45e28e,_0x2f3ef8){return db['JscriptyAnswerReport']['create'](_0x45e28e[_0x28a4('0x44')],{})[_0x28a4('0x1e')](respondWithResult(_0x2f3ef8,0xc9))[_0x28a4('0x40')](handleError(_0x2f3ef8,null));};exports['update']=function(_0x44917d,_0x5a469b){if(_0x44917d[_0x28a4('0x44')]['id']){delete _0x44917d[_0x28a4('0x44')]['id'];}return db[_0x28a4('0x23')][_0x28a4('0x43')]({'where':{'id':_0x44917d[_0x28a4('0x45')]['id']}})[_0x28a4('0x1e')](handleEntityNotFound(_0x5a469b,null))[_0x28a4('0x1e')](saveUpdates(_0x44917d[_0x28a4('0x44')],null))[_0x28a4('0x1e')](respondWithResult(_0x5a469b,null))[_0x28a4('0x40')](handleError(_0x5a469b,null));};exports[_0x28a4('0x46')]=function(_0xffa023,_0x485463){return db[_0x28a4('0x23')][_0x28a4('0x43')]({'where':{'id':_0xffa023['params']['id']}})[_0x28a4('0x1e')](handleEntityNotFound(_0x485463,null))[_0x28a4('0x1e')](removeEntity(_0x485463,null))[_0x28a4('0x40')](handleError(_0x485463,null));};exports[_0x28a4('0x47')]=function(_0x11a6c0,_0x1c0c46){return db[_0x28a4('0x23')][_0x28a4('0x47')]()['then'](respondWithResult(_0x1c0c46,null))['catch'](handleError(_0x1c0c46,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index fd08c1d..7142e66 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 _0x7bbf=['api','moment','bluebird','./jscriptyAnswerReport.attributes','define','JscriptyAnswerReport','util','../../config/logger'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x7bbf,0x15e));var _0xf7bb=function(_0x23d815,_0x2e1075){_0x23d815=_0x23d815-0x0;var _0x5d8d62=_0x7bbf[_0x23d815];return _0x5d8d62;};'use strict';var _=require('lodash');var util=require(_0xf7bb('0x0'));var logger=require(_0xf7bb('0x1'))(_0xf7bb('0x2'));var moment=require(_0xf7bb('0x3'));var BPromise=require(_0xf7bb('0x4'));var rp=require('request-promise');var attributes=require(_0xf7bb('0x5'));module['exports']=function(_0x34377c,_0x202dad){return _0x34377c[_0xf7bb('0x6')](_0xf7bb('0x7'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ab5=['request-promise','./jscriptyAnswerReport.attributes','define','report_jscripty_answers','lodash','util','moment','bluebird'];(function(_0x4723ec,_0x5ac82d){var _0x22b51c=function(_0x4d944d){while(--_0x4d944d){_0x4723ec['push'](_0x4723ec['shift']());}};_0x22b51c(++_0x5ac82d);}(_0x6ab5,0x7c));var _0x56ab=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x6ab5[_0x3c8e9a];return _0x2d4c57;};'use strict';var _=require(_0x56ab('0x0'));var util=require(_0x56ab('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x56ab('0x2'));var BPromise=require(_0x56ab('0x3'));var rp=require(_0x56ab('0x4'));var attributes=require(_0x56ab('0x5'));module['exports']=function(_0x35a747,_0xef7e1){return _0x35a747[_0x56ab('0x6')]('JscriptyAnswerReport',attributes,{'tableName':_0x56ab('0x7'),'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 1455df5..6ebcd4d 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 _0x27d6=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x15ff8d,_0x4d9f74){var _0x59d817=function(_0x3d9e29){while(--_0x3d9e29){_0x15ff8d['push'](_0x15ff8d['shift']());}};_0x59d817(++_0x4d9f74);}(_0x27d6,0x11b));var _0x627d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x27d6[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x627d('0x0'));var util=require(_0x627d('0x1'));var moment=require(_0x627d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x627d('0x3'));var db=require(_0x627d('0x4'))['db'];var utils=require(_0x627d('0x5'));var logger=require(_0x627d('0x6'))(_0x627d('0x7'));var config=require(_0x627d('0x8'));var jayson=require(_0x627d('0x9'));var client=jayson[_0x627d('0xa')][_0x627d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x69bb15,_0x69f035,_0x1a366a){return new BPromise(function(_0x487d21,_0x917a5f){return client[_0x627d('0xc')](_0x69bb15,_0x1a366a)['then'](function(_0x3e818f){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x69f035,_0x627d('0xd'));logger['debug'](_0x627d('0xe'),_0x69f035,_0x627d('0xd'),JSON[_0x627d('0xf')](_0x3e818f));if(_0x3e818f['error']){if(_0x3e818f[_0x627d('0x10')][_0x627d('0x11')]===0x1f4){logger[_0x627d('0x10')](_0x627d('0x12'),_0x69f035,_0x3e818f['error'][_0x627d('0x13')]);return _0x917a5f(_0x3e818f[_0x627d('0x10')]['message']);}logger[_0x627d('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x69f035,_0x3e818f[_0x627d('0x10')]['message']);return _0x487d21(_0x3e818f['error'][_0x627d('0x13')]);}else{logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x69f035,'request\x20sent');_0x487d21(_0x3e818f[_0x627d('0x14')][_0x627d('0x13')]);}})[_0x627d('0x15')](function(_0x20bbe8){logger[_0x627d('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x69f035,_0x20bbe8);_0x917a5f(_0x20bbe8);});});} \ No newline at end of file +var _0xcb11=['jayson/promise','client','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment'];(function(_0x2241a4,_0x5b2548){var _0x1512c8=function(_0x1ee9a8){while(--_0x1ee9a8){_0x2241a4['push'](_0x2241a4['shift']());}};_0x1512c8(++_0x5b2548);}(_0xcb11,0x161));var _0x1cb1=function(_0x1ad394,_0x1beea7){_0x1ad394=_0x1ad394-0x0;var _0x7548c=_0xcb11[_0x1ad394];return _0x7548c;};'use strict';var _=require(_0x1cb1('0x0'));var util=require(_0x1cb1('0x1'));var moment=require(_0x1cb1('0x2'));var BPromise=require(_0x1cb1('0x3'));var rs=require(_0x1cb1('0x4'));var fs=require('fs');var Redis=require(_0x1cb1('0x5'));var db=require(_0x1cb1('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1cb1('0x7'));var jayson=require(_0x1cb1('0x8'));var client=jayson[_0x1cb1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10d386,_0x46f0d5,_0xf2f79b){return new BPromise(function(_0x49abe0,_0x42b7a5){return client['request'](_0x10d386,_0xf2f79b)[_0x1cb1('0xa')](function(_0x54a86f){logger[_0x1cb1('0xb')](_0x1cb1('0xc'),_0x46f0d5,'request\x20sent');logger[_0x1cb1('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x46f0d5,_0x1cb1('0xe'),JSON['stringify'](_0x54a86f));if(_0x54a86f[_0x1cb1('0xf')]){if(_0x54a86f[_0x1cb1('0xf')][_0x1cb1('0x10')]===0x1f4){logger[_0x1cb1('0xf')](_0x1cb1('0xc'),_0x46f0d5,_0x54a86f['error'][_0x1cb1('0x11')]);return _0x42b7a5(_0x54a86f['error'][_0x1cb1('0x11')]);}logger['error'](_0x1cb1('0xc'),_0x46f0d5,_0x54a86f[_0x1cb1('0xf')][_0x1cb1('0x11')]);return _0x49abe0(_0x54a86f[_0x1cb1('0xf')][_0x1cb1('0x11')]);}else{logger[_0x1cb1('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x46f0d5,_0x1cb1('0xe'));_0x49abe0(_0x54a86f['result']['message']);}})[_0x1cb1('0x12')](function(_0x1cef0b){logger[_0x1cb1('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x46f0d5,_0x1cef0b);_0x42b7a5(_0x1cef0b);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 263256e..e36d165 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 _0xfea4=['getAnswers','/:id/summary','30s','post','create','/:id/clone','clone','put','delete','destroy','util','connect-timeout','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index','/:id','isAuthenticated','show','/:id/sessions','getSessions','/:id/answers'];(function(_0xc0e172,_0x5378ee){var _0x19447e=function(_0x45e153){while(--_0x45e153){_0xc0e172['push'](_0xc0e172['shift']());}};_0x19447e(++_0x5378ee);}(_0xfea4,0x1a8));var _0x4fea=function(_0x4f83ca,_0x46f67a){_0x4f83ca=_0x4f83ca-0x0;var _0x1fbac3=_0xfea4[_0x4f83ca];return _0x1fbac3;};'use strict';var multer=require('multer');var util=require(_0x4fea('0x0'));var path=require('path');var timeout=require(_0x4fea('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4fea('0x2'));var config=require(_0x4fea('0x3'));var controller=require(_0x4fea('0x4'));router[_0x4fea('0x5')]('/',auth['isAuthenticated'](),controller[_0x4fea('0x6')]);router[_0x4fea('0x5')](_0x4fea('0x7'),auth[_0x4fea('0x8')](),controller[_0x4fea('0x9')]);router[_0x4fea('0x5')](_0x4fea('0xa'),auth[_0x4fea('0x8')](),controller[_0x4fea('0xb')]);router['get'](_0x4fea('0xc'),auth[_0x4fea('0x8')](),controller[_0x4fea('0xd')]);router[_0x4fea('0x5')](_0x4fea('0xe'),auth['isAuthenticated'](),timeout(_0x4fea('0xf')),controller['getSummary']);router[_0x4fea('0x10')]('/',auth[_0x4fea('0x8')](),controller[_0x4fea('0x11')]);router[_0x4fea('0x10')](_0x4fea('0x12'),auth[_0x4fea('0x8')](),controller[_0x4fea('0x13')]);router[_0x4fea('0x14')](_0x4fea('0x7'),auth[_0x4fea('0x8')](),controller['update']);router[_0x4fea('0x15')](_0x4fea('0x7'),auth[_0x4fea('0x8')](),controller[_0x4fea('0x16')]);module['exports']=router; \ No newline at end of file +var _0x132a=['express','Router','../../components/auth/service','../../config/environment','./jscriptyProject.controller','index','get','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','isAuthenticated','create','/:id/clone','clone','put','/:id','update','exports','util','path','connect-timeout'];(function(_0x11e000,_0x12a8e5){var _0x110c27=function(_0x10d468){while(--_0x10d468){_0x11e000['push'](_0x11e000['shift']());}};_0x110c27(++_0x12a8e5);}(_0x132a,0xe7));var _0xa132=function(_0x28190c,_0x434350){_0x28190c=_0x28190c-0x0;var _0x10bba9=_0x132a[_0x28190c];return _0x10bba9;};'use strict';var multer=require('multer');var util=require(_0xa132('0x0'));var path=require(_0xa132('0x1'));var timeout=require(_0xa132('0x2'));var express=require(_0xa132('0x3'));var router=express[_0xa132('0x4')]();var auth=require(_0xa132('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa132('0x6'));var controller=require(_0xa132('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xa132('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa132('0x9')](_0xa132('0xa'),auth['isAuthenticated'](),controller[_0xa132('0xb')]);router[_0xa132('0x9')](_0xa132('0xc'),auth['isAuthenticated'](),controller[_0xa132('0xd')]);router[_0xa132('0x9')](_0xa132('0xe'),auth['isAuthenticated'](),timeout(_0xa132('0xf')),controller[_0xa132('0x10')]);router[_0xa132('0x11')]('/',auth[_0xa132('0x12')](),controller[_0xa132('0x13')]);router[_0xa132('0x11')](_0xa132('0x14'),auth[_0xa132('0x12')](),controller[_0xa132('0x15')]);router[_0xa132('0x16')](_0xa132('0x17'),auth[_0xa132('0x12')](),controller[_0xa132('0x18')]);router['delete'](_0xa132('0x17'),auth[_0xa132('0x12')](),controller['destroy']);module[_0xa132('0x19')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index c7bd352..0105aae 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 _0x15b6=['getDataValue','description','BOOLEAN','util','name','STRING','TEXT','long','isObjectLike','stringify','isString','setDataValue','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0x15b6,0x1a7));var _0x615b=function(_0x43e885,_0x25c816){_0x43e885=_0x43e885-0x0;var _0xc86170=_0x15b6[_0x43e885];return _0xc86170;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');var util=require(_0x615b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x615b('0x1')},'description':{'type':Sequelize[_0x615b('0x2')]},'formData':{'type':Sequelize[_0x615b('0x3')](_0x615b('0x4')),'set':function(_0x1f1516){if(_[_0x615b('0x5')](_0x1f1516)){this['setDataValue']('formData',JSON[_0x615b('0x6')](_0x1f1516));}else if(_[_0x615b('0x7')](_0x1f1516)){this[_0x615b('0x8')]('formData',_0x1f1516);}else{this['setDataValue'](_0x615b('0x9'),util[_0x615b('0xa')](_0x615b('0xb'),this[_0x615b('0xc')](_0x615b('0x1'))||'',this[_0x615b('0xc')](_0x615b('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x615b('0xe')],'defaultValue':!![]}}; \ No newline at end of file +var _0x94bd=['format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','description','BOOLEAN','sequelize','lodash','STRING','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString'];(function(_0x5748d2,_0x59cc41){var _0x3baab4=function(_0x4110d7){while(--_0x4110d7){_0x5748d2['push'](_0x5748d2['shift']());}};_0x3baab4(++_0x59cc41);}(_0x94bd,0x126));var _0xd94b=function(_0x592ed1,_0x5811d8){_0x592ed1=_0x592ed1-0x0;var _0x10c042=_0x94bd[_0x592ed1];return _0x10c042;};'use strict';var Sequelize=require(_0xd94b('0x0'));var _=require(_0xd94b('0x1'));var util=require('util');module['exports']={'name':{'type':Sequelize[_0xd94b('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xd94b('0x2')]},'formData':{'type':Sequelize[_0xd94b('0x3')](_0xd94b('0x4')),'set':function(_0x5248eb){if(_[_0xd94b('0x5')](_0x5248eb)){this[_0xd94b('0x6')](_0xd94b('0x7'),JSON[_0xd94b('0x8')](_0x5248eb));}else if(_[_0xd94b('0x9')](_0x5248eb)){this[_0xd94b('0x6')]('formData',_0x5248eb);}else{this['setDataValue'](_0xd94b('0x7'),util[_0xd94b('0xa')](_0xd94b('0xb'),this[_0xd94b('0xc')](_0xd94b('0xd'))||'',this[_0xd94b('0xc')](_0xd94b('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xd94b('0xf')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index c5e0e0e..b63e15d 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 _0xaba0=['save','then','stack','send','JscriptyProject','rawAttributes','model','keys','query','dateStart','dateEnd','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','day','merge','filter','map','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','clone','get','omit','createdAt','updatedAt','update','params','destroy','getSessions','JscriptySessionReport','nolimit','ProjectId','JscriptyAnswerReport','add','fromCharCode','toString','indexOf','replace','getSummary','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','html-pdf','rimraf','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/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','limit','set','Content-Range','json','apply'];(function(_0x457c3a,_0x176f89){var _0x466211=function(_0x42539e){while(--_0x42539e){_0x457c3a['push'](_0x457c3a['shift']());}};_0x466211(++_0x176f89);}(_0xaba0,0x11f));var _0x0aba=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xaba0[_0xbca1b1];return _0x4e1686;};'use strict';var pdf=require(_0x0aba('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0aba('0x1'));var zipdir=require(_0x0aba('0x2'));var jsonpatch=require(_0x0aba('0x3'));var rp=require(_0x0aba('0x4'));var moment=require(_0x0aba('0x5'));var BPromise=require(_0x0aba('0x6'));var Mustache=require(_0x0aba('0x7'));var util=require(_0x0aba('0x8'));var path=require(_0x0aba('0x9'));var sox=require(_0x0aba('0xa'));var csv=require(_0x0aba('0xb'));var ejs=require(_0x0aba('0xc'));var fs=require('fs');var _=require(_0x0aba('0xd'));var squel=require(_0x0aba('0xe'));var crypto=require('crypto');var jsforce=require(_0x0aba('0xf'));var deskjs=require(_0x0aba('0x10'));var toCsv=require('to-csv');var querystring=require(_0x0aba('0x11'));var Papa=require(_0x0aba('0x12'));var Redis=require(_0x0aba('0x13'));var qs=require(_0x0aba('0x14'));var logger=require(_0x0aba('0x15'))(_0x0aba('0x16'));var utils=require(_0x0aba('0x17'));var config=require(_0x0aba('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e3bd6,_0x3fcf26){_0x3fcf26=_0x3fcf26||0xcc;return function(_0x3a2f39){if(_0x3a2f39){return _0x2e3bd6[_0x0aba('0x19')](_0x3fcf26);}return _0x2e3bd6[_0x0aba('0x1a')](_0x3fcf26)[_0x0aba('0x1b')]();};}function respondWithResult(_0x110541,_0xb60e97){_0xb60e97=_0xb60e97||0xc8;return function(_0x57f84e){if(_0x57f84e){return _0x110541[_0x0aba('0x1a')](_0xb60e97)['json'](_0x57f84e);}};}function respondWithFilteredResult(_0x3b293d,_0x4ec829){return function(_0x57c0fd){if(_0x57c0fd){var _0x457495=_0x57c0fd['count'],_0x2da377=_0x4ec829[_0x0aba('0x1c')],_0x35ff45=_0x4ec829[_0x0aba('0x1c')]+_0x4ec829[_0x0aba('0x1d')],_0x4376ed;if(_0x35ff45>=_0x457495){_0x35ff45=_0x457495;_0x4376ed=0xc8;}else{_0x4376ed=0xce;}_0x3b293d[_0x0aba('0x1a')](_0x4376ed);return _0x3b293d[_0x0aba('0x1e')](_0x0aba('0x1f'),_0x2da377+'-'+_0x35ff45+'/'+_0x457495)[_0x0aba('0x20')](_0x57c0fd);}return null;};}function patchUpdates(_0x2d46e0){return function(_0x248ae0){try{jsonpatch[_0x0aba('0x21')](_0x248ae0,_0x2d46e0,!![]);}catch(_0x5997d2){return BPromise['reject'](_0x5997d2);}return _0x248ae0[_0x0aba('0x22')]();};}function saveUpdates(_0x591312,_0xbf7228){return function(_0xd32c49){if(_0xd32c49){return _0xd32c49['update'](_0x591312)['then'](function(_0x22d704){return _0x22d704;});}return null;};}function removeEntity(_0x59b74c,_0x4666dd){return function(_0x12fb96){if(_0x12fb96){return _0x12fb96['destroy']()[_0x0aba('0x23')](function(){_0x59b74c[_0x0aba('0x1a')](0xcc)[_0x0aba('0x1b')]();});}};}function handleEntityNotFound(_0x275367,_0x1c6b60){return function(_0x81a3d2){if(!_0x81a3d2){_0x275367[_0x0aba('0x19')](0x194);}return _0x81a3d2;};}function handleError(_0x24cdc3,_0x13aa4d){_0x13aa4d=_0x13aa4d||0x1f4;return function(_0x4e0dd6){logger['error'](_0x4e0dd6[_0x0aba('0x24')]);if(_0x4e0dd6['name']){delete _0x4e0dd6['name'];}_0x24cdc3['status'](_0x13aa4d)[_0x0aba('0x25')](_0x4e0dd6);};}exports['index']=function(_0x86a22c,_0x6a43dd){var _0x97627f={},_0x30f56b={},_0x25cb5e={'count':0x0,'rows':[]};var _0x16cbb4=db[_0x0aba('0x26')][_0x0aba('0x27')];_0x30f56b[_0x0aba('0x28')]=_[_0x0aba('0x29')](_0x16cbb4);var _0x58675d={'dateStart':_0x86a22c[_0x0aba('0x2a')][_0x0aba('0x2b')],'dateEnd':_0x86a22c[_0x0aba('0x2a')][_0x0aba('0x2c')]};delete _0x86a22c['query']['dateStart'];delete _0x86a22c[_0x0aba('0x2a')][_0x0aba('0x2c')];_0x30f56b[_0x0aba('0x2a')]=_[_0x0aba('0x29')](_0x86a22c['query']);_0x30f56b['filters']=_['intersection'](_0x30f56b[_0x0aba('0x28')],_0x30f56b['query']);_0x97627f[_0x0aba('0x2d')]=_[_0x0aba('0x2e')](_0x30f56b['model'],qs[_0x0aba('0x2f')](_0x86a22c[_0x0aba('0x2a')]['fields']));_0x97627f['attributes']=_0x97627f[_0x0aba('0x2d')][_0x0aba('0x30')]?_0x97627f[_0x0aba('0x2d')]:_0x30f56b[_0x0aba('0x28')];if(!_0x86a22c['query'][_0x0aba('0x31')]('nolimit')){_0x97627f[_0x0aba('0x1d')]=qs['limit'](_0x86a22c[_0x0aba('0x2a')][_0x0aba('0x1d')]);_0x97627f['offset']=qs[_0x0aba('0x1c')](_0x86a22c[_0x0aba('0x2a')][_0x0aba('0x1c')]);}_0x97627f[_0x0aba('0x32')]=qs[_0x0aba('0x33')](_0x86a22c[_0x0aba('0x2a')]['sort']);_0x97627f[_0x0aba('0x34')]=qs[_0x0aba('0x35')](_[_0x0aba('0x36')](_0x86a22c[_0x0aba('0x2a')],_0x30f56b['filters']));if(_0x58675d[_0x0aba('0x2b')]){if(_0x58675d[_0x0aba('0x2c')]){_0x58675d[_0x0aba('0x2c')]=moment(_0x58675d[_0x0aba('0x2c')])['add'](0x1,'day');}else{_0x58675d[_0x0aba('0x2c')]=moment(_0x58675d[_0x0aba('0x2b')])['add'](0x1,_0x0aba('0x37'));}_[_0x0aba('0x38')](_0x97627f['where'],{'createdAt':{'$gte':_0x58675d[_0x0aba('0x2b')],'$lte':_0x58675d[_0x0aba('0x2c')]}});}if(_0x86a22c[_0x0aba('0x2a')][_0x0aba('0x39')]){_0x97627f['where']=_[_0x0aba('0x38')](_0x97627f[_0x0aba('0x34')],{'$or':_[_0x0aba('0x3a')](_0x97627f[_0x0aba('0x2d')],function(_0x5e808b){var _0x28dc4b={};_0x28dc4b[_0x5e808b]={'$like':'%'+_0x86a22c[_0x0aba('0x2a')]['filter']+'%'};return _0x28dc4b;})});}_0x97627f=_[_0x0aba('0x38')]({},_0x97627f,_0x86a22c[_0x0aba('0x3b')]);var _0x1f386a={'where':_0x97627f[_0x0aba('0x34')]};return db['JscriptyProject'][_0x0aba('0x3c')](_0x1f386a)[_0x0aba('0x23')](function(_0x474b70){_0x25cb5e[_0x0aba('0x3c')]=_0x474b70;if(_0x86a22c[_0x0aba('0x2a')][_0x0aba('0x3d')]){_0x97627f[_0x0aba('0x3e')]=[{'all':!![]}];}return db[_0x0aba('0x26')][_0x0aba('0x3f')](_0x97627f);})[_0x0aba('0x23')](function(_0x14f157){_0x25cb5e[_0x0aba('0x40')]=_0x14f157;return _0x25cb5e;})[_0x0aba('0x23')](respondWithFilteredResult(_0x6a43dd,_0x97627f))[_0x0aba('0x41')](handleError(_0x6a43dd,null));};exports[_0x0aba('0x42')]=function(_0x380f76,_0xef7b73){var _0x2a7b55={'raw':![],'where':{'id':_0x380f76['params']['id']}},_0x2cd5a2={};_0x2cd5a2['model']=_[_0x0aba('0x29')](db[_0x0aba('0x26')][_0x0aba('0x27')]);_0x2cd5a2[_0x0aba('0x2a')]=_[_0x0aba('0x29')](_0x380f76['query']);_0x2cd5a2[_0x0aba('0x35')]=_['intersection'](_0x2cd5a2[_0x0aba('0x28')],_0x2cd5a2[_0x0aba('0x2a')]);_0x2a7b55[_0x0aba('0x2d')]=_['intersection'](_0x2cd5a2[_0x0aba('0x28')],qs[_0x0aba('0x2f')](_0x380f76['query'][_0x0aba('0x2f')]));_0x2a7b55['attributes']=_0x2a7b55[_0x0aba('0x2d')][_0x0aba('0x30')]?_0x2a7b55[_0x0aba('0x2d')]:_0x2cd5a2[_0x0aba('0x28')];if(_0x380f76['query']['includeAll']){_0x2a7b55['include']=[{'all':!![]}];}_0x2a7b55=_[_0x0aba('0x38')]({},_0x2a7b55,_0x380f76[_0x0aba('0x3b')]);return db[_0x0aba('0x26')][_0x0aba('0x43')](_0x2a7b55)[_0x0aba('0x23')](handleEntityNotFound(_0xef7b73,null))['then'](respondWithResult(_0xef7b73,null))[_0x0aba('0x41')](handleError(_0xef7b73,null));};exports[_0x0aba('0x44')]=function(_0x35776a,_0x5c5d4a){return db['JscriptyProject']['create'](_0x35776a[_0x0aba('0x45')],{})[_0x0aba('0x23')](respondWithResult(_0x5c5d4a,0xc9))[_0x0aba('0x41')](handleError(_0x5c5d4a,null));};exports[_0x0aba('0x46')]=function(_0x5380c4,_0x33bf1e){var _0x341b1a={'raw':![],'where':{'id':_0x5380c4['params']['id']}},_0x4b8a56={};_0x4b8a56[_0x0aba('0x28')]=_[_0x0aba('0x29')](db[_0x0aba('0x26')][_0x0aba('0x27')]);_0x341b1a[_0x0aba('0x2d')]=_[_0x0aba('0x2e')](_0x4b8a56[_0x0aba('0x28')],qs[_0x0aba('0x2f')](_0x5380c4['query'][_0x0aba('0x2f')]));_0x341b1a['attributes']=_0x341b1a['attributes'][_0x0aba('0x30')]?_0x341b1a[_0x0aba('0x2d')]:_0x4b8a56['model'];if(_0x5380c4[_0x0aba('0x2a')][_0x0aba('0x3d')]){_0x341b1a[_0x0aba('0x3e')]=[{'all':!![]}];}_0x341b1a=_[_0x0aba('0x38')]({},_0x341b1a,_0x5380c4[_0x0aba('0x3b')]);return db['JscriptyProject'][_0x0aba('0x43')](_0x341b1a)[_0x0aba('0x23')](handleEntityNotFound(_0x33bf1e,null))[_0x0aba('0x23')](function(_0x3881a2){if(_0x3881a2){var _0x5da4bd=_0x3881a2[_0x0aba('0x47')]({'plain':!![]});_0x5da4bd=qs[_0x0aba('0x48')](_0x5da4bd,['id',_0x0aba('0x49'),_0x0aba('0x4a')]);_0x5380c4[_0x0aba('0x45')]=_['omit'](_0x5380c4[_0x0aba('0x45')],['id',_0x0aba('0x49'),_0x0aba('0x4a')]);return db[_0x0aba('0x26')][_0x0aba('0x44')](_[_0x0aba('0x38')](_0x5da4bd,_0x5380c4['body']),{'include':_0x5380c4[_0x0aba('0x2a')][_0x0aba('0x3d')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x33bf1e,0xc9))[_0x0aba('0x41')](handleError(_0x33bf1e,null));};exports[_0x0aba('0x4b')]=function(_0x5d0da1,_0x10fe80){if(_0x5d0da1[_0x0aba('0x45')]['id']){delete _0x5d0da1['body']['id'];}return db['JscriptyProject']['find']({'where':{'id':_0x5d0da1[_0x0aba('0x4c')]['id']}})[_0x0aba('0x23')](handleEntityNotFound(_0x10fe80,null))['then'](saveUpdates(_0x5d0da1[_0x0aba('0x45')],null))['then'](respondWithResult(_0x10fe80,null))[_0x0aba('0x41')](handleError(_0x10fe80,null));};exports[_0x0aba('0x4d')]=function(_0x283550,_0x257212){return db[_0x0aba('0x26')]['find']({'where':{'id':_0x283550['params']['id']}})[_0x0aba('0x23')](handleEntityNotFound(_0x257212,null))[_0x0aba('0x23')](removeEntity(_0x257212,null))['catch'](handleError(_0x257212,null));};exports[_0x0aba('0x4e')]=function(_0x4ae027,_0x38221e,_0x20271a){var _0x2a9244={'raw':!![],'where':{}};var _0x3d38b4={};var _0x5817ea={'count':0x0,'rows':[]};return db[_0x0aba('0x26')]['findOne']({'where':{'id':_0x4ae027['params']['id']}})[_0x0aba('0x23')](handleEntityNotFound(_0x38221e,null))[_0x0aba('0x23')](function(_0x465a70){if(_0x465a70){_0x3d38b4[_0x0aba('0x28')]=_[_0x0aba('0x29')](db[_0x0aba('0x4f')][_0x0aba('0x27')]);_0x3d38b4['query']=_[_0x0aba('0x29')](_0x4ae027[_0x0aba('0x2a')]);_0x3d38b4['filters']=_[_0x0aba('0x2e')](_0x3d38b4['model'],_0x3d38b4[_0x0aba('0x2a')]);_0x2a9244[_0x0aba('0x2d')]=_[_0x0aba('0x2e')](_0x3d38b4[_0x0aba('0x28')],qs[_0x0aba('0x2f')](_0x4ae027[_0x0aba('0x2a')][_0x0aba('0x2f')]));_0x2a9244[_0x0aba('0x2d')]=_0x2a9244[_0x0aba('0x2d')][_0x0aba('0x30')]?_0x2a9244[_0x0aba('0x2d')]:_0x3d38b4[_0x0aba('0x28')];if(!_0x4ae027[_0x0aba('0x2a')][_0x0aba('0x31')](_0x0aba('0x50'))){_0x2a9244[_0x0aba('0x1d')]=qs[_0x0aba('0x1d')](_0x4ae027[_0x0aba('0x2a')]['limit']);_0x2a9244[_0x0aba('0x1c')]=qs['offset'](_0x4ae027['query'][_0x0aba('0x1c')]);}_0x2a9244[_0x0aba('0x32')]=qs[_0x0aba('0x33')](_0x4ae027[_0x0aba('0x2a')][_0x0aba('0x33')]);_0x2a9244[_0x0aba('0x34')]=qs[_0x0aba('0x35')](_[_0x0aba('0x36')](_0x4ae027[_0x0aba('0x2a')],_0x3d38b4['filters']));_0x2a9244[_0x0aba('0x34')][_0x0aba('0x51')]=_0x465a70['id'];if(_0x4ae027[_0x0aba('0x2a')][_0x0aba('0x39')]){_0x2a9244[_0x0aba('0x34')]=_[_0x0aba('0x38')](_0x2a9244[_0x0aba('0x34')],{'$or':_['map'](_0x2a9244[_0x0aba('0x2d')],function(_0x55a660){var _0x2f89ef={};_0x2f89ef[_0x55a660]={'$like':'%'+_0x4ae027[_0x0aba('0x2a')][_0x0aba('0x39')]+'%'};return _0x2f89ef;})});}_0x2a9244=_[_0x0aba('0x38')]({},_0x2a9244,_0x4ae027[_0x0aba('0x3b')]);return db['JscriptySessionReport'][_0x0aba('0x3c')]({'where':_0x2a9244[_0x0aba('0x34')]})[_0x0aba('0x23')](function(_0x5dd344){_0x5817ea[_0x0aba('0x3c')]=_0x5dd344;if(_0x4ae027['query'][_0x0aba('0x3d')]){_0x2a9244[_0x0aba('0x3e')]=[{'all':!![]}];}return db[_0x0aba('0x4f')][_0x0aba('0x3f')](_0x2a9244);})['then'](function(_0x32f0fb){_0x5817ea[_0x0aba('0x40')]=_0x32f0fb;return _0x5817ea;});}})[_0x0aba('0x23')](respondWithFilteredResult(_0x38221e,_0x2a9244))[_0x0aba('0x41')](handleError(_0x38221e,null));};exports['getAnswers']=function(_0x6555aa,_0x244c3a,_0x1f20e0){var _0x3ecfe6={'raw':!![],'where':{}};var _0x2ad9ff={};var _0x3c1ff8={'count':0x0,'rows':[]};var _0x24946f={'dateStart':_0x6555aa[_0x0aba('0x2a')][_0x0aba('0x2b')],'dateEnd':_0x6555aa['query'][_0x0aba('0x2c')]};delete _0x6555aa['query'][_0x0aba('0x2b')];delete _0x6555aa['query'][_0x0aba('0x2c')];return db[_0x0aba('0x26')]['findOne']({'where':{'id':_0x6555aa[_0x0aba('0x4c')]['id']}})[_0x0aba('0x23')](handleEntityNotFound(_0x244c3a,null))[_0x0aba('0x23')](function(_0x49ae42){if(_0x49ae42){_0x2ad9ff[_0x0aba('0x28')]=_['keys'](db[_0x0aba('0x52')][_0x0aba('0x27')]);_0x2ad9ff['query']=_['keys'](_0x6555aa['query']);_0x2ad9ff['filters']=_[_0x0aba('0x2e')](_0x2ad9ff[_0x0aba('0x28')],_0x2ad9ff[_0x0aba('0x2a')]);_0x3ecfe6[_0x0aba('0x2d')]=_[_0x0aba('0x2e')](_0x2ad9ff['model'],qs['fields'](_0x6555aa[_0x0aba('0x2a')][_0x0aba('0x2f')]));_0x3ecfe6[_0x0aba('0x2d')]=_0x3ecfe6['attributes'][_0x0aba('0x30')]?_0x3ecfe6[_0x0aba('0x2d')]:_0x2ad9ff[_0x0aba('0x28')];if(!_0x6555aa[_0x0aba('0x2a')][_0x0aba('0x31')](_0x0aba('0x50'))){_0x3ecfe6['limit']=qs[_0x0aba('0x1d')](_0x6555aa[_0x0aba('0x2a')]['limit']);_0x3ecfe6['offset']=qs['offset'](_0x6555aa['query'][_0x0aba('0x1c')]);}_0x3ecfe6['order']=qs[_0x0aba('0x33')](_0x6555aa['query'][_0x0aba('0x33')]);_0x3ecfe6['where']=qs[_0x0aba('0x35')](_['pick'](_0x6555aa[_0x0aba('0x2a')],_0x2ad9ff[_0x0aba('0x35')]));_0x3ecfe6[_0x0aba('0x34')][_0x0aba('0x51')]=_0x49ae42['id'];if(_0x24946f[_0x0aba('0x2b')]){if(_0x24946f[_0x0aba('0x2c')]){_0x24946f[_0x0aba('0x2c')]=moment(_0x24946f[_0x0aba('0x2c')])[_0x0aba('0x53')](0x1,_0x0aba('0x37'));}else{_0x24946f[_0x0aba('0x2c')]=moment(_0x24946f[_0x0aba('0x2b')])[_0x0aba('0x53')](0x1,_0x0aba('0x37'));}_['merge'](_0x3ecfe6[_0x0aba('0x34')],{'createdAt':{'$gte':_0x24946f[_0x0aba('0x2b')],'$lte':_0x24946f[_0x0aba('0x2c')]}});}if(_0x6555aa[_0x0aba('0x2a')][_0x0aba('0x39')]){_0x3ecfe6[_0x0aba('0x34')]=_[_0x0aba('0x38')](_0x3ecfe6[_0x0aba('0x34')],{'$or':_[_0x0aba('0x3a')](_0x3ecfe6[_0x0aba('0x2d')],function(_0xc39bac){var _0x3eb316={};_0x3eb316[_0xc39bac]={'$like':'%'+_0x6555aa['query'][_0x0aba('0x39')]+'%'};return _0x3eb316;})});}_0x3ecfe6=_[_0x0aba('0x38')]({},_0x3ecfe6,_0x6555aa[_0x0aba('0x3b')]);return db[_0x0aba('0x52')]['count']({'where':_0x3ecfe6[_0x0aba('0x34')]})[_0x0aba('0x23')](function(_0x48305e){_0x3c1ff8[_0x0aba('0x3c')]=_0x48305e;if(_0x6555aa[_0x0aba('0x2a')]['includeAll']){_0x3ecfe6[_0x0aba('0x3e')]=[{'all':!![]}];}return db[_0x0aba('0x52')][_0x0aba('0x3f')](_0x3ecfe6);})['then'](function(_0x312f73){_0x3c1ff8['rows']=_0x312f73;return _0x3c1ff8;});}})['then'](respondWithFilteredResult(_0x244c3a,_0x3ecfe6))[_0x0aba('0x41')](handleError(_0x244c3a,null));};function char(_0xde46d9){return'number'===typeof _0xde46d9?String[_0x0aba('0x54')][_0x0aba('0x21')](null,arguments):_0xde46d9;}function needsEncapsulation(_0x553934){return!!_0x553934&&(_0x553934[_0x0aba('0x55')]()[_0x0aba('0x56')](char(0xd))>=0x0||_0x553934['toString']()[_0x0aba('0x56')](char(0xa))>=0x0||_0x553934[_0x0aba('0x55')]()['indexOf'](char(0x2c))>=0x0||_0x553934[_0x0aba('0x55')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x2c0fd2){var _0x53c212=char(0x22),_0x176dcc='\x5c'+char(0x22),_0x1a2998=_0x2c0fd2[_0x0aba('0x55')]()[_0x0aba('0x57')](new RegExp(_0x53c212,'g'),_0x176dcc);return _0x53c212+_0x1a2998+_0x53c212;}exports[_0x0aba('0x58')]=function(_0x37af18,_0x1bc471,_0x160f2e){var _0x195336,_0x178e8e;var _0x4d296f={'dateStart':_0x37af18[_0x0aba('0x2a')][_0x0aba('0x2b')],'dateEnd':_0x37af18[_0x0aba('0x2a')][_0x0aba('0x2c')]};delete _0x37af18[_0x0aba('0x2a')]['dateStart'];delete _0x37af18['query'][_0x0aba('0x2c')];if(_0x4d296f['dateStart']){if(_0x4d296f['dateEnd']){_0x4d296f['dateEnd']=moment(_0x4d296f[_0x0aba('0x2c')])[_0x0aba('0x53')](0x1,_0x0aba('0x37'));}else{_0x4d296f[_0x0aba('0x2c')]=moment(_0x4d296f[_0x0aba('0x2b')])['add'](0x1,_0x0aba('0x37'));}}return db[_0x0aba('0x4f')][_0x0aba('0x3f')]({'where':{'ProjectId':_0x37af18[_0x0aba('0x4c')]['id'],'starttime':{'$gte':_0x4d296f[_0x0aba('0x2b')],'$lte':_0x4d296f[_0x0aba('0x2c')]}}})[_0x0aba('0x23')](handleEntityNotFound(_0x1bc471,null))['then'](function(_0x4d3c3e){if(_0x4d3c3e){_0x195336=_0x4d3c3e;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0x0aba('0x3a')](_0x195336,'id')},'ProjectId':_0x37af18[_0x0aba('0x4c')]['id']},'order':_0x0aba('0x59')});}})[_0x0aba('0x23')](handleEntityNotFound(_0x1bc471,null))[_0x0aba('0x23')](function(_0x7f9de3){if(_0x7f9de3){_0x178e8e=_0x7f9de3;var _0x469b53={};for(var _0x5a4424=0x0,_0x3ac4cb=_0x178e8e[_0x0aba('0x30')];_0x5a4424<_0x3ac4cb;_0x5a4424++){if(!_0x469b53['hasOwnProperty'](_0x178e8e[_0x5a4424][_0x0aba('0x5a')])){_0x469b53[_0x178e8e[_0x5a4424][_0x0aba('0x5a')]]=needsEncapsulation(_0x178e8e[_0x5a4424][_0x0aba('0x5b')])?encapsulate(_0x178e8e[_0x5a4424]['question']):_0x178e8e[_0x5a4424][_0x0aba('0x5b')];}}var _0x424daa=[],_0x182b3e={};for(var _0x5ce221=0x0,_0x4714a2=_0x195336[_0x0aba('0x30')];_0x5ce221<_0x4714a2;_0x5ce221++){_0x182b3e={'ProjectId':_0x37af18[_0x0aba('0x4c')]['id'],'SessionId':_0x195336[_0x5ce221]['id'],'StartTime':moment(_0x195336[_0x5ce221][_0x0aba('0x5c')])[_0x0aba('0x5d')](_0x0aba('0x5e'))};for(var _0x87f8f5=0x0,_0x578f43=_0x178e8e[_0x0aba('0x30')];_0x87f8f5<_0x578f43;_0x87f8f5++){if(_0x178e8e[_0x87f8f5][_0x0aba('0x5f')]==_0x195336[_0x5ce221]['id']&&_0x469b53[_0x0aba('0x31')](_0x178e8e[_0x87f8f5][_0x0aba('0x5a')])){_0x182b3e[_0x469b53[_0x178e8e[_0x87f8f5]['questionId']]]=_0x178e8e[_0x87f8f5][_0x0aba('0x60')];}}for(var _0x24d3ac in _0x469b53){if(!_0x182b3e[_0x0aba('0x31')](_0x469b53[_0x24d3ac])){_0x182b3e[_0x469b53[_0x24d3ac]]=null;}}_0x424daa[_0x0aba('0x61')](_0x182b3e);}return _0x424daa;}})[_0x0aba('0x23')](function(_0x4b2ff8){if(!_['isEmpty'](_0x4b2ff8)){var _0x40bfb3=toCsv(_0x4b2ff8);var _0x347641=Date[_0x0aba('0x62')]();fs['writeFileSync'](util[_0x0aba('0x5d')](_0x0aba('0x63'),_0x37af18[_0x0aba('0x4c')]['id'],_0x347641),_0x40bfb3);_0x1bc471[_0x0aba('0x64')](_0x0aba('0x65'),_0x0aba('0x66')+util[_0x0aba('0x5d')](_0x0aba('0x67'),_0x37af18[_0x0aba('0x4c')]['id'],_0x347641));_0x1bc471[_0x0aba('0x64')](_0x0aba('0x68'),_0x0aba('0x69'));return _0x1bc471[_0x0aba('0x6a')](util[_0x0aba('0x5d')](_0x0aba('0x63'),_0x37af18[_0x0aba('0x4c')]['id'],_0x347641));}else{return _0x1bc471[_0x0aba('0x19')](0xcc);}})[_0x0aba('0x41')](handleError(_0x1bc471,null));}; \ No newline at end of file +var _0x8f2d=['download','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','JscriptyProject','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','add','day','merge','filter','map','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','options','omit','updatedAt','createdAt','destroy','getSessions','findOne','JscriptySessionReport','nolimit','pick','getAnswers','JscriptyAnswerReport','fromCharCode','toString','indexOf','replace','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv'];(function(_0x4c5212,_0xdd425a){var _0x290a86=function(_0x47403e){while(--_0x47403e){_0x4c5212['push'](_0x4c5212['shift']());}};_0x290a86(++_0xdd425a);}(_0x8f2d,0x19d));var _0xd8f2=function(_0x5f279c,_0x4df91b){_0x5f279c=_0x5f279c-0x0;var _0x59f540=_0x8f2d[_0x5f279c];return _0x59f540;};'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('request-promise');var moment=require('moment');var BPromise=require(_0xd8f2('0x4'));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(_0xd8f2('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd8f2('0xb'));var jsforce=require(_0xd8f2('0xc'));var deskjs=require(_0xd8f2('0xd'));var toCsv=require(_0xd8f2('0x9'));var querystring=require(_0xd8f2('0xe'));var Papa=require(_0xd8f2('0xf'));var Redis=require(_0xd8f2('0x10'));var qs=require(_0xd8f2('0x11'));var logger=require(_0xd8f2('0x12'))(_0xd8f2('0x13'));var utils=require(_0xd8f2('0x14'));var config=require(_0xd8f2('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe5fc29,_0x4316ae){_0x4316ae=_0x4316ae||0xcc;return function(_0x259d0e){if(_0x259d0e){return _0xe5fc29[_0xd8f2('0x16')](_0x4316ae);}return _0xe5fc29[_0xd8f2('0x17')](_0x4316ae)[_0xd8f2('0x18')]();};}function respondWithResult(_0x24419f,_0x289535){_0x289535=_0x289535||0xc8;return function(_0x5f5722){if(_0x5f5722){return _0x24419f[_0xd8f2('0x17')](_0x289535)[_0xd8f2('0x19')](_0x5f5722);}};}function respondWithFilteredResult(_0xf4a91c,_0x1e7476){return function(_0x432742){if(_0x432742){var _0x33ea25=_0x432742[_0xd8f2('0x1a')],_0x15be39=_0x1e7476[_0xd8f2('0x1b')],_0x50ff67=_0x1e7476[_0xd8f2('0x1b')]+_0x1e7476[_0xd8f2('0x1c')],_0x682287;if(_0x50ff67>=_0x33ea25){_0x50ff67=_0x33ea25;_0x682287=0xc8;}else{_0x682287=0xce;}_0xf4a91c[_0xd8f2('0x17')](_0x682287);return _0xf4a91c[_0xd8f2('0x1d')](_0xd8f2('0x1e'),_0x15be39+'-'+_0x50ff67+'/'+_0x33ea25)[_0xd8f2('0x19')](_0x432742);}return null;};}function patchUpdates(_0x4ebf7a){return function(_0x1d47ad){try{jsonpatch[_0xd8f2('0x1f')](_0x1d47ad,_0x4ebf7a,!![]);}catch(_0xae00f){return BPromise[_0xd8f2('0x20')](_0xae00f);}return _0x1d47ad[_0xd8f2('0x21')]();};}function saveUpdates(_0x1e0b82,_0x5e46bb){return function(_0x139fab){if(_0x139fab){return _0x139fab[_0xd8f2('0x22')](_0x1e0b82)['then'](function(_0xc72625){return _0xc72625;});}return null;};}function removeEntity(_0x5b7ed3,_0x53b0f0){return function(_0x4da66d){if(_0x4da66d){return _0x4da66d['destroy']()[_0xd8f2('0x23')](function(){_0x5b7ed3[_0xd8f2('0x17')](0xcc)[_0xd8f2('0x18')]();});}};}function handleEntityNotFound(_0x16770d,_0x1af955){return function(_0x43b46d){if(!_0x43b46d){_0x16770d[_0xd8f2('0x16')](0x194);}return _0x43b46d;};}function handleError(_0x5b5ba0,_0x42881e){_0x42881e=_0x42881e||0x1f4;return function(_0x4b09af){logger[_0xd8f2('0x24')](_0x4b09af[_0xd8f2('0x25')]);if(_0x4b09af[_0xd8f2('0x26')]){delete _0x4b09af[_0xd8f2('0x26')];}_0x5b5ba0['status'](_0x42881e)['send'](_0x4b09af);};}exports[_0xd8f2('0x27')]=function(_0x1cab12,_0x5aebd9){var _0x596062={},_0x25d9c7={},_0x4e3ce5={'count':0x0,'rows':[]};var _0x14b9c5=db[_0xd8f2('0x28')]['rawAttributes'];_0x25d9c7[_0xd8f2('0x29')]=_[_0xd8f2('0x2a')](_0x14b9c5);var _0x192dff={'dateStart':_0x1cab12[_0xd8f2('0x2b')]['dateStart'],'dateEnd':_0x1cab12['query']['dateEnd']};delete _0x1cab12[_0xd8f2('0x2b')][_0xd8f2('0x2c')];delete _0x1cab12['query'][_0xd8f2('0x2d')];_0x25d9c7[_0xd8f2('0x2b')]=_[_0xd8f2('0x2a')](_0x1cab12['query']);_0x25d9c7[_0xd8f2('0x2e')]=_[_0xd8f2('0x2f')](_0x25d9c7['model'],_0x25d9c7[_0xd8f2('0x2b')]);_0x596062['attributes']=_[_0xd8f2('0x2f')](_0x25d9c7['model'],qs['fields'](_0x1cab12['query'][_0xd8f2('0x30')]));_0x596062[_0xd8f2('0x31')]=_0x596062['attributes'][_0xd8f2('0x32')]?_0x596062[_0xd8f2('0x31')]:_0x25d9c7['model'];if(!_0x1cab12[_0xd8f2('0x2b')][_0xd8f2('0x33')]('nolimit')){_0x596062[_0xd8f2('0x1c')]=qs['limit'](_0x1cab12['query'][_0xd8f2('0x1c')]);_0x596062[_0xd8f2('0x1b')]=qs[_0xd8f2('0x1b')](_0x1cab12[_0xd8f2('0x2b')]['offset']);}_0x596062[_0xd8f2('0x34')]=qs[_0xd8f2('0x35')](_0x1cab12['query'][_0xd8f2('0x35')]);_0x596062[_0xd8f2('0x36')]=qs[_0xd8f2('0x2e')](_['pick'](_0x1cab12[_0xd8f2('0x2b')],_0x25d9c7['filters']));if(_0x192dff[_0xd8f2('0x2c')]){if(_0x192dff[_0xd8f2('0x2d')]){_0x192dff[_0xd8f2('0x2d')]=moment(_0x192dff[_0xd8f2('0x2d')])[_0xd8f2('0x37')](0x1,'day');}else{_0x192dff[_0xd8f2('0x2d')]=moment(_0x192dff[_0xd8f2('0x2c')])[_0xd8f2('0x37')](0x1,_0xd8f2('0x38'));}_[_0xd8f2('0x39')](_0x596062[_0xd8f2('0x36')],{'createdAt':{'$gte':_0x192dff['dateStart'],'$lte':_0x192dff[_0xd8f2('0x2d')]}});}if(_0x1cab12['query'][_0xd8f2('0x3a')]){_0x596062['where']=_['merge'](_0x596062['where'],{'$or':_[_0xd8f2('0x3b')](_0x596062[_0xd8f2('0x31')],function(_0x3de56f){var _0x49f9bf={};_0x49f9bf[_0x3de56f]={'$like':'%'+_0x1cab12[_0xd8f2('0x2b')]['filter']+'%'};return _0x49f9bf;})});}_0x596062=_[_0xd8f2('0x39')]({},_0x596062,_0x1cab12['options']);var _0x1d2363={'where':_0x596062['where']};return db[_0xd8f2('0x28')]['count'](_0x1d2363)[_0xd8f2('0x23')](function(_0x48e564){_0x4e3ce5[_0xd8f2('0x1a')]=_0x48e564;if(_0x1cab12[_0xd8f2('0x2b')][_0xd8f2('0x3c')]){_0x596062[_0xd8f2('0x3d')]=[{'all':!![]}];}return db[_0xd8f2('0x28')][_0xd8f2('0x3e')](_0x596062);})[_0xd8f2('0x23')](function(_0x1855b4){_0x4e3ce5[_0xd8f2('0x3f')]=_0x1855b4;return _0x4e3ce5;})[_0xd8f2('0x23')](respondWithFilteredResult(_0x5aebd9,_0x596062))[_0xd8f2('0x40')](handleError(_0x5aebd9,null));};exports[_0xd8f2('0x41')]=function(_0xaf6758,_0x191b05){var _0x4e6e38={'raw':![],'where':{'id':_0xaf6758[_0xd8f2('0x42')]['id']}},_0x535e7b={};_0x535e7b[_0xd8f2('0x29')]=_[_0xd8f2('0x2a')](db['JscriptyProject'][_0xd8f2('0x43')]);_0x535e7b[_0xd8f2('0x2b')]=_[_0xd8f2('0x2a')](_0xaf6758['query']);_0x535e7b[_0xd8f2('0x2e')]=_[_0xd8f2('0x2f')](_0x535e7b[_0xd8f2('0x29')],_0x535e7b[_0xd8f2('0x2b')]);_0x4e6e38[_0xd8f2('0x31')]=_[_0xd8f2('0x2f')](_0x535e7b[_0xd8f2('0x29')],qs[_0xd8f2('0x30')](_0xaf6758['query'][_0xd8f2('0x30')]));_0x4e6e38[_0xd8f2('0x31')]=_0x4e6e38[_0xd8f2('0x31')][_0xd8f2('0x32')]?_0x4e6e38[_0xd8f2('0x31')]:_0x535e7b[_0xd8f2('0x29')];if(_0xaf6758[_0xd8f2('0x2b')][_0xd8f2('0x3c')]){_0x4e6e38[_0xd8f2('0x3d')]=[{'all':!![]}];}_0x4e6e38=_[_0xd8f2('0x39')]({},_0x4e6e38,_0xaf6758['options']);return db[_0xd8f2('0x28')][_0xd8f2('0x44')](_0x4e6e38)[_0xd8f2('0x23')](handleEntityNotFound(_0x191b05,null))['then'](respondWithResult(_0x191b05,null))[_0xd8f2('0x40')](handleError(_0x191b05,null));};exports[_0xd8f2('0x45')]=function(_0x1e1ac9,_0x2bbf18){return db[_0xd8f2('0x28')][_0xd8f2('0x45')](_0x1e1ac9[_0xd8f2('0x46')],{})['then'](respondWithResult(_0x2bbf18,0xc9))[_0xd8f2('0x40')](handleError(_0x2bbf18,null));};exports['clone']=function(_0x372f4a,_0x261b3b){var _0x21e306={'raw':![],'where':{'id':_0x372f4a[_0xd8f2('0x42')]['id']}},_0x5e5d0b={};_0x5e5d0b[_0xd8f2('0x29')]=_[_0xd8f2('0x2a')](db[_0xd8f2('0x28')]['rawAttributes']);_0x21e306[_0xd8f2('0x31')]=_[_0xd8f2('0x2f')](_0x5e5d0b[_0xd8f2('0x29')],qs[_0xd8f2('0x30')](_0x372f4a[_0xd8f2('0x2b')][_0xd8f2('0x30')]));_0x21e306[_0xd8f2('0x31')]=_0x21e306[_0xd8f2('0x31')][_0xd8f2('0x32')]?_0x21e306[_0xd8f2('0x31')]:_0x5e5d0b[_0xd8f2('0x29')];if(_0x372f4a[_0xd8f2('0x2b')][_0xd8f2('0x3c')]){_0x21e306[_0xd8f2('0x3d')]=[{'all':!![]}];}_0x21e306=_[_0xd8f2('0x39')]({},_0x21e306,_0x372f4a[_0xd8f2('0x47')]);return db[_0xd8f2('0x28')][_0xd8f2('0x44')](_0x21e306)[_0xd8f2('0x23')](handleEntityNotFound(_0x261b3b,null))['then'](function(_0x485f50){if(_0x485f50){var _0x5b63a3=_0x485f50['get']({'plain':!![]});_0x5b63a3=qs[_0xd8f2('0x48')](_0x5b63a3,['id','createdAt',_0xd8f2('0x49')]);_0x372f4a['body']=_['omit'](_0x372f4a[_0xd8f2('0x46')],['id',_0xd8f2('0x4a'),_0xd8f2('0x49')]);return db[_0xd8f2('0x28')][_0xd8f2('0x45')](_[_0xd8f2('0x39')](_0x5b63a3,_0x372f4a['body']),{'include':_0x372f4a[_0xd8f2('0x2b')]['includeAll']?[{'all':!![]}]:undefined});}})[_0xd8f2('0x23')](respondWithResult(_0x261b3b,0xc9))['catch'](handleError(_0x261b3b,null));};exports[_0xd8f2('0x22')]=function(_0x392452,_0x466099){if(_0x392452['body']['id']){delete _0x392452[_0xd8f2('0x46')]['id'];}return db[_0xd8f2('0x28')][_0xd8f2('0x44')]({'where':{'id':_0x392452[_0xd8f2('0x42')]['id']}})[_0xd8f2('0x23')](handleEntityNotFound(_0x466099,null))[_0xd8f2('0x23')](saveUpdates(_0x392452[_0xd8f2('0x46')],null))['then'](respondWithResult(_0x466099,null))[_0xd8f2('0x40')](handleError(_0x466099,null));};exports[_0xd8f2('0x4b')]=function(_0x390890,_0x1c4a61){return db[_0xd8f2('0x28')][_0xd8f2('0x44')]({'where':{'id':_0x390890['params']['id']}})[_0xd8f2('0x23')](handleEntityNotFound(_0x1c4a61,null))[_0xd8f2('0x23')](removeEntity(_0x1c4a61,null))[_0xd8f2('0x40')](handleError(_0x1c4a61,null));};exports[_0xd8f2('0x4c')]=function(_0x5ae5bc,_0x4ef1f4,_0x355f63){var _0x209c8f={'raw':!![],'where':{}};var _0x394c39={};var _0x170752={'count':0x0,'rows':[]};return db[_0xd8f2('0x28')][_0xd8f2('0x4d')]({'where':{'id':_0x5ae5bc[_0xd8f2('0x42')]['id']}})['then'](handleEntityNotFound(_0x4ef1f4,null))[_0xd8f2('0x23')](function(_0x52d864){if(_0x52d864){_0x394c39[_0xd8f2('0x29')]=_[_0xd8f2('0x2a')](db[_0xd8f2('0x4e')]['rawAttributes']);_0x394c39[_0xd8f2('0x2b')]=_[_0xd8f2('0x2a')](_0x5ae5bc[_0xd8f2('0x2b')]);_0x394c39[_0xd8f2('0x2e')]=_[_0xd8f2('0x2f')](_0x394c39[_0xd8f2('0x29')],_0x394c39[_0xd8f2('0x2b')]);_0x209c8f[_0xd8f2('0x31')]=_[_0xd8f2('0x2f')](_0x394c39[_0xd8f2('0x29')],qs[_0xd8f2('0x30')](_0x5ae5bc[_0xd8f2('0x2b')][_0xd8f2('0x30')]));_0x209c8f['attributes']=_0x209c8f['attributes'][_0xd8f2('0x32')]?_0x209c8f[_0xd8f2('0x31')]:_0x394c39[_0xd8f2('0x29')];if(!_0x5ae5bc[_0xd8f2('0x2b')][_0xd8f2('0x33')](_0xd8f2('0x4f'))){_0x209c8f['limit']=qs[_0xd8f2('0x1c')](_0x5ae5bc[_0xd8f2('0x2b')]['limit']);_0x209c8f[_0xd8f2('0x1b')]=qs[_0xd8f2('0x1b')](_0x5ae5bc[_0xd8f2('0x2b')][_0xd8f2('0x1b')]);}_0x209c8f[_0xd8f2('0x34')]=qs[_0xd8f2('0x35')](_0x5ae5bc[_0xd8f2('0x2b')][_0xd8f2('0x35')]);_0x209c8f[_0xd8f2('0x36')]=qs[_0xd8f2('0x2e')](_[_0xd8f2('0x50')](_0x5ae5bc['query'],_0x394c39['filters']));_0x209c8f[_0xd8f2('0x36')]['ProjectId']=_0x52d864['id'];if(_0x5ae5bc['query'][_0xd8f2('0x3a')]){_0x209c8f[_0xd8f2('0x36')]=_['merge'](_0x209c8f[_0xd8f2('0x36')],{'$or':_[_0xd8f2('0x3b')](_0x209c8f[_0xd8f2('0x31')],function(_0xd97d87){var _0x47d420={};_0x47d420[_0xd97d87]={'$like':'%'+_0x5ae5bc[_0xd8f2('0x2b')][_0xd8f2('0x3a')]+'%'};return _0x47d420;})});}_0x209c8f=_[_0xd8f2('0x39')]({},_0x209c8f,_0x5ae5bc[_0xd8f2('0x47')]);return db[_0xd8f2('0x4e')]['count']({'where':_0x209c8f[_0xd8f2('0x36')]})[_0xd8f2('0x23')](function(_0x594c87){_0x170752[_0xd8f2('0x1a')]=_0x594c87;if(_0x5ae5bc['query'][_0xd8f2('0x3c')]){_0x209c8f['include']=[{'all':!![]}];}return db[_0xd8f2('0x4e')][_0xd8f2('0x3e')](_0x209c8f);})[_0xd8f2('0x23')](function(_0x282521){_0x170752[_0xd8f2('0x3f')]=_0x282521;return _0x170752;});}})['then'](respondWithFilteredResult(_0x4ef1f4,_0x209c8f))[_0xd8f2('0x40')](handleError(_0x4ef1f4,null));};exports[_0xd8f2('0x51')]=function(_0x5d89ca,_0x56cee4,_0x342a12){var _0x4ebda4={'raw':!![],'where':{}};var _0x5829ff={};var _0xdebe05={'count':0x0,'rows':[]};var _0x3b21e0={'dateStart':_0x5d89ca[_0xd8f2('0x2b')][_0xd8f2('0x2c')],'dateEnd':_0x5d89ca[_0xd8f2('0x2b')][_0xd8f2('0x2d')]};delete _0x5d89ca[_0xd8f2('0x2b')][_0xd8f2('0x2c')];delete _0x5d89ca[_0xd8f2('0x2b')][_0xd8f2('0x2d')];return db[_0xd8f2('0x28')][_0xd8f2('0x4d')]({'where':{'id':_0x5d89ca[_0xd8f2('0x42')]['id']}})[_0xd8f2('0x23')](handleEntityNotFound(_0x56cee4,null))[_0xd8f2('0x23')](function(_0x9aa220){if(_0x9aa220){_0x5829ff[_0xd8f2('0x29')]=_[_0xd8f2('0x2a')](db[_0xd8f2('0x52')][_0xd8f2('0x43')]);_0x5829ff[_0xd8f2('0x2b')]=_['keys'](_0x5d89ca[_0xd8f2('0x2b')]);_0x5829ff[_0xd8f2('0x2e')]=_[_0xd8f2('0x2f')](_0x5829ff['model'],_0x5829ff['query']);_0x4ebda4[_0xd8f2('0x31')]=_['intersection'](_0x5829ff[_0xd8f2('0x29')],qs[_0xd8f2('0x30')](_0x5d89ca[_0xd8f2('0x2b')][_0xd8f2('0x30')]));_0x4ebda4[_0xd8f2('0x31')]=_0x4ebda4[_0xd8f2('0x31')][_0xd8f2('0x32')]?_0x4ebda4[_0xd8f2('0x31')]:_0x5829ff[_0xd8f2('0x29')];if(!_0x5d89ca[_0xd8f2('0x2b')][_0xd8f2('0x33')]('nolimit')){_0x4ebda4['limit']=qs[_0xd8f2('0x1c')](_0x5d89ca[_0xd8f2('0x2b')][_0xd8f2('0x1c')]);_0x4ebda4[_0xd8f2('0x1b')]=qs[_0xd8f2('0x1b')](_0x5d89ca['query'][_0xd8f2('0x1b')]);}_0x4ebda4[_0xd8f2('0x34')]=qs[_0xd8f2('0x35')](_0x5d89ca['query'][_0xd8f2('0x35')]);_0x4ebda4[_0xd8f2('0x36')]=qs[_0xd8f2('0x2e')](_['pick'](_0x5d89ca[_0xd8f2('0x2b')],_0x5829ff['filters']));_0x4ebda4[_0xd8f2('0x36')]['ProjectId']=_0x9aa220['id'];if(_0x3b21e0[_0xd8f2('0x2c')]){if(_0x3b21e0[_0xd8f2('0x2d')]){_0x3b21e0[_0xd8f2('0x2d')]=moment(_0x3b21e0['dateEnd'])['add'](0x1,_0xd8f2('0x38'));}else{_0x3b21e0[_0xd8f2('0x2d')]=moment(_0x3b21e0[_0xd8f2('0x2c')])[_0xd8f2('0x37')](0x1,'day');}_[_0xd8f2('0x39')](_0x4ebda4[_0xd8f2('0x36')],{'createdAt':{'$gte':_0x3b21e0[_0xd8f2('0x2c')],'$lte':_0x3b21e0['dateEnd']}});}if(_0x5d89ca[_0xd8f2('0x2b')][_0xd8f2('0x3a')]){_0x4ebda4[_0xd8f2('0x36')]=_[_0xd8f2('0x39')](_0x4ebda4[_0xd8f2('0x36')],{'$or':_[_0xd8f2('0x3b')](_0x4ebda4[_0xd8f2('0x31')],function(_0x5e9ef2){var _0x1f2bbc={};_0x1f2bbc[_0x5e9ef2]={'$like':'%'+_0x5d89ca[_0xd8f2('0x2b')][_0xd8f2('0x3a')]+'%'};return _0x1f2bbc;})});}_0x4ebda4=_[_0xd8f2('0x39')]({},_0x4ebda4,_0x5d89ca['options']);return db['JscriptyAnswerReport']['count']({'where':_0x4ebda4['where']})[_0xd8f2('0x23')](function(_0x2405a3){_0xdebe05[_0xd8f2('0x1a')]=_0x2405a3;if(_0x5d89ca[_0xd8f2('0x2b')][_0xd8f2('0x3c')]){_0x4ebda4[_0xd8f2('0x3d')]=[{'all':!![]}];}return db[_0xd8f2('0x52')][_0xd8f2('0x3e')](_0x4ebda4);})[_0xd8f2('0x23')](function(_0x2af0e2){_0xdebe05[_0xd8f2('0x3f')]=_0x2af0e2;return _0xdebe05;});}})[_0xd8f2('0x23')](respondWithFilteredResult(_0x56cee4,_0x4ebda4))[_0xd8f2('0x40')](handleError(_0x56cee4,null));};function char(_0x381560){return'number'===typeof _0x381560?String[_0xd8f2('0x53')][_0xd8f2('0x1f')](null,arguments):_0x381560;}function needsEncapsulation(_0x101518){return!!_0x101518&&(_0x101518['toString']()['indexOf'](char(0xd))>=0x0||_0x101518[_0xd8f2('0x54')]()[_0xd8f2('0x55')](char(0xa))>=0x0||_0x101518[_0xd8f2('0x54')]()[_0xd8f2('0x55')](char(0x2c))>=0x0||_0x101518[_0xd8f2('0x54')]()[_0xd8f2('0x55')](char(0x22))>=0x0);}function encapsulate(_0x92ea79){var _0x248121=char(0x22),_0x2dc25f='\x5c'+char(0x22),_0x3e5aa7=_0x92ea79['toString']()[_0xd8f2('0x56')](new RegExp(_0x248121,'g'),_0x2dc25f);return _0x248121+_0x3e5aa7+_0x248121;}exports['getSummary']=function(_0x51e72b,_0x390a6e,_0x38f4ac){var _0x482cb1,_0x1b05ed;var _0x585a0d={'dateStart':_0x51e72b['query'][_0xd8f2('0x2c')],'dateEnd':_0x51e72b[_0xd8f2('0x2b')][_0xd8f2('0x2d')]};delete _0x51e72b['query']['dateStart'];delete _0x51e72b[_0xd8f2('0x2b')][_0xd8f2('0x2d')];if(_0x585a0d[_0xd8f2('0x2c')]){if(_0x585a0d[_0xd8f2('0x2d')]){_0x585a0d[_0xd8f2('0x2d')]=moment(_0x585a0d[_0xd8f2('0x2d')])[_0xd8f2('0x37')](0x1,_0xd8f2('0x38'));}else{_0x585a0d[_0xd8f2('0x2d')]=moment(_0x585a0d[_0xd8f2('0x2c')])[_0xd8f2('0x37')](0x1,_0xd8f2('0x38'));}}return db['JscriptySessionReport'][_0xd8f2('0x3e')]({'where':{'ProjectId':_0x51e72b[_0xd8f2('0x42')]['id'],'starttime':{'$gte':_0x585a0d[_0xd8f2('0x2c')],'$lte':_0x585a0d[_0xd8f2('0x2d')]}}})[_0xd8f2('0x23')](handleEntityNotFound(_0x390a6e,null))[_0xd8f2('0x23')](function(_0x8cc000){if(_0x8cc000){_0x482cb1=_0x8cc000;return db['JscriptyQuestionReport'][_0xd8f2('0x3e')]({'where':{'SessionId':{'$in':_[_0xd8f2('0x3b')](_0x482cb1,'id')},'ProjectId':_0x51e72b[_0xd8f2('0x42')]['id']},'order':'-createdAt'});}})[_0xd8f2('0x23')](handleEntityNotFound(_0x390a6e,null))[_0xd8f2('0x23')](function(_0x52c07e){if(_0x52c07e){_0x1b05ed=_0x52c07e;var _0x48239a={};for(var _0x5d4887=0x0,_0x2d892b=_0x1b05ed[_0xd8f2('0x32')];_0x5d4887<_0x2d892b;_0x5d4887++){if(!_0x48239a['hasOwnProperty'](_0x1b05ed[_0x5d4887][_0xd8f2('0x57')])){_0x48239a[_0x1b05ed[_0x5d4887][_0xd8f2('0x57')]]=needsEncapsulation(_0x1b05ed[_0x5d4887][_0xd8f2('0x58')])?encapsulate(_0x1b05ed[_0x5d4887][_0xd8f2('0x58')]):_0x1b05ed[_0x5d4887][_0xd8f2('0x58')];}}var _0x49fb25=[],_0x2040ca={};for(var _0x200493=0x0,_0x5c6ad9=_0x482cb1[_0xd8f2('0x32')];_0x200493<_0x5c6ad9;_0x200493++){_0x2040ca={'ProjectId':_0x51e72b[_0xd8f2('0x42')]['id'],'SessionId':_0x482cb1[_0x200493]['id'],'StartTime':moment(_0x482cb1[_0x200493]['starttime'])['format'](_0xd8f2('0x59'))};for(var _0x382188=0x0,_0x2120a7=_0x1b05ed[_0xd8f2('0x32')];_0x382188<_0x2120a7;_0x382188++){if(_0x1b05ed[_0x382188][_0xd8f2('0x5a')]==_0x482cb1[_0x200493]['id']&&_0x48239a['hasOwnProperty'](_0x1b05ed[_0x382188][_0xd8f2('0x57')])){_0x2040ca[_0x48239a[_0x1b05ed[_0x382188][_0xd8f2('0x57')]]]=_0x1b05ed[_0x382188][_0xd8f2('0x5b')];}}for(var _0x5cd8b2 in _0x48239a){if(!_0x2040ca['hasOwnProperty'](_0x48239a[_0x5cd8b2])){_0x2040ca[_0x48239a[_0x5cd8b2]]=null;}}_0x49fb25[_0xd8f2('0x5c')](_0x2040ca);}return _0x49fb25;}})[_0xd8f2('0x23')](function(_0x580e0b){if(!_[_0xd8f2('0x5d')](_0x580e0b)){var _0x3ff1df=toCsv(_0x580e0b);var _0x11b286=Date['now']();fs[_0xd8f2('0x5e')](util[_0xd8f2('0x5f')](_0xd8f2('0x60'),_0x51e72b[_0xd8f2('0x42')]['id'],_0x11b286),_0x3ff1df);_0x390a6e[_0xd8f2('0x61')]('Content-disposition',_0xd8f2('0x62')+util['format'](_0xd8f2('0x63'),_0x51e72b['params']['id'],_0x11b286));_0x390a6e['setHeader'](_0xd8f2('0x64'),_0xd8f2('0x65'));return _0x390a6e[_0xd8f2('0x66')](util[_0xd8f2('0x5f')](_0xd8f2('0x60'),_0x51e72b[_0xd8f2('0x42')]['id'],_0x11b286));}else{return _0x390a6e['sendStatus'](0xcc);}})[_0xd8f2('0x40')](handleError(_0x390a6e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 080fc23..9c30cb4 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 _0xc664=['util','../../config/logger','api','bluebird','request-promise','exports','define','JscriptyProject','jscripty_projects','lodash'];(function(_0x3b86a4,_0x5df054){var _0x27e920=function(_0x2f07dd){while(--_0x2f07dd){_0x3b86a4['push'](_0x3b86a4['shift']());}};_0x27e920(++_0x5df054);}(_0xc664,0x1ad));var _0x4c66=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc664[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4c66('0x0'));var util=require(_0x4c66('0x1'));var logger=require(_0x4c66('0x2'))(_0x4c66('0x3'));var moment=require('moment');var BPromise=require(_0x4c66('0x4'));var rp=require(_0x4c66('0x5'));var attributes=require('./jscriptyProject.attributes');module[_0x4c66('0x6')]=function(_0x45f9ae,_0x57fbd5){return _0x45f9ae[_0x4c66('0x7')](_0x4c66('0x8'),attributes,{'tableName':_0x4c66('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1202=['moment','bluebird','request-promise','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api'];(function(_0x3a7d2d,_0x4d6223){var _0x5f0c2e=function(_0x47757f){while(--_0x47757f){_0x3a7d2d['push'](_0x3a7d2d['shift']());}};_0x5f0c2e(++_0x4d6223);}(_0x1202,0x11c));var _0x2120=function(_0x84d5cd,_0x52aa86){_0x84d5cd=_0x84d5cd-0x0;var _0xe71f9d=_0x1202[_0x84d5cd];return _0xe71f9d;};'use strict';var _=require(_0x2120('0x0'));var util=require(_0x2120('0x1'));var logger=require(_0x2120('0x2'))(_0x2120('0x3'));var moment=require(_0x2120('0x4'));var BPromise=require(_0x2120('0x5'));var rp=require(_0x2120('0x6'));var attributes=require(_0x2120('0x7'));module[_0x2120('0x8')]=function(_0x2d7d21,_0x10de76){return _0x2d7d21[_0x2120('0x9')](_0x2120('0xa'),attributes,{'tableName':_0x2120('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index aa3c223..89d5547 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 _0xa3f1=['info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1073ad,_0x44bf0b){var _0x528474=function(_0x3450f7){while(--_0x3450f7){_0x1073ad['push'](_0x1073ad['shift']());}};_0x528474(++_0x44bf0b);}(_0xa3f1,0x116));var _0x1a3f=function(_0x201bb7,_0x514c0c){_0x201bb7=_0x201bb7-0x0;var _0xfee38e=_0xa3f1[_0x201bb7];return _0xfee38e;};'use strict';var _=require(_0x1a3f('0x0'));var util=require(_0x1a3f('0x1'));var moment=require(_0x1a3f('0x2'));var BPromise=require(_0x1a3f('0x3'));var rs=require(_0x1a3f('0x4'));var fs=require('fs');var Redis=require(_0x1a3f('0x5'));var db=require(_0x1a3f('0x6'))['db'];var utils=require(_0x1a3f('0x7'));var logger=require(_0x1a3f('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1a3f('0x9'));var client=jayson[_0x1a3f('0xa')][_0x1a3f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27dca7,_0x5d1c54,_0x4453c9){return new BPromise(function(_0x108a30,_0x589bdb){return client[_0x1a3f('0xc')](_0x27dca7,_0x4453c9)[_0x1a3f('0xd')](function(_0x1b8fe8){logger['info'](_0x1a3f('0xe'),_0x5d1c54,_0x1a3f('0xf'));logger[_0x1a3f('0x10')](_0x1a3f('0x11'),_0x5d1c54,_0x1a3f('0xf'),JSON[_0x1a3f('0x12')](_0x1b8fe8));if(_0x1b8fe8[_0x1a3f('0x13')]){if(_0x1b8fe8[_0x1a3f('0x13')][_0x1a3f('0x14')]===0x1f4){logger['error'](_0x1a3f('0xe'),_0x5d1c54,_0x1b8fe8['error']['message']);return _0x589bdb(_0x1b8fe8['error'][_0x1a3f('0x15')]);}logger['error'](_0x1a3f('0xe'),_0x5d1c54,_0x1b8fe8[_0x1a3f('0x13')]['message']);return _0x108a30(_0x1b8fe8[_0x1a3f('0x13')][_0x1a3f('0x15')]);}else{logger[_0x1a3f('0x16')](_0x1a3f('0xe'),_0x5d1c54,'request\x20sent');_0x108a30(_0x1b8fe8[_0x1a3f('0x17')]['message']);}})[_0x1a3f('0x18')](function(_0x23a79f){logger[_0x1a3f('0x13')](_0x1a3f('0xe'),_0x5d1c54,_0x23a79f);_0x589bdb(_0x23a79f);});});} \ No newline at end of file +var _0x3302=['info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then'];(function(_0x8f8d85,_0x106130){var _0x2c4181=function(_0x468c6a){while(--_0x468c6a){_0x8f8d85['push'](_0x8f8d85['shift']());}};_0x2c4181(++_0x106130);}(_0x3302,0x184));var _0x2330=function(_0x346531,_0x35d2b8){_0x346531=_0x346531-0x0;var _0x4cc8ab=_0x3302[_0x346531];return _0x4cc8ab;};'use strict';var _=require(_0x2330('0x0'));var util=require('util');var moment=require(_0x2330('0x1'));var BPromise=require(_0x2330('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2330('0x3'))['db'];var utils=require(_0x2330('0x4'));var logger=require(_0x2330('0x5'))('rpc');var config=require(_0x2330('0x6'));var jayson=require(_0x2330('0x7'));var client=jayson['client'][_0x2330('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3bf494,_0x3d9a71,_0x2e1103){return new BPromise(function(_0x193ff1,_0x4187dd){return client[_0x2330('0x9')](_0x3bf494,_0x2e1103)[_0x2330('0xa')](function(_0x1e1a5b){logger[_0x2330('0xb')](_0x2330('0xc'),_0x3d9a71,_0x2330('0xd'));logger[_0x2330('0xe')](_0x2330('0xf'),_0x3d9a71,_0x2330('0xd'),JSON[_0x2330('0x10')](_0x1e1a5b));if(_0x1e1a5b[_0x2330('0x11')]){if(_0x1e1a5b[_0x2330('0x11')]['code']===0x1f4){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x3d9a71,_0x1e1a5b['error']['message']);return _0x4187dd(_0x1e1a5b[_0x2330('0x11')]['message']);}logger['error'](_0x2330('0xc'),_0x3d9a71,_0x1e1a5b[_0x2330('0x11')][_0x2330('0x12')]);return _0x193ff1(_0x1e1a5b['error'][_0x2330('0x12')]);}else{logger[_0x2330('0xb')](_0x2330('0xc'),_0x3d9a71,_0x2330('0xd'));_0x193ff1(_0x1e1a5b[_0x2330('0x13')][_0x2330('0x12')]);}})[_0x2330('0x14')](function(_0x27a78e){logger['error'](_0x2330('0xc'),_0x3d9a71,_0x27a78e);_0x4187dd(_0x27a78e);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 3e3f05e..7a65b25 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 _0x8c69=['multer','util','express','Router','../../components/interaction/service','./jscriptyQuestionReport.controller','isAuthenticated','index','get','/describe','describe','/:id','create','put','update','delete','exports'];(function(_0x408753,_0x5176e1){var _0x1ba6f1=function(_0x2ed00d){while(--_0x2ed00d){_0x408753['push'](_0x408753['shift']());}};_0x1ba6f1(++_0x5176e1);}(_0x8c69,0x77));var _0x98c6=function(_0x1e0422,_0x823fa5){_0x1e0422=_0x1e0422-0x0;var _0x1afee6=_0x8c69[_0x1e0422];return _0x1afee6;};'use strict';var multer=require(_0x98c6('0x0'));var util=require(_0x98c6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x98c6('0x2'));var router=express[_0x98c6('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x98c6('0x4'));var config=require('../../config/environment');var controller=require(_0x98c6('0x5'));router['get']('/',auth[_0x98c6('0x6')](),controller[_0x98c6('0x7')]);router[_0x98c6('0x8')](_0x98c6('0x9'),auth[_0x98c6('0x6')](),controller[_0x98c6('0xa')]);router[_0x98c6('0x8')](_0x98c6('0xb'),auth[_0x98c6('0x6')](),controller['show']);router['post']('/',auth[_0x98c6('0x6')](),controller[_0x98c6('0xc')]);router[_0x98c6('0xd')](_0x98c6('0xb'),auth[_0x98c6('0x6')](),controller[_0x98c6('0xe')]);router[_0x98c6('0xf')](_0x98c6('0xb'),auth[_0x98c6('0x6')](),controller['destroy']);module[_0x98c6('0x10')]=router; \ No newline at end of file +var _0x620f=['get','isAuthenticated','index','/describe','describe','show','post','put','/:id','update','delete','exports','multer','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller'];(function(_0x5291c8,_0x2c41c7){var _0x16f9df=function(_0x43b308){while(--_0x43b308){_0x5291c8['push'](_0x5291c8['shift']());}};_0x16f9df(++_0x2c41c7);}(_0x620f,0x1bc));var _0xf620=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x620f[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xf620('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf620('0x1'));var router=express['Router']();var auth=require(_0xf620('0x2'));var interaction=require(_0xf620('0x3'));var config=require(_0xf620('0x4'));var controller=require(_0xf620('0x5'));router[_0xf620('0x6')]('/',auth[_0xf620('0x7')](),controller[_0xf620('0x8')]);router['get'](_0xf620('0x9'),auth['isAuthenticated'](),controller[_0xf620('0xa')]);router['get']('/:id',auth[_0xf620('0x7')](),controller[_0xf620('0xb')]);router[_0xf620('0xc')]('/',auth[_0xf620('0x7')](),controller['create']);router[_0xf620('0xd')](_0xf620('0xe'),auth[_0xf620('0x7')](),controller[_0xf620('0xf')]);router[_0xf620('0x10')](_0xf620('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xf620('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 837e9a2..b55a6b2 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 _0x1a5c=['sequelize','exports','STRING','TEXT','long'];(function(_0x16a64c,_0x25fb0f){var _0x16e9ec=function(_0x17b227){while(--_0x17b227){_0x16a64c['push'](_0x16a64c['shift']());}};_0x16e9ec(++_0x25fb0f);}(_0x1a5c,0x12c));var _0xc1a5=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x1a5c[_0xf50820];return _0x2a9b10;};'use strict';var Sequelize=require(_0xc1a5('0x0'));module[_0xc1a5('0x1')]={'question':{'type':Sequelize[_0xc1a5('0x2')]},'answer':{'type':Sequelize[_0xc1a5('0x3')](_0xc1a5('0x4'))},'membername':{'type':Sequelize[_0xc1a5('0x2')]},'projectname':{'type':Sequelize[_0xc1a5('0x2')]},'queue':{'type':Sequelize[_0xc1a5('0x2')]},'uniqueid':{'type':Sequelize[_0xc1a5('0x2')]},'calleridname':{'type':Sequelize[_0xc1a5('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0xc1a5('0x2')]}}; \ No newline at end of file +var _0x3ae9=['STRING','TEXT','long'];(function(_0x3c9107,_0x29f6de){var _0x32e346=function(_0x2529c6){while(--_0x2529c6){_0x3c9107['push'](_0x3c9107['shift']());}};_0x32e346(++_0x29f6de);}(_0x3ae9,0xdb));var _0x93ae=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x3ae9[_0x2a6809];return _0x11c371;};'use strict';var Sequelize=require('sequelize');module['exports']={'question':{'type':Sequelize[_0x93ae('0x0')]},'answer':{'type':Sequelize[_0x93ae('0x1')](_0x93ae('0x2'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x93ae('0x0')]},'queue':{'type':Sequelize[_0x93ae('0x0')]},'uniqueid':{'type':Sequelize[_0x93ae('0x0')]},'calleridname':{'type':Sequelize[_0x93ae('0x0')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0x93ae('0x0')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index ee9d2fd..7b1ff14 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 _0xe511=['count','offset','limit','Content-Range','apply','save','update','then','destroy','end','stack','name','model','query','dateEnd','dateStart','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','add','day','where','filter','merge','map','options','JscriptyQuestionReport','includeAll','findAll','rows','catch','show','params','rawAttributes','body','find','describe','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json'];(function(_0x2d1a6e,_0x26f215){var _0x4b1674=function(_0x170ed3){while(--_0x170ed3){_0x2d1a6e['push'](_0x2d1a6e['shift']());}};_0x4b1674(++_0x26f215);}(_0xe511,0x16f));var _0x1e51=function(_0x204931,_0x53e846){_0x204931=_0x204931-0x0;var _0x9d95b8=_0xe511[_0x204931];return _0x9d95b8;};'use strict';var pdf=require(_0x1e51('0x0'));var emlformat=require(_0x1e51('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1e51('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1e51('0x3'));var moment=require(_0x1e51('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1e51('0x5'));var util=require(_0x1e51('0x6'));var path=require(_0x1e51('0x7'));var sox=require(_0x1e51('0x8'));var csv=require('to-csv');var ejs=require(_0x1e51('0x9'));var fs=require('fs');var _=require(_0x1e51('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e51('0xb'));var deskjs=require(_0x1e51('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e51('0xd'));var Redis=require(_0x1e51('0xe'));var qs=require(_0x1e51('0xf'));var logger=require(_0x1e51('0x10'))(_0x1e51('0x11'));var utils=require(_0x1e51('0x12'));var config=require('../../config/environment');var db=require(_0x1e51('0x13'))['db'];function respondWithStatusCode(_0xcdfa5d,_0x3350bb){_0x3350bb=_0x3350bb||0xcc;return function(_0x2ea35d){if(_0x2ea35d){return _0xcdfa5d[_0x1e51('0x14')](_0x3350bb);}return _0xcdfa5d[_0x1e51('0x15')](_0x3350bb)['end']();};}function respondWithResult(_0x408a77,_0x102f01){_0x102f01=_0x102f01||0xc8;return function(_0x2acdf5){if(_0x2acdf5){return _0x408a77[_0x1e51('0x15')](_0x102f01)[_0x1e51('0x16')](_0x2acdf5);}};}function respondWithFilteredResult(_0x32945d,_0x441c70){return function(_0x467e77){if(_0x467e77){var _0x1cc62a=_0x467e77[_0x1e51('0x17')],_0xd76fba=_0x441c70[_0x1e51('0x18')],_0x5a5c07=_0x441c70['offset']+_0x441c70[_0x1e51('0x19')],_0x3b01b7;if(_0x5a5c07>=_0x1cc62a){_0x5a5c07=_0x1cc62a;_0x3b01b7=0xc8;}else{_0x3b01b7=0xce;}_0x32945d['status'](_0x3b01b7);return _0x32945d['set'](_0x1e51('0x1a'),_0xd76fba+'-'+_0x5a5c07+'/'+_0x1cc62a)[_0x1e51('0x16')](_0x467e77);}return null;};}function patchUpdates(_0x40ae4c){return function(_0x4785a5){try{jsonpatch[_0x1e51('0x1b')](_0x4785a5,_0x40ae4c,!![]);}catch(_0x3e4234){return BPromise['reject'](_0x3e4234);}return _0x4785a5[_0x1e51('0x1c')]();};}function saveUpdates(_0x4a9272,_0xea581d){return function(_0x1cbd1c){if(_0x1cbd1c){return _0x1cbd1c[_0x1e51('0x1d')](_0x4a9272)[_0x1e51('0x1e')](function(_0x506f40){return _0x506f40;});}return null;};}function removeEntity(_0x5223c3,_0x4e6a49){return function(_0x548c32){if(_0x548c32){return _0x548c32[_0x1e51('0x1f')]()['then'](function(){_0x5223c3[_0x1e51('0x15')](0xcc)[_0x1e51('0x20')]();});}};}function handleEntityNotFound(_0x415154,_0x13240f){return function(_0x23c85a){if(!_0x23c85a){_0x415154[_0x1e51('0x14')](0x194);}return _0x23c85a;};}function handleError(_0x270adf,_0x461d3d){_0x461d3d=_0x461d3d||0x1f4;return function(_0x4bcdd3){logger['error'](_0x4bcdd3[_0x1e51('0x21')]);if(_0x4bcdd3[_0x1e51('0x22')]){delete _0x4bcdd3[_0x1e51('0x22')];}_0x270adf[_0x1e51('0x15')](_0x461d3d)['send'](_0x4bcdd3);};}exports['index']=function(_0x486ad6,_0x1eb83f){var _0x2a1561={},_0x433c2d={},_0x5412bc={'count':0x0,'rows':[]};var _0x1e7a96=db['JscriptyQuestionReport']['rawAttributes'];_0x433c2d[_0x1e51('0x23')]=_['keys'](_0x1e7a96);var _0x170ec6={'dateStart':_0x486ad6[_0x1e51('0x24')]['dateStart'],'dateEnd':_0x486ad6[_0x1e51('0x24')][_0x1e51('0x25')]};delete _0x486ad6[_0x1e51('0x24')][_0x1e51('0x26')];delete _0x486ad6['query']['dateEnd'];_0x433c2d['query']=_[_0x1e51('0x27')](_0x486ad6[_0x1e51('0x24')]);_0x433c2d[_0x1e51('0x28')]=_[_0x1e51('0x29')](_0x433c2d[_0x1e51('0x23')],_0x433c2d[_0x1e51('0x24')]);_0x2a1561[_0x1e51('0x2a')]=_[_0x1e51('0x29')](_0x433c2d[_0x1e51('0x23')],qs[_0x1e51('0x2b')](_0x486ad6[_0x1e51('0x24')]['fields']));_0x2a1561[_0x1e51('0x2a')]=_0x2a1561[_0x1e51('0x2a')][_0x1e51('0x2c')]?_0x2a1561[_0x1e51('0x2a')]:_0x433c2d[_0x1e51('0x23')];if(!_0x486ad6['query'][_0x1e51('0x2d')]('nolimit')){_0x2a1561[_0x1e51('0x19')]=qs[_0x1e51('0x19')](_0x486ad6[_0x1e51('0x24')]['limit']);_0x2a1561[_0x1e51('0x18')]=qs['offset'](_0x486ad6[_0x1e51('0x24')]['offset']);}_0x2a1561['order']=qs[_0x1e51('0x2e')](_0x486ad6[_0x1e51('0x24')][_0x1e51('0x2e')]);_0x2a1561['where']=qs[_0x1e51('0x28')](_['pick'](_0x486ad6[_0x1e51('0x24')],_0x433c2d[_0x1e51('0x28')]));if(_0x170ec6['dateStart']){if(_0x170ec6[_0x1e51('0x25')]){_0x170ec6[_0x1e51('0x25')]=moment(_0x170ec6[_0x1e51('0x25')])[_0x1e51('0x2f')](0x1,_0x1e51('0x30'));}else{_0x170ec6[_0x1e51('0x25')]=moment(_0x170ec6['dateStart'])['add'](0x1,_0x1e51('0x30'));}_['merge'](_0x2a1561[_0x1e51('0x31')],{'createdAt':{'$gte':_0x170ec6[_0x1e51('0x26')],'$lte':_0x170ec6[_0x1e51('0x25')]}});}if(_0x486ad6[_0x1e51('0x24')][_0x1e51('0x32')]){_0x2a1561[_0x1e51('0x31')]=_[_0x1e51('0x33')](_0x2a1561[_0x1e51('0x31')],{'$or':_[_0x1e51('0x34')](_0x2a1561[_0x1e51('0x2a')],function(_0x45d5fe){var _0x5360b3={};_0x5360b3[_0x45d5fe]={'$like':'%'+_0x486ad6[_0x1e51('0x24')]['filter']+'%'};return _0x5360b3;})});}_0x2a1561=_[_0x1e51('0x33')]({},_0x2a1561,_0x486ad6[_0x1e51('0x35')]);var _0x2b287e={'where':_0x2a1561[_0x1e51('0x31')]};return db[_0x1e51('0x36')][_0x1e51('0x17')](_0x2b287e)[_0x1e51('0x1e')](function(_0x27b3fd){_0x5412bc[_0x1e51('0x17')]=_0x27b3fd;if(_0x486ad6[_0x1e51('0x24')][_0x1e51('0x37')]){_0x2a1561['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x1e51('0x38')](_0x2a1561);})[_0x1e51('0x1e')](function(_0x3be495){_0x5412bc[_0x1e51('0x39')]=_0x3be495;return _0x5412bc;})[_0x1e51('0x1e')](respondWithFilteredResult(_0x1eb83f,_0x2a1561))[_0x1e51('0x3a')](handleError(_0x1eb83f,null));};exports[_0x1e51('0x3b')]=function(_0x3ca63d,_0x5a6340){var _0x279fca={'raw':!![],'where':{'id':_0x3ca63d[_0x1e51('0x3c')]['id']}},_0x30eba9={};_0x30eba9[_0x1e51('0x23')]=_[_0x1e51('0x27')](db[_0x1e51('0x36')][_0x1e51('0x3d')]);_0x30eba9['query']=_[_0x1e51('0x27')](_0x3ca63d[_0x1e51('0x24')]);_0x30eba9['filters']=_[_0x1e51('0x29')](_0x30eba9[_0x1e51('0x23')],_0x30eba9[_0x1e51('0x24')]);_0x279fca['attributes']=_[_0x1e51('0x29')](_0x30eba9[_0x1e51('0x23')],qs[_0x1e51('0x2b')](_0x3ca63d[_0x1e51('0x24')][_0x1e51('0x2b')]));_0x279fca[_0x1e51('0x2a')]=_0x279fca[_0x1e51('0x2a')][_0x1e51('0x2c')]?_0x279fca[_0x1e51('0x2a')]:_0x30eba9['model'];if(_0x3ca63d[_0x1e51('0x24')][_0x1e51('0x37')]){_0x279fca['include']=[{'all':!![]}];}_0x279fca=_[_0x1e51('0x33')]({},_0x279fca,_0x3ca63d[_0x1e51('0x35')]);return db[_0x1e51('0x36')]['find'](_0x279fca)[_0x1e51('0x1e')](handleEntityNotFound(_0x5a6340,null))[_0x1e51('0x1e')](respondWithResult(_0x5a6340,null))[_0x1e51('0x3a')](handleError(_0x5a6340,null));};exports['create']=function(_0x2e9ee2,_0x52e7da){return db['JscriptyQuestionReport']['create'](_0x2e9ee2[_0x1e51('0x3e')],{})[_0x1e51('0x1e')](respondWithResult(_0x52e7da,0xc9))['catch'](handleError(_0x52e7da,null));};exports['update']=function(_0x191a79,_0x7ffc42){if(_0x191a79[_0x1e51('0x3e')]['id']){delete _0x191a79[_0x1e51('0x3e')]['id'];}return db[_0x1e51('0x36')][_0x1e51('0x3f')]({'where':{'id':_0x191a79['params']['id']}})[_0x1e51('0x1e')](handleEntityNotFound(_0x7ffc42,null))['then'](saveUpdates(_0x191a79[_0x1e51('0x3e')],null))[_0x1e51('0x1e')](respondWithResult(_0x7ffc42,null))['catch'](handleError(_0x7ffc42,null));};exports['destroy']=function(_0x479fe6,_0x5f7b11){return db[_0x1e51('0x36')][_0x1e51('0x3f')]({'where':{'id':_0x479fe6['params']['id']}})[_0x1e51('0x1e')](handleEntityNotFound(_0x5f7b11,null))[_0x1e51('0x1e')](removeEntity(_0x5f7b11,null))[_0x1e51('0x3a')](handleError(_0x5f7b11,null));};exports[_0x1e51('0x40')]=function(_0x1ccb55,_0x12584c){return db[_0x1e51('0x36')][_0x1e51('0x40')]()['then'](respondWithResult(_0x12584c,null))[_0x1e51('0x3a')](handleError(_0x12584c,null));}; \ No newline at end of file +var _0x6c76=['reject','save','then','destroy','error','name','send','index','JscriptyQuestionReport','rawAttributes','model','keys','query','dateEnd','dateStart','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','add','day','merge','where','filter','map','options','includeAll','include','findAll','show','params','find','catch','create','body','update','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit'];(function(_0x5a0277,_0x2186ff){var _0x491acc=function(_0x4fb86d){while(--_0x4fb86d){_0x5a0277['push'](_0x5a0277['shift']());}};_0x491acc(++_0x2186ff);}(_0x6c76,0x184));var _0x66c7=function(_0x252a88,_0x32e4b5){_0x252a88=_0x252a88-0x0;var _0x57cb1d=_0x6c76[_0x252a88];return _0x57cb1d;};'use strict';var pdf=require(_0x66c7('0x0'));var emlformat=require(_0x66c7('0x1'));var rimraf=require(_0x66c7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x66c7('0x3'));var rp=require(_0x66c7('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x66c7('0x5'));var util=require(_0x66c7('0x6'));var path=require('path');var sox=require(_0x66c7('0x7'));var csv=require(_0x66c7('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x66c7('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x66c7('0xa'));var deskjs=require(_0x66c7('0xb'));var toCsv=require(_0x66c7('0x8'));var querystring=require('querystring');var Papa=require(_0x66c7('0xc'));var Redis=require(_0x66c7('0xd'));var qs=require(_0x66c7('0xe'));var logger=require(_0x66c7('0xf'))('api');var utils=require(_0x66c7('0x10'));var config=require(_0x66c7('0x11'));var db=require(_0x66c7('0x12'))['db'];function respondWithStatusCode(_0x187e00,_0x21fb64){_0x21fb64=_0x21fb64||0xcc;return function(_0x406e41){if(_0x406e41){return _0x187e00[_0x66c7('0x13')](_0x21fb64);}return _0x187e00['status'](_0x21fb64)[_0x66c7('0x14')]();};}function respondWithResult(_0x760e36,_0x35cbc2){_0x35cbc2=_0x35cbc2||0xc8;return function(_0xea3f56){if(_0xea3f56){return _0x760e36[_0x66c7('0x15')](_0x35cbc2)[_0x66c7('0x16')](_0xea3f56);}};}function respondWithFilteredResult(_0x618bd7,_0xf3b04){return function(_0x6400fe){if(_0x6400fe){var _0x5d44e1=_0x6400fe[_0x66c7('0x17')],_0x110f6d=_0xf3b04[_0x66c7('0x18')],_0x4dd902=_0xf3b04[_0x66c7('0x18')]+_0xf3b04[_0x66c7('0x19')],_0x208010;if(_0x4dd902>=_0x5d44e1){_0x4dd902=_0x5d44e1;_0x208010=0xc8;}else{_0x208010=0xce;}_0x618bd7['status'](_0x208010);return _0x618bd7['set']('Content-Range',_0x110f6d+'-'+_0x4dd902+'/'+_0x5d44e1)['json'](_0x6400fe);}return null;};}function patchUpdates(_0x8ad572){return function(_0x19f29d){try{jsonpatch['apply'](_0x19f29d,_0x8ad572,!![]);}catch(_0x524e87){return BPromise[_0x66c7('0x1a')](_0x524e87);}return _0x19f29d[_0x66c7('0x1b')]();};}function saveUpdates(_0x4756f7,_0x23578b){return function(_0x52437d){if(_0x52437d){return _0x52437d['update'](_0x4756f7)[_0x66c7('0x1c')](function(_0x237177){return _0x237177;});}return null;};}function removeEntity(_0xf30f9,_0x1c43c4){return function(_0x465457){if(_0x465457){return _0x465457[_0x66c7('0x1d')]()['then'](function(){_0xf30f9[_0x66c7('0x15')](0xcc)[_0x66c7('0x14')]();});}};}function handleEntityNotFound(_0x4a2b90,_0x7462f1){return function(_0x8b96b1){if(!_0x8b96b1){_0x4a2b90[_0x66c7('0x13')](0x194);}return _0x8b96b1;};}function handleError(_0x1fc9d3,_0x5bfaf6){_0x5bfaf6=_0x5bfaf6||0x1f4;return function(_0x2736df){logger[_0x66c7('0x1e')](_0x2736df['stack']);if(_0x2736df[_0x66c7('0x1f')]){delete _0x2736df[_0x66c7('0x1f')];}_0x1fc9d3[_0x66c7('0x15')](_0x5bfaf6)[_0x66c7('0x20')](_0x2736df);};}exports[_0x66c7('0x21')]=function(_0x54d45d,_0x5bc4e6){var _0x4e514a={},_0x2dd131={},_0x542ff1={'count':0x0,'rows':[]};var _0x5c5e42=db[_0x66c7('0x22')][_0x66c7('0x23')];_0x2dd131[_0x66c7('0x24')]=_[_0x66c7('0x25')](_0x5c5e42);var _0x36a830={'dateStart':_0x54d45d[_0x66c7('0x26')]['dateStart'],'dateEnd':_0x54d45d[_0x66c7('0x26')][_0x66c7('0x27')]};delete _0x54d45d[_0x66c7('0x26')][_0x66c7('0x28')];delete _0x54d45d[_0x66c7('0x26')]['dateEnd'];_0x2dd131[_0x66c7('0x26')]=_['keys'](_0x54d45d[_0x66c7('0x26')]);_0x2dd131['filters']=_[_0x66c7('0x29')](_0x2dd131[_0x66c7('0x24')],_0x2dd131[_0x66c7('0x26')]);_0x4e514a[_0x66c7('0x2a')]=_[_0x66c7('0x29')](_0x2dd131[_0x66c7('0x24')],qs['fields'](_0x54d45d['query'][_0x66c7('0x2b')]));_0x4e514a[_0x66c7('0x2a')]=_0x4e514a[_0x66c7('0x2a')][_0x66c7('0x2c')]?_0x4e514a[_0x66c7('0x2a')]:_0x2dd131[_0x66c7('0x24')];if(!_0x54d45d[_0x66c7('0x26')][_0x66c7('0x2d')](_0x66c7('0x2e'))){_0x4e514a[_0x66c7('0x19')]=qs[_0x66c7('0x19')](_0x54d45d[_0x66c7('0x26')]['limit']);_0x4e514a['offset']=qs[_0x66c7('0x18')](_0x54d45d[_0x66c7('0x26')][_0x66c7('0x18')]);}_0x4e514a[_0x66c7('0x2f')]=qs[_0x66c7('0x30')](_0x54d45d[_0x66c7('0x26')][_0x66c7('0x30')]);_0x4e514a['where']=qs[_0x66c7('0x31')](_[_0x66c7('0x32')](_0x54d45d[_0x66c7('0x26')],_0x2dd131[_0x66c7('0x31')]));if(_0x36a830[_0x66c7('0x28')]){if(_0x36a830[_0x66c7('0x27')]){_0x36a830[_0x66c7('0x27')]=moment(_0x36a830[_0x66c7('0x27')])[_0x66c7('0x33')](0x1,_0x66c7('0x34'));}else{_0x36a830[_0x66c7('0x27')]=moment(_0x36a830['dateStart'])['add'](0x1,_0x66c7('0x34'));}_[_0x66c7('0x35')](_0x4e514a[_0x66c7('0x36')],{'createdAt':{'$gte':_0x36a830['dateStart'],'$lte':_0x36a830['dateEnd']}});}if(_0x54d45d[_0x66c7('0x26')][_0x66c7('0x37')]){_0x4e514a['where']=_[_0x66c7('0x35')](_0x4e514a[_0x66c7('0x36')],{'$or':_[_0x66c7('0x38')](_0x4e514a['attributes'],function(_0x20374a){var _0x16b754={};_0x16b754[_0x20374a]={'$like':'%'+_0x54d45d[_0x66c7('0x26')][_0x66c7('0x37')]+'%'};return _0x16b754;})});}_0x4e514a=_[_0x66c7('0x35')]({},_0x4e514a,_0x54d45d[_0x66c7('0x39')]);var _0x21deb3={'where':_0x4e514a[_0x66c7('0x36')]};return db[_0x66c7('0x22')]['count'](_0x21deb3)[_0x66c7('0x1c')](function(_0x347cd1){_0x542ff1[_0x66c7('0x17')]=_0x347cd1;if(_0x54d45d[_0x66c7('0x26')][_0x66c7('0x3a')]){_0x4e514a[_0x66c7('0x3b')]=[{'all':!![]}];}return db[_0x66c7('0x22')][_0x66c7('0x3c')](_0x4e514a);})[_0x66c7('0x1c')](function(_0x3d371a){_0x542ff1['rows']=_0x3d371a;return _0x542ff1;})['then'](respondWithFilteredResult(_0x5bc4e6,_0x4e514a))['catch'](handleError(_0x5bc4e6,null));};exports[_0x66c7('0x3d')]=function(_0x1661e8,_0x5022a2){var _0x55d12e={'raw':!![],'where':{'id':_0x1661e8[_0x66c7('0x3e')]['id']}},_0x34d002={};_0x34d002[_0x66c7('0x24')]=_[_0x66c7('0x25')](db[_0x66c7('0x22')]['rawAttributes']);_0x34d002[_0x66c7('0x26')]=_['keys'](_0x1661e8['query']);_0x34d002[_0x66c7('0x31')]=_[_0x66c7('0x29')](_0x34d002[_0x66c7('0x24')],_0x34d002[_0x66c7('0x26')]);_0x55d12e['attributes']=_['intersection'](_0x34d002[_0x66c7('0x24')],qs['fields'](_0x1661e8['query'][_0x66c7('0x2b')]));_0x55d12e[_0x66c7('0x2a')]=_0x55d12e[_0x66c7('0x2a')][_0x66c7('0x2c')]?_0x55d12e['attributes']:_0x34d002[_0x66c7('0x24')];if(_0x1661e8[_0x66c7('0x26')][_0x66c7('0x3a')]){_0x55d12e['include']=[{'all':!![]}];}_0x55d12e=_[_0x66c7('0x35')]({},_0x55d12e,_0x1661e8[_0x66c7('0x39')]);return db[_0x66c7('0x22')][_0x66c7('0x3f')](_0x55d12e)[_0x66c7('0x1c')](handleEntityNotFound(_0x5022a2,null))[_0x66c7('0x1c')](respondWithResult(_0x5022a2,null))[_0x66c7('0x40')](handleError(_0x5022a2,null));};exports[_0x66c7('0x41')]=function(_0x50c0c8,_0x33fd6a){return db[_0x66c7('0x22')][_0x66c7('0x41')](_0x50c0c8[_0x66c7('0x42')],{})[_0x66c7('0x1c')](respondWithResult(_0x33fd6a,0xc9))[_0x66c7('0x40')](handleError(_0x33fd6a,null));};exports[_0x66c7('0x43')]=function(_0x12d063,_0x1b3dc2){if(_0x12d063[_0x66c7('0x42')]['id']){delete _0x12d063[_0x66c7('0x42')]['id'];}return db[_0x66c7('0x22')][_0x66c7('0x3f')]({'where':{'id':_0x12d063[_0x66c7('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1b3dc2,null))[_0x66c7('0x1c')](saveUpdates(_0x12d063[_0x66c7('0x42')],null))[_0x66c7('0x1c')](respondWithResult(_0x1b3dc2,null))[_0x66c7('0x40')](handleError(_0x1b3dc2,null));};exports['destroy']=function(_0x3d3448,_0x1a159f){return db['JscriptyQuestionReport'][_0x66c7('0x3f')]({'where':{'id':_0x3d3448[_0x66c7('0x3e')]['id']}})[_0x66c7('0x1c')](handleEntityNotFound(_0x1a159f,null))[_0x66c7('0x1c')](removeEntity(_0x1a159f,null))[_0x66c7('0x40')](handleError(_0x1a159f,null));};exports[_0x66c7('0x44')]=function(_0x1ed21e,_0x5cd4e9){return db[_0x66c7('0x22')][_0x66c7('0x44')]()['then'](respondWithResult(_0x5cd4e9,null))[_0x66c7('0x40')](handleError(_0x5cd4e9,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 9e90408..342158d 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 _0x969e=['define','JscriptyQuestionReport','lodash','util','api','moment','bluebird'];(function(_0x559cf1,_0x321b2){var _0x221c26=function(_0xfd3039){while(--_0xfd3039){_0x559cf1['push'](_0x559cf1['shift']());}};_0x221c26(++_0x321b2);}(_0x969e,0x136));var _0xe969=function(_0x3c310f,_0x553c78){_0x3c310f=_0x3c310f-0x0;var _0x533495=_0x969e[_0x3c310f];return _0x533495;};'use strict';var _=require(_0xe969('0x0'));var util=require(_0xe969('0x1'));var logger=require('../../config/logger')(_0xe969('0x2'));var moment=require(_0xe969('0x3'));var BPromise=require(_0xe969('0x4'));var rp=require('request-promise');var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x4235bf,_0x1aa327){return _0x4235bf[_0xe969('0x5')](_0xe969('0x6'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b8e=['../../config/logger','moment','bluebird','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util'];(function(_0x4e21ba,_0x18097f){var _0x55b94b=function(_0x3b9add){while(--_0x3b9add){_0x4e21ba['push'](_0x4e21ba['shift']());}};_0x55b94b(++_0x18097f);}(_0x1b8e,0x10c));var _0xe1b8=function(_0x1f60c6,_0x2f3477){_0x1f60c6=_0x1f60c6-0x0;var _0xc2e0c9=_0x1b8e[_0x1f60c6];return _0xc2e0c9;};'use strict';var _=require(_0xe1b8('0x0'));var util=require(_0xe1b8('0x1'));var logger=require(_0xe1b8('0x2'))('api');var moment=require(_0xe1b8('0x3'));var BPromise=require(_0xe1b8('0x4'));var rp=require('request-promise');var attributes=require(_0xe1b8('0x5'));module['exports']=function(_0x49f04c,_0x2e4ec8){return _0x49f04c[_0xe1b8('0x6')](_0xe1b8('0x7'),attributes,{'tableName':_0xe1b8('0x8'),'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 988331b..5467ccc 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 _0x4c1f=['moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x4396f0,_0x186c64){var _0x587e57=function(_0x43b3fd){while(--_0x43b3fd){_0x4396f0['push'](_0x4396f0['shift']());}};_0x587e57(++_0x186c64);}(_0x4c1f,0x12a));var _0xf4c1=function(_0x2059a4,_0x35b28f){_0x2059a4=_0x2059a4-0x0;var _0x328234=_0x4c1f[_0x2059a4];return _0x328234;};'use strict';var _=require('lodash');var util=require(_0xf4c1('0x0'));var moment=require(_0xf4c1('0x1'));var BPromise=require(_0xf4c1('0x2'));var rs=require(_0xf4c1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4c1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf4c1('0x5'))(_0xf4c1('0x6'));var config=require(_0xf4c1('0x7'));var jayson=require(_0xf4c1('0x8'));var client=jayson['client'][_0xf4c1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe3757d,_0x4f71c4,_0x2259e6){return new BPromise(function(_0x2a2538,_0xdb78){return client[_0xf4c1('0xa')](_0xe3757d,_0x2259e6)[_0xf4c1('0xb')](function(_0x39f65b){logger[_0xf4c1('0xc')](_0xf4c1('0xd'),_0x4f71c4,_0xf4c1('0xe'));logger[_0xf4c1('0xf')](_0xf4c1('0x10'),_0x4f71c4,_0xf4c1('0xe'),JSON[_0xf4c1('0x11')](_0x39f65b));if(_0x39f65b[_0xf4c1('0x12')]){if(_0x39f65b['error'][_0xf4c1('0x13')]===0x1f4){logger['error'](_0xf4c1('0xd'),_0x4f71c4,_0x39f65b['error'][_0xf4c1('0x14')]);return _0xdb78(_0x39f65b[_0xf4c1('0x12')][_0xf4c1('0x14')]);}logger['error'](_0xf4c1('0xd'),_0x4f71c4,_0x39f65b['error']['message']);return _0x2a2538(_0x39f65b[_0xf4c1('0x12')]['message']);}else{logger[_0xf4c1('0xc')](_0xf4c1('0xd'),_0x4f71c4,'request\x20sent');_0x2a2538(_0x39f65b[_0xf4c1('0x15')][_0xf4c1('0x14')]);}})[_0xf4c1('0x16')](function(_0x351cd6){logger[_0xf4c1('0x12')](_0xf4c1('0xd'),_0x4f71c4,_0x351cd6);_0xdb78(_0x351cd6);});});} \ No newline at end of file +var _0xec8d=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch'];(function(_0x657fa6,_0x27c3a2){var _0x362ab4=function(_0x47c58b){while(--_0x47c58b){_0x657fa6['push'](_0x657fa6['shift']());}};_0x362ab4(++_0x27c3a2);}(_0xec8d,0x142));var _0xdec8=function(_0x813d0a,_0x4fd3d7){_0x813d0a=_0x813d0a-0x0;var _0x241352=_0xec8d[_0x813d0a];return _0x241352;};'use strict';var _=require(_0xdec8('0x0'));var util=require(_0xdec8('0x1'));var moment=require('moment');var BPromise=require(_0xdec8('0x2'));var rs=require(_0xdec8('0x3'));var fs=require('fs');var Redis=require(_0xdec8('0x4'));var db=require(_0xdec8('0x5'))['db'];var utils=require(_0xdec8('0x6'));var logger=require(_0xdec8('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdec8('0x8'));var client=jayson[_0xdec8('0x9')][_0xdec8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ac716,_0x2beffb,_0x2a9eec){return new BPromise(function(_0x1f708e,_0x14c6cc){return client[_0xdec8('0xb')](_0x1ac716,_0x2a9eec)[_0xdec8('0xc')](function(_0x5ad0aa){logger['info'](_0xdec8('0xd'),_0x2beffb,_0xdec8('0xe'));logger[_0xdec8('0xf')](_0xdec8('0x10'),_0x2beffb,_0xdec8('0xe'),JSON[_0xdec8('0x11')](_0x5ad0aa));if(_0x5ad0aa[_0xdec8('0x12')]){if(_0x5ad0aa['error']['code']===0x1f4){logger[_0xdec8('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2beffb,_0x5ad0aa[_0xdec8('0x12')][_0xdec8('0x13')]);return _0x14c6cc(_0x5ad0aa[_0xdec8('0x12')][_0xdec8('0x13')]);}logger[_0xdec8('0x12')](_0xdec8('0xd'),_0x2beffb,_0x5ad0aa[_0xdec8('0x12')][_0xdec8('0x13')]);return _0x1f708e(_0x5ad0aa[_0xdec8('0x12')][_0xdec8('0x13')]);}else{logger[_0xdec8('0x14')](_0xdec8('0xd'),_0x2beffb,_0xdec8('0xe'));_0x1f708e(_0x5ad0aa[_0xdec8('0x15')][_0xdec8('0x13')]);}})[_0xdec8('0x16')](function(_0x201f96){logger['error'](_0xdec8('0xd'),_0x2beffb,_0x201f96);_0x14c6cc(_0x201f96);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index cd20401..28a8334 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 _0x387c=['/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','index','isAuthenticated','describe','/:id','show'];(function(_0x596f6e,_0x3f8857){var _0x1e0803=function(_0x31f91f){while(--_0x31f91f){_0x596f6e['push'](_0x596f6e['shift']());}};_0x1e0803(++_0x3f8857);}(_0x387c,0x111));var _0xc387=function(_0x188d31,_0x576e87){_0x188d31=_0x188d31-0x0;var _0x30ed33=_0x387c[_0x188d31];return _0x30ed33;};'use strict';var multer=require(_0xc387('0x0'));var util=require('util');var path=require(_0xc387('0x1'));var timeout=require(_0xc387('0x2'));var express=require(_0xc387('0x3'));var router=express[_0xc387('0x4')]();var auth=require(_0xc387('0x5'));var interaction=require(_0xc387('0x6'));var config=require(_0xc387('0x7'));var controller=require(_0xc387('0x8'));router[_0xc387('0x9')]('/',auth['isAuthenticated'](),controller[_0xc387('0xa')]);router['get']('/describe',auth[_0xc387('0xb')](),controller[_0xc387('0xc')]);router[_0xc387('0x9')](_0xc387('0xd'),auth[_0xc387('0xb')](),controller[_0xc387('0xe')]);router[_0xc387('0x9')](_0xc387('0xf'),auth[_0xc387('0xb')](),controller[_0xc387('0x10')]);router[_0xc387('0x11')]('/',auth[_0xc387('0xb')](),controller[_0xc387('0x12')]);router[_0xc387('0x13')]('/:id',auth[_0xc387('0xb')](),controller[_0xc387('0x14')]);router[_0xc387('0x15')](_0xc387('0xd'),auth[_0xc387('0xb')](),controller[_0xc387('0x16')]);module[_0xc387('0x17')]=router; \ No newline at end of file +var _0x85ab=['multer','path','Router','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports'];(function(_0x4c1883,_0x35404f){var _0x395e39=function(_0x582979){while(--_0x582979){_0x4c1883['push'](_0x4c1883['shift']());}};_0x395e39(++_0x35404f);}(_0x85ab,0x17c));var _0xb85a=function(_0x1c16a4,_0xbba97c){_0x1c16a4=_0x1c16a4-0x0;var _0xa47eb7=_0x85ab[_0x1c16a4];return _0xa47eb7;};'use strict';var multer=require(_0xb85a('0x0'));var util=require('util');var path=require(_0xb85a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb85a('0x2')]();var auth=require(_0xb85a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xb85a('0x4'));var controller=require(_0xb85a('0x5'));router[_0xb85a('0x6')]('/',auth[_0xb85a('0x7')](),controller['index']);router[_0xb85a('0x6')](_0xb85a('0x8'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xb85a('0x9'),auth[_0xb85a('0x7')](),controller[_0xb85a('0xa')]);router['get'](_0xb85a('0xb'),auth[_0xb85a('0x7')](),controller[_0xb85a('0xc')]);router[_0xb85a('0xd')]('/',auth[_0xb85a('0x7')](),controller[_0xb85a('0xe')]);router[_0xb85a('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xb85a('0x10')]);router[_0xb85a('0x11')](_0xb85a('0x9'),auth['isAuthenticated'](),controller[_0xb85a('0x12')]);module[_0xb85a('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 5edf39d..d786832 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 _0xe6c4=['format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','setDataValue','starttime'];(function(_0x282442,_0x185644){var _0x244748=function(_0x10a419){while(--_0x10a419){_0x282442['push'](_0x282442['shift']());}};_0x244748(++_0x185644);}(_0xe6c4,0x1dc));var _0x4e6c=function(_0x289614,_0xfd795f){_0x289614=_0x289614-0x0;var _0x1e8e77=_0xe6c4[_0x289614];return _0x1e8e77;};'use strict';var moment=require(_0x4e6c('0x0'));var Sequelize=require(_0x4e6c('0x1'));module['exports']={'starttime':{'type':Sequelize['DATE'],'set':function(_0x5aae38){this[_0x4e6c('0x2')](_0x4e6c('0x3'),_0x5aae38);this[_0x4e6c('0x2')]('endtime',moment()[_0x4e6c('0x4')](_0x4e6c('0x5')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4e6c('0x6')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x4e6c('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x9101=['endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','DATE','setDataValue'];(function(_0x47a802,_0x424bf1){var _0xb3badc=function(_0x5f44d3){while(--_0x5f44d3){_0x47a802['push'](_0x47a802['shift']());}};_0xb3badc(++_0x424bf1);}(_0x9101,0x9c));var _0x1910=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x9101[_0x59ee6f];return _0x4c0979;};'use strict';var moment=require(_0x1910('0x0'));var Sequelize=require(_0x1910('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x1910('0x2')],'set':function(_0x2f0ff3){this[_0x1910('0x3')]('starttime',_0x2f0ff3);this['setDataValue'](_0x1910('0x4'),moment()['format'](_0x1910('0x5')));}},'endtime':{'type':Sequelize[_0x1910('0x2')]},'membername':{'type':Sequelize[_0x1910('0x6')]},'projectname':{'type':Sequelize[_0x1910('0x6')]},'queue':{'type':Sequelize[_0x1910('0x6')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x1910('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x1910('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 3bd9c89..a1ebc92 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 _0x3e14=['create','body','getQuestions','findOne','JscriptyQuestionReport','nolimit','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','../../config/utils','end','status','json','count','offset','set','Content-Range','apply','reject','update','destroy','then','sendStatus','name','send','index','JscriptySessionReport','rawAttributes','keys','query','dateEnd','dateStart','intersection','model','attributes','length','hasOwnProperty','limit','sort','where','filters','pick','add','day','filter','merge','options','include','findAll','rows','catch','show','params','fields','includeAll','find'];(function(_0x30d54a,_0x2399b4){var _0x383ece=function(_0xc77f95){while(--_0xc77f95){_0x30d54a['push'](_0x30d54a['shift']());}};_0x383ece(++_0x2399b4);}(_0x3e14,0x1f0));var _0x43e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e14[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x43e1('0x0'));var emlformat=require(_0x43e1('0x1'));var rimraf=require(_0x43e1('0x2'));var zipdir=require(_0x43e1('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x43e1('0x4'));var moment=require(_0x43e1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x43e1('0x6'));var util=require('util');var path=require(_0x43e1('0x7'));var sox=require('sox');var csv=require(_0x43e1('0x8'));var ejs=require(_0x43e1('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x43e1('0xa'));var crypto=require(_0x43e1('0xb'));var jsforce=require(_0x43e1('0xc'));var deskjs=require(_0x43e1('0xd'));var toCsv=require(_0x43e1('0x8'));var querystring=require(_0x43e1('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var qs=require(_0x43e1('0xf'));var logger=require(_0x43e1('0x10'))('api');var utils=require(_0x43e1('0x11'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c9fa5,_0x393736){_0x393736=_0x393736||0xcc;return function(_0x4aa8b5){if(_0x4aa8b5){return _0x5c9fa5['sendStatus'](_0x393736);}return _0x5c9fa5['status'](_0x393736)[_0x43e1('0x12')]();};}function respondWithResult(_0x2e6a41,_0x2f0eb2){_0x2f0eb2=_0x2f0eb2||0xc8;return function(_0x338e5b){if(_0x338e5b){return _0x2e6a41[_0x43e1('0x13')](_0x2f0eb2)[_0x43e1('0x14')](_0x338e5b);}};}function respondWithFilteredResult(_0x546b3e,_0x44c5d4){return function(_0x201218){if(_0x201218){var _0x14cbd6=_0x201218[_0x43e1('0x15')],_0x13a1c0=_0x44c5d4[_0x43e1('0x16')],_0x41707d=_0x44c5d4[_0x43e1('0x16')]+_0x44c5d4['limit'],_0x4dd966;if(_0x41707d>=_0x14cbd6){_0x41707d=_0x14cbd6;_0x4dd966=0xc8;}else{_0x4dd966=0xce;}_0x546b3e[_0x43e1('0x13')](_0x4dd966);return _0x546b3e[_0x43e1('0x17')](_0x43e1('0x18'),_0x13a1c0+'-'+_0x41707d+'/'+_0x14cbd6)[_0x43e1('0x14')](_0x201218);}return null;};}function patchUpdates(_0x555713){return function(_0x4ae4c5){try{jsonpatch[_0x43e1('0x19')](_0x4ae4c5,_0x555713,!![]);}catch(_0x149b72){return BPromise[_0x43e1('0x1a')](_0x149b72);}return _0x4ae4c5['save']();};}function saveUpdates(_0x3b1a20,_0x38a22a){return function(_0x1904b2){if(_0x1904b2){return _0x1904b2[_0x43e1('0x1b')](_0x3b1a20)['then'](function(_0x313fc6){return _0x313fc6;});}return null;};}function removeEntity(_0x7b9d6b,_0x14254c){return function(_0x499043){if(_0x499043){return _0x499043[_0x43e1('0x1c')]()[_0x43e1('0x1d')](function(){_0x7b9d6b[_0x43e1('0x13')](0xcc)[_0x43e1('0x12')]();});}};}function handleEntityNotFound(_0x48c668,_0x2b8309){return function(_0x57035b){if(!_0x57035b){_0x48c668[_0x43e1('0x1e')](0x194);}return _0x57035b;};}function handleError(_0x544bd4,_0x235c52){_0x235c52=_0x235c52||0x1f4;return function(_0x61dde3){logger['error'](_0x61dde3['stack']);if(_0x61dde3['name']){delete _0x61dde3[_0x43e1('0x1f')];}_0x544bd4[_0x43e1('0x13')](_0x235c52)[_0x43e1('0x20')](_0x61dde3);};}exports[_0x43e1('0x21')]=function(_0x3f42dd,_0xbbdf29){var _0x28192e={},_0x2ef2a2={},_0x1c5132={'count':0x0,'rows':[]};var _0x53e2cf=db[_0x43e1('0x22')][_0x43e1('0x23')];_0x2ef2a2['model']=_[_0x43e1('0x24')](_0x53e2cf);var _0x5bc80b={'dateStart':_0x3f42dd[_0x43e1('0x25')]['dateStart'],'dateEnd':_0x3f42dd['query'][_0x43e1('0x26')]};delete _0x3f42dd['query'][_0x43e1('0x27')];delete _0x3f42dd[_0x43e1('0x25')][_0x43e1('0x26')];_0x2ef2a2[_0x43e1('0x25')]=_[_0x43e1('0x24')](_0x3f42dd[_0x43e1('0x25')]);_0x2ef2a2['filters']=_[_0x43e1('0x28')](_0x2ef2a2[_0x43e1('0x29')],_0x2ef2a2[_0x43e1('0x25')]);_0x28192e[_0x43e1('0x2a')]=_['intersection'](_0x2ef2a2[_0x43e1('0x29')],qs['fields'](_0x3f42dd[_0x43e1('0x25')]['fields']));_0x28192e[_0x43e1('0x2a')]=_0x28192e[_0x43e1('0x2a')][_0x43e1('0x2b')]?_0x28192e[_0x43e1('0x2a')]:_0x2ef2a2[_0x43e1('0x29')];if(!_0x3f42dd[_0x43e1('0x25')][_0x43e1('0x2c')]('nolimit')){_0x28192e[_0x43e1('0x2d')]=qs[_0x43e1('0x2d')](_0x3f42dd[_0x43e1('0x25')][_0x43e1('0x2d')]);_0x28192e['offset']=qs[_0x43e1('0x16')](_0x3f42dd[_0x43e1('0x25')][_0x43e1('0x16')]);}_0x28192e['order']=qs[_0x43e1('0x2e')](_0x3f42dd[_0x43e1('0x25')][_0x43e1('0x2e')]);_0x28192e[_0x43e1('0x2f')]=qs[_0x43e1('0x30')](_[_0x43e1('0x31')](_0x3f42dd[_0x43e1('0x25')],_0x2ef2a2[_0x43e1('0x30')]));if(_0x5bc80b['dateStart']){if(_0x5bc80b[_0x43e1('0x26')]){_0x5bc80b[_0x43e1('0x26')]=moment(_0x5bc80b[_0x43e1('0x26')])[_0x43e1('0x32')](0x1,_0x43e1('0x33'));}else{_0x5bc80b[_0x43e1('0x26')]=moment(_0x5bc80b[_0x43e1('0x27')])[_0x43e1('0x32')](0x1,_0x43e1('0x33'));}_['merge'](_0x28192e[_0x43e1('0x2f')],{'createdAt':{'$gte':_0x5bc80b[_0x43e1('0x27')],'$lte':_0x5bc80b[_0x43e1('0x26')]}});}if(_0x3f42dd['query'][_0x43e1('0x34')]){_0x28192e[_0x43e1('0x2f')]=_[_0x43e1('0x35')](_0x28192e[_0x43e1('0x2f')],{'$or':_['map'](_0x28192e[_0x43e1('0x2a')],function(_0x2f2328){var _0x2d5125={};_0x2d5125[_0x2f2328]={'$like':'%'+_0x3f42dd[_0x43e1('0x25')][_0x43e1('0x34')]+'%'};return _0x2d5125;})});}_0x28192e=_[_0x43e1('0x35')]({},_0x28192e,_0x3f42dd[_0x43e1('0x36')]);var _0x423767={'where':_0x28192e[_0x43e1('0x2f')]};return db[_0x43e1('0x22')][_0x43e1('0x15')](_0x423767)[_0x43e1('0x1d')](function(_0x5da71a){_0x1c5132['count']=_0x5da71a;if(_0x3f42dd[_0x43e1('0x25')]['includeAll']){_0x28192e[_0x43e1('0x37')]=[{'all':!![]}];}return db[_0x43e1('0x22')][_0x43e1('0x38')](_0x28192e);})[_0x43e1('0x1d')](function(_0x40d66d){_0x1c5132[_0x43e1('0x39')]=_0x40d66d;return _0x1c5132;})['then'](respondWithFilteredResult(_0xbbdf29,_0x28192e))[_0x43e1('0x3a')](handleError(_0xbbdf29,null));};exports[_0x43e1('0x3b')]=function(_0x39d5e7,_0x36a831){var _0x30f881={'raw':!![],'where':{'id':_0x39d5e7[_0x43e1('0x3c')]['id']}},_0x4af52f={};_0x4af52f[_0x43e1('0x29')]=_['keys'](db[_0x43e1('0x22')][_0x43e1('0x23')]);_0x4af52f['query']=_[_0x43e1('0x24')](_0x39d5e7['query']);_0x4af52f[_0x43e1('0x30')]=_[_0x43e1('0x28')](_0x4af52f[_0x43e1('0x29')],_0x4af52f[_0x43e1('0x25')]);_0x30f881[_0x43e1('0x2a')]=_[_0x43e1('0x28')](_0x4af52f[_0x43e1('0x29')],qs[_0x43e1('0x3d')](_0x39d5e7[_0x43e1('0x25')]['fields']));_0x30f881[_0x43e1('0x2a')]=_0x30f881[_0x43e1('0x2a')]['length']?_0x30f881[_0x43e1('0x2a')]:_0x4af52f[_0x43e1('0x29')];if(_0x39d5e7[_0x43e1('0x25')][_0x43e1('0x3e')]){_0x30f881[_0x43e1('0x37')]=[{'all':!![]}];}_0x30f881=_['merge']({},_0x30f881,_0x39d5e7[_0x43e1('0x36')]);return db['JscriptySessionReport'][_0x43e1('0x3f')](_0x30f881)[_0x43e1('0x1d')](handleEntityNotFound(_0x36a831,null))[_0x43e1('0x1d')](respondWithResult(_0x36a831,null))[_0x43e1('0x3a')](handleError(_0x36a831,null));};exports[_0x43e1('0x40')]=function(_0x18dfac,_0x491f24){return db[_0x43e1('0x22')]['create'](_0x18dfac[_0x43e1('0x41')],{})[_0x43e1('0x1d')](respondWithResult(_0x491f24,0xc9))[_0x43e1('0x3a')](handleError(_0x491f24,null));};exports[_0x43e1('0x1b')]=function(_0x3fc2b,_0x29e94e){if(_0x3fc2b[_0x43e1('0x41')]['id']){delete _0x3fc2b[_0x43e1('0x41')]['id'];}return db[_0x43e1('0x22')][_0x43e1('0x3f')]({'where':{'id':_0x3fc2b[_0x43e1('0x3c')]['id']}})[_0x43e1('0x1d')](handleEntityNotFound(_0x29e94e,null))[_0x43e1('0x1d')](saveUpdates(_0x3fc2b['body'],null))[_0x43e1('0x1d')](respondWithResult(_0x29e94e,null))[_0x43e1('0x3a')](handleError(_0x29e94e,null));};exports[_0x43e1('0x1c')]=function(_0x4e2113,_0x4f664f){return db['JscriptySessionReport']['find']({'where':{'id':_0x4e2113[_0x43e1('0x3c')]['id']}})[_0x43e1('0x1d')](handleEntityNotFound(_0x4f664f,null))['then'](removeEntity(_0x4f664f,null))[_0x43e1('0x3a')](handleError(_0x4f664f,null));};exports['describe']=function(_0xcd346e,_0x34bfee){return db[_0x43e1('0x22')]['describe']()['then'](respondWithResult(_0x34bfee,null))[_0x43e1('0x3a')](handleError(_0x34bfee,null));};exports[_0x43e1('0x42')]=function(_0xa42770,_0x3729e3,_0x1e1270){var _0x40b15d={'raw':!![],'where':{}};var _0x5c2f6c={};var _0x5e53b5={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x43e1('0x43')]({'where':{'id':_0xa42770[_0x43e1('0x3c')]['id']}})[_0x43e1('0x1d')](handleEntityNotFound(_0x3729e3,null))['then'](function(_0x185557){if(_0x185557){_0x5c2f6c[_0x43e1('0x29')]=_[_0x43e1('0x24')](db[_0x43e1('0x44')][_0x43e1('0x23')]);_0x5c2f6c[_0x43e1('0x25')]=_[_0x43e1('0x24')](_0xa42770[_0x43e1('0x25')]);_0x5c2f6c[_0x43e1('0x30')]=_[_0x43e1('0x28')](_0x5c2f6c[_0x43e1('0x29')],_0x5c2f6c[_0x43e1('0x25')]);_0x40b15d['attributes']=_[_0x43e1('0x28')](_0x5c2f6c[_0x43e1('0x29')],qs[_0x43e1('0x3d')](_0xa42770[_0x43e1('0x25')][_0x43e1('0x3d')]));_0x40b15d[_0x43e1('0x2a')]=_0x40b15d[_0x43e1('0x2a')][_0x43e1('0x2b')]?_0x40b15d['attributes']:_0x5c2f6c[_0x43e1('0x29')];if(!_0xa42770[_0x43e1('0x25')]['hasOwnProperty'](_0x43e1('0x45'))){_0x40b15d[_0x43e1('0x2d')]=qs[_0x43e1('0x2d')](_0xa42770[_0x43e1('0x25')][_0x43e1('0x2d')]);_0x40b15d[_0x43e1('0x16')]=qs[_0x43e1('0x16')](_0xa42770[_0x43e1('0x25')][_0x43e1('0x16')]);}_0x40b15d['order']=qs[_0x43e1('0x2e')](_0xa42770['query'][_0x43e1('0x2e')]);_0x40b15d['where']=qs[_0x43e1('0x30')](_[_0x43e1('0x31')](_0xa42770['query'],_0x5c2f6c[_0x43e1('0x30')]));_0x40b15d['where']['SessionId']=_0x185557['id'];if(_0xa42770['query'][_0x43e1('0x34')]){_0x40b15d[_0x43e1('0x2f')]=_[_0x43e1('0x35')](_0x40b15d[_0x43e1('0x2f')],{'$or':_['map'](_0x40b15d[_0x43e1('0x2a')],function(_0x24b13a){var _0x31aa1f={};_0x31aa1f[_0x24b13a]={'$like':'%'+_0xa42770['query'][_0x43e1('0x34')]+'%'};return _0x31aa1f;})});}_0x40b15d=_[_0x43e1('0x35')]({},_0x40b15d,_0xa42770['options']);return db['JscriptyQuestionReport'][_0x43e1('0x15')]({'where':_0x40b15d['where']})[_0x43e1('0x1d')](function(_0x2041d4){_0x5e53b5[_0x43e1('0x15')]=_0x2041d4;if(_0xa42770[_0x43e1('0x25')][_0x43e1('0x3e')]){_0x40b15d[_0x43e1('0x37')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x43e1('0x38')](_0x40b15d);})[_0x43e1('0x1d')](function(_0x70e322){_0x5e53b5['rows']=_0x70e322;return _0x5e53b5;});}})['then'](respondWithFilteredResult(_0x3729e3,_0x40b15d))['catch'](handleError(_0x3729e3,null));}; \ No newline at end of file +var _0xdf47=['getQuestions','findOne','JscriptyQuestionReport','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','error','name','JscriptySessionReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','day','add','merge','where','map','filter','options','includeAll','include','findAll','rows','catch','show','params','body','find','describe'];(function(_0x5a99db,_0x1cece5){var _0x3aad62=function(_0x334cb7){while(--_0x334cb7){_0x5a99db['push'](_0x5a99db['shift']());}};_0x3aad62(++_0x1cece5);}(_0xdf47,0xe2));var _0x7df4=function(_0x396b68,_0x51ba2d){_0x396b68=_0x396b68-0x0;var _0x2a5b2f=_0xdf47[_0x396b68];return _0x2a5b2f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7df4('0x0'));var rimraf=require(_0x7df4('0x1'));var zipdir=require(_0x7df4('0x2'));var jsonpatch=require(_0x7df4('0x3'));var rp=require(_0x7df4('0x4'));var moment=require(_0x7df4('0x5'));var BPromise=require(_0x7df4('0x6'));var Mustache=require('mustache');var util=require(_0x7df4('0x7'));var path=require(_0x7df4('0x8'));var sox=require(_0x7df4('0x9'));var csv=require(_0x7df4('0xa'));var ejs=require(_0x7df4('0xb'));var fs=require('fs');var _=require(_0x7df4('0xc'));var squel=require(_0x7df4('0xd'));var crypto=require('crypto');var jsforce=require(_0x7df4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7df4('0xa'));var querystring=require(_0x7df4('0xf'));var Papa=require(_0x7df4('0x10'));var Redis=require(_0x7df4('0x11'));var qs=require('../../components/parsers/qs');var logger=require(_0x7df4('0x12'))(_0x7df4('0x13'));var utils=require('../../config/utils');var config=require(_0x7df4('0x14'));var db=require(_0x7df4('0x15'))['db'];function respondWithStatusCode(_0x3e9bda,_0x3dc447){_0x3dc447=_0x3dc447||0xcc;return function(_0x545878){if(_0x545878){return _0x3e9bda[_0x7df4('0x16')](_0x3dc447);}return _0x3e9bda[_0x7df4('0x17')](_0x3dc447)[_0x7df4('0x18')]();};}function respondWithResult(_0x274752,_0x185939){_0x185939=_0x185939||0xc8;return function(_0x3ffd97){if(_0x3ffd97){return _0x274752[_0x7df4('0x17')](_0x185939)[_0x7df4('0x19')](_0x3ffd97);}};}function respondWithFilteredResult(_0x14be51,_0x182e60){return function(_0x8595bf){if(_0x8595bf){var _0x1b36b3=_0x8595bf[_0x7df4('0x1a')],_0x2c8755=_0x182e60[_0x7df4('0x1b')],_0x559f3d=_0x182e60[_0x7df4('0x1b')]+_0x182e60[_0x7df4('0x1c')],_0x1d6a08;if(_0x559f3d>=_0x1b36b3){_0x559f3d=_0x1b36b3;_0x1d6a08=0xc8;}else{_0x1d6a08=0xce;}_0x14be51[_0x7df4('0x17')](_0x1d6a08);return _0x14be51['set'](_0x7df4('0x1d'),_0x2c8755+'-'+_0x559f3d+'/'+_0x1b36b3)[_0x7df4('0x19')](_0x8595bf);}return null;};}function patchUpdates(_0x23964c){return function(_0x174f94){try{jsonpatch['apply'](_0x174f94,_0x23964c,!![]);}catch(_0x5de5d6){return BPromise[_0x7df4('0x1e')](_0x5de5d6);}return _0x174f94[_0x7df4('0x1f')]();};}function saveUpdates(_0x104bce,_0x299564){return function(_0x24f7de){if(_0x24f7de){return _0x24f7de[_0x7df4('0x20')](_0x104bce)[_0x7df4('0x21')](function(_0x43f39b){return _0x43f39b;});}return null;};}function removeEntity(_0x5219f2,_0x1cb7e9){return function(_0x974d89){if(_0x974d89){return _0x974d89[_0x7df4('0x22')]()[_0x7df4('0x21')](function(){_0x5219f2[_0x7df4('0x17')](0xcc)[_0x7df4('0x18')]();});}};}function handleEntityNotFound(_0x59810a,_0x5ad14d){return function(_0xcf5ad8){if(!_0xcf5ad8){_0x59810a['sendStatus'](0x194);}return _0xcf5ad8;};}function handleError(_0x3e1d38,_0x3a974f){_0x3a974f=_0x3a974f||0x1f4;return function(_0x7f6947){logger[_0x7df4('0x23')](_0x7f6947['stack']);if(_0x7f6947[_0x7df4('0x24')]){delete _0x7f6947[_0x7df4('0x24')];}_0x3e1d38[_0x7df4('0x17')](_0x3a974f)['send'](_0x7f6947);};}exports['index']=function(_0x1f9060,_0x3a54f8){var _0x3a2741={},_0xe666e5={},_0x5e2e6={'count':0x0,'rows':[]};var _0x11e684=db[_0x7df4('0x25')][_0x7df4('0x26')];_0xe666e5[_0x7df4('0x27')]=_[_0x7df4('0x28')](_0x11e684);var _0x251e8c={'dateStart':_0x1f9060[_0x7df4('0x29')][_0x7df4('0x2a')],'dateEnd':_0x1f9060[_0x7df4('0x29')]['dateEnd']};delete _0x1f9060[_0x7df4('0x29')][_0x7df4('0x2a')];delete _0x1f9060['query'][_0x7df4('0x2b')];_0xe666e5[_0x7df4('0x29')]=_[_0x7df4('0x28')](_0x1f9060['query']);_0xe666e5[_0x7df4('0x2c')]=_[_0x7df4('0x2d')](_0xe666e5[_0x7df4('0x27')],_0xe666e5[_0x7df4('0x29')]);_0x3a2741[_0x7df4('0x2e')]=_[_0x7df4('0x2d')](_0xe666e5['model'],qs[_0x7df4('0x2f')](_0x1f9060[_0x7df4('0x29')][_0x7df4('0x2f')]));_0x3a2741[_0x7df4('0x2e')]=_0x3a2741[_0x7df4('0x2e')][_0x7df4('0x30')]?_0x3a2741[_0x7df4('0x2e')]:_0xe666e5[_0x7df4('0x27')];if(!_0x1f9060['query'][_0x7df4('0x31')](_0x7df4('0x32'))){_0x3a2741[_0x7df4('0x1c')]=qs['limit'](_0x1f9060[_0x7df4('0x29')][_0x7df4('0x1c')]);_0x3a2741['offset']=qs['offset'](_0x1f9060[_0x7df4('0x29')][_0x7df4('0x1b')]);}_0x3a2741[_0x7df4('0x33')]=qs[_0x7df4('0x34')](_0x1f9060[_0x7df4('0x29')][_0x7df4('0x34')]);_0x3a2741['where']=qs['filters'](_['pick'](_0x1f9060[_0x7df4('0x29')],_0xe666e5[_0x7df4('0x2c')]));if(_0x251e8c['dateStart']){if(_0x251e8c[_0x7df4('0x2b')]){_0x251e8c[_0x7df4('0x2b')]=moment(_0x251e8c[_0x7df4('0x2b')])['add'](0x1,_0x7df4('0x35'));}else{_0x251e8c[_0x7df4('0x2b')]=moment(_0x251e8c[_0x7df4('0x2a')])[_0x7df4('0x36')](0x1,_0x7df4('0x35'));}_[_0x7df4('0x37')](_0x3a2741[_0x7df4('0x38')],{'createdAt':{'$gte':_0x251e8c[_0x7df4('0x2a')],'$lte':_0x251e8c[_0x7df4('0x2b')]}});}if(_0x1f9060['query']['filter']){_0x3a2741[_0x7df4('0x38')]=_[_0x7df4('0x37')](_0x3a2741[_0x7df4('0x38')],{'$or':_[_0x7df4('0x39')](_0x3a2741[_0x7df4('0x2e')],function(_0x5bc8b5){var _0x1efd9a={};_0x1efd9a[_0x5bc8b5]={'$like':'%'+_0x1f9060[_0x7df4('0x29')][_0x7df4('0x3a')]+'%'};return _0x1efd9a;})});}_0x3a2741=_[_0x7df4('0x37')]({},_0x3a2741,_0x1f9060[_0x7df4('0x3b')]);var _0x4f595f={'where':_0x3a2741[_0x7df4('0x38')]};return db[_0x7df4('0x25')][_0x7df4('0x1a')](_0x4f595f)['then'](function(_0x5cb534){_0x5e2e6[_0x7df4('0x1a')]=_0x5cb534;if(_0x1f9060[_0x7df4('0x29')][_0x7df4('0x3c')]){_0x3a2741[_0x7df4('0x3d')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x7df4('0x3e')](_0x3a2741);})[_0x7df4('0x21')](function(_0x1b549e){_0x5e2e6[_0x7df4('0x3f')]=_0x1b549e;return _0x5e2e6;})[_0x7df4('0x21')](respondWithFilteredResult(_0x3a54f8,_0x3a2741))[_0x7df4('0x40')](handleError(_0x3a54f8,null));};exports[_0x7df4('0x41')]=function(_0x1865e4,_0x2e057e){var _0x2b0a06={'raw':!![],'where':{'id':_0x1865e4[_0x7df4('0x42')]['id']}},_0x4d49bf={};_0x4d49bf[_0x7df4('0x27')]=_['keys'](db[_0x7df4('0x25')][_0x7df4('0x26')]);_0x4d49bf[_0x7df4('0x29')]=_[_0x7df4('0x28')](_0x1865e4[_0x7df4('0x29')]);_0x4d49bf[_0x7df4('0x2c')]=_[_0x7df4('0x2d')](_0x4d49bf[_0x7df4('0x27')],_0x4d49bf['query']);_0x2b0a06[_0x7df4('0x2e')]=_[_0x7df4('0x2d')](_0x4d49bf[_0x7df4('0x27')],qs[_0x7df4('0x2f')](_0x1865e4[_0x7df4('0x29')][_0x7df4('0x2f')]));_0x2b0a06[_0x7df4('0x2e')]=_0x2b0a06[_0x7df4('0x2e')][_0x7df4('0x30')]?_0x2b0a06[_0x7df4('0x2e')]:_0x4d49bf[_0x7df4('0x27')];if(_0x1865e4['query'][_0x7df4('0x3c')]){_0x2b0a06[_0x7df4('0x3d')]=[{'all':!![]}];}_0x2b0a06=_['merge']({},_0x2b0a06,_0x1865e4[_0x7df4('0x3b')]);return db[_0x7df4('0x25')]['find'](_0x2b0a06)[_0x7df4('0x21')](handleEntityNotFound(_0x2e057e,null))[_0x7df4('0x21')](respondWithResult(_0x2e057e,null))[_0x7df4('0x40')](handleError(_0x2e057e,null));};exports['create']=function(_0x5b0c14,_0x15aa3d){return db[_0x7df4('0x25')]['create'](_0x5b0c14['body'],{})[_0x7df4('0x21')](respondWithResult(_0x15aa3d,0xc9))[_0x7df4('0x40')](handleError(_0x15aa3d,null));};exports[_0x7df4('0x20')]=function(_0xa8bbae,_0x919840){if(_0xa8bbae[_0x7df4('0x43')]['id']){delete _0xa8bbae['body']['id'];}return db[_0x7df4('0x25')]['find']({'where':{'id':_0xa8bbae['params']['id']}})[_0x7df4('0x21')](handleEntityNotFound(_0x919840,null))[_0x7df4('0x21')](saveUpdates(_0xa8bbae[_0x7df4('0x43')],null))['then'](respondWithResult(_0x919840,null))[_0x7df4('0x40')](handleError(_0x919840,null));};exports[_0x7df4('0x22')]=function(_0x478ca3,_0xd72063){return db[_0x7df4('0x25')][_0x7df4('0x44')]({'where':{'id':_0x478ca3['params']['id']}})[_0x7df4('0x21')](handleEntityNotFound(_0xd72063,null))[_0x7df4('0x21')](removeEntity(_0xd72063,null))[_0x7df4('0x40')](handleError(_0xd72063,null));};exports[_0x7df4('0x45')]=function(_0x5a4dd9,_0x1e7bc1){return db[_0x7df4('0x25')]['describe']()[_0x7df4('0x21')](respondWithResult(_0x1e7bc1,null))['catch'](handleError(_0x1e7bc1,null));};exports[_0x7df4('0x46')]=function(_0x18d92c,_0x2b8d8f,_0x12166c){var _0x7a6d01={'raw':!![],'where':{}};var _0x25b94b={};var _0x544d02={'count':0x0,'rows':[]};return db[_0x7df4('0x25')][_0x7df4('0x47')]({'where':{'id':_0x18d92c[_0x7df4('0x42')]['id']}})['then'](handleEntityNotFound(_0x2b8d8f,null))[_0x7df4('0x21')](function(_0x1cc0b9){if(_0x1cc0b9){_0x25b94b[_0x7df4('0x27')]=_[_0x7df4('0x28')](db[_0x7df4('0x48')]['rawAttributes']);_0x25b94b[_0x7df4('0x29')]=_['keys'](_0x18d92c[_0x7df4('0x29')]);_0x25b94b[_0x7df4('0x2c')]=_['intersection'](_0x25b94b[_0x7df4('0x27')],_0x25b94b[_0x7df4('0x29')]);_0x7a6d01[_0x7df4('0x2e')]=_[_0x7df4('0x2d')](_0x25b94b['model'],qs['fields'](_0x18d92c[_0x7df4('0x29')][_0x7df4('0x2f')]));_0x7a6d01['attributes']=_0x7a6d01[_0x7df4('0x2e')][_0x7df4('0x30')]?_0x7a6d01['attributes']:_0x25b94b[_0x7df4('0x27')];if(!_0x18d92c[_0x7df4('0x29')][_0x7df4('0x31')](_0x7df4('0x32'))){_0x7a6d01[_0x7df4('0x1c')]=qs[_0x7df4('0x1c')](_0x18d92c['query'][_0x7df4('0x1c')]);_0x7a6d01[_0x7df4('0x1b')]=qs['offset'](_0x18d92c[_0x7df4('0x29')][_0x7df4('0x1b')]);}_0x7a6d01[_0x7df4('0x33')]=qs[_0x7df4('0x34')](_0x18d92c[_0x7df4('0x29')]['sort']);_0x7a6d01[_0x7df4('0x38')]=qs['filters'](_['pick'](_0x18d92c[_0x7df4('0x29')],_0x25b94b[_0x7df4('0x2c')]));_0x7a6d01['where'][_0x7df4('0x49')]=_0x1cc0b9['id'];if(_0x18d92c['query'][_0x7df4('0x3a')]){_0x7a6d01['where']=_[_0x7df4('0x37')](_0x7a6d01['where'],{'$or':_[_0x7df4('0x39')](_0x7a6d01[_0x7df4('0x2e')],function(_0x40dfaf){var _0x17aad4={};_0x17aad4[_0x40dfaf]={'$like':'%'+_0x18d92c[_0x7df4('0x29')][_0x7df4('0x3a')]+'%'};return _0x17aad4;})});}_0x7a6d01=_[_0x7df4('0x37')]({},_0x7a6d01,_0x18d92c[_0x7df4('0x3b')]);return db[_0x7df4('0x48')]['count']({'where':_0x7a6d01[_0x7df4('0x38')]})[_0x7df4('0x21')](function(_0x1f7206){_0x544d02['count']=_0x1f7206;if(_0x18d92c[_0x7df4('0x29')][_0x7df4('0x3c')]){_0x7a6d01['include']=[{'all':!![]}];}return db[_0x7df4('0x48')][_0x7df4('0x3e')](_0x7a6d01);})['then'](function(_0x39cf2e){_0x544d02['rows']=_0x39cf2e;return _0x544d02;});}})[_0x7df4('0x21')](respondWithFilteredResult(_0x2b8d8f,_0x7a6d01))[_0x7df4('0x40')](handleError(_0x2b8d8f,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 5821229..42829e9 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 _0xebd3=['lodash','util','../../config/logger','bluebird','./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions'];(function(_0x7dfb17,_0x56b075){var _0x37f513=function(_0x221ff2){while(--_0x221ff2){_0x7dfb17['push'](_0x7dfb17['shift']());}};_0x37f513(++_0x56b075);}(_0xebd3,0x158));var _0x3ebd=function(_0x5538d5,_0x190032){_0x5538d5=_0x5538d5-0x0;var _0x323b1a=_0xebd3[_0x5538d5];return _0x323b1a;};'use strict';var _=require(_0x3ebd('0x0'));var util=require(_0x3ebd('0x1'));var logger=require(_0x3ebd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3ebd('0x3'));var rp=require('request-promise');var attributes=require(_0x3ebd('0x4'));module[_0x3ebd('0x5')]=function(_0xc199d5,_0x582539){return _0xc199d5['define'](_0x3ebd('0x6'),attributes,{'tableName':_0x3ebd('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3958=['request-promise','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','lodash','util','../../config/logger','api','bluebird'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3958,0xeb));var _0x8395=function(_0x34bb12,_0x4e9455){_0x34bb12=_0x34bb12-0x0;var _0x39be5b=_0x3958[_0x34bb12];return _0x39be5b;};'use strict';var _=require(_0x8395('0x0'));var util=require(_0x8395('0x1'));var logger=require(_0x8395('0x2'))(_0x8395('0x3'));var moment=require('moment');var BPromise=require(_0x8395('0x4'));var rp=require(_0x8395('0x5'));var attributes=require(_0x8395('0x6'));module[_0x8395('0x7')]=function(_0x3c1296,_0x411bfc){return _0x3c1296[_0x8395('0x8')](_0x8395('0x9'),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 0598c05..43d02da 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 _0x7a54=['info','JscriptySessionReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x3757aa,_0x3a7d15){_0x3757aa=_0x3757aa-0x0;var _0x3fbd0d=_0x7a54[_0x3757aa];return _0x3fbd0d;};'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')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0xa24d=['http','request','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x865dcb,_0x4db494){var _0x4ae5a4=function(_0x2a4bac){while(--_0x2a4bac){_0x865dcb['push'](_0x865dcb['shift']());}};_0x4ae5a4(++_0x4db494);}(_0xa24d,0x1c1));var _0xda24=function(_0x8338b1,_0x1eb097){_0x8338b1=_0x8338b1-0x0;var _0x4f4e95=_0xa24d[_0x8338b1];return _0x4f4e95;};'use strict';var _=require(_0xda24('0x0'));var util=require(_0xda24('0x1'));var moment=require(_0xda24('0x2'));var BPromise=require(_0xda24('0x3'));var rs=require(_0xda24('0x4'));var fs=require('fs');var Redis=require(_0xda24('0x5'));var db=require(_0xda24('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xda24('0x7'))(_0xda24('0x8'));var config=require(_0xda24('0x9'));var jayson=require(_0xda24('0xa'));var client=jayson['client'][_0xda24('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xdba54e,_0x5868af,_0x3d0ec5){return new BPromise(function(_0x48117a,_0x446e2e){return client[_0xda24('0xc')](_0xdba54e,_0x3d0ec5)[_0xda24('0xd')](function(_0x1dccb2){logger['info'](_0xda24('0xe'),_0x5868af,_0xda24('0xf'));logger[_0xda24('0x10')](_0xda24('0x11'),_0x5868af,_0xda24('0xf'),JSON['stringify'](_0x1dccb2));if(_0x1dccb2[_0xda24('0x12')]){if(_0x1dccb2['error'][_0xda24('0x13')]===0x1f4){logger[_0xda24('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x5868af,_0x1dccb2['error'][_0xda24('0x14')]);return _0x446e2e(_0x1dccb2[_0xda24('0x12')][_0xda24('0x14')]);}logger[_0xda24('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x5868af,_0x1dccb2[_0xda24('0x12')]['message']);return _0x48117a(_0x1dccb2[_0xda24('0x12')][_0xda24('0x14')]);}else{logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x5868af,_0xda24('0xf'));_0x48117a(_0x1dccb2[_0xda24('0x15')][_0xda24('0x14')]);}})[_0xda24('0x16')](function(_0x3348e0){logger[_0xda24('0x12')](_0xda24('0xe'),_0x5868af,_0x3348e0);_0x446e2e(_0x3348e0);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index f787241..cbc6175 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 _0xbfe0=['put','/:id','update','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xbfe0,0x13c));var _0x0bfe=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0xbfe0[_0x158f01];return _0x5ef74e;};'use strict';var multer=require('multer');var util=require(_0x0bfe('0x0'));var path=require(_0x0bfe('0x1'));var timeout=require(_0x0bfe('0x2'));var express=require(_0x0bfe('0x3'));var router=express[_0x0bfe('0x4')]();var auth=require(_0x0bfe('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0bfe('0x6'));var controller=require('./license.controller');router[_0x0bfe('0x7')]('/',controller[_0x0bfe('0x8')]);router[_0x0bfe('0x9')](_0x0bfe('0xa'),auth['isAuthenticated'](),controller[_0x0bfe('0xb')]);module[_0x0bfe('0xc')]=router; \ No newline at end of file +var _0xe368=['./license.controller','get','index','put','/:id','update','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4244a4,_0x1a1ba1){var _0x4aaebd=function(_0x42b834){while(--_0x42b834){_0x4244a4['push'](_0x4244a4['shift']());}};_0x4aaebd(++_0x1a1ba1);}(_0xe368,0x18e));var _0x8e36=function(_0x2f1172,_0x58b413){_0x2f1172=_0x2f1172-0x0;var _0x1504a1=_0xe368[_0x2f1172];return _0x1504a1;};'use strict';var multer=require(_0x8e36('0x0'));var util=require(_0x8e36('0x1'));var path=require('path');var timeout=require(_0x8e36('0x2'));var express=require(_0x8e36('0x3'));var router=express[_0x8e36('0x4')]();var auth=require(_0x8e36('0x5'));var interaction=require(_0x8e36('0x6'));var config=require(_0x8e36('0x7'));var controller=require(_0x8e36('0x8'));router[_0x8e36('0x9')]('/',controller[_0x8e36('0xa')]);router[_0x8e36('0xb')](_0x8e36('0xc'),auth['isAuthenticated'](),controller[_0x8e36('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index c7154b0..97d897d 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 _0xd39f=['sequelize','exports','STRING'];(function(_0x49a2f6,_0x147b48){var _0x918b69=function(_0x3ff652){while(--_0x3ff652){_0x49a2f6['push'](_0x49a2f6['shift']());}};_0x918b69(++_0x147b48);}(_0xd39f,0xf6));var _0xfd39=function(_0x4dab14,_0x4bdfb5){_0x4dab14=_0x4dab14-0x0;var _0x371600=_0xd39f[_0x4dab14];return _0x371600;};'use strict';var Sequelize=require(_0xfd39('0x0'));module[_0xfd39('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xfd39('0x2')]},'data2':{'type':Sequelize[_0xfd39('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6a94=['sequelize','exports','TEXT','STRING','INTEGER'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6a94,0x163));var _0x46a9=function(_0x56a0b5,_0x48b58b){_0x56a0b5=_0x56a0b5-0x0;var _0x881bf1=_0x6a94[_0x56a0b5];return _0x881bf1;};'use strict';var Sequelize=require(_0x46a9('0x0'));module[_0x46a9('0x1')]={'license':{'type':Sequelize[_0x46a9('0x2')]},'data1':{'type':Sequelize[_0x46a9('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x46a9('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index be94fe3..17fd367 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 _0x7b84=['sendStatus','status','end','json','count','offset','apply','update','then','destroy','error','name','send','../../config/license/util','index','keys','License','rawAttributes','query','intersection','model','attributes','fields','merge','options','getLicense','body','find','params','checkLicense','demo','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x12c8e6,_0x5657ae){var _0x5e157d=function(_0x54d229){while(--_0x54d229){_0x12c8e6['push'](_0x12c8e6['shift']());}};_0x5e157d(++_0x5657ae);}(_0x7b84,0x17c));var _0x47b8=function(_0x48899a,_0x27e898){_0x48899a=_0x48899a-0x0;var _0x3458dc=_0x7b84[_0x48899a];return _0x3458dc;};'use strict';var pdf=require(_0x47b8('0x0'));var emlformat=require(_0x47b8('0x1'));var rimraf=require(_0x47b8('0x2'));var zipdir=require(_0x47b8('0x3'));var jsonpatch=require(_0x47b8('0x4'));var rp=require(_0x47b8('0x5'));var moment=require(_0x47b8('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x47b8('0x7'));var util=require(_0x47b8('0x8'));var path=require(_0x47b8('0x9'));var sox=require(_0x47b8('0xa'));var csv=require(_0x47b8('0xb'));var ejs=require(_0x47b8('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47b8('0xd'));var crypto=require(_0x47b8('0xe'));var jsforce=require(_0x47b8('0xf'));var deskjs=require(_0x47b8('0x10'));var toCsv=require(_0x47b8('0xb'));var querystring=require(_0x47b8('0x11'));var Papa=require(_0x47b8('0x12'));var Redis=require(_0x47b8('0x13'));var qs=require(_0x47b8('0x14'));var logger=require(_0x47b8('0x15'))(_0x47b8('0x16'));var utils=require(_0x47b8('0x17'));var config=require(_0x47b8('0x18'));var db=require(_0x47b8('0x19'))['db'];function respondWithStatusCode(_0x3e255e,_0x2a1af3){_0x2a1af3=_0x2a1af3||0xcc;return function(_0x34bb18){if(_0x34bb18){return _0x3e255e[_0x47b8('0x1a')](_0x2a1af3);}return _0x3e255e[_0x47b8('0x1b')](_0x2a1af3)[_0x47b8('0x1c')]();};}function respondWithResult(_0x1edb4b,_0x127d42){_0x127d42=_0x127d42||0xc8;return function(_0x2d1aaf){if(_0x2d1aaf){return _0x1edb4b[_0x47b8('0x1b')](_0x127d42)[_0x47b8('0x1d')](_0x2d1aaf);}};}function respondWithFilteredResult(_0x223121,_0xf66dd6){return function(_0x51cc56){if(_0x51cc56){var _0x1fe3b7=_0x51cc56[_0x47b8('0x1e')],_0x340da0=_0xf66dd6[_0x47b8('0x1f')],_0x3e760a=_0xf66dd6[_0x47b8('0x1f')]+_0xf66dd6['limit'],_0x1217a4;if(_0x3e760a>=_0x1fe3b7){_0x3e760a=_0x1fe3b7;_0x1217a4=0xc8;}else{_0x1217a4=0xce;}_0x223121[_0x47b8('0x1b')](_0x1217a4);return _0x223121['set']('Content-Range',_0x340da0+'-'+_0x3e760a+'/'+_0x1fe3b7)['json'](_0x51cc56);}return null;};}function patchUpdates(_0x299195){return function(_0x36faf1){try{jsonpatch[_0x47b8('0x20')](_0x36faf1,_0x299195,!![]);}catch(_0x5b3e8e){return BPromise['reject'](_0x5b3e8e);}return _0x36faf1['save']();};}function saveUpdates(_0x1c5bfd,_0x5531a2){return function(_0x2a4fa7){if(_0x2a4fa7){return _0x2a4fa7[_0x47b8('0x21')](_0x1c5bfd)[_0x47b8('0x22')](function(_0xfccf56){return _0xfccf56;});}return null;};}function removeEntity(_0x4eba33,_0xc20df1){return function(_0x2d0205){if(_0x2d0205){return _0x2d0205[_0x47b8('0x23')]()[_0x47b8('0x22')](function(){_0x4eba33[_0x47b8('0x1b')](0xcc)[_0x47b8('0x1c')]();});}};}function handleEntityNotFound(_0x54f6bc,_0x31555d){return function(_0x2a22e3){if(!_0x2a22e3){_0x54f6bc['sendStatus'](0x194);}return _0x2a22e3;};}function handleError(_0x22e7dd,_0x247429){_0x247429=_0x247429||0x1f4;return function(_0x19b03e){logger[_0x47b8('0x24')](_0x19b03e['stack']);if(_0x19b03e[_0x47b8('0x25')]){delete _0x19b03e[_0x47b8('0x25')];}_0x22e7dd[_0x47b8('0x1b')](_0x247429)[_0x47b8('0x26')](_0x19b03e);};}var utilLicense=require(_0x47b8('0x27'));exports[_0x47b8('0x28')]=function(_0x40918f,_0x568c1e){var _0x43fd49={'raw':!![],'where':{'id':0x1}},_0x1f719a={};_0x1f719a['model']=_[_0x47b8('0x29')](db[_0x47b8('0x2a')][_0x47b8('0x2b')]);_0x1f719a[_0x47b8('0x2c')]=_['keys'](_0x40918f[_0x47b8('0x2c')]);_0x1f719a['filters']=_[_0x47b8('0x2d')](_0x1f719a[_0x47b8('0x2e')],_0x1f719a[_0x47b8('0x2c')]);_0x43fd49[_0x47b8('0x2f')]=_['intersection'](_0x1f719a[_0x47b8('0x2e')],qs[_0x47b8('0x30')](_0x40918f[_0x47b8('0x2c')][_0x47b8('0x30')]));_0x43fd49[_0x47b8('0x2f')]=_0x43fd49[_0x47b8('0x2f')]['length']?_0x43fd49['attributes']:_0x1f719a['model'];_0x43fd49=_[_0x47b8('0x31')]({},_0x43fd49,_0x40918f[_0x47b8('0x32')]);return utilLicense[_0x47b8('0x33')](_0x43fd49)['then'](respondWithResult(_0x568c1e,null))['catch'](handleError(_0x568c1e,null));};exports['update']=function(_0x4c588b,_0x347769){if(_0x4c588b[_0x47b8('0x34')]['id']){delete _0x4c588b[_0x47b8('0x34')]['id'];}return db[_0x47b8('0x2a')][_0x47b8('0x35')]({'where':{'id':_0x4c588b[_0x47b8('0x36')]['id']}})[_0x47b8('0x22')](handleEntityNotFound(_0x347769,null))[_0x47b8('0x22')](function(_0x2bca34){var _0x52ce02=_0x2bca34['get']({'plain':!![]});return utilLicense[_0x47b8('0x37')](_0x52ce02,_0x4c588b[_0x47b8('0x34')]['key']);})['then'](function(_0x23ccbf){if(!_0x23ccbf[_0x47b8('0x38')]){return saveUpdates(_0x4c588b[_0x47b8('0x34')],null);}return _0x23ccbf;})['then'](respondWithResult(_0x347769,null))[_0x47b8('0x39')](handleError(_0x347769,null));}; \ No newline at end of file +var _0xd117=['merge','options','getLicense','catch','body','find','params','checkLicense','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','api','../../mysqldb','status','end','json','offset','limit','set','save','update','then','sendStatus','error','stack','name','index','keys','License','rawAttributes','query','filters','intersection','fields','length','attributes'];(function(_0x154818,_0x17ae16){var _0xe7de7e=function(_0x33fe3a){while(--_0x33fe3a){_0x154818['push'](_0x154818['shift']());}};_0xe7de7e(++_0x17ae16);}(_0xd117,0x182));var _0x7d11=function(_0x11adbd,_0x5055f5){_0x11adbd=_0x11adbd-0x0;var _0x270029=_0xd117[_0x11adbd];return _0x270029;};'use strict';var pdf=require(_0x7d11('0x0'));var emlformat=require(_0x7d11('0x1'));var rimraf=require(_0x7d11('0x2'));var zipdir=require(_0x7d11('0x3'));var jsonpatch=require(_0x7d11('0x4'));var rp=require(_0x7d11('0x5'));var moment=require(_0x7d11('0x6'));var BPromise=require(_0x7d11('0x7'));var Mustache=require(_0x7d11('0x8'));var util=require(_0x7d11('0x9'));var path=require(_0x7d11('0xa'));var sox=require(_0x7d11('0xb'));var csv=require(_0x7d11('0xc'));var ejs=require(_0x7d11('0xd'));var fs=require('fs');var _=require(_0x7d11('0xe'));var squel=require(_0x7d11('0xf'));var crypto=require('crypto');var jsforce=require(_0x7d11('0x10'));var deskjs=require(_0x7d11('0x11'));var toCsv=require(_0x7d11('0xc'));var querystring=require('querystring');var Papa=require(_0x7d11('0x12'));var Redis=require(_0x7d11('0x13'));var qs=require(_0x7d11('0x14'));var logger=require('../../config/logger')(_0x7d11('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x7d11('0x16'))['db'];function respondWithStatusCode(_0x5c6d5d,_0x4a8668){_0x4a8668=_0x4a8668||0xcc;return function(_0xc52a95){if(_0xc52a95){return _0x5c6d5d['sendStatus'](_0x4a8668);}return _0x5c6d5d[_0x7d11('0x17')](_0x4a8668)[_0x7d11('0x18')]();};}function respondWithResult(_0x5ee572,_0x401bb7){_0x401bb7=_0x401bb7||0xc8;return function(_0x20f519){if(_0x20f519){return _0x5ee572['status'](_0x401bb7)[_0x7d11('0x19')](_0x20f519);}};}function respondWithFilteredResult(_0x16949d,_0x20a2df){return function(_0x2978da){if(_0x2978da){var _0x417e2d=_0x2978da['count'],_0xeae744=_0x20a2df[_0x7d11('0x1a')],_0x2a269e=_0x20a2df[_0x7d11('0x1a')]+_0x20a2df[_0x7d11('0x1b')],_0xb1669e;if(_0x2a269e>=_0x417e2d){_0x2a269e=_0x417e2d;_0xb1669e=0xc8;}else{_0xb1669e=0xce;}_0x16949d[_0x7d11('0x17')](_0xb1669e);return _0x16949d[_0x7d11('0x1c')]('Content-Range',_0xeae744+'-'+_0x2a269e+'/'+_0x417e2d)[_0x7d11('0x19')](_0x2978da);}return null;};}function patchUpdates(_0x49a34b){return function(_0x4d1306){try{jsonpatch['apply'](_0x4d1306,_0x49a34b,!![]);}catch(_0x2ca3a2){return BPromise['reject'](_0x2ca3a2);}return _0x4d1306[_0x7d11('0x1d')]();};}function saveUpdates(_0x5c0af8,_0xbe0a79){return function(_0x17e539){if(_0x17e539){return _0x17e539[_0x7d11('0x1e')](_0x5c0af8)[_0x7d11('0x1f')](function(_0x30df70){return _0x30df70;});}return null;};}function removeEntity(_0x117bb9,_0x4297f8){return function(_0x3d2574){if(_0x3d2574){return _0x3d2574['destroy']()[_0x7d11('0x1f')](function(){_0x117bb9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c3898,_0x27a818){return function(_0x3545dc){if(!_0x3545dc){_0x5c3898[_0x7d11('0x20')](0x194);}return _0x3545dc;};}function handleError(_0x1a7853,_0x355d14){_0x355d14=_0x355d14||0x1f4;return function(_0xd938df){logger[_0x7d11('0x21')](_0xd938df[_0x7d11('0x22')]);if(_0xd938df['name']){delete _0xd938df[_0x7d11('0x23')];}_0x1a7853['status'](_0x355d14)['send'](_0xd938df);};}var utilLicense=require('../../config/license/util');exports[_0x7d11('0x24')]=function(_0x59cdba,_0x180e1e){var _0x30e4c6={'raw':!![],'where':{'id':0x1}},_0x328ab7={};_0x328ab7['model']=_[_0x7d11('0x25')](db[_0x7d11('0x26')][_0x7d11('0x27')]);_0x328ab7['query']=_[_0x7d11('0x25')](_0x59cdba[_0x7d11('0x28')]);_0x328ab7[_0x7d11('0x29')]=_[_0x7d11('0x2a')](_0x328ab7['model'],_0x328ab7[_0x7d11('0x28')]);_0x30e4c6['attributes']=_[_0x7d11('0x2a')](_0x328ab7['model'],qs[_0x7d11('0x2b')](_0x59cdba[_0x7d11('0x28')][_0x7d11('0x2b')]));_0x30e4c6['attributes']=_0x30e4c6['attributes'][_0x7d11('0x2c')]?_0x30e4c6[_0x7d11('0x2d')]:_0x328ab7['model'];_0x30e4c6=_[_0x7d11('0x2e')]({},_0x30e4c6,_0x59cdba[_0x7d11('0x2f')]);return utilLicense[_0x7d11('0x30')](_0x30e4c6)['then'](respondWithResult(_0x180e1e,null))[_0x7d11('0x31')](handleError(_0x180e1e,null));};exports['update']=function(_0x507465,_0x3a88c9){if(_0x507465['body']['id']){delete _0x507465[_0x7d11('0x32')]['id'];}return db[_0x7d11('0x26')][_0x7d11('0x33')]({'where':{'id':_0x507465[_0x7d11('0x34')]['id']}})['then'](handleEntityNotFound(_0x3a88c9,null))[_0x7d11('0x1f')](function(_0x1f282b){var _0x55a029=_0x1f282b['get']({'plain':!![]});return utilLicense[_0x7d11('0x35')](_0x55a029,_0x507465[_0x7d11('0x32')]['key']);})[_0x7d11('0x1f')](function(_0x5ac591){if(!_0x5ac591['demo']){return saveUpdates(_0x507465[_0x7d11('0x32')],null);}return _0x5ac591;})['then'](respondWithResult(_0x3a88c9,null))['catch'](handleError(_0x3a88c9,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index b425297..31b271f 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 _0x5640=['api','moment','bluebird','request-promise','./license.attributes','exports','define','License','license','lodash','../../config/logger'];(function(_0x49c68e,_0x1c1673){var _0x33032b=function(_0x42ac31){while(--_0x42ac31){_0x49c68e['push'](_0x49c68e['shift']());}};_0x33032b(++_0x1c1673);}(_0x5640,0x111));var _0x0564=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5640[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x0564('0x0'));var util=require('util');var logger=require(_0x0564('0x1'))(_0x0564('0x2'));var moment=require(_0x0564('0x3'));var BPromise=require(_0x0564('0x4'));var rp=require(_0x0564('0x5'));var attributes=require(_0x0564('0x6'));module[_0x0564('0x7')]=function(_0x1c229d,_0x401b67){return _0x1c229d[_0x0564('0x8')](_0x0564('0x9'),attributes,{'tableName':_0x0564('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3eec=['util','../../config/logger','api','bluebird','request-promise','./license.attributes','exports','License','license','lodash'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x3eec,0x1e9));var _0xc3ee=function(_0x36eeed,_0x1eb853){_0x36eeed=_0x36eeed-0x0;var _0x12029e=_0x3eec[_0x36eeed];return _0x12029e;};'use strict';var _=require(_0xc3ee('0x0'));var util=require(_0xc3ee('0x1'));var logger=require(_0xc3ee('0x2'))(_0xc3ee('0x3'));var moment=require('moment');var BPromise=require(_0xc3ee('0x4'));var rp=require(_0xc3ee('0x5'));var attributes=require(_0xc3ee('0x6'));module[_0xc3ee('0x7')]=function(_0x25074b,_0x237115){return _0x25074b['define'](_0xc3ee('0x8'),attributes,{'tableName':_0xc3ee('0x9'),'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 4692796..4d4c972 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 _0xb8aa=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','License,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','bluebird'];(function(_0xd1b4d7,_0x28b2c1){var _0x3002ec=function(_0x3d95ce){while(--_0x3d95ce){_0xd1b4d7['push'](_0xd1b4d7['shift']());}};_0x3002ec(++_0x28b2c1);}(_0xb8aa,0x1b5));var _0xab8a=function(_0x572ffe,_0x52c50c){_0x572ffe=_0x572ffe-0x0;var _0x3a5cde=_0xb8aa[_0x572ffe];return _0x3a5cde;};'use strict';var _=require('lodash');var util=require(_0xab8a('0x0'));var moment=require(_0xab8a('0x1'));var BPromise=require(_0xab8a('0x2'));var rs=require(_0xab8a('0x3'));var fs=require('fs');var Redis=require(_0xab8a('0x4'));var db=require(_0xab8a('0x5'))['db'];var utils=require(_0xab8a('0x6'));var logger=require('../../config/logger')(_0xab8a('0x7'));var config=require(_0xab8a('0x8'));var jayson=require(_0xab8a('0x9'));var client=jayson[_0xab8a('0xa')][_0xab8a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf89d3c,_0x5322b4,_0x2ddc08){return new BPromise(function(_0x153063,_0x30a1d6){return client[_0xab8a('0xc')](_0xf89d3c,_0x2ddc08)[_0xab8a('0xd')](function(_0x40b543){logger['info'](_0xab8a('0xe'),_0x5322b4,_0xab8a('0xf'));logger[_0xab8a('0x10')]('License,\x20%s,\x20%s,\x20%s',_0x5322b4,_0xab8a('0xf'),JSON[_0xab8a('0x11')](_0x40b543));if(_0x40b543['error']){if(_0x40b543[_0xab8a('0x12')][_0xab8a('0x13')]===0x1f4){logger[_0xab8a('0x12')]('License,\x20%s,\x20%s',_0x5322b4,_0x40b543[_0xab8a('0x12')][_0xab8a('0x14')]);return _0x30a1d6(_0x40b543[_0xab8a('0x12')][_0xab8a('0x14')]);}logger['error'](_0xab8a('0xe'),_0x5322b4,_0x40b543[_0xab8a('0x12')]['message']);return _0x153063(_0x40b543[_0xab8a('0x12')][_0xab8a('0x14')]);}else{logger['info'](_0xab8a('0xe'),_0x5322b4,_0xab8a('0xf'));_0x153063(_0x40b543[_0xab8a('0x15')][_0xab8a('0x14')]);}})['catch'](function(_0x2762a4){logger[_0xab8a('0x12')](_0xab8a('0xe'),_0x5322b4,_0x2762a4);_0x30a1d6(_0x2762a4);});});} \ No newline at end of file +var _0xdc62=['request','then','info','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xdc62,0x64));var _0x2dc6=function(_0x4f47ff,_0x39e575){_0x4f47ff=_0x4f47ff-0x0;var _0x48e268=_0xdc62[_0x4f47ff];return _0x48e268;};'use strict';var _=require(_0x2dc6('0x0'));var util=require(_0x2dc6('0x1'));var moment=require('moment');var BPromise=require(_0x2dc6('0x2'));var rs=require(_0x2dc6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2dc6('0x4'));var logger=require(_0x2dc6('0x5'))(_0x2dc6('0x6'));var config=require(_0x2dc6('0x7'));var jayson=require(_0x2dc6('0x8'));var client=jayson['client'][_0x2dc6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8c026a,_0xf7a377,_0x3a102f){return new BPromise(function(_0x324e52,_0x46b677){return client[_0x2dc6('0xa')](_0x8c026a,_0x3a102f)[_0x2dc6('0xb')](function(_0x36a43e){logger[_0x2dc6('0xc')](_0x2dc6('0xd'),_0xf7a377,'request\x20sent');logger[_0x2dc6('0xe')](_0x2dc6('0xf'),_0xf7a377,_0x2dc6('0x10'),JSON[_0x2dc6('0x11')](_0x36a43e));if(_0x36a43e[_0x2dc6('0x12')]){if(_0x36a43e[_0x2dc6('0x12')][_0x2dc6('0x13')]===0x1f4){logger[_0x2dc6('0x12')](_0x2dc6('0xd'),_0xf7a377,_0x36a43e[_0x2dc6('0x12')][_0x2dc6('0x14')]);return _0x46b677(_0x36a43e[_0x2dc6('0x12')]['message']);}logger[_0x2dc6('0x12')]('License,\x20%s,\x20%s',_0xf7a377,_0x36a43e[_0x2dc6('0x12')][_0x2dc6('0x14')]);return _0x324e52(_0x36a43e['error'][_0x2dc6('0x14')]);}else{logger[_0x2dc6('0xc')](_0x2dc6('0xd'),_0xf7a377,'request\x20sent');_0x324e52(_0x36a43e[_0x2dc6('0x15')][_0x2dc6('0x14')]);}})['catch'](function(_0x14f123){logger[_0x2dc6('0x12')](_0x2dc6('0xd'),_0xf7a377,_0x14f123);_0x46b677(_0x14f123);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 94b3ac8..577fef9 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 _0xeec6=['getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','verifySmtp','/:id/users','getAgents','addDisposition','post','create','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','index','isAuthenticated','describe','/:id','show','/:id/dispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers'];(function(_0x1ae975,_0x70b40e){var _0x2576ca=function(_0x1b4e97){while(--_0x1b4e97){_0x1ae975['push'](_0x1ae975['shift']());}};_0x2576ca(++_0x70b40e);}(_0xeec6,0x1c2));var _0x6eec=function(_0x40eec9,_0x817a67){_0x40eec9=_0x40eec9-0x0;var _0xfee890=_0xeec6[_0x40eec9];return _0xfee890;};'use strict';var multer=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var path=require(_0x6eec('0x2'));var timeout=require(_0x6eec('0x3'));var express=require('express');var router=express[_0x6eec('0x4')]();var auth=require(_0x6eec('0x5'));var interaction=require(_0x6eec('0x6'));var config=require(_0x6eec('0x7'));var controller=require(_0x6eec('0x8'));router[_0x6eec('0x9')]('/',auth['isAuthenticated'](),controller[_0x6eec('0xa')]);router[_0x6eec('0x9')]('/describe',auth[_0x6eec('0xb')](),controller[_0x6eec('0xc')]);router[_0x6eec('0x9')](_0x6eec('0xd'),auth['isAuthenticated'](),controller[_0x6eec('0xe')]);router[_0x6eec('0x9')](_0x6eec('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0x6eec('0x10'),auth[_0x6eec('0xb')](),controller['getAnswers']);router['get'](_0x6eec('0x11'),auth['isAuthenticated'](),controller[_0x6eec('0x12')]);router[_0x6eec('0x9')](_0x6eec('0x13'),auth[_0x6eec('0xb')](),controller[_0x6eec('0x14')]);router['get'](_0x6eec('0x15'),auth[_0x6eec('0xb')](),controller[_0x6eec('0x16')]);router[_0x6eec('0x9')](_0x6eec('0x17'),auth[_0x6eec('0xb')](),controller[_0x6eec('0x18')]);router[_0x6eec('0x9')](_0x6eec('0x19'),auth[_0x6eec('0xb')](),controller['getMessages']);router[_0x6eec('0x9')]('/:id/verify',auth[_0x6eec('0xb')](),controller[_0x6eec('0x1a')]);router['get'](_0x6eec('0x1b'),auth[_0x6eec('0xb')](),controller[_0x6eec('0x1c')]);router['post'](_0x6eec('0xf'),auth[_0x6eec('0xb')](),controller[_0x6eec('0x1d')]);router[_0x6eec('0x1e')](_0x6eec('0x10'),auth[_0x6eec('0xb')](),controller['addAnswer']);router[_0x6eec('0x1e')]('/',auth[_0x6eec('0xb')](),controller[_0x6eec('0x1f')]);router[_0x6eec('0x1e')](_0x6eec('0x11'),auth[_0x6eec('0xb')](),controller['addImap']);router[_0x6eec('0x1e')](_0x6eec('0x13'),auth[_0x6eec('0xb')](),controller[_0x6eec('0x20')]);router[_0x6eec('0x1e')](_0x6eec('0x15'),auth['isAuthenticated'](),controller[_0x6eec('0x21')]);router[_0x6eec('0x1e')](_0x6eec('0x17'),auth[_0x6eec('0xb')](),controller[_0x6eec('0x22')]);router[_0x6eec('0x1e')](_0x6eec('0x23'),auth[_0x6eec('0xb')](),controller[_0x6eec('0x24')]);router['post'](_0x6eec('0x1b'),auth[_0x6eec('0xb')](),controller[_0x6eec('0x25')]);router[_0x6eec('0x26')]('/:id',auth[_0x6eec('0xb')](),controller[_0x6eec('0x27')]);router['delete']('/:id/dispositions',auth[_0x6eec('0xb')](),controller['removeDispositions']);router[_0x6eec('0x28')](_0x6eec('0x10'),auth[_0x6eec('0xb')](),controller[_0x6eec('0x29')]);router[_0x6eec('0x28')](_0x6eec('0x11'),auth[_0x6eec('0xb')](),controller[_0x6eec('0x2a')]);router[_0x6eec('0x28')](_0x6eec('0x13'),auth['isAuthenticated'](),controller[_0x6eec('0x2b')]);router['delete'](_0x6eec('0xd'),auth[_0x6eec('0xb')](),controller[_0x6eec('0x2c')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x6eec('0x2d')]);module[_0x6eec('0x2e')]=router; \ No newline at end of file +var _0x425d=['/:id/messages','getMessages','/:id/verify','/:id/users','getAgents','post','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','update','delete','removeDispositions','removeImap','removeSmtp','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications'];(function(_0x1e4dca,_0x44147a){var _0x355ca9=function(_0x4d49b2){while(--_0x4d49b2){_0x1e4dca['push'](_0x1e4dca['shift']());}};_0x355ca9(++_0x44147a);}(_0x425d,0x1e0));var _0xd425=function(_0x42b5d6,_0x444d17){_0x42b5d6=_0x42b5d6-0x0;var _0x26f3cc=_0x425d[_0x42b5d6];return _0x26f3cc;};'use strict';var multer=require(_0xd425('0x0'));var util=require('util');var path=require(_0xd425('0x1'));var timeout=require(_0xd425('0x2'));var express=require(_0xd425('0x3'));var router=express[_0xd425('0x4')]();var auth=require(_0xd425('0x5'));var interaction=require(_0xd425('0x6'));var config=require(_0xd425('0x7'));var controller=require('./mailAccount.controller');router[_0xd425('0x8')]('/',auth[_0xd425('0x9')](),controller[_0xd425('0xa')]);router[_0xd425('0x8')](_0xd425('0xb'),auth[_0xd425('0x9')](),controller['describe']);router[_0xd425('0x8')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller[_0xd425('0xd')]);router[_0xd425('0x8')](_0xd425('0xe'),auth[_0xd425('0x9')](),controller[_0xd425('0xf')]);router[_0xd425('0x8')](_0xd425('0x10'),auth[_0xd425('0x9')](),controller[_0xd425('0x11')]);router[_0xd425('0x8')](_0xd425('0x12'),auth[_0xd425('0x9')](),controller[_0xd425('0x13')]);router[_0xd425('0x8')](_0xd425('0x14'),auth[_0xd425('0x9')](),controller[_0xd425('0x15')]);router['get'](_0xd425('0x16'),auth[_0xd425('0x9')](),controller[_0xd425('0x17')]);router['get'](_0xd425('0x18'),auth[_0xd425('0x9')](),controller[_0xd425('0x19')]);router[_0xd425('0x8')](_0xd425('0x1a'),auth['isAuthenticated'](),controller[_0xd425('0x1b')]);router[_0xd425('0x8')](_0xd425('0x1c'),auth[_0xd425('0x9')](),controller['verifySmtp']);router[_0xd425('0x8')](_0xd425('0x1d'),auth[_0xd425('0x9')](),controller[_0xd425('0x1e')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0xd425('0x1f')](_0xd425('0x10'),auth[_0xd425('0x9')](),controller['addAnswer']);router[_0xd425('0x1f')]('/',auth[_0xd425('0x9')](),controller['create']);router[_0xd425('0x1f')](_0xd425('0x12'),auth[_0xd425('0x9')](),controller[_0xd425('0x20')]);router[_0xd425('0x1f')](_0xd425('0x14'),auth[_0xd425('0x9')](),controller[_0xd425('0x21')]);router[_0xd425('0x1f')](_0xd425('0x16'),auth[_0xd425('0x9')](),controller[_0xd425('0x22')]);router['post'](_0xd425('0x18'),auth[_0xd425('0x9')](),controller[_0xd425('0x23')]);router[_0xd425('0x1f')](_0xd425('0x24'),auth[_0xd425('0x9')](),controller[_0xd425('0x25')]);router['post'](_0xd425('0x1d'),auth[_0xd425('0x9')](),controller[_0xd425('0x26')]);router['put'](_0xd425('0xc'),auth[_0xd425('0x9')](),controller[_0xd425('0x27')]);router[_0xd425('0x28')](_0xd425('0xe'),auth[_0xd425('0x9')](),controller[_0xd425('0x29')]);router[_0xd425('0x28')](_0xd425('0x10'),auth[_0xd425('0x9')](),controller['removeAnswers']);router[_0xd425('0x28')](_0xd425('0x12'),auth[_0xd425('0x9')](),controller[_0xd425('0x2a')]);router[_0xd425('0x28')](_0xd425('0x14'),auth[_0xd425('0x9')](),controller[_0xd425('0x2b')]);router[_0xd425('0x28')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller['destroy']);router[_0xd425('0x28')](_0xd425('0x1d'),auth[_0xd425('0x9')](),controller[_0xd425('0x2c')]);module[_0xd425('0x2d')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 38a0d46..9c0fab4 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 _0xca1d=['sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}'];(function(_0x42844a,_0x5854fa){var _0x15a66e=function(_0x233464){while(--_0x233464){_0x42844a['push'](_0x42844a['shift']());}};_0x15a66e(++_0x5854fa);}(_0xca1d,0x1e6));var _0xdca1=function(_0x38a9b6,_0x1a71b9){_0x38a9b6=_0x38a9b6-0x0;var _0x2e6409=_0xca1d[_0x38a9b6];return _0x2e6409;};'use strict';var Sequelize=require(_0xdca1('0x0'));module[_0xdca1('0x1')]={'description':{'type':Sequelize[_0xdca1('0x2')]},'name':{'type':Sequelize[_0xdca1('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xdca1('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xdca1('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xdca1('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0xdca1('0x4')]},'markAsUnread':{'type':Sequelize[_0xdca1('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdca1('0x5')},'fontSize':{'type':Sequelize[_0xdca1('0x6')](0x2)[_0xdca1('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xdca1('0x8');}},'notificationSound':{'type':Sequelize[_0xdca1('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdca1('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdca1('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdca1('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdca1('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdca1('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c}}; \ No newline at end of file +var _0x2242=['Arial,Helvetica,sans-serif','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','sequelize','exports','STRING','BOOLEAN','TEXT'];(function(_0x34b671,_0xce9946){var _0x4be131=function(_0x4369fa){while(--_0x4369fa){_0x34b671['push'](_0x34b671['shift']());}};_0x4be131(++_0xce9946);}(_0x2242,0x1a3));var _0x2224=function(_0x5ebebc,_0x257876){_0x5ebebc=_0x5ebebc-0x0;var _0x1260f5=_0x2242[_0x5ebebc];return _0x1260f5;};'use strict';var Sequelize=require(_0x2224('0x0'));module[_0x2224('0x1')]={'description':{'type':Sequelize[_0x2224('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x2224('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x2224('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x2224('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x2224('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x2224('0x2')],'allowNull':![],'defaultValue':_0x2224('0x5')},'fontSize':{'type':Sequelize[_0x2224('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x2224('0x4')],'defaultValue':function(){return _0x2224('0x7');}},'notificationSound':{'type':Sequelize[_0x2224('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2224('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2224('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2224('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2224('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2224('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2224('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 070c371..cd115d8 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 _0x6bcb=['lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','client','http','request','then','info','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','set','json','apply','reject','save','update','destroy','stack','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','MailAccount','rawAttributes','dateStart','query','dateEnd','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','add','day','merge','filter','map','count','include','findAll','rows','show','params','keys','options','find','body','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','pick','ids','addAnswer','CannedAnswer','getAnswers','nolimit','includeAll','removeAnswers','isNil','active','description','cservice','cauthentication','user','cuser','password','authentication','host','port','service','pass','cpassword','getImap','addImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','omit','MailInteraction','Contact','Owner','fullname','internal','Tag','Tags','color','tag','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','split','format','CmContact','updatedAt','from','%s\x20<%s>','email','attachments','join','basename','SendMail','List\x20not\x20found','List','messageId','subject','attach','YYYY-MM-DD\x20HH:mm:ss','out','Interaction','Messages','VerifySmtp','verifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','User','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6bcb,0xa7));var _0xb6bc=function(_0x1e6db3,_0x5643ac){_0x1e6db3=_0x1e6db3-0x0;var _0x1de886=_0x6bcb[_0x1e6db3];return _0x1de886;};'use strict';var pdf=require(_0xb6bc('0x0'));var emlformat=require(_0xb6bc('0x1'));var rimraf=require(_0xb6bc('0x2'));var zipdir=require(_0xb6bc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb6bc('0x4'));var moment=require(_0xb6bc('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb6bc('0x6'));var util=require(_0xb6bc('0x7'));var path=require(_0xb6bc('0x8'));var sox=require(_0xb6bc('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb6bc('0xa'));var squel=require(_0xb6bc('0xb'));var crypto=require(_0xb6bc('0xc'));var jsforce=require(_0xb6bc('0xd'));var deskjs=require(_0xb6bc('0xe'));var toCsv=require(_0xb6bc('0xf'));var querystring=require(_0xb6bc('0x10'));var Papa=require(_0xb6bc('0x11'));var Redis=require(_0xb6bc('0x12'));var qs=require(_0xb6bc('0x13'));var logger=require(_0xb6bc('0x14'))(_0xb6bc('0x15'));var utils=require(_0xb6bc('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xb6bc('0x17')]=_[_0xb6bc('0x18')](config[_0xb6bc('0x17')],{'host':_0xb6bc('0x19'),'port':0x18eb});var socket=require(_0xb6bc('0x1a'))(new Redis(config[_0xb6bc('0x17')]));require(_0xb6bc('0x1b'))[_0xb6bc('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb6bc('0x1d')][_0xb6bc('0x1e')]({'port':0x232b});function respondWithRpcPromise(_0x5238b1,_0x10f3b0,_0x39ad22,_0x265168){return new BPromise(function(_0xd87ce5,_0x2dede1){var _0x13aa97=_0x265168||client;return _0x13aa97[_0xb6bc('0x1f')](_0x5238b1,_0x39ad22)[_0xb6bc('0x20')](function(_0x5dd3bf){logger[_0xb6bc('0x21')]('MailAccount,\x20%s,\x20%s',_0x10f3b0,_0xb6bc('0x22'));logger['debug'](_0xb6bc('0x23'),_0x10f3b0,_0xb6bc('0x22'),JSON['stringify'](_0x5dd3bf));if(_0x5dd3bf[_0xb6bc('0x24')]){if(_0x5dd3bf[_0xb6bc('0x24')]['code']===0x1f4){logger[_0xb6bc('0x24')](_0xb6bc('0x25'),_0x10f3b0,_0x5dd3bf[_0xb6bc('0x24')]['message']);return _0x2dede1(_0x5dd3bf[_0xb6bc('0x24')][_0xb6bc('0x26')]);}logger[_0xb6bc('0x24')](_0xb6bc('0x25'),_0x10f3b0,_0x5dd3bf[_0xb6bc('0x24')]['message']);return _0xd87ce5(_0x5dd3bf[_0xb6bc('0x24')][_0xb6bc('0x26')]);}else{logger[_0xb6bc('0x21')]('MailAccount,\x20%s,\x20%s',_0x10f3b0,_0xb6bc('0x22'));_0xd87ce5(_0x5dd3bf[_0xb6bc('0x27')]['message']);}})[_0xb6bc('0x28')](function(_0x6fccf6){logger[_0xb6bc('0x24')](_0xb6bc('0x25'),_0x10f3b0,_0x6fccf6);_0x2dede1(_0x6fccf6);});});}function respondWithStatusCode(_0x41ec26,_0x15307e){_0x15307e=_0x15307e||0xcc;return function(_0xd07d73){if(_0xd07d73){return _0x41ec26[_0xb6bc('0x29')](_0x15307e);}return _0x41ec26[_0xb6bc('0x2a')](_0x15307e)[_0xb6bc('0x2b')]();};}function respondWithResult(_0x1628c9,_0x1f7414){_0x1f7414=_0x1f7414||0xc8;return function(_0x2447f4){if(_0x2447f4){return _0x1628c9[_0xb6bc('0x2a')](_0x1f7414)['json'](_0x2447f4);}};}function respondWithFilteredResult(_0x2f3a44,_0x17cdb3){return function(_0x498f3c){if(_0x498f3c){var _0x531f39=_0x498f3c['count'],_0x3f1364=_0x17cdb3[_0xb6bc('0x2c')],_0x3ae96d=_0x17cdb3['offset']+_0x17cdb3['limit'],_0x3076e6;if(_0x3ae96d>=_0x531f39){_0x3ae96d=_0x531f39;_0x3076e6=0xc8;}else{_0x3076e6=0xce;}_0x2f3a44[_0xb6bc('0x2a')](_0x3076e6);return _0x2f3a44[_0xb6bc('0x2d')]('Content-Range',_0x3f1364+'-'+_0x3ae96d+'/'+_0x531f39)[_0xb6bc('0x2e')](_0x498f3c);}return null;};}function patchUpdates(_0x4bfdac){return function(_0x3520bc){try{jsonpatch[_0xb6bc('0x2f')](_0x3520bc,_0x4bfdac,!![]);}catch(_0x506df7){return BPromise[_0xb6bc('0x30')](_0x506df7);}return _0x3520bc[_0xb6bc('0x31')]();};}function saveUpdates(_0x5e9756,_0x1615ce){return function(_0x441bed){if(_0x441bed){return _0x441bed[_0xb6bc('0x32')](_0x5e9756)[_0xb6bc('0x20')](function(_0x373a43){return _0x373a43;});}return null;};}function removeEntity(_0x4c9a0f,_0x13003a){return function(_0x1f708c){if(_0x1f708c){return _0x1f708c[_0xb6bc('0x33')]()[_0xb6bc('0x20')](function(){_0x4c9a0f['status'](0xcc)[_0xb6bc('0x2b')]();});}};}function handleEntityNotFound(_0x3c6c5f,_0x1d8471){return function(_0x5dbb3b){if(!_0x5dbb3b){_0x3c6c5f[_0xb6bc('0x29')](0x194);}return _0x5dbb3b;};}function handleError(_0x4f2c62,_0x50066f){_0x50066f=_0x50066f||0x1f4;return function(_0x546573){logger[_0xb6bc('0x24')](_0x546573[_0xb6bc('0x34')]);if(_0x546573['name']){delete _0x546573[_0xb6bc('0x35')];}_0x4f2c62[_0xb6bc('0x2a')](_0x50066f)[_0xb6bc('0x36')](_0x546573);};}exports[_0xb6bc('0x37')]=function(_0x329292,_0x48c985){var _0x5ed480={'include':[{'model':db[_0xb6bc('0x38')],'as':_0xb6bc('0x39')},{'model':db[_0xb6bc('0x3a')],'as':_0xb6bc('0x3b')}]},_0xe73d2={},_0x1e4b55={'count':0x0,'rows':[]};var _0x5987a4=db[_0xb6bc('0x3c')][_0xb6bc('0x3d')];_0xe73d2['model']=_['keys'](_0x5987a4);var _0x506dd6={'dateStart':_0x329292['query'][_0xb6bc('0x3e')],'dateEnd':_0x329292[_0xb6bc('0x3f')]['dateEnd']};delete _0x329292[_0xb6bc('0x3f')][_0xb6bc('0x3e')];delete _0x329292[_0xb6bc('0x3f')][_0xb6bc('0x40')];_0xe73d2[_0xb6bc('0x3f')]=_['keys'](_0x329292[_0xb6bc('0x3f')]);_0xe73d2[_0xb6bc('0x41')]=_[_0xb6bc('0x42')](_0xe73d2[_0xb6bc('0x43')],_0xe73d2[_0xb6bc('0x3f')]);_0x5ed480[_0xb6bc('0x44')]=_[_0xb6bc('0x42')](_0xe73d2['model'],qs[_0xb6bc('0x45')](_0x329292[_0xb6bc('0x3f')][_0xb6bc('0x45')]));_0x5ed480[_0xb6bc('0x44')]=_0x5ed480[_0xb6bc('0x44')][_0xb6bc('0x46')]?_0x5ed480['attributes']:_0xe73d2[_0xb6bc('0x43')];if(!_0x329292[_0xb6bc('0x3f')][_0xb6bc('0x47')]('nolimit')){_0x5ed480[_0xb6bc('0x48')]=qs[_0xb6bc('0x48')](_0x329292[_0xb6bc('0x3f')][_0xb6bc('0x48')]);_0x5ed480[_0xb6bc('0x2c')]=qs[_0xb6bc('0x2c')](_0x329292['query']['offset']);}_0x5ed480[_0xb6bc('0x49')]=qs[_0xb6bc('0x4a')](_0x329292['query'][_0xb6bc('0x4a')]);_0x5ed480[_0xb6bc('0x4b')]=qs['filters'](_['pick'](_0x329292[_0xb6bc('0x3f')],_0xe73d2[_0xb6bc('0x41')]));if(_0x506dd6[_0xb6bc('0x3e')]){if(_0x506dd6[_0xb6bc('0x40')]){_0x506dd6[_0xb6bc('0x40')]=moment(_0x506dd6[_0xb6bc('0x40')])[_0xb6bc('0x4c')](0x1,_0xb6bc('0x4d'));}else{_0x506dd6[_0xb6bc('0x40')]=moment(_0x506dd6[_0xb6bc('0x3e')])['add'](0x1,_0xb6bc('0x4d'));}_[_0xb6bc('0x4e')](_0x5ed480[_0xb6bc('0x4b')],{'createdAt':{'$gte':_0x506dd6[_0xb6bc('0x3e')],'$lte':_0x506dd6['dateEnd']}});}if(_0x329292[_0xb6bc('0x3f')][_0xb6bc('0x4f')]){_0x5ed480['where']=_[_0xb6bc('0x4e')](_0x5ed480['where'],{'$or':_[_0xb6bc('0x50')](_0x5ed480[_0xb6bc('0x44')],function(_0x4d07e3){var _0x39a985={};_0x39a985[_0x4d07e3]={'$like':'%'+_0x329292[_0xb6bc('0x3f')][_0xb6bc('0x4f')]+'%'};return _0x39a985;})});}_0x5ed480=_[_0xb6bc('0x4e')]({},_0x5ed480,_0x329292['options']);var _0x581f9f={'where':_0x5ed480[_0xb6bc('0x4b')]};return db[_0xb6bc('0x3c')]['count'](_0x581f9f)['then'](function(_0x362ae0){_0x1e4b55[_0xb6bc('0x51')]=_0x362ae0;if(_0x329292[_0xb6bc('0x3f')]['includeAll']){_0x5ed480[_0xb6bc('0x52')]=[{'all':!![]}];}return db[_0xb6bc('0x3c')][_0xb6bc('0x53')](_0x5ed480);})['then'](function(_0x507dab){_0x1e4b55[_0xb6bc('0x54')]=_0x507dab;return _0x1e4b55;})[_0xb6bc('0x20')](respondWithFilteredResult(_0x48c985,_0x5ed480))[_0xb6bc('0x28')](handleError(_0x48c985,null));};exports[_0xb6bc('0x55')]=function(_0x4ac44e,_0x3aef56){var _0x14f631={'raw':![],'where':{'id':_0x4ac44e[_0xb6bc('0x56')]['id']},'include':[{'model':db[_0xb6bc('0x38')],'as':_0xb6bc('0x39')},{'model':db[_0xb6bc('0x3a')],'as':_0xb6bc('0x3b')}]},_0x47518b={};_0x47518b['model']=_[_0xb6bc('0x57')](db[_0xb6bc('0x3c')][_0xb6bc('0x3d')]);_0x47518b[_0xb6bc('0x3f')]=_['keys'](_0x4ac44e[_0xb6bc('0x3f')]);_0x47518b[_0xb6bc('0x41')]=_['intersection'](_0x47518b[_0xb6bc('0x43')],_0x47518b['query']);_0x14f631[_0xb6bc('0x44')]=_[_0xb6bc('0x42')](_0x47518b[_0xb6bc('0x43')],qs[_0xb6bc('0x45')](_0x4ac44e['query'][_0xb6bc('0x45')]));_0x14f631[_0xb6bc('0x44')]=_0x14f631['attributes'][_0xb6bc('0x46')]?_0x14f631[_0xb6bc('0x44')]:_0x47518b[_0xb6bc('0x43')];if(_0x4ac44e['query']['includeAll']){_0x14f631[_0xb6bc('0x52')]=[{'all':!![]}];}_0x14f631=_['merge']({},_0x14f631,_0x4ac44e[_0xb6bc('0x58')]);return db[_0xb6bc('0x3c')][_0xb6bc('0x59')](_0x14f631)[_0xb6bc('0x20')](handleEntityNotFound(_0x3aef56,null))[_0xb6bc('0x20')](respondWithResult(_0x3aef56,null))['catch'](handleError(_0x3aef56,null));};exports[_0xb6bc('0x32')]=function(_0x3a62f9,_0x14c47e){if(_0x3a62f9[_0xb6bc('0x5a')]['id']){delete _0x3a62f9[_0xb6bc('0x5a')]['id'];}return db[_0xb6bc('0x3c')]['find']({'where':{'id':_0x3a62f9[_0xb6bc('0x56')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0xb6bc('0x3a')],'as':_0xb6bc('0x3b')}]})['then'](handleEntityNotFound(_0x14c47e,null))['then'](saveUpdates(_0x3a62f9[_0xb6bc('0x5a')],null))[_0xb6bc('0x20')](function(_0xcc357b){if(_0xcc357b&&_0x3a62f9['body'][_0xb6bc('0x39')]){return db['MailServerIn'][_0xb6bc('0x32')](_0x3a62f9[_0xb6bc('0x5a')]['Imap'],{'where':{'MailAccountId':_0xcc357b['id']}})[_0xb6bc('0x20')](function(){return _0xcc357b;});}return _0xcc357b;})[_0xb6bc('0x20')](function(_0x5cd768){if(_0x5cd768&&_0x3a62f9[_0xb6bc('0x5a')][_0xb6bc('0x3b')]){return db[_0xb6bc('0x3a')][_0xb6bc('0x32')](_0x3a62f9['body'][_0xb6bc('0x3b')],{'where':{'MailAccountId':_0x5cd768['id']}})['then'](function(){return _0x5cd768;});}return _0x5cd768;})[_0xb6bc('0x20')](respondWithResult(_0x14c47e,null))[_0xb6bc('0x28')](handleError(_0x14c47e,null));};exports['describe']=function(_0x2ef3b0,_0x5ca560){return db['MailAccount'][_0xb6bc('0x5b')]()[_0xb6bc('0x20')](respondWithResult(_0x5ca560,null))['catch'](handleError(_0x5ca560,null));};exports[_0xb6bc('0x5c')]=function(_0x203baa,_0x55a352,_0x36018c){if(_0x203baa[_0xb6bc('0x5a')]['id']){delete _0x203baa[_0xb6bc('0x5a')]['id'];}return db[_0xb6bc('0x3c')][_0xb6bc('0x59')]({'where':{'id':_0x203baa[_0xb6bc('0x56')]['id']}})[_0xb6bc('0x20')](handleEntityNotFound(_0x55a352,null))[_0xb6bc('0x20')](function(_0x192390){if(_0x192390){_0x203baa[_0xb6bc('0x5a')][_0xb6bc('0x5d')]=_0x192390['id'];return db[_0xb6bc('0x5e')][_0xb6bc('0x5f')](_0x203baa[_0xb6bc('0x5a')]);}})[_0xb6bc('0x20')](respondWithResult(_0x55a352,null))[_0xb6bc('0x28')](handleError(_0x55a352,null));};exports[_0xb6bc('0x60')]=function(_0x27bbbe,_0x5793bd,_0x4da912){var _0x31112e={'raw':![],'where':{}};var _0x263fad={};var _0x2d41b6={'count':0x0,'rows':[]};return db[_0xb6bc('0x3c')][_0xb6bc('0x61')]({'where':{'id':_0x27bbbe['params']['id']}})[_0xb6bc('0x20')](handleEntityNotFound(_0x5793bd,null))[_0xb6bc('0x20')](function(_0x4b10cc){if(_0x4b10cc){_0x263fad[_0xb6bc('0x43')]=_[_0xb6bc('0x57')](db[_0xb6bc('0x5e')][_0xb6bc('0x3d')]);_0x263fad['query']=_[_0xb6bc('0x57')](_0x27bbbe['query']);_0x263fad[_0xb6bc('0x41')]=_['intersection'](_0x263fad['model'],_0x263fad[_0xb6bc('0x3f')]);_0x31112e[_0xb6bc('0x44')]=_[_0xb6bc('0x42')](_0x263fad[_0xb6bc('0x43')],qs[_0xb6bc('0x45')](_0x27bbbe[_0xb6bc('0x3f')]['fields']));_0x31112e['attributes']=_0x31112e['attributes'][_0xb6bc('0x46')]?_0x31112e['attributes']:_0x263fad[_0xb6bc('0x43')];if(!_0x27bbbe[_0xb6bc('0x3f')]['hasOwnProperty']('nolimit')){_0x31112e[_0xb6bc('0x48')]=qs['limit'](_0x27bbbe['query']['limit']);_0x31112e[_0xb6bc('0x2c')]=qs['offset'](_0x27bbbe[_0xb6bc('0x3f')][_0xb6bc('0x2c')]);}_0x31112e[_0xb6bc('0x49')]=qs[_0xb6bc('0x4a')](_0x27bbbe[_0xb6bc('0x3f')]['sort']);_0x31112e[_0xb6bc('0x4b')]=qs['filters'](_[_0xb6bc('0x62')](_0x27bbbe[_0xb6bc('0x3f')],_0x263fad[_0xb6bc('0x41')]));_0x31112e['where'][_0xb6bc('0x5d')]=_0x4b10cc['id'];if(_0x27bbbe[_0xb6bc('0x3f')][_0xb6bc('0x4f')]){_0x31112e[_0xb6bc('0x4b')]=_[_0xb6bc('0x4e')](_0x31112e[_0xb6bc('0x4b')],{'$or':_[_0xb6bc('0x50')](_0x31112e[_0xb6bc('0x44')],function(_0x415e84){var _0x1c3910={};_0x1c3910[_0x415e84]={'$like':'%'+_0x27bbbe['query']['filter']+'%'};return _0x1c3910;})});}_0x31112e=_[_0xb6bc('0x4e')]({},_0x31112e,_0x27bbbe['options']);return db[_0xb6bc('0x5e')][_0xb6bc('0x51')]({'where':_0x31112e[_0xb6bc('0x4b')]})[_0xb6bc('0x20')](function(_0x49728f){_0x2d41b6[_0xb6bc('0x51')]=_0x49728f;if(_0x27bbbe['query']['includeAll']){_0x31112e[_0xb6bc('0x52')]=[{'all':!![]}];}return db['Disposition'][_0xb6bc('0x53')](_0x31112e);})['then'](function(_0x34e95e){_0x2d41b6['rows']=_0x34e95e;return _0x2d41b6;});}})[_0xb6bc('0x20')](respondWithFilteredResult(_0x5793bd,_0x31112e))[_0xb6bc('0x28')](handleError(_0x5793bd,null));};exports['removeDispositions']=function(_0x4a6431,_0xdbd11a,_0x236aaf){var _0x8b3f5b;return db[_0xb6bc('0x3c')][_0xb6bc('0x59')]({'where':{'id':_0x4a6431['params']['id']}})['then'](handleEntityNotFound(_0xdbd11a,null))[_0xb6bc('0x20')](function(_0x34da6a){if(_0x34da6a){return _0x34da6a['removeDispositions'](_0x4a6431['query'][_0xb6bc('0x63')]);}})[_0xb6bc('0x20')](respondWithStatusCode(_0xdbd11a,null))[_0xb6bc('0x28')](handleError(_0xdbd11a,null));};exports[_0xb6bc('0x64')]=function(_0x51280f,_0x580666,_0x3a51c8){if(_0x51280f[_0xb6bc('0x5a')]['id']){delete _0x51280f[_0xb6bc('0x5a')]['id'];}return db['MailAccount'][_0xb6bc('0x59')]({'where':{'id':_0x51280f[_0xb6bc('0x56')]['id']}})[_0xb6bc('0x20')](handleEntityNotFound(_0x580666,null))[_0xb6bc('0x20')](function(_0x37f10c){if(_0x37f10c){_0x51280f['body'][_0xb6bc('0x5d')]=_0x37f10c['id'];return db[_0xb6bc('0x65')][_0xb6bc('0x5f')](_0x51280f[_0xb6bc('0x5a')]);}})['then'](respondWithResult(_0x580666,null))['catch'](handleError(_0x580666,null));};exports[_0xb6bc('0x66')]=function(_0x3452ef,_0x424fea,_0x28aed1){var _0x240474={'raw':![],'where':{}};var _0x4771b7={};var _0x20a81e={'count':0x0,'rows':[]};return db[_0xb6bc('0x3c')][_0xb6bc('0x61')]({'where':{'id':_0x3452ef['params']['id']}})[_0xb6bc('0x20')](handleEntityNotFound(_0x424fea,null))[_0xb6bc('0x20')](function(_0x351e40){if(_0x351e40){_0x4771b7['model']=_[_0xb6bc('0x57')](db[_0xb6bc('0x65')][_0xb6bc('0x3d')]);_0x4771b7['query']=_[_0xb6bc('0x57')](_0x3452ef['query']);_0x4771b7[_0xb6bc('0x41')]=_[_0xb6bc('0x42')](_0x4771b7[_0xb6bc('0x43')],_0x4771b7[_0xb6bc('0x3f')]);_0x240474['attributes']=_[_0xb6bc('0x42')](_0x4771b7['model'],qs[_0xb6bc('0x45')](_0x3452ef[_0xb6bc('0x3f')][_0xb6bc('0x45')]));_0x240474[_0xb6bc('0x44')]=_0x240474[_0xb6bc('0x44')][_0xb6bc('0x46')]?_0x240474[_0xb6bc('0x44')]:_0x4771b7[_0xb6bc('0x43')];if(!_0x3452ef['query'][_0xb6bc('0x47')](_0xb6bc('0x67'))){_0x240474[_0xb6bc('0x48')]=qs['limit'](_0x3452ef['query'][_0xb6bc('0x48')]);_0x240474[_0xb6bc('0x2c')]=qs[_0xb6bc('0x2c')](_0x3452ef['query'][_0xb6bc('0x2c')]);}_0x240474[_0xb6bc('0x49')]=qs[_0xb6bc('0x4a')](_0x3452ef['query']['sort']);_0x240474[_0xb6bc('0x4b')]=qs['filters'](_[_0xb6bc('0x62')](_0x3452ef[_0xb6bc('0x3f')],_0x4771b7[_0xb6bc('0x41')]));_0x240474[_0xb6bc('0x4b')]['MailAccountId']=_0x351e40['id'];if(_0x3452ef[_0xb6bc('0x3f')][_0xb6bc('0x4f')]){_0x240474[_0xb6bc('0x4b')]=_[_0xb6bc('0x4e')](_0x240474['where'],{'$or':_[_0xb6bc('0x50')](_0x240474['attributes'],function(_0x3f9491){var _0x153d7c={};_0x153d7c[_0x3f9491]={'$like':'%'+_0x3452ef[_0xb6bc('0x3f')][_0xb6bc('0x4f')]+'%'};return _0x153d7c;})});}_0x240474=_[_0xb6bc('0x4e')]({},_0x240474,_0x3452ef[_0xb6bc('0x58')]);return db[_0xb6bc('0x65')]['count']({'where':_0x240474[_0xb6bc('0x4b')]})[_0xb6bc('0x20')](function(_0x4e266d){_0x20a81e[_0xb6bc('0x51')]=_0x4e266d;if(_0x3452ef[_0xb6bc('0x3f')][_0xb6bc('0x68')]){_0x240474[_0xb6bc('0x52')]=[{'all':!![]}];}return db[_0xb6bc('0x65')]['findAll'](_0x240474);})[_0xb6bc('0x20')](function(_0x4618af){_0x20a81e[_0xb6bc('0x54')]=_0x4618af;return _0x20a81e;});}})[_0xb6bc('0x20')](respondWithFilteredResult(_0x424fea,_0x240474))['catch'](handleError(_0x424fea,null));};exports['removeAnswers']=function(_0x56d965,_0xf03527,_0xda6a3c){var _0x183637;return db['MailAccount'][_0xb6bc('0x59')]({'where':{'id':_0x56d965[_0xb6bc('0x56')]['id']}})[_0xb6bc('0x20')](handleEntityNotFound(_0xf03527,null))[_0xb6bc('0x20')](function(_0x34162d){if(_0x34162d){return _0x34162d[_0xb6bc('0x69')](_0x56d965[_0xb6bc('0x3f')][_0xb6bc('0x63')]);}})[_0xb6bc('0x20')](respondWithStatusCode(_0xf03527,null))[_0xb6bc('0x28')](handleError(_0xf03527,null));};exports[_0xb6bc('0x5f')]=function(_0x8530a5,_0x50476a){var _0x349be3={'name':_0x8530a5[_0xb6bc('0x5a')][_0xb6bc('0x35')],'key':_0x8530a5[_0xb6bc('0x5a')]['key'],'email':_0x8530a5[_0xb6bc('0x5a')]['email'],'ListId':_0x8530a5[_0xb6bc('0x5a')]['ListId'],'active':!_[_0xb6bc('0x6a')](_0x8530a5['body'][_0xb6bc('0x6b')])?_0x8530a5['body'][_0xb6bc('0x6b')]:!![],'description':_0x8530a5['body'][_0xb6bc('0x6c')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x8530a5[_0xb6bc('0x5a')][_0xb6bc('0x6d')])){if(_0x8530a5[_0xb6bc('0x5a')][_0xb6bc('0x6e')]){_0x349be3['Imap'][_0xb6bc('0x6f')]=_0x349be3['Smtp']['user']=_0x8530a5[_0xb6bc('0x5a')][_0xb6bc('0x70')];_0x349be3[_0xb6bc('0x39')][_0xb6bc('0x71')]=_0x349be3[_0xb6bc('0x3b')]['pass']=_0x8530a5[_0xb6bc('0x5a')]['cpassword'];}else{_0x349be3[_0xb6bc('0x39')][_0xb6bc('0x72')]=_0x349be3[_0xb6bc('0x3b')][_0xb6bc('0x72')]=![];}_0x349be3[_0xb6bc('0x39')][_0xb6bc('0x73')]=_0x8530a5[_0xb6bc('0x5a')][_0xb6bc('0x39')][_0xb6bc('0x73')];_0x349be3[_0xb6bc('0x39')][_0xb6bc('0x74')]=_0x8530a5[_0xb6bc('0x5a')]['Imap'][_0xb6bc('0x74')];_0x349be3[_0xb6bc('0x3b')][_0xb6bc('0x73')]=_0x8530a5[_0xb6bc('0x5a')]['Smtp'][_0xb6bc('0x73')];_0x349be3['Smtp']['port']=_0x8530a5[_0xb6bc('0x5a')][_0xb6bc('0x3b')][_0xb6bc('0x74')];}else{_0x349be3['Imap']['service']=_0x349be3[_0xb6bc('0x3b')][_0xb6bc('0x75')]=_0x8530a5['body']['cservice'];_0x349be3[_0xb6bc('0x39')][_0xb6bc('0x6f')]=_0x349be3['Smtp'][_0xb6bc('0x6f')]=_0x8530a5[_0xb6bc('0x5a')][_0xb6bc('0x70')];_0x349be3[_0xb6bc('0x39')][_0xb6bc('0x71')]=_0x349be3[_0xb6bc('0x3b')][_0xb6bc('0x76')]=_0x8530a5[_0xb6bc('0x5a')][_0xb6bc('0x77')];}return db[_0xb6bc('0x3c')][_0xb6bc('0x5f')](_0x349be3,{'include':[{'model':db[_0xb6bc('0x3a')],'as':'Smtp'},{'model':db[_0xb6bc('0x38')],'as':_0xb6bc('0x39')}]})['then'](respondWithResult(_0x50476a,0xc9))['catch'](handleError(_0x50476a,null));};exports[_0xb6bc('0x78')]=function(_0x59a866,_0x25ddca,_0x58d031){return db[_0xb6bc('0x3c')]['findOne']({'where':{'id':_0x59a866[_0xb6bc('0x56')]['id']}})[_0xb6bc('0x20')](handleEntityNotFound(_0x25ddca,null))[_0xb6bc('0x20')](function(_0x134f1c){if(_0x134f1c){return _0x134f1c[_0xb6bc('0x78')]();}return null;})[_0xb6bc('0x20')](respondWithResult(_0x25ddca,null))['catch'](handleError(_0x25ddca,null));};exports[_0xb6bc('0x79')]=function(_0x5de1bd,_0x2213b1,_0x14d194){if(_0x5de1bd['body']['id']){delete _0x5de1bd[_0xb6bc('0x5a')]['id'];}return db[_0xb6bc('0x3c')][_0xb6bc('0x59')]({'where':{'id':_0x5de1bd[_0xb6bc('0x56')]['id']}})[_0xb6bc('0x20')](handleEntityNotFound(_0x2213b1,null))[_0xb6bc('0x20')](function(_0x466904){if(_0x466904){_0x5de1bd[_0xb6bc('0x5a')][_0xb6bc('0x5d')]=_0x466904['id'];return db['MailServerIn'][_0xb6bc('0x5f')](_0x5de1bd[_0xb6bc('0x5a')]);}})[_0xb6bc('0x20')](respondWithResult(_0x2213b1,null))[_0xb6bc('0x28')](handleError(_0x2213b1,null));};exports['removeImap']=function(_0x134632,_0x50b2b6,_0x4d250e){return db[_0xb6bc('0x3c')][_0xb6bc('0x61')]({'where':{'id':_0x134632[_0xb6bc('0x56')]['id']}})[_0xb6bc('0x20')](handleEntityNotFound(_0x50b2b6,null))[_0xb6bc('0x20')](function(_0x36713b){if(_0x36713b){return _0x36713b[_0xb6bc('0x7a')](null);}return null;})['then'](respondWithStatusCode(_0x50b2b6,null))[_0xb6bc('0x28')](handleError(_0x50b2b6,null));};exports[_0xb6bc('0x7b')]=function(_0x29c24e,_0x59a38c,_0x2575ad){return db[_0xb6bc('0x3c')][_0xb6bc('0x61')]({'where':{'id':_0x29c24e[_0xb6bc('0x56')]['id']}})[_0xb6bc('0x20')](handleEntityNotFound(_0x59a38c,null))[_0xb6bc('0x20')](function(_0x11e2ae){if(_0x11e2ae){return _0x11e2ae[_0xb6bc('0x7b')]();}return null;})['then'](respondWithResult(_0x59a38c,null))[_0xb6bc('0x28')](handleError(_0x59a38c,null));};exports['addSmtp']=function(_0x31f4cb,_0x38b164,_0x6d1543){if(_0x31f4cb[_0xb6bc('0x5a')]['id']){delete _0x31f4cb[_0xb6bc('0x5a')]['id'];}return db[_0xb6bc('0x3c')][_0xb6bc('0x59')]({'where':{'id':_0x31f4cb[_0xb6bc('0x56')]['id']}})[_0xb6bc('0x20')](handleEntityNotFound(_0x38b164,null))['then'](function(_0x131576){if(_0x131576){_0x31f4cb['body'][_0xb6bc('0x5d')]=_0x131576['id'];return db[_0xb6bc('0x3a')][_0xb6bc('0x5f')](_0x31f4cb[_0xb6bc('0x5a')]);}})[_0xb6bc('0x20')](respondWithResult(_0x38b164,null))['catch'](handleError(_0x38b164,null));};exports[_0xb6bc('0x7c')]=function(_0x46e479,_0x2a4d44,_0x27588d){return db[_0xb6bc('0x3c')]['findOne']({'where':{'id':_0x46e479[_0xb6bc('0x56')]['id']}})[_0xb6bc('0x20')](handleEntityNotFound(_0x2a4d44,null))[_0xb6bc('0x20')](function(_0xcb7173){if(_0xcb7173){return _0xcb7173[_0xb6bc('0x7d')](null);}return null;})['then'](respondWithStatusCode(_0x2a4d44,null))[_0xb6bc('0x28')](handleError(_0x2a4d44,null));};exports['addInteraction']=function(_0x556385,_0x5b1824,_0x31a210){return db['MailInteraction'][_0xb6bc('0x59')]({'where':{'id':_0x556385[_0xb6bc('0x56')]['id']}})[_0xb6bc('0x20')](handleEntityNotFound(_0x5b1824,null))[_0xb6bc('0x20')](function(_0x5aa4ff){if(_0x5aa4ff){return _0x5aa4ff[_0xb6bc('0x7e')](_0x556385[_0xb6bc('0x5a')][_0xb6bc('0x63')],_[_0xb6bc('0x7f')](_0x556385[_0xb6bc('0x5a')],[_0xb6bc('0x63'),'id'])||{});}})[_0xb6bc('0x20')](respondWithResult(_0x5b1824,null))['catch'](handleError(_0x5b1824,null));};exports['getInteractions']=function(_0x5a49c0,_0x56ff74,_0x4fe100){var _0x28f6da={'raw':![],'where':{}};var _0x79a7f6={};var _0x18e3ea={'count':0x0,'rows':[]};return db[_0xb6bc('0x3c')][_0xb6bc('0x61')]({'where':{'id':_0x5a49c0['params']['id']}})[_0xb6bc('0x20')](handleEntityNotFound(_0x56ff74,null))['then'](function(_0x225b54){if(_0x225b54){_0x79a7f6['model']=_['keys'](db[_0xb6bc('0x80')]['rawAttributes']);_0x79a7f6[_0xb6bc('0x3f')]=_['keys'](_0x5a49c0['query']);_0x79a7f6[_0xb6bc('0x41')]=_[_0xb6bc('0x42')](_0x79a7f6[_0xb6bc('0x43')],_0x79a7f6['query']);_0x28f6da[_0xb6bc('0x44')]=_[_0xb6bc('0x42')](_0x79a7f6[_0xb6bc('0x43')],qs[_0xb6bc('0x45')](_0x5a49c0['query']['fields']));_0x28f6da[_0xb6bc('0x44')]=_0x28f6da[_0xb6bc('0x44')][_0xb6bc('0x46')]?_0x28f6da[_0xb6bc('0x44')]:_0x79a7f6[_0xb6bc('0x43')];if(!_0x5a49c0['query']['hasOwnProperty']('nolimit')){_0x28f6da[_0xb6bc('0x48')]=qs[_0xb6bc('0x48')](_0x5a49c0[_0xb6bc('0x3f')][_0xb6bc('0x48')]);_0x28f6da[_0xb6bc('0x2c')]=qs['offset'](_0x5a49c0[_0xb6bc('0x3f')]['offset']);}_0x28f6da[_0xb6bc('0x49')]=qs['sort'](_0x5a49c0[_0xb6bc('0x3f')]['sort']);_0x28f6da[_0xb6bc('0x4b')]=qs[_0xb6bc('0x41')](_['pick'](_0x5a49c0[_0xb6bc('0x3f')],_0x79a7f6['filters']));_0x28f6da['where'][_0xb6bc('0x5d')]=_0x225b54['id'];if(_0x5a49c0['query'][_0xb6bc('0x4f')]){_0x28f6da[_0xb6bc('0x4b')]=_[_0xb6bc('0x4e')](_0x28f6da[_0xb6bc('0x4b')],{'$or':_[_0xb6bc('0x50')](_0x28f6da[_0xb6bc('0x44')],function(_0xaa457a){var _0x55cf6a={};_0x55cf6a[_0xaa457a]={'$like':'%'+_0x5a49c0[_0xb6bc('0x3f')]['filter']+'%'};return _0x55cf6a;})});}_0x28f6da=_['merge']({},_0x28f6da,_0x5a49c0[_0xb6bc('0x58')]);return db[_0xb6bc('0x80')][_0xb6bc('0x51')]({'where':_0x28f6da[_0xb6bc('0x4b')]})['then'](function(_0x17fcad){_0x18e3ea[_0xb6bc('0x51')]=_0x17fcad;if(_0x5a49c0[_0xb6bc('0x3f')][_0xb6bc('0x68')]){_0x28f6da['include']=[{'model':db['CmContact'],'as':_0xb6bc('0x81'),'required':![]},{'model':db['User'],'as':_0xb6bc('0x82'),'attributes':[_0xb6bc('0x35'),_0xb6bc('0x83'),_0xb6bc('0x84')],'required':![]},{'model':db[_0xb6bc('0x85')],'as':_0xb6bc('0x86'),'attributes':['id','name',_0xb6bc('0x87')],'where':_0x5a49c0[_0xb6bc('0x3f')][_0xb6bc('0x88')]?{'id':_0x5a49c0[_0xb6bc('0x3f')][_0xb6bc('0x88')]}:undefined,'required':_0x5a49c0[_0xb6bc('0x3f')]['tag']?!![]:![]}];}return db[_0xb6bc('0x80')][_0xb6bc('0x53')](_0x28f6da);})['then'](function(_0x436c9a){_0x18e3ea[_0xb6bc('0x54')]=_0x436c9a;return _0x18e3ea;});}})[_0xb6bc('0x20')](respondWithFilteredResult(_0x56ff74,_0x28f6da))[_0xb6bc('0x28')](handleError(_0x56ff74,null));};exports['addApplications']=function(_0x4854bc,_0xc57e06,_0x469437){return db[_0xb6bc('0x3c')][_0xb6bc('0x61')]({'where':{'id':_0x4854bc[_0xb6bc('0x56')]['id']}})[_0xb6bc('0x20')](handleEntityNotFound(_0xc57e06,null))['then'](function(_0x448286){if(_0x448286){return db['sequelize'][_0xb6bc('0x89')](function(_0x197855){return db[_0xb6bc('0x8a')][_0xb6bc('0x33')]({'where':{'MailAccountId':_0x4854bc[_0xb6bc('0x56')]['id']},'transaction':_0x197855})[_0xb6bc('0x20')](function(_0x4d7b5f){var _0x4fcdfd=_[_0xb6bc('0x50')](_0x4854bc['body'],function(_0x58fc0f){_0x58fc0f[_0xb6bc('0x5d')]=_0x4854bc[_0xb6bc('0x56')]['id'];return _0x58fc0f;});return db[_0xb6bc('0x8a')][_0xb6bc('0x8b')](_0x4fcdfd,{'transaction':_0x197855});});})[_0xb6bc('0x20')](function(){return db['MailApplication'][_0xb6bc('0x8c')]({'where':{'MailAccountId':_0x4854bc[_0xb6bc('0x56')]['id']},'order':_0xb6bc('0x8d')});});}})['then'](respondWithResult(_0xc57e06,null))[_0xb6bc('0x28')](handleError(_0xc57e06,null));};exports[_0xb6bc('0x8e')]=function(_0x1f9ac9,_0xbf599c,_0x53e9d5){var _0x50ea0a={};var _0x58ed63={};var _0x4a86b6;var _0xf7d5e4;return db[_0xb6bc('0x3c')][_0xb6bc('0x61')]({'where':{'id':_0x1f9ac9[_0xb6bc('0x56')]['id']}})[_0xb6bc('0x20')](handleEntityNotFound(_0xbf599c,null))[_0xb6bc('0x20')](function(_0x1b044a){if(_0x1b044a){_0x4a86b6=_0x1b044a;_0x58ed63[_0xb6bc('0x43')]=_['keys'](db[_0xb6bc('0x8a')][_0xb6bc('0x3d')]);_0x58ed63[_0xb6bc('0x3f')]=_[_0xb6bc('0x57')](_0x1f9ac9[_0xb6bc('0x3f')]);_0x58ed63[_0xb6bc('0x41')]=_[_0xb6bc('0x42')](_0x58ed63[_0xb6bc('0x43')],_0x58ed63[_0xb6bc('0x3f')]);_0x50ea0a[_0xb6bc('0x44')]=_[_0xb6bc('0x42')](_0x58ed63[_0xb6bc('0x43')],qs[_0xb6bc('0x45')](_0x1f9ac9[_0xb6bc('0x3f')]['fields']));_0x50ea0a[_0xb6bc('0x44')]=_0x50ea0a[_0xb6bc('0x44')][_0xb6bc('0x46')]?_0x50ea0a[_0xb6bc('0x44')]:_0x58ed63[_0xb6bc('0x43')];_0x50ea0a[_0xb6bc('0x49')]=qs[_0xb6bc('0x4a')](_0x1f9ac9[_0xb6bc('0x3f')][_0xb6bc('0x4a')]);_0x50ea0a['where']=qs[_0xb6bc('0x41')](_['pick'](_0x1f9ac9['query'],_0x58ed63[_0xb6bc('0x41')]));if(_0x1f9ac9['query'][_0xb6bc('0x4f')]){_0x50ea0a[_0xb6bc('0x4b')]=_[_0xb6bc('0x4e')](_0x50ea0a[_0xb6bc('0x4b')],{'$or':_[_0xb6bc('0x50')](_0x50ea0a[_0xb6bc('0x44')],function(_0x223f3b){var _0x2ebb49={};_0x2ebb49[_0x223f3b]={'$like':'%'+_0x1f9ac9[_0xb6bc('0x3f')][_0xb6bc('0x4f')]+'%'};return _0x2ebb49;})});}_0x50ea0a=_[_0xb6bc('0x4e')]({},_0x50ea0a,_0x1f9ac9[_0xb6bc('0x58')]);return _0x4a86b6['getApplications'](_0x50ea0a);}})[_0xb6bc('0x20')](function(_0x5e6447){if(_0x5e6447){_0xf7d5e4=_0x5e6447[_0xb6bc('0x46')];if(!_0x1f9ac9['query'][_0xb6bc('0x47')](_0xb6bc('0x67'))){_0x50ea0a['limit']=qs[_0xb6bc('0x48')](_0x1f9ac9[_0xb6bc('0x3f')]['limit']);_0x50ea0a[_0xb6bc('0x2c')]=qs[_0xb6bc('0x2c')](_0x1f9ac9[_0xb6bc('0x3f')][_0xb6bc('0x2c')]);}return _0x4a86b6[_0xb6bc('0x8e')](_0x50ea0a);}})['then'](function(_0x375df5){if(_0x375df5){return _0x375df5?{'count':_0xf7d5e4,'rows':_0x375df5}:null;}})[_0xb6bc('0x20')](respondWithResult(_0xbf599c,null))[_0xb6bc('0x28')](handleError(_0xbf599c,null));};exports[_0xb6bc('0x8f')]=function(_0x4a81db,_0x40fe57,_0x463a28){var _0x5a024f={'raw':!![],'where':{}};var _0x213c85={};var _0x339c7e={'count':0x0,'rows':[]};return db[_0xb6bc('0x3c')]['findOne']({'where':{'id':_0x4a81db[_0xb6bc('0x56')]['id']}})[_0xb6bc('0x20')](handleEntityNotFound(_0x40fe57,null))[_0xb6bc('0x20')](function(_0x55eaa4){if(_0x55eaa4){_0x213c85[_0xb6bc('0x43')]=_[_0xb6bc('0x57')](db[_0xb6bc('0x90')]['rawAttributes']);_0x213c85[_0xb6bc('0x3f')]=_[_0xb6bc('0x57')](_0x4a81db[_0xb6bc('0x3f')]);_0x213c85[_0xb6bc('0x41')]=_['intersection'](_0x213c85[_0xb6bc('0x43')],_0x213c85[_0xb6bc('0x3f')]);_0x5a024f['attributes']=_['intersection'](_0x213c85['model'],qs['fields'](_0x4a81db['query']['fields']));_0x5a024f['attributes']=_0x5a024f[_0xb6bc('0x44')][_0xb6bc('0x46')]?_0x5a024f[_0xb6bc('0x44')]:_0x213c85[_0xb6bc('0x43')];if(!_0x4a81db[_0xb6bc('0x3f')][_0xb6bc('0x47')](_0xb6bc('0x67'))){_0x5a024f[_0xb6bc('0x48')]=qs[_0xb6bc('0x48')](_0x4a81db[_0xb6bc('0x3f')][_0xb6bc('0x48')]);_0x5a024f['offset']=qs['offset'](_0x4a81db[_0xb6bc('0x3f')][_0xb6bc('0x2c')]);}_0x5a024f[_0xb6bc('0x49')]=qs[_0xb6bc('0x4a')](_0x4a81db[_0xb6bc('0x3f')][_0xb6bc('0x4a')]);_0x5a024f[_0xb6bc('0x4b')]=qs['filters'](_[_0xb6bc('0x62')](_0x4a81db['query'],_0x213c85['filters']));_0x5a024f[_0xb6bc('0x4b')][_0xb6bc('0x5d')]=_0x55eaa4['id'];if(_0x4a81db[_0xb6bc('0x3f')][_0xb6bc('0x4f')]){_0x5a024f[_0xb6bc('0x4b')]=_[_0xb6bc('0x4e')](_0x5a024f[_0xb6bc('0x4b')],{'$or':_[_0xb6bc('0x50')](_0x5a024f[_0xb6bc('0x44')],function(_0x560867){var _0x5f441c={};_0x5f441c[_0x560867]={'$like':'%'+_0x4a81db[_0xb6bc('0x3f')][_0xb6bc('0x4f')]+'%'};return _0x5f441c;})});}if(_0x4a81db['query']['$gte']){var _0x16734b=_0x4a81db[_0xb6bc('0x3f')]['$gte'][_0xb6bc('0x91')](',');var _0x43f2ad={};_0x43f2ad[_0x16734b[0x0]]={'$gte':moment(_0x16734b[0x1])[_0xb6bc('0x92')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5a024f[_0xb6bc('0x4b')]=_[_0xb6bc('0x4e')](_0x5a024f['where'],_0x43f2ad);}_0x5a024f=_[_0xb6bc('0x4e')]({},_0x5a024f,_0x4a81db[_0xb6bc('0x58')]);return db[_0xb6bc('0x90')][_0xb6bc('0x51')]({'where':_0x5a024f[_0xb6bc('0x4b')]})['then'](function(_0x3ec6cb){_0x339c7e[_0xb6bc('0x51')]=_0x3ec6cb;if(_0x4a81db[_0xb6bc('0x3f')][_0xb6bc('0x68')]){_0x5a024f[_0xb6bc('0x52')]=[{'all':!![]}];}return db[_0xb6bc('0x90')]['findAll'](_0x5a024f);})[_0xb6bc('0x20')](function(_0x2f3984){_0x339c7e[_0xb6bc('0x54')]=_0x2f3984;return _0x339c7e;});}})['then'](respondWithFilteredResult(_0x40fe57,_0x5a024f))[_0xb6bc('0x28')](handleError(_0x40fe57,null));};exports['send']=function(_0x4fcad2,_0x15e376,_0x41fd58){var _0x27d5cc,_0x437564={},_0x4736fc;if(_0x4fcad2[_0xb6bc('0x5a')]['to']){_0x4736fc=_0x4fcad2[_0xb6bc('0x5a')]['to']['split'](',')[0x0];}return db[_0xb6bc('0x3c')][_0xb6bc('0x59')]({'where':{'id':_0x4fcad2['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xb6bc('0x93')],'as':'Contacts','where':{'email':_0x4736fc},'limit':0x1,'order':[[_0xb6bc('0x94'),'DESC']]}]},{'model':db[_0xb6bc('0x3a')],'as':'Smtp','raw':!![]}]})['then'](handleEntityNotFound(_0x15e376,null))[_0xb6bc('0x20')](function(_0x3cda4c){if(_0x3cda4c){_0x27d5cc=_0x3cda4c;if(_0x3cda4c[_0xb6bc('0x3b')]){if(_[_0xb6bc('0x6a')](_0x4fcad2[_0xb6bc('0x5a')]['from'])){_0x4fcad2[_0xb6bc('0x5a')][_0xb6bc('0x95')]=util[_0xb6bc('0x92')](_0xb6bc('0x96'),_0x3cda4c[_0xb6bc('0x35')],_0x3cda4c[_0xb6bc('0x97')]||_0x3cda4c['Smtp'][_0xb6bc('0x6f')]);}if(_0x4fcad2[_0xb6bc('0x5a')]['attachments']&&_0x4fcad2[_0xb6bc('0x5a')]['attachments'][_0xb6bc('0x46')]){for(var _0xb6c10d=0x0;_0xb6c10d<_0x4fcad2[_0xb6bc('0x5a')][_0xb6bc('0x98')]['length'];_0xb6c10d+=0x1){_0x4fcad2[_0xb6bc('0x5a')][_0xb6bc('0x98')][_0xb6c10d]={'filename':_0x4fcad2[_0xb6bc('0x5a')][_0xb6bc('0x98')][_0xb6c10d][_0xb6bc('0x35')],'path':path[_0xb6bc('0x99')](config['root'],'server/files/attachments',_0x4fcad2[_0xb6bc('0x5a')][_0xb6bc('0x98')][_0xb6c10d][_0xb6bc('0x9a')])};}}var _0x328067={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x3cda4c[_0xb6bc('0x3b')][_0xb6bc('0x75')])){if(_0x3cda4c[_0xb6bc('0x3b')]['authentication']){_0x328067['auth']={'user':_0x3cda4c['Smtp'][_0xb6bc('0x6f')],'pass':_0x3cda4c[_0xb6bc('0x3b')]['pass']};}_0x328067[_0xb6bc('0x73')]=_0x3cda4c[_0xb6bc('0x3b')][_0xb6bc('0x73')];_0x328067[_0xb6bc('0x74')]=_0x3cda4c[_0xb6bc('0x3b')][_0xb6bc('0x74')];_0x328067['secure']=_0x3cda4c[_0xb6bc('0x3b')]['secure'];}else{_0x328067['service']=_0x3cda4c['Smtp'][_0xb6bc('0x75')];_0x328067['auth']={'user':_0x3cda4c[_0xb6bc('0x3b')][_0xb6bc('0x6f')],'pass':_0x3cda4c[_0xb6bc('0x3b')]['pass']};}return respondWithRpcPromise(_0xb6bc('0x9b'),'sendMail',{'account':_0x328067,'message':_0x4fcad2[_0xb6bc('0x5a')]});}else{throw new Error(_0xb6bc('0x9c'));}}})[_0xb6bc('0x20')](function(_0x3e00f6){if(_0x3e00f6){_0x437564=_0x3e00f6;if(_0x27d5cc[_0xb6bc('0x9d')]){if(_0x27d5cc[_0xb6bc('0x9d')]['Contacts'][_0xb6bc('0x46')]){return _0x27d5cc[_0xb6bc('0x9d')]['Contacts'][0x0];}else{return db['CmContact'][_0xb6bc('0x5f')](_[_0xb6bc('0x18')](_0x4fcad2[_0xb6bc('0x5a')],{'firstName':_0x4fcad2['body']['to'],'email':_0x4fcad2[_0xb6bc('0x5a')]['to'],'phone':_0x4fcad2[_0xb6bc('0x5a')]['to'],'ListId':_0x27d5cc['ListId']}));}}else{throw new Error(_0xb6bc('0x9c'));}}})[_0xb6bc('0x20')](function(_0x16f80d){if(_0x16f80d){var _0x34bc7b={'UserId':_0x4fcad2[_0xb6bc('0x6f')]['id'],'ContactId':_0x16f80d['id'],'MailAccountId':_0x27d5cc['id'],'inReplyTo':_0x437564[_0xb6bc('0x9e')],'to':_0x4fcad2['body'][_0xb6bc('0x95')],'cc':_0x4fcad2[_0xb6bc('0x5a')]['cc'],'subject':_0x4fcad2[_0xb6bc('0x5a')][_0xb6bc('0x9f')],'attach':_0x4fcad2[_0xb6bc('0x5a')][_0xb6bc('0xa0')],'firstMsgDirection':'out','lastMsgAt':moment()['format'](_0xb6bc('0xa1')),'lastMsgDirection':_0xb6bc('0xa2'),'lastMsgBody':_0x4fcad2[_0xb6bc('0x5a')][_0xb6bc('0x5a')],'Messages':[_[_0xb6bc('0x4e')](_0x4fcad2['body'],{'messageId':_0x437564[_0xb6bc('0x9e')],'sentAt':moment()[_0xb6bc('0x92')](_0xb6bc('0xa1')),'read':!![],'MailAccountId':_0x27d5cc['id'],'UserId':_0x4fcad2[_0xb6bc('0x6f')]['id'],'ContactId':_0x16f80d['id']})]};if(_0x4fcad2[_0xb6bc('0x5a')][_0xb6bc('0xa3')]){_0x34bc7b=_['merge'](_0x34bc7b,_0x4fcad2[_0xb6bc('0x5a')][_0xb6bc('0xa3')]);}return db['MailInteraction'][_0xb6bc('0x5f')](_0x34bc7b,{'include':[{'model':db[_0xb6bc('0x90')],'as':_0xb6bc('0xa4')}]});}})[_0xb6bc('0x20')](respondWithResult(_0x15e376,null))[_0xb6bc('0x28')](handleError(_0x15e376,null));};exports['verifySmtp']=function(_0x39f474,_0xf8045a,_0x1ccdf0){return db[_0xb6bc('0x3c')][_0xb6bc('0x59')]({'where':{'id':_0x39f474[_0xb6bc('0x56')]['id']},'include':[{'model':db[_0xb6bc('0x3a')],'as':_0xb6bc('0x3b'),'raw':!![]}]})['then'](handleEntityNotFound(_0xf8045a,null))[_0xb6bc('0x20')](function(_0x2be75a){if(_0x2be75a&&_0x2be75a[_0xb6bc('0x3b')]){var _0xc0035b={'id':_0x2be75a['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2be75a['Smtp'][_0xb6bc('0x75')]){_0xc0035b[_0xb6bc('0x75')]=_0x2be75a[_0xb6bc('0x3b')][_0xb6bc('0x75')];}else{_0xc0035b[_0xb6bc('0x73')]=_0x2be75a[_0xb6bc('0x3b')]['host'];_0xc0035b[_0xb6bc('0x74')]=_0x2be75a[_0xb6bc('0x3b')]['port'];_0xc0035b['secure']=_0x2be75a[_0xb6bc('0x3b')]['secure'];}if(_0x2be75a['Smtp'][_0xb6bc('0x72')]){_0xc0035b['auth']={'user':_0x2be75a['Smtp'][_0xb6bc('0x6f')],'pass':_0x2be75a[_0xb6bc('0x3b')][_0xb6bc('0x76')]};}return respondWithRpcPromise(_0xb6bc('0xa5'),_0xb6bc('0xa6'),{'account':_0xc0035b});}})[_0xb6bc('0x20')](respondWithResult(_0xf8045a,null))['catch'](handleError(_0xf8045a,null));};exports[_0xb6bc('0x33')]=function(_0x5435bc,_0x515063){return db[_0xb6bc('0x3c')]['find']({'where':{'id':_0x5435bc[_0xb6bc('0x56')]['id']}})[_0xb6bc('0x20')](handleEntityNotFound(_0x515063,null))[_0xb6bc('0x20')](function(_0x396f1e){if(_0x396f1e&&_0x396f1e['service']){throw new db['Sequelize'][(_0xb6bc('0xa7'))](_0xb6bc('0xa8'));}return _0x396f1e;})[_0xb6bc('0x20')](removeEntity(_0x515063,null))[_0xb6bc('0x28')](handleError(_0x515063,null));};exports[_0xb6bc('0xa9')]=function(_0x597ee4,_0x1687d8,_0x462298){return db['MailAccount'][_0xb6bc('0x59')]({'where':{'id':_0x597ee4[_0xb6bc('0x56')]['id']}})[_0xb6bc('0x20')](handleEntityNotFound(_0x1687d8,null))['then'](function(_0x1f6f5e){if(_0x1f6f5e){return _0x1f6f5e[_0xb6bc('0xa9')](_0x597ee4[_0xb6bc('0x5a')]['ids'],_[_0xb6bc('0x7f')](_0x597ee4[_0xb6bc('0x5a')],[_0xb6bc('0x63'),'id'])||{})['spread'](function(_0x3d4d60){for(var _0x23c8e7=0x0;_0x23c8e7<_0x597ee4[_0xb6bc('0x5a')][_0xb6bc('0x63')][_0xb6bc('0x46')];_0x23c8e7+=0x1){socket['emit'](_0xb6bc('0xaa'),{'UserId':_0x597ee4[_0xb6bc('0x5a')][_0xb6bc('0x63')][_0x23c8e7],'MailAccountId':_0x597ee4[_0xb6bc('0x56')]['id']});}return _0x3d4d60;});}})[_0xb6bc('0x20')](respondWithResult(_0x1687d8,null))[_0xb6bc('0x28')](handleError(_0x1687d8,null));};exports[_0xb6bc('0xab')]=function(_0x15dadd,_0x39aef4,_0x121777){var _0x518c6f;return db[_0xb6bc('0x3c')][_0xb6bc('0x59')]({'where':{'id':_0x15dadd[_0xb6bc('0x56')]['id']}})[_0xb6bc('0x20')](handleEntityNotFound(_0x39aef4,null))[_0xb6bc('0x20')](function(_0x46bca2){if(_0x46bca2){return _0x46bca2[_0xb6bc('0xab')](_0x15dadd[_0xb6bc('0x3f')][_0xb6bc('0x63')])[_0xb6bc('0x20')](function(_0x29bb0c){if(_[_0xb6bc('0xac')](_0x15dadd[_0xb6bc('0x3f')][_0xb6bc('0x63')])){for(var _0x2fd474=0x0;_0x2fd474<_0x15dadd['query'][_0xb6bc('0x63')][_0xb6bc('0x46')];_0x2fd474+=0x1){socket[_0xb6bc('0xad')](_0xb6bc('0xae'),{'UserId':_0x15dadd[_0xb6bc('0x3f')][_0xb6bc('0x63')][_0x2fd474],'MailAccountId':_0x15dadd['params']['id']});}}else{socket['emit']('userMailAccount:remove',{'UserId':_0x15dadd[_0xb6bc('0x3f')]['ids'],'MailAccountId':_0x15dadd['params']['id']});}});}})['then'](respondWithStatusCode(_0x39aef4,null))[_0xb6bc('0x28')](handleError(_0x39aef4,null));};exports['getAgents']=function(_0x32f0fe,_0x5e2c54,_0x4316a3){var _0x1d2145={};var _0x1f76c6={};var _0x2bbba7;var _0x47c7e1;return db[_0xb6bc('0x3c')][_0xb6bc('0x61')]({'where':{'id':_0x32f0fe[_0xb6bc('0x56')]['id']}})[_0xb6bc('0x20')](handleEntityNotFound(_0x5e2c54,null))[_0xb6bc('0x20')](function(_0x2bcfea){if(_0x2bcfea){_0x2bbba7=_0x2bcfea;_0x1f76c6['model']=_[_0xb6bc('0x57')](db[_0xb6bc('0xaf')][_0xb6bc('0x3d')]);_0x1f76c6[_0xb6bc('0x3f')]=_[_0xb6bc('0x57')](_0x32f0fe['query']);_0x1f76c6['filters']=_['intersection'](_0x1f76c6[_0xb6bc('0x43')],_0x1f76c6[_0xb6bc('0x3f')]);_0x1d2145[_0xb6bc('0x44')]=_['intersection'](_0x1f76c6[_0xb6bc('0x43')],qs['fields'](_0x32f0fe[_0xb6bc('0x3f')]['fields']));_0x1d2145[_0xb6bc('0x44')]=_0x1d2145['attributes']['length']?_0x1d2145['attributes']:_0x1f76c6[_0xb6bc('0x43')];_0x1d2145[_0xb6bc('0x49')]=qs[_0xb6bc('0x4a')](_0x32f0fe['query'][_0xb6bc('0x4a')]);_0x1d2145[_0xb6bc('0x4b')]=qs[_0xb6bc('0x41')](_[_0xb6bc('0x62')](_0x32f0fe[_0xb6bc('0x3f')],_0x1f76c6[_0xb6bc('0x41')]));if(_0x32f0fe['query']['filter']){_0x1d2145[_0xb6bc('0x4b')]=_[_0xb6bc('0x4e')](_0x1d2145['where'],{'$or':_[_0xb6bc('0x50')](_0x1d2145[_0xb6bc('0x44')],function(_0x3bffa7){var _0x1dd9cf={};_0x1dd9cf[_0x3bffa7]={'$like':'%'+_0x32f0fe[_0xb6bc('0x3f')][_0xb6bc('0x4f')]+'%'};return _0x1dd9cf;})});}_0x1d2145=_[_0xb6bc('0x4e')]({},_0x1d2145,_0x32f0fe[_0xb6bc('0x58')]);return _0x2bbba7[_0xb6bc('0xb0')](_0x1d2145);}})['then'](function(_0x14df56){if(_0x14df56){_0x47c7e1=_0x14df56[_0xb6bc('0x46')];if(!_0x32f0fe[_0xb6bc('0x3f')]['hasOwnProperty'](_0xb6bc('0x67'))){_0x1d2145[_0xb6bc('0x48')]=qs[_0xb6bc('0x48')](_0x32f0fe['query'][_0xb6bc('0x48')]);_0x1d2145[_0xb6bc('0x2c')]=qs[_0xb6bc('0x2c')](_0x32f0fe[_0xb6bc('0x3f')][_0xb6bc('0x2c')]);}return _0x2bbba7['getAgents'](_0x1d2145);}})['then'](function(_0x89808e){if(_0x89808e){return _0x89808e?{'count':_0x47c7e1,'rows':_0x89808e}:null;}})[_0xb6bc('0x20')](respondWithResult(_0x5e2c54,null))[_0xb6bc('0x28')](handleError(_0x5e2c54,null));}; \ No newline at end of file +var _0xffa9=['basename','auth','secure','pass','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','Sequelize','ValidationError','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','destroy','end','stack','name','index','MailServerIn','MailServerOut','Smtp','MailAccount','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','day','merge','filter','options','includeAll','include','findAll','rows','show','params','length','find','update','body','Imap','describe','MailAccountId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','addAnswer','getAnswers','CannedAnswer','map','removeAnswers','ids','create','key','ListId','isNil','active','cauthentication','user','password','cpassword','authentication','port','host','service','cservice','cuser','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','transaction','MailApplication','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','send','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','email','attachments','join','server/files/attachments'];(function(_0x2243c1,_0x4a4bdc){var _0x4c6d38=function(_0x338ab1){while(--_0x338ab1){_0x2243c1['push'](_0x2243c1['shift']());}};_0x4c6d38(++_0x4a4bdc);}(_0xffa9,0xd0));var _0x9ffa=function(_0x2341ab,_0x326a6c){_0x2341ab=_0x2341ab-0x0;var _0x54533e=_0xffa9[_0x2341ab];return _0x54533e;};'use strict';var pdf=require(_0x9ffa('0x0'));var emlformat=require(_0x9ffa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9ffa('0x2'));var jsonpatch=require(_0x9ffa('0x3'));var rp=require(_0x9ffa('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9ffa('0x5'));var util=require(_0x9ffa('0x6'));var path=require(_0x9ffa('0x7'));var sox=require(_0x9ffa('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x9ffa('0x9'));var squel=require(_0x9ffa('0xa'));var crypto=require(_0x9ffa('0xb'));var jsforce=require(_0x9ffa('0xc'));var deskjs=require(_0x9ffa('0xd'));var toCsv=require(_0x9ffa('0xe'));var querystring=require(_0x9ffa('0xf'));var Papa=require(_0x9ffa('0x10'));var Redis=require('ioredis');var qs=require(_0x9ffa('0x11'));var logger=require(_0x9ffa('0x12'))(_0x9ffa('0x13'));var utils=require(_0x9ffa('0x14'));var config=require(_0x9ffa('0x15'));var db=require(_0x9ffa('0x16'))['db'];config[_0x9ffa('0x17')]=_[_0x9ffa('0x18')](config['redis'],{'host':_0x9ffa('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9ffa('0x17')]));require('./mailAccount.socket')[_0x9ffa('0x1a')](socket);var jayson=require(_0x9ffa('0x1b'));var client=jayson[_0x9ffa('0x1c')][_0x9ffa('0x1d')]({'port':0x232b});function respondWithRpcPromise(_0x2ee47b,_0x135c55,_0x5af0c0,_0x3187a3){return new BPromise(function(_0x424f8d,_0x31c459){var _0x42ca27=_0x3187a3||client;return _0x42ca27[_0x9ffa('0x1e')](_0x2ee47b,_0x5af0c0)[_0x9ffa('0x1f')](function(_0x4e127c){logger[_0x9ffa('0x20')](_0x9ffa('0x21'),_0x135c55,_0x9ffa('0x22'));logger[_0x9ffa('0x23')](_0x9ffa('0x24'),_0x135c55,_0x9ffa('0x22'),JSON[_0x9ffa('0x25')](_0x4e127c));if(_0x4e127c['error']){if(_0x4e127c[_0x9ffa('0x26')]['code']===0x1f4){logger[_0x9ffa('0x26')](_0x9ffa('0x21'),_0x135c55,_0x4e127c[_0x9ffa('0x26')][_0x9ffa('0x27')]);return _0x31c459(_0x4e127c[_0x9ffa('0x26')]['message']);}logger[_0x9ffa('0x26')](_0x9ffa('0x21'),_0x135c55,_0x4e127c[_0x9ffa('0x26')][_0x9ffa('0x27')]);return _0x424f8d(_0x4e127c[_0x9ffa('0x26')][_0x9ffa('0x27')]);}else{logger[_0x9ffa('0x20')](_0x9ffa('0x21'),_0x135c55,'request\x20sent');_0x424f8d(_0x4e127c['result'][_0x9ffa('0x27')]);}})[_0x9ffa('0x28')](function(_0x4d29cd){logger[_0x9ffa('0x26')](_0x9ffa('0x21'),_0x135c55,_0x4d29cd);_0x31c459(_0x4d29cd);});});}function respondWithStatusCode(_0x336d71,_0x47d878){_0x47d878=_0x47d878||0xcc;return function(_0x3f3f6e){if(_0x3f3f6e){return _0x336d71[_0x9ffa('0x29')](_0x47d878);}return _0x336d71[_0x9ffa('0x2a')](_0x47d878)['end']();};}function respondWithResult(_0x229658,_0x298630){_0x298630=_0x298630||0xc8;return function(_0x136cd2){if(_0x136cd2){return _0x229658[_0x9ffa('0x2a')](_0x298630)[_0x9ffa('0x2b')](_0x136cd2);}};}function respondWithFilteredResult(_0x37d3b5,_0x11abea){return function(_0x4cc63d){if(_0x4cc63d){var _0x34da6f=_0x4cc63d[_0x9ffa('0x2c')],_0x33b80e=_0x11abea['offset'],_0x58f3ef=_0x11abea[_0x9ffa('0x2d')]+_0x11abea[_0x9ffa('0x2e')],_0x2ebb6f;if(_0x58f3ef>=_0x34da6f){_0x58f3ef=_0x34da6f;_0x2ebb6f=0xc8;}else{_0x2ebb6f=0xce;}_0x37d3b5[_0x9ffa('0x2a')](_0x2ebb6f);return _0x37d3b5[_0x9ffa('0x2f')](_0x9ffa('0x30'),_0x33b80e+'-'+_0x58f3ef+'/'+_0x34da6f)[_0x9ffa('0x2b')](_0x4cc63d);}return null;};}function patchUpdates(_0x3d3018){return function(_0x5160a6){try{jsonpatch[_0x9ffa('0x31')](_0x5160a6,_0x3d3018,!![]);}catch(_0x5039db){return BPromise['reject'](_0x5039db);}return _0x5160a6[_0x9ffa('0x32')]();};}function saveUpdates(_0x3b6963,_0x142ce1){return function(_0x2f0591){if(_0x2f0591){return _0x2f0591['update'](_0x3b6963)['then'](function(_0x18442c){return _0x18442c;});}return null;};}function removeEntity(_0x4c6596,_0x37e855){return function(_0xd145b7){if(_0xd145b7){return _0xd145b7[_0x9ffa('0x33')]()[_0x9ffa('0x1f')](function(){_0x4c6596[_0x9ffa('0x2a')](0xcc)[_0x9ffa('0x34')]();});}};}function handleEntityNotFound(_0x1a1fe2,_0x2892f3){return function(_0x4ecd25){if(!_0x4ecd25){_0x1a1fe2['sendStatus'](0x194);}return _0x4ecd25;};}function handleError(_0xc3c6c1,_0x2a58fa){_0x2a58fa=_0x2a58fa||0x1f4;return function(_0x26ebb3){logger[_0x9ffa('0x26')](_0x26ebb3[_0x9ffa('0x35')]);if(_0x26ebb3[_0x9ffa('0x36')]){delete _0x26ebb3[_0x9ffa('0x36')];}_0xc3c6c1['status'](_0x2a58fa)['send'](_0x26ebb3);};}exports[_0x9ffa('0x37')]=function(_0x3c057c,_0x253d85){var _0x2a1882={'include':[{'model':db[_0x9ffa('0x38')],'as':'Imap'},{'model':db[_0x9ffa('0x39')],'as':_0x9ffa('0x3a')}]},_0x573511={},_0x306f33={'count':0x0,'rows':[]};var _0x20f75f=db[_0x9ffa('0x3b')][_0x9ffa('0x3c')];_0x573511[_0x9ffa('0x3d')]=_[_0x9ffa('0x3e')](_0x20f75f);var _0x518240={'dateStart':_0x3c057c[_0x9ffa('0x3f')][_0x9ffa('0x40')],'dateEnd':_0x3c057c['query']['dateEnd']};delete _0x3c057c['query'][_0x9ffa('0x40')];delete _0x3c057c[_0x9ffa('0x3f')][_0x9ffa('0x41')];_0x573511[_0x9ffa('0x3f')]=_[_0x9ffa('0x3e')](_0x3c057c[_0x9ffa('0x3f')]);_0x573511[_0x9ffa('0x42')]=_[_0x9ffa('0x43')](_0x573511['model'],_0x573511[_0x9ffa('0x3f')]);_0x2a1882[_0x9ffa('0x44')]=_['intersection'](_0x573511[_0x9ffa('0x3d')],qs[_0x9ffa('0x45')](_0x3c057c[_0x9ffa('0x3f')]['fields']));_0x2a1882[_0x9ffa('0x44')]=_0x2a1882[_0x9ffa('0x44')]['length']?_0x2a1882[_0x9ffa('0x44')]:_0x573511[_0x9ffa('0x3d')];if(!_0x3c057c['query']['hasOwnProperty'](_0x9ffa('0x46'))){_0x2a1882['limit']=qs[_0x9ffa('0x2e')](_0x3c057c['query'][_0x9ffa('0x2e')]);_0x2a1882['offset']=qs[_0x9ffa('0x2d')](_0x3c057c[_0x9ffa('0x3f')]['offset']);}_0x2a1882[_0x9ffa('0x47')]=qs[_0x9ffa('0x48')](_0x3c057c[_0x9ffa('0x3f')][_0x9ffa('0x48')]);_0x2a1882[_0x9ffa('0x49')]=qs[_0x9ffa('0x42')](_[_0x9ffa('0x4a')](_0x3c057c[_0x9ffa('0x3f')],_0x573511[_0x9ffa('0x42')]));if(_0x518240['dateStart']){if(_0x518240['dateEnd']){_0x518240[_0x9ffa('0x41')]=moment(_0x518240['dateEnd'])['add'](0x1,_0x9ffa('0x4b'));}else{_0x518240[_0x9ffa('0x41')]=moment(_0x518240[_0x9ffa('0x40')])['add'](0x1,_0x9ffa('0x4b'));}_[_0x9ffa('0x4c')](_0x2a1882[_0x9ffa('0x49')],{'createdAt':{'$gte':_0x518240[_0x9ffa('0x40')],'$lte':_0x518240['dateEnd']}});}if(_0x3c057c[_0x9ffa('0x3f')][_0x9ffa('0x4d')]){_0x2a1882['where']=_['merge'](_0x2a1882[_0x9ffa('0x49')],{'$or':_['map'](_0x2a1882[_0x9ffa('0x44')],function(_0x3064df){var _0x378052={};_0x378052[_0x3064df]={'$like':'%'+_0x3c057c[_0x9ffa('0x3f')][_0x9ffa('0x4d')]+'%'};return _0x378052;})});}_0x2a1882=_[_0x9ffa('0x4c')]({},_0x2a1882,_0x3c057c[_0x9ffa('0x4e')]);var _0x443f5c={'where':_0x2a1882[_0x9ffa('0x49')]};return db[_0x9ffa('0x3b')][_0x9ffa('0x2c')](_0x443f5c)[_0x9ffa('0x1f')](function(_0x50b9ff){_0x306f33[_0x9ffa('0x2c')]=_0x50b9ff;if(_0x3c057c[_0x9ffa('0x3f')][_0x9ffa('0x4f')]){_0x2a1882[_0x9ffa('0x50')]=[{'all':!![]}];}return db[_0x9ffa('0x3b')][_0x9ffa('0x51')](_0x2a1882);})[_0x9ffa('0x1f')](function(_0x115fe8){_0x306f33[_0x9ffa('0x52')]=_0x115fe8;return _0x306f33;})[_0x9ffa('0x1f')](respondWithFilteredResult(_0x253d85,_0x2a1882))['catch'](handleError(_0x253d85,null));};exports[_0x9ffa('0x53')]=function(_0x3fdfef,_0x19b3de){var _0x45a85f={'raw':![],'where':{'id':_0x3fdfef[_0x9ffa('0x54')]['id']},'include':[{'model':db[_0x9ffa('0x38')],'as':'Imap'},{'model':db[_0x9ffa('0x39')],'as':_0x9ffa('0x3a')}]},_0x2b1a73={};_0x2b1a73['model']=_[_0x9ffa('0x3e')](db[_0x9ffa('0x3b')][_0x9ffa('0x3c')]);_0x2b1a73[_0x9ffa('0x3f')]=_[_0x9ffa('0x3e')](_0x3fdfef['query']);_0x2b1a73[_0x9ffa('0x42')]=_[_0x9ffa('0x43')](_0x2b1a73[_0x9ffa('0x3d')],_0x2b1a73[_0x9ffa('0x3f')]);_0x45a85f[_0x9ffa('0x44')]=_['intersection'](_0x2b1a73[_0x9ffa('0x3d')],qs[_0x9ffa('0x45')](_0x3fdfef[_0x9ffa('0x3f')][_0x9ffa('0x45')]));_0x45a85f['attributes']=_0x45a85f['attributes'][_0x9ffa('0x55')]?_0x45a85f[_0x9ffa('0x44')]:_0x2b1a73[_0x9ffa('0x3d')];if(_0x3fdfef[_0x9ffa('0x3f')][_0x9ffa('0x4f')]){_0x45a85f[_0x9ffa('0x50')]=[{'all':!![]}];}_0x45a85f=_['merge']({},_0x45a85f,_0x3fdfef[_0x9ffa('0x4e')]);return db[_0x9ffa('0x3b')][_0x9ffa('0x56')](_0x45a85f)['then'](handleEntityNotFound(_0x19b3de,null))['then'](respondWithResult(_0x19b3de,null))[_0x9ffa('0x28')](handleError(_0x19b3de,null));};exports[_0x9ffa('0x57')]=function(_0xf60635,_0x56235a){if(_0xf60635['body']['id']){delete _0xf60635[_0x9ffa('0x58')]['id'];}return db[_0x9ffa('0x3b')][_0x9ffa('0x56')]({'where':{'id':_0xf60635[_0x9ffa('0x54')]['id']},'include':[{'model':db[_0x9ffa('0x38')],'as':'Imap'},{'model':db[_0x9ffa('0x39')],'as':_0x9ffa('0x3a')}]})[_0x9ffa('0x1f')](handleEntityNotFound(_0x56235a,null))[_0x9ffa('0x1f')](saveUpdates(_0xf60635['body'],null))['then'](function(_0x51f455){if(_0x51f455&&_0xf60635['body'][_0x9ffa('0x59')]){return db['MailServerIn'][_0x9ffa('0x57')](_0xf60635[_0x9ffa('0x58')]['Imap'],{'where':{'MailAccountId':_0x51f455['id']}})[_0x9ffa('0x1f')](function(){return _0x51f455;});}return _0x51f455;})[_0x9ffa('0x1f')](function(_0x405294){if(_0x405294&&_0xf60635['body'][_0x9ffa('0x3a')]){return db[_0x9ffa('0x39')][_0x9ffa('0x57')](_0xf60635['body'][_0x9ffa('0x3a')],{'where':{'MailAccountId':_0x405294['id']}})[_0x9ffa('0x1f')](function(){return _0x405294;});}return _0x405294;})['then'](respondWithResult(_0x56235a,null))[_0x9ffa('0x28')](handleError(_0x56235a,null));};exports[_0x9ffa('0x5a')]=function(_0x50431c,_0x579909){return db[_0x9ffa('0x3b')][_0x9ffa('0x5a')]()[_0x9ffa('0x1f')](respondWithResult(_0x579909,null))[_0x9ffa('0x28')](handleError(_0x579909,null));};exports['addDisposition']=function(_0x11b80e,_0x1f4d03,_0x125016){if(_0x11b80e[_0x9ffa('0x58')]['id']){delete _0x11b80e[_0x9ffa('0x58')]['id'];}return db[_0x9ffa('0x3b')][_0x9ffa('0x56')]({'where':{'id':_0x11b80e[_0x9ffa('0x54')]['id']}})[_0x9ffa('0x1f')](handleEntityNotFound(_0x1f4d03,null))['then'](function(_0x1cee73){if(_0x1cee73){_0x11b80e['body'][_0x9ffa('0x5b')]=_0x1cee73['id'];return db[_0x9ffa('0x5c')]['create'](_0x11b80e[_0x9ffa('0x58')]);}})[_0x9ffa('0x1f')](respondWithResult(_0x1f4d03,null))[_0x9ffa('0x28')](handleError(_0x1f4d03,null));};exports[_0x9ffa('0x5d')]=function(_0x172c0b,_0x46cd7f,_0x12c99f){var _0xd977d1={'raw':![],'where':{}};var _0x40ef25={};var _0x5476b6={'count':0x0,'rows':[]};return db[_0x9ffa('0x3b')][_0x9ffa('0x5e')]({'where':{'id':_0x172c0b[_0x9ffa('0x54')]['id']}})[_0x9ffa('0x1f')](handleEntityNotFound(_0x46cd7f,null))[_0x9ffa('0x1f')](function(_0x1ff138){if(_0x1ff138){_0x40ef25[_0x9ffa('0x3d')]=_['keys'](db[_0x9ffa('0x5c')][_0x9ffa('0x3c')]);_0x40ef25[_0x9ffa('0x3f')]=_[_0x9ffa('0x3e')](_0x172c0b['query']);_0x40ef25['filters']=_['intersection'](_0x40ef25[_0x9ffa('0x3d')],_0x40ef25[_0x9ffa('0x3f')]);_0xd977d1[_0x9ffa('0x44')]=_[_0x9ffa('0x43')](_0x40ef25[_0x9ffa('0x3d')],qs['fields'](_0x172c0b[_0x9ffa('0x3f')][_0x9ffa('0x45')]));_0xd977d1['attributes']=_0xd977d1[_0x9ffa('0x44')][_0x9ffa('0x55')]?_0xd977d1[_0x9ffa('0x44')]:_0x40ef25['model'];if(!_0x172c0b[_0x9ffa('0x3f')][_0x9ffa('0x5f')]('nolimit')){_0xd977d1['limit']=qs[_0x9ffa('0x2e')](_0x172c0b['query'][_0x9ffa('0x2e')]);_0xd977d1[_0x9ffa('0x2d')]=qs['offset'](_0x172c0b[_0x9ffa('0x3f')][_0x9ffa('0x2d')]);}_0xd977d1[_0x9ffa('0x47')]=qs['sort'](_0x172c0b[_0x9ffa('0x3f')][_0x9ffa('0x48')]);_0xd977d1[_0x9ffa('0x49')]=qs[_0x9ffa('0x42')](_[_0x9ffa('0x4a')](_0x172c0b[_0x9ffa('0x3f')],_0x40ef25['filters']));_0xd977d1[_0x9ffa('0x49')][_0x9ffa('0x5b')]=_0x1ff138['id'];if(_0x172c0b['query'][_0x9ffa('0x4d')]){_0xd977d1[_0x9ffa('0x49')]=_[_0x9ffa('0x4c')](_0xd977d1[_0x9ffa('0x49')],{'$or':_['map'](_0xd977d1[_0x9ffa('0x44')],function(_0x3bf234){var _0x3f6614={};_0x3f6614[_0x3bf234]={'$like':'%'+_0x172c0b['query']['filter']+'%'};return _0x3f6614;})});}_0xd977d1=_['merge']({},_0xd977d1,_0x172c0b[_0x9ffa('0x4e')]);return db[_0x9ffa('0x5c')][_0x9ffa('0x2c')]({'where':_0xd977d1[_0x9ffa('0x49')]})[_0x9ffa('0x1f')](function(_0x297807){_0x5476b6[_0x9ffa('0x2c')]=_0x297807;if(_0x172c0b['query'][_0x9ffa('0x4f')]){_0xd977d1[_0x9ffa('0x50')]=[{'all':!![]}];}return db[_0x9ffa('0x5c')][_0x9ffa('0x51')](_0xd977d1);})[_0x9ffa('0x1f')](function(_0x150ceb){_0x5476b6[_0x9ffa('0x52')]=_0x150ceb;return _0x5476b6;});}})[_0x9ffa('0x1f')](respondWithFilteredResult(_0x46cd7f,_0xd977d1))[_0x9ffa('0x28')](handleError(_0x46cd7f,null));};exports[_0x9ffa('0x60')]=function(_0x3e7980,_0x200b9b,_0x421309){var _0x4371ec;return db[_0x9ffa('0x3b')][_0x9ffa('0x56')]({'where':{'id':_0x3e7980['params']['id']}})[_0x9ffa('0x1f')](handleEntityNotFound(_0x200b9b,null))['then'](function(_0x503a93){if(_0x503a93){return _0x503a93[_0x9ffa('0x60')](_0x3e7980[_0x9ffa('0x3f')]['ids']);}})[_0x9ffa('0x1f')](respondWithStatusCode(_0x200b9b,null))[_0x9ffa('0x28')](handleError(_0x200b9b,null));};exports[_0x9ffa('0x61')]=function(_0x1c1b4c,_0x259e28,_0x101c34){if(_0x1c1b4c[_0x9ffa('0x58')]['id']){delete _0x1c1b4c[_0x9ffa('0x58')]['id'];}return db[_0x9ffa('0x3b')][_0x9ffa('0x56')]({'where':{'id':_0x1c1b4c['params']['id']}})['then'](handleEntityNotFound(_0x259e28,null))[_0x9ffa('0x1f')](function(_0x3ff64a){if(_0x3ff64a){_0x1c1b4c['body'][_0x9ffa('0x5b')]=_0x3ff64a['id'];return db['CannedAnswer']['create'](_0x1c1b4c['body']);}})[_0x9ffa('0x1f')](respondWithResult(_0x259e28,null))[_0x9ffa('0x28')](handleError(_0x259e28,null));};exports[_0x9ffa('0x62')]=function(_0x267a4e,_0x44ff59,_0x5d8c59){var _0x46f4ff={'raw':![],'where':{}};var _0x151aaa={};var _0x4e1876={'count':0x0,'rows':[]};return db[_0x9ffa('0x3b')]['findOne']({'where':{'id':_0x267a4e[_0x9ffa('0x54')]['id']}})[_0x9ffa('0x1f')](handleEntityNotFound(_0x44ff59,null))[_0x9ffa('0x1f')](function(_0x5e388a){if(_0x5e388a){_0x151aaa['model']=_[_0x9ffa('0x3e')](db[_0x9ffa('0x63')][_0x9ffa('0x3c')]);_0x151aaa['query']=_[_0x9ffa('0x3e')](_0x267a4e[_0x9ffa('0x3f')]);_0x151aaa['filters']=_[_0x9ffa('0x43')](_0x151aaa[_0x9ffa('0x3d')],_0x151aaa[_0x9ffa('0x3f')]);_0x46f4ff[_0x9ffa('0x44')]=_[_0x9ffa('0x43')](_0x151aaa[_0x9ffa('0x3d')],qs['fields'](_0x267a4e[_0x9ffa('0x3f')]['fields']));_0x46f4ff[_0x9ffa('0x44')]=_0x46f4ff['attributes'][_0x9ffa('0x55')]?_0x46f4ff['attributes']:_0x151aaa['model'];if(!_0x267a4e['query'][_0x9ffa('0x5f')](_0x9ffa('0x46'))){_0x46f4ff['limit']=qs[_0x9ffa('0x2e')](_0x267a4e['query'][_0x9ffa('0x2e')]);_0x46f4ff[_0x9ffa('0x2d')]=qs[_0x9ffa('0x2d')](_0x267a4e[_0x9ffa('0x3f')][_0x9ffa('0x2d')]);}_0x46f4ff[_0x9ffa('0x47')]=qs[_0x9ffa('0x48')](_0x267a4e[_0x9ffa('0x3f')][_0x9ffa('0x48')]);_0x46f4ff[_0x9ffa('0x49')]=qs['filters'](_[_0x9ffa('0x4a')](_0x267a4e[_0x9ffa('0x3f')],_0x151aaa[_0x9ffa('0x42')]));_0x46f4ff['where'][_0x9ffa('0x5b')]=_0x5e388a['id'];if(_0x267a4e[_0x9ffa('0x3f')]['filter']){_0x46f4ff[_0x9ffa('0x49')]=_[_0x9ffa('0x4c')](_0x46f4ff['where'],{'$or':_[_0x9ffa('0x64')](_0x46f4ff['attributes'],function(_0x4f186c){var _0x1e6d05={};_0x1e6d05[_0x4f186c]={'$like':'%'+_0x267a4e[_0x9ffa('0x3f')][_0x9ffa('0x4d')]+'%'};return _0x1e6d05;})});}_0x46f4ff=_[_0x9ffa('0x4c')]({},_0x46f4ff,_0x267a4e[_0x9ffa('0x4e')]);return db[_0x9ffa('0x63')][_0x9ffa('0x2c')]({'where':_0x46f4ff[_0x9ffa('0x49')]})[_0x9ffa('0x1f')](function(_0x28a794){_0x4e1876['count']=_0x28a794;if(_0x267a4e[_0x9ffa('0x3f')][_0x9ffa('0x4f')]){_0x46f4ff[_0x9ffa('0x50')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x46f4ff);})[_0x9ffa('0x1f')](function(_0x9549d0){_0x4e1876[_0x9ffa('0x52')]=_0x9549d0;return _0x4e1876;});}})[_0x9ffa('0x1f')](respondWithFilteredResult(_0x44ff59,_0x46f4ff))[_0x9ffa('0x28')](handleError(_0x44ff59,null));};exports[_0x9ffa('0x65')]=function(_0x32da38,_0x1e7102,_0x49f4c3){var _0x411412;return db['MailAccount'][_0x9ffa('0x56')]({'where':{'id':_0x32da38[_0x9ffa('0x54')]['id']}})[_0x9ffa('0x1f')](handleEntityNotFound(_0x1e7102,null))[_0x9ffa('0x1f')](function(_0x5cdb5a){if(_0x5cdb5a){return _0x5cdb5a[_0x9ffa('0x65')](_0x32da38[_0x9ffa('0x3f')][_0x9ffa('0x66')]);}})[_0x9ffa('0x1f')](respondWithStatusCode(_0x1e7102,null))[_0x9ffa('0x28')](handleError(_0x1e7102,null));};exports[_0x9ffa('0x67')]=function(_0x119904,_0x42c9ea){var _0x5239c9={'name':_0x119904[_0x9ffa('0x58')][_0x9ffa('0x36')],'key':_0x119904[_0x9ffa('0x58')][_0x9ffa('0x68')],'email':_0x119904[_0x9ffa('0x58')]['email'],'ListId':_0x119904[_0x9ffa('0x58')][_0x9ffa('0x69')],'active':!_[_0x9ffa('0x6a')](_0x119904['body'][_0x9ffa('0x6b')])?_0x119904['body'][_0x9ffa('0x6b')]:!![],'description':_0x119904[_0x9ffa('0x58')]['description']||null,'Imap':{},'Smtp':{}};if(_[_0x9ffa('0x6a')](_0x119904[_0x9ffa('0x58')]['cservice'])){if(_0x119904['body'][_0x9ffa('0x6c')]){_0x5239c9[_0x9ffa('0x59')][_0x9ffa('0x6d')]=_0x5239c9[_0x9ffa('0x3a')][_0x9ffa('0x6d')]=_0x119904[_0x9ffa('0x58')]['cuser'];_0x5239c9[_0x9ffa('0x59')][_0x9ffa('0x6e')]=_0x5239c9['Smtp']['pass']=_0x119904['body'][_0x9ffa('0x6f')];}else{_0x5239c9[_0x9ffa('0x59')][_0x9ffa('0x70')]=_0x5239c9['Smtp'][_0x9ffa('0x70')]=![];}_0x5239c9[_0x9ffa('0x59')]['host']=_0x119904[_0x9ffa('0x58')]['Imap']['host'];_0x5239c9[_0x9ffa('0x59')][_0x9ffa('0x71')]=_0x119904['body'][_0x9ffa('0x59')][_0x9ffa('0x71')];_0x5239c9[_0x9ffa('0x3a')][_0x9ffa('0x72')]=_0x119904[_0x9ffa('0x58')][_0x9ffa('0x3a')][_0x9ffa('0x72')];_0x5239c9[_0x9ffa('0x3a')][_0x9ffa('0x71')]=_0x119904[_0x9ffa('0x58')][_0x9ffa('0x3a')][_0x9ffa('0x71')];}else{_0x5239c9['Imap']['service']=_0x5239c9[_0x9ffa('0x3a')][_0x9ffa('0x73')]=_0x119904[_0x9ffa('0x58')][_0x9ffa('0x74')];_0x5239c9['Imap']['user']=_0x5239c9[_0x9ffa('0x3a')]['user']=_0x119904[_0x9ffa('0x58')][_0x9ffa('0x75')];_0x5239c9['Imap'][_0x9ffa('0x6e')]=_0x5239c9['Smtp']['pass']=_0x119904[_0x9ffa('0x58')]['cpassword'];}return db[_0x9ffa('0x3b')][_0x9ffa('0x67')](_0x5239c9,{'include':[{'model':db[_0x9ffa('0x39')],'as':_0x9ffa('0x3a')},{'model':db[_0x9ffa('0x38')],'as':_0x9ffa('0x59')}]})[_0x9ffa('0x1f')](respondWithResult(_0x42c9ea,0xc9))[_0x9ffa('0x28')](handleError(_0x42c9ea,null));};exports[_0x9ffa('0x76')]=function(_0x3190e6,_0x946d2a,_0x14f7e6){return db['MailAccount']['findOne']({'where':{'id':_0x3190e6[_0x9ffa('0x54')]['id']}})[_0x9ffa('0x1f')](handleEntityNotFound(_0x946d2a,null))['then'](function(_0x442e9d){if(_0x442e9d){return _0x442e9d[_0x9ffa('0x76')]();}return null;})[_0x9ffa('0x1f')](respondWithResult(_0x946d2a,null))[_0x9ffa('0x28')](handleError(_0x946d2a,null));};exports[_0x9ffa('0x77')]=function(_0x4ceec2,_0x28ced5,_0x5364d7){if(_0x4ceec2[_0x9ffa('0x58')]['id']){delete _0x4ceec2[_0x9ffa('0x58')]['id'];}return db[_0x9ffa('0x3b')]['find']({'where':{'id':_0x4ceec2['params']['id']}})[_0x9ffa('0x1f')](handleEntityNotFound(_0x28ced5,null))[_0x9ffa('0x1f')](function(_0x5783e2){if(_0x5783e2){_0x4ceec2[_0x9ffa('0x58')][_0x9ffa('0x5b')]=_0x5783e2['id'];return db['MailServerIn']['create'](_0x4ceec2['body']);}})[_0x9ffa('0x1f')](respondWithResult(_0x28ced5,null))[_0x9ffa('0x28')](handleError(_0x28ced5,null));};exports[_0x9ffa('0x78')]=function(_0x4108f0,_0x532f76,_0x2a52ac){return db['MailAccount']['findOne']({'where':{'id':_0x4108f0[_0x9ffa('0x54')]['id']}})[_0x9ffa('0x1f')](handleEntityNotFound(_0x532f76,null))[_0x9ffa('0x1f')](function(_0x5d5040){if(_0x5d5040){return _0x5d5040[_0x9ffa('0x79')](null);}return null;})[_0x9ffa('0x1f')](respondWithStatusCode(_0x532f76,null))[_0x9ffa('0x28')](handleError(_0x532f76,null));};exports['getSmtp']=function(_0x38f04e,_0x370701,_0x26ac4d){return db[_0x9ffa('0x3b')][_0x9ffa('0x5e')]({'where':{'id':_0x38f04e[_0x9ffa('0x54')]['id']}})[_0x9ffa('0x1f')](handleEntityNotFound(_0x370701,null))[_0x9ffa('0x1f')](function(_0x2c79f9){if(_0x2c79f9){return _0x2c79f9[_0x9ffa('0x7a')]();}return null;})[_0x9ffa('0x1f')](respondWithResult(_0x370701,null))[_0x9ffa('0x28')](handleError(_0x370701,null));};exports[_0x9ffa('0x7b')]=function(_0x596aea,_0xb67061,_0x594ae3){if(_0x596aea['body']['id']){delete _0x596aea[_0x9ffa('0x58')]['id'];}return db[_0x9ffa('0x3b')][_0x9ffa('0x56')]({'where':{'id':_0x596aea[_0x9ffa('0x54')]['id']}})[_0x9ffa('0x1f')](handleEntityNotFound(_0xb67061,null))[_0x9ffa('0x1f')](function(_0x1d25d7){if(_0x1d25d7){_0x596aea[_0x9ffa('0x58')]['MailAccountId']=_0x1d25d7['id'];return db[_0x9ffa('0x39')][_0x9ffa('0x67')](_0x596aea[_0x9ffa('0x58')]);}})[_0x9ffa('0x1f')](respondWithResult(_0xb67061,null))['catch'](handleError(_0xb67061,null));};exports[_0x9ffa('0x7c')]=function(_0x2e2a20,_0x49bc1d,_0x376ee1){return db[_0x9ffa('0x3b')][_0x9ffa('0x5e')]({'where':{'id':_0x2e2a20[_0x9ffa('0x54')]['id']}})['then'](handleEntityNotFound(_0x49bc1d,null))[_0x9ffa('0x1f')](function(_0x137895){if(_0x137895){return _0x137895[_0x9ffa('0x7d')](null);}return null;})[_0x9ffa('0x1f')](respondWithStatusCode(_0x49bc1d,null))['catch'](handleError(_0x49bc1d,null));};exports[_0x9ffa('0x7e')]=function(_0x338759,_0x1c8a6d,_0xc19d3a){return db[_0x9ffa('0x7f')][_0x9ffa('0x56')]({'where':{'id':_0x338759[_0x9ffa('0x54')]['id']}})[_0x9ffa('0x1f')](handleEntityNotFound(_0x1c8a6d,null))[_0x9ffa('0x1f')](function(_0x48d525){if(_0x48d525){return _0x48d525[_0x9ffa('0x7e')](_0x338759[_0x9ffa('0x58')][_0x9ffa('0x66')],_[_0x9ffa('0x80')](_0x338759[_0x9ffa('0x58')],[_0x9ffa('0x66'),'id'])||{});}})[_0x9ffa('0x1f')](respondWithResult(_0x1c8a6d,null))[_0x9ffa('0x28')](handleError(_0x1c8a6d,null));};exports[_0x9ffa('0x81')]=function(_0x2864e6,_0x3d3dd8,_0x47a07d){var _0x5e37d7={'raw':![],'where':{}};var _0x3e8dcd={};var _0x23f096={'count':0x0,'rows':[]};return db[_0x9ffa('0x3b')][_0x9ffa('0x5e')]({'where':{'id':_0x2864e6[_0x9ffa('0x54')]['id']}})['then'](handleEntityNotFound(_0x3d3dd8,null))[_0x9ffa('0x1f')](function(_0x4545b0){if(_0x4545b0){_0x3e8dcd[_0x9ffa('0x3d')]=_[_0x9ffa('0x3e')](db[_0x9ffa('0x7f')][_0x9ffa('0x3c')]);_0x3e8dcd[_0x9ffa('0x3f')]=_[_0x9ffa('0x3e')](_0x2864e6[_0x9ffa('0x3f')]);_0x3e8dcd[_0x9ffa('0x42')]=_[_0x9ffa('0x43')](_0x3e8dcd['model'],_0x3e8dcd['query']);_0x5e37d7[_0x9ffa('0x44')]=_['intersection'](_0x3e8dcd[_0x9ffa('0x3d')],qs['fields'](_0x2864e6['query']['fields']));_0x5e37d7[_0x9ffa('0x44')]=_0x5e37d7['attributes'][_0x9ffa('0x55')]?_0x5e37d7['attributes']:_0x3e8dcd['model'];if(!_0x2864e6[_0x9ffa('0x3f')][_0x9ffa('0x5f')]('nolimit')){_0x5e37d7[_0x9ffa('0x2e')]=qs[_0x9ffa('0x2e')](_0x2864e6['query'][_0x9ffa('0x2e')]);_0x5e37d7['offset']=qs[_0x9ffa('0x2d')](_0x2864e6[_0x9ffa('0x3f')][_0x9ffa('0x2d')]);}_0x5e37d7[_0x9ffa('0x47')]=qs[_0x9ffa('0x48')](_0x2864e6[_0x9ffa('0x3f')][_0x9ffa('0x48')]);_0x5e37d7[_0x9ffa('0x49')]=qs[_0x9ffa('0x42')](_[_0x9ffa('0x4a')](_0x2864e6['query'],_0x3e8dcd[_0x9ffa('0x42')]));_0x5e37d7[_0x9ffa('0x49')][_0x9ffa('0x5b')]=_0x4545b0['id'];if(_0x2864e6[_0x9ffa('0x3f')]['filter']){_0x5e37d7[_0x9ffa('0x49')]=_[_0x9ffa('0x4c')](_0x5e37d7[_0x9ffa('0x49')],{'$or':_[_0x9ffa('0x64')](_0x5e37d7['attributes'],function(_0x114a08){var _0x240df9={};_0x240df9[_0x114a08]={'$like':'%'+_0x2864e6[_0x9ffa('0x3f')][_0x9ffa('0x4d')]+'%'};return _0x240df9;})});}_0x5e37d7=_[_0x9ffa('0x4c')]({},_0x5e37d7,_0x2864e6[_0x9ffa('0x4e')]);return db['MailInteraction'][_0x9ffa('0x2c')]({'where':_0x5e37d7[_0x9ffa('0x49')]})[_0x9ffa('0x1f')](function(_0x2dba23){_0x23f096[_0x9ffa('0x2c')]=_0x2dba23;if(_0x2864e6['query'][_0x9ffa('0x4f')]){_0x5e37d7[_0x9ffa('0x50')]=[{'model':db[_0x9ffa('0x82')],'as':_0x9ffa('0x83'),'required':![]},{'model':db['User'],'as':_0x9ffa('0x84'),'attributes':[_0x9ffa('0x36'),_0x9ffa('0x85'),_0x9ffa('0x86')],'required':![]},{'model':db[_0x9ffa('0x87')],'as':_0x9ffa('0x88'),'attributes':['id',_0x9ffa('0x36'),_0x9ffa('0x89')],'where':_0x2864e6['query'][_0x9ffa('0x8a')]?{'id':_0x2864e6['query'][_0x9ffa('0x8a')]}:undefined,'required':_0x2864e6[_0x9ffa('0x3f')][_0x9ffa('0x8a')]?!![]:![]}];}return db[_0x9ffa('0x7f')]['findAll'](_0x5e37d7);})[_0x9ffa('0x1f')](function(_0x31b545){_0x23f096['rows']=_0x31b545;return _0x23f096;});}})[_0x9ffa('0x1f')](respondWithFilteredResult(_0x3d3dd8,_0x5e37d7))[_0x9ffa('0x28')](handleError(_0x3d3dd8,null));};exports[_0x9ffa('0x8b')]=function(_0x2f7834,_0x578e41,_0x29f5e0){return db[_0x9ffa('0x3b')][_0x9ffa('0x5e')]({'where':{'id':_0x2f7834['params']['id']}})[_0x9ffa('0x1f')](handleEntityNotFound(_0x578e41,null))[_0x9ffa('0x1f')](function(_0x3d45eb){if(_0x3d45eb){return db['sequelize'][_0x9ffa('0x8c')](function(_0x455d8e){return db[_0x9ffa('0x8d')]['destroy']({'where':{'MailAccountId':_0x2f7834[_0x9ffa('0x54')]['id']},'transaction':_0x455d8e})[_0x9ffa('0x1f')](function(_0x48641d){var _0x40fe05=_[_0x9ffa('0x64')](_0x2f7834[_0x9ffa('0x58')],function(_0x583c34){_0x583c34['MailAccountId']=_0x2f7834[_0x9ffa('0x54')]['id'];return _0x583c34;});return db[_0x9ffa('0x8d')]['bulkCreate'](_0x40fe05,{'transaction':_0x455d8e});});})[_0x9ffa('0x1f')](function(){return db[_0x9ffa('0x8d')]['findAndCountAll']({'where':{'MailAccountId':_0x2f7834[_0x9ffa('0x54')]['id']},'order':'priority'});});}})[_0x9ffa('0x1f')](respondWithResult(_0x578e41,null))[_0x9ffa('0x28')](handleError(_0x578e41,null));};exports['getApplications']=function(_0x55d63d,_0x2e6de1,_0x1400cf){var _0x537b4d={};var _0x3167bb={};var _0x173931;var _0x5ae287;return db[_0x9ffa('0x3b')]['findOne']({'where':{'id':_0x55d63d[_0x9ffa('0x54')]['id']}})[_0x9ffa('0x1f')](handleEntityNotFound(_0x2e6de1,null))[_0x9ffa('0x1f')](function(_0x47f5da){if(_0x47f5da){_0x173931=_0x47f5da;_0x3167bb[_0x9ffa('0x3d')]=_[_0x9ffa('0x3e')](db[_0x9ffa('0x8d')]['rawAttributes']);_0x3167bb[_0x9ffa('0x3f')]=_['keys'](_0x55d63d[_0x9ffa('0x3f')]);_0x3167bb[_0x9ffa('0x42')]=_[_0x9ffa('0x43')](_0x3167bb['model'],_0x3167bb[_0x9ffa('0x3f')]);_0x537b4d[_0x9ffa('0x44')]=_[_0x9ffa('0x43')](_0x3167bb[_0x9ffa('0x3d')],qs[_0x9ffa('0x45')](_0x55d63d[_0x9ffa('0x3f')][_0x9ffa('0x45')]));_0x537b4d[_0x9ffa('0x44')]=_0x537b4d['attributes']['length']?_0x537b4d[_0x9ffa('0x44')]:_0x3167bb[_0x9ffa('0x3d')];_0x537b4d[_0x9ffa('0x47')]=qs[_0x9ffa('0x48')](_0x55d63d[_0x9ffa('0x3f')][_0x9ffa('0x48')]);_0x537b4d[_0x9ffa('0x49')]=qs['filters'](_[_0x9ffa('0x4a')](_0x55d63d[_0x9ffa('0x3f')],_0x3167bb[_0x9ffa('0x42')]));if(_0x55d63d['query'][_0x9ffa('0x4d')]){_0x537b4d[_0x9ffa('0x49')]=_[_0x9ffa('0x4c')](_0x537b4d[_0x9ffa('0x49')],{'$or':_['map'](_0x537b4d[_0x9ffa('0x44')],function(_0xe11585){var _0xffb8da={};_0xffb8da[_0xe11585]={'$like':'%'+_0x55d63d[_0x9ffa('0x3f')][_0x9ffa('0x4d')]+'%'};return _0xffb8da;})});}_0x537b4d=_[_0x9ffa('0x4c')]({},_0x537b4d,_0x55d63d['options']);return _0x173931[_0x9ffa('0x8e')](_0x537b4d);}})[_0x9ffa('0x1f')](function(_0x50e1b0){if(_0x50e1b0){_0x5ae287=_0x50e1b0[_0x9ffa('0x55')];if(!_0x55d63d[_0x9ffa('0x3f')][_0x9ffa('0x5f')](_0x9ffa('0x46'))){_0x537b4d[_0x9ffa('0x2e')]=qs[_0x9ffa('0x2e')](_0x55d63d[_0x9ffa('0x3f')][_0x9ffa('0x2e')]);_0x537b4d['offset']=qs[_0x9ffa('0x2d')](_0x55d63d[_0x9ffa('0x3f')]['offset']);}return _0x173931[_0x9ffa('0x8e')](_0x537b4d);}})['then'](function(_0x19ff9e){if(_0x19ff9e){return _0x19ff9e?{'count':_0x5ae287,'rows':_0x19ff9e}:null;}})[_0x9ffa('0x1f')](respondWithResult(_0x2e6de1,null))[_0x9ffa('0x28')](handleError(_0x2e6de1,null));};exports[_0x9ffa('0x8f')]=function(_0x4737ff,_0x5f53cb,_0x21ebcf){var _0x4aafef={'raw':!![],'where':{}};var _0x354ec3={};var _0x5951f3={'count':0x0,'rows':[]};return db[_0x9ffa('0x3b')][_0x9ffa('0x5e')]({'where':{'id':_0x4737ff['params']['id']}})['then'](handleEntityNotFound(_0x5f53cb,null))['then'](function(_0x712898){if(_0x712898){_0x354ec3[_0x9ffa('0x3d')]=_[_0x9ffa('0x3e')](db[_0x9ffa('0x90')][_0x9ffa('0x3c')]);_0x354ec3[_0x9ffa('0x3f')]=_[_0x9ffa('0x3e')](_0x4737ff[_0x9ffa('0x3f')]);_0x354ec3[_0x9ffa('0x42')]=_[_0x9ffa('0x43')](_0x354ec3[_0x9ffa('0x3d')],_0x354ec3[_0x9ffa('0x3f')]);_0x4aafef[_0x9ffa('0x44')]=_[_0x9ffa('0x43')](_0x354ec3[_0x9ffa('0x3d')],qs[_0x9ffa('0x45')](_0x4737ff[_0x9ffa('0x3f')][_0x9ffa('0x45')]));_0x4aafef[_0x9ffa('0x44')]=_0x4aafef[_0x9ffa('0x44')][_0x9ffa('0x55')]?_0x4aafef[_0x9ffa('0x44')]:_0x354ec3[_0x9ffa('0x3d')];if(!_0x4737ff[_0x9ffa('0x3f')][_0x9ffa('0x5f')]('nolimit')){_0x4aafef[_0x9ffa('0x2e')]=qs[_0x9ffa('0x2e')](_0x4737ff[_0x9ffa('0x3f')]['limit']);_0x4aafef[_0x9ffa('0x2d')]=qs['offset'](_0x4737ff[_0x9ffa('0x3f')]['offset']);}_0x4aafef[_0x9ffa('0x47')]=qs[_0x9ffa('0x48')](_0x4737ff['query'][_0x9ffa('0x48')]);_0x4aafef[_0x9ffa('0x49')]=qs[_0x9ffa('0x42')](_[_0x9ffa('0x4a')](_0x4737ff[_0x9ffa('0x3f')],_0x354ec3[_0x9ffa('0x42')]));_0x4aafef[_0x9ffa('0x49')][_0x9ffa('0x5b')]=_0x712898['id'];if(_0x4737ff[_0x9ffa('0x3f')]['filter']){_0x4aafef['where']=_['merge'](_0x4aafef[_0x9ffa('0x49')],{'$or':_[_0x9ffa('0x64')](_0x4aafef['attributes'],function(_0x24a01c){var _0xdd6548={};_0xdd6548[_0x24a01c]={'$like':'%'+_0x4737ff['query']['filter']+'%'};return _0xdd6548;})});}if(_0x4737ff[_0x9ffa('0x3f')][_0x9ffa('0x91')]){var _0x16cb32=_0x4737ff[_0x9ffa('0x3f')]['$gte'][_0x9ffa('0x92')](',');var _0x2f47a6={};_0x2f47a6[_0x16cb32[0x0]]={'$gte':moment(_0x16cb32[0x1])[_0x9ffa('0x93')](_0x9ffa('0x94'))};_0x4aafef['where']=_[_0x9ffa('0x4c')](_0x4aafef['where'],_0x2f47a6);}_0x4aafef=_[_0x9ffa('0x4c')]({},_0x4aafef,_0x4737ff[_0x9ffa('0x4e')]);return db[_0x9ffa('0x90')]['count']({'where':_0x4aafef[_0x9ffa('0x49')]})[_0x9ffa('0x1f')](function(_0x23c465){_0x5951f3[_0x9ffa('0x2c')]=_0x23c465;if(_0x4737ff[_0x9ffa('0x3f')][_0x9ffa('0x4f')]){_0x4aafef[_0x9ffa('0x50')]=[{'all':!![]}];}return db[_0x9ffa('0x90')]['findAll'](_0x4aafef);})[_0x9ffa('0x1f')](function(_0xc961be){_0x5951f3[_0x9ffa('0x52')]=_0xc961be;return _0x5951f3;});}})[_0x9ffa('0x1f')](respondWithFilteredResult(_0x5f53cb,_0x4aafef))[_0x9ffa('0x28')](handleError(_0x5f53cb,null));};exports[_0x9ffa('0x95')]=function(_0x67382,_0x1b5485,_0x51a607){var _0x46e394,_0x16e142={},_0x58777f;if(_0x67382['body']['to']){_0x58777f=_0x67382[_0x9ffa('0x58')]['to'][_0x9ffa('0x92')](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x67382[_0x9ffa('0x54')]['id']},'include':[{'model':db['CmList'],'as':_0x9ffa('0x96'),'include':[{'model':db['CmContact'],'as':_0x9ffa('0x97'),'where':{'email':_0x58777f},'limit':0x1,'order':[[_0x9ffa('0x98'),_0x9ffa('0x99')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0x9ffa('0x1f')](handleEntityNotFound(_0x1b5485,null))[_0x9ffa('0x1f')](function(_0x517921){if(_0x517921){_0x46e394=_0x517921;if(_0x517921['Smtp']){if(_[_0x9ffa('0x6a')](_0x67382[_0x9ffa('0x58')][_0x9ffa('0x9a')])){_0x67382[_0x9ffa('0x58')][_0x9ffa('0x9a')]=util['format'](_0x9ffa('0x9b'),_0x517921[_0x9ffa('0x36')],_0x517921[_0x9ffa('0x9c')]||_0x517921[_0x9ffa('0x3a')]['user']);}if(_0x67382[_0x9ffa('0x58')][_0x9ffa('0x9d')]&&_0x67382['body']['attachments'][_0x9ffa('0x55')]){for(var _0x1a930e=0x0;_0x1a930e<_0x67382['body'][_0x9ffa('0x9d')][_0x9ffa('0x55')];_0x1a930e+=0x1){_0x67382[_0x9ffa('0x58')][_0x9ffa('0x9d')][_0x1a930e]={'filename':_0x67382['body']['attachments'][_0x1a930e]['name'],'path':path[_0x9ffa('0x9e')](config['root'],_0x9ffa('0x9f'),_0x67382[_0x9ffa('0x58')]['attachments'][_0x1a930e][_0x9ffa('0xa0')])};}}var _0x2d6132={'tls':{'rejectUnauthorized':![]}};if(_[_0x9ffa('0x6a')](_0x517921['Smtp'][_0x9ffa('0x73')])){if(_0x517921[_0x9ffa('0x3a')][_0x9ffa('0x70')]){_0x2d6132[_0x9ffa('0xa1')]={'user':_0x517921[_0x9ffa('0x3a')][_0x9ffa('0x6d')],'pass':_0x517921['Smtp']['pass']};}_0x2d6132['host']=_0x517921[_0x9ffa('0x3a')][_0x9ffa('0x72')];_0x2d6132[_0x9ffa('0x71')]=_0x517921[_0x9ffa('0x3a')][_0x9ffa('0x71')];_0x2d6132[_0x9ffa('0xa2')]=_0x517921['Smtp'][_0x9ffa('0xa2')];}else{_0x2d6132['service']=_0x517921[_0x9ffa('0x3a')][_0x9ffa('0x73')];_0x2d6132['auth']={'user':_0x517921[_0x9ffa('0x3a')][_0x9ffa('0x6d')],'pass':_0x517921[_0x9ffa('0x3a')][_0x9ffa('0xa3')]};}return respondWithRpcPromise(_0x9ffa('0xa4'),_0x9ffa('0xa5'),{'account':_0x2d6132,'message':_0x67382[_0x9ffa('0x58')]});}else{throw new Error(_0x9ffa('0xa6'));}}})[_0x9ffa('0x1f')](function(_0x21eb5d){if(_0x21eb5d){_0x16e142=_0x21eb5d;if(_0x46e394[_0x9ffa('0x96')]){if(_0x46e394[_0x9ffa('0x96')]['Contacts']['length']){return _0x46e394['List'][_0x9ffa('0x97')][0x0];}else{return db['CmContact'][_0x9ffa('0x67')](_['defaults'](_0x67382[_0x9ffa('0x58')],{'firstName':_0x67382[_0x9ffa('0x58')]['to'],'email':_0x67382[_0x9ffa('0x58')]['to'],'phone':_0x67382[_0x9ffa('0x58')]['to'],'ListId':_0x46e394[_0x9ffa('0x69')]}));}}else{throw new Error(_0x9ffa('0xa6'));}}})[_0x9ffa('0x1f')](function(_0x59fdc5){if(_0x59fdc5){var _0x1bb1f4={'UserId':_0x67382[_0x9ffa('0x6d')]['id'],'ContactId':_0x59fdc5['id'],'MailAccountId':_0x46e394['id'],'inReplyTo':_0x16e142[_0x9ffa('0xa7')],'to':_0x67382[_0x9ffa('0x58')]['from'],'cc':_0x67382[_0x9ffa('0x58')]['cc'],'subject':_0x67382[_0x9ffa('0x58')][_0x9ffa('0xa8')],'attach':_0x67382[_0x9ffa('0x58')][_0x9ffa('0xa9')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x9ffa('0x93')](_0x9ffa('0x94')),'lastMsgDirection':_0x9ffa('0xaa'),'lastMsgBody':_0x67382[_0x9ffa('0x58')][_0x9ffa('0x58')],'Messages':[_[_0x9ffa('0x4c')](_0x67382['body'],{'messageId':_0x16e142['messageId'],'sentAt':moment()[_0x9ffa('0x93')](_0x9ffa('0x94')),'read':!![],'MailAccountId':_0x46e394['id'],'UserId':_0x67382['user']['id'],'ContactId':_0x59fdc5['id']})]};if(_0x67382[_0x9ffa('0x58')][_0x9ffa('0xab')]){_0x1bb1f4=_[_0x9ffa('0x4c')](_0x1bb1f4,_0x67382[_0x9ffa('0x58')][_0x9ffa('0xab')]);}return db[_0x9ffa('0x7f')]['create'](_0x1bb1f4,{'include':[{'model':db[_0x9ffa('0x90')],'as':_0x9ffa('0xac')}]});}})[_0x9ffa('0x1f')](respondWithResult(_0x1b5485,null))['catch'](handleError(_0x1b5485,null));};exports[_0x9ffa('0xad')]=function(_0x2b275a,_0x473a5c,_0x4ecc4b){return db[_0x9ffa('0x3b')][_0x9ffa('0x56')]({'where':{'id':_0x2b275a[_0x9ffa('0x54')]['id']},'include':[{'model':db[_0x9ffa('0x39')],'as':'Smtp','raw':!![]}]})[_0x9ffa('0x1f')](handleEntityNotFound(_0x473a5c,null))['then'](function(_0x5b99ee){if(_0x5b99ee&&_0x5b99ee[_0x9ffa('0x3a')]){var _0x5641b7={'id':_0x5b99ee['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5b99ee[_0x9ffa('0x3a')]['service']){_0x5641b7[_0x9ffa('0x73')]=_0x5b99ee[_0x9ffa('0x3a')]['service'];}else{_0x5641b7[_0x9ffa('0x72')]=_0x5b99ee['Smtp'][_0x9ffa('0x72')];_0x5641b7[_0x9ffa('0x71')]=_0x5b99ee[_0x9ffa('0x3a')][_0x9ffa('0x71')];_0x5641b7[_0x9ffa('0xa2')]=_0x5b99ee['Smtp'][_0x9ffa('0xa2')];}if(_0x5b99ee['Smtp']['authentication']){_0x5641b7[_0x9ffa('0xa1')]={'user':_0x5b99ee['Smtp'][_0x9ffa('0x6d')],'pass':_0x5b99ee[_0x9ffa('0x3a')][_0x9ffa('0xa3')]};}return respondWithRpcPromise('VerifySmtp',_0x9ffa('0xad'),{'account':_0x5641b7});}})[_0x9ffa('0x1f')](respondWithResult(_0x473a5c,null))['catch'](handleError(_0x473a5c,null));};exports[_0x9ffa('0x33')]=function(_0x1aad1c,_0x56b814){return db[_0x9ffa('0x3b')][_0x9ffa('0x56')]({'where':{'id':_0x1aad1c['params']['id']}})[_0x9ffa('0x1f')](handleEntityNotFound(_0x56b814,null))[_0x9ffa('0x1f')](function(_0x1b2962){if(_0x1b2962&&_0x1b2962[_0x9ffa('0x73')]){throw new db[(_0x9ffa('0xae'))][(_0x9ffa('0xaf'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x1b2962;})[_0x9ffa('0x1f')](removeEntity(_0x56b814,null))[_0x9ffa('0x28')](handleError(_0x56b814,null));};exports[_0x9ffa('0xb0')]=function(_0x3971e2,_0x1337ff,_0x286a2c){return db[_0x9ffa('0x3b')][_0x9ffa('0x56')]({'where':{'id':_0x3971e2[_0x9ffa('0x54')]['id']}})[_0x9ffa('0x1f')](handleEntityNotFound(_0x1337ff,null))[_0x9ffa('0x1f')](function(_0x574fd6){if(_0x574fd6){return _0x574fd6[_0x9ffa('0xb0')](_0x3971e2[_0x9ffa('0x58')][_0x9ffa('0x66')],_[_0x9ffa('0x80')](_0x3971e2[_0x9ffa('0x58')],[_0x9ffa('0x66'),'id'])||{})[_0x9ffa('0xb1')](function(_0x2a1417){for(var _0x3e5250=0x0;_0x3e5250<_0x3971e2[_0x9ffa('0x58')]['ids']['length'];_0x3e5250+=0x1){socket[_0x9ffa('0xb2')](_0x9ffa('0xb3'),{'UserId':_0x3971e2[_0x9ffa('0x58')][_0x9ffa('0x66')][_0x3e5250],'MailAccountId':_0x3971e2[_0x9ffa('0x54')]['id']});}return _0x2a1417;});}})['then'](respondWithResult(_0x1337ff,null))[_0x9ffa('0x28')](handleError(_0x1337ff,null));};exports['removeAgents']=function(_0x46b50b,_0x23848c,_0x3c5749){var _0x29a229;return db[_0x9ffa('0x3b')][_0x9ffa('0x56')]({'where':{'id':_0x46b50b['params']['id']}})[_0x9ffa('0x1f')](handleEntityNotFound(_0x23848c,null))[_0x9ffa('0x1f')](function(_0x377738){if(_0x377738){return _0x377738[_0x9ffa('0xb4')](_0x46b50b['query'][_0x9ffa('0x66')])['then'](function(_0x377c4b){if(_[_0x9ffa('0xb5')](_0x46b50b[_0x9ffa('0x3f')][_0x9ffa('0x66')])){for(var _0x3e6b6a=0x0;_0x3e6b6a<_0x46b50b[_0x9ffa('0x3f')][_0x9ffa('0x66')][_0x9ffa('0x55')];_0x3e6b6a+=0x1){socket[_0x9ffa('0xb2')](_0x9ffa('0xb6'),{'UserId':_0x46b50b[_0x9ffa('0x3f')][_0x9ffa('0x66')][_0x3e6b6a],'MailAccountId':_0x46b50b[_0x9ffa('0x54')]['id']});}}else{socket[_0x9ffa('0xb2')](_0x9ffa('0xb6'),{'UserId':_0x46b50b[_0x9ffa('0x3f')]['ids'],'MailAccountId':_0x46b50b['params']['id']});}});}})[_0x9ffa('0x1f')](respondWithStatusCode(_0x23848c,null))['catch'](handleError(_0x23848c,null));};exports['getAgents']=function(_0x3094c6,_0x3b87f4,_0x3fe432){var _0x45c09e={};var _0x5dec3c={};var _0x247e09;var _0x303d43;return db[_0x9ffa('0x3b')][_0x9ffa('0x5e')]({'where':{'id':_0x3094c6[_0x9ffa('0x54')]['id']}})[_0x9ffa('0x1f')](handleEntityNotFound(_0x3b87f4,null))[_0x9ffa('0x1f')](function(_0x407555){if(_0x407555){_0x247e09=_0x407555;_0x5dec3c[_0x9ffa('0x3d')]=_[_0x9ffa('0x3e')](db['User']['rawAttributes']);_0x5dec3c[_0x9ffa('0x3f')]=_[_0x9ffa('0x3e')](_0x3094c6[_0x9ffa('0x3f')]);_0x5dec3c[_0x9ffa('0x42')]=_[_0x9ffa('0x43')](_0x5dec3c[_0x9ffa('0x3d')],_0x5dec3c[_0x9ffa('0x3f')]);_0x45c09e[_0x9ffa('0x44')]=_[_0x9ffa('0x43')](_0x5dec3c['model'],qs['fields'](_0x3094c6[_0x9ffa('0x3f')]['fields']));_0x45c09e[_0x9ffa('0x44')]=_0x45c09e['attributes'][_0x9ffa('0x55')]?_0x45c09e[_0x9ffa('0x44')]:_0x5dec3c[_0x9ffa('0x3d')];_0x45c09e[_0x9ffa('0x47')]=qs['sort'](_0x3094c6[_0x9ffa('0x3f')]['sort']);_0x45c09e[_0x9ffa('0x49')]=qs[_0x9ffa('0x42')](_[_0x9ffa('0x4a')](_0x3094c6[_0x9ffa('0x3f')],_0x5dec3c['filters']));if(_0x3094c6['query'][_0x9ffa('0x4d')]){_0x45c09e[_0x9ffa('0x49')]=_['merge'](_0x45c09e[_0x9ffa('0x49')],{'$or':_['map'](_0x45c09e[_0x9ffa('0x44')],function(_0x49a4e4){var _0x2b9dd2={};_0x2b9dd2[_0x49a4e4]={'$like':'%'+_0x3094c6['query']['filter']+'%'};return _0x2b9dd2;})});}_0x45c09e=_[_0x9ffa('0x4c')]({},_0x45c09e,_0x3094c6[_0x9ffa('0x4e')]);return _0x247e09[_0x9ffa('0xb7')](_0x45c09e);}})['then'](function(_0xd54403){if(_0xd54403){_0x303d43=_0xd54403['length'];if(!_0x3094c6[_0x9ffa('0x3f')][_0x9ffa('0x5f')]('nolimit')){_0x45c09e[_0x9ffa('0x2e')]=qs['limit'](_0x3094c6[_0x9ffa('0x3f')][_0x9ffa('0x2e')]);_0x45c09e[_0x9ffa('0x2d')]=qs[_0x9ffa('0x2d')](_0x3094c6['query']['offset']);}return _0x247e09['getAgents'](_0x45c09e);}})['then'](function(_0x1f8be3){if(_0x1f8be3){return _0x1f8be3?{'count':_0x303d43,'rows':_0x1f8be3}:null;}})['then'](respondWithResult(_0x3b87f4,null))[_0x9ffa('0x28')](handleError(_0x3b87f4,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 53a061b..0f6a7b0 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 _0xb4f1=['update','remove','emit','hasOwnProperty','hook','events','MailAccount','setMaxListeners'];(function(_0x12dd11,_0x52b882){var _0x3a502b=function(_0x1a660d){while(--_0x1a660d){_0x12dd11['push'](_0x12dd11['shift']());}};_0x3a502b(++_0x52b882);}(_0xb4f1,0x9d));var _0x1b4f=function(_0x4ee436,_0x128ec8){_0x4ee436=_0x4ee436-0x0;var _0x22b826=_0xb4f1[_0x4ee436];return _0x22b826;};'use strict';var EventEmitter=require(_0x1b4f('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x1b4f('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x1b4f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1b4f('0x3'),'afterDestroy':_0x1b4f('0x4')};function emitEvent(_0x19db2f){return function(_0x3c5e54,_0x2deb62,_0x5ba325){MailAccountEvents[_0x1b4f('0x5')](_0x19db2f+':'+_0x3c5e54['id'],_0x3c5e54);MailAccountEvents[_0x1b4f('0x5')](_0x19db2f,_0x3c5e54);_0x5ba325(null);};}for(var e in events){if(events[_0x1b4f('0x6')](e)){var event=events[e];MailAccount[_0x1b4f('0x7')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0xf3d7=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','save'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xf3d7,0x1a9));var _0x7f3d=function(_0x47c53e,_0x35f7f3){_0x47c53e=_0x47c53e-0x0;var _0x306afd=_0xf3d7[_0x47c53e];return _0x306afd;};'use strict';var EventEmitter=require(_0x7f3d('0x0'));var MailAccount=require(_0x7f3d('0x1'))['db'][_0x7f3d('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7f3d('0x3')](0x0);var events={'afterCreate':_0x7f3d('0x4'),'afterUpdate':'update','afterDestroy':_0x7f3d('0x5')};function emitEvent(_0x12f155){return function(_0x289d80,_0x1801ff,_0x2f96da){MailAccountEvents['emit'](_0x12f155+':'+_0x289d80['id'],_0x289d80);MailAccountEvents[_0x7f3d('0x6')](_0x12f155,_0x289d80);_0x2f96da(null);};}for(var e in events){if(events[_0x7f3d('0x7')](e)){var event=events[e];MailAccount[_0x7f3d('0x8')](e,emitEvent(event));}}module[_0x7f3d('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 2e67938..374ca5c 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 _0x319f=['exports','MailAccount','lodash','util','../../config/logger','api','moment','bluebird','./mailAccount.attributes'];(function(_0x1b93a2,_0x22bcd8){var _0x3c714d=function(_0x3f938a){while(--_0x3f938a){_0x1b93a2['push'](_0x1b93a2['shift']());}};_0x3c714d(++_0x22bcd8);}(_0x319f,0xbf));var _0xf319=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x319f[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xf319('0x0'));var util=require(_0xf319('0x1'));var logger=require(_0xf319('0x2'))(_0xf319('0x3'));var moment=require(_0xf319('0x4'));var BPromise=require(_0xf319('0x5'));var rp=require('request-promise');var attributes=require(_0xf319('0x6'));module[_0xf319('0x7')]=function(_0x101be6,_0x18b22c){return _0x101be6['define'](_0xf319('0x8'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcdf9=['lodash','util','../../config/logger','api','bluebird','./mailAccount.attributes','exports','define','MailAccount','mail_accounts'];(function(_0x118983,_0x2beef4){var _0x391c11=function(_0x1745f7){while(--_0x1745f7){_0x118983['push'](_0x118983['shift']());}};_0x391c11(++_0x2beef4);}(_0xcdf9,0x168));var _0x9cdf=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0xcdf9[_0x53cf8e];return _0x459197;};'use strict';var _=require(_0x9cdf('0x0'));var util=require(_0x9cdf('0x1'));var logger=require(_0x9cdf('0x2'))(_0x9cdf('0x3'));var moment=require('moment');var BPromise=require(_0x9cdf('0x4'));var rp=require('request-promise');var attributes=require(_0x9cdf('0x5'));module[_0x9cdf('0x6')]=function(_0x45631e,_0x5de3bf){return _0x45631e[_0x9cdf('0x7')](_0x9cdf('0x8'),attributes,{'tableName':_0x9cdf('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 35c9f48..a50e90a 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 _0x9552=['ListId','create','List\x20not\x20found','contact','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','MailInteraction','Contact\x20not\x20found','spread','update','subject','interaction','created','originCc','bcc','Attachment','UserId','User','name','agent','Start','startRouting','util','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','include','map','model','catch','ShowMailAccount','find','then','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','DESC','Applications','Smtp','get','applications','list','List','orderBy','priority','asc','account','autoclose','push','close','*,*,*,*','Contacts','length'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9552,0x148));var _0x2955=function(_0x1fa87b,_0x503544){_0x1fa87b=_0x1fa87b-0x0;var _0x591757=_0x9552[_0x1fa87b];return _0x591757;};'use strict';var _=require('lodash');var util=require(_0x2955('0x0'));var moment=require(_0x2955('0x1'));var BPromise=require(_0x2955('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2955('0x3'));var logger=require(_0x2955('0x4'))(_0x2955('0x5'));var config=require('../../config/environment');var jayson=require(_0x2955('0x6'));var client=jayson[_0x2955('0x7')]['http']({'port':0x232c});config[_0x2955('0x8')]=_[_0x2955('0x9')](config[_0x2955('0x8')],{'host':_0x2955('0xa'),'port':0x18eb});var socket=require(_0x2955('0xb'))(new Redis(config['redis']));require(_0x2955('0xc'))[_0x2955('0xd')](socket);function respondWithRpcPromise(_0x249874,_0x204221,_0x2d99a1){return new BPromise(function(_0x146238,_0x22e2d6){return client['request'](_0x249874,_0x2d99a1)['then'](function(_0x18fbbc){logger['info'](_0x2955('0xe'),_0x204221,_0x2955('0xf'));logger[_0x2955('0x10')](_0x2955('0x11'),_0x204221,'request\x20sent',JSON[_0x2955('0x12')](_0x18fbbc));if(_0x18fbbc[_0x2955('0x13')]){if(_0x18fbbc['error'][_0x2955('0x14')]===0x1f4){logger['error'](_0x2955('0xe'),_0x204221,_0x18fbbc['error'][_0x2955('0x15')]);return _0x22e2d6(_0x18fbbc[_0x2955('0x13')]['message']);}logger['error'](_0x2955('0xe'),_0x204221,_0x18fbbc['error'][_0x2955('0x15')]);return _0x146238(_0x18fbbc['error'][_0x2955('0x15')]);}else{logger[_0x2955('0x16')](_0x2955('0xe'),_0x204221,_0x2955('0xf'));_0x146238(_0x18fbbc['result'][_0x2955('0x15')]);}})['catch'](function(_0x5f14b1){logger[_0x2955('0x13')](_0x2955('0xe'),_0x204221,_0x5f14b1);_0x22e2d6(_0x5f14b1);});});}exports[_0x2955('0x17')]=function(_0x18b6fc){var _0x546bd8=this;return new Promise(function(_0x2e2d62,_0x3c939d){return db[_0x2955('0x18')][_0x2955('0x19')]({'raw':_0x18b6fc['options']?_0x18b6fc[_0x2955('0x1a')][_0x2955('0x1b')]===undefined?!![]:![]:!![],'where':_0x18b6fc[_0x2955('0x1a')]?_0x18b6fc[_0x2955('0x1a')][_0x2955('0x1c')]||null:null,'attributes':_0x18b6fc[_0x2955('0x1a')]?_0x18b6fc[_0x2955('0x1a')][_0x2955('0x1d')]||null:null,'limit':_0x18b6fc[_0x2955('0x1a')]?_0x18b6fc[_0x2955('0x1a')]['limit']||null:null,'include':_0x18b6fc[_0x2955('0x1a')]?_0x18b6fc[_0x2955('0x1a')][_0x2955('0x1e')]?_[_0x2955('0x1f')](_0x18b6fc['options'][_0x2955('0x1e')],function(_0x168606){return{'model':db[_0x168606[_0x2955('0x20')]],'as':_0x168606['as'],'attributes':_0x168606[_0x2955('0x1d')],'include':_0x168606[_0x2955('0x1e')]?_[_0x2955('0x1f')](_0x168606[_0x2955('0x1e')],function(_0x5635f5){return{'model':db[_0x5635f5[_0x2955('0x20')]],'as':_0x5635f5['as'],'attributes':_0x5635f5[_0x2955('0x1d')],'include':_0x5635f5[_0x2955('0x1e')]?_['map'](_0x5635f5[_0x2955('0x1e')],function(_0x3fdd48){return{'model':db[_0x3fdd48[_0x2955('0x20')]],'as':_0x3fdd48['as'],'attributes':_0x3fdd48['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c5a3a){logger[_0x2955('0x16')](_0x2955('0x17'),_0x18b6fc);logger['debug'](_0x2955('0x17'),_0x18b6fc,JSON[_0x2955('0x12')](_0x5c5a3a));_0x2e2d62(_0x5c5a3a);})[_0x2955('0x21')](function(_0x4fb9e3){logger[_0x2955('0x13')](_0x2955('0x17'),_0x4fb9e3[_0x2955('0x15')],_0x18b6fc);_0x3c939d(_0x546bd8['error'](0x1f4,_0x4fb9e3['message']));});});};exports[_0x2955('0x22')]=function(_0x74401f){var _0x4a8ddc=this;return new Promise(function(_0x12f6aa,_0x4dcb2b){return db[_0x2955('0x18')][_0x2955('0x23')]({'raw':_0x74401f[_0x2955('0x1a')]?_0x74401f[_0x2955('0x1a')][_0x2955('0x1b')]===undefined?!![]:![]:!![],'where':_0x74401f[_0x2955('0x1a')]?_0x74401f[_0x2955('0x1a')]['where']||null:null,'attributes':_0x74401f[_0x2955('0x1a')]?_0x74401f[_0x2955('0x1a')][_0x2955('0x1d')]||null:null,'include':_0x74401f[_0x2955('0x1a')]?_0x74401f[_0x2955('0x1a')][_0x2955('0x1e')]?_['map'](_0x74401f['options'][_0x2955('0x1e')],function(_0x14a5e8){return{'model':db[_0x14a5e8[_0x2955('0x20')]],'as':_0x14a5e8['as'],'attributes':_0x14a5e8[_0x2955('0x1d')],'include':_0x14a5e8[_0x2955('0x1e')]?_[_0x2955('0x1f')](_0x14a5e8[_0x2955('0x1e')],function(_0x40cf13){return{'model':db[_0x40cf13[_0x2955('0x20')]],'as':_0x40cf13['as'],'attributes':_0x40cf13[_0x2955('0x1d')],'include':_0x40cf13[_0x2955('0x1e')]?_[_0x2955('0x1f')](_0x40cf13[_0x2955('0x1e')],function(_0x4e1261){return{'model':db[_0x4e1261[_0x2955('0x20')]],'as':_0x4e1261['as'],'attributes':_0x4e1261[_0x2955('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2955('0x24')](function(_0x1f7838){logger[_0x2955('0x16')](_0x2955('0x22'),_0x74401f);logger['debug'](_0x2955('0x22'),_0x74401f,JSON['stringify'](_0x1f7838));_0x12f6aa(_0x1f7838);})[_0x2955('0x21')](function(_0x4c170e){logger['error'](_0x2955('0x22'),_0x4c170e['message'],_0x74401f);_0x4dcb2b(_0x4a8ddc[_0x2955('0x13')](0x1f4,_0x4c170e[_0x2955('0x15')]));});});};exports[_0x2955('0x25')]=function(_0x2dc75f){var _0x5ce46b=this;return new Promise(function(_0x272156,_0x39a5c5){var _0x21f9a3={'body':_0x2dc75f[_0x2955('0x26')],'channel':_0x2955('0x27')};var _0x18bf1e=_[_0x2955('0x28')](_[_0x2955('0x29')](db[_0x2955('0x2a')][_0x2955('0x2b')]),[_0x2955('0x2c'),_0x2955('0x2d'),_0x2955('0x2e'),'ListId']);var _0x49d35f=![];if(_0x2dc75f[_0x2955('0x26')]['id']){delete _0x2dc75f['body']['id'];}if(_[_0x2955('0x2f')](_0x2dc75f[_0x2955('0x26')][_0x2955('0x30')])){return _0x39a5c5(_0x5ce46b['error'](0x1f4,_0x2955('0x31')));}if(_[_0x2955('0x2f')](_0x2dc75f[_0x2955('0x26')][_0x2955('0x26')])||_0x2dc75f[_0x2955('0x26')]['body']===''){return _0x39a5c5(_0x5ce46b[_0x2955('0x13')](0x1f4,_0x2955('0x32')));}if(_[_0x2955('0x2f')](_0x2dc75f[_0x2955('0x26')][_0x2955('0x33')])){return _0x39a5c5(_0x5ce46b[_0x2955('0x13')](0x1f4,_0x2955('0x34')+_0x18bf1e));}if(!_[_0x2955('0x35')](_0x18bf1e,_0x2dc75f['body'][_0x2955('0x33')])){return _0x39a5c5(_0x5ce46b[_0x2955('0x13')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x18bf1e));}var _0x1ffa55={};_0x1ffa55[_0x2dc75f[_0x2955('0x26')][_0x2955('0x33')]]=_0x2dc75f[_0x2955('0x26')]['from'];return db['MailAccount'][_0x2955('0x23')]({'where':{'id':_0x2dc75f['account']['id']},'include':[{'model':db[_0x2955('0x36')],'as':'List','include':[{'model':db[_0x2955('0x2a')],'as':'Contacts','where':_0x1ffa55,'limit':0x1,'order':[[_0x2955('0x2d'),_0x2955('0x37')]]}]},{'model':db['MailApplication'],'as':_0x2955('0x38')},{'model':db['MailServerOut'],'as':_0x2955('0x39')}]})[_0x2955('0x24')](function(_0x1b65df){if(_0x1b65df&&_0x1b65df['List']){var _0x559c4d=_0x1b65df[_0x2955('0x3a')]({'plain':!![]});_0x21f9a3['account']=_['omit'](_0x559c4d,['Applications','List']);_0x21f9a3[_0x2955('0x3b')]=_0x559c4d[_0x2955('0x38')];_0x21f9a3[_0x2955('0x3c')]=_0x559c4d[_0x2955('0x3d')];_0x21f9a3[_0x2955('0x3b')]=_[_0x2955('0x3e')](_0x21f9a3[_0x2955('0x3b')],[_0x2955('0x3f')],[_0x2955('0x40')]);if(_0x21f9a3[_0x2955('0x41')]&&_0x21f9a3[_0x2955('0x41')][_0x2955('0x42')]){_0x21f9a3[_0x2955('0x3b')][_0x2955('0x43')]({'id':0x0,'priority':_0x21f9a3[_0x2955('0x3b')]['length']+0x1,'app':_0x2955('0x44'),'appdata':_0x2955('0x42'),'interval':_0x2955('0x45')});}if(_0x21f9a3[_0x2955('0x41')][_0x2955('0x38')]){delete _0x21f9a3[_0x2955('0x41')][_0x2955('0x38')];}if(_0x21f9a3['account'][_0x2955('0x3d')]){delete _0x21f9a3[_0x2955('0x41')][_0x2955('0x3d')];}if(_0x559c4d[_0x2955('0x3d')][_0x2955('0x46')][_0x2955('0x47')]){return _0x559c4d['List'][_0x2955('0x46')][0x0];}var _0x436abb=_[_0x2955('0x9')](_0x2dc75f['body'],{'firstName':_0x2dc75f[_0x2955('0x26')][_0x2955('0x30')],'ListId':_0x559c4d[_0x2955('0x48')]});_0x436abb[_0x2dc75f['body']['mapKey']]=_0x2dc75f['body'][_0x2955('0x30')];return db['CmContact'][_0x2955('0x49')](_0x436abb);}else{throw new Error(_0x2955('0x4a'));}})['then'](function(_0x1bfba8){_0x21f9a3[_0x2955('0x4b')]=_0x1bfba8;if(_0x1bfba8){if(!_0x2dc75f['body']['message'][_0x2955('0x4c')]){_0x2dc75f['body'][_0x2955('0x15')][_0x2955('0x4c')]=rs[_0x2955('0x4d')]()+'\x20'+_0x2dc75f['body'][_0x2955('0x15')][_0x2955('0x30')];}var _0x1e654={'ContactId':_0x1bfba8['id'],'MailAccountId':_0x2dc75f[_0x2955('0x41')]['id'],'inReplyTo':_0x2dc75f[_0x2955('0x26')][_0x2955('0x15')][_0x2955('0x4c')],'to':_0x2dc75f[_0x2955('0x26')][_0x2955('0x15')][_0x2955('0x30')],'cc':_0x2dc75f['body']['message']['cc'],'subject':_0x2dc75f[_0x2955('0x26')][_0x2955('0x15')]['subject'],'attach':_0x2dc75f[_0x2955('0x26')][_0x2955('0x15')][_0x2955('0x4e')],'lastMsgAt':moment()[_0x2955('0x4f')](_0x2955('0x50')),'lastMsgDirection':'in','lastMsgBody':_0x2dc75f[_0x2955('0x26')][_0x2955('0x26')]};return db['MailInteraction'][_0x2955('0x23')]({'where':{'closed':![],'MailAccountId':_0x2dc75f['account']['id']},'include':[{'model':db[_0x2955('0x51')],'as':_0x2955('0x52'),'attributes':[_0x2955('0x4c')],'where':{'messageId':_0x2dc75f[_0x2955('0x26')][_0x2955('0x15')][_0x2955('0x53')]}}]})[_0x2955('0x24')](function(_0x5b91fd){if(_0x5b91fd){return[_0x5b91fd,![]];}return db[_0x2955('0x54')][_0x2955('0x49')](_0x1e654)[_0x2955('0x24')](function(_0x7000f7){return[_0x7000f7,!![]];});});}else{throw new Error(_0x2955('0x55'));}})[_0x2955('0x56')](function(_0x43257,_0x3e56dc){if(_0x43257){_0x49d35f=_0x3e56dc;if(!_0x3e56dc){return _0x43257[_0x2955('0x57')]({'inReplyTo':_0x2dc75f[_0x2955('0x26')][_0x2955('0x15')][_0x2955('0x4c')],'to':_0x2dc75f[_0x2955('0x26')]['message'][_0x2955('0x30')],'cc':_0x2dc75f[_0x2955('0x26')][_0x2955('0x15')]['cc'],'subject':_0x2dc75f[_0x2955('0x26')][_0x2955('0x15')][_0x2955('0x58')],'attach':_0x43257[_0x2955('0x4e')]?_0x43257[_0x2955('0x4e')]:_0x2dc75f[_0x2955('0x26')][_0x2955('0x15')][_0x2955('0x4e')],'substatus':null,'substatusAt':moment()['format'](_0x2955('0x50')),'lastMsgAt':moment()[_0x2955('0x4f')](_0x2955('0x50')),'lastMsgDirection':'in','lastMsgBody':_0x2dc75f['body'][_0x2955('0x26')]});}else{return _0x43257;}}})['then'](function(_0x47cfe5){_0x21f9a3[_0x2955('0x59')]=_0x47cfe5[_0x2955('0x3a')]({'plain':!![]});_0x21f9a3[_0x2955('0x59')][_0x2955('0x5a')]=_0x49d35f;return db['MailMessage'][_0x2955('0x49')]({'body':_0x2dc75f[_0x2955('0x26')][_0x2955('0x26')],'MailAccountId':_0x2dc75f[_0x2955('0x41')]['id'],'MailInteractionId':_0x47cfe5['id'],'direction':'in','ContactId':_0x21f9a3[_0x2955('0x4b')]['id'],'messageId':_0x2dc75f['body']['message'][_0x2955('0x4c')],'from':_0x2dc75f['body']['message'][_0x2955('0x30')],'to':_0x2dc75f[_0x2955('0x26')][_0x2955('0x15')]['to'],'cc':_0x2dc75f[_0x2955('0x26')]['message']['cc'],'subject':_0x2dc75f[_0x2955('0x26')][_0x2955('0x15')]['subject'],'attach':_0x2dc75f[_0x2955('0x26')]['message']['attach'],'Attachments':_0x2dc75f[_0x2955('0x26')][_0x2955('0x15')]['attachments'],'originTo':_0x2dc75f['body'][_0x2955('0x15')]['originTo'],'originCc':_0x2dc75f[_0x2955('0x26')][_0x2955('0x15')][_0x2955('0x5b')],'bcc':_0x2dc75f[_0x2955('0x26')][_0x2955('0x15')][_0x2955('0x5c')]},{'include':[{'model':db[_0x2955('0x5d')],'as':'Attachments'}]});})[_0x2955('0x24')](function(_0x5502c7){_0x21f9a3['message']=_0x5502c7;if(_0x21f9a3[_0x2955('0x59')][_0x2955('0x5e')]){return db[_0x2955('0x5f')][_0x2955('0x23')]({'attributes':['id',_0x2955('0x60')],'where':{'id':_0x21f9a3['interaction'][_0x2955('0x5e')]}})['then'](function(_0x38432e){if(_0x38432e){_0x21f9a3['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x2955('0x61'),'appdata':_0x38432e[_0x2955('0x60')]+','+(_0x21f9a3['account']['waitForTheAssignedAgent']||0xa),'interval':_0x2955('0x45')});}return respondWithRpcPromise(_0x2955('0x62'),_0x2955('0x63'),_0x21f9a3);});}return respondWithRpcPromise('Start',_0x2955('0x63'),_0x21f9a3);})[_0x2955('0x24')](function(_0x5921ce){_0x272156(_0x5921ce);})[_0x2955('0x21')](function(_0x262531){_0x39a5c5(_0x5ce46b[_0x2955('0x13')](0x1f4,_0x262531[_0x2955('0x15')]));});});}; \ No newline at end of file +var _0x1afa=['MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','findAll','options','raw','where','include','map','model','attributes','info','GetMailAccount','stringify','ShowMailAccount','MailAccount','NotifyMailAccount','body','mail','keys','CmContact','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','find','account','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','get','omit','applications','orderBy','priority','autoclose','push','length','messageId','generate','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','MailInteraction','create','Contact\x20not\x20found','spread','subject','attach','interaction','created','attachments','originTo','bcc','Attachments','name','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1a526a,_0x3f1a43){var _0x355d5f=function(_0x1f21f1){while(--_0x1f21f1){_0x1a526a['push'](_0x1a526a['shift']());}};_0x355d5f(++_0x3f1a43);}(_0x1afa,0xb1));var _0xa1af=function(_0x56b5b7,_0x1bdfb7){_0x56b5b7=_0x56b5b7-0x0;var _0x44529f=_0x1afa[_0x56b5b7];return _0x44529f;};'use strict';var _=require(_0xa1af('0x0'));var util=require(_0xa1af('0x1'));var moment=require(_0xa1af('0x2'));var BPromise=require('bluebird');var rs=require(_0xa1af('0x3'));var fs=require('fs');var Redis=require(_0xa1af('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa1af('0x5'));var logger=require(_0xa1af('0x6'))(_0xa1af('0x7'));var config=require(_0xa1af('0x8'));var jayson=require(_0xa1af('0x9'));var client=jayson['client'][_0xa1af('0xa')]({'port':0x232c});config[_0xa1af('0xb')]=_[_0xa1af('0xc')](config[_0xa1af('0xb')],{'host':_0xa1af('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa1af('0xb')]));require('./mailAccount.socket')['register'](socket);function respondWithRpcPromise(_0x19bab4,_0x2e8215,_0x33dae0){return new BPromise(function(_0x44901a,_0x430348){return client[_0xa1af('0xe')](_0x19bab4,_0x33dae0)[_0xa1af('0xf')](function(_0x15743b){logger['info'](_0xa1af('0x10'),_0x2e8215,_0xa1af('0x11'));logger[_0xa1af('0x12')](_0xa1af('0x13'),_0x2e8215,'request\x20sent',JSON['stringify'](_0x15743b));if(_0x15743b[_0xa1af('0x14')]){if(_0x15743b['error'][_0xa1af('0x15')]===0x1f4){logger[_0xa1af('0x14')](_0xa1af('0x10'),_0x2e8215,_0x15743b[_0xa1af('0x14')]['message']);return _0x430348(_0x15743b[_0xa1af('0x14')][_0xa1af('0x16')]);}logger[_0xa1af('0x14')](_0xa1af('0x10'),_0x2e8215,_0x15743b['error']['message']);return _0x44901a(_0x15743b[_0xa1af('0x14')]['message']);}else{logger['info'](_0xa1af('0x10'),_0x2e8215,_0xa1af('0x11'));_0x44901a(_0x15743b[_0xa1af('0x17')][_0xa1af('0x16')]);}})[_0xa1af('0x18')](function(_0x3a74a9){logger['error'](_0xa1af('0x10'),_0x2e8215,_0x3a74a9);_0x430348(_0x3a74a9);});});}exports['GetMailAccount']=function(_0x4418c7){var _0x44fa20=this;return new Promise(function(_0x35107b,_0x20c21f){return db['MailAccount'][_0xa1af('0x19')]({'raw':_0x4418c7['options']?_0x4418c7[_0xa1af('0x1a')][_0xa1af('0x1b')]===undefined?!![]:![]:!![],'where':_0x4418c7['options']?_0x4418c7[_0xa1af('0x1a')][_0xa1af('0x1c')]||null:null,'attributes':_0x4418c7[_0xa1af('0x1a')]?_0x4418c7[_0xa1af('0x1a')]['attributes']||null:null,'limit':_0x4418c7[_0xa1af('0x1a')]?_0x4418c7['options']['limit']||null:null,'include':_0x4418c7[_0xa1af('0x1a')]?_0x4418c7['options'][_0xa1af('0x1d')]?_[_0xa1af('0x1e')](_0x4418c7[_0xa1af('0x1a')][_0xa1af('0x1d')],function(_0x3ea14a){return{'model':db[_0x3ea14a[_0xa1af('0x1f')]],'as':_0x3ea14a['as'],'attributes':_0x3ea14a[_0xa1af('0x20')],'include':_0x3ea14a['include']?_[_0xa1af('0x1e')](_0x3ea14a[_0xa1af('0x1d')],function(_0x57bebd){return{'model':db[_0x57bebd[_0xa1af('0x1f')]],'as':_0x57bebd['as'],'attributes':_0x57bebd[_0xa1af('0x20')],'include':_0x57bebd[_0xa1af('0x1d')]?_[_0xa1af('0x1e')](_0x57bebd['include'],function(_0x5efd14){return{'model':db[_0x5efd14[_0xa1af('0x1f')]],'as':_0x5efd14['as'],'attributes':_0x5efd14[_0xa1af('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4fc866){logger[_0xa1af('0x21')](_0xa1af('0x22'),_0x4418c7);logger['debug'](_0xa1af('0x22'),_0x4418c7,JSON[_0xa1af('0x23')](_0x4fc866));_0x35107b(_0x4fc866);})[_0xa1af('0x18')](function(_0x5931e4){logger[_0xa1af('0x14')](_0xa1af('0x22'),_0x5931e4[_0xa1af('0x16')],_0x4418c7);_0x20c21f(_0x44fa20[_0xa1af('0x14')](0x1f4,_0x5931e4['message']));});});};exports[_0xa1af('0x24')]=function(_0x5517f3){var _0x12a875=this;return new Promise(function(_0x919d0d,_0x32baa3){return db[_0xa1af('0x25')]['find']({'raw':_0x5517f3['options']?_0x5517f3[_0xa1af('0x1a')][_0xa1af('0x1b')]===undefined?!![]:![]:!![],'where':_0x5517f3['options']?_0x5517f3[_0xa1af('0x1a')]['where']||null:null,'attributes':_0x5517f3[_0xa1af('0x1a')]?_0x5517f3['options'][_0xa1af('0x20')]||null:null,'include':_0x5517f3['options']?_0x5517f3[_0xa1af('0x1a')]['include']?_[_0xa1af('0x1e')](_0x5517f3[_0xa1af('0x1a')][_0xa1af('0x1d')],function(_0x36c30a){return{'model':db[_0x36c30a[_0xa1af('0x1f')]],'as':_0x36c30a['as'],'attributes':_0x36c30a[_0xa1af('0x20')],'include':_0x36c30a[_0xa1af('0x1d')]?_[_0xa1af('0x1e')](_0x36c30a[_0xa1af('0x1d')],function(_0xa50f88){return{'model':db[_0xa50f88[_0xa1af('0x1f')]],'as':_0xa50f88['as'],'attributes':_0xa50f88['attributes'],'include':_0xa50f88[_0xa1af('0x1d')]?_[_0xa1af('0x1e')](_0xa50f88['include'],function(_0x3f66ae){return{'model':db[_0x3f66ae['model']],'as':_0x3f66ae['as'],'attributes':_0x3f66ae[_0xa1af('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa1af('0xf')](function(_0x1f30a9){logger['info'](_0xa1af('0x24'),_0x5517f3);logger[_0xa1af('0x12')](_0xa1af('0x24'),_0x5517f3,JSON['stringify'](_0x1f30a9));_0x919d0d(_0x1f30a9);})[_0xa1af('0x18')](function(_0x2eb54f){logger[_0xa1af('0x14')](_0xa1af('0x24'),_0x2eb54f[_0xa1af('0x16')],_0x5517f3);_0x32baa3(_0x12a875[_0xa1af('0x14')](0x1f4,_0x2eb54f['message']));});});};exports[_0xa1af('0x26')]=function(_0x50f860){var _0x27c332=this;return new Promise(function(_0x3c9dec,_0x5696c9){var _0x5a441e={'body':_0x50f860[_0xa1af('0x27')],'channel':_0xa1af('0x28')};var _0x5f2d1d=_['difference'](_[_0xa1af('0x29')](db[_0xa1af('0x2a')]['rawAttributes']),[_0xa1af('0x2b'),_0xa1af('0x2c'),_0xa1af('0x2d'),_0xa1af('0x2e')]);var _0x14e143=![];if(_0x50f860[_0xa1af('0x27')]['id']){delete _0x50f860['body']['id'];}if(_[_0xa1af('0x2f')](_0x50f860[_0xa1af('0x27')][_0xa1af('0x30')])){return _0x5696c9(_0x27c332[_0xa1af('0x14')](0x1f4,_0xa1af('0x31')));}if(_[_0xa1af('0x2f')](_0x50f860[_0xa1af('0x27')]['body'])||_0x50f860['body'][_0xa1af('0x27')]===''){return _0x5696c9(_0x27c332['error'](0x1f4,_0xa1af('0x32')));}if(_[_0xa1af('0x2f')](_0x50f860[_0xa1af('0x27')][_0xa1af('0x33')])){return _0x5696c9(_0x27c332[_0xa1af('0x14')](0x1f4,_0xa1af('0x34')+_0x5f2d1d));}if(!_[_0xa1af('0x35')](_0x5f2d1d,_0x50f860[_0xa1af('0x27')][_0xa1af('0x33')])){return _0x5696c9(_0x27c332[_0xa1af('0x14')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5f2d1d));}var _0x156766={};_0x156766[_0x50f860[_0xa1af('0x27')][_0xa1af('0x33')]]=_0x50f860[_0xa1af('0x27')][_0xa1af('0x30')];return db[_0xa1af('0x25')][_0xa1af('0x36')]({'where':{'id':_0x50f860[_0xa1af('0x37')]['id']},'include':[{'model':db['CmList'],'as':_0xa1af('0x38'),'include':[{'model':db[_0xa1af('0x2a')],'as':_0xa1af('0x39'),'where':_0x156766,'limit':0x1,'order':[[_0xa1af('0x2c'),_0xa1af('0x3a')]]}]},{'model':db[_0xa1af('0x3b')],'as':_0xa1af('0x3c')},{'model':db[_0xa1af('0x3d')],'as':_0xa1af('0x3e')}]})['then'](function(_0x5805ee){if(_0x5805ee&&_0x5805ee['List']){var _0x1105b2=_0x5805ee[_0xa1af('0x3f')]({'plain':!![]});_0x5a441e['account']=_[_0xa1af('0x40')](_0x1105b2,[_0xa1af('0x3c'),_0xa1af('0x38')]);_0x5a441e[_0xa1af('0x41')]=_0x1105b2[_0xa1af('0x3c')];_0x5a441e['list']=_0x1105b2[_0xa1af('0x38')];_0x5a441e['applications']=_[_0xa1af('0x42')](_0x5a441e[_0xa1af('0x41')],[_0xa1af('0x43')],['asc']);if(_0x5a441e[_0xa1af('0x37')]&&_0x5a441e[_0xa1af('0x37')][_0xa1af('0x44')]){_0x5a441e['applications'][_0xa1af('0x45')]({'id':0x0,'priority':_0x5a441e[_0xa1af('0x41')][_0xa1af('0x46')]+0x1,'app':'close','appdata':_0xa1af('0x44'),'interval':'*,*,*,*'});}if(_0x5a441e[_0xa1af('0x37')][_0xa1af('0x3c')]){delete _0x5a441e[_0xa1af('0x37')][_0xa1af('0x3c')];}if(_0x5a441e[_0xa1af('0x37')][_0xa1af('0x38')]){delete _0x5a441e[_0xa1af('0x37')][_0xa1af('0x38')];}if(_0x1105b2['List'][_0xa1af('0x39')][_0xa1af('0x46')]){return _0x1105b2[_0xa1af('0x38')]['Contacts'][0x0];}var _0x83f908=_[_0xa1af('0xc')](_0x50f860[_0xa1af('0x27')],{'firstName':_0x50f860[_0xa1af('0x27')][_0xa1af('0x30')],'ListId':_0x1105b2[_0xa1af('0x2e')]});_0x83f908[_0x50f860[_0xa1af('0x27')]['mapKey']]=_0x50f860[_0xa1af('0x27')]['from'];return db[_0xa1af('0x2a')]['create'](_0x83f908);}else{throw new Error('List\x20not\x20found');}})['then'](function(_0x47d6cb){_0x5a441e['contact']=_0x47d6cb;if(_0x47d6cb){if(!_0x50f860[_0xa1af('0x27')][_0xa1af('0x16')][_0xa1af('0x47')]){_0x50f860[_0xa1af('0x27')]['message'][_0xa1af('0x47')]=rs[_0xa1af('0x48')]()+'\x20'+_0x50f860[_0xa1af('0x27')][_0xa1af('0x16')][_0xa1af('0x30')];}var _0xe3b855={'ContactId':_0x47d6cb['id'],'MailAccountId':_0x50f860['account']['id'],'inReplyTo':_0x50f860[_0xa1af('0x27')]['message'][_0xa1af('0x47')],'to':_0x50f860['body'][_0xa1af('0x16')][_0xa1af('0x30')],'cc':_0x50f860[_0xa1af('0x27')]['message']['cc'],'subject':_0x50f860['body']['message']['subject'],'attach':_0x50f860[_0xa1af('0x27')]['message']['attach'],'lastMsgAt':moment()[_0xa1af('0x49')](_0xa1af('0x4a')),'lastMsgDirection':'in','lastMsgBody':_0x50f860['body'][_0xa1af('0x27')]};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x50f860[_0xa1af('0x37')]['id']},'include':[{'model':db[_0xa1af('0x4b')],'as':_0xa1af('0x4c'),'attributes':[_0xa1af('0x47')],'where':{'messageId':_0x50f860['body'][_0xa1af('0x16')][_0xa1af('0x4d')]}}]})['then'](function(_0x20f47b){if(_0x20f47b){return[_0x20f47b,![]];}return db[_0xa1af('0x4e')][_0xa1af('0x4f')](_0xe3b855)[_0xa1af('0xf')](function(_0x4766e4){return[_0x4766e4,!![]];});});}else{throw new Error(_0xa1af('0x50'));}})[_0xa1af('0x51')](function(_0x3768a5,_0x2c3361){if(_0x3768a5){_0x14e143=_0x2c3361;if(!_0x2c3361){return _0x3768a5['update']({'inReplyTo':_0x50f860[_0xa1af('0x27')][_0xa1af('0x16')][_0xa1af('0x47')],'to':_0x50f860['body'][_0xa1af('0x16')][_0xa1af('0x30')],'cc':_0x50f860[_0xa1af('0x27')]['message']['cc'],'subject':_0x50f860[_0xa1af('0x27')][_0xa1af('0x16')][_0xa1af('0x52')],'attach':_0x3768a5[_0xa1af('0x53')]?_0x3768a5['attach']:_0x50f860[_0xa1af('0x27')][_0xa1af('0x16')][_0xa1af('0x53')],'substatus':null,'substatusAt':moment()[_0xa1af('0x49')](_0xa1af('0x4a')),'lastMsgAt':moment()['format'](_0xa1af('0x4a')),'lastMsgDirection':'in','lastMsgBody':_0x50f860[_0xa1af('0x27')][_0xa1af('0x27')]});}else{return _0x3768a5;}}})[_0xa1af('0xf')](function(_0x27071a){_0x5a441e[_0xa1af('0x54')]=_0x27071a[_0xa1af('0x3f')]({'plain':!![]});_0x5a441e[_0xa1af('0x54')][_0xa1af('0x55')]=_0x14e143;return db[_0xa1af('0x4b')]['create']({'body':_0x50f860[_0xa1af('0x27')][_0xa1af('0x27')],'MailAccountId':_0x50f860[_0xa1af('0x37')]['id'],'MailInteractionId':_0x27071a['id'],'direction':'in','ContactId':_0x5a441e['contact']['id'],'messageId':_0x50f860[_0xa1af('0x27')]['message'][_0xa1af('0x47')],'from':_0x50f860[_0xa1af('0x27')]['message'][_0xa1af('0x30')],'to':_0x50f860['body'][_0xa1af('0x16')]['to'],'cc':_0x50f860[_0xa1af('0x27')][_0xa1af('0x16')]['cc'],'subject':_0x50f860[_0xa1af('0x27')]['message'][_0xa1af('0x52')],'attach':_0x50f860[_0xa1af('0x27')][_0xa1af('0x16')][_0xa1af('0x53')],'Attachments':_0x50f860[_0xa1af('0x27')]['message'][_0xa1af('0x56')],'originTo':_0x50f860['body'][_0xa1af('0x16')][_0xa1af('0x57')],'originCc':_0x50f860[_0xa1af('0x27')][_0xa1af('0x16')]['originCc'],'bcc':_0x50f860[_0xa1af('0x27')]['message'][_0xa1af('0x58')]},{'include':[{'model':db['Attachment'],'as':_0xa1af('0x59')}]});})['then'](function(_0x1e66d6){_0x5a441e['message']=_0x1e66d6;if(_0x5a441e[_0xa1af('0x54')]['UserId']){return db['User'][_0xa1af('0x36')]({'attributes':['id',_0xa1af('0x5a')],'where':{'id':_0x5a441e[_0xa1af('0x54')][_0xa1af('0x5b')]}})[_0xa1af('0xf')](function(_0x24f717){if(_0x24f717){_0x5a441e[_0xa1af('0x41')][_0xa1af('0x5c')]({'id':0x0,'priority':0x0,'app':_0xa1af('0x5d'),'appdata':_0x24f717[_0xa1af('0x5a')]+','+(_0x5a441e[_0xa1af('0x37')][_0xa1af('0x5e')]||0xa),'interval':_0xa1af('0x5f')});}return respondWithRpcPromise(_0xa1af('0x60'),_0xa1af('0x61'),_0x5a441e);});}return respondWithRpcPromise(_0xa1af('0x60'),_0xa1af('0x61'),_0x5a441e);})[_0xa1af('0xf')](function(_0x4c8d73){_0x3c9dec(_0x4c8d73);})[_0xa1af('0x18')](function(_0x32dda5){_0x5696c9(_0x27c332[_0xa1af('0x14')](0x1f4,_0x32dda5[_0xa1af('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 6e544e4..89d25e2 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 _0xfa66=['emit','removeListener','register','length','save','remove','update'];(function(_0x3a3c17,_0x5b7b7e){var _0xd07f21=function(_0xeaad44){while(--_0xeaad44){_0x3a3c17['push'](_0x3a3c17['shift']());}};_0xd07f21(++_0x5b7b7e);}(_0xfa66,0xb3));var _0x6fa6=function(_0x4d4c10,_0x108b7f){_0x4d4c10=_0x4d4c10-0x0;var _0x387b59=_0xfa66[_0x4d4c10];return _0x387b59;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x6fa6('0x0'),_0x6fa6('0x1'),_0x6fa6('0x2')];function createListener(_0x2983b9,_0x201364){return function(_0x2139cf){_0x201364[_0x6fa6('0x3')](_0x2983b9,_0x2139cf);};}function removeListener(_0x2a7eac,_0x1eafbf){return function(){MailAccountEvents[_0x6fa6('0x4')](_0x2a7eac,_0x1eafbf);};}exports[_0x6fa6('0x5')]=function(_0x34fbd5){for(var _0x5e1f6b=0x0,_0x9e2e3e=events[_0x6fa6('0x6')];_0x5e1f6b<_0x9e2e3e;_0x5e1f6b++){var _0x32cd4f=events[_0x5e1f6b];var _0x3fff51=createListener('mailAccount:'+_0x32cd4f,_0x34fbd5);MailAccountEvents['on'](_0x32cd4f,_0x3fff51);}}; \ No newline at end of file +var _0xc869=['removeListener','register','length','mailAccount:','save','remove','update','emit'];(function(_0x38941d,_0x686681){var _0x4b7af1=function(_0x35b920){while(--_0x35b920){_0x38941d['push'](_0x38941d['shift']());}};_0x4b7af1(++_0x686681);}(_0xc869,0x1ec));var _0x9c86=function(_0x4cfac7,_0x5c15d3){_0x4cfac7=_0x4cfac7-0x0;var _0x2afa59=_0xc869[_0x4cfac7];return _0x2afa59;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x9c86('0x0'),_0x9c86('0x1'),_0x9c86('0x2')];function createListener(_0xe4a965,_0x1ed7e0){return function(_0x4585c5){_0x1ed7e0[_0x9c86('0x3')](_0xe4a965,_0x4585c5);};}function removeListener(_0x82cb0a,_0x3d46e2){return function(){MailAccountEvents[_0x9c86('0x4')](_0x82cb0a,_0x3d46e2);};}exports[_0x9c86('0x5')]=function(_0xcb5fb){for(var _0xec1b7c=0x0,_0x1233a2=events[_0x9c86('0x6')];_0xec1b7c<_0x1233a2;_0xec1b7c++){var _0x15754e=events[_0xec1b7c];var _0x3fabf3=createListener(_0x9c86('0x7')+_0x15754e,_0xcb5fb);MailAccountEvents['on'](_0x15754e,_0x3fabf3);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index fdd160f..747dd6d 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 _0x4d9e=['update','delete','destroy','exports','multer','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','put'];(function(_0x3149cf,_0x1266eb){var _0x4d283a=function(_0x544724){while(--_0x544724){_0x3149cf['push'](_0x3149cf['shift']());}};_0x4d283a(++_0x1266eb);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x2004a8,_0x3841a0){_0x2004a8=_0x2004a8-0x0;var _0x4c1903=_0x4d9e[_0x2004a8];return _0x4c1903;};'use strict';var multer=require(_0xe4d9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe4d9('0x1'));var express=require('express');var router=express[_0xe4d9('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xe4d9('0x3'));var config=require(_0xe4d9('0x4'));var controller=require('./mailApplication.controller');router[_0xe4d9('0x5')](_0xe4d9('0x6'),auth[_0xe4d9('0x7')](),controller[_0xe4d9('0x8')]);router[_0xe4d9('0x9')](_0xe4d9('0x6'),auth['isAuthenticated'](),controller[_0xe4d9('0xa')]);router[_0xe4d9('0xb')](_0xe4d9('0x6'),auth[_0xe4d9('0x7')](),controller[_0xe4d9('0xc')]);module[_0xe4d9('0xd')]=router; \ No newline at end of file +var _0x6737=['express','Router','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','isAuthenticated','show','delete','destroy','util','path'];(function(_0x4a9d87,_0x2cc20f){var _0x1ad978=function(_0x37673c){while(--_0x37673c){_0x4a9d87['push'](_0x4a9d87['shift']());}};_0x1ad978(++_0x2cc20f);}(_0x6737,0xe2));var _0x7673=function(_0x21489a,_0x76bdfc){_0x21489a=_0x21489a-0x0;var _0x3d09e3=_0x6737[_0x21489a];return _0x3d09e3;};'use strict';var multer=require('multer');var util=require(_0x7673('0x0'));var path=require(_0x7673('0x1'));var timeout=require('connect-timeout');var express=require(_0x7673('0x2'));var router=express[_0x7673('0x3')]();var auth=require(_0x7673('0x4'));var interaction=require(_0x7673('0x5'));var config=require('../../config/environment');var controller=require(_0x7673('0x6'));router[_0x7673('0x7')]('/:id',auth[_0x7673('0x8')](),controller[_0x7673('0x9')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x7673('0xa')]('/:id',auth[_0x7673('0x8')](),controller[_0x7673('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index c95baab..e09a808 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 _0x31d8=['INTEGER','STRING','noop','sequelize'];(function(_0x109848,_0x26a29a){var _0x366257=function(_0x13d4cb){while(--_0x13d4cb){_0x109848['push'](_0x109848['shift']());}};_0x366257(++_0x26a29a);}(_0x31d8,0xb7));var _0x831d=function(_0x4ccdc4,_0x2797c6){_0x4ccdc4=_0x4ccdc4-0x0;var _0x689053=_0x31d8[_0x4ccdc4];return _0x689053;};'use strict';var Sequelize=require(_0x831d('0x0'));module['exports']={'priority':{'type':Sequelize[_0x831d('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x831d('0x2')],'allowNull':![],'defaultValue':_0x831d('0x3')},'appdata':{'type':Sequelize[_0x831d('0x2')](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0x831d('0x2')]},'interval':{'type':Sequelize[_0x831d('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xee5a=['noop','STRING','exports'];(function(_0x2e1ad7,_0x2fb1a6){var _0x203810=function(_0x7edae){while(--_0x7edae){_0x2e1ad7['push'](_0x2e1ad7['shift']());}};_0x203810(++_0x2fb1a6);}(_0xee5a,0x1a3));var _0xaee5=function(_0x409b3e,_0x246d8d){_0x409b3e=_0x409b3e-0x0;var _0x354461=_0xee5a[_0x409b3e];return _0x354461;};'use strict';var Sequelize=require('sequelize');module[_0xaee5('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xaee5('0x1')},'appdata':{'type':Sequelize[_0xaee5('0x2')](0x1000),'defaultValue':''},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index c113ad2..d232e30 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 _0x949d=['model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','options','find','then','body','MailApplication','params','catch','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','error','stack','name','send','show'];(function(_0x281f21,_0x1a0091){var _0x2d8ad4=function(_0x44dc70){while(--_0x44dc70){_0x281f21['push'](_0x281f21['shift']());}};_0x2d8ad4(++_0x1a0091);}(_0x949d,0x162));var _0xd949=function(_0x239f1e,_0x56dcac){_0x239f1e=_0x239f1e-0x0;var _0x768743=_0x949d[_0x239f1e];return _0x768743;};'use strict';var pdf=require(_0xd949('0x0'));var emlformat=require(_0xd949('0x1'));var rimraf=require(_0xd949('0x2'));var zipdir=require(_0xd949('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd949('0x4'));var BPromise=require(_0xd949('0x5'));var Mustache=require('mustache');var util=require(_0xd949('0x6'));var path=require(_0xd949('0x7'));var sox=require('sox');var csv=require(_0xd949('0x8'));var ejs=require(_0xd949('0x9'));var fs=require('fs');var _=require(_0xd949('0xa'));var squel=require('squel');var crypto=require(_0xd949('0xb'));var jsforce=require(_0xd949('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd949('0xd'));var Papa=require(_0xd949('0xe'));var Redis=require(_0xd949('0xf'));var qs=require(_0xd949('0x10'));var logger=require(_0xd949('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xd949('0x12'));var db=require(_0xd949('0x13'))['db'];function respondWithStatusCode(_0xc55b5a,_0x37517a){_0x37517a=_0x37517a||0xcc;return function(_0x59159b){if(_0x59159b){return _0xc55b5a[_0xd949('0x14')](_0x37517a);}return _0xc55b5a[_0xd949('0x15')](_0x37517a)[_0xd949('0x16')]();};}function respondWithResult(_0x182284,_0x3756ba){_0x3756ba=_0x3756ba||0xc8;return function(_0x2edba2){if(_0x2edba2){return _0x182284[_0xd949('0x15')](_0x3756ba)[_0xd949('0x17')](_0x2edba2);}};}function respondWithFilteredResult(_0x4eb028,_0x319286){return function(_0x2efe05){if(_0x2efe05){var _0x3fc0bb=_0x2efe05[_0xd949('0x18')],_0x45870e=_0x319286[_0xd949('0x19')],_0x50ee4d=_0x319286[_0xd949('0x19')]+_0x319286[_0xd949('0x1a')],_0x16f1ad;if(_0x50ee4d>=_0x3fc0bb){_0x50ee4d=_0x3fc0bb;_0x16f1ad=0xc8;}else{_0x16f1ad=0xce;}_0x4eb028[_0xd949('0x15')](_0x16f1ad);return _0x4eb028[_0xd949('0x1b')]('Content-Range',_0x45870e+'-'+_0x50ee4d+'/'+_0x3fc0bb)[_0xd949('0x17')](_0x2efe05);}return null;};}function patchUpdates(_0x2a2859){return function(_0x5a0790){try{jsonpatch[_0xd949('0x1c')](_0x5a0790,_0x2a2859,!![]);}catch(_0x133445){return BPromise[_0xd949('0x1d')](_0x133445);}return _0x5a0790[_0xd949('0x1e')]();};}function saveUpdates(_0x157f76,_0x495cbf){return function(_0x25f52f){if(_0x25f52f){return _0x25f52f[_0xd949('0x1f')](_0x157f76)['then'](function(_0x582d8e){return _0x582d8e;});}return null;};}function removeEntity(_0x6c4e63,_0xb06b83){return function(_0x14f080){if(_0x14f080){return _0x14f080[_0xd949('0x20')]()['then'](function(){_0x6c4e63['status'](0xcc)[_0xd949('0x16')]();});}};}function handleEntityNotFound(_0x40484f,_0x6c4e09){return function(_0xf0cc12){if(!_0xf0cc12){_0x40484f[_0xd949('0x14')](0x194);}return _0xf0cc12;};}function handleError(_0x38978f,_0x94a7a8){_0x94a7a8=_0x94a7a8||0x1f4;return function(_0x541785){logger[_0xd949('0x21')](_0x541785[_0xd949('0x22')]);if(_0x541785[_0xd949('0x23')]){delete _0x541785[_0xd949('0x23')];}_0x38978f['status'](_0x94a7a8)[_0xd949('0x24')](_0x541785);};}exports[_0xd949('0x25')]=function(_0x1e9abd,_0xfd040a){var _0x31811d={'raw':!![],'where':{'id':_0x1e9abd['params']['id']}},_0x47b26d={};_0x47b26d[_0xd949('0x26')]=_[_0xd949('0x27')](db['MailApplication'][_0xd949('0x28')]);_0x47b26d[_0xd949('0x29')]=_['keys'](_0x1e9abd['query']);_0x47b26d[_0xd949('0x2a')]=_[_0xd949('0x2b')](_0x47b26d[_0xd949('0x26')],_0x47b26d[_0xd949('0x29')]);_0x31811d['attributes']=_[_0xd949('0x2b')](_0x47b26d['model'],qs[_0xd949('0x2c')](_0x1e9abd['query']['fields']));_0x31811d[_0xd949('0x2d')]=_0x31811d['attributes'][_0xd949('0x2e')]?_0x31811d[_0xd949('0x2d')]:_0x47b26d['model'];if(_0x1e9abd['query'][_0xd949('0x2f')]){_0x31811d[_0xd949('0x30')]=[{'all':!![]}];}_0x31811d=_['merge']({},_0x31811d,_0x1e9abd[_0xd949('0x31')]);return db['MailApplication'][_0xd949('0x32')](_0x31811d)[_0xd949('0x33')](handleEntityNotFound(_0xfd040a,null))['then'](respondWithResult(_0xfd040a,null))['catch'](handleError(_0xfd040a,null));};exports[_0xd949('0x1f')]=function(_0x4683e7,_0x2fbfba){if(_0x4683e7[_0xd949('0x34')]['id']){delete _0x4683e7[_0xd949('0x34')]['id'];}return db[_0xd949('0x35')][_0xd949('0x32')]({'where':{'id':_0x4683e7[_0xd949('0x36')]['id']}})[_0xd949('0x33')](handleEntityNotFound(_0x2fbfba,null))[_0xd949('0x33')](saveUpdates(_0x4683e7[_0xd949('0x34')],null))[_0xd949('0x33')](respondWithResult(_0x2fbfba,null))[_0xd949('0x37')](handleError(_0x2fbfba,null));};exports[_0xd949('0x20')]=function(_0x5745bc,_0x25d4fa){return db[_0xd949('0x35')][_0xd949('0x32')]({'where':{'id':_0x5745bc[_0xd949('0x36')]['id']}})[_0xd949('0x33')](handleEntityNotFound(_0x25d4fa,null))['then'](removeEntity(_0x25d4fa,null))['catch'](handleError(_0x25d4fa,null));}; \ No newline at end of file +var _0x3cfb=['json','reject','save','update','then','destroy','error','stack','name','send','show','keys','MailApplication','query','filters','intersection','model','attributes','length','includeAll','include','merge','options','catch','body','params','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range'];(function(_0x4c584d,_0x5a81cd){var _0x37c74c=function(_0x51fb1b){while(--_0x51fb1b){_0x4c584d['push'](_0x4c584d['shift']());}};_0x37c74c(++_0x5a81cd);}(_0x3cfb,0x1b8));var _0xb3cf=function(_0x2b980a,_0x14143b){_0x2b980a=_0x2b980a-0x0;var _0x42dd19=_0x3cfb[_0x2b980a];return _0x42dd19;};'use strict';var pdf=require(_0xb3cf('0x0'));var emlformat=require(_0xb3cf('0x1'));var rimraf=require(_0xb3cf('0x2'));var zipdir=require(_0xb3cf('0x3'));var jsonpatch=require(_0xb3cf('0x4'));var rp=require(_0xb3cf('0x5'));var moment=require(_0xb3cf('0x6'));var BPromise=require(_0xb3cf('0x7'));var Mustache=require('mustache');var util=require(_0xb3cf('0x8'));var path=require(_0xb3cf('0x9'));var sox=require(_0xb3cf('0xa'));var csv=require('to-csv');var ejs=require(_0xb3cf('0xb'));var fs=require('fs');var _=require(_0xb3cf('0xc'));var squel=require(_0xb3cf('0xd'));var crypto=require('crypto');var jsforce=require(_0xb3cf('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb3cf('0xf'));var Papa=require(_0xb3cf('0x10'));var Redis=require(_0xb3cf('0x11'));var qs=require(_0xb3cf('0x12'));var logger=require(_0xb3cf('0x13'))(_0xb3cf('0x14'));var utils=require(_0xb3cf('0x15'));var config=require(_0xb3cf('0x16'));var db=require(_0xb3cf('0x17'))['db'];function respondWithStatusCode(_0x3b6401,_0x302234){_0x302234=_0x302234||0xcc;return function(_0x2b9317){if(_0x2b9317){return _0x3b6401[_0xb3cf('0x18')](_0x302234);}return _0x3b6401[_0xb3cf('0x19')](_0x302234)[_0xb3cf('0x1a')]();};}function respondWithResult(_0x530325,_0x495b2a){_0x495b2a=_0x495b2a||0xc8;return function(_0x430e03){if(_0x430e03){return _0x530325[_0xb3cf('0x19')](_0x495b2a)['json'](_0x430e03);}};}function respondWithFilteredResult(_0x21ce6c,_0x510bae){return function(_0x5c7a5c){if(_0x5c7a5c){var _0x174f92=_0x5c7a5c[_0xb3cf('0x1b')],_0x66ea06=_0x510bae[_0xb3cf('0x1c')],_0x2eff5c=_0x510bae[_0xb3cf('0x1c')]+_0x510bae[_0xb3cf('0x1d')],_0x56f703;if(_0x2eff5c>=_0x174f92){_0x2eff5c=_0x174f92;_0x56f703=0xc8;}else{_0x56f703=0xce;}_0x21ce6c[_0xb3cf('0x19')](_0x56f703);return _0x21ce6c[_0xb3cf('0x1e')](_0xb3cf('0x1f'),_0x66ea06+'-'+_0x2eff5c+'/'+_0x174f92)[_0xb3cf('0x20')](_0x5c7a5c);}return null;};}function patchUpdates(_0x1526c9){return function(_0x222c1d){try{jsonpatch['apply'](_0x222c1d,_0x1526c9,!![]);}catch(_0x35cab6){return BPromise[_0xb3cf('0x21')](_0x35cab6);}return _0x222c1d[_0xb3cf('0x22')]();};}function saveUpdates(_0x416910,_0x4801b7){return function(_0x25d2f0){if(_0x25d2f0){return _0x25d2f0[_0xb3cf('0x23')](_0x416910)[_0xb3cf('0x24')](function(_0x1dfbc3){return _0x1dfbc3;});}return null;};}function removeEntity(_0x283249,_0x2ee4a0){return function(_0x161cad){if(_0x161cad){return _0x161cad[_0xb3cf('0x25')]()[_0xb3cf('0x24')](function(){_0x283249[_0xb3cf('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x227360,_0x43f774){return function(_0x351196){if(!_0x351196){_0x227360[_0xb3cf('0x18')](0x194);}return _0x351196;};}function handleError(_0x1fb3ea,_0x402d3e){_0x402d3e=_0x402d3e||0x1f4;return function(_0x13b0b1){logger[_0xb3cf('0x26')](_0x13b0b1[_0xb3cf('0x27')]);if(_0x13b0b1[_0xb3cf('0x28')]){delete _0x13b0b1['name'];}_0x1fb3ea[_0xb3cf('0x19')](_0x402d3e)[_0xb3cf('0x29')](_0x13b0b1);};}exports[_0xb3cf('0x2a')]=function(_0x4fd689,_0x4cae37){var _0x15cf4d={'raw':!![],'where':{'id':_0x4fd689['params']['id']}},_0x173177={};_0x173177['model']=_[_0xb3cf('0x2b')](db[_0xb3cf('0x2c')]['rawAttributes']);_0x173177[_0xb3cf('0x2d')]=_[_0xb3cf('0x2b')](_0x4fd689[_0xb3cf('0x2d')]);_0x173177[_0xb3cf('0x2e')]=_[_0xb3cf('0x2f')](_0x173177[_0xb3cf('0x30')],_0x173177[_0xb3cf('0x2d')]);_0x15cf4d[_0xb3cf('0x31')]=_[_0xb3cf('0x2f')](_0x173177[_0xb3cf('0x30')],qs['fields'](_0x4fd689[_0xb3cf('0x2d')]['fields']));_0x15cf4d['attributes']=_0x15cf4d['attributes'][_0xb3cf('0x32')]?_0x15cf4d[_0xb3cf('0x31')]:_0x173177['model'];if(_0x4fd689[_0xb3cf('0x2d')][_0xb3cf('0x33')]){_0x15cf4d[_0xb3cf('0x34')]=[{'all':!![]}];}_0x15cf4d=_[_0xb3cf('0x35')]({},_0x15cf4d,_0x4fd689[_0xb3cf('0x36')]);return db[_0xb3cf('0x2c')]['find'](_0x15cf4d)[_0xb3cf('0x24')](handleEntityNotFound(_0x4cae37,null))['then'](respondWithResult(_0x4cae37,null))[_0xb3cf('0x37')](handleError(_0x4cae37,null));};exports[_0xb3cf('0x23')]=function(_0x3da85b,_0x35f8bc){if(_0x3da85b[_0xb3cf('0x38')]['id']){delete _0x3da85b[_0xb3cf('0x38')]['id'];}return db['MailApplication']['find']({'where':{'id':_0x3da85b[_0xb3cf('0x39')]['id']}})['then'](handleEntityNotFound(_0x35f8bc,null))['then'](saveUpdates(_0x3da85b[_0xb3cf('0x38')],null))['then'](respondWithResult(_0x35f8bc,null))[_0xb3cf('0x37')](handleError(_0x35f8bc,null));};exports[_0xb3cf('0x25')]=function(_0x1108c7,_0x1662ba){return db[_0xb3cf('0x2c')][_0xb3cf('0x3a')]({'where':{'id':_0x1108c7['params']['id']}})[_0xb3cf('0x24')](handleEntityNotFound(_0x1662ba,null))[_0xb3cf('0x24')](removeEntity(_0x1662ba,null))[_0xb3cf('0x37')](handleError(_0x1662ba,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index f1e23b6..1dbbcce 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 _0x05e6=['MailApplication','util','../../config/logger','api','moment','bluebird','exports','define'];(function(_0x23ec3b,_0x48e374){var _0x53cadb=function(_0x55b817){while(--_0x55b817){_0x23ec3b['push'](_0x23ec3b['shift']());}};_0x53cadb(++_0x48e374);}(_0x05e6,0x189));var _0x605e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x05e6[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require('lodash');var util=require(_0x605e('0x0'));var logger=require(_0x605e('0x1'))(_0x605e('0x2'));var moment=require(_0x605e('0x3'));var BPromise=require(_0x605e('0x4'));var rp=require('request-promise');var attributes=require('./mailApplication.attributes');module[_0x605e('0x5')]=function(_0x1784a5,_0xd24b65){return _0x1784a5[_0x605e('0x6')](_0x605e('0x7'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x092d=['exports','define','MailApplication','lodash','../../config/logger','api','bluebird','./mailApplication.attributes'];(function(_0x29bf0a,_0x18001a){var _0x144e64=function(_0x285998){while(--_0x285998){_0x29bf0a['push'](_0x29bf0a['shift']());}};_0x144e64(++_0x18001a);}(_0x092d,0x1f3));var _0xd092=function(_0x224ad0,_0x2482bd){_0x224ad0=_0x224ad0-0x0;var _0x2e04fc=_0x092d[_0x224ad0];return _0x2e04fc;};'use strict';var _=require(_0xd092('0x0'));var util=require('util');var logger=require(_0xd092('0x1'))(_0xd092('0x2'));var moment=require('moment');var BPromise=require(_0xd092('0x3'));var rp=require('request-promise');var attributes=require(_0xd092('0x4'));module[_0xd092('0x5')]=function(_0x53ab07,_0x36e279){return _0x53ab07[_0xd092('0x6')](_0xd092('0x7'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 2c4460d..10642e3 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 _0x7a54=['message','request\x20sent','result','catch','MailApplication','update','body','options','raw','where','attributes','limit','then','UpdateMailApplication','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailApplication,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x5b2905,_0x27db64){var _0xc4bfdb=function(_0x3b1c99){while(--_0x3b1c99){_0x5b2905['push'](_0x5b2905['shift']());}};_0xc4bfdb(++_0x27db64);}(_0x7a54,0x106));var _0x47a5=function(_0x9cb23,_0x59c092){_0x9cb23=_0x9cb23-0x0;var _0x16e421=_0x7a54[_0x9cb23];return _0x16e421;};'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')]('MailApplication,\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);});});}exports['UpdateMailApplication']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5247fd['options']?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x1a')]||null:null,'attributes':_0x5247fd['options']?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x1b')]||null:null,'limit':_0x5247fd[_0x47a5('0x18')]?_0x5247fd['options'][_0x47a5('0x1c')]||null:null})[_0x47a5('0x1d')](function(_0x23db32){logger[_0x47a5('0xb')]('UpdateMailApplication',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON['stringify'](_0x23db32));_0xaf70a6(_0x23db32);})[_0x47a5('0x14')](function(_0xc4cd63){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0xc4cd63[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xc4cd63['message']));});});}; \ No newline at end of file +var _0x9957=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','update','options','raw','attributes','limit','lodash','util','moment'];(function(_0x93942f,_0xb48547){var _0x23fcd8=function(_0x4728be){while(--_0x4728be){_0x93942f['push'](_0x93942f['shift']());}};_0x23fcd8(++_0xb48547);}(_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']('MailApplication,\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['MailApplication'][_0x7995('0x19')](_0x291317['body'],{'raw':_0x291317['options']?_0x291317[_0x7995('0x1a')][_0x7995('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x291317['options']?_0x291317[_0x7995('0x1a')]['where']||null:null,'attributes':_0x291317['options']?_0x291317[_0x7995('0x1a')][_0x7995('0x1c')]||null:null,'limit':_0x291317[_0x7995('0x1a')]?_0x291317[_0x7995('0x1a')][_0x7995('0x1d')]||null:null})[_0x7995('0xc')](function(_0x5d40ae){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x5d40ae));_0x37a7d4(_0x5d40ae);})[_0x7995('0x17')](function(_0x475351){logger[_0x7995('0x13')]('UpdateMailApplication',_0x475351[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x475351[_0x7995('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index c9093f8..f160403 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 _0x41fa=['mailinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','addMessage','tracked','addTags','mailinteraction:update','delete'];(function(_0x3bb7df,_0x1b5d3a){var _0xb10d46=function(_0x2ed02d){while(--_0x2ed02d){_0x3bb7df['push'](_0x3bb7df['shift']());}};_0xb10d46(++_0x1b5d3a);}(_0x41fa,0x1f1));var _0xa41f=function(_0xa087f5,_0x34fd10){_0xa087f5=_0xa087f5-0x0;var _0x4c8806=_0x41fa[_0xa087f5];return _0x4c8806;};'use strict';var multer=require(_0xa41f('0x0'));var util=require(_0xa41f('0x1'));var path=require(_0xa41f('0x2'));var timeout=require(_0xa41f('0x3'));var express=require(_0xa41f('0x4'));var router=express[_0xa41f('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xa41f('0x6'));var config=require(_0xa41f('0x7'));var controller=require(_0xa41f('0x8'));router[_0xa41f('0x9')]('/',auth[_0xa41f('0xa')](),controller[_0xa41f('0xb')]);router['get'](_0xa41f('0xc'),auth[_0xa41f('0xa')](),controller[_0xa41f('0xd')]);router['get'](_0xa41f('0xe'),auth[_0xa41f('0xa')](),controller[_0xa41f('0xf')]);router[_0xa41f('0x9')](_0xa41f('0x10'),auth[_0xa41f('0xa')](),controller[_0xa41f('0x11')]);router[_0xa41f('0x9')]('/:id/download',auth[_0xa41f('0xa')](),controller[_0xa41f('0x12')]);router[_0xa41f('0x13')]('/',auth[_0xa41f('0xa')](),controller['create']);router[_0xa41f('0x13')](_0xa41f('0x10'),auth[_0xa41f('0xa')](),controller[_0xa41f('0x14')]);router[_0xa41f('0x13')]('/:id/tags',auth[_0xa41f('0xa')](),interaction[_0xa41f('0x15')]('mail','mailinteraction:addtags'),controller[_0xa41f('0x16')]);router['put']('/:id',auth[_0xa41f('0xa')](),interaction[_0xa41f('0x15')]('mail',_0xa41f('0x17')),controller['update']);router[_0xa41f('0x18')](_0xa41f('0xe'),auth[_0xa41f('0xa')](),interaction[_0xa41f('0x15')]('mail',_0xa41f('0x19')),controller[_0xa41f('0x1a')]);router[_0xa41f('0x18')]('/:id/tags',auth['isAuthenticated'](),controller[_0xa41f('0x1b')]);module[_0xa41f('0x1c')]=router; \ No newline at end of file +var _0x342f=['isAuthenticated','describe','/:id','/:id/messages','getMessages','post','create','addMessage','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','/:id/tags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get'];(function(_0x5ceb4c,_0x1e4f11){var _0x1a4482=function(_0x3d7f84){while(--_0x3d7f84){_0x5ceb4c['push'](_0x5ceb4c['shift']());}};_0x1a4482(++_0x1e4f11);}(_0x342f,0x1d4));var _0xf342=function(_0xb90f8f,_0x27a214){_0xb90f8f=_0xb90f8f-0x0;var _0x18fc10=_0x342f[_0xb90f8f];return _0x18fc10;};'use strict';var multer=require(_0xf342('0x0'));var util=require(_0xf342('0x1'));var path=require(_0xf342('0x2'));var timeout=require(_0xf342('0x3'));var express=require(_0xf342('0x4'));var router=express['Router']();var auth=require(_0xf342('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf342('0x6'));var controller=require('./mailInteraction.controller');router[_0xf342('0x7')]('/',auth[_0xf342('0x8')](),controller['index']);router[_0xf342('0x7')]('/describe',auth[_0xf342('0x8')](),controller[_0xf342('0x9')]);router[_0xf342('0x7')](_0xf342('0xa'),auth[_0xf342('0x8')](),controller['show']);router['get'](_0xf342('0xb'),auth[_0xf342('0x8')](),controller[_0xf342('0xc')]);router[_0xf342('0x7')]('/:id/download',auth[_0xf342('0x8')](),controller['download']);router[_0xf342('0xd')]('/',auth[_0xf342('0x8')](),controller[_0xf342('0xe')]);router[_0xf342('0xd')]('/:id/messages',auth['isAuthenticated'](),controller[_0xf342('0xf')]);router[_0xf342('0xd')]('/:id/tags',auth[_0xf342('0x8')](),interaction[_0xf342('0x10')](_0xf342('0x11'),_0xf342('0x12')),controller[_0xf342('0x13')]);router[_0xf342('0x14')]('/:id',auth[_0xf342('0x8')](),interaction['tracked']('mail',_0xf342('0x15')),controller[_0xf342('0x16')]);router[_0xf342('0x17')](_0xf342('0xa'),auth[_0xf342('0x8')](),interaction[_0xf342('0x10')]('mail',_0xf342('0x18')),controller[_0xf342('0x19')]);router['delete'](_0xf342('0x1a'),auth['isAuthenticated'](),controller['removeTags']);module[_0xf342('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 706522b..c76dcee 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 _0x450e=['getDataValue','fromString','lastMsgBody','split','slice','join','html-to-text','exports','BOOLEAN','DATE','STRING','long','TEXT','ENUM','out','\x20CHARSET\x20utf8mb4\x20COLLATE\x20utf8mb4_unicode_ci'];(function(_0x119b3e,_0x588d50){var _0x1169ae=function(_0x377422){while(--_0x377422){_0x119b3e['push'](_0x119b3e['shift']());}};_0x1169ae(++_0x588d50);}(_0x450e,0x176));var _0xe450=function(_0x2e82f6,_0x521f30){_0x2e82f6=_0x2e82f6-0x0;var _0x21aed6=_0x450e[_0x2e82f6];return _0x21aed6;};'use strict';var Sequelize=require('sequelize');var htmlToText=require(_0xe450('0x0'));var iconv=require('iconv');module[_0xe450('0x1')]={'closed':{'type':Sequelize[_0xe450('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe450('0x3')]},'disposition':{'type':Sequelize[_0xe450('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xe450('0x4')](0xbe)},'to':{'type':Sequelize[_0xe450('0x4')]},'cc':{'type':Sequelize['TEXT'](_0xe450('0x5'))},'subject':{'type':Sequelize[_0xe450('0x6')]('')+'\x20CHARSET\x20utf8mb4\x20COLLATE\x20utf8mb4_unicode_ci'},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0xe450('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xe450('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xe450('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe450('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xe450('0x7')]('in',_0xe450('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xe450('0x6')]('long')+_0xe450('0x9'),'get':function(){try{return this[_0xe450('0xa')]('lastMsgBody')?htmlToText[_0xe450('0xb')](this[_0xe450('0xa')](_0xe450('0xc')),{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'ignoreImage':!![]})[_0xe450('0xd')]('\x0a')[_0xe450('0xe')](0x0,0x6)[_0xe450('0xf')]('\x0a'):null;}catch(_0x237305){return null;}}}}; \ No newline at end of file +var _0xc128=['getDataValue','lastMsgBody','fromString','split','join','sequelize','iconv','STRING','TEXT','long','BOOLEAN','DATE','ENUM','out','\x20CHARSET\x20utf8mb4\x20COLLATE\x20utf8mb4_unicode_ci'];(function(_0x54baf8,_0x4b7d5c){var _0x36d820=function(_0xfe83e8){while(--_0xfe83e8){_0x54baf8['push'](_0x54baf8['shift']());}};_0x36d820(++_0x4b7d5c);}(_0xc128,0xc8));var _0x8c12=function(_0x4d0533,_0x5c06e2){_0x4d0533=_0x4d0533-0x0;var _0x3cdf58=_0xc128[_0x4d0533];return _0x3cdf58;};'use strict';var Sequelize=require(_0x8c12('0x0'));var htmlToText=require('html-to-text');var iconv=require(_0x8c12('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x8c12('0x2')]},'inReplyTo':{'type':Sequelize[_0x8c12('0x2')](0xbe)},'to':{'type':Sequelize[_0x8c12('0x2')]},'cc':{'type':Sequelize[_0x8c12('0x3')](_0x8c12('0x4'))},'subject':{'type':Sequelize[_0x8c12('0x3')]('')+'\x20CHARSET\x20utf8mb4\x20COLLATE\x20utf8mb4_unicode_ci'},'attach':{'type':Sequelize[_0x8c12('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x8c12('0x6')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x8c12('0x6')]},'firstMsgDirection':{'type':Sequelize[_0x8c12('0x7')]('in',_0x8c12('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8c12('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x8c12('0x7')]('in',_0x8c12('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x8c12('0x3')](_0x8c12('0x4'))+_0x8c12('0x9'),'get':function(){try{return this[_0x8c12('0xa')](_0x8c12('0xb'))?htmlToText[_0x8c12('0xc')](this[_0x8c12('0xa')]('lastMsgBody'),{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'ignoreImage':!![]})[_0x8c12('0xd')]('\x0a')['slice'](0x0,0x6)[_0x8c12('0xe')]('\x0a'):null;}catch(_0x1e8f16){return null;}}}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index c576b8f..c0e84d9 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 _0x533a=['api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','MailInteraction','rawAttributes','model','keys','dateStart','query','dateEnd','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filters','pick','add','day','merge','filter','map','options','include','push','Tag','tag','distinct','read','MailMessage','Messages','createdAt','includeAll','CmContact','User','Owner','fullname','MailAccount','Account','key','email','Tags','color','ThroughTags','catch','show','params','find','create','body','describe','omit','ids','getMessages','findOne','MailInteractionId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','setTags','emit','mailInteractionTags:save','removeTags','download','toString','join','root','server','files','tmp','interaction-%s.zip','from','subject','attachments','Attachment','each','Attachments','basename','existsSync','build','writeFileSync','message%d.eml','log','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../config/logger'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x533a,0x72));var _0xa533=function(_0x236e4b,_0x136c92){_0x236e4b=_0x236e4b-0x0;var _0x5cce4e=_0x533a[_0x236e4b];return _0x5cce4e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xa533('0x0'));var zipdir=require(_0xa533('0x1'));var jsonpatch=require(_0xa533('0x2'));var rp=require(_0xa533('0x3'));var moment=require(_0xa533('0x4'));var BPromise=require(_0xa533('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa533('0x6'));var sox=require(_0xa533('0x7'));var csv=require(_0xa533('0x8'));var ejs=require(_0xa533('0x9'));var fs=require('fs');var _=require(_0xa533('0xa'));var squel=require('squel');var crypto=require(_0xa533('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa533('0xc'));var toCsv=require(_0xa533('0x8'));var querystring=require(_0xa533('0xd'));var Papa=require(_0xa533('0xe'));var Redis=require(_0xa533('0xf'));var qs=require('../../components/parsers/qs');var logger=require(_0xa533('0x10'))(_0xa533('0x11'));var utils=require(_0xa533('0x12'));var config=require(_0xa533('0x13'));var db=require(_0xa533('0x14'))['db'];config['redis']=_['defaults'](config[_0xa533('0x15')],{'host':_0xa533('0x16'),'port':0x18eb});var socket=require(_0xa533('0x17'))(new Redis(config[_0xa533('0x15')]));require(_0xa533('0x18'))[_0xa533('0x19')](socket);function respondWithStatusCode(_0x193153,_0x52c38c){_0x52c38c=_0x52c38c||0xcc;return function(_0x455784){if(_0x455784){return _0x193153[_0xa533('0x1a')](_0x52c38c);}return _0x193153[_0xa533('0x1b')](_0x52c38c)[_0xa533('0x1c')]();};}function respondWithResult(_0x28df7e,_0x389752){_0x389752=_0x389752||0xc8;return function(_0x42ce2b){if(_0x42ce2b){return _0x28df7e['status'](_0x389752)[_0xa533('0x1d')](_0x42ce2b);}};}function respondWithFilteredResult(_0x3999e9,_0x5a73eb){return function(_0x77032f){if(_0x77032f){var _0x352a88=_0x77032f[_0xa533('0x1e')],_0x5592dc=_0x5a73eb[_0xa533('0x1f')],_0x47cc2b=_0x5a73eb['offset']+_0x5a73eb['limit'],_0x53ca10;if(_0x47cc2b>=_0x352a88){_0x47cc2b=_0x352a88;_0x53ca10=0xc8;}else{_0x53ca10=0xce;}_0x3999e9[_0xa533('0x1b')](_0x53ca10);return _0x3999e9[_0xa533('0x20')](_0xa533('0x21'),_0x5592dc+'-'+_0x47cc2b+'/'+_0x352a88)[_0xa533('0x1d')](_0x77032f);}return null;};}function patchUpdates(_0xafddb3){return function(_0x54e2d1){try{jsonpatch['apply'](_0x54e2d1,_0xafddb3,!![]);}catch(_0x2c6690){return BPromise[_0xa533('0x22')](_0x2c6690);}return _0x54e2d1[_0xa533('0x23')]();};}function saveUpdates(_0x45335b,_0x165497){return function(_0x56bb17){if(_0x56bb17){return _0x56bb17['update'](_0x45335b)[_0xa533('0x24')](function(_0x45ce26){return _0x45ce26;});}return null;};}function removeEntity(_0x412d18,_0x10f1d2){return function(_0x362f7c){if(_0x362f7c){return _0x362f7c[_0xa533('0x25')]()[_0xa533('0x24')](function(){_0x412d18[_0xa533('0x1b')](0xcc)[_0xa533('0x1c')]();});}};}function handleEntityNotFound(_0x43787f,_0x52edf9){return function(_0x1cc467){if(!_0x1cc467){_0x43787f[_0xa533('0x1a')](0x194);}return _0x1cc467;};}function handleError(_0x1319e5,_0x5ef502){_0x5ef502=_0x5ef502||0x1f4;return function(_0xe3e591){logger[_0xa533('0x26')](_0xe3e591[_0xa533('0x27')]);if(_0xe3e591['name']){delete _0xe3e591[_0xa533('0x28')];}_0x1319e5[_0xa533('0x1b')](_0x5ef502)[_0xa533('0x29')](_0xe3e591);};}exports[_0xa533('0x2a')]=function(_0x4331f6,_0x38ff62){var _0x50c094={},_0x1cec8c={},_0x2523c5={'count':0x0,'rows':[]};var _0x4d97e0=db[_0xa533('0x2b')][_0xa533('0x2c')];_0x1cec8c[_0xa533('0x2d')]=_[_0xa533('0x2e')](_0x4d97e0);var _0x36d9cf={'dateStart':_0x4331f6['query'][_0xa533('0x2f')],'dateEnd':_0x4331f6[_0xa533('0x30')]['dateEnd']};delete _0x4331f6[_0xa533('0x30')][_0xa533('0x2f')];delete _0x4331f6[_0xa533('0x30')][_0xa533('0x31')];_0x1cec8c[_0xa533('0x30')]=_[_0xa533('0x2e')](_0x4331f6[_0xa533('0x30')]);_0x1cec8c['filters']=_[_0xa533('0x32')](_0x1cec8c['model'],_0x1cec8c['query']);_0x50c094['attributes']=_[_0xa533('0x32')](_0x1cec8c[_0xa533('0x2d')],qs[_0xa533('0x33')](_0x4331f6[_0xa533('0x30')][_0xa533('0x33')]));_0x50c094['attributes']=_0x50c094[_0xa533('0x34')][_0xa533('0x35')]?_0x50c094['attributes']:_0x1cec8c['model'];if(!_0x4331f6['query']['hasOwnProperty'](_0xa533('0x36'))){_0x50c094['limit']=qs['limit'](_0x4331f6[_0xa533('0x30')][_0xa533('0x37')]);_0x50c094['offset']=qs[_0xa533('0x1f')](_0x4331f6[_0xa533('0x30')]['offset']);}_0x50c094[_0xa533('0x38')]=qs[_0xa533('0x39')](_0x4331f6[_0xa533('0x30')][_0xa533('0x39')]);_0x50c094[_0xa533('0x3a')]=qs[_0xa533('0x3b')](_[_0xa533('0x3c')](_0x4331f6[_0xa533('0x30')],_0x1cec8c[_0xa533('0x3b')]));if(_0x36d9cf[_0xa533('0x2f')]){if(_0x36d9cf[_0xa533('0x31')]){_0x36d9cf['dateEnd']=moment(_0x36d9cf[_0xa533('0x31')])[_0xa533('0x3d')](0x1,_0xa533('0x3e'));}else{_0x36d9cf[_0xa533('0x31')]=moment(_0x36d9cf['dateStart'])['add'](0x1,_0xa533('0x3e'));}_[_0xa533('0x3f')](_0x50c094[_0xa533('0x3a')],{'createdAt':{'$gte':_0x36d9cf[_0xa533('0x2f')],'$lte':_0x36d9cf[_0xa533('0x31')]}});}if(_0x4331f6[_0xa533('0x30')][_0xa533('0x40')]){_0x50c094[_0xa533('0x3a')]=_[_0xa533('0x3f')](_0x50c094[_0xa533('0x3a')],{'$or':_[_0xa533('0x41')](_0x50c094['attributes'],function(_0x51b1b8){var _0x43b15d={};_0x43b15d[_0x51b1b8]={'$like':'%'+_0x4331f6[_0xa533('0x30')]['filter']+'%'};return _0x43b15d;})});}_0x50c094=_[_0xa533('0x3f')]({},_0x50c094,_0x4331f6[_0xa533('0x42')]);var _0x5e257d={'where':_0x50c094[_0xa533('0x3a')]};_0x5e257d[_0xa533('0x43')]=[];if(_0x4331f6[_0xa533('0x30')]['tag']){_0x5e257d[_0xa533('0x43')][_0xa533('0x44')]({'model':db[_0xa533('0x45')],'as':'Tags','attributes':['id'],'where':{'id':_0x4331f6[_0xa533('0x30')][_0xa533('0x46')]},'required':!![]});_0x5e257d[_0xa533('0x47')]=!![];}if(_0x4331f6[_0xa533('0x30')][_0xa533('0x48')]){_0x5e257d['include']['push']({'model':db[_0xa533('0x49')],'as':_0xa533('0x4a'),'attributes':['id','direction',_0xa533('0x4b'),_0xa533('0x48')],'where':{'direction':'in','read':_0x4331f6[_0xa533('0x30')]['read']||![]},'required':!![]});_0x5e257d[_0xa533('0x47')]=!![];}return db[_0xa533('0x2b')][_0xa533('0x1e')](_0x5e257d)[_0xa533('0x24')](function(_0x4ec202){_0x2523c5[_0xa533('0x1e')]=_0x4ec202;if(_0x4331f6[_0xa533('0x30')][_0xa533('0x4c')]){_0x50c094[_0xa533('0x43')]=[{'model':db['User'],'as':'Users','required':![],'attributes':['id',_0xa533('0x28'),'fullname']},{'model':db[_0xa533('0x4d')],'as':'Contact','required':![]},{'model':db[_0xa533('0x4e')],'as':_0xa533('0x4f'),'attributes':[_0xa533('0x28'),_0xa533('0x50'),'internal'],'required':![]},{'model':db[_0xa533('0x51')],'as':_0xa533('0x52'),'attributes':[_0xa533('0x28'),_0xa533('0x53'),_0xa533('0x54')],'required':![]},{'model':db[_0xa533('0x49')],'as':_0xa533('0x4a'),'attributes':['id','direction',_0xa533('0x4b'),_0xa533('0x48')],'where':{'direction':'in','read':_0x4331f6[_0xa533('0x30')]['read']||![]},'required':_0x4331f6[_0xa533('0x30')][_0xa533('0x48')]||![]},{'model':db['Tag'],'as':_0xa533('0x55'),'attributes':['id',_0xa533('0x28'),_0xa533('0x56')],'required':_0x4331f6[_0xa533('0x30')][_0xa533('0x46')]?!![]:![]},{'model':db[_0xa533('0x45')],'as':_0xa533('0x57'),'attributes':['id','name','color'],'through':_0x4331f6['query'][_0xa533('0x46')]?{'attributes':[],'where':{'TagId':_0x4331f6[_0xa533('0x30')]['tag']||undefined}}:{},'required':_0x4331f6[_0xa533('0x30')][_0xa533('0x46')]?!![]:![]}];}return db[_0xa533('0x2b')]['findAll'](_0x50c094);})[_0xa533('0x24')](function(_0x4a39f1){_0x2523c5['rows']=_0x4a39f1;return _0x2523c5;})[_0xa533('0x24')](respondWithFilteredResult(_0x38ff62,_0x50c094))[_0xa533('0x58')](handleError(_0x38ff62,null));};exports[_0xa533('0x59')]=function(_0x5c1304,_0x4d6b9c){var _0x2478e3={'raw':![],'where':{'id':_0x5c1304[_0xa533('0x5a')]['id']}},_0x3f42eb={};_0x3f42eb[_0xa533('0x2d')]=_['keys'](db[_0xa533('0x2b')][_0xa533('0x2c')]);_0x3f42eb[_0xa533('0x30')]=_[_0xa533('0x2e')](_0x5c1304[_0xa533('0x30')]);_0x3f42eb[_0xa533('0x3b')]=_[_0xa533('0x32')](_0x3f42eb[_0xa533('0x2d')],_0x3f42eb[_0xa533('0x30')]);_0x2478e3[_0xa533('0x34')]=_[_0xa533('0x32')](_0x3f42eb[_0xa533('0x2d')],qs['fields'](_0x5c1304[_0xa533('0x30')][_0xa533('0x33')]));_0x2478e3['attributes']=_0x2478e3[_0xa533('0x34')][_0xa533('0x35')]?_0x2478e3[_0xa533('0x34')]:_0x3f42eb['model'];if(_0x5c1304[_0xa533('0x30')][_0xa533('0x4c')]){_0x2478e3[_0xa533('0x43')]=[{'all':!![]}];}_0x2478e3=_[_0xa533('0x3f')]({},_0x2478e3,_0x5c1304['options']);return db[_0xa533('0x2b')][_0xa533('0x5b')](_0x2478e3)[_0xa533('0x24')](handleEntityNotFound(_0x4d6b9c,null))[_0xa533('0x24')](respondWithResult(_0x4d6b9c,null))['catch'](handleError(_0x4d6b9c,null));};exports[_0xa533('0x5c')]=function(_0xf3d75c,_0x42e5a5){return db['MailInteraction'][_0xa533('0x5c')](_0xf3d75c[_0xa533('0x5d')],{})[_0xa533('0x24')](respondWithResult(_0x42e5a5,0xc9))[_0xa533('0x58')](handleError(_0x42e5a5,null));};exports['update']=function(_0x464e15,_0x429c1f){if(_0x464e15[_0xa533('0x5d')]['id']){delete _0x464e15[_0xa533('0x5d')]['id'];}return db[_0xa533('0x2b')]['find']({'where':{'id':_0x464e15[_0xa533('0x5a')]['id']}})['then'](handleEntityNotFound(_0x429c1f,null))[_0xa533('0x24')](saveUpdates(_0x464e15[_0xa533('0x5d')],null))[_0xa533('0x24')](respondWithResult(_0x429c1f,null))[_0xa533('0x58')](handleError(_0x429c1f,null));};exports[_0xa533('0x25')]=function(_0x276150,_0x5004aa){return db[_0xa533('0x2b')][_0xa533('0x5b')]({'where':{'id':_0x276150['params']['id']}})[_0xa533('0x24')](handleEntityNotFound(_0x5004aa,null))[_0xa533('0x24')](removeEntity(_0x5004aa,null))[_0xa533('0x58')](handleError(_0x5004aa,null));};exports[_0xa533('0x5e')]=function(_0x1fdcc3,_0x57bad9){return db[_0xa533('0x2b')][_0xa533('0x5e')]()[_0xa533('0x24')](respondWithResult(_0x57bad9,null))['catch'](handleError(_0x57bad9,null));};exports['addMessage']=function(_0x336957,_0x4a00b8,_0x12a3cd){return db[_0xa533('0x49')][_0xa533('0x5b')]({'where':{'id':_0x336957['params']['id']}})[_0xa533('0x24')](handleEntityNotFound(_0x4a00b8,null))[_0xa533('0x24')](function(_0x36c900){if(_0x36c900){return _0x36c900['addMessage'](_0x336957[_0xa533('0x5d')]['ids'],_[_0xa533('0x5f')](_0x336957['body'],[_0xa533('0x60'),'id'])||{});}})[_0xa533('0x24')](respondWithResult(_0x4a00b8,null))[_0xa533('0x58')](handleError(_0x4a00b8,null));};exports[_0xa533('0x61')]=function(_0x51aad5,_0x1f0d8a,_0x1386d4){var _0x114645={'raw':![],'where':{}};var _0x52d20e={};var _0xaa4b16={'count':0x0,'rows':[]};return db[_0xa533('0x2b')][_0xa533('0x62')]({'where':{'id':_0x51aad5[_0xa533('0x5a')]['id']}})[_0xa533('0x24')](handleEntityNotFound(_0x1f0d8a,null))[_0xa533('0x24')](function(_0x1c832f){if(_0x1c832f){_0x52d20e[_0xa533('0x2d')]=_['keys'](db[_0xa533('0x49')][_0xa533('0x2c')]);_0x52d20e['query']=_[_0xa533('0x2e')](_0x51aad5[_0xa533('0x30')]);_0x52d20e[_0xa533('0x3b')]=_[_0xa533('0x32')](_0x52d20e[_0xa533('0x2d')],_0x52d20e[_0xa533('0x30')]);_0x114645[_0xa533('0x34')]=_[_0xa533('0x32')](_0x52d20e[_0xa533('0x2d')],qs[_0xa533('0x33')](_0x51aad5[_0xa533('0x30')][_0xa533('0x33')]));_0x114645[_0xa533('0x34')]=_0x114645['attributes'][_0xa533('0x35')]?_0x114645['attributes']:_0x52d20e[_0xa533('0x2d')];if(!_0x51aad5['query']['hasOwnProperty'](_0xa533('0x36'))){_0x114645[_0xa533('0x37')]=qs[_0xa533('0x37')](_0x51aad5[_0xa533('0x30')][_0xa533('0x37')]);_0x114645['offset']=qs['offset'](_0x51aad5[_0xa533('0x30')][_0xa533('0x1f')]);}_0x114645[_0xa533('0x38')]=qs[_0xa533('0x39')](_0x51aad5[_0xa533('0x30')][_0xa533('0x39')]);_0x114645['where']=qs[_0xa533('0x3b')](_[_0xa533('0x3c')](_0x51aad5['query'],_0x52d20e[_0xa533('0x3b')]));_0x114645[_0xa533('0x3a')][_0xa533('0x63')]=_0x1c832f['id'];if(_0x51aad5[_0xa533('0x30')][_0xa533('0x40')]){_0x114645[_0xa533('0x3a')]=_[_0xa533('0x3f')](_0x114645[_0xa533('0x3a')],{'$or':_['map'](_0x114645['attributes'],function(_0x56ae9d){var _0x25c04b={};_0x25c04b[_0x56ae9d]={'$like':'%'+_0x51aad5['query'][_0xa533('0x40')]+'%'};return _0x25c04b;})});}if(_0x51aad5[_0xa533('0x30')][_0xa533('0x64')]){var _0x145515=_0x51aad5[_0xa533('0x30')][_0xa533('0x64')][_0xa533('0x65')](',');var _0xbc476c={};_0xbc476c[_0x145515[0x0]]={'$gte':moment(_0x145515[0x1])[_0xa533('0x66')](_0xa533('0x67'))};_0x114645['where']=_[_0xa533('0x3f')](_0x114645[_0xa533('0x3a')],_0xbc476c);}_0x114645=_[_0xa533('0x3f')]({},_0x114645,_0x51aad5['options']);return db['MailMessage'][_0xa533('0x1e')]({'where':_0x114645['where']})[_0xa533('0x24')](function(_0x51d8c2){_0xaa4b16[_0xa533('0x1e')]=_0x51d8c2;if(_0x51aad5[_0xa533('0x30')][_0xa533('0x4c')]){_0x114645[_0xa533('0x43')]=[{'all':!![]}];}return db[_0xa533('0x49')][_0xa533('0x68')](_0x114645);})[_0xa533('0x24')](function(_0x2d34a5){_0xaa4b16[_0xa533('0x69')]=_0x2d34a5;return _0xaa4b16;});}})[_0xa533('0x24')](respondWithFilteredResult(_0x1f0d8a,_0x114645))[_0xa533('0x58')](handleError(_0x1f0d8a,null));};exports['addTags']=function(_0x2b4061,_0x2981a2,_0x2d4fa3){return db[_0xa533('0x2b')][_0xa533('0x5b')]({'where':{'id':_0x2b4061['params']['id']}})[_0xa533('0x24')](handleEntityNotFound(_0x2981a2,null))[_0xa533('0x24')](function(_0x30510b){if(_0x30510b){return _0x30510b[_0xa533('0x6a')](_0x2b4061[_0xa533('0x5d')][_0xa533('0x60')],_[_0xa533('0x5f')](_0x2b4061[_0xa533('0x5d')],[_0xa533('0x60'),'id'])||{})['spread'](function(){return db[_0xa533('0x45')][_0xa533('0x68')]({'attributes':['id',_0xa533('0x28'),_0xa533('0x56')],'where':{'id':_0x2b4061[_0xa533('0x5d')][_0xa533('0x60')]}});})[_0xa533('0x24')](function(_0x209eb9){socket[_0xa533('0x6b')](_0xa533('0x6c'),{'id':Number(_0x2b4061[_0xa533('0x5a')]['id']),'tags':_0x209eb9||[]});return{'id':Number(_0x2b4061[_0xa533('0x5a')]['id']),'tags':_0x209eb9||[]};});}})[_0xa533('0x24')](respondWithResult(_0x2981a2,null))[_0xa533('0x58')](handleError(_0x2981a2,null));};exports[_0xa533('0x6d')]=function(_0x481845,_0x3dacbf,_0x86e84b){var _0x54d567;return db[_0xa533('0x2b')][_0xa533('0x5b')]({'where':{'id':_0x481845[_0xa533('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3dacbf,null))[_0xa533('0x24')](function(_0x2d6c63){if(_0x2d6c63){return _0x2d6c63['removeTags'](_0x481845[_0xa533('0x30')][_0xa533('0x60')]);}})['then'](respondWithStatusCode(_0x3dacbf,null))['catch'](handleError(_0x3dacbf,null));};exports[_0xa533('0x6e')]=function(_0x38c87b,_0x3b0fe5){var _0x5a132d=moment()['unix']()[_0xa533('0x6f')]();var _0x53cbd9=path[_0xa533('0x70')](config[_0xa533('0x71')],_0xa533('0x72'),_0xa533('0x73'),'attachments');var _0x37ef8c=path[_0xa533('0x70')](config[_0xa533('0x71')],_0xa533('0x72'),'files',_0xa533('0x74'));var _0x3ee6f8=path['join'](_0x37ef8c,_0x5a132d);var _0xd31972=util[_0xa533('0x66')](_0xa533('0x75'),_0x5a132d);var _0x28aab4=path[_0xa533('0x70')](_0x37ef8c,_0xd31972);var _0x5acce3=![];return db[_0xa533('0x2b')]['find']({'where':{'id':_0x38c87b[_0xa533('0x5a')]['id']}})[_0xa533('0x24')](handleEntityNotFound(_0x3b0fe5,null))[_0xa533('0x24')](function(_0x4dd341){if(_0x4dd341){return _0x4dd341['getMessages']({'attributes':['id',_0xa533('0x5d'),_0xa533('0x76'),'to','cc',_0xa533('0x77'),_0xa533('0x4b')],'where':{'secret':![]},'include':_0x38c87b['query'][_0xa533('0x78')]?[{'model':db[_0xa533('0x79')],'as':'Attachments'}]:undefined,'order':qs[_0xa533('0x39')]('id')});}return[];})[_0xa533('0x24')](function(_0x4a882d){_0x5acce3=_0x4a882d['length'];if(_0x4a882d[_0xa533('0x35')]){fs['mkdirSync'](_0x3ee6f8);return BPromise[_0xa533('0x7a')](_0x4a882d,function(_0x5c5976,_0x39d4ef){var _0x4a7388=_0x5c5976;var _0x4aa4c6={'from':_0x4a7388[_0xa533('0x76')],'to':_0x4a7388['to'],'subject':_0x4a7388[_0xa533('0x77')],'html':_0x4a7388['body'],'attachments':[]};return new BPromise(function(_0x574fc5,_0x28823b){if(_0x5c5976[_0xa533('0x7b')]){for(var _0x5a29d1=0x0;_0x5a29d1<_0x5c5976[_0xa533('0x7b')]['length'];_0x5a29d1++){var _0x36019c=_0x5c5976[_0xa533('0x7b')][_0x5a29d1];var _0x296988=path[_0xa533('0x70')](_0x53cbd9,_0x36019c[_0xa533('0x7c')]);if(fs[_0xa533('0x7d')](_0x296988)){_0x4aa4c6[_0xa533('0x78')]['push']({'name':_0x36019c[_0xa533('0x28')],'contentType':_0x36019c['type'],'data':fs['readFileSync'](_0x296988)});}}}emlformat[_0xa533('0x7e')](_0x4aa4c6,function(_0xdbec9e,_0x1bc771){if(_0xdbec9e)return _0x28823b(_0xdbec9e);fs[_0xa533('0x7f')](path[_0xa533('0x70')](_0x3ee6f8,util['format'](_0xa533('0x80'),_0x39d4ef)),_0x1bc771);return _0x574fc5(_0x1bc771);});});});}})[_0xa533('0x24')](function(){if(_0x5acce3){return new BPromise(function(_0x28241e,_0x51e545){zipdir(_0x3ee6f8,{'saveTo':_0x28aab4},function(_0x3f3564,_0xd2949c){if(_0x3f3564)return _0x51e545(_0x3f3564);return _0x28241e(_0xd2949c);});});}})['then'](function(){if(_0x5acce3){return new BPromise(function(_0x2bc203,_0x595dcc){rimraf(_0x3ee6f8,function(_0x5eec4){if(_0x5eec4)_0x595dcc(_0x5eec4);return _0x2bc203();});});}})[_0xa533('0x24')](function(){if(_0x5acce3){return _0x3b0fe5['download'](_0x28aab4,_0xd31972,function(_0x2bc8c9){if(_0x2bc8c9){console[_0xa533('0x81')]('err',_0x2bc8c9);}else{fs[_0xa533('0x82')](_0x28aab4);}});}else{return _0x3b0fe5['sendStatus'](0xc8);}})[_0xa533('0x58')](handleError(_0x3b0fe5,null));}; \ No newline at end of file +var _0x49a7=['each','basename','type','readFileSync','build','writeFileSync','message%d.eml','log','err','unlinkSync','html-pdf','eml-format','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','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','json','count','offset','Content-Range','apply','update','destroy','end','error','stack','name','send','index','MailInteraction','model','keys','query','dateStart','dateEnd','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','add','day','merge','filter','where','map','options','push','Tags','tag','distinct','MailMessage','Messages','direction','createdAt','read','then','include','Users','fullname','CmContact','Contact','Owner','internal','key','Tag','color','ThroughTags','findAll','rows','catch','includeAll','find','create','body','params','describe','addMessage','ids','omit','getMessages','findOne','MailInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','setTags','spread','emit','removeTags','download','unix','toString','files','attachments','join','root','server','tmp','interaction-%s.zip','from','subject','Attachment','Attachments','mkdirSync'];(function(_0x1fcb67,_0x70fb6c){var _0x17a001=function(_0x43ae93){while(--_0x43ae93){_0x1fcb67['push'](_0x1fcb67['shift']());}};_0x17a001(++_0x70fb6c);}(_0x49a7,0x91));var _0x749a=function(_0x1455b1,_0x27f765){_0x1455b1=_0x1455b1-0x0;var _0x1db24f=_0x49a7[_0x1455b1];return _0x1db24f;};'use strict';var pdf=require(_0x749a('0x0'));var emlformat=require(_0x749a('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x749a('0x2'));var rp=require(_0x749a('0x3'));var moment=require(_0x749a('0x4'));var BPromise=require(_0x749a('0x5'));var Mustache=require(_0x749a('0x6'));var util=require(_0x749a('0x7'));var path=require(_0x749a('0x8'));var sox=require(_0x749a('0x9'));var csv=require(_0x749a('0xa'));var ejs=require(_0x749a('0xb'));var fs=require('fs');var _=require(_0x749a('0xc'));var squel=require(_0x749a('0xd'));var crypto=require(_0x749a('0xe'));var jsforce=require(_0x749a('0xf'));var deskjs=require(_0x749a('0x10'));var toCsv=require(_0x749a('0xa'));var querystring=require(_0x749a('0x11'));var Papa=require('papaparse');var Redis=require(_0x749a('0x12'));var qs=require(_0x749a('0x13'));var logger=require(_0x749a('0x14'))(_0x749a('0x15'));var utils=require('../../config/utils');var config=require(_0x749a('0x16'));var db=require('../../mysqldb')['db'];config[_0x749a('0x17')]=_[_0x749a('0x18')](config[_0x749a('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x749a('0x19'))(new Redis(config[_0x749a('0x17')]));require(_0x749a('0x1a'))[_0x749a('0x1b')](socket);function respondWithStatusCode(_0x4fdac6,_0x391384){_0x391384=_0x391384||0xcc;return function(_0x3030f2){if(_0x3030f2){return _0x4fdac6[_0x749a('0x1c')](_0x391384);}return _0x4fdac6[_0x749a('0x1d')](_0x391384)['end']();};}function respondWithResult(_0x12ab91,_0x87bba6){_0x87bba6=_0x87bba6||0xc8;return function(_0x5942ce){if(_0x5942ce){return _0x12ab91[_0x749a('0x1d')](_0x87bba6)[_0x749a('0x1e')](_0x5942ce);}};}function respondWithFilteredResult(_0xdfc8a7,_0x80d26e){return function(_0x26197a){if(_0x26197a){var _0x2ac07a=_0x26197a[_0x749a('0x1f')],_0x1240ca=_0x80d26e[_0x749a('0x20')],_0x5dcf26=_0x80d26e['offset']+_0x80d26e['limit'],_0x4b20d8;if(_0x5dcf26>=_0x2ac07a){_0x5dcf26=_0x2ac07a;_0x4b20d8=0xc8;}else{_0x4b20d8=0xce;}_0xdfc8a7[_0x749a('0x1d')](_0x4b20d8);return _0xdfc8a7['set'](_0x749a('0x21'),_0x1240ca+'-'+_0x5dcf26+'/'+_0x2ac07a)[_0x749a('0x1e')](_0x26197a);}return null;};}function patchUpdates(_0x5e38b1){return function(_0x4fc93f){try{jsonpatch[_0x749a('0x22')](_0x4fc93f,_0x5e38b1,!![]);}catch(_0x79206f){return BPromise['reject'](_0x79206f);}return _0x4fc93f['save']();};}function saveUpdates(_0x2ad697,_0x59a692){return function(_0x5b78d8){if(_0x5b78d8){return _0x5b78d8[_0x749a('0x23')](_0x2ad697)['then'](function(_0x6f5966){return _0x6f5966;});}return null;};}function removeEntity(_0x467569,_0x450ac1){return function(_0x31b8fa){if(_0x31b8fa){return _0x31b8fa[_0x749a('0x24')]()['then'](function(){_0x467569[_0x749a('0x1d')](0xcc)[_0x749a('0x25')]();});}};}function handleEntityNotFound(_0x2d9628,_0x1ef852){return function(_0x387fe5){if(!_0x387fe5){_0x2d9628[_0x749a('0x1c')](0x194);}return _0x387fe5;};}function handleError(_0x3192d8,_0x2bb407){_0x2bb407=_0x2bb407||0x1f4;return function(_0xcd32a0){logger[_0x749a('0x26')](_0xcd32a0[_0x749a('0x27')]);if(_0xcd32a0[_0x749a('0x28')]){delete _0xcd32a0[_0x749a('0x28')];}_0x3192d8['status'](_0x2bb407)[_0x749a('0x29')](_0xcd32a0);};}exports[_0x749a('0x2a')]=function(_0x47231e,_0x2f0075){var _0x78ae5={},_0x2bc975={},_0xa7ea8f={'count':0x0,'rows':[]};var _0x516ed5=db[_0x749a('0x2b')]['rawAttributes'];_0x2bc975[_0x749a('0x2c')]=_[_0x749a('0x2d')](_0x516ed5);var _0x25359d={'dateStart':_0x47231e[_0x749a('0x2e')][_0x749a('0x2f')],'dateEnd':_0x47231e[_0x749a('0x2e')][_0x749a('0x30')]};delete _0x47231e['query']['dateStart'];delete _0x47231e[_0x749a('0x2e')][_0x749a('0x30')];_0x2bc975[_0x749a('0x2e')]=_[_0x749a('0x2d')](_0x47231e['query']);_0x2bc975['filters']=_[_0x749a('0x31')](_0x2bc975['model'],_0x2bc975[_0x749a('0x2e')]);_0x78ae5[_0x749a('0x32')]=_[_0x749a('0x31')](_0x2bc975[_0x749a('0x2c')],qs[_0x749a('0x33')](_0x47231e[_0x749a('0x2e')]['fields']));_0x78ae5[_0x749a('0x32')]=_0x78ae5[_0x749a('0x32')][_0x749a('0x34')]?_0x78ae5[_0x749a('0x32')]:_0x2bc975[_0x749a('0x2c')];if(!_0x47231e[_0x749a('0x2e')][_0x749a('0x35')](_0x749a('0x36'))){_0x78ae5[_0x749a('0x37')]=qs['limit'](_0x47231e[_0x749a('0x2e')]['limit']);_0x78ae5[_0x749a('0x20')]=qs[_0x749a('0x20')](_0x47231e['query']['offset']);}_0x78ae5[_0x749a('0x38')]=qs['sort'](_0x47231e[_0x749a('0x2e')][_0x749a('0x39')]);_0x78ae5['where']=qs[_0x749a('0x3a')](_[_0x749a('0x3b')](_0x47231e[_0x749a('0x2e')],_0x2bc975['filters']));if(_0x25359d[_0x749a('0x2f')]){if(_0x25359d[_0x749a('0x30')]){_0x25359d['dateEnd']=moment(_0x25359d[_0x749a('0x30')])[_0x749a('0x3c')](0x1,_0x749a('0x3d'));}else{_0x25359d[_0x749a('0x30')]=moment(_0x25359d[_0x749a('0x2f')])[_0x749a('0x3c')](0x1,'day');}_[_0x749a('0x3e')](_0x78ae5['where'],{'createdAt':{'$gte':_0x25359d['dateStart'],'$lte':_0x25359d[_0x749a('0x30')]}});}if(_0x47231e[_0x749a('0x2e')][_0x749a('0x3f')]){_0x78ae5[_0x749a('0x40')]=_[_0x749a('0x3e')](_0x78ae5[_0x749a('0x40')],{'$or':_[_0x749a('0x41')](_0x78ae5[_0x749a('0x32')],function(_0x2067d6){var _0x2dc2bf={};_0x2dc2bf[_0x2067d6]={'$like':'%'+_0x47231e[_0x749a('0x2e')][_0x749a('0x3f')]+'%'};return _0x2dc2bf;})});}_0x78ae5=_[_0x749a('0x3e')]({},_0x78ae5,_0x47231e[_0x749a('0x42')]);var _0xa7ea36={'where':_0x78ae5['where']};_0xa7ea36['include']=[];if(_0x47231e[_0x749a('0x2e')]['tag']){_0xa7ea36['include'][_0x749a('0x43')]({'model':db['Tag'],'as':_0x749a('0x44'),'attributes':['id'],'where':{'id':_0x47231e['query'][_0x749a('0x45')]},'required':!![]});_0xa7ea36[_0x749a('0x46')]=!![];}if(_0x47231e['query']['read']){_0xa7ea36['include'][_0x749a('0x43')]({'model':db[_0x749a('0x47')],'as':_0x749a('0x48'),'attributes':['id',_0x749a('0x49'),_0x749a('0x4a'),'read'],'where':{'direction':'in','read':_0x47231e['query'][_0x749a('0x4b')]||![]},'required':!![]});_0xa7ea36['distinct']=!![];}return db['MailInteraction'][_0x749a('0x1f')](_0xa7ea36)[_0x749a('0x4c')](function(_0x48767c){_0xa7ea8f[_0x749a('0x1f')]=_0x48767c;if(_0x47231e['query']['includeAll']){_0x78ae5[_0x749a('0x4d')]=[{'model':db['User'],'as':_0x749a('0x4e'),'required':![],'attributes':['id','name',_0x749a('0x4f')]},{'model':db[_0x749a('0x50')],'as':_0x749a('0x51'),'required':![]},{'model':db['User'],'as':_0x749a('0x52'),'attributes':[_0x749a('0x28'),_0x749a('0x4f'),_0x749a('0x53')],'required':![]},{'model':db['MailAccount'],'as':'Account','attributes':['name',_0x749a('0x54'),'email'],'required':![]},{'model':db[_0x749a('0x47')],'as':_0x749a('0x48'),'attributes':['id',_0x749a('0x49'),_0x749a('0x4a'),_0x749a('0x4b')],'where':{'direction':'in','read':_0x47231e['query']['read']||![]},'required':_0x47231e[_0x749a('0x2e')][_0x749a('0x4b')]||![]},{'model':db[_0x749a('0x55')],'as':_0x749a('0x44'),'attributes':['id',_0x749a('0x28'),_0x749a('0x56')],'required':_0x47231e[_0x749a('0x2e')]['tag']?!![]:![]},{'model':db['Tag'],'as':_0x749a('0x57'),'attributes':['id',_0x749a('0x28'),'color'],'through':_0x47231e['query'][_0x749a('0x45')]?{'attributes':[],'where':{'TagId':_0x47231e['query']['tag']||undefined}}:{},'required':_0x47231e[_0x749a('0x2e')][_0x749a('0x45')]?!![]:![]}];}return db[_0x749a('0x2b')][_0x749a('0x58')](_0x78ae5);})[_0x749a('0x4c')](function(_0xb72284){_0xa7ea8f[_0x749a('0x59')]=_0xb72284;return _0xa7ea8f;})[_0x749a('0x4c')](respondWithFilteredResult(_0x2f0075,_0x78ae5))[_0x749a('0x5a')](handleError(_0x2f0075,null));};exports['show']=function(_0x4a87dd,_0x65868c){var _0x853fc={'raw':![],'where':{'id':_0x4a87dd['params']['id']}},_0x5885d6={};_0x5885d6[_0x749a('0x2c')]=_['keys'](db[_0x749a('0x2b')]['rawAttributes']);_0x5885d6[_0x749a('0x2e')]=_[_0x749a('0x2d')](_0x4a87dd['query']);_0x5885d6[_0x749a('0x3a')]=_['intersection'](_0x5885d6['model'],_0x5885d6[_0x749a('0x2e')]);_0x853fc['attributes']=_['intersection'](_0x5885d6['model'],qs[_0x749a('0x33')](_0x4a87dd[_0x749a('0x2e')][_0x749a('0x33')]));_0x853fc[_0x749a('0x32')]=_0x853fc['attributes'][_0x749a('0x34')]?_0x853fc[_0x749a('0x32')]:_0x5885d6[_0x749a('0x2c')];if(_0x4a87dd[_0x749a('0x2e')][_0x749a('0x5b')]){_0x853fc[_0x749a('0x4d')]=[{'all':!![]}];}_0x853fc=_[_0x749a('0x3e')]({},_0x853fc,_0x4a87dd[_0x749a('0x42')]);return db[_0x749a('0x2b')][_0x749a('0x5c')](_0x853fc)[_0x749a('0x4c')](handleEntityNotFound(_0x65868c,null))[_0x749a('0x4c')](respondWithResult(_0x65868c,null))[_0x749a('0x5a')](handleError(_0x65868c,null));};exports[_0x749a('0x5d')]=function(_0x3d063f,_0x2feddb){return db[_0x749a('0x2b')][_0x749a('0x5d')](_0x3d063f[_0x749a('0x5e')],{})[_0x749a('0x4c')](respondWithResult(_0x2feddb,0xc9))[_0x749a('0x5a')](handleError(_0x2feddb,null));};exports['update']=function(_0x2c64b5,_0x404246){if(_0x2c64b5[_0x749a('0x5e')]['id']){delete _0x2c64b5[_0x749a('0x5e')]['id'];}return db[_0x749a('0x2b')]['find']({'where':{'id':_0x2c64b5['params']['id']}})[_0x749a('0x4c')](handleEntityNotFound(_0x404246,null))[_0x749a('0x4c')](saveUpdates(_0x2c64b5[_0x749a('0x5e')],null))[_0x749a('0x4c')](respondWithResult(_0x404246,null))['catch'](handleError(_0x404246,null));};exports[_0x749a('0x24')]=function(_0x7dc9c2,_0x267a7b){return db[_0x749a('0x2b')]['find']({'where':{'id':_0x7dc9c2[_0x749a('0x5f')]['id']}})[_0x749a('0x4c')](handleEntityNotFound(_0x267a7b,null))[_0x749a('0x4c')](removeEntity(_0x267a7b,null))['catch'](handleError(_0x267a7b,null));};exports[_0x749a('0x60')]=function(_0x51f010,_0x22abbc){return db[_0x749a('0x2b')][_0x749a('0x60')]()[_0x749a('0x4c')](respondWithResult(_0x22abbc,null))[_0x749a('0x5a')](handleError(_0x22abbc,null));};exports[_0x749a('0x61')]=function(_0x90d15a,_0x286088,_0x46a712){return db[_0x749a('0x47')][_0x749a('0x5c')]({'where':{'id':_0x90d15a[_0x749a('0x5f')]['id']}})[_0x749a('0x4c')](handleEntityNotFound(_0x286088,null))[_0x749a('0x4c')](function(_0x288db8){if(_0x288db8){return _0x288db8[_0x749a('0x61')](_0x90d15a[_0x749a('0x5e')][_0x749a('0x62')],_[_0x749a('0x63')](_0x90d15a[_0x749a('0x5e')],[_0x749a('0x62'),'id'])||{});}})[_0x749a('0x4c')](respondWithResult(_0x286088,null))[_0x749a('0x5a')](handleError(_0x286088,null));};exports[_0x749a('0x64')]=function(_0x167148,_0x460de2,_0x141603){var _0x3fb2d4={'raw':![],'where':{}};var _0x3dc694={};var _0x3acb2a={'count':0x0,'rows':[]};return db[_0x749a('0x2b')][_0x749a('0x65')]({'where':{'id':_0x167148['params']['id']}})[_0x749a('0x4c')](handleEntityNotFound(_0x460de2,null))[_0x749a('0x4c')](function(_0x8a2068){if(_0x8a2068){_0x3dc694[_0x749a('0x2c')]=_[_0x749a('0x2d')](db[_0x749a('0x47')]['rawAttributes']);_0x3dc694[_0x749a('0x2e')]=_[_0x749a('0x2d')](_0x167148[_0x749a('0x2e')]);_0x3dc694['filters']=_['intersection'](_0x3dc694['model'],_0x3dc694[_0x749a('0x2e')]);_0x3fb2d4[_0x749a('0x32')]=_[_0x749a('0x31')](_0x3dc694['model'],qs[_0x749a('0x33')](_0x167148['query'][_0x749a('0x33')]));_0x3fb2d4[_0x749a('0x32')]=_0x3fb2d4['attributes'][_0x749a('0x34')]?_0x3fb2d4[_0x749a('0x32')]:_0x3dc694['model'];if(!_0x167148['query'][_0x749a('0x35')]('nolimit')){_0x3fb2d4[_0x749a('0x37')]=qs[_0x749a('0x37')](_0x167148[_0x749a('0x2e')][_0x749a('0x37')]);_0x3fb2d4[_0x749a('0x20')]=qs[_0x749a('0x20')](_0x167148[_0x749a('0x2e')][_0x749a('0x20')]);}_0x3fb2d4[_0x749a('0x38')]=qs[_0x749a('0x39')](_0x167148['query'][_0x749a('0x39')]);_0x3fb2d4[_0x749a('0x40')]=qs['filters'](_['pick'](_0x167148[_0x749a('0x2e')],_0x3dc694['filters']));_0x3fb2d4[_0x749a('0x40')][_0x749a('0x66')]=_0x8a2068['id'];if(_0x167148[_0x749a('0x2e')]['filter']){_0x3fb2d4['where']=_[_0x749a('0x3e')](_0x3fb2d4[_0x749a('0x40')],{'$or':_[_0x749a('0x41')](_0x3fb2d4['attributes'],function(_0x4685e3){var _0x2dfe9b={};_0x2dfe9b[_0x4685e3]={'$like':'%'+_0x167148[_0x749a('0x2e')][_0x749a('0x3f')]+'%'};return _0x2dfe9b;})});}if(_0x167148[_0x749a('0x2e')][_0x749a('0x67')]){var _0x3f9f1c=_0x167148[_0x749a('0x2e')]['$gte']['split'](',');var _0x31af76={};_0x31af76[_0x3f9f1c[0x0]]={'$gte':moment(_0x3f9f1c[0x1])[_0x749a('0x68')](_0x749a('0x69'))};_0x3fb2d4[_0x749a('0x40')]=_[_0x749a('0x3e')](_0x3fb2d4[_0x749a('0x40')],_0x31af76);}_0x3fb2d4=_['merge']({},_0x3fb2d4,_0x167148[_0x749a('0x42')]);return db['MailMessage']['count']({'where':_0x3fb2d4[_0x749a('0x40')]})['then'](function(_0x5eb7d7){_0x3acb2a['count']=_0x5eb7d7;if(_0x167148['query']['includeAll']){_0x3fb2d4[_0x749a('0x4d')]=[{'all':!![]}];}return db[_0x749a('0x47')][_0x749a('0x58')](_0x3fb2d4);})[_0x749a('0x4c')](function(_0x3d078c){_0x3acb2a[_0x749a('0x59')]=_0x3d078c;return _0x3acb2a;});}})['then'](respondWithFilteredResult(_0x460de2,_0x3fb2d4))[_0x749a('0x5a')](handleError(_0x460de2,null));};exports['addTags']=function(_0x9eb1b0,_0x39dd1b,_0x145fd2){return db['MailInteraction'][_0x749a('0x5c')]({'where':{'id':_0x9eb1b0[_0x749a('0x5f')]['id']}})['then'](handleEntityNotFound(_0x39dd1b,null))[_0x749a('0x4c')](function(_0x37a9de){if(_0x37a9de){return _0x37a9de[_0x749a('0x6a')](_0x9eb1b0[_0x749a('0x5e')][_0x749a('0x62')],_[_0x749a('0x63')](_0x9eb1b0['body'],['ids','id'])||{})[_0x749a('0x6b')](function(){return db[_0x749a('0x55')]['findAll']({'attributes':['id',_0x749a('0x28'),_0x749a('0x56')],'where':{'id':_0x9eb1b0[_0x749a('0x5e')]['ids']}});})[_0x749a('0x4c')](function(_0x5bc662){socket[_0x749a('0x6c')]('mailInteractionTags:save',{'id':Number(_0x9eb1b0[_0x749a('0x5f')]['id']),'tags':_0x5bc662||[]});return{'id':Number(_0x9eb1b0['params']['id']),'tags':_0x5bc662||[]};});}})['then'](respondWithResult(_0x39dd1b,null))[_0x749a('0x5a')](handleError(_0x39dd1b,null));};exports['removeTags']=function(_0x5b0a2a,_0x4c3726,_0x4f0bd8){var _0x4cd378;return db[_0x749a('0x2b')][_0x749a('0x5c')]({'where':{'id':_0x5b0a2a['params']['id']}})[_0x749a('0x4c')](handleEntityNotFound(_0x4c3726,null))[_0x749a('0x4c')](function(_0x3b3b45){if(_0x3b3b45){return _0x3b3b45[_0x749a('0x6d')](_0x5b0a2a['query'][_0x749a('0x62')]);}})[_0x749a('0x4c')](respondWithStatusCode(_0x4c3726,null))[_0x749a('0x5a')](handleError(_0x4c3726,null));};exports[_0x749a('0x6e')]=function(_0x2db085,_0x11d70c){var _0x2842ef=moment()[_0x749a('0x6f')]()[_0x749a('0x70')]();var _0x49b412=path['join'](config['root'],'server',_0x749a('0x71'),_0x749a('0x72'));var _0x3c5f79=path[_0x749a('0x73')](config[_0x749a('0x74')],_0x749a('0x75'),_0x749a('0x71'),_0x749a('0x76'));var _0x1fbb80=path['join'](_0x3c5f79,_0x2842ef);var _0x3a91c1=util[_0x749a('0x68')](_0x749a('0x77'),_0x2842ef);var _0x16bea4=path[_0x749a('0x73')](_0x3c5f79,_0x3a91c1);var _0x2d9d2e=![];return db[_0x749a('0x2b')][_0x749a('0x5c')]({'where':{'id':_0x2db085['params']['id']}})[_0x749a('0x4c')](handleEntityNotFound(_0x11d70c,null))[_0x749a('0x4c')](function(_0x135967){if(_0x135967){return _0x135967[_0x749a('0x64')]({'attributes':['id',_0x749a('0x5e'),_0x749a('0x78'),'to','cc',_0x749a('0x79'),_0x749a('0x4a')],'where':{'secret':![]},'include':_0x2db085[_0x749a('0x2e')]['attachments']?[{'model':db[_0x749a('0x7a')],'as':_0x749a('0x7b')}]:undefined,'order':qs[_0x749a('0x39')]('id')});}return[];})[_0x749a('0x4c')](function(_0x18762d){_0x2d9d2e=_0x18762d[_0x749a('0x34')];if(_0x18762d[_0x749a('0x34')]){fs[_0x749a('0x7c')](_0x1fbb80);return BPromise[_0x749a('0x7d')](_0x18762d,function(_0x5d6ee2,_0x1b18fa){var _0x3105e0=_0x5d6ee2;var _0x1d4f01={'from':_0x3105e0[_0x749a('0x78')],'to':_0x3105e0['to'],'subject':_0x3105e0[_0x749a('0x79')],'html':_0x3105e0[_0x749a('0x5e')],'attachments':[]};return new BPromise(function(_0x317078,_0x2afa66){if(_0x5d6ee2[_0x749a('0x7b')]){for(var _0x40573a=0x0;_0x40573a<_0x5d6ee2[_0x749a('0x7b')][_0x749a('0x34')];_0x40573a++){var _0x48ecee=_0x5d6ee2[_0x749a('0x7b')][_0x40573a];var _0x4037af=path[_0x749a('0x73')](_0x49b412,_0x48ecee[_0x749a('0x7e')]);if(fs['existsSync'](_0x4037af)){_0x1d4f01[_0x749a('0x72')][_0x749a('0x43')]({'name':_0x48ecee[_0x749a('0x28')],'contentType':_0x48ecee[_0x749a('0x7f')],'data':fs[_0x749a('0x80')](_0x4037af)});}}}emlformat[_0x749a('0x81')](_0x1d4f01,function(_0x4ce6da,_0x230573){if(_0x4ce6da)return _0x2afa66(_0x4ce6da);fs[_0x749a('0x82')](path[_0x749a('0x73')](_0x1fbb80,util[_0x749a('0x68')](_0x749a('0x83'),_0x1b18fa)),_0x230573);return _0x317078(_0x230573);});});});}})['then'](function(){if(_0x2d9d2e){return new BPromise(function(_0x3decac,_0x29ba5b){zipdir(_0x1fbb80,{'saveTo':_0x16bea4},function(_0x14523a,_0x42e744){if(_0x14523a)return _0x29ba5b(_0x14523a);return _0x3decac(_0x42e744);});});}})[_0x749a('0x4c')](function(){if(_0x2d9d2e){return new BPromise(function(_0x3bfb1a,_0x427f1a){rimraf(_0x1fbb80,function(_0x3810f0){if(_0x3810f0)_0x427f1a(_0x3810f0);return _0x3bfb1a();});});}})[_0x749a('0x4c')](function(){if(_0x2d9d2e){return _0x11d70c['download'](_0x16bea4,_0x3a91c1,function(_0x479707){if(_0x479707){console[_0x749a('0x84')](_0x749a('0x85'),_0x479707);}else{fs[_0x749a('0x86')](_0x16bea4);}});}else{return _0x11d70c[_0x749a('0x1c')](0xc8);}})['catch'](handleError(_0x11d70c,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index c36b678..0a60989 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 _0xe3d4=['MailInteraction','save','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0xd85f08,_0x4c34f3){var _0x41428f=function(_0x652976){while(--_0x652976){_0xd85f08['push'](_0xd85f08['shift']());}};_0x41428f(++_0x4c34f3);}(_0xe3d4,0x77));var _0x4e3d=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0xe3d4[_0x220f3f];return _0x1f170e;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x4e3d('0x0'))['db'][_0x4e3d('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4e3d('0x2'),'afterUpdate':_0x4e3d('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1442c5){return function(_0x4b5209,_0x4a97ad,_0x26cc46){MailInteractionEvents[_0x4e3d('0x4')](_0x1442c5+':'+_0x4b5209['id'],_0x4b5209);MailInteractionEvents[_0x4e3d('0x4')](_0x1442c5,_0x4b5209);_0x26cc46(null);};}for(var e in events){if(events[_0x4e3d('0x5')](e)){var event=events[e];MailInteraction[_0x4e3d('0x6')](e,emitEvent(event));}}module[_0x4e3d('0x7')]=MailInteractionEvents; \ No newline at end of file +var _0x8b41=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','save','update','remove'];(function(_0x45edda,_0x50244f){var _0xdd8075=function(_0x56953a){while(--_0x56953a){_0x45edda['push'](_0x45edda['shift']());}};_0xdd8075(++_0x50244f);}(_0x8b41,0xae));var _0x18b4=function(_0xce865b,_0x4376be){_0xce865b=_0xce865b-0x0;var _0x42712f=_0x8b41[_0xce865b];return _0x42712f;};'use strict';var EventEmitter=require(_0x18b4('0x0'));var MailInteraction=require(_0x18b4('0x1'))['db'][_0x18b4('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x18b4('0x3'),'afterUpdate':_0x18b4('0x4'),'afterDestroy':_0x18b4('0x5')};function emitEvent(_0x55c5bf){return function(_0x4ee964,_0x29300b,_0x25fb14){MailInteractionEvents[_0x18b4('0x6')](_0x55c5bf+':'+_0x4ee964['id'],_0x4ee964);MailInteractionEvents[_0x18b4('0x6')](_0x55c5bf,_0x4ee964);_0x25fb14(null);};}for(var e in events){if(events[_0x18b4('0x7')](e)){var event=events[e];MailInteraction[_0x18b4('0x8')](e,emitEvent(event));}}module[_0x18b4('0x9')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index e0d1645..5474807 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 _0xc122=['MailInteraction','mail_interactions','lodash','util','../../config/logger','moment','bluebird','request-promise','exports','define'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xc122,0x66));var _0x2c12=function(_0x545574,_0x5be46a){_0x545574=_0x545574-0x0;var _0x41a95d=_0xc122[_0x545574];return _0x41a95d;};'use strict';var _=require(_0x2c12('0x0'));var util=require(_0x2c12('0x1'));var logger=require(_0x2c12('0x2'))('api');var moment=require(_0x2c12('0x3'));var BPromise=require(_0x2c12('0x4'));var rp=require(_0x2c12('0x5'));var attributes=require('./mailInteraction.attributes');module[_0x2c12('0x6')]=function(_0x1bdc6b,_0x1b5193){return _0x1bdc6b[_0x2c12('0x7')](_0x2c12('0x8'),attributes,{'tableName':_0x2c12('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f24=['mail_interactions','util','../../config/logger','api','moment','bluebird','request-promise','./mailInteraction.attributes','MailInteraction'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x0f24,0xac));var _0x40f2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0f24[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x40f2('0x0'));var logger=require(_0x40f2('0x1'))(_0x40f2('0x2'));var moment=require(_0x40f2('0x3'));var BPromise=require(_0x40f2('0x4'));var rp=require(_0x40f2('0x5'));var attributes=require(_0x40f2('0x6'));module['exports']=function(_0x43dbbe,_0x4dd045){return _0x43dbbe['define'](_0x40f2('0x7'),attributes,{'tableName':_0x40f2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 314d427..5c3e81f 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 _0x0adf=['../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','request','then','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','catch','AddTagsToMailInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x250f7f,_0x5a586b){var _0x132191=function(_0xc6a87c){while(--_0xc6a87c){_0x250f7f['push'](_0x250f7f['shift']());}};_0x132191(++_0x5a586b);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x9ad73d,_0x28a993){_0x9ad73d=_0x9ad73d-0x0;var _0x1240c7=_0x0adf[_0x9ad73d];return _0x1240c7;};'use strict';var _=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var moment=require(_0xf0ad('0x2'));var BPromise=require('bluebird');var rs=require(_0xf0ad('0x3'));var fs=require('fs');var Redis=require(_0xf0ad('0x4'));var db=require(_0xf0ad('0x5'))['db'];var utils=require(_0xf0ad('0x6'));var logger=require(_0xf0ad('0x7'))(_0xf0ad('0x8'));var config=require(_0xf0ad('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf0ad('0xa')]['http']({'port':0x232a});config[_0xf0ad('0xb')]=_[_0xf0ad('0xc')](config[_0xf0ad('0xb')],{'host':_0xf0ad('0xd'),'port':0x18eb});var socket=require(_0xf0ad('0xe'))(new Redis(config[_0xf0ad('0xb')]));require(_0xf0ad('0xf'))['register'](socket);function respondWithRpcPromise(_0x2ab4eb,_0x53c81a,_0x24db70){return new BPromise(function(_0x1f2952,_0x43fb01){return client[_0xf0ad('0x10')](_0x2ab4eb,_0x24db70)[_0xf0ad('0x11')](function(_0x4f2b79){logger['info'](_0xf0ad('0x12'),_0x53c81a,_0xf0ad('0x13'));logger[_0xf0ad('0x14')](_0xf0ad('0x15'),_0x53c81a,'request\x20sent',JSON[_0xf0ad('0x16')](_0x4f2b79));if(_0x4f2b79[_0xf0ad('0x17')]){if(_0x4f2b79['error']['code']===0x1f4){logger['error'](_0xf0ad('0x12'),_0x53c81a,_0x4f2b79['error'][_0xf0ad('0x18')]);return _0x43fb01(_0x4f2b79[_0xf0ad('0x17')][_0xf0ad('0x18')]);}logger[_0xf0ad('0x17')](_0xf0ad('0x12'),_0x53c81a,_0x4f2b79['error'][_0xf0ad('0x18')]);return _0x1f2952(_0x4f2b79[_0xf0ad('0x17')][_0xf0ad('0x18')]);}else{logger[_0xf0ad('0x19')]('MailInteraction,\x20%s,\x20%s',_0x53c81a,'request\x20sent');_0x1f2952(_0x4f2b79[_0xf0ad('0x1a')][_0xf0ad('0x18')]);}})['catch'](function(_0x32d05c){logger[_0xf0ad('0x17')](_0xf0ad('0x12'),_0x53c81a,_0x32d05c);_0x43fb01(_0x32d05c);});});}exports[_0xf0ad('0x1b')]=function(_0x4cc08a){var _0x57c570=this;return new Promise(function(_0x3f8cf3,_0x2da425){return db[_0xf0ad('0x1c')][_0xf0ad('0x1d')](_0x4cc08a[_0xf0ad('0x1e')],{'raw':_0x4cc08a[_0xf0ad('0x1f')]?_0x4cc08a['options'][_0xf0ad('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cc08a[_0xf0ad('0x1f')]?_0x4cc08a[_0xf0ad('0x1f')][_0xf0ad('0x21')]||null:null,'attributes':_0x4cc08a[_0xf0ad('0x1f')]?_0x4cc08a[_0xf0ad('0x1f')][_0xf0ad('0x22')]||null:null,'limit':_0x4cc08a[_0xf0ad('0x1f')]?_0x4cc08a[_0xf0ad('0x1f')][_0xf0ad('0x23')]||null:null})[_0xf0ad('0x11')](function(_0x2f634f){logger[_0xf0ad('0x19')](_0xf0ad('0x1b'),_0x4cc08a);logger[_0xf0ad('0x14')]('UpdateMailInteraction',_0x4cc08a,JSON[_0xf0ad('0x16')](_0x2f634f));_0x3f8cf3(_0x2f634f);})[_0xf0ad('0x24')](function(_0x248794){logger[_0xf0ad('0x17')](_0xf0ad('0x1b'),_0x248794[_0xf0ad('0x18')],_0x4cc08a);_0x2da425(_0x57c570['error'](0x1f4,_0x248794[_0xf0ad('0x18')]));});});};exports[_0xf0ad('0x25')]=function(_0x2b62){return new Promise(function(_0x1e60b1,_0x1b6880){return db[_0xf0ad('0x1c')][_0xf0ad('0x26')]({'where':_0x2b62[_0xf0ad('0x1f')]?_0x2b62[_0xf0ad('0x1f')][_0xf0ad('0x21')]||null:null})[_0xf0ad('0x11')](function(_0x4c839d){if(_0x4c839d){return _0x4c839d[_0xf0ad('0x27')](_0x2b62['body'][_0xf0ad('0x28')],_['omit'](_0x2b62[_0xf0ad('0x1e')],[_0xf0ad('0x28'),'id'])||{});}})[_0xf0ad('0x29')](function(_0x3015ce){logger[_0xf0ad('0x19')](_0xf0ad('0x2a'),_0x2b62);logger[_0xf0ad('0x14')](_0xf0ad('0x2a'),_0x2b62,JSON['stringify'](_0x3015ce));_0x1e60b1(_0x3015ce);})['catch'](function(_0x22ecf3){logger[_0xf0ad('0x17')](_0xf0ad('0x2a'),_0x22ecf3[_0xf0ad('0x18')],_0x2b62);_0x1b6880(_this['error'](0x1f4,_0x22ecf3[_0xf0ad('0x18')]));});});}; \ No newline at end of file +var _0x6931=['UpdateMailInteraction','omit','spread','info','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./mailInteraction.socket','register','request','then','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailInteraction','update','body','options','raw','where','limit'];(function(_0x1b3564,_0x16c919){var _0x504069=function(_0x9322b6){while(--_0x9322b6){_0x1b3564['push'](_0x1b3564['shift']());}};_0x504069(++_0x16c919);}(_0x6931,0x1a9));var _0x1693=function(_0x4e10cb,_0x10d271){_0x4e10cb=_0x4e10cb-0x0;var _0x3434f5=_0x6931[_0x4e10cb];return _0x3434f5;};'use strict';var _=require(_0x1693('0x0'));var util=require(_0x1693('0x1'));var moment=require(_0x1693('0x2'));var BPromise=require(_0x1693('0x3'));var rs=require(_0x1693('0x4'));var fs=require('fs');var Redis=require(_0x1693('0x5'));var db=require(_0x1693('0x6'))['db'];var utils=require(_0x1693('0x7'));var logger=require('../../config/logger')(_0x1693('0x8'));var config=require(_0x1693('0x9'));var jayson=require(_0x1693('0xa'));var client=jayson[_0x1693('0xb')][_0x1693('0xc')]({'port':0x232a});config['redis']=_[_0x1693('0xd')](config[_0x1693('0xe')],{'host':_0x1693('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1693('0xe')]));require(_0x1693('0x10'))[_0x1693('0x11')](socket);function respondWithRpcPromise(_0x141ea9,_0x2af3d1,_0x181184){return new BPromise(function(_0x26ba4b,_0x3807dd){return client[_0x1693('0x12')](_0x141ea9,_0x181184)[_0x1693('0x13')](function(_0x1ba755){logger['info'](_0x1693('0x14'),_0x2af3d1,_0x1693('0x15'));logger[_0x1693('0x16')](_0x1693('0x17'),_0x2af3d1,_0x1693('0x15'),JSON[_0x1693('0x18')](_0x1ba755));if(_0x1ba755[_0x1693('0x19')]){if(_0x1ba755['error'][_0x1693('0x1a')]===0x1f4){logger['error'](_0x1693('0x14'),_0x2af3d1,_0x1ba755['error'][_0x1693('0x1b')]);return _0x3807dd(_0x1ba755[_0x1693('0x19')]['message']);}logger['error'](_0x1693('0x14'),_0x2af3d1,_0x1ba755['error']['message']);return _0x26ba4b(_0x1ba755['error'][_0x1693('0x1b')]);}else{logger['info']('MailInteraction,\x20%s,\x20%s',_0x2af3d1,_0x1693('0x15'));_0x26ba4b(_0x1ba755[_0x1693('0x1c')][_0x1693('0x1b')]);}})[_0x1693('0x1d')](function(_0x28edfe){logger[_0x1693('0x19')]('MailInteraction,\x20%s,\x20%s',_0x2af3d1,_0x28edfe);_0x3807dd(_0x28edfe);});});}exports['UpdateMailInteraction']=function(_0x266bb6){var _0x3d1559=this;return new Promise(function(_0x528995,_0x183183){return db[_0x1693('0x1e')][_0x1693('0x1f')](_0x266bb6[_0x1693('0x20')],{'raw':_0x266bb6[_0x1693('0x21')]?_0x266bb6['options'][_0x1693('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x266bb6[_0x1693('0x21')]?_0x266bb6[_0x1693('0x21')][_0x1693('0x23')]||null:null,'attributes':_0x266bb6[_0x1693('0x21')]?_0x266bb6[_0x1693('0x21')]['attributes']||null:null,'limit':_0x266bb6[_0x1693('0x21')]?_0x266bb6['options'][_0x1693('0x24')]||null:null})[_0x1693('0x13')](function(_0x31ef48){logger['info'](_0x1693('0x25'),_0x266bb6);logger[_0x1693('0x16')](_0x1693('0x25'),_0x266bb6,JSON[_0x1693('0x18')](_0x31ef48));_0x528995(_0x31ef48);})[_0x1693('0x1d')](function(_0x459c39){logger[_0x1693('0x19')]('UpdateMailInteraction',_0x459c39[_0x1693('0x1b')],_0x266bb6);_0x183183(_0x3d1559['error'](0x1f4,_0x459c39[_0x1693('0x1b')]));});});};exports['AddTagsToMailInteraction']=function(_0x3f94b9){return new Promise(function(_0x3cf82a,_0x437eb9){return db[_0x1693('0x1e')]['find']({'where':_0x3f94b9[_0x1693('0x21')]?_0x3f94b9[_0x1693('0x21')]['where']||null:null})['then'](function(_0x372585){if(_0x372585){return _0x372585['addTags'](_0x3f94b9['body']['ids'],_[_0x1693('0x26')](_0x3f94b9[_0x1693('0x20')],['ids','id'])||{});}})[_0x1693('0x27')](function(_0x514115){logger[_0x1693('0x28')]('AddTags',_0x3f94b9);logger[_0x1693('0x16')](_0x1693('0x29'),_0x3f94b9,JSON[_0x1693('0x18')](_0x514115));_0x3cf82a(_0x514115);})['catch'](function(_0x2c4805){logger[_0x1693('0x19')](_0x1693('0x29'),_0x2c4805[_0x1693('0x1b')],_0x3f94b9);_0x437eb9(_this[_0x1693('0x19')](0x1f4,_0x2c4805[_0x1693('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 674b914..14007ff 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 _0x71a1=['removeListener','register','length','mailInteraction:','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x71a1,0x1ee));var _0x171a=function(_0x386d5b,_0x33ea31){_0x386d5b=_0x386d5b-0x0;var _0x44bf7d=_0x71a1[_0x386d5b];return _0x44bf7d;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=['save','remove','update'];function createListener(_0x2371bc,_0x565a2c){return function(_0x36e1cc){_0x565a2c[_0x171a('0x0')](_0x2371bc,_0x36e1cc);};}function removeListener(_0x5e7ea8,_0x3549fc){return function(){MailInteractionEvents[_0x171a('0x1')](_0x5e7ea8,_0x3549fc);};}exports[_0x171a('0x2')]=function(_0x1f921b){for(var _0x25c75c=0x0,_0x3dc02c=events[_0x171a('0x3')];_0x25c75c<_0x3dc02c;_0x25c75c++){var _0x59ec09=events[_0x25c75c];var _0x19060a=createListener(_0x171a('0x4')+_0x59ec09,_0x1f921b);MailInteractionEvents['on'](_0x59ec09,_0x19060a);}}; \ No newline at end of file +var _0x0e51=['mailInteraction:','./mailInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x54ce0e,_0x97efa2){var _0x2f5637=function(_0x38ef57){while(--_0x38ef57){_0x54ce0e['push'](_0x54ce0e['shift']());}};_0x2f5637(++_0x97efa2);}(_0x0e51,0x199));var _0x10e5=function(_0x11d0da,_0x3c7cbc){_0x11d0da=_0x11d0da-0x0;var _0x392df8=_0x0e51[_0x11d0da];return _0x392df8;};'use strict';var MailInteractionEvents=require(_0x10e5('0x0'));var events=[_0x10e5('0x1'),_0x10e5('0x2'),_0x10e5('0x3')];function createListener(_0x176c1c,_0x456647){return function(_0x1a02be){_0x456647[_0x10e5('0x4')](_0x176c1c,_0x1a02be);};}function removeListener(_0x1e17cb,_0x32a4f3){return function(){MailInteractionEvents[_0x10e5('0x5')](_0x1e17cb,_0x32a4f3);};}exports[_0x10e5('0x6')]=function(_0x4793a1){for(var _0x1031d8=0x0,_0x575338=events['length'];_0x1031d8<_0x575338;_0x1031d8++){var _0x55206c=events[_0x1031d8];var _0x5b94fd=createListener(_0x10e5('0x7')+_0x55206c,_0x4793a1);MailInteractionEvents['on'](_0x55206c,_0x5b94fd);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 3ecad5c..50f6ebb 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 _0x8ef6=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x8ef6,0xf2));var _0x68ef=function(_0x111e1e,_0x23e2ff){_0x111e1e=_0x111e1e-0x0;var _0xf56f79=_0x8ef6[_0x111e1e];return _0xf56f79;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var auth=require(_0x68ef('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x68ef('0x7'));var controller=require(_0x68ef('0x8'));router[_0x68ef('0x9')]('/',auth[_0x68ef('0xa')](),controller['index']);router['get'](_0x68ef('0xb'),auth[_0x68ef('0xa')](),controller[_0x68ef('0xc')]);router['get'](_0x68ef('0xd'),auth[_0x68ef('0xa')](),controller[_0x68ef('0xe')]);router[_0x68ef('0x9')](_0x68ef('0xf'),auth[_0x68ef('0xa')](),controller[_0x68ef('0x10')]);router[_0x68ef('0x11')]('/',auth[_0x68ef('0xa')](),interaction[_0x68ef('0x12')](_0x68ef('0x13'),_0x68ef('0x14')),controller['create']);router[_0x68ef('0x15')](_0x68ef('0xd'),auth[_0x68ef('0xa')](),controller[_0x68ef('0x16')]);router[_0x68ef('0x15')](_0x68ef('0x17'),auth['isAuthenticated'](),controller[_0x68ef('0x18')]);router[_0x68ef('0x15')](_0x68ef('0x19'),auth['isAuthenticated'](),controller[_0x68ef('0x1a')]);router[_0x68ef('0x1b')](_0x68ef('0xd'),auth['isAuthenticated'](),controller[_0x68ef('0x1c')]);module[_0x68ef('0x1d')]=router; \ No newline at end of file +var _0x5d17=['/:id/download','post','mail','mailmessage:create','create','put','/:id/accept','accept','reject','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0xb2e70c,_0x341cd4){var _0x303164=function(_0x2a0170){while(--_0x2a0170){_0xb2e70c['push'](_0xb2e70c['shift']());}};_0x303164(++_0x341cd4);}(_0x5d17,0x114));var _0x75d1=function(_0x2ac5f8,_0x4c3a9f){_0x2ac5f8=_0x2ac5f8-0x0;var _0x3b8229=_0x5d17[_0x2ac5f8];return _0x3b8229;};'use strict';var multer=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x75d1('0x2'));var router=express[_0x75d1('0x3')]();var auth=require(_0x75d1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x75d1('0x5'));var controller=require(_0x75d1('0x6'));router[_0x75d1('0x7')]('/',auth[_0x75d1('0x8')](),controller['index']);router[_0x75d1('0x7')](_0x75d1('0x9'),auth[_0x75d1('0x8')](),controller[_0x75d1('0xa')]);router[_0x75d1('0x7')](_0x75d1('0xb'),auth[_0x75d1('0x8')](),controller['show']);router['get'](_0x75d1('0xc'),auth['isAuthenticated'](),controller['download']);router[_0x75d1('0xd')]('/',auth[_0x75d1('0x8')](),interaction['tracked'](_0x75d1('0xe'),_0x75d1('0xf')),controller[_0x75d1('0x10')]);router[_0x75d1('0x11')](_0x75d1('0xb'),auth[_0x75d1('0x8')](),controller['update']);router[_0x75d1('0x11')](_0x75d1('0x12'),auth[_0x75d1('0x8')](),controller[_0x75d1('0x13')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x75d1('0x14')]);router[_0x75d1('0x15')](_0x75d1('0xb'),auth['isAuthenticated'](),controller[_0x75d1('0x16')]);module[_0x75d1('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 091a3b2..ac7059a 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 _0x9009=['TEXT','BOOLEAN','ENUM','out','STRING','long','DATE','INTEGER','sequelize','exports'];(function(_0x3fcfda,_0xa0bfeb){var _0x132ce0=function(_0x5d227b){while(--_0x5d227b){_0x3fcfda['push'](_0x3fcfda['shift']());}};_0x132ce0(++_0xa0bfeb);}(_0x9009,0x1d4));var _0x9900=function(_0x2c8298,_0xe64869){_0x2c8298=_0x2c8298-0x0;var _0xbf6cf=_0x9009[_0x2c8298];return _0xbf6cf;};'use strict';var Sequelize=require(_0x9900('0x0'));var _=require('lodash');module[_0x9900('0x1')]={'body':{'type':Sequelize[_0x9900('0x2')]('long'),'allowNull':![]},'read':{'type':Sequelize[_0x9900('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9900('0x4')]('in',_0x9900('0x5')),'defaultValue':_0x9900('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'from':{'type':Sequelize[_0x9900('0x6')]},'to':{'type':Sequelize[_0x9900('0x2')]('long')},'cc':{'type':Sequelize['TEXT'](_0x9900('0x7'))},'bcc':{'type':Sequelize[_0x9900('0x2')]('long')},'subject':{'type':Sequelize[_0x9900('0x2')]},'sentAt':{'type':Sequelize[_0x9900('0x8')]},'attach':{'type':Sequelize[_0x9900('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x9900('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x9900('0x2')](_0x9900('0x7'))},'originCc':{'type':Sequelize[_0x9900('0x2')](_0x9900('0x7'))}}; \ No newline at end of file +var _0x0967=['DATE','INTEGER','BOOLEAN','sequelize','TEXT','long','ENUM','STRING'];(function(_0x29f08e,_0x3e70a6){var _0x4d74c3=function(_0x15c392){while(--_0x15c392){_0x29f08e['push'](_0x29f08e['shift']());}};_0x4d74c3(++_0x3e70a6);}(_0x0967,0x173));var _0x7096=function(_0x204124,_0x1f978c){_0x204124=_0x204124-0x0;var _0x379793=_0x0967[_0x204124];return _0x379793;};'use strict';var Sequelize=require(_0x7096('0x0'));var _=require('lodash');module['exports']={'body':{'type':Sequelize[_0x7096('0x1')](_0x7096('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x7096('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x7096('0x4')](0xbe)},'from':{'type':Sequelize[_0x7096('0x4')]},'to':{'type':Sequelize[_0x7096('0x1')](_0x7096('0x2'))},'cc':{'type':Sequelize['TEXT'](_0x7096('0x2'))},'bcc':{'type':Sequelize[_0x7096('0x1')](_0x7096('0x2'))},'subject':{'type':Sequelize[_0x7096('0x1')]},'sentAt':{'type':Sequelize[_0x7096('0x5')]},'attach':{'type':Sequelize[_0x7096('0x6')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x7096('0x7')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x7096('0x1')](_0x7096('0x2'))},'originCc':{'type':Sequelize[_0x7096('0x1')](_0x7096('0x2'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 2ec28a8..9182ec8 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 _0xdb38=['set','Content-Range','save','update','destroy','stack','name','send','MailMessage','model','keys','dateStart','query','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','add','day','merge','where','filter','map','count','includeAll','include','show','params','rawAttributes','options','find','body','describe','create','direction','out','MailAccount','findOne','MailAccountId','MailServerOut','Smtp','isNil','host','port','secure','authentication','user','service','pass','attachments','join','server/files/attachments','basename','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','mail','read','readAt','format','UserId','Contact','MailInteraction','MailInteractionId','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','SIP/%s','accept','EventManager','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','channel','event','download','unix','toString','server','files','message-%s.eml','from','subject','Attachment','Attachments','existsSync','build','err','unlinkSync','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','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit'];(function(_0xee405c,_0x135503){var _0x12a589=function(_0x48bffa){while(--_0x48bffa){_0xee405c['push'](_0xee405c['shift']());}};_0x12a589(++_0x135503);}(_0xdb38,0x19a));var _0x8db3=function(_0x117adf,_0x531a0b){_0x117adf=_0x117adf-0x0;var _0xeff0fa=_0xdb38[_0x117adf];return _0xeff0fa;};'use strict';var pdf=require(_0x8db3('0x0'));var emlformat=require(_0x8db3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8db3('0x2'));var jsonpatch=require(_0x8db3('0x3'));var rp=require(_0x8db3('0x4'));var moment=require(_0x8db3('0x5'));var BPromise=require(_0x8db3('0x6'));var Mustache=require(_0x8db3('0x7'));var util=require(_0x8db3('0x8'));var path=require(_0x8db3('0x9'));var sox=require(_0x8db3('0xa'));var csv=require(_0x8db3('0xb'));var ejs=require(_0x8db3('0xc'));var fs=require('fs');var _=require(_0x8db3('0xd'));var squel=require(_0x8db3('0xe'));var crypto=require(_0x8db3('0xf'));var jsforce=require(_0x8db3('0x10'));var deskjs=require(_0x8db3('0x11'));var toCsv=require(_0x8db3('0xb'));var querystring=require('querystring');var Papa=require(_0x8db3('0x12'));var Redis=require(_0x8db3('0x13'));var qs=require(_0x8db3('0x14'));var logger=require(_0x8db3('0x15'))(_0x8db3('0x16'));var utils=require(_0x8db3('0x17'));var config=require('../../config/environment');var db=require(_0x8db3('0x18'))['db'];config['redis']=_[_0x8db3('0x19')](config[_0x8db3('0x1a')],{'host':_0x8db3('0x1b'),'port':0x18eb});var socket=require(_0x8db3('0x1c'))(new Redis(config[_0x8db3('0x1a')]));require(_0x8db3('0x1d'))['register'](socket);var jayson=require(_0x8db3('0x1e'));var client=jayson[_0x8db3('0x1f')]['http']({'port':0x232c});var client9003=jayson['client'][_0x8db3('0x20')]({'port':0x232b});var client9002=jayson[_0x8db3('0x1f')][_0x8db3('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x46634a,_0x4f5024,_0x22fafc,_0x15f608){return new BPromise(function(_0xb452eb,_0x463806){var _0x427583=_0x15f608||client;return _0x427583[_0x8db3('0x21')](_0x46634a,_0x22fafc)[_0x8db3('0x22')](function(_0x4cca8c){logger[_0x8db3('0x23')](_0x8db3('0x24'),_0x4f5024,_0x8db3('0x25'));logger[_0x8db3('0x26')](_0x8db3('0x27'),_0x4f5024,_0x8db3('0x25'),JSON[_0x8db3('0x28')](_0x4cca8c));if(_0x4cca8c[_0x8db3('0x29')]){if(_0x4cca8c[_0x8db3('0x29')][_0x8db3('0x2a')]===0x1f4){logger[_0x8db3('0x29')]('MailMessage,\x20%s,\x20%s',_0x4f5024,_0x4cca8c['error'][_0x8db3('0x2b')]);return _0x463806(_0x4cca8c[_0x8db3('0x29')]['message']);}logger[_0x8db3('0x29')](_0x8db3('0x24'),_0x4f5024,_0x4cca8c[_0x8db3('0x29')][_0x8db3('0x2b')]);return _0xb452eb(_0x4cca8c['error'][_0x8db3('0x2b')]);}else{logger[_0x8db3('0x23')](_0x8db3('0x24'),_0x4f5024,_0x8db3('0x25'));_0xb452eb(_0x4cca8c[_0x8db3('0x2c')][_0x8db3('0x2b')]);}})[_0x8db3('0x2d')](function(_0xf6a443){logger[_0x8db3('0x29')]('MailMessage,\x20%s,\x20%s',_0x4f5024,_0xf6a443);_0x463806(_0xf6a443);});});}function respondWithStatusCode(_0x5274fc,_0xd841fe){_0xd841fe=_0xd841fe||0xcc;return function(_0x455b11){if(_0x455b11){return _0x5274fc[_0x8db3('0x2e')](_0xd841fe);}return _0x5274fc[_0x8db3('0x2f')](_0xd841fe)[_0x8db3('0x30')]();};}function respondWithResult(_0x66c33b,_0x4f9bf8){_0x4f9bf8=_0x4f9bf8||0xc8;return function(_0x5718be){if(_0x5718be){return _0x66c33b['status'](_0x4f9bf8)[_0x8db3('0x31')](_0x5718be);}};}function respondWithFilteredResult(_0x2a4dd9,_0x44c917){return function(_0x15506f){if(_0x15506f){var _0x4f20fb=_0x15506f['count'],_0x5d79e4=_0x44c917[_0x8db3('0x32')],_0x11c73c=_0x44c917[_0x8db3('0x32')]+_0x44c917[_0x8db3('0x33')],_0x49022a;if(_0x11c73c>=_0x4f20fb){_0x11c73c=_0x4f20fb;_0x49022a=0xc8;}else{_0x49022a=0xce;}_0x2a4dd9[_0x8db3('0x2f')](_0x49022a);return _0x2a4dd9[_0x8db3('0x34')](_0x8db3('0x35'),_0x5d79e4+'-'+_0x11c73c+'/'+_0x4f20fb)[_0x8db3('0x31')](_0x15506f);}return null;};}function patchUpdates(_0x1d055a){return function(_0x3ad95e){try{jsonpatch['apply'](_0x3ad95e,_0x1d055a,!![]);}catch(_0x33555a){return BPromise['reject'](_0x33555a);}return _0x3ad95e[_0x8db3('0x36')]();};}function saveUpdates(_0x43450c,_0x2cb7a5){return function(_0x589af3){if(_0x589af3){return _0x589af3[_0x8db3('0x37')](_0x43450c)['then'](function(_0xa7dc88){return _0xa7dc88;});}return null;};}function removeEntity(_0x1856a2,_0x29f678){return function(_0x3b0e6b){if(_0x3b0e6b){return _0x3b0e6b[_0x8db3('0x38')]()[_0x8db3('0x22')](function(){_0x1856a2['status'](0xcc)[_0x8db3('0x30')]();});}};}function handleEntityNotFound(_0x5a80b6,_0x1eeae1){return function(_0x74a9ae){if(!_0x74a9ae){_0x5a80b6[_0x8db3('0x2e')](0x194);}return _0x74a9ae;};}function handleError(_0x38e4b4,_0x452e33){_0x452e33=_0x452e33||0x1f4;return function(_0x2e8c66){logger['error'](_0x2e8c66[_0x8db3('0x39')]);if(_0x2e8c66[_0x8db3('0x3a')]){delete _0x2e8c66['name'];}_0x38e4b4['status'](_0x452e33)[_0x8db3('0x3b')](_0x2e8c66);};}exports['index']=function(_0x4cc379,_0x2ae447){var _0x53dbf3={},_0x3a0418={},_0x2df166={'count':0x0,'rows':[]};var _0x157abd=db[_0x8db3('0x3c')]['rawAttributes'];_0x3a0418[_0x8db3('0x3d')]=_[_0x8db3('0x3e')](_0x157abd);var _0x4c6bb0={'dateStart':_0x4cc379['query'][_0x8db3('0x3f')],'dateEnd':_0x4cc379[_0x8db3('0x40')][_0x8db3('0x41')]};delete _0x4cc379[_0x8db3('0x40')][_0x8db3('0x3f')];delete _0x4cc379[_0x8db3('0x40')][_0x8db3('0x41')];_0x3a0418[_0x8db3('0x40')]=_[_0x8db3('0x3e')](_0x4cc379['query']);_0x3a0418[_0x8db3('0x42')]=_[_0x8db3('0x43')](_0x3a0418['model'],_0x3a0418[_0x8db3('0x40')]);_0x53dbf3['attributes']=_['intersection'](_0x3a0418['model'],qs['fields'](_0x4cc379[_0x8db3('0x40')][_0x8db3('0x44')]));_0x53dbf3['attributes']=_0x53dbf3[_0x8db3('0x45')][_0x8db3('0x46')]?_0x53dbf3[_0x8db3('0x45')]:_0x3a0418[_0x8db3('0x3d')];if(!_0x4cc379[_0x8db3('0x40')][_0x8db3('0x47')]('nolimit')){_0x53dbf3[_0x8db3('0x33')]=qs[_0x8db3('0x33')](_0x4cc379['query'][_0x8db3('0x33')]);_0x53dbf3['offset']=qs[_0x8db3('0x32')](_0x4cc379[_0x8db3('0x40')]['offset']);}_0x53dbf3[_0x8db3('0x48')]=qs['sort'](_0x4cc379['query'][_0x8db3('0x49')]);_0x53dbf3['where']=qs[_0x8db3('0x42')](_[_0x8db3('0x4a')](_0x4cc379[_0x8db3('0x40')],_0x3a0418[_0x8db3('0x42')]));if(_0x4c6bb0[_0x8db3('0x3f')]){if(_0x4c6bb0['dateEnd']){_0x4c6bb0['dateEnd']=moment(_0x4c6bb0['dateEnd'])[_0x8db3('0x4b')](0x1,_0x8db3('0x4c'));}else{_0x4c6bb0[_0x8db3('0x41')]=moment(_0x4c6bb0['dateStart'])[_0x8db3('0x4b')](0x1,_0x8db3('0x4c'));}_[_0x8db3('0x4d')](_0x53dbf3[_0x8db3('0x4e')],{'createdAt':{'$gte':_0x4c6bb0[_0x8db3('0x3f')],'$lte':_0x4c6bb0[_0x8db3('0x41')]}});}if(_0x4cc379['query'][_0x8db3('0x4f')]){_0x53dbf3[_0x8db3('0x4e')]=_[_0x8db3('0x4d')](_0x53dbf3['where'],{'$or':_[_0x8db3('0x50')](_0x53dbf3[_0x8db3('0x45')],function(_0x35d03b){var _0x32bfa3={};_0x32bfa3[_0x35d03b]={'$like':'%'+_0x4cc379[_0x8db3('0x40')][_0x8db3('0x4f')]+'%'};return _0x32bfa3;})});}_0x53dbf3=_['merge']({},_0x53dbf3,_0x4cc379['options']);var _0x441440={'where':_0x53dbf3['where']};return db[_0x8db3('0x3c')][_0x8db3('0x51')](_0x441440)['then'](function(_0x175ba9){_0x2df166['count']=_0x175ba9;if(_0x4cc379['query'][_0x8db3('0x52')]){_0x53dbf3[_0x8db3('0x53')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x53dbf3);})[_0x8db3('0x22')](function(_0x37f407){_0x2df166['rows']=_0x37f407;return _0x2df166;})[_0x8db3('0x22')](respondWithFilteredResult(_0x2ae447,_0x53dbf3))[_0x8db3('0x2d')](handleError(_0x2ae447,null));};exports[_0x8db3('0x54')]=function(_0x28ca44,_0x23a9d0){var _0x62f7bf={'raw':!![],'where':{'id':_0x28ca44[_0x8db3('0x55')]['id']}},_0x943c3b={};_0x943c3b[_0x8db3('0x3d')]=_[_0x8db3('0x3e')](db['MailMessage'][_0x8db3('0x56')]);_0x943c3b['query']=_[_0x8db3('0x3e')](_0x28ca44[_0x8db3('0x40')]);_0x943c3b[_0x8db3('0x42')]=_[_0x8db3('0x43')](_0x943c3b[_0x8db3('0x3d')],_0x943c3b[_0x8db3('0x40')]);_0x62f7bf['attributes']=_[_0x8db3('0x43')](_0x943c3b[_0x8db3('0x3d')],qs[_0x8db3('0x44')](_0x28ca44[_0x8db3('0x40')][_0x8db3('0x44')]));_0x62f7bf['attributes']=_0x62f7bf[_0x8db3('0x45')][_0x8db3('0x46')]?_0x62f7bf[_0x8db3('0x45')]:_0x943c3b[_0x8db3('0x3d')];if(_0x28ca44['query'][_0x8db3('0x52')]){_0x62f7bf[_0x8db3('0x53')]=[{'all':!![]}];}_0x62f7bf=_[_0x8db3('0x4d')]({},_0x62f7bf,_0x28ca44[_0x8db3('0x57')]);return db['MailMessage'][_0x8db3('0x58')](_0x62f7bf)['then'](handleEntityNotFound(_0x23a9d0,null))['then'](respondWithResult(_0x23a9d0,null))['catch'](handleError(_0x23a9d0,null));};exports['update']=function(_0x7d7e49,_0x2dc3d9){if(_0x7d7e49[_0x8db3('0x59')]['id']){delete _0x7d7e49[_0x8db3('0x59')]['id'];}return db['MailMessage'][_0x8db3('0x58')]({'where':{'id':_0x7d7e49[_0x8db3('0x55')]['id']}})[_0x8db3('0x22')](handleEntityNotFound(_0x2dc3d9,null))[_0x8db3('0x22')](saveUpdates(_0x7d7e49[_0x8db3('0x59')],null))[_0x8db3('0x22')](respondWithResult(_0x2dc3d9,null))[_0x8db3('0x2d')](handleError(_0x2dc3d9,null));};exports['destroy']=function(_0x58821f,_0x518eb6){return db['MailMessage']['find']({'where':{'id':_0x58821f[_0x8db3('0x55')]['id']}})[_0x8db3('0x22')](handleEntityNotFound(_0x518eb6,null))[_0x8db3('0x22')](removeEntity(_0x518eb6,null))['catch'](handleError(_0x518eb6,null));};exports['describe']=function(_0x39645d,_0x3e549c){return db[_0x8db3('0x3c')][_0x8db3('0x5a')]()[_0x8db3('0x22')](respondWithResult(_0x3e549c,null))[_0x8db3('0x2d')](handleError(_0x3e549c,null));};exports[_0x8db3('0x5b')]=function(_0x2c8b58,_0x222a4c){return db[_0x8db3('0x3c')]['create'](_0x2c8b58[_0x8db3('0x59')])[_0x8db3('0x22')](function(_0x50e1b6){if(_0x50e1b6){if(_0x50e1b6[_0x8db3('0x5c')]===_0x8db3('0x5d')&&!_0x50e1b6['secret']){return db[_0x8db3('0x5e')][_0x8db3('0x5f')]({'where':{'id':_0x50e1b6[_0x8db3('0x60')]},'include':[{'model':db[_0x8db3('0x61')],'as':_0x8db3('0x62'),'raw':!![]}]})[_0x8db3('0x22')](function(_0x36c756){if(_0x36c756&&_0x36c756['Smtp']){var _0x5cd4f1={'tls':{'rejectUnauthorized':![]}};if(_[_0x8db3('0x63')](_0x36c756['Smtp']['service'])){_0x5cd4f1[_0x8db3('0x64')]=_0x36c756[_0x8db3('0x62')][_0x8db3('0x64')];_0x5cd4f1[_0x8db3('0x65')]=_0x36c756['Smtp'][_0x8db3('0x65')];_0x5cd4f1[_0x8db3('0x66')]=_0x36c756['Smtp'][_0x8db3('0x66')];if(_0x36c756[_0x8db3('0x62')][_0x8db3('0x67')]){_0x5cd4f1['auth']={'user':_0x36c756[_0x8db3('0x62')][_0x8db3('0x68')],'pass':_0x36c756[_0x8db3('0x62')]['pass']};}}else{_0x5cd4f1[_0x8db3('0x69')]=_0x36c756[_0x8db3('0x62')][_0x8db3('0x69')];_0x5cd4f1['auth']={'user':_0x36c756[_0x8db3('0x62')][_0x8db3('0x68')],'pass':_0x36c756[_0x8db3('0x62')][_0x8db3('0x6a')]};_0x5cd4f1[_0x8db3('0x66')]=_0x36c756[_0x8db3('0x62')][_0x8db3('0x66')];}if(_0x2c8b58[_0x8db3('0x59')]['attachments']&&_0x2c8b58[_0x8db3('0x59')]['attachments'][_0x8db3('0x46')]){for(var _0x1d32f0=0x0;_0x1d32f0<_0x2c8b58[_0x8db3('0x59')][_0x8db3('0x6b')][_0x8db3('0x46')];_0x1d32f0+=0x1){_0x2c8b58[_0x8db3('0x59')][_0x8db3('0x6b')][_0x1d32f0]={'filename':_0x2c8b58[_0x8db3('0x59')]['attachments'][_0x1d32f0][_0x8db3('0x3a')],'path':path[_0x8db3('0x6c')](config['root'],_0x8db3('0x6d'),_0x2c8b58[_0x8db3('0x59')][_0x8db3('0x6b')][_0x1d32f0][_0x8db3('0x6e')])};}}return{'account':_0x5cd4f1,'message':_0x2c8b58[_0x8db3('0x59')]};}})[_0x8db3('0x22')](function(_0xd64bab){if(_0xd64bab){return respondWithRpcPromise(_0x8db3('0x6f'),_0x8db3('0x70'),_0xd64bab,client9003)[_0x8db3('0x22')](function(_0x126678){return _0x50e1b6['update']({'read':!![],'messageId':_0x126678[_0x8db3('0x71')],'sentAt':moment()['format'](_0x8db3('0x72'))});})['catch'](function(_0x1ead00){logger[_0x8db3('0x29')]('%s',JSON[_0x8db3('0x28')](_0x1ead00));return _0x50e1b6;});}return _0x50e1b6;});}return _0x50e1b6;}})['then'](respondWithResult(_0x222a4c,0xc9))[_0x8db3('0x2d')](handleError(_0x222a4c,null));};var interaction_log=require('../../config/logger')('mail-interactions');exports['accept']=function(_0x4e36fa,_0x5635e9,_0x357d5e){var _0x3a5251={'channel':_0x8db3('0x73')};if(_0x4e36fa[_0x8db3('0x59')]['id']){delete _0x4e36fa[_0x8db3('0x59')]['id'];}_0x4e36fa['body'][_0x8db3('0x74')]=!![];_0x4e36fa[_0x8db3('0x59')][_0x8db3('0x75')]=moment()[_0x8db3('0x76')](_0x8db3('0x72'));_0x4e36fa[_0x8db3('0x59')][_0x8db3('0x77')]=_0x4e36fa['body'][_0x8db3('0x77')]||_0x4e36fa['user']['id'];return db['MailMessage'][_0x8db3('0x58')]({'where':{'id':_0x4e36fa[_0x8db3('0x55')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x8db3('0x78')}]})[_0x8db3('0x22')](handleEntityNotFound(_0x5635e9,null))[_0x8db3('0x22')](saveUpdates(_0x4e36fa['body'],null))[_0x8db3('0x22')](function(_0x4c21df){if(_0x4c21df){_0x3a5251['message']=_0x4c21df['get']({'plain':!![]});return db[_0x8db3('0x79')][_0x8db3('0x58')]({'where':{'id':_0x4c21df[_0x8db3('0x7a')]}});}return null;})[_0x8db3('0x22')](handleEntityNotFound(_0x5635e9,null))['then'](function(_0xaba88e){if(_0xaba88e){return _0xaba88e['update']({'UserId':_0x4e36fa[_0x8db3('0x59')][_0x8db3('0x77')],'read1stAt':_[_0x8db3('0x63')](_0xaba88e[_0x8db3('0x7b')])?moment()[_0x8db3('0x76')](_0x8db3('0x72')):undefined});}return null;})['then'](function(_0x286f1e){if(_0x286f1e){_0x3a5251[_0x8db3('0x7c')]=_0x286f1e[_0x8db3('0x7d')]({'plain':!![]});interaction_log[_0x8db3('0x23')](_0x8db3('0x7e'),_0x4e36fa[_0x8db3('0x68')]['id'],_0x4e36fa['user']['name'],_0x4e36fa[_0x8db3('0x68')][_0x8db3('0x7f')],_0x3a5251[_0x8db3('0x7c')]['id'],_0x4e36fa[_0x8db3('0x59')]?JSON[_0x8db3('0x28')](_0x4e36fa[_0x8db3('0x59')]):_0x8db3('0x80'));return respondWithRpcPromise(_0x8db3('0x81'),_0x8db3('0x82'),_0x3a5251);}return null;})['then'](function(_0x2ae65f){if(_0x2ae65f){if(_0x4e36fa[_0x8db3('0x59')]['manual']){_0x3a5251['message'][_0x8db3('0x83')]=util[_0x8db3('0x76')](_0x8db3('0x84'),_0x4e36fa['user'][_0x8db3('0x3a')]);_0x3a5251[_0x8db3('0x2b')]['channel']=_0x3a5251['channel'];_0x3a5251[_0x8db3('0x2b')]['event']=_0x8db3('0x85');return respondWithRpcPromise(_0x8db3('0x86'),_0x8db3('0x86'),{'event':'acceptmessage','message':_0x3a5251[_0x8db3('0x2b')]},client9002)[_0x8db3('0x22')](function(){return _0x3a5251;});}return _0x3a5251;}return null;})['then'](respondWithResult(_0x5635e9,null))[_0x8db3('0x2d')](handleError(_0x5635e9,null));};var interaction_log=require(_0x8db3('0x15'))('mail-interactions');exports['reject']=function(_0x1d385c,_0x51ef04,_0x4bc8e2){var _0x186a93={'agent':{},'channel':_0x8db3('0x73')};if(_0x1d385c[_0x8db3('0x59')]['id']){delete _0x1d385c[_0x8db3('0x59')]['id'];}_0x1d385c[_0x8db3('0x59')]['UserId']=_0x1d385c[_0x8db3('0x59')][_0x8db3('0x77')]||_0x1d385c[_0x8db3('0x68')]['id'];_0x186a93[_0x8db3('0x87')]['id']=_0x1d385c[_0x8db3('0x59')]['UserId'];return db[_0x8db3('0x3c')][_0x8db3('0x58')]({'where':{'id':_0x1d385c[_0x8db3('0x55')]['id'],'UserId':null}})[_0x8db3('0x22')](handleEntityNotFound(_0x51ef04,null))[_0x8db3('0x22')](function(_0x3cd0ca){if(_0x3cd0ca){_0x186a93[_0x8db3('0x2b')]=_0x3cd0ca[_0x8db3('0x7d')]({'plain':!![]});return db[_0x8db3('0x79')]['find']({'where':{'id':_0x3cd0ca[_0x8db3('0x7a')]}});}return null;})[_0x8db3('0x22')](handleEntityNotFound(_0x51ef04,null))[_0x8db3('0x22')](function(_0x16bae7){if(_0x16bae7){_0x186a93[_0x8db3('0x7c')]=_0x16bae7['get']({'plain':!![]});interaction_log[_0x8db3('0x23')](_0x8db3('0x88'),_0x1d385c[_0x8db3('0x68')]['id'],_0x1d385c[_0x8db3('0x68')][_0x8db3('0x3a')],_0x1d385c['user'][_0x8db3('0x7f')],_0x186a93['interaction']['id'],_0x1d385c['body']?JSON[_0x8db3('0x28')](_0x1d385c[_0x8db3('0x59')]):_0x8db3('0x80'));return respondWithRpcPromise(_0x8db3('0x89'),'rejectMessage',_0x186a93);}return null;})['then'](function(_0x42c1b1){if(_0x42c1b1){_0x42c1b1[_0x8db3('0x2b')]['interface']=util[_0x8db3('0x76')](_0x8db3('0x84'),_0x1d385c[_0x8db3('0x68')][_0x8db3('0x3a')]);_0x42c1b1[_0x8db3('0x2b')][_0x8db3('0x8a')]=_0x186a93[_0x8db3('0x8a')];_0x42c1b1[_0x8db3('0x2b')][_0x8db3('0x8b')]='reject';respondWithRpcPromise('EventManager',_0x8db3('0x86'),{'event':'rejectmessage','message':_0x42c1b1[_0x8db3('0x2b')]},client9002);return _0x186a93;}return null;})['then'](respondWithResult(_0x51ef04,null))[_0x8db3('0x2d')](handleError(_0x51ef04,null));};exports[_0x8db3('0x8c')]=function(_0x40b48d,_0x19a90c){var _0x1f62a2=moment()[_0x8db3('0x8d')]()[_0x8db3('0x8e')]();var _0x4a9c84=path[_0x8db3('0x6c')](config['root'],_0x8db3('0x8f'),_0x8db3('0x90'),'tmp');var _0x1629ba=path[_0x8db3('0x6c')](config['root'],_0x8db3('0x8f'),_0x8db3('0x90'),_0x8db3('0x6b'));var _0x395b90=util[_0x8db3('0x76')](_0x8db3('0x91'),_0x1f62a2);return db[_0x8db3('0x3c')][_0x8db3('0x58')]({'where':{'id':_0x40b48d['params']['id']},'attributes':['id','body',_0x8db3('0x92'),'to','cc',_0x8db3('0x93'),'createdAt'],'include':_0x40b48d[_0x8db3('0x40')][_0x8db3('0x6b')]?[{'model':db[_0x8db3('0x94')],'as':'Attachments'}]:undefined})[_0x8db3('0x22')](handleEntityNotFound(_0x19a90c,null))[_0x8db3('0x22')](function(_0x1d738d){if(_0x1d738d){var _0x264e5e=_0x1d738d;var _0x6db0a6={'from':_0x264e5e[_0x8db3('0x92')],'to':_0x264e5e['to'],'subject':_0x264e5e[_0x8db3('0x93')],'html':_0x264e5e['body'],'attachments':[]};return new BPromise(function(_0x3db440,_0x2b08ff){if(_0x1d738d[_0x8db3('0x95')]){for(var _0x425577=0x0;_0x425577<_0x1d738d[_0x8db3('0x95')][_0x8db3('0x46')];_0x425577++){var _0x3a906e=_0x1d738d[_0x8db3('0x95')][_0x425577];var _0x3aa8ef=path[_0x8db3('0x6c')](_0x1629ba,_0x3a906e[_0x8db3('0x6e')]);if(fs[_0x8db3('0x96')](_0x3aa8ef)){_0x6db0a6[_0x8db3('0x6b')]['push']({'name':_0x3a906e[_0x8db3('0x3a')],'contentType':_0x3a906e['type'],'data':fs['readFileSync'](_0x3aa8ef)});}}}emlformat[_0x8db3('0x97')](_0x6db0a6,function(_0x3e5060,_0x675665){if(_0x3e5060)return _0x2b08ff(_0x3e5060);fs['writeFileSync'](path[_0x8db3('0x6c')](_0x4a9c84,_0x395b90),_0x675665);return _0x3db440(_0x675665);});});}})[_0x8db3('0x22')](function(_0x34d520){if(_0x34d520){return _0x19a90c['download'](path[_0x8db3('0x6c')](_0x4a9c84,_0x395b90),_0x395b90,function(_0x22a84a){if(_0x22a84a){console['log'](_0x8db3('0x98'),_0x22a84a);}else{fs[_0x8db3('0x99')](path[_0x8db3('0x6c')](_0x4a9c84,_0x395b90));}});}})[_0x8db3('0x2d')](handleError(_0x19a90c,null));}; \ No newline at end of file +var _0x8430=['MailServerOut','Smtp','isNil','service','host','port','secure','authentication','pass','auth','user','attachments','join','root','server/files/attachments','basename','SendMail','format','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','read','readAt','UserId','CmContact','Contact','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','mail','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','rejectmessage','download','toString','server','tmp','subject','createdAt','Attachment','Attachments','existsSync','push','type','readFileSync','build','writeFileSync','log','err','unlinkSync','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','jayson/promise','http','client','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','status','json','count','offset','limit','set','reject','save','update','destroy','end','stack','name','index','MailMessage','query','dateStart','dateEnd','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','sort','pick','day','add','merge','where','map','includeAll','include','rows','catch','show','rawAttributes','find','body','params','describe','create','direction','out','findOne'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x8430,0xd7));var _0x0843=function(_0x1b98b4,_0xb1826a){_0x1b98b4=_0x1b98b4-0x0;var _0x448bb3=_0x8430[_0x1b98b4];return _0x448bb3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0843('0x0'));var rimraf=require(_0x0843('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0843('0x2'));var rp=require('request-promise');var moment=require(_0x0843('0x3'));var BPromise=require(_0x0843('0x4'));var Mustache=require(_0x0843('0x5'));var util=require('util');var path=require(_0x0843('0x6'));var sox=require('sox');var csv=require(_0x0843('0x7'));var ejs=require(_0x0843('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0843('0x9'));var crypto=require(_0x0843('0xa'));var jsforce=require(_0x0843('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0843('0x7'));var querystring=require(_0x0843('0xc'));var Papa=require(_0x0843('0xd'));var Redis=require('ioredis');var qs=require(_0x0843('0xe'));var logger=require(_0x0843('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x0843('0x10'));var db=require(_0x0843('0x11'))['db'];config[_0x0843('0x12')]=_[_0x0843('0x13')](config[_0x0843('0x12')],{'host':_0x0843('0x14'),'port':0x18eb});var socket=require(_0x0843('0x15'))(new Redis(config[_0x0843('0x12')]));require(_0x0843('0x16'))['register'](socket);var jayson=require(_0x0843('0x17'));var client=jayson['client'][_0x0843('0x18')]({'port':0x232c});var client9003=jayson[_0x0843('0x19')][_0x0843('0x18')]({'port':0x232b});var client9002=jayson['client'][_0x0843('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x2ee23a,_0x294b71,_0x1509db,_0x49b70d){return new BPromise(function(_0x4cb32d,_0x89e057){var _0x522c56=_0x49b70d||client;return _0x522c56['request'](_0x2ee23a,_0x1509db)[_0x0843('0x1a')](function(_0x23a357){logger[_0x0843('0x1b')](_0x0843('0x1c'),_0x294b71,_0x0843('0x1d'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x294b71,_0x0843('0x1d'),JSON['stringify'](_0x23a357));if(_0x23a357[_0x0843('0x1e')]){if(_0x23a357[_0x0843('0x1e')][_0x0843('0x1f')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x294b71,_0x23a357[_0x0843('0x1e')][_0x0843('0x20')]);return _0x89e057(_0x23a357['error'][_0x0843('0x20')]);}logger['error'](_0x0843('0x1c'),_0x294b71,_0x23a357[_0x0843('0x1e')][_0x0843('0x20')]);return _0x4cb32d(_0x23a357[_0x0843('0x1e')][_0x0843('0x20')]);}else{logger[_0x0843('0x1b')](_0x0843('0x1c'),_0x294b71,'request\x20sent');_0x4cb32d(_0x23a357[_0x0843('0x21')][_0x0843('0x20')]);}})['catch'](function(_0x2e18cd){logger[_0x0843('0x1e')](_0x0843('0x1c'),_0x294b71,_0x2e18cd);_0x89e057(_0x2e18cd);});});}function respondWithStatusCode(_0x4d04b2,_0x40567f){_0x40567f=_0x40567f||0xcc;return function(_0x36ca1a){if(_0x36ca1a){return _0x4d04b2['sendStatus'](_0x40567f);}return _0x4d04b2['status'](_0x40567f)['end']();};}function respondWithResult(_0x16288a,_0x4ff704){_0x4ff704=_0x4ff704||0xc8;return function(_0x20c6a7){if(_0x20c6a7){return _0x16288a[_0x0843('0x22')](_0x4ff704)[_0x0843('0x23')](_0x20c6a7);}};}function respondWithFilteredResult(_0x826942,_0x2ca4fa){return function(_0x13f0d9){if(_0x13f0d9){var _0xf889c4=_0x13f0d9[_0x0843('0x24')],_0x653dc6=_0x2ca4fa[_0x0843('0x25')],_0x28d727=_0x2ca4fa[_0x0843('0x25')]+_0x2ca4fa[_0x0843('0x26')],_0x5c81ea;if(_0x28d727>=_0xf889c4){_0x28d727=_0xf889c4;_0x5c81ea=0xc8;}else{_0x5c81ea=0xce;}_0x826942[_0x0843('0x22')](_0x5c81ea);return _0x826942[_0x0843('0x27')]('Content-Range',_0x653dc6+'-'+_0x28d727+'/'+_0xf889c4)[_0x0843('0x23')](_0x13f0d9);}return null;};}function patchUpdates(_0x28aeef){return function(_0x52fca3){try{jsonpatch['apply'](_0x52fca3,_0x28aeef,!![]);}catch(_0x45b5c7){return BPromise[_0x0843('0x28')](_0x45b5c7);}return _0x52fca3[_0x0843('0x29')]();};}function saveUpdates(_0x1017f0,_0x55519c){return function(_0x94461b){if(_0x94461b){return _0x94461b[_0x0843('0x2a')](_0x1017f0)[_0x0843('0x1a')](function(_0x1fa4eb){return _0x1fa4eb;});}return null;};}function removeEntity(_0x1904d4,_0x382eb4){return function(_0x5a6309){if(_0x5a6309){return _0x5a6309[_0x0843('0x2b')]()[_0x0843('0x1a')](function(){_0x1904d4[_0x0843('0x22')](0xcc)[_0x0843('0x2c')]();});}};}function handleEntityNotFound(_0x20b53a,_0x2e61e1){return function(_0x33e0b2){if(!_0x33e0b2){_0x20b53a['sendStatus'](0x194);}return _0x33e0b2;};}function handleError(_0x17e189,_0x2904d1){_0x2904d1=_0x2904d1||0x1f4;return function(_0x344e22){logger['error'](_0x344e22[_0x0843('0x2d')]);if(_0x344e22[_0x0843('0x2e')]){delete _0x344e22[_0x0843('0x2e')];}_0x17e189[_0x0843('0x22')](_0x2904d1)['send'](_0x344e22);};}exports[_0x0843('0x2f')]=function(_0x556838,_0x1fbf51){var _0x2001c4={},_0x537b55={},_0x535a42={'count':0x0,'rows':[]};var _0x3aafd4=db[_0x0843('0x30')]['rawAttributes'];_0x537b55['model']=_['keys'](_0x3aafd4);var _0x5cacfe={'dateStart':_0x556838[_0x0843('0x31')]['dateStart'],'dateEnd':_0x556838[_0x0843('0x31')]['dateEnd']};delete _0x556838[_0x0843('0x31')][_0x0843('0x32')];delete _0x556838[_0x0843('0x31')][_0x0843('0x33')];_0x537b55['query']=_[_0x0843('0x34')](_0x556838[_0x0843('0x31')]);_0x537b55[_0x0843('0x35')]=_['intersection'](_0x537b55['model'],_0x537b55[_0x0843('0x31')]);_0x2001c4[_0x0843('0x36')]=_[_0x0843('0x37')](_0x537b55[_0x0843('0x38')],qs['fields'](_0x556838[_0x0843('0x31')][_0x0843('0x39')]));_0x2001c4[_0x0843('0x36')]=_0x2001c4[_0x0843('0x36')][_0x0843('0x3a')]?_0x2001c4[_0x0843('0x36')]:_0x537b55['model'];if(!_0x556838[_0x0843('0x31')][_0x0843('0x3b')]('nolimit')){_0x2001c4['limit']=qs[_0x0843('0x26')](_0x556838[_0x0843('0x31')][_0x0843('0x26')]);_0x2001c4[_0x0843('0x25')]=qs[_0x0843('0x25')](_0x556838[_0x0843('0x31')]['offset']);}_0x2001c4['order']=qs[_0x0843('0x3c')](_0x556838[_0x0843('0x31')][_0x0843('0x3c')]);_0x2001c4['where']=qs[_0x0843('0x35')](_[_0x0843('0x3d')](_0x556838[_0x0843('0x31')],_0x537b55[_0x0843('0x35')]));if(_0x5cacfe[_0x0843('0x32')]){if(_0x5cacfe[_0x0843('0x33')]){_0x5cacfe['dateEnd']=moment(_0x5cacfe['dateEnd'])['add'](0x1,_0x0843('0x3e'));}else{_0x5cacfe[_0x0843('0x33')]=moment(_0x5cacfe[_0x0843('0x32')])[_0x0843('0x3f')](0x1,_0x0843('0x3e'));}_[_0x0843('0x40')](_0x2001c4[_0x0843('0x41')],{'createdAt':{'$gte':_0x5cacfe[_0x0843('0x32')],'$lte':_0x5cacfe[_0x0843('0x33')]}});}if(_0x556838[_0x0843('0x31')]['filter']){_0x2001c4[_0x0843('0x41')]=_['merge'](_0x2001c4['where'],{'$or':_[_0x0843('0x42')](_0x2001c4[_0x0843('0x36')],function(_0x407bf6){var _0x30132a={};_0x30132a[_0x407bf6]={'$like':'%'+_0x556838[_0x0843('0x31')]['filter']+'%'};return _0x30132a;})});}_0x2001c4=_[_0x0843('0x40')]({},_0x2001c4,_0x556838['options']);var _0x1ee6fb={'where':_0x2001c4[_0x0843('0x41')]};return db[_0x0843('0x30')]['count'](_0x1ee6fb)[_0x0843('0x1a')](function(_0x12c9bc){_0x535a42['count']=_0x12c9bc;if(_0x556838[_0x0843('0x31')][_0x0843('0x43')]){_0x2001c4[_0x0843('0x44')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x2001c4);})[_0x0843('0x1a')](function(_0x21b516){_0x535a42[_0x0843('0x45')]=_0x21b516;return _0x535a42;})['then'](respondWithFilteredResult(_0x1fbf51,_0x2001c4))[_0x0843('0x46')](handleError(_0x1fbf51,null));};exports[_0x0843('0x47')]=function(_0x5a43e9,_0x36d1a6){var _0x29c191={'raw':!![],'where':{'id':_0x5a43e9['params']['id']}},_0x1e4618={};_0x1e4618[_0x0843('0x38')]=_[_0x0843('0x34')](db['MailMessage'][_0x0843('0x48')]);_0x1e4618[_0x0843('0x31')]=_[_0x0843('0x34')](_0x5a43e9[_0x0843('0x31')]);_0x1e4618[_0x0843('0x35')]=_[_0x0843('0x37')](_0x1e4618[_0x0843('0x38')],_0x1e4618['query']);_0x29c191[_0x0843('0x36')]=_[_0x0843('0x37')](_0x1e4618[_0x0843('0x38')],qs['fields'](_0x5a43e9[_0x0843('0x31')]['fields']));_0x29c191[_0x0843('0x36')]=_0x29c191[_0x0843('0x36')]['length']?_0x29c191[_0x0843('0x36')]:_0x1e4618[_0x0843('0x38')];if(_0x5a43e9[_0x0843('0x31')]['includeAll']){_0x29c191[_0x0843('0x44')]=[{'all':!![]}];}_0x29c191=_[_0x0843('0x40')]({},_0x29c191,_0x5a43e9['options']);return db[_0x0843('0x30')][_0x0843('0x49')](_0x29c191)[_0x0843('0x1a')](handleEntityNotFound(_0x36d1a6,null))['then'](respondWithResult(_0x36d1a6,null))['catch'](handleError(_0x36d1a6,null));};exports[_0x0843('0x2a')]=function(_0x1cc965,_0x33fdae){if(_0x1cc965[_0x0843('0x4a')]['id']){delete _0x1cc965[_0x0843('0x4a')]['id'];}return db[_0x0843('0x30')]['find']({'where':{'id':_0x1cc965[_0x0843('0x4b')]['id']}})[_0x0843('0x1a')](handleEntityNotFound(_0x33fdae,null))[_0x0843('0x1a')](saveUpdates(_0x1cc965[_0x0843('0x4a')],null))['then'](respondWithResult(_0x33fdae,null))['catch'](handleError(_0x33fdae,null));};exports['destroy']=function(_0x5ebfea,_0x438f73){return db[_0x0843('0x30')][_0x0843('0x49')]({'where':{'id':_0x5ebfea[_0x0843('0x4b')]['id']}})['then'](handleEntityNotFound(_0x438f73,null))[_0x0843('0x1a')](removeEntity(_0x438f73,null))[_0x0843('0x46')](handleError(_0x438f73,null));};exports[_0x0843('0x4c')]=function(_0x4b26fb,_0x184d71){return db[_0x0843('0x30')][_0x0843('0x4c')]()[_0x0843('0x1a')](respondWithResult(_0x184d71,null))[_0x0843('0x46')](handleError(_0x184d71,null));};exports[_0x0843('0x4d')]=function(_0x493cdb,_0x49dcc0){return db[_0x0843('0x30')]['create'](_0x493cdb[_0x0843('0x4a')])[_0x0843('0x1a')](function(_0x29da90){if(_0x29da90){if(_0x29da90[_0x0843('0x4e')]===_0x0843('0x4f')&&!_0x29da90['secret']){return db['MailAccount'][_0x0843('0x50')]({'where':{'id':_0x29da90['MailAccountId']},'include':[{'model':db[_0x0843('0x51')],'as':_0x0843('0x52'),'raw':!![]}]})[_0x0843('0x1a')](function(_0x1ab920){if(_0x1ab920&&_0x1ab920[_0x0843('0x52')]){var _0x338486={'tls':{'rejectUnauthorized':![]}};if(_[_0x0843('0x53')](_0x1ab920['Smtp'][_0x0843('0x54')])){_0x338486[_0x0843('0x55')]=_0x1ab920[_0x0843('0x52')][_0x0843('0x55')];_0x338486[_0x0843('0x56')]=_0x1ab920['Smtp'][_0x0843('0x56')];_0x338486[_0x0843('0x57')]=_0x1ab920[_0x0843('0x52')][_0x0843('0x57')];if(_0x1ab920[_0x0843('0x52')][_0x0843('0x58')]){_0x338486['auth']={'user':_0x1ab920[_0x0843('0x52')]['user'],'pass':_0x1ab920[_0x0843('0x52')][_0x0843('0x59')]};}}else{_0x338486['service']=_0x1ab920[_0x0843('0x52')][_0x0843('0x54')];_0x338486[_0x0843('0x5a')]={'user':_0x1ab920[_0x0843('0x52')][_0x0843('0x5b')],'pass':_0x1ab920[_0x0843('0x52')]['pass']};_0x338486['secure']=_0x1ab920[_0x0843('0x52')][_0x0843('0x57')];}if(_0x493cdb[_0x0843('0x4a')]['attachments']&&_0x493cdb[_0x0843('0x4a')]['attachments'][_0x0843('0x3a')]){for(var _0x49b534=0x0;_0x49b534<_0x493cdb[_0x0843('0x4a')]['attachments']['length'];_0x49b534+=0x1){_0x493cdb['body'][_0x0843('0x5c')][_0x49b534]={'filename':_0x493cdb[_0x0843('0x4a')][_0x0843('0x5c')][_0x49b534][_0x0843('0x2e')],'path':path[_0x0843('0x5d')](config[_0x0843('0x5e')],_0x0843('0x5f'),_0x493cdb[_0x0843('0x4a')][_0x0843('0x5c')][_0x49b534][_0x0843('0x60')])};}}return{'account':_0x338486,'message':_0x493cdb[_0x0843('0x4a')]};}})[_0x0843('0x1a')](function(_0x2e366c){if(_0x2e366c){return respondWithRpcPromise(_0x0843('0x61'),'sendMail',_0x2e366c,client9003)['then'](function(_0x2e4c01){return _0x29da90['update']({'read':!![],'messageId':_0x2e4c01['messageId'],'sentAt':moment()[_0x0843('0x62')](_0x0843('0x63'))});})[_0x0843('0x46')](function(_0x45cb78){logger['error']('%s',JSON['stringify'](_0x45cb78));return _0x29da90;});}return _0x29da90;});}return _0x29da90;}})[_0x0843('0x1a')](respondWithResult(_0x49dcc0,0xc9))['catch'](handleError(_0x49dcc0,null));};var interaction_log=require(_0x0843('0xf'))(_0x0843('0x64'));exports[_0x0843('0x65')]=function(_0x285552,_0x119c26,_0x50d851){var _0x2bfae6={'channel':'mail'};if(_0x285552[_0x0843('0x4a')]['id']){delete _0x285552[_0x0843('0x4a')]['id'];}_0x285552['body'][_0x0843('0x66')]=!![];_0x285552[_0x0843('0x4a')][_0x0843('0x67')]=moment()[_0x0843('0x62')](_0x0843('0x63'));_0x285552[_0x0843('0x4a')]['UserId']=_0x285552['body'][_0x0843('0x68')]||_0x285552[_0x0843('0x5b')]['id'];return db['MailMessage'][_0x0843('0x49')]({'where':{'id':_0x285552[_0x0843('0x4b')]['id'],'UserId':null},'include':[{'model':db[_0x0843('0x69')],'as':_0x0843('0x6a')}]})[_0x0843('0x1a')](handleEntityNotFound(_0x119c26,null))['then'](saveUpdates(_0x285552[_0x0843('0x4a')],null))['then'](function(_0x724cab){if(_0x724cab){_0x2bfae6[_0x0843('0x20')]=_0x724cab[_0x0843('0x6b')]({'plain':!![]});return db[_0x0843('0x6c')][_0x0843('0x49')]({'where':{'id':_0x724cab[_0x0843('0x6d')]}});}return null;})[_0x0843('0x1a')](handleEntityNotFound(_0x119c26,null))[_0x0843('0x1a')](function(_0x28131d){if(_0x28131d){return _0x28131d['update']({'UserId':_0x285552[_0x0843('0x4a')][_0x0843('0x68')],'read1stAt':_[_0x0843('0x53')](_0x28131d[_0x0843('0x6e')])?moment()[_0x0843('0x62')](_0x0843('0x63')):undefined});}return null;})['then'](function(_0x3da333){if(_0x3da333){_0x2bfae6[_0x0843('0x6f')]=_0x3da333['get']({'plain':!![]});interaction_log[_0x0843('0x1b')](_0x0843('0x70'),_0x285552[_0x0843('0x5b')]['id'],_0x285552[_0x0843('0x5b')][_0x0843('0x2e')],_0x285552[_0x0843('0x5b')][_0x0843('0x71')],_0x2bfae6['interaction']['id'],_0x285552[_0x0843('0x4a')]?JSON[_0x0843('0x72')](_0x285552['body']):'null');return respondWithRpcPromise(_0x0843('0x73'),_0x0843('0x74'),_0x2bfae6);}return null;})['then'](function(_0x34a7ed){if(_0x34a7ed){if(_0x285552[_0x0843('0x4a')][_0x0843('0x75')]){_0x2bfae6[_0x0843('0x20')][_0x0843('0x76')]=util[_0x0843('0x62')](_0x0843('0x77'),_0x285552[_0x0843('0x5b')][_0x0843('0x2e')]);_0x2bfae6[_0x0843('0x20')][_0x0843('0x78')]=_0x2bfae6[_0x0843('0x78')];_0x2bfae6[_0x0843('0x20')][_0x0843('0x79')]=_0x0843('0x65');return respondWithRpcPromise(_0x0843('0x7a'),'EventManager',{'event':_0x0843('0x7b'),'message':_0x2bfae6[_0x0843('0x20')]},client9002)[_0x0843('0x1a')](function(){return _0x2bfae6;});}return _0x2bfae6;}return null;})[_0x0843('0x1a')](respondWithResult(_0x119c26,null))[_0x0843('0x46')](handleError(_0x119c26,null));};var interaction_log=require('../../config/logger')(_0x0843('0x64'));exports['reject']=function(_0x4516a0,_0x206885,_0x2c489e){var _0x13b059={'agent':{},'channel':_0x0843('0x7c')};if(_0x4516a0['body']['id']){delete _0x4516a0['body']['id'];}_0x4516a0[_0x0843('0x4a')][_0x0843('0x68')]=_0x4516a0[_0x0843('0x4a')][_0x0843('0x68')]||_0x4516a0[_0x0843('0x5b')]['id'];_0x13b059[_0x0843('0x7d')]['id']=_0x4516a0[_0x0843('0x4a')]['UserId'];return db[_0x0843('0x30')]['find']({'where':{'id':_0x4516a0['params']['id'],'UserId':null}})[_0x0843('0x1a')](handleEntityNotFound(_0x206885,null))['then'](function(_0x1d3e04){if(_0x1d3e04){_0x13b059[_0x0843('0x20')]=_0x1d3e04[_0x0843('0x6b')]({'plain':!![]});return db[_0x0843('0x6c')][_0x0843('0x49')]({'where':{'id':_0x1d3e04['MailInteractionId']}});}return null;})[_0x0843('0x1a')](handleEntityNotFound(_0x206885,null))[_0x0843('0x1a')](function(_0x22f7c5){if(_0x22f7c5){_0x13b059[_0x0843('0x6f')]=_0x22f7c5['get']({'plain':!![]});interaction_log['info'](_0x0843('0x7e'),_0x4516a0['user']['id'],_0x4516a0['user'][_0x0843('0x2e')],_0x4516a0[_0x0843('0x5b')][_0x0843('0x71')],_0x13b059[_0x0843('0x6f')]['id'],_0x4516a0[_0x0843('0x4a')]?JSON[_0x0843('0x72')](_0x4516a0[_0x0843('0x4a')]):_0x0843('0x7f'));return respondWithRpcPromise(_0x0843('0x80'),_0x0843('0x81'),_0x13b059);}return null;})[_0x0843('0x1a')](function(_0x44677a){if(_0x44677a){_0x44677a['message'][_0x0843('0x76')]=util[_0x0843('0x62')](_0x0843('0x77'),_0x4516a0[_0x0843('0x5b')][_0x0843('0x2e')]);_0x44677a[_0x0843('0x20')][_0x0843('0x78')]=_0x13b059[_0x0843('0x78')];_0x44677a[_0x0843('0x20')][_0x0843('0x79')]=_0x0843('0x28');respondWithRpcPromise('EventManager',_0x0843('0x7a'),{'event':_0x0843('0x82'),'message':_0x44677a['message']},client9002);return _0x13b059;}return null;})[_0x0843('0x1a')](respondWithResult(_0x206885,null))[_0x0843('0x46')](handleError(_0x206885,null));};exports[_0x0843('0x83')]=function(_0x3ccc8a,_0x2f48d5){var _0x4a78d2=moment()['unix']()[_0x0843('0x84')]();var _0x2f8a13=path['join'](config[_0x0843('0x5e')],_0x0843('0x85'),'files',_0x0843('0x86'));var _0x14c242=path[_0x0843('0x5d')](config[_0x0843('0x5e')],_0x0843('0x85'),'files','attachments');var _0x54b9fc=util[_0x0843('0x62')]('message-%s.eml',_0x4a78d2);return db[_0x0843('0x30')][_0x0843('0x49')]({'where':{'id':_0x3ccc8a[_0x0843('0x4b')]['id']},'attributes':['id',_0x0843('0x4a'),'from','to','cc',_0x0843('0x87'),_0x0843('0x88')],'include':_0x3ccc8a[_0x0843('0x31')][_0x0843('0x5c')]?[{'model':db[_0x0843('0x89')],'as':_0x0843('0x8a')}]:undefined})['then'](handleEntityNotFound(_0x2f48d5,null))['then'](function(_0x2168ad){if(_0x2168ad){var _0xd9972c=_0x2168ad;var _0x1341a1={'from':_0xd9972c['from'],'to':_0xd9972c['to'],'subject':_0xd9972c[_0x0843('0x87')],'html':_0xd9972c[_0x0843('0x4a')],'attachments':[]};return new BPromise(function(_0x247799,_0x16f40c){if(_0x2168ad[_0x0843('0x8a')]){for(var _0x32a52e=0x0;_0x32a52e<_0x2168ad['Attachments'][_0x0843('0x3a')];_0x32a52e++){var _0x461439=_0x2168ad[_0x0843('0x8a')][_0x32a52e];var _0x4303db=path[_0x0843('0x5d')](_0x14c242,_0x461439[_0x0843('0x60')]);if(fs[_0x0843('0x8b')](_0x4303db)){_0x1341a1[_0x0843('0x5c')][_0x0843('0x8c')]({'name':_0x461439[_0x0843('0x2e')],'contentType':_0x461439[_0x0843('0x8d')],'data':fs[_0x0843('0x8e')](_0x4303db)});}}}emlformat[_0x0843('0x8f')](_0x1341a1,function(_0xbd93b6,_0x487fb5){if(_0xbd93b6)return _0x16f40c(_0xbd93b6);fs[_0x0843('0x90')](path[_0x0843('0x5d')](_0x2f8a13,_0x54b9fc),_0x487fb5);return _0x247799(_0x487fb5);});});}})[_0x0843('0x1a')](function(_0x29c5fc){if(_0x29c5fc){return _0x2f48d5['download'](path['join'](_0x2f8a13,_0x54b9fc),_0x54b9fc,function(_0x4d9dab){if(_0x4d9dab){console[_0x0843('0x91')](_0x0843('0x92'),_0x4d9dab);}else{fs[_0x0843('0x93')](path[_0x0843('0x5d')](_0x2f8a13,_0x54b9fc));}});}})[_0x0843('0x46')](handleError(_0x2f48d5,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 9a70c8b..71b3ebf 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 _0xf29c=['MailMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x2b9215,_0x2e1c04){var _0xfdad72=function(_0x4b7da0){while(--_0x4b7da0){_0x2b9215['push'](_0x2b9215['shift']());}};_0xfdad72(++_0x2e1c04);}(_0xf29c,0xc7));var _0xcf29=function(_0x2cb3ae,_0x27580a){_0x2cb3ae=_0x2cb3ae-0x0;var _0x44bc50=_0xf29c[_0x2cb3ae];return _0x44bc50;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xcf29('0x0'))['db'][_0xcf29('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xcf29('0x2')](0x0);var events={'afterCreate':_0xcf29('0x3'),'afterUpdate':_0xcf29('0x4'),'afterDestroy':_0xcf29('0x5')};function emitEvent(_0x46fd65){return function(_0x148004,_0x1f2b5d,_0x1a85d7){MailMessageEvents[_0xcf29('0x6')](_0x46fd65+':'+_0x148004['id'],_0x148004);MailMessageEvents[_0xcf29('0x6')](_0x46fd65,_0x148004);_0x1a85d7(null);};}for(var e in events){if(events[_0xcf29('0x7')](e)){var event=events[e];MailMessage[_0xcf29('0x8')](e,emitEvent(event));}}module[_0xcf29('0x9')]=MailMessageEvents; \ No newline at end of file +var _0x6a88=['MailMessage','setMaxListeners','save','update','remove','emit','hook','events','../../mysqldb'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0x6a88,0xa9));var _0x86a8=function(_0x38efe1,_0x34a883){_0x38efe1=_0x38efe1-0x0;var _0x44c9fb=_0x6a88[_0x38efe1];return _0x44c9fb;};'use strict';var EventEmitter=require(_0x86a8('0x0'));var MailMessage=require(_0x86a8('0x1'))['db'][_0x86a8('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x86a8('0x3')](0x0);var events={'afterCreate':_0x86a8('0x4'),'afterUpdate':_0x86a8('0x5'),'afterDestroy':_0x86a8('0x6')};function emitEvent(_0x510057){return function(_0x21afeb,_0x5aa681,_0x59313b){MailMessageEvents[_0x86a8('0x7')](_0x510057+':'+_0x21afeb['id'],_0x21afeb);MailMessageEvents[_0x86a8('0x7')](_0x510057,_0x21afeb);_0x59313b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x86a8('0x8')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 544edaf..1a125f6 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 _0x4f00=['request-promise','./mailMessage.attributes','MailMessage','mail_messages','messageId','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0x446fdb,_0x253afe){var _0x515170=function(_0x573c57){while(--_0x573c57){_0x446fdb['push'](_0x446fdb['shift']());}};_0x515170(++_0x253afe);}(_0x4f00,0x1ea));var _0x04f0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x4f00[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x04f0('0x0'));var util=require(_0x04f0('0x1'));var logger=require(_0x04f0('0x2'))(_0x04f0('0x3'));var moment=require(_0x04f0('0x4'));var BPromise=require('bluebird');var rp=require(_0x04f0('0x5'));var attributes=require(_0x04f0('0x6'));module['exports']=function(_0x5aba0b,_0x1063c9){return _0x5aba0b['define'](_0x04f0('0x7'),attributes,{'tableName':_0x04f0('0x8'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x04f0('0x9')]}],'timestamps':!![],'charset':_0x04f0('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xaf62=['./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4ec011,_0x105102){var _0x363f6e=function(_0x47f396){while(--_0x47f396){_0x4ec011['push'](_0x4ec011['shift']());}};_0x363f6e(++_0x105102);}(_0xaf62,0x174));var _0x2af6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xaf62[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x2af6('0x0'));var logger=require(_0x2af6('0x1'))(_0x2af6('0x2'));var moment=require('moment');var BPromise=require(_0x2af6('0x3'));var rp=require(_0x2af6('0x4'));var attributes=require(_0x2af6('0x5'));module[_0x2af6('0x6')]=function(_0x359bb3,_0x5d6a21){return _0x359bb3[_0x2af6('0x7')](_0x2af6('0x8'),attributes,{'tableName':_0x2af6('0x9'),'paranoid':![],'indexes':[{'name':_0x2af6('0xa'),'fields':['messageId']}],'timestamps':!![],'charset':_0x2af6('0xb'),'collate':_0x2af6('0xc')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 1f413c1..4b3af38 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 _0x0dee=['catch','CreateMailMessage','create','body','options','raw','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./mailMessage.socket','request','then','info','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','message','MailMessage,\x20%s,\x20%s','request\x20sent','result'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0dee,0xf7));var _0xe0de=function(_0x2ef23c,_0x108ac7){_0x2ef23c=_0x2ef23c-0x0;var _0xcdb1db=_0x0dee[_0x2ef23c];return _0xcdb1db;};'use strict';var _=require(_0xe0de('0x0'));var util=require(_0xe0de('0x1'));var moment=require('moment');var BPromise=require(_0xe0de('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0de('0x3'));var db=require(_0xe0de('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe0de('0x5'))(_0xe0de('0x6'));var config=require(_0xe0de('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe0de('0x8')]['http']({'port':0x232a});config[_0xe0de('0x9')]=_[_0xe0de('0xa')](config[_0xe0de('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xe0de('0xb'))(new Redis(config['redis']));require(_0xe0de('0xc'))['register'](socket);function respondWithRpcPromise(_0x401250,_0x301e88,_0xd2fd6){return new BPromise(function(_0x107be5,_0x53930a){return client[_0xe0de('0xd')](_0x401250,_0xd2fd6)[_0xe0de('0xe')](function(_0x15dfc8){logger[_0xe0de('0xf')]('MailMessage,\x20%s,\x20%s',_0x301e88,'request\x20sent');logger[_0xe0de('0x10')](_0xe0de('0x11'),_0x301e88,'request\x20sent',JSON['stringify'](_0x15dfc8));if(_0x15dfc8[_0xe0de('0x12')]){if(_0x15dfc8[_0xe0de('0x12')]['code']===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x301e88,_0x15dfc8['error'][_0xe0de('0x13')]);return _0x53930a(_0x15dfc8[_0xe0de('0x12')][_0xe0de('0x13')]);}logger[_0xe0de('0x12')](_0xe0de('0x14'),_0x301e88,_0x15dfc8[_0xe0de('0x12')][_0xe0de('0x13')]);return _0x107be5(_0x15dfc8[_0xe0de('0x12')][_0xe0de('0x13')]);}else{logger[_0xe0de('0xf')]('MailMessage,\x20%s,\x20%s',_0x301e88,_0xe0de('0x15'));_0x107be5(_0x15dfc8[_0xe0de('0x16')][_0xe0de('0x13')]);}})[_0xe0de('0x17')](function(_0x22c5b7){logger[_0xe0de('0x12')](_0xe0de('0x14'),_0x301e88,_0x22c5b7);_0x53930a(_0x22c5b7);});});}exports[_0xe0de('0x18')]=function(_0x2c728e){var _0x194211=this;return new Promise(function(_0x509353,_0x2d7ad8){return db['MailMessage'][_0xe0de('0x19')](_0x2c728e[_0xe0de('0x1a')],{'raw':_0x2c728e[_0xe0de('0x1b')]?_0x2c728e['options'][_0xe0de('0x1c')]===undefined?!![]:![]:!![]})[_0xe0de('0xe')](function(_0x2df49c){logger[_0xe0de('0xf')](_0xe0de('0x18'),_0x2c728e);logger['debug'](_0xe0de('0x18'),_0x2c728e,JSON[_0xe0de('0x1d')](_0x2df49c));_0x509353(_0x2df49c);})['catch'](function(_0x1d7c7d){logger[_0xe0de('0x12')](_0xe0de('0x18'),_0x1d7c7d['message'],_0x2c728e);_0x2d7ad8(_0x194211['error'](0x1f4,_0x1d7c7d['message']));});});}; \ No newline at end of file +var _0x72a2=['info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','CreateMailMessage','MailMessage','create','body','options','raw','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','http','redis','defaults','register'];(function(_0xf3a320,_0xae99ab){var _0xc1fa9c=function(_0x2fc2a5){while(--_0x2fc2a5){_0xf3a320['push'](_0xf3a320['shift']());}};_0xc1fa9c(++_0xae99ab);}(_0x72a2,0x161));var _0x272a=function(_0x19eeae,_0x260c69){_0x19eeae=_0x19eeae-0x0;var _0x1fbbab=_0x72a2[_0x19eeae];return _0x1fbbab;};'use strict';var _=require('lodash');var util=require(_0x272a('0x0'));var moment=require(_0x272a('0x1'));var BPromise=require(_0x272a('0x2'));var rs=require(_0x272a('0x3'));var fs=require('fs');var Redis=require(_0x272a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x272a('0x5'));var logger=require('../../config/logger')(_0x272a('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x272a('0x7')]({'port':0x232a});config[_0x272a('0x8')]=_[_0x272a('0x9')](config[_0x272a('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x272a('0x8')]));require('./mailMessage.socket')[_0x272a('0xa')](socket);function respondWithRpcPromise(_0x50af90,_0x8ff2fe,_0x844c3a){return new BPromise(function(_0x103fff,_0x39965a){return client['request'](_0x50af90,_0x844c3a)['then'](function(_0x153666){logger[_0x272a('0xb')]('MailMessage,\x20%s,\x20%s',_0x8ff2fe,_0x272a('0xc'));logger[_0x272a('0xd')](_0x272a('0xe'),_0x8ff2fe,_0x272a('0xc'),JSON[_0x272a('0xf')](_0x153666));if(_0x153666['error']){if(_0x153666[_0x272a('0x10')][_0x272a('0x11')]===0x1f4){logger[_0x272a('0x10')](_0x272a('0x12'),_0x8ff2fe,_0x153666['error'][_0x272a('0x13')]);return _0x39965a(_0x153666[_0x272a('0x10')]['message']);}logger['error']('MailMessage,\x20%s,\x20%s',_0x8ff2fe,_0x153666['error']['message']);return _0x103fff(_0x153666['error'][_0x272a('0x13')]);}else{logger['info'](_0x272a('0x12'),_0x8ff2fe,_0x272a('0xc'));_0x103fff(_0x153666[_0x272a('0x14')][_0x272a('0x13')]);}})['catch'](function(_0x28b7ba){logger[_0x272a('0x10')](_0x272a('0x12'),_0x8ff2fe,_0x28b7ba);_0x39965a(_0x28b7ba);});});}exports[_0x272a('0x15')]=function(_0x1652c9){var _0x9a0156=this;return new Promise(function(_0x3e3961,_0x5cc0d6){return db[_0x272a('0x16')][_0x272a('0x17')](_0x1652c9[_0x272a('0x18')],{'raw':_0x1652c9[_0x272a('0x19')]?_0x1652c9[_0x272a('0x19')][_0x272a('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1bfe85){logger['info'](_0x272a('0x15'),_0x1652c9);logger['debug'](_0x272a('0x15'),_0x1652c9,JSON['stringify'](_0x1bfe85));_0x3e3961(_0x1bfe85);})[_0x272a('0x1b')](function(_0x3b0439){logger[_0x272a('0x10')](_0x272a('0x15'),_0x3b0439[_0x272a('0x13')],_0x1652c9);_0x5cc0d6(_0x9a0156[_0x272a('0x10')](0x1f4,_0x3b0439[_0x272a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 3155ee5..84043cd 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 _0xa489=['removeListener','register','mailMessage:','./mailMessage.events','save','remove','update','emit'];(function(_0x5117ee,_0x1237a0){var _0x385096=function(_0x17d774){while(--_0x17d774){_0x5117ee['push'](_0x5117ee['shift']());}};_0x385096(++_0x1237a0);}(_0xa489,0xeb));var _0x9a48=function(_0x15ce35,_0x5d4c5d){_0x15ce35=_0x15ce35-0x0;var _0x549e30=_0xa489[_0x15ce35];return _0x549e30;};'use strict';var MailMessageEvents=require(_0x9a48('0x0'));var events=[_0x9a48('0x1'),_0x9a48('0x2'),_0x9a48('0x3')];function createListener(_0x39a70c,_0x561fa1){return function(_0x359dda){_0x561fa1[_0x9a48('0x4')](_0x39a70c,_0x359dda);};}function removeListener(_0x36b923,_0x51a734){return function(){MailMessageEvents[_0x9a48('0x5')](_0x36b923,_0x51a734);};}exports[_0x9a48('0x6')]=function(_0x32f0d5){for(var _0x42b9c9=0x0,_0x407a79=events['length'];_0x42b9c9<_0x407a79;_0x42b9c9++){var _0x24978f=events[_0x42b9c9];var _0x385926=createListener(_0x9a48('0x7')+_0x24978f,_0x32f0d5);MailMessageEvents['on'](_0x24978f,_0x385926);}}; \ No newline at end of file +var _0x282a=['mailMessage:','./mailMessage.events','save','update','emit','removeListener','register','length'];(function(_0x4e3ee6,_0x1cac16){var _0x3a1887=function(_0x1d4b44){while(--_0x1d4b44){_0x4e3ee6['push'](_0x4e3ee6['shift']());}};_0x3a1887(++_0x1cac16);}(_0x282a,0xf9));var _0xa282=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x282a[_0x178e48];return _0x440d7e;};'use strict';var MailMessageEvents=require(_0xa282('0x0'));var events=[_0xa282('0x1'),'remove',_0xa282('0x2')];function createListener(_0x47811b,_0x12ae79){return function(_0x2e46fd){_0x12ae79[_0xa282('0x3')](_0x47811b,_0x2e46fd);};}function removeListener(_0x5ece91,_0x1f4bfe){return function(){MailMessageEvents[_0xa282('0x4')](_0x5ece91,_0x1f4bfe);};}exports[_0xa282('0x5')]=function(_0x651ee4){for(var _0x1e9409=0x0,_0x575b0b=events[_0xa282('0x6')];_0x1e9409<_0x575b0b;_0x1e9409++){var _0x400721=events[_0x1e9409];var _0x9d9049=createListener(_0xa282('0x7')+_0x400721,_0x651ee4);MailMessageEvents['on'](_0x400721,_0x9d9049);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index e91a671..6e52492 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 _0x21ac=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show','getMembers','/:id/teams','/:id/users','getAgents','create','post','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3221a7,_0x4fcbaa){var _0x389c34=function(_0x3b053e){while(--_0x3b053e){_0x3221a7['push'](_0x3221a7['shift']());}};_0x389c34(++_0x4fcbaa);}(_0x21ac,0x12e));var _0xc21a=function(_0x6ed0f1,_0x3fc9e1){_0x6ed0f1=_0x6ed0f1-0x0;var _0x487509=_0x21ac[_0x6ed0f1];return _0x487509;};'use strict';var multer=require(_0xc21a('0x0'));var util=require(_0xc21a('0x1'));var path=require(_0xc21a('0x2'));var timeout=require(_0xc21a('0x3'));var express=require(_0xc21a('0x4'));var router=express[_0xc21a('0x5')]();var auth=require(_0xc21a('0x6'));var interaction=require(_0xc21a('0x7'));var config=require('../../config/environment');var controller=require('./mailQueue.controller');router[_0xc21a('0x8')]('/',auth[_0xc21a('0x9')](),controller[_0xc21a('0xa')]);router[_0xc21a('0x8')]('/describe',auth[_0xc21a('0x9')](),controller[_0xc21a('0xb')]);router['get'](_0xc21a('0xc'),auth[_0xc21a('0x9')](),controller[_0xc21a('0xd')]);router[_0xc21a('0x8')]('/:id/members',auth[_0xc21a('0x9')](),controller[_0xc21a('0xe')]);router[_0xc21a('0x8')](_0xc21a('0xf'),auth['isAuthenticated'](),controller['getTeams']);router['get'](_0xc21a('0x10'),auth[_0xc21a('0x9')](),controller[_0xc21a('0x11')]);router['post']('/',auth[_0xc21a('0x9')](),controller[_0xc21a('0x12')]);router[_0xc21a('0x13')](_0xc21a('0xf'),auth[_0xc21a('0x9')](),controller['addTeams']);router['post'](_0xc21a('0x10'),auth['isAuthenticated'](),controller[_0xc21a('0x14')]);router[_0xc21a('0x15')](_0xc21a('0xc'),auth[_0xc21a('0x9')](),controller[_0xc21a('0x16')]);router[_0xc21a('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xc21a('0x18')]);router[_0xc21a('0x17')](_0xc21a('0xf'),auth[_0xc21a('0x9')](),controller[_0xc21a('0x19')]);router[_0xc21a('0x17')](_0xc21a('0x10'),auth[_0xc21a('0x9')](),controller[_0xc21a('0x1a')]);module[_0xc21a('0x1b')]=router; \ No newline at end of file +var _0x8e9f=['isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','post','create','/:id/teams','addTeams','/:id/users','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get'];(function(_0xe15270,_0x227d06){var _0x1e813b=function(_0x1d590d){while(--_0x1d590d){_0xe15270['push'](_0xe15270['shift']());}};_0x1e813b(++_0x227d06);}(_0x8e9f,0x1d8));var _0xf8e9=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0x8e9f[_0x37a79c];return _0x561d89;};'use strict';var multer=require(_0xf8e9('0x0'));var util=require(_0xf8e9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf8e9('0x2')]();var auth=require(_0xf8e9('0x3'));var interaction=require(_0xf8e9('0x4'));var config=require(_0xf8e9('0x5'));var controller=require(_0xf8e9('0x6'));router[_0xf8e9('0x7')]('/',auth[_0xf8e9('0x8')](),controller[_0xf8e9('0x9')]);router[_0xf8e9('0x7')](_0xf8e9('0xa'),auth[_0xf8e9('0x8')](),controller[_0xf8e9('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf8e9('0xc')]);router[_0xf8e9('0x7')](_0xf8e9('0xd'),auth[_0xf8e9('0x8')](),controller[_0xf8e9('0xe')]);router['get']('/:id/teams',auth[_0xf8e9('0x8')](),controller[_0xf8e9('0xf')]);router[_0xf8e9('0x7')]('/:id/users',auth[_0xf8e9('0x8')](),controller['getAgents']);router[_0xf8e9('0x10')]('/',auth['isAuthenticated'](),controller[_0xf8e9('0x11')]);router[_0xf8e9('0x10')](_0xf8e9('0x12'),auth[_0xf8e9('0x8')](),controller[_0xf8e9('0x13')]);router[_0xf8e9('0x10')](_0xf8e9('0x14'),auth[_0xf8e9('0x8')](),controller[_0xf8e9('0x15')]);router[_0xf8e9('0x16')](_0xf8e9('0x17'),auth[_0xf8e9('0x8')](),controller[_0xf8e9('0x18')]);router[_0xf8e9('0x19')](_0xf8e9('0x17'),auth['isAuthenticated'](),controller[_0xf8e9('0x1a')]);router[_0xf8e9('0x19')](_0xf8e9('0x12'),auth[_0xf8e9('0x8')](),controller[_0xf8e9('0x1b')]);router[_0xf8e9('0x19')](_0xf8e9('0x14'),auth[_0xf8e9('0x8')](),controller[_0xf8e9('0x1c')]);module[_0xf8e9('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 4165e16..4471b39 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 _0xd192=['ENUM','beepall','roundrobin','sequelize','STRING','INTEGER'];(function(_0x4fb1c5,_0xe075b8){var _0x4e382d=function(_0x24e1ca){while(--_0x24e1ca){_0x4fb1c5['push'](_0x4fb1c5['shift']());}};_0x4e382d(++_0xe075b8);}(_0xd192,0x1ad));var _0x2d19=function(_0x35aa08,_0x3f6752){_0x35aa08=_0x35aa08-0x0;var _0x1df0d0=_0xd192[_0x35aa08];return _0x1df0d0;};'use strict';var Sequelize=require(_0x2d19('0x0'));module['exports']={'name':{'type':Sequelize[_0x2d19('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2d19('0x1')]},'timeout':{'type':Sequelize[_0x2d19('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2d19('0x3')]('rrmemory',_0x2d19('0x4'),_0x2d19('0x5'))}}; \ No newline at end of file +var _0x50c3=['sequelize','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x3610f6,_0x308781){var _0x56fa74=function(_0x1ccb23){while(--_0x1ccb23){_0x3610f6['push'](_0x3610f6['shift']());}};_0x56fa74(++_0x308781);}(_0x50c3,0x19d));var _0x350c=function(_0x3214ff,_0x33ea6e){_0x3214ff=_0x3214ff-0x0;var _0x5f18de=_0x50c3[_0x3214ff];return _0x5f18de;};'use strict';var Sequelize=require(_0x350c('0x0'));module['exports']={'name':{'type':Sequelize[_0x350c('0x1')],'unique':_0x350c('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x350c('0x1')]},'timeout':{'type':Sequelize[_0x350c('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x350c('0x4')](_0x350c('0x5'),_0x350c('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index e8b178f..1461b0a 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 _0xd172=['hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','map','options','MailQueue','count','includeAll','findAll','rows','catch','params','include','find','create','body','destroy','describe','getMembers','findOne','get','UserMailQueue','MailQueueId','filter','User','findAndCountAll','UserId','mailPause','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','Agents','union','addAgents','ids','removeTeams','removeAgents','omit','spread','emit','userMailQueue:save','isArray','userMailQueue:remove','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','./mailQueue.socket','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','end','error','name','send','index','rawAttributes','model','keys','dateStart','query','dateEnd','filters','intersection','fields','attributes','length'];(function(_0x10cabb,_0x2745db){var _0x396c1c=function(_0x1e2317){while(--_0x1e2317){_0x10cabb['push'](_0x10cabb['shift']());}};_0x396c1c(++_0x2745db);}(_0xd172,0x9f));var _0x2d17=function(_0x48b492,_0x1c5091){_0x48b492=_0x48b492-0x0;var _0x5eb0f1=_0xd172[_0x48b492];return _0x5eb0f1;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2d17('0x0'));var zipdir=require(_0x2d17('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2d17('0x2'));var moment=require(_0x2d17('0x3'));var BPromise=require(_0x2d17('0x4'));var Mustache=require(_0x2d17('0x5'));var util=require('util');var path=require(_0x2d17('0x6'));var sox=require(_0x2d17('0x7'));var csv=require(_0x2d17('0x8'));var ejs=require(_0x2d17('0x9'));var fs=require('fs');var _=require(_0x2d17('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2d17('0xb'));var deskjs=require(_0x2d17('0xc'));var toCsv=require(_0x2d17('0x8'));var querystring=require(_0x2d17('0xd'));var Papa=require(_0x2d17('0xe'));var Redis=require(_0x2d17('0xf'));var qs=require('../../components/parsers/qs');var logger=require(_0x2d17('0x10'))(_0x2d17('0x11'));var utils=require(_0x2d17('0x12'));var config=require(_0x2d17('0x13'));var db=require(_0x2d17('0x14'))['db'];config[_0x2d17('0x15')]=_['defaults'](config[_0x2d17('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2d17('0x15')]));require(_0x2d17('0x16'))['register'](socket);function respondWithStatusCode(_0x4f5334,_0xb0c5af){_0xb0c5af=_0xb0c5af||0xcc;return function(_0x3d53e3){if(_0x3d53e3){return _0x4f5334[_0x2d17('0x17')](_0xb0c5af);}return _0x4f5334[_0x2d17('0x18')](_0xb0c5af)['end']();};}function respondWithResult(_0x3332f3,_0x2aa8f2){_0x2aa8f2=_0x2aa8f2||0xc8;return function(_0x196c3d){if(_0x196c3d){return _0x3332f3[_0x2d17('0x18')](_0x2aa8f2)['json'](_0x196c3d);}};}function respondWithFilteredResult(_0x31ae2a,_0x521e2f){return function(_0x578abe){if(_0x578abe){var _0xb1df2d=_0x578abe['count'],_0x20438b=_0x521e2f[_0x2d17('0x19')],_0x53cbaf=_0x521e2f[_0x2d17('0x19')]+_0x521e2f[_0x2d17('0x1a')],_0x538b43;if(_0x53cbaf>=_0xb1df2d){_0x53cbaf=_0xb1df2d;_0x538b43=0xc8;}else{_0x538b43=0xce;}_0x31ae2a[_0x2d17('0x18')](_0x538b43);return _0x31ae2a[_0x2d17('0x1b')](_0x2d17('0x1c'),_0x20438b+'-'+_0x53cbaf+'/'+_0xb1df2d)[_0x2d17('0x1d')](_0x578abe);}return null;};}function patchUpdates(_0x3e7084){return function(_0x43db89){try{jsonpatch[_0x2d17('0x1e')](_0x43db89,_0x3e7084,!![]);}catch(_0x27b65d){return BPromise[_0x2d17('0x1f')](_0x27b65d);}return _0x43db89[_0x2d17('0x20')]();};}function saveUpdates(_0x295920,_0xec5dee){return function(_0x10588b){if(_0x10588b){return _0x10588b[_0x2d17('0x21')](_0x295920)[_0x2d17('0x22')](function(_0x2605d1){return _0x2605d1;});}return null;};}function removeEntity(_0x2593d9,_0x1add02){return function(_0x2a91a4){if(_0x2a91a4){return _0x2a91a4['destroy']()[_0x2d17('0x22')](function(){_0x2593d9[_0x2d17('0x18')](0xcc)[_0x2d17('0x23')]();});}};}function handleEntityNotFound(_0x21a1ab,_0x623f67){return function(_0x47c640){if(!_0x47c640){_0x21a1ab[_0x2d17('0x17')](0x194);}return _0x47c640;};}function handleError(_0x3bced9,_0x4adb18){_0x4adb18=_0x4adb18||0x1f4;return function(_0x5f1dfe){logger[_0x2d17('0x24')](_0x5f1dfe['stack']);if(_0x5f1dfe['name']){delete _0x5f1dfe[_0x2d17('0x25')];}_0x3bced9[_0x2d17('0x18')](_0x4adb18)[_0x2d17('0x26')](_0x5f1dfe);};}exports[_0x2d17('0x27')]=function(_0x348038,_0x1ecf07){var _0x4149aa={},_0x55b9db={},_0x52b67c={'count':0x0,'rows':[]};var _0x28ab1f=db['MailQueue'][_0x2d17('0x28')];_0x55b9db[_0x2d17('0x29')]=_[_0x2d17('0x2a')](_0x28ab1f);var _0x99336f={'dateStart':_0x348038['query'][_0x2d17('0x2b')],'dateEnd':_0x348038[_0x2d17('0x2c')][_0x2d17('0x2d')]};delete _0x348038['query']['dateStart'];delete _0x348038[_0x2d17('0x2c')][_0x2d17('0x2d')];_0x55b9db[_0x2d17('0x2c')]=_['keys'](_0x348038[_0x2d17('0x2c')]);_0x55b9db[_0x2d17('0x2e')]=_[_0x2d17('0x2f')](_0x55b9db[_0x2d17('0x29')],_0x55b9db[_0x2d17('0x2c')]);_0x4149aa['attributes']=_['intersection'](_0x55b9db[_0x2d17('0x29')],qs[_0x2d17('0x30')](_0x348038[_0x2d17('0x2c')]['fields']));_0x4149aa[_0x2d17('0x31')]=_0x4149aa[_0x2d17('0x31')][_0x2d17('0x32')]?_0x4149aa[_0x2d17('0x31')]:_0x55b9db['model'];if(!_0x348038[_0x2d17('0x2c')][_0x2d17('0x33')](_0x2d17('0x34'))){_0x4149aa[_0x2d17('0x1a')]=qs[_0x2d17('0x1a')](_0x348038['query'][_0x2d17('0x1a')]);_0x4149aa[_0x2d17('0x19')]=qs[_0x2d17('0x19')](_0x348038[_0x2d17('0x2c')][_0x2d17('0x19')]);}_0x4149aa[_0x2d17('0x35')]=qs[_0x2d17('0x36')](_0x348038[_0x2d17('0x2c')][_0x2d17('0x36')]);_0x4149aa[_0x2d17('0x37')]=qs[_0x2d17('0x2e')](_[_0x2d17('0x38')](_0x348038[_0x2d17('0x2c')],_0x55b9db[_0x2d17('0x2e')]));if(_0x99336f[_0x2d17('0x2b')]){if(_0x99336f[_0x2d17('0x2d')]){_0x99336f[_0x2d17('0x2d')]=moment(_0x99336f[_0x2d17('0x2d')])[_0x2d17('0x39')](0x1,_0x2d17('0x3a'));}else{_0x99336f[_0x2d17('0x2d')]=moment(_0x99336f['dateStart'])['add'](0x1,_0x2d17('0x3a'));}_[_0x2d17('0x3b')](_0x4149aa[_0x2d17('0x37')],{'createdAt':{'$gte':_0x99336f[_0x2d17('0x2b')],'$lte':_0x99336f[_0x2d17('0x2d')]}});}if(_0x348038[_0x2d17('0x2c')]['filter']){_0x4149aa[_0x2d17('0x37')]=_[_0x2d17('0x3b')](_0x4149aa[_0x2d17('0x37')],{'$or':_[_0x2d17('0x3c')](_0x4149aa[_0x2d17('0x31')],function(_0x689d4e){var _0x17bbd0={};_0x17bbd0[_0x689d4e]={'$like':'%'+_0x348038['query']['filter']+'%'};return _0x17bbd0;})});}_0x4149aa=_[_0x2d17('0x3b')]({},_0x4149aa,_0x348038[_0x2d17('0x3d')]);var _0x424d19={'where':_0x4149aa[_0x2d17('0x37')]};return db[_0x2d17('0x3e')][_0x2d17('0x3f')](_0x424d19)[_0x2d17('0x22')](function(_0x586eb2){_0x52b67c['count']=_0x586eb2;if(_0x348038[_0x2d17('0x2c')][_0x2d17('0x40')]){_0x4149aa['include']=[{'all':!![]}];}return db[_0x2d17('0x3e')][_0x2d17('0x41')](_0x4149aa);})[_0x2d17('0x22')](function(_0x29f5c6){_0x52b67c[_0x2d17('0x42')]=_0x29f5c6;return _0x52b67c;})[_0x2d17('0x22')](respondWithFilteredResult(_0x1ecf07,_0x4149aa))[_0x2d17('0x43')](handleError(_0x1ecf07,null));};exports['show']=function(_0x221304,_0x136578){var _0xcf01da={'raw':!![],'where':{'id':_0x221304[_0x2d17('0x44')]['id']}},_0x479636={};_0x479636['model']=_[_0x2d17('0x2a')](db[_0x2d17('0x3e')][_0x2d17('0x28')]);_0x479636['query']=_[_0x2d17('0x2a')](_0x221304[_0x2d17('0x2c')]);_0x479636['filters']=_[_0x2d17('0x2f')](_0x479636[_0x2d17('0x29')],_0x479636[_0x2d17('0x2c')]);_0xcf01da['attributes']=_[_0x2d17('0x2f')](_0x479636[_0x2d17('0x29')],qs['fields'](_0x221304[_0x2d17('0x2c')][_0x2d17('0x30')]));_0xcf01da[_0x2d17('0x31')]=_0xcf01da['attributes'][_0x2d17('0x32')]?_0xcf01da[_0x2d17('0x31')]:_0x479636[_0x2d17('0x29')];if(_0x221304[_0x2d17('0x2c')][_0x2d17('0x40')]){_0xcf01da[_0x2d17('0x45')]=[{'all':!![]}];}_0xcf01da=_[_0x2d17('0x3b')]({},_0xcf01da,_0x221304[_0x2d17('0x3d')]);return db[_0x2d17('0x3e')][_0x2d17('0x46')](_0xcf01da)[_0x2d17('0x22')](handleEntityNotFound(_0x136578,null))[_0x2d17('0x22')](respondWithResult(_0x136578,null))[_0x2d17('0x43')](handleError(_0x136578,null));};exports[_0x2d17('0x47')]=function(_0xbde1c4,_0xca935c){return db[_0x2d17('0x3e')][_0x2d17('0x47')](_0xbde1c4[_0x2d17('0x48')],{})[_0x2d17('0x22')](respondWithResult(_0xca935c,0xc9))[_0x2d17('0x43')](handleError(_0xca935c,null));};exports['update']=function(_0x43c2c3,_0x31d5eb){if(_0x43c2c3[_0x2d17('0x48')]['id']){delete _0x43c2c3[_0x2d17('0x48')]['id'];}return db[_0x2d17('0x3e')][_0x2d17('0x46')]({'where':{'id':_0x43c2c3[_0x2d17('0x44')]['id']}})[_0x2d17('0x22')](handleEntityNotFound(_0x31d5eb,null))[_0x2d17('0x22')](saveUpdates(_0x43c2c3[_0x2d17('0x48')],null))['then'](respondWithResult(_0x31d5eb,null))['catch'](handleError(_0x31d5eb,null));};exports[_0x2d17('0x49')]=function(_0x2ea8f3,_0x116a4d){return db[_0x2d17('0x3e')][_0x2d17('0x46')]({'where':{'id':_0x2ea8f3[_0x2d17('0x44')]['id']}})[_0x2d17('0x22')](handleEntityNotFound(_0x116a4d,null))[_0x2d17('0x22')](removeEntity(_0x116a4d,null))[_0x2d17('0x43')](handleError(_0x116a4d,null));};exports['describe']=function(_0x5c476a,_0x4ef308){return db['MailQueue'][_0x2d17('0x4a')]()[_0x2d17('0x22')](respondWithResult(_0x4ef308,null))[_0x2d17('0x43')](handleError(_0x4ef308,null));};exports[_0x2d17('0x4b')]=function(_0x5aa243,_0x3ee691,_0x2b687b){var _0x2d1d7e={'raw':!![],'where':{}},_0x44adab={},_0x386860;return db['MailQueue'][_0x2d17('0x4c')]({'where':{'id':_0x5aa243['params']['id']}})[_0x2d17('0x22')](handleEntityNotFound(_0x3ee691,null))[_0x2d17('0x22')](function(_0x5a99ae){if(_0x5a99ae){_0x386860=_0x5a99ae[_0x2d17('0x4d')]({'plain':!![]});_0x44adab[_0x2d17('0x29')]=_['keys'](db[_0x2d17('0x4e')][_0x2d17('0x28')]);_0x44adab[_0x2d17('0x2c')]=_[_0x2d17('0x2a')](_0x5aa243[_0x2d17('0x2c')]);_0x44adab['filters']=_[_0x2d17('0x2f')](_0x44adab['model'],_0x44adab[_0x2d17('0x2c')]);_0x2d1d7e[_0x2d17('0x31')]=_[_0x2d17('0x2f')](_0x44adab[_0x2d17('0x29')],qs[_0x2d17('0x30')](_0x5aa243[_0x2d17('0x2c')][_0x2d17('0x30')]));_0x2d1d7e[_0x2d17('0x31')]=_0x2d1d7e['attributes'][_0x2d17('0x32')]?_0x2d1d7e[_0x2d17('0x31')]:_0x44adab[_0x2d17('0x29')];if(!_0x5aa243[_0x2d17('0x2c')][_0x2d17('0x33')]('nolimit')){_0x2d1d7e['limit']=qs[_0x2d17('0x1a')](_0x5aa243['query'][_0x2d17('0x1a')]);_0x2d1d7e[_0x2d17('0x19')]=qs[_0x2d17('0x19')](_0x5aa243[_0x2d17('0x2c')]['offset']);}_0x2d1d7e[_0x2d17('0x35')]=qs['sort'](_0x5aa243[_0x2d17('0x2c')][_0x2d17('0x36')]);_0x2d1d7e[_0x2d17('0x37')]=qs[_0x2d17('0x2e')](_[_0x2d17('0x38')](_0x5aa243[_0x2d17('0x2c')],_0x44adab[_0x2d17('0x2e')]));_0x2d1d7e[_0x2d17('0x37')][_0x2d17('0x4f')]=_0x5a99ae['id'];if(_0x5aa243['query'][_0x2d17('0x50')]){_0x2d1d7e[_0x2d17('0x37')]=_[_0x2d17('0x3b')](_0x2d1d7e['where'],{'$or':_['map'](_0x2d1d7e['attributes'],function(_0x15a3cf){var _0x55a215={};_0x55a215[_0x15a3cf]={'$like':'%'+_0x5aa243[_0x2d17('0x2c')][_0x2d17('0x50')]+'%'};return _0x55a215;})});}_0x2d1d7e=_[_0x2d17('0x3b')]({},_0x2d1d7e,_0x5aa243[_0x2d17('0x3d')]);return db[_0x2d17('0x4e')][_0x2d17('0x41')](_0x2d1d7e);}})['then'](function(_0xcf8015){if(_0xcf8015){return db[_0x2d17('0x51')][_0x2d17('0x52')]({'where':{'id':_[_0x2d17('0x3c')](_0xcf8015,_0x2d17('0x53')),'role':'agent'},'attributes':['id','name',_0x2d17('0x54'),'updatedAt',_0x2d17('0x55')]});}})[_0x2d17('0x22')](function(_0x335dac){if(_0x335dac){return{'count':_0x335dac[_0x2d17('0x3f')],'rows':_[_0x2d17('0x3c')](_0x335dac[_0x2d17('0x42')],function(_0x1d8639){return{'membername':_0x1d8639['name'],'UserId':_0x1d8639['id'],'queue_name':_0x386860[_0x2d17('0x25')],'MailQueueId':_0x386860['id'],'interface':util[_0x2d17('0x56')](_0x2d17('0x57'),_0x2d17('0x58'),_0x1d8639['name']),'penalty':0x0,'paused':_0x1d8639[_0x2d17('0x54')],'createdAt':_0x1d8639[_0x2d17('0x55')],'updatedAt':_0x1d8639['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3ee691,_0x2d1d7e))[_0x2d17('0x43')](handleError(_0x3ee691,null));};exports[_0x2d17('0x59')]=function(_0x85cf8a,_0xf42213,_0x257331){var _0x8835c8={};var _0x2cc50b={};var _0xc7d8a9;var _0x466ad2;return db[_0x2d17('0x3e')][_0x2d17('0x4c')]({'where':{'id':_0x85cf8a[_0x2d17('0x44')]['id']}})[_0x2d17('0x22')](handleEntityNotFound(_0xf42213,null))['then'](function(_0xae90a0){if(_0xae90a0){_0xc7d8a9=_0xae90a0;_0x2cc50b['model']=_[_0x2d17('0x2a')](db[_0x2d17('0x5a')][_0x2d17('0x28')]);_0x2cc50b[_0x2d17('0x2c')]=_[_0x2d17('0x2a')](_0x85cf8a[_0x2d17('0x2c')]);_0x2cc50b['filters']=_[_0x2d17('0x2f')](_0x2cc50b['model'],_0x2cc50b[_0x2d17('0x2c')]);_0x8835c8['attributes']=_[_0x2d17('0x2f')](_0x2cc50b[_0x2d17('0x29')],qs[_0x2d17('0x30')](_0x85cf8a['query'][_0x2d17('0x30')]));_0x8835c8[_0x2d17('0x31')]=_0x8835c8[_0x2d17('0x31')][_0x2d17('0x32')]?_0x8835c8[_0x2d17('0x31')]:_0x2cc50b['model'];_0x8835c8['order']=qs['sort'](_0x85cf8a[_0x2d17('0x2c')][_0x2d17('0x36')]);_0x8835c8[_0x2d17('0x37')]=qs['filters'](_[_0x2d17('0x38')](_0x85cf8a[_0x2d17('0x2c')],_0x2cc50b[_0x2d17('0x2e')]));if(_0x85cf8a['query'][_0x2d17('0x50')]){_0x8835c8[_0x2d17('0x37')]=_[_0x2d17('0x3b')](_0x8835c8[_0x2d17('0x37')],{'$or':_[_0x2d17('0x3c')](_0x8835c8[_0x2d17('0x31')],function(_0x12bd42){var _0x7c48f0={};_0x7c48f0[_0x12bd42]={'$like':'%'+_0x85cf8a[_0x2d17('0x2c')][_0x2d17('0x50')]+'%'};return _0x7c48f0;})});}_0x8835c8=_[_0x2d17('0x3b')]({},_0x8835c8,_0x85cf8a[_0x2d17('0x3d')]);return _0xc7d8a9[_0x2d17('0x59')](_0x8835c8);}})[_0x2d17('0x22')](function(_0xafa473){if(_0xafa473){_0x466ad2=_0xafa473['length'];if(!_0x85cf8a[_0x2d17('0x2c')][_0x2d17('0x33')](_0x2d17('0x34'))){_0x8835c8[_0x2d17('0x1a')]=qs['limit'](_0x85cf8a[_0x2d17('0x2c')][_0x2d17('0x1a')]);_0x8835c8[_0x2d17('0x19')]=qs[_0x2d17('0x19')](_0x85cf8a['query'][_0x2d17('0x19')]);}return _0xc7d8a9[_0x2d17('0x59')](_0x8835c8);}})[_0x2d17('0x22')](function(_0x2a3772){if(_0x2a3772){return _0x2a3772?{'count':_0x466ad2,'rows':_0x2a3772}:null;}})['then'](respondWithResult(_0xf42213,null))[_0x2d17('0x43')](handleError(_0xf42213,null));};exports[_0x2d17('0x5b')]=function(_0xa23afc,_0x5425d9,_0x4d6b55){var _0x1e2580=[];var _0x2007db;return db[_0x2d17('0x5a')][_0x2d17('0x41')]({'where':{'id':_0xa23afc[_0x2d17('0x48')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2d17('0x51')],'as':_0x2d17('0x5c'),'attributes':['id'],'raw':!![]}]})[_0x2d17('0x22')](function(_0x2036de){if(_0x2036de){for(var _0x366bdf=0x0;_0x366bdf<_0x2036de[_0x2d17('0x32')];_0x366bdf+=0x1){for(var _0x382502=0x0;_0x382502<_0x2036de[_0x366bdf][_0x2d17('0x5c')][_0x2d17('0x32')];_0x382502+=0x1){_0x1e2580=_[_0x2d17('0x5d')](_0x1e2580,[_0x2036de[_0x366bdf][_0x2d17('0x5c')][_0x382502]['id']]);}}return _0x1e2580;}})[_0x2d17('0x22')](function(_0x133edf){if(_0x133edf){return db['MailQueue'][_0x2d17('0x46')]({'where':{'id':_0xa23afc[_0x2d17('0x44')]['id']}});}})[_0x2d17('0x22')](function(_0x37094a){if(_0x37094a){_0x2007db=_0x37094a;return _0x2007db[_0x2d17('0x5e')](_0x1e2580,{'penalty':_0xa23afc[_0x2d17('0x48')]['penalty']});}})['then'](function(_0x1b23ad){if(_0x1b23ad){return _0x2007db['addTeams'](_0xa23afc[_0x2d17('0x48')][_0x2d17('0x5f')]);}})[_0x2d17('0x22')](handleEntityNotFound(_0x5425d9,null))['then'](respondWithStatusCode(_0x5425d9,null))['catch'](handleError(_0x5425d9,null));};exports[_0x2d17('0x60')]=function(_0x1cae37,_0xa784ee,_0x14202b){var _0x31113c=[];var _0x3d9a5b;return db['Team']['findAll']({'where':{'id':_0x1cae37[_0x2d17('0x2c')][_0x2d17('0x5f')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2d17('0x5c'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x57114c){if(_0x57114c){for(var _0x471927=0x0;_0x471927<_0x57114c[_0x2d17('0x32')];_0x471927+=0x1){for(var _0x52193d=0x0;_0x52193d<_0x57114c[_0x471927][_0x2d17('0x5c')][_0x2d17('0x32')];_0x52193d+=0x1){_0x31113c=_[_0x2d17('0x5d')](_0x31113c,[_0x57114c[_0x471927]['Agents'][_0x52193d]['id']]);}}return _0x31113c;}})['then'](function(_0x2ff0ba){if(_0x2ff0ba){return db[_0x2d17('0x3e')]['find']({'where':{'id':_0x1cae37[_0x2d17('0x44')]['id']}});}})['then'](function(_0x1868a1){if(_0x1868a1){_0x3d9a5b=_0x1868a1;return _0x3d9a5b[_0x2d17('0x61')](_0x31113c);}})[_0x2d17('0x22')](function(_0x4ac906){if(_0x3d9a5b){return _0x3d9a5b[_0x2d17('0x60')](_0x1cae37[_0x2d17('0x2c')][_0x2d17('0x5f')]);}})[_0x2d17('0x22')](handleEntityNotFound(_0xa784ee,null))[_0x2d17('0x22')](respondWithStatusCode(_0xa784ee,null))[_0x2d17('0x43')](handleError(_0xa784ee,null));};exports['addAgents']=function(_0x2fa12d,_0x4b53ee,_0x462e30){return db[_0x2d17('0x3e')][_0x2d17('0x46')]({'where':{'id':_0x2fa12d[_0x2d17('0x44')]['id']}})[_0x2d17('0x22')](handleEntityNotFound(_0x4b53ee,null))['then'](function(_0x51a4fc){if(_0x51a4fc){return _0x51a4fc['addAgents'](_0x2fa12d[_0x2d17('0x48')][_0x2d17('0x5f')],_[_0x2d17('0x62')](_0x2fa12d[_0x2d17('0x48')],[_0x2d17('0x5f'),'id'])||{})[_0x2d17('0x63')](function(_0x29ab1e){for(var _0x3e1f4=0x0;_0x3e1f4<_0x2fa12d[_0x2d17('0x48')][_0x2d17('0x5f')][_0x2d17('0x32')];_0x3e1f4+=0x1){socket[_0x2d17('0x64')](_0x2d17('0x65'),{'UserId':_0x2fa12d[_0x2d17('0x48')]['ids'][_0x3e1f4],'MailQueueId':_0x2fa12d[_0x2d17('0x44')]['id']});}return _0x29ab1e;});}})['then'](respondWithResult(_0x4b53ee,null))[_0x2d17('0x43')](handleError(_0x4b53ee,null));};exports[_0x2d17('0x61')]=function(_0x18797a,_0x560986,_0x8faf2){var _0x29a472;return db[_0x2d17('0x3e')][_0x2d17('0x46')]({'where':{'id':_0x18797a['params']['id']}})['then'](handleEntityNotFound(_0x560986,null))[_0x2d17('0x22')](function(_0x37abe8){if(_0x37abe8){return _0x37abe8[_0x2d17('0x61')](_0x18797a[_0x2d17('0x2c')][_0x2d17('0x5f')])[_0x2d17('0x22')](function(_0x1d174c){if(_[_0x2d17('0x66')](_0x18797a[_0x2d17('0x2c')]['ids'])){for(var _0x38128=0x0;_0x38128<_0x18797a[_0x2d17('0x2c')][_0x2d17('0x5f')][_0x2d17('0x32')];_0x38128+=0x1){socket[_0x2d17('0x64')]('userMailQueue:remove',{'UserId':_0x18797a['query'][_0x2d17('0x5f')][_0x38128],'MailQueueId':_0x18797a[_0x2d17('0x44')]['id']});}}else{socket[_0x2d17('0x64')](_0x2d17('0x67'),{'UserId':_0x18797a[_0x2d17('0x2c')][_0x2d17('0x5f')],'MailQueueId':_0x18797a[_0x2d17('0x44')]['id']});}});}})[_0x2d17('0x22')](respondWithStatusCode(_0x560986,null))[_0x2d17('0x43')](handleError(_0x560986,null));};exports['getAgents']=function(_0x4116d9,_0x48b811,_0x1c48a5){var _0x468df5={};var _0x202c64={};var _0x431e7d;var _0x57e314;return db[_0x2d17('0x3e')][_0x2d17('0x4c')]({'where':{'id':_0x4116d9['params']['id']}})['then'](handleEntityNotFound(_0x48b811,null))['then'](function(_0x3faf7a){if(_0x3faf7a){_0x431e7d=_0x3faf7a;_0x202c64[_0x2d17('0x29')]=_[_0x2d17('0x2a')](db[_0x2d17('0x51')][_0x2d17('0x28')]);_0x202c64[_0x2d17('0x2c')]=_['keys'](_0x4116d9['query']);_0x202c64[_0x2d17('0x2e')]=_[_0x2d17('0x2f')](_0x202c64[_0x2d17('0x29')],_0x202c64['query']);_0x468df5[_0x2d17('0x31')]=_[_0x2d17('0x2f')](_0x202c64[_0x2d17('0x29')],qs[_0x2d17('0x30')](_0x4116d9[_0x2d17('0x2c')]['fields']));_0x468df5[_0x2d17('0x31')]=_0x468df5[_0x2d17('0x31')][_0x2d17('0x32')]?_0x468df5[_0x2d17('0x31')]:_0x202c64[_0x2d17('0x29')];_0x468df5['order']=qs[_0x2d17('0x36')](_0x4116d9[_0x2d17('0x2c')]['sort']);_0x468df5[_0x2d17('0x37')]=qs[_0x2d17('0x2e')](_[_0x2d17('0x38')](_0x4116d9['query'],_0x202c64[_0x2d17('0x2e')]));if(_0x4116d9[_0x2d17('0x2c')]['filter']){_0x468df5[_0x2d17('0x37')]=_[_0x2d17('0x3b')](_0x468df5[_0x2d17('0x37')],{'$or':_[_0x2d17('0x3c')](_0x468df5['attributes'],function(_0x962012){var _0x2e8b30={};_0x2e8b30[_0x962012]={'$like':'%'+_0x4116d9[_0x2d17('0x2c')][_0x2d17('0x50')]+'%'};return _0x2e8b30;})});}_0x468df5=_['merge']({},_0x468df5,_0x4116d9[_0x2d17('0x3d')]);return _0x431e7d[_0x2d17('0x68')](_0x468df5);}})['then'](function(_0x535efc){if(_0x535efc){_0x57e314=_0x535efc[_0x2d17('0x32')];if(!_0x4116d9['query']['hasOwnProperty'](_0x2d17('0x34'))){_0x468df5['limit']=qs['limit'](_0x4116d9['query'][_0x2d17('0x1a')]);_0x468df5[_0x2d17('0x19')]=qs[_0x2d17('0x19')](_0x4116d9['query']['offset']);}return _0x431e7d[_0x2d17('0x68')](_0x468df5);}})[_0x2d17('0x22')](function(_0xb435ba){if(_0xb435ba){return _0xb435ba?{'count':_0x57e314,'rows':_0xb435ba}:null;}})[_0x2d17('0x22')](respondWithResult(_0x48b811,null))[_0x2d17('0x43')](handleError(_0x48b811,null));}; \ No newline at end of file +var _0xc2e2=['crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','index','MailQueue','keys','dateStart','query','dateEnd','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','add','day','merge','filter','map','options','count','include','findAll','catch','show','params','length','includeAll','find','create','body','describe','getMembers','get','UserMailQueue','rawAttributes','pick','MailQueueId','User','findAndCountAll','UserId','agent','name','mailPause','createdAt','rows','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','ids','Agents','union','addAgents','penalty','removeTeams','removeAgents','omit','emit','isArray','userMailQueue:remove','getAgents','eml-format','rimraf','request-promise','util','path','to-csv','lodash','squel'];(function(_0x4695e2,_0x3d5f15){var _0x160563=function(_0x5df0a2){while(--_0x5df0a2){_0x4695e2['push'](_0x4695e2['shift']());}};_0x160563(++_0x3d5f15);}(_0xc2e2,0x194));var _0x2c2e=function(_0x48ca18,_0x5232ed){_0x48ca18=_0x48ca18-0x0;var _0x5a4c8a=_0xc2e2[_0x48ca18];return _0x5a4c8a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2c2e('0x0'));var rimraf=require(_0x2c2e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2c2e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2c2e('0x3'));var path=require(_0x2c2e('0x4'));var sox=require('sox');var csv=require(_0x2c2e('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2c2e('0x6'));var squel=require(_0x2c2e('0x7'));var crypto=require(_0x2c2e('0x8'));var jsforce=require(_0x2c2e('0x9'));var deskjs=require(_0x2c2e('0xa'));var toCsv=require(_0x2c2e('0x5'));var querystring=require(_0x2c2e('0xb'));var Papa=require(_0x2c2e('0xc'));var Redis=require('ioredis');var qs=require(_0x2c2e('0xd'));var logger=require(_0x2c2e('0xe'))(_0x2c2e('0xf'));var utils=require(_0x2c2e('0x10'));var config=require(_0x2c2e('0x11'));var db=require(_0x2c2e('0x12'))['db'];config[_0x2c2e('0x13')]=_[_0x2c2e('0x14')](config[_0x2c2e('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x2c2e('0x15'))(new Redis(config[_0x2c2e('0x13')]));require('./mailQueue.socket')['register'](socket);function respondWithStatusCode(_0x4bcc0b,_0x4a9fb9){_0x4a9fb9=_0x4a9fb9||0xcc;return function(_0x5cc920){if(_0x5cc920){return _0x4bcc0b[_0x2c2e('0x16')](_0x4a9fb9);}return _0x4bcc0b[_0x2c2e('0x17')](_0x4a9fb9)[_0x2c2e('0x18')]();};}function respondWithResult(_0x33193c,_0x304d49){_0x304d49=_0x304d49||0xc8;return function(_0x415d7c){if(_0x415d7c){return _0x33193c[_0x2c2e('0x17')](_0x304d49)[_0x2c2e('0x19')](_0x415d7c);}};}function respondWithFilteredResult(_0x2c3a31,_0x23b143){return function(_0x2f4ecf){if(_0x2f4ecf){var _0x2b4db0=_0x2f4ecf['count'],_0x4de6d6=_0x23b143[_0x2c2e('0x1a')],_0x2d2203=_0x23b143[_0x2c2e('0x1a')]+_0x23b143[_0x2c2e('0x1b')],_0x48c8f4;if(_0x2d2203>=_0x2b4db0){_0x2d2203=_0x2b4db0;_0x48c8f4=0xc8;}else{_0x48c8f4=0xce;}_0x2c3a31[_0x2c2e('0x17')](_0x48c8f4);return _0x2c3a31[_0x2c2e('0x1c')]('Content-Range',_0x4de6d6+'-'+_0x2d2203+'/'+_0x2b4db0)[_0x2c2e('0x19')](_0x2f4ecf);}return null;};}function patchUpdates(_0x2ce2e0){return function(_0x15f60b){try{jsonpatch[_0x2c2e('0x1d')](_0x15f60b,_0x2ce2e0,!![]);}catch(_0x1eb102){return BPromise[_0x2c2e('0x1e')](_0x1eb102);}return _0x15f60b[_0x2c2e('0x1f')]();};}function saveUpdates(_0x7a67e4,_0xab096b){return function(_0x4d35b4){if(_0x4d35b4){return _0x4d35b4[_0x2c2e('0x20')](_0x7a67e4)[_0x2c2e('0x21')](function(_0x320fdc){return _0x320fdc;});}return null;};}function removeEntity(_0x1271c8,_0x147781){return function(_0x97e7f9){if(_0x97e7f9){return _0x97e7f9[_0x2c2e('0x22')]()[_0x2c2e('0x21')](function(){_0x1271c8[_0x2c2e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x324ca9,_0x99e929){return function(_0xdfc0cd){if(!_0xdfc0cd){_0x324ca9[_0x2c2e('0x16')](0x194);}return _0xdfc0cd;};}function handleError(_0x17ae52,_0xef373c){_0xef373c=_0xef373c||0x1f4;return function(_0x42612a){logger[_0x2c2e('0x23')](_0x42612a[_0x2c2e('0x24')]);if(_0x42612a['name']){delete _0x42612a['name'];}_0x17ae52[_0x2c2e('0x17')](_0xef373c)['send'](_0x42612a);};}exports[_0x2c2e('0x25')]=function(_0x2c3b36,_0x37a2b2){var _0x4370be={},_0x356f75={},_0x356a5={'count':0x0,'rows':[]};var _0x2614a2=db[_0x2c2e('0x26')]['rawAttributes'];_0x356f75['model']=_[_0x2c2e('0x27')](_0x2614a2);var _0x200cea={'dateStart':_0x2c3b36['query'][_0x2c2e('0x28')],'dateEnd':_0x2c3b36[_0x2c2e('0x29')][_0x2c2e('0x2a')]};delete _0x2c3b36[_0x2c2e('0x29')][_0x2c2e('0x28')];delete _0x2c3b36[_0x2c2e('0x29')][_0x2c2e('0x2a')];_0x356f75[_0x2c2e('0x29')]=_['keys'](_0x2c3b36[_0x2c2e('0x29')]);_0x356f75[_0x2c2e('0x2b')]=_[_0x2c2e('0x2c')](_0x356f75[_0x2c2e('0x2d')],_0x356f75['query']);_0x4370be['attributes']=_['intersection'](_0x356f75['model'],qs['fields'](_0x2c3b36[_0x2c2e('0x29')][_0x2c2e('0x2e')]));_0x4370be[_0x2c2e('0x2f')]=_0x4370be['attributes']['length']?_0x4370be['attributes']:_0x356f75[_0x2c2e('0x2d')];if(!_0x2c3b36[_0x2c2e('0x29')][_0x2c2e('0x30')](_0x2c2e('0x31'))){_0x4370be[_0x2c2e('0x1b')]=qs[_0x2c2e('0x1b')](_0x2c3b36[_0x2c2e('0x29')]['limit']);_0x4370be['offset']=qs[_0x2c2e('0x1a')](_0x2c3b36['query'][_0x2c2e('0x1a')]);}_0x4370be[_0x2c2e('0x32')]=qs['sort'](_0x2c3b36[_0x2c2e('0x29')][_0x2c2e('0x33')]);_0x4370be[_0x2c2e('0x34')]=qs[_0x2c2e('0x2b')](_['pick'](_0x2c3b36['query'],_0x356f75[_0x2c2e('0x2b')]));if(_0x200cea[_0x2c2e('0x28')]){if(_0x200cea[_0x2c2e('0x2a')]){_0x200cea[_0x2c2e('0x2a')]=moment(_0x200cea[_0x2c2e('0x2a')])[_0x2c2e('0x35')](0x1,_0x2c2e('0x36'));}else{_0x200cea[_0x2c2e('0x2a')]=moment(_0x200cea[_0x2c2e('0x28')])[_0x2c2e('0x35')](0x1,_0x2c2e('0x36'));}_[_0x2c2e('0x37')](_0x4370be['where'],{'createdAt':{'$gte':_0x200cea[_0x2c2e('0x28')],'$lte':_0x200cea['dateEnd']}});}if(_0x2c3b36[_0x2c2e('0x29')][_0x2c2e('0x38')]){_0x4370be[_0x2c2e('0x34')]=_[_0x2c2e('0x37')](_0x4370be[_0x2c2e('0x34')],{'$or':_[_0x2c2e('0x39')](_0x4370be[_0x2c2e('0x2f')],function(_0x2f27ba){var _0x3cf66e={};_0x3cf66e[_0x2f27ba]={'$like':'%'+_0x2c3b36[_0x2c2e('0x29')][_0x2c2e('0x38')]+'%'};return _0x3cf66e;})});}_0x4370be=_[_0x2c2e('0x37')]({},_0x4370be,_0x2c3b36[_0x2c2e('0x3a')]);var _0x2f15d5={'where':_0x4370be['where']};return db['MailQueue'][_0x2c2e('0x3b')](_0x2f15d5)[_0x2c2e('0x21')](function(_0x3979d6){_0x356a5[_0x2c2e('0x3b')]=_0x3979d6;if(_0x2c3b36[_0x2c2e('0x29')]['includeAll']){_0x4370be[_0x2c2e('0x3c')]=[{'all':!![]}];}return db['MailQueue'][_0x2c2e('0x3d')](_0x4370be);})[_0x2c2e('0x21')](function(_0x3164a9){_0x356a5['rows']=_0x3164a9;return _0x356a5;})[_0x2c2e('0x21')](respondWithFilteredResult(_0x37a2b2,_0x4370be))[_0x2c2e('0x3e')](handleError(_0x37a2b2,null));};exports[_0x2c2e('0x3f')]=function(_0x3597dc,_0x324daf){var _0x4ecda2={'raw':!![],'where':{'id':_0x3597dc[_0x2c2e('0x40')]['id']}},_0x1a16c6={};_0x1a16c6[_0x2c2e('0x2d')]=_[_0x2c2e('0x27')](db[_0x2c2e('0x26')]['rawAttributes']);_0x1a16c6[_0x2c2e('0x29')]=_[_0x2c2e('0x27')](_0x3597dc[_0x2c2e('0x29')]);_0x1a16c6['filters']=_['intersection'](_0x1a16c6[_0x2c2e('0x2d')],_0x1a16c6['query']);_0x4ecda2[_0x2c2e('0x2f')]=_[_0x2c2e('0x2c')](_0x1a16c6[_0x2c2e('0x2d')],qs[_0x2c2e('0x2e')](_0x3597dc[_0x2c2e('0x29')][_0x2c2e('0x2e')]));_0x4ecda2[_0x2c2e('0x2f')]=_0x4ecda2[_0x2c2e('0x2f')][_0x2c2e('0x41')]?_0x4ecda2['attributes']:_0x1a16c6[_0x2c2e('0x2d')];if(_0x3597dc[_0x2c2e('0x29')][_0x2c2e('0x42')]){_0x4ecda2[_0x2c2e('0x3c')]=[{'all':!![]}];}_0x4ecda2=_['merge']({},_0x4ecda2,_0x3597dc[_0x2c2e('0x3a')]);return db['MailQueue'][_0x2c2e('0x43')](_0x4ecda2)[_0x2c2e('0x21')](handleEntityNotFound(_0x324daf,null))[_0x2c2e('0x21')](respondWithResult(_0x324daf,null))[_0x2c2e('0x3e')](handleError(_0x324daf,null));};exports['create']=function(_0x1f85ba,_0x45ab24){return db[_0x2c2e('0x26')][_0x2c2e('0x44')](_0x1f85ba['body'],{})[_0x2c2e('0x21')](respondWithResult(_0x45ab24,0xc9))[_0x2c2e('0x3e')](handleError(_0x45ab24,null));};exports[_0x2c2e('0x20')]=function(_0x438cb9,_0x19ce22){if(_0x438cb9[_0x2c2e('0x45')]['id']){delete _0x438cb9[_0x2c2e('0x45')]['id'];}return db[_0x2c2e('0x26')]['find']({'where':{'id':_0x438cb9[_0x2c2e('0x40')]['id']}})[_0x2c2e('0x21')](handleEntityNotFound(_0x19ce22,null))['then'](saveUpdates(_0x438cb9[_0x2c2e('0x45')],null))[_0x2c2e('0x21')](respondWithResult(_0x19ce22,null))[_0x2c2e('0x3e')](handleError(_0x19ce22,null));};exports[_0x2c2e('0x22')]=function(_0x38bb16,_0x2b134e){return db[_0x2c2e('0x26')][_0x2c2e('0x43')]({'where':{'id':_0x38bb16[_0x2c2e('0x40')]['id']}})[_0x2c2e('0x21')](handleEntityNotFound(_0x2b134e,null))[_0x2c2e('0x21')](removeEntity(_0x2b134e,null))[_0x2c2e('0x3e')](handleError(_0x2b134e,null));};exports[_0x2c2e('0x46')]=function(_0x2e2dc8,_0x2e7fce){return db['MailQueue'][_0x2c2e('0x46')]()[_0x2c2e('0x21')](respondWithResult(_0x2e7fce,null))['catch'](handleError(_0x2e7fce,null));};exports[_0x2c2e('0x47')]=function(_0x26669d,_0x4245f3,_0x39d073){var _0x488f35={'raw':!![],'where':{}},_0x35374e={},_0x1afe4e;return db[_0x2c2e('0x26')]['findOne']({'where':{'id':_0x26669d['params']['id']}})[_0x2c2e('0x21')](handleEntityNotFound(_0x4245f3,null))['then'](function(_0x57eb20){if(_0x57eb20){_0x1afe4e=_0x57eb20[_0x2c2e('0x48')]({'plain':!![]});_0x35374e[_0x2c2e('0x2d')]=_[_0x2c2e('0x27')](db[_0x2c2e('0x49')][_0x2c2e('0x4a')]);_0x35374e[_0x2c2e('0x29')]=_[_0x2c2e('0x27')](_0x26669d[_0x2c2e('0x29')]);_0x35374e[_0x2c2e('0x2b')]=_[_0x2c2e('0x2c')](_0x35374e['model'],_0x35374e[_0x2c2e('0x29')]);_0x488f35['attributes']=_[_0x2c2e('0x2c')](_0x35374e[_0x2c2e('0x2d')],qs[_0x2c2e('0x2e')](_0x26669d[_0x2c2e('0x29')][_0x2c2e('0x2e')]));_0x488f35[_0x2c2e('0x2f')]=_0x488f35[_0x2c2e('0x2f')]['length']?_0x488f35[_0x2c2e('0x2f')]:_0x35374e[_0x2c2e('0x2d')];if(!_0x26669d[_0x2c2e('0x29')][_0x2c2e('0x30')]('nolimit')){_0x488f35[_0x2c2e('0x1b')]=qs[_0x2c2e('0x1b')](_0x26669d[_0x2c2e('0x29')][_0x2c2e('0x1b')]);_0x488f35[_0x2c2e('0x1a')]=qs[_0x2c2e('0x1a')](_0x26669d[_0x2c2e('0x29')][_0x2c2e('0x1a')]);}_0x488f35[_0x2c2e('0x32')]=qs['sort'](_0x26669d[_0x2c2e('0x29')][_0x2c2e('0x33')]);_0x488f35[_0x2c2e('0x34')]=qs[_0x2c2e('0x2b')](_[_0x2c2e('0x4b')](_0x26669d['query'],_0x35374e['filters']));_0x488f35[_0x2c2e('0x34')][_0x2c2e('0x4c')]=_0x57eb20['id'];if(_0x26669d[_0x2c2e('0x29')][_0x2c2e('0x38')]){_0x488f35['where']=_[_0x2c2e('0x37')](_0x488f35[_0x2c2e('0x34')],{'$or':_[_0x2c2e('0x39')](_0x488f35['attributes'],function(_0x5f38ee){var _0x4cbb59={};_0x4cbb59[_0x5f38ee]={'$like':'%'+_0x26669d[_0x2c2e('0x29')]['filter']+'%'};return _0x4cbb59;})});}_0x488f35=_[_0x2c2e('0x37')]({},_0x488f35,_0x26669d[_0x2c2e('0x3a')]);return db[_0x2c2e('0x49')]['findAll'](_0x488f35);}})[_0x2c2e('0x21')](function(_0x1d3835){if(_0x1d3835){return db[_0x2c2e('0x4d')][_0x2c2e('0x4e')]({'where':{'id':_[_0x2c2e('0x39')](_0x1d3835,_0x2c2e('0x4f')),'role':_0x2c2e('0x50')},'attributes':['id',_0x2c2e('0x51'),_0x2c2e('0x52'),'updatedAt',_0x2c2e('0x53')]});}})['then'](function(_0x37a9f1){if(_0x37a9f1){return{'count':_0x37a9f1[_0x2c2e('0x3b')],'rows':_[_0x2c2e('0x39')](_0x37a9f1[_0x2c2e('0x54')],function(_0x22d208){return{'membername':_0x22d208[_0x2c2e('0x51')],'UserId':_0x22d208['id'],'queue_name':_0x1afe4e[_0x2c2e('0x51')],'MailQueueId':_0x1afe4e['id'],'interface':util['format'](_0x2c2e('0x55'),_0x2c2e('0x56'),_0x22d208[_0x2c2e('0x51')]),'penalty':0x0,'paused':_0x22d208[_0x2c2e('0x52')],'createdAt':_0x22d208[_0x2c2e('0x53')],'updatedAt':_0x22d208[_0x2c2e('0x57')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4245f3,_0x488f35))[_0x2c2e('0x3e')](handleError(_0x4245f3,null));};exports[_0x2c2e('0x58')]=function(_0x2cf310,_0x353f8c,_0x505098){var _0x38f5cd={};var _0x99b6f8={};var _0x1b037d;var _0x5d90d4;return db[_0x2c2e('0x26')]['findOne']({'where':{'id':_0x2cf310['params']['id']}})[_0x2c2e('0x21')](handleEntityNotFound(_0x353f8c,null))[_0x2c2e('0x21')](function(_0x518c60){if(_0x518c60){_0x1b037d=_0x518c60;_0x99b6f8[_0x2c2e('0x2d')]=_['keys'](db[_0x2c2e('0x59')][_0x2c2e('0x4a')]);_0x99b6f8[_0x2c2e('0x29')]=_['keys'](_0x2cf310[_0x2c2e('0x29')]);_0x99b6f8[_0x2c2e('0x2b')]=_[_0x2c2e('0x2c')](_0x99b6f8[_0x2c2e('0x2d')],_0x99b6f8[_0x2c2e('0x29')]);_0x38f5cd[_0x2c2e('0x2f')]=_[_0x2c2e('0x2c')](_0x99b6f8[_0x2c2e('0x2d')],qs['fields'](_0x2cf310[_0x2c2e('0x29')][_0x2c2e('0x2e')]));_0x38f5cd['attributes']=_0x38f5cd['attributes'][_0x2c2e('0x41')]?_0x38f5cd[_0x2c2e('0x2f')]:_0x99b6f8[_0x2c2e('0x2d')];_0x38f5cd['order']=qs['sort'](_0x2cf310[_0x2c2e('0x29')]['sort']);_0x38f5cd[_0x2c2e('0x34')]=qs['filters'](_[_0x2c2e('0x4b')](_0x2cf310[_0x2c2e('0x29')],_0x99b6f8[_0x2c2e('0x2b')]));if(_0x2cf310['query'][_0x2c2e('0x38')]){_0x38f5cd[_0x2c2e('0x34')]=_['merge'](_0x38f5cd[_0x2c2e('0x34')],{'$or':_['map'](_0x38f5cd[_0x2c2e('0x2f')],function(_0x1dc0e3){var _0x2bb2ea={};_0x2bb2ea[_0x1dc0e3]={'$like':'%'+_0x2cf310[_0x2c2e('0x29')]['filter']+'%'};return _0x2bb2ea;})});}_0x38f5cd=_[_0x2c2e('0x37')]({},_0x38f5cd,_0x2cf310[_0x2c2e('0x3a')]);return _0x1b037d['getTeams'](_0x38f5cd);}})[_0x2c2e('0x21')](function(_0x139ed9){if(_0x139ed9){_0x5d90d4=_0x139ed9[_0x2c2e('0x41')];if(!_0x2cf310[_0x2c2e('0x29')][_0x2c2e('0x30')](_0x2c2e('0x31'))){_0x38f5cd['limit']=qs[_0x2c2e('0x1b')](_0x2cf310[_0x2c2e('0x29')][_0x2c2e('0x1b')]);_0x38f5cd[_0x2c2e('0x1a')]=qs['offset'](_0x2cf310[_0x2c2e('0x29')][_0x2c2e('0x1a')]);}return _0x1b037d[_0x2c2e('0x58')](_0x38f5cd);}})['then'](function(_0x3d68ff){if(_0x3d68ff){return _0x3d68ff?{'count':_0x5d90d4,'rows':_0x3d68ff}:null;}})[_0x2c2e('0x21')](respondWithResult(_0x353f8c,null))[_0x2c2e('0x3e')](handleError(_0x353f8c,null));};exports[_0x2c2e('0x5a')]=function(_0x1fd079,_0x210d1d,_0x175da3){var _0x35c235=[];var _0x4390d7;return db[_0x2c2e('0x59')][_0x2c2e('0x3d')]({'where':{'id':_0x1fd079['body'][_0x2c2e('0x5b')]},'attributes':['id'],'include':[{'model':db[_0x2c2e('0x4d')],'as':_0x2c2e('0x5c'),'attributes':['id'],'raw':!![]}]})[_0x2c2e('0x21')](function(_0x49ed7d){if(_0x49ed7d){for(var _0x590387=0x0;_0x590387<_0x49ed7d[_0x2c2e('0x41')];_0x590387+=0x1){for(var _0x225101=0x0;_0x225101<_0x49ed7d[_0x590387][_0x2c2e('0x5c')][_0x2c2e('0x41')];_0x225101+=0x1){_0x35c235=_[_0x2c2e('0x5d')](_0x35c235,[_0x49ed7d[_0x590387][_0x2c2e('0x5c')][_0x225101]['id']]);}}return _0x35c235;}})[_0x2c2e('0x21')](function(_0x51ea29){if(_0x51ea29){return db[_0x2c2e('0x26')][_0x2c2e('0x43')]({'where':{'id':_0x1fd079[_0x2c2e('0x40')]['id']}});}})[_0x2c2e('0x21')](function(_0xf78384){if(_0xf78384){_0x4390d7=_0xf78384;return _0x4390d7[_0x2c2e('0x5e')](_0x35c235,{'penalty':_0x1fd079[_0x2c2e('0x45')][_0x2c2e('0x5f')]});}})[_0x2c2e('0x21')](function(_0x489900){if(_0x489900){return _0x4390d7[_0x2c2e('0x5a')](_0x1fd079[_0x2c2e('0x45')][_0x2c2e('0x5b')]);}})['then'](handleEntityNotFound(_0x210d1d,null))[_0x2c2e('0x21')](respondWithStatusCode(_0x210d1d,null))['catch'](handleError(_0x210d1d,null));};exports[_0x2c2e('0x60')]=function(_0x2c1d5c,_0x3af214,_0x3e6035){var _0x18eb9c=[];var _0x52a1be;return db['Team'][_0x2c2e('0x3d')]({'where':{'id':_0x2c1d5c[_0x2c2e('0x29')][_0x2c2e('0x5b')]},'attributes':['id'],'include':[{'model':db[_0x2c2e('0x4d')],'as':_0x2c2e('0x5c'),'attributes':['id'],'raw':!![]}]})[_0x2c2e('0x21')](function(_0x50d4de){if(_0x50d4de){for(var _0xe223a1=0x0;_0xe223a1<_0x50d4de[_0x2c2e('0x41')];_0xe223a1+=0x1){for(var _0x573eb0=0x0;_0x573eb0<_0x50d4de[_0xe223a1][_0x2c2e('0x5c')][_0x2c2e('0x41')];_0x573eb0+=0x1){_0x18eb9c=_[_0x2c2e('0x5d')](_0x18eb9c,[_0x50d4de[_0xe223a1][_0x2c2e('0x5c')][_0x573eb0]['id']]);}}return _0x18eb9c;}})['then'](function(_0x11e3e9){if(_0x11e3e9){return db[_0x2c2e('0x26')][_0x2c2e('0x43')]({'where':{'id':_0x2c1d5c[_0x2c2e('0x40')]['id']}});}})[_0x2c2e('0x21')](function(_0x3e89f1){if(_0x3e89f1){_0x52a1be=_0x3e89f1;return _0x52a1be[_0x2c2e('0x61')](_0x18eb9c);}})[_0x2c2e('0x21')](function(_0x354bfa){if(_0x52a1be){return _0x52a1be[_0x2c2e('0x60')](_0x2c1d5c['query'][_0x2c2e('0x5b')]);}})['then'](handleEntityNotFound(_0x3af214,null))[_0x2c2e('0x21')](respondWithStatusCode(_0x3af214,null))[_0x2c2e('0x3e')](handleError(_0x3af214,null));};exports[_0x2c2e('0x5e')]=function(_0x22f5e7,_0x30417d,_0x107c98){return db['MailQueue'][_0x2c2e('0x43')]({'where':{'id':_0x22f5e7['params']['id']}})['then'](handleEntityNotFound(_0x30417d,null))['then'](function(_0x2be7ce){if(_0x2be7ce){return _0x2be7ce[_0x2c2e('0x5e')](_0x22f5e7[_0x2c2e('0x45')]['ids'],_[_0x2c2e('0x62')](_0x22f5e7['body'],[_0x2c2e('0x5b'),'id'])||{})['spread'](function(_0x36852b){for(var _0x3d1855=0x0;_0x3d1855<_0x22f5e7[_0x2c2e('0x45')][_0x2c2e('0x5b')]['length'];_0x3d1855+=0x1){socket[_0x2c2e('0x63')]('userMailQueue:save',{'UserId':_0x22f5e7[_0x2c2e('0x45')]['ids'][_0x3d1855],'MailQueueId':_0x22f5e7[_0x2c2e('0x40')]['id']});}return _0x36852b;});}})[_0x2c2e('0x21')](respondWithResult(_0x30417d,null))[_0x2c2e('0x3e')](handleError(_0x30417d,null));};exports[_0x2c2e('0x61')]=function(_0x1a27a4,_0x427634,_0x4f187a){var _0x396a01;return db[_0x2c2e('0x26')]['find']({'where':{'id':_0x1a27a4[_0x2c2e('0x40')]['id']}})[_0x2c2e('0x21')](handleEntityNotFound(_0x427634,null))[_0x2c2e('0x21')](function(_0x494905){if(_0x494905){return _0x494905[_0x2c2e('0x61')](_0x1a27a4['query'][_0x2c2e('0x5b')])['then'](function(_0x28e70c){if(_[_0x2c2e('0x64')](_0x1a27a4[_0x2c2e('0x29')]['ids'])){for(var _0x20b9db=0x0;_0x20b9db<_0x1a27a4[_0x2c2e('0x29')][_0x2c2e('0x5b')][_0x2c2e('0x41')];_0x20b9db+=0x1){socket[_0x2c2e('0x63')](_0x2c2e('0x65'),{'UserId':_0x1a27a4[_0x2c2e('0x29')]['ids'][_0x20b9db],'MailQueueId':_0x1a27a4[_0x2c2e('0x40')]['id']});}}else{socket[_0x2c2e('0x63')](_0x2c2e('0x65'),{'UserId':_0x1a27a4['query']['ids'],'MailQueueId':_0x1a27a4[_0x2c2e('0x40')]['id']});}});}})[_0x2c2e('0x21')](respondWithStatusCode(_0x427634,null))[_0x2c2e('0x3e')](handleError(_0x427634,null));};exports[_0x2c2e('0x66')]=function(_0x511da6,_0x11138c,_0x4c16cf){var _0xd7a903={};var _0x2254a1={};var _0x534e9e;var _0x297da5;return db['MailQueue']['findOne']({'where':{'id':_0x511da6[_0x2c2e('0x40')]['id']}})['then'](handleEntityNotFound(_0x11138c,null))['then'](function(_0x240e2b){if(_0x240e2b){_0x534e9e=_0x240e2b;_0x2254a1[_0x2c2e('0x2d')]=_[_0x2c2e('0x27')](db[_0x2c2e('0x4d')][_0x2c2e('0x4a')]);_0x2254a1[_0x2c2e('0x29')]=_['keys'](_0x511da6[_0x2c2e('0x29')]);_0x2254a1[_0x2c2e('0x2b')]=_[_0x2c2e('0x2c')](_0x2254a1[_0x2c2e('0x2d')],_0x2254a1[_0x2c2e('0x29')]);_0xd7a903['attributes']=_[_0x2c2e('0x2c')](_0x2254a1[_0x2c2e('0x2d')],qs[_0x2c2e('0x2e')](_0x511da6[_0x2c2e('0x29')][_0x2c2e('0x2e')]));_0xd7a903[_0x2c2e('0x2f')]=_0xd7a903[_0x2c2e('0x2f')][_0x2c2e('0x41')]?_0xd7a903[_0x2c2e('0x2f')]:_0x2254a1['model'];_0xd7a903[_0x2c2e('0x32')]=qs['sort'](_0x511da6[_0x2c2e('0x29')]['sort']);_0xd7a903['where']=qs[_0x2c2e('0x2b')](_[_0x2c2e('0x4b')](_0x511da6['query'],_0x2254a1[_0x2c2e('0x2b')]));if(_0x511da6[_0x2c2e('0x29')]['filter']){_0xd7a903[_0x2c2e('0x34')]=_[_0x2c2e('0x37')](_0xd7a903['where'],{'$or':_[_0x2c2e('0x39')](_0xd7a903['attributes'],function(_0xdefd9f){var _0x2fa1ca={};_0x2fa1ca[_0xdefd9f]={'$like':'%'+_0x511da6[_0x2c2e('0x29')][_0x2c2e('0x38')]+'%'};return _0x2fa1ca;})});}_0xd7a903=_['merge']({},_0xd7a903,_0x511da6[_0x2c2e('0x3a')]);return _0x534e9e[_0x2c2e('0x66')](_0xd7a903);}})['then'](function(_0x11989e){if(_0x11989e){_0x297da5=_0x11989e['length'];if(!_0x511da6['query'][_0x2c2e('0x30')](_0x2c2e('0x31'))){_0xd7a903[_0x2c2e('0x1b')]=qs[_0x2c2e('0x1b')](_0x511da6[_0x2c2e('0x29')][_0x2c2e('0x1b')]);_0xd7a903[_0x2c2e('0x1a')]=qs[_0x2c2e('0x1a')](_0x511da6['query'][_0x2c2e('0x1a')]);}return _0x534e9e[_0x2c2e('0x66')](_0xd7a903);}})['then'](function(_0x3f2826){if(_0x3f2826){return _0x3f2826?{'count':_0x297da5,'rows':_0x3f2826}:null;}})['then'](respondWithResult(_0x11138c,null))[_0x2c2e('0x3e')](handleError(_0x11138c,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index a9c0bb9..7893e80 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 _0x52af=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x324666,_0x2c0fb5){var _0x1240db=function(_0x678b35){while(--_0x678b35){_0x324666['push'](_0x324666['shift']());}};_0x1240db(++_0x2c0fb5);}(_0x52af,0x1d1));var _0xf52a=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x52af[_0x5ddaac];return _0x2a9c58;};'use strict';var EventEmitter=require(_0xf52a('0x0'));var MailQueue=require(_0xf52a('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xf52a('0x2')](0x0);var events={'afterCreate':_0xf52a('0x3'),'afterUpdate':'update','afterDestroy':_0xf52a('0x4')};function emitEvent(_0x3f475d){return function(_0x2e9a81,_0x28fd53,_0x578b73){MailQueueEvents[_0xf52a('0x5')](_0x3f475d+':'+_0x2e9a81['id'],_0x2e9a81);MailQueueEvents[_0xf52a('0x5')](_0x3f475d,_0x2e9a81);_0x578b73(null);};}for(var e in events){if(events[_0xf52a('0x6')](e)){var event=events[e];MailQueue[_0xf52a('0x7')](e,emitEvent(event));}}module[_0xf52a('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x5c70=['hasOwnProperty','hook','exports','events','update','remove','emit'];(function(_0x2c88e2,_0x4fe992){var _0x203678=function(_0x6455e7){while(--_0x6455e7){_0x2c88e2['push'](_0x2c88e2['shift']());}};_0x203678(++_0x4fe992);}(_0x5c70,0x1ca));var _0x05c7=function(_0x1a122c,_0x46a6a2){_0x1a122c=_0x1a122c-0x0;var _0x53747d=_0x5c70[_0x1a122c];return _0x53747d;};'use strict';var EventEmitter=require(_0x05c7('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x05c7('0x1'),'afterDestroy':_0x05c7('0x2')};function emitEvent(_0x49fb02){return function(_0x5981b5,_0x153926,_0x78425){MailQueueEvents[_0x05c7('0x3')](_0x49fb02+':'+_0x5981b5['id'],_0x5981b5);MailQueueEvents[_0x05c7('0x3')](_0x49fb02,_0x5981b5);_0x78425(null);};}for(var e in events){if(events[_0x05c7('0x4')](e)){var event=events[e];MailQueue[_0x05c7('0x5')](e,emitEvent(event));}}module[_0x05c7('0x6')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 7f34630..203e8a3 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 _0xc890=['bluebird','request-promise','./mailQueue.attributes','define','mail_queues','lodash','util','../../config/logger','api'];(function(_0x2729b1,_0xa3f80b){var _0x213c36=function(_0x5f59dd){while(--_0x5f59dd){_0x2729b1['push'](_0x2729b1['shift']());}};_0x213c36(++_0xa3f80b);}(_0xc890,0x188));var _0x0c89=function(_0x314c7e,_0x216db0){_0x314c7e=_0x314c7e-0x0;var _0x5147cf=_0xc890[_0x314c7e];return _0x5147cf;};'use strict';var _=require(_0x0c89('0x0'));var util=require(_0x0c89('0x1'));var logger=require(_0x0c89('0x2'))(_0x0c89('0x3'));var moment=require('moment');var BPromise=require(_0x0c89('0x4'));var rp=require(_0x0c89('0x5'));var attributes=require(_0x0c89('0x6'));module['exports']=function(_0xb9bcc8,_0x1ba794){return _0xb9bcc8[_0x0c89('0x7')]('MailQueue',attributes,{'tableName':_0x0c89('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c83=['../../config/logger','api','bluebird','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','util'];(function(_0x2422c5,_0x263013){var _0x309c89=function(_0xbc7cd){while(--_0xbc7cd){_0x2422c5['push'](_0x2422c5['shift']());}};_0x309c89(++_0x263013);}(_0x0c83,0x13e));var _0x30c8=function(_0x526d33,_0x32fe3){_0x526d33=_0x526d33-0x0;var _0x31a7b7=_0x0c83[_0x526d33];return _0x31a7b7;};'use strict';var _=require(_0x30c8('0x0'));var util=require(_0x30c8('0x1'));var logger=require(_0x30c8('0x2'))(_0x30c8('0x3'));var moment=require('moment');var BPromise=require(_0x30c8('0x4'));var rp=require('request-promise');var attributes=require(_0x30c8('0x5'));module[_0x30c8('0x6')]=function(_0x3acc2d,_0x18733b){return _0x3acc2d[_0x30c8('0x7')](_0x30c8('0x8'),attributes,{'tableName':_0x30c8('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 98e853a..2d4bd56 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 _0xf55c=['MailQueue','findAll','options','raw','where','attributes','limit','map','include','model','catch','ShowMailQueue','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./mailQueue.socket','register','request','then','info','debug','error','MailQueue,\x20%s,\x20%s','message','result','GetMailQueue'];(function(_0x4804d7,_0x56ef10){var _0x532259=function(_0x5929e3){while(--_0x5929e3){_0x4804d7['push'](_0x4804d7['shift']());}};_0x532259(++_0x56ef10);}(_0xf55c,0xe4));var _0xcf55=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xf55c[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0xcf55('0x0'));var util=require(_0xcf55('0x1'));var moment=require(_0xcf55('0x2'));var BPromise=require('bluebird');var rs=require(_0xcf55('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcf55('0x4'))['db'];var utils=require(_0xcf55('0x5'));var logger=require(_0xcf55('0x6'))(_0xcf55('0x7'));var config=require(_0xcf55('0x8'));var jayson=require(_0xcf55('0x9'));var client=jayson[_0xcf55('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xcf55('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xcf55('0xc'))(new Redis(config[_0xcf55('0xb')]));require(_0xcf55('0xd'))[_0xcf55('0xe')](socket);function respondWithRpcPromise(_0x424f0f,_0x5d34f7,_0x9a6bd2){return new BPromise(function(_0x2e2e7f,_0x113f4a){return client[_0xcf55('0xf')](_0x424f0f,_0x9a6bd2)[_0xcf55('0x10')](function(_0x4ddf68){logger[_0xcf55('0x11')]('MailQueue,\x20%s,\x20%s',_0x5d34f7,'request\x20sent');logger[_0xcf55('0x12')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x5d34f7,'request\x20sent',JSON['stringify'](_0x4ddf68));if(_0x4ddf68[_0xcf55('0x13')]){if(_0x4ddf68['error']['code']===0x1f4){logger['error'](_0xcf55('0x14'),_0x5d34f7,_0x4ddf68[_0xcf55('0x13')][_0xcf55('0x15')]);return _0x113f4a(_0x4ddf68[_0xcf55('0x13')][_0xcf55('0x15')]);}logger['error'](_0xcf55('0x14'),_0x5d34f7,_0x4ddf68['error'][_0xcf55('0x15')]);return _0x2e2e7f(_0x4ddf68['error']['message']);}else{logger['info'](_0xcf55('0x14'),_0x5d34f7,'request\x20sent');_0x2e2e7f(_0x4ddf68[_0xcf55('0x16')][_0xcf55('0x15')]);}})['catch'](function(_0x404e3a){logger[_0xcf55('0x13')](_0xcf55('0x14'),_0x5d34f7,_0x404e3a);_0x113f4a(_0x404e3a);});});}exports[_0xcf55('0x17')]=function(_0x3228b9){var _0x53781f=this;return new Promise(function(_0x29d79a,_0x3c69d2){return db[_0xcf55('0x18')][_0xcf55('0x19')]({'raw':_0x3228b9[_0xcf55('0x1a')]?_0x3228b9['options'][_0xcf55('0x1b')]===undefined?!![]:![]:!![],'where':_0x3228b9[_0xcf55('0x1a')]?_0x3228b9[_0xcf55('0x1a')][_0xcf55('0x1c')]||null:null,'attributes':_0x3228b9[_0xcf55('0x1a')]?_0x3228b9[_0xcf55('0x1a')][_0xcf55('0x1d')]||null:null,'limit':_0x3228b9[_0xcf55('0x1a')]?_0x3228b9['options'][_0xcf55('0x1e')]||null:null,'include':_0x3228b9['options']?_0x3228b9[_0xcf55('0x1a')]['include']?_[_0xcf55('0x1f')](_0x3228b9[_0xcf55('0x1a')][_0xcf55('0x20')],function(_0x452313){return{'model':db[_0x452313[_0xcf55('0x21')]],'as':_0x452313['as'],'attributes':_0x452313[_0xcf55('0x1d')],'include':_0x452313[_0xcf55('0x20')]?_['map'](_0x452313[_0xcf55('0x20')],function(_0x1e05f4){return{'model':db[_0x1e05f4[_0xcf55('0x21')]],'as':_0x1e05f4['as'],'attributes':_0x1e05f4['attributes'],'include':_0x1e05f4[_0xcf55('0x20')]?_['map'](_0x1e05f4[_0xcf55('0x20')],function(_0x287c32){return{'model':db[_0x287c32[_0xcf55('0x21')]],'as':_0x287c32['as'],'attributes':_0x287c32['attributes']};}):[]};}):[]};}):[]:[]})[_0xcf55('0x10')](function(_0xafe602){logger[_0xcf55('0x11')]('GetMailQueue',_0x3228b9);logger[_0xcf55('0x12')](_0xcf55('0x17'),_0x3228b9,JSON['stringify'](_0xafe602));_0x29d79a(_0xafe602);})[_0xcf55('0x22')](function(_0x55d7bd){logger[_0xcf55('0x13')](_0xcf55('0x17'),_0x55d7bd[_0xcf55('0x15')],_0x3228b9);_0x3c69d2(_0x53781f[_0xcf55('0x13')](0x1f4,_0x55d7bd[_0xcf55('0x15')]));});});};exports[_0xcf55('0x23')]=function(_0x5d64dd){var _0x283225=this;return new Promise(function(_0x51108a,_0x575c74){return db[_0xcf55('0x18')]['find']({'raw':_0x5d64dd[_0xcf55('0x1a')]?_0x5d64dd[_0xcf55('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5d64dd[_0xcf55('0x1a')]?_0x5d64dd['options']['where']||null:null,'attributes':_0x5d64dd[_0xcf55('0x1a')]?_0x5d64dd[_0xcf55('0x1a')][_0xcf55('0x1d')]||null:null,'include':_0x5d64dd[_0xcf55('0x1a')]?_0x5d64dd['options'][_0xcf55('0x20')]?_['map'](_0x5d64dd['options'][_0xcf55('0x20')],function(_0x46b591){return{'model':db[_0x46b591[_0xcf55('0x21')]],'as':_0x46b591['as'],'attributes':_0x46b591['attributes'],'include':_0x46b591['include']?_[_0xcf55('0x1f')](_0x46b591['include'],function(_0x4ea805){return{'model':db[_0x4ea805[_0xcf55('0x21')]],'as':_0x4ea805['as'],'attributes':_0x4ea805['attributes'],'include':_0x4ea805['include']?_[_0xcf55('0x1f')](_0x4ea805[_0xcf55('0x20')],function(_0x540732){return{'model':db[_0x540732[_0xcf55('0x21')]],'as':_0x540732['as'],'attributes':_0x540732[_0xcf55('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcf55('0x10')](function(_0x3a867c){logger[_0xcf55('0x11')]('ShowMailQueue',_0x5d64dd);logger['debug']('ShowMailQueue',_0x5d64dd,JSON['stringify'](_0x3a867c));_0x51108a(_0x3a867c);})[_0xcf55('0x22')](function(_0x1a377b){logger[_0xcf55('0x13')](_0xcf55('0x23'),_0x1a377b[_0xcf55('0x15')],_0x5d64dd);_0x575c74(_0x283225['error'](0x1f4,_0x1a377b[_0xcf55('0x15')]));});});}; \ No newline at end of file +var _0xdda5=['stringify','error','code','MailQueue,\x20%s,\x20%s','message','GetMailQueue','MailQueue','findAll','options','where','attributes','limit','include','map','model','catch','ShowMailQueue','find','raw','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s'];(function(_0x56b6a4,_0x43420e){var _0x2e0035=function(_0x45599b){while(--_0x45599b){_0x56b6a4['push'](_0x56b6a4['shift']());}};_0x2e0035(++_0x43420e);}(_0xdda5,0xb3));var _0x5dda=function(_0x305d99,_0x4fa67e){_0x305d99=_0x305d99-0x0;var _0xc0a105=_0xdda5[_0x305d99];return _0xc0a105;};'use strict';var _=require(_0x5dda('0x0'));var util=require(_0x5dda('0x1'));var moment=require(_0x5dda('0x2'));var BPromise=require(_0x5dda('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5dda('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5dda('0x5'))(_0x5dda('0x6'));var config=require('../../config/environment');var jayson=require(_0x5dda('0x7'));var client=jayson[_0x5dda('0x8')][_0x5dda('0x9')]({'port':0x232a});config[_0x5dda('0xa')]=_['defaults'](config[_0x5dda('0xa')],{'host':_0x5dda('0xb'),'port':0x18eb});var socket=require(_0x5dda('0xc'))(new Redis(config['redis']));require(_0x5dda('0xd'))[_0x5dda('0xe')](socket);function respondWithRpcPromise(_0x5c9988,_0x38abee,_0x417dfd){return new BPromise(function(_0x166082,_0x4d15f7){return client[_0x5dda('0xf')](_0x5c9988,_0x417dfd)[_0x5dda('0x10')](function(_0x1eb761){logger[_0x5dda('0x11')]('MailQueue,\x20%s,\x20%s',_0x38abee,_0x5dda('0x12'));logger[_0x5dda('0x13')](_0x5dda('0x14'),_0x38abee,_0x5dda('0x12'),JSON[_0x5dda('0x15')](_0x1eb761));if(_0x1eb761['error']){if(_0x1eb761[_0x5dda('0x16')][_0x5dda('0x17')]===0x1f4){logger[_0x5dda('0x16')](_0x5dda('0x18'),_0x38abee,_0x1eb761[_0x5dda('0x16')][_0x5dda('0x19')]);return _0x4d15f7(_0x1eb761[_0x5dda('0x16')]['message']);}logger[_0x5dda('0x16')](_0x5dda('0x18'),_0x38abee,_0x1eb761[_0x5dda('0x16')][_0x5dda('0x19')]);return _0x166082(_0x1eb761['error'][_0x5dda('0x19')]);}else{logger[_0x5dda('0x11')](_0x5dda('0x18'),_0x38abee,_0x5dda('0x12'));_0x166082(_0x1eb761['result']['message']);}})['catch'](function(_0x3daca7){logger[_0x5dda('0x16')]('MailQueue,\x20%s,\x20%s',_0x38abee,_0x3daca7);_0x4d15f7(_0x3daca7);});});}exports[_0x5dda('0x1a')]=function(_0x1fa1bc){var _0xc9b5b7=this;return new Promise(function(_0x463f7e,_0x174751){return db[_0x5dda('0x1b')][_0x5dda('0x1c')]({'raw':_0x1fa1bc['options']?_0x1fa1bc[_0x5dda('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1fa1bc[_0x5dda('0x1d')]?_0x1fa1bc['options'][_0x5dda('0x1e')]||null:null,'attributes':_0x1fa1bc['options']?_0x1fa1bc[_0x5dda('0x1d')][_0x5dda('0x1f')]||null:null,'limit':_0x1fa1bc[_0x5dda('0x1d')]?_0x1fa1bc[_0x5dda('0x1d')][_0x5dda('0x20')]||null:null,'include':_0x1fa1bc[_0x5dda('0x1d')]?_0x1fa1bc[_0x5dda('0x1d')][_0x5dda('0x21')]?_[_0x5dda('0x22')](_0x1fa1bc[_0x5dda('0x1d')][_0x5dda('0x21')],function(_0x3c7b13){return{'model':db[_0x3c7b13[_0x5dda('0x23')]],'as':_0x3c7b13['as'],'attributes':_0x3c7b13[_0x5dda('0x1f')],'include':_0x3c7b13[_0x5dda('0x21')]?_[_0x5dda('0x22')](_0x3c7b13['include'],function(_0x473508){return{'model':db[_0x473508[_0x5dda('0x23')]],'as':_0x473508['as'],'attributes':_0x473508[_0x5dda('0x1f')],'include':_0x473508[_0x5dda('0x21')]?_[_0x5dda('0x22')](_0x473508[_0x5dda('0x21')],function(_0x163623){return{'model':db[_0x163623[_0x5dda('0x23')]],'as':_0x163623['as'],'attributes':_0x163623[_0x5dda('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x226dcc){logger[_0x5dda('0x11')]('GetMailQueue',_0x1fa1bc);logger['debug'](_0x5dda('0x1a'),_0x1fa1bc,JSON['stringify'](_0x226dcc));_0x463f7e(_0x226dcc);})[_0x5dda('0x24')](function(_0x2941f5){logger[_0x5dda('0x16')]('GetMailQueue',_0x2941f5[_0x5dda('0x19')],_0x1fa1bc);_0x174751(_0xc9b5b7[_0x5dda('0x16')](0x1f4,_0x2941f5[_0x5dda('0x19')]));});});};exports[_0x5dda('0x25')]=function(_0x3ccc08){var _0x39d94d=this;return new Promise(function(_0x3b9add,_0x4563d3){return db[_0x5dda('0x1b')][_0x5dda('0x26')]({'raw':_0x3ccc08[_0x5dda('0x1d')]?_0x3ccc08[_0x5dda('0x1d')][_0x5dda('0x27')]===undefined?!![]:![]:!![],'where':_0x3ccc08['options']?_0x3ccc08[_0x5dda('0x1d')][_0x5dda('0x1e')]||null:null,'attributes':_0x3ccc08['options']?_0x3ccc08[_0x5dda('0x1d')][_0x5dda('0x1f')]||null:null,'include':_0x3ccc08[_0x5dda('0x1d')]?_0x3ccc08['options']['include']?_['map'](_0x3ccc08[_0x5dda('0x1d')][_0x5dda('0x21')],function(_0x1d31c4){return{'model':db[_0x1d31c4['model']],'as':_0x1d31c4['as'],'attributes':_0x1d31c4['attributes'],'include':_0x1d31c4[_0x5dda('0x21')]?_['map'](_0x1d31c4['include'],function(_0x24fd2b){return{'model':db[_0x24fd2b[_0x5dda('0x23')]],'as':_0x24fd2b['as'],'attributes':_0x24fd2b['attributes'],'include':_0x24fd2b[_0x5dda('0x21')]?_['map'](_0x24fd2b[_0x5dda('0x21')],function(_0x4962a1){return{'model':db[_0x4962a1[_0x5dda('0x23')]],'as':_0x4962a1['as'],'attributes':_0x4962a1[_0x5dda('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5dda('0x10')](function(_0xe54ae7){logger[_0x5dda('0x11')](_0x5dda('0x25'),_0x3ccc08);logger['debug'](_0x5dda('0x25'),_0x3ccc08,JSON[_0x5dda('0x15')](_0xe54ae7));_0x3b9add(_0xe54ae7);})[_0x5dda('0x24')](function(_0x368f2f){logger[_0x5dda('0x16')](_0x5dda('0x25'),_0x368f2f['message'],_0x3ccc08);_0x4563d3(_0x39d94d[_0x5dda('0x16')](0x1f4,_0x368f2f[_0x5dda('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 8f7ddfa..c08aec2 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 _0x4883=['register','length','mailQueue:','./mailQueue.events','save','remove','update'];(function(_0x1f726f,_0x4348ef){var _0x5f5891=function(_0x5b2e93){while(--_0x5b2e93){_0x1f726f['push'](_0x1f726f['shift']());}};_0x5f5891(++_0x4348ef);}(_0x4883,0x65));var _0x3488=function(_0x19d9eb,_0xd3a7a5){_0x19d9eb=_0x19d9eb-0x0;var _0x181b9b=_0x4883[_0x19d9eb];return _0x181b9b;};'use strict';var MailQueueEvents=require(_0x3488('0x0'));var events=[_0x3488('0x1'),_0x3488('0x2'),_0x3488('0x3')];function createListener(_0x37fc2f,_0x47d1d3){return function(_0x217b8c){_0x47d1d3['emit'](_0x37fc2f,_0x217b8c);};}function removeListener(_0x282134,_0x4578e8){return function(){MailQueueEvents['removeListener'](_0x282134,_0x4578e8);};}exports[_0x3488('0x4')]=function(_0x358864){for(var _0x5141df=0x0,_0x440ef8=events[_0x3488('0x5')];_0x5141df<_0x440ef8;_0x5141df++){var _0x2d10f0=events[_0x5141df];var _0x4cdcfb=createListener(_0x3488('0x6')+_0x2d10f0,_0x358864);MailQueueEvents['on'](_0x2d10f0,_0x4cdcfb);}}; \ No newline at end of file +var _0x3b82=['emit','removeListener','register','mailQueue:','./mailQueue.events','update'];(function(_0x5ebe34,_0x421337){var _0x36a3ee=function(_0x1d3306){while(--_0x1d3306){_0x5ebe34['push'](_0x5ebe34['shift']());}};_0x36a3ee(++_0x421337);}(_0x3b82,0x124));var _0x23b8=function(_0x179a0c,_0x2ca073){_0x179a0c=_0x179a0c-0x0;var _0x1c8b9a=_0x3b82[_0x179a0c];return _0x1c8b9a;};'use strict';var MailQueueEvents=require(_0x23b8('0x0'));var events=['save','remove',_0x23b8('0x1')];function createListener(_0xc53576,_0x1fbf2a){return function(_0x53b86e){_0x1fbf2a[_0x23b8('0x2')](_0xc53576,_0x53b86e);};}function removeListener(_0x314c7c,_0x1e83b7){return function(){MailQueueEvents[_0x23b8('0x3')](_0x314c7c,_0x1e83b7);};}exports[_0x23b8('0x4')]=function(_0x350b8e){for(var _0x5245e2=0x0,_0x288f2e=events['length'];_0x5245e2<_0x288f2e;_0x5245e2++){var _0x511c31=events[_0x5245e2];var _0x4524df=createListener(_0x23b8('0x5')+_0x511c31,_0x350b8e);MailQueueEvents['on'](_0x511c31,_0x4524df);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index c1dfda7..1630993 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 _0x3152=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','index','get','isAuthenticated','describe','/:id','show','post','create','update','delete','multer'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3152,0xe3));var _0x2315=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x3152[_0x1969a7];return _0x3d665f;};'use strict';var multer=require(_0x2315('0x0'));var util=require(_0x2315('0x1'));var path=require(_0x2315('0x2'));var timeout=require('connect-timeout');var express=require(_0x2315('0x3'));var router=express[_0x2315('0x4')]();var auth=require(_0x2315('0x5'));var interaction=require(_0x2315('0x6'));var config=require(_0x2315('0x7'));var controller=require(_0x2315('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x2315('0x9')]);router[_0x2315('0xa')]('/describe',auth[_0x2315('0xb')](),controller[_0x2315('0xc')]);router['get'](_0x2315('0xd'),auth['isAuthenticated'](),controller[_0x2315('0xe')]);router[_0x2315('0xf')]('/',auth[_0x2315('0xb')](),controller[_0x2315('0x10')]);router['put'](_0x2315('0xd'),auth[_0x2315('0xb')](),controller[_0x2315('0x11')]);router[_0x2315('0x12')](_0x2315('0xd'),auth[_0x2315('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7428=['post','create','update','delete','/:id','destroy','exports','multer','util','../../components/auth/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index','get','/describe','describe'];(function(_0xeafb9f,_0xee9b93){var _0xd3b454=function(_0x3fb362){while(--_0x3fb362){_0xeafb9f['push'](_0xeafb9f['shift']());}};_0xd3b454(++_0xee9b93);}(_0x7428,0xc2));var _0x8742=function(_0x1cc967,_0x44e6d1){_0x1cc967=_0x1cc967-0x0;var _0x5a6121=_0x7428[_0x1cc967];return _0x5a6121;};'use strict';var multer=require(_0x8742('0x0'));var util=require(_0x8742('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x8742('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x8742('0x3'));var controller=require(_0x8742('0x4'));router['get']('/',auth[_0x8742('0x5')](),controller[_0x8742('0x6')]);router[_0x8742('0x7')](_0x8742('0x8'),auth[_0x8742('0x5')](),controller[_0x8742('0x9')]);router[_0x8742('0x7')]('/:id',auth[_0x8742('0x5')](),controller['show']);router[_0x8742('0xa')]('/',auth[_0x8742('0x5')](),controller[_0x8742('0xb')]);router['put']('/:id',auth[_0x8742('0x5')](),controller[_0x8742('0xc')]);router[_0x8742('0xd')](_0x8742('0xe'),auth[_0x8742('0x5')](),controller[_0x8742('0xf')]);module[_0x8742('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 261330f..f59c939 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 _0x9849=['DATE','moment','sequelize','exports','STRING'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x9849,0x155));var _0x9984=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x9849[_0x43d11d];return _0x38cd08;};'use strict';var moment=require(_0x9984('0x0'));var Sequelize=require(_0x9984('0x1'));module[_0x9984('0x2')]={'uniqueid':{'type':Sequelize[_0x9984('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x9984('0x4')]},'acceptAt':{'type':Sequelize[_0x9984('0x4')]},'exitAt':{'type':Sequelize[_0x9984('0x4')]},'reason':{'type':Sequelize[_0x9984('0x3')]}}; \ No newline at end of file +var _0x5c2e=['moment','exports','STRING','DATE'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x5c2e,0x124));var _0xe5c2=function(_0x1780f8,_0x11ba93){_0x1780f8=_0x1780f8-0x0;var _0x33a410=_0x5c2e[_0x1780f8];return _0x33a410;};'use strict';var moment=require(_0xe5c2('0x0'));var Sequelize=require('sequelize');module[_0xe5c2('0x1')]={'uniqueid':{'type':Sequelize[_0xe5c2('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xe5c2('0x2')]},'joinAt':{'type':Sequelize[_0xe5c2('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xe5c2('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 7b229ba..e6d6abd 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 _0xe35f=['api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','name','send','index','MailQueueReport','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','add','day','merge','filter','map','options','includeAll','include','rows','show','params','find','create','body','catch','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger'];(function(_0x414f63,_0x2d2538){var _0x436011=function(_0x4605a9){while(--_0x4605a9){_0x414f63['push'](_0x414f63['shift']());}};_0x436011(++_0x2d2538);}(_0xe35f,0xc6));var _0xfe35=function(_0xff9616,_0x3c3856){_0xff9616=_0xff9616-0x0;var _0x242724=_0xe35f[_0xff9616];return _0x242724;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xfe35('0x0'));var zipdir=require(_0xfe35('0x1'));var jsonpatch=require(_0xfe35('0x2'));var rp=require(_0xfe35('0x3'));var moment=require(_0xfe35('0x4'));var BPromise=require(_0xfe35('0x5'));var Mustache=require(_0xfe35('0x6'));var util=require(_0xfe35('0x7'));var path=require(_0xfe35('0x8'));var sox=require('sox');var csv=require(_0xfe35('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfe35('0xa'));var squel=require(_0xfe35('0xb'));var crypto=require(_0xfe35('0xc'));var jsforce=require(_0xfe35('0xd'));var deskjs=require(_0xfe35('0xe'));var toCsv=require(_0xfe35('0x9'));var querystring=require(_0xfe35('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var qs=require(_0xfe35('0x10'));var logger=require(_0xfe35('0x11'))(_0xfe35('0x12'));var utils=require(_0xfe35('0x13'));var config=require(_0xfe35('0x14'));var db=require(_0xfe35('0x15'))['db'];function respondWithStatusCode(_0x375f4c,_0x51f903){_0x51f903=_0x51f903||0xcc;return function(_0xf93f1c){if(_0xf93f1c){return _0x375f4c['sendStatus'](_0x51f903);}return _0x375f4c[_0xfe35('0x16')](_0x51f903)[_0xfe35('0x17')]();};}function respondWithResult(_0x4a19d2,_0x6f3f43){_0x6f3f43=_0x6f3f43||0xc8;return function(_0x55867e){if(_0x55867e){return _0x4a19d2[_0xfe35('0x16')](_0x6f3f43)['json'](_0x55867e);}};}function respondWithFilteredResult(_0x5bb6d0,_0x2cad9b){return function(_0x32c86b){if(_0x32c86b){var _0x595e3a=_0x32c86b[_0xfe35('0x18')],_0x3d9d32=_0x2cad9b[_0xfe35('0x19')],_0x573f2b=_0x2cad9b[_0xfe35('0x19')]+_0x2cad9b[_0xfe35('0x1a')],_0x119366;if(_0x573f2b>=_0x595e3a){_0x573f2b=_0x595e3a;_0x119366=0xc8;}else{_0x119366=0xce;}_0x5bb6d0['status'](_0x119366);return _0x5bb6d0[_0xfe35('0x1b')](_0xfe35('0x1c'),_0x3d9d32+'-'+_0x573f2b+'/'+_0x595e3a)['json'](_0x32c86b);}return null;};}function patchUpdates(_0x4f8942){return function(_0x4ee601){try{jsonpatch[_0xfe35('0x1d')](_0x4ee601,_0x4f8942,!![]);}catch(_0x54a2bd){return BPromise[_0xfe35('0x1e')](_0x54a2bd);}return _0x4ee601[_0xfe35('0x1f')]();};}function saveUpdates(_0x2afec1,_0x5e746a){return function(_0x4c2be7){if(_0x4c2be7){return _0x4c2be7['update'](_0x2afec1)[_0xfe35('0x20')](function(_0x484758){return _0x484758;});}return null;};}function removeEntity(_0x11a870,_0x46ca0f){return function(_0xabe9c4){if(_0xabe9c4){return _0xabe9c4[_0xfe35('0x21')]()[_0xfe35('0x20')](function(){_0x11a870[_0xfe35('0x16')](0xcc)[_0xfe35('0x17')]();});}};}function handleEntityNotFound(_0x1ca78a,_0x4e367f){return function(_0x105769){if(!_0x105769){_0x1ca78a[_0xfe35('0x22')](0x194);}return _0x105769;};}function handleError(_0x51ea70,_0x1d4c5a){_0x1d4c5a=_0x1d4c5a||0x1f4;return function(_0xd53ffe){logger['error'](_0xd53ffe['stack']);if(_0xd53ffe[_0xfe35('0x23')]){delete _0xd53ffe[_0xfe35('0x23')];}_0x51ea70[_0xfe35('0x16')](_0x1d4c5a)[_0xfe35('0x24')](_0xd53ffe);};}exports[_0xfe35('0x25')]=function(_0x3e3a4d,_0x35c9ef){var _0x39f68f={},_0x28d78e={},_0x50d4e9={'count':0x0,'rows':[]};var _0x590865=db[_0xfe35('0x26')][_0xfe35('0x27')];_0x28d78e['model']=_[_0xfe35('0x28')](_0x590865);var _0x3696ca={'dateStart':_0x3e3a4d[_0xfe35('0x29')][_0xfe35('0x2a')],'dateEnd':_0x3e3a4d[_0xfe35('0x29')]['dateEnd']};delete _0x3e3a4d['query'][_0xfe35('0x2a')];delete _0x3e3a4d['query'][_0xfe35('0x2b')];_0x28d78e[_0xfe35('0x29')]=_[_0xfe35('0x28')](_0x3e3a4d[_0xfe35('0x29')]);_0x28d78e[_0xfe35('0x2c')]=_[_0xfe35('0x2d')](_0x28d78e['model'],_0x28d78e[_0xfe35('0x29')]);_0x39f68f['attributes']=_[_0xfe35('0x2d')](_0x28d78e[_0xfe35('0x2e')],qs[_0xfe35('0x2f')](_0x3e3a4d[_0xfe35('0x29')][_0xfe35('0x2f')]));_0x39f68f[_0xfe35('0x30')]=_0x39f68f[_0xfe35('0x30')][_0xfe35('0x31')]?_0x39f68f[_0xfe35('0x30')]:_0x28d78e['model'];if(!_0x3e3a4d[_0xfe35('0x29')][_0xfe35('0x32')](_0xfe35('0x33'))){_0x39f68f['limit']=qs['limit'](_0x3e3a4d[_0xfe35('0x29')][_0xfe35('0x1a')]);_0x39f68f['offset']=qs['offset'](_0x3e3a4d[_0xfe35('0x29')]['offset']);}_0x39f68f[_0xfe35('0x34')]=qs[_0xfe35('0x35')](_0x3e3a4d[_0xfe35('0x29')][_0xfe35('0x35')]);_0x39f68f[_0xfe35('0x36')]=qs[_0xfe35('0x2c')](_['pick'](_0x3e3a4d[_0xfe35('0x29')],_0x28d78e['filters']));if(_0x3696ca[_0xfe35('0x2a')]){if(_0x3696ca[_0xfe35('0x2b')]){_0x3696ca[_0xfe35('0x2b')]=moment(_0x3696ca['dateEnd'])[_0xfe35('0x37')](0x1,_0xfe35('0x38'));}else{_0x3696ca[_0xfe35('0x2b')]=moment(_0x3696ca[_0xfe35('0x2a')])['add'](0x1,_0xfe35('0x38'));}_[_0xfe35('0x39')](_0x39f68f[_0xfe35('0x36')],{'createdAt':{'$gte':_0x3696ca[_0xfe35('0x2a')],'$lte':_0x3696ca[_0xfe35('0x2b')]}});}if(_0x3e3a4d[_0xfe35('0x29')][_0xfe35('0x3a')]){_0x39f68f[_0xfe35('0x36')]=_['merge'](_0x39f68f['where'],{'$or':_[_0xfe35('0x3b')](_0x39f68f[_0xfe35('0x30')],function(_0x60162c){var _0x9543c2={};_0x9543c2[_0x60162c]={'$like':'%'+_0x3e3a4d[_0xfe35('0x29')][_0xfe35('0x3a')]+'%'};return _0x9543c2;})});}_0x39f68f=_[_0xfe35('0x39')]({},_0x39f68f,_0x3e3a4d[_0xfe35('0x3c')]);var _0x10b1aa={'where':_0x39f68f['where']};return db[_0xfe35('0x26')][_0xfe35('0x18')](_0x10b1aa)[_0xfe35('0x20')](function(_0x474251){_0x50d4e9[_0xfe35('0x18')]=_0x474251;if(_0x3e3a4d['query'][_0xfe35('0x3d')]){_0x39f68f[_0xfe35('0x3e')]=[{'all':!![]}];}return db[_0xfe35('0x26')]['findAll'](_0x39f68f);})[_0xfe35('0x20')](function(_0x5b122){_0x50d4e9[_0xfe35('0x3f')]=_0x5b122;return _0x50d4e9;})['then'](respondWithFilteredResult(_0x35c9ef,_0x39f68f))['catch'](handleError(_0x35c9ef,null));};exports[_0xfe35('0x40')]=function(_0x66fc54,_0x484cff){var _0x27ac05={'raw':!![],'where':{'id':_0x66fc54[_0xfe35('0x41')]['id']}},_0x312356={};_0x312356['model']=_[_0xfe35('0x28')](db[_0xfe35('0x26')][_0xfe35('0x27')]);_0x312356[_0xfe35('0x29')]=_['keys'](_0x66fc54[_0xfe35('0x29')]);_0x312356[_0xfe35('0x2c')]=_[_0xfe35('0x2d')](_0x312356['model'],_0x312356[_0xfe35('0x29')]);_0x27ac05[_0xfe35('0x30')]=_[_0xfe35('0x2d')](_0x312356['model'],qs['fields'](_0x66fc54[_0xfe35('0x29')][_0xfe35('0x2f')]));_0x27ac05['attributes']=_0x27ac05[_0xfe35('0x30')][_0xfe35('0x31')]?_0x27ac05['attributes']:_0x312356[_0xfe35('0x2e')];if(_0x66fc54[_0xfe35('0x29')]['includeAll']){_0x27ac05[_0xfe35('0x3e')]=[{'all':!![]}];}_0x27ac05=_[_0xfe35('0x39')]({},_0x27ac05,_0x66fc54['options']);return db['MailQueueReport'][_0xfe35('0x42')](_0x27ac05)[_0xfe35('0x20')](handleEntityNotFound(_0x484cff,null))['then'](respondWithResult(_0x484cff,null))['catch'](handleError(_0x484cff,null));};exports['create']=function(_0x49c10b,_0x57667d){return db[_0xfe35('0x26')][_0xfe35('0x43')](_0x49c10b[_0xfe35('0x44')],{})[_0xfe35('0x20')](respondWithResult(_0x57667d,0xc9))[_0xfe35('0x45')](handleError(_0x57667d,null));};exports[_0xfe35('0x46')]=function(_0x1a9fc5,_0x5e7876){if(_0x1a9fc5[_0xfe35('0x44')]['id']){delete _0x1a9fc5[_0xfe35('0x44')]['id'];}return db[_0xfe35('0x26')]['find']({'where':{'id':_0x1a9fc5[_0xfe35('0x41')]['id']}})[_0xfe35('0x20')](handleEntityNotFound(_0x5e7876,null))[_0xfe35('0x20')](saveUpdates(_0x1a9fc5[_0xfe35('0x44')],null))['then'](respondWithResult(_0x5e7876,null))['catch'](handleError(_0x5e7876,null));};exports['destroy']=function(_0x5f10e0,_0x25353a){return db[_0xfe35('0x26')][_0xfe35('0x42')]({'where':{'id':_0x5f10e0['params']['id']}})[_0xfe35('0x20')](handleEntityNotFound(_0x25353a,null))['then'](removeEntity(_0x25353a,null))[_0xfe35('0x45')](handleError(_0x25353a,null));};exports[_0xfe35('0x47')]=function(_0x142260,_0x3b31af){return db[_0xfe35('0x26')][_0xfe35('0x47')]()[_0xfe35('0x20')](respondWithResult(_0x3b31af,null))[_0xfe35('0x45')](handleError(_0x3b31af,null));}; \ No newline at end of file +var _0xa2df=['bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','end','offset','limit','set','Content-Range','save','then','destroy','status','sendStatus','error','name','send','index','MailQueueReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','count','includeAll','include','findAll','rows','catch','show','create','body','update','params','find','describe','rimraf','zip-dir','request-promise','moment'];(function(_0x58ac97,_0x5e9b1c){var _0x15cae3=function(_0x34e59d){while(--_0x34e59d){_0x58ac97['push'](_0x58ac97['shift']());}};_0x15cae3(++_0x5e9b1c);}(_0xa2df,0x86));var _0xfa2d=function(_0xfad0ca,_0x5d8c8c){_0xfad0ca=_0xfad0ca-0x0;var _0xefb863=_0xa2df[_0xfad0ca];return _0xefb863;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xfa2d('0x0'));var zipdir=require(_0xfa2d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfa2d('0x2'));var moment=require(_0xfa2d('0x3'));var BPromise=require(_0xfa2d('0x4'));var Mustache=require('mustache');var util=require(_0xfa2d('0x5'));var path=require('path');var sox=require(_0xfa2d('0x6'));var csv=require(_0xfa2d('0x7'));var ejs=require(_0xfa2d('0x8'));var fs=require('fs');var _=require(_0xfa2d('0x9'));var squel=require(_0xfa2d('0xa'));var crypto=require(_0xfa2d('0xb'));var jsforce=require(_0xfa2d('0xc'));var deskjs=require(_0xfa2d('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfa2d('0xe'));var Papa=require(_0xfa2d('0xf'));var Redis=require('ioredis');var qs=require(_0xfa2d('0x10'));var logger=require(_0xfa2d('0x11'))(_0xfa2d('0x12'));var utils=require(_0xfa2d('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a8b6c,_0x160100){_0x160100=_0x160100||0xcc;return function(_0x2a540a){if(_0x2a540a){return _0x2a8b6c['sendStatus'](_0x160100);}return _0x2a8b6c['status'](_0x160100)[_0xfa2d('0x14')]();};}function respondWithResult(_0x127a39,_0x3089a1){_0x3089a1=_0x3089a1||0xc8;return function(_0x545eb9){if(_0x545eb9){return _0x127a39['status'](_0x3089a1)['json'](_0x545eb9);}};}function respondWithFilteredResult(_0x2b3787,_0x349e01){return function(_0x338fa1){if(_0x338fa1){var _0x21a90f=_0x338fa1['count'],_0x39921d=_0x349e01[_0xfa2d('0x15')],_0xb0d5ff=_0x349e01[_0xfa2d('0x15')]+_0x349e01[_0xfa2d('0x16')],_0x488688;if(_0xb0d5ff>=_0x21a90f){_0xb0d5ff=_0x21a90f;_0x488688=0xc8;}else{_0x488688=0xce;}_0x2b3787['status'](_0x488688);return _0x2b3787[_0xfa2d('0x17')](_0xfa2d('0x18'),_0x39921d+'-'+_0xb0d5ff+'/'+_0x21a90f)['json'](_0x338fa1);}return null;};}function patchUpdates(_0x49bb8b){return function(_0x16d96d){try{jsonpatch['apply'](_0x16d96d,_0x49bb8b,!![]);}catch(_0x42c066){return BPromise['reject'](_0x42c066);}return _0x16d96d[_0xfa2d('0x19')]();};}function saveUpdates(_0x5d7866,_0x296607){return function(_0x28e04c){if(_0x28e04c){return _0x28e04c['update'](_0x5d7866)[_0xfa2d('0x1a')](function(_0x51fc07){return _0x51fc07;});}return null;};}function removeEntity(_0x4ceef9,_0x350b81){return function(_0x5e1528){if(_0x5e1528){return _0x5e1528[_0xfa2d('0x1b')]()[_0xfa2d('0x1a')](function(){_0x4ceef9[_0xfa2d('0x1c')](0xcc)[_0xfa2d('0x14')]();});}};}function handleEntityNotFound(_0x6272a1,_0x4e5cdd){return function(_0x1737d4){if(!_0x1737d4){_0x6272a1[_0xfa2d('0x1d')](0x194);}return _0x1737d4;};}function handleError(_0x392fd3,_0x20d7ad){_0x20d7ad=_0x20d7ad||0x1f4;return function(_0x44065a){logger[_0xfa2d('0x1e')](_0x44065a['stack']);if(_0x44065a[_0xfa2d('0x1f')]){delete _0x44065a['name'];}_0x392fd3['status'](_0x20d7ad)[_0xfa2d('0x20')](_0x44065a);};}exports[_0xfa2d('0x21')]=function(_0x11bbd2,_0x598696){var _0x36c946={},_0x2fee1a={},_0x42e596={'count':0x0,'rows':[]};var _0x3dfa73=db[_0xfa2d('0x22')][_0xfa2d('0x23')];_0x2fee1a[_0xfa2d('0x24')]=_[_0xfa2d('0x25')](_0x3dfa73);var _0x15d1c7={'dateStart':_0x11bbd2[_0xfa2d('0x26')][_0xfa2d('0x27')],'dateEnd':_0x11bbd2[_0xfa2d('0x26')][_0xfa2d('0x28')]};delete _0x11bbd2[_0xfa2d('0x26')][_0xfa2d('0x27')];delete _0x11bbd2[_0xfa2d('0x26')][_0xfa2d('0x28')];_0x2fee1a[_0xfa2d('0x26')]=_[_0xfa2d('0x25')](_0x11bbd2[_0xfa2d('0x26')]);_0x2fee1a[_0xfa2d('0x29')]=_[_0xfa2d('0x2a')](_0x2fee1a[_0xfa2d('0x24')],_0x2fee1a[_0xfa2d('0x26')]);_0x36c946[_0xfa2d('0x2b')]=_[_0xfa2d('0x2a')](_0x2fee1a[_0xfa2d('0x24')],qs[_0xfa2d('0x2c')](_0x11bbd2[_0xfa2d('0x26')][_0xfa2d('0x2c')]));_0x36c946[_0xfa2d('0x2b')]=_0x36c946['attributes'][_0xfa2d('0x2d')]?_0x36c946[_0xfa2d('0x2b')]:_0x2fee1a[_0xfa2d('0x24')];if(!_0x11bbd2['query'][_0xfa2d('0x2e')](_0xfa2d('0x2f'))){_0x36c946[_0xfa2d('0x16')]=qs[_0xfa2d('0x16')](_0x11bbd2[_0xfa2d('0x26')][_0xfa2d('0x16')]);_0x36c946[_0xfa2d('0x15')]=qs[_0xfa2d('0x15')](_0x11bbd2['query'][_0xfa2d('0x15')]);}_0x36c946[_0xfa2d('0x30')]=qs[_0xfa2d('0x31')](_0x11bbd2[_0xfa2d('0x26')]['sort']);_0x36c946[_0xfa2d('0x32')]=qs[_0xfa2d('0x29')](_[_0xfa2d('0x33')](_0x11bbd2[_0xfa2d('0x26')],_0x2fee1a[_0xfa2d('0x29')]));if(_0x15d1c7[_0xfa2d('0x27')]){if(_0x15d1c7[_0xfa2d('0x28')]){_0x15d1c7[_0xfa2d('0x28')]=moment(_0x15d1c7['dateEnd'])[_0xfa2d('0x34')](0x1,_0xfa2d('0x35'));}else{_0x15d1c7[_0xfa2d('0x28')]=moment(_0x15d1c7[_0xfa2d('0x27')])[_0xfa2d('0x34')](0x1,_0xfa2d('0x35'));}_[_0xfa2d('0x36')](_0x36c946['where'],{'createdAt':{'$gte':_0x15d1c7[_0xfa2d('0x27')],'$lte':_0x15d1c7[_0xfa2d('0x28')]}});}if(_0x11bbd2[_0xfa2d('0x26')][_0xfa2d('0x37')]){_0x36c946['where']=_[_0xfa2d('0x36')](_0x36c946[_0xfa2d('0x32')],{'$or':_['map'](_0x36c946['attributes'],function(_0x44e2e5){var _0x4b2573={};_0x4b2573[_0x44e2e5]={'$like':'%'+_0x11bbd2['query'][_0xfa2d('0x37')]+'%'};return _0x4b2573;})});}_0x36c946=_[_0xfa2d('0x36')]({},_0x36c946,_0x11bbd2['options']);var _0x7fc800={'where':_0x36c946[_0xfa2d('0x32')]};return db[_0xfa2d('0x22')][_0xfa2d('0x38')](_0x7fc800)[_0xfa2d('0x1a')](function(_0x104f4f){_0x42e596[_0xfa2d('0x38')]=_0x104f4f;if(_0x11bbd2[_0xfa2d('0x26')][_0xfa2d('0x39')]){_0x36c946[_0xfa2d('0x3a')]=[{'all':!![]}];}return db[_0xfa2d('0x22')][_0xfa2d('0x3b')](_0x36c946);})[_0xfa2d('0x1a')](function(_0x333e01){_0x42e596[_0xfa2d('0x3c')]=_0x333e01;return _0x42e596;})[_0xfa2d('0x1a')](respondWithFilteredResult(_0x598696,_0x36c946))[_0xfa2d('0x3d')](handleError(_0x598696,null));};exports[_0xfa2d('0x3e')]=function(_0x564cc3,_0x2141b7){var _0xda808={'raw':!![],'where':{'id':_0x564cc3['params']['id']}},_0x1ac253={};_0x1ac253['model']=_['keys'](db[_0xfa2d('0x22')]['rawAttributes']);_0x1ac253['query']=_[_0xfa2d('0x25')](_0x564cc3['query']);_0x1ac253[_0xfa2d('0x29')]=_['intersection'](_0x1ac253[_0xfa2d('0x24')],_0x1ac253[_0xfa2d('0x26')]);_0xda808[_0xfa2d('0x2b')]=_[_0xfa2d('0x2a')](_0x1ac253[_0xfa2d('0x24')],qs[_0xfa2d('0x2c')](_0x564cc3['query'][_0xfa2d('0x2c')]));_0xda808[_0xfa2d('0x2b')]=_0xda808['attributes']['length']?_0xda808[_0xfa2d('0x2b')]:_0x1ac253[_0xfa2d('0x24')];if(_0x564cc3['query'][_0xfa2d('0x39')]){_0xda808[_0xfa2d('0x3a')]=[{'all':!![]}];}_0xda808=_[_0xfa2d('0x36')]({},_0xda808,_0x564cc3['options']);return db[_0xfa2d('0x22')]['find'](_0xda808)[_0xfa2d('0x1a')](handleEntityNotFound(_0x2141b7,null))['then'](respondWithResult(_0x2141b7,null))[_0xfa2d('0x3d')](handleError(_0x2141b7,null));};exports[_0xfa2d('0x3f')]=function(_0x1b9f2d,_0x218fcf){return db[_0xfa2d('0x22')][_0xfa2d('0x3f')](_0x1b9f2d[_0xfa2d('0x40')],{})[_0xfa2d('0x1a')](respondWithResult(_0x218fcf,0xc9))[_0xfa2d('0x3d')](handleError(_0x218fcf,null));};exports[_0xfa2d('0x41')]=function(_0x30c70b,_0x3e162c){if(_0x30c70b[_0xfa2d('0x40')]['id']){delete _0x30c70b['body']['id'];}return db[_0xfa2d('0x22')]['find']({'where':{'id':_0x30c70b[_0xfa2d('0x42')]['id']}})[_0xfa2d('0x1a')](handleEntityNotFound(_0x3e162c,null))[_0xfa2d('0x1a')](saveUpdates(_0x30c70b['body'],null))[_0xfa2d('0x1a')](respondWithResult(_0x3e162c,null))[_0xfa2d('0x3d')](handleError(_0x3e162c,null));};exports[_0xfa2d('0x1b')]=function(_0x30b1cb,_0x30063a){return db[_0xfa2d('0x22')][_0xfa2d('0x43')]({'where':{'id':_0x30b1cb['params']['id']}})[_0xfa2d('0x1a')](handleEntityNotFound(_0x30063a,null))[_0xfa2d('0x1a')](removeEntity(_0x30063a,null))[_0xfa2d('0x3d')](handleError(_0x30063a,null));};exports[_0xfa2d('0x44')]=function(_0x5ba0d9,_0x27231b){return db[_0xfa2d('0x22')][_0xfa2d('0x44')]()[_0xfa2d('0x1a')](respondWithResult(_0x27231b,null))[_0xfa2d('0x3d')](handleError(_0x27231b,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 1fc0a24..aa34755 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 _0x8de5=['report_mail_queue','uniqueid','lodash','../../config/logger','api','./mailQueueReport.attributes','exports','define','MailQueueReport'];(function(_0x106214,_0x454b8d){var _0x5f5cea=function(_0x247841){while(--_0x247841){_0x106214['push'](_0x106214['shift']());}};_0x5f5cea(++_0x454b8d);}(_0x8de5,0x1cd));var _0x58de=function(_0x2d76bd,_0x19da1b){_0x2d76bd=_0x2d76bd-0x0;var _0x283ffd=_0x8de5[_0x2d76bd];return _0x283ffd;};'use strict';var _=require(_0x58de('0x0'));var util=require('util');var logger=require(_0x58de('0x1'))(_0x58de('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x58de('0x3'));module[_0x58de('0x4')]=function(_0x1391ed,_0x290604){return _0x1391ed[_0x58de('0x5')](_0x58de('0x6'),attributes,{'tableName':_0x58de('0x7'),'paranoid':![],'indexes':[{'name':_0x58de('0x8'),'fields':[_0x58de('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x173d=['uniqueid','api','./mailQueueReport.attributes','exports','MailQueueReport','report_mail_queue'];(function(_0x46e24a,_0x4d992b){var _0x2ae4ab=function(_0x1e8940){while(--_0x1e8940){_0x46e24a['push'](_0x46e24a['shift']());}};_0x2ae4ab(++_0x4d992b);}(_0x173d,0x16f));var _0xd173=function(_0x526eb4,_0xc59915){_0x526eb4=_0x526eb4-0x0;var _0x23ab61=_0x173d[_0x526eb4];return _0x23ab61;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd173('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xd173('0x1'));module[_0xd173('0x2')]=function(_0x4c700e,_0x4f83b0){return _0x4c700e['define'](_0xd173('0x3'),attributes,{'tableName':_0xd173('0x4'),'paranoid':![],'indexes':[{'name':_0xd173('0x5'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 0520ccd..bea4a03 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 _0x174c=['raw','attributes','UpdateMailQueueReport','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','create','body','options'];(function(_0x5e3701,_0x596265){var _0x345dcf=function(_0x5eb12a){while(--_0x5eb12a){_0x5e3701['push'](_0x5e3701['shift']());}};_0x345dcf(++_0x596265);}(_0x174c,0x177));var _0xc174=function(_0xbf400c,_0x37e1e7){_0xbf400c=_0xbf400c-0x0;var _0x2ee697=_0x174c[_0xbf400c];return _0x2ee697;};'use strict';var _=require(_0xc174('0x0'));var util=require(_0xc174('0x1'));var moment=require(_0xc174('0x2'));var BPromise=require('bluebird');var rs=require(_0xc174('0x3'));var fs=require('fs');var Redis=require(_0xc174('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc174('0x5'));var logger=require(_0xc174('0x6'))(_0xc174('0x7'));var config=require(_0xc174('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc174('0x9')][_0xc174('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15176e,_0x51c756,_0xfe3793){return new BPromise(function(_0x485638,_0x430894){return client[_0xc174('0xb')](_0x15176e,_0xfe3793)[_0xc174('0xc')](function(_0x2b297c){logger[_0xc174('0xd')](_0xc174('0xe'),_0x51c756,_0xc174('0xf'));logger[_0xc174('0x10')](_0xc174('0x11'),_0x51c756,_0xc174('0xf'),JSON[_0xc174('0x12')](_0x2b297c));if(_0x2b297c['error']){if(_0x2b297c[_0xc174('0x13')][_0xc174('0x14')]===0x1f4){logger['error'](_0xc174('0xe'),_0x51c756,_0x2b297c[_0xc174('0x13')][_0xc174('0x15')]);return _0x430894(_0x2b297c[_0xc174('0x13')]['message']);}logger[_0xc174('0x13')]('MailQueueReport,\x20%s,\x20%s',_0x51c756,_0x2b297c['error'][_0xc174('0x15')]);return _0x485638(_0x2b297c[_0xc174('0x13')][_0xc174('0x15')]);}else{logger[_0xc174('0xd')](_0xc174('0xe'),_0x51c756,_0xc174('0xf'));_0x485638(_0x2b297c['result'][_0xc174('0x15')]);}})[_0xc174('0x16')](function(_0x4d2ee7){logger[_0xc174('0x13')](_0xc174('0xe'),_0x51c756,_0x4d2ee7);_0x430894(_0x4d2ee7);});});}exports[_0xc174('0x17')]=function(_0x4764a1){var _0xb67e89=this;return new Promise(function(_0x13a9f7,_0x4daa86){return db[_0xc174('0x18')][_0xc174('0x19')](_0x4764a1[_0xc174('0x1a')],{'raw':_0x4764a1['options']?_0x4764a1[_0xc174('0x1b')][_0xc174('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x536719){logger[_0xc174('0xd')](_0xc174('0x17'),_0x4764a1);logger[_0xc174('0x10')](_0xc174('0x17'),_0x4764a1,JSON[_0xc174('0x12')](_0x536719));_0x13a9f7(_0x536719);})[_0xc174('0x16')](function(_0x1639fb){logger[_0xc174('0x13')]('CreateMailQueueReport',_0x1639fb[_0xc174('0x15')],_0x4764a1);_0x4daa86(_0xb67e89[_0xc174('0x13')](0x1f4,_0x1639fb[_0xc174('0x15')]));});});};exports['UpdateMailQueueReport']=function(_0x12e9b0){var _0x4f800d=this;return new Promise(function(_0x52e931,_0x493b41){return db[_0xc174('0x18')]['update'](_0x12e9b0[_0xc174('0x1a')],{'raw':_0x12e9b0[_0xc174('0x1b')]?_0x12e9b0[_0xc174('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12e9b0[_0xc174('0x1b')]?_0x12e9b0[_0xc174('0x1b')]['where']||null:null,'attributes':_0x12e9b0[_0xc174('0x1b')]?_0x12e9b0[_0xc174('0x1b')][_0xc174('0x1d')]||null:null,'limit':_0x12e9b0[_0xc174('0x1b')]?_0x12e9b0[_0xc174('0x1b')]['limit']||null:null})[_0xc174('0xc')](function(_0x1c9b44){logger[_0xc174('0xd')](_0xc174('0x1e'),_0x12e9b0);logger[_0xc174('0x10')](_0xc174('0x1e'),_0x12e9b0,JSON[_0xc174('0x12')](_0x1c9b44));_0x52e931(_0x1c9b44);})[_0xc174('0x16')](function(_0x2ef2d5){logger[_0xc174('0x13')](_0xc174('0x1e'),_0x2ef2d5[_0xc174('0x15')],_0x12e9b0);_0x493b41(_0x4f800d['error'](0x1f4,_0x2ef2d5[_0xc174('0x15')]));});});}; \ No newline at end of file +var _0x4ab2=['update','raw','where','limit','UpdateMailQueueReport','lodash','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','client','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','create','body','options','debug'];(function(_0x367e5b,_0x5721e4){var _0x4b909e=function(_0x22c6a4){while(--_0x22c6a4){_0x367e5b['push'](_0x367e5b['shift']());}};_0x4b909e(++_0x5721e4);}(_0x4ab2,0x1d0));var _0x24ab=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x4ab2[_0x819464];return _0x49dcc0;};'use strict';var _=require(_0x24ab('0x0'));var util=require('util');var moment=require(_0x24ab('0x1'));var BPromise=require('bluebird');var rs=require(_0x24ab('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x24ab('0x3'));var logger=require(_0x24ab('0x4'))('rpc');var config=require(_0x24ab('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x24ab('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3fe44b,_0x1a8444,_0x1df490){return new BPromise(function(_0x272f3b,_0x19a332){return client['request'](_0x3fe44b,_0x1df490)[_0x24ab('0x7')](function(_0x227aa2){logger[_0x24ab('0x8')](_0x24ab('0x9'),_0x1a8444,_0x24ab('0xa'));logger['debug']('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x1a8444,'request\x20sent',JSON[_0x24ab('0xb')](_0x227aa2));if(_0x227aa2['error']){if(_0x227aa2[_0x24ab('0xc')][_0x24ab('0xd')]===0x1f4){logger[_0x24ab('0xc')](_0x24ab('0x9'),_0x1a8444,_0x227aa2[_0x24ab('0xc')][_0x24ab('0xe')]);return _0x19a332(_0x227aa2[_0x24ab('0xc')]['message']);}logger[_0x24ab('0xc')](_0x24ab('0x9'),_0x1a8444,_0x227aa2[_0x24ab('0xc')][_0x24ab('0xe')]);return _0x272f3b(_0x227aa2[_0x24ab('0xc')][_0x24ab('0xe')]);}else{logger[_0x24ab('0x8')](_0x24ab('0x9'),_0x1a8444,'request\x20sent');_0x272f3b(_0x227aa2['result']['message']);}})[_0x24ab('0xf')](function(_0x3114d6){logger[_0x24ab('0xc')](_0x24ab('0x9'),_0x1a8444,_0x3114d6);_0x19a332(_0x3114d6);});});}exports[_0x24ab('0x10')]=function(_0x3d9c1d){var _0x844d0f=this;return new Promise(function(_0x3c14d9,_0xeefb25){return db[_0x24ab('0x11')][_0x24ab('0x12')](_0x3d9c1d[_0x24ab('0x13')],{'raw':_0x3d9c1d['options']?_0x3d9c1d[_0x24ab('0x14')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4d447f){logger[_0x24ab('0x8')](_0x24ab('0x10'),_0x3d9c1d);logger[_0x24ab('0x15')](_0x24ab('0x10'),_0x3d9c1d,JSON['stringify'](_0x4d447f));_0x3c14d9(_0x4d447f);})['catch'](function(_0x41712f){logger[_0x24ab('0xc')](_0x24ab('0x10'),_0x41712f[_0x24ab('0xe')],_0x3d9c1d);_0xeefb25(_0x844d0f[_0x24ab('0xc')](0x1f4,_0x41712f[_0x24ab('0xe')]));});});};exports['UpdateMailQueueReport']=function(_0x4ec676){var _0x3d6001=this;return new Promise(function(_0x160f50,_0x5a2f75){return db[_0x24ab('0x11')][_0x24ab('0x16')](_0x4ec676[_0x24ab('0x13')],{'raw':_0x4ec676[_0x24ab('0x14')]?_0x4ec676[_0x24ab('0x14')][_0x24ab('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ec676[_0x24ab('0x14')]?_0x4ec676['options'][_0x24ab('0x18')]||null:null,'attributes':_0x4ec676['options']?_0x4ec676['options']['attributes']||null:null,'limit':_0x4ec676[_0x24ab('0x14')]?_0x4ec676[_0x24ab('0x14')][_0x24ab('0x19')]||null:null})[_0x24ab('0x7')](function(_0x5f1835){logger[_0x24ab('0x8')](_0x24ab('0x1a'),_0x4ec676);logger[_0x24ab('0x15')]('UpdateMailQueueReport',_0x4ec676,JSON[_0x24ab('0xb')](_0x5f1835));_0x160f50(_0x5f1835);})['catch'](function(_0x57794c){logger['error'](_0x24ab('0x1a'),_0x57794c['message'],_0x4ec676);_0x5a2f75(_0x3d6001[_0x24ab('0xc')](0x1f4,_0x57794c[_0x24ab('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 11347cb..7f39152 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 _0x1a61=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x1a61,0x1e6));var _0x11a6=function(_0x3c94dc,_0x274e1a){_0x3c94dc=_0x3c94dc-0x0;var _0x5c7287=_0x1a61[_0x3c94dc];return _0x5c7287;};'use strict';var multer=require(_0x11a6('0x0'));var util=require('util');var path=require(_0x11a6('0x1'));var timeout=require('connect-timeout');var express=require(_0x11a6('0x2'));var router=express[_0x11a6('0x3')]();var auth=require(_0x11a6('0x4'));var interaction=require(_0x11a6('0x5'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0xdb2a=['../../config/environment','multer','util','path','Router','../../components/auth/service'];(function(_0x15f622,_0x5d2873){var _0x35814e=function(_0x46bc85){while(--_0x46bc85){_0x15f622['push'](_0x15f622['shift']());}};_0x35814e(++_0x5d2873);}(_0xdb2a,0x16f));var _0xadb2=function(_0x3fffec,_0x5f5243){_0x3fffec=_0x3fffec-0x0;var _0x111723=_0xdb2a[_0x3fffec];return _0x111723;};'use strict';var multer=require(_0xadb2('0x0'));var util=require(_0xadb2('0x1'));var path=require(_0xadb2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xadb2('0x3')]();var auth=require(_0xadb2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xadb2('0x5'));module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 3855c96..3a34512 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 _0x1339=['username','INTEGER','INBOX','STRING','BOOLEAN'];(function(_0x510005,_0x22057d){var _0x2f530f=function(_0xd9bf64){while(--_0xd9bf64){_0x510005['push'](_0x510005['shift']());}};_0x2f530f(++_0x22057d);}(_0x1339,0x1ed));var _0x9133=function(_0xee8d4c,_0x1c7ce3){_0xee8d4c=_0xee8d4c-0x0;var _0xc3311b=_0x1339[_0xee8d4c];return _0xc3311b;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x9133('0x0')]},'host':{'type':Sequelize[_0x9133('0x0')]},'authentication':{'type':Sequelize[_0x9133('0x1')],'defaultValue':!![]},'user':{'type':Sequelize[_0x9133('0x0')],'unique':_0x9133('0x2')},'password':{'type':Sequelize[_0x9133('0x0')]},'port':{'type':Sequelize[_0x9133('0x3')]},'tls':{'type':Sequelize[_0x9133('0x1')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x9133('0x4')},'connTimeout':{'type':Sequelize[_0x9133('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x9133('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2e54=['username','INTEGER','INBOX','sequelize','STRING','BOOLEAN'];(function(_0x43f51f,_0x201238){var _0x1d5af1=function(_0x2fc116){while(--_0x2fc116){_0x43f51f['push'](_0x43f51f['shift']());}};_0x1d5af1(++_0x201238);}(_0x2e54,0x1dd));var _0x42e5=function(_0x23afe6,_0x423e32){_0x23afe6=_0x23afe6-0x0;var _0x56161c=_0x2e54[_0x23afe6];return _0x56161c;};'use strict';var Sequelize=require(_0x42e5('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x42e5('0x1')]},'authentication':{'type':Sequelize[_0x42e5('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x42e5('0x1')],'unique':_0x42e5('0x3')},'password':{'type':Sequelize[_0x42e5('0x1')]},'port':{'type':Sequelize[_0x42e5('0x4')]},'tls':{'type':Sequelize[_0x42e5('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x42e5('0x5')},'connTimeout':{'type':Sequelize[_0x42e5('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x42e5('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index c3da8e6..4f5b00f 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 _0xcbe1=['./mailServerIn.attributes','define','MailServerIn','util','request-promise'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xcbe1,0x1a2));var _0x1cbe=function(_0x58c3ff,_0x124777){_0x58c3ff=_0x58c3ff-0x0;var _0x4e5a30=_0xcbe1[_0x58c3ff];return _0x4e5a30;};'use strict';var _=require('lodash');var util=require(_0x1cbe('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1cbe('0x1'));var attributes=require(_0x1cbe('0x2'));module['exports']=function(_0x1ba56c,_0x563162){return _0x1ba56c[_0x1cbe('0x3')](_0x1cbe('0x4'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e16=['request-promise','./mailServerIn.attributes','define','MailServerIn','mail_servers_in','lodash','moment','bluebird'];(function(_0x509717,_0x3a0418){var _0x455efa=function(_0x4dc873){while(--_0x4dc873){_0x509717['push'](_0x509717['shift']());}};_0x455efa(++_0x3a0418);}(_0x2e16,0x8d));var _0x62e1=function(_0x281d94,_0x1c60bd){_0x281d94=_0x281d94-0x0;var _0x525bb3=_0x2e16[_0x281d94];return _0x525bb3;};'use strict';var _=require(_0x62e1('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x62e1('0x1'));var BPromise=require(_0x62e1('0x2'));var rp=require(_0x62e1('0x3'));var attributes=require(_0x62e1('0x4'));module['exports']=function(_0x248e08,_0x3b78d1){return _0x248e08[_0x62e1('0x5')](_0x62e1('0x6'),attributes,{'tableName':_0x62e1('0x7'),'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 bf23a3f..da3a913 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 _0x1b07=['error','code','message','result','GetMailServerIn','MailServerIn','findAll','raw','options','where','limit','map','include','model','attributes','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1031b1,_0x21cdce){var _0x1feb58=function(_0x48136b){while(--_0x48136b){_0x1031b1['push'](_0x1031b1['shift']());}};_0x1feb58(++_0x21cdce);}(_0x1b07,0x1ca));var _0x71b0=function(_0x28578d,_0xcf5cf0){_0x28578d=_0x28578d-0x0;var _0x524826=_0x1b07[_0x28578d];return _0x524826;};'use strict';var _=require(_0x71b0('0x0'));var util=require(_0x71b0('0x1'));var moment=require(_0x71b0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x71b0('0x3'));var db=require(_0x71b0('0x4'))['db'];var utils=require(_0x71b0('0x5'));var logger=require(_0x71b0('0x6'))(_0x71b0('0x7'));var config=require('../../config/environment');var jayson=require(_0x71b0('0x8'));var client=jayson['client'][_0x71b0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x10a911,_0x449f9b,_0x5d010a){return new BPromise(function(_0x1c7534,_0x3b6dc5){return client[_0x71b0('0xa')](_0x10a911,_0x5d010a)[_0x71b0('0xb')](function(_0x42d503){logger[_0x71b0('0xc')](_0x71b0('0xd'),_0x449f9b,_0x71b0('0xe'));logger[_0x71b0('0xf')](_0x71b0('0x10'),_0x449f9b,_0x71b0('0xe'),JSON[_0x71b0('0x11')](_0x42d503));if(_0x42d503[_0x71b0('0x12')]){if(_0x42d503[_0x71b0('0x12')][_0x71b0('0x13')]===0x1f4){logger[_0x71b0('0x12')](_0x71b0('0xd'),_0x449f9b,_0x42d503[_0x71b0('0x12')][_0x71b0('0x14')]);return _0x3b6dc5(_0x42d503[_0x71b0('0x12')][_0x71b0('0x14')]);}logger['error'](_0x71b0('0xd'),_0x449f9b,_0x42d503[_0x71b0('0x12')]['message']);return _0x1c7534(_0x42d503[_0x71b0('0x12')][_0x71b0('0x14')]);}else{logger[_0x71b0('0xc')](_0x71b0('0xd'),_0x449f9b,_0x71b0('0xe'));_0x1c7534(_0x42d503[_0x71b0('0x15')][_0x71b0('0x14')]);}})['catch'](function(_0x54dd04){logger[_0x71b0('0x12')]('MailServerIn,\x20%s,\x20%s',_0x449f9b,_0x54dd04);_0x3b6dc5(_0x54dd04);});});}exports[_0x71b0('0x16')]=function(_0x186762){var _0x30b8d0=this;return new Promise(function(_0x1fe915,_0xc653e5){return db[_0x71b0('0x17')][_0x71b0('0x18')]({'raw':_0x186762['options']?_0x186762['options'][_0x71b0('0x19')]===undefined?!![]:![]:!![],'where':_0x186762[_0x71b0('0x1a')]?_0x186762['options'][_0x71b0('0x1b')]||null:null,'attributes':_0x186762['options']?_0x186762[_0x71b0('0x1a')]['attributes']||null:null,'limit':_0x186762[_0x71b0('0x1a')]?_0x186762['options'][_0x71b0('0x1c')]||null:null,'include':_0x186762[_0x71b0('0x1a')]?_0x186762[_0x71b0('0x1a')]['include']?_[_0x71b0('0x1d')](_0x186762[_0x71b0('0x1a')][_0x71b0('0x1e')],function(_0x39d142){return{'model':db[_0x39d142[_0x71b0('0x1f')]],'as':_0x39d142['as'],'attributes':_0x39d142[_0x71b0('0x20')],'include':_0x39d142[_0x71b0('0x1e')]?_[_0x71b0('0x1d')](_0x39d142[_0x71b0('0x1e')],function(_0x3bb155){return{'model':db[_0x3bb155[_0x71b0('0x1f')]],'as':_0x3bb155['as'],'attributes':_0x3bb155[_0x71b0('0x20')],'include':_0x3bb155[_0x71b0('0x1e')]?_[_0x71b0('0x1d')](_0x3bb155['include'],function(_0xe09047){return{'model':db[_0xe09047[_0x71b0('0x1f')]],'as':_0xe09047['as'],'attributes':_0xe09047[_0x71b0('0x20')]};}):[]};}):[]};}):[]:[]})[_0x71b0('0xb')](function(_0x4ec244){logger[_0x71b0('0xc')](_0x71b0('0x16'),_0x186762);logger['debug'](_0x71b0('0x16'),_0x186762,JSON[_0x71b0('0x11')](_0x4ec244));_0x1fe915(_0x4ec244);})[_0x71b0('0x21')](function(_0x1979d8){logger[_0x71b0('0x12')](_0x71b0('0x16'),_0x1979d8[_0x71b0('0x14')],_0x186762);_0xc653e5(_0x30b8d0[_0x71b0('0x12')](0x1f4,_0x1979d8['message']));});});}; \ No newline at end of file +var _0x2484=['message','request\x20sent','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','limit','include','map','model','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x12246f,_0x4dc1de){var _0x51ce2f=function(_0x38f40c){while(--_0x38f40c){_0x12246f['push'](_0x12246f['shift']());}};_0x51ce2f(++_0x4dc1de);}(_0x2484,0x6e));var _0x4248=function(_0x25f0d5,_0xc2dbf1){_0x25f0d5=_0x25f0d5-0x0;var _0x3dac6b=_0x2484[_0x25f0d5];return _0x3dac6b;};'use strict';var _=require(_0x4248('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4248('0x1'));var rs=require(_0x4248('0x2'));var fs=require('fs');var Redis=require(_0x4248('0x3'));var db=require(_0x4248('0x4'))['db'];var utils=require(_0x4248('0x5'));var logger=require('../../config/logger')(_0x4248('0x6'));var config=require(_0x4248('0x7'));var jayson=require(_0x4248('0x8'));var client=jayson[_0x4248('0x9')][_0x4248('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51c701,_0x468682,_0x4fa55b){return new BPromise(function(_0x21d87d,_0x1fe3f6){return client['request'](_0x51c701,_0x4fa55b)[_0x4248('0xb')](function(_0x5c7406){logger[_0x4248('0xc')](_0x4248('0xd'),_0x468682,'request\x20sent');logger[_0x4248('0xe')](_0x4248('0xf'),_0x468682,'request\x20sent',JSON[_0x4248('0x10')](_0x5c7406));if(_0x5c7406[_0x4248('0x11')]){if(_0x5c7406[_0x4248('0x11')]['code']===0x1f4){logger['error'](_0x4248('0xd'),_0x468682,_0x5c7406['error'][_0x4248('0x12')]);return _0x1fe3f6(_0x5c7406[_0x4248('0x11')][_0x4248('0x12')]);}logger[_0x4248('0x11')]('MailServerIn,\x20%s,\x20%s',_0x468682,_0x5c7406[_0x4248('0x11')][_0x4248('0x12')]);return _0x21d87d(_0x5c7406[_0x4248('0x11')][_0x4248('0x12')]);}else{logger[_0x4248('0xc')](_0x4248('0xd'),_0x468682,_0x4248('0x13'));_0x21d87d(_0x5c7406[_0x4248('0x14')]['message']);}})[_0x4248('0x15')](function(_0x25bbef){logger[_0x4248('0x11')](_0x4248('0xd'),_0x468682,_0x25bbef);_0x1fe3f6(_0x25bbef);});});}exports[_0x4248('0x16')]=function(_0x3a2b72){var _0x351051=this;return new Promise(function(_0x35bb0d,_0x31b10e){return db[_0x4248('0x17')][_0x4248('0x18')]({'raw':_0x3a2b72[_0x4248('0x19')]?_0x3a2b72[_0x4248('0x19')][_0x4248('0x1a')]===undefined?!![]:![]:!![],'where':_0x3a2b72[_0x4248('0x19')]?_0x3a2b72['options']['where']||null:null,'attributes':_0x3a2b72[_0x4248('0x19')]?_0x3a2b72['options']['attributes']||null:null,'limit':_0x3a2b72['options']?_0x3a2b72[_0x4248('0x19')][_0x4248('0x1b')]||null:null,'include':_0x3a2b72['options']?_0x3a2b72[_0x4248('0x19')][_0x4248('0x1c')]?_[_0x4248('0x1d')](_0x3a2b72[_0x4248('0x19')]['include'],function(_0x43aa1f){return{'model':db[_0x43aa1f['model']],'as':_0x43aa1f['as'],'attributes':_0x43aa1f['attributes'],'include':_0x43aa1f[_0x4248('0x1c')]?_['map'](_0x43aa1f[_0x4248('0x1c')],function(_0x1072af){return{'model':db[_0x1072af[_0x4248('0x1e')]],'as':_0x1072af['as'],'attributes':_0x1072af[_0x4248('0x1f')],'include':_0x1072af[_0x4248('0x1c')]?_['map'](_0x1072af[_0x4248('0x1c')],function(_0x1ada15){return{'model':db[_0x1ada15[_0x4248('0x1e')]],'as':_0x1ada15['as'],'attributes':_0x1ada15[_0x4248('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4248('0xb')](function(_0x50d6cf){logger[_0x4248('0xc')](_0x4248('0x16'),_0x3a2b72);logger[_0x4248('0xe')]('GetMailServerIn',_0x3a2b72,JSON['stringify'](_0x50d6cf));_0x35bb0d(_0x50d6cf);})['catch'](function(_0x190b68){logger[_0x4248('0x11')]('GetMailServerIn',_0x190b68['message'],_0x3a2b72);_0x31b10e(_0x351051[_0x4248('0x11')](0x1f4,_0x190b68[_0x4248('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 2bd4ed3..0997985 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 _0x25fb=['exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy'];(function(_0x3ae285,_0x27a64f){var _0x38de01=function(_0xdd2ac8){while(--_0xdd2ac8){_0x3ae285['push'](_0x3ae285['shift']());}};_0x38de01(++_0x27a64f);}(_0x25fb,0x1dc));var _0xb25f=function(_0x5e17c3,_0x2b12ca){_0x5e17c3=_0x5e17c3-0x0;var _0x4e14c6=_0x25fb[_0x5e17c3];return _0x4e14c6;};'use strict';var multer=require(_0xb25f('0x0'));var util=require(_0xb25f('0x1'));var path=require(_0xb25f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb25f('0x3')]();var auth=require(_0xb25f('0x4'));var interaction=require(_0xb25f('0x5'));var config=require(_0xb25f('0x6'));var controller=require(_0xb25f('0x7'));router['get']('/',auth[_0xb25f('0x8')](),controller[_0xb25f('0x9')]);router[_0xb25f('0xa')](_0xb25f('0xb'),auth[_0xb25f('0x8')](),controller[_0xb25f('0xc')]);router[_0xb25f('0xd')]('/',auth[_0xb25f('0x8')](),controller['create']);router[_0xb25f('0xe')](_0xb25f('0xb'),auth[_0xb25f('0x8')](),controller[_0xb25f('0xf')]);router[_0xb25f('0x10')](_0xb25f('0xb'),auth[_0xb25f('0x8')](),controller[_0xb25f('0x11')]);module[_0xb25f('0x12')]=router; \ No newline at end of file +var _0x8042=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','/:id','post','update','delete','destroy','multer','util'];(function(_0x207251,_0x8df5d6){var _0x5dfc27=function(_0x1f51dd){while(--_0x1f51dd){_0x207251['push'](_0x207251['shift']());}};_0x5dfc27(++_0x8df5d6);}(_0x8042,0x1ed));var _0x2804=function(_0x1b5fff,_0x4a7dad){_0x1b5fff=_0x1b5fff-0x0;var _0x31cc64=_0x8042[_0x1b5fff];return _0x31cc64;};'use strict';var multer=require(_0x2804('0x0'));var util=require(_0x2804('0x1'));var path=require('path');var timeout=require(_0x2804('0x2'));var express=require(_0x2804('0x3'));var router=express[_0x2804('0x4')]();var auth=require(_0x2804('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2804('0x6'));var controller=require(_0x2804('0x7'));router[_0x2804('0x8')]('/',auth[_0x2804('0x9')](),controller['index']);router[_0x2804('0x8')](_0x2804('0xa'),auth[_0x2804('0x9')](),controller['show']);router[_0x2804('0xb')]('/',auth[_0x2804('0x9')](),controller['create']);router['put'](_0x2804('0xa'),auth[_0x2804('0x9')](),controller[_0x2804('0xc')]);router[_0x2804('0xd')]('/:id',auth[_0x2804('0x9')](),controller[_0x2804('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index c962276..6aa4524 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 _0x24ce=['sequelize','STRING','INTEGER','BOOLEAN'];(function(_0x2053ea,_0x1ab2d4){var _0x2232c4=function(_0x4230df){while(--_0x4230df){_0x2053ea['push'](_0x2053ea['shift']());}};_0x2232c4(++_0x1ab2d4);}(_0x24ce,0x68));var _0xe24c=function(_0x55e1df,_0x56017c){_0x55e1df=_0x55e1df-0x0;var _0x311536=_0x24ce[_0x55e1df];return _0x311536;};'use strict';var Sequelize=require(_0xe24c('0x0'));module['exports']={'description':{'type':Sequelize[_0xe24c('0x1')]},'host':{'type':Sequelize[_0xe24c('0x1')]},'user':{'type':Sequelize[_0xe24c('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xe24c('0x2')]},'secure':{'type':Sequelize[_0xe24c('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xe24c('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xa47a=['exports','STRING','sequelize'];(function(_0x51b10b,_0x311567){var _0x45b2cf=function(_0xa17759){while(--_0xa17759){_0x51b10b['push'](_0x51b10b['shift']());}};_0x45b2cf(++_0x311567);}(_0xa47a,0x1b5));var _0xaa47=function(_0x3ecefe,_0x1c7630){_0x3ecefe=_0x3ecefe-0x0;var _0x2f68e6=_0xa47a[_0x3ecefe];return _0x2f68e6;};'use strict';var Sequelize=require(_0xaa47('0x0'));module[_0xaa47('0x1')]={'description':{'type':Sequelize[_0xaa47('0x2')]},'host':{'type':Sequelize[_0xaa47('0x2')]},'user':{'type':Sequelize[_0xaa47('0x2')]},'pass':{'type':Sequelize[_0xaa47('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xaa47('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 9cdf898..b69ce7a 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 _0xebcc=['create','body','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','error','name','send','index','MailServerOut','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','nolimit','sort','where','pick','add','day','filter','merge','includeAll','include','findAll','rows','catch','params','length','options','find'];(function(_0x4b174a,_0x33a017){var _0x3cd7bf=function(_0x44ccd9){while(--_0x44ccd9){_0x4b174a['push'](_0x4b174a['shift']());}};_0x3cd7bf(++_0x33a017);}(_0xebcc,0x143));var _0xcebc=function(_0x356185,_0x220c72){_0x356185=_0x356185-0x0;var _0x2f2ba5=_0xebcc[_0x356185];return _0x2f2ba5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcebc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcebc('0x1'));var rp=require(_0xcebc('0x2'));var moment=require(_0xcebc('0x3'));var BPromise=require(_0xcebc('0x4'));var Mustache=require(_0xcebc('0x5'));var util=require('util');var path=require(_0xcebc('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xcebc('0x7'));var crypto=require(_0xcebc('0x8'));var jsforce=require(_0xcebc('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xcebc('0xa'));var querystring=require(_0xcebc('0xb'));var Papa=require(_0xcebc('0xc'));var Redis=require(_0xcebc('0xd'));var qs=require(_0xcebc('0xe'));var logger=require(_0xcebc('0xf'))('api');var utils=require(_0xcebc('0x10'));var config=require('../../config/environment');var db=require(_0xcebc('0x11'))['db'];function respondWithStatusCode(_0x416358,_0x38828c){_0x38828c=_0x38828c||0xcc;return function(_0x1eabab){if(_0x1eabab){return _0x416358['sendStatus'](_0x38828c);}return _0x416358[_0xcebc('0x12')](_0x38828c)[_0xcebc('0x13')]();};}function respondWithResult(_0x45264e,_0x2e872c){_0x2e872c=_0x2e872c||0xc8;return function(_0x5f3333){if(_0x5f3333){return _0x45264e[_0xcebc('0x12')](_0x2e872c)[_0xcebc('0x14')](_0x5f3333);}};}function respondWithFilteredResult(_0x5d3f71,_0x1893ee){return function(_0x712bd5){if(_0x712bd5){var _0x1770b9=_0x712bd5[_0xcebc('0x15')],_0x3ec6bf=_0x1893ee[_0xcebc('0x16')],_0x51fa5b=_0x1893ee[_0xcebc('0x16')]+_0x1893ee[_0xcebc('0x17')],_0x27b119;if(_0x51fa5b>=_0x1770b9){_0x51fa5b=_0x1770b9;_0x27b119=0xc8;}else{_0x27b119=0xce;}_0x5d3f71['status'](_0x27b119);return _0x5d3f71['set'](_0xcebc('0x18'),_0x3ec6bf+'-'+_0x51fa5b+'/'+_0x1770b9)[_0xcebc('0x14')](_0x712bd5);}return null;};}function patchUpdates(_0xd457f2){return function(_0x1d0a11){try{jsonpatch[_0xcebc('0x19')](_0x1d0a11,_0xd457f2,!![]);}catch(_0x38e642){return BPromise[_0xcebc('0x1a')](_0x38e642);}return _0x1d0a11[_0xcebc('0x1b')]();};}function saveUpdates(_0x398bbb,_0x31d015){return function(_0x2d80ac){if(_0x2d80ac){return _0x2d80ac['update'](_0x398bbb)[_0xcebc('0x1c')](function(_0x3d9a24){return _0x3d9a24;});}return null;};}function removeEntity(_0x10f1b7,_0x3eee8b){return function(_0x4b9ad1){if(_0x4b9ad1){return _0x4b9ad1['destroy']()['then'](function(){_0x10f1b7[_0xcebc('0x12')](0xcc)[_0xcebc('0x13')]();});}};}function handleEntityNotFound(_0x34da12,_0x1b1508){return function(_0x19a9a6){if(!_0x19a9a6){_0x34da12['sendStatus'](0x194);}return _0x19a9a6;};}function handleError(_0x207499,_0x5bb5fa){_0x5bb5fa=_0x5bb5fa||0x1f4;return function(_0x4380f4){logger[_0xcebc('0x1d')](_0x4380f4['stack']);if(_0x4380f4[_0xcebc('0x1e')]){delete _0x4380f4['name'];}_0x207499[_0xcebc('0x12')](_0x5bb5fa)[_0xcebc('0x1f')](_0x4380f4);};}exports[_0xcebc('0x20')]=function(_0xe48f9d,_0x772f0a){var _0x33bbcd={},_0x43a6ab={},_0x4aa047={'count':0x0,'rows':[]};var _0x3cb7cf=db[_0xcebc('0x21')][_0xcebc('0x22')];_0x43a6ab[_0xcebc('0x23')]=_[_0xcebc('0x24')](_0x3cb7cf);var _0x3c96d3={'dateStart':_0xe48f9d[_0xcebc('0x25')][_0xcebc('0x26')],'dateEnd':_0xe48f9d[_0xcebc('0x25')][_0xcebc('0x27')]};delete _0xe48f9d['query'][_0xcebc('0x26')];delete _0xe48f9d[_0xcebc('0x25')]['dateEnd'];_0x43a6ab[_0xcebc('0x25')]=_[_0xcebc('0x24')](_0xe48f9d[_0xcebc('0x25')]);_0x43a6ab[_0xcebc('0x28')]=_['intersection'](_0x43a6ab['model'],_0x43a6ab[_0xcebc('0x25')]);_0x33bbcd[_0xcebc('0x29')]=_[_0xcebc('0x2a')](_0x43a6ab[_0xcebc('0x23')],qs['fields'](_0xe48f9d[_0xcebc('0x25')][_0xcebc('0x2b')]));_0x33bbcd['attributes']=_0x33bbcd['attributes']['length']?_0x33bbcd[_0xcebc('0x29')]:_0x43a6ab['model'];if(!_0xe48f9d[_0xcebc('0x25')]['hasOwnProperty'](_0xcebc('0x2c'))){_0x33bbcd[_0xcebc('0x17')]=qs[_0xcebc('0x17')](_0xe48f9d[_0xcebc('0x25')][_0xcebc('0x17')]);_0x33bbcd[_0xcebc('0x16')]=qs[_0xcebc('0x16')](_0xe48f9d[_0xcebc('0x25')][_0xcebc('0x16')]);}_0x33bbcd['order']=qs['sort'](_0xe48f9d['query'][_0xcebc('0x2d')]);_0x33bbcd[_0xcebc('0x2e')]=qs['filters'](_[_0xcebc('0x2f')](_0xe48f9d[_0xcebc('0x25')],_0x43a6ab[_0xcebc('0x28')]));if(_0x3c96d3[_0xcebc('0x26')]){if(_0x3c96d3[_0xcebc('0x27')]){_0x3c96d3[_0xcebc('0x27')]=moment(_0x3c96d3[_0xcebc('0x27')])[_0xcebc('0x30')](0x1,'day');}else{_0x3c96d3[_0xcebc('0x27')]=moment(_0x3c96d3['dateStart'])[_0xcebc('0x30')](0x1,_0xcebc('0x31'));}_['merge'](_0x33bbcd[_0xcebc('0x2e')],{'createdAt':{'$gte':_0x3c96d3[_0xcebc('0x26')],'$lte':_0x3c96d3['dateEnd']}});}if(_0xe48f9d[_0xcebc('0x25')][_0xcebc('0x32')]){_0x33bbcd[_0xcebc('0x2e')]=_[_0xcebc('0x33')](_0x33bbcd[_0xcebc('0x2e')],{'$or':_['map'](_0x33bbcd[_0xcebc('0x29')],function(_0xfe49c3){var _0x2c3332={};_0x2c3332[_0xfe49c3]={'$like':'%'+_0xe48f9d['query']['filter']+'%'};return _0x2c3332;})});}_0x33bbcd=_['merge']({},_0x33bbcd,_0xe48f9d['options']);var _0x2ca1c6={'where':_0x33bbcd[_0xcebc('0x2e')]};return db['MailServerOut']['count'](_0x2ca1c6)[_0xcebc('0x1c')](function(_0x4e950e){_0x4aa047[_0xcebc('0x15')]=_0x4e950e;if(_0xe48f9d[_0xcebc('0x25')][_0xcebc('0x34')]){_0x33bbcd[_0xcebc('0x35')]=[{'all':!![]}];}return db['MailServerOut'][_0xcebc('0x36')](_0x33bbcd);})[_0xcebc('0x1c')](function(_0x2142fc){_0x4aa047[_0xcebc('0x37')]=_0x2142fc;return _0x4aa047;})[_0xcebc('0x1c')](respondWithFilteredResult(_0x772f0a,_0x33bbcd))[_0xcebc('0x38')](handleError(_0x772f0a,null));};exports['show']=function(_0x4984ef,_0x39ad51){var _0x7e600f={'raw':!![],'where':{'id':_0x4984ef[_0xcebc('0x39')]['id']}},_0x19a48f={};_0x19a48f['model']=_[_0xcebc('0x24')](db['MailServerOut']['rawAttributes']);_0x19a48f[_0xcebc('0x25')]=_[_0xcebc('0x24')](_0x4984ef[_0xcebc('0x25')]);_0x19a48f[_0xcebc('0x28')]=_[_0xcebc('0x2a')](_0x19a48f[_0xcebc('0x23')],_0x19a48f['query']);_0x7e600f[_0xcebc('0x29')]=_['intersection'](_0x19a48f['model'],qs[_0xcebc('0x2b')](_0x4984ef[_0xcebc('0x25')]['fields']));_0x7e600f[_0xcebc('0x29')]=_0x7e600f[_0xcebc('0x29')][_0xcebc('0x3a')]?_0x7e600f['attributes']:_0x19a48f['model'];if(_0x4984ef[_0xcebc('0x25')][_0xcebc('0x34')]){_0x7e600f[_0xcebc('0x35')]=[{'all':!![]}];}_0x7e600f=_[_0xcebc('0x33')]({},_0x7e600f,_0x4984ef[_0xcebc('0x3b')]);return db['MailServerOut'][_0xcebc('0x3c')](_0x7e600f)[_0xcebc('0x1c')](handleEntityNotFound(_0x39ad51,null))['then'](respondWithResult(_0x39ad51,null))[_0xcebc('0x38')](handleError(_0x39ad51,null));};exports[_0xcebc('0x3d')]=function(_0x143a83,_0x3ac329){return db[_0xcebc('0x21')][_0xcebc('0x3d')](_0x143a83[_0xcebc('0x3e')],{})[_0xcebc('0x1c')](respondWithResult(_0x3ac329,0xc9))[_0xcebc('0x38')](handleError(_0x3ac329,null));};exports['update']=function(_0x24e72d,_0x1aa3ac){if(_0x24e72d[_0xcebc('0x3e')]['id']){delete _0x24e72d[_0xcebc('0x3e')]['id'];}return db[_0xcebc('0x21')][_0xcebc('0x3c')]({'where':{'id':_0x24e72d['params']['id']}})['then'](handleEntityNotFound(_0x1aa3ac,null))['then'](saveUpdates(_0x24e72d[_0xcebc('0x3e')],null))[_0xcebc('0x1c')](respondWithResult(_0x1aa3ac,null))[_0xcebc('0x38')](handleError(_0x1aa3ac,null));};exports[_0xcebc('0x3f')]=function(_0x117a72,_0x57365d){return db[_0xcebc('0x21')]['find']({'where':{'id':_0x117a72[_0xcebc('0x39')]['id']}})[_0xcebc('0x1c')](handleEntityNotFound(_0x57365d,null))[_0xcebc('0x1c')](removeEntity(_0x57365d,null))['catch'](handleError(_0x57365d,null));}; \ No newline at end of file +var _0x9383=['../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','rawAttributes','model','keys','dateStart','query','dateEnd','filters','intersection','fields','attributes','length','order','sort','where','pick','add','day','merge','filter','map','options','MailServerOut','include','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x2c09c8,_0x167bb6){var _0x1d6bd4=function(_0x2f341a){while(--_0x2f341a){_0x2c09c8['push'](_0x2c09c8['shift']());}};_0x1d6bd4(++_0x167bb6);}(_0x9383,0x7a));var _0x3938=function(_0x41c4bb,_0xca217e){_0x41c4bb=_0x41c4bb-0x0;var _0x49b9ea=_0x9383[_0x41c4bb];return _0x49b9ea;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3938('0x0'));var rimraf=require(_0x3938('0x1'));var zipdir=require(_0x3938('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3938('0x3'));var moment=require(_0x3938('0x4'));var BPromise=require(_0x3938('0x5'));var Mustache=require(_0x3938('0x6'));var util=require(_0x3938('0x7'));var path=require('path');var sox=require(_0x3938('0x8'));var csv=require('to-csv');var ejs=require(_0x3938('0x9'));var fs=require('fs');var _=require(_0x3938('0xa'));var squel=require(_0x3938('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3938('0xc'));var toCsv=require(_0x3938('0xd'));var querystring=require(_0x3938('0xe'));var Papa=require(_0x3938('0xf'));var Redis=require(_0x3938('0x10'));var qs=require(_0x3938('0x11'));var logger=require(_0x3938('0x12'))(_0x3938('0x13'));var utils=require('../../config/utils');var config=require(_0x3938('0x14'));var db=require(_0x3938('0x15'))['db'];function respondWithStatusCode(_0x45fab6,_0x5191d7){_0x5191d7=_0x5191d7||0xcc;return function(_0x5f50ca){if(_0x5f50ca){return _0x45fab6[_0x3938('0x16')](_0x5191d7);}return _0x45fab6[_0x3938('0x17')](_0x5191d7)[_0x3938('0x18')]();};}function respondWithResult(_0x1ed878,_0x8f1be6){_0x8f1be6=_0x8f1be6||0xc8;return function(_0x439031){if(_0x439031){return _0x1ed878[_0x3938('0x17')](_0x8f1be6)[_0x3938('0x19')](_0x439031);}};}function respondWithFilteredResult(_0x39912f,_0x23ae9c){return function(_0x346db6){if(_0x346db6){var _0x47af38=_0x346db6[_0x3938('0x1a')],_0x53a0ed=_0x23ae9c[_0x3938('0x1b')],_0x2d9e41=_0x23ae9c[_0x3938('0x1b')]+_0x23ae9c[_0x3938('0x1c')],_0x5a75d2;if(_0x2d9e41>=_0x47af38){_0x2d9e41=_0x47af38;_0x5a75d2=0xc8;}else{_0x5a75d2=0xce;}_0x39912f[_0x3938('0x17')](_0x5a75d2);return _0x39912f['set'](_0x3938('0x1d'),_0x53a0ed+'-'+_0x2d9e41+'/'+_0x47af38)[_0x3938('0x19')](_0x346db6);}return null;};}function patchUpdates(_0x55f535){return function(_0x47ed0e){try{jsonpatch[_0x3938('0x1e')](_0x47ed0e,_0x55f535,!![]);}catch(_0x1e07f1){return BPromise[_0x3938('0x1f')](_0x1e07f1);}return _0x47ed0e['save']();};}function saveUpdates(_0x10cf18,_0x581f05){return function(_0x5bb940){if(_0x5bb940){return _0x5bb940[_0x3938('0x20')](_0x10cf18)[_0x3938('0x21')](function(_0x5a1afb){return _0x5a1afb;});}return null;};}function removeEntity(_0x1cf1e2,_0x298841){return function(_0x23eee8){if(_0x23eee8){return _0x23eee8[_0x3938('0x22')]()[_0x3938('0x21')](function(){_0x1cf1e2[_0x3938('0x17')](0xcc)[_0x3938('0x18')]();});}};}function handleEntityNotFound(_0x5882d9,_0x433de3){return function(_0x130763){if(!_0x130763){_0x5882d9[_0x3938('0x16')](0x194);}return _0x130763;};}function handleError(_0x2d4759,_0x17bd07){_0x17bd07=_0x17bd07||0x1f4;return function(_0xe2f276){logger[_0x3938('0x23')](_0xe2f276[_0x3938('0x24')]);if(_0xe2f276[_0x3938('0x25')]){delete _0xe2f276[_0x3938('0x25')];}_0x2d4759['status'](_0x17bd07)[_0x3938('0x26')](_0xe2f276);};}exports['index']=function(_0x1290e6,_0x20ea7d){var _0xf6c5c={},_0x3392e0={},_0x453bb1={'count':0x0,'rows':[]};var _0xcbb931=db['MailServerOut'][_0x3938('0x27')];_0x3392e0[_0x3938('0x28')]=_[_0x3938('0x29')](_0xcbb931);var _0x515473={'dateStart':_0x1290e6['query'][_0x3938('0x2a')],'dateEnd':_0x1290e6[_0x3938('0x2b')][_0x3938('0x2c')]};delete _0x1290e6[_0x3938('0x2b')][_0x3938('0x2a')];delete _0x1290e6[_0x3938('0x2b')][_0x3938('0x2c')];_0x3392e0['query']=_[_0x3938('0x29')](_0x1290e6[_0x3938('0x2b')]);_0x3392e0[_0x3938('0x2d')]=_[_0x3938('0x2e')](_0x3392e0[_0x3938('0x28')],_0x3392e0[_0x3938('0x2b')]);_0xf6c5c['attributes']=_[_0x3938('0x2e')](_0x3392e0['model'],qs[_0x3938('0x2f')](_0x1290e6[_0x3938('0x2b')][_0x3938('0x2f')]));_0xf6c5c[_0x3938('0x30')]=_0xf6c5c['attributes'][_0x3938('0x31')]?_0xf6c5c[_0x3938('0x30')]:_0x3392e0[_0x3938('0x28')];if(!_0x1290e6[_0x3938('0x2b')]['hasOwnProperty']('nolimit')){_0xf6c5c[_0x3938('0x1c')]=qs['limit'](_0x1290e6[_0x3938('0x2b')][_0x3938('0x1c')]);_0xf6c5c['offset']=qs[_0x3938('0x1b')](_0x1290e6[_0x3938('0x2b')][_0x3938('0x1b')]);}_0xf6c5c[_0x3938('0x32')]=qs[_0x3938('0x33')](_0x1290e6[_0x3938('0x2b')]['sort']);_0xf6c5c[_0x3938('0x34')]=qs['filters'](_[_0x3938('0x35')](_0x1290e6[_0x3938('0x2b')],_0x3392e0[_0x3938('0x2d')]));if(_0x515473[_0x3938('0x2a')]){if(_0x515473['dateEnd']){_0x515473[_0x3938('0x2c')]=moment(_0x515473['dateEnd'])[_0x3938('0x36')](0x1,_0x3938('0x37'));}else{_0x515473[_0x3938('0x2c')]=moment(_0x515473[_0x3938('0x2a')])[_0x3938('0x36')](0x1,_0x3938('0x37'));}_[_0x3938('0x38')](_0xf6c5c[_0x3938('0x34')],{'createdAt':{'$gte':_0x515473[_0x3938('0x2a')],'$lte':_0x515473['dateEnd']}});}if(_0x1290e6[_0x3938('0x2b')][_0x3938('0x39')]){_0xf6c5c[_0x3938('0x34')]=_[_0x3938('0x38')](_0xf6c5c[_0x3938('0x34')],{'$or':_[_0x3938('0x3a')](_0xf6c5c[_0x3938('0x30')],function(_0x113346){var _0x180896={};_0x180896[_0x113346]={'$like':'%'+_0x1290e6[_0x3938('0x2b')]['filter']+'%'};return _0x180896;})});}_0xf6c5c=_['merge']({},_0xf6c5c,_0x1290e6[_0x3938('0x3b')]);var _0x399d7f={'where':_0xf6c5c[_0x3938('0x34')]};return db[_0x3938('0x3c')][_0x3938('0x1a')](_0x399d7f)[_0x3938('0x21')](function(_0x5d9bc0){_0x453bb1[_0x3938('0x1a')]=_0x5d9bc0;if(_0x1290e6[_0x3938('0x2b')]['includeAll']){_0xf6c5c[_0x3938('0x3d')]=[{'all':!![]}];}return db[_0x3938('0x3c')][_0x3938('0x3e')](_0xf6c5c);})[_0x3938('0x21')](function(_0x332786){_0x453bb1[_0x3938('0x3f')]=_0x332786;return _0x453bb1;})[_0x3938('0x21')](respondWithFilteredResult(_0x20ea7d,_0xf6c5c))[_0x3938('0x40')](handleError(_0x20ea7d,null));};exports[_0x3938('0x41')]=function(_0xa22d8d,_0x28e4a5){var _0x3efaa2={'raw':!![],'where':{'id':_0xa22d8d[_0x3938('0x42')]['id']}},_0x1736f1={};_0x1736f1[_0x3938('0x28')]=_['keys'](db['MailServerOut']['rawAttributes']);_0x1736f1['query']=_[_0x3938('0x29')](_0xa22d8d[_0x3938('0x2b')]);_0x1736f1['filters']=_[_0x3938('0x2e')](_0x1736f1[_0x3938('0x28')],_0x1736f1[_0x3938('0x2b')]);_0x3efaa2[_0x3938('0x30')]=_[_0x3938('0x2e')](_0x1736f1[_0x3938('0x28')],qs['fields'](_0xa22d8d['query'][_0x3938('0x2f')]));_0x3efaa2[_0x3938('0x30')]=_0x3efaa2[_0x3938('0x30')][_0x3938('0x31')]?_0x3efaa2[_0x3938('0x30')]:_0x1736f1[_0x3938('0x28')];if(_0xa22d8d[_0x3938('0x2b')][_0x3938('0x43')]){_0x3efaa2[_0x3938('0x3d')]=[{'all':!![]}];}_0x3efaa2=_[_0x3938('0x38')]({},_0x3efaa2,_0xa22d8d[_0x3938('0x3b')]);return db[_0x3938('0x3c')][_0x3938('0x44')](_0x3efaa2)[_0x3938('0x21')](handleEntityNotFound(_0x28e4a5,null))['then'](respondWithResult(_0x28e4a5,null))[_0x3938('0x40')](handleError(_0x28e4a5,null));};exports['create']=function(_0x2c8a0f,_0x78ae9){return db[_0x3938('0x3c')][_0x3938('0x45')](_0x2c8a0f[_0x3938('0x46')],{})[_0x3938('0x21')](respondWithResult(_0x78ae9,0xc9))['catch'](handleError(_0x78ae9,null));};exports[_0x3938('0x20')]=function(_0x1d3051,_0x523d70){if(_0x1d3051['body']['id']){delete _0x1d3051['body']['id'];}return db[_0x3938('0x3c')][_0x3938('0x44')]({'where':{'id':_0x1d3051[_0x3938('0x42')]['id']}})[_0x3938('0x21')](handleEntityNotFound(_0x523d70,null))['then'](saveUpdates(_0x1d3051['body'],null))[_0x3938('0x21')](respondWithResult(_0x523d70,null))[_0x3938('0x40')](handleError(_0x523d70,null));};exports[_0x3938('0x22')]=function(_0x16bbda,_0x3c37b5){return db[_0x3938('0x3c')]['find']({'where':{'id':_0x16bbda[_0x3938('0x42')]['id']}})[_0x3938('0x21')](handleEntityNotFound(_0x3c37b5,null))[_0x3938('0x21')](removeEntity(_0x3c37b5,null))[_0x3938('0x40')](handleError(_0x3c37b5,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index b101c14..dabbbea 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 _0x4300=['define','mail_servers_out','lodash','bluebird','request-promise','./mailServerOut.attributes','exports'];(function(_0x208853,_0x4dce71){var _0x5a8686=function(_0x53f4f5){while(--_0x53f4f5){_0x208853['push'](_0x208853['shift']());}};_0x5a8686(++_0x4dce71);}(_0x4300,0x1a6));var _0x0430=function(_0x5f3c0f,_0x21214c){_0x5f3c0f=_0x5f3c0f-0x0;var _0x1103f2=_0x4300[_0x5f3c0f];return _0x1103f2;};'use strict';var _=require(_0x0430('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0430('0x1'));var rp=require(_0x0430('0x2'));var attributes=require(_0x0430('0x3'));module[_0x0430('0x4')]=function(_0x1735aa,_0x5d0aac){return _0x1735aa[_0x0430('0x5')]('MailServerOut',attributes,{'tableName':_0x0430('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4317=['request-promise','./mailServerOut.attributes','exports','mail_servers_out','util','../../config/logger','api','bluebird'];(function(_0x3f57bf,_0x3f3bee){var _0x11b3c4=function(_0x10c2c9){while(--_0x10c2c9){_0x3f57bf['push'](_0x3f57bf['shift']());}};_0x11b3c4(++_0x3f3bee);}(_0x4317,0x7c));var _0x7431=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x4317[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require(_0x7431('0x0'));var logger=require(_0x7431('0x1'))(_0x7431('0x2'));var moment=require('moment');var BPromise=require(_0x7431('0x3'));var rp=require(_0x7431('0x4'));var attributes=require(_0x7431('0x5'));module[_0x7431('0x6')]=function(_0x12c492,_0x201287){return _0x12c492['define']('MailServerOut',attributes,{'tableName':_0x7431('0x7'),'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 8566426..2ea9749 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 _0x8577=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','MailServerOut,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x5bee3a,_0x4da6d4){var _0x487b45=function(_0x53630d){while(--_0x53630d){_0x5bee3a['push'](_0x5bee3a['shift']());}};_0x487b45(++_0x4da6d4);}(_0x8577,0x19d));var _0x7857=function(_0x1c289d,_0x385e8b){_0x1c289d=_0x1c289d-0x0;var _0x5d184e=_0x8577[_0x1c289d];return _0x5d184e;};'use strict';var _=require(_0x7857('0x0'));var util=require('util');var moment=require(_0x7857('0x1'));var BPromise=require(_0x7857('0x2'));var rs=require(_0x7857('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7857('0x4'))['db'];var utils=require(_0x7857('0x5'));var logger=require(_0x7857('0x6'))(_0x7857('0x7'));var config=require(_0x7857('0x8'));var jayson=require(_0x7857('0x9'));var client=jayson[_0x7857('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11614c,_0x2ea52c,_0x550d7f){return new BPromise(function(_0x4afaa3,_0x21db4f){return client[_0x7857('0xb')](_0x11614c,_0x550d7f)[_0x7857('0xc')](function(_0x1027a4){logger['info']('MailServerOut,\x20%s,\x20%s',_0x2ea52c,_0x7857('0xd'));logger[_0x7857('0xe')](_0x7857('0xf'),_0x2ea52c,_0x7857('0xd'),JSON[_0x7857('0x10')](_0x1027a4));if(_0x1027a4[_0x7857('0x11')]){if(_0x1027a4[_0x7857('0x11')][_0x7857('0x12')]===0x1f4){logger['error'](_0x7857('0x13'),_0x2ea52c,_0x1027a4[_0x7857('0x11')][_0x7857('0x14')]);return _0x21db4f(_0x1027a4[_0x7857('0x11')]['message']);}logger['error'](_0x7857('0x13'),_0x2ea52c,_0x1027a4[_0x7857('0x11')][_0x7857('0x14')]);return _0x4afaa3(_0x1027a4[_0x7857('0x11')][_0x7857('0x14')]);}else{logger['info'](_0x7857('0x13'),_0x2ea52c,_0x7857('0xd'));_0x4afaa3(_0x1027a4[_0x7857('0x15')]['message']);}})['catch'](function(_0x37572a){logger[_0x7857('0x11')](_0x7857('0x13'),_0x2ea52c,_0x37572a);_0x21db4f(_0x37572a);});});} \ No newline at end of file +var _0xca12=['../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x35c3f4,_0x5f5154){var _0x4bf0f6=function(_0x268916){while(--_0x268916){_0x35c3f4['push'](_0x35c3f4['shift']());}};_0x4bf0f6(++_0x5f5154);}(_0xca12,0x1c8));var _0x2ca1=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xca12[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0x2ca1('0x0'));var util=require(_0x2ca1('0x1'));var moment=require(_0x2ca1('0x2'));var BPromise=require(_0x2ca1('0x3'));var rs=require(_0x2ca1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2ca1('0x5'))['db'];var utils=require(_0x2ca1('0x6'));var logger=require('../../config/logger')(_0x2ca1('0x7'));var config=require(_0x2ca1('0x8'));var jayson=require(_0x2ca1('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x22b90a,_0x4d4e27,_0x44a731){return new BPromise(function(_0x7bb950,_0x3a081f){return client[_0x2ca1('0xa')](_0x22b90a,_0x44a731)[_0x2ca1('0xb')](function(_0x49f112){logger[_0x2ca1('0xc')](_0x2ca1('0xd'),_0x4d4e27,'request\x20sent');logger[_0x2ca1('0xe')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x4d4e27,_0x2ca1('0xf'),JSON[_0x2ca1('0x10')](_0x49f112));if(_0x49f112[_0x2ca1('0x11')]){if(_0x49f112[_0x2ca1('0x11')][_0x2ca1('0x12')]===0x1f4){logger[_0x2ca1('0x11')]('MailServerOut,\x20%s,\x20%s',_0x4d4e27,_0x49f112['error'][_0x2ca1('0x13')]);return _0x3a081f(_0x49f112['error'][_0x2ca1('0x13')]);}logger[_0x2ca1('0x11')](_0x2ca1('0xd'),_0x4d4e27,_0x49f112[_0x2ca1('0x11')][_0x2ca1('0x13')]);return _0x7bb950(_0x49f112[_0x2ca1('0x11')][_0x2ca1('0x13')]);}else{logger['info'](_0x2ca1('0xd'),_0x4d4e27,_0x2ca1('0xf'));_0x7bb950(_0x49f112['result'][_0x2ca1('0x13')]);}})[_0x2ca1('0x14')](function(_0x21ca10){logger['error'](_0x2ca1('0xd'),_0x4d4e27,_0x21ca10);_0x3a081f(_0x21ca10);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 800c145..d74b40f 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 _0x71c9=['delete','destroy','exports','multer','connect-timeout','Router','../../components/auth/service','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x2bfd4f,_0x1bbf2c){var _0x341849=function(_0x4c246e){while(--_0x4c246e){_0x2bfd4f['push'](_0x2bfd4f['shift']());}};_0x341849(++_0x1bbf2c);}(_0x71c9,0x111));var _0x971c=function(_0x281055,_0x495e4c){_0x281055=_0x281055-0x0;var _0x1ae017=_0x71c9[_0x281055];return _0x1ae017;};'use strict';var multer=require(_0x971c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x971c('0x1'));var express=require('express');var router=express[_0x971c('0x2')]();var auth=require(_0x971c('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x971c('0x4'));router[_0x971c('0x5')]('/',auth[_0x971c('0x6')](),controller[_0x971c('0x7')]);router[_0x971c('0x5')](_0x971c('0x8'),auth[_0x971c('0x6')](),controller[_0x971c('0x9')]);router[_0x971c('0x5')](_0x971c('0xa'),auth['isAuthenticated'](),controller[_0x971c('0xb')]);router[_0x971c('0xc')]('/',auth[_0x971c('0x6')](),controller[_0x971c('0xd')]);router[_0x971c('0xe')](_0x971c('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x971c('0xf')]('/:id',auth[_0x971c('0x6')](),controller[_0x971c('0x10')]);module[_0x971c('0x11')]=router; \ No newline at end of file +var _0xba07=['describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','isAuthenticated'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xba07,0x185));var _0x7ba0=function(_0x44814a,_0x29d546){_0x44814a=_0x44814a-0x0;var _0x759e3f=_0xba07[_0x44814a];return _0x759e3f;};'use strict';var multer=require(_0x7ba0('0x0'));var util=require(_0x7ba0('0x1'));var path=require(_0x7ba0('0x2'));var timeout=require('connect-timeout');var express=require(_0x7ba0('0x3'));var router=express['Router']();var auth=require(_0x7ba0('0x4'));var interaction=require(_0x7ba0('0x5'));var config=require(_0x7ba0('0x6'));var controller=require(_0x7ba0('0x7'));router[_0x7ba0('0x8')]('/',auth['isAuthenticated'](),controller[_0x7ba0('0x9')]);router['get']('/describe',auth[_0x7ba0('0xa')](),controller[_0x7ba0('0xb')]);router[_0x7ba0('0x8')](_0x7ba0('0xc'),auth[_0x7ba0('0xa')](),controller['show']);router[_0x7ba0('0xd')]('/',auth[_0x7ba0('0xa')](),controller[_0x7ba0('0xe')]);router[_0x7ba0('0xf')](_0x7ba0('0xc'),auth[_0x7ba0('0xa')](),controller[_0x7ba0('0x10')]);router[_0x7ba0('0x11')]('/:id',auth[_0x7ba0('0xa')](),controller[_0x7ba0('0x12')]);module[_0x7ba0('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index daff4e4..dd3a76b 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 _0x6f7a=['STRING','name','sequelize','exports'];(function(_0x33628a,_0x2df134){var _0x25d370=function(_0x5567fc){while(--_0x5567fc){_0x33628a['push'](_0x33628a['shift']());}};_0x25d370(++_0x2df134);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x46966e,_0x162146){_0x46966e=_0x46966e-0x0;var _0x4254f8=_0x6f7a[_0x46966e];return _0x4254f8;};'use strict';var Sequelize=require(_0xa6f7('0x0'));module[_0xa6f7('0x1')]={'name':{'type':Sequelize[_0xa6f7('0x2')],'unique':_0xa6f7('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe3d4=['exports','STRING','name'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xe3d4,0xc6));var _0x4e3d=function(_0x1cbecb,_0x505e33){_0x1cbecb=_0x1cbecb-0x0;var _0x4112c4=_0xe3d4[_0x1cbecb];return _0x4112c4;};'use strict';var Sequelize=require('sequelize');module[_0x4e3d('0x0')]={'name':{'type':Sequelize[_0x4e3d('0x1')],'unique':_0x4e3d('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index c6a98bb..bfc4cbb 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 _0xd203=['rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','add','day','merge','filter','map','MailSubstatus','count','includeAll','findAll','rows','show','length','find','catch','create','body','params','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','json','apply','save','update','then','destroy','error','stack','name','index'];(function(_0x47f0f8,_0x5f0deb){var _0x4f1cdb=function(_0x433b62){while(--_0x433b62){_0x47f0f8['push'](_0x47f0f8['shift']());}};_0x4f1cdb(++_0x5f0deb);}(_0xd203,0x193));var _0x3d20=function(_0x5ae89e,_0xc5d766){_0x5ae89e=_0x5ae89e-0x0;var _0x60378e=_0xd203[_0x5ae89e];return _0x60378e;};'use strict';var pdf=require(_0x3d20('0x0'));var emlformat=require(_0x3d20('0x1'));var rimraf=require(_0x3d20('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3d20('0x3'));var moment=require(_0x3d20('0x4'));var BPromise=require(_0x3d20('0x5'));var Mustache=require(_0x3d20('0x6'));var util=require(_0x3d20('0x7'));var path=require(_0x3d20('0x8'));var sox=require(_0x3d20('0x9'));var csv=require(_0x3d20('0xa'));var ejs=require(_0x3d20('0xb'));var fs=require('fs');var _=require(_0x3d20('0xc'));var squel=require(_0x3d20('0xd'));var crypto=require(_0x3d20('0xe'));var jsforce=require(_0x3d20('0xf'));var deskjs=require(_0x3d20('0x10'));var toCsv=require(_0x3d20('0xa'));var querystring=require(_0x3d20('0x11'));var Papa=require(_0x3d20('0x12'));var Redis=require(_0x3d20('0x13'));var qs=require(_0x3d20('0x14'));var logger=require(_0x3d20('0x15'))(_0x3d20('0x16'));var utils=require('../../config/utils');var config=require(_0x3d20('0x17'));var db=require(_0x3d20('0x18'))['db'];function respondWithStatusCode(_0x475a6b,_0xc47b74){_0xc47b74=_0xc47b74||0xcc;return function(_0x1afb8a){if(_0x1afb8a){return _0x475a6b[_0x3d20('0x19')](_0xc47b74);}return _0x475a6b[_0x3d20('0x1a')](_0xc47b74)[_0x3d20('0x1b')]();};}function respondWithResult(_0x345483,_0x3e84df){_0x3e84df=_0x3e84df||0xc8;return function(_0x4b9af1){if(_0x4b9af1){return _0x345483[_0x3d20('0x1a')](_0x3e84df)['json'](_0x4b9af1);}};}function respondWithFilteredResult(_0x107149,_0x1fd99f){return function(_0x34d0fa){if(_0x34d0fa){var _0x2ae761=_0x34d0fa['count'],_0x1011df=_0x1fd99f[_0x3d20('0x1c')],_0x21c943=_0x1fd99f[_0x3d20('0x1c')]+_0x1fd99f[_0x3d20('0x1d')],_0x23df26;if(_0x21c943>=_0x2ae761){_0x21c943=_0x2ae761;_0x23df26=0xc8;}else{_0x23df26=0xce;}_0x107149[_0x3d20('0x1a')](_0x23df26);return _0x107149['set'](_0x3d20('0x1e'),_0x1011df+'-'+_0x21c943+'/'+_0x2ae761)[_0x3d20('0x1f')](_0x34d0fa);}return null;};}function patchUpdates(_0x5e1dc7){return function(_0x1942b9){try{jsonpatch[_0x3d20('0x20')](_0x1942b9,_0x5e1dc7,!![]);}catch(_0x4a4eb0){return BPromise['reject'](_0x4a4eb0);}return _0x1942b9[_0x3d20('0x21')]();};}function saveUpdates(_0x273b3b,_0x91dfc4){return function(_0x12796d){if(_0x12796d){return _0x12796d[_0x3d20('0x22')](_0x273b3b)[_0x3d20('0x23')](function(_0x2e96af){return _0x2e96af;});}return null;};}function removeEntity(_0x427fbf,_0x4305b4){return function(_0x100ad1){if(_0x100ad1){return _0x100ad1[_0x3d20('0x24')]()[_0x3d20('0x23')](function(){_0x427fbf[_0x3d20('0x1a')](0xcc)[_0x3d20('0x1b')]();});}};}function handleEntityNotFound(_0x2b541f,_0x1be460){return function(_0x37b333){if(!_0x37b333){_0x2b541f['sendStatus'](0x194);}return _0x37b333;};}function handleError(_0x36b7cc,_0xb2d481){_0xb2d481=_0xb2d481||0x1f4;return function(_0x188e02){logger[_0x3d20('0x25')](_0x188e02[_0x3d20('0x26')]);if(_0x188e02['name']){delete _0x188e02[_0x3d20('0x27')];}_0x36b7cc[_0x3d20('0x1a')](_0xb2d481)['send'](_0x188e02);};}exports[_0x3d20('0x28')]=function(_0x1c3136,_0x3d542e){var _0xc37f5c={},_0x46e757={},_0x4abbc9={'count':0x0,'rows':[]};var _0x144e54=db['MailSubstatus'][_0x3d20('0x29')];_0x46e757[_0x3d20('0x2a')]=_[_0x3d20('0x2b')](_0x144e54);var _0x3a2256={'dateStart':_0x1c3136[_0x3d20('0x2c')][_0x3d20('0x2d')],'dateEnd':_0x1c3136['query'][_0x3d20('0x2e')]};delete _0x1c3136[_0x3d20('0x2c')][_0x3d20('0x2d')];delete _0x1c3136[_0x3d20('0x2c')][_0x3d20('0x2e')];_0x46e757[_0x3d20('0x2c')]=_[_0x3d20('0x2b')](_0x1c3136[_0x3d20('0x2c')]);_0x46e757[_0x3d20('0x2f')]=_[_0x3d20('0x30')](_0x46e757[_0x3d20('0x2a')],_0x46e757['query']);_0xc37f5c['attributes']=_[_0x3d20('0x30')](_0x46e757[_0x3d20('0x2a')],qs[_0x3d20('0x31')](_0x1c3136[_0x3d20('0x2c')][_0x3d20('0x31')]));_0xc37f5c[_0x3d20('0x32')]=_0xc37f5c['attributes']['length']?_0xc37f5c[_0x3d20('0x32')]:_0x46e757['model'];if(!_0x1c3136[_0x3d20('0x2c')][_0x3d20('0x33')]('nolimit')){_0xc37f5c[_0x3d20('0x1d')]=qs[_0x3d20('0x1d')](_0x1c3136[_0x3d20('0x2c')][_0x3d20('0x1d')]);_0xc37f5c[_0x3d20('0x1c')]=qs[_0x3d20('0x1c')](_0x1c3136[_0x3d20('0x2c')][_0x3d20('0x1c')]);}_0xc37f5c[_0x3d20('0x34')]=qs[_0x3d20('0x35')](_0x1c3136[_0x3d20('0x2c')][_0x3d20('0x35')]);_0xc37f5c[_0x3d20('0x36')]=qs[_0x3d20('0x2f')](_[_0x3d20('0x37')](_0x1c3136['query'],_0x46e757[_0x3d20('0x2f')]));if(_0x3a2256['dateStart']){if(_0x3a2256['dateEnd']){_0x3a2256[_0x3d20('0x2e')]=moment(_0x3a2256[_0x3d20('0x2e')])[_0x3d20('0x38')](0x1,_0x3d20('0x39'));}else{_0x3a2256['dateEnd']=moment(_0x3a2256[_0x3d20('0x2d')])[_0x3d20('0x38')](0x1,_0x3d20('0x39'));}_[_0x3d20('0x3a')](_0xc37f5c[_0x3d20('0x36')],{'createdAt':{'$gte':_0x3a2256['dateStart'],'$lte':_0x3a2256[_0x3d20('0x2e')]}});}if(_0x1c3136[_0x3d20('0x2c')][_0x3d20('0x3b')]){_0xc37f5c[_0x3d20('0x36')]=_[_0x3d20('0x3a')](_0xc37f5c[_0x3d20('0x36')],{'$or':_[_0x3d20('0x3c')](_0xc37f5c[_0x3d20('0x32')],function(_0x22dc47){var _0x4e9cc5={};_0x4e9cc5[_0x22dc47]={'$like':'%'+_0x1c3136['query']['filter']+'%'};return _0x4e9cc5;})});}_0xc37f5c=_[_0x3d20('0x3a')]({},_0xc37f5c,_0x1c3136['options']);var _0x31912b={'where':_0xc37f5c['where']};return db[_0x3d20('0x3d')][_0x3d20('0x3e')](_0x31912b)[_0x3d20('0x23')](function(_0x45d483){_0x4abbc9[_0x3d20('0x3e')]=_0x45d483;if(_0x1c3136[_0x3d20('0x2c')][_0x3d20('0x3f')]){_0xc37f5c['include']=[{'all':!![]}];}return db['MailSubstatus'][_0x3d20('0x40')](_0xc37f5c);})['then'](function(_0x46a108){_0x4abbc9[_0x3d20('0x41')]=_0x46a108;return _0x4abbc9;})['then'](respondWithFilteredResult(_0x3d542e,_0xc37f5c))['catch'](handleError(_0x3d542e,null));};exports[_0x3d20('0x42')]=function(_0x14ff94,_0x4a7c75){var _0x55a724={'raw':!![],'where':{'id':_0x14ff94['params']['id']}},_0x590a63={};_0x590a63[_0x3d20('0x2a')]=_[_0x3d20('0x2b')](db[_0x3d20('0x3d')][_0x3d20('0x29')]);_0x590a63[_0x3d20('0x2c')]=_[_0x3d20('0x2b')](_0x14ff94[_0x3d20('0x2c')]);_0x590a63['filters']=_[_0x3d20('0x30')](_0x590a63[_0x3d20('0x2a')],_0x590a63[_0x3d20('0x2c')]);_0x55a724[_0x3d20('0x32')]=_[_0x3d20('0x30')](_0x590a63[_0x3d20('0x2a')],qs['fields'](_0x14ff94[_0x3d20('0x2c')]['fields']));_0x55a724['attributes']=_0x55a724[_0x3d20('0x32')][_0x3d20('0x43')]?_0x55a724['attributes']:_0x590a63[_0x3d20('0x2a')];if(_0x14ff94['query']['includeAll']){_0x55a724['include']=[{'all':!![]}];}_0x55a724=_['merge']({},_0x55a724,_0x14ff94['options']);return db[_0x3d20('0x3d')][_0x3d20('0x44')](_0x55a724)[_0x3d20('0x23')](handleEntityNotFound(_0x4a7c75,null))[_0x3d20('0x23')](respondWithResult(_0x4a7c75,null))[_0x3d20('0x45')](handleError(_0x4a7c75,null));};exports[_0x3d20('0x46')]=function(_0x2c9238,_0x286bac){return db['MailSubstatus'][_0x3d20('0x46')](_0x2c9238['body'],{})[_0x3d20('0x23')](respondWithResult(_0x286bac,0xc9))[_0x3d20('0x45')](handleError(_0x286bac,null));};exports[_0x3d20('0x22')]=function(_0x28091c,_0x1f775b){if(_0x28091c['body']['id']){delete _0x28091c[_0x3d20('0x47')]['id'];}return db[_0x3d20('0x3d')][_0x3d20('0x44')]({'where':{'id':_0x28091c[_0x3d20('0x48')]['id']}})[_0x3d20('0x23')](handleEntityNotFound(_0x1f775b,null))['then'](saveUpdates(_0x28091c[_0x3d20('0x47')],null))[_0x3d20('0x23')](respondWithResult(_0x1f775b,null))['catch'](handleError(_0x1f775b,null));};exports['destroy']=function(_0x889a53,_0x44081b){return db[_0x3d20('0x3d')][_0x3d20('0x44')]({'where':{'id':_0x889a53['params']['id']}})[_0x3d20('0x23')](handleEntityNotFound(_0x44081b,null))[_0x3d20('0x23')](removeEntity(_0x44081b,null))[_0x3d20('0x45')](handleError(_0x44081b,null));};exports[_0x3d20('0x49')]=function(_0x1cd24e,_0x55303f){return db['MailSubstatus'][_0x3d20('0x49')]()[_0x3d20('0x23')](respondWithResult(_0x55303f,null))['catch'](handleError(_0x55303f,null));}; \ No newline at end of file +var _0x6d82=['then','destroy','error','stack','send','model','query','dateStart','dateEnd','intersection','attributes','length','nolimit','limit','order','sort','where','pick','filters','add','day','filter','map','merge','options','MailSubstatus','includeAll','include','findAll','rows','show','params','keys','fields','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','set','Content-Range','apply','save','update'];(function(_0x5c5c52,_0x36d085){var _0x4229ff=function(_0x3806df){while(--_0x3806df){_0x5c5c52['push'](_0x5c5c52['shift']());}};_0x4229ff(++_0x36d085);}(_0x6d82,0x1ca));var _0x26d8=function(_0x451485,_0x5e8ecc){_0x451485=_0x451485-0x0;var _0x2378ed=_0x6d82[_0x451485];return _0x2378ed;};'use strict';var pdf=require(_0x26d8('0x0'));var emlformat=require(_0x26d8('0x1'));var rimraf=require(_0x26d8('0x2'));var zipdir=require(_0x26d8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x26d8('0x4'));var util=require(_0x26d8('0x5'));var path=require(_0x26d8('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x26d8('0x7'));var squel=require(_0x26d8('0x8'));var crypto=require(_0x26d8('0x9'));var jsforce=require(_0x26d8('0xa'));var deskjs=require(_0x26d8('0xb'));var toCsv=require(_0x26d8('0xc'));var querystring=require(_0x26d8('0xd'));var Papa=require(_0x26d8('0xe'));var Redis=require(_0x26d8('0xf'));var qs=require(_0x26d8('0x10'));var logger=require(_0x26d8('0x11'))(_0x26d8('0x12'));var utils=require(_0x26d8('0x13'));var config=require(_0x26d8('0x14'));var db=require(_0x26d8('0x15'))['db'];function respondWithStatusCode(_0x4aebc4,_0x4d6026){_0x4d6026=_0x4d6026||0xcc;return function(_0x40fa88){if(_0x40fa88){return _0x4aebc4[_0x26d8('0x16')](_0x4d6026);}return _0x4aebc4['status'](_0x4d6026)[_0x26d8('0x17')]();};}function respondWithResult(_0x125b8,_0x5b0b1){_0x5b0b1=_0x5b0b1||0xc8;return function(_0x21c6c6){if(_0x21c6c6){return _0x125b8[_0x26d8('0x18')](_0x5b0b1)['json'](_0x21c6c6);}};}function respondWithFilteredResult(_0x46360c,_0x42659f){return function(_0x2cf070){if(_0x2cf070){var _0x48a11d=_0x2cf070[_0x26d8('0x19')],_0x3a54c2=_0x42659f[_0x26d8('0x1a')],_0x12a01a=_0x42659f[_0x26d8('0x1a')]+_0x42659f['limit'],_0x803c89;if(_0x12a01a>=_0x48a11d){_0x12a01a=_0x48a11d;_0x803c89=0xc8;}else{_0x803c89=0xce;}_0x46360c['status'](_0x803c89);return _0x46360c[_0x26d8('0x1b')](_0x26d8('0x1c'),_0x3a54c2+'-'+_0x12a01a+'/'+_0x48a11d)['json'](_0x2cf070);}return null;};}function patchUpdates(_0x4d5d65){return function(_0x133b1f){try{jsonpatch[_0x26d8('0x1d')](_0x133b1f,_0x4d5d65,!![]);}catch(_0x13019c){return BPromise['reject'](_0x13019c);}return _0x133b1f[_0x26d8('0x1e')]();};}function saveUpdates(_0xe8562c,_0x5cb827){return function(_0x56764f){if(_0x56764f){return _0x56764f[_0x26d8('0x1f')](_0xe8562c)[_0x26d8('0x20')](function(_0x5532ef){return _0x5532ef;});}return null;};}function removeEntity(_0x1f5bbf,_0x468c1d){return function(_0x3fd270){if(_0x3fd270){return _0x3fd270[_0x26d8('0x21')]()[_0x26d8('0x20')](function(){_0x1f5bbf['status'](0xcc)[_0x26d8('0x17')]();});}};}function handleEntityNotFound(_0x38cdba,_0x473f35){return function(_0x552fcf){if(!_0x552fcf){_0x38cdba['sendStatus'](0x194);}return _0x552fcf;};}function handleError(_0x3f5971,_0x1de052){_0x1de052=_0x1de052||0x1f4;return function(_0x1bd0ef){logger[_0x26d8('0x22')](_0x1bd0ef[_0x26d8('0x23')]);if(_0x1bd0ef['name']){delete _0x1bd0ef['name'];}_0x3f5971[_0x26d8('0x18')](_0x1de052)[_0x26d8('0x24')](_0x1bd0ef);};}exports['index']=function(_0x49b771,_0x4a47a7){var _0x265c5e={},_0x8a828e={},_0x2240d7={'count':0x0,'rows':[]};var _0x105b01=db['MailSubstatus']['rawAttributes'];_0x8a828e[_0x26d8('0x25')]=_['keys'](_0x105b01);var _0x2b5a71={'dateStart':_0x49b771[_0x26d8('0x26')][_0x26d8('0x27')],'dateEnd':_0x49b771['query'][_0x26d8('0x28')]};delete _0x49b771[_0x26d8('0x26')][_0x26d8('0x27')];delete _0x49b771['query']['dateEnd'];_0x8a828e[_0x26d8('0x26')]=_['keys'](_0x49b771[_0x26d8('0x26')]);_0x8a828e['filters']=_[_0x26d8('0x29')](_0x8a828e['model'],_0x8a828e['query']);_0x265c5e[_0x26d8('0x2a')]=_[_0x26d8('0x29')](_0x8a828e['model'],qs['fields'](_0x49b771['query']['fields']));_0x265c5e[_0x26d8('0x2a')]=_0x265c5e['attributes'][_0x26d8('0x2b')]?_0x265c5e[_0x26d8('0x2a')]:_0x8a828e[_0x26d8('0x25')];if(!_0x49b771[_0x26d8('0x26')]['hasOwnProperty'](_0x26d8('0x2c'))){_0x265c5e[_0x26d8('0x2d')]=qs[_0x26d8('0x2d')](_0x49b771['query']['limit']);_0x265c5e[_0x26d8('0x1a')]=qs['offset'](_0x49b771[_0x26d8('0x26')][_0x26d8('0x1a')]);}_0x265c5e[_0x26d8('0x2e')]=qs['sort'](_0x49b771[_0x26d8('0x26')][_0x26d8('0x2f')]);_0x265c5e[_0x26d8('0x30')]=qs['filters'](_[_0x26d8('0x31')](_0x49b771['query'],_0x8a828e[_0x26d8('0x32')]));if(_0x2b5a71[_0x26d8('0x27')]){if(_0x2b5a71[_0x26d8('0x28')]){_0x2b5a71[_0x26d8('0x28')]=moment(_0x2b5a71[_0x26d8('0x28')])[_0x26d8('0x33')](0x1,_0x26d8('0x34'));}else{_0x2b5a71[_0x26d8('0x28')]=moment(_0x2b5a71[_0x26d8('0x27')])['add'](0x1,_0x26d8('0x34'));}_['merge'](_0x265c5e['where'],{'createdAt':{'$gte':_0x2b5a71[_0x26d8('0x27')],'$lte':_0x2b5a71[_0x26d8('0x28')]}});}if(_0x49b771[_0x26d8('0x26')][_0x26d8('0x35')]){_0x265c5e['where']=_['merge'](_0x265c5e['where'],{'$or':_[_0x26d8('0x36')](_0x265c5e['attributes'],function(_0x584339){var _0x28fdad={};_0x28fdad[_0x584339]={'$like':'%'+_0x49b771[_0x26d8('0x26')][_0x26d8('0x35')]+'%'};return _0x28fdad;})});}_0x265c5e=_[_0x26d8('0x37')]({},_0x265c5e,_0x49b771[_0x26d8('0x38')]);var _0x5363c2={'where':_0x265c5e['where']};return db[_0x26d8('0x39')][_0x26d8('0x19')](_0x5363c2)[_0x26d8('0x20')](function(_0x35373e){_0x2240d7[_0x26d8('0x19')]=_0x35373e;if(_0x49b771[_0x26d8('0x26')][_0x26d8('0x3a')]){_0x265c5e[_0x26d8('0x3b')]=[{'all':!![]}];}return db[_0x26d8('0x39')][_0x26d8('0x3c')](_0x265c5e);})[_0x26d8('0x20')](function(_0x179908){_0x2240d7[_0x26d8('0x3d')]=_0x179908;return _0x2240d7;})[_0x26d8('0x20')](respondWithFilteredResult(_0x4a47a7,_0x265c5e))['catch'](handleError(_0x4a47a7,null));};exports[_0x26d8('0x3e')]=function(_0xd6d9b2,_0x113b1f){var _0x5425bd={'raw':!![],'where':{'id':_0xd6d9b2[_0x26d8('0x3f')]['id']}},_0x564a02={};_0x564a02[_0x26d8('0x25')]=_[_0x26d8('0x40')](db[_0x26d8('0x39')]['rawAttributes']);_0x564a02[_0x26d8('0x26')]=_[_0x26d8('0x40')](_0xd6d9b2[_0x26d8('0x26')]);_0x564a02[_0x26d8('0x32')]=_[_0x26d8('0x29')](_0x564a02[_0x26d8('0x25')],_0x564a02[_0x26d8('0x26')]);_0x5425bd['attributes']=_['intersection'](_0x564a02[_0x26d8('0x25')],qs['fields'](_0xd6d9b2['query'][_0x26d8('0x41')]));_0x5425bd[_0x26d8('0x2a')]=_0x5425bd['attributes'][_0x26d8('0x2b')]?_0x5425bd[_0x26d8('0x2a')]:_0x564a02[_0x26d8('0x25')];if(_0xd6d9b2['query']['includeAll']){_0x5425bd[_0x26d8('0x3b')]=[{'all':!![]}];}_0x5425bd=_[_0x26d8('0x37')]({},_0x5425bd,_0xd6d9b2['options']);return db[_0x26d8('0x39')]['find'](_0x5425bd)['then'](handleEntityNotFound(_0x113b1f,null))['then'](respondWithResult(_0x113b1f,null))[_0x26d8('0x42')](handleError(_0x113b1f,null));};exports[_0x26d8('0x43')]=function(_0x1afd63,_0x2abf7c){return db[_0x26d8('0x39')][_0x26d8('0x43')](_0x1afd63['body'],{})[_0x26d8('0x20')](respondWithResult(_0x2abf7c,0xc9))[_0x26d8('0x42')](handleError(_0x2abf7c,null));};exports[_0x26d8('0x1f')]=function(_0x322f41,_0x5eae0d){if(_0x322f41[_0x26d8('0x44')]['id']){delete _0x322f41['body']['id'];}return db[_0x26d8('0x39')]['find']({'where':{'id':_0x322f41[_0x26d8('0x3f')]['id']}})[_0x26d8('0x20')](handleEntityNotFound(_0x5eae0d,null))['then'](saveUpdates(_0x322f41['body'],null))['then'](respondWithResult(_0x5eae0d,null))[_0x26d8('0x42')](handleError(_0x5eae0d,null));};exports[_0x26d8('0x21')]=function(_0x329bb4,_0x24814){return db[_0x26d8('0x39')]['find']({'where':{'id':_0x329bb4[_0x26d8('0x3f')]['id']}})[_0x26d8('0x20')](handleEntityNotFound(_0x24814,null))['then'](removeEntity(_0x24814,null))[_0x26d8('0x42')](handleError(_0x24814,null));};exports[_0x26d8('0x45')]=function(_0x198370,_0x33a535){return db[_0x26d8('0x39')][_0x26d8('0x45')]()[_0x26d8('0x20')](respondWithResult(_0x33a535,null))[_0x26d8('0x42')](handleError(_0x33a535,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index fd56d26..609e078 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 _0x773b=['../../config/logger','api','moment','bluebird','./mailSubstatus.attributes','exports','define','MailSubstatus','lodash','util'];(function(_0x10f371,_0x53202a){var _0x5a65a6=function(_0x54fcc6){while(--_0x54fcc6){_0x10f371['push'](_0x10f371['shift']());}};_0x5a65a6(++_0x53202a);}(_0x773b,0x1f2));var _0xb773=function(_0x1f7ef0,_0x382896){_0x1f7ef0=_0x1f7ef0-0x0;var _0x2cefbe=_0x773b[_0x1f7ef0];return _0x2cefbe;};'use strict';var _=require(_0xb773('0x0'));var util=require(_0xb773('0x1'));var logger=require(_0xb773('0x2'))(_0xb773('0x3'));var moment=require(_0xb773('0x4'));var BPromise=require(_0xb773('0x5'));var rp=require('request-promise');var attributes=require(_0xb773('0x6'));module[_0xb773('0x7')]=function(_0x53ed68,_0x5c08e9){return _0x53ed68[_0xb773('0x8')](_0xb773('0x9'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac80=['define','MailSubstatus','mail_substatuses','lodash','util','api','moment','bluebird','./mailSubstatus.attributes','exports'];(function(_0x2ac3cf,_0x465bb6){var _0x27dcca=function(_0x33f954){while(--_0x33f954){_0x2ac3cf['push'](_0x2ac3cf['shift']());}};_0x27dcca(++_0x465bb6);}(_0xac80,0xfd));var _0x0ac8=function(_0x404ff6,_0x101f66){_0x404ff6=_0x404ff6-0x0;var _0x5b5e08=_0xac80[_0x404ff6];return _0x5b5e08;};'use strict';var _=require(_0x0ac8('0x0'));var util=require(_0x0ac8('0x1'));var logger=require('../../config/logger')(_0x0ac8('0x2'));var moment=require(_0x0ac8('0x3'));var BPromise=require(_0x0ac8('0x4'));var rp=require('request-promise');var attributes=require(_0x0ac8('0x5'));module[_0x0ac8('0x6')]=function(_0x36449d,_0xdad27c){return _0x36449d[_0x0ac8('0x7')](_0x0ac8('0x8'),attributes,{'tableName':_0x0ac8('0x9'),'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 03a50d8..b03e759 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 _0xb312=['stringify','code','error','message','result','catch','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xb312,0x131));var _0x2b31=function(_0x48e8da,_0x208a13){_0x48e8da=_0x48e8da-0x0;var _0x31ad7a=_0xb312[_0x48e8da];return _0x31ad7a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2b31('0x0'));var rs=require(_0x2b31('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2b31('0x2'))['db'];var utils=require(_0x2b31('0x3'));var logger=require(_0x2b31('0x4'))(_0x2b31('0x5'));var config=require(_0x2b31('0x6'));var jayson=require(_0x2b31('0x7'));var client=jayson[_0x2b31('0x8')][_0x2b31('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x277149,_0xe9726,_0x321c08){return new BPromise(function(_0x21a00e,_0x59c5f5){return client[_0x2b31('0xa')](_0x277149,_0x321c08)[_0x2b31('0xb')](function(_0x37491a){logger[_0x2b31('0xc')](_0x2b31('0xd'),_0xe9726,_0x2b31('0xe'));logger[_0x2b31('0xf')](_0x2b31('0x10'),_0xe9726,'request\x20sent',JSON[_0x2b31('0x11')](_0x37491a));if(_0x37491a['error']){if(_0x37491a['error'][_0x2b31('0x12')]===0x1f4){logger[_0x2b31('0x13')](_0x2b31('0xd'),_0xe9726,_0x37491a[_0x2b31('0x13')]['message']);return _0x59c5f5(_0x37491a[_0x2b31('0x13')][_0x2b31('0x14')]);}logger[_0x2b31('0x13')](_0x2b31('0xd'),_0xe9726,_0x37491a['error']['message']);return _0x21a00e(_0x37491a['error'][_0x2b31('0x14')]);}else{logger[_0x2b31('0xc')](_0x2b31('0xd'),_0xe9726,_0x2b31('0xe'));_0x21a00e(_0x37491a[_0x2b31('0x15')]['message']);}})[_0x2b31('0x16')](function(_0x20cd58){logger[_0x2b31('0x13')](_0x2b31('0xd'),_0xe9726,_0x20cd58);_0x59c5f5(_0x20cd58);});});} \ No newline at end of file +var _0xc6ae=['result','catch','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2f5235,_0x5ba3b8){var _0x34d3bc=function(_0x142ec2){while(--_0x142ec2){_0x2f5235['push'](_0x2f5235['shift']());}};_0x34d3bc(++_0x5ba3b8);}(_0xc6ae,0x120));var _0xec6a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc6ae[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xec6a('0x0'));var moment=require(_0xec6a('0x1'));var BPromise=require(_0xec6a('0x2'));var rs=require(_0xec6a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xec6a('0x4'))(_0xec6a('0x5'));var config=require(_0xec6a('0x6'));var jayson=require(_0xec6a('0x7'));var client=jayson[_0xec6a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45661c,_0x8bbdef,_0x342a6b){return new BPromise(function(_0x5c3749,_0x499be3){return client[_0xec6a('0x9')](_0x45661c,_0x342a6b)[_0xec6a('0xa')](function(_0x451c6c){logger[_0xec6a('0xb')](_0xec6a('0xc'),_0x8bbdef,_0xec6a('0xd'));logger[_0xec6a('0xe')](_0xec6a('0xf'),_0x8bbdef,_0xec6a('0xd'),JSON[_0xec6a('0x10')](_0x451c6c));if(_0x451c6c[_0xec6a('0x11')]){if(_0x451c6c[_0xec6a('0x11')][_0xec6a('0x12')]===0x1f4){logger[_0xec6a('0x11')](_0xec6a('0xc'),_0x8bbdef,_0x451c6c[_0xec6a('0x11')][_0xec6a('0x13')]);return _0x499be3(_0x451c6c[_0xec6a('0x11')][_0xec6a('0x13')]);}logger[_0xec6a('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x8bbdef,_0x451c6c[_0xec6a('0x11')][_0xec6a('0x13')]);return _0x5c3749(_0x451c6c[_0xec6a('0x11')][_0xec6a('0x13')]);}else{logger[_0xec6a('0xb')]('MailSubstatus,\x20%s,\x20%s',_0x8bbdef,_0xec6a('0xd'));_0x5c3749(_0x451c6c[_0xec6a('0x14')][_0xec6a('0x13')]);}})[_0xec6a('0x15')](function(_0x579ca6){logger[_0xec6a('0x11')](_0xec6a('0xc'),_0x8bbdef,_0x579ca6);_0x499be3(_0x579ca6);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 9f95aa0..72ecc27 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 _0x0d4d=['index','/describe','describe','/:id','show','post','isAuthenticated','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./mailTransferReport.controller','get'];(function(_0x35ca9c,_0x44b0c7){var _0x4dd5bd=function(_0x31b1d6){while(--_0x31b1d6){_0x35ca9c['push'](_0x35ca9c['shift']());}};_0x4dd5bd(++_0x44b0c7);}(_0x0d4d,0x132));var _0xd0d4=function(_0x1cea2b,_0x2ecaf5){_0x1cea2b=_0x1cea2b-0x0;var _0x4a9ea4=_0x0d4d[_0x1cea2b];return _0x4a9ea4;};'use strict';var multer=require(_0xd0d4('0x0'));var util=require(_0xd0d4('0x1'));var path=require(_0xd0d4('0x2'));var timeout=require(_0xd0d4('0x3'));var express=require(_0xd0d4('0x4'));var router=express[_0xd0d4('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xd0d4('0x6'));var config=require('../../config/environment');var controller=require(_0xd0d4('0x7'));router[_0xd0d4('0x8')]('/',auth['isAuthenticated'](),controller[_0xd0d4('0x9')]);router[_0xd0d4('0x8')](_0xd0d4('0xa'),auth['isAuthenticated'](),controller[_0xd0d4('0xb')]);router['get'](_0xd0d4('0xc'),auth['isAuthenticated'](),controller[_0xd0d4('0xd')]);router[_0xd0d4('0xe')]('/',auth[_0xd0d4('0xf')](),controller['create']);router[_0xd0d4('0x10')](_0xd0d4('0xc'),auth[_0xd0d4('0xf')](),controller[_0xd0d4('0x11')]);router[_0xd0d4('0x12')](_0xd0d4('0xc'),auth['isAuthenticated'](),controller[_0xd0d4('0x13')]);module[_0xd0d4('0x14')]=router; \ No newline at end of file +var _0x9206=['multer','util','path','connect-timeout','express','Router','../../config/environment','./mailTransferReport.controller','index','/describe','isAuthenticated','describe','get','show','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9206,0x176));var _0x6920=function(_0x2fe8b5,_0x561233){_0x2fe8b5=_0x2fe8b5-0x0;var _0x25b13d=_0x9206[_0x2fe8b5];return _0x25b13d;};'use strict';var multer=require(_0x6920('0x0'));var util=require(_0x6920('0x1'));var path=require(_0x6920('0x2'));var timeout=require(_0x6920('0x3'));var express=require(_0x6920('0x4'));var router=express[_0x6920('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6920('0x6'));var controller=require(_0x6920('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x6920('0x8')]);router['get'](_0x6920('0x9'),auth[_0x6920('0xa')](),controller[_0x6920('0xb')]);router[_0x6920('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x6920('0xd')]);router[_0x6920('0xe')]('/',auth[_0x6920('0xa')](),controller[_0x6920('0xf')]);router[_0x6920('0x10')](_0x6920('0x11'),auth[_0x6920('0xa')](),controller[_0x6920('0x12')]);router[_0x6920('0x13')](_0x6920('0x11'),auth[_0x6920('0xa')](),controller[_0x6920('0x14')]);module[_0x6920('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index e5cf5db..82f84a6 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 _0x2e35=['STRING','ENUM','agent','DATE','NOW','moment','sequelize','exports'];(function(_0x1d2bbb,_0x202267){var _0x38082b=function(_0x27d153){while(--_0x27d153){_0x1d2bbb['push'](_0x1d2bbb['shift']());}};_0x38082b(++_0x202267);}(_0x2e35,0x12d));var _0x52e3=function(_0x1ac9d9,_0x2f574c){_0x1ac9d9=_0x1ac9d9-0x0;var _0x46b829=_0x2e35[_0x1ac9d9];return _0x46b829;};'use strict';var moment=require(_0x52e3('0x0'));var Sequelize=require(_0x52e3('0x1'));module[_0x52e3('0x2')]={'uniqueid':{'type':Sequelize[_0x52e3('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x52e3('0x4')]('account',_0x52e3('0x5'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x52e3('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x52e3('0x7')]}}; \ No newline at end of file +var _0x213c=['agent','queue','DATE','moment','exports','ENUM'];(function(_0x1bedf9,_0x316933){var _0xce0d05=function(_0x3288fb){while(--_0x3288fb){_0x1bedf9['push'](_0x1bedf9['shift']());}};_0xce0d05(++_0x316933);}(_0x213c,0xf9));var _0xc213=function(_0x5679db,_0x1f5aff){_0x5679db=_0x5679db-0x0;var _0x31baa0=_0x213c[_0x5679db];return _0x31baa0;};'use strict';var moment=require(_0xc213('0x0'));var Sequelize=require('sequelize');module[_0xc213('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xc213('0x2')]('account',_0xc213('0x3'),_0xc213('0x4')),'allowNull':![],'defaultValue':_0xc213('0x4')},'transferredAt':{'type':Sequelize[_0xc213('0x5')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 9e073fe..60d334d 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 _0x78af=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','dateEnd','add','day','merge','filter','map','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','MailTransferReport','rawAttributes','model','query','dateStart'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x78af,0xb7));var _0xf78a=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0x78af[_0x243217];return _0x478029;};'use strict';var pdf=require(_0xf78a('0x0'));var emlformat=require(_0xf78a('0x1'));var rimraf=require(_0xf78a('0x2'));var zipdir=require(_0xf78a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf78a('0x4'));var moment=require(_0xf78a('0x5'));var BPromise=require(_0xf78a('0x6'));var Mustache=require(_0xf78a('0x7'));var util=require(_0xf78a('0x8'));var path=require(_0xf78a('0x9'));var sox=require(_0xf78a('0xa'));var csv=require(_0xf78a('0xb'));var ejs=require(_0xf78a('0xc'));var fs=require('fs');var _=require(_0xf78a('0xd'));var squel=require(_0xf78a('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf78a('0xf'));var toCsv=require(_0xf78a('0xb'));var querystring=require(_0xf78a('0x10'));var Papa=require(_0xf78a('0x11'));var Redis=require(_0xf78a('0x12'));var qs=require(_0xf78a('0x13'));var logger=require(_0xf78a('0x14'))(_0xf78a('0x15'));var utils=require('../../config/utils');var config=require(_0xf78a('0x16'));var db=require(_0xf78a('0x17'))['db'];function respondWithStatusCode(_0x14464b,_0x51845d){_0x51845d=_0x51845d||0xcc;return function(_0x2b3d91){if(_0x2b3d91){return _0x14464b['sendStatus'](_0x51845d);}return _0x14464b[_0xf78a('0x18')](_0x51845d)[_0xf78a('0x19')]();};}function respondWithResult(_0x57cc14,_0xeef197){_0xeef197=_0xeef197||0xc8;return function(_0xf02388){if(_0xf02388){return _0x57cc14[_0xf78a('0x18')](_0xeef197)[_0xf78a('0x1a')](_0xf02388);}};}function respondWithFilteredResult(_0x258f0f,_0x247691){return function(_0x5f0087){if(_0x5f0087){var _0x5d1adf=_0x5f0087[_0xf78a('0x1b')],_0x537a3c=_0x247691[_0xf78a('0x1c')],_0x4d9c7f=_0x247691[_0xf78a('0x1c')]+_0x247691[_0xf78a('0x1d')],_0x27d248;if(_0x4d9c7f>=_0x5d1adf){_0x4d9c7f=_0x5d1adf;_0x27d248=0xc8;}else{_0x27d248=0xce;}_0x258f0f[_0xf78a('0x18')](_0x27d248);return _0x258f0f[_0xf78a('0x1e')](_0xf78a('0x1f'),_0x537a3c+'-'+_0x4d9c7f+'/'+_0x5d1adf)[_0xf78a('0x1a')](_0x5f0087);}return null;};}function patchUpdates(_0x56282a){return function(_0x40b29b){try{jsonpatch[_0xf78a('0x20')](_0x40b29b,_0x56282a,!![]);}catch(_0x40e95a){return BPromise[_0xf78a('0x21')](_0x40e95a);}return _0x40b29b[_0xf78a('0x22')]();};}function saveUpdates(_0x21fb0e,_0x31b841){return function(_0xb494c8){if(_0xb494c8){return _0xb494c8[_0xf78a('0x23')](_0x21fb0e)[_0xf78a('0x24')](function(_0x5eb37d){return _0x5eb37d;});}return null;};}function removeEntity(_0x5405e7,_0x240cab){return function(_0x3bf3ed){if(_0x3bf3ed){return _0x3bf3ed[_0xf78a('0x25')]()['then'](function(){_0x5405e7[_0xf78a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ffb7b,_0x12da10){return function(_0x12301e){if(!_0x12301e){_0x4ffb7b[_0xf78a('0x26')](0x194);}return _0x12301e;};}function handleError(_0x5109b4,_0x40a90d){_0x40a90d=_0x40a90d||0x1f4;return function(_0x5267cf){logger[_0xf78a('0x27')](_0x5267cf['stack']);if(_0x5267cf['name']){delete _0x5267cf[_0xf78a('0x28')];}_0x5109b4[_0xf78a('0x18')](_0x40a90d)[_0xf78a('0x29')](_0x5267cf);};}exports[_0xf78a('0x2a')]=function(_0x1bf6e6,_0xb6e79c){var _0x57c298={},_0x47a7dc={},_0xf4e835={'count':0x0,'rows':[]};var _0x155a1e=db[_0xf78a('0x2b')][_0xf78a('0x2c')];_0x47a7dc[_0xf78a('0x2d')]=_['keys'](_0x155a1e);var _0x38dd37={'dateStart':_0x1bf6e6[_0xf78a('0x2e')][_0xf78a('0x2f')],'dateEnd':_0x1bf6e6[_0xf78a('0x2e')]['dateEnd']};delete _0x1bf6e6[_0xf78a('0x2e')]['dateStart'];delete _0x1bf6e6[_0xf78a('0x2e')]['dateEnd'];_0x47a7dc[_0xf78a('0x2e')]=_['keys'](_0x1bf6e6[_0xf78a('0x2e')]);_0x47a7dc[_0xf78a('0x30')]=_[_0xf78a('0x31')](_0x47a7dc[_0xf78a('0x2d')],_0x47a7dc[_0xf78a('0x2e')]);_0x57c298[_0xf78a('0x32')]=_['intersection'](_0x47a7dc[_0xf78a('0x2d')],qs[_0xf78a('0x33')](_0x1bf6e6[_0xf78a('0x2e')][_0xf78a('0x33')]));_0x57c298[_0xf78a('0x32')]=_0x57c298[_0xf78a('0x32')][_0xf78a('0x34')]?_0x57c298['attributes']:_0x47a7dc[_0xf78a('0x2d')];if(!_0x1bf6e6['query'][_0xf78a('0x35')](_0xf78a('0x36'))){_0x57c298[_0xf78a('0x1d')]=qs[_0xf78a('0x1d')](_0x1bf6e6[_0xf78a('0x2e')][_0xf78a('0x1d')]);_0x57c298[_0xf78a('0x1c')]=qs['offset'](_0x1bf6e6['query'][_0xf78a('0x1c')]);}_0x57c298[_0xf78a('0x37')]=qs['sort'](_0x1bf6e6[_0xf78a('0x2e')][_0xf78a('0x38')]);_0x57c298[_0xf78a('0x39')]=qs['filters'](_['pick'](_0x1bf6e6[_0xf78a('0x2e')],_0x47a7dc['filters']));if(_0x38dd37[_0xf78a('0x2f')]){if(_0x38dd37[_0xf78a('0x3a')]){_0x38dd37['dateEnd']=moment(_0x38dd37[_0xf78a('0x3a')])[_0xf78a('0x3b')](0x1,'day');}else{_0x38dd37[_0xf78a('0x3a')]=moment(_0x38dd37[_0xf78a('0x2f')])[_0xf78a('0x3b')](0x1,_0xf78a('0x3c'));}_[_0xf78a('0x3d')](_0x57c298[_0xf78a('0x39')],{'createdAt':{'$gte':_0x38dd37['dateStart'],'$lte':_0x38dd37[_0xf78a('0x3a')]}});}if(_0x1bf6e6[_0xf78a('0x2e')][_0xf78a('0x3e')]){_0x57c298[_0xf78a('0x39')]=_['merge'](_0x57c298[_0xf78a('0x39')],{'$or':_[_0xf78a('0x3f')](_0x57c298[_0xf78a('0x32')],function(_0x5557d5){var _0xad4a12={};_0xad4a12[_0x5557d5]={'$like':'%'+_0x1bf6e6[_0xf78a('0x2e')][_0xf78a('0x3e')]+'%'};return _0xad4a12;})});}_0x57c298=_['merge']({},_0x57c298,_0x1bf6e6[_0xf78a('0x40')]);var _0x5bdaf4={'where':_0x57c298[_0xf78a('0x39')]};return db[_0xf78a('0x2b')]['count'](_0x5bdaf4)[_0xf78a('0x24')](function(_0x5eadd3){_0xf4e835[_0xf78a('0x1b')]=_0x5eadd3;if(_0x1bf6e6['query'][_0xf78a('0x41')]){_0x57c298[_0xf78a('0x42')]=[{'all':!![]}];}return db[_0xf78a('0x2b')][_0xf78a('0x43')](_0x57c298);})['then'](function(_0x1e2f05){_0xf4e835[_0xf78a('0x44')]=_0x1e2f05;return _0xf4e835;})[_0xf78a('0x24')](respondWithFilteredResult(_0xb6e79c,_0x57c298))[_0xf78a('0x45')](handleError(_0xb6e79c,null));};exports[_0xf78a('0x46')]=function(_0x1c5812,_0x40df33){var _0x2ced3c={'raw':!![],'where':{'id':_0x1c5812[_0xf78a('0x47')]['id']}},_0x4c2bff={};_0x4c2bff[_0xf78a('0x2d')]=_[_0xf78a('0x48')](db[_0xf78a('0x2b')][_0xf78a('0x2c')]);_0x4c2bff['query']=_[_0xf78a('0x48')](_0x1c5812[_0xf78a('0x2e')]);_0x4c2bff[_0xf78a('0x30')]=_['intersection'](_0x4c2bff[_0xf78a('0x2d')],_0x4c2bff[_0xf78a('0x2e')]);_0x2ced3c[_0xf78a('0x32')]=_[_0xf78a('0x31')](_0x4c2bff[_0xf78a('0x2d')],qs[_0xf78a('0x33')](_0x1c5812['query'][_0xf78a('0x33')]));_0x2ced3c[_0xf78a('0x32')]=_0x2ced3c[_0xf78a('0x32')][_0xf78a('0x34')]?_0x2ced3c['attributes']:_0x4c2bff[_0xf78a('0x2d')];if(_0x1c5812[_0xf78a('0x2e')]['includeAll']){_0x2ced3c[_0xf78a('0x42')]=[{'all':!![]}];}_0x2ced3c=_[_0xf78a('0x3d')]({},_0x2ced3c,_0x1c5812['options']);return db['MailTransferReport'][_0xf78a('0x49')](_0x2ced3c)[_0xf78a('0x24')](handleEntityNotFound(_0x40df33,null))[_0xf78a('0x24')](respondWithResult(_0x40df33,null))[_0xf78a('0x45')](handleError(_0x40df33,null));};exports['create']=function(_0x41c3f5,_0x5dbbca){return db[_0xf78a('0x2b')][_0xf78a('0x4a')](_0x41c3f5[_0xf78a('0x4b')],{})[_0xf78a('0x24')](respondWithResult(_0x5dbbca,0xc9))['catch'](handleError(_0x5dbbca,null));};exports[_0xf78a('0x23')]=function(_0x4b721f,_0x143592){if(_0x4b721f[_0xf78a('0x4b')]['id']){delete _0x4b721f[_0xf78a('0x4b')]['id'];}return db['MailTransferReport']['find']({'where':{'id':_0x4b721f['params']['id']}})[_0xf78a('0x24')](handleEntityNotFound(_0x143592,null))[_0xf78a('0x24')](saveUpdates(_0x4b721f[_0xf78a('0x4b')],null))[_0xf78a('0x24')](respondWithResult(_0x143592,null))['catch'](handleError(_0x143592,null));};exports['destroy']=function(_0xbb4c75,_0x1f84b6){return db[_0xf78a('0x2b')]['find']({'where':{'id':_0xbb4c75[_0xf78a('0x47')]['id']}})[_0xf78a('0x24')](handleEntityNotFound(_0x1f84b6,null))[_0xf78a('0x24')](removeEntity(_0x1f84b6,null))[_0xf78a('0x45')](handleError(_0x1f84b6,null));};exports[_0xf78a('0x4c')]=function(_0x1914da,_0x3d862b){return db[_0xf78a('0x2b')][_0xf78a('0x4c')]()[_0xf78a('0x24')](respondWithResult(_0x3d862b,null))[_0xf78a('0x45')](handleError(_0x3d862b,null));}; \ No newline at end of file +var _0x08bd=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','Content-Range','apply','save','update','then','destroy','error','name','MailTransferReport','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','add','day','merge','map','filter','options','includeAll','include','findAll','catch','params','rawAttributes','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x08bd,0x19d));var _0xd08b=function(_0x1192aa,_0x223692){_0x1192aa=_0x1192aa-0x0;var _0x5df51d=_0x08bd[_0x1192aa];return _0x5df51d;};'use strict';var pdf=require(_0xd08b('0x0'));var emlformat=require(_0xd08b('0x1'));var rimraf=require(_0xd08b('0x2'));var zipdir=require(_0xd08b('0x3'));var jsonpatch=require(_0xd08b('0x4'));var rp=require(_0xd08b('0x5'));var moment=require(_0xd08b('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd08b('0x7'));var path=require(_0xd08b('0x8'));var sox=require(_0xd08b('0x9'));var csv=require(_0xd08b('0xa'));var ejs=require(_0xd08b('0xb'));var fs=require('fs');var _=require(_0xd08b('0xc'));var squel=require(_0xd08b('0xd'));var crypto=require(_0xd08b('0xe'));var jsforce=require(_0xd08b('0xf'));var deskjs=require(_0xd08b('0x10'));var toCsv=require(_0xd08b('0xa'));var querystring=require(_0xd08b('0x11'));var Papa=require(_0xd08b('0x12'));var Redis=require(_0xd08b('0x13'));var qs=require(_0xd08b('0x14'));var logger=require(_0xd08b('0x15'))('api');var utils=require(_0xd08b('0x16'));var config=require(_0xd08b('0x17'));var db=require(_0xd08b('0x18'))['db'];function respondWithStatusCode(_0x5ae7b9,_0x1fcc6a){_0x1fcc6a=_0x1fcc6a||0xcc;return function(_0xe0fe57){if(_0xe0fe57){return _0x5ae7b9['sendStatus'](_0x1fcc6a);}return _0x5ae7b9[_0xd08b('0x19')](_0x1fcc6a)[_0xd08b('0x1a')]();};}function respondWithResult(_0x9a2ee9,_0xe82082){_0xe82082=_0xe82082||0xc8;return function(_0x22836){if(_0x22836){return _0x9a2ee9['status'](_0xe82082)[_0xd08b('0x1b')](_0x22836);}};}function respondWithFilteredResult(_0x412787,_0x5c485e){return function(_0x24e7c4){if(_0x24e7c4){var _0x4ba3a0=_0x24e7c4[_0xd08b('0x1c')],_0x3800e9=_0x5c485e[_0xd08b('0x1d')],_0x119c56=_0x5c485e[_0xd08b('0x1d')]+_0x5c485e['limit'],_0x61729;if(_0x119c56>=_0x4ba3a0){_0x119c56=_0x4ba3a0;_0x61729=0xc8;}else{_0x61729=0xce;}_0x412787[_0xd08b('0x19')](_0x61729);return _0x412787['set'](_0xd08b('0x1e'),_0x3800e9+'-'+_0x119c56+'/'+_0x4ba3a0)['json'](_0x24e7c4);}return null;};}function patchUpdates(_0x14c874){return function(_0x14fb6f){try{jsonpatch[_0xd08b('0x1f')](_0x14fb6f,_0x14c874,!![]);}catch(_0x3353e2){return BPromise['reject'](_0x3353e2);}return _0x14fb6f[_0xd08b('0x20')]();};}function saveUpdates(_0x5b60fe,_0x2c0ba4){return function(_0x6979b){if(_0x6979b){return _0x6979b[_0xd08b('0x21')](_0x5b60fe)[_0xd08b('0x22')](function(_0x52fade){return _0x52fade;});}return null;};}function removeEntity(_0x183a95,_0x3291bf){return function(_0x5c92e7){if(_0x5c92e7){return _0x5c92e7[_0xd08b('0x23')]()[_0xd08b('0x22')](function(){_0x183a95[_0xd08b('0x19')](0xcc)[_0xd08b('0x1a')]();});}};}function handleEntityNotFound(_0x4ce2b9,_0x39dd1d){return function(_0x585487){if(!_0x585487){_0x4ce2b9['sendStatus'](0x194);}return _0x585487;};}function handleError(_0x38d573,_0x329b5f){_0x329b5f=_0x329b5f||0x1f4;return function(_0x387074){logger[_0xd08b('0x24')](_0x387074['stack']);if(_0x387074[_0xd08b('0x25')]){delete _0x387074[_0xd08b('0x25')];}_0x38d573['status'](_0x329b5f)['send'](_0x387074);};}exports['index']=function(_0x13c34c,_0x3208d6){var _0x52b6bf={},_0xd5dbfa={},_0x59ac22={'count':0x0,'rows':[]};var _0x46d771=db[_0xd08b('0x26')]['rawAttributes'];_0xd5dbfa[_0xd08b('0x27')]=_['keys'](_0x46d771);var _0x58862b={'dateStart':_0x13c34c[_0xd08b('0x28')][_0xd08b('0x29')],'dateEnd':_0x13c34c[_0xd08b('0x28')][_0xd08b('0x2a')]};delete _0x13c34c['query'][_0xd08b('0x29')];delete _0x13c34c['query'][_0xd08b('0x2a')];_0xd5dbfa[_0xd08b('0x28')]=_[_0xd08b('0x2b')](_0x13c34c[_0xd08b('0x28')]);_0xd5dbfa[_0xd08b('0x2c')]=_[_0xd08b('0x2d')](_0xd5dbfa[_0xd08b('0x27')],_0xd5dbfa[_0xd08b('0x28')]);_0x52b6bf[_0xd08b('0x2e')]=_[_0xd08b('0x2d')](_0xd5dbfa[_0xd08b('0x27')],qs[_0xd08b('0x2f')](_0x13c34c[_0xd08b('0x28')][_0xd08b('0x2f')]));_0x52b6bf[_0xd08b('0x2e')]=_0x52b6bf[_0xd08b('0x2e')][_0xd08b('0x30')]?_0x52b6bf[_0xd08b('0x2e')]:_0xd5dbfa[_0xd08b('0x27')];if(!_0x13c34c[_0xd08b('0x28')][_0xd08b('0x31')](_0xd08b('0x32'))){_0x52b6bf[_0xd08b('0x33')]=qs[_0xd08b('0x33')](_0x13c34c[_0xd08b('0x28')][_0xd08b('0x33')]);_0x52b6bf[_0xd08b('0x1d')]=qs[_0xd08b('0x1d')](_0x13c34c[_0xd08b('0x28')][_0xd08b('0x1d')]);}_0x52b6bf[_0xd08b('0x34')]=qs[_0xd08b('0x35')](_0x13c34c[_0xd08b('0x28')][_0xd08b('0x35')]);_0x52b6bf[_0xd08b('0x36')]=qs[_0xd08b('0x2c')](_['pick'](_0x13c34c[_0xd08b('0x28')],_0xd5dbfa['filters']));if(_0x58862b[_0xd08b('0x29')]){if(_0x58862b[_0xd08b('0x2a')]){_0x58862b[_0xd08b('0x2a')]=moment(_0x58862b[_0xd08b('0x2a')])[_0xd08b('0x37')](0x1,_0xd08b('0x38'));}else{_0x58862b[_0xd08b('0x2a')]=moment(_0x58862b['dateStart'])[_0xd08b('0x37')](0x1,_0xd08b('0x38'));}_[_0xd08b('0x39')](_0x52b6bf[_0xd08b('0x36')],{'createdAt':{'$gte':_0x58862b[_0xd08b('0x29')],'$lte':_0x58862b['dateEnd']}});}if(_0x13c34c[_0xd08b('0x28')]['filter']){_0x52b6bf[_0xd08b('0x36')]=_[_0xd08b('0x39')](_0x52b6bf[_0xd08b('0x36')],{'$or':_[_0xd08b('0x3a')](_0x52b6bf['attributes'],function(_0xe01c83){var _0x56478e={};_0x56478e[_0xe01c83]={'$like':'%'+_0x13c34c[_0xd08b('0x28')][_0xd08b('0x3b')]+'%'};return _0x56478e;})});}_0x52b6bf=_[_0xd08b('0x39')]({},_0x52b6bf,_0x13c34c[_0xd08b('0x3c')]);var _0x560b43={'where':_0x52b6bf[_0xd08b('0x36')]};return db[_0xd08b('0x26')][_0xd08b('0x1c')](_0x560b43)[_0xd08b('0x22')](function(_0x5b18e8){_0x59ac22[_0xd08b('0x1c')]=_0x5b18e8;if(_0x13c34c[_0xd08b('0x28')][_0xd08b('0x3d')]){_0x52b6bf[_0xd08b('0x3e')]=[{'all':!![]}];}return db[_0xd08b('0x26')][_0xd08b('0x3f')](_0x52b6bf);})[_0xd08b('0x22')](function(_0x1b4091){_0x59ac22['rows']=_0x1b4091;return _0x59ac22;})[_0xd08b('0x22')](respondWithFilteredResult(_0x3208d6,_0x52b6bf))[_0xd08b('0x40')](handleError(_0x3208d6,null));};exports['show']=function(_0x5e4c32,_0x34a055){var _0x37e118={'raw':!![],'where':{'id':_0x5e4c32[_0xd08b('0x41')]['id']}},_0x4fc5be={};_0x4fc5be[_0xd08b('0x27')]=_[_0xd08b('0x2b')](db[_0xd08b('0x26')][_0xd08b('0x42')]);_0x4fc5be[_0xd08b('0x28')]=_[_0xd08b('0x2b')](_0x5e4c32[_0xd08b('0x28')]);_0x4fc5be[_0xd08b('0x2c')]=_['intersection'](_0x4fc5be[_0xd08b('0x27')],_0x4fc5be[_0xd08b('0x28')]);_0x37e118[_0xd08b('0x2e')]=_[_0xd08b('0x2d')](_0x4fc5be['model'],qs[_0xd08b('0x2f')](_0x5e4c32[_0xd08b('0x28')][_0xd08b('0x2f')]));_0x37e118[_0xd08b('0x2e')]=_0x37e118[_0xd08b('0x2e')][_0xd08b('0x30')]?_0x37e118['attributes']:_0x4fc5be[_0xd08b('0x27')];if(_0x5e4c32[_0xd08b('0x28')][_0xd08b('0x3d')]){_0x37e118[_0xd08b('0x3e')]=[{'all':!![]}];}_0x37e118=_[_0xd08b('0x39')]({},_0x37e118,_0x5e4c32[_0xd08b('0x3c')]);return db['MailTransferReport']['find'](_0x37e118)[_0xd08b('0x22')](handleEntityNotFound(_0x34a055,null))[_0xd08b('0x22')](respondWithResult(_0x34a055,null))['catch'](handleError(_0x34a055,null));};exports[_0xd08b('0x43')]=function(_0x9e14ad,_0x4496f4){return db[_0xd08b('0x26')][_0xd08b('0x43')](_0x9e14ad['body'],{})[_0xd08b('0x22')](respondWithResult(_0x4496f4,0xc9))[_0xd08b('0x40')](handleError(_0x4496f4,null));};exports[_0xd08b('0x21')]=function(_0x52e9b4,_0x27bec8){if(_0x52e9b4[_0xd08b('0x44')]['id']){delete _0x52e9b4[_0xd08b('0x44')]['id'];}return db[_0xd08b('0x26')][_0xd08b('0x45')]({'where':{'id':_0x52e9b4['params']['id']}})[_0xd08b('0x22')](handleEntityNotFound(_0x27bec8,null))[_0xd08b('0x22')](saveUpdates(_0x52e9b4['body'],null))[_0xd08b('0x22')](respondWithResult(_0x27bec8,null))[_0xd08b('0x40')](handleError(_0x27bec8,null));};exports[_0xd08b('0x23')]=function(_0x23179f,_0x1b008d){return db[_0xd08b('0x26')][_0xd08b('0x45')]({'where':{'id':_0x23179f[_0xd08b('0x41')]['id']}})[_0xd08b('0x22')](handleEntityNotFound(_0x1b008d,null))[_0xd08b('0x22')](removeEntity(_0x1b008d,null))['catch'](handleError(_0x1b008d,null));};exports[_0xd08b('0x46')]=function(_0x4a820d,_0x26e592){return db['MailTransferReport']['describe']()[_0xd08b('0x22')](respondWithResult(_0x26e592,null))[_0xd08b('0x40')](handleError(_0x26e592,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 33680f7..8f18834 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 _0x4f8f=['report_mail_transfer','uniqueid','util','moment','request-promise','./mailTransferReport.attributes','MailTransferReport'];(function(_0x3bb060,_0x35ea3b){var _0x42daf6=function(_0x288bdd){while(--_0x288bdd){_0x3bb060['push'](_0x3bb060['shift']());}};_0x42daf6(++_0x35ea3b);}(_0x4f8f,0x175));var _0xf4f8=function(_0xfe4a36,_0x2939a9){_0xfe4a36=_0xfe4a36-0x0;var _0x223946=_0x4f8f[_0xfe4a36];return _0x223946;};'use strict';var _=require('lodash');var util=require(_0xf4f8('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xf4f8('0x1'));var BPromise=require('bluebird');var rp=require(_0xf4f8('0x2'));var attributes=require(_0xf4f8('0x3'));module['exports']=function(_0x4aa0fa,_0x1b152d){return _0x4aa0fa['define'](_0xf4f8('0x4'),attributes,{'tableName':_0xf4f8('0x5'),'paranoid':![],'indexes':[{'name':_0xf4f8('0x6'),'fields':[_0xf4f8('0x6')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1867=['exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','api','bluebird','request-promise','./mailTransferReport.attributes'];(function(_0x3b1461,_0x474c23){var _0x3f0db9=function(_0x2e6a19){while(--_0x2e6a19){_0x3b1461['push'](_0x3b1461['shift']());}};_0x3f0db9(++_0x474c23);}(_0x1867,0xb5));var _0x7186=function(_0x53d1c9,_0x2e58bb){_0x53d1c9=_0x53d1c9-0x0;var _0x4a82eb=_0x1867[_0x53d1c9];return _0x4a82eb;};'use strict';var _=require(_0x7186('0x0'));var util=require(_0x7186('0x1'));var logger=require('../../config/logger')(_0x7186('0x2'));var moment=require('moment');var BPromise=require(_0x7186('0x3'));var rp=require(_0x7186('0x4'));var attributes=require(_0x7186('0x5'));module[_0x7186('0x6')]=function(_0x25d50d,_0x16dcd1){return _0x25d50d[_0x7186('0x7')](_0x7186('0x8'),attributes,{'tableName':_0x7186('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7186('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 bb6910b..3449d23 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 _0x93e5=['result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message'];(function(_0x3bace6,_0x2ff71b){var _0x2f997c=function(_0x2f2522){while(--_0x2f2522){_0x3bace6['push'](_0x3bace6['shift']());}};_0x2f997c(++_0x2ff71b);}(_0x93e5,0xf1));var _0x593e=function(_0x35fd8c,_0x156b59){_0x35fd8c=_0x35fd8c-0x0;var _0xd2fe51=_0x93e5[_0x35fd8c];return _0xd2fe51;};'use strict';var _=require(_0x593e('0x0'));var util=require(_0x593e('0x1'));var moment=require('moment');var BPromise=require(_0x593e('0x2'));var rs=require(_0x593e('0x3'));var fs=require('fs');var Redis=require(_0x593e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x593e('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x593e('0x6'));var jayson=require(_0x593e('0x7'));var client=jayson[_0x593e('0x8')][_0x593e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441eba,_0x5922cc,_0x24a0ab){return new BPromise(function(_0x35f7fa,_0x1141cf){return client[_0x593e('0xa')](_0x441eba,_0x24a0ab)[_0x593e('0xb')](function(_0x151abf){logger[_0x593e('0xc')](_0x593e('0xd'),_0x5922cc,'request\x20sent');logger[_0x593e('0xe')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x5922cc,_0x593e('0xf'),JSON['stringify'](_0x151abf));if(_0x151abf[_0x593e('0x10')]){if(_0x151abf[_0x593e('0x10')][_0x593e('0x11')]===0x1f4){logger[_0x593e('0x10')](_0x593e('0xd'),_0x5922cc,_0x151abf[_0x593e('0x10')][_0x593e('0x12')]);return _0x1141cf(_0x151abf[_0x593e('0x10')][_0x593e('0x12')]);}logger[_0x593e('0x10')](_0x593e('0xd'),_0x5922cc,_0x151abf[_0x593e('0x10')][_0x593e('0x12')]);return _0x35f7fa(_0x151abf[_0x593e('0x10')]['message']);}else{logger[_0x593e('0xc')]('MailTransferReport,\x20%s,\x20%s',_0x5922cc,_0x593e('0xf'));_0x35f7fa(_0x151abf[_0x593e('0x13')][_0x593e('0x12')]);}})['catch'](function(_0x1ba4ea){logger[_0x593e('0x10')](_0x593e('0xd'),_0x5922cc,_0x1ba4ea);_0x1141cf(_0x1ba4ea);});});} \ No newline at end of file +var _0xdf7c=['rpc','../../config/environment','jayson/promise','client','http','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdf7c,0x18a));var _0xcdf7=function(_0x4a8bad,_0x4bfb2f){_0x4a8bad=_0x4a8bad-0x0;var _0x30cf32=_0xdf7c[_0x4a8bad];return _0x30cf32;};'use strict';var _=require('lodash');var util=require(_0xcdf7('0x0'));var moment=require(_0xcdf7('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcdf7('0x2'));var db=require(_0xcdf7('0x3'))['db'];var utils=require(_0xcdf7('0x4'));var logger=require('../../config/logger')(_0xcdf7('0x5'));var config=require(_0xcdf7('0x6'));var jayson=require(_0xcdf7('0x7'));var client=jayson[_0xcdf7('0x8')][_0xcdf7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c211c,_0x150a81,_0x1324dd){return new BPromise(function(_0x53ca48,_0x59490f){return client[_0xcdf7('0xa')](_0x2c211c,_0x1324dd)['then'](function(_0xb9c4a7){logger[_0xcdf7('0xb')](_0xcdf7('0xc'),_0x150a81,_0xcdf7('0xd'));logger[_0xcdf7('0xe')](_0xcdf7('0xf'),_0x150a81,_0xcdf7('0xd'),JSON[_0xcdf7('0x10')](_0xb9c4a7));if(_0xb9c4a7[_0xcdf7('0x11')]){if(_0xb9c4a7[_0xcdf7('0x11')][_0xcdf7('0x12')]===0x1f4){logger[_0xcdf7('0x11')](_0xcdf7('0xc'),_0x150a81,_0xb9c4a7[_0xcdf7('0x11')]['message']);return _0x59490f(_0xb9c4a7['error'][_0xcdf7('0x13')]);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0x150a81,_0xb9c4a7[_0xcdf7('0x11')][_0xcdf7('0x13')]);return _0x53ca48(_0xb9c4a7[_0xcdf7('0x11')]['message']);}else{logger[_0xcdf7('0xb')](_0xcdf7('0xc'),_0x150a81,_0xcdf7('0xd'));_0x53ca48(_0xb9c4a7['result'][_0xcdf7('0x13')]);}})[_0xcdf7('0x14')](function(_0x224bc8){logger[_0xcdf7('0x11')](_0xcdf7('0xc'),_0x150a81,_0x224bc8);_0x59490f(_0x224bc8);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index faacfb0..767352b 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 _0xd883=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','exports','multer'];(function(_0x12c7c7,_0x1936af){var _0x3112d1=function(_0x5e4d02){while(--_0x5e4d02){_0x12c7c7['push'](_0x12c7c7['shift']());}};_0x3112d1(++_0x1936af);}(_0xd883,0x1df));var _0x3d88=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xd883[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x3d88('0x0'));var util=require(_0x3d88('0x1'));var path=require(_0x3d88('0x2'));var timeout=require(_0x3d88('0x3'));var express=require(_0x3d88('0x4'));var router=express[_0x3d88('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x3d88('0x6'));var config=require(_0x3d88('0x7'));var controller=require(_0x3d88('0x8'));router[_0x3d88('0x9')]('/',auth[_0x3d88('0xa')](),controller[_0x3d88('0xb')]);router['get'](_0x3d88('0xc'),auth[_0x3d88('0xa')](),controller['describe']);router['get'](_0x3d88('0xd'),auth[_0x3d88('0xa')](),controller[_0x3d88('0xe')]);router[_0x3d88('0xf')]('/',auth[_0x3d88('0xa')](),controller[_0x3d88('0x10')]);router[_0x3d88('0x11')](_0x3d88('0xd'),auth[_0x3d88('0xa')](),controller[_0x3d88('0x12')]);router['delete'](_0x3d88('0xd'),auth[_0x3d88('0xa')](),controller['destroy']);module[_0x3d88('0x13')]=router; \ No newline at end of file +var _0x0620=['../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x53e211,_0x850e23){var _0x532c61=function(_0x4e5869){while(--_0x4e5869){_0x53e211['push'](_0x53e211['shift']());}};_0x532c61(++_0x850e23);}(_0x0620,0x92));var _0x0062=function(_0x5f1053,_0x3f93ae){_0x5f1053=_0x5f1053-0x0;var _0x551502=_0x0620[_0x5f1053];return _0x551502;};'use strict';var multer=require(_0x0062('0x0'));var util=require(_0x0062('0x1'));var path=require(_0x0062('0x2'));var timeout=require(_0x0062('0x3'));var express=require(_0x0062('0x4'));var router=express[_0x0062('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0062('0x6'));var controller=require(_0x0062('0x7'));router[_0x0062('0x8')]('/',auth[_0x0062('0x9')](),controller[_0x0062('0xa')]);router[_0x0062('0x8')](_0x0062('0xb'),auth['isAuthenticated'](),controller[_0x0062('0xc')]);router[_0x0062('0x8')](_0x0062('0xd'),auth[_0x0062('0x9')](),controller['show']);router[_0x0062('0xe')]('/',auth[_0x0062('0x9')](),controller[_0x0062('0xf')]);router[_0x0062('0x10')]('/:id',auth[_0x0062('0x9')](),controller[_0x0062('0x11')]);router['delete'](_0x0062('0xd'),auth[_0x0062('0x9')](),controller[_0x0062('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 6549593..1db9782 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 _0x32a9=['talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','diff','seconds','setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]'];(function(_0x2934ad,_0x49ca22){var _0x43bd60=function(_0x21773e){while(--_0x21773e){_0x2934ad['push'](_0x2934ad['shift']());}};_0x43bd60(++_0x49ca22);}(_0x32a9,0xe3));var _0x932a=function(_0x285159,_0x434500){_0x285159=_0x285159-0x0;var _0x3ade27=_0x32a9[_0x285159];return _0x3ade27;};'use strict';var Sequelize=require(_0x932a('0x0'));var moment=require(_0x932a('0x1'));module[_0x932a('0x2')]={'channel':{'type':Sequelize[_0x932a('0x3')]},'membername':{'type':Sequelize[_0x932a('0x3')]},'interface':{'type':Sequelize[_0x932a('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x932a('0x4'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x932a('0x5')]},'enterAt':{'type':Sequelize[_0x932a('0x6')]},'exitAt':{'type':Sequelize[_0x932a('0x6')],'set':function(_0x238d48){var _0x3cbf26=moment(_0x238d48);var _0x108ab4=moment(this['getDataValue']('enterAt'));var _0x29a176=_0x3cbf26[_0x932a('0x7')](_0x108ab4,_0x932a('0x8'));this[_0x932a('0x9')]('exitAt',_0x238d48);this[_0x932a('0x9')]('duration',_0x29a176||null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x932a('0xa')},'data2':{'type':Sequelize[_0x932a('0x3')],'comment':_0x932a('0xb')},'data3':{'type':Sequelize[_0x932a('0x3')],'comment':_0x932a('0xc')},'data4':{'type':Sequelize['STRING'],'comment':_0x932a('0xd')},'data5':{'type':Sequelize[_0x932a('0x3')],'comment':_0x932a('0xe')},'role':{'type':Sequelize[_0x932a('0x3')]},'internal':{'type':Sequelize[_0x932a('0x5')]},'uniqueid':{'type':Sequelize[_0x932a('0x3')]}}; \ No newline at end of file +var _0x1a3c=['DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','sequelize','moment','exports','STRING'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x1a3c,0x152));var _0xc1a3=function(_0x20116e,_0x1e8b22){_0x20116e=_0x20116e-0x0;var _0x1bbe48=_0x1a3c[_0x20116e];return _0x1bbe48;};'use strict';var Sequelize=require(_0xc1a3('0x0'));var moment=require(_0xc1a3('0x1'));module[_0xc1a3('0x2')]={'channel':{'type':Sequelize[_0xc1a3('0x3')]},'membername':{'type':Sequelize[_0xc1a3('0x3')]},'interface':{'type':Sequelize[_0xc1a3('0x3')]},'type':{'type':Sequelize[_0xc1a3('0x3')],'defaultValue':_0xc1a3('0x4'),'comment':_0xc1a3('0x5')},'duration':{'type':Sequelize[_0xc1a3('0x6')]},'enterAt':{'type':Sequelize[_0xc1a3('0x7')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x51af0d){var _0x585297=moment(_0x51af0d);var _0x1f3a38=moment(this[_0xc1a3('0x8')](_0xc1a3('0x9')));var _0x55f51f=_0x585297[_0xc1a3('0xa')](_0x1f3a38,_0xc1a3('0xb'));this[_0xc1a3('0xc')]('exitAt',_0x51af0d);this[_0xc1a3('0xc')](_0xc1a3('0xd'),_0x55f51f||null);}},'data1':{'type':Sequelize[_0xc1a3('0x3')],'comment':_0xc1a3('0xe')},'data2':{'type':Sequelize['STRING'],'comment':_0xc1a3('0xf')},'data3':{'type':Sequelize[_0xc1a3('0x3')],'comment':_0xc1a3('0x10')},'data4':{'type':Sequelize[_0xc1a3('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':_0xc1a3('0x11')},'role':{'type':Sequelize[_0xc1a3('0x3')]},'internal':{'type':Sequelize[_0xc1a3('0x6')]},'uniqueid':{'type':Sequelize[_0xc1a3('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 69aff03..85f1497 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 _0x59e1=['rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','day','add','merge','findAll','rows','show','params','includeAll','include','options','find','create','body','catch','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','MemberReport'];(function(_0x590e7c,_0x1702b1){var _0x26e9bf=function(_0x2829c2){while(--_0x2829c2){_0x590e7c['push'](_0x590e7c['shift']());}};_0x26e9bf(++_0x1702b1);}(_0x59e1,0x1d3));var _0x159e=function(_0x4fab68,_0x3ce64a){_0x4fab68=_0x4fab68-0x0;var _0x17570c=_0x59e1[_0x4fab68];return _0x17570c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x159e('0x0'));var rimraf=require(_0x159e('0x1'));var zipdir=require(_0x159e('0x2'));var jsonpatch=require(_0x159e('0x3'));var rp=require(_0x159e('0x4'));var moment=require(_0x159e('0x5'));var BPromise=require(_0x159e('0x6'));var Mustache=require(_0x159e('0x7'));var util=require(_0x159e('0x8'));var path=require(_0x159e('0x9'));var sox=require(_0x159e('0xa'));var csv=require(_0x159e('0xb'));var ejs=require(_0x159e('0xc'));var fs=require('fs');var _=require(_0x159e('0xd'));var squel=require('squel');var crypto=require(_0x159e('0xe'));var jsforce=require(_0x159e('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x159e('0x10'));var Papa=require(_0x159e('0x11'));var Redis=require(_0x159e('0x12'));var qs=require(_0x159e('0x13'));var logger=require(_0x159e('0x14'))(_0x159e('0x15'));var utils=require(_0x159e('0x16'));var config=require(_0x159e('0x17'));var db=require(_0x159e('0x18'))['db'];function respondWithStatusCode(_0x535a73,_0x715577){_0x715577=_0x715577||0xcc;return function(_0x448aa8){if(_0x448aa8){return _0x535a73['sendStatus'](_0x715577);}return _0x535a73[_0x159e('0x19')](_0x715577)[_0x159e('0x1a')]();};}function respondWithResult(_0x53b1b5,_0x56333a){_0x56333a=_0x56333a||0xc8;return function(_0x5edce4){if(_0x5edce4){return _0x53b1b5[_0x159e('0x19')](_0x56333a)[_0x159e('0x1b')](_0x5edce4);}};}function respondWithFilteredResult(_0x56c40c,_0x3a266b){return function(_0x4cfb20){if(_0x4cfb20){var _0x292724=_0x4cfb20[_0x159e('0x1c')],_0x300b01=_0x3a266b[_0x159e('0x1d')],_0x39c512=_0x3a266b['offset']+_0x3a266b[_0x159e('0x1e')],_0x22e95a;if(_0x39c512>=_0x292724){_0x39c512=_0x292724;_0x22e95a=0xc8;}else{_0x22e95a=0xce;}_0x56c40c[_0x159e('0x19')](_0x22e95a);return _0x56c40c[_0x159e('0x1f')]('Content-Range',_0x300b01+'-'+_0x39c512+'/'+_0x292724)[_0x159e('0x1b')](_0x4cfb20);}return null;};}function patchUpdates(_0x4407e4){return function(_0x1c5934){try{jsonpatch[_0x159e('0x20')](_0x1c5934,_0x4407e4,!![]);}catch(_0x3f71b2){return BPromise[_0x159e('0x21')](_0x3f71b2);}return _0x1c5934[_0x159e('0x22')]();};}function saveUpdates(_0x12ecc9,_0x42052d){return function(_0x3d9487){if(_0x3d9487){return _0x3d9487[_0x159e('0x23')](_0x12ecc9)[_0x159e('0x24')](function(_0x4804ba){return _0x4804ba;});}return null;};}function removeEntity(_0x57b39c,_0x335de5){return function(_0x120f86){if(_0x120f86){return _0x120f86['destroy']()[_0x159e('0x24')](function(){_0x57b39c['status'](0xcc)[_0x159e('0x1a')]();});}};}function handleEntityNotFound(_0x2bec52,_0x48c49b){return function(_0xf0b0bd){if(!_0xf0b0bd){_0x2bec52[_0x159e('0x25')](0x194);}return _0xf0b0bd;};}function handleError(_0x205bbb,_0x472560){_0x472560=_0x472560||0x1f4;return function(_0x179365){logger[_0x159e('0x26')](_0x179365[_0x159e('0x27')]);if(_0x179365['name']){delete _0x179365[_0x159e('0x28')];}_0x205bbb['status'](_0x472560)[_0x159e('0x29')](_0x179365);};}exports[_0x159e('0x2a')]=function(_0x17d274,_0x402613){var _0x2ba654={},_0x3de1c0={},_0x38d9c3={'count':0x0,'rows':[]};var _0x38d2c0=db[_0x159e('0x2b')][_0x159e('0x2c')];_0x3de1c0[_0x159e('0x2d')]=_['keys'](_0x38d2c0);var _0x23ca78={'dateStart':_0x17d274[_0x159e('0x2e')][_0x159e('0x2f')],'dateEnd':_0x17d274['query'][_0x159e('0x30')]};delete _0x17d274[_0x159e('0x2e')][_0x159e('0x2f')];delete _0x17d274[_0x159e('0x2e')][_0x159e('0x30')];_0x3de1c0['query']=_[_0x159e('0x31')](_0x17d274['query']);_0x3de1c0[_0x159e('0x32')]=_[_0x159e('0x33')](_0x3de1c0[_0x159e('0x2d')],_0x3de1c0[_0x159e('0x2e')]);_0x2ba654[_0x159e('0x34')]=_[_0x159e('0x33')](_0x3de1c0['model'],qs[_0x159e('0x35')](_0x17d274['query']['fields']));_0x2ba654['attributes']=_0x2ba654['attributes']['length']?_0x2ba654[_0x159e('0x34')]:_0x3de1c0[_0x159e('0x2d')];if(!_0x17d274[_0x159e('0x2e')][_0x159e('0x36')]('nolimit')){_0x2ba654[_0x159e('0x1e')]=qs[_0x159e('0x1e')](_0x17d274[_0x159e('0x2e')]['limit']);_0x2ba654[_0x159e('0x1d')]=qs[_0x159e('0x1d')](_0x17d274[_0x159e('0x2e')][_0x159e('0x1d')]);}_0x2ba654['order']=qs[_0x159e('0x37')](_0x17d274[_0x159e('0x2e')]['sort']);_0x2ba654[_0x159e('0x38')]=qs['filters'](_['pick'](_0x17d274[_0x159e('0x2e')],_0x3de1c0[_0x159e('0x32')]));if(_0x23ca78['dateStart']){if(_0x23ca78[_0x159e('0x30')]){_0x23ca78[_0x159e('0x30')]=moment(_0x23ca78[_0x159e('0x30')])['add'](0x1,_0x159e('0x39'));}else{_0x23ca78[_0x159e('0x30')]=moment(_0x23ca78[_0x159e('0x2f')])[_0x159e('0x3a')](0x1,_0x159e('0x39'));}_['merge'](_0x2ba654['where'],{'createdAt':{'$gte':_0x23ca78[_0x159e('0x2f')],'$lte':_0x23ca78['dateEnd']}});}if(_0x17d274['query']['filter']){_0x2ba654['where']=_['merge'](_0x2ba654['where'],{'$or':_['map'](_0x2ba654[_0x159e('0x34')],function(_0x50c624){var _0x58d777={};_0x58d777[_0x50c624]={'$like':'%'+_0x17d274[_0x159e('0x2e')]['filter']+'%'};return _0x58d777;})});}_0x2ba654=_[_0x159e('0x3b')]({},_0x2ba654,_0x17d274['options']);var _0x45c7cc={'where':_0x2ba654['where']};return db[_0x159e('0x2b')][_0x159e('0x1c')](_0x45c7cc)[_0x159e('0x24')](function(_0x1af51a){_0x38d9c3[_0x159e('0x1c')]=_0x1af51a;if(_0x17d274['query']['includeAll']){_0x2ba654['include']=[{'all':!![]}];}return db[_0x159e('0x2b')][_0x159e('0x3c')](_0x2ba654);})[_0x159e('0x24')](function(_0x501fbc){_0x38d9c3[_0x159e('0x3d')]=_0x501fbc;return _0x38d9c3;})[_0x159e('0x24')](respondWithFilteredResult(_0x402613,_0x2ba654))['catch'](handleError(_0x402613,null));};exports[_0x159e('0x3e')]=function(_0x32b522,_0x4e6da6){var _0x51a9db={'raw':!![],'where':{'id':_0x32b522[_0x159e('0x3f')]['id']}},_0x43a476={};_0x43a476[_0x159e('0x2d')]=_[_0x159e('0x31')](db[_0x159e('0x2b')][_0x159e('0x2c')]);_0x43a476[_0x159e('0x2e')]=_[_0x159e('0x31')](_0x32b522[_0x159e('0x2e')]);_0x43a476[_0x159e('0x32')]=_['intersection'](_0x43a476[_0x159e('0x2d')],_0x43a476['query']);_0x51a9db[_0x159e('0x34')]=_['intersection'](_0x43a476[_0x159e('0x2d')],qs[_0x159e('0x35')](_0x32b522['query'][_0x159e('0x35')]));_0x51a9db[_0x159e('0x34')]=_0x51a9db[_0x159e('0x34')]['length']?_0x51a9db['attributes']:_0x43a476[_0x159e('0x2d')];if(_0x32b522[_0x159e('0x2e')][_0x159e('0x40')]){_0x51a9db[_0x159e('0x41')]=[{'all':!![]}];}_0x51a9db=_[_0x159e('0x3b')]({},_0x51a9db,_0x32b522[_0x159e('0x42')]);return db['MemberReport'][_0x159e('0x43')](_0x51a9db)['then'](handleEntityNotFound(_0x4e6da6,null))[_0x159e('0x24')](respondWithResult(_0x4e6da6,null))['catch'](handleError(_0x4e6da6,null));};exports[_0x159e('0x44')]=function(_0x114851,_0x4baa6a){return db[_0x159e('0x2b')]['create'](_0x114851[_0x159e('0x45')],{})[_0x159e('0x24')](respondWithResult(_0x4baa6a,0xc9))[_0x159e('0x46')](handleError(_0x4baa6a,null));};exports['update']=function(_0x1b3530,_0x25513e){if(_0x1b3530[_0x159e('0x45')]['id']){delete _0x1b3530[_0x159e('0x45')]['id'];}return db['MemberReport']['find']({'where':{'id':_0x1b3530[_0x159e('0x3f')]['id']}})[_0x159e('0x24')](handleEntityNotFound(_0x25513e,null))[_0x159e('0x24')](saveUpdates(_0x1b3530[_0x159e('0x45')],null))[_0x159e('0x24')](respondWithResult(_0x25513e,null))['catch'](handleError(_0x25513e,null));};exports[_0x159e('0x47')]=function(_0x43bb84,_0xacb096){return db[_0x159e('0x2b')][_0x159e('0x43')]({'where':{'id':_0x43bb84[_0x159e('0x3f')]['id']}})['then'](handleEntityNotFound(_0xacb096,null))['then'](removeEntity(_0xacb096,null))['catch'](handleError(_0xacb096,null));};exports[_0x159e('0x48')]=function(_0x4bb37a,_0x2584a5){return db['MemberReport'][_0x159e('0x48')]()['then'](respondWithResult(_0x2584a5,null))[_0x159e('0x46')](handleError(_0x2584a5,null));}; \ No newline at end of file +var _0xee9c=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','MemberReport','query','dateEnd','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','dateStart','add','day','merge','where','map','filter','options','includeAll','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe'];(function(_0x1e5ebc,_0x4b6b4e){var _0x3e6a73=function(_0x2d5c0d){while(--_0x2d5c0d){_0x1e5ebc['push'](_0x1e5ebc['shift']());}};_0x3e6a73(++_0x4b6b4e);}(_0xee9c,0x1b6));var _0xcee9=function(_0x47c5bf,_0x45977e){_0x47c5bf=_0x47c5bf-0x0;var _0x11b779=_0xee9c[_0x47c5bf];return _0x11b779;};'use strict';var pdf=require(_0xcee9('0x0'));var emlformat=require(_0xcee9('0x1'));var rimraf=require(_0xcee9('0x2'));var zipdir=require(_0xcee9('0x3'));var jsonpatch=require(_0xcee9('0x4'));var rp=require('request-promise');var moment=require(_0xcee9('0x5'));var BPromise=require(_0xcee9('0x6'));var Mustache=require('mustache');var util=require(_0xcee9('0x7'));var path=require(_0xcee9('0x8'));var sox=require(_0xcee9('0x9'));var csv=require(_0xcee9('0xa'));var ejs=require(_0xcee9('0xb'));var fs=require('fs');var _=require(_0xcee9('0xc'));var squel=require('squel');var crypto=require(_0xcee9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xcee9('0xe'));var toCsv=require(_0xcee9('0xa'));var querystring=require(_0xcee9('0xf'));var Papa=require(_0xcee9('0x10'));var Redis=require('ioredis');var qs=require(_0xcee9('0x11'));var logger=require(_0xcee9('0x12'))(_0xcee9('0x13'));var utils=require(_0xcee9('0x14'));var config=require(_0xcee9('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a75a4,_0x2bb28e){_0x2bb28e=_0x2bb28e||0xcc;return function(_0x3aeabe){if(_0x3aeabe){return _0x1a75a4['sendStatus'](_0x2bb28e);}return _0x1a75a4[_0xcee9('0x16')](_0x2bb28e)[_0xcee9('0x17')]();};}function respondWithResult(_0x5576cb,_0x10bc6a){_0x10bc6a=_0x10bc6a||0xc8;return function(_0x2729c8){if(_0x2729c8){return _0x5576cb[_0xcee9('0x16')](_0x10bc6a)[_0xcee9('0x18')](_0x2729c8);}};}function respondWithFilteredResult(_0x24975d,_0x4453f0){return function(_0x744a89){if(_0x744a89){var _0x17e418=_0x744a89[_0xcee9('0x19')],_0x16be01=_0x4453f0[_0xcee9('0x1a')],_0x26bcff=_0x4453f0[_0xcee9('0x1a')]+_0x4453f0[_0xcee9('0x1b')],_0x540225;if(_0x26bcff>=_0x17e418){_0x26bcff=_0x17e418;_0x540225=0xc8;}else{_0x540225=0xce;}_0x24975d['status'](_0x540225);return _0x24975d[_0xcee9('0x1c')]('Content-Range',_0x16be01+'-'+_0x26bcff+'/'+_0x17e418)['json'](_0x744a89);}return null;};}function patchUpdates(_0x2f258a){return function(_0x3f3439){try{jsonpatch[_0xcee9('0x1d')](_0x3f3439,_0x2f258a,!![]);}catch(_0x1ea0a6){return BPromise[_0xcee9('0x1e')](_0x1ea0a6);}return _0x3f3439[_0xcee9('0x1f')]();};}function saveUpdates(_0x466ad0,_0x31d632){return function(_0x14796a){if(_0x14796a){return _0x14796a[_0xcee9('0x20')](_0x466ad0)['then'](function(_0x59285b){return _0x59285b;});}return null;};}function removeEntity(_0x636a9e,_0x594a0a){return function(_0x14e87d){if(_0x14e87d){return _0x14e87d[_0xcee9('0x21')]()[_0xcee9('0x22')](function(){_0x636a9e[_0xcee9('0x16')](0xcc)[_0xcee9('0x17')]();});}};}function handleEntityNotFound(_0x16a93c,_0x5a2012){return function(_0x25e9ad){if(!_0x25e9ad){_0x16a93c[_0xcee9('0x23')](0x194);}return _0x25e9ad;};}function handleError(_0x55f011,_0x137a76){_0x137a76=_0x137a76||0x1f4;return function(_0x14b9f1){logger[_0xcee9('0x24')](_0x14b9f1[_0xcee9('0x25')]);if(_0x14b9f1[_0xcee9('0x26')]){delete _0x14b9f1[_0xcee9('0x26')];}_0x55f011[_0xcee9('0x16')](_0x137a76)[_0xcee9('0x27')](_0x14b9f1);};}exports['index']=function(_0x5e4c47,_0x291aae){var _0x4304aa={},_0x4f5bcf={},_0x34b751={'count':0x0,'rows':[]};var _0x2d1ef9=db[_0xcee9('0x28')]['rawAttributes'];_0x4f5bcf['model']=_['keys'](_0x2d1ef9);var _0x15375c={'dateStart':_0x5e4c47[_0xcee9('0x29')]['dateStart'],'dateEnd':_0x5e4c47[_0xcee9('0x29')][_0xcee9('0x2a')]};delete _0x5e4c47[_0xcee9('0x29')]['dateStart'];delete _0x5e4c47[_0xcee9('0x29')]['dateEnd'];_0x4f5bcf[_0xcee9('0x29')]=_['keys'](_0x5e4c47[_0xcee9('0x29')]);_0x4f5bcf['filters']=_[_0xcee9('0x2b')](_0x4f5bcf[_0xcee9('0x2c')],_0x4f5bcf['query']);_0x4304aa[_0xcee9('0x2d')]=_[_0xcee9('0x2b')](_0x4f5bcf['model'],qs[_0xcee9('0x2e')](_0x5e4c47[_0xcee9('0x29')][_0xcee9('0x2e')]));_0x4304aa[_0xcee9('0x2d')]=_0x4304aa['attributes'][_0xcee9('0x2f')]?_0x4304aa[_0xcee9('0x2d')]:_0x4f5bcf[_0xcee9('0x2c')];if(!_0x5e4c47[_0xcee9('0x29')][_0xcee9('0x30')](_0xcee9('0x31'))){_0x4304aa[_0xcee9('0x1b')]=qs[_0xcee9('0x1b')](_0x5e4c47[_0xcee9('0x29')][_0xcee9('0x1b')]);_0x4304aa[_0xcee9('0x1a')]=qs[_0xcee9('0x1a')](_0x5e4c47[_0xcee9('0x29')][_0xcee9('0x1a')]);}_0x4304aa[_0xcee9('0x32')]=qs['sort'](_0x5e4c47[_0xcee9('0x29')][_0xcee9('0x33')]);_0x4304aa['where']=qs[_0xcee9('0x34')](_[_0xcee9('0x35')](_0x5e4c47[_0xcee9('0x29')],_0x4f5bcf[_0xcee9('0x34')]));if(_0x15375c[_0xcee9('0x36')]){if(_0x15375c[_0xcee9('0x2a')]){_0x15375c[_0xcee9('0x2a')]=moment(_0x15375c[_0xcee9('0x2a')])['add'](0x1,'day');}else{_0x15375c[_0xcee9('0x2a')]=moment(_0x15375c['dateStart'])[_0xcee9('0x37')](0x1,_0xcee9('0x38'));}_[_0xcee9('0x39')](_0x4304aa['where'],{'createdAt':{'$gte':_0x15375c[_0xcee9('0x36')],'$lte':_0x15375c['dateEnd']}});}if(_0x5e4c47[_0xcee9('0x29')]['filter']){_0x4304aa[_0xcee9('0x3a')]=_['merge'](_0x4304aa['where'],{'$or':_[_0xcee9('0x3b')](_0x4304aa['attributes'],function(_0x2d7668){var _0x4aa0fe={};_0x4aa0fe[_0x2d7668]={'$like':'%'+_0x5e4c47['query'][_0xcee9('0x3c')]+'%'};return _0x4aa0fe;})});}_0x4304aa=_[_0xcee9('0x39')]({},_0x4304aa,_0x5e4c47[_0xcee9('0x3d')]);var _0x36d700={'where':_0x4304aa[_0xcee9('0x3a')]};return db[_0xcee9('0x28')][_0xcee9('0x19')](_0x36d700)[_0xcee9('0x22')](function(_0x14a464){_0x34b751[_0xcee9('0x19')]=_0x14a464;if(_0x5e4c47[_0xcee9('0x29')][_0xcee9('0x3e')]){_0x4304aa['include']=[{'all':!![]}];}return db[_0xcee9('0x28')][_0xcee9('0x3f')](_0x4304aa);})[_0xcee9('0x22')](function(_0x3c6305){_0x34b751[_0xcee9('0x40')]=_0x3c6305;return _0x34b751;})['then'](respondWithFilteredResult(_0x291aae,_0x4304aa))[_0xcee9('0x41')](handleError(_0x291aae,null));};exports[_0xcee9('0x42')]=function(_0x27c966,_0x160752){var _0x3bfdc6={'raw':!![],'where':{'id':_0x27c966[_0xcee9('0x43')]['id']}},_0x169eb2={};_0x169eb2[_0xcee9('0x2c')]=_['keys'](db[_0xcee9('0x28')][_0xcee9('0x44')]);_0x169eb2[_0xcee9('0x29')]=_['keys'](_0x27c966[_0xcee9('0x29')]);_0x169eb2[_0xcee9('0x34')]=_['intersection'](_0x169eb2[_0xcee9('0x2c')],_0x169eb2[_0xcee9('0x29')]);_0x3bfdc6['attributes']=_[_0xcee9('0x2b')](_0x169eb2[_0xcee9('0x2c')],qs[_0xcee9('0x2e')](_0x27c966[_0xcee9('0x29')][_0xcee9('0x2e')]));_0x3bfdc6['attributes']=_0x3bfdc6[_0xcee9('0x2d')][_0xcee9('0x2f')]?_0x3bfdc6['attributes']:_0x169eb2['model'];if(_0x27c966[_0xcee9('0x29')][_0xcee9('0x3e')]){_0x3bfdc6['include']=[{'all':!![]}];}_0x3bfdc6=_[_0xcee9('0x39')]({},_0x3bfdc6,_0x27c966['options']);return db[_0xcee9('0x28')][_0xcee9('0x45')](_0x3bfdc6)['then'](handleEntityNotFound(_0x160752,null))[_0xcee9('0x22')](respondWithResult(_0x160752,null))[_0xcee9('0x41')](handleError(_0x160752,null));};exports['create']=function(_0x362c14,_0x1e2a2f){return db[_0xcee9('0x28')][_0xcee9('0x46')](_0x362c14[_0xcee9('0x47')],{})[_0xcee9('0x22')](respondWithResult(_0x1e2a2f,0xc9))[_0xcee9('0x41')](handleError(_0x1e2a2f,null));};exports[_0xcee9('0x20')]=function(_0x8607dc,_0x35ad35){if(_0x8607dc[_0xcee9('0x47')]['id']){delete _0x8607dc[_0xcee9('0x47')]['id'];}return db[_0xcee9('0x28')]['find']({'where':{'id':_0x8607dc['params']['id']}})[_0xcee9('0x22')](handleEntityNotFound(_0x35ad35,null))[_0xcee9('0x22')](saveUpdates(_0x8607dc[_0xcee9('0x47')],null))['then'](respondWithResult(_0x35ad35,null))[_0xcee9('0x41')](handleError(_0x35ad35,null));};exports['destroy']=function(_0x3a8f7f,_0xc5566f){return db[_0xcee9('0x28')]['find']({'where':{'id':_0x3a8f7f[_0xcee9('0x43')]['id']}})[_0xcee9('0x22')](handleEntityNotFound(_0xc5566f,null))[_0xcee9('0x22')](removeEntity(_0xc5566f,null))['catch'](handleError(_0xc5566f,null));};exports[_0xcee9('0x48')]=function(_0x1629c0,_0x215de9){return db[_0xcee9('0x28')][_0xcee9('0x48')]()['then'](respondWithResult(_0x215de9,null))[_0xcee9('0x41')](handleError(_0x215de9,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 48f6602..f6ba54e 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 _0xabe9=['membername_interface','membername','interface','lodash','util','../../config/logger','api','bluebird','./memberReport.attributes','define','MemberReport','report_member'];(function(_0x5349d2,_0x5d095a){var _0x14d707=function(_0x53c5c2){while(--_0x53c5c2){_0x5349d2['push'](_0x5349d2['shift']());}};_0x14d707(++_0x5d095a);}(_0xabe9,0x10b));var _0x9abe=function(_0x97676b,_0x4798ed){_0x97676b=_0x97676b-0x0;var _0x485d7f=_0xabe9[_0x97676b];return _0x485d7f;};'use strict';var _=require(_0x9abe('0x0'));var util=require(_0x9abe('0x1'));var logger=require(_0x9abe('0x2'))(_0x9abe('0x3'));var moment=require('moment');var BPromise=require(_0x9abe('0x4'));var rp=require('request-promise');var attributes=require(_0x9abe('0x5'));module['exports']=function(_0x483e81,_0x435cd1){return _0x483e81[_0x9abe('0x6')](_0x9abe('0x7'),attributes,{'tableName':_0x9abe('0x8'),'paranoid':![],'indexes':[{'name':_0x9abe('0x9'),'fields':[_0x9abe('0xa'),_0x9abe('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb1f9=['exports','define','MemberReport','report_member','interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./memberReport.attributes'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xb1f9,0x18b));var _0x9b1f=function(_0x1c03ef,_0x33bca0){_0x1c03ef=_0x1c03ef-0x0;var _0x1e7baa=_0xb1f9[_0x1c03ef];return _0x1e7baa;};'use strict';var _=require(_0x9b1f('0x0'));var util=require(_0x9b1f('0x1'));var logger=require(_0x9b1f('0x2'))(_0x9b1f('0x3'));var moment=require(_0x9b1f('0x4'));var BPromise=require(_0x9b1f('0x5'));var rp=require(_0x9b1f('0x6'));var attributes=require(_0x9b1f('0x7'));module[_0x9b1f('0x8')]=function(_0x518154,_0x243c28){return _0x518154[_0x9b1f('0x9')](_0x9b1f('0xa'),attributes,{'tableName':_0x9b1f('0xb'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername',_0x9b1f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 06d46ea..c32b4f9 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 _0xb2a3=['client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetMemberReport','MemberReport','findAll','options','raw','include','map','model','attributes','catch','CreateMemberReport','create','body','limit','UpdateMemberReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x5ecee1,_0x26cce1){var _0x4e2229=function(_0x48b031){while(--_0x48b031){_0x5ecee1['push'](_0x5ecee1['shift']());}};_0x4e2229(++_0x26cce1);}(_0xb2a3,0x169));var _0x3b2a=function(_0x4897f5,_0x5d9eb8){_0x4897f5=_0x4897f5-0x0;var _0x48e571=_0xb2a3[_0x4897f5];return _0x48e571;};'use strict';var _=require('lodash');var util=require(_0x3b2a('0x0'));var moment=require(_0x3b2a('0x1'));var BPromise=require(_0x3b2a('0x2'));var rs=require(_0x3b2a('0x3'));var fs=require('fs');var Redis=require(_0x3b2a('0x4'));var db=require(_0x3b2a('0x5'))['db'];var utils=require(_0x3b2a('0x6'));var logger=require('../../config/logger')(_0x3b2a('0x7'));var config=require(_0x3b2a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3b2a('0x9')][_0x3b2a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b0ef4,_0x1e5698,_0x5d4f9d){return new BPromise(function(_0x523e9c,_0x5578c5){return client[_0x3b2a('0xb')](_0x5b0ef4,_0x5d4f9d)[_0x3b2a('0xc')](function(_0x565b9e){logger[_0x3b2a('0xd')](_0x3b2a('0xe'),_0x1e5698,_0x3b2a('0xf'));logger[_0x3b2a('0x10')](_0x3b2a('0x11'),_0x1e5698,_0x3b2a('0xf'),JSON[_0x3b2a('0x12')](_0x565b9e));if(_0x565b9e[_0x3b2a('0x13')]){if(_0x565b9e['error'][_0x3b2a('0x14')]===0x1f4){logger['error'](_0x3b2a('0xe'),_0x1e5698,_0x565b9e[_0x3b2a('0x13')][_0x3b2a('0x15')]);return _0x5578c5(_0x565b9e[_0x3b2a('0x13')]['message']);}logger[_0x3b2a('0x13')](_0x3b2a('0xe'),_0x1e5698,_0x565b9e['error']['message']);return _0x523e9c(_0x565b9e[_0x3b2a('0x13')]['message']);}else{logger[_0x3b2a('0xd')](_0x3b2a('0xe'),_0x1e5698,_0x3b2a('0xf'));_0x523e9c(_0x565b9e['result'][_0x3b2a('0x15')]);}})['catch'](function(_0xd6445d){logger[_0x3b2a('0x13')](_0x3b2a('0xe'),_0x1e5698,_0xd6445d);_0x5578c5(_0xd6445d);});});}exports[_0x3b2a('0x16')]=function(_0x509d4c){var _0x19c2e8=this;return new Promise(function(_0x6ab216,_0x19ead4){return db[_0x3b2a('0x17')][_0x3b2a('0x18')]({'raw':_0x509d4c[_0x3b2a('0x19')]?_0x509d4c[_0x3b2a('0x19')][_0x3b2a('0x1a')]===undefined?!![]:![]:!![],'where':_0x509d4c[_0x3b2a('0x19')]?_0x509d4c[_0x3b2a('0x19')]['where']||null:null,'attributes':_0x509d4c[_0x3b2a('0x19')]?_0x509d4c[_0x3b2a('0x19')]['attributes']||null:null,'limit':_0x509d4c['options']?_0x509d4c[_0x3b2a('0x19')]['limit']||null:null,'include':_0x509d4c[_0x3b2a('0x19')]?_0x509d4c[_0x3b2a('0x19')][_0x3b2a('0x1b')]?_[_0x3b2a('0x1c')](_0x509d4c['options']['include'],function(_0x2fe153){return{'model':db[_0x2fe153[_0x3b2a('0x1d')]],'as':_0x2fe153['as'],'attributes':_0x2fe153[_0x3b2a('0x1e')],'include':_0x2fe153['include']?_['map'](_0x2fe153[_0x3b2a('0x1b')],function(_0x494884){return{'model':db[_0x494884[_0x3b2a('0x1d')]],'as':_0x494884['as'],'attributes':_0x494884[_0x3b2a('0x1e')],'include':_0x494884[_0x3b2a('0x1b')]?_[_0x3b2a('0x1c')](_0x494884['include'],function(_0x1e533c){return{'model':db[_0x1e533c['model']],'as':_0x1e533c['as'],'attributes':_0x1e533c['attributes']};}):[]};}):[]};}):[]:[]})[_0x3b2a('0xc')](function(_0x2eed6f){logger[_0x3b2a('0xd')]('GetMemberReport',_0x509d4c);logger[_0x3b2a('0x10')](_0x3b2a('0x16'),_0x509d4c,JSON[_0x3b2a('0x12')](_0x2eed6f));_0x6ab216(_0x2eed6f);})[_0x3b2a('0x1f')](function(_0x26a13e){logger['error'](_0x3b2a('0x16'),_0x26a13e[_0x3b2a('0x15')],_0x509d4c);_0x19ead4(_0x19c2e8[_0x3b2a('0x13')](0x1f4,_0x26a13e[_0x3b2a('0x15')]));});});};exports[_0x3b2a('0x20')]=function(_0x121988){var _0x33bdaf=this;return new Promise(function(_0x5ddc71,_0x217f78){return db[_0x3b2a('0x17')][_0x3b2a('0x21')](_0x121988[_0x3b2a('0x22')],{'raw':_0x121988[_0x3b2a('0x19')]?_0x121988[_0x3b2a('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x3b2a('0xc')](function(_0x3b1d4a){logger[_0x3b2a('0xd')]('CreateMemberReport',_0x121988);logger[_0x3b2a('0x10')](_0x3b2a('0x20'),_0x121988,JSON[_0x3b2a('0x12')](_0x3b1d4a));_0x5ddc71(_0x3b1d4a);})[_0x3b2a('0x1f')](function(_0x57d305){logger['error']('CreateMemberReport',_0x57d305['message'],_0x121988);_0x217f78(_0x33bdaf[_0x3b2a('0x13')](0x1f4,_0x57d305[_0x3b2a('0x15')]));});});};exports['UpdateMemberReport']=function(_0x23a20e){var _0x31afa6=this;return new Promise(function(_0x5e7af9,_0x44644f){return db['MemberReport']['update'](_0x23a20e[_0x3b2a('0x22')],{'raw':_0x23a20e[_0x3b2a('0x19')]?_0x23a20e['options'][_0x3b2a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23a20e['options']?_0x23a20e[_0x3b2a('0x19')]['where']||null:null,'attributes':_0x23a20e[_0x3b2a('0x19')]?_0x23a20e[_0x3b2a('0x19')][_0x3b2a('0x1e')]||null:null,'limit':_0x23a20e[_0x3b2a('0x19')]?_0x23a20e['options'][_0x3b2a('0x23')]||null:null})[_0x3b2a('0xc')](function(_0x5cd7fc){logger[_0x3b2a('0xd')](_0x3b2a('0x24'),_0x23a20e);logger[_0x3b2a('0x10')](_0x3b2a('0x24'),_0x23a20e,JSON[_0x3b2a('0x12')](_0x5cd7fc));_0x5e7af9(_0x5cd7fc);})[_0x3b2a('0x1f')](function(_0x23358f){logger[_0x3b2a('0x13')](_0x3b2a('0x24'),_0x23358f[_0x3b2a('0x15')],_0x23a20e);_0x44644f(_0x31afa6[_0x3b2a('0x13')](0x1f4,_0x23358f[_0x3b2a('0x15')]));});});}; \ No newline at end of file +var _0xb559=['MemberReport','options','raw','attributes','limit','include','map','model','CreateMemberReport','body','update','where','UpdateMemberReport','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetMemberReport'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xb559,0xbc));var _0x9b55=function(_0x51dbba,_0x817f0d){_0x51dbba=_0x51dbba-0x0;var _0x34906d=_0xb559[_0x51dbba];return _0x34906d;};'use strict';var _=require(_0x9b55('0x0'));var util=require(_0x9b55('0x1'));var moment=require('moment');var BPromise=require(_0x9b55('0x2'));var rs=require(_0x9b55('0x3'));var fs=require('fs');var Redis=require(_0x9b55('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9b55('0x5'));var logger=require(_0x9b55('0x6'))(_0x9b55('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9b55('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a7f38,_0x496af6,_0x1e0473){return new BPromise(function(_0x465702,_0x236e34){return client[_0x9b55('0x9')](_0x2a7f38,_0x1e0473)[_0x9b55('0xa')](function(_0x1720ca){logger[_0x9b55('0xb')](_0x9b55('0xc'),_0x496af6,_0x9b55('0xd'));logger[_0x9b55('0xe')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x496af6,'request\x20sent',JSON[_0x9b55('0xf')](_0x1720ca));if(_0x1720ca[_0x9b55('0x10')]){if(_0x1720ca[_0x9b55('0x10')][_0x9b55('0x11')]===0x1f4){logger[_0x9b55('0x10')](_0x9b55('0xc'),_0x496af6,_0x1720ca[_0x9b55('0x10')][_0x9b55('0x12')]);return _0x236e34(_0x1720ca[_0x9b55('0x10')][_0x9b55('0x12')]);}logger['error'](_0x9b55('0xc'),_0x496af6,_0x1720ca[_0x9b55('0x10')]['message']);return _0x465702(_0x1720ca[_0x9b55('0x10')][_0x9b55('0x12')]);}else{logger['info'](_0x9b55('0xc'),_0x496af6,'request\x20sent');_0x465702(_0x1720ca[_0x9b55('0x13')][_0x9b55('0x12')]);}})[_0x9b55('0x14')](function(_0x5d8da4){logger[_0x9b55('0x10')](_0x9b55('0xc'),_0x496af6,_0x5d8da4);_0x236e34(_0x5d8da4);});});}exports[_0x9b55('0x15')]=function(_0x102845){var _0x123f93=this;return new Promise(function(_0x1efe6e,_0x1d61e9){return db[_0x9b55('0x16')]['findAll']({'raw':_0x102845[_0x9b55('0x17')]?_0x102845[_0x9b55('0x17')][_0x9b55('0x18')]===undefined?!![]:![]:!![],'where':_0x102845[_0x9b55('0x17')]?_0x102845[_0x9b55('0x17')]['where']||null:null,'attributes':_0x102845[_0x9b55('0x17')]?_0x102845['options'][_0x9b55('0x19')]||null:null,'limit':_0x102845['options']?_0x102845['options'][_0x9b55('0x1a')]||null:null,'include':_0x102845[_0x9b55('0x17')]?_0x102845[_0x9b55('0x17')][_0x9b55('0x1b')]?_[_0x9b55('0x1c')](_0x102845[_0x9b55('0x17')][_0x9b55('0x1b')],function(_0x1cf71b){return{'model':db[_0x1cf71b[_0x9b55('0x1d')]],'as':_0x1cf71b['as'],'attributes':_0x1cf71b[_0x9b55('0x19')],'include':_0x1cf71b[_0x9b55('0x1b')]?_[_0x9b55('0x1c')](_0x1cf71b[_0x9b55('0x1b')],function(_0x28af97){return{'model':db[_0x28af97[_0x9b55('0x1d')]],'as':_0x28af97['as'],'attributes':_0x28af97[_0x9b55('0x19')],'include':_0x28af97[_0x9b55('0x1b')]?_[_0x9b55('0x1c')](_0x28af97[_0x9b55('0x1b')],function(_0x5538f4){return{'model':db[_0x5538f4['model']],'as':_0x5538f4['as'],'attributes':_0x5538f4[_0x9b55('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9b55('0xa')](function(_0x173794){logger[_0x9b55('0xb')]('GetMemberReport',_0x102845);logger['debug'](_0x9b55('0x15'),_0x102845,JSON[_0x9b55('0xf')](_0x173794));_0x1efe6e(_0x173794);})[_0x9b55('0x14')](function(_0x56546d){logger[_0x9b55('0x10')](_0x9b55('0x15'),_0x56546d[_0x9b55('0x12')],_0x102845);_0x1d61e9(_0x123f93[_0x9b55('0x10')](0x1f4,_0x56546d[_0x9b55('0x12')]));});});};exports[_0x9b55('0x1e')]=function(_0x4991b7){var _0x4bae97=this;return new Promise(function(_0x2ac5ce,_0x1933b5){return db['MemberReport']['create'](_0x4991b7[_0x9b55('0x1f')],{'raw':_0x4991b7[_0x9b55('0x17')]?_0x4991b7['options'][_0x9b55('0x18')]===undefined?!![]:![]:!![]})[_0x9b55('0xa')](function(_0x33fd10){logger[_0x9b55('0xb')](_0x9b55('0x1e'),_0x4991b7);logger['debug'](_0x9b55('0x1e'),_0x4991b7,JSON['stringify'](_0x33fd10));_0x2ac5ce(_0x33fd10);})['catch'](function(_0x137a35){logger[_0x9b55('0x10')]('CreateMemberReport',_0x137a35[_0x9b55('0x12')],_0x4991b7);_0x1933b5(_0x4bae97[_0x9b55('0x10')](0x1f4,_0x137a35[_0x9b55('0x12')]));});});};exports['UpdateMemberReport']=function(_0x1c4a05){var _0xe86729=this;return new Promise(function(_0x15afb5,_0x37f6ca){return db[_0x9b55('0x16')][_0x9b55('0x20')](_0x1c4a05[_0x9b55('0x1f')],{'raw':_0x1c4a05[_0x9b55('0x17')]?_0x1c4a05[_0x9b55('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c4a05[_0x9b55('0x17')]?_0x1c4a05[_0x9b55('0x17')][_0x9b55('0x21')]||null:null,'attributes':_0x1c4a05['options']?_0x1c4a05[_0x9b55('0x17')][_0x9b55('0x19')]||null:null,'limit':_0x1c4a05['options']?_0x1c4a05['options'][_0x9b55('0x1a')]||null:null})[_0x9b55('0xa')](function(_0x1d9dff){logger[_0x9b55('0xb')]('UpdateMemberReport',_0x1c4a05);logger[_0x9b55('0xe')](_0x9b55('0x22'),_0x1c4a05,JSON[_0x9b55('0xf')](_0x1d9dff));_0x15afb5(_0x1d9dff);})[_0x9b55('0x14')](function(_0x1f7429){logger[_0x9b55('0x10')](_0x9b55('0x22'),_0x1f7429[_0x9b55('0x12')],_0x1c4a05);_0x37f6ca(_0xe86729[_0x9b55('0x10')](0x1f4,_0x1f7429[_0x9b55('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index e8ab78f..b4bcc11 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 _0x37f8=['get','index','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller'];(function(_0x4347cd,_0x562582){var _0x40c6d7=function(_0xe4c3e7){while(--_0xe4c3e7){_0x4347cd['push'](_0x4347cd['shift']());}};_0x40c6d7(++_0x562582);}(_0x37f8,0x1d7));var _0x837f=function(_0xd5818b,_0x427f21){_0xd5818b=_0xd5818b-0x0;var _0x763b45=_0x37f8[_0xd5818b];return _0x763b45;};'use strict';var multer=require(_0x837f('0x0'));var util=require(_0x837f('0x1'));var path=require(_0x837f('0x2'));var timeout=require(_0x837f('0x3'));var express=require('express');var router=express[_0x837f('0x4')]();var auth=require(_0x837f('0x5'));var interaction=require(_0x837f('0x6'));var config=require(_0x837f('0x7'));var controller=require(_0x837f('0x8'));router[_0x837f('0x9')]('/',controller[_0x837f('0xa')]);module[_0x837f('0xb')]=router; \ No newline at end of file +var _0x5c84=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x569b7a,_0x377a61){var _0x39d00a=function(_0x1ee0bc){while(--_0x1ee0bc){_0x569b7a['push'](_0x569b7a['shift']());}};_0x39d00a(++_0x377a61);}(_0x5c84,0xa1));var _0x45c8=function(_0x4ed0dd,_0x25cb9f){_0x4ed0dd=_0x4ed0dd-0x0;var _0x988fe8=_0x5c84[_0x4ed0dd];return _0x988fe8;};'use strict';var multer=require(_0x45c8('0x0'));var util=require(_0x45c8('0x1'));var path=require(_0x45c8('0x2'));var timeout=require(_0x45c8('0x3'));var express=require(_0x45c8('0x4'));var router=express['Router']();var auth=require(_0x45c8('0x5'));var interaction=require(_0x45c8('0x6'));var config=require('../../config/environment');var controller=require('./migration.controller');router[_0x45c8('0x7')]('/',controller[_0x45c8('0x8')]);module[_0x45c8('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 4d8693c..7205ce2 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 _0xff1d=['exports'];(function(_0x4f48fe,_0x4c4e59){var _0x6a5b80=function(_0x2eb109){while(--_0x2eb109){_0x4f48fe['push'](_0x4f48fe['shift']());}};_0x6a5b80(++_0x4c4e59);}(_0xff1d,0x192));var _0xdff1=function(_0x14365a,_0x25a607){_0x14365a=_0x14365a-0x0;var _0x666a32=_0xff1d[_0x14365a];return _0x666a32;};'use strict';var Sequelize=require('sequelize');module[_0xdff1('0x0')]={'version':{'type':Sequelize['STRING'],'primaryKey':!![],'autoIncrement':![]}}; \ No newline at end of file +var _0x7292=['exports','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7292,0x107));var _0x2729=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x7292[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require(_0x2729('0x0'));module[_0x2729('0x1')]={'version':{'type':Sequelize[_0x2729('0x2')],'primaryKey':!![],'autoIncrement':![]}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index c07f08b..a38e0cf 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 _0x1c4f=['squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','reject','save','destroy','then','error','name','send','index','rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','filter','map','includeAll','include','Migration','findAll','rows','catch','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash'];(function(_0x12f552,_0x1fb6e3){var _0x1f5b2e=function(_0x15009d){while(--_0x15009d){_0x12f552['push'](_0x12f552['shift']());}};_0x1f5b2e(++_0x1fb6e3);}(_0x1c4f,0x1f4));var _0xf1c4=function(_0x69ac5a,_0xc68990){_0x69ac5a=_0x69ac5a-0x0;var _0x2d898c=_0x1c4f[_0x69ac5a];return _0x2d898c;};'use strict';var pdf=require(_0xf1c4('0x0'));var emlformat=require(_0xf1c4('0x1'));var rimraf=require(_0xf1c4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf1c4('0x3'));var rp=require(_0xf1c4('0x4'));var moment=require('moment');var BPromise=require(_0xf1c4('0x5'));var Mustache=require(_0xf1c4('0x6'));var util=require(_0xf1c4('0x7'));var path=require('path');var sox=require(_0xf1c4('0x8'));var csv=require(_0xf1c4('0x9'));var ejs=require(_0xf1c4('0xa'));var fs=require('fs');var _=require(_0xf1c4('0xb'));var squel=require(_0xf1c4('0xc'));var crypto=require(_0xf1c4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf1c4('0xe'));var toCsv=require(_0xf1c4('0x9'));var querystring=require(_0xf1c4('0xf'));var Papa=require('papaparse');var Redis=require(_0xf1c4('0x10'));var qs=require(_0xf1c4('0x11'));var logger=require(_0xf1c4('0x12'))(_0xf1c4('0x13'));var utils=require(_0xf1c4('0x14'));var config=require(_0xf1c4('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x517b0e,_0x965bbb){_0x965bbb=_0x965bbb||0xcc;return function(_0x881426){if(_0x881426){return _0x517b0e[_0xf1c4('0x16')](_0x965bbb);}return _0x517b0e[_0xf1c4('0x17')](_0x965bbb)[_0xf1c4('0x18')]();};}function respondWithResult(_0x2f7302,_0x12cbd7){_0x12cbd7=_0x12cbd7||0xc8;return function(_0x55732e){if(_0x55732e){return _0x2f7302[_0xf1c4('0x17')](_0x12cbd7)['json'](_0x55732e);}};}function respondWithFilteredResult(_0x2d49ce,_0x3c211b){return function(_0x11cb27){if(_0x11cb27){var _0x1f1122=_0x11cb27[_0xf1c4('0x19')],_0x390dfa=_0x3c211b[_0xf1c4('0x1a')],_0x119d04=_0x3c211b[_0xf1c4('0x1a')]+_0x3c211b[_0xf1c4('0x1b')],_0x30efff;if(_0x119d04>=_0x1f1122){_0x119d04=_0x1f1122;_0x30efff=0xc8;}else{_0x30efff=0xce;}_0x2d49ce['status'](_0x30efff);return _0x2d49ce[_0xf1c4('0x1c')]('Content-Range',_0x390dfa+'-'+_0x119d04+'/'+_0x1f1122)['json'](_0x11cb27);}return null;};}function patchUpdates(_0x2dd4a7){return function(_0x87cd5f){try{jsonpatch['apply'](_0x87cd5f,_0x2dd4a7,!![]);}catch(_0x37c6d0){return BPromise[_0xf1c4('0x1d')](_0x37c6d0);}return _0x87cd5f[_0xf1c4('0x1e')]();};}function saveUpdates(_0x2ba83f,_0x3f18dd){return function(_0x25ce7d){if(_0x25ce7d){return _0x25ce7d['update'](_0x2ba83f)['then'](function(_0x3e8616){return _0x3e8616;});}return null;};}function removeEntity(_0x115302,_0x6dcb98){return function(_0x709b27){if(_0x709b27){return _0x709b27[_0xf1c4('0x1f')]()[_0xf1c4('0x20')](function(){_0x115302[_0xf1c4('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5dc29d,_0x1b11c2){return function(_0x496518){if(!_0x496518){_0x5dc29d['sendStatus'](0x194);}return _0x496518;};}function handleError(_0x1e4521,_0x215a62){_0x215a62=_0x215a62||0x1f4;return function(_0x594e0d){logger[_0xf1c4('0x21')](_0x594e0d['stack']);if(_0x594e0d[_0xf1c4('0x22')]){delete _0x594e0d['name'];}_0x1e4521[_0xf1c4('0x17')](_0x215a62)[_0xf1c4('0x23')](_0x594e0d);};}exports[_0xf1c4('0x24')]=function(_0x2d6417,_0x1a7440){var _0x6d3d79={},_0x236906={},_0x12b67b={'count':0x0,'rows':[]};var _0x318dbb=db['Migration'][_0xf1c4('0x25')];_0x236906[_0xf1c4('0x26')]=_['keys'](_0x318dbb);var _0x5b51ea={'dateStart':_0x2d6417[_0xf1c4('0x27')][_0xf1c4('0x28')],'dateEnd':_0x2d6417[_0xf1c4('0x27')][_0xf1c4('0x29')]};delete _0x2d6417[_0xf1c4('0x27')][_0xf1c4('0x28')];delete _0x2d6417[_0xf1c4('0x27')][_0xf1c4('0x29')];_0x236906[_0xf1c4('0x27')]=_[_0xf1c4('0x2a')](_0x2d6417[_0xf1c4('0x27')]);_0x236906[_0xf1c4('0x2b')]=_[_0xf1c4('0x2c')](_0x236906[_0xf1c4('0x26')],_0x236906['query']);_0x6d3d79[_0xf1c4('0x2d')]=_[_0xf1c4('0x2c')](_0x236906[_0xf1c4('0x26')],qs[_0xf1c4('0x2e')](_0x2d6417[_0xf1c4('0x27')][_0xf1c4('0x2e')]));_0x6d3d79[_0xf1c4('0x2d')]=_0x6d3d79[_0xf1c4('0x2d')][_0xf1c4('0x2f')]?_0x6d3d79[_0xf1c4('0x2d')]:_0x236906['model'];if(!_0x2d6417['query'][_0xf1c4('0x30')](_0xf1c4('0x31'))){_0x6d3d79[_0xf1c4('0x1b')]=qs[_0xf1c4('0x1b')](_0x2d6417[_0xf1c4('0x27')]['limit']);_0x6d3d79[_0xf1c4('0x1a')]=qs[_0xf1c4('0x1a')](_0x2d6417[_0xf1c4('0x27')][_0xf1c4('0x1a')]);}_0x6d3d79[_0xf1c4('0x32')]=qs[_0xf1c4('0x33')](_0x2d6417[_0xf1c4('0x27')][_0xf1c4('0x33')]);_0x6d3d79[_0xf1c4('0x34')]=qs[_0xf1c4('0x2b')](_[_0xf1c4('0x35')](_0x2d6417['query'],_0x236906[_0xf1c4('0x2b')]));if(_0x5b51ea['dateStart']){if(_0x5b51ea[_0xf1c4('0x29')]){_0x5b51ea[_0xf1c4('0x29')]=moment(_0x5b51ea['dateEnd'])[_0xf1c4('0x36')](0x1,_0xf1c4('0x37'));}else{_0x5b51ea[_0xf1c4('0x29')]=moment(_0x5b51ea['dateStart'])['add'](0x1,_0xf1c4('0x37'));}_['merge'](_0x6d3d79['where'],{'createdAt':{'$gte':_0x5b51ea[_0xf1c4('0x28')],'$lte':_0x5b51ea[_0xf1c4('0x29')]}});}if(_0x2d6417[_0xf1c4('0x27')][_0xf1c4('0x38')]){_0x6d3d79[_0xf1c4('0x34')]=_['merge'](_0x6d3d79['where'],{'$or':_[_0xf1c4('0x39')](_0x6d3d79[_0xf1c4('0x2d')],function(_0x41db80){var _0x39742d={};_0x39742d[_0x41db80]={'$like':'%'+_0x2d6417[_0xf1c4('0x27')][_0xf1c4('0x38')]+'%'};return _0x39742d;})});}_0x6d3d79=_['merge']({},_0x6d3d79,_0x2d6417['options']);var _0x441b1b={'where':_0x6d3d79[_0xf1c4('0x34')]};return db['Migration'][_0xf1c4('0x19')](_0x441b1b)[_0xf1c4('0x20')](function(_0xf18efc){_0x12b67b[_0xf1c4('0x19')]=_0xf18efc;if(_0x2d6417[_0xf1c4('0x27')][_0xf1c4('0x3a')]){_0x6d3d79[_0xf1c4('0x3b')]=[{'all':!![]}];}return db[_0xf1c4('0x3c')][_0xf1c4('0x3d')](_0x6d3d79);})[_0xf1c4('0x20')](function(_0x1212ba){_0x12b67b[_0xf1c4('0x3e')]=_0x1212ba;return _0x12b67b;})['then'](respondWithFilteredResult(_0x1a7440,_0x6d3d79))[_0xf1c4('0x3f')](handleError(_0x1a7440,null));}; \ No newline at end of file +var _0x0fd9=['then','destroy','error','name','send','index','Migration','keys','query','dateStart','dateEnd','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','add','filter','merge','map','options','count','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','reject','save','update'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x0fd9,0xa3));var _0x90fd=function(_0x3ff685,_0x304b9e){_0x3ff685=_0x3ff685-0x0;var _0x2046c9=_0x0fd9[_0x3ff685];return _0x2046c9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x90fd('0x0'));var rimraf=require(_0x90fd('0x1'));var zipdir=require(_0x90fd('0x2'));var jsonpatch=require(_0x90fd('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x90fd('0x4'));var Mustache=require(_0x90fd('0x5'));var util=require(_0x90fd('0x6'));var path=require(_0x90fd('0x7'));var sox=require(_0x90fd('0x8'));var csv=require(_0x90fd('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x90fd('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x90fd('0xb'));var toCsv=require(_0x90fd('0x9'));var querystring=require('querystring');var Papa=require(_0x90fd('0xc'));var Redis=require(_0x90fd('0xd'));var qs=require(_0x90fd('0xe'));var logger=require(_0x90fd('0xf'))(_0x90fd('0x10'));var utils=require(_0x90fd('0x11'));var config=require(_0x90fd('0x12'));var db=require(_0x90fd('0x13'))['db'];function respondWithStatusCode(_0x3c541e,_0x48943e){_0x48943e=_0x48943e||0xcc;return function(_0x23c417){if(_0x23c417){return _0x3c541e[_0x90fd('0x14')](_0x48943e);}return _0x3c541e['status'](_0x48943e)[_0x90fd('0x15')]();};}function respondWithResult(_0x37a0f8,_0x19a594){_0x19a594=_0x19a594||0xc8;return function(_0x5f28ab){if(_0x5f28ab){return _0x37a0f8[_0x90fd('0x16')](_0x19a594)['json'](_0x5f28ab);}};}function respondWithFilteredResult(_0x1cae40,_0xb402d9){return function(_0x18bdb6){if(_0x18bdb6){var _0x1b3f3b=_0x18bdb6['count'],_0x3c5da8=_0xb402d9['offset'],_0x442a19=_0xb402d9[_0x90fd('0x17')]+_0xb402d9[_0x90fd('0x18')],_0x296a64;if(_0x442a19>=_0x1b3f3b){_0x442a19=_0x1b3f3b;_0x296a64=0xc8;}else{_0x296a64=0xce;}_0x1cae40['status'](_0x296a64);return _0x1cae40[_0x90fd('0x19')](_0x90fd('0x1a'),_0x3c5da8+'-'+_0x442a19+'/'+_0x1b3f3b)[_0x90fd('0x1b')](_0x18bdb6);}return null;};}function patchUpdates(_0x4d8f3b){return function(_0x3f9c76){try{jsonpatch[_0x90fd('0x1c')](_0x3f9c76,_0x4d8f3b,!![]);}catch(_0x16d8a7){return BPromise[_0x90fd('0x1d')](_0x16d8a7);}return _0x3f9c76[_0x90fd('0x1e')]();};}function saveUpdates(_0x58866f,_0x10a14b){return function(_0x301e19){if(_0x301e19){return _0x301e19[_0x90fd('0x1f')](_0x58866f)[_0x90fd('0x20')](function(_0x19e79b){return _0x19e79b;});}return null;};}function removeEntity(_0x34ab93,_0x1fb31a){return function(_0x83fde){if(_0x83fde){return _0x83fde[_0x90fd('0x21')]()['then'](function(){_0x34ab93[_0x90fd('0x16')](0xcc)[_0x90fd('0x15')]();});}};}function handleEntityNotFound(_0xf3044b,_0x1b47e5){return function(_0x411a6a){if(!_0x411a6a){_0xf3044b[_0x90fd('0x14')](0x194);}return _0x411a6a;};}function handleError(_0x30f67e,_0x300262){_0x300262=_0x300262||0x1f4;return function(_0x5152f6){logger[_0x90fd('0x22')](_0x5152f6['stack']);if(_0x5152f6[_0x90fd('0x23')]){delete _0x5152f6[_0x90fd('0x23')];}_0x30f67e[_0x90fd('0x16')](_0x300262)[_0x90fd('0x24')](_0x5152f6);};}exports[_0x90fd('0x25')]=function(_0x4c962f,_0x35c38d){var _0xe333f0={},_0x2fffe6={},_0x1cdc38={'count':0x0,'rows':[]};var _0x1c3805=db[_0x90fd('0x26')]['rawAttributes'];_0x2fffe6['model']=_[_0x90fd('0x27')](_0x1c3805);var _0x170cfb={'dateStart':_0x4c962f[_0x90fd('0x28')][_0x90fd('0x29')],'dateEnd':_0x4c962f[_0x90fd('0x28')]['dateEnd']};delete _0x4c962f['query'][_0x90fd('0x29')];delete _0x4c962f[_0x90fd('0x28')][_0x90fd('0x2a')];_0x2fffe6[_0x90fd('0x28')]=_['keys'](_0x4c962f['query']);_0x2fffe6[_0x90fd('0x2b')]=_[_0x90fd('0x2c')](_0x2fffe6[_0x90fd('0x2d')],_0x2fffe6[_0x90fd('0x28')]);_0xe333f0['attributes']=_[_0x90fd('0x2c')](_0x2fffe6[_0x90fd('0x2d')],qs[_0x90fd('0x2e')](_0x4c962f[_0x90fd('0x28')][_0x90fd('0x2e')]));_0xe333f0[_0x90fd('0x2f')]=_0xe333f0[_0x90fd('0x2f')][_0x90fd('0x30')]?_0xe333f0[_0x90fd('0x2f')]:_0x2fffe6[_0x90fd('0x2d')];if(!_0x4c962f[_0x90fd('0x28')][_0x90fd('0x31')](_0x90fd('0x32'))){_0xe333f0[_0x90fd('0x18')]=qs[_0x90fd('0x18')](_0x4c962f[_0x90fd('0x28')]['limit']);_0xe333f0[_0x90fd('0x17')]=qs[_0x90fd('0x17')](_0x4c962f[_0x90fd('0x28')][_0x90fd('0x17')]);}_0xe333f0[_0x90fd('0x33')]=qs[_0x90fd('0x34')](_0x4c962f[_0x90fd('0x28')][_0x90fd('0x34')]);_0xe333f0[_0x90fd('0x35')]=qs[_0x90fd('0x2b')](_[_0x90fd('0x36')](_0x4c962f[_0x90fd('0x28')],_0x2fffe6[_0x90fd('0x2b')]));if(_0x170cfb['dateStart']){if(_0x170cfb[_0x90fd('0x2a')]){_0x170cfb[_0x90fd('0x2a')]=moment(_0x170cfb[_0x90fd('0x2a')])[_0x90fd('0x37')](0x1,'day');}else{_0x170cfb[_0x90fd('0x2a')]=moment(_0x170cfb[_0x90fd('0x29')])[_0x90fd('0x37')](0x1,'day');}_['merge'](_0xe333f0[_0x90fd('0x35')],{'createdAt':{'$gte':_0x170cfb[_0x90fd('0x29')],'$lte':_0x170cfb[_0x90fd('0x2a')]}});}if(_0x4c962f[_0x90fd('0x28')][_0x90fd('0x38')]){_0xe333f0[_0x90fd('0x35')]=_[_0x90fd('0x39')](_0xe333f0[_0x90fd('0x35')],{'$or':_[_0x90fd('0x3a')](_0xe333f0[_0x90fd('0x2f')],function(_0x3265c6){var _0x43c84c={};_0x43c84c[_0x3265c6]={'$like':'%'+_0x4c962f[_0x90fd('0x28')][_0x90fd('0x38')]+'%'};return _0x43c84c;})});}_0xe333f0=_[_0x90fd('0x39')]({},_0xe333f0,_0x4c962f[_0x90fd('0x3b')]);var _0x2717ca={'where':_0xe333f0[_0x90fd('0x35')]};return db['Migration'][_0x90fd('0x3c')](_0x2717ca)[_0x90fd('0x20')](function(_0x2cb5e8){_0x1cdc38['count']=_0x2cb5e8;if(_0x4c962f['query']['includeAll']){_0xe333f0[_0x90fd('0x3d')]=[{'all':!![]}];}return db[_0x90fd('0x26')][_0x90fd('0x3e')](_0xe333f0);})[_0x90fd('0x20')](function(_0x1361d9){_0x1cdc38[_0x90fd('0x3f')]=_0x1361d9;return _0x1cdc38;})[_0x90fd('0x20')](respondWithFilteredResult(_0x35c38d,_0xe333f0))[_0x90fd('0x40')](handleError(_0x35c38d,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 084f295..1886525 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 _0xa817=['define','migrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./migration.attributes','exports'];(function(_0x4ee679,_0x343787){var _0x3cf569=function(_0x5c8930){while(--_0x5c8930){_0x4ee679['push'](_0x4ee679['shift']());}};_0x3cf569(++_0x343787);}(_0xa817,0x7b));var _0x7a81=function(_0x43cdf5,_0x47c1e7){_0x43cdf5=_0x43cdf5-0x0;var _0x89cc4b=_0xa817[_0x43cdf5];return _0x89cc4b;};'use strict';var _=require(_0x7a81('0x0'));var util=require(_0x7a81('0x1'));var logger=require(_0x7a81('0x2'))(_0x7a81('0x3'));var moment=require(_0x7a81('0x4'));var BPromise=require(_0x7a81('0x5'));var rp=require(_0x7a81('0x6'));var attributes=require(_0x7a81('0x7'));module[_0x7a81('0x8')]=function(_0x4b5d54,_0x23551a){return _0x4b5d54[_0x7a81('0x9')]('Migration',attributes,{'tableName':_0x7a81('0xa'),'paranoid':![],'indexes':[],'timestamps':![]});}; \ No newline at end of file +var _0xb422=['exports','Migration','migrations','api','request-promise'];(function(_0x379007,_0x280103){var _0x3f2a0b=function(_0x59500a){while(--_0x59500a){_0x379007['push'](_0x379007['shift']());}};_0x3f2a0b(++_0x280103);}(_0xb422,0x85));var _0x2b42=function(_0x2eec7e,_0x8c4a6a){_0x2eec7e=_0x2eec7e-0x0;var _0x266083=_0xb422[_0x2eec7e];return _0x266083;};'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 attributes=require('./migration.attributes');module[_0x2b42('0x2')]=function(_0x5df2d3,_0x1b469f){return _0x5df2d3['define'](_0x2b42('0x3'),attributes,{'tableName':_0x2b42('0x4'),'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 ee3746a..2dfe04b 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 _0xa41a=['rpc','../../config/environment','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x438133,_0x2e5e09){var _0x171e94=function(_0x296a1e){while(--_0x296a1e){_0x438133['push'](_0x438133['shift']());}};_0x171e94(++_0x2e5e09);}(_0xa41a,0x6b));var _0xaa41=function(_0x223a91,_0x53bac5){_0x223a91=_0x223a91-0x0;var _0x4661e9=_0xa41a[_0x223a91];return _0x4661e9;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ No newline at end of file +var _0xee14=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','Migration,\x20%s,\x20%s','message','result','catch','moment'];(function(_0x187677,_0x3916e6){var _0x4f7ee5=function(_0x4c6f1e){while(--_0x4c6f1e){_0x187677['push'](_0x187677['shift']());}};_0x4f7ee5(++_0x3916e6);}(_0xee14,0x13a));var _0x4ee1=function(_0x4f33d3,_0x66cec1){_0x4f33d3=_0x4f33d3-0x0;var _0x318baf=_0xee14[_0x4f33d3];return _0x318baf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4ee1('0x0'));var BPromise=require(_0x4ee1('0x1'));var rs=require(_0x4ee1('0x2'));var fs=require('fs');var Redis=require(_0x4ee1('0x3'));var db=require(_0x4ee1('0x4'))['db'];var utils=require(_0x4ee1('0x5'));var logger=require(_0x4ee1('0x6'))(_0x4ee1('0x7'));var config=require(_0x4ee1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4ee1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x327c18,_0x3a45a3,_0x187656){return new BPromise(function(_0x293d5f,_0xdfe9c1){return client[_0x4ee1('0xa')](_0x327c18,_0x187656)['then'](function(_0x33dbe6){logger[_0x4ee1('0xb')]('Migration,\x20%s,\x20%s',_0x3a45a3,_0x4ee1('0xc'));logger[_0x4ee1('0xd')](_0x4ee1('0xe'),_0x3a45a3,_0x4ee1('0xc'),JSON['stringify'](_0x33dbe6));if(_0x33dbe6[_0x4ee1('0xf')]){if(_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x10')]===0x1f4){logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3a45a3,_0x33dbe6[_0x4ee1('0xf')]['message']);return _0xdfe9c1(_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x12')]);}logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3a45a3,_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x12')]);return _0x293d5f(_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x12')]);}else{logger[_0x4ee1('0xb')]('Migration,\x20%s,\x20%s',_0x3a45a3,_0x4ee1('0xc'));_0x293d5f(_0x33dbe6[_0x4ee1('0x13')][_0x4ee1('0x12')]);}})[_0x4ee1('0x14')](function(_0x123c5e){logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3a45a3,_0x123c5e);_0xdfe9c1(_0x123c5e);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 4511825..7d8e880 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 _0xb1d3=['get','isAuthenticated','index','show','post','create','destroy','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','./network.controller'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb1d3,0xe8));var _0x3b1d=function(_0x5edeff,_0x53a244){_0x5edeff=_0x5edeff-0x0;var _0x487c5b=_0xb1d3[_0x5edeff];return _0x487c5b;};'use strict';var multer=require(_0x3b1d('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3b1d('0x1'));var router=express[_0x3b1d('0x2')]();var auth=require(_0x3b1d('0x3'));var interaction=require(_0x3b1d('0x4'));var config=require('../../config/environment');var controller=require(_0x3b1d('0x5'));router[_0x3b1d('0x6')]('/',auth[_0x3b1d('0x7')](),controller[_0x3b1d('0x8')]);router['get']('/:id',auth[_0x3b1d('0x7')](),controller[_0x3b1d('0x9')]);router[_0x3b1d('0xa')]('/',auth[_0x3b1d('0x7')](),controller[_0x3b1d('0xb')]);router['put']('/:id',auth[_0x3b1d('0x7')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3b1d('0xc')]);module[_0x3b1d('0xd')]=router; \ No newline at end of file +var _0xe5ad=['isAuthenticated','show','post','create','put','update','delete','destroy','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id'];(function(_0x2ac84e,_0x3d8931){var _0x481a04=function(_0x367b52){while(--_0x367b52){_0x2ac84e['push'](_0x2ac84e['shift']());}};_0x481a04(++_0x3d8931);}(_0xe5ad,0x158));var _0xde5a=function(_0x1fc62d,_0x329598){_0x1fc62d=_0x1fc62d-0x0;var _0x49dfc0=_0xe5ad[_0x1fc62d];return _0x49dfc0;};'use strict';var multer=require('multer');var util=require(_0xde5a('0x0'));var path=require(_0xde5a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xde5a('0x2')]();var auth=require(_0xde5a('0x3'));var interaction=require(_0xde5a('0x4'));var config=require(_0xde5a('0x5'));var controller=require('./network.controller');router[_0xde5a('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xde5a('0x7'),auth[_0xde5a('0x8')](),controller[_0xde5a('0x9')]);router[_0xde5a('0xa')]('/',auth[_0xde5a('0x8')](),controller[_0xde5a('0xb')]);router[_0xde5a('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xde5a('0xd')]);router[_0xde5a('0xe')](_0xde5a('0x7'),auth[_0xde5a('0x8')](),controller[_0xde5a('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index f68d830..ea037cf 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 _0xa728=['sequelize','exports','localnet','STRING'];(function(_0x4166b0,_0x3b5e5a){var _0x50b286=function(_0x494d11){while(--_0x494d11){_0x4166b0['push'](_0x4166b0['shift']());}};_0x50b286(++_0x3b5e5a);}(_0xa728,0x84));var _0x8a72=function(_0x4a71b6,_0x23120f){_0x4a71b6=_0x4a71b6-0x0;var _0x290de9=_0xa728[_0x4a71b6];return _0x290de9;};'use strict';var Sequelize=require(_0x8a72('0x0'));module[_0x8a72('0x1')]={'type':{'type':Sequelize['ENUM'](_0x8a72('0x2'),'externip')},'value':{'type':Sequelize[_0x8a72('0x3')]}}; \ No newline at end of file +var _0x5f4a=['exports','ENUM','STRING','sequelize'];(function(_0x163aaa,_0x3c4b11){var _0x4615b1=function(_0x22ae89){while(--_0x22ae89){_0x163aaa['push'](_0x163aaa['shift']());}};_0x4615b1(++_0x3c4b11);}(_0x5f4a,0x6b));var _0xa5f4=function(_0x2e0d20,_0x6fea31){_0x2e0d20=_0x2e0d20-0x0;var _0x4a25d7=_0x5f4a[_0x2e0d20];return _0x4a25d7;};'use strict';var Sequelize=require(_0xa5f4('0x0'));module[_0xa5f4('0x1')]={'type':{'type':Sequelize[_0xa5f4('0x2')]('localnet','externip')},'value':{'type':Sequelize[_0xa5f4('0x3')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index ef27a2b..ded3294 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 _0xac2b=['then','destroy','stack','name','send','index','Network','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','day','merge','where','filter','map','options','count','include','findAll','rows','show','params','includeAll','find','create','body','type','join','root','server/files/templates/network.ejs','utf8','render','format','toLowerCase','Reload','chan_sip.so','update','sequelize','transaction','readFileSync','writeFileSync','/etc/asterisk/sip_xcally_%s.conf','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','jayson/promise','client','http','info','Network,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save'];(function(_0x3ec072,_0x617d83){var _0x192614=function(_0x27111e){while(--_0x27111e){_0x3ec072['push'](_0x3ec072['shift']());}};_0x192614(++_0x617d83);}(_0xac2b,0x159));var _0xbac2=function(_0x2b3c9d,_0x1c8c0c){_0x2b3c9d=_0x2b3c9d-0x0;var _0x4b8037=_0xac2b[_0x2b3c9d];return _0x4b8037;};'use strict';var pdf=require(_0xbac2('0x0'));var emlformat=require(_0xbac2('0x1'));var rimraf=require(_0xbac2('0x2'));var zipdir=require(_0xbac2('0x3'));var jsonpatch=require(_0xbac2('0x4'));var rp=require(_0xbac2('0x5'));var moment=require(_0xbac2('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xbac2('0x7'));var util=require('util');var path=require(_0xbac2('0x8'));var sox=require(_0xbac2('0x9'));var csv=require(_0xbac2('0xa'));var ejs=require(_0xbac2('0xb'));var fs=require('fs');var _=require(_0xbac2('0xc'));var squel=require(_0xbac2('0xd'));var crypto=require(_0xbac2('0xe'));var jsforce=require(_0xbac2('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbac2('0xa'));var querystring=require(_0xbac2('0x10'));var Papa=require(_0xbac2('0x11'));var Redis=require('ioredis');var qs=require(_0xbac2('0x12'));var logger=require(_0xbac2('0x13'))('api');var utils=require(_0xbac2('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0xbac2('0x15'));var client=jayson[_0xbac2('0x16')][_0xbac2('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x106bcc,_0x182641,_0x2cfa5,_0x52ae6e){return new BPromise(function(_0x457b34,_0x18c806){var _0x371036=_0x52ae6e||client;return _0x371036['request'](_0x106bcc,_0x2cfa5)['then'](function(_0x4cf1d7){logger[_0xbac2('0x18')](_0xbac2('0x19'),_0x182641,_0xbac2('0x1a'));logger[_0xbac2('0x1b')]('Network,\x20%s,\x20%s,\x20%s',_0x182641,_0xbac2('0x1a'),JSON['stringify'](_0x4cf1d7));if(_0x4cf1d7[_0xbac2('0x1c')]){if(_0x4cf1d7[_0xbac2('0x1c')][_0xbac2('0x1d')]===0x1f4){logger[_0xbac2('0x1c')](_0xbac2('0x19'),_0x182641,_0x4cf1d7['error'][_0xbac2('0x1e')]);return _0x18c806(_0x4cf1d7['error'][_0xbac2('0x1e')]);}logger[_0xbac2('0x1c')](_0xbac2('0x19'),_0x182641,_0x4cf1d7['error'][_0xbac2('0x1e')]);return _0x457b34(_0x4cf1d7[_0xbac2('0x1c')][_0xbac2('0x1e')]);}else{logger[_0xbac2('0x18')](_0xbac2('0x19'),_0x182641,_0xbac2('0x1a'));_0x457b34(_0x4cf1d7[_0xbac2('0x1f')][_0xbac2('0x1e')]);}})[_0xbac2('0x20')](function(_0x108725){logger[_0xbac2('0x1c')](_0xbac2('0x19'),_0x182641,_0x108725);_0x18c806(_0x108725);});});}function respondWithStatusCode(_0x790f29,_0x1663ca){_0x1663ca=_0x1663ca||0xcc;return function(_0x38f139){if(_0x38f139){return _0x790f29[_0xbac2('0x21')](_0x1663ca);}return _0x790f29[_0xbac2('0x22')](_0x1663ca)[_0xbac2('0x23')]();};}function respondWithResult(_0x378daf,_0x14643e){_0x14643e=_0x14643e||0xc8;return function(_0x3e6a07){if(_0x3e6a07){return _0x378daf['status'](_0x14643e)[_0xbac2('0x24')](_0x3e6a07);}};}function respondWithFilteredResult(_0x5268e2,_0x38f8fa){return function(_0x526548){if(_0x526548){var _0x4c03a0=_0x526548['count'],_0x507205=_0x38f8fa[_0xbac2('0x25')],_0x2fddc3=_0x38f8fa['offset']+_0x38f8fa[_0xbac2('0x26')],_0x5354bd;if(_0x2fddc3>=_0x4c03a0){_0x2fddc3=_0x4c03a0;_0x5354bd=0xc8;}else{_0x5354bd=0xce;}_0x5268e2[_0xbac2('0x22')](_0x5354bd);return _0x5268e2[_0xbac2('0x27')](_0xbac2('0x28'),_0x507205+'-'+_0x2fddc3+'/'+_0x4c03a0)['json'](_0x526548);}return null;};}function patchUpdates(_0x1389ec){return function(_0x5c46fe){try{jsonpatch['apply'](_0x5c46fe,_0x1389ec,!![]);}catch(_0x4c1cbd){return BPromise[_0xbac2('0x29')](_0x4c1cbd);}return _0x5c46fe[_0xbac2('0x2a')]();};}function saveUpdates(_0x3a12a3,_0x5a3b81){return function(_0x4fb4e7){if(_0x4fb4e7){return _0x4fb4e7['update'](_0x3a12a3)[_0xbac2('0x2b')](function(_0x3b4178){return _0x3b4178;});}return null;};}function removeEntity(_0x5cda48,_0x235f73){return function(_0x415fa3){if(_0x415fa3){return _0x415fa3[_0xbac2('0x2c')]()['then'](function(){_0x5cda48['status'](0xcc)[_0xbac2('0x23')]();});}};}function handleEntityNotFound(_0xc754e1,_0x259f33){return function(_0x36ec54){if(!_0x36ec54){_0xc754e1[_0xbac2('0x21')](0x194);}return _0x36ec54;};}function handleError(_0x891cf9,_0x35d139){_0x35d139=_0x35d139||0x1f4;return function(_0x3d18cc){logger[_0xbac2('0x1c')](_0x3d18cc[_0xbac2('0x2d')]);if(_0x3d18cc[_0xbac2('0x2e')]){delete _0x3d18cc[_0xbac2('0x2e')];}_0x891cf9[_0xbac2('0x22')](_0x35d139)[_0xbac2('0x2f')](_0x3d18cc);};}exports[_0xbac2('0x30')]=function(_0x3c0a55,_0x9a1f88){var _0x35a3b9={},_0x20451c={},_0x1b2efc={'count':0x0,'rows':[]};var _0x87e319=db[_0xbac2('0x31')][_0xbac2('0x32')];_0x20451c[_0xbac2('0x33')]=_[_0xbac2('0x34')](_0x87e319);var _0x2902e6={'dateStart':_0x3c0a55[_0xbac2('0x35')][_0xbac2('0x36')],'dateEnd':_0x3c0a55[_0xbac2('0x35')]['dateEnd']};delete _0x3c0a55[_0xbac2('0x35')][_0xbac2('0x36')];delete _0x3c0a55['query'][_0xbac2('0x37')];_0x20451c[_0xbac2('0x35')]=_[_0xbac2('0x34')](_0x3c0a55[_0xbac2('0x35')]);_0x20451c[_0xbac2('0x38')]=_['intersection'](_0x20451c[_0xbac2('0x33')],_0x20451c[_0xbac2('0x35')]);_0x35a3b9[_0xbac2('0x39')]=_[_0xbac2('0x3a')](_0x20451c['model'],qs['fields'](_0x3c0a55['query'][_0xbac2('0x3b')]));_0x35a3b9[_0xbac2('0x39')]=_0x35a3b9[_0xbac2('0x39')][_0xbac2('0x3c')]?_0x35a3b9[_0xbac2('0x39')]:_0x20451c[_0xbac2('0x33')];if(!_0x3c0a55[_0xbac2('0x35')][_0xbac2('0x3d')](_0xbac2('0x3e'))){_0x35a3b9[_0xbac2('0x26')]=qs[_0xbac2('0x26')](_0x3c0a55['query'][_0xbac2('0x26')]);_0x35a3b9[_0xbac2('0x25')]=qs[_0xbac2('0x25')](_0x3c0a55['query'][_0xbac2('0x25')]);}_0x35a3b9[_0xbac2('0x3f')]=qs[_0xbac2('0x40')](_0x3c0a55[_0xbac2('0x35')][_0xbac2('0x40')]);_0x35a3b9['where']=qs[_0xbac2('0x38')](_['pick'](_0x3c0a55[_0xbac2('0x35')],_0x20451c[_0xbac2('0x38')]));if(_0x2902e6[_0xbac2('0x36')]){if(_0x2902e6[_0xbac2('0x37')]){_0x2902e6[_0xbac2('0x37')]=moment(_0x2902e6[_0xbac2('0x37')])['add'](0x1,'day');}else{_0x2902e6[_0xbac2('0x37')]=moment(_0x2902e6[_0xbac2('0x36')])['add'](0x1,_0xbac2('0x41'));}_[_0xbac2('0x42')](_0x35a3b9[_0xbac2('0x43')],{'createdAt':{'$gte':_0x2902e6[_0xbac2('0x36')],'$lte':_0x2902e6[_0xbac2('0x37')]}});}if(_0x3c0a55[_0xbac2('0x35')][_0xbac2('0x44')]){_0x35a3b9[_0xbac2('0x43')]=_[_0xbac2('0x42')](_0x35a3b9[_0xbac2('0x43')],{'$or':_[_0xbac2('0x45')](_0x35a3b9[_0xbac2('0x39')],function(_0x11d1c8){var _0x771daa={};_0x771daa[_0x11d1c8]={'$like':'%'+_0x3c0a55['query'][_0xbac2('0x44')]+'%'};return _0x771daa;})});}_0x35a3b9=_[_0xbac2('0x42')]({},_0x35a3b9,_0x3c0a55[_0xbac2('0x46')]);var _0x30a22a={'where':_0x35a3b9['where']};return db['Network'][_0xbac2('0x47')](_0x30a22a)[_0xbac2('0x2b')](function(_0x1efd4e){_0x1b2efc[_0xbac2('0x47')]=_0x1efd4e;if(_0x3c0a55[_0xbac2('0x35')]['includeAll']){_0x35a3b9[_0xbac2('0x48')]=[{'all':!![]}];}return db[_0xbac2('0x31')][_0xbac2('0x49')](_0x35a3b9);})[_0xbac2('0x2b')](function(_0x4195ae){_0x1b2efc[_0xbac2('0x4a')]=_0x4195ae;return _0x1b2efc;})['then'](respondWithFilteredResult(_0x9a1f88,_0x35a3b9))[_0xbac2('0x20')](handleError(_0x9a1f88,null));};exports[_0xbac2('0x4b')]=function(_0x5a1c0b,_0x85071b){var _0x426b75={'raw':!![],'where':{'id':_0x5a1c0b[_0xbac2('0x4c')]['id']}},_0x3cecef={};_0x3cecef[_0xbac2('0x33')]=_[_0xbac2('0x34')](db['Network'][_0xbac2('0x32')]);_0x3cecef['query']=_['keys'](_0x5a1c0b[_0xbac2('0x35')]);_0x3cecef['filters']=_[_0xbac2('0x3a')](_0x3cecef[_0xbac2('0x33')],_0x3cecef[_0xbac2('0x35')]);_0x426b75[_0xbac2('0x39')]=_[_0xbac2('0x3a')](_0x3cecef[_0xbac2('0x33')],qs[_0xbac2('0x3b')](_0x5a1c0b['query']['fields']));_0x426b75['attributes']=_0x426b75[_0xbac2('0x39')][_0xbac2('0x3c')]?_0x426b75[_0xbac2('0x39')]:_0x3cecef['model'];if(_0x5a1c0b['query'][_0xbac2('0x4d')]){_0x426b75['include']=[{'all':!![]}];}_0x426b75=_[_0xbac2('0x42')]({},_0x426b75,_0x5a1c0b[_0xbac2('0x46')]);return db[_0xbac2('0x31')][_0xbac2('0x4e')](_0x426b75)['then'](handleEntityNotFound(_0x85071b,null))['then'](respondWithResult(_0x85071b,null))['catch'](handleError(_0x85071b,null));};exports['create']=function(_0x23f090,_0x2db1be,_0x5ddfc1){var _0x370b5b;return db['sequelize']['transaction'](function(_0x5313cf){return db[_0xbac2('0x31')][_0xbac2('0x4f')](_0x23f090[_0xbac2('0x50')],{'raw':!![]})[_0xbac2('0x2b')](function(_0x280230){_0x370b5b=_0x280230;return db[_0xbac2('0x31')]['findAll']({'where':{'type':_0x23f090[_0xbac2('0x50')][_0xbac2('0x51')]},'raw':!![]});})[_0xbac2('0x2b')](function(_0x130b3e){var _0xccfa6d=fs['readFileSync'](path[_0xbac2('0x52')](config[_0xbac2('0x53')],_0xbac2('0x54')),_0xbac2('0x55'));var _0x3ce13e=ejs[_0xbac2('0x56')](_0xccfa6d,{'networks':_0x130b3e||[]});fs['writeFileSync'](util[_0xbac2('0x57')]('/etc/asterisk/sip_xcally_%s.conf',_0x23f090[_0xbac2('0x50')]['type'][_0xbac2('0x58')]()),_0x3ce13e);})[_0xbac2('0x2b')](function(){return respondWithRpcPromise(_0xbac2('0x59'),_0xbac2('0x4f'),{'module':_0xbac2('0x5a')});})[_0xbac2('0x2b')](function(){return _0x370b5b;});})[_0xbac2('0x2b')](respondWithResult(_0x2db1be,0xc9))[_0xbac2('0x20')](handleError(_0x2db1be,null));};exports[_0xbac2('0x5b')]=function(_0x242820,_0x4929c0,_0x1e5bca){var _0x377e96;return db[_0xbac2('0x5c')][_0xbac2('0x5d')](function(_0x3ea7d4){return db['Network'][_0xbac2('0x4e')]({'where':{'id':_0x242820['params']['id']}})[_0xbac2('0x2b')](handleEntityNotFound(_0x4929c0,null))[_0xbac2('0x2b')](saveUpdates(_0x242820[_0xbac2('0x50')],null))[_0xbac2('0x2b')](function(_0x38f081){if(_0x38f081){_0x377e96=_0x38f081;return db['Network'][_0xbac2('0x49')]({'where':{'type':_0x377e96[_0xbac2('0x51')]},'raw':!![]});}return null;})[_0xbac2('0x2b')](function(_0x3e66a6){if(_0x3e66a6){var _0x8ce5b3=fs[_0xbac2('0x5e')](path[_0xbac2('0x52')](config[_0xbac2('0x53')],'server/files/templates/network.ejs'),_0xbac2('0x55'));var _0x479741=ejs[_0xbac2('0x56')](_0x8ce5b3,{'networks':_0x3e66a6||[]});fs[_0xbac2('0x5f')](util[_0xbac2('0x57')](_0xbac2('0x60'),_0x377e96[_0xbac2('0x51')][_0xbac2('0x58')]()),_0x479741);return respondWithRpcPromise(_0xbac2('0x59'),_0xbac2('0x5b'),{'module':_0xbac2('0x5a')});}return null;})[_0xbac2('0x2b')](function(_0x11c315){if(_0x11c315){return _0x377e96;}return null;});})[_0xbac2('0x2b')](respondWithResult(_0x4929c0,null))[_0xbac2('0x20')](handleError(_0x4929c0,null));};exports['destroy']=function(_0x2831ef,_0x5a2c55,_0x342864){var _0x28cebd;return db[_0xbac2('0x31')][_0xbac2('0x4e')]({'where':{'id':_0x2831ef[_0xbac2('0x4c')]['id']}})[_0xbac2('0x2b')](function(_0x1711a5){_0x28cebd=_0x1711a5;return _0x1711a5;})[_0xbac2('0x2b')](handleEntityNotFound(_0x5a2c55,null))[_0xbac2('0x2b')](removeEntity(_0x5a2c55,null))[_0xbac2('0x2b')](function(){if(_0x28cebd){return db[_0xbac2('0x31')][_0xbac2('0x49')]({'where':{'type':_0x28cebd['type']},'raw':!![]});}})[_0xbac2('0x2b')](function(_0x16ef01){if(_0x16ef01){var _0x519dea=fs[_0xbac2('0x5e')](path['join'](config['root'],'server/files/templates/network.ejs'),_0xbac2('0x55'));var _0x556c0f=ejs[_0xbac2('0x56')](_0x519dea,{'networks':_0x16ef01||[]});fs['writeFileSync'](util[_0xbac2('0x57')]('/etc/asterisk/sip_xcally_%s.conf',_0x28cebd[_0xbac2('0x51')][_0xbac2('0x58')]()),_0x556c0f);return respondWithRpcPromise('Reload','destroy',{'module':_0xbac2('0x5a')});}})[_0xbac2('0x20')](handleError(_0x5a2c55,null));}; \ No newline at end of file +var _0x274e=['fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','desk.js','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','count','offset','limit','set','apply','reject','save','end','stack','name','send','Network','rawAttributes','model','query','dateEnd','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','add','day','dateStart','merge','where','filter','map','options','includeAll','include','findAll','rows','find','create','sequelize','transaction','type','readFileSync','join','root','writeFileSync','format','/etc/asterisk/sip_xcally_%s.conf','Reload','chan_sip.so','update','body','utf8','render','toLowerCase','destroy','params','eml-format','rimraf'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x274e,0x1c0));var _0xe274=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x274e[_0x334841];return _0x5beb4b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe274('0x0'));var rimraf=require(_0xe274('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe274('0x2'));var rp=require('request-promise');var moment=require(_0xe274('0x3'));var BPromise=require(_0xe274('0x4'));var Mustache=require(_0xe274('0x5'));var util=require('util');var path=require(_0xe274('0x6'));var sox=require('sox');var csv=require(_0xe274('0x7'));var ejs=require(_0xe274('0x8'));var fs=require('fs');var _=require(_0xe274('0x9'));var squel=require('squel');var crypto=require(_0xe274('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe274('0xb'));var toCsv=require(_0xe274('0x7'));var querystring=require('querystring');var Papa=require(_0xe274('0xc'));var Redis=require('ioredis');var qs=require(_0xe274('0xd'));var logger=require(_0xe274('0xe'))('api');var utils=require('../../config/utils');var config=require(_0xe274('0xf'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xe274('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x335017,_0x29f72c,_0x200f50,_0x83ca94){return new BPromise(function(_0x252357,_0x45100f){var _0x3687dd=_0x83ca94||client;return _0x3687dd[_0xe274('0x11')](_0x335017,_0x200f50)[_0xe274('0x12')](function(_0x85a5b0){logger[_0xe274('0x13')](_0xe274('0x14'),_0x29f72c,_0xe274('0x15'));logger[_0xe274('0x16')](_0xe274('0x17'),_0x29f72c,_0xe274('0x15'),JSON[_0xe274('0x18')](_0x85a5b0));if(_0x85a5b0[_0xe274('0x19')]){if(_0x85a5b0['error'][_0xe274('0x1a')]===0x1f4){logger['error'](_0xe274('0x14'),_0x29f72c,_0x85a5b0[_0xe274('0x19')][_0xe274('0x1b')]);return _0x45100f(_0x85a5b0[_0xe274('0x19')][_0xe274('0x1b')]);}logger[_0xe274('0x19')]('Network,\x20%s,\x20%s',_0x29f72c,_0x85a5b0[_0xe274('0x19')][_0xe274('0x1b')]);return _0x252357(_0x85a5b0[_0xe274('0x19')]['message']);}else{logger['info'](_0xe274('0x14'),_0x29f72c,_0xe274('0x15'));_0x252357(_0x85a5b0['result'][_0xe274('0x1b')]);}})[_0xe274('0x1c')](function(_0x1adbcf){logger[_0xe274('0x19')]('Network,\x20%s,\x20%s',_0x29f72c,_0x1adbcf);_0x45100f(_0x1adbcf);});});}function respondWithStatusCode(_0x3a4c52,_0x4ba9a7){_0x4ba9a7=_0x4ba9a7||0xcc;return function(_0x46c9d2){if(_0x46c9d2){return _0x3a4c52[_0xe274('0x1d')](_0x4ba9a7);}return _0x3a4c52[_0xe274('0x1e')](_0x4ba9a7)['end']();};}function respondWithResult(_0x59f262,_0x263012){_0x263012=_0x263012||0xc8;return function(_0x5c8703){if(_0x5c8703){return _0x59f262[_0xe274('0x1e')](_0x263012)[_0xe274('0x1f')](_0x5c8703);}};}function respondWithFilteredResult(_0x2699e4,_0x577d7a){return function(_0x36c32f){if(_0x36c32f){var _0x20f665=_0x36c32f[_0xe274('0x20')],_0x117d53=_0x577d7a['offset'],_0x3e34c4=_0x577d7a[_0xe274('0x21')]+_0x577d7a[_0xe274('0x22')],_0x343fc8;if(_0x3e34c4>=_0x20f665){_0x3e34c4=_0x20f665;_0x343fc8=0xc8;}else{_0x343fc8=0xce;}_0x2699e4[_0xe274('0x1e')](_0x343fc8);return _0x2699e4[_0xe274('0x23')]('Content-Range',_0x117d53+'-'+_0x3e34c4+'/'+_0x20f665)[_0xe274('0x1f')](_0x36c32f);}return null;};}function patchUpdates(_0x579446){return function(_0x30c1a9){try{jsonpatch[_0xe274('0x24')](_0x30c1a9,_0x579446,!![]);}catch(_0x10b2a1){return BPromise[_0xe274('0x25')](_0x10b2a1);}return _0x30c1a9[_0xe274('0x26')]();};}function saveUpdates(_0x400025,_0x7ae4bc){return function(_0x22b856){if(_0x22b856){return _0x22b856['update'](_0x400025)['then'](function(_0x4b7b75){return _0x4b7b75;});}return null;};}function removeEntity(_0x49f62b,_0x44417f){return function(_0x2e59c0){if(_0x2e59c0){return _0x2e59c0['destroy']()['then'](function(){_0x49f62b[_0xe274('0x1e')](0xcc)[_0xe274('0x27')]();});}};}function handleEntityNotFound(_0x540338,_0x4e8c1b){return function(_0x11856a){if(!_0x11856a){_0x540338[_0xe274('0x1d')](0x194);}return _0x11856a;};}function handleError(_0x126223,_0x327cfb){_0x327cfb=_0x327cfb||0x1f4;return function(_0x464adb){logger[_0xe274('0x19')](_0x464adb[_0xe274('0x28')]);if(_0x464adb['name']){delete _0x464adb[_0xe274('0x29')];}_0x126223[_0xe274('0x1e')](_0x327cfb)[_0xe274('0x2a')](_0x464adb);};}exports['index']=function(_0x5b088e,_0x594685){var _0x5cb26f={},_0x1473c1={},_0x574a90={'count':0x0,'rows':[]};var _0x514bc2=db[_0xe274('0x2b')][_0xe274('0x2c')];_0x1473c1[_0xe274('0x2d')]=_['keys'](_0x514bc2);var _0x437f77={'dateStart':_0x5b088e[_0xe274('0x2e')]['dateStart'],'dateEnd':_0x5b088e[_0xe274('0x2e')][_0xe274('0x2f')]};delete _0x5b088e['query']['dateStart'];delete _0x5b088e['query']['dateEnd'];_0x1473c1[_0xe274('0x2e')]=_[_0xe274('0x30')](_0x5b088e[_0xe274('0x2e')]);_0x1473c1[_0xe274('0x31')]=_[_0xe274('0x32')](_0x1473c1[_0xe274('0x2d')],_0x1473c1[_0xe274('0x2e')]);_0x5cb26f[_0xe274('0x33')]=_[_0xe274('0x32')](_0x1473c1['model'],qs['fields'](_0x5b088e[_0xe274('0x2e')][_0xe274('0x34')]));_0x5cb26f[_0xe274('0x33')]=_0x5cb26f[_0xe274('0x33')][_0xe274('0x35')]?_0x5cb26f[_0xe274('0x33')]:_0x1473c1['model'];if(!_0x5b088e[_0xe274('0x2e')][_0xe274('0x36')](_0xe274('0x37'))){_0x5cb26f[_0xe274('0x22')]=qs['limit'](_0x5b088e['query'][_0xe274('0x22')]);_0x5cb26f[_0xe274('0x21')]=qs[_0xe274('0x21')](_0x5b088e['query'][_0xe274('0x21')]);}_0x5cb26f['order']=qs[_0xe274('0x38')](_0x5b088e[_0xe274('0x2e')][_0xe274('0x38')]);_0x5cb26f['where']=qs[_0xe274('0x31')](_[_0xe274('0x39')](_0x5b088e['query'],_0x1473c1[_0xe274('0x31')]));if(_0x437f77['dateStart']){if(_0x437f77[_0xe274('0x2f')]){_0x437f77[_0xe274('0x2f')]=moment(_0x437f77[_0xe274('0x2f')])[_0xe274('0x3a')](0x1,_0xe274('0x3b'));}else{_0x437f77[_0xe274('0x2f')]=moment(_0x437f77[_0xe274('0x3c')])[_0xe274('0x3a')](0x1,_0xe274('0x3b'));}_[_0xe274('0x3d')](_0x5cb26f[_0xe274('0x3e')],{'createdAt':{'$gte':_0x437f77[_0xe274('0x3c')],'$lte':_0x437f77[_0xe274('0x2f')]}});}if(_0x5b088e[_0xe274('0x2e')][_0xe274('0x3f')]){_0x5cb26f[_0xe274('0x3e')]=_[_0xe274('0x3d')](_0x5cb26f['where'],{'$or':_[_0xe274('0x40')](_0x5cb26f['attributes'],function(_0xb2c42a){var _0x2e1649={};_0x2e1649[_0xb2c42a]={'$like':'%'+_0x5b088e[_0xe274('0x2e')][_0xe274('0x3f')]+'%'};return _0x2e1649;})});}_0x5cb26f=_[_0xe274('0x3d')]({},_0x5cb26f,_0x5b088e[_0xe274('0x41')]);var _0x559f37={'where':_0x5cb26f[_0xe274('0x3e')]};return db[_0xe274('0x2b')][_0xe274('0x20')](_0x559f37)[_0xe274('0x12')](function(_0x5f100d){_0x574a90[_0xe274('0x20')]=_0x5f100d;if(_0x5b088e[_0xe274('0x2e')][_0xe274('0x42')]){_0x5cb26f[_0xe274('0x43')]=[{'all':!![]}];}return db['Network'][_0xe274('0x44')](_0x5cb26f);})[_0xe274('0x12')](function(_0x4c0ca1){_0x574a90[_0xe274('0x45')]=_0x4c0ca1;return _0x574a90;})[_0xe274('0x12')](respondWithFilteredResult(_0x594685,_0x5cb26f))[_0xe274('0x1c')](handleError(_0x594685,null));};exports['show']=function(_0x4857dd,_0x47907d){var _0x56b891={'raw':!![],'where':{'id':_0x4857dd['params']['id']}},_0x3b50a2={};_0x3b50a2['model']=_[_0xe274('0x30')](db[_0xe274('0x2b')][_0xe274('0x2c')]);_0x3b50a2[_0xe274('0x2e')]=_[_0xe274('0x30')](_0x4857dd[_0xe274('0x2e')]);_0x3b50a2[_0xe274('0x31')]=_[_0xe274('0x32')](_0x3b50a2[_0xe274('0x2d')],_0x3b50a2[_0xe274('0x2e')]);_0x56b891['attributes']=_[_0xe274('0x32')](_0x3b50a2[_0xe274('0x2d')],qs['fields'](_0x4857dd[_0xe274('0x2e')][_0xe274('0x34')]));_0x56b891[_0xe274('0x33')]=_0x56b891[_0xe274('0x33')][_0xe274('0x35')]?_0x56b891['attributes']:_0x3b50a2[_0xe274('0x2d')];if(_0x4857dd['query'][_0xe274('0x42')]){_0x56b891['include']=[{'all':!![]}];}_0x56b891=_[_0xe274('0x3d')]({},_0x56b891,_0x4857dd[_0xe274('0x41')]);return db[_0xe274('0x2b')][_0xe274('0x46')](_0x56b891)['then'](handleEntityNotFound(_0x47907d,null))['then'](respondWithResult(_0x47907d,null))['catch'](handleError(_0x47907d,null));};exports[_0xe274('0x47')]=function(_0x1644d0,_0x4fc10f,_0xddd6b8){var _0x3a41dc;return db[_0xe274('0x48')][_0xe274('0x49')](function(_0x146a22){return db[_0xe274('0x2b')][_0xe274('0x47')](_0x1644d0['body'],{'raw':!![]})[_0xe274('0x12')](function(_0x2ce9b8){_0x3a41dc=_0x2ce9b8;return db[_0xe274('0x2b')][_0xe274('0x44')]({'where':{'type':_0x1644d0['body'][_0xe274('0x4a')]},'raw':!![]});})[_0xe274('0x12')](function(_0xe1add5){var _0x587e7c=fs[_0xe274('0x4b')](path[_0xe274('0x4c')](config[_0xe274('0x4d')],'server/files/templates/network.ejs'),'utf8');var _0x4f4685=ejs['render'](_0x587e7c,{'networks':_0xe1add5||[]});fs[_0xe274('0x4e')](util[_0xe274('0x4f')](_0xe274('0x50'),_0x1644d0['body'][_0xe274('0x4a')]['toLowerCase']()),_0x4f4685);})[_0xe274('0x12')](function(){return respondWithRpcPromise(_0xe274('0x51'),_0xe274('0x47'),{'module':_0xe274('0x52')});})[_0xe274('0x12')](function(){return _0x3a41dc;});})[_0xe274('0x12')](respondWithResult(_0x4fc10f,0xc9))[_0xe274('0x1c')](handleError(_0x4fc10f,null));};exports[_0xe274('0x53')]=function(_0x2a1fc9,_0xfbd3be,_0x3449ae){var _0x1c9fd9;return db[_0xe274('0x48')][_0xe274('0x49')](function(_0x2e984b){return db[_0xe274('0x2b')][_0xe274('0x46')]({'where':{'id':_0x2a1fc9['params']['id']}})[_0xe274('0x12')](handleEntityNotFound(_0xfbd3be,null))[_0xe274('0x12')](saveUpdates(_0x2a1fc9[_0xe274('0x54')],null))[_0xe274('0x12')](function(_0x45eba2){if(_0x45eba2){_0x1c9fd9=_0x45eba2;return db[_0xe274('0x2b')][_0xe274('0x44')]({'where':{'type':_0x1c9fd9[_0xe274('0x4a')]},'raw':!![]});}return null;})[_0xe274('0x12')](function(_0x1a1a15){if(_0x1a1a15){var _0x1bcb12=fs[_0xe274('0x4b')](path[_0xe274('0x4c')](config[_0xe274('0x4d')],'server/files/templates/network.ejs'),_0xe274('0x55'));var _0x194a58=ejs[_0xe274('0x56')](_0x1bcb12,{'networks':_0x1a1a15||[]});fs['writeFileSync'](util[_0xe274('0x4f')](_0xe274('0x50'),_0x1c9fd9[_0xe274('0x4a')][_0xe274('0x57')]()),_0x194a58);return respondWithRpcPromise(_0xe274('0x51'),_0xe274('0x53'),{'module':_0xe274('0x52')});}return null;})[_0xe274('0x12')](function(_0x1ee353){if(_0x1ee353){return _0x1c9fd9;}return null;});})[_0xe274('0x12')](respondWithResult(_0xfbd3be,null))[_0xe274('0x1c')](handleError(_0xfbd3be,null));};exports[_0xe274('0x58')]=function(_0x4f1418,_0x4f2645,_0x5822da){var _0x1a8028;return db[_0xe274('0x2b')]['find']({'where':{'id':_0x4f1418[_0xe274('0x59')]['id']}})[_0xe274('0x12')](function(_0x3d9a85){_0x1a8028=_0x3d9a85;return _0x3d9a85;})['then'](handleEntityNotFound(_0x4f2645,null))['then'](removeEntity(_0x4f2645,null))['then'](function(){if(_0x1a8028){return db[_0xe274('0x2b')][_0xe274('0x44')]({'where':{'type':_0x1a8028[_0xe274('0x4a')]},'raw':!![]});}})[_0xe274('0x12')](function(_0x1c6db0){if(_0x1c6db0){var _0x376885=fs['readFileSync'](path['join'](config[_0xe274('0x4d')],'server/files/templates/network.ejs'),'utf8');var _0x1d8351=ejs[_0xe274('0x56')](_0x376885,{'networks':_0x1c6db0||[]});fs[_0xe274('0x4e')](util[_0xe274('0x4f')](_0xe274('0x50'),_0x1a8028[_0xe274('0x4a')][_0xe274('0x57')]()),_0x1d8351);return respondWithRpcPromise(_0xe274('0x51'),_0xe274('0x58'),{'module':'chan_sip.so'});}})[_0xe274('0x1c')](handleError(_0x4f2645,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 2ef7e7a..4760d3d 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 _0x226d=['moment','bluebird','./network.attributes','exports','define','Network','network','lodash','util','../../config/logger','api'];(function(_0x18d879,_0x566761){var _0x14ffff=function(_0x3520cd){while(--_0x3520cd){_0x18d879['push'](_0x18d879['shift']());}};_0x14ffff(++_0x566761);}(_0x226d,0xac));var _0xd226=function(_0x131df9,_0x29a4ea){_0x131df9=_0x131df9-0x0;var _0x3338f5=_0x226d[_0x131df9];return _0x3338f5;};'use strict';var _=require(_0xd226('0x0'));var util=require(_0xd226('0x1'));var logger=require(_0xd226('0x2'))(_0xd226('0x3'));var moment=require(_0xd226('0x4'));var BPromise=require(_0xd226('0x5'));var rp=require('request-promise');var attributes=require(_0xd226('0x6'));module[_0xd226('0x7')]=function(_0x25da7c,_0x4dc59a){return _0x25da7c[_0xd226('0x8')](_0xd226('0x9'),attributes,{'tableName':_0xd226('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae72=['define','network','lodash','api','moment','bluebird','request-promise'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xae72,0x1de));var _0x2ae7=function(_0x216af3,_0x1b2340){_0x216af3=_0x216af3-0x0;var _0x421227=_0xae72[_0x216af3];return _0x421227;};'use strict';var _=require(_0x2ae7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2ae7('0x1'));var moment=require(_0x2ae7('0x2'));var BPromise=require(_0x2ae7('0x3'));var rp=require(_0x2ae7('0x4'));var attributes=require('./network.attributes');module['exports']=function(_0x460084,_0x594cf4){return _0x460084[_0x2ae7('0x5')]('Network',attributes,{'tableName':_0x2ae7('0x6'),'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 38c1a05..ac1f4f8 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 _0x5fd1=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','Network,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash'];(function(_0x3b656f,_0x572771){var _0x1a2fba=function(_0x5a9159){while(--_0x5a9159){_0x3b656f['push'](_0x3b656f['shift']());}};_0x1a2fba(++_0x572771);}(_0x5fd1,0x155));var _0x15fd=function(_0x253d7b,_0x24d619){_0x253d7b=_0x253d7b-0x0;var _0x3f6ade=_0x5fd1[_0x253d7b];return _0x3f6ade;};'use strict';var _=require(_0x15fd('0x0'));var util=require('util');var moment=require(_0x15fd('0x1'));var BPromise=require(_0x15fd('0x2'));var rs=require(_0x15fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x15fd('0x4'));var logger=require(_0x15fd('0x5'))(_0x15fd('0x6'));var config=require('../../config/environment');var jayson=require(_0x15fd('0x7'));var client=jayson[_0x15fd('0x8')][_0x15fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e88bf,_0x225728,_0x534e63){return new BPromise(function(_0x210e90,_0x1ee117){return client[_0x15fd('0xa')](_0x2e88bf,_0x534e63)['then'](function(_0x2d2fbb){logger['info'](_0x15fd('0xb'),_0x225728,_0x15fd('0xc'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x225728,'request\x20sent',JSON[_0x15fd('0xd')](_0x2d2fbb));if(_0x2d2fbb[_0x15fd('0xe')]){if(_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0xf')]===0x1f4){logger[_0x15fd('0xe')](_0x15fd('0xb'),_0x225728,_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);return _0x1ee117(_0x2d2fbb[_0x15fd('0xe')]['message']);}logger['error']('Network,\x20%s,\x20%s',_0x225728,_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);return _0x210e90(_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);}else{logger[_0x15fd('0x11')](_0x15fd('0xb'),_0x225728,_0x15fd('0xc'));_0x210e90(_0x2d2fbb[_0x15fd('0x12')]['message']);}})['catch'](function(_0x25f139){logger['error'](_0x15fd('0xb'),_0x225728,_0x25f139);_0x1ee117(_0x25f139);});});} \ No newline at end of file +var _0xd101=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x17bca2,_0x3d6e0c){var _0x514f80=function(_0x2eaceb){while(--_0x2eaceb){_0x17bca2['push'](_0x17bca2['shift']());}};_0x514f80(++_0x3d6e0c);}(_0xd101,0xc1));var _0x1d10=function(_0x106893,_0x2bf591){_0x106893=_0x106893-0x0;var _0x254e3b=_0xd101[_0x106893];return _0x254e3b;};'use strict';var _=require(_0x1d10('0x0'));var util=require('util');var moment=require(_0x1d10('0x1'));var BPromise=require(_0x1d10('0x2'));var rs=require(_0x1d10('0x3'));var fs=require('fs');var Redis=require(_0x1d10('0x4'));var db=require(_0x1d10('0x5'))['db'];var utils=require(_0x1d10('0x6'));var logger=require(_0x1d10('0x7'))(_0x1d10('0x8'));var config=require('../../config/environment');var jayson=require(_0x1d10('0x9'));var client=jayson[_0x1d10('0xa')][_0x1d10('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27d569,_0xb9e08,_0x36335e){return new BPromise(function(_0x6d6def,_0x43df2c){return client[_0x1d10('0xc')](_0x27d569,_0x36335e)[_0x1d10('0xd')](function(_0xf7926b){logger[_0x1d10('0xe')](_0x1d10('0xf'),_0xb9e08,_0x1d10('0x10'));logger[_0x1d10('0x11')](_0x1d10('0x12'),_0xb9e08,_0x1d10('0x10'),JSON['stringify'](_0xf7926b));if(_0xf7926b[_0x1d10('0x13')]){if(_0xf7926b[_0x1d10('0x13')][_0x1d10('0x14')]===0x1f4){logger[_0x1d10('0x13')](_0x1d10('0xf'),_0xb9e08,_0xf7926b['error'][_0x1d10('0x15')]);return _0x43df2c(_0xf7926b[_0x1d10('0x13')][_0x1d10('0x15')]);}logger[_0x1d10('0x13')](_0x1d10('0xf'),_0xb9e08,_0xf7926b[_0x1d10('0x13')]['message']);return _0x6d6def(_0xf7926b[_0x1d10('0x13')][_0x1d10('0x15')]);}else{logger[_0x1d10('0xe')](_0x1d10('0xf'),_0xb9e08,'request\x20sent');_0x6d6def(_0xf7926b[_0x1d10('0x16')][_0x1d10('0x15')]);}})[_0x1d10('0x17')](function(_0x3f2f2b){logger[_0x1d10('0x13')](_0x1d10('0xf'),_0xb9e08,_0x3f2f2b);_0x43df2c(_0x3f2f2b);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 211c668..407e469 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 _0xaddb=['../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addDisposition','addAnswer','addApplications','addAgents','send','put','removeDispositions','removeAnswers','removeAgents','multer','util','path','express','Router'];(function(_0x49220a,_0x53357e){var _0x94612c=function(_0x164cac){while(--_0x164cac){_0x49220a['push'](_0x49220a['shift']());}};_0x94612c(++_0x53357e);}(_0xaddb,0x83));var _0xbadd=function(_0x176f90,_0x30e1de){_0x176f90=_0x176f90-0x0;var _0x80bc3d=_0xaddb[_0x176f90];return _0x80bc3d;};'use strict';var multer=require(_0xbadd('0x0'));var util=require(_0xbadd('0x1'));var path=require(_0xbadd('0x2'));var timeout=require('connect-timeout');var express=require(_0xbadd('0x3'));var router=express[_0xbadd('0x4')]();var auth=require(_0xbadd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbadd('0x6'));var controller=require(_0xbadd('0x7'));router[_0xbadd('0x8')]('/',auth['isAuthenticated'](),controller[_0xbadd('0x9')]);router[_0xbadd('0x8')](_0xbadd('0xa'),auth[_0xbadd('0xb')](),controller[_0xbadd('0xc')]);router[_0xbadd('0x8')](_0xbadd('0xd'),auth[_0xbadd('0xb')](),controller['show']);router[_0xbadd('0x8')](_0xbadd('0xe'),auth['isAuthenticated'](),controller[_0xbadd('0xf')]);router[_0xbadd('0x8')](_0xbadd('0x10'),auth[_0xbadd('0xb')](),controller[_0xbadd('0x11')]);router[_0xbadd('0x8')](_0xbadd('0x12'),auth[_0xbadd('0xb')](),controller['getApplications']);router['get'](_0xbadd('0x13'),auth[_0xbadd('0xb')](),controller[_0xbadd('0x14')]);router[_0xbadd('0x8')](_0xbadd('0x15'),auth[_0xbadd('0xb')](),controller[_0xbadd('0x16')]);router['post']('/',auth[_0xbadd('0xb')](),controller[_0xbadd('0x17')]);router[_0xbadd('0x18')](_0xbadd('0xe'),auth[_0xbadd('0xb')](),controller[_0xbadd('0x19')]);router[_0xbadd('0x18')](_0xbadd('0x10'),auth['isAuthenticated'](),controller[_0xbadd('0x1a')]);router['post']('/:id/notify',controller['notify']);router[_0xbadd('0x18')](_0xbadd('0x12'),auth[_0xbadd('0xb')](),controller[_0xbadd('0x1b')]);router[_0xbadd('0x18')]('/:id/users',auth[_0xbadd('0xb')](),controller[_0xbadd('0x1c')]);router['post']('/:id/send',auth[_0xbadd('0xb')](),controller[_0xbadd('0x1d')]);router[_0xbadd('0x1e')](_0xbadd('0xd'),auth[_0xbadd('0xb')](),controller['update']);router['delete']('/:id',auth[_0xbadd('0xb')](),controller['destroy']);router['delete'](_0xbadd('0xe'),auth[_0xbadd('0xb')](),controller[_0xbadd('0x1f')]);router['delete'](_0xbadd('0x10'),auth[_0xbadd('0xb')](),controller[_0xbadd('0x20')]);router['delete'](_0xbadd('0x15'),auth['isAuthenticated'](),controller[_0xbadd('0x21')]);module['exports']=router; \ No newline at end of file +var _0x1fd9=['/:id/interactions','getInteractions','getAgents','addDisposition','post','/:id/notify','notify','addApplications','/:id/send','send','put','delete','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications'];(function(_0x434d90,_0x1223a5){var _0x414246=function(_0xa3d146){while(--_0xa3d146){_0x434d90['push'](_0x434d90['shift']());}};_0x414246(++_0x1223a5);}(_0x1fd9,0x19b));var _0x91fd=function(_0x1efb8e,_0x14f00c){_0x1efb8e=_0x1efb8e-0x0;var _0x13c426=_0x1fd9[_0x1efb8e];return _0x13c426;};'use strict';var multer=require(_0x91fd('0x0'));var util=require(_0x91fd('0x1'));var path=require(_0x91fd('0x2'));var timeout=require(_0x91fd('0x3'));var express=require(_0x91fd('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x91fd('0x5'));var config=require(_0x91fd('0x6'));var controller=require('./openchannelAccount.controller');router['get']('/',auth[_0x91fd('0x7')](),controller[_0x91fd('0x8')]);router[_0x91fd('0x9')](_0x91fd('0xa'),auth[_0x91fd('0x7')](),controller[_0x91fd('0xb')]);router['get'](_0x91fd('0xc'),auth['isAuthenticated'](),controller[_0x91fd('0xd')]);router[_0x91fd('0x9')](_0x91fd('0xe'),auth[_0x91fd('0x7')](),controller['getDispositions']);router['get'](_0x91fd('0xf'),auth[_0x91fd('0x7')](),controller[_0x91fd('0x10')]);router[_0x91fd('0x9')]('/:id/applications',auth[_0x91fd('0x7')](),controller[_0x91fd('0x11')]);router[_0x91fd('0x9')](_0x91fd('0x12'),auth[_0x91fd('0x7')](),controller[_0x91fd('0x13')]);router[_0x91fd('0x9')]('/:id/users',auth[_0x91fd('0x7')](),controller[_0x91fd('0x14')]);router['post']('/',auth[_0x91fd('0x7')](),controller['create']);router['post'](_0x91fd('0xe'),auth['isAuthenticated'](),controller[_0x91fd('0x15')]);router[_0x91fd('0x16')](_0x91fd('0xf'),auth[_0x91fd('0x7')](),controller['addAnswer']);router[_0x91fd('0x16')](_0x91fd('0x17'),controller[_0x91fd('0x18')]);router[_0x91fd('0x16')]('/:id/applications',auth['isAuthenticated'](),controller[_0x91fd('0x19')]);router[_0x91fd('0x16')]('/:id/users',auth[_0x91fd('0x7')](),controller['addAgents']);router['post'](_0x91fd('0x1a'),auth[_0x91fd('0x7')](),controller[_0x91fd('0x1b')]);router[_0x91fd('0x1c')](_0x91fd('0xc'),auth[_0x91fd('0x7')](),controller['update']);router['delete'](_0x91fd('0xc'),auth[_0x91fd('0x7')](),controller['destroy']);router[_0x91fd('0x1d')](_0x91fd('0xe'),auth[_0x91fd('0x7')](),controller['removeDispositions']);router['delete'](_0x91fd('0xf'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x91fd('0x1d')](_0x91fd('0x1e'),auth['isAuthenticated'](),controller[_0x91fd('0x1f')]);module[_0x91fd('0x20')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 98e5632..1a70464 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 _0x4b84=['name','generate','STRING','BOOLEAN','INTEGER','sequelize','randomstring'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x4b84,0x1cc));var _0x44b8=function(_0x590b61,_0x4c4335){_0x590b61=_0x590b61-0x0;var _0x1a14dc=_0x4b84[_0x590b61];return _0x1a14dc;};'use strict';var Sequelize=require(_0x44b8('0x0'));var rs=require(_0x44b8('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x44b8('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x44b8('0x3')]();}},'replyUri':{'type':Sequelize[_0x44b8('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x44b8('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x44b8('0x4')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x44b8('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c}}; \ No newline at end of file +var _0x54ef=['generate','TEXT','BOOLEAN','INTEGER','sequelize','randomstring','exports','name','STRING'];(function(_0x4aaacc,_0x4a66b0){var _0xd72087=function(_0x512379){while(--_0x512379){_0x4aaacc['push'](_0x4aaacc['shift']());}};_0xd72087(++_0x4a66b0);}(_0x54ef,0x112));var _0xf54e=function(_0x383080,_0x3df106){_0x383080=_0x383080-0x0;var _0x4fa594=_0x54ef[_0x383080];return _0x4fa594;};'use strict';var Sequelize=require(_0xf54e('0x0'));var rs=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xf54e('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xf54e('0x4')]},'token':{'type':Sequelize[_0xf54e('0x4')],'defaultValue':function(){return rs[_0xf54e('0x5')]();}},'replyUri':{'type':Sequelize[_0xf54e('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xf54e('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf54e('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf54e('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf54e('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xf54e('0x4')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf54e('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf54e('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 56e1c39..022fc7a 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 _0x390a=['set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','rawAttributes','query','dateStart','dateEnd','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','day','add','merge','where','map','filter','options','OpenchannelAccount','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','OpnechannelAccountId','Disposition','getDispositions','findOne','hasOwnProperty','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','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','List','CmContact','DESC','OpenchannelApplication','account','applications','list','orderBy','priority','asc','Applications','Contacts','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','interaction','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','findAndCountAll','getApplications','getInteractions','pick','Contact','Owner','fullname','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','get','user','out','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','json','count','offset'];(function(_0x50ef09,_0x9f4bde){var _0x38f222=function(_0x35cc84){while(--_0x35cc84){_0x50ef09['push'](_0x50ef09['shift']());}};_0x38f222(++_0x9f4bde);}(_0x390a,0x143));var _0xa390=function(_0x239c77,_0x4604cb){_0x239c77=_0x239c77-0x0;var _0x459d29=_0x390a[_0x239c77];return _0x459d29;};'use strict';var pdf=require(_0xa390('0x0'));var emlformat=require(_0xa390('0x1'));var rimraf=require(_0xa390('0x2'));var zipdir=require(_0xa390('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa390('0x4'));var Mustache=require(_0xa390('0x5'));var util=require(_0xa390('0x6'));var path=require(_0xa390('0x7'));var sox=require(_0xa390('0x8'));var csv=require(_0xa390('0x9'));var ejs=require(_0xa390('0xa'));var fs=require('fs');var _=require(_0xa390('0xb'));var squel=require(_0xa390('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa390('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa390('0xe'));var Papa=require('papaparse');var Redis=require(_0xa390('0xf'));var qs=require(_0xa390('0x10'));var logger=require(_0xa390('0x11'))(_0xa390('0x12'));var utils=require(_0xa390('0x13'));var config=require('../../config/environment');var db=require(_0xa390('0x14'))['db'];config['redis']=_[_0xa390('0x15')](config[_0xa390('0x16')],{'host':_0xa390('0x17'),'port':0x18eb});var socket=require(_0xa390('0x18'))(new Redis(config[_0xa390('0x16')]));require(_0xa390('0x19'))[_0xa390('0x1a')](socket);var jayson=require(_0xa390('0x1b'));var client=jayson[_0xa390('0x1c')][_0xa390('0x1d')]({'port':0x232c});var client9002=jayson[_0xa390('0x1c')][_0xa390('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x592d71,_0x2bc29c,_0x3594a8,_0x11d35c){return new BPromise(function(_0x4b48a5,_0x14d6bc){var _0x4121b4=_0x11d35c||client;return _0x4121b4['request'](_0x592d71,_0x3594a8)[_0xa390('0x1e')](function(_0x53f493){logger[_0xa390('0x1f')](_0xa390('0x20'),_0x2bc29c,_0xa390('0x21'));logger[_0xa390('0x22')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x2bc29c,_0xa390('0x21'),JSON[_0xa390('0x23')](_0x53f493));if(_0x53f493[_0xa390('0x24')]){if(_0x53f493['error'][_0xa390('0x25')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x2bc29c,_0x53f493[_0xa390('0x24')]['message']);return _0x14d6bc(_0x53f493[_0xa390('0x24')][_0xa390('0x26')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x2bc29c,_0x53f493[_0xa390('0x24')][_0xa390('0x26')]);return _0x4b48a5(_0x53f493[_0xa390('0x24')][_0xa390('0x26')]);}else{logger['info'](_0xa390('0x20'),_0x2bc29c,_0xa390('0x21'));_0x4b48a5(_0x53f493[_0xa390('0x27')][_0xa390('0x26')]);}})['catch'](function(_0x2302a8){logger[_0xa390('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x2bc29c,_0x2302a8);_0x14d6bc(_0x2302a8);});});}function respondWithStatusCode(_0x5807b7,_0x34a9da){_0x34a9da=_0x34a9da||0xcc;return function(_0x260ab9){if(_0x260ab9){return _0x5807b7[_0xa390('0x28')](_0x34a9da);}return _0x5807b7[_0xa390('0x29')](_0x34a9da)['end']();};}function respondWithResult(_0x2ed194,_0x291e1a){_0x291e1a=_0x291e1a||0xc8;return function(_0x3c6615){if(_0x3c6615){return _0x2ed194['status'](_0x291e1a)[_0xa390('0x2a')](_0x3c6615);}};}function respondWithFilteredResult(_0x16bc43,_0xe01263){return function(_0x29aba6){if(_0x29aba6){var _0x7d0d8b=_0x29aba6[_0xa390('0x2b')],_0x1574b2=_0xe01263[_0xa390('0x2c')],_0x457ffa=_0xe01263[_0xa390('0x2c')]+_0xe01263['limit'],_0x463117;if(_0x457ffa>=_0x7d0d8b){_0x457ffa=_0x7d0d8b;_0x463117=0xc8;}else{_0x463117=0xce;}_0x16bc43[_0xa390('0x29')](_0x463117);return _0x16bc43[_0xa390('0x2d')](_0xa390('0x2e'),_0x1574b2+'-'+_0x457ffa+'/'+_0x7d0d8b)[_0xa390('0x2a')](_0x29aba6);}return null;};}function patchUpdates(_0x2cd85e){return function(_0x24b792){try{jsonpatch[_0xa390('0x2f')](_0x24b792,_0x2cd85e,!![]);}catch(_0x3e5fb5){return BPromise[_0xa390('0x30')](_0x3e5fb5);}return _0x24b792[_0xa390('0x31')]();};}function saveUpdates(_0x2026ec,_0x4e8af8){return function(_0xee7a0e){if(_0xee7a0e){return _0xee7a0e[_0xa390('0x32')](_0x2026ec)[_0xa390('0x1e')](function(_0xaa4c1){return _0xaa4c1;});}return null;};}function removeEntity(_0x4cd3b5,_0x5009f9){return function(_0x1efd72){if(_0x1efd72){return _0x1efd72[_0xa390('0x33')]()[_0xa390('0x1e')](function(){_0x4cd3b5[_0xa390('0x29')](0xcc)[_0xa390('0x34')]();});}};}function handleEntityNotFound(_0x51f454,_0xed86e1){return function(_0xafcbc5){if(!_0xafcbc5){_0x51f454[_0xa390('0x28')](0x194);}return _0xafcbc5;};}function handleError(_0x53e44e,_0x4b06ca){_0x4b06ca=_0x4b06ca||0x1f4;return function(_0x3fd984){logger[_0xa390('0x24')](_0x3fd984[_0xa390('0x35')]);if(_0x3fd984[_0xa390('0x36')]){delete _0x3fd984[_0xa390('0x36')];}_0x53e44e['status'](_0x4b06ca)[_0xa390('0x37')](_0x3fd984);};}exports['index']=function(_0x413bb6,_0x2bce34){var _0x46fe2b={},_0xc8dbcd={},_0x650c6d={'count':0x0,'rows':[]};var _0x284937=db['OpenchannelAccount'][_0xa390('0x38')];_0xc8dbcd['model']=_['keys'](_0x284937);var _0x5e6de7={'dateStart':_0x413bb6[_0xa390('0x39')][_0xa390('0x3a')],'dateEnd':_0x413bb6[_0xa390('0x39')][_0xa390('0x3b')]};delete _0x413bb6[_0xa390('0x39')]['dateStart'];delete _0x413bb6[_0xa390('0x39')][_0xa390('0x3b')];_0xc8dbcd['query']=_[_0xa390('0x3c')](_0x413bb6[_0xa390('0x39')]);_0xc8dbcd[_0xa390('0x3d')]=_[_0xa390('0x3e')](_0xc8dbcd[_0xa390('0x3f')],_0xc8dbcd[_0xa390('0x39')]);_0x46fe2b[_0xa390('0x40')]=_[_0xa390('0x3e')](_0xc8dbcd['model'],qs[_0xa390('0x41')](_0x413bb6[_0xa390('0x39')][_0xa390('0x41')]));_0x46fe2b[_0xa390('0x40')]=_0x46fe2b[_0xa390('0x40')][_0xa390('0x42')]?_0x46fe2b[_0xa390('0x40')]:_0xc8dbcd['model'];if(!_0x413bb6[_0xa390('0x39')]['hasOwnProperty'](_0xa390('0x43'))){_0x46fe2b['limit']=qs[_0xa390('0x44')](_0x413bb6[_0xa390('0x39')][_0xa390('0x44')]);_0x46fe2b[_0xa390('0x2c')]=qs['offset'](_0x413bb6[_0xa390('0x39')][_0xa390('0x2c')]);}_0x46fe2b[_0xa390('0x45')]=qs[_0xa390('0x46')](_0x413bb6[_0xa390('0x39')]['sort']);_0x46fe2b['where']=qs[_0xa390('0x3d')](_['pick'](_0x413bb6[_0xa390('0x39')],_0xc8dbcd[_0xa390('0x3d')]));if(_0x5e6de7[_0xa390('0x3a')]){if(_0x5e6de7[_0xa390('0x3b')]){_0x5e6de7[_0xa390('0x3b')]=moment(_0x5e6de7[_0xa390('0x3b')])['add'](0x1,_0xa390('0x47'));}else{_0x5e6de7[_0xa390('0x3b')]=moment(_0x5e6de7[_0xa390('0x3a')])[_0xa390('0x48')](0x1,_0xa390('0x47'));}_[_0xa390('0x49')](_0x46fe2b['where'],{'createdAt':{'$gte':_0x5e6de7[_0xa390('0x3a')],'$lte':_0x5e6de7[_0xa390('0x3b')]}});}if(_0x413bb6[_0xa390('0x39')]['filter']){_0x46fe2b[_0xa390('0x4a')]=_['merge'](_0x46fe2b['where'],{'$or':_[_0xa390('0x4b')](_0x46fe2b[_0xa390('0x40')],function(_0x323e91){var _0x5e1adf={};_0x5e1adf[_0x323e91]={'$like':'%'+_0x413bb6['query'][_0xa390('0x4c')]+'%'};return _0x5e1adf;})});}_0x46fe2b=_['merge']({},_0x46fe2b,_0x413bb6[_0xa390('0x4d')]);var _0x1e3077={'where':_0x46fe2b['where']};return db[_0xa390('0x4e')][_0xa390('0x2b')](_0x1e3077)[_0xa390('0x1e')](function(_0x5b5e7f){_0x650c6d[_0xa390('0x2b')]=_0x5b5e7f;if(_0x413bb6[_0xa390('0x39')][_0xa390('0x4f')]){_0x46fe2b[_0xa390('0x50')]=[{'all':!![]}];}return db[_0xa390('0x4e')][_0xa390('0x51')](_0x46fe2b);})['then'](function(_0x3be931){_0x650c6d[_0xa390('0x52')]=_0x3be931;return _0x650c6d;})[_0xa390('0x1e')](respondWithFilteredResult(_0x2bce34,_0x46fe2b))['catch'](handleError(_0x2bce34,null));};exports[_0xa390('0x53')]=function(_0x14dcd2,_0x3dfddf){var _0x1a8980={'raw':![],'where':{'id':_0x14dcd2[_0xa390('0x54')]['id']}},_0x4a6ace={};_0x4a6ace[_0xa390('0x3f')]=_[_0xa390('0x3c')](db[_0xa390('0x4e')][_0xa390('0x38')]);_0x4a6ace[_0xa390('0x39')]=_['keys'](_0x14dcd2[_0xa390('0x39')]);_0x4a6ace[_0xa390('0x3d')]=_[_0xa390('0x3e')](_0x4a6ace['model'],_0x4a6ace['query']);_0x1a8980[_0xa390('0x40')]=_[_0xa390('0x3e')](_0x4a6ace[_0xa390('0x3f')],qs[_0xa390('0x41')](_0x14dcd2[_0xa390('0x39')][_0xa390('0x41')]));_0x1a8980['attributes']=_0x1a8980[_0xa390('0x40')]['length']?_0x1a8980[_0xa390('0x40')]:_0x4a6ace[_0xa390('0x3f')];if(_0x14dcd2[_0xa390('0x39')][_0xa390('0x4f')]){_0x1a8980[_0xa390('0x50')]=[{'all':!![]}];}_0x1a8980=_[_0xa390('0x49')]({},_0x1a8980,_0x14dcd2[_0xa390('0x4d')]);return db[_0xa390('0x4e')][_0xa390('0x55')](_0x1a8980)[_0xa390('0x1e')](handleEntityNotFound(_0x3dfddf,null))['then'](respondWithResult(_0x3dfddf,null))[_0xa390('0x56')](handleError(_0x3dfddf,null));};exports[_0xa390('0x57')]=function(_0x32c3af,_0x329c3c){return db[_0xa390('0x4e')][_0xa390('0x57')](_0x32c3af[_0xa390('0x58')],{})[_0xa390('0x1e')](respondWithResult(_0x329c3c,0xc9))['catch'](handleError(_0x329c3c,null));};exports['update']=function(_0x1dce6e,_0x263e2a){if(_0x1dce6e[_0xa390('0x58')]['id']){delete _0x1dce6e[_0xa390('0x58')]['id'];}return db[_0xa390('0x4e')][_0xa390('0x55')]({'where':{'id':_0x1dce6e[_0xa390('0x54')]['id']}})['then'](handleEntityNotFound(_0x263e2a,null))['then'](saveUpdates(_0x1dce6e[_0xa390('0x58')],null))[_0xa390('0x1e')](respondWithResult(_0x263e2a,null))['catch'](handleError(_0x263e2a,null));};exports[_0xa390('0x33')]=function(_0x5f0718,_0x4f22a5){return db[_0xa390('0x4e')][_0xa390('0x55')]({'where':{'id':_0x5f0718[_0xa390('0x54')]['id']}})[_0xa390('0x1e')](handleEntityNotFound(_0x4f22a5,null))['then'](removeEntity(_0x4f22a5,null))[_0xa390('0x56')](handleError(_0x4f22a5,null));};exports[_0xa390('0x59')]=function(_0x144232,_0x1d9094){return db['OpenchannelAccount'][_0xa390('0x59')]()[_0xa390('0x1e')](respondWithResult(_0x1d9094,null))[_0xa390('0x56')](handleError(_0x1d9094,null));};exports['addDisposition']=function(_0x5d7ae3,_0x2cbb9f,_0x5677e2){if(_0x5d7ae3[_0xa390('0x58')]['id']){delete _0x5d7ae3[_0xa390('0x58')]['id'];}return db['OpenchannelAccount'][_0xa390('0x55')]({'where':{'id':_0x5d7ae3[_0xa390('0x54')]['id']}})[_0xa390('0x1e')](handleEntityNotFound(_0x2cbb9f,null))['then'](function(_0x1f11e3){if(_0x1f11e3){_0x5d7ae3['body'][_0xa390('0x5a')]=_0x1f11e3['id'];return db[_0xa390('0x5b')]['create'](_0x5d7ae3[_0xa390('0x58')]);}})[_0xa390('0x1e')](respondWithResult(_0x2cbb9f,null))['catch'](handleError(_0x2cbb9f,null));};exports[_0xa390('0x5c')]=function(_0x1116d2,_0x20b234,_0xd3ad21){var _0x527823={'raw':![],'where':{}};var _0x45eb36={};var _0x305985={'count':0x0,'rows':[]};return db[_0xa390('0x4e')][_0xa390('0x5d')]({'where':{'id':_0x1116d2[_0xa390('0x54')]['id']}})[_0xa390('0x1e')](handleEntityNotFound(_0x20b234,null))['then'](function(_0x46ad90){if(_0x46ad90){_0x45eb36['model']=_[_0xa390('0x3c')](db[_0xa390('0x5b')][_0xa390('0x38')]);_0x45eb36['query']=_[_0xa390('0x3c')](_0x1116d2[_0xa390('0x39')]);_0x45eb36['filters']=_[_0xa390('0x3e')](_0x45eb36[_0xa390('0x3f')],_0x45eb36[_0xa390('0x39')]);_0x527823[_0xa390('0x40')]=_[_0xa390('0x3e')](_0x45eb36[_0xa390('0x3f')],qs[_0xa390('0x41')](_0x1116d2[_0xa390('0x39')][_0xa390('0x41')]));_0x527823[_0xa390('0x40')]=_0x527823[_0xa390('0x40')]['length']?_0x527823['attributes']:_0x45eb36[_0xa390('0x3f')];if(!_0x1116d2['query'][_0xa390('0x5e')]('nolimit')){_0x527823['limit']=qs[_0xa390('0x44')](_0x1116d2['query'][_0xa390('0x44')]);_0x527823[_0xa390('0x2c')]=qs['offset'](_0x1116d2[_0xa390('0x39')][_0xa390('0x2c')]);}_0x527823[_0xa390('0x45')]=qs['sort'](_0x1116d2[_0xa390('0x39')][_0xa390('0x46')]);_0x527823['where']=qs[_0xa390('0x3d')](_['pick'](_0x1116d2[_0xa390('0x39')],_0x45eb36['filters']));_0x527823[_0xa390('0x4a')][_0xa390('0x5f')]=_0x46ad90['id'];if(_0x1116d2[_0xa390('0x39')][_0xa390('0x4c')]){_0x527823['where']=_[_0xa390('0x49')](_0x527823[_0xa390('0x4a')],{'$or':_[_0xa390('0x4b')](_0x527823[_0xa390('0x40')],function(_0xd3597c){var _0x28b3cb={};_0x28b3cb[_0xd3597c]={'$like':'%'+_0x1116d2['query'][_0xa390('0x4c')]+'%'};return _0x28b3cb;})});}_0x527823=_[_0xa390('0x49')]({},_0x527823,_0x1116d2[_0xa390('0x4d')]);return db['Disposition'][_0xa390('0x2b')]({'where':_0x527823[_0xa390('0x4a')]})[_0xa390('0x1e')](function(_0x316f60){_0x305985[_0xa390('0x2b')]=_0x316f60;if(_0x1116d2[_0xa390('0x39')][_0xa390('0x4f')]){_0x527823[_0xa390('0x50')]=[{'all':!![]}];}return db[_0xa390('0x5b')][_0xa390('0x51')](_0x527823);})['then'](function(_0x4b9468){_0x305985[_0xa390('0x52')]=_0x4b9468;return _0x305985;});}})[_0xa390('0x1e')](respondWithFilteredResult(_0x20b234,_0x527823))[_0xa390('0x56')](handleError(_0x20b234,null));};exports[_0xa390('0x60')]=function(_0x9d3c15,_0x2b15ed,_0x43a01f){var _0x3a0311;return db[_0xa390('0x4e')][_0xa390('0x55')]({'where':{'id':_0x9d3c15[_0xa390('0x54')]['id']}})['then'](handleEntityNotFound(_0x2b15ed,null))[_0xa390('0x1e')](function(_0x2eabbe){if(_0x2eabbe){return _0x2eabbe[_0xa390('0x60')](_0x9d3c15[_0xa390('0x39')][_0xa390('0x61')]);}})[_0xa390('0x1e')](respondWithStatusCode(_0x2b15ed,null))[_0xa390('0x56')](handleError(_0x2b15ed,null));};exports[_0xa390('0x62')]=function(_0x238c7c,_0x5bd8cf,_0xb620ab){if(_0x238c7c[_0xa390('0x58')]['id']){delete _0x238c7c[_0xa390('0x58')]['id'];}return db[_0xa390('0x4e')][_0xa390('0x55')]({'where':{'id':_0x238c7c['params']['id']}})[_0xa390('0x1e')](handleEntityNotFound(_0x5bd8cf,null))[_0xa390('0x1e')](function(_0x531e33){if(_0x531e33){_0x238c7c[_0xa390('0x58')][_0xa390('0x5f')]=_0x531e33['id'];return db[_0xa390('0x63')][_0xa390('0x57')](_0x238c7c[_0xa390('0x58')]);}})[_0xa390('0x1e')](respondWithResult(_0x5bd8cf,null))['catch'](handleError(_0x5bd8cf,null));};exports[_0xa390('0x64')]=function(_0x498d79,_0x140522,_0x126eda){var _0x59e934={'raw':![],'where':{}};var _0x47c282={};var _0x4a062d={'count':0x0,'rows':[]};return db[_0xa390('0x4e')][_0xa390('0x5d')]({'where':{'id':_0x498d79[_0xa390('0x54')]['id']}})[_0xa390('0x1e')](handleEntityNotFound(_0x140522,null))[_0xa390('0x1e')](function(_0x5789e7){if(_0x5789e7){_0x47c282['model']=_['keys'](db[_0xa390('0x63')][_0xa390('0x38')]);_0x47c282[_0xa390('0x39')]=_['keys'](_0x498d79[_0xa390('0x39')]);_0x47c282[_0xa390('0x3d')]=_[_0xa390('0x3e')](_0x47c282[_0xa390('0x3f')],_0x47c282[_0xa390('0x39')]);_0x59e934[_0xa390('0x40')]=_[_0xa390('0x3e')](_0x47c282['model'],qs[_0xa390('0x41')](_0x498d79[_0xa390('0x39')]['fields']));_0x59e934[_0xa390('0x40')]=_0x59e934[_0xa390('0x40')]['length']?_0x59e934[_0xa390('0x40')]:_0x47c282[_0xa390('0x3f')];if(!_0x498d79[_0xa390('0x39')]['hasOwnProperty'](_0xa390('0x43'))){_0x59e934[_0xa390('0x44')]=qs[_0xa390('0x44')](_0x498d79[_0xa390('0x39')]['limit']);_0x59e934['offset']=qs['offset'](_0x498d79[_0xa390('0x39')][_0xa390('0x2c')]);}_0x59e934['order']=qs[_0xa390('0x46')](_0x498d79[_0xa390('0x39')][_0xa390('0x46')]);_0x59e934['where']=qs[_0xa390('0x3d')](_['pick'](_0x498d79[_0xa390('0x39')],_0x47c282['filters']));_0x59e934[_0xa390('0x4a')][_0xa390('0x5f')]=_0x5789e7['id'];if(_0x498d79['query'][_0xa390('0x4c')]){_0x59e934[_0xa390('0x4a')]=_[_0xa390('0x49')](_0x59e934[_0xa390('0x4a')],{'$or':_[_0xa390('0x4b')](_0x59e934[_0xa390('0x40')],function(_0x4b133d){var _0x27e586={};_0x27e586[_0x4b133d]={'$like':'%'+_0x498d79['query'][_0xa390('0x4c')]+'%'};return _0x27e586;})});}_0x59e934=_[_0xa390('0x49')]({},_0x59e934,_0x498d79[_0xa390('0x4d')]);return db[_0xa390('0x63')]['count']({'where':_0x59e934['where']})[_0xa390('0x1e')](function(_0x4ef312){_0x4a062d[_0xa390('0x2b')]=_0x4ef312;if(_0x498d79['query'][_0xa390('0x4f')]){_0x59e934[_0xa390('0x50')]=[{'all':!![]}];}return db[_0xa390('0x63')][_0xa390('0x51')](_0x59e934);})[_0xa390('0x1e')](function(_0x2125d6){_0x4a062d[_0xa390('0x52')]=_0x2125d6;return _0x4a062d;});}})[_0xa390('0x1e')](respondWithFilteredResult(_0x140522,_0x59e934))[_0xa390('0x56')](handleError(_0x140522,null));};exports['removeAnswers']=function(_0x4ff283,_0x52e2b6,_0x391796){var _0x41fc17;return db[_0xa390('0x4e')][_0xa390('0x55')]({'where':{'id':_0x4ff283[_0xa390('0x54')]['id']}})['then'](handleEntityNotFound(_0x52e2b6,null))[_0xa390('0x1e')](function(_0x20a828){if(_0x20a828){return _0x20a828[_0xa390('0x65')](_0x4ff283[_0xa390('0x39')][_0xa390('0x61')]);}})[_0xa390('0x1e')](respondWithStatusCode(_0x52e2b6,null))[_0xa390('0x56')](handleError(_0x52e2b6,null));};exports[_0xa390('0x66')]=function(_0x36ca43,_0xfd866f,_0x3f0d1e){var _0x172249={'body':_0x36ca43['body'],'channel':_0xa390('0x67')};var _0x5ddfc6=[];var _0x3386ca=[];var _0x48c8d4={};var _0x403f65=![];return db['CmContact']['describe']()[_0xa390('0x1e')](function(_0x41817c){if(!_0x41817c){throw new db[(_0xa390('0x68'))][(_0xa390('0x69'))](_0xa390('0x6a'));}_0x5ddfc6=_[_0xa390('0x6b')](_[_0xa390('0x3c')](_0x41817c),['createdAt',_0xa390('0x6c')]);_0x3386ca=_['difference'](_['keys'](_0x41817c),[_0xa390('0x6d'),'updatedAt',_0xa390('0x6e'),_0xa390('0x6f')]);if(_0x36ca43[_0xa390('0x58')]['id']){delete _0x36ca43['body']['id'];}if(_['isNil'](_0x36ca43[_0xa390('0x58')][_0xa390('0x70')])){throw new db[(_0xa390('0x68'))][(_0xa390('0x69'))](_0xa390('0x71'));}if(_[_0xa390('0x72')](_0x36ca43[_0xa390('0x58')]['body'])||_0x36ca43[_0xa390('0x58')][_0xa390('0x58')]===''){throw new db[(_0xa390('0x68'))][(_0xa390('0x69'))](_0xa390('0x73'));}if(_[_0xa390('0x72')](_0x36ca43[_0xa390('0x58')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0xa390('0x74')+_0x3386ca);}if(!_[_0xa390('0x75')](_0x3386ca,_0x36ca43[_0xa390('0x58')][_0xa390('0x76')])){throw new db[(_0xa390('0x68'))][(_0xa390('0x69'))](_0xa390('0x77')+_0x3386ca);}_0x48c8d4[_0x36ca43['body'][_0xa390('0x76')]]=_0x36ca43[_0xa390('0x58')]['from'];})['then'](function(){return db[_0xa390('0x4e')][_0xa390('0x55')]({'where':{'id':_0x36ca43[_0xa390('0x54')]['id']},'include':[{'model':db[_0xa390('0x78')],'as':_0xa390('0x79'),'include':[{'model':db[_0xa390('0x7a')],'as':'Contacts','where':_0x48c8d4,'limit':0x1,'order':[['updatedAt',_0xa390('0x7b')]]}]},{'model':db[_0xa390('0x7c')],'as':'Applications'}]});})[_0xa390('0x1e')](handleEntityNotFound(_0xfd866f,null))['then'](function(_0x32af50){if(_0x32af50&&_0x32af50[_0xa390('0x79')]){_0x172249[_0xa390('0x7d')]=_0x32af50;_0x172249[_0xa390('0x7e')]=_0x32af50['Applications'];_0x172249[_0xa390('0x7f')]=_0x32af50['List'];_0x172249[_0xa390('0x7e')]=_[_0xa390('0x80')](_0x172249[_0xa390('0x7e')],[_0xa390('0x81')],[_0xa390('0x82')]);if(_0x172249[_0xa390('0x7d')][_0xa390('0x83')]){delete _0x172249[_0xa390('0x7d')][_0xa390('0x83')];}if(_0x172249['account'][_0xa390('0x79')]&&_0x172249[_0xa390('0x7d')][_0xa390('0x79')][_0xa390('0x84')][_0xa390('0x42')]){return _0x172249[_0xa390('0x7d')][_0xa390('0x79')][_0xa390('0x84')][0x0];}var _0x1f0c90=_[_0xa390('0x15')](_0x36ca43[_0xa390('0x58')],{'firstName':_0x36ca43[_0xa390('0x58')]['from'],'ListId':_0x32af50[_0xa390('0x6f')]});_0x1f0c90[_0x36ca43['body']['mapKey']]=_0x36ca43[_0xa390('0x58')][_0xa390('0x70')];return db['CmContact']['create'](_0x1f0c90,{'fields':_0x5ddfc6,'raw':!![]});}})[_0xa390('0x1e')](handleEntityNotFound(_0xfd866f,null))[_0xa390('0x1e')](function(_0x133498){_0x172249['contact']=_0x133498;if(_0x133498){var _0x93c50f={'ContactId':_0x133498['id'],'OpenchannelAccountId':_0x36ca43['params']['id'],'from':(_0x133498[_0xa390('0x85')]||'')+'\x20'+(_0x133498[_0xa390('0x86')]||'')};var _0x3abc86={'OpenchannelAccountId':_0x36ca43[_0xa390('0x54')]['id'],'closed':![]};if(_0x36ca43[_0xa390('0x58')][_0xa390('0x87')]){_0x3abc86['threadId']=_0x36ca43[_0xa390('0x58')]['threadId'];return db[_0xa390('0x88')][_0xa390('0x55')]({'where':_0x3abc86})[_0xa390('0x1e')](function(_0x42e0a7){if(_0x42e0a7){return[_0x42e0a7,![]];}_0x93c50f[_0xa390('0x87')]=_0x36ca43[_0xa390('0x58')][_0xa390('0x87')];_0x93c50f['externalUrl']=_0x36ca43[_0xa390('0x58')][_0xa390('0x89')];return db[_0xa390('0x88')][_0xa390('0x57')](_0x93c50f)[_0xa390('0x1e')](function(_0x1822b8){return[_0x1822b8,!![]];});});}else{_0x3abc86[_0xa390('0x87')]=null;}_0x3abc86[_0xa390('0x8a')]=_0x133498['id'];return db[_0xa390('0x88')][_0xa390('0x55')]({'where':_0x3abc86})['then'](function(_0x283d6d){if(_0x283d6d){return[_0x283d6d,![]];}return db[_0xa390('0x88')]['create'](_0x93c50f)[_0xa390('0x1e')](function(_0x3e4661){return[_0x3e4661,!![]];});});}})[_0xa390('0x8b')](function(_0x4e8283,_0x2d4d80){if(_0x4e8283){_0x403f65=_0x2d4d80;if(!_0x2d4d80){return _0x4e8283['update']({'from':(_0x172249[_0xa390('0x8c')][_0xa390('0x85')]||'')+'\x20'+(_0x172249[_0xa390('0x8c')][_0xa390('0x86')]||'')});}else{return _0x4e8283;}}})[_0xa390('0x1e')](function(_0x1fb177){_0x172249[_0xa390('0x8d')]=_0x1fb177['get']({'plain':!![]});_0x172249[_0xa390('0x8d')]['created']=_0x403f65;if(_0x172249[_0xa390('0x8d')]['created']){if(_0x172249[_0xa390('0x7d')][_0xa390('0x8e')]){_0x172249[_0xa390('0x7e')][_0xa390('0x8f')]({'id':0x0,'priority':_0x172249[_0xa390('0x7e')]['length']+0x1,'app':_0xa390('0x90'),'appdata':_0xa390('0x91'),'interval':_0xa390('0x92')});}}return db[_0xa390('0x93')][_0xa390('0x57')]({'body':_0x36ca43[_0xa390('0x58')][_0xa390('0x58')],'OpenchannelAccountId':_0x36ca43[_0xa390('0x54')]['id'],'OpenchannelInteractionId':_0x1fb177['id'],'direction':'in','ContactId':_0x172249[_0xa390('0x8c')]['id'],'AttachmentId':_0x36ca43[_0xa390('0x58')][_0xa390('0x94')]});})[_0xa390('0x1e')](function(_0x250dbc){_0x172249['message']=_0x250dbc;if(_0x172249[_0xa390('0x8d')][_0xa390('0x95')]){return db[_0xa390('0x96')][_0xa390('0x55')]({'attributes':['id',_0xa390('0x36')],'where':{'id':_0x172249[_0xa390('0x8d')]['UserId']}})[_0xa390('0x1e')](function(_0x1c1ad3){if(_0x1c1ad3){_0x172249[_0xa390('0x7e')][_0xa390('0x97')]({'id':0x0,'priority':0x0,'app':_0xa390('0x98'),'appdata':_0x1c1ad3[_0xa390('0x36')]+','+(_0x172249[_0xa390('0x7d')]['waitForTheAssignedAgent']||0xa),'interval':_0xa390('0x92')});_0x172249[_0xa390('0x99')]=![];}return respondWithRpcPromise(_0xa390('0x9a'),_0xa390('0x9b'),_0x172249);});}return respondWithRpcPromise('Start',_0xa390('0x9b'),_0x172249);})[_0xa390('0x1e')](function(_0x587aa9){respondWithRpcPromise(_0xa390('0x9c'),'EventManager',{'event':_0xa390('0x66'),'message':_0x587aa9},client9002);return _0x587aa9;})['then'](respondWithResult(_0xfd866f,null))[_0xa390('0x56')](handleError(_0xfd866f,null));};exports[_0xa390('0x9d')]=function(_0xcfde0b,_0x52ed15,_0x27c15a){return db[_0xa390('0x4e')][_0xa390('0x5d')]({'where':{'id':_0xcfde0b[_0xa390('0x54')]['id']}})[_0xa390('0x1e')](handleEntityNotFound(_0x52ed15,null))[_0xa390('0x1e')](function(_0x1b5af9){if(_0x1b5af9){return db[_0xa390('0x9e')][_0xa390('0x9f')](function(_0x5cfc19){return db[_0xa390('0x7c')][_0xa390('0x33')]({'where':{'OpenchannelAccountId':_0xcfde0b[_0xa390('0x54')]['id']},'transaction':_0x5cfc19})[_0xa390('0x1e')](function(_0xf8c579){var _0x472218=_[_0xa390('0x4b')](_0xcfde0b['body'],function(_0x37c783){_0x37c783[_0xa390('0x5f')]=_0xcfde0b['params']['id'];return _0x37c783;});return db[_0xa390('0x7c')]['bulkCreate'](_0x472218,{'transaction':_0x5cfc19});});})[_0xa390('0x1e')](function(){return db[_0xa390('0x7c')][_0xa390('0xa0')]({'where':{'OpenchannelAccountId':_0xcfde0b[_0xa390('0x54')]['id']},'order':_0xa390('0x81')});});}})[_0xa390('0x1e')](respondWithResult(_0x52ed15,null))['catch'](handleError(_0x52ed15,null));};exports[_0xa390('0xa1')]=function(_0x409651,_0x4d0d7c,_0x4d8e60){var _0x59a5d8={};var _0x23b0f2={};var _0x32719a;var _0x1c6b0e;return db[_0xa390('0x4e')][_0xa390('0x5d')]({'where':{'id':_0x409651[_0xa390('0x54')]['id']}})[_0xa390('0x1e')](handleEntityNotFound(_0x4d0d7c,null))[_0xa390('0x1e')](function(_0x25b3c4){if(_0x25b3c4){_0x32719a=_0x25b3c4;_0x23b0f2[_0xa390('0x3f')]=_[_0xa390('0x3c')](db[_0xa390('0x7c')][_0xa390('0x38')]);_0x23b0f2[_0xa390('0x39')]=_[_0xa390('0x3c')](_0x409651[_0xa390('0x39')]);_0x23b0f2[_0xa390('0x3d')]=_[_0xa390('0x3e')](_0x23b0f2[_0xa390('0x3f')],_0x23b0f2['query']);_0x59a5d8['attributes']=_[_0xa390('0x3e')](_0x23b0f2[_0xa390('0x3f')],qs[_0xa390('0x41')](_0x409651['query'][_0xa390('0x41')]));_0x59a5d8[_0xa390('0x40')]=_0x59a5d8[_0xa390('0x40')][_0xa390('0x42')]?_0x59a5d8[_0xa390('0x40')]:_0x23b0f2[_0xa390('0x3f')];_0x59a5d8[_0xa390('0x45')]=qs['sort'](_0x409651[_0xa390('0x39')]['sort']);_0x59a5d8[_0xa390('0x4a')]=qs[_0xa390('0x3d')](_['pick'](_0x409651[_0xa390('0x39')],_0x23b0f2[_0xa390('0x3d')]));if(_0x409651[_0xa390('0x39')][_0xa390('0x4c')]){_0x59a5d8['where']=_[_0xa390('0x49')](_0x59a5d8[_0xa390('0x4a')],{'$or':_['map'](_0x59a5d8[_0xa390('0x40')],function(_0x1d17b0){var _0x3e03d4={};_0x3e03d4[_0x1d17b0]={'$like':'%'+_0x409651[_0xa390('0x39')][_0xa390('0x4c')]+'%'};return _0x3e03d4;})});}_0x59a5d8=_[_0xa390('0x49')]({},_0x59a5d8,_0x409651[_0xa390('0x4d')]);return _0x32719a[_0xa390('0xa1')](_0x59a5d8);}})[_0xa390('0x1e')](function(_0x22fcd8){if(_0x22fcd8){_0x1c6b0e=_0x22fcd8[_0xa390('0x42')];if(!_0x409651['query'][_0xa390('0x5e')](_0xa390('0x43'))){_0x59a5d8[_0xa390('0x44')]=qs['limit'](_0x409651[_0xa390('0x39')][_0xa390('0x44')]);_0x59a5d8[_0xa390('0x2c')]=qs[_0xa390('0x2c')](_0x409651[_0xa390('0x39')]['offset']);}return _0x32719a['getApplications'](_0x59a5d8);}})[_0xa390('0x1e')](function(_0x485e9d){if(_0x485e9d){return _0x485e9d?{'count':_0x1c6b0e,'rows':_0x485e9d}:null;}})['then'](respondWithResult(_0x4d0d7c,null))[_0xa390('0x56')](handleError(_0x4d0d7c,null));};exports[_0xa390('0xa2')]=function(_0x47bcb5,_0x3955ce,_0x211928){var _0x19ffba={'raw':![],'where':{}};var _0x20b69f={};var _0x5bb924={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xa390('0x5d')]({'where':{'id':_0x47bcb5['params']['id']}})[_0xa390('0x1e')](handleEntityNotFound(_0x3955ce,null))['then'](function(_0x266b0b){if(_0x266b0b){_0x20b69f[_0xa390('0x3f')]=_[_0xa390('0x3c')](db['OpenchannelInteraction'][_0xa390('0x38')]);_0x20b69f[_0xa390('0x39')]=_[_0xa390('0x3c')](_0x47bcb5['query']);_0x20b69f[_0xa390('0x3d')]=_[_0xa390('0x3e')](_0x20b69f[_0xa390('0x3f')],_0x20b69f['query']);_0x19ffba[_0xa390('0x40')]=_[_0xa390('0x3e')](_0x20b69f['model'],qs['fields'](_0x47bcb5['query']['fields']));_0x19ffba[_0xa390('0x40')]=_0x19ffba[_0xa390('0x40')][_0xa390('0x42')]?_0x19ffba['attributes']:_0x20b69f[_0xa390('0x3f')];if(!_0x47bcb5[_0xa390('0x39')][_0xa390('0x5e')](_0xa390('0x43'))){_0x19ffba['limit']=qs[_0xa390('0x44')](_0x47bcb5[_0xa390('0x39')]['limit']);_0x19ffba['offset']=qs[_0xa390('0x2c')](_0x47bcb5['query'][_0xa390('0x2c')]);}_0x19ffba[_0xa390('0x45')]=qs['sort'](_0x47bcb5[_0xa390('0x39')]['sort']);_0x19ffba[_0xa390('0x4a')]=qs[_0xa390('0x3d')](_[_0xa390('0xa3')](_0x47bcb5[_0xa390('0x39')],_0x20b69f[_0xa390('0x3d')]));_0x19ffba[_0xa390('0x4a')]['OpenchannelAccountId']=_0x266b0b['id'];if(_0x47bcb5[_0xa390('0x39')][_0xa390('0x4c')]){_0x19ffba[_0xa390('0x4a')]=_[_0xa390('0x49')](_0x19ffba[_0xa390('0x4a')],{'$or':_[_0xa390('0x4b')](_0x19ffba[_0xa390('0x40')],function(_0x4c6ffc){var _0x47c770={};_0x47c770[_0x4c6ffc]={'$like':'%'+_0x47bcb5['query'][_0xa390('0x4c')]+'%'};return _0x47c770;})});}_0x19ffba=_[_0xa390('0x49')]({},_0x19ffba,_0x47bcb5[_0xa390('0x4d')]);return db[_0xa390('0x88')]['count']({'where':_0x19ffba[_0xa390('0x4a')]})['then'](function(_0xbbc1c6){_0x5bb924[_0xa390('0x2b')]=_0xbbc1c6;if(_0x47bcb5[_0xa390('0x39')][_0xa390('0x4f')]){_0x19ffba['include']=[{'model':db[_0xa390('0x7a')],'as':_0xa390('0xa4'),'required':![]},{'model':db[_0xa390('0x96')],'as':_0xa390('0xa5'),'attributes':[_0xa390('0x36'),_0xa390('0xa6'),'internal'],'required':![]},{'model':db[_0xa390('0xa7')],'as':_0xa390('0xa8'),'attributes':['id',_0xa390('0x36'),_0xa390('0xa9')],'where':_0x47bcb5[_0xa390('0x39')]['tag']?{'id':_0x47bcb5[_0xa390('0x39')][_0xa390('0xaa')]}:undefined,'required':_0x47bcb5[_0xa390('0x39')][_0xa390('0xaa')]?!![]:![]}];}return db[_0xa390('0x88')][_0xa390('0x51')](_0x19ffba);})['then'](function(_0x4be3a0){_0x5bb924[_0xa390('0x52')]=_0x4be3a0;return _0x5bb924;});}})['then'](respondWithFilteredResult(_0x3955ce,_0x19ffba))[_0xa390('0x56')](handleError(_0x3955ce,null));};exports[_0xa390('0xab')]=function(_0x1a7083,_0x8c192c,_0x38246e){return db[_0xa390('0x4e')]['find']({'where':{'id':_0x1a7083['params']['id']}})['then'](handleEntityNotFound(_0x8c192c,null))[_0xa390('0x1e')](function(_0x5012ea){if(_0x5012ea){return _0x5012ea['addAgents'](_0x1a7083[_0xa390('0x58')][_0xa390('0x61')],_[_0xa390('0xac')](_0x1a7083['body'],[_0xa390('0x61'),'id'])||{})[_0xa390('0x8b')](function(_0x48794d){for(var _0xe36c07=0x0;_0xe36c07<_0x1a7083[_0xa390('0x58')][_0xa390('0x61')][_0xa390('0x42')];_0xe36c07+=0x1){socket[_0xa390('0xad')](_0xa390('0xae'),{'UserId':_0x1a7083['body'][_0xa390('0x61')][_0xe36c07],'OpenchannelAccountId':_0x1a7083['params']['id']});}return _0x48794d;});}})['then'](respondWithResult(_0x8c192c,null))['catch'](handleError(_0x8c192c,null));};exports[_0xa390('0xaf')]=function(_0x45959e,_0x3f4455,_0x569185){var _0x4dfefd;return db['OpenchannelAccount'][_0xa390('0x55')]({'where':{'id':_0x45959e[_0xa390('0x54')]['id']}})[_0xa390('0x1e')](handleEntityNotFound(_0x3f4455,null))['then'](function(_0x5f43da){if(_0x5f43da){return _0x5f43da['removeAgents'](_0x45959e[_0xa390('0x39')][_0xa390('0x61')])[_0xa390('0x1e')](function(_0x3cc3cd){if(_[_0xa390('0xb0')](_0x45959e[_0xa390('0x39')]['ids'])){for(var _0x657e16=0x0;_0x657e16<_0x45959e[_0xa390('0x39')][_0xa390('0x61')]['length'];_0x657e16+=0x1){socket[_0xa390('0xad')](_0xa390('0xb1'),{'UserId':_0x45959e['query'][_0xa390('0x61')][_0x657e16],'OpenchannelAccountId':_0x45959e[_0xa390('0x54')]['id']});}}else{socket[_0xa390('0xad')](_0xa390('0xb1'),{'UserId':_0x45959e[_0xa390('0x39')][_0xa390('0x61')],'OpenchannelAccountId':_0x45959e[_0xa390('0x54')]['id']});}});}})['then'](respondWithStatusCode(_0x3f4455,null))['catch'](handleError(_0x3f4455,null));};exports['getAgents']=function(_0x89ea6a,_0x1249a3,_0x36950c){var _0x514750={};var _0x2e5a61={};var _0x2fbd1;var _0x23bc80;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x89ea6a[_0xa390('0x54')]['id']}})[_0xa390('0x1e')](handleEntityNotFound(_0x1249a3,null))[_0xa390('0x1e')](function(_0x35f6a6){if(_0x35f6a6){_0x2fbd1=_0x35f6a6;_0x2e5a61[_0xa390('0x3f')]=_[_0xa390('0x3c')](db[_0xa390('0x96')][_0xa390('0x38')]);_0x2e5a61['query']=_[_0xa390('0x3c')](_0x89ea6a[_0xa390('0x39')]);_0x2e5a61[_0xa390('0x3d')]=_[_0xa390('0x3e')](_0x2e5a61[_0xa390('0x3f')],_0x2e5a61[_0xa390('0x39')]);_0x514750['attributes']=_[_0xa390('0x3e')](_0x2e5a61[_0xa390('0x3f')],qs['fields'](_0x89ea6a['query'][_0xa390('0x41')]));_0x514750[_0xa390('0x40')]=_0x514750[_0xa390('0x40')][_0xa390('0x42')]?_0x514750[_0xa390('0x40')]:_0x2e5a61[_0xa390('0x3f')];_0x514750[_0xa390('0x45')]=qs[_0xa390('0x46')](_0x89ea6a[_0xa390('0x39')][_0xa390('0x46')]);_0x514750['where']=qs['filters'](_['pick'](_0x89ea6a['query'],_0x2e5a61[_0xa390('0x3d')]));if(_0x89ea6a['query'][_0xa390('0x4c')]){_0x514750[_0xa390('0x4a')]=_[_0xa390('0x49')](_0x514750[_0xa390('0x4a')],{'$or':_['map'](_0x514750[_0xa390('0x40')],function(_0x4c617c){var _0x2fcafe={};_0x2fcafe[_0x4c617c]={'$like':'%'+_0x89ea6a['query'][_0xa390('0x4c')]+'%'};return _0x2fcafe;})});}_0x514750=_[_0xa390('0x49')]({},_0x514750,_0x89ea6a['options']);return _0x2fbd1[_0xa390('0xb2')](_0x514750);}})[_0xa390('0x1e')](function(_0x4cb5ee){if(_0x4cb5ee){_0x23bc80=_0x4cb5ee['length'];if(!_0x89ea6a[_0xa390('0x39')][_0xa390('0x5e')](_0xa390('0x43'))){_0x514750['limit']=qs[_0xa390('0x44')](_0x89ea6a['query'][_0xa390('0x44')]);_0x514750['offset']=qs[_0xa390('0x2c')](_0x89ea6a[_0xa390('0x39')][_0xa390('0x2c')]);}return _0x2fbd1[_0xa390('0xb2')](_0x514750);}})[_0xa390('0x1e')](function(_0x8a2a74){if(_0x8a2a74){return _0x8a2a74?{'count':_0x23bc80,'rows':_0x8a2a74}:null;}})[_0xa390('0x1e')](respondWithResult(_0x1249a3,null))['catch'](handleError(_0x1249a3,null));};exports['send']=function(_0x44f3ea,_0x92139f,_0x4ee4ab){var _0x4f0686,_0x3804ea,_0x5b07c4;if(_['isNil'](_0x44f3ea['body'][_0xa390('0x58')])||_0x44f3ea[_0xa390('0x58')]['body']===''){throw new db[(_0xa390('0x68'))][(_0xa390('0x69'))](_0xa390('0x73'));}if(_[_0xa390('0x72')](_0x44f3ea['body']['to'])){}_0x4f0686=_0x44f3ea[_0xa390('0x58')]['to'];return db[_0xa390('0x4e')][_0xa390('0x5d')]({'where':{'id':_0x44f3ea[_0xa390('0x54')]['id']}})['then'](handleEntityNotFound(_0x92139f,null))[_0xa390('0x1e')](function(_0x1823ee){if(_0x1823ee){return db[_0xa390('0x4e')][_0xa390('0x55')]({'where':{'id':_0x1823ee['id']},'include':[{'model':db['CmList'],'as':_0xa390('0x79'),'include':[{'model':db['CmContact'],'as':_0xa390('0x84'),'where':{[_0x1823ee[_0xa390('0x76')]]:_0x4f0686},'limit':0x1,'order':[[_0xa390('0x6c'),_0xa390('0x7b')]]}]}]})[_0xa390('0x1e')](handleEntityNotFound(_0x92139f,null))[_0xa390('0x1e')](function(_0x1a2c72){if(_0x1a2c72&&_0x1a2c72['List']){_0x3804ea=_0x1a2c72[_0xa390('0xb3')]({'plain':!![]});if(_0x3804ea[_0xa390('0x79')]&&_0x3804ea['List'][_0xa390('0x84')][_0xa390('0x42')]){return _0x3804ea['List'][_0xa390('0x84')][0x0];}return db['CmContact'][_0xa390('0x57')](_[_0xa390('0x15')](_0x44f3ea[_0xa390('0x58')],{'firstName':_0x4f0686,[_0x1a2c72[_0xa390('0x76')]]:_0x4f0686,'phone':_0x4f0686,'ListId':_0x3804ea['ListId']}));}})[_0xa390('0x1e')](handleEntityNotFound(_0x92139f,null))[_0xa390('0x1e')](function(_0x9acf0){if(_0x9acf0){_0x5b07c4=_0x9acf0;return db[_0xa390('0x88')][_0xa390('0x55')]({'where':{'ContactId':_0x5b07c4['id'],'closed':![],'OpenchannelAccountId':_0x3804ea['id']}})[_0xa390('0x1e')](function(_0x55ed8d){if(_0x55ed8d){return[_0x55ed8d,![]];}return db[_0xa390('0x88')][_0xa390('0x57')]({'UserId':_0x44f3ea[_0xa390('0xb4')]['id'],'ContactId':_0x5b07c4['id'],'OpenchannelAccountId':_0x3804ea['id'],'lastMsgDirection':_0xa390('0xb5'),'Messages':[_[_0xa390('0x49')](_0x44f3ea[_0xa390('0x58')],{'read':![],'body':_0x44f3ea[_0xa390('0x58')][_0xa390('0x58')],'OpenchannelAccountId':_0x3804ea['id'],'UserId':_0x44f3ea[_0xa390('0xb4')]['id'],'ContactId':_0x5b07c4['id']})]},{'include':[{'model':db[_0xa390('0x93')],'as':_0xa390('0xb6')}]})[_0xa390('0x1e')](function(_0x2aac45){return[_0x2aac45,!![]];});});}})[_0xa390('0x8b')](function(_0x3522ca,_0x45fd35){if(_0x45fd35){return _0x3522ca;}return db[_0xa390('0x93')][_0xa390('0x57')](_[_0xa390('0x49')](_0x44f3ea[_0xa390('0x58')],{'read':![],'body':_0x44f3ea[_0xa390('0x58')][_0xa390('0x58')],'OpenchannelAccountId':_0x3804ea['id'],'OpenchannelInteractionId':_0x3522ca['id'],'UserId':_0x44f3ea['user']['id'],'ContactId':_0x5b07c4['id']}))[_0xa390('0x1e')](function(_0x482300){_0x3522ca[_0xa390('0xb7')]['Messages']=[];_0x3522ca['dataValues']['Messages'][_0xa390('0x8f')](_0x482300[_0xa390('0xb7')]);return _0x3522ca;});});}})[_0xa390('0x1e')](respondWithResult(_0x92139f,null))[_0xa390('0x56')](handleError(_0x92139f,null));}; \ No newline at end of file +var _0xdfed=['*,*,*,*','AttachmentId','User','waitForTheAssignedAgent','forcedOwnership','Start','EventManager','notify','addApplications','sequelize','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','tag','addAgents','omit','emit','removeAgents','userOpenchannelAccount:remove','getAgents','user','out','dataValues','Messages','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','http','client','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','destroy','name','send','index','OpenchannelAccount','rawAttributes','keys','query','dateStart','dateEnd','filters','attributes','fields','model','hasOwnProperty','nolimit','offset','sort','where','pick','add','day','merge','map','filter','options','includeAll','include','findAll','rows','show','params','intersection','length','create','body','find','describe','addDisposition','Disposition','getDispositions','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','findOne','order','removeAnswers','CmContact','Sequelize','ValidationError','difference','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','applications','list','orderBy','priority','asc','account','lastName','threadId','OpenchannelInteraction','externalUrl','spread','contact','firstName','interaction','get','created','autoclose','push','unmanaged'];(function(_0x4861ca,_0x53cfc8){var _0x2571ee=function(_0x4b445e){while(--_0x4b445e){_0x4861ca['push'](_0x4861ca['shift']());}};_0x2571ee(++_0x53cfc8);}(_0xdfed,0xc0));var _0xddfe=function(_0x178e71,_0x5c6c7d){_0x178e71=_0x178e71-0x0;var _0x3eec6c=_0xdfed[_0x178e71];return _0x3eec6c;};'use strict';var pdf=require(_0xddfe('0x0'));var emlformat=require(_0xddfe('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xddfe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xddfe('0x3'));var moment=require(_0xddfe('0x4'));var BPromise=require(_0xddfe('0x5'));var Mustache=require(_0xddfe('0x6'));var util=require(_0xddfe('0x7'));var path=require('path');var sox=require(_0xddfe('0x8'));var csv=require(_0xddfe('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xddfe('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xddfe('0xb'));var deskjs=require(_0xddfe('0xc'));var toCsv=require(_0xddfe('0x9'));var querystring=require(_0xddfe('0xd'));var Papa=require(_0xddfe('0xe'));var Redis=require(_0xddfe('0xf'));var qs=require('../../components/parsers/qs');var logger=require(_0xddfe('0x10'))('api');var utils=require(_0xddfe('0x11'));var config=require(_0xddfe('0x12'));var db=require('../../mysqldb')['db'];config[_0xddfe('0x13')]=_['defaults'](config[_0xddfe('0x13')],{'host':_0xddfe('0x14'),'port':0x18eb});var socket=require(_0xddfe('0x15'))(new Redis(config[_0xddfe('0x13')]));require(_0xddfe('0x16'))[_0xddfe('0x17')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xddfe('0x18')]({'port':0x232c});var client9002=jayson[_0xddfe('0x19')][_0xddfe('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x247132,_0x5c4f87,_0x545d65,_0x241141){return new BPromise(function(_0x51f47c,_0x41c5cd){var _0x3ec083=_0x241141||client;return _0x3ec083['request'](_0x247132,_0x545d65)[_0xddfe('0x1a')](function(_0x28bce9){logger['info'](_0xddfe('0x1b'),_0x5c4f87,_0xddfe('0x1c'));logger[_0xddfe('0x1d')](_0xddfe('0x1e'),_0x5c4f87,'request\x20sent',JSON[_0xddfe('0x1f')](_0x28bce9));if(_0x28bce9[_0xddfe('0x20')]){if(_0x28bce9[_0xddfe('0x20')][_0xddfe('0x21')]===0x1f4){logger[_0xddfe('0x20')](_0xddfe('0x1b'),_0x5c4f87,_0x28bce9[_0xddfe('0x20')]['message']);return _0x41c5cd(_0x28bce9[_0xddfe('0x20')]['message']);}logger['error'](_0xddfe('0x1b'),_0x5c4f87,_0x28bce9[_0xddfe('0x20')][_0xddfe('0x22')]);return _0x51f47c(_0x28bce9[_0xddfe('0x20')][_0xddfe('0x22')]);}else{logger[_0xddfe('0x23')](_0xddfe('0x1b'),_0x5c4f87,_0xddfe('0x1c'));_0x51f47c(_0x28bce9[_0xddfe('0x24')][_0xddfe('0x22')]);}})[_0xddfe('0x25')](function(_0x110e8a){logger[_0xddfe('0x20')](_0xddfe('0x1b'),_0x5c4f87,_0x110e8a);_0x41c5cd(_0x110e8a);});});}function respondWithStatusCode(_0x4204cc,_0x4e776d){_0x4e776d=_0x4e776d||0xcc;return function(_0xb3a15e){if(_0xb3a15e){return _0x4204cc[_0xddfe('0x26')](_0x4e776d);}return _0x4204cc[_0xddfe('0x27')](_0x4e776d)[_0xddfe('0x28')]();};}function respondWithResult(_0x584356,_0x59f150){_0x59f150=_0x59f150||0xc8;return function(_0x31452e){if(_0x31452e){return _0x584356[_0xddfe('0x27')](_0x59f150)[_0xddfe('0x29')](_0x31452e);}};}function respondWithFilteredResult(_0x2a190a,_0x4cb52a){return function(_0x49fad0){if(_0x49fad0){var _0x3f6c9a=_0x49fad0[_0xddfe('0x2a')],_0x41b61f=_0x4cb52a['offset'],_0x34018f=_0x4cb52a['offset']+_0x4cb52a[_0xddfe('0x2b')],_0x23f2e6;if(_0x34018f>=_0x3f6c9a){_0x34018f=_0x3f6c9a;_0x23f2e6=0xc8;}else{_0x23f2e6=0xce;}_0x2a190a['status'](_0x23f2e6);return _0x2a190a[_0xddfe('0x2c')](_0xddfe('0x2d'),_0x41b61f+'-'+_0x34018f+'/'+_0x3f6c9a)[_0xddfe('0x29')](_0x49fad0);}return null;};}function patchUpdates(_0x6f610f){return function(_0x2cfedd){try{jsonpatch[_0xddfe('0x2e')](_0x2cfedd,_0x6f610f,!![]);}catch(_0x251ca3){return BPromise[_0xddfe('0x2f')](_0x251ca3);}return _0x2cfedd[_0xddfe('0x30')]();};}function saveUpdates(_0x30d429,_0x58ecaf){return function(_0xa7170e){if(_0xa7170e){return _0xa7170e[_0xddfe('0x31')](_0x30d429)[_0xddfe('0x1a')](function(_0xae0f6f){return _0xae0f6f;});}return null;};}function removeEntity(_0x341e1a,_0x4dc6b7){return function(_0x10a385){if(_0x10a385){return _0x10a385[_0xddfe('0x32')]()[_0xddfe('0x1a')](function(){_0x341e1a[_0xddfe('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x361272,_0x4e7d0d){return function(_0x5358c4){if(!_0x5358c4){_0x361272[_0xddfe('0x26')](0x194);}return _0x5358c4;};}function handleError(_0x584801,_0x1ca432){_0x1ca432=_0x1ca432||0x1f4;return function(_0x107b6c){logger[_0xddfe('0x20')](_0x107b6c['stack']);if(_0x107b6c[_0xddfe('0x33')]){delete _0x107b6c[_0xddfe('0x33')];}_0x584801[_0xddfe('0x27')](_0x1ca432)[_0xddfe('0x34')](_0x107b6c);};}exports[_0xddfe('0x35')]=function(_0x580209,_0x419fba){var _0x25e170={},_0x3a85fd={},_0x4eba50={'count':0x0,'rows':[]};var _0x372269=db[_0xddfe('0x36')][_0xddfe('0x37')];_0x3a85fd['model']=_[_0xddfe('0x38')](_0x372269);var _0x4fc946={'dateStart':_0x580209[_0xddfe('0x39')][_0xddfe('0x3a')],'dateEnd':_0x580209[_0xddfe('0x39')][_0xddfe('0x3b')]};delete _0x580209['query'][_0xddfe('0x3a')];delete _0x580209[_0xddfe('0x39')][_0xddfe('0x3b')];_0x3a85fd[_0xddfe('0x39')]=_['keys'](_0x580209['query']);_0x3a85fd[_0xddfe('0x3c')]=_['intersection'](_0x3a85fd['model'],_0x3a85fd[_0xddfe('0x39')]);_0x25e170[_0xddfe('0x3d')]=_['intersection'](_0x3a85fd['model'],qs[_0xddfe('0x3e')](_0x580209[_0xddfe('0x39')][_0xddfe('0x3e')]));_0x25e170[_0xddfe('0x3d')]=_0x25e170[_0xddfe('0x3d')]['length']?_0x25e170['attributes']:_0x3a85fd[_0xddfe('0x3f')];if(!_0x580209[_0xddfe('0x39')][_0xddfe('0x40')](_0xddfe('0x41'))){_0x25e170[_0xddfe('0x2b')]=qs[_0xddfe('0x2b')](_0x580209[_0xddfe('0x39')]['limit']);_0x25e170[_0xddfe('0x42')]=qs[_0xddfe('0x42')](_0x580209['query'][_0xddfe('0x42')]);}_0x25e170['order']=qs['sort'](_0x580209[_0xddfe('0x39')][_0xddfe('0x43')]);_0x25e170[_0xddfe('0x44')]=qs[_0xddfe('0x3c')](_[_0xddfe('0x45')](_0x580209[_0xddfe('0x39')],_0x3a85fd[_0xddfe('0x3c')]));if(_0x4fc946['dateStart']){if(_0x4fc946[_0xddfe('0x3b')]){_0x4fc946[_0xddfe('0x3b')]=moment(_0x4fc946[_0xddfe('0x3b')])[_0xddfe('0x46')](0x1,_0xddfe('0x47'));}else{_0x4fc946[_0xddfe('0x3b')]=moment(_0x4fc946['dateStart'])[_0xddfe('0x46')](0x1,'day');}_[_0xddfe('0x48')](_0x25e170[_0xddfe('0x44')],{'createdAt':{'$gte':_0x4fc946['dateStart'],'$lte':_0x4fc946[_0xddfe('0x3b')]}});}if(_0x580209['query']['filter']){_0x25e170[_0xddfe('0x44')]=_[_0xddfe('0x48')](_0x25e170[_0xddfe('0x44')],{'$or':_[_0xddfe('0x49')](_0x25e170[_0xddfe('0x3d')],function(_0x4d6b3e){var _0x4dd1fb={};_0x4dd1fb[_0x4d6b3e]={'$like':'%'+_0x580209[_0xddfe('0x39')][_0xddfe('0x4a')]+'%'};return _0x4dd1fb;})});}_0x25e170=_['merge']({},_0x25e170,_0x580209[_0xddfe('0x4b')]);var _0x493609={'where':_0x25e170[_0xddfe('0x44')]};return db[_0xddfe('0x36')][_0xddfe('0x2a')](_0x493609)[_0xddfe('0x1a')](function(_0x5cc243){_0x4eba50['count']=_0x5cc243;if(_0x580209['query'][_0xddfe('0x4c')]){_0x25e170[_0xddfe('0x4d')]=[{'all':!![]}];}return db[_0xddfe('0x36')][_0xddfe('0x4e')](_0x25e170);})[_0xddfe('0x1a')](function(_0x304e9a){_0x4eba50[_0xddfe('0x4f')]=_0x304e9a;return _0x4eba50;})[_0xddfe('0x1a')](respondWithFilteredResult(_0x419fba,_0x25e170))[_0xddfe('0x25')](handleError(_0x419fba,null));};exports[_0xddfe('0x50')]=function(_0x1144a6,_0x32cabd){var _0x589dcf={'raw':![],'where':{'id':_0x1144a6[_0xddfe('0x51')]['id']}},_0x31a965={};_0x31a965[_0xddfe('0x3f')]=_[_0xddfe('0x38')](db[_0xddfe('0x36')]['rawAttributes']);_0x31a965[_0xddfe('0x39')]=_[_0xddfe('0x38')](_0x1144a6[_0xddfe('0x39')]);_0x31a965['filters']=_[_0xddfe('0x52')](_0x31a965[_0xddfe('0x3f')],_0x31a965[_0xddfe('0x39')]);_0x589dcf[_0xddfe('0x3d')]=_[_0xddfe('0x52')](_0x31a965[_0xddfe('0x3f')],qs['fields'](_0x1144a6[_0xddfe('0x39')][_0xddfe('0x3e')]));_0x589dcf['attributes']=_0x589dcf[_0xddfe('0x3d')][_0xddfe('0x53')]?_0x589dcf[_0xddfe('0x3d')]:_0x31a965[_0xddfe('0x3f')];if(_0x1144a6[_0xddfe('0x39')][_0xddfe('0x4c')]){_0x589dcf['include']=[{'all':!![]}];}_0x589dcf=_[_0xddfe('0x48')]({},_0x589dcf,_0x1144a6['options']);return db[_0xddfe('0x36')]['find'](_0x589dcf)[_0xddfe('0x1a')](handleEntityNotFound(_0x32cabd,null))[_0xddfe('0x1a')](respondWithResult(_0x32cabd,null))[_0xddfe('0x25')](handleError(_0x32cabd,null));};exports[_0xddfe('0x54')]=function(_0x2feec7,_0x2d2848){return db[_0xddfe('0x36')][_0xddfe('0x54')](_0x2feec7[_0xddfe('0x55')],{})[_0xddfe('0x1a')](respondWithResult(_0x2d2848,0xc9))['catch'](handleError(_0x2d2848,null));};exports[_0xddfe('0x31')]=function(_0x263bbd,_0xf38106){if(_0x263bbd[_0xddfe('0x55')]['id']){delete _0x263bbd[_0xddfe('0x55')]['id'];}return db[_0xddfe('0x36')][_0xddfe('0x56')]({'where':{'id':_0x263bbd[_0xddfe('0x51')]['id']}})['then'](handleEntityNotFound(_0xf38106,null))[_0xddfe('0x1a')](saveUpdates(_0x263bbd[_0xddfe('0x55')],null))[_0xddfe('0x1a')](respondWithResult(_0xf38106,null))[_0xddfe('0x25')](handleError(_0xf38106,null));};exports[_0xddfe('0x32')]=function(_0x4bbf48,_0x5f2904){return db[_0xddfe('0x36')][_0xddfe('0x56')]({'where':{'id':_0x4bbf48[_0xddfe('0x51')]['id']}})[_0xddfe('0x1a')](handleEntityNotFound(_0x5f2904,null))[_0xddfe('0x1a')](removeEntity(_0x5f2904,null))[_0xddfe('0x25')](handleError(_0x5f2904,null));};exports[_0xddfe('0x57')]=function(_0x5ab8e6,_0x472b53){return db['OpenchannelAccount']['describe']()[_0xddfe('0x1a')](respondWithResult(_0x472b53,null))['catch'](handleError(_0x472b53,null));};exports[_0xddfe('0x58')]=function(_0x4ed04d,_0x1783c1,_0x2ed233){if(_0x4ed04d[_0xddfe('0x55')]['id']){delete _0x4ed04d[_0xddfe('0x55')]['id'];}return db['OpenchannelAccount'][_0xddfe('0x56')]({'where':{'id':_0x4ed04d['params']['id']}})[_0xddfe('0x1a')](handleEntityNotFound(_0x1783c1,null))['then'](function(_0x5bc684){if(_0x5bc684){_0x4ed04d[_0xddfe('0x55')]['OpnechannelAccountId']=_0x5bc684['id'];return db[_0xddfe('0x59')][_0xddfe('0x54')](_0x4ed04d[_0xddfe('0x55')]);}})['then'](respondWithResult(_0x1783c1,null))[_0xddfe('0x25')](handleError(_0x1783c1,null));};exports[_0xddfe('0x5a')]=function(_0x53997e,_0x56f07d,_0x528bc2){var _0x30418c={'raw':![],'where':{}};var _0xb4a5b9={};var _0x46e7ca={'count':0x0,'rows':[]};return db[_0xddfe('0x36')]['findOne']({'where':{'id':_0x53997e[_0xddfe('0x51')]['id']}})[_0xddfe('0x1a')](handleEntityNotFound(_0x56f07d,null))[_0xddfe('0x1a')](function(_0xb1a3bb){if(_0xb1a3bb){_0xb4a5b9['model']=_[_0xddfe('0x38')](db[_0xddfe('0x59')][_0xddfe('0x37')]);_0xb4a5b9[_0xddfe('0x39')]=_[_0xddfe('0x38')](_0x53997e['query']);_0xb4a5b9[_0xddfe('0x3c')]=_[_0xddfe('0x52')](_0xb4a5b9[_0xddfe('0x3f')],_0xb4a5b9[_0xddfe('0x39')]);_0x30418c[_0xddfe('0x3d')]=_[_0xddfe('0x52')](_0xb4a5b9[_0xddfe('0x3f')],qs[_0xddfe('0x3e')](_0x53997e[_0xddfe('0x39')][_0xddfe('0x3e')]));_0x30418c[_0xddfe('0x3d')]=_0x30418c[_0xddfe('0x3d')][_0xddfe('0x53')]?_0x30418c[_0xddfe('0x3d')]:_0xb4a5b9['model'];if(!_0x53997e[_0xddfe('0x39')][_0xddfe('0x40')](_0xddfe('0x41'))){_0x30418c[_0xddfe('0x2b')]=qs[_0xddfe('0x2b')](_0x53997e[_0xddfe('0x39')][_0xddfe('0x2b')]);_0x30418c['offset']=qs[_0xddfe('0x42')](_0x53997e[_0xddfe('0x39')][_0xddfe('0x42')]);}_0x30418c['order']=qs[_0xddfe('0x43')](_0x53997e[_0xddfe('0x39')][_0xddfe('0x43')]);_0x30418c['where']=qs['filters'](_['pick'](_0x53997e['query'],_0xb4a5b9[_0xddfe('0x3c')]));_0x30418c[_0xddfe('0x44')][_0xddfe('0x5b')]=_0xb1a3bb['id'];if(_0x53997e['query'][_0xddfe('0x4a')]){_0x30418c[_0xddfe('0x44')]=_[_0xddfe('0x48')](_0x30418c['where'],{'$or':_[_0xddfe('0x49')](_0x30418c[_0xddfe('0x3d')],function(_0x1f1543){var _0x57989c={};_0x57989c[_0x1f1543]={'$like':'%'+_0x53997e[_0xddfe('0x39')][_0xddfe('0x4a')]+'%'};return _0x57989c;})});}_0x30418c=_[_0xddfe('0x48')]({},_0x30418c,_0x53997e[_0xddfe('0x4b')]);return db['Disposition'][_0xddfe('0x2a')]({'where':_0x30418c[_0xddfe('0x44')]})[_0xddfe('0x1a')](function(_0x548baf){_0x46e7ca['count']=_0x548baf;if(_0x53997e[_0xddfe('0x39')][_0xddfe('0x4c')]){_0x30418c[_0xddfe('0x4d')]=[{'all':!![]}];}return db[_0xddfe('0x59')][_0xddfe('0x4e')](_0x30418c);})[_0xddfe('0x1a')](function(_0x1f3696){_0x46e7ca[_0xddfe('0x4f')]=_0x1f3696;return _0x46e7ca;});}})[_0xddfe('0x1a')](respondWithFilteredResult(_0x56f07d,_0x30418c))[_0xddfe('0x25')](handleError(_0x56f07d,null));};exports[_0xddfe('0x5c')]=function(_0x29504f,_0x50c549,_0xb52967){var _0x2b22ea;return db['OpenchannelAccount'][_0xddfe('0x56')]({'where':{'id':_0x29504f[_0xddfe('0x51')]['id']}})[_0xddfe('0x1a')](handleEntityNotFound(_0x50c549,null))['then'](function(_0x1c0084){if(_0x1c0084){return _0x1c0084[_0xddfe('0x5c')](_0x29504f[_0xddfe('0x39')][_0xddfe('0x5d')]);}})[_0xddfe('0x1a')](respondWithStatusCode(_0x50c549,null))['catch'](handleError(_0x50c549,null));};exports[_0xddfe('0x5e')]=function(_0x1a4bd5,_0x1ec645,_0x57e77f){if(_0x1a4bd5[_0xddfe('0x55')]['id']){delete _0x1a4bd5[_0xddfe('0x55')]['id'];}return db[_0xddfe('0x36')][_0xddfe('0x56')]({'where':{'id':_0x1a4bd5[_0xddfe('0x51')]['id']}})[_0xddfe('0x1a')](handleEntityNotFound(_0x1ec645,null))[_0xddfe('0x1a')](function(_0x2b4e05){if(_0x2b4e05){_0x1a4bd5['body'][_0xddfe('0x5b')]=_0x2b4e05['id'];return db[_0xddfe('0x5f')][_0xddfe('0x54')](_0x1a4bd5[_0xddfe('0x55')]);}})['then'](respondWithResult(_0x1ec645,null))[_0xddfe('0x25')](handleError(_0x1ec645,null));};exports['getAnswers']=function(_0x22855c,_0x11c1e8,_0x57db6c){var _0x4dedb7={'raw':![],'where':{}};var _0x4980af={};var _0x341b8c={'count':0x0,'rows':[]};return db[_0xddfe('0x36')][_0xddfe('0x60')]({'where':{'id':_0x22855c[_0xddfe('0x51')]['id']}})[_0xddfe('0x1a')](handleEntityNotFound(_0x11c1e8,null))[_0xddfe('0x1a')](function(_0x3fface){if(_0x3fface){_0x4980af[_0xddfe('0x3f')]=_[_0xddfe('0x38')](db[_0xddfe('0x5f')][_0xddfe('0x37')]);_0x4980af[_0xddfe('0x39')]=_[_0xddfe('0x38')](_0x22855c[_0xddfe('0x39')]);_0x4980af[_0xddfe('0x3c')]=_['intersection'](_0x4980af[_0xddfe('0x3f')],_0x4980af[_0xddfe('0x39')]);_0x4dedb7[_0xddfe('0x3d')]=_[_0xddfe('0x52')](_0x4980af['model'],qs['fields'](_0x22855c[_0xddfe('0x39')][_0xddfe('0x3e')]));_0x4dedb7[_0xddfe('0x3d')]=_0x4dedb7['attributes'][_0xddfe('0x53')]?_0x4dedb7[_0xddfe('0x3d')]:_0x4980af[_0xddfe('0x3f')];if(!_0x22855c[_0xddfe('0x39')][_0xddfe('0x40')](_0xddfe('0x41'))){_0x4dedb7[_0xddfe('0x2b')]=qs['limit'](_0x22855c[_0xddfe('0x39')][_0xddfe('0x2b')]);_0x4dedb7['offset']=qs['offset'](_0x22855c[_0xddfe('0x39')][_0xddfe('0x42')]);}_0x4dedb7[_0xddfe('0x61')]=qs[_0xddfe('0x43')](_0x22855c[_0xddfe('0x39')]['sort']);_0x4dedb7[_0xddfe('0x44')]=qs['filters'](_[_0xddfe('0x45')](_0x22855c[_0xddfe('0x39')],_0x4980af['filters']));_0x4dedb7['where']['OpenchannelAccountId']=_0x3fface['id'];if(_0x22855c['query']['filter']){_0x4dedb7[_0xddfe('0x44')]=_['merge'](_0x4dedb7[_0xddfe('0x44')],{'$or':_['map'](_0x4dedb7[_0xddfe('0x3d')],function(_0x799d91){var _0x253049={};_0x253049[_0x799d91]={'$like':'%'+_0x22855c[_0xddfe('0x39')][_0xddfe('0x4a')]+'%'};return _0x253049;})});}_0x4dedb7=_[_0xddfe('0x48')]({},_0x4dedb7,_0x22855c[_0xddfe('0x4b')]);return db[_0xddfe('0x5f')][_0xddfe('0x2a')]({'where':_0x4dedb7['where']})[_0xddfe('0x1a')](function(_0x80c857){_0x341b8c[_0xddfe('0x2a')]=_0x80c857;if(_0x22855c[_0xddfe('0x39')]['includeAll']){_0x4dedb7[_0xddfe('0x4d')]=[{'all':!![]}];}return db[_0xddfe('0x5f')][_0xddfe('0x4e')](_0x4dedb7);})[_0xddfe('0x1a')](function(_0x2a3212){_0x341b8c['rows']=_0x2a3212;return _0x341b8c;});}})[_0xddfe('0x1a')](respondWithFilteredResult(_0x11c1e8,_0x4dedb7))[_0xddfe('0x25')](handleError(_0x11c1e8,null));};exports[_0xddfe('0x62')]=function(_0x100d99,_0x1a3f7b,_0x4ed3ed){var _0x19f743;return db['OpenchannelAccount'][_0xddfe('0x56')]({'where':{'id':_0x100d99[_0xddfe('0x51')]['id']}})[_0xddfe('0x1a')](handleEntityNotFound(_0x1a3f7b,null))[_0xddfe('0x1a')](function(_0xdf2cee){if(_0xdf2cee){return _0xdf2cee['removeAnswers'](_0x100d99[_0xddfe('0x39')]['ids']);}})['then'](respondWithStatusCode(_0x1a3f7b,null))['catch'](handleError(_0x1a3f7b,null));};exports['notify']=function(_0xe07275,_0x48c494,_0x3c7964){var _0x3fd7ca={'body':_0xe07275['body'],'channel':'openchannel'};var _0x57efef=[];var _0x3a6d1c=[];var _0x5d2bfb={};var _0x1dceb6=![];return db[_0xddfe('0x63')][_0xddfe('0x57')]()[_0xddfe('0x1a')](function(_0x5f2b59){if(!_0x5f2b59){throw new db[(_0xddfe('0x64'))][(_0xddfe('0x65'))]('no\x20available\x20attributes');}_0x57efef=_[_0xddfe('0x66')](_['keys'](_0x5f2b59),['createdAt',_0xddfe('0x67')]);_0x3a6d1c=_['difference'](_[_0xddfe('0x38')](_0x5f2b59),['createdAt',_0xddfe('0x67'),_0xddfe('0x68'),_0xddfe('0x69')]);if(_0xe07275[_0xddfe('0x55')]['id']){delete _0xe07275[_0xddfe('0x55')]['id'];}if(_[_0xddfe('0x6a')](_0xe07275[_0xddfe('0x55')][_0xddfe('0x6b')])){throw new db[(_0xddfe('0x64'))][(_0xddfe('0x65'))](_0xddfe('0x6c'));}if(_[_0xddfe('0x6a')](_0xe07275['body']['body'])||_0xe07275[_0xddfe('0x55')][_0xddfe('0x55')]===''){throw new db['Sequelize'][(_0xddfe('0x65'))](_0xddfe('0x6d'));}if(_['isNil'](_0xe07275['body'][_0xddfe('0x6e')])){throw new db[(_0xddfe('0x64'))]['ValidationError'](_0xddfe('0x6f')+_0x3a6d1c);}if(!_[_0xddfe('0x70')](_0x3a6d1c,_0xe07275[_0xddfe('0x55')]['mapKey'])){throw new db[(_0xddfe('0x64'))][(_0xddfe('0x65'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3a6d1c);}_0x5d2bfb[_0xe07275['body'][_0xddfe('0x6e')]]=_0xe07275[_0xddfe('0x55')][_0xddfe('0x6b')];})[_0xddfe('0x1a')](function(){return db[_0xddfe('0x36')][_0xddfe('0x56')]({'where':{'id':_0xe07275[_0xddfe('0x51')]['id']},'include':[{'model':db[_0xddfe('0x71')],'as':_0xddfe('0x72'),'include':[{'model':db[_0xddfe('0x63')],'as':_0xddfe('0x73'),'where':_0x5d2bfb,'limit':0x1,'order':[[_0xddfe('0x67'),_0xddfe('0x74')]]}]},{'model':db[_0xddfe('0x75')],'as':_0xddfe('0x76')}]});})['then'](handleEntityNotFound(_0x48c494,null))[_0xddfe('0x1a')](function(_0x1b1b69){if(_0x1b1b69&&_0x1b1b69[_0xddfe('0x72')]){_0x3fd7ca['account']=_0x1b1b69;_0x3fd7ca[_0xddfe('0x77')]=_0x1b1b69[_0xddfe('0x76')];_0x3fd7ca[_0xddfe('0x78')]=_0x1b1b69[_0xddfe('0x72')];_0x3fd7ca[_0xddfe('0x77')]=_[_0xddfe('0x79')](_0x3fd7ca['applications'],[_0xddfe('0x7a')],[_0xddfe('0x7b')]);if(_0x3fd7ca[_0xddfe('0x7c')][_0xddfe('0x76')]){delete _0x3fd7ca[_0xddfe('0x7c')][_0xddfe('0x76')];}if(_0x3fd7ca[_0xddfe('0x7c')][_0xddfe('0x72')]&&_0x3fd7ca[_0xddfe('0x7c')][_0xddfe('0x72')]['Contacts'][_0xddfe('0x53')]){return _0x3fd7ca['account']['List'][_0xddfe('0x73')][0x0];}var _0x72056a=_['defaults'](_0xe07275[_0xddfe('0x55')],{'firstName':_0xe07275[_0xddfe('0x55')]['from'],'ListId':_0x1b1b69[_0xddfe('0x69')]});_0x72056a[_0xe07275['body'][_0xddfe('0x6e')]]=_0xe07275['body'][_0xddfe('0x6b')];return db[_0xddfe('0x63')]['create'](_0x72056a,{'fields':_0x57efef,'raw':!![]});}})[_0xddfe('0x1a')](handleEntityNotFound(_0x48c494,null))['then'](function(_0x1f5fe4){_0x3fd7ca['contact']=_0x1f5fe4;if(_0x1f5fe4){var _0x5d525f={'ContactId':_0x1f5fe4['id'],'OpenchannelAccountId':_0xe07275[_0xddfe('0x51')]['id'],'from':(_0x1f5fe4['firstName']||'')+'\x20'+(_0x1f5fe4[_0xddfe('0x7d')]||'')};var _0x15d312={'OpenchannelAccountId':_0xe07275[_0xddfe('0x51')]['id'],'closed':![]};if(_0xe07275[_0xddfe('0x55')][_0xddfe('0x7e')]){_0x15d312[_0xddfe('0x7e')]=_0xe07275[_0xddfe('0x55')]['threadId'];return db[_0xddfe('0x7f')]['find']({'where':_0x15d312})[_0xddfe('0x1a')](function(_0x2271dd){if(_0x2271dd){return[_0x2271dd,![]];}_0x5d525f[_0xddfe('0x7e')]=_0xe07275[_0xddfe('0x55')][_0xddfe('0x7e')];_0x5d525f[_0xddfe('0x80')]=_0xe07275['body']['externalUrl'];return db[_0xddfe('0x7f')][_0xddfe('0x54')](_0x5d525f)['then'](function(_0x512e68){return[_0x512e68,!![]];});});}else{_0x15d312[_0xddfe('0x7e')]=null;}_0x15d312['ContactId']=_0x1f5fe4['id'];return db[_0xddfe('0x7f')]['find']({'where':_0x15d312})[_0xddfe('0x1a')](function(_0x3cae95){if(_0x3cae95){return[_0x3cae95,![]];}return db[_0xddfe('0x7f')][_0xddfe('0x54')](_0x5d525f)[_0xddfe('0x1a')](function(_0x4f4f69){return[_0x4f4f69,!![]];});});}})[_0xddfe('0x81')](function(_0x4443bb,_0xd8eca4){if(_0x4443bb){_0x1dceb6=_0xd8eca4;if(!_0xd8eca4){return _0x4443bb['update']({'from':(_0x3fd7ca[_0xddfe('0x82')][_0xddfe('0x83')]||'')+'\x20'+(_0x3fd7ca[_0xddfe('0x82')][_0xddfe('0x7d')]||'')});}else{return _0x4443bb;}}})[_0xddfe('0x1a')](function(_0x1db649){_0x3fd7ca[_0xddfe('0x84')]=_0x1db649[_0xddfe('0x85')]({'plain':!![]});_0x3fd7ca[_0xddfe('0x84')]['created']=_0x1dceb6;if(_0x3fd7ca[_0xddfe('0x84')][_0xddfe('0x86')]){if(_0x3fd7ca[_0xddfe('0x7c')][_0xddfe('0x87')]){_0x3fd7ca[_0xddfe('0x77')][_0xddfe('0x88')]({'id':0x0,'priority':_0x3fd7ca['applications'][_0xddfe('0x53')]+0x1,'app':'close','appdata':_0xddfe('0x89'),'interval':_0xddfe('0x8a')});}}return db['OpenchannelMessage'][_0xddfe('0x54')]({'body':_0xe07275['body'][_0xddfe('0x55')],'OpenchannelAccountId':_0xe07275[_0xddfe('0x51')]['id'],'OpenchannelInteractionId':_0x1db649['id'],'direction':'in','ContactId':_0x3fd7ca['contact']['id'],'AttachmentId':_0xe07275[_0xddfe('0x55')][_0xddfe('0x8b')]});})['then'](function(_0x289ecc){_0x3fd7ca[_0xddfe('0x22')]=_0x289ecc;if(_0x3fd7ca[_0xddfe('0x84')]['UserId']){return db[_0xddfe('0x8c')][_0xddfe('0x56')]({'attributes':['id',_0xddfe('0x33')],'where':{'id':_0x3fd7ca['interaction']['UserId']}})[_0xddfe('0x1a')](function(_0x44e1e6){if(_0x44e1e6){_0x3fd7ca['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x44e1e6[_0xddfe('0x33')]+','+(_0x3fd7ca[_0xddfe('0x7c')][_0xddfe('0x8d')]||0xa),'interval':_0xddfe('0x8a')});_0x3fd7ca[_0xddfe('0x8e')]=![];}return respondWithRpcPromise(_0xddfe('0x8f'),'startRouting',_0x3fd7ca);});}return respondWithRpcPromise(_0xddfe('0x8f'),'startRouting',_0x3fd7ca);})['then'](function(_0x17d15b){respondWithRpcPromise(_0xddfe('0x90'),_0xddfe('0x90'),{'event':_0xddfe('0x91'),'message':_0x17d15b},client9002);return _0x17d15b;})[_0xddfe('0x1a')](respondWithResult(_0x48c494,null))[_0xddfe('0x25')](handleError(_0x48c494,null));};exports[_0xddfe('0x92')]=function(_0x364e54,_0x507fb2,_0x2d8e40){return db[_0xddfe('0x36')][_0xddfe('0x60')]({'where':{'id':_0x364e54[_0xddfe('0x51')]['id']}})[_0xddfe('0x1a')](handleEntityNotFound(_0x507fb2,null))[_0xddfe('0x1a')](function(_0x3dc871){if(_0x3dc871){return db[_0xddfe('0x93')]['transaction'](function(_0x3d0fa){return db[_0xddfe('0x75')][_0xddfe('0x32')]({'where':{'OpenchannelAccountId':_0x364e54['params']['id']},'transaction':_0x3d0fa})[_0xddfe('0x1a')](function(_0x243799){var _0x37f0e7=_[_0xddfe('0x49')](_0x364e54[_0xddfe('0x55')],function(_0x118aa3){_0x118aa3[_0xddfe('0x5b')]=_0x364e54[_0xddfe('0x51')]['id'];return _0x118aa3;});return db[_0xddfe('0x75')][_0xddfe('0x94')](_0x37f0e7,{'transaction':_0x3d0fa});});})['then'](function(){return db['OpenchannelApplication'][_0xddfe('0x95')]({'where':{'OpenchannelAccountId':_0x364e54[_0xddfe('0x51')]['id']},'order':_0xddfe('0x7a')});});}})[_0xddfe('0x1a')](respondWithResult(_0x507fb2,null))[_0xddfe('0x25')](handleError(_0x507fb2,null));};exports['getApplications']=function(_0x25af1b,_0x3b7c51,_0x3b79fd){var _0x390b32={};var _0x54a801={};var _0x2a34b2;var _0x10d117;return db[_0xddfe('0x36')]['findOne']({'where':{'id':_0x25af1b[_0xddfe('0x51')]['id']}})[_0xddfe('0x1a')](handleEntityNotFound(_0x3b7c51,null))['then'](function(_0x15c20d){if(_0x15c20d){_0x2a34b2=_0x15c20d;_0x54a801[_0xddfe('0x3f')]=_['keys'](db[_0xddfe('0x75')][_0xddfe('0x37')]);_0x54a801[_0xddfe('0x39')]=_[_0xddfe('0x38')](_0x25af1b[_0xddfe('0x39')]);_0x54a801[_0xddfe('0x3c')]=_['intersection'](_0x54a801[_0xddfe('0x3f')],_0x54a801[_0xddfe('0x39')]);_0x390b32[_0xddfe('0x3d')]=_[_0xddfe('0x52')](_0x54a801[_0xddfe('0x3f')],qs[_0xddfe('0x3e')](_0x25af1b[_0xddfe('0x39')]['fields']));_0x390b32[_0xddfe('0x3d')]=_0x390b32[_0xddfe('0x3d')]['length']?_0x390b32[_0xddfe('0x3d')]:_0x54a801[_0xddfe('0x3f')];_0x390b32[_0xddfe('0x61')]=qs[_0xddfe('0x43')](_0x25af1b[_0xddfe('0x39')]['sort']);_0x390b32[_0xddfe('0x44')]=qs[_0xddfe('0x3c')](_[_0xddfe('0x45')](_0x25af1b[_0xddfe('0x39')],_0x54a801['filters']));if(_0x25af1b['query']['filter']){_0x390b32[_0xddfe('0x44')]=_['merge'](_0x390b32[_0xddfe('0x44')],{'$or':_[_0xddfe('0x49')](_0x390b32[_0xddfe('0x3d')],function(_0x1e9cd6){var _0x57660e={};_0x57660e[_0x1e9cd6]={'$like':'%'+_0x25af1b[_0xddfe('0x39')][_0xddfe('0x4a')]+'%'};return _0x57660e;})});}_0x390b32=_[_0xddfe('0x48')]({},_0x390b32,_0x25af1b[_0xddfe('0x4b')]);return _0x2a34b2[_0xddfe('0x96')](_0x390b32);}})[_0xddfe('0x1a')](function(_0x11a6c1){if(_0x11a6c1){_0x10d117=_0x11a6c1[_0xddfe('0x53')];if(!_0x25af1b[_0xddfe('0x39')][_0xddfe('0x40')](_0xddfe('0x41'))){_0x390b32['limit']=qs['limit'](_0x25af1b[_0xddfe('0x39')]['limit']);_0x390b32[_0xddfe('0x42')]=qs[_0xddfe('0x42')](_0x25af1b[_0xddfe('0x39')][_0xddfe('0x42')]);}return _0x2a34b2[_0xddfe('0x96')](_0x390b32);}})[_0xddfe('0x1a')](function(_0x27a672){if(_0x27a672){return _0x27a672?{'count':_0x10d117,'rows':_0x27a672}:null;}})[_0xddfe('0x1a')](respondWithResult(_0x3b7c51,null))[_0xddfe('0x25')](handleError(_0x3b7c51,null));};exports[_0xddfe('0x97')]=function(_0x137980,_0xeb66f2,_0xd71de3){var _0x3336d6={'raw':![],'where':{}};var _0x388426={};var _0x5411a0={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xddfe('0x60')]({'where':{'id':_0x137980[_0xddfe('0x51')]['id']}})[_0xddfe('0x1a')](handleEntityNotFound(_0xeb66f2,null))['then'](function(_0xb361a7){if(_0xb361a7){_0x388426[_0xddfe('0x3f')]=_[_0xddfe('0x38')](db['OpenchannelInteraction'][_0xddfe('0x37')]);_0x388426[_0xddfe('0x39')]=_[_0xddfe('0x38')](_0x137980['query']);_0x388426['filters']=_[_0xddfe('0x52')](_0x388426[_0xddfe('0x3f')],_0x388426[_0xddfe('0x39')]);_0x3336d6[_0xddfe('0x3d')]=_[_0xddfe('0x52')](_0x388426[_0xddfe('0x3f')],qs[_0xddfe('0x3e')](_0x137980[_0xddfe('0x39')]['fields']));_0x3336d6[_0xddfe('0x3d')]=_0x3336d6[_0xddfe('0x3d')]['length']?_0x3336d6[_0xddfe('0x3d')]:_0x388426[_0xddfe('0x3f')];if(!_0x137980[_0xddfe('0x39')][_0xddfe('0x40')](_0xddfe('0x41'))){_0x3336d6[_0xddfe('0x2b')]=qs[_0xddfe('0x2b')](_0x137980['query'][_0xddfe('0x2b')]);_0x3336d6[_0xddfe('0x42')]=qs[_0xddfe('0x42')](_0x137980['query']['offset']);}_0x3336d6[_0xddfe('0x61')]=qs['sort'](_0x137980[_0xddfe('0x39')]['sort']);_0x3336d6[_0xddfe('0x44')]=qs['filters'](_[_0xddfe('0x45')](_0x137980[_0xddfe('0x39')],_0x388426['filters']));_0x3336d6[_0xddfe('0x44')]['OpenchannelAccountId']=_0xb361a7['id'];if(_0x137980[_0xddfe('0x39')]['filter']){_0x3336d6[_0xddfe('0x44')]=_[_0xddfe('0x48')](_0x3336d6[_0xddfe('0x44')],{'$or':_['map'](_0x3336d6['attributes'],function(_0x5cbcaa){var _0x4d1c70={};_0x4d1c70[_0x5cbcaa]={'$like':'%'+_0x137980[_0xddfe('0x39')][_0xddfe('0x4a')]+'%'};return _0x4d1c70;})});}_0x3336d6=_['merge']({},_0x3336d6,_0x137980['options']);return db[_0xddfe('0x7f')][_0xddfe('0x2a')]({'where':_0x3336d6[_0xddfe('0x44')]})['then'](function(_0x349814){_0x5411a0[_0xddfe('0x2a')]=_0x349814;if(_0x137980[_0xddfe('0x39')]['includeAll']){_0x3336d6['include']=[{'model':db[_0xddfe('0x63')],'as':_0xddfe('0x98'),'required':![]},{'model':db[_0xddfe('0x8c')],'as':_0xddfe('0x99'),'attributes':[_0xddfe('0x33'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xddfe('0x33'),'color'],'where':_0x137980[_0xddfe('0x39')][_0xddfe('0x9a')]?{'id':_0x137980[_0xddfe('0x39')]['tag']}:undefined,'required':_0x137980['query'][_0xddfe('0x9a')]?!![]:![]}];}return db['OpenchannelInteraction'][_0xddfe('0x4e')](_0x3336d6);})['then'](function(_0x1ddc5f){_0x5411a0[_0xddfe('0x4f')]=_0x1ddc5f;return _0x5411a0;});}})[_0xddfe('0x1a')](respondWithFilteredResult(_0xeb66f2,_0x3336d6))['catch'](handleError(_0xeb66f2,null));};exports[_0xddfe('0x9b')]=function(_0x5edfb3,_0xbe006e,_0x5d4311){return db['OpenchannelAccount'][_0xddfe('0x56')]({'where':{'id':_0x5edfb3[_0xddfe('0x51')]['id']}})[_0xddfe('0x1a')](handleEntityNotFound(_0xbe006e,null))[_0xddfe('0x1a')](function(_0x4229ab){if(_0x4229ab){return _0x4229ab[_0xddfe('0x9b')](_0x5edfb3[_0xddfe('0x55')]['ids'],_[_0xddfe('0x9c')](_0x5edfb3['body'],[_0xddfe('0x5d'),'id'])||{})[_0xddfe('0x81')](function(_0x31d003){for(var _0x3458d0=0x0;_0x3458d0<_0x5edfb3[_0xddfe('0x55')][_0xddfe('0x5d')][_0xddfe('0x53')];_0x3458d0+=0x1){socket[_0xddfe('0x9d')]('userOpenchannelAccount:save',{'UserId':_0x5edfb3[_0xddfe('0x55')][_0xddfe('0x5d')][_0x3458d0],'OpenchannelAccountId':_0x5edfb3[_0xddfe('0x51')]['id']});}return _0x31d003;});}})[_0xddfe('0x1a')](respondWithResult(_0xbe006e,null))[_0xddfe('0x25')](handleError(_0xbe006e,null));};exports[_0xddfe('0x9e')]=function(_0x6cf09,_0x381238,_0xaead0e){var _0x537bd8;return db[_0xddfe('0x36')][_0xddfe('0x56')]({'where':{'id':_0x6cf09[_0xddfe('0x51')]['id']}})[_0xddfe('0x1a')](handleEntityNotFound(_0x381238,null))[_0xddfe('0x1a')](function(_0x558c2c){if(_0x558c2c){return _0x558c2c['removeAgents'](_0x6cf09[_0xddfe('0x39')][_0xddfe('0x5d')])[_0xddfe('0x1a')](function(_0x5c62c4){if(_['isArray'](_0x6cf09[_0xddfe('0x39')]['ids'])){for(var _0x532d06=0x0;_0x532d06<_0x6cf09[_0xddfe('0x39')][_0xddfe('0x5d')][_0xddfe('0x53')];_0x532d06+=0x1){socket[_0xddfe('0x9d')](_0xddfe('0x9f'),{'UserId':_0x6cf09['query'][_0xddfe('0x5d')][_0x532d06],'OpenchannelAccountId':_0x6cf09[_0xddfe('0x51')]['id']});}}else{socket[_0xddfe('0x9d')](_0xddfe('0x9f'),{'UserId':_0x6cf09[_0xddfe('0x39')][_0xddfe('0x5d')],'OpenchannelAccountId':_0x6cf09[_0xddfe('0x51')]['id']});}});}})[_0xddfe('0x1a')](respondWithStatusCode(_0x381238,null))[_0xddfe('0x25')](handleError(_0x381238,null));};exports['getAgents']=function(_0xd11c31,_0x4233bc,_0x47aed4){var _0x5ca31d={};var _0x4ca422={};var _0x19f61c;var _0x4c80ae;return db[_0xddfe('0x36')]['findOne']({'where':{'id':_0xd11c31[_0xddfe('0x51')]['id']}})[_0xddfe('0x1a')](handleEntityNotFound(_0x4233bc,null))[_0xddfe('0x1a')](function(_0x466237){if(_0x466237){_0x19f61c=_0x466237;_0x4ca422[_0xddfe('0x3f')]=_[_0xddfe('0x38')](db[_0xddfe('0x8c')][_0xddfe('0x37')]);_0x4ca422[_0xddfe('0x39')]=_[_0xddfe('0x38')](_0xd11c31[_0xddfe('0x39')]);_0x4ca422[_0xddfe('0x3c')]=_[_0xddfe('0x52')](_0x4ca422['model'],_0x4ca422[_0xddfe('0x39')]);_0x5ca31d['attributes']=_[_0xddfe('0x52')](_0x4ca422[_0xddfe('0x3f')],qs[_0xddfe('0x3e')](_0xd11c31[_0xddfe('0x39')][_0xddfe('0x3e')]));_0x5ca31d['attributes']=_0x5ca31d[_0xddfe('0x3d')][_0xddfe('0x53')]?_0x5ca31d[_0xddfe('0x3d')]:_0x4ca422[_0xddfe('0x3f')];_0x5ca31d[_0xddfe('0x61')]=qs['sort'](_0xd11c31[_0xddfe('0x39')][_0xddfe('0x43')]);_0x5ca31d[_0xddfe('0x44')]=qs[_0xddfe('0x3c')](_['pick'](_0xd11c31['query'],_0x4ca422['filters']));if(_0xd11c31[_0xddfe('0x39')]['filter']){_0x5ca31d[_0xddfe('0x44')]=_['merge'](_0x5ca31d[_0xddfe('0x44')],{'$or':_[_0xddfe('0x49')](_0x5ca31d[_0xddfe('0x3d')],function(_0x533bac){var _0x3b1b4a={};_0x3b1b4a[_0x533bac]={'$like':'%'+_0xd11c31[_0xddfe('0x39')]['filter']+'%'};return _0x3b1b4a;})});}_0x5ca31d=_[_0xddfe('0x48')]({},_0x5ca31d,_0xd11c31[_0xddfe('0x4b')]);return _0x19f61c[_0xddfe('0xa0')](_0x5ca31d);}})[_0xddfe('0x1a')](function(_0x193fab){if(_0x193fab){_0x4c80ae=_0x193fab[_0xddfe('0x53')];if(!_0xd11c31[_0xddfe('0x39')]['hasOwnProperty']('nolimit')){_0x5ca31d['limit']=qs['limit'](_0xd11c31[_0xddfe('0x39')][_0xddfe('0x2b')]);_0x5ca31d['offset']=qs[_0xddfe('0x42')](_0xd11c31[_0xddfe('0x39')]['offset']);}return _0x19f61c[_0xddfe('0xa0')](_0x5ca31d);}})[_0xddfe('0x1a')](function(_0x43e33c){if(_0x43e33c){return _0x43e33c?{'count':_0x4c80ae,'rows':_0x43e33c}:null;}})[_0xddfe('0x1a')](respondWithResult(_0x4233bc,null))['catch'](handleError(_0x4233bc,null));};exports[_0xddfe('0x34')]=function(_0x4e585c,_0x2cc622,_0xd84823){var _0x5d3312,_0x48c763,_0x1642fa;if(_[_0xddfe('0x6a')](_0x4e585c['body'][_0xddfe('0x55')])||_0x4e585c[_0xddfe('0x55')][_0xddfe('0x55')]===''){throw new db[(_0xddfe('0x64'))][(_0xddfe('0x65'))](_0xddfe('0x6d'));}if(_[_0xddfe('0x6a')](_0x4e585c[_0xddfe('0x55')]['to'])){}_0x5d3312=_0x4e585c[_0xddfe('0x55')]['to'];return db[_0xddfe('0x36')][_0xddfe('0x60')]({'where':{'id':_0x4e585c[_0xddfe('0x51')]['id']}})[_0xddfe('0x1a')](handleEntityNotFound(_0x2cc622,null))[_0xddfe('0x1a')](function(_0x50fb78){if(_0x50fb78){return db['OpenchannelAccount'][_0xddfe('0x56')]({'where':{'id':_0x50fb78['id']},'include':[{'model':db[_0xddfe('0x71')],'as':_0xddfe('0x72'),'include':[{'model':db[_0xddfe('0x63')],'as':_0xddfe('0x73'),'where':{[_0x50fb78[_0xddfe('0x6e')]]:_0x5d3312},'limit':0x1,'order':[[_0xddfe('0x67'),_0xddfe('0x74')]]}]}]})['then'](handleEntityNotFound(_0x2cc622,null))['then'](function(_0xd0e95c){if(_0xd0e95c&&_0xd0e95c[_0xddfe('0x72')]){_0x48c763=_0xd0e95c[_0xddfe('0x85')]({'plain':!![]});if(_0x48c763[_0xddfe('0x72')]&&_0x48c763[_0xddfe('0x72')][_0xddfe('0x73')][_0xddfe('0x53')]){return _0x48c763[_0xddfe('0x72')][_0xddfe('0x73')][0x0];}return db['CmContact'][_0xddfe('0x54')](_['defaults'](_0x4e585c[_0xddfe('0x55')],{'firstName':_0x5d3312,[_0xd0e95c[_0xddfe('0x6e')]]:_0x5d3312,'phone':_0x5d3312,'ListId':_0x48c763['ListId']}));}})[_0xddfe('0x1a')](handleEntityNotFound(_0x2cc622,null))[_0xddfe('0x1a')](function(_0x4ae38f){if(_0x4ae38f){_0x1642fa=_0x4ae38f;return db[_0xddfe('0x7f')][_0xddfe('0x56')]({'where':{'ContactId':_0x1642fa['id'],'closed':![],'OpenchannelAccountId':_0x48c763['id']}})['then'](function(_0x3fa1e3){if(_0x3fa1e3){return[_0x3fa1e3,![]];}return db[_0xddfe('0x7f')][_0xddfe('0x54')]({'UserId':_0x4e585c[_0xddfe('0xa1')]['id'],'ContactId':_0x1642fa['id'],'OpenchannelAccountId':_0x48c763['id'],'lastMsgDirection':_0xddfe('0xa2'),'Messages':[_[_0xddfe('0x48')](_0x4e585c[_0xddfe('0x55')],{'read':![],'body':_0x4e585c['body'][_0xddfe('0x55')],'OpenchannelAccountId':_0x48c763['id'],'UserId':_0x4e585c[_0xddfe('0xa1')]['id'],'ContactId':_0x1642fa['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})[_0xddfe('0x1a')](function(_0x440d94){return[_0x440d94,!![]];});});}})[_0xddfe('0x81')](function(_0x437591,_0x38d04a){if(_0x38d04a){return _0x437591;}return db['OpenchannelMessage']['create'](_[_0xddfe('0x48')](_0x4e585c[_0xddfe('0x55')],{'read':![],'body':_0x4e585c[_0xddfe('0x55')][_0xddfe('0x55')],'OpenchannelAccountId':_0x48c763['id'],'OpenchannelInteractionId':_0x437591['id'],'UserId':_0x4e585c[_0xddfe('0xa1')]['id'],'ContactId':_0x1642fa['id']}))[_0xddfe('0x1a')](function(_0xa5c4c){_0x437591[_0xddfe('0xa3')][_0xddfe('0xa4')]=[];_0x437591[_0xddfe('0xa3')][_0xddfe('0xa4')][_0xddfe('0x88')](_0xa5c4c[_0xddfe('0xa3')]);return _0x437591;});});}})[_0xddfe('0x1a')](respondWithResult(_0x2cc622,null))[_0xddfe('0x25')](handleError(_0x2cc622,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index daa6769..8213c49 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 _0x4860=['../../mysqldb','OpenchannelAccount','save','remove','emit','hasOwnProperty','hook','events'];(function(_0x5edcbd,_0x1ded39){var _0xebd7a9=function(_0x4a6f28){while(--_0x4a6f28){_0x5edcbd['push'](_0x5edcbd['shift']());}};_0xebd7a9(++_0x1ded39);}(_0x4860,0x197));var _0x0486=function(_0x10c3d0,_0x2780ef){_0x10c3d0=_0x10c3d0-0x0;var _0x4aeca7=_0x4860[_0x10c3d0];return _0x4aeca7;};'use strict';var EventEmitter=require(_0x0486('0x0'));var OpenchannelAccount=require(_0x0486('0x1'))['db'][_0x0486('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0486('0x3'),'afterUpdate':'update','afterDestroy':_0x0486('0x4')};function emitEvent(_0x15aa97){return function(_0x50a958,_0x2fa84d,_0x219b4a){OpenchannelAccountEvents[_0x0486('0x5')](_0x15aa97+':'+_0x50a958['id'],_0x50a958);OpenchannelAccountEvents['emit'](_0x15aa97,_0x50a958);_0x219b4a(null);};}for(var e in events){if(events[_0x0486('0x6')](e)){var event=events[e];OpenchannelAccount[_0x0486('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0xcea2=['hook','exports','events','OpenchannelAccount','save','update','remove','emit'];(function(_0x202c61,_0x3673e0){var _0x540691=function(_0x409610){while(--_0x409610){_0x202c61['push'](_0x202c61['shift']());}};_0x540691(++_0x3673e0);}(_0xcea2,0x15a));var _0x2cea=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xcea2[_0x4565bf];return _0x5610ba;};'use strict';var EventEmitter=require(_0x2cea('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0x2cea('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2cea('0x2'),'afterUpdate':_0x2cea('0x3'),'afterDestroy':_0x2cea('0x4')};function emitEvent(_0x513963){return function(_0x3ff73f,_0x46060b,_0x11596e){OpenchannelAccountEvents['emit'](_0x513963+':'+_0x3ff73f['id'],_0x3ff73f);OpenchannelAccountEvents[_0x2cea('0x5')](_0x513963,_0x3ff73f);_0x11596e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x2cea('0x6')](e,emitEvent(event));}}module[_0x2cea('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index fa6ccd6..dd73b87 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 _0xda3f=['define','OpenchannelAccount','util','../../config/logger','request-promise','exports'];(function(_0x30dfa4,_0x1a6275){var _0x185b37=function(_0x1a8025){while(--_0x1a8025){_0x30dfa4['push'](_0x30dfa4['shift']());}};_0x185b37(++_0x1a6275);}(_0xda3f,0xec));var _0xfda3=function(_0x5dce82,_0x5b4d32){_0x5dce82=_0x5dce82-0x0;var _0x568162=_0xda3f[_0x5dce82];return _0x568162;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfda3('0x2'));var attributes=require('./openchannelAccount.attributes');module[_0xfda3('0x3')]=function(_0x22187d,_0x516500){return _0x22187d[_0xfda3('0x4')](_0xfda3('0x5'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['request-promise','./openchannelAccount.attributes','exports','define','openchannel_accounts','util','../../config/logger'];(function(_0x140010,_0x4d7233){var _0x373bb8=function(_0x2b6291){while(--_0x2b6291){_0x140010['push'](_0x140010['shift']());}};_0x373bb8(++_0x4d7233);}(_0x757a,0xde));var _0xa757=function(_0x31bc0e,_0xfb0768){_0x31bc0e=_0x31bc0e-0x0;var _0x325f58=_0x757a[_0x31bc0e];return _0x325f58;};'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 attributes=require(_0xa757('0x3'));module[_0xa757('0x4')]=function(_0x453d07,_0x32630d){return _0x453d07[_0xa757('0x5')]('OpenchannelAccount',attributes,{'tableName':_0xa757('0x6'),'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 be78668..0e32d23 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 _0x7a54=['result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x2aa4f8,_0x294d4b){_0x2aa4f8=_0x2aa4f8-0x0;var _0x18411e=_0x7a54[_0x2aa4f8];return _0x18411e;};'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});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelAccount,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});} \ No newline at end of file +var _0x814b=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x26a229,_0x1cfef0){var _0x1c28e7=function(_0x2953c0){while(--_0x2953c0){_0x26a229['push'](_0x26a229['shift']());}};_0x1c28e7(++_0x1cfef0);}(_0x814b,0x1a2));var _0xb814=function(_0x27d958,_0x29ef87){_0x27d958=_0x27d958-0x0;var _0x53e63e=_0x814b[_0x27d958];return _0x53e63e;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});config[_0xb814('0xc')]=_[_0xb814('0xd')](config['redis'],{'host':_0xb814('0xe'),'port':0x18eb});var socket=require(_0xb814('0xf'))(new Redis(config[_0xb814('0xc')]));require(_0xb814('0x10'))[_0xb814('0x11')](socket);function respondWithRpcPromise(_0x21d4a5,_0x1086f8,_0x19aad8){return new BPromise(function(_0x207dbc,_0x3450f2){return client[_0xb814('0x12')](_0x21d4a5,_0x19aad8)['then'](function(_0x43dfe6){logger['info'](_0xb814('0x13'),_0x1086f8,_0xb814('0x14'));logger[_0xb814('0x15')](_0xb814('0x16'),_0x1086f8,_0xb814('0x14'),JSON[_0xb814('0x17')](_0x43dfe6));if(_0x43dfe6[_0xb814('0x18')]){if(_0x43dfe6[_0xb814('0x18')][_0xb814('0x19')]===0x1f4){logger[_0xb814('0x18')](_0xb814('0x13'),_0x1086f8,_0x43dfe6[_0xb814('0x18')][_0xb814('0x1a')]);return _0x3450f2(_0x43dfe6[_0xb814('0x18')][_0xb814('0x1a')]);}logger[_0xb814('0x18')](_0xb814('0x13'),_0x1086f8,_0x43dfe6[_0xb814('0x18')][_0xb814('0x1a')]);return _0x207dbc(_0x43dfe6[_0xb814('0x18')][_0xb814('0x1a')]);}else{logger['info'](_0xb814('0x13'),_0x1086f8,'request\x20sent');_0x207dbc(_0x43dfe6[_0xb814('0x1b')][_0xb814('0x1a')]);}})['catch'](function(_0x4b55a7){logger['error'](_0xb814('0x13'),_0x1086f8,_0x4b55a7);_0x3450f2(_0x4b55a7);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 8d4ab89..d527268 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 _0x0bac=['./openchannelAccount.events','save','remove','update','removeListener','register','length'];(function(_0x2c4fd6,_0x350269){var _0x4728b2=function(_0x13c53b){while(--_0x13c53b){_0x2c4fd6['push'](_0x2c4fd6['shift']());}};_0x4728b2(++_0x350269);}(_0x0bac,0x1ea));var _0xc0ba=function(_0x3bf0bf,_0x1de9af){_0x3bf0bf=_0x3bf0bf-0x0;var _0x6a204=_0x0bac[_0x3bf0bf];return _0x6a204;};'use strict';var OpenchannelAccountEvents=require(_0xc0ba('0x0'));var events=[_0xc0ba('0x1'),_0xc0ba('0x2'),_0xc0ba('0x3')];function createListener(_0x2c0c6a,_0x404eca){return function(_0x36639b){_0x404eca['emit'](_0x2c0c6a,_0x36639b);};}function removeListener(_0x9ac38e,_0x23cd91){return function(){OpenchannelAccountEvents[_0xc0ba('0x4')](_0x9ac38e,_0x23cd91);};}exports[_0xc0ba('0x5')]=function(_0x3bb006){for(var _0x2e5d60=0x0,_0x472a3e=events[_0xc0ba('0x6')];_0x2e5d60<_0x472a3e;_0x2e5d60++){var _0x25bc43=events[_0x2e5d60];var _0x24494a=createListener('openchannelAccount:'+_0x25bc43,_0x3bb006);OpenchannelAccountEvents['on'](_0x25bc43,_0x24494a);}}; \ No newline at end of file +var _0xfc9b=['removeListener','length','./openchannelAccount.events','save','remove','emit'];(function(_0x313c96,_0x3cee6e){var _0x522f53=function(_0x8961e){while(--_0x8961e){_0x313c96['push'](_0x313c96['shift']());}};_0x522f53(++_0x3cee6e);}(_0xfc9b,0x15e));var _0xbfc9=function(_0x520aee,_0x15ceed){_0x520aee=_0x520aee-0x0;var _0xbf8a0a=_0xfc9b[_0x520aee];return _0xbf8a0a;};'use strict';var OpenchannelAccountEvents=require(_0xbfc9('0x0'));var events=[_0xbfc9('0x1'),_0xbfc9('0x2'),'update'];function createListener(_0x139bc3,_0x2b49f4){return function(_0xc6fc){_0x2b49f4[_0xbfc9('0x3')](_0x139bc3,_0xc6fc);};}function removeListener(_0x3918de,_0x432586){return function(){OpenchannelAccountEvents[_0xbfc9('0x4')](_0x3918de,_0x432586);};}exports['register']=function(_0x1c25c0){for(var _0xa433ed=0x0,_0x4c6715=events[_0xbfc9('0x5')];_0xa433ed<_0x4c6715;_0xa433ed++){var _0x1bfd50=events[_0xa433ed];var _0x58dede=createListener('openchannelAccount:'+_0x1bfd50,_0x1c25c0);OpenchannelAccountEvents['on'](_0x1bfd50,_0x58dede);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index f3f73b4..915cae7 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 _0x318b=['post','create','/:id','update','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x318b,0x123));var _0xb318=function(_0x5e8eae,_0x4f81e0){_0x5e8eae=_0x5e8eae-0x0;var _0xdd09cd=_0x318b[_0x5e8eae];return _0xdd09cd;};'use strict';var multer=require(_0xb318('0x0'));var util=require('util');var path=require(_0xb318('0x1'));var timeout=require(_0xb318('0x2'));var express=require('express');var router=express[_0xb318('0x3')]();var auth=require(_0xb318('0x4'));var interaction=require(_0xb318('0x5'));var config=require(_0xb318('0x6'));var controller=require('./openchannelApplication.controller');router[_0xb318('0x7')]('/',auth[_0xb318('0x8')](),controller['index']);router[_0xb318('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xb318('0x9')]('/',auth[_0xb318('0x8')](),controller[_0xb318('0xa')]);router['put'](_0xb318('0xb'),auth[_0xb318('0x8')](),controller[_0xb318('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb318('0xd')]);module[_0xb318('0xe')]=router; \ No newline at end of file +var _0x96f2=['get','isAuthenticated','index','post','create','delete','/:id','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller'];(function(_0x45a484,_0x24de00){var _0x5c0df0=function(_0x5df2b4){while(--_0x5df2b4){_0x45a484['push'](_0x45a484['shift']());}};_0x5c0df0(++_0x24de00);}(_0x96f2,0xc9));var _0x296f=function(_0x415af5,_0x2da2a6){_0x415af5=_0x415af5-0x0;var _0x95d1b0=_0x96f2[_0x415af5];return _0x95d1b0;};'use strict';var multer=require('multer');var util=require(_0x296f('0x0'));var path=require('path');var timeout=require(_0x296f('0x1'));var express=require(_0x296f('0x2'));var router=express[_0x296f('0x3')]();var auth=require(_0x296f('0x4'));var interaction=require(_0x296f('0x5'));var config=require('../../config/environment');var controller=require(_0x296f('0x6'));router[_0x296f('0x7')]('/',auth[_0x296f('0x8')](),controller[_0x296f('0x9')]);router[_0x296f('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x296f('0xa')]('/',auth[_0x296f('0x8')](),controller[_0x296f('0xb')]);router['put']('/:id',auth[_0x296f('0x8')](),controller['update']);router[_0x296f('0xc')](_0x296f('0xd'),auth[_0x296f('0x8')](),controller[_0x296f('0xe')]);module[_0x296f('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index dc7245e..49488a4 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 _0xe8b9=['INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x2d61b2,_0x142947){var _0x12df89=function(_0x31c717){while(--_0x31c717){_0x2d61b2['push'](_0x2d61b2['shift']());}};_0x12df89(++_0x142947);}(_0xe8b9,0x17b));var _0x9e8b=function(_0xcbdad1,_0x5c7032){_0xcbdad1=_0xcbdad1-0x0;var _0x359da2=_0xe8b9[_0xcbdad1];return _0x359da2;};'use strict';var Sequelize=require(_0x9e8b('0x0'));module['exports']={'priority':{'type':Sequelize[_0x9e8b('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x9e8b('0x2')],'allowNull':![],'defaultValue':_0x9e8b('0x3')},'appdata':{'type':Sequelize[_0x9e8b('0x2')](0x1000),'defaultValue':''},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x9e8b('0x2')],'defaultValue':_0x9e8b('0x4')}}; \ No newline at end of file +var _0xd58f=['*,*,*,*','sequelize','exports','INTEGER','noop','STRING'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xd58f,0x1b7));var _0xfd58=function(_0x42131c,_0x39a466){_0x42131c=_0x42131c-0x0;var _0x5350c9=_0xd58f[_0x42131c];return _0x5350c9;};'use strict';var Sequelize=require(_0xfd58('0x0'));module[_0xfd58('0x1')]={'priority':{'type':Sequelize[_0xfd58('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xfd58('0x3')},'appdata':{'type':Sequelize[_0xfd58('0x4')](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0xfd58('0x4')]},'interval':{'type':Sequelize[_0xfd58('0x4')],'defaultValue':_0xfd58('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 9ebe390..712439a 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 _0x3618=['filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','add','day','merge','filter','where','map','options','OpenchannelApplication','include','findAll','catch','show','includeAll','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','end','json','count','offset','limit','set','save','update','then','destroy','sendStatus','error','stack','name','index','rawAttributes','model','keys','dateStart','query','dateEnd'];(function(_0x51b7c5,_0x218969){var _0x3355d7=function(_0x2cce68){while(--_0x2cce68){_0x51b7c5['push'](_0x51b7c5['shift']());}};_0x3355d7(++_0x218969);}(_0x3618,0x126));var _0x8361=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x3618[_0x18ab2a];return _0x16dcee;};'use strict';var pdf=require(_0x8361('0x0'));var emlformat=require(_0x8361('0x1'));var rimraf=require(_0x8361('0x2'));var zipdir=require(_0x8361('0x3'));var jsonpatch=require(_0x8361('0x4'));var rp=require(_0x8361('0x5'));var moment=require(_0x8361('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x8361('0x7'));var sox=require('sox');var csv=require(_0x8361('0x8'));var ejs=require(_0x8361('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8361('0xa'));var crypto=require(_0x8361('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8361('0x8'));var querystring=require(_0x8361('0xc'));var Papa=require(_0x8361('0xd'));var Redis=require(_0x8361('0xe'));var qs=require(_0x8361('0xf'));var logger=require(_0x8361('0x10'))(_0x8361('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x8361('0x12'))['db'];function respondWithStatusCode(_0x4ec913,_0x225e26){_0x225e26=_0x225e26||0xcc;return function(_0x477ebe){if(_0x477ebe){return _0x4ec913['sendStatus'](_0x225e26);}return _0x4ec913[_0x8361('0x13')](_0x225e26)[_0x8361('0x14')]();};}function respondWithResult(_0x3b11b7,_0x574d6c){_0x574d6c=_0x574d6c||0xc8;return function(_0x472e42){if(_0x472e42){return _0x3b11b7['status'](_0x574d6c)[_0x8361('0x15')](_0x472e42);}};}function respondWithFilteredResult(_0x48d6eb,_0x26e4c5){return function(_0x28780d){if(_0x28780d){var _0x8a8e22=_0x28780d[_0x8361('0x16')],_0x2dd740=_0x26e4c5[_0x8361('0x17')],_0x58ca93=_0x26e4c5['offset']+_0x26e4c5[_0x8361('0x18')],_0x4cda4c;if(_0x58ca93>=_0x8a8e22){_0x58ca93=_0x8a8e22;_0x4cda4c=0xc8;}else{_0x4cda4c=0xce;}_0x48d6eb[_0x8361('0x13')](_0x4cda4c);return _0x48d6eb[_0x8361('0x19')]('Content-Range',_0x2dd740+'-'+_0x58ca93+'/'+_0x8a8e22)['json'](_0x28780d);}return null;};}function patchUpdates(_0x2f2831){return function(_0x382362){try{jsonpatch['apply'](_0x382362,_0x2f2831,!![]);}catch(_0x32530b){return BPromise['reject'](_0x32530b);}return _0x382362[_0x8361('0x1a')]();};}function saveUpdates(_0x1d9bf1,_0x4ace45){return function(_0x380164){if(_0x380164){return _0x380164[_0x8361('0x1b')](_0x1d9bf1)[_0x8361('0x1c')](function(_0x5d2f85){return _0x5d2f85;});}return null;};}function removeEntity(_0x178447,_0x14c595){return function(_0x49a125){if(_0x49a125){return _0x49a125[_0x8361('0x1d')]()[_0x8361('0x1c')](function(){_0x178447[_0x8361('0x13')](0xcc)[_0x8361('0x14')]();});}};}function handleEntityNotFound(_0x380e13,_0x378c41){return function(_0x1f1b11){if(!_0x1f1b11){_0x380e13[_0x8361('0x1e')](0x194);}return _0x1f1b11;};}function handleError(_0x3adbd4,_0x1907f6){_0x1907f6=_0x1907f6||0x1f4;return function(_0x2e2e5e){logger[_0x8361('0x1f')](_0x2e2e5e[_0x8361('0x20')]);if(_0x2e2e5e['name']){delete _0x2e2e5e[_0x8361('0x21')];}_0x3adbd4[_0x8361('0x13')](_0x1907f6)['send'](_0x2e2e5e);};}exports[_0x8361('0x22')]=function(_0x1307d1,_0x1c96cb){var _0x314438={},_0x550fd9={},_0x5b64ee={'count':0x0,'rows':[]};var _0x500834=db['OpenchannelApplication'][_0x8361('0x23')];_0x550fd9[_0x8361('0x24')]=_[_0x8361('0x25')](_0x500834);var _0x380442={'dateStart':_0x1307d1['query'][_0x8361('0x26')],'dateEnd':_0x1307d1['query']['dateEnd']};delete _0x1307d1['query'][_0x8361('0x26')];delete _0x1307d1[_0x8361('0x27')][_0x8361('0x28')];_0x550fd9[_0x8361('0x27')]=_[_0x8361('0x25')](_0x1307d1['query']);_0x550fd9[_0x8361('0x29')]=_[_0x8361('0x2a')](_0x550fd9[_0x8361('0x24')],_0x550fd9[_0x8361('0x27')]);_0x314438['attributes']=_[_0x8361('0x2a')](_0x550fd9[_0x8361('0x24')],qs[_0x8361('0x2b')](_0x1307d1['query'][_0x8361('0x2b')]));_0x314438['attributes']=_0x314438[_0x8361('0x2c')][_0x8361('0x2d')]?_0x314438[_0x8361('0x2c')]:_0x550fd9[_0x8361('0x24')];if(!_0x1307d1[_0x8361('0x27')][_0x8361('0x2e')]('nolimit')){_0x314438[_0x8361('0x18')]=qs[_0x8361('0x18')](_0x1307d1['query'][_0x8361('0x18')]);_0x314438['offset']=qs[_0x8361('0x17')](_0x1307d1[_0x8361('0x27')][_0x8361('0x17')]);}_0x314438[_0x8361('0x2f')]=qs[_0x8361('0x30')](_0x1307d1[_0x8361('0x27')][_0x8361('0x30')]);_0x314438['where']=qs['filters'](_[_0x8361('0x31')](_0x1307d1[_0x8361('0x27')],_0x550fd9[_0x8361('0x29')]));if(_0x380442[_0x8361('0x26')]){if(_0x380442[_0x8361('0x28')]){_0x380442['dateEnd']=moment(_0x380442[_0x8361('0x28')])[_0x8361('0x32')](0x1,_0x8361('0x33'));}else{_0x380442[_0x8361('0x28')]=moment(_0x380442[_0x8361('0x26')])[_0x8361('0x32')](0x1,_0x8361('0x33'));}_[_0x8361('0x34')](_0x314438['where'],{'createdAt':{'$gte':_0x380442[_0x8361('0x26')],'$lte':_0x380442[_0x8361('0x28')]}});}if(_0x1307d1[_0x8361('0x27')][_0x8361('0x35')]){_0x314438[_0x8361('0x36')]=_[_0x8361('0x34')](_0x314438[_0x8361('0x36')],{'$or':_[_0x8361('0x37')](_0x314438[_0x8361('0x2c')],function(_0x32050d){var _0x1cf083={};_0x1cf083[_0x32050d]={'$like':'%'+_0x1307d1[_0x8361('0x27')]['filter']+'%'};return _0x1cf083;})});}_0x314438=_['merge']({},_0x314438,_0x1307d1[_0x8361('0x38')]);var _0x1997ca={'where':_0x314438[_0x8361('0x36')]};return db[_0x8361('0x39')]['count'](_0x1997ca)[_0x8361('0x1c')](function(_0x1aed03){_0x5b64ee['count']=_0x1aed03;if(_0x1307d1['query']['includeAll']){_0x314438[_0x8361('0x3a')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x8361('0x3b')](_0x314438);})[_0x8361('0x1c')](function(_0x5559bf){_0x5b64ee['rows']=_0x5559bf;return _0x5b64ee;})[_0x8361('0x1c')](respondWithFilteredResult(_0x1c96cb,_0x314438))[_0x8361('0x3c')](handleError(_0x1c96cb,null));};exports[_0x8361('0x3d')]=function(_0x1f61a2,_0x56d129){var _0x3595f5={'raw':!![],'where':{'id':_0x1f61a2['params']['id']}},_0x11dc3f={};_0x11dc3f[_0x8361('0x24')]=_[_0x8361('0x25')](db[_0x8361('0x39')][_0x8361('0x23')]);_0x11dc3f[_0x8361('0x27')]=_[_0x8361('0x25')](_0x1f61a2[_0x8361('0x27')]);_0x11dc3f[_0x8361('0x29')]=_[_0x8361('0x2a')](_0x11dc3f[_0x8361('0x24')],_0x11dc3f[_0x8361('0x27')]);_0x3595f5['attributes']=_[_0x8361('0x2a')](_0x11dc3f[_0x8361('0x24')],qs['fields'](_0x1f61a2['query'][_0x8361('0x2b')]));_0x3595f5[_0x8361('0x2c')]=_0x3595f5[_0x8361('0x2c')][_0x8361('0x2d')]?_0x3595f5[_0x8361('0x2c')]:_0x11dc3f['model'];if(_0x1f61a2[_0x8361('0x27')][_0x8361('0x3e')]){_0x3595f5[_0x8361('0x3a')]=[{'all':!![]}];}_0x3595f5=_[_0x8361('0x34')]({},_0x3595f5,_0x1f61a2[_0x8361('0x38')]);return db[_0x8361('0x39')][_0x8361('0x3f')](_0x3595f5)['then'](handleEntityNotFound(_0x56d129,null))['then'](respondWithResult(_0x56d129,null))[_0x8361('0x3c')](handleError(_0x56d129,null));};exports[_0x8361('0x40')]=function(_0x2e3cc1,_0x16dcf4){return db[_0x8361('0x39')]['create'](_0x2e3cc1[_0x8361('0x41')],{})[_0x8361('0x1c')](respondWithResult(_0x16dcf4,0xc9))['catch'](handleError(_0x16dcf4,null));};exports[_0x8361('0x1b')]=function(_0x400515,_0x5f4ef1){if(_0x400515[_0x8361('0x41')]['id']){delete _0x400515[_0x8361('0x41')]['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x400515[_0x8361('0x42')]['id']}})[_0x8361('0x1c')](handleEntityNotFound(_0x5f4ef1,null))['then'](saveUpdates(_0x400515[_0x8361('0x41')],null))['then'](respondWithResult(_0x5f4ef1,null))[_0x8361('0x3c')](handleError(_0x5f4ef1,null));};exports['destroy']=function(_0x55b6b7,_0x407282){return db[_0x8361('0x39')][_0x8361('0x3f')]({'where':{'id':_0x55b6b7[_0x8361('0x42')]['id']}})[_0x8361('0x1c')](handleEntityNotFound(_0x407282,null))[_0x8361('0x1c')](removeEntity(_0x407282,null))['catch'](handleError(_0x407282,null));}; \ No newline at end of file +var _0x4366=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','OpenchannelApplication','rawAttributes','query','dateEnd','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','dateStart','filter','map','includeAll','include','findAll','rows','catch','params','keys','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../config/logger'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x4366,0x118));var _0x6436=function(_0x20ba94,_0x1e0174){_0x20ba94=_0x20ba94-0x0;var _0x3e8e87=_0x4366[_0x20ba94];return _0x3e8e87;};'use strict';var pdf=require(_0x6436('0x0'));var emlformat=require(_0x6436('0x1'));var rimraf=require(_0x6436('0x2'));var zipdir=require(_0x6436('0x3'));var jsonpatch=require(_0x6436('0x4'));var rp=require(_0x6436('0x5'));var moment=require(_0x6436('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x6436('0x7'));var util=require(_0x6436('0x8'));var path=require(_0x6436('0x9'));var sox=require('sox');var csv=require(_0x6436('0xa'));var ejs=require(_0x6436('0xb'));var fs=require('fs');var _=require(_0x6436('0xc'));var squel=require(_0x6436('0xd'));var crypto=require(_0x6436('0xe'));var jsforce=require(_0x6436('0xf'));var deskjs=require(_0x6436('0x10'));var toCsv=require(_0x6436('0xa'));var querystring=require('querystring');var Papa=require(_0x6436('0x11'));var Redis=require(_0x6436('0x12'));var qs=require('../../components/parsers/qs');var logger=require(_0x6436('0x13'))('api');var utils=require(_0x6436('0x14'));var config=require(_0x6436('0x15'));var db=require(_0x6436('0x16'))['db'];function respondWithStatusCode(_0x374fd5,_0x30d3d0){_0x30d3d0=_0x30d3d0||0xcc;return function(_0x590d98){if(_0x590d98){return _0x374fd5[_0x6436('0x17')](_0x30d3d0);}return _0x374fd5['status'](_0x30d3d0)['end']();};}function respondWithResult(_0x520a51,_0x55869b){_0x55869b=_0x55869b||0xc8;return function(_0x2f547b){if(_0x2f547b){return _0x520a51[_0x6436('0x18')](_0x55869b)[_0x6436('0x19')](_0x2f547b);}};}function respondWithFilteredResult(_0x218ac8,_0x2700f3){return function(_0x5c047d){if(_0x5c047d){var _0x520455=_0x5c047d[_0x6436('0x1a')],_0x3b7f71=_0x2700f3[_0x6436('0x1b')],_0x441076=_0x2700f3[_0x6436('0x1b')]+_0x2700f3[_0x6436('0x1c')],_0x2d03c8;if(_0x441076>=_0x520455){_0x441076=_0x520455;_0x2d03c8=0xc8;}else{_0x2d03c8=0xce;}_0x218ac8['status'](_0x2d03c8);return _0x218ac8[_0x6436('0x1d')](_0x6436('0x1e'),_0x3b7f71+'-'+_0x441076+'/'+_0x520455)[_0x6436('0x19')](_0x5c047d);}return null;};}function patchUpdates(_0x112a18){return function(_0x1df0bd){try{jsonpatch[_0x6436('0x1f')](_0x1df0bd,_0x112a18,!![]);}catch(_0x12e093){return BPromise[_0x6436('0x20')](_0x12e093);}return _0x1df0bd[_0x6436('0x21')]();};}function saveUpdates(_0x1ea412,_0xe1aa91){return function(_0x5903d5){if(_0x5903d5){return _0x5903d5[_0x6436('0x22')](_0x1ea412)[_0x6436('0x23')](function(_0x229003){return _0x229003;});}return null;};}function removeEntity(_0x6b2edd,_0x51536d){return function(_0x391dd7){if(_0x391dd7){return _0x391dd7[_0x6436('0x24')]()[_0x6436('0x23')](function(){_0x6b2edd[_0x6436('0x18')](0xcc)[_0x6436('0x25')]();});}};}function handleEntityNotFound(_0x36497a,_0x504eb2){return function(_0x335437){if(!_0x335437){_0x36497a[_0x6436('0x17')](0x194);}return _0x335437;};}function handleError(_0x5845b6,_0x480132){_0x480132=_0x480132||0x1f4;return function(_0x40add5){logger[_0x6436('0x26')](_0x40add5[_0x6436('0x27')]);if(_0x40add5[_0x6436('0x28')]){delete _0x40add5['name'];}_0x5845b6[_0x6436('0x18')](_0x480132)[_0x6436('0x29')](_0x40add5);};}exports[_0x6436('0x2a')]=function(_0x2f714a,_0x242715){var _0x2c5903={},_0xb6e5b0={},_0x147220={'count':0x0,'rows':[]};var _0x2ee5de=db[_0x6436('0x2b')][_0x6436('0x2c')];_0xb6e5b0['model']=_['keys'](_0x2ee5de);var _0x536639={'dateStart':_0x2f714a[_0x6436('0x2d')]['dateStart'],'dateEnd':_0x2f714a[_0x6436('0x2d')][_0x6436('0x2e')]};delete _0x2f714a[_0x6436('0x2d')]['dateStart'];delete _0x2f714a['query'][_0x6436('0x2e')];_0xb6e5b0[_0x6436('0x2d')]=_['keys'](_0x2f714a[_0x6436('0x2d')]);_0xb6e5b0[_0x6436('0x2f')]=_[_0x6436('0x30')](_0xb6e5b0[_0x6436('0x31')],_0xb6e5b0[_0x6436('0x2d')]);_0x2c5903['attributes']=_['intersection'](_0xb6e5b0[_0x6436('0x31')],qs[_0x6436('0x32')](_0x2f714a['query'][_0x6436('0x32')]));_0x2c5903[_0x6436('0x33')]=_0x2c5903[_0x6436('0x33')]['length']?_0x2c5903[_0x6436('0x33')]:_0xb6e5b0['model'];if(!_0x2f714a[_0x6436('0x2d')][_0x6436('0x34')](_0x6436('0x35'))){_0x2c5903[_0x6436('0x1c')]=qs[_0x6436('0x1c')](_0x2f714a[_0x6436('0x2d')][_0x6436('0x1c')]);_0x2c5903['offset']=qs[_0x6436('0x1b')](_0x2f714a[_0x6436('0x2d')][_0x6436('0x1b')]);}_0x2c5903[_0x6436('0x36')]=qs[_0x6436('0x37')](_0x2f714a[_0x6436('0x2d')][_0x6436('0x37')]);_0x2c5903[_0x6436('0x38')]=qs[_0x6436('0x2f')](_[_0x6436('0x39')](_0x2f714a['query'],_0xb6e5b0[_0x6436('0x2f')]));if(_0x536639['dateStart']){if(_0x536639[_0x6436('0x2e')]){_0x536639[_0x6436('0x2e')]=moment(_0x536639[_0x6436('0x2e')])[_0x6436('0x3a')](0x1,'day');}else{_0x536639[_0x6436('0x2e')]=moment(_0x536639['dateStart'])[_0x6436('0x3a')](0x1,_0x6436('0x3b'));}_[_0x6436('0x3c')](_0x2c5903['where'],{'createdAt':{'$gte':_0x536639[_0x6436('0x3d')],'$lte':_0x536639[_0x6436('0x2e')]}});}if(_0x2f714a[_0x6436('0x2d')][_0x6436('0x3e')]){_0x2c5903['where']=_[_0x6436('0x3c')](_0x2c5903[_0x6436('0x38')],{'$or':_[_0x6436('0x3f')](_0x2c5903['attributes'],function(_0x4490b5){var _0xe8c20c={};_0xe8c20c[_0x4490b5]={'$like':'%'+_0x2f714a[_0x6436('0x2d')]['filter']+'%'};return _0xe8c20c;})});}_0x2c5903=_[_0x6436('0x3c')]({},_0x2c5903,_0x2f714a['options']);var _0x5e2a6e={'where':_0x2c5903['where']};return db[_0x6436('0x2b')][_0x6436('0x1a')](_0x5e2a6e)['then'](function(_0xf395ec){_0x147220[_0x6436('0x1a')]=_0xf395ec;if(_0x2f714a['query'][_0x6436('0x40')]){_0x2c5903[_0x6436('0x41')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x6436('0x42')](_0x2c5903);})[_0x6436('0x23')](function(_0x3d7ed2){_0x147220[_0x6436('0x43')]=_0x3d7ed2;return _0x147220;})['then'](respondWithFilteredResult(_0x242715,_0x2c5903))[_0x6436('0x44')](handleError(_0x242715,null));};exports['show']=function(_0x1afc04,_0x3ebe3d){var _0x4c149e={'raw':!![],'where':{'id':_0x1afc04[_0x6436('0x45')]['id']}},_0x2f778a={};_0x2f778a[_0x6436('0x31')]=_[_0x6436('0x46')](db[_0x6436('0x2b')][_0x6436('0x2c')]);_0x2f778a[_0x6436('0x2d')]=_[_0x6436('0x46')](_0x1afc04[_0x6436('0x2d')]);_0x2f778a[_0x6436('0x2f')]=_[_0x6436('0x30')](_0x2f778a[_0x6436('0x31')],_0x2f778a[_0x6436('0x2d')]);_0x4c149e['attributes']=_['intersection'](_0x2f778a[_0x6436('0x31')],qs[_0x6436('0x32')](_0x1afc04[_0x6436('0x2d')][_0x6436('0x32')]));_0x4c149e[_0x6436('0x33')]=_0x4c149e['attributes']['length']?_0x4c149e['attributes']:_0x2f778a[_0x6436('0x31')];if(_0x1afc04[_0x6436('0x2d')][_0x6436('0x40')]){_0x4c149e[_0x6436('0x41')]=[{'all':!![]}];}_0x4c149e=_[_0x6436('0x3c')]({},_0x4c149e,_0x1afc04[_0x6436('0x47')]);return db['OpenchannelApplication'][_0x6436('0x48')](_0x4c149e)['then'](handleEntityNotFound(_0x3ebe3d,null))[_0x6436('0x23')](respondWithResult(_0x3ebe3d,null))[_0x6436('0x44')](handleError(_0x3ebe3d,null));};exports['create']=function(_0x1e2102,_0x5bd386){return db['OpenchannelApplication'][_0x6436('0x49')](_0x1e2102[_0x6436('0x4a')],{})['then'](respondWithResult(_0x5bd386,0xc9))[_0x6436('0x44')](handleError(_0x5bd386,null));};exports[_0x6436('0x22')]=function(_0x2d7b5f,_0x5b15d4){if(_0x2d7b5f[_0x6436('0x4a')]['id']){delete _0x2d7b5f['body']['id'];}return db['OpenchannelApplication'][_0x6436('0x48')]({'where':{'id':_0x2d7b5f[_0x6436('0x45')]['id']}})['then'](handleEntityNotFound(_0x5b15d4,null))[_0x6436('0x23')](saveUpdates(_0x2d7b5f[_0x6436('0x4a')],null))[_0x6436('0x23')](respondWithResult(_0x5b15d4,null))[_0x6436('0x44')](handleError(_0x5b15d4,null));};exports[_0x6436('0x24')]=function(_0x1eeb9d,_0x3bbf1b){return db[_0x6436('0x2b')]['find']({'where':{'id':_0x1eeb9d[_0x6436('0x45')]['id']}})[_0x6436('0x23')](handleEntityNotFound(_0x3bbf1b,null))[_0x6436('0x23')](removeEntity(_0x3bbf1b,null))[_0x6436('0x44')](handleError(_0x3bbf1b,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index bf59d31..983fec5 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 _0x2c4c=['bluebird','request-promise','./openchannelApplication.attributes','exports','define','OpenchannelApplication','lodash','util','../../config/logger','moment'];(function(_0x57d370,_0x3ed0f6){var _0x550fd2=function(_0x59634f){while(--_0x59634f){_0x57d370['push'](_0x57d370['shift']());}};_0x550fd2(++_0x3ed0f6);}(_0x2c4c,0x1dc));var _0xc2c4=function(_0x44bef2,_0x4e3bd6){_0x44bef2=_0x44bef2-0x0;var _0x56d832=_0x2c4c[_0x44bef2];return _0x56d832;};'use strict';var _=require(_0xc2c4('0x0'));var util=require(_0xc2c4('0x1'));var logger=require(_0xc2c4('0x2'))('api');var moment=require(_0xc2c4('0x3'));var BPromise=require(_0xc2c4('0x4'));var rp=require(_0xc2c4('0x5'));var attributes=require(_0xc2c4('0x6'));module[_0xc2c4('0x7')]=function(_0x3ba567,_0x396303){return _0x3ba567[_0xc2c4('0x8')](_0xc2c4('0x9'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5efd=['moment','request-promise','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','lodash','util','../../config/logger','api'];(function(_0x44a573,_0x1e6efc){var _0x4babc6=function(_0x5495aa){while(--_0x5495aa){_0x44a573['push'](_0x44a573['shift']());}};_0x4babc6(++_0x1e6efc);}(_0x5efd,0xcd));var _0xd5ef=function(_0x2a0914,_0x25b14e){_0x2a0914=_0x2a0914-0x0;var _0x25a9a6=_0x5efd[_0x2a0914];return _0x25a9a6;};'use strict';var _=require(_0xd5ef('0x0'));var util=require(_0xd5ef('0x1'));var logger=require(_0xd5ef('0x2'))(_0xd5ef('0x3'));var moment=require(_0xd5ef('0x4'));var BPromise=require('bluebird');var rp=require(_0xd5ef('0x5'));var attributes=require(_0xd5ef('0x6'));module[_0xd5ef('0x7')]=function(_0x366495,_0x135d49){return _0x366495[_0xd5ef('0x8')](_0xd5ef('0x9'),attributes,{'tableName':_0xd5ef('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index f8a7225..0941b08 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 _0xc4cf=['http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateOpenchannelApplication','update','body','options','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client'];(function(_0x2de1e4,_0x282ddf){var _0x1ad75a=function(_0x58cc34){while(--_0x58cc34){_0x2de1e4['push'](_0x2de1e4['shift']());}};_0x1ad75a(++_0x282ddf);}(_0xc4cf,0xc8));var _0xfc4c=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0xc4cf[_0x1cb18a];return _0x22442e;};'use strict';var _=require(_0xfc4c('0x0'));var util=require(_0xfc4c('0x1'));var moment=require(_0xfc4c('0x2'));var BPromise=require(_0xfc4c('0x3'));var rs=require(_0xfc4c('0x4'));var fs=require('fs');var Redis=require(_0xfc4c('0x5'));var db=require(_0xfc4c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfc4c('0x7'))(_0xfc4c('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfc4c('0x9')][_0xfc4c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14d02b,_0x10920f,_0x500cfb){return new BPromise(function(_0x2f5f5b,_0x34dc8b){return client[_0xfc4c('0xb')](_0x14d02b,_0x500cfb)[_0xfc4c('0xc')](function(_0x3fdc0b){logger[_0xfc4c('0xd')](_0xfc4c('0xe'),_0x10920f,'request\x20sent');logger['debug']('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x10920f,_0xfc4c('0xf'),JSON[_0xfc4c('0x10')](_0x3fdc0b));if(_0x3fdc0b[_0xfc4c('0x11')]){if(_0x3fdc0b[_0xfc4c('0x11')][_0xfc4c('0x12')]===0x1f4){logger[_0xfc4c('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x10920f,_0x3fdc0b['error'][_0xfc4c('0x13')]);return _0x34dc8b(_0x3fdc0b[_0xfc4c('0x11')][_0xfc4c('0x13')]);}logger[_0xfc4c('0x11')](_0xfc4c('0xe'),_0x10920f,_0x3fdc0b[_0xfc4c('0x11')][_0xfc4c('0x13')]);return _0x2f5f5b(_0x3fdc0b[_0xfc4c('0x11')][_0xfc4c('0x13')]);}else{logger[_0xfc4c('0xd')](_0xfc4c('0xe'),_0x10920f,_0xfc4c('0xf'));_0x2f5f5b(_0x3fdc0b[_0xfc4c('0x14')][_0xfc4c('0x13')]);}})[_0xfc4c('0x15')](function(_0x7de453){logger[_0xfc4c('0x11')](_0xfc4c('0xe'),_0x10920f,_0x7de453);_0x34dc8b(_0x7de453);});});}exports[_0xfc4c('0x16')]=function(_0x2f7879){var _0x4f33c7=this;return new Promise(function(_0x5d0da6,_0x10f6b8){return db['OpenchannelApplication'][_0xfc4c('0x17')](_0x2f7879[_0xfc4c('0x18')],{'raw':_0x2f7879[_0xfc4c('0x19')]?_0x2f7879[_0xfc4c('0x19')][_0xfc4c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f7879[_0xfc4c('0x19')]?_0x2f7879[_0xfc4c('0x19')][_0xfc4c('0x1b')]||null:null,'attributes':_0x2f7879[_0xfc4c('0x19')]?_0x2f7879[_0xfc4c('0x19')][_0xfc4c('0x1c')]||null:null,'limit':_0x2f7879['options']?_0x2f7879[_0xfc4c('0x19')][_0xfc4c('0x1d')]||null:null})[_0xfc4c('0xc')](function(_0x80c39){logger[_0xfc4c('0xd')]('UpdateOpenchannelApplication',_0x2f7879);logger['debug'](_0xfc4c('0x16'),_0x2f7879,JSON[_0xfc4c('0x10')](_0x80c39));_0x5d0da6(_0x80c39);})[_0xfc4c('0x15')](function(_0x25b4bd){logger[_0xfc4c('0x11')](_0xfc4c('0x16'),_0x25b4bd[_0xfc4c('0x13')],_0x2f7879);_0x10f6b8(_0x4f33c7[_0xfc4c('0x11')](0x1f4,_0x25b4bd[_0xfc4c('0x13')]));});});}; \ No newline at end of file +var _0x2292=['request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','limit','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','OpenchannelApplication,\x20%s,\x20%s'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x2292,0x11e));var _0x2229=function(_0x2f421,_0x5144c4){_0x2f421=_0x2f421-0x0;var _0x27b4af=_0x2292[_0x2f421];return _0x27b4af;};'use strict';var _=require(_0x2229('0x0'));var util=require('util');var moment=require(_0x2229('0x1'));var BPromise=require(_0x2229('0x2'));var rs=require(_0x2229('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2229('0x4'));var logger=require(_0x2229('0x5'))(_0x2229('0x6'));var config=require(_0x2229('0x7'));var jayson=require(_0x2229('0x8'));var client=jayson[_0x2229('0x9')][_0x2229('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x460424,_0x5576e2,_0x5237de){return new BPromise(function(_0x118f03,_0xea1ad7){return client['request'](_0x460424,_0x5237de)[_0x2229('0xb')](function(_0x185cb6){logger[_0x2229('0xc')](_0x2229('0xd'),_0x5576e2,_0x2229('0xe'));logger[_0x2229('0xf')](_0x2229('0x10'),_0x5576e2,_0x2229('0xe'),JSON[_0x2229('0x11')](_0x185cb6));if(_0x185cb6['error']){if(_0x185cb6[_0x2229('0x12')][_0x2229('0x13')]===0x1f4){logger[_0x2229('0x12')](_0x2229('0xd'),_0x5576e2,_0x185cb6[_0x2229('0x12')][_0x2229('0x14')]);return _0xea1ad7(_0x185cb6[_0x2229('0x12')][_0x2229('0x14')]);}logger[_0x2229('0x12')](_0x2229('0xd'),_0x5576e2,_0x185cb6[_0x2229('0x12')][_0x2229('0x14')]);return _0x118f03(_0x185cb6[_0x2229('0x12')]['message']);}else{logger[_0x2229('0xc')]('OpenchannelApplication,\x20%s,\x20%s',_0x5576e2,_0x2229('0xe'));_0x118f03(_0x185cb6['result'][_0x2229('0x14')]);}})[_0x2229('0x15')](function(_0x2f2f7c){logger[_0x2229('0x12')]('OpenchannelApplication,\x20%s,\x20%s',_0x5576e2,_0x2f2f7c);_0xea1ad7(_0x2f2f7c);});});}exports[_0x2229('0x16')]=function(_0x3aa259){var _0x4315c5=this;return new Promise(function(_0x10c342,_0x35f32a){return db[_0x2229('0x17')][_0x2229('0x18')](_0x3aa259[_0x2229('0x19')],{'raw':_0x3aa259[_0x2229('0x1a')]?_0x3aa259[_0x2229('0x1a')][_0x2229('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3aa259[_0x2229('0x1a')]?_0x3aa259[_0x2229('0x1a')][_0x2229('0x1c')]||null:null,'attributes':_0x3aa259['options']?_0x3aa259[_0x2229('0x1a')]['attributes']||null:null,'limit':_0x3aa259[_0x2229('0x1a')]?_0x3aa259['options'][_0x2229('0x1d')]||null:null})['then'](function(_0x2f49f6){logger[_0x2229('0xc')](_0x2229('0x16'),_0x3aa259);logger[_0x2229('0xf')](_0x2229('0x16'),_0x3aa259,JSON[_0x2229('0x11')](_0x2f49f6));_0x10c342(_0x2f49f6);})[_0x2229('0x15')](function(_0x581766){logger['error'](_0x2229('0x16'),_0x581766[_0x2229('0x14')],_0x3aa259);_0x35f32a(_0x4315c5[_0x2229('0x12')](0x1f4,_0x581766['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index dbafb97..534d24f 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 _0x0ca5=['../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','index','/describe','isAuthenticated','describe','get','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannel','addTags','put','openchannelinteraction:update','delete','openchannelinteraction:destroy','destroy','removeTags','multer','path','connect-timeout','express','Router'];(function(_0x3c7a06,_0x20a471){var _0x86875=function(_0x592fda){while(--_0x592fda){_0x3c7a06['push'](_0x3c7a06['shift']());}};_0x86875(++_0x20a471);}(_0x0ca5,0x15b));var _0x50ca=function(_0x2bda17,_0x4b23ee){_0x2bda17=_0x2bda17-0x0;var _0x4b8097=_0x0ca5[_0x2bda17];return _0x4b8097;};'use strict';var multer=require(_0x50ca('0x0'));var util=require('util');var path=require(_0x50ca('0x1'));var timeout=require(_0x50ca('0x2'));var express=require(_0x50ca('0x3'));var router=express[_0x50ca('0x4')]();var auth=require(_0x50ca('0x5'));var interaction=require(_0x50ca('0x6'));var config=require('../../config/environment');var controller=require(_0x50ca('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x50ca('0x8')]);router['get'](_0x50ca('0x9'),auth[_0x50ca('0xa')](),controller[_0x50ca('0xb')]);router[_0x50ca('0xc')](_0x50ca('0xd'),auth[_0x50ca('0xa')](),controller[_0x50ca('0xe')]);router[_0x50ca('0xc')](_0x50ca('0xf'),auth[_0x50ca('0xa')](),controller[_0x50ca('0x10')]);router['get'](_0x50ca('0x11'),auth['isAuthenticated'](),controller[_0x50ca('0x12')]);router[_0x50ca('0x13')]('/',auth[_0x50ca('0xa')](),controller[_0x50ca('0x14')]);router['post'](_0x50ca('0xf'),auth['isAuthenticated'](),controller[_0x50ca('0x15')]);router[_0x50ca('0x13')](_0x50ca('0x16'),auth['isAuthenticated'](),interaction[_0x50ca('0x17')](_0x50ca('0x18'),'openchannelinteraction:addtags'),controller[_0x50ca('0x19')]);router[_0x50ca('0x1a')]('/:id',auth[_0x50ca('0xa')](),interaction[_0x50ca('0x17')](_0x50ca('0x18'),_0x50ca('0x1b')),controller['update']);router[_0x50ca('0x1c')](_0x50ca('0xd'),auth[_0x50ca('0xa')](),interaction[_0x50ca('0x17')](_0x50ca('0x18'),_0x50ca('0x1d')),controller[_0x50ca('0x1e')]);router['delete'](_0x50ca('0x16'),auth[_0x50ca('0xa')](),controller[_0x50ca('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x6dff=['express','Router','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','openchannelinteraction:update','destroy','delete','exports','util'];(function(_0x329d13,_0x1aff27){var _0x33efd9=function(_0x265b7d){while(--_0x265b7d){_0x329d13['push'](_0x329d13['shift']());}};_0x33efd9(++_0x1aff27);}(_0x6dff,0x6f));var _0xf6df=function(_0x3a99b3,_0x25b11c){_0x3a99b3=_0x3a99b3-0x0;var _0x387014=_0x6dff[_0x3a99b3];return _0x387014;};'use strict';var multer=require('multer');var util=require(_0xf6df('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf6df('0x1'));var router=express[_0xf6df('0x2')]();var auth=require(_0xf6df('0x3'));var interaction=require(_0xf6df('0x4'));var config=require('../../config/environment');var controller=require(_0xf6df('0x5'));router[_0xf6df('0x6')]('/',auth[_0xf6df('0x7')](),controller[_0xf6df('0x8')]);router['get'](_0xf6df('0x9'),auth[_0xf6df('0x7')](),controller[_0xf6df('0xa')]);router[_0xf6df('0x6')](_0xf6df('0xb'),auth[_0xf6df('0x7')](),controller[_0xf6df('0xc')]);router['get'](_0xf6df('0xd'),auth[_0xf6df('0x7')](),controller[_0xf6df('0xe')]);router[_0xf6df('0x6')](_0xf6df('0xf'),auth['isAuthenticated'](),controller[_0xf6df('0x10')]);router[_0xf6df('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xf6df('0xd'),auth[_0xf6df('0x7')](),controller[_0xf6df('0x12')]);router[_0xf6df('0x11')](_0xf6df('0x13'),auth['isAuthenticated'](),interaction[_0xf6df('0x14')](_0xf6df('0x15'),_0xf6df('0x16')),controller[_0xf6df('0x17')]);router['put'](_0xf6df('0xb'),auth[_0xf6df('0x7')](),interaction['tracked'](_0xf6df('0x15'),_0xf6df('0x18')),controller['update']);router['delete'](_0xf6df('0xb'),auth[_0xf6df('0x7')](),interaction[_0xf6df('0x14')](_0xf6df('0x15'),'openchannelinteraction:destroy'),controller[_0xf6df('0x19')]);router[_0xf6df('0x1a')]('/:id/tags',auth['isAuthenticated'](),controller['removeTags']);module[_0xf6df('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 02e00ad..b6cfa95 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 _0xe4d6=['exports','BOOLEAN','DATE','STRING','ENUM','sequelize'];(function(_0x525078,_0x45d74e){var _0x5423c1=function(_0x928451){while(--_0x928451){_0x525078['push'](_0x525078['shift']());}};_0x5423c1(++_0x45d74e);}(_0xe4d6,0xd7));var _0x6e4d=function(_0x1c20b9,_0x5a3d3a){_0x1c20b9=_0x1c20b9-0x0;var _0x295bbf=_0xe4d6[_0x1c20b9];return _0x295bbf;};'use strict';var Sequelize=require(_0x6e4d('0x0'));module[_0x6e4d('0x1')]={'closed':{'type':Sequelize[_0x6e4d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6e4d('0x3')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x6e4d('0x4')]},'read1stAt':{'type':Sequelize[_0x6e4d('0x3')]},'threadId':{'type':Sequelize[_0x6e4d('0x4')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x6e4d('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x6e4d('0x4')]}}; \ No newline at end of file +var _0x2dd3=['ENUM','out','exports','BOOLEAN','DATE','STRING'];(function(_0x151381,_0x97b314){var _0x2afab6=function(_0x4b3941){while(--_0x4b3941){_0x151381['push'](_0x151381['shift']());}};_0x2afab6(++_0x97b314);}(_0x2dd3,0x6e));var _0x32dd=function(_0x507fe4,_0x10f923){_0x507fe4=_0x507fe4-0x0;var _0x56bdee=_0x2dd3[_0x507fe4];return _0x56bdee;};'use strict';var Sequelize=require('sequelize');module[_0x32dd('0x0')]={'closed':{'type':Sequelize[_0x32dd('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x32dd('0x2')]},'disposition':{'type':Sequelize[_0x32dd('0x3')]},'note':{'type':Sequelize[_0x32dd('0x3')]},'read1stAt':{'type':Sequelize[_0x32dd('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x32dd('0x3')]},'lastMsgAt':{'type':Sequelize[_0x32dd('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x32dd('0x4')]('in',_0x32dd('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x32dd('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 85cff7f..7f1a358 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 _0xbd18=['add','day','merge','filter','options','include','push','Tags','read','OpenchannelMessage','direction','createdAt','distinct','count','then','includeAll','User','Users','fullname','CmContact','Contact','Owner','internal','OpenchannelAccount','Account','key','Tag','color','tag','ThroughTags','OpenchannelInteraction','params','keys','find','catch','create','body','update','describe','addMessage','ids','omit','findOne','OpenchannelInteractionId','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','emit','removeTags','download','unix','toString','root','files','tmp','server','attachments','join','interaction-%s.zip','firstName','Attachment','Letter','1cm','mkdirSync','

Date:\x20%s

','MMMM\x20Do\x20YYYY,\x20HH:mm:ss','
','Messages','','existsSync','createReadStream','createWriteStream','basename','toFile','interaction-','.pdf','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','json','offset','limit','apply','reject','destroy','end','sendStatus','stack','name','rawAttributes','model','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick'];(function(_0x3c5f8d,_0x39891f){var _0x3b7beb=function(_0x44d6c9){while(--_0x44d6c9){_0x3c5f8d['push'](_0x3c5f8d['shift']());}};_0x3b7beb(++_0x39891f);}(_0xbd18,0x163));var _0x8bd1=function(_0x31b25e,_0x346563){_0x31b25e=_0x31b25e-0x0;var _0x41c5de=_0xbd18[_0x31b25e];return _0x41c5de;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x8bd1('0x0'));var zipdir=require(_0x8bd1('0x1'));var jsonpatch=require(_0x8bd1('0x2'));var rp=require('request-promise');var moment=require(_0x8bd1('0x3'));var BPromise=require(_0x8bd1('0x4'));var Mustache=require(_0x8bd1('0x5'));var util=require(_0x8bd1('0x6'));var path=require(_0x8bd1('0x7'));var sox=require('sox');var csv=require(_0x8bd1('0x8'));var ejs=require(_0x8bd1('0x9'));var fs=require('fs');var _=require(_0x8bd1('0xa'));var squel=require(_0x8bd1('0xb'));var crypto=require('crypto');var jsforce=require(_0x8bd1('0xc'));var deskjs=require(_0x8bd1('0xd'));var toCsv=require(_0x8bd1('0x8'));var querystring=require('querystring');var Papa=require(_0x8bd1('0xe'));var Redis=require(_0x8bd1('0xf'));var qs=require('../../components/parsers/qs');var logger=require(_0x8bd1('0x10'))('api');var utils=require(_0x8bd1('0x11'));var config=require('../../config/environment');var db=require(_0x8bd1('0x12'))['db'];config[_0x8bd1('0x13')]=_[_0x8bd1('0x14')](config[_0x8bd1('0x13')],{'host':_0x8bd1('0x15'),'port':0x18eb});var socket=require(_0x8bd1('0x16'))(new Redis(config[_0x8bd1('0x13')]));require('./openchannelInteraction.socket')[_0x8bd1('0x17')](socket);function respondWithStatusCode(_0x112ba3,_0x511a0e){_0x511a0e=_0x511a0e||0xcc;return function(_0x25eae9){if(_0x25eae9){return _0x112ba3['sendStatus'](_0x511a0e);}return _0x112ba3[_0x8bd1('0x18')](_0x511a0e)['end']();};}function respondWithResult(_0x37f255,_0x5b8a02){_0x5b8a02=_0x5b8a02||0xc8;return function(_0x1c5535){if(_0x1c5535){return _0x37f255['status'](_0x5b8a02)[_0x8bd1('0x19')](_0x1c5535);}};}function respondWithFilteredResult(_0x354d5f,_0x40e796){return function(_0x3f7a32){if(_0x3f7a32){var _0x1f665a=_0x3f7a32['count'],_0x25c881=_0x40e796['offset'],_0x4de15b=_0x40e796[_0x8bd1('0x1a')]+_0x40e796[_0x8bd1('0x1b')],_0xa5244b;if(_0x4de15b>=_0x1f665a){_0x4de15b=_0x1f665a;_0xa5244b=0xc8;}else{_0xa5244b=0xce;}_0x354d5f[_0x8bd1('0x18')](_0xa5244b);return _0x354d5f['set']('Content-Range',_0x25c881+'-'+_0x4de15b+'/'+_0x1f665a)[_0x8bd1('0x19')](_0x3f7a32);}return null;};}function patchUpdates(_0x90498f){return function(_0x4ec957){try{jsonpatch[_0x8bd1('0x1c')](_0x4ec957,_0x90498f,!![]);}catch(_0x5611bd){return BPromise[_0x8bd1('0x1d')](_0x5611bd);}return _0x4ec957['save']();};}function saveUpdates(_0xd494a3,_0x17ef8d){return function(_0x1e717c){if(_0x1e717c){return _0x1e717c['update'](_0xd494a3)['then'](function(_0x3dc991){return _0x3dc991;});}return null;};}function removeEntity(_0x36f43b,_0x1503f7){return function(_0x148661){if(_0x148661){return _0x148661[_0x8bd1('0x1e')]()['then'](function(){_0x36f43b[_0x8bd1('0x18')](0xcc)[_0x8bd1('0x1f')]();});}};}function handleEntityNotFound(_0x38f791,_0x43f6e2){return function(_0xa387a3){if(!_0xa387a3){_0x38f791[_0x8bd1('0x20')](0x194);}return _0xa387a3;};}function handleError(_0x38109a,_0x56f52d){_0x56f52d=_0x56f52d||0x1f4;return function(_0x18a7c1){logger['error'](_0x18a7c1[_0x8bd1('0x21')]);if(_0x18a7c1[_0x8bd1('0x22')]){delete _0x18a7c1[_0x8bd1('0x22')];}_0x38109a[_0x8bd1('0x18')](_0x56f52d)['send'](_0x18a7c1);};}exports['index']=function(_0x2c2842,_0x4cac06){var _0x2e04b3={},_0x422183={},_0x32a5fd={'count':0x0,'rows':[]};var _0x41db44=db['OpenchannelInteraction'][_0x8bd1('0x23')];_0x422183[_0x8bd1('0x24')]=_['keys'](_0x41db44);var _0x5c1098={'dateStart':_0x2c2842[_0x8bd1('0x25')][_0x8bd1('0x26')],'dateEnd':_0x2c2842['query']['dateEnd']};delete _0x2c2842[_0x8bd1('0x25')]['dateStart'];delete _0x2c2842[_0x8bd1('0x25')][_0x8bd1('0x27')];_0x422183[_0x8bd1('0x25')]=_['keys'](_0x2c2842[_0x8bd1('0x25')]);_0x422183[_0x8bd1('0x28')]=_[_0x8bd1('0x29')](_0x422183[_0x8bd1('0x24')],_0x422183[_0x8bd1('0x25')]);_0x2e04b3[_0x8bd1('0x2a')]=_[_0x8bd1('0x29')](_0x422183['model'],qs[_0x8bd1('0x2b')](_0x2c2842[_0x8bd1('0x25')][_0x8bd1('0x2b')]));_0x2e04b3[_0x8bd1('0x2a')]=_0x2e04b3[_0x8bd1('0x2a')][_0x8bd1('0x2c')]?_0x2e04b3[_0x8bd1('0x2a')]:_0x422183[_0x8bd1('0x24')];if(!_0x2c2842[_0x8bd1('0x25')]['hasOwnProperty'](_0x8bd1('0x2d'))){_0x2e04b3[_0x8bd1('0x1b')]=qs[_0x8bd1('0x1b')](_0x2c2842[_0x8bd1('0x25')][_0x8bd1('0x1b')]);_0x2e04b3[_0x8bd1('0x1a')]=qs['offset'](_0x2c2842[_0x8bd1('0x25')][_0x8bd1('0x1a')]);}_0x2e04b3[_0x8bd1('0x2e')]=qs[_0x8bd1('0x2f')](_0x2c2842['query']['sort']);_0x2e04b3[_0x8bd1('0x30')]=qs[_0x8bd1('0x28')](_[_0x8bd1('0x31')](_0x2c2842[_0x8bd1('0x25')],_0x422183['filters']));if(_0x5c1098['dateStart']){if(_0x5c1098['dateEnd']){_0x5c1098[_0x8bd1('0x27')]=moment(_0x5c1098['dateEnd'])[_0x8bd1('0x32')](0x1,_0x8bd1('0x33'));}else{_0x5c1098[_0x8bd1('0x27')]=moment(_0x5c1098[_0x8bd1('0x26')])[_0x8bd1('0x32')](0x1,_0x8bd1('0x33'));}_[_0x8bd1('0x34')](_0x2e04b3['where'],{'createdAt':{'$gte':_0x5c1098[_0x8bd1('0x26')],'$lte':_0x5c1098[_0x8bd1('0x27')]}});}if(_0x2c2842[_0x8bd1('0x25')]['filter']){_0x2e04b3['where']=_[_0x8bd1('0x34')](_0x2e04b3[_0x8bd1('0x30')],{'$or':_['map'](_0x2e04b3[_0x8bd1('0x2a')],function(_0x1ae812){var _0x3f0300={};_0x3f0300[_0x1ae812]={'$like':'%'+_0x2c2842[_0x8bd1('0x25')][_0x8bd1('0x35')]+'%'};return _0x3f0300;})});}_0x2e04b3=_[_0x8bd1('0x34')]({},_0x2e04b3,_0x2c2842[_0x8bd1('0x36')]);var _0x219454={'where':_0x2e04b3[_0x8bd1('0x30')]};_0x219454['include']=[];if(_0x2c2842['query']['tag']){_0x219454[_0x8bd1('0x37')][_0x8bd1('0x38')]({'model':db['Tag'],'as':_0x8bd1('0x39'),'attributes':['id'],'where':{'id':_0x2c2842[_0x8bd1('0x25')]['tag']},'required':!![]});_0x219454['distinct']=!![];}if(_0x2c2842[_0x8bd1('0x25')][_0x8bd1('0x3a')]){_0x219454[_0x8bd1('0x37')][_0x8bd1('0x38')]({'model':db[_0x8bd1('0x3b')],'as':'Messages','attributes':['id',_0x8bd1('0x3c'),_0x8bd1('0x3d'),_0x8bd1('0x3a')],'where':{'direction':'in','read':_0x2c2842['query'][_0x8bd1('0x3a')]||![]},'required':!![]});_0x219454[_0x8bd1('0x3e')]=!![];}return db['OpenchannelInteraction'][_0x8bd1('0x3f')](_0x219454)[_0x8bd1('0x40')](function(_0x4d1fe4){_0x32a5fd[_0x8bd1('0x3f')]=_0x4d1fe4;if(_0x2c2842['query'][_0x8bd1('0x41')]){_0x2e04b3['include']=[{'model':db[_0x8bd1('0x42')],'as':_0x8bd1('0x43'),'required':![],'attributes':['id',_0x8bd1('0x22'),_0x8bd1('0x44')]},{'model':db[_0x8bd1('0x45')],'as':_0x8bd1('0x46'),'required':![]},{'model':db[_0x8bd1('0x42')],'as':_0x8bd1('0x47'),'attributes':[_0x8bd1('0x22'),_0x8bd1('0x44'),_0x8bd1('0x48')],'required':![]},{'model':db[_0x8bd1('0x49')],'as':_0x8bd1('0x4a'),'attributes':[_0x8bd1('0x22'),_0x8bd1('0x4b')],'required':![]},{'model':db[_0x8bd1('0x3b')],'as':'Messages','attributes':['id',_0x8bd1('0x3c'),_0x8bd1('0x3d'),'read'],'where':{'direction':'in','read':_0x2c2842[_0x8bd1('0x25')][_0x8bd1('0x3a')]||![]},'required':_0x2c2842[_0x8bd1('0x25')][_0x8bd1('0x3a')]||![]},{'model':db[_0x8bd1('0x4c')],'as':_0x8bd1('0x39'),'attributes':['id',_0x8bd1('0x22'),_0x8bd1('0x4d')],'required':_0x2c2842['query'][_0x8bd1('0x4e')]?!![]:![]},{'model':db[_0x8bd1('0x4c')],'as':_0x8bd1('0x4f'),'attributes':['id','name',_0x8bd1('0x4d')],'through':_0x2c2842[_0x8bd1('0x25')]['tag']?{'attributes':[],'where':{'TagId':_0x2c2842[_0x8bd1('0x25')][_0x8bd1('0x4e')]||undefined}}:{},'required':_0x2c2842[_0x8bd1('0x25')][_0x8bd1('0x4e')]?!![]:![]}];}return db[_0x8bd1('0x50')]['findAll'](_0x2e04b3);})[_0x8bd1('0x40')](function(_0x19088f){_0x32a5fd['rows']=_0x19088f;return _0x32a5fd;})[_0x8bd1('0x40')](respondWithFilteredResult(_0x4cac06,_0x2e04b3))['catch'](handleError(_0x4cac06,null));};exports['show']=function(_0x1361fb,_0x31837b){var _0x35285a={'raw':![],'where':{'id':_0x1361fb[_0x8bd1('0x51')]['id']}},_0x2bcb0c={};_0x2bcb0c['model']=_['keys'](db[_0x8bd1('0x50')][_0x8bd1('0x23')]);_0x2bcb0c[_0x8bd1('0x25')]=_[_0x8bd1('0x52')](_0x1361fb['query']);_0x2bcb0c[_0x8bd1('0x28')]=_[_0x8bd1('0x29')](_0x2bcb0c[_0x8bd1('0x24')],_0x2bcb0c[_0x8bd1('0x25')]);_0x35285a[_0x8bd1('0x2a')]=_[_0x8bd1('0x29')](_0x2bcb0c[_0x8bd1('0x24')],qs[_0x8bd1('0x2b')](_0x1361fb[_0x8bd1('0x25')][_0x8bd1('0x2b')]));_0x35285a[_0x8bd1('0x2a')]=_0x35285a[_0x8bd1('0x2a')]['length']?_0x35285a['attributes']:_0x2bcb0c[_0x8bd1('0x24')];if(_0x1361fb[_0x8bd1('0x25')][_0x8bd1('0x41')]){_0x35285a[_0x8bd1('0x37')]=[{'all':!![]}];}_0x35285a=_[_0x8bd1('0x34')]({},_0x35285a,_0x1361fb[_0x8bd1('0x36')]);return db[_0x8bd1('0x50')][_0x8bd1('0x53')](_0x35285a)['then'](handleEntityNotFound(_0x31837b,null))[_0x8bd1('0x40')](respondWithResult(_0x31837b,null))[_0x8bd1('0x54')](handleError(_0x31837b,null));};exports[_0x8bd1('0x55')]=function(_0x1679d6,_0x315d55){return db['OpenchannelInteraction'][_0x8bd1('0x55')](_0x1679d6[_0x8bd1('0x56')],{})[_0x8bd1('0x40')](respondWithResult(_0x315d55,0xc9))['catch'](handleError(_0x315d55,null));};exports[_0x8bd1('0x57')]=function(_0x1f4b29,_0x57f124){if(_0x1f4b29['body']['id']){delete _0x1f4b29[_0x8bd1('0x56')]['id'];}return db[_0x8bd1('0x50')][_0x8bd1('0x53')]({'where':{'id':_0x1f4b29['params']['id']}})[_0x8bd1('0x40')](handleEntityNotFound(_0x57f124,null))[_0x8bd1('0x40')](saveUpdates(_0x1f4b29[_0x8bd1('0x56')],null))[_0x8bd1('0x40')](respondWithResult(_0x57f124,null))[_0x8bd1('0x54')](handleError(_0x57f124,null));};exports['destroy']=function(_0x4600cb,_0x37599f){return db['OpenchannelInteraction'][_0x8bd1('0x53')]({'where':{'id':_0x4600cb[_0x8bd1('0x51')]['id']}})[_0x8bd1('0x40')](handleEntityNotFound(_0x37599f,null))[_0x8bd1('0x40')](removeEntity(_0x37599f,null))[_0x8bd1('0x54')](handleError(_0x37599f,null));};exports[_0x8bd1('0x58')]=function(_0x17a886,_0x23932a){return db[_0x8bd1('0x50')]['describe']()[_0x8bd1('0x40')](respondWithResult(_0x23932a,null))[_0x8bd1('0x54')](handleError(_0x23932a,null));};exports[_0x8bd1('0x59')]=function(_0x3e689b,_0x2a4745,_0x3071cd){return db[_0x8bd1('0x3b')][_0x8bd1('0x53')]({'where':{'id':_0x3e689b[_0x8bd1('0x51')]['id']}})[_0x8bd1('0x40')](handleEntityNotFound(_0x2a4745,null))[_0x8bd1('0x40')](function(_0x2ea174){if(_0x2ea174){return _0x2ea174['addMessage'](_0x3e689b[_0x8bd1('0x56')][_0x8bd1('0x5a')],_[_0x8bd1('0x5b')](_0x3e689b[_0x8bd1('0x56')],[_0x8bd1('0x5a'),'id'])||{});}})[_0x8bd1('0x40')](respondWithResult(_0x2a4745,null))[_0x8bd1('0x54')](handleError(_0x2a4745,null));};exports['getMessages']=function(_0x2c3371,_0x53dd8e,_0x1ae69a){var _0x19e4d7={'raw':![],'where':{}};var _0x6411cb={};var _0x54514c={'count':0x0,'rows':[]};return db[_0x8bd1('0x50')][_0x8bd1('0x5c')]({'where':{'id':_0x2c3371['params']['id']}})[_0x8bd1('0x40')](handleEntityNotFound(_0x53dd8e,null))[_0x8bd1('0x40')](function(_0xdf2e72){if(_0xdf2e72){_0x6411cb[_0x8bd1('0x24')]=_[_0x8bd1('0x52')](db[_0x8bd1('0x3b')][_0x8bd1('0x23')]);_0x6411cb[_0x8bd1('0x25')]=_[_0x8bd1('0x52')](_0x2c3371['query']);_0x6411cb[_0x8bd1('0x28')]=_['intersection'](_0x6411cb[_0x8bd1('0x24')],_0x6411cb['query']);_0x19e4d7[_0x8bd1('0x2a')]=_['intersection'](_0x6411cb[_0x8bd1('0x24')],qs['fields'](_0x2c3371[_0x8bd1('0x25')]['fields']));_0x19e4d7['attributes']=_0x19e4d7['attributes'][_0x8bd1('0x2c')]?_0x19e4d7['attributes']:_0x6411cb[_0x8bd1('0x24')];if(!_0x2c3371[_0x8bd1('0x25')]['hasOwnProperty']('nolimit')){_0x19e4d7[_0x8bd1('0x1b')]=qs[_0x8bd1('0x1b')](_0x2c3371[_0x8bd1('0x25')][_0x8bd1('0x1b')]);_0x19e4d7[_0x8bd1('0x1a')]=qs['offset'](_0x2c3371[_0x8bd1('0x25')][_0x8bd1('0x1a')]);}_0x19e4d7[_0x8bd1('0x2e')]=qs[_0x8bd1('0x2f')](_0x2c3371[_0x8bd1('0x25')][_0x8bd1('0x2f')]);_0x19e4d7[_0x8bd1('0x30')]=qs[_0x8bd1('0x28')](_[_0x8bd1('0x31')](_0x2c3371[_0x8bd1('0x25')],_0x6411cb['filters']));_0x19e4d7[_0x8bd1('0x30')][_0x8bd1('0x5d')]=_0xdf2e72['id'];if(_0x2c3371[_0x8bd1('0x25')]['filter']){_0x19e4d7['where']=_[_0x8bd1('0x34')](_0x19e4d7[_0x8bd1('0x30')],{'$or':_[_0x8bd1('0x5e')](_0x19e4d7[_0x8bd1('0x2a')],function(_0x300a85){var _0xd7df13={};_0xd7df13[_0x300a85]={'$like':'%'+_0x2c3371['query'][_0x8bd1('0x35')]+'%'};return _0xd7df13;})});}if(_0x2c3371[_0x8bd1('0x25')]['$gte']){var _0x19da0e=_0x2c3371[_0x8bd1('0x25')][_0x8bd1('0x5f')][_0x8bd1('0x60')](',');var _0x43b03d={};_0x43b03d[_0x19da0e[0x0]]={'$gte':moment(_0x19da0e[0x1])[_0x8bd1('0x61')](_0x8bd1('0x62'))};_0x19e4d7[_0x8bd1('0x30')]=_[_0x8bd1('0x34')](_0x19e4d7[_0x8bd1('0x30')],_0x43b03d);}_0x19e4d7=_[_0x8bd1('0x34')]({},_0x19e4d7,_0x2c3371[_0x8bd1('0x36')]);return db[_0x8bd1('0x3b')][_0x8bd1('0x3f')]({'where':_0x19e4d7[_0x8bd1('0x30')]})['then'](function(_0x1559df){_0x54514c[_0x8bd1('0x3f')]=_0x1559df;if(_0x2c3371[_0x8bd1('0x25')][_0x8bd1('0x41')]){_0x19e4d7[_0x8bd1('0x37')]=[{'all':!![]}];}return db[_0x8bd1('0x3b')]['findAll'](_0x19e4d7);})[_0x8bd1('0x40')](function(_0x283d2d){_0x54514c[_0x8bd1('0x63')]=_0x283d2d;return _0x54514c;});}})[_0x8bd1('0x40')](respondWithFilteredResult(_0x53dd8e,_0x19e4d7))[_0x8bd1('0x54')](handleError(_0x53dd8e,null));};exports[_0x8bd1('0x64')]=function(_0x5e9867,_0x22248d,_0x11afde){return db[_0x8bd1('0x50')][_0x8bd1('0x53')]({'where':{'id':_0x5e9867['params']['id']}})[_0x8bd1('0x40')](handleEntityNotFound(_0x22248d,null))[_0x8bd1('0x40')](function(_0x4d6369){if(_0x4d6369){return _0x4d6369[_0x8bd1('0x65')](_0x5e9867[_0x8bd1('0x56')][_0x8bd1('0x5a')],_[_0x8bd1('0x5b')](_0x5e9867['body'],[_0x8bd1('0x5a'),'id'])||{})[_0x8bd1('0x66')](function(){return db[_0x8bd1('0x4c')]['findAll']({'attributes':['id',_0x8bd1('0x22'),_0x8bd1('0x4d')],'where':{'id':_0x5e9867[_0x8bd1('0x56')][_0x8bd1('0x5a')]}});})['then'](function(_0x5527a3){socket[_0x8bd1('0x67')]('openchannelInteractionTags:save',{'id':Number(_0x5e9867[_0x8bd1('0x51')]['id']),'tags':_0x5527a3||[]});return{'id':Number(_0x5e9867[_0x8bd1('0x51')]['id']),'tags':_0x5527a3||[]};});}})[_0x8bd1('0x40')](respondWithResult(_0x22248d,null))[_0x8bd1('0x54')](handleError(_0x22248d,null));};exports[_0x8bd1('0x68')]=function(_0x14a6a2,_0x62a47b,_0x3e6151){var _0x59f29b;return db[_0x8bd1('0x50')][_0x8bd1('0x53')]({'where':{'id':_0x14a6a2['params']['id']}})[_0x8bd1('0x40')](handleEntityNotFound(_0x62a47b,null))['then'](function(_0x32675b){if(_0x32675b){return _0x32675b[_0x8bd1('0x68')](_0x14a6a2[_0x8bd1('0x25')][_0x8bd1('0x5a')]);}})['then'](respondWithStatusCode(_0x62a47b,null))[_0x8bd1('0x54')](handleError(_0x62a47b,null));};exports[_0x8bd1('0x69')]=function(_0x3be939,_0x58438a){var _0x507d44=moment()[_0x8bd1('0x6a')]()[_0x8bd1('0x6b')]();var _0x4a6d21=path['join'](config[_0x8bd1('0x6c')],'server',_0x8bd1('0x6d'),_0x8bd1('0x6e'));var _0x13c7ab=path['join'](config[_0x8bd1('0x6c')],_0x8bd1('0x6f'),_0x8bd1('0x6d'),_0x8bd1('0x70'));var _0x38e763=path[_0x8bd1('0x71')](_0x4a6d21,_0x507d44);var _0x29e34d=util[_0x8bd1('0x61')](_0x8bd1('0x72'),_0x507d44);var _0x50a512=path['join'](_0x4a6d21,_0x29e34d);var _0x31a6c5=![];return db[_0x8bd1('0x50')][_0x8bd1('0x53')]({'where':{'id':_0x3be939['params']['id']},'include':[{'model':db['OpenchannelMessage'],'as':'Messages','attributes':['id',_0x8bd1('0x56')],'include':[{'model':db[_0x8bd1('0x42')],'as':'User','attributes':['id',_0x8bd1('0x44')],'raw':!![]},{'model':db[_0x8bd1('0x45')],'as':_0x8bd1('0x46'),'attributes':['id',_0x8bd1('0x73')],'raw':!![]},{'model':db['Attachment'],'as':_0x8bd1('0x74'),'raw':!![]}]}]})[_0x8bd1('0x40')](handleEntityNotFound(_0x58438a,null))[_0x8bd1('0x40')](function(_0x3d799b){if(_0x3d799b){_0x31a6c5=!![];var _0x9977e2='';var _0x164ea1={'format':_0x8bd1('0x75'),'border':_0x8bd1('0x76')};fs[_0x8bd1('0x77')](_0x38e763);_0x9977e2+=util[_0x8bd1('0x61')]('

Openchannel\x20Interaction:\x20#%d

',_0x3d799b['id']);_0x9977e2+=util[_0x8bd1('0x61')](_0x8bd1('0x78'),moment()[_0x8bd1('0x61')](_0x8bd1('0x79'))[_0x8bd1('0x6b')]());_0x9977e2+=_0x8bd1('0x7a');for(var _0x435c27=0x0;_0x435c27<_0x3d799b[_0x8bd1('0x7b')][_0x8bd1('0x2c')];_0x435c27++){var _0x578646=_0x3d799b[_0x8bd1('0x7b')][_0x435c27];_0x9977e2+=_0x8bd1('0x7c');_0x9977e2+=util[_0x8bd1('0x61')]('%s:\x20%s

',_0x578646[_0x8bd1('0x42')]?_0x578646['User'][_0x8bd1('0x44')]:_0x578646[_0x8bd1('0x46')][_0x8bd1('0x73')],_0x578646[_0x8bd1('0x56')]);_0x9977e2+='';if(_0x578646[_0x8bd1('0x74')]){var _0xa47e30=_0x578646[_0x8bd1('0x74')];var _0x305092=path[_0x8bd1('0x71')](_0x13c7ab,_0xa47e30['basename']);if(fs[_0x8bd1('0x7d')](_0x305092)){fs[_0x8bd1('0x7e')](_0x305092)['pipe'](fs[_0x8bd1('0x7f')](path[_0x8bd1('0x71')](_0x38e763,_0xa47e30[_0x8bd1('0x80')])));}}}return new BPromise(function(_0x2fc6d8,_0x1ce56d){pdf[_0x8bd1('0x55')](_0x9977e2,_0x164ea1)[_0x8bd1('0x81')](path[_0x8bd1('0x71')](_0x38e763,_0x8bd1('0x82')+_0x507d44+_0x8bd1('0x83')),function(_0x4c88a8,_0x1ab060){if(_0x4c88a8)return _0x1ce56d(_0x4c88a8);_0x2fc6d8(_0x1ab060);});});}})['then'](function(){if(_0x31a6c5){return new BPromise(function(_0x487ff4,_0x307b26){zipdir(_0x38e763,{'saveTo':_0x50a512},function(_0x41aac8,_0x3b8632){if(_0x41aac8)return _0x307b26(_0x41aac8);return _0x487ff4(_0x3b8632);});});}})['then'](function(){if(_0x31a6c5){return new BPromise(function(_0x3dcfb2,_0x4c2456){rimraf(_0x38e763,function(_0x1edc73){if(_0x1edc73)_0x4c2456(_0x1edc73);return _0x3dcfb2();});});}})[_0x8bd1('0x40')](function(){if(_0x31a6c5){return _0x58438a[_0x8bd1('0x69')](_0x50a512,_0x29e34d,function(_0x572d92){if(_0x572d92){console[_0x8bd1('0x84')](_0x8bd1('0x85'),_0x572d92);}else{fs[_0x8bd1('0x86')](_0x50a512);}});}else{return _0x58438a[_0x8bd1('0x20')](0xc8);}})[_0x8bd1('0x54')](handleError(_0x58438a,null));}; \ No newline at end of file +var _0x2a15=['ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','update','destroy','then','error','name','OpenchannelInteraction','model','keys','dateStart','query','dateEnd','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','add','day','merge','filter','map','options','include','tag','Tags','distinct','read','OpenchannelMessage','direction','createdAt','User','Users','fullname','CmContact','Contact','Owner','OpenchannelAccount','Account','key','Messages','Tag','color','ThroughTags','findAll','rows','catch','show','rawAttributes','includeAll','find','create','body','params','describe','addMessage','ids','omit','getMessages','findOne','OpenchannelInteractionId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','emit','removeTags','download','unix','join','root','tmp','server','files','attachments','interaction-%s.zip','firstName','Attachment','Letter','1cm','mkdirSync','

Openchannel\x20Interaction:\x20#%d

','MMMM\x20Do\x20YYYY,\x20HH:mm:ss','toString','
','','%s:\x20%s

','basename','existsSync','createReadStream','pipe','createWriteStream','toFile','interaction-','.pdf','log','err','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x2a15,0x1a4));var _0x52a1=function(_0x87b453,_0x4c4a29){_0x87b453=_0x87b453-0x0;var _0x3079f6=_0x2a15[_0x87b453];return _0x3079f6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x52a1('0x0'));var rimraf=require(_0x52a1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x52a1('0x2'));var rp=require(_0x52a1('0x3'));var moment=require('moment');var BPromise=require(_0x52a1('0x4'));var Mustache=require(_0x52a1('0x5'));var util=require(_0x52a1('0x6'));var path=require('path');var sox=require(_0x52a1('0x7'));var csv=require(_0x52a1('0x8'));var ejs=require(_0x52a1('0x9'));var fs=require('fs');var _=require(_0x52a1('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x52a1('0xb'));var deskjs=require(_0x52a1('0xc'));var toCsv=require(_0x52a1('0x8'));var querystring=require(_0x52a1('0xd'));var Papa=require(_0x52a1('0xe'));var Redis=require(_0x52a1('0xf'));var qs=require(_0x52a1('0x10'));var logger=require(_0x52a1('0x11'))(_0x52a1('0x12'));var utils=require(_0x52a1('0x13'));var config=require(_0x52a1('0x14'));var db=require(_0x52a1('0x15'))['db'];config[_0x52a1('0x16')]=_[_0x52a1('0x17')](config[_0x52a1('0x16')],{'host':_0x52a1('0x18'),'port':0x18eb});var socket=require(_0x52a1('0x19'))(new Redis(config[_0x52a1('0x16')]));require(_0x52a1('0x1a'))[_0x52a1('0x1b')](socket);function respondWithStatusCode(_0x594c7f,_0x48b71a){_0x48b71a=_0x48b71a||0xcc;return function(_0x4de2b6){if(_0x4de2b6){return _0x594c7f[_0x52a1('0x1c')](_0x48b71a);}return _0x594c7f[_0x52a1('0x1d')](_0x48b71a)[_0x52a1('0x1e')]();};}function respondWithResult(_0x32cc88,_0x4e301a){_0x4e301a=_0x4e301a||0xc8;return function(_0xf96588){if(_0xf96588){return _0x32cc88[_0x52a1('0x1d')](_0x4e301a)['json'](_0xf96588);}};}function respondWithFilteredResult(_0x4fe9af,_0x47541c){return function(_0x14ceb9){if(_0x14ceb9){var _0x29f990=_0x14ceb9[_0x52a1('0x1f')],_0x574c80=_0x47541c[_0x52a1('0x20')],_0x1cf1cc=_0x47541c[_0x52a1('0x20')]+_0x47541c[_0x52a1('0x21')],_0x3af342;if(_0x1cf1cc>=_0x29f990){_0x1cf1cc=_0x29f990;_0x3af342=0xc8;}else{_0x3af342=0xce;}_0x4fe9af[_0x52a1('0x1d')](_0x3af342);return _0x4fe9af[_0x52a1('0x22')](_0x52a1('0x23'),_0x574c80+'-'+_0x1cf1cc+'/'+_0x29f990)[_0x52a1('0x24')](_0x14ceb9);}return null;};}function patchUpdates(_0x2c87ba){return function(_0x50d2d9){try{jsonpatch['apply'](_0x50d2d9,_0x2c87ba,!![]);}catch(_0x119405){return BPromise[_0x52a1('0x25')](_0x119405);}return _0x50d2d9['save']();};}function saveUpdates(_0x96650b,_0x545223){return function(_0x71f18a){if(_0x71f18a){return _0x71f18a[_0x52a1('0x26')](_0x96650b)['then'](function(_0x56e65a){return _0x56e65a;});}return null;};}function removeEntity(_0x666c7d,_0x96ea18){return function(_0x13a823){if(_0x13a823){return _0x13a823[_0x52a1('0x27')]()[_0x52a1('0x28')](function(){_0x666c7d[_0x52a1('0x1d')](0xcc)[_0x52a1('0x1e')]();});}};}function handleEntityNotFound(_0x40fe9a,_0x2095b6){return function(_0x1e0f40){if(!_0x1e0f40){_0x40fe9a[_0x52a1('0x1c')](0x194);}return _0x1e0f40;};}function handleError(_0x139f6c,_0x1b283d){_0x1b283d=_0x1b283d||0x1f4;return function(_0x55698e){logger[_0x52a1('0x29')](_0x55698e['stack']);if(_0x55698e[_0x52a1('0x2a')]){delete _0x55698e['name'];}_0x139f6c[_0x52a1('0x1d')](_0x1b283d)['send'](_0x55698e);};}exports['index']=function(_0x4820ad,_0x667e1){var _0x1a1598={},_0x62ffe={},_0x214ede={'count':0x0,'rows':[]};var _0x475b42=db[_0x52a1('0x2b')]['rawAttributes'];_0x62ffe[_0x52a1('0x2c')]=_[_0x52a1('0x2d')](_0x475b42);var _0x34ed50={'dateStart':_0x4820ad['query'][_0x52a1('0x2e')],'dateEnd':_0x4820ad[_0x52a1('0x2f')][_0x52a1('0x30')]};delete _0x4820ad[_0x52a1('0x2f')][_0x52a1('0x2e')];delete _0x4820ad['query'][_0x52a1('0x30')];_0x62ffe['query']=_['keys'](_0x4820ad['query']);_0x62ffe['filters']=_[_0x52a1('0x31')](_0x62ffe[_0x52a1('0x2c')],_0x62ffe['query']);_0x1a1598[_0x52a1('0x32')]=_[_0x52a1('0x31')](_0x62ffe[_0x52a1('0x2c')],qs[_0x52a1('0x33')](_0x4820ad[_0x52a1('0x2f')][_0x52a1('0x33')]));_0x1a1598['attributes']=_0x1a1598[_0x52a1('0x32')][_0x52a1('0x34')]?_0x1a1598[_0x52a1('0x32')]:_0x62ffe[_0x52a1('0x2c')];if(!_0x4820ad[_0x52a1('0x2f')][_0x52a1('0x35')](_0x52a1('0x36'))){_0x1a1598[_0x52a1('0x21')]=qs[_0x52a1('0x21')](_0x4820ad[_0x52a1('0x2f')][_0x52a1('0x21')]);_0x1a1598[_0x52a1('0x20')]=qs[_0x52a1('0x20')](_0x4820ad[_0x52a1('0x2f')][_0x52a1('0x20')]);}_0x1a1598[_0x52a1('0x37')]=qs[_0x52a1('0x38')](_0x4820ad['query']['sort']);_0x1a1598[_0x52a1('0x39')]=qs[_0x52a1('0x3a')](_[_0x52a1('0x3b')](_0x4820ad[_0x52a1('0x2f')],_0x62ffe['filters']));if(_0x34ed50[_0x52a1('0x2e')]){if(_0x34ed50[_0x52a1('0x30')]){_0x34ed50['dateEnd']=moment(_0x34ed50[_0x52a1('0x30')])[_0x52a1('0x3c')](0x1,_0x52a1('0x3d'));}else{_0x34ed50[_0x52a1('0x30')]=moment(_0x34ed50['dateStart'])[_0x52a1('0x3c')](0x1,_0x52a1('0x3d'));}_[_0x52a1('0x3e')](_0x1a1598[_0x52a1('0x39')],{'createdAt':{'$gte':_0x34ed50[_0x52a1('0x2e')],'$lte':_0x34ed50[_0x52a1('0x30')]}});}if(_0x4820ad[_0x52a1('0x2f')][_0x52a1('0x3f')]){_0x1a1598[_0x52a1('0x39')]=_['merge'](_0x1a1598[_0x52a1('0x39')],{'$or':_[_0x52a1('0x40')](_0x1a1598[_0x52a1('0x32')],function(_0x55a1a8){var _0x5eda5d={};_0x5eda5d[_0x55a1a8]={'$like':'%'+_0x4820ad[_0x52a1('0x2f')][_0x52a1('0x3f')]+'%'};return _0x5eda5d;})});}_0x1a1598=_[_0x52a1('0x3e')]({},_0x1a1598,_0x4820ad[_0x52a1('0x41')]);var _0x5394eb={'where':_0x1a1598[_0x52a1('0x39')]};_0x5394eb[_0x52a1('0x42')]=[];if(_0x4820ad[_0x52a1('0x2f')][_0x52a1('0x43')]){_0x5394eb[_0x52a1('0x42')]['push']({'model':db['Tag'],'as':_0x52a1('0x44'),'attributes':['id'],'where':{'id':_0x4820ad[_0x52a1('0x2f')][_0x52a1('0x43')]},'required':!![]});_0x5394eb[_0x52a1('0x45')]=!![];}if(_0x4820ad['query'][_0x52a1('0x46')]){_0x5394eb[_0x52a1('0x42')]['push']({'model':db[_0x52a1('0x47')],'as':'Messages','attributes':['id',_0x52a1('0x48'),_0x52a1('0x49'),'read'],'where':{'direction':'in','read':_0x4820ad[_0x52a1('0x2f')][_0x52a1('0x46')]||![]},'required':!![]});_0x5394eb['distinct']=!![];}return db[_0x52a1('0x2b')][_0x52a1('0x1f')](_0x5394eb)[_0x52a1('0x28')](function(_0x413b7c){_0x214ede['count']=_0x413b7c;if(_0x4820ad[_0x52a1('0x2f')]['includeAll']){_0x1a1598['include']=[{'model':db[_0x52a1('0x4a')],'as':_0x52a1('0x4b'),'required':![],'attributes':['id','name',_0x52a1('0x4c')]},{'model':db[_0x52a1('0x4d')],'as':_0x52a1('0x4e'),'required':![]},{'model':db[_0x52a1('0x4a')],'as':_0x52a1('0x4f'),'attributes':[_0x52a1('0x2a'),_0x52a1('0x4c'),'internal'],'required':![]},{'model':db[_0x52a1('0x50')],'as':_0x52a1('0x51'),'attributes':['name',_0x52a1('0x52')],'required':![]},{'model':db[_0x52a1('0x47')],'as':_0x52a1('0x53'),'attributes':['id','direction','createdAt',_0x52a1('0x46')],'where':{'direction':'in','read':_0x4820ad[_0x52a1('0x2f')][_0x52a1('0x46')]||![]},'required':_0x4820ad['query']['read']||![]},{'model':db[_0x52a1('0x54')],'as':_0x52a1('0x44'),'attributes':['id',_0x52a1('0x2a'),_0x52a1('0x55')],'required':_0x4820ad['query'][_0x52a1('0x43')]?!![]:![]},{'model':db['Tag'],'as':_0x52a1('0x56'),'attributes':['id','name',_0x52a1('0x55')],'through':_0x4820ad[_0x52a1('0x2f')][_0x52a1('0x43')]?{'attributes':[],'where':{'TagId':_0x4820ad['query'][_0x52a1('0x43')]||undefined}}:{},'required':_0x4820ad[_0x52a1('0x2f')][_0x52a1('0x43')]?!![]:![]}];}return db[_0x52a1('0x2b')][_0x52a1('0x57')](_0x1a1598);})[_0x52a1('0x28')](function(_0x394723){_0x214ede[_0x52a1('0x58')]=_0x394723;return _0x214ede;})['then'](respondWithFilteredResult(_0x667e1,_0x1a1598))[_0x52a1('0x59')](handleError(_0x667e1,null));};exports[_0x52a1('0x5a')]=function(_0xd00044,_0x3d1ee2){var _0x429719={'raw':![],'where':{'id':_0xd00044['params']['id']}},_0x10b925={};_0x10b925[_0x52a1('0x2c')]=_[_0x52a1('0x2d')](db[_0x52a1('0x2b')][_0x52a1('0x5b')]);_0x10b925['query']=_[_0x52a1('0x2d')](_0xd00044[_0x52a1('0x2f')]);_0x10b925[_0x52a1('0x3a')]=_[_0x52a1('0x31')](_0x10b925[_0x52a1('0x2c')],_0x10b925[_0x52a1('0x2f')]);_0x429719['attributes']=_[_0x52a1('0x31')](_0x10b925[_0x52a1('0x2c')],qs['fields'](_0xd00044[_0x52a1('0x2f')][_0x52a1('0x33')]));_0x429719[_0x52a1('0x32')]=_0x429719[_0x52a1('0x32')][_0x52a1('0x34')]?_0x429719['attributes']:_0x10b925[_0x52a1('0x2c')];if(_0xd00044[_0x52a1('0x2f')][_0x52a1('0x5c')]){_0x429719['include']=[{'all':!![]}];}_0x429719=_['merge']({},_0x429719,_0xd00044[_0x52a1('0x41')]);return db[_0x52a1('0x2b')][_0x52a1('0x5d')](_0x429719)[_0x52a1('0x28')](handleEntityNotFound(_0x3d1ee2,null))[_0x52a1('0x28')](respondWithResult(_0x3d1ee2,null))[_0x52a1('0x59')](handleError(_0x3d1ee2,null));};exports['create']=function(_0x38b98a,_0x5d0e33){return db[_0x52a1('0x2b')][_0x52a1('0x5e')](_0x38b98a[_0x52a1('0x5f')],{})[_0x52a1('0x28')](respondWithResult(_0x5d0e33,0xc9))[_0x52a1('0x59')](handleError(_0x5d0e33,null));};exports[_0x52a1('0x26')]=function(_0x4d440b,_0x3efe77){if(_0x4d440b[_0x52a1('0x5f')]['id']){delete _0x4d440b[_0x52a1('0x5f')]['id'];}return db[_0x52a1('0x2b')][_0x52a1('0x5d')]({'where':{'id':_0x4d440b[_0x52a1('0x60')]['id']}})[_0x52a1('0x28')](handleEntityNotFound(_0x3efe77,null))['then'](saveUpdates(_0x4d440b[_0x52a1('0x5f')],null))[_0x52a1('0x28')](respondWithResult(_0x3efe77,null))[_0x52a1('0x59')](handleError(_0x3efe77,null));};exports[_0x52a1('0x27')]=function(_0x4cb1e1,_0x44508f){return db[_0x52a1('0x2b')][_0x52a1('0x5d')]({'where':{'id':_0x4cb1e1['params']['id']}})['then'](handleEntityNotFound(_0x44508f,null))[_0x52a1('0x28')](removeEntity(_0x44508f,null))['catch'](handleError(_0x44508f,null));};exports['describe']=function(_0x25e853,_0x346e56){return db[_0x52a1('0x2b')][_0x52a1('0x61')]()[_0x52a1('0x28')](respondWithResult(_0x346e56,null))['catch'](handleError(_0x346e56,null));};exports[_0x52a1('0x62')]=function(_0x1f3608,_0x377f7c,_0x4067d4){return db[_0x52a1('0x47')][_0x52a1('0x5d')]({'where':{'id':_0x1f3608[_0x52a1('0x60')]['id']}})[_0x52a1('0x28')](handleEntityNotFound(_0x377f7c,null))[_0x52a1('0x28')](function(_0x41d603){if(_0x41d603){return _0x41d603[_0x52a1('0x62')](_0x1f3608[_0x52a1('0x5f')][_0x52a1('0x63')],_[_0x52a1('0x64')](_0x1f3608[_0x52a1('0x5f')],['ids','id'])||{});}})['then'](respondWithResult(_0x377f7c,null))[_0x52a1('0x59')](handleError(_0x377f7c,null));};exports[_0x52a1('0x65')]=function(_0x4ac8a9,_0x189183,_0x401533){var _0x48132d={'raw':![],'where':{}};var _0x35fe39={};var _0xe21bef={'count':0x0,'rows':[]};return db[_0x52a1('0x2b')][_0x52a1('0x66')]({'where':{'id':_0x4ac8a9[_0x52a1('0x60')]['id']}})[_0x52a1('0x28')](handleEntityNotFound(_0x189183,null))[_0x52a1('0x28')](function(_0x223a8b){if(_0x223a8b){_0x35fe39['model']=_[_0x52a1('0x2d')](db['OpenchannelMessage']['rawAttributes']);_0x35fe39[_0x52a1('0x2f')]=_['keys'](_0x4ac8a9[_0x52a1('0x2f')]);_0x35fe39[_0x52a1('0x3a')]=_[_0x52a1('0x31')](_0x35fe39[_0x52a1('0x2c')],_0x35fe39['query']);_0x48132d[_0x52a1('0x32')]=_[_0x52a1('0x31')](_0x35fe39[_0x52a1('0x2c')],qs[_0x52a1('0x33')](_0x4ac8a9[_0x52a1('0x2f')][_0x52a1('0x33')]));_0x48132d[_0x52a1('0x32')]=_0x48132d[_0x52a1('0x32')][_0x52a1('0x34')]?_0x48132d['attributes']:_0x35fe39['model'];if(!_0x4ac8a9[_0x52a1('0x2f')][_0x52a1('0x35')](_0x52a1('0x36'))){_0x48132d[_0x52a1('0x21')]=qs[_0x52a1('0x21')](_0x4ac8a9['query'][_0x52a1('0x21')]);_0x48132d[_0x52a1('0x20')]=qs[_0x52a1('0x20')](_0x4ac8a9['query'][_0x52a1('0x20')]);}_0x48132d[_0x52a1('0x37')]=qs['sort'](_0x4ac8a9['query']['sort']);_0x48132d[_0x52a1('0x39')]=qs['filters'](_['pick'](_0x4ac8a9['query'],_0x35fe39[_0x52a1('0x3a')]));_0x48132d['where'][_0x52a1('0x67')]=_0x223a8b['id'];if(_0x4ac8a9[_0x52a1('0x2f')]['filter']){_0x48132d[_0x52a1('0x39')]=_[_0x52a1('0x3e')](_0x48132d[_0x52a1('0x39')],{'$or':_[_0x52a1('0x40')](_0x48132d[_0x52a1('0x32')],function(_0x44328f){var _0x42cfc0={};_0x42cfc0[_0x44328f]={'$like':'%'+_0x4ac8a9[_0x52a1('0x2f')][_0x52a1('0x3f')]+'%'};return _0x42cfc0;})});}if(_0x4ac8a9[_0x52a1('0x2f')][_0x52a1('0x68')]){var _0x5ba9b0=_0x4ac8a9[_0x52a1('0x2f')][_0x52a1('0x68')][_0x52a1('0x69')](',');var _0x5cf55f={};_0x5cf55f[_0x5ba9b0[0x0]]={'$gte':moment(_0x5ba9b0[0x1])[_0x52a1('0x6a')](_0x52a1('0x6b'))};_0x48132d['where']=_[_0x52a1('0x3e')](_0x48132d[_0x52a1('0x39')],_0x5cf55f);}_0x48132d=_['merge']({},_0x48132d,_0x4ac8a9[_0x52a1('0x41')]);return db[_0x52a1('0x47')][_0x52a1('0x1f')]({'where':_0x48132d[_0x52a1('0x39')]})[_0x52a1('0x28')](function(_0x4fe98a){_0xe21bef[_0x52a1('0x1f')]=_0x4fe98a;if(_0x4ac8a9['query'][_0x52a1('0x5c')]){_0x48132d['include']=[{'all':!![]}];}return db[_0x52a1('0x47')][_0x52a1('0x57')](_0x48132d);})[_0x52a1('0x28')](function(_0x1cf463){_0xe21bef[_0x52a1('0x58')]=_0x1cf463;return _0xe21bef;});}})[_0x52a1('0x28')](respondWithFilteredResult(_0x189183,_0x48132d))[_0x52a1('0x59')](handleError(_0x189183,null));};exports[_0x52a1('0x6c')]=function(_0x4a2a26,_0x48243a,_0x45750a){return db[_0x52a1('0x2b')]['find']({'where':{'id':_0x4a2a26[_0x52a1('0x60')]['id']}})[_0x52a1('0x28')](handleEntityNotFound(_0x48243a,null))[_0x52a1('0x28')](function(_0x456c2b){if(_0x456c2b){return _0x456c2b[_0x52a1('0x6d')](_0x4a2a26[_0x52a1('0x5f')]['ids'],_[_0x52a1('0x64')](_0x4a2a26[_0x52a1('0x5f')],[_0x52a1('0x63'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id','name',_0x52a1('0x55')],'where':{'id':_0x4a2a26[_0x52a1('0x5f')][_0x52a1('0x63')]}});})[_0x52a1('0x28')](function(_0xe2d95c){socket[_0x52a1('0x6e')]('openchannelInteractionTags:save',{'id':Number(_0x4a2a26['params']['id']),'tags':_0xe2d95c||[]});return{'id':Number(_0x4a2a26[_0x52a1('0x60')]['id']),'tags':_0xe2d95c||[]};});}})[_0x52a1('0x28')](respondWithResult(_0x48243a,null))[_0x52a1('0x59')](handleError(_0x48243a,null));};exports[_0x52a1('0x6f')]=function(_0x5742cb,_0x1ef2c5,_0xaf1b67){var _0x1fd783;return db[_0x52a1('0x2b')]['find']({'where':{'id':_0x5742cb['params']['id']}})[_0x52a1('0x28')](handleEntityNotFound(_0x1ef2c5,null))['then'](function(_0x51de88){if(_0x51de88){return _0x51de88[_0x52a1('0x6f')](_0x5742cb[_0x52a1('0x2f')][_0x52a1('0x63')]);}})[_0x52a1('0x28')](respondWithStatusCode(_0x1ef2c5,null))[_0x52a1('0x59')](handleError(_0x1ef2c5,null));};exports[_0x52a1('0x70')]=function(_0x100b00,_0x368048){var _0x41aa2e=moment()[_0x52a1('0x71')]()['toString']();var _0x428cb9=path[_0x52a1('0x72')](config[_0x52a1('0x73')],'server','files',_0x52a1('0x74'));var _0x130664=path['join'](config[_0x52a1('0x73')],_0x52a1('0x75'),_0x52a1('0x76'),_0x52a1('0x77'));var _0x238ba6=path['join'](_0x428cb9,_0x41aa2e);var _0x4d3b7a=util[_0x52a1('0x6a')](_0x52a1('0x78'),_0x41aa2e);var _0x2771e0=path[_0x52a1('0x72')](_0x428cb9,_0x4d3b7a);var _0x48bcab=![];return db[_0x52a1('0x2b')][_0x52a1('0x5d')]({'where':{'id':_0x100b00[_0x52a1('0x60')]['id']},'include':[{'model':db[_0x52a1('0x47')],'as':_0x52a1('0x53'),'attributes':['id','body'],'include':[{'model':db[_0x52a1('0x4a')],'as':_0x52a1('0x4a'),'attributes':['id',_0x52a1('0x4c')],'raw':!![]},{'model':db[_0x52a1('0x4d')],'as':_0x52a1('0x4e'),'attributes':['id',_0x52a1('0x79')],'raw':!![]},{'model':db[_0x52a1('0x7a')],'as':_0x52a1('0x7a'),'raw':!![]}]}]})[_0x52a1('0x28')](handleEntityNotFound(_0x368048,null))['then'](function(_0x4f1cad){if(_0x4f1cad){_0x48bcab=!![];var _0x50d10a='';var _0x55ce9f={'format':_0x52a1('0x7b'),'border':_0x52a1('0x7c')};fs[_0x52a1('0x7d')](_0x238ba6);_0x50d10a+=util[_0x52a1('0x6a')](_0x52a1('0x7e'),_0x4f1cad['id']);_0x50d10a+=util['format']('

Date:\x20%s

',moment()['format'](_0x52a1('0x7f'))[_0x52a1('0x80')]());_0x50d10a+=_0x52a1('0x81');for(var _0x5d5785=0x0;_0x5d5785<_0x4f1cad[_0x52a1('0x53')][_0x52a1('0x34')];_0x5d5785++){var _0x1e58b7=_0x4f1cad[_0x52a1('0x53')][_0x5d5785];_0x50d10a+=_0x52a1('0x82');_0x50d10a+=util[_0x52a1('0x6a')](_0x52a1('0x83'),_0x1e58b7[_0x52a1('0x4a')]?_0x1e58b7[_0x52a1('0x4a')][_0x52a1('0x4c')]:_0x1e58b7[_0x52a1('0x4e')][_0x52a1('0x79')],_0x1e58b7[_0x52a1('0x5f')]);_0x50d10a+='';if(_0x1e58b7['Attachment']){var _0x5e7073=_0x1e58b7[_0x52a1('0x7a')];var _0x5598d8=path['join'](_0x130664,_0x5e7073[_0x52a1('0x84')]);if(fs[_0x52a1('0x85')](_0x5598d8)){fs[_0x52a1('0x86')](_0x5598d8)[_0x52a1('0x87')](fs[_0x52a1('0x88')](path[_0x52a1('0x72')](_0x238ba6,_0x5e7073[_0x52a1('0x84')])));}}}return new BPromise(function(_0x510f62,_0x294bcf){pdf[_0x52a1('0x5e')](_0x50d10a,_0x55ce9f)[_0x52a1('0x89')](path[_0x52a1('0x72')](_0x238ba6,_0x52a1('0x8a')+_0x41aa2e+_0x52a1('0x8b')),function(_0x58acae,_0x4c5ac0){if(_0x58acae)return _0x294bcf(_0x58acae);_0x510f62(_0x4c5ac0);});});}})[_0x52a1('0x28')](function(){if(_0x48bcab){return new BPromise(function(_0x2c2a65,_0x32c2d2){zipdir(_0x238ba6,{'saveTo':_0x2771e0},function(_0xd7168d,_0x1ba562){if(_0xd7168d)return _0x32c2d2(_0xd7168d);return _0x2c2a65(_0x1ba562);});});}})['then'](function(){if(_0x48bcab){return new BPromise(function(_0x306552,_0x349f2b){rimraf(_0x238ba6,function(_0x393799){if(_0x393799)_0x349f2b(_0x393799);return _0x306552();});});}})['then'](function(){if(_0x48bcab){return _0x368048[_0x52a1('0x70')](_0x2771e0,_0x4d3b7a,function(_0x250fad){if(_0x250fad){console[_0x52a1('0x8c')](_0x52a1('0x8d'),_0x250fad);}else{fs[_0x52a1('0x8e')](_0x2771e0);}});}else{return _0x368048[_0x52a1('0x1c')](0xc8);}})[_0x52a1('0x59')](handleError(_0x368048,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 305c43a..8f9a651 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 _0xab40=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb','OpenchannelInteraction','setMaxListeners'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xab40,0x164));var _0x0ab4=function(_0x31b31c,_0x192f65){_0x31b31c=_0x31b31c-0x0;var _0x58307a=_0xab40[_0x31b31c];return _0x58307a;};'use strict';var EventEmitter=require(_0x0ab4('0x0'));var OpenchannelInteraction=require(_0x0ab4('0x1'))['db'][_0x0ab4('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x0ab4('0x3')](0x0);var events={'afterCreate':_0x0ab4('0x4'),'afterUpdate':_0x0ab4('0x5'),'afterDestroy':_0x0ab4('0x6')};function emitEvent(_0x57c067){return function(_0x5de8e3,_0xac41e9,_0x34d096){OpenchannelInteractionEvents[_0x0ab4('0x7')](_0x57c067+':'+_0x5de8e3['id'],_0x5de8e3);OpenchannelInteractionEvents[_0x0ab4('0x7')](_0x57c067,_0x5de8e3);_0x34d096(null);};}for(var e in events){if(events[_0x0ab4('0x8')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x93ec=['emit','events','../../mysqldb','setMaxListeners','update','remove'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x93ec,0x16f));var _0xc93e=function(_0x92116d,_0xa6ee1b){_0x92116d=_0x92116d-0x0;var _0xfe4f60=_0x93ec[_0x92116d];return _0xfe4f60;};'use strict';var EventEmitter=require(_0xc93e('0x0'));var OpenchannelInteraction=require(_0xc93e('0x1'))['db']['OpenchannelInteraction'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xc93e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc93e('0x3'),'afterDestroy':_0xc93e('0x4')};function emitEvent(_0x16a822){return function(_0x1f646c,_0x4ed262,_0x235dda){OpenchannelInteractionEvents[_0xc93e('0x5')](_0x16a822+':'+_0x1f646c['id'],_0x1f646c);OpenchannelInteractionEvents[_0xc93e('0x5')](_0x16a822,_0x1f646c);_0x235dda(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index ef45161..bde1805 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 _0x7915=['request-promise','./openchannelInteraction.attributes','define','OpenchannelInteraction','openchannel_interactions','lodash','bluebird'];(function(_0x425d5e,_0x3b9040){var _0x3cc67b=function(_0x121446){while(--_0x121446){_0x425d5e['push'](_0x425d5e['shift']());}};_0x3cc67b(++_0x3b9040);}(_0x7915,0x1be));var _0x5791=function(_0x3e6d7b,_0x511046){_0x3e6d7b=_0x3e6d7b-0x0;var _0x1f8e0e=_0x7915[_0x3e6d7b];return _0x1f8e0e;};'use strict';var _=require(_0x5791('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x5791('0x1'));var rp=require(_0x5791('0x2'));var attributes=require(_0x5791('0x3'));module['exports']=function(_0x167a8b,_0x418971){return _0x167a8b[_0x5791('0x4')](_0x5791('0x5'),attributes,{'tableName':_0x5791('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa8c0=['util','../../config/logger','api','moment','request-promise','exports','define','OpenchannelInteraction'];(function(_0x45fc65,_0x243f24){var _0x11eaa4=function(_0x3dad69){while(--_0x3dad69){_0x45fc65['push'](_0x45fc65['shift']());}};_0x11eaa4(++_0x243f24);}(_0xa8c0,0x118));var _0x0a8c=function(_0x427217,_0x4039b1){_0x427217=_0x427217-0x0;var _0x5b28fb=_0xa8c0[_0x427217];return _0x5b28fb;};'use strict';var _=require('lodash');var util=require(_0x0a8c('0x0'));var logger=require(_0x0a8c('0x1'))(_0x0a8c('0x2'));var moment=require(_0x0a8c('0x3'));var BPromise=require('bluebird');var rp=require(_0x0a8c('0x4'));var attributes=require('./openchannelInteraction.attributes');module[_0x0a8c('0x5')]=function(_0x2c6899,_0x12c166){return _0x2c6899[_0x0a8c('0x6')](_0x0a8c('0x7'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index d8f9b03..3a31633 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 _0x8958=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','then','AddTagsToOpenchannelInteraction','find','ids','omit','AddTags','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8958,0x93));var _0x8895=function(_0x5c1402,_0x5d5642){_0x5c1402=_0x5c1402-0x0;var _0x375f6f=_0x8958[_0x5c1402];return _0x375f6f;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8895('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x8895('0x2'))(_0x8895('0x3'));var config=require(_0x8895('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x8895('0x5')][_0x8895('0x6')]({'port':0x232a});config[_0x8895('0x7')]=_[_0x8895('0x8')](config[_0x8895('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x8895('0x9'))(new Redis(config[_0x8895('0x7')]));require(_0x8895('0xa'))[_0x8895('0xb')](socket);function respondWithRpcPromise(_0x6eab1e,_0x29c126,_0x22a12b){return new BPromise(function(_0xdb3d59,_0x46c467){return client[_0x8895('0xc')](_0x6eab1e,_0x22a12b)['then'](function(_0x1cf600){logger[_0x8895('0xd')](_0x8895('0xe'),_0x29c126,_0x8895('0xf'));logger[_0x8895('0x10')](_0x8895('0x11'),_0x29c126,'request\x20sent',JSON[_0x8895('0x12')](_0x1cf600));if(_0x1cf600[_0x8895('0x13')]){if(_0x1cf600[_0x8895('0x13')]['code']===0x1f4){logger['error'](_0x8895('0xe'),_0x29c126,_0x1cf600['error'][_0x8895('0x14')]);return _0x46c467(_0x1cf600[_0x8895('0x13')][_0x8895('0x14')]);}logger[_0x8895('0x13')](_0x8895('0xe'),_0x29c126,_0x1cf600['error'][_0x8895('0x14')]);return _0xdb3d59(_0x1cf600[_0x8895('0x13')][_0x8895('0x14')]);}else{logger[_0x8895('0xd')](_0x8895('0xe'),_0x29c126,_0x8895('0xf'));_0xdb3d59(_0x1cf600[_0x8895('0x15')][_0x8895('0x14')]);}})[_0x8895('0x16')](function(_0x2da618){logger[_0x8895('0x13')](_0x8895('0xe'),_0x29c126,_0x2da618);_0x46c467(_0x2da618);});});}exports[_0x8895('0x17')]=function(_0x54e6d4){var _0x522a4e=this;return new Promise(function(_0x4fcbc3,_0x3daf43){return db[_0x8895('0x18')][_0x8895('0x19')](_0x54e6d4[_0x8895('0x1a')],{'raw':_0x54e6d4[_0x8895('0x1b')]?_0x54e6d4[_0x8895('0x1b')][_0x8895('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54e6d4[_0x8895('0x1b')]?_0x54e6d4['options'][_0x8895('0x1d')]||null:null,'attributes':_0x54e6d4[_0x8895('0x1b')]?_0x54e6d4[_0x8895('0x1b')][_0x8895('0x1e')]||null:null,'limit':_0x54e6d4[_0x8895('0x1b')]?_0x54e6d4['options']['limit']||null:null})[_0x8895('0x1f')](function(_0x398382){logger[_0x8895('0xd')](_0x8895('0x17'),_0x54e6d4);logger['debug'](_0x8895('0x17'),_0x54e6d4,JSON[_0x8895('0x12')](_0x398382));_0x4fcbc3(_0x398382);})[_0x8895('0x16')](function(_0x5486a6){logger['error'](_0x8895('0x17'),_0x5486a6['message'],_0x54e6d4);_0x3daf43(_0x522a4e[_0x8895('0x13')](0x1f4,_0x5486a6[_0x8895('0x14')]));});});};exports[_0x8895('0x20')]=function(_0xf5fb66){return new Promise(function(_0x153220,_0x5c03ea){return db['OpenchannelInteraction'][_0x8895('0x21')]({'where':_0xf5fb66[_0x8895('0x1b')]?_0xf5fb66[_0x8895('0x1b')][_0x8895('0x1d')]||null:null})[_0x8895('0x1f')](function(_0x560b93){if(_0x560b93){return _0x560b93['addTags'](_0xf5fb66[_0x8895('0x1a')][_0x8895('0x22')],_[_0x8895('0x23')](_0xf5fb66[_0x8895('0x1a')],[_0x8895('0x22'),'id'])||{});}})['spread'](function(_0x1da939){logger['info'](_0x8895('0x24'),_0xf5fb66);logger['debug'](_0x8895('0x24'),_0xf5fb66,JSON[_0x8895('0x12')](_0x1da939));_0x153220(_0x1da939);})[_0x8895('0x16')](function(_0x3e71fa){logger[_0x8895('0x13')]('AddTags',_0x3e71fa[_0x8895('0x14')],_0xf5fb66);_0x5c03ea(_this[_0x8895('0x13')](0x1f4,_0x3e71fa[_0x8895('0x14')]));});});}; \ No newline at end of file +var _0x326f=['omit','spread','info','AddTags','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','register','request','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','OpenchannelInteraction','options','where','attributes','limit','then','UpdateOpenchannelInteraction','find','addTags','body','ids'];(function(_0x4a8418,_0x39078a){var _0x390174=function(_0x173ea6){while(--_0x173ea6){_0x4a8418['push'](_0x4a8418['shift']());}};_0x390174(++_0x39078a);}(_0x326f,0xd1));var _0xf326=function(_0x25810e,_0x2ccfd6){_0x25810e=_0x25810e-0x0;var _0x3a0350=_0x326f[_0x25810e];return _0x3a0350;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});config[_0xf326('0xb')]=_[_0xf326('0xc')](config[_0xf326('0xb')],{'host':_0xf326('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0xf326('0xe')](socket);function respondWithRpcPromise(_0x1fc80e,_0x163416,_0x2686e1){return new BPromise(function(_0x1f3a33,_0x5db9d7){return client[_0xf326('0xf')](_0x1fc80e,_0x2686e1)['then'](function(_0x1cf441){logger['info'](_0xf326('0x10'),_0x163416,'request\x20sent');logger[_0xf326('0x11')](_0xf326('0x12'),_0x163416,'request\x20sent',JSON[_0xf326('0x13')](_0x1cf441));if(_0x1cf441[_0xf326('0x14')]){if(_0x1cf441[_0xf326('0x14')][_0xf326('0x15')]===0x1f4){logger['error'](_0xf326('0x10'),_0x163416,_0x1cf441['error']['message']);return _0x5db9d7(_0x1cf441[_0xf326('0x14')][_0xf326('0x16')]);}logger[_0xf326('0x14')](_0xf326('0x10'),_0x163416,_0x1cf441[_0xf326('0x14')][_0xf326('0x16')]);return _0x1f3a33(_0x1cf441[_0xf326('0x14')][_0xf326('0x16')]);}else{logger['info'](_0xf326('0x10'),_0x163416,_0xf326('0x17'));_0x1f3a33(_0x1cf441[_0xf326('0x18')][_0xf326('0x16')]);}})[_0xf326('0x19')](function(_0x311af0){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x163416,_0x311af0);_0x5db9d7(_0x311af0);});});}exports['UpdateOpenchannelInteraction']=function(_0x16e605){var _0x289f4b=this;return new Promise(function(_0x484cbe,_0x4cabce){return db[_0xf326('0x1a')]['update'](_0x16e605['body'],{'raw':_0x16e605[_0xf326('0x1b')]?_0x16e605[_0xf326('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16e605['options']?_0x16e605[_0xf326('0x1b')][_0xf326('0x1c')]||null:null,'attributes':_0x16e605['options']?_0x16e605[_0xf326('0x1b')][_0xf326('0x1d')]||null:null,'limit':_0x16e605[_0xf326('0x1b')]?_0x16e605[_0xf326('0x1b')][_0xf326('0x1e')]||null:null})[_0xf326('0x1f')](function(_0x5ce532){logger['info']('UpdateOpenchannelInteraction',_0x16e605);logger[_0xf326('0x11')](_0xf326('0x20'),_0x16e605,JSON[_0xf326('0x13')](_0x5ce532));_0x484cbe(_0x5ce532);})[_0xf326('0x19')](function(_0x148953){logger[_0xf326('0x14')]('UpdateOpenchannelInteraction',_0x148953[_0xf326('0x16')],_0x16e605);_0x4cabce(_0x289f4b[_0xf326('0x14')](0x1f4,_0x148953[_0xf326('0x16')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x1617d2){return new Promise(function(_0x55ad0f,_0x4a9abf){return db[_0xf326('0x1a')][_0xf326('0x21')]({'where':_0x1617d2[_0xf326('0x1b')]?_0x1617d2['options'][_0xf326('0x1c')]||null:null})[_0xf326('0x1f')](function(_0x55790d){if(_0x55790d){return _0x55790d[_0xf326('0x22')](_0x1617d2[_0xf326('0x23')][_0xf326('0x24')],_[_0xf326('0x25')](_0x1617d2[_0xf326('0x23')],[_0xf326('0x24'),'id'])||{});}})[_0xf326('0x26')](function(_0x39a1e2){logger[_0xf326('0x27')](_0xf326('0x28'),_0x1617d2);logger['debug'](_0xf326('0x28'),_0x1617d2,JSON[_0xf326('0x13')](_0x39a1e2));_0x55ad0f(_0x39a1e2);})[_0xf326('0x19')](function(_0x4792d2){logger[_0xf326('0x14')](_0xf326('0x28'),_0x4792d2[_0xf326('0x16')],_0x1617d2);_0x4a9abf(_this['error'](0x1f4,_0x4792d2['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index e8ffea5..06c336f 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 _0x5dd9=['emit','removeListener','register','./openchannelInteraction.events','remove','update'];(function(_0x14e9cf,_0xcd4862){var _0x578f35=function(_0x523c0e){while(--_0x523c0e){_0x14e9cf['push'](_0x14e9cf['shift']());}};_0x578f35(++_0xcd4862);}(_0x5dd9,0x15f));var _0x95dd=function(_0x1a8f86,_0x5ed9c4){_0x1a8f86=_0x1a8f86-0x0;var _0x20d876=_0x5dd9[_0x1a8f86];return _0x20d876;};'use strict';var OpenchannelInteractionEvents=require(_0x95dd('0x0'));var events=['save',_0x95dd('0x1'),_0x95dd('0x2')];function createListener(_0x573990,_0x432779){return function(_0x334595){_0x432779[_0x95dd('0x3')](_0x573990,_0x334595);};}function removeListener(_0x9f90fc,_0x18ea18){return function(){OpenchannelInteractionEvents[_0x95dd('0x4')](_0x9f90fc,_0x18ea18);};}exports[_0x95dd('0x5')]=function(_0x571663){for(var _0x2682cf=0x0,_0x267184=events['length'];_0x2682cf<_0x267184;_0x2682cf++){var _0x1e4d8e=events[_0x2682cf];var _0x58f303=createListener('openchannelInteraction:'+_0x1e4d8e,_0x571663);OpenchannelInteractionEvents['on'](_0x1e4d8e,_0x58f303);}}; \ No newline at end of file +var _0xe8a1=['openchannelInteraction:','save','remove','update','emit','removeListener','register','length'];(function(_0x14f837,_0x57f860){var _0x3ec952=function(_0x1aba44){while(--_0x1aba44){_0x14f837['push'](_0x14f837['shift']());}};_0x3ec952(++_0x57f860);}(_0xe8a1,0x189));var _0x1e8a=function(_0x473f7c,_0x454960){_0x473f7c=_0x473f7c-0x0;var _0x146537=_0xe8a1[_0x473f7c];return _0x146537;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x1e8a('0x0'),_0x1e8a('0x1'),_0x1e8a('0x2')];function createListener(_0xd19452,_0x538bd4){return function(_0x2476a4){_0x538bd4[_0x1e8a('0x3')](_0xd19452,_0x2476a4);};}function removeListener(_0xbf6d0e,_0x48fd51){return function(){OpenchannelInteractionEvents[_0x1e8a('0x4')](_0xbf6d0e,_0x48fd51);};}exports[_0x1e8a('0x5')]=function(_0x3da9f2){for(var _0x471b0c=0x0,_0x57ceaa=events[_0x1e8a('0x6')];_0x471b0c<_0x57ceaa;_0x471b0c++){var _0x302c4a=events[_0x471b0c];var _0x232dac=createListener(_0x1e8a('0x7')+_0x302c4a,_0x3da9f2);OpenchannelInteractionEvents['on'](_0x302c4a,_0x232dac);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 890b22d..f52eb0e 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 _0x644e=['tracked','openchannelmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','index','/describe','isAuthenticated','/:id','show','post'];(function(_0x4221cb,_0x197b31){var _0x55bb97=function(_0x2ebae4){while(--_0x2ebae4){_0x4221cb['push'](_0x4221cb['shift']());}};_0x55bb97(++_0x197b31);}(_0x644e,0x103));var _0xe644=function(_0x3ad4fc,_0x24407){_0x3ad4fc=_0x3ad4fc-0x0;var _0x45c370=_0x644e[_0x3ad4fc];return _0x45c370;};'use strict';var multer=require('multer');var util=require(_0xe644('0x0'));var path=require(_0xe644('0x1'));var timeout=require(_0xe644('0x2'));var express=require(_0xe644('0x3'));var router=express[_0xe644('0x4')]();var auth=require(_0xe644('0x5'));var interaction=require(_0xe644('0x6'));var config=require(_0xe644('0x7'));var controller=require(_0xe644('0x8'));router[_0xe644('0x9')]('/',auth['isAuthenticated'](),controller[_0xe644('0xa')]);router[_0xe644('0x9')](_0xe644('0xb'),auth[_0xe644('0xc')](),controller['describe']);router['get'](_0xe644('0xd'),auth[_0xe644('0xc')](),controller[_0xe644('0xe')]);router[_0xe644('0xf')]('/',auth[_0xe644('0xc')](),interaction[_0xe644('0x10')]('openchannel',_0xe644('0x11')),controller[_0xe644('0x12')]);router[_0xe644('0x13')](_0xe644('0xd'),auth[_0xe644('0xc')](),controller['update']);router[_0xe644('0x13')](_0xe644('0x14'),auth['isAuthenticated'](),controller[_0xe644('0x15')]);router[_0xe644('0x13')](_0xe644('0x16'),auth[_0xe644('0xc')](),controller[_0xe644('0x17')]);router['delete'](_0xe644('0xd'),auth['isAuthenticated'](),controller[_0xe644('0x18')]);module['exports']=router; \ No newline at end of file +var _0xeea1=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','tracked','openchannel','openchannelmessage:create','create','put','update','/:id/accept','accept','reject','destroy','multer'];(function(_0x3f7fd9,_0x5f4426){var _0x542dfa=function(_0x55fc30){while(--_0x55fc30){_0x3f7fd9['push'](_0x3f7fd9['shift']());}};_0x542dfa(++_0x5f4426);}(_0xeea1,0x1e5));var _0x1eea=function(_0x235701,_0x296c34){_0x235701=_0x235701-0x0;var _0x2831f8=_0xeea1[_0x235701];return _0x2831f8;};'use strict';var multer=require(_0x1eea('0x0'));var util=require(_0x1eea('0x1'));var path=require(_0x1eea('0x2'));var timeout=require(_0x1eea('0x3'));var express=require(_0x1eea('0x4'));var router=express[_0x1eea('0x5')]();var auth=require(_0x1eea('0x6'));var interaction=require(_0x1eea('0x7'));var config=require(_0x1eea('0x8'));var controller=require(_0x1eea('0x9'));router[_0x1eea('0xa')]('/',auth[_0x1eea('0xb')](),controller[_0x1eea('0xc')]);router[_0x1eea('0xa')](_0x1eea('0xd'),auth[_0x1eea('0xb')](),controller[_0x1eea('0xe')]);router[_0x1eea('0xa')](_0x1eea('0xf'),auth[_0x1eea('0xb')](),controller[_0x1eea('0x10')]);router['post']('/',auth[_0x1eea('0xb')](),interaction[_0x1eea('0x11')](_0x1eea('0x12'),_0x1eea('0x13')),controller[_0x1eea('0x14')]);router[_0x1eea('0x15')](_0x1eea('0xf'),auth[_0x1eea('0xb')](),controller[_0x1eea('0x16')]);router[_0x1eea('0x15')](_0x1eea('0x17'),auth[_0x1eea('0xb')](),controller[_0x1eea('0x18')]);router[_0x1eea('0x15')]('/:id/reject',auth['isAuthenticated'](),controller[_0x1eea('0x19')]);router['delete'](_0x1eea('0xf'),auth['isAuthenticated'](),controller[_0x1eea('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 76f48fd..e92d98d 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 _0x9492=['exports','TEXT','medium','BOOLEAN','out','DATE','sequelize'];(function(_0x3c2671,_0x37b009){var _0xb13b48=function(_0x32590f){while(--_0x32590f){_0x3c2671['push'](_0x3c2671['shift']());}};_0xb13b48(++_0x37b009);}(_0x9492,0x1f0));var _0x2949=function(_0x54faff,_0x9a3b5e){_0x54faff=_0x54faff-0x0;var _0x5a784c=_0x9492[_0x54faff];return _0x5a784c;};'use strict';var Sequelize=require(_0x2949('0x0'));module[_0x2949('0x1')]={'body':{'type':Sequelize[_0x2949('0x2')](_0x2949('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x2949('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x2949('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x2949('0x5')),'defaultValue':_0x2949('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x2949('0x6')]}}; \ No newline at end of file +var _0xcddb=['medium','BOOLEAN','ENUM','DATE','sequelize','exports','TEXT'];(function(_0x3eee78,_0x5acc63){var _0x53a5e5=function(_0x472fb6){while(--_0x472fb6){_0x3eee78['push'](_0x3eee78['shift']());}};_0x53a5e5(++_0x5acc63);}(_0xcddb,0x10e));var _0xbcdd=function(_0x1d4be7,_0x59c63){_0x1d4be7=_0x1d4be7-0x0;var _0x5f43a0=_0xcddb[_0x1d4be7];return _0x5f43a0;};'use strict';var Sequelize=require(_0xbcdd('0x0'));module[_0xbcdd('0x1')]={'body':{'type':Sequelize[_0xbcdd('0x2')](_0xbcdd('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xbcdd('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xbcdd('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbcdd('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xbcdd('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 90e06c7..7ceaaa6 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 _0x7a6d=['jsforce','desk.js','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','register','jayson/promise','http','client','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','apply','reject','update','destroy','name','OpenchannelMessage','rawAttributes','model','query','dateStart','dateEnd','keys','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','add','day','merge','map','filter','options','count','includeAll','include','rows','show','params','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','format','UserId','user','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','lodash','squel'];(function(_0x57ad90,_0x387568){var _0x3c0baa=function(_0x2e3106){while(--_0x2e3106){_0x57ad90['push'](_0x57ad90['shift']());}};_0x3c0baa(++_0x387568);}(_0x7a6d,0x14d));var _0xd7a6=function(_0xf73c09,_0x4e424e){_0xf73c09=_0xf73c09-0x0;var _0xa8923c=_0x7a6d[_0xf73c09];return _0xa8923c;};'use strict';var pdf=require(_0xd7a6('0x0'));var emlformat=require(_0xd7a6('0x1'));var rimraf=require(_0xd7a6('0x2'));var zipdir=require(_0xd7a6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd7a6('0x4'));var moment=require(_0xd7a6('0x5'));var BPromise=require(_0xd7a6('0x6'));var Mustache=require(_0xd7a6('0x7'));var util=require('util');var path=require(_0xd7a6('0x8'));var sox=require('sox');var csv=require(_0xd7a6('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd7a6('0xa'));var squel=require(_0xd7a6('0xb'));var crypto=require('crypto');var jsforce=require(_0xd7a6('0xc'));var deskjs=require(_0xd7a6('0xd'));var toCsv=require(_0xd7a6('0x9'));var querystring=require('querystring');var Papa=require(_0xd7a6('0xe'));var Redis=require(_0xd7a6('0xf'));var qs=require('../../components/parsers/qs');var logger=require(_0xd7a6('0x10'))(_0xd7a6('0x11'));var utils=require(_0xd7a6('0x12'));var config=require(_0xd7a6('0x13'));var db=require('../../mysqldb')['db'];config[_0xd7a6('0x14')]=_[_0xd7a6('0x15')](config[_0xd7a6('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0xd7a6('0x16'))(new Redis(config['redis']));require('./openchannelMessage.socket')[_0xd7a6('0x17')](socket);var jayson=require(_0xd7a6('0x18'));var client=jayson['client'][_0xd7a6('0x19')]({'port':0x232c});var client9002=jayson[_0xd7a6('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4852ca,_0x42cfb9,_0x143282,_0x744f18){return new BPromise(function(_0x5a3ea1,_0x285c38){var _0x9742a1=_0x744f18||client;return _0x9742a1[_0xd7a6('0x1b')](_0x4852ca,_0x143282)[_0xd7a6('0x1c')](function(_0x3726b7){logger[_0xd7a6('0x1d')](_0xd7a6('0x1e'),_0x42cfb9,_0xd7a6('0x1f'));logger[_0xd7a6('0x20')](_0xd7a6('0x21'),_0x42cfb9,_0xd7a6('0x1f'),JSON[_0xd7a6('0x22')](_0x3726b7));if(_0x3726b7[_0xd7a6('0x23')]){if(_0x3726b7[_0xd7a6('0x23')][_0xd7a6('0x24')]===0x1f4){logger[_0xd7a6('0x23')](_0xd7a6('0x1e'),_0x42cfb9,_0x3726b7[_0xd7a6('0x23')][_0xd7a6('0x25')]);return _0x285c38(_0x3726b7[_0xd7a6('0x23')][_0xd7a6('0x25')]);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x42cfb9,_0x3726b7['error'][_0xd7a6('0x25')]);return _0x5a3ea1(_0x3726b7[_0xd7a6('0x23')]['message']);}else{logger['info'](_0xd7a6('0x1e'),_0x42cfb9,'request\x20sent');_0x5a3ea1(_0x3726b7[_0xd7a6('0x26')][_0xd7a6('0x25')]);}})[_0xd7a6('0x27')](function(_0x3d8378){logger['error'](_0xd7a6('0x1e'),_0x42cfb9,_0x3d8378);_0x285c38(_0x3d8378);});});}function respondWithStatusCode(_0x2307da,_0x1ad4fa){_0x1ad4fa=_0x1ad4fa||0xcc;return function(_0x26fea2){if(_0x26fea2){return _0x2307da[_0xd7a6('0x28')](_0x1ad4fa);}return _0x2307da[_0xd7a6('0x29')](_0x1ad4fa)[_0xd7a6('0x2a')]();};}function respondWithResult(_0x2a78d3,_0x432966){_0x432966=_0x432966||0xc8;return function(_0x6519fd){if(_0x6519fd){return _0x2a78d3[_0xd7a6('0x29')](_0x432966)[_0xd7a6('0x2b')](_0x6519fd);}};}function respondWithFilteredResult(_0xdb32b2,_0x71ce19){return function(_0x119d4a){if(_0x119d4a){var _0x1cbf18=_0x119d4a['count'],_0x2038fc=_0x71ce19[_0xd7a6('0x2c')],_0xb5988d=_0x71ce19['offset']+_0x71ce19[_0xd7a6('0x2d')],_0x3f7813;if(_0xb5988d>=_0x1cbf18){_0xb5988d=_0x1cbf18;_0x3f7813=0xc8;}else{_0x3f7813=0xce;}_0xdb32b2[_0xd7a6('0x29')](_0x3f7813);return _0xdb32b2[_0xd7a6('0x2e')]('Content-Range',_0x2038fc+'-'+_0xb5988d+'/'+_0x1cbf18)['json'](_0x119d4a);}return null;};}function patchUpdates(_0x4ee67c){return function(_0x17c2e5){try{jsonpatch[_0xd7a6('0x2f')](_0x17c2e5,_0x4ee67c,!![]);}catch(_0x4b5061){return BPromise[_0xd7a6('0x30')](_0x4b5061);}return _0x17c2e5['save']();};}function saveUpdates(_0x17b32e,_0x24fc2c){return function(_0xd2db91){if(_0xd2db91){return _0xd2db91[_0xd7a6('0x31')](_0x17b32e)[_0xd7a6('0x1c')](function(_0x2ca5ec){return _0x2ca5ec;});}return null;};}function removeEntity(_0x2b0497,_0x8aa02f){return function(_0x2de3ed){if(_0x2de3ed){return _0x2de3ed[_0xd7a6('0x32')]()[_0xd7a6('0x1c')](function(){_0x2b0497['status'](0xcc)[_0xd7a6('0x2a')]();});}};}function handleEntityNotFound(_0x46cc65,_0x6cae43){return function(_0x45d5b9){if(!_0x45d5b9){_0x46cc65[_0xd7a6('0x28')](0x194);}return _0x45d5b9;};}function handleError(_0x2b9ed1,_0x39b942){_0x39b942=_0x39b942||0x1f4;return function(_0x476b90){logger['error'](_0x476b90['stack']);if(_0x476b90[_0xd7a6('0x33')]){delete _0x476b90[_0xd7a6('0x33')];}_0x2b9ed1[_0xd7a6('0x29')](_0x39b942)['send'](_0x476b90);};}exports['index']=function(_0x30a0bb,_0x3e3e41){var _0xe8b552={},_0x17d9ed={},_0x28e2d3={'count':0x0,'rows':[]};var _0x243ea9=db[_0xd7a6('0x34')][_0xd7a6('0x35')];_0x17d9ed[_0xd7a6('0x36')]=_['keys'](_0x243ea9);var _0x359d38={'dateStart':_0x30a0bb['query']['dateStart'],'dateEnd':_0x30a0bb[_0xd7a6('0x37')]['dateEnd']};delete _0x30a0bb[_0xd7a6('0x37')][_0xd7a6('0x38')];delete _0x30a0bb[_0xd7a6('0x37')][_0xd7a6('0x39')];_0x17d9ed[_0xd7a6('0x37')]=_[_0xd7a6('0x3a')](_0x30a0bb[_0xd7a6('0x37')]);_0x17d9ed['filters']=_[_0xd7a6('0x3b')](_0x17d9ed[_0xd7a6('0x36')],_0x17d9ed[_0xd7a6('0x37')]);_0xe8b552[_0xd7a6('0x3c')]=_[_0xd7a6('0x3b')](_0x17d9ed[_0xd7a6('0x36')],qs['fields'](_0x30a0bb[_0xd7a6('0x37')][_0xd7a6('0x3d')]));_0xe8b552[_0xd7a6('0x3c')]=_0xe8b552[_0xd7a6('0x3c')][_0xd7a6('0x3e')]?_0xe8b552[_0xd7a6('0x3c')]:_0x17d9ed[_0xd7a6('0x36')];if(!_0x30a0bb[_0xd7a6('0x37')]['hasOwnProperty'](_0xd7a6('0x3f'))){_0xe8b552[_0xd7a6('0x2d')]=qs[_0xd7a6('0x2d')](_0x30a0bb[_0xd7a6('0x37')][_0xd7a6('0x2d')]);_0xe8b552[_0xd7a6('0x2c')]=qs[_0xd7a6('0x2c')](_0x30a0bb[_0xd7a6('0x37')][_0xd7a6('0x2c')]);}_0xe8b552[_0xd7a6('0x40')]=qs[_0xd7a6('0x41')](_0x30a0bb['query'][_0xd7a6('0x41')]);_0xe8b552[_0xd7a6('0x42')]=qs['filters'](_[_0xd7a6('0x43')](_0x30a0bb['query'],_0x17d9ed[_0xd7a6('0x44')]));if(_0x359d38[_0xd7a6('0x38')]){if(_0x359d38['dateEnd']){_0x359d38[_0xd7a6('0x39')]=moment(_0x359d38[_0xd7a6('0x39')])[_0xd7a6('0x45')](0x1,_0xd7a6('0x46'));}else{_0x359d38['dateEnd']=moment(_0x359d38['dateStart'])[_0xd7a6('0x45')](0x1,_0xd7a6('0x46'));}_['merge'](_0xe8b552[_0xd7a6('0x42')],{'createdAt':{'$gte':_0x359d38[_0xd7a6('0x38')],'$lte':_0x359d38[_0xd7a6('0x39')]}});}if(_0x30a0bb[_0xd7a6('0x37')]['filter']){_0xe8b552[_0xd7a6('0x42')]=_[_0xd7a6('0x47')](_0xe8b552[_0xd7a6('0x42')],{'$or':_[_0xd7a6('0x48')](_0xe8b552[_0xd7a6('0x3c')],function(_0x46a47d){var _0x8a78b1={};_0x8a78b1[_0x46a47d]={'$like':'%'+_0x30a0bb[_0xd7a6('0x37')][_0xd7a6('0x49')]+'%'};return _0x8a78b1;})});}_0xe8b552=_[_0xd7a6('0x47')]({},_0xe8b552,_0x30a0bb[_0xd7a6('0x4a')]);var _0x2dd72a={'where':_0xe8b552['where']};return db[_0xd7a6('0x34')]['count'](_0x2dd72a)[_0xd7a6('0x1c')](function(_0x4078de){_0x28e2d3[_0xd7a6('0x4b')]=_0x4078de;if(_0x30a0bb[_0xd7a6('0x37')][_0xd7a6('0x4c')]){_0xe8b552[_0xd7a6('0x4d')]=[{'all':!![]}];}return db[_0xd7a6('0x34')]['findAll'](_0xe8b552);})['then'](function(_0x461676){_0x28e2d3[_0xd7a6('0x4e')]=_0x461676;return _0x28e2d3;})[_0xd7a6('0x1c')](respondWithFilteredResult(_0x3e3e41,_0xe8b552))[_0xd7a6('0x27')](handleError(_0x3e3e41,null));};exports[_0xd7a6('0x4f')]=function(_0xf48b30,_0x3cf841){var _0x304a1d={'raw':!![],'where':{'id':_0xf48b30[_0xd7a6('0x50')]['id']}},_0x5c69c8={};_0x5c69c8[_0xd7a6('0x36')]=_[_0xd7a6('0x3a')](db[_0xd7a6('0x34')][_0xd7a6('0x35')]);_0x5c69c8[_0xd7a6('0x37')]=_[_0xd7a6('0x3a')](_0xf48b30['query']);_0x5c69c8[_0xd7a6('0x44')]=_[_0xd7a6('0x3b')](_0x5c69c8[_0xd7a6('0x36')],_0x5c69c8[_0xd7a6('0x37')]);_0x304a1d[_0xd7a6('0x3c')]=_['intersection'](_0x5c69c8[_0xd7a6('0x36')],qs[_0xd7a6('0x3d')](_0xf48b30['query'][_0xd7a6('0x3d')]));_0x304a1d[_0xd7a6('0x3c')]=_0x304a1d[_0xd7a6('0x3c')][_0xd7a6('0x3e')]?_0x304a1d[_0xd7a6('0x3c')]:_0x5c69c8['model'];if(_0xf48b30[_0xd7a6('0x37')][_0xd7a6('0x4c')]){_0x304a1d[_0xd7a6('0x4d')]=[{'all':!![]}];}_0x304a1d=_['merge']({},_0x304a1d,_0xf48b30[_0xd7a6('0x4a')]);return db['OpenchannelMessage'][_0xd7a6('0x51')](_0x304a1d)[_0xd7a6('0x1c')](handleEntityNotFound(_0x3cf841,null))[_0xd7a6('0x1c')](respondWithResult(_0x3cf841,null))[_0xd7a6('0x27')](handleError(_0x3cf841,null));};exports[_0xd7a6('0x52')]=function(_0xbd915d,_0x1a74c0){return db[_0xd7a6('0x34')]['create'](_0xbd915d[_0xd7a6('0x53')],{})['then'](respondWithResult(_0x1a74c0,0xc9))[_0xd7a6('0x27')](handleError(_0x1a74c0,null));};exports[_0xd7a6('0x31')]=function(_0x2456c6,_0x5dda46){if(_0x2456c6[_0xd7a6('0x53')]['id']){delete _0x2456c6[_0xd7a6('0x53')]['id'];}return db['OpenchannelMessage'][_0xd7a6('0x51')]({'where':{'id':_0x2456c6[_0xd7a6('0x50')]['id']}})['then'](handleEntityNotFound(_0x5dda46,null))[_0xd7a6('0x1c')](saveUpdates(_0x2456c6[_0xd7a6('0x53')],null))[_0xd7a6('0x1c')](respondWithResult(_0x5dda46,null))[_0xd7a6('0x27')](handleError(_0x5dda46,null));};exports['destroy']=function(_0xbf63f1,_0x136731){return db[_0xd7a6('0x34')][_0xd7a6('0x51')]({'where':{'id':_0xbf63f1[_0xd7a6('0x50')]['id']}})[_0xd7a6('0x1c')](handleEntityNotFound(_0x136731,null))['then'](removeEntity(_0x136731,null))[_0xd7a6('0x27')](handleError(_0x136731,null));};exports['describe']=function(_0xa31a5b,_0x4e215e){return db[_0xd7a6('0x34')][_0xd7a6('0x54')]()[_0xd7a6('0x1c')](respondWithResult(_0x4e215e,null))[_0xd7a6('0x27')](handleError(_0x4e215e,null));};var interaction_log=require('../../config/logger')(_0xd7a6('0x55'));exports[_0xd7a6('0x56')]=function(_0x25b6a9,_0x52e85a,_0xc5a0f6){var _0x4a3e60={'channel':_0xd7a6('0x57')};if(_0x25b6a9['body']['id']){delete _0x25b6a9[_0xd7a6('0x53')]['id'];}_0x25b6a9[_0xd7a6('0x53')][_0xd7a6('0x58')]=!![];_0x25b6a9[_0xd7a6('0x53')][_0xd7a6('0x59')]=moment()[_0xd7a6('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0x25b6a9[_0xd7a6('0x53')][_0xd7a6('0x5b')]=_0x25b6a9[_0xd7a6('0x53')][_0xd7a6('0x5b')]||_0x25b6a9[_0xd7a6('0x5c')]['id'];return db[_0xd7a6('0x34')][_0xd7a6('0x51')]({'where':{'id':_0x25b6a9[_0xd7a6('0x50')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xd7a6('0x5d')}]})[_0xd7a6('0x1c')](handleEntityNotFound(_0x52e85a,null))[_0xd7a6('0x1c')](saveUpdates(_0x25b6a9[_0xd7a6('0x53')],null))[_0xd7a6('0x1c')](function(_0x4b07bc){if(_0x4b07bc){_0x4a3e60[_0xd7a6('0x25')]=_0x4b07bc[_0xd7a6('0x5e')]({'plain':!![]});return db[_0xd7a6('0x5f')][_0xd7a6('0x51')]({'where':{'id':_0x4b07bc[_0xd7a6('0x60')]}});}return null;})[_0xd7a6('0x1c')](handleEntityNotFound(_0x52e85a,null))[_0xd7a6('0x1c')](function(_0x4aa754){if(_0x4aa754){return _0x4aa754[_0xd7a6('0x31')]({'UserId':_0x25b6a9[_0xd7a6('0x53')][_0xd7a6('0x5b')],'read1stAt':_[_0xd7a6('0x61')](_0x4aa754['read1stAt'])?moment()['format'](_0xd7a6('0x62')):undefined});}return null;})[_0xd7a6('0x1c')](function(_0x413acb){if(_0x413acb){_0x4a3e60[_0xd7a6('0x63')]=_0x413acb[_0xd7a6('0x5e')]({'plain':!![]});interaction_log[_0xd7a6('0x1d')](_0xd7a6('0x64'),_0x25b6a9[_0xd7a6('0x5c')]['id'],_0x25b6a9[_0xd7a6('0x5c')]['name'],_0x25b6a9[_0xd7a6('0x5c')][_0xd7a6('0x65')],_0x4a3e60[_0xd7a6('0x63')]['id'],_0x25b6a9[_0xd7a6('0x53')]?JSON[_0xd7a6('0x22')](_0x25b6a9['body']):_0xd7a6('0x66'));return respondWithRpcPromise(_0xd7a6('0x67'),_0xd7a6('0x68'),_0x4a3e60);}return null;})[_0xd7a6('0x1c')](function(_0x1b039e){if(_0x1b039e){if(_0x25b6a9[_0xd7a6('0x53')][_0xd7a6('0x69')]){_0x4a3e60[_0xd7a6('0x25')][_0xd7a6('0x6a')]=util[_0xd7a6('0x5a')](_0xd7a6('0x6b'),_0x25b6a9['user']['name']);_0x4a3e60[_0xd7a6('0x25')][_0xd7a6('0x6c')]=_0x4a3e60[_0xd7a6('0x6c')];_0x4a3e60[_0xd7a6('0x25')][_0xd7a6('0x6d')]=_0xd7a6('0x56');return respondWithRpcPromise(_0xd7a6('0x6e'),_0xd7a6('0x6e'),{'event':'acceptmessage','message':_0x4a3e60['message']},client9002)[_0xd7a6('0x1c')](function(){return _0x4a3e60;});}return _0x4a3e60;}return null;})['then'](respondWithResult(_0x52e85a,null))[_0xd7a6('0x27')](handleError(_0x52e85a,null));};var interaction_log=require(_0xd7a6('0x10'))('openchannel-interactions');exports[_0xd7a6('0x30')]=function(_0x28d811,_0xd768ff,_0x5b2d96){var _0xcb03e2={'agent':{},'channel':_0xd7a6('0x57')};if(_0x28d811[_0xd7a6('0x53')]['id']){delete _0x28d811[_0xd7a6('0x53')]['id'];}_0x28d811[_0xd7a6('0x53')][_0xd7a6('0x5b')]=_0x28d811['body'][_0xd7a6('0x5b')]||_0x28d811[_0xd7a6('0x5c')]['id'];_0xcb03e2[_0xd7a6('0x6f')]['id']=_0x28d811['body'][_0xd7a6('0x5b')];return db[_0xd7a6('0x34')][_0xd7a6('0x51')]({'where':{'id':_0x28d811['params']['id'],'UserId':null}})[_0xd7a6('0x1c')](handleEntityNotFound(_0xd768ff,null))[_0xd7a6('0x1c')](function(_0x3c82a8){if(_0x3c82a8){_0xcb03e2[_0xd7a6('0x25')]=_0x3c82a8[_0xd7a6('0x5e')]({'plain':!![]});return db[_0xd7a6('0x5f')]['find']({'where':{'id':_0x3c82a8[_0xd7a6('0x60')]}});}return null;})[_0xd7a6('0x1c')](handleEntityNotFound(_0xd768ff,null))[_0xd7a6('0x1c')](function(_0x51dd92){if(_0x51dd92){_0xcb03e2[_0xd7a6('0x63')]=_0x51dd92[_0xd7a6('0x5e')]({'plain':!![]});interaction_log[_0xd7a6('0x1d')](_0xd7a6('0x70'),_0x28d811['user']['id'],_0x28d811[_0xd7a6('0x5c')][_0xd7a6('0x33')],_0x28d811[_0xd7a6('0x5c')][_0xd7a6('0x65')],_0xcb03e2[_0xd7a6('0x63')]['id'],_0x28d811[_0xd7a6('0x53')]?JSON[_0xd7a6('0x22')](_0x28d811[_0xd7a6('0x53')]):_0xd7a6('0x66'));return respondWithRpcPromise(_0xd7a6('0x71'),'rejectMessage',_0xcb03e2);}return null;})['then'](function(_0x31ef4e){if(_0x31ef4e){_0x31ef4e[_0xd7a6('0x25')][_0xd7a6('0x6a')]=util[_0xd7a6('0x5a')](_0xd7a6('0x6b'),_0x28d811['user'][_0xd7a6('0x33')]);_0x31ef4e[_0xd7a6('0x25')][_0xd7a6('0x6c')]=_0xcb03e2[_0xd7a6('0x6c')];_0x31ef4e[_0xd7a6('0x25')][_0xd7a6('0x6d')]=_0xd7a6('0x30');respondWithRpcPromise('EventManager',_0xd7a6('0x6e'),{'event':_0xd7a6('0x72'),'message':_0x31ef4e[_0xd7a6('0x25')]},client9002);return _0xcb03e2;}return null;})[_0xd7a6('0x1c')](respondWithResult(_0xd768ff,null))[_0xd7a6('0x27')](handleError(_0xd768ff,null));}; \ No newline at end of file +var _0x3dc3=['model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','add','day','merge','filter','map','options','include','findAll','rows','show','params','includeAll','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','acceptMessage','interface','channel','event','EventManager','acceptmessage','../../config/logger','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','SIP/%s','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','info','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','end','json','count','limit','apply','reject','save','update','destroy','then','sendStatus','stack','name','index','OpenchannelMessage','rawAttributes','keys','query','dateEnd','dateStart','filters','intersection'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3dc3,0x1b6));var _0x33dc=function(_0x4055bd,_0x3c59c9){_0x4055bd=_0x4055bd-0x0;var _0x41539f=_0x3dc3[_0x4055bd];return _0x41539f;};'use strict';var pdf=require(_0x33dc('0x0'));var emlformat=require(_0x33dc('0x1'));var rimraf=require(_0x33dc('0x2'));var zipdir=require(_0x33dc('0x3'));var jsonpatch=require(_0x33dc('0x4'));var rp=require('request-promise');var moment=require(_0x33dc('0x5'));var BPromise=require(_0x33dc('0x6'));var Mustache=require(_0x33dc('0x7'));var util=require(_0x33dc('0x8'));var path=require(_0x33dc('0x9'));var sox=require(_0x33dc('0xa'));var csv=require(_0x33dc('0xb'));var ejs=require(_0x33dc('0xc'));var fs=require('fs');var _=require(_0x33dc('0xd'));var squel=require(_0x33dc('0xe'));var crypto=require(_0x33dc('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x33dc('0x10'));var toCsv=require(_0x33dc('0xb'));var querystring=require('querystring');var Papa=require(_0x33dc('0x11'));var Redis=require(_0x33dc('0x12'));var qs=require(_0x33dc('0x13'));var logger=require('../../config/logger')(_0x33dc('0x14'));var utils=require(_0x33dc('0x15'));var config=require(_0x33dc('0x16'));var db=require(_0x33dc('0x17'))['db'];config[_0x33dc('0x18')]=_[_0x33dc('0x19')](config[_0x33dc('0x18')],{'host':_0x33dc('0x1a'),'port':0x18eb});var socket=require(_0x33dc('0x1b'))(new Redis(config[_0x33dc('0x18')]));require(_0x33dc('0x1c'))[_0x33dc('0x1d')](socket);var jayson=require(_0x33dc('0x1e'));var client=jayson[_0x33dc('0x1f')][_0x33dc('0x20')]({'port':0x232c});var client9002=jayson[_0x33dc('0x1f')][_0x33dc('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x9c3a52,_0x22443f,_0x5445cb,_0x1bfdaa){return new BPromise(function(_0x47e135,_0x4a4339){var _0x50a3ae=_0x1bfdaa||client;return _0x50a3ae['request'](_0x9c3a52,_0x5445cb)['then'](function(_0x3f5ac1){logger[_0x33dc('0x21')](_0x33dc('0x22'),_0x22443f,'request\x20sent');logger[_0x33dc('0x23')](_0x33dc('0x24'),_0x22443f,_0x33dc('0x25'),JSON[_0x33dc('0x26')](_0x3f5ac1));if(_0x3f5ac1[_0x33dc('0x27')]){if(_0x3f5ac1[_0x33dc('0x27')][_0x33dc('0x28')]===0x1f4){logger[_0x33dc('0x27')](_0x33dc('0x22'),_0x22443f,_0x3f5ac1[_0x33dc('0x27')][_0x33dc('0x29')]);return _0x4a4339(_0x3f5ac1[_0x33dc('0x27')]['message']);}logger[_0x33dc('0x27')](_0x33dc('0x22'),_0x22443f,_0x3f5ac1[_0x33dc('0x27')]['message']);return _0x47e135(_0x3f5ac1[_0x33dc('0x27')][_0x33dc('0x29')]);}else{logger[_0x33dc('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x22443f,_0x33dc('0x25'));_0x47e135(_0x3f5ac1['result']['message']);}})[_0x33dc('0x2a')](function(_0x3def81){logger[_0x33dc('0x27')](_0x33dc('0x22'),_0x22443f,_0x3def81);_0x4a4339(_0x3def81);});});}function respondWithStatusCode(_0x224624,_0x32d185){_0x32d185=_0x32d185||0xcc;return function(_0x24bf42){if(_0x24bf42){return _0x224624['sendStatus'](_0x32d185);}return _0x224624[_0x33dc('0x2b')](_0x32d185)[_0x33dc('0x2c')]();};}function respondWithResult(_0xe7f7af,_0x1b3230){_0x1b3230=_0x1b3230||0xc8;return function(_0xda0441){if(_0xda0441){return _0xe7f7af['status'](_0x1b3230)[_0x33dc('0x2d')](_0xda0441);}};}function respondWithFilteredResult(_0x994f65,_0x5e749e){return function(_0x1673c4){if(_0x1673c4){var _0x347fd0=_0x1673c4[_0x33dc('0x2e')],_0x246d24=_0x5e749e['offset'],_0x4a472c=_0x5e749e['offset']+_0x5e749e[_0x33dc('0x2f')],_0x1d33fc;if(_0x4a472c>=_0x347fd0){_0x4a472c=_0x347fd0;_0x1d33fc=0xc8;}else{_0x1d33fc=0xce;}_0x994f65[_0x33dc('0x2b')](_0x1d33fc);return _0x994f65['set']('Content-Range',_0x246d24+'-'+_0x4a472c+'/'+_0x347fd0)['json'](_0x1673c4);}return null;};}function patchUpdates(_0x436f9a){return function(_0x58fa13){try{jsonpatch[_0x33dc('0x30')](_0x58fa13,_0x436f9a,!![]);}catch(_0x3d93de){return BPromise[_0x33dc('0x31')](_0x3d93de);}return _0x58fa13[_0x33dc('0x32')]();};}function saveUpdates(_0x10ad58,_0x273aaa){return function(_0x5bbe7d){if(_0x5bbe7d){return _0x5bbe7d[_0x33dc('0x33')](_0x10ad58)['then'](function(_0xc58b45){return _0xc58b45;});}return null;};}function removeEntity(_0x32a617,_0x3cd4e7){return function(_0x11e579){if(_0x11e579){return _0x11e579[_0x33dc('0x34')]()[_0x33dc('0x35')](function(){_0x32a617[_0x33dc('0x2b')](0xcc)[_0x33dc('0x2c')]();});}};}function handleEntityNotFound(_0x40597c,_0x2a388c){return function(_0x9cce2b){if(!_0x9cce2b){_0x40597c[_0x33dc('0x36')](0x194);}return _0x9cce2b;};}function handleError(_0xbd941d,_0x429320){_0x429320=_0x429320||0x1f4;return function(_0x941403){logger[_0x33dc('0x27')](_0x941403[_0x33dc('0x37')]);if(_0x941403['name']){delete _0x941403[_0x33dc('0x38')];}_0xbd941d[_0x33dc('0x2b')](_0x429320)['send'](_0x941403);};}exports[_0x33dc('0x39')]=function(_0x188e09,_0x1477ff){var _0x4698f3={},_0x50a45e={},_0x33674b={'count':0x0,'rows':[]};var _0x5ad476=db[_0x33dc('0x3a')][_0x33dc('0x3b')];_0x50a45e['model']=_[_0x33dc('0x3c')](_0x5ad476);var _0x1b7a24={'dateStart':_0x188e09[_0x33dc('0x3d')]['dateStart'],'dateEnd':_0x188e09[_0x33dc('0x3d')][_0x33dc('0x3e')]};delete _0x188e09[_0x33dc('0x3d')][_0x33dc('0x3f')];delete _0x188e09['query'][_0x33dc('0x3e')];_0x50a45e[_0x33dc('0x3d')]=_['keys'](_0x188e09[_0x33dc('0x3d')]);_0x50a45e[_0x33dc('0x40')]=_[_0x33dc('0x41')](_0x50a45e[_0x33dc('0x42')],_0x50a45e[_0x33dc('0x3d')]);_0x4698f3[_0x33dc('0x43')]=_[_0x33dc('0x41')](_0x50a45e[_0x33dc('0x42')],qs[_0x33dc('0x44')](_0x188e09[_0x33dc('0x3d')]['fields']));_0x4698f3[_0x33dc('0x43')]=_0x4698f3[_0x33dc('0x43')][_0x33dc('0x45')]?_0x4698f3[_0x33dc('0x43')]:_0x50a45e[_0x33dc('0x42')];if(!_0x188e09[_0x33dc('0x3d')][_0x33dc('0x46')](_0x33dc('0x47'))){_0x4698f3['limit']=qs[_0x33dc('0x2f')](_0x188e09['query'][_0x33dc('0x2f')]);_0x4698f3[_0x33dc('0x48')]=qs['offset'](_0x188e09[_0x33dc('0x3d')][_0x33dc('0x48')]);}_0x4698f3[_0x33dc('0x49')]=qs[_0x33dc('0x4a')](_0x188e09[_0x33dc('0x3d')][_0x33dc('0x4a')]);_0x4698f3[_0x33dc('0x4b')]=qs['filters'](_[_0x33dc('0x4c')](_0x188e09[_0x33dc('0x3d')],_0x50a45e[_0x33dc('0x40')]));if(_0x1b7a24[_0x33dc('0x3f')]){if(_0x1b7a24[_0x33dc('0x3e')]){_0x1b7a24[_0x33dc('0x3e')]=moment(_0x1b7a24[_0x33dc('0x3e')])[_0x33dc('0x4d')](0x1,_0x33dc('0x4e'));}else{_0x1b7a24['dateEnd']=moment(_0x1b7a24[_0x33dc('0x3f')])[_0x33dc('0x4d')](0x1,'day');}_[_0x33dc('0x4f')](_0x4698f3[_0x33dc('0x4b')],{'createdAt':{'$gte':_0x1b7a24[_0x33dc('0x3f')],'$lte':_0x1b7a24['dateEnd']}});}if(_0x188e09[_0x33dc('0x3d')][_0x33dc('0x50')]){_0x4698f3[_0x33dc('0x4b')]=_[_0x33dc('0x4f')](_0x4698f3[_0x33dc('0x4b')],{'$or':_[_0x33dc('0x51')](_0x4698f3[_0x33dc('0x43')],function(_0x59576){var _0x1b129c={};_0x1b129c[_0x59576]={'$like':'%'+_0x188e09[_0x33dc('0x3d')]['filter']+'%'};return _0x1b129c;})});}_0x4698f3=_[_0x33dc('0x4f')]({},_0x4698f3,_0x188e09[_0x33dc('0x52')]);var _0x2647e9={'where':_0x4698f3[_0x33dc('0x4b')]};return db[_0x33dc('0x3a')][_0x33dc('0x2e')](_0x2647e9)['then'](function(_0x4a3481){_0x33674b['count']=_0x4a3481;if(_0x188e09[_0x33dc('0x3d')]['includeAll']){_0x4698f3[_0x33dc('0x53')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x33dc('0x54')](_0x4698f3);})['then'](function(_0x10962a){_0x33674b[_0x33dc('0x55')]=_0x10962a;return _0x33674b;})['then'](respondWithFilteredResult(_0x1477ff,_0x4698f3))[_0x33dc('0x2a')](handleError(_0x1477ff,null));};exports[_0x33dc('0x56')]=function(_0x1196e9,_0x2efe0c){var _0x51000e={'raw':!![],'where':{'id':_0x1196e9[_0x33dc('0x57')]['id']}},_0x12ab62={};_0x12ab62[_0x33dc('0x42')]=_['keys'](db['OpenchannelMessage'][_0x33dc('0x3b')]);_0x12ab62['query']=_[_0x33dc('0x3c')](_0x1196e9[_0x33dc('0x3d')]);_0x12ab62[_0x33dc('0x40')]=_[_0x33dc('0x41')](_0x12ab62[_0x33dc('0x42')],_0x12ab62[_0x33dc('0x3d')]);_0x51000e[_0x33dc('0x43')]=_[_0x33dc('0x41')](_0x12ab62[_0x33dc('0x42')],qs[_0x33dc('0x44')](_0x1196e9[_0x33dc('0x3d')][_0x33dc('0x44')]));_0x51000e['attributes']=_0x51000e[_0x33dc('0x43')][_0x33dc('0x45')]?_0x51000e[_0x33dc('0x43')]:_0x12ab62[_0x33dc('0x42')];if(_0x1196e9['query'][_0x33dc('0x58')]){_0x51000e[_0x33dc('0x53')]=[{'all':!![]}];}_0x51000e=_[_0x33dc('0x4f')]({},_0x51000e,_0x1196e9[_0x33dc('0x52')]);return db['OpenchannelMessage'][_0x33dc('0x59')](_0x51000e)[_0x33dc('0x35')](handleEntityNotFound(_0x2efe0c,null))['then'](respondWithResult(_0x2efe0c,null))[_0x33dc('0x2a')](handleError(_0x2efe0c,null));};exports['create']=function(_0x5c2939,_0x1d9784){return db['OpenchannelMessage'][_0x33dc('0x5a')](_0x5c2939['body'],{})[_0x33dc('0x35')](respondWithResult(_0x1d9784,0xc9))[_0x33dc('0x2a')](handleError(_0x1d9784,null));};exports[_0x33dc('0x33')]=function(_0x268630,_0x49b1a8){if(_0x268630['body']['id']){delete _0x268630[_0x33dc('0x5b')]['id'];}return db['OpenchannelMessage']['find']({'where':{'id':_0x268630[_0x33dc('0x57')]['id']}})[_0x33dc('0x35')](handleEntityNotFound(_0x49b1a8,null))[_0x33dc('0x35')](saveUpdates(_0x268630['body'],null))[_0x33dc('0x35')](respondWithResult(_0x49b1a8,null))['catch'](handleError(_0x49b1a8,null));};exports[_0x33dc('0x34')]=function(_0xe03ab,_0x251c42){return db['OpenchannelMessage'][_0x33dc('0x59')]({'where':{'id':_0xe03ab[_0x33dc('0x57')]['id']}})[_0x33dc('0x35')](handleEntityNotFound(_0x251c42,null))[_0x33dc('0x35')](removeEntity(_0x251c42,null))[_0x33dc('0x2a')](handleError(_0x251c42,null));};exports['describe']=function(_0x2fd60e,_0x59d9cc){return db[_0x33dc('0x3a')][_0x33dc('0x5c')]()[_0x33dc('0x35')](respondWithResult(_0x59d9cc,null))[_0x33dc('0x2a')](handleError(_0x59d9cc,null));};var interaction_log=require('../../config/logger')(_0x33dc('0x5d'));exports[_0x33dc('0x5e')]=function(_0x5319e0,_0x5b12d9,_0x157f42){var _0x394a36={'channel':_0x33dc('0x5f')};if(_0x5319e0[_0x33dc('0x5b')]['id']){delete _0x5319e0['body']['id'];}_0x5319e0[_0x33dc('0x5b')][_0x33dc('0x60')]=!![];_0x5319e0[_0x33dc('0x5b')][_0x33dc('0x61')]=moment()[_0x33dc('0x62')](_0x33dc('0x63'));_0x5319e0['body'][_0x33dc('0x64')]=_0x5319e0[_0x33dc('0x5b')][_0x33dc('0x64')]||_0x5319e0['user']['id'];return db[_0x33dc('0x3a')][_0x33dc('0x59')]({'where':{'id':_0x5319e0[_0x33dc('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x33dc('0x65')],'as':_0x33dc('0x66')}]})[_0x33dc('0x35')](handleEntityNotFound(_0x5b12d9,null))[_0x33dc('0x35')](saveUpdates(_0x5319e0['body'],null))[_0x33dc('0x35')](function(_0x1df4d4){if(_0x1df4d4){_0x394a36[_0x33dc('0x29')]=_0x1df4d4['get']({'plain':!![]});return db[_0x33dc('0x67')]['find']({'where':{'id':_0x1df4d4[_0x33dc('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x5b12d9,null))['then'](function(_0x596185){if(_0x596185){return _0x596185[_0x33dc('0x33')]({'UserId':_0x5319e0[_0x33dc('0x5b')][_0x33dc('0x64')],'read1stAt':_[_0x33dc('0x69')](_0x596185[_0x33dc('0x6a')])?moment()[_0x33dc('0x62')](_0x33dc('0x63')):undefined});}return null;})[_0x33dc('0x35')](function(_0x55aa33){if(_0x55aa33){_0x394a36[_0x33dc('0x6b')]=_0x55aa33[_0x33dc('0x6c')]({'plain':!![]});interaction_log[_0x33dc('0x21')](_0x33dc('0x6d'),_0x5319e0[_0x33dc('0x6e')]['id'],_0x5319e0[_0x33dc('0x6e')][_0x33dc('0x38')],_0x5319e0[_0x33dc('0x6e')][_0x33dc('0x6f')],_0x394a36[_0x33dc('0x6b')]['id'],_0x5319e0['body']?JSON[_0x33dc('0x26')](_0x5319e0[_0x33dc('0x5b')]):'null');return respondWithRpcPromise(_0x33dc('0x70'),_0x33dc('0x71'),_0x394a36);}return null;})[_0x33dc('0x35')](function(_0x412591){if(_0x412591){if(_0x5319e0['body']['manual']){_0x394a36[_0x33dc('0x29')][_0x33dc('0x72')]=util[_0x33dc('0x62')]('SIP/%s',_0x5319e0['user'][_0x33dc('0x38')]);_0x394a36[_0x33dc('0x29')][_0x33dc('0x73')]=_0x394a36[_0x33dc('0x73')];_0x394a36[_0x33dc('0x29')][_0x33dc('0x74')]=_0x33dc('0x5e');return respondWithRpcPromise('EventManager',_0x33dc('0x75'),{'event':_0x33dc('0x76'),'message':_0x394a36['message']},client9002)[_0x33dc('0x35')](function(){return _0x394a36;});}return _0x394a36;}return null;})['then'](respondWithResult(_0x5b12d9,null))[_0x33dc('0x2a')](handleError(_0x5b12d9,null));};var interaction_log=require(_0x33dc('0x77'))('openchannel-interactions');exports[_0x33dc('0x31')]=function(_0x3dc3de,_0xafe9e7,_0x5c2238){var _0x54e451={'agent':{},'channel':'openchannel'};if(_0x3dc3de[_0x33dc('0x5b')]['id']){delete _0x3dc3de[_0x33dc('0x5b')]['id'];}_0x3dc3de[_0x33dc('0x5b')][_0x33dc('0x64')]=_0x3dc3de[_0x33dc('0x5b')]['UserId']||_0x3dc3de[_0x33dc('0x6e')]['id'];_0x54e451[_0x33dc('0x78')]['id']=_0x3dc3de[_0x33dc('0x5b')]['UserId'];return db[_0x33dc('0x3a')][_0x33dc('0x59')]({'where':{'id':_0x3dc3de[_0x33dc('0x57')]['id'],'UserId':null}})[_0x33dc('0x35')](handleEntityNotFound(_0xafe9e7,null))[_0x33dc('0x35')](function(_0x459ea7){if(_0x459ea7){_0x54e451['message']=_0x459ea7[_0x33dc('0x6c')]({'plain':!![]});return db[_0x33dc('0x67')][_0x33dc('0x59')]({'where':{'id':_0x459ea7['OpenchannelInteractionId']}});}return null;})[_0x33dc('0x35')](handleEntityNotFound(_0xafe9e7,null))[_0x33dc('0x35')](function(_0x480d5e){if(_0x480d5e){_0x54e451['interaction']=_0x480d5e['get']({'plain':!![]});interaction_log[_0x33dc('0x21')](_0x33dc('0x79'),_0x3dc3de['user']['id'],_0x3dc3de[_0x33dc('0x6e')][_0x33dc('0x38')],_0x3dc3de[_0x33dc('0x6e')][_0x33dc('0x6f')],_0x54e451['interaction']['id'],_0x3dc3de[_0x33dc('0x5b')]?JSON[_0x33dc('0x26')](_0x3dc3de[_0x33dc('0x5b')]):_0x33dc('0x7a'));return respondWithRpcPromise(_0x33dc('0x7b'),'rejectMessage',_0x54e451);}return null;})[_0x33dc('0x35')](function(_0x5a7e8d){if(_0x5a7e8d){_0x5a7e8d[_0x33dc('0x29')][_0x33dc('0x72')]=util[_0x33dc('0x62')](_0x33dc('0x7c'),_0x3dc3de[_0x33dc('0x6e')][_0x33dc('0x38')]);_0x5a7e8d[_0x33dc('0x29')][_0x33dc('0x73')]=_0x54e451[_0x33dc('0x73')];_0x5a7e8d[_0x33dc('0x29')][_0x33dc('0x74')]=_0x33dc('0x31');respondWithRpcPromise(_0x33dc('0x75'),_0x33dc('0x75'),{'event':_0x33dc('0x7d'),'message':_0x5a7e8d[_0x33dc('0x29')]},client9002);return _0x54e451;}return null;})[_0x33dc('0x35')](respondWithResult(_0xafe9e7,null))[_0x33dc('0x2a')](handleError(_0xafe9e7,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 89d9169..cb86f46 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 _0xabf1=['setMaxListeners','save','update','remove','emit','hook','../../mysqldb'];(function(_0x6fad69,_0x3a630f){var _0x5bbea6=function(_0x1d570e){while(--_0x1d570e){_0x6fad69['push'](_0x6fad69['shift']());}};_0x5bbea6(++_0x3a630f);}(_0xabf1,0xed));var _0x1abf=function(_0x34b9c5,_0x42700f){_0x34b9c5=_0x34b9c5-0x0;var _0x10b193=_0xabf1[_0x34b9c5];return _0x10b193;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x1abf('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x1abf('0x1')](0x0);var events={'afterCreate':_0x1abf('0x2'),'afterUpdate':_0x1abf('0x3'),'afterDestroy':_0x1abf('0x4')};function emitEvent(_0x4df0af){return function(_0x59990a,_0x20a184,_0x531209){OpenchannelMessageEvents['emit'](_0x4df0af+':'+_0x59990a['id'],_0x59990a);OpenchannelMessageEvents[_0x1abf('0x5')](_0x4df0af,_0x59990a);_0x531209(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x1abf('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0xdaf2=['OpenchannelMessage','save','update','remove','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x465ffe,_0x186623){var _0x2d743b=function(_0x1e22f8){while(--_0x1e22f8){_0x465ffe['push'](_0x465ffe['shift']());}};_0x2d743b(++_0x186623);}(_0xdaf2,0x1cf));var _0x2daf=function(_0xf2f332,_0x299fbf){_0xf2f332=_0xf2f332-0x0;var _0x56cce3=_0xdaf2[_0xf2f332];return _0x56cce3;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x2daf('0x0'))['db'][_0x2daf('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2daf('0x2'),'afterUpdate':_0x2daf('0x3'),'afterDestroy':_0x2daf('0x4')};function emitEvent(_0x1e5ed6){return function(_0x5b9fa9,_0x1a2ee6,_0xcea48f){OpenchannelMessageEvents[_0x2daf('0x5')](_0x1e5ed6+':'+_0x5b9fa9['id'],_0x5b9fa9);OpenchannelMessageEvents['emit'](_0x1e5ed6,_0x5b9fa9);_0xcea48f(null);};}for(var e in events){if(events[_0x2daf('0x6')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x2daf('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 2ca2f48..9cbdc1c 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 _0x1c4f=['exports','define','OpenchannelMessage','openchannel_messages','models','get','toLowerCase','direction','out','secret','isNil','findOne','OpenchannelInteractionId','then','update','createdAt','body','error','CmContact','describe','OpenchannelAccount','OpenchannelAccountId','keys','replyUri','info','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','Contact','GET','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','catch','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','./openchannelMessage.attributes'];(function(_0x1e3771,_0x3caa39){var _0x2bf79f=function(_0x48ee71){while(--_0x48ee71){_0x1e3771['push'](_0x1e3771['shift']());}};_0x2bf79f(++_0x3caa39);}(_0x1c4f,0x1f4));var _0xf1c4=function(_0xb0a744,_0x1d6dbd){_0xb0a744=_0xb0a744-0x0;var _0x2e05c4=_0x1c4f[_0xb0a744];return _0x2e05c4;};'use strict';var _=require(_0xf1c4('0x0'));var util=require(_0xf1c4('0x1'));var logger=require(_0xf1c4('0x2'))('api');var moment=require(_0xf1c4('0x3'));var BPromise=require(_0xf1c4('0x4'));var rp=require('request-promise');var attributes=require(_0xf1c4('0x5'));module[_0xf1c4('0x6')]=function(_0x3e3ba9,_0x5f4827){return _0x3e3ba9[_0xf1c4('0x7')](_0xf1c4('0x8'),attributes,{'tableName':_0xf1c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x79689d,_0x3dadae,_0x2b45c2){var _0x5743a6=_0x3e3ba9[_0xf1c4('0xa')];var _0x1d152c=_0x79689d[_0xf1c4('0xb')]({'plain':!![]});if(_0x1d152c['direction'][_0xf1c4('0xc')]()==='in'||_0x1d152c[_0xf1c4('0xd')][_0xf1c4('0xc')]()===_0xf1c4('0xe')&&!_0x1d152c[_0xf1c4('0xf')]&&!_[_0xf1c4('0x10')](_0x1d152c['UserId'])){_0x5743a6['OpenchannelInteraction'][_0xf1c4('0x11')]({'where':{'id':_0x1d152c[_0xf1c4('0x12')]}})[_0xf1c4('0x13')](function(_0x63cbf4){if(_0x63cbf4){_0x63cbf4[_0xf1c4('0x14')]({'lastMsgAt':_0x1d152c[_0xf1c4('0x15')],'lastMsgDirection':_0x1d152c[_0xf1c4('0xd')]['toLowerCase'](),'lastMsgBody':_0x1d152c[_0xf1c4('0x16')]});}})['catch'](function(_0x2d49ce){console[_0xf1c4('0x17')](_0x2d49ce);});}if(_0x1d152c[_0xf1c4('0xd')]===_0xf1c4('0xe')&&!_0x1d152c[_0xf1c4('0xf')]){var _0x119d04;_0x5743a6[_0xf1c4('0x18')][_0xf1c4('0x19')]()[_0xf1c4('0x13')](function(_0xdf2187){return _0x5743a6[_0xf1c4('0x1a')]['find']({'where':{'id':_0x1d152c[_0xf1c4('0x1b')]},'include':[{'model':_0x5743a6['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x1d152c[_0xf1c4('0x12')]},'limit':0x1,'include':[{'model':_0x5743a6[_0xf1c4('0x18')],'as':'Contact','attributes':_[_0xf1c4('0x1c')](_0xdf2187)}]}]});})[_0xf1c4('0x13')](function(_0x3d6795){_0x119d04=_0x3d6795[_0xf1c4('0xb')]({'plain':!![]});if(_0x119d04&&_0x119d04[_0xf1c4('0x1d')]){logger[_0xf1c4('0x1e')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xf1c4('0x1f')](_0xf1c4('0x20'),_0x1d152c['id'],_0x119d04[_0xf1c4('0x1d')]));if(_0x119d04[_0xf1c4('0x21')]&&_0x119d04[_0xf1c4('0x21')][_0xf1c4('0x22')]){_0x1d152c[_0xf1c4('0x23')]=_['omit'](_0x119d04['Interactions'][0x0],_0xf1c4('0x24'));_0x1d152c['Contact']=_0x119d04['Interactions'][0x0][_0xf1c4('0x24')];}var _0x3dadae={'method':'POST','uri':encodeURI(_0x119d04[_0xf1c4('0x1d')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3dadae['method']){case _0xf1c4('0x25'):_0x3dadae['qs']=_0x1d152c;break;case'POST':_0x3dadae[_0xf1c4('0x16')]=_0x1d152c;break;}return rp(_0x3dadae)[_0xf1c4('0x13')](function(_0x2b2eec){logger[_0xf1c4('0x1e')](_0xf1c4('0x26'),_0xf1c4('0x27'),util[_0xf1c4('0x1f')](_0xf1c4('0x28'),_0x1d152c['id'],_0x119d04[_0xf1c4('0x1d')]));return _0x79689d['update']({'read':!![]});})[_0xf1c4('0x29')](function(_0x3c43a0){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0xf1c4('0x27'),util[_0xf1c4('0x2a')](_0x3c43a0,{'showHidden':![],'depth':null}));_0x2b45c2();});}else{_0x2b45c2();}})[_0xf1c4('0x2b')](function(){_0x2b45c2();});}else{_0x2b45c2();}}},'charset':_0xf1c4('0x2c'),'collate':_0xf1c4('0x2d')});}; \ No newline at end of file +var _0x3685=['GET','afterCreate','format','Message\x20%d\x20forwarded\x20to\x20%s','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','./openchannelMessage.attributes','exports','define','openchannel_messages','models','get','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','then','body','catch','error','secret','describe','OpenchannelAccount','find','OpenchannelAccountId','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','omit','Contact','POST','method'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x3685,0xf8));var _0x5368=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3685[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x5368('0x0'));var util=require('util');var logger=require(_0x5368('0x1'))(_0x5368('0x2'));var moment=require(_0x5368('0x3'));var BPromise=require(_0x5368('0x4'));var rp=require(_0x5368('0x5'));var attributes=require(_0x5368('0x6'));module[_0x5368('0x7')]=function(_0x2c9c35,_0x3bf968){return _0x2c9c35[_0x5368('0x8')]('OpenchannelMessage',attributes,{'tableName':_0x5368('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2529a2,_0x39223d,_0xaf4549){var _0x55fb7d=_0x2c9c35[_0x5368('0xa')];var _0x374865=_0x2529a2[_0x5368('0xb')]({'plain':!![]});if(_0x374865[_0x5368('0xc')][_0x5368('0xd')]()==='in'||_0x374865[_0x5368('0xc')][_0x5368('0xd')]()===_0x5368('0xe')&&!_0x374865['secret']&&!_[_0x5368('0xf')](_0x374865[_0x5368('0x10')])){_0x55fb7d[_0x5368('0x11')]['findOne']({'where':{'id':_0x374865[_0x5368('0x12')]}})[_0x5368('0x13')](function(_0x4940af){if(_0x4940af){_0x4940af['update']({'lastMsgAt':_0x374865['createdAt'],'lastMsgDirection':_0x374865[_0x5368('0xc')][_0x5368('0xd')](),'lastMsgBody':_0x374865[_0x5368('0x14')]});}})[_0x5368('0x15')](function(_0xa5ce3c){console[_0x5368('0x16')](_0xa5ce3c);});}if(_0x374865[_0x5368('0xc')]===_0x5368('0xe')&&!_0x374865[_0x5368('0x17')]){var _0x5b1da2;_0x55fb7d['CmContact'][_0x5368('0x18')]()[_0x5368('0x13')](function(_0x59c422){return _0x55fb7d[_0x5368('0x19')][_0x5368('0x1a')]({'where':{'id':_0x374865[_0x5368('0x1b')]},'include':[{'model':_0x55fb7d[_0x5368('0x11')],'as':'Interactions','where':{'id':_0x374865[_0x5368('0x12')]},'limit':0x1,'include':[{'model':_0x55fb7d['CmContact'],'as':'Contact','attributes':_[_0x5368('0x1c')](_0x59c422)}]}]});})['then'](function(_0x52afa9){_0x5b1da2=_0x52afa9['get']({'plain':!![]});if(_0x5b1da2&&_0x5b1da2[_0x5368('0x1d')]){logger[_0x5368('0x1e')](_0x5368('0x1f'),'afterCreate',util['format'](_0x5368('0x20'),_0x374865['id'],_0x5b1da2[_0x5368('0x1d')]));if(_0x5b1da2[_0x5368('0x21')]&&_0x5b1da2[_0x5368('0x21')][_0x5368('0x22')]){_0x374865[_0x5368('0x23')]=_[_0x5368('0x24')](_0x5b1da2[_0x5368('0x21')][0x0],_0x5368('0x25'));_0x374865[_0x5368('0x25')]=_0x5b1da2['Interactions'][0x0][_0x5368('0x25')];}var _0x39223d={'method':_0x5368('0x26'),'uri':encodeURI(_0x5b1da2[_0x5368('0x1d')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x39223d[_0x5368('0x27')]){case _0x5368('0x28'):_0x39223d['qs']=_0x374865;break;case _0x5368('0x26'):_0x39223d[_0x5368('0x14')]=_0x374865;break;}return rp(_0x39223d)[_0x5368('0x13')](function(_0x569d81){logger['info'](_0x5368('0x1f'),_0x5368('0x29'),util[_0x5368('0x2a')](_0x5368('0x2b'),_0x374865['id'],_0x5b1da2[_0x5368('0x1d')]));return _0x2529a2['update']({'read':!![]});})[_0x5368('0x15')](function(_0x200ad0){logger[_0x5368('0x16')](_0x5368('0x1f'),_0x5368('0x29'),util[_0x5368('0x2c')](_0x200ad0,{'showHidden':![],'depth':null}));_0xaf4549();});}else{_0xaf4549();}})[_0x5368('0x2d')](function(){_0xaf4549();});}else{_0xaf4549();}}},'charset':_0x5368('0x2e'),'collate':_0x5368('0x2f')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 1c488fc..f62af3e 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 _0xdb41=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','./openchannelMessage.socket','request','then','info','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','OpenchannelMessage,\x20%s,\x20%s','message','catch','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','debug','stringify','lodash','util','moment','bluebird'];(function(_0x8f9c9,_0x25649d){var _0xcb89d=function(_0x68d43e){while(--_0x68d43e){_0x8f9c9['push'](_0x8f9c9['shift']());}};_0xcb89d(++_0x25649d);}(_0xdb41,0xe3));var _0x1db4=function(_0x5a3d95,_0x16bee6){_0x5a3d95=_0x5a3d95-0x0;var _0x2928e9=_0xdb41[_0x5a3d95];return _0x2928e9;};'use strict';var _=require(_0x1db4('0x0'));var util=require(_0x1db4('0x1'));var moment=require(_0x1db4('0x2'));var BPromise=require(_0x1db4('0x3'));var rs=require(_0x1db4('0x4'));var fs=require('fs');var Redis=require(_0x1db4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1db4('0x6'));var logger=require(_0x1db4('0x7'))(_0x1db4('0x8'));var config=require(_0x1db4('0x9'));var jayson=require(_0x1db4('0xa'));var client=jayson['client'][_0x1db4('0xb')]({'port':0x232a});config[_0x1db4('0xc')]=_['defaults'](config[_0x1db4('0xc')],{'host':_0x1db4('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1db4('0xc')]));require(_0x1db4('0xe'))['register'](socket);function respondWithRpcPromise(_0x41f98c,_0x4fdc0a,_0x76d5b1){return new BPromise(function(_0x123056,_0x5135e7){return client[_0x1db4('0xf')](_0x41f98c,_0x76d5b1)[_0x1db4('0x10')](function(_0x4e3d68){logger[_0x1db4('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x4fdc0a,'request\x20sent');logger['debug'](_0x1db4('0x12'),_0x4fdc0a,_0x1db4('0x13'),JSON['stringify'](_0x4e3d68));if(_0x4e3d68[_0x1db4('0x14')]){if(_0x4e3d68[_0x1db4('0x14')][_0x1db4('0x15')]===0x1f4){logger[_0x1db4('0x14')](_0x1db4('0x16'),_0x4fdc0a,_0x4e3d68['error']['message']);return _0x5135e7(_0x4e3d68[_0x1db4('0x14')]['message']);}logger[_0x1db4('0x14')](_0x1db4('0x16'),_0x4fdc0a,_0x4e3d68[_0x1db4('0x14')]['message']);return _0x123056(_0x4e3d68['error'][_0x1db4('0x17')]);}else{logger[_0x1db4('0x11')](_0x1db4('0x16'),_0x4fdc0a,_0x1db4('0x13'));_0x123056(_0x4e3d68['result'][_0x1db4('0x17')]);}})[_0x1db4('0x18')](function(_0x118ac6){logger[_0x1db4('0x14')](_0x1db4('0x16'),_0x4fdc0a,_0x118ac6);_0x5135e7(_0x118ac6);});});}exports[_0x1db4('0x19')]=function(_0x166180){var _0x1e6a38=this;return new Promise(function(_0x381b22,_0x144685){return db[_0x1db4('0x1a')][_0x1db4('0x1b')](_0x166180[_0x1db4('0x1c')],{'raw':_0x166180[_0x1db4('0x1d')]?_0x166180[_0x1db4('0x1d')][_0x1db4('0x1e')]===undefined?!![]:![]:!![]})[_0x1db4('0x10')](function(_0x514c56){logger['info'](_0x1db4('0x19'),_0x166180);logger[_0x1db4('0x1f')]('CreateOpenchannelMessage',_0x166180,JSON[_0x1db4('0x20')](_0x514c56));_0x381b22(_0x514c56);})[_0x1db4('0x18')](function(_0x45489e){logger[_0x1db4('0x14')]('CreateOpenchannelMessage',_0x45489e[_0x1db4('0x17')],_0x166180);_0x144685(_0x1e6a38['error'](0x1f4,_0x45489e[_0x1db4('0x17')]));});});}; \ No newline at end of file +var _0x9e90=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','raw','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','redis','defaults','localhost','register','request','then','info','request\x20sent','debug'];(function(_0x30b7d8,_0x30a9ab){var _0x323473=function(_0x248d6d){while(--_0x248d6d){_0x30b7d8['push'](_0x30b7d8['shift']());}};_0x323473(++_0x30a9ab);}(_0x9e90,0x1a2));var _0x09e9=function(_0x15629d,_0x15f92e){_0x15629d=_0x15629d-0x0;var _0x51a8e9=_0x9e90[_0x15629d];return _0x51a8e9;};'use strict';var _=require(_0x09e9('0x0'));var util=require(_0x09e9('0x1'));var moment=require(_0x09e9('0x2'));var BPromise=require('bluebird');var rs=require(_0x09e9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x09e9('0x4'))['db'];var utils=require(_0x09e9('0x5'));var logger=require(_0x09e9('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x09e9('0x7')]['http']({'port':0x232a});config[_0x09e9('0x8')]=_[_0x09e9('0x9')](config['redis'],{'host':_0x09e9('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x09e9('0x8')]));require('./openchannelMessage.socket')[_0x09e9('0xb')](socket);function respondWithRpcPromise(_0x1cc0e6,_0x5df226,_0x490d46){return new BPromise(function(_0x56ed97,_0x329272){return client[_0x09e9('0xc')](_0x1cc0e6,_0x490d46)[_0x09e9('0xd')](function(_0x895d3a){logger[_0x09e9('0xe')]('OpenchannelMessage,\x20%s,\x20%s',_0x5df226,_0x09e9('0xf'));logger[_0x09e9('0x10')](_0x09e9('0x11'),_0x5df226,_0x09e9('0xf'),JSON['stringify'](_0x895d3a));if(_0x895d3a[_0x09e9('0x12')]){if(_0x895d3a['error'][_0x09e9('0x13')]===0x1f4){logger['error'](_0x09e9('0x14'),_0x5df226,_0x895d3a['error'][_0x09e9('0x15')]);return _0x329272(_0x895d3a[_0x09e9('0x12')][_0x09e9('0x15')]);}logger[_0x09e9('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0x5df226,_0x895d3a[_0x09e9('0x12')][_0x09e9('0x15')]);return _0x56ed97(_0x895d3a['error'][_0x09e9('0x15')]);}else{logger[_0x09e9('0xe')](_0x09e9('0x14'),_0x5df226,_0x09e9('0xf'));_0x56ed97(_0x895d3a[_0x09e9('0x16')][_0x09e9('0x15')]);}})['catch'](function(_0x34a739){logger[_0x09e9('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0x5df226,_0x34a739);_0x329272(_0x34a739);});});}exports[_0x09e9('0x17')]=function(_0xd672f5){var _0x2f2564=this;return new Promise(function(_0xa1fc4e,_0x3a25f0){return db[_0x09e9('0x18')][_0x09e9('0x19')](_0xd672f5[_0x09e9('0x1a')],{'raw':_0xd672f5['options']?_0xd672f5['options'][_0x09e9('0x1b')]===undefined?!![]:![]:!![]})[_0x09e9('0xd')](function(_0x137da6){logger[_0x09e9('0xe')](_0x09e9('0x17'),_0xd672f5);logger[_0x09e9('0x10')](_0x09e9('0x17'),_0xd672f5,JSON['stringify'](_0x137da6));_0xa1fc4e(_0x137da6);})[_0x09e9('0x1c')](function(_0x13ff68){logger[_0x09e9('0x12')](_0x09e9('0x17'),_0x13ff68[_0x09e9('0x15')],_0xd672f5);_0x3a25f0(_0x2f2564[_0x09e9('0x12')](0x1f4,_0x13ff68[_0x09e9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 35135e7..0c0f7d0 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 _0x8819=['removeListener','register','length','openchannelMessage:','remove','update'];(function(_0x3411c3,_0x33613b){var _0x3337fa=function(_0x221b93){while(--_0x221b93){_0x3411c3['push'](_0x3411c3['shift']());}};_0x3337fa(++_0x33613b);}(_0x8819,0x94));var _0x9881=function(_0x3fc11a,_0x5bad9d){_0x3fc11a=_0x3fc11a-0x0;var _0x4a0918=_0x8819[_0x3fc11a];return _0x4a0918;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x9881('0x0'),_0x9881('0x1')];function createListener(_0x317d26,_0x14cd6c){return function(_0x17e6bf){_0x14cd6c['emit'](_0x317d26,_0x17e6bf);};}function removeListener(_0x333d6f,_0x446deb){return function(){OpenchannelMessageEvents[_0x9881('0x2')](_0x333d6f,_0x446deb);};}exports[_0x9881('0x3')]=function(_0x1791fd){for(var _0x2a3664=0x0,_0x5f1d45=events[_0x9881('0x4')];_0x2a3664<_0x5f1d45;_0x2a3664++){var _0x4a6471=events[_0x2a3664];var _0x530547=createListener(_0x9881('0x5')+_0x4a6471,_0x1791fd);OpenchannelMessageEvents['on'](_0x4a6471,_0x530547);}}; \ No newline at end of file +var _0x5ad3=['register','openchannelMessage:','./openchannelMessage.events','save','remove','update','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x3ebb69,_0x3e612e){_0x3ebb69=_0x3ebb69-0x0;var _0x421e59=_0x5ad3[_0x3ebb69];return _0x421e59;};'use strict';var OpenchannelMessageEvents=require(_0x35ad('0x0'));var events=[_0x35ad('0x1'),_0x35ad('0x2'),_0x35ad('0x3')];function createListener(_0x5543d1,_0x468072){return function(_0x373228){_0x468072[_0x35ad('0x4')](_0x5543d1,_0x373228);};}function removeListener(_0x69a0b3,_0x450f55){return function(){OpenchannelMessageEvents[_0x35ad('0x5')](_0x69a0b3,_0x450f55);};}exports[_0x35ad('0x6')]=function(_0x436dcb){for(var _0x36c606=0x0,_0x31cc6a=events['length'];_0x36c606<_0x31cc6a;_0x36c606++){var _0x292521=events[_0x36c606];var _0x3cec3e=createListener(_0x35ad('0x7')+_0x292521,_0x436dcb);OpenchannelMessageEvents['on'](_0x292521,_0x3cec3e);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 620046f..959ccbd 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 _0x0ef8=['exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','destroy','removeTeams'];(function(_0x1cfee8,_0x5b9174){var _0x32e4c0=function(_0x55301e){while(--_0x55301e){_0x1cfee8['push'](_0x1cfee8['shift']());}};_0x32e4c0(++_0x5b9174);}(_0x0ef8,0x1a5));var _0x80ef=function(_0x305f25,_0x38db3a){_0x305f25=_0x305f25-0x0;var _0x446b90=_0x0ef8[_0x305f25];return _0x446b90;};'use strict';var multer=require(_0x80ef('0x0'));var util=require(_0x80ef('0x1'));var path=require('path');var timeout=require(_0x80ef('0x2'));var express=require(_0x80ef('0x3'));var router=express[_0x80ef('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x80ef('0x5'));var config=require('../../config/environment');var controller=require(_0x80ef('0x6'));router[_0x80ef('0x7')]('/',auth[_0x80ef('0x8')](),controller[_0x80ef('0x9')]);router['get'](_0x80ef('0xa'),auth['isAuthenticated'](),controller[_0x80ef('0xb')]);router[_0x80ef('0x7')](_0x80ef('0xc'),auth[_0x80ef('0x8')](),controller[_0x80ef('0xd')]);router['get'](_0x80ef('0xe'),auth[_0x80ef('0x8')](),controller[_0x80ef('0xf')]);router['get'](_0x80ef('0x10'),auth[_0x80ef('0x8')](),controller[_0x80ef('0x11')]);router['get'](_0x80ef('0x12'),auth['isAuthenticated'](),controller[_0x80ef('0x13')]);router[_0x80ef('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x80ef('0x14')]('/:id/teams',auth[_0x80ef('0x8')](),controller[_0x80ef('0x15')]);router['post'](_0x80ef('0x12'),auth[_0x80ef('0x8')](),controller[_0x80ef('0x16')]);router['put'](_0x80ef('0xc'),auth[_0x80ef('0x8')](),controller[_0x80ef('0x17')]);router[_0x80ef('0x18')](_0x80ef('0xc'),auth[_0x80ef('0x8')](),controller[_0x80ef('0x19')]);router[_0x80ef('0x18')](_0x80ef('0x10'),auth[_0x80ef('0x8')](),controller[_0x80ef('0x1a')]);router[_0x80ef('0x18')](_0x80ef('0x12'),auth[_0x80ef('0x8')](),controller['removeAgents']);module[_0x80ef('0x1b')]=router; \ No newline at end of file +var _0xa6fb=['create','/:id/teams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','isAuthenticated','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','post'];(function(_0x4851ef,_0x103034){var _0x3fd648=function(_0x3e0842){while(--_0x3e0842){_0x4851ef['push'](_0x4851ef['shift']());}};_0x3fd648(++_0x103034);}(_0xa6fb,0x1d9));var _0xba6f=function(_0xdfbfeb,_0x1939b3){_0xdfbfeb=_0xdfbfeb-0x0;var _0xbdc59d=_0xa6fb[_0xdfbfeb];return _0xbdc59d;};'use strict';var multer=require(_0xba6f('0x0'));var util=require(_0xba6f('0x1'));var path=require(_0xba6f('0x2'));var timeout=require(_0xba6f('0x3'));var express=require(_0xba6f('0x4'));var router=express[_0xba6f('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xba6f('0x6'));var config=require(_0xba6f('0x7'));var controller=require(_0xba6f('0x8'));router[_0xba6f('0x9')]('/',auth['isAuthenticated'](),controller[_0xba6f('0xa')]);router['get'](_0xba6f('0xb'),auth[_0xba6f('0xc')](),controller['describe']);router[_0xba6f('0x9')](_0xba6f('0xd'),auth[_0xba6f('0xc')](),controller['show']);router['get'](_0xba6f('0xe'),auth[_0xba6f('0xc')](),controller[_0xba6f('0xf')]);router[_0xba6f('0x9')]('/:id/teams',auth[_0xba6f('0xc')](),controller[_0xba6f('0x10')]);router[_0xba6f('0x9')](_0xba6f('0x11'),auth['isAuthenticated'](),controller[_0xba6f('0x12')]);router[_0xba6f('0x13')]('/',auth[_0xba6f('0xc')](),controller[_0xba6f('0x14')]);router[_0xba6f('0x13')](_0xba6f('0x15'),auth['isAuthenticated'](),controller['addTeams']);router[_0xba6f('0x13')]('/:id/users',auth[_0xba6f('0xc')](),controller[_0xba6f('0x16')]);router[_0xba6f('0x17')](_0xba6f('0xd'),auth[_0xba6f('0xc')](),controller[_0xba6f('0x18')]);router[_0xba6f('0x19')](_0xba6f('0xd'),auth[_0xba6f('0xc')](),controller[_0xba6f('0x1a')]);router[_0xba6f('0x19')](_0xba6f('0x15'),auth['isAuthenticated'](),controller[_0xba6f('0x1b')]);router[_0xba6f('0x19')]('/:id/users',auth['isAuthenticated'](),controller[_0xba6f('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 23297c9..102e6cf 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 _0xb48d=['beepall','roundrobin','sequelize','STRING','name'];(function(_0x3934cc,_0x47e0fb){var _0x444ab4=function(_0x1e36a9){while(--_0x1e36a9){_0x3934cc['push'](_0x3934cc['shift']());}};_0x444ab4(++_0x47e0fb);}(_0xb48d,0xb1));var _0xdb48=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xb48d[_0x38ced4];return _0x547c07;};'use strict';var Sequelize=require(_0xdb48('0x0'));module['exports']={'name':{'type':Sequelize[_0xdb48('0x1')],'unique':_0xdb48('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xdb48('0x3'),_0xdb48('0x4'))}}; \ No newline at end of file +var _0xb451=['name','STRING','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x3d6523,_0x39e250){var _0x422784=function(_0xddb105){while(--_0xddb105){_0x3d6523['push'](_0x3d6523['shift']());}};_0x422784(++_0x39e250);}(_0xb451,0x12b));var _0x1b45=function(_0x5948dd,_0x1f6ac8){_0x5948dd=_0x5948dd-0x0;var _0xb1f8be=_0xb451[_0x5948dd];return _0xb1f8be;};'use strict';var Sequelize=require(_0x1b45('0x0'));module[_0x1b45('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1b45('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1b45('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x1b45('0x4'),_0x1b45('0x5'),_0x1b45('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 7c42590..cbb03b1 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 _0xff5b=['create','body','update','find','describe','getMembers','findOne','get','sort','OpenchannelQueueId','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','format','SIP','createdAt','getTeams','Team','addTeams','findAll','ids','Agents','addAgents','union','removeAgents','removeTeams','omit','spread','emit','userOpenchannelQueue:remove','getAgents','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelQueue.socket','status','end','json','offset','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','index','OpenchannelQueue','rawAttributes','model','keys','dateStart','dateEnd','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','add','day','merge','filter','map','count','includeAll','include','rows','show','params','options','catch'];(function(_0x4ab35e,_0x9919a1){var _0x336164=function(_0x5a2840){while(--_0x5a2840){_0x4ab35e['push'](_0x4ab35e['shift']());}};_0x336164(++_0x9919a1);}(_0xff5b,0x1cf));var _0xbff5=function(_0x3a1775,_0x4dda5b){_0x3a1775=_0x3a1775-0x0;var _0x154d89=_0xff5b[_0x3a1775];return _0x154d89;};'use strict';var pdf=require(_0xbff5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbff5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbff5('0x2'));var rp=require(_0xbff5('0x3'));var moment=require(_0xbff5('0x4'));var BPromise=require(_0xbff5('0x5'));var Mustache=require(_0xbff5('0x6'));var util=require(_0xbff5('0x7'));var path=require(_0xbff5('0x8'));var sox=require(_0xbff5('0x9'));var csv=require(_0xbff5('0xa'));var ejs=require(_0xbff5('0xb'));var fs=require('fs');var _=require(_0xbff5('0xc'));var squel=require(_0xbff5('0xd'));var crypto=require(_0xbff5('0xe'));var jsforce=require(_0xbff5('0xf'));var deskjs=require(_0xbff5('0x10'));var toCsv=require(_0xbff5('0xa'));var querystring=require('querystring');var Papa=require(_0xbff5('0x11'));var Redis=require('ioredis');var qs=require(_0xbff5('0x12'));var logger=require(_0xbff5('0x13'))('api');var utils=require(_0xbff5('0x14'));var config=require(_0xbff5('0x15'));var db=require(_0xbff5('0x16'))['db'];config[_0xbff5('0x17')]=_[_0xbff5('0x18')](config[_0xbff5('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xbff5('0x19'))(new Redis(config[_0xbff5('0x17')]));require(_0xbff5('0x1a'))['register'](socket);function respondWithStatusCode(_0x528592,_0x2d6be6){_0x2d6be6=_0x2d6be6||0xcc;return function(_0x2bec2e){if(_0x2bec2e){return _0x528592['sendStatus'](_0x2d6be6);}return _0x528592[_0xbff5('0x1b')](_0x2d6be6)[_0xbff5('0x1c')]();};}function respondWithResult(_0x568ea3,_0x1045df){_0x1045df=_0x1045df||0xc8;return function(_0x7a3559){if(_0x7a3559){return _0x568ea3[_0xbff5('0x1b')](_0x1045df)[_0xbff5('0x1d')](_0x7a3559);}};}function respondWithFilteredResult(_0x2e72c5,_0x2a2fdd){return function(_0x2f5f02){if(_0x2f5f02){var _0x5ace44=_0x2f5f02['count'],_0x1d76fb=_0x2a2fdd['offset'],_0x551fdf=_0x2a2fdd[_0xbff5('0x1e')]+_0x2a2fdd[_0xbff5('0x1f')],_0x3eb399;if(_0x551fdf>=_0x5ace44){_0x551fdf=_0x5ace44;_0x3eb399=0xc8;}else{_0x3eb399=0xce;}_0x2e72c5['status'](_0x3eb399);return _0x2e72c5[_0xbff5('0x20')](_0xbff5('0x21'),_0x1d76fb+'-'+_0x551fdf+'/'+_0x5ace44)[_0xbff5('0x1d')](_0x2f5f02);}return null;};}function patchUpdates(_0x103a69){return function(_0x249979){try{jsonpatch[_0xbff5('0x22')](_0x249979,_0x103a69,!![]);}catch(_0x2fa3e3){return BPromise['reject'](_0x2fa3e3);}return _0x249979[_0xbff5('0x23')]();};}function saveUpdates(_0x374436,_0x147954){return function(_0x1be9cc){if(_0x1be9cc){return _0x1be9cc['update'](_0x374436)[_0xbff5('0x24')](function(_0x3d4374){return _0x3d4374;});}return null;};}function removeEntity(_0x469116,_0x50ad17){return function(_0x330d48){if(_0x330d48){return _0x330d48[_0xbff5('0x25')]()['then'](function(){_0x469116[_0xbff5('0x1b')](0xcc)[_0xbff5('0x1c')]();});}};}function handleEntityNotFound(_0x2f416d,_0x546849){return function(_0x5a3a7a){if(!_0x5a3a7a){_0x2f416d['sendStatus'](0x194);}return _0x5a3a7a;};}function handleError(_0x42b277,_0x1b549d){_0x1b549d=_0x1b549d||0x1f4;return function(_0x1c87cf){logger[_0xbff5('0x26')](_0x1c87cf[_0xbff5('0x27')]);if(_0x1c87cf[_0xbff5('0x28')]){delete _0x1c87cf[_0xbff5('0x28')];}_0x42b277[_0xbff5('0x1b')](_0x1b549d)['send'](_0x1c87cf);};}exports[_0xbff5('0x29')]=function(_0x41b04d,_0x3b374c){var _0x4aba6f={},_0xcf022f={},_0x1baaa1={'count':0x0,'rows':[]};var _0x42116d=db[_0xbff5('0x2a')][_0xbff5('0x2b')];_0xcf022f[_0xbff5('0x2c')]=_[_0xbff5('0x2d')](_0x42116d);var _0x2f4c77={'dateStart':_0x41b04d['query'][_0xbff5('0x2e')],'dateEnd':_0x41b04d['query'][_0xbff5('0x2f')]};delete _0x41b04d[_0xbff5('0x30')][_0xbff5('0x2e')];delete _0x41b04d[_0xbff5('0x30')][_0xbff5('0x2f')];_0xcf022f[_0xbff5('0x30')]=_[_0xbff5('0x2d')](_0x41b04d[_0xbff5('0x30')]);_0xcf022f[_0xbff5('0x31')]=_[_0xbff5('0x32')](_0xcf022f[_0xbff5('0x2c')],_0xcf022f[_0xbff5('0x30')]);_0x4aba6f[_0xbff5('0x33')]=_['intersection'](_0xcf022f[_0xbff5('0x2c')],qs['fields'](_0x41b04d['query'][_0xbff5('0x34')]));_0x4aba6f[_0xbff5('0x33')]=_0x4aba6f[_0xbff5('0x33')][_0xbff5('0x35')]?_0x4aba6f[_0xbff5('0x33')]:_0xcf022f[_0xbff5('0x2c')];if(!_0x41b04d[_0xbff5('0x30')][_0xbff5('0x36')](_0xbff5('0x37'))){_0x4aba6f[_0xbff5('0x1f')]=qs[_0xbff5('0x1f')](_0x41b04d[_0xbff5('0x30')][_0xbff5('0x1f')]);_0x4aba6f[_0xbff5('0x1e')]=qs['offset'](_0x41b04d['query'][_0xbff5('0x1e')]);}_0x4aba6f[_0xbff5('0x38')]=qs['sort'](_0x41b04d[_0xbff5('0x30')]['sort']);_0x4aba6f[_0xbff5('0x39')]=qs[_0xbff5('0x31')](_[_0xbff5('0x3a')](_0x41b04d[_0xbff5('0x30')],_0xcf022f[_0xbff5('0x31')]));if(_0x2f4c77['dateStart']){if(_0x2f4c77['dateEnd']){_0x2f4c77[_0xbff5('0x2f')]=moment(_0x2f4c77[_0xbff5('0x2f')])[_0xbff5('0x3b')](0x1,_0xbff5('0x3c'));}else{_0x2f4c77[_0xbff5('0x2f')]=moment(_0x2f4c77['dateStart'])[_0xbff5('0x3b')](0x1,'day');}_[_0xbff5('0x3d')](_0x4aba6f[_0xbff5('0x39')],{'createdAt':{'$gte':_0x2f4c77[_0xbff5('0x2e')],'$lte':_0x2f4c77[_0xbff5('0x2f')]}});}if(_0x41b04d[_0xbff5('0x30')][_0xbff5('0x3e')]){_0x4aba6f[_0xbff5('0x39')]=_[_0xbff5('0x3d')](_0x4aba6f[_0xbff5('0x39')],{'$or':_[_0xbff5('0x3f')](_0x4aba6f[_0xbff5('0x33')],function(_0x1d3a4c){var _0x53906a={};_0x53906a[_0x1d3a4c]={'$like':'%'+_0x41b04d['query'][_0xbff5('0x3e')]+'%'};return _0x53906a;})});}_0x4aba6f=_[_0xbff5('0x3d')]({},_0x4aba6f,_0x41b04d['options']);var _0x2f545a={'where':_0x4aba6f[_0xbff5('0x39')]};return db[_0xbff5('0x2a')][_0xbff5('0x40')](_0x2f545a)[_0xbff5('0x24')](function(_0x41fe8b){_0x1baaa1[_0xbff5('0x40')]=_0x41fe8b;if(_0x41b04d['query'][_0xbff5('0x41')]){_0x4aba6f[_0xbff5('0x42')]=[{'all':!![]}];}return db['OpenchannelQueue']['findAll'](_0x4aba6f);})[_0xbff5('0x24')](function(_0x4a5ec3){_0x1baaa1[_0xbff5('0x43')]=_0x4a5ec3;return _0x1baaa1;})['then'](respondWithFilteredResult(_0x3b374c,_0x4aba6f))['catch'](handleError(_0x3b374c,null));};exports[_0xbff5('0x44')]=function(_0x99a079,_0x2e68de){var _0x1bbc8f={'raw':!![],'where':{'id':_0x99a079[_0xbff5('0x45')]['id']}},_0x22e656={};_0x22e656[_0xbff5('0x2c')]=_[_0xbff5('0x2d')](db['OpenchannelQueue'][_0xbff5('0x2b')]);_0x22e656['query']=_[_0xbff5('0x2d')](_0x99a079[_0xbff5('0x30')]);_0x22e656[_0xbff5('0x31')]=_[_0xbff5('0x32')](_0x22e656[_0xbff5('0x2c')],_0x22e656[_0xbff5('0x30')]);_0x1bbc8f[_0xbff5('0x33')]=_[_0xbff5('0x32')](_0x22e656[_0xbff5('0x2c')],qs['fields'](_0x99a079[_0xbff5('0x30')]['fields']));_0x1bbc8f[_0xbff5('0x33')]=_0x1bbc8f[_0xbff5('0x33')][_0xbff5('0x35')]?_0x1bbc8f[_0xbff5('0x33')]:_0x22e656[_0xbff5('0x2c')];if(_0x99a079[_0xbff5('0x30')][_0xbff5('0x41')]){_0x1bbc8f[_0xbff5('0x42')]=[{'all':!![]}];}_0x1bbc8f=_[_0xbff5('0x3d')]({},_0x1bbc8f,_0x99a079[_0xbff5('0x46')]);return db[_0xbff5('0x2a')]['find'](_0x1bbc8f)[_0xbff5('0x24')](handleEntityNotFound(_0x2e68de,null))['then'](respondWithResult(_0x2e68de,null))[_0xbff5('0x47')](handleError(_0x2e68de,null));};exports['create']=function(_0x228b89,_0x1e152b){return db['OpenchannelQueue'][_0xbff5('0x48')](_0x228b89[_0xbff5('0x49')],{})[_0xbff5('0x24')](respondWithResult(_0x1e152b,0xc9))[_0xbff5('0x47')](handleError(_0x1e152b,null));};exports[_0xbff5('0x4a')]=function(_0x502ada,_0x4918b9){if(_0x502ada[_0xbff5('0x49')]['id']){delete _0x502ada['body']['id'];}return db['OpenchannelQueue']['find']({'where':{'id':_0x502ada['params']['id']}})[_0xbff5('0x24')](handleEntityNotFound(_0x4918b9,null))[_0xbff5('0x24')](saveUpdates(_0x502ada[_0xbff5('0x49')],null))[_0xbff5('0x24')](respondWithResult(_0x4918b9,null))[_0xbff5('0x47')](handleError(_0x4918b9,null));};exports[_0xbff5('0x25')]=function(_0x5e81e5,_0x400bd5){return db[_0xbff5('0x2a')][_0xbff5('0x4b')]({'where':{'id':_0x5e81e5[_0xbff5('0x45')]['id']}})[_0xbff5('0x24')](handleEntityNotFound(_0x400bd5,null))['then'](removeEntity(_0x400bd5,null))['catch'](handleError(_0x400bd5,null));};exports[_0xbff5('0x4c')]=function(_0x34cd08,_0x497887){return db[_0xbff5('0x2a')][_0xbff5('0x4c')]()[_0xbff5('0x24')](respondWithResult(_0x497887,null))[_0xbff5('0x47')](handleError(_0x497887,null));};exports[_0xbff5('0x4d')]=function(_0x52fa8e,_0x373109,_0x3c55f0){var _0x1bdf62={'raw':!![],'where':{}},_0x22c8a0={},_0xbd8646;return db['OpenchannelQueue'][_0xbff5('0x4e')]({'where':{'id':_0x52fa8e[_0xbff5('0x45')]['id']}})[_0xbff5('0x24')](handleEntityNotFound(_0x373109,null))[_0xbff5('0x24')](function(_0x3788cc){if(_0x3788cc){_0xbd8646=_0x3788cc[_0xbff5('0x4f')]({'plain':!![]});_0x22c8a0[_0xbff5('0x2c')]=_['keys'](db['UserOpenchannelQueue'][_0xbff5('0x2b')]);_0x22c8a0[_0xbff5('0x30')]=_[_0xbff5('0x2d')](_0x52fa8e['query']);_0x22c8a0[_0xbff5('0x31')]=_[_0xbff5('0x32')](_0x22c8a0[_0xbff5('0x2c')],_0x22c8a0[_0xbff5('0x30')]);_0x1bdf62[_0xbff5('0x33')]=_[_0xbff5('0x32')](_0x22c8a0[_0xbff5('0x2c')],qs['fields'](_0x52fa8e[_0xbff5('0x30')]['fields']));_0x1bdf62[_0xbff5('0x33')]=_0x1bdf62[_0xbff5('0x33')][_0xbff5('0x35')]?_0x1bdf62[_0xbff5('0x33')]:_0x22c8a0[_0xbff5('0x2c')];if(!_0x52fa8e['query'][_0xbff5('0x36')](_0xbff5('0x37'))){_0x1bdf62[_0xbff5('0x1f')]=qs[_0xbff5('0x1f')](_0x52fa8e[_0xbff5('0x30')]['limit']);_0x1bdf62[_0xbff5('0x1e')]=qs[_0xbff5('0x1e')](_0x52fa8e[_0xbff5('0x30')][_0xbff5('0x1e')]);}_0x1bdf62['order']=qs[_0xbff5('0x50')](_0x52fa8e[_0xbff5('0x30')][_0xbff5('0x50')]);_0x1bdf62[_0xbff5('0x39')]=qs[_0xbff5('0x31')](_[_0xbff5('0x3a')](_0x52fa8e['query'],_0x22c8a0[_0xbff5('0x31')]));_0x1bdf62[_0xbff5('0x39')][_0xbff5('0x51')]=_0x3788cc['id'];if(_0x52fa8e['query'][_0xbff5('0x3e')]){_0x1bdf62[_0xbff5('0x39')]=_[_0xbff5('0x3d')](_0x1bdf62['where'],{'$or':_[_0xbff5('0x3f')](_0x1bdf62['attributes'],function(_0x182af1){var _0x4ee392={};_0x4ee392[_0x182af1]={'$like':'%'+_0x52fa8e[_0xbff5('0x30')][_0xbff5('0x3e')]+'%'};return _0x4ee392;})});}_0x1bdf62=_[_0xbff5('0x3d')]({},_0x1bdf62,_0x52fa8e['options']);return db[_0xbff5('0x52')]['findAll'](_0x1bdf62);}})[_0xbff5('0x24')](function(_0x1adbdc){if(_0x1adbdc){return db[_0xbff5('0x53')][_0xbff5('0x54')]({'where':{'id':_[_0xbff5('0x3f')](_0x1adbdc,_0xbff5('0x55')),'role':_0xbff5('0x56')},'attributes':['id','name',_0xbff5('0x57'),_0xbff5('0x58'),'createdAt']});}})[_0xbff5('0x24')](function(_0x1f27f9){if(_0x1f27f9){return{'count':_0x1f27f9[_0xbff5('0x40')],'rows':_[_0xbff5('0x3f')](_0x1f27f9[_0xbff5('0x43')],function(_0x53c26e){return{'membername':_0x53c26e[_0xbff5('0x28')],'UserId':_0x53c26e['id'],'queue_name':_0xbd8646['name'],'OpenchannelQueueId':_0xbd8646['id'],'interface':util[_0xbff5('0x59')]('%s/%s',_0xbff5('0x5a'),_0x53c26e[_0xbff5('0x28')]),'penalty':0x0,'paused':_0x53c26e[_0xbff5('0x57')],'createdAt':_0x53c26e[_0xbff5('0x5b')],'updatedAt':_0x53c26e['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xbff5('0x24')](respondWithFilteredResult(_0x373109,_0x1bdf62))[_0xbff5('0x47')](handleError(_0x373109,null));};exports[_0xbff5('0x5c')]=function(_0x55de7f,_0x42be49,_0x48d487){var _0x19d7ce={};var _0x5b7201={};var _0x296ee5;var _0x15eb01;return db['OpenchannelQueue'][_0xbff5('0x4e')]({'where':{'id':_0x55de7f[_0xbff5('0x45')]['id']}})['then'](handleEntityNotFound(_0x42be49,null))[_0xbff5('0x24')](function(_0xc945d9){if(_0xc945d9){_0x296ee5=_0xc945d9;_0x5b7201[_0xbff5('0x2c')]=_[_0xbff5('0x2d')](db[_0xbff5('0x5d')][_0xbff5('0x2b')]);_0x5b7201[_0xbff5('0x30')]=_[_0xbff5('0x2d')](_0x55de7f[_0xbff5('0x30')]);_0x5b7201[_0xbff5('0x31')]=_[_0xbff5('0x32')](_0x5b7201[_0xbff5('0x2c')],_0x5b7201['query']);_0x19d7ce['attributes']=_['intersection'](_0x5b7201[_0xbff5('0x2c')],qs['fields'](_0x55de7f[_0xbff5('0x30')][_0xbff5('0x34')]));_0x19d7ce[_0xbff5('0x33')]=_0x19d7ce[_0xbff5('0x33')][_0xbff5('0x35')]?_0x19d7ce[_0xbff5('0x33')]:_0x5b7201['model'];_0x19d7ce[_0xbff5('0x38')]=qs[_0xbff5('0x50')](_0x55de7f['query'][_0xbff5('0x50')]);_0x19d7ce[_0xbff5('0x39')]=qs['filters'](_['pick'](_0x55de7f[_0xbff5('0x30')],_0x5b7201['filters']));if(_0x55de7f['query'][_0xbff5('0x3e')]){_0x19d7ce[_0xbff5('0x39')]=_[_0xbff5('0x3d')](_0x19d7ce['where'],{'$or':_['map'](_0x19d7ce[_0xbff5('0x33')],function(_0x3ee8cd){var _0x48d5ad={};_0x48d5ad[_0x3ee8cd]={'$like':'%'+_0x55de7f[_0xbff5('0x30')]['filter']+'%'};return _0x48d5ad;})});}_0x19d7ce=_[_0xbff5('0x3d')]({},_0x19d7ce,_0x55de7f[_0xbff5('0x46')]);return _0x296ee5[_0xbff5('0x5c')](_0x19d7ce);}})[_0xbff5('0x24')](function(_0x27dbc1){if(_0x27dbc1){_0x15eb01=_0x27dbc1[_0xbff5('0x35')];if(!_0x55de7f[_0xbff5('0x30')][_0xbff5('0x36')](_0xbff5('0x37'))){_0x19d7ce[_0xbff5('0x1f')]=qs[_0xbff5('0x1f')](_0x55de7f[_0xbff5('0x30')]['limit']);_0x19d7ce[_0xbff5('0x1e')]=qs['offset'](_0x55de7f['query'][_0xbff5('0x1e')]);}return _0x296ee5['getTeams'](_0x19d7ce);}})[_0xbff5('0x24')](function(_0x5d5f1d){if(_0x5d5f1d){return _0x5d5f1d?{'count':_0x15eb01,'rows':_0x5d5f1d}:null;}})[_0xbff5('0x24')](respondWithResult(_0x42be49,null))[_0xbff5('0x47')](handleError(_0x42be49,null));};exports[_0xbff5('0x5e')]=function(_0x59673f,_0x95362f,_0xc83201){var _0x51f48c=[];var _0x1973aa;return db[_0xbff5('0x5d')][_0xbff5('0x5f')]({'where':{'id':_0x59673f['body'][_0xbff5('0x60')]},'attributes':['id'],'include':[{'model':db[_0xbff5('0x53')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbff5('0x24')](function(_0x25611d){if(_0x25611d){for(var _0x43ef95=0x0;_0x43ef95<_0x25611d['length'];_0x43ef95+=0x1){for(var _0x136948=0x0;_0x136948<_0x25611d[_0x43ef95][_0xbff5('0x61')]['length'];_0x136948+=0x1){_0x51f48c=_['union'](_0x51f48c,[_0x25611d[_0x43ef95][_0xbff5('0x61')][_0x136948]['id']]);}}return _0x51f48c;}})[_0xbff5('0x24')](function(_0x139718){if(_0x139718){return db[_0xbff5('0x2a')][_0xbff5('0x4b')]({'where':{'id':_0x59673f['params']['id']}});}})[_0xbff5('0x24')](function(_0x1edcc7){if(_0x1edcc7){_0x1973aa=_0x1edcc7;return _0x1973aa[_0xbff5('0x62')](_0x51f48c,{'penalty':_0x59673f[_0xbff5('0x49')]['penalty']});}})[_0xbff5('0x24')](function(_0x575a2d){if(_0x575a2d){return _0x1973aa['addTeams'](_0x59673f['body'][_0xbff5('0x60')]);}})['then'](handleEntityNotFound(_0x95362f,null))['then'](respondWithStatusCode(_0x95362f,null))[_0xbff5('0x47')](handleError(_0x95362f,null));};exports['removeTeams']=function(_0x11d3b1,_0x15dc1c,_0x3bfc36){var _0x5c7fb1=[];var _0x3549de;return db[_0xbff5('0x5d')][_0xbff5('0x5f')]({'where':{'id':_0x11d3b1[_0xbff5('0x30')][_0xbff5('0x60')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbff5('0x61'),'attributes':['id'],'raw':!![]}]})[_0xbff5('0x24')](function(_0x397c8a){if(_0x397c8a){for(var _0x42dd74=0x0;_0x42dd74<_0x397c8a[_0xbff5('0x35')];_0x42dd74+=0x1){for(var _0x24a299=0x0;_0x24a299<_0x397c8a[_0x42dd74][_0xbff5('0x61')]['length'];_0x24a299+=0x1){_0x5c7fb1=_[_0xbff5('0x63')](_0x5c7fb1,[_0x397c8a[_0x42dd74]['Agents'][_0x24a299]['id']]);}}return _0x5c7fb1;}})['then'](function(_0x44e95b){if(_0x44e95b){return db[_0xbff5('0x2a')][_0xbff5('0x4b')]({'where':{'id':_0x11d3b1['params']['id']}});}})['then'](function(_0x26972d){if(_0x26972d){_0x3549de=_0x26972d;return _0x3549de[_0xbff5('0x64')](_0x5c7fb1);}})[_0xbff5('0x24')](function(_0x4fcd15){if(_0x3549de){return _0x3549de[_0xbff5('0x65')](_0x11d3b1['query']['ids']);}})['then'](handleEntityNotFound(_0x15dc1c,null))[_0xbff5('0x24')](respondWithStatusCode(_0x15dc1c,null))[_0xbff5('0x47')](handleError(_0x15dc1c,null));};exports['addAgents']=function(_0x504160,_0x4ba2aa,_0x1b544f){return db[_0xbff5('0x2a')][_0xbff5('0x4b')]({'where':{'id':_0x504160[_0xbff5('0x45')]['id']}})[_0xbff5('0x24')](handleEntityNotFound(_0x4ba2aa,null))[_0xbff5('0x24')](function(_0x11a62d){if(_0x11a62d){return _0x11a62d[_0xbff5('0x62')](_0x504160[_0xbff5('0x49')][_0xbff5('0x60')],_[_0xbff5('0x66')](_0x504160[_0xbff5('0x49')],[_0xbff5('0x60'),'id'])||{})[_0xbff5('0x67')](function(_0x4dbd27){for(var _0x1f77bf=0x0;_0x1f77bf<_0x504160[_0xbff5('0x49')][_0xbff5('0x60')][_0xbff5('0x35')];_0x1f77bf+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x504160['body']['ids'][_0x1f77bf],'OpenchannelQueueId':_0x504160[_0xbff5('0x45')]['id']});}return _0x4dbd27;});}})[_0xbff5('0x24')](respondWithResult(_0x4ba2aa,null))[_0xbff5('0x47')](handleError(_0x4ba2aa,null));};exports[_0xbff5('0x64')]=function(_0x21648b,_0xd60b22,_0x49f22c){var _0x827b1c;return db[_0xbff5('0x2a')][_0xbff5('0x4b')]({'where':{'id':_0x21648b[_0xbff5('0x45')]['id']}})[_0xbff5('0x24')](handleEntityNotFound(_0xd60b22,null))[_0xbff5('0x24')](function(_0x643386){if(_0x643386){return _0x643386['removeAgents'](_0x21648b[_0xbff5('0x30')]['ids'])['then'](function(_0x2c78fc){if(_['isArray'](_0x21648b[_0xbff5('0x30')][_0xbff5('0x60')])){for(var _0x10b756=0x0;_0x10b756<_0x21648b[_0xbff5('0x30')][_0xbff5('0x60')]['length'];_0x10b756+=0x1){socket[_0xbff5('0x68')]('userOpenchannelQueue:remove',{'UserId':_0x21648b[_0xbff5('0x30')]['ids'][_0x10b756],'OpenchannelQueueId':_0x21648b[_0xbff5('0x45')]['id']});}}else{socket[_0xbff5('0x68')](_0xbff5('0x69'),{'UserId':_0x21648b[_0xbff5('0x30')][_0xbff5('0x60')],'OpenchannelQueueId':_0x21648b['params']['id']});}});}})[_0xbff5('0x24')](respondWithStatusCode(_0xd60b22,null))[_0xbff5('0x47')](handleError(_0xd60b22,null));};exports[_0xbff5('0x6a')]=function(_0x348bdb,_0x4bce12,_0xc01f11){var _0x36b03f={};var _0x398727={};var _0x273dc7;var _0x390419;return db[_0xbff5('0x2a')]['findOne']({'where':{'id':_0x348bdb['params']['id']}})['then'](handleEntityNotFound(_0x4bce12,null))[_0xbff5('0x24')](function(_0xf1a2fe){if(_0xf1a2fe){_0x273dc7=_0xf1a2fe;_0x398727[_0xbff5('0x2c')]=_[_0xbff5('0x2d')](db[_0xbff5('0x53')][_0xbff5('0x2b')]);_0x398727[_0xbff5('0x30')]=_[_0xbff5('0x2d')](_0x348bdb[_0xbff5('0x30')]);_0x398727[_0xbff5('0x31')]=_[_0xbff5('0x32')](_0x398727[_0xbff5('0x2c')],_0x398727[_0xbff5('0x30')]);_0x36b03f[_0xbff5('0x33')]=_[_0xbff5('0x32')](_0x398727[_0xbff5('0x2c')],qs[_0xbff5('0x34')](_0x348bdb[_0xbff5('0x30')][_0xbff5('0x34')]));_0x36b03f[_0xbff5('0x33')]=_0x36b03f['attributes'][_0xbff5('0x35')]?_0x36b03f[_0xbff5('0x33')]:_0x398727['model'];_0x36b03f[_0xbff5('0x38')]=qs[_0xbff5('0x50')](_0x348bdb[_0xbff5('0x30')][_0xbff5('0x50')]);_0x36b03f['where']=qs[_0xbff5('0x31')](_[_0xbff5('0x3a')](_0x348bdb['query'],_0x398727[_0xbff5('0x31')]));if(_0x348bdb['query'][_0xbff5('0x3e')]){_0x36b03f['where']=_[_0xbff5('0x3d')](_0x36b03f[_0xbff5('0x39')],{'$or':_['map'](_0x36b03f[_0xbff5('0x33')],function(_0x3c8eb3){var _0x4ec0cc={};_0x4ec0cc[_0x3c8eb3]={'$like':'%'+_0x348bdb[_0xbff5('0x30')][_0xbff5('0x3e')]+'%'};return _0x4ec0cc;})});}_0x36b03f=_[_0xbff5('0x3d')]({},_0x36b03f,_0x348bdb['options']);return _0x273dc7['getAgents'](_0x36b03f);}})[_0xbff5('0x24')](function(_0x324552){if(_0x324552){_0x390419=_0x324552[_0xbff5('0x35')];if(!_0x348bdb[_0xbff5('0x30')][_0xbff5('0x36')](_0xbff5('0x37'))){_0x36b03f[_0xbff5('0x1f')]=qs[_0xbff5('0x1f')](_0x348bdb[_0xbff5('0x30')][_0xbff5('0x1f')]);_0x36b03f[_0xbff5('0x1e')]=qs[_0xbff5('0x1e')](_0x348bdb[_0xbff5('0x30')][_0xbff5('0x1e')]);}return _0x273dc7['getAgents'](_0x36b03f);}})[_0xbff5('0x24')](function(_0x2a1766){if(_0x2a1766){return _0x2a1766?{'count':_0x390419,'rows':_0x2a1766}:null;}})[_0xbff5('0x24')](respondWithResult(_0x4bce12,null))[_0xbff5('0x47')](handleError(_0x4bce12,null));}; \ No newline at end of file +var _0xb481=['UserId','agent','openchannelPause','createdAt','rows','format','%s/%s','updatedAt','getTeams','Team','addTeams','findAll','ids','Agents','union','addAgents','penalty','removeAgents','omit','userOpenchannelQueue:save','emit','userOpenchannelQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','./openchannelQueue.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','OpenchannelQueue','rawAttributes','model','keys','dateStart','dateEnd','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','add','day','merge','filter','show','catch','create','body','update','find','params','describe','getMembers','findOne','get','UserOpenchannelQueue','sort','OpenchannelQueueId','map','options','User','findAndCountAll'];(function(_0x33202f,_0x55cbef){var _0x263649=function(_0x192e8a){while(--_0x192e8a){_0x33202f['push'](_0x33202f['shift']());}};_0x263649(++_0x55cbef);}(_0xb481,0x1c7));var _0x1b48=function(_0xf90544,_0x211f7a){_0xf90544=_0xf90544-0x0;var _0x22b0ed=_0xb481[_0xf90544];return _0x22b0ed;};'use strict';var pdf=require(_0x1b48('0x0'));var emlformat=require(_0x1b48('0x1'));var rimraf=require(_0x1b48('0x2'));var zipdir=require(_0x1b48('0x3'));var jsonpatch=require(_0x1b48('0x4'));var rp=require(_0x1b48('0x5'));var moment=require(_0x1b48('0x6'));var BPromise=require(_0x1b48('0x7'));var Mustache=require(_0x1b48('0x8'));var util=require(_0x1b48('0x9'));var path=require(_0x1b48('0xa'));var sox=require(_0x1b48('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x1b48('0xc'));var squel=require(_0x1b48('0xd'));var crypto=require(_0x1b48('0xe'));var jsforce=require(_0x1b48('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1b48('0x10'));var querystring=require(_0x1b48('0x11'));var Papa=require(_0x1b48('0x12'));var Redis=require(_0x1b48('0x13'));var qs=require(_0x1b48('0x14'));var logger=require(_0x1b48('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x1b48('0x16'));var db=require(_0x1b48('0x17'))['db'];config[_0x1b48('0x18')]=_['defaults'](config['redis'],{'host':_0x1b48('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1b48('0x18')]));require(_0x1b48('0x1a'))['register'](socket);function respondWithStatusCode(_0x3c6f1c,_0x56beed){_0x56beed=_0x56beed||0xcc;return function(_0x380c65){if(_0x380c65){return _0x3c6f1c[_0x1b48('0x1b')](_0x56beed);}return _0x3c6f1c[_0x1b48('0x1c')](_0x56beed)[_0x1b48('0x1d')]();};}function respondWithResult(_0x3f23ad,_0x10e8d7){_0x10e8d7=_0x10e8d7||0xc8;return function(_0x141d8a){if(_0x141d8a){return _0x3f23ad[_0x1b48('0x1c')](_0x10e8d7)[_0x1b48('0x1e')](_0x141d8a);}};}function respondWithFilteredResult(_0x366a64,_0x18ff80){return function(_0x232d91){if(_0x232d91){var _0x1fcf10=_0x232d91[_0x1b48('0x1f')],_0x59306d=_0x18ff80[_0x1b48('0x20')],_0x3ba2e9=_0x18ff80[_0x1b48('0x20')]+_0x18ff80[_0x1b48('0x21')],_0x718cc;if(_0x3ba2e9>=_0x1fcf10){_0x3ba2e9=_0x1fcf10;_0x718cc=0xc8;}else{_0x718cc=0xce;}_0x366a64['status'](_0x718cc);return _0x366a64[_0x1b48('0x22')](_0x1b48('0x23'),_0x59306d+'-'+_0x3ba2e9+'/'+_0x1fcf10)[_0x1b48('0x1e')](_0x232d91);}return null;};}function patchUpdates(_0x405ab0){return function(_0x47d1fc){try{jsonpatch[_0x1b48('0x24')](_0x47d1fc,_0x405ab0,!![]);}catch(_0x54b171){return BPromise[_0x1b48('0x25')](_0x54b171);}return _0x47d1fc[_0x1b48('0x26')]();};}function saveUpdates(_0x10f9df,_0x3545ff){return function(_0x227628){if(_0x227628){return _0x227628['update'](_0x10f9df)[_0x1b48('0x27')](function(_0x5f0331){return _0x5f0331;});}return null;};}function removeEntity(_0x20931b,_0x24d707){return function(_0x274d0f){if(_0x274d0f){return _0x274d0f[_0x1b48('0x28')]()[_0x1b48('0x27')](function(){_0x20931b['status'](0xcc)[_0x1b48('0x1d')]();});}};}function handleEntityNotFound(_0x5c184c,_0x1fbe00){return function(_0x405b84){if(!_0x405b84){_0x5c184c[_0x1b48('0x1b')](0x194);}return _0x405b84;};}function handleError(_0x1d245e,_0x3ceb80){_0x3ceb80=_0x3ceb80||0x1f4;return function(_0x1a8cac){logger[_0x1b48('0x29')](_0x1a8cac[_0x1b48('0x2a')]);if(_0x1a8cac['name']){delete _0x1a8cac[_0x1b48('0x2b')];}_0x1d245e[_0x1b48('0x1c')](_0x3ceb80)[_0x1b48('0x2c')](_0x1a8cac);};}exports[_0x1b48('0x2d')]=function(_0x46eb52,_0x19c166){var _0x1b47bf={},_0x4e55a8={},_0x25e958={'count':0x0,'rows':[]};var _0x3fd599=db[_0x1b48('0x2e')][_0x1b48('0x2f')];_0x4e55a8[_0x1b48('0x30')]=_[_0x1b48('0x31')](_0x3fd599);var _0x45f36c={'dateStart':_0x46eb52['query'][_0x1b48('0x32')],'dateEnd':_0x46eb52['query'][_0x1b48('0x33')]};delete _0x46eb52['query'][_0x1b48('0x32')];delete _0x46eb52[_0x1b48('0x34')]['dateEnd'];_0x4e55a8[_0x1b48('0x34')]=_[_0x1b48('0x31')](_0x46eb52[_0x1b48('0x34')]);_0x4e55a8[_0x1b48('0x35')]=_[_0x1b48('0x36')](_0x4e55a8['model'],_0x4e55a8[_0x1b48('0x34')]);_0x1b47bf[_0x1b48('0x37')]=_[_0x1b48('0x36')](_0x4e55a8[_0x1b48('0x30')],qs[_0x1b48('0x38')](_0x46eb52[_0x1b48('0x34')][_0x1b48('0x38')]));_0x1b47bf[_0x1b48('0x37')]=_0x1b47bf[_0x1b48('0x37')][_0x1b48('0x39')]?_0x1b47bf['attributes']:_0x4e55a8[_0x1b48('0x30')];if(!_0x46eb52[_0x1b48('0x34')][_0x1b48('0x3a')](_0x1b48('0x3b'))){_0x1b47bf['limit']=qs['limit'](_0x46eb52[_0x1b48('0x34')][_0x1b48('0x21')]);_0x1b47bf['offset']=qs[_0x1b48('0x20')](_0x46eb52[_0x1b48('0x34')]['offset']);}_0x1b47bf[_0x1b48('0x3c')]=qs['sort'](_0x46eb52[_0x1b48('0x34')]['sort']);_0x1b47bf[_0x1b48('0x3d')]=qs[_0x1b48('0x35')](_[_0x1b48('0x3e')](_0x46eb52[_0x1b48('0x34')],_0x4e55a8[_0x1b48('0x35')]));if(_0x45f36c[_0x1b48('0x32')]){if(_0x45f36c[_0x1b48('0x33')]){_0x45f36c[_0x1b48('0x33')]=moment(_0x45f36c['dateEnd'])[_0x1b48('0x3f')](0x1,_0x1b48('0x40'));}else{_0x45f36c[_0x1b48('0x33')]=moment(_0x45f36c[_0x1b48('0x32')])[_0x1b48('0x3f')](0x1,_0x1b48('0x40'));}_[_0x1b48('0x41')](_0x1b47bf[_0x1b48('0x3d')],{'createdAt':{'$gte':_0x45f36c[_0x1b48('0x32')],'$lte':_0x45f36c['dateEnd']}});}if(_0x46eb52[_0x1b48('0x34')]['filter']){_0x1b47bf['where']=_[_0x1b48('0x41')](_0x1b47bf[_0x1b48('0x3d')],{'$or':_['map'](_0x1b47bf[_0x1b48('0x37')],function(_0x416afc){var _0x5143e1={};_0x5143e1[_0x416afc]={'$like':'%'+_0x46eb52[_0x1b48('0x34')][_0x1b48('0x42')]+'%'};return _0x5143e1;})});}_0x1b47bf=_[_0x1b48('0x41')]({},_0x1b47bf,_0x46eb52['options']);var _0x308934={'where':_0x1b47bf[_0x1b48('0x3d')]};return db[_0x1b48('0x2e')][_0x1b48('0x1f')](_0x308934)['then'](function(_0x1e4293){_0x25e958['count']=_0x1e4293;if(_0x46eb52[_0x1b48('0x34')]['includeAll']){_0x1b47bf['include']=[{'all':!![]}];}return db[_0x1b48('0x2e')]['findAll'](_0x1b47bf);})[_0x1b48('0x27')](function(_0xa1c770){_0x25e958['rows']=_0xa1c770;return _0x25e958;})[_0x1b48('0x27')](respondWithFilteredResult(_0x19c166,_0x1b47bf))['catch'](handleError(_0x19c166,null));};exports[_0x1b48('0x43')]=function(_0x547df6,_0x274034){var _0x28039f={'raw':!![],'where':{'id':_0x547df6['params']['id']}},_0x29648a={};_0x29648a['model']=_['keys'](db['OpenchannelQueue'][_0x1b48('0x2f')]);_0x29648a[_0x1b48('0x34')]=_[_0x1b48('0x31')](_0x547df6[_0x1b48('0x34')]);_0x29648a[_0x1b48('0x35')]=_[_0x1b48('0x36')](_0x29648a['model'],_0x29648a[_0x1b48('0x34')]);_0x28039f['attributes']=_[_0x1b48('0x36')](_0x29648a[_0x1b48('0x30')],qs[_0x1b48('0x38')](_0x547df6['query'][_0x1b48('0x38')]));_0x28039f['attributes']=_0x28039f[_0x1b48('0x37')]['length']?_0x28039f['attributes']:_0x29648a[_0x1b48('0x30')];if(_0x547df6[_0x1b48('0x34')]['includeAll']){_0x28039f['include']=[{'all':!![]}];}_0x28039f=_['merge']({},_0x28039f,_0x547df6['options']);return db[_0x1b48('0x2e')]['find'](_0x28039f)[_0x1b48('0x27')](handleEntityNotFound(_0x274034,null))[_0x1b48('0x27')](respondWithResult(_0x274034,null))[_0x1b48('0x44')](handleError(_0x274034,null));};exports[_0x1b48('0x45')]=function(_0x499e87,_0x1a28a4){return db[_0x1b48('0x2e')][_0x1b48('0x45')](_0x499e87[_0x1b48('0x46')],{})['then'](respondWithResult(_0x1a28a4,0xc9))[_0x1b48('0x44')](handleError(_0x1a28a4,null));};exports[_0x1b48('0x47')]=function(_0x5683c5,_0x3ca4bc){if(_0x5683c5[_0x1b48('0x46')]['id']){delete _0x5683c5[_0x1b48('0x46')]['id'];}return db[_0x1b48('0x2e')][_0x1b48('0x48')]({'where':{'id':_0x5683c5['params']['id']}})[_0x1b48('0x27')](handleEntityNotFound(_0x3ca4bc,null))[_0x1b48('0x27')](saveUpdates(_0x5683c5[_0x1b48('0x46')],null))['then'](respondWithResult(_0x3ca4bc,null))[_0x1b48('0x44')](handleError(_0x3ca4bc,null));};exports[_0x1b48('0x28')]=function(_0x2d890f,_0x4cd01a){return db[_0x1b48('0x2e')][_0x1b48('0x48')]({'where':{'id':_0x2d890f[_0x1b48('0x49')]['id']}})[_0x1b48('0x27')](handleEntityNotFound(_0x4cd01a,null))['then'](removeEntity(_0x4cd01a,null))['catch'](handleError(_0x4cd01a,null));};exports[_0x1b48('0x4a')]=function(_0x55155e,_0x5d00ea){return db[_0x1b48('0x2e')]['describe']()['then'](respondWithResult(_0x5d00ea,null))[_0x1b48('0x44')](handleError(_0x5d00ea,null));};exports[_0x1b48('0x4b')]=function(_0x35c565,_0x5bbe06,_0x2bbdff){var _0x822a7d={'raw':!![],'where':{}},_0x30de73={},_0x5221d8;return db[_0x1b48('0x2e')][_0x1b48('0x4c')]({'where':{'id':_0x35c565[_0x1b48('0x49')]['id']}})['then'](handleEntityNotFound(_0x5bbe06,null))['then'](function(_0x42909d){if(_0x42909d){_0x5221d8=_0x42909d[_0x1b48('0x4d')]({'plain':!![]});_0x30de73[_0x1b48('0x30')]=_[_0x1b48('0x31')](db[_0x1b48('0x4e')][_0x1b48('0x2f')]);_0x30de73['query']=_[_0x1b48('0x31')](_0x35c565[_0x1b48('0x34')]);_0x30de73['filters']=_[_0x1b48('0x36')](_0x30de73[_0x1b48('0x30')],_0x30de73[_0x1b48('0x34')]);_0x822a7d[_0x1b48('0x37')]=_[_0x1b48('0x36')](_0x30de73[_0x1b48('0x30')],qs[_0x1b48('0x38')](_0x35c565[_0x1b48('0x34')]['fields']));_0x822a7d['attributes']=_0x822a7d['attributes'][_0x1b48('0x39')]?_0x822a7d[_0x1b48('0x37')]:_0x30de73[_0x1b48('0x30')];if(!_0x35c565['query'][_0x1b48('0x3a')](_0x1b48('0x3b'))){_0x822a7d[_0x1b48('0x21')]=qs[_0x1b48('0x21')](_0x35c565[_0x1b48('0x34')][_0x1b48('0x21')]);_0x822a7d[_0x1b48('0x20')]=qs[_0x1b48('0x20')](_0x35c565['query']['offset']);}_0x822a7d[_0x1b48('0x3c')]=qs['sort'](_0x35c565[_0x1b48('0x34')][_0x1b48('0x4f')]);_0x822a7d[_0x1b48('0x3d')]=qs[_0x1b48('0x35')](_[_0x1b48('0x3e')](_0x35c565[_0x1b48('0x34')],_0x30de73[_0x1b48('0x35')]));_0x822a7d[_0x1b48('0x3d')][_0x1b48('0x50')]=_0x42909d['id'];if(_0x35c565['query'][_0x1b48('0x42')]){_0x822a7d[_0x1b48('0x3d')]=_['merge'](_0x822a7d[_0x1b48('0x3d')],{'$or':_[_0x1b48('0x51')](_0x822a7d[_0x1b48('0x37')],function(_0x18cc6c){var _0xbde989={};_0xbde989[_0x18cc6c]={'$like':'%'+_0x35c565['query'][_0x1b48('0x42')]+'%'};return _0xbde989;})});}_0x822a7d=_['merge']({},_0x822a7d,_0x35c565[_0x1b48('0x52')]);return db[_0x1b48('0x4e')]['findAll'](_0x822a7d);}})['then'](function(_0x453db6){if(_0x453db6){return db[_0x1b48('0x53')][_0x1b48('0x54')]({'where':{'id':_[_0x1b48('0x51')](_0x453db6,_0x1b48('0x55')),'role':_0x1b48('0x56')},'attributes':['id',_0x1b48('0x2b'),_0x1b48('0x57'),'updatedAt',_0x1b48('0x58')]});}})['then'](function(_0x50dad0){if(_0x50dad0){return{'count':_0x50dad0[_0x1b48('0x1f')],'rows':_[_0x1b48('0x51')](_0x50dad0[_0x1b48('0x59')],function(_0x525544){return{'membername':_0x525544[_0x1b48('0x2b')],'UserId':_0x525544['id'],'queue_name':_0x5221d8[_0x1b48('0x2b')],'OpenchannelQueueId':_0x5221d8['id'],'interface':util[_0x1b48('0x5a')](_0x1b48('0x5b'),'SIP',_0x525544[_0x1b48('0x2b')]),'penalty':0x0,'paused':_0x525544['openchannelPause'],'createdAt':_0x525544[_0x1b48('0x58')],'updatedAt':_0x525544[_0x1b48('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1b48('0x27')](respondWithFilteredResult(_0x5bbe06,_0x822a7d))[_0x1b48('0x44')](handleError(_0x5bbe06,null));};exports[_0x1b48('0x5d')]=function(_0x24c547,_0x41439e,_0x3350b7){var _0x8bf09d={};var _0x344bf7={};var _0x30c04c;var _0x1a2b4e;return db[_0x1b48('0x2e')][_0x1b48('0x4c')]({'where':{'id':_0x24c547[_0x1b48('0x49')]['id']}})[_0x1b48('0x27')](handleEntityNotFound(_0x41439e,null))[_0x1b48('0x27')](function(_0x193ca2){if(_0x193ca2){_0x30c04c=_0x193ca2;_0x344bf7[_0x1b48('0x30')]=_['keys'](db[_0x1b48('0x5e')][_0x1b48('0x2f')]);_0x344bf7[_0x1b48('0x34')]=_[_0x1b48('0x31')](_0x24c547[_0x1b48('0x34')]);_0x344bf7[_0x1b48('0x35')]=_[_0x1b48('0x36')](_0x344bf7[_0x1b48('0x30')],_0x344bf7['query']);_0x8bf09d['attributes']=_[_0x1b48('0x36')](_0x344bf7[_0x1b48('0x30')],qs[_0x1b48('0x38')](_0x24c547[_0x1b48('0x34')][_0x1b48('0x38')]));_0x8bf09d['attributes']=_0x8bf09d['attributes'][_0x1b48('0x39')]?_0x8bf09d[_0x1b48('0x37')]:_0x344bf7[_0x1b48('0x30')];_0x8bf09d[_0x1b48('0x3c')]=qs[_0x1b48('0x4f')](_0x24c547[_0x1b48('0x34')]['sort']);_0x8bf09d[_0x1b48('0x3d')]=qs['filters'](_[_0x1b48('0x3e')](_0x24c547[_0x1b48('0x34')],_0x344bf7[_0x1b48('0x35')]));if(_0x24c547[_0x1b48('0x34')]['filter']){_0x8bf09d['where']=_[_0x1b48('0x41')](_0x8bf09d[_0x1b48('0x3d')],{'$or':_['map'](_0x8bf09d[_0x1b48('0x37')],function(_0xc58d0d){var _0x50be19={};_0x50be19[_0xc58d0d]={'$like':'%'+_0x24c547[_0x1b48('0x34')][_0x1b48('0x42')]+'%'};return _0x50be19;})});}_0x8bf09d=_[_0x1b48('0x41')]({},_0x8bf09d,_0x24c547[_0x1b48('0x52')]);return _0x30c04c[_0x1b48('0x5d')](_0x8bf09d);}})[_0x1b48('0x27')](function(_0x1c8573){if(_0x1c8573){_0x1a2b4e=_0x1c8573[_0x1b48('0x39')];if(!_0x24c547['query']['hasOwnProperty'](_0x1b48('0x3b'))){_0x8bf09d[_0x1b48('0x21')]=qs[_0x1b48('0x21')](_0x24c547[_0x1b48('0x34')][_0x1b48('0x21')]);_0x8bf09d[_0x1b48('0x20')]=qs['offset'](_0x24c547[_0x1b48('0x34')][_0x1b48('0x20')]);}return _0x30c04c[_0x1b48('0x5d')](_0x8bf09d);}})[_0x1b48('0x27')](function(_0x147661){if(_0x147661){return _0x147661?{'count':_0x1a2b4e,'rows':_0x147661}:null;}})['then'](respondWithResult(_0x41439e,null))[_0x1b48('0x44')](handleError(_0x41439e,null));};exports[_0x1b48('0x5f')]=function(_0xfdef2b,_0x1d7872,_0x4c2b2f){var _0x41d76f=[];var _0x4d0511;return db['Team'][_0x1b48('0x60')]({'where':{'id':_0xfdef2b[_0x1b48('0x46')][_0x1b48('0x61')]},'attributes':['id'],'include':[{'model':db[_0x1b48('0x53')],'as':_0x1b48('0x62'),'attributes':['id'],'raw':!![]}]})[_0x1b48('0x27')](function(_0x172b2f){if(_0x172b2f){for(var _0x37c0ec=0x0;_0x37c0ec<_0x172b2f[_0x1b48('0x39')];_0x37c0ec+=0x1){for(var _0x5739b0=0x0;_0x5739b0<_0x172b2f[_0x37c0ec]['Agents'][_0x1b48('0x39')];_0x5739b0+=0x1){_0x41d76f=_[_0x1b48('0x63')](_0x41d76f,[_0x172b2f[_0x37c0ec][_0x1b48('0x62')][_0x5739b0]['id']]);}}return _0x41d76f;}})['then'](function(_0x2067ab){if(_0x2067ab){return db[_0x1b48('0x2e')]['find']({'where':{'id':_0xfdef2b[_0x1b48('0x49')]['id']}});}})['then'](function(_0x15d5a4){if(_0x15d5a4){_0x4d0511=_0x15d5a4;return _0x4d0511[_0x1b48('0x64')](_0x41d76f,{'penalty':_0xfdef2b[_0x1b48('0x46')][_0x1b48('0x65')]});}})[_0x1b48('0x27')](function(_0x5bab8f){if(_0x5bab8f){return _0x4d0511[_0x1b48('0x5f')](_0xfdef2b[_0x1b48('0x46')]['ids']);}})[_0x1b48('0x27')](handleEntityNotFound(_0x1d7872,null))[_0x1b48('0x27')](respondWithStatusCode(_0x1d7872,null))['catch'](handleError(_0x1d7872,null));};exports['removeTeams']=function(_0x3ed032,_0x4ebb1c,_0x1a65c1){var _0x488610=[];var _0x168880;return db[_0x1b48('0x5e')][_0x1b48('0x60')]({'where':{'id':_0x3ed032[_0x1b48('0x34')]['ids']},'attributes':['id'],'include':[{'model':db[_0x1b48('0x53')],'as':_0x1b48('0x62'),'attributes':['id'],'raw':!![]}]})[_0x1b48('0x27')](function(_0x48fd97){if(_0x48fd97){for(var _0x2b54e9=0x0;_0x2b54e9<_0x48fd97[_0x1b48('0x39')];_0x2b54e9+=0x1){for(var _0x5cdada=0x0;_0x5cdada<_0x48fd97[_0x2b54e9][_0x1b48('0x62')][_0x1b48('0x39')];_0x5cdada+=0x1){_0x488610=_[_0x1b48('0x63')](_0x488610,[_0x48fd97[_0x2b54e9]['Agents'][_0x5cdada]['id']]);}}return _0x488610;}})['then'](function(_0x27d349){if(_0x27d349){return db[_0x1b48('0x2e')][_0x1b48('0x48')]({'where':{'id':_0x3ed032[_0x1b48('0x49')]['id']}});}})[_0x1b48('0x27')](function(_0x7f7506){if(_0x7f7506){_0x168880=_0x7f7506;return _0x168880[_0x1b48('0x66')](_0x488610);}})[_0x1b48('0x27')](function(_0x418ab1){if(_0x168880){return _0x168880['removeTeams'](_0x3ed032[_0x1b48('0x34')][_0x1b48('0x61')]);}})[_0x1b48('0x27')](handleEntityNotFound(_0x4ebb1c,null))[_0x1b48('0x27')](respondWithStatusCode(_0x4ebb1c,null))[_0x1b48('0x44')](handleError(_0x4ebb1c,null));};exports[_0x1b48('0x64')]=function(_0x492497,_0x57a4b7,_0x1b44cc){return db[_0x1b48('0x2e')][_0x1b48('0x48')]({'where':{'id':_0x492497[_0x1b48('0x49')]['id']}})[_0x1b48('0x27')](handleEntityNotFound(_0x57a4b7,null))[_0x1b48('0x27')](function(_0xcedd15){if(_0xcedd15){return _0xcedd15[_0x1b48('0x64')](_0x492497[_0x1b48('0x46')][_0x1b48('0x61')],_[_0x1b48('0x67')](_0x492497[_0x1b48('0x46')],[_0x1b48('0x61'),'id'])||{})['spread'](function(_0x254f64){for(var _0x38d2aa=0x0;_0x38d2aa<_0x492497['body'][_0x1b48('0x61')]['length'];_0x38d2aa+=0x1){socket['emit'](_0x1b48('0x68'),{'UserId':_0x492497[_0x1b48('0x46')][_0x1b48('0x61')][_0x38d2aa],'OpenchannelQueueId':_0x492497['params']['id']});}return _0x254f64;});}})[_0x1b48('0x27')](respondWithResult(_0x57a4b7,null))[_0x1b48('0x44')](handleError(_0x57a4b7,null));};exports[_0x1b48('0x66')]=function(_0x32da5f,_0x1afbcf,_0x223c70){var _0x21385b;return db[_0x1b48('0x2e')][_0x1b48('0x48')]({'where':{'id':_0x32da5f['params']['id']}})['then'](handleEntityNotFound(_0x1afbcf,null))[_0x1b48('0x27')](function(_0x2f27f9){if(_0x2f27f9){return _0x2f27f9[_0x1b48('0x66')](_0x32da5f[_0x1b48('0x34')][_0x1b48('0x61')])[_0x1b48('0x27')](function(_0x448b65){if(_['isArray'](_0x32da5f[_0x1b48('0x34')][_0x1b48('0x61')])){for(var _0x2cbf15=0x0;_0x2cbf15<_0x32da5f[_0x1b48('0x34')][_0x1b48('0x61')]['length'];_0x2cbf15+=0x1){socket[_0x1b48('0x69')]('userOpenchannelQueue:remove',{'UserId':_0x32da5f[_0x1b48('0x34')]['ids'][_0x2cbf15],'OpenchannelQueueId':_0x32da5f[_0x1b48('0x49')]['id']});}}else{socket[_0x1b48('0x69')](_0x1b48('0x6a'),{'UserId':_0x32da5f[_0x1b48('0x34')]['ids'],'OpenchannelQueueId':_0x32da5f[_0x1b48('0x49')]['id']});}});}})[_0x1b48('0x27')](respondWithStatusCode(_0x1afbcf,null))[_0x1b48('0x44')](handleError(_0x1afbcf,null));};exports['getAgents']=function(_0x1a5bbf,_0x4dd7f1,_0x543679){var _0x1e7163={};var _0x51f31f={};var _0x269723;var _0x58cf4f;return db[_0x1b48('0x2e')][_0x1b48('0x4c')]({'where':{'id':_0x1a5bbf[_0x1b48('0x49')]['id']}})[_0x1b48('0x27')](handleEntityNotFound(_0x4dd7f1,null))[_0x1b48('0x27')](function(_0x4245de){if(_0x4245de){_0x269723=_0x4245de;_0x51f31f[_0x1b48('0x30')]=_['keys'](db['User'][_0x1b48('0x2f')]);_0x51f31f[_0x1b48('0x34')]=_['keys'](_0x1a5bbf[_0x1b48('0x34')]);_0x51f31f[_0x1b48('0x35')]=_[_0x1b48('0x36')](_0x51f31f[_0x1b48('0x30')],_0x51f31f[_0x1b48('0x34')]);_0x1e7163[_0x1b48('0x37')]=_[_0x1b48('0x36')](_0x51f31f['model'],qs['fields'](_0x1a5bbf['query']['fields']));_0x1e7163[_0x1b48('0x37')]=_0x1e7163[_0x1b48('0x37')][_0x1b48('0x39')]?_0x1e7163[_0x1b48('0x37')]:_0x51f31f['model'];_0x1e7163[_0x1b48('0x3c')]=qs[_0x1b48('0x4f')](_0x1a5bbf[_0x1b48('0x34')][_0x1b48('0x4f')]);_0x1e7163['where']=qs['filters'](_['pick'](_0x1a5bbf[_0x1b48('0x34')],_0x51f31f[_0x1b48('0x35')]));if(_0x1a5bbf['query']['filter']){_0x1e7163[_0x1b48('0x3d')]=_[_0x1b48('0x41')](_0x1e7163[_0x1b48('0x3d')],{'$or':_[_0x1b48('0x51')](_0x1e7163[_0x1b48('0x37')],function(_0x4151b6){var _0x38161e={};_0x38161e[_0x4151b6]={'$like':'%'+_0x1a5bbf[_0x1b48('0x34')][_0x1b48('0x42')]+'%'};return _0x38161e;})});}_0x1e7163=_[_0x1b48('0x41')]({},_0x1e7163,_0x1a5bbf[_0x1b48('0x52')]);return _0x269723[_0x1b48('0x6b')](_0x1e7163);}})[_0x1b48('0x27')](function(_0x2efc77){if(_0x2efc77){_0x58cf4f=_0x2efc77[_0x1b48('0x39')];if(!_0x1a5bbf[_0x1b48('0x34')][_0x1b48('0x3a')](_0x1b48('0x3b'))){_0x1e7163[_0x1b48('0x21')]=qs[_0x1b48('0x21')](_0x1a5bbf['query'][_0x1b48('0x21')]);_0x1e7163['offset']=qs[_0x1b48('0x20')](_0x1a5bbf[_0x1b48('0x34')]['offset']);}return _0x269723['getAgents'](_0x1e7163);}})['then'](function(_0xfd271d){if(_0xfd271d){return _0xfd271d?{'count':_0x58cf4f,'rows':_0xfd271d}:null;}})[_0x1b48('0x27')](respondWithResult(_0x4dd7f1,null))[_0x1b48('0x44')](handleError(_0x4dd7f1,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 526efbd..1c49e0f 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 _0x06d1=['emit','exports','events','save','update','remove'];(function(_0x41ed25,_0xa17e95){var _0x2ad25e=function(_0x48fab3){while(--_0x48fab3){_0x41ed25['push'](_0x41ed25['shift']());}};_0x2ad25e(++_0xa17e95);}(_0x06d1,0x194));var _0x106d=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x06d1[_0x2e4aa2];return _0x5e6092;};'use strict';var EventEmitter=require(_0x106d('0x0'));var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x106d('0x1'),'afterUpdate':_0x106d('0x2'),'afterDestroy':_0x106d('0x3')};function emitEvent(_0x378388){return function(_0x1aaac7,_0x35694e,_0x3871ad){OpenchannelQueueEvents[_0x106d('0x4')](_0x378388+':'+_0x1aaac7['id'],_0x1aaac7);OpenchannelQueueEvents[_0x106d('0x4')](_0x378388,_0x1aaac7);_0x3871ad(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x106d('0x5')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xad0f=['emit','hook','events','OpenchannelQueue','setMaxListeners','save','update','remove'];(function(_0x454553,_0x2a96f2){var _0x11e4d7=function(_0x4c1ea1){while(--_0x4c1ea1){_0x454553['push'](_0x454553['shift']());}};_0x11e4d7(++_0x2a96f2);}(_0xad0f,0x9a));var _0xfad0=function(_0x1aeda2,_0x1217eb){_0x1aeda2=_0x1aeda2-0x0;var _0x32dc6d=_0xad0f[_0x1aeda2];return _0x32dc6d;};'use strict';var EventEmitter=require(_0xfad0('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0xfad0('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xfad0('0x2')](0x0);var events={'afterCreate':_0xfad0('0x3'),'afterUpdate':_0xfad0('0x4'),'afterDestroy':_0xfad0('0x5')};function emitEvent(_0x9eafd6){return function(_0x465028,_0x54f35c,_0x320672){OpenchannelQueueEvents[_0xfad0('0x6')](_0x9eafd6+':'+_0x465028['id'],_0x465028);OpenchannelQueueEvents[_0xfad0('0x6')](_0x9eafd6,_0x465028);_0x320672(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xfad0('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 3a66513..f27b47e 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 _0xf72b=['OpenchannelQueue','lodash','../../config/logger','moment','bluebird','./openchannelQueue.attributes','exports','define'];(function(_0x46cad2,_0x2835ad){var _0x4ae5f5=function(_0x18f201){while(--_0x18f201){_0x46cad2['push'](_0x46cad2['shift']());}};_0x4ae5f5(++_0x2835ad);}(_0xf72b,0x1d9));var _0xbf72=function(_0x50994c,_0x5435df){_0x50994c=_0x50994c-0x0;var _0x471c95=_0xf72b[_0x50994c];return _0x471c95;};'use strict';var _=require(_0xbf72('0x0'));var util=require('util');var logger=require(_0xbf72('0x1'))('api');var moment=require(_0xbf72('0x2'));var BPromise=require(_0xbf72('0x3'));var rp=require('request-promise');var attributes=require(_0xbf72('0x4'));module[_0xbf72('0x5')]=function(_0x37afc8,_0x3d3a6f){return _0x37afc8[_0xbf72('0x6')](_0xbf72('0x7'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa74f=['request-promise','./openchannelQueue.attributes','exports','openchannel_queues','../../config/logger','bluebird'];(function(_0x23b85e,_0x39b209){var _0x329756=function(_0x3418e1){while(--_0x3418e1){_0x23b85e['push'](_0x23b85e['shift']());}};_0x329756(++_0x39b209);}(_0xa74f,0x9a));var _0xfa74=function(_0x2300c7,_0x255f74){_0x2300c7=_0x2300c7-0x0;var _0x23f720=_0xa74f[_0x2300c7];return _0x23f720;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfa74('0x0'))('api');var moment=require('moment');var BPromise=require(_0xfa74('0x1'));var rp=require(_0xfa74('0x2'));var attributes=require(_0xfa74('0x3'));module[_0xfa74('0x4')]=function(_0x5b367b,_0x141625){return _0x5b367b['define']('OpenchannelQueue',attributes,{'tableName':_0xfa74('0x5'),'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 d96aa25..2afd128 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 _0xf776=['attributes','include','map','model','info','ShowOpenchannelQueue','OpenchannelQueue','find','raw','where','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','./openchannelQueue.socket','register','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetOpenchannelQueue','options'];(function(_0x53b53e,_0x498437){var _0xbb6179=function(_0x3975eb){while(--_0x3975eb){_0x53b53e['push'](_0x53b53e['shift']());}};_0xbb6179(++_0x498437);}(_0xf776,0x169));var _0x6f77=function(_0x3b9f61,_0x1454ac){_0x3b9f61=_0x3b9f61-0x0;var _0x7a9619=_0xf776[_0x3b9f61];return _0x7a9619;};'use strict';var _=require(_0x6f77('0x0'));var util=require('util');var moment=require(_0x6f77('0x1'));var BPromise=require(_0x6f77('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6f77('0x3'));var db=require(_0x6f77('0x4'))['db'];var utils=require(_0x6f77('0x5'));var logger=require(_0x6f77('0x6'))('rpc');var config=require(_0x6f77('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6f77('0x8')][_0x6f77('0x9')]({'port':0x232a});config[_0x6f77('0xa')]=_[_0x6f77('0xb')](config['redis'],{'host':_0x6f77('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f77('0xa')]));require(_0x6f77('0xd'))[_0x6f77('0xe')](socket);function respondWithRpcPromise(_0x148902,_0x51b0cb,_0x11f8ad){return new BPromise(function(_0x2902bd,_0x2f4a50){return client[_0x6f77('0xf')](_0x148902,_0x11f8ad)[_0x6f77('0x10')](function(_0x1ae008){logger['info'](_0x6f77('0x11'),_0x51b0cb,_0x6f77('0x12'));logger[_0x6f77('0x13')](_0x6f77('0x14'),_0x51b0cb,_0x6f77('0x12'),JSON[_0x6f77('0x15')](_0x1ae008));if(_0x1ae008[_0x6f77('0x16')]){if(_0x1ae008[_0x6f77('0x16')][_0x6f77('0x17')]===0x1f4){logger[_0x6f77('0x16')](_0x6f77('0x11'),_0x51b0cb,_0x1ae008[_0x6f77('0x16')]['message']);return _0x2f4a50(_0x1ae008['error'][_0x6f77('0x18')]);}logger[_0x6f77('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x51b0cb,_0x1ae008[_0x6f77('0x16')]['message']);return _0x2902bd(_0x1ae008[_0x6f77('0x16')][_0x6f77('0x18')]);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x51b0cb,_0x6f77('0x12'));_0x2902bd(_0x1ae008[_0x6f77('0x19')][_0x6f77('0x18')]);}})[_0x6f77('0x1a')](function(_0xb1e6d){logger[_0x6f77('0x16')](_0x6f77('0x11'),_0x51b0cb,_0xb1e6d);_0x2f4a50(_0xb1e6d);});});}exports[_0x6f77('0x1b')]=function(_0x487635){var _0x7d7b18=this;return new Promise(function(_0xe954bc,_0x3ce6ad){return db['OpenchannelQueue']['findAll']({'raw':_0x487635[_0x6f77('0x1c')]?_0x487635[_0x6f77('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x487635[_0x6f77('0x1c')]?_0x487635[_0x6f77('0x1c')]['where']||null:null,'attributes':_0x487635[_0x6f77('0x1c')]?_0x487635[_0x6f77('0x1c')][_0x6f77('0x1d')]||null:null,'limit':_0x487635[_0x6f77('0x1c')]?_0x487635[_0x6f77('0x1c')]['limit']||null:null,'include':_0x487635[_0x6f77('0x1c')]?_0x487635[_0x6f77('0x1c')][_0x6f77('0x1e')]?_[_0x6f77('0x1f')](_0x487635[_0x6f77('0x1c')][_0x6f77('0x1e')],function(_0x2a907d){return{'model':db[_0x2a907d['model']],'as':_0x2a907d['as'],'attributes':_0x2a907d['attributes'],'include':_0x2a907d[_0x6f77('0x1e')]?_[_0x6f77('0x1f')](_0x2a907d[_0x6f77('0x1e')],function(_0x45fc8b){return{'model':db[_0x45fc8b[_0x6f77('0x20')]],'as':_0x45fc8b['as'],'attributes':_0x45fc8b[_0x6f77('0x1d')],'include':_0x45fc8b['include']?_['map'](_0x45fc8b[_0x6f77('0x1e')],function(_0x3904f9){return{'model':db[_0x3904f9[_0x6f77('0x20')]],'as':_0x3904f9['as'],'attributes':_0x3904f9[_0x6f77('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6f77('0x10')](function(_0x39afda){logger[_0x6f77('0x21')](_0x6f77('0x1b'),_0x487635);logger['debug']('GetOpenchannelQueue',_0x487635,JSON[_0x6f77('0x15')](_0x39afda));_0xe954bc(_0x39afda);})[_0x6f77('0x1a')](function(_0x2fe9d5){logger[_0x6f77('0x16')](_0x6f77('0x1b'),_0x2fe9d5['message'],_0x487635);_0x3ce6ad(_0x7d7b18[_0x6f77('0x16')](0x1f4,_0x2fe9d5[_0x6f77('0x18')]));});});};exports[_0x6f77('0x22')]=function(_0x586515){var _0x1d81af=this;return new Promise(function(_0x5bea99,_0x49adce){return db[_0x6f77('0x23')][_0x6f77('0x24')]({'raw':_0x586515[_0x6f77('0x1c')]?_0x586515[_0x6f77('0x1c')][_0x6f77('0x25')]===undefined?!![]:![]:!![],'where':_0x586515[_0x6f77('0x1c')]?_0x586515[_0x6f77('0x1c')][_0x6f77('0x26')]||null:null,'attributes':_0x586515[_0x6f77('0x1c')]?_0x586515['options'][_0x6f77('0x1d')]||null:null,'include':_0x586515['options']?_0x586515[_0x6f77('0x1c')]['include']?_[_0x6f77('0x1f')](_0x586515[_0x6f77('0x1c')]['include'],function(_0xe00f94){return{'model':db[_0xe00f94[_0x6f77('0x20')]],'as':_0xe00f94['as'],'attributes':_0xe00f94[_0x6f77('0x1d')],'include':_0xe00f94[_0x6f77('0x1e')]?_[_0x6f77('0x1f')](_0xe00f94['include'],function(_0x222c8b){return{'model':db[_0x222c8b[_0x6f77('0x20')]],'as':_0x222c8b['as'],'attributes':_0x222c8b[_0x6f77('0x1d')],'include':_0x222c8b[_0x6f77('0x1e')]?_[_0x6f77('0x1f')](_0x222c8b['include'],function(_0x3fe314){return{'model':db[_0x3fe314[_0x6f77('0x20')]],'as':_0x3fe314['as'],'attributes':_0x3fe314[_0x6f77('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6f77('0x10')](function(_0x435b40){logger['info'](_0x6f77('0x22'),_0x586515);logger['debug'](_0x6f77('0x22'),_0x586515,JSON[_0x6f77('0x15')](_0x435b40));_0x5bea99(_0x435b40);})[_0x6f77('0x1a')](function(_0xe8f717){logger[_0x6f77('0x16')]('ShowOpenchannelQueue',_0xe8f717[_0x6f77('0x18')],_0x586515);_0x49adce(_0x1d81af[_0x6f77('0x16')](0x1f4,_0xe8f717[_0x6f77('0x18')]));});});}; \ No newline at end of file +var _0xb0d9=['ioredis','../../config/utils','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','then','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','map','include','model','info','stringify','find','ShowOpenchannelQueue','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb0d9,0x10c));var _0x9b0d=function(_0x34995a,_0x257435){_0x34995a=_0x34995a-0x0;var _0x5963be=_0xb0d9[_0x34995a];return _0x5963be;};'use strict';var _=require(_0x9b0d('0x0'));var util=require(_0x9b0d('0x1'));var moment=require(_0x9b0d('0x2'));var BPromise=require(_0x9b0d('0x3'));var rs=require(_0x9b0d('0x4'));var fs=require('fs');var Redis=require(_0x9b0d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9b0d('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9b0d('0x7'));var client=jayson[_0x9b0d('0x8')][_0x9b0d('0x9')]({'port':0x232a});config[_0x9b0d('0xa')]=_[_0x9b0d('0xb')](config[_0x9b0d('0xa')],{'host':_0x9b0d('0xc'),'port':0x18eb});var socket=require(_0x9b0d('0xd'))(new Redis(config[_0x9b0d('0xa')]));require('./openchannelQueue.socket')['register'](socket);function respondWithRpcPromise(_0x193597,_0x76dc19,_0x48ac4a){return new BPromise(function(_0x382196,_0x118863){return client['request'](_0x193597,_0x48ac4a)[_0x9b0d('0xe')](function(_0x41f224){logger['info'](_0x9b0d('0xf'),_0x76dc19,'request\x20sent');logger[_0x9b0d('0x10')](_0x9b0d('0x11'),_0x76dc19,_0x9b0d('0x12'),JSON['stringify'](_0x41f224));if(_0x41f224[_0x9b0d('0x13')]){if(_0x41f224['error'][_0x9b0d('0x14')]===0x1f4){logger[_0x9b0d('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x76dc19,_0x41f224[_0x9b0d('0x13')]['message']);return _0x118863(_0x41f224[_0x9b0d('0x13')][_0x9b0d('0x15')]);}logger[_0x9b0d('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x76dc19,_0x41f224[_0x9b0d('0x13')][_0x9b0d('0x15')]);return _0x382196(_0x41f224['error']['message']);}else{logger['info'](_0x9b0d('0xf'),_0x76dc19,_0x9b0d('0x12'));_0x382196(_0x41f224[_0x9b0d('0x16')][_0x9b0d('0x15')]);}})['catch'](function(_0x292a17){logger[_0x9b0d('0x13')](_0x9b0d('0xf'),_0x76dc19,_0x292a17);_0x118863(_0x292a17);});});}exports[_0x9b0d('0x17')]=function(_0x53e8ce){var _0x331c03=this;return new Promise(function(_0x2f487b,_0xe5fb08){return db[_0x9b0d('0x18')][_0x9b0d('0x19')]({'raw':_0x53e8ce['options']?_0x53e8ce[_0x9b0d('0x1a')][_0x9b0d('0x1b')]===undefined?!![]:![]:!![],'where':_0x53e8ce[_0x9b0d('0x1a')]?_0x53e8ce[_0x9b0d('0x1a')][_0x9b0d('0x1c')]||null:null,'attributes':_0x53e8ce[_0x9b0d('0x1a')]?_0x53e8ce[_0x9b0d('0x1a')][_0x9b0d('0x1d')]||null:null,'limit':_0x53e8ce[_0x9b0d('0x1a')]?_0x53e8ce[_0x9b0d('0x1a')][_0x9b0d('0x1e')]||null:null,'include':_0x53e8ce['options']?_0x53e8ce[_0x9b0d('0x1a')]['include']?_[_0x9b0d('0x1f')](_0x53e8ce[_0x9b0d('0x1a')][_0x9b0d('0x20')],function(_0x12536e){return{'model':db[_0x12536e[_0x9b0d('0x21')]],'as':_0x12536e['as'],'attributes':_0x12536e[_0x9b0d('0x1d')],'include':_0x12536e[_0x9b0d('0x20')]?_[_0x9b0d('0x1f')](_0x12536e[_0x9b0d('0x20')],function(_0x5b31e4){return{'model':db[_0x5b31e4[_0x9b0d('0x21')]],'as':_0x5b31e4['as'],'attributes':_0x5b31e4[_0x9b0d('0x1d')],'include':_0x5b31e4[_0x9b0d('0x20')]?_[_0x9b0d('0x1f')](_0x5b31e4[_0x9b0d('0x20')],function(_0x3d9cba){return{'model':db[_0x3d9cba['model']],'as':_0x3d9cba['as'],'attributes':_0x3d9cba[_0x9b0d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9b0d('0xe')](function(_0x434a20){logger[_0x9b0d('0x22')]('GetOpenchannelQueue',_0x53e8ce);logger[_0x9b0d('0x10')]('GetOpenchannelQueue',_0x53e8ce,JSON[_0x9b0d('0x23')](_0x434a20));_0x2f487b(_0x434a20);})['catch'](function(_0x30155d){logger['error'](_0x9b0d('0x17'),_0x30155d[_0x9b0d('0x15')],_0x53e8ce);_0xe5fb08(_0x331c03['error'](0x1f4,_0x30155d[_0x9b0d('0x15')]));});});};exports['ShowOpenchannelQueue']=function(_0x47eae0){var _0x1b16a7=this;return new Promise(function(_0x1e2a68,_0xb35144){return db[_0x9b0d('0x18')][_0x9b0d('0x24')]({'raw':_0x47eae0['options']?_0x47eae0[_0x9b0d('0x1a')][_0x9b0d('0x1b')]===undefined?!![]:![]:!![],'where':_0x47eae0[_0x9b0d('0x1a')]?_0x47eae0[_0x9b0d('0x1a')][_0x9b0d('0x1c')]||null:null,'attributes':_0x47eae0[_0x9b0d('0x1a')]?_0x47eae0[_0x9b0d('0x1a')][_0x9b0d('0x1d')]||null:null,'include':_0x47eae0[_0x9b0d('0x1a')]?_0x47eae0[_0x9b0d('0x1a')]['include']?_[_0x9b0d('0x1f')](_0x47eae0[_0x9b0d('0x1a')][_0x9b0d('0x20')],function(_0x5633ec){return{'model':db[_0x5633ec['model']],'as':_0x5633ec['as'],'attributes':_0x5633ec[_0x9b0d('0x1d')],'include':_0x5633ec['include']?_['map'](_0x5633ec[_0x9b0d('0x20')],function(_0xaf35cb){return{'model':db[_0xaf35cb['model']],'as':_0xaf35cb['as'],'attributes':_0xaf35cb[_0x9b0d('0x1d')],'include':_0xaf35cb[_0x9b0d('0x20')]?_['map'](_0xaf35cb[_0x9b0d('0x20')],function(_0x818a11){return{'model':db[_0x818a11[_0x9b0d('0x21')]],'as':_0x818a11['as'],'attributes':_0x818a11[_0x9b0d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9b0d('0xe')](function(_0x2efb02){logger[_0x9b0d('0x22')]('ShowOpenchannelQueue',_0x47eae0);logger['debug'](_0x9b0d('0x25'),_0x47eae0,JSON[_0x9b0d('0x23')](_0x2efb02));_0x1e2a68(_0x2efb02);})[_0x9b0d('0x26')](function(_0x107e1a){logger[_0x9b0d('0x13')]('ShowOpenchannelQueue',_0x107e1a[_0x9b0d('0x15')],_0x47eae0);_0xb35144(_0x1b16a7[_0x9b0d('0x13')](0x1f4,_0x107e1a[_0x9b0d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index b810811..5d4a6c5 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 _0xa9e0=['register','length','openchannelQueue:','./openchannelQueue.events','save','remove','emit','removeListener'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var OpenchannelQueueEvents=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(){OpenchannelQueueEvents[_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);OpenchannelQueueEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','openchannelQueue:','./openchannelQueue.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var OpenchannelQueueEvents=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(){OpenchannelQueueEvents[_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);OpenchannelQueueEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index b42523b..acad2c0 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 _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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 _0xb10b=['../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x450e22,_0x3ba125){var _0x5e3b1d=function(_0x50f77c){while(--_0x50f77c){_0x450e22['push'](_0x450e22['shift']());}};_0x5e3b1d(++_0x3ba125);}(_0xb10b,0x12a));var _0xbb10=function(_0x264d4d,_0x118fb5){_0x264d4d=_0x264d4d-0x0;var _0xc917e2=_0xb10b[_0x264d4d];return _0xc917e2;};'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('0xe')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0xf')]);router['put']('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router[_0xbb10('0x11')]('/:id',auth[_0xbb10('0x9')](),controller['destroy']);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 86af10f..5ea2b30 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 _0xdaab=['DATE','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdaab,0x19c));var _0xbdaa=function(_0x3efcd5,_0x4a8d63){_0x3efcd5=_0x3efcd5-0x0;var _0x1b3333=_0xdaab[_0x3efcd5];return _0x1b3333;};'use strict';var moment=require('moment');var Sequelize=require(_0xbdaa('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xbdaa('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xbdaa('0x1')]},'joinAt':{'type':Sequelize[_0xbdaa('0x2')]},'leaveAt':{'type':Sequelize[_0xbdaa('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2838=['moment','sequelize','exports','STRING','DATE'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x2838,0xfa));var _0x8283=function(_0x4589fd,_0x4c6f26){_0x4589fd=_0x4589fd-0x0;var _0x44084b=_0x2838[_0x4589fd];return _0x44084b;};'use strict';var moment=require(_0x8283('0x0'));var Sequelize=require(_0x8283('0x1'));module[_0x8283('0x2')]={'uniqueid':{'type':Sequelize[_0x8283('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x8283('0x3')]},'joinAt':{'type':Sequelize[_0x8283('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x8283('0x4')]},'exitAt':{'type':Sequelize[_0x8283('0x4')]},'reason':{'type':Sequelize[_0x8283('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 55cacc0..e9e6ad6 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 _0xf3cd=['stack','name','send','rawAttributes','model','query','dateStart','dateEnd','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','add','day','merge','filter','options','OpenchannelQueueReport','include','findAll','catch','show','params','includeAll','create','body','find','describe','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','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error'];(function(_0x142e17,_0x5d1ca0){var _0x306336=function(_0x365f1f){while(--_0x365f1f){_0x142e17['push'](_0x142e17['shift']());}};_0x306336(++_0x5d1ca0);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x41dfac,_0x278319){_0x41dfac=_0x41dfac-0x0;var _0x12900b=_0xf3cd[_0x41dfac];return _0x12900b;};'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 qs=require('../../components/parsers/qs');var logger=require(_0xdf3c('0x12'))(_0xdf3c('0x13'));var utils=require(_0xdf3c('0x14'));var config=require(_0xdf3c('0x15'));var db=require(_0xdf3c('0x16'))['db'];function respondWithStatusCode(_0x1c456b,_0xf7da9d){_0xf7da9d=_0xf7da9d||0xcc;return function(_0x32d2db){if(_0x32d2db){return _0x1c456b['sendStatus'](_0xf7da9d);}return _0x1c456b[_0xdf3c('0x17')](_0xf7da9d)[_0xdf3c('0x18')]();};}function respondWithResult(_0x41fc33,_0x17319c){_0x17319c=_0x17319c||0xc8;return function(_0x59e431){if(_0x59e431){return _0x41fc33[_0xdf3c('0x17')](_0x17319c)[_0xdf3c('0x19')](_0x59e431);}};}function respondWithFilteredResult(_0x13ea5f,_0x5e0047){return function(_0x18aafa){if(_0x18aafa){var _0x38b01d=_0x18aafa[_0xdf3c('0x1a')],_0x173041=_0x5e0047[_0xdf3c('0x1b')],_0x4274fd=_0x5e0047[_0xdf3c('0x1b')]+_0x5e0047[_0xdf3c('0x1c')],_0x21e587;if(_0x4274fd>=_0x38b01d){_0x4274fd=_0x38b01d;_0x21e587=0xc8;}else{_0x21e587=0xce;}_0x13ea5f[_0xdf3c('0x17')](_0x21e587);return _0x13ea5f['set'](_0xdf3c('0x1d'),_0x173041+'-'+_0x4274fd+'/'+_0x38b01d)[_0xdf3c('0x19')](_0x18aafa);}return null;};}function patchUpdates(_0xf1da1f){return function(_0x18d4ec){try{jsonpatch[_0xdf3c('0x1e')](_0x18d4ec,_0xf1da1f,!![]);}catch(_0x113b56){return BPromise[_0xdf3c('0x1f')](_0x113b56);}return _0x18d4ec[_0xdf3c('0x20')]();};}function saveUpdates(_0x426f3a,_0x18fb5f){return function(_0x267488){if(_0x267488){return _0x267488[_0xdf3c('0x21')](_0x426f3a)[_0xdf3c('0x22')](function(_0x5d2390){return _0x5d2390;});}return null;};}function removeEntity(_0x4d620f,_0x3aa254){return function(_0x583ce4){if(_0x583ce4){return _0x583ce4[_0xdf3c('0x23')]()[_0xdf3c('0x22')](function(){_0x4d620f[_0xdf3c('0x17')](0xcc)[_0xdf3c('0x18')]();});}};}function handleEntityNotFound(_0x33652f,_0x36ba1c){return function(_0x50d8ca){if(!_0x50d8ca){_0x33652f[_0xdf3c('0x24')](0x194);}return _0x50d8ca;};}function handleError(_0x213d75,_0x13e3ca){_0x13e3ca=_0x13e3ca||0x1f4;return function(_0x24754a){logger[_0xdf3c('0x25')](_0x24754a[_0xdf3c('0x26')]);if(_0x24754a[_0xdf3c('0x27')]){delete _0x24754a[_0xdf3c('0x27')];}_0x213d75[_0xdf3c('0x17')](_0x13e3ca)[_0xdf3c('0x28')](_0x24754a);};}exports['index']=function(_0xd284d7,_0x153daa){var _0x4b57a4={},_0xdc8962={},_0x59659e={'count':0x0,'rows':[]};var _0x4eaced=db['OpenchannelQueueReport'][_0xdf3c('0x29')];_0xdc8962[_0xdf3c('0x2a')]=_['keys'](_0x4eaced);var _0x5c3b5a={'dateStart':_0xd284d7[_0xdf3c('0x2b')][_0xdf3c('0x2c')],'dateEnd':_0xd284d7[_0xdf3c('0x2b')][_0xdf3c('0x2d')]};delete _0xd284d7['query'][_0xdf3c('0x2c')];delete _0xd284d7[_0xdf3c('0x2b')]['dateEnd'];_0xdc8962['query']=_[_0xdf3c('0x2e')](_0xd284d7[_0xdf3c('0x2b')]);_0xdc8962[_0xdf3c('0x2f')]=_['intersection'](_0xdc8962[_0xdf3c('0x2a')],_0xdc8962[_0xdf3c('0x2b')]);_0x4b57a4[_0xdf3c('0x30')]=_[_0xdf3c('0x31')](_0xdc8962['model'],qs[_0xdf3c('0x32')](_0xd284d7[_0xdf3c('0x2b')]['fields']));_0x4b57a4[_0xdf3c('0x30')]=_0x4b57a4[_0xdf3c('0x30')][_0xdf3c('0x33')]?_0x4b57a4[_0xdf3c('0x30')]:_0xdc8962['model'];if(!_0xd284d7[_0xdf3c('0x2b')][_0xdf3c('0x34')](_0xdf3c('0x35'))){_0x4b57a4[_0xdf3c('0x1c')]=qs['limit'](_0xd284d7[_0xdf3c('0x2b')][_0xdf3c('0x1c')]);_0x4b57a4['offset']=qs['offset'](_0xd284d7[_0xdf3c('0x2b')]['offset']);}_0x4b57a4[_0xdf3c('0x36')]=qs['sort'](_0xd284d7['query']['sort']);_0x4b57a4[_0xdf3c('0x37')]=qs[_0xdf3c('0x2f')](_[_0xdf3c('0x38')](_0xd284d7[_0xdf3c('0x2b')],_0xdc8962['filters']));if(_0x5c3b5a['dateStart']){if(_0x5c3b5a[_0xdf3c('0x2d')]){_0x5c3b5a['dateEnd']=moment(_0x5c3b5a[_0xdf3c('0x2d')])[_0xdf3c('0x39')](0x1,_0xdf3c('0x3a'));}else{_0x5c3b5a[_0xdf3c('0x2d')]=moment(_0x5c3b5a[_0xdf3c('0x2c')])[_0xdf3c('0x39')](0x1,_0xdf3c('0x3a'));}_[_0xdf3c('0x3b')](_0x4b57a4[_0xdf3c('0x37')],{'createdAt':{'$gte':_0x5c3b5a['dateStart'],'$lte':_0x5c3b5a[_0xdf3c('0x2d')]}});}if(_0xd284d7['query']['filter']){_0x4b57a4[_0xdf3c('0x37')]=_['merge'](_0x4b57a4[_0xdf3c('0x37')],{'$or':_['map'](_0x4b57a4[_0xdf3c('0x30')],function(_0x27ee91){var _0x1c6dee={};_0x1c6dee[_0x27ee91]={'$like':'%'+_0xd284d7[_0xdf3c('0x2b')][_0xdf3c('0x3c')]+'%'};return _0x1c6dee;})});}_0x4b57a4=_[_0xdf3c('0x3b')]({},_0x4b57a4,_0xd284d7[_0xdf3c('0x3d')]);var _0x3d47fb={'where':_0x4b57a4[_0xdf3c('0x37')]};return db[_0xdf3c('0x3e')][_0xdf3c('0x1a')](_0x3d47fb)[_0xdf3c('0x22')](function(_0x57e0ab){_0x59659e['count']=_0x57e0ab;if(_0xd284d7[_0xdf3c('0x2b')]['includeAll']){_0x4b57a4[_0xdf3c('0x3f')]=[{'all':!![]}];}return db[_0xdf3c('0x3e')][_0xdf3c('0x40')](_0x4b57a4);})[_0xdf3c('0x22')](function(_0x5e068f){_0x59659e['rows']=_0x5e068f;return _0x59659e;})[_0xdf3c('0x22')](respondWithFilteredResult(_0x153daa,_0x4b57a4))[_0xdf3c('0x41')](handleError(_0x153daa,null));};exports[_0xdf3c('0x42')]=function(_0x4c59ef,_0x18274d){var _0x59041d={'raw':!![],'where':{'id':_0x4c59ef[_0xdf3c('0x43')]['id']}},_0x6fc3b6={};_0x6fc3b6['model']=_[_0xdf3c('0x2e')](db[_0xdf3c('0x3e')][_0xdf3c('0x29')]);_0x6fc3b6[_0xdf3c('0x2b')]=_[_0xdf3c('0x2e')](_0x4c59ef['query']);_0x6fc3b6[_0xdf3c('0x2f')]=_[_0xdf3c('0x31')](_0x6fc3b6[_0xdf3c('0x2a')],_0x6fc3b6[_0xdf3c('0x2b')]);_0x59041d[_0xdf3c('0x30')]=_[_0xdf3c('0x31')](_0x6fc3b6['model'],qs['fields'](_0x4c59ef[_0xdf3c('0x2b')][_0xdf3c('0x32')]));_0x59041d['attributes']=_0x59041d['attributes'][_0xdf3c('0x33')]?_0x59041d[_0xdf3c('0x30')]:_0x6fc3b6[_0xdf3c('0x2a')];if(_0x4c59ef[_0xdf3c('0x2b')][_0xdf3c('0x44')]){_0x59041d[_0xdf3c('0x3f')]=[{'all':!![]}];}_0x59041d=_[_0xdf3c('0x3b')]({},_0x59041d,_0x4c59ef[_0xdf3c('0x3d')]);return db[_0xdf3c('0x3e')]['find'](_0x59041d)[_0xdf3c('0x22')](handleEntityNotFound(_0x18274d,null))[_0xdf3c('0x22')](respondWithResult(_0x18274d,null))[_0xdf3c('0x41')](handleError(_0x18274d,null));};exports[_0xdf3c('0x45')]=function(_0xfc5901,_0x385824){return db[_0xdf3c('0x3e')]['create'](_0xfc5901[_0xdf3c('0x46')],{})['then'](respondWithResult(_0x385824,0xc9))[_0xdf3c('0x41')](handleError(_0x385824,null));};exports['update']=function(_0x41b78c,_0x28144f){if(_0x41b78c[_0xdf3c('0x46')]['id']){delete _0x41b78c[_0xdf3c('0x46')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x41b78c['params']['id']}})[_0xdf3c('0x22')](handleEntityNotFound(_0x28144f,null))['then'](saveUpdates(_0x41b78c[_0xdf3c('0x46')],null))[_0xdf3c('0x22')](respondWithResult(_0x28144f,null))[_0xdf3c('0x41')](handleError(_0x28144f,null));};exports[_0xdf3c('0x23')]=function(_0x3b17d9,_0x4c1a24){return db['OpenchannelQueueReport'][_0xdf3c('0x47')]({'where':{'id':_0x3b17d9[_0xdf3c('0x43')]['id']}})['then'](handleEntityNotFound(_0x4c1a24,null))[_0xdf3c('0x22')](removeEntity(_0x4c1a24,null))[_0xdf3c('0x41')](handleError(_0x4c1a24,null));};exports[_0xdf3c('0x48')]=function(_0x3fda0a,_0x38de63){return db[_0xdf3c('0x3e')][_0xdf3c('0x48')]()['then'](respondWithResult(_0x38de63,null))['catch'](handleError(_0x38de63,null));}; \ No newline at end of file +var _0x5c12=['rawAttributes','model','keys','dateStart','dateEnd','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','add','day','map','filter','options','count','include','findAll','then','show','params','fields','includeAll','merge','find','catch','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','limit','json','apply','update','error','stack','name','send','index','OpenchannelQueueReport'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x5c12,0x188));var _0x25c1=function(_0x1b02bb,_0x3d9fde){_0x1b02bb=_0x1b02bb-0x0;var _0x131245=_0x5c12[_0x1b02bb];return _0x131245;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x25c1('0x0'));var rimraf=require(_0x25c1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x25c1('0x2'));var rp=require(_0x25c1('0x3'));var moment=require(_0x25c1('0x4'));var BPromise=require(_0x25c1('0x5'));var Mustache=require(_0x25c1('0x6'));var util=require(_0x25c1('0x7'));var path=require(_0x25c1('0x8'));var sox=require('sox');var csv=require(_0x25c1('0x9'));var ejs=require(_0x25c1('0xa'));var fs=require('fs');var _=require(_0x25c1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x25c1('0xc'));var deskjs=require(_0x25c1('0xd'));var toCsv=require(_0x25c1('0x9'));var querystring=require(_0x25c1('0xe'));var Papa=require(_0x25c1('0xf'));var Redis=require('ioredis');var qs=require(_0x25c1('0x10'));var logger=require(_0x25c1('0x11'))(_0x25c1('0x12'));var utils=require(_0x25c1('0x13'));var config=require(_0x25c1('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x196e2f,_0x401734){_0x401734=_0x401734||0xcc;return function(_0x49fb8e){if(_0x49fb8e){return _0x196e2f[_0x25c1('0x15')](_0x401734);}return _0x196e2f[_0x25c1('0x16')](_0x401734)[_0x25c1('0x17')]();};}function respondWithResult(_0x329ba9,_0x5d3d11){_0x5d3d11=_0x5d3d11||0xc8;return function(_0x569ef9){if(_0x569ef9){return _0x329ba9['status'](_0x5d3d11)['json'](_0x569ef9);}};}function respondWithFilteredResult(_0x3ef429,_0x1412ed){return function(_0x342cd4){if(_0x342cd4){var _0x6eba15=_0x342cd4['count'],_0x17a032=_0x1412ed['offset'],_0x4ea926=_0x1412ed['offset']+_0x1412ed[_0x25c1('0x18')],_0x4638f0;if(_0x4ea926>=_0x6eba15){_0x4ea926=_0x6eba15;_0x4638f0=0xc8;}else{_0x4638f0=0xce;}_0x3ef429[_0x25c1('0x16')](_0x4638f0);return _0x3ef429['set']('Content-Range',_0x17a032+'-'+_0x4ea926+'/'+_0x6eba15)[_0x25c1('0x19')](_0x342cd4);}return null;};}function patchUpdates(_0x4c0d49){return function(_0x7175d4){try{jsonpatch[_0x25c1('0x1a')](_0x7175d4,_0x4c0d49,!![]);}catch(_0x5c3c5d){return BPromise['reject'](_0x5c3c5d);}return _0x7175d4['save']();};}function saveUpdates(_0x2ce1ce,_0x3d3149){return function(_0x22a36e){if(_0x22a36e){return _0x22a36e[_0x25c1('0x1b')](_0x2ce1ce)['then'](function(_0x119639){return _0x119639;});}return null;};}function removeEntity(_0x9f54e3,_0x34454a){return function(_0x29e637){if(_0x29e637){return _0x29e637['destroy']()['then'](function(){_0x9f54e3[_0x25c1('0x16')](0xcc)[_0x25c1('0x17')]();});}};}function handleEntityNotFound(_0x396ed5,_0x1c61e7){return function(_0x15cf2f){if(!_0x15cf2f){_0x396ed5[_0x25c1('0x15')](0x194);}return _0x15cf2f;};}function handleError(_0x2ba595,_0x324ea9){_0x324ea9=_0x324ea9||0x1f4;return function(_0x14ffd9){logger[_0x25c1('0x1c')](_0x14ffd9[_0x25c1('0x1d')]);if(_0x14ffd9[_0x25c1('0x1e')]){delete _0x14ffd9[_0x25c1('0x1e')];}_0x2ba595['status'](_0x324ea9)[_0x25c1('0x1f')](_0x14ffd9);};}exports[_0x25c1('0x20')]=function(_0x1b1c96,_0x1fb59f){var _0x21fdb8={},_0x326a5f={},_0x5ad776={'count':0x0,'rows':[]};var _0x17c924=db[_0x25c1('0x21')][_0x25c1('0x22')];_0x326a5f[_0x25c1('0x23')]=_[_0x25c1('0x24')](_0x17c924);var _0x193a68={'dateStart':_0x1b1c96['query'][_0x25c1('0x25')],'dateEnd':_0x1b1c96['query'][_0x25c1('0x26')]};delete _0x1b1c96[_0x25c1('0x27')][_0x25c1('0x25')];delete _0x1b1c96[_0x25c1('0x27')][_0x25c1('0x26')];_0x326a5f[_0x25c1('0x27')]=_[_0x25c1('0x24')](_0x1b1c96[_0x25c1('0x27')]);_0x326a5f[_0x25c1('0x28')]=_['intersection'](_0x326a5f[_0x25c1('0x23')],_0x326a5f['query']);_0x21fdb8['attributes']=_[_0x25c1('0x29')](_0x326a5f[_0x25c1('0x23')],qs['fields'](_0x1b1c96[_0x25c1('0x27')]['fields']));_0x21fdb8[_0x25c1('0x2a')]=_0x21fdb8['attributes'][_0x25c1('0x2b')]?_0x21fdb8[_0x25c1('0x2a')]:_0x326a5f[_0x25c1('0x23')];if(!_0x1b1c96[_0x25c1('0x27')][_0x25c1('0x2c')](_0x25c1('0x2d'))){_0x21fdb8[_0x25c1('0x18')]=qs[_0x25c1('0x18')](_0x1b1c96['query'][_0x25c1('0x18')]);_0x21fdb8['offset']=qs[_0x25c1('0x2e')](_0x1b1c96['query'][_0x25c1('0x2e')]);}_0x21fdb8[_0x25c1('0x2f')]=qs[_0x25c1('0x30')](_0x1b1c96[_0x25c1('0x27')][_0x25c1('0x30')]);_0x21fdb8[_0x25c1('0x31')]=qs[_0x25c1('0x28')](_[_0x25c1('0x32')](_0x1b1c96[_0x25c1('0x27')],_0x326a5f[_0x25c1('0x28')]));if(_0x193a68[_0x25c1('0x25')]){if(_0x193a68[_0x25c1('0x26')]){_0x193a68[_0x25c1('0x26')]=moment(_0x193a68[_0x25c1('0x26')])[_0x25c1('0x33')](0x1,_0x25c1('0x34'));}else{_0x193a68[_0x25c1('0x26')]=moment(_0x193a68[_0x25c1('0x25')])[_0x25c1('0x33')](0x1,_0x25c1('0x34'));}_['merge'](_0x21fdb8[_0x25c1('0x31')],{'createdAt':{'$gte':_0x193a68[_0x25c1('0x25')],'$lte':_0x193a68['dateEnd']}});}if(_0x1b1c96[_0x25c1('0x27')]['filter']){_0x21fdb8[_0x25c1('0x31')]=_['merge'](_0x21fdb8[_0x25c1('0x31')],{'$or':_[_0x25c1('0x35')](_0x21fdb8[_0x25c1('0x2a')],function(_0x3d6135){var _0xbc20a3={};_0xbc20a3[_0x3d6135]={'$like':'%'+_0x1b1c96['query'][_0x25c1('0x36')]+'%'};return _0xbc20a3;})});}_0x21fdb8=_['merge']({},_0x21fdb8,_0x1b1c96[_0x25c1('0x37')]);var _0xe83d32={'where':_0x21fdb8[_0x25c1('0x31')]};return db[_0x25c1('0x21')]['count'](_0xe83d32)['then'](function(_0x58b8f3){_0x5ad776[_0x25c1('0x38')]=_0x58b8f3;if(_0x1b1c96[_0x25c1('0x27')]['includeAll']){_0x21fdb8[_0x25c1('0x39')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x25c1('0x3a')](_0x21fdb8);})[_0x25c1('0x3b')](function(_0x3c24da){_0x5ad776['rows']=_0x3c24da;return _0x5ad776;})['then'](respondWithFilteredResult(_0x1fb59f,_0x21fdb8))['catch'](handleError(_0x1fb59f,null));};exports[_0x25c1('0x3c')]=function(_0x3cf9c0,_0x4f9f73){var _0x3ab903={'raw':!![],'where':{'id':_0x3cf9c0[_0x25c1('0x3d')]['id']}},_0x4c90f6={};_0x4c90f6['model']=_['keys'](db['OpenchannelQueueReport']['rawAttributes']);_0x4c90f6[_0x25c1('0x27')]=_[_0x25c1('0x24')](_0x3cf9c0['query']);_0x4c90f6[_0x25c1('0x28')]=_[_0x25c1('0x29')](_0x4c90f6[_0x25c1('0x23')],_0x4c90f6[_0x25c1('0x27')]);_0x3ab903[_0x25c1('0x2a')]=_[_0x25c1('0x29')](_0x4c90f6[_0x25c1('0x23')],qs['fields'](_0x3cf9c0['query'][_0x25c1('0x3e')]));_0x3ab903[_0x25c1('0x2a')]=_0x3ab903[_0x25c1('0x2a')]['length']?_0x3ab903[_0x25c1('0x2a')]:_0x4c90f6[_0x25c1('0x23')];if(_0x3cf9c0[_0x25c1('0x27')][_0x25c1('0x3f')]){_0x3ab903['include']=[{'all':!![]}];}_0x3ab903=_[_0x25c1('0x40')]({},_0x3ab903,_0x3cf9c0[_0x25c1('0x37')]);return db[_0x25c1('0x21')][_0x25c1('0x41')](_0x3ab903)['then'](handleEntityNotFound(_0x4f9f73,null))['then'](respondWithResult(_0x4f9f73,null))[_0x25c1('0x42')](handleError(_0x4f9f73,null));};exports[_0x25c1('0x43')]=function(_0x26891b,_0x37d24e){return db['OpenchannelQueueReport'][_0x25c1('0x43')](_0x26891b[_0x25c1('0x44')],{})['then'](respondWithResult(_0x37d24e,0xc9))[_0x25c1('0x42')](handleError(_0x37d24e,null));};exports[_0x25c1('0x1b')]=function(_0x16e740,_0x31c504){if(_0x16e740['body']['id']){delete _0x16e740['body']['id'];}return db[_0x25c1('0x21')][_0x25c1('0x41')]({'where':{'id':_0x16e740[_0x25c1('0x3d')]['id']}})['then'](handleEntityNotFound(_0x31c504,null))[_0x25c1('0x3b')](saveUpdates(_0x16e740[_0x25c1('0x44')],null))['then'](respondWithResult(_0x31c504,null))[_0x25c1('0x42')](handleError(_0x31c504,null));};exports[_0x25c1('0x45')]=function(_0x2b58a3,_0x2b3bcb){return db[_0x25c1('0x21')][_0x25c1('0x41')]({'where':{'id':_0x2b58a3[_0x25c1('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2b3bcb,null))['then'](removeEntity(_0x2b3bcb,null))['catch'](handleError(_0x2b3bcb,null));};exports[_0x25c1('0x46')]=function(_0x5c588c,_0x133d1d){return db[_0x25c1('0x21')][_0x25c1('0x46')]()[_0x25c1('0x3b')](respondWithResult(_0x133d1d,null))[_0x25c1('0x42')](handleError(_0x133d1d,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 4c8a8bc..a56d1fe 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 _0x0738=['../../config/logger','api','moment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util'];(function(_0x309f9c,_0x493c0b){var _0x3c6b0c=function(_0x27c95d){while(--_0x27c95d){_0x309f9c['push'](_0x309f9c['shift']());}};_0x3c6b0c(++_0x493c0b);}(_0x0738,0xb9));var _0x8073=function(_0x403115,_0x2d6d03){_0x403115=_0x403115-0x0;var _0x596ef3=_0x0738[_0x403115];return _0x596ef3;};'use strict';var _=require(_0x8073('0x0'));var util=require(_0x8073('0x1'));var logger=require(_0x8073('0x2'))(_0x8073('0x3'));var moment=require(_0x8073('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x8073('0x5'));module[_0x8073('0x6')]=function(_0x1133f4,_0x683b93){return _0x1133f4[_0x8073('0x7')](_0x8073('0x8'),attributes,{'tableName':_0x8073('0x9'),'paranoid':![],'indexes':[{'name':_0x8073('0xa'),'fields':[_0x8073('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x808a=['util','../../config/logger','api','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x164d70,_0x520b64){var _0x1b2c9f=function(_0x556fea){while(--_0x556fea){_0x164d70['push'](_0x164d70['shift']());}};_0x1b2c9f(++_0x520b64);}(_0x808a,0x1b7));var _0xa808=function(_0xf466fc,_0xe6b550){_0xf466fc=_0xf466fc-0x0;var _0x1e6330=_0x808a[_0xf466fc];return _0x1e6330;};'use strict';var _=require(_0xa808('0x0'));var util=require(_0xa808('0x1'));var logger=require(_0xa808('0x2'))(_0xa808('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./openchannelQueueReport.attributes');module[_0xa808('0x4')]=function(_0x38ed20,_0x3baf9b){return _0x38ed20[_0xa808('0x5')]('OpenchannelQueueReport',attributes,{'tableName':_0xa808('0x6'),'paranoid':![],'indexes':[{'name':_0xa808('0x7'),'fields':[_0xa808('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index fbeb28d..c8d2ff0 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 _0x5cfc=['catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','update','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x5cfc,0x1a3));var _0xc5cf=function(_0x5b5eb4,_0x117c87){_0x5b5eb4=_0x5b5eb4-0x0;var _0x42af53=_0x5cfc[_0x5b5eb4];return _0x42af53;};'use strict';var _=require(_0xc5cf('0x0'));var util=require(_0xc5cf('0x1'));var moment=require('moment');var BPromise=require(_0xc5cf('0x2'));var rs=require(_0xc5cf('0x3'));var fs=require('fs');var Redis=require(_0xc5cf('0x4'));var db=require(_0xc5cf('0x5'))['db'];var utils=require(_0xc5cf('0x6'));var logger=require(_0xc5cf('0x7'))(_0xc5cf('0x8'));var config=require(_0xc5cf('0x9'));var jayson=require(_0xc5cf('0xa'));var client=jayson['client'][_0xc5cf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ff77f,_0x175a6f,_0x572a3d){return new BPromise(function(_0x188b2e,_0x59aff0){return client['request'](_0x4ff77f,_0x572a3d)[_0xc5cf('0xc')](function(_0x289414){logger['info'](_0xc5cf('0xd'),_0x175a6f,_0xc5cf('0xe'));logger[_0xc5cf('0xf')](_0xc5cf('0x10'),_0x175a6f,_0xc5cf('0xe'),JSON[_0xc5cf('0x11')](_0x289414));if(_0x289414[_0xc5cf('0x12')]){if(_0x289414[_0xc5cf('0x12')][_0xc5cf('0x13')]===0x1f4){logger['error'](_0xc5cf('0xd'),_0x175a6f,_0x289414['error']['message']);return _0x59aff0(_0x289414[_0xc5cf('0x12')]['message']);}logger[_0xc5cf('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x175a6f,_0x289414[_0xc5cf('0x12')][_0xc5cf('0x14')]);return _0x188b2e(_0x289414[_0xc5cf('0x12')][_0xc5cf('0x14')]);}else{logger[_0xc5cf('0x15')](_0xc5cf('0xd'),_0x175a6f,_0xc5cf('0xe'));_0x188b2e(_0x289414[_0xc5cf('0x16')][_0xc5cf('0x14')]);}})[_0xc5cf('0x17')](function(_0x594be2){logger[_0xc5cf('0x12')](_0xc5cf('0xd'),_0x175a6f,_0x594be2);_0x59aff0(_0x594be2);});});}exports[_0xc5cf('0x18')]=function(_0x29995f){var _0x1e7aa1=this;return new Promise(function(_0x213432,_0x212606){return db[_0xc5cf('0x19')][_0xc5cf('0x1a')](_0x29995f[_0xc5cf('0x1b')],{'raw':_0x29995f[_0xc5cf('0x1c')]?_0x29995f['options'][_0xc5cf('0x1d')]===undefined?!![]:![]:!![]})[_0xc5cf('0xc')](function(_0x56bc31){logger[_0xc5cf('0x15')](_0xc5cf('0x18'),_0x29995f);logger[_0xc5cf('0xf')](_0xc5cf('0x18'),_0x29995f,JSON[_0xc5cf('0x11')](_0x56bc31));_0x213432(_0x56bc31);})[_0xc5cf('0x17')](function(_0x477efa){logger[_0xc5cf('0x12')](_0xc5cf('0x18'),_0x477efa[_0xc5cf('0x14')],_0x29995f);_0x212606(_0x1e7aa1[_0xc5cf('0x12')](0x1f4,_0x477efa[_0xc5cf('0x14')]));});});};exports[_0xc5cf('0x1e')]=function(_0x3b3a23){var _0x3600c8=this;return new Promise(function(_0x451462,_0x7da14b){return db[_0xc5cf('0x19')][_0xc5cf('0x1f')](_0x3b3a23[_0xc5cf('0x1b')],{'raw':_0x3b3a23[_0xc5cf('0x1c')]?_0x3b3a23['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b3a23[_0xc5cf('0x1c')]?_0x3b3a23['options']['where']||null:null,'attributes':_0x3b3a23['options']?_0x3b3a23[_0xc5cf('0x1c')][_0xc5cf('0x20')]||null:null,'limit':_0x3b3a23['options']?_0x3b3a23[_0xc5cf('0x1c')][_0xc5cf('0x21')]||null:null})[_0xc5cf('0xc')](function(_0x44ea46){logger[_0xc5cf('0x15')]('UpdateOpenchannelQueueReport',_0x3b3a23);logger[_0xc5cf('0xf')](_0xc5cf('0x1e'),_0x3b3a23,JSON[_0xc5cf('0x11')](_0x44ea46));_0x451462(_0x44ea46);})['catch'](function(_0xabdb55){logger[_0xc5cf('0x12')](_0xc5cf('0x1e'),_0xabdb55[_0xc5cf('0x14')],_0x3b3a23);_0x7da14b(_0x3600c8[_0xc5cf('0x12')](0x1f4,_0xabdb55[_0xc5cf('0x14')]));});});}; \ No newline at end of file +var _0xd695=['stringify','error','code','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','then','UpdateOpenchannelQueueReport','update','limit','lodash','util','moment','bluebird','randomstring','ioredis','rpc','client','request','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x31726a,_0x2d90e9){var _0x51c911=function(_0x3e0834){while(--_0x3e0834){_0x31726a['push'](_0x31726a['shift']());}};_0x51c911(++_0x2d90e9);}(_0xd695,0x1df));var _0x5d69=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd695[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x5d69('0x0'));var util=require(_0x5d69('0x1'));var moment=require(_0x5d69('0x2'));var BPromise=require(_0x5d69('0x3'));var rs=require(_0x5d69('0x4'));var fs=require('fs');var Redis=require(_0x5d69('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5d69('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5d69('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58919f,_0x1cf83d,_0x3c510f){return new BPromise(function(_0x2f1948,_0x928e66){return client[_0x5d69('0x8')](_0x58919f,_0x3c510f)['then'](function(_0x3356b){logger[_0x5d69('0x9')](_0x5d69('0xa'),_0x1cf83d,_0x5d69('0xb'));logger[_0x5d69('0xc')](_0x5d69('0xd'),_0x1cf83d,_0x5d69('0xb'),JSON[_0x5d69('0xe')](_0x3356b));if(_0x3356b[_0x5d69('0xf')]){if(_0x3356b[_0x5d69('0xf')][_0x5d69('0x10')]===0x1f4){logger[_0x5d69('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x1cf83d,_0x3356b['error'][_0x5d69('0x11')]);return _0x928e66(_0x3356b[_0x5d69('0xf')][_0x5d69('0x11')]);}logger[_0x5d69('0xf')](_0x5d69('0xa'),_0x1cf83d,_0x3356b[_0x5d69('0xf')][_0x5d69('0x11')]);return _0x2f1948(_0x3356b[_0x5d69('0xf')][_0x5d69('0x11')]);}else{logger[_0x5d69('0x9')](_0x5d69('0xa'),_0x1cf83d,_0x5d69('0xb'));_0x2f1948(_0x3356b['result'][_0x5d69('0x11')]);}})[_0x5d69('0x12')](function(_0xdb75d5){logger[_0x5d69('0xf')](_0x5d69('0xa'),_0x1cf83d,_0xdb75d5);_0x928e66(_0xdb75d5);});});}exports[_0x5d69('0x13')]=function(_0x4da468){var _0x18ba38=this;return new Promise(function(_0x291487,_0x1ffd6d){return db[_0x5d69('0x14')][_0x5d69('0x15')](_0x4da468[_0x5d69('0x16')],{'raw':_0x4da468['options']?_0x4da468[_0x5d69('0x17')][_0x5d69('0x18')]===undefined?!![]:![]:!![]})[_0x5d69('0x19')](function(_0x5960a2){logger[_0x5d69('0x9')](_0x5d69('0x13'),_0x4da468);logger[_0x5d69('0xc')](_0x5d69('0x13'),_0x4da468,JSON[_0x5d69('0xe')](_0x5960a2));_0x291487(_0x5960a2);})[_0x5d69('0x12')](function(_0x2cd5bf){logger[_0x5d69('0xf')](_0x5d69('0x13'),_0x2cd5bf[_0x5d69('0x11')],_0x4da468);_0x1ffd6d(_0x18ba38[_0x5d69('0xf')](0x1f4,_0x2cd5bf[_0x5d69('0x11')]));});});};exports[_0x5d69('0x1a')]=function(_0x549621){var _0x550d2d=this;return new Promise(function(_0x647879,_0x356206){return db['OpenchannelQueueReport'][_0x5d69('0x1b')](_0x549621[_0x5d69('0x16')],{'raw':_0x549621[_0x5d69('0x17')]?_0x549621[_0x5d69('0x17')][_0x5d69('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x549621[_0x5d69('0x17')]?_0x549621[_0x5d69('0x17')]['where']||null:null,'attributes':_0x549621[_0x5d69('0x17')]?_0x549621[_0x5d69('0x17')]['attributes']||null:null,'limit':_0x549621[_0x5d69('0x17')]?_0x549621['options'][_0x5d69('0x1c')]||null:null})['then'](function(_0x3bd81f){logger[_0x5d69('0x9')]('UpdateOpenchannelQueueReport',_0x549621);logger['debug'](_0x5d69('0x1a'),_0x549621,JSON[_0x5d69('0xe')](_0x3bd81f));_0x647879(_0x3bd81f);})[_0x5d69('0x12')](function(_0x2ba5bb){logger[_0x5d69('0xf')](_0x5d69('0x1a'),_0x2ba5bb[_0x5d69('0x11')],_0x549621);_0x356206(_0x550d2d[_0x5d69('0xf')](0x1f4,_0x2ba5bb[_0x5d69('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index d0723d3..cb7f7fd 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 _0xee91=['../../components/interaction/service','./openchannelTransferReport.controller','get','isAuthenticated','describe','/:id','post','create','update','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xee91,0x1aa));var _0x1ee9=function(_0x11ac40,_0x375c63){_0x11ac40=_0x11ac40-0x0;var _0x45b544=_0xee91[_0x11ac40];return _0x45b544;};'use strict';var multer=require(_0x1ee9('0x0'));var util=require('util');var path=require(_0x1ee9('0x1'));var timeout=require(_0x1ee9('0x2'));var express=require(_0x1ee9('0x3'));var router=express[_0x1ee9('0x4')]();var auth=require(_0x1ee9('0x5'));var interaction=require(_0x1ee9('0x6'));var config=require('../../config/environment');var controller=require(_0x1ee9('0x7'));router[_0x1ee9('0x8')]('/',auth[_0x1ee9('0x9')](),controller['index']);router[_0x1ee9('0x8')]('/describe',auth[_0x1ee9('0x9')](),controller[_0x1ee9('0xa')]);router['get'](_0x1ee9('0xb'),auth[_0x1ee9('0x9')](),controller['show']);router[_0x1ee9('0xc')]('/',auth[_0x1ee9('0x9')](),controller[_0x1ee9('0xd')]);router['put']('/:id',auth[_0x1ee9('0x9')](),controller[_0x1ee9('0xe')]);router['delete'](_0x1ee9('0xb'),auth[_0x1ee9('0x9')](),controller[_0x1ee9('0xf')]);module['exports']=router; \ No newline at end of file +var _0xfea0=['../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x47eb13,_0x24b67d){var _0x1e6e02=function(_0x19091b){while(--_0x19091b){_0x47eb13['push'](_0x47eb13['shift']());}};_0x1e6e02(++_0x24b67d);}(_0xfea0,0x162));var _0x0fea=function(_0x580a9f,_0x4bf6a1){_0x580a9f=_0x580a9f-0x0;var _0x24a583=_0xfea0[_0x580a9f];return _0x24a583;};'use strict';var multer=require('multer');var util=require(_0x0fea('0x0'));var path=require(_0x0fea('0x1'));var timeout=require(_0x0fea('0x2'));var express=require(_0x0fea('0x3'));var router=express[_0x0fea('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0fea('0x5'));var config=require(_0x0fea('0x6'));var controller=require(_0x0fea('0x7'));router[_0x0fea('0x8')]('/',auth[_0x0fea('0x9')](),controller[_0x0fea('0xa')]);router[_0x0fea('0x8')](_0x0fea('0xb'),auth[_0x0fea('0x9')](),controller[_0x0fea('0xc')]);router[_0x0fea('0x8')](_0x0fea('0xd'),auth[_0x0fea('0x9')](),controller['show']);router[_0x0fea('0xe')]('/',auth[_0x0fea('0x9')](),controller[_0x0fea('0xf')]);router['put'](_0x0fea('0xd'),auth[_0x0fea('0x9')](),controller[_0x0fea('0x10')]);router[_0x0fea('0x11')](_0x0fea('0xd'),auth[_0x0fea('0x9')](),controller[_0x0fea('0x12')]);module[_0x0fea('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index d5ac20e..3be8850 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 _0xd004=['sequelize','exports','STRING','ENUM','account','queue','DATE'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd004,0x149));var _0x4d00=function(_0x5e795f,_0x831a4f){_0x5e795f=_0x5e795f-0x0;var _0x1a0912=_0xd004[_0x5e795f];return _0x1a0912;};'use strict';var moment=require('moment');var Sequelize=require(_0x4d00('0x0'));module[_0x4d00('0x1')]={'uniqueid':{'type':Sequelize[_0x4d00('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4d00('0x3')](_0x4d00('0x4'),'agent','queue'),'allowNull':![],'defaultValue':_0x4d00('0x5')},'transferredAt':{'type':Sequelize[_0x4d00('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x847e=['exports','STRING','ENUM','account','agent','queue','DATE','moment','sequelize'];(function(_0x5d36a1,_0x3048c4){var _0x33feb9=function(_0x46e91a){while(--_0x46e91a){_0x5d36a1['push'](_0x5d36a1['shift']());}};_0x33feb9(++_0x3048c4);}(_0x847e,0x1c0));var _0xe847=function(_0x1100be,_0xc86309){_0x1100be=_0x1100be-0x0;var _0x182dda=_0x847e[_0x1100be];return _0x182dda;};'use strict';var moment=require(_0xe847('0x0'));var Sequelize=require(_0xe847('0x1'));module[_0xe847('0x2')]={'uniqueid':{'type':Sequelize[_0xe847('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xe847('0x4')](_0xe847('0x5'),_0xe847('0x6'),'queue'),'allowNull':![],'defaultValue':_0xe847('0x7')},'transferredAt':{'type':Sequelize[_0xe847('0x8')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 76d69a7..2399003 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 _0x43cf=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','OpenchannelTransferReport','rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','add','day','merge','filter','map','options','includeAll','findAll','catch','show','params','length','include','body','update','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger'];(function(_0xa2b365,_0xe776f){var _0x107c9f=function(_0x160e78){while(--_0x160e78){_0xa2b365['push'](_0xa2b365['shift']());}};_0x107c9f(++_0xe776f);}(_0x43cf,0x114));var _0xf43c=function(_0x5d07ff,_0x1f976f){_0x5d07ff=_0x5d07ff-0x0;var _0x5226ad=_0x43cf[_0x5d07ff];return _0x5226ad;};'use strict';var pdf=require(_0xf43c('0x0'));var emlformat=require(_0xf43c('0x1'));var rimraf=require(_0xf43c('0x2'));var zipdir=require(_0xf43c('0x3'));var jsonpatch=require(_0xf43c('0x4'));var rp=require(_0xf43c('0x5'));var moment=require(_0xf43c('0x6'));var BPromise=require(_0xf43c('0x7'));var Mustache=require(_0xf43c('0x8'));var util=require(_0xf43c('0x9'));var path=require(_0xf43c('0xa'));var sox=require('sox');var csv=require(_0xf43c('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf43c('0xc'));var squel=require(_0xf43c('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf43c('0xe'));var toCsv=require(_0xf43c('0xb'));var querystring=require(_0xf43c('0xf'));var Papa=require(_0xf43c('0x10'));var Redis=require(_0xf43c('0x11'));var qs=require(_0xf43c('0x12'));var logger=require(_0xf43c('0x13'))(_0xf43c('0x14'));var utils=require(_0xf43c('0x15'));var config=require(_0xf43c('0x16'));var db=require(_0xf43c('0x17'))['db'];function respondWithStatusCode(_0x115bee,_0x228e2c){_0x228e2c=_0x228e2c||0xcc;return function(_0x3394e0){if(_0x3394e0){return _0x115bee[_0xf43c('0x18')](_0x228e2c);}return _0x115bee[_0xf43c('0x19')](_0x228e2c)[_0xf43c('0x1a')]();};}function respondWithResult(_0xed2857,_0x32ec88){_0x32ec88=_0x32ec88||0xc8;return function(_0xb6882e){if(_0xb6882e){return _0xed2857[_0xf43c('0x19')](_0x32ec88)[_0xf43c('0x1b')](_0xb6882e);}};}function respondWithFilteredResult(_0x4b386c,_0xdcfe4c){return function(_0x135a82){if(_0x135a82){var _0x380e37=_0x135a82[_0xf43c('0x1c')],_0x4b61a2=_0xdcfe4c[_0xf43c('0x1d')],_0x4a753b=_0xdcfe4c[_0xf43c('0x1d')]+_0xdcfe4c['limit'],_0x1eb2d8;if(_0x4a753b>=_0x380e37){_0x4a753b=_0x380e37;_0x1eb2d8=0xc8;}else{_0x1eb2d8=0xce;}_0x4b386c[_0xf43c('0x19')](_0x1eb2d8);return _0x4b386c[_0xf43c('0x1e')](_0xf43c('0x1f'),_0x4b61a2+'-'+_0x4a753b+'/'+_0x380e37)[_0xf43c('0x1b')](_0x135a82);}return null;};}function patchUpdates(_0x50f6c5){return function(_0x46780c){try{jsonpatch[_0xf43c('0x20')](_0x46780c,_0x50f6c5,!![]);}catch(_0x4ac32c){return BPromise[_0xf43c('0x21')](_0x4ac32c);}return _0x46780c[_0xf43c('0x22')]();};}function saveUpdates(_0x3cb8a6,_0x595d5b){return function(_0x530398){if(_0x530398){return _0x530398['update'](_0x3cb8a6)[_0xf43c('0x23')](function(_0x34e083){return _0x34e083;});}return null;};}function removeEntity(_0x47bef3,_0x59fd0e){return function(_0x3fed39){if(_0x3fed39){return _0x3fed39[_0xf43c('0x24')]()[_0xf43c('0x23')](function(){_0x47bef3[_0xf43c('0x19')](0xcc)[_0xf43c('0x1a')]();});}};}function handleEntityNotFound(_0x10f79e,_0x110676){return function(_0x20d735){if(!_0x20d735){_0x10f79e[_0xf43c('0x18')](0x194);}return _0x20d735;};}function handleError(_0x459cc8,_0x35a239){_0x35a239=_0x35a239||0x1f4;return function(_0x51bf28){logger['error'](_0x51bf28[_0xf43c('0x25')]);if(_0x51bf28[_0xf43c('0x26')]){delete _0x51bf28['name'];}_0x459cc8[_0xf43c('0x19')](_0x35a239)[_0xf43c('0x27')](_0x51bf28);};}exports[_0xf43c('0x28')]=function(_0x3ac5d4,_0x1bd17a){var _0x569630={},_0x24203d={},_0x3411cd={'count':0x0,'rows':[]};var _0x33ca55=db[_0xf43c('0x29')][_0xf43c('0x2a')];_0x24203d[_0xf43c('0x2b')]=_['keys'](_0x33ca55);var _0x4e04e0={'dateStart':_0x3ac5d4[_0xf43c('0x2c')][_0xf43c('0x2d')],'dateEnd':_0x3ac5d4[_0xf43c('0x2c')][_0xf43c('0x2e')]};delete _0x3ac5d4[_0xf43c('0x2c')][_0xf43c('0x2d')];delete _0x3ac5d4[_0xf43c('0x2c')]['dateEnd'];_0x24203d[_0xf43c('0x2c')]=_[_0xf43c('0x2f')](_0x3ac5d4[_0xf43c('0x2c')]);_0x24203d[_0xf43c('0x30')]=_[_0xf43c('0x31')](_0x24203d[_0xf43c('0x2b')],_0x24203d[_0xf43c('0x2c')]);_0x569630['attributes']=_[_0xf43c('0x31')](_0x24203d[_0xf43c('0x2b')],qs[_0xf43c('0x32')](_0x3ac5d4['query'][_0xf43c('0x32')]));_0x569630[_0xf43c('0x33')]=_0x569630[_0xf43c('0x33')]['length']?_0x569630[_0xf43c('0x33')]:_0x24203d[_0xf43c('0x2b')];if(!_0x3ac5d4['query'][_0xf43c('0x34')](_0xf43c('0x35'))){_0x569630['limit']=qs[_0xf43c('0x36')](_0x3ac5d4[_0xf43c('0x2c')][_0xf43c('0x36')]);_0x569630[_0xf43c('0x1d')]=qs['offset'](_0x3ac5d4[_0xf43c('0x2c')][_0xf43c('0x1d')]);}_0x569630['order']=qs[_0xf43c('0x37')](_0x3ac5d4[_0xf43c('0x2c')][_0xf43c('0x37')]);_0x569630[_0xf43c('0x38')]=qs['filters'](_[_0xf43c('0x39')](_0x3ac5d4[_0xf43c('0x2c')],_0x24203d[_0xf43c('0x30')]));if(_0x4e04e0[_0xf43c('0x2d')]){if(_0x4e04e0[_0xf43c('0x2e')]){_0x4e04e0[_0xf43c('0x2e')]=moment(_0x4e04e0[_0xf43c('0x2e')])[_0xf43c('0x3a')](0x1,_0xf43c('0x3b'));}else{_0x4e04e0['dateEnd']=moment(_0x4e04e0[_0xf43c('0x2d')])[_0xf43c('0x3a')](0x1,'day');}_[_0xf43c('0x3c')](_0x569630['where'],{'createdAt':{'$gte':_0x4e04e0['dateStart'],'$lte':_0x4e04e0[_0xf43c('0x2e')]}});}if(_0x3ac5d4['query'][_0xf43c('0x3d')]){_0x569630[_0xf43c('0x38')]=_[_0xf43c('0x3c')](_0x569630[_0xf43c('0x38')],{'$or':_[_0xf43c('0x3e')](_0x569630[_0xf43c('0x33')],function(_0xc5c31d){var _0x18bdeb={};_0x18bdeb[_0xc5c31d]={'$like':'%'+_0x3ac5d4['query'][_0xf43c('0x3d')]+'%'};return _0x18bdeb;})});}_0x569630=_[_0xf43c('0x3c')]({},_0x569630,_0x3ac5d4[_0xf43c('0x3f')]);var _0x8231db={'where':_0x569630[_0xf43c('0x38')]};return db[_0xf43c('0x29')][_0xf43c('0x1c')](_0x8231db)[_0xf43c('0x23')](function(_0x43a6b2){_0x3411cd[_0xf43c('0x1c')]=_0x43a6b2;if(_0x3ac5d4[_0xf43c('0x2c')][_0xf43c('0x40')]){_0x569630['include']=[{'all':!![]}];}return db[_0xf43c('0x29')][_0xf43c('0x41')](_0x569630);})[_0xf43c('0x23')](function(_0x37658e){_0x3411cd['rows']=_0x37658e;return _0x3411cd;})[_0xf43c('0x23')](respondWithFilteredResult(_0x1bd17a,_0x569630))[_0xf43c('0x42')](handleError(_0x1bd17a,null));};exports[_0xf43c('0x43')]=function(_0x2feab2,_0x338668){var _0x2c4046={'raw':!![],'where':{'id':_0x2feab2[_0xf43c('0x44')]['id']}},_0x521e72={};_0x521e72[_0xf43c('0x2b')]=_[_0xf43c('0x2f')](db[_0xf43c('0x29')][_0xf43c('0x2a')]);_0x521e72[_0xf43c('0x2c')]=_[_0xf43c('0x2f')](_0x2feab2[_0xf43c('0x2c')]);_0x521e72[_0xf43c('0x30')]=_[_0xf43c('0x31')](_0x521e72['model'],_0x521e72['query']);_0x2c4046[_0xf43c('0x33')]=_[_0xf43c('0x31')](_0x521e72[_0xf43c('0x2b')],qs[_0xf43c('0x32')](_0x2feab2[_0xf43c('0x2c')]['fields']));_0x2c4046['attributes']=_0x2c4046[_0xf43c('0x33')][_0xf43c('0x45')]?_0x2c4046[_0xf43c('0x33')]:_0x521e72[_0xf43c('0x2b')];if(_0x2feab2['query'][_0xf43c('0x40')]){_0x2c4046[_0xf43c('0x46')]=[{'all':!![]}];}_0x2c4046=_['merge']({},_0x2c4046,_0x2feab2[_0xf43c('0x3f')]);return db[_0xf43c('0x29')]['find'](_0x2c4046)[_0xf43c('0x23')](handleEntityNotFound(_0x338668,null))['then'](respondWithResult(_0x338668,null))[_0xf43c('0x42')](handleError(_0x338668,null));};exports['create']=function(_0x3888f5,_0x15d910){return db['OpenchannelTransferReport']['create'](_0x3888f5[_0xf43c('0x47')],{})[_0xf43c('0x23')](respondWithResult(_0x15d910,0xc9))['catch'](handleError(_0x15d910,null));};exports[_0xf43c('0x48')]=function(_0x5cfcbc,_0x1b538e){if(_0x5cfcbc[_0xf43c('0x47')]['id']){delete _0x5cfcbc[_0xf43c('0x47')]['id'];}return db[_0xf43c('0x29')][_0xf43c('0x49')]({'where':{'id':_0x5cfcbc['params']['id']}})[_0xf43c('0x23')](handleEntityNotFound(_0x1b538e,null))[_0xf43c('0x23')](saveUpdates(_0x5cfcbc['body'],null))[_0xf43c('0x23')](respondWithResult(_0x1b538e,null))[_0xf43c('0x42')](handleError(_0x1b538e,null));};exports['destroy']=function(_0x3d06cf,_0x56e534){return db[_0xf43c('0x29')][_0xf43c('0x49')]({'where':{'id':_0x3d06cf[_0xf43c('0x44')]['id']}})['then'](handleEntityNotFound(_0x56e534,null))[_0xf43c('0x23')](removeEntity(_0x56e534,null))[_0xf43c('0x42')](handleError(_0x56e534,null));};exports['describe']=function(_0x9398a5,_0x24e724){return db[_0xf43c('0x29')]['describe']()[_0xf43c('0x23')](respondWithResult(_0x24e724,null))[_0xf43c('0x42')](handleError(_0x24e724,null));}; \ No newline at end of file +var _0x9c25=['status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','model','keys','query','dateEnd','dateStart','intersection','fields','attributes','length','nolimit','order','sort','filters','pick','add','day','merge','where','filter','map','options','OpenchannelTransferReport','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus'];(function(_0x7b5af,_0x4cf0a2){var _0x58c1c1=function(_0x5aeecc){while(--_0x5aeecc){_0x7b5af['push'](_0x7b5af['shift']());}};_0x58c1c1(++_0x4cf0a2);}(_0x9c25,0x106));var _0x59c2=function(_0x1e9946,_0x16a118){_0x1e9946=_0x1e9946-0x0;var _0x1122cc=_0x9c25[_0x1e9946];return _0x1122cc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x59c2('0x0'));var rimraf=require(_0x59c2('0x1'));var zipdir=require(_0x59c2('0x2'));var jsonpatch=require(_0x59c2('0x3'));var rp=require(_0x59c2('0x4'));var moment=require(_0x59c2('0x5'));var BPromise=require(_0x59c2('0x6'));var Mustache=require(_0x59c2('0x7'));var util=require('util');var path=require(_0x59c2('0x8'));var sox=require(_0x59c2('0x9'));var csv=require('to-csv');var ejs=require(_0x59c2('0xa'));var fs=require('fs');var _=require(_0x59c2('0xb'));var squel=require(_0x59c2('0xc'));var crypto=require(_0x59c2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x59c2('0xe'));var toCsv=require(_0x59c2('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var qs=require(_0x59c2('0x10'));var logger=require(_0x59c2('0x11'))(_0x59c2('0x12'));var utils=require(_0x59c2('0x13'));var config=require(_0x59c2('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3503e1,_0x401871){_0x401871=_0x401871||0xcc;return function(_0x3626d0){if(_0x3626d0){return _0x3503e1[_0x59c2('0x15')](_0x401871);}return _0x3503e1[_0x59c2('0x16')](_0x401871)[_0x59c2('0x17')]();};}function respondWithResult(_0x2d03cc,_0x51466f){_0x51466f=_0x51466f||0xc8;return function(_0x5ad19b){if(_0x5ad19b){return _0x2d03cc['status'](_0x51466f)['json'](_0x5ad19b);}};}function respondWithFilteredResult(_0x4e81fc,_0x18224f){return function(_0x1ba0ca){if(_0x1ba0ca){var _0x210e0c=_0x1ba0ca[_0x59c2('0x18')],_0x1e8852=_0x18224f[_0x59c2('0x19')],_0x1f7f8b=_0x18224f[_0x59c2('0x19')]+_0x18224f[_0x59c2('0x1a')],_0x4f050c;if(_0x1f7f8b>=_0x210e0c){_0x1f7f8b=_0x210e0c;_0x4f050c=0xc8;}else{_0x4f050c=0xce;}_0x4e81fc[_0x59c2('0x16')](_0x4f050c);return _0x4e81fc[_0x59c2('0x1b')](_0x59c2('0x1c'),_0x1e8852+'-'+_0x1f7f8b+'/'+_0x210e0c)['json'](_0x1ba0ca);}return null;};}function patchUpdates(_0x203368){return function(_0x263105){try{jsonpatch[_0x59c2('0x1d')](_0x263105,_0x203368,!![]);}catch(_0x5a7750){return BPromise[_0x59c2('0x1e')](_0x5a7750);}return _0x263105[_0x59c2('0x1f')]();};}function saveUpdates(_0x28e813,_0x1b0bf0){return function(_0x498fa7){if(_0x498fa7){return _0x498fa7[_0x59c2('0x20')](_0x28e813)[_0x59c2('0x21')](function(_0x1eb6f7){return _0x1eb6f7;});}return null;};}function removeEntity(_0x4993ef,_0x302b51){return function(_0x35076c){if(_0x35076c){return _0x35076c[_0x59c2('0x22')]()[_0x59c2('0x21')](function(){_0x4993ef[_0x59c2('0x16')](0xcc)[_0x59c2('0x17')]();});}};}function handleEntityNotFound(_0x2c9974,_0x20fb4e){return function(_0xfbb0c7){if(!_0xfbb0c7){_0x2c9974[_0x59c2('0x15')](0x194);}return _0xfbb0c7;};}function handleError(_0x457f51,_0x5ab000){_0x5ab000=_0x5ab000||0x1f4;return function(_0x1e3d83){logger[_0x59c2('0x23')](_0x1e3d83[_0x59c2('0x24')]);if(_0x1e3d83[_0x59c2('0x25')]){delete _0x1e3d83['name'];}_0x457f51[_0x59c2('0x16')](_0x5ab000)['send'](_0x1e3d83);};}exports['index']=function(_0x56e429,_0x388869){var _0xaaf88e={},_0x4d7aa1={},_0x101bd3={'count':0x0,'rows':[]};var _0xa0a067=db['OpenchannelTransferReport']['rawAttributes'];_0x4d7aa1[_0x59c2('0x26')]=_[_0x59c2('0x27')](_0xa0a067);var _0xce1c66={'dateStart':_0x56e429[_0x59c2('0x28')]['dateStart'],'dateEnd':_0x56e429['query'][_0x59c2('0x29')]};delete _0x56e429[_0x59c2('0x28')][_0x59c2('0x2a')];delete _0x56e429['query'][_0x59c2('0x29')];_0x4d7aa1[_0x59c2('0x28')]=_[_0x59c2('0x27')](_0x56e429[_0x59c2('0x28')]);_0x4d7aa1['filters']=_[_0x59c2('0x2b')](_0x4d7aa1[_0x59c2('0x26')],_0x4d7aa1['query']);_0xaaf88e['attributes']=_[_0x59c2('0x2b')](_0x4d7aa1['model'],qs[_0x59c2('0x2c')](_0x56e429[_0x59c2('0x28')][_0x59c2('0x2c')]));_0xaaf88e[_0x59c2('0x2d')]=_0xaaf88e[_0x59c2('0x2d')][_0x59c2('0x2e')]?_0xaaf88e[_0x59c2('0x2d')]:_0x4d7aa1[_0x59c2('0x26')];if(!_0x56e429['query']['hasOwnProperty'](_0x59c2('0x2f'))){_0xaaf88e[_0x59c2('0x1a')]=qs[_0x59c2('0x1a')](_0x56e429[_0x59c2('0x28')]['limit']);_0xaaf88e[_0x59c2('0x19')]=qs[_0x59c2('0x19')](_0x56e429[_0x59c2('0x28')][_0x59c2('0x19')]);}_0xaaf88e[_0x59c2('0x30')]=qs[_0x59c2('0x31')](_0x56e429[_0x59c2('0x28')][_0x59c2('0x31')]);_0xaaf88e['where']=qs[_0x59c2('0x32')](_[_0x59c2('0x33')](_0x56e429[_0x59c2('0x28')],_0x4d7aa1[_0x59c2('0x32')]));if(_0xce1c66[_0x59c2('0x2a')]){if(_0xce1c66['dateEnd']){_0xce1c66[_0x59c2('0x29')]=moment(_0xce1c66['dateEnd'])[_0x59c2('0x34')](0x1,'day');}else{_0xce1c66[_0x59c2('0x29')]=moment(_0xce1c66[_0x59c2('0x2a')])[_0x59c2('0x34')](0x1,_0x59c2('0x35'));}_[_0x59c2('0x36')](_0xaaf88e[_0x59c2('0x37')],{'createdAt':{'$gte':_0xce1c66['dateStart'],'$lte':_0xce1c66[_0x59c2('0x29')]}});}if(_0x56e429['query'][_0x59c2('0x38')]){_0xaaf88e[_0x59c2('0x37')]=_[_0x59c2('0x36')](_0xaaf88e[_0x59c2('0x37')],{'$or':_[_0x59c2('0x39')](_0xaaf88e[_0x59c2('0x2d')],function(_0x49aeb1){var _0x56c056={};_0x56c056[_0x49aeb1]={'$like':'%'+_0x56e429[_0x59c2('0x28')][_0x59c2('0x38')]+'%'};return _0x56c056;})});}_0xaaf88e=_[_0x59c2('0x36')]({},_0xaaf88e,_0x56e429[_0x59c2('0x3a')]);var _0x3a9c7f={'where':_0xaaf88e[_0x59c2('0x37')]};return db[_0x59c2('0x3b')]['count'](_0x3a9c7f)[_0x59c2('0x21')](function(_0x15bd0f){_0x101bd3[_0x59c2('0x18')]=_0x15bd0f;if(_0x56e429[_0x59c2('0x28')][_0x59c2('0x3c')]){_0xaaf88e['include']=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x59c2('0x3d')](_0xaaf88e);})['then'](function(_0x97f58d){_0x101bd3[_0x59c2('0x3e')]=_0x97f58d;return _0x101bd3;})[_0x59c2('0x21')](respondWithFilteredResult(_0x388869,_0xaaf88e))[_0x59c2('0x3f')](handleError(_0x388869,null));};exports[_0x59c2('0x40')]=function(_0x205a6b,_0x3ab951){var _0x11897a={'raw':!![],'where':{'id':_0x205a6b[_0x59c2('0x41')]['id']}},_0x32e475={};_0x32e475[_0x59c2('0x26')]=_[_0x59c2('0x27')](db['OpenchannelTransferReport'][_0x59c2('0x42')]);_0x32e475[_0x59c2('0x28')]=_[_0x59c2('0x27')](_0x205a6b[_0x59c2('0x28')]);_0x32e475[_0x59c2('0x32')]=_[_0x59c2('0x2b')](_0x32e475[_0x59c2('0x26')],_0x32e475[_0x59c2('0x28')]);_0x11897a[_0x59c2('0x2d')]=_[_0x59c2('0x2b')](_0x32e475[_0x59c2('0x26')],qs['fields'](_0x205a6b[_0x59c2('0x28')]['fields']));_0x11897a[_0x59c2('0x2d')]=_0x11897a[_0x59c2('0x2d')][_0x59c2('0x2e')]?_0x11897a['attributes']:_0x32e475['model'];if(_0x205a6b[_0x59c2('0x28')][_0x59c2('0x3c')]){_0x11897a[_0x59c2('0x43')]=[{'all':!![]}];}_0x11897a=_[_0x59c2('0x36')]({},_0x11897a,_0x205a6b[_0x59c2('0x3a')]);return db[_0x59c2('0x3b')][_0x59c2('0x44')](_0x11897a)[_0x59c2('0x21')](handleEntityNotFound(_0x3ab951,null))[_0x59c2('0x21')](respondWithResult(_0x3ab951,null))['catch'](handleError(_0x3ab951,null));};exports['create']=function(_0x2ef4d8,_0x166823){return db[_0x59c2('0x3b')]['create'](_0x2ef4d8[_0x59c2('0x45')],{})[_0x59c2('0x21')](respondWithResult(_0x166823,0xc9))[_0x59c2('0x3f')](handleError(_0x166823,null));};exports[_0x59c2('0x20')]=function(_0x28bdf0,_0x133351){if(_0x28bdf0[_0x59c2('0x45')]['id']){delete _0x28bdf0[_0x59c2('0x45')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x28bdf0[_0x59c2('0x41')]['id']}})[_0x59c2('0x21')](handleEntityNotFound(_0x133351,null))[_0x59c2('0x21')](saveUpdates(_0x28bdf0[_0x59c2('0x45')],null))['then'](respondWithResult(_0x133351,null))[_0x59c2('0x3f')](handleError(_0x133351,null));};exports[_0x59c2('0x22')]=function(_0x3479bf,_0x510588){return db[_0x59c2('0x3b')]['find']({'where':{'id':_0x3479bf['params']['id']}})[_0x59c2('0x21')](handleEntityNotFound(_0x510588,null))[_0x59c2('0x21')](removeEntity(_0x510588,null))[_0x59c2('0x3f')](handleError(_0x510588,null));};exports[_0x59c2('0x46')]=function(_0x3473c9,_0x35d7ce){return db[_0x59c2('0x3b')][_0x59c2('0x46')]()[_0x59c2('0x21')](respondWithResult(_0x35d7ce,null))[_0x59c2('0x3f')](handleError(_0x35d7ce,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index c16162a..bf4734a 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 _0x7a54=['report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','./openchannelTransferReport.attributes','exports','define'];(function(_0x1a46e7,_0xa69448){var _0x10885b=function(_0x2e908d){while(--_0x2e908d){_0x1a46e7['push'](_0x1a46e7['shift']());}};_0x10885b(++_0xa69448);}(_0x7a54,0x106));var _0x47a5=function(_0x14d57b,_0x198151){_0x14d57b=_0x14d57b-0x0;var _0x2c9759=_0x7a54[_0x14d57b];return _0x2c9759;};'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 attributes=require(_0x47a5('0x5'));module[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){return _0x2a1a7e[_0x47a5('0x7')]('OpenchannelTransferReport',attributes,{'tableName':_0x47a5('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','./openchannelTransferReport.attributes','exports','define'];(function(_0x2ca8ff,_0x4b6b76){var _0x129a15=function(_0xffca4c){while(--_0xffca4c){_0x2ca8ff['push'](_0x2ca8ff['shift']());}};_0x129a15(++_0x4b6b76);}(_0x7a54,0x106));var _0x47a5=function(_0x575a29,_0x33a19f){_0x575a29=_0x575a29-0x0;var _0x5b5755=_0x7a54[_0x575a29];return _0x5b5755;};'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 attributes=require(_0x47a5('0x5'));module[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){return _0x2a1a7e[_0x47a5('0x7')]('OpenchannelTransferReport',attributes,{'tableName':_0x47a5('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index deb3c33..2252a10 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 _0x8456=['http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3c53cc,_0x4342ac){var _0x694962=function(_0x170424){while(--_0x170424){_0x3c53cc['push'](_0x3c53cc['shift']());}};_0x694962(++_0x4342ac);}(_0x8456,0xfd));var _0x6845=function(_0x4be8d2,_0x58423a){_0x4be8d2=_0x4be8d2-0x0;var _0x4d5ac6=_0x8456[_0x4be8d2];return _0x4d5ac6;};'use strict';var _=require(_0x6845('0x0'));var util=require(_0x6845('0x1'));var moment=require(_0x6845('0x2'));var BPromise=require('bluebird');var rs=require(_0x6845('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6845('0x4'))['db'];var utils=require(_0x6845('0x5'));var logger=require(_0x6845('0x6'))(_0x6845('0x7'));var config=require(_0x6845('0x8'));var jayson=require(_0x6845('0x9'));var client=jayson[_0x6845('0xa')][_0x6845('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x437908,_0x33cda2,_0x5b20b1){return new BPromise(function(_0x2afc29,_0x52c9ac){return client[_0x6845('0xc')](_0x437908,_0x5b20b1)[_0x6845('0xd')](function(_0x49a4b8){logger[_0x6845('0xe')](_0x6845('0xf'),_0x33cda2,_0x6845('0x10'));logger['debug'](_0x6845('0x11'),_0x33cda2,_0x6845('0x10'),JSON[_0x6845('0x12')](_0x49a4b8));if(_0x49a4b8[_0x6845('0x13')]){if(_0x49a4b8[_0x6845('0x13')][_0x6845('0x14')]===0x1f4){logger['error'](_0x6845('0xf'),_0x33cda2,_0x49a4b8[_0x6845('0x13')][_0x6845('0x15')]);return _0x52c9ac(_0x49a4b8[_0x6845('0x13')][_0x6845('0x15')]);}logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x33cda2,_0x49a4b8[_0x6845('0x13')][_0x6845('0x15')]);return _0x2afc29(_0x49a4b8[_0x6845('0x13')]['message']);}else{logger[_0x6845('0xe')](_0x6845('0xf'),_0x33cda2,_0x6845('0x10'));_0x2afc29(_0x49a4b8[_0x6845('0x16')][_0x6845('0x15')]);}})[_0x6845('0x17')](function(_0x3d6f07){logger['error'](_0x6845('0xf'),_0x33cda2,_0x3d6f07);_0x52c9ac(_0x3d6f07);});});} \ No newline at end of file +var _0xfcda=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelTransferReport,\x20%s,\x20%s','result','catch','lodash','util','bluebird','../../config/utils','../../config/logger','rpc'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0xfcda,0x198));var _0xafcd=function(_0x50bdb5,_0x48ef63){_0x50bdb5=_0x50bdb5-0x0;var _0x2c2b92=_0xfcda[_0x50bdb5];return _0x2c2b92;};'use strict';var _=require(_0xafcd('0x0'));var util=require(_0xafcd('0x1'));var moment=require('moment');var BPromise=require(_0xafcd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xafcd('0x3'));var logger=require(_0xafcd('0x4'))(_0xafcd('0x5'));var config=require(_0xafcd('0x6'));var jayson=require(_0xafcd('0x7'));var client=jayson[_0xafcd('0x8')][_0xafcd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53fb69,_0x3305d7,_0x4c1e30){return new BPromise(function(_0x3f625f,_0x3040a0){return client[_0xafcd('0xa')](_0x53fb69,_0x4c1e30)[_0xafcd('0xb')](function(_0xabe1f8){logger[_0xafcd('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3305d7,_0xafcd('0xd'));logger[_0xafcd('0xe')](_0xafcd('0xf'),_0x3305d7,_0xafcd('0xd'),JSON[_0xafcd('0x10')](_0xabe1f8));if(_0xabe1f8[_0xafcd('0x11')]){if(_0xabe1f8[_0xafcd('0x11')][_0xafcd('0x12')]===0x1f4){logger[_0xafcd('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3305d7,_0xabe1f8[_0xafcd('0x11')][_0xafcd('0x13')]);return _0x3040a0(_0xabe1f8['error'][_0xafcd('0x13')]);}logger[_0xafcd('0x11')](_0xafcd('0x14'),_0x3305d7,_0xabe1f8[_0xafcd('0x11')][_0xafcd('0x13')]);return _0x3f625f(_0xabe1f8['error']['message']);}else{logger['info'](_0xafcd('0x14'),_0x3305d7,_0xafcd('0xd'));_0x3f625f(_0xabe1f8[_0xafcd('0x15')]['message']);}})[_0xafcd('0x16')](function(_0xcca11d){logger[_0xafcd('0x11')](_0xafcd('0x14'),_0x3305d7,_0xcca11d);_0x3040a0(_0xcca11d);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index afbaeaf..3b42ae7 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 _0x3013=['post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./pause.controller','get','index','/:id','isAuthenticated','show'];(function(_0x40ce98,_0x4bbf5f){var _0x281859=function(_0x4161c5){while(--_0x4161c5){_0x40ce98['push'](_0x40ce98['shift']());}};_0x281859(++_0x4bbf5f);}(_0x3013,0xea));var _0x3301=function(_0x585c06,_0x21571b){_0x585c06=_0x585c06-0x0;var _0x58cbeb=_0x3013[_0x585c06];return _0x58cbeb;};'use strict';var multer=require(_0x3301('0x0'));var util=require(_0x3301('0x1'));var path=require(_0x3301('0x2'));var timeout=require(_0x3301('0x3'));var express=require('express');var router=express[_0x3301('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3301('0x5'));var config=require(_0x3301('0x6'));var controller=require(_0x3301('0x7'));router[_0x3301('0x8')]('/',auth['isAuthenticated'](),controller[_0x3301('0x9')]);router['get'](_0x3301('0xa'),auth[_0x3301('0xb')](),controller[_0x3301('0xc')]);router[_0x3301('0xd')]('/',auth[_0x3301('0xb')](),controller['create']);router[_0x3301('0xe')](_0x3301('0xa'),auth[_0x3301('0xb')](),controller[_0x3301('0xf')]);router[_0x3301('0x10')]('/:id',auth[_0x3301('0xb')](),controller[_0x3301('0x11')]);module[_0x3301('0x12')]=router; \ No newline at end of file +var _0x4b6c=['show','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index','get','/:id'];(function(_0x4e1953,_0x3ecb1d){var _0x224f85=function(_0x2e387c){while(--_0x2e387c){_0x4e1953['push'](_0x4e1953['shift']());}};_0x224f85(++_0x3ecb1d);}(_0x4b6c,0x14a));var _0xc4b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b6c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc4b6('0x0'));var util=require(_0xc4b6('0x1'));var path=require('path');var timeout=require(_0xc4b6('0x2'));var express=require(_0xc4b6('0x3'));var router=express[_0xc4b6('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc4b6('0x5'));var config=require(_0xc4b6('0x6'));var controller=require(_0xc4b6('0x7'));router['get']('/',auth[_0xc4b6('0x8')](),controller[_0xc4b6('0x9')]);router[_0xc4b6('0xa')](_0xc4b6('0xb'),auth['isAuthenticated'](),controller[_0xc4b6('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc4b6('0xd')]);router[_0xc4b6('0xe')](_0xc4b6('0xb'),auth[_0xc4b6('0x8')](),controller[_0xc4b6('0xf')]);router[_0xc4b6('0x10')]('/:id',auth[_0xc4b6('0x8')](),controller[_0xc4b6('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index fcc7569..cbc3bd3 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 _0x91a5=['exports','STRING','name'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x91a5,0x96));var _0x591a=function(_0x4e8286,_0x4eaeb4){_0x4e8286=_0x4e8286-0x0;var _0x44a440=_0x91a5[_0x4e8286];return _0x44a440;};'use strict';var Sequelize=require('sequelize');module[_0x591a('0x0')]={'name':{'type':Sequelize[_0x591a('0x1')],'unique':_0x591a('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x591a('0x1')]}}; \ No newline at end of file +var _0xdd26=['name','exports','STRING'];(function(_0x1d5400,_0x567e3c){var _0x21d9fe=function(_0x23fb75){while(--_0x23fb75){_0x1d5400['push'](_0x1d5400['shift']());}};_0x21d9fe(++_0x567e3c);}(_0xdd26,0x16c));var _0x6dd2=function(_0x3e1909,_0xe9786a){_0x3e1909=_0x3e1909-0x0;var _0x50ea4c=_0xdd26[_0x3e1909];return _0x50ea4c;};'use strict';var Sequelize=require('sequelize');module[_0x6dd2('0x0')]={'name':{'type':Sequelize[_0x6dd2('0x1')],'unique':_0x6dd2('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x6dd2('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 5b84013..32a0022 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 _0xa9e0=['intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','day','add','merge','filter','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','index','Pause','model','keys','query','dateStart','dateEnd','filters'];(function(_0x3a31f3,_0x3aa7b8){var _0x40dafc=function(_0x14f30f){while(--_0x14f30f){_0x3a31f3['push'](_0x3a31f3['shift']());}};_0x40dafc(++_0x3aa7b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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 qs=require(_0x0a9e('0xf'));var logger=require(_0x0a9e('0x10'))(_0x0a9e('0x11'));var utils=require(_0x0a9e('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x527cdd,_0x4cfe67){_0x4cfe67=_0x4cfe67||0xcc;return function(_0x273d4d){if(_0x273d4d){return _0x527cdd[_0x0a9e('0x13')](_0x4cfe67);}return _0x527cdd[_0x0a9e('0x14')](_0x4cfe67)[_0x0a9e('0x15')]();};}function respondWithResult(_0x32d742,_0x69aeb7){_0x69aeb7=_0x69aeb7||0xc8;return function(_0x5db4b0){if(_0x5db4b0){return _0x32d742[_0x0a9e('0x14')](_0x69aeb7)[_0x0a9e('0x16')](_0x5db4b0);}};}function respondWithFilteredResult(_0x2b4227,_0x281129){return function(_0x44dcfd){if(_0x44dcfd){var _0x4d5611=_0x44dcfd[_0x0a9e('0x17')],_0x52a03d=_0x281129['offset'],_0x22dccb=_0x281129[_0x0a9e('0x18')]+_0x281129[_0x0a9e('0x19')],_0x5d0880;if(_0x22dccb>=_0x4d5611){_0x22dccb=_0x4d5611;_0x5d0880=0xc8;}else{_0x5d0880=0xce;}_0x2b4227['status'](_0x5d0880);return _0x2b4227[_0x0a9e('0x1a')]('Content-Range',_0x52a03d+'-'+_0x22dccb+'/'+_0x4d5611)[_0x0a9e('0x16')](_0x44dcfd);}return null;};}function patchUpdates(_0x478723){return function(_0x106033){try{jsonpatch[_0x0a9e('0x1b')](_0x106033,_0x478723,!![]);}catch(_0x31b1ca){return BPromise[_0x0a9e('0x1c')](_0x31b1ca);}return _0x106033[_0x0a9e('0x1d')]();};}function saveUpdates(_0x20559e,_0x1314ae){return function(_0x112016){if(_0x112016){return _0x112016[_0x0a9e('0x1e')](_0x20559e)[_0x0a9e('0x1f')](function(_0x4bb1e3){return _0x4bb1e3;});}return null;};}function removeEntity(_0x2c3407,_0x155cce){return function(_0x53682f){if(_0x53682f){return _0x53682f[_0x0a9e('0x20')]()['then'](function(){_0x2c3407['status'](0xcc)[_0x0a9e('0x15')]();});}};}function handleEntityNotFound(_0x432e56,_0x38e7c4){return function(_0x30bae6){if(!_0x30bae6){_0x432e56['sendStatus'](0x194);}return _0x30bae6;};}function handleError(_0xfb6e48,_0x2fb0e4){_0x2fb0e4=_0x2fb0e4||0x1f4;return function(_0x3b45bc){logger[_0x0a9e('0x21')](_0x3b45bc[_0x0a9e('0x22')]);if(_0x3b45bc[_0x0a9e('0x23')]){delete _0x3b45bc[_0x0a9e('0x23')];}_0xfb6e48['status'](_0x2fb0e4)['send'](_0x3b45bc);};}exports[_0x0a9e('0x24')]=function(_0x3a8e58,_0x40c424){var _0x33161b={},_0x526cf3={},_0x384319={'count':0x0,'rows':[]};var _0x479bc4=db[_0x0a9e('0x25')]['rawAttributes'];_0x526cf3[_0x0a9e('0x26')]=_[_0x0a9e('0x27')](_0x479bc4);var _0x25fba9={'dateStart':_0x3a8e58[_0x0a9e('0x28')][_0x0a9e('0x29')],'dateEnd':_0x3a8e58[_0x0a9e('0x28')][_0x0a9e('0x2a')]};delete _0x3a8e58[_0x0a9e('0x28')]['dateStart'];delete _0x3a8e58[_0x0a9e('0x28')][_0x0a9e('0x2a')];_0x526cf3[_0x0a9e('0x28')]=_[_0x0a9e('0x27')](_0x3a8e58['query']);_0x526cf3[_0x0a9e('0x2b')]=_[_0x0a9e('0x2c')](_0x526cf3[_0x0a9e('0x26')],_0x526cf3[_0x0a9e('0x28')]);_0x33161b[_0x0a9e('0x2d')]=_[_0x0a9e('0x2c')](_0x526cf3[_0x0a9e('0x26')],qs[_0x0a9e('0x2e')](_0x3a8e58[_0x0a9e('0x28')]['fields']));_0x33161b[_0x0a9e('0x2d')]=_0x33161b['attributes'][_0x0a9e('0x2f')]?_0x33161b[_0x0a9e('0x2d')]:_0x526cf3[_0x0a9e('0x26')];if(!_0x3a8e58[_0x0a9e('0x28')][_0x0a9e('0x30')]('nolimit')){_0x33161b[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x3a8e58[_0x0a9e('0x28')][_0x0a9e('0x19')]);_0x33161b[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x3a8e58[_0x0a9e('0x28')][_0x0a9e('0x18')]);}_0x33161b['order']=qs[_0x0a9e('0x31')](_0x3a8e58['query'][_0x0a9e('0x31')]);_0x33161b[_0x0a9e('0x32')]=qs[_0x0a9e('0x2b')](_[_0x0a9e('0x33')](_0x3a8e58['query'],_0x526cf3[_0x0a9e('0x2b')]));if(_0x25fba9[_0x0a9e('0x29')]){if(_0x25fba9[_0x0a9e('0x2a')]){_0x25fba9[_0x0a9e('0x2a')]=moment(_0x25fba9['dateEnd'])['add'](0x1,_0x0a9e('0x34'));}else{_0x25fba9['dateEnd']=moment(_0x25fba9[_0x0a9e('0x29')])[_0x0a9e('0x35')](0x1,_0x0a9e('0x34'));}_[_0x0a9e('0x36')](_0x33161b['where'],{'createdAt':{'$gte':_0x25fba9[_0x0a9e('0x29')],'$lte':_0x25fba9[_0x0a9e('0x2a')]}});}if(_0x3a8e58[_0x0a9e('0x28')]['filter']){_0x33161b[_0x0a9e('0x32')]=_[_0x0a9e('0x36')](_0x33161b[_0x0a9e('0x32')],{'$or':_['map'](_0x33161b['attributes'],function(_0x11b61d){var _0x40d766={};_0x40d766[_0x11b61d]={'$like':'%'+_0x3a8e58['query'][_0x0a9e('0x37')]+'%'};return _0x40d766;})});}_0x33161b=_[_0x0a9e('0x36')]({},_0x33161b,_0x3a8e58[_0x0a9e('0x38')]);var _0x148f55={'where':_0x33161b['where']};return db['Pause'][_0x0a9e('0x17')](_0x148f55)[_0x0a9e('0x1f')](function(_0x53f3ee){_0x384319[_0x0a9e('0x17')]=_0x53f3ee;if(_0x3a8e58[_0x0a9e('0x28')][_0x0a9e('0x39')]){_0x33161b['include']=[{'all':!![]}];}return db[_0x0a9e('0x25')][_0x0a9e('0x3a')](_0x33161b);})[_0x0a9e('0x1f')](function(_0x43dd5b){_0x384319[_0x0a9e('0x3b')]=_0x43dd5b;return _0x384319;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x40c424,_0x33161b))[_0x0a9e('0x3c')](handleError(_0x40c424,null));};exports[_0x0a9e('0x3d')]=function(_0x23b089,_0x3da2cd){var _0x2c3711={'raw':!![],'where':{'id':_0x23b089[_0x0a9e('0x3e')]['id']}},_0x148007={};_0x148007[_0x0a9e('0x26')]=_[_0x0a9e('0x27')](db['Pause']['rawAttributes']);_0x148007[_0x0a9e('0x28')]=_[_0x0a9e('0x27')](_0x23b089[_0x0a9e('0x28')]);_0x148007[_0x0a9e('0x2b')]=_[_0x0a9e('0x2c')](_0x148007[_0x0a9e('0x26')],_0x148007[_0x0a9e('0x28')]);_0x2c3711[_0x0a9e('0x2d')]=_[_0x0a9e('0x2c')](_0x148007[_0x0a9e('0x26')],qs[_0x0a9e('0x2e')](_0x23b089[_0x0a9e('0x28')]['fields']));_0x2c3711[_0x0a9e('0x2d')]=_0x2c3711[_0x0a9e('0x2d')][_0x0a9e('0x2f')]?_0x2c3711[_0x0a9e('0x2d')]:_0x148007[_0x0a9e('0x26')];if(_0x23b089[_0x0a9e('0x28')][_0x0a9e('0x39')]){_0x2c3711[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x2c3711=_['merge']({},_0x2c3711,_0x23b089[_0x0a9e('0x38')]);return db['Pause'][_0x0a9e('0x40')](_0x2c3711)[_0x0a9e('0x1f')](handleEntityNotFound(_0x3da2cd,null))[_0x0a9e('0x1f')](respondWithResult(_0x3da2cd,null))['catch'](handleError(_0x3da2cd,null));};exports[_0x0a9e('0x41')]=function(_0x7f6eb1,_0x4774f4){return db[_0x0a9e('0x25')][_0x0a9e('0x41')](_0x7f6eb1[_0x0a9e('0x42')],{})[_0x0a9e('0x1f')](respondWithResult(_0x4774f4,0xc9))['catch'](handleError(_0x4774f4,null));};exports[_0x0a9e('0x1e')]=function(_0x1bde3c,_0x1b5e80){if(_0x1bde3c[_0x0a9e('0x42')]['id']){delete _0x1bde3c[_0x0a9e('0x42')]['id'];}return db[_0x0a9e('0x25')][_0x0a9e('0x40')]({'where':{'id':_0x1bde3c[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x1b5e80,null))['then'](saveUpdates(_0x1bde3c[_0x0a9e('0x42')],null))[_0x0a9e('0x1f')](respondWithResult(_0x1b5e80,null))['catch'](handleError(_0x1b5e80,null));};exports['destroy']=function(_0x5ddf84,_0x1adfee){return db[_0x0a9e('0x25')][_0x0a9e('0x40')]({'where':{'id':_0x5ddf84[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x1adfee,null))[_0x0a9e('0x1f')](removeEntity(_0x1adfee,null))[_0x0a9e('0x3c')](handleError(_0x1adfee,null));}; \ No newline at end of file +var _0xa9e0=['intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','day','add','merge','filter','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','index','Pause','model','keys','query','dateStart','dateEnd','filters'];(function(_0x99f4e4,_0x5e9985){var _0x126b54=function(_0x2667cc){while(--_0x2667cc){_0x99f4e4['push'](_0x99f4e4['shift']());}};_0x126b54(++_0x5e9985);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var qs=require(_0x0a9e('0xf'));var logger=require(_0x0a9e('0x10'))(_0x0a9e('0x11'));var utils=require(_0x0a9e('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x527cdd,_0x4cfe67){_0x4cfe67=_0x4cfe67||0xcc;return function(_0x273d4d){if(_0x273d4d){return _0x527cdd[_0x0a9e('0x13')](_0x4cfe67);}return _0x527cdd[_0x0a9e('0x14')](_0x4cfe67)[_0x0a9e('0x15')]();};}function respondWithResult(_0x32d742,_0x69aeb7){_0x69aeb7=_0x69aeb7||0xc8;return function(_0x5db4b0){if(_0x5db4b0){return _0x32d742[_0x0a9e('0x14')](_0x69aeb7)[_0x0a9e('0x16')](_0x5db4b0);}};}function respondWithFilteredResult(_0x2b4227,_0x281129){return function(_0x44dcfd){if(_0x44dcfd){var _0x4d5611=_0x44dcfd[_0x0a9e('0x17')],_0x52a03d=_0x281129['offset'],_0x22dccb=_0x281129[_0x0a9e('0x18')]+_0x281129[_0x0a9e('0x19')],_0x5d0880;if(_0x22dccb>=_0x4d5611){_0x22dccb=_0x4d5611;_0x5d0880=0xc8;}else{_0x5d0880=0xce;}_0x2b4227['status'](_0x5d0880);return _0x2b4227[_0x0a9e('0x1a')]('Content-Range',_0x52a03d+'-'+_0x22dccb+'/'+_0x4d5611)[_0x0a9e('0x16')](_0x44dcfd);}return null;};}function patchUpdates(_0x478723){return function(_0x106033){try{jsonpatch[_0x0a9e('0x1b')](_0x106033,_0x478723,!![]);}catch(_0x31b1ca){return BPromise[_0x0a9e('0x1c')](_0x31b1ca);}return _0x106033[_0x0a9e('0x1d')]();};}function saveUpdates(_0x20559e,_0x1314ae){return function(_0x112016){if(_0x112016){return _0x112016[_0x0a9e('0x1e')](_0x20559e)[_0x0a9e('0x1f')](function(_0x4bb1e3){return _0x4bb1e3;});}return null;};}function removeEntity(_0x2c3407,_0x155cce){return function(_0x53682f){if(_0x53682f){return _0x53682f[_0x0a9e('0x20')]()['then'](function(){_0x2c3407['status'](0xcc)[_0x0a9e('0x15')]();});}};}function handleEntityNotFound(_0x432e56,_0x38e7c4){return function(_0x30bae6){if(!_0x30bae6){_0x432e56['sendStatus'](0x194);}return _0x30bae6;};}function handleError(_0xfb6e48,_0x2fb0e4){_0x2fb0e4=_0x2fb0e4||0x1f4;return function(_0x3b45bc){logger[_0x0a9e('0x21')](_0x3b45bc[_0x0a9e('0x22')]);if(_0x3b45bc[_0x0a9e('0x23')]){delete _0x3b45bc[_0x0a9e('0x23')];}_0xfb6e48['status'](_0x2fb0e4)['send'](_0x3b45bc);};}exports[_0x0a9e('0x24')]=function(_0x3a8e58,_0x40c424){var _0x33161b={},_0x526cf3={},_0x384319={'count':0x0,'rows':[]};var _0x479bc4=db[_0x0a9e('0x25')]['rawAttributes'];_0x526cf3[_0x0a9e('0x26')]=_[_0x0a9e('0x27')](_0x479bc4);var _0x25fba9={'dateStart':_0x3a8e58[_0x0a9e('0x28')][_0x0a9e('0x29')],'dateEnd':_0x3a8e58[_0x0a9e('0x28')][_0x0a9e('0x2a')]};delete _0x3a8e58[_0x0a9e('0x28')]['dateStart'];delete _0x3a8e58[_0x0a9e('0x28')][_0x0a9e('0x2a')];_0x526cf3[_0x0a9e('0x28')]=_[_0x0a9e('0x27')](_0x3a8e58['query']);_0x526cf3[_0x0a9e('0x2b')]=_[_0x0a9e('0x2c')](_0x526cf3[_0x0a9e('0x26')],_0x526cf3[_0x0a9e('0x28')]);_0x33161b[_0x0a9e('0x2d')]=_[_0x0a9e('0x2c')](_0x526cf3[_0x0a9e('0x26')],qs[_0x0a9e('0x2e')](_0x3a8e58[_0x0a9e('0x28')]['fields']));_0x33161b[_0x0a9e('0x2d')]=_0x33161b['attributes'][_0x0a9e('0x2f')]?_0x33161b[_0x0a9e('0x2d')]:_0x526cf3[_0x0a9e('0x26')];if(!_0x3a8e58[_0x0a9e('0x28')][_0x0a9e('0x30')]('nolimit')){_0x33161b[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x3a8e58[_0x0a9e('0x28')][_0x0a9e('0x19')]);_0x33161b[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x3a8e58[_0x0a9e('0x28')][_0x0a9e('0x18')]);}_0x33161b['order']=qs[_0x0a9e('0x31')](_0x3a8e58['query'][_0x0a9e('0x31')]);_0x33161b[_0x0a9e('0x32')]=qs[_0x0a9e('0x2b')](_[_0x0a9e('0x33')](_0x3a8e58['query'],_0x526cf3[_0x0a9e('0x2b')]));if(_0x25fba9[_0x0a9e('0x29')]){if(_0x25fba9[_0x0a9e('0x2a')]){_0x25fba9[_0x0a9e('0x2a')]=moment(_0x25fba9['dateEnd'])['add'](0x1,_0x0a9e('0x34'));}else{_0x25fba9['dateEnd']=moment(_0x25fba9[_0x0a9e('0x29')])[_0x0a9e('0x35')](0x1,_0x0a9e('0x34'));}_[_0x0a9e('0x36')](_0x33161b['where'],{'createdAt':{'$gte':_0x25fba9[_0x0a9e('0x29')],'$lte':_0x25fba9[_0x0a9e('0x2a')]}});}if(_0x3a8e58[_0x0a9e('0x28')]['filter']){_0x33161b[_0x0a9e('0x32')]=_[_0x0a9e('0x36')](_0x33161b[_0x0a9e('0x32')],{'$or':_['map'](_0x33161b['attributes'],function(_0x11b61d){var _0x40d766={};_0x40d766[_0x11b61d]={'$like':'%'+_0x3a8e58['query'][_0x0a9e('0x37')]+'%'};return _0x40d766;})});}_0x33161b=_[_0x0a9e('0x36')]({},_0x33161b,_0x3a8e58[_0x0a9e('0x38')]);var _0x148f55={'where':_0x33161b['where']};return db['Pause'][_0x0a9e('0x17')](_0x148f55)[_0x0a9e('0x1f')](function(_0x53f3ee){_0x384319[_0x0a9e('0x17')]=_0x53f3ee;if(_0x3a8e58[_0x0a9e('0x28')][_0x0a9e('0x39')]){_0x33161b['include']=[{'all':!![]}];}return db[_0x0a9e('0x25')][_0x0a9e('0x3a')](_0x33161b);})[_0x0a9e('0x1f')](function(_0x43dd5b){_0x384319[_0x0a9e('0x3b')]=_0x43dd5b;return _0x384319;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x40c424,_0x33161b))[_0x0a9e('0x3c')](handleError(_0x40c424,null));};exports[_0x0a9e('0x3d')]=function(_0x23b089,_0x3da2cd){var _0x2c3711={'raw':!![],'where':{'id':_0x23b089[_0x0a9e('0x3e')]['id']}},_0x148007={};_0x148007[_0x0a9e('0x26')]=_[_0x0a9e('0x27')](db['Pause']['rawAttributes']);_0x148007[_0x0a9e('0x28')]=_[_0x0a9e('0x27')](_0x23b089[_0x0a9e('0x28')]);_0x148007[_0x0a9e('0x2b')]=_[_0x0a9e('0x2c')](_0x148007[_0x0a9e('0x26')],_0x148007[_0x0a9e('0x28')]);_0x2c3711[_0x0a9e('0x2d')]=_[_0x0a9e('0x2c')](_0x148007[_0x0a9e('0x26')],qs[_0x0a9e('0x2e')](_0x23b089[_0x0a9e('0x28')]['fields']));_0x2c3711[_0x0a9e('0x2d')]=_0x2c3711[_0x0a9e('0x2d')][_0x0a9e('0x2f')]?_0x2c3711[_0x0a9e('0x2d')]:_0x148007[_0x0a9e('0x26')];if(_0x23b089[_0x0a9e('0x28')][_0x0a9e('0x39')]){_0x2c3711[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x2c3711=_['merge']({},_0x2c3711,_0x23b089[_0x0a9e('0x38')]);return db['Pause'][_0x0a9e('0x40')](_0x2c3711)[_0x0a9e('0x1f')](handleEntityNotFound(_0x3da2cd,null))[_0x0a9e('0x1f')](respondWithResult(_0x3da2cd,null))['catch'](handleError(_0x3da2cd,null));};exports[_0x0a9e('0x41')]=function(_0x7f6eb1,_0x4774f4){return db[_0x0a9e('0x25')][_0x0a9e('0x41')](_0x7f6eb1[_0x0a9e('0x42')],{})[_0x0a9e('0x1f')](respondWithResult(_0x4774f4,0xc9))['catch'](handleError(_0x4774f4,null));};exports[_0x0a9e('0x1e')]=function(_0x1bde3c,_0x1b5e80){if(_0x1bde3c[_0x0a9e('0x42')]['id']){delete _0x1bde3c[_0x0a9e('0x42')]['id'];}return db[_0x0a9e('0x25')][_0x0a9e('0x40')]({'where':{'id':_0x1bde3c[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x1b5e80,null))['then'](saveUpdates(_0x1bde3c[_0x0a9e('0x42')],null))[_0x0a9e('0x1f')](respondWithResult(_0x1b5e80,null))['catch'](handleError(_0x1b5e80,null));};exports['destroy']=function(_0x5ddf84,_0x1adfee){return db[_0x0a9e('0x25')][_0x0a9e('0x40')]({'where':{'id':_0x5ddf84[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x1adfee,null))[_0x0a9e('0x1f')](removeEntity(_0x1adfee,null))[_0x0a9e('0x3c')](handleError(_0x1adfee,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index f7c2341..6bba605 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 _0x23db=['../../config/logger','moment','exports','define','Pause'];(function(_0x1d90ca,_0x3bab16){var _0x28872b=function(_0x3ea71b){while(--_0x3ea71b){_0x1d90ca['push'](_0x1d90ca['shift']());}};_0x28872b(++_0x3bab16);}(_0x23db,0x122));var _0xb23d=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x23db[_0x4b2863];return _0x567d67;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb23d('0x0'))('api');var moment=require(_0xb23d('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./pause.attributes');module[_0xb23d('0x2')]=function(_0x32f40b,_0x5a0347){return _0x32f40b[_0xb23d('0x3')](_0xb23d('0x4'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x563f=['bluebird','./pause.attributes','exports','Pause','tools_pauses','../../config/logger','moment'];(function(_0x9f51be,_0x5823ac){var _0x165f24=function(_0x41b881){while(--_0x41b881){_0x9f51be['push'](_0x9f51be['shift']());}};_0x165f24(++_0x5823ac);}(_0x563f,0x11d));var _0xf563=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x563f[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf563('0x0'))('api');var moment=require(_0xf563('0x1'));var BPromise=require(_0xf563('0x2'));var rp=require('request-promise');var attributes=require(_0xf563('0x3'));module[_0xf563('0x4')]=function(_0x40a8e1,_0x1c4e2d){return _0x40a8e1['define'](_0xf563('0x5'),attributes,{'tableName':_0xf563('0x6'),'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 e8fc45a..9ece0e8 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 _0xa9be=['code','message','result','catch','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xa9be,0x1eb));var _0xea9b=function(_0x201d42,_0x3f3c49){_0x201d42=_0x201d42-0x0;var _0x2080b0=_0xa9be[_0x201d42];return _0x2080b0;};'use strict';var _=require(_0xea9b('0x0'));var util=require(_0xea9b('0x1'));var moment=require(_0xea9b('0x2'));var BPromise=require(_0xea9b('0x3'));var rs=require(_0xea9b('0x4'));var fs=require('fs');var Redis=require(_0xea9b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xea9b('0x6'));var logger=require(_0xea9b('0x7'))(_0xea9b('0x8'));var config=require(_0xea9b('0x9'));var jayson=require(_0xea9b('0xa'));var client=jayson[_0xea9b('0xb')][_0xea9b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4f1c0e,_0x10e567,_0x1197c1){return new BPromise(function(_0x4f513f,_0x156dfb){return client['request'](_0x4f1c0e,_0x1197c1)[_0xea9b('0xd')](function(_0x2bacbc){logger[_0xea9b('0xe')](_0xea9b('0xf'),_0x10e567,_0xea9b('0x10'));logger[_0xea9b('0x11')]('Pause,\x20%s,\x20%s,\x20%s',_0x10e567,_0xea9b('0x10'),JSON['stringify'](_0x2bacbc));if(_0x2bacbc[_0xea9b('0x12')]){if(_0x2bacbc[_0xea9b('0x12')][_0xea9b('0x13')]===0x1f4){logger[_0xea9b('0x12')](_0xea9b('0xf'),_0x10e567,_0x2bacbc[_0xea9b('0x12')]['message']);return _0x156dfb(_0x2bacbc[_0xea9b('0x12')][_0xea9b('0x14')]);}logger[_0xea9b('0x12')](_0xea9b('0xf'),_0x10e567,_0x2bacbc[_0xea9b('0x12')][_0xea9b('0x14')]);return _0x4f513f(_0x2bacbc['error'][_0xea9b('0x14')]);}else{logger[_0xea9b('0xe')](_0xea9b('0xf'),_0x10e567,'request\x20sent');_0x4f513f(_0x2bacbc[_0xea9b('0x15')][_0xea9b('0x14')]);}})[_0xea9b('0x16')](function(_0x1c2dd8){logger[_0xea9b('0x12')](_0xea9b('0xf'),_0x10e567,_0x1c2dd8);_0x156dfb(_0x1c2dd8);});});}exports[_0xea9b('0x17')]=function(_0x1de758){var _0x49dd19=this;return new Promise(function(_0x4c1b81,_0xc033e0){return db[_0xea9b('0x18')][_0xea9b('0x19')]({'raw':_0x1de758[_0xea9b('0x1a')]?_0x1de758[_0xea9b('0x1a')][_0xea9b('0x1b')]===undefined?!![]:![]:!![],'where':_0x1de758['options']?_0x1de758['options'][_0xea9b('0x1c')]||null:null,'attributes':_0x1de758[_0xea9b('0x1a')]?_0x1de758[_0xea9b('0x1a')][_0xea9b('0x1d')]||null:null,'include':_0x1de758[_0xea9b('0x1a')]?_0x1de758[_0xea9b('0x1a')]['include']?_[_0xea9b('0x1e')](_0x1de758['options'][_0xea9b('0x1f')],function(_0x41904e){return{'model':db[_0x41904e[_0xea9b('0x20')]],'as':_0x41904e['as'],'attributes':_0x41904e[_0xea9b('0x1d')],'include':_0x41904e[_0xea9b('0x1f')]?_['map'](_0x41904e['include'],function(_0x3fb675){return{'model':db[_0x3fb675[_0xea9b('0x20')]],'as':_0x3fb675['as'],'attributes':_0x3fb675[_0xea9b('0x1d')],'include':_0x3fb675['include']?_['map'](_0x3fb675[_0xea9b('0x1f')],function(_0x3f6e3a){return{'model':db[_0x3f6e3a[_0xea9b('0x20')]],'as':_0x3f6e3a['as'],'attributes':_0x3f6e3a[_0xea9b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xea9b('0xd')](function(_0xddfae0){logger[_0xea9b('0xe')](_0xea9b('0x17'),_0x1de758);logger[_0xea9b('0x11')](_0xea9b('0x17'),_0x1de758,JSON[_0xea9b('0x21')](_0xddfae0));_0x4c1b81(_0xddfae0);})[_0xea9b('0x16')](function(_0x3973be){logger[_0xea9b('0x12')]('ShowPause',_0x3973be[_0xea9b('0x14')],_0x1de758);_0xc033e0(_0x49dd19[_0xea9b('0x12')](0x1f4,_0x3973be[_0xea9b('0x14')]));});});}; \ No newline at end of file +var _0x3d10=['map','include','model','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','Pause,\x20%s,\x20%s','message','result','catch','ShowPause','options','raw','where','attributes'];(function(_0x5dac60,_0x2a3533){var _0x4ffd5c=function(_0x101189){while(--_0x101189){_0x5dac60['push'](_0x5dac60['shift']());}};_0x4ffd5c(++_0x2a3533);}(_0x3d10,0x7b));var _0x03d1=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x3d10[_0x58e469];return _0x4c01c5;};'use strict';var _=require(_0x03d1('0x0'));var util=require('util');var moment=require(_0x03d1('0x1'));var BPromise=require('bluebird');var rs=require(_0x03d1('0x2'));var fs=require('fs');var Redis=require(_0x03d1('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x03d1('0x4'))(_0x03d1('0x5'));var config=require(_0x03d1('0x6'));var jayson=require(_0x03d1('0x7'));var client=jayson['client'][_0x03d1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x351980,_0x51513a,_0x5a9f05){return new BPromise(function(_0xd8505,_0x3bf30f){return client[_0x03d1('0x9')](_0x351980,_0x5a9f05)[_0x03d1('0xa')](function(_0x17b5c2){logger[_0x03d1('0xb')]('Pause,\x20%s,\x20%s',_0x51513a,_0x03d1('0xc'));logger[_0x03d1('0xd')](_0x03d1('0xe'),_0x51513a,_0x03d1('0xc'),JSON[_0x03d1('0xf')](_0x17b5c2));if(_0x17b5c2[_0x03d1('0x10')]){if(_0x17b5c2['error'][_0x03d1('0x11')]===0x1f4){logger[_0x03d1('0x10')](_0x03d1('0x12'),_0x51513a,_0x17b5c2[_0x03d1('0x10')]['message']);return _0x3bf30f(_0x17b5c2[_0x03d1('0x10')][_0x03d1('0x13')]);}logger['error'](_0x03d1('0x12'),_0x51513a,_0x17b5c2[_0x03d1('0x10')][_0x03d1('0x13')]);return _0xd8505(_0x17b5c2[_0x03d1('0x10')][_0x03d1('0x13')]);}else{logger[_0x03d1('0xb')](_0x03d1('0x12'),_0x51513a,_0x03d1('0xc'));_0xd8505(_0x17b5c2[_0x03d1('0x14')][_0x03d1('0x13')]);}})[_0x03d1('0x15')](function(_0x4c29ea){logger[_0x03d1('0x10')]('Pause,\x20%s,\x20%s',_0x51513a,_0x4c29ea);_0x3bf30f(_0x4c29ea);});});}exports[_0x03d1('0x16')]=function(_0x2952b5){var _0x540fad=this;return new Promise(function(_0x259ef6,_0x19ef11){return db['Pause']['find']({'raw':_0x2952b5[_0x03d1('0x17')]?_0x2952b5[_0x03d1('0x17')][_0x03d1('0x18')]===undefined?!![]:![]:!![],'where':_0x2952b5[_0x03d1('0x17')]?_0x2952b5['options'][_0x03d1('0x19')]||null:null,'attributes':_0x2952b5[_0x03d1('0x17')]?_0x2952b5[_0x03d1('0x17')][_0x03d1('0x1a')]||null:null,'include':_0x2952b5[_0x03d1('0x17')]?_0x2952b5[_0x03d1('0x17')]['include']?_[_0x03d1('0x1b')](_0x2952b5[_0x03d1('0x17')][_0x03d1('0x1c')],function(_0x43699a){return{'model':db[_0x43699a[_0x03d1('0x1d')]],'as':_0x43699a['as'],'attributes':_0x43699a[_0x03d1('0x1a')],'include':_0x43699a[_0x03d1('0x1c')]?_[_0x03d1('0x1b')](_0x43699a[_0x03d1('0x1c')],function(_0x150f80){return{'model':db[_0x150f80[_0x03d1('0x1d')]],'as':_0x150f80['as'],'attributes':_0x150f80[_0x03d1('0x1a')],'include':_0x150f80[_0x03d1('0x1c')]?_['map'](_0x150f80[_0x03d1('0x1c')],function(_0x44c820){return{'model':db[_0x44c820[_0x03d1('0x1d')]],'as':_0x44c820['as'],'attributes':_0x44c820['attributes']};}):[]};}):[]};}):[]:[]})[_0x03d1('0xa')](function(_0x29a36d){logger[_0x03d1('0xb')]('ShowPause',_0x2952b5);logger['debug'](_0x03d1('0x16'),_0x2952b5,JSON[_0x03d1('0xf')](_0x29a36d));_0x259ef6(_0x29a36d);})['catch'](function(_0xe5fce4){logger[_0x03d1('0x10')]('ShowPause',_0xe5fce4[_0x03d1('0x13')],_0x2952b5);_0x19ef11(_0x540fad[_0x03d1('0x10')](0x1f4,_0xe5fce4[_0x03d1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index dc776c5..e4b9679 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 _0xdb04=['/webhook','webhookGet','/:id','isAuthenticated','download','join','root','server/files/plugins','originalname','format','basename','extname','single','upload','post','put','update','delete','exports','util','path','express','Router','../../components/interaction/service','./plugin.controller','index','get'];(function(_0x51ffec,_0x26605e){var _0xcb30ff=function(_0x519a08){while(--_0x519a08){_0x51ffec['push'](_0x51ffec['shift']());}};_0xcb30ff(++_0x26605e);}(_0xdb04,0x1a8));var _0x4db0=function(_0x12129e,_0x564b2f){_0x12129e=_0x12129e-0x0;var _0x350d43=_0xdb04[_0x12129e];return _0x350d43;};'use strict';var multer=require('multer');var util=require(_0x4db0('0x0'));var path=require(_0x4db0('0x1'));var timeout=require('connect-timeout');var express=require(_0x4db0('0x2'));var router=express[_0x4db0('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4db0('0x4'));var config=require('../../config/environment');var controller=require(_0x4db0('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x4db0('0x6')]);router[_0x4db0('0x7')](_0x4db0('0x8'),controller[_0x4db0('0x9')]);router['get'](_0x4db0('0xa'),auth[_0x4db0('0xb')](),controller['show']);router[_0x4db0('0x7')]('/:id/download',auth[_0x4db0('0xb')](),controller[_0x4db0('0xc')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1ef011,_0x55e8f1,_0x58b8df){_0x58b8df(null,path[_0x4db0('0xd')](config[_0x4db0('0xe')],_0x4db0('0xf')));},'filename':function(_0x156504,_0x571405,_0x52139a){_0x571405['originalname']=_0x571405[_0x4db0('0x10')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x52139a(null,util[_0x4db0('0x11')]('%s-%s%s',path[_0x4db0('0x12')](_0x571405[_0x4db0('0x10')],path[_0x4db0('0x13')](_0x571405[_0x4db0('0x10')])),Date['now'](),path[_0x4db0('0x13')](_0x571405['originalname'])));}})});router['post']('/',upload[_0x4db0('0x14')]('file'),controller[_0x4db0('0x15')]);router[_0x4db0('0x16')](_0x4db0('0x8'),controller['webhookPost']);router[_0x4db0('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x4db0('0x18')]);router[_0x4db0('0x19')](_0x4db0('0xa'),auth['isAuthenticated'](),controller[_0x4db0('0x19')]);module[_0x4db0('0x1a')]=router; \ No newline at end of file +var _0x8f7d=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/webhook','webhookGet','download','diskStorage','join','server/files/plugins','originalname','format','basename','extname','now','post','single','file','upload','put','update','exports','multer','path'];(function(_0xd2bb42,_0x1e5dd3){var _0x193f65=function(_0x430d85){while(--_0x430d85){_0xd2bb42['push'](_0xd2bb42['shift']());}};_0x193f65(++_0x1e5dd3);}(_0x8f7d,0x150));var _0xd8f7=function(_0x1d0d0c,_0x9e73){_0x1d0d0c=_0x1d0d0c-0x0;var _0x16368f=_0x8f7d[_0x1d0d0c];return _0x16368f;};'use strict';var multer=require(_0xd8f7('0x0'));var util=require('util');var path=require(_0xd8f7('0x1'));var timeout=require(_0xd8f7('0x2'));var express=require('express');var router=express[_0xd8f7('0x3')]();var auth=require(_0xd8f7('0x4'));var interaction=require(_0xd8f7('0x5'));var config=require(_0xd8f7('0x6'));var controller=require('./plugin.controller');router['get']('/',auth[_0xd8f7('0x7')](),controller['index']);router['get'](_0xd8f7('0x8'),controller[_0xd8f7('0x9')]);router['get']('/:id',auth[_0xd8f7('0x7')](),controller['show']);router['get']('/:id/download',auth[_0xd8f7('0x7')](),controller[_0xd8f7('0xa')]);var upload=multer({'storage':multer[_0xd8f7('0xb')]({'destination':function(_0x43ed19,_0x2925c5,_0x45f8bd){_0x45f8bd(null,path[_0xd8f7('0xc')](config['root'],_0xd8f7('0xd')));},'filename':function(_0x54ac9b,_0x1254bb,_0xd2e488){_0x1254bb[_0xd8f7('0xe')]=_0x1254bb[_0xd8f7('0xe')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xd2e488(null,util[_0xd8f7('0xf')]('%s-%s%s',path[_0xd8f7('0x10')](_0x1254bb[_0xd8f7('0xe')],path[_0xd8f7('0x11')](_0x1254bb[_0xd8f7('0xe')])),Date[_0xd8f7('0x12')](),path[_0xd8f7('0x11')](_0x1254bb['originalname'])));}})});router[_0xd8f7('0x13')]('/',upload[_0xd8f7('0x14')](_0xd8f7('0x15')),controller[_0xd8f7('0x16')]);router[_0xd8f7('0x13')](_0xd8f7('0x8'),controller['webhookPost']);router[_0xd8f7('0x17')]('/:id',auth[_0xd8f7('0x7')](),controller[_0xd8f7('0x18')]);router['delete']('/:id',auth[_0xd8f7('0x7')](),controller['delete']);module[_0xd8f7('0x19')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 3b7b15a..9acc3d2 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 _0x4f68=['STRING','html','TEXT','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','agentOnly','never','always','exports'];(function(_0x25e803,_0x3070ed){var _0x44fd23=function(_0x42d4d3){while(--_0x42d4d3){_0x25e803['push'](_0x25e803['shift']());}};_0x44fd23(++_0x3070ed);}(_0x4f68,0x98));var _0x84f6=function(_0x2139e1,_0x4bc18b){_0x2139e1=_0x2139e1-0x0;var _0x25d4a6=_0x4f68[_0x2139e1];return _0x25d4a6;};'use strict';var Sequelize=require('sequelize');module[_0x84f6('0x0')]={'name':{'type':Sequelize[_0x84f6('0x1')]},'type':{'type':Sequelize['ENUM'](_0x84f6('0x2'),'script')},'description':{'type':Sequelize[_0x84f6('0x3')]},'version':{'type':Sequelize[_0x84f6('0x3')]},'path':{'type':Sequelize[_0x84f6('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x84f6('0x4')},'sidebar':{'type':Sequelize[_0x84f6('0x5')]('adminOnly',_0x84f6('0x6'),'always',_0x84f6('0x7')),'defaultValue':_0x84f6('0x8'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x84f6('0x1')]},'adminUrl':{'type':Sequelize[_0x84f6('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x84f6('0x1')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x40ab=['BOOLEAN','adminOnly','always','sequelize','exports','ENUM','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x40ab,0xe9));var _0xb40a=function(_0x3b30e5,_0x22175b){_0x3b30e5=_0x3b30e5-0x0;var _0x5c6ab1=_0x40ab[_0x3b30e5];return _0x5c6ab1;};'use strict';var Sequelize=require(_0xb40a('0x0'));module[_0xb40a('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb40a('0x2')]('html',_0xb40a('0x3'))},'description':{'type':Sequelize[_0xb40a('0x4')]},'version':{'type':Sequelize[_0xb40a('0x4')]},'path':{'type':Sequelize[_0xb40a('0x5')],'comment':_0xb40a('0x6')},'active':{'type':Sequelize[_0xb40a('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0xb40a('0x2')](_0xb40a('0x8'),'agentOnly',_0xb40a('0x9'),'never'),'defaultValue':_0xb40a('0x9'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0xb40a('0x5')]},'adminUrl':{'type':Sequelize[_0xb40a('0x5')]},'agentUrl':{'type':Sequelize[_0xb40a('0x5')]},'scriptName':{'type':Sequelize[_0xb40a('0x5')]},'scriptPath':{'type':Sequelize[_0xb40a('0x5')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 6499518..b0091cb 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 _0x5d31=['scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','Extracted\x20folder\x20removed','update','body','webhookGet','resolve','hostname','port','encoding','method','%s%s','headers','set','endsWith','sendStatus','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','archiver','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','status','offset','limit','Content-Range','json','apply','save','then','destroy','end','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','count','includeAll','include','findAll','rows','catch','Plugin','find','download','params','join','server/files/plugins','format','basename','createWriteStream','zip','warning','ENOENT','error','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','%s.zip','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','upload','file','filename','extname','root','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','manifest.json','readFileSync','undefined','Invalid\x20manifest:\x20name\x20missing','type','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','html','views','Invalid\x20manifest:\x20views\x20missing','admin','parameters','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x5d31,0xb7));var _0x15d3=function(_0x1d606e,_0x438c6a){_0x1d606e=_0x1d606e-0x0;var _0x528543=_0x5d31[_0x1d606e];return _0x528543;};'use strict';var pdf=require(_0x15d3('0x0'));var emlformat=require(_0x15d3('0x1'));var rimraf=require(_0x15d3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x15d3('0x3'));var rp=require(_0x15d3('0x4'));var moment=require('moment');var BPromise=require(_0x15d3('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x15d3('0x6'));var sox=require(_0x15d3('0x7'));var csv=require(_0x15d3('0x8'));var ejs=require(_0x15d3('0x9'));var fs=require('fs');var _=require(_0x15d3('0xa'));var squel=require(_0x15d3('0xb'));var crypto=require('crypto');var jsforce=require(_0x15d3('0xc'));var deskjs=require(_0x15d3('0xd'));var toCsv=require(_0x15d3('0x8'));var querystring=require('querystring');var Papa=require(_0x15d3('0xe'));var Redis=require('ioredis');var extract=require('extract-zip');var rimraf=require(_0x15d3('0x2'));var archiver=require(_0x15d3('0xf'));var qs=require(_0x15d3('0x10'));var logger=require(_0x15d3('0x11'))(_0x15d3('0x12'));var utils=require(_0x15d3('0x13'));var config=require(_0x15d3('0x14'));var db=require('../../mysqldb')['db'];config[_0x15d3('0x15')]=_[_0x15d3('0x16')](config[_0x15d3('0x15')],{'host':_0x15d3('0x17'),'port':0x18eb});var socket=require(_0x15d3('0x18'))(new Redis(config[_0x15d3('0x15')]));require('./plugin.socket')[_0x15d3('0x19')](socket);function respondWithStatusCode(_0x3ce80d,_0x466f82){_0x466f82=_0x466f82||0xcc;return function(_0x4b2f4a){if(_0x4b2f4a){return _0x3ce80d['sendStatus'](_0x466f82);}return _0x3ce80d[_0x15d3('0x1a')](_0x466f82)['end']();};}function respondWithResult(_0x514875,_0xcbfd71){_0xcbfd71=_0xcbfd71||0xc8;return function(_0x382154){if(_0x382154){return _0x514875[_0x15d3('0x1a')](_0xcbfd71)['json'](_0x382154);}};}function respondWithFilteredResult(_0x11180e,_0x121692){return function(_0x25a67e){if(_0x25a67e){var _0x42940f=_0x25a67e['count'],_0x389bd5=_0x121692[_0x15d3('0x1b')],_0x1778fd=_0x121692[_0x15d3('0x1b')]+_0x121692[_0x15d3('0x1c')],_0xc3474d;if(_0x1778fd>=_0x42940f){_0x1778fd=_0x42940f;_0xc3474d=0xc8;}else{_0xc3474d=0xce;}_0x11180e['status'](_0xc3474d);return _0x11180e['set'](_0x15d3('0x1d'),_0x389bd5+'-'+_0x1778fd+'/'+_0x42940f)[_0x15d3('0x1e')](_0x25a67e);}return null;};}function patchUpdates(_0x1d251e){return function(_0x3d4f31){try{jsonpatch[_0x15d3('0x1f')](_0x3d4f31,_0x1d251e,!![]);}catch(_0x57b3ec){return BPromise['reject'](_0x57b3ec);}return _0x3d4f31[_0x15d3('0x20')]();};}function saveUpdates(_0x7c9603,_0x28af7b){return function(_0x445192){if(_0x445192){return _0x445192['update'](_0x7c9603)[_0x15d3('0x21')](function(_0x9eb2b5){return _0x9eb2b5;});}return null;};}function removeEntity(_0x10ae1b,_0x5178e1){return function(_0x1e3fd9){if(_0x1e3fd9){return _0x1e3fd9[_0x15d3('0x22')]()[_0x15d3('0x21')](function(){_0x10ae1b[_0x15d3('0x1a')](0xcc)[_0x15d3('0x23')]();});}};}function handleEntityNotFound(_0x6baf8c,_0x2a3e77){return function(_0x43351a){if(!_0x43351a){_0x6baf8c['sendStatus'](0x194);}return _0x43351a;};}function handleError(_0x5d939c,_0x4ee291){_0x4ee291=_0x4ee291||0x1f4;return function(_0x3c2d05){logger['error'](_0x3c2d05['stack']);if(_0x3c2d05[_0x15d3('0x24')]){delete _0x3c2d05['name'];}_0x5d939c[_0x15d3('0x1a')](_0x4ee291)[_0x15d3('0x25')](_0x3c2d05);};}exports[_0x15d3('0x26')]=function(_0x4a4505,_0x181f56){var _0x2f39bb={},_0x590646={},_0x3ee31e={'count':0x0,'rows':[]};var _0x26329f=db['Plugin'][_0x15d3('0x27')];_0x590646[_0x15d3('0x28')]=_[_0x15d3('0x29')](_0x26329f);var _0x48f790={'dateStart':_0x4a4505[_0x15d3('0x2a')][_0x15d3('0x2b')],'dateEnd':_0x4a4505[_0x15d3('0x2a')]['dateEnd']};delete _0x4a4505[_0x15d3('0x2a')][_0x15d3('0x2b')];delete _0x4a4505[_0x15d3('0x2a')][_0x15d3('0x2c')];_0x590646[_0x15d3('0x2a')]=_[_0x15d3('0x29')](_0x4a4505['query']);_0x590646[_0x15d3('0x2d')]=_[_0x15d3('0x2e')](_0x590646['model'],_0x590646[_0x15d3('0x2a')]);_0x2f39bb[_0x15d3('0x2f')]=_[_0x15d3('0x2e')](_0x590646[_0x15d3('0x28')],qs[_0x15d3('0x30')](_0x4a4505['query'][_0x15d3('0x30')]));_0x2f39bb[_0x15d3('0x2f')]=_0x2f39bb[_0x15d3('0x2f')][_0x15d3('0x31')]?_0x2f39bb[_0x15d3('0x2f')]:_0x590646['model'];if(!_0x4a4505[_0x15d3('0x2a')][_0x15d3('0x32')](_0x15d3('0x33'))){_0x2f39bb[_0x15d3('0x1c')]=qs[_0x15d3('0x1c')](_0x4a4505[_0x15d3('0x2a')]['limit']);_0x2f39bb[_0x15d3('0x1b')]=qs['offset'](_0x4a4505[_0x15d3('0x2a')][_0x15d3('0x1b')]);}_0x2f39bb[_0x15d3('0x34')]=qs[_0x15d3('0x35')](_0x4a4505[_0x15d3('0x2a')][_0x15d3('0x35')]);_0x2f39bb[_0x15d3('0x36')]=qs[_0x15d3('0x2d')](_[_0x15d3('0x37')](_0x4a4505[_0x15d3('0x2a')],_0x590646['filters']));if(_0x48f790['dateStart']){if(_0x48f790[_0x15d3('0x2c')]){_0x48f790[_0x15d3('0x2c')]=moment(_0x48f790['dateEnd'])[_0x15d3('0x38')](0x1,_0x15d3('0x39'));}else{_0x48f790[_0x15d3('0x2c')]=moment(_0x48f790[_0x15d3('0x2b')])['add'](0x1,_0x15d3('0x39'));}_[_0x15d3('0x3a')](_0x2f39bb[_0x15d3('0x36')],{'createdAt':{'$gte':_0x48f790[_0x15d3('0x2b')],'$lte':_0x48f790[_0x15d3('0x2c')]}});}if(_0x4a4505[_0x15d3('0x2a')][_0x15d3('0x3b')]){_0x2f39bb[_0x15d3('0x36')]=_['merge'](_0x2f39bb[_0x15d3('0x36')],{'$or':_[_0x15d3('0x3c')](_0x2f39bb[_0x15d3('0x2f')],function(_0x2f3a16){var _0x1d7647={};_0x1d7647[_0x2f3a16]={'$like':'%'+_0x4a4505['query'][_0x15d3('0x3b')]+'%'};return _0x1d7647;})});}_0x2f39bb=_[_0x15d3('0x3a')]({},_0x2f39bb,_0x4a4505[_0x15d3('0x3d')]);var _0x16cea3={'where':_0x2f39bb[_0x15d3('0x36')]};return db['Plugin'][_0x15d3('0x3e')](_0x16cea3)[_0x15d3('0x21')](function(_0x409ebb){_0x3ee31e[_0x15d3('0x3e')]=_0x409ebb;if(_0x4a4505[_0x15d3('0x2a')][_0x15d3('0x3f')]){_0x2f39bb[_0x15d3('0x40')]=[{'all':!![]}];}return db['Plugin'][_0x15d3('0x41')](_0x2f39bb);})[_0x15d3('0x21')](function(_0x2386fa){_0x3ee31e[_0x15d3('0x42')]=_0x2386fa;return _0x3ee31e;})[_0x15d3('0x21')](respondWithFilteredResult(_0x181f56,_0x2f39bb))[_0x15d3('0x43')](handleError(_0x181f56,null));};exports['show']=function(_0x4204a0,_0x5a2d23){var _0x2ac0ad={'raw':!![],'where':{'id':_0x4204a0['params']['id']}},_0x56e47a={};_0x56e47a[_0x15d3('0x28')]=_[_0x15d3('0x29')](db[_0x15d3('0x44')]['rawAttributes']);_0x56e47a[_0x15d3('0x2a')]=_[_0x15d3('0x29')](_0x4204a0[_0x15d3('0x2a')]);_0x56e47a[_0x15d3('0x2d')]=_[_0x15d3('0x2e')](_0x56e47a['model'],_0x56e47a[_0x15d3('0x2a')]);_0x2ac0ad[_0x15d3('0x2f')]=_[_0x15d3('0x2e')](_0x56e47a[_0x15d3('0x28')],qs[_0x15d3('0x30')](_0x4204a0['query'][_0x15d3('0x30')]));_0x2ac0ad[_0x15d3('0x2f')]=_0x2ac0ad[_0x15d3('0x2f')][_0x15d3('0x31')]?_0x2ac0ad[_0x15d3('0x2f')]:_0x56e47a['model'];if(_0x4204a0[_0x15d3('0x2a')][_0x15d3('0x3f')]){_0x2ac0ad[_0x15d3('0x40')]=[{'all':!![]}];}_0x2ac0ad=_[_0x15d3('0x3a')]({},_0x2ac0ad,_0x4204a0[_0x15d3('0x3d')]);return db[_0x15d3('0x44')][_0x15d3('0x45')](_0x2ac0ad)[_0x15d3('0x21')](handleEntityNotFound(_0x5a2d23,null))[_0x15d3('0x21')](respondWithResult(_0x5a2d23,null))[_0x15d3('0x43')](handleError(_0x5a2d23,null));};exports[_0x15d3('0x46')]=function(_0x1d697f,_0x419d16,_0xccf4db){return db[_0x15d3('0x44')][_0x15d3('0x45')]({'where':{'id':_0x1d697f[_0x15d3('0x47')]['id']},'attributes':[_0x15d3('0x24'),_0x15d3('0x6')],'raw':!![]})[_0x15d3('0x21')](handleEntityNotFound(_0x419d16,null))['then'](function(_0x4cb9af){if(_0x4cb9af){var _0x3d4ad1=path[_0x15d3('0x48')](config['root'],_0x15d3('0x49'),util[_0x15d3('0x4a')]('%s.zip',path[_0x15d3('0x4b')](_0x4cb9af['path'])));var _0x294275=fs[_0x15d3('0x4c')](_0x3d4ad1);var _0x4b08f7=archiver(_0x15d3('0x4d'),{'zlib':{'level':0x9}});_0x4b08f7['on'](_0x15d3('0x4e'),function(_0x52144d){if(_0x52144d['code']===_0x15d3('0x4f')){logger[_0x15d3('0x50')](_0x52144d);}else{throw new db['Sequelize'][(_0x15d3('0x51'))](_0x15d3('0x52'));}});_0x4b08f7['on']('error',function(_0x323766){throw new db[(_0x15d3('0x53'))]['Error'](_0x15d3('0x52'));});_0x4b08f7[_0x15d3('0x54')](_0x294275);_0x4b08f7[_0x15d3('0x55')](_0x15d3('0x56'),{'cwd':path[_0x15d3('0x48')](config['root'],_0x15d3('0x49'),path[_0x15d3('0x57')](_0x4cb9af[_0x15d3('0x6')])),'ignore':[path[_0x15d3('0x48')](path['basename'](_0x4cb9af[_0x15d3('0x6')]),_0x15d3('0x58')),path[_0x15d3('0x48')](path[_0x15d3('0x4b')](_0x4cb9af['path']),_0x15d3('0x59'))],'nodir':!![]})[_0x15d3('0x5a')]();_0x294275['on']('close',function(){if(!fs[_0x15d3('0x5b')](_0x3d4ad1)){throw new db[(_0x15d3('0x53'))][(_0x15d3('0x51'))](_0x15d3('0x5c'));}return _0x419d16['download'](_0x3d4ad1,util[_0x15d3('0x4a')](_0x15d3('0x5d'),path[_0x15d3('0x4b')](_0x4cb9af[_0x15d3('0x6')])),function(_0x294bc8){if(_0x294bc8){throw new db['Sequelize'][(_0x15d3('0x51'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x15d3('0x5e')](_0x3d4ad1);logger['info'](_0x15d3('0x5f'));logger[_0x15d3('0x60')](_0x15d3('0x61'));});});}return null;})[_0x15d3('0x43')](handleError(_0x419d16,null));};exports[_0x15d3('0x62')]=function(_0x332960,_0x19b21e,_0x45251d){var _0x285cdc=path[_0x15d3('0x4b')](_0x332960[_0x15d3('0x63')][_0x15d3('0x64')],path[_0x15d3('0x65')](_0x332960[_0x15d3('0x63')][_0x15d3('0x64')]));var _0x23b48e=path[_0x15d3('0x48')](config['root'],_0x15d3('0x49'),_0x332960[_0x15d3('0x63')][_0x15d3('0x64')]);var _0x38d0a1=path['join'](config[_0x15d3('0x66')],_0x15d3('0x49'),_0x285cdc);logger[_0x15d3('0x60')](_0x15d3('0x67'),_0x23b48e);logger[_0x15d3('0x60')]('Plugin\x20upload\x20destination:\x20%s',_0x38d0a1);try{fs[_0x15d3('0x68')](_0x23b48e,parseInt(_0x15d3('0x69'),0x8));extract(_0x23b48e,{'dir':_0x38d0a1},function(_0x2beb3f){if(_0x2beb3f){logger['error'](_0x2beb3f);handleError(_0x2beb3f,!![]);};var _0x2e3890=fs[_0x15d3('0x6a')](_0x38d0a1);if(_0x2e3890['length']>0x1){removeReferences(_0x23b48e,_0x38d0a1);logger[_0x15d3('0x50')](_0x15d3('0x6b'));return _0x45251d(new Error(_0x15d3('0x6b')));}var _0x43ba8d=fs[_0x15d3('0x6c')](path[_0x15d3('0x48')](_0x38d0a1,_0x2e3890[0x0]));if(_0x43ba8d['isFile']()){removeReferences(_0x23b48e,_0x38d0a1);logger['error'](_0x15d3('0x6b'));return _0x45251d(new Error('Invalid\x20plugin\x20structure'));}if(_0x43ba8d[_0x15d3('0x6d')]()){var _0x2a6957=fs[_0x15d3('0x6a')](path[_0x15d3('0x48')](_0x38d0a1,_0x2e3890[0x0]));if(_0x2a6957[_0x15d3('0x31')]===0x0){removeReferences(_0x23b48e,_0x38d0a1);logger[_0x15d3('0x50')]('Invalid\x20plugin\x20structure');return _0x45251d(new Error(_0x15d3('0x6b')));}var _0x406d8e=_0x2a6957['some'](function(_0x52dee9){return _0x52dee9===_0x15d3('0x6e');});if(!_0x406d8e){return _0x45251d(new Error('Plugin\x20manifest\x20missing'));}var _0x2663c7=fs[_0x15d3('0x6f')](path['join'](_0x38d0a1,_0x2e3890[0x0],'manifest.json'));var _0x823f7c=JSON['parse'](_0x2663c7);if(_0x15d3('0x70')==typeof _0x823f7c[_0x15d3('0x24')]){return _0x45251d(new Error(_0x15d3('0x71')));}if(_0x15d3('0x70')==typeof _0x823f7c[_0x15d3('0x72')]){return _0x45251d(new Error(_0x15d3('0x73')));}if(_0x15d3('0x70')==typeof _0x823f7c['version']){return _0x45251d(new Error(_0x15d3('0x74')));}if(_0x15d3('0x70')==typeof _0x823f7c['parameters']){return _0x45251d(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x823f7c[_0x15d3('0x72')]===_0x15d3('0x75')){if(_0x15d3('0x70')==typeof _0x823f7c['parameters'][_0x15d3('0x76')]){return _0x45251d(new Error(_0x15d3('0x77')));}if('undefined'==typeof _0x823f7c['parameters'][_0x15d3('0x76')][_0x15d3('0x78')]&&_0x15d3('0x70')==typeof _0x823f7c[_0x15d3('0x79')][_0x15d3('0x76')][_0x15d3('0x7a')]){return _0x45251d(new Error(_0x15d3('0x7b')));}}else if(_0x823f7c[_0x15d3('0x72')]===_0x15d3('0x7c')){if(_0x15d3('0x70')==typeof _0x823f7c[_0x15d3('0x79')][_0x15d3('0x7d')]){return _0x45251d(new Error(_0x15d3('0x7e')));}if(_0x15d3('0x70')==typeof _0x823f7c[_0x15d3('0x79')][_0x15d3('0x7f')]){return _0x45251d(new Error(_0x15d3('0x80')));}}else{return _0x45251d(new Error(_0x15d3('0x81')));}var _0x50328c=_0x823f7c[_0x15d3('0x24')];var _0x90a19f=_0x823f7c[_0x15d3('0x82')];var _0x3a55ef=_0x823f7c[_0x15d3('0x72')];var _0x1924d8=_0x823f7c['sidebar']?_0x823f7c[_0x15d3('0x83')]:'always';var _0x374ce4=_0x823f7c['icon']?_0x823f7c['icon']:_0x15d3('0x84');var _0x1df536='';var _0x3d0c3b='';var _0x5df28e='';var _0x41cf84='';var _0x2ded39=_0x823f7c['version'];if(_0x3a55ef===_0x15d3('0x75')){if(_0x15d3('0x70')!=typeof _0x823f7c[_0x15d3('0x79')]['views']['admin']){var _0x4d0516=_0x823f7c[_0x15d3('0x79')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x15d3('0x85')](_0x4d0516)){_0x1df536=path[_0x15d3('0x48')](_0x15d3('0x86'),_0x285cdc,_0x2e3890[0x0],_0x4d0516);}else{_0x1df536=_0x4d0516;}}else{logger[_0x15d3('0x60')](_0x15d3('0x87'));}if(_0x15d3('0x70')!=typeof _0x823f7c['parameters'][_0x15d3('0x76')][_0x15d3('0x7a')]){var _0x3fc67d=_0x823f7c[_0x15d3('0x79')][_0x15d3('0x76')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x15d3('0x85')](_0x3fc67d)){_0x3d0c3b=path[_0x15d3('0x48')]('plugins',_0x285cdc,_0x2e3890[0x0],_0x3fc67d);}else{_0x3d0c3b=_0x3fc67d;}}else{logger[_0x15d3('0x60')](_0x15d3('0x88'));}}else if(_0x3a55ef===_0x15d3('0x7c')){_0x5df28e=_0x823f7c[_0x15d3('0x79')][_0x15d3('0x7d')];_0x41cf84=_0x823f7c[_0x15d3('0x79')][_0x15d3('0x7f')];if(_0x15d3('0x70')!=typeof _0x823f7c[_0x15d3('0x79')]['views']){if(_0x15d3('0x70')!=typeof _0x823f7c[_0x15d3('0x79')]['views']['admin']){var _0x4d0516=_0x823f7c[_0x15d3('0x79')]['views'][_0x15d3('0x78')];if(!/^(f|ht)tps?:\/\//i[_0x15d3('0x85')](_0x4d0516)){_0x1df536=path['join'](_0x15d3('0x86'),_0x285cdc,_0x2e3890[0x0],_0x4d0516);}else{_0x1df536=_0x4d0516;}}if('undefined'!=typeof _0x823f7c[_0x15d3('0x79')][_0x15d3('0x76')][_0x15d3('0x7a')]){var _0x3fc67d=_0x823f7c[_0x15d3('0x79')][_0x15d3('0x76')][_0x15d3('0x7a')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3fc67d)){_0x3d0c3b=path[_0x15d3('0x48')](_0x15d3('0x86'),_0x285cdc,_0x2e3890[0x0],_0x3fc67d);}else{_0x3d0c3b=_0x3fc67d;}}}}var _0x2d069d={'name':_0x50328c,'description':_0x90a19f,'path':path[_0x15d3('0x48')](_0x285cdc,_0x2e3890[0x0]),'type':_0x3a55ef,'sidebar':_0x1924d8,'icon':_0x374ce4,'adminUrl':_0x1df536,'agentUrl':_0x3d0c3b,'scriptName':_0x5df28e,'scriptPath':_0x41cf84,'version':_0x2ded39};removeReferences(_0x23b48e,null);return db['Plugin']['create'](_0x2d069d)[_0x15d3('0x21')](respondWithResult(_0x19b21e,null))[_0x15d3('0x43')](handleError(_0x19b21e,null));}});}catch(_0x1fa243){_0x19b21e[_0x15d3('0x1a')](0x1f4)['send'](_0x1fa243);}};function removeReferences(_0x100b9c,_0x460a95){try{if(_0x100b9c){fs[_0x15d3('0x5e')](_0x100b9c);logger['info']('Zip\x20archive\x20removed');}if(_0x460a95){rimraf(_0x460a95,function(){});logger[_0x15d3('0x60')](_0x15d3('0x89'));}}catch(_0x58e913){logger[_0x15d3('0x50')](_0x58e913);}}exports[_0x15d3('0x8a')]=function(_0x57282b,_0xfcad0b,_0x3d63bd){return db[_0x15d3('0x44')][_0x15d3('0x45')]({'where':{'id':_0x57282b[_0x15d3('0x47')]['id']}})[_0x15d3('0x21')](handleEntityNotFound(_0xfcad0b,null))[_0x15d3('0x21')](saveUpdates(_0x57282b[_0x15d3('0x8b')],null))[_0x15d3('0x21')](respondWithResult(_0xfcad0b,null))[_0x15d3('0x43')](handleError(_0xfcad0b,null));};exports['delete']=function(_0x47134d,_0x79591a,_0x20142f){return db[_0x15d3('0x44')][_0x15d3('0x45')]({'where':{'id':_0x47134d[_0x15d3('0x47')]['id']}})['then'](function(_0xb0a993){if(_0xb0a993){return _0xb0a993[_0x15d3('0x22')]();}})[_0x15d3('0x21')](function(_0x3b8b72){rimraf(path['join'](config[_0x15d3('0x66')],_0x15d3('0x49'),path[_0x15d3('0x57')](_0x3b8b72['path'])),function(){});return _0x3b8b72;})[_0x15d3('0x21')](handleEntityNotFound(_0x79591a,null))[_0x15d3('0x21')](respondWithStatusCode(_0x79591a,null))['catch'](handleError(_0x79591a,null));};exports[_0x15d3('0x8c')]=function(_0x2f9f3a,_0x5ee711,_0xc13e4b){return BPromise[_0x15d3('0x8d')]()[_0x15d3('0x21')](function(){if(!_0x2f9f3a[_0x15d3('0x2a')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x2f9f3a[_0x15d3('0x2a')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x3e170a=_0x2f9f3a[_0x15d3('0x2a')][_0x15d3('0x8e')]?_0x2f9f3a[_0x15d3('0x2a')]['hostname']+':'+_0x2f9f3a[_0x15d3('0x2a')][_0x15d3('0x8f')]:'http://localhost:'+_0x2f9f3a[_0x15d3('0x2a')][_0x15d3('0x8f')];var _0x4855eb=_0x2f9f3a[_0x15d3('0x2a')][_0x15d3('0x1e')]?_0x2f9f3a['query'][_0x15d3('0x1e')]:!![];var _0x2c547e=_0x2f9f3a[_0x15d3('0x2a')][_0x15d3('0x90')]?_0x2f9f3a['query'][_0x15d3('0x90')]:null;var _0x3e1ee4={'method':_0x2f9f3a[_0x15d3('0x91')],'uri':util['format'](_0x15d3('0x92'),_0x3e170a,_0x2f9f3a[_0x15d3('0x2a')][_0x15d3('0x6')]),'json':_0x4855eb,'resolveWithFullResponse':!![],'encoding':_0x2c547e,'qs':_0x2f9f3a[_0x15d3('0x2a')]};if(_0x2f9f3a[_0x15d3('0x93')]){_0x3e1ee4[_0x15d3('0x93')]=_0x2f9f3a['headers'];}return rp(_0x3e1ee4);})[_0x15d3('0x21')](function(_0xdead0){if(_0xdead0){_0x5ee711[_0x15d3('0x94')](_0xdead0[_0x15d3('0x93')]);logger[_0x15d3('0x60')](_0xdead0[_0x15d3('0x8b')]);if(_[_0x15d3('0x95')](_0x2f9f3a['query'][_0x15d3('0x6')],_0x15d3('0x46'))&&_0xdead0['statusCode']==0x1f4){return _0x5ee711[_0x15d3('0x96')](_0xdead0[_0x15d3('0x97')]);}else{return _0x5ee711[_0x15d3('0x1a')](_0xdead0[_0x15d3('0x97')])[_0x15d3('0x25')](_0xdead0['body']);}}else{return _0x5ee711[_0x15d3('0x96')](0xc8);}})[_0x15d3('0x43')](handleError(_0x5ee711,null));};exports[_0x15d3('0x98')]=function(_0x379cd0,_0x32f945,_0x25f56d){return BPromise[_0x15d3('0x8d')]()[_0x15d3('0x21')](function(){if(!_0x379cd0[_0x15d3('0x2a')][_0x15d3('0x6')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x379cd0['query'][_0x15d3('0x8f')]){throw new Error(_0x15d3('0x99'));}var _0x30b033=_0x379cd0['query'][_0x15d3('0x8e')]?_0x379cd0[_0x15d3('0x2a')][_0x15d3('0x8e')]+':'+_0x379cd0[_0x15d3('0x2a')][_0x15d3('0x8f')]:_0x15d3('0x9a')+_0x379cd0[_0x15d3('0x2a')]['port'];var _0x3c37a1=_0x379cd0[_0x15d3('0x2a')][_0x15d3('0x1e')]?_0x379cd0[_0x15d3('0x2a')][_0x15d3('0x1e')]:!![];var _0x779af8=_0x379cd0[_0x15d3('0x2a')][_0x15d3('0x90')]?_0x379cd0[_0x15d3('0x2a')]['encoding']:null;var _0x593a48={'method':_0x379cd0[_0x15d3('0x91')],'uri':util[_0x15d3('0x4a')](_0x15d3('0x92'),_0x30b033,_0x379cd0[_0x15d3('0x2a')][_0x15d3('0x6')]),'json':_0x3c37a1,'resolveWithFullResponse':!![],'encoding':_0x779af8,'body':_0x379cd0[_0x15d3('0x8b')]};if(_0x379cd0['headers']){_0x593a48[_0x15d3('0x93')]=_0x379cd0[_0x15d3('0x93')];}return rp(_0x593a48);})[_0x15d3('0x21')](function(_0x2833c0){if(_0x2833c0){_0x32f945[_0x15d3('0x94')](_0x2833c0[_0x15d3('0x93')]);logger['info'](_0x2833c0[_0x15d3('0x8b')]);return _0x32f945['status'](_0x2833c0[_0x15d3('0x97')])[_0x15d3('0x25')](_0x2833c0[_0x15d3('0x8b')]);}else{return _0x32f945[_0x15d3('0x96')](0xc8);}})[_0x15d3('0x43')](handleError(_0x32f945,null));}; \ No newline at end of file +var _0x688a=['../../config/environment','redis','localhost','register','sendStatus','end','status','json','offset','apply','reject','save','update','then','destroy','error','stack','name','send','index','Plugin','rawAttributes','model','dateStart','dateEnd','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','add','day','merge','filter','options','count','includeAll','include','findAll','rows','catch','show','params','filters','find','join','server/files/plugins','basename','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','root','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','download','format','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','Temporary\x20file\x20removed','upload','filename','extname','file','info','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','type','undefined','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','body','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','set','endsWith','statusCode','webhookPost','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','ioredis','archiver','../../components/parsers/qs','../../config/logger','api','../../config/utils'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x688a,0x124));var _0xa688=function(_0x1f60fe,_0x56a12a){_0x1f60fe=_0x1f60fe-0x0;var _0x419741=_0x688a[_0x1f60fe];return _0x419741;};'use strict';var pdf=require(_0xa688('0x0'));var emlformat=require(_0xa688('0x1'));var rimraf=require(_0xa688('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa688('0x3'));var rp=require('request-promise');var moment=require(_0xa688('0x4'));var BPromise=require(_0xa688('0x5'));var Mustache=require('mustache');var util=require(_0xa688('0x6'));var path=require(_0xa688('0x7'));var sox=require(_0xa688('0x8'));var csv=require(_0xa688('0x9'));var ejs=require(_0xa688('0xa'));var fs=require('fs');var _=require(_0xa688('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa688('0xc'));var deskjs=require(_0xa688('0xd'));var toCsv=require(_0xa688('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa688('0xe'));var extract=require('extract-zip');var rimraf=require('rimraf');var archiver=require(_0xa688('0xf'));var qs=require(_0xa688('0x10'));var logger=require(_0xa688('0x11'))(_0xa688('0x12'));var utils=require(_0xa688('0x13'));var config=require(_0xa688('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xa688('0x15')],{'host':_0xa688('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa688('0x15')]));require('./plugin.socket')[_0xa688('0x17')](socket);function respondWithStatusCode(_0x43159e,_0x506fca){_0x506fca=_0x506fca||0xcc;return function(_0x5b3caf){if(_0x5b3caf){return _0x43159e[_0xa688('0x18')](_0x506fca);}return _0x43159e['status'](_0x506fca)[_0xa688('0x19')]();};}function respondWithResult(_0x5b8b1f,_0xe776d6){_0xe776d6=_0xe776d6||0xc8;return function(_0x1e7ad3){if(_0x1e7ad3){return _0x5b8b1f[_0xa688('0x1a')](_0xe776d6)[_0xa688('0x1b')](_0x1e7ad3);}};}function respondWithFilteredResult(_0x7d2f27,_0x10fc2d){return function(_0x5715cb){if(_0x5715cb){var _0x59e392=_0x5715cb['count'],_0x14ca3c=_0x10fc2d[_0xa688('0x1c')],_0x1330d5=_0x10fc2d[_0xa688('0x1c')]+_0x10fc2d['limit'],_0x5dc07f;if(_0x1330d5>=_0x59e392){_0x1330d5=_0x59e392;_0x5dc07f=0xc8;}else{_0x5dc07f=0xce;}_0x7d2f27[_0xa688('0x1a')](_0x5dc07f);return _0x7d2f27['set']('Content-Range',_0x14ca3c+'-'+_0x1330d5+'/'+_0x59e392)[_0xa688('0x1b')](_0x5715cb);}return null;};}function patchUpdates(_0x466ae3){return function(_0xf36560){try{jsonpatch[_0xa688('0x1d')](_0xf36560,_0x466ae3,!![]);}catch(_0xcccd78){return BPromise[_0xa688('0x1e')](_0xcccd78);}return _0xf36560[_0xa688('0x1f')]();};}function saveUpdates(_0x203214,_0x2a9f67){return function(_0x1a7bf2){if(_0x1a7bf2){return _0x1a7bf2[_0xa688('0x20')](_0x203214)[_0xa688('0x21')](function(_0x42643){return _0x42643;});}return null;};}function removeEntity(_0x11133b,_0x48cb17){return function(_0x442672){if(_0x442672){return _0x442672[_0xa688('0x22')]()['then'](function(){_0x11133b[_0xa688('0x1a')](0xcc)[_0xa688('0x19')]();});}};}function handleEntityNotFound(_0x53eec6,_0x2898cb){return function(_0x3b09c9){if(!_0x3b09c9){_0x53eec6[_0xa688('0x18')](0x194);}return _0x3b09c9;};}function handleError(_0x25d1fa,_0x153a86){_0x153a86=_0x153a86||0x1f4;return function(_0x4072e4){logger[_0xa688('0x23')](_0x4072e4[_0xa688('0x24')]);if(_0x4072e4[_0xa688('0x25')]){delete _0x4072e4[_0xa688('0x25')];}_0x25d1fa[_0xa688('0x1a')](_0x153a86)[_0xa688('0x26')](_0x4072e4);};}exports[_0xa688('0x27')]=function(_0x12a35a,_0x1d4cfa){var _0x5d1657={},_0x217a35={},_0x1bdd8e={'count':0x0,'rows':[]};var _0x1a8d72=db[_0xa688('0x28')][_0xa688('0x29')];_0x217a35[_0xa688('0x2a')]=_['keys'](_0x1a8d72);var _0x5b0527={'dateStart':_0x12a35a['query'][_0xa688('0x2b')],'dateEnd':_0x12a35a['query'][_0xa688('0x2c')]};delete _0x12a35a[_0xa688('0x2d')][_0xa688('0x2b')];delete _0x12a35a[_0xa688('0x2d')][_0xa688('0x2c')];_0x217a35[_0xa688('0x2d')]=_[_0xa688('0x2e')](_0x12a35a['query']);_0x217a35['filters']=_['intersection'](_0x217a35['model'],_0x217a35[_0xa688('0x2d')]);_0x5d1657[_0xa688('0x2f')]=_[_0xa688('0x30')](_0x217a35['model'],qs[_0xa688('0x31')](_0x12a35a['query']['fields']));_0x5d1657['attributes']=_0x5d1657[_0xa688('0x2f')][_0xa688('0x32')]?_0x5d1657[_0xa688('0x2f')]:_0x217a35['model'];if(!_0x12a35a['query'][_0xa688('0x33')](_0xa688('0x34'))){_0x5d1657[_0xa688('0x35')]=qs[_0xa688('0x35')](_0x12a35a[_0xa688('0x2d')]['limit']);_0x5d1657['offset']=qs[_0xa688('0x1c')](_0x12a35a['query'][_0xa688('0x1c')]);}_0x5d1657[_0xa688('0x36')]=qs[_0xa688('0x37')](_0x12a35a[_0xa688('0x2d')]['sort']);_0x5d1657[_0xa688('0x38')]=qs['filters'](_['pick'](_0x12a35a[_0xa688('0x2d')],_0x217a35['filters']));if(_0x5b0527[_0xa688('0x2b')]){if(_0x5b0527['dateEnd']){_0x5b0527[_0xa688('0x2c')]=moment(_0x5b0527[_0xa688('0x2c')])[_0xa688('0x39')](0x1,'day');}else{_0x5b0527[_0xa688('0x2c')]=moment(_0x5b0527[_0xa688('0x2b')])[_0xa688('0x39')](0x1,_0xa688('0x3a'));}_[_0xa688('0x3b')](_0x5d1657[_0xa688('0x38')],{'createdAt':{'$gte':_0x5b0527[_0xa688('0x2b')],'$lte':_0x5b0527[_0xa688('0x2c')]}});}if(_0x12a35a[_0xa688('0x2d')][_0xa688('0x3c')]){_0x5d1657[_0xa688('0x38')]=_['merge'](_0x5d1657[_0xa688('0x38')],{'$or':_['map'](_0x5d1657[_0xa688('0x2f')],function(_0x394d70){var _0x1b901d={};_0x1b901d[_0x394d70]={'$like':'%'+_0x12a35a[_0xa688('0x2d')]['filter']+'%'};return _0x1b901d;})});}_0x5d1657=_[_0xa688('0x3b')]({},_0x5d1657,_0x12a35a[_0xa688('0x3d')]);var _0x4b3bbd={'where':_0x5d1657[_0xa688('0x38')]};return db[_0xa688('0x28')][_0xa688('0x3e')](_0x4b3bbd)[_0xa688('0x21')](function(_0x3205d4){_0x1bdd8e[_0xa688('0x3e')]=_0x3205d4;if(_0x12a35a[_0xa688('0x2d')][_0xa688('0x3f')]){_0x5d1657[_0xa688('0x40')]=[{'all':!![]}];}return db['Plugin'][_0xa688('0x41')](_0x5d1657);})[_0xa688('0x21')](function(_0x4475b5){_0x1bdd8e[_0xa688('0x42')]=_0x4475b5;return _0x1bdd8e;})[_0xa688('0x21')](respondWithFilteredResult(_0x1d4cfa,_0x5d1657))[_0xa688('0x43')](handleError(_0x1d4cfa,null));};exports[_0xa688('0x44')]=function(_0x328799,_0x52e48f){var _0x25b2eb={'raw':!![],'where':{'id':_0x328799[_0xa688('0x45')]['id']}},_0x23f07d={};_0x23f07d[_0xa688('0x2a')]=_['keys'](db[_0xa688('0x28')][_0xa688('0x29')]);_0x23f07d['query']=_[_0xa688('0x2e')](_0x328799[_0xa688('0x2d')]);_0x23f07d[_0xa688('0x46')]=_[_0xa688('0x30')](_0x23f07d[_0xa688('0x2a')],_0x23f07d[_0xa688('0x2d')]);_0x25b2eb['attributes']=_[_0xa688('0x30')](_0x23f07d[_0xa688('0x2a')],qs[_0xa688('0x31')](_0x328799[_0xa688('0x2d')][_0xa688('0x31')]));_0x25b2eb['attributes']=_0x25b2eb[_0xa688('0x2f')][_0xa688('0x32')]?_0x25b2eb[_0xa688('0x2f')]:_0x23f07d[_0xa688('0x2a')];if(_0x328799[_0xa688('0x2d')][_0xa688('0x3f')]){_0x25b2eb['include']=[{'all':!![]}];}_0x25b2eb=_[_0xa688('0x3b')]({},_0x25b2eb,_0x328799[_0xa688('0x3d')]);return db[_0xa688('0x28')][_0xa688('0x47')](_0x25b2eb)[_0xa688('0x21')](handleEntityNotFound(_0x52e48f,null))[_0xa688('0x21')](respondWithResult(_0x52e48f,null))[_0xa688('0x43')](handleError(_0x52e48f,null));};exports['download']=function(_0x1e1d1d,_0x1e8758,_0x296a7d){return db[_0xa688('0x28')]['find']({'where':{'id':_0x1e1d1d[_0xa688('0x45')]['id']},'attributes':[_0xa688('0x25'),_0xa688('0x7')],'raw':!![]})[_0xa688('0x21')](handleEntityNotFound(_0x1e8758,null))[_0xa688('0x21')](function(_0x3f34f2){if(_0x3f34f2){var _0x59172b=path[_0xa688('0x48')](config['root'],_0xa688('0x49'),util['format']('%s.zip',path[_0xa688('0x4a')](_0x3f34f2[_0xa688('0x7')])));var _0x8fa54e=fs['createWriteStream'](_0x59172b);var _0x4381a4=archiver('zip',{'zlib':{'level':0x9}});_0x4381a4['on']('warning',function(_0x522947){if(_0x522947['code']==='ENOENT'){logger[_0xa688('0x23')](_0x522947);}else{throw new db[(_0xa688('0x4b'))][(_0xa688('0x4c'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x4381a4['on'](_0xa688('0x23'),function(_0x50ab09){throw new db[(_0xa688('0x4b'))][(_0xa688('0x4c'))](_0xa688('0x4d'));});_0x4381a4[_0xa688('0x4e')](_0x8fa54e);_0x4381a4[_0xa688('0x4f')](_0xa688('0x50'),{'cwd':path[_0xa688('0x48')](config[_0xa688('0x51')],_0xa688('0x49'),path[_0xa688('0x52')](_0x3f34f2['path'])),'ignore':[path['join'](path['basename'](_0x3f34f2[_0xa688('0x7')]),_0xa688('0x53')),path[_0xa688('0x48')](path[_0xa688('0x4a')](_0x3f34f2[_0xa688('0x7')]),_0xa688('0x54'))],'nodir':!![]})[_0xa688('0x55')]();_0x8fa54e['on'](_0xa688('0x56'),function(){if(!fs[_0xa688('0x57')](_0x59172b)){throw new db[(_0xa688('0x4b'))][(_0xa688('0x4c'))](_0xa688('0x58'));}return _0x1e8758[_0xa688('0x59')](_0x59172b,util[_0xa688('0x5a')](_0xa688('0x5b'),path['basename'](_0x3f34f2['path'])),function(_0x2068cb){if(_0x2068cb){throw new db['Sequelize']['Error'](_0xa688('0x5c'));}fs[_0xa688('0x5d')](_0x59172b);logger['info'](_0xa688('0x5e'));logger['info'](_0xa688('0x5f'));});});}return null;})['catch'](handleError(_0x1e8758,null));};exports[_0xa688('0x60')]=function(_0x47bd3d,_0x218b5e,_0x1b52a4){var _0x1acd66=path[_0xa688('0x4a')](_0x47bd3d['file'][_0xa688('0x61')],path[_0xa688('0x62')](_0x47bd3d[_0xa688('0x63')][_0xa688('0x61')]));var _0x47dd33=path[_0xa688('0x48')](config[_0xa688('0x51')],'server/files/plugins',_0x47bd3d['file'][_0xa688('0x61')]);var _0x20fed9=path[_0xa688('0x48')](config[_0xa688('0x51')],_0xa688('0x49'),_0x1acd66);logger[_0xa688('0x64')](_0xa688('0x65'),_0x47dd33);logger[_0xa688('0x64')]('Plugin\x20upload\x20destination:\x20%s',_0x20fed9);try{fs[_0xa688('0x66')](_0x47dd33,parseInt(_0xa688('0x67'),0x8));extract(_0x47dd33,{'dir':_0x20fed9},function(_0x2db732){if(_0x2db732){logger['error'](_0x2db732);handleError(_0x2db732,!![]);};var _0x2eb14e=fs[_0xa688('0x68')](_0x20fed9);if(_0x2eb14e[_0xa688('0x32')]>0x1){removeReferences(_0x47dd33,_0x20fed9);logger[_0xa688('0x23')](_0xa688('0x69'));return _0x1b52a4(new Error(_0xa688('0x69')));}var _0x520228=fs[_0xa688('0x6a')](path['join'](_0x20fed9,_0x2eb14e[0x0]));if(_0x520228[_0xa688('0x6b')]()){removeReferences(_0x47dd33,_0x20fed9);logger[_0xa688('0x23')](_0xa688('0x69'));return _0x1b52a4(new Error(_0xa688('0x69')));}if(_0x520228['isDirectory']()){var _0x242639=fs[_0xa688('0x68')](path[_0xa688('0x48')](_0x20fed9,_0x2eb14e[0x0]));if(_0x242639['length']===0x0){removeReferences(_0x47dd33,_0x20fed9);logger[_0xa688('0x23')]('Invalid\x20plugin\x20structure');return _0x1b52a4(new Error(_0xa688('0x69')));}var _0x73cde3=_0x242639[_0xa688('0x6c')](function(_0x486210){return _0x486210===_0xa688('0x6d');});if(!_0x73cde3){return _0x1b52a4(new Error(_0xa688('0x6e')));}var _0x40eac9=fs[_0xa688('0x6f')](path[_0xa688('0x48')](_0x20fed9,_0x2eb14e[0x0],_0xa688('0x6d')));var _0x1cdde3=JSON['parse'](_0x40eac9);if('undefined'==typeof _0x1cdde3['name']){return _0x1b52a4(new Error(_0xa688('0x70')));}if('undefined'==typeof _0x1cdde3[_0xa688('0x71')]){return _0x1b52a4(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xa688('0x72')==typeof _0x1cdde3[_0xa688('0x73')]){return _0x1b52a4(new Error(_0xa688('0x74')));}if(_0xa688('0x72')==typeof _0x1cdde3[_0xa688('0x75')]){return _0x1b52a4(new Error(_0xa688('0x76')));}if(_0x1cdde3[_0xa688('0x71')]===_0xa688('0x77')){if(_0xa688('0x72')==typeof _0x1cdde3['parameters'][_0xa688('0x78')]){return _0x1b52a4(new Error(_0xa688('0x79')));}if('undefined'==typeof _0x1cdde3['parameters'][_0xa688('0x78')][_0xa688('0x7a')]&&'undefined'==typeof _0x1cdde3[_0xa688('0x75')][_0xa688('0x78')][_0xa688('0x7b')]){return _0x1b52a4(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x1cdde3['type']===_0xa688('0x7c')){if(_0xa688('0x72')==typeof _0x1cdde3[_0xa688('0x75')][_0xa688('0x7d')]){return _0x1b52a4(new Error(_0xa688('0x7e')));}if(_0xa688('0x72')==typeof _0x1cdde3[_0xa688('0x75')]['scriptPath']){return _0x1b52a4(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x1b52a4(new Error(_0xa688('0x7f')));}var _0x483f55=_0x1cdde3[_0xa688('0x25')];var _0x574e8d=_0x1cdde3[_0xa688('0x80')];var _0x16ef7d=_0x1cdde3[_0xa688('0x71')];var _0x507036=_0x1cdde3[_0xa688('0x81')]?_0x1cdde3[_0xa688('0x81')]:_0xa688('0x82');var _0x2ff186=_0x1cdde3[_0xa688('0x83')]?_0x1cdde3['icon']:_0xa688('0x84');var _0x1ce8a7='';var _0x4750a7='';var _0x3d15ed='';var _0x50f23b='';var _0x328b7f=_0x1cdde3[_0xa688('0x73')];if(_0x16ef7d===_0xa688('0x77')){if(_0xa688('0x72')!=typeof _0x1cdde3[_0xa688('0x75')][_0xa688('0x78')][_0xa688('0x7a')]){var _0x527e02=_0x1cdde3[_0xa688('0x75')][_0xa688('0x78')][_0xa688('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0xa688('0x85')](_0x527e02)){_0x1ce8a7=path['join'](_0xa688('0x86'),_0x1acd66,_0x2eb14e[0x0],_0x527e02);}else{_0x1ce8a7=_0x527e02;}}else{logger[_0xa688('0x64')](_0xa688('0x87'));}if(_0xa688('0x72')!=typeof _0x1cdde3[_0xa688('0x75')]['views'][_0xa688('0x7b')]){var _0x57e0c0=_0x1cdde3[_0xa688('0x75')][_0xa688('0x78')][_0xa688('0x7b')];if(!/^(f|ht)tps?:\/\//i['test'](_0x57e0c0)){_0x4750a7=path[_0xa688('0x48')]('plugins',_0x1acd66,_0x2eb14e[0x0],_0x57e0c0);}else{_0x4750a7=_0x57e0c0;}}else{logger['info'](_0xa688('0x88'));}}else if(_0x16ef7d===_0xa688('0x7c')){_0x3d15ed=_0x1cdde3[_0xa688('0x75')][_0xa688('0x7d')];_0x50f23b=_0x1cdde3[_0xa688('0x75')][_0xa688('0x89')];if('undefined'!=typeof _0x1cdde3[_0xa688('0x75')][_0xa688('0x78')]){if(_0xa688('0x72')!=typeof _0x1cdde3[_0xa688('0x75')]['views'][_0xa688('0x7a')]){var _0x527e02=_0x1cdde3[_0xa688('0x75')][_0xa688('0x78')][_0xa688('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0xa688('0x85')](_0x527e02)){_0x1ce8a7=path[_0xa688('0x48')](_0xa688('0x86'),_0x1acd66,_0x2eb14e[0x0],_0x527e02);}else{_0x1ce8a7=_0x527e02;}}if(_0xa688('0x72')!=typeof _0x1cdde3['parameters'][_0xa688('0x78')][_0xa688('0x7b')]){var _0x57e0c0=_0x1cdde3['parameters'][_0xa688('0x78')][_0xa688('0x7b')];if(!/^(f|ht)tps?:\/\//i['test'](_0x57e0c0)){_0x4750a7=path[_0xa688('0x48')](_0xa688('0x86'),_0x1acd66,_0x2eb14e[0x0],_0x57e0c0);}else{_0x4750a7=_0x57e0c0;}}}}var _0x55b4f2={'name':_0x483f55,'description':_0x574e8d,'path':path[_0xa688('0x48')](_0x1acd66,_0x2eb14e[0x0]),'type':_0x16ef7d,'sidebar':_0x507036,'icon':_0x2ff186,'adminUrl':_0x1ce8a7,'agentUrl':_0x4750a7,'scriptName':_0x3d15ed,'scriptPath':_0x50f23b,'version':_0x328b7f};removeReferences(_0x47dd33,null);return db[_0xa688('0x28')]['create'](_0x55b4f2)['then'](respondWithResult(_0x218b5e,null))[_0xa688('0x43')](handleError(_0x218b5e,null));}});}catch(_0x55894b){_0x218b5e['status'](0x1f4)['send'](_0x55894b);}};function removeReferences(_0xdea928,_0x2acf68){try{if(_0xdea928){fs['unlinkSync'](_0xdea928);logger[_0xa688('0x64')](_0xa688('0x8a'));}if(_0x2acf68){rimraf(_0x2acf68,function(){});logger[_0xa688('0x64')](_0xa688('0x8b'));}}catch(_0x3223e1){logger['error'](_0x3223e1);}}exports[_0xa688('0x20')]=function(_0x41d980,_0x1ed269,_0x15ee1a){return db[_0xa688('0x28')][_0xa688('0x47')]({'where':{'id':_0x41d980[_0xa688('0x45')]['id']}})[_0xa688('0x21')](handleEntityNotFound(_0x1ed269,null))[_0xa688('0x21')](saveUpdates(_0x41d980[_0xa688('0x8c')],null))[_0xa688('0x21')](respondWithResult(_0x1ed269,null))['catch'](handleError(_0x1ed269,null));};exports['delete']=function(_0x20c596,_0x1b087c,_0x1e14e8){return db[_0xa688('0x28')][_0xa688('0x47')]({'where':{'id':_0x20c596[_0xa688('0x45')]['id']}})['then'](function(_0x8d5cd9){if(_0x8d5cd9){return _0x8d5cd9[_0xa688('0x22')]();}})[_0xa688('0x21')](function(_0xd33b10){rimraf(path['join'](config[_0xa688('0x51')],_0xa688('0x49'),path[_0xa688('0x52')](_0xd33b10[_0xa688('0x7')])),function(){});return _0xd33b10;})[_0xa688('0x21')](handleEntityNotFound(_0x1b087c,null))[_0xa688('0x21')](respondWithStatusCode(_0x1b087c,null))[_0xa688('0x43')](handleError(_0x1b087c,null));};exports[_0xa688('0x8d')]=function(_0x1b456d,_0x35ea2c,_0xeba893){return BPromise[_0xa688('0x8e')]()[_0xa688('0x21')](function(){if(!_0x1b456d['query'][_0xa688('0x7')]){throw new Error(_0xa688('0x8f'));}if(!_0x1b456d['query'][_0xa688('0x90')]){throw new Error(_0xa688('0x91'));}var _0x147e82=_0x1b456d[_0xa688('0x2d')][_0xa688('0x92')]?_0x1b456d['query'][_0xa688('0x92')]+':'+_0x1b456d[_0xa688('0x2d')][_0xa688('0x90')]:_0xa688('0x93')+_0x1b456d[_0xa688('0x2d')][_0xa688('0x90')];var _0x21dbac=_0x1b456d[_0xa688('0x2d')][_0xa688('0x1b')]?_0x1b456d[_0xa688('0x2d')][_0xa688('0x1b')]:!![];var _0x396290=_0x1b456d[_0xa688('0x2d')][_0xa688('0x94')]?_0x1b456d[_0xa688('0x2d')][_0xa688('0x94')]:null;var _0x912b44={'method':_0x1b456d[_0xa688('0x95')],'uri':util[_0xa688('0x5a')](_0xa688('0x96'),_0x147e82,_0x1b456d[_0xa688('0x2d')][_0xa688('0x7')]),'json':_0x21dbac,'resolveWithFullResponse':!![],'encoding':_0x396290,'qs':_0x1b456d['query']};if(_0x1b456d[_0xa688('0x97')]){_0x912b44[_0xa688('0x97')]=_0x1b456d[_0xa688('0x97')];}return rp(_0x912b44);})[_0xa688('0x21')](function(_0x4d83cd){if(_0x4d83cd){_0x35ea2c[_0xa688('0x98')](_0x4d83cd[_0xa688('0x97')]);logger[_0xa688('0x64')](_0x4d83cd[_0xa688('0x8c')]);if(_[_0xa688('0x99')](_0x1b456d[_0xa688('0x2d')]['path'],'download')&&_0x4d83cd[_0xa688('0x9a')]==0x1f4){return _0x35ea2c[_0xa688('0x18')](_0x4d83cd[_0xa688('0x9a')]);}else{return _0x35ea2c[_0xa688('0x1a')](_0x4d83cd[_0xa688('0x9a')])[_0xa688('0x26')](_0x4d83cd[_0xa688('0x8c')]);}}else{return _0x35ea2c['sendStatus'](0xc8);}})[_0xa688('0x43')](handleError(_0x35ea2c,null));};exports[_0xa688('0x9b')]=function(_0xfcbc35,_0xbacd96,_0x3c3f5f){return BPromise[_0xa688('0x8e')]()[_0xa688('0x21')](function(){if(!_0xfcbc35['query'][_0xa688('0x7')]){throw new Error(_0xa688('0x8f'));}if(!_0xfcbc35[_0xa688('0x2d')][_0xa688('0x90')]){throw new Error(_0xa688('0x91'));}var _0x5ecf64=_0xfcbc35[_0xa688('0x2d')]['hostname']?_0xfcbc35[_0xa688('0x2d')]['hostname']+':'+_0xfcbc35[_0xa688('0x2d')][_0xa688('0x90')]:_0xa688('0x93')+_0xfcbc35[_0xa688('0x2d')][_0xa688('0x90')];var _0x2942ae=_0xfcbc35[_0xa688('0x2d')][_0xa688('0x1b')]?_0xfcbc35['query'][_0xa688('0x1b')]:!![];var _0x1ac5a1=_0xfcbc35[_0xa688('0x2d')][_0xa688('0x94')]?_0xfcbc35[_0xa688('0x2d')][_0xa688('0x94')]:null;var _0xb580e5={'method':_0xfcbc35[_0xa688('0x95')],'uri':util['format']('%s%s',_0x5ecf64,_0xfcbc35[_0xa688('0x2d')]['path']),'json':_0x2942ae,'resolveWithFullResponse':!![],'encoding':_0x1ac5a1,'body':_0xfcbc35[_0xa688('0x8c')]};if(_0xfcbc35[_0xa688('0x97')]){_0xb580e5[_0xa688('0x97')]=_0xfcbc35['headers'];}return rp(_0xb580e5);})[_0xa688('0x21')](function(_0xc709ec){if(_0xc709ec){_0xbacd96[_0xa688('0x98')](_0xc709ec[_0xa688('0x97')]);logger['info'](_0xc709ec[_0xa688('0x8c')]);return _0xbacd96['status'](_0xc709ec[_0xa688('0x9a')])[_0xa688('0x26')](_0xc709ec[_0xa688('0x8c')]);}else{return _0xbacd96[_0xa688('0x18')](0xc8);}})[_0xa688('0x43')](handleError(_0xbacd96,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 8bfe12f..686debb 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 _0x7a54=['Plugin','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x4a1de2,_0x4728d5){var _0x250d26=function(_0x489381){while(--_0x489381){_0x4a1de2['push'](_0x4a1de2['shift']());}};_0x250d26(++_0x4728d5);}(_0x7a54,0x106));var _0x47a5=function(_0x37b812,_0x12d0fa){_0x37b812=_0x37b812-0x0;var _0x35aab5=_0x7a54[_0x37b812];return _0x35aab5;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var Plugin=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47a5('0x3'),'afterUpdate':_0x47a5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f7f12){return function(_0x11bf85,_0x2a1a7e,_0x3717e1){PluginEvents[_0x47a5('0x5')](_0x5f7f12+':'+_0x11bf85['id'],_0x11bf85);PluginEvents['emit'](_0x5f7f12,_0x11bf85);_0x3717e1(null);};}for(var e in events){if(events[_0x47a5('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x47a5('0x7')]=PluginEvents; \ No newline at end of file +var _0x7a54=['Plugin','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x2e5440,_0x12d705){var _0x3c03df=function(_0x3f3b0c){while(--_0x3f3b0c){_0x2e5440['push'](_0x2e5440['shift']());}};_0x3c03df(++_0x12d705);}(_0x7a54,0x106));var _0x47a5=function(_0x53cfcb,_0x27322b){_0x53cfcb=_0x53cfcb-0x0;var _0x2e4263=_0x7a54[_0x53cfcb];return _0x2e4263;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var Plugin=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47a5('0x3'),'afterUpdate':_0x47a5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f7f12){return function(_0x11bf85,_0x2a1a7e,_0x3717e1){PluginEvents[_0x47a5('0x5')](_0x5f7f12+':'+_0x11bf85['id'],_0x11bf85);PluginEvents['emit'](_0x5f7f12,_0x11bf85);_0x3717e1(null);};}for(var e in events){if(events[_0x47a5('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x47a5('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index c0fc3fb..77389b5 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 _0x0646=['plugins','util','../../config/logger','api','moment','bluebird','define','Plugin'];(function(_0x4d2d3b,_0x6ea545){var _0x4bef6a=function(_0x575752){while(--_0x575752){_0x4d2d3b['push'](_0x4d2d3b['shift']());}};_0x4bef6a(++_0x6ea545);}(_0x0646,0x1b9));var _0x6064=function(_0x287289,_0x1f635c){_0x287289=_0x287289-0x0;var _0x186e3c=_0x0646[_0x287289];return _0x186e3c;};'use strict';var _=require('lodash');var util=require(_0x6064('0x0'));var logger=require(_0x6064('0x1'))(_0x6064('0x2'));var moment=require(_0x6064('0x3'));var BPromise=require(_0x6064('0x4'));var rp=require('request-promise');var attributes=require('./plugin.attributes');module['exports']=function(_0x50dd57,_0x186203){return _0x50dd57[_0x6064('0x5')](_0x6064('0x6'),attributes,{'tableName':_0x6064('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd153=['define','Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./plugin.attributes','exports'];(function(_0x5820aa,_0xa386a1){var _0x45b632=function(_0x2ba970){while(--_0x2ba970){_0x5820aa['push'](_0x5820aa['shift']());}};_0x45b632(++_0xa386a1);}(_0xd153,0xb7));var _0x3d15=function(_0x2ede8f,_0x586cb5){_0x2ede8f=_0x2ede8f-0x0;var _0x384fd4=_0xd153[_0x2ede8f];return _0x384fd4;};'use strict';var _=require(_0x3d15('0x0'));var util=require(_0x3d15('0x1'));var logger=require(_0x3d15('0x2'))(_0x3d15('0x3'));var moment=require(_0x3d15('0x4'));var BPromise=require(_0x3d15('0x5'));var rp=require(_0x3d15('0x6'));var attributes=require(_0x3d15('0x7'));module[_0x3d15('0x8')]=function(_0x596ba5,_0x4c9a54){return _0x596ba5[_0x3d15('0x9')](_0x3d15('0xa'),attributes,{'tableName':_0x3d15('0xb'),'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 b2a681c..eff2f1c 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 _0xc7e1=['localhost','socket.io-emitter','./plugin.socket','register','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreatePlugin','Plugin','create','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x54e892,_0x1b0bd6){var _0x57e4b2=function(_0x2e8984){while(--_0x2e8984){_0x54e892['push'](_0x54e892['shift']());}};_0x57e4b2(++_0x1b0bd6);}(_0xc7e1,0x15d));var _0x1c7e=function(_0x5ce184,_0x17f4df){_0x5ce184=_0x5ce184-0x0;var _0x3fdd9c=_0xc7e1[_0x5ce184];return _0x3fdd9c;};'use strict';var _=require(_0x1c7e('0x0'));var util=require(_0x1c7e('0x1'));var moment=require(_0x1c7e('0x2'));var BPromise=require(_0x1c7e('0x3'));var rs=require(_0x1c7e('0x4'));var fs=require('fs');var Redis=require(_0x1c7e('0x5'));var db=require(_0x1c7e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1c7e('0x7'))(_0x1c7e('0x8'));var config=require(_0x1c7e('0x9'));var jayson=require(_0x1c7e('0xa'));var client=jayson['client'][_0x1c7e('0xb')]({'port':0x232a});config[_0x1c7e('0xc')]=_[_0x1c7e('0xd')](config['redis'],{'host':_0x1c7e('0xe'),'port':0x18eb});var socket=require(_0x1c7e('0xf'))(new Redis(config[_0x1c7e('0xc')]));require(_0x1c7e('0x10'))[_0x1c7e('0x11')](socket);function respondWithRpcPromise(_0x2a86de,_0x11c7e5,_0x3cb68c){return new BPromise(function(_0x3ad47b,_0x32a1c1){return client['request'](_0x2a86de,_0x3cb68c)['then'](function(_0x456399){logger[_0x1c7e('0x12')](_0x1c7e('0x13'),_0x11c7e5,_0x1c7e('0x14'));logger[_0x1c7e('0x15')]('Plugin,\x20%s,\x20%s,\x20%s',_0x11c7e5,_0x1c7e('0x14'),JSON[_0x1c7e('0x16')](_0x456399));if(_0x456399[_0x1c7e('0x17')]){if(_0x456399[_0x1c7e('0x17')]['code']===0x1f4){logger[_0x1c7e('0x17')](_0x1c7e('0x13'),_0x11c7e5,_0x456399[_0x1c7e('0x17')][_0x1c7e('0x18')]);return _0x32a1c1(_0x456399[_0x1c7e('0x17')][_0x1c7e('0x18')]);}logger['error'](_0x1c7e('0x13'),_0x11c7e5,_0x456399['error'][_0x1c7e('0x18')]);return _0x3ad47b(_0x456399[_0x1c7e('0x17')][_0x1c7e('0x18')]);}else{logger[_0x1c7e('0x12')]('Plugin,\x20%s,\x20%s',_0x11c7e5,_0x1c7e('0x14'));_0x3ad47b(_0x456399[_0x1c7e('0x19')][_0x1c7e('0x18')]);}})[_0x1c7e('0x1a')](function(_0x2cea9b){logger['error'](_0x1c7e('0x13'),_0x11c7e5,_0x2cea9b);_0x32a1c1(_0x2cea9b);});});}exports[_0x1c7e('0x1b')]=function(_0x1e8ef1){var _0x1b3632=this;return new Promise(function(_0x337d1b,_0x329509){return db[_0x1c7e('0x1c')][_0x1c7e('0x1d')](_0x1e8ef1['body'],{'raw':_0x1e8ef1['options']?_0x1e8ef1[_0x1c7e('0x1e')][_0x1c7e('0x1f')]===undefined?!![]:![]:!![]})[_0x1c7e('0x20')](function(_0x5983c9){logger['info'](_0x1c7e('0x1b'),_0x1e8ef1);logger['debug'](_0x1c7e('0x1b'),_0x1e8ef1,JSON['stringify'](_0x5983c9));_0x337d1b(_0x5983c9);})[_0x1c7e('0x1a')](function(_0x5993e7){logger[_0x1c7e('0x17')](_0x1c7e('0x1b'),_0x5993e7[_0x1c7e('0x18')],_0x1e8ef1);_0x329509(_0x1b3632[_0x1c7e('0x17')](0x1f4,_0x5993e7[_0x1c7e('0x18')]));});});}; \ No newline at end of file +var _0xfc37=['socket.io-emitter','register','then','info','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','CreatePlugin','Plugin','create','raw','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xfc37,0x115));var _0x7fc3=function(_0x2d3863,_0x16bc0d){_0x2d3863=_0x2d3863-0x0;var _0x40f906=_0xfc37[_0x2d3863];return _0x40f906;};'use strict';var _=require(_0x7fc3('0x0'));var util=require(_0x7fc3('0x1'));var moment=require(_0x7fc3('0x2'));var BPromise=require('bluebird');var rs=require(_0x7fc3('0x3'));var fs=require('fs');var Redis=require(_0x7fc3('0x4'));var db=require(_0x7fc3('0x5'))['db'];var utils=require(_0x7fc3('0x6'));var logger=require(_0x7fc3('0x7'))(_0x7fc3('0x8'));var config=require(_0x7fc3('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x7fc3('0xa')]=_[_0x7fc3('0xb')](config[_0x7fc3('0xa')],{'host':_0x7fc3('0xc'),'port':0x18eb});var socket=require(_0x7fc3('0xd'))(new Redis(config[_0x7fc3('0xa')]));require('./plugin.socket')[_0x7fc3('0xe')](socket);function respondWithRpcPromise(_0x38a316,_0x34613e,_0x4bccbc){return new BPromise(function(_0x48f8f0,_0x200def){return client['request'](_0x38a316,_0x4bccbc)[_0x7fc3('0xf')](function(_0x490171){logger[_0x7fc3('0x10')](_0x7fc3('0x11'),_0x34613e,'request\x20sent');logger[_0x7fc3('0x12')](_0x7fc3('0x13'),_0x34613e,_0x7fc3('0x14'),JSON[_0x7fc3('0x15')](_0x490171));if(_0x490171[_0x7fc3('0x16')]){if(_0x490171[_0x7fc3('0x16')]['code']===0x1f4){logger[_0x7fc3('0x16')](_0x7fc3('0x11'),_0x34613e,_0x490171[_0x7fc3('0x16')][_0x7fc3('0x17')]);return _0x200def(_0x490171[_0x7fc3('0x16')][_0x7fc3('0x17')]);}logger[_0x7fc3('0x16')](_0x7fc3('0x11'),_0x34613e,_0x490171[_0x7fc3('0x16')][_0x7fc3('0x17')]);return _0x48f8f0(_0x490171[_0x7fc3('0x16')][_0x7fc3('0x17')]);}else{logger[_0x7fc3('0x10')](_0x7fc3('0x11'),_0x34613e,'request\x20sent');_0x48f8f0(_0x490171['result'][_0x7fc3('0x17')]);}})['catch'](function(_0x5a0123){logger[_0x7fc3('0x16')](_0x7fc3('0x11'),_0x34613e,_0x5a0123);_0x200def(_0x5a0123);});});}exports[_0x7fc3('0x18')]=function(_0x529105){var _0x5cbd71=this;return new Promise(function(_0x1226af,_0x4228d4){return db[_0x7fc3('0x19')][_0x7fc3('0x1a')](_0x529105['body'],{'raw':_0x529105['options']?_0x529105['options'][_0x7fc3('0x1b')]===undefined?!![]:![]:!![]})[_0x7fc3('0xf')](function(_0x4134cc){logger[_0x7fc3('0x10')](_0x7fc3('0x18'),_0x529105);logger[_0x7fc3('0x12')](_0x7fc3('0x18'),_0x529105,JSON[_0x7fc3('0x15')](_0x4134cc));_0x1226af(_0x4134cc);})[_0x7fc3('0x1c')](function(_0x396025){logger['error'](_0x7fc3('0x18'),_0x396025[_0x7fc3('0x17')],_0x529105);_0x4228d4(_0x5cbd71[_0x7fc3('0x16')](0x1f4,_0x396025[_0x7fc3('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index b2df808..10b9d9b 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 _0xb7df=['save','update','emit','removeListener','register','length','./plugin.events'];(function(_0x214994,_0x2e5651){var _0x2b9f87=function(_0x5f4a8e){while(--_0x5f4a8e){_0x214994['push'](_0x214994['shift']());}};_0x2b9f87(++_0x2e5651);}(_0xb7df,0x1b8));var _0xfb7d=function(_0x178ca2,_0x4f4d67){_0x178ca2=_0x178ca2-0x0;var _0x36cf84=_0xb7df[_0x178ca2];return _0x36cf84;};'use strict';var PluginEvents=require(_0xfb7d('0x0'));var events=[_0xfb7d('0x1'),'remove',_0xfb7d('0x2')];function createListener(_0x44d796,_0x1a692a){return function(_0x5c3240){_0x1a692a[_0xfb7d('0x3')](_0x44d796,_0x5c3240);};}function removeListener(_0xb4ac78,_0x425a51){return function(){PluginEvents[_0xfb7d('0x4')](_0xb4ac78,_0x425a51);};}exports[_0xfb7d('0x5')]=function(_0xe30ef){for(var _0x3b01a2=0x0,_0x2c0741=events[_0xfb7d('0x6')];_0x3b01a2<_0x2c0741;_0x3b01a2++){var _0x2150f2=events[_0x3b01a2];var _0x1b33af=createListener('plugin:'+_0x2150f2,_0xe30ef);PluginEvents['on'](_0x2150f2,_0x1b33af);}}; \ No newline at end of file +var _0x0f1d=['save','remove','update','register','length','plugin:','./plugin.events'];(function(_0x10b967,_0xb32c4d){var _0x264da2=function(_0x1a7212){while(--_0x1a7212){_0x10b967['push'](_0x10b967['shift']());}};_0x264da2(++_0xb32c4d);}(_0x0f1d,0x12c));var _0xd0f1=function(_0x2946ba,_0x3256a3){_0x2946ba=_0x2946ba-0x0;var _0x31458f=_0x0f1d[_0x2946ba];return _0x31458f;};'use strict';var PluginEvents=require(_0xd0f1('0x0'));var events=[_0xd0f1('0x1'),_0xd0f1('0x2'),_0xd0f1('0x3')];function createListener(_0x527f2f,_0x1440bb){return function(_0x54d118){_0x1440bb['emit'](_0x527f2f,_0x54d118);};}function removeListener(_0x55e57e,_0x1ed66d){return function(){PluginEvents['removeListener'](_0x55e57e,_0x1ed66d);};}exports[_0xd0f1('0x4')]=function(_0x3fe51c){for(var _0x2e56af=0x0,_0x4ee663=events[_0xd0f1('0x5')];_0x2e56af<_0x4ee663;_0x2e56af++){var _0x11167f=events[_0x2e56af];var _0x1268d9=createListener(_0xd0f1('0x6')+_0x11167f,_0x3fe51c);PluginEvents['on'](_0x11167f,_0x1268d9);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 885f929..c5b7735 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 _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x309802,_0x576545){var _0x2499b1=function(_0xfe387b){while(--_0xfe387b){_0x309802['push'](_0x309802['shift']());}};_0x2499b1(++_0x576545);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x480d9b,_0x737adc){var _0x594254=function(_0x4dd9f9){while(--_0x4dd9f9){_0x480d9b['push'](_0x480d9b['shift']());}};_0x594254(++_0x737adc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 396689b..cb3a857 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 _0x5432=['send','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','params','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','info','index','then','express','motion2','catch','describe','create','body','script','../../files/plugins','chdir','start','dump'];(function(_0x175085,_0x1aeda6){var _0x217a50=function(_0x5afd1a){while(--_0x5afd1a){_0x175085['push'](_0x175085['shift']());}};_0x217a50(++_0x1aeda6);}(_0x5432,0xc8));var _0x2543=function(_0x138cfe,_0x12b0de){_0x138cfe=_0x138cfe-0x0;var _0x2bda27=_0x5432[_0x138cfe];return _0x2bda27;};'use strict';var _=require(_0x2543('0x0'));var pm2=require(_0x2543('0x1'));var logger=require(_0x2543('0x2'))(_0x2543('0x3'));var path=require(_0x2543('0x4'));var exec=require(_0x2543('0x5'))[_0x2543('0x6')];var BPromise=require(_0x2543('0x7'));function handleEntityNotFound(_0x3dadb0,_0x337443){return function(_0x43d252){if(!_0x43d252){_0x3dadb0[_0x2543('0x8')](0x194);;}return _0x43d252;};}function respondWithResult(_0x31bd2c,_0x5325b3){_0x5325b3=_0x5325b3||0xc8;return function(_0x24d480){if(_0x24d480){return _0x31bd2c[_0x2543('0x9')](_0x5325b3)[_0x2543('0xa')](_0x24d480);}return null;};}function handleError(_0x9d3609,_0x457028){_0x457028=_0x457028||0x1f4;return function(_0x1f4ee7){logger[_0x2543('0xb')](_0x1f4ee7[_0x2543('0xc')]);if(_0x1f4ee7['name']){delete _0x1f4ee7[_0x2543('0xd')];}_0x9d3609[_0x2543('0x9')](_0x457028)['send'](_0x1f4ee7);};}function execChildProcess(){return new BPromise(function(_0x16ec48,_0x2f4c91){exec('npm\x20install',function(_0x2a47cf,_0x32ca5d,_0x1a9349){logger[_0x2543('0xe')](_0x32ca5d);logger[_0x2543('0xe')](_0x1a9349);if(_0x2a47cf){logger['error'](_0x2a47cf);return _0x2f4c91(_0x2a47cf);}return _0x16ec48(_0x32ca5d);});});}exports[_0x2543('0xf')]=function(_0x203fa5,_0xf982fb){return pm2['list']()[_0x2543('0x10')](function(_0xd926c1){if(_0xd926c1){var _0x18d64c=_['reject'](_0xd926c1,function(_0x595477){return _0x595477[_0x2543('0xd')]===_0x2543('0x11')||_0x595477['name']===_0x2543('0x12');});return{'rows':_0x18d64c,'count':_0x18d64c['length']};}return null;})[_0x2543('0x10')](respondWithResult(_0xf982fb,null))[_0x2543('0x13')](handleError(_0xf982fb,null));};exports['show']=function(_0x238287,_0x5be3d2){return pm2[_0x2543('0x14')](_0x238287['params']['id'])[_0x2543('0x10')](respondWithResult(_0x5be3d2,null))['then'](handleEntityNotFound(_0x5be3d2,null))[_0x2543('0x13')](handleError(_0x5be3d2,null));};exports[_0x2543('0x15')]=function(_0x34310f,_0x121fd1){if(_0x34310f[_0x2543('0x16')]['name']&&_0x34310f[_0x2543('0x16')][_0x2543('0x17')]){var _0x12ef9c=path['join'](__dirname,_0x2543('0x18'),_0x34310f['body'][_0x2543('0x17')]);var _0x5b4c3c=process['cwd']();process[_0x2543('0x19')](path['dirname'](_0x12ef9c));return execChildProcess()[_0x2543('0x10')](function(_0x37b5d0){process[_0x2543('0x19')](_0x5b4c3c);return pm2[_0x2543('0x1a')]({'name':_0x34310f['body'][_0x2543('0xd')],'script':_0x12ef9c});})[_0x2543('0x10')](function(_0x42c026){pm2[_0x2543('0x1b')]();return _0x42c026[0x0];})['then'](respondWithResult(_0x121fd1,0xc9))[_0x2543('0x13')](handleError(_0x121fd1,null));}else{return _0x121fd1[_0x2543('0x9')](0x1f4)[_0x2543('0x1c')]({'message':_0x2543('0x1d')});}};exports['update']=function(_0x5d068b,_0x2bb56f){if(_0x5d068b[_0x2543('0x16')]['id']){delete _0x5d068b[_0x2543('0x16')]['id'];}var _0x2d35b7={'online':_0x2543('0x1e'),'stopped':_0x2543('0x1f')};if(_0x2d35b7[_0x2543('0x20')](_0x5d068b[_0x2543('0x16')][_0x2543('0x9')])){return pm2[_0x2d35b7[_0x5d068b[_0x2543('0x16')]['status']]](_0x5d068b[_0x2543('0x21')]['id'])[_0x2543('0x10')](respondWithResult(_0x2bb56f,0xc8))[_0x2543('0x13')](handleError(_0x2bb56f,null));}else{return _0x2bb56f[_0x2543('0x9')](0x1f4)[_0x2543('0x1c')]({'message':_0x2543('0x22')});}};exports[_0x2543('0x23')]=function(_0x1a13db,_0x356d37){if(_0x1a13db['body']['id']){delete _0x1a13db['body']['id'];}if(_0x1a13db[_0x2543('0x21')]['id']){return pm2[_0x2543('0x24')](_0x1a13db['params']['id'])[_0x2543('0x10')](function(_0x23127c){pm2[_0x2543('0x1b')]();return _0x23127c[0x0];})[_0x2543('0x10')](respondWithResult(_0x356d37,null))[_0x2543('0x13')](handleError(_0x356d37,null));}else{return _0x356d37['status'](0x1f4)[_0x2543('0x1c')]({'message':_0x2543('0x25')});}}; \ No newline at end of file +var _0x4cff=['npm\x20install','index','list','then','reject','motion2','length','catch','show','describe','params','body','join','../../files/plugins','script','cwd','dirname','chdir','start','Missing\x20name\x20and/or\x20path','hasOwnProperty','Unknown\x20status','destroy','delete','dump','Unknown\x20id','lodash','../../config/pm2','api','child_process','exec','sendStatus','status','json','error','stack','name','send'];(function(_0x1f79f8,_0x4b68e7){var _0x21baa6=function(_0x4ffa5b){while(--_0x4ffa5b){_0x1f79f8['push'](_0x1f79f8['shift']());}};_0x21baa6(++_0x4b68e7);}(_0x4cff,0x14a));var _0xf4cf=function(_0x23868b,_0x258399){_0x23868b=_0x23868b-0x0;var _0x43b28f=_0x4cff[_0x23868b];return _0x43b28f;};'use strict';var _=require(_0xf4cf('0x0'));var pm2=require(_0xf4cf('0x1'));var logger=require('../../config/logger')(_0xf4cf('0x2'));var path=require('path');var exec=require(_0xf4cf('0x3'))[_0xf4cf('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x3d5ddc,_0x1c1936){return function(_0x9bcfbe){if(!_0x9bcfbe){_0x3d5ddc[_0xf4cf('0x5')](0x194);;}return _0x9bcfbe;};}function respondWithResult(_0x4634f6,_0x33c9d7){_0x33c9d7=_0x33c9d7||0xc8;return function(_0x53a3e6){if(_0x53a3e6){return _0x4634f6[_0xf4cf('0x6')](_0x33c9d7)[_0xf4cf('0x7')](_0x53a3e6);}return null;};}function handleError(_0x1f06c6,_0x3882b2){_0x3882b2=_0x3882b2||0x1f4;return function(_0x53df8d){logger[_0xf4cf('0x8')](_0x53df8d[_0xf4cf('0x9')]);if(_0x53df8d[_0xf4cf('0xa')]){delete _0x53df8d[_0xf4cf('0xa')];}_0x1f06c6['status'](_0x3882b2)[_0xf4cf('0xb')](_0x53df8d);};}function execChildProcess(){return new BPromise(function(_0xec3042,_0x1ba79e){exec(_0xf4cf('0xc'),function(_0x50f939,_0x4a87cf,_0x20db44){logger['info'](_0x4a87cf);logger['info'](_0x20db44);if(_0x50f939){logger['error'](_0x50f939);return _0x1ba79e(_0x50f939);}return _0xec3042(_0x4a87cf);});});}exports[_0xf4cf('0xd')]=function(_0x3e6f30,_0x1ce2fc){return pm2[_0xf4cf('0xe')]()[_0xf4cf('0xf')](function(_0x2d8c31){if(_0x2d8c31){var _0x198490=_[_0xf4cf('0x10')](_0x2d8c31,function(_0x453dfa){return _0x453dfa[_0xf4cf('0xa')]==='express'||_0x453dfa[_0xf4cf('0xa')]===_0xf4cf('0x11');});return{'rows':_0x198490,'count':_0x198490[_0xf4cf('0x12')]};}return null;})[_0xf4cf('0xf')](respondWithResult(_0x1ce2fc,null))[_0xf4cf('0x13')](handleError(_0x1ce2fc,null));};exports[_0xf4cf('0x14')]=function(_0x2c8503,_0x4b58f8){return pm2[_0xf4cf('0x15')](_0x2c8503[_0xf4cf('0x16')]['id'])[_0xf4cf('0xf')](respondWithResult(_0x4b58f8,null))['then'](handleEntityNotFound(_0x4b58f8,null))[_0xf4cf('0x13')](handleError(_0x4b58f8,null));};exports['create']=function(_0x44b401,_0x5d2a81){if(_0x44b401[_0xf4cf('0x17')]['name']&&_0x44b401['body']['script']){var _0x214233=path[_0xf4cf('0x18')](__dirname,_0xf4cf('0x19'),_0x44b401[_0xf4cf('0x17')][_0xf4cf('0x1a')]);var _0x925f8b=process[_0xf4cf('0x1b')]();process['chdir'](path[_0xf4cf('0x1c')](_0x214233));return execChildProcess()[_0xf4cf('0xf')](function(_0x279c73){process[_0xf4cf('0x1d')](_0x925f8b);return pm2[_0xf4cf('0x1e')]({'name':_0x44b401[_0xf4cf('0x17')]['name'],'script':_0x214233});})[_0xf4cf('0xf')](function(_0x1ca8b8){pm2['dump']();return _0x1ca8b8[0x0];})[_0xf4cf('0xf')](respondWithResult(_0x5d2a81,0xc9))['catch'](handleError(_0x5d2a81,null));}else{return _0x5d2a81['status'](0x1f4)[_0xf4cf('0xb')]({'message':_0xf4cf('0x1f')});}};exports['update']=function(_0x230a18,_0x54d153){if(_0x230a18[_0xf4cf('0x17')]['id']){delete _0x230a18[_0xf4cf('0x17')]['id'];}var _0x97e3e4={'online':'restart','stopped':'stop'};if(_0x97e3e4[_0xf4cf('0x20')](_0x230a18[_0xf4cf('0x17')][_0xf4cf('0x6')])){return pm2[_0x97e3e4[_0x230a18[_0xf4cf('0x17')][_0xf4cf('0x6')]]](_0x230a18[_0xf4cf('0x16')]['id'])[_0xf4cf('0xf')](respondWithResult(_0x54d153,0xc8))['catch'](handleError(_0x54d153,null));}else{return _0x54d153[_0xf4cf('0x6')](0x1f4)[_0xf4cf('0xb')]({'message':_0xf4cf('0x21')});}};exports[_0xf4cf('0x22')]=function(_0x33b5c2,_0x47de20){if(_0x33b5c2['body']['id']){delete _0x33b5c2[_0xf4cf('0x17')]['id'];}if(_0x33b5c2[_0xf4cf('0x16')]['id']){return pm2[_0xf4cf('0x23')](_0x33b5c2[_0xf4cf('0x16')]['id'])[_0xf4cf('0xf')](function(_0x108218){pm2[_0xf4cf('0x24')]();return _0x108218[0x0];})[_0xf4cf('0xf')](respondWithResult(_0x47de20,null))[_0xf4cf('0x13')](handleError(_0x47de20,null));}else{return _0x47de20['status'](0x1f4)['send']({'message':_0xf4cf('0x25')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index bc1281b..2b198b9 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 _0x81d4=['path','express','Router','../../components/auth/service','exports','util'];(function(_0x243d52,_0x2d5634){var _0xbbf923=function(_0x1a9466){while(--_0x1a9466){_0x243d52['push'](_0x243d52['shift']());}};_0xbbf923(++_0x2d5634);}(_0x81d4,0x197));var _0x481d=function(_0x3de940,_0x122999){_0x3de940=_0x3de940-0x0;var _0xde8749=_0x81d4[_0x3de940];return _0xde8749;};'use strict';var multer=require('multer');var util=require(_0x481d('0x0'));var path=require(_0x481d('0x1'));var timeout=require('connect-timeout');var express=require(_0x481d('0x2'));var router=express[_0x481d('0x3')]();var auth=require(_0x481d('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x481d('0x5')]=router; \ No newline at end of file +var _0x1228=['../../config/environment','exports','multer','path','express','Router','../../components/auth/service'];(function(_0x71b765,_0x3053f8){var _0x34cb24=function(_0x2dd237){while(--_0x2dd237){_0x71b765['push'](_0x71b765['shift']());}};_0x34cb24(++_0x3053f8);}(_0x1228,0x12f));var _0x8122=function(_0x30cb96,_0x31b9e1){_0x30cb96=_0x30cb96-0x0;var _0xeff506=_0x1228[_0x30cb96];return _0xeff506;};'use strict';var multer=require(_0x8122('0x0'));var util=require('util');var path=require(_0x8122('0x1'));var timeout=require('connect-timeout');var express=require(_0x8122('0x2'));var router=express[_0x8122('0x3')]();var auth=require(_0x8122('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8122('0x5'));module[_0x8122('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 825b754..4496c73 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 _0xfdb6=['STRING','DATE','sequelize','exports','INTEGER'];(function(_0x33a1c0,_0x146ed0){var _0x30c612=function(_0x3319a3){while(--_0x3319a3){_0x33a1c0['push'](_0x33a1c0['shift']());}};_0x30c612(++_0x146ed0);}(_0xfdb6,0x70));var _0x6fdb=function(_0x25b25a,_0x4805e8){_0x25b25a=_0x25b25a-0x0;var _0x41544c=_0xfdb6[_0x25b25a];return _0x41544c;};'use strict';var Sequelize=require(_0x6fdb('0x0'));module[_0x6fdb('0x1')]={'state':{'type':Sequelize[_0x6fdb('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x6fdb('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x6fdb('0x3')]},'starttime':{'type':Sequelize[_0x6fdb('0x4')]},'responsetime':{'type':Sequelize[_0x6fdb('0x4')]},'ringtime':{'type':Sequelize[_0x6fdb('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x6fdb('0x3')]},'campaigntype':{'type':Sequelize[_0x6fdb('0x3')]},'membername':{'type':Sequelize[_0x6fdb('0x3')]}}; \ No newline at end of file +var _0xd0f8=['sequelize','INTEGER','STRING','DATE'];(function(_0x331473,_0x28a760){var _0x3b2580=function(_0x52be96){while(--_0x52be96){_0x331473['push'](_0x331473['shift']());}};_0x3b2580(++_0x28a760);}(_0xd0f8,0x1e0));var _0x8d0f=function(_0x397699,_0x235d6c){_0x397699=_0x397699-0x0;var _0x4542b6=_0xd0f8[_0x397699];return _0x4542b6;};'use strict';var Sequelize=require(_0x8d0f('0x0'));module['exports']={'state':{'type':Sequelize[_0x8d0f('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x8d0f('0x2')]},'scheduledat':{'type':Sequelize[_0x8d0f('0x3')]},'uniqueid':{'type':Sequelize[_0x8d0f('0x2')]},'starttime':{'type':Sequelize[_0x8d0f('0x3')]},'responsetime':{'type':Sequelize[_0x8d0f('0x3')]},'ringtime':{'type':Sequelize[_0x8d0f('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x8d0f('0x2')]},'membername':{'type':Sequelize[_0x8d0f('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 0c5544e..d888217 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 _0xe3fb=['exports','define','ReportAgentPreview','report_agent_preview','../../config/logger','moment','request-promise'];(function(_0x323419,_0x2a6172){var _0x4c0be7=function(_0x5ae2df){while(--_0x5ae2df){_0x323419['push'](_0x323419['shift']());}};_0x4c0be7(++_0x2a6172);}(_0xe3fb,0x123));var _0xbe3f=function(_0x62a56f,_0x4cedeb){_0x62a56f=_0x62a56f-0x0;var _0x156be0=_0xe3fb[_0x62a56f];return _0x156be0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbe3f('0x0'))('api');var moment=require(_0xbe3f('0x1'));var BPromise=require('bluebird');var rp=require(_0xbe3f('0x2'));var attributes=require('./reportAgentPreview.attributes');module[_0xbe3f('0x3')]=function(_0x840d62,_0x4a3340){return _0x840d62[_0xbe3f('0x4')](_0xbe3f('0x5'),attributes,{'tableName':_0xbe3f('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x28d3=['api','moment','bluebird','request-promise','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','../../config/logger'];(function(_0x5b3950,_0x4e5556){var _0x41e436=function(_0x139e30){while(--_0x139e30){_0x5b3950['push'](_0x5b3950['shift']());}};_0x41e436(++_0x4e5556);}(_0x28d3,0xef));var _0x328d=function(_0x2a7c36,_0x3b442a){_0x2a7c36=_0x2a7c36-0x0;var _0x4bb498=_0x28d3[_0x2a7c36];return _0x4bb498;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x328d('0x0'))(_0x328d('0x1'));var moment=require(_0x328d('0x2'));var BPromise=require(_0x328d('0x3'));var rp=require(_0x328d('0x4'));var attributes=require(_0x328d('0x5'));module[_0x328d('0x6')]=function(_0x310b59,_0x195282){return _0x310b59[_0x328d('0x7')](_0x328d('0x8'),attributes,{'tableName':_0x328d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 95dbf79..54572d4 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 _0xddd1=['error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','CreateReportAgentPreview','create','options','raw','stringify','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0xddd1,0x1bb));var _0x1ddd=function(_0x392f18,_0x536485){_0x392f18=_0x392f18-0x0;var _0x46d46c=_0xddd1[_0x392f18];return _0x46d46c;};'use strict';var _=require(_0x1ddd('0x0'));var util=require(_0x1ddd('0x1'));var moment=require(_0x1ddd('0x2'));var BPromise=require(_0x1ddd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ddd('0x4'));var db=require(_0x1ddd('0x5'))['db'];var utils=require(_0x1ddd('0x6'));var logger=require(_0x1ddd('0x7'))(_0x1ddd('0x8'));var config=require(_0x1ddd('0x9'));var jayson=require(_0x1ddd('0xa'));var client=jayson[_0x1ddd('0xb')][_0x1ddd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d1419,_0x45509e,_0x530d2d){return new BPromise(function(_0x5b1fe3,_0x314f18){return client['request'](_0x1d1419,_0x530d2d)['then'](function(_0x206647){logger[_0x1ddd('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x45509e,_0x1ddd('0xe'));logger['debug'](_0x1ddd('0xf'),_0x45509e,_0x1ddd('0xe'),JSON['stringify'](_0x206647));if(_0x206647[_0x1ddd('0x10')]){if(_0x206647[_0x1ddd('0x10')][_0x1ddd('0x11')]===0x1f4){logger[_0x1ddd('0x10')](_0x1ddd('0x12'),_0x45509e,_0x206647[_0x1ddd('0x10')]['message']);return _0x314f18(_0x206647[_0x1ddd('0x10')][_0x1ddd('0x13')]);}logger[_0x1ddd('0x10')](_0x1ddd('0x12'),_0x45509e,_0x206647[_0x1ddd('0x10')]['message']);return _0x5b1fe3(_0x206647[_0x1ddd('0x10')][_0x1ddd('0x13')]);}else{logger[_0x1ddd('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x45509e,_0x1ddd('0xe'));_0x5b1fe3(_0x206647[_0x1ddd('0x14')]['message']);}})['catch'](function(_0x4817a1){logger['error'](_0x1ddd('0x12'),_0x45509e,_0x4817a1);_0x314f18(_0x4817a1);});});}exports[_0x1ddd('0x15')]=function(_0x4efa4b){var _0x4bfda1=this;return new Promise(function(_0x5a0de2,_0x41d27c){return db['ReportAgentPreview'][_0x1ddd('0x16')](_0x4efa4b['body'],{'raw':_0x4efa4b['options']?_0x4efa4b[_0x1ddd('0x17')][_0x1ddd('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x4ccb53){logger[_0x1ddd('0xd')](_0x1ddd('0x15'),_0x4efa4b);logger['debug'](_0x1ddd('0x15'),_0x4efa4b,JSON[_0x1ddd('0x19')](_0x4ccb53));_0x5a0de2(_0x4ccb53);})[_0x1ddd('0x1a')](function(_0x4e7a06){logger[_0x1ddd('0x10')](_0x1ddd('0x15'),_0x4e7a06[_0x1ddd('0x13')],_0x4efa4b);_0x41d27c(_0x4bfda1[_0x1ddd('0x10')](0x1f4,_0x4e7a06['message']));});});}; \ No newline at end of file +var _0x79d1=['ReportAgentPreview,\x20%s,\x20%s','message','catch','CreateReportAgentPreview','ReportAgentPreview','create','options','raw','debug','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x4f192e,_0x4d1756){var _0x49294d=function(_0x580ab3){while(--_0x580ab3){_0x4f192e['push'](_0x4f192e['shift']());}};_0x49294d(++_0x4d1756);}(_0x79d1,0x1a9));var _0x179d=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x79d1[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x179d('0x0'));var util=require('util');var moment=require(_0x179d('0x1'));var BPromise=require(_0x179d('0x2'));var rs=require(_0x179d('0x3'));var fs=require('fs');var Redis=require(_0x179d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x179d('0x5'));var logger=require(_0x179d('0x6'))(_0x179d('0x7'));var config=require('../../config/environment');var jayson=require(_0x179d('0x8'));var client=jayson['client'][_0x179d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1feade,_0x2c4b26,_0x95212a){return new BPromise(function(_0x23892b,_0x3d98a7){return client[_0x179d('0xa')](_0x1feade,_0x95212a)[_0x179d('0xb')](function(_0xcdf769){logger[_0x179d('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x2c4b26,_0x179d('0xd'));logger['debug'](_0x179d('0xe'),_0x2c4b26,_0x179d('0xd'),JSON['stringify'](_0xcdf769));if(_0xcdf769['error']){if(_0xcdf769['error'][_0x179d('0xf')]===0x1f4){logger[_0x179d('0x10')](_0x179d('0x11'),_0x2c4b26,_0xcdf769[_0x179d('0x10')][_0x179d('0x12')]);return _0x3d98a7(_0xcdf769[_0x179d('0x10')][_0x179d('0x12')]);}logger[_0x179d('0x10')](_0x179d('0x11'),_0x2c4b26,_0xcdf769[_0x179d('0x10')][_0x179d('0x12')]);return _0x23892b(_0xcdf769[_0x179d('0x10')][_0x179d('0x12')]);}else{logger['info'](_0x179d('0x11'),_0x2c4b26,'request\x20sent');_0x23892b(_0xcdf769['result'][_0x179d('0x12')]);}})[_0x179d('0x13')](function(_0x1ecaf2){logger[_0x179d('0x10')](_0x179d('0x11'),_0x2c4b26,_0x1ecaf2);_0x3d98a7(_0x1ecaf2);});});}exports[_0x179d('0x14')]=function(_0x48b29c){var _0x4df659=this;return new Promise(function(_0x3e8ff1,_0x256b24){return db[_0x179d('0x15')][_0x179d('0x16')](_0x48b29c['body'],{'raw':_0x48b29c[_0x179d('0x17')]?_0x48b29c[_0x179d('0x17')][_0x179d('0x18')]===undefined?!![]:![]:!![]})[_0x179d('0xb')](function(_0xe25820){logger['info'](_0x179d('0x14'),_0x48b29c);logger[_0x179d('0x19')](_0x179d('0x14'),_0x48b29c,JSON['stringify'](_0xe25820));_0x3e8ff1(_0xe25820);})[_0x179d('0x13')](function(_0x37cea8){logger[_0x179d('0x10')](_0x179d('0x14'),_0x37cea8[_0x179d('0x12')],_0x48b29c);_0x256b24(_0x4df659[_0x179d('0x10')](0x1f4,_0x37cea8[_0x179d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index cbc4331..5e8d88a 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 _0x340e=['/trunks','trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','openchannel','/openchannel/queues/:id','/sms/queues/:id','showSmsQueues','/agents/:id/notify','agentNotify','multer','path','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','get','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','put','agentCapacity','/telephones','telephones'];(function(_0x400143,_0x336bc6){var _0x46aa59=function(_0x1ff6e7){while(--_0x1ff6e7){_0x400143['push'](_0x400143['shift']());}};_0x46aa59(++_0x336bc6);}(_0x340e,0x1dc));var _0xe340=function(_0xfa3d38,_0x45be2e){_0xfa3d38=_0xfa3d38-0x0;var _0x2b337d=_0x340e[_0xfa3d38];return _0x2b337d;};'use strict';var multer=require(_0xe340('0x0'));var util=require('util');var path=require(_0xe340('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0xe340('0x2'));var controller=require(_0xe340('0x3'));router['get'](_0xe340('0x4'),auth[_0xe340('0x5')](),controller[_0xe340('0x6')]);router['get'](_0xe340('0x7'),auth['isAuthenticated'](),controller[_0xe340('0x8')]);router[_0xe340('0x9')](_0xe340('0xa'),auth[_0xe340('0x5')](),controller[_0xe340('0xb')]);router['get'](_0xe340('0xc'),auth[_0xe340('0x5')](),controller[_0xe340('0xd')]);router['get'](_0xe340('0xe'),auth[_0xe340('0x5')](),controller[_0xe340('0xf')]);router[_0xe340('0x9')]('/mail/queues',auth[_0xe340('0x5')](),controller[_0xe340('0x10')]);router[_0xe340('0x9')](_0xe340('0x11'),auth[_0xe340('0x5')](),controller[_0xe340('0x12')]);router[_0xe340('0x9')]('/openchannel/queues',auth[_0xe340('0x5')](),controller[_0xe340('0x13')]);router[_0xe340('0x9')](_0xe340('0x14'),auth[_0xe340('0x5')](),controller['smsQueues']);router[_0xe340('0x9')](_0xe340('0x15'),auth['isAuthenticated'](),controller[_0xe340('0x16')]);router[_0xe340('0x9')](_0xe340('0x17'),auth[_0xe340('0x5')](),controller[_0xe340('0x18')]);router[_0xe340('0x9')](_0xe340('0x19'),auth[_0xe340('0x5')](),controller[_0xe340('0x1a')]);router[_0xe340('0x9')]('/voice/queues/channels/:uniqueid',auth[_0xe340('0x5')](),controller[_0xe340('0x1b')]);router[_0xe340('0x9')](_0xe340('0x1c'),auth[_0xe340('0x5')](),controller['voiceQueuesChannelHangup']);router[_0xe340('0x9')](_0xe340('0x1d'),auth[_0xe340('0x5')](),controller[_0xe340('0x1e')]);router[_0xe340('0x9')]('/voice/queues/:id',auth[_0xe340('0x5')](),controller[_0xe340('0x1f')]);router[_0xe340('0x9')](_0xe340('0x20'),auth[_0xe340('0x5')](),controller[_0xe340('0x21')]);router[_0xe340('0x9')](_0xe340('0x22'),auth[_0xe340('0x5')](),controller[_0xe340('0x23')]);router[_0xe340('0x9')](_0xe340('0x24'),auth['isAuthenticated'](),controller[_0xe340('0x25')]);router[_0xe340('0x26')]('/agents/:id/capacity',auth[_0xe340('0x5')](),controller[_0xe340('0x27')]);router[_0xe340('0x9')](_0xe340('0x28'),auth[_0xe340('0x5')](),controller[_0xe340('0x29')]);router['get'](_0xe340('0x2a'),auth['isAuthenticated'](),controller[_0xe340('0x2b')]);router[_0xe340('0x9')](_0xe340('0x2c'),auth[_0xe340('0x5')](),controller[_0xe340('0x2d')]);router[_0xe340('0x9')]('/fax/accounts',auth[_0xe340('0x5')](),controller[_0xe340('0x2e')]);router[_0xe340('0x9')](_0xe340('0x2f'),auth['isAuthenticated'](),controller[_0xe340('0x30')]);router[_0xe340('0x9')](_0xe340('0x31'),auth[_0xe340('0x5')](),controller[_0xe340('0x32')]);router['get'](_0xe340('0x33'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0xe340('0x9')]('/sms/queues/waitinginteractions',auth[_0xe340('0x5')](),controller[_0xe340('0x34')]);router['get'](_0xe340('0x35'),auth[_0xe340('0x5')](),controller[_0xe340('0x36')]);router[_0xe340('0x37')](_0xe340('0x38'),auth[_0xe340('0x5')](),controller['queueNotify'](_0xe340('0x39')));router['get'](_0xe340('0x3a'),auth[_0xe340('0x5')](),controller[_0xe340('0x3b')]);router[_0xe340('0x37')](_0xe340('0x3c'),auth[_0xe340('0x5')](),controller[_0xe340('0x3d')](_0xe340('0x3e')));router[_0xe340('0x9')](_0xe340('0x3f'),auth[_0xe340('0x5')](),controller[_0xe340('0x40')]);router[_0xe340('0x37')](_0xe340('0x41'),auth[_0xe340('0x5')](),controller[_0xe340('0x3d')](_0xe340('0x42')));router[_0xe340('0x9')]('/fax/queues/:id',auth[_0xe340('0x5')](),controller[_0xe340('0x43')]);router[_0xe340('0x37')]('/openchannel/queues/:id/notify',auth[_0xe340('0x5')](),controller[_0xe340('0x3d')](_0xe340('0x44')));router[_0xe340('0x9')](_0xe340('0x45'),auth['isAuthenticated'](),controller['showOpenchannelQueues']);router[_0xe340('0x37')]('/sms/queues/:id/notify',auth['isAuthenticated'](),controller[_0xe340('0x3d')]('sms'));router[_0xe340('0x9')](_0xe340('0x46'),auth[_0xe340('0x5')](),controller[_0xe340('0x47')]);router[_0xe340('0x37')](_0xe340('0x48'),auth['isAuthenticated'](),controller[_0xe340('0x49')]);module['exports']=router; \ No newline at end of file +var _0x6972=['smsQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/sms/queues/:id','/agents/:id/notify','multer','path','express','Router','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','/mail/queues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','/fax/queues','faxQueues','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','outbound','outboundChannels','/agents','agents','put','agentCapacity','/telephones','/trunks','trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions'];(function(_0x13bf70,_0x1d6a0b){var _0x2d1e30=function(_0x42e490){while(--_0x42e490){_0x13bf70['push'](_0x13bf70['shift']());}};_0x2d1e30(++_0x1d6a0b);}(_0x6972,0x173));var _0x2697=function(_0x341a1a,_0x19cdf5){_0x341a1a=_0x341a1a-0x0;var _0x2b8742=_0x6972[_0x341a1a];return _0x2b8742;};'use strict';var multer=require(_0x2697('0x0'));var util=require('util');var path=require(_0x2697('0x1'));var express=require(_0x2697('0x2'));var router=express[_0x2697('0x3')]();var auth=require('../../components/auth/service');var controller=require(_0x2697('0x4'));router[_0x2697('0x5')]('/voice/channels',auth[_0x2697('0x6')](),controller[_0x2697('0x7')]);router[_0x2697('0x5')](_0x2697('0x8'),auth[_0x2697('0x6')](),controller[_0x2697('0x9')]);router[_0x2697('0x5')](_0x2697('0xa'),auth[_0x2697('0x6')](),controller[_0x2697('0xb')]);router[_0x2697('0x5')](_0x2697('0xc'),auth[_0x2697('0x6')](),controller['voiceQueues']);router[_0x2697('0x5')](_0x2697('0xd'),auth[_0x2697('0x6')](),controller['chatQueues']);router[_0x2697('0x5')](_0x2697('0xe'),auth[_0x2697('0x6')](),controller['mailQueues']);router[_0x2697('0x5')](_0x2697('0xf'),auth[_0x2697('0x6')](),controller[_0x2697('0x10')]);router[_0x2697('0x5')](_0x2697('0x11'),auth[_0x2697('0x6')](),controller[_0x2697('0x12')]);router[_0x2697('0x5')]('/sms/queues',auth[_0x2697('0x6')](),controller[_0x2697('0x13')]);router[_0x2697('0x5')](_0x2697('0x14'),auth[_0x2697('0x6')](),controller[_0x2697('0x15')]);router[_0x2697('0x5')]('/voice/queues/preview/:id',auth[_0x2697('0x6')](),controller['voiceQueuesPreview']);router[_0x2697('0x5')](_0x2697('0x16'),auth['isAuthenticated'](),controller[_0x2697('0x17')]);router[_0x2697('0x5')](_0x2697('0x18'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router['get'](_0x2697('0x19'),auth[_0x2697('0x6')](),controller[_0x2697('0x1a')]);router[_0x2697('0x5')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x2697('0x6')](),controller[_0x2697('0x1b')]);router[_0x2697('0x5')](_0x2697('0x1c'),auth['isAuthenticated'](),controller[_0x2697('0x1d')]);router[_0x2697('0x5')](_0x2697('0x1e'),auth[_0x2697('0x6')](),controller[_0x2697('0x1f')]);router['get']('/outbound/channels',auth['isAuthenticated'](),controller[_0x2697('0x20')]);router[_0x2697('0x5')](_0x2697('0x21'),auth[_0x2697('0x6')](),controller[_0x2697('0x22')]);router[_0x2697('0x23')]('/agents/:id/capacity',auth[_0x2697('0x6')](),controller[_0x2697('0x24')]);router[_0x2697('0x5')](_0x2697('0x25'),auth[_0x2697('0x6')](),controller['telephones']);router['get'](_0x2697('0x26'),auth[_0x2697('0x6')](),controller[_0x2697('0x27')]);router[_0x2697('0x5')](_0x2697('0x28'),auth[_0x2697('0x6')](),controller['campaigns']);router[_0x2697('0x5')](_0x2697('0x29'),auth[_0x2697('0x6')](),controller[_0x2697('0x2a')]);router[_0x2697('0x5')](_0x2697('0x2b'),auth[_0x2697('0x6')](),controller['chatQueuesWaitingInteractions']);router[_0x2697('0x5')](_0x2697('0x2c'),auth[_0x2697('0x6')](),controller[_0x2697('0x2d')]);router[_0x2697('0x5')](_0x2697('0x2e'),auth[_0x2697('0x6')](),controller[_0x2697('0x2f')]);router[_0x2697('0x5')](_0x2697('0x30'),auth[_0x2697('0x6')](),controller[_0x2697('0x31')]);router[_0x2697('0x5')]('/fax/queues/waitinginteractions',auth[_0x2697('0x6')](),controller['faxQueuesWaitingInteractions']);router[_0x2697('0x32')](_0x2697('0x33'),auth[_0x2697('0x6')](),controller[_0x2697('0x34')](_0x2697('0x35')));router['get']('/mail/queues/:id',auth['isAuthenticated'](),controller[_0x2697('0x36')]);router[_0x2697('0x32')](_0x2697('0x37'),auth[_0x2697('0x6')](),controller[_0x2697('0x34')](_0x2697('0x38')));router[_0x2697('0x5')](_0x2697('0x39'),auth[_0x2697('0x6')](),controller['showChatQueues']);router[_0x2697('0x32')](_0x2697('0x3a'),auth[_0x2697('0x6')](),controller['queueNotify'](_0x2697('0x3b')));router['get'](_0x2697('0x3c'),auth['isAuthenticated'](),controller[_0x2697('0x3d')]);router['post'](_0x2697('0x3e'),auth[_0x2697('0x6')](),controller[_0x2697('0x34')](_0x2697('0x3f')));router[_0x2697('0x5')](_0x2697('0x40'),auth['isAuthenticated'](),controller[_0x2697('0x41')]);router[_0x2697('0x32')](_0x2697('0x42'),auth[_0x2697('0x6')](),controller[_0x2697('0x34')](_0x2697('0x43')));router[_0x2697('0x5')](_0x2697('0x44'),auth[_0x2697('0x6')](),controller['showSmsQueues']);router[_0x2697('0x32')](_0x2697('0x45'),auth[_0x2697('0x6')](),controller['agentNotify']);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 ac8fd75..b8af994 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 _0xe65b=['queueTransferTimeout','*,*,*,*','channel','chat','Website','User','Agent\x20not\x20found','\x20Message\x20not\x20found','update','TransferReport','Start','agentTransferTimeout','lodash','../../mysqldb','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','sendStatus','stack','name','send','isNil','rows','voiceChannels','VoiceChannels','query','VoiceChannelMixMonitor','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','user','interaction','hasOwnProperty','MemberReport','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','faxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','findOne','Message','messageId','Interaction','MessageId','InteractionId','From','Account','QueueId','create','queue'];(function(_0x529c2e,_0x321a8d){var _0xd620e7=function(_0x5ba812){while(--_0x5ba812){_0x529c2e['push'](_0x529c2e['shift']());}};_0xd620e7(++_0x321a8d);}(_0xe65b,0x153));var _0xbe65=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xe65b[_0x2be8c2];return _0x97f531;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0xbe65('0x0'));var util=require('util');var db=require(_0xbe65('0x1'))['db'];var logger=require('../../config/logger')(_0xbe65('0x2'));var jayson=require(_0xbe65('0x3'));var amiClient=jayson[_0xbe65('0x4')][_0xbe65('0x5')]({'port':0x232a});var mailClient=jayson['client'][_0xbe65('0x5')]({'port':0x232b});var routingClient=jayson[_0xbe65('0x4')][_0xbe65('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x2a527e,_0x2145a3,_0x44ed95){return new BPromise(function(_0x4d5c95,_0x93845f){var _0x2e2cfb=_0x44ed95?_0x44ed95:amiClient;return _0x2e2cfb[_0xbe65('0x6')](_0x2a527e,_0x2145a3)[_0xbe65('0x7')](function(_0x365963){if(_0x365963[_0xbe65('0x8')]){if(_0x365963['error'][_0xbe65('0x9')]===0x1f4){return _0x93845f(_0x365963[_0xbe65('0x8')][_0xbe65('0xa')]);}return _0x4d5c95(_0x365963['error'][_0xbe65('0xa')]);}else{_0x4d5c95(_0x365963[_0xbe65('0xb')]);}})[_0xbe65('0xc')](function(_0x3d3f8e){_0x93845f(_0x3d3f8e);});});}function respondWithResult(_0x1ee652,_0x3fe754){_0x3fe754=_0x3fe754||0xc8;return function(_0x41e8cf){if(_0x41e8cf){return _0x1ee652[_0xbe65('0xd')](_0x3fe754)['json'](_0x41e8cf);}return _0x1ee652[_0xbe65('0xe')](0x194);};}function handleError(_0x133927,_0x4f0c1e){_0x4f0c1e=_0x4f0c1e||0x1f4;return function(_0x308439){logger[_0xbe65('0x8')](_0x308439[_0xbe65('0xf')]);if(_0x308439['name']){delete _0x308439[_0xbe65('0x10')];}_0x133927[_0xbe65('0xd')](_0x4f0c1e)[_0xbe65('0x11')](_0x308439);};}function findById(_0x1e5e65){return function(_0x49eb9d){if(!_[_0xbe65('0x12')](_0x1e5e65)&&!_[_0xbe65('0x12')](_0x49eb9d)&&!_[_0xbe65('0x12')](_0x49eb9d[_0xbe65('0x13')])){return _['find'](_0x49eb9d['rows'],function(_0x10f3cc){return _0x10f3cc['id']==_0x1e5e65;});}return null;};}exports[_0xbe65('0x14')]=function(_0x4477c1,_0x19dd02){return respondWithRpcPromise(_0xbe65('0x15'),_0x4477c1[_0xbe65('0x16')])[_0xbe65('0x7')](respondWithResult(_0x19dd02,null))[_0xbe65('0xc')](handleError(_0x19dd02,null));};exports['voiceChannelMixMonitor']=function(_0x12fb71,_0x4cd1d7){return respondWithRpcPromise(_0xbe65('0x17'),_['merge'](_0x12fb71[_0xbe65('0x16')],_0x12fb71[_0xbe65('0x18')]))[_0xbe65('0x7')](respondWithResult(_0x4cd1d7,null))[_0xbe65('0xc')](handleError(_0x4cd1d7,null));};exports[_0xbe65('0x19')]=function(_0x4c902a,_0x6efab1){return respondWithRpcPromise(_0xbe65('0x1a'),_[_0xbe65('0x1b')](_0x4c902a[_0xbe65('0x16')],_0x4c902a['params']))[_0xbe65('0x7')](respondWithResult(_0x6efab1,null))[_0xbe65('0xc')](handleError(_0x6efab1,null));};exports[_0xbe65('0x1c')]=function(_0x23704d,_0x530861){return respondWithRpcPromise(_0xbe65('0x1d'),_0x23704d['query'])[_0xbe65('0x7')](respondWithResult(_0x530861,null))[_0xbe65('0xc')](handleError(_0x530861,null));};exports[_0xbe65('0x1e')]=function(_0x19c5df,_0xca4de){return respondWithRpcPromise(_0xbe65('0x1d'),_0x19c5df['query'])[_0xbe65('0x7')](findById(_0x19c5df[_0xbe65('0x18')]['id']))[_0xbe65('0x7')](respondWithResult(_0xca4de,null))[_0xbe65('0xc')](handleError(_0xca4de,null));};exports['voiceQueuesPreview']=function(_0x46e940,_0x1e1d07){return respondWithRpcPromise(_0xbe65('0x1f'),_[_0xbe65('0x1b')](_0x46e940['query'],_0x46e940[_0xbe65('0x18')]))['then'](respondWithResult(_0x1e1d07,null))[_0xbe65('0xc')](handleError(_0x1e1d07,null));};exports[_0xbe65('0x20')]=function(_0x700dee,_0x59038c){return respondWithRpcPromise(_0xbe65('0x21'),_0x700dee['query'])['then'](respondWithResult(_0x59038c,null))[_0xbe65('0xc')](handleError(_0x59038c,null));};exports['voiceQueuesChannel']=function(_0x183b89,_0xd7c538){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x183b89[_0xbe65('0x16')],_0x183b89[_0xbe65('0x18')]))[_0xbe65('0x7')](respondWithResult(_0xd7c538,null))[_0xbe65('0xc')](handleError(_0xd7c538,null));};exports[_0xbe65('0x22')]=function(_0x11b12a,_0x51f5d4){return respondWithRpcPromise(_0xbe65('0x23'),_[_0xbe65('0x1b')](_0x11b12a[_0xbe65('0x16')],_0x11b12a[_0xbe65('0x18')]))[_0xbe65('0x7')](respondWithResult(_0x51f5d4,null))[_0xbe65('0xc')](handleError(_0x51f5d4,null));};exports[_0xbe65('0x24')]=function(_0x3e4369,_0x476b9c){return respondWithRpcPromise(_0xbe65('0x25'),_[_0xbe65('0x1b')](_0x3e4369[_0xbe65('0x16')],_0x3e4369[_0xbe65('0x18')]))[_0xbe65('0x7')](respondWithResult(_0x476b9c,null))[_0xbe65('0xc')](handleError(_0x476b9c,null));};exports['outbound']=function(_0x2eced2,_0x25016e){return respondWithRpcPromise(_0xbe65('0x26'),_0x2eced2[_0xbe65('0x16')])[_0xbe65('0x7')](respondWithResult(_0x25016e,null))[_0xbe65('0xc')](handleError(_0x25016e,null));};exports[_0xbe65('0x27')]=function(_0x4b2842,_0x4c41e0){return respondWithRpcPromise(_0xbe65('0x28'),_0x4b2842[_0xbe65('0x16')])['then'](respondWithResult(_0x4c41e0,null))[_0xbe65('0xc')](handleError(_0x4c41e0,null));};exports[_0xbe65('0x29')]=function(_0x8e2afb,_0x197991){var _0x5dca2f;return respondWithRpcPromise(_0xbe65('0x2a'),_0x8e2afb[_0xbe65('0x16')])[_0xbe65('0x7')](function(_0x45e2aa){_0x5dca2f=_0x45e2aa;return respondWithRpcPromise(_0xbe65('0x2a'),_0x8e2afb[_0xbe65('0x16')],routingClient);})[_0xbe65('0x7')](function(_0x5b66e4){return _[_0xbe65('0x1b')]({},_0x5b66e4,_0x5dca2f);})[_0xbe65('0x7')](respondWithResult(_0x197991,null))[_0xbe65('0xc')](handleError(_0x197991,null));};exports[_0xbe65('0x2b')]=function(_0x2fa04c,_0x94e7d7){if(_0x2fa04c[_0xbe65('0x2c')]&&_0x2fa04c[_0xbe65('0x2c')]['interaction']&&_0x2fa04c['user']&&_0x2fa04c[_0xbe65('0x2d')]['name']){for(var _0x2baf7f in _0x2fa04c[_0xbe65('0x2c')][_0xbe65('0x2e')]){if(_0x2fa04c[_0xbe65('0x2c')][_0xbe65('0x2e')][_0xbe65('0x2f')](_0x2baf7f)){db[_0xbe65('0x30')]['findAll']({'where':{'channel':_0x2baf7f,'membername':_0x2fa04c[_0xbe65('0x2d')]['name'],'type':_0xbe65('0x31'),'exitAt':null,'uniqueid':_0x2fa04c['body']['interaction'][_0x2baf7f]&&_0x2fa04c[_0xbe65('0x2c')][_0xbe65('0x2e')][_0x2baf7f][_0xbe65('0x32')]?{'$notIn':_0x2fa04c[_0xbe65('0x2c')][_0xbe65('0x2e')][_0x2baf7f]}:{'$ne':null}}})[_0xbe65('0x7')](function(_0x5d52fc){var _0x4c740a=moment()[_0xbe65('0x33')](_0xbe65('0x34'));for(var _0x3f2f20=0x0,_0x5bf50d=_0x5d52fc[_0xbe65('0x32')];_0x3f2f20<_0x5bf50d;_0x3f2f20+=0x1){_0x5d52fc[_0x3f2f20]['updateAttributes']({'exitAt':_0x4c740a});}});for(var _0xc361f8=0x0;_0xc361f8<_0x2fa04c[_0xbe65('0x2c')][_0xbe65('0x2e')][_0x2baf7f][_0xbe65('0x32')];_0xc361f8+=0x1){db[_0xbe65('0x30')][_0xbe65('0x35')]({'where':{'channel':_0x2baf7f,'membername':_0x2fa04c[_0xbe65('0x2d')][_0xbe65('0x10')],'type':'INTERACTION','uniqueid':_0x2fa04c[_0xbe65('0x2c')][_0xbe65('0x2e')][_0x2baf7f][_0xc361f8],'exitAt':null},'defaults':{'channel':_0x2baf7f,'membername':_0x2fa04c['user'][_0xbe65('0x10')],'interface':_[_0xbe65('0x12')](_0x2fa04c['user'][_0xbe65('0x36')])?util['format'](_0xbe65('0x37'),_0x2fa04c[_0xbe65('0x2d')][_0xbe65('0x10')]):_0x2fa04c[_0xbe65('0x2d')]['interface'],'type':'INTERACTION','enterAt':moment()[_0xbe65('0x33')](_0xbe65('0x34')),'role':_0xbe65('0x38'),'internal':_0x2fa04c['user'][_0xbe65('0x39')],'uniqueid':_0x2fa04c[_0xbe65('0x2c')][_0xbe65('0x2e')][_0x2baf7f][_0xc361f8]}});}}}}return respondWithRpcPromise(_0xbe65('0x3a'),{'id':_0x2fa04c[_0xbe65('0x18')]['id'],'capacity':_0x2fa04c[_0xbe65('0x2c')][_0xbe65('0x3b')]},routingClient)[_0xbe65('0x7')](respondWithResult(_0x94e7d7,null))[_0xbe65('0xc')](handleError(_0x94e7d7,null));};exports[_0xbe65('0x3c')]=function(_0x193fe7,_0x18378f){return respondWithRpcPromise(_0xbe65('0x3d'),_0x193fe7[_0xbe65('0x16')])[_0xbe65('0x7')](respondWithResult(_0x18378f,null))[_0xbe65('0xc')](handleError(_0x18378f,null));};exports['trunks']=function(_0x3b49c7,_0x361d38){return respondWithRpcPromise('Trunks',_0x3b49c7[_0xbe65('0x16')])[_0xbe65('0x7')](respondWithResult(_0x361d38,null))[_0xbe65('0xc')](handleError(_0x361d38,null));};exports[_0xbe65('0x3e')]=function(_0x1f3a36,_0xe0f938){return respondWithRpcPromise(_0xbe65('0x3f'),_0x1f3a36[_0xbe65('0x16')])[_0xbe65('0x7')](respondWithResult(_0xe0f938,null))[_0xbe65('0xc')](handleError(_0xe0f938,null));};exports[_0xbe65('0x40')]=function(_0x4a7e91,_0x25b2d1){return respondWithRpcPromise(_0xbe65('0x41'),_0x4a7e91[_0xbe65('0x16')],routingClient)[_0xbe65('0x7')](respondWithResult(_0x25b2d1,null))[_0xbe65('0xc')](handleError(_0x25b2d1,null));};exports[_0xbe65('0x42')]=function(_0x3d1b50,_0x5141f5){return respondWithRpcPromise('ChatQueues',_0x3d1b50['query'],routingClient)[_0xbe65('0x7')](findById(_0x3d1b50['params']['id']))['then'](respondWithResult(_0x5141f5,null))[_0xbe65('0xc')](handleError(_0x5141f5,null));};exports[_0xbe65('0x43')]=function(_0x2bff13,_0x10c369){return respondWithRpcPromise(_0xbe65('0x44'),_0x2bff13[_0xbe65('0x16')],routingClient)[_0xbe65('0x7')](respondWithResult(_0x10c369,null))[_0xbe65('0xc')](handleError(_0x10c369,null));};exports['showMailQueues']=function(_0x32e442,_0x13741a){return respondWithRpcPromise('MailQueues',_0x32e442[_0xbe65('0x16')],routingClient)[_0xbe65('0x7')](findById(_0x32e442['params']['id']))[_0xbe65('0x7')](respondWithResult(_0x13741a,null))[_0xbe65('0xc')](handleError(_0x13741a,null));};exports[_0xbe65('0x45')]=function(_0x5dea53,_0x830cc3){return respondWithRpcPromise('MailAccounts',_0x5dea53[_0xbe65('0x16')],mailClient)[_0xbe65('0x7')](respondWithResult(_0x830cc3,null))['catch'](handleError(_0x830cc3,null));};exports['openchannelQueues']=function(_0x3b77ee,_0x159a63){return respondWithRpcPromise(_0xbe65('0x46'),_0x3b77ee[_0xbe65('0x16')],routingClient)[_0xbe65('0x7')](respondWithResult(_0x159a63,null))[_0xbe65('0xc')](handleError(_0x159a63,null));};exports[_0xbe65('0x47')]=function(_0x16bc8c,_0x3a9f06){return respondWithRpcPromise(_0xbe65('0x46'),_0x16bc8c[_0xbe65('0x16')],routingClient)[_0xbe65('0x7')](findById(_0x16bc8c[_0xbe65('0x18')]['id']))['then'](respondWithResult(_0x3a9f06,null))[_0xbe65('0xc')](handleError(_0x3a9f06,null));};exports[_0xbe65('0x48')]=function(_0x547235,_0x5d6543){return respondWithRpcPromise('SmsQueues',_0x547235[_0xbe65('0x16')],routingClient)[_0xbe65('0x7')](respondWithResult(_0x5d6543,null))[_0xbe65('0xc')](handleError(_0x5d6543,null));};exports[_0xbe65('0x49')]=function(_0x2308ef,_0x1ad411){return respondWithRpcPromise('SmsQueues',_0x2308ef[_0xbe65('0x16')],routingClient)[_0xbe65('0x7')](findById(_0x2308ef[_0xbe65('0x18')]['id']))['then'](respondWithResult(_0x1ad411,null))[_0xbe65('0xc')](handleError(_0x1ad411,null));};exports[_0xbe65('0x4a')]=function(_0x15b7b4,_0x682764){return respondWithRpcPromise('FaxQueues',_0x15b7b4[_0xbe65('0x16')],routingClient)[_0xbe65('0x7')](respondWithResult(_0x682764,null))[_0xbe65('0xc')](handleError(_0x682764,null));};exports['showFaxQueues']=function(_0x272de1,_0x5207ca){return respondWithRpcPromise('FaxQueues',_0x272de1[_0xbe65('0x16')],routingClient)[_0xbe65('0x7')](findById(_0x272de1[_0xbe65('0x18')]['id']))[_0xbe65('0x7')](respondWithResult(_0x5207ca,null))['catch'](handleError(_0x5207ca,null));};exports['faxAccounts']=function(_0x4328ce,_0x10bac1){return respondWithRpcPromise(_0xbe65('0x4b'),_0x4328ce[_0xbe65('0x16')])['then'](respondWithResult(_0x10bac1,null))[_0xbe65('0xc')](handleError(_0x10bac1,null));};exports[_0xbe65('0x4c')]=function(_0x381426,_0x39d502){return respondWithRpcPromise(_0xbe65('0x4d'),_0x381426['query'],routingClient)[_0xbe65('0x7')](respondWithResult(_0x39d502,null))[_0xbe65('0xc')](handleError(_0x39d502,null));};exports[_0xbe65('0x4e')]=function(_0x45eb3e,_0x23f310){return respondWithRpcPromise(_0xbe65('0x4f'),_0x45eb3e[_0xbe65('0x16')],routingClient)['then'](respondWithResult(_0x23f310,null))[_0xbe65('0xc')](handleError(_0x23f310,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x310281,_0x392e49){return respondWithRpcPromise(_0xbe65('0x50'),_0x310281[_0xbe65('0x16')],routingClient)['then'](respondWithResult(_0x392e49,null))['catch'](handleError(_0x392e49,null));};exports[_0xbe65('0x51')]=function(_0x4e74f0,_0x553974){return respondWithRpcPromise(_0xbe65('0x52'),_0x4e74f0[_0xbe65('0x16')],routingClient)['then'](respondWithResult(_0x553974,null))[_0xbe65('0xc')](handleError(_0x553974,null));};exports[_0xbe65('0x53')]=function(_0x53c8b5,_0x438077){return respondWithRpcPromise(_0xbe65('0x54'),_0x53c8b5[_0xbe65('0x16')],routingClient)['then'](respondWithResult(_0x438077,null))['catch'](handleError(_0x438077,null));};exports['queueNotify']=function(_0x420e26){return function(_0x32b0f2,_0x55a32a){var _0x56bd83,_0x138325;var _0x4b75bc=_[_0xbe65('0x55')](_0x420e26);var _0x3b0ac2=_0x420e26==='chat'?'Website':'Account';return db[_0x4b75bc+'Queue'][_0xbe65('0x56')]({'raw':!![],'where':{'id':_0x32b0f2['params']['id']}})[_0xbe65('0x7')](function(_0xf5d6e7){if(_[_0xbe65('0x12')](_0xf5d6e7)){throw new Error(_0x4b75bc+'\x20Queue\x20not\x20found');}_0x56bd83=_0xf5d6e7;return db[_0x4b75bc+_0xbe65('0x57')][_0xbe65('0x56')]({'where':{'id':_0x32b0f2[_0xbe65('0x2c')][_0xbe65('0x58')]},'include':[{'model':db[_0x4b75bc+'Interaction'],'as':_0xbe65('0x59')},{'model':db[_0x4b75bc+_0x3b0ac2],'as':'Account'}]});})[_0xbe65('0x7')](function(_0xb61382){if(_['isNil'](_0xb61382)){throw new Error(_0x4b75bc+'\x20Message\x20not\x20found');}_0x138325=_0xb61382;return _0xb61382['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xbe65('0x7')](function(){var _0x2f2bc1={'uniqueid':_0x420e26+'.'+_0x138325['id']+'.'+_0x138325[_0xbe65('0x59')]['id'],'FromUserId':_0x32b0f2[_0xbe65('0x2d')]['id'],'type':'queue'};_0x2f2bc1[_0x4b75bc+_0xbe65('0x5a')]=_0x138325['id'];_0x2f2bc1[_0x4b75bc+_0xbe65('0x5b')]=_0x138325['Interaction']['id'];_0x2f2bc1[_0xbe65('0x5c')+_0x4b75bc+_0x3b0ac2+'Id']=_0x138325[_0xbe65('0x5d')]['id'];_0x2f2bc1['To'+_0x4b75bc+_0xbe65('0x5e')]=_0x56bd83['id'];return db[_0x4b75bc+'TransferReport'][_0xbe65('0x5f')](_0x2f2bc1);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x420e26,'interaction':_0x138325['Interaction'],'message':_0x138325,'account':_0x138325[_0xbe65('0x5d')],'applications':[{'id':0x0,'priority':0x1,'app':_0xbe65('0x60'),'appdata':_0x56bd83['name']+','+(_0x138325['Account'][_0xbe65('0x61')]||0x12c),'interval':_0xbe65('0x62')}]},routingClient);})[_0xbe65('0x7')](respondWithResult(_0x55a32a,null))[_0xbe65('0xc')](handleError(_0x55a32a,null));};};exports['agentNotify']=function(_0x4e4df5,_0x4e3aa5){var _0x5e0f04,_0xf4619b;if(_['isNil'](_0x4e4df5[_0xbe65('0x2c')][_0xbe65('0x63')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x38803b=_0x4e4df5[_0xbe65('0x2c')][_0xbe65('0x63')];var _0x28ccca=_[_0xbe65('0x55')](_0x38803b);var _0x1da57a=_0x38803b===_0xbe65('0x64')?_0xbe65('0x65'):_0xbe65('0x5d');return db[_0xbe65('0x66')]['findOne']({'raw':!![],'where':{'id':_0x4e4df5[_0xbe65('0x18')]['id'],'role':_0xbe65('0x38')}})['then'](function(_0x4934bb){if(_[_0xbe65('0x12')](_0x4934bb)){throw new Error(_0xbe65('0x67'));}_0x5e0f04=_0x4934bb;return db[_0x28ccca+_0xbe65('0x57')][_0xbe65('0x56')]({'where':{'id':_0x4e4df5[_0xbe65('0x2c')]['messageId']},'include':[{'model':db[_0x28ccca+_0xbe65('0x59')],'as':'Interaction'},{'model':db[_0x28ccca+_0x1da57a],'as':'Account'}]});})['then'](function(_0x16e493){if(_['isNil'](_0x16e493)){throw new Error(_0x28ccca+_0xbe65('0x68'));}_0xf4619b=_0x16e493;return _0x16e493[_0xbe65('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0xbe65('0x7')](function(){var _0x321966={'uniqueid':_0x38803b+'.'+_0xf4619b['id']+'.'+_0xf4619b[_0xbe65('0x59')]['id'],'FromUserId':_0x4e4df5[_0xbe65('0x2d')]['id'],'type':_0xbe65('0x60'),'ToUserId':_0x5e0f04['id']};_0x321966[_0x28ccca+_0xbe65('0x5a')]=_0xf4619b['id'];_0x321966[_0x28ccca+_0xbe65('0x5b')]=_0xf4619b[_0xbe65('0x59')]['id'];_0x321966['From'+_0x28ccca+_0x1da57a+'Id']=_0xf4619b[_0xbe65('0x5d')]['id'];return db[_0x28ccca+_0xbe65('0x6a')][_0xbe65('0x5f')](_0x321966);})['then'](function(){return respondWithRpcPromise(_0xbe65('0x6b'),{'channel':_0x38803b,'interaction':_0xf4619b[_0xbe65('0x59')],'message':_0xf4619b,'account':_0xf4619b[_0xbe65('0x5d')],'applications':[{'id':0x0,'priority':0x1,'app':_0xbe65('0x38'),'appdata':_0x5e0f04[_0xbe65('0x10')]+','+(_0xf4619b[_0xbe65('0x5d')][_0xbe65('0x6c')]||0x12c),'interval':_0xbe65('0x62')}]},routingClient);})[_0xbe65('0x7')](respondWithResult(_0x4e3aa5,null))[_0xbe65('0xc')](handleError(_0x4e3aa5,null));}; \ No newline at end of file +var _0xcd3b=['isNil','rows','find','voiceChannels','VoiceChannels','query','catch','voiceChannelMixMonitor','merge','params','then','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','MemberReport','findAll','INTERACTION','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','interface','format','agent','capacity','telephones','Telephones','trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Website','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','Account','update','queue','InteractionId','From','QueueId','create','Start','queueTransferTimeout','agentNotify','channel','capitalize','User','Agent\x20not\x20found','\x20Message\x20not\x20found','TransferReport','*,*,*,*','lodash','util','api','jayson/promise','client','http','request','error','code','message','result','status','json','stack','name','send'];(function(_0x20a29a,_0x1730a0){var _0x4396f9=function(_0x2619e7){while(--_0x2619e7){_0x20a29a['push'](_0x20a29a['shift']());}};_0x4396f9(++_0x1730a0);}(_0xcd3b,0xc8));var _0xbcd3=function(_0x275a12,_0x30cee3){_0x275a12=_0x275a12-0x0;var _0x45a2d8=_0xcd3b[_0x275a12];return _0x45a2d8;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0xbcd3('0x0'));var util=require(_0xbcd3('0x1'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0xbcd3('0x2'));var jayson=require(_0xbcd3('0x3'));var amiClient=jayson[_0xbcd3('0x4')]['http']({'port':0x232a});var mailClient=jayson[_0xbcd3('0x4')][_0xbcd3('0x5')]({'port':0x232b});var routingClient=jayson[_0xbcd3('0x4')][_0xbcd3('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x231bbb,_0x29391d,_0x12917){return new BPromise(function(_0x3db785,_0xa051ea){var _0x2528c4=_0x12917?_0x12917:amiClient;return _0x2528c4[_0xbcd3('0x6')](_0x231bbb,_0x29391d)['then'](function(_0x5b0466){if(_0x5b0466[_0xbcd3('0x7')]){if(_0x5b0466[_0xbcd3('0x7')][_0xbcd3('0x8')]===0x1f4){return _0xa051ea(_0x5b0466['error'][_0xbcd3('0x9')]);}return _0x3db785(_0x5b0466[_0xbcd3('0x7')][_0xbcd3('0x9')]);}else{_0x3db785(_0x5b0466[_0xbcd3('0xa')]);}})['catch'](function(_0x4ce401){_0xa051ea(_0x4ce401);});});}function respondWithResult(_0x3c37eb,_0x1aec12){_0x1aec12=_0x1aec12||0xc8;return function(_0x76f2b9){if(_0x76f2b9){return _0x3c37eb[_0xbcd3('0xb')](_0x1aec12)[_0xbcd3('0xc')](_0x76f2b9);}return _0x3c37eb['sendStatus'](0x194);};}function handleError(_0x40b321,_0x51b532){_0x51b532=_0x51b532||0x1f4;return function(_0x4ae913){logger[_0xbcd3('0x7')](_0x4ae913[_0xbcd3('0xd')]);if(_0x4ae913['name']){delete _0x4ae913[_0xbcd3('0xe')];}_0x40b321[_0xbcd3('0xb')](_0x51b532)[_0xbcd3('0xf')](_0x4ae913);};}function findById(_0x248145){return function(_0x5660b2){if(!_[_0xbcd3('0x10')](_0x248145)&&!_[_0xbcd3('0x10')](_0x5660b2)&&!_['isNil'](_0x5660b2[_0xbcd3('0x11')])){return _[_0xbcd3('0x12')](_0x5660b2['rows'],function(_0xc9db5d){return _0xc9db5d['id']==_0x248145;});}return null;};}exports[_0xbcd3('0x13')]=function(_0x5089af,_0xb6037b){return respondWithRpcPromise(_0xbcd3('0x14'),_0x5089af[_0xbcd3('0x15')])['then'](respondWithResult(_0xb6037b,null))[_0xbcd3('0x16')](handleError(_0xb6037b,null));};exports[_0xbcd3('0x17')]=function(_0x5ead94,_0x213603){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xbcd3('0x18')](_0x5ead94['query'],_0x5ead94[_0xbcd3('0x19')]))[_0xbcd3('0x1a')](respondWithResult(_0x213603,null))['catch'](handleError(_0x213603,null));};exports[_0xbcd3('0x1b')]=function(_0x24eac9,_0x183fb6){return respondWithRpcPromise(_0xbcd3('0x1c'),_[_0xbcd3('0x18')](_0x24eac9[_0xbcd3('0x15')],_0x24eac9[_0xbcd3('0x19')]))[_0xbcd3('0x1a')](respondWithResult(_0x183fb6,null))[_0xbcd3('0x16')](handleError(_0x183fb6,null));};exports[_0xbcd3('0x1d')]=function(_0x240fef,_0x4b0347){return respondWithRpcPromise(_0xbcd3('0x1e'),_0x240fef[_0xbcd3('0x15')])[_0xbcd3('0x1a')](respondWithResult(_0x4b0347,null))[_0xbcd3('0x16')](handleError(_0x4b0347,null));};exports[_0xbcd3('0x1f')]=function(_0x3892fc,_0x192b78){return respondWithRpcPromise(_0xbcd3('0x1e'),_0x3892fc['query'])['then'](findById(_0x3892fc[_0xbcd3('0x19')]['id']))[_0xbcd3('0x1a')](respondWithResult(_0x192b78,null))[_0xbcd3('0x16')](handleError(_0x192b78,null));};exports[_0xbcd3('0x20')]=function(_0x1663f8,_0x11a55e){return respondWithRpcPromise('VoiceQueuesPreview',_[_0xbcd3('0x18')](_0x1663f8['query'],_0x1663f8[_0xbcd3('0x19')]))[_0xbcd3('0x1a')](respondWithResult(_0x11a55e,null))[_0xbcd3('0x16')](handleError(_0x11a55e,null));};exports['voiceQueuesChannels']=function(_0x576f9e,_0x173796){return respondWithRpcPromise(_0xbcd3('0x21'),_0x576f9e['query'])[_0xbcd3('0x1a')](respondWithResult(_0x173796,null))['catch'](handleError(_0x173796,null));};exports[_0xbcd3('0x22')]=function(_0x27f38e,_0xdead85){return respondWithRpcPromise(_0xbcd3('0x23'),_[_0xbcd3('0x18')](_0x27f38e[_0xbcd3('0x15')],_0x27f38e[_0xbcd3('0x19')]))[_0xbcd3('0x1a')](respondWithResult(_0xdead85,null))['catch'](handleError(_0xdead85,null));};exports['voiceQueuesChannelHangup']=function(_0x560c0d,_0x2ac7c6){return respondWithRpcPromise('VoiceQueuesChannelHangup',_['merge'](_0x560c0d[_0xbcd3('0x15')],_0x560c0d[_0xbcd3('0x19')]))[_0xbcd3('0x1a')](respondWithResult(_0x2ac7c6,null))['catch'](handleError(_0x2ac7c6,null));};exports['voiceQueuesChannelRedirect']=function(_0x5c3ea6,_0x360454){return respondWithRpcPromise(_0xbcd3('0x24'),_[_0xbcd3('0x18')](_0x5c3ea6['query'],_0x5c3ea6[_0xbcd3('0x19')]))[_0xbcd3('0x1a')](respondWithResult(_0x360454,null))[_0xbcd3('0x16')](handleError(_0x360454,null));};exports[_0xbcd3('0x25')]=function(_0x14b58b,_0x518553){return respondWithRpcPromise('Outbound',_0x14b58b[_0xbcd3('0x15')])[_0xbcd3('0x1a')](respondWithResult(_0x518553,null))[_0xbcd3('0x16')](handleError(_0x518553,null));};exports[_0xbcd3('0x26')]=function(_0x361e9e,_0x26aebb){return respondWithRpcPromise(_0xbcd3('0x27'),_0x361e9e[_0xbcd3('0x15')])[_0xbcd3('0x1a')](respondWithResult(_0x26aebb,null))[_0xbcd3('0x16')](handleError(_0x26aebb,null));};exports[_0xbcd3('0x28')]=function(_0x32bd07,_0xdbb7f9){var _0x182126;return respondWithRpcPromise('Agents',_0x32bd07['query'])['then'](function(_0x8f660a){_0x182126=_0x8f660a;return respondWithRpcPromise(_0xbcd3('0x29'),_0x32bd07[_0xbcd3('0x15')],routingClient);})[_0xbcd3('0x1a')](function(_0x174d38){return _[_0xbcd3('0x18')]({},_0x174d38,_0x182126);})[_0xbcd3('0x1a')](respondWithResult(_0xdbb7f9,null))[_0xbcd3('0x16')](handleError(_0xdbb7f9,null));};exports[_0xbcd3('0x2a')]=function(_0x588b85,_0x579b94){if(_0x588b85[_0xbcd3('0x2b')]&&_0x588b85[_0xbcd3('0x2b')][_0xbcd3('0x2c')]&&_0x588b85[_0xbcd3('0x2d')]&&_0x588b85[_0xbcd3('0x2d')][_0xbcd3('0xe')]){for(var _0x2187b1 in _0x588b85[_0xbcd3('0x2b')][_0xbcd3('0x2c')]){if(_0x588b85[_0xbcd3('0x2b')][_0xbcd3('0x2c')]['hasOwnProperty'](_0x2187b1)){db[_0xbcd3('0x2e')][_0xbcd3('0x2f')]({'where':{'channel':_0x2187b1,'membername':_0x588b85[_0xbcd3('0x2d')][_0xbcd3('0xe')],'type':_0xbcd3('0x30'),'exitAt':null,'uniqueid':_0x588b85[_0xbcd3('0x2b')]['interaction'][_0x2187b1]&&_0x588b85[_0xbcd3('0x2b')]['interaction'][_0x2187b1]['length']?{'$notIn':_0x588b85[_0xbcd3('0x2b')][_0xbcd3('0x2c')][_0x2187b1]}:{'$ne':null}}})['then'](function(_0x5216e0){var _0x2a2342=moment()['format'](_0xbcd3('0x31'));for(var _0x169761=0x0,_0x255a51=_0x5216e0[_0xbcd3('0x32')];_0x169761<_0x255a51;_0x169761+=0x1){_0x5216e0[_0x169761][_0xbcd3('0x33')]({'exitAt':_0x2a2342});}});for(var _0x1c6157=0x0;_0x1c6157<_0x588b85[_0xbcd3('0x2b')][_0xbcd3('0x2c')][_0x2187b1][_0xbcd3('0x32')];_0x1c6157+=0x1){db['MemberReport'][_0xbcd3('0x34')]({'where':{'channel':_0x2187b1,'membername':_0x588b85[_0xbcd3('0x2d')]['name'],'type':'INTERACTION','uniqueid':_0x588b85[_0xbcd3('0x2b')]['interaction'][_0x2187b1][_0x1c6157],'exitAt':null},'defaults':{'channel':_0x2187b1,'membername':_0x588b85[_0xbcd3('0x2d')][_0xbcd3('0xe')],'interface':_['isNil'](_0x588b85[_0xbcd3('0x2d')][_0xbcd3('0x35')])?util[_0xbcd3('0x36')]('SIP/%s',_0x588b85[_0xbcd3('0x2d')][_0xbcd3('0xe')]):_0x588b85['user'][_0xbcd3('0x35')],'type':_0xbcd3('0x30'),'enterAt':moment()['format'](_0xbcd3('0x31')),'role':_0xbcd3('0x37'),'internal':_0x588b85[_0xbcd3('0x2d')]['internal'],'uniqueid':_0x588b85[_0xbcd3('0x2b')][_0xbcd3('0x2c')][_0x2187b1][_0x1c6157]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x588b85[_0xbcd3('0x19')]['id'],'capacity':_0x588b85['body'][_0xbcd3('0x38')]},routingClient)[_0xbcd3('0x1a')](respondWithResult(_0x579b94,null))['catch'](handleError(_0x579b94,null));};exports[_0xbcd3('0x39')]=function(_0x16ab94,_0x62969d){return respondWithRpcPromise(_0xbcd3('0x3a'),_0x16ab94[_0xbcd3('0x15')])[_0xbcd3('0x1a')](respondWithResult(_0x62969d,null))[_0xbcd3('0x16')](handleError(_0x62969d,null));};exports[_0xbcd3('0x3b')]=function(_0x277adc,_0x416ea9){return respondWithRpcPromise('Trunks',_0x277adc[_0xbcd3('0x15')])['then'](respondWithResult(_0x416ea9,null))[_0xbcd3('0x16')](handleError(_0x416ea9,null));};exports[_0xbcd3('0x3c')]=function(_0x1e7abf,_0x45890c){return respondWithRpcPromise('Campaigns',_0x1e7abf[_0xbcd3('0x15')])['then'](respondWithResult(_0x45890c,null))[_0xbcd3('0x16')](handleError(_0x45890c,null));};exports[_0xbcd3('0x3d')]=function(_0x71b3ca,_0x16c1b8){return respondWithRpcPromise(_0xbcd3('0x3e'),_0x71b3ca[_0xbcd3('0x15')],routingClient)[_0xbcd3('0x1a')](respondWithResult(_0x16c1b8,null))[_0xbcd3('0x16')](handleError(_0x16c1b8,null));};exports[_0xbcd3('0x3f')]=function(_0x257dee,_0x5d2946){return respondWithRpcPromise(_0xbcd3('0x3e'),_0x257dee['query'],routingClient)['then'](findById(_0x257dee['params']['id']))[_0xbcd3('0x1a')](respondWithResult(_0x5d2946,null))[_0xbcd3('0x16')](handleError(_0x5d2946,null));};exports[_0xbcd3('0x40')]=function(_0x11a855,_0x21bbcf){return respondWithRpcPromise('MailQueues',_0x11a855['query'],routingClient)['then'](respondWithResult(_0x21bbcf,null))[_0xbcd3('0x16')](handleError(_0x21bbcf,null));};exports['showMailQueues']=function(_0x26a726,_0x5830a5){return respondWithRpcPromise('MailQueues',_0x26a726['query'],routingClient)[_0xbcd3('0x1a')](findById(_0x26a726[_0xbcd3('0x19')]['id']))[_0xbcd3('0x1a')](respondWithResult(_0x5830a5,null))[_0xbcd3('0x16')](handleError(_0x5830a5,null));};exports[_0xbcd3('0x41')]=function(_0x80a33d,_0x4873d1){return respondWithRpcPromise(_0xbcd3('0x42'),_0x80a33d[_0xbcd3('0x15')],mailClient)[_0xbcd3('0x1a')](respondWithResult(_0x4873d1,null))['catch'](handleError(_0x4873d1,null));};exports[_0xbcd3('0x43')]=function(_0x21797d,_0x24df95){return respondWithRpcPromise(_0xbcd3('0x44'),_0x21797d[_0xbcd3('0x15')],routingClient)[_0xbcd3('0x1a')](respondWithResult(_0x24df95,null))[_0xbcd3('0x16')](handleError(_0x24df95,null));};exports['showOpenchannelQueues']=function(_0x2b99ad,_0x4ec8b6){return respondWithRpcPromise(_0xbcd3('0x44'),_0x2b99ad[_0xbcd3('0x15')],routingClient)[_0xbcd3('0x1a')](findById(_0x2b99ad[_0xbcd3('0x19')]['id']))[_0xbcd3('0x1a')](respondWithResult(_0x4ec8b6,null))[_0xbcd3('0x16')](handleError(_0x4ec8b6,null));};exports[_0xbcd3('0x45')]=function(_0x32f7ec,_0x5ad022){return respondWithRpcPromise('SmsQueues',_0x32f7ec[_0xbcd3('0x15')],routingClient)[_0xbcd3('0x1a')](respondWithResult(_0x5ad022,null))['catch'](handleError(_0x5ad022,null));};exports['showSmsQueues']=function(_0x55bbdb,_0x53992a){return respondWithRpcPromise(_0xbcd3('0x46'),_0x55bbdb[_0xbcd3('0x15')],routingClient)[_0xbcd3('0x1a')](findById(_0x55bbdb[_0xbcd3('0x19')]['id']))['then'](respondWithResult(_0x53992a,null))['catch'](handleError(_0x53992a,null));};exports['faxQueues']=function(_0x5dafd3,_0x15971e){return respondWithRpcPromise(_0xbcd3('0x47'),_0x5dafd3['query'],routingClient)['then'](respondWithResult(_0x15971e,null))[_0xbcd3('0x16')](handleError(_0x15971e,null));};exports[_0xbcd3('0x48')]=function(_0x428d94,_0x7c303c){return respondWithRpcPromise(_0xbcd3('0x47'),_0x428d94[_0xbcd3('0x15')],routingClient)[_0xbcd3('0x1a')](findById(_0x428d94[_0xbcd3('0x19')]['id']))[_0xbcd3('0x1a')](respondWithResult(_0x7c303c,null))['catch'](handleError(_0x7c303c,null));};exports[_0xbcd3('0x49')]=function(_0x7620c3,_0x248ad3){return respondWithRpcPromise(_0xbcd3('0x4a'),_0x7620c3[_0xbcd3('0x15')])[_0xbcd3('0x1a')](respondWithResult(_0x248ad3,null))['catch'](handleError(_0x248ad3,null));};exports[_0xbcd3('0x4b')]=function(_0xf17650,_0x42a3e7){return respondWithRpcPromise(_0xbcd3('0x4c'),_0xf17650[_0xbcd3('0x15')],routingClient)[_0xbcd3('0x1a')](respondWithResult(_0x42a3e7,null))[_0xbcd3('0x16')](handleError(_0x42a3e7,null));};exports['mailQueuesWaitingInteractions']=function(_0x11590d,_0x36f2f0){return respondWithRpcPromise(_0xbcd3('0x4d'),_0x11590d[_0xbcd3('0x15')],routingClient)[_0xbcd3('0x1a')](respondWithResult(_0x36f2f0,null))[_0xbcd3('0x16')](handleError(_0x36f2f0,null));};exports[_0xbcd3('0x4e')]=function(_0x3ec280,_0xbb30c0){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x3ec280[_0xbcd3('0x15')],routingClient)[_0xbcd3('0x1a')](respondWithResult(_0xbb30c0,null))['catch'](handleError(_0xbb30c0,null));};exports[_0xbcd3('0x4f')]=function(_0x4d3d54,_0x487cd2){return respondWithRpcPromise(_0xbcd3('0x50'),_0x4d3d54[_0xbcd3('0x15')],routingClient)[_0xbcd3('0x1a')](respondWithResult(_0x487cd2,null))[_0xbcd3('0x16')](handleError(_0x487cd2,null));};exports[_0xbcd3('0x51')]=function(_0x4699bb,_0x1a5f5c){return respondWithRpcPromise(_0xbcd3('0x52'),_0x4699bb[_0xbcd3('0x15')],routingClient)[_0xbcd3('0x1a')](respondWithResult(_0x1a5f5c,null))[_0xbcd3('0x16')](handleError(_0x1a5f5c,null));};exports[_0xbcd3('0x53')]=function(_0x11c344){return function(_0x4c3d1c,_0x1a6cb8){var _0x4a37ab,_0x228739;var _0x2b0560=_['capitalize'](_0x11c344);var _0x49cc15=_0x11c344===_0xbcd3('0x54')?_0xbcd3('0x55'):'Account';return db[_0x2b0560+_0xbcd3('0x56')][_0xbcd3('0x57')]({'raw':!![],'where':{'id':_0x4c3d1c[_0xbcd3('0x19')]['id']}})['then'](function(_0x42b362){if(_['isNil'](_0x42b362)){throw new Error(_0x2b0560+_0xbcd3('0x58'));}_0x4a37ab=_0x42b362;return db[_0x2b0560+'Message'][_0xbcd3('0x57')]({'where':{'id':_0x4c3d1c[_0xbcd3('0x2b')][_0xbcd3('0x59')]},'include':[{'model':db[_0x2b0560+_0xbcd3('0x5a')],'as':_0xbcd3('0x5a')},{'model':db[_0x2b0560+_0x49cc15],'as':_0xbcd3('0x5b')}]});})[_0xbcd3('0x1a')](function(_0x1db80d){if(_[_0xbcd3('0x10')](_0x1db80d)){throw new Error(_0x2b0560+'\x20Message\x20not\x20found');}_0x228739=_0x1db80d;return _0x1db80d[_0xbcd3('0x5c')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3724aa={'uniqueid':_0x11c344+'.'+_0x228739['id']+'.'+_0x228739['Interaction']['id'],'FromUserId':_0x4c3d1c[_0xbcd3('0x2d')]['id'],'type':_0xbcd3('0x5d')};_0x3724aa[_0x2b0560+'MessageId']=_0x228739['id'];_0x3724aa[_0x2b0560+_0xbcd3('0x5e')]=_0x228739[_0xbcd3('0x5a')]['id'];_0x3724aa[_0xbcd3('0x5f')+_0x2b0560+_0x49cc15+'Id']=_0x228739['Account']['id'];_0x3724aa['To'+_0x2b0560+_0xbcd3('0x60')]=_0x4a37ab['id'];return db[_0x2b0560+'TransferReport'][_0xbcd3('0x61')](_0x3724aa);})[_0xbcd3('0x1a')](function(){return respondWithRpcPromise(_0xbcd3('0x62'),{'channel':_0x11c344,'interaction':_0x228739[_0xbcd3('0x5a')],'message':_0x228739,'account':_0x228739[_0xbcd3('0x5b')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4a37ab[_0xbcd3('0xe')]+','+(_0x228739[_0xbcd3('0x5b')][_0xbcd3('0x63')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xbcd3('0x1a')](respondWithResult(_0x1a6cb8,null))['catch'](handleError(_0x1a6cb8,null));};};exports[_0xbcd3('0x64')]=function(_0x473318,_0x40bdf9){var _0x113aa8,_0x920c6;if(_[_0xbcd3('0x10')](_0x473318[_0xbcd3('0x2b')][_0xbcd3('0x65')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x4e68e4=_0x473318[_0xbcd3('0x2b')][_0xbcd3('0x65')];var _0x44eb5d=_[_0xbcd3('0x66')](_0x4e68e4);var _0x5be005=_0x4e68e4===_0xbcd3('0x54')?_0xbcd3('0x55'):_0xbcd3('0x5b');return db[_0xbcd3('0x67')][_0xbcd3('0x57')]({'raw':!![],'where':{'id':_0x473318[_0xbcd3('0x19')]['id'],'role':_0xbcd3('0x37')}})[_0xbcd3('0x1a')](function(_0x16efe4){if(_['isNil'](_0x16efe4)){throw new Error(_0xbcd3('0x68'));}_0x113aa8=_0x16efe4;return db[_0x44eb5d+'Message'][_0xbcd3('0x57')]({'where':{'id':_0x473318['body'][_0xbcd3('0x59')]},'include':[{'model':db[_0x44eb5d+_0xbcd3('0x5a')],'as':'Interaction'},{'model':db[_0x44eb5d+_0x5be005],'as':_0xbcd3('0x5b')}]});})['then'](function(_0x745799){if(_['isNil'](_0x745799)){throw new Error(_0x44eb5d+_0xbcd3('0x69'));}_0x920c6=_0x745799;return _0x745799[_0xbcd3('0x5c')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x31c44b={'uniqueid':_0x4e68e4+'.'+_0x920c6['id']+'.'+_0x920c6[_0xbcd3('0x5a')]['id'],'FromUserId':_0x473318['user']['id'],'type':_0xbcd3('0x5d'),'ToUserId':_0x113aa8['id']};_0x31c44b[_0x44eb5d+'MessageId']=_0x920c6['id'];_0x31c44b[_0x44eb5d+'InteractionId']=_0x920c6['Interaction']['id'];_0x31c44b['From'+_0x44eb5d+_0x5be005+'Id']=_0x920c6[_0xbcd3('0x5b')]['id'];return db[_0x44eb5d+_0xbcd3('0x6a')][_0xbcd3('0x61')](_0x31c44b);})['then'](function(){return respondWithRpcPromise(_0xbcd3('0x62'),{'channel':_0x4e68e4,'interaction':_0x920c6[_0xbcd3('0x5a')],'message':_0x920c6,'account':_0x920c6['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xbcd3('0x37'),'appdata':_0x113aa8['name']+','+(_0x920c6[_0xbcd3('0x5b')]['agentTransferTimeout']||0x12c),'interval':_0xbcd3('0x6b')}]},routingClient);})[_0xbcd3('0x1a')](respondWithResult(_0x40bdf9,null))[_0xbcd3('0x16')](handleError(_0x40bdf9,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 2690906..d4369e0 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 _0x2018=['show','/:id/run','run','post','create','update','delete','destroy','exports','path','connect-timeout','express','../../config/environment','isAuthenticated','get','/:id'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x2018,0x119));var _0x8201=function(_0x1188a8,_0xc1498d){_0x1188a8=_0x1188a8-0x0;var _0x50c1c1=_0x2018[_0x1188a8];return _0x50c1c1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8201('0x0'));var timeout=require(_0x8201('0x1'));var express=require(_0x8201('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8201('0x3'));var controller=require('./schedule.controller');router['get']('/',auth[_0x8201('0x4')](),controller['index']);router[_0x8201('0x5')](_0x8201('0x6'),auth['isAuthenticated'](),controller[_0x8201('0x7')]);router['get'](_0x8201('0x8'),auth[_0x8201('0x4')](),controller[_0x8201('0x9')]);router[_0x8201('0xa')]('/',auth[_0x8201('0x4')](),controller[_0x8201('0xb')]);router['put'](_0x8201('0x6'),auth[_0x8201('0x4')](),controller[_0x8201('0xc')]);router[_0x8201('0xd')](_0x8201('0x6'),auth[_0x8201('0x4')](),controller[_0x8201('0xe')]);module[_0x8201('0xf')]=router; \ No newline at end of file +var _0x84c4=['post','create','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','isAuthenticated','index','run'];(function(_0x380e75,_0x486360){var _0x444d96=function(_0x32c8f8){while(--_0x32c8f8){_0x380e75['push'](_0x380e75['shift']());}};_0x444d96(++_0x486360);}(_0x84c4,0x124));var _0x484c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x84c4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x484c('0x0'));var util=require(_0x484c('0x1'));var path=require('path');var timeout=require(_0x484c('0x2'));var express=require(_0x484c('0x3'));var router=express[_0x484c('0x4')]();var auth=require(_0x484c('0x5'));var interaction=require(_0x484c('0x6'));var config=require('../../config/environment');var controller=require(_0x484c('0x7'));router[_0x484c('0x8')]('/',auth[_0x484c('0x9')](),controller[_0x484c('0xa')]);router[_0x484c('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['get']('/:id/run',auth[_0x484c('0x9')](),controller[_0x484c('0xb')]);router[_0x484c('0xc')]('/',auth[_0x484c('0x9')](),controller[_0x484c('0xd')]);router['put'](_0x484c('0xe'),auth[_0x484c('0x9')](),controller[_0x484c('0xf')]);router[_0x484c('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x484c('0x11')]);module[_0x484c('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index a67dcb1..426c4b7 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 _0x1b4e=['STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','days','minutes','csv','pdf','custom','default','TEXT','sequelize'];(function(_0x1c58b8,_0x589ac5){var _0x398eeb=function(_0x4d2503){while(--_0x4d2503){_0x1c58b8['push'](_0x1c58b8['shift']());}};_0x398eeb(++_0x589ac5);}(_0x1b4e,0x1cf));var _0xe1b4=function(_0x1c41fb,_0x4ae9aa){_0x1c41fb=_0x1c41fb-0x0;var _0x4b0545=_0x1b4e[_0x1c41fb];return _0x4b0545;};'use strict';var Sequelize=require(_0xe1b4('0x0'));module['exports']={'name':{'type':Sequelize[_0xe1b4('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xe1b4('0x1')]},'active':{'type':Sequelize[_0xe1b4('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xe1b4('0x1')],'allowNull':![],'defaultValue':_0xe1b4('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xe1b4('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xe1b4('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xe1b4('0x6')](_0xe1b4('0x7'),_0xe1b4('0x8'),'months','weeks',_0xe1b4('0x9'),'hours',_0xe1b4('0xa')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xe1b4('0x6')](_0xe1b4('0xb'),_0xe1b4('0xc'),'xlsx'),'allowNull':![],'defaultValue':_0xe1b4('0xb')},'type':{'type':Sequelize[_0xe1b4('0x6')](_0xe1b4('0xd'),_0xe1b4('0xe')),'allowNull':![],'defaultValue':_0xe1b4('0xd')},'sendMail':{'type':Sequelize[_0xe1b4('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xe1b4('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xe1b4('0xf')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x7192=['exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','years','quarters','months','weeks','hours','minutes','days','ENUM','csv','pdf','xlsx','custom','default','TEXT'];(function(_0x39a7b3,_0x9c5210){var _0x1e25e2=function(_0x530d86){while(--_0x530d86){_0x39a7b3['push'](_0x39a7b3['shift']());}};_0x1e25e2(++_0x9c5210);}(_0x7192,0x98));var _0x2719=function(_0x2521a6,_0x1b7063){_0x2521a6=_0x2521a6-0x0;var _0x23de0b=_0x7192[_0x2521a6];return _0x23de0b;};'use strict';var Sequelize=require('sequelize');module[_0x2719('0x0')]={'name':{'type':Sequelize[_0x2719('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x2719('0x1')]},'active':{'type':Sequelize[_0x2719('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2719('0x3')},'startAt':{'type':Sequelize[_0x2719('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x2719('0x5'),_0x2719('0x6'),_0x2719('0x7'),_0x2719('0x8'),'days',_0x2719('0x9'),_0x2719('0xa')),'allowNull':![],'defaultValue':_0x2719('0xb')},'output':{'type':Sequelize[_0x2719('0xc')](_0x2719('0xd'),_0x2719('0xe'),_0x2719('0xf')),'allowNull':![],'defaultValue':_0x2719('0xd')},'type':{'type':Sequelize[_0x2719('0xc')](_0x2719('0x10'),_0x2719('0x11')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x2719('0x1')]},'cc':{'type':Sequelize[_0x2719('0x12')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x2719('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 47140ae..4e1dea8 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 _0x76ff=['../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','update','then','destroy','name','index','Schedule','rawAttributes','model','query','dateStart','dateEnd','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','add','day','merge','filter','map','options','includeAll','include','findAll','catch','show','params','keys','filters','find','create','body','../../config/schedule','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','lodash','squel','jsforce','querystring','../../components/parsers/qs','../../config/logger','api'];(function(_0x43b264,_0x19e07e){var _0x5eb242=function(_0x294efb){while(--_0x294efb){_0x43b264['push'](_0x43b264['shift']());}};_0x5eb242(++_0x19e07e);}(_0x76ff,0x73));var _0xf76f=function(_0x4c37ae,_0x4b613d){_0x4c37ae=_0x4c37ae-0x0;var _0x391a83=_0x76ff[_0x4c37ae];return _0x391a83;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf76f('0x0'));var rimraf=require(_0xf76f('0x1'));var zipdir=require(_0xf76f('0x2'));var jsonpatch=require(_0xf76f('0x3'));var rp=require(_0xf76f('0x4'));var moment=require(_0xf76f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf76f('0x6'));var util=require('util');var path=require(_0xf76f('0x7'));var sox=require(_0xf76f('0x8'));var csv=require(_0xf76f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf76f('0xa'));var squel=require(_0xf76f('0xb'));var crypto=require('crypto');var jsforce=require(_0xf76f('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf76f('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var qs=require(_0xf76f('0xe'));var logger=require(_0xf76f('0xf'))(_0xf76f('0x10'));var utils=require(_0xf76f('0x11'));var config=require('../../config/environment');var db=require(_0xf76f('0x12'))['db'];function respondWithStatusCode(_0x597484,_0x362892){_0x362892=_0x362892||0xcc;return function(_0x2ffc19){if(_0x2ffc19){return _0x597484[_0xf76f('0x13')](_0x362892);}return _0x597484[_0xf76f('0x14')](_0x362892)[_0xf76f('0x15')]();};}function respondWithResult(_0x238e1e,_0x324f24){_0x324f24=_0x324f24||0xc8;return function(_0x542471){if(_0x542471){return _0x238e1e['status'](_0x324f24)[_0xf76f('0x16')](_0x542471);}};}function respondWithFilteredResult(_0x393d12,_0x749f0f){return function(_0x521410){if(_0x521410){var _0x5cc32d=_0x521410[_0xf76f('0x17')],_0xd91950=_0x749f0f[_0xf76f('0x18')],_0x3497eb=_0x749f0f['offset']+_0x749f0f[_0xf76f('0x19')],_0x2e7ff0;if(_0x3497eb>=_0x5cc32d){_0x3497eb=_0x5cc32d;_0x2e7ff0=0xc8;}else{_0x2e7ff0=0xce;}_0x393d12[_0xf76f('0x14')](_0x2e7ff0);return _0x393d12['set'](_0xf76f('0x1a'),_0xd91950+'-'+_0x3497eb+'/'+_0x5cc32d)[_0xf76f('0x16')](_0x521410);}return null;};}function patchUpdates(_0x60f33a){return function(_0x52a1c3){try{jsonpatch['apply'](_0x52a1c3,_0x60f33a,!![]);}catch(_0x5ff3f8){return BPromise['reject'](_0x5ff3f8);}return _0x52a1c3['save']();};}function saveUpdates(_0x55bf4d,_0x544585){return function(_0x1c1b95){if(_0x1c1b95){return _0x1c1b95[_0xf76f('0x1b')](_0x55bf4d)[_0xf76f('0x1c')](function(_0x2489a7){return _0x2489a7;});}return null;};}function removeEntity(_0x58d92b,_0x23b10e){return function(_0x4c3f79){if(_0x4c3f79){return _0x4c3f79[_0xf76f('0x1d')]()['then'](function(){_0x58d92b['status'](0xcc)[_0xf76f('0x15')]();});}};}function handleEntityNotFound(_0x9ccf83,_0x5c08c9){return function(_0x2bb940){if(!_0x2bb940){_0x9ccf83[_0xf76f('0x13')](0x194);}return _0x2bb940;};}function handleError(_0x166099,_0x1633b4){_0x1633b4=_0x1633b4||0x1f4;return function(_0x57001c){logger['error'](_0x57001c['stack']);if(_0x57001c[_0xf76f('0x1e')]){delete _0x57001c[_0xf76f('0x1e')];}_0x166099[_0xf76f('0x14')](_0x1633b4)['send'](_0x57001c);};}exports[_0xf76f('0x1f')]=function(_0x1e5547,_0xce1a04){var _0x3f4386={},_0x83d3d2={},_0x40524e={'count':0x0,'rows':[]};var _0xb0052a=db[_0xf76f('0x20')][_0xf76f('0x21')];_0x83d3d2[_0xf76f('0x22')]=_['keys'](_0xb0052a);var _0x2ae4c9={'dateStart':_0x1e5547[_0xf76f('0x23')][_0xf76f('0x24')],'dateEnd':_0x1e5547[_0xf76f('0x23')][_0xf76f('0x25')]};delete _0x1e5547['query'][_0xf76f('0x24')];delete _0x1e5547['query']['dateEnd'];_0x83d3d2[_0xf76f('0x23')]=_['keys'](_0x1e5547[_0xf76f('0x23')]);_0x83d3d2['filters']=_[_0xf76f('0x26')](_0x83d3d2[_0xf76f('0x22')],_0x83d3d2[_0xf76f('0x23')]);_0x3f4386[_0xf76f('0x27')]=_['intersection'](_0x83d3d2[_0xf76f('0x22')],qs[_0xf76f('0x28')](_0x1e5547['query'][_0xf76f('0x28')]));_0x3f4386[_0xf76f('0x27')]=_0x3f4386[_0xf76f('0x27')][_0xf76f('0x29')]?_0x3f4386[_0xf76f('0x27')]:_0x83d3d2[_0xf76f('0x22')];if(!_0x1e5547['query'][_0xf76f('0x2a')](_0xf76f('0x2b'))){_0x3f4386[_0xf76f('0x19')]=qs[_0xf76f('0x19')](_0x1e5547[_0xf76f('0x23')][_0xf76f('0x19')]);_0x3f4386[_0xf76f('0x18')]=qs[_0xf76f('0x18')](_0x1e5547[_0xf76f('0x23')][_0xf76f('0x18')]);}_0x3f4386['order']=qs[_0xf76f('0x2c')](_0x1e5547[_0xf76f('0x23')][_0xf76f('0x2c')]);_0x3f4386[_0xf76f('0x2d')]=qs['filters'](_[_0xf76f('0x2e')](_0x1e5547['query'],_0x83d3d2['filters']));if(_0x2ae4c9[_0xf76f('0x24')]){if(_0x2ae4c9[_0xf76f('0x25')]){_0x2ae4c9[_0xf76f('0x25')]=moment(_0x2ae4c9[_0xf76f('0x25')])[_0xf76f('0x2f')](0x1,_0xf76f('0x30'));}else{_0x2ae4c9[_0xf76f('0x25')]=moment(_0x2ae4c9['dateStart'])['add'](0x1,'day');}_[_0xf76f('0x31')](_0x3f4386[_0xf76f('0x2d')],{'createdAt':{'$gte':_0x2ae4c9['dateStart'],'$lte':_0x2ae4c9[_0xf76f('0x25')]}});}if(_0x1e5547['query'][_0xf76f('0x32')]){_0x3f4386['where']=_['merge'](_0x3f4386[_0xf76f('0x2d')],{'$or':_[_0xf76f('0x33')](_0x3f4386[_0xf76f('0x27')],function(_0x284811){var _0x45188e={};_0x45188e[_0x284811]={'$like':'%'+_0x1e5547[_0xf76f('0x23')][_0xf76f('0x32')]+'%'};return _0x45188e;})});}_0x3f4386=_[_0xf76f('0x31')]({},_0x3f4386,_0x1e5547[_0xf76f('0x34')]);var _0x4554a5={'where':_0x3f4386[_0xf76f('0x2d')]};return db[_0xf76f('0x20')]['count'](_0x4554a5)[_0xf76f('0x1c')](function(_0x1c523b){_0x40524e[_0xf76f('0x17')]=_0x1c523b;if(_0x1e5547[_0xf76f('0x23')][_0xf76f('0x35')]){_0x3f4386[_0xf76f('0x36')]=[{'all':!![]}];}return db[_0xf76f('0x20')][_0xf76f('0x37')](_0x3f4386);})[_0xf76f('0x1c')](function(_0x34edb1){_0x40524e['rows']=_0x34edb1;return _0x40524e;})[_0xf76f('0x1c')](respondWithFilteredResult(_0xce1a04,_0x3f4386))[_0xf76f('0x38')](handleError(_0xce1a04,null));};exports[_0xf76f('0x39')]=function(_0x46e5e0,_0x12483d){var _0x259d57={'raw':![],'where':{'id':_0x46e5e0[_0xf76f('0x3a')]['id']}},_0x3da748={};_0x3da748['model']=_[_0xf76f('0x3b')](db['Schedule'][_0xf76f('0x21')]);_0x3da748['query']=_[_0xf76f('0x3b')](_0x46e5e0[_0xf76f('0x23')]);_0x3da748[_0xf76f('0x3c')]=_['intersection'](_0x3da748[_0xf76f('0x22')],_0x3da748[_0xf76f('0x23')]);_0x259d57[_0xf76f('0x27')]=_[_0xf76f('0x26')](_0x3da748[_0xf76f('0x22')],qs[_0xf76f('0x28')](_0x46e5e0[_0xf76f('0x23')]['fields']));_0x259d57[_0xf76f('0x27')]=_0x259d57[_0xf76f('0x27')][_0xf76f('0x29')]?_0x259d57[_0xf76f('0x27')]:_0x3da748[_0xf76f('0x22')];if(_0x46e5e0[_0xf76f('0x23')]['includeAll']){_0x259d57['include']=[{'all':!![]}];}_0x259d57=_[_0xf76f('0x31')]({},_0x259d57,_0x46e5e0['options']);return db[_0xf76f('0x20')][_0xf76f('0x3d')](_0x259d57)[_0xf76f('0x1c')](handleEntityNotFound(_0x12483d,null))[_0xf76f('0x1c')](respondWithResult(_0x12483d,null))[_0xf76f('0x38')](handleError(_0x12483d,null));};exports[_0xf76f('0x3e')]=function(_0x398fa9,_0x521494){return db['Schedule'][_0xf76f('0x3e')](_0x398fa9[_0xf76f('0x3f')],{})[_0xf76f('0x1c')](respondWithResult(_0x521494,0xc9))[_0xf76f('0x38')](handleError(_0x521494,null));};exports[_0xf76f('0x1b')]=function(_0x3aa493,_0x25ddad){if(_0x3aa493['body']['id']){delete _0x3aa493[_0xf76f('0x3f')]['id'];}return db[_0xf76f('0x20')][_0xf76f('0x3d')]({'where':{'id':_0x3aa493[_0xf76f('0x3a')]['id']}})[_0xf76f('0x1c')](handleEntityNotFound(_0x25ddad,null))[_0xf76f('0x1c')](saveUpdates(_0x3aa493[_0xf76f('0x3f')],null))['then'](respondWithResult(_0x25ddad,null))[_0xf76f('0x38')](handleError(_0x25ddad,null));};exports[_0xf76f('0x1d')]=function(_0xe69694,_0x4e98d4){return db['Schedule'][_0xf76f('0x3d')]({'where':{'id':_0xe69694[_0xf76f('0x3a')]['id']}})[_0xf76f('0x1c')](handleEntityNotFound(_0x4e98d4,null))[_0xf76f('0x1c')](removeEntity(_0x4e98d4,null))[_0xf76f('0x38')](handleError(_0x4e98d4,null));};exports['run']=function(_0x441f2c,_0x16102c,_0x4c656a){var _0xcb4088=require(_0xf76f('0x40'));return db[_0xf76f('0x20')][_0xf76f('0x3d')]({'where':{'id':_0x441f2c[_0xf76f('0x3a')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x16102c,null))[_0xf76f('0x1c')](function(){_0xcb4088[_0xf76f('0x41')](_0x441f2c['params']['id']);})[_0xf76f('0x1c')](respondWithStatusCode(_0x16102c,null))[_0xf76f('0x38')](handleError(_0x16102c,null));}; \ No newline at end of file +var _0xd39a=['pick','day','merge','filter','map','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','run','../../config/schedule','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','Schedule','rawAttributes','model','keys','dateStart','query','dateEnd','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters'];(function(_0x796a03,_0x3fd9a9){var _0x44a665=function(_0x4598fe){while(--_0x4598fe){_0x796a03['push'](_0x796a03['shift']());}};_0x44a665(++_0x3fd9a9);}(_0xd39a,0xf0));var _0xad39=function(_0x8a2e9d,_0xa7a01c){_0x8a2e9d=_0x8a2e9d-0x0;var _0xf64cdd=_0xd39a[_0x8a2e9d];return _0xf64cdd;};'use strict';var pdf=require(_0xad39('0x0'));var emlformat=require(_0xad39('0x1'));var rimraf=require(_0xad39('0x2'));var zipdir=require(_0xad39('0x3'));var jsonpatch=require(_0xad39('0x4'));var rp=require(_0xad39('0x5'));var moment=require(_0xad39('0x6'));var BPromise=require(_0xad39('0x7'));var Mustache=require(_0xad39('0x8'));var util=require(_0xad39('0x9'));var path=require(_0xad39('0xa'));var sox=require('sox');var csv=require(_0xad39('0xb'));var ejs=require(_0xad39('0xc'));var fs=require('fs');var _=require(_0xad39('0xd'));var squel=require(_0xad39('0xe'));var crypto=require(_0xad39('0xf'));var jsforce=require(_0xad39('0x10'));var deskjs=require(_0xad39('0x11'));var toCsv=require(_0xad39('0xb'));var querystring=require(_0xad39('0x12'));var Papa=require('papaparse');var Redis=require(_0xad39('0x13'));var qs=require(_0xad39('0x14'));var logger=require(_0xad39('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xad39('0x16'));var db=require(_0xad39('0x17'))['db'];function respondWithStatusCode(_0x5921d4,_0x4953c8){_0x4953c8=_0x4953c8||0xcc;return function(_0x3736e7){if(_0x3736e7){return _0x5921d4[_0xad39('0x18')](_0x4953c8);}return _0x5921d4[_0xad39('0x19')](_0x4953c8)[_0xad39('0x1a')]();};}function respondWithResult(_0x320939,_0x57451c){_0x57451c=_0x57451c||0xc8;return function(_0xd79bcf){if(_0xd79bcf){return _0x320939[_0xad39('0x19')](_0x57451c)[_0xad39('0x1b')](_0xd79bcf);}};}function respondWithFilteredResult(_0x54637e,_0x5e0429){return function(_0x4d7819){if(_0x4d7819){var _0x38f811=_0x4d7819[_0xad39('0x1c')],_0x36b17c=_0x5e0429[_0xad39('0x1d')],_0x5f191e=_0x5e0429[_0xad39('0x1d')]+_0x5e0429[_0xad39('0x1e')],_0x9debdc;if(_0x5f191e>=_0x38f811){_0x5f191e=_0x38f811;_0x9debdc=0xc8;}else{_0x9debdc=0xce;}_0x54637e[_0xad39('0x19')](_0x9debdc);return _0x54637e['set']('Content-Range',_0x36b17c+'-'+_0x5f191e+'/'+_0x38f811)[_0xad39('0x1b')](_0x4d7819);}return null;};}function patchUpdates(_0x10db2a){return function(_0x201ff1){try{jsonpatch[_0xad39('0x1f')](_0x201ff1,_0x10db2a,!![]);}catch(_0x240b20){return BPromise[_0xad39('0x20')](_0x240b20);}return _0x201ff1[_0xad39('0x21')]();};}function saveUpdates(_0x1ba9a7,_0x5bc558){return function(_0x5cf7e5){if(_0x5cf7e5){return _0x5cf7e5[_0xad39('0x22')](_0x1ba9a7)[_0xad39('0x23')](function(_0x184b62){return _0x184b62;});}return null;};}function removeEntity(_0x2823e9,_0x2923bc){return function(_0x1a39a7){if(_0x1a39a7){return _0x1a39a7[_0xad39('0x24')]()['then'](function(){_0x2823e9[_0xad39('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27a46c,_0x2c4aeb){return function(_0x469ab8){if(!_0x469ab8){_0x27a46c[_0xad39('0x18')](0x194);}return _0x469ab8;};}function handleError(_0x569b1b,_0x55e3b8){_0x55e3b8=_0x55e3b8||0x1f4;return function(_0x559c66){logger[_0xad39('0x25')](_0x559c66[_0xad39('0x26')]);if(_0x559c66[_0xad39('0x27')]){delete _0x559c66['name'];}_0x569b1b[_0xad39('0x19')](_0x55e3b8)['send'](_0x559c66);};}exports['index']=function(_0x38976b,_0x43fd04){var _0x3e20e6={},_0x2d0f56={},_0x988f36={'count':0x0,'rows':[]};var _0x202080=db[_0xad39('0x28')][_0xad39('0x29')];_0x2d0f56[_0xad39('0x2a')]=_[_0xad39('0x2b')](_0x202080);var _0x5a93a1={'dateStart':_0x38976b['query'][_0xad39('0x2c')],'dateEnd':_0x38976b[_0xad39('0x2d')][_0xad39('0x2e')]};delete _0x38976b[_0xad39('0x2d')][_0xad39('0x2c')];delete _0x38976b[_0xad39('0x2d')][_0xad39('0x2e')];_0x2d0f56[_0xad39('0x2d')]=_['keys'](_0x38976b[_0xad39('0x2d')]);_0x2d0f56['filters']=_['intersection'](_0x2d0f56[_0xad39('0x2a')],_0x2d0f56[_0xad39('0x2d')]);_0x3e20e6['attributes']=_[_0xad39('0x2f')](_0x2d0f56[_0xad39('0x2a')],qs[_0xad39('0x30')](_0x38976b[_0xad39('0x2d')][_0xad39('0x30')]));_0x3e20e6[_0xad39('0x31')]=_0x3e20e6[_0xad39('0x31')][_0xad39('0x32')]?_0x3e20e6[_0xad39('0x31')]:_0x2d0f56[_0xad39('0x2a')];if(!_0x38976b['query'][_0xad39('0x33')]('nolimit')){_0x3e20e6[_0xad39('0x1e')]=qs[_0xad39('0x1e')](_0x38976b[_0xad39('0x2d')]['limit']);_0x3e20e6[_0xad39('0x1d')]=qs['offset'](_0x38976b[_0xad39('0x2d')]['offset']);}_0x3e20e6[_0xad39('0x34')]=qs[_0xad39('0x35')](_0x38976b['query']['sort']);_0x3e20e6[_0xad39('0x36')]=qs[_0xad39('0x37')](_[_0xad39('0x38')](_0x38976b[_0xad39('0x2d')],_0x2d0f56[_0xad39('0x37')]));if(_0x5a93a1[_0xad39('0x2c')]){if(_0x5a93a1[_0xad39('0x2e')]){_0x5a93a1[_0xad39('0x2e')]=moment(_0x5a93a1[_0xad39('0x2e')])['add'](0x1,'day');}else{_0x5a93a1[_0xad39('0x2e')]=moment(_0x5a93a1[_0xad39('0x2c')])['add'](0x1,_0xad39('0x39'));}_[_0xad39('0x3a')](_0x3e20e6[_0xad39('0x36')],{'createdAt':{'$gte':_0x5a93a1[_0xad39('0x2c')],'$lte':_0x5a93a1[_0xad39('0x2e')]}});}if(_0x38976b[_0xad39('0x2d')][_0xad39('0x3b')]){_0x3e20e6['where']=_[_0xad39('0x3a')](_0x3e20e6[_0xad39('0x36')],{'$or':_[_0xad39('0x3c')](_0x3e20e6[_0xad39('0x31')],function(_0x2d56bb){var _0x44669f={};_0x44669f[_0x2d56bb]={'$like':'%'+_0x38976b[_0xad39('0x2d')][_0xad39('0x3b')]+'%'};return _0x44669f;})});}_0x3e20e6=_[_0xad39('0x3a')]({},_0x3e20e6,_0x38976b[_0xad39('0x3d')]);var _0x745729={'where':_0x3e20e6[_0xad39('0x36')]};return db[_0xad39('0x28')][_0xad39('0x1c')](_0x745729)['then'](function(_0x56a78c){_0x988f36[_0xad39('0x1c')]=_0x56a78c;if(_0x38976b[_0xad39('0x2d')][_0xad39('0x3e')]){_0x3e20e6[_0xad39('0x3f')]=[{'all':!![]}];}return db['Schedule'][_0xad39('0x40')](_0x3e20e6);})[_0xad39('0x23')](function(_0x1f7794){_0x988f36[_0xad39('0x41')]=_0x1f7794;return _0x988f36;})[_0xad39('0x23')](respondWithFilteredResult(_0x43fd04,_0x3e20e6))[_0xad39('0x42')](handleError(_0x43fd04,null));};exports[_0xad39('0x43')]=function(_0x2fc00a,_0x13f209){var _0x326ff9={'raw':![],'where':{'id':_0x2fc00a[_0xad39('0x44')]['id']}},_0x67aa55={};_0x67aa55[_0xad39('0x2a')]=_['keys'](db[_0xad39('0x28')][_0xad39('0x29')]);_0x67aa55[_0xad39('0x2d')]=_[_0xad39('0x2b')](_0x2fc00a[_0xad39('0x2d')]);_0x67aa55[_0xad39('0x37')]=_['intersection'](_0x67aa55['model'],_0x67aa55[_0xad39('0x2d')]);_0x326ff9[_0xad39('0x31')]=_['intersection'](_0x67aa55[_0xad39('0x2a')],qs['fields'](_0x2fc00a[_0xad39('0x2d')]['fields']));_0x326ff9[_0xad39('0x31')]=_0x326ff9['attributes']['length']?_0x326ff9[_0xad39('0x31')]:_0x67aa55[_0xad39('0x2a')];if(_0x2fc00a[_0xad39('0x2d')][_0xad39('0x3e')]){_0x326ff9[_0xad39('0x3f')]=[{'all':!![]}];}_0x326ff9=_[_0xad39('0x3a')]({},_0x326ff9,_0x2fc00a[_0xad39('0x3d')]);return db['Schedule'][_0xad39('0x45')](_0x326ff9)[_0xad39('0x23')](handleEntityNotFound(_0x13f209,null))['then'](respondWithResult(_0x13f209,null))['catch'](handleError(_0x13f209,null));};exports[_0xad39('0x46')]=function(_0x4306ee,_0x4af8ba){return db['Schedule'][_0xad39('0x46')](_0x4306ee[_0xad39('0x47')],{})['then'](respondWithResult(_0x4af8ba,0xc9))[_0xad39('0x42')](handleError(_0x4af8ba,null));};exports[_0xad39('0x22')]=function(_0x3e2f34,_0x35188a){if(_0x3e2f34[_0xad39('0x47')]['id']){delete _0x3e2f34[_0xad39('0x47')]['id'];}return db[_0xad39('0x28')]['find']({'where':{'id':_0x3e2f34[_0xad39('0x44')]['id']}})[_0xad39('0x23')](handleEntityNotFound(_0x35188a,null))[_0xad39('0x23')](saveUpdates(_0x3e2f34[_0xad39('0x47')],null))['then'](respondWithResult(_0x35188a,null))[_0xad39('0x42')](handleError(_0x35188a,null));};exports[_0xad39('0x24')]=function(_0x3d0284,_0x49c559){return db[_0xad39('0x28')]['find']({'where':{'id':_0x3d0284[_0xad39('0x44')]['id']}})[_0xad39('0x23')](handleEntityNotFound(_0x49c559,null))[_0xad39('0x23')](removeEntity(_0x49c559,null))['catch'](handleError(_0x49c559,null));};exports[_0xad39('0x48')]=function(_0x12a5eb,_0x30ab52,_0x37d542){var _0x283466=require(_0xad39('0x49'));return db[_0xad39('0x28')][_0xad39('0x45')]({'where':{'id':_0x12a5eb[_0xad39('0x44')]['id']},'raw':!![]})[_0xad39('0x23')](handleEntityNotFound(_0x30ab52,null))[_0xad39('0x23')](function(){_0x283466[_0xad39('0x48')](_0x12a5eb[_0xad39('0x44')]['id']);})[_0xad39('0x23')](respondWithStatusCode(_0x30ab52,null))[_0xad39('0x42')](handleError(_0x30ab52,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 0e2b950..84ea8c0 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 _0xb478=['bluebird','./schedule.attributes','exports','Schedule','lodash','../../config/logger','api'];(function(_0x526a03,_0x5f95b){var _0x4ad801=function(_0x314855){while(--_0x314855){_0x526a03['push'](_0x526a03['shift']());}};_0x4ad801(++_0x5f95b);}(_0xb478,0x1ee));var _0x8b47=function(_0x51b1a5,_0x285a4f){_0x51b1a5=_0x51b1a5-0x0;var _0x15c738=_0xb478[_0x51b1a5];return _0x15c738;};'use strict';var _=require(_0x8b47('0x0'));var util=require('util');var logger=require(_0x8b47('0x1'))(_0x8b47('0x2'));var moment=require('moment');var BPromise=require(_0x8b47('0x3'));var rp=require('request-promise');var attributes=require(_0x8b47('0x4'));module[_0x8b47('0x5')]=function(_0x4e5523,_0x4a26b3){return _0x4e5523['define'](_0x8b47('0x6'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e74=['tools_schedules','util','api','moment','bluebird','request-promise','./schedule.attributes','exports','Schedule'];(function(_0x1dc2c7,_0x960923){var _0x506089=function(_0x3de4dc){while(--_0x3de4dc){_0x1dc2c7['push'](_0x1dc2c7['shift']());}};_0x506089(++_0x960923);}(_0x7e74,0x7f));var _0x47e7=function(_0x50a6c5,_0x51b738){_0x50a6c5=_0x50a6c5-0x0;var _0x15d3d2=_0x7e74[_0x50a6c5];return _0x15d3d2;};'use strict';var _=require('lodash');var util=require(_0x47e7('0x0'));var logger=require('../../config/logger')(_0x47e7('0x1'));var moment=require(_0x47e7('0x2'));var BPromise=require(_0x47e7('0x3'));var rp=require(_0x47e7('0x4'));var attributes=require(_0x47e7('0x5'));module[_0x47e7('0x6')]=function(_0x2751ed,_0x2a3777){return _0x2751ed['define'](_0x47e7('0x7'),attributes,{'tableName':_0x47e7('0x8'),'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 c2164fc..9679cbc 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 _0xa24f=['util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','request\x20sent','debug','stringify','error','message','Schedule,\x20%s,\x20%s','result','catch','lodash'];(function(_0x33b25f,_0x7c3660){var _0x3bd005=function(_0x3f9c50){while(--_0x3f9c50){_0x33b25f['push'](_0x33b25f['shift']());}};_0x3bd005(++_0x7c3660);}(_0xa24f,0x153));var _0xfa24=function(_0x54a946,_0x30a84e){_0x54a946=_0x54a946-0x0;var _0x4484af=_0xa24f[_0x54a946];return _0x4484af;};'use strict';var _=require(_0xfa24('0x0'));var util=require(_0xfa24('0x1'));var moment=require(_0xfa24('0x2'));var BPromise=require(_0xfa24('0x3'));var rs=require(_0xfa24('0x4'));var fs=require('fs');var Redis=require(_0xfa24('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfa24('0x6'))(_0xfa24('0x7'));var config=require(_0xfa24('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfa24('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27e12f,_0x2551d3,_0xb40b84){return new BPromise(function(_0x527d96,_0x238736){return client['request'](_0x27e12f,_0xb40b84)[_0xfa24('0xa')](function(_0x5000a0){logger[_0xfa24('0xb')]('Schedule,\x20%s,\x20%s',_0x2551d3,_0xfa24('0xc'));logger[_0xfa24('0xd')]('Schedule,\x20%s,\x20%s,\x20%s',_0x2551d3,_0xfa24('0xc'),JSON[_0xfa24('0xe')](_0x5000a0));if(_0x5000a0[_0xfa24('0xf')]){if(_0x5000a0[_0xfa24('0xf')]['code']===0x1f4){logger[_0xfa24('0xf')]('Schedule,\x20%s,\x20%s',_0x2551d3,_0x5000a0['error'][_0xfa24('0x10')]);return _0x238736(_0x5000a0[_0xfa24('0xf')]['message']);}logger['error'](_0xfa24('0x11'),_0x2551d3,_0x5000a0[_0xfa24('0xf')][_0xfa24('0x10')]);return _0x527d96(_0x5000a0[_0xfa24('0xf')]['message']);}else{logger[_0xfa24('0xb')](_0xfa24('0x11'),_0x2551d3,_0xfa24('0xc'));_0x527d96(_0x5000a0[_0xfa24('0x12')][_0xfa24('0x10')]);}})[_0xfa24('0x13')](function(_0x19c10a){logger[_0xfa24('0xf')](_0xfa24('0x11'),_0x2551d3,_0x19c10a);_0x238736(_0x19c10a);});});} \ No newline at end of file +var _0xcc56=['error','code','Schedule,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','request\x20sent','debug','stringify'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xcc56,0x1a5));var _0x6cc5=function(_0x153f7b,_0x3d2df4){_0x153f7b=_0x153f7b-0x0;var _0x212994=_0xcc56[_0x153f7b];return _0x212994;};'use strict';var _=require(_0x6cc5('0x0'));var util=require(_0x6cc5('0x1'));var moment=require(_0x6cc5('0x2'));var BPromise=require(_0x6cc5('0x3'));var rs=require(_0x6cc5('0x4'));var fs=require('fs');var Redis=require(_0x6cc5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6cc5('0x6'));var logger=require(_0x6cc5('0x7'))(_0x6cc5('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6cc5('0x9')][_0x6cc5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41f5e9,_0x4dc56b,_0x326950){return new BPromise(function(_0x5345f5,_0x1577b0){return client[_0x6cc5('0xb')](_0x41f5e9,_0x326950)[_0x6cc5('0xc')](function(_0x3b3ec3){logger['info']('Schedule,\x20%s,\x20%s',_0x4dc56b,_0x6cc5('0xd'));logger[_0x6cc5('0xe')]('Schedule,\x20%s,\x20%s,\x20%s',_0x4dc56b,_0x6cc5('0xd'),JSON[_0x6cc5('0xf')](_0x3b3ec3));if(_0x3b3ec3[_0x6cc5('0x10')]){if(_0x3b3ec3[_0x6cc5('0x10')][_0x6cc5('0x11')]===0x1f4){logger['error'](_0x6cc5('0x12'),_0x4dc56b,_0x3b3ec3[_0x6cc5('0x10')][_0x6cc5('0x13')]);return _0x1577b0(_0x3b3ec3[_0x6cc5('0x10')][_0x6cc5('0x13')]);}logger[_0x6cc5('0x10')]('Schedule,\x20%s,\x20%s',_0x4dc56b,_0x3b3ec3[_0x6cc5('0x10')]['message']);return _0x5345f5(_0x3b3ec3['error'][_0x6cc5('0x13')]);}else{logger[_0x6cc5('0x14')](_0x6cc5('0x12'),_0x4dc56b,_0x6cc5('0xd'));_0x5345f5(_0x3b3ec3[_0x6cc5('0x15')][_0x6cc5('0x13')]);}})[_0x6cc5('0x16')](function(_0x26a414){logger[_0x6cc5('0x10')]('Schedule,\x20%s,\x20%s',_0x4dc56b,_0x26a414);_0x1577b0(_0x26a414);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 83902af..aa88af6 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 _0xfaee=['/:id/preferred','put','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./setting.controller','get','isAuthenticated','index','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','getPreferred','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','single','file','logologin','post','addLogoLogin','preferred'];(function(_0x76d591,_0x387554){var _0x4f646c=function(_0x3b9567){while(--_0x3b9567){_0x76d591['push'](_0x76d591['shift']());}};_0x4f646c(++_0x387554);}(_0xfaee,0x1ed));var _0xefae=function(_0x2b2b33,_0x56606f){_0x2b2b33=_0x2b2b33-0x0;var _0x229157=_0xfaee[_0x2b2b33];return _0x229157;};'use strict';var multer=require(_0xefae('0x0'));var util=require(_0xefae('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xefae('0x2'));var router=express[_0xefae('0x3')]();var auth=require(_0xefae('0x4'));var interaction=require(_0xefae('0x5'));var config=require('../../config/environment');var controller=require(_0xefae('0x6'));router[_0xefae('0x7')]('/',auth[_0xefae('0x8')](),controller[_0xefae('0x9')]);router[_0xefae('0x7')](_0xefae('0xa'),controller[_0xefae('0xb')]);router[_0xefae('0x7')](_0xefae('0xc'),controller['getLogo']);router[_0xefae('0x7')](_0xefae('0xd'),controller[_0xefae('0xe')]);router[_0xefae('0x7')](_0xefae('0xf'),controller['gdpr']);router[_0xefae('0x7')]('/:id/preferred',controller[_0xefae('0x10')]);var upload=multer({'storage':multer[_0xefae('0x11')]({'destination':function(_0x2d2085,_0x4b79dc,_0x179eae){_0x179eae(null,path[_0xefae('0x12')](config[_0xefae('0x13')],_0xefae('0x14')));},'filename':function(_0x317531,_0x13351f,_0x55c57a){_0x55c57a(null,util[_0xefae('0x15')](_0xefae('0x16'),_0xefae('0x17'),path[_0xefae('0x18')](_0x13351f[_0xefae('0x19')])));}})});router['post'](_0xefae('0xc'),upload[_0xefae('0x1a')](_0xefae('0x1b')),controller['addLogo']);var upload=multer({'storage':multer[_0xefae('0x11')]({'destination':function(_0xe8781c,_0x2eb72a,_0x22af6a){_0x22af6a(null,path[_0xefae('0x12')](config[_0xefae('0x13')],'server/files/images/logos/'));},'filename':function(_0x1e7c9e,_0x2c43e4,_0x548562){_0x548562(null,util['format'](_0xefae('0x16'),_0xefae('0x1c'),path['extname'](_0x2c43e4[_0xefae('0x19')])));}})});router[_0xefae('0x1d')](_0xefae('0xd'),upload['single'](_0xefae('0x1b')),controller[_0xefae('0x1e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x312f0d,_0x5e3aed,_0x4947b7){_0x4947b7(null,path[_0xefae('0x12')](config[_0xefae('0x13')],_0xefae('0x14')));},'filename':function(_0x2d5d18,_0x183f5d,_0x56d5da){_0x56d5da(null,util[_0xefae('0x15')]('%s%s',_0xefae('0x1f'),path[_0xefae('0x18')](_0x183f5d[_0xefae('0x19')])));}})});router[_0xefae('0x1d')](_0xefae('0x20'),upload[_0xefae('0x1a')](_0xefae('0x1b')),controller['addPreferred']);router[_0xefae('0x21')](_0xefae('0xa'),auth[_0xefae('0x8')](),controller['update']);module[_0xefae('0x22')]=router; \ No newline at end of file +var _0xac63=['multer','util','connect-timeout','express','Router','./setting.controller','get','isAuthenticated','index','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','getPreferred','join','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','file','addLogo','diskStorage','root','addPreferred','put','update','exports'];(function(_0x1a54ba,_0x4d79b8){var _0x4c596a=function(_0x5737b1){while(--_0x5737b1){_0x1a54ba['push'](_0x1a54ba['shift']());}};_0x4c596a(++_0x4d79b8);}(_0xac63,0xaa));var _0x3ac6=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0xac63[_0x10004e];return _0x5af990;};'use strict';var multer=require(_0x3ac6('0x0'));var util=require(_0x3ac6('0x1'));var path=require('path');var timeout=require(_0x3ac6('0x2'));var express=require(_0x3ac6('0x3'));var router=express[_0x3ac6('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3ac6('0x5'));router[_0x3ac6('0x6')]('/',auth[_0x3ac6('0x7')](),controller[_0x3ac6('0x8')]);router[_0x3ac6('0x6')](_0x3ac6('0x9'),controller[_0x3ac6('0xa')]);router[_0x3ac6('0x6')](_0x3ac6('0xb'),controller[_0x3ac6('0xc')]);router[_0x3ac6('0x6')](_0x3ac6('0xd'),controller[_0x3ac6('0xe')]);router[_0x3ac6('0x6')](_0x3ac6('0xf'),controller['gdpr']);router[_0x3ac6('0x6')]('/:id/preferred',controller[_0x3ac6('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x32b9f5,_0x5061ac,_0x2c0dc0){_0x2c0dc0(null,path[_0x3ac6('0x11')](config['root'],_0x3ac6('0x12')));},'filename':function(_0x18f563,_0x142b92,_0x33cac6){_0x33cac6(null,util[_0x3ac6('0x13')](_0x3ac6('0x14'),_0x3ac6('0x15'),path[_0x3ac6('0x16')](_0x142b92[_0x3ac6('0x17')])));}})});router[_0x3ac6('0x18')](_0x3ac6('0xb'),upload[_0x3ac6('0x19')](_0x3ac6('0x1a')),controller[_0x3ac6('0x1b')]);var upload=multer({'storage':multer[_0x3ac6('0x1c')]({'destination':function(_0x16ea1b,_0x2b3f3c,_0x56a0b5){_0x56a0b5(null,path[_0x3ac6('0x11')](config['root'],'server/files/images/logos/'));},'filename':function(_0x52403b,_0x4d940c,_0x54824e){_0x54824e(null,util['format'](_0x3ac6('0x14'),'logologin',path['extname'](_0x4d940c[_0x3ac6('0x17')])));}})});router[_0x3ac6('0x18')](_0x3ac6('0xd'),upload[_0x3ac6('0x19')](_0x3ac6('0x1a')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x3ac6('0x1c')]({'destination':function(_0x130332,_0x2cb210,_0x1eb69a){_0x1eb69a(null,path[_0x3ac6('0x11')](config[_0x3ac6('0x1d')],'server/files/images/logos/'));},'filename':function(_0x1dca3a,_0x1af665,_0x45c650){_0x45c650(null,util[_0x3ac6('0x13')](_0x3ac6('0x14'),'preferred',path[_0x3ac6('0x16')](_0x1af665[_0x3ac6('0x17')])));}})});router[_0x3ac6('0x18')]('/:id/preferred',upload[_0x3ac6('0x19')](_0x3ac6('0x1a')),controller[_0x3ac6('0x1e')]);router[_0x3ac6('0x1f')](_0x3ac6('0x9'),auth[_0x3ac6('0x7')](),controller[_0x3ac6('0x20')]);module[_0x3ac6('0x21')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 85dd239..f716615 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 _0x5ab6=['alternate','exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml'];(function(_0x42b030,_0x252cb6){var _0x112303=function(_0x261838){while(--_0x261838){_0x42b030['push'](_0x42b030['shift']());}};_0x112303(++_0x252cb6);}(_0x5ab6,0x1d5));var _0x65ab=function(_0x527f47,_0x5e46da){_0x527f47=_0x527f47-0x0;var _0x10ea41=_0x5ab6[_0x527f47];return _0x10ea41;};'use strict';var Sequelize=require('sequelize');module[_0x65ab('0x0')]={'min_internal':{'type':Sequelize[_0x65ab('0x1')](0xb),'unique':_0x65ab('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x65ab('0x1')](0xb),'unique':_0x65ab('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x65ab('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x65ab('0x4')],'defaultValue':_0x65ab('0x5')},'logo':{'type':Sequelize[_0x65ab('0x4')]},'defaultLogo':{'type':Sequelize[_0x65ab('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x65ab('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x65ab('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x65ab('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x65ab('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x65ab('0x4')]},'turnaddr':{'type':Sequelize[_0x65ab('0x4')]},'turnusername':{'type':Sequelize[_0x65ab('0x4')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x65ab('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x65ab('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x65ab('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x65ab('0x4')],'defaultValue':_0x65ab('0x7')},'enableEmailPreview':{'type':Sequelize[_0x65ab('0x6')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x65ab('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x65ab('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x65ab('0x8')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x65ab('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x65ab('0x4')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xa384=['alternate','INTEGER','min_internal','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml'];(function(_0x54eab6,_0x5e262f){var _0x1e7435=function(_0x468c91){while(--_0x468c91){_0x54eab6['push'](_0x54eab6['shift']());}};_0x1e7435(++_0x5e262f);}(_0xa384,0xa2));var _0x4a38=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0xa384[_0x2f1762];return _0x8ab21;};'use strict';var Sequelize=require('sequelize');module['exports']={'min_internal':{'type':Sequelize[_0x4a38('0x0')](0xb),'unique':_0x4a38('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x4a38('0x0')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x4a38('0x0')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x4a38('0x2')],'defaultValue':_0x4a38('0x3')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x4a38('0x4')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x4a38('0x4')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x4a38('0x2')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x4a38('0x4')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x4a38('0x4')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x4a38('0x4')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x4a38('0x2')]},'turnpassword':{'type':Sequelize[_0x4a38('0x2')]},'pageTitle':{'type':Sequelize[_0x4a38('0x2')]},'defaultPageTitle':{'type':Sequelize[_0x4a38('0x4')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x4a38('0x0')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x4a38('0x2')],'defaultValue':_0x4a38('0x5')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x4a38('0x0')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x4a38('0x0')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x4a38('0x0')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x4a38('0x2')],'defaultValue':_0x4a38('0x6')},'chatTimeout':{'type':Sequelize[_0x4a38('0x0')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x4a38('0x4')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x4a38('0x2')]},'defaultPreferred':{'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 3daa243..b9df8ac 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 _0xd0bb=['bluebird','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/environment','../../mysqldb','client','http','request','then','info','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Setting,\x20%s,\x20%s','message','result','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','destroy','stack','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','filter','merge','map','options','Setting','includeAll','include','findAll','rows','catch','show','params','body','get','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','/etc/asterisk/turn_xcally.conf','Reload','res_stun_monitor.so','res_rtp_asterisk.so','addLogo','file','filename','logo','find','addLogoLogin','loginLogo','../../config/license/util','getLogo','getLicense','preferred','toLower','default','custom','default_logo.png','Sequelize','ValidationError','Logo\x20not\x20found','download','getLogoLogin','server/files/images/logos','defaultPreferred','existsSync','default_loginLogo.png','upperFirst','securePassword','getPreferred','defaultLogo','defaultLoginLogo','default_preferred.png','html-pdf','eml-format','rimraf','fast-json-patch','moment'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x5c8edb,_0x105253){_0x5c8edb=_0x5c8edb-0x0;var _0x5a1451=_0xd0bb[_0x5c8edb];return _0x5a1451;};'use strict';var pdf=require(_0xbd0b('0x0'));var emlformat=require(_0xbd0b('0x1'));var rimraf=require(_0xbd0b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbd0b('0x3'));var rp=require('request-promise');var moment=require(_0xbd0b('0x4'));var BPromise=require(_0xbd0b('0x5'));var Mustache=require('mustache');var util=require(_0xbd0b('0x6'));var path=require('path');var sox=require(_0xbd0b('0x7'));var csv=require(_0xbd0b('0x8'));var ejs=require(_0xbd0b('0x9'));var fs=require('fs');var _=require(_0xbd0b('0xa'));var squel=require(_0xbd0b('0xb'));var crypto=require('crypto');var jsforce=require(_0xbd0b('0xc'));var deskjs=require(_0xbd0b('0xd'));var toCsv=require(_0xbd0b('0x8'));var querystring=require(_0xbd0b('0xe'));var Papa=require(_0xbd0b('0xf'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xbd0b('0x10'))(_0xbd0b('0x11'));var utils=require('../../config/utils');var config=require(_0xbd0b('0x12'));var db=require(_0xbd0b('0x13'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xbd0b('0x14')][_0xbd0b('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x3a4b28,_0x315ed9,_0x2621bf,_0x42a96b){return new BPromise(function(_0x420f96,_0x1f25b6){var _0x1a55ab=_0x42a96b||client;return _0x1a55ab[_0xbd0b('0x16')](_0x3a4b28,_0x2621bf)[_0xbd0b('0x17')](function(_0x57077a){logger[_0xbd0b('0x18')]('Setting,\x20%s,\x20%s',_0x315ed9,'request\x20sent');logger[_0xbd0b('0x19')](_0xbd0b('0x1a'),_0x315ed9,_0xbd0b('0x1b'),JSON[_0xbd0b('0x1c')](_0x57077a));if(_0x57077a[_0xbd0b('0x1d')]){if(_0x57077a['error']['code']===0x1f4){logger[_0xbd0b('0x1d')](_0xbd0b('0x1e'),_0x315ed9,_0x57077a[_0xbd0b('0x1d')][_0xbd0b('0x1f')]);return _0x1f25b6(_0x57077a[_0xbd0b('0x1d')][_0xbd0b('0x1f')]);}logger['error'](_0xbd0b('0x1e'),_0x315ed9,_0x57077a['error'][_0xbd0b('0x1f')]);return _0x420f96(_0x57077a[_0xbd0b('0x1d')][_0xbd0b('0x1f')]);}else{logger[_0xbd0b('0x18')]('Setting,\x20%s,\x20%s',_0x315ed9,_0xbd0b('0x1b'));_0x420f96(_0x57077a[_0xbd0b('0x20')][_0xbd0b('0x1f')]);}})['catch'](function(_0x1c5b52){logger['error'](_0xbd0b('0x1e'),_0x315ed9,_0x1c5b52);_0x1f25b6(_0x1c5b52);});});}function respondWithStatusCode(_0x3c4938,_0x3bbc03){_0x3bbc03=_0x3bbc03||0xcc;return function(_0x17a92a){if(_0x17a92a){return _0x3c4938[_0xbd0b('0x21')](_0x3bbc03);}return _0x3c4938['status'](_0x3bbc03)[_0xbd0b('0x22')]();};}function respondWithResult(_0x58a721,_0x3e7e9c){_0x3e7e9c=_0x3e7e9c||0xc8;return function(_0x18b9dc){if(_0x18b9dc){return _0x58a721[_0xbd0b('0x23')](_0x3e7e9c)[_0xbd0b('0x24')](_0x18b9dc);}};}function respondWithFilteredResult(_0xfd9f82,_0xb06342){return function(_0x4fe9ed){if(_0x4fe9ed){var _0x382f76=_0x4fe9ed[_0xbd0b('0x25')],_0x1b46a3=_0xb06342[_0xbd0b('0x26')],_0x33b752=_0xb06342['offset']+_0xb06342[_0xbd0b('0x27')],_0x1b5a00;if(_0x33b752>=_0x382f76){_0x33b752=_0x382f76;_0x1b5a00=0xc8;}else{_0x1b5a00=0xce;}_0xfd9f82[_0xbd0b('0x23')](_0x1b5a00);return _0xfd9f82[_0xbd0b('0x28')]('Content-Range',_0x1b46a3+'-'+_0x33b752+'/'+_0x382f76)['json'](_0x4fe9ed);}return null;};}function patchUpdates(_0x2187a5){return function(_0x684b09){try{jsonpatch[_0xbd0b('0x29')](_0x684b09,_0x2187a5,!![]);}catch(_0xf4ba04){return BPromise[_0xbd0b('0x2a')](_0xf4ba04);}return _0x684b09[_0xbd0b('0x2b')]();};}function saveUpdates(_0x41e083,_0x4bc752){return function(_0x45f7d6){if(_0x45f7d6){return _0x45f7d6[_0xbd0b('0x2c')](_0x41e083)['then'](function(_0x5e5e69){return _0x5e5e69;});}return null;};}function removeEntity(_0x206c6a,_0xab7a0d){return function(_0x53f555){if(_0x53f555){return _0x53f555[_0xbd0b('0x2d')]()[_0xbd0b('0x17')](function(){_0x206c6a[_0xbd0b('0x23')](0xcc)[_0xbd0b('0x22')]();});}};}function handleEntityNotFound(_0x3ce614,_0x27c478){return function(_0x5f224e){if(!_0x5f224e){_0x3ce614[_0xbd0b('0x21')](0x194);}return _0x5f224e;};}function handleError(_0x4524d9,_0x32572e){_0x32572e=_0x32572e||0x1f4;return function(_0x3e38e4){logger[_0xbd0b('0x1d')](_0x3e38e4[_0xbd0b('0x2e')]);if(_0x3e38e4[_0xbd0b('0x2f')]){delete _0x3e38e4[_0xbd0b('0x2f')];}_0x4524d9[_0xbd0b('0x23')](_0x32572e)[_0xbd0b('0x30')](_0x3e38e4);};}exports[_0xbd0b('0x31')]=function(_0xfc1894,_0x77c299){var _0x28fdc2={},_0x48e4cb={},_0x6132c8={'count':0x0,'rows':[]};var _0x23b0fa=db['Setting'][_0xbd0b('0x32')];_0x48e4cb[_0xbd0b('0x33')]=_[_0xbd0b('0x34')](_0x23b0fa);var _0xa2c4a0={'dateStart':_0xfc1894[_0xbd0b('0x35')][_0xbd0b('0x36')],'dateEnd':_0xfc1894['query'][_0xbd0b('0x37')]};delete _0xfc1894[_0xbd0b('0x35')][_0xbd0b('0x36')];delete _0xfc1894[_0xbd0b('0x35')][_0xbd0b('0x37')];_0x48e4cb['query']=_['keys'](_0xfc1894[_0xbd0b('0x35')]);_0x48e4cb[_0xbd0b('0x38')]=_[_0xbd0b('0x39')](_0x48e4cb[_0xbd0b('0x33')],_0x48e4cb['query']);_0x28fdc2['attributes']=_[_0xbd0b('0x39')](_0x48e4cb['model'],qs[_0xbd0b('0x3a')](_0xfc1894[_0xbd0b('0x35')][_0xbd0b('0x3a')]));_0x28fdc2[_0xbd0b('0x3b')]=_0x28fdc2[_0xbd0b('0x3b')][_0xbd0b('0x3c')]?_0x28fdc2[_0xbd0b('0x3b')]:_0x48e4cb[_0xbd0b('0x33')];if(!_0xfc1894[_0xbd0b('0x35')][_0xbd0b('0x3d')](_0xbd0b('0x3e'))){_0x28fdc2[_0xbd0b('0x27')]=qs[_0xbd0b('0x27')](_0xfc1894[_0xbd0b('0x35')][_0xbd0b('0x27')]);_0x28fdc2[_0xbd0b('0x26')]=qs[_0xbd0b('0x26')](_0xfc1894[_0xbd0b('0x35')]['offset']);}_0x28fdc2[_0xbd0b('0x3f')]=qs[_0xbd0b('0x40')](_0xfc1894[_0xbd0b('0x35')][_0xbd0b('0x40')]);_0x28fdc2[_0xbd0b('0x41')]=qs[_0xbd0b('0x38')](_[_0xbd0b('0x42')](_0xfc1894[_0xbd0b('0x35')],_0x48e4cb[_0xbd0b('0x38')]));if(_0xa2c4a0[_0xbd0b('0x36')]){if(_0xa2c4a0[_0xbd0b('0x37')]){_0xa2c4a0[_0xbd0b('0x37')]=moment(_0xa2c4a0['dateEnd'])[_0xbd0b('0x43')](0x1,'day');}else{_0xa2c4a0['dateEnd']=moment(_0xa2c4a0[_0xbd0b('0x36')])[_0xbd0b('0x43')](0x1,_0xbd0b('0x44'));}_['merge'](_0x28fdc2[_0xbd0b('0x41')],{'createdAt':{'$gte':_0xa2c4a0[_0xbd0b('0x36')],'$lte':_0xa2c4a0[_0xbd0b('0x37')]}});}if(_0xfc1894[_0xbd0b('0x35')][_0xbd0b('0x45')]){_0x28fdc2['where']=_[_0xbd0b('0x46')](_0x28fdc2[_0xbd0b('0x41')],{'$or':_[_0xbd0b('0x47')](_0x28fdc2[_0xbd0b('0x3b')],function(_0x102147){var _0xaaefaa={};_0xaaefaa[_0x102147]={'$like':'%'+_0xfc1894['query'][_0xbd0b('0x45')]+'%'};return _0xaaefaa;})});}_0x28fdc2=_[_0xbd0b('0x46')]({},_0x28fdc2,_0xfc1894[_0xbd0b('0x48')]);var _0x3f5835={'where':_0x28fdc2[_0xbd0b('0x41')]};return db[_0xbd0b('0x49')][_0xbd0b('0x25')](_0x3f5835)[_0xbd0b('0x17')](function(_0xc8b3f){_0x6132c8[_0xbd0b('0x25')]=_0xc8b3f;if(_0xfc1894[_0xbd0b('0x35')][_0xbd0b('0x4a')]){_0x28fdc2[_0xbd0b('0x4b')]=[{'all':!![]}];}return db[_0xbd0b('0x49')][_0xbd0b('0x4c')](_0x28fdc2);})[_0xbd0b('0x17')](function(_0x3b77fb){_0x6132c8[_0xbd0b('0x4d')]=_0x3b77fb;return _0x6132c8;})[_0xbd0b('0x17')](respondWithFilteredResult(_0x77c299,_0x28fdc2))[_0xbd0b('0x4e')](handleError(_0x77c299,null));};exports[_0xbd0b('0x4f')]=function(_0xbd64e2,_0x915d2c){var _0x5148c2={'raw':![],'where':{'id':_0xbd64e2[_0xbd0b('0x50')]['id']}},_0x12d3e7={};_0x12d3e7['model']=_['keys'](db['Setting'][_0xbd0b('0x32')]);_0x12d3e7['query']=_[_0xbd0b('0x34')](_0xbd64e2[_0xbd0b('0x35')]);_0x12d3e7[_0xbd0b('0x38')]=_[_0xbd0b('0x39')](_0x12d3e7['model'],_0x12d3e7[_0xbd0b('0x35')]);_0x5148c2['attributes']=_[_0xbd0b('0x39')](_0x12d3e7['model'],qs['fields'](_0xbd64e2[_0xbd0b('0x35')][_0xbd0b('0x3a')]));_0x5148c2[_0xbd0b('0x3b')]=_0x5148c2[_0xbd0b('0x3b')][_0xbd0b('0x3c')]?_0x5148c2[_0xbd0b('0x3b')]:_0x12d3e7[_0xbd0b('0x33')];if(_0xbd64e2[_0xbd0b('0x35')]['includeAll']){_0x5148c2['include']=[{'all':!![]}];}_0x5148c2=_[_0xbd0b('0x46')]({},_0x5148c2,_0xbd64e2[_0xbd0b('0x48')]);return db['Setting']['find'](_0x5148c2)[_0xbd0b('0x17')](handleEntityNotFound(_0x915d2c,null))[_0xbd0b('0x17')](respondWithResult(_0x915d2c,null))[_0xbd0b('0x4e')](handleError(_0x915d2c,null));};exports[_0xbd0b('0x2c')]=function(_0x550e84,_0x444f7d,_0x248794){var _0x19d3e0;return db[_0xbd0b('0x49')]['find']({'where':{'id':_0x550e84[_0xbd0b('0x50')]['id']}})[_0xbd0b('0x17')](handleEntityNotFound(_0x444f7d,null))['then'](saveUpdates(_0x550e84[_0xbd0b('0x51')],null))[_0xbd0b('0x17')](function(_0x44bc2a){if(_0x44bc2a){_0x19d3e0=_0x44bc2a[_0xbd0b('0x52')]({'plain':!![]});var _0x1ba677=fs[_0xbd0b('0x53')](path[_0xbd0b('0x54')](config[_0xbd0b('0x55')],'server/files/templates/stun.ejs'),_0xbd0b('0x56'));var _0x114cf9=ejs[_0xbd0b('0x57')](_0x1ba677,_0x19d3e0);var _0x15b83e=fs[_0xbd0b('0x53')](path[_0xbd0b('0x54')](config['root'],'server/files/templates/turn.ejs'),_0xbd0b('0x56'));var _0xe881f2=ejs['render'](_0x15b83e,_0x19d3e0);fs[_0xbd0b('0x58')](_0xbd0b('0x59'),_0x114cf9);fs[_0xbd0b('0x58')](_0xbd0b('0x5a'),_0xe881f2);return respondWithRpcPromise(_0xbd0b('0x5b'),'update',{'module':_0xbd0b('0x5c')});}})[_0xbd0b('0x17')](function(){return respondWithRpcPromise(_0xbd0b('0x5b'),_0xbd0b('0x2c'),{'module':_0xbd0b('0x5d')});})[_0xbd0b('0x17')](function(){return _0x19d3e0||null;})[_0xbd0b('0x17')](respondWithResult(_0x444f7d,null))[_0xbd0b('0x4e')](handleError(_0x444f7d,null));};exports[_0xbd0b('0x5e')]=function(_0x21a22a,_0x471443,_0x3ed651){if(_0x21a22a[_0xbd0b('0x5f')]&&_0x21a22a[_0xbd0b('0x5f')][_0xbd0b('0x60')]){_0x21a22a[_0xbd0b('0x51')][_0xbd0b('0x61')]=_0x21a22a['file'][_0xbd0b('0x60')];}return db[_0xbd0b('0x49')][_0xbd0b('0x62')]({'where':{'id':_0x21a22a[_0xbd0b('0x50')]['id']}})['then'](handleEntityNotFound(_0x471443,null))['then'](saveUpdates(_0x21a22a[_0xbd0b('0x51')],null))[_0xbd0b('0x17')](respondWithResult(_0x471443,null))[_0xbd0b('0x4e')](handleError(_0x471443,null));};exports[_0xbd0b('0x63')]=function(_0x2085f2,_0x5813a2,_0x19d32c){if(_0x2085f2['file']&&_0x2085f2[_0xbd0b('0x5f')][_0xbd0b('0x60')]){_0x2085f2[_0xbd0b('0x51')][_0xbd0b('0x64')]=_0x2085f2[_0xbd0b('0x5f')][_0xbd0b('0x60')];}return db['Setting'][_0xbd0b('0x62')]({'where':{'id':_0x2085f2[_0xbd0b('0x50')]['id']}})[_0xbd0b('0x17')](handleEntityNotFound(_0x5813a2,null))[_0xbd0b('0x17')](saveUpdates(_0x2085f2['body'],null))[_0xbd0b('0x17')](respondWithResult(_0x5813a2,null))[_0xbd0b('0x4e')](handleError(_0x5813a2,null));};var utilLicense=require(_0xbd0b('0x65'));exports[_0xbd0b('0x66')]=function(_0x274e79,_0x4df3df,_0x496875){var _0x4ce5bc='server/files/images/logos';var _0x2cd008={'custom':![]};return utilLicense[_0xbd0b('0x67')]()[_0xbd0b('0x17')](function(_0x1876ae){if(_0x1876ae){_0x2cd008=_0x1876ae;}return db[_0xbd0b('0x49')][_0xbd0b('0x62')]({'where':{'id':_0x274e79['params']['id']},'attributes':[_0xbd0b('0x61'),'loginLogo',_0xbd0b('0x68'),'defaultLogo','defaultLoginLogo','defaultPreferred'],'raw':!![]});})[_0xbd0b('0x17')](handleEntityNotFound(_0x4df3df,null))['then'](function(_0x57d14b){if(_0x57d14b){var _0x308317=_0x57d14b[_0xbd0b('0x61')]&&fs['existsSync'](path[_0xbd0b('0x54')](config['root'],_0x4ce5bc,_['toLower'](_0x57d14b[_0xbd0b('0x61')])))?path[_0xbd0b('0x54')](config[_0xbd0b('0x55')],_0x4ce5bc,_[_0xbd0b('0x69')](_0x57d14b[_0xbd0b('0x61')])):path[_0xbd0b('0x54')](config[_0xbd0b('0x55')],_0x4ce5bc,_[_0xbd0b('0x69')]('default_logo.png'));var _0x5c8cb7=_0xbd0b('0x6a')+_['upperFirst'](_0xbd0b('0x61'));if(_0x57d14b[_0x5c8cb7]||!_0x2cd008[_0xbd0b('0x6b')]){_0x308317=path[_0xbd0b('0x54')](config['root'],_0x4ce5bc,_[_0xbd0b('0x69')](_0xbd0b('0x6c')));}if(!fs['existsSync'](_0x308317)){throw new db[(_0xbd0b('0x6d'))][(_0xbd0b('0x6e'))](_0xbd0b('0x6f'));}return _0x4df3df[_0xbd0b('0x70')](_0x308317);}})[_0xbd0b('0x4e')](handleError(_0x4df3df,null));};var utilLicense=require('../../config/license/util');exports[_0xbd0b('0x71')]=function(_0x202800,_0x353c5a,_0x2db3a0){var _0x56fc7a=_0xbd0b('0x72');var _0x1eb23f={'custom':![]};return utilLicense['getLicense']()[_0xbd0b('0x17')](function(_0x4ced87){if(_0x4ced87){_0x1eb23f=_0x4ced87;}return db[_0xbd0b('0x49')][_0xbd0b('0x62')]({'where':{'id':_0x202800[_0xbd0b('0x50')]['id']},'attributes':[_0xbd0b('0x61'),_0xbd0b('0x64'),'preferred','defaultLogo','defaultLoginLogo',_0xbd0b('0x73')],'raw':!![]});})[_0xbd0b('0x17')](handleEntityNotFound(_0x353c5a,null))[_0xbd0b('0x17')](function(_0x4f3b37){if(_0x4f3b37){var _0x2a394c=_0x4f3b37[_0xbd0b('0x64')]&&fs[_0xbd0b('0x74')](path[_0xbd0b('0x54')](config[_0xbd0b('0x55')],_0x56fc7a,_['toLower'](_0x4f3b37[_0xbd0b('0x64')])))?path['join'](config[_0xbd0b('0x55')],_0x56fc7a,_[_0xbd0b('0x69')](_0x4f3b37[_0xbd0b('0x64')])):path[_0xbd0b('0x54')](config[_0xbd0b('0x55')],_0x56fc7a,_[_0xbd0b('0x69')](_0xbd0b('0x75')));var _0x35ef58=_0xbd0b('0x6a')+_[_0xbd0b('0x76')]('loginLogo');if(_0x4f3b37[_0x35ef58]||!_0x1eb23f[_0xbd0b('0x6b')]){_0x2a394c=path[_0xbd0b('0x54')](config[_0xbd0b('0x55')],_0x56fc7a,_[_0xbd0b('0x69')](_0xbd0b('0x75')));}if(!fs[_0xbd0b('0x74')](_0x2a394c)){throw new db[(_0xbd0b('0x6d'))]['ValidationError'](_0xbd0b('0x6f'));}return _0x353c5a[_0xbd0b('0x70')](_0x2a394c);}})[_0xbd0b('0x4e')](handleError(_0x353c5a,null));};exports['gdpr']=function(_0x1d1d70,_0x5ba4bf){return db[_0xbd0b('0x49')][_0xbd0b('0x62')]({'where':{'id':_0x1d1d70[_0xbd0b('0x50')]['id']},'attributes':[_0xbd0b('0x77')]})[_0xbd0b('0x17')](respondWithResult(_0x5ba4bf,null))[_0xbd0b('0x4e')](handleError(_0x5ba4bf,null));};exports['addPreferred']=function(_0xdc102d,_0x35a947,_0x2b3459){if(_0xdc102d[_0xbd0b('0x5f')]&&_0xdc102d['file'][_0xbd0b('0x60')]){_0xdc102d['body'][_0xbd0b('0x68')]=_0xdc102d[_0xbd0b('0x5f')][_0xbd0b('0x60')];}return db[_0xbd0b('0x49')][_0xbd0b('0x62')]({'where':{'id':_0xdc102d[_0xbd0b('0x50')]['id']}})[_0xbd0b('0x17')](handleEntityNotFound(_0x35a947,null))[_0xbd0b('0x17')](saveUpdates(_0xdc102d[_0xbd0b('0x51')],null))[_0xbd0b('0x17')](respondWithResult(_0x35a947,null))[_0xbd0b('0x4e')](handleError(_0x35a947,null));};var utilLicense=require(_0xbd0b('0x65'));exports[_0xbd0b('0x78')]=function(_0x50b868,_0x39740c,_0x2a86f5){var _0x2dc361=_0xbd0b('0x72');var _0xf81312={'custom':![]};return utilLicense[_0xbd0b('0x67')]()[_0xbd0b('0x17')](function(_0x38dc35){if(_0x38dc35){_0xf81312=_0x38dc35;}return db[_0xbd0b('0x49')][_0xbd0b('0x62')]({'where':{'id':_0x50b868[_0xbd0b('0x50')]['id']},'attributes':[_0xbd0b('0x61'),_0xbd0b('0x64'),'preferred',_0xbd0b('0x79'),_0xbd0b('0x7a'),_0xbd0b('0x73')],'raw':!![]});})[_0xbd0b('0x17')](handleEntityNotFound(_0x39740c,null))['then'](function(_0x14f0c6){if(_0x14f0c6){var _0x1f32c5=_0x14f0c6[_0xbd0b('0x68')]&&fs[_0xbd0b('0x74')](path[_0xbd0b('0x54')](config['root'],_0x2dc361,_['toLower'](_0x14f0c6[_0xbd0b('0x68')])))?path[_0xbd0b('0x54')](config[_0xbd0b('0x55')],_0x2dc361,_['toLower'](_0x14f0c6[_0xbd0b('0x68')])):path[_0xbd0b('0x54')](config[_0xbd0b('0x55')],_0x2dc361,_['toLower'](_0xbd0b('0x7b')));var _0x5dbb78='default'+_[_0xbd0b('0x76')]('preferred');if(_0x14f0c6[_0x5dbb78]||!_0xf81312['custom']||!_0xf81312[_0xbd0b('0x68')]){_0x1f32c5=path['join'](config[_0xbd0b('0x55')],_0x2dc361,_[_0xbd0b('0x69')]('default_preferred.png'));}if(!fs[_0xbd0b('0x74')](_0x1f32c5)){throw new db[(_0xbd0b('0x6d'))][(_0xbd0b('0x6e'))](_0xbd0b('0x6f'));}return _0x39740c[_0xbd0b('0x70')](_0x1f32c5);}})['catch'](handleError(_0x39740c,null));}; \ No newline at end of file +var _0x34e8=['sort','where','pick','add','day','filter','merge','map','options','includeAll','include','findAll','rows','show','params','fields','find','body','get','readFileSync','join','server/files/templates/stun.ejs','render','root','server/files/templates/turn.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','Reload','res_stun_monitor.so','res_rtp_asterisk.so','addLogo','file','filename','logo','addLogoLogin','../../config/license/util','server/files/images/logos','getLicense','loginLogo','preferred','defaultLoginLogo','existsSync','toLower','upperFirst','custom','Sequelize','ValidationError','download','getLogoLogin','defaultPreferred','Logo\x20not\x20found','gdpr','addPreferred','getPreferred','defaultLogo','default','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','code','Setting,\x20%s,\x20%s','message','result','catch','status','end','count','offset','limit','apply','save','update','then','destroy','sendStatus','name','send','Setting','rawAttributes','model','keys','dateStart','dateEnd','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x37e799,_0x32625f){var _0x436718=function(_0x3e28a9){while(--_0x3e28a9){_0x37e799['push'](_0x37e799['shift']());}};_0x436718(++_0x32625f);}(_0x34e8,0x12c));var _0x834e=function(_0x6df2fe,_0x2234bc){_0x6df2fe=_0x6df2fe-0x0;var _0x39acd3=_0x34e8[_0x6df2fe];return _0x39acd3;};'use strict';var pdf=require(_0x834e('0x0'));var emlformat=require(_0x834e('0x1'));var rimraf=require(_0x834e('0x2'));var zipdir=require(_0x834e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x834e('0x4'));var moment=require(_0x834e('0x5'));var BPromise=require(_0x834e('0x6'));var Mustache=require(_0x834e('0x7'));var util=require(_0x834e('0x8'));var path=require(_0x834e('0x9'));var sox=require(_0x834e('0xa'));var csv=require('to-csv');var ejs=require(_0x834e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0x10'));var querystring=require(_0x834e('0x11'));var Papa=require(_0x834e('0x12'));var Redis=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var logger=require(_0x834e('0x15'))(_0x834e('0x16'));var utils=require(_0x834e('0x17'));var config=require(_0x834e('0x18'));var db=require(_0x834e('0x19'))['db'];var jayson=require(_0x834e('0x1a'));var client=jayson[_0x834e('0x1b')][_0x834e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x538bb3,_0x5e5b6d,_0x6cd9b9,_0x58a27e){return new BPromise(function(_0x23848e,_0x2d95f2){var _0x28e659=_0x58a27e||client;return _0x28e659[_0x834e('0x1d')](_0x538bb3,_0x6cd9b9)['then'](function(_0x43156c){logger[_0x834e('0x1e')]('Setting,\x20%s,\x20%s',_0x5e5b6d,_0x834e('0x1f'));logger['debug'](_0x834e('0x20'),_0x5e5b6d,_0x834e('0x1f'),JSON['stringify'](_0x43156c));if(_0x43156c[_0x834e('0x21')]){if(_0x43156c[_0x834e('0x21')][_0x834e('0x22')]===0x1f4){logger['error'](_0x834e('0x23'),_0x5e5b6d,_0x43156c[_0x834e('0x21')][_0x834e('0x24')]);return _0x2d95f2(_0x43156c[_0x834e('0x21')][_0x834e('0x24')]);}logger[_0x834e('0x21')](_0x834e('0x23'),_0x5e5b6d,_0x43156c['error'][_0x834e('0x24')]);return _0x23848e(_0x43156c[_0x834e('0x21')][_0x834e('0x24')]);}else{logger[_0x834e('0x1e')]('Setting,\x20%s,\x20%s',_0x5e5b6d,_0x834e('0x1f'));_0x23848e(_0x43156c[_0x834e('0x25')]['message']);}})[_0x834e('0x26')](function(_0x28d687){logger[_0x834e('0x21')]('Setting,\x20%s,\x20%s',_0x5e5b6d,_0x28d687);_0x2d95f2(_0x28d687);});});}function respondWithStatusCode(_0x4e3f48,_0x231619){_0x231619=_0x231619||0xcc;return function(_0x34563b){if(_0x34563b){return _0x4e3f48['sendStatus'](_0x231619);}return _0x4e3f48[_0x834e('0x27')](_0x231619)[_0x834e('0x28')]();};}function respondWithResult(_0x58f4fd,_0x3bc4f7){_0x3bc4f7=_0x3bc4f7||0xc8;return function(_0x2e1983){if(_0x2e1983){return _0x58f4fd[_0x834e('0x27')](_0x3bc4f7)['json'](_0x2e1983);}};}function respondWithFilteredResult(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(_0x5e1cc5){var _0x5bef62=_0x5e1cc5[_0x834e('0x29')],_0x1e713a=_0x3e310f[_0x834e('0x2a')],_0x508a1d=_0x3e310f[_0x834e('0x2a')]+_0x3e310f[_0x834e('0x2b')],_0x2826ec;if(_0x508a1d>=_0x5bef62){_0x508a1d=_0x5bef62;_0x2826ec=0xc8;}else{_0x2826ec=0xce;}_0x24fcf7[_0x834e('0x27')](_0x2826ec);return _0x24fcf7['set']('Content-Range',_0x1e713a+'-'+_0x508a1d+'/'+_0x5bef62)['json'](_0x5e1cc5);}return null;};}function patchUpdates(_0x58c1d7){return function(_0x2c7a8d){try{jsonpatch[_0x834e('0x2c')](_0x2c7a8d,_0x58c1d7,!![]);}catch(_0x106d6a){return BPromise['reject'](_0x106d6a);}return _0x2c7a8d[_0x834e('0x2d')]();};}function saveUpdates(_0x11f1ce,_0x1f3671){return function(_0x1e026a){if(_0x1e026a){return _0x1e026a[_0x834e('0x2e')](_0x11f1ce)[_0x834e('0x2f')](function(_0x3d149d){return _0x3d149d;});}return null;};}function removeEntity(_0xfaf716,_0x278db3){return function(_0x493289){if(_0x493289){return _0x493289[_0x834e('0x30')]()['then'](function(){_0xfaf716[_0x834e('0x27')](0xcc)[_0x834e('0x28')]();});}};}function handleEntityNotFound(_0x9ab921,_0x2b3418){return function(_0x444366){if(!_0x444366){_0x9ab921[_0x834e('0x31')](0x194);}return _0x444366;};}function handleError(_0x4696a1,_0x38cd29){_0x38cd29=_0x38cd29||0x1f4;return function(_0x358c31){logger[_0x834e('0x21')](_0x358c31['stack']);if(_0x358c31[_0x834e('0x32')]){delete _0x358c31[_0x834e('0x32')];}_0x4696a1[_0x834e('0x27')](_0x38cd29)[_0x834e('0x33')](_0x358c31);};}exports['index']=function(_0x3f88ad,_0x379d60){var _0x4b12f5={},_0x496533={},_0x59385a={'count':0x0,'rows':[]};var _0x3e58fa=db[_0x834e('0x34')][_0x834e('0x35')];_0x496533[_0x834e('0x36')]=_[_0x834e('0x37')](_0x3e58fa);var _0x1b76dd={'dateStart':_0x3f88ad['query'][_0x834e('0x38')],'dateEnd':_0x3f88ad['query'][_0x834e('0x39')]};delete _0x3f88ad[_0x834e('0x3a')]['dateStart'];delete _0x3f88ad[_0x834e('0x3a')][_0x834e('0x39')];_0x496533['query']=_['keys'](_0x3f88ad[_0x834e('0x3a')]);_0x496533[_0x834e('0x3b')]=_[_0x834e('0x3c')](_0x496533[_0x834e('0x36')],_0x496533[_0x834e('0x3a')]);_0x4b12f5['attributes']=_[_0x834e('0x3c')](_0x496533['model'],qs['fields'](_0x3f88ad[_0x834e('0x3a')]['fields']));_0x4b12f5[_0x834e('0x3d')]=_0x4b12f5[_0x834e('0x3d')][_0x834e('0x3e')]?_0x4b12f5[_0x834e('0x3d')]:_0x496533[_0x834e('0x36')];if(!_0x3f88ad['query'][_0x834e('0x3f')](_0x834e('0x40'))){_0x4b12f5[_0x834e('0x2b')]=qs['limit'](_0x3f88ad[_0x834e('0x3a')][_0x834e('0x2b')]);_0x4b12f5['offset']=qs[_0x834e('0x2a')](_0x3f88ad['query'][_0x834e('0x2a')]);}_0x4b12f5[_0x834e('0x41')]=qs['sort'](_0x3f88ad['query'][_0x834e('0x42')]);_0x4b12f5[_0x834e('0x43')]=qs[_0x834e('0x3b')](_[_0x834e('0x44')](_0x3f88ad[_0x834e('0x3a')],_0x496533[_0x834e('0x3b')]));if(_0x1b76dd[_0x834e('0x38')]){if(_0x1b76dd['dateEnd']){_0x1b76dd[_0x834e('0x39')]=moment(_0x1b76dd['dateEnd'])[_0x834e('0x45')](0x1,'day');}else{_0x1b76dd[_0x834e('0x39')]=moment(_0x1b76dd['dateStart'])[_0x834e('0x45')](0x1,_0x834e('0x46'));}_['merge'](_0x4b12f5[_0x834e('0x43')],{'createdAt':{'$gte':_0x1b76dd[_0x834e('0x38')],'$lte':_0x1b76dd[_0x834e('0x39')]}});}if(_0x3f88ad[_0x834e('0x3a')][_0x834e('0x47')]){_0x4b12f5[_0x834e('0x43')]=_[_0x834e('0x48')](_0x4b12f5[_0x834e('0x43')],{'$or':_[_0x834e('0x49')](_0x4b12f5[_0x834e('0x3d')],function(_0x5f3943){var _0x3124be={};_0x3124be[_0x5f3943]={'$like':'%'+_0x3f88ad[_0x834e('0x3a')]['filter']+'%'};return _0x3124be;})});}_0x4b12f5=_[_0x834e('0x48')]({},_0x4b12f5,_0x3f88ad[_0x834e('0x4a')]);var _0x25b035={'where':_0x4b12f5[_0x834e('0x43')]};return db[_0x834e('0x34')][_0x834e('0x29')](_0x25b035)['then'](function(_0x59c855){_0x59385a[_0x834e('0x29')]=_0x59c855;if(_0x3f88ad[_0x834e('0x3a')][_0x834e('0x4b')]){_0x4b12f5[_0x834e('0x4c')]=[{'all':!![]}];}return db[_0x834e('0x34')][_0x834e('0x4d')](_0x4b12f5);})[_0x834e('0x2f')](function(_0x43f599){_0x59385a[_0x834e('0x4e')]=_0x43f599;return _0x59385a;})[_0x834e('0x2f')](respondWithFilteredResult(_0x379d60,_0x4b12f5))[_0x834e('0x26')](handleError(_0x379d60,null));};exports[_0x834e('0x4f')]=function(_0x1a28f6,_0x1a3237){var _0x2aa072={'raw':![],'where':{'id':_0x1a28f6[_0x834e('0x50')]['id']}},_0x1a3855={};_0x1a3855[_0x834e('0x36')]=_[_0x834e('0x37')](db[_0x834e('0x34')]['rawAttributes']);_0x1a3855[_0x834e('0x3a')]=_[_0x834e('0x37')](_0x1a28f6['query']);_0x1a3855[_0x834e('0x3b')]=_[_0x834e('0x3c')](_0x1a3855['model'],_0x1a3855[_0x834e('0x3a')]);_0x2aa072[_0x834e('0x3d')]=_[_0x834e('0x3c')](_0x1a3855[_0x834e('0x36')],qs[_0x834e('0x51')](_0x1a28f6[_0x834e('0x3a')][_0x834e('0x51')]));_0x2aa072['attributes']=_0x2aa072[_0x834e('0x3d')][_0x834e('0x3e')]?_0x2aa072[_0x834e('0x3d')]:_0x1a3855[_0x834e('0x36')];if(_0x1a28f6[_0x834e('0x3a')][_0x834e('0x4b')]){_0x2aa072[_0x834e('0x4c')]=[{'all':!![]}];}_0x2aa072=_[_0x834e('0x48')]({},_0x2aa072,_0x1a28f6['options']);return db[_0x834e('0x34')]['find'](_0x2aa072)[_0x834e('0x2f')](handleEntityNotFound(_0x1a3237,null))['then'](respondWithResult(_0x1a3237,null))[_0x834e('0x26')](handleError(_0x1a3237,null));};exports['update']=function(_0x527eef,_0x6c0b29,_0x3e1bee){var _0x5291ae;return db['Setting'][_0x834e('0x52')]({'where':{'id':_0x527eef[_0x834e('0x50')]['id']}})[_0x834e('0x2f')](handleEntityNotFound(_0x6c0b29,null))[_0x834e('0x2f')](saveUpdates(_0x527eef[_0x834e('0x53')],null))[_0x834e('0x2f')](function(_0x3d3f2b){if(_0x3d3f2b){_0x5291ae=_0x3d3f2b[_0x834e('0x54')]({'plain':!![]});var _0x528e66=fs[_0x834e('0x55')](path[_0x834e('0x56')](config['root'],_0x834e('0x57')),'utf8');var _0x3e58ef=ejs[_0x834e('0x58')](_0x528e66,_0x5291ae);var _0x5160c4=fs[_0x834e('0x55')](path[_0x834e('0x56')](config[_0x834e('0x59')],_0x834e('0x5a')),'utf8');var _0xe35ded=ejs[_0x834e('0x58')](_0x5160c4,_0x5291ae);fs[_0x834e('0x5b')]('/etc/asterisk/stun_xcally.conf',_0x3e58ef);fs[_0x834e('0x5b')](_0x834e('0x5c'),_0xe35ded);return respondWithRpcPromise(_0x834e('0x5d'),_0x834e('0x2e'),{'module':_0x834e('0x5e')});}})[_0x834e('0x2f')](function(){return respondWithRpcPromise(_0x834e('0x5d'),_0x834e('0x2e'),{'module':_0x834e('0x5f')});})[_0x834e('0x2f')](function(){return _0x5291ae||null;})[_0x834e('0x2f')](respondWithResult(_0x6c0b29,null))[_0x834e('0x26')](handleError(_0x6c0b29,null));};exports[_0x834e('0x60')]=function(_0x1659c8,_0x460a7a,_0x17b8e3){if(_0x1659c8[_0x834e('0x61')]&&_0x1659c8[_0x834e('0x61')][_0x834e('0x62')]){_0x1659c8[_0x834e('0x53')][_0x834e('0x63')]=_0x1659c8[_0x834e('0x61')]['filename'];}return db[_0x834e('0x34')][_0x834e('0x52')]({'where':{'id':_0x1659c8[_0x834e('0x50')]['id']}})[_0x834e('0x2f')](handleEntityNotFound(_0x460a7a,null))['then'](saveUpdates(_0x1659c8[_0x834e('0x53')],null))['then'](respondWithResult(_0x460a7a,null))['catch'](handleError(_0x460a7a,null));};exports[_0x834e('0x64')]=function(_0x2b1ec7,_0x1644dd,_0xe79465){if(_0x2b1ec7[_0x834e('0x61')]&&_0x2b1ec7[_0x834e('0x61')][_0x834e('0x62')]){_0x2b1ec7[_0x834e('0x53')]['loginLogo']=_0x2b1ec7[_0x834e('0x61')]['filename'];}return db[_0x834e('0x34')][_0x834e('0x52')]({'where':{'id':_0x2b1ec7['params']['id']}})['then'](handleEntityNotFound(_0x1644dd,null))[_0x834e('0x2f')](saveUpdates(_0x2b1ec7[_0x834e('0x53')],null))[_0x834e('0x2f')](respondWithResult(_0x1644dd,null))[_0x834e('0x26')](handleError(_0x1644dd,null));};var utilLicense=require(_0x834e('0x65'));exports['getLogo']=function(_0x2b0d93,_0x15018f,_0x2df64f){var _0x228a60=_0x834e('0x66');var _0x28b5c9={'custom':![]};return utilLicense[_0x834e('0x67')]()[_0x834e('0x2f')](function(_0x376f72){if(_0x376f72){_0x28b5c9=_0x376f72;}return db[_0x834e('0x34')]['find']({'where':{'id':_0x2b0d93[_0x834e('0x50')]['id']},'attributes':[_0x834e('0x63'),_0x834e('0x68'),_0x834e('0x69'),'defaultLogo',_0x834e('0x6a'),'defaultPreferred'],'raw':!![]});})['then'](handleEntityNotFound(_0x15018f,null))['then'](function(_0x452f7f){if(_0x452f7f){var _0x332d8f=_0x452f7f['logo']&&fs[_0x834e('0x6b')](path[_0x834e('0x56')](config['root'],_0x228a60,_[_0x834e('0x6c')](_0x452f7f[_0x834e('0x63')])))?path['join'](config['root'],_0x228a60,_[_0x834e('0x6c')](_0x452f7f[_0x834e('0x63')])):path[_0x834e('0x56')](config[_0x834e('0x59')],_0x228a60,_[_0x834e('0x6c')]('default_logo.png'));var _0x264a6f='default'+_[_0x834e('0x6d')](_0x834e('0x63'));if(_0x452f7f[_0x264a6f]||!_0x28b5c9[_0x834e('0x6e')]){_0x332d8f=path['join'](config[_0x834e('0x59')],_0x228a60,_[_0x834e('0x6c')]('default_logo.png'));}if(!fs[_0x834e('0x6b')](_0x332d8f)){throw new db[(_0x834e('0x6f'))][(_0x834e('0x70'))]('Logo\x20not\x20found');}return _0x15018f[_0x834e('0x71')](_0x332d8f);}})[_0x834e('0x26')](handleError(_0x15018f,null));};var utilLicense=require(_0x834e('0x65'));exports[_0x834e('0x72')]=function(_0x1a7399,_0x29bfd7,_0x1372dd){var _0x23b5d9=_0x834e('0x66');var _0x1691d5={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x4e466e){if(_0x4e466e){_0x1691d5=_0x4e466e;}return db[_0x834e('0x34')][_0x834e('0x52')]({'where':{'id':_0x1a7399[_0x834e('0x50')]['id']},'attributes':[_0x834e('0x63'),_0x834e('0x68'),'preferred','defaultLogo',_0x834e('0x6a'),_0x834e('0x73')],'raw':!![]});})[_0x834e('0x2f')](handleEntityNotFound(_0x29bfd7,null))[_0x834e('0x2f')](function(_0x40a705){if(_0x40a705){var _0x5acf5c=_0x40a705[_0x834e('0x68')]&&fs[_0x834e('0x6b')](path[_0x834e('0x56')](config['root'],_0x23b5d9,_[_0x834e('0x6c')](_0x40a705[_0x834e('0x68')])))?path[_0x834e('0x56')](config[_0x834e('0x59')],_0x23b5d9,_[_0x834e('0x6c')](_0x40a705['loginLogo'])):path['join'](config[_0x834e('0x59')],_0x23b5d9,_[_0x834e('0x6c')]('default_loginLogo.png'));var _0xb57b1b='default'+_[_0x834e('0x6d')](_0x834e('0x68'));if(_0x40a705[_0xb57b1b]||!_0x1691d5[_0x834e('0x6e')]){_0x5acf5c=path['join'](config[_0x834e('0x59')],_0x23b5d9,_['toLower']('default_loginLogo.png'));}if(!fs['existsSync'](_0x5acf5c)){throw new db[(_0x834e('0x6f'))][(_0x834e('0x70'))](_0x834e('0x74'));}return _0x29bfd7[_0x834e('0x71')](_0x5acf5c);}})[_0x834e('0x26')](handleError(_0x29bfd7,null));};exports[_0x834e('0x75')]=function(_0x3aa388,_0x179892){return db[_0x834e('0x34')]['find']({'where':{'id':_0x3aa388[_0x834e('0x50')]['id']},'attributes':['securePassword']})[_0x834e('0x2f')](respondWithResult(_0x179892,null))[_0x834e('0x26')](handleError(_0x179892,null));};exports[_0x834e('0x76')]=function(_0x27df3d,_0x1d1877,_0x116830){if(_0x27df3d['file']&&_0x27df3d['file'][_0x834e('0x62')]){_0x27df3d[_0x834e('0x53')]['preferred']=_0x27df3d[_0x834e('0x61')][_0x834e('0x62')];}return db[_0x834e('0x34')][_0x834e('0x52')]({'where':{'id':_0x27df3d[_0x834e('0x50')]['id']}})['then'](handleEntityNotFound(_0x1d1877,null))[_0x834e('0x2f')](saveUpdates(_0x27df3d[_0x834e('0x53')],null))['then'](respondWithResult(_0x1d1877,null))['catch'](handleError(_0x1d1877,null));};var utilLicense=require('../../config/license/util');exports[_0x834e('0x77')]=function(_0x1f3e26,_0x4f716d,_0x23ce49){var _0x1f053f='server/files/images/logos';var _0xfb93b1={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x41dfd9){if(_0x41dfd9){_0xfb93b1=_0x41dfd9;}return db[_0x834e('0x34')][_0x834e('0x52')]({'where':{'id':_0x1f3e26[_0x834e('0x50')]['id']},'attributes':['logo',_0x834e('0x68'),_0x834e('0x69'),_0x834e('0x78'),_0x834e('0x6a'),_0x834e('0x73')],'raw':!![]});})[_0x834e('0x2f')](handleEntityNotFound(_0x4f716d,null))[_0x834e('0x2f')](function(_0x15e141){if(_0x15e141){var _0x13c5a4=_0x15e141[_0x834e('0x69')]&&fs[_0x834e('0x6b')](path[_0x834e('0x56')](config[_0x834e('0x59')],_0x1f053f,_[_0x834e('0x6c')](_0x15e141[_0x834e('0x69')])))?path[_0x834e('0x56')](config[_0x834e('0x59')],_0x1f053f,_[_0x834e('0x6c')](_0x15e141[_0x834e('0x69')])):path[_0x834e('0x56')](config[_0x834e('0x59')],_0x1f053f,_[_0x834e('0x6c')]('default_preferred.png'));var _0x325ce1=_0x834e('0x79')+_[_0x834e('0x6d')](_0x834e('0x69'));if(_0x15e141[_0x325ce1]||!_0xfb93b1[_0x834e('0x6e')]||!_0xfb93b1[_0x834e('0x69')]){_0x13c5a4=path[_0x834e('0x56')](config[_0x834e('0x59')],_0x1f053f,_[_0x834e('0x6c')]('default_preferred.png'));}if(!fs['existsSync'](_0x13c5a4)){throw new db['Sequelize'][(_0x834e('0x70'))]('Logo\x20not\x20found');}return _0x4f716d[_0x834e('0x71')](_0x13c5a4);}})[_0x834e('0x26')](handleError(_0x4f716d,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 43c150f..323edfa 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 _0xb631=['./setting.attributes','exports','define','Setting','settings','util','api','moment','bluebird','request-promise'];(function(_0x4554c1,_0x589649){var _0x1dfa5c=function(_0x10c269){while(--_0x10c269){_0x4554c1['push'](_0x4554c1['shift']());}};_0x1dfa5c(++_0x589649);}(_0xb631,0x69));var _0x1b63=function(_0x56113d,_0x53cd35){_0x56113d=_0x56113d-0x0;var _0x4f2e86=_0xb631[_0x56113d];return _0x4f2e86;};'use strict';var _=require('lodash');var util=require(_0x1b63('0x0'));var logger=require('../../config/logger')(_0x1b63('0x1'));var moment=require(_0x1b63('0x2'));var BPromise=require(_0x1b63('0x3'));var rp=require(_0x1b63('0x4'));var attributes=require(_0x1b63('0x5'));module[_0x1b63('0x6')]=function(_0x277ee9,_0xfea722){return _0x277ee9[_0x1b63('0x7')](_0x1b63('0x8'),attributes,{'tableName':_0x1b63('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3552=['../../config/logger','api','./setting.attributes','exports','define','Setting','util'];(function(_0x35b888,_0x1b84a5){var _0x45c089=function(_0x2708e2){while(--_0x2708e2){_0x35b888['push'](_0x35b888['shift']());}};_0x45c089(++_0x1b84a5);}(_0x3552,0x102));var _0x2355=function(_0x30bdf6,_0x1a3d52){_0x30bdf6=_0x30bdf6-0x0;var _0x38ad01=_0x3552[_0x30bdf6];return _0x38ad01;};'use strict';var _=require('lodash');var util=require(_0x2355('0x0'));var logger=require(_0x2355('0x1'))(_0x2355('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x2355('0x3'));module[_0x2355('0x4')]=function(_0x4016ea,_0x4964ce){return _0x4016ea[_0x2355('0x5')](_0x2355('0x6'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 7152551..e98b1ce 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 _0xafb2=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird'];(function(_0x305880,_0x1f79d2){var _0x17e6bc=function(_0x25355d){while(--_0x25355d){_0x305880['push'](_0x305880['shift']());}};_0x17e6bc(++_0x1f79d2);}(_0xafb2,0x147));var _0x2afb=function(_0x1a104b,_0x250e3c){_0x1a104b=_0x1a104b-0x0;var _0x826c34=_0xafb2[_0x1a104b];return _0x826c34;};'use strict';var _=require(_0x2afb('0x0'));var util=require('util');var moment=require(_0x2afb('0x1'));var BPromise=require(_0x2afb('0x2'));var rs=require(_0x2afb('0x3'));var fs=require('fs');var Redis=require(_0x2afb('0x4'));var db=require(_0x2afb('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2afb('0x6'));var config=require(_0x2afb('0x7'));var jayson=require(_0x2afb('0x8'));var client=jayson[_0x2afb('0x9')][_0x2afb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ccd5d,_0xc3fc5e,_0xc713af){return new BPromise(function(_0x3abd0f,_0x4a718e){return client['request'](_0x1ccd5d,_0xc713af)[_0x2afb('0xb')](function(_0x1c6643){logger[_0x2afb('0xc')](_0x2afb('0xd'),_0xc3fc5e,_0x2afb('0xe'));logger[_0x2afb('0xf')](_0x2afb('0x10'),_0xc3fc5e,_0x2afb('0xe'),JSON[_0x2afb('0x11')](_0x1c6643));if(_0x1c6643[_0x2afb('0x12')]){if(_0x1c6643[_0x2afb('0x12')][_0x2afb('0x13')]===0x1f4){logger[_0x2afb('0x12')](_0x2afb('0xd'),_0xc3fc5e,_0x1c6643['error'][_0x2afb('0x14')]);return _0x4a718e(_0x1c6643[_0x2afb('0x12')]['message']);}logger[_0x2afb('0x12')](_0x2afb('0xd'),_0xc3fc5e,_0x1c6643[_0x2afb('0x12')][_0x2afb('0x14')]);return _0x3abd0f(_0x1c6643[_0x2afb('0x12')][_0x2afb('0x14')]);}else{logger[_0x2afb('0xc')]('Setting,\x20%s,\x20%s',_0xc3fc5e,'request\x20sent');_0x3abd0f(_0x1c6643['result'][_0x2afb('0x14')]);}})[_0x2afb('0x15')](function(_0x8e2a43){logger[_0x2afb('0x12')](_0x2afb('0xd'),_0xc3fc5e,_0x8e2a43);_0x4a718e(_0x8e2a43);});});} \ No newline at end of file +var _0x2f5d=['randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x3f22a1,_0x296b45){var _0x569be0=function(_0x491c15){while(--_0x491c15){_0x3f22a1['push'](_0x3f22a1['shift']());}};_0x569be0(++_0x296b45);}(_0x2f5d,0x7a));var _0xd2f5=function(_0x11d827,_0x543592){_0x11d827=_0x11d827-0x0;var _0x5169ad=_0x2f5d[_0x11d827];return _0x5169ad;};'use strict';var _=require(_0xd2f5('0x0'));var util=require(_0xd2f5('0x1'));var moment=require(_0xd2f5('0x2'));var BPromise=require(_0xd2f5('0x3'));var rs=require(_0xd2f5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd2f5('0x5'))['db'];var utils=require(_0xd2f5('0x6'));var logger=require('../../config/logger')(_0xd2f5('0x7'));var config=require('../../config/environment');var jayson=require(_0xd2f5('0x8'));var client=jayson[_0xd2f5('0x9')][_0xd2f5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e89e9,_0x4570cf,_0xba0720){return new BPromise(function(_0x479fbd,_0xb832ba){return client['request'](_0x5e89e9,_0xba0720)['then'](function(_0x5a8e76){logger['info'](_0xd2f5('0xb'),_0x4570cf,'request\x20sent');logger[_0xd2f5('0xc')](_0xd2f5('0xd'),_0x4570cf,_0xd2f5('0xe'),JSON[_0xd2f5('0xf')](_0x5a8e76));if(_0x5a8e76[_0xd2f5('0x10')]){if(_0x5a8e76[_0xd2f5('0x10')]['code']===0x1f4){logger[_0xd2f5('0x10')](_0xd2f5('0xb'),_0x4570cf,_0x5a8e76[_0xd2f5('0x10')][_0xd2f5('0x11')]);return _0xb832ba(_0x5a8e76[_0xd2f5('0x10')]['message']);}logger[_0xd2f5('0x10')](_0xd2f5('0xb'),_0x4570cf,_0x5a8e76[_0xd2f5('0x10')][_0xd2f5('0x11')]);return _0x479fbd(_0x5a8e76['error'][_0xd2f5('0x11')]);}else{logger[_0xd2f5('0x12')]('Setting,\x20%s,\x20%s',_0x4570cf,_0xd2f5('0xe'));_0x479fbd(_0x5a8e76[_0xd2f5('0x13')][_0xd2f5('0x11')]);}})[_0xd2f5('0x14')](function(_0x2c4e03){logger[_0xd2f5('0x10')](_0xd2f5('0xb'),_0x4570cf,_0x2c4e03);_0xb832ba(_0x2c4e03);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index cbf3f6d..a4473a4 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 _0x615a=['/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','/:id/status','addAgents','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions'];(function(_0xab3a70,_0x2a1670){var _0x1330c7=function(_0x3fd009){while(--_0x3fd009){_0xab3a70['push'](_0xab3a70['shift']());}};_0x1330c7(++_0x2a1670);}(_0x615a,0x119));var _0xa615=function(_0x4f53a6,_0x582ff5){_0x4f53a6=_0x4f53a6-0x0;var _0x30e4b7=_0x615a[_0x4f53a6];return _0x30e4b7;};'use strict';var multer=require(_0xa615('0x0'));var util=require('util');var path=require(_0xa615('0x1'));var timeout=require('connect-timeout');var express=require(_0xa615('0x2'));var router=express[_0xa615('0x3')]();var auth=require(_0xa615('0x4'));var interaction=require(_0xa615('0x5'));var config=require('../../config/environment');var controller=require(_0xa615('0x6'));router[_0xa615('0x7')]('/',auth['isAuthenticated'](),controller[_0xa615('0x8')]);router['get'](_0xa615('0x9'),auth[_0xa615('0xa')](),controller[_0xa615('0xb')]);router[_0xa615('0x7')](_0xa615('0xc'),auth['isAuthenticated'](),controller[_0xa615('0xd')]);router['get'](_0xa615('0xe'),auth[_0xa615('0xa')](),controller['getDispositions']);router[_0xa615('0x7')](_0xa615('0xf'),auth[_0xa615('0xa')](),controller[_0xa615('0x10')]);router[_0xa615('0x7')]('/:id/applications',auth['isAuthenticated'](),controller[_0xa615('0x11')]);router['get'](_0xa615('0x12'),auth[_0xa615('0xa')](),controller[_0xa615('0x13')]);router[_0xa615('0x7')]('/:id/status',controller['statusGet']);router[_0xa615('0x7')](_0xa615('0x14'),auth[_0xa615('0xa')](),controller[_0xa615('0x15')]);router[_0xa615('0x16')]('/',auth[_0xa615('0xa')](),controller[_0xa615('0x17')]);router[_0xa615('0x16')](_0xa615('0xe'),auth[_0xa615('0xa')](),controller[_0xa615('0x18')]);router[_0xa615('0x16')](_0xa615('0xf'),auth[_0xa615('0xa')](),controller[_0xa615('0x19')]);router[_0xa615('0x16')](_0xa615('0x1a'),controller[_0xa615('0x1b')]);router[_0xa615('0x16')]('/:id/applications',auth[_0xa615('0xa')](),controller['addApplications']);router[_0xa615('0x16')]('/:id/send',auth[_0xa615('0xa')](),controller['send']);router[_0xa615('0x16')](_0xa615('0x1c'),controller['status']);router[_0xa615('0x16')](_0xa615('0x14'),auth[_0xa615('0xa')](),controller[_0xa615('0x1d')]);router[_0xa615('0x1e')](_0xa615('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xa615('0x1f')](_0xa615('0xc'),auth[_0xa615('0xa')](),controller[_0xa615('0x20')]);router[_0xa615('0x1f')](_0xa615('0xe'),auth[_0xa615('0xa')](),controller[_0xa615('0x21')]);router['delete']('/:id/canned_answers',auth[_0xa615('0xa')](),controller[_0xa615('0x22')]);router[_0xa615('0x1f')](_0xa615('0x14'),auth[_0xa615('0xa')](),controller[_0xa615('0x23')]);module[_0xa615('0x24')]=router; \ No newline at end of file +var _0x851e=['put','update','delete','/:id','destroy','removeDispositions','removeAgents','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','isAuthenticated','index','get','/describe','show','/:id/dispositions','/:id/canned_answers','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents','create','post','addDisposition','notify','/:id/applications','addApplications','/:id/send','send','status','addAgents'];(function(_0x13a68a,_0x2daaaa){var _0x27f857=function(_0x17b3a1){while(--_0x17b3a1){_0x13a68a['push'](_0x13a68a['shift']());}};_0x27f857(++_0x2daaaa);}(_0x851e,0x1e8));var _0xe851=function(_0xd02923,_0x7d3515){_0xd02923=_0xd02923-0x0;var _0x10ff2f=_0x851e[_0xd02923];return _0x10ff2f;};'use strict';var multer=require(_0xe851('0x0'));var util=require(_0xe851('0x1'));var path=require(_0xe851('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe851('0x3')]();var auth=require(_0xe851('0x4'));var interaction=require(_0xe851('0x5'));var config=require(_0xe851('0x6'));var controller=require(_0xe851('0x7'));router['get']('/',auth[_0xe851('0x8')](),controller[_0xe851('0x9')]);router[_0xe851('0xa')](_0xe851('0xb'),auth[_0xe851('0x8')](),controller['describe']);router[_0xe851('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xe851('0xc')]);router[_0xe851('0xa')](_0xe851('0xd'),auth[_0xe851('0x8')](),controller['getDispositions']);router[_0xe851('0xa')](_0xe851('0xe'),auth[_0xe851('0x8')](),controller['getAnswers']);router[_0xe851('0xa')]('/:id/applications',auth[_0xe851('0x8')](),controller[_0xe851('0xf')]);router['get'](_0xe851('0x10'),auth['isAuthenticated'](),controller[_0xe851('0x11')]);router['get'](_0xe851('0x12'),controller[_0xe851('0x13')]);router['get'](_0xe851('0x14'),auth[_0xe851('0x8')](),controller[_0xe851('0x15')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe851('0x16')]);router[_0xe851('0x17')](_0xe851('0xd'),auth[_0xe851('0x8')](),controller[_0xe851('0x18')]);router[_0xe851('0x17')]('/:id/canned_answers',auth[_0xe851('0x8')](),controller['addAnswer']);router[_0xe851('0x17')]('/:id/notify',controller[_0xe851('0x19')]);router['post'](_0xe851('0x1a'),auth[_0xe851('0x8')](),controller[_0xe851('0x1b')]);router[_0xe851('0x17')](_0xe851('0x1c'),auth[_0xe851('0x8')](),controller[_0xe851('0x1d')]);router[_0xe851('0x17')]('/:id/status',controller[_0xe851('0x1e')]);router['post'](_0xe851('0x14'),auth['isAuthenticated'](),controller[_0xe851('0x1f')]);router[_0xe851('0x20')]('/:id',auth['isAuthenticated'](),controller[_0xe851('0x21')]);router[_0xe851('0x22')](_0xe851('0x23'),auth[_0xe851('0x8')](),controller[_0xe851('0x24')]);router[_0xe851('0x22')]('/:id/dispositions',auth[_0xe851('0x8')](),controller[_0xe851('0x25')]);router['delete']('/:id/canned_answers',auth[_0xe851('0x8')](),controller['removeAnswers']);router[_0xe851('0x22')](_0xe851('0x14'),auth[_0xe851('0x8')](),controller[_0xe851('0x26')]);module[_0xe851('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index e100c01..6ce3d38 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 _0x0693=['INTEGER','exports','STRING','name','generate','ENUM','twilio','connectel','plivo','csc','infobip','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x0693,0x119));var _0x3069=function(_0x2d15ab,_0x2eec7c){_0x2d15ab=_0x2d15ab-0x0;var _0x2cab1d=_0x0693[_0x2d15ab];return _0x2cab1d;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x3069('0x0')]={'name':{'type':Sequelize[_0x3069('0x1')],'unique':_0x3069('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x3069('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x3069('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x3069('0x1')],'defaultValue':function(){return rs[_0x3069('0x3')]();}},'phone':{'type':Sequelize[_0x3069('0x1')]},'type':{'type':Sequelize[_0x3069('0x4')](_0x3069('0x5'),'skebby',_0x3069('0x6'),'clicksend',_0x3069('0x7'),'clickatell',_0x3069('0x8'),_0x3069('0x9'))},'accountSid':{'type':Sequelize[_0x3069('0x1')]},'authId':{'type':Sequelize[_0x3069('0x1')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x3069('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x3069('0x1')]},'password':{'type':Sequelize[_0x3069('0x1')]},'apiKey':{'type':Sequelize[_0x3069('0x1')]},'senderString':{'type':Sequelize[_0x3069('0x1')]},'deliveryReport':{'type':Sequelize[_0x3069('0xa')],'defaultValue':![]},'description':{'type':Sequelize[_0x3069('0x1')]},'notificationTemplate':{'type':Sequelize[_0x3069('0xb')],'defaultValue':function(){return _0x3069('0xc');}},'notificationSound':{'type':Sequelize[_0x3069('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3069('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3069('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3069('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3069('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3069('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x3069('0x1')]}}; \ No newline at end of file +var _0x1d81=['BOOLEAN','INTEGER','sequelize','randomstring','exports','STRING','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','TEXT'];(function(_0x38c337,_0x524093){var _0x48d7dc=function(_0x5f2af9){while(--_0x5f2af9){_0x38c337['push'](_0x38c337['shift']());}};_0x48d7dc(++_0x524093);}(_0x1d81,0x13d));var _0x11d8=function(_0x542e14,_0x5dfd4b){_0x542e14=_0x542e14-0x0;var _0xe3bbb=_0x1d81[_0x542e14];return _0xe3bbb;};'use strict';var Sequelize=require(_0x11d8('0x0'));var rs=require(_0x11d8('0x1'));module[_0x11d8('0x2')]={'name':{'type':Sequelize[_0x11d8('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x11d8('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x11d8('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x11d8('0x3')],'defaultValue':function(){return rs[_0x11d8('0x4')]();}},'phone':{'type':Sequelize[_0x11d8('0x3')]},'type':{'type':Sequelize[_0x11d8('0x5')](_0x11d8('0x6'),_0x11d8('0x7'),_0x11d8('0x8'),_0x11d8('0x9'),_0x11d8('0xa'),_0x11d8('0xb'),'csc','infobip')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x11d8('0x3')]},'authToken':{'type':Sequelize[_0x11d8('0x3')]},'smsMethod':{'type':Sequelize[_0x11d8('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x11d8('0x3')]},'password':{'type':Sequelize[_0x11d8('0x3')]},'apiKey':{'type':Sequelize[_0x11d8('0x3')]},'senderString':{'type':Sequelize[_0x11d8('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x11d8('0x3')]},'notificationTemplate':{'type':Sequelize[_0x11d8('0xc')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x11d8('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x11d8('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x11d8('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x11d8('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x11d8('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x11d8('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index a3bb36c..34a1879 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 _0xa9e0=['originatingAddress','segmentedMessage','fromNumber','replyMessageId','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','CmList','CmContact','Contacts','DESC','omit','defaults','contact','SmsInteraction','spread','get','interaction','created','autoclose','push','close','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','debug','entity\x20found','set','text/xml','\x0a','addApplications','transaction','SmsApplication','bulkCreate','getApplications','Contact','Owner','fullname','internal','Tag','Tags','color','tag','send','to\x20is\x20mandatory','List','user','out','dataValues','Messages','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','clickatell','error_code','DELIVERED_TO_GATEWAY','statusGet','message-id','state','addAgents','emit','removeAgents','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','redis','localhost','socket.io-emitter','./smsAccount.socket','register','client','http','request','info','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','sendStatus','status','count','offset','limit','Content-Range','json','reject','save','update','then','destroy','end','stack','name','index','SmsAccount','rawAttributes','dateStart','query','dateEnd','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','body','describe','Disposition','create','getDispositions','findOne','SmsAccountId','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','sms','Applications','applications','orderBy','priority','asc','account','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','type','twilio','messageId','skebby','from','sender','text','connectel','clicksend','message_id','plivo','From','infobip','results','csc'];(function(_0x37ec4f,_0x698ceb){var _0x8a4f31=function(_0x5c8720){while(--_0x5c8720){_0x37ec4f['push'](_0x37ec4f['shift']());}};_0x8a4f31(++_0x698ceb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var qs=require(_0x0a9e('0xf'));var logger=require(_0x0a9e('0x10'))(_0x0a9e('0x11'));var utils=require(_0x0a9e('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x0a9e('0x13')],{'host':_0x0a9e('0x14'),'port':0x18eb});var socket=require(_0x0a9e('0x15'))(new Redis(config[_0x0a9e('0x13')]));require(_0x0a9e('0x16'))[_0x0a9e('0x17')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x18')][_0x0a9e('0x19')]({'port':0x232c});function respondWithRpcPromise(_0x2b4227,_0x281129,_0x44dcfd,_0x4d5611){return new BPromise(function(_0x52a03d,_0x22dccb){var _0x5d0880=_0x4d5611||client;return _0x5d0880[_0x0a9e('0x1a')](_0x2b4227,_0x44dcfd)['then'](function(_0x16033c){logger[_0x0a9e('0x1b')]('SmsAccount,\x20%s,\x20%s',_0x281129,_0x0a9e('0x1c'));logger['debug'](_0x0a9e('0x1d'),_0x281129,_0x0a9e('0x1c'),JSON[_0x0a9e('0x1e')](_0x16033c));if(_0x16033c[_0x0a9e('0x1f')]){if(_0x16033c[_0x0a9e('0x1f')][_0x0a9e('0x20')]===0x1f4){logger[_0x0a9e('0x1f')](_0x0a9e('0x21'),_0x281129,_0x16033c[_0x0a9e('0x1f')][_0x0a9e('0x22')]);return _0x22dccb(_0x16033c[_0x0a9e('0x1f')][_0x0a9e('0x22')]);}logger['error'](_0x0a9e('0x21'),_0x281129,_0x16033c[_0x0a9e('0x1f')]['message']);return _0x52a03d(_0x16033c[_0x0a9e('0x1f')]['message']);}else{logger['info'](_0x0a9e('0x21'),_0x281129,_0x0a9e('0x1c'));_0x52a03d(_0x16033c[_0x0a9e('0x23')][_0x0a9e('0x22')]);}})['catch'](function(_0xfb6e48){logger[_0x0a9e('0x1f')](_0x0a9e('0x21'),_0x281129,_0xfb6e48);_0x22dccb(_0xfb6e48);});});}function respondWithStatusCode(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0xcc;return function(_0x42ac8f){if(_0x42ac8f){return _0x4d00e6[_0x0a9e('0x24')](_0x370d86);}return _0x4d00e6['status'](_0x370d86)['end']();};}function respondWithResult(_0x197ec0,_0x3a8e58){_0x3a8e58=_0x3a8e58||0xc8;return function(_0x40c424){if(_0x40c424){return _0x197ec0[_0x0a9e('0x25')](_0x3a8e58)['json'](_0x40c424);}};}function respondWithFilteredResult(_0x384319,_0x479bc4){return function(_0x45a1e7){if(_0x45a1e7){var _0x5bfb33=_0x45a1e7[_0x0a9e('0x26')],_0x1dc186=_0x479bc4[_0x0a9e('0x27')],_0x34dc65=_0x479bc4[_0x0a9e('0x27')]+_0x479bc4[_0x0a9e('0x28')],_0x25fba9;if(_0x34dc65>=_0x5bfb33){_0x34dc65=_0x5bfb33;_0x25fba9=0xc8;}else{_0x25fba9=0xce;}_0x384319[_0x0a9e('0x25')](_0x25fba9);return _0x384319['set'](_0x0a9e('0x29'),_0x1dc186+'-'+_0x34dc65+'/'+_0x5bfb33)[_0x0a9e('0x2a')](_0x45a1e7);}return null;};}function patchUpdates(_0x2b1f27){return function(_0x2ec755){try{jsonpatch['apply'](_0x2ec755,_0x2b1f27,!![]);}catch(_0x15b200){return BPromise[_0x0a9e('0x2b')](_0x15b200);}return _0x2ec755[_0x0a9e('0x2c')]();};}function saveUpdates(_0x824a4f,_0x58b06f){return function(_0x563b45){if(_0x563b45){return _0x563b45[_0x0a9e('0x2d')](_0x824a4f)[_0x0a9e('0x2e')](function(_0x1dbde2){return _0x1dbde2;});}return null;};}function removeEntity(_0x540530,_0x426950){return function(_0x5d1e0e){if(_0x5d1e0e){return _0x5d1e0e[_0x0a9e('0x2f')]()[_0x0a9e('0x2e')](function(){_0x540530[_0x0a9e('0x25')](0xcc)[_0x0a9e('0x30')]();});}};}function handleEntityNotFound(_0x25ce3a,_0x5180f1){return function(_0x66c1d2){if(!_0x66c1d2){_0x25ce3a[_0x0a9e('0x24')](0x194);}return _0x66c1d2;};}function handleError(_0x40cb85,_0x2da5c0){_0x2da5c0=_0x2da5c0||0x1f4;return function(_0x2b45ea){logger[_0x0a9e('0x1f')](_0x2b45ea[_0x0a9e('0x31')]);if(_0x2b45ea[_0x0a9e('0x32')]){delete _0x2b45ea['name'];}_0x40cb85[_0x0a9e('0x25')](_0x2da5c0)['send'](_0x2b45ea);};}exports[_0x0a9e('0x33')]=function(_0x14b13f,_0x2b7e7f){var _0x3f3d41={},_0x567193={},_0x191e91={'count':0x0,'rows':[]};var _0xd1836d=db[_0x0a9e('0x34')][_0x0a9e('0x35')];_0x567193['model']=_['keys'](_0xd1836d);var _0x1e8694={'dateStart':_0x14b13f['query'][_0x0a9e('0x36')],'dateEnd':_0x14b13f[_0x0a9e('0x37')][_0x0a9e('0x38')]};delete _0x14b13f[_0x0a9e('0x37')]['dateStart'];delete _0x14b13f[_0x0a9e('0x37')][_0x0a9e('0x38')];_0x567193[_0x0a9e('0x37')]=_['keys'](_0x14b13f[_0x0a9e('0x37')]);_0x567193[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x567193['model'],_0x567193['query']);_0x3f3d41[_0x0a9e('0x3b')]=_[_0x0a9e('0x3a')](_0x567193['model'],qs[_0x0a9e('0x3c')](_0x14b13f[_0x0a9e('0x37')][_0x0a9e('0x3c')]));_0x3f3d41[_0x0a9e('0x3b')]=_0x3f3d41['attributes']['length']?_0x3f3d41[_0x0a9e('0x3b')]:_0x567193[_0x0a9e('0x3d')];if(!_0x14b13f['query'][_0x0a9e('0x3e')](_0x0a9e('0x3f'))){_0x3f3d41[_0x0a9e('0x28')]=qs['limit'](_0x14b13f[_0x0a9e('0x37')][_0x0a9e('0x28')]);_0x3f3d41[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x14b13f[_0x0a9e('0x37')][_0x0a9e('0x27')]);}_0x3f3d41[_0x0a9e('0x40')]=qs[_0x0a9e('0x41')](_0x14b13f[_0x0a9e('0x37')][_0x0a9e('0x41')]);_0x3f3d41[_0x0a9e('0x42')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x43')](_0x14b13f[_0x0a9e('0x37')],_0x567193[_0x0a9e('0x39')]));if(_0x1e8694['dateStart']){if(_0x1e8694['dateEnd']){_0x1e8694[_0x0a9e('0x38')]=moment(_0x1e8694[_0x0a9e('0x38')])[_0x0a9e('0x44')](0x1,_0x0a9e('0x45'));}else{_0x1e8694[_0x0a9e('0x38')]=moment(_0x1e8694[_0x0a9e('0x36')])[_0x0a9e('0x44')](0x1,_0x0a9e('0x45'));}_[_0x0a9e('0x46')](_0x3f3d41[_0x0a9e('0x42')],{'createdAt':{'$gte':_0x1e8694[_0x0a9e('0x36')],'$lte':_0x1e8694[_0x0a9e('0x38')]}});}if(_0x14b13f['query'][_0x0a9e('0x47')]){_0x3f3d41[_0x0a9e('0x42')]=_[_0x0a9e('0x46')](_0x3f3d41[_0x0a9e('0x42')],{'$or':_[_0x0a9e('0x48')](_0x3f3d41[_0x0a9e('0x3b')],function(_0x21eb86){var _0x44dd99={};_0x44dd99[_0x21eb86]={'$like':'%'+_0x14b13f['query'][_0x0a9e('0x47')]+'%'};return _0x44dd99;})});}_0x3f3d41=_['merge']({},_0x3f3d41,_0x14b13f[_0x0a9e('0x49')]);var _0x476688={'where':_0x3f3d41[_0x0a9e('0x42')]};return db['SmsAccount'][_0x0a9e('0x26')](_0x476688)[_0x0a9e('0x2e')](function(_0x4774f4){_0x191e91[_0x0a9e('0x26')]=_0x4774f4;if(_0x14b13f[_0x0a9e('0x37')][_0x0a9e('0x4a')]){_0x3f3d41[_0x0a9e('0x4b')]=[{'all':!![]}];}return db['SmsAccount'][_0x0a9e('0x4c')](_0x3f3d41);})[_0x0a9e('0x2e')](function(_0x1b5e80){_0x191e91[_0x0a9e('0x4d')]=_0x1b5e80;return _0x191e91;})[_0x0a9e('0x2e')](respondWithFilteredResult(_0x2b7e7f,_0x3f3d41))[_0x0a9e('0x4e')](handleError(_0x2b7e7f,null));};exports[_0x0a9e('0x4f')]=function(_0x19383e,_0x34febd){var _0x58a5c2={'raw':![],'where':{'id':_0x19383e[_0x0a9e('0x50')]['id']}},_0xe401a={};_0xe401a['model']=_['keys'](db['SmsAccount'][_0x0a9e('0x35')]);_0xe401a[_0x0a9e('0x37')]=_[_0x0a9e('0x51')](_0x19383e[_0x0a9e('0x37')]);_0xe401a[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0xe401a[_0x0a9e('0x3d')],_0xe401a[_0x0a9e('0x37')]);_0x58a5c2['attributes']=_['intersection'](_0xe401a['model'],qs[_0x0a9e('0x3c')](_0x19383e[_0x0a9e('0x37')][_0x0a9e('0x3c')]));_0x58a5c2['attributes']=_0x58a5c2[_0x0a9e('0x3b')][_0x0a9e('0x52')]?_0x58a5c2['attributes']:_0xe401a['model'];if(_0x19383e[_0x0a9e('0x37')]['includeAll']){_0x58a5c2[_0x0a9e('0x4b')]=[{'all':!![]}];}_0x58a5c2=_['merge']({},_0x58a5c2,_0x19383e[_0x0a9e('0x49')]);return db[_0x0a9e('0x34')][_0x0a9e('0x53')](_0x58a5c2)['then'](handleEntityNotFound(_0x34febd,null))[_0x0a9e('0x2e')](respondWithResult(_0x34febd,null))[_0x0a9e('0x4e')](handleError(_0x34febd,null));};exports['create']=function(_0x50f687,_0x128aa6){return db[_0x0a9e('0x34')]['create'](_0x50f687[_0x0a9e('0x54')],{})['then'](respondWithResult(_0x128aa6,0xc9))[_0x0a9e('0x4e')](handleError(_0x128aa6,null));};exports['update']=function(_0xe22ccc,_0x4a6deb){if(_0xe22ccc['body']['id']){delete _0xe22ccc['body']['id'];}return db[_0x0a9e('0x34')]['find']({'where':{'id':_0xe22ccc[_0x0a9e('0x50')]['id']}})[_0x0a9e('0x2e')](handleEntityNotFound(_0x4a6deb,null))[_0x0a9e('0x2e')](saveUpdates(_0xe22ccc[_0x0a9e('0x54')],null))[_0x0a9e('0x2e')](respondWithResult(_0x4a6deb,null))[_0x0a9e('0x4e')](handleError(_0x4a6deb,null));};exports[_0x0a9e('0x2f')]=function(_0x28d814,_0x4e67ab){return db[_0x0a9e('0x34')][_0x0a9e('0x53')]({'where':{'id':_0x28d814[_0x0a9e('0x50')]['id']}})[_0x0a9e('0x2e')](handleEntityNotFound(_0x4e67ab,null))[_0x0a9e('0x2e')](removeEntity(_0x4e67ab,null))[_0x0a9e('0x4e')](handleError(_0x4e67ab,null));};exports['describe']=function(_0x956fbe,_0x26bc80){return db['SmsAccount'][_0x0a9e('0x55')]()['then'](respondWithResult(_0x26bc80,null))[_0x0a9e('0x4e')](handleError(_0x26bc80,null));};exports['addDisposition']=function(_0x4b3c1a,_0x5674ee,_0x273cb5){if(_0x4b3c1a['body']['id']){delete _0x4b3c1a[_0x0a9e('0x54')]['id'];}return db[_0x0a9e('0x34')][_0x0a9e('0x53')]({'where':{'id':_0x4b3c1a[_0x0a9e('0x50')]['id']}})[_0x0a9e('0x2e')](handleEntityNotFound(_0x5674ee,null))[_0x0a9e('0x2e')](function(_0x49eed0){if(_0x49eed0){_0x4b3c1a[_0x0a9e('0x54')]['SmsAccountId']=_0x49eed0['id'];return db[_0x0a9e('0x56')][_0x0a9e('0x57')](_0x4b3c1a[_0x0a9e('0x54')]);}})['then'](respondWithResult(_0x5674ee,null))[_0x0a9e('0x4e')](handleError(_0x5674ee,null));};exports[_0x0a9e('0x58')]=function(_0x119677,_0x32e134,_0x497d91){var _0x1d0dc8={'raw':![],'where':{}};var _0xe05a5a={};var _0x54327c={'count':0x0,'rows':[]};return db[_0x0a9e('0x34')][_0x0a9e('0x59')]({'where':{'id':_0x119677[_0x0a9e('0x50')]['id']}})[_0x0a9e('0x2e')](handleEntityNotFound(_0x32e134,null))[_0x0a9e('0x2e')](function(_0x4d4a35){if(_0x4d4a35){_0xe05a5a[_0x0a9e('0x3d')]=_[_0x0a9e('0x51')](db[_0x0a9e('0x56')]['rawAttributes']);_0xe05a5a[_0x0a9e('0x37')]=_['keys'](_0x119677['query']);_0xe05a5a[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0xe05a5a[_0x0a9e('0x3d')],_0xe05a5a[_0x0a9e('0x37')]);_0x1d0dc8[_0x0a9e('0x3b')]=_[_0x0a9e('0x3a')](_0xe05a5a[_0x0a9e('0x3d')],qs[_0x0a9e('0x3c')](_0x119677[_0x0a9e('0x37')][_0x0a9e('0x3c')]));_0x1d0dc8[_0x0a9e('0x3b')]=_0x1d0dc8[_0x0a9e('0x3b')][_0x0a9e('0x52')]?_0x1d0dc8[_0x0a9e('0x3b')]:_0xe05a5a[_0x0a9e('0x3d')];if(!_0x119677[_0x0a9e('0x37')][_0x0a9e('0x3e')](_0x0a9e('0x3f'))){_0x1d0dc8['limit']=qs[_0x0a9e('0x28')](_0x119677[_0x0a9e('0x37')][_0x0a9e('0x28')]);_0x1d0dc8['offset']=qs[_0x0a9e('0x27')](_0x119677[_0x0a9e('0x37')]['offset']);}_0x1d0dc8[_0x0a9e('0x40')]=qs[_0x0a9e('0x41')](_0x119677[_0x0a9e('0x37')][_0x0a9e('0x41')]);_0x1d0dc8[_0x0a9e('0x42')]=qs['filters'](_['pick'](_0x119677['query'],_0xe05a5a[_0x0a9e('0x39')]));_0x1d0dc8[_0x0a9e('0x42')][_0x0a9e('0x5a')]=_0x4d4a35['id'];if(_0x119677[_0x0a9e('0x37')][_0x0a9e('0x47')]){_0x1d0dc8[_0x0a9e('0x42')]=_[_0x0a9e('0x46')](_0x1d0dc8[_0x0a9e('0x42')],{'$or':_['map'](_0x1d0dc8[_0x0a9e('0x3b')],function(_0xcbc8b2){var _0x12ccdb={};_0x12ccdb[_0xcbc8b2]={'$like':'%'+_0x119677['query'][_0x0a9e('0x47')]+'%'};return _0x12ccdb;})});}_0x1d0dc8=_['merge']({},_0x1d0dc8,_0x119677[_0x0a9e('0x49')]);return db[_0x0a9e('0x56')]['count']({'where':_0x1d0dc8[_0x0a9e('0x42')]})[_0x0a9e('0x2e')](function(_0x2cc7a7){_0x54327c[_0x0a9e('0x26')]=_0x2cc7a7;if(_0x119677['query'][_0x0a9e('0x4a')]){_0x1d0dc8[_0x0a9e('0x4b')]=[{'all':!![]}];}return db[_0x0a9e('0x56')][_0x0a9e('0x4c')](_0x1d0dc8);})['then'](function(_0x109ccb){_0x54327c[_0x0a9e('0x4d')]=_0x109ccb;return _0x54327c;});}})[_0x0a9e('0x2e')](respondWithFilteredResult(_0x32e134,_0x1d0dc8))[_0x0a9e('0x4e')](handleError(_0x32e134,null));};exports['removeDispositions']=function(_0x290d43,_0x3511c9,_0x30a4c7){var _0xf410e5;return db[_0x0a9e('0x34')][_0x0a9e('0x53')]({'where':{'id':_0x290d43[_0x0a9e('0x50')]['id']}})[_0x0a9e('0x2e')](handleEntityNotFound(_0x3511c9,null))[_0x0a9e('0x2e')](function(_0x336dc3){if(_0x336dc3){return _0x336dc3[_0x0a9e('0x5b')](_0x290d43[_0x0a9e('0x37')][_0x0a9e('0x5c')]);}})[_0x0a9e('0x2e')](respondWithStatusCode(_0x3511c9,null))['catch'](handleError(_0x3511c9,null));};exports[_0x0a9e('0x5d')]=function(_0x11da9c,_0xc599b3,_0x563627){if(_0x11da9c[_0x0a9e('0x54')]['id']){delete _0x11da9c[_0x0a9e('0x54')]['id'];}return db[_0x0a9e('0x34')][_0x0a9e('0x53')]({'where':{'id':_0x11da9c['params']['id']}})['then'](handleEntityNotFound(_0xc599b3,null))[_0x0a9e('0x2e')](function(_0x2bbdb5){if(_0x2bbdb5){_0x11da9c['body'][_0x0a9e('0x5a')]=_0x2bbdb5['id'];return db['CannedAnswer'][_0x0a9e('0x57')](_0x11da9c[_0x0a9e('0x54')]);}})['then'](respondWithResult(_0xc599b3,null))[_0x0a9e('0x4e')](handleError(_0xc599b3,null));};exports[_0x0a9e('0x5e')]=function(_0x2d2286,_0x42b959,_0x3755fe){var _0x1f42a0={'raw':![],'where':{}};var _0x444f1f={};var _0x482ca2={'count':0x0,'rows':[]};return db[_0x0a9e('0x34')][_0x0a9e('0x59')]({'where':{'id':_0x2d2286[_0x0a9e('0x50')]['id']}})[_0x0a9e('0x2e')](handleEntityNotFound(_0x42b959,null))['then'](function(_0xf51744){if(_0xf51744){_0x444f1f[_0x0a9e('0x3d')]=_['keys'](db[_0x0a9e('0x5f')]['rawAttributes']);_0x444f1f[_0x0a9e('0x37')]=_[_0x0a9e('0x51')](_0x2d2286[_0x0a9e('0x37')]);_0x444f1f[_0x0a9e('0x39')]=_['intersection'](_0x444f1f['model'],_0x444f1f[_0x0a9e('0x37')]);_0x1f42a0[_0x0a9e('0x3b')]=_[_0x0a9e('0x3a')](_0x444f1f['model'],qs[_0x0a9e('0x3c')](_0x2d2286[_0x0a9e('0x37')]['fields']));_0x1f42a0['attributes']=_0x1f42a0[_0x0a9e('0x3b')]['length']?_0x1f42a0['attributes']:_0x444f1f['model'];if(!_0x2d2286[_0x0a9e('0x37')][_0x0a9e('0x3e')](_0x0a9e('0x3f'))){_0x1f42a0[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x2d2286[_0x0a9e('0x37')]['limit']);_0x1f42a0[_0x0a9e('0x27')]=qs['offset'](_0x2d2286[_0x0a9e('0x37')][_0x0a9e('0x27')]);}_0x1f42a0[_0x0a9e('0x40')]=qs[_0x0a9e('0x41')](_0x2d2286['query'][_0x0a9e('0x41')]);_0x1f42a0[_0x0a9e('0x42')]=qs[_0x0a9e('0x39')](_['pick'](_0x2d2286[_0x0a9e('0x37')],_0x444f1f[_0x0a9e('0x39')]));_0x1f42a0[_0x0a9e('0x42')][_0x0a9e('0x5a')]=_0xf51744['id'];if(_0x2d2286[_0x0a9e('0x37')][_0x0a9e('0x47')]){_0x1f42a0[_0x0a9e('0x42')]=_[_0x0a9e('0x46')](_0x1f42a0['where'],{'$or':_[_0x0a9e('0x48')](_0x1f42a0[_0x0a9e('0x3b')],function(_0x589ff3){var _0x40e0f0={};_0x40e0f0[_0x589ff3]={'$like':'%'+_0x2d2286[_0x0a9e('0x37')][_0x0a9e('0x47')]+'%'};return _0x40e0f0;})});}_0x1f42a0=_['merge']({},_0x1f42a0,_0x2d2286[_0x0a9e('0x49')]);return db['CannedAnswer'][_0x0a9e('0x26')]({'where':_0x1f42a0[_0x0a9e('0x42')]})[_0x0a9e('0x2e')](function(_0x1f29bd){_0x482ca2[_0x0a9e('0x26')]=_0x1f29bd;if(_0x2d2286[_0x0a9e('0x37')][_0x0a9e('0x4a')]){_0x1f42a0[_0x0a9e('0x4b')]=[{'all':!![]}];}return db['CannedAnswer'][_0x0a9e('0x4c')](_0x1f42a0);})[_0x0a9e('0x2e')](function(_0x17f692){_0x482ca2[_0x0a9e('0x4d')]=_0x17f692;return _0x482ca2;});}})[_0x0a9e('0x2e')](respondWithFilteredResult(_0x42b959,_0x1f42a0))[_0x0a9e('0x4e')](handleError(_0x42b959,null));};exports[_0x0a9e('0x60')]=function(_0x33f0c9,_0x1808ba,_0x31af8c){var _0x151956;return db[_0x0a9e('0x34')][_0x0a9e('0x53')]({'where':{'id':_0x33f0c9['params']['id']}})[_0x0a9e('0x2e')](handleEntityNotFound(_0x1808ba,null))[_0x0a9e('0x2e')](function(_0x12843d){if(_0x12843d){return _0x12843d[_0x0a9e('0x60')](_0x33f0c9[_0x0a9e('0x37')]['ids']);}})[_0x0a9e('0x2e')](respondWithStatusCode(_0x1808ba,null))[_0x0a9e('0x4e')](handleError(_0x1808ba,null));};exports['notify']=function(_0x23b447,_0x5e725e,_0x45d113){var _0x27041d={'channel':_0x0a9e('0x61')};var _0xf8c6c4=[];var _0x4f4d2d=[];var _0x3ceba6={};return db['SmsAccount'][_0x0a9e('0x53')]({'where':{'id':_0x23b447[_0x0a9e('0x50')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x0a9e('0x62')}]})[_0x0a9e('0x2e')](handleEntityNotFound(_0x5e725e,null))[_0x0a9e('0x2e')](function(_0x4ab276){_0x27041d['account']=_0x4ab276;_0x27041d[_0x0a9e('0x63')]=_[_0x0a9e('0x64')](_0x4ab276[_0x0a9e('0x62')],[_0x0a9e('0x65')],[_0x0a9e('0x66')]);if(_0x27041d[_0x0a9e('0x67')][_0x0a9e('0x62')]){delete _0x27041d[_0x0a9e('0x67')][_0x0a9e('0x62')];}return db['CmContact'][_0x0a9e('0x55')]();})['then'](function(_0x287324){if(!_0x287324){throw new db[(_0x0a9e('0x68'))][(_0x0a9e('0x69'))](_0x0a9e('0x6a'));}_0xf8c6c4=_[_0x0a9e('0x6b')](_['keys'](_0x287324),[_0x0a9e('0x6c'),_0x0a9e('0x6d')]);_0x4f4d2d=_[_0x0a9e('0x6b')](_[_0x0a9e('0x51')](_0x287324),[_0x0a9e('0x6c'),'updatedAt','CompanyId',_0x0a9e('0x6e')]);_0x27041d['body']={'mapKey':_0x0a9e('0x6f')};if(_0x27041d[_0x0a9e('0x67')][_0x0a9e('0x70')]){switch(_0x27041d[_0x0a9e('0x67')][_0x0a9e('0x70')]){case _0x0a9e('0x71'):_0x27041d['body']['from']=_0x23b447[_0x0a9e('0x54')]['From'];_0x27041d[_0x0a9e('0x54')]['body']=_0x23b447[_0x0a9e('0x54')]['Body'];_0x27041d['body'][_0x0a9e('0x72')]=_0x23b447[_0x0a9e('0x54')]['MessageSid'];break;case _0x0a9e('0x73'):_0x27041d[_0x0a9e('0x54')][_0x0a9e('0x74')]='+'+_0x23b447[_0x0a9e('0x54')][_0x0a9e('0x75')];_0x27041d['body']['body']=_0x23b447[_0x0a9e('0x54')][_0x0a9e('0x76')];break;case _0x0a9e('0x77'):_0x27041d[_0x0a9e('0x54')][_0x0a9e('0x74')]=_0x23b447['body'][_0x0a9e('0x74')];_0x27041d[_0x0a9e('0x54')]['body']=_0x23b447[_0x0a9e('0x54')][_0x0a9e('0x22')];break;case _0x0a9e('0x78'):_0x27041d[_0x0a9e('0x54')][_0x0a9e('0x74')]=_0x23b447[_0x0a9e('0x54')][_0x0a9e('0x74')];_0x27041d[_0x0a9e('0x54')][_0x0a9e('0x54')]=_0x23b447[_0x0a9e('0x54')]['body'];_0x27041d[_0x0a9e('0x54')][_0x0a9e('0x72')]=_0x23b447[_0x0a9e('0x54')][_0x0a9e('0x79')];break;case _0x0a9e('0x7a'):_0x27041d['body']['from']=_0x23b447[_0x0a9e('0x54')][_0x0a9e('0x7b')];_0x27041d[_0x0a9e('0x54')][_0x0a9e('0x54')]=_0x23b447[_0x0a9e('0x54')]['Text'];_0x27041d[_0x0a9e('0x54')][_0x0a9e('0x72')]=_0x23b447[_0x0a9e('0x54')]['MessageUUID'];break;case _0x0a9e('0x7c'):_0x27041d['body'][_0x0a9e('0x74')]='+'+_0x23b447['body'][_0x0a9e('0x7d')][0x0][_0x0a9e('0x74')];_0x27041d[_0x0a9e('0x54')]['body']=_0x23b447[_0x0a9e('0x54')]['results'][0x0][_0x0a9e('0x76')];_0x27041d[_0x0a9e('0x54')][_0x0a9e('0x72')]=_0x23b447[_0x0a9e('0x54')][_0x0a9e('0x7d')][0x0][_0x0a9e('0x72')];break;case _0x0a9e('0x7e'):_0x27041d[_0x0a9e('0x54')][_0x0a9e('0x74')]=_0x23b447[_0x0a9e('0x54')][_0x0a9e('0x7f')];_0x27041d[_0x0a9e('0x54')][_0x0a9e('0x54')]=_0x23b447[_0x0a9e('0x54')][_0x0a9e('0x80')][_0x0a9e('0x22')];break;case'clickatell':_0x27041d['body'][_0x0a9e('0x74')]=_0x23b447['body'][_0x0a9e('0x81')];_0x27041d[_0x0a9e('0x54')]['body']=_0x23b447[_0x0a9e('0x54')][_0x0a9e('0x76')];_0x27041d[_0x0a9e('0x54')][_0x0a9e('0x72')]=_0x23b447['body'][_0x0a9e('0x82')];break;}}if(_0x27041d[_0x0a9e('0x54')]['id']){delete _0x27041d[_0x0a9e('0x54')]['id'];}if(_[_0x0a9e('0x83')](_0x27041d['body'][_0x0a9e('0x74')])){throw new db[(_0x0a9e('0x68'))][(_0x0a9e('0x69'))]('from\x20is\x20mandatory');}if(_[_0x0a9e('0x83')](_0x27041d[_0x0a9e('0x54')][_0x0a9e('0x54')])||_0x27041d['body'][_0x0a9e('0x54')]===''){throw new db[(_0x0a9e('0x68'))][(_0x0a9e('0x69'))](_0x0a9e('0x84'));}if(_[_0x0a9e('0x83')](_0x27041d['body'][_0x0a9e('0x85')])){throw new db[(_0x0a9e('0x68'))]['ValidationError'](_0x0a9e('0x86')+_0x4f4d2d);}if(!_[_0x0a9e('0x87')](_0x4f4d2d,_0x27041d[_0x0a9e('0x54')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x0a9e('0x88')+_0x4f4d2d);}_0x3ceba6[_0x27041d[_0x0a9e('0x54')]['mapKey']]=_0x27041d[_0x0a9e('0x54')][_0x0a9e('0x74')];return db[_0x0a9e('0x89')]['find']({'where':{'id':_0x27041d[_0x0a9e('0x67')][_0x0a9e('0x6e')]},'include':[{'model':db[_0x0a9e('0x8a')],'as':_0x0a9e('0x8b'),'where':_0x3ceba6,'limit':0x1,'order':[[_0x0a9e('0x6d'),_0x0a9e('0x8c')]]}]});})[_0x0a9e('0x2e')](handleEntityNotFound(_0x5e725e,null))[_0x0a9e('0x2e')](function(_0x3b5bda){if(_0x3b5bda){_0x27041d['list']=_[_0x0a9e('0x8d')](_0x3b5bda,['Contacts']);if(_0x3b5bda[_0x0a9e('0x8b')][_0x0a9e('0x52')]){return _0x3b5bda[_0x0a9e('0x8b')][0x0];}var _0x3cf222=_[_0x0a9e('0x8e')](_0x27041d[_0x0a9e('0x54')],{'firstName':_0x27041d['body'][_0x0a9e('0x74')],'ListId':_0x3b5bda['id']});_0x3cf222[_0x27041d[_0x0a9e('0x54')][_0x0a9e('0x85')]]=_0x27041d[_0x0a9e('0x54')]['from'];return db[_0x0a9e('0x8a')][_0x0a9e('0x57')](_0x3cf222,{'fields':_0xf8c6c4,'raw':!![]});}})[_0x0a9e('0x2e')](handleEntityNotFound(_0x5e725e,null))[_0x0a9e('0x2e')](function(_0xc2e7b){if(_0xc2e7b){_0x27041d[_0x0a9e('0x8f')]=_0xc2e7b;var _0x238c24={'ContactId':_0xc2e7b['id'],'phone':_0x27041d[_0x0a9e('0x54')][_0x0a9e('0x74')],'SmsAccountId':_0x23b447[_0x0a9e('0x50')]['id']};var _0x57f0ad={'ContactId':_0xc2e7b['id'],'SmsAccountId':_0x23b447[_0x0a9e('0x50')]['id'],'closed':![]};return db[_0x0a9e('0x90')][_0x0a9e('0x53')]({'where':_0x57f0ad})[_0x0a9e('0x2e')](function(_0xea8bd1){if(_0xea8bd1){return[_0xea8bd1,![]];}return db[_0x0a9e('0x90')][_0x0a9e('0x57')](_0x238c24)[_0x0a9e('0x2e')](function(_0x566b90){return[_0x566b90,!![]];});});}})[_0x0a9e('0x91')](function(_0xd2391,_0x1a9ef1){_0x27041d['interaction']=_0xd2391[_0x0a9e('0x92')]({'plain':!![]});_0x27041d[_0x0a9e('0x93')][_0x0a9e('0x94')]=![];if(_0x1a9ef1){if(_0x27041d[_0x0a9e('0x67')][_0x0a9e('0x95')]){_0x27041d[_0x0a9e('0x63')][_0x0a9e('0x96')]({'id':0x0,'priority':_0x27041d[_0x0a9e('0x63')][_0x0a9e('0x52')]+0x1,'app':_0x0a9e('0x97'),'appdata':'unmanaged','interval':_0x0a9e('0x98')});}_0x27041d[_0x0a9e('0x93')][_0x0a9e('0x94')]=!![];}return db[_0x0a9e('0x99')][_0x0a9e('0x57')]({'phone':_0x27041d[_0x0a9e('0x54')]['from'],'messageId':_0x27041d[_0x0a9e('0x54')]['messageId'],'body':_0x27041d['body']['body'],'SmsAccountId':_0x23b447[_0x0a9e('0x50')]['id'],'SmsInteractionId':_0xd2391['id'],'direction':'in','ContactId':_0xd2391[_0x0a9e('0x9a')],'AttachmentId':_0x27041d[_0x0a9e('0x54')][_0x0a9e('0x9b')]});})['then'](function(_0x4156a5){_0x27041d[_0x0a9e('0x22')]=_0x4156a5;if(_0x27041d[_0x0a9e('0x93')][_0x0a9e('0x9c')]){return db[_0x0a9e('0x9d')]['find']({'attributes':['id','name'],'where':{'id':_0x27041d[_0x0a9e('0x93')][_0x0a9e('0x9c')]}})[_0x0a9e('0x2e')](function(_0x5e85d0){if(_0x5e85d0){_0x27041d[_0x0a9e('0x63')][_0x0a9e('0x9e')]({'id':0x0,'priority':0x0,'app':_0x0a9e('0x9f'),'appdata':_0x5e85d0['name']+','+(_0x27041d[_0x0a9e('0x67')][_0x0a9e('0xa0')]||0xa),'interval':_0x0a9e('0x98')});}return respondWithRpcPromise('Start',_0x0a9e('0xa1'),_0x27041d);});}return respondWithRpcPromise(_0x0a9e('0xa2'),_0x0a9e('0xa1'),_0x27041d);})['then'](function(_0x549697){if(_0x549697){var _0x53ef46=0xc8;var _0x3b04fd=_0x0a9e('0xa3');logger[_0x0a9e('0x1b')](_0x0a9e('0x1d'),_0x3b04fd,_0x53ef46,'entity\x20found');logger[_0x0a9e('0xa4')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x3b04fd,_0x53ef46,_0x0a9e('0xa5'),JSON[_0x0a9e('0x1e')](_0x549697));if(_0x27041d[_0x0a9e('0x67')]['type']===_0x0a9e('0x71')){return _0x5e725e[_0x0a9e('0x25')](_0x53ef46)[_0x0a9e('0xa6')]('Content-Type',_0x0a9e('0xa7'))['send'](_0x0a9e('0xa8'));}else{return _0x5e725e['status'](_0x53ef46)[_0x0a9e('0x2a')](_0x549697);}}})['catch'](handleError(_0x5e725e,null));};exports[_0x0a9e('0xa9')]=function(_0x37215d,_0xa288e4,_0x10ace8){return db[_0x0a9e('0x34')][_0x0a9e('0x59')]({'where':{'id':_0x37215d[_0x0a9e('0x50')]['id']}})['then'](handleEntityNotFound(_0xa288e4,null))[_0x0a9e('0x2e')](function(_0x1c9ea2){if(_0x1c9ea2){return db['sequelize'][_0x0a9e('0xaa')](function(_0x3753ca){return db['SmsApplication'][_0x0a9e('0x2f')]({'where':{'SmsAccountId':_0x37215d[_0x0a9e('0x50')]['id']},'transaction':_0x3753ca})[_0x0a9e('0x2e')](function(_0x569528){var _0x3766d7=_[_0x0a9e('0x48')](_0x37215d[_0x0a9e('0x54')],function(_0x3f0d64){_0x3f0d64[_0x0a9e('0x5a')]=_0x37215d[_0x0a9e('0x50')]['id'];return _0x3f0d64;});return db[_0x0a9e('0xab')][_0x0a9e('0xac')](_0x3766d7,{'transaction':_0x3753ca});});})[_0x0a9e('0x2e')](function(){return db[_0x0a9e('0xab')]['findAndCountAll']({'where':{'SmsAccountId':_0x37215d[_0x0a9e('0x50')]['id']},'order':'priority'});});}})[_0x0a9e('0x2e')](respondWithResult(_0xa288e4,null))[_0x0a9e('0x4e')](handleError(_0xa288e4,null));};exports[_0x0a9e('0xad')]=function(_0x315e31,_0x5d577b,_0x2d45db){var _0x5691ac={};var _0x119708={};var _0x469035;var _0x2977a7;return db['SmsAccount'][_0x0a9e('0x59')]({'where':{'id':_0x315e31[_0x0a9e('0x50')]['id']}})[_0x0a9e('0x2e')](handleEntityNotFound(_0x5d577b,null))[_0x0a9e('0x2e')](function(_0x31e1e0){if(_0x31e1e0){_0x469035=_0x31e1e0;_0x119708[_0x0a9e('0x3d')]=_[_0x0a9e('0x51')](db['SmsApplication'][_0x0a9e('0x35')]);_0x119708[_0x0a9e('0x37')]=_[_0x0a9e('0x51')](_0x315e31[_0x0a9e('0x37')]);_0x119708[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x119708[_0x0a9e('0x3d')],_0x119708['query']);_0x5691ac['attributes']=_[_0x0a9e('0x3a')](_0x119708[_0x0a9e('0x3d')],qs[_0x0a9e('0x3c')](_0x315e31[_0x0a9e('0x37')][_0x0a9e('0x3c')]));_0x5691ac[_0x0a9e('0x3b')]=_0x5691ac[_0x0a9e('0x3b')]['length']?_0x5691ac[_0x0a9e('0x3b')]:_0x119708[_0x0a9e('0x3d')];_0x5691ac[_0x0a9e('0x40')]=qs[_0x0a9e('0x41')](_0x315e31[_0x0a9e('0x37')][_0x0a9e('0x41')]);_0x5691ac[_0x0a9e('0x42')]=qs['filters'](_[_0x0a9e('0x43')](_0x315e31[_0x0a9e('0x37')],_0x119708[_0x0a9e('0x39')]));if(_0x315e31['query'][_0x0a9e('0x47')]){_0x5691ac[_0x0a9e('0x42')]=_[_0x0a9e('0x46')](_0x5691ac[_0x0a9e('0x42')],{'$or':_['map'](_0x5691ac[_0x0a9e('0x3b')],function(_0xcbbea0){var _0x21d082={};_0x21d082[_0xcbbea0]={'$like':'%'+_0x315e31[_0x0a9e('0x37')][_0x0a9e('0x47')]+'%'};return _0x21d082;})});}_0x5691ac=_[_0x0a9e('0x46')]({},_0x5691ac,_0x315e31[_0x0a9e('0x49')]);return _0x469035[_0x0a9e('0xad')](_0x5691ac);}})['then'](function(_0x3ede01){if(_0x3ede01){_0x2977a7=_0x3ede01[_0x0a9e('0x52')];if(!_0x315e31[_0x0a9e('0x37')][_0x0a9e('0x3e')]('nolimit')){_0x5691ac['limit']=qs[_0x0a9e('0x28')](_0x315e31[_0x0a9e('0x37')][_0x0a9e('0x28')]);_0x5691ac['offset']=qs[_0x0a9e('0x27')](_0x315e31[_0x0a9e('0x37')]['offset']);}return _0x469035[_0x0a9e('0xad')](_0x5691ac);}})['then'](function(_0x35cc2a){if(_0x35cc2a){return _0x35cc2a?{'count':_0x2977a7,'rows':_0x35cc2a}:null;}})['then'](respondWithResult(_0x5d577b,null))['catch'](handleError(_0x5d577b,null));};exports['getInteractions']=function(_0xad4d10,_0x4297d1,_0x19f800){var _0x20007e={'raw':![],'where':{}};var _0x7d59a9={};var _0xe17af8={'count':0x0,'rows':[]};return db['SmsAccount'][_0x0a9e('0x59')]({'where':{'id':_0xad4d10[_0x0a9e('0x50')]['id']}})[_0x0a9e('0x2e')](handleEntityNotFound(_0x4297d1,null))[_0x0a9e('0x2e')](function(_0x293b22){if(_0x293b22){_0x7d59a9[_0x0a9e('0x3d')]=_[_0x0a9e('0x51')](db['SmsInteraction']['rawAttributes']);_0x7d59a9[_0x0a9e('0x37')]=_['keys'](_0xad4d10[_0x0a9e('0x37')]);_0x7d59a9[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x7d59a9[_0x0a9e('0x3d')],_0x7d59a9[_0x0a9e('0x37')]);_0x20007e[_0x0a9e('0x3b')]=_['intersection'](_0x7d59a9[_0x0a9e('0x3d')],qs['fields'](_0xad4d10['query'][_0x0a9e('0x3c')]));_0x20007e['attributes']=_0x20007e[_0x0a9e('0x3b')]['length']?_0x20007e['attributes']:_0x7d59a9[_0x0a9e('0x3d')];if(!_0xad4d10['query'][_0x0a9e('0x3e')](_0x0a9e('0x3f'))){_0x20007e[_0x0a9e('0x28')]=qs['limit'](_0xad4d10[_0x0a9e('0x37')][_0x0a9e('0x28')]);_0x20007e[_0x0a9e('0x27')]=qs['offset'](_0xad4d10['query'][_0x0a9e('0x27')]);}_0x20007e[_0x0a9e('0x40')]=qs[_0x0a9e('0x41')](_0xad4d10[_0x0a9e('0x37')][_0x0a9e('0x41')]);_0x20007e[_0x0a9e('0x42')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x43')](_0xad4d10[_0x0a9e('0x37')],_0x7d59a9[_0x0a9e('0x39')]));_0x20007e['where']['SmsAccountId']=_0x293b22['id'];if(_0xad4d10['query'][_0x0a9e('0x47')]){_0x20007e[_0x0a9e('0x42')]=_[_0x0a9e('0x46')](_0x20007e[_0x0a9e('0x42')],{'$or':_[_0x0a9e('0x48')](_0x20007e[_0x0a9e('0x3b')],function(_0x2b97fc){var _0x307d13={};_0x307d13[_0x2b97fc]={'$like':'%'+_0xad4d10['query']['filter']+'%'};return _0x307d13;})});}_0x20007e=_[_0x0a9e('0x46')]({},_0x20007e,_0xad4d10[_0x0a9e('0x49')]);return db['SmsInteraction'][_0x0a9e('0x26')]({'where':_0x20007e[_0x0a9e('0x42')]})[_0x0a9e('0x2e')](function(_0x19e024){_0xe17af8[_0x0a9e('0x26')]=_0x19e024;if(_0xad4d10[_0x0a9e('0x37')][_0x0a9e('0x4a')]){_0x20007e[_0x0a9e('0x4b')]=[{'model':db[_0x0a9e('0x8a')],'as':_0x0a9e('0xae'),'required':![]},{'model':db[_0x0a9e('0x9d')],'as':_0x0a9e('0xaf'),'attributes':['name',_0x0a9e('0xb0'),_0x0a9e('0xb1')],'required':![]},{'model':db[_0x0a9e('0xb2')],'as':_0x0a9e('0xb3'),'attributes':['id',_0x0a9e('0x32'),_0x0a9e('0xb4')],'where':_0xad4d10[_0x0a9e('0x37')][_0x0a9e('0xb5')]?{'id':_0xad4d10[_0x0a9e('0x37')][_0x0a9e('0xb5')]}:undefined,'required':_0xad4d10[_0x0a9e('0x37')][_0x0a9e('0xb5')]?!![]:![]}];}return db['SmsInteraction']['findAll'](_0x20007e);})[_0x0a9e('0x2e')](function(_0x401207){_0xe17af8[_0x0a9e('0x4d')]=_0x401207;return _0xe17af8;});}})[_0x0a9e('0x2e')](respondWithFilteredResult(_0x4297d1,_0x20007e))[_0x0a9e('0x4e')](handleError(_0x4297d1,null));};exports[_0x0a9e('0xb6')]=function(_0xa8b5de,_0x4f7907,_0x26a204){var _0x49fd0e,_0x26aa44,_0x1ad1d7;if(_[_0x0a9e('0x83')](_0xa8b5de[_0x0a9e('0x54')][_0x0a9e('0x54')])||_0xa8b5de[_0x0a9e('0x54')][_0x0a9e('0x54')]===''){throw new db[(_0x0a9e('0x68'))][(_0x0a9e('0x69'))](_0x0a9e('0x84'));}if(_[_0x0a9e('0x83')](_0xa8b5de[_0x0a9e('0x54')]['to'])){throw new db[(_0x0a9e('0x68'))][(_0x0a9e('0x69'))](_0x0a9e('0xb7'));}_0x49fd0e=_0xa8b5de[_0x0a9e('0x54')]['to'];return db['SmsAccount']['find']({'where':{'id':_0xa8b5de[_0x0a9e('0x50')]['id']},'include':[{'model':db[_0x0a9e('0x89')],'as':'List','include':[{'model':db['CmContact'],'as':_0x0a9e('0x8b'),'where':{'mobile':_0x49fd0e},'limit':0x1,'order':[[_0x0a9e('0x6d'),_0x0a9e('0x8c')]]}]}]})['then'](handleEntityNotFound(_0x4f7907,null))[_0x0a9e('0x2e')](function(_0x5b6447){if(_0x5b6447&&_0x5b6447[_0x0a9e('0xb8')]){_0x26aa44=_0x5b6447['get']({'plain':!![]});if(_0x26aa44[_0x0a9e('0xb8')]&&_0x26aa44['List'][_0x0a9e('0x8b')][_0x0a9e('0x52')]){return _0x26aa44[_0x0a9e('0xb8')]['Contacts'][0x0];}return db[_0x0a9e('0x8a')]['create'](_['defaults'](_0xa8b5de[_0x0a9e('0x54')],{'firstName':_0x49fd0e,'mobile':_0x49fd0e,'phone':_0x49fd0e,'ListId':_0x26aa44[_0x0a9e('0x6e')]}));}})[_0x0a9e('0x2e')](handleEntityNotFound(_0x4f7907,null))[_0x0a9e('0x2e')](function(_0x1d51fd){if(_0x1d51fd){_0x1ad1d7=_0x1d51fd;return db[_0x0a9e('0x90')][_0x0a9e('0x53')]({'where':{'ContactId':_0x1ad1d7['id'],'closed':![],'SmsAccountId':_0x26aa44['id']}})[_0x0a9e('0x2e')](function(_0x1a3143){if(_0x1a3143){return[_0x1a3143,![]];}return db[_0x0a9e('0x90')][_0x0a9e('0x57')]({'UserId':_0xa8b5de[_0x0a9e('0xb9')]['id'],'ContactId':_0x1ad1d7['id'],'SmsAccountId':_0x26aa44['id'],'phone':_0x49fd0e,'firstMsgDirection':_0x0a9e('0xba'),'Messages':[_[_0x0a9e('0x46')](_0xa8b5de[_0x0a9e('0x54')],{'read':![],'body':_0xa8b5de[_0x0a9e('0x54')][_0x0a9e('0x54')],'phone':_0x49fd0e,'SmsAccountId':_0x26aa44['id'],'UserId':_0xa8b5de[_0x0a9e('0xb9')]['id'],'ContactId':_0x1ad1d7['id']})]},{'include':[{'model':db[_0x0a9e('0x99')],'as':'Messages'}]})[_0x0a9e('0x2e')](function(_0xf780f5){return[_0xf780f5,!![]];});});}})[_0x0a9e('0x91')](function(_0x356132,_0x56e63d){if(_0x56e63d){return _0x356132;}return db['SmsMessage']['create'](_[_0x0a9e('0x46')](_0xa8b5de['body'],{'read':![],'body':_0xa8b5de[_0x0a9e('0x54')][_0x0a9e('0x54')],'phone':_0x49fd0e,'SmsAccountId':_0x26aa44['id'],'SmsInteractionId':_0x356132['id'],'UserId':_0xa8b5de[_0x0a9e('0xb9')]['id'],'ContactId':_0x1ad1d7['id']}))[_0x0a9e('0x2e')](function(_0x294c49){_0x356132[_0x0a9e('0xbb')][_0x0a9e('0xbc')]=[];_0x356132[_0x0a9e('0xbb')][_0x0a9e('0xbc')][_0x0a9e('0x96')](_0x294c49['dataValues']);return _0x356132;});})[_0x0a9e('0x2e')](respondWithResult(_0x4f7907,null))['catch'](handleError(_0x4f7907,null));};exports[_0x0a9e('0x25')]=function(_0x586d2f,_0xf4de86,_0x2c5385){if(_0x586d2f[_0x0a9e('0x54')]['id']){delete _0x586d2f['body']['id'];}console[_0x0a9e('0xbd')](_0x0a9e('0xbe'),_0x586d2f['body']);var _0x53c4f0,_0x3fab79,_0x41e19e;return db[_0x0a9e('0x34')]['find']({'where':{'id':_0x586d2f['params']['id']}})['then'](handleEntityNotFound(_0xf4de86,null))[_0x0a9e('0x2e')](function(_0x22c591){if(_0x22c591){_0x41e19e=_0x22c591;logger[_0x0a9e('0xa4')](_0x0a9e('0x1d'),_0x0a9e('0x25'),_0x0a9e('0xbf'),_0x22c591[_0x0a9e('0x70')],util[_0x0a9e('0xc0')](_0x586d2f[_0x0a9e('0x54')],{'showHidden':![],'depth':null}));switch(_0x22c591[_0x0a9e('0x70')]){case _0x0a9e('0x73'):if(_0x586d2f[_0x0a9e('0x54')][_0x0a9e('0xc1')]&&_0x586d2f[_0x0a9e('0x54')][_0x0a9e('0x25')]){_0x3fab79=_0x586d2f[_0x0a9e('0x54')][_0x0a9e('0x25')];return db[_0x0a9e('0x99')]['find']({'where':{'messageId':_0x586d2f[_0x0a9e('0x54')][_0x0a9e('0xc1')]}});}break;case _0x0a9e('0x77'):if(_0x586d2f[_0x0a9e('0x54')][_0x0a9e('0xc2')]&&_0x586d2f[_0x0a9e('0x54')]['statusInt']){_0x3fab79=_0x586d2f[_0x0a9e('0x54')][_0x0a9e('0xc3')];return db[_0x0a9e('0x99')][_0x0a9e('0x53')]({'where':{'messageId':_0x586d2f[_0x0a9e('0x54')][_0x0a9e('0xc2')]}});}break;case _0x0a9e('0x78'):if(_0x586d2f[_0x0a9e('0x54')][_0x0a9e('0x79')]&&_0x586d2f['body']['status_code']){_0x3fab79=_0x586d2f[_0x0a9e('0x54')][_0x0a9e('0xc4')];return db['SmsMessage'][_0x0a9e('0x53')]({'where':{'messageId':_0x586d2f[_0x0a9e('0x54')]['message_id']}});}break;case _0x0a9e('0x7c'):var _0x4fc371=_0x586d2f[_0x0a9e('0x54')][_0x0a9e('0x7d')][0x0];if(_0x4fc371['messageId']&&_0x4fc371[_0x0a9e('0x25')][_0x0a9e('0xc5')]==='DELIVERED'){_0x3fab79=_0x4fc371[_0x0a9e('0x25')][_0x0a9e('0xc5')];return db['SmsMessage'][_0x0a9e('0x53')]({'where':{'messageId':_0x4fc371[_0x0a9e('0x72')]}});}break;case _0x0a9e('0xc6'):if(_0x586d2f[_0x0a9e('0x54')][_0x0a9e('0x72')]&&_0x586d2f[_0x0a9e('0x54')]['status']){_0x3fab79=_0x586d2f[_0x0a9e('0x54')][_0x0a9e('0x25')];return db['SmsMessage'][_0x0a9e('0x53')]({'where':{'messageId':_0x586d2f[_0x0a9e('0x54')][_0x0a9e('0x72')]}});}break;}}})[_0x0a9e('0x2e')](handleEntityNotFound(_0xf4de86,null))[_0x0a9e('0x2e')](function(_0x200f3e){if(_0x200f3e){_0x53c4f0=_0x200f3e;switch(_0x41e19e[_0x0a9e('0x70')]){case'skebby':if(_0x3fab79==='DELIVERED'){return _0x53c4f0['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0a9e('0x25'),_0x0a9e('0x73'),util['inspect'](_0x586d2f['body'],{'showHidden':![],'depth':null}));}break;case _0x0a9e('0x77'):if(_0x3fab79==='1'){return _0x53c4f0['update']({'read':!![]});}else{logger[_0x0a9e('0x1f')](_0x0a9e('0x1d'),_0x0a9e('0x25'),_0x0a9e('0x73'),util[_0x0a9e('0xc0')](_0x586d2f[_0x0a9e('0x54')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x586d2f[_0x0a9e('0x54')][_0x0a9e('0xc7')]&&_0x3fab79>=0xc8&&_0x3fab79<=0xce){return _0x53c4f0['update']({'read':!![]});}else{logger[_0x0a9e('0x1f')](_0x0a9e('0x1d'),_0x0a9e('0x25'),_0x0a9e('0x78'),util[_0x0a9e('0xc0')](_0x586d2f[_0x0a9e('0x54')],{'showHidden':![],'depth':null}));}break;case _0x0a9e('0x7c'):var _0x4a36df=_0x586d2f[_0x0a9e('0x54')]['results'][0x0];if(_0x4a36df[_0x0a9e('0x25')][_0x0a9e('0xc5')]==='DELIVERED'){return _0x53c4f0[_0x0a9e('0x2d')]({'read':!![]});}else{logger[_0x0a9e('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0a9e('0x25'),'infobip',util[_0x0a9e('0xc0')](_0x586d2f[_0x0a9e('0x54')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x3fab79==_0x0a9e('0xc8')||_0x3fab79=='RECEIVED_BY_RECIPIENT'){return _0x53c4f0[_0x0a9e('0x2d')]({'read':!![]});}else{logger[_0x0a9e('0x1f')](_0x0a9e('0x1d'),_0x0a9e('0x25'),_0x0a9e('0xc6'),util[_0x0a9e('0xc0')](_0x586d2f[_0x0a9e('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x53c4f0;}})['then'](respondWithResult(_0xf4de86,null))[_0x0a9e('0x4e')](handleError(_0xf4de86,null));};exports[_0x0a9e('0xc9')]=function(_0x17854b,_0x1b1971,_0x38e256){var _0x5932ad,_0xb376ed,_0x49a6b2;return db['SmsAccount'][_0x0a9e('0x53')]({'where':{'id':_0x17854b['params']['id']}})[_0x0a9e('0x2e')](handleEntityNotFound(_0x1b1971,null))[_0x0a9e('0x2e')](function(_0x58d5fd){if(_0x58d5fd){_0x49a6b2=_0x58d5fd;logger[_0x0a9e('0xa4')](_0x0a9e('0x1d'),_0x0a9e('0x25'),_0x0a9e('0xbf'),_0x58d5fd[_0x0a9e('0x70')],util[_0x0a9e('0xc0')](_0x17854b[_0x0a9e('0x37')],{'showHidden':![],'depth':null}));switch(_0x58d5fd[_0x0a9e('0x70')]){case _0x0a9e('0x7e'):if(_0x17854b['query'][_0x0a9e('0xca')]&&_0x17854b[_0x0a9e('0x37')][_0x0a9e('0xcb')]){_0xb376ed=_0x17854b[_0x0a9e('0x37')]['state'];return db[_0x0a9e('0x99')][_0x0a9e('0x53')]({'where':{'messageId':_0x17854b[_0x0a9e('0x37')]['message-id']}});}break;}}})[_0x0a9e('0x2e')](handleEntityNotFound(_0x1b1971,null))[_0x0a9e('0x2e')](function(_0x393e21){if(_0x393e21){_0x5932ad=_0x393e21;switch(_0x49a6b2['type']){case _0x0a9e('0x7e'):if(_0xb376ed==='2'||_0xb376ed==='6'){return _0x5932ad['update']({'read':!![]});}else{logger[_0x0a9e('0x1f')](_0x0a9e('0x1d'),_0x0a9e('0x25'),_0x0a9e('0x7e'),util[_0x0a9e('0xc0')](_0x17854b[_0x0a9e('0x37')],{'showHidden':![],'depth':null}));};break;}return _0x5932ad;}})[_0x0a9e('0x2e')](respondWithResult(_0x1b1971,null))['catch'](handleError(_0x1b1971,null));};exports[_0x0a9e('0xcc')]=function(_0xabaf97,_0x7c4db6,_0x14444e){return db[_0x0a9e('0x34')][_0x0a9e('0x53')]({'where':{'id':_0xabaf97[_0x0a9e('0x50')]['id']}})[_0x0a9e('0x2e')](handleEntityNotFound(_0x7c4db6,null))[_0x0a9e('0x2e')](function(_0x4712c9){if(_0x4712c9){return _0x4712c9[_0x0a9e('0xcc')](_0xabaf97[_0x0a9e('0x54')][_0x0a9e('0x5c')],_[_0x0a9e('0x8d')](_0xabaf97[_0x0a9e('0x54')],[_0x0a9e('0x5c'),'id'])||{})[_0x0a9e('0x91')](function(_0x28932f){for(var _0x6276a4=0x0;_0x6276a4<_0xabaf97[_0x0a9e('0x54')][_0x0a9e('0x5c')][_0x0a9e('0x52')];_0x6276a4+=0x1){socket[_0x0a9e('0xcd')]('userSmsAccount:save',{'UserId':_0xabaf97[_0x0a9e('0x54')][_0x0a9e('0x5c')][_0x6276a4],'SmsAccountId':_0xabaf97[_0x0a9e('0x50')]['id']});}return _0x28932f;});}})['then'](respondWithResult(_0x7c4db6,null))[_0x0a9e('0x4e')](handleError(_0x7c4db6,null));};exports['removeAgents']=function(_0xf007cd,_0xf2f758,_0x20a292){var _0x39c4da;return db[_0x0a9e('0x34')][_0x0a9e('0x53')]({'where':{'id':_0xf007cd[_0x0a9e('0x50')]['id']}})[_0x0a9e('0x2e')](handleEntityNotFound(_0xf2f758,null))['then'](function(_0x3ccbed){if(_0x3ccbed){return _0x3ccbed[_0x0a9e('0xce')](_0xf007cd['query'][_0x0a9e('0x5c')])[_0x0a9e('0x2e')](function(_0x579bb0){if(_['isArray'](_0xf007cd[_0x0a9e('0x37')][_0x0a9e('0x5c')])){for(var _0x315299=0x0;_0x315299<_0xf007cd[_0x0a9e('0x37')]['ids'][_0x0a9e('0x52')];_0x315299+=0x1){socket[_0x0a9e('0xcd')](_0x0a9e('0xcf'),{'UserId':_0xf007cd[_0x0a9e('0x37')][_0x0a9e('0x5c')][_0x315299],'SmsAccountId':_0xf007cd['params']['id']});}}else{socket[_0x0a9e('0xcd')](_0x0a9e('0xcf'),{'UserId':_0xf007cd['query'][_0x0a9e('0x5c')],'SmsAccountId':_0xf007cd[_0x0a9e('0x50')]['id']});}});}})[_0x0a9e('0x2e')](respondWithStatusCode(_0xf2f758,null))['catch'](handleError(_0xf2f758,null));};exports['getAgents']=function(_0x45ef37,_0x36d905,_0x271485){var _0x283bbb={};var _0x23a073={};var _0x430aa1;var _0x312e02;return db[_0x0a9e('0x34')]['findOne']({'where':{'id':_0x45ef37['params']['id']}})[_0x0a9e('0x2e')](handleEntityNotFound(_0x36d905,null))['then'](function(_0x803bc){if(_0x803bc){_0x430aa1=_0x803bc;_0x23a073[_0x0a9e('0x3d')]=_[_0x0a9e('0x51')](db[_0x0a9e('0x9d')]['rawAttributes']);_0x23a073[_0x0a9e('0x37')]=_[_0x0a9e('0x51')](_0x45ef37['query']);_0x23a073[_0x0a9e('0x39')]=_['intersection'](_0x23a073[_0x0a9e('0x3d')],_0x23a073[_0x0a9e('0x37')]);_0x283bbb[_0x0a9e('0x3b')]=_[_0x0a9e('0x3a')](_0x23a073[_0x0a9e('0x3d')],qs[_0x0a9e('0x3c')](_0x45ef37['query'][_0x0a9e('0x3c')]));_0x283bbb['attributes']=_0x283bbb[_0x0a9e('0x3b')][_0x0a9e('0x52')]?_0x283bbb[_0x0a9e('0x3b')]:_0x23a073[_0x0a9e('0x3d')];_0x283bbb[_0x0a9e('0x40')]=qs[_0x0a9e('0x41')](_0x45ef37[_0x0a9e('0x37')]['sort']);_0x283bbb[_0x0a9e('0x42')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x43')](_0x45ef37[_0x0a9e('0x37')],_0x23a073[_0x0a9e('0x39')]));if(_0x45ef37['query'][_0x0a9e('0x47')]){_0x283bbb[_0x0a9e('0x42')]=_['merge'](_0x283bbb['where'],{'$or':_[_0x0a9e('0x48')](_0x283bbb[_0x0a9e('0x3b')],function(_0x439bc7){var _0x32cdbe={};_0x32cdbe[_0x439bc7]={'$like':'%'+_0x45ef37[_0x0a9e('0x37')][_0x0a9e('0x47')]+'%'};return _0x32cdbe;})});}_0x283bbb=_['merge']({},_0x283bbb,_0x45ef37[_0x0a9e('0x49')]);return _0x430aa1[_0x0a9e('0xd0')](_0x283bbb);}})[_0x0a9e('0x2e')](function(_0x4bf3c7){if(_0x4bf3c7){_0x312e02=_0x4bf3c7[_0x0a9e('0x52')];if(!_0x45ef37[_0x0a9e('0x37')][_0x0a9e('0x3e')](_0x0a9e('0x3f'))){_0x283bbb['limit']=qs['limit'](_0x45ef37[_0x0a9e('0x37')][_0x0a9e('0x28')]);_0x283bbb[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x45ef37[_0x0a9e('0x37')][_0x0a9e('0x27')]);}return _0x430aa1[_0x0a9e('0xd0')](_0x283bbb);}})[_0x0a9e('0x2e')](function(_0x4a4f79){if(_0x4a4f79){return _0x4a4f79?{'count':_0x312e02,'rows':_0x4a4f79}:null;}})[_0x0a9e('0x2e')](respondWithResult(_0x36d905,null))['catch'](handleError(_0x36d905,null));}; \ No newline at end of file +var _0xa9e0=['originatingAddress','segmentedMessage','fromNumber','replyMessageId','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','CmList','CmContact','Contacts','DESC','omit','defaults','contact','SmsInteraction','spread','get','interaction','created','autoclose','push','close','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','debug','entity\x20found','set','text/xml','\x0a','addApplications','transaction','SmsApplication','bulkCreate','getApplications','Contact','Owner','fullname','internal','Tag','Tags','color','tag','send','to\x20is\x20mandatory','List','user','out','dataValues','Messages','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','clickatell','error_code','DELIVERED_TO_GATEWAY','statusGet','message-id','state','addAgents','emit','removeAgents','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','redis','localhost','socket.io-emitter','./smsAccount.socket','register','client','http','request','info','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','sendStatus','status','count','offset','limit','Content-Range','json','reject','save','update','then','destroy','end','stack','name','index','SmsAccount','rawAttributes','dateStart','query','dateEnd','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','body','describe','Disposition','create','getDispositions','findOne','SmsAccountId','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','sms','Applications','applications','orderBy','priority','asc','account','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','type','twilio','messageId','skebby','from','sender','text','connectel','clicksend','message_id','plivo','From','infobip','results','csc'];(function(_0x5540e9,_0x242364){var _0x192160=function(_0x525fc8){while(--_0x525fc8){_0x5540e9['push'](_0x5540e9['shift']());}};_0x192160(++_0x242364);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var qs=require(_0x0a9e('0xf'));var logger=require(_0x0a9e('0x10'))(_0x0a9e('0x11'));var utils=require(_0x0a9e('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x0a9e('0x13')],{'host':_0x0a9e('0x14'),'port':0x18eb});var socket=require(_0x0a9e('0x15'))(new Redis(config[_0x0a9e('0x13')]));require(_0x0a9e('0x16'))[_0x0a9e('0x17')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x18')][_0x0a9e('0x19')]({'port':0x232c});function respondWithRpcPromise(_0x2b4227,_0x281129,_0x44dcfd,_0x4d5611){return new BPromise(function(_0x52a03d,_0x22dccb){var _0x5d0880=_0x4d5611||client;return _0x5d0880[_0x0a9e('0x1a')](_0x2b4227,_0x44dcfd)['then'](function(_0x16033c){logger[_0x0a9e('0x1b')]('SmsAccount,\x20%s,\x20%s',_0x281129,_0x0a9e('0x1c'));logger['debug'](_0x0a9e('0x1d'),_0x281129,_0x0a9e('0x1c'),JSON[_0x0a9e('0x1e')](_0x16033c));if(_0x16033c[_0x0a9e('0x1f')]){if(_0x16033c[_0x0a9e('0x1f')][_0x0a9e('0x20')]===0x1f4){logger[_0x0a9e('0x1f')](_0x0a9e('0x21'),_0x281129,_0x16033c[_0x0a9e('0x1f')][_0x0a9e('0x22')]);return _0x22dccb(_0x16033c[_0x0a9e('0x1f')][_0x0a9e('0x22')]);}logger['error'](_0x0a9e('0x21'),_0x281129,_0x16033c[_0x0a9e('0x1f')]['message']);return _0x52a03d(_0x16033c[_0x0a9e('0x1f')]['message']);}else{logger['info'](_0x0a9e('0x21'),_0x281129,_0x0a9e('0x1c'));_0x52a03d(_0x16033c[_0x0a9e('0x23')][_0x0a9e('0x22')]);}})['catch'](function(_0xfb6e48){logger[_0x0a9e('0x1f')](_0x0a9e('0x21'),_0x281129,_0xfb6e48);_0x22dccb(_0xfb6e48);});});}function respondWithStatusCode(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0xcc;return function(_0x42ac8f){if(_0x42ac8f){return _0x4d00e6[_0x0a9e('0x24')](_0x370d86);}return _0x4d00e6['status'](_0x370d86)['end']();};}function respondWithResult(_0x197ec0,_0x3a8e58){_0x3a8e58=_0x3a8e58||0xc8;return function(_0x40c424){if(_0x40c424){return _0x197ec0[_0x0a9e('0x25')](_0x3a8e58)['json'](_0x40c424);}};}function respondWithFilteredResult(_0x384319,_0x479bc4){return function(_0x45a1e7){if(_0x45a1e7){var _0x5bfb33=_0x45a1e7[_0x0a9e('0x26')],_0x1dc186=_0x479bc4[_0x0a9e('0x27')],_0x34dc65=_0x479bc4[_0x0a9e('0x27')]+_0x479bc4[_0x0a9e('0x28')],_0x25fba9;if(_0x34dc65>=_0x5bfb33){_0x34dc65=_0x5bfb33;_0x25fba9=0xc8;}else{_0x25fba9=0xce;}_0x384319[_0x0a9e('0x25')](_0x25fba9);return _0x384319['set'](_0x0a9e('0x29'),_0x1dc186+'-'+_0x34dc65+'/'+_0x5bfb33)[_0x0a9e('0x2a')](_0x45a1e7);}return null;};}function patchUpdates(_0x2b1f27){return function(_0x2ec755){try{jsonpatch['apply'](_0x2ec755,_0x2b1f27,!![]);}catch(_0x15b200){return BPromise[_0x0a9e('0x2b')](_0x15b200);}return _0x2ec755[_0x0a9e('0x2c')]();};}function saveUpdates(_0x824a4f,_0x58b06f){return function(_0x563b45){if(_0x563b45){return _0x563b45[_0x0a9e('0x2d')](_0x824a4f)[_0x0a9e('0x2e')](function(_0x1dbde2){return _0x1dbde2;});}return null;};}function removeEntity(_0x540530,_0x426950){return function(_0x5d1e0e){if(_0x5d1e0e){return _0x5d1e0e[_0x0a9e('0x2f')]()[_0x0a9e('0x2e')](function(){_0x540530[_0x0a9e('0x25')](0xcc)[_0x0a9e('0x30')]();});}};}function handleEntityNotFound(_0x25ce3a,_0x5180f1){return function(_0x66c1d2){if(!_0x66c1d2){_0x25ce3a[_0x0a9e('0x24')](0x194);}return _0x66c1d2;};}function handleError(_0x40cb85,_0x2da5c0){_0x2da5c0=_0x2da5c0||0x1f4;return function(_0x2b45ea){logger[_0x0a9e('0x1f')](_0x2b45ea[_0x0a9e('0x31')]);if(_0x2b45ea[_0x0a9e('0x32')]){delete _0x2b45ea['name'];}_0x40cb85[_0x0a9e('0x25')](_0x2da5c0)['send'](_0x2b45ea);};}exports[_0x0a9e('0x33')]=function(_0x14b13f,_0x2b7e7f){var _0x3f3d41={},_0x567193={},_0x191e91={'count':0x0,'rows':[]};var _0xd1836d=db[_0x0a9e('0x34')][_0x0a9e('0x35')];_0x567193['model']=_['keys'](_0xd1836d);var _0x1e8694={'dateStart':_0x14b13f['query'][_0x0a9e('0x36')],'dateEnd':_0x14b13f[_0x0a9e('0x37')][_0x0a9e('0x38')]};delete _0x14b13f[_0x0a9e('0x37')]['dateStart'];delete _0x14b13f[_0x0a9e('0x37')][_0x0a9e('0x38')];_0x567193[_0x0a9e('0x37')]=_['keys'](_0x14b13f[_0x0a9e('0x37')]);_0x567193[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x567193['model'],_0x567193['query']);_0x3f3d41[_0x0a9e('0x3b')]=_[_0x0a9e('0x3a')](_0x567193['model'],qs[_0x0a9e('0x3c')](_0x14b13f[_0x0a9e('0x37')][_0x0a9e('0x3c')]));_0x3f3d41[_0x0a9e('0x3b')]=_0x3f3d41['attributes']['length']?_0x3f3d41[_0x0a9e('0x3b')]:_0x567193[_0x0a9e('0x3d')];if(!_0x14b13f['query'][_0x0a9e('0x3e')](_0x0a9e('0x3f'))){_0x3f3d41[_0x0a9e('0x28')]=qs['limit'](_0x14b13f[_0x0a9e('0x37')][_0x0a9e('0x28')]);_0x3f3d41[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x14b13f[_0x0a9e('0x37')][_0x0a9e('0x27')]);}_0x3f3d41[_0x0a9e('0x40')]=qs[_0x0a9e('0x41')](_0x14b13f[_0x0a9e('0x37')][_0x0a9e('0x41')]);_0x3f3d41[_0x0a9e('0x42')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x43')](_0x14b13f[_0x0a9e('0x37')],_0x567193[_0x0a9e('0x39')]));if(_0x1e8694['dateStart']){if(_0x1e8694['dateEnd']){_0x1e8694[_0x0a9e('0x38')]=moment(_0x1e8694[_0x0a9e('0x38')])[_0x0a9e('0x44')](0x1,_0x0a9e('0x45'));}else{_0x1e8694[_0x0a9e('0x38')]=moment(_0x1e8694[_0x0a9e('0x36')])[_0x0a9e('0x44')](0x1,_0x0a9e('0x45'));}_[_0x0a9e('0x46')](_0x3f3d41[_0x0a9e('0x42')],{'createdAt':{'$gte':_0x1e8694[_0x0a9e('0x36')],'$lte':_0x1e8694[_0x0a9e('0x38')]}});}if(_0x14b13f['query'][_0x0a9e('0x47')]){_0x3f3d41[_0x0a9e('0x42')]=_[_0x0a9e('0x46')](_0x3f3d41[_0x0a9e('0x42')],{'$or':_[_0x0a9e('0x48')](_0x3f3d41[_0x0a9e('0x3b')],function(_0x21eb86){var _0x44dd99={};_0x44dd99[_0x21eb86]={'$like':'%'+_0x14b13f['query'][_0x0a9e('0x47')]+'%'};return _0x44dd99;})});}_0x3f3d41=_['merge']({},_0x3f3d41,_0x14b13f[_0x0a9e('0x49')]);var _0x476688={'where':_0x3f3d41[_0x0a9e('0x42')]};return db['SmsAccount'][_0x0a9e('0x26')](_0x476688)[_0x0a9e('0x2e')](function(_0x4774f4){_0x191e91[_0x0a9e('0x26')]=_0x4774f4;if(_0x14b13f[_0x0a9e('0x37')][_0x0a9e('0x4a')]){_0x3f3d41[_0x0a9e('0x4b')]=[{'all':!![]}];}return db['SmsAccount'][_0x0a9e('0x4c')](_0x3f3d41);})[_0x0a9e('0x2e')](function(_0x1b5e80){_0x191e91[_0x0a9e('0x4d')]=_0x1b5e80;return _0x191e91;})[_0x0a9e('0x2e')](respondWithFilteredResult(_0x2b7e7f,_0x3f3d41))[_0x0a9e('0x4e')](handleError(_0x2b7e7f,null));};exports[_0x0a9e('0x4f')]=function(_0x19383e,_0x34febd){var _0x58a5c2={'raw':![],'where':{'id':_0x19383e[_0x0a9e('0x50')]['id']}},_0xe401a={};_0xe401a['model']=_['keys'](db['SmsAccount'][_0x0a9e('0x35')]);_0xe401a[_0x0a9e('0x37')]=_[_0x0a9e('0x51')](_0x19383e[_0x0a9e('0x37')]);_0xe401a[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0xe401a[_0x0a9e('0x3d')],_0xe401a[_0x0a9e('0x37')]);_0x58a5c2['attributes']=_['intersection'](_0xe401a['model'],qs[_0x0a9e('0x3c')](_0x19383e[_0x0a9e('0x37')][_0x0a9e('0x3c')]));_0x58a5c2['attributes']=_0x58a5c2[_0x0a9e('0x3b')][_0x0a9e('0x52')]?_0x58a5c2['attributes']:_0xe401a['model'];if(_0x19383e[_0x0a9e('0x37')]['includeAll']){_0x58a5c2[_0x0a9e('0x4b')]=[{'all':!![]}];}_0x58a5c2=_['merge']({},_0x58a5c2,_0x19383e[_0x0a9e('0x49')]);return db[_0x0a9e('0x34')][_0x0a9e('0x53')](_0x58a5c2)['then'](handleEntityNotFound(_0x34febd,null))[_0x0a9e('0x2e')](respondWithResult(_0x34febd,null))[_0x0a9e('0x4e')](handleError(_0x34febd,null));};exports['create']=function(_0x50f687,_0x128aa6){return db[_0x0a9e('0x34')]['create'](_0x50f687[_0x0a9e('0x54')],{})['then'](respondWithResult(_0x128aa6,0xc9))[_0x0a9e('0x4e')](handleError(_0x128aa6,null));};exports['update']=function(_0xe22ccc,_0x4a6deb){if(_0xe22ccc['body']['id']){delete _0xe22ccc['body']['id'];}return db[_0x0a9e('0x34')]['find']({'where':{'id':_0xe22ccc[_0x0a9e('0x50')]['id']}})[_0x0a9e('0x2e')](handleEntityNotFound(_0x4a6deb,null))[_0x0a9e('0x2e')](saveUpdates(_0xe22ccc[_0x0a9e('0x54')],null))[_0x0a9e('0x2e')](respondWithResult(_0x4a6deb,null))[_0x0a9e('0x4e')](handleError(_0x4a6deb,null));};exports[_0x0a9e('0x2f')]=function(_0x28d814,_0x4e67ab){return db[_0x0a9e('0x34')][_0x0a9e('0x53')]({'where':{'id':_0x28d814[_0x0a9e('0x50')]['id']}})[_0x0a9e('0x2e')](handleEntityNotFound(_0x4e67ab,null))[_0x0a9e('0x2e')](removeEntity(_0x4e67ab,null))[_0x0a9e('0x4e')](handleError(_0x4e67ab,null));};exports['describe']=function(_0x956fbe,_0x26bc80){return db['SmsAccount'][_0x0a9e('0x55')]()['then'](respondWithResult(_0x26bc80,null))[_0x0a9e('0x4e')](handleError(_0x26bc80,null));};exports['addDisposition']=function(_0x4b3c1a,_0x5674ee,_0x273cb5){if(_0x4b3c1a['body']['id']){delete _0x4b3c1a[_0x0a9e('0x54')]['id'];}return db[_0x0a9e('0x34')][_0x0a9e('0x53')]({'where':{'id':_0x4b3c1a[_0x0a9e('0x50')]['id']}})[_0x0a9e('0x2e')](handleEntityNotFound(_0x5674ee,null))[_0x0a9e('0x2e')](function(_0x49eed0){if(_0x49eed0){_0x4b3c1a[_0x0a9e('0x54')]['SmsAccountId']=_0x49eed0['id'];return db[_0x0a9e('0x56')][_0x0a9e('0x57')](_0x4b3c1a[_0x0a9e('0x54')]);}})['then'](respondWithResult(_0x5674ee,null))[_0x0a9e('0x4e')](handleError(_0x5674ee,null));};exports[_0x0a9e('0x58')]=function(_0x119677,_0x32e134,_0x497d91){var _0x1d0dc8={'raw':![],'where':{}};var _0xe05a5a={};var _0x54327c={'count':0x0,'rows':[]};return db[_0x0a9e('0x34')][_0x0a9e('0x59')]({'where':{'id':_0x119677[_0x0a9e('0x50')]['id']}})[_0x0a9e('0x2e')](handleEntityNotFound(_0x32e134,null))[_0x0a9e('0x2e')](function(_0x4d4a35){if(_0x4d4a35){_0xe05a5a[_0x0a9e('0x3d')]=_[_0x0a9e('0x51')](db[_0x0a9e('0x56')]['rawAttributes']);_0xe05a5a[_0x0a9e('0x37')]=_['keys'](_0x119677['query']);_0xe05a5a[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0xe05a5a[_0x0a9e('0x3d')],_0xe05a5a[_0x0a9e('0x37')]);_0x1d0dc8[_0x0a9e('0x3b')]=_[_0x0a9e('0x3a')](_0xe05a5a[_0x0a9e('0x3d')],qs[_0x0a9e('0x3c')](_0x119677[_0x0a9e('0x37')][_0x0a9e('0x3c')]));_0x1d0dc8[_0x0a9e('0x3b')]=_0x1d0dc8[_0x0a9e('0x3b')][_0x0a9e('0x52')]?_0x1d0dc8[_0x0a9e('0x3b')]:_0xe05a5a[_0x0a9e('0x3d')];if(!_0x119677[_0x0a9e('0x37')][_0x0a9e('0x3e')](_0x0a9e('0x3f'))){_0x1d0dc8['limit']=qs[_0x0a9e('0x28')](_0x119677[_0x0a9e('0x37')][_0x0a9e('0x28')]);_0x1d0dc8['offset']=qs[_0x0a9e('0x27')](_0x119677[_0x0a9e('0x37')]['offset']);}_0x1d0dc8[_0x0a9e('0x40')]=qs[_0x0a9e('0x41')](_0x119677[_0x0a9e('0x37')][_0x0a9e('0x41')]);_0x1d0dc8[_0x0a9e('0x42')]=qs['filters'](_['pick'](_0x119677['query'],_0xe05a5a[_0x0a9e('0x39')]));_0x1d0dc8[_0x0a9e('0x42')][_0x0a9e('0x5a')]=_0x4d4a35['id'];if(_0x119677[_0x0a9e('0x37')][_0x0a9e('0x47')]){_0x1d0dc8[_0x0a9e('0x42')]=_[_0x0a9e('0x46')](_0x1d0dc8[_0x0a9e('0x42')],{'$or':_['map'](_0x1d0dc8[_0x0a9e('0x3b')],function(_0xcbc8b2){var _0x12ccdb={};_0x12ccdb[_0xcbc8b2]={'$like':'%'+_0x119677['query'][_0x0a9e('0x47')]+'%'};return _0x12ccdb;})});}_0x1d0dc8=_['merge']({},_0x1d0dc8,_0x119677[_0x0a9e('0x49')]);return db[_0x0a9e('0x56')]['count']({'where':_0x1d0dc8[_0x0a9e('0x42')]})[_0x0a9e('0x2e')](function(_0x2cc7a7){_0x54327c[_0x0a9e('0x26')]=_0x2cc7a7;if(_0x119677['query'][_0x0a9e('0x4a')]){_0x1d0dc8[_0x0a9e('0x4b')]=[{'all':!![]}];}return db[_0x0a9e('0x56')][_0x0a9e('0x4c')](_0x1d0dc8);})['then'](function(_0x109ccb){_0x54327c[_0x0a9e('0x4d')]=_0x109ccb;return _0x54327c;});}})[_0x0a9e('0x2e')](respondWithFilteredResult(_0x32e134,_0x1d0dc8))[_0x0a9e('0x4e')](handleError(_0x32e134,null));};exports['removeDispositions']=function(_0x290d43,_0x3511c9,_0x30a4c7){var _0xf410e5;return db[_0x0a9e('0x34')][_0x0a9e('0x53')]({'where':{'id':_0x290d43[_0x0a9e('0x50')]['id']}})[_0x0a9e('0x2e')](handleEntityNotFound(_0x3511c9,null))[_0x0a9e('0x2e')](function(_0x336dc3){if(_0x336dc3){return _0x336dc3[_0x0a9e('0x5b')](_0x290d43[_0x0a9e('0x37')][_0x0a9e('0x5c')]);}})[_0x0a9e('0x2e')](respondWithStatusCode(_0x3511c9,null))['catch'](handleError(_0x3511c9,null));};exports[_0x0a9e('0x5d')]=function(_0x11da9c,_0xc599b3,_0x563627){if(_0x11da9c[_0x0a9e('0x54')]['id']){delete _0x11da9c[_0x0a9e('0x54')]['id'];}return db[_0x0a9e('0x34')][_0x0a9e('0x53')]({'where':{'id':_0x11da9c['params']['id']}})['then'](handleEntityNotFound(_0xc599b3,null))[_0x0a9e('0x2e')](function(_0x2bbdb5){if(_0x2bbdb5){_0x11da9c['body'][_0x0a9e('0x5a')]=_0x2bbdb5['id'];return db['CannedAnswer'][_0x0a9e('0x57')](_0x11da9c[_0x0a9e('0x54')]);}})['then'](respondWithResult(_0xc599b3,null))[_0x0a9e('0x4e')](handleError(_0xc599b3,null));};exports[_0x0a9e('0x5e')]=function(_0x2d2286,_0x42b959,_0x3755fe){var _0x1f42a0={'raw':![],'where':{}};var _0x444f1f={};var _0x482ca2={'count':0x0,'rows':[]};return db[_0x0a9e('0x34')][_0x0a9e('0x59')]({'where':{'id':_0x2d2286[_0x0a9e('0x50')]['id']}})[_0x0a9e('0x2e')](handleEntityNotFound(_0x42b959,null))['then'](function(_0xf51744){if(_0xf51744){_0x444f1f[_0x0a9e('0x3d')]=_['keys'](db[_0x0a9e('0x5f')]['rawAttributes']);_0x444f1f[_0x0a9e('0x37')]=_[_0x0a9e('0x51')](_0x2d2286[_0x0a9e('0x37')]);_0x444f1f[_0x0a9e('0x39')]=_['intersection'](_0x444f1f['model'],_0x444f1f[_0x0a9e('0x37')]);_0x1f42a0[_0x0a9e('0x3b')]=_[_0x0a9e('0x3a')](_0x444f1f['model'],qs[_0x0a9e('0x3c')](_0x2d2286[_0x0a9e('0x37')]['fields']));_0x1f42a0['attributes']=_0x1f42a0[_0x0a9e('0x3b')]['length']?_0x1f42a0['attributes']:_0x444f1f['model'];if(!_0x2d2286[_0x0a9e('0x37')][_0x0a9e('0x3e')](_0x0a9e('0x3f'))){_0x1f42a0[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x2d2286[_0x0a9e('0x37')]['limit']);_0x1f42a0[_0x0a9e('0x27')]=qs['offset'](_0x2d2286[_0x0a9e('0x37')][_0x0a9e('0x27')]);}_0x1f42a0[_0x0a9e('0x40')]=qs[_0x0a9e('0x41')](_0x2d2286['query'][_0x0a9e('0x41')]);_0x1f42a0[_0x0a9e('0x42')]=qs[_0x0a9e('0x39')](_['pick'](_0x2d2286[_0x0a9e('0x37')],_0x444f1f[_0x0a9e('0x39')]));_0x1f42a0[_0x0a9e('0x42')][_0x0a9e('0x5a')]=_0xf51744['id'];if(_0x2d2286[_0x0a9e('0x37')][_0x0a9e('0x47')]){_0x1f42a0[_0x0a9e('0x42')]=_[_0x0a9e('0x46')](_0x1f42a0['where'],{'$or':_[_0x0a9e('0x48')](_0x1f42a0[_0x0a9e('0x3b')],function(_0x589ff3){var _0x40e0f0={};_0x40e0f0[_0x589ff3]={'$like':'%'+_0x2d2286[_0x0a9e('0x37')][_0x0a9e('0x47')]+'%'};return _0x40e0f0;})});}_0x1f42a0=_['merge']({},_0x1f42a0,_0x2d2286[_0x0a9e('0x49')]);return db['CannedAnswer'][_0x0a9e('0x26')]({'where':_0x1f42a0[_0x0a9e('0x42')]})[_0x0a9e('0x2e')](function(_0x1f29bd){_0x482ca2[_0x0a9e('0x26')]=_0x1f29bd;if(_0x2d2286[_0x0a9e('0x37')][_0x0a9e('0x4a')]){_0x1f42a0[_0x0a9e('0x4b')]=[{'all':!![]}];}return db['CannedAnswer'][_0x0a9e('0x4c')](_0x1f42a0);})[_0x0a9e('0x2e')](function(_0x17f692){_0x482ca2[_0x0a9e('0x4d')]=_0x17f692;return _0x482ca2;});}})[_0x0a9e('0x2e')](respondWithFilteredResult(_0x42b959,_0x1f42a0))[_0x0a9e('0x4e')](handleError(_0x42b959,null));};exports[_0x0a9e('0x60')]=function(_0x33f0c9,_0x1808ba,_0x31af8c){var _0x151956;return db[_0x0a9e('0x34')][_0x0a9e('0x53')]({'where':{'id':_0x33f0c9['params']['id']}})[_0x0a9e('0x2e')](handleEntityNotFound(_0x1808ba,null))[_0x0a9e('0x2e')](function(_0x12843d){if(_0x12843d){return _0x12843d[_0x0a9e('0x60')](_0x33f0c9[_0x0a9e('0x37')]['ids']);}})[_0x0a9e('0x2e')](respondWithStatusCode(_0x1808ba,null))[_0x0a9e('0x4e')](handleError(_0x1808ba,null));};exports['notify']=function(_0x23b447,_0x5e725e,_0x45d113){var _0x27041d={'channel':_0x0a9e('0x61')};var _0xf8c6c4=[];var _0x4f4d2d=[];var _0x3ceba6={};return db['SmsAccount'][_0x0a9e('0x53')]({'where':{'id':_0x23b447[_0x0a9e('0x50')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x0a9e('0x62')}]})[_0x0a9e('0x2e')](handleEntityNotFound(_0x5e725e,null))[_0x0a9e('0x2e')](function(_0x4ab276){_0x27041d['account']=_0x4ab276;_0x27041d[_0x0a9e('0x63')]=_[_0x0a9e('0x64')](_0x4ab276[_0x0a9e('0x62')],[_0x0a9e('0x65')],[_0x0a9e('0x66')]);if(_0x27041d[_0x0a9e('0x67')][_0x0a9e('0x62')]){delete _0x27041d[_0x0a9e('0x67')][_0x0a9e('0x62')];}return db['CmContact'][_0x0a9e('0x55')]();})['then'](function(_0x287324){if(!_0x287324){throw new db[(_0x0a9e('0x68'))][(_0x0a9e('0x69'))](_0x0a9e('0x6a'));}_0xf8c6c4=_[_0x0a9e('0x6b')](_['keys'](_0x287324),[_0x0a9e('0x6c'),_0x0a9e('0x6d')]);_0x4f4d2d=_[_0x0a9e('0x6b')](_[_0x0a9e('0x51')](_0x287324),[_0x0a9e('0x6c'),'updatedAt','CompanyId',_0x0a9e('0x6e')]);_0x27041d['body']={'mapKey':_0x0a9e('0x6f')};if(_0x27041d[_0x0a9e('0x67')][_0x0a9e('0x70')]){switch(_0x27041d[_0x0a9e('0x67')][_0x0a9e('0x70')]){case _0x0a9e('0x71'):_0x27041d['body']['from']=_0x23b447[_0x0a9e('0x54')]['From'];_0x27041d[_0x0a9e('0x54')]['body']=_0x23b447[_0x0a9e('0x54')]['Body'];_0x27041d['body'][_0x0a9e('0x72')]=_0x23b447[_0x0a9e('0x54')]['MessageSid'];break;case _0x0a9e('0x73'):_0x27041d[_0x0a9e('0x54')][_0x0a9e('0x74')]='+'+_0x23b447[_0x0a9e('0x54')][_0x0a9e('0x75')];_0x27041d['body']['body']=_0x23b447[_0x0a9e('0x54')][_0x0a9e('0x76')];break;case _0x0a9e('0x77'):_0x27041d[_0x0a9e('0x54')][_0x0a9e('0x74')]=_0x23b447['body'][_0x0a9e('0x74')];_0x27041d[_0x0a9e('0x54')]['body']=_0x23b447[_0x0a9e('0x54')][_0x0a9e('0x22')];break;case _0x0a9e('0x78'):_0x27041d[_0x0a9e('0x54')][_0x0a9e('0x74')]=_0x23b447[_0x0a9e('0x54')][_0x0a9e('0x74')];_0x27041d[_0x0a9e('0x54')][_0x0a9e('0x54')]=_0x23b447[_0x0a9e('0x54')]['body'];_0x27041d[_0x0a9e('0x54')][_0x0a9e('0x72')]=_0x23b447[_0x0a9e('0x54')][_0x0a9e('0x79')];break;case _0x0a9e('0x7a'):_0x27041d['body']['from']=_0x23b447[_0x0a9e('0x54')][_0x0a9e('0x7b')];_0x27041d[_0x0a9e('0x54')][_0x0a9e('0x54')]=_0x23b447[_0x0a9e('0x54')]['Text'];_0x27041d[_0x0a9e('0x54')][_0x0a9e('0x72')]=_0x23b447[_0x0a9e('0x54')]['MessageUUID'];break;case _0x0a9e('0x7c'):_0x27041d['body'][_0x0a9e('0x74')]='+'+_0x23b447['body'][_0x0a9e('0x7d')][0x0][_0x0a9e('0x74')];_0x27041d[_0x0a9e('0x54')]['body']=_0x23b447[_0x0a9e('0x54')]['results'][0x0][_0x0a9e('0x76')];_0x27041d[_0x0a9e('0x54')][_0x0a9e('0x72')]=_0x23b447[_0x0a9e('0x54')][_0x0a9e('0x7d')][0x0][_0x0a9e('0x72')];break;case _0x0a9e('0x7e'):_0x27041d[_0x0a9e('0x54')][_0x0a9e('0x74')]=_0x23b447[_0x0a9e('0x54')][_0x0a9e('0x7f')];_0x27041d[_0x0a9e('0x54')][_0x0a9e('0x54')]=_0x23b447[_0x0a9e('0x54')][_0x0a9e('0x80')][_0x0a9e('0x22')];break;case'clickatell':_0x27041d['body'][_0x0a9e('0x74')]=_0x23b447['body'][_0x0a9e('0x81')];_0x27041d[_0x0a9e('0x54')]['body']=_0x23b447[_0x0a9e('0x54')][_0x0a9e('0x76')];_0x27041d[_0x0a9e('0x54')][_0x0a9e('0x72')]=_0x23b447['body'][_0x0a9e('0x82')];break;}}if(_0x27041d[_0x0a9e('0x54')]['id']){delete _0x27041d[_0x0a9e('0x54')]['id'];}if(_[_0x0a9e('0x83')](_0x27041d['body'][_0x0a9e('0x74')])){throw new db[(_0x0a9e('0x68'))][(_0x0a9e('0x69'))]('from\x20is\x20mandatory');}if(_[_0x0a9e('0x83')](_0x27041d[_0x0a9e('0x54')][_0x0a9e('0x54')])||_0x27041d['body'][_0x0a9e('0x54')]===''){throw new db[(_0x0a9e('0x68'))][(_0x0a9e('0x69'))](_0x0a9e('0x84'));}if(_[_0x0a9e('0x83')](_0x27041d['body'][_0x0a9e('0x85')])){throw new db[(_0x0a9e('0x68'))]['ValidationError'](_0x0a9e('0x86')+_0x4f4d2d);}if(!_[_0x0a9e('0x87')](_0x4f4d2d,_0x27041d[_0x0a9e('0x54')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x0a9e('0x88')+_0x4f4d2d);}_0x3ceba6[_0x27041d[_0x0a9e('0x54')]['mapKey']]=_0x27041d[_0x0a9e('0x54')][_0x0a9e('0x74')];return db[_0x0a9e('0x89')]['find']({'where':{'id':_0x27041d[_0x0a9e('0x67')][_0x0a9e('0x6e')]},'include':[{'model':db[_0x0a9e('0x8a')],'as':_0x0a9e('0x8b'),'where':_0x3ceba6,'limit':0x1,'order':[[_0x0a9e('0x6d'),_0x0a9e('0x8c')]]}]});})[_0x0a9e('0x2e')](handleEntityNotFound(_0x5e725e,null))[_0x0a9e('0x2e')](function(_0x3b5bda){if(_0x3b5bda){_0x27041d['list']=_[_0x0a9e('0x8d')](_0x3b5bda,['Contacts']);if(_0x3b5bda[_0x0a9e('0x8b')][_0x0a9e('0x52')]){return _0x3b5bda[_0x0a9e('0x8b')][0x0];}var _0x3cf222=_[_0x0a9e('0x8e')](_0x27041d[_0x0a9e('0x54')],{'firstName':_0x27041d['body'][_0x0a9e('0x74')],'ListId':_0x3b5bda['id']});_0x3cf222[_0x27041d[_0x0a9e('0x54')][_0x0a9e('0x85')]]=_0x27041d[_0x0a9e('0x54')]['from'];return db[_0x0a9e('0x8a')][_0x0a9e('0x57')](_0x3cf222,{'fields':_0xf8c6c4,'raw':!![]});}})[_0x0a9e('0x2e')](handleEntityNotFound(_0x5e725e,null))[_0x0a9e('0x2e')](function(_0xc2e7b){if(_0xc2e7b){_0x27041d[_0x0a9e('0x8f')]=_0xc2e7b;var _0x238c24={'ContactId':_0xc2e7b['id'],'phone':_0x27041d[_0x0a9e('0x54')][_0x0a9e('0x74')],'SmsAccountId':_0x23b447[_0x0a9e('0x50')]['id']};var _0x57f0ad={'ContactId':_0xc2e7b['id'],'SmsAccountId':_0x23b447[_0x0a9e('0x50')]['id'],'closed':![]};return db[_0x0a9e('0x90')][_0x0a9e('0x53')]({'where':_0x57f0ad})[_0x0a9e('0x2e')](function(_0xea8bd1){if(_0xea8bd1){return[_0xea8bd1,![]];}return db[_0x0a9e('0x90')][_0x0a9e('0x57')](_0x238c24)[_0x0a9e('0x2e')](function(_0x566b90){return[_0x566b90,!![]];});});}})[_0x0a9e('0x91')](function(_0xd2391,_0x1a9ef1){_0x27041d['interaction']=_0xd2391[_0x0a9e('0x92')]({'plain':!![]});_0x27041d[_0x0a9e('0x93')][_0x0a9e('0x94')]=![];if(_0x1a9ef1){if(_0x27041d[_0x0a9e('0x67')][_0x0a9e('0x95')]){_0x27041d[_0x0a9e('0x63')][_0x0a9e('0x96')]({'id':0x0,'priority':_0x27041d[_0x0a9e('0x63')][_0x0a9e('0x52')]+0x1,'app':_0x0a9e('0x97'),'appdata':'unmanaged','interval':_0x0a9e('0x98')});}_0x27041d[_0x0a9e('0x93')][_0x0a9e('0x94')]=!![];}return db[_0x0a9e('0x99')][_0x0a9e('0x57')]({'phone':_0x27041d[_0x0a9e('0x54')]['from'],'messageId':_0x27041d[_0x0a9e('0x54')]['messageId'],'body':_0x27041d['body']['body'],'SmsAccountId':_0x23b447[_0x0a9e('0x50')]['id'],'SmsInteractionId':_0xd2391['id'],'direction':'in','ContactId':_0xd2391[_0x0a9e('0x9a')],'AttachmentId':_0x27041d[_0x0a9e('0x54')][_0x0a9e('0x9b')]});})['then'](function(_0x4156a5){_0x27041d[_0x0a9e('0x22')]=_0x4156a5;if(_0x27041d[_0x0a9e('0x93')][_0x0a9e('0x9c')]){return db[_0x0a9e('0x9d')]['find']({'attributes':['id','name'],'where':{'id':_0x27041d[_0x0a9e('0x93')][_0x0a9e('0x9c')]}})[_0x0a9e('0x2e')](function(_0x5e85d0){if(_0x5e85d0){_0x27041d[_0x0a9e('0x63')][_0x0a9e('0x9e')]({'id':0x0,'priority':0x0,'app':_0x0a9e('0x9f'),'appdata':_0x5e85d0['name']+','+(_0x27041d[_0x0a9e('0x67')][_0x0a9e('0xa0')]||0xa),'interval':_0x0a9e('0x98')});}return respondWithRpcPromise('Start',_0x0a9e('0xa1'),_0x27041d);});}return respondWithRpcPromise(_0x0a9e('0xa2'),_0x0a9e('0xa1'),_0x27041d);})['then'](function(_0x549697){if(_0x549697){var _0x53ef46=0xc8;var _0x3b04fd=_0x0a9e('0xa3');logger[_0x0a9e('0x1b')](_0x0a9e('0x1d'),_0x3b04fd,_0x53ef46,'entity\x20found');logger[_0x0a9e('0xa4')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x3b04fd,_0x53ef46,_0x0a9e('0xa5'),JSON[_0x0a9e('0x1e')](_0x549697));if(_0x27041d[_0x0a9e('0x67')]['type']===_0x0a9e('0x71')){return _0x5e725e[_0x0a9e('0x25')](_0x53ef46)[_0x0a9e('0xa6')]('Content-Type',_0x0a9e('0xa7'))['send'](_0x0a9e('0xa8'));}else{return _0x5e725e['status'](_0x53ef46)[_0x0a9e('0x2a')](_0x549697);}}})['catch'](handleError(_0x5e725e,null));};exports[_0x0a9e('0xa9')]=function(_0x37215d,_0xa288e4,_0x10ace8){return db[_0x0a9e('0x34')][_0x0a9e('0x59')]({'where':{'id':_0x37215d[_0x0a9e('0x50')]['id']}})['then'](handleEntityNotFound(_0xa288e4,null))[_0x0a9e('0x2e')](function(_0x1c9ea2){if(_0x1c9ea2){return db['sequelize'][_0x0a9e('0xaa')](function(_0x3753ca){return db['SmsApplication'][_0x0a9e('0x2f')]({'where':{'SmsAccountId':_0x37215d[_0x0a9e('0x50')]['id']},'transaction':_0x3753ca})[_0x0a9e('0x2e')](function(_0x569528){var _0x3766d7=_[_0x0a9e('0x48')](_0x37215d[_0x0a9e('0x54')],function(_0x3f0d64){_0x3f0d64[_0x0a9e('0x5a')]=_0x37215d[_0x0a9e('0x50')]['id'];return _0x3f0d64;});return db[_0x0a9e('0xab')][_0x0a9e('0xac')](_0x3766d7,{'transaction':_0x3753ca});});})[_0x0a9e('0x2e')](function(){return db[_0x0a9e('0xab')]['findAndCountAll']({'where':{'SmsAccountId':_0x37215d[_0x0a9e('0x50')]['id']},'order':'priority'});});}})[_0x0a9e('0x2e')](respondWithResult(_0xa288e4,null))[_0x0a9e('0x4e')](handleError(_0xa288e4,null));};exports[_0x0a9e('0xad')]=function(_0x315e31,_0x5d577b,_0x2d45db){var _0x5691ac={};var _0x119708={};var _0x469035;var _0x2977a7;return db['SmsAccount'][_0x0a9e('0x59')]({'where':{'id':_0x315e31[_0x0a9e('0x50')]['id']}})[_0x0a9e('0x2e')](handleEntityNotFound(_0x5d577b,null))[_0x0a9e('0x2e')](function(_0x31e1e0){if(_0x31e1e0){_0x469035=_0x31e1e0;_0x119708[_0x0a9e('0x3d')]=_[_0x0a9e('0x51')](db['SmsApplication'][_0x0a9e('0x35')]);_0x119708[_0x0a9e('0x37')]=_[_0x0a9e('0x51')](_0x315e31[_0x0a9e('0x37')]);_0x119708[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x119708[_0x0a9e('0x3d')],_0x119708['query']);_0x5691ac['attributes']=_[_0x0a9e('0x3a')](_0x119708[_0x0a9e('0x3d')],qs[_0x0a9e('0x3c')](_0x315e31[_0x0a9e('0x37')][_0x0a9e('0x3c')]));_0x5691ac[_0x0a9e('0x3b')]=_0x5691ac[_0x0a9e('0x3b')]['length']?_0x5691ac[_0x0a9e('0x3b')]:_0x119708[_0x0a9e('0x3d')];_0x5691ac[_0x0a9e('0x40')]=qs[_0x0a9e('0x41')](_0x315e31[_0x0a9e('0x37')][_0x0a9e('0x41')]);_0x5691ac[_0x0a9e('0x42')]=qs['filters'](_[_0x0a9e('0x43')](_0x315e31[_0x0a9e('0x37')],_0x119708[_0x0a9e('0x39')]));if(_0x315e31['query'][_0x0a9e('0x47')]){_0x5691ac[_0x0a9e('0x42')]=_[_0x0a9e('0x46')](_0x5691ac[_0x0a9e('0x42')],{'$or':_['map'](_0x5691ac[_0x0a9e('0x3b')],function(_0xcbbea0){var _0x21d082={};_0x21d082[_0xcbbea0]={'$like':'%'+_0x315e31[_0x0a9e('0x37')][_0x0a9e('0x47')]+'%'};return _0x21d082;})});}_0x5691ac=_[_0x0a9e('0x46')]({},_0x5691ac,_0x315e31[_0x0a9e('0x49')]);return _0x469035[_0x0a9e('0xad')](_0x5691ac);}})['then'](function(_0x3ede01){if(_0x3ede01){_0x2977a7=_0x3ede01[_0x0a9e('0x52')];if(!_0x315e31[_0x0a9e('0x37')][_0x0a9e('0x3e')]('nolimit')){_0x5691ac['limit']=qs[_0x0a9e('0x28')](_0x315e31[_0x0a9e('0x37')][_0x0a9e('0x28')]);_0x5691ac['offset']=qs[_0x0a9e('0x27')](_0x315e31[_0x0a9e('0x37')]['offset']);}return _0x469035[_0x0a9e('0xad')](_0x5691ac);}})['then'](function(_0x35cc2a){if(_0x35cc2a){return _0x35cc2a?{'count':_0x2977a7,'rows':_0x35cc2a}:null;}})['then'](respondWithResult(_0x5d577b,null))['catch'](handleError(_0x5d577b,null));};exports['getInteractions']=function(_0xad4d10,_0x4297d1,_0x19f800){var _0x20007e={'raw':![],'where':{}};var _0x7d59a9={};var _0xe17af8={'count':0x0,'rows':[]};return db['SmsAccount'][_0x0a9e('0x59')]({'where':{'id':_0xad4d10[_0x0a9e('0x50')]['id']}})[_0x0a9e('0x2e')](handleEntityNotFound(_0x4297d1,null))[_0x0a9e('0x2e')](function(_0x293b22){if(_0x293b22){_0x7d59a9[_0x0a9e('0x3d')]=_[_0x0a9e('0x51')](db['SmsInteraction']['rawAttributes']);_0x7d59a9[_0x0a9e('0x37')]=_['keys'](_0xad4d10[_0x0a9e('0x37')]);_0x7d59a9[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x7d59a9[_0x0a9e('0x3d')],_0x7d59a9[_0x0a9e('0x37')]);_0x20007e[_0x0a9e('0x3b')]=_['intersection'](_0x7d59a9[_0x0a9e('0x3d')],qs['fields'](_0xad4d10['query'][_0x0a9e('0x3c')]));_0x20007e['attributes']=_0x20007e[_0x0a9e('0x3b')]['length']?_0x20007e['attributes']:_0x7d59a9[_0x0a9e('0x3d')];if(!_0xad4d10['query'][_0x0a9e('0x3e')](_0x0a9e('0x3f'))){_0x20007e[_0x0a9e('0x28')]=qs['limit'](_0xad4d10[_0x0a9e('0x37')][_0x0a9e('0x28')]);_0x20007e[_0x0a9e('0x27')]=qs['offset'](_0xad4d10['query'][_0x0a9e('0x27')]);}_0x20007e[_0x0a9e('0x40')]=qs[_0x0a9e('0x41')](_0xad4d10[_0x0a9e('0x37')][_0x0a9e('0x41')]);_0x20007e[_0x0a9e('0x42')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x43')](_0xad4d10[_0x0a9e('0x37')],_0x7d59a9[_0x0a9e('0x39')]));_0x20007e['where']['SmsAccountId']=_0x293b22['id'];if(_0xad4d10['query'][_0x0a9e('0x47')]){_0x20007e[_0x0a9e('0x42')]=_[_0x0a9e('0x46')](_0x20007e[_0x0a9e('0x42')],{'$or':_[_0x0a9e('0x48')](_0x20007e[_0x0a9e('0x3b')],function(_0x2b97fc){var _0x307d13={};_0x307d13[_0x2b97fc]={'$like':'%'+_0xad4d10['query']['filter']+'%'};return _0x307d13;})});}_0x20007e=_[_0x0a9e('0x46')]({},_0x20007e,_0xad4d10[_0x0a9e('0x49')]);return db['SmsInteraction'][_0x0a9e('0x26')]({'where':_0x20007e[_0x0a9e('0x42')]})[_0x0a9e('0x2e')](function(_0x19e024){_0xe17af8[_0x0a9e('0x26')]=_0x19e024;if(_0xad4d10[_0x0a9e('0x37')][_0x0a9e('0x4a')]){_0x20007e[_0x0a9e('0x4b')]=[{'model':db[_0x0a9e('0x8a')],'as':_0x0a9e('0xae'),'required':![]},{'model':db[_0x0a9e('0x9d')],'as':_0x0a9e('0xaf'),'attributes':['name',_0x0a9e('0xb0'),_0x0a9e('0xb1')],'required':![]},{'model':db[_0x0a9e('0xb2')],'as':_0x0a9e('0xb3'),'attributes':['id',_0x0a9e('0x32'),_0x0a9e('0xb4')],'where':_0xad4d10[_0x0a9e('0x37')][_0x0a9e('0xb5')]?{'id':_0xad4d10[_0x0a9e('0x37')][_0x0a9e('0xb5')]}:undefined,'required':_0xad4d10[_0x0a9e('0x37')][_0x0a9e('0xb5')]?!![]:![]}];}return db['SmsInteraction']['findAll'](_0x20007e);})[_0x0a9e('0x2e')](function(_0x401207){_0xe17af8[_0x0a9e('0x4d')]=_0x401207;return _0xe17af8;});}})[_0x0a9e('0x2e')](respondWithFilteredResult(_0x4297d1,_0x20007e))[_0x0a9e('0x4e')](handleError(_0x4297d1,null));};exports[_0x0a9e('0xb6')]=function(_0xa8b5de,_0x4f7907,_0x26a204){var _0x49fd0e,_0x26aa44,_0x1ad1d7;if(_[_0x0a9e('0x83')](_0xa8b5de[_0x0a9e('0x54')][_0x0a9e('0x54')])||_0xa8b5de[_0x0a9e('0x54')][_0x0a9e('0x54')]===''){throw new db[(_0x0a9e('0x68'))][(_0x0a9e('0x69'))](_0x0a9e('0x84'));}if(_[_0x0a9e('0x83')](_0xa8b5de[_0x0a9e('0x54')]['to'])){throw new db[(_0x0a9e('0x68'))][(_0x0a9e('0x69'))](_0x0a9e('0xb7'));}_0x49fd0e=_0xa8b5de[_0x0a9e('0x54')]['to'];return db['SmsAccount']['find']({'where':{'id':_0xa8b5de[_0x0a9e('0x50')]['id']},'include':[{'model':db[_0x0a9e('0x89')],'as':'List','include':[{'model':db['CmContact'],'as':_0x0a9e('0x8b'),'where':{'mobile':_0x49fd0e},'limit':0x1,'order':[[_0x0a9e('0x6d'),_0x0a9e('0x8c')]]}]}]})['then'](handleEntityNotFound(_0x4f7907,null))[_0x0a9e('0x2e')](function(_0x5b6447){if(_0x5b6447&&_0x5b6447[_0x0a9e('0xb8')]){_0x26aa44=_0x5b6447['get']({'plain':!![]});if(_0x26aa44[_0x0a9e('0xb8')]&&_0x26aa44['List'][_0x0a9e('0x8b')][_0x0a9e('0x52')]){return _0x26aa44[_0x0a9e('0xb8')]['Contacts'][0x0];}return db[_0x0a9e('0x8a')]['create'](_['defaults'](_0xa8b5de[_0x0a9e('0x54')],{'firstName':_0x49fd0e,'mobile':_0x49fd0e,'phone':_0x49fd0e,'ListId':_0x26aa44[_0x0a9e('0x6e')]}));}})[_0x0a9e('0x2e')](handleEntityNotFound(_0x4f7907,null))[_0x0a9e('0x2e')](function(_0x1d51fd){if(_0x1d51fd){_0x1ad1d7=_0x1d51fd;return db[_0x0a9e('0x90')][_0x0a9e('0x53')]({'where':{'ContactId':_0x1ad1d7['id'],'closed':![],'SmsAccountId':_0x26aa44['id']}})[_0x0a9e('0x2e')](function(_0x1a3143){if(_0x1a3143){return[_0x1a3143,![]];}return db[_0x0a9e('0x90')][_0x0a9e('0x57')]({'UserId':_0xa8b5de[_0x0a9e('0xb9')]['id'],'ContactId':_0x1ad1d7['id'],'SmsAccountId':_0x26aa44['id'],'phone':_0x49fd0e,'firstMsgDirection':_0x0a9e('0xba'),'Messages':[_[_0x0a9e('0x46')](_0xa8b5de[_0x0a9e('0x54')],{'read':![],'body':_0xa8b5de[_0x0a9e('0x54')][_0x0a9e('0x54')],'phone':_0x49fd0e,'SmsAccountId':_0x26aa44['id'],'UserId':_0xa8b5de[_0x0a9e('0xb9')]['id'],'ContactId':_0x1ad1d7['id']})]},{'include':[{'model':db[_0x0a9e('0x99')],'as':'Messages'}]})[_0x0a9e('0x2e')](function(_0xf780f5){return[_0xf780f5,!![]];});});}})[_0x0a9e('0x91')](function(_0x356132,_0x56e63d){if(_0x56e63d){return _0x356132;}return db['SmsMessage']['create'](_[_0x0a9e('0x46')](_0xa8b5de['body'],{'read':![],'body':_0xa8b5de[_0x0a9e('0x54')][_0x0a9e('0x54')],'phone':_0x49fd0e,'SmsAccountId':_0x26aa44['id'],'SmsInteractionId':_0x356132['id'],'UserId':_0xa8b5de[_0x0a9e('0xb9')]['id'],'ContactId':_0x1ad1d7['id']}))[_0x0a9e('0x2e')](function(_0x294c49){_0x356132[_0x0a9e('0xbb')][_0x0a9e('0xbc')]=[];_0x356132[_0x0a9e('0xbb')][_0x0a9e('0xbc')][_0x0a9e('0x96')](_0x294c49['dataValues']);return _0x356132;});})[_0x0a9e('0x2e')](respondWithResult(_0x4f7907,null))['catch'](handleError(_0x4f7907,null));};exports[_0x0a9e('0x25')]=function(_0x586d2f,_0xf4de86,_0x2c5385){if(_0x586d2f[_0x0a9e('0x54')]['id']){delete _0x586d2f['body']['id'];}console[_0x0a9e('0xbd')](_0x0a9e('0xbe'),_0x586d2f['body']);var _0x53c4f0,_0x3fab79,_0x41e19e;return db[_0x0a9e('0x34')]['find']({'where':{'id':_0x586d2f['params']['id']}})['then'](handleEntityNotFound(_0xf4de86,null))[_0x0a9e('0x2e')](function(_0x22c591){if(_0x22c591){_0x41e19e=_0x22c591;logger[_0x0a9e('0xa4')](_0x0a9e('0x1d'),_0x0a9e('0x25'),_0x0a9e('0xbf'),_0x22c591[_0x0a9e('0x70')],util[_0x0a9e('0xc0')](_0x586d2f[_0x0a9e('0x54')],{'showHidden':![],'depth':null}));switch(_0x22c591[_0x0a9e('0x70')]){case _0x0a9e('0x73'):if(_0x586d2f[_0x0a9e('0x54')][_0x0a9e('0xc1')]&&_0x586d2f[_0x0a9e('0x54')][_0x0a9e('0x25')]){_0x3fab79=_0x586d2f[_0x0a9e('0x54')][_0x0a9e('0x25')];return db[_0x0a9e('0x99')]['find']({'where':{'messageId':_0x586d2f[_0x0a9e('0x54')][_0x0a9e('0xc1')]}});}break;case _0x0a9e('0x77'):if(_0x586d2f[_0x0a9e('0x54')][_0x0a9e('0xc2')]&&_0x586d2f[_0x0a9e('0x54')]['statusInt']){_0x3fab79=_0x586d2f[_0x0a9e('0x54')][_0x0a9e('0xc3')];return db[_0x0a9e('0x99')][_0x0a9e('0x53')]({'where':{'messageId':_0x586d2f[_0x0a9e('0x54')][_0x0a9e('0xc2')]}});}break;case _0x0a9e('0x78'):if(_0x586d2f[_0x0a9e('0x54')][_0x0a9e('0x79')]&&_0x586d2f['body']['status_code']){_0x3fab79=_0x586d2f[_0x0a9e('0x54')][_0x0a9e('0xc4')];return db['SmsMessage'][_0x0a9e('0x53')]({'where':{'messageId':_0x586d2f[_0x0a9e('0x54')]['message_id']}});}break;case _0x0a9e('0x7c'):var _0x4fc371=_0x586d2f[_0x0a9e('0x54')][_0x0a9e('0x7d')][0x0];if(_0x4fc371['messageId']&&_0x4fc371[_0x0a9e('0x25')][_0x0a9e('0xc5')]==='DELIVERED'){_0x3fab79=_0x4fc371[_0x0a9e('0x25')][_0x0a9e('0xc5')];return db['SmsMessage'][_0x0a9e('0x53')]({'where':{'messageId':_0x4fc371[_0x0a9e('0x72')]}});}break;case _0x0a9e('0xc6'):if(_0x586d2f[_0x0a9e('0x54')][_0x0a9e('0x72')]&&_0x586d2f[_0x0a9e('0x54')]['status']){_0x3fab79=_0x586d2f[_0x0a9e('0x54')][_0x0a9e('0x25')];return db['SmsMessage'][_0x0a9e('0x53')]({'where':{'messageId':_0x586d2f[_0x0a9e('0x54')][_0x0a9e('0x72')]}});}break;}}})[_0x0a9e('0x2e')](handleEntityNotFound(_0xf4de86,null))[_0x0a9e('0x2e')](function(_0x200f3e){if(_0x200f3e){_0x53c4f0=_0x200f3e;switch(_0x41e19e[_0x0a9e('0x70')]){case'skebby':if(_0x3fab79==='DELIVERED'){return _0x53c4f0['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0a9e('0x25'),_0x0a9e('0x73'),util['inspect'](_0x586d2f['body'],{'showHidden':![],'depth':null}));}break;case _0x0a9e('0x77'):if(_0x3fab79==='1'){return _0x53c4f0['update']({'read':!![]});}else{logger[_0x0a9e('0x1f')](_0x0a9e('0x1d'),_0x0a9e('0x25'),_0x0a9e('0x73'),util[_0x0a9e('0xc0')](_0x586d2f[_0x0a9e('0x54')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x586d2f[_0x0a9e('0x54')][_0x0a9e('0xc7')]&&_0x3fab79>=0xc8&&_0x3fab79<=0xce){return _0x53c4f0['update']({'read':!![]});}else{logger[_0x0a9e('0x1f')](_0x0a9e('0x1d'),_0x0a9e('0x25'),_0x0a9e('0x78'),util[_0x0a9e('0xc0')](_0x586d2f[_0x0a9e('0x54')],{'showHidden':![],'depth':null}));}break;case _0x0a9e('0x7c'):var _0x4a36df=_0x586d2f[_0x0a9e('0x54')]['results'][0x0];if(_0x4a36df[_0x0a9e('0x25')][_0x0a9e('0xc5')]==='DELIVERED'){return _0x53c4f0[_0x0a9e('0x2d')]({'read':!![]});}else{logger[_0x0a9e('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0a9e('0x25'),'infobip',util[_0x0a9e('0xc0')](_0x586d2f[_0x0a9e('0x54')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x3fab79==_0x0a9e('0xc8')||_0x3fab79=='RECEIVED_BY_RECIPIENT'){return _0x53c4f0[_0x0a9e('0x2d')]({'read':!![]});}else{logger[_0x0a9e('0x1f')](_0x0a9e('0x1d'),_0x0a9e('0x25'),_0x0a9e('0xc6'),util[_0x0a9e('0xc0')](_0x586d2f[_0x0a9e('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x53c4f0;}})['then'](respondWithResult(_0xf4de86,null))[_0x0a9e('0x4e')](handleError(_0xf4de86,null));};exports[_0x0a9e('0xc9')]=function(_0x17854b,_0x1b1971,_0x38e256){var _0x5932ad,_0xb376ed,_0x49a6b2;return db['SmsAccount'][_0x0a9e('0x53')]({'where':{'id':_0x17854b['params']['id']}})[_0x0a9e('0x2e')](handleEntityNotFound(_0x1b1971,null))[_0x0a9e('0x2e')](function(_0x58d5fd){if(_0x58d5fd){_0x49a6b2=_0x58d5fd;logger[_0x0a9e('0xa4')](_0x0a9e('0x1d'),_0x0a9e('0x25'),_0x0a9e('0xbf'),_0x58d5fd[_0x0a9e('0x70')],util[_0x0a9e('0xc0')](_0x17854b[_0x0a9e('0x37')],{'showHidden':![],'depth':null}));switch(_0x58d5fd[_0x0a9e('0x70')]){case _0x0a9e('0x7e'):if(_0x17854b['query'][_0x0a9e('0xca')]&&_0x17854b[_0x0a9e('0x37')][_0x0a9e('0xcb')]){_0xb376ed=_0x17854b[_0x0a9e('0x37')]['state'];return db[_0x0a9e('0x99')][_0x0a9e('0x53')]({'where':{'messageId':_0x17854b[_0x0a9e('0x37')]['message-id']}});}break;}}})[_0x0a9e('0x2e')](handleEntityNotFound(_0x1b1971,null))[_0x0a9e('0x2e')](function(_0x393e21){if(_0x393e21){_0x5932ad=_0x393e21;switch(_0x49a6b2['type']){case _0x0a9e('0x7e'):if(_0xb376ed==='2'||_0xb376ed==='6'){return _0x5932ad['update']({'read':!![]});}else{logger[_0x0a9e('0x1f')](_0x0a9e('0x1d'),_0x0a9e('0x25'),_0x0a9e('0x7e'),util[_0x0a9e('0xc0')](_0x17854b[_0x0a9e('0x37')],{'showHidden':![],'depth':null}));};break;}return _0x5932ad;}})[_0x0a9e('0x2e')](respondWithResult(_0x1b1971,null))['catch'](handleError(_0x1b1971,null));};exports[_0x0a9e('0xcc')]=function(_0xabaf97,_0x7c4db6,_0x14444e){return db[_0x0a9e('0x34')][_0x0a9e('0x53')]({'where':{'id':_0xabaf97[_0x0a9e('0x50')]['id']}})[_0x0a9e('0x2e')](handleEntityNotFound(_0x7c4db6,null))[_0x0a9e('0x2e')](function(_0x4712c9){if(_0x4712c9){return _0x4712c9[_0x0a9e('0xcc')](_0xabaf97[_0x0a9e('0x54')][_0x0a9e('0x5c')],_[_0x0a9e('0x8d')](_0xabaf97[_0x0a9e('0x54')],[_0x0a9e('0x5c'),'id'])||{})[_0x0a9e('0x91')](function(_0x28932f){for(var _0x6276a4=0x0;_0x6276a4<_0xabaf97[_0x0a9e('0x54')][_0x0a9e('0x5c')][_0x0a9e('0x52')];_0x6276a4+=0x1){socket[_0x0a9e('0xcd')]('userSmsAccount:save',{'UserId':_0xabaf97[_0x0a9e('0x54')][_0x0a9e('0x5c')][_0x6276a4],'SmsAccountId':_0xabaf97[_0x0a9e('0x50')]['id']});}return _0x28932f;});}})['then'](respondWithResult(_0x7c4db6,null))[_0x0a9e('0x4e')](handleError(_0x7c4db6,null));};exports['removeAgents']=function(_0xf007cd,_0xf2f758,_0x20a292){var _0x39c4da;return db[_0x0a9e('0x34')][_0x0a9e('0x53')]({'where':{'id':_0xf007cd[_0x0a9e('0x50')]['id']}})[_0x0a9e('0x2e')](handleEntityNotFound(_0xf2f758,null))['then'](function(_0x3ccbed){if(_0x3ccbed){return _0x3ccbed[_0x0a9e('0xce')](_0xf007cd['query'][_0x0a9e('0x5c')])[_0x0a9e('0x2e')](function(_0x579bb0){if(_['isArray'](_0xf007cd[_0x0a9e('0x37')][_0x0a9e('0x5c')])){for(var _0x315299=0x0;_0x315299<_0xf007cd[_0x0a9e('0x37')]['ids'][_0x0a9e('0x52')];_0x315299+=0x1){socket[_0x0a9e('0xcd')](_0x0a9e('0xcf'),{'UserId':_0xf007cd[_0x0a9e('0x37')][_0x0a9e('0x5c')][_0x315299],'SmsAccountId':_0xf007cd['params']['id']});}}else{socket[_0x0a9e('0xcd')](_0x0a9e('0xcf'),{'UserId':_0xf007cd['query'][_0x0a9e('0x5c')],'SmsAccountId':_0xf007cd[_0x0a9e('0x50')]['id']});}});}})[_0x0a9e('0x2e')](respondWithStatusCode(_0xf2f758,null))['catch'](handleError(_0xf2f758,null));};exports['getAgents']=function(_0x45ef37,_0x36d905,_0x271485){var _0x283bbb={};var _0x23a073={};var _0x430aa1;var _0x312e02;return db[_0x0a9e('0x34')]['findOne']({'where':{'id':_0x45ef37['params']['id']}})[_0x0a9e('0x2e')](handleEntityNotFound(_0x36d905,null))['then'](function(_0x803bc){if(_0x803bc){_0x430aa1=_0x803bc;_0x23a073[_0x0a9e('0x3d')]=_[_0x0a9e('0x51')](db[_0x0a9e('0x9d')]['rawAttributes']);_0x23a073[_0x0a9e('0x37')]=_[_0x0a9e('0x51')](_0x45ef37['query']);_0x23a073[_0x0a9e('0x39')]=_['intersection'](_0x23a073[_0x0a9e('0x3d')],_0x23a073[_0x0a9e('0x37')]);_0x283bbb[_0x0a9e('0x3b')]=_[_0x0a9e('0x3a')](_0x23a073[_0x0a9e('0x3d')],qs[_0x0a9e('0x3c')](_0x45ef37['query'][_0x0a9e('0x3c')]));_0x283bbb['attributes']=_0x283bbb[_0x0a9e('0x3b')][_0x0a9e('0x52')]?_0x283bbb[_0x0a9e('0x3b')]:_0x23a073[_0x0a9e('0x3d')];_0x283bbb[_0x0a9e('0x40')]=qs[_0x0a9e('0x41')](_0x45ef37[_0x0a9e('0x37')]['sort']);_0x283bbb[_0x0a9e('0x42')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x43')](_0x45ef37[_0x0a9e('0x37')],_0x23a073[_0x0a9e('0x39')]));if(_0x45ef37['query'][_0x0a9e('0x47')]){_0x283bbb[_0x0a9e('0x42')]=_['merge'](_0x283bbb['where'],{'$or':_[_0x0a9e('0x48')](_0x283bbb[_0x0a9e('0x3b')],function(_0x439bc7){var _0x32cdbe={};_0x32cdbe[_0x439bc7]={'$like':'%'+_0x45ef37[_0x0a9e('0x37')][_0x0a9e('0x47')]+'%'};return _0x32cdbe;})});}_0x283bbb=_['merge']({},_0x283bbb,_0x45ef37[_0x0a9e('0x49')]);return _0x430aa1[_0x0a9e('0xd0')](_0x283bbb);}})[_0x0a9e('0x2e')](function(_0x4bf3c7){if(_0x4bf3c7){_0x312e02=_0x4bf3c7[_0x0a9e('0x52')];if(!_0x45ef37[_0x0a9e('0x37')][_0x0a9e('0x3e')](_0x0a9e('0x3f'))){_0x283bbb['limit']=qs['limit'](_0x45ef37[_0x0a9e('0x37')][_0x0a9e('0x28')]);_0x283bbb[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x45ef37[_0x0a9e('0x37')][_0x0a9e('0x27')]);}return _0x430aa1[_0x0a9e('0xd0')](_0x283bbb);}})[_0x0a9e('0x2e')](function(_0x4a4f79){if(_0x4a4f79){return _0x4a4f79?{'count':_0x312e02,'rows':_0x4a4f79}:null;}})[_0x0a9e('0x2e')](respondWithResult(_0x36d905,null))['catch'](handleError(_0x36d905,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index f985354..c1d3cd3 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 _0xbbeb=['exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x439bc4,_0x44464c){var _0x159912=function(_0x4790f2){while(--_0x4790f2){_0x439bc4['push'](_0x439bc4['shift']());}};_0x159912(++_0x44464c);}(_0xbbeb,0x85));var _0xbbbe=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0xbbeb[_0xef8146];return _0x5a6cb0;};'use strict';var EventEmitter=require(_0xbbbe('0x0'));var SmsAccount=require(_0xbbbe('0x1'))['db'][_0xbbbe('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xbbbe('0x3')](0x0);var events={'afterCreate':_0xbbbe('0x4'),'afterUpdate':_0xbbbe('0x5'),'afterDestroy':_0xbbbe('0x6')};function emitEvent(_0x12ec1c){return function(_0x428e96,_0x29de96,_0xd896b1){SmsAccountEvents[_0xbbbe('0x7')](_0x12ec1c+':'+_0x428e96['id'],_0x428e96);SmsAccountEvents[_0xbbbe('0x7')](_0x12ec1c,_0x428e96);_0xd896b1(null);};}for(var e in events){if(events[_0xbbbe('0x8')](e)){var event=events[e];SmsAccount[_0xbbbe('0x9')](e,emitEvent(event));}}module[_0xbbbe('0xa')]=SmsAccountEvents; \ No newline at end of file +var _0x90b5=['remove','emit','hasOwnProperty','hook','../../mysqldb','SmsAccount','save','update'];(function(_0x23a959,_0x5c39dd){var _0x2b73dd=function(_0x2ced19){while(--_0x2ced19){_0x23a959['push'](_0x23a959['shift']());}};_0x2b73dd(++_0x5c39dd);}(_0x90b5,0xe4));var _0x590b=function(_0x23cc76,_0x9c756b){_0x23cc76=_0x23cc76-0x0;var _0x2f5c13=_0x90b5[_0x23cc76];return _0x2f5c13;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x590b('0x0'))['db'][_0x590b('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x590b('0x2'),'afterUpdate':_0x590b('0x3'),'afterDestroy':_0x590b('0x4')};function emitEvent(_0x2ba65a){return function(_0x478710,_0xa39809,_0x55d0cc){SmsAccountEvents[_0x590b('0x5')](_0x2ba65a+':'+_0x478710['id'],_0x478710);SmsAccountEvents[_0x590b('0x5')](_0x2ba65a,_0x478710);_0x55d0cc(null);};}for(var e in events){if(events[_0x590b('0x6')](e)){var event=events[e];SmsAccount[_0x590b('0x7')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 3b30e9e..64d76c0 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 _0xaf4a=['moment','bluebird','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','util','../../config/logger','api'];(function(_0x67fbed,_0x14b287){var _0x5a3218=function(_0x443c59){while(--_0x443c59){_0x67fbed['push'](_0x67fbed['shift']());}};_0x5a3218(++_0x14b287);}(_0xaf4a,0x101));var _0xaaf4=function(_0x1bd259,_0x34d2f0){_0x1bd259=_0x1bd259-0x0;var _0xe1faed=_0xaf4a[_0x1bd259];return _0xe1faed;};'use strict';var _=require('lodash');var util=require(_0xaaf4('0x0'));var logger=require(_0xaaf4('0x1'))(_0xaaf4('0x2'));var moment=require(_0xaaf4('0x3'));var BPromise=require(_0xaaf4('0x4'));var rp=require('request-promise');var attributes=require(_0xaaf4('0x5'));module[_0xaaf4('0x6')]=function(_0x413666,_0x21b3db){return _0x413666[_0xaaf4('0x7')](_0xaaf4('0x8'),attributes,{'tableName':_0xaaf4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x867f=['lodash','util','../../config/logger','moment','bluebird','request-promise','exports','define','SmsAccount','sms_accounts'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x867f,0xdc));var _0xf867=function(_0x44dbc3,_0x145c5b){_0x44dbc3=_0x44dbc3-0x0;var _0x33ec1f=_0x867f[_0x44dbc3];return _0x33ec1f;};'use strict';var _=require(_0xf867('0x0'));var util=require(_0xf867('0x1'));var logger=require(_0xf867('0x2'))('api');var moment=require(_0xf867('0x3'));var BPromise=require(_0xf867('0x4'));var rp=require(_0xf867('0x5'));var attributes=require('./smsAccount.attributes');module[_0xf867('0x6')]=function(_0x4cfdb5,_0x168658){return _0x4cfdb5[_0xf867('0x7')](_0xf867('0x8'),attributes,{'tableName':_0xf867('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index d618ed6..f19b297 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 _0x8bf1=['localhost','./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','SmsAccount','find','options','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis'];(function(_0x17f5e5,_0x4bc59c){var _0x2b4ea7=function(_0x5df676){while(--_0x5df676){_0x17f5e5['push'](_0x17f5e5['shift']());}};_0x2b4ea7(++_0x4bc59c);}(_0x8bf1,0xb9));var _0x18bf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8bf1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x18bf('0x0'));var util=require(_0x18bf('0x1'));var moment=require(_0x18bf('0x2'));var BPromise=require(_0x18bf('0x3'));var rs=require(_0x18bf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x18bf('0x5'))['db'];var utils=require(_0x18bf('0x6'));var logger=require(_0x18bf('0x7'))(_0x18bf('0x8'));var config=require(_0x18bf('0x9'));var jayson=require(_0x18bf('0xa'));var client=jayson[_0x18bf('0xb')][_0x18bf('0xc')]({'port':0x232a});config['redis']=_[_0x18bf('0xd')](config[_0x18bf('0xe')],{'host':_0x18bf('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x18bf('0xe')]));require(_0x18bf('0x10'))[_0x18bf('0x11')](socket);function respondWithRpcPromise(_0x3d13db,_0x3c78d2,_0x3f2ba7){return new BPromise(function(_0x4bcfbe,_0x2b12dc){return client[_0x18bf('0x12')](_0x3d13db,_0x3f2ba7)[_0x18bf('0x13')](function(_0x393400){logger[_0x18bf('0x14')](_0x18bf('0x15'),_0x3c78d2,_0x18bf('0x16'));logger[_0x18bf('0x17')](_0x18bf('0x18'),_0x3c78d2,_0x18bf('0x16'),JSON[_0x18bf('0x19')](_0x393400));if(_0x393400[_0x18bf('0x1a')]){if(_0x393400[_0x18bf('0x1a')][_0x18bf('0x1b')]===0x1f4){logger[_0x18bf('0x1a')](_0x18bf('0x15'),_0x3c78d2,_0x393400['error']['message']);return _0x2b12dc(_0x393400['error'][_0x18bf('0x1c')]);}logger[_0x18bf('0x1a')]('SmsAccount,\x20%s,\x20%s',_0x3c78d2,_0x393400[_0x18bf('0x1a')]['message']);return _0x4bcfbe(_0x393400[_0x18bf('0x1a')]['message']);}else{logger[_0x18bf('0x14')](_0x18bf('0x15'),_0x3c78d2,'request\x20sent');_0x4bcfbe(_0x393400[_0x18bf('0x1d')][_0x18bf('0x1c')]);}})[_0x18bf('0x1e')](function(_0xb3878c){logger[_0x18bf('0x1a')]('SmsAccount,\x20%s,\x20%s',_0x3c78d2,_0xb3878c);_0x2b12dc(_0xb3878c);});});}exports[_0x18bf('0x1f')]=function(_0x3d9837){var _0x20becb=this;return new Promise(function(_0x41138e,_0x1ee7ff){return db[_0x18bf('0x20')][_0x18bf('0x21')]({'raw':_0x3d9837['options']?_0x3d9837[_0x18bf('0x22')]['raw']===undefined?!![]:![]:!![],'where':_0x3d9837[_0x18bf('0x22')]?_0x3d9837['options'][_0x18bf('0x23')]||null:null,'attributes':_0x3d9837[_0x18bf('0x22')]?_0x3d9837[_0x18bf('0x22')][_0x18bf('0x24')]||null:null,'include':_0x3d9837[_0x18bf('0x22')]?_0x3d9837['options'][_0x18bf('0x25')]?_[_0x18bf('0x26')](_0x3d9837['options']['include'],function(_0x24a141){return{'model':db[_0x24a141[_0x18bf('0x27')]],'as':_0x24a141['as'],'attributes':_0x24a141[_0x18bf('0x24')],'include':_0x24a141[_0x18bf('0x25')]?_[_0x18bf('0x26')](_0x24a141['include'],function(_0x3520c3){return{'model':db[_0x3520c3['model']],'as':_0x3520c3['as'],'attributes':_0x3520c3['attributes'],'include':_0x3520c3['include']?_[_0x18bf('0x26')](_0x3520c3[_0x18bf('0x25')],function(_0x217b56){return{'model':db[_0x217b56[_0x18bf('0x27')]],'as':_0x217b56['as'],'attributes':_0x217b56[_0x18bf('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3fbc1e){logger[_0x18bf('0x14')](_0x18bf('0x1f'),_0x3d9837);logger['debug'](_0x18bf('0x1f'),_0x3d9837,JSON[_0x18bf('0x19')](_0x3fbc1e));_0x41138e(_0x3fbc1e);})['catch'](function(_0x3c3060){logger['error']('ShowSmsAccount',_0x3c3060['message'],_0x3d9837);_0x1ee7ff(_0x20becb[_0x18bf('0x1a')](0x1f4,_0x3c3060['message']));});});}; \ No newline at end of file +var _0x1fb8=['debug','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','defaults','redis','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','ShowSmsAccount','SmsAccount','find','raw','options','where','attributes','map','include','model'];(function(_0x239dfe,_0x4b16f1){var _0x4dd694=function(_0x38c638){while(--_0x38c638){_0x239dfe['push'](_0x239dfe['shift']());}};_0x4dd694(++_0x4b16f1);}(_0x1fb8,0x1e1));var _0x81fb=function(_0x3b2526,_0x278079){_0x3b2526=_0x3b2526-0x0;var _0x5e40bf=_0x1fb8[_0x3b2526];return _0x5e40bf;};'use strict';var _=require(_0x81fb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x81fb('0x1'));var rs=require(_0x81fb('0x2'));var fs=require('fs');var Redis=require(_0x81fb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x81fb('0x4'));var logger=require(_0x81fb('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x81fb('0x6')](config[_0x81fb('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x81fb('0x7')]));require(_0x81fb('0x8'))[_0x81fb('0x9')](socket);function respondWithRpcPromise(_0x4419ad,_0x114353,_0x5f29a4){return new BPromise(function(_0x219244,_0x1aa96f){return client[_0x81fb('0xa')](_0x4419ad,_0x5f29a4)[_0x81fb('0xb')](function(_0x46fe4d){logger[_0x81fb('0xc')](_0x81fb('0xd'),_0x114353,_0x81fb('0xe'));logger['debug'](_0x81fb('0xf'),_0x114353,_0x81fb('0xe'),JSON[_0x81fb('0x10')](_0x46fe4d));if(_0x46fe4d['error']){if(_0x46fe4d['error'][_0x81fb('0x11')]===0x1f4){logger[_0x81fb('0x12')](_0x81fb('0xd'),_0x114353,_0x46fe4d[_0x81fb('0x12')]['message']);return _0x1aa96f(_0x46fe4d[_0x81fb('0x12')]['message']);}logger['error'](_0x81fb('0xd'),_0x114353,_0x46fe4d[_0x81fb('0x12')][_0x81fb('0x13')]);return _0x219244(_0x46fe4d[_0x81fb('0x12')][_0x81fb('0x13')]);}else{logger['info'](_0x81fb('0xd'),_0x114353,_0x81fb('0xe'));_0x219244(_0x46fe4d['result'][_0x81fb('0x13')]);}})[_0x81fb('0x14')](function(_0x9579ea){logger[_0x81fb('0x12')](_0x81fb('0xd'),_0x114353,_0x9579ea);_0x1aa96f(_0x9579ea);});});}exports[_0x81fb('0x15')]=function(_0x60a130){var _0x40a23e=this;return new Promise(function(_0x3e7223,_0x5815ed){return db[_0x81fb('0x16')][_0x81fb('0x17')]({'raw':_0x60a130['options']?_0x60a130['options'][_0x81fb('0x18')]===undefined?!![]:![]:!![],'where':_0x60a130[_0x81fb('0x19')]?_0x60a130['options'][_0x81fb('0x1a')]||null:null,'attributes':_0x60a130['options']?_0x60a130['options'][_0x81fb('0x1b')]||null:null,'include':_0x60a130[_0x81fb('0x19')]?_0x60a130[_0x81fb('0x19')]['include']?_[_0x81fb('0x1c')](_0x60a130['options'][_0x81fb('0x1d')],function(_0x15ad6b){return{'model':db[_0x15ad6b['model']],'as':_0x15ad6b['as'],'attributes':_0x15ad6b[_0x81fb('0x1b')],'include':_0x15ad6b[_0x81fb('0x1d')]?_[_0x81fb('0x1c')](_0x15ad6b[_0x81fb('0x1d')],function(_0x1cd579){return{'model':db[_0x1cd579[_0x81fb('0x1e')]],'as':_0x1cd579['as'],'attributes':_0x1cd579[_0x81fb('0x1b')],'include':_0x1cd579[_0x81fb('0x1d')]?_[_0x81fb('0x1c')](_0x1cd579['include'],function(_0x2d8c39){return{'model':db[_0x2d8c39[_0x81fb('0x1e')]],'as':_0x2d8c39['as'],'attributes':_0x2d8c39['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3781a9){logger['info']('ShowSmsAccount',_0x60a130);logger[_0x81fb('0x1f')](_0x81fb('0x15'),_0x60a130,JSON['stringify'](_0x3781a9));_0x3e7223(_0x3781a9);})[_0x81fb('0x14')](function(_0x5b4aa2){logger[_0x81fb('0x12')](_0x81fb('0x15'),_0x5b4aa2[_0x81fb('0x13')],_0x60a130);_0x5815ed(_0x40a23e[_0x81fb('0x12')](0x1f4,_0x5b4aa2[_0x81fb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index b2b53fc..cd53ee1 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 _0x1e2f=['remove','update','emit','register','length','smsAccount:','save'];(function(_0x4ac9c6,_0x5cdafd){var _0x3fec8e=function(_0x2c9c87){while(--_0x2c9c87){_0x4ac9c6['push'](_0x4ac9c6['shift']());}};_0x3fec8e(++_0x5cdafd);}(_0x1e2f,0x187));var _0xf1e2=function(_0x4677b8,_0x24818e){_0x4677b8=_0x4677b8-0x0;var _0x2d9d66=_0x1e2f[_0x4677b8];return _0x2d9d66;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=[_0xf1e2('0x0'),_0xf1e2('0x1'),_0xf1e2('0x2')];function createListener(_0x1cb259,_0x206ad1){return function(_0x5435ff){_0x206ad1[_0xf1e2('0x3')](_0x1cb259,_0x5435ff);};}function removeListener(_0x440460,_0x472b23){return function(){SmsAccountEvents['removeListener'](_0x440460,_0x472b23);};}exports[_0xf1e2('0x4')]=function(_0x404439){for(var _0x5cd490=0x0,_0x52c303=events[_0xf1e2('0x5')];_0x5cd490<_0x52c303;_0x5cd490++){var _0x36ed89=events[_0x5cd490];var _0x10e37e=createListener(_0xf1e2('0x6')+_0x36ed89,_0x404439);SmsAccountEvents['on'](_0x36ed89,_0x10e37e);}}; \ No newline at end of file +var _0xc9ed=['removeListener','register','length','smsAccount:','./smsAccount.events','remove','update'];(function(_0x33bb04,_0x2c4ef0){var _0x1eeaae=function(_0xd42b1b){while(--_0xd42b1b){_0x33bb04['push'](_0x33bb04['shift']());}};_0x1eeaae(++_0x2c4ef0);}(_0xc9ed,0x162));var _0xdc9e=function(_0x241de8,_0x24c165){_0x241de8=_0x241de8-0x0;var _0x19fb75=_0xc9ed[_0x241de8];return _0x19fb75;};'use strict';var SmsAccountEvents=require(_0xdc9e('0x0'));var events=['save',_0xdc9e('0x1'),_0xdc9e('0x2')];function createListener(_0x5c4289,_0x39a74b){return function(_0x41caf4){_0x39a74b['emit'](_0x5c4289,_0x41caf4);};}function removeListener(_0x1dddc2,_0x4aaa98){return function(){SmsAccountEvents[_0xdc9e('0x3')](_0x1dddc2,_0x4aaa98);};}exports[_0xdc9e('0x4')]=function(_0x414d7e){for(var _0x312975=0x0,_0x15321e=events[_0xdc9e('0x5')];_0x312975<_0x15321e;_0x312975++){var _0x5848e5=events[_0x312975];var _0x5e04f5=createListener(_0xdc9e('0x6')+_0x5848e5,_0x414d7e);SmsAccountEvents['on'](_0x5848e5,_0x5e04f5);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 5d1ae54..755f3bf 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 _0x236c=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','put','update','delete','/:id'];(function(_0x3ae803,_0x9893fa){var _0xef94ba=function(_0x551308){while(--_0x551308){_0x3ae803['push'](_0x3ae803['shift']());}};_0xef94ba(++_0x9893fa);}(_0x236c,0x155));var _0xc236=function(_0x5a0ed8,_0x5377f5){_0x5a0ed8=_0x5a0ed8-0x0;var _0x5d2285=_0x236c[_0x5a0ed8];return _0x5d2285;};'use strict';var multer=require(_0xc236('0x0'));var util=require('util');var path=require(_0xc236('0x1'));var timeout=require(_0xc236('0x2'));var express=require(_0xc236('0x3'));var router=express[_0xc236('0x4')]();var auth=require(_0xc236('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc236('0x6'));var controller=require(_0xc236('0x7'));router[_0xc236('0x8')]('/',auth[_0xc236('0x9')](),controller[_0xc236('0xa')]);router[_0xc236('0x8')]('/:id',auth[_0xc236('0x9')](),controller[_0xc236('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xc236('0xc')]('/:id',auth[_0xc236('0x9')](),controller[_0xc236('0xd')]);router[_0xc236('0xe')](_0xc236('0xf'),auth[_0xc236('0x9')](),controller['destroy']);module[_0xc236('0x10')]=router; \ No newline at end of file +var _0x896e=['isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get'];(function(_0x4aa78a,_0x15c09c){var _0x444b3b=function(_0x7c30bb){while(--_0x7c30bb){_0x4aa78a['push'](_0x4aa78a['shift']());}};_0x444b3b(++_0x15c09c);}(_0x896e,0x1e9));var _0xe896=function(_0x17c966,_0x43080e){_0x17c966=_0x17c966-0x0;var _0x1bdcbc=_0x896e[_0x17c966];return _0x1bdcbc;};'use strict';var multer=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var path=require(_0xe896('0x2'));var timeout=require(_0xe896('0x3'));var express=require(_0xe896('0x4'));var router=express[_0xe896('0x5')]();var auth=require(_0xe896('0x6'));var interaction=require(_0xe896('0x7'));var config=require(_0xe896('0x8'));var controller=require(_0xe896('0x9'));router[_0xe896('0xa')]('/',auth[_0xe896('0xb')](),controller['index']);router[_0xe896('0xa')](_0xe896('0xc'),auth[_0xe896('0xb')](),controller[_0xe896('0xd')]);router[_0xe896('0xe')]('/',auth['isAuthenticated'](),controller[_0xe896('0xf')]);router[_0xe896('0x10')](_0xe896('0xc'),auth['isAuthenticated'](),controller[_0xe896('0x11')]);router['delete'](_0xe896('0xc'),auth['isAuthenticated'](),controller[_0xe896('0x12')]);module[_0xe896('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 41c6d1d..957679f 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 _0xba8e=['STRING','noop','*,*,*,*','exports','INTEGER'];(function(_0x3dad30,_0x32b016){var _0x5d0fb0=function(_0x51d291){while(--_0x51d291){_0x3dad30['push'](_0x3dad30['shift']());}};_0x5d0fb0(++_0x32b016);}(_0xba8e,0x85));var _0xeba8=function(_0x5ac1e5,_0x4b5012){_0x5ac1e5=_0x5ac1e5-0x0;var _0x1bccc6=_0xba8e[_0x5ac1e5];return _0x1bccc6;};'use strict';var Sequelize=require('sequelize');module[_0xeba8('0x0')]={'priority':{'type':Sequelize[_0xeba8('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xeba8('0x2')],'allowNull':![],'defaultValue':_0xeba8('0x3')},'appdata':{'type':Sequelize[_0xeba8('0x2')](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0xeba8('0x2')]},'interval':{'type':Sequelize[_0xeba8('0x2')],'defaultValue':_0xeba8('0x4')}}; \ No newline at end of file +var _0x440c=['STRING','noop','*,*,*,*','exports','INTEGER'];(function(_0x4f05d4,_0x31ea0c){var _0x32ce26=function(_0x45b5ac){while(--_0x45b5ac){_0x4f05d4['push'](_0x4f05d4['shift']());}};_0x32ce26(++_0x31ea0c);}(_0x440c,0x12f));var _0xc440=function(_0x23ee42,_0x5efcfa){_0x23ee42=_0x23ee42-0x0;var _0x57e897=_0x440c[_0x23ee42];return _0x57e897;};'use strict';var Sequelize=require('sequelize');module[_0xc440('0x0')]={'priority':{'type':Sequelize[_0xc440('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xc440('0x2')],'allowNull':![],'defaultValue':_0xc440('0x3')},'appdata':{'type':Sequelize['STRING'](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0xc440('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xc440('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 685a13b..7e5e2b6 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 _0x3200=['name','send','index','rawAttributes','model','keys','query','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','dateStart','add','day','filter','merge','options','includeAll','include','SmsApplication','findAll','rows','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','stack'];(function(_0x2049a9,_0x5eae97){var _0x1db278=function(_0x8aea4){while(--_0x8aea4){_0x2049a9['push'](_0x2049a9['shift']());}};_0x1db278(++_0x5eae97);}(_0x3200,0x6c));var _0x0320=function(_0x1ff543,_0x593646){_0x1ff543=_0x1ff543-0x0;var _0x2f039a=_0x3200[_0x1ff543];return _0x2f039a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0320('0x0'));var rimraf=require(_0x0320('0x1'));var zipdir=require(_0x0320('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0320('0x3'));var moment=require('moment');var BPromise=require(_0x0320('0x4'));var Mustache=require(_0x0320('0x5'));var util=require(_0x0320('0x6'));var path=require(_0x0320('0x7'));var sox=require('sox');var csv=require(_0x0320('0x8'));var ejs=require(_0x0320('0x9'));var fs=require('fs');var _=require(_0x0320('0xa'));var squel=require(_0x0320('0xb'));var crypto=require(_0x0320('0xc'));var jsforce=require(_0x0320('0xd'));var deskjs=require(_0x0320('0xe'));var toCsv=require(_0x0320('0x8'));var querystring=require(_0x0320('0xf'));var Papa=require(_0x0320('0x10'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x0320('0x11'))(_0x0320('0x12'));var utils=require(_0x0320('0x13'));var config=require(_0x0320('0x14'));var db=require(_0x0320('0x15'))['db'];function respondWithStatusCode(_0x51cf27,_0x2837cc){_0x2837cc=_0x2837cc||0xcc;return function(_0xdcff08){if(_0xdcff08){return _0x51cf27[_0x0320('0x16')](_0x2837cc);}return _0x51cf27[_0x0320('0x17')](_0x2837cc)[_0x0320('0x18')]();};}function respondWithResult(_0x43d879,_0x433403){_0x433403=_0x433403||0xc8;return function(_0x1d749b){if(_0x1d749b){return _0x43d879[_0x0320('0x17')](_0x433403)[_0x0320('0x19')](_0x1d749b);}};}function respondWithFilteredResult(_0x1f8e1d,_0x451695){return function(_0x3de4aa){if(_0x3de4aa){var _0x5d000a=_0x3de4aa[_0x0320('0x1a')],_0x6045b7=_0x451695['offset'],_0x82dc55=_0x451695[_0x0320('0x1b')]+_0x451695[_0x0320('0x1c')],_0x5581db;if(_0x82dc55>=_0x5d000a){_0x82dc55=_0x5d000a;_0x5581db=0xc8;}else{_0x5581db=0xce;}_0x1f8e1d[_0x0320('0x17')](_0x5581db);return _0x1f8e1d[_0x0320('0x1d')](_0x0320('0x1e'),_0x6045b7+'-'+_0x82dc55+'/'+_0x5d000a)['json'](_0x3de4aa);}return null;};}function patchUpdates(_0x4ae937){return function(_0x3d9511){try{jsonpatch[_0x0320('0x1f')](_0x3d9511,_0x4ae937,!![]);}catch(_0x1a4a6c){return BPromise[_0x0320('0x20')](_0x1a4a6c);}return _0x3d9511['save']();};}function saveUpdates(_0x30aa9c,_0x95a00d){return function(_0x3c31b6){if(_0x3c31b6){return _0x3c31b6[_0x0320('0x21')](_0x30aa9c)['then'](function(_0x6a8e69){return _0x6a8e69;});}return null;};}function removeEntity(_0x28c999,_0x5b8765){return function(_0x4c4172){if(_0x4c4172){return _0x4c4172[_0x0320('0x22')]()[_0x0320('0x23')](function(){_0x28c999[_0x0320('0x17')](0xcc)[_0x0320('0x18')]();});}};}function handleEntityNotFound(_0x54f3c1,_0x56b9ae){return function(_0x1d6dcd){if(!_0x1d6dcd){_0x54f3c1[_0x0320('0x16')](0x194);}return _0x1d6dcd;};}function handleError(_0x5c9377,_0x41278f){_0x41278f=_0x41278f||0x1f4;return function(_0x16b2d5){logger[_0x0320('0x24')](_0x16b2d5[_0x0320('0x25')]);if(_0x16b2d5[_0x0320('0x26')]){delete _0x16b2d5[_0x0320('0x26')];}_0x5c9377['status'](_0x41278f)[_0x0320('0x27')](_0x16b2d5);};}exports[_0x0320('0x28')]=function(_0x3aa959,_0x12ef77){var _0x12a1c4={},_0x4351ea={},_0x2e8b45={'count':0x0,'rows':[]};var _0x7035b5=db['SmsApplication'][_0x0320('0x29')];_0x4351ea[_0x0320('0x2a')]=_[_0x0320('0x2b')](_0x7035b5);var _0x4e6b5c={'dateStart':_0x3aa959[_0x0320('0x2c')]['dateStart'],'dateEnd':_0x3aa959[_0x0320('0x2c')][_0x0320('0x2d')]};delete _0x3aa959[_0x0320('0x2c')]['dateStart'];delete _0x3aa959['query']['dateEnd'];_0x4351ea[_0x0320('0x2c')]=_[_0x0320('0x2b')](_0x3aa959[_0x0320('0x2c')]);_0x4351ea[_0x0320('0x2e')]=_[_0x0320('0x2f')](_0x4351ea[_0x0320('0x2a')],_0x4351ea[_0x0320('0x2c')]);_0x12a1c4[_0x0320('0x30')]=_['intersection'](_0x4351ea[_0x0320('0x2a')],qs[_0x0320('0x31')](_0x3aa959[_0x0320('0x2c')][_0x0320('0x31')]));_0x12a1c4[_0x0320('0x30')]=_0x12a1c4[_0x0320('0x30')][_0x0320('0x32')]?_0x12a1c4['attributes']:_0x4351ea['model'];if(!_0x3aa959['query'][_0x0320('0x33')](_0x0320('0x34'))){_0x12a1c4[_0x0320('0x1c')]=qs['limit'](_0x3aa959['query'][_0x0320('0x1c')]);_0x12a1c4['offset']=qs[_0x0320('0x1b')](_0x3aa959[_0x0320('0x2c')]['offset']);}_0x12a1c4[_0x0320('0x35')]=qs['sort'](_0x3aa959[_0x0320('0x2c')]['sort']);_0x12a1c4[_0x0320('0x36')]=qs['filters'](_[_0x0320('0x37')](_0x3aa959[_0x0320('0x2c')],_0x4351ea['filters']));if(_0x4e6b5c[_0x0320('0x38')]){if(_0x4e6b5c[_0x0320('0x2d')]){_0x4e6b5c[_0x0320('0x2d')]=moment(_0x4e6b5c[_0x0320('0x2d')])[_0x0320('0x39')](0x1,'day');}else{_0x4e6b5c[_0x0320('0x2d')]=moment(_0x4e6b5c[_0x0320('0x38')])[_0x0320('0x39')](0x1,_0x0320('0x3a'));}_['merge'](_0x12a1c4[_0x0320('0x36')],{'createdAt':{'$gte':_0x4e6b5c[_0x0320('0x38')],'$lte':_0x4e6b5c[_0x0320('0x2d')]}});}if(_0x3aa959['query'][_0x0320('0x3b')]){_0x12a1c4[_0x0320('0x36')]=_[_0x0320('0x3c')](_0x12a1c4[_0x0320('0x36')],{'$or':_['map'](_0x12a1c4[_0x0320('0x30')],function(_0x38d42c){var _0x28b80a={};_0x28b80a[_0x38d42c]={'$like':'%'+_0x3aa959[_0x0320('0x2c')][_0x0320('0x3b')]+'%'};return _0x28b80a;})});}_0x12a1c4=_[_0x0320('0x3c')]({},_0x12a1c4,_0x3aa959[_0x0320('0x3d')]);var _0x5bf23b={'where':_0x12a1c4[_0x0320('0x36')]};return db['SmsApplication'][_0x0320('0x1a')](_0x5bf23b)[_0x0320('0x23')](function(_0x200354){_0x2e8b45['count']=_0x200354;if(_0x3aa959[_0x0320('0x2c')][_0x0320('0x3e')]){_0x12a1c4[_0x0320('0x3f')]=[{'all':!![]}];}return db[_0x0320('0x40')][_0x0320('0x41')](_0x12a1c4);})['then'](function(_0x3fbab4){_0x2e8b45[_0x0320('0x42')]=_0x3fbab4;return _0x2e8b45;})['then'](respondWithFilteredResult(_0x12ef77,_0x12a1c4))[_0x0320('0x43')](handleError(_0x12ef77,null));};exports[_0x0320('0x44')]=function(_0x3bde0b,_0x20daf1){var _0x2ed90c={'raw':!![],'where':{'id':_0x3bde0b[_0x0320('0x45')]['id']}},_0x930b69={};_0x930b69['model']=_[_0x0320('0x2b')](db[_0x0320('0x40')][_0x0320('0x29')]);_0x930b69[_0x0320('0x2c')]=_[_0x0320('0x2b')](_0x3bde0b[_0x0320('0x2c')]);_0x930b69['filters']=_[_0x0320('0x2f')](_0x930b69['model'],_0x930b69[_0x0320('0x2c')]);_0x2ed90c[_0x0320('0x30')]=_['intersection'](_0x930b69[_0x0320('0x2a')],qs[_0x0320('0x31')](_0x3bde0b[_0x0320('0x2c')][_0x0320('0x31')]));_0x2ed90c['attributes']=_0x2ed90c[_0x0320('0x30')][_0x0320('0x32')]?_0x2ed90c['attributes']:_0x930b69[_0x0320('0x2a')];if(_0x3bde0b[_0x0320('0x2c')][_0x0320('0x3e')]){_0x2ed90c['include']=[{'all':!![]}];}_0x2ed90c=_['merge']({},_0x2ed90c,_0x3bde0b['options']);return db['SmsApplication']['find'](_0x2ed90c)[_0x0320('0x23')](handleEntityNotFound(_0x20daf1,null))['then'](respondWithResult(_0x20daf1,null))[_0x0320('0x43')](handleError(_0x20daf1,null));};exports['create']=function(_0x1f3a00,_0x51d72f){return db['SmsApplication'][_0x0320('0x46')](_0x1f3a00[_0x0320('0x47')],{})['then'](respondWithResult(_0x51d72f,0xc9))[_0x0320('0x43')](handleError(_0x51d72f,null));};exports[_0x0320('0x21')]=function(_0xe42b5b,_0xd70aff){if(_0xe42b5b[_0x0320('0x47')]['id']){delete _0xe42b5b[_0x0320('0x47')]['id'];}return db['SmsApplication'][_0x0320('0x48')]({'where':{'id':_0xe42b5b[_0x0320('0x45')]['id']}})['then'](handleEntityNotFound(_0xd70aff,null))[_0x0320('0x23')](saveUpdates(_0xe42b5b[_0x0320('0x47')],null))[_0x0320('0x23')](respondWithResult(_0xd70aff,null))[_0x0320('0x43')](handleError(_0xd70aff,null));};exports['destroy']=function(_0xdac7a6,_0x1e7960){return db[_0x0320('0x40')][_0x0320('0x48')]({'where':{'id':_0xdac7a6['params']['id']}})[_0x0320('0x23')](handleEntityNotFound(_0x1e7960,null))[_0x0320('0x23')](removeEntity(_0x1e7960,null))[_0x0320('0x43')](handleError(_0x1e7960,null));}; \ No newline at end of file +var _0x04b8=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','send','index','SmsApplication','rawAttributes','keys','query','dateStart','dateEnd','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','day','merge','filter','map','options','includeAll','include','findAll','rows','show','params','intersection','find','catch','create','body','html-pdf'];(function(_0x45ee03,_0x2f5319){var _0x13d535=function(_0x391904){while(--_0x391904){_0x45ee03['push'](_0x45ee03['shift']());}};_0x13d535(++_0x2f5319);}(_0x04b8,0x1a3));var _0x804b=function(_0x1e8534,_0x564191){_0x1e8534=_0x1e8534-0x0;var _0x3482f2=_0x04b8[_0x1e8534];return _0x3482f2;};'use strict';var pdf=require(_0x804b('0x0'));var emlformat=require(_0x804b('0x1'));var rimraf=require(_0x804b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x804b('0x3'));var rp=require(_0x804b('0x4'));var moment=require(_0x804b('0x5'));var BPromise=require(_0x804b('0x6'));var Mustache=require(_0x804b('0x7'));var util=require('util');var path=require('path');var sox=require(_0x804b('0x8'));var csv=require('to-csv');var ejs=require(_0x804b('0x9'));var fs=require('fs');var _=require(_0x804b('0xa'));var squel=require(_0x804b('0xb'));var crypto=require('crypto');var jsforce=require(_0x804b('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x804b('0xd'));var Papa=require('papaparse');var Redis=require(_0x804b('0xe'));var qs=require(_0x804b('0xf'));var logger=require(_0x804b('0x10'))(_0x804b('0x11'));var utils=require(_0x804b('0x12'));var config=require('../../config/environment');var db=require(_0x804b('0x13'))['db'];function respondWithStatusCode(_0x5b0eb7,_0x24cf6d){_0x24cf6d=_0x24cf6d||0xcc;return function(_0x19bfad){if(_0x19bfad){return _0x5b0eb7[_0x804b('0x14')](_0x24cf6d);}return _0x5b0eb7[_0x804b('0x15')](_0x24cf6d)[_0x804b('0x16')]();};}function respondWithResult(_0x448e8d,_0x54ba30){_0x54ba30=_0x54ba30||0xc8;return function(_0x18c4d0){if(_0x18c4d0){return _0x448e8d[_0x804b('0x15')](_0x54ba30)[_0x804b('0x17')](_0x18c4d0);}};}function respondWithFilteredResult(_0x15e9f2,_0xe68bce){return function(_0x34c464){if(_0x34c464){var _0x7a6484=_0x34c464[_0x804b('0x18')],_0x5a23fd=_0xe68bce['offset'],_0x5035bc=_0xe68bce[_0x804b('0x19')]+_0xe68bce[_0x804b('0x1a')],_0x2d2f5e;if(_0x5035bc>=_0x7a6484){_0x5035bc=_0x7a6484;_0x2d2f5e=0xc8;}else{_0x2d2f5e=0xce;}_0x15e9f2[_0x804b('0x15')](_0x2d2f5e);return _0x15e9f2['set']('Content-Range',_0x5a23fd+'-'+_0x5035bc+'/'+_0x7a6484)[_0x804b('0x17')](_0x34c464);}return null;};}function patchUpdates(_0x398f9a){return function(_0x42b242){try{jsonpatch[_0x804b('0x1b')](_0x42b242,_0x398f9a,!![]);}catch(_0x24d96e){return BPromise[_0x804b('0x1c')](_0x24d96e);}return _0x42b242[_0x804b('0x1d')]();};}function saveUpdates(_0x8a441b,_0x3fe86c){return function(_0x5753bd){if(_0x5753bd){return _0x5753bd[_0x804b('0x1e')](_0x8a441b)[_0x804b('0x1f')](function(_0x522ad6){return _0x522ad6;});}return null;};}function removeEntity(_0x1712e6,_0x1d29a7){return function(_0x54e2cf){if(_0x54e2cf){return _0x54e2cf[_0x804b('0x20')]()['then'](function(){_0x1712e6['status'](0xcc)[_0x804b('0x16')]();});}};}function handleEntityNotFound(_0x4c277c,_0x189227){return function(_0xe92bea){if(!_0xe92bea){_0x4c277c[_0x804b('0x14')](0x194);}return _0xe92bea;};}function handleError(_0x98ceda,_0x2d3ab5){_0x2d3ab5=_0x2d3ab5||0x1f4;return function(_0x4f9cb6){logger[_0x804b('0x21')](_0x4f9cb6[_0x804b('0x22')]);if(_0x4f9cb6[_0x804b('0x23')]){delete _0x4f9cb6[_0x804b('0x23')];}_0x98ceda[_0x804b('0x15')](_0x2d3ab5)[_0x804b('0x24')](_0x4f9cb6);};}exports[_0x804b('0x25')]=function(_0x48c6f6,_0x5b6761){var _0xb611bc={},_0x1004f8={},_0x427aae={'count':0x0,'rows':[]};var _0x542bbf=db[_0x804b('0x26')][_0x804b('0x27')];_0x1004f8['model']=_[_0x804b('0x28')](_0x542bbf);var _0x466ecf={'dateStart':_0x48c6f6[_0x804b('0x29')][_0x804b('0x2a')],'dateEnd':_0x48c6f6['query']['dateEnd']};delete _0x48c6f6[_0x804b('0x29')]['dateStart'];delete _0x48c6f6['query'][_0x804b('0x2b')];_0x1004f8[_0x804b('0x29')]=_[_0x804b('0x28')](_0x48c6f6[_0x804b('0x29')]);_0x1004f8[_0x804b('0x2c')]=_['intersection'](_0x1004f8[_0x804b('0x2d')],_0x1004f8[_0x804b('0x29')]);_0xb611bc[_0x804b('0x2e')]=_['intersection'](_0x1004f8[_0x804b('0x2d')],qs[_0x804b('0x2f')](_0x48c6f6['query'][_0x804b('0x2f')]));_0xb611bc[_0x804b('0x2e')]=_0xb611bc[_0x804b('0x2e')][_0x804b('0x30')]?_0xb611bc['attributes']:_0x1004f8[_0x804b('0x2d')];if(!_0x48c6f6[_0x804b('0x29')][_0x804b('0x31')](_0x804b('0x32'))){_0xb611bc[_0x804b('0x1a')]=qs[_0x804b('0x1a')](_0x48c6f6[_0x804b('0x29')]['limit']);_0xb611bc['offset']=qs[_0x804b('0x19')](_0x48c6f6[_0x804b('0x29')][_0x804b('0x19')]);}_0xb611bc[_0x804b('0x33')]=qs[_0x804b('0x34')](_0x48c6f6[_0x804b('0x29')][_0x804b('0x34')]);_0xb611bc[_0x804b('0x35')]=qs[_0x804b('0x2c')](_['pick'](_0x48c6f6['query'],_0x1004f8['filters']));if(_0x466ecf[_0x804b('0x2a')]){if(_0x466ecf[_0x804b('0x2b')]){_0x466ecf[_0x804b('0x2b')]=moment(_0x466ecf[_0x804b('0x2b')])['add'](0x1,'day');}else{_0x466ecf[_0x804b('0x2b')]=moment(_0x466ecf[_0x804b('0x2a')])['add'](0x1,_0x804b('0x36'));}_[_0x804b('0x37')](_0xb611bc['where'],{'createdAt':{'$gte':_0x466ecf['dateStart'],'$lte':_0x466ecf['dateEnd']}});}if(_0x48c6f6['query'][_0x804b('0x38')]){_0xb611bc['where']=_[_0x804b('0x37')](_0xb611bc['where'],{'$or':_[_0x804b('0x39')](_0xb611bc['attributes'],function(_0x40e91d){var _0x46fdf3={};_0x46fdf3[_0x40e91d]={'$like':'%'+_0x48c6f6[_0x804b('0x29')][_0x804b('0x38')]+'%'};return _0x46fdf3;})});}_0xb611bc=_['merge']({},_0xb611bc,_0x48c6f6[_0x804b('0x3a')]);var _0x17ab7d={'where':_0xb611bc[_0x804b('0x35')]};return db[_0x804b('0x26')]['count'](_0x17ab7d)[_0x804b('0x1f')](function(_0x283ab6){_0x427aae[_0x804b('0x18')]=_0x283ab6;if(_0x48c6f6[_0x804b('0x29')][_0x804b('0x3b')]){_0xb611bc[_0x804b('0x3c')]=[{'all':!![]}];}return db['SmsApplication'][_0x804b('0x3d')](_0xb611bc);})['then'](function(_0x79ab57){_0x427aae[_0x804b('0x3e')]=_0x79ab57;return _0x427aae;})[_0x804b('0x1f')](respondWithFilteredResult(_0x5b6761,_0xb611bc))['catch'](handleError(_0x5b6761,null));};exports[_0x804b('0x3f')]=function(_0x1db093,_0x42db95){var _0x1be3f5={'raw':!![],'where':{'id':_0x1db093[_0x804b('0x40')]['id']}},_0x291b2d={};_0x291b2d[_0x804b('0x2d')]=_[_0x804b('0x28')](db[_0x804b('0x26')][_0x804b('0x27')]);_0x291b2d[_0x804b('0x29')]=_[_0x804b('0x28')](_0x1db093[_0x804b('0x29')]);_0x291b2d['filters']=_[_0x804b('0x41')](_0x291b2d['model'],_0x291b2d[_0x804b('0x29')]);_0x1be3f5['attributes']=_[_0x804b('0x41')](_0x291b2d[_0x804b('0x2d')],qs[_0x804b('0x2f')](_0x1db093[_0x804b('0x29')][_0x804b('0x2f')]));_0x1be3f5[_0x804b('0x2e')]=_0x1be3f5[_0x804b('0x2e')][_0x804b('0x30')]?_0x1be3f5[_0x804b('0x2e')]:_0x291b2d[_0x804b('0x2d')];if(_0x1db093[_0x804b('0x29')][_0x804b('0x3b')]){_0x1be3f5[_0x804b('0x3c')]=[{'all':!![]}];}_0x1be3f5=_[_0x804b('0x37')]({},_0x1be3f5,_0x1db093[_0x804b('0x3a')]);return db['SmsApplication'][_0x804b('0x42')](_0x1be3f5)[_0x804b('0x1f')](handleEntityNotFound(_0x42db95,null))[_0x804b('0x1f')](respondWithResult(_0x42db95,null))[_0x804b('0x43')](handleError(_0x42db95,null));};exports[_0x804b('0x44')]=function(_0xd8892b,_0x539813){return db[_0x804b('0x26')]['create'](_0xd8892b[_0x804b('0x45')],{})[_0x804b('0x1f')](respondWithResult(_0x539813,0xc9))[_0x804b('0x43')](handleError(_0x539813,null));};exports[_0x804b('0x1e')]=function(_0xb6fd38,_0x128c4e){if(_0xb6fd38[_0x804b('0x45')]['id']){delete _0xb6fd38[_0x804b('0x45')]['id'];}return db['SmsApplication'][_0x804b('0x42')]({'where':{'id':_0xb6fd38[_0x804b('0x40')]['id']}})[_0x804b('0x1f')](handleEntityNotFound(_0x128c4e,null))[_0x804b('0x1f')](saveUpdates(_0xb6fd38['body'],null))[_0x804b('0x1f')](respondWithResult(_0x128c4e,null))[_0x804b('0x43')](handleError(_0x128c4e,null));};exports[_0x804b('0x20')]=function(_0xcbd82b,_0xaf800b){return db[_0x804b('0x26')][_0x804b('0x42')]({'where':{'id':_0xcbd82b[_0x804b('0x40')]['id']}})[_0x804b('0x1f')](handleEntityNotFound(_0xaf800b,null))[_0x804b('0x1f')](removeEntity(_0xaf800b,null))['catch'](handleError(_0xaf800b,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index a27bf5e..6326ae3 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 _0xe0fe=['../../config/logger','api','bluebird','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','lodash','util'];(function(_0x12aa04,_0x40899a){var _0x3c72df=function(_0x3f826a){while(--_0x3f826a){_0x12aa04['push'](_0x12aa04['shift']());}};_0x3c72df(++_0x40899a);}(_0xe0fe,0xe4));var _0xee0f=function(_0x50d4ee,_0x4e8289){_0x50d4ee=_0x50d4ee-0x0;var _0xd15710=_0xe0fe[_0x50d4ee];return _0xd15710;};'use strict';var _=require(_0xee0f('0x0'));var util=require(_0xee0f('0x1'));var logger=require(_0xee0f('0x2'))(_0xee0f('0x3'));var moment=require('moment');var BPromise=require(_0xee0f('0x4'));var rp=require('request-promise');var attributes=require(_0xee0f('0x5'));module[_0xee0f('0x6')]=function(_0x33fec6,_0x3f6b74){return _0x33fec6[_0xee0f('0x7')](_0xee0f('0x8'),attributes,{'tableName':_0xee0f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8cd0=['moment','bluebird','./smsApplication.attributes','exports','sms_applications','lodash','util','../../config/logger','api'];(function(_0x2a3ca4,_0x39a7e8){var _0x374c52=function(_0x32c6b8){while(--_0x32c6b8){_0x2a3ca4['push'](_0x2a3ca4['shift']());}};_0x374c52(++_0x39a7e8);}(_0x8cd0,0x1ac));var _0x08cd=function(_0x59f39d,_0x13321d){_0x59f39d=_0x59f39d-0x0;var _0x1fdd8e=_0x8cd0[_0x59f39d];return _0x1fdd8e;};'use strict';var _=require(_0x08cd('0x0'));var util=require(_0x08cd('0x1'));var logger=require(_0x08cd('0x2'))(_0x08cd('0x3'));var moment=require(_0x08cd('0x4'));var BPromise=require(_0x08cd('0x5'));var rp=require('request-promise');var attributes=require(_0x08cd('0x6'));module[_0x08cd('0x7')]=function(_0x309cc7,_0x48a056){return _0x309cc7['define']('SmsApplication',attributes,{'tableName':_0x08cd('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 306fb43..d11d57f 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 _0xc66a=['result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xc66a,0x17e));var _0xac66=function(_0x169b8c,_0x3b3b91){_0x169b8c=_0x169b8c-0x0;var _0x4f2c17=_0xc66a[_0x169b8c];return _0x4f2c17;};'use strict';var _=require('lodash');var util=require(_0xac66('0x0'));var moment=require('moment');var BPromise=require(_0xac66('0x1'));var rs=require(_0xac66('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac66('0x3'))['db'];var utils=require(_0xac66('0x4'));var logger=require('../../config/logger')(_0xac66('0x5'));var config=require(_0xac66('0x6'));var jayson=require(_0xac66('0x7'));var client=jayson['client'][_0xac66('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x57b442,_0x25ac9a,_0x12e7d3){return new BPromise(function(_0x191e5b,_0x1087b7){return client[_0xac66('0x9')](_0x57b442,_0x12e7d3)['then'](function(_0x26d899){logger['info'](_0xac66('0xa'),_0x25ac9a,_0xac66('0xb'));logger[_0xac66('0xc')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x25ac9a,'request\x20sent',JSON['stringify'](_0x26d899));if(_0x26d899[_0xac66('0xd')]){if(_0x26d899[_0xac66('0xd')][_0xac66('0xe')]===0x1f4){logger[_0xac66('0xd')](_0xac66('0xa'),_0x25ac9a,_0x26d899['error'][_0xac66('0xf')]);return _0x1087b7(_0x26d899[_0xac66('0xd')][_0xac66('0xf')]);}logger['error'](_0xac66('0xa'),_0x25ac9a,_0x26d899[_0xac66('0xd')][_0xac66('0xf')]);return _0x191e5b(_0x26d899['error'][_0xac66('0xf')]);}else{logger[_0xac66('0x10')](_0xac66('0xa'),_0x25ac9a,_0xac66('0xb'));_0x191e5b(_0x26d899[_0xac66('0x11')]['message']);}})[_0xac66('0x12')](function(_0x569426){logger[_0xac66('0xd')](_0xac66('0xa'),_0x25ac9a,_0x569426);_0x1087b7(_0x569426);});});} \ No newline at end of file +var _0x7532=['error','code','SmsApplication,\x20%s,\x20%s','message','request\x20sent','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','SmsApplication,\x20%s,\x20%s,\x20%s'];(function(_0x4e170e,_0x207e58){var _0x338291=function(_0x4cb198){while(--_0x4cb198){_0x4e170e['push'](_0x4e170e['shift']());}};_0x338291(++_0x207e58);}(_0x7532,0x16a));var _0x2753=function(_0x1e24b1,_0x14ab30){_0x1e24b1=_0x1e24b1-0x0;var _0x212baf=_0x7532[_0x1e24b1];return _0x212baf;};'use strict';var _=require(_0x2753('0x0'));var util=require('util');var moment=require(_0x2753('0x1'));var BPromise=require(_0x2753('0x2'));var rs=require(_0x2753('0x3'));var fs=require('fs');var Redis=require(_0x2753('0x4'));var db=require(_0x2753('0x5'))['db'];var utils=require(_0x2753('0x6'));var logger=require('../../config/logger')(_0x2753('0x7'));var config=require(_0x2753('0x8'));var jayson=require(_0x2753('0x9'));var client=jayson['client'][_0x2753('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13734f,_0x476d11,_0x1b8646){return new BPromise(function(_0x2d8810,_0x535212){return client[_0x2753('0xb')](_0x13734f,_0x1b8646)[_0x2753('0xc')](function(_0x49e1bd){logger[_0x2753('0xd')]('SmsApplication,\x20%s,\x20%s',_0x476d11,'request\x20sent');logger[_0x2753('0xe')](_0x2753('0xf'),_0x476d11,'request\x20sent',JSON['stringify'](_0x49e1bd));if(_0x49e1bd[_0x2753('0x10')]){if(_0x49e1bd[_0x2753('0x10')][_0x2753('0x11')]===0x1f4){logger[_0x2753('0x10')](_0x2753('0x12'),_0x476d11,_0x49e1bd[_0x2753('0x10')][_0x2753('0x13')]);return _0x535212(_0x49e1bd[_0x2753('0x10')][_0x2753('0x13')]);}logger[_0x2753('0x10')](_0x2753('0x12'),_0x476d11,_0x49e1bd[_0x2753('0x10')][_0x2753('0x13')]);return _0x2d8810(_0x49e1bd[_0x2753('0x10')][_0x2753('0x13')]);}else{logger['info']('SmsApplication,\x20%s,\x20%s',_0x476d11,_0x2753('0x14'));_0x2d8810(_0x49e1bd['result'][_0x2753('0x13')]);}})['catch'](function(_0x371033){logger[_0x2753('0x10')](_0x2753('0x12'),_0x476d11,_0x371033);_0x535212(_0x371033);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 85f5ff0..e2e8384 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 _0xaa2d=['../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id/messages','getMessages','post','create','tracked','smsinteraction:addtags','put','sms','smsinteraction:update','update','delete','/:id','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x3e385c,_0x24e848){var _0x4c6171=function(_0x1825c7){while(--_0x1825c7){_0x3e385c['push'](_0x3e385c['shift']());}};_0x4c6171(++_0x24e848);}(_0xaa2d,0xcc));var _0xdaa2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa2d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xdaa2('0x0'));var util=require(_0xdaa2('0x1'));var path=require(_0xdaa2('0x2'));var timeout=require(_0xdaa2('0x3'));var express=require('express');var router=express[_0xdaa2('0x4')]();var auth=require(_0xdaa2('0x5'));var interaction=require(_0xdaa2('0x6'));var config=require(_0xdaa2('0x7'));var controller=require(_0xdaa2('0x8'));router[_0xdaa2('0x9')]('/',auth[_0xdaa2('0xa')](),controller[_0xdaa2('0xb')]);router['get'](_0xdaa2('0xc'),auth[_0xdaa2('0xa')](),controller[_0xdaa2('0xd')]);router[_0xdaa2('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0xdaa2('0xe'),auth[_0xdaa2('0xa')](),controller[_0xdaa2('0xf')]);router[_0xdaa2('0x9')]('/:id/download',auth[_0xdaa2('0xa')](),controller['download']);router[_0xdaa2('0x10')]('/',auth['isAuthenticated'](),controller[_0xdaa2('0x11')]);router[_0xdaa2('0x10')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0xdaa2('0x10')]('/:id/tags',auth[_0xdaa2('0xa')](),interaction[_0xdaa2('0x12')]('sms',_0xdaa2('0x13')),controller['addTags']);router[_0xdaa2('0x14')]('/:id',auth[_0xdaa2('0xa')](),interaction[_0xdaa2('0x12')](_0xdaa2('0x15'),_0xdaa2('0x16')),controller[_0xdaa2('0x17')]);router[_0xdaa2('0x18')](_0xdaa2('0x19'),auth['isAuthenticated'](),interaction['tracked'](_0xdaa2('0x15'),'smsinteraction:destroy'),controller[_0xdaa2('0x1a')]);router[_0xdaa2('0x18')](_0xdaa2('0x1b'),auth[_0xdaa2('0xa')](),controller[_0xdaa2('0x1c')]);module[_0xdaa2('0x1d')]=router; \ No newline at end of file +var _0x9d3f=['/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','download','create','post','addMessage','/:id/tags','sms','smsinteraction:addtags','addTags','put','tracked','smsinteraction:update','destroy','delete','removeTags','util','connect-timeout','express','Router','../../config/environment','./smsInteraction.controller','get','index'];(function(_0x4409a3,_0x4b0bde){var _0x26ec0a=function(_0x4b74a6){while(--_0x4b74a6){_0x4409a3['push'](_0x4409a3['shift']());}};_0x26ec0a(++_0x4b0bde);}(_0x9d3f,0x18e));var _0xf9d3=function(_0x107928,_0x366a21){_0x107928=_0x107928-0x0;var _0x1e0592=_0x9d3f[_0x107928];return _0x1e0592;};'use strict';var multer=require('multer');var util=require(_0xf9d3('0x0'));var path=require('path');var timeout=require(_0xf9d3('0x1'));var express=require(_0xf9d3('0x2'));var router=express[_0xf9d3('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf9d3('0x4'));var controller=require(_0xf9d3('0x5'));router[_0xf9d3('0x6')]('/',auth['isAuthenticated'](),controller[_0xf9d3('0x7')]);router[_0xf9d3('0x6')](_0xf9d3('0x8'),auth[_0xf9d3('0x9')](),controller[_0xf9d3('0xa')]);router[_0xf9d3('0x6')](_0xf9d3('0xb'),auth[_0xf9d3('0x9')](),controller[_0xf9d3('0xc')]);router[_0xf9d3('0x6')](_0xf9d3('0xd'),auth['isAuthenticated'](),controller[_0xf9d3('0xe')]);router[_0xf9d3('0x6')]('/:id/download',auth['isAuthenticated'](),controller[_0xf9d3('0xf')]);router['post']('/',auth[_0xf9d3('0x9')](),controller[_0xf9d3('0x10')]);router[_0xf9d3('0x11')]('/:id/messages',auth[_0xf9d3('0x9')](),controller[_0xf9d3('0x12')]);router[_0xf9d3('0x11')](_0xf9d3('0x13'),auth['isAuthenticated'](),interaction['tracked'](_0xf9d3('0x14'),_0xf9d3('0x15')),controller[_0xf9d3('0x16')]);router[_0xf9d3('0x17')]('/:id',auth[_0xf9d3('0x9')](),interaction[_0xf9d3('0x18')]('sms',_0xf9d3('0x19')),controller['update']);router['delete'](_0xf9d3('0xb'),auth[_0xf9d3('0x9')](),interaction[_0xf9d3('0x18')]('sms','smsinteraction:destroy'),controller[_0xf9d3('0x1a')]);router[_0xf9d3('0x1b')](_0xf9d3('0x13'),auth['isAuthenticated'](),controller[_0xf9d3('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 9526058..178577f 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 _0x3a72=['BOOLEAN','STRING','ENUM','out','sequelize','exports'];(function(_0x41056b,_0x5a53c0){var _0x3603a5=function(_0xfd51f){while(--_0xfd51f){_0x41056b['push'](_0x41056b['shift']());}};_0x3603a5(++_0x5a53c0);}(_0x3a72,0xee));var _0x23a7=function(_0x520520,_0xeabffd){_0x520520=_0x520520-0x0;var _0x30d241=_0x3a72[_0x520520];return _0x30d241;};'use strict';var Sequelize=require(_0x23a7('0x0'));var moment=require('moment');module[_0x23a7('0x1')]={'closed':{'type':Sequelize[_0x23a7('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x23a7('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x23a7('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x23a7('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x23a7('0x4')]('in',_0x23a7('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x3fc9=['STRING','DATE','ENUM','out','moment','exports'];(function(_0x1d006a,_0x2812b5){var _0x20a76b=function(_0x15953f){while(--_0x15953f){_0x1d006a['push'](_0x1d006a['shift']());}};_0x20a76b(++_0x2812b5);}(_0x3fc9,0x1e4));var _0x93fc=function(_0x14c65b,_0x10b662){_0x14c65b=_0x14c65b-0x0;var _0x7ed29a=_0x3fc9[_0x14c65b];return _0x7ed29a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x93fc('0x0'));module[_0x93fc('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x93fc('0x2')]},'note':{'type':Sequelize[_0x93fc('0x2')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x93fc('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x93fc('0x4')]('in',_0x93fc('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x93fc('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x93fc('0x5')),'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 11135e2..6f2e9d3 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 _0xac39=['dateStart','merge','where','filter','options','include','tag','Tag','Tags','distinct','read','push','direction','createdAt','includeAll','Users','Owner','fullname','internal','SmsAccount','Account','key','Messages','color','findAll','rows','catch','show','params','find','create','body','describe','addMessage','SmsMessage','ids','getMessages','findOne','nolimit','SmsInteractionId','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','addTags','omit','spread','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','format','interaction-%s.zip','User','CmContact','Contact','firstName','1cm','mkdirSync','

Sms\x20Interaction:\x20#%d

','

Date:\x20%s

','MMMM\x20Do\x20YYYY,\x20HH:mm:ss','
','','%s:\x20%s

','','toFile','interaction-','.pdf','err','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','redis','defaults','socket.io-emitter','register','status','end','json','count','offset','limit','reject','save','then','destroy','sendStatus','name','send','index','SmsInteraction','rawAttributes','model','keys','query','dateEnd','filters','attributes','intersection','fields','length','order','sort','pick','add','day'];(function(_0x576266,_0x4002b0){var _0x18234f=function(_0x4e9ad5){while(--_0x4e9ad5){_0x576266['push'](_0x576266['shift']());}};_0x18234f(++_0x4002b0);}(_0xac39,0x156));var _0x9ac3=function(_0x3b4c3d,_0x2d88f8){_0x3b4c3d=_0x3b4c3d-0x0;var _0x586038=_0xac39[_0x3b4c3d];return _0x586038;};'use strict';var pdf=require(_0x9ac3('0x0'));var emlformat=require(_0x9ac3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9ac3('0x2'));var jsonpatch=require(_0x9ac3('0x3'));var rp=require('request-promise');var moment=require(_0x9ac3('0x4'));var BPromise=require(_0x9ac3('0x5'));var Mustache=require(_0x9ac3('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9ac3('0x7'));var ejs=require(_0x9ac3('0x8'));var fs=require('fs');var _=require(_0x9ac3('0x9'));var squel=require(_0x9ac3('0xa'));var crypto=require(_0x9ac3('0xb'));var jsforce=require(_0x9ac3('0xc'));var deskjs=require(_0x9ac3('0xd'));var toCsv=require(_0x9ac3('0x7'));var querystring=require(_0x9ac3('0xe'));var Papa=require(_0x9ac3('0xf'));var Redis=require(_0x9ac3('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0x9ac3('0x11'))(_0x9ac3('0x12'));var utils=require(_0x9ac3('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x9ac3('0x14')]=_[_0x9ac3('0x15')](config[_0x9ac3('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x9ac3('0x16'))(new Redis(config[_0x9ac3('0x14')]));require('./smsInteraction.socket')[_0x9ac3('0x17')](socket);function respondWithStatusCode(_0x44d563,_0x1c834a){_0x1c834a=_0x1c834a||0xcc;return function(_0xd99a26){if(_0xd99a26){return _0x44d563['sendStatus'](_0x1c834a);}return _0x44d563[_0x9ac3('0x18')](_0x1c834a)[_0x9ac3('0x19')]();};}function respondWithResult(_0x116ada,_0x3fe686){_0x3fe686=_0x3fe686||0xc8;return function(_0x3459fc){if(_0x3459fc){return _0x116ada[_0x9ac3('0x18')](_0x3fe686)[_0x9ac3('0x1a')](_0x3459fc);}};}function respondWithFilteredResult(_0x37ad5a,_0x4e1aec){return function(_0x2dbb97){if(_0x2dbb97){var _0x41d0eb=_0x2dbb97[_0x9ac3('0x1b')],_0x3ee34d=_0x4e1aec[_0x9ac3('0x1c')],_0x2173ec=_0x4e1aec[_0x9ac3('0x1c')]+_0x4e1aec[_0x9ac3('0x1d')],_0x359918;if(_0x2173ec>=_0x41d0eb){_0x2173ec=_0x41d0eb;_0x359918=0xc8;}else{_0x359918=0xce;}_0x37ad5a[_0x9ac3('0x18')](_0x359918);return _0x37ad5a['set']('Content-Range',_0x3ee34d+'-'+_0x2173ec+'/'+_0x41d0eb)[_0x9ac3('0x1a')](_0x2dbb97);}return null;};}function patchUpdates(_0x18fdfd){return function(_0x5be78c){try{jsonpatch['apply'](_0x5be78c,_0x18fdfd,!![]);}catch(_0x459cc3){return BPromise[_0x9ac3('0x1e')](_0x459cc3);}return _0x5be78c[_0x9ac3('0x1f')]();};}function saveUpdates(_0x990402,_0x44df74){return function(_0x233887){if(_0x233887){return _0x233887['update'](_0x990402)[_0x9ac3('0x20')](function(_0x1f3af5){return _0x1f3af5;});}return null;};}function removeEntity(_0x5b670d,_0x55ac2b){return function(_0xaa6882){if(_0xaa6882){return _0xaa6882[_0x9ac3('0x21')]()[_0x9ac3('0x20')](function(){_0x5b670d[_0x9ac3('0x18')](0xcc)[_0x9ac3('0x19')]();});}};}function handleEntityNotFound(_0x4b70a6,_0x2dc342){return function(_0xc92833){if(!_0xc92833){_0x4b70a6[_0x9ac3('0x22')](0x194);}return _0xc92833;};}function handleError(_0x463265,_0x56ba32){_0x56ba32=_0x56ba32||0x1f4;return function(_0x3ba24e){logger['error'](_0x3ba24e['stack']);if(_0x3ba24e['name']){delete _0x3ba24e[_0x9ac3('0x23')];}_0x463265['status'](_0x56ba32)[_0x9ac3('0x24')](_0x3ba24e);};}exports[_0x9ac3('0x25')]=function(_0x14b1d7,_0x46a51e){var _0x3c3d23={},_0x56e67c={},_0x916dd0={'count':0x0,'rows':[]};var _0x3c1c80=db[_0x9ac3('0x26')][_0x9ac3('0x27')];_0x56e67c[_0x9ac3('0x28')]=_[_0x9ac3('0x29')](_0x3c1c80);var _0x59ca82={'dateStart':_0x14b1d7[_0x9ac3('0x2a')]['dateStart'],'dateEnd':_0x14b1d7[_0x9ac3('0x2a')][_0x9ac3('0x2b')]};delete _0x14b1d7['query']['dateStart'];delete _0x14b1d7[_0x9ac3('0x2a')][_0x9ac3('0x2b')];_0x56e67c[_0x9ac3('0x2a')]=_[_0x9ac3('0x29')](_0x14b1d7[_0x9ac3('0x2a')]);_0x56e67c[_0x9ac3('0x2c')]=_['intersection'](_0x56e67c[_0x9ac3('0x28')],_0x56e67c[_0x9ac3('0x2a')]);_0x3c3d23[_0x9ac3('0x2d')]=_[_0x9ac3('0x2e')](_0x56e67c[_0x9ac3('0x28')],qs[_0x9ac3('0x2f')](_0x14b1d7[_0x9ac3('0x2a')][_0x9ac3('0x2f')]));_0x3c3d23[_0x9ac3('0x2d')]=_0x3c3d23['attributes'][_0x9ac3('0x30')]?_0x3c3d23[_0x9ac3('0x2d')]:_0x56e67c['model'];if(!_0x14b1d7['query']['hasOwnProperty']('nolimit')){_0x3c3d23[_0x9ac3('0x1d')]=qs[_0x9ac3('0x1d')](_0x14b1d7[_0x9ac3('0x2a')][_0x9ac3('0x1d')]);_0x3c3d23[_0x9ac3('0x1c')]=qs['offset'](_0x14b1d7[_0x9ac3('0x2a')]['offset']);}_0x3c3d23[_0x9ac3('0x31')]=qs['sort'](_0x14b1d7[_0x9ac3('0x2a')][_0x9ac3('0x32')]);_0x3c3d23['where']=qs[_0x9ac3('0x2c')](_[_0x9ac3('0x33')](_0x14b1d7[_0x9ac3('0x2a')],_0x56e67c[_0x9ac3('0x2c')]));if(_0x59ca82['dateStart']){if(_0x59ca82[_0x9ac3('0x2b')]){_0x59ca82[_0x9ac3('0x2b')]=moment(_0x59ca82[_0x9ac3('0x2b')])[_0x9ac3('0x34')](0x1,_0x9ac3('0x35'));}else{_0x59ca82['dateEnd']=moment(_0x59ca82[_0x9ac3('0x36')])['add'](0x1,_0x9ac3('0x35'));}_[_0x9ac3('0x37')](_0x3c3d23['where'],{'createdAt':{'$gte':_0x59ca82['dateStart'],'$lte':_0x59ca82[_0x9ac3('0x2b')]}});}if(_0x14b1d7[_0x9ac3('0x2a')]['filter']){_0x3c3d23[_0x9ac3('0x38')]=_[_0x9ac3('0x37')](_0x3c3d23[_0x9ac3('0x38')],{'$or':_['map'](_0x3c3d23[_0x9ac3('0x2d')],function(_0x2e631b){var _0x3daf6f={};_0x3daf6f[_0x2e631b]={'$like':'%'+_0x14b1d7['query'][_0x9ac3('0x39')]+'%'};return _0x3daf6f;})});}_0x3c3d23=_['merge']({},_0x3c3d23,_0x14b1d7[_0x9ac3('0x3a')]);var _0xa181db={'where':_0x3c3d23[_0x9ac3('0x38')]};_0xa181db[_0x9ac3('0x3b')]=[];if(_0x14b1d7['query'][_0x9ac3('0x3c')]){_0xa181db[_0x9ac3('0x3b')]['push']({'model':db[_0x9ac3('0x3d')],'as':_0x9ac3('0x3e'),'attributes':['id'],'where':{'id':_0x14b1d7[_0x9ac3('0x2a')][_0x9ac3('0x3c')]},'required':!![]});_0xa181db[_0x9ac3('0x3f')]=!![];}if(_0x14b1d7[_0x9ac3('0x2a')][_0x9ac3('0x40')]){_0xa181db[_0x9ac3('0x3b')][_0x9ac3('0x41')]({'model':db['SmsMessage'],'as':'Messages','attributes':['id',_0x9ac3('0x42'),_0x9ac3('0x43'),'read'],'where':{'direction':'in','read':_0x14b1d7['query'][_0x9ac3('0x40')]||![]},'required':!![]});_0xa181db['distinct']=!![];}return db['SmsInteraction'][_0x9ac3('0x1b')](_0xa181db)[_0x9ac3('0x20')](function(_0x320392){_0x916dd0['count']=_0x320392;if(_0x14b1d7['query'][_0x9ac3('0x44')]){_0x3c3d23[_0x9ac3('0x3b')]=[{'model':db['User'],'as':_0x9ac3('0x45'),'required':![],'attributes':['id',_0x9ac3('0x23'),'fullname']},{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['User'],'as':_0x9ac3('0x46'),'attributes':[_0x9ac3('0x23'),_0x9ac3('0x47'),_0x9ac3('0x48')],'required':![]},{'model':db[_0x9ac3('0x49')],'as':_0x9ac3('0x4a'),'attributes':['name',_0x9ac3('0x4b')],'required':![]},{'model':db['SmsMessage'],'as':_0x9ac3('0x4c'),'attributes':['id',_0x9ac3('0x42'),_0x9ac3('0x43'),_0x9ac3('0x40')],'where':{'direction':'in','read':_0x14b1d7['query'][_0x9ac3('0x40')]||![]},'required':_0x14b1d7[_0x9ac3('0x2a')][_0x9ac3('0x40')]||![]},{'model':db[_0x9ac3('0x3d')],'as':_0x9ac3('0x3e'),'attributes':['id',_0x9ac3('0x23'),_0x9ac3('0x4d')],'required':_0x14b1d7[_0x9ac3('0x2a')][_0x9ac3('0x3c')]?!![]:![]},{'model':db['Tag'],'as':'ThroughTags','attributes':['id',_0x9ac3('0x23'),_0x9ac3('0x4d')],'through':_0x14b1d7['query']['tag']?{'attributes':[],'where':{'TagId':_0x14b1d7[_0x9ac3('0x2a')][_0x9ac3('0x3c')]||undefined}}:{},'required':_0x14b1d7[_0x9ac3('0x2a')]['tag']?!![]:![]}];}return db['SmsInteraction'][_0x9ac3('0x4e')](_0x3c3d23);})[_0x9ac3('0x20')](function(_0x4e1c48){_0x916dd0[_0x9ac3('0x4f')]=_0x4e1c48;return _0x916dd0;})[_0x9ac3('0x20')](respondWithFilteredResult(_0x46a51e,_0x3c3d23))[_0x9ac3('0x50')](handleError(_0x46a51e,null));};exports[_0x9ac3('0x51')]=function(_0x2a5126,_0x2f9c32){var _0x27bf85={'raw':![],'where':{'id':_0x2a5126[_0x9ac3('0x52')]['id']}},_0x256807={};_0x256807['model']=_['keys'](db[_0x9ac3('0x26')]['rawAttributes']);_0x256807['query']=_[_0x9ac3('0x29')](_0x2a5126[_0x9ac3('0x2a')]);_0x256807[_0x9ac3('0x2c')]=_['intersection'](_0x256807[_0x9ac3('0x28')],_0x256807['query']);_0x27bf85[_0x9ac3('0x2d')]=_[_0x9ac3('0x2e')](_0x256807[_0x9ac3('0x28')],qs[_0x9ac3('0x2f')](_0x2a5126['query'][_0x9ac3('0x2f')]));_0x27bf85[_0x9ac3('0x2d')]=_0x27bf85[_0x9ac3('0x2d')][_0x9ac3('0x30')]?_0x27bf85[_0x9ac3('0x2d')]:_0x256807['model'];if(_0x2a5126[_0x9ac3('0x2a')][_0x9ac3('0x44')]){_0x27bf85[_0x9ac3('0x3b')]=[{'all':!![]}];}_0x27bf85=_['merge']({},_0x27bf85,_0x2a5126['options']);return db[_0x9ac3('0x26')][_0x9ac3('0x53')](_0x27bf85)[_0x9ac3('0x20')](handleEntityNotFound(_0x2f9c32,null))['then'](respondWithResult(_0x2f9c32,null))['catch'](handleError(_0x2f9c32,null));};exports[_0x9ac3('0x54')]=function(_0xbc5a03,_0x336d5f){return db[_0x9ac3('0x26')][_0x9ac3('0x54')](_0xbc5a03[_0x9ac3('0x55')],{})[_0x9ac3('0x20')](respondWithResult(_0x336d5f,0xc9))['catch'](handleError(_0x336d5f,null));};exports['update']=function(_0x26c6ef,_0x3be8a7){if(_0x26c6ef[_0x9ac3('0x55')]['id']){delete _0x26c6ef[_0x9ac3('0x55')]['id'];}return db[_0x9ac3('0x26')]['find']({'where':{'id':_0x26c6ef[_0x9ac3('0x52')]['id']}})[_0x9ac3('0x20')](handleEntityNotFound(_0x3be8a7,null))[_0x9ac3('0x20')](saveUpdates(_0x26c6ef[_0x9ac3('0x55')],null))[_0x9ac3('0x20')](respondWithResult(_0x3be8a7,null))[_0x9ac3('0x50')](handleError(_0x3be8a7,null));};exports['destroy']=function(_0x1b7c74,_0x41058f){return db[_0x9ac3('0x26')]['find']({'where':{'id':_0x1b7c74[_0x9ac3('0x52')]['id']}})[_0x9ac3('0x20')](handleEntityNotFound(_0x41058f,null))[_0x9ac3('0x20')](removeEntity(_0x41058f,null))[_0x9ac3('0x50')](handleError(_0x41058f,null));};exports['describe']=function(_0x19a9f9,_0x3a1ba3){return db[_0x9ac3('0x26')][_0x9ac3('0x56')]()[_0x9ac3('0x20')](respondWithResult(_0x3a1ba3,null))[_0x9ac3('0x50')](handleError(_0x3a1ba3,null));};exports[_0x9ac3('0x57')]=function(_0x1e9bd1,_0x237b20,_0x4c7b9b){return db[_0x9ac3('0x58')][_0x9ac3('0x53')]({'where':{'id':_0x1e9bd1[_0x9ac3('0x52')]['id']}})['then'](handleEntityNotFound(_0x237b20,null))['then'](function(_0x3d3426){if(_0x3d3426){return _0x3d3426['addMessage'](_0x1e9bd1[_0x9ac3('0x55')][_0x9ac3('0x59')],_['omit'](_0x1e9bd1['body'],[_0x9ac3('0x59'),'id'])||{});}})['then'](respondWithResult(_0x237b20,null))[_0x9ac3('0x50')](handleError(_0x237b20,null));};exports[_0x9ac3('0x5a')]=function(_0x3c7c5e,_0x1ba32a,_0x400a8f){var _0x34c433={'raw':![],'where':{}};var _0x519d7a={};var _0x43dda4={'count':0x0,'rows':[]};return db[_0x9ac3('0x26')][_0x9ac3('0x5b')]({'where':{'id':_0x3c7c5e[_0x9ac3('0x52')]['id']}})['then'](handleEntityNotFound(_0x1ba32a,null))[_0x9ac3('0x20')](function(_0x38b8bd){if(_0x38b8bd){_0x519d7a['model']=_[_0x9ac3('0x29')](db['SmsMessage'][_0x9ac3('0x27')]);_0x519d7a[_0x9ac3('0x2a')]=_[_0x9ac3('0x29')](_0x3c7c5e['query']);_0x519d7a['filters']=_['intersection'](_0x519d7a[_0x9ac3('0x28')],_0x519d7a[_0x9ac3('0x2a')]);_0x34c433[_0x9ac3('0x2d')]=_[_0x9ac3('0x2e')](_0x519d7a[_0x9ac3('0x28')],qs['fields'](_0x3c7c5e[_0x9ac3('0x2a')]['fields']));_0x34c433[_0x9ac3('0x2d')]=_0x34c433[_0x9ac3('0x2d')]['length']?_0x34c433[_0x9ac3('0x2d')]:_0x519d7a[_0x9ac3('0x28')];if(!_0x3c7c5e[_0x9ac3('0x2a')]['hasOwnProperty'](_0x9ac3('0x5c'))){_0x34c433['limit']=qs['limit'](_0x3c7c5e[_0x9ac3('0x2a')][_0x9ac3('0x1d')]);_0x34c433['offset']=qs[_0x9ac3('0x1c')](_0x3c7c5e[_0x9ac3('0x2a')][_0x9ac3('0x1c')]);}_0x34c433[_0x9ac3('0x31')]=qs[_0x9ac3('0x32')](_0x3c7c5e[_0x9ac3('0x2a')][_0x9ac3('0x32')]);_0x34c433[_0x9ac3('0x38')]=qs[_0x9ac3('0x2c')](_['pick'](_0x3c7c5e[_0x9ac3('0x2a')],_0x519d7a[_0x9ac3('0x2c')]));_0x34c433['where'][_0x9ac3('0x5d')]=_0x38b8bd['id'];if(_0x3c7c5e[_0x9ac3('0x2a')][_0x9ac3('0x39')]){_0x34c433[_0x9ac3('0x38')]=_['merge'](_0x34c433[_0x9ac3('0x38')],{'$or':_[_0x9ac3('0x5e')](_0x34c433[_0x9ac3('0x2d')],function(_0x24eea2){var _0x3f81ae={};_0x3f81ae[_0x24eea2]={'$like':'%'+_0x3c7c5e[_0x9ac3('0x2a')][_0x9ac3('0x39')]+'%'};return _0x3f81ae;})});}if(_0x3c7c5e[_0x9ac3('0x2a')][_0x9ac3('0x5f')]){var _0x4b8751=_0x3c7c5e[_0x9ac3('0x2a')][_0x9ac3('0x5f')][_0x9ac3('0x60')](',');var _0x437b5f={};_0x437b5f[_0x4b8751[0x0]]={'$gte':moment(_0x4b8751[0x1])['format'](_0x9ac3('0x61'))};_0x34c433['where']=_['merge'](_0x34c433[_0x9ac3('0x38')],_0x437b5f);}_0x34c433=_['merge']({},_0x34c433,_0x3c7c5e[_0x9ac3('0x3a')]);return db[_0x9ac3('0x58')]['count']({'where':_0x34c433[_0x9ac3('0x38')]})[_0x9ac3('0x20')](function(_0x40db2a){_0x43dda4['count']=_0x40db2a;if(_0x3c7c5e[_0x9ac3('0x2a')][_0x9ac3('0x44')]){_0x34c433[_0x9ac3('0x3b')]=[{'all':!![]}];}return db[_0x9ac3('0x58')]['findAll'](_0x34c433);})[_0x9ac3('0x20')](function(_0x223c44){_0x43dda4[_0x9ac3('0x4f')]=_0x223c44;return _0x43dda4;});}})['then'](respondWithFilteredResult(_0x1ba32a,_0x34c433))[_0x9ac3('0x50')](handleError(_0x1ba32a,null));};exports[_0x9ac3('0x62')]=function(_0x20e0e0,_0xe6ae3c,_0x17ec7c){return db[_0x9ac3('0x26')][_0x9ac3('0x53')]({'where':{'id':_0x20e0e0[_0x9ac3('0x52')]['id']}})['then'](handleEntityNotFound(_0xe6ae3c,null))[_0x9ac3('0x20')](function(_0x4984cc){if(_0x4984cc){return _0x4984cc['setTags'](_0x20e0e0['body'][_0x9ac3('0x59')],_[_0x9ac3('0x63')](_0x20e0e0[_0x9ac3('0x55')],[_0x9ac3('0x59'),'id'])||{})[_0x9ac3('0x64')](function(){return db[_0x9ac3('0x3d')][_0x9ac3('0x4e')]({'attributes':['id',_0x9ac3('0x23'),_0x9ac3('0x4d')],'where':{'id':_0x20e0e0[_0x9ac3('0x55')][_0x9ac3('0x59')]}});})[_0x9ac3('0x20')](function(_0x6ddab2){socket[_0x9ac3('0x65')](_0x9ac3('0x66'),{'id':Number(_0x20e0e0[_0x9ac3('0x52')]['id']),'tags':_0x6ddab2||[]});return{'id':Number(_0x20e0e0[_0x9ac3('0x52')]['id']),'tags':_0x6ddab2||[]};});}})[_0x9ac3('0x20')](respondWithResult(_0xe6ae3c,null))[_0x9ac3('0x50')](handleError(_0xe6ae3c,null));};exports[_0x9ac3('0x67')]=function(_0x46f121,_0x17d264,_0x2acc1c){var _0x4c0104;return db[_0x9ac3('0x26')][_0x9ac3('0x53')]({'where':{'id':_0x46f121[_0x9ac3('0x52')]['id']}})['then'](handleEntityNotFound(_0x17d264,null))[_0x9ac3('0x20')](function(_0x3eb15e){if(_0x3eb15e){return _0x3eb15e['removeTags'](_0x46f121[_0x9ac3('0x2a')]['ids']);}})[_0x9ac3('0x20')](respondWithStatusCode(_0x17d264,null))[_0x9ac3('0x50')](handleError(_0x17d264,null));};exports[_0x9ac3('0x68')]=function(_0x58ff14,_0x52565a){var _0x686b84=moment()[_0x9ac3('0x69')]()[_0x9ac3('0x6a')]();var _0x42271d=path[_0x9ac3('0x6b')](config[_0x9ac3('0x6c')],_0x9ac3('0x6d'),_0x9ac3('0x6e'),_0x9ac3('0x6f'));var _0x39314f=path[_0x9ac3('0x6b')](config['root'],_0x9ac3('0x6d'),_0x9ac3('0x6e'),_0x9ac3('0x70'));var _0x1d9646=path[_0x9ac3('0x6b')](_0x42271d,_0x686b84);var _0x1fbaf0=util[_0x9ac3('0x71')](_0x9ac3('0x72'),_0x686b84);var _0x23dfc9=path[_0x9ac3('0x6b')](_0x42271d,_0x1fbaf0);var _0x14b5d0=![];return db['SmsInteraction'][_0x9ac3('0x53')]({'where':{'id':_0x58ff14[_0x9ac3('0x52')]['id']},'include':[{'model':db[_0x9ac3('0x58')],'as':'Messages','attributes':['id',_0x9ac3('0x55')],'include':[{'model':db[_0x9ac3('0x73')],'as':_0x9ac3('0x73'),'attributes':['id',_0x9ac3('0x47')],'raw':!![]},{'model':db[_0x9ac3('0x74')],'as':_0x9ac3('0x75'),'attributes':['id',_0x9ac3('0x76')],'raw':!![]}]}]})[_0x9ac3('0x20')](handleEntityNotFound(_0x52565a,null))[_0x9ac3('0x20')](function(_0x5a1ae9){if(_0x5a1ae9){_0x14b5d0=!![];var _0x48b7da='';var _0x4f5dda={'format':'Letter','border':_0x9ac3('0x77')};fs[_0x9ac3('0x78')](_0x1d9646);_0x48b7da+=util['format'](_0x9ac3('0x79'),_0x5a1ae9['id']);_0x48b7da+=util['format'](_0x9ac3('0x7a'),moment()[_0x9ac3('0x71')](_0x9ac3('0x7b'))[_0x9ac3('0x6a')]());_0x48b7da+=_0x9ac3('0x7c');for(var _0x1cd43b=0x0;_0x1cd43b<_0x5a1ae9[_0x9ac3('0x4c')][_0x9ac3('0x30')];_0x1cd43b++){var _0x2a588c=_0x5a1ae9[_0x9ac3('0x4c')][_0x1cd43b];_0x48b7da+=_0x9ac3('0x7d');_0x48b7da+=util['format'](_0x9ac3('0x7e'),_0x2a588c['User']?_0x2a588c[_0x9ac3('0x73')][_0x9ac3('0x47')]:_0x2a588c[_0x9ac3('0x75')]['firstName'],_0x2a588c[_0x9ac3('0x55')]);_0x48b7da+=_0x9ac3('0x7f');}return new BPromise(function(_0x118f3b,_0x1318b1){pdf[_0x9ac3('0x54')](_0x48b7da,_0x4f5dda)[_0x9ac3('0x80')](path['join'](_0x1d9646,_0x9ac3('0x81')+_0x686b84+_0x9ac3('0x82')),function(_0x1a64ee,_0xcc34ad){if(_0x1a64ee)return _0x1318b1(_0x1a64ee);_0x118f3b(_0xcc34ad);});});}})[_0x9ac3('0x20')](function(){if(_0x14b5d0){return new BPromise(function(_0x1bdad5,_0x3d4387){zipdir(_0x1d9646,{'saveTo':_0x23dfc9},function(_0x42561d,_0x36ac45){if(_0x42561d)return _0x3d4387(_0x42561d);return _0x1bdad5(_0x36ac45);});});}})[_0x9ac3('0x20')](function(){if(_0x14b5d0){return new BPromise(function(_0xf261a3,_0x196cb2){rimraf(_0x1d9646,function(_0x84e2e3){if(_0x84e2e3)_0x196cb2(_0x84e2e3);return _0xf261a3();});});}})[_0x9ac3('0x20')](function(){if(_0x14b5d0){return _0x52565a[_0x9ac3('0x68')](_0x23dfc9,_0x1fbaf0,function(_0x5bbbd7){if(_0x5bbbd7){console['log'](_0x9ac3('0x83'),_0x5bbbd7);}else{fs['unlinkSync'](_0x23dfc9);}});}else{return _0x52565a['sendStatus'](0xc8);}})[_0x9ac3('0x50')](handleError(_0x52565a,null));}; \ No newline at end of file +var _0x22fd=['log','err','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','end','status','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','SmsInteraction','rawAttributes','model','keys','query','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','dateStart','add','day','merge','filter','where','include','tag','push','Tag','Tags','distinct','SmsMessage','Messages','direction','createdAt','read','includeAll','User','Users','CmContact','Contact','Owner','fullname','internal','Account','key','catch','show','params','length','options','find','create','body','describe','addMessage','ids','findOne','nolimit','SmsInteractionId','map','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','omit','emit','smsInteractionTags:save','removeTags','unix','toString','join','root','server','files','tmp','attachments','interaction-%s.zip','firstName','Letter','1cm','mkdirSync','

Sms\x20Interaction:\x20#%d

','

Date:\x20%s

','MMMM\x20Do\x20YYYY,\x20HH:mm:ss','','%s:\x20%s

','','interaction-','.pdf','download'];(function(_0x54e726,_0x5f287e){var _0x3c7f61=function(_0x269273){while(--_0x269273){_0x54e726['push'](_0x54e726['shift']());}};_0x3c7f61(++_0x5f287e);}(_0x22fd,0x19d));var _0xd22f=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x22fd[_0x255d5b];return _0x3e141a;};'use strict';var pdf=require(_0xd22f('0x0'));var emlformat=require(_0xd22f('0x1'));var rimraf=require(_0xd22f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd22f('0x3'));var rp=require(_0xd22f('0x4'));var moment=require(_0xd22f('0x5'));var BPromise=require(_0xd22f('0x6'));var Mustache=require(_0xd22f('0x7'));var util=require(_0xd22f('0x8'));var path=require(_0xd22f('0x9'));var sox=require(_0xd22f('0xa'));var csv=require(_0xd22f('0xb'));var ejs=require(_0xd22f('0xc'));var fs=require('fs');var _=require(_0xd22f('0xd'));var squel=require(_0xd22f('0xe'));var crypto=require(_0xd22f('0xf'));var jsforce=require(_0xd22f('0x10'));var deskjs=require(_0xd22f('0x11'));var toCsv=require(_0xd22f('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd22f('0x12'));var qs=require(_0xd22f('0x13'));var logger=require(_0xd22f('0x14'))(_0xd22f('0x15'));var utils=require(_0xd22f('0x16'));var config=require('../../config/environment');var db=require(_0xd22f('0x17'))['db'];config[_0xd22f('0x18')]=_[_0xd22f('0x19')](config[_0xd22f('0x18')],{'host':_0xd22f('0x1a'),'port':0x18eb});var socket=require(_0xd22f('0x1b'))(new Redis(config[_0xd22f('0x18')]));require(_0xd22f('0x1c'))[_0xd22f('0x1d')](socket);function respondWithStatusCode(_0x316652,_0xea598c){_0xea598c=_0xea598c||0xcc;return function(_0x11c6a9){if(_0x11c6a9){return _0x316652[_0xd22f('0x1e')](_0xea598c);}return _0x316652['status'](_0xea598c)[_0xd22f('0x1f')]();};}function respondWithResult(_0x159bb4,_0x2e8665){_0x2e8665=_0x2e8665||0xc8;return function(_0x5a6b5b){if(_0x5a6b5b){return _0x159bb4[_0xd22f('0x20')](_0x2e8665)[_0xd22f('0x21')](_0x5a6b5b);}};}function respondWithFilteredResult(_0x184171,_0x210eb1){return function(_0x1aa390){if(_0x1aa390){var _0x296be6=_0x1aa390[_0xd22f('0x22')],_0x2b7075=_0x210eb1[_0xd22f('0x23')],_0x1a6ed9=_0x210eb1['offset']+_0x210eb1['limit'],_0x175bb2;if(_0x1a6ed9>=_0x296be6){_0x1a6ed9=_0x296be6;_0x175bb2=0xc8;}else{_0x175bb2=0xce;}_0x184171[_0xd22f('0x20')](_0x175bb2);return _0x184171['set'](_0xd22f('0x24'),_0x2b7075+'-'+_0x1a6ed9+'/'+_0x296be6)[_0xd22f('0x21')](_0x1aa390);}return null;};}function patchUpdates(_0x3d0013){return function(_0x32bd8a){try{jsonpatch[_0xd22f('0x25')](_0x32bd8a,_0x3d0013,!![]);}catch(_0x55c068){return BPromise[_0xd22f('0x26')](_0x55c068);}return _0x32bd8a[_0xd22f('0x27')]();};}function saveUpdates(_0x5c7404,_0x2d0d53){return function(_0x380368){if(_0x380368){return _0x380368[_0xd22f('0x28')](_0x5c7404)[_0xd22f('0x29')](function(_0x458c26){return _0x458c26;});}return null;};}function removeEntity(_0x4d8a90,_0x109029){return function(_0x4b36c1){if(_0x4b36c1){return _0x4b36c1[_0xd22f('0x2a')]()[_0xd22f('0x29')](function(){_0x4d8a90[_0xd22f('0x20')](0xcc)[_0xd22f('0x1f')]();});}};}function handleEntityNotFound(_0x1b453b,_0x3e08e3){return function(_0x1551f7){if(!_0x1551f7){_0x1b453b[_0xd22f('0x1e')](0x194);}return _0x1551f7;};}function handleError(_0x4b3470,_0x2dfe99){_0x2dfe99=_0x2dfe99||0x1f4;return function(_0x59005d){logger[_0xd22f('0x2b')](_0x59005d[_0xd22f('0x2c')]);if(_0x59005d[_0xd22f('0x2d')]){delete _0x59005d['name'];}_0x4b3470[_0xd22f('0x20')](_0x2dfe99)[_0xd22f('0x2e')](_0x59005d);};}exports[_0xd22f('0x2f')]=function(_0xe3f1ea,_0x52f844){var _0x4a0bbd={},_0x7fc7ff={},_0x5d05d4={'count':0x0,'rows':[]};var _0x13375=db[_0xd22f('0x30')][_0xd22f('0x31')];_0x7fc7ff[_0xd22f('0x32')]=_[_0xd22f('0x33')](_0x13375);var _0x2501bf={'dateStart':_0xe3f1ea[_0xd22f('0x34')]['dateStart'],'dateEnd':_0xe3f1ea[_0xd22f('0x34')]['dateEnd']};delete _0xe3f1ea[_0xd22f('0x34')]['dateStart'];delete _0xe3f1ea[_0xd22f('0x34')][_0xd22f('0x35')];_0x7fc7ff[_0xd22f('0x34')]=_[_0xd22f('0x33')](_0xe3f1ea[_0xd22f('0x34')]);_0x7fc7ff[_0xd22f('0x36')]=_[_0xd22f('0x37')](_0x7fc7ff[_0xd22f('0x32')],_0x7fc7ff[_0xd22f('0x34')]);_0x4a0bbd[_0xd22f('0x38')]=_[_0xd22f('0x37')](_0x7fc7ff[_0xd22f('0x32')],qs[_0xd22f('0x39')](_0xe3f1ea[_0xd22f('0x34')]['fields']));_0x4a0bbd[_0xd22f('0x38')]=_0x4a0bbd['attributes']['length']?_0x4a0bbd[_0xd22f('0x38')]:_0x7fc7ff[_0xd22f('0x32')];if(!_0xe3f1ea['query'][_0xd22f('0x3a')]('nolimit')){_0x4a0bbd[_0xd22f('0x3b')]=qs['limit'](_0xe3f1ea[_0xd22f('0x34')][_0xd22f('0x3b')]);_0x4a0bbd['offset']=qs[_0xd22f('0x23')](_0xe3f1ea[_0xd22f('0x34')]['offset']);}_0x4a0bbd[_0xd22f('0x3c')]=qs[_0xd22f('0x3d')](_0xe3f1ea[_0xd22f('0x34')]['sort']);_0x4a0bbd['where']=qs[_0xd22f('0x36')](_['pick'](_0xe3f1ea[_0xd22f('0x34')],_0x7fc7ff['filters']));if(_0x2501bf[_0xd22f('0x3e')]){if(_0x2501bf[_0xd22f('0x35')]){_0x2501bf[_0xd22f('0x35')]=moment(_0x2501bf[_0xd22f('0x35')])[_0xd22f('0x3f')](0x1,_0xd22f('0x40'));}else{_0x2501bf[_0xd22f('0x35')]=moment(_0x2501bf[_0xd22f('0x3e')])['add'](0x1,_0xd22f('0x40'));}_[_0xd22f('0x41')](_0x4a0bbd['where'],{'createdAt':{'$gte':_0x2501bf[_0xd22f('0x3e')],'$lte':_0x2501bf[_0xd22f('0x35')]}});}if(_0xe3f1ea[_0xd22f('0x34')][_0xd22f('0x42')]){_0x4a0bbd[_0xd22f('0x43')]=_[_0xd22f('0x41')](_0x4a0bbd[_0xd22f('0x43')],{'$or':_['map'](_0x4a0bbd['attributes'],function(_0x2d8c90){var _0x217f83={};_0x217f83[_0x2d8c90]={'$like':'%'+_0xe3f1ea[_0xd22f('0x34')][_0xd22f('0x42')]+'%'};return _0x217f83;})});}_0x4a0bbd=_[_0xd22f('0x41')]({},_0x4a0bbd,_0xe3f1ea['options']);var _0x20cb77={'where':_0x4a0bbd[_0xd22f('0x43')]};_0x20cb77[_0xd22f('0x44')]=[];if(_0xe3f1ea[_0xd22f('0x34')][_0xd22f('0x45')]){_0x20cb77[_0xd22f('0x44')][_0xd22f('0x46')]({'model':db[_0xd22f('0x47')],'as':_0xd22f('0x48'),'attributes':['id'],'where':{'id':_0xe3f1ea[_0xd22f('0x34')][_0xd22f('0x45')]},'required':!![]});_0x20cb77[_0xd22f('0x49')]=!![];}if(_0xe3f1ea['query']['read']){_0x20cb77['include'][_0xd22f('0x46')]({'model':db[_0xd22f('0x4a')],'as':_0xd22f('0x4b'),'attributes':['id',_0xd22f('0x4c'),_0xd22f('0x4d'),_0xd22f('0x4e')],'where':{'direction':'in','read':_0xe3f1ea[_0xd22f('0x34')]['read']||![]},'required':!![]});_0x20cb77[_0xd22f('0x49')]=!![];}return db[_0xd22f('0x30')][_0xd22f('0x22')](_0x20cb77)[_0xd22f('0x29')](function(_0x3e8d37){_0x5d05d4[_0xd22f('0x22')]=_0x3e8d37;if(_0xe3f1ea['query'][_0xd22f('0x4f')]){_0x4a0bbd[_0xd22f('0x44')]=[{'model':db[_0xd22f('0x50')],'as':_0xd22f('0x51'),'required':![],'attributes':['id',_0xd22f('0x2d'),'fullname']},{'model':db[_0xd22f('0x52')],'as':_0xd22f('0x53'),'required':![]},{'model':db[_0xd22f('0x50')],'as':_0xd22f('0x54'),'attributes':[_0xd22f('0x2d'),_0xd22f('0x55'),_0xd22f('0x56')],'required':![]},{'model':db['SmsAccount'],'as':_0xd22f('0x57'),'attributes':[_0xd22f('0x2d'),_0xd22f('0x58')],'required':![]},{'model':db['SmsMessage'],'as':_0xd22f('0x4b'),'attributes':['id',_0xd22f('0x4c'),'createdAt',_0xd22f('0x4e')],'where':{'direction':'in','read':_0xe3f1ea[_0xd22f('0x34')][_0xd22f('0x4e')]||![]},'required':_0xe3f1ea[_0xd22f('0x34')]['read']||![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xd22f('0x2d'),'color'],'required':_0xe3f1ea[_0xd22f('0x34')]['tag']?!![]:![]},{'model':db['Tag'],'as':'ThroughTags','attributes':['id',_0xd22f('0x2d'),'color'],'through':_0xe3f1ea[_0xd22f('0x34')][_0xd22f('0x45')]?{'attributes':[],'where':{'TagId':_0xe3f1ea[_0xd22f('0x34')][_0xd22f('0x45')]||undefined}}:{},'required':_0xe3f1ea[_0xd22f('0x34')][_0xd22f('0x45')]?!![]:![]}];}return db[_0xd22f('0x30')]['findAll'](_0x4a0bbd);})[_0xd22f('0x29')](function(_0x58c935){_0x5d05d4['rows']=_0x58c935;return _0x5d05d4;})[_0xd22f('0x29')](respondWithFilteredResult(_0x52f844,_0x4a0bbd))[_0xd22f('0x59')](handleError(_0x52f844,null));};exports[_0xd22f('0x5a')]=function(_0x6443bd,_0x26694f){var _0x12c0e7={'raw':![],'where':{'id':_0x6443bd[_0xd22f('0x5b')]['id']}},_0x2c224={};_0x2c224[_0xd22f('0x32')]=_['keys'](db[_0xd22f('0x30')]['rawAttributes']);_0x2c224[_0xd22f('0x34')]=_[_0xd22f('0x33')](_0x6443bd[_0xd22f('0x34')]);_0x2c224['filters']=_[_0xd22f('0x37')](_0x2c224[_0xd22f('0x32')],_0x2c224[_0xd22f('0x34')]);_0x12c0e7[_0xd22f('0x38')]=_[_0xd22f('0x37')](_0x2c224['model'],qs[_0xd22f('0x39')](_0x6443bd[_0xd22f('0x34')][_0xd22f('0x39')]));_0x12c0e7[_0xd22f('0x38')]=_0x12c0e7[_0xd22f('0x38')][_0xd22f('0x5c')]?_0x12c0e7[_0xd22f('0x38')]:_0x2c224[_0xd22f('0x32')];if(_0x6443bd[_0xd22f('0x34')][_0xd22f('0x4f')]){_0x12c0e7[_0xd22f('0x44')]=[{'all':!![]}];}_0x12c0e7=_[_0xd22f('0x41')]({},_0x12c0e7,_0x6443bd[_0xd22f('0x5d')]);return db['SmsInteraction'][_0xd22f('0x5e')](_0x12c0e7)['then'](handleEntityNotFound(_0x26694f,null))[_0xd22f('0x29')](respondWithResult(_0x26694f,null))[_0xd22f('0x59')](handleError(_0x26694f,null));};exports['create']=function(_0x14d090,_0x4e3b39){return db[_0xd22f('0x30')][_0xd22f('0x5f')](_0x14d090[_0xd22f('0x60')],{})[_0xd22f('0x29')](respondWithResult(_0x4e3b39,0xc9))[_0xd22f('0x59')](handleError(_0x4e3b39,null));};exports[_0xd22f('0x28')]=function(_0x227bd5,_0x1588fe){if(_0x227bd5[_0xd22f('0x60')]['id']){delete _0x227bd5[_0xd22f('0x60')]['id'];}return db[_0xd22f('0x30')][_0xd22f('0x5e')]({'where':{'id':_0x227bd5[_0xd22f('0x5b')]['id']}})[_0xd22f('0x29')](handleEntityNotFound(_0x1588fe,null))['then'](saveUpdates(_0x227bd5[_0xd22f('0x60')],null))[_0xd22f('0x29')](respondWithResult(_0x1588fe,null))[_0xd22f('0x59')](handleError(_0x1588fe,null));};exports['destroy']=function(_0x3782b4,_0x2c8dea){return db[_0xd22f('0x30')][_0xd22f('0x5e')]({'where':{'id':_0x3782b4[_0xd22f('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2c8dea,null))[_0xd22f('0x29')](removeEntity(_0x2c8dea,null))[_0xd22f('0x59')](handleError(_0x2c8dea,null));};exports[_0xd22f('0x61')]=function(_0x3e4509,_0x3fa551){return db[_0xd22f('0x30')][_0xd22f('0x61')]()[_0xd22f('0x29')](respondWithResult(_0x3fa551,null))[_0xd22f('0x59')](handleError(_0x3fa551,null));};exports[_0xd22f('0x62')]=function(_0x460012,_0x3700d2,_0xff7f19){return db[_0xd22f('0x4a')][_0xd22f('0x5e')]({'where':{'id':_0x460012[_0xd22f('0x5b')]['id']}})[_0xd22f('0x29')](handleEntityNotFound(_0x3700d2,null))[_0xd22f('0x29')](function(_0x187f14){if(_0x187f14){return _0x187f14[_0xd22f('0x62')](_0x460012[_0xd22f('0x60')]['ids'],_['omit'](_0x460012[_0xd22f('0x60')],[_0xd22f('0x63'),'id'])||{});}})[_0xd22f('0x29')](respondWithResult(_0x3700d2,null))[_0xd22f('0x59')](handleError(_0x3700d2,null));};exports['getMessages']=function(_0x6f3101,_0x4929b6,_0x109727){var _0x50f4ad={'raw':![],'where':{}};var _0x5c5d01={};var _0x4ac3c4={'count':0x0,'rows':[]};return db[_0xd22f('0x30')][_0xd22f('0x64')]({'where':{'id':_0x6f3101[_0xd22f('0x5b')]['id']}})[_0xd22f('0x29')](handleEntityNotFound(_0x4929b6,null))['then'](function(_0xd958c1){if(_0xd958c1){_0x5c5d01[_0xd22f('0x32')]=_[_0xd22f('0x33')](db[_0xd22f('0x4a')][_0xd22f('0x31')]);_0x5c5d01['query']=_[_0xd22f('0x33')](_0x6f3101[_0xd22f('0x34')]);_0x5c5d01[_0xd22f('0x36')]=_[_0xd22f('0x37')](_0x5c5d01[_0xd22f('0x32')],_0x5c5d01[_0xd22f('0x34')]);_0x50f4ad[_0xd22f('0x38')]=_[_0xd22f('0x37')](_0x5c5d01[_0xd22f('0x32')],qs[_0xd22f('0x39')](_0x6f3101[_0xd22f('0x34')][_0xd22f('0x39')]));_0x50f4ad[_0xd22f('0x38')]=_0x50f4ad[_0xd22f('0x38')][_0xd22f('0x5c')]?_0x50f4ad[_0xd22f('0x38')]:_0x5c5d01[_0xd22f('0x32')];if(!_0x6f3101[_0xd22f('0x34')][_0xd22f('0x3a')](_0xd22f('0x65'))){_0x50f4ad[_0xd22f('0x3b')]=qs[_0xd22f('0x3b')](_0x6f3101[_0xd22f('0x34')][_0xd22f('0x3b')]);_0x50f4ad[_0xd22f('0x23')]=qs[_0xd22f('0x23')](_0x6f3101[_0xd22f('0x34')]['offset']);}_0x50f4ad[_0xd22f('0x3c')]=qs[_0xd22f('0x3d')](_0x6f3101[_0xd22f('0x34')]['sort']);_0x50f4ad['where']=qs[_0xd22f('0x36')](_['pick'](_0x6f3101['query'],_0x5c5d01[_0xd22f('0x36')]));_0x50f4ad[_0xd22f('0x43')][_0xd22f('0x66')]=_0xd958c1['id'];if(_0x6f3101[_0xd22f('0x34')][_0xd22f('0x42')]){_0x50f4ad['where']=_['merge'](_0x50f4ad[_0xd22f('0x43')],{'$or':_[_0xd22f('0x67')](_0x50f4ad[_0xd22f('0x38')],function(_0x1e0c9d){var _0x3e8ed4={};_0x3e8ed4[_0x1e0c9d]={'$like':'%'+_0x6f3101['query'][_0xd22f('0x42')]+'%'};return _0x3e8ed4;})});}if(_0x6f3101['query']['$gte']){var _0x56d62b=_0x6f3101[_0xd22f('0x34')]['$gte'][_0xd22f('0x68')](',');var _0x192fb3={};_0x192fb3[_0x56d62b[0x0]]={'$gte':moment(_0x56d62b[0x1])[_0xd22f('0x69')](_0xd22f('0x6a'))};_0x50f4ad[_0xd22f('0x43')]=_[_0xd22f('0x41')](_0x50f4ad['where'],_0x192fb3);}_0x50f4ad=_[_0xd22f('0x41')]({},_0x50f4ad,_0x6f3101[_0xd22f('0x5d')]);return db[_0xd22f('0x4a')][_0xd22f('0x22')]({'where':_0x50f4ad[_0xd22f('0x43')]})['then'](function(_0x3c3435){_0x4ac3c4[_0xd22f('0x22')]=_0x3c3435;if(_0x6f3101[_0xd22f('0x34')][_0xd22f('0x4f')]){_0x50f4ad[_0xd22f('0x44')]=[{'all':!![]}];}return db[_0xd22f('0x4a')][_0xd22f('0x6b')](_0x50f4ad);})[_0xd22f('0x29')](function(_0x5143e6){_0x4ac3c4['rows']=_0x5143e6;return _0x4ac3c4;});}})['then'](respondWithFilteredResult(_0x4929b6,_0x50f4ad))[_0xd22f('0x59')](handleError(_0x4929b6,null));};exports['addTags']=function(_0xa6265d,_0x4b767b,_0x20d39b){return db[_0xd22f('0x30')]['find']({'where':{'id':_0xa6265d[_0xd22f('0x5b')]['id']}})[_0xd22f('0x29')](handleEntityNotFound(_0x4b767b,null))[_0xd22f('0x29')](function(_0x468b4c){if(_0x468b4c){return _0x468b4c[_0xd22f('0x6c')](_0xa6265d[_0xd22f('0x60')][_0xd22f('0x63')],_[_0xd22f('0x6d')](_0xa6265d[_0xd22f('0x60')],['ids','id'])||{})['spread'](function(){return db[_0xd22f('0x47')][_0xd22f('0x6b')]({'attributes':['id',_0xd22f('0x2d'),'color'],'where':{'id':_0xa6265d[_0xd22f('0x60')][_0xd22f('0x63')]}});})[_0xd22f('0x29')](function(_0x58363b){socket[_0xd22f('0x6e')](_0xd22f('0x6f'),{'id':Number(_0xa6265d[_0xd22f('0x5b')]['id']),'tags':_0x58363b||[]});return{'id':Number(_0xa6265d[_0xd22f('0x5b')]['id']),'tags':_0x58363b||[]};});}})['then'](respondWithResult(_0x4b767b,null))[_0xd22f('0x59')](handleError(_0x4b767b,null));};exports[_0xd22f('0x70')]=function(_0x5dda61,_0x259343,_0x4e7f40){var _0x4a9ea8;return db[_0xd22f('0x30')]['find']({'where':{'id':_0x5dda61['params']['id']}})[_0xd22f('0x29')](handleEntityNotFound(_0x259343,null))[_0xd22f('0x29')](function(_0x3d6b16){if(_0x3d6b16){return _0x3d6b16[_0xd22f('0x70')](_0x5dda61['query'][_0xd22f('0x63')]);}})['then'](respondWithStatusCode(_0x259343,null))['catch'](handleError(_0x259343,null));};exports['download']=function(_0x55d8b0,_0x525b3e){var _0x1d8ece=moment()[_0xd22f('0x71')]()[_0xd22f('0x72')]();var _0x521d96=path[_0xd22f('0x73')](config[_0xd22f('0x74')],_0xd22f('0x75'),_0xd22f('0x76'),_0xd22f('0x77'));var _0x413f63=path[_0xd22f('0x73')](config[_0xd22f('0x74')],'server',_0xd22f('0x76'),_0xd22f('0x78'));var _0xc68cb4=path[_0xd22f('0x73')](_0x521d96,_0x1d8ece);var _0x38d755=util[_0xd22f('0x69')](_0xd22f('0x79'),_0x1d8ece);var _0x2d17eb=path[_0xd22f('0x73')](_0x521d96,_0x38d755);var _0x5b7772=![];return db[_0xd22f('0x30')][_0xd22f('0x5e')]({'where':{'id':_0x55d8b0[_0xd22f('0x5b')]['id']},'include':[{'model':db[_0xd22f('0x4a')],'as':_0xd22f('0x4b'),'attributes':['id','body'],'include':[{'model':db['User'],'as':_0xd22f('0x50'),'attributes':['id','fullname'],'raw':!![]},{'model':db['CmContact'],'as':_0xd22f('0x53'),'attributes':['id',_0xd22f('0x7a')],'raw':!![]}]}]})[_0xd22f('0x29')](handleEntityNotFound(_0x525b3e,null))[_0xd22f('0x29')](function(_0x1722ea){if(_0x1722ea){_0x5b7772=!![];var _0x25565c='';var _0x23f6ff={'format':_0xd22f('0x7b'),'border':_0xd22f('0x7c')};fs[_0xd22f('0x7d')](_0xc68cb4);_0x25565c+=util[_0xd22f('0x69')](_0xd22f('0x7e'),_0x1722ea['id']);_0x25565c+=util[_0xd22f('0x69')](_0xd22f('0x7f'),moment()[_0xd22f('0x69')](_0xd22f('0x80'))[_0xd22f('0x72')]());_0x25565c+='
';for(var _0x3d14b0=0x0;_0x3d14b0<_0x1722ea[_0xd22f('0x4b')]['length'];_0x3d14b0++){var _0x10367b=_0x1722ea[_0xd22f('0x4b')][_0x3d14b0];_0x25565c+=_0xd22f('0x81');_0x25565c+=util[_0xd22f('0x69')](_0xd22f('0x82'),_0x10367b['User']?_0x10367b[_0xd22f('0x50')][_0xd22f('0x55')]:_0x10367b[_0xd22f('0x53')][_0xd22f('0x7a')],_0x10367b[_0xd22f('0x60')]);_0x25565c+=_0xd22f('0x83');}return new BPromise(function(_0x1bfcfe,_0x31938b){pdf['create'](_0x25565c,_0x23f6ff)['toFile'](path[_0xd22f('0x73')](_0xc68cb4,_0xd22f('0x84')+_0x1d8ece+_0xd22f('0x85')),function(_0x147a45,_0x22f8a0){if(_0x147a45)return _0x31938b(_0x147a45);_0x1bfcfe(_0x22f8a0);});});}})[_0xd22f('0x29')](function(){if(_0x5b7772){return new BPromise(function(_0x277719,_0x3b2b98){zipdir(_0xc68cb4,{'saveTo':_0x2d17eb},function(_0x184af6,_0x421b2a){if(_0x184af6)return _0x3b2b98(_0x184af6);return _0x277719(_0x421b2a);});});}})['then'](function(){if(_0x5b7772){return new BPromise(function(_0x3881f8,_0x35cca3){rimraf(_0xc68cb4,function(_0x4af7e0){if(_0x4af7e0)_0x35cca3(_0x4af7e0);return _0x3881f8();});});}})[_0xd22f('0x29')](function(){if(_0x5b7772){return _0x525b3e[_0xd22f('0x86')](_0x2d17eb,_0x38d755,function(_0x1c918f){if(_0x1c918f){console[_0xd22f('0x87')](_0xd22f('0x88'),_0x1c918f);}else{fs['unlinkSync'](_0x2d17eb);}});}else{return _0x525b3e[_0xd22f('0x1e')](0xc8);}})[_0xd22f('0x59')](handleError(_0x525b3e,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 8fddd09..fa17087 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 _0xd81f=['events','../../mysqldb','SmsInteraction','setMaxListeners','save','update','remove','hasOwnProperty','exports'];(function(_0x8806a6,_0x686e06){var _0x49cdd3=function(_0x1b0358){while(--_0x1b0358){_0x8806a6['push'](_0x8806a6['shift']());}};_0x49cdd3(++_0x686e06);}(_0xd81f,0x1c2));var _0xfd81=function(_0x3a2a3c,_0x37bd31){_0x3a2a3c=_0x3a2a3c-0x0;var _0x50ac9a=_0xd81f[_0x3a2a3c];return _0x50ac9a;};'use strict';var EventEmitter=require(_0xfd81('0x0'));var SmsInteraction=require(_0xfd81('0x1'))['db'][_0xfd81('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xfd81('0x3')](0x0);var events={'afterCreate':_0xfd81('0x4'),'afterUpdate':_0xfd81('0x5'),'afterDestroy':_0xfd81('0x6')};function emitEvent(_0x1ef9a7){return function(_0x14c3cb,_0x1f3a18,_0x5ee360){SmsInteractionEvents['emit'](_0x1ef9a7+':'+_0x14c3cb['id'],_0x14c3cb);SmsInteractionEvents['emit'](_0x1ef9a7,_0x14c3cb);_0x5ee360(null);};}for(var e in events){if(events[_0xfd81('0x7')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0xfd81('0x8')]=SmsInteractionEvents; \ No newline at end of file +var _0xde78=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','SmsInteraction'];(function(_0x3e8b89,_0x167445){var _0xdb5cac=function(_0xe3ee0d){while(--_0xe3ee0d){_0x3e8b89['push'](_0x3e8b89['shift']());}};_0xdb5cac(++_0x167445);}(_0xde78,0x179));var _0x8de7=function(_0x427d3a,_0x23724c){_0x427d3a=_0x427d3a-0x0;var _0xe5c521=_0xde78[_0x427d3a];return _0xe5c521;};'use strict';var EventEmitter=require(_0x8de7('0x0'));var SmsInteraction=require(_0x8de7('0x1'))['db'][_0x8de7('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x8de7('0x3')](0x0);var events={'afterCreate':_0x8de7('0x4'),'afterUpdate':_0x8de7('0x5'),'afterDestroy':_0x8de7('0x6')};function emitEvent(_0x38f658){return function(_0x1ae3c7,_0xeb735a,_0x1fdd95){SmsInteractionEvents[_0x8de7('0x7')](_0x38f658+':'+_0x1ae3c7['id'],_0x1ae3c7);SmsInteractionEvents[_0x8de7('0x7')](_0x38f658,_0x1ae3c7);_0x1fdd95(null);};}for(var e in events){if(events[_0x8de7('0x8')](e)){var event=events[e];SmsInteraction[_0x8de7('0x9')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index d39bbde..94b7505 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 _0x98ae=['../../config/logger','api','bluebird','request-promise','./smsInteraction.attributes','SmsInteraction','sms_interactions','lodash','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x98ae,0x142));var _0xe98a=function(_0x2ef525,_0x3344fc){_0x2ef525=_0x2ef525-0x0;var _0x7c7bdf=_0x98ae[_0x2ef525];return _0x7c7bdf;};'use strict';var _=require(_0xe98a('0x0'));var util=require(_0xe98a('0x1'));var logger=require(_0xe98a('0x2'))(_0xe98a('0x3'));var moment=require('moment');var BPromise=require(_0xe98a('0x4'));var rp=require(_0xe98a('0x5'));var attributes=require(_0xe98a('0x6'));module['exports']=function(_0x3ed189,_0x439532){return _0x3ed189['define'](_0xe98a('0x7'),attributes,{'tableName':_0xe98a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x430c=['bluebird','define','sms_interactions','lodash','api','moment'];(function(_0x14be19,_0x3067bb){var _0x240fb4=function(_0x58a3b9){while(--_0x58a3b9){_0x14be19['push'](_0x14be19['shift']());}};_0x240fb4(++_0x3067bb);}(_0x430c,0x1a1));var _0xc430=function(_0x3181cc,_0x28447f){_0x3181cc=_0x3181cc-0x0;var _0x547a4a=_0x430c[_0x3181cc];return _0x547a4a;};'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 attributes=require('./smsInteraction.attributes');module['exports']=function(_0x47d8b9,_0x338a82){return _0x47d8b9[_0xc430('0x4')]('SmsInteraction',attributes,{'tableName':_0xc430('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index ac0b755..b03b5ec 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 _0x53c4=['client','http','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','UpdateSmsInteraction','SmsInteraction','update','options','raw','attributes','catch','AddTagsToSmsInteraction','where','body','ids','omit','spread','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x5ac7b7,_0x27ae13){var _0x41a662=function(_0x52758c){while(--_0x52758c){_0x5ac7b7['push'](_0x5ac7b7['shift']());}};_0x41a662(++_0x27ae13);}(_0x53c4,0xe8));var _0x453c=function(_0x1fdc13,_0x1de8ec){_0x1fdc13=_0x1fdc13-0x0;var _0xdc23f8=_0x53c4[_0x1fdc13];return _0xdc23f8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x453c('0x0'));var BPromise=require(_0x453c('0x1'));var rs=require(_0x453c('0x2'));var fs=require('fs');var Redis=require(_0x453c('0x3'));var db=require(_0x453c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x453c('0x5'))(_0x453c('0x6'));var config=require(_0x453c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x453c('0x8')][_0x453c('0x9')]({'port':0x232a});config[_0x453c('0xa')]=_[_0x453c('0xb')](config[_0x453c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x453c('0xc'))(new Redis(config['redis']));require(_0x453c('0xd'))[_0x453c('0xe')](socket);function respondWithRpcPromise(_0x48c94b,_0x1b65f3,_0x19d42e){return new BPromise(function(_0x1c3d30,_0x27f05f){return client[_0x453c('0xf')](_0x48c94b,_0x19d42e)[_0x453c('0x10')](function(_0x131cdf){logger[_0x453c('0x11')](_0x453c('0x12'),_0x1b65f3,'request\x20sent');logger[_0x453c('0x13')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x1b65f3,_0x453c('0x14'),JSON[_0x453c('0x15')](_0x131cdf));if(_0x131cdf[_0x453c('0x16')]){if(_0x131cdf['error'][_0x453c('0x17')]===0x1f4){logger[_0x453c('0x16')](_0x453c('0x12'),_0x1b65f3,_0x131cdf['error'][_0x453c('0x18')]);return _0x27f05f(_0x131cdf['error']['message']);}logger['error'](_0x453c('0x12'),_0x1b65f3,_0x131cdf[_0x453c('0x16')][_0x453c('0x18')]);return _0x1c3d30(_0x131cdf['error'][_0x453c('0x18')]);}else{logger[_0x453c('0x11')](_0x453c('0x12'),_0x1b65f3,_0x453c('0x14'));_0x1c3d30(_0x131cdf[_0x453c('0x19')]['message']);}})['catch'](function(_0x5d5bf8){logger[_0x453c('0x16')](_0x453c('0x12'),_0x1b65f3,_0x5d5bf8);_0x27f05f(_0x5d5bf8);});});}exports[_0x453c('0x1a')]=function(_0x405f8d){var _0x2d977f=this;return new Promise(function(_0x21a0f6,_0x1e166f){return db[_0x453c('0x1b')][_0x453c('0x1c')](_0x405f8d['body'],{'raw':_0x405f8d[_0x453c('0x1d')]?_0x405f8d[_0x453c('0x1d')][_0x453c('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x405f8d[_0x453c('0x1d')]?_0x405f8d[_0x453c('0x1d')]['where']||null:null,'attributes':_0x405f8d[_0x453c('0x1d')]?_0x405f8d['options'][_0x453c('0x1f')]||null:null,'limit':_0x405f8d['options']?_0x405f8d[_0x453c('0x1d')]['limit']||null:null})[_0x453c('0x10')](function(_0x4accf5){logger[_0x453c('0x11')](_0x453c('0x1a'),_0x405f8d);logger[_0x453c('0x13')]('UpdateSmsInteraction',_0x405f8d,JSON[_0x453c('0x15')](_0x4accf5));_0x21a0f6(_0x4accf5);})[_0x453c('0x20')](function(_0x535737){logger[_0x453c('0x16')](_0x453c('0x1a'),_0x535737['message'],_0x405f8d);_0x1e166f(_0x2d977f[_0x453c('0x16')](0x1f4,_0x535737[_0x453c('0x18')]));});});};exports[_0x453c('0x21')]=function(_0x5050ea){return new Promise(function(_0x21b184,_0x10ac19){return db[_0x453c('0x1b')]['find']({'where':_0x5050ea[_0x453c('0x1d')]?_0x5050ea[_0x453c('0x1d')][_0x453c('0x22')]||null:null})['then'](function(_0xeaaf55){if(_0xeaaf55){return _0xeaaf55['addTags'](_0x5050ea[_0x453c('0x23')][_0x453c('0x24')],_[_0x453c('0x25')](_0x5050ea['body'],[_0x453c('0x24'),'id'])||{});}})[_0x453c('0x26')](function(_0x6f4fee){logger['info'](_0x453c('0x27'),_0x5050ea);logger[_0x453c('0x13')]('AddTags',_0x5050ea,JSON[_0x453c('0x15')](_0x6f4fee));_0x21b184(_0x6f4fee);})['catch'](function(_0x553bc5){logger[_0x453c('0x16')](_0x453c('0x27'),_0x553bc5[_0x453c('0x18')],_0x5050ea);_0x10ac19(_this[_0x453c('0x16')](0x1f4,_0x553bc5[_0x453c('0x18')]));});});}; \ No newline at end of file +var _0x0552=['result','catch','SmsInteraction','update','body','options','where','attributes','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','ids','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','then','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message'];(function(_0x3c8033,_0x18ad41){var _0x35f8f3=function(_0x568c09){while(--_0x568c09){_0x3c8033['push'](_0x3c8033['shift']());}};_0x35f8f3(++_0x18ad41);}(_0x0552,0xf7));var _0x2055=function(_0x100fd7,_0x3e7486){_0x100fd7=_0x100fd7-0x0;var _0x27a4c8=_0x0552[_0x100fd7];return _0x27a4c8;};'use strict';var _=require(_0x2055('0x0'));var util=require(_0x2055('0x1'));var moment=require(_0x2055('0x2'));var BPromise=require(_0x2055('0x3'));var rs=require(_0x2055('0x4'));var fs=require('fs');var Redis=require(_0x2055('0x5'));var db=require(_0x2055('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2055('0x7'));var jayson=require(_0x2055('0x8'));var client=jayson[_0x2055('0x9')][_0x2055('0xa')]({'port':0x232a});config[_0x2055('0xb')]=_[_0x2055('0xc')](config[_0x2055('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x2055('0xd'))(new Redis(config[_0x2055('0xb')]));require(_0x2055('0xe'))[_0x2055('0xf')](socket);function respondWithRpcPromise(_0x49b7c3,_0x37ebc0,_0x4fe531){return new BPromise(function(_0x353a75,_0x5e06f7){return client['request'](_0x49b7c3,_0x4fe531)[_0x2055('0x10')](function(_0x7e502){logger[_0x2055('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x37ebc0,_0x2055('0x12'));logger[_0x2055('0x13')](_0x2055('0x14'),_0x37ebc0,'request\x20sent',JSON[_0x2055('0x15')](_0x7e502));if(_0x7e502['error']){if(_0x7e502[_0x2055('0x16')][_0x2055('0x17')]===0x1f4){logger['error'](_0x2055('0x18'),_0x37ebc0,_0x7e502[_0x2055('0x16')][_0x2055('0x19')]);return _0x5e06f7(_0x7e502[_0x2055('0x16')]['message']);}logger[_0x2055('0x16')](_0x2055('0x18'),_0x37ebc0,_0x7e502[_0x2055('0x16')]['message']);return _0x353a75(_0x7e502['error'][_0x2055('0x19')]);}else{logger[_0x2055('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x37ebc0,'request\x20sent');_0x353a75(_0x7e502[_0x2055('0x1a')][_0x2055('0x19')]);}})[_0x2055('0x1b')](function(_0x2a09bb){logger[_0x2055('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x37ebc0,_0x2a09bb);_0x5e06f7(_0x2a09bb);});});}exports['UpdateSmsInteraction']=function(_0x38947e){var _0x10219f=this;return new Promise(function(_0x33bb85,_0x753238){return db[_0x2055('0x1c')][_0x2055('0x1d')](_0x38947e[_0x2055('0x1e')],{'raw':_0x38947e[_0x2055('0x1f')]?_0x38947e[_0x2055('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38947e[_0x2055('0x1f')]?_0x38947e[_0x2055('0x1f')][_0x2055('0x20')]||null:null,'attributes':_0x38947e[_0x2055('0x1f')]?_0x38947e['options'][_0x2055('0x21')]||null:null,'limit':_0x38947e[_0x2055('0x1f')]?_0x38947e[_0x2055('0x1f')][_0x2055('0x22')]||null:null})['then'](function(_0x550991){logger[_0x2055('0x11')]('UpdateSmsInteraction',_0x38947e);logger[_0x2055('0x13')](_0x2055('0x23'),_0x38947e,JSON[_0x2055('0x15')](_0x550991));_0x33bb85(_0x550991);})[_0x2055('0x1b')](function(_0x32c8d1){logger[_0x2055('0x16')](_0x2055('0x23'),_0x32c8d1[_0x2055('0x19')],_0x38947e);_0x753238(_0x10219f[_0x2055('0x16')](0x1f4,_0x32c8d1[_0x2055('0x19')]));});});};exports[_0x2055('0x24')]=function(_0x5355af){return new Promise(function(_0x4b3e31,_0x3463fb){return db[_0x2055('0x1c')]['find']({'where':_0x5355af[_0x2055('0x1f')]?_0x5355af[_0x2055('0x1f')]['where']||null:null})[_0x2055('0x10')](function(_0x1de6c6){if(_0x1de6c6){return _0x1de6c6['addTags'](_0x5355af[_0x2055('0x1e')][_0x2055('0x25')],_['omit'](_0x5355af['body'],[_0x2055('0x25'),'id'])||{});}})['spread'](function(_0xd660af){logger[_0x2055('0x11')](_0x2055('0x26'),_0x5355af);logger[_0x2055('0x13')](_0x2055('0x26'),_0x5355af,JSON[_0x2055('0x15')](_0xd660af));_0x4b3e31(_0xd660af);})[_0x2055('0x1b')](function(_0x42e37f){logger[_0x2055('0x16')]('AddTags',_0x42e37f[_0x2055('0x19')],_0x5355af);_0x3463fb(_this['error'](0x1f4,_0x42e37f['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index cc4dbd0..d5ac77f 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 _0x8010=['smsInteraction:','./smsInteraction.events','remove','update','emit','removeListener','register','length'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x8010,0xf1));var _0x0801=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8010[_0x3dd15e];return _0x231fd0;};'use strict';var SmsInteractionEvents=require(_0x0801('0x0'));var events=['save',_0x0801('0x1'),_0x0801('0x2')];function createListener(_0x1e4909,_0x3f475e){return function(_0x1bc9ea){_0x3f475e[_0x0801('0x3')](_0x1e4909,_0x1bc9ea);};}function removeListener(_0x342f70,_0xd9334e){return function(){SmsInteractionEvents[_0x0801('0x4')](_0x342f70,_0xd9334e);};}exports[_0x0801('0x5')]=function(_0x4349b8){for(var _0x4e8c00=0x0,_0x5bf815=events[_0x0801('0x6')];_0x4e8c00<_0x5bf815;_0x4e8c00++){var _0x387a67=events[_0x4e8c00];var _0xb512c4=createListener(_0x0801('0x7')+_0x387a67,_0x4349b8);SmsInteractionEvents['on'](_0x387a67,_0xb512c4);}}; \ No newline at end of file +var _0x2f44=['register','smsInteraction:','./smsInteraction.events','save','remove','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2f44,0x191));var _0x42f4=function(_0x251ff8,_0x181c7f){_0x251ff8=_0x251ff8-0x0;var _0xda0abc=_0x2f44[_0x251ff8];return _0xda0abc;};'use strict';var SmsInteractionEvents=require(_0x42f4('0x0'));var events=[_0x42f4('0x1'),_0x42f4('0x2'),_0x42f4('0x3')];function createListener(_0x2d6b65,_0x309697){return function(_0x594574){_0x309697[_0x42f4('0x4')](_0x2d6b65,_0x594574);};}function removeListener(_0x2c6403,_0x458a5e){return function(){SmsInteractionEvents['removeListener'](_0x2c6403,_0x458a5e);};}exports[_0x42f4('0x5')]=function(_0x60d0ab){for(var _0x17cfb8=0x0,_0x22329b=events['length'];_0x17cfb8<_0x22329b;_0x17cfb8++){var _0x574ecf=events[_0x17cfb8];var _0x5051b5=createListener(_0x42f4('0x6')+_0x574ecf,_0x60d0ab);SmsInteractionEvents['on'](_0x574ecf,_0x5051b5);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 55cb283..cd4d08e 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 _0xa150=['../../config/environment','./smsMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','tracked','sms','smsmessage:create','create','post','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5a7eae,_0x60da5e){var _0x33dc48=function(_0xec7d93){while(--_0xec7d93){_0x5a7eae['push'](_0x5a7eae['shift']());}};_0x33dc48(++_0x60da5e);}(_0xa150,0x1ad));var _0x0a15=function(_0x541a2,_0x3e2719){_0x541a2=_0x541a2-0x0;var _0x39f701=_0xa150[_0x541a2];return _0x39f701;};'use strict';var multer=require(_0x0a15('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0a15('0x1'));var express=require(_0x0a15('0x2'));var router=express[_0x0a15('0x3')]();var auth=require(_0x0a15('0x4'));var interaction=require(_0x0a15('0x5'));var config=require(_0x0a15('0x6'));var controller=require(_0x0a15('0x7'));router[_0x0a15('0x8')]('/',auth[_0x0a15('0x9')](),controller['index']);router[_0x0a15('0x8')](_0x0a15('0xa'),auth[_0x0a15('0x9')](),controller[_0x0a15('0xb')]);router[_0x0a15('0x8')](_0x0a15('0xc'),auth[_0x0a15('0x9')](),controller[_0x0a15('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x0a15('0xe')](_0x0a15('0xf'),_0x0a15('0x10')),controller[_0x0a15('0x11')]);router[_0x0a15('0x12')](_0x0a15('0x13'),controller[_0x0a15('0x14')]);router[_0x0a15('0x15')](_0x0a15('0xc'),auth['isAuthenticated'](),controller[_0x0a15('0x16')]);router['put'](_0x0a15('0x17'),auth['isAuthenticated'](),controller[_0x0a15('0x18')]);router['put'](_0x0a15('0x19'),auth[_0x0a15('0x9')](),controller[_0x0a15('0x1a')]);router['delete']('/:id',auth[_0x0a15('0x9')](),controller[_0x0a15('0x1b')]);module[_0x0a15('0x1c')]=router; \ No newline at end of file +var _0xb43b=['express','Router','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','describe','/:id','post','sms','smsmessage:create','create','/:id/status','status','/:id/accept','put','reject','destroy','exports','multer','util','connect-timeout'];(function(_0x19d7ae,_0x236661){var _0x47a06c=function(_0x79d790){while(--_0x79d790){_0x19d7ae['push'](_0x19d7ae['shift']());}};_0x47a06c(++_0x236661);}(_0xb43b,0x1b2));var _0xbb43=function(_0x470a1e,_0x49f6b1){_0x470a1e=_0x470a1e-0x0;var _0x120dc9=_0xb43b[_0x470a1e];return _0x120dc9;};'use strict';var multer=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var path=require('path');var timeout=require(_0xbb43('0x2'));var express=require(_0xbb43('0x3'));var router=express[_0xbb43('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xbb43('0x5'));var config=require(_0xbb43('0x6'));var controller=require(_0xbb43('0x7'));router[_0xbb43('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbb43('0x8')]('/describe',auth[_0xbb43('0x9')](),controller[_0xbb43('0xa')]);router[_0xbb43('0x8')](_0xbb43('0xb'),auth[_0xbb43('0x9')](),controller['show']);router[_0xbb43('0xc')]('/',auth[_0xbb43('0x9')](),interaction['tracked'](_0xbb43('0xd'),_0xbb43('0xe')),controller[_0xbb43('0xf')]);router[_0xbb43('0xc')](_0xbb43('0x10'),controller[_0xbb43('0x11')]);router['put'](_0xbb43('0xb'),auth[_0xbb43('0x9')](),controller['update']);router['put'](_0xbb43('0x12'),auth['isAuthenticated'](),controller['accept']);router[_0xbb43('0x13')]('/:id/reject',auth[_0xbb43('0x9')](),controller[_0xbb43('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xbb43('0x15')]);module[_0xbb43('0x16')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index da42303..8602b42 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 _0xe9e7=['sequelize','exports','TEXT','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x13a3da,_0x2f8e52){var _0x415169=function(_0x23b834){while(--_0x23b834){_0x13a3da['push'](_0x13a3da['shift']());}};_0x415169(++_0x2f8e52);}(_0xe9e7,0x1f0));var _0x7e9e=function(_0xc4b2a2,_0x37cc5a){_0xc4b2a2=_0xc4b2a2-0x0;var _0x2b9431=_0xe9e7[_0xc4b2a2];return _0x2b9431;};'use strict';var Sequelize=require(_0x7e9e('0x0'));module[_0x7e9e('0x1')]={'body':{'type':Sequelize[_0x7e9e('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x7e9e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7e9e('0x4')]('in',_0x7e9e('0x5')),'defaultValue':_0x7e9e('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x7e9e('0x6')](0xbe)},'phone':{'type':Sequelize[_0x7e9e('0x6')]},'readAt':{'type':Sequelize[_0x7e9e('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x482d=['TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0x482d,0x16c));var _0xd482=function(_0x3a0acd,_0x4ed88e){_0x3a0acd=_0x3a0acd-0x0;var _0x4aa261=_0x482d[_0x3a0acd];return _0x4aa261;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xd482('0x0')](_0xd482('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xd482('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd482('0x3')]('in',_0xd482('0x4')),'defaultValue':_0xd482('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xd482('0x5')]},'readAt':{'type':Sequelize[_0xd482('0x6')]},'secret':{'type':Sequelize[_0xd482('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 22f0946..1d2580e 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 _0xe706=['get','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','rejectMessage','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','groupName','DELIVERED','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','http','request','then','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','sendStatus','end','json','count','offset','limit','status','set','Content-Range','save','update','destroy','name','send','index','SmsMessage','rawAttributes','query','dateStart','dateEnd','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','add','day','merge','filter','map','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','describe','sms-interactions','sms','read','format','UserId','user','Contact','SmsInteraction','SmsInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','reject','agent'];(function(_0x1a6e2b,_0xeaad01){var _0x20f03b=function(_0x49ca81){while(--_0x49ca81){_0x1a6e2b['push'](_0x1a6e2b['shift']());}};_0x20f03b(++_0xeaad01);}(_0xe706,0xa3));var _0x6e70=function(_0x2dd628,_0x3c22e4){_0x2dd628=_0x2dd628-0x0;var _0x2e138c=_0xe706[_0x2dd628];return _0x2e138c;};'use strict';var pdf=require(_0x6e70('0x0'));var emlformat=require(_0x6e70('0x1'));var rimraf=require(_0x6e70('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e70('0x3'));var rp=require(_0x6e70('0x4'));var moment=require(_0x6e70('0x5'));var BPromise=require(_0x6e70('0x6'));var Mustache=require(_0x6e70('0x7'));var util=require(_0x6e70('0x8'));var path=require(_0x6e70('0x9'));var sox=require(_0x6e70('0xa'));var csv=require(_0x6e70('0xb'));var ejs=require(_0x6e70('0xc'));var fs=require('fs');var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xb'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var qs=require(_0x6e70('0x15'));var logger=require(_0x6e70('0x16'))(_0x6e70('0x17'));var utils=require(_0x6e70('0x18'));var config=require(_0x6e70('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x6e70('0x1a')](config[_0x6e70('0x1b')],{'host':_0x6e70('0x1c'),'port':0x18eb});var socket=require(_0x6e70('0x1d'))(new Redis(config[_0x6e70('0x1b')]));require(_0x6e70('0x1e'))[_0x6e70('0x1f')](socket);var jayson=require(_0x6e70('0x20'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0x6e70('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x5a37a6,_0x53aed0,_0x304716,_0x22c50c){return new BPromise(function(_0x5d9263,_0x24f3ac){var _0x5c3fe7=_0x22c50c||client;return _0x5c3fe7[_0x6e70('0x22')](_0x5a37a6,_0x304716)[_0x6e70('0x23')](function(_0x4ca554){logger['info'](_0x6e70('0x24'),_0x53aed0,'request\x20sent');logger[_0x6e70('0x25')](_0x6e70('0x26'),_0x53aed0,'request\x20sent',JSON['stringify'](_0x4ca554));if(_0x4ca554[_0x6e70('0x27')]){if(_0x4ca554[_0x6e70('0x27')][_0x6e70('0x28')]===0x1f4){logger[_0x6e70('0x27')](_0x6e70('0x24'),_0x53aed0,_0x4ca554[_0x6e70('0x27')][_0x6e70('0x29')]);return _0x24f3ac(_0x4ca554[_0x6e70('0x27')][_0x6e70('0x29')]);}logger[_0x6e70('0x27')]('SmsMessage,\x20%s,\x20%s',_0x53aed0,_0x4ca554[_0x6e70('0x27')][_0x6e70('0x29')]);return _0x5d9263(_0x4ca554[_0x6e70('0x27')]['message']);}else{logger[_0x6e70('0x2a')](_0x6e70('0x24'),_0x53aed0,_0x6e70('0x2b'));_0x5d9263(_0x4ca554['result'][_0x6e70('0x29')]);}})['catch'](function(_0x50aec2){logger['error'](_0x6e70('0x24'),_0x53aed0,_0x50aec2);_0x24f3ac(_0x50aec2);});});}function respondWithStatusCode(_0x19c5ae,_0x51d292){_0x51d292=_0x51d292||0xcc;return function(_0x3ecdf1){if(_0x3ecdf1){return _0x19c5ae[_0x6e70('0x2c')](_0x51d292);}return _0x19c5ae['status'](_0x51d292)[_0x6e70('0x2d')]();};}function respondWithResult(_0x67fb43,_0x2bb231){_0x2bb231=_0x2bb231||0xc8;return function(_0x4a67ac){if(_0x4a67ac){return _0x67fb43['status'](_0x2bb231)[_0x6e70('0x2e')](_0x4a67ac);}};}function respondWithFilteredResult(_0x3af17f,_0x83c836){return function(_0x114344){if(_0x114344){var _0x43fee0=_0x114344[_0x6e70('0x2f')],_0x5d772a=_0x83c836[_0x6e70('0x30')],_0x1952ea=_0x83c836[_0x6e70('0x30')]+_0x83c836[_0x6e70('0x31')],_0x406f29;if(_0x1952ea>=_0x43fee0){_0x1952ea=_0x43fee0;_0x406f29=0xc8;}else{_0x406f29=0xce;}_0x3af17f[_0x6e70('0x32')](_0x406f29);return _0x3af17f[_0x6e70('0x33')](_0x6e70('0x34'),_0x5d772a+'-'+_0x1952ea+'/'+_0x43fee0)[_0x6e70('0x2e')](_0x114344);}return null;};}function patchUpdates(_0x4b1229){return function(_0x1b27d8){try{jsonpatch['apply'](_0x1b27d8,_0x4b1229,!![]);}catch(_0x259486){return BPromise['reject'](_0x259486);}return _0x1b27d8[_0x6e70('0x35')]();};}function saveUpdates(_0x2722e8,_0x30fa0b){return function(_0x56f6f7){if(_0x56f6f7){return _0x56f6f7[_0x6e70('0x36')](_0x2722e8)[_0x6e70('0x23')](function(_0x5780a1){return _0x5780a1;});}return null;};}function removeEntity(_0x13d673,_0x154925){return function(_0x52b457){if(_0x52b457){return _0x52b457[_0x6e70('0x37')]()[_0x6e70('0x23')](function(){_0x13d673[_0x6e70('0x32')](0xcc)[_0x6e70('0x2d')]();});}};}function handleEntityNotFound(_0x3b4a13,_0x1e3e76){return function(_0x44b19d){if(!_0x44b19d){_0x3b4a13[_0x6e70('0x2c')](0x194);}return _0x44b19d;};}function handleError(_0xf146fd,_0x419a41){_0x419a41=_0x419a41||0x1f4;return function(_0x4d32d8){logger[_0x6e70('0x27')](_0x4d32d8['stack']);if(_0x4d32d8[_0x6e70('0x38')]){delete _0x4d32d8[_0x6e70('0x38')];}_0xf146fd[_0x6e70('0x32')](_0x419a41)[_0x6e70('0x39')](_0x4d32d8);};}exports[_0x6e70('0x3a')]=function(_0x989b80,_0x2440be){var _0xdd0bee={},_0x80bebb={},_0x198dd1={'count':0x0,'rows':[]};var _0x2a5444=db[_0x6e70('0x3b')][_0x6e70('0x3c')];_0x80bebb['model']=_['keys'](_0x2a5444);var _0x5424eb={'dateStart':_0x989b80[_0x6e70('0x3d')][_0x6e70('0x3e')],'dateEnd':_0x989b80[_0x6e70('0x3d')][_0x6e70('0x3f')]};delete _0x989b80[_0x6e70('0x3d')][_0x6e70('0x3e')];delete _0x989b80['query'][_0x6e70('0x3f')];_0x80bebb[_0x6e70('0x3d')]=_[_0x6e70('0x40')](_0x989b80[_0x6e70('0x3d')]);_0x80bebb[_0x6e70('0x41')]=_[_0x6e70('0x42')](_0x80bebb[_0x6e70('0x43')],_0x80bebb[_0x6e70('0x3d')]);_0xdd0bee['attributes']=_[_0x6e70('0x42')](_0x80bebb[_0x6e70('0x43')],qs[_0x6e70('0x44')](_0x989b80[_0x6e70('0x3d')][_0x6e70('0x44')]));_0xdd0bee[_0x6e70('0x45')]=_0xdd0bee[_0x6e70('0x45')]['length']?_0xdd0bee['attributes']:_0x80bebb['model'];if(!_0x989b80[_0x6e70('0x3d')][_0x6e70('0x46')](_0x6e70('0x47'))){_0xdd0bee[_0x6e70('0x31')]=qs[_0x6e70('0x31')](_0x989b80['query'][_0x6e70('0x31')]);_0xdd0bee[_0x6e70('0x30')]=qs[_0x6e70('0x30')](_0x989b80['query']['offset']);}_0xdd0bee['order']=qs[_0x6e70('0x48')](_0x989b80['query'][_0x6e70('0x48')]);_0xdd0bee[_0x6e70('0x49')]=qs[_0x6e70('0x41')](_[_0x6e70('0x4a')](_0x989b80['query'],_0x80bebb[_0x6e70('0x41')]));if(_0x5424eb['dateStart']){if(_0x5424eb[_0x6e70('0x3f')]){_0x5424eb[_0x6e70('0x3f')]=moment(_0x5424eb[_0x6e70('0x3f')])[_0x6e70('0x4b')](0x1,'day');}else{_0x5424eb[_0x6e70('0x3f')]=moment(_0x5424eb[_0x6e70('0x3e')])[_0x6e70('0x4b')](0x1,_0x6e70('0x4c'));}_[_0x6e70('0x4d')](_0xdd0bee[_0x6e70('0x49')],{'createdAt':{'$gte':_0x5424eb[_0x6e70('0x3e')],'$lte':_0x5424eb['dateEnd']}});}if(_0x989b80[_0x6e70('0x3d')][_0x6e70('0x4e')]){_0xdd0bee[_0x6e70('0x49')]=_[_0x6e70('0x4d')](_0xdd0bee[_0x6e70('0x49')],{'$or':_[_0x6e70('0x4f')](_0xdd0bee[_0x6e70('0x45')],function(_0x4ab26e){var _0x3f5c89={};_0x3f5c89[_0x4ab26e]={'$like':'%'+_0x989b80['query'][_0x6e70('0x4e')]+'%'};return _0x3f5c89;})});}_0xdd0bee=_[_0x6e70('0x4d')]({},_0xdd0bee,_0x989b80['options']);var _0x53efc3={'where':_0xdd0bee[_0x6e70('0x49')]};return db[_0x6e70('0x3b')][_0x6e70('0x2f')](_0x53efc3)['then'](function(_0x4af9b1){_0x198dd1[_0x6e70('0x2f')]=_0x4af9b1;if(_0x989b80[_0x6e70('0x3d')][_0x6e70('0x50')]){_0xdd0bee[_0x6e70('0x51')]=[{'all':!![]}];}return db[_0x6e70('0x3b')][_0x6e70('0x52')](_0xdd0bee);})['then'](function(_0x756a5b){_0x198dd1[_0x6e70('0x53')]=_0x756a5b;return _0x198dd1;})[_0x6e70('0x23')](respondWithFilteredResult(_0x2440be,_0xdd0bee))[_0x6e70('0x54')](handleError(_0x2440be,null));};exports[_0x6e70('0x55')]=function(_0x4b354e,_0x4ae901){var _0x2c5538={'raw':!![],'where':{'id':_0x4b354e[_0x6e70('0x56')]['id']}},_0x2e3ea6={};_0x2e3ea6[_0x6e70('0x43')]=_[_0x6e70('0x40')](db['SmsMessage'][_0x6e70('0x3c')]);_0x2e3ea6[_0x6e70('0x3d')]=_[_0x6e70('0x40')](_0x4b354e[_0x6e70('0x3d')]);_0x2e3ea6[_0x6e70('0x41')]=_['intersection'](_0x2e3ea6[_0x6e70('0x43')],_0x2e3ea6[_0x6e70('0x3d')]);_0x2c5538[_0x6e70('0x45')]=_[_0x6e70('0x42')](_0x2e3ea6[_0x6e70('0x43')],qs[_0x6e70('0x44')](_0x4b354e['query'][_0x6e70('0x44')]));_0x2c5538[_0x6e70('0x45')]=_0x2c5538['attributes'][_0x6e70('0x57')]?_0x2c5538[_0x6e70('0x45')]:_0x2e3ea6['model'];if(_0x4b354e[_0x6e70('0x3d')][_0x6e70('0x50')]){_0x2c5538[_0x6e70('0x51')]=[{'all':!![]}];}_0x2c5538=_[_0x6e70('0x4d')]({},_0x2c5538,_0x4b354e[_0x6e70('0x58')]);return db['SmsMessage'][_0x6e70('0x59')](_0x2c5538)[_0x6e70('0x23')](handleEntityNotFound(_0x4ae901,null))[_0x6e70('0x23')](respondWithResult(_0x4ae901,null))[_0x6e70('0x54')](handleError(_0x4ae901,null));};exports[_0x6e70('0x5a')]=function(_0x1fe13a,_0x14643b){return db[_0x6e70('0x3b')][_0x6e70('0x5a')](_0x1fe13a[_0x6e70('0x5b')],{})[_0x6e70('0x23')](respondWithResult(_0x14643b,0xc9))[_0x6e70('0x54')](handleError(_0x14643b,null));};exports[_0x6e70('0x36')]=function(_0x1fd9a6,_0x2a9173){if(_0x1fd9a6[_0x6e70('0x5b')]['id']){delete _0x1fd9a6[_0x6e70('0x5b')]['id'];}return db[_0x6e70('0x3b')][_0x6e70('0x59')]({'where':{'id':_0x1fd9a6[_0x6e70('0x56')]['id']}})['then'](handleEntityNotFound(_0x2a9173,null))[_0x6e70('0x23')](saveUpdates(_0x1fd9a6[_0x6e70('0x5b')],null))[_0x6e70('0x23')](respondWithResult(_0x2a9173,null))[_0x6e70('0x54')](handleError(_0x2a9173,null));};exports[_0x6e70('0x37')]=function(_0x3880dd,_0x5b4d5d){return db[_0x6e70('0x3b')][_0x6e70('0x59')]({'where':{'id':_0x3880dd['params']['id']}})[_0x6e70('0x23')](handleEntityNotFound(_0x5b4d5d,null))[_0x6e70('0x23')](removeEntity(_0x5b4d5d,null))[_0x6e70('0x54')](handleError(_0x5b4d5d,null));};exports['describe']=function(_0x51f268,_0x2f9be4){return db[_0x6e70('0x3b')][_0x6e70('0x5c')]()[_0x6e70('0x23')](respondWithResult(_0x2f9be4,null))[_0x6e70('0x54')](handleError(_0x2f9be4,null));};var interaction_log=require(_0x6e70('0x16'))(_0x6e70('0x5d'));exports['accept']=function(_0x4d47e1,_0x2c8dc6,_0x1e23c5){var _0x2bf9ec={'channel':_0x6e70('0x5e')};if(_0x4d47e1['body']['id']){delete _0x4d47e1['body']['id'];}_0x4d47e1[_0x6e70('0x5b')][_0x6e70('0x5f')]=!![];_0x4d47e1['body']['readAt']=moment()[_0x6e70('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x4d47e1[_0x6e70('0x5b')][_0x6e70('0x61')]=_0x4d47e1[_0x6e70('0x5b')][_0x6e70('0x61')]||_0x4d47e1[_0x6e70('0x62')]['id'];return db[_0x6e70('0x3b')][_0x6e70('0x59')]({'where':{'id':_0x4d47e1[_0x6e70('0x56')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x6e70('0x63')}]})[_0x6e70('0x23')](handleEntityNotFound(_0x2c8dc6,null))[_0x6e70('0x23')](saveUpdates(_0x4d47e1[_0x6e70('0x5b')],null))[_0x6e70('0x23')](function(_0x5d1cf6){if(_0x5d1cf6){_0x2bf9ec['message']=_0x5d1cf6['get']({'plain':!![]});return db[_0x6e70('0x64')][_0x6e70('0x59')]({'where':{'id':_0x5d1cf6[_0x6e70('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x2c8dc6,null))['then'](function(_0x2fc2a2){if(_0x2fc2a2){return _0x2fc2a2[_0x6e70('0x36')]({'UserId':_0x4d47e1[_0x6e70('0x5b')][_0x6e70('0x61')],'read1stAt':_[_0x6e70('0x66')](_0x2fc2a2[_0x6e70('0x67')])?moment()['format'](_0x6e70('0x68')):undefined});}return null;})[_0x6e70('0x23')](function(_0x30d11b){if(_0x30d11b){_0x2bf9ec[_0x6e70('0x69')]=_0x30d11b['get']({'plain':!![]});interaction_log[_0x6e70('0x2a')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4d47e1['user']['id'],_0x4d47e1[_0x6e70('0x62')][_0x6e70('0x38')],_0x4d47e1[_0x6e70('0x62')][_0x6e70('0x6a')],_0x2bf9ec[_0x6e70('0x69')]['id'],_0x4d47e1[_0x6e70('0x5b')]?JSON['stringify'](_0x4d47e1[_0x6e70('0x5b')]):_0x6e70('0x6b'));return respondWithRpcPromise(_0x6e70('0x6c'),_0x6e70('0x6d'),_0x2bf9ec);}return null;})[_0x6e70('0x23')](function(_0x13c092){if(_0x13c092){if(_0x4d47e1[_0x6e70('0x5b')][_0x6e70('0x6e')]){_0x2bf9ec[_0x6e70('0x29')][_0x6e70('0x6f')]=util['format'](_0x6e70('0x70'),_0x4d47e1[_0x6e70('0x62')][_0x6e70('0x38')]);_0x2bf9ec['message']['channel']=_0x2bf9ec[_0x6e70('0x71')];_0x2bf9ec[_0x6e70('0x29')][_0x6e70('0x72')]=_0x6e70('0x73');return respondWithRpcPromise(_0x6e70('0x74'),'EventManager',{'event':'acceptmessage','message':_0x2bf9ec[_0x6e70('0x29')]},client9002)[_0x6e70('0x23')](function(){return _0x2bf9ec;});}return _0x2bf9ec;}return null;})['then'](respondWithResult(_0x2c8dc6,null))[_0x6e70('0x54')](handleError(_0x2c8dc6,null));};var interaction_log=require(_0x6e70('0x16'))(_0x6e70('0x5d'));exports[_0x6e70('0x75')]=function(_0x3b01c9,_0x44bf96,_0x46ba13){var _0x150e57={'agent':{},'channel':_0x6e70('0x5e')};if(_0x3b01c9[_0x6e70('0x5b')]['id']){delete _0x3b01c9[_0x6e70('0x5b')]['id'];}_0x3b01c9[_0x6e70('0x5b')][_0x6e70('0x61')]=_0x3b01c9[_0x6e70('0x5b')]['UserId']||_0x3b01c9['user']['id'];_0x150e57[_0x6e70('0x76')]['id']=_0x3b01c9['body'][_0x6e70('0x61')];return db['SmsMessage']['find']({'where':{'id':_0x3b01c9[_0x6e70('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x44bf96,null))['then'](function(_0x3c77d8){if(_0x3c77d8){_0x150e57[_0x6e70('0x29')]=_0x3c77d8[_0x6e70('0x77')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x3c77d8['SmsInteractionId']}});}return null;})[_0x6e70('0x23')](handleEntityNotFound(_0x44bf96,null))['then'](function(_0x2e8ed3){if(_0x2e8ed3){_0x150e57[_0x6e70('0x69')]=_0x2e8ed3[_0x6e70('0x77')]({'plain':!![]});interaction_log[_0x6e70('0x2a')](_0x6e70('0x78'),_0x3b01c9[_0x6e70('0x62')]['id'],_0x3b01c9[_0x6e70('0x62')]['name'],_0x3b01c9[_0x6e70('0x62')][_0x6e70('0x6a')],_0x150e57[_0x6e70('0x69')]['id'],_0x3b01c9['body']?JSON[_0x6e70('0x79')](_0x3b01c9[_0x6e70('0x5b')]):_0x6e70('0x6b'));return respondWithRpcPromise(_0x6e70('0x7a'),_0x6e70('0x7b'),_0x150e57);}return null;})[_0x6e70('0x23')](function(_0xb72fe1){if(_0xb72fe1){_0xb72fe1[_0x6e70('0x29')][_0x6e70('0x6f')]=util['format'](_0x6e70('0x70'),_0x3b01c9[_0x6e70('0x62')]['name']);_0xb72fe1[_0x6e70('0x29')][_0x6e70('0x71')]=_0x150e57['channel'];_0xb72fe1['message'][_0x6e70('0x72')]='reject';respondWithRpcPromise(_0x6e70('0x74'),'EventManager',{'event':_0x6e70('0x7c'),'message':_0xb72fe1[_0x6e70('0x29')]},client9002);return _0x150e57;}return null;})[_0x6e70('0x23')](respondWithResult(_0x44bf96,null))[_0x6e70('0x54')](handleError(_0x44bf96,null));};exports[_0x6e70('0x32')]=function(_0x3d44fd,_0x3f985f,_0x5afbf5){if(_0x3d44fd['body']['id']){delete _0x3d44fd[_0x6e70('0x5b')]['id'];}var _0x4bf451;return db[_0x6e70('0x3b')][_0x6e70('0x59')]({'where':{'id':_0x3d44fd[_0x6e70('0x56')]['id']}})[_0x6e70('0x23')](handleEntityNotFound(_0x3f985f,null))['then'](function(_0x21fb9a){if(_0x21fb9a){_0x4bf451=_0x21fb9a;return db['SmsAccount'][_0x6e70('0x59')]({'where':{'id':_0x21fb9a[_0x6e70('0x7d')]}});}})[_0x6e70('0x23')](handleEntityNotFound(_0x3f985f,null))[_0x6e70('0x23')](function(_0x35aff6){if(_0x35aff6){logger[_0x6e70('0x25')](_0x6e70('0x26'),'status',_0x6e70('0x7e'),_0x35aff6['type'],util[_0x6e70('0x7f')](_0x3d44fd['body'],{'showHidden':![],'depth':null}));switch(_0x35aff6['type']){case'twilio':if(_0x3d44fd[_0x6e70('0x5b')][_0x6e70('0x80')]&&_0x3d44fd[_0x6e70('0x5b')][_0x6e70('0x80')]===_0x4bf451[_0x6e70('0x81')]){return _0x4bf451['update']({'read':!![]});}else{logger[_0x6e70('0x27')](_0x6e70('0x82'),'status',_0x6e70('0x83'),util['inspect'](_0x3d44fd[_0x6e70('0x5b')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x3d44fd['body'][_0x6e70('0x84')]&&_0x3d44fd[_0x6e70('0x5b')][_0x6e70('0x84')]===_0x4bf451[_0x6e70('0x81')]&&_[_0x6e70('0x85')]([_0x6e70('0x86'),_0x6e70('0x87')],_0x3d44fd['body'][_0x6e70('0x88')])>=0x0){return _0x4bf451['update']({'read':!![]});}else{logger[_0x6e70('0x27')](_0x6e70('0x82'),_0x6e70('0x32'),_0x6e70('0x89'),util[_0x6e70('0x7f')](_0x3d44fd[_0x6e70('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x6e70('0x8a'):var _0x56ffd5=_0x3d44fd[_0x6e70('0x5b')]['results'][0x0];if(_0x56ffd5[_0x6e70('0x32')][_0x6e70('0x8b')]===_0x6e70('0x8c')){return _0x4bf451[_0x6e70('0x36')]({'read':!![]});}else{logger[_0x6e70('0x27')](_0x6e70('0x82'),_0x6e70('0x32'),_0x6e70('0x8a'),util[_0x6e70('0x7f')](_0x3d44fd[_0x6e70('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x4bf451;}})['then'](respondWithResult(_0x3f985f,null))[_0x6e70('0x54')](handleError(_0x3f985f,null));}; \ No newline at end of file +var _0x9c44=['bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./smsMessage.socket','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','stack','name','send','index','SmsMessage','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','filter','merge','map','includeAll','include','findAll','rows','show','params','options','find','create','update','body','destroy','describe','sms','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','SmsInteraction','SmsInteractionId','isNil','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','manual','interface','channel','event','accept','EventManager','acceptmessage','sms-interactions','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SmsAccount','received\x20delivery\x20report\x20from','type','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','plivio','infobip','results','DELIVERED','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9c44,0x178));var _0x49c4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9c44[_0xfae23b];return _0x200640;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x49c4('0x0'));var zipdir=require(_0x49c4('0x1'));var jsonpatch=require(_0x49c4('0x2'));var rp=require(_0x49c4('0x3'));var moment=require(_0x49c4('0x4'));var BPromise=require(_0x49c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x49c4('0x6'));var sox=require('sox');var csv=require(_0x49c4('0x7'));var ejs=require(_0x49c4('0x8'));var fs=require('fs');var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0x7'));var querystring=require(_0x49c4('0xd'));var Papa=require(_0x49c4('0xe'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x49c4('0xf'))(_0x49c4('0x10'));var utils=require('../../config/utils');var config=require(_0x49c4('0x11'));var db=require(_0x49c4('0x12'))['db'];config['redis']=_['defaults'](config[_0x49c4('0x13')],{'host':_0x49c4('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x49c4('0x13')]));require(_0x49c4('0x15'))['register'](socket);var jayson=require(_0x49c4('0x16'));var client=jayson[_0x49c4('0x17')][_0x49c4('0x18')]({'port':0x232c});var client9002=jayson[_0x49c4('0x17')][_0x49c4('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x18211c,_0x75ea8,_0x3de397,_0x58d177){return new BPromise(function(_0x3acd06,_0x141003){var _0x13a2db=_0x58d177||client;return _0x13a2db[_0x49c4('0x19')](_0x18211c,_0x3de397)[_0x49c4('0x1a')](function(_0x53e3a2){logger[_0x49c4('0x1b')](_0x49c4('0x1c'),_0x75ea8,'request\x20sent');logger['debug'](_0x49c4('0x1d'),_0x75ea8,_0x49c4('0x1e'),JSON[_0x49c4('0x1f')](_0x53e3a2));if(_0x53e3a2['error']){if(_0x53e3a2[_0x49c4('0x20')]['code']===0x1f4){logger[_0x49c4('0x20')](_0x49c4('0x1c'),_0x75ea8,_0x53e3a2[_0x49c4('0x20')][_0x49c4('0x21')]);return _0x141003(_0x53e3a2[_0x49c4('0x20')][_0x49c4('0x21')]);}logger[_0x49c4('0x20')](_0x49c4('0x1c'),_0x75ea8,_0x53e3a2[_0x49c4('0x20')]['message']);return _0x3acd06(_0x53e3a2['error']['message']);}else{logger[_0x49c4('0x1b')]('SmsMessage,\x20%s,\x20%s',_0x75ea8,'request\x20sent');_0x3acd06(_0x53e3a2[_0x49c4('0x22')][_0x49c4('0x21')]);}})[_0x49c4('0x23')](function(_0xd335e4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x75ea8,_0xd335e4);_0x141003(_0xd335e4);});});}function respondWithStatusCode(_0x180276,_0x9cb797){_0x9cb797=_0x9cb797||0xcc;return function(_0x565423){if(_0x565423){return _0x180276[_0x49c4('0x24')](_0x9cb797);}return _0x180276[_0x49c4('0x25')](_0x9cb797)[_0x49c4('0x26')]();};}function respondWithResult(_0xa7a826,_0x531d92){_0x531d92=_0x531d92||0xc8;return function(_0x543ea2){if(_0x543ea2){return _0xa7a826[_0x49c4('0x25')](_0x531d92)['json'](_0x543ea2);}};}function respondWithFilteredResult(_0x3800b7,_0x3852b2){return function(_0x3f1708){if(_0x3f1708){var _0x372a47=_0x3f1708[_0x49c4('0x27')],_0x5987ae=_0x3852b2[_0x49c4('0x28')],_0x889909=_0x3852b2[_0x49c4('0x28')]+_0x3852b2[_0x49c4('0x29')],_0x2b2793;if(_0x889909>=_0x372a47){_0x889909=_0x372a47;_0x2b2793=0xc8;}else{_0x2b2793=0xce;}_0x3800b7[_0x49c4('0x25')](_0x2b2793);return _0x3800b7[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x5987ae+'-'+_0x889909+'/'+_0x372a47)[_0x49c4('0x2c')](_0x3f1708);}return null;};}function patchUpdates(_0x46f7ea){return function(_0x4ea6ea){try{jsonpatch['apply'](_0x4ea6ea,_0x46f7ea,!![]);}catch(_0x59eb84){return BPromise[_0x49c4('0x2d')](_0x59eb84);}return _0x4ea6ea[_0x49c4('0x2e')]();};}function saveUpdates(_0x1eb035,_0x27e467){return function(_0x28eb47){if(_0x28eb47){return _0x28eb47['update'](_0x1eb035)[_0x49c4('0x1a')](function(_0x116eb4){return _0x116eb4;});}return null;};}function removeEntity(_0x2e7a69,_0x24bba9){return function(_0x58e252){if(_0x58e252){return _0x58e252['destroy']()[_0x49c4('0x1a')](function(){_0x2e7a69[_0x49c4('0x25')](0xcc)[_0x49c4('0x26')]();});}};}function handleEntityNotFound(_0x13b3b4,_0xd38540){return function(_0x4a0c7a){if(!_0x4a0c7a){_0x13b3b4[_0x49c4('0x24')](0x194);}return _0x4a0c7a;};}function handleError(_0x84c621,_0x1bfa0f){_0x1bfa0f=_0x1bfa0f||0x1f4;return function(_0x512d02){logger['error'](_0x512d02[_0x49c4('0x2f')]);if(_0x512d02[_0x49c4('0x30')]){delete _0x512d02[_0x49c4('0x30')];}_0x84c621[_0x49c4('0x25')](_0x1bfa0f)[_0x49c4('0x31')](_0x512d02);};}exports[_0x49c4('0x32')]=function(_0x1d1557,_0x27ef5f){var _0x3209cd={},_0x4e0209={},_0x2d34ca={'count':0x0,'rows':[]};var _0x5b96df=db[_0x49c4('0x33')][_0x49c4('0x34')];_0x4e0209[_0x49c4('0x35')]=_[_0x49c4('0x36')](_0x5b96df);var _0x4ed4f8={'dateStart':_0x1d1557[_0x49c4('0x37')][_0x49c4('0x38')],'dateEnd':_0x1d1557[_0x49c4('0x37')]['dateEnd']};delete _0x1d1557[_0x49c4('0x37')][_0x49c4('0x38')];delete _0x1d1557[_0x49c4('0x37')][_0x49c4('0x39')];_0x4e0209[_0x49c4('0x37')]=_[_0x49c4('0x36')](_0x1d1557[_0x49c4('0x37')]);_0x4e0209[_0x49c4('0x3a')]=_[_0x49c4('0x3b')](_0x4e0209[_0x49c4('0x35')],_0x4e0209[_0x49c4('0x37')]);_0x3209cd['attributes']=_[_0x49c4('0x3b')](_0x4e0209[_0x49c4('0x35')],qs[_0x49c4('0x3c')](_0x1d1557[_0x49c4('0x37')][_0x49c4('0x3c')]));_0x3209cd[_0x49c4('0x3d')]=_0x3209cd[_0x49c4('0x3d')][_0x49c4('0x3e')]?_0x3209cd[_0x49c4('0x3d')]:_0x4e0209[_0x49c4('0x35')];if(!_0x1d1557[_0x49c4('0x37')][_0x49c4('0x3f')](_0x49c4('0x40'))){_0x3209cd['limit']=qs[_0x49c4('0x29')](_0x1d1557['query'][_0x49c4('0x29')]);_0x3209cd[_0x49c4('0x28')]=qs[_0x49c4('0x28')](_0x1d1557[_0x49c4('0x37')][_0x49c4('0x28')]);}_0x3209cd[_0x49c4('0x41')]=qs['sort'](_0x1d1557['query'][_0x49c4('0x42')]);_0x3209cd[_0x49c4('0x43')]=qs[_0x49c4('0x3a')](_[_0x49c4('0x44')](_0x1d1557['query'],_0x4e0209[_0x49c4('0x3a')]));if(_0x4ed4f8[_0x49c4('0x38')]){if(_0x4ed4f8[_0x49c4('0x39')]){_0x4ed4f8[_0x49c4('0x39')]=moment(_0x4ed4f8[_0x49c4('0x39')])[_0x49c4('0x45')](0x1,_0x49c4('0x46'));}else{_0x4ed4f8[_0x49c4('0x39')]=moment(_0x4ed4f8[_0x49c4('0x38')])['add'](0x1,_0x49c4('0x46'));}_['merge'](_0x3209cd[_0x49c4('0x43')],{'createdAt':{'$gte':_0x4ed4f8[_0x49c4('0x38')],'$lte':_0x4ed4f8[_0x49c4('0x39')]}});}if(_0x1d1557[_0x49c4('0x37')][_0x49c4('0x47')]){_0x3209cd['where']=_[_0x49c4('0x48')](_0x3209cd[_0x49c4('0x43')],{'$or':_[_0x49c4('0x49')](_0x3209cd[_0x49c4('0x3d')],function(_0x1ded71){var _0x5d4790={};_0x5d4790[_0x1ded71]={'$like':'%'+_0x1d1557[_0x49c4('0x37')]['filter']+'%'};return _0x5d4790;})});}_0x3209cd=_[_0x49c4('0x48')]({},_0x3209cd,_0x1d1557['options']);var _0x3f7379={'where':_0x3209cd[_0x49c4('0x43')]};return db[_0x49c4('0x33')][_0x49c4('0x27')](_0x3f7379)[_0x49c4('0x1a')](function(_0x30bea5){_0x2d34ca[_0x49c4('0x27')]=_0x30bea5;if(_0x1d1557['query'][_0x49c4('0x4a')]){_0x3209cd[_0x49c4('0x4b')]=[{'all':!![]}];}return db['SmsMessage'][_0x49c4('0x4c')](_0x3209cd);})[_0x49c4('0x1a')](function(_0xfbe179){_0x2d34ca[_0x49c4('0x4d')]=_0xfbe179;return _0x2d34ca;})['then'](respondWithFilteredResult(_0x27ef5f,_0x3209cd))['catch'](handleError(_0x27ef5f,null));};exports[_0x49c4('0x4e')]=function(_0x4e8221,_0x4597c3){var _0x1f941f={'raw':!![],'where':{'id':_0x4e8221[_0x49c4('0x4f')]['id']}},_0x3811b2={};_0x3811b2[_0x49c4('0x35')]=_[_0x49c4('0x36')](db[_0x49c4('0x33')]['rawAttributes']);_0x3811b2[_0x49c4('0x37')]=_[_0x49c4('0x36')](_0x4e8221[_0x49c4('0x37')]);_0x3811b2[_0x49c4('0x3a')]=_[_0x49c4('0x3b')](_0x3811b2[_0x49c4('0x35')],_0x3811b2[_0x49c4('0x37')]);_0x1f941f[_0x49c4('0x3d')]=_[_0x49c4('0x3b')](_0x3811b2[_0x49c4('0x35')],qs['fields'](_0x4e8221['query'][_0x49c4('0x3c')]));_0x1f941f[_0x49c4('0x3d')]=_0x1f941f['attributes']['length']?_0x1f941f[_0x49c4('0x3d')]:_0x3811b2['model'];if(_0x4e8221['query'][_0x49c4('0x4a')]){_0x1f941f[_0x49c4('0x4b')]=[{'all':!![]}];}_0x1f941f=_[_0x49c4('0x48')]({},_0x1f941f,_0x4e8221[_0x49c4('0x50')]);return db[_0x49c4('0x33')][_0x49c4('0x51')](_0x1f941f)[_0x49c4('0x1a')](handleEntityNotFound(_0x4597c3,null))['then'](respondWithResult(_0x4597c3,null))[_0x49c4('0x23')](handleError(_0x4597c3,null));};exports[_0x49c4('0x52')]=function(_0x207572,_0x208208){return db[_0x49c4('0x33')][_0x49c4('0x52')](_0x207572['body'],{})['then'](respondWithResult(_0x208208,0xc9))[_0x49c4('0x23')](handleError(_0x208208,null));};exports[_0x49c4('0x53')]=function(_0x2a6308,_0xf7a10f){if(_0x2a6308[_0x49c4('0x54')]['id']){delete _0x2a6308[_0x49c4('0x54')]['id'];}return db[_0x49c4('0x33')]['find']({'where':{'id':_0x2a6308[_0x49c4('0x4f')]['id']}})[_0x49c4('0x1a')](handleEntityNotFound(_0xf7a10f,null))['then'](saveUpdates(_0x2a6308[_0x49c4('0x54')],null))['then'](respondWithResult(_0xf7a10f,null))[_0x49c4('0x23')](handleError(_0xf7a10f,null));};exports[_0x49c4('0x55')]=function(_0x9eaa84,_0x2fe89a){return db[_0x49c4('0x33')][_0x49c4('0x51')]({'where':{'id':_0x9eaa84[_0x49c4('0x4f')]['id']}})[_0x49c4('0x1a')](handleEntityNotFound(_0x2fe89a,null))['then'](removeEntity(_0x2fe89a,null))[_0x49c4('0x23')](handleError(_0x2fe89a,null));};exports[_0x49c4('0x56')]=function(_0x59dc8d,_0x10dec7){return db[_0x49c4('0x33')]['describe']()[_0x49c4('0x1a')](respondWithResult(_0x10dec7,null))[_0x49c4('0x23')](handleError(_0x10dec7,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports['accept']=function(_0x513879,_0xc43386,_0x54947d){var _0xb20a5d={'channel':_0x49c4('0x57')};if(_0x513879['body']['id']){delete _0x513879[_0x49c4('0x54')]['id'];}_0x513879[_0x49c4('0x54')]['read']=!![];_0x513879[_0x49c4('0x54')][_0x49c4('0x58')]=moment()[_0x49c4('0x59')](_0x49c4('0x5a'));_0x513879['body'][_0x49c4('0x5b')]=_0x513879[_0x49c4('0x54')][_0x49c4('0x5b')]||_0x513879[_0x49c4('0x5c')]['id'];return db['SmsMessage'][_0x49c4('0x51')]({'where':{'id':_0x513879['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})['then'](handleEntityNotFound(_0xc43386,null))[_0x49c4('0x1a')](saveUpdates(_0x513879[_0x49c4('0x54')],null))[_0x49c4('0x1a')](function(_0x28bbf3){if(_0x28bbf3){_0xb20a5d['message']=_0x28bbf3['get']({'plain':!![]});return db[_0x49c4('0x5d')][_0x49c4('0x51')]({'where':{'id':_0x28bbf3[_0x49c4('0x5e')]}});}return null;})[_0x49c4('0x1a')](handleEntityNotFound(_0xc43386,null))[_0x49c4('0x1a')](function(_0x404f98){if(_0x404f98){return _0x404f98[_0x49c4('0x53')]({'UserId':_0x513879[_0x49c4('0x54')]['UserId'],'read1stAt':_[_0x49c4('0x5f')](_0x404f98['read1stAt'])?moment()[_0x49c4('0x59')](_0x49c4('0x5a')):undefined});}return null;})[_0x49c4('0x1a')](function(_0x1ea1b4){if(_0x1ea1b4){_0xb20a5d[_0x49c4('0x60')]=_0x1ea1b4[_0x49c4('0x61')]({'plain':!![]});interaction_log[_0x49c4('0x1b')](_0x49c4('0x62'),_0x513879[_0x49c4('0x5c')]['id'],_0x513879[_0x49c4('0x5c')][_0x49c4('0x30')],_0x513879[_0x49c4('0x5c')][_0x49c4('0x63')],_0xb20a5d[_0x49c4('0x60')]['id'],_0x513879[_0x49c4('0x54')]?JSON[_0x49c4('0x1f')](_0x513879[_0x49c4('0x54')]):_0x49c4('0x64'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0xb20a5d);}return null;})[_0x49c4('0x1a')](function(_0x16b3e8){if(_0x16b3e8){if(_0x513879['body'][_0x49c4('0x65')]){_0xb20a5d[_0x49c4('0x21')][_0x49c4('0x66')]=util[_0x49c4('0x59')]('SIP/%s',_0x513879['user']['name']);_0xb20a5d[_0x49c4('0x21')][_0x49c4('0x67')]=_0xb20a5d[_0x49c4('0x67')];_0xb20a5d[_0x49c4('0x21')][_0x49c4('0x68')]=_0x49c4('0x69');return respondWithRpcPromise(_0x49c4('0x6a'),_0x49c4('0x6a'),{'event':_0x49c4('0x6b'),'message':_0xb20a5d['message']},client9002)[_0x49c4('0x1a')](function(){return _0xb20a5d;});}return _0xb20a5d;}return null;})[_0x49c4('0x1a')](respondWithResult(_0xc43386,null))[_0x49c4('0x23')](handleError(_0xc43386,null));};var interaction_log=require('../../config/logger')(_0x49c4('0x6c'));exports[_0x49c4('0x2d')]=function(_0x1fa0a6,_0xb6031b,_0x1f25be){var _0x2fd749={'agent':{},'channel':_0x49c4('0x57')};if(_0x1fa0a6[_0x49c4('0x54')]['id']){delete _0x1fa0a6['body']['id'];}_0x1fa0a6[_0x49c4('0x54')][_0x49c4('0x5b')]=_0x1fa0a6[_0x49c4('0x54')][_0x49c4('0x5b')]||_0x1fa0a6[_0x49c4('0x5c')]['id'];_0x2fd749['agent']['id']=_0x1fa0a6['body'][_0x49c4('0x5b')];return db['SmsMessage'][_0x49c4('0x51')]({'where':{'id':_0x1fa0a6['params']['id'],'UserId':null}})[_0x49c4('0x1a')](handleEntityNotFound(_0xb6031b,null))[_0x49c4('0x1a')](function(_0x3b03dd){if(_0x3b03dd){_0x2fd749[_0x49c4('0x21')]=_0x3b03dd['get']({'plain':!![]});return db[_0x49c4('0x5d')][_0x49c4('0x51')]({'where':{'id':_0x3b03dd[_0x49c4('0x5e')]}});}return null;})[_0x49c4('0x1a')](handleEntityNotFound(_0xb6031b,null))[_0x49c4('0x1a')](function(_0xbb7f42){if(_0xbb7f42){_0x2fd749[_0x49c4('0x60')]=_0xbb7f42[_0x49c4('0x61')]({'plain':!![]});interaction_log[_0x49c4('0x1b')](_0x49c4('0x6d'),_0x1fa0a6['user']['id'],_0x1fa0a6[_0x49c4('0x5c')][_0x49c4('0x30')],_0x1fa0a6['user'][_0x49c4('0x63')],_0x2fd749['interaction']['id'],_0x1fa0a6[_0x49c4('0x54')]?JSON[_0x49c4('0x1f')](_0x1fa0a6[_0x49c4('0x54')]):_0x49c4('0x64'));return respondWithRpcPromise(_0x49c4('0x6e'),'rejectMessage',_0x2fd749);}return null;})[_0x49c4('0x1a')](function(_0x2329b6){if(_0x2329b6){_0x2329b6['message'][_0x49c4('0x66')]=util[_0x49c4('0x59')]('SIP/%s',_0x1fa0a6[_0x49c4('0x5c')][_0x49c4('0x30')]);_0x2329b6['message'][_0x49c4('0x67')]=_0x2fd749[_0x49c4('0x67')];_0x2329b6[_0x49c4('0x21')][_0x49c4('0x68')]='reject';respondWithRpcPromise(_0x49c4('0x6a'),_0x49c4('0x6a'),{'event':'rejectmessage','message':_0x2329b6[_0x49c4('0x21')]},client9002);return _0x2fd749;}return null;})['then'](respondWithResult(_0xb6031b,null))['catch'](handleError(_0xb6031b,null));};exports[_0x49c4('0x25')]=function(_0x507078,_0x50fd24,_0x39cacf){if(_0x507078[_0x49c4('0x54')]['id']){delete _0x507078['body']['id'];}var _0x23e684;return db['SmsMessage']['find']({'where':{'id':_0x507078['params']['id']}})[_0x49c4('0x1a')](handleEntityNotFound(_0x50fd24,null))[_0x49c4('0x1a')](function(_0x20312b){if(_0x20312b){_0x23e684=_0x20312b;return db[_0x49c4('0x6f')]['find']({'where':{'id':_0x20312b['SmsAccountId']}});}})[_0x49c4('0x1a')](handleEntityNotFound(_0x50fd24,null))['then'](function(_0x2c560e){if(_0x2c560e){logger['debug'](_0x49c4('0x1d'),_0x49c4('0x25'),_0x49c4('0x70'),_0x2c560e[_0x49c4('0x71')],util[_0x49c4('0x72')](_0x507078[_0x49c4('0x54')],{'showHidden':![],'depth':null}));switch(_0x2c560e[_0x49c4('0x71')]){case'twilio':if(_0x507078[_0x49c4('0x54')][_0x49c4('0x73')]&&_0x507078[_0x49c4('0x54')][_0x49c4('0x73')]===_0x23e684[_0x49c4('0x74')]){return _0x23e684['update']({'read':!![]});}else{logger[_0x49c4('0x20')](_0x49c4('0x75'),_0x49c4('0x25'),'twilio',util['inspect'](_0x507078[_0x49c4('0x54')],{'showHidden':![],'depth':null}));}break;case _0x49c4('0x76'):if(_0x507078[_0x49c4('0x54')][_0x49c4('0x77')]&&_0x507078[_0x49c4('0x54')]['MessageUUID']===_0x23e684[_0x49c4('0x74')]&&_[_0x49c4('0x78')]([_0x49c4('0x79'),_0x49c4('0x7a')],_0x507078['body']['Status'])>=0x0){return _0x23e684[_0x49c4('0x53')]({'read':!![]});}else{logger[_0x49c4('0x20')](_0x49c4('0x75'),_0x49c4('0x25'),_0x49c4('0x7b'),util['inspect'](_0x507078[_0x49c4('0x54')],{'showHidden':![],'depth':null}));}break;case _0x49c4('0x7c'):var _0x44f20d=_0x507078[_0x49c4('0x54')][_0x49c4('0x7d')][0x0];if(_0x44f20d[_0x49c4('0x25')]['groupName']===_0x49c4('0x7e')){return _0x23e684[_0x49c4('0x53')]({'read':!![]});}else{logger[_0x49c4('0x20')](_0x49c4('0x75'),'status','infobip',util[_0x49c4('0x72')](_0x507078['body'],{'showHidden':![],'depth':null}));}break;}return _0x23e684;}})[_0x49c4('0x1a')](respondWithResult(_0x50fd24,null))['catch'](handleError(_0x50fd24,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 62ef2db..536ab8e 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 _0x8b3e=['events','../../mysqldb','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x3721d9,_0x1deba6){var _0x4a008c=function(_0x2d79e6){while(--_0x2d79e6){_0x3721d9['push'](_0x3721d9['shift']());}};_0x4a008c(++_0x1deba6);}(_0x8b3e,0x68));var _0xe8b3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8b3e[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xe8b3('0x0'));var SmsMessage=require(_0xe8b3('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xe8b3('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe8b3('0x3'),'afterDestroy':_0xe8b3('0x4')};function emitEvent(_0x5e8496){return function(_0x448fd6,_0x59553b,_0x459cff){SmsMessageEvents['emit'](_0x5e8496+':'+_0x448fd6['id'],_0x448fd6);SmsMessageEvents[_0xe8b3('0x5')](_0x5e8496,_0x448fd6);_0x459cff(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xe8b3('0x6')](e,emitEvent(event));}}module[_0xe8b3('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0x6f2a=['events','SmsMessage','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x32dbd1,_0x214170){var _0x4cfb22=function(_0x49b447){while(--_0x49b447){_0x32dbd1['push'](_0x32dbd1['shift']());}};_0x4cfb22(++_0x214170);}(_0x6f2a,0x1e0));var _0xa6f2=function(_0x3f5063,_0xc07451){_0x3f5063=_0x3f5063-0x0;var _0x5ae700=_0x6f2a[_0x3f5063];return _0x5ae700;};'use strict';var EventEmitter=require(_0xa6f2('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0xa6f2('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xa6f2('0x2')](0x0);var events={'afterCreate':_0xa6f2('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x258b13){return function(_0x28dcd2,_0x152baa,_0x269aee){SmsMessageEvents[_0xa6f2('0x4')](_0x258b13+':'+_0x28dcd2['id'],_0x28dcd2);SmsMessageEvents[_0xa6f2('0x4')](_0x258b13,_0x28dcd2);_0x269aee(null);};}for(var e in events){if(events[_0xa6f2('0x5')](e)){var event=events[e];SmsMessage[_0xa6f2('0x6')](e,emitEvent(event));}}module[_0xa6f2('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index bbdb548..ce0d3a6 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 _0x3d97=['read','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','token','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','length','createHash','md5','digest','hex','https://sms.csc.lv/external/get/send.php?','keys','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','finally','utf8mb4','lodash','api','moment','bluebird','./smsMessage.attributes','exports','define','sms_messages','messageId','models','get','direction','toLowerCase','out','isNil','UserId','findOne','update','createdAt','catch','error','secret','SmsAccountId','type','twilio','accountSid','authToken','messages','body','phone','remote','/api/sms/messages/','/status?token=','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','login?username=','&password=','password','GET','then','split','sms','POST','user_key','session_key','total_sent','smsMethod','deliveryReport','connectel','senderString','https://smsapi.connectel.se/api/send/','requestid'];(function(_0x592a9d,_0x434abb){var _0x59d2b3=function(_0x4661dc){while(--_0x4661dc){_0x592a9d['push'](_0x592a9d['shift']());}};_0x59d2b3(++_0x434abb);}(_0x3d97,0x9a));var _0x73d9=function(_0x34c43c,_0x2ed8b2){_0x34c43c=_0x34c43c-0x0;var _0x13a493=_0x3d97[_0x34c43c];return _0x13a493;};'use strict';var _=require(_0x73d9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x73d9('0x1'));var moment=require(_0x73d9('0x2'));var BPromise=require(_0x73d9('0x3'));var rp=require('request-promise');var attributes=require(_0x73d9('0x4'));module[_0x73d9('0x5')]=function(_0x46fed2,_0x4f8b5c){return _0x46fed2[_0x73d9('0x6')]('SmsMessage',attributes,{'tableName':_0x73d9('0x7'),'paranoid':![],'indexes':[{'name':_0x73d9('0x8'),'fields':[_0x73d9('0x8')]}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1b37bf,_0x5772bb,_0x602df5){var _0x1da8aa=_0x46fed2[_0x73d9('0x9')];var _0x296245=_0x1b37bf[_0x73d9('0xa')]({'plain':!![]});if(_0x296245['direction']['toLowerCase']()==='in'||_0x296245[_0x73d9('0xb')][_0x73d9('0xc')]()===_0x73d9('0xd')&&!_0x296245['secret']&&!_[_0x73d9('0xe')](_0x296245[_0x73d9('0xf')])){_0x1da8aa['SmsInteraction'][_0x73d9('0x10')]({'where':{'id':_0x296245['SmsInteractionId']}})['then'](function(_0xc5a3b9){if(_0xc5a3b9){_0xc5a3b9[_0x73d9('0x11')]({'lastMsgAt':_0x296245[_0x73d9('0x12')],'lastMsgDirection':_0x296245[_0x73d9('0xb')][_0x73d9('0xc')](),'lastMsgBody':_0x296245['body']});}})[_0x73d9('0x13')](function(_0x2c6750){console[_0x73d9('0x14')](_0x2c6750);});}if(_0x296245[_0x73d9('0xb')]===_0x73d9('0xd')&&!_0x296245[_0x73d9('0x15')]){var _0x30f974;_0x1da8aa['SmsAccount']['find']({'where':{'id':_0x296245[_0x73d9('0x16')]},'raw':!![]})['then'](function(_0x517431){_0x30f974=_0x517431;if(_0x30f974&&_0x30f974[_0x73d9('0x17')]){switch(_0x30f974[_0x73d9('0x17')]){case _0x73d9('0x18'):var _0x5a7b94=require('twilio');if(_0x30f974['accountSid']&&_0x30f974['authToken']&&_0x30f974['phone']){var _0x351a59=new _0x5a7b94(_0x30f974[_0x73d9('0x19')],_0x30f974[_0x73d9('0x1a')]);_0x351a59[_0x73d9('0x1b')]['create']({'body':_0x296245[_0x73d9('0x1c')],'to':_0x296245['phone'],'from':_0x30f974[_0x73d9('0x1d')],'statusCallback':_0x30f974[_0x73d9('0x1e')]+_0x73d9('0x1f')+_0x296245['id']+_0x73d9('0x20')+_0x30f974['token']})['then'](function(_0xdda92b){if(_0xdda92b[_0x73d9('0x21')]){return _0x1b37bf['update']({'messageId':_0xdda92b['sid']});}})[_0x73d9('0x13')](function(_0x4eb1d4){logger[_0x73d9('0x14')](_0x73d9('0x22'),_0x73d9('0x23'),_0x73d9('0x18'),util[_0x73d9('0x24')](_0x4eb1d4,{'showHidden':![],'depth':null}));});}else{logger[_0x73d9('0x14')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x73d9('0x23'),_0x73d9('0x18'),_0x73d9('0x25'));}break;case _0x73d9('0x26'):var _0x170a09=_0x73d9('0x27');if(_0x30f974[_0x73d9('0x28')]&&_0x30f974['password']){var _0xb1458d={'recipient':[_0x296245[_0x73d9('0x1d')]],'message':_0x296245[_0x73d9('0x1c')],'message_type':_0x30f974['smsMethod']};var _0x12b07e={'url':_0x170a09+_0x73d9('0x29')+_0x30f974[_0x73d9('0x28')]+_0x73d9('0x2a')+_0x30f974[_0x73d9('0x2b')],'method':_0x73d9('0x2c')};rp(_0x12b07e)[_0x73d9('0x2d')](function(_0x3ed5be){var _0x7cc845=_0x3ed5be[_0x73d9('0x2e')](';');var _0x4427f1={'user_key':_0x7cc845[0x0],'session_key':_0x7cc845[0x1]};_0x12b07e={'url':_0x170a09+_0x73d9('0x2f'),'method':_0x73d9('0x30'),'headers':{'user_key':_0x4427f1[_0x73d9('0x31')],'Session_key':_0x4427f1[_0x73d9('0x32')]},'json':!![],'body':_0xb1458d};return rp(_0x12b07e);})['then'](function(_0x38d317){if(_0x38d317[_0x73d9('0x33')]>=0x1){var _0xec672b={'messageId':_0x38d317['internal_order_id']};if(_0x30f974[_0x73d9('0x34')]!=='GP'||!_0x30f974[_0x73d9('0x35')]){_0xec672b['read']=!![];}return _0x1b37bf[_0x73d9('0x11')](_0xec672b);}else{return logger[_0x73d9('0x14')](_0x73d9('0x22'),'afterCreate','skebby',util[_0x73d9('0x24')](_0x38d317,{'showHidden':![],'depth':null}));}})[_0x73d9('0x13')](function(_0x58440c){return logger['error'](_0x73d9('0x22'),'afterCreate',_0x73d9('0x26'),util['inspect'](_0x58440c,{'showHidden':![],'depth':null}));});}else{logger[_0x73d9('0x14')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x73d9('0x23'),_0x73d9('0x26'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x73d9('0x36'):if(_0x30f974['authToken']){var _0x328fa4={'recipient':_0x296245[_0x73d9('0x1d')],'message':_0x296245[_0x73d9('0x1c')],'sender':_0x30f974[_0x73d9('0x37')]||_0x30f974[_0x73d9('0x1d')],'authorization':_0x30f974[_0x73d9('0x1a')]};var _0x5772bb={'method':'POST','uri':_0x73d9('0x38'),'body':_0x328fa4,'json':!![]};rp(_0x5772bb)['then'](function(_0x2dfc2c){var _0x8b1201={'messageId':_0x2dfc2c[_0x73d9('0x39')]};if(!_0x30f974['deliveryReport']){_0x8b1201[_0x73d9('0x3a')]=!![];}return _0x1b37bf[_0x73d9('0x11')](_0x8b1201);})[_0x73d9('0x13')](function(_0x4b4541){logger[_0x73d9('0x14')](_0x73d9('0x22'),_0x73d9('0x23'),'connectel',util['inspect'](_0x4b4541,{'showHidden':![],'depth':null}));});}else{logger[_0x73d9('0x14')](_0x73d9('0x22'),_0x73d9('0x23'),_0x73d9('0x36'),_0x73d9('0x3b'));}break;case _0x73d9('0x3c'):if(_0x30f974[_0x73d9('0x28')]&&_0x30f974['password']){var _0x328fa4={'messages':[{'source':_0x73d9('0x3d'),'to':_0x296245[_0x73d9('0x1d')],'body':_0x296245[_0x73d9('0x1c')],'from':_0x30f974[_0x73d9('0x37')]||_0x30f974['phone']}]};var _0x2b20f3=util[_0x73d9('0x3e')](_0x73d9('0x3f'),_0x30f974[_0x73d9('0x28')],_0x30f974['password']);var _0x5772bb={'method':_0x73d9('0x30'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x328fa4,'headers':{'Authorization':util[_0x73d9('0x3e')](_0x73d9('0x40'),new Buffer(_0x2b20f3)[_0x73d9('0x41')](_0x73d9('0x42')))},'json':!![]};rp(_0x5772bb)['then'](function(_0xf788ba){if(_0xf788ba['http_code']>=0xc8&&_0xf788ba[_0x73d9('0x43')]<=0xce){if(_0xf788ba['data']&&_0xf788ba[_0x73d9('0x44')][_0x73d9('0x45')]>0x0){var _0x35ed7b=_[_0x73d9('0x46')](_0xf788ba[_0x73d9('0x44')][_0x73d9('0x1b')]);var _0x87a618={'messageId':_0x35ed7b[_0x73d9('0x47')]};if(!_0x30f974[_0x73d9('0x35')]){_0x87a618[_0x73d9('0x3a')]=!![];}return _0x1b37bf['update'](_0x87a618);}else{logger['error'](_0x73d9('0x22'),'afterCreate',_0x73d9('0x48'),util['inspect'](_0xf788ba,{'showHidden':![],'depth':null}));}}else{logger[_0x73d9('0x14')](_0x73d9('0x22'),_0x73d9('0x23'),'clickSend',util[_0x73d9('0x24')](_0xf788ba,{'showHidden':![],'depth':null}));}})[_0x73d9('0x13')](function(_0x437c78){logger[_0x73d9('0x14')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x73d9('0x23'),'clickSend',util['inspect'](_0x437c78,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x73d9('0x23'),_0x73d9('0x48'),_0x73d9('0x49'));}break;case _0x73d9('0x4a'):if(_0x30f974[_0x73d9('0x4b')]&&_0x30f974[_0x73d9('0x1a')]){var _0x328fa4={'dst':_0x296245['phone'],'text':_0x296245[_0x73d9('0x1c')],'src':_0x30f974['senderString']||_0x30f974[_0x73d9('0x1d')],'url':_0x30f974['remote']+'/api/sms/messages/'+_0x296245['id']+_0x73d9('0x20')+_0x30f974[_0x73d9('0x4c')]};var _0x2b20f3=util['format'](_0x73d9('0x3f'),_0x30f974[_0x73d9('0x4b')],_0x30f974[_0x73d9('0x1a')]);var _0x5772bb={'method':_0x73d9('0x30'),'uri':util['format']('https://api.plivo.com/v1/Account/%s/Message/',_0x30f974[_0x73d9('0x4b')]),'body':_0x328fa4,'headers':{'Authorization':util[_0x73d9('0x3e')](_0x73d9('0x40'),new Buffer(_0x2b20f3)['toString'](_0x73d9('0x42')))},'json':!![]};rp(_0x5772bb)[_0x73d9('0x2d')](function(_0x44f793){var _0x2dad29={'messageId':_0x44f793[_0x73d9('0x4d')][0x0]};return _0x1b37bf['update'](_0x2dad29);})[_0x73d9('0x13')](function(_0x2a6524){logger['error'](_0x73d9('0x22'),_0x73d9('0x23'),_0x73d9('0x4a'),util[_0x73d9('0x24')](_0x2a6524,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x73d9('0x23'),_0x73d9('0x4a'),_0x73d9('0x4e'));}break;case _0x73d9('0x4f'):if(_0x30f974['username']&&_0x30f974[_0x73d9('0x2b')]){if(_0x30f974[_0x73d9('0x50')]){var _0x3ddeae={'method':_0x73d9('0x30'),'uri':_0x30f974['baseUrl']+'/auth/1/session','body':{'username':_0x30f974[_0x73d9('0x28')],'password':_0x30f974[_0x73d9('0x2b')]},'json':!![]};return rp(_0x3ddeae)['then'](function(_0x2d1384){var _0x47b755={'method':_0x73d9('0x30'),'uri':_0x30f974[_0x73d9('0x50')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x30f974[_0x73d9('0x1d')],'destinations':[{'to':_0x296245[_0x73d9('0x1d')]}],'text':_0x296245[_0x73d9('0x1c')],'notifyUrl':_0x30f974[_0x73d9('0x1e')]+'/api/sms/messages/'+_0x296245['id']+'/status?token='+_0x30f974[_0x73d9('0x4c')],'notifyContentType':_0x73d9('0x51'),'callbackData':_0x30f974[_0x73d9('0x1d')]+';'+_0x296245[_0x73d9('0x1c')]}]},'headers':{'Authorization':_0x73d9('0x52')+_0x2d1384[_0x73d9('0x4c')]},'json':!![]};return rp(_0x47b755)[_0x73d9('0x2d')](function(_0x5c6737){if(_0x5c6737[_0x73d9('0x1b')]){var _0x5112fe={'messageId':_0x5c6737['messages'][0x0][_0x73d9('0x8')]};if(!_0x30f974[_0x73d9('0x35')]){_0x5112fe[_0x73d9('0x3a')]=!![];}return _0x1b37bf[_0x73d9('0x11')](_0x5112fe);}else{return logger[_0x73d9('0x14')](_0x73d9('0x22'),_0x73d9('0x23'),_0x73d9('0x4f'),util['inspect'](_0x5c6737,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x2186ee){return logger['error'](_0x73d9('0x22'),_0x73d9('0x23'),_0x73d9('0x4f'),util[_0x73d9('0x24')](_0x2186ee,{'showHidden':![],'depth':null}));});}else{logger[_0x73d9('0x14')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x73d9('0x4f'),_0x73d9('0x53'));}}else{logger[_0x73d9('0x14')](_0x73d9('0x22'),'afterCreate',_0x73d9('0x4f'),_0x73d9('0x49'));}case _0x73d9('0x54'):var _0x133802=require(_0x73d9('0x55'));if(_0x30f974[_0x73d9('0x56')]){var _0x294c78={};_0x294c78[_0x73d9('0x57')]=_0x30f974[_0x73d9('0x28')];_0x294c78[_0x73d9('0x1d')]=_0x296245[_0x73d9('0x1d')];_0x294c78['sender']=_0x30f974[_0x73d9('0x1d')];_0x294c78[_0x73d9('0x58')]=_0x296245[_0x73d9('0x1c')];_0x294c78[_0x73d9('0x59')]=+new Date();var _0x579ded='';var _0x26da6c='';var _0x49899f=Object['keys'](_0x294c78);_0x49899f['sort']();for(var _0x362bcd=0x0;_0x362bcd<_0x49899f[_0x73d9('0x5a')];_0x362bcd++){if(_0x579ded!=''){_0x579ded+='&';}_0x579ded+=_0x49899f[_0x362bcd]+'='+encodeURIComponent(_0x294c78[_0x49899f[_0x362bcd]]);_0x26da6c+=_0x294c78[_0x49899f[_0x362bcd]];}_0x26da6c+=_0x30f974[_0x73d9('0x56')];_0x26da6c=_0x133802[_0x73d9('0x5b')](_0x73d9('0x5c'))['update'](_0x26da6c)[_0x73d9('0x5d')](_0x73d9('0x5e'));if(_0x579ded!==''){_0x579ded+='&';}_0x579ded+='signature='+_0x26da6c;var _0x12b07e={'method':_0x73d9('0x2c'),'uri':_0x73d9('0x5f')+_0x579ded,'json':!![]};return rp(_0x12b07e)[_0x73d9('0x2d')](function(_0x530d56){var _0x416166=Object[_0x73d9('0x60')](_0x530d56);if(_0x530d56[_0x416166[0x0]]['error']&&parseInt(_0x530d56[_0x416166[0x0]][_0x73d9('0x14')])===0x0){var _0x1af089={'messageId':_0x530d56[_0x416166[0x0]][_0x73d9('0x61')]};if(!_0x30f974['deliveryReport']){_0x1af089['read']=!![];}return _0x1b37bf[_0x73d9('0x11')](_0x1af089);}else{return logger[_0x73d9('0x14')](_0x73d9('0x22'),_0x73d9('0x23'),'csc',util['inspect'](_0x530d56[_0x73d9('0x14')],{'showHidden':![],'depth':null}));}})[_0x73d9('0x13')](function(_0x5bb091){return logger[_0x73d9('0x14')](_0x73d9('0x22'),_0x73d9('0x23'),_0x73d9('0x54'),util[_0x73d9('0x24')](_0x5bb091,{'showHidden':![],'depth':null}));});}else{logger[_0x73d9('0x14')](_0x73d9('0x22'),_0x73d9('0x23'),_0x73d9('0x54'),_0x73d9('0x62'));}case _0x73d9('0x63'):if(_0x30f974[_0x73d9('0x56')]){var _0x4c2e51={'method':_0x73d9('0x30'),'uri':_0x73d9('0x64'),'headers':{'Authorization':_0x30f974[_0x73d9('0x56')]},'body':{'content':_0x296245[_0x73d9('0x1c')],'to':[_0x296245[_0x73d9('0x1d')]],'from':_0x30f974[_0x73d9('0x1d')],'binary':![],'clientMessageId':_0x73d9('0x65'),'charset':_0x73d9('0x66')},'json':!![]};rp(_0x4c2e51)[_0x73d9('0x2d')](function(_0x155b5b){if(!_0x155b5b[_0x73d9('0x14')]){var _0x4709fe={'messageId':_0x155b5b[_0x73d9('0x1b')][0x0][_0x73d9('0x67')]};if(!_0x30f974['deliveryReport']){_0x4709fe['read']=!![];}return _0x1b37bf[_0x73d9('0x11')](_0x4709fe);}else{return logger[_0x73d9('0x14')](_0x73d9('0x22'),_0x73d9('0x23'),_0x73d9('0x63'),util[_0x73d9('0x24')](_0x155b5b['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0xc7ef68){return logger[_0x73d9('0x14')](_0x73d9('0x22'),_0x73d9('0x23'),_0x73d9('0x63'),util['inspect'](_0xc7ef68,{'showHidden':![],'depth':null}));});}else{logger[_0x73d9('0x14')](_0x73d9('0x22'),_0x73d9('0x23'),'clickatell',_0x73d9('0x62'));}break;}}})[_0x73d9('0x68')](function(){_0x602df5();});}else{_0x602df5();}}},'charset':_0x73d9('0x69'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa3fe=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','./smsMessage.attributes','define','SmsMessage','sms_messages','toLowerCase','direction','UserId','SmsInteraction','findOne','SmsInteractionId','createdAt','body','catch','error','out','secret','SmsAccount','find','SmsAccountId','then','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','&password=','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','update','senderString','https://smsapi.connectel.se/api/send/','requestid','connectel','Missing\x20parameters:\x20authToken','clicksend','password','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','message_id','clickSend','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','messageId','Missing\x20parameters:\x20username,\x20password','csc','apiKey','login','sender','text','timestamp','keys','sort','length','md5','hex','signature=','https://sms.csc.lv/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','finally'];(function(_0x3149ce,_0x136017){var _0x4b2d5d=function(_0x165065){while(--_0x165065){_0x3149ce['push'](_0x3149ce['shift']());}};_0x4b2d5d(++_0x136017);}(_0xa3fe,0xd8));var _0xea3f=function(_0x3dc1ff,_0x5d41a3){_0x3dc1ff=_0x3dc1ff-0x0;var _0x3e1472=_0xa3fe[_0x3dc1ff];return _0x3e1472;};'use strict';var _=require(_0xea3f('0x0'));var util=require('util');var logger=require(_0xea3f('0x1'))(_0xea3f('0x2'));var moment=require('moment');var BPromise=require(_0xea3f('0x3'));var rp=require(_0xea3f('0x4'));var attributes=require(_0xea3f('0x5'));module['exports']=function(_0x2880a2,_0x4e8978){return _0x2880a2[_0xea3f('0x6')](_0xea3f('0x7'),attributes,{'tableName':_0xea3f('0x8'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']}],'timestamps':!![],'hooks':{'afterCreate':function(_0x187ce0,_0x35ba50,_0x3c4807){var _0x5dbd3e=_0x2880a2['models'];var _0x464ad4=_0x187ce0['get']({'plain':!![]});if(_0x464ad4['direction'][_0xea3f('0x9')]()==='in'||_0x464ad4[_0xea3f('0xa')][_0xea3f('0x9')]()==='out'&&!_0x464ad4['secret']&&!_['isNil'](_0x464ad4[_0xea3f('0xb')])){_0x5dbd3e[_0xea3f('0xc')][_0xea3f('0xd')]({'where':{'id':_0x464ad4[_0xea3f('0xe')]}})['then'](function(_0x5afd23){if(_0x5afd23){_0x5afd23['update']({'lastMsgAt':_0x464ad4[_0xea3f('0xf')],'lastMsgDirection':_0x464ad4[_0xea3f('0xa')]['toLowerCase'](),'lastMsgBody':_0x464ad4[_0xea3f('0x10')]});}})[_0xea3f('0x11')](function(_0x4942ec){console[_0xea3f('0x12')](_0x4942ec);});}if(_0x464ad4[_0xea3f('0xa')]===_0xea3f('0x13')&&!_0x464ad4[_0xea3f('0x14')]){var _0x32c2f;_0x5dbd3e[_0xea3f('0x15')][_0xea3f('0x16')]({'where':{'id':_0x464ad4[_0xea3f('0x17')]},'raw':!![]})[_0xea3f('0x18')](function(_0x403fd2){_0x32c2f=_0x403fd2;if(_0x32c2f&&_0x32c2f[_0xea3f('0x19')]){switch(_0x32c2f[_0xea3f('0x19')]){case _0xea3f('0x1a'):var _0x116d13=require(_0xea3f('0x1a'));if(_0x32c2f[_0xea3f('0x1b')]&&_0x32c2f[_0xea3f('0x1c')]&&_0x32c2f[_0xea3f('0x1d')]){var _0x4bbd3c=new _0x116d13(_0x32c2f[_0xea3f('0x1b')],_0x32c2f[_0xea3f('0x1c')]);_0x4bbd3c[_0xea3f('0x1e')][_0xea3f('0x1f')]({'body':_0x464ad4[_0xea3f('0x10')],'to':_0x464ad4['phone'],'from':_0x32c2f['phone'],'statusCallback':_0x32c2f[_0xea3f('0x20')]+_0xea3f('0x21')+_0x464ad4['id']+'/status?token='+_0x32c2f[_0xea3f('0x22')]})[_0xea3f('0x18')](function(_0x1a2cdc){if(_0x1a2cdc[_0xea3f('0x23')]){return _0x187ce0['update']({'messageId':_0x1a2cdc['sid']});}})['catch'](function(_0x2f8bdc){logger[_0xea3f('0x12')](_0xea3f('0x24'),_0xea3f('0x25'),_0xea3f('0x1a'),util[_0xea3f('0x26')](_0x2f8bdc,{'showHidden':![],'depth':null}));});}else{logger[_0xea3f('0x12')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xea3f('0x25'),'twilio',_0xea3f('0x27'));}break;case _0xea3f('0x28'):var _0x1f66b3=_0xea3f('0x29');if(_0x32c2f[_0xea3f('0x2a')]&&_0x32c2f['password']){var _0xaf81bb={'recipient':[_0x464ad4['phone']],'message':_0x464ad4[_0xea3f('0x10')],'message_type':_0x32c2f[_0xea3f('0x2b')]};var _0x22bcbd={'url':_0x1f66b3+'login?username='+_0x32c2f[_0xea3f('0x2a')]+_0xea3f('0x2c')+_0x32c2f['password'],'method':_0xea3f('0x2d')};rp(_0x22bcbd)[_0xea3f('0x18')](function(_0x373413){var _0x391828=_0x373413[_0xea3f('0x2e')](';');var _0x177de5={'user_key':_0x391828[0x0],'session_key':_0x391828[0x1]};_0x22bcbd={'url':_0x1f66b3+_0xea3f('0x2f'),'method':_0xea3f('0x30'),'headers':{'user_key':_0x177de5[_0xea3f('0x31')],'Session_key':_0x177de5[_0xea3f('0x32')]},'json':!![],'body':_0xaf81bb};return rp(_0x22bcbd);})[_0xea3f('0x18')](function(_0x21b81c){if(_0x21b81c[_0xea3f('0x33')]>=0x1){var _0x2bca54={'messageId':_0x21b81c[_0xea3f('0x34')]};if(_0x32c2f[_0xea3f('0x2b')]!=='GP'||!_0x32c2f[_0xea3f('0x35')]){_0x2bca54[_0xea3f('0x36')]=!![];}return _0x187ce0[_0xea3f('0x37')](_0x2bca54);}else{return logger['error'](_0xea3f('0x24'),_0xea3f('0x25'),_0xea3f('0x28'),util[_0xea3f('0x26')](_0x21b81c,{'showHidden':![],'depth':null}));}})[_0xea3f('0x11')](function(_0x15531e){return logger[_0xea3f('0x12')](_0xea3f('0x24'),_0xea3f('0x25'),'skebby',util[_0xea3f('0x26')](_0x15531e,{'showHidden':![],'depth':null}));});}else{logger[_0xea3f('0x12')](_0xea3f('0x24'),_0xea3f('0x25'),_0xea3f('0x28'),'Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x32c2f[_0xea3f('0x1c')]){var _0x302fc0={'recipient':_0x464ad4[_0xea3f('0x1d')],'message':_0x464ad4[_0xea3f('0x10')],'sender':_0x32c2f[_0xea3f('0x38')]||_0x32c2f[_0xea3f('0x1d')],'authorization':_0x32c2f[_0xea3f('0x1c')]};var _0x35ba50={'method':'POST','uri':_0xea3f('0x39'),'body':_0x302fc0,'json':!![]};rp(_0x35ba50)['then'](function(_0x5cd639){var _0x5ef92d={'messageId':_0x5cd639[_0xea3f('0x3a')]};if(!_0x32c2f[_0xea3f('0x35')]){_0x5ef92d[_0xea3f('0x36')]=!![];}return _0x187ce0[_0xea3f('0x37')](_0x5ef92d);})[_0xea3f('0x11')](function(_0x2cfe17){logger[_0xea3f('0x12')](_0xea3f('0x24'),_0xea3f('0x25'),_0xea3f('0x3b'),util[_0xea3f('0x26')](_0x2cfe17,{'showHidden':![],'depth':null}));});}else{logger[_0xea3f('0x12')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xea3f('0x25'),'connectel',_0xea3f('0x3c'));}break;case _0xea3f('0x3d'):if(_0x32c2f[_0xea3f('0x2a')]&&_0x32c2f[_0xea3f('0x3e')]){var _0x302fc0={'messages':[{'source':'xCALLY\x20Motion','to':_0x464ad4[_0xea3f('0x1d')],'body':_0x464ad4['body'],'from':_0x32c2f[_0xea3f('0x38')]||_0x32c2f[_0xea3f('0x1d')]}]};var _0x312989=util[_0xea3f('0x3f')](_0xea3f('0x40'),_0x32c2f[_0xea3f('0x2a')],_0x32c2f[_0xea3f('0x3e')]);var _0x35ba50={'method':_0xea3f('0x30'),'uri':_0xea3f('0x41'),'body':_0x302fc0,'headers':{'Authorization':util[_0xea3f('0x3f')](_0xea3f('0x42'),new Buffer(_0x312989)[_0xea3f('0x43')](_0xea3f('0x44')))},'json':!![]};rp(_0x35ba50)[_0xea3f('0x18')](function(_0x4e064d){if(_0x4e064d[_0xea3f('0x45')]>=0xc8&&_0x4e064d['http_code']<=0xce){if(_0x4e064d[_0xea3f('0x46')]&&_0x4e064d['data'][_0xea3f('0x47')]>0x0){var _0x1431c3=_['head'](_0x4e064d[_0xea3f('0x46')][_0xea3f('0x1e')]);var _0x5ac5fd={'messageId':_0x1431c3[_0xea3f('0x48')]};if(!_0x32c2f[_0xea3f('0x35')]){_0x5ac5fd[_0xea3f('0x36')]=!![];}return _0x187ce0['update'](_0x5ac5fd);}else{logger[_0xea3f('0x12')](_0xea3f('0x24'),_0xea3f('0x25'),_0xea3f('0x49'),util[_0xea3f('0x26')](_0x4e064d,{'showHidden':![],'depth':null}));}}else{logger[_0xea3f('0x12')](_0xea3f('0x24'),_0xea3f('0x25'),_0xea3f('0x49'),util[_0xea3f('0x26')](_0x4e064d,{'showHidden':![],'depth':null}));}})[_0xea3f('0x11')](function(_0x192039){logger[_0xea3f('0x12')](_0xea3f('0x24'),'afterCreate','clickSend',util[_0xea3f('0x26')](_0x192039,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xea3f('0x24'),_0xea3f('0x25'),'clickSend','Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x32c2f['authId']&&_0x32c2f[_0xea3f('0x1c')]){var _0x302fc0={'dst':_0x464ad4[_0xea3f('0x1d')],'text':_0x464ad4[_0xea3f('0x10')],'src':_0x32c2f[_0xea3f('0x38')]||_0x32c2f[_0xea3f('0x1d')],'url':_0x32c2f['remote']+_0xea3f('0x21')+_0x464ad4['id']+'/status?token='+_0x32c2f[_0xea3f('0x22')]};var _0x312989=util['format'](_0xea3f('0x40'),_0x32c2f[_0xea3f('0x4a')],_0x32c2f['authToken']);var _0x35ba50={'method':_0xea3f('0x30'),'uri':util[_0xea3f('0x3f')](_0xea3f('0x4b'),_0x32c2f[_0xea3f('0x4a')]),'body':_0x302fc0,'headers':{'Authorization':util[_0xea3f('0x3f')](_0xea3f('0x42'),new Buffer(_0x312989)[_0xea3f('0x43')](_0xea3f('0x44')))},'json':!![]};rp(_0x35ba50)[_0xea3f('0x18')](function(_0x3f85db){var _0x3f307a={'messageId':_0x3f85db[_0xea3f('0x4c')][0x0]};return _0x187ce0['update'](_0x3f307a);})['catch'](function(_0x54e0bc){logger[_0xea3f('0x12')](_0xea3f('0x24'),_0xea3f('0x25'),_0xea3f('0x4d'),util[_0xea3f('0x26')](_0x54e0bc,{'showHidden':![],'depth':null}));});}else{logger[_0xea3f('0x12')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xea3f('0x25'),_0xea3f('0x4d'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xea3f('0x4e'):if(_0x32c2f['username']&&_0x32c2f[_0xea3f('0x3e')]){if(_0x32c2f[_0xea3f('0x4f')]){var _0x12f1c0={'method':_0xea3f('0x30'),'uri':_0x32c2f[_0xea3f('0x4f')]+_0xea3f('0x50'),'body':{'username':_0x32c2f[_0xea3f('0x2a')],'password':_0x32c2f[_0xea3f('0x3e')]},'json':!![]};return rp(_0x12f1c0)['then'](function(_0x4c58b6){var _0x52e549={'method':_0xea3f('0x30'),'uri':_0x32c2f[_0xea3f('0x4f')]+_0xea3f('0x51'),'body':{'messages':[{'from':_0x32c2f['phone'],'destinations':[{'to':_0x464ad4[_0xea3f('0x1d')]}],'text':_0x464ad4[_0xea3f('0x10')],'notifyUrl':_0x32c2f['remote']+_0xea3f('0x21')+_0x464ad4['id']+'/status?token='+_0x32c2f['token'],'notifyContentType':_0xea3f('0x52'),'callbackData':_0x32c2f['phone']+';'+_0x464ad4[_0xea3f('0x10')]}]},'headers':{'Authorization':_0xea3f('0x53')+_0x4c58b6[_0xea3f('0x22')]},'json':!![]};return rp(_0x52e549)[_0xea3f('0x18')](function(_0x148791){if(_0x148791['messages']){var _0x26530a={'messageId':_0x148791[_0xea3f('0x1e')][0x0][_0xea3f('0x54')]};if(!_0x32c2f[_0xea3f('0x35')]){_0x26530a[_0xea3f('0x36')]=!![];}return _0x187ce0[_0xea3f('0x37')](_0x26530a);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xea3f('0x25'),_0xea3f('0x4e'),util[_0xea3f('0x26')](_0x148791,{'showHidden':![],'depth':null}));}});})[_0xea3f('0x11')](function(_0x44d427){return logger[_0xea3f('0x12')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xea3f('0x25'),_0xea3f('0x4e'),util[_0xea3f('0x26')](_0x44d427,{'showHidden':![],'depth':null}));});}else{logger[_0xea3f('0x12')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xea3f('0x25'),_0xea3f('0x4e'),'Missing\x20parameters:\x20base_url');}}else{logger[_0xea3f('0x12')](_0xea3f('0x24'),_0xea3f('0x25'),'infobip',_0xea3f('0x55'));}case _0xea3f('0x56'):var _0x5d7e08=require('crypto');if(_0x32c2f[_0xea3f('0x57')]){var _0x316f2d={};_0x316f2d[_0xea3f('0x58')]=_0x32c2f[_0xea3f('0x2a')];_0x316f2d[_0xea3f('0x1d')]=_0x464ad4[_0xea3f('0x1d')];_0x316f2d[_0xea3f('0x59')]=_0x32c2f[_0xea3f('0x1d')];_0x316f2d[_0xea3f('0x5a')]=_0x464ad4[_0xea3f('0x10')];_0x316f2d[_0xea3f('0x5b')]=+new Date();var _0x421dda='';var _0x1fdcef='';var _0x2d6164=Object[_0xea3f('0x5c')](_0x316f2d);_0x2d6164[_0xea3f('0x5d')]();for(var _0x3a5ee8=0x0;_0x3a5ee8<_0x2d6164[_0xea3f('0x5e')];_0x3a5ee8++){if(_0x421dda!=''){_0x421dda+='&';}_0x421dda+=_0x2d6164[_0x3a5ee8]+'='+encodeURIComponent(_0x316f2d[_0x2d6164[_0x3a5ee8]]);_0x1fdcef+=_0x316f2d[_0x2d6164[_0x3a5ee8]];}_0x1fdcef+=_0x32c2f[_0xea3f('0x57')];_0x1fdcef=_0x5d7e08['createHash'](_0xea3f('0x5f'))[_0xea3f('0x37')](_0x1fdcef)['digest'](_0xea3f('0x60'));if(_0x421dda!==''){_0x421dda+='&';}_0x421dda+=_0xea3f('0x61')+_0x1fdcef;var _0x22bcbd={'method':_0xea3f('0x2d'),'uri':_0xea3f('0x62')+_0x421dda,'json':!![]};return rp(_0x22bcbd)[_0xea3f('0x18')](function(_0x16ddf9){var _0x4750aa=Object['keys'](_0x16ddf9);if(_0x16ddf9[_0x4750aa[0x0]][_0xea3f('0x12')]&&parseInt(_0x16ddf9[_0x4750aa[0x0]][_0xea3f('0x12')])===0x0){var _0x5119b4={'messageId':_0x16ddf9[_0x4750aa[0x0]]['id_sms']};if(!_0x32c2f[_0xea3f('0x35')]){_0x5119b4[_0xea3f('0x36')]=!![];}return _0x187ce0['update'](_0x5119b4);}else{return logger['error'](_0xea3f('0x24'),'afterCreate',_0xea3f('0x56'),util[_0xea3f('0x26')](_0x16ddf9['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0xf17c31){return logger[_0xea3f('0x12')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xea3f('0x25'),_0xea3f('0x56'),util[_0xea3f('0x26')](_0xf17c31,{'showHidden':![],'depth':null}));});}else{logger[_0xea3f('0x12')](_0xea3f('0x24'),_0xea3f('0x25'),_0xea3f('0x56'),_0xea3f('0x63'));}case _0xea3f('0x64'):if(_0x32c2f[_0xea3f('0x57')]){var _0x401570={'method':_0xea3f('0x30'),'uri':_0xea3f('0x65'),'headers':{'Authorization':_0x32c2f[_0xea3f('0x57')]},'body':{'content':_0x464ad4['body'],'to':[_0x464ad4[_0xea3f('0x1d')]],'from':_0x32c2f[_0xea3f('0x1d')],'binary':![],'clientMessageId':_0xea3f('0x66'),'charset':_0xea3f('0x67')},'json':!![]};rp(_0x401570)[_0xea3f('0x18')](function(_0x5a8d8e){if(!_0x5a8d8e['error']){var _0x26b6c5={'messageId':_0x5a8d8e[_0xea3f('0x1e')][0x0]['apiMessageId']};if(!_0x32c2f[_0xea3f('0x35')]){_0x26b6c5[_0xea3f('0x36')]=!![];}return _0x187ce0[_0xea3f('0x37')](_0x26b6c5);}else{return logger[_0xea3f('0x12')](_0xea3f('0x24'),_0xea3f('0x25'),_0xea3f('0x64'),util['inspect'](_0x5a8d8e[_0xea3f('0x12')],{'showHidden':![],'depth':null}));}})[_0xea3f('0x11')](function(_0x5a1f63){return logger[_0xea3f('0x12')](_0xea3f('0x24'),_0xea3f('0x25'),_0xea3f('0x64'),util['inspect'](_0x5a1f63,{'showHidden':![],'depth':null}));});}else{logger[_0xea3f('0x12')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xea3f('0x25'),'clickatell',_0xea3f('0x63'));}break;}}})[_0xea3f('0x68')](function(){_0x3c4807();});}else{_0x3c4807();}}},'charset':_0xea3f('0x69'),'collate':_0xea3f('0x6a')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 9db65c4..adc54b7 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 _0x9f63=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','message','result','SmsMessage','create','options','raw','then','CreateSmsMessage','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x4057b4,_0xd57996){var _0x17170c=function(_0x2bb26d){while(--_0x2bb26d){_0x4057b4['push'](_0x4057b4['shift']());}};_0x17170c(++_0xd57996);}(_0x9f63,0x163));var _0x39f6=function(_0x5becc0,_0x5be6c3){_0x5becc0=_0x5becc0-0x0;var _0x46d254=_0x9f63[_0x5becc0];return _0x46d254;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x39f6('0x0'));var BPromise=require(_0x39f6('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x39f6('0x2'));var db=require(_0x39f6('0x3'))['db'];var utils=require(_0x39f6('0x4'));var logger=require('../../config/logger')(_0x39f6('0x5'));var config=require(_0x39f6('0x6'));var jayson=require(_0x39f6('0x7'));var client=jayson[_0x39f6('0x8')][_0x39f6('0x9')]({'port':0x232a});config[_0x39f6('0xa')]=_[_0x39f6('0xb')](config['redis'],{'host':_0x39f6('0xc'),'port':0x18eb});var socket=require(_0x39f6('0xd'))(new Redis(config['redis']));require('./smsMessage.socket')[_0x39f6('0xe')](socket);function respondWithRpcPromise(_0x11ac93,_0x5181b7,_0x40a85b){return new BPromise(function(_0x352d89,_0x38255b){return client['request'](_0x11ac93,_0x40a85b)['then'](function(_0x16ec5b){logger[_0x39f6('0xf')](_0x39f6('0x10'),_0x5181b7,_0x39f6('0x11'));logger[_0x39f6('0x12')](_0x39f6('0x13'),_0x5181b7,_0x39f6('0x11'),JSON['stringify'](_0x16ec5b));if(_0x16ec5b[_0x39f6('0x14')]){if(_0x16ec5b['error']['code']===0x1f4){logger[_0x39f6('0x14')](_0x39f6('0x10'),_0x5181b7,_0x16ec5b[_0x39f6('0x14')][_0x39f6('0x15')]);return _0x38255b(_0x16ec5b[_0x39f6('0x14')][_0x39f6('0x15')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x5181b7,_0x16ec5b[_0x39f6('0x14')][_0x39f6('0x15')]);return _0x352d89(_0x16ec5b['error'][_0x39f6('0x15')]);}else{logger[_0x39f6('0xf')]('SmsMessage,\x20%s,\x20%s',_0x5181b7,'request\x20sent');_0x352d89(_0x16ec5b[_0x39f6('0x16')][_0x39f6('0x15')]);}})['catch'](function(_0xa0124b){logger['error'](_0x39f6('0x10'),_0x5181b7,_0xa0124b);_0x38255b(_0xa0124b);});});}exports['CreateSmsMessage']=function(_0x5efcd4){var _0x41ee84=this;return new Promise(function(_0x4a91d3,_0x5a71b4){return db[_0x39f6('0x17')][_0x39f6('0x18')](_0x5efcd4['body'],{'raw':_0x5efcd4[_0x39f6('0x19')]?_0x5efcd4[_0x39f6('0x19')][_0x39f6('0x1a')]===undefined?!![]:![]:!![]})[_0x39f6('0x1b')](function(_0x36e9d7){logger[_0x39f6('0xf')](_0x39f6('0x1c'),_0x5efcd4);logger[_0x39f6('0x12')](_0x39f6('0x1c'),_0x5efcd4,JSON['stringify'](_0x36e9d7));_0x4a91d3(_0x36e9d7);})[_0x39f6('0x1d')](function(_0x18f0a0){logger[_0x39f6('0x14')](_0x39f6('0x1c'),_0x18f0a0[_0x39f6('0x15')],_0x5efcd4);_0x5a71b4(_0x41ee84[_0x39f6('0x14')](0x1f4,_0x18f0a0[_0x39f6('0x15')]));});});}; \ No newline at end of file +var _0x6c31=['catch','CreateSmsMessage','SmsMessage','create','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./smsMessage.socket','request','then','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x28ea35,_0xb8cc1b){var _0x278874=function(_0xdaa9b0){while(--_0xdaa9b0){_0x28ea35['push'](_0x28ea35['shift']());}};_0x278874(++_0xb8cc1b);}(_0x6c31,0x66));var _0x16c3=function(_0x521084,_0x3fbb5e){_0x521084=_0x521084-0x0;var _0x3323e0=_0x6c31[_0x521084];return _0x3323e0;};'use strict';var _=require(_0x16c3('0x0'));var util=require(_0x16c3('0x1'));var moment=require(_0x16c3('0x2'));var BPromise=require(_0x16c3('0x3'));var rs=require(_0x16c3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x16c3('0x5'))['db'];var utils=require(_0x16c3('0x6'));var logger=require(_0x16c3('0x7'))('rpc');var config=require(_0x16c3('0x8'));var jayson=require(_0x16c3('0x9'));var client=jayson[_0x16c3('0xa')][_0x16c3('0xb')]({'port':0x232a});config['redis']=_[_0x16c3('0xc')](config['redis'],{'host':_0x16c3('0xd'),'port':0x18eb});var socket=require(_0x16c3('0xe'))(new Redis(config['redis']));require(_0x16c3('0xf'))['register'](socket);function respondWithRpcPromise(_0x3192d1,_0x47fd97,_0x324cb9){return new BPromise(function(_0x4d5103,_0xc435f2){return client[_0x16c3('0x10')](_0x3192d1,_0x324cb9)[_0x16c3('0x11')](function(_0x19f76b){logger['info'](_0x16c3('0x12'),_0x47fd97,'request\x20sent');logger[_0x16c3('0x13')](_0x16c3('0x14'),_0x47fd97,_0x16c3('0x15'),JSON[_0x16c3('0x16')](_0x19f76b));if(_0x19f76b[_0x16c3('0x17')]){if(_0x19f76b[_0x16c3('0x17')]['code']===0x1f4){logger[_0x16c3('0x17')](_0x16c3('0x12'),_0x47fd97,_0x19f76b[_0x16c3('0x17')][_0x16c3('0x18')]);return _0xc435f2(_0x19f76b[_0x16c3('0x17')][_0x16c3('0x18')]);}logger['error'](_0x16c3('0x12'),_0x47fd97,_0x19f76b[_0x16c3('0x17')][_0x16c3('0x18')]);return _0x4d5103(_0x19f76b['error'][_0x16c3('0x18')]);}else{logger['info'](_0x16c3('0x12'),_0x47fd97,_0x16c3('0x15'));_0x4d5103(_0x19f76b[_0x16c3('0x19')][_0x16c3('0x18')]);}})[_0x16c3('0x1a')](function(_0x2dd638){logger['error']('SmsMessage,\x20%s,\x20%s',_0x47fd97,_0x2dd638);_0xc435f2(_0x2dd638);});});}exports[_0x16c3('0x1b')]=function(_0x54618e){var _0x530872=this;return new Promise(function(_0xeae372,_0x27f01d){return db[_0x16c3('0x1c')][_0x16c3('0x1d')](_0x54618e['body'],{'raw':_0x54618e['options']?_0x54618e[_0x16c3('0x1e')][_0x16c3('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0xb15a75){logger['info'](_0x16c3('0x1b'),_0x54618e);logger['debug'](_0x16c3('0x1b'),_0x54618e,JSON[_0x16c3('0x16')](_0xb15a75));_0xeae372(_0xb15a75);})[_0x16c3('0x1a')](function(_0x1f2215){logger[_0x16c3('0x17')](_0x16c3('0x1b'),_0x1f2215[_0x16c3('0x18')],_0x54618e);_0x27f01d(_0x530872[_0x16c3('0x17')](0x1f4,_0x1f2215['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 5950eb8..f1b55d2 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 _0xee34=['update','removeListener','length','smsMessage:','./smsMessage.events','save','remove'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0xee34,0x154));var _0x4ee3=function(_0x5abe6b,_0x47559a){_0x5abe6b=_0x5abe6b-0x0;var _0x5cc806=_0xee34[_0x5abe6b];return _0x5cc806;};'use strict';var SmsMessageEvents=require(_0x4ee3('0x0'));var events=[_0x4ee3('0x1'),_0x4ee3('0x2'),_0x4ee3('0x3')];function createListener(_0x499ef2,_0xe9bba){return function(_0x738773){_0xe9bba['emit'](_0x499ef2,_0x738773);};}function removeListener(_0x1179b0,_0x614a86){return function(){SmsMessageEvents[_0x4ee3('0x4')](_0x1179b0,_0x614a86);};}exports['register']=function(_0x154806){for(var _0x5e0136=0x0,_0x3a28dc=events[_0x4ee3('0x5')];_0x5e0136<_0x3a28dc;_0x5e0136++){var _0x300013=events[_0x5e0136];var _0x41f271=createListener(_0x4ee3('0x6')+_0x300013,_0x154806);SmsMessageEvents['on'](_0x300013,_0x41f271);}}; \ No newline at end of file +var _0x8ccd=['update','emit','removeListener','register','length','./smsMessage.events','save','remove'];(function(_0x34cefe,_0x4d4e4d){var _0xc48806=function(_0x490162){while(--_0x490162){_0x34cefe['push'](_0x34cefe['shift']());}};_0xc48806(++_0x4d4e4d);}(_0x8ccd,0xcd));var _0xd8cc=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x8ccd[_0x43d11d];return _0x38cd08;};'use strict';var SmsMessageEvents=require(_0xd8cc('0x0'));var events=[_0xd8cc('0x1'),_0xd8cc('0x2'),_0xd8cc('0x3')];function createListener(_0x378629,_0x457de6){return function(_0x1777e7){_0x457de6[_0xd8cc('0x4')](_0x378629,_0x1777e7);};}function removeListener(_0x1c85dc,_0x2eee10){return function(){SmsMessageEvents[_0xd8cc('0x5')](_0x1c85dc,_0x2eee10);};}exports[_0xd8cc('0x6')]=function(_0x3bf1a3){for(var _0x10912d=0x0,_0x594c4b=events[_0xd8cc('0x7')];_0x10912d<_0x594c4b;_0x10912d++){var _0x1ba92d=events[_0x10912d];var _0xfdbffd=createListener('smsMessage:'+_0x1ba92d,_0x3bf1a3);SmsMessageEvents['on'](_0x1ba92d,_0xfdbffd);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index decc0a6..61db148 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 _0xd4be=['/describe','describe','/:id','/:id/members','getMembers','getTeams','getAgents','post','create','/:id/teams','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeTeams','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index'];(function(_0x321978,_0x24e585){var _0x44cfba=function(_0xd052f8){while(--_0xd052f8){_0x321978['push'](_0x321978['shift']());}};_0x44cfba(++_0x24e585);}(_0xd4be,0xa8));var _0xed4b=function(_0x3b4889,_0x319ed1){_0x3b4889=_0x3b4889-0x0;var _0x5074dd=_0xd4be[_0x3b4889];return _0x5074dd;};'use strict';var multer=require(_0xed4b('0x0'));var util=require('util');var path=require(_0xed4b('0x1'));var timeout=require(_0xed4b('0x2'));var express=require(_0xed4b('0x3'));var router=express[_0xed4b('0x4')]();var auth=require(_0xed4b('0x5'));var interaction=require(_0xed4b('0x6'));var config=require(_0xed4b('0x7'));var controller=require(_0xed4b('0x8'));router[_0xed4b('0x9')]('/',auth[_0xed4b('0xa')](),controller[_0xed4b('0xb')]);router[_0xed4b('0x9')](_0xed4b('0xc'),auth[_0xed4b('0xa')](),controller[_0xed4b('0xd')]);router[_0xed4b('0x9')](_0xed4b('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xed4b('0x9')](_0xed4b('0xf'),auth[_0xed4b('0xa')](),controller[_0xed4b('0x10')]);router[_0xed4b('0x9')]('/:id/teams',auth[_0xed4b('0xa')](),controller[_0xed4b('0x11')]);router['get']('/:id/users',auth[_0xed4b('0xa')](),controller[_0xed4b('0x12')]);router[_0xed4b('0x13')]('/',auth[_0xed4b('0xa')](),controller[_0xed4b('0x14')]);router[_0xed4b('0x13')](_0xed4b('0x15'),auth[_0xed4b('0xa')](),controller[_0xed4b('0x16')]);router[_0xed4b('0x13')](_0xed4b('0x17'),auth[_0xed4b('0xa')](),controller[_0xed4b('0x18')]);router[_0xed4b('0x19')]('/:id',auth[_0xed4b('0xa')](),controller[_0xed4b('0x1a')]);router[_0xed4b('0x1b')](_0xed4b('0xe'),auth[_0xed4b('0xa')](),controller[_0xed4b('0x1c')]);router[_0xed4b('0x1b')](_0xed4b('0x15'),auth[_0xed4b('0xa')](),controller[_0xed4b('0x1d')]);router[_0xed4b('0x1b')]('/:id/users',auth[_0xed4b('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x4bb5=['removeAgents','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','describe','show','get','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','put','update','/:id','destroy','delete','removeTeams'];(function(_0x1b92a6,_0x14444b){var _0x24be5b=function(_0x3a5fb5){while(--_0x3a5fb5){_0x1b92a6['push'](_0x1b92a6['shift']());}};_0x24be5b(++_0x14444b);}(_0x4bb5,0x110));var _0x54bb=function(_0x3255bd,_0x3436f3){_0x3255bd=_0x3255bd-0x0;var _0x23685b=_0x4bb5[_0x3255bd];return _0x23685b;};'use strict';var multer=require('multer');var util=require(_0x54bb('0x0'));var path=require(_0x54bb('0x1'));var timeout=require('connect-timeout');var express=require(_0x54bb('0x2'));var router=express[_0x54bb('0x3')]();var auth=require(_0x54bb('0x4'));var interaction=require(_0x54bb('0x5'));var config=require(_0x54bb('0x6'));var controller=require(_0x54bb('0x7'));router['get']('/',auth[_0x54bb('0x8')](),controller['index']);router['get']('/describe',auth[_0x54bb('0x8')](),controller[_0x54bb('0x9')]);router['get']('/:id',auth[_0x54bb('0x8')](),controller[_0x54bb('0xa')]);router[_0x54bb('0xb')](_0x54bb('0xc'),auth[_0x54bb('0x8')](),controller[_0x54bb('0xd')]);router['get'](_0x54bb('0xe'),auth[_0x54bb('0x8')](),controller['getTeams']);router[_0x54bb('0xb')](_0x54bb('0xf'),auth[_0x54bb('0x8')](),controller[_0x54bb('0x10')]);router[_0x54bb('0x11')]('/',auth[_0x54bb('0x8')](),controller[_0x54bb('0x12')]);router[_0x54bb('0x11')]('/:id/teams',auth[_0x54bb('0x8')](),controller['addTeams']);router[_0x54bb('0x11')](_0x54bb('0xf'),auth[_0x54bb('0x8')](),controller['addAgents']);router[_0x54bb('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x54bb('0x14')]);router['delete'](_0x54bb('0x15'),auth[_0x54bb('0x8')](),controller[_0x54bb('0x16')]);router[_0x54bb('0x17')]('/:id/teams',auth[_0x54bb('0x8')](),controller[_0x54bb('0x18')]);router[_0x54bb('0x17')]('/:id/users',auth[_0x54bb('0x8')](),controller[_0x54bb('0x19')]);module[_0x54bb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 0911e96..54e36c1 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 _0xa365=['ENUM','rrmemory','beepall','STRING','name','INTEGER'];(function(_0x56449e,_0x444621){var _0x41cf9c=function(_0x33b0e9){while(--_0x33b0e9){_0x56449e['push'](_0x56449e['shift']());}};_0x41cf9c(++_0x444621);}(_0xa365,0xc3));var _0x5a36=function(_0x5b50fa,_0x11c374){_0x5b50fa=_0x5b50fa-0x0;var _0x14d6a7=_0xa365[_0x5b50fa];return _0x14d6a7;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5a36('0x0')],'unique':_0x5a36('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5a36('0x0')]},'timeout':{'type':Sequelize[_0x5a36('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5a36('0x3')](_0x5a36('0x4'),_0x5a36('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x26a4=['beepall','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x3da5f8,_0x194be3){var _0x1ec7a4=function(_0x513644){while(--_0x513644){_0x3da5f8['push'](_0x3da5f8['shift']());}};_0x1ec7a4(++_0x194be3);}(_0x26a4,0x119));var _0x426a=function(_0x112b3b,_0x38a1cd){_0x112b3b=_0x112b3b-0x0;var _0x44e6c8=_0x26a4[_0x112b3b];return _0x44e6c8;};'use strict';var Sequelize=require('sequelize');module[_0x426a('0x0')]={'name':{'type':Sequelize[_0x426a('0x1')],'unique':_0x426a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x426a('0x1')]},'timeout':{'type':Sequelize[_0x426a('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x426a('0x4')](_0x426a('0x5'),_0x426a('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index d7b587b..f5537c7 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 _0x6569=['squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','json','set','Content-Range','apply','save','update','then','destroy','end','error','name','send','index','rawAttributes','keys','query','dateStart','dateEnd','intersection','attributes','fields','length','model','nolimit','limit','offset','sort','where','filters','pick','day','filter','merge','map','options','SmsQueue','count','includeAll','include','findAll','rows','show','params','find','create','body','catch','describe','getMembers','get','hasOwnProperty','order','SmsQueueId','UserSmsQueue','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','Agents','union','penalty','ids','User','addAgents','omit','spread','emit','userSmsQueue:save','removeAgents','userSmsQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x5b26be,_0x24893b){var _0x4c02c9=function(_0x17dac2){while(--_0x17dac2){_0x5b26be['push'](_0x5b26be['shift']());}};_0x4c02c9(++_0x24893b);}(_0x6569,0xcb));var _0x9656=function(_0x37a079,_0x1a972d){_0x37a079=_0x37a079-0x0;var _0x30cffb=_0x6569[_0x37a079];return _0x30cffb;};'use strict';var pdf=require(_0x9656('0x0'));var emlformat=require(_0x9656('0x1'));var rimraf=require(_0x9656('0x2'));var zipdir=require(_0x9656('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9656('0x4'));var BPromise=require(_0x9656('0x5'));var Mustache=require(_0x9656('0x6'));var util=require(_0x9656('0x7'));var path=require(_0x9656('0x8'));var sox=require(_0x9656('0x9'));var csv=require(_0x9656('0xa'));var ejs=require(_0x9656('0xb'));var fs=require('fs');var _=require(_0x9656('0xc'));var squel=require(_0x9656('0xd'));var crypto=require('crypto');var jsforce=require(_0x9656('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9656('0xa'));var querystring=require(_0x9656('0xf'));var Papa=require('papaparse');var Redis=require(_0x9656('0x10'));var qs=require(_0x9656('0x11'));var logger=require(_0x9656('0x12'))(_0x9656('0x13'));var utils=require(_0x9656('0x14'));var config=require(_0x9656('0x15'));var db=require('../../mysqldb')['db'];config[_0x9656('0x16')]=_[_0x9656('0x17')](config[_0x9656('0x16')],{'host':_0x9656('0x18'),'port':0x18eb});var socket=require(_0x9656('0x19'))(new Redis(config[_0x9656('0x16')]));require(_0x9656('0x1a'))[_0x9656('0x1b')](socket);function respondWithStatusCode(_0x5c9016,_0x1f1c7a){_0x1f1c7a=_0x1f1c7a||0xcc;return function(_0x3d356a){if(_0x3d356a){return _0x5c9016[_0x9656('0x1c')](_0x1f1c7a);}return _0x5c9016['status'](_0x1f1c7a)['end']();};}function respondWithResult(_0x1b247a,_0x26d660){_0x26d660=_0x26d660||0xc8;return function(_0x5749d5){if(_0x5749d5){return _0x1b247a[_0x9656('0x1d')](_0x26d660)[_0x9656('0x1e')](_0x5749d5);}};}function respondWithFilteredResult(_0xfbf4a5,_0x4dd9d9){return function(_0x4f0f08){if(_0x4f0f08){var _0x3f2f8f=_0x4f0f08['count'],_0x41ec48=_0x4dd9d9['offset'],_0x4c09d9=_0x4dd9d9['offset']+_0x4dd9d9['limit'],_0x104367;if(_0x4c09d9>=_0x3f2f8f){_0x4c09d9=_0x3f2f8f;_0x104367=0xc8;}else{_0x104367=0xce;}_0xfbf4a5[_0x9656('0x1d')](_0x104367);return _0xfbf4a5[_0x9656('0x1f')](_0x9656('0x20'),_0x41ec48+'-'+_0x4c09d9+'/'+_0x3f2f8f)[_0x9656('0x1e')](_0x4f0f08);}return null;};}function patchUpdates(_0x46c63c){return function(_0x55b889){try{jsonpatch[_0x9656('0x21')](_0x55b889,_0x46c63c,!![]);}catch(_0x3cb7dc){return BPromise['reject'](_0x3cb7dc);}return _0x55b889[_0x9656('0x22')]();};}function saveUpdates(_0x149c3c,_0x8fe31c){return function(_0x1c03cc){if(_0x1c03cc){return _0x1c03cc[_0x9656('0x23')](_0x149c3c)[_0x9656('0x24')](function(_0x4b5667){return _0x4b5667;});}return null;};}function removeEntity(_0x3e17a0,_0x2b3672){return function(_0x4a6e02){if(_0x4a6e02){return _0x4a6e02[_0x9656('0x25')]()[_0x9656('0x24')](function(){_0x3e17a0[_0x9656('0x1d')](0xcc)[_0x9656('0x26')]();});}};}function handleEntityNotFound(_0x295b21,_0x24cb6e){return function(_0x3369b0){if(!_0x3369b0){_0x295b21[_0x9656('0x1c')](0x194);}return _0x3369b0;};}function handleError(_0x201cd0,_0x144b7a){_0x144b7a=_0x144b7a||0x1f4;return function(_0x1c601e){logger[_0x9656('0x27')](_0x1c601e['stack']);if(_0x1c601e['name']){delete _0x1c601e[_0x9656('0x28')];}_0x201cd0[_0x9656('0x1d')](_0x144b7a)[_0x9656('0x29')](_0x1c601e);};}exports[_0x9656('0x2a')]=function(_0x472d3e,_0x501ea4){var _0x543d85={},_0x1c5024={},_0xb69608={'count':0x0,'rows':[]};var _0x22149b=db['SmsQueue'][_0x9656('0x2b')];_0x1c5024['model']=_[_0x9656('0x2c')](_0x22149b);var _0x2df297={'dateStart':_0x472d3e[_0x9656('0x2d')][_0x9656('0x2e')],'dateEnd':_0x472d3e['query'][_0x9656('0x2f')]};delete _0x472d3e[_0x9656('0x2d')][_0x9656('0x2e')];delete _0x472d3e[_0x9656('0x2d')][_0x9656('0x2f')];_0x1c5024['query']=_[_0x9656('0x2c')](_0x472d3e['query']);_0x1c5024['filters']=_[_0x9656('0x30')](_0x1c5024['model'],_0x1c5024[_0x9656('0x2d')]);_0x543d85[_0x9656('0x31')]=_[_0x9656('0x30')](_0x1c5024['model'],qs[_0x9656('0x32')](_0x472d3e['query'][_0x9656('0x32')]));_0x543d85[_0x9656('0x31')]=_0x543d85[_0x9656('0x31')][_0x9656('0x33')]?_0x543d85[_0x9656('0x31')]:_0x1c5024[_0x9656('0x34')];if(!_0x472d3e[_0x9656('0x2d')]['hasOwnProperty'](_0x9656('0x35'))){_0x543d85['limit']=qs[_0x9656('0x36')](_0x472d3e[_0x9656('0x2d')][_0x9656('0x36')]);_0x543d85['offset']=qs[_0x9656('0x37')](_0x472d3e['query']['offset']);}_0x543d85['order']=qs[_0x9656('0x38')](_0x472d3e['query'][_0x9656('0x38')]);_0x543d85[_0x9656('0x39')]=qs[_0x9656('0x3a')](_[_0x9656('0x3b')](_0x472d3e[_0x9656('0x2d')],_0x1c5024['filters']));if(_0x2df297[_0x9656('0x2e')]){if(_0x2df297[_0x9656('0x2f')]){_0x2df297['dateEnd']=moment(_0x2df297[_0x9656('0x2f')])['add'](0x1,'day');}else{_0x2df297[_0x9656('0x2f')]=moment(_0x2df297['dateStart'])['add'](0x1,_0x9656('0x3c'));}_['merge'](_0x543d85[_0x9656('0x39')],{'createdAt':{'$gte':_0x2df297[_0x9656('0x2e')],'$lte':_0x2df297[_0x9656('0x2f')]}});}if(_0x472d3e[_0x9656('0x2d')][_0x9656('0x3d')]){_0x543d85[_0x9656('0x39')]=_[_0x9656('0x3e')](_0x543d85[_0x9656('0x39')],{'$or':_[_0x9656('0x3f')](_0x543d85[_0x9656('0x31')],function(_0x2e1df0){var _0x3aea6b={};_0x3aea6b[_0x2e1df0]={'$like':'%'+_0x472d3e[_0x9656('0x2d')][_0x9656('0x3d')]+'%'};return _0x3aea6b;})});}_0x543d85=_[_0x9656('0x3e')]({},_0x543d85,_0x472d3e[_0x9656('0x40')]);var _0x7ef503={'where':_0x543d85[_0x9656('0x39')]};return db[_0x9656('0x41')][_0x9656('0x42')](_0x7ef503)[_0x9656('0x24')](function(_0x238e55){_0xb69608['count']=_0x238e55;if(_0x472d3e[_0x9656('0x2d')][_0x9656('0x43')]){_0x543d85[_0x9656('0x44')]=[{'all':!![]}];}return db[_0x9656('0x41')][_0x9656('0x45')](_0x543d85);})[_0x9656('0x24')](function(_0x1e6d68){_0xb69608[_0x9656('0x46')]=_0x1e6d68;return _0xb69608;})[_0x9656('0x24')](respondWithFilteredResult(_0x501ea4,_0x543d85))['catch'](handleError(_0x501ea4,null));};exports[_0x9656('0x47')]=function(_0x375aeb,_0x254427){var _0x24f72a={'raw':!![],'where':{'id':_0x375aeb[_0x9656('0x48')]['id']}},_0x528e03={};_0x528e03['model']=_[_0x9656('0x2c')](db[_0x9656('0x41')][_0x9656('0x2b')]);_0x528e03[_0x9656('0x2d')]=_[_0x9656('0x2c')](_0x375aeb[_0x9656('0x2d')]);_0x528e03[_0x9656('0x3a')]=_['intersection'](_0x528e03[_0x9656('0x34')],_0x528e03[_0x9656('0x2d')]);_0x24f72a['attributes']=_[_0x9656('0x30')](_0x528e03[_0x9656('0x34')],qs[_0x9656('0x32')](_0x375aeb['query']['fields']));_0x24f72a[_0x9656('0x31')]=_0x24f72a[_0x9656('0x31')][_0x9656('0x33')]?_0x24f72a['attributes']:_0x528e03[_0x9656('0x34')];if(_0x375aeb['query'][_0x9656('0x43')]){_0x24f72a['include']=[{'all':!![]}];}_0x24f72a=_[_0x9656('0x3e')]({},_0x24f72a,_0x375aeb[_0x9656('0x40')]);return db[_0x9656('0x41')][_0x9656('0x49')](_0x24f72a)[_0x9656('0x24')](handleEntityNotFound(_0x254427,null))[_0x9656('0x24')](respondWithResult(_0x254427,null))['catch'](handleError(_0x254427,null));};exports[_0x9656('0x4a')]=function(_0x3d97cc,_0x1cb1c8){return db[_0x9656('0x41')][_0x9656('0x4a')](_0x3d97cc[_0x9656('0x4b')],{})[_0x9656('0x24')](respondWithResult(_0x1cb1c8,0xc9))[_0x9656('0x4c')](handleError(_0x1cb1c8,null));};exports[_0x9656('0x23')]=function(_0x88ff77,_0x263c6a){if(_0x88ff77[_0x9656('0x4b')]['id']){delete _0x88ff77[_0x9656('0x4b')]['id'];}return db[_0x9656('0x41')][_0x9656('0x49')]({'where':{'id':_0x88ff77[_0x9656('0x48')]['id']}})[_0x9656('0x24')](handleEntityNotFound(_0x263c6a,null))[_0x9656('0x24')](saveUpdates(_0x88ff77['body'],null))[_0x9656('0x24')](respondWithResult(_0x263c6a,null))['catch'](handleError(_0x263c6a,null));};exports[_0x9656('0x25')]=function(_0x30daed,_0x2adcf6){return db[_0x9656('0x41')][_0x9656('0x49')]({'where':{'id':_0x30daed[_0x9656('0x48')]['id']}})[_0x9656('0x24')](handleEntityNotFound(_0x2adcf6,null))[_0x9656('0x24')](removeEntity(_0x2adcf6,null))['catch'](handleError(_0x2adcf6,null));};exports[_0x9656('0x4d')]=function(_0xd7393f,_0x39a5fa){return db['SmsQueue'][_0x9656('0x4d')]()['then'](respondWithResult(_0x39a5fa,null))['catch'](handleError(_0x39a5fa,null));};exports[_0x9656('0x4e')]=function(_0x1880bb,_0x3f906f,_0xea2dfa){var _0x2a0e75={'raw':!![],'where':{}},_0x589571={},_0x568c38;return db[_0x9656('0x41')]['findOne']({'where':{'id':_0x1880bb['params']['id']}})[_0x9656('0x24')](handleEntityNotFound(_0x3f906f,null))[_0x9656('0x24')](function(_0x5a65ef){if(_0x5a65ef){_0x568c38=_0x5a65ef[_0x9656('0x4f')]({'plain':!![]});_0x589571['model']=_[_0x9656('0x2c')](db['UserSmsQueue'][_0x9656('0x2b')]);_0x589571[_0x9656('0x2d')]=_['keys'](_0x1880bb[_0x9656('0x2d')]);_0x589571['filters']=_[_0x9656('0x30')](_0x589571[_0x9656('0x34')],_0x589571[_0x9656('0x2d')]);_0x2a0e75[_0x9656('0x31')]=_[_0x9656('0x30')](_0x589571[_0x9656('0x34')],qs[_0x9656('0x32')](_0x1880bb[_0x9656('0x2d')][_0x9656('0x32')]));_0x2a0e75['attributes']=_0x2a0e75[_0x9656('0x31')][_0x9656('0x33')]?_0x2a0e75[_0x9656('0x31')]:_0x589571[_0x9656('0x34')];if(!_0x1880bb[_0x9656('0x2d')][_0x9656('0x50')](_0x9656('0x35'))){_0x2a0e75[_0x9656('0x36')]=qs[_0x9656('0x36')](_0x1880bb[_0x9656('0x2d')][_0x9656('0x36')]);_0x2a0e75[_0x9656('0x37')]=qs[_0x9656('0x37')](_0x1880bb[_0x9656('0x2d')][_0x9656('0x37')]);}_0x2a0e75[_0x9656('0x51')]=qs[_0x9656('0x38')](_0x1880bb[_0x9656('0x2d')][_0x9656('0x38')]);_0x2a0e75[_0x9656('0x39')]=qs[_0x9656('0x3a')](_[_0x9656('0x3b')](_0x1880bb[_0x9656('0x2d')],_0x589571[_0x9656('0x3a')]));_0x2a0e75[_0x9656('0x39')][_0x9656('0x52')]=_0x5a65ef['id'];if(_0x1880bb['query'][_0x9656('0x3d')]){_0x2a0e75['where']=_['merge'](_0x2a0e75[_0x9656('0x39')],{'$or':_[_0x9656('0x3f')](_0x2a0e75[_0x9656('0x31')],function(_0x4040ba){var _0xe7cd22={};_0xe7cd22[_0x4040ba]={'$like':'%'+_0x1880bb[_0x9656('0x2d')][_0x9656('0x3d')]+'%'};return _0xe7cd22;})});}_0x2a0e75=_[_0x9656('0x3e')]({},_0x2a0e75,_0x1880bb[_0x9656('0x40')]);return db[_0x9656('0x53')][_0x9656('0x45')](_0x2a0e75);}})[_0x9656('0x24')](function(_0x46285a){if(_0x46285a){return db['User']['findAndCountAll']({'where':{'id':_[_0x9656('0x3f')](_0x46285a,_0x9656('0x54')),'role':_0x9656('0x55')},'attributes':['id',_0x9656('0x28'),_0x9656('0x56'),_0x9656('0x57'),_0x9656('0x58')]});}})[_0x9656('0x24')](function(_0x26a532){if(_0x26a532){return{'count':_0x26a532[_0x9656('0x42')],'rows':_[_0x9656('0x3f')](_0x26a532[_0x9656('0x46')],function(_0x3267bc){return{'membername':_0x3267bc[_0x9656('0x28')],'UserId':_0x3267bc['id'],'queue_name':_0x568c38[_0x9656('0x28')],'SmsQueueId':_0x568c38['id'],'interface':util[_0x9656('0x59')](_0x9656('0x5a'),_0x9656('0x5b'),_0x3267bc['name']),'penalty':0x0,'paused':_0x3267bc['smsPause'],'createdAt':_0x3267bc[_0x9656('0x58')],'updatedAt':_0x3267bc['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3f906f,_0x2a0e75))[_0x9656('0x4c')](handleError(_0x3f906f,null));};exports[_0x9656('0x5c')]=function(_0x1fa869,_0x4752be,_0x51754e){var _0xa5178e={};var _0x5d1cfa={};var _0x5ae0d9;var _0x39f024;return db[_0x9656('0x41')][_0x9656('0x5d')]({'where':{'id':_0x1fa869['params']['id']}})[_0x9656('0x24')](handleEntityNotFound(_0x4752be,null))[_0x9656('0x24')](function(_0x1f2ccf){if(_0x1f2ccf){_0x5ae0d9=_0x1f2ccf;_0x5d1cfa[_0x9656('0x34')]=_['keys'](db['Team'][_0x9656('0x2b')]);_0x5d1cfa[_0x9656('0x2d')]=_[_0x9656('0x2c')](_0x1fa869[_0x9656('0x2d')]);_0x5d1cfa['filters']=_[_0x9656('0x30')](_0x5d1cfa[_0x9656('0x34')],_0x5d1cfa['query']);_0xa5178e[_0x9656('0x31')]=_['intersection'](_0x5d1cfa[_0x9656('0x34')],qs[_0x9656('0x32')](_0x1fa869[_0x9656('0x2d')][_0x9656('0x32')]));_0xa5178e[_0x9656('0x31')]=_0xa5178e[_0x9656('0x31')]['length']?_0xa5178e[_0x9656('0x31')]:_0x5d1cfa[_0x9656('0x34')];_0xa5178e['order']=qs[_0x9656('0x38')](_0x1fa869[_0x9656('0x2d')]['sort']);_0xa5178e[_0x9656('0x39')]=qs[_0x9656('0x3a')](_[_0x9656('0x3b')](_0x1fa869[_0x9656('0x2d')],_0x5d1cfa['filters']));if(_0x1fa869['query'][_0x9656('0x3d')]){_0xa5178e[_0x9656('0x39')]=_['merge'](_0xa5178e[_0x9656('0x39')],{'$or':_[_0x9656('0x3f')](_0xa5178e[_0x9656('0x31')],function(_0x5af525){var _0x5c2821={};_0x5c2821[_0x5af525]={'$like':'%'+_0x1fa869[_0x9656('0x2d')]['filter']+'%'};return _0x5c2821;})});}_0xa5178e=_[_0x9656('0x3e')]({},_0xa5178e,_0x1fa869['options']);return _0x5ae0d9[_0x9656('0x5c')](_0xa5178e);}})[_0x9656('0x24')](function(_0x256873){if(_0x256873){_0x39f024=_0x256873[_0x9656('0x33')];if(!_0x1fa869['query'][_0x9656('0x50')](_0x9656('0x35'))){_0xa5178e[_0x9656('0x36')]=qs[_0x9656('0x36')](_0x1fa869[_0x9656('0x2d')][_0x9656('0x36')]);_0xa5178e[_0x9656('0x37')]=qs[_0x9656('0x37')](_0x1fa869[_0x9656('0x2d')][_0x9656('0x37')]);}return _0x5ae0d9[_0x9656('0x5c')](_0xa5178e);}})[_0x9656('0x24')](function(_0x1c7b99){if(_0x1c7b99){return _0x1c7b99?{'count':_0x39f024,'rows':_0x1c7b99}:null;}})[_0x9656('0x24')](respondWithResult(_0x4752be,null))[_0x9656('0x4c')](handleError(_0x4752be,null));};exports['addTeams']=function(_0x1b4ab1,_0xc2a127,_0x3f52b3){var _0x405733=[];var _0x34ec68;return db[_0x9656('0x5e')][_0x9656('0x45')]({'where':{'id':_0x1b4ab1[_0x9656('0x4b')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9656('0x5f'),'attributes':['id'],'raw':!![]}]})[_0x9656('0x24')](function(_0xc3002b){if(_0xc3002b){for(var _0x310239=0x0;_0x310239<_0xc3002b[_0x9656('0x33')];_0x310239+=0x1){for(var _0x582091=0x0;_0x582091<_0xc3002b[_0x310239][_0x9656('0x5f')][_0x9656('0x33')];_0x582091+=0x1){_0x405733=_[_0x9656('0x60')](_0x405733,[_0xc3002b[_0x310239][_0x9656('0x5f')][_0x582091]['id']]);}}return _0x405733;}})[_0x9656('0x24')](function(_0x5f1f24){if(_0x5f1f24){return db[_0x9656('0x41')]['find']({'where':{'id':_0x1b4ab1[_0x9656('0x48')]['id']}});}})[_0x9656('0x24')](function(_0x58ecec){if(_0x58ecec){_0x34ec68=_0x58ecec;return _0x34ec68['addAgents'](_0x405733,{'penalty':_0x1b4ab1['body'][_0x9656('0x61')]});}})[_0x9656('0x24')](function(_0x420481){if(_0x420481){return _0x34ec68['addTeams'](_0x1b4ab1[_0x9656('0x4b')][_0x9656('0x62')]);}})[_0x9656('0x24')](handleEntityNotFound(_0xc2a127,null))[_0x9656('0x24')](respondWithStatusCode(_0xc2a127,null))[_0x9656('0x4c')](handleError(_0xc2a127,null));};exports['removeTeams']=function(_0x3249df,_0x52058f,_0x42c7b2){var _0xd7e6b3=[];var _0x21ff69;return db[_0x9656('0x5e')]['findAll']({'where':{'id':_0x3249df[_0x9656('0x2d')][_0x9656('0x62')]},'attributes':['id'],'include':[{'model':db[_0x9656('0x63')],'as':_0x9656('0x5f'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x1132a1){if(_0x1132a1){for(var _0x5a5dbc=0x0;_0x5a5dbc<_0x1132a1[_0x9656('0x33')];_0x5a5dbc+=0x1){for(var _0x571c31=0x0;_0x571c31<_0x1132a1[_0x5a5dbc][_0x9656('0x5f')]['length'];_0x571c31+=0x1){_0xd7e6b3=_[_0x9656('0x60')](_0xd7e6b3,[_0x1132a1[_0x5a5dbc]['Agents'][_0x571c31]['id']]);}}return _0xd7e6b3;}})[_0x9656('0x24')](function(_0x1dbb78){if(_0x1dbb78){return db[_0x9656('0x41')][_0x9656('0x49')]({'where':{'id':_0x3249df[_0x9656('0x48')]['id']}});}})[_0x9656('0x24')](function(_0x13a00d){if(_0x13a00d){_0x21ff69=_0x13a00d;return _0x21ff69['removeAgents'](_0xd7e6b3);}})['then'](function(_0x2b1227){if(_0x21ff69){return _0x21ff69['removeTeams'](_0x3249df[_0x9656('0x2d')][_0x9656('0x62')]);}})[_0x9656('0x24')](handleEntityNotFound(_0x52058f,null))['then'](respondWithStatusCode(_0x52058f,null))['catch'](handleError(_0x52058f,null));};exports['addAgents']=function(_0x25103b,_0xc04903,_0x1d4384){return db[_0x9656('0x41')]['find']({'where':{'id':_0x25103b[_0x9656('0x48')]['id']}})[_0x9656('0x24')](handleEntityNotFound(_0xc04903,null))[_0x9656('0x24')](function(_0x5a9f9e){if(_0x5a9f9e){return _0x5a9f9e[_0x9656('0x64')](_0x25103b['body'][_0x9656('0x62')],_[_0x9656('0x65')](_0x25103b[_0x9656('0x4b')],[_0x9656('0x62'),'id'])||{})[_0x9656('0x66')](function(_0x31c4be){for(var _0x541df0=0x0;_0x541df0<_0x25103b['body'][_0x9656('0x62')][_0x9656('0x33')];_0x541df0+=0x1){socket[_0x9656('0x67')](_0x9656('0x68'),{'UserId':_0x25103b[_0x9656('0x4b')][_0x9656('0x62')][_0x541df0],'SmsQueueId':_0x25103b['params']['id']});}return _0x31c4be;});}})['then'](respondWithResult(_0xc04903,null))[_0x9656('0x4c')](handleError(_0xc04903,null));};exports['removeAgents']=function(_0x29eca1,_0x4df721,_0x3c2877){var _0x20b577;return db[_0x9656('0x41')]['find']({'where':{'id':_0x29eca1[_0x9656('0x48')]['id']}})[_0x9656('0x24')](handleEntityNotFound(_0x4df721,null))[_0x9656('0x24')](function(_0xc10527){if(_0xc10527){return _0xc10527[_0x9656('0x69')](_0x29eca1[_0x9656('0x2d')][_0x9656('0x62')])[_0x9656('0x24')](function(_0x3ec679){if(_['isArray'](_0x29eca1['query'][_0x9656('0x62')])){for(var _0x26820e=0x0;_0x26820e<_0x29eca1['query'][_0x9656('0x62')][_0x9656('0x33')];_0x26820e+=0x1){socket[_0x9656('0x67')](_0x9656('0x6a'),{'UserId':_0x29eca1['query']['ids'][_0x26820e],'SmsQueueId':_0x29eca1[_0x9656('0x48')]['id']});}}else{socket['emit'](_0x9656('0x6a'),{'UserId':_0x29eca1[_0x9656('0x2d')][_0x9656('0x62')],'SmsQueueId':_0x29eca1[_0x9656('0x48')]['id']});}});}})[_0x9656('0x24')](respondWithStatusCode(_0x4df721,null))[_0x9656('0x4c')](handleError(_0x4df721,null));};exports['getAgents']=function(_0x3c856d,_0x196b88,_0x17d0fe){var _0x762fa={};var _0x4e24a4={};var _0xfee25e;var _0x6a1f82;return db[_0x9656('0x41')][_0x9656('0x5d')]({'where':{'id':_0x3c856d[_0x9656('0x48')]['id']}})[_0x9656('0x24')](handleEntityNotFound(_0x196b88,null))[_0x9656('0x24')](function(_0x4bf3dc){if(_0x4bf3dc){_0xfee25e=_0x4bf3dc;_0x4e24a4[_0x9656('0x34')]=_[_0x9656('0x2c')](db[_0x9656('0x63')]['rawAttributes']);_0x4e24a4['query']=_['keys'](_0x3c856d[_0x9656('0x2d')]);_0x4e24a4[_0x9656('0x3a')]=_[_0x9656('0x30')](_0x4e24a4[_0x9656('0x34')],_0x4e24a4[_0x9656('0x2d')]);_0x762fa['attributes']=_[_0x9656('0x30')](_0x4e24a4[_0x9656('0x34')],qs[_0x9656('0x32')](_0x3c856d[_0x9656('0x2d')]['fields']));_0x762fa[_0x9656('0x31')]=_0x762fa['attributes']['length']?_0x762fa[_0x9656('0x31')]:_0x4e24a4['model'];_0x762fa[_0x9656('0x51')]=qs[_0x9656('0x38')](_0x3c856d[_0x9656('0x2d')]['sort']);_0x762fa['where']=qs[_0x9656('0x3a')](_[_0x9656('0x3b')](_0x3c856d[_0x9656('0x2d')],_0x4e24a4[_0x9656('0x3a')]));if(_0x3c856d[_0x9656('0x2d')][_0x9656('0x3d')]){_0x762fa[_0x9656('0x39')]=_['merge'](_0x762fa[_0x9656('0x39')],{'$or':_[_0x9656('0x3f')](_0x762fa[_0x9656('0x31')],function(_0x1b3d99){var _0x342db7={};_0x342db7[_0x1b3d99]={'$like':'%'+_0x3c856d[_0x9656('0x2d')][_0x9656('0x3d')]+'%'};return _0x342db7;})});}_0x762fa=_[_0x9656('0x3e')]({},_0x762fa,_0x3c856d['options']);return _0xfee25e[_0x9656('0x6b')](_0x762fa);}})['then'](function(_0x4ce8b0){if(_0x4ce8b0){_0x6a1f82=_0x4ce8b0[_0x9656('0x33')];if(!_0x3c856d[_0x9656('0x2d')][_0x9656('0x50')](_0x9656('0x35'))){_0x762fa[_0x9656('0x36')]=qs['limit'](_0x3c856d['query'][_0x9656('0x36')]);_0x762fa['offset']=qs['offset'](_0x3c856d[_0x9656('0x2d')][_0x9656('0x37')]);}return _0xfee25e[_0x9656('0x6b')](_0x762fa);}})['then'](function(_0x2d334c){if(_0x2d334c){return _0x2d334c?{'count':_0x6a1f82,'rows':_0x2d334c}:null;}})[_0x9656('0x24')](respondWithResult(_0x196b88,null))['catch'](handleError(_0x196b88,null));}; \ No newline at end of file +var _0x8ef8=['describe','getMembers','get','UserSmsQueue','nolimit','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','getTeams','findOne','Team','ids','Agents','union','addTeams','removeAgents','removeTeams','addAgents','omit','emit','userSmsQueue:save','isArray','userSmsQueue:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','json','count','offset','limit','set','apply','reject','save','then','destroy','end','error','stack','name','send','rawAttributes','model','keys','query','dateStart','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filters','day','dateEnd','add','merge','where','filter','map','options','SmsQueue','includeAll','findAll','rows','catch','show','params','include','find','create','body','update'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8ef8,0xf9));var _0x88ef=function(_0x4d23bf,_0x5e48a6){_0x4d23bf=_0x4d23bf-0x0;var _0x332eb3=_0x8ef8[_0x4d23bf];return _0x332eb3;};'use strict';var pdf=require(_0x88ef('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x88ef('0x1'));var zipdir=require(_0x88ef('0x2'));var jsonpatch=require(_0x88ef('0x3'));var rp=require(_0x88ef('0x4'));var moment=require('moment');var BPromise=require(_0x88ef('0x5'));var Mustache=require('mustache');var util=require(_0x88ef('0x6'));var path=require(_0x88ef('0x7'));var sox=require(_0x88ef('0x8'));var csv=require(_0x88ef('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x88ef('0xa'));var squel=require(_0x88ef('0xb'));var crypto=require(_0x88ef('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x88ef('0xd'));var toCsv=require(_0x88ef('0x9'));var querystring=require('querystring');var Papa=require(_0x88ef('0xe'));var Redis=require(_0x88ef('0xf'));var qs=require(_0x88ef('0x10'));var logger=require(_0x88ef('0x11'))('api');var utils=require(_0x88ef('0x12'));var config=require(_0x88ef('0x13'));var db=require(_0x88ef('0x14'))['db'];config[_0x88ef('0x15')]=_[_0x88ef('0x16')](config[_0x88ef('0x15')],{'host':_0x88ef('0x17'),'port':0x18eb});var socket=require(_0x88ef('0x18'))(new Redis(config[_0x88ef('0x15')]));require(_0x88ef('0x19'))[_0x88ef('0x1a')](socket);function respondWithStatusCode(_0x2c174f,_0x8249d8){_0x8249d8=_0x8249d8||0xcc;return function(_0x4c65d3){if(_0x4c65d3){return _0x2c174f[_0x88ef('0x1b')](_0x8249d8);}return _0x2c174f[_0x88ef('0x1c')](_0x8249d8)['end']();};}function respondWithResult(_0x3887db,_0x575719){_0x575719=_0x575719||0xc8;return function(_0x6b26f3){if(_0x6b26f3){return _0x3887db[_0x88ef('0x1c')](_0x575719)[_0x88ef('0x1d')](_0x6b26f3);}};}function respondWithFilteredResult(_0x614981,_0x440c00){return function(_0x22a868){if(_0x22a868){var _0x374da7=_0x22a868[_0x88ef('0x1e')],_0x3ab1bc=_0x440c00[_0x88ef('0x1f')],_0x229a83=_0x440c00[_0x88ef('0x1f')]+_0x440c00[_0x88ef('0x20')],_0x1e83a0;if(_0x229a83>=_0x374da7){_0x229a83=_0x374da7;_0x1e83a0=0xc8;}else{_0x1e83a0=0xce;}_0x614981[_0x88ef('0x1c')](_0x1e83a0);return _0x614981[_0x88ef('0x21')]('Content-Range',_0x3ab1bc+'-'+_0x229a83+'/'+_0x374da7)[_0x88ef('0x1d')](_0x22a868);}return null;};}function patchUpdates(_0x45fa7e){return function(_0x1c9772){try{jsonpatch[_0x88ef('0x22')](_0x1c9772,_0x45fa7e,!![]);}catch(_0x34d85e){return BPromise[_0x88ef('0x23')](_0x34d85e);}return _0x1c9772[_0x88ef('0x24')]();};}function saveUpdates(_0x78cc11,_0x48d2e9){return function(_0x2eada2){if(_0x2eada2){return _0x2eada2['update'](_0x78cc11)[_0x88ef('0x25')](function(_0x375413){return _0x375413;});}return null;};}function removeEntity(_0x516d55,_0x51cf67){return function(_0x41a227){if(_0x41a227){return _0x41a227[_0x88ef('0x26')]()[_0x88ef('0x25')](function(){_0x516d55[_0x88ef('0x1c')](0xcc)[_0x88ef('0x27')]();});}};}function handleEntityNotFound(_0x370ad2,_0x4528aa){return function(_0x4739b5){if(!_0x4739b5){_0x370ad2[_0x88ef('0x1b')](0x194);}return _0x4739b5;};}function handleError(_0x15e22a,_0x51d2c9){_0x51d2c9=_0x51d2c9||0x1f4;return function(_0x223651){logger[_0x88ef('0x28')](_0x223651[_0x88ef('0x29')]);if(_0x223651[_0x88ef('0x2a')]){delete _0x223651[_0x88ef('0x2a')];}_0x15e22a['status'](_0x51d2c9)[_0x88ef('0x2b')](_0x223651);};}exports['index']=function(_0x5e0c57,_0x528b5d){var _0x531bdb={},_0x414b78={},_0xbffc04={'count':0x0,'rows':[]};var _0x1fca94=db['SmsQueue'][_0x88ef('0x2c')];_0x414b78[_0x88ef('0x2d')]=_[_0x88ef('0x2e')](_0x1fca94);var _0x5a63f9={'dateStart':_0x5e0c57[_0x88ef('0x2f')]['dateStart'],'dateEnd':_0x5e0c57[_0x88ef('0x2f')]['dateEnd']};delete _0x5e0c57[_0x88ef('0x2f')][_0x88ef('0x30')];delete _0x5e0c57['query']['dateEnd'];_0x414b78[_0x88ef('0x2f')]=_[_0x88ef('0x2e')](_0x5e0c57['query']);_0x414b78['filters']=_[_0x88ef('0x31')](_0x414b78[_0x88ef('0x2d')],_0x414b78['query']);_0x531bdb[_0x88ef('0x32')]=_[_0x88ef('0x31')](_0x414b78[_0x88ef('0x2d')],qs[_0x88ef('0x33')](_0x5e0c57['query'][_0x88ef('0x33')]));_0x531bdb[_0x88ef('0x32')]=_0x531bdb[_0x88ef('0x32')][_0x88ef('0x34')]?_0x531bdb[_0x88ef('0x32')]:_0x414b78[_0x88ef('0x2d')];if(!_0x5e0c57[_0x88ef('0x2f')][_0x88ef('0x35')]('nolimit')){_0x531bdb[_0x88ef('0x20')]=qs[_0x88ef('0x20')](_0x5e0c57['query'][_0x88ef('0x20')]);_0x531bdb['offset']=qs['offset'](_0x5e0c57[_0x88ef('0x2f')][_0x88ef('0x1f')]);}_0x531bdb[_0x88ef('0x36')]=qs[_0x88ef('0x37')](_0x5e0c57[_0x88ef('0x2f')][_0x88ef('0x37')]);_0x531bdb['where']=qs['filters'](_[_0x88ef('0x38')](_0x5e0c57[_0x88ef('0x2f')],_0x414b78[_0x88ef('0x39')]));if(_0x5a63f9[_0x88ef('0x30')]){if(_0x5a63f9['dateEnd']){_0x5a63f9['dateEnd']=moment(_0x5a63f9['dateEnd'])['add'](0x1,_0x88ef('0x3a'));}else{_0x5a63f9[_0x88ef('0x3b')]=moment(_0x5a63f9[_0x88ef('0x30')])[_0x88ef('0x3c')](0x1,_0x88ef('0x3a'));}_[_0x88ef('0x3d')](_0x531bdb[_0x88ef('0x3e')],{'createdAt':{'$gte':_0x5a63f9[_0x88ef('0x30')],'$lte':_0x5a63f9[_0x88ef('0x3b')]}});}if(_0x5e0c57['query'][_0x88ef('0x3f')]){_0x531bdb[_0x88ef('0x3e')]=_['merge'](_0x531bdb[_0x88ef('0x3e')],{'$or':_[_0x88ef('0x40')](_0x531bdb[_0x88ef('0x32')],function(_0x233513){var _0x577c19={};_0x577c19[_0x233513]={'$like':'%'+_0x5e0c57[_0x88ef('0x2f')][_0x88ef('0x3f')]+'%'};return _0x577c19;})});}_0x531bdb=_['merge']({},_0x531bdb,_0x5e0c57[_0x88ef('0x41')]);var _0x556b9f={'where':_0x531bdb[_0x88ef('0x3e')]};return db[_0x88ef('0x42')]['count'](_0x556b9f)['then'](function(_0x5c7ca2){_0xbffc04[_0x88ef('0x1e')]=_0x5c7ca2;if(_0x5e0c57[_0x88ef('0x2f')][_0x88ef('0x43')]){_0x531bdb['include']=[{'all':!![]}];}return db['SmsQueue'][_0x88ef('0x44')](_0x531bdb);})['then'](function(_0x3e8404){_0xbffc04[_0x88ef('0x45')]=_0x3e8404;return _0xbffc04;})['then'](respondWithFilteredResult(_0x528b5d,_0x531bdb))[_0x88ef('0x46')](handleError(_0x528b5d,null));};exports[_0x88ef('0x47')]=function(_0x6eb5fb,_0x88f98d){var _0x3a156a={'raw':!![],'where':{'id':_0x6eb5fb[_0x88ef('0x48')]['id']}},_0x43fa97={};_0x43fa97[_0x88ef('0x2d')]=_['keys'](db[_0x88ef('0x42')][_0x88ef('0x2c')]);_0x43fa97[_0x88ef('0x2f')]=_[_0x88ef('0x2e')](_0x6eb5fb[_0x88ef('0x2f')]);_0x43fa97['filters']=_[_0x88ef('0x31')](_0x43fa97[_0x88ef('0x2d')],_0x43fa97[_0x88ef('0x2f')]);_0x3a156a[_0x88ef('0x32')]=_['intersection'](_0x43fa97[_0x88ef('0x2d')],qs[_0x88ef('0x33')](_0x6eb5fb[_0x88ef('0x2f')][_0x88ef('0x33')]));_0x3a156a[_0x88ef('0x32')]=_0x3a156a[_0x88ef('0x32')]['length']?_0x3a156a[_0x88ef('0x32')]:_0x43fa97[_0x88ef('0x2d')];if(_0x6eb5fb[_0x88ef('0x2f')][_0x88ef('0x43')]){_0x3a156a[_0x88ef('0x49')]=[{'all':!![]}];}_0x3a156a=_[_0x88ef('0x3d')]({},_0x3a156a,_0x6eb5fb[_0x88ef('0x41')]);return db['SmsQueue'][_0x88ef('0x4a')](_0x3a156a)[_0x88ef('0x25')](handleEntityNotFound(_0x88f98d,null))[_0x88ef('0x25')](respondWithResult(_0x88f98d,null))[_0x88ef('0x46')](handleError(_0x88f98d,null));};exports[_0x88ef('0x4b')]=function(_0x3a2dd8,_0x439a99){return db[_0x88ef('0x42')][_0x88ef('0x4b')](_0x3a2dd8[_0x88ef('0x4c')],{})[_0x88ef('0x25')](respondWithResult(_0x439a99,0xc9))['catch'](handleError(_0x439a99,null));};exports[_0x88ef('0x4d')]=function(_0x71ac2c,_0x2e0a46){if(_0x71ac2c[_0x88ef('0x4c')]['id']){delete _0x71ac2c[_0x88ef('0x4c')]['id'];}return db[_0x88ef('0x42')]['find']({'where':{'id':_0x71ac2c[_0x88ef('0x48')]['id']}})[_0x88ef('0x25')](handleEntityNotFound(_0x2e0a46,null))[_0x88ef('0x25')](saveUpdates(_0x71ac2c['body'],null))[_0x88ef('0x25')](respondWithResult(_0x2e0a46,null))[_0x88ef('0x46')](handleError(_0x2e0a46,null));};exports[_0x88ef('0x26')]=function(_0x227005,_0x5e9634){return db[_0x88ef('0x42')][_0x88ef('0x4a')]({'where':{'id':_0x227005['params']['id']}})[_0x88ef('0x25')](handleEntityNotFound(_0x5e9634,null))[_0x88ef('0x25')](removeEntity(_0x5e9634,null))[_0x88ef('0x46')](handleError(_0x5e9634,null));};exports[_0x88ef('0x4e')]=function(_0xd5d6e,_0x4f490a){return db[_0x88ef('0x42')][_0x88ef('0x4e')]()['then'](respondWithResult(_0x4f490a,null))[_0x88ef('0x46')](handleError(_0x4f490a,null));};exports[_0x88ef('0x4f')]=function(_0x5b213a,_0x2c60d3,_0x37bab5){var _0x3f5b6e={'raw':!![],'where':{}},_0x27e18e={},_0xbe5688;return db[_0x88ef('0x42')]['findOne']({'where':{'id':_0x5b213a[_0x88ef('0x48')]['id']}})[_0x88ef('0x25')](handleEntityNotFound(_0x2c60d3,null))[_0x88ef('0x25')](function(_0x1a77a0){if(_0x1a77a0){_0xbe5688=_0x1a77a0[_0x88ef('0x50')]({'plain':!![]});_0x27e18e['model']=_['keys'](db[_0x88ef('0x51')][_0x88ef('0x2c')]);_0x27e18e[_0x88ef('0x2f')]=_[_0x88ef('0x2e')](_0x5b213a[_0x88ef('0x2f')]);_0x27e18e[_0x88ef('0x39')]=_[_0x88ef('0x31')](_0x27e18e[_0x88ef('0x2d')],_0x27e18e['query']);_0x3f5b6e[_0x88ef('0x32')]=_[_0x88ef('0x31')](_0x27e18e[_0x88ef('0x2d')],qs['fields'](_0x5b213a[_0x88ef('0x2f')][_0x88ef('0x33')]));_0x3f5b6e[_0x88ef('0x32')]=_0x3f5b6e['attributes'][_0x88ef('0x34')]?_0x3f5b6e[_0x88ef('0x32')]:_0x27e18e[_0x88ef('0x2d')];if(!_0x5b213a[_0x88ef('0x2f')][_0x88ef('0x35')](_0x88ef('0x52'))){_0x3f5b6e[_0x88ef('0x20')]=qs[_0x88ef('0x20')](_0x5b213a[_0x88ef('0x2f')]['limit']);_0x3f5b6e[_0x88ef('0x1f')]=qs[_0x88ef('0x1f')](_0x5b213a[_0x88ef('0x2f')][_0x88ef('0x1f')]);}_0x3f5b6e['order']=qs[_0x88ef('0x37')](_0x5b213a[_0x88ef('0x2f')]['sort']);_0x3f5b6e[_0x88ef('0x3e')]=qs[_0x88ef('0x39')](_[_0x88ef('0x38')](_0x5b213a['query'],_0x27e18e['filters']));_0x3f5b6e[_0x88ef('0x3e')][_0x88ef('0x53')]=_0x1a77a0['id'];if(_0x5b213a[_0x88ef('0x2f')][_0x88ef('0x3f')]){_0x3f5b6e[_0x88ef('0x3e')]=_[_0x88ef('0x3d')](_0x3f5b6e['where'],{'$or':_['map'](_0x3f5b6e['attributes'],function(_0x267653){var _0x265739={};_0x265739[_0x267653]={'$like':'%'+_0x5b213a['query'][_0x88ef('0x3f')]+'%'};return _0x265739;})});}_0x3f5b6e=_[_0x88ef('0x3d')]({},_0x3f5b6e,_0x5b213a['options']);return db['UserSmsQueue'][_0x88ef('0x44')](_0x3f5b6e);}})[_0x88ef('0x25')](function(_0x8b59a8){if(_0x8b59a8){return db[_0x88ef('0x54')][_0x88ef('0x55')]({'where':{'id':_[_0x88ef('0x40')](_0x8b59a8,_0x88ef('0x56')),'role':_0x88ef('0x57')},'attributes':['id',_0x88ef('0x2a'),_0x88ef('0x58'),_0x88ef('0x59'),_0x88ef('0x5a')]});}})[_0x88ef('0x25')](function(_0x1e8fe9){if(_0x1e8fe9){return{'count':_0x1e8fe9['count'],'rows':_[_0x88ef('0x40')](_0x1e8fe9[_0x88ef('0x45')],function(_0x48e340){return{'membername':_0x48e340[_0x88ef('0x2a')],'UserId':_0x48e340['id'],'queue_name':_0xbe5688['name'],'SmsQueueId':_0xbe5688['id'],'interface':util[_0x88ef('0x5b')](_0x88ef('0x5c'),'SIP',_0x48e340[_0x88ef('0x2a')]),'penalty':0x0,'paused':_0x48e340[_0x88ef('0x58')],'createdAt':_0x48e340[_0x88ef('0x5a')],'updatedAt':_0x48e340[_0x88ef('0x59')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x88ef('0x25')](respondWithFilteredResult(_0x2c60d3,_0x3f5b6e))['catch'](handleError(_0x2c60d3,null));};exports[_0x88ef('0x5d')]=function(_0xf11c7f,_0x4c9e58,_0x40c2ec){var _0x5c8221={};var _0x47e91d={};var _0x14f38d;var _0x17b52a;return db[_0x88ef('0x42')][_0x88ef('0x5e')]({'where':{'id':_0xf11c7f[_0x88ef('0x48')]['id']}})[_0x88ef('0x25')](handleEntityNotFound(_0x4c9e58,null))[_0x88ef('0x25')](function(_0x44336a){if(_0x44336a){_0x14f38d=_0x44336a;_0x47e91d[_0x88ef('0x2d')]=_[_0x88ef('0x2e')](db[_0x88ef('0x5f')][_0x88ef('0x2c')]);_0x47e91d[_0x88ef('0x2f')]=_[_0x88ef('0x2e')](_0xf11c7f[_0x88ef('0x2f')]);_0x47e91d[_0x88ef('0x39')]=_[_0x88ef('0x31')](_0x47e91d[_0x88ef('0x2d')],_0x47e91d['query']);_0x5c8221[_0x88ef('0x32')]=_['intersection'](_0x47e91d[_0x88ef('0x2d')],qs[_0x88ef('0x33')](_0xf11c7f[_0x88ef('0x2f')][_0x88ef('0x33')]));_0x5c8221[_0x88ef('0x32')]=_0x5c8221[_0x88ef('0x32')][_0x88ef('0x34')]?_0x5c8221[_0x88ef('0x32')]:_0x47e91d[_0x88ef('0x2d')];_0x5c8221[_0x88ef('0x36')]=qs[_0x88ef('0x37')](_0xf11c7f['query']['sort']);_0x5c8221[_0x88ef('0x3e')]=qs['filters'](_['pick'](_0xf11c7f[_0x88ef('0x2f')],_0x47e91d['filters']));if(_0xf11c7f[_0x88ef('0x2f')]['filter']){_0x5c8221[_0x88ef('0x3e')]=_[_0x88ef('0x3d')](_0x5c8221[_0x88ef('0x3e')],{'$or':_['map'](_0x5c8221[_0x88ef('0x32')],function(_0x9998ca){var _0xc42b6d={};_0xc42b6d[_0x9998ca]={'$like':'%'+_0xf11c7f[_0x88ef('0x2f')]['filter']+'%'};return _0xc42b6d;})});}_0x5c8221=_[_0x88ef('0x3d')]({},_0x5c8221,_0xf11c7f[_0x88ef('0x41')]);return _0x14f38d[_0x88ef('0x5d')](_0x5c8221);}})[_0x88ef('0x25')](function(_0x2251af){if(_0x2251af){_0x17b52a=_0x2251af[_0x88ef('0x34')];if(!_0xf11c7f[_0x88ef('0x2f')]['hasOwnProperty'](_0x88ef('0x52'))){_0x5c8221[_0x88ef('0x20')]=qs[_0x88ef('0x20')](_0xf11c7f['query'][_0x88ef('0x20')]);_0x5c8221['offset']=qs[_0x88ef('0x1f')](_0xf11c7f[_0x88ef('0x2f')][_0x88ef('0x1f')]);}return _0x14f38d['getTeams'](_0x5c8221);}})[_0x88ef('0x25')](function(_0x33c40b){if(_0x33c40b){return _0x33c40b?{'count':_0x17b52a,'rows':_0x33c40b}:null;}})[_0x88ef('0x25')](respondWithResult(_0x4c9e58,null))[_0x88ef('0x46')](handleError(_0x4c9e58,null));};exports['addTeams']=function(_0x2247b6,_0x57b237,_0x1a3e47){var _0x3410e5=[];var _0x3ff253;return db['Team']['findAll']({'where':{'id':_0x2247b6[_0x88ef('0x4c')][_0x88ef('0x60')]},'attributes':['id'],'include':[{'model':db[_0x88ef('0x54')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x88ef('0x25')](function(_0x3e83dc){if(_0x3e83dc){for(var _0x27b94d=0x0;_0x27b94d<_0x3e83dc['length'];_0x27b94d+=0x1){for(var _0xcfea02=0x0;_0xcfea02<_0x3e83dc[_0x27b94d][_0x88ef('0x61')][_0x88ef('0x34')];_0xcfea02+=0x1){_0x3410e5=_[_0x88ef('0x62')](_0x3410e5,[_0x3e83dc[_0x27b94d][_0x88ef('0x61')][_0xcfea02]['id']]);}}return _0x3410e5;}})['then'](function(_0x4fffd3){if(_0x4fffd3){return db[_0x88ef('0x42')]['find']({'where':{'id':_0x2247b6[_0x88ef('0x48')]['id']}});}})[_0x88ef('0x25')](function(_0x2d3abe){if(_0x2d3abe){_0x3ff253=_0x2d3abe;return _0x3ff253['addAgents'](_0x3410e5,{'penalty':_0x2247b6[_0x88ef('0x4c')]['penalty']});}})[_0x88ef('0x25')](function(_0x3ca083){if(_0x3ca083){return _0x3ff253[_0x88ef('0x63')](_0x2247b6['body'][_0x88ef('0x60')]);}})[_0x88ef('0x25')](handleEntityNotFound(_0x57b237,null))[_0x88ef('0x25')](respondWithStatusCode(_0x57b237,null))[_0x88ef('0x46')](handleError(_0x57b237,null));};exports['removeTeams']=function(_0x440934,_0x1c144d,_0x5c9c27){var _0x4ad741=[];var _0xf3e77d;return db[_0x88ef('0x5f')][_0x88ef('0x44')]({'where':{'id':_0x440934[_0x88ef('0x2f')][_0x88ef('0x60')]},'attributes':['id'],'include':[{'model':db[_0x88ef('0x54')],'as':_0x88ef('0x61'),'attributes':['id'],'raw':!![]}]})[_0x88ef('0x25')](function(_0x5b3b53){if(_0x5b3b53){for(var _0x43ed58=0x0;_0x43ed58<_0x5b3b53[_0x88ef('0x34')];_0x43ed58+=0x1){for(var _0x4c77c1=0x0;_0x4c77c1<_0x5b3b53[_0x43ed58][_0x88ef('0x61')][_0x88ef('0x34')];_0x4c77c1+=0x1){_0x4ad741=_[_0x88ef('0x62')](_0x4ad741,[_0x5b3b53[_0x43ed58][_0x88ef('0x61')][_0x4c77c1]['id']]);}}return _0x4ad741;}})[_0x88ef('0x25')](function(_0x57f3e9){if(_0x57f3e9){return db[_0x88ef('0x42')][_0x88ef('0x4a')]({'where':{'id':_0x440934['params']['id']}});}})['then'](function(_0x37cea1){if(_0x37cea1){_0xf3e77d=_0x37cea1;return _0xf3e77d[_0x88ef('0x64')](_0x4ad741);}})['then'](function(_0x320d78){if(_0xf3e77d){return _0xf3e77d[_0x88ef('0x65')](_0x440934[_0x88ef('0x2f')][_0x88ef('0x60')]);}})['then'](handleEntityNotFound(_0x1c144d,null))[_0x88ef('0x25')](respondWithStatusCode(_0x1c144d,null))['catch'](handleError(_0x1c144d,null));};exports[_0x88ef('0x66')]=function(_0x461706,_0x2bd212,_0x31154d){return db[_0x88ef('0x42')]['find']({'where':{'id':_0x461706[_0x88ef('0x48')]['id']}})[_0x88ef('0x25')](handleEntityNotFound(_0x2bd212,null))[_0x88ef('0x25')](function(_0x1f040a){if(_0x1f040a){return _0x1f040a[_0x88ef('0x66')](_0x461706[_0x88ef('0x4c')][_0x88ef('0x60')],_[_0x88ef('0x67')](_0x461706[_0x88ef('0x4c')],['ids','id'])||{})['spread'](function(_0x4b5062){for(var _0x846a2c=0x0;_0x846a2c<_0x461706['body']['ids'][_0x88ef('0x34')];_0x846a2c+=0x1){socket[_0x88ef('0x68')](_0x88ef('0x69'),{'UserId':_0x461706[_0x88ef('0x4c')][_0x88ef('0x60')][_0x846a2c],'SmsQueueId':_0x461706['params']['id']});}return _0x4b5062;});}})[_0x88ef('0x25')](respondWithResult(_0x2bd212,null))['catch'](handleError(_0x2bd212,null));};exports[_0x88ef('0x64')]=function(_0x4349fa,_0x55542b,_0x233235){var _0x4302e3;return db[_0x88ef('0x42')][_0x88ef('0x4a')]({'where':{'id':_0x4349fa['params']['id']}})[_0x88ef('0x25')](handleEntityNotFound(_0x55542b,null))['then'](function(_0x2dd31f){if(_0x2dd31f){return _0x2dd31f[_0x88ef('0x64')](_0x4349fa[_0x88ef('0x2f')][_0x88ef('0x60')])[_0x88ef('0x25')](function(_0x21f3c0){if(_[_0x88ef('0x6a')](_0x4349fa[_0x88ef('0x2f')][_0x88ef('0x60')])){for(var _0x1da089=0x0;_0x1da089<_0x4349fa[_0x88ef('0x2f')]['ids'][_0x88ef('0x34')];_0x1da089+=0x1){socket[_0x88ef('0x68')]('userSmsQueue:remove',{'UserId':_0x4349fa[_0x88ef('0x2f')][_0x88ef('0x60')][_0x1da089],'SmsQueueId':_0x4349fa['params']['id']});}}else{socket['emit'](_0x88ef('0x6b'),{'UserId':_0x4349fa[_0x88ef('0x2f')][_0x88ef('0x60')],'SmsQueueId':_0x4349fa[_0x88ef('0x48')]['id']});}});}})[_0x88ef('0x25')](respondWithStatusCode(_0x55542b,null))[_0x88ef('0x46')](handleError(_0x55542b,null));};exports[_0x88ef('0x6c')]=function(_0x4ca4f6,_0x506fef,_0x54e557){var _0x567df2={};var _0x54c6da={};var _0x5c345c;var _0x9aa68f;return db['SmsQueue'][_0x88ef('0x5e')]({'where':{'id':_0x4ca4f6['params']['id']}})[_0x88ef('0x25')](handleEntityNotFound(_0x506fef,null))['then'](function(_0x5c91b2){if(_0x5c91b2){_0x5c345c=_0x5c91b2;_0x54c6da[_0x88ef('0x2d')]=_['keys'](db[_0x88ef('0x54')]['rawAttributes']);_0x54c6da[_0x88ef('0x2f')]=_[_0x88ef('0x2e')](_0x4ca4f6['query']);_0x54c6da[_0x88ef('0x39')]=_[_0x88ef('0x31')](_0x54c6da[_0x88ef('0x2d')],_0x54c6da[_0x88ef('0x2f')]);_0x567df2[_0x88ef('0x32')]=_[_0x88ef('0x31')](_0x54c6da[_0x88ef('0x2d')],qs['fields'](_0x4ca4f6['query'][_0x88ef('0x33')]));_0x567df2[_0x88ef('0x32')]=_0x567df2[_0x88ef('0x32')][_0x88ef('0x34')]?_0x567df2['attributes']:_0x54c6da['model'];_0x567df2[_0x88ef('0x36')]=qs[_0x88ef('0x37')](_0x4ca4f6[_0x88ef('0x2f')][_0x88ef('0x37')]);_0x567df2[_0x88ef('0x3e')]=qs['filters'](_[_0x88ef('0x38')](_0x4ca4f6['query'],_0x54c6da[_0x88ef('0x39')]));if(_0x4ca4f6[_0x88ef('0x2f')][_0x88ef('0x3f')]){_0x567df2[_0x88ef('0x3e')]=_[_0x88ef('0x3d')](_0x567df2[_0x88ef('0x3e')],{'$or':_[_0x88ef('0x40')](_0x567df2[_0x88ef('0x32')],function(_0x15ce76){var _0x9ee617={};_0x9ee617[_0x15ce76]={'$like':'%'+_0x4ca4f6[_0x88ef('0x2f')][_0x88ef('0x3f')]+'%'};return _0x9ee617;})});}_0x567df2=_['merge']({},_0x567df2,_0x4ca4f6[_0x88ef('0x41')]);return _0x5c345c[_0x88ef('0x6c')](_0x567df2);}})[_0x88ef('0x25')](function(_0x1040ac){if(_0x1040ac){_0x9aa68f=_0x1040ac[_0x88ef('0x34')];if(!_0x4ca4f6[_0x88ef('0x2f')][_0x88ef('0x35')]('nolimit')){_0x567df2[_0x88ef('0x20')]=qs[_0x88ef('0x20')](_0x4ca4f6[_0x88ef('0x2f')]['limit']);_0x567df2['offset']=qs[_0x88ef('0x1f')](_0x4ca4f6[_0x88ef('0x2f')][_0x88ef('0x1f')]);}return _0x5c345c[_0x88ef('0x6c')](_0x567df2);}})[_0x88ef('0x25')](function(_0x45aa0f){if(_0x45aa0f){return _0x45aa0f?{'count':_0x9aa68f,'rows':_0x45aa0f}:null;}})[_0x88ef('0x25')](respondWithResult(_0x506fef,null))['catch'](handleError(_0x506fef,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index c3cfb0f..31e6753 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 _0xa1b9=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','SmsQueue'];(function(_0x300d0e,_0x4fcd1b){var _0x1903cb=function(_0x1d4721){while(--_0x1d4721){_0x300d0e['push'](_0x300d0e['shift']());}};_0x1903cb(++_0x4fcd1b);}(_0xa1b9,0x1d2));var _0x9a1b=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa1b9[_0x36dfbd];return _0x4ecad9;};'use strict';var EventEmitter=require(_0x9a1b('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x9a1b('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x9a1b('0x2')](0x0);var events={'afterCreate':_0x9a1b('0x3'),'afterUpdate':_0x9a1b('0x4'),'afterDestroy':_0x9a1b('0x5')};function emitEvent(_0x41a75e){return function(_0x1a7f17,_0x32deec,_0x21c7dd){SmsQueueEvents[_0x9a1b('0x6')](_0x41a75e+':'+_0x1a7f17['id'],_0x1a7f17);SmsQueueEvents[_0x9a1b('0x6')](_0x41a75e,_0x1a7f17);_0x21c7dd(null);};}for(var e in events){if(events[_0x9a1b('0x7')](e)){var event=events[e];SmsQueue[_0x9a1b('0x8')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x8cdd=['events','../../mysqldb','SmsQueue','save','update','remove','emit','exports'];(function(_0x44dc4c,_0x357e6a){var _0x4e644e=function(_0x2f033e){while(--_0x2f033e){_0x44dc4c['push'](_0x44dc4c['shift']());}};_0x4e644e(++_0x357e6a);}(_0x8cdd,0x70));var _0xd8cd=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x8cdd[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require(_0xd8cd('0x0'));var SmsQueue=require(_0xd8cd('0x1'))['db'][_0xd8cd('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd8cd('0x3'),'afterUpdate':_0xd8cd('0x4'),'afterDestroy':_0xd8cd('0x5')};function emitEvent(_0x596f70){return function(_0x8637c6,_0x48ed27,_0x575e9f){SmsQueueEvents[_0xd8cd('0x6')](_0x596f70+':'+_0x8637c6['id'],_0x8637c6);SmsQueueEvents[_0xd8cd('0x6')](_0x596f70,_0x8637c6);_0x575e9f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xd8cd('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index b88c8b4..b924549 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 _0xf3be=['./smsQueue.attributes','exports','define','sms_queues','util','../../config/logger','api','bluebird','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf3be,0x1f3));var _0xef3b=function(_0x304392,_0x2264ff){_0x304392=_0x304392-0x0;var _0x1a5d24=_0xf3be[_0x304392];return _0x1a5d24;};'use strict';var _=require('lodash');var util=require(_0xef3b('0x0'));var logger=require(_0xef3b('0x1'))(_0xef3b('0x2'));var moment=require('moment');var BPromise=require(_0xef3b('0x3'));var rp=require(_0xef3b('0x4'));var attributes=require(_0xef3b('0x5'));module[_0xef3b('0x6')]=function(_0x102c1e,_0xefa60d){return _0x102c1e[_0xef3b('0x7')]('SmsQueue',attributes,{'tableName':_0xef3b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a61=['moment','bluebird','request-promise','./smsQueue.attributes','define','SmsQueue','sms_queues','lodash','util'];(function(_0x1f7d90,_0x4a3845){var _0x1afd30=function(_0x293ef4){while(--_0x293ef4){_0x1f7d90['push'](_0x1f7d90['shift']());}};_0x1afd30(++_0x4a3845);}(_0x1a61,0x16f));var _0x11a6=function(_0x549154,_0x10492d){_0x549154=_0x549154-0x0;var _0x3029b2=_0x1a61[_0x549154];return _0x3029b2;};'use strict';var _=require(_0x11a6('0x0'));var util=require(_0x11a6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x11a6('0x2'));var BPromise=require(_0x11a6('0x3'));var rp=require(_0x11a6('0x4'));var attributes=require(_0x11a6('0x5'));module['exports']=function(_0x43dc42,_0x33f658){return _0x43dc42[_0x11a6('0x6')](_0x11a6('0x7'),attributes,{'tableName':_0x11a6('0x8'),'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 6c01e66..97768ce 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 _0xeb7c=['find','raw','ShowSmsQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','SmsQueue,\x20%s,\x20%s','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','findAll','options','where','attributes','limit','include','map','model','info','GetSmsQueue','catch','SmsQueue'];(function(_0x5a600a,_0xbdb5b7){var _0x35803c=function(_0xb61977){while(--_0xb61977){_0x5a600a['push'](_0x5a600a['shift']());}};_0x35803c(++_0xbdb5b7);}(_0xeb7c,0xcb));var _0xceb7=function(_0x312bad,_0x553026){_0x312bad=_0x312bad-0x0;var _0x3bdaf6=_0xeb7c[_0x312bad];return _0x3bdaf6;};'use strict';var _=require(_0xceb7('0x0'));var util=require(_0xceb7('0x1'));var moment=require(_0xceb7('0x2'));var BPromise=require(_0xceb7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xceb7('0x4'));var db=require(_0xceb7('0x5'))['db'];var utils=require(_0xceb7('0x6'));var logger=require('../../config/logger')(_0xceb7('0x7'));var config=require(_0xceb7('0x8'));var jayson=require(_0xceb7('0x9'));var client=jayson[_0xceb7('0xa')][_0xceb7('0xb')]({'port':0x232a});config[_0xceb7('0xc')]=_[_0xceb7('0xd')](config[_0xceb7('0xc')],{'host':_0xceb7('0xe'),'port':0x18eb});var socket=require(_0xceb7('0xf'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xceb7('0x10')](socket);function respondWithRpcPromise(_0x4180ca,_0xb80cee,_0x143155){return new BPromise(function(_0x24e7e1,_0x1f57e2){return client['request'](_0x4180ca,_0x143155)[_0xceb7('0x11')](function(_0x3e104f){logger['info'](_0xceb7('0x12'),_0xb80cee,'request\x20sent');logger['debug'](_0xceb7('0x13'),_0xb80cee,'request\x20sent',JSON[_0xceb7('0x14')](_0x3e104f));if(_0x3e104f[_0xceb7('0x15')]){if(_0x3e104f[_0xceb7('0x15')][_0xceb7('0x16')]===0x1f4){logger[_0xceb7('0x15')]('SmsQueue,\x20%s,\x20%s',_0xb80cee,_0x3e104f[_0xceb7('0x15')]['message']);return _0x1f57e2(_0x3e104f[_0xceb7('0x15')][_0xceb7('0x17')]);}logger[_0xceb7('0x15')](_0xceb7('0x12'),_0xb80cee,_0x3e104f[_0xceb7('0x15')]['message']);return _0x24e7e1(_0x3e104f[_0xceb7('0x15')]['message']);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0xb80cee,_0xceb7('0x18'));_0x24e7e1(_0x3e104f['result'][_0xceb7('0x17')]);}})['catch'](function(_0x288513){logger['error']('SmsQueue,\x20%s,\x20%s',_0xb80cee,_0x288513);_0x1f57e2(_0x288513);});});}exports['GetSmsQueue']=function(_0x5eafe5){var _0x4a2edf=this;return new Promise(function(_0xfd84ce,_0x2deff8){return db['SmsQueue'][_0xceb7('0x19')]({'raw':_0x5eafe5[_0xceb7('0x1a')]?_0x5eafe5[_0xceb7('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5eafe5[_0xceb7('0x1a')]?_0x5eafe5['options'][_0xceb7('0x1b')]||null:null,'attributes':_0x5eafe5[_0xceb7('0x1a')]?_0x5eafe5[_0xceb7('0x1a')][_0xceb7('0x1c')]||null:null,'limit':_0x5eafe5['options']?_0x5eafe5['options'][_0xceb7('0x1d')]||null:null,'include':_0x5eafe5[_0xceb7('0x1a')]?_0x5eafe5['options'][_0xceb7('0x1e')]?_[_0xceb7('0x1f')](_0x5eafe5[_0xceb7('0x1a')][_0xceb7('0x1e')],function(_0x3ef3e3){return{'model':db[_0x3ef3e3[_0xceb7('0x20')]],'as':_0x3ef3e3['as'],'attributes':_0x3ef3e3['attributes'],'include':_0x3ef3e3[_0xceb7('0x1e')]?_[_0xceb7('0x1f')](_0x3ef3e3[_0xceb7('0x1e')],function(_0x39b020){return{'model':db[_0x39b020['model']],'as':_0x39b020['as'],'attributes':_0x39b020['attributes'],'include':_0x39b020['include']?_['map'](_0x39b020[_0xceb7('0x1e')],function(_0x365337){return{'model':db[_0x365337['model']],'as':_0x365337['as'],'attributes':_0x365337[_0xceb7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xceb7('0x11')](function(_0x5b79c5){logger[_0xceb7('0x21')](_0xceb7('0x22'),_0x5eafe5);logger['debug']('GetSmsQueue',_0x5eafe5,JSON[_0xceb7('0x14')](_0x5b79c5));_0xfd84ce(_0x5b79c5);})[_0xceb7('0x23')](function(_0xa83ac3){logger[_0xceb7('0x15')]('GetSmsQueue',_0xa83ac3[_0xceb7('0x17')],_0x5eafe5);_0x2deff8(_0x4a2edf[_0xceb7('0x15')](0x1f4,_0xa83ac3[_0xceb7('0x17')]));});});};exports['ShowSmsQueue']=function(_0x16b470){var _0x3db943=this;return new Promise(function(_0x351c09,_0x23c202){return db[_0xceb7('0x24')][_0xceb7('0x25')]({'raw':_0x16b470[_0xceb7('0x1a')]?_0x16b470[_0xceb7('0x1a')][_0xceb7('0x26')]===undefined?!![]:![]:!![],'where':_0x16b470[_0xceb7('0x1a')]?_0x16b470[_0xceb7('0x1a')][_0xceb7('0x1b')]||null:null,'attributes':_0x16b470[_0xceb7('0x1a')]?_0x16b470[_0xceb7('0x1a')][_0xceb7('0x1c')]||null:null,'include':_0x16b470[_0xceb7('0x1a')]?_0x16b470[_0xceb7('0x1a')]['include']?_[_0xceb7('0x1f')](_0x16b470[_0xceb7('0x1a')][_0xceb7('0x1e')],function(_0x5b1aa7){return{'model':db[_0x5b1aa7[_0xceb7('0x20')]],'as':_0x5b1aa7['as'],'attributes':_0x5b1aa7[_0xceb7('0x1c')],'include':_0x5b1aa7[_0xceb7('0x1e')]?_[_0xceb7('0x1f')](_0x5b1aa7[_0xceb7('0x1e')],function(_0x23fa4d){return{'model':db[_0x23fa4d[_0xceb7('0x20')]],'as':_0x23fa4d['as'],'attributes':_0x23fa4d[_0xceb7('0x1c')],'include':_0x23fa4d[_0xceb7('0x1e')]?_['map'](_0x23fa4d[_0xceb7('0x1e')],function(_0x3b4ac5){return{'model':db[_0x3b4ac5[_0xceb7('0x20')]],'as':_0x3b4ac5['as'],'attributes':_0x3b4ac5[_0xceb7('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ca8ce){logger[_0xceb7('0x21')](_0xceb7('0x27'),_0x16b470);logger['debug']('ShowSmsQueue',_0x16b470,JSON['stringify'](_0x1ca8ce));_0x351c09(_0x1ca8ce);})['catch'](function(_0x271f10){logger[_0xceb7('0x15')]('ShowSmsQueue',_0x271f10['message'],_0x16b470);_0x23c202(_0x3db943[_0xceb7('0x15')](0x1f4,_0x271f10['message']));});});}; \ No newline at end of file +var _0x4108=['jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','result','catch','GetSmsQueue','findAll','options','raw','where','attributes','limit','include','model','map','ShowSmsQueue','SmsQueue','find','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5888d3,_0x3c3038){var _0xb751c=function(_0x484d29){while(--_0x484d29){_0x5888d3['push'](_0x5888d3['shift']());}};_0xb751c(++_0x3c3038);}(_0x4108,0x1d0));var _0x8410=function(_0x458e0e,_0x2ece9f){_0x458e0e=_0x458e0e-0x0;var _0x3807cd=_0x4108[_0x458e0e];return _0x3807cd;};'use strict';var _=require('lodash');var util=require(_0x8410('0x0'));var moment=require(_0x8410('0x1'));var BPromise=require(_0x8410('0x2'));var rs=require(_0x8410('0x3'));var fs=require('fs');var Redis=require(_0x8410('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8410('0x5'));var logger=require(_0x8410('0x6'))(_0x8410('0x7'));var config=require(_0x8410('0x8'));var jayson=require(_0x8410('0x9'));var client=jayson[_0x8410('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8410('0xb')](config[_0x8410('0xc')],{'host':_0x8410('0xd'),'port':0x18eb});var socket=require(_0x8410('0xe'))(new Redis(config[_0x8410('0xc')]));require(_0x8410('0xf'))[_0x8410('0x10')](socket);function respondWithRpcPromise(_0x54e855,_0x2681d1,_0x180025){return new BPromise(function(_0x5c0bc,_0xa9dd0b){return client[_0x8410('0x11')](_0x54e855,_0x180025)[_0x8410('0x12')](function(_0x19e67a){logger[_0x8410('0x13')]('SmsQueue,\x20%s,\x20%s',_0x2681d1,_0x8410('0x14'));logger[_0x8410('0x15')](_0x8410('0x16'),_0x2681d1,_0x8410('0x14'),JSON[_0x8410('0x17')](_0x19e67a));if(_0x19e67a[_0x8410('0x18')]){if(_0x19e67a[_0x8410('0x18')][_0x8410('0x19')]===0x1f4){logger[_0x8410('0x18')](_0x8410('0x1a'),_0x2681d1,_0x19e67a[_0x8410('0x18')][_0x8410('0x1b')]);return _0xa9dd0b(_0x19e67a[_0x8410('0x18')][_0x8410('0x1b')]);}logger[_0x8410('0x18')]('SmsQueue,\x20%s,\x20%s',_0x2681d1,_0x19e67a['error']['message']);return _0x5c0bc(_0x19e67a[_0x8410('0x18')][_0x8410('0x1b')]);}else{logger['info'](_0x8410('0x1a'),_0x2681d1,_0x8410('0x14'));_0x5c0bc(_0x19e67a[_0x8410('0x1c')][_0x8410('0x1b')]);}})[_0x8410('0x1d')](function(_0x1a44ec){logger['error'](_0x8410('0x1a'),_0x2681d1,_0x1a44ec);_0xa9dd0b(_0x1a44ec);});});}exports[_0x8410('0x1e')]=function(_0x357c81){var _0x3f719c=this;return new Promise(function(_0x112e47,_0x1f2d91){return db['SmsQueue'][_0x8410('0x1f')]({'raw':_0x357c81[_0x8410('0x20')]?_0x357c81[_0x8410('0x20')][_0x8410('0x21')]===undefined?!![]:![]:!![],'where':_0x357c81[_0x8410('0x20')]?_0x357c81[_0x8410('0x20')][_0x8410('0x22')]||null:null,'attributes':_0x357c81[_0x8410('0x20')]?_0x357c81['options'][_0x8410('0x23')]||null:null,'limit':_0x357c81[_0x8410('0x20')]?_0x357c81[_0x8410('0x20')][_0x8410('0x24')]||null:null,'include':_0x357c81[_0x8410('0x20')]?_0x357c81[_0x8410('0x20')][_0x8410('0x25')]?_['map'](_0x357c81[_0x8410('0x20')][_0x8410('0x25')],function(_0x5a327a){return{'model':db[_0x5a327a[_0x8410('0x26')]],'as':_0x5a327a['as'],'attributes':_0x5a327a[_0x8410('0x23')],'include':_0x5a327a[_0x8410('0x25')]?_['map'](_0x5a327a[_0x8410('0x25')],function(_0xa10fe0){return{'model':db[_0xa10fe0['model']],'as':_0xa10fe0['as'],'attributes':_0xa10fe0[_0x8410('0x23')],'include':_0xa10fe0[_0x8410('0x25')]?_[_0x8410('0x27')](_0xa10fe0['include'],function(_0xb4b646){return{'model':db[_0xb4b646[_0x8410('0x26')]],'as':_0xb4b646['as'],'attributes':_0xb4b646['attributes']};}):[]};}):[]};}):[]:[]})[_0x8410('0x12')](function(_0x1f4b2f){logger[_0x8410('0x13')](_0x8410('0x1e'),_0x357c81);logger[_0x8410('0x15')](_0x8410('0x1e'),_0x357c81,JSON[_0x8410('0x17')](_0x1f4b2f));_0x112e47(_0x1f4b2f);})['catch'](function(_0x439981){logger[_0x8410('0x18')](_0x8410('0x1e'),_0x439981['message'],_0x357c81);_0x1f2d91(_0x3f719c[_0x8410('0x18')](0x1f4,_0x439981['message']));});});};exports[_0x8410('0x28')]=function(_0x2f757d){var _0x3c1e52=this;return new Promise(function(_0x67fc17,_0x210dd7){return db[_0x8410('0x29')][_0x8410('0x2a')]({'raw':_0x2f757d[_0x8410('0x20')]?_0x2f757d[_0x8410('0x20')][_0x8410('0x21')]===undefined?!![]:![]:!![],'where':_0x2f757d['options']?_0x2f757d[_0x8410('0x20')][_0x8410('0x22')]||null:null,'attributes':_0x2f757d[_0x8410('0x20')]?_0x2f757d[_0x8410('0x20')]['attributes']||null:null,'include':_0x2f757d[_0x8410('0x20')]?_0x2f757d[_0x8410('0x20')][_0x8410('0x25')]?_[_0x8410('0x27')](_0x2f757d['options'][_0x8410('0x25')],function(_0x59a1a5){return{'model':db[_0x59a1a5[_0x8410('0x26')]],'as':_0x59a1a5['as'],'attributes':_0x59a1a5[_0x8410('0x23')],'include':_0x59a1a5[_0x8410('0x25')]?_['map'](_0x59a1a5['include'],function(_0x1ea82e){return{'model':db[_0x1ea82e[_0x8410('0x26')]],'as':_0x1ea82e['as'],'attributes':_0x1ea82e[_0x8410('0x23')],'include':_0x1ea82e['include']?_[_0x8410('0x27')](_0x1ea82e[_0x8410('0x25')],function(_0x55ed86){return{'model':db[_0x55ed86[_0x8410('0x26')]],'as':_0x55ed86['as'],'attributes':_0x55ed86[_0x8410('0x23')]};}):[]};}):[]};}):[]:[]})[_0x8410('0x12')](function(_0x3fec2e){logger['info'](_0x8410('0x28'),_0x2f757d);logger['debug'](_0x8410('0x28'),_0x2f757d,JSON['stringify'](_0x3fec2e));_0x67fc17(_0x3fec2e);})[_0x8410('0x1d')](function(_0x3ec54d){logger[_0x8410('0x18')]('ShowSmsQueue',_0x3ec54d['message'],_0x2f757d);_0x210dd7(_0x3c1e52[_0x8410('0x18')](0x1f4,_0x3ec54d[_0x8410('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 6640abf..4ee16da 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 _0x6d65=['removeListener','register','length','smsQueue:','./smsQueue.events','save','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6d65,0x100));var _0x56d6=function(_0x26a403,_0x2596a3){_0x26a403=_0x26a403-0x0;var _0x5264c9=_0x6d65[_0x26a403];return _0x5264c9;};'use strict';var SmsQueueEvents=require(_0x56d6('0x0'));var events=[_0x56d6('0x1'),'remove',_0x56d6('0x2')];function createListener(_0x51cc68,_0x35761f){return function(_0x407f2b){_0x35761f['emit'](_0x51cc68,_0x407f2b);};}function removeListener(_0x36f63b,_0x2f1716){return function(){SmsQueueEvents[_0x56d6('0x3')](_0x36f63b,_0x2f1716);};}exports[_0x56d6('0x4')]=function(_0x17f94d){for(var _0x2febbb=0x0,_0x554cc1=events[_0x56d6('0x5')];_0x2febbb<_0x554cc1;_0x2febbb++){var _0x485c7b=events[_0x2febbb];var _0x505790=createListener(_0x56d6('0x6')+_0x485c7b,_0x17f94d);SmsQueueEvents['on'](_0x485c7b,_0x505790);}}; \ No newline at end of file +var _0x5334=['update','smsQueue:','./smsQueue.events','save','remove'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x5334,0x84));var _0x4533=function(_0x1c932c,_0x27ad50){_0x1c932c=_0x1c932c-0x0;var _0x87685b=_0x5334[_0x1c932c];return _0x87685b;};'use strict';var SmsQueueEvents=require(_0x4533('0x0'));var events=[_0x4533('0x1'),_0x4533('0x2'),_0x4533('0x3')];function createListener(_0x39af56,_0x52b768){return function(_0x17585f){_0x52b768['emit'](_0x39af56,_0x17585f);};}function removeListener(_0x42184d,_0x11ce61){return function(){SmsQueueEvents['removeListener'](_0x42184d,_0x11ce61);};}exports['register']=function(_0x51b4ce){for(var _0x201673=0x0,_0x4dea06=events['length'];_0x201673<_0x4dea06;_0x201673++){var _0x487906=events[_0x201673];var _0x3fbdc3=createListener(_0x4533('0x4')+_0x487906,_0x51b4ce);SmsQueueEvents['on'](_0x487906,_0x3fbdc3);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 124744c..5ac0e9a 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 _0xa2c8=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','create','update','delete','exports'];(function(_0x495453,_0x2f974b){var _0x5281e0=function(_0x51282c){while(--_0x51282c){_0x495453['push'](_0x495453['shift']());}};_0x5281e0(++_0x2f974b);}(_0xa2c8,0x99));var _0x8a2c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa2c8[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x8a2c('0x0'));var util=require(_0x8a2c('0x1'));var path=require(_0x8a2c('0x2'));var timeout=require(_0x8a2c('0x3'));var express=require(_0x8a2c('0x4'));var router=express[_0x8a2c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x8a2c('0x6'));var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router['get']('/',auth[_0x8a2c('0x7')](),controller[_0x8a2c('0x8')]);router[_0x8a2c('0x9')](_0x8a2c('0xa'),auth['isAuthenticated'](),controller[_0x8a2c('0xb')]);router[_0x8a2c('0x9')](_0x8a2c('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x8a2c('0x7')](),controller[_0x8a2c('0xd')]);router['put'](_0x8a2c('0xc'),auth[_0x8a2c('0x7')](),controller[_0x8a2c('0xe')]);router[_0x8a2c('0xf')](_0x8a2c('0xc'),auth[_0x8a2c('0x7')](),controller['destroy']);module[_0x8a2c('0x10')]=router; \ No newline at end of file +var _0xf435=['get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsQueueReport.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf435,0x174));var _0x5f43=function(_0x5cec8e,_0x1cbf4f){_0x5cec8e=_0x5cec8e-0x0;var _0x2cd7fe=_0xf435[_0x5cec8e];return _0x2cd7fe;};'use strict';var multer=require('multer');var util=require(_0x5f43('0x0'));var path=require(_0x5f43('0x1'));var timeout=require(_0x5f43('0x2'));var express=require(_0x5f43('0x3'));var router=express[_0x5f43('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x5f43('0x5'));var config=require(_0x5f43('0x6'));var controller=require(_0x5f43('0x7'));router[_0x5f43('0x8')]('/',auth['isAuthenticated'](),controller[_0x5f43('0x9')]);router[_0x5f43('0x8')](_0x5f43('0xa'),auth['isAuthenticated'](),controller[_0x5f43('0xb')]);router[_0x5f43('0x8')](_0x5f43('0xc'),auth[_0x5f43('0xd')](),controller[_0x5f43('0xe')]);router[_0x5f43('0xf')]('/',auth[_0x5f43('0xd')](),controller[_0x5f43('0x10')]);router[_0x5f43('0x11')](_0x5f43('0xc'),auth[_0x5f43('0xd')](),controller['update']);router['delete'](_0x5f43('0xc'),auth[_0x5f43('0xd')](),controller[_0x5f43('0x12')]);module[_0x5f43('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index b21664b..178789b 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 _0x844a=['sequelize','exports','STRING','DATE','moment'];(function(_0x437f59,_0x2e9342){var _0x2ba6a4=function(_0x34dc69){while(--_0x34dc69){_0x437f59['push'](_0x437f59['shift']());}};_0x2ba6a4(++_0x2e9342);}(_0x844a,0xb3));var _0xa844=function(_0x35d2a2,_0x2d041a){_0x35d2a2=_0x35d2a2-0x0;var _0x58359f=_0x844a[_0x35d2a2];return _0x58359f;};'use strict';var moment=require(_0xa844('0x0'));var Sequelize=require(_0xa844('0x1'));module[_0xa844('0x2')]={'uniqueid':{'type':Sequelize[_0xa844('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa844('0x3')]},'joinAt':{'type':Sequelize[_0xa844('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa844('0x4')]},'exitAt':{'type':Sequelize[_0xa844('0x4')]},'reason':{'type':Sequelize[_0xa844('0x3')]}}; \ No newline at end of file +var _0xf1c0=['STRING','DATE','exports'];(function(_0x268f33,_0x36d792){var _0x440f7d=function(_0x43ba69){while(--_0x43ba69){_0x268f33['push'](_0x268f33['shift']());}};_0x440f7d(++_0x36d792);}(_0xf1c0,0x10d));var _0x0f1c=function(_0xdc9cca,_0x261512){_0xdc9cca=_0xdc9cca-0x0;var _0x3d1707=_0xf1c0[_0xdc9cca];return _0x3d1707;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x0f1c('0x0')]={'uniqueid':{'type':Sequelize[_0x0f1c('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x0f1c('0x1')]},'joinAt':{'type':Sequelize[_0x0f1c('0x2')]},'leaveAt':{'type':Sequelize[_0x0f1c('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x0f1c('0x2')]},'reason':{'type':Sequelize[_0x0f1c('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 6ef7056..03d8044 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 _0xf7b7=['../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','save','update','then','destroy','end','error','name','index','SmsQueueReport','model','keys','dateStart','query','dateEnd','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','day','add','filter','merge','count','includeAll','include','findAll','show','params','rawAttributes','catch','create','body','find','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0xf7b7,0x1cd));var _0x7f7b=function(_0x418024,_0x578735){_0x418024=_0x418024-0x0;var _0x3cf668=_0xf7b7[_0x418024];return _0x3cf668;};'use strict';var pdf=require(_0x7f7b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7f7b('0x1'));var jsonpatch=require(_0x7f7b('0x2'));var rp=require(_0x7f7b('0x3'));var moment=require(_0x7f7b('0x4'));var BPromise=require(_0x7f7b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7f7b('0x6'));var sox=require(_0x7f7b('0x7'));var csv=require('to-csv');var ejs=require(_0x7f7b('0x8'));var fs=require('fs');var _=require(_0x7f7b('0x9'));var squel=require(_0x7f7b('0xa'));var crypto=require(_0x7f7b('0xb'));var jsforce=require(_0x7f7b('0xc'));var deskjs=require(_0x7f7b('0xd'));var toCsv=require(_0x7f7b('0xe'));var querystring=require(_0x7f7b('0xf'));var Papa=require(_0x7f7b('0x10'));var Redis=require(_0x7f7b('0x11'));var qs=require(_0x7f7b('0x12'));var logger=require(_0x7f7b('0x13'))(_0x7f7b('0x14'));var utils=require(_0x7f7b('0x15'));var config=require(_0x7f7b('0x16'));var db=require(_0x7f7b('0x17'))['db'];function respondWithStatusCode(_0x30f9df,_0x36193b){_0x36193b=_0x36193b||0xcc;return function(_0x1f6ee8){if(_0x1f6ee8){return _0x30f9df[_0x7f7b('0x18')](_0x36193b);}return _0x30f9df['status'](_0x36193b)['end']();};}function respondWithResult(_0x1059bf,_0x3c22bd){_0x3c22bd=_0x3c22bd||0xc8;return function(_0x4f43de){if(_0x4f43de){return _0x1059bf[_0x7f7b('0x19')](_0x3c22bd)[_0x7f7b('0x1a')](_0x4f43de);}};}function respondWithFilteredResult(_0xbfb801,_0x414ea9){return function(_0x5ce8f3){if(_0x5ce8f3){var _0xd55d9a=_0x5ce8f3['count'],_0x55f009=_0x414ea9[_0x7f7b('0x1b')],_0x2c5530=_0x414ea9[_0x7f7b('0x1b')]+_0x414ea9[_0x7f7b('0x1c')],_0x2bb3be;if(_0x2c5530>=_0xd55d9a){_0x2c5530=_0xd55d9a;_0x2bb3be=0xc8;}else{_0x2bb3be=0xce;}_0xbfb801[_0x7f7b('0x19')](_0x2bb3be);return _0xbfb801[_0x7f7b('0x1d')]('Content-Range',_0x55f009+'-'+_0x2c5530+'/'+_0xd55d9a)[_0x7f7b('0x1a')](_0x5ce8f3);}return null;};}function patchUpdates(_0x23ec11){return function(_0x354b2e){try{jsonpatch['apply'](_0x354b2e,_0x23ec11,!![]);}catch(_0x228ccd){return BPromise['reject'](_0x228ccd);}return _0x354b2e[_0x7f7b('0x1e')]();};}function saveUpdates(_0x153f34,_0x1983d3){return function(_0xdfdbd6){if(_0xdfdbd6){return _0xdfdbd6[_0x7f7b('0x1f')](_0x153f34)[_0x7f7b('0x20')](function(_0x379e33){return _0x379e33;});}return null;};}function removeEntity(_0x3d14d5,_0x2f7d2a){return function(_0x1f3dc1){if(_0x1f3dc1){return _0x1f3dc1[_0x7f7b('0x21')]()['then'](function(){_0x3d14d5['status'](0xcc)[_0x7f7b('0x22')]();});}};}function handleEntityNotFound(_0x2b78cc,_0xd677de){return function(_0x40e5d5){if(!_0x40e5d5){_0x2b78cc[_0x7f7b('0x18')](0x194);}return _0x40e5d5;};}function handleError(_0xf7c9cc,_0x488b7f){_0x488b7f=_0x488b7f||0x1f4;return function(_0xe1b23d){logger[_0x7f7b('0x23')](_0xe1b23d['stack']);if(_0xe1b23d['name']){delete _0xe1b23d[_0x7f7b('0x24')];}_0xf7c9cc['status'](_0x488b7f)['send'](_0xe1b23d);};}exports[_0x7f7b('0x25')]=function(_0x2f4dc0,_0x6d7a57){var _0x4166d2={},_0x630ba5={},_0x1a18ad={'count':0x0,'rows':[]};var _0x31d16d=db[_0x7f7b('0x26')]['rawAttributes'];_0x630ba5[_0x7f7b('0x27')]=_[_0x7f7b('0x28')](_0x31d16d);var _0x3f1597={'dateStart':_0x2f4dc0['query'][_0x7f7b('0x29')],'dateEnd':_0x2f4dc0[_0x7f7b('0x2a')]['dateEnd']};delete _0x2f4dc0[_0x7f7b('0x2a')][_0x7f7b('0x29')];delete _0x2f4dc0[_0x7f7b('0x2a')][_0x7f7b('0x2b')];_0x630ba5[_0x7f7b('0x2a')]=_[_0x7f7b('0x28')](_0x2f4dc0[_0x7f7b('0x2a')]);_0x630ba5[_0x7f7b('0x2c')]=_[_0x7f7b('0x2d')](_0x630ba5[_0x7f7b('0x27')],_0x630ba5['query']);_0x4166d2[_0x7f7b('0x2e')]=_[_0x7f7b('0x2d')](_0x630ba5[_0x7f7b('0x27')],qs[_0x7f7b('0x2f')](_0x2f4dc0['query']['fields']));_0x4166d2['attributes']=_0x4166d2[_0x7f7b('0x2e')][_0x7f7b('0x30')]?_0x4166d2[_0x7f7b('0x2e')]:_0x630ba5[_0x7f7b('0x27')];if(!_0x2f4dc0[_0x7f7b('0x2a')]['hasOwnProperty'](_0x7f7b('0x31'))){_0x4166d2[_0x7f7b('0x1c')]=qs['limit'](_0x2f4dc0[_0x7f7b('0x2a')][_0x7f7b('0x1c')]);_0x4166d2[_0x7f7b('0x1b')]=qs[_0x7f7b('0x1b')](_0x2f4dc0[_0x7f7b('0x2a')][_0x7f7b('0x1b')]);}_0x4166d2['order']=qs[_0x7f7b('0x32')](_0x2f4dc0[_0x7f7b('0x2a')][_0x7f7b('0x32')]);_0x4166d2[_0x7f7b('0x33')]=qs['filters'](_[_0x7f7b('0x34')](_0x2f4dc0[_0x7f7b('0x2a')],_0x630ba5[_0x7f7b('0x2c')]));if(_0x3f1597[_0x7f7b('0x29')]){if(_0x3f1597[_0x7f7b('0x2b')]){_0x3f1597[_0x7f7b('0x2b')]=moment(_0x3f1597[_0x7f7b('0x2b')])['add'](0x1,_0x7f7b('0x35'));}else{_0x3f1597[_0x7f7b('0x2b')]=moment(_0x3f1597[_0x7f7b('0x29')])[_0x7f7b('0x36')](0x1,'day');}_['merge'](_0x4166d2['where'],{'createdAt':{'$gte':_0x3f1597['dateStart'],'$lte':_0x3f1597[_0x7f7b('0x2b')]}});}if(_0x2f4dc0[_0x7f7b('0x2a')][_0x7f7b('0x37')]){_0x4166d2['where']=_['merge'](_0x4166d2[_0x7f7b('0x33')],{'$or':_['map'](_0x4166d2[_0x7f7b('0x2e')],function(_0x21d9e4){var _0x2e2d9c={};_0x2e2d9c[_0x21d9e4]={'$like':'%'+_0x2f4dc0[_0x7f7b('0x2a')][_0x7f7b('0x37')]+'%'};return _0x2e2d9c;})});}_0x4166d2=_[_0x7f7b('0x38')]({},_0x4166d2,_0x2f4dc0['options']);var _0x4e01aa={'where':_0x4166d2[_0x7f7b('0x33')]};return db[_0x7f7b('0x26')][_0x7f7b('0x39')](_0x4e01aa)[_0x7f7b('0x20')](function(_0x22ee45){_0x1a18ad['count']=_0x22ee45;if(_0x2f4dc0[_0x7f7b('0x2a')][_0x7f7b('0x3a')]){_0x4166d2[_0x7f7b('0x3b')]=[{'all':!![]}];}return db[_0x7f7b('0x26')][_0x7f7b('0x3c')](_0x4166d2);})[_0x7f7b('0x20')](function(_0x49edc8){_0x1a18ad['rows']=_0x49edc8;return _0x1a18ad;})['then'](respondWithFilteredResult(_0x6d7a57,_0x4166d2))['catch'](handleError(_0x6d7a57,null));};exports[_0x7f7b('0x3d')]=function(_0x4cd9fa,_0x2c4463){var _0x378d2d={'raw':!![],'where':{'id':_0x4cd9fa[_0x7f7b('0x3e')]['id']}},_0x5099cb={};_0x5099cb['model']=_['keys'](db[_0x7f7b('0x26')][_0x7f7b('0x3f')]);_0x5099cb[_0x7f7b('0x2a')]=_[_0x7f7b('0x28')](_0x4cd9fa['query']);_0x5099cb[_0x7f7b('0x2c')]=_[_0x7f7b('0x2d')](_0x5099cb[_0x7f7b('0x27')],_0x5099cb[_0x7f7b('0x2a')]);_0x378d2d['attributes']=_[_0x7f7b('0x2d')](_0x5099cb[_0x7f7b('0x27')],qs['fields'](_0x4cd9fa['query']['fields']));_0x378d2d[_0x7f7b('0x2e')]=_0x378d2d['attributes'][_0x7f7b('0x30')]?_0x378d2d[_0x7f7b('0x2e')]:_0x5099cb[_0x7f7b('0x27')];if(_0x4cd9fa[_0x7f7b('0x2a')][_0x7f7b('0x3a')]){_0x378d2d['include']=[{'all':!![]}];}_0x378d2d=_[_0x7f7b('0x38')]({},_0x378d2d,_0x4cd9fa['options']);return db[_0x7f7b('0x26')]['find'](_0x378d2d)[_0x7f7b('0x20')](handleEntityNotFound(_0x2c4463,null))[_0x7f7b('0x20')](respondWithResult(_0x2c4463,null))[_0x7f7b('0x40')](handleError(_0x2c4463,null));};exports[_0x7f7b('0x41')]=function(_0x412fe7,_0x5130ee){return db[_0x7f7b('0x26')]['create'](_0x412fe7[_0x7f7b('0x42')],{})[_0x7f7b('0x20')](respondWithResult(_0x5130ee,0xc9))['catch'](handleError(_0x5130ee,null));};exports[_0x7f7b('0x1f')]=function(_0x46d675,_0xafee58){if(_0x46d675[_0x7f7b('0x42')]['id']){delete _0x46d675[_0x7f7b('0x42')]['id'];}return db[_0x7f7b('0x26')][_0x7f7b('0x43')]({'where':{'id':_0x46d675[_0x7f7b('0x3e')]['id']}})[_0x7f7b('0x20')](handleEntityNotFound(_0xafee58,null))[_0x7f7b('0x20')](saveUpdates(_0x46d675[_0x7f7b('0x42')],null))[_0x7f7b('0x20')](respondWithResult(_0xafee58,null))[_0x7f7b('0x40')](handleError(_0xafee58,null));};exports['destroy']=function(_0x54d3ac,_0x1220eb){return db[_0x7f7b('0x26')][_0x7f7b('0x43')]({'where':{'id':_0x54d3ac[_0x7f7b('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1220eb,null))['then'](removeEntity(_0x1220eb,null))[_0x7f7b('0x40')](handleError(_0x1220eb,null));};exports['describe']=function(_0x27512c,_0x290bf7){return db[_0x7f7b('0x26')][_0x7f7b('0x44')]()['then'](respondWithResult(_0x290bf7,null))[_0x7f7b('0x40')](handleError(_0x290bf7,null));}; \ No newline at end of file +var _0x1306=['map','count','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','status','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','SmsQueueReport','rawAttributes','model','dateStart','query','dateEnd','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','filter','merge'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1306,0x9b));var _0x6130=function(_0x1a432d,_0x1fcd0c){_0x1a432d=_0x1a432d-0x0;var _0x4c4644=_0x1306[_0x1a432d];return _0x4c4644;};'use strict';var pdf=require(_0x6130('0x0'));var emlformat=require(_0x6130('0x1'));var rimraf=require(_0x6130('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6130('0x3'));var moment=require(_0x6130('0x4'));var BPromise=require(_0x6130('0x5'));var Mustache=require(_0x6130('0x6'));var util=require(_0x6130('0x7'));var path=require(_0x6130('0x8'));var sox=require(_0x6130('0x9'));var csv=require(_0x6130('0xa'));var ejs=require(_0x6130('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6130('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6130('0xd'));var toCsv=require(_0x6130('0xa'));var querystring=require(_0x6130('0xe'));var Papa=require(_0x6130('0xf'));var Redis=require(_0x6130('0x10'));var qs=require(_0x6130('0x11'));var logger=require(_0x6130('0x12'))('api');var utils=require(_0x6130('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6ab3e4,_0x399281){_0x399281=_0x399281||0xcc;return function(_0x1b71f9){if(_0x1b71f9){return _0x6ab3e4['sendStatus'](_0x399281);}return _0x6ab3e4[_0x6130('0x14')](_0x399281)['end']();};}function respondWithResult(_0x5c3713,_0x5c4e38){_0x5c4e38=_0x5c4e38||0xc8;return function(_0x248422){if(_0x248422){return _0x5c3713[_0x6130('0x14')](_0x5c4e38)[_0x6130('0x15')](_0x248422);}};}function respondWithFilteredResult(_0x58aa84,_0x4dc698){return function(_0x1658a5){if(_0x1658a5){var _0x61393b=_0x1658a5['count'],_0x54bded=_0x4dc698[_0x6130('0x16')],_0x14b317=_0x4dc698[_0x6130('0x16')]+_0x4dc698[_0x6130('0x17')],_0x25fb98;if(_0x14b317>=_0x61393b){_0x14b317=_0x61393b;_0x25fb98=0xc8;}else{_0x25fb98=0xce;}_0x58aa84[_0x6130('0x14')](_0x25fb98);return _0x58aa84[_0x6130('0x18')](_0x6130('0x19'),_0x54bded+'-'+_0x14b317+'/'+_0x61393b)[_0x6130('0x15')](_0x1658a5);}return null;};}function patchUpdates(_0x58a738){return function(_0x5390cc){try{jsonpatch['apply'](_0x5390cc,_0x58a738,!![]);}catch(_0x26d56f){return BPromise[_0x6130('0x1a')](_0x26d56f);}return _0x5390cc[_0x6130('0x1b')]();};}function saveUpdates(_0x263706,_0x4e4e4f){return function(_0x29884f){if(_0x29884f){return _0x29884f[_0x6130('0x1c')](_0x263706)[_0x6130('0x1d')](function(_0x58bb8f){return _0x58bb8f;});}return null;};}function removeEntity(_0x17a5b5,_0x296d30){return function(_0x3ae077){if(_0x3ae077){return _0x3ae077[_0x6130('0x1e')]()[_0x6130('0x1d')](function(){_0x17a5b5[_0x6130('0x14')](0xcc)[_0x6130('0x1f')]();});}};}function handleEntityNotFound(_0x351d9e,_0x4ec9bd){return function(_0x1f4da7){if(!_0x1f4da7){_0x351d9e['sendStatus'](0x194);}return _0x1f4da7;};}function handleError(_0x121f1b,_0x513325){_0x513325=_0x513325||0x1f4;return function(_0x2d3a8a){logger[_0x6130('0x20')](_0x2d3a8a[_0x6130('0x21')]);if(_0x2d3a8a['name']){delete _0x2d3a8a[_0x6130('0x22')];}_0x121f1b[_0x6130('0x14')](_0x513325)[_0x6130('0x23')](_0x2d3a8a);};}exports['index']=function(_0x483c7f,_0x59898b){var _0xcfe12a={},_0x22da2b={},_0x2a02ad={'count':0x0,'rows':[]};var _0x186b94=db[_0x6130('0x24')][_0x6130('0x25')];_0x22da2b[_0x6130('0x26')]=_['keys'](_0x186b94);var _0x493f6b={'dateStart':_0x483c7f['query'][_0x6130('0x27')],'dateEnd':_0x483c7f[_0x6130('0x28')][_0x6130('0x29')]};delete _0x483c7f['query']['dateStart'];delete _0x483c7f[_0x6130('0x28')][_0x6130('0x29')];_0x22da2b[_0x6130('0x28')]=_[_0x6130('0x2a')](_0x483c7f['query']);_0x22da2b[_0x6130('0x2b')]=_[_0x6130('0x2c')](_0x22da2b['model'],_0x22da2b[_0x6130('0x28')]);_0xcfe12a['attributes']=_[_0x6130('0x2c')](_0x22da2b[_0x6130('0x26')],qs[_0x6130('0x2d')](_0x483c7f[_0x6130('0x28')][_0x6130('0x2d')]));_0xcfe12a[_0x6130('0x2e')]=_0xcfe12a['attributes'][_0x6130('0x2f')]?_0xcfe12a[_0x6130('0x2e')]:_0x22da2b[_0x6130('0x26')];if(!_0x483c7f[_0x6130('0x28')][_0x6130('0x30')](_0x6130('0x31'))){_0xcfe12a[_0x6130('0x17')]=qs[_0x6130('0x17')](_0x483c7f[_0x6130('0x28')][_0x6130('0x17')]);_0xcfe12a[_0x6130('0x16')]=qs[_0x6130('0x16')](_0x483c7f[_0x6130('0x28')][_0x6130('0x16')]);}_0xcfe12a[_0x6130('0x32')]=qs[_0x6130('0x33')](_0x483c7f[_0x6130('0x28')][_0x6130('0x33')]);_0xcfe12a[_0x6130('0x34')]=qs[_0x6130('0x2b')](_[_0x6130('0x35')](_0x483c7f['query'],_0x22da2b['filters']));if(_0x493f6b[_0x6130('0x27')]){if(_0x493f6b['dateEnd']){_0x493f6b[_0x6130('0x29')]=moment(_0x493f6b[_0x6130('0x29')])[_0x6130('0x36')](0x1,_0x6130('0x37'));}else{_0x493f6b[_0x6130('0x29')]=moment(_0x493f6b[_0x6130('0x27')])[_0x6130('0x36')](0x1,_0x6130('0x37'));}_['merge'](_0xcfe12a[_0x6130('0x34')],{'createdAt':{'$gte':_0x493f6b[_0x6130('0x27')],'$lte':_0x493f6b[_0x6130('0x29')]}});}if(_0x483c7f[_0x6130('0x28')][_0x6130('0x38')]){_0xcfe12a[_0x6130('0x34')]=_[_0x6130('0x39')](_0xcfe12a[_0x6130('0x34')],{'$or':_[_0x6130('0x3a')](_0xcfe12a[_0x6130('0x2e')],function(_0x961e61){var _0x10625b={};_0x10625b[_0x961e61]={'$like':'%'+_0x483c7f[_0x6130('0x28')][_0x6130('0x38')]+'%'};return _0x10625b;})});}_0xcfe12a=_[_0x6130('0x39')]({},_0xcfe12a,_0x483c7f['options']);var _0x37978f={'where':_0xcfe12a[_0x6130('0x34')]};return db['SmsQueueReport'][_0x6130('0x3b')](_0x37978f)[_0x6130('0x1d')](function(_0x6559e){_0x2a02ad[_0x6130('0x3b')]=_0x6559e;if(_0x483c7f[_0x6130('0x28')][_0x6130('0x3c')]){_0xcfe12a[_0x6130('0x3d')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x6130('0x3e')](_0xcfe12a);})['then'](function(_0x3cae4c){_0x2a02ad[_0x6130('0x3f')]=_0x3cae4c;return _0x2a02ad;})[_0x6130('0x1d')](respondWithFilteredResult(_0x59898b,_0xcfe12a))[_0x6130('0x40')](handleError(_0x59898b,null));};exports[_0x6130('0x41')]=function(_0x7cfb80,_0x1bcdff){var _0x199cdc={'raw':!![],'where':{'id':_0x7cfb80[_0x6130('0x42')]['id']}},_0x5211a8={};_0x5211a8[_0x6130('0x26')]=_[_0x6130('0x2a')](db[_0x6130('0x24')][_0x6130('0x25')]);_0x5211a8[_0x6130('0x28')]=_[_0x6130('0x2a')](_0x7cfb80[_0x6130('0x28')]);_0x5211a8[_0x6130('0x2b')]=_[_0x6130('0x2c')](_0x5211a8['model'],_0x5211a8[_0x6130('0x28')]);_0x199cdc[_0x6130('0x2e')]=_[_0x6130('0x2c')](_0x5211a8[_0x6130('0x26')],qs[_0x6130('0x2d')](_0x7cfb80[_0x6130('0x28')][_0x6130('0x2d')]));_0x199cdc[_0x6130('0x2e')]=_0x199cdc[_0x6130('0x2e')][_0x6130('0x2f')]?_0x199cdc[_0x6130('0x2e')]:_0x5211a8[_0x6130('0x26')];if(_0x7cfb80[_0x6130('0x28')][_0x6130('0x3c')]){_0x199cdc[_0x6130('0x3d')]=[{'all':!![]}];}_0x199cdc=_[_0x6130('0x39')]({},_0x199cdc,_0x7cfb80['options']);return db['SmsQueueReport']['find'](_0x199cdc)[_0x6130('0x1d')](handleEntityNotFound(_0x1bcdff,null))[_0x6130('0x1d')](respondWithResult(_0x1bcdff,null))[_0x6130('0x40')](handleError(_0x1bcdff,null));};exports[_0x6130('0x43')]=function(_0x7d966,_0xdaf79d){return db[_0x6130('0x24')][_0x6130('0x43')](_0x7d966[_0x6130('0x44')],{})['then'](respondWithResult(_0xdaf79d,0xc9))[_0x6130('0x40')](handleError(_0xdaf79d,null));};exports[_0x6130('0x1c')]=function(_0x3efc23,_0x3fd767){if(_0x3efc23[_0x6130('0x44')]['id']){delete _0x3efc23['body']['id'];}return db[_0x6130('0x24')][_0x6130('0x45')]({'where':{'id':_0x3efc23['params']['id']}})[_0x6130('0x1d')](handleEntityNotFound(_0x3fd767,null))[_0x6130('0x1d')](saveUpdates(_0x3efc23[_0x6130('0x44')],null))[_0x6130('0x1d')](respondWithResult(_0x3fd767,null))[_0x6130('0x40')](handleError(_0x3fd767,null));};exports['destroy']=function(_0x2ad14a,_0x345174){return db['SmsQueueReport'][_0x6130('0x45')]({'where':{'id':_0x2ad14a['params']['id']}})[_0x6130('0x1d')](handleEntityNotFound(_0x345174,null))[_0x6130('0x1d')](removeEntity(_0x345174,null))[_0x6130('0x40')](handleError(_0x345174,null));};exports['describe']=function(_0x25e937,_0x3da7cc){return db[_0x6130('0x24')][_0x6130('0x46')]()[_0x6130('0x1d')](respondWithResult(_0x3da7cc,null))[_0x6130('0x40')](handleError(_0x3da7cc,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index b1224c0..234354c 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 _0xadd6=['./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x536291,_0x3a864e){var _0x1acef6=function(_0x180f5c){while(--_0x180f5c){_0x536291['push'](_0x536291['shift']());}};_0x1acef6(++_0x3a864e);}(_0xadd6,0xfd));var _0x6add=function(_0x9aca10,_0x5463b5){_0x9aca10=_0x9aca10-0x0;var _0x499dcf=_0xadd6[_0x9aca10];return _0x499dcf;};'use strict';var _=require(_0x6add('0x0'));var util=require(_0x6add('0x1'));var logger=require(_0x6add('0x2'))(_0x6add('0x3'));var moment=require(_0x6add('0x4'));var BPromise=require(_0x6add('0x5'));var rp=require(_0x6add('0x6'));var attributes=require(_0x6add('0x7'));module[_0x6add('0x8')]=function(_0x32416e,_0x2f7c68){return _0x32416e[_0x6add('0x9')](_0x6add('0xa'),attributes,{'tableName':_0x6add('0xb'),'paranoid':![],'indexes':[{'name':_0x6add('0xc'),'fields':[_0x6add('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb287=['report_sms_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','exports','define','SmsQueueReport'];(function(_0x3b6e40,_0x35b6fa){var _0x17fc15=function(_0x3cc101){while(--_0x3cc101){_0x3b6e40['push'](_0x3b6e40['shift']());}};_0x17fc15(++_0x35b6fa);}(_0xb287,0x1a6));var _0x7b28=function(_0x2bf4b1,_0x50aacd){_0x2bf4b1=_0x2bf4b1-0x0;var _0x2e0b08=_0xb287[_0x2bf4b1];return _0x2e0b08;};'use strict';var _=require(_0x7b28('0x0'));var util=require(_0x7b28('0x1'));var logger=require(_0x7b28('0x2'))(_0x7b28('0x3'));var moment=require('moment');var BPromise=require(_0x7b28('0x4'));var rp=require('request-promise');var attributes=require('./smsQueueReport.attributes');module[_0x7b28('0x5')]=function(_0x552ebd,_0x27dcef){return _0x552ebd[_0x7b28('0x6')](_0x7b28('0x7'),attributes,{'tableName':_0x7b28('0x8'),'paranoid':![],'indexes':[{'name':_0x7b28('0x9'),'fields':[_0x7b28('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index ee16b9d..fb9f651 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 _0xa0a5=['then','UpdateSmsQueueReport','SmsQueueReport','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsQueueReport','create','body','options','raw'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xa0a5,0x170));var _0x5a0a=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0xa0a5[_0x424a9a];return _0xa7831c;};'use strict';var _=require(_0x5a0a('0x0'));var util=require(_0x5a0a('0x1'));var moment=require(_0x5a0a('0x2'));var BPromise=require(_0x5a0a('0x3'));var rs=require(_0x5a0a('0x4'));var fs=require('fs');var Redis=require(_0x5a0a('0x5'));var db=require(_0x5a0a('0x6'))['db'];var utils=require(_0x5a0a('0x7'));var logger=require(_0x5a0a('0x8'))('rpc');var config=require(_0x5a0a('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5a0a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fdda8,_0x5b4064,_0x26f78f){return new BPromise(function(_0x373dd8,_0x4e0103){return client[_0x5a0a('0xb')](_0x3fdda8,_0x26f78f)['then'](function(_0x5aed5f){logger[_0x5a0a('0xc')](_0x5a0a('0xd'),_0x5b4064,_0x5a0a('0xe'));logger[_0x5a0a('0xf')](_0x5a0a('0x10'),_0x5b4064,_0x5a0a('0xe'),JSON[_0x5a0a('0x11')](_0x5aed5f));if(_0x5aed5f[_0x5a0a('0x12')]){if(_0x5aed5f[_0x5a0a('0x12')][_0x5a0a('0x13')]===0x1f4){logger[_0x5a0a('0x12')](_0x5a0a('0xd'),_0x5b4064,_0x5aed5f[_0x5a0a('0x12')]['message']);return _0x4e0103(_0x5aed5f[_0x5a0a('0x12')]['message']);}logger[_0x5a0a('0x12')](_0x5a0a('0xd'),_0x5b4064,_0x5aed5f[_0x5a0a('0x12')][_0x5a0a('0x14')]);return _0x373dd8(_0x5aed5f[_0x5a0a('0x12')][_0x5a0a('0x14')]);}else{logger['info'](_0x5a0a('0xd'),_0x5b4064,_0x5a0a('0xe'));_0x373dd8(_0x5aed5f[_0x5a0a('0x15')]['message']);}})[_0x5a0a('0x16')](function(_0x28a207){logger[_0x5a0a('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x5b4064,_0x28a207);_0x4e0103(_0x28a207);});});}exports[_0x5a0a('0x17')]=function(_0x286398){var _0x4ef7c5=this;return new Promise(function(_0x577777,_0x3a304e){return db['SmsQueueReport'][_0x5a0a('0x18')](_0x286398[_0x5a0a('0x19')],{'raw':_0x286398[_0x5a0a('0x1a')]?_0x286398[_0x5a0a('0x1a')][_0x5a0a('0x1b')]===undefined?!![]:![]:!![]})[_0x5a0a('0x1c')](function(_0x3021a2){logger[_0x5a0a('0xc')](_0x5a0a('0x17'),_0x286398);logger[_0x5a0a('0xf')](_0x5a0a('0x17'),_0x286398,JSON['stringify'](_0x3021a2));_0x577777(_0x3021a2);})['catch'](function(_0x57ddcb){logger['error'](_0x5a0a('0x17'),_0x57ddcb[_0x5a0a('0x14')],_0x286398);_0x3a304e(_0x4ef7c5[_0x5a0a('0x12')](0x1f4,_0x57ddcb[_0x5a0a('0x14')]));});});};exports[_0x5a0a('0x1d')]=function(_0x5f019e){var _0x413d85=this;return new Promise(function(_0x20b1d1,_0x38a0a1){return db[_0x5a0a('0x1e')]['update'](_0x5f019e[_0x5a0a('0x19')],{'raw':_0x5f019e['options']?_0x5f019e[_0x5a0a('0x1a')][_0x5a0a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f019e['options']?_0x5f019e['options'][_0x5a0a('0x1f')]||null:null,'attributes':_0x5f019e['options']?_0x5f019e[_0x5a0a('0x1a')]['attributes']||null:null,'limit':_0x5f019e[_0x5a0a('0x1a')]?_0x5f019e[_0x5a0a('0x1a')][_0x5a0a('0x20')]||null:null})[_0x5a0a('0x1c')](function(_0x125f3b){logger[_0x5a0a('0xc')](_0x5a0a('0x1d'),_0x5f019e);logger[_0x5a0a('0xf')]('UpdateSmsQueueReport',_0x5f019e,JSON[_0x5a0a('0x11')](_0x125f3b));_0x20b1d1(_0x125f3b);})[_0x5a0a('0x16')](function(_0x175bd5){logger['error']('UpdateSmsQueueReport',_0x175bd5[_0x5a0a('0x14')],_0x5f019e);_0x38a0a1(_0x413d85[_0x5a0a('0x12')](0x1f4,_0x175bd5[_0x5a0a('0x14')]));});});}; \ No newline at end of file +var _0x3dea=['message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','then','UpdateSmsQueueReport','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x22d77e,_0x28fe69){var _0x713b4=function(_0x295cba){while(--_0x295cba){_0x22d77e['push'](_0x22d77e['shift']());}};_0x713b4(++_0x28fe69);}(_0x3dea,0x1a6));var _0xa3de=function(_0x47fffb,_0x30c81b){_0x47fffb=_0x47fffb-0x0;var _0x36b08e=_0x3dea[_0x47fffb];return _0x36b08e;};'use strict';var _=require(_0xa3de('0x0'));var util=require(_0xa3de('0x1'));var moment=require('moment');var BPromise=require(_0xa3de('0x2'));var rs=require(_0xa3de('0x3'));var fs=require('fs');var Redis=require(_0xa3de('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa3de('0x5'));var logger=require(_0xa3de('0x6'))(_0xa3de('0x7'));var config=require(_0xa3de('0x8'));var jayson=require(_0xa3de('0x9'));var client=jayson[_0xa3de('0xa')][_0xa3de('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bec2e,_0x5b1377,_0x34d836){return new BPromise(function(_0x3753d9,_0x9c7d9e){return client[_0xa3de('0xc')](_0x1bec2e,_0x34d836)['then'](function(_0x35369b){logger['info'](_0xa3de('0xd'),_0x5b1377,_0xa3de('0xe'));logger[_0xa3de('0xf')](_0xa3de('0x10'),_0x5b1377,_0xa3de('0xe'),JSON[_0xa3de('0x11')](_0x35369b));if(_0x35369b[_0xa3de('0x12')]){if(_0x35369b['error'][_0xa3de('0x13')]===0x1f4){logger[_0xa3de('0x12')](_0xa3de('0xd'),_0x5b1377,_0x35369b['error'][_0xa3de('0x14')]);return _0x9c7d9e(_0x35369b[_0xa3de('0x12')][_0xa3de('0x14')]);}logger['error'](_0xa3de('0xd'),_0x5b1377,_0x35369b['error']['message']);return _0x3753d9(_0x35369b[_0xa3de('0x12')][_0xa3de('0x14')]);}else{logger[_0xa3de('0x15')]('SmsQueueReport,\x20%s,\x20%s',_0x5b1377,'request\x20sent');_0x3753d9(_0x35369b[_0xa3de('0x16')]['message']);}})[_0xa3de('0x17')](function(_0x243a0c){logger['error'](_0xa3de('0xd'),_0x5b1377,_0x243a0c);_0x9c7d9e(_0x243a0c);});});}exports[_0xa3de('0x18')]=function(_0x9ea035){var _0x59c714=this;return new Promise(function(_0x509a38,_0x4f6346){return db[_0xa3de('0x19')][_0xa3de('0x1a')](_0x9ea035[_0xa3de('0x1b')],{'raw':_0x9ea035[_0xa3de('0x1c')]?_0x9ea035[_0xa3de('0x1c')][_0xa3de('0x1d')]===undefined?!![]:![]:!![]})[_0xa3de('0x1e')](function(_0x208f06){logger['info'](_0xa3de('0x18'),_0x9ea035);logger[_0xa3de('0xf')](_0xa3de('0x18'),_0x9ea035,JSON['stringify'](_0x208f06));_0x509a38(_0x208f06);})[_0xa3de('0x17')](function(_0x44b0ae){logger['error']('CreateSmsQueueReport',_0x44b0ae['message'],_0x9ea035);_0x4f6346(_0x59c714[_0xa3de('0x12')](0x1f4,_0x44b0ae['message']));});});};exports[_0xa3de('0x1f')]=function(_0x365ad1){var _0x1b2a71=this;return new Promise(function(_0x3f8d5d,_0x2d6a4d){return db['SmsQueueReport']['update'](_0x365ad1[_0xa3de('0x1b')],{'raw':_0x365ad1[_0xa3de('0x1c')]?_0x365ad1['options'][_0xa3de('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x365ad1[_0xa3de('0x1c')]?_0x365ad1['options']['where']||null:null,'attributes':_0x365ad1[_0xa3de('0x1c')]?_0x365ad1[_0xa3de('0x1c')][_0xa3de('0x20')]||null:null,'limit':_0x365ad1[_0xa3de('0x1c')]?_0x365ad1[_0xa3de('0x1c')][_0xa3de('0x21')]||null:null})[_0xa3de('0x1e')](function(_0x207671){logger[_0xa3de('0x15')](_0xa3de('0x1f'),_0x365ad1);logger['debug']('UpdateSmsQueueReport',_0x365ad1,JSON[_0xa3de('0x11')](_0x207671));_0x3f8d5d(_0x207671);})[_0xa3de('0x17')](function(_0x5ecb96){logger[_0xa3de('0x12')](_0xa3de('0x1f'),_0x5ecb96['message'],_0x365ad1);_0x2d6a4d(_0x1b2a71['error'](0x1f4,_0x5ecb96[_0xa3de('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 074c5c9..243bf4b 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 _0x6da0=['/describe','/:id','show','post','create','put','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index'];(function(_0x49c68e,_0x1c1673){var _0x33032b=function(_0x42ac31){while(--_0x42ac31){_0x49c68e['push'](_0x49c68e['shift']());}};_0x33032b(++_0x1c1673);}(_0x6da0,0x80));var _0x06da=function(_0x3fcf3d,_0x2775ed){_0x3fcf3d=_0x3fcf3d-0x0;var _0x1f53d7=_0x6da0[_0x3fcf3d];return _0x1f53d7;};'use strict';var multer=require('multer');var util=require(_0x06da('0x0'));var path=require(_0x06da('0x1'));var timeout=require(_0x06da('0x2'));var express=require(_0x06da('0x3'));var router=express[_0x06da('0x4')]();var auth=require(_0x06da('0x5'));var interaction=require(_0x06da('0x6'));var config=require(_0x06da('0x7'));var controller=require(_0x06da('0x8'));router[_0x06da('0x9')]('/',auth[_0x06da('0xa')](),controller[_0x06da('0xb')]);router[_0x06da('0x9')](_0x06da('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x06da('0x9')](_0x06da('0xd'),auth[_0x06da('0xa')](),controller[_0x06da('0xe')]);router[_0x06da('0xf')]('/',auth[_0x06da('0xa')](),controller[_0x06da('0x10')]);router[_0x06da('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x06da('0x12')]('/:id',auth[_0x06da('0xa')](),controller['destroy']);module[_0x06da('0x13')]=router; \ No newline at end of file +var _0xc6ff=['create','/:id','update','destroy','exports','util','path','connect-timeout','../../components/interaction/service','./smsTransferReport.controller','get','index','/describe','isAuthenticated','show','post'];(function(_0xf168d3,_0x43dcfc){var _0x17fb54=function(_0x3d9674){while(--_0x3d9674){_0xf168d3['push'](_0xf168d3['shift']());}};_0x17fb54(++_0x43dcfc);}(_0xc6ff,0x85));var _0xfc6f=function(_0x27a199,_0x3b597b){_0x27a199=_0x27a199-0x0;var _0x152004=_0xc6ff[_0x27a199];return _0x152004;};'use strict';var multer=require('multer');var util=require(_0xfc6f('0x0'));var path=require(_0xfc6f('0x1'));var timeout=require(_0xfc6f('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xfc6f('0x3'));var config=require('../../config/environment');var controller=require(_0xfc6f('0x4'));router[_0xfc6f('0x5')]('/',auth['isAuthenticated'](),controller[_0xfc6f('0x6')]);router[_0xfc6f('0x5')](_0xfc6f('0x7'),auth[_0xfc6f('0x8')](),controller['describe']);router['get']('/:id',auth[_0xfc6f('0x8')](),controller[_0xfc6f('0x9')]);router[_0xfc6f('0xa')]('/',auth[_0xfc6f('0x8')](),controller[_0xfc6f('0xb')]);router['put'](_0xfc6f('0xc'),auth[_0xfc6f('0x8')](),controller[_0xfc6f('0xd')]);router['delete'](_0xfc6f('0xc'),auth[_0xfc6f('0x8')](),controller[_0xfc6f('0xe')]);module[_0xfc6f('0xf')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 54fcdfc..da4264f 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 _0x27fe=['exports','STRING','ENUM','agent','queue','DATE','sequelize'];(function(_0x1afb2a,_0x1b9ca6){var _0x4c6998=function(_0x421aab){while(--_0x421aab){_0x1afb2a['push'](_0x1afb2a['shift']());}};_0x4c6998(++_0x1b9ca6);}(_0x27fe,0x164));var _0xe27f=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x27fe[_0x2f5ac5];return _0x37c9a8;};'use strict';var moment=require('moment');var Sequelize=require(_0xe27f('0x0'));module[_0xe27f('0x1')]={'uniqueid':{'type':Sequelize[_0xe27f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe27f('0x3')]('account',_0xe27f('0x4'),_0xe27f('0x5')),'allowNull':![],'defaultValue':_0xe27f('0x5')},'transferredAt':{'type':Sequelize[_0xe27f('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x724b=['queue','DATE','NOW','moment','exports','STRING','account','agent'];(function(_0x538d57,_0x5604d9){var _0x5b0fbc=function(_0x32b81d){while(--_0x32b81d){_0x538d57['push'](_0x538d57['shift']());}};_0x5b0fbc(++_0x5604d9);}(_0x724b,0x10b));var _0xb724=function(_0x34d690,_0x54d7a8){_0x34d690=_0x34d690-0x0;var _0xd67bf2=_0x724b[_0x34d690];return _0xd67bf2;};'use strict';var moment=require(_0xb724('0x0'));var Sequelize=require('sequelize');module[_0xb724('0x1')]={'uniqueid':{'type':Sequelize[_0xb724('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xb724('0x3'),_0xb724('0x4'),_0xb724('0x5')),'allowNull':![],'defaultValue':_0xb724('0x5')},'transferredAt':{'type':Sequelize[_0xb724('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb724('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 245f571..8cad29d 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 _0x7a54=['ejs','squel','crypto','desk.js','ioredis','../../components/parsers/qs','api','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','save','then','destroy','error','stack','name','index','SmsTransferReport','rawAttributes','model','keys','query','dateStart','dateEnd','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','add','day','where','filter','map','merge','options','includeAll','include','rows','show','params','find','create','update','body','catch','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox'];(function(_0x47644e,_0x5c15c9){var _0x4a5cc0=function(_0x3983d0){while(--_0x3983d0){_0x47644e['push'](_0x47644e['shift']());}};_0x4a5cc0(++_0x5c15c9);}(_0x7a54,0x106));var _0x47a5=function(_0x33cf6c,_0x3b9e3c){_0x33cf6c=_0x33cf6c-0x0;var _0x384c88=_0x7a54[_0x33cf6c];return _0x384c88;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var qs=require(_0x47a5('0xf'));var logger=require('../../config/logger')(_0x47a5('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x47a5('0x11'))['db'];function respondWithStatusCode(_0x69e4d4,_0x2f399b){_0x2f399b=_0x2f399b||0xcc;return function(_0x250fad){if(_0x250fad){return _0x69e4d4[_0x47a5('0x12')](_0x2f399b);}return _0x69e4d4[_0x47a5('0x13')](_0x2f399b)[_0x47a5('0x14')]();};}function respondWithResult(_0x5beb89,_0x44bd3e){_0x44bd3e=_0x44bd3e||0xc8;return function(_0x221b54){if(_0x221b54){return _0x5beb89[_0x47a5('0x13')](_0x44bd3e)[_0x47a5('0x15')](_0x221b54);}};}function respondWithFilteredResult(_0x139f25,_0x620ee9){return function(_0x3c6c46){if(_0x3c6c46){var _0x190faa=_0x3c6c46[_0x47a5('0x16')],_0x4e99a8=_0x620ee9[_0x47a5('0x17')],_0x362359=_0x620ee9[_0x47a5('0x17')]+_0x620ee9['limit'],_0x11faf5;if(_0x362359>=_0x190faa){_0x362359=_0x190faa;_0x11faf5=0xc8;}else{_0x11faf5=0xce;}_0x139f25['status'](_0x11faf5);return _0x139f25[_0x47a5('0x18')]('Content-Range',_0x4e99a8+'-'+_0x362359+'/'+_0x190faa)['json'](_0x3c6c46);}return null;};}function patchUpdates(_0x423a81){return function(_0xaf70a6){try{jsonpatch[_0x47a5('0x19')](_0xaf70a6,_0x423a81,!![]);}catch(_0x1ef371){return BPromise[_0x47a5('0x1a')](_0x1ef371);}return _0xaf70a6[_0x47a5('0x1b')]();};}function saveUpdates(_0x2763d6,_0xe3c618){return function(_0x3aed38){if(_0x3aed38){return _0x3aed38['update'](_0x2763d6)[_0x47a5('0x1c')](function(_0xf160ba){return _0xf160ba;});}return null;};}function removeEntity(_0x47cf3c,_0x2b0360){return function(_0x1f03f7){if(_0x1f03f7){return _0x1f03f7[_0x47a5('0x1d')]()['then'](function(){_0x47cf3c[_0x47a5('0x13')](0xcc)[_0x47a5('0x14')]();});}};}function handleEntityNotFound(_0x23db32,_0x7a9f9e){return function(_0x5ef1b1){if(!_0x5ef1b1){_0x23db32[_0x47a5('0x12')](0x194);}return _0x5ef1b1;};}function handleError(_0x385687,_0x513981){_0x513981=_0x513981||0x1f4;return function(_0x28747d){logger[_0x47a5('0x1e')](_0x28747d[_0x47a5('0x1f')]);if(_0x28747d[_0x47a5('0x20')]){delete _0x28747d[_0x47a5('0x20')];}_0x385687['status'](_0x513981)['send'](_0x28747d);};}exports[_0x47a5('0x21')]=function(_0x5686db,_0x1ea9c8){var _0x5b6c4e={},_0x23cb77={},_0x378208={'count':0x0,'rows':[]};var _0x36ad34=db[_0x47a5('0x22')][_0x47a5('0x23')];_0x23cb77[_0x47a5('0x24')]=_[_0x47a5('0x25')](_0x36ad34);var _0x136b14={'dateStart':_0x5686db[_0x47a5('0x26')][_0x47a5('0x27')],'dateEnd':_0x5686db[_0x47a5('0x26')][_0x47a5('0x28')]};delete _0x5686db[_0x47a5('0x26')]['dateStart'];delete _0x5686db[_0x47a5('0x26')]['dateEnd'];_0x23cb77[_0x47a5('0x26')]=_[_0x47a5('0x25')](_0x5686db[_0x47a5('0x26')]);_0x23cb77['filters']=_[_0x47a5('0x29')](_0x23cb77[_0x47a5('0x24')],_0x23cb77[_0x47a5('0x26')]);_0x5b6c4e[_0x47a5('0x2a')]=_['intersection'](_0x23cb77['model'],qs[_0x47a5('0x2b')](_0x5686db[_0x47a5('0x26')]['fields']));_0x5b6c4e['attributes']=_0x5b6c4e[_0x47a5('0x2a')][_0x47a5('0x2c')]?_0x5b6c4e['attributes']:_0x23cb77[_0x47a5('0x24')];if(!_0x5686db['query'][_0x47a5('0x2d')](_0x47a5('0x2e'))){_0x5b6c4e['limit']=qs['limit'](_0x5686db[_0x47a5('0x26')]['limit']);_0x5b6c4e[_0x47a5('0x17')]=qs[_0x47a5('0x17')](_0x5686db[_0x47a5('0x26')]['offset']);}_0x5b6c4e[_0x47a5('0x2f')]=qs['sort'](_0x5686db['query'][_0x47a5('0x30')]);_0x5b6c4e['where']=qs[_0x47a5('0x31')](_['pick'](_0x5686db[_0x47a5('0x26')],_0x23cb77[_0x47a5('0x31')]));if(_0x136b14[_0x47a5('0x27')]){if(_0x136b14[_0x47a5('0x28')]){_0x136b14[_0x47a5('0x28')]=moment(_0x136b14[_0x47a5('0x28')])[_0x47a5('0x32')](0x1,_0x47a5('0x33'));}else{_0x136b14[_0x47a5('0x28')]=moment(_0x136b14['dateStart'])[_0x47a5('0x32')](0x1,_0x47a5('0x33'));}_['merge'](_0x5b6c4e[_0x47a5('0x34')],{'createdAt':{'$gte':_0x136b14[_0x47a5('0x27')],'$lte':_0x136b14[_0x47a5('0x28')]}});}if(_0x5686db['query'][_0x47a5('0x35')]){_0x5b6c4e[_0x47a5('0x34')]=_['merge'](_0x5b6c4e[_0x47a5('0x34')],{'$or':_[_0x47a5('0x36')](_0x5b6c4e['attributes'],function(_0x55c5eb){var _0x5ebd8c={};_0x5ebd8c[_0x55c5eb]={'$like':'%'+_0x5686db[_0x47a5('0x26')]['filter']+'%'};return _0x5ebd8c;})});}_0x5b6c4e=_[_0x47a5('0x37')]({},_0x5b6c4e,_0x5686db[_0x47a5('0x38')]);var _0x301a85={'where':_0x5b6c4e[_0x47a5('0x34')]};return db[_0x47a5('0x22')][_0x47a5('0x16')](_0x301a85)[_0x47a5('0x1c')](function(_0x1f3d01){_0x378208[_0x47a5('0x16')]=_0x1f3d01;if(_0x5686db[_0x47a5('0x26')][_0x47a5('0x39')]){_0x5b6c4e[_0x47a5('0x3a')]=[{'all':!![]}];}return db[_0x47a5('0x22')]['findAll'](_0x5b6c4e);})[_0x47a5('0x1c')](function(_0x1c36fa){_0x378208[_0x47a5('0x3b')]=_0x1c36fa;return _0x378208;})[_0x47a5('0x1c')](respondWithFilteredResult(_0x1ea9c8,_0x5b6c4e))['catch'](handleError(_0x1ea9c8,null));};exports[_0x47a5('0x3c')]=function(_0x528ef3,_0x47c7a2){var _0x55c43d={'raw':!![],'where':{'id':_0x528ef3[_0x47a5('0x3d')]['id']}},_0x50d116={};_0x50d116['model']=_[_0x47a5('0x25')](db[_0x47a5('0x22')][_0x47a5('0x23')]);_0x50d116['query']=_[_0x47a5('0x25')](_0x528ef3[_0x47a5('0x26')]);_0x50d116['filters']=_['intersection'](_0x50d116[_0x47a5('0x24')],_0x50d116['query']);_0x55c43d[_0x47a5('0x2a')]=_[_0x47a5('0x29')](_0x50d116[_0x47a5('0x24')],qs[_0x47a5('0x2b')](_0x528ef3[_0x47a5('0x26')][_0x47a5('0x2b')]));_0x55c43d[_0x47a5('0x2a')]=_0x55c43d[_0x47a5('0x2a')][_0x47a5('0x2c')]?_0x55c43d[_0x47a5('0x2a')]:_0x50d116[_0x47a5('0x24')];if(_0x528ef3[_0x47a5('0x26')][_0x47a5('0x39')]){_0x55c43d[_0x47a5('0x3a')]=[{'all':!![]}];}_0x55c43d=_[_0x47a5('0x37')]({},_0x55c43d,_0x528ef3[_0x47a5('0x38')]);return db['SmsTransferReport'][_0x47a5('0x3e')](_0x55c43d)[_0x47a5('0x1c')](handleEntityNotFound(_0x47c7a2,null))['then'](respondWithResult(_0x47c7a2,null))['catch'](handleError(_0x47c7a2,null));};exports[_0x47a5('0x3f')]=function(_0x560e4e,_0x13750d){return db[_0x47a5('0x22')]['create'](_0x560e4e['body'],{})[_0x47a5('0x1c')](respondWithResult(_0x13750d,0xc9))['catch'](handleError(_0x13750d,null));};exports[_0x47a5('0x40')]=function(_0x1d1039,_0x3548bc){if(_0x1d1039[_0x47a5('0x41')]['id']){delete _0x1d1039[_0x47a5('0x41')]['id'];}return db[_0x47a5('0x22')][_0x47a5('0x3e')]({'where':{'id':_0x1d1039['params']['id']}})['then'](handleEntityNotFound(_0x3548bc,null))[_0x47a5('0x1c')](saveUpdates(_0x1d1039[_0x47a5('0x41')],null))[_0x47a5('0x1c')](respondWithResult(_0x3548bc,null))[_0x47a5('0x42')](handleError(_0x3548bc,null));};exports[_0x47a5('0x1d')]=function(_0x2c0c86,_0x249de5){return db['SmsTransferReport'][_0x47a5('0x3e')]({'where':{'id':_0x2c0c86[_0x47a5('0x3d')]['id']}})[_0x47a5('0x1c')](handleEntityNotFound(_0x249de5,null))['then'](removeEntity(_0x249de5,null))[_0x47a5('0x42')](handleError(_0x249de5,null));};exports['describe']=function(_0x2bf302,_0xe31817){return db[_0x47a5('0x22')][_0x47a5('0x43')]()['then'](respondWithResult(_0xe31817,null))[_0x47a5('0x42')](handleError(_0xe31817,null));}; \ No newline at end of file +var _0x5f2f=['limit','set','Content-Range','apply','reject','save','destroy','then','stack','name','send','index','SmsTransferReport','rawAttributes','model','keys','dateStart','query','dateEnd','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','day','add','merge','map','filter','include','findAll','catch','params','intersection','includeAll','options','find','create','body','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','api','../../mysqldb','sendStatus','status','end','json','count','offset'];(function(_0x464951,_0x5b96c0){var _0x497470=function(_0x6e54de){while(--_0x6e54de){_0x464951['push'](_0x464951['shift']());}};_0x497470(++_0x5b96c0);}(_0x5f2f,0x73));var _0xf5f2=function(_0x38f411,_0x5864cc){_0x38f411=_0x38f411-0x0;var _0x2a6132=_0x5f2f[_0x38f411];return _0x2a6132;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0xa'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var qs=require(_0xf5f2('0x12'));var logger=require('../../config/logger')(_0xf5f2('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xf5f2('0x14'))['db'];function respondWithStatusCode(_0x151aba,_0x4b78cd){_0x4b78cd=_0x4b78cd||0xcc;return function(_0x336f6b){if(_0x336f6b){return _0x151aba[_0xf5f2('0x15')](_0x4b78cd);}return _0x151aba[_0xf5f2('0x16')](_0x4b78cd)[_0xf5f2('0x17')]();};}function respondWithResult(_0x59bb6c,_0x3e5956){_0x3e5956=_0x3e5956||0xc8;return function(_0x5c01b8){if(_0x5c01b8){return _0x59bb6c[_0xf5f2('0x16')](_0x3e5956)[_0xf5f2('0x18')](_0x5c01b8);}};}function respondWithFilteredResult(_0x269909,_0x1c1a5c){return function(_0x422b55){if(_0x422b55){var _0x4d97fc=_0x422b55[_0xf5f2('0x19')],_0xafe430=_0x1c1a5c[_0xf5f2('0x1a')],_0x286197=_0x1c1a5c[_0xf5f2('0x1a')]+_0x1c1a5c[_0xf5f2('0x1b')],_0x17d656;if(_0x286197>=_0x4d97fc){_0x286197=_0x4d97fc;_0x17d656=0xc8;}else{_0x17d656=0xce;}_0x269909[_0xf5f2('0x16')](_0x17d656);return _0x269909[_0xf5f2('0x1c')](_0xf5f2('0x1d'),_0xafe430+'-'+_0x286197+'/'+_0x4d97fc)[_0xf5f2('0x18')](_0x422b55);}return null;};}function patchUpdates(_0x28e097){return function(_0x4ff59b){try{jsonpatch[_0xf5f2('0x1e')](_0x4ff59b,_0x28e097,!![]);}catch(_0x3cf5ea){return BPromise[_0xf5f2('0x1f')](_0x3cf5ea);}return _0x4ff59b[_0xf5f2('0x20')]();};}function saveUpdates(_0x56acc5,_0x34706d){return function(_0x47101e){if(_0x47101e){return _0x47101e['update'](_0x56acc5)['then'](function(_0x2d2805){return _0x2d2805;});}return null;};}function removeEntity(_0x388e6c,_0x4ae323){return function(_0x45b74f){if(_0x45b74f){return _0x45b74f[_0xf5f2('0x21')]()[_0xf5f2('0x22')](function(){_0x388e6c[_0xf5f2('0x16')](0xcc)[_0xf5f2('0x17')]();});}};}function handleEntityNotFound(_0x4c691a,_0x21cd91){return function(_0x4669a6){if(!_0x4669a6){_0x4c691a[_0xf5f2('0x15')](0x194);}return _0x4669a6;};}function handleError(_0x2833fe,_0x287ad5){_0x287ad5=_0x287ad5||0x1f4;return function(_0x5bdf4a){logger['error'](_0x5bdf4a[_0xf5f2('0x23')]);if(_0x5bdf4a[_0xf5f2('0x24')]){delete _0x5bdf4a[_0xf5f2('0x24')];}_0x2833fe[_0xf5f2('0x16')](_0x287ad5)[_0xf5f2('0x25')](_0x5bdf4a);};}exports[_0xf5f2('0x26')]=function(_0x13a3be,_0x281ec8){var _0x294414={},_0x4ab014={},_0xaa2602={'count':0x0,'rows':[]};var _0x102449=db[_0xf5f2('0x27')][_0xf5f2('0x28')];_0x4ab014[_0xf5f2('0x29')]=_[_0xf5f2('0x2a')](_0x102449);var _0x5b6672={'dateStart':_0x13a3be['query'][_0xf5f2('0x2b')],'dateEnd':_0x13a3be[_0xf5f2('0x2c')][_0xf5f2('0x2d')]};delete _0x13a3be['query']['dateStart'];delete _0x13a3be[_0xf5f2('0x2c')][_0xf5f2('0x2d')];_0x4ab014[_0xf5f2('0x2c')]=_[_0xf5f2('0x2a')](_0x13a3be[_0xf5f2('0x2c')]);_0x4ab014['filters']=_['intersection'](_0x4ab014[_0xf5f2('0x29')],_0x4ab014['query']);_0x294414[_0xf5f2('0x2e')]=_['intersection'](_0x4ab014[_0xf5f2('0x29')],qs[_0xf5f2('0x2f')](_0x13a3be[_0xf5f2('0x2c')][_0xf5f2('0x2f')]));_0x294414[_0xf5f2('0x2e')]=_0x294414[_0xf5f2('0x2e')][_0xf5f2('0x30')]?_0x294414[_0xf5f2('0x2e')]:_0x4ab014['model'];if(!_0x13a3be[_0xf5f2('0x2c')][_0xf5f2('0x31')](_0xf5f2('0x32'))){_0x294414[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x13a3be[_0xf5f2('0x2c')][_0xf5f2('0x1b')]);_0x294414['offset']=qs[_0xf5f2('0x1a')](_0x13a3be[_0xf5f2('0x2c')]['offset']);}_0x294414[_0xf5f2('0x33')]=qs['sort'](_0x13a3be[_0xf5f2('0x2c')][_0xf5f2('0x34')]);_0x294414[_0xf5f2('0x35')]=qs[_0xf5f2('0x36')](_['pick'](_0x13a3be['query'],_0x4ab014[_0xf5f2('0x36')]));if(_0x5b6672[_0xf5f2('0x2b')]){if(_0x5b6672[_0xf5f2('0x2d')]){_0x5b6672['dateEnd']=moment(_0x5b6672[_0xf5f2('0x2d')])['add'](0x1,_0xf5f2('0x37'));}else{_0x5b6672['dateEnd']=moment(_0x5b6672[_0xf5f2('0x2b')])[_0xf5f2('0x38')](0x1,'day');}_[_0xf5f2('0x39')](_0x294414[_0xf5f2('0x35')],{'createdAt':{'$gte':_0x5b6672[_0xf5f2('0x2b')],'$lte':_0x5b6672[_0xf5f2('0x2d')]}});}if(_0x13a3be['query']['filter']){_0x294414[_0xf5f2('0x35')]=_[_0xf5f2('0x39')](_0x294414[_0xf5f2('0x35')],{'$or':_[_0xf5f2('0x3a')](_0x294414[_0xf5f2('0x2e')],function(_0xe62b57){var _0x2bc20e={};_0x2bc20e[_0xe62b57]={'$like':'%'+_0x13a3be['query'][_0xf5f2('0x3b')]+'%'};return _0x2bc20e;})});}_0x294414=_[_0xf5f2('0x39')]({},_0x294414,_0x13a3be['options']);var _0xc6a1ae={'where':_0x294414[_0xf5f2('0x35')]};return db[_0xf5f2('0x27')][_0xf5f2('0x19')](_0xc6a1ae)[_0xf5f2('0x22')](function(_0x3b6372){_0xaa2602[_0xf5f2('0x19')]=_0x3b6372;if(_0x13a3be[_0xf5f2('0x2c')]['includeAll']){_0x294414[_0xf5f2('0x3c')]=[{'all':!![]}];}return db[_0xf5f2('0x27')][_0xf5f2('0x3d')](_0x294414);})['then'](function(_0x509dbc){_0xaa2602['rows']=_0x509dbc;return _0xaa2602;})[_0xf5f2('0x22')](respondWithFilteredResult(_0x281ec8,_0x294414))[_0xf5f2('0x3e')](handleError(_0x281ec8,null));};exports['show']=function(_0x106272,_0xeed03d){var _0x28e33f={'raw':!![],'where':{'id':_0x106272[_0xf5f2('0x3f')]['id']}},_0x31f86c={};_0x31f86c[_0xf5f2('0x29')]=_[_0xf5f2('0x2a')](db[_0xf5f2('0x27')][_0xf5f2('0x28')]);_0x31f86c[_0xf5f2('0x2c')]=_[_0xf5f2('0x2a')](_0x106272[_0xf5f2('0x2c')]);_0x31f86c[_0xf5f2('0x36')]=_[_0xf5f2('0x40')](_0x31f86c['model'],_0x31f86c[_0xf5f2('0x2c')]);_0x28e33f['attributes']=_[_0xf5f2('0x40')](_0x31f86c[_0xf5f2('0x29')],qs[_0xf5f2('0x2f')](_0x106272[_0xf5f2('0x2c')][_0xf5f2('0x2f')]));_0x28e33f[_0xf5f2('0x2e')]=_0x28e33f['attributes'][_0xf5f2('0x30')]?_0x28e33f[_0xf5f2('0x2e')]:_0x31f86c[_0xf5f2('0x29')];if(_0x106272[_0xf5f2('0x2c')][_0xf5f2('0x41')]){_0x28e33f[_0xf5f2('0x3c')]=[{'all':!![]}];}_0x28e33f=_[_0xf5f2('0x39')]({},_0x28e33f,_0x106272[_0xf5f2('0x42')]);return db['SmsTransferReport'][_0xf5f2('0x43')](_0x28e33f)[_0xf5f2('0x22')](handleEntityNotFound(_0xeed03d,null))[_0xf5f2('0x22')](respondWithResult(_0xeed03d,null))['catch'](handleError(_0xeed03d,null));};exports[_0xf5f2('0x44')]=function(_0xc91b64,_0x3179a9){return db['SmsTransferReport']['create'](_0xc91b64[_0xf5f2('0x45')],{})[_0xf5f2('0x22')](respondWithResult(_0x3179a9,0xc9))['catch'](handleError(_0x3179a9,null));};exports[_0xf5f2('0x46')]=function(_0x533cca,_0x740321){if(_0x533cca['body']['id']){delete _0x533cca[_0xf5f2('0x45')]['id'];}return db['SmsTransferReport'][_0xf5f2('0x43')]({'where':{'id':_0x533cca[_0xf5f2('0x3f')]['id']}})[_0xf5f2('0x22')](handleEntityNotFound(_0x740321,null))[_0xf5f2('0x22')](saveUpdates(_0x533cca['body'],null))[_0xf5f2('0x22')](respondWithResult(_0x740321,null))[_0xf5f2('0x3e')](handleError(_0x740321,null));};exports['destroy']=function(_0x58213b,_0xc3d4f){return db[_0xf5f2('0x27')]['find']({'where':{'id':_0x58213b[_0xf5f2('0x3f')]['id']}})[_0xf5f2('0x22')](handleEntityNotFound(_0xc3d4f,null))[_0xf5f2('0x22')](removeEntity(_0xc3d4f,null))[_0xf5f2('0x3e')](handleError(_0xc3d4f,null));};exports['describe']=function(_0x4e7f1d,_0x12550f){return db[_0xf5f2('0x27')]['describe']()[_0xf5f2('0x22')](respondWithResult(_0x12550f,null))[_0xf5f2('0x3e')](handleError(_0x12550f,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 446610b..dc397c8 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 _0x98a8=['define','SmsTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x98a8,0x12c));var _0x898a=function(_0x5965cb,_0x157f26){_0x5965cb=_0x5965cb-0x0;var _0x58b485=_0x98a8[_0x5965cb];return _0x58b485;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var logger=require(_0x898a('0x2'))(_0x898a('0x3'));var moment=require(_0x898a('0x4'));var BPromise=require(_0x898a('0x5'));var rp=require(_0x898a('0x6'));var attributes=require('./smsTransferReport.attributes');module[_0x898a('0x7')]=function(_0xf84a19,_0x1b3dd0){return _0xf84a19[_0x898a('0x8')](_0x898a('0x9'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x898a('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe5b3=['../../config/logger','api','moment','bluebird','request-promise','./smsTransferReport.attributes','exports','define','report_sms_transfer','uniqueid','util'];(function(_0x4a0128,_0x3e31b2){var _0x18d6f6=function(_0x2a1748){while(--_0x2a1748){_0x4a0128['push'](_0x4a0128['shift']());}};_0x18d6f6(++_0x3e31b2);}(_0xe5b3,0x133));var _0x3e5b=function(_0x427b47,_0x23c1c2){_0x427b47=_0x427b47-0x0;var _0x37131b=_0xe5b3[_0x427b47];return _0x37131b;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var logger=require(_0x3e5b('0x1'))(_0x3e5b('0x2'));var moment=require(_0x3e5b('0x3'));var BPromise=require(_0x3e5b('0x4'));var rp=require(_0x3e5b('0x5'));var attributes=require(_0x3e5b('0x6'));module[_0x3e5b('0x7')]=function(_0x320b1e,_0x4195cb){return _0x320b1e[_0x3e5b('0x8')]('SmsTransferReport',attributes,{'tableName':_0x3e5b('0x9'),'paranoid':![],'indexes':[{'name':_0x3e5b('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index f6b43f7..c27dfff 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 _0x48ac=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','bluebird','randomstring','ioredis'];(function(_0xe7f038,_0x4e6bac){var _0x24a2e6=function(_0x57e628){while(--_0x57e628){_0xe7f038['push'](_0xe7f038['shift']());}};_0x24a2e6(++_0x4e6bac);}(_0x48ac,0xe0));var _0xc48a=function(_0x56a578,_0x1b0321){_0x56a578=_0x56a578-0x0;var _0x48d7fe=_0x48ac[_0x56a578];return _0x48d7fe;};'use strict';var _=require('lodash');var util=require(_0xc48a('0x0'));var moment=require('moment');var BPromise=require(_0xc48a('0x1'));var rs=require(_0xc48a('0x2'));var fs=require('fs');var Redis=require(_0xc48a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc48a('0x4'));var logger=require(_0xc48a('0x5'))(_0xc48a('0x6'));var config=require(_0xc48a('0x7'));var jayson=require(_0xc48a('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5df462,_0x5cffd4,_0x1e1e1a){return new BPromise(function(_0xf0c31b,_0x2c3285){return client['request'](_0x5df462,_0x1e1e1a)[_0xc48a('0x9')](function(_0x43461a){logger[_0xc48a('0xa')](_0xc48a('0xb'),_0x5cffd4,_0xc48a('0xc'));logger[_0xc48a('0xd')](_0xc48a('0xe'),_0x5cffd4,_0xc48a('0xc'),JSON[_0xc48a('0xf')](_0x43461a));if(_0x43461a[_0xc48a('0x10')]){if(_0x43461a[_0xc48a('0x10')]['code']===0x1f4){logger[_0xc48a('0x10')](_0xc48a('0xb'),_0x5cffd4,_0x43461a[_0xc48a('0x10')]['message']);return _0x2c3285(_0x43461a[_0xc48a('0x10')][_0xc48a('0x11')]);}logger['error'](_0xc48a('0xb'),_0x5cffd4,_0x43461a[_0xc48a('0x10')][_0xc48a('0x11')]);return _0xf0c31b(_0x43461a['error'][_0xc48a('0x11')]);}else{logger[_0xc48a('0xa')](_0xc48a('0xb'),_0x5cffd4,'request\x20sent');_0xf0c31b(_0x43461a[_0xc48a('0x12')][_0xc48a('0x11')]);}})['catch'](function(_0x5c319b){logger[_0xc48a('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x5cffd4,_0x5c319b);_0x2c3285(_0x5c319b);});});} \ No newline at end of file +var _0xb422=['../../config/environment','client','http','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','bluebird','../../mysqldb','../../config/logger'];(function(_0x3cf101,_0x19e1e5){var _0x42e8df=function(_0x46118c){while(--_0x46118c){_0x3cf101['push'](_0x3cf101['shift']());}};_0x42e8df(++_0x19e1e5);}(_0xb422,0x85));var _0x2b42=function(_0x5e32f3,_0x3386c1){_0x5e32f3=_0x5e32f3-0x0;var _0x4d4e03=_0xb422[_0x5e32f3];return _0x4d4e03;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2b42('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2b42('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x2b42('0x2'))('rpc');var config=require(_0x2b42('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x2b42('0x4')][_0x2b42('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x750c2,_0x51b3bd,_0xde9c67){return new BPromise(function(_0x1b64f7,_0x12b303){return client['request'](_0x750c2,_0xde9c67)['then'](function(_0x4174e8){logger['info'](_0x2b42('0x6'),_0x51b3bd,_0x2b42('0x7'));logger[_0x2b42('0x8')](_0x2b42('0x9'),_0x51b3bd,'request\x20sent',JSON[_0x2b42('0xa')](_0x4174e8));if(_0x4174e8[_0x2b42('0xb')]){if(_0x4174e8['error'][_0x2b42('0xc')]===0x1f4){logger[_0x2b42('0xb')](_0x2b42('0x6'),_0x51b3bd,_0x4174e8[_0x2b42('0xb')]['message']);return _0x12b303(_0x4174e8['error'][_0x2b42('0xd')]);}logger[_0x2b42('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x51b3bd,_0x4174e8[_0x2b42('0xb')][_0x2b42('0xd')]);return _0x1b64f7(_0x4174e8[_0x2b42('0xb')][_0x2b42('0xd')]);}else{logger[_0x2b42('0xe')](_0x2b42('0x6'),_0x51b3bd,_0x2b42('0x7'));_0x1b64f7(_0x4174e8[_0x2b42('0xf')][_0x2b42('0xd')]);}})[_0x2b42('0x10')](function(_0x4897d8){logger[_0x2b42('0xb')](_0x2b42('0x6'),_0x51b3bd,_0x4897d8);_0x12b303(_0x4897d8);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index fea4bae..2a5442f 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 _0xd55a=['isAuthenticated','/:id','show','get','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','basename','now','extname','post','single','file','create','put','delete','exports','multer','connect-timeout','Router','../../config/environment','./sound.controller'];(function(_0x3a96d1,_0x5c7932){var _0x177ecd=function(_0x22d38d){while(--_0x22d38d){_0x3a96d1['push'](_0x3a96d1['shift']());}};_0x177ecd(++_0x5c7932);}(_0xd55a,0x87));var _0xad55=function(_0xffba63,_0x3ead76){_0xffba63=_0xffba63-0x0;var _0x2124a8=_0xd55a[_0xffba63];return _0x2124a8;};'use strict';var multer=require(_0xad55('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xad55('0x1'));var express=require('express');var router=express[_0xad55('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xad55('0x3'));var controller=require(_0xad55('0x4'));router['get']('/',auth[_0xad55('0x5')](),controller['index']);router['get'](_0xad55('0x6'),auth[_0xad55('0x5')](),controller[_0xad55('0x7')]);router[_0xad55('0x8')](_0xad55('0x9'),auth[_0xad55('0x5')](),controller[_0xad55('0xa')]);var upload=multer({'storage':multer[_0xad55('0xb')]({'destination':function(_0x4f9da7,_0x166b11,_0x25aceb){_0x25aceb(null,path[_0xad55('0xc')](config[_0xad55('0xd')],_0xad55('0xe')));},'filename':function(_0x1002f7,_0x325220,_0x42da7d){_0x325220[_0xad55('0xf')]=_0x325220[_0xad55('0xf')][_0xad55('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x42da7d(null,util[_0xad55('0x11')]('%s-%s%s',path[_0xad55('0x12')](_0x325220[_0xad55('0xf')],path['extname'](_0x325220[_0xad55('0xf')])),Date[_0xad55('0x13')](),path[_0xad55('0x14')](_0x325220[_0xad55('0xf')])));}})});router[_0xad55('0x15')]('/',upload[_0xad55('0x16')](_0xad55('0x17')),controller[_0xad55('0x18')]);router[_0xad55('0x19')]('/:id',auth[_0xad55('0x5')](),controller['update']);router[_0xad55('0x1a')]('/:id',auth['isAuthenticated'](),controller['delete']);module[_0xad55('0x1b')]=router; \ No newline at end of file +var _0xeebf=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','index','get','/:id','show','/:id/download','isAuthenticated','download','diskStorage','server/files/sounds/original/','originalname','replace','format','basename','extname','now','post','single','create','put','update'];(function(_0x11b4c8,_0x3b68a5){var _0x136bf8=function(_0x482fb9){while(--_0x482fb9){_0x11b4c8['push'](_0x11b4c8['shift']());}};_0x136bf8(++_0x3b68a5);}(_0xeebf,0xd4));var _0xfeeb=function(_0x594ae6,_0x39a7c7){_0x594ae6=_0x594ae6-0x0;var _0x36d241=_0xeebf[_0x594ae6];return _0x36d241;};'use strict';var multer=require(_0xfeeb('0x0'));var util=require(_0xfeeb('0x1'));var path=require(_0xfeeb('0x2'));var timeout=require(_0xfeeb('0x3'));var express=require(_0xfeeb('0x4'));var router=express[_0xfeeb('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xfeeb('0x6'));var config=require(_0xfeeb('0x7'));var controller=require('./sound.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xfeeb('0x8')]);router[_0xfeeb('0x9')](_0xfeeb('0xa'),auth['isAuthenticated'](),controller[_0xfeeb('0xb')]);router[_0xfeeb('0x9')](_0xfeeb('0xc'),auth[_0xfeeb('0xd')](),controller[_0xfeeb('0xe')]);var upload=multer({'storage':multer[_0xfeeb('0xf')]({'destination':function(_0x536b4a,_0x46ee98,_0x12ce26){_0x12ce26(null,path['join'](config['root'],_0xfeeb('0x10')));},'filename':function(_0x1c1e9b,_0x385324,_0x477574){_0x385324['originalname']=_0x385324[_0xfeeb('0x11')][_0xfeeb('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x477574(null,util[_0xfeeb('0x13')]('%s-%s%s',path[_0xfeeb('0x14')](_0x385324[_0xfeeb('0x11')],path[_0xfeeb('0x15')](_0x385324[_0xfeeb('0x11')])),Date[_0xfeeb('0x16')](),path[_0xfeeb('0x15')](_0x385324[_0xfeeb('0x11')])));}})});router[_0xfeeb('0x17')]('/',upload[_0xfeeb('0x18')]('file'),controller[_0xfeeb('0x19')]);router[_0xfeeb('0x1a')]('/:id',auth[_0xfeeb('0xd')](),controller[_0xfeeb('0x1b')]);router[_0xfeeb('0x1c')](_0xfeeb('0xa'),auth['isAuthenticated'](),controller[_0xfeeb('0x1c')]);module[_0xfeeb('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 8322d35..3d00b31 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 _0xfc5e=['exports','STRING','name','INTEGER','FLOAT','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfc5e,0x197));var _0xefc5=function(_0x453c6a,_0x15bfa0){_0x453c6a=_0x453c6a-0x0;var _0x4747db=_0xfc5e[_0x453c6a];return _0x4747db;};'use strict';var Sequelize=require(_0xefc5('0x0'));module[_0xefc5('0x1')]={'name':{'type':Sequelize[_0xefc5('0x2')],'unique':_0xefc5('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0xefc5('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xefc5('0x2')]},'original_format':{'type':Sequelize[_0xefc5('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xefc5('0x4')]},'converted_format':{'type':Sequelize[_0xefc5('0x2')]},'converted_duration':{'type':Sequelize[_0xefc5('0x5')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xefc5('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xefc5('0x4')]}}; \ No newline at end of file +var _0x1c85=['BIGINT','INTEGER','FLOAT','sequelize','exports','name','STRING'];(function(_0x3a7f80,_0x59862a){var _0x3f9eb2=function(_0x25dac4){while(--_0x25dac4){_0x3a7f80['push'](_0x3a7f80['shift']());}};_0x3f9eb2(++_0x59862a);}(_0x1c85,0x153));var _0x51c8=function(_0x4ce140,_0x5e8c50){_0x4ce140=_0x4ce140-0x0;var _0x1f2d2a=_0x1c85[_0x4ce140];return _0x1f2d2a;};'use strict';var Sequelize=require(_0x51c8('0x0'));module[_0x51c8('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x51c8('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x51c8('0x3')]},'display_name':{'type':Sequelize[_0x51c8('0x3')],'defaultValue':''},'description':{'type':Sequelize[_0x51c8('0x3')]},'original_format':{'type':Sequelize[_0x51c8('0x3')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x51c8('0x4')]},'original_channelCount':{'type':Sequelize[_0x51c8('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x51c8('0x5')]},'converted_format':{'type':Sequelize[_0x51c8('0x3')]},'converted_duration':{'type':Sequelize[_0x51c8('0x6')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x51c8('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x51c8('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 7e882b3..710bbde 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 _0xeffd=['path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','set','reject','save','update','then','error','stack','name','send','index','model','keys','query','dateStart','dateEnd','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','add','day','merge','filter','map','options','Sound','findAll','rows','catch','params','length','includeAll','find','download','save_name','converted_format','existsSync','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','join','%s.%s','format','create','basename','file','originalname','filename','extname','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','transcode','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','chmodSync','start','pick','body','delete','destroy','original_format','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xeffd,0x6b));var _0xdeff=function(_0x430131,_0x11d01b){_0x430131=_0x430131-0x0;var _0x275f89=_0xeffd[_0x430131];return _0x275f89;};'use strict';var pdf=require(_0xdeff('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdeff('0x1'));var zipdir=require(_0xdeff('0x2'));var jsonpatch=require(_0xdeff('0x3'));var rp=require(_0xdeff('0x4'));var moment=require(_0xdeff('0x5'));var BPromise=require(_0xdeff('0x6'));var Mustache=require(_0xdeff('0x7'));var util=require(_0xdeff('0x8'));var path=require(_0xdeff('0x9'));var sox=require(_0xdeff('0xa'));var csv=require(_0xdeff('0xb'));var ejs=require(_0xdeff('0xc'));var fs=require('fs');var _=require(_0xdeff('0xd'));var squel=require(_0xdeff('0xe'));var crypto=require(_0xdeff('0xf'));var jsforce=require(_0xdeff('0x10'));var deskjs=require(_0xdeff('0x11'));var toCsv=require('to-csv');var querystring=require(_0xdeff('0x12'));var Papa=require(_0xdeff('0x13'));var Redis=require(_0xdeff('0x14'));var qs=require('../../components/parsers/qs');var logger=require(_0xdeff('0x15'))(_0xdeff('0x16'));var utils=require(_0xdeff('0x17'));var config=require(_0xdeff('0x18'));var db=require(_0xdeff('0x19'))['db'];function respondWithStatusCode(_0x256b73,_0x2e9783){_0x2e9783=_0x2e9783||0xcc;return function(_0x402075){if(_0x402075){return _0x256b73['sendStatus'](_0x2e9783);}return _0x256b73[_0xdeff('0x1a')](_0x2e9783)[_0xdeff('0x1b')]();};}function respondWithResult(_0x4952f2,_0x2e614c){_0x2e614c=_0x2e614c||0xc8;return function(_0x4e7526){if(_0x4e7526){return _0x4952f2['status'](_0x2e614c)[_0xdeff('0x1c')](_0x4e7526);}};}function respondWithFilteredResult(_0x47410f,_0x1585e8){return function(_0xb4bc82){if(_0xb4bc82){var _0x48f0e8=_0xb4bc82[_0xdeff('0x1d')],_0x826132=_0x1585e8[_0xdeff('0x1e')],_0x314ded=_0x1585e8[_0xdeff('0x1e')]+_0x1585e8['limit'],_0xea6c4;if(_0x314ded>=_0x48f0e8){_0x314ded=_0x48f0e8;_0xea6c4=0xc8;}else{_0xea6c4=0xce;}_0x47410f['status'](_0xea6c4);return _0x47410f[_0xdeff('0x1f')]('Content-Range',_0x826132+'-'+_0x314ded+'/'+_0x48f0e8)['json'](_0xb4bc82);}return null;};}function patchUpdates(_0x35635f){return function(_0x369e13){try{jsonpatch['apply'](_0x369e13,_0x35635f,!![]);}catch(_0x2de203){return BPromise[_0xdeff('0x20')](_0x2de203);}return _0x369e13[_0xdeff('0x21')]();};}function saveUpdates(_0x3a677a,_0x18f2e2){return function(_0x299cc5){if(_0x299cc5){return _0x299cc5[_0xdeff('0x22')](_0x3a677a)[_0xdeff('0x23')](function(_0x488faa){return _0x488faa;});}return null;};}function removeEntity(_0x5591fa,_0x56cb84){return function(_0x2f3fd6){if(_0x2f3fd6){return _0x2f3fd6['destroy']()[_0xdeff('0x23')](function(){_0x5591fa[_0xdeff('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18338c,_0x21981e){return function(_0x4eb2a8){if(!_0x4eb2a8){_0x18338c['sendStatus'](0x194);}return _0x4eb2a8;};}function handleError(_0x3b2554,_0x15c425){_0x15c425=_0x15c425||0x1f4;return function(_0x253eed){logger[_0xdeff('0x24')](_0x253eed[_0xdeff('0x25')]);if(_0x253eed['name']){delete _0x253eed[_0xdeff('0x26')];}_0x3b2554[_0xdeff('0x1a')](_0x15c425)[_0xdeff('0x27')](_0x253eed);};}exports[_0xdeff('0x28')]=function(_0x16974b,_0x35823c){var _0x3d0111={},_0x52ea5d={},_0x31bb72={'count':0x0,'rows':[]};var _0x1a546c=db['Sound']['rawAttributes'];_0x52ea5d[_0xdeff('0x29')]=_[_0xdeff('0x2a')](_0x1a546c);var _0x16b2d0={'dateStart':_0x16974b[_0xdeff('0x2b')][_0xdeff('0x2c')],'dateEnd':_0x16974b[_0xdeff('0x2b')][_0xdeff('0x2d')]};delete _0x16974b['query'][_0xdeff('0x2c')];delete _0x16974b[_0xdeff('0x2b')][_0xdeff('0x2d')];_0x52ea5d['query']=_['keys'](_0x16974b[_0xdeff('0x2b')]);_0x52ea5d['filters']=_[_0xdeff('0x2e')](_0x52ea5d[_0xdeff('0x29')],_0x52ea5d[_0xdeff('0x2b')]);_0x3d0111['attributes']=_[_0xdeff('0x2e')](_0x52ea5d['model'],qs['fields'](_0x16974b[_0xdeff('0x2b')][_0xdeff('0x2f')]));_0x3d0111[_0xdeff('0x30')]=_0x3d0111[_0xdeff('0x30')]['length']?_0x3d0111[_0xdeff('0x30')]:_0x52ea5d[_0xdeff('0x29')];if(!_0x16974b[_0xdeff('0x2b')][_0xdeff('0x31')](_0xdeff('0x32'))){_0x3d0111[_0xdeff('0x33')]=qs[_0xdeff('0x33')](_0x16974b['query'][_0xdeff('0x33')]);_0x3d0111['offset']=qs[_0xdeff('0x1e')](_0x16974b[_0xdeff('0x2b')][_0xdeff('0x1e')]);}_0x3d0111[_0xdeff('0x34')]=qs[_0xdeff('0x35')](_0x16974b[_0xdeff('0x2b')]['sort']);_0x3d0111[_0xdeff('0x36')]=qs[_0xdeff('0x37')](_['pick'](_0x16974b[_0xdeff('0x2b')],_0x52ea5d[_0xdeff('0x37')]));if(_0x16b2d0[_0xdeff('0x2c')]){if(_0x16b2d0[_0xdeff('0x2d')]){_0x16b2d0[_0xdeff('0x2d')]=moment(_0x16b2d0[_0xdeff('0x2d')])[_0xdeff('0x38')](0x1,_0xdeff('0x39'));}else{_0x16b2d0['dateEnd']=moment(_0x16b2d0[_0xdeff('0x2c')])['add'](0x1,_0xdeff('0x39'));}_[_0xdeff('0x3a')](_0x3d0111[_0xdeff('0x36')],{'createdAt':{'$gte':_0x16b2d0['dateStart'],'$lte':_0x16b2d0[_0xdeff('0x2d')]}});}if(_0x16974b[_0xdeff('0x2b')][_0xdeff('0x3b')]){_0x3d0111[_0xdeff('0x36')]=_[_0xdeff('0x3a')](_0x3d0111['where'],{'$or':_[_0xdeff('0x3c')](_0x3d0111['attributes'],function(_0x393d75){var _0x14f1d0={};_0x14f1d0[_0x393d75]={'$like':'%'+_0x16974b['query'][_0xdeff('0x3b')]+'%'};return _0x14f1d0;})});}_0x3d0111=_[_0xdeff('0x3a')]({},_0x3d0111,_0x16974b[_0xdeff('0x3d')]);var _0x2e9dcd={'where':_0x3d0111[_0xdeff('0x36')]};return db['Sound'][_0xdeff('0x1d')](_0x2e9dcd)[_0xdeff('0x23')](function(_0x3ccb3a){_0x31bb72[_0xdeff('0x1d')]=_0x3ccb3a;if(_0x16974b[_0xdeff('0x2b')]['includeAll']){_0x3d0111['include']=[{'all':!![]}];}return db[_0xdeff('0x3e')][_0xdeff('0x3f')](_0x3d0111);})[_0xdeff('0x23')](function(_0x318e77){_0x31bb72[_0xdeff('0x40')]=_0x318e77;return _0x31bb72;})[_0xdeff('0x23')](respondWithFilteredResult(_0x35823c,_0x3d0111))[_0xdeff('0x41')](handleError(_0x35823c,null));};exports['show']=function(_0x336762,_0x11be83){var _0x3c6c89={'raw':!![],'where':{'id':_0x336762[_0xdeff('0x42')]['id']}},_0x54fa5b={};_0x54fa5b[_0xdeff('0x29')]=_[_0xdeff('0x2a')](db[_0xdeff('0x3e')]['rawAttributes']);_0x54fa5b[_0xdeff('0x2b')]=_[_0xdeff('0x2a')](_0x336762[_0xdeff('0x2b')]);_0x54fa5b[_0xdeff('0x37')]=_[_0xdeff('0x2e')](_0x54fa5b[_0xdeff('0x29')],_0x54fa5b[_0xdeff('0x2b')]);_0x3c6c89[_0xdeff('0x30')]=_['intersection'](_0x54fa5b[_0xdeff('0x29')],qs[_0xdeff('0x2f')](_0x336762[_0xdeff('0x2b')][_0xdeff('0x2f')]));_0x3c6c89[_0xdeff('0x30')]=_0x3c6c89['attributes'][_0xdeff('0x43')]?_0x3c6c89[_0xdeff('0x30')]:_0x54fa5b[_0xdeff('0x29')];if(_0x336762[_0xdeff('0x2b')][_0xdeff('0x44')]){_0x3c6c89['include']=[{'all':!![]}];}_0x3c6c89=_[_0xdeff('0x3a')]({},_0x3c6c89,_0x336762['options']);return db[_0xdeff('0x3e')][_0xdeff('0x45')](_0x3c6c89)[_0xdeff('0x23')](handleEntityNotFound(_0x11be83,null))[_0xdeff('0x23')](respondWithResult(_0x11be83,null))[_0xdeff('0x41')](handleError(_0x11be83,null));};exports[_0xdeff('0x46')]=function(_0x591203,_0x49bc0b,_0x71b5a5){return db[_0xdeff('0x3e')][_0xdeff('0x45')]({'where':{'id':_0x591203['params']['id']},'attributes':['name',_0xdeff('0x47'),_0xdeff('0x48')],'raw':!![]})['then'](handleEntityNotFound(_0x49bc0b,null))[_0xdeff('0x23')](function(_0x219e3){if(_0x219e3){if(!fs[_0xdeff('0x49')](path['join'](config[_0xdeff('0x4a')],_0xdeff('0x4b'),_0x219e3[_0xdeff('0x47')]+'.'+_0x219e3['converted_format']))){throw new db[(_0xdeff('0x4c'))][(_0xdeff('0x4d'))](_0xdeff('0x4e'));}return _0x49bc0b[_0xdeff('0x46')](path[_0xdeff('0x4f')](config[_0xdeff('0x4a')],_0xdeff('0x4b'),util['format'](_0xdeff('0x50'),_0x219e3[_0xdeff('0x47')],_0x219e3['converted_format'])),util[_0xdeff('0x51')](_0xdeff('0x50'),_0x219e3[_0xdeff('0x26')],_0x219e3[_0xdeff('0x48')]));}return null;})[_0xdeff('0x41')](handleError(_0x49bc0b,null));};exports[_0xdeff('0x52')]=function(_0x473d9d,_0x2d6110,_0x5ca032){var _0x1b7eb3={'name':path[_0xdeff('0x53')](_0x473d9d[_0xdeff('0x54')]['originalname'],path['extname'](_0x473d9d[_0xdeff('0x54')][_0xdeff('0x55')])),'save_name':path[_0xdeff('0x53')](_0x473d9d[_0xdeff('0x54')][_0xdeff('0x56')],path[_0xdeff('0x57')](_0x473d9d['file']['filename'])),'original_format':path[_0xdeff('0x57')](_0x473d9d[_0xdeff('0x54')]['originalname'])['substring'](0x1),'converted_format':_0xdeff('0x58')};var _0x407001=path['join'](config[_0xdeff('0x4a')],_0xdeff('0x59'),_0x473d9d['file'][_0xdeff('0x56')]);var _0xe731d8=path['join'](config[_0xdeff('0x4a')],_0xdeff('0x4b'),util['format'](_0xdeff('0x50'),path[_0xdeff('0x53')](_0x473d9d[_0xdeff('0x54')]['filename'],path['extname'](_0x473d9d[_0xdeff('0x54')]['filename'])),_0x1b7eb3[_0xdeff('0x48')]));logger[_0xdeff('0x5a')](_0xdeff('0x5b'),_0x407001);logger[_0xdeff('0x5a')](_0xdeff('0x5c'),_0xe731d8);try{fs['chmodSync'](_0x407001,parseInt('0777',0x8));var _0x98d18c=sox[_0xdeff('0x5d')](_0x407001,_0xe731d8,{'sampleRate':0x1f40,'format':_0xdeff('0x58'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x98d18c['on'](_0xdeff('0x24'),function(_0x106976){fs[_0xdeff('0x5e')](_0x407001);_0x2d6110['status'](0x1f4)[_0xdeff('0x27')](_0x106976);});_0x98d18c['on']('src',function(_0x10253e){_0x1b7eb3[_0xdeff('0x5f')]=isNaN(_0x10253e[_0xdeff('0x60')])?null:_0x10253e[_0xdeff('0x60')]*0x3e8;_0x1b7eb3[_0xdeff('0x61')]=isNaN(_0x10253e[_0xdeff('0x62')])?null:_0x10253e[_0xdeff('0x62')];_0x1b7eb3[_0xdeff('0x63')]=isNaN(_0x10253e[_0xdeff('0x64')])?null:_0x10253e['channelCount'];_0x1b7eb3[_0xdeff('0x65')]=isNaN(_0x10253e['bitRate'])?null:_0x10253e[_0xdeff('0x66')];_0x1b7eb3[_0xdeff('0x67')]=isNaN(_0x10253e['sampleRate'])?null:_0x10253e[_0xdeff('0x68')];});_0x98d18c['on']('dest',function(_0x2148fa){_0x1b7eb3['converted_duration']=isNaN(_0x2148fa['duration'])?null:_0x2148fa[_0xdeff('0x60')]*0x3e8;_0x1b7eb3[_0xdeff('0x69')]=isNaN(_0x2148fa['sampleCount'])?null:_0x2148fa[_0xdeff('0x62')];_0x1b7eb3[_0xdeff('0x6a')]=isNaN(_0x2148fa[_0xdeff('0x64')])?null:_0x2148fa[_0xdeff('0x64')];_0x1b7eb3[_0xdeff('0x6b')]=isNaN(_0x2148fa[_0xdeff('0x66')])?null:_0x2148fa[_0xdeff('0x66')];_0x1b7eb3[_0xdeff('0x6c')]=isNaN(_0x2148fa[_0xdeff('0x68')])?null:_0x2148fa['sampleRate'];});_0x98d18c['on'](_0xdeff('0x1b'),function(){fs[_0xdeff('0x6d')](_0xe731d8,parseInt('0777',0x8));return db['Sound'][_0xdeff('0x52')](_0x1b7eb3)[_0xdeff('0x23')](respondWithResult(_0x2d6110,null))['catch'](handleError(_0x2d6110,null));});_0x98d18c[_0xdeff('0x6e')]();}catch(_0x3b820c){_0x2d6110[_0xdeff('0x1a')](0x1f4)[_0xdeff('0x27')](_0x3b820c);}};exports[_0xdeff('0x22')]=function(_0x41dc90,_0xa5f4a0,_0x8042f8){return db[_0xdeff('0x3e')][_0xdeff('0x45')]({'where':{'id':_0x41dc90['params']['id']}})[_0xdeff('0x23')](handleEntityNotFound(_0xa5f4a0,null))[_0xdeff('0x23')](saveUpdates(_[_0xdeff('0x6f')](_0x41dc90[_0xdeff('0x70')],[_0xdeff('0x26'),'description']),null))['then'](respondWithResult(_0xa5f4a0,null))['catch'](handleError(_0xa5f4a0,null));};exports[_0xdeff('0x71')]=function(_0x22941f,_0x2e801b,_0x5e85dc){return db['Sound']['find']({'where':{'id':_0x22941f[_0xdeff('0x42')]['id']}})[_0xdeff('0x23')](function(_0x46e1d5){if(_0x46e1d5){return _0x46e1d5[_0xdeff('0x72')]();}})[_0xdeff('0x23')](function(_0x19ab0f){var _0x1eb1a3=path[_0xdeff('0x4f')](config['root'],_0xdeff('0x59'),util[_0xdeff('0x51')](_0xdeff('0x50'),_0x19ab0f[_0xdeff('0x47')],_0x19ab0f[_0xdeff('0x73')]));var _0x327c18=path[_0xdeff('0x4f')](config[_0xdeff('0x4a')],_0xdeff('0x4b'),util[_0xdeff('0x51')](_0xdeff('0x50'),_0x19ab0f[_0xdeff('0x47')],_0x19ab0f['converted_format']));fs[_0xdeff('0x5e')](_0x1eb1a3);fs[_0xdeff('0x5e')](_0x327c18);return _0x19ab0f;})[_0xdeff('0x23')](function(_0x54adce){if(_0x54adce){return _0x2e801b[_0xdeff('0x1a')](0xcc)[_0xdeff('0x1b')]();}})[_0xdeff('0x23')](handleEntityNotFound(_0x2e801b,null))[_0xdeff('0x41')](handleError(_0x2e801b,null));}; \ No newline at end of file +var _0x2c54=['stack','name','index','Sound','model','query','dateStart','intersection','fields','length','attributes','hasOwnProperty','offset','sort','where','filters','pick','dateEnd','day','merge','filter','options','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','download','params','save_name','converted_format','existsSync','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','join','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','format','Sound\x20upload\x20filepath:\x20%s','chmodSync','error','send','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_sampleRate','0777','start','body','description','original_format','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x2a8e7d,_0x24ed67){var _0x24037b=function(_0x35b4ed){while(--_0x35b4ed){_0x2a8e7d['push'](_0x2a8e7d['shift']());}};_0x24037b(++_0x24ed67);}(_0x2c54,0x136));var _0x42c5=function(_0x3a2d75,_0x3fc383){_0x3a2d75=_0x3a2d75-0x0;var _0x1dcb6b=_0x2c54[_0x3a2d75];return _0x1dcb6b;};'use strict';var pdf=require(_0x42c5('0x0'));var emlformat=require(_0x42c5('0x1'));var rimraf=require(_0x42c5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x42c5('0x3'));var rp=require(_0x42c5('0x4'));var moment=require(_0x42c5('0x5'));var BPromise=require(_0x42c5('0x6'));var Mustache=require(_0x42c5('0x7'));var util=require(_0x42c5('0x8'));var path=require('path');var sox=require(_0x42c5('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x42c5('0xa'));var squel=require(_0x42c5('0xb'));var crypto=require(_0x42c5('0xc'));var jsforce=require(_0x42c5('0xd'));var deskjs=require(_0x42c5('0xe'));var toCsv=require(_0x42c5('0xf'));var querystring=require(_0x42c5('0x10'));var Papa=require(_0x42c5('0x11'));var Redis=require(_0x42c5('0x12'));var qs=require(_0x42c5('0x13'));var logger=require(_0x42c5('0x14'))(_0x42c5('0x15'));var utils=require(_0x42c5('0x16'));var config=require(_0x42c5('0x17'));var db=require(_0x42c5('0x18'))['db'];function respondWithStatusCode(_0x1edc64,_0x741cb4){_0x741cb4=_0x741cb4||0xcc;return function(_0x3a4e16){if(_0x3a4e16){return _0x1edc64[_0x42c5('0x19')](_0x741cb4);}return _0x1edc64[_0x42c5('0x1a')](_0x741cb4)[_0x42c5('0x1b')]();};}function respondWithResult(_0x391716,_0x576129){_0x576129=_0x576129||0xc8;return function(_0x5d02a3){if(_0x5d02a3){return _0x391716[_0x42c5('0x1a')](_0x576129)[_0x42c5('0x1c')](_0x5d02a3);}};}function respondWithFilteredResult(_0x337f2d,_0x1056de){return function(_0x47affc){if(_0x47affc){var _0x374218=_0x47affc[_0x42c5('0x1d')],_0x22d052=_0x1056de['offset'],_0x5c9ac2=_0x1056de['offset']+_0x1056de[_0x42c5('0x1e')],_0x4efb1a;if(_0x5c9ac2>=_0x374218){_0x5c9ac2=_0x374218;_0x4efb1a=0xc8;}else{_0x4efb1a=0xce;}_0x337f2d['status'](_0x4efb1a);return _0x337f2d['set'](_0x42c5('0x1f'),_0x22d052+'-'+_0x5c9ac2+'/'+_0x374218)[_0x42c5('0x1c')](_0x47affc);}return null;};}function patchUpdates(_0x10e31e){return function(_0x3f4172){try{jsonpatch[_0x42c5('0x20')](_0x3f4172,_0x10e31e,!![]);}catch(_0xac2a76){return BPromise[_0x42c5('0x21')](_0xac2a76);}return _0x3f4172[_0x42c5('0x22')]();};}function saveUpdates(_0x29ca68,_0x213690){return function(_0x156209){if(_0x156209){return _0x156209[_0x42c5('0x23')](_0x29ca68)[_0x42c5('0x24')](function(_0x15035e){return _0x15035e;});}return null;};}function removeEntity(_0x57b36f,_0x102294){return function(_0x233841){if(_0x233841){return _0x233841[_0x42c5('0x25')]()['then'](function(){_0x57b36f[_0x42c5('0x1a')](0xcc)[_0x42c5('0x1b')]();});}};}function handleEntityNotFound(_0x4c79e3,_0x466f9d){return function(_0xd577c8){if(!_0xd577c8){_0x4c79e3[_0x42c5('0x19')](0x194);}return _0xd577c8;};}function handleError(_0x3166b5,_0x119580){_0x119580=_0x119580||0x1f4;return function(_0x4119bf){logger['error'](_0x4119bf[_0x42c5('0x26')]);if(_0x4119bf['name']){delete _0x4119bf[_0x42c5('0x27')];}_0x3166b5[_0x42c5('0x1a')](_0x119580)['send'](_0x4119bf);};}exports[_0x42c5('0x28')]=function(_0x53e81b,_0x27a6b5){var _0x45e9bf={},_0x1058dc={},_0x4096c0={'count':0x0,'rows':[]};var _0x2cb126=db[_0x42c5('0x29')]['rawAttributes'];_0x1058dc[_0x42c5('0x2a')]=_['keys'](_0x2cb126);var _0x16e198={'dateStart':_0x53e81b[_0x42c5('0x2b')][_0x42c5('0x2c')],'dateEnd':_0x53e81b[_0x42c5('0x2b')]['dateEnd']};delete _0x53e81b['query'][_0x42c5('0x2c')];delete _0x53e81b[_0x42c5('0x2b')]['dateEnd'];_0x1058dc[_0x42c5('0x2b')]=_['keys'](_0x53e81b[_0x42c5('0x2b')]);_0x1058dc['filters']=_[_0x42c5('0x2d')](_0x1058dc[_0x42c5('0x2a')],_0x1058dc[_0x42c5('0x2b')]);_0x45e9bf['attributes']=_['intersection'](_0x1058dc[_0x42c5('0x2a')],qs[_0x42c5('0x2e')](_0x53e81b[_0x42c5('0x2b')][_0x42c5('0x2e')]));_0x45e9bf['attributes']=_0x45e9bf['attributes'][_0x42c5('0x2f')]?_0x45e9bf[_0x42c5('0x30')]:_0x1058dc[_0x42c5('0x2a')];if(!_0x53e81b[_0x42c5('0x2b')][_0x42c5('0x31')]('nolimit')){_0x45e9bf[_0x42c5('0x1e')]=qs[_0x42c5('0x1e')](_0x53e81b['query'][_0x42c5('0x1e')]);_0x45e9bf['offset']=qs[_0x42c5('0x32')](_0x53e81b[_0x42c5('0x2b')]['offset']);}_0x45e9bf['order']=qs['sort'](_0x53e81b['query'][_0x42c5('0x33')]);_0x45e9bf[_0x42c5('0x34')]=qs[_0x42c5('0x35')](_[_0x42c5('0x36')](_0x53e81b['query'],_0x1058dc[_0x42c5('0x35')]));if(_0x16e198[_0x42c5('0x2c')]){if(_0x16e198[_0x42c5('0x37')]){_0x16e198[_0x42c5('0x37')]=moment(_0x16e198['dateEnd'])['add'](0x1,_0x42c5('0x38'));}else{_0x16e198['dateEnd']=moment(_0x16e198['dateStart'])['add'](0x1,_0x42c5('0x38'));}_[_0x42c5('0x39')](_0x45e9bf[_0x42c5('0x34')],{'createdAt':{'$gte':_0x16e198[_0x42c5('0x2c')],'$lte':_0x16e198[_0x42c5('0x37')]}});}if(_0x53e81b[_0x42c5('0x2b')][_0x42c5('0x3a')]){_0x45e9bf[_0x42c5('0x34')]=_[_0x42c5('0x39')](_0x45e9bf[_0x42c5('0x34')],{'$or':_['map'](_0x45e9bf[_0x42c5('0x30')],function(_0x1f04e4){var _0x6b53ee={};_0x6b53ee[_0x1f04e4]={'$like':'%'+_0x53e81b[_0x42c5('0x2b')][_0x42c5('0x3a')]+'%'};return _0x6b53ee;})});}_0x45e9bf=_['merge']({},_0x45e9bf,_0x53e81b[_0x42c5('0x3b')]);var _0x52a853={'where':_0x45e9bf[_0x42c5('0x34')]};return db[_0x42c5('0x29')][_0x42c5('0x1d')](_0x52a853)[_0x42c5('0x24')](function(_0x29a305){_0x4096c0[_0x42c5('0x1d')]=_0x29a305;if(_0x53e81b[_0x42c5('0x2b')][_0x42c5('0x3c')]){_0x45e9bf[_0x42c5('0x3d')]=[{'all':!![]}];}return db[_0x42c5('0x29')][_0x42c5('0x3e')](_0x45e9bf);})[_0x42c5('0x24')](function(_0x1b5079){_0x4096c0[_0x42c5('0x3f')]=_0x1b5079;return _0x4096c0;})[_0x42c5('0x24')](respondWithFilteredResult(_0x27a6b5,_0x45e9bf))[_0x42c5('0x40')](handleError(_0x27a6b5,null));};exports[_0x42c5('0x41')]=function(_0x187437,_0x3db458){var _0x35da5e={'raw':!![],'where':{'id':_0x187437['params']['id']}},_0x2bb3ed={};_0x2bb3ed[_0x42c5('0x2a')]=_[_0x42c5('0x42')](db['Sound'][_0x42c5('0x43')]);_0x2bb3ed[_0x42c5('0x2b')]=_['keys'](_0x187437[_0x42c5('0x2b')]);_0x2bb3ed[_0x42c5('0x35')]=_[_0x42c5('0x2d')](_0x2bb3ed[_0x42c5('0x2a')],_0x2bb3ed[_0x42c5('0x2b')]);_0x35da5e[_0x42c5('0x30')]=_[_0x42c5('0x2d')](_0x2bb3ed['model'],qs['fields'](_0x187437[_0x42c5('0x2b')][_0x42c5('0x2e')]));_0x35da5e[_0x42c5('0x30')]=_0x35da5e[_0x42c5('0x30')]['length']?_0x35da5e['attributes']:_0x2bb3ed[_0x42c5('0x2a')];if(_0x187437[_0x42c5('0x2b')][_0x42c5('0x3c')]){_0x35da5e[_0x42c5('0x3d')]=[{'all':!![]}];}_0x35da5e=_[_0x42c5('0x39')]({},_0x35da5e,_0x187437['options']);return db[_0x42c5('0x29')][_0x42c5('0x44')](_0x35da5e)[_0x42c5('0x24')](handleEntityNotFound(_0x3db458,null))[_0x42c5('0x24')](respondWithResult(_0x3db458,null))['catch'](handleError(_0x3db458,null));};exports[_0x42c5('0x45')]=function(_0x1fa718,_0x21adc0,_0x133e3a){return db[_0x42c5('0x29')][_0x42c5('0x44')]({'where':{'id':_0x1fa718[_0x42c5('0x46')]['id']},'attributes':[_0x42c5('0x27'),_0x42c5('0x47'),_0x42c5('0x48')],'raw':!![]})['then'](handleEntityNotFound(_0x21adc0,null))[_0x42c5('0x24')](function(_0x473723){if(_0x473723){if(!fs[_0x42c5('0x49')](path['join'](config[_0x42c5('0x4a')],_0x42c5('0x4b'),_0x473723['save_name']+'.'+_0x473723[_0x42c5('0x48')]))){throw new db[(_0x42c5('0x4c'))][(_0x42c5('0x4d'))](_0x42c5('0x4e'));}return _0x21adc0['download'](path[_0x42c5('0x4f')](config[_0x42c5('0x4a')],'server/files/sounds/converted',util['format'](_0x42c5('0x50'),_0x473723[_0x42c5('0x47')],_0x473723['converted_format'])),util['format']('%s.%s',_0x473723[_0x42c5('0x27')],_0x473723['converted_format']));}return null;})[_0x42c5('0x40')](handleError(_0x21adc0,null));};exports[_0x42c5('0x51')]=function(_0x249ddb,_0x1c6b74,_0x12f3d5){var _0x459ba={'name':path[_0x42c5('0x52')](_0x249ddb[_0x42c5('0x53')][_0x42c5('0x54')],path[_0x42c5('0x55')](_0x249ddb[_0x42c5('0x53')][_0x42c5('0x54')])),'save_name':path[_0x42c5('0x52')](_0x249ddb[_0x42c5('0x53')]['filename'],path[_0x42c5('0x55')](_0x249ddb[_0x42c5('0x53')][_0x42c5('0x56')])),'original_format':path[_0x42c5('0x55')](_0x249ddb[_0x42c5('0x53')][_0x42c5('0x54')])[_0x42c5('0x57')](0x1),'converted_format':_0x42c5('0x58')};var _0x1d4b14=path['join'](config[_0x42c5('0x4a')],_0x42c5('0x59'),_0x249ddb[_0x42c5('0x53')][_0x42c5('0x56')]);var _0x476281=path['join'](config[_0x42c5('0x4a')],_0x42c5('0x4b'),util[_0x42c5('0x5a')](_0x42c5('0x50'),path[_0x42c5('0x52')](_0x249ddb[_0x42c5('0x53')][_0x42c5('0x56')],path[_0x42c5('0x55')](_0x249ddb[_0x42c5('0x53')]['filename'])),_0x459ba[_0x42c5('0x48')]));logger['info'](_0x42c5('0x5b'),_0x1d4b14);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x476281);try{fs[_0x42c5('0x5c')](_0x1d4b14,parseInt('0777',0x8));var _0x101c27=sox['transcode'](_0x1d4b14,_0x476281,{'sampleRate':0x1f40,'format':_0x42c5('0x58'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x101c27['on'](_0x42c5('0x5d'),function(_0x4e5bf6){fs['unlinkSync'](_0x1d4b14);_0x1c6b74[_0x42c5('0x1a')](0x1f4)[_0x42c5('0x5e')](_0x4e5bf6);});_0x101c27['on'](_0x42c5('0x5f'),function(_0x377b95){_0x459ba[_0x42c5('0x60')]=isNaN(_0x377b95[_0x42c5('0x61')])?null:_0x377b95[_0x42c5('0x61')]*0x3e8;_0x459ba[_0x42c5('0x62')]=isNaN(_0x377b95[_0x42c5('0x63')])?null:_0x377b95[_0x42c5('0x63')];_0x459ba['original_channelCount']=isNaN(_0x377b95[_0x42c5('0x64')])?null:_0x377b95[_0x42c5('0x64')];_0x459ba[_0x42c5('0x65')]=isNaN(_0x377b95[_0x42c5('0x66')])?null:_0x377b95['bitRate'];_0x459ba[_0x42c5('0x67')]=isNaN(_0x377b95[_0x42c5('0x68')])?null:_0x377b95[_0x42c5('0x68')];});_0x101c27['on'](_0x42c5('0x69'),function(_0x3cfbeb){_0x459ba[_0x42c5('0x6a')]=isNaN(_0x3cfbeb[_0x42c5('0x61')])?null:_0x3cfbeb[_0x42c5('0x61')]*0x3e8;_0x459ba[_0x42c5('0x6b')]=isNaN(_0x3cfbeb[_0x42c5('0x63')])?null:_0x3cfbeb[_0x42c5('0x63')];_0x459ba[_0x42c5('0x6c')]=isNaN(_0x3cfbeb[_0x42c5('0x64')])?null:_0x3cfbeb[_0x42c5('0x64')];_0x459ba['converted_bitRate']=isNaN(_0x3cfbeb['bitRate'])?null:_0x3cfbeb[_0x42c5('0x66')];_0x459ba[_0x42c5('0x6d')]=isNaN(_0x3cfbeb[_0x42c5('0x68')])?null:_0x3cfbeb['sampleRate'];});_0x101c27['on'](_0x42c5('0x1b'),function(){fs[_0x42c5('0x5c')](_0x476281,parseInt(_0x42c5('0x6e'),0x8));return db['Sound'][_0x42c5('0x51')](_0x459ba)[_0x42c5('0x24')](respondWithResult(_0x1c6b74,null))['catch'](handleError(_0x1c6b74,null));});_0x101c27[_0x42c5('0x6f')]();}catch(_0x531c62){_0x1c6b74[_0x42c5('0x1a')](0x1f4)['send'](_0x531c62);}};exports[_0x42c5('0x23')]=function(_0x25caa5,_0x47ab80,_0x49b39a){return db[_0x42c5('0x29')][_0x42c5('0x44')]({'where':{'id':_0x25caa5[_0x42c5('0x46')]['id']}})[_0x42c5('0x24')](handleEntityNotFound(_0x47ab80,null))[_0x42c5('0x24')](saveUpdates(_[_0x42c5('0x36')](_0x25caa5[_0x42c5('0x70')],[_0x42c5('0x27'),_0x42c5('0x71')]),null))[_0x42c5('0x24')](respondWithResult(_0x47ab80,null))[_0x42c5('0x40')](handleError(_0x47ab80,null));};exports['delete']=function(_0x5900ac,_0x57b626,_0x4f3cc8){return db[_0x42c5('0x29')][_0x42c5('0x44')]({'where':{'id':_0x5900ac[_0x42c5('0x46')]['id']}})[_0x42c5('0x24')](function(_0x2b1add){if(_0x2b1add){return _0x2b1add[_0x42c5('0x25')]();}})[_0x42c5('0x24')](function(_0x2a406b){var _0x5e6dca=path[_0x42c5('0x4f')](config[_0x42c5('0x4a')],_0x42c5('0x59'),util[_0x42c5('0x5a')]('%s.%s',_0x2a406b[_0x42c5('0x47')],_0x2a406b[_0x42c5('0x72')]));var _0x14f534=path[_0x42c5('0x4f')](config[_0x42c5('0x4a')],'server/files/sounds/converted',util[_0x42c5('0x5a')]('%s.%s',_0x2a406b[_0x42c5('0x47')],_0x2a406b[_0x42c5('0x48')]));fs[_0x42c5('0x73')](_0x5e6dca);fs[_0x42c5('0x73')](_0x14f534);return _0x2a406b;})['then'](function(_0x48586c){if(_0x48586c){return _0x57b626[_0x42c5('0x1a')](0xcc)['end']();}})[_0x42c5('0x24')](handleEntityNotFound(_0x57b626,null))['catch'](handleError(_0x57b626,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 32b019c..d1374a7 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 _0x39ed=['exports','define','Sound','tools_sounds','lodash','util','../../config/logger','moment','bluebird','request-promise','./sound.attributes'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x39ed,0xe0));var _0xd39e=function(_0x4117b9,_0x4ed43f){_0x4117b9=_0x4117b9-0x0;var _0x409f67=_0x39ed[_0x4117b9];return _0x409f67;};'use strict';var _=require(_0xd39e('0x0'));var util=require(_0xd39e('0x1'));var logger=require(_0xd39e('0x2'))('api');var moment=require(_0xd39e('0x3'));var BPromise=require(_0xd39e('0x4'));var rp=require(_0xd39e('0x5'));var attributes=require(_0xd39e('0x6'));module[_0xd39e('0x7')]=function(_0x11a731,_0x17a55e){return _0x11a731[_0xd39e('0x8')](_0xd39e('0x9'),attributes,{'tableName':_0xd39e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x914c=['bluebird','./sound.attributes','exports','define','Sound','tools_sounds','lodash','../../config/logger','api','moment'];(function(_0x3dc116,_0x16e4a8){var _0xcae20a=function(_0x5cf9b0){while(--_0x5cf9b0){_0x3dc116['push'](_0x3dc116['shift']());}};_0xcae20a(++_0x16e4a8);}(_0x914c,0x132));var _0xc914=function(_0x267d8d,_0xe90f65){_0x267d8d=_0x267d8d-0x0;var _0x11a98f=_0x914c[_0x267d8d];return _0x11a98f;};'use strict';var _=require(_0xc914('0x0'));var util=require('util');var logger=require(_0xc914('0x1'))(_0xc914('0x2'));var moment=require(_0xc914('0x3'));var BPromise=require(_0xc914('0x4'));var rp=require('request-promise');var attributes=require(_0xc914('0x5'));module[_0xc914('0x6')]=function(_0x37262b,_0xad0cf6){return _0x37262b[_0xc914('0x7')](_0xc914('0x8'),attributes,{'tableName':_0xc914('0x9'),'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 ab78130..0f11d1c 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 _0xd8b0=['request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSound','Sound','options','raw','where','include','model','attributes','map','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Sound,\x20%s,\x20%s'];(function(_0x1b040a,_0x411501){var _0x13c27b=function(_0x41dab1){while(--_0x41dab1){_0x1b040a['push'](_0x1b040a['shift']());}};_0x13c27b(++_0x411501);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});}exports[_0x0d8b('0x16')]=function(_0x5fecbd){var _0x333674=this;return new Promise(function(_0x18dd2d,_0x264b39){return db[_0x0d8b('0x17')]['find']({'raw':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x19')]===undefined?!![]:![]:!![],'where':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x1a')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')]['attributes']||null:null,'include':_0x5fecbd['options']?_0x5fecbd[_0x0d8b('0x18')]['include']?_['map'](_0x5fecbd['options'][_0x0d8b('0x1b')],function(_0x2b924f){return{'model':db[_0x2b924f[_0x0d8b('0x1c')]],'as':_0x2b924f['as'],'attributes':_0x2b924f[_0x0d8b('0x1d')],'include':_0x2b924f[_0x0d8b('0x1b')]?_[_0x0d8b('0x1e')](_0x2b924f[_0x0d8b('0x1b')],function(_0x4562cb){return{'model':db[_0x4562cb[_0x0d8b('0x1c')]],'as':_0x4562cb['as'],'attributes':_0x4562cb['attributes'],'include':_0x4562cb[_0x0d8b('0x1b')]?_[_0x0d8b('0x1e')](_0x4562cb['include'],function(_0xe1ef20){return{'model':db[_0xe1ef20['model']],'as':_0xe1ef20['as'],'attributes':_0xe1ef20[_0x0d8b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0d8b('0xa')](function(_0xa2af02){logger['info']('ShowSound',_0x5fecbd);logger[_0x0d8b('0xe')](_0x0d8b('0x16'),_0x5fecbd,JSON['stringify'](_0xa2af02));_0x18dd2d(_0xa2af02);})[_0x0d8b('0x15')](function(_0x59aa83){logger[_0x0d8b('0x11')]('ShowSound',_0x59aa83[_0x0d8b('0x13')],_0x5fecbd);_0x264b39(_0x333674['error'](0x1f4,_0x59aa83[_0x0d8b('0x13')]));});});}; \ No newline at end of file +var _0xd8b0=['request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSound','Sound','options','raw','where','include','model','attributes','map','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Sound,\x20%s,\x20%s'];(function(_0x29ec39,_0x45cadc){var _0x54f137=function(_0x4f5c10){while(--_0x4f5c10){_0x29ec39['push'](_0x29ec39['shift']());}};_0x54f137(++_0x45cadc);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});}exports[_0x0d8b('0x16')]=function(_0x5fecbd){var _0x333674=this;return new Promise(function(_0x18dd2d,_0x264b39){return db[_0x0d8b('0x17')]['find']({'raw':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x19')]===undefined?!![]:![]:!![],'where':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x1a')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')]['attributes']||null:null,'include':_0x5fecbd['options']?_0x5fecbd[_0x0d8b('0x18')]['include']?_['map'](_0x5fecbd['options'][_0x0d8b('0x1b')],function(_0x2b924f){return{'model':db[_0x2b924f[_0x0d8b('0x1c')]],'as':_0x2b924f['as'],'attributes':_0x2b924f[_0x0d8b('0x1d')],'include':_0x2b924f[_0x0d8b('0x1b')]?_[_0x0d8b('0x1e')](_0x2b924f[_0x0d8b('0x1b')],function(_0x4562cb){return{'model':db[_0x4562cb[_0x0d8b('0x1c')]],'as':_0x4562cb['as'],'attributes':_0x4562cb['attributes'],'include':_0x4562cb[_0x0d8b('0x1b')]?_[_0x0d8b('0x1e')](_0x4562cb['include'],function(_0xe1ef20){return{'model':db[_0xe1ef20['model']],'as':_0xe1ef20['as'],'attributes':_0xe1ef20[_0x0d8b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0d8b('0xa')](function(_0xa2af02){logger['info']('ShowSound',_0x5fecbd);logger[_0x0d8b('0xe')](_0x0d8b('0x16'),_0x5fecbd,JSON['stringify'](_0xa2af02));_0x18dd2d(_0xa2af02);})[_0x0d8b('0x15')](function(_0x59aa83){logger[_0x0d8b('0x11')]('ShowSound',_0x59aa83[_0x0d8b('0x13')],_0x5fecbd);_0x264b39(_0x333674['error'](0x1f4,_0x59aa83[_0x0d8b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 0d983c8..4b024b2 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 _0x5eb1=['isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareMessage.controller','get'];(function(_0x578a0a,_0x290ede){var _0x1a30c0=function(_0x21f380){while(--_0x21f380){_0x578a0a['push'](_0x578a0a['shift']());}};_0x1a30c0(++_0x290ede);}(_0x5eb1,0x7c));var _0x15eb=function(_0x38a155,_0x2aa026){_0x38a155=_0x38a155-0x0;var _0x269403=_0x5eb1[_0x38a155];return _0x269403;};'use strict';var multer=require('multer');var util=require(_0x15eb('0x0'));var path=require(_0x15eb('0x1'));var timeout=require(_0x15eb('0x2'));var express=require(_0x15eb('0x3'));var router=express[_0x15eb('0x4')]();var auth=require(_0x15eb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x15eb('0x6'));var controller=require(_0x15eb('0x7'));router[_0x15eb('0x8')]('/',auth[_0x15eb('0x9')](),controller['index']);router[_0x15eb('0x8')](_0x15eb('0xa'),auth['isAuthenticated'](),controller[_0x15eb('0xb')]);router[_0x15eb('0xc')]('/',auth[_0x15eb('0x9')](),controller[_0x15eb('0xd')]);router[_0x15eb('0xe')](_0x15eb('0xa'),auth[_0x15eb('0x9')](),controller[_0x15eb('0xf')]);router[_0x15eb('0x10')](_0x15eb('0xa'),auth[_0x15eb('0x9')](),controller[_0x15eb('0x11')]);module[_0x15eb('0x12')]=router; \ No newline at end of file +var _0x4e65=['isAuthenticated','index','/:id','show','post','create','update','delete','exports','util','path','connect-timeout','express','Router','../../config/environment','./squareMessage.controller','get'];(function(_0x3559c4,_0x47580b){var _0x124053=function(_0x2edf1){while(--_0x2edf1){_0x3559c4['push'](_0x3559c4['shift']());}};_0x124053(++_0x47580b);}(_0x4e65,0xc4));var _0x54e6=function(_0x9df0f7,_0x897a79){_0x9df0f7=_0x9df0f7-0x0;var _0x1ee8d0=_0x4e65[_0x9df0f7];return _0x1ee8d0;};'use strict';var multer=require('multer');var util=require(_0x54e6('0x0'));var path=require(_0x54e6('0x1'));var timeout=require(_0x54e6('0x2'));var express=require(_0x54e6('0x3'));var router=express[_0x54e6('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x54e6('0x5'));var controller=require(_0x54e6('0x6'));router[_0x54e6('0x7')]('/',auth[_0x54e6('0x8')](),controller[_0x54e6('0x9')]);router['get'](_0x54e6('0xa'),auth['isAuthenticated'](),controller[_0x54e6('0xb')]);router[_0x54e6('0xc')]('/',auth[_0x54e6('0x8')](),controller[_0x54e6('0xd')]);router['put'](_0x54e6('0xa'),auth[_0x54e6('0x8')](),controller[_0x54e6('0xe')]);router[_0x54e6('0xf')](_0x54e6('0xa'),auth[_0x54e6('0x8')](),controller['destroy']);module[_0x54e6('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 029543e..837a6c7 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 _0x0232=['ENUM','out','sequelize','medium'];(function(_0x18a00f,_0x57d490){var _0x21d1aa=function(_0x3ec1b6){while(--_0x3ec1b6){_0x18a00f['push'](_0x18a00f['shift']());}};_0x21d1aa(++_0x57d490);}(_0x0232,0x112));var _0x2023=function(_0x1f700c,_0xcd2737){_0x1f700c=_0x1f700c-0x0;var _0x108d74=_0x0232[_0x1f700c];return _0x108d74;};'use strict';var Sequelize=require(_0x2023('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT'](_0x2023('0x1')),'allowNull':![]},'direction':{'type':Sequelize[_0x2023('0x2')]('in',_0x2023('0x3')),'defaultValue':'out','allowNull':![]}}; \ No newline at end of file +var _0xad50=['medium','ENUM','out','TEXT'];(function(_0x241636,_0x5e16ad){var _0x1066cc=function(_0x53f22c){while(--_0x53f22c){_0x241636['push'](_0x241636['shift']());}};_0x1066cc(++_0x5e16ad);}(_0xad50,0xc3));var _0x0ad5=function(_0x5e28c2,_0x1e48ab){_0x5e28c2=_0x5e28c2-0x0;var _0x1a8cc6=_0xad50[_0x5e28c2];return _0x1a8cc6;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x0ad5('0x0')](_0x0ad5('0x1')),'allowNull':![]},'direction':{'type':Sequelize[_0x0ad5('0x2')]('in',_0x0ad5('0x3')),'defaultValue':_0x0ad5('0x3'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 2d80ca5..5aa7b77 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 _0x28f8=['rows','catch','show','find','create','body','destroy','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','reject','save','update','then','stack','name','send','index','rawAttributes','model','keys','query','dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','dateEnd','add','day','merge','filter','map','options','SquareMessage','count','includeAll','include','findAll'];(function(_0xbfd0e5,_0x1e3daa){var _0x12642f=function(_0x33b669){while(--_0x33b669){_0xbfd0e5['push'](_0xbfd0e5['shift']());}};_0x12642f(++_0x1e3daa);}(_0x28f8,0xe0));var _0x828f=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x28f8[_0x17d9e3];return _0x14192d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x828f('0x0'));var rimraf=require(_0x828f('0x1'));var zipdir=require(_0x828f('0x2'));var jsonpatch=require(_0x828f('0x3'));var rp=require(_0x828f('0x4'));var moment=require(_0x828f('0x5'));var BPromise=require(_0x828f('0x6'));var Mustache=require(_0x828f('0x7'));var util=require(_0x828f('0x8'));var path=require(_0x828f('0x9'));var sox=require(_0x828f('0xa'));var csv=require(_0x828f('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x828f('0xc'));var crypto=require('crypto');var jsforce=require(_0x828f('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x828f('0xe'));var Papa=require('papaparse');var Redis=require(_0x828f('0xf'));var qs=require(_0x828f('0x10'));var logger=require(_0x828f('0x11'))(_0x828f('0x12'));var utils=require('../../config/utils');var config=require(_0x828f('0x13'));var db=require(_0x828f('0x14'))['db'];function respondWithStatusCode(_0x555df9,_0xb4c682){_0xb4c682=_0xb4c682||0xcc;return function(_0x15c6da){if(_0x15c6da){return _0x555df9[_0x828f('0x15')](_0xb4c682);}return _0x555df9['status'](_0xb4c682)[_0x828f('0x16')]();};}function respondWithResult(_0x8c6bcf,_0x322f32){_0x322f32=_0x322f32||0xc8;return function(_0x556980){if(_0x556980){return _0x8c6bcf[_0x828f('0x17')](_0x322f32)[_0x828f('0x18')](_0x556980);}};}function respondWithFilteredResult(_0x1ad6f5,_0x35ee1a){return function(_0x5923a1){if(_0x5923a1){var _0xc68ae9=_0x5923a1['count'],_0x917db0=_0x35ee1a[_0x828f('0x19')],_0x3f9fc9=_0x35ee1a[_0x828f('0x19')]+_0x35ee1a[_0x828f('0x1a')],_0x1d0f6b;if(_0x3f9fc9>=_0xc68ae9){_0x3f9fc9=_0xc68ae9;_0x1d0f6b=0xc8;}else{_0x1d0f6b=0xce;}_0x1ad6f5[_0x828f('0x17')](_0x1d0f6b);return _0x1ad6f5[_0x828f('0x1b')](_0x828f('0x1c'),_0x917db0+'-'+_0x3f9fc9+'/'+_0xc68ae9)['json'](_0x5923a1);}return null;};}function patchUpdates(_0x437e30){return function(_0x2d3eeb){try{jsonpatch['apply'](_0x2d3eeb,_0x437e30,!![]);}catch(_0x36c8af){return BPromise[_0x828f('0x1d')](_0x36c8af);}return _0x2d3eeb[_0x828f('0x1e')]();};}function saveUpdates(_0x3d5c22,_0x278064){return function(_0x5ee546){if(_0x5ee546){return _0x5ee546[_0x828f('0x1f')](_0x3d5c22)['then'](function(_0x1a210f){return _0x1a210f;});}return null;};}function removeEntity(_0x8cafa1,_0x56f986){return function(_0x49071a){if(_0x49071a){return _0x49071a['destroy']()[_0x828f('0x20')](function(){_0x8cafa1[_0x828f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9a7ed3,_0x595aae){return function(_0x555af1){if(!_0x555af1){_0x9a7ed3[_0x828f('0x15')](0x194);}return _0x555af1;};}function handleError(_0x4df25b,_0x5dc06){_0x5dc06=_0x5dc06||0x1f4;return function(_0x40d571){logger['error'](_0x40d571[_0x828f('0x21')]);if(_0x40d571[_0x828f('0x22')]){delete _0x40d571['name'];}_0x4df25b['status'](_0x5dc06)[_0x828f('0x23')](_0x40d571);};}exports[_0x828f('0x24')]=function(_0xf4ba94,_0x54c841){var _0x165321={},_0x3c7022={},_0x56c616={'count':0x0,'rows':[]};var _0x153f36=db['SquareMessage'][_0x828f('0x25')];_0x3c7022[_0x828f('0x26')]=_[_0x828f('0x27')](_0x153f36);var _0x29faa8={'dateStart':_0xf4ba94[_0x828f('0x28')][_0x828f('0x29')],'dateEnd':_0xf4ba94[_0x828f('0x28')]['dateEnd']};delete _0xf4ba94['query']['dateStart'];delete _0xf4ba94[_0x828f('0x28')]['dateEnd'];_0x3c7022['query']=_['keys'](_0xf4ba94[_0x828f('0x28')]);_0x3c7022[_0x828f('0x2a')]=_[_0x828f('0x2b')](_0x3c7022[_0x828f('0x26')],_0x3c7022[_0x828f('0x28')]);_0x165321[_0x828f('0x2c')]=_[_0x828f('0x2b')](_0x3c7022['model'],qs[_0x828f('0x2d')](_0xf4ba94[_0x828f('0x28')][_0x828f('0x2d')]));_0x165321['attributes']=_0x165321[_0x828f('0x2c')][_0x828f('0x2e')]?_0x165321[_0x828f('0x2c')]:_0x3c7022[_0x828f('0x26')];if(!_0xf4ba94[_0x828f('0x28')][_0x828f('0x2f')](_0x828f('0x30'))){_0x165321[_0x828f('0x1a')]=qs['limit'](_0xf4ba94[_0x828f('0x28')][_0x828f('0x1a')]);_0x165321['offset']=qs[_0x828f('0x19')](_0xf4ba94[_0x828f('0x28')][_0x828f('0x19')]);}_0x165321[_0x828f('0x31')]=qs['sort'](_0xf4ba94['query'][_0x828f('0x32')]);_0x165321[_0x828f('0x33')]=qs[_0x828f('0x2a')](_['pick'](_0xf4ba94['query'],_0x3c7022['filters']));if(_0x29faa8[_0x828f('0x29')]){if(_0x29faa8['dateEnd']){_0x29faa8[_0x828f('0x34')]=moment(_0x29faa8[_0x828f('0x34')])[_0x828f('0x35')](0x1,_0x828f('0x36'));}else{_0x29faa8['dateEnd']=moment(_0x29faa8['dateStart'])[_0x828f('0x35')](0x1,_0x828f('0x36'));}_[_0x828f('0x37')](_0x165321[_0x828f('0x33')],{'createdAt':{'$gte':_0x29faa8[_0x828f('0x29')],'$lte':_0x29faa8['dateEnd']}});}if(_0xf4ba94[_0x828f('0x28')][_0x828f('0x38')]){_0x165321[_0x828f('0x33')]=_[_0x828f('0x37')](_0x165321[_0x828f('0x33')],{'$or':_[_0x828f('0x39')](_0x165321[_0x828f('0x2c')],function(_0xce2249){var _0x4e473e={};_0x4e473e[_0xce2249]={'$like':'%'+_0xf4ba94[_0x828f('0x28')][_0x828f('0x38')]+'%'};return _0x4e473e;})});}_0x165321=_[_0x828f('0x37')]({},_0x165321,_0xf4ba94[_0x828f('0x3a')]);var _0xb20c1a={'where':_0x165321[_0x828f('0x33')]};return db[_0x828f('0x3b')][_0x828f('0x3c')](_0xb20c1a)[_0x828f('0x20')](function(_0x5a4790){_0x56c616[_0x828f('0x3c')]=_0x5a4790;if(_0xf4ba94[_0x828f('0x28')][_0x828f('0x3d')]){_0x165321[_0x828f('0x3e')]=[{'all':!![]}];}return db[_0x828f('0x3b')][_0x828f('0x3f')](_0x165321);})[_0x828f('0x20')](function(_0x30c307){_0x56c616[_0x828f('0x40')]=_0x30c307;return _0x56c616;})[_0x828f('0x20')](respondWithFilteredResult(_0x54c841,_0x165321))[_0x828f('0x41')](handleError(_0x54c841,null));};exports[_0x828f('0x42')]=function(_0x91967e,_0x53d727){var _0x3baa99={'raw':!![],'where':{'id':_0x91967e['params']['id']}},_0x1815a8={};_0x1815a8['model']=_['keys'](db[_0x828f('0x3b')][_0x828f('0x25')]);_0x1815a8[_0x828f('0x28')]=_['keys'](_0x91967e['query']);_0x1815a8[_0x828f('0x2a')]=_[_0x828f('0x2b')](_0x1815a8[_0x828f('0x26')],_0x1815a8[_0x828f('0x28')]);_0x3baa99['attributes']=_['intersection'](_0x1815a8[_0x828f('0x26')],qs[_0x828f('0x2d')](_0x91967e[_0x828f('0x28')]['fields']));_0x3baa99['attributes']=_0x3baa99[_0x828f('0x2c')][_0x828f('0x2e')]?_0x3baa99['attributes']:_0x1815a8[_0x828f('0x26')];if(_0x91967e[_0x828f('0x28')][_0x828f('0x3d')]){_0x3baa99[_0x828f('0x3e')]=[{'all':!![]}];}_0x3baa99=_[_0x828f('0x37')]({},_0x3baa99,_0x91967e[_0x828f('0x3a')]);return db[_0x828f('0x3b')][_0x828f('0x43')](_0x3baa99)['then'](handleEntityNotFound(_0x53d727,null))[_0x828f('0x20')](respondWithResult(_0x53d727,null))[_0x828f('0x41')](handleError(_0x53d727,null));};exports[_0x828f('0x44')]=function(_0x2222a4,_0x5554f7){return db[_0x828f('0x3b')][_0x828f('0x44')](_0x2222a4['body'],{})[_0x828f('0x20')](respondWithResult(_0x5554f7,0xc9))[_0x828f('0x41')](handleError(_0x5554f7,null));};exports[_0x828f('0x1f')]=function(_0x273729,_0x34dac4){if(_0x273729[_0x828f('0x45')]['id']){delete _0x273729[_0x828f('0x45')]['id'];}return db[_0x828f('0x3b')]['find']({'where':{'id':_0x273729['params']['id']}})[_0x828f('0x20')](handleEntityNotFound(_0x34dac4,null))['then'](saveUpdates(_0x273729['body'],null))[_0x828f('0x20')](respondWithResult(_0x34dac4,null))[_0x828f('0x41')](handleError(_0x34dac4,null));};exports[_0x828f('0x46')]=function(_0x351293,_0x3bdb11){return db[_0x828f('0x3b')][_0x828f('0x43')]({'where':{'id':_0x351293[_0x828f('0x47')]['id']}})[_0x828f('0x20')](handleEntityNotFound(_0x3bdb11,null))['then'](removeEntity(_0x3bdb11,null))['catch'](handleError(_0x3bdb11,null));}; \ No newline at end of file +var _0x83c7=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','SquareMessage','rawAttributes','keys','query','dateEnd','dateStart','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','day','filter','merge','options','count','includeAll','findAll','rows','catch','show','params','include','find','create','body'];(function(_0x2b5448,_0xe31456){var _0xee510e=function(_0x48a4fa){while(--_0x48a4fa){_0x2b5448['push'](_0x2b5448['shift']());}};_0xee510e(++_0xe31456);}(_0x83c7,0xdb));var _0x783c=function(_0x22fc25,_0x549453){_0x22fc25=_0x22fc25-0x0;var _0x5102c5=_0x83c7[_0x22fc25];return _0x5102c5;};'use strict';var pdf=require(_0x783c('0x0'));var emlformat=require(_0x783c('0x1'));var rimraf=require(_0x783c('0x2'));var zipdir=require(_0x783c('0x3'));var jsonpatch=require(_0x783c('0x4'));var rp=require(_0x783c('0x5'));var moment=require('moment');var BPromise=require(_0x783c('0x6'));var Mustache=require(_0x783c('0x7'));var util=require(_0x783c('0x8'));var path=require(_0x783c('0x9'));var sox=require('sox');var csv=require(_0x783c('0xa'));var ejs=require(_0x783c('0xb'));var fs=require('fs');var _=require(_0x783c('0xc'));var squel=require(_0x783c('0xd'));var crypto=require(_0x783c('0xe'));var jsforce=require(_0x783c('0xf'));var deskjs=require(_0x783c('0x10'));var toCsv=require('to-csv');var querystring=require(_0x783c('0x11'));var Papa=require(_0x783c('0x12'));var Redis=require(_0x783c('0x13'));var qs=require(_0x783c('0x14'));var logger=require(_0x783c('0x15'))(_0x783c('0x16'));var utils=require(_0x783c('0x17'));var config=require('../../config/environment');var db=require(_0x783c('0x18'))['db'];function respondWithStatusCode(_0x5a7d0e,_0x363781){_0x363781=_0x363781||0xcc;return function(_0xeb7360){if(_0xeb7360){return _0x5a7d0e[_0x783c('0x19')](_0x363781);}return _0x5a7d0e[_0x783c('0x1a')](_0x363781)[_0x783c('0x1b')]();};}function respondWithResult(_0x3d50d4,_0x12b54f){_0x12b54f=_0x12b54f||0xc8;return function(_0x2f249a){if(_0x2f249a){return _0x3d50d4[_0x783c('0x1a')](_0x12b54f)[_0x783c('0x1c')](_0x2f249a);}};}function respondWithFilteredResult(_0x59ae34,_0x4563fc){return function(_0x55eb59){if(_0x55eb59){var _0x43fa3f=_0x55eb59['count'],_0x4755b9=_0x4563fc[_0x783c('0x1d')],_0x43aa14=_0x4563fc[_0x783c('0x1d')]+_0x4563fc[_0x783c('0x1e')],_0x151ea1;if(_0x43aa14>=_0x43fa3f){_0x43aa14=_0x43fa3f;_0x151ea1=0xc8;}else{_0x151ea1=0xce;}_0x59ae34['status'](_0x151ea1);return _0x59ae34['set'](_0x783c('0x1f'),_0x4755b9+'-'+_0x43aa14+'/'+_0x43fa3f)['json'](_0x55eb59);}return null;};}function patchUpdates(_0x5bd5b3){return function(_0x26b846){try{jsonpatch[_0x783c('0x20')](_0x26b846,_0x5bd5b3,!![]);}catch(_0x43f516){return BPromise[_0x783c('0x21')](_0x43f516);}return _0x26b846[_0x783c('0x22')]();};}function saveUpdates(_0x394877,_0x2b66c8){return function(_0x45b64b){if(_0x45b64b){return _0x45b64b[_0x783c('0x23')](_0x394877)['then'](function(_0x2dc9b4){return _0x2dc9b4;});}return null;};}function removeEntity(_0x140f84,_0x5afeb4){return function(_0x3d2cc6){if(_0x3d2cc6){return _0x3d2cc6[_0x783c('0x24')]()[_0x783c('0x25')](function(){_0x140f84[_0x783c('0x1a')](0xcc)[_0x783c('0x1b')]();});}};}function handleEntityNotFound(_0x5a2ee2,_0x9fe248){return function(_0x39729a){if(!_0x39729a){_0x5a2ee2[_0x783c('0x19')](0x194);}return _0x39729a;};}function handleError(_0x3fce3b,_0x1dc3cf){_0x1dc3cf=_0x1dc3cf||0x1f4;return function(_0x576ddb){logger[_0x783c('0x26')](_0x576ddb[_0x783c('0x27')]);if(_0x576ddb[_0x783c('0x28')]){delete _0x576ddb[_0x783c('0x28')];}_0x3fce3b[_0x783c('0x1a')](_0x1dc3cf)[_0x783c('0x29')](_0x576ddb);};}exports['index']=function(_0x26c340,_0x4e8302){var _0x18cd88={},_0x317f2f={},_0x3ac265={'count':0x0,'rows':[]};var _0x13b89c=db[_0x783c('0x2a')][_0x783c('0x2b')];_0x317f2f['model']=_[_0x783c('0x2c')](_0x13b89c);var _0x5d10a7={'dateStart':_0x26c340[_0x783c('0x2d')]['dateStart'],'dateEnd':_0x26c340[_0x783c('0x2d')][_0x783c('0x2e')]};delete _0x26c340[_0x783c('0x2d')][_0x783c('0x2f')];delete _0x26c340[_0x783c('0x2d')][_0x783c('0x2e')];_0x317f2f[_0x783c('0x2d')]=_[_0x783c('0x2c')](_0x26c340[_0x783c('0x2d')]);_0x317f2f['filters']=_[_0x783c('0x30')](_0x317f2f[_0x783c('0x31')],_0x317f2f[_0x783c('0x2d')]);_0x18cd88[_0x783c('0x32')]=_['intersection'](_0x317f2f['model'],qs[_0x783c('0x33')](_0x26c340['query'][_0x783c('0x33')]));_0x18cd88['attributes']=_0x18cd88[_0x783c('0x32')]['length']?_0x18cd88[_0x783c('0x32')]:_0x317f2f[_0x783c('0x31')];if(!_0x26c340[_0x783c('0x2d')][_0x783c('0x34')]('nolimit')){_0x18cd88[_0x783c('0x1e')]=qs[_0x783c('0x1e')](_0x26c340[_0x783c('0x2d')][_0x783c('0x1e')]);_0x18cd88[_0x783c('0x1d')]=qs[_0x783c('0x1d')](_0x26c340[_0x783c('0x2d')]['offset']);}_0x18cd88[_0x783c('0x35')]=qs[_0x783c('0x36')](_0x26c340[_0x783c('0x2d')]['sort']);_0x18cd88[_0x783c('0x37')]=qs[_0x783c('0x38')](_[_0x783c('0x39')](_0x26c340['query'],_0x317f2f[_0x783c('0x38')]));if(_0x5d10a7[_0x783c('0x2f')]){if(_0x5d10a7[_0x783c('0x2e')]){_0x5d10a7[_0x783c('0x2e')]=moment(_0x5d10a7[_0x783c('0x2e')])['add'](0x1,_0x783c('0x3a'));}else{_0x5d10a7['dateEnd']=moment(_0x5d10a7[_0x783c('0x2f')])['add'](0x1,_0x783c('0x3a'));}_['merge'](_0x18cd88['where'],{'createdAt':{'$gte':_0x5d10a7[_0x783c('0x2f')],'$lte':_0x5d10a7[_0x783c('0x2e')]}});}if(_0x26c340[_0x783c('0x2d')][_0x783c('0x3b')]){_0x18cd88[_0x783c('0x37')]=_['merge'](_0x18cd88[_0x783c('0x37')],{'$or':_['map'](_0x18cd88[_0x783c('0x32')],function(_0x51a782){var _0x512b51={};_0x512b51[_0x51a782]={'$like':'%'+_0x26c340['query'][_0x783c('0x3b')]+'%'};return _0x512b51;})});}_0x18cd88=_[_0x783c('0x3c')]({},_0x18cd88,_0x26c340[_0x783c('0x3d')]);var _0x4be238={'where':_0x18cd88[_0x783c('0x37')]};return db[_0x783c('0x2a')]['count'](_0x4be238)[_0x783c('0x25')](function(_0x2f8cda){_0x3ac265[_0x783c('0x3e')]=_0x2f8cda;if(_0x26c340[_0x783c('0x2d')][_0x783c('0x3f')]){_0x18cd88['include']=[{'all':!![]}];}return db[_0x783c('0x2a')][_0x783c('0x40')](_0x18cd88);})[_0x783c('0x25')](function(_0x27983d){_0x3ac265[_0x783c('0x41')]=_0x27983d;return _0x3ac265;})[_0x783c('0x25')](respondWithFilteredResult(_0x4e8302,_0x18cd88))[_0x783c('0x42')](handleError(_0x4e8302,null));};exports[_0x783c('0x43')]=function(_0x1e279f,_0x1264be){var _0x204506={'raw':!![],'where':{'id':_0x1e279f[_0x783c('0x44')]['id']}},_0x1ff67e={};_0x1ff67e[_0x783c('0x31')]=_[_0x783c('0x2c')](db[_0x783c('0x2a')]['rawAttributes']);_0x1ff67e[_0x783c('0x2d')]=_[_0x783c('0x2c')](_0x1e279f[_0x783c('0x2d')]);_0x1ff67e[_0x783c('0x38')]=_[_0x783c('0x30')](_0x1ff67e['model'],_0x1ff67e[_0x783c('0x2d')]);_0x204506[_0x783c('0x32')]=_['intersection'](_0x1ff67e['model'],qs[_0x783c('0x33')](_0x1e279f[_0x783c('0x2d')][_0x783c('0x33')]));_0x204506[_0x783c('0x32')]=_0x204506['attributes']['length']?_0x204506[_0x783c('0x32')]:_0x1ff67e[_0x783c('0x31')];if(_0x1e279f[_0x783c('0x2d')]['includeAll']){_0x204506[_0x783c('0x45')]=[{'all':!![]}];}_0x204506=_[_0x783c('0x3c')]({},_0x204506,_0x1e279f[_0x783c('0x3d')]);return db[_0x783c('0x2a')][_0x783c('0x46')](_0x204506)['then'](handleEntityNotFound(_0x1264be,null))[_0x783c('0x25')](respondWithResult(_0x1264be,null))['catch'](handleError(_0x1264be,null));};exports[_0x783c('0x47')]=function(_0x12784e,_0x411b2a){return db[_0x783c('0x2a')]['create'](_0x12784e['body'],{})['then'](respondWithResult(_0x411b2a,0xc9))[_0x783c('0x42')](handleError(_0x411b2a,null));};exports['update']=function(_0x102d3c,_0x16bfc8){if(_0x102d3c[_0x783c('0x48')]['id']){delete _0x102d3c[_0x783c('0x48')]['id'];}return db[_0x783c('0x2a')][_0x783c('0x46')]({'where':{'id':_0x102d3c[_0x783c('0x44')]['id']}})[_0x783c('0x25')](handleEntityNotFound(_0x16bfc8,null))['then'](saveUpdates(_0x102d3c['body'],null))[_0x783c('0x25')](respondWithResult(_0x16bfc8,null))[_0x783c('0x42')](handleError(_0x16bfc8,null));};exports[_0x783c('0x24')]=function(_0x2c923b,_0x39b115){return db['SquareMessage'][_0x783c('0x46')]({'where':{'id':_0x2c923b[_0x783c('0x44')]['id']}})[_0x783c('0x25')](handleEntityNotFound(_0x39b115,null))[_0x783c('0x25')](removeEntity(_0x39b115,null))['catch'](handleError(_0x39b115,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 1d3df68..858293e 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 _0xfeb1=['api','moment','request-promise','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0xfeb1,0x105));var _0x1feb=function(_0x2a09c9,_0x2c93f9){_0x2a09c9=_0x2a09c9-0x0;var _0x525dee=_0xfeb1[_0x2a09c9];return _0x525dee;};'use strict';var _=require(_0x1feb('0x0'));var util=require(_0x1feb('0x1'));var logger=require(_0x1feb('0x2'))(_0x1feb('0x3'));var moment=require(_0x1feb('0x4'));var BPromise=require('bluebird');var rp=require(_0x1feb('0x5'));var attributes=require(_0x1feb('0x6'));module[_0x1feb('0x7')]=function(_0x540d6e,_0x4b175f){return _0x540d6e[_0x1feb('0x8')](_0x1feb('0x9'),attributes,{'tableName':_0x1feb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd01=['./squareMessage.attributes','exports','square_messages','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x38c160,_0x1318fa){var _0x780b56=function(_0x51c44e){while(--_0x51c44e){_0x38c160['push'](_0x38c160['shift']());}};_0x780b56(++_0x1318fa);}(_0xcd01,0x14b));var _0x1cd0=function(_0x40b7bd,_0x2f8acc){_0x40b7bd=_0x40b7bd-0x0;var _0x30f8a5=_0xcd01[_0x40b7bd];return _0x30f8a5;};'use strict';var _=require(_0x1cd0('0x0'));var util=require('util');var logger=require(_0x1cd0('0x1'))('api');var moment=require(_0x1cd0('0x2'));var BPromise=require(_0x1cd0('0x3'));var rp=require(_0x1cd0('0x4'));var attributes=require(_0x1cd0('0x5'));module[_0x1cd0('0x6')]=function(_0x1af05c,_0x4ea77c){return _0x1af05c['define']('SquareMessage',attributes,{'tableName':_0x1cd0('0x7'),'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 596322f..49c16f1 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 _0x64df=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','SquareMessage,\x20%s,\x20%s','result','catch','CreateSquareMessage','SquareMessage','create','body','options','util','moment','bluebird','randomstring','ioredis'];(function(_0x49053a,_0x3b32fc){var _0x48f74c=function(_0x68c87b){while(--_0x68c87b){_0x49053a['push'](_0x49053a['shift']());}};_0x48f74c(++_0x3b32fc);}(_0x64df,0x167));var _0xf64d=function(_0x5b788c,_0x246974){_0x5b788c=_0x5b788c-0x0;var _0x4736d1=_0x64df[_0x5b788c];return _0x4736d1;};'use strict';var _=require('lodash');var util=require(_0xf64d('0x0'));var moment=require(_0xf64d('0x1'));var BPromise=require(_0xf64d('0x2'));var rs=require(_0xf64d('0x3'));var fs=require('fs');var Redis=require(_0xf64d('0x4'));var db=require(_0xf64d('0x5'))['db'];var utils=require(_0xf64d('0x6'));var logger=require(_0xf64d('0x7'))('rpc');var config=require(_0xf64d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf64d('0x9')][_0xf64d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x386349,_0x3314ff,_0x49f6fe){return new BPromise(function(_0x47f9ec,_0xe4083e){return client[_0xf64d('0xb')](_0x386349,_0x49f6fe)[_0xf64d('0xc')](function(_0x1892c5){logger['info']('SquareMessage,\x20%s,\x20%s',_0x3314ff,_0xf64d('0xd'));logger[_0xf64d('0xe')](_0xf64d('0xf'),_0x3314ff,'request\x20sent',JSON[_0xf64d('0x10')](_0x1892c5));if(_0x1892c5[_0xf64d('0x11')]){if(_0x1892c5[_0xf64d('0x11')]['code']===0x1f4){logger[_0xf64d('0x11')]('SquareMessage,\x20%s,\x20%s',_0x3314ff,_0x1892c5[_0xf64d('0x11')][_0xf64d('0x12')]);return _0xe4083e(_0x1892c5[_0xf64d('0x11')][_0xf64d('0x12')]);}logger[_0xf64d('0x11')]('SquareMessage,\x20%s,\x20%s',_0x3314ff,_0x1892c5[_0xf64d('0x11')][_0xf64d('0x12')]);return _0x47f9ec(_0x1892c5[_0xf64d('0x11')][_0xf64d('0x12')]);}else{logger[_0xf64d('0x13')](_0xf64d('0x14'),_0x3314ff,_0xf64d('0xd'));_0x47f9ec(_0x1892c5[_0xf64d('0x15')][_0xf64d('0x12')]);}})[_0xf64d('0x16')](function(_0xd6f07){logger[_0xf64d('0x11')]('SquareMessage,\x20%s,\x20%s',_0x3314ff,_0xd6f07);_0xe4083e(_0xd6f07);});});}exports[_0xf64d('0x17')]=function(_0x502888){var _0x512a3e=this;return new Promise(function(_0x25900e,_0x4e5d09){return db[_0xf64d('0x18')][_0xf64d('0x19')](_0x502888[_0xf64d('0x1a')],{'raw':_0x502888[_0xf64d('0x1b')]?_0x502888['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2a7071){logger['info']('CreateSquareMessage',_0x502888);logger[_0xf64d('0xe')]('CreateSquareMessage',_0x502888,JSON['stringify'](_0x2a7071));_0x25900e(_0x2a7071);})[_0xf64d('0x16')](function(_0x2e85a8){logger[_0xf64d('0x11')](_0xf64d('0x17'),_0x2e85a8[_0xf64d('0x12')],_0x502888);_0x4e5d09(_0x512a3e[_0xf64d('0x11')](0x1f4,_0x2e85a8[_0xf64d('0x12')]));});});}; \ No newline at end of file +var _0xefcd=['SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xefcd,0x1c1));var _0xdefc=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xefcd[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xdefc('0x0'));var util=require(_0xdefc('0x1'));var moment=require(_0xdefc('0x2'));var BPromise=require(_0xdefc('0x3'));var rs=require(_0xdefc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdefc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdefc('0x6'))('rpc');var config=require(_0xdefc('0x7'));var jayson=require(_0xdefc('0x8'));var client=jayson[_0xdefc('0x9')][_0xdefc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x392c6b,_0x390fda,_0x2f9a7d){return new BPromise(function(_0x571275,_0x4e9548){return client['request'](_0x392c6b,_0x2f9a7d)[_0xdefc('0xb')](function(_0x3908ed){logger[_0xdefc('0xc')]('SquareMessage,\x20%s,\x20%s',_0x390fda,_0xdefc('0xd'));logger[_0xdefc('0xe')](_0xdefc('0xf'),_0x390fda,_0xdefc('0xd'),JSON[_0xdefc('0x10')](_0x3908ed));if(_0x3908ed[_0xdefc('0x11')]){if(_0x3908ed['error'][_0xdefc('0x12')]===0x1f4){logger['error'](_0xdefc('0x13'),_0x390fda,_0x3908ed[_0xdefc('0x11')]['message']);return _0x4e9548(_0x3908ed[_0xdefc('0x11')]['message']);}logger[_0xdefc('0x11')](_0xdefc('0x13'),_0x390fda,_0x3908ed[_0xdefc('0x11')][_0xdefc('0x14')]);return _0x571275(_0x3908ed[_0xdefc('0x11')][_0xdefc('0x14')]);}else{logger[_0xdefc('0xc')](_0xdefc('0x13'),_0x390fda,_0xdefc('0xd'));_0x571275(_0x3908ed[_0xdefc('0x15')][_0xdefc('0x14')]);}})[_0xdefc('0x16')](function(_0x58de56){logger[_0xdefc('0x11')](_0xdefc('0x13'),_0x390fda,_0x58de56);_0x4e9548(_0x58de56);});});}exports[_0xdefc('0x17')]=function(_0x2fcef5){var _0x92ef36=this;return new Promise(function(_0x187f13,_0x200aef){return db[_0xdefc('0x18')][_0xdefc('0x19')](_0x2fcef5[_0xdefc('0x1a')],{'raw':_0x2fcef5[_0xdefc('0x1b')]?_0x2fcef5['options'][_0xdefc('0x1c')]===undefined?!![]:![]:!![]})[_0xdefc('0xb')](function(_0x44a785){logger[_0xdefc('0xc')]('CreateSquareMessage',_0x2fcef5);logger[_0xdefc('0xe')](_0xdefc('0x17'),_0x2fcef5,JSON[_0xdefc('0x10')](_0x44a785));_0x187f13(_0x44a785);})[_0xdefc('0x16')](function(_0x26b25f){logger[_0xdefc('0x11')](_0xdefc('0x17'),_0x26b25f[_0xdefc('0x14')],_0x2fcef5);_0x200aef(_0x92ef36[_0xdefc('0x11')](0x1f4,_0x26b25f[_0xdefc('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 6762751..17e775e 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 _0x2242=['util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/test','15s','test','post','create','put','update','destroy','exports','multer'];(function(_0x3cb66e,_0xf50c35){var _0x24e6c2=function(_0x10cec5){while(--_0x10cec5){_0x3cb66e['push'](_0x3cb66e['shift']());}};_0x24e6c2(++_0xf50c35);}(_0x2242,0x1a3));var _0x2224=function(_0xe1f0b9,_0x5ca49d){_0xe1f0b9=_0xe1f0b9-0x0;var _0x4bfb5a=_0x2242[_0xe1f0b9];return _0x4bfb5a;};'use strict';var multer=require(_0x2224('0x0'));var util=require(_0x2224('0x1'));var path=require(_0x2224('0x2'));var timeout=require('connect-timeout');var express=require(_0x2224('0x3'));var router=express[_0x2224('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2224('0x5'));var config=require(_0x2224('0x6'));var controller=require('./squareOdbc.controller');router[_0x2224('0x7')]('/',auth[_0x2224('0x8')](),controller[_0x2224('0x9')]);router['get'](_0x2224('0xa'),auth[_0x2224('0x8')](),controller[_0x2224('0xb')]);router[_0x2224('0x7')](_0x2224('0xc'),auth[_0x2224('0x8')](),timeout(_0x2224('0xd')),controller[_0x2224('0xe')]);router[_0x2224('0xf')]('/',auth[_0x2224('0x8')](),controller[_0x2224('0x10')]);router[_0x2224('0x11')](_0x2224('0xa'),auth[_0x2224('0x8')](),controller[_0x2224('0x12')]);router['delete']('/:id',auth[_0x2224('0x8')](),controller[_0x2224('0x13')]);module[_0x2224('0x14')]=router; \ No newline at end of file +var _0xfa7c=['index','get','/:id','show','/:id/test','15s','test','create','put','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated'];(function(_0x316b05,_0xad1b45){var _0x2262bc=function(_0x3e0f76){while(--_0x3e0f76){_0x316b05['push'](_0x316b05['shift']());}};_0x2262bc(++_0xad1b45);}(_0xfa7c,0x15b));var _0xcfa7=function(_0x576629,_0x5e72f4){_0x576629=_0x576629-0x0;var _0x49aaaa=_0xfa7c[_0x576629];return _0x49aaaa;};'use strict';var multer=require(_0xcfa7('0x0'));var util=require('util');var path=require(_0xcfa7('0x1'));var timeout=require(_0xcfa7('0x2'));var express=require(_0xcfa7('0x3'));var router=express[_0xcfa7('0x4')]();var auth=require(_0xcfa7('0x5'));var interaction=require(_0xcfa7('0x6'));var config=require(_0xcfa7('0x7'));var controller=require(_0xcfa7('0x8'));router['get']('/',auth[_0xcfa7('0x9')](),controller[_0xcfa7('0xa')]);router[_0xcfa7('0xb')](_0xcfa7('0xc'),auth['isAuthenticated'](),controller[_0xcfa7('0xd')]);router[_0xcfa7('0xb')](_0xcfa7('0xe'),auth[_0xcfa7('0x9')](),timeout(_0xcfa7('0xf')),controller[_0xcfa7('0x10')]);router['post']('/',auth[_0xcfa7('0x9')](),controller[_0xcfa7('0x11')]);router[_0xcfa7('0x12')](_0xcfa7('0xc'),auth[_0xcfa7('0x9')](),controller['update']);router['delete'](_0xcfa7('0xc'),auth['isAuthenticated'](),controller[_0xcfa7('0x13')]);module[_0xcfa7('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 5b8acbc..4d5281b 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 _0x3552=['sequelize','exports','STRING','name'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3552,0x194));var _0x2355=function(_0x2041d4,_0x258330){_0x2041d4=_0x2041d4-0x0;var _0x5baa04=_0x3552[_0x2041d4];return _0x5baa04;};'use strict';var Sequelize=require(_0x2355('0x0'));module[_0x2355('0x1')]={'name':{'type':Sequelize[_0x2355('0x2')],'unique':_0x2355('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x2355('0x2')]},'description':{'type':Sequelize[_0x2355('0x2')]}}; \ No newline at end of file +var _0xcb1e=['exports','STRING'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xcb1e,0x168));var _0xecb1=function(_0x382e89,_0x4768c0){_0x382e89=_0x382e89-0x0;var _0x3a1318=_0xcb1e[_0x382e89];return _0x3a1318;};'use strict';var Sequelize=require('sequelize');module[_0xecb1('0x0')]={'name':{'type':Sequelize[_0xecb1('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0xecb1('0x1')]},'description':{'type':Sequelize[_0xecb1('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 0fe45ca..04a294b 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 _0x3f49=['apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','SquareOdbc','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','add','day','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','test','dsn','odbc','openSync','closeSync','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','api','../../config/utils','../../mysqldb','status','end','json','count','offset','set'];(function(_0x485b93,_0x4e6489){var _0x18bc60=function(_0x4bcea7){while(--_0x4bcea7){_0x485b93['push'](_0x485b93['shift']());}};_0x18bc60(++_0x4e6489);}(_0x3f49,0x1e7));var _0x93f4=function(_0x2e545a,_0x82517a){_0x2e545a=_0x2e545a-0x0;var _0x3fca76=_0x3f49[_0x2e545a];return _0x3fca76;};'use strict';var pdf=require(_0x93f4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x93f4('0x1'));var zipdir=require(_0x93f4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x93f4('0x3'));var BPromise=require(_0x93f4('0x4'));var Mustache=require(_0x93f4('0x5'));var util=require('util');var path=require(_0x93f4('0x6'));var sox=require(_0x93f4('0x7'));var csv=require(_0x93f4('0x8'));var ejs=require(_0x93f4('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x93f4('0xa'));var jsforce=require(_0x93f4('0xb'));var deskjs=require(_0x93f4('0xc'));var toCsv=require('to-csv');var querystring=require(_0x93f4('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var qs=require(_0x93f4('0xe'));var logger=require('../../config/logger')(_0x93f4('0xf'));var utils=require(_0x93f4('0x10'));var config=require('../../config/environment');var db=require(_0x93f4('0x11'))['db'];function respondWithStatusCode(_0x3a88e3,_0x23c643){_0x23c643=_0x23c643||0xcc;return function(_0x35e1fd){if(_0x35e1fd){return _0x3a88e3['sendStatus'](_0x23c643);}return _0x3a88e3[_0x93f4('0x12')](_0x23c643)[_0x93f4('0x13')]();};}function respondWithResult(_0x2e99d4,_0x59b96){_0x59b96=_0x59b96||0xc8;return function(_0x5cf5a4){if(_0x5cf5a4){return _0x2e99d4[_0x93f4('0x12')](_0x59b96)[_0x93f4('0x14')](_0x5cf5a4);}};}function respondWithFilteredResult(_0x23448e,_0x5336f8){return function(_0x53981f){if(_0x53981f){var _0x43cbde=_0x53981f[_0x93f4('0x15')],_0x191606=_0x5336f8['offset'],_0xfcf3f9=_0x5336f8[_0x93f4('0x16')]+_0x5336f8['limit'],_0x393b61;if(_0xfcf3f9>=_0x43cbde){_0xfcf3f9=_0x43cbde;_0x393b61=0xc8;}else{_0x393b61=0xce;}_0x23448e[_0x93f4('0x12')](_0x393b61);return _0x23448e[_0x93f4('0x17')]('Content-Range',_0x191606+'-'+_0xfcf3f9+'/'+_0x43cbde)[_0x93f4('0x14')](_0x53981f);}return null;};}function patchUpdates(_0x1ded02){return function(_0x4a9047){try{jsonpatch[_0x93f4('0x18')](_0x4a9047,_0x1ded02,!![]);}catch(_0x625302){return BPromise[_0x93f4('0x19')](_0x625302);}return _0x4a9047[_0x93f4('0x1a')]();};}function saveUpdates(_0x525bfd,_0x10f879){return function(_0x408d34){if(_0x408d34){return _0x408d34[_0x93f4('0x1b')](_0x525bfd)[_0x93f4('0x1c')](function(_0x572fdb){return _0x572fdb;});}return null;};}function removeEntity(_0x3a3abc,_0x4f0626){return function(_0x1f158f){if(_0x1f158f){return _0x1f158f[_0x93f4('0x1d')]()[_0x93f4('0x1c')](function(){_0x3a3abc[_0x93f4('0x12')](0xcc)[_0x93f4('0x13')]();});}};}function handleEntityNotFound(_0x16e961,_0x3db220){return function(_0xbf3a66){if(!_0xbf3a66){_0x16e961[_0x93f4('0x1e')](0x194);}return _0xbf3a66;};}function handleError(_0x151273,_0x16a8f0){_0x16a8f0=_0x16a8f0||0x1f4;return function(_0x391d0){logger[_0x93f4('0x1f')](_0x391d0[_0x93f4('0x20')]);if(_0x391d0[_0x93f4('0x21')]){delete _0x391d0[_0x93f4('0x21')];}_0x151273['status'](_0x16a8f0)[_0x93f4('0x22')](_0x391d0);};}exports['index']=function(_0x52e2c4,_0x2871ed){var _0xbfb39f={},_0x962b1d={},_0x2918e0={'count':0x0,'rows':[]};var _0x1f9ed9=db[_0x93f4('0x23')][_0x93f4('0x24')];_0x962b1d[_0x93f4('0x25')]=_[_0x93f4('0x26')](_0x1f9ed9);var _0x501ac4={'dateStart':_0x52e2c4[_0x93f4('0x27')]['dateStart'],'dateEnd':_0x52e2c4[_0x93f4('0x27')]['dateEnd']};delete _0x52e2c4[_0x93f4('0x27')][_0x93f4('0x28')];delete _0x52e2c4[_0x93f4('0x27')][_0x93f4('0x29')];_0x962b1d[_0x93f4('0x27')]=_[_0x93f4('0x26')](_0x52e2c4[_0x93f4('0x27')]);_0x962b1d[_0x93f4('0x2a')]=_[_0x93f4('0x2b')](_0x962b1d['model'],_0x962b1d[_0x93f4('0x27')]);_0xbfb39f[_0x93f4('0x2c')]=_[_0x93f4('0x2b')](_0x962b1d['model'],qs['fields'](_0x52e2c4[_0x93f4('0x27')][_0x93f4('0x2d')]));_0xbfb39f[_0x93f4('0x2c')]=_0xbfb39f['attributes'][_0x93f4('0x2e')]?_0xbfb39f[_0x93f4('0x2c')]:_0x962b1d[_0x93f4('0x25')];if(!_0x52e2c4[_0x93f4('0x27')][_0x93f4('0x2f')]('nolimit')){_0xbfb39f[_0x93f4('0x30')]=qs['limit'](_0x52e2c4[_0x93f4('0x27')][_0x93f4('0x30')]);_0xbfb39f[_0x93f4('0x16')]=qs['offset'](_0x52e2c4['query'][_0x93f4('0x16')]);}_0xbfb39f[_0x93f4('0x31')]=qs[_0x93f4('0x32')](_0x52e2c4[_0x93f4('0x27')][_0x93f4('0x32')]);_0xbfb39f[_0x93f4('0x33')]=qs[_0x93f4('0x2a')](_[_0x93f4('0x34')](_0x52e2c4['query'],_0x962b1d[_0x93f4('0x2a')]));if(_0x501ac4[_0x93f4('0x28')]){if(_0x501ac4[_0x93f4('0x29')]){_0x501ac4[_0x93f4('0x29')]=moment(_0x501ac4[_0x93f4('0x29')])[_0x93f4('0x35')](0x1,'day');}else{_0x501ac4['dateEnd']=moment(_0x501ac4[_0x93f4('0x28')])[_0x93f4('0x35')](0x1,_0x93f4('0x36'));}_['merge'](_0xbfb39f[_0x93f4('0x33')],{'createdAt':{'$gte':_0x501ac4['dateStart'],'$lte':_0x501ac4[_0x93f4('0x29')]}});}if(_0x52e2c4['query'][_0x93f4('0x37')]){_0xbfb39f[_0x93f4('0x33')]=_[_0x93f4('0x38')](_0xbfb39f['where'],{'$or':_['map'](_0xbfb39f[_0x93f4('0x2c')],function(_0x25aeea){var _0x5bc275={};_0x5bc275[_0x25aeea]={'$like':'%'+_0x52e2c4['query'][_0x93f4('0x37')]+'%'};return _0x5bc275;})});}_0xbfb39f=_['merge']({},_0xbfb39f,_0x52e2c4[_0x93f4('0x39')]);var _0x378025={'where':_0xbfb39f[_0x93f4('0x33')]};return db[_0x93f4('0x23')][_0x93f4('0x15')](_0x378025)[_0x93f4('0x1c')](function(_0x4b698b){_0x2918e0[_0x93f4('0x15')]=_0x4b698b;if(_0x52e2c4['query'][_0x93f4('0x3a')]){_0xbfb39f[_0x93f4('0x3b')]=[{'all':!![]}];}return db[_0x93f4('0x23')][_0x93f4('0x3c')](_0xbfb39f);})['then'](function(_0x8818e6){_0x2918e0[_0x93f4('0x3d')]=_0x8818e6;return _0x2918e0;})[_0x93f4('0x1c')](respondWithFilteredResult(_0x2871ed,_0xbfb39f))[_0x93f4('0x3e')](handleError(_0x2871ed,null));};exports[_0x93f4('0x3f')]=function(_0x14fc70,_0xe7d319){var _0x1f0147={'raw':!![],'where':{'id':_0x14fc70['params']['id']}},_0x53fea8={};_0x53fea8[_0x93f4('0x25')]=_[_0x93f4('0x26')](db[_0x93f4('0x23')][_0x93f4('0x24')]);_0x53fea8['query']=_['keys'](_0x14fc70[_0x93f4('0x27')]);_0x53fea8['filters']=_[_0x93f4('0x2b')](_0x53fea8[_0x93f4('0x25')],_0x53fea8[_0x93f4('0x27')]);_0x1f0147[_0x93f4('0x2c')]=_[_0x93f4('0x2b')](_0x53fea8[_0x93f4('0x25')],qs[_0x93f4('0x2d')](_0x14fc70['query'][_0x93f4('0x2d')]));_0x1f0147[_0x93f4('0x2c')]=_0x1f0147['attributes'][_0x93f4('0x2e')]?_0x1f0147['attributes']:_0x53fea8['model'];if(_0x14fc70['query'][_0x93f4('0x3a')]){_0x1f0147[_0x93f4('0x3b')]=[{'all':!![]}];}_0x1f0147=_['merge']({},_0x1f0147,_0x14fc70[_0x93f4('0x39')]);return db['SquareOdbc'][_0x93f4('0x40')](_0x1f0147)[_0x93f4('0x1c')](handleEntityNotFound(_0xe7d319,null))['then'](respondWithResult(_0xe7d319,null))[_0x93f4('0x3e')](handleError(_0xe7d319,null));};exports[_0x93f4('0x41')]=function(_0x32883b,_0x1bcd49){return db['SquareOdbc'][_0x93f4('0x41')](_0x32883b[_0x93f4('0x42')],{})[_0x93f4('0x1c')](respondWithResult(_0x1bcd49,0xc9))['catch'](handleError(_0x1bcd49,null));};exports['update']=function(_0x1400d8,_0x2a792d){if(_0x1400d8[_0x93f4('0x42')]['id']){delete _0x1400d8[_0x93f4('0x42')]['id'];}return db[_0x93f4('0x23')]['find']({'where':{'id':_0x1400d8[_0x93f4('0x43')]['id']}})[_0x93f4('0x1c')](handleEntityNotFound(_0x2a792d,null))[_0x93f4('0x1c')](saveUpdates(_0x1400d8['body'],null))[_0x93f4('0x1c')](respondWithResult(_0x2a792d,null))[_0x93f4('0x3e')](handleError(_0x2a792d,null));};exports[_0x93f4('0x1d')]=function(_0x5c2c9b,_0x5b2d1c){return db[_0x93f4('0x23')][_0x93f4('0x40')]({'where':{'id':_0x5c2c9b['params']['id']}})[_0x93f4('0x1c')](handleEntityNotFound(_0x5b2d1c,null))[_0x93f4('0x1c')](removeEntity(_0x5b2d1c,null))[_0x93f4('0x3e')](handleError(_0x5b2d1c,null));};exports[_0x93f4('0x44')]=function(_0x490cdb,_0x32b07d,_0x4ba212){var _0x25f062;return db[_0x93f4('0x23')][_0x93f4('0x40')]({'where':{'id':_0x490cdb[_0x93f4('0x43')]['id']},'attributes':['id',_0x93f4('0x45')]})[_0x93f4('0x1c')](handleEntityNotFound(_0x32b07d,null))[_0x93f4('0x1c')](function(_0x111fa5){if(_0x111fa5){var _0x138f9c=require(_0x93f4('0x46'))();_0x138f9c[_0x93f4('0x47')](_0x111fa5[_0x93f4('0x45')]);_0x138f9c[_0x93f4('0x48')]();return _0x111fa5;}})[_0x93f4('0x1c')](respondWithResult(_0x32b07d,null))['catch'](handleError(_0x32b07d,null));}; \ No newline at end of file +var _0xee66=['desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','sendStatus','end','json','count','offset','limit','status','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','add','day','merge','filter','map','options','SquareOdbc','includeAll','findAll','show','params','include','find','create','body','catch','test','dsn','odbc','openSync','eml-format','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x5dd996,_0xe67af2){var _0x433806=function(_0x149cae){while(--_0x149cae){_0x5dd996['push'](_0x5dd996['shift']());}};_0x433806(++_0xe67af2);}(_0xee66,0xcf));var _0x6ee6=function(_0x251fa4,_0x3d5860){_0x251fa4=_0x251fa4-0x0;var _0x453047=_0xee66[_0x251fa4];return _0x453047;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6ee6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6ee6('0x1'));var rp=require(_0x6ee6('0x2'));var moment=require(_0x6ee6('0x3'));var BPromise=require(_0x6ee6('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6ee6('0x5'));var sox=require(_0x6ee6('0x6'));var csv=require(_0x6ee6('0x7'));var ejs=require(_0x6ee6('0x8'));var fs=require('fs');var _=require(_0x6ee6('0x9'));var squel=require(_0x6ee6('0xa'));var crypto=require('crypto');var jsforce=require(_0x6ee6('0xb'));var deskjs=require(_0x6ee6('0xc'));var toCsv=require(_0x6ee6('0x7'));var querystring=require(_0x6ee6('0xd'));var Papa=require(_0x6ee6('0xe'));var Redis=require('ioredis');var qs=require(_0x6ee6('0xf'));var logger=require('../../config/logger')(_0x6ee6('0x10'));var utils=require(_0x6ee6('0x11'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2dcad6,_0xd53262){_0xd53262=_0xd53262||0xcc;return function(_0x2345c5){if(_0x2345c5){return _0x2dcad6[_0x6ee6('0x12')](_0xd53262);}return _0x2dcad6['status'](_0xd53262)[_0x6ee6('0x13')]();};}function respondWithResult(_0x301e86,_0xed7252){_0xed7252=_0xed7252||0xc8;return function(_0x562fd7){if(_0x562fd7){return _0x301e86['status'](_0xed7252)[_0x6ee6('0x14')](_0x562fd7);}};}function respondWithFilteredResult(_0x4b4639,_0x7aa47){return function(_0x37fd8b){if(_0x37fd8b){var _0x11c988=_0x37fd8b[_0x6ee6('0x15')],_0x53479a=_0x7aa47['offset'],_0x3a8d9b=_0x7aa47[_0x6ee6('0x16')]+_0x7aa47[_0x6ee6('0x17')],_0x2c6361;if(_0x3a8d9b>=_0x11c988){_0x3a8d9b=_0x11c988;_0x2c6361=0xc8;}else{_0x2c6361=0xce;}_0x4b4639[_0x6ee6('0x18')](_0x2c6361);return _0x4b4639['set'](_0x6ee6('0x19'),_0x53479a+'-'+_0x3a8d9b+'/'+_0x11c988)[_0x6ee6('0x14')](_0x37fd8b);}return null;};}function patchUpdates(_0x30df25){return function(_0x3d96fb){try{jsonpatch[_0x6ee6('0x1a')](_0x3d96fb,_0x30df25,!![]);}catch(_0x21320f){return BPromise[_0x6ee6('0x1b')](_0x21320f);}return _0x3d96fb[_0x6ee6('0x1c')]();};}function saveUpdates(_0x594952,_0x63d956){return function(_0x14902e){if(_0x14902e){return _0x14902e[_0x6ee6('0x1d')](_0x594952)[_0x6ee6('0x1e')](function(_0x4b24d6){return _0x4b24d6;});}return null;};}function removeEntity(_0x40518f,_0x5d4bef){return function(_0x51ee77){if(_0x51ee77){return _0x51ee77[_0x6ee6('0x1f')]()['then'](function(){_0x40518f[_0x6ee6('0x18')](0xcc)[_0x6ee6('0x13')]();});}};}function handleEntityNotFound(_0x416c96,_0x10adfa){return function(_0x2db3ab){if(!_0x2db3ab){_0x416c96['sendStatus'](0x194);}return _0x2db3ab;};}function handleError(_0x100e99,_0x17a720){_0x17a720=_0x17a720||0x1f4;return function(_0x20a9c9){logger[_0x6ee6('0x20')](_0x20a9c9[_0x6ee6('0x21')]);if(_0x20a9c9[_0x6ee6('0x22')]){delete _0x20a9c9[_0x6ee6('0x22')];}_0x100e99[_0x6ee6('0x18')](_0x17a720)[_0x6ee6('0x23')](_0x20a9c9);};}exports[_0x6ee6('0x24')]=function(_0x52f55a,_0x4be1f1){var _0x32f30f={},_0x3ea1b8={},_0x4697df={'count':0x0,'rows':[]};var _0x454123=db['SquareOdbc'][_0x6ee6('0x25')];_0x3ea1b8[_0x6ee6('0x26')]=_[_0x6ee6('0x27')](_0x454123);var _0x363c3d={'dateStart':_0x52f55a[_0x6ee6('0x28')]['dateStart'],'dateEnd':_0x52f55a[_0x6ee6('0x28')][_0x6ee6('0x29')]};delete _0x52f55a[_0x6ee6('0x28')][_0x6ee6('0x2a')];delete _0x52f55a[_0x6ee6('0x28')][_0x6ee6('0x29')];_0x3ea1b8['query']=_['keys'](_0x52f55a[_0x6ee6('0x28')]);_0x3ea1b8[_0x6ee6('0x2b')]=_[_0x6ee6('0x2c')](_0x3ea1b8[_0x6ee6('0x26')],_0x3ea1b8['query']);_0x32f30f[_0x6ee6('0x2d')]=_[_0x6ee6('0x2c')](_0x3ea1b8[_0x6ee6('0x26')],qs[_0x6ee6('0x2e')](_0x52f55a[_0x6ee6('0x28')]['fields']));_0x32f30f[_0x6ee6('0x2d')]=_0x32f30f[_0x6ee6('0x2d')][_0x6ee6('0x2f')]?_0x32f30f[_0x6ee6('0x2d')]:_0x3ea1b8['model'];if(!_0x52f55a[_0x6ee6('0x28')][_0x6ee6('0x30')](_0x6ee6('0x31'))){_0x32f30f[_0x6ee6('0x17')]=qs['limit'](_0x52f55a['query'][_0x6ee6('0x17')]);_0x32f30f[_0x6ee6('0x16')]=qs[_0x6ee6('0x16')](_0x52f55a[_0x6ee6('0x28')][_0x6ee6('0x16')]);}_0x32f30f[_0x6ee6('0x32')]=qs[_0x6ee6('0x33')](_0x52f55a['query'][_0x6ee6('0x33')]);_0x32f30f[_0x6ee6('0x34')]=qs[_0x6ee6('0x2b')](_['pick'](_0x52f55a[_0x6ee6('0x28')],_0x3ea1b8['filters']));if(_0x363c3d[_0x6ee6('0x2a')]){if(_0x363c3d[_0x6ee6('0x29')]){_0x363c3d[_0x6ee6('0x29')]=moment(_0x363c3d['dateEnd'])['add'](0x1,'day');}else{_0x363c3d[_0x6ee6('0x29')]=moment(_0x363c3d['dateStart'])[_0x6ee6('0x35')](0x1,_0x6ee6('0x36'));}_[_0x6ee6('0x37')](_0x32f30f['where'],{'createdAt':{'$gte':_0x363c3d[_0x6ee6('0x2a')],'$lte':_0x363c3d[_0x6ee6('0x29')]}});}if(_0x52f55a[_0x6ee6('0x28')][_0x6ee6('0x38')]){_0x32f30f[_0x6ee6('0x34')]=_[_0x6ee6('0x37')](_0x32f30f['where'],{'$or':_[_0x6ee6('0x39')](_0x32f30f['attributes'],function(_0x15ff79){var _0x42ddb8={};_0x42ddb8[_0x15ff79]={'$like':'%'+_0x52f55a[_0x6ee6('0x28')]['filter']+'%'};return _0x42ddb8;})});}_0x32f30f=_[_0x6ee6('0x37')]({},_0x32f30f,_0x52f55a[_0x6ee6('0x3a')]);var _0x257d39={'where':_0x32f30f[_0x6ee6('0x34')]};return db[_0x6ee6('0x3b')][_0x6ee6('0x15')](_0x257d39)[_0x6ee6('0x1e')](function(_0x2078f6){_0x4697df[_0x6ee6('0x15')]=_0x2078f6;if(_0x52f55a[_0x6ee6('0x28')][_0x6ee6('0x3c')]){_0x32f30f['include']=[{'all':!![]}];}return db['SquareOdbc'][_0x6ee6('0x3d')](_0x32f30f);})[_0x6ee6('0x1e')](function(_0x4ab5b2){_0x4697df['rows']=_0x4ab5b2;return _0x4697df;})['then'](respondWithFilteredResult(_0x4be1f1,_0x32f30f))['catch'](handleError(_0x4be1f1,null));};exports[_0x6ee6('0x3e')]=function(_0x22451e,_0x5ef388){var _0x5db8a4={'raw':!![],'where':{'id':_0x22451e[_0x6ee6('0x3f')]['id']}},_0xa9d092={};_0xa9d092[_0x6ee6('0x26')]=_[_0x6ee6('0x27')](db[_0x6ee6('0x3b')][_0x6ee6('0x25')]);_0xa9d092['query']=_[_0x6ee6('0x27')](_0x22451e[_0x6ee6('0x28')]);_0xa9d092[_0x6ee6('0x2b')]=_[_0x6ee6('0x2c')](_0xa9d092[_0x6ee6('0x26')],_0xa9d092[_0x6ee6('0x28')]);_0x5db8a4[_0x6ee6('0x2d')]=_[_0x6ee6('0x2c')](_0xa9d092['model'],qs[_0x6ee6('0x2e')](_0x22451e[_0x6ee6('0x28')]['fields']));_0x5db8a4['attributes']=_0x5db8a4['attributes'][_0x6ee6('0x2f')]?_0x5db8a4[_0x6ee6('0x2d')]:_0xa9d092[_0x6ee6('0x26')];if(_0x22451e[_0x6ee6('0x28')][_0x6ee6('0x3c')]){_0x5db8a4[_0x6ee6('0x40')]=[{'all':!![]}];}_0x5db8a4=_[_0x6ee6('0x37')]({},_0x5db8a4,_0x22451e[_0x6ee6('0x3a')]);return db[_0x6ee6('0x3b')][_0x6ee6('0x41')](_0x5db8a4)['then'](handleEntityNotFound(_0x5ef388,null))[_0x6ee6('0x1e')](respondWithResult(_0x5ef388,null))['catch'](handleError(_0x5ef388,null));};exports[_0x6ee6('0x42')]=function(_0x14cd56,_0x5f0840){return db['SquareOdbc']['create'](_0x14cd56[_0x6ee6('0x43')],{})[_0x6ee6('0x1e')](respondWithResult(_0x5f0840,0xc9))['catch'](handleError(_0x5f0840,null));};exports['update']=function(_0x34ef92,_0x1bd0d9){if(_0x34ef92[_0x6ee6('0x43')]['id']){delete _0x34ef92[_0x6ee6('0x43')]['id'];}return db[_0x6ee6('0x3b')][_0x6ee6('0x41')]({'where':{'id':_0x34ef92[_0x6ee6('0x3f')]['id']}})[_0x6ee6('0x1e')](handleEntityNotFound(_0x1bd0d9,null))[_0x6ee6('0x1e')](saveUpdates(_0x34ef92['body'],null))[_0x6ee6('0x1e')](respondWithResult(_0x1bd0d9,null))['catch'](handleError(_0x1bd0d9,null));};exports[_0x6ee6('0x1f')]=function(_0x450814,_0x4bd538){return db[_0x6ee6('0x3b')][_0x6ee6('0x41')]({'where':{'id':_0x450814[_0x6ee6('0x3f')]['id']}})[_0x6ee6('0x1e')](handleEntityNotFound(_0x4bd538,null))[_0x6ee6('0x1e')](removeEntity(_0x4bd538,null))[_0x6ee6('0x44')](handleError(_0x4bd538,null));};exports[_0x6ee6('0x45')]=function(_0x510b24,_0x5ecff7,_0x5cd437){var _0x908a6b;return db[_0x6ee6('0x3b')][_0x6ee6('0x41')]({'where':{'id':_0x510b24[_0x6ee6('0x3f')]['id']},'attributes':['id',_0x6ee6('0x46')]})[_0x6ee6('0x1e')](handleEntityNotFound(_0x5ecff7,null))[_0x6ee6('0x1e')](function(_0x452d72){if(_0x452d72){var _0x52d5e5=require(_0x6ee6('0x47'))();_0x52d5e5[_0x6ee6('0x48')](_0x452d72[_0x6ee6('0x46')]);_0x52d5e5['closeSync']();return _0x452d72;}})[_0x6ee6('0x1e')](respondWithResult(_0x5ecff7,null))['catch'](handleError(_0x5ecff7,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 6e50b87..11331ce 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 _0x750a=['./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','util','moment','bluebird','request-promise'];(function(_0x4247d7,_0x2cba99){var _0xc6febc=function(_0x4d5f9c){while(--_0x4d5f9c){_0x4247d7['push'](_0x4247d7['shift']());}};_0xc6febc(++_0x2cba99);}(_0x750a,0x140));var _0xa750=function(_0x36af44,_0x5f9627){_0x36af44=_0x36af44-0x0;var _0xc668ea=_0x750a[_0x36af44];return _0xc668ea;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa750('0x1'));var BPromise=require(_0xa750('0x2'));var rp=require(_0xa750('0x3'));var attributes=require(_0xa750('0x4'));module[_0xa750('0x5')]=function(_0x43d704,_0x562911){return _0x43d704[_0xa750('0x6')](_0xa750('0x7'),attributes,{'tableName':_0xa750('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4522=['SquareOdbc','square_odbc','../../config/logger','api','moment','request-promise','./squareOdbc.attributes','exports','define'];(function(_0x4ed085,_0xc9dd09){var _0xc729d1=function(_0x68020e){while(--_0x68020e){_0x4ed085['push'](_0x4ed085['shift']());}};_0xc729d1(++_0xc9dd09);}(_0x4522,0x1a0));var _0x2452=function(_0x20deee,_0x493615){_0x20deee=_0x20deee-0x0;var _0x458387=_0x4522[_0x20deee];return _0x458387;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2452('0x0'))(_0x2452('0x1'));var moment=require(_0x2452('0x2'));var BPromise=require('bluebird');var rp=require(_0x2452('0x3'));var attributes=require(_0x2452('0x4'));module[_0x2452('0x5')]=function(_0x2f21dc,_0x34ff44){return _0x2f21dc[_0x2452('0x6')](_0x2452('0x7'),attributes,{'tableName':_0x2452('0x8'),'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 c38a27c..652ae91 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 _0x1fcf=['SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','include','map','model','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x9b2689,_0x57dde3){var _0x15d620=function(_0x703b20){while(--_0x703b20){_0x9b2689['push'](_0x9b2689['shift']());}};_0x15d620(++_0x57dde3);}(_0x1fcf,0x1f2));var _0xf1fc=function(_0x2420bd,_0xb58e4e){_0x2420bd=_0x2420bd-0x0;var _0x5610b8=_0x1fcf[_0x2420bd];return _0x5610b8;};'use strict';var _=require('lodash');var util=require(_0xf1fc('0x0'));var moment=require(_0xf1fc('0x1'));var BPromise=require(_0xf1fc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf1fc('0x3'));var db=require(_0xf1fc('0x4'))['db'];var utils=require(_0xf1fc('0x5'));var logger=require(_0xf1fc('0x6'))(_0xf1fc('0x7'));var config=require(_0xf1fc('0x8'));var jayson=require(_0xf1fc('0x9'));var client=jayson[_0xf1fc('0xa')][_0xf1fc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x290f89,_0x44d59b,_0x3c34ff){return new BPromise(function(_0x30a8a2,_0x1c87f0){return client['request'](_0x290f89,_0x3c34ff)[_0xf1fc('0xc')](function(_0x3da097){logger[_0xf1fc('0xd')](_0xf1fc('0xe'),_0x44d59b,_0xf1fc('0xf'));logger['debug'](_0xf1fc('0x10'),_0x44d59b,_0xf1fc('0xf'),JSON['stringify'](_0x3da097));if(_0x3da097[_0xf1fc('0x11')]){if(_0x3da097['error'][_0xf1fc('0x12')]===0x1f4){logger[_0xf1fc('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x44d59b,_0x3da097[_0xf1fc('0x11')][_0xf1fc('0x13')]);return _0x1c87f0(_0x3da097[_0xf1fc('0x11')][_0xf1fc('0x13')]);}logger['error'](_0xf1fc('0xe'),_0x44d59b,_0x3da097[_0xf1fc('0x11')][_0xf1fc('0x13')]);return _0x30a8a2(_0x3da097[_0xf1fc('0x11')][_0xf1fc('0x13')]);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x44d59b,_0xf1fc('0xf'));_0x30a8a2(_0x3da097[_0xf1fc('0x14')]['message']);}})[_0xf1fc('0x15')](function(_0x543e17){logger[_0xf1fc('0x11')](_0xf1fc('0xe'),_0x44d59b,_0x543e17);_0x1c87f0(_0x543e17);});});}exports[_0xf1fc('0x16')]=function(_0x218225){var _0x3f33be=this;return new Promise(function(_0x1abc5d,_0x3931c6){return db[_0xf1fc('0x17')][_0xf1fc('0x18')]({'raw':_0x218225[_0xf1fc('0x19')]?_0x218225[_0xf1fc('0x19')][_0xf1fc('0x1a')]===undefined?!![]:![]:!![],'where':_0x218225[_0xf1fc('0x19')]?_0x218225[_0xf1fc('0x19')][_0xf1fc('0x1b')]||null:null,'attributes':_0x218225['options']?_0x218225[_0xf1fc('0x19')][_0xf1fc('0x1c')]||null:null,'include':_0x218225[_0xf1fc('0x19')]?_0x218225['options'][_0xf1fc('0x1d')]?_['map'](_0x218225['options']['include'],function(_0xa69dd4){return{'model':db[_0xa69dd4['model']],'as':_0xa69dd4['as'],'attributes':_0xa69dd4['attributes'],'include':_0xa69dd4[_0xf1fc('0x1d')]?_[_0xf1fc('0x1e')](_0xa69dd4[_0xf1fc('0x1d')],function(_0x1e8633){return{'model':db[_0x1e8633[_0xf1fc('0x1f')]],'as':_0x1e8633['as'],'attributes':_0x1e8633['attributes'],'include':_0x1e8633['include']?_[_0xf1fc('0x1e')](_0x1e8633['include'],function(_0x17cced){return{'model':db[_0x17cced[_0xf1fc('0x1f')]],'as':_0x17cced['as'],'attributes':_0x17cced[_0xf1fc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf1fc('0xc')](function(_0x3b97a7){logger[_0xf1fc('0xd')](_0xf1fc('0x16'),_0x218225);logger['debug'](_0xf1fc('0x16'),_0x218225,JSON['stringify'](_0x3b97a7));_0x1abc5d(_0x3b97a7);})[_0xf1fc('0x15')](function(_0x54f232){logger[_0xf1fc('0x11')](_0xf1fc('0x16'),_0x54f232[_0xf1fc('0x13')],_0x218225);_0x3931c6(_0x3f33be['error'](0x1f4,_0x54f232[_0xf1fc('0x13')]));});});}; \ No newline at end of file +var _0x6232=['request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','include','model','map','then','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','SquareOdbc,\x20%s,\x20%s'];(function(_0x2ae909,_0x2b0d30){var _0x4b9085=function(_0x20e1be){while(--_0x20e1be){_0x2ae909['push'](_0x2ae909['shift']());}};_0x4b9085(++_0x2b0d30);}(_0x6232,0xeb));var _0x2623=function(_0x5afeea,_0x729435){_0x5afeea=_0x5afeea-0x0;var _0x5f057a=_0x6232[_0x5afeea];return _0x5f057a;};'use strict';var _=require(_0x2623('0x0'));var util=require('util');var moment=require(_0x2623('0x1'));var BPromise=require(_0x2623('0x2'));var rs=require(_0x2623('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2623('0x4'))['db'];var utils=require(_0x2623('0x5'));var logger=require(_0x2623('0x6'))(_0x2623('0x7'));var config=require('../../config/environment');var jayson=require(_0x2623('0x8'));var client=jayson[_0x2623('0x9')][_0x2623('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11ad39,_0x354118,_0xd23dbd){return new BPromise(function(_0x307d4d,_0x196b93){return client['request'](_0x11ad39,_0xd23dbd)['then'](function(_0x5961be){logger[_0x2623('0xb')](_0x2623('0xc'),_0x354118,_0x2623('0xd'));logger[_0x2623('0xe')](_0x2623('0xf'),_0x354118,'request\x20sent',JSON[_0x2623('0x10')](_0x5961be));if(_0x5961be['error']){if(_0x5961be[_0x2623('0x11')][_0x2623('0x12')]===0x1f4){logger[_0x2623('0x11')](_0x2623('0xc'),_0x354118,_0x5961be[_0x2623('0x11')][_0x2623('0x13')]);return _0x196b93(_0x5961be[_0x2623('0x11')]['message']);}logger[_0x2623('0x11')](_0x2623('0xc'),_0x354118,_0x5961be[_0x2623('0x11')][_0x2623('0x13')]);return _0x307d4d(_0x5961be[_0x2623('0x11')][_0x2623('0x13')]);}else{logger[_0x2623('0xb')](_0x2623('0xc'),_0x354118,_0x2623('0xd'));_0x307d4d(_0x5961be[_0x2623('0x14')][_0x2623('0x13')]);}})[_0x2623('0x15')](function(_0x240029){logger[_0x2623('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x354118,_0x240029);_0x196b93(_0x240029);});});}exports[_0x2623('0x16')]=function(_0x1a3ba8){var _0xb3b054=this;return new Promise(function(_0xc6e545,_0x5452e7){return db[_0x2623('0x17')][_0x2623('0x18')]({'raw':_0x1a3ba8['options']?_0x1a3ba8[_0x2623('0x19')][_0x2623('0x1a')]===undefined?!![]:![]:!![],'where':_0x1a3ba8[_0x2623('0x19')]?_0x1a3ba8[_0x2623('0x19')]['where']||null:null,'attributes':_0x1a3ba8[_0x2623('0x19')]?_0x1a3ba8['options']['attributes']||null:null,'include':_0x1a3ba8[_0x2623('0x19')]?_0x1a3ba8[_0x2623('0x19')]['include']?_['map'](_0x1a3ba8[_0x2623('0x19')][_0x2623('0x1b')],function(_0x47a9c3){return{'model':db[_0x47a9c3[_0x2623('0x1c')]],'as':_0x47a9c3['as'],'attributes':_0x47a9c3['attributes'],'include':_0x47a9c3[_0x2623('0x1b')]?_[_0x2623('0x1d')](_0x47a9c3[_0x2623('0x1b')],function(_0x55ba3c){return{'model':db[_0x55ba3c[_0x2623('0x1c')]],'as':_0x55ba3c['as'],'attributes':_0x55ba3c['attributes'],'include':_0x55ba3c['include']?_[_0x2623('0x1d')](_0x55ba3c[_0x2623('0x1b')],function(_0x3fc351){return{'model':db[_0x3fc351['model']],'as':_0x3fc351['as'],'attributes':_0x3fc351['attributes']};}):[]};}):[]};}):[]:[]})[_0x2623('0x1e')](function(_0x16a098){logger[_0x2623('0xb')](_0x2623('0x16'),_0x1a3ba8);logger[_0x2623('0xe')](_0x2623('0x16'),_0x1a3ba8,JSON['stringify'](_0x16a098));_0xc6e545(_0x16a098);})[_0x2623('0x15')](function(_0x21b451){logger[_0x2623('0x11')](_0x2623('0x16'),_0x21b451[_0x2623('0x13')],_0x1a3ba8);_0x5452e7(_0xb3b054[_0x2623('0x11')](0x1f4,_0x21b451[_0x2623('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 2f65ead..4235588 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 _0x31d7=['show','/:id/users','post','create','addUsers','put','update','destroy','delete','removeUsers','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','index','/:id'];(function(_0x177a2f,_0x3c2b31){var _0x591ad3=function(_0x30dbef){while(--_0x30dbef){_0x177a2f['push'](_0x177a2f['shift']());}};_0x591ad3(++_0x3c2b31);}(_0x31d7,0xc7));var _0x731d=function(_0x58b438,_0x5b2e42){_0x58b438=_0x58b438-0x0;var _0x18fea3=_0x31d7[_0x58b438];return _0x18fea3;};'use strict';var multer=require(_0x731d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x731d('0x1'));var express=require(_0x731d('0x2'));var router=express[_0x731d('0x3')]();var auth=require(_0x731d('0x4'));var interaction=require(_0x731d('0x5'));var config=require('../../config/environment');var controller=require(_0x731d('0x6'));router[_0x731d('0x7')]('/',auth[_0x731d('0x8')](),controller[_0x731d('0x9')]);router['get'](_0x731d('0xa'),auth[_0x731d('0x8')](),controller[_0x731d('0xb')]);router[_0x731d('0x7')](_0x731d('0xc'),auth[_0x731d('0x8')](),controller['getUsers']);router[_0x731d('0xd')]('/',auth[_0x731d('0x8')](),controller[_0x731d('0xe')]);router['post']('/:id/users',auth[_0x731d('0x8')](),controller[_0x731d('0xf')]);router[_0x731d('0x10')](_0x731d('0xa'),auth[_0x731d('0x8')](),controller[_0x731d('0x11')]);router['delete'](_0x731d('0xa'),auth[_0x731d('0x8')](),controller[_0x731d('0x12')]);router[_0x731d('0x13')](_0x731d('0xc'),auth[_0x731d('0x8')](),controller[_0x731d('0x14')]);module['exports']=router; \ No newline at end of file +var _0xb3b0=['update','delete','destroy','removeUsers','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/users','getUsers','post','create','put'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb3b0,0xa6));var _0x0b3b=function(_0x424f6b,_0x50dbaf){_0x424f6b=_0x424f6b-0x0;var _0x55a688=_0xb3b0[_0x424f6b];return _0x55a688;};'use strict';var multer=require(_0x0b3b('0x0'));var util=require(_0x0b3b('0x1'));var path=require(_0x0b3b('0x2'));var timeout=require('connect-timeout');var express=require(_0x0b3b('0x3'));var router=express[_0x0b3b('0x4')]();var auth=require(_0x0b3b('0x5'));var interaction=require(_0x0b3b('0x6'));var config=require(_0x0b3b('0x7'));var controller=require('./squareProject.controller');router[_0x0b3b('0x8')]('/',auth['isAuthenticated'](),controller[_0x0b3b('0x9')]);router[_0x0b3b('0x8')](_0x0b3b('0xa'),auth[_0x0b3b('0xb')](),controller[_0x0b3b('0xc')]);router[_0x0b3b('0x8')](_0x0b3b('0xd'),auth['isAuthenticated'](),controller[_0x0b3b('0xe')]);router[_0x0b3b('0xf')]('/',auth[_0x0b3b('0xb')](),controller[_0x0b3b('0x10')]);router[_0x0b3b('0xf')](_0x0b3b('0xd'),auth['isAuthenticated'](),controller['addUsers']);router[_0x0b3b('0x11')]('/:id',auth[_0x0b3b('0xb')](),controller[_0x0b3b('0x12')]);router[_0x0b3b('0x13')](_0x0b3b('0xa'),auth[_0x0b3b('0xb')](),controller[_0x0b3b('0x14')]);router[_0x0b3b('0x13')]('/:id/users',auth[_0x0b3b('0xb')](),controller[_0x0b3b('0x15')]);module[_0x0b3b('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 95c7f18..b119591 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 _0x7b84=['BLOB','long','getDataValue','preproduction','toString','utf8','production','sequelize','exports','STRING','TEXT'];(function(_0x1e3671,_0x9ae4fc){var _0x48d5f5=function(_0xfab713){while(--_0xfab713){_0x1e3671['push'](_0x1e3671['shift']());}};_0x48d5f5(++_0x9ae4fc);}(_0x7b84,0x167));var _0x47b8=function(_0x2e6fb5,_0x3f0aba){_0x2e6fb5=_0x2e6fb5-0x0;var _0x24a0ab=_0x7b84[_0x2e6fb5];return _0x24a0ab;};'use strict';var Sequelize=require(_0x47b8('0x0'));module[_0x47b8('0x1')]={'name':{'type':Sequelize[_0x47b8('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x47b8('0x3')]},'preproduction':{'type':Sequelize[_0x47b8('0x4')](_0x47b8('0x5')),'get':function(){if(this[_0x47b8('0x6')](_0x47b8('0x7'))){return this[_0x47b8('0x6')](_0x47b8('0x7'))[_0x47b8('0x8')](_0x47b8('0x9'));}}},'production':{'type':Sequelize[_0x47b8('0x4')](_0x47b8('0x5')),'get':function(){if(this[_0x47b8('0x6')](_0x47b8('0xa'))){return this[_0x47b8('0x6')](_0x47b8('0xa'))[_0x47b8('0x8')](_0x47b8('0x9'));}}}}; \ No newline at end of file +var _0xf31b=['STRING','name','TEXT','BLOB','getDataValue','preproduction','toString','long','utf8','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf31b,0x1a0));var _0xbf31=function(_0x2bc7fa,_0x12df78){_0x2bc7fa=_0x2bc7fa-0x0;var _0x5b65dd=_0xf31b[_0x2bc7fa];return _0x5b65dd;};'use strict';var Sequelize=require(_0xbf31('0x0'));module[_0xbf31('0x1')]={'name':{'type':Sequelize[_0xbf31('0x2')],'unique':_0xbf31('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xbf31('0x2')]},'notes':{'type':Sequelize[_0xbf31('0x4')]},'preproduction':{'type':Sequelize[_0xbf31('0x5')]('long'),'get':function(){if(this[_0xbf31('0x6')](_0xbf31('0x7'))){return this['getDataValue']('preproduction')[_0xbf31('0x8')]('utf8');}}},'production':{'type':Sequelize[_0xbf31('0x5')](_0xbf31('0x9')),'get':function(){if(this['getDataValue']('production')){return this[_0xbf31('0x6')]('production')[_0xbf31('0x8')](_0xbf31('0xa'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 9787c63..546b646 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 _0x4e8a=['socket.io-emitter','./squareProject.socket','register','sendStatus','status','json','offset','limit','Content-Range','apply','update','then','destroy','end','error','name','send','index','SquareProject','rawAttributes','model','keys','query','dateStart','filters','intersection','fields','attributes','hasOwnProperty','order','where','dateEnd','add','day','merge','map','filter','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','addUsers','ids','removeUsers','isArray','length','emit','userSquareProject:remove','getUsers','findOne','User','sort','pick','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost'];(function(_0x326499,_0x27f884){var _0x3ab059=function(_0x2ce9f7){while(--_0x2ce9f7){_0x326499['push'](_0x326499['shift']());}};_0x3ab059(++_0x27f884);}(_0x4e8a,0x91));var _0xa4e8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4e8a[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xa4e8('0x0'));var emlformat=require(_0xa4e8('0x1'));var rimraf=require(_0xa4e8('0x2'));var zipdir=require(_0xa4e8('0x3'));var jsonpatch=require(_0xa4e8('0x4'));var rp=require(_0xa4e8('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa4e8('0x6'));var path=require(_0xa4e8('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa4e8('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa4e8('0x9'));var crypto=require(_0xa4e8('0xa'));var jsforce=require(_0xa4e8('0xb'));var deskjs=require(_0xa4e8('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa4e8('0xd'));var Papa=require(_0xa4e8('0xe'));var Redis=require(_0xa4e8('0xf'));var qs=require('../../components/parsers/qs');var logger=require(_0xa4e8('0x10'))(_0xa4e8('0x11'));var utils=require(_0xa4e8('0x12'));var config=require(_0xa4e8('0x13'));var db=require(_0xa4e8('0x14'))['db'];config[_0xa4e8('0x15')]=_['defaults'](config['redis'],{'host':_0xa4e8('0x16'),'port':0x18eb});var socket=require(_0xa4e8('0x17'))(new Redis(config[_0xa4e8('0x15')]));require(_0xa4e8('0x18'))[_0xa4e8('0x19')](socket);function respondWithStatusCode(_0x29fd2f,_0x31d883){_0x31d883=_0x31d883||0xcc;return function(_0xa0195a){if(_0xa0195a){return _0x29fd2f[_0xa4e8('0x1a')](_0x31d883);}return _0x29fd2f[_0xa4e8('0x1b')](_0x31d883)['end']();};}function respondWithResult(_0x1b240d,_0x49ff9f){_0x49ff9f=_0x49ff9f||0xc8;return function(_0x5b4e91){if(_0x5b4e91){return _0x1b240d[_0xa4e8('0x1b')](_0x49ff9f)[_0xa4e8('0x1c')](_0x5b4e91);}};}function respondWithFilteredResult(_0x22cb50,_0xc57142){return function(_0x5080b4){if(_0x5080b4){var _0x5b6840=_0x5080b4['count'],_0xdde8b9=_0xc57142[_0xa4e8('0x1d')],_0x382b1c=_0xc57142['offset']+_0xc57142[_0xa4e8('0x1e')],_0x236fdb;if(_0x382b1c>=_0x5b6840){_0x382b1c=_0x5b6840;_0x236fdb=0xc8;}else{_0x236fdb=0xce;}_0x22cb50[_0xa4e8('0x1b')](_0x236fdb);return _0x22cb50['set'](_0xa4e8('0x1f'),_0xdde8b9+'-'+_0x382b1c+'/'+_0x5b6840)[_0xa4e8('0x1c')](_0x5080b4);}return null;};}function patchUpdates(_0x5c828c){return function(_0x256a3f){try{jsonpatch[_0xa4e8('0x20')](_0x256a3f,_0x5c828c,!![]);}catch(_0x26b90e){return BPromise['reject'](_0x26b90e);}return _0x256a3f['save']();};}function saveUpdates(_0x82ab7,_0x354f4e){return function(_0x47279f){if(_0x47279f){return _0x47279f[_0xa4e8('0x21')](_0x82ab7)[_0xa4e8('0x22')](function(_0x11b311){return _0x11b311;});}return null;};}function removeEntity(_0x2ca963,_0x124fff){return function(_0x5b3d89){if(_0x5b3d89){return _0x5b3d89[_0xa4e8('0x23')]()[_0xa4e8('0x22')](function(){_0x2ca963['status'](0xcc)[_0xa4e8('0x24')]();});}};}function handleEntityNotFound(_0x2e6e68,_0x230398){return function(_0x1dd0cc){if(!_0x1dd0cc){_0x2e6e68['sendStatus'](0x194);}return _0x1dd0cc;};}function handleError(_0x512d6c,_0x37f524){_0x37f524=_0x37f524||0x1f4;return function(_0x112009){logger[_0xa4e8('0x25')](_0x112009['stack']);if(_0x112009['name']){delete _0x112009[_0xa4e8('0x26')];}_0x512d6c[_0xa4e8('0x1b')](_0x37f524)[_0xa4e8('0x27')](_0x112009);};}exports[_0xa4e8('0x28')]=function(_0x5bbec3,_0x54aab1){var _0x44d591={},_0x2afe16={},_0x43877e={'count':0x0,'rows':[]};var _0x10dbc1=db[_0xa4e8('0x29')][_0xa4e8('0x2a')];_0x2afe16[_0xa4e8('0x2b')]=_[_0xa4e8('0x2c')](_0x10dbc1);var _0x556a1b={'dateStart':_0x5bbec3[_0xa4e8('0x2d')][_0xa4e8('0x2e')],'dateEnd':_0x5bbec3[_0xa4e8('0x2d')]['dateEnd']};delete _0x5bbec3['query']['dateStart'];delete _0x5bbec3[_0xa4e8('0x2d')]['dateEnd'];_0x2afe16[_0xa4e8('0x2d')]=_[_0xa4e8('0x2c')](_0x5bbec3[_0xa4e8('0x2d')]);_0x2afe16[_0xa4e8('0x2f')]=_[_0xa4e8('0x30')](_0x2afe16[_0xa4e8('0x2b')],_0x2afe16[_0xa4e8('0x2d')]);_0x44d591['attributes']=_[_0xa4e8('0x30')](_0x2afe16[_0xa4e8('0x2b')],qs[_0xa4e8('0x31')](_0x5bbec3[_0xa4e8('0x2d')]['fields']));_0x44d591['attributes']=_0x44d591[_0xa4e8('0x32')]['length']?_0x44d591[_0xa4e8('0x32')]:_0x2afe16['model'];if(!_0x5bbec3[_0xa4e8('0x2d')][_0xa4e8('0x33')]('nolimit')){_0x44d591[_0xa4e8('0x1e')]=qs['limit'](_0x5bbec3[_0xa4e8('0x2d')][_0xa4e8('0x1e')]);_0x44d591['offset']=qs['offset'](_0x5bbec3['query']['offset']);}_0x44d591[_0xa4e8('0x34')]=qs['sort'](_0x5bbec3[_0xa4e8('0x2d')]['sort']);_0x44d591[_0xa4e8('0x35')]=qs[_0xa4e8('0x2f')](_['pick'](_0x5bbec3['query'],_0x2afe16[_0xa4e8('0x2f')]));if(_0x556a1b[_0xa4e8('0x2e')]){if(_0x556a1b['dateEnd']){_0x556a1b[_0xa4e8('0x36')]=moment(_0x556a1b[_0xa4e8('0x36')])[_0xa4e8('0x37')](0x1,_0xa4e8('0x38'));}else{_0x556a1b['dateEnd']=moment(_0x556a1b[_0xa4e8('0x2e')])[_0xa4e8('0x37')](0x1,'day');}_[_0xa4e8('0x39')](_0x44d591['where'],{'createdAt':{'$gte':_0x556a1b[_0xa4e8('0x2e')],'$lte':_0x556a1b['dateEnd']}});}if(_0x5bbec3[_0xa4e8('0x2d')]['filter']){_0x44d591['where']=_['merge'](_0x44d591['where'],{'$or':_[_0xa4e8('0x3a')](_0x44d591[_0xa4e8('0x32')],function(_0x4c3115){var _0x51193a={};_0x51193a[_0x4c3115]={'$like':'%'+_0x5bbec3[_0xa4e8('0x2d')][_0xa4e8('0x3b')]+'%'};return _0x51193a;})});}_0x44d591=_[_0xa4e8('0x39')]({},_0x44d591,_0x5bbec3[_0xa4e8('0x3c')]);var _0x586c6a={'where':_0x44d591[_0xa4e8('0x35')]};return db['SquareProject']['count'](_0x586c6a)[_0xa4e8('0x22')](function(_0x37e818){_0x43877e[_0xa4e8('0x3d')]=_0x37e818;if(_0x5bbec3[_0xa4e8('0x2d')][_0xa4e8('0x3e')]){_0x44d591[_0xa4e8('0x3f')]=[{'all':!![]}];}return db[_0xa4e8('0x29')][_0xa4e8('0x40')](_0x44d591);})['then'](function(_0x13bbc6){_0x43877e[_0xa4e8('0x41')]=_0x13bbc6;return _0x43877e;})['then'](respondWithFilteredResult(_0x54aab1,_0x44d591))[_0xa4e8('0x42')](handleError(_0x54aab1,null));};exports[_0xa4e8('0x43')]=function(_0x423b9e,_0x154f4b){var _0x367966={'raw':![],'where':{'id':_0x423b9e[_0xa4e8('0x44')]['id']}},_0x1f1830={};_0x1f1830[_0xa4e8('0x2b')]=_[_0xa4e8('0x2c')](db['SquareProject']['rawAttributes']);_0x1f1830[_0xa4e8('0x2d')]=_[_0xa4e8('0x2c')](_0x423b9e['query']);_0x1f1830['filters']=_['intersection'](_0x1f1830[_0xa4e8('0x2b')],_0x1f1830[_0xa4e8('0x2d')]);_0x367966[_0xa4e8('0x32')]=_[_0xa4e8('0x30')](_0x1f1830[_0xa4e8('0x2b')],qs[_0xa4e8('0x31')](_0x423b9e[_0xa4e8('0x2d')][_0xa4e8('0x31')]));_0x367966[_0xa4e8('0x32')]=_0x367966[_0xa4e8('0x32')]['length']?_0x367966['attributes']:_0x1f1830[_0xa4e8('0x2b')];if(_0x423b9e['query']['includeAll']){_0x367966[_0xa4e8('0x3f')]=[{'all':!![]}];}_0x367966=_['merge']({},_0x367966,_0x423b9e[_0xa4e8('0x3c')]);return db[_0xa4e8('0x29')][_0xa4e8('0x45')](_0x367966)[_0xa4e8('0x22')](handleEntityNotFound(_0x154f4b,null))[_0xa4e8('0x22')](respondWithResult(_0x154f4b,null))['catch'](handleError(_0x154f4b,null));};exports[_0xa4e8('0x46')]=function(_0x1e304d,_0x4ae3a9){return db[_0xa4e8('0x29')]['create'](_0x1e304d[_0xa4e8('0x47')],{})[_0xa4e8('0x22')](respondWithResult(_0x4ae3a9,0xc9))[_0xa4e8('0x42')](handleError(_0x4ae3a9,null));};exports[_0xa4e8('0x21')]=function(_0x35723e,_0x1cd759){if(_0x35723e[_0xa4e8('0x47')]['id']){delete _0x35723e[_0xa4e8('0x47')]['id'];}return db[_0xa4e8('0x29')]['find']({'where':{'id':_0x35723e[_0xa4e8('0x44')]['id']}})[_0xa4e8('0x22')](handleEntityNotFound(_0x1cd759,null))[_0xa4e8('0x22')](saveUpdates(_0x35723e['body'],null))[_0xa4e8('0x22')](respondWithResult(_0x1cd759,null))['catch'](handleError(_0x1cd759,null));};exports[_0xa4e8('0x23')]=function(_0x5df68c,_0x43f7df){return db['SquareProject'][_0xa4e8('0x45')]({'where':{'id':_0x5df68c[_0xa4e8('0x44')]['id']}})[_0xa4e8('0x22')](handleEntityNotFound(_0x43f7df,null))[_0xa4e8('0x22')](removeEntity(_0x43f7df,null))['catch'](handleError(_0x43f7df,null));};exports[_0xa4e8('0x48')]=function(_0x6b2824,_0x53bfc5,_0x285f4d){return db[_0xa4e8('0x29')]['find']({'where':{'id':_0x6b2824['params']['id']}})['then'](handleEntityNotFound(_0x53bfc5,null))[_0xa4e8('0x22')](function(_0xc652f4){if(_0xc652f4){return _0xc652f4[_0xa4e8('0x48')](_0x6b2824[_0xa4e8('0x47')][_0xa4e8('0x49')],_['omit'](_0x6b2824[_0xa4e8('0x47')],['ids','id'])||{});}})[_0xa4e8('0x22')](respondWithResult(_0x53bfc5,null))[_0xa4e8('0x42')](handleError(_0x53bfc5,null));};exports[_0xa4e8('0x4a')]=function(_0x263945,_0x18a735,_0x4056d5){var _0x196357;return db[_0xa4e8('0x29')][_0xa4e8('0x45')]({'where':{'id':_0x263945[_0xa4e8('0x44')]['id']}})[_0xa4e8('0x22')](handleEntityNotFound(_0x18a735,null))[_0xa4e8('0x22')](function(_0x29cefc){if(_0x29cefc){return _0x29cefc[_0xa4e8('0x4a')](_0x263945['query'][_0xa4e8('0x49')])[_0xa4e8('0x22')](function(_0x2284b9){if(_[_0xa4e8('0x4b')](_0x263945[_0xa4e8('0x2d')][_0xa4e8('0x49')])){for(var _0x4265f8=0x0;_0x4265f8<_0x263945[_0xa4e8('0x2d')][_0xa4e8('0x49')][_0xa4e8('0x4c')];_0x4265f8+=0x1){socket[_0xa4e8('0x4d')]('userSquareProject:remove',{'UserId':_0x263945[_0xa4e8('0x2d')][_0xa4e8('0x49')][_0x4265f8],'SquareProjectId':_0x263945[_0xa4e8('0x44')]['id']});}}else{socket[_0xa4e8('0x4d')](_0xa4e8('0x4e'),{'UserId':_0x263945['query'][_0xa4e8('0x49')],'SquareProjectId':_0x263945[_0xa4e8('0x44')]['id']});}});}})[_0xa4e8('0x22')](respondWithStatusCode(_0x18a735,null))['catch'](handleError(_0x18a735,null));};exports[_0xa4e8('0x4f')]=function(_0x4466a8,_0x19fbad,_0x5a96e6){var _0x53e54f={};var _0xb7d4ac={};var _0x45b82e;var _0x4a3258;return db['SquareProject'][_0xa4e8('0x50')]({'where':{'id':_0x4466a8[_0xa4e8('0x44')]['id']}})['then'](handleEntityNotFound(_0x19fbad,null))[_0xa4e8('0x22')](function(_0x7c479e){if(_0x7c479e){_0x45b82e=_0x7c479e;_0xb7d4ac['model']=_['keys'](db[_0xa4e8('0x51')][_0xa4e8('0x2a')]);_0xb7d4ac[_0xa4e8('0x2d')]=_['keys'](_0x4466a8[_0xa4e8('0x2d')]);_0xb7d4ac[_0xa4e8('0x2f')]=_[_0xa4e8('0x30')](_0xb7d4ac[_0xa4e8('0x2b')],_0xb7d4ac[_0xa4e8('0x2d')]);_0x53e54f['attributes']=_[_0xa4e8('0x30')](_0xb7d4ac[_0xa4e8('0x2b')],qs['fields'](_0x4466a8[_0xa4e8('0x2d')][_0xa4e8('0x31')]));_0x53e54f[_0xa4e8('0x32')]=_0x53e54f[_0xa4e8('0x32')]['length']?_0x53e54f[_0xa4e8('0x32')]:_0xb7d4ac[_0xa4e8('0x2b')];_0x53e54f[_0xa4e8('0x34')]=qs[_0xa4e8('0x52')](_0x4466a8[_0xa4e8('0x2d')]['sort']);_0x53e54f[_0xa4e8('0x35')]=qs[_0xa4e8('0x2f')](_[_0xa4e8('0x53')](_0x4466a8[_0xa4e8('0x2d')],_0xb7d4ac[_0xa4e8('0x2f')]));if(_0x4466a8[_0xa4e8('0x2d')][_0xa4e8('0x3b')]){_0x53e54f[_0xa4e8('0x35')]=_[_0xa4e8('0x39')](_0x53e54f['where'],{'$or':_['map'](_0x53e54f[_0xa4e8('0x32')],function(_0x1ea314){var _0xd2e53b={};_0xd2e53b[_0x1ea314]={'$like':'%'+_0x4466a8['query'][_0xa4e8('0x3b')]+'%'};return _0xd2e53b;})});}_0x53e54f=_[_0xa4e8('0x39')]({},_0x53e54f,_0x4466a8['options']);return _0x45b82e[_0xa4e8('0x4f')](_0x53e54f);}})[_0xa4e8('0x22')](function(_0x33d4d2){if(_0x33d4d2){_0x4a3258=_0x33d4d2['length'];if(!_0x4466a8['query'][_0xa4e8('0x33')]('nolimit')){_0x53e54f['limit']=qs['limit'](_0x4466a8[_0xa4e8('0x2d')]['limit']);_0x53e54f['offset']=qs[_0xa4e8('0x1d')](_0x4466a8[_0xa4e8('0x2d')][_0xa4e8('0x1d')]);}return _0x45b82e['getUsers'](_0x53e54f);}})[_0xa4e8('0x22')](function(_0x1db7bb){if(_0x1db7bb){return _0x1db7bb?{'count':_0x4a3258,'rows':_0x1db7bb}:null;}})['then'](respondWithResult(_0x19fbad,null))[_0xa4e8('0x42')](handleError(_0x19fbad,null));}; \ No newline at end of file +var _0x193c=['count','offset','limit','set','Content-Range','save','then','error','stack','name','send','index','SquareProject','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','add','day','where','filter','merge','map','options','includeAll','findAll','rows','catch','show','params','find','create','update','body','destroy','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','order','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','util','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','end','json'];(function(_0x1155fa,_0x43b141){var _0x571a17=function(_0x44b632){while(--_0x44b632){_0x1155fa['push'](_0x1155fa['shift']());}};_0x571a17(++_0x43b141);}(_0x193c,0x1d3));var _0xc193=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x193c[_0x3b380d];return _0x54502b;};'use strict';var pdf=require(_0xc193('0x0'));var emlformat=require(_0xc193('0x1'));var rimraf=require(_0xc193('0x2'));var zipdir=require(_0xc193('0x3'));var jsonpatch=require(_0xc193('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc193('0x5'));var path=require(_0xc193('0x6'));var sox=require(_0xc193('0x7'));var csv=require(_0xc193('0x8'));var ejs=require(_0xc193('0x9'));var fs=require('fs');var _=require(_0xc193('0xa'));var squel=require(_0xc193('0xb'));var crypto=require(_0xc193('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc193('0x8'));var querystring=require('querystring');var Papa=require(_0xc193('0xd'));var Redis=require('ioredis');var qs=require(_0xc193('0xe'));var logger=require(_0xc193('0xf'))('api');var utils=require('../../config/utils');var config=require(_0xc193('0x10'));var db=require(_0xc193('0x11'))['db'];config[_0xc193('0x12')]=_[_0xc193('0x13')](config[_0xc193('0x12')],{'host':'localhost','port':0x18eb});var socket=require(_0xc193('0x14'))(new Redis(config['redis']));require('./squareProject.socket')['register'](socket);function respondWithStatusCode(_0x331f86,_0x5339e6){_0x5339e6=_0x5339e6||0xcc;return function(_0x4325f3){if(_0x4325f3){return _0x331f86[_0xc193('0x15')](_0x5339e6);}return _0x331f86[_0xc193('0x16')](_0x5339e6)[_0xc193('0x17')]();};}function respondWithResult(_0x486647,_0x13ee22){_0x13ee22=_0x13ee22||0xc8;return function(_0x447caa){if(_0x447caa){return _0x486647[_0xc193('0x16')](_0x13ee22)[_0xc193('0x18')](_0x447caa);}};}function respondWithFilteredResult(_0x324298,_0x27cb15){return function(_0x13b024){if(_0x13b024){var _0x456135=_0x13b024[_0xc193('0x19')],_0x44a59f=_0x27cb15[_0xc193('0x1a')],_0xc8231c=_0x27cb15[_0xc193('0x1a')]+_0x27cb15[_0xc193('0x1b')],_0x33670c;if(_0xc8231c>=_0x456135){_0xc8231c=_0x456135;_0x33670c=0xc8;}else{_0x33670c=0xce;}_0x324298['status'](_0x33670c);return _0x324298[_0xc193('0x1c')](_0xc193('0x1d'),_0x44a59f+'-'+_0xc8231c+'/'+_0x456135)[_0xc193('0x18')](_0x13b024);}return null;};}function patchUpdates(_0x4b9196){return function(_0x28e859){try{jsonpatch['apply'](_0x28e859,_0x4b9196,!![]);}catch(_0x54b446){return BPromise['reject'](_0x54b446);}return _0x28e859[_0xc193('0x1e')]();};}function saveUpdates(_0x2b79b7,_0x3599dc){return function(_0x4278d6){if(_0x4278d6){return _0x4278d6['update'](_0x2b79b7)[_0xc193('0x1f')](function(_0x4c609e){return _0x4c609e;});}return null;};}function removeEntity(_0x5df1b6,_0xee154f){return function(_0x4b2c43){if(_0x4b2c43){return _0x4b2c43['destroy']()[_0xc193('0x1f')](function(){_0x5df1b6['status'](0xcc)[_0xc193('0x17')]();});}};}function handleEntityNotFound(_0xacad58,_0x2056be){return function(_0x370636){if(!_0x370636){_0xacad58['sendStatus'](0x194);}return _0x370636;};}function handleError(_0x135998,_0x464d64){_0x464d64=_0x464d64||0x1f4;return function(_0x5dfd2f){logger[_0xc193('0x20')](_0x5dfd2f[_0xc193('0x21')]);if(_0x5dfd2f['name']){delete _0x5dfd2f[_0xc193('0x22')];}_0x135998[_0xc193('0x16')](_0x464d64)[_0xc193('0x23')](_0x5dfd2f);};}exports[_0xc193('0x24')]=function(_0x41ba18,_0x320037){var _0x2daf5a={},_0x5637cf={},_0x167f15={'count':0x0,'rows':[]};var _0x38b0c6=db[_0xc193('0x25')][_0xc193('0x26')];_0x5637cf[_0xc193('0x27')]=_[_0xc193('0x28')](_0x38b0c6);var _0x55365b={'dateStart':_0x41ba18[_0xc193('0x29')][_0xc193('0x2a')],'dateEnd':_0x41ba18[_0xc193('0x29')][_0xc193('0x2b')]};delete _0x41ba18['query'][_0xc193('0x2a')];delete _0x41ba18[_0xc193('0x29')][_0xc193('0x2b')];_0x5637cf[_0xc193('0x29')]=_['keys'](_0x41ba18[_0xc193('0x29')]);_0x5637cf[_0xc193('0x2c')]=_['intersection'](_0x5637cf[_0xc193('0x27')],_0x5637cf['query']);_0x2daf5a[_0xc193('0x2d')]=_[_0xc193('0x2e')](_0x5637cf[_0xc193('0x27')],qs[_0xc193('0x2f')](_0x41ba18[_0xc193('0x29')][_0xc193('0x2f')]));_0x2daf5a[_0xc193('0x2d')]=_0x2daf5a[_0xc193('0x2d')][_0xc193('0x30')]?_0x2daf5a[_0xc193('0x2d')]:_0x5637cf['model'];if(!_0x41ba18['query'][_0xc193('0x31')](_0xc193('0x32'))){_0x2daf5a[_0xc193('0x1b')]=qs['limit'](_0x41ba18[_0xc193('0x29')][_0xc193('0x1b')]);_0x2daf5a[_0xc193('0x1a')]=qs[_0xc193('0x1a')](_0x41ba18[_0xc193('0x29')][_0xc193('0x1a')]);}_0x2daf5a['order']=qs[_0xc193('0x33')](_0x41ba18[_0xc193('0x29')]['sort']);_0x2daf5a['where']=qs[_0xc193('0x2c')](_[_0xc193('0x34')](_0x41ba18[_0xc193('0x29')],_0x5637cf[_0xc193('0x2c')]));if(_0x55365b[_0xc193('0x2a')]){if(_0x55365b['dateEnd']){_0x55365b[_0xc193('0x2b')]=moment(_0x55365b[_0xc193('0x2b')])[_0xc193('0x35')](0x1,_0xc193('0x36'));}else{_0x55365b['dateEnd']=moment(_0x55365b[_0xc193('0x2a')])['add'](0x1,'day');}_['merge'](_0x2daf5a[_0xc193('0x37')],{'createdAt':{'$gte':_0x55365b['dateStart'],'$lte':_0x55365b['dateEnd']}});}if(_0x41ba18['query'][_0xc193('0x38')]){_0x2daf5a[_0xc193('0x37')]=_[_0xc193('0x39')](_0x2daf5a[_0xc193('0x37')],{'$or':_[_0xc193('0x3a')](_0x2daf5a[_0xc193('0x2d')],function(_0x4c377c){var _0x5c3940={};_0x5c3940[_0x4c377c]={'$like':'%'+_0x41ba18['query'][_0xc193('0x38')]+'%'};return _0x5c3940;})});}_0x2daf5a=_[_0xc193('0x39')]({},_0x2daf5a,_0x41ba18[_0xc193('0x3b')]);var _0x102676={'where':_0x2daf5a[_0xc193('0x37')]};return db[_0xc193('0x25')][_0xc193('0x19')](_0x102676)['then'](function(_0x493827){_0x167f15[_0xc193('0x19')]=_0x493827;if(_0x41ba18[_0xc193('0x29')][_0xc193('0x3c')]){_0x2daf5a['include']=[{'all':!![]}];}return db[_0xc193('0x25')][_0xc193('0x3d')](_0x2daf5a);})['then'](function(_0x32b16c){_0x167f15[_0xc193('0x3e')]=_0x32b16c;return _0x167f15;})[_0xc193('0x1f')](respondWithFilteredResult(_0x320037,_0x2daf5a))[_0xc193('0x3f')](handleError(_0x320037,null));};exports[_0xc193('0x40')]=function(_0x286a6b,_0x10ce90){var _0x2c0b12={'raw':![],'where':{'id':_0x286a6b[_0xc193('0x41')]['id']}},_0x17522d={};_0x17522d[_0xc193('0x27')]=_['keys'](db[_0xc193('0x25')][_0xc193('0x26')]);_0x17522d[_0xc193('0x29')]=_['keys'](_0x286a6b[_0xc193('0x29')]);_0x17522d[_0xc193('0x2c')]=_[_0xc193('0x2e')](_0x17522d['model'],_0x17522d[_0xc193('0x29')]);_0x2c0b12[_0xc193('0x2d')]=_[_0xc193('0x2e')](_0x17522d[_0xc193('0x27')],qs[_0xc193('0x2f')](_0x286a6b[_0xc193('0x29')][_0xc193('0x2f')]));_0x2c0b12[_0xc193('0x2d')]=_0x2c0b12[_0xc193('0x2d')][_0xc193('0x30')]?_0x2c0b12[_0xc193('0x2d')]:_0x17522d[_0xc193('0x27')];if(_0x286a6b[_0xc193('0x29')]['includeAll']){_0x2c0b12['include']=[{'all':!![]}];}_0x2c0b12=_['merge']({},_0x2c0b12,_0x286a6b[_0xc193('0x3b')]);return db['SquareProject'][_0xc193('0x42')](_0x2c0b12)[_0xc193('0x1f')](handleEntityNotFound(_0x10ce90,null))[_0xc193('0x1f')](respondWithResult(_0x10ce90,null))[_0xc193('0x3f')](handleError(_0x10ce90,null));};exports[_0xc193('0x43')]=function(_0x121a5c,_0x797c3){return db[_0xc193('0x25')][_0xc193('0x43')](_0x121a5c['body'],{})[_0xc193('0x1f')](respondWithResult(_0x797c3,0xc9))['catch'](handleError(_0x797c3,null));};exports[_0xc193('0x44')]=function(_0x81e0f9,_0x44a0d3){if(_0x81e0f9[_0xc193('0x45')]['id']){delete _0x81e0f9['body']['id'];}return db[_0xc193('0x25')][_0xc193('0x42')]({'where':{'id':_0x81e0f9['params']['id']}})[_0xc193('0x1f')](handleEntityNotFound(_0x44a0d3,null))['then'](saveUpdates(_0x81e0f9['body'],null))[_0xc193('0x1f')](respondWithResult(_0x44a0d3,null))[_0xc193('0x3f')](handleError(_0x44a0d3,null));};exports[_0xc193('0x46')]=function(_0x3b29a6,_0x1c05b1){return db['SquareProject'][_0xc193('0x42')]({'where':{'id':_0x3b29a6[_0xc193('0x41')]['id']}})[_0xc193('0x1f')](handleEntityNotFound(_0x1c05b1,null))[_0xc193('0x1f')](removeEntity(_0x1c05b1,null))[_0xc193('0x3f')](handleError(_0x1c05b1,null));};exports[_0xc193('0x47')]=function(_0x1f4b2c,_0x270790,_0x2c5418){return db[_0xc193('0x25')][_0xc193('0x42')]({'where':{'id':_0x1f4b2c['params']['id']}})[_0xc193('0x1f')](handleEntityNotFound(_0x270790,null))['then'](function(_0x278fa9){if(_0x278fa9){return _0x278fa9[_0xc193('0x47')](_0x1f4b2c[_0xc193('0x45')][_0xc193('0x48')],_[_0xc193('0x49')](_0x1f4b2c['body'],[_0xc193('0x48'),'id'])||{});}})[_0xc193('0x1f')](respondWithResult(_0x270790,null))[_0xc193('0x3f')](handleError(_0x270790,null));};exports[_0xc193('0x4a')]=function(_0x126b64,_0x11f6b8,_0x346f93){var _0x364be4;return db[_0xc193('0x25')][_0xc193('0x42')]({'where':{'id':_0x126b64[_0xc193('0x41')]['id']}})['then'](handleEntityNotFound(_0x11f6b8,null))[_0xc193('0x1f')](function(_0x480314){if(_0x480314){return _0x480314['removeUsers'](_0x126b64[_0xc193('0x29')][_0xc193('0x48')])[_0xc193('0x1f')](function(_0x4004da){if(_[_0xc193('0x4b')](_0x126b64[_0xc193('0x29')][_0xc193('0x48')])){for(var _0x47e3a0=0x0;_0x47e3a0<_0x126b64[_0xc193('0x29')][_0xc193('0x48')][_0xc193('0x30')];_0x47e3a0+=0x1){socket[_0xc193('0x4c')](_0xc193('0x4d'),{'UserId':_0x126b64['query']['ids'][_0x47e3a0],'SquareProjectId':_0x126b64[_0xc193('0x41')]['id']});}}else{socket[_0xc193('0x4c')](_0xc193('0x4d'),{'UserId':_0x126b64[_0xc193('0x29')]['ids'],'SquareProjectId':_0x126b64[_0xc193('0x41')]['id']});}});}})['then'](respondWithStatusCode(_0x11f6b8,null))['catch'](handleError(_0x11f6b8,null));};exports[_0xc193('0x4e')]=function(_0x4398bf,_0x44e9fd,_0x559ae7){var _0x465c3c={};var _0x273f5b={};var _0x487eaa;var _0x343c15;return db['SquareProject'][_0xc193('0x4f')]({'where':{'id':_0x4398bf['params']['id']}})[_0xc193('0x1f')](handleEntityNotFound(_0x44e9fd,null))['then'](function(_0x53fdcc){if(_0x53fdcc){_0x487eaa=_0x53fdcc;_0x273f5b[_0xc193('0x27')]=_['keys'](db[_0xc193('0x50')][_0xc193('0x26')]);_0x273f5b[_0xc193('0x29')]=_['keys'](_0x4398bf['query']);_0x273f5b[_0xc193('0x2c')]=_[_0xc193('0x2e')](_0x273f5b[_0xc193('0x27')],_0x273f5b[_0xc193('0x29')]);_0x465c3c[_0xc193('0x2d')]=_['intersection'](_0x273f5b['model'],qs[_0xc193('0x2f')](_0x4398bf[_0xc193('0x29')][_0xc193('0x2f')]));_0x465c3c['attributes']=_0x465c3c[_0xc193('0x2d')][_0xc193('0x30')]?_0x465c3c[_0xc193('0x2d')]:_0x273f5b[_0xc193('0x27')];_0x465c3c[_0xc193('0x51')]=qs[_0xc193('0x33')](_0x4398bf[_0xc193('0x29')][_0xc193('0x33')]);_0x465c3c[_0xc193('0x37')]=qs['filters'](_['pick'](_0x4398bf['query'],_0x273f5b[_0xc193('0x2c')]));if(_0x4398bf[_0xc193('0x29')][_0xc193('0x38')]){_0x465c3c[_0xc193('0x37')]=_[_0xc193('0x39')](_0x465c3c[_0xc193('0x37')],{'$or':_[_0xc193('0x3a')](_0x465c3c['attributes'],function(_0x1c77e4){var _0x242b1f={};_0x242b1f[_0x1c77e4]={'$like':'%'+_0x4398bf['query'][_0xc193('0x38')]+'%'};return _0x242b1f;})});}_0x465c3c=_['merge']({},_0x465c3c,_0x4398bf['options']);return _0x487eaa[_0xc193('0x4e')](_0x465c3c);}})['then'](function(_0x349f3b){if(_0x349f3b){_0x343c15=_0x349f3b[_0xc193('0x30')];if(!_0x4398bf[_0xc193('0x29')][_0xc193('0x31')](_0xc193('0x32'))){_0x465c3c['limit']=qs[_0xc193('0x1b')](_0x4398bf[_0xc193('0x29')][_0xc193('0x1b')]);_0x465c3c[_0xc193('0x1a')]=qs[_0xc193('0x1a')](_0x4398bf[_0xc193('0x29')][_0xc193('0x1a')]);}return _0x487eaa[_0xc193('0x4e')](_0x465c3c);}})['then'](function(_0xd7ab1c){if(_0xd7ab1c){return _0xd7ab1c?{'count':_0x343c15,'rows':_0xd7ab1c}:null;}})[_0xc193('0x1f')](respondWithResult(_0x44e9fd,null))[_0xc193('0x3f')](handleError(_0x44e9fd,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index e4e220e..64793d7 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 _0x0a78=['emit','hook','exports','events','../../mysqldb','setMaxListeners','update','remove'];(function(_0x58c239,_0x1788bc){var _0x1cd7cb=function(_0x4359b5){while(--_0x4359b5){_0x58c239['push'](_0x58c239['shift']());}};_0x1cd7cb(++_0x1788bc);}(_0x0a78,0x1ab));var _0x80a7=function(_0x199979,_0x22face){_0x199979=_0x199979-0x0;var _0x4df310=_0x0a78[_0x199979];return _0x4df310;};'use strict';var EventEmitter=require(_0x80a7('0x0'));var SquareProject=require(_0x80a7('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x80a7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x80a7('0x3'),'afterDestroy':_0x80a7('0x4')};function emitEvent(_0x1b6af6){return function(_0x4e1208,_0x445615,_0x5c556b){SquareProjectEvents[_0x80a7('0x5')](_0x1b6af6+':'+_0x4e1208['id'],_0x4e1208);SquareProjectEvents[_0x80a7('0x5')](_0x1b6af6,_0x4e1208);_0x5c556b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x80a7('0x6')](e,emitEvent(event));}}module[_0x80a7('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0xe678=['update','remove','emit','hasOwnProperty','exports','events','setMaxListeners','save'];(function(_0x1cb1f7,_0x3b1212){var _0x1c1df6=function(_0x41d72a){while(--_0x41d72a){_0x1cb1f7['push'](_0x1cb1f7['shift']());}};_0x1c1df6(++_0x3b1212);}(_0xe678,0x95));var _0x8e67=function(_0x4af28b,_0x509f75){_0x4af28b=_0x4af28b-0x0;var _0x4002e8=_0xe678[_0x4af28b];return _0x4002e8;};'use strict';var EventEmitter=require(_0x8e67('0x0'));var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x8e67('0x1')](0x0);var events={'afterCreate':_0x8e67('0x2'),'afterUpdate':_0x8e67('0x3'),'afterDestroy':_0x8e67('0x4')};function emitEvent(_0x29ab10){return function(_0x382fad,_0x47b5cb,_0x4a9b67){SquareProjectEvents[_0x8e67('0x5')](_0x29ab10+':'+_0x382fad['id'],_0x382fad);SquareProjectEvents['emit'](_0x29ab10,_0x382fad);_0x4a9b67(null);};}for(var e in events){if(events[_0x8e67('0x6')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x8e67('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 1c6ba24..26ce706 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 _0x76a8=['SquareProject','square_projects','util','api','moment','request-promise','exports','define'];(function(_0x7a6e0,_0x35f1d3){var _0x2ef4a7=function(_0x43cc67){while(--_0x43cc67){_0x7a6e0['push'](_0x7a6e0['shift']());}};_0x2ef4a7(++_0x35f1d3);}(_0x76a8,0xca));var _0x876a=function(_0x40d576,_0x4674b1){_0x40d576=_0x40d576-0x0;var _0x4b529d=_0x76a8[_0x40d576];return _0x4b529d;};'use strict';var _=require('lodash');var util=require(_0x876a('0x0'));var logger=require('../../config/logger')(_0x876a('0x1'));var moment=require(_0x876a('0x2'));var BPromise=require('bluebird');var rp=require(_0x876a('0x3'));var attributes=require('./squareProject.attributes');module[_0x876a('0x4')]=function(_0x3c30a5,_0x5214b5){return _0x3c30a5[_0x876a('0x5')](_0x876a('0x6'),attributes,{'tableName':_0x876a('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f29=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','define','SquareProject','square_projects'];(function(_0x37eda8,_0x377267){var _0x109144=function(_0xef7d00){while(--_0xef7d00){_0x37eda8['push'](_0x37eda8['shift']());}};_0x109144(++_0x377267);}(_0x0f29,0x12c));var _0x90f2=function(_0x439c02,_0x38c611){_0x439c02=_0x439c02-0x0;var _0x4853ad=_0x0f29[_0x439c02];return _0x4853ad;};'use strict';var _=require(_0x90f2('0x0'));var util=require(_0x90f2('0x1'));var logger=require(_0x90f2('0x2'))(_0x90f2('0x3'));var moment=require(_0x90f2('0x4'));var BPromise=require(_0x90f2('0x5'));var rp=require(_0x90f2('0x6'));var attributes=require('./squareProject.attributes');module['exports']=function(_0x22364e,_0x6a4c60){return _0x22364e[_0x90f2('0x7')](_0x90f2('0x8'),attributes,{'tableName':_0x90f2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 8f7ea19..6b9d586 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 _0xa9e0=['catch','ShowSquareProject','find','options','raw','where','attributes','include','map','model','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x30b145,_0x5b1406){var _0x5acce4=function(_0x48ade5){while(--_0x48ade5){_0x30b145['push'](_0x30b145['shift']());}};_0x5acce4(++_0x5b1406);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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});config[_0x0a9e('0xa')]=_[_0x0a9e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xc'))(new Redis(config['redis']));require('./squareProject.socket')[_0x0a9e('0xd')](socket);function respondWithRpcPromise(_0xf81284,_0x307b3e,_0x3ab53f){return new BPromise(function(_0xfeb75b,_0xbd1168){return client['request'](_0xf81284,_0x3ab53f)['then'](function(_0x527cdd){logger['info'](_0x0a9e('0xe'),_0x307b3e,_0x0a9e('0xf'));logger[_0x0a9e('0x10')](_0x0a9e('0x11'),_0x307b3e,_0x0a9e('0xf'),JSON[_0x0a9e('0x12')](_0x527cdd));if(_0x527cdd['error']){if(_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x14')]===0x1f4){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x15')]);return _0xbd1168(_0x527cdd['error'][_0x0a9e('0x15')]);}logger['error'](_0x0a9e('0xe'),_0x307b3e,_0x527cdd['error'][_0x0a9e('0x15')]);return _0xfeb75b(_0x527cdd[_0x0a9e('0x13')]['message']);}else{logger[_0x0a9e('0x16')]('SquareProject,\x20%s,\x20%s',_0x307b3e,_0x0a9e('0xf'));_0xfeb75b(_0x527cdd[_0x0a9e('0x17')][_0x0a9e('0x15')]);}})[_0x0a9e('0x18')](function(_0x31b1ca){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x31b1ca);_0xbd1168(_0x31b1ca);});});}exports[_0x0a9e('0x19')]=function(_0x1314ae){var _0x112016=this;return new Promise(function(_0x1c696a,_0x105080){return db['SquareProject'][_0x0a9e('0x1a')]({'raw':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae['options'][_0x0a9e('0x1c')]===undefined?!![]:![]:!![],'where':_0x1314ae['options']?_0x1314ae['options'][_0x0a9e('0x1d')]||null:null,'attributes':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1e')]||null:null,'include':_0x1314ae['options']?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1f')],function(_0x42ac8f){return{'model':db[_0x42ac8f[_0x0a9e('0x21')]],'as':_0x42ac8f['as'],'attributes':_0x42ac8f['attributes'],'include':_0x42ac8f['include']?_[_0x0a9e('0x20')](_0x42ac8f[_0x0a9e('0x1f')],function(_0x40c424){return{'model':db[_0x40c424[_0x0a9e('0x21')]],'as':_0x40c424['as'],'attributes':_0x40c424['attributes'],'include':_0x40c424[_0x0a9e('0x1f')]?_['map'](_0x40c424[_0x0a9e('0x1f')],function(_0x5bfb33){return{'model':db[_0x5bfb33[_0x0a9e('0x21')]],'as':_0x5bfb33['as'],'attributes':_0x5bfb33[_0x0a9e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x22')](function(_0x14433c){logger[_0x0a9e('0x16')](_0x0a9e('0x19'),_0x1314ae);logger[_0x0a9e('0x10')](_0x0a9e('0x19'),_0x1314ae,JSON['stringify'](_0x14433c));_0x1c696a(_0x14433c);})[_0x0a9e('0x18')](function(_0x468813){logger[_0x0a9e('0x13')](_0x0a9e('0x19'),_0x468813['message'],_0x1314ae);_0x105080(_0x112016[_0x0a9e('0x13')](0x1f4,_0x468813[_0x0a9e('0x15')]));});});}; \ No newline at end of file +var _0xa9e0=['catch','ShowSquareProject','find','options','raw','where','attributes','include','map','model','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x14259b,_0x588942){var _0x5d87fa=function(_0x2164e9){while(--_0x2164e9){_0x14259b['push'](_0x14259b['shift']());}};_0x5d87fa(++_0x588942);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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});config[_0x0a9e('0xa')]=_[_0x0a9e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xc'))(new Redis(config['redis']));require('./squareProject.socket')[_0x0a9e('0xd')](socket);function respondWithRpcPromise(_0xf81284,_0x307b3e,_0x3ab53f){return new BPromise(function(_0xfeb75b,_0xbd1168){return client['request'](_0xf81284,_0x3ab53f)['then'](function(_0x527cdd){logger['info'](_0x0a9e('0xe'),_0x307b3e,_0x0a9e('0xf'));logger[_0x0a9e('0x10')](_0x0a9e('0x11'),_0x307b3e,_0x0a9e('0xf'),JSON[_0x0a9e('0x12')](_0x527cdd));if(_0x527cdd['error']){if(_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x14')]===0x1f4){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x15')]);return _0xbd1168(_0x527cdd['error'][_0x0a9e('0x15')]);}logger['error'](_0x0a9e('0xe'),_0x307b3e,_0x527cdd['error'][_0x0a9e('0x15')]);return _0xfeb75b(_0x527cdd[_0x0a9e('0x13')]['message']);}else{logger[_0x0a9e('0x16')]('SquareProject,\x20%s,\x20%s',_0x307b3e,_0x0a9e('0xf'));_0xfeb75b(_0x527cdd[_0x0a9e('0x17')][_0x0a9e('0x15')]);}})[_0x0a9e('0x18')](function(_0x31b1ca){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x31b1ca);_0xbd1168(_0x31b1ca);});});}exports[_0x0a9e('0x19')]=function(_0x1314ae){var _0x112016=this;return new Promise(function(_0x1c696a,_0x105080){return db['SquareProject'][_0x0a9e('0x1a')]({'raw':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae['options'][_0x0a9e('0x1c')]===undefined?!![]:![]:!![],'where':_0x1314ae['options']?_0x1314ae['options'][_0x0a9e('0x1d')]||null:null,'attributes':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1e')]||null:null,'include':_0x1314ae['options']?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1f')],function(_0x42ac8f){return{'model':db[_0x42ac8f[_0x0a9e('0x21')]],'as':_0x42ac8f['as'],'attributes':_0x42ac8f['attributes'],'include':_0x42ac8f['include']?_[_0x0a9e('0x20')](_0x42ac8f[_0x0a9e('0x1f')],function(_0x40c424){return{'model':db[_0x40c424[_0x0a9e('0x21')]],'as':_0x40c424['as'],'attributes':_0x40c424['attributes'],'include':_0x40c424[_0x0a9e('0x1f')]?_['map'](_0x40c424[_0x0a9e('0x1f')],function(_0x5bfb33){return{'model':db[_0x5bfb33[_0x0a9e('0x21')]],'as':_0x5bfb33['as'],'attributes':_0x5bfb33[_0x0a9e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x22')](function(_0x14433c){logger[_0x0a9e('0x16')](_0x0a9e('0x19'),_0x1314ae);logger[_0x0a9e('0x10')](_0x0a9e('0x19'),_0x1314ae,JSON['stringify'](_0x14433c));_0x1c696a(_0x14433c);})[_0x0a9e('0x18')](function(_0x468813){logger[_0x0a9e('0x13')](_0x0a9e('0x19'),_0x468813['message'],_0x1314ae);_0x105080(_0x112016[_0x0a9e('0x13')](0x1f4,_0x468813[_0x0a9e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 3fc5d59..9316a8e 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 _0xc30d=['update','removeListener','register','length','squareProject:','./squareProject.events','remove'];(function(_0x4d6635,_0x382541){var _0x49e280=function(_0xc2a72a){while(--_0xc2a72a){_0x4d6635['push'](_0x4d6635['shift']());}};_0x49e280(++_0x382541);}(_0xc30d,0x6e));var _0xdc30=function(_0x152ea8,_0x3fb53f){_0x152ea8=_0x152ea8-0x0;var _0x4c0ebe=_0xc30d[_0x152ea8];return _0x4c0ebe;};'use strict';var SquareProjectEvents=require(_0xdc30('0x0'));var events=['save',_0xdc30('0x1'),_0xdc30('0x2')];function createListener(_0x15aa6c,_0x3d0fd5){return function(_0x129c4e){_0x3d0fd5['emit'](_0x15aa6c,_0x129c4e);};}function removeListener(_0x1cc1bc,_0x53cb76){return function(){SquareProjectEvents[_0xdc30('0x3')](_0x1cc1bc,_0x53cb76);};}exports[_0xdc30('0x4')]=function(_0x1d2db4){for(var _0x3e480e=0x0,_0x4011da=events[_0xdc30('0x5')];_0x3e480e<_0x4011da;_0x3e480e++){var _0x4a0310=events[_0x3e480e];var _0x1cdfb4=createListener(_0xdc30('0x6')+_0x4a0310,_0x1d2db4);SquareProjectEvents['on'](_0x4a0310,_0x1cdfb4);}}; \ No newline at end of file +var _0x99e9=['update','emit','removeListener','length','squareProject:','save','remove'];(function(_0x35201e,_0x34341b){var _0x4bc5b7=function(_0x504ba7){while(--_0x504ba7){_0x35201e['push'](_0x35201e['shift']());}};_0x4bc5b7(++_0x34341b);}(_0x99e9,0xb4));var _0x999e=function(_0x469fc4,_0x427a80){_0x469fc4=_0x469fc4-0x0;var _0x11f6d4=_0x99e9[_0x469fc4];return _0x11f6d4;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x999e('0x0'),_0x999e('0x1'),_0x999e('0x2')];function createListener(_0x1c6fa0,_0x4aaeb4){return function(_0x19a818){_0x4aaeb4[_0x999e('0x3')](_0x1c6fa0,_0x19a818);};}function removeListener(_0x3aac27,_0x4e2112){return function(){SquareProjectEvents[_0x999e('0x4')](_0x3aac27,_0x4e2112);};}exports['register']=function(_0x25421f){for(var _0x1bda0a=0x0,_0x100330=events[_0x999e('0x5')];_0x1bda0a<_0x100330;_0x1bda0a++){var _0x5c1c17=events[_0x1bda0a];var _0x46aeae=createListener(_0x999e('0x6')+_0x5c1c17,_0x25421f);SquareProjectEvents['on'](_0x5c1c17,_0x46aeae);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 80b3259..9371d3a 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 _0xbfec=['Router','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x5557d9,_0x11d251){var _0x282111=function(_0x47cdb1){while(--_0x47cdb1){_0x5557d9['push'](_0x5557d9['shift']());}};_0x282111(++_0x11d251);}(_0xbfec,0x1b3));var _0xcbfe=function(_0x5ecd4d,_0x350c3c){_0x5ecd4d=_0x5ecd4d-0x0;var _0x3a8143=_0xbfec[_0x5ecd4d];return _0x3a8143;};'use strict';var multer=require(_0xcbfe('0x0'));var util=require(_0xcbfe('0x1'));var path=require(_0xcbfe('0x2'));var timeout=require(_0xcbfe('0x3'));var express=require(_0xcbfe('0x4'));var router=express[_0xcbfe('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcbfe('0x6'));var controller=require(_0xcbfe('0x7'));router[_0xcbfe('0x8')]('/',auth[_0xcbfe('0x9')](),controller[_0xcbfe('0xa')]);router['get'](_0xcbfe('0xb'),auth[_0xcbfe('0x9')](),controller['show']);router[_0xcbfe('0x8')](_0xcbfe('0xc'),auth[_0xcbfe('0x9')](),controller[_0xcbfe('0xd')]);router[_0xcbfe('0xe')]('/',auth[_0xcbfe('0x9')](),controller[_0xcbfe('0xf')]);router[_0xcbfe('0x10')](_0xcbfe('0xb'),auth[_0xcbfe('0x9')](),controller['update']);router[_0xcbfe('0x11')](_0xcbfe('0xb'),auth[_0xcbfe('0x9')](),controller[_0xcbfe('0x12')]);module[_0xcbfe('0x13')]=router; \ No newline at end of file +var _0x08fd=['Router','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','show','download','post','create','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x08fd,0xa6));var _0xd08f=function(_0x583d65,_0x2c5404){_0x583d65=_0x583d65-0x0;var _0x1b5729=_0x08fd[_0x583d65];return _0x1b5729;};'use strict';var multer=require(_0xd08f('0x0'));var util=require(_0xd08f('0x1'));var path=require(_0xd08f('0x2'));var timeout=require(_0xd08f('0x3'));var express=require('express');var router=express[_0xd08f('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd08f('0x5'));var controller=require(_0xd08f('0x6'));router[_0xd08f('0x7')]('/',auth[_0xd08f('0x8')](),controller[_0xd08f('0x9')]);router[_0xd08f('0x7')]('/:id',auth[_0xd08f('0x8')](),controller[_0xd08f('0xa')]);router['get']('/:id/download',auth[_0xd08f('0x8')](),controller[_0xd08f('0xb')]);router[_0xd08f('0xc')]('/',auth[_0xd08f('0x8')](),controller[_0xd08f('0xd')]);router['put']('/:id',auth[_0xd08f('0x8')](),controller['update']);router[_0xd08f('0xe')]('/:id',auth[_0xd08f('0x8')](),controller[_0xd08f('0xf')]);module[_0xd08f('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 6562304..f41353b 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 _0x54b9=['STRING','sequelize','exports'];(function(_0x10852d,_0x4cdcc6){var _0x13a8d6=function(_0x2ece16){while(--_0x2ece16){_0x10852d['push'](_0x10852d['shift']());}};_0x13a8d6(++_0x4cdcc6);}(_0x54b9,0x1a5));var _0x954b=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x54b9[_0x55e08b];return _0xd1a7ff;};'use strict';var Sequelize=require(_0x954b('0x0'));module[_0x954b('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x954b('0x2')]},'calleridname':{'type':Sequelize[_0x954b('0x2')]},'context':{'type':Sequelize[_0x954b('0x2')]},'extension':{'type':Sequelize[_0x954b('0x2')]},'priority':{'type':Sequelize[_0x954b('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x954b('0x2')]},'projectName':{'type':Sequelize[_0x954b('0x2')]},'saveName':{'type':Sequelize[_0x954b('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x954b('0x2')]}}; \ No newline at end of file +var _0xfaf1=['STRING','exports'];(function(_0x29854d,_0x197a1a){var _0x41607d=function(_0xc45220){while(--_0xc45220){_0x29854d['push'](_0x29854d['shift']());}};_0x41607d(++_0x197a1a);}(_0xfaf1,0x105));var _0x1faf=function(_0x361984,_0x4071b4){_0x361984=_0x361984-0x0;var _0x45e4e6=_0xfaf1[_0x361984];return _0x45e4e6;};'use strict';var Sequelize=require('sequelize');module[_0x1faf('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x1faf('0x1')]},'calleridname':{'type':Sequelize[_0x1faf('0x1')]},'context':{'type':Sequelize[_0x1faf('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x1faf('0x1')]},'accountcode':{'type':Sequelize[_0x1faf('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x1faf('0x1')]},'saveName':{'type':Sequelize[_0x1faf('0x1')]},'filename':{'type':Sequelize[_0x1faf('0x1')]},'savePath':{'type':Sequelize[_0x1faf('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 4f967c7..db5a4b7 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 _0x4122=['SquareRecording','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','hasOwnProperty','nolimit','order','sort','pick','add','day','merge','filter','where','map','includeAll','include','findAll','rows','catch','fields','length','options','create','body','find','params','destroy','download','../../components/encryptor','type','uniqueid','savePath','filename','format','%s.cypher','value','existsSync','decryptFile','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','error','stack','name','index'];(function(_0xf79634,_0x35541d){var _0x428160=function(_0x4f954b){while(--_0x4f954b){_0xf79634['push'](_0xf79634['shift']());}};_0x428160(++_0x35541d);}(_0x4122,0xdf));var _0x2412=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x4122[_0x5d6456];return _0x4d66c1;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2412('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2412('0x1'));var moment=require(_0x2412('0x2'));var BPromise=require(_0x2412('0x3'));var Mustache=require('mustache');var util=require(_0x2412('0x4'));var path=require(_0x2412('0x5'));var sox=require(_0x2412('0x6'));var csv=require(_0x2412('0x7'));var ejs=require(_0x2412('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2412('0x9'));var jsforce=require(_0x2412('0xa'));var deskjs=require(_0x2412('0xb'));var toCsv=require('to-csv');var querystring=require(_0x2412('0xc'));var Papa=require(_0x2412('0xd'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x2412('0xe'))(_0x2412('0xf'));var utils=require('../../config/utils');var config=require(_0x2412('0x10'));var db=require(_0x2412('0x11'))['db'];function respondWithStatusCode(_0x4966fc,_0x3079e4){_0x3079e4=_0x3079e4||0xcc;return function(_0x1f607e){if(_0x1f607e){return _0x4966fc[_0x2412('0x12')](_0x3079e4);}return _0x4966fc[_0x2412('0x13')](_0x3079e4)[_0x2412('0x14')]();};}function respondWithResult(_0x1bf92b,_0x2bfd37){_0x2bfd37=_0x2bfd37||0xc8;return function(_0x59d0c7){if(_0x59d0c7){return _0x1bf92b[_0x2412('0x13')](_0x2bfd37)[_0x2412('0x15')](_0x59d0c7);}};}function respondWithFilteredResult(_0x277613,_0x449e83){return function(_0x20ebf1){if(_0x20ebf1){var _0xc36804=_0x20ebf1[_0x2412('0x16')],_0x3d0ba4=_0x449e83['offset'],_0x4350d3=_0x449e83[_0x2412('0x17')]+_0x449e83[_0x2412('0x18')],_0x2bd222;if(_0x4350d3>=_0xc36804){_0x4350d3=_0xc36804;_0x2bd222=0xc8;}else{_0x2bd222=0xce;}_0x277613[_0x2412('0x13')](_0x2bd222);return _0x277613[_0x2412('0x19')](_0x2412('0x1a'),_0x3d0ba4+'-'+_0x4350d3+'/'+_0xc36804)[_0x2412('0x15')](_0x20ebf1);}return null;};}function patchUpdates(_0x4f9ce1){return function(_0x42cab0){try{jsonpatch[_0x2412('0x1b')](_0x42cab0,_0x4f9ce1,!![]);}catch(_0x20ed73){return BPromise[_0x2412('0x1c')](_0x20ed73);}return _0x42cab0[_0x2412('0x1d')]();};}function saveUpdates(_0x4ba5a9,_0x130ba8){return function(_0x469b7d){if(_0x469b7d){return _0x469b7d['update'](_0x4ba5a9)[_0x2412('0x1e')](function(_0x5dcec5){return _0x5dcec5;});}return null;};}function removeEntity(_0x1b258c,_0x680161){return function(_0x54c222){if(_0x54c222){return _0x54c222['destroy']()[_0x2412('0x1e')](function(){_0x1b258c['status'](0xcc)[_0x2412('0x14')]();});}};}function handleEntityNotFound(_0x2fbc59,_0x1252a1){return function(_0x237545){if(!_0x237545){_0x2fbc59[_0x2412('0x12')](0x194);}return _0x237545;};}function handleError(_0x1bceef,_0x2b26e6){_0x2b26e6=_0x2b26e6||0x1f4;return function(_0x506a29){logger[_0x2412('0x1f')](_0x506a29[_0x2412('0x20')]);if(_0x506a29[_0x2412('0x21')]){delete _0x506a29[_0x2412('0x21')];}_0x1bceef[_0x2412('0x13')](_0x2b26e6)['send'](_0x506a29);};}exports[_0x2412('0x22')]=function(_0x50b61a,_0x153820){var _0x535fe5={},_0x1b6558={},_0x2ae74e={'count':0x0,'rows':[]};var _0x54a28f=db[_0x2412('0x23')][_0x2412('0x24')];_0x1b6558[_0x2412('0x25')]=_[_0x2412('0x26')](_0x54a28f);var _0x5221a5={'dateStart':_0x50b61a[_0x2412('0x27')][_0x2412('0x28')],'dateEnd':_0x50b61a[_0x2412('0x27')][_0x2412('0x29')]};delete _0x50b61a[_0x2412('0x27')][_0x2412('0x28')];delete _0x50b61a[_0x2412('0x27')][_0x2412('0x29')];_0x1b6558[_0x2412('0x27')]=_['keys'](_0x50b61a[_0x2412('0x27')]);_0x1b6558[_0x2412('0x2a')]=_['intersection'](_0x1b6558[_0x2412('0x25')],_0x1b6558[_0x2412('0x27')]);_0x535fe5[_0x2412('0x2b')]=_[_0x2412('0x2c')](_0x1b6558[_0x2412('0x25')],qs['fields'](_0x50b61a[_0x2412('0x27')]['fields']));_0x535fe5[_0x2412('0x2b')]=_0x535fe5['attributes']['length']?_0x535fe5['attributes']:_0x1b6558['model'];if(!_0x50b61a['query'][_0x2412('0x2d')](_0x2412('0x2e'))){_0x535fe5[_0x2412('0x18')]=qs[_0x2412('0x18')](_0x50b61a[_0x2412('0x27')]['limit']);_0x535fe5[_0x2412('0x17')]=qs[_0x2412('0x17')](_0x50b61a['query'][_0x2412('0x17')]);}_0x535fe5[_0x2412('0x2f')]=qs[_0x2412('0x30')](_0x50b61a[_0x2412('0x27')]['sort']);_0x535fe5['where']=qs[_0x2412('0x2a')](_[_0x2412('0x31')](_0x50b61a[_0x2412('0x27')],_0x1b6558[_0x2412('0x2a')]));if(_0x5221a5['dateStart']){if(_0x5221a5[_0x2412('0x29')]){_0x5221a5[_0x2412('0x29')]=moment(_0x5221a5[_0x2412('0x29')])[_0x2412('0x32')](0x1,'day');}else{_0x5221a5['dateEnd']=moment(_0x5221a5[_0x2412('0x28')])[_0x2412('0x32')](0x1,_0x2412('0x33'));}_[_0x2412('0x34')](_0x535fe5['where'],{'createdAt':{'$gte':_0x5221a5[_0x2412('0x28')],'$lte':_0x5221a5['dateEnd']}});}if(_0x50b61a[_0x2412('0x27')][_0x2412('0x35')]){_0x535fe5[_0x2412('0x36')]=_[_0x2412('0x34')](_0x535fe5['where'],{'$or':_[_0x2412('0x37')](_0x535fe5[_0x2412('0x2b')],function(_0x4ee6e2){var _0x22b7f4={};_0x22b7f4[_0x4ee6e2]={'$like':'%'+_0x50b61a['query']['filter']+'%'};return _0x22b7f4;})});}_0x535fe5=_[_0x2412('0x34')]({},_0x535fe5,_0x50b61a['options']);var _0x214bbd={'where':_0x535fe5['where']};return db[_0x2412('0x23')][_0x2412('0x16')](_0x214bbd)[_0x2412('0x1e')](function(_0x3ba2d1){_0x2ae74e[_0x2412('0x16')]=_0x3ba2d1;if(_0x50b61a[_0x2412('0x27')][_0x2412('0x38')]){_0x535fe5[_0x2412('0x39')]=[{'all':!![]}];}return db[_0x2412('0x23')][_0x2412('0x3a')](_0x535fe5);})[_0x2412('0x1e')](function(_0x2fc43b){_0x2ae74e[_0x2412('0x3b')]=_0x2fc43b;return _0x2ae74e;})[_0x2412('0x1e')](respondWithFilteredResult(_0x153820,_0x535fe5))[_0x2412('0x3c')](handleError(_0x153820,null));};exports['show']=function(_0x280a67,_0x1b653c){var _0x2bd6d4={'raw':!![],'where':{'id':_0x280a67['params']['id']}},_0x1562a4={};_0x1562a4[_0x2412('0x25')]=_[_0x2412('0x26')](db[_0x2412('0x23')]['rawAttributes']);_0x1562a4[_0x2412('0x27')]=_[_0x2412('0x26')](_0x280a67['query']);_0x1562a4[_0x2412('0x2a')]=_[_0x2412('0x2c')](_0x1562a4[_0x2412('0x25')],_0x1562a4[_0x2412('0x27')]);_0x2bd6d4['attributes']=_[_0x2412('0x2c')](_0x1562a4[_0x2412('0x25')],qs[_0x2412('0x3d')](_0x280a67[_0x2412('0x27')][_0x2412('0x3d')]));_0x2bd6d4['attributes']=_0x2bd6d4[_0x2412('0x2b')][_0x2412('0x3e')]?_0x2bd6d4[_0x2412('0x2b')]:_0x1562a4['model'];if(_0x280a67[_0x2412('0x27')]['includeAll']){_0x2bd6d4[_0x2412('0x39')]=[{'all':!![]}];}_0x2bd6d4=_[_0x2412('0x34')]({},_0x2bd6d4,_0x280a67[_0x2412('0x3f')]);return db[_0x2412('0x23')]['find'](_0x2bd6d4)[_0x2412('0x1e')](handleEntityNotFound(_0x1b653c,null))[_0x2412('0x1e')](respondWithResult(_0x1b653c,null))[_0x2412('0x3c')](handleError(_0x1b653c,null));};exports['create']=function(_0x562bee,_0x524f5b){return db[_0x2412('0x23')][_0x2412('0x40')](_0x562bee[_0x2412('0x41')],{})[_0x2412('0x1e')](respondWithResult(_0x524f5b,0xc9))[_0x2412('0x3c')](handleError(_0x524f5b,null));};exports['update']=function(_0x1cb0fc,_0x4ac0f2){if(_0x1cb0fc['body']['id']){delete _0x1cb0fc['body']['id'];}return db[_0x2412('0x23')][_0x2412('0x42')]({'where':{'id':_0x1cb0fc[_0x2412('0x43')]['id']}})['then'](handleEntityNotFound(_0x4ac0f2,null))['then'](saveUpdates(_0x1cb0fc[_0x2412('0x41')],null))[_0x2412('0x1e')](respondWithResult(_0x4ac0f2,null))[_0x2412('0x3c')](handleError(_0x4ac0f2,null));};exports[_0x2412('0x44')]=function(_0x300f37,_0x120ed9){return db[_0x2412('0x23')][_0x2412('0x42')]({'where':{'id':_0x300f37[_0x2412('0x43')]['id']}})[_0x2412('0x1e')](handleEntityNotFound(_0x120ed9,null))['then'](removeEntity(_0x120ed9,null))[_0x2412('0x3c')](handleError(_0x120ed9,null));};exports[_0x2412('0x45')]=function(_0x2e7f08,_0x4ec775,_0x240ac7){var _0x4de7da=require(_0x2412('0x46'));var _0x4b2f47=![];var _0x48c7c5={};if(_0x2e7f08[_0x2412('0x27')][_0x2412('0x47')]&&_0x2e7f08[_0x2412('0x27')][_0x2412('0x47')]===_0x2412('0x48')){_0x48c7c5[_0x2412('0x48')]=_0x2e7f08[_0x2412('0x43')]['id'];}else{_0x48c7c5['id']=_0x2e7f08[_0x2412('0x43')]['id'];}return db['SquareRecording'][_0x2412('0x42')]({'where':_0x48c7c5,'attributes':['id',_0x2412('0x49'),_0x2412('0x4a')],'raw':!![]})[_0x2412('0x1e')](handleEntityNotFound(_0x4ec775,null))[_0x2412('0x1e')](function(_0x1124f9){if(_0x1124f9){var _0x1b4841=util[_0x2412('0x4b')](_0x2412('0x4c'),_0x1124f9[_0x2412('0x4d')]);if(fs[_0x2412('0x4e')](_0x1b4841)){_0x4b2f47=!![];return _0x4de7da[_0x2412('0x4f')](_0x1b4841,_0x1124f9[_0x2412('0x49')],config['secrets'][_0x2412('0x50')])['then'](function(){return _0x1124f9;});}return _0x1124f9;}})[_0x2412('0x1e')](function(_0xc90804){if(_0xc90804){if(!fs[_0x2412('0x4e')](_0xc90804[_0x2412('0x49')])){throw new db[(_0x2412('0x51'))][(_0x2412('0x52'))](_0x2412('0x53'));}if(_0xc90804[_0x2412('0x4a')]){return _0x4ec775[_0x2412('0x45')](_0xc90804[_0x2412('0x49')],_0xc90804['filename']+path[_0x2412('0x54')](_0xc90804[_0x2412('0x49')]),function(){if(_0x4b2f47){fs[_0x2412('0x55')](_0xc90804['savePath']);}});}else{return _0x4ec775[_0x2412('0x45')](_0xc90804[_0x2412('0x49')],function(_0x48a036){if(_0x4b2f47){fs[_0x2412('0x55')](_0xc90804[_0x2412('0x49')]);}});}}})[_0x2412('0x3c')](handleError(_0x4ec775,null));}; \ No newline at end of file +var _0xeadf=['status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','SquareRecording','rawAttributes','query','dateEnd','dateStart','intersection','model','attributes','fields','length','limit','order','sort','where','filters','pick','add','day','merge','filter','map','options','includeAll','rows','catch','show','params','find','create','body','../../components/encryptor','type','uniqueid','filename','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','download','extname','savePath','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus'];(function(_0x33cb35,_0x6240ef){var _0x50a2ac=function(_0x94b55d){while(--_0x94b55d){_0x33cb35['push'](_0x33cb35['shift']());}};_0x50a2ac(++_0x6240ef);}(_0xeadf,0x8e));var _0xfead=function(_0x2e2f84,_0x24e46f){_0x2e2f84=_0x2e2f84-0x0;var _0x448191=_0xeadf[_0x2e2f84];return _0x448191;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfead('0x0'));var rimraf=require(_0xfead('0x1'));var zipdir=require(_0xfead('0x2'));var jsonpatch=require(_0xfead('0x3'));var rp=require(_0xfead('0x4'));var moment=require(_0xfead('0x5'));var BPromise=require(_0xfead('0x6'));var Mustache=require('mustache');var util=require(_0xfead('0x7'));var path=require(_0xfead('0x8'));var sox=require('sox');var csv=require(_0xfead('0x9'));var ejs=require(_0xfead('0xa'));var fs=require('fs');var _=require(_0xfead('0xb'));var squel=require('squel');var crypto=require(_0xfead('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfead('0xd'));var toCsv=require(_0xfead('0x9'));var querystring=require(_0xfead('0xe'));var Papa=require(_0xfead('0xf'));var Redis=require(_0xfead('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0xfead('0x11'))(_0xfead('0x12'));var utils=require('../../config/utils');var config=require(_0xfead('0x13'));var db=require(_0xfead('0x14'))['db'];function respondWithStatusCode(_0x59eb66,_0x378952){_0x378952=_0x378952||0xcc;return function(_0x14a810){if(_0x14a810){return _0x59eb66[_0xfead('0x15')](_0x378952);}return _0x59eb66[_0xfead('0x16')](_0x378952)[_0xfead('0x17')]();};}function respondWithResult(_0x14a576,_0x10ef9f){_0x10ef9f=_0x10ef9f||0xc8;return function(_0x5a195b){if(_0x5a195b){return _0x14a576[_0xfead('0x16')](_0x10ef9f)[_0xfead('0x18')](_0x5a195b);}};}function respondWithFilteredResult(_0x59d88f,_0x2e39de){return function(_0x6d0511){if(_0x6d0511){var _0x15645d=_0x6d0511[_0xfead('0x19')],_0x11e4ff=_0x2e39de['offset'],_0xf05244=_0x2e39de[_0xfead('0x1a')]+_0x2e39de['limit'],_0x3c1a11;if(_0xf05244>=_0x15645d){_0xf05244=_0x15645d;_0x3c1a11=0xc8;}else{_0x3c1a11=0xce;}_0x59d88f[_0xfead('0x16')](_0x3c1a11);return _0x59d88f[_0xfead('0x1b')](_0xfead('0x1c'),_0x11e4ff+'-'+_0xf05244+'/'+_0x15645d)[_0xfead('0x18')](_0x6d0511);}return null;};}function patchUpdates(_0xd990b6){return function(_0x1896dc){try{jsonpatch[_0xfead('0x1d')](_0x1896dc,_0xd990b6,!![]);}catch(_0x261239){return BPromise[_0xfead('0x1e')](_0x261239);}return _0x1896dc[_0xfead('0x1f')]();};}function saveUpdates(_0x3c5827,_0x3207cc){return function(_0x108bd5){if(_0x108bd5){return _0x108bd5[_0xfead('0x20')](_0x3c5827)[_0xfead('0x21')](function(_0x1c9f8a){return _0x1c9f8a;});}return null;};}function removeEntity(_0x437481,_0x5c1824){return function(_0x313ce1){if(_0x313ce1){return _0x313ce1[_0xfead('0x22')]()[_0xfead('0x21')](function(){_0x437481[_0xfead('0x16')](0xcc)[_0xfead('0x17')]();});}};}function handleEntityNotFound(_0x53aa27,_0x1691df){return function(_0x577b2d){if(!_0x577b2d){_0x53aa27[_0xfead('0x15')](0x194);}return _0x577b2d;};}function handleError(_0x314e35,_0x4545c4){_0x4545c4=_0x4545c4||0x1f4;return function(_0x36268f){logger[_0xfead('0x23')](_0x36268f[_0xfead('0x24')]);if(_0x36268f['name']){delete _0x36268f[_0xfead('0x25')];}_0x314e35[_0xfead('0x16')](_0x4545c4)[_0xfead('0x26')](_0x36268f);};}exports['index']=function(_0x13c2ec,_0x5df49b){var _0x5ce247={},_0x531e09={},_0x16324f={'count':0x0,'rows':[]};var _0x25d27b=db[_0xfead('0x27')][_0xfead('0x28')];_0x531e09['model']=_['keys'](_0x25d27b);var _0x15d22f={'dateStart':_0x13c2ec['query']['dateStart'],'dateEnd':_0x13c2ec[_0xfead('0x29')][_0xfead('0x2a')]};delete _0x13c2ec[_0xfead('0x29')][_0xfead('0x2b')];delete _0x13c2ec['query']['dateEnd'];_0x531e09[_0xfead('0x29')]=_['keys'](_0x13c2ec[_0xfead('0x29')]);_0x531e09['filters']=_[_0xfead('0x2c')](_0x531e09[_0xfead('0x2d')],_0x531e09[_0xfead('0x29')]);_0x5ce247[_0xfead('0x2e')]=_['intersection'](_0x531e09[_0xfead('0x2d')],qs[_0xfead('0x2f')](_0x13c2ec[_0xfead('0x29')][_0xfead('0x2f')]));_0x5ce247[_0xfead('0x2e')]=_0x5ce247[_0xfead('0x2e')][_0xfead('0x30')]?_0x5ce247['attributes']:_0x531e09[_0xfead('0x2d')];if(!_0x13c2ec[_0xfead('0x29')]['hasOwnProperty']('nolimit')){_0x5ce247[_0xfead('0x31')]=qs[_0xfead('0x31')](_0x13c2ec[_0xfead('0x29')]['limit']);_0x5ce247[_0xfead('0x1a')]=qs[_0xfead('0x1a')](_0x13c2ec[_0xfead('0x29')][_0xfead('0x1a')]);}_0x5ce247[_0xfead('0x32')]=qs[_0xfead('0x33')](_0x13c2ec[_0xfead('0x29')][_0xfead('0x33')]);_0x5ce247[_0xfead('0x34')]=qs[_0xfead('0x35')](_[_0xfead('0x36')](_0x13c2ec[_0xfead('0x29')],_0x531e09[_0xfead('0x35')]));if(_0x15d22f[_0xfead('0x2b')]){if(_0x15d22f[_0xfead('0x2a')]){_0x15d22f[_0xfead('0x2a')]=moment(_0x15d22f[_0xfead('0x2a')])[_0xfead('0x37')](0x1,'day');}else{_0x15d22f[_0xfead('0x2a')]=moment(_0x15d22f[_0xfead('0x2b')])[_0xfead('0x37')](0x1,_0xfead('0x38'));}_[_0xfead('0x39')](_0x5ce247[_0xfead('0x34')],{'createdAt':{'$gte':_0x15d22f[_0xfead('0x2b')],'$lte':_0x15d22f[_0xfead('0x2a')]}});}if(_0x13c2ec['query'][_0xfead('0x3a')]){_0x5ce247['where']=_[_0xfead('0x39')](_0x5ce247[_0xfead('0x34')],{'$or':_[_0xfead('0x3b')](_0x5ce247['attributes'],function(_0x4a78cb){var _0x5957af={};_0x5957af[_0x4a78cb]={'$like':'%'+_0x13c2ec[_0xfead('0x29')][_0xfead('0x3a')]+'%'};return _0x5957af;})});}_0x5ce247=_[_0xfead('0x39')]({},_0x5ce247,_0x13c2ec[_0xfead('0x3c')]);var _0x45d8d1={'where':_0x5ce247[_0xfead('0x34')]};return db[_0xfead('0x27')]['count'](_0x45d8d1)[_0xfead('0x21')](function(_0x5d5272){_0x16324f[_0xfead('0x19')]=_0x5d5272;if(_0x13c2ec[_0xfead('0x29')][_0xfead('0x3d')]){_0x5ce247['include']=[{'all':!![]}];}return db[_0xfead('0x27')]['findAll'](_0x5ce247);})[_0xfead('0x21')](function(_0x53d41d){_0x16324f[_0xfead('0x3e')]=_0x53d41d;return _0x16324f;})[_0xfead('0x21')](respondWithFilteredResult(_0x5df49b,_0x5ce247))[_0xfead('0x3f')](handleError(_0x5df49b,null));};exports[_0xfead('0x40')]=function(_0x9edf8b,_0x214afd){var _0x47189a={'raw':!![],'where':{'id':_0x9edf8b[_0xfead('0x41')]['id']}},_0xaabd1b={};_0xaabd1b['model']=_['keys'](db['SquareRecording'][_0xfead('0x28')]);_0xaabd1b[_0xfead('0x29')]=_['keys'](_0x9edf8b[_0xfead('0x29')]);_0xaabd1b[_0xfead('0x35')]=_[_0xfead('0x2c')](_0xaabd1b[_0xfead('0x2d')],_0xaabd1b[_0xfead('0x29')]);_0x47189a[_0xfead('0x2e')]=_['intersection'](_0xaabd1b['model'],qs[_0xfead('0x2f')](_0x9edf8b[_0xfead('0x29')]['fields']));_0x47189a['attributes']=_0x47189a[_0xfead('0x2e')]['length']?_0x47189a['attributes']:_0xaabd1b[_0xfead('0x2d')];if(_0x9edf8b[_0xfead('0x29')][_0xfead('0x3d')]){_0x47189a['include']=[{'all':!![]}];}_0x47189a=_[_0xfead('0x39')]({},_0x47189a,_0x9edf8b[_0xfead('0x3c')]);return db[_0xfead('0x27')][_0xfead('0x42')](_0x47189a)[_0xfead('0x21')](handleEntityNotFound(_0x214afd,null))[_0xfead('0x21')](respondWithResult(_0x214afd,null))[_0xfead('0x3f')](handleError(_0x214afd,null));};exports[_0xfead('0x43')]=function(_0x2c2672,_0x371729){return db[_0xfead('0x27')][_0xfead('0x43')](_0x2c2672[_0xfead('0x44')],{})[_0xfead('0x21')](respondWithResult(_0x371729,0xc9))['catch'](handleError(_0x371729,null));};exports[_0xfead('0x20')]=function(_0x61edce,_0x4bc2c0){if(_0x61edce['body']['id']){delete _0x61edce['body']['id'];}return db['SquareRecording'][_0xfead('0x42')]({'where':{'id':_0x61edce[_0xfead('0x41')]['id']}})[_0xfead('0x21')](handleEntityNotFound(_0x4bc2c0,null))[_0xfead('0x21')](saveUpdates(_0x61edce['body'],null))['then'](respondWithResult(_0x4bc2c0,null))[_0xfead('0x3f')](handleError(_0x4bc2c0,null));};exports[_0xfead('0x22')]=function(_0x5b2f26,_0x4f0ad1){return db[_0xfead('0x27')][_0xfead('0x42')]({'where':{'id':_0x5b2f26[_0xfead('0x41')]['id']}})['then'](handleEntityNotFound(_0x4f0ad1,null))['then'](removeEntity(_0x4f0ad1,null))[_0xfead('0x3f')](handleError(_0x4f0ad1,null));};exports['download']=function(_0x4b60a1,_0xf1a33a,_0x2a4cd4){var _0x456125=require(_0xfead('0x45'));var _0x237122=![];var _0x5a1027={};if(_0x4b60a1['query'][_0xfead('0x46')]&&_0x4b60a1[_0xfead('0x29')][_0xfead('0x46')]===_0xfead('0x47')){_0x5a1027[_0xfead('0x47')]=_0x4b60a1['params']['id'];}else{_0x5a1027['id']=_0x4b60a1[_0xfead('0x41')]['id'];}return db[_0xfead('0x27')][_0xfead('0x42')]({'where':_0x5a1027,'attributes':['id','savePath',_0xfead('0x48')],'raw':!![]})[_0xfead('0x21')](handleEntityNotFound(_0xf1a33a,null))['then'](function(_0xa1ca5b){if(_0xa1ca5b){var _0x170304=util['format']('%s.cypher',_0xa1ca5b['value']);if(fs[_0xfead('0x49')](_0x170304)){_0x237122=!![];return _0x456125[_0xfead('0x4a')](_0x170304,_0xa1ca5b['savePath'],config[_0xfead('0x4b')][_0xfead('0x4c')])[_0xfead('0x21')](function(){return _0xa1ca5b;});}return _0xa1ca5b;}})[_0xfead('0x21')](function(_0x22ec78){if(_0x22ec78){if(!fs[_0xfead('0x49')](_0x22ec78['savePath'])){throw new db[(_0xfead('0x4d'))][(_0xfead('0x4e'))]('SquareRecording\x20not\x20found');}if(_0x22ec78['filename']){return _0xf1a33a[_0xfead('0x4f')](_0x22ec78['savePath'],_0x22ec78[_0xfead('0x48')]+path[_0xfead('0x50')](_0x22ec78[_0xfead('0x51')]),function(){if(_0x237122){fs['unlink'](_0x22ec78[_0xfead('0x51')]);}});}else{return _0xf1a33a[_0xfead('0x4f')](_0x22ec78['savePath'],function(_0xa86bce){if(_0x237122){fs['unlink'](_0x22ec78[_0xfead('0x51')]);}});}}})[_0xfead('0x3f')](handleError(_0xf1a33a,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 4c0371e..e9b78cb 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 _0xb0df=['exports','define','SquareRecording','util','../../config/logger','api','moment','bluebird','request-promise','./squareRecording.attributes'];(function(_0x9780c3,_0x3d6ef0){var _0x247b4c=function(_0x5bc10c){while(--_0x5bc10c){_0x9780c3['push'](_0x9780c3['shift']());}};_0x247b4c(++_0x3d6ef0);}(_0xb0df,0x85));var _0xfb0d=function(_0xe3e0af,_0x4564ed){_0xe3e0af=_0xe3e0af-0x0;var _0x4828e9=_0xb0df[_0xe3e0af];return _0x4828e9;};'use strict';var _=require('lodash');var util=require(_0xfb0d('0x0'));var logger=require(_0xfb0d('0x1'))(_0xfb0d('0x2'));var moment=require(_0xfb0d('0x3'));var BPromise=require(_0xfb0d('0x4'));var rp=require(_0xfb0d('0x5'));var attributes=require(_0xfb0d('0x6'));module[_0xfb0d('0x7')]=function(_0x3348e0,_0x4ff814){return _0x3348e0[_0xfb0d('0x8')](_0xfb0d('0x9'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x448a=['../../config/logger','moment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','util'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x448a,0x1ef));var _0xa448=function(_0x5f46a7,_0x5d4591){_0x5f46a7=_0x5f46a7-0x0;var _0x54db17=_0x448a[_0x5f46a7];return _0x54db17;};'use strict';var _=require('lodash');var util=require(_0xa448('0x0'));var logger=require(_0xa448('0x1'))('api');var moment=require(_0xa448('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xa448('0x3'));module[_0xa448('0x4')]=function(_0x57e1ea,_0x98f0a1){return _0x57e1ea[_0xa448('0x5')](_0xa448('0x6'),attributes,{'tableName':_0xa448('0x7'),'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 4bb38ab..fe68c78 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 _0xb633=['SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','body','options','CreateSquareRecording','stringify','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xbdde76,_0x4d460d){var _0x713dd9=function(_0x1d6645){while(--_0x1d6645){_0xbdde76['push'](_0xbdde76['shift']());}};_0x713dd9(++_0x4d460d);}(_0xb633,0xc0));var _0x3b63=function(_0x4c2b80,_0x2d9078){_0x4c2b80=_0x4c2b80-0x0;var _0x21ecf9=_0xb633[_0x4c2b80];return _0x21ecf9;};'use strict';var _=require(_0x3b63('0x0'));var util=require(_0x3b63('0x1'));var moment=require('moment');var BPromise=require(_0x3b63('0x2'));var rs=require(_0x3b63('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3b63('0x4'))['db'];var utils=require(_0x3b63('0x5'));var logger=require(_0x3b63('0x6'))(_0x3b63('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3b63('0x8')][_0x3b63('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c3e4c,_0x36f9a1,_0x5e1e73){return new BPromise(function(_0x5668ee,_0x77d4b9){return client[_0x3b63('0xa')](_0x4c3e4c,_0x5e1e73)[_0x3b63('0xb')](function(_0x4e1d28){logger[_0x3b63('0xc')](_0x3b63('0xd'),_0x36f9a1,_0x3b63('0xe'));logger[_0x3b63('0xf')](_0x3b63('0x10'),_0x36f9a1,_0x3b63('0xe'),JSON['stringify'](_0x4e1d28));if(_0x4e1d28[_0x3b63('0x11')]){if(_0x4e1d28[_0x3b63('0x11')][_0x3b63('0x12')]===0x1f4){logger['error'](_0x3b63('0xd'),_0x36f9a1,_0x4e1d28[_0x3b63('0x11')][_0x3b63('0x13')]);return _0x77d4b9(_0x4e1d28[_0x3b63('0x11')][_0x3b63('0x13')]);}logger[_0x3b63('0x11')](_0x3b63('0xd'),_0x36f9a1,_0x4e1d28[_0x3b63('0x11')][_0x3b63('0x13')]);return _0x5668ee(_0x4e1d28[_0x3b63('0x11')][_0x3b63('0x13')]);}else{logger[_0x3b63('0xc')]('SquareRecording,\x20%s,\x20%s',_0x36f9a1,'request\x20sent');_0x5668ee(_0x4e1d28[_0x3b63('0x14')]['message']);}})['catch'](function(_0x358c61){logger[_0x3b63('0x11')](_0x3b63('0xd'),_0x36f9a1,_0x358c61);_0x77d4b9(_0x358c61);});});}exports['CreateSquareRecording']=function(_0x56965c){var _0x568baf=this;return new Promise(function(_0x270d92,_0xead172){return db['SquareRecording']['create'](_0x56965c[_0x3b63('0x15')],{'raw':_0x56965c[_0x3b63('0x16')]?_0x56965c[_0x3b63('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x3b63('0xb')](function(_0x32bc16){logger[_0x3b63('0xc')]('CreateSquareRecording',_0x56965c);logger[_0x3b63('0xf')](_0x3b63('0x17'),_0x56965c,JSON[_0x3b63('0x18')](_0x32bc16));_0x270d92(_0x32bc16);})[_0x3b63('0x19')](function(_0x158e31){logger[_0x3b63('0x11')](_0x3b63('0x17'),_0x158e31['message'],_0x56965c);_0xead172(_0x568baf[_0x3b63('0x11')](0x1f4,_0x158e31['message']));});});}; \ No newline at end of file +var _0x793f=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','error','message','result','catch','create','body','options','raw','CreateSquareRecording','debug','stringify','util','bluebird'];(function(_0x1c4863,_0x5a11c9){var _0x13aae5=function(_0x2c5fbf){while(--_0x2c5fbf){_0x1c4863['push'](_0x1c4863['shift']());}};_0x13aae5(++_0x5a11c9);}(_0x793f,0xf1));var _0xf793=function(_0x39579c,_0x312473){_0x39579c=_0x39579c-0x0;var _0x1b5d88=_0x793f[_0x39579c];return _0x1b5d88;};'use strict';var _=require('lodash');var util=require(_0xf793('0x0'));var moment=require('moment');var BPromise=require(_0xf793('0x1'));var rs=require(_0xf793('0x2'));var fs=require('fs');var Redis=require(_0xf793('0x3'));var db=require(_0xf793('0x4'))['db'];var utils=require(_0xf793('0x5'));var logger=require('../../config/logger')(_0xf793('0x6'));var config=require('../../config/environment');var jayson=require(_0xf793('0x7'));var client=jayson[_0xf793('0x8')][_0xf793('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x194fae,_0x129b9b,_0x2aaa93){return new BPromise(function(_0x7aae18,_0x6ea365){return client[_0xf793('0xa')](_0x194fae,_0x2aaa93)[_0xf793('0xb')](function(_0x2b924d){logger[_0xf793('0xc')](_0xf793('0xd'),_0x129b9b,_0xf793('0xe'));logger['debug'](_0xf793('0xf'),_0x129b9b,_0xf793('0xe'),JSON['stringify'](_0x2b924d));if(_0x2b924d[_0xf793('0x10')]){if(_0x2b924d[_0xf793('0x10')]['code']===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0x129b9b,_0x2b924d['error']['message']);return _0x6ea365(_0x2b924d[_0xf793('0x10')][_0xf793('0x11')]);}logger[_0xf793('0x10')]('SquareRecording,\x20%s,\x20%s',_0x129b9b,_0x2b924d['error'][_0xf793('0x11')]);return _0x7aae18(_0x2b924d[_0xf793('0x10')][_0xf793('0x11')]);}else{logger[_0xf793('0xc')](_0xf793('0xd'),_0x129b9b,_0xf793('0xe'));_0x7aae18(_0x2b924d[_0xf793('0x12')][_0xf793('0x11')]);}})[_0xf793('0x13')](function(_0x5d202a){logger[_0xf793('0x10')](_0xf793('0xd'),_0x129b9b,_0x5d202a);_0x6ea365(_0x5d202a);});});}exports['CreateSquareRecording']=function(_0x4ea3da){var _0x47bc06=this;return new Promise(function(_0x3ecdc6,_0x254773){return db['SquareRecording'][_0xf793('0x14')](_0x4ea3da[_0xf793('0x15')],{'raw':_0x4ea3da[_0xf793('0x16')]?_0x4ea3da['options'][_0xf793('0x17')]===undefined?!![]:![]:!![]})[_0xf793('0xb')](function(_0xecce7e){logger['info'](_0xf793('0x18'),_0x4ea3da);logger[_0xf793('0x19')](_0xf793('0x18'),_0x4ea3da,JSON[_0xf793('0x1a')](_0xecce7e));_0x3ecdc6(_0xecce7e);})[_0xf793('0x13')](function(_0x2329b1){logger[_0xf793('0x10')](_0xf793('0x18'),_0x2329b1['message'],_0x4ea3da);_0x254773(_0x47bc06[_0xf793('0x10')](0x1f4,_0x2329b1[_0xf793('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index b412942..a98387c 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 _0xbb69=['/describe','/:id','show','create','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../config/environment','isAuthenticated','index','get'];(function(_0x26b5ff,_0x92009a){var _0x58603e=function(_0x4454ff){while(--_0x4454ff){_0x26b5ff['push'](_0x26b5ff['shift']());}};_0x58603e(++_0x92009a);}(_0xbb69,0x129));var _0x9bb6=function(_0x3d1bec,_0x5a2ef1){_0x3d1bec=_0x3d1bec-0x0;var _0x47405a=_0xbb69[_0x3d1bec];return _0x47405a;};'use strict';var multer=require(_0x9bb6('0x0'));var util=require(_0x9bb6('0x1'));var path=require(_0x9bb6('0x2'));var timeout=require('connect-timeout');var express=require(_0x9bb6('0x3'));var router=express['Router']();var auth=require(_0x9bb6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9bb6('0x5'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x9bb6('0x6')](),controller[_0x9bb6('0x7')]);router[_0x9bb6('0x8')](_0x9bb6('0x9'),auth[_0x9bb6('0x6')](),controller['describe']);router[_0x9bb6('0x8')](_0x9bb6('0xa'),auth[_0x9bb6('0x6')](),controller[_0x9bb6('0xb')]);router['post']('/',auth[_0x9bb6('0x6')](),controller[_0x9bb6('0xc')]);router['put'](_0x9bb6('0xa'),auth[_0x9bb6('0x6')](),controller[_0x9bb6('0xd')]);router[_0x9bb6('0xe')](_0x9bb6('0xa'),auth[_0x9bb6('0x6')](),controller[_0x9bb6('0xf')]);module[_0x9bb6('0x10')]=router; \ No newline at end of file +var _0xf56b=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete'];(function(_0x1de164,_0x1ccf5f){var _0x5613b4=function(_0x22dca9){while(--_0x22dca9){_0x1de164['push'](_0x1de164['shift']());}};_0x5613b4(++_0x1ccf5f);}(_0xf56b,0x72));var _0xbf56=function(_0x40b8db,_0x4b6ed1){_0x40b8db=_0x40b8db-0x0;var _0x22d39e=_0xf56b[_0x40b8db];return _0x22d39e;};'use strict';var multer=require(_0xbf56('0x0'));var util=require(_0xbf56('0x1'));var path=require(_0xbf56('0x2'));var timeout=require('connect-timeout');var express=require(_0xbf56('0x3'));var router=express[_0xbf56('0x4')]();var auth=require(_0xbf56('0x5'));var interaction=require(_0xbf56('0x6'));var config=require(_0xbf56('0x7'));var controller=require('./squareReport.controller');router[_0xbf56('0x8')]('/',auth[_0xbf56('0x9')](),controller['index']);router['get'](_0xbf56('0xa'),auth['isAuthenticated'](),controller[_0xbf56('0xb')]);router[_0xbf56('0x8')](_0xbf56('0xc'),auth[_0xbf56('0x9')](),controller[_0xbf56('0xd')]);router[_0xbf56('0xe')]('/',auth[_0xbf56('0x9')](),controller[_0xbf56('0xf')]);router[_0xbf56('0x10')](_0xbf56('0xc'),auth['isAuthenticated'](),controller[_0xbf56('0x11')]);router[_0xbf56('0x12')](_0xbf56('0xc'),auth[_0xbf56('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 73086a5..408bab4 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 _0x66fa=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x67b97a,_0x503a86){var _0x1c50b2=function(_0x1f76d7){while(--_0x1f76d7){_0x67b97a['push'](_0x67b97a['shift']());}};_0x1c50b2(++_0x503a86);}(_0x66fa,0x168));var _0xa66f=function(_0x45939a,_0x1197ca){_0x45939a=_0x45939a-0x0;var _0x30d3f9=_0x66fa[_0x45939a];return _0x30d3f9;};'use strict';var Sequelize=require(_0xa66f('0x0'));module[_0xa66f('0x1')]={'network':{'type':Sequelize[_0xa66f('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa66f('0x2')]},'language':{'type':Sequelize[_0xa66f('0x2')]},'type':{'type':Sequelize[_0xa66f('0x2')]},'uniqueid':{'type':Sequelize[_0xa66f('0x2')]},'version':{'type':Sequelize[_0xa66f('0x2')]},'callerid':{'type':Sequelize[_0xa66f('0x2')]},'calleridname':{'type':Sequelize[_0xa66f('0x2')]},'callingpres':{'type':Sequelize[_0xa66f('0x2')]},'callingani2':{'type':Sequelize[_0xa66f('0x2')]},'callington':{'type':Sequelize[_0xa66f('0x2')]},'callingtns':{'type':Sequelize[_0xa66f('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xa66f('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xa66f('0x2')]},'priority':{'type':Sequelize[_0xa66f('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa66f('0x2')]},'threadid':{'type':Sequelize[_0xa66f('0x2')]},'project_name':{'type':Sequelize[_0xa66f('0x2')]},'joinAt':{'type':Sequelize[_0xa66f('0x3')]},'leaveAt':{'type':Sequelize[_0xa66f('0x3')]},'bot':{'type':Sequelize[_0xa66f('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x96a2=['DATE','BOOLEAN','sequelize','STRING'];(function(_0x235dd1,_0x5c9e7e){var _0x3676e1=function(_0xbefd73){while(--_0xbefd73){_0x235dd1['push'](_0x235dd1['shift']());}};_0x3676e1(++_0x5c9e7e);}(_0x96a2,0x96));var _0x296a=function(_0x35b583,_0x39d4c7){_0x35b583=_0x35b583-0x0;var _0x1d1600=_0x96a2[_0x35b583];return _0x1d1600;};'use strict';var Sequelize=require(_0x296a('0x0'));module['exports']={'network':{'type':Sequelize[_0x296a('0x1')]},'network_script':{'type':Sequelize[_0x296a('0x1')]},'request':{'type':Sequelize[_0x296a('0x1')]},'channel':{'type':Sequelize[_0x296a('0x1')]},'language':{'type':Sequelize[_0x296a('0x1')]},'type':{'type':Sequelize[_0x296a('0x1')]},'uniqueid':{'type':Sequelize[_0x296a('0x1')]},'version':{'type':Sequelize[_0x296a('0x1')]},'callerid':{'type':Sequelize[_0x296a('0x1')]},'calleridname':{'type':Sequelize[_0x296a('0x1')]},'callingpres':{'type':Sequelize[_0x296a('0x1')]},'callingani2':{'type':Sequelize[_0x296a('0x1')]},'callington':{'type':Sequelize[_0x296a('0x1')]},'callingtns':{'type':Sequelize[_0x296a('0x1')]},'dnid':{'type':Sequelize[_0x296a('0x1')]},'rdnis':{'type':Sequelize[_0x296a('0x1')]},'context':{'type':Sequelize[_0x296a('0x1')]},'extension':{'type':Sequelize[_0x296a('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x296a('0x1')]},'accountcode':{'type':Sequelize[_0x296a('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x296a('0x1')]},'joinAt':{'type':Sequelize[_0x296a('0x2')]},'leaveAt':{'type':Sequelize[_0x296a('0x2')]},'bot':{'type':Sequelize[_0x296a('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index f2fb868..59e60e8 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 _0xd140=['map','options','includeAll','include','findAll','rows','show','keys','body','catch','find','params','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','count','offset','Content-Range','json','apply','update','then','destroy','end','sendStatus','stack','name','SquareReport','rawAttributes','query','dateStart','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','dateEnd','add','day','merge','filter'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xd140,0xd9));var _0x0d14=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd140[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0d14('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0d14('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0d14('0x2'));var moment=require(_0x0d14('0x3'));var BPromise=require(_0x0d14('0x4'));var Mustache=require(_0x0d14('0x5'));var util=require('util');var path=require(_0x0d14('0x6'));var sox=require(_0x0d14('0x7'));var csv=require(_0x0d14('0x8'));var ejs=require(_0x0d14('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0d14('0xa'));var crypto=require(_0x0d14('0xb'));var jsforce=require(_0x0d14('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0d14('0x8'));var querystring=require(_0x0d14('0xd'));var Papa=require(_0x0d14('0xe'));var Redis=require(_0x0d14('0xf'));var qs=require('../../components/parsers/qs');var logger=require(_0x0d14('0x10'))(_0x0d14('0x11'));var utils=require(_0x0d14('0x12'));var config=require(_0x0d14('0x13'));var db=require(_0x0d14('0x14'))['db'];function respondWithStatusCode(_0x5c118e,_0x315044){_0x315044=_0x315044||0xcc;return function(_0x20d96e){if(_0x20d96e){return _0x5c118e['sendStatus'](_0x315044);}return _0x5c118e[_0x0d14('0x15')](_0x315044)['end']();};}function respondWithResult(_0x21860d,_0x539603){_0x539603=_0x539603||0xc8;return function(_0x2be29e){if(_0x2be29e){return _0x21860d[_0x0d14('0x15')](_0x539603)['json'](_0x2be29e);}};}function respondWithFilteredResult(_0xacadf,_0x5b85a4){return function(_0x425f98){if(_0x425f98){var _0x545bb5=_0x425f98[_0x0d14('0x16')],_0x46c0f9=_0x5b85a4[_0x0d14('0x17')],_0x4b210e=_0x5b85a4[_0x0d14('0x17')]+_0x5b85a4['limit'],_0x350063;if(_0x4b210e>=_0x545bb5){_0x4b210e=_0x545bb5;_0x350063=0xc8;}else{_0x350063=0xce;}_0xacadf[_0x0d14('0x15')](_0x350063);return _0xacadf['set'](_0x0d14('0x18'),_0x46c0f9+'-'+_0x4b210e+'/'+_0x545bb5)[_0x0d14('0x19')](_0x425f98);}return null;};}function patchUpdates(_0x57db2){return function(_0x2c6558){try{jsonpatch[_0x0d14('0x1a')](_0x2c6558,_0x57db2,!![]);}catch(_0x17a52d){return BPromise['reject'](_0x17a52d);}return _0x2c6558['save']();};}function saveUpdates(_0x3e94b8,_0x51ae1f){return function(_0x2d610c){if(_0x2d610c){return _0x2d610c[_0x0d14('0x1b')](_0x3e94b8)[_0x0d14('0x1c')](function(_0x4bf056){return _0x4bf056;});}return null;};}function removeEntity(_0x59070f,_0x59078b){return function(_0x1af17e){if(_0x1af17e){return _0x1af17e[_0x0d14('0x1d')]()[_0x0d14('0x1c')](function(){_0x59070f[_0x0d14('0x15')](0xcc)[_0x0d14('0x1e')]();});}};}function handleEntityNotFound(_0x137fc5,_0x26f7f4){return function(_0x36e9fb){if(!_0x36e9fb){_0x137fc5[_0x0d14('0x1f')](0x194);}return _0x36e9fb;};}function handleError(_0x3ebd48,_0x2a491b){_0x2a491b=_0x2a491b||0x1f4;return function(_0x152ef1){logger['error'](_0x152ef1[_0x0d14('0x20')]);if(_0x152ef1[_0x0d14('0x21')]){delete _0x152ef1[_0x0d14('0x21')];}_0x3ebd48['status'](_0x2a491b)['send'](_0x152ef1);};}exports['index']=function(_0x486ecd,_0x19b86a){var _0x4e8332={},_0x72de57={},_0x2cea6f={'count':0x0,'rows':[]};var _0x9ba7f4=db[_0x0d14('0x22')][_0x0d14('0x23')];_0x72de57['model']=_['keys'](_0x9ba7f4);var _0x348319={'dateStart':_0x486ecd[_0x0d14('0x24')][_0x0d14('0x25')],'dateEnd':_0x486ecd[_0x0d14('0x24')]['dateEnd']};delete _0x486ecd[_0x0d14('0x24')][_0x0d14('0x25')];delete _0x486ecd[_0x0d14('0x24')]['dateEnd'];_0x72de57[_0x0d14('0x24')]=_['keys'](_0x486ecd[_0x0d14('0x24')]);_0x72de57[_0x0d14('0x26')]=_['intersection'](_0x72de57[_0x0d14('0x27')],_0x72de57[_0x0d14('0x24')]);_0x4e8332[_0x0d14('0x28')]=_[_0x0d14('0x29')](_0x72de57[_0x0d14('0x27')],qs[_0x0d14('0x2a')](_0x486ecd[_0x0d14('0x24')][_0x0d14('0x2a')]));_0x4e8332[_0x0d14('0x28')]=_0x4e8332['attributes'][_0x0d14('0x2b')]?_0x4e8332['attributes']:_0x72de57[_0x0d14('0x27')];if(!_0x486ecd[_0x0d14('0x24')][_0x0d14('0x2c')](_0x0d14('0x2d'))){_0x4e8332['limit']=qs[_0x0d14('0x2e')](_0x486ecd[_0x0d14('0x24')][_0x0d14('0x2e')]);_0x4e8332[_0x0d14('0x17')]=qs[_0x0d14('0x17')](_0x486ecd[_0x0d14('0x24')][_0x0d14('0x17')]);}_0x4e8332[_0x0d14('0x2f')]=qs[_0x0d14('0x30')](_0x486ecd[_0x0d14('0x24')]['sort']);_0x4e8332[_0x0d14('0x31')]=qs[_0x0d14('0x26')](_['pick'](_0x486ecd[_0x0d14('0x24')],_0x72de57[_0x0d14('0x26')]));if(_0x348319[_0x0d14('0x25')]){if(_0x348319[_0x0d14('0x32')]){_0x348319[_0x0d14('0x32')]=moment(_0x348319[_0x0d14('0x32')])['add'](0x1,'day');}else{_0x348319[_0x0d14('0x32')]=moment(_0x348319[_0x0d14('0x25')])[_0x0d14('0x33')](0x1,_0x0d14('0x34'));}_[_0x0d14('0x35')](_0x4e8332[_0x0d14('0x31')],{'createdAt':{'$gte':_0x348319['dateStart'],'$lte':_0x348319['dateEnd']}});}if(_0x486ecd['query'][_0x0d14('0x36')]){_0x4e8332[_0x0d14('0x31')]=_['merge'](_0x4e8332['where'],{'$or':_[_0x0d14('0x37')](_0x4e8332[_0x0d14('0x28')],function(_0x2b6478){var _0x56a6a0={};_0x56a6a0[_0x2b6478]={'$like':'%'+_0x486ecd['query'][_0x0d14('0x36')]+'%'};return _0x56a6a0;})});}_0x4e8332=_[_0x0d14('0x35')]({},_0x4e8332,_0x486ecd[_0x0d14('0x38')]);var _0x242ed1={'where':_0x4e8332[_0x0d14('0x31')]};return db[_0x0d14('0x22')][_0x0d14('0x16')](_0x242ed1)[_0x0d14('0x1c')](function(_0x15eddb){_0x2cea6f[_0x0d14('0x16')]=_0x15eddb;if(_0x486ecd['query'][_0x0d14('0x39')]){_0x4e8332[_0x0d14('0x3a')]=[{'all':!![]}];}return db[_0x0d14('0x22')][_0x0d14('0x3b')](_0x4e8332);})[_0x0d14('0x1c')](function(_0x1c8cf5){_0x2cea6f[_0x0d14('0x3c')]=_0x1c8cf5;return _0x2cea6f;})[_0x0d14('0x1c')](respondWithFilteredResult(_0x19b86a,_0x4e8332))['catch'](handleError(_0x19b86a,null));};exports[_0x0d14('0x3d')]=function(_0x136f2a,_0x42962d){var _0x625a86={'raw':!![],'where':{'id':_0x136f2a['params']['id']}},_0x5c1961={};_0x5c1961['model']=_[_0x0d14('0x3e')](db[_0x0d14('0x22')]['rawAttributes']);_0x5c1961[_0x0d14('0x24')]=_['keys'](_0x136f2a[_0x0d14('0x24')]);_0x5c1961[_0x0d14('0x26')]=_['intersection'](_0x5c1961[_0x0d14('0x27')],_0x5c1961['query']);_0x625a86[_0x0d14('0x28')]=_[_0x0d14('0x29')](_0x5c1961[_0x0d14('0x27')],qs[_0x0d14('0x2a')](_0x136f2a[_0x0d14('0x24')]['fields']));_0x625a86[_0x0d14('0x28')]=_0x625a86[_0x0d14('0x28')][_0x0d14('0x2b')]?_0x625a86[_0x0d14('0x28')]:_0x5c1961[_0x0d14('0x27')];if(_0x136f2a['query'][_0x0d14('0x39')]){_0x625a86[_0x0d14('0x3a')]=[{'all':!![]}];}_0x625a86=_['merge']({},_0x625a86,_0x136f2a[_0x0d14('0x38')]);return db[_0x0d14('0x22')]['find'](_0x625a86)[_0x0d14('0x1c')](handleEntityNotFound(_0x42962d,null))['then'](respondWithResult(_0x42962d,null))['catch'](handleError(_0x42962d,null));};exports['create']=function(_0x5e5a02,_0xec9067){return db[_0x0d14('0x22')]['create'](_0x5e5a02[_0x0d14('0x3f')],{})[_0x0d14('0x1c')](respondWithResult(_0xec9067,0xc9))[_0x0d14('0x40')](handleError(_0xec9067,null));};exports[_0x0d14('0x1b')]=function(_0x48563d,_0x4df772){if(_0x48563d[_0x0d14('0x3f')]['id']){delete _0x48563d[_0x0d14('0x3f')]['id'];}return db[_0x0d14('0x22')][_0x0d14('0x41')]({'where':{'id':_0x48563d[_0x0d14('0x42')]['id']}})[_0x0d14('0x1c')](handleEntityNotFound(_0x4df772,null))['then'](saveUpdates(_0x48563d[_0x0d14('0x3f')],null))[_0x0d14('0x1c')](respondWithResult(_0x4df772,null))[_0x0d14('0x40')](handleError(_0x4df772,null));};exports[_0x0d14('0x1d')]=function(_0x3ff5c2,_0x4d2ca1){return db['SquareReport'][_0x0d14('0x41')]({'where':{'id':_0x3ff5c2[_0x0d14('0x42')]['id']}})[_0x0d14('0x1c')](handleEntityNotFound(_0x4d2ca1,null))[_0x0d14('0x1c')](removeEntity(_0x4d2ca1,null))[_0x0d14('0x40')](handleError(_0x4d2ca1,null));};exports[_0x0d14('0x43')]=function(_0x3e577a,_0x497428){return db[_0x0d14('0x22')]['describe']()[_0x0d14('0x1c')](respondWithResult(_0x497428,null))[_0x0d14('0x40')](handleError(_0x497428,null));}; \ No newline at end of file +var _0x7178=['error','stack','name','send','index','SquareReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','limit','order','sort','pick','day','add','merge','filter','where','map','options','includeAll','include','findAll','rows','show','params','length','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','save','update','then','destroy','end'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7178,0xbd));var _0x8717=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x7178[_0x19950b];return _0x3c6b41;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8717('0x0'));var rimraf=require(_0x8717('0x1'));var zipdir=require(_0x8717('0x2'));var jsonpatch=require(_0x8717('0x3'));var rp=require(_0x8717('0x4'));var moment=require(_0x8717('0x5'));var BPromise=require(_0x8717('0x6'));var Mustache=require(_0x8717('0x7'));var util=require(_0x8717('0x8'));var path=require(_0x8717('0x9'));var sox=require(_0x8717('0xa'));var csv=require(_0x8717('0xb'));var ejs=require(_0x8717('0xc'));var fs=require('fs');var _=require(_0x8717('0xd'));var squel=require(_0x8717('0xe'));var crypto=require(_0x8717('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8717('0xb'));var querystring=require(_0x8717('0x10'));var Papa=require('papaparse');var Redis=require(_0x8717('0x11'));var qs=require(_0x8717('0x12'));var logger=require(_0x8717('0x13'))(_0x8717('0x14'));var utils=require(_0x8717('0x15'));var config=require('../../config/environment');var db=require(_0x8717('0x16'))['db'];function respondWithStatusCode(_0xc0a8bc,_0x4a9e36){_0x4a9e36=_0x4a9e36||0xcc;return function(_0x3c9c51){if(_0x3c9c51){return _0xc0a8bc[_0x8717('0x17')](_0x4a9e36);}return _0xc0a8bc[_0x8717('0x18')](_0x4a9e36)['end']();};}function respondWithResult(_0x2393aa,_0x1275e3){_0x1275e3=_0x1275e3||0xc8;return function(_0x544565){if(_0x544565){return _0x2393aa['status'](_0x1275e3)[_0x8717('0x19')](_0x544565);}};}function respondWithFilteredResult(_0x2b511d,_0x2994f8){return function(_0x29294c){if(_0x29294c){var _0x47deea=_0x29294c[_0x8717('0x1a')],_0x3f4a65=_0x2994f8[_0x8717('0x1b')],_0x24c386=_0x2994f8[_0x8717('0x1b')]+_0x2994f8['limit'],_0x82a81f;if(_0x24c386>=_0x47deea){_0x24c386=_0x47deea;_0x82a81f=0xc8;}else{_0x82a81f=0xce;}_0x2b511d[_0x8717('0x18')](_0x82a81f);return _0x2b511d[_0x8717('0x1c')](_0x8717('0x1d'),_0x3f4a65+'-'+_0x24c386+'/'+_0x47deea)['json'](_0x29294c);}return null;};}function patchUpdates(_0x22c925){return function(_0x2f1b81){try{jsonpatch[_0x8717('0x1e')](_0x2f1b81,_0x22c925,!![]);}catch(_0x533142){return BPromise['reject'](_0x533142);}return _0x2f1b81[_0x8717('0x1f')]();};}function saveUpdates(_0x1e78e5,_0xab397){return function(_0x49069a){if(_0x49069a){return _0x49069a[_0x8717('0x20')](_0x1e78e5)[_0x8717('0x21')](function(_0x3c35ff){return _0x3c35ff;});}return null;};}function removeEntity(_0x6ac017,_0x51008e){return function(_0x22b66){if(_0x22b66){return _0x22b66[_0x8717('0x22')]()['then'](function(){_0x6ac017[_0x8717('0x18')](0xcc)[_0x8717('0x23')]();});}};}function handleEntityNotFound(_0x17ae92,_0x54441b){return function(_0x5044e5){if(!_0x5044e5){_0x17ae92[_0x8717('0x17')](0x194);}return _0x5044e5;};}function handleError(_0x49a1e3,_0xceeafe){_0xceeafe=_0xceeafe||0x1f4;return function(_0x5c5e1c){logger[_0x8717('0x24')](_0x5c5e1c[_0x8717('0x25')]);if(_0x5c5e1c['name']){delete _0x5c5e1c[_0x8717('0x26')];}_0x49a1e3[_0x8717('0x18')](_0xceeafe)[_0x8717('0x27')](_0x5c5e1c);};}exports[_0x8717('0x28')]=function(_0x3e5dfc,_0x23c08d){var _0x2e7d50={},_0x4fb277={},_0x2a5704={'count':0x0,'rows':[]};var _0x22d621=db[_0x8717('0x29')][_0x8717('0x2a')];_0x4fb277[_0x8717('0x2b')]=_[_0x8717('0x2c')](_0x22d621);var _0x8b6d57={'dateStart':_0x3e5dfc[_0x8717('0x2d')][_0x8717('0x2e')],'dateEnd':_0x3e5dfc[_0x8717('0x2d')]['dateEnd']};delete _0x3e5dfc[_0x8717('0x2d')][_0x8717('0x2e')];delete _0x3e5dfc['query'][_0x8717('0x2f')];_0x4fb277[_0x8717('0x2d')]=_[_0x8717('0x2c')](_0x3e5dfc[_0x8717('0x2d')]);_0x4fb277[_0x8717('0x30')]=_[_0x8717('0x31')](_0x4fb277[_0x8717('0x2b')],_0x4fb277[_0x8717('0x2d')]);_0x2e7d50[_0x8717('0x32')]=_[_0x8717('0x31')](_0x4fb277[_0x8717('0x2b')],qs[_0x8717('0x33')](_0x3e5dfc['query'][_0x8717('0x33')]));_0x2e7d50['attributes']=_0x2e7d50[_0x8717('0x32')]['length']?_0x2e7d50[_0x8717('0x32')]:_0x4fb277[_0x8717('0x2b')];if(!_0x3e5dfc[_0x8717('0x2d')]['hasOwnProperty']('nolimit')){_0x2e7d50[_0x8717('0x34')]=qs[_0x8717('0x34')](_0x3e5dfc[_0x8717('0x2d')][_0x8717('0x34')]);_0x2e7d50[_0x8717('0x1b')]=qs['offset'](_0x3e5dfc[_0x8717('0x2d')]['offset']);}_0x2e7d50[_0x8717('0x35')]=qs[_0x8717('0x36')](_0x3e5dfc[_0x8717('0x2d')][_0x8717('0x36')]);_0x2e7d50['where']=qs['filters'](_[_0x8717('0x37')](_0x3e5dfc[_0x8717('0x2d')],_0x4fb277[_0x8717('0x30')]));if(_0x8b6d57[_0x8717('0x2e')]){if(_0x8b6d57[_0x8717('0x2f')]){_0x8b6d57[_0x8717('0x2f')]=moment(_0x8b6d57['dateEnd'])['add'](0x1,_0x8717('0x38'));}else{_0x8b6d57['dateEnd']=moment(_0x8b6d57['dateStart'])[_0x8717('0x39')](0x1,_0x8717('0x38'));}_[_0x8717('0x3a')](_0x2e7d50['where'],{'createdAt':{'$gte':_0x8b6d57[_0x8717('0x2e')],'$lte':_0x8b6d57[_0x8717('0x2f')]}});}if(_0x3e5dfc[_0x8717('0x2d')][_0x8717('0x3b')]){_0x2e7d50['where']=_[_0x8717('0x3a')](_0x2e7d50[_0x8717('0x3c')],{'$or':_[_0x8717('0x3d')](_0x2e7d50[_0x8717('0x32')],function(_0x330d62){var _0xc8e20b={};_0xc8e20b[_0x330d62]={'$like':'%'+_0x3e5dfc[_0x8717('0x2d')][_0x8717('0x3b')]+'%'};return _0xc8e20b;})});}_0x2e7d50=_['merge']({},_0x2e7d50,_0x3e5dfc[_0x8717('0x3e')]);var _0x2c7a6d={'where':_0x2e7d50[_0x8717('0x3c')]};return db[_0x8717('0x29')][_0x8717('0x1a')](_0x2c7a6d)[_0x8717('0x21')](function(_0x5d957f){_0x2a5704[_0x8717('0x1a')]=_0x5d957f;if(_0x3e5dfc[_0x8717('0x2d')][_0x8717('0x3f')]){_0x2e7d50[_0x8717('0x40')]=[{'all':!![]}];}return db[_0x8717('0x29')][_0x8717('0x41')](_0x2e7d50);})[_0x8717('0x21')](function(_0x31faf7){_0x2a5704[_0x8717('0x42')]=_0x31faf7;return _0x2a5704;})[_0x8717('0x21')](respondWithFilteredResult(_0x23c08d,_0x2e7d50))['catch'](handleError(_0x23c08d,null));};exports[_0x8717('0x43')]=function(_0x4b0c7a,_0x394d79){var _0x3bf55d={'raw':!![],'where':{'id':_0x4b0c7a[_0x8717('0x44')]['id']}},_0x2656c4={};_0x2656c4['model']=_[_0x8717('0x2c')](db[_0x8717('0x29')][_0x8717('0x2a')]);_0x2656c4['query']=_[_0x8717('0x2c')](_0x4b0c7a[_0x8717('0x2d')]);_0x2656c4[_0x8717('0x30')]=_[_0x8717('0x31')](_0x2656c4[_0x8717('0x2b')],_0x2656c4[_0x8717('0x2d')]);_0x3bf55d[_0x8717('0x32')]=_[_0x8717('0x31')](_0x2656c4['model'],qs[_0x8717('0x33')](_0x4b0c7a[_0x8717('0x2d')][_0x8717('0x33')]));_0x3bf55d[_0x8717('0x32')]=_0x3bf55d[_0x8717('0x32')][_0x8717('0x45')]?_0x3bf55d[_0x8717('0x32')]:_0x2656c4[_0x8717('0x2b')];if(_0x4b0c7a[_0x8717('0x2d')][_0x8717('0x3f')]){_0x3bf55d[_0x8717('0x40')]=[{'all':!![]}];}_0x3bf55d=_[_0x8717('0x3a')]({},_0x3bf55d,_0x4b0c7a[_0x8717('0x3e')]);return db['SquareReport'][_0x8717('0x46')](_0x3bf55d)[_0x8717('0x21')](handleEntityNotFound(_0x394d79,null))[_0x8717('0x21')](respondWithResult(_0x394d79,null))['catch'](handleError(_0x394d79,null));};exports[_0x8717('0x47')]=function(_0x375e1b,_0x42cfff){return db[_0x8717('0x29')]['create'](_0x375e1b[_0x8717('0x48')],{})[_0x8717('0x21')](respondWithResult(_0x42cfff,0xc9))[_0x8717('0x49')](handleError(_0x42cfff,null));};exports['update']=function(_0x440a7a,_0x172f6e){if(_0x440a7a[_0x8717('0x48')]['id']){delete _0x440a7a[_0x8717('0x48')]['id'];}return db[_0x8717('0x29')]['find']({'where':{'id':_0x440a7a[_0x8717('0x44')]['id']}})[_0x8717('0x21')](handleEntityNotFound(_0x172f6e,null))[_0x8717('0x21')](saveUpdates(_0x440a7a[_0x8717('0x48')],null))['then'](respondWithResult(_0x172f6e,null))[_0x8717('0x49')](handleError(_0x172f6e,null));};exports[_0x8717('0x22')]=function(_0x491818,_0x55ed60){return db[_0x8717('0x29')][_0x8717('0x46')]({'where':{'id':_0x491818[_0x8717('0x44')]['id']}})[_0x8717('0x21')](handleEntityNotFound(_0x55ed60,null))['then'](removeEntity(_0x55ed60,null))[_0x8717('0x49')](handleError(_0x55ed60,null));};exports[_0x8717('0x4a')]=function(_0x192228,_0x1a2c34){return db[_0x8717('0x29')][_0x8717('0x4a')]()['then'](respondWithResult(_0x1a2c34,null))[_0x8717('0x49')](handleError(_0x1a2c34,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index b4828fb..54663b3 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 _0x9c0c=['SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','bluebird','request-promise','./squareReport.attributes','exports'];(function(_0x7ef0f,_0x33eefe){var _0x10424b=function(_0x569c1d){while(--_0x569c1d){_0x7ef0f['push'](_0x7ef0f['shift']());}};_0x10424b(++_0x33eefe);}(_0x9c0c,0xe6));var _0xc9c0=function(_0x151418,_0x2cbffa){_0x151418=_0x151418-0x0;var _0x40e29a=_0x9c0c[_0x151418];return _0x40e29a;};'use strict';var _=require(_0xc9c0('0x0'));var util=require(_0xc9c0('0x1'));var logger=require(_0xc9c0('0x2'))(_0xc9c0('0x3'));var moment=require('moment');var BPromise=require(_0xc9c0('0x4'));var rp=require(_0xc9c0('0x5'));var attributes=require(_0xc9c0('0x6'));module[_0xc9c0('0x7')]=function(_0x5ddcae,_0x998b2e){return _0x5ddcae['define'](_0xc9c0('0x8'),attributes,{'tableName':_0xc9c0('0x9'),'paranoid':![],'indexes':[{'name':_0xc9c0('0xa'),'fields':[_0xc9c0('0xb'),_0xc9c0('0xc')]},{'name':'leaveAt','fields':[_0xc9c0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0ed4=['leaveAt','lodash','../../config/logger','api','moment','bluebird','request-promise','exports','SquareReport','report_square','uid_pname','uniqueid','project_name'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x0ed4,0x146));var _0x40ed=function(_0x256a42,_0x4e6542){_0x256a42=_0x256a42-0x0;var _0x4663e4=_0x0ed4[_0x256a42];return _0x4663e4;};'use strict';var _=require(_0x40ed('0x0'));var util=require('util');var logger=require(_0x40ed('0x1'))(_0x40ed('0x2'));var moment=require(_0x40ed('0x3'));var BPromise=require(_0x40ed('0x4'));var rp=require(_0x40ed('0x5'));var attributes=require('./squareReport.attributes');module[_0x40ed('0x6')]=function(_0xff2617,_0x20b0ef){return _0xff2617['define'](_0x40ed('0x7'),attributes,{'tableName':_0x40ed('0x8'),'paranoid':![],'indexes':[{'name':_0x40ed('0x9'),'fields':[_0x40ed('0xa'),_0x40ed('0xb')]},{'name':_0x40ed('0xc'),'fields':[_0x40ed('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 9e2122d..d7e2b7c 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 _0xa6fc=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','info','SquareReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','result','message','catch','SquareReport','create','options','then','CreateSquareReport','UpdateSquareReport','update','raw','attributes','limit','util','moment'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xa6fc,0x7a));var _0xca6f=function(_0x3926dc,_0x72c472){_0x3926dc=_0x3926dc-0x0;var _0x56d20e=_0xa6fc[_0x3926dc];return _0x56d20e;};'use strict';var _=require('lodash');var util=require(_0xca6f('0x0'));var moment=require(_0xca6f('0x1'));var BPromise=require(_0xca6f('0x2'));var rs=require(_0xca6f('0x3'));var fs=require('fs');var Redis=require(_0xca6f('0x4'));var db=require(_0xca6f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xca6f('0x6'))(_0xca6f('0x7'));var config=require(_0xca6f('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xca6f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18529e,_0x21b06c,_0x41e590){return new BPromise(function(_0x47c777,_0x2041b4){return client[_0xca6f('0xa')](_0x18529e,_0x41e590)['then'](function(_0x190034){logger[_0xca6f('0xb')](_0xca6f('0xc'),_0x21b06c,'request\x20sent');logger[_0xca6f('0xd')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x21b06c,_0xca6f('0xe'),JSON[_0xca6f('0xf')](_0x190034));if(_0x190034['error']){if(_0x190034[_0xca6f('0x10')][_0xca6f('0x11')]===0x1f4){logger[_0xca6f('0x10')]('SquareReport,\x20%s,\x20%s',_0x21b06c,_0x190034[_0xca6f('0x10')]['message']);return _0x2041b4(_0x190034[_0xca6f('0x10')]['message']);}logger['error'](_0xca6f('0xc'),_0x21b06c,_0x190034[_0xca6f('0x10')]['message']);return _0x47c777(_0x190034['error']['message']);}else{logger[_0xca6f('0xb')](_0xca6f('0xc'),_0x21b06c,_0xca6f('0xe'));_0x47c777(_0x190034[_0xca6f('0x12')][_0xca6f('0x13')]);}})[_0xca6f('0x14')](function(_0x116300){logger[_0xca6f('0x10')](_0xca6f('0xc'),_0x21b06c,_0x116300);_0x2041b4(_0x116300);});});}exports['CreateSquareReport']=function(_0x7dda45){var _0x1f91b7=this;return new Promise(function(_0x1659cd,_0x1f5f20){return db[_0xca6f('0x15')][_0xca6f('0x16')](_0x7dda45['body'],{'raw':_0x7dda45[_0xca6f('0x17')]?_0x7dda45[_0xca6f('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xca6f('0x18')](function(_0x3a9325){logger['info'](_0xca6f('0x19'),_0x7dda45);logger['debug'](_0xca6f('0x19'),_0x7dda45,JSON['stringify'](_0x3a9325));_0x1659cd(_0x3a9325);})['catch'](function(_0x347002){logger['error'](_0xca6f('0x19'),_0x347002['message'],_0x7dda45);_0x1f5f20(_0x1f91b7['error'](0x1f4,_0x347002[_0xca6f('0x13')]));});});};exports[_0xca6f('0x1a')]=function(_0x2046dd){var _0x4ffb51=this;return new Promise(function(_0x10c862,_0x26ca19){return db['SquareReport'][_0xca6f('0x1b')](_0x2046dd['body'],{'raw':_0x2046dd[_0xca6f('0x17')]?_0x2046dd['options'][_0xca6f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2046dd[_0xca6f('0x17')]?_0x2046dd[_0xca6f('0x17')]['where']||null:null,'attributes':_0x2046dd[_0xca6f('0x17')]?_0x2046dd[_0xca6f('0x17')][_0xca6f('0x1d')]||null:null,'limit':_0x2046dd['options']?_0x2046dd[_0xca6f('0x17')][_0xca6f('0x1e')]||null:null})[_0xca6f('0x18')](function(_0x34c9ce){logger[_0xca6f('0xb')](_0xca6f('0x1a'),_0x2046dd);logger['debug'](_0xca6f('0x1a'),_0x2046dd,JSON[_0xca6f('0xf')](_0x34c9ce));_0x10c862(_0x34c9ce);})[_0xca6f('0x14')](function(_0x509ebc){logger[_0xca6f('0x10')](_0xca6f('0x1a'),_0x509ebc['message'],_0x2046dd);_0x26ca19(_0x4ffb51[_0xca6f('0x10')](0x1f4,_0x509ebc[_0xca6f('0x13')]));});});}; \ No newline at end of file +var _0xdd8c=['debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport','SquareReport','create','options','raw','UpdateSquareReport','update','body','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x2fb87c,_0x2dee49){var _0x43038b=function(_0x7e5396){while(--_0x7e5396){_0x2fb87c['push'](_0x2fb87c['shift']());}};_0x43038b(++_0x2dee49);}(_0xdd8c,0xcb));var _0xcdd8=function(_0x46b398,_0x38a5f4){_0x46b398=_0x46b398-0x0;var _0xf8a0e4=_0xdd8c[_0x46b398];return _0xf8a0e4;};'use strict';var _=require('lodash');var util=require(_0xcdd8('0x0'));var moment=require('moment');var BPromise=require(_0xcdd8('0x1'));var rs=require(_0xcdd8('0x2'));var fs=require('fs');var Redis=require(_0xcdd8('0x3'));var db=require(_0xcdd8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcdd8('0x5'))('rpc');var config=require(_0xcdd8('0x6'));var jayson=require(_0xcdd8('0x7'));var client=jayson[_0xcdd8('0x8')][_0xcdd8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5cc13a,_0x40f443,_0x40e2c3){return new BPromise(function(_0x508cf5,_0x2110a4){return client[_0xcdd8('0xa')](_0x5cc13a,_0x40e2c3)[_0xcdd8('0xb')](function(_0x268287){logger[_0xcdd8('0xc')]('SquareReport,\x20%s,\x20%s',_0x40f443,_0xcdd8('0xd'));logger[_0xcdd8('0xe')](_0xcdd8('0xf'),_0x40f443,_0xcdd8('0xd'),JSON[_0xcdd8('0x10')](_0x268287));if(_0x268287[_0xcdd8('0x11')]){if(_0x268287[_0xcdd8('0x11')][_0xcdd8('0x12')]===0x1f4){logger[_0xcdd8('0x11')](_0xcdd8('0x13'),_0x40f443,_0x268287[_0xcdd8('0x11')]['message']);return _0x2110a4(_0x268287['error'][_0xcdd8('0x14')]);}logger[_0xcdd8('0x11')](_0xcdd8('0x13'),_0x40f443,_0x268287[_0xcdd8('0x11')][_0xcdd8('0x14')]);return _0x508cf5(_0x268287[_0xcdd8('0x11')][_0xcdd8('0x14')]);}else{logger['info'](_0xcdd8('0x13'),_0x40f443,_0xcdd8('0xd'));_0x508cf5(_0x268287[_0xcdd8('0x15')][_0xcdd8('0x14')]);}})[_0xcdd8('0x16')](function(_0x5c0ea7){logger['error'](_0xcdd8('0x13'),_0x40f443,_0x5c0ea7);_0x2110a4(_0x5c0ea7);});});}exports[_0xcdd8('0x17')]=function(_0x1a59e6){var _0x45d48d=this;return new Promise(function(_0x35992d,_0x4aa5ea){return db[_0xcdd8('0x18')][_0xcdd8('0x19')](_0x1a59e6['body'],{'raw':_0x1a59e6['options']?_0x1a59e6[_0xcdd8('0x1a')][_0xcdd8('0x1b')]===undefined?!![]:![]:!![]})[_0xcdd8('0xb')](function(_0x49ef63){logger[_0xcdd8('0xc')](_0xcdd8('0x17'),_0x1a59e6);logger[_0xcdd8('0xe')](_0xcdd8('0x17'),_0x1a59e6,JSON[_0xcdd8('0x10')](_0x49ef63));_0x35992d(_0x49ef63);})[_0xcdd8('0x16')](function(_0x201d20){logger[_0xcdd8('0x11')](_0xcdd8('0x17'),_0x201d20[_0xcdd8('0x14')],_0x1a59e6);_0x4aa5ea(_0x45d48d['error'](0x1f4,_0x201d20['message']));});});};exports[_0xcdd8('0x1c')]=function(_0x46afae){var _0x95a070=this;return new Promise(function(_0x21148d,_0x3c874f){return db[_0xcdd8('0x18')][_0xcdd8('0x1d')](_0x46afae[_0xcdd8('0x1e')],{'raw':_0x46afae['options']?_0x46afae['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46afae[_0xcdd8('0x1a')]?_0x46afae[_0xcdd8('0x1a')]['where']||null:null,'attributes':_0x46afae['options']?_0x46afae[_0xcdd8('0x1a')]['attributes']||null:null,'limit':_0x46afae[_0xcdd8('0x1a')]?_0x46afae[_0xcdd8('0x1a')]['limit']||null:null})[_0xcdd8('0xb')](function(_0x33cd46){logger[_0xcdd8('0xc')]('UpdateSquareReport',_0x46afae);logger['debug'](_0xcdd8('0x1c'),_0x46afae,JSON['stringify'](_0x33cd46));_0x21148d(_0x33cd46);})[_0xcdd8('0x16')](function(_0x1b1168){logger[_0xcdd8('0x11')](_0xcdd8('0x1c'),_0x1b1168[_0xcdd8('0x14')],_0x46afae);_0x3c874f(_0x95a070[_0xcdd8('0x11')](0x1f4,_0x1b1168['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index a983ead..861fcdd 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 _0x036c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','index','/describe','isAuthenticated','describe','get','show','create','put','/:id','update','delete','destroy','exports','express','Router'];(function(_0x30dc7b,_0x4f6f69){var _0xabbfc2=function(_0x214a2e){while(--_0x214a2e){_0x30dc7b['push'](_0x30dc7b['shift']());}};_0xabbfc2(++_0x4f6f69);}(_0x036c,0x1b3));var _0xc036=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x036c[_0x173d7e];return _0x2220d6;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc036('0x0'));var router=express[_0xc036('0x1')]();var auth=require(_0xc036('0x2'));var interaction=require(_0xc036('0x3'));var config=require(_0xc036('0x4'));var controller=require(_0xc036('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xc036('0x6')]);router['get'](_0xc036('0x7'),auth[_0xc036('0x8')](),controller[_0xc036('0x9')]);router[_0xc036('0xa')]('/:id',auth[_0xc036('0x8')](),controller[_0xc036('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc036('0xc')]);router[_0xc036('0xd')](_0xc036('0xe'),auth[_0xc036('0x8')](),controller[_0xc036('0xf')]);router[_0xc036('0x10')](_0xc036('0xe'),auth['isAuthenticated'](),controller[_0xc036('0x11')]);module[_0xc036('0x12')]=router; \ No newline at end of file +var _0xc7ee=['express','Router','../../components/auth/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0xc7ee,0x10e));var _0xec7e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc7ee[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xec7e('0x0'));var util=require('util');var path=require(_0xec7e('0x1'));var timeout=require(_0xec7e('0x2'));var express=require(_0xec7e('0x3'));var router=express[_0xec7e('0x4')]();var auth=require(_0xec7e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xec7e('0x6'));var controller=require(_0xec7e('0x7'));router[_0xec7e('0x8')]('/',auth[_0xec7e('0x9')](),controller[_0xec7e('0xa')]);router['get'](_0xec7e('0xb'),auth[_0xec7e('0x9')](),controller[_0xec7e('0xc')]);router[_0xec7e('0x8')](_0xec7e('0xd'),auth[_0xec7e('0x9')](),controller[_0xec7e('0xe')]);router[_0xec7e('0xf')]('/',auth[_0xec7e('0x9')](),controller[_0xec7e('0x10')]);router['put'](_0xec7e('0xd'),auth['isAuthenticated'](),controller[_0xec7e('0x11')]);router[_0xec7e('0x12')](_0xec7e('0xd'),auth['isAuthenticated'](),controller[_0xec7e('0x13')]);module[_0xec7e('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index a4f943f..0c0e8a4 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 _0xde9e=['STRING','sequelize','exports'];(function(_0x24d98c,_0x20ed15){var _0x16c9e=function(_0x3640c6){while(--_0x3640c6){_0x24d98c['push'](_0x24d98c['shift']());}};_0x16c9e(++_0x20ed15);}(_0xde9e,0x8e));var _0xede9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde9e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xede9('0x0'));module[_0xede9('0x1')]={'uniqueid':{'type':Sequelize[_0xede9('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xede9('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0xede9('0x2')]},'callerid':{'type':Sequelize[_0xede9('0x2')]}}; \ No newline at end of file +var _0x2849=['exports','STRING','sequelize'];(function(_0xfcbcb8,_0x35bf6b){var _0x1b1f97=function(_0x51e11d){while(--_0x51e11d){_0xfcbcb8['push'](_0xfcbcb8['shift']());}};_0x1b1f97(++_0x35bf6b);}(_0x2849,0x89));var _0x9284=function(_0x3df8c0,_0xdd192c){_0x3df8c0=_0x3df8c0-0x0;var _0x68a5a=_0x2849[_0x3df8c0];return _0x68a5a;};'use strict';var Sequelize=require(_0x9284('0x0'));module[_0x9284('0x1')]={'uniqueid':{'type':Sequelize[_0x9284('0x2')]},'node':{'type':Sequelize[_0x9284('0x2')]},'application':{'type':Sequelize[_0x9284('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index cae34d6..db07f2d 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 _0x7b0d=['index','SquareDetailsReport','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','count','includeAll','include','findAll','catch','params','rawAttributes','length','find','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','update','then','destroy','stack','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7b0d,0x100));var _0xd7b0=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x7b0d[_0x2576d7];return _0x16a08c;};'use strict';var pdf=require(_0xd7b0('0x0'));var emlformat=require(_0xd7b0('0x1'));var rimraf=require(_0xd7b0('0x2'));var zipdir=require(_0xd7b0('0x3'));var jsonpatch=require(_0xd7b0('0x4'));var rp=require('request-promise');var moment=require(_0xd7b0('0x5'));var BPromise=require(_0xd7b0('0x6'));var Mustache=require(_0xd7b0('0x7'));var util=require(_0xd7b0('0x8'));var path=require(_0xd7b0('0x9'));var sox=require(_0xd7b0('0xa'));var csv=require(_0xd7b0('0xb'));var ejs=require(_0xd7b0('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd7b0('0xd'));var crypto=require(_0xd7b0('0xe'));var jsforce=require(_0xd7b0('0xf'));var deskjs=require(_0xd7b0('0x10'));var toCsv=require(_0xd7b0('0xb'));var querystring=require(_0xd7b0('0x11'));var Papa=require(_0xd7b0('0x12'));var Redis=require(_0xd7b0('0x13'));var qs=require(_0xd7b0('0x14'));var logger=require(_0xd7b0('0x15'))(_0xd7b0('0x16'));var utils=require(_0xd7b0('0x17'));var config=require(_0xd7b0('0x18'));var db=require(_0xd7b0('0x19'))['db'];function respondWithStatusCode(_0x492e78,_0x331b97){_0x331b97=_0x331b97||0xcc;return function(_0x3dc026){if(_0x3dc026){return _0x492e78[_0xd7b0('0x1a')](_0x331b97);}return _0x492e78[_0xd7b0('0x1b')](_0x331b97)[_0xd7b0('0x1c')]();};}function respondWithResult(_0x38e5e2,_0x15d931){_0x15d931=_0x15d931||0xc8;return function(_0x495b03){if(_0x495b03){return _0x38e5e2[_0xd7b0('0x1b')](_0x15d931)[_0xd7b0('0x1d')](_0x495b03);}};}function respondWithFilteredResult(_0x5ced9b,_0x24c6fd){return function(_0x2ad573){if(_0x2ad573){var _0x37b628=_0x2ad573['count'],_0x426a1d=_0x24c6fd[_0xd7b0('0x1e')],_0x38f698=_0x24c6fd[_0xd7b0('0x1e')]+_0x24c6fd[_0xd7b0('0x1f')],_0x1166ea;if(_0x38f698>=_0x37b628){_0x38f698=_0x37b628;_0x1166ea=0xc8;}else{_0x1166ea=0xce;}_0x5ced9b['status'](_0x1166ea);return _0x5ced9b[_0xd7b0('0x20')]('Content-Range',_0x426a1d+'-'+_0x38f698+'/'+_0x37b628)[_0xd7b0('0x1d')](_0x2ad573);}return null;};}function patchUpdates(_0x49d2cc){return function(_0x1f90d7){try{jsonpatch[_0xd7b0('0x21')](_0x1f90d7,_0x49d2cc,!![]);}catch(_0x263ad0){return BPromise[_0xd7b0('0x22')](_0x263ad0);}return _0x1f90d7['save']();};}function saveUpdates(_0x152dd7,_0x437306){return function(_0x4d146a){if(_0x4d146a){return _0x4d146a[_0xd7b0('0x23')](_0x152dd7)[_0xd7b0('0x24')](function(_0x112472){return _0x112472;});}return null;};}function removeEntity(_0x4bbd66,_0x1021fe){return function(_0x47062e){if(_0x47062e){return _0x47062e[_0xd7b0('0x25')]()[_0xd7b0('0x24')](function(){_0x4bbd66[_0xd7b0('0x1b')](0xcc)[_0xd7b0('0x1c')]();});}};}function handleEntityNotFound(_0x177b7d,_0x124185){return function(_0x145e6f){if(!_0x145e6f){_0x177b7d['sendStatus'](0x194);}return _0x145e6f;};}function handleError(_0x3de90a,_0x29e0ac){_0x29e0ac=_0x29e0ac||0x1f4;return function(_0x13a6bf){logger['error'](_0x13a6bf[_0xd7b0('0x26')]);if(_0x13a6bf[_0xd7b0('0x27')]){delete _0x13a6bf['name'];}_0x3de90a[_0xd7b0('0x1b')](_0x29e0ac)['send'](_0x13a6bf);};}exports[_0xd7b0('0x28')]=function(_0xd4655d,_0x3d938c){var _0xfb3d0={},_0x57c17d={},_0x1b7232={'count':0x0,'rows':[]};var _0x389a5e=db[_0xd7b0('0x29')]['rawAttributes'];_0x57c17d['model']=_[_0xd7b0('0x2a')](_0x389a5e);var _0x4434cf={'dateStart':_0xd4655d[_0xd7b0('0x2b')][_0xd7b0('0x2c')],'dateEnd':_0xd4655d[_0xd7b0('0x2b')][_0xd7b0('0x2d')]};delete _0xd4655d['query'][_0xd7b0('0x2c')];delete _0xd4655d[_0xd7b0('0x2b')][_0xd7b0('0x2d')];_0x57c17d['query']=_[_0xd7b0('0x2a')](_0xd4655d['query']);_0x57c17d[_0xd7b0('0x2e')]=_[_0xd7b0('0x2f')](_0x57c17d[_0xd7b0('0x30')],_0x57c17d[_0xd7b0('0x2b')]);_0xfb3d0[_0xd7b0('0x31')]=_[_0xd7b0('0x2f')](_0x57c17d['model'],qs[_0xd7b0('0x32')](_0xd4655d['query'][_0xd7b0('0x32')]));_0xfb3d0['attributes']=_0xfb3d0[_0xd7b0('0x31')]['length']?_0xfb3d0[_0xd7b0('0x31')]:_0x57c17d[_0xd7b0('0x30')];if(!_0xd4655d[_0xd7b0('0x2b')][_0xd7b0('0x33')](_0xd7b0('0x34'))){_0xfb3d0['limit']=qs[_0xd7b0('0x1f')](_0xd4655d['query'][_0xd7b0('0x1f')]);_0xfb3d0[_0xd7b0('0x1e')]=qs[_0xd7b0('0x1e')](_0xd4655d['query'][_0xd7b0('0x1e')]);}_0xfb3d0[_0xd7b0('0x35')]=qs[_0xd7b0('0x36')](_0xd4655d[_0xd7b0('0x2b')]['sort']);_0xfb3d0[_0xd7b0('0x37')]=qs['filters'](_[_0xd7b0('0x38')](_0xd4655d[_0xd7b0('0x2b')],_0x57c17d[_0xd7b0('0x2e')]));if(_0x4434cf['dateStart']){if(_0x4434cf['dateEnd']){_0x4434cf['dateEnd']=moment(_0x4434cf[_0xd7b0('0x2d')])[_0xd7b0('0x39')](0x1,_0xd7b0('0x3a'));}else{_0x4434cf['dateEnd']=moment(_0x4434cf[_0xd7b0('0x2c')])[_0xd7b0('0x39')](0x1,_0xd7b0('0x3a'));}_[_0xd7b0('0x3b')](_0xfb3d0[_0xd7b0('0x37')],{'createdAt':{'$gte':_0x4434cf[_0xd7b0('0x2c')],'$lte':_0x4434cf[_0xd7b0('0x2d')]}});}if(_0xd4655d['query'][_0xd7b0('0x3c')]){_0xfb3d0[_0xd7b0('0x37')]=_['merge'](_0xfb3d0[_0xd7b0('0x37')],{'$or':_[_0xd7b0('0x3d')](_0xfb3d0[_0xd7b0('0x31')],function(_0x584b08){var _0x1f6ce3={};_0x1f6ce3[_0x584b08]={'$like':'%'+_0xd4655d[_0xd7b0('0x2b')][_0xd7b0('0x3c')]+'%'};return _0x1f6ce3;})});}_0xfb3d0=_[_0xd7b0('0x3b')]({},_0xfb3d0,_0xd4655d[_0xd7b0('0x3e')]);var _0x4ca339={'where':_0xfb3d0[_0xd7b0('0x37')]};return db['SquareDetailsReport'][_0xd7b0('0x3f')](_0x4ca339)[_0xd7b0('0x24')](function(_0x961007){_0x1b7232[_0xd7b0('0x3f')]=_0x961007;if(_0xd4655d[_0xd7b0('0x2b')][_0xd7b0('0x40')]){_0xfb3d0[_0xd7b0('0x41')]=[{'all':!![]}];}return db[_0xd7b0('0x29')][_0xd7b0('0x42')](_0xfb3d0);})[_0xd7b0('0x24')](function(_0x587021){_0x1b7232['rows']=_0x587021;return _0x1b7232;})['then'](respondWithFilteredResult(_0x3d938c,_0xfb3d0))[_0xd7b0('0x43')](handleError(_0x3d938c,null));};exports['show']=function(_0x249705,_0x1cad65){var _0x53d899={'raw':!![],'where':{'id':_0x249705[_0xd7b0('0x44')]['id']}},_0x42fd3b={};_0x42fd3b[_0xd7b0('0x30')]=_[_0xd7b0('0x2a')](db[_0xd7b0('0x29')][_0xd7b0('0x45')]);_0x42fd3b[_0xd7b0('0x2b')]=_[_0xd7b0('0x2a')](_0x249705[_0xd7b0('0x2b')]);_0x42fd3b[_0xd7b0('0x2e')]=_[_0xd7b0('0x2f')](_0x42fd3b[_0xd7b0('0x30')],_0x42fd3b[_0xd7b0('0x2b')]);_0x53d899[_0xd7b0('0x31')]=_[_0xd7b0('0x2f')](_0x42fd3b[_0xd7b0('0x30')],qs[_0xd7b0('0x32')](_0x249705[_0xd7b0('0x2b')][_0xd7b0('0x32')]));_0x53d899[_0xd7b0('0x31')]=_0x53d899[_0xd7b0('0x31')][_0xd7b0('0x46')]?_0x53d899[_0xd7b0('0x31')]:_0x42fd3b['model'];if(_0x249705[_0xd7b0('0x2b')][_0xd7b0('0x40')]){_0x53d899[_0xd7b0('0x41')]=[{'all':!![]}];}_0x53d899=_[_0xd7b0('0x3b')]({},_0x53d899,_0x249705[_0xd7b0('0x3e')]);return db[_0xd7b0('0x29')][_0xd7b0('0x47')](_0x53d899)[_0xd7b0('0x24')](handleEntityNotFound(_0x1cad65,null))[_0xd7b0('0x24')](respondWithResult(_0x1cad65,null))['catch'](handleError(_0x1cad65,null));};exports['create']=function(_0x5d479b,_0x220f8c){return db['SquareDetailsReport']['create'](_0x5d479b[_0xd7b0('0x48')],{})[_0xd7b0('0x24')](respondWithResult(_0x220f8c,0xc9))[_0xd7b0('0x43')](handleError(_0x220f8c,null));};exports[_0xd7b0('0x23')]=function(_0x1eb87f,_0x5255b9){if(_0x1eb87f[_0xd7b0('0x48')]['id']){delete _0x1eb87f[_0xd7b0('0x48')]['id'];}return db[_0xd7b0('0x29')][_0xd7b0('0x47')]({'where':{'id':_0x1eb87f[_0xd7b0('0x44')]['id']}})[_0xd7b0('0x24')](handleEntityNotFound(_0x5255b9,null))[_0xd7b0('0x24')](saveUpdates(_0x1eb87f[_0xd7b0('0x48')],null))[_0xd7b0('0x24')](respondWithResult(_0x5255b9,null))[_0xd7b0('0x43')](handleError(_0x5255b9,null));};exports[_0xd7b0('0x25')]=function(_0x5342ba,_0x48af2c){return db[_0xd7b0('0x29')]['find']({'where':{'id':_0x5342ba[_0xd7b0('0x44')]['id']}})[_0xd7b0('0x24')](handleEntityNotFound(_0x48af2c,null))[_0xd7b0('0x24')](removeEntity(_0x48af2c,null))[_0xd7b0('0x43')](handleError(_0x48af2c,null));};exports[_0xd7b0('0x49')]=function(_0x10aaf2,_0x247391){return db[_0xd7b0('0x29')][_0xd7b0('0x49')]()[_0xd7b0('0x24')](respondWithResult(_0x247391,null))['catch'](handleError(_0x247391,null));}; \ No newline at end of file +var _0x649b=['json','count','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','rawAttributes','model','keys','query','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','sort','where','pick','dateStart','add','day','merge','map','options','SquareDetailsReport','include','show','params','length','includeAll','find','catch','body','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','sendStatus','status','end'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x649b,0x6d));var _0xb649=function(_0xce45c4,_0x1583ff){_0xce45c4=_0xce45c4-0x0;var _0x1075c4=_0x649b[_0xce45c4];return _0x1075c4;};'use strict';var pdf=require(_0xb649('0x0'));var emlformat=require(_0xb649('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb649('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb649('0x3'));var moment=require(_0xb649('0x4'));var BPromise=require(_0xb649('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb649('0x6'));var sox=require('sox');var csv=require(_0xb649('0x7'));var ejs=require(_0xb649('0x8'));var fs=require('fs');var _=require(_0xb649('0x9'));var squel=require(_0xb649('0xa'));var crypto=require(_0xb649('0xb'));var jsforce=require(_0xb649('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb649('0x7'));var querystring=require(_0xb649('0xd'));var Papa=require(_0xb649('0xe'));var Redis=require(_0xb649('0xf'));var qs=require(_0xb649('0x10'));var logger=require(_0xb649('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17b5a3,_0x17e7be){_0x17e7be=_0x17e7be||0xcc;return function(_0x55614a){if(_0x55614a){return _0x17b5a3[_0xb649('0x12')](_0x17e7be);}return _0x17b5a3[_0xb649('0x13')](_0x17e7be)[_0xb649('0x14')]();};}function respondWithResult(_0x37cccc,_0x3c5fae){_0x3c5fae=_0x3c5fae||0xc8;return function(_0x1a3de1){if(_0x1a3de1){return _0x37cccc[_0xb649('0x13')](_0x3c5fae)[_0xb649('0x15')](_0x1a3de1);}};}function respondWithFilteredResult(_0x4263ea,_0x524361){return function(_0x498cdc){if(_0x498cdc){var _0x40b098=_0x498cdc[_0xb649('0x16')],_0x4eca4e=_0x524361['offset'],_0x573c7f=_0x524361['offset']+_0x524361[_0xb649('0x17')],_0x349925;if(_0x573c7f>=_0x40b098){_0x573c7f=_0x40b098;_0x349925=0xc8;}else{_0x349925=0xce;}_0x4263ea[_0xb649('0x13')](_0x349925);return _0x4263ea[_0xb649('0x18')](_0xb649('0x19'),_0x4eca4e+'-'+_0x573c7f+'/'+_0x40b098)[_0xb649('0x15')](_0x498cdc);}return null;};}function patchUpdates(_0x2db5a1){return function(_0x1f1719){try{jsonpatch['apply'](_0x1f1719,_0x2db5a1,!![]);}catch(_0x33bea2){return BPromise[_0xb649('0x1a')](_0x33bea2);}return _0x1f1719[_0xb649('0x1b')]();};}function saveUpdates(_0x2e26db,_0x8f195c){return function(_0x2fb1d7){if(_0x2fb1d7){return _0x2fb1d7['update'](_0x2e26db)[_0xb649('0x1c')](function(_0xb0aec9){return _0xb0aec9;});}return null;};}function removeEntity(_0x34ecce,_0x468b94){return function(_0x31229c){if(_0x31229c){return _0x31229c[_0xb649('0x1d')]()[_0xb649('0x1c')](function(){_0x34ecce[_0xb649('0x13')](0xcc)[_0xb649('0x14')]();});}};}function handleEntityNotFound(_0x503b34,_0x19b7fc){return function(_0x1f3390){if(!_0x1f3390){_0x503b34[_0xb649('0x12')](0x194);}return _0x1f3390;};}function handleError(_0x446272,_0x3eef71){_0x3eef71=_0x3eef71||0x1f4;return function(_0x5315d0){logger[_0xb649('0x1e')](_0x5315d0[_0xb649('0x1f')]);if(_0x5315d0[_0xb649('0x20')]){delete _0x5315d0['name'];}_0x446272[_0xb649('0x13')](_0x3eef71)[_0xb649('0x21')](_0x5315d0);};}exports[_0xb649('0x22')]=function(_0x9c16c9,_0x2de3fe){var _0x2ce4c1={},_0x3907c6={},_0x5b2462={'count':0x0,'rows':[]};var _0x57085f=db['SquareDetailsReport'][_0xb649('0x23')];_0x3907c6[_0xb649('0x24')]=_[_0xb649('0x25')](_0x57085f);var _0x4de518={'dateStart':_0x9c16c9[_0xb649('0x26')]['dateStart'],'dateEnd':_0x9c16c9[_0xb649('0x26')][_0xb649('0x27')]};delete _0x9c16c9[_0xb649('0x26')]['dateStart'];delete _0x9c16c9[_0xb649('0x26')][_0xb649('0x27')];_0x3907c6[_0xb649('0x26')]=_[_0xb649('0x25')](_0x9c16c9['query']);_0x3907c6[_0xb649('0x28')]=_[_0xb649('0x29')](_0x3907c6[_0xb649('0x24')],_0x3907c6['query']);_0x2ce4c1[_0xb649('0x2a')]=_[_0xb649('0x29')](_0x3907c6[_0xb649('0x24')],qs[_0xb649('0x2b')](_0x9c16c9[_0xb649('0x26')][_0xb649('0x2b')]));_0x2ce4c1['attributes']=_0x2ce4c1[_0xb649('0x2a')]['length']?_0x2ce4c1[_0xb649('0x2a')]:_0x3907c6['model'];if(!_0x9c16c9[_0xb649('0x26')][_0xb649('0x2c')](_0xb649('0x2d'))){_0x2ce4c1['limit']=qs['limit'](_0x9c16c9[_0xb649('0x26')]['limit']);_0x2ce4c1[_0xb649('0x2e')]=qs[_0xb649('0x2e')](_0x9c16c9[_0xb649('0x26')][_0xb649('0x2e')]);}_0x2ce4c1['order']=qs[_0xb649('0x2f')](_0x9c16c9['query'][_0xb649('0x2f')]);_0x2ce4c1[_0xb649('0x30')]=qs[_0xb649('0x28')](_[_0xb649('0x31')](_0x9c16c9[_0xb649('0x26')],_0x3907c6[_0xb649('0x28')]));if(_0x4de518[_0xb649('0x32')]){if(_0x4de518[_0xb649('0x27')]){_0x4de518[_0xb649('0x27')]=moment(_0x4de518[_0xb649('0x27')])[_0xb649('0x33')](0x1,'day');}else{_0x4de518['dateEnd']=moment(_0x4de518[_0xb649('0x32')])[_0xb649('0x33')](0x1,_0xb649('0x34'));}_[_0xb649('0x35')](_0x2ce4c1[_0xb649('0x30')],{'createdAt':{'$gte':_0x4de518['dateStart'],'$lte':_0x4de518['dateEnd']}});}if(_0x9c16c9[_0xb649('0x26')]['filter']){_0x2ce4c1[_0xb649('0x30')]=_[_0xb649('0x35')](_0x2ce4c1[_0xb649('0x30')],{'$or':_[_0xb649('0x36')](_0x2ce4c1[_0xb649('0x2a')],function(_0x3d71b6){var _0x5a1ed1={};_0x5a1ed1[_0x3d71b6]={'$like':'%'+_0x9c16c9[_0xb649('0x26')]['filter']+'%'};return _0x5a1ed1;})});}_0x2ce4c1=_['merge']({},_0x2ce4c1,_0x9c16c9[_0xb649('0x37')]);var _0x1d81ab={'where':_0x2ce4c1[_0xb649('0x30')]};return db[_0xb649('0x38')][_0xb649('0x16')](_0x1d81ab)[_0xb649('0x1c')](function(_0x5b8b58){_0x5b2462[_0xb649('0x16')]=_0x5b8b58;if(_0x9c16c9[_0xb649('0x26')]['includeAll']){_0x2ce4c1[_0xb649('0x39')]=[{'all':!![]}];}return db[_0xb649('0x38')]['findAll'](_0x2ce4c1);})[_0xb649('0x1c')](function(_0x11d59){_0x5b2462['rows']=_0x11d59;return _0x5b2462;})[_0xb649('0x1c')](respondWithFilteredResult(_0x2de3fe,_0x2ce4c1))['catch'](handleError(_0x2de3fe,null));};exports[_0xb649('0x3a')]=function(_0x1d728d,_0x42f49d){var _0x29a48d={'raw':!![],'where':{'id':_0x1d728d[_0xb649('0x3b')]['id']}},_0x22c1df={};_0x22c1df['model']=_['keys'](db[_0xb649('0x38')][_0xb649('0x23')]);_0x22c1df['query']=_[_0xb649('0x25')](_0x1d728d['query']);_0x22c1df[_0xb649('0x28')]=_[_0xb649('0x29')](_0x22c1df[_0xb649('0x24')],_0x22c1df['query']);_0x29a48d[_0xb649('0x2a')]=_[_0xb649('0x29')](_0x22c1df['model'],qs[_0xb649('0x2b')](_0x1d728d[_0xb649('0x26')]['fields']));_0x29a48d[_0xb649('0x2a')]=_0x29a48d[_0xb649('0x2a')][_0xb649('0x3c')]?_0x29a48d['attributes']:_0x22c1df[_0xb649('0x24')];if(_0x1d728d[_0xb649('0x26')][_0xb649('0x3d')]){_0x29a48d['include']=[{'all':!![]}];}_0x29a48d=_[_0xb649('0x35')]({},_0x29a48d,_0x1d728d[_0xb649('0x37')]);return db[_0xb649('0x38')][_0xb649('0x3e')](_0x29a48d)[_0xb649('0x1c')](handleEntityNotFound(_0x42f49d,null))[_0xb649('0x1c')](respondWithResult(_0x42f49d,null))[_0xb649('0x3f')](handleError(_0x42f49d,null));};exports['create']=function(_0x42b9ac,_0x371656){return db[_0xb649('0x38')]['create'](_0x42b9ac[_0xb649('0x40')],{})[_0xb649('0x1c')](respondWithResult(_0x371656,0xc9))[_0xb649('0x3f')](handleError(_0x371656,null));};exports['update']=function(_0x4b6192,_0x38bfe1){if(_0x4b6192[_0xb649('0x40')]['id']){delete _0x4b6192['body']['id'];}return db[_0xb649('0x38')][_0xb649('0x3e')]({'where':{'id':_0x4b6192[_0xb649('0x3b')]['id']}})[_0xb649('0x1c')](handleEntityNotFound(_0x38bfe1,null))[_0xb649('0x1c')](saveUpdates(_0x4b6192[_0xb649('0x40')],null))['then'](respondWithResult(_0x38bfe1,null))[_0xb649('0x3f')](handleError(_0x38bfe1,null));};exports['destroy']=function(_0x443ee5,_0x87293d){return db['SquareDetailsReport'][_0xb649('0x3e')]({'where':{'id':_0x443ee5[_0xb649('0x3b')]['id']}})['then'](handleEntityNotFound(_0x87293d,null))[_0xb649('0x1c')](removeEntity(_0x87293d,null))[_0xb649('0x3f')](handleError(_0x87293d,null));};exports['describe']=function(_0x3ee1c8,_0x150b27){return db[_0xb649('0x38')]['describe']()['then'](respondWithResult(_0x150b27,null))[_0xb649('0x3f')](handleError(_0x150b27,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index d5e01bd..1feaae2 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 _0x9fa0=['../../config/logger','api','moment','bluebird','request-promise','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','util'];(function(_0x242ffe,_0x445664){var _0x2a3637=function(_0x4253ee){while(--_0x4253ee){_0x242ffe['push'](_0x242ffe['shift']());}};_0x2a3637(++_0x445664);}(_0x9fa0,0x99));var _0x09fa=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0x9fa0[_0x511bd1];return _0x4c48ec;};'use strict';var _=require('lodash');var util=require(_0x09fa('0x0'));var logger=require(_0x09fa('0x1'))(_0x09fa('0x2'));var moment=require(_0x09fa('0x3'));var BPromise=require(_0x09fa('0x4'));var rp=require(_0x09fa('0x5'));var attributes=require(_0x09fa('0x6'));module[_0x09fa('0x7')]=function(_0x3e6870,_0x459e6b){return _0x3e6870[_0x09fa('0x8')](_0x09fa('0x9'),attributes,{'tableName':_0x09fa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c11=['lodash','util','../../config/logger','bluebird','request-promise','exports','define','SquareDetailsReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2c11,0x1a8));var _0x12c1=function(_0x1e1962,_0x5a2061){_0x1e1962=_0x1e1962-0x0;var _0x3c06be=_0x2c11[_0x1e1962];return _0x3c06be;};'use strict';var _=require(_0x12c1('0x0'));var util=require(_0x12c1('0x1'));var logger=require(_0x12c1('0x2'))('api');var moment=require('moment');var BPromise=require(_0x12c1('0x3'));var rp=require(_0x12c1('0x4'));var attributes=require('./squareReportDetail.attributes');module[_0x12c1('0x5')]=function(_0x7221bd,_0x39306c){return _0x7221bd[_0x12c1('0x6')](_0x12c1('0x7'),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 f0c42f7..df54f56 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 _0xa13d=['info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','request','then'];(function(_0x4966f2,_0x14c0ea){var _0x110195=function(_0x1dc440){while(--_0x1dc440){_0x4966f2['push'](_0x4966f2['shift']());}};_0x110195(++_0x14c0ea);}(_0xa13d,0x154));var _0xda13=function(_0x485bc7,_0x5ebf09){_0x485bc7=_0x485bc7-0x0;var _0xabaa9a=_0xa13d[_0x485bc7];return _0xabaa9a;};'use strict';var _=require(_0xda13('0x0'));var util=require('util');var moment=require(_0xda13('0x1'));var BPromise=require(_0xda13('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda13('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xda13('0x4'));var logger=require(_0xda13('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xda13('0x6'));var client=jayson[_0xda13('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48cd5f,_0x461ca0,_0x2584c5){return new BPromise(function(_0x51fa1b,_0x2f1510){return client[_0xda13('0x8')](_0x48cd5f,_0x2584c5)[_0xda13('0x9')](function(_0x3536c1){logger[_0xda13('0xa')](_0xda13('0xb'),_0x461ca0,_0xda13('0xc'));logger[_0xda13('0xd')](_0xda13('0xe'),_0x461ca0,_0xda13('0xc'),JSON[_0xda13('0xf')](_0x3536c1));if(_0x3536c1[_0xda13('0x10')]){if(_0x3536c1[_0xda13('0x10')][_0xda13('0x11')]===0x1f4){logger[_0xda13('0x10')](_0xda13('0xb'),_0x461ca0,_0x3536c1[_0xda13('0x10')]['message']);return _0x2f1510(_0x3536c1[_0xda13('0x10')]['message']);}logger[_0xda13('0x10')](_0xda13('0xb'),_0x461ca0,_0x3536c1['error'][_0xda13('0x12')]);return _0x51fa1b(_0x3536c1[_0xda13('0x10')][_0xda13('0x12')]);}else{logger[_0xda13('0xa')]('SquareDetailsReport,\x20%s,\x20%s',_0x461ca0,_0xda13('0xc'));_0x51fa1b(_0x3536c1[_0xda13('0x13')]['message']);}})[_0xda13('0x14')](function(_0x4d17a9){logger[_0xda13('0x10')](_0xda13('0xb'),_0x461ca0,_0x4d17a9);_0x2f1510(_0x4d17a9);});});}exports[_0xda13('0x15')]=function(_0x1ddf84){var _0x229df1=this;return new Promise(function(_0x3cdfa1,_0x211feb){return db[_0xda13('0x16')]['create'](_0x1ddf84[_0xda13('0x17')],{'raw':_0x1ddf84[_0xda13('0x18')]?_0x1ddf84[_0xda13('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xda13('0x9')](function(_0x7a9700){logger[_0xda13('0xa')](_0xda13('0x15'),_0x1ddf84);logger['debug'](_0xda13('0x15'),_0x1ddf84,JSON[_0xda13('0xf')](_0x7a9700));_0x3cdfa1(_0x7a9700);})[_0xda13('0x14')](function(_0x5a67c8){logger[_0xda13('0x10')](_0xda13('0x15'),_0x5a67c8[_0xda13('0x12')],_0x1ddf84);_0x211feb(_0x229df1[_0xda13('0x10')](0x1f4,_0x5a67c8[_0xda13('0x12')]));});});}; \ No newline at end of file +var _0xe599=['error','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x2d425f,_0x4534e5){var _0x1e8b97=function(_0x52ed57){while(--_0x52ed57){_0x2d425f['push'](_0x2d425f['shift']());}};_0x1e8b97(++_0x4534e5);}(_0xe599,0x1e5));var _0x9e59=function(_0x526361,_0x5c8125){_0x526361=_0x526361-0x0;var _0x5eaa48=_0xe599[_0x526361];return _0x5eaa48;};'use strict';var _=require(_0x9e59('0x0'));var util=require(_0x9e59('0x1'));var moment=require(_0x9e59('0x2'));var BPromise=require(_0x9e59('0x3'));var rs=require(_0x9e59('0x4'));var fs=require('fs');var Redis=require(_0x9e59('0x5'));var db=require(_0x9e59('0x6'))['db'];var utils=require(_0x9e59('0x7'));var logger=require(_0x9e59('0x8'))('rpc');var config=require(_0x9e59('0x9'));var jayson=require(_0x9e59('0xa'));var client=jayson['client'][_0x9e59('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x599400,_0x290f63,_0x21c5a9){return new BPromise(function(_0x5288df,_0x1c975c){return client[_0x9e59('0xc')](_0x599400,_0x21c5a9)[_0x9e59('0xd')](function(_0x1a6a13){logger[_0x9e59('0xe')](_0x9e59('0xf'),_0x290f63,'request\x20sent');logger[_0x9e59('0x10')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x290f63,_0x9e59('0x11'),JSON[_0x9e59('0x12')](_0x1a6a13));if(_0x1a6a13[_0x9e59('0x13')]){if(_0x1a6a13[_0x9e59('0x13')]['code']===0x1f4){logger[_0x9e59('0x13')](_0x9e59('0xf'),_0x290f63,_0x1a6a13['error'][_0x9e59('0x14')]);return _0x1c975c(_0x1a6a13[_0x9e59('0x13')][_0x9e59('0x14')]);}logger[_0x9e59('0x13')]('SquareDetailsReport,\x20%s,\x20%s',_0x290f63,_0x1a6a13[_0x9e59('0x13')][_0x9e59('0x14')]);return _0x5288df(_0x1a6a13[_0x9e59('0x13')][_0x9e59('0x14')]);}else{logger[_0x9e59('0xe')](_0x9e59('0xf'),_0x290f63,_0x9e59('0x11'));_0x5288df(_0x1a6a13[_0x9e59('0x15')]['message']);}})[_0x9e59('0x16')](function(_0x4bfd39){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x290f63,_0x4bfd39);_0x1c975c(_0x4bfd39);});});}exports[_0x9e59('0x17')]=function(_0x470f7a){var _0x51e05b=this;return new Promise(function(_0x224bc7,_0x3e6c34){return db[_0x9e59('0x18')][_0x9e59('0x19')](_0x470f7a[_0x9e59('0x1a')],{'raw':_0x470f7a[_0x9e59('0x1b')]?_0x470f7a[_0x9e59('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x9e59('0xd')](function(_0x52022d){logger['info']('CreateSquareDetailsReport',_0x470f7a);logger[_0x9e59('0x10')](_0x9e59('0x17'),_0x470f7a,JSON[_0x9e59('0x12')](_0x52022d));_0x224bc7(_0x52022d);})['catch'](function(_0x660477){logger[_0x9e59('0x13')]('CreateSquareDetailsReport',_0x660477['message'],_0x470f7a);_0x3e6c34(_0x51e05b['error'](0x1f4,_0x660477[_0x9e59('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 1ec3a36..04d0cf9 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 _0x5baf=['get','/process/:pid/kill','isAuthenticated','killProcess','../../components/auth/service','./system.controller'];(function(_0x1bfd01,_0x32a4b1){var _0xe5a0cc=function(_0x106549){while(--_0x106549){_0x1bfd01['push'](_0x1bfd01['shift']());}};_0xe5a0cc(++_0x32a4b1);}(_0x5baf,0x1de));var _0xf5ba=function(_0x4839ab,_0x2c1f81){_0x4839ab=_0x4839ab-0x0;var _0x3e681e=_0x5baf[_0x4839ab];return _0x3e681e;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xf5ba('0x0'));var controller=require(_0xf5ba('0x1'));router[_0xf5ba('0x2')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf5ba('0x2')](_0xf5ba('0x3'),auth[_0xf5ba('0x4')](),controller[_0xf5ba('0x5')]);module['exports']=router; \ No newline at end of file +var _0x1fb9=['/process/:pid/kill','killProcess','exports','../../components/auth/service','./system.controller','get','isAuthenticated'];(function(_0xbb14db,_0x3ee8c6){var _0x36bed7=function(_0x16c478){while(--_0x16c478){_0xbb14db['push'](_0xbb14db['shift']());}};_0x36bed7(++_0x3ee8c6);}(_0x1fb9,0x184));var _0x91fb=function(_0x4953da,_0x5adaca){_0x4953da=_0x4953da-0x0;var _0x2d3780=_0x1fb9[_0x4953da];return _0x2d3780;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x91fb('0x0'));var controller=require(_0x91fb('0x1'));router[_0x91fb('0x2')]('/',auth[_0x91fb('0x3')](),controller['index']);router[_0x91fb('0x2')](_0x91fb('0x4'),auth[_0x91fb('0x3')](),controller[_0x91fb('0x5')]);module[_0x91fb('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 6418efd..8257a73 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 _0x9150=['lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','catch','killProcess','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','api','util'];(function(_0x4fd5b4,_0x451a51){var _0x27ba3b=function(_0x14d48c){while(--_0x14d48c){_0x4fd5b4['push'](_0x4fd5b4['shift']());}};_0x27ba3b(++_0x451a51);}(_0x9150,0x175));var _0x0915=function(_0x1180cc,_0x1acd19){_0x1180cc=_0x1180cc-0x0;var _0x3bb538=_0x9150[_0x1180cc];return _0x3bb538;};'use strict';var info=require(_0x0915('0x0'));var exec=require(_0x0915('0x1'))[_0x0915('0x2')];var logger=require('../../config/logger')(_0x0915('0x3'));var util=require(_0x0915('0x4'));var BPromise=require('bluebird');var _=require(_0x0915('0x5'));function handleError(_0x18bd2e,_0x52a7ce,_0x4f41ad){_0x52a7ce=_0x52a7ce||0x1f4;return function(_0x3ffe6f){logger['error'](_0x0915('0x6'),_0x4f41ad,_0x52a7ce,util[_0x0915('0x7')](_0x3ffe6f,{'showHidden':![],'depth':null}));delete _0x3ffe6f[_0x0915('0x8')];_0x18bd2e[_0x0915('0x9')](_0x52a7ce)[_0x0915('0xa')](_0x3ffe6f);};}exports[_0x0915('0xb')]=function(_0x2dba05,_0x1ee839){return info[_0x0915('0xc')]()[_0x0915('0xd')](function(_0x570702){return _0x1ee839['status'](0xc8)[_0x0915('0xe')](_0x570702);})[_0x0915('0xf')](function(_0x3a8a67){return _0x1ee839[_0x0915('0x9')](0x1f4)[_0x0915('0xe')](_0x3a8a67);});};exports[_0x0915('0x10')]=function(_0x1aec5e,_0x57fd4d){var _0x19a3f2=['components/import/cm'];return new BPromise(function(_0x6d3da6,_0x359f46){return exec(util['format'](_0x0915('0x11'),_0x1aec5e[_0x0915('0x12')]['pid']),function(_0x51eda2,_0x2ebc94,_0x179f72){if(_0x51eda2){return _0x359f46(_0x51eda2);}return _0x6d3da6(_0x2ebc94);});})['then'](function(_0x232aa1){var _0x3bc6f0=![];var _0x275711=_0x232aa1[_0x0915('0x13')](/\n/);for(var _0x5a7991=0x0,_0x2c52ac=_0x19a3f2['length'];_0x5a7991<_0x2c52ac,_0x3bc6f0===![];_0x5a7991+=0x1){if(_0x232aa1[_0x0915('0x14')](_0x19a3f2[_0x5a7991])>=0x0){_0x3bc6f0=!![];}}if(!_0x3bc6f0){throw new Error(util[_0x0915('0x15')](_0x0915('0x16'),_0x1aec5e[_0x0915('0x12')][_0x0915('0x17')]));}process[_0x0915('0x18')](_0x1aec5e[_0x0915('0x12')][_0x0915('0x17')],_0x0915('0x19'));return _0x57fd4d[_0x0915('0x9')](0xc8)[_0x0915('0xe')]({'message':util[_0x0915('0x15')](_0x0915('0x1a'),_0x1aec5e['params'][_0x0915('0x17')])});})[_0x0915('0xf')](handleError(_0x57fd4d,null,_0x0915('0x10')));}; \ No newline at end of file +var _0x1738=['length','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','systeminformation','child_process','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','send','index','then','status','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split'];(function(_0x448f8,_0x2aa1d7){var _0xa73126=function(_0x1fcafa){while(--_0x1fcafa){_0x448f8['push'](_0x448f8['shift']());}};_0xa73126(++_0x2aa1d7);}(_0x1738,0xb3));var _0x8173=function(_0x1d93fa,_0x4ae083){_0x1d93fa=_0x1d93fa-0x0;var _0x45abbc=_0x1738[_0x1d93fa];return _0x45abbc;};'use strict';var info=require(_0x8173('0x0'));var exec=require(_0x8173('0x1'))['exec'];var logger=require('../../config/logger')('api');var util=require(_0x8173('0x2'));var BPromise=require('bluebird');var _=require(_0x8173('0x3'));function handleError(_0x31e4fb,_0x55e323,_0x38c76d){_0x55e323=_0x55e323||0x1f4;return function(_0x47887f){logger[_0x8173('0x4')](_0x8173('0x5'),_0x38c76d,_0x55e323,util[_0x8173('0x6')](_0x47887f,{'showHidden':![],'depth':null}));delete _0x47887f[_0x8173('0x7')];_0x31e4fb['status'](_0x55e323)[_0x8173('0x8')](_0x47887f);};}exports[_0x8173('0x9')]=function(_0x29a771,_0xd3042a){return info['getAllData']()[_0x8173('0xa')](function(_0xc5ef46){return _0xd3042a[_0x8173('0xb')](0xc8)[_0x8173('0xc')](_0xc5ef46);})[_0x8173('0xd')](function(_0x447e04){return _0xd3042a[_0x8173('0xb')](0x1f4)['json'](_0x447e04);});};exports[_0x8173('0xe')]=function(_0x452a49,_0x2e68d1){var _0x5d02d9=[_0x8173('0xf')];return new BPromise(function(_0x25e6d8,_0x59f7f9){return exec(util[_0x8173('0x10')](_0x8173('0x11'),_0x452a49[_0x8173('0x12')][_0x8173('0x13')]),function(_0x32fde4,_0x2227a1,_0x54a0fc){if(_0x32fde4){return _0x59f7f9(_0x32fde4);}return _0x25e6d8(_0x2227a1);});})[_0x8173('0xa')](function(_0x45e3b6){var _0x172573=![];var _0xd4b878=_0x45e3b6[_0x8173('0x14')](/\n/);for(var _0x41b50b=0x0,_0x11033f=_0x5d02d9[_0x8173('0x15')];_0x41b50b<_0x11033f,_0x172573===![];_0x41b50b+=0x1){if(_0x45e3b6['indexOf'](_0x5d02d9[_0x41b50b])>=0x0){_0x172573=!![];}}if(!_0x172573){throw new Error(util['format'](_0x8173('0x16'),_0x452a49[_0x8173('0x12')][_0x8173('0x13')]));}process[_0x8173('0x17')](_0x452a49['params'][_0x8173('0x13')],_0x8173('0x18'));return _0x2e68d1[_0x8173('0xb')](0xc8)[_0x8173('0xc')]({'message':util[_0x8173('0x10')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x452a49['params']['pid'])});})[_0x8173('0xd')](handleError(_0x2e68d1,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 21cedc1..6269900 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 _0x5f2f=['create','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','post'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x5f2f,0x73));var _0xf5f2=function(_0xc437bc,_0x751999){_0xc437bc=_0xc437bc-0x0;var _0x1519f6=_0x5f2f[_0xc437bc];return _0x1519f6;};'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('./tag.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xc')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xd')]);router['put'](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['delete'](_0xf5f2('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xf5f2('0xf')]=router; \ No newline at end of file +var _0x1a85=['express','../../components/interaction/service','../../config/environment','./tag.controller','isAuthenticated','get','show','/:id','update','delete','destroy','exports','path','connect-timeout'];(function(_0x3b6a0f,_0x501177){var _0x487ddc=function(_0x483108){while(--_0x483108){_0x3b6a0f['push'](_0x3b6a0f['shift']());}};_0x487ddc(++_0x501177);}(_0x1a85,0x178));var _0x51a8=function(_0x3dac28,_0x345de7){_0x3dac28=_0x3dac28-0x0;var _0x139e69=_0x1a85[_0x3dac28];return _0x139e69;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x51a8('0x0'));var timeout=require(_0x51a8('0x1'));var express=require(_0x51a8('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x51a8('0x3'));var config=require(_0x51a8('0x4'));var controller=require(_0x51a8('0x5'));router['get']('/',auth[_0x51a8('0x6')](),controller['index']);router[_0x51a8('0x7')]('/:id',auth[_0x51a8('0x6')](),controller[_0x51a8('0x8')]);router['post']('/',auth[_0x51a8('0x6')](),controller['create']);router['put'](_0x51a8('0x9'),auth[_0x51a8('0x6')](),controller[_0x51a8('0xa')]);router[_0x51a8('0xb')](_0x51a8('0x9'),auth[_0x51a8('0x6')](),controller[_0x51a8('0xc')]);module[_0x51a8('0xd')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 0342d35..9645c4c 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 _0xf409=['STRING','#0091EA','sequelize','exports','name'];(function(_0x46ceaa,_0x1e5518){var _0x50e799=function(_0x3b8963){while(--_0x3b8963){_0x46ceaa['push'](_0x46ceaa['shift']());}};_0x50e799(++_0x1e5518);}(_0xf409,0x1a6));var _0x9f40=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0xf409[_0x397cfb];return _0x15fed9;};'use strict';var Sequelize=require(_0x9f40('0x0'));module[_0x9f40('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9f40('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x9f40('0x3')],'defaultValue':_0x9f40('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8ef5=['STRING','name','#0091EA','sequelize','exports'];(function(_0xdcdc38,_0x4d6f89){var _0x2fb669=function(_0x47656a){while(--_0x47656a){_0xdcdc38['push'](_0xdcdc38['shift']());}};_0x2fb669(++_0x4d6f89);}(_0x8ef5,0x1b6));var _0x58ef=function(_0x41b9f4,_0x3c7ed2){_0x41b9f4=_0x41b9f4-0x0;var _0x2cf5d6=_0x8ef5[_0x41b9f4];return _0x2cf5d6;};'use strict';var Sequelize=require(_0x58ef('0x0'));module[_0x58ef('0x1')]={'name':{'type':Sequelize[_0x58ef('0x2')],'unique':_0x58ef('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x58ef('0x2')],'defaultValue':_0x58ef('0x4')},'description':{'type':Sequelize[_0x58ef('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index faa5d67..519bf2b 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 _0x9957=['params','length','includeAll','find','create','update','body','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/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','reject','then','destroy','error','stack','name','send','index','Tag','rawAttributes','model','keys','query','dateEnd','filters','intersection','fields','attributes','limit','pick','dateStart','day','add','merge','where','filter','map','options','include','rows','catch'];(function(_0x54ae53,_0x2d3764){var _0x352aae=function(_0x2977d5){while(--_0x2977d5){_0x54ae53['push'](_0x54ae53['shift']());}};_0x352aae(++_0x2d3764);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var qs=require(_0x7995('0x13'));var logger=require(_0x7995('0x14'))(_0x7995('0x15'));var utils=require(_0x7995('0x16'));var config=require('../../config/environment');var db=require(_0x7995('0x17'))['db'];function respondWithStatusCode(_0x41c652,_0x581f22){_0x581f22=_0x581f22||0xcc;return function(_0xb0c872){if(_0xb0c872){return _0x41c652[_0x7995('0x18')](_0x581f22);}return _0x41c652[_0x7995('0x19')](_0x581f22)[_0x7995('0x1a')]();};}function respondWithResult(_0x281576,_0x23999f){_0x23999f=_0x23999f||0xc8;return function(_0x2bbe7a){if(_0x2bbe7a){return _0x281576['status'](_0x23999f)['json'](_0x2bbe7a);}};}function respondWithFilteredResult(_0x2b4e94,_0x2233dd){return function(_0x24b5bb){if(_0x24b5bb){var _0x321ae8=_0x24b5bb[_0x7995('0x1b')],_0x3f1d3e=_0x2233dd['offset'],_0x1a5310=_0x2233dd[_0x7995('0x1c')]+_0x2233dd['limit'],_0x2202ce;if(_0x1a5310>=_0x321ae8){_0x1a5310=_0x321ae8;_0x2202ce=0xc8;}else{_0x2202ce=0xce;}_0x2b4e94[_0x7995('0x19')](_0x2202ce);return _0x2b4e94[_0x7995('0x1d')](_0x7995('0x1e'),_0x3f1d3e+'-'+_0x1a5310+'/'+_0x321ae8)[_0x7995('0x1f')](_0x24b5bb);}return null;};}function patchUpdates(_0x1e1415){return function(_0x37a7d4){try{jsonpatch['apply'](_0x37a7d4,_0x1e1415,!![]);}catch(_0x54c9ae){return BPromise[_0x7995('0x20')](_0x54c9ae);}return _0x37a7d4['save']();};}function saveUpdates(_0x555f74,_0x3ec178){return function(_0x3d463e){if(_0x3d463e){return _0x3d463e['update'](_0x555f74)[_0x7995('0x21')](function(_0x51f276){return _0x51f276;});}return null;};}function removeEntity(_0x4b1a8e,_0x3e4c54){return function(_0x327b1f){if(_0x327b1f){return _0x327b1f[_0x7995('0x22')]()[_0x7995('0x21')](function(){_0x4b1a8e[_0x7995('0x19')](0xcc)[_0x7995('0x1a')]();});}};}function handleEntityNotFound(_0x5d40ae,_0x32a09a){return function(_0x46ee4b){if(!_0x46ee4b){_0x5d40ae[_0x7995('0x18')](0x194);}return _0x46ee4b;};}function handleError(_0x285437,_0x563799){_0x563799=_0x563799||0x1f4;return function(_0x13bc35){logger[_0x7995('0x23')](_0x13bc35[_0x7995('0x24')]);if(_0x13bc35['name']){delete _0x13bc35[_0x7995('0x25')];}_0x285437[_0x7995('0x19')](_0x563799)[_0x7995('0x26')](_0x13bc35);};}exports[_0x7995('0x27')]=function(_0x3a3fcf,_0x2a307e){var _0x56691a={},_0x47625f={},_0x5911c3={'count':0x0,'rows':[]};var _0x229742=db[_0x7995('0x28')][_0x7995('0x29')];_0x47625f[_0x7995('0x2a')]=_[_0x7995('0x2b')](_0x229742);var _0x4b6f99={'dateStart':_0x3a3fcf[_0x7995('0x2c')]['dateStart'],'dateEnd':_0x3a3fcf[_0x7995('0x2c')][_0x7995('0x2d')]};delete _0x3a3fcf[_0x7995('0x2c')]['dateStart'];delete _0x3a3fcf['query']['dateEnd'];_0x47625f[_0x7995('0x2c')]=_[_0x7995('0x2b')](_0x3a3fcf[_0x7995('0x2c')]);_0x47625f[_0x7995('0x2e')]=_[_0x7995('0x2f')](_0x47625f[_0x7995('0x2a')],_0x47625f['query']);_0x56691a['attributes']=_[_0x7995('0x2f')](_0x47625f['model'],qs[_0x7995('0x30')](_0x3a3fcf[_0x7995('0x2c')][_0x7995('0x30')]));_0x56691a[_0x7995('0x31')]=_0x56691a[_0x7995('0x31')]['length']?_0x56691a[_0x7995('0x31')]:_0x47625f[_0x7995('0x2a')];if(!_0x3a3fcf['query']['hasOwnProperty']('nolimit')){_0x56691a[_0x7995('0x32')]=qs[_0x7995('0x32')](_0x3a3fcf['query'][_0x7995('0x32')]);_0x56691a['offset']=qs[_0x7995('0x1c')](_0x3a3fcf[_0x7995('0x2c')][_0x7995('0x1c')]);}_0x56691a['order']=qs['sort'](_0x3a3fcf[_0x7995('0x2c')]['sort']);_0x56691a['where']=qs[_0x7995('0x2e')](_[_0x7995('0x33')](_0x3a3fcf['query'],_0x47625f[_0x7995('0x2e')]));if(_0x4b6f99[_0x7995('0x34')]){if(_0x4b6f99[_0x7995('0x2d')]){_0x4b6f99[_0x7995('0x2d')]=moment(_0x4b6f99[_0x7995('0x2d')])['add'](0x1,_0x7995('0x35'));}else{_0x4b6f99[_0x7995('0x2d')]=moment(_0x4b6f99[_0x7995('0x34')])[_0x7995('0x36')](0x1,'day');}_[_0x7995('0x37')](_0x56691a[_0x7995('0x38')],{'createdAt':{'$gte':_0x4b6f99[_0x7995('0x34')],'$lte':_0x4b6f99[_0x7995('0x2d')]}});}if(_0x3a3fcf[_0x7995('0x2c')][_0x7995('0x39')]){_0x56691a['where']=_[_0x7995('0x37')](_0x56691a[_0x7995('0x38')],{'$or':_[_0x7995('0x3a')](_0x56691a[_0x7995('0x31')],function(_0x2e04cd){var _0x298fc2={};_0x298fc2[_0x2e04cd]={'$like':'%'+_0x3a3fcf[_0x7995('0x2c')][_0x7995('0x39')]+'%'};return _0x298fc2;})});}_0x56691a=_[_0x7995('0x37')]({},_0x56691a,_0x3a3fcf[_0x7995('0x3b')]);var _0x6fe77b={'where':_0x56691a[_0x7995('0x38')]};return db[_0x7995('0x28')]['count'](_0x6fe77b)['then'](function(_0x334dff){_0x5911c3[_0x7995('0x1b')]=_0x334dff;if(_0x3a3fcf['query']['includeAll']){_0x56691a[_0x7995('0x3c')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x56691a);})[_0x7995('0x21')](function(_0x36e28b){_0x5911c3[_0x7995('0x3d')]=_0x36e28b;return _0x5911c3;})['then'](respondWithFilteredResult(_0x2a307e,_0x56691a))[_0x7995('0x3e')](handleError(_0x2a307e,null));};exports['show']=function(_0x3993b5,_0x5a8881){var _0x493066={'raw':!![],'where':{'id':_0x3993b5[_0x7995('0x3f')]['id']}},_0x39c5b8={};_0x39c5b8[_0x7995('0x2a')]=_[_0x7995('0x2b')](db['Tag'][_0x7995('0x29')]);_0x39c5b8[_0x7995('0x2c')]=_[_0x7995('0x2b')](_0x3993b5[_0x7995('0x2c')]);_0x39c5b8['filters']=_['intersection'](_0x39c5b8[_0x7995('0x2a')],_0x39c5b8['query']);_0x493066[_0x7995('0x31')]=_['intersection'](_0x39c5b8[_0x7995('0x2a')],qs['fields'](_0x3993b5[_0x7995('0x2c')][_0x7995('0x30')]));_0x493066['attributes']=_0x493066[_0x7995('0x31')][_0x7995('0x40')]?_0x493066[_0x7995('0x31')]:_0x39c5b8[_0x7995('0x2a')];if(_0x3993b5['query'][_0x7995('0x41')]){_0x493066[_0x7995('0x3c')]=[{'all':!![]}];}_0x493066=_[_0x7995('0x37')]({},_0x493066,_0x3993b5['options']);return db[_0x7995('0x28')][_0x7995('0x42')](_0x493066)[_0x7995('0x21')](handleEntityNotFound(_0x5a8881,null))[_0x7995('0x21')](respondWithResult(_0x5a8881,null))[_0x7995('0x3e')](handleError(_0x5a8881,null));};exports['create']=function(_0x1a5cec,_0xfb72b2){return db['Tag'][_0x7995('0x43')](_0x1a5cec['body'],{})[_0x7995('0x21')](respondWithResult(_0xfb72b2,0xc9))[_0x7995('0x3e')](handleError(_0xfb72b2,null));};exports[_0x7995('0x44')]=function(_0x30e220,_0xddf537){if(_0x30e220[_0x7995('0x45')]['id']){delete _0x30e220[_0x7995('0x45')]['id'];}return db['Tag'][_0x7995('0x42')]({'where':{'id':_0x30e220[_0x7995('0x3f')]['id']}})[_0x7995('0x21')](handleEntityNotFound(_0xddf537,null))['then'](saveUpdates(_0x30e220[_0x7995('0x45')],null))[_0x7995('0x21')](respondWithResult(_0xddf537,null))[_0x7995('0x3e')](handleError(_0xddf537,null));};exports['destroy']=function(_0x4ec548,_0x5a592e){return db[_0x7995('0x28')][_0x7995('0x42')]({'where':{'id':_0x4ec548['params']['id']}})[_0x7995('0x21')](handleEntityNotFound(_0x5a592e,null))[_0x7995('0x21')](removeEntity(_0x5a592e,null))[_0x7995('0x3e')](handleError(_0x5a592e,null));}; \ No newline at end of file +var _0x9957=['params','length','includeAll','find','create','update','body','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/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','reject','then','destroy','error','stack','name','send','index','Tag','rawAttributes','model','keys','query','dateEnd','filters','intersection','fields','attributes','limit','pick','dateStart','day','add','merge','where','filter','map','options','include','rows','catch'];(function(_0x124005,_0x746b73){var _0x18972e=function(_0x5b2bf0){while(--_0x5b2bf0){_0x124005['push'](_0x124005['shift']());}};_0x18972e(++_0x746b73);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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 qs=require(_0x7995('0x13'));var logger=require(_0x7995('0x14'))(_0x7995('0x15'));var utils=require(_0x7995('0x16'));var config=require('../../config/environment');var db=require(_0x7995('0x17'))['db'];function respondWithStatusCode(_0x41c652,_0x581f22){_0x581f22=_0x581f22||0xcc;return function(_0xb0c872){if(_0xb0c872){return _0x41c652[_0x7995('0x18')](_0x581f22);}return _0x41c652[_0x7995('0x19')](_0x581f22)[_0x7995('0x1a')]();};}function respondWithResult(_0x281576,_0x23999f){_0x23999f=_0x23999f||0xc8;return function(_0x2bbe7a){if(_0x2bbe7a){return _0x281576['status'](_0x23999f)['json'](_0x2bbe7a);}};}function respondWithFilteredResult(_0x2b4e94,_0x2233dd){return function(_0x24b5bb){if(_0x24b5bb){var _0x321ae8=_0x24b5bb[_0x7995('0x1b')],_0x3f1d3e=_0x2233dd['offset'],_0x1a5310=_0x2233dd[_0x7995('0x1c')]+_0x2233dd['limit'],_0x2202ce;if(_0x1a5310>=_0x321ae8){_0x1a5310=_0x321ae8;_0x2202ce=0xc8;}else{_0x2202ce=0xce;}_0x2b4e94[_0x7995('0x19')](_0x2202ce);return _0x2b4e94[_0x7995('0x1d')](_0x7995('0x1e'),_0x3f1d3e+'-'+_0x1a5310+'/'+_0x321ae8)[_0x7995('0x1f')](_0x24b5bb);}return null;};}function patchUpdates(_0x1e1415){return function(_0x37a7d4){try{jsonpatch['apply'](_0x37a7d4,_0x1e1415,!![]);}catch(_0x54c9ae){return BPromise[_0x7995('0x20')](_0x54c9ae);}return _0x37a7d4['save']();};}function saveUpdates(_0x555f74,_0x3ec178){return function(_0x3d463e){if(_0x3d463e){return _0x3d463e['update'](_0x555f74)[_0x7995('0x21')](function(_0x51f276){return _0x51f276;});}return null;};}function removeEntity(_0x4b1a8e,_0x3e4c54){return function(_0x327b1f){if(_0x327b1f){return _0x327b1f[_0x7995('0x22')]()[_0x7995('0x21')](function(){_0x4b1a8e[_0x7995('0x19')](0xcc)[_0x7995('0x1a')]();});}};}function handleEntityNotFound(_0x5d40ae,_0x32a09a){return function(_0x46ee4b){if(!_0x46ee4b){_0x5d40ae[_0x7995('0x18')](0x194);}return _0x46ee4b;};}function handleError(_0x285437,_0x563799){_0x563799=_0x563799||0x1f4;return function(_0x13bc35){logger[_0x7995('0x23')](_0x13bc35[_0x7995('0x24')]);if(_0x13bc35['name']){delete _0x13bc35[_0x7995('0x25')];}_0x285437[_0x7995('0x19')](_0x563799)[_0x7995('0x26')](_0x13bc35);};}exports[_0x7995('0x27')]=function(_0x3a3fcf,_0x2a307e){var _0x56691a={},_0x47625f={},_0x5911c3={'count':0x0,'rows':[]};var _0x229742=db[_0x7995('0x28')][_0x7995('0x29')];_0x47625f[_0x7995('0x2a')]=_[_0x7995('0x2b')](_0x229742);var _0x4b6f99={'dateStart':_0x3a3fcf[_0x7995('0x2c')]['dateStart'],'dateEnd':_0x3a3fcf[_0x7995('0x2c')][_0x7995('0x2d')]};delete _0x3a3fcf[_0x7995('0x2c')]['dateStart'];delete _0x3a3fcf['query']['dateEnd'];_0x47625f[_0x7995('0x2c')]=_[_0x7995('0x2b')](_0x3a3fcf[_0x7995('0x2c')]);_0x47625f[_0x7995('0x2e')]=_[_0x7995('0x2f')](_0x47625f[_0x7995('0x2a')],_0x47625f['query']);_0x56691a['attributes']=_[_0x7995('0x2f')](_0x47625f['model'],qs[_0x7995('0x30')](_0x3a3fcf[_0x7995('0x2c')][_0x7995('0x30')]));_0x56691a[_0x7995('0x31')]=_0x56691a[_0x7995('0x31')]['length']?_0x56691a[_0x7995('0x31')]:_0x47625f[_0x7995('0x2a')];if(!_0x3a3fcf['query']['hasOwnProperty']('nolimit')){_0x56691a[_0x7995('0x32')]=qs[_0x7995('0x32')](_0x3a3fcf['query'][_0x7995('0x32')]);_0x56691a['offset']=qs[_0x7995('0x1c')](_0x3a3fcf[_0x7995('0x2c')][_0x7995('0x1c')]);}_0x56691a['order']=qs['sort'](_0x3a3fcf[_0x7995('0x2c')]['sort']);_0x56691a['where']=qs[_0x7995('0x2e')](_[_0x7995('0x33')](_0x3a3fcf['query'],_0x47625f[_0x7995('0x2e')]));if(_0x4b6f99[_0x7995('0x34')]){if(_0x4b6f99[_0x7995('0x2d')]){_0x4b6f99[_0x7995('0x2d')]=moment(_0x4b6f99[_0x7995('0x2d')])['add'](0x1,_0x7995('0x35'));}else{_0x4b6f99[_0x7995('0x2d')]=moment(_0x4b6f99[_0x7995('0x34')])[_0x7995('0x36')](0x1,'day');}_[_0x7995('0x37')](_0x56691a[_0x7995('0x38')],{'createdAt':{'$gte':_0x4b6f99[_0x7995('0x34')],'$lte':_0x4b6f99[_0x7995('0x2d')]}});}if(_0x3a3fcf[_0x7995('0x2c')][_0x7995('0x39')]){_0x56691a['where']=_[_0x7995('0x37')](_0x56691a[_0x7995('0x38')],{'$or':_[_0x7995('0x3a')](_0x56691a[_0x7995('0x31')],function(_0x2e04cd){var _0x298fc2={};_0x298fc2[_0x2e04cd]={'$like':'%'+_0x3a3fcf[_0x7995('0x2c')][_0x7995('0x39')]+'%'};return _0x298fc2;})});}_0x56691a=_[_0x7995('0x37')]({},_0x56691a,_0x3a3fcf[_0x7995('0x3b')]);var _0x6fe77b={'where':_0x56691a[_0x7995('0x38')]};return db[_0x7995('0x28')]['count'](_0x6fe77b)['then'](function(_0x334dff){_0x5911c3[_0x7995('0x1b')]=_0x334dff;if(_0x3a3fcf['query']['includeAll']){_0x56691a[_0x7995('0x3c')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x56691a);})[_0x7995('0x21')](function(_0x36e28b){_0x5911c3[_0x7995('0x3d')]=_0x36e28b;return _0x5911c3;})['then'](respondWithFilteredResult(_0x2a307e,_0x56691a))[_0x7995('0x3e')](handleError(_0x2a307e,null));};exports['show']=function(_0x3993b5,_0x5a8881){var _0x493066={'raw':!![],'where':{'id':_0x3993b5[_0x7995('0x3f')]['id']}},_0x39c5b8={};_0x39c5b8[_0x7995('0x2a')]=_[_0x7995('0x2b')](db['Tag'][_0x7995('0x29')]);_0x39c5b8[_0x7995('0x2c')]=_[_0x7995('0x2b')](_0x3993b5[_0x7995('0x2c')]);_0x39c5b8['filters']=_['intersection'](_0x39c5b8[_0x7995('0x2a')],_0x39c5b8['query']);_0x493066[_0x7995('0x31')]=_['intersection'](_0x39c5b8[_0x7995('0x2a')],qs['fields'](_0x3993b5[_0x7995('0x2c')][_0x7995('0x30')]));_0x493066['attributes']=_0x493066[_0x7995('0x31')][_0x7995('0x40')]?_0x493066[_0x7995('0x31')]:_0x39c5b8[_0x7995('0x2a')];if(_0x3993b5['query'][_0x7995('0x41')]){_0x493066[_0x7995('0x3c')]=[{'all':!![]}];}_0x493066=_[_0x7995('0x37')]({},_0x493066,_0x3993b5['options']);return db[_0x7995('0x28')][_0x7995('0x42')](_0x493066)[_0x7995('0x21')](handleEntityNotFound(_0x5a8881,null))[_0x7995('0x21')](respondWithResult(_0x5a8881,null))[_0x7995('0x3e')](handleError(_0x5a8881,null));};exports['create']=function(_0x1a5cec,_0xfb72b2){return db['Tag'][_0x7995('0x43')](_0x1a5cec['body'],{})[_0x7995('0x21')](respondWithResult(_0xfb72b2,0xc9))[_0x7995('0x3e')](handleError(_0xfb72b2,null));};exports[_0x7995('0x44')]=function(_0x30e220,_0xddf537){if(_0x30e220[_0x7995('0x45')]['id']){delete _0x30e220[_0x7995('0x45')]['id'];}return db['Tag'][_0x7995('0x42')]({'where':{'id':_0x30e220[_0x7995('0x3f')]['id']}})[_0x7995('0x21')](handleEntityNotFound(_0xddf537,null))['then'](saveUpdates(_0x30e220[_0x7995('0x45')],null))[_0x7995('0x21')](respondWithResult(_0xddf537,null))[_0x7995('0x3e')](handleError(_0xddf537,null));};exports['destroy']=function(_0x4ec548,_0x5a592e){return db[_0x7995('0x28')][_0x7995('0x42')]({'where':{'id':_0x4ec548['params']['id']}})[_0x7995('0x21')](handleEntityNotFound(_0x5a592e,null))[_0x7995('0x21')](removeEntity(_0x5a592e,null))[_0x7995('0x3e')](handleError(_0x5a592e,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 30321a5..022c2ad 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 _0x6b2a=['exports','define','Tag','util','../../config/logger','api','moment','bluebird','request-promise','./tag.attributes'];(function(_0x406ba5,_0x39fa4b){var _0x557db7=function(_0x40f28b){while(--_0x40f28b){_0x406ba5['push'](_0x406ba5['shift']());}};_0x557db7(++_0x39fa4b);}(_0x6b2a,0x125));var _0xa6b2=function(_0x551fae,_0x2818b4){_0x551fae=_0x551fae-0x0;var _0x4c9ff8=_0x6b2a[_0x551fae];return _0x4c9ff8;};'use strict';var _=require('lodash');var util=require(_0xa6b2('0x0'));var logger=require(_0xa6b2('0x1'))(_0xa6b2('0x2'));var moment=require(_0xa6b2('0x3'));var BPromise=require(_0xa6b2('0x4'));var rp=require(_0xa6b2('0x5'));var attributes=require(_0xa6b2('0x6'));module[_0xa6b2('0x7')]=function(_0xda9e2f,_0x373331){return _0xda9e2f[_0xa6b2('0x8')](_0xa6b2('0x9'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b91=['exports','define','Tag','util','../../config/logger','api','bluebird','./tag.attributes'];(function(_0x58f5bc,_0x101b8d){var _0x105fe5=function(_0x4e7384){while(--_0x4e7384){_0x58f5bc['push'](_0x58f5bc['shift']());}};_0x105fe5(++_0x101b8d);}(_0x3b91,0x103));var _0x13b9=function(_0x5b1064,_0x486fad){_0x5b1064=_0x5b1064-0x0;var _0x180988=_0x3b91[_0x5b1064];return _0x180988;};'use strict';var _=require('lodash');var util=require(_0x13b9('0x0'));var logger=require(_0x13b9('0x1'))(_0x13b9('0x2'));var moment=require('moment');var BPromise=require(_0x13b9('0x3'));var rp=require('request-promise');var attributes=require(_0x13b9('0x4'));module[_0x13b9('0x5')]=function(_0x58ec09,_0x2003f2){return _0x58ec09[_0x13b9('0x6')](_0x13b9('0x7'),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 3fdb05b..8934ba8 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 _0x730a=['jayson/promise','client','info','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x30c752,_0x5d2cb6){var _0x39be97=function(_0x54e6da){while(--_0x54e6da){_0x30c752['push'](_0x30c752['shift']());}};_0x39be97(++_0x5d2cb6);}(_0x730a,0x147));var _0xa730=function(_0x4b19b3,_0x59b162){_0x4b19b3=_0x4b19b3-0x0;var _0x2780e7=_0x730a[_0x4b19b3];return _0x2780e7;};'use strict';var _=require(_0xa730('0x0'));var util=require(_0xa730('0x1'));var moment=require(_0xa730('0x2'));var BPromise=require(_0xa730('0x3'));var rs=require(_0xa730('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa730('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa730('0x6'))(_0xa730('0x7'));var config=require(_0xa730('0x8'));var jayson=require(_0xa730('0x9'));var client=jayson[_0xa730('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1058df,_0x45f666,_0x13c366){return new BPromise(function(_0x5ea925,_0x185435){return client['request'](_0x1058df,_0x13c366)['then'](function(_0x46183a){logger[_0xa730('0xb')](_0xa730('0xc'),_0x45f666,_0xa730('0xd'));logger['debug'](_0xa730('0xe'),_0x45f666,_0xa730('0xd'),JSON[_0xa730('0xf')](_0x46183a));if(_0x46183a[_0xa730('0x10')]){if(_0x46183a[_0xa730('0x10')][_0xa730('0x11')]===0x1f4){logger[_0xa730('0x10')]('Tag,\x20%s,\x20%s',_0x45f666,_0x46183a['error']['message']);return _0x185435(_0x46183a[_0xa730('0x10')][_0xa730('0x12')]);}logger[_0xa730('0x10')](_0xa730('0xc'),_0x45f666,_0x46183a[_0xa730('0x10')][_0xa730('0x12')]);return _0x5ea925(_0x46183a['error']['message']);}else{logger[_0xa730('0xb')](_0xa730('0xc'),_0x45f666,_0xa730('0xd'));_0x5ea925(_0x46183a[_0xa730('0x13')][_0xa730('0x12')]);}})[_0xa730('0x14')](function(_0x452dae){logger[_0xa730('0x10')](_0xa730('0xc'),_0x45f666,_0x452dae);_0x185435(_0x452dae);});});} \ No newline at end of file +var _0xc87a=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird'];(function(_0x4d93a4,_0x245743){var _0x3791f3=function(_0x3c2fa1){while(--_0x3c2fa1){_0x4d93a4['push'](_0x4d93a4['shift']());}};_0x3791f3(++_0x245743);}(_0xc87a,0x66));var _0xac87=function(_0x2356c6,_0x41d1f7){_0x2356c6=_0x2356c6-0x0;var _0x37e02b=_0xc87a[_0x2356c6];return _0x37e02b;};'use strict';var _=require('lodash');var util=require(_0xac87('0x0'));var moment=require(_0xac87('0x1'));var BPromise=require(_0xac87('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac87('0x3'));var db=require(_0xac87('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xac87('0x5'))(_0xac87('0x6'));var config=require(_0xac87('0x7'));var jayson=require(_0xac87('0x8'));var client=jayson[_0xac87('0x9')][_0xac87('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d57fb,_0x458efe,_0x56ef44){return new BPromise(function(_0x27d8d4,_0x21e0b8){return client[_0xac87('0xb')](_0x1d57fb,_0x56ef44)['then'](function(_0x3e3893){logger[_0xac87('0xc')](_0xac87('0xd'),_0x458efe,_0xac87('0xe'));logger[_0xac87('0xf')]('Tag,\x20%s,\x20%s,\x20%s',_0x458efe,'request\x20sent',JSON['stringify'](_0x3e3893));if(_0x3e3893['error']){if(_0x3e3893[_0xac87('0x10')][_0xac87('0x11')]===0x1f4){logger[_0xac87('0x10')](_0xac87('0xd'),_0x458efe,_0x3e3893[_0xac87('0x10')]['message']);return _0x21e0b8(_0x3e3893[_0xac87('0x10')][_0xac87('0x12')]);}logger[_0xac87('0x10')](_0xac87('0xd'),_0x458efe,_0x3e3893['error']['message']);return _0x27d8d4(_0x3e3893[_0xac87('0x10')][_0xac87('0x12')]);}else{logger[_0xac87('0xc')](_0xac87('0xd'),_0x458efe,_0xac87('0xe'));_0x27d8d4(_0x3e3893[_0xac87('0x13')]['message']);}})[_0xac87('0x14')](function(_0x146b26){logger[_0xac87('0x10')](_0xac87('0xd'),_0x458efe,_0x146b26);_0x21e0b8(_0x146b26);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index fda9c5c..3b772d3 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 _0x4221=['put','/:id','delete','destroy','removeQueues','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','isAuthenticated','/:id/queues','getQueues','post','addQueues','/:id/users'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x4221,0x109));var _0x1422=function(_0x16dae3,_0x1aab9c){_0x16dae3=_0x16dae3-0x0;var _0x1b2518=_0x4221[_0x16dae3];return _0x1b2518;};'use strict';var multer=require(_0x1422('0x0'));var util=require(_0x1422('0x1'));var path=require('path');var timeout=require(_0x1422('0x2'));var express=require(_0x1422('0x3'));var router=express['Router']();var auth=require(_0x1422('0x4'));var interaction=require(_0x1422('0x5'));var config=require(_0x1422('0x6'));var controller=require(_0x1422('0x7'));router[_0x1422('0x8')]('/',auth[_0x1422('0x9')](),controller['index']);router[_0x1422('0x8')]('/:id',auth[_0x1422('0x9')](),controller['show']);router['get'](_0x1422('0xa'),auth[_0x1422('0x9')](),controller[_0x1422('0xb')]);router['get']('/:id/users',auth[_0x1422('0x9')](),controller['getAgents']);router[_0x1422('0xc')]('/',auth[_0x1422('0x9')](),controller['create']);router['post']('/:id/queues',auth[_0x1422('0x9')](),controller[_0x1422('0xd')]);router[_0x1422('0xc')](_0x1422('0xe'),auth[_0x1422('0x9')](),controller['addAgents']);router[_0x1422('0xf')](_0x1422('0x10'),auth[_0x1422('0x9')](),controller['update']);router[_0x1422('0x11')](_0x1422('0x10'),auth[_0x1422('0x9')](),controller[_0x1422('0x12')]);router['delete'](_0x1422('0xa'),auth[_0x1422('0x9')](),controller[_0x1422('0x13')]);router[_0x1422('0x11')](_0x1422('0xe'),auth[_0x1422('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xcc13=['removeAgents','exports','multer','connect-timeout','express','Router','../../components/auth/service','./team.controller','get','index','/:id','isAuthenticated','/:id/queues','getQueues','/:id/users','getAgents','create','post','addQueues','put','update','delete','removeQueues'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0xcc13,0x15b));var _0x3cc1=function(_0x2a2017,_0x38e3ce){_0x2a2017=_0x2a2017-0x0;var _0x5c9634=_0xcc13[_0x2a2017];return _0x5c9634;};'use strict';var multer=require(_0x3cc1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3cc1('0x1'));var express=require(_0x3cc1('0x2'));var router=express[_0x3cc1('0x3')]();var auth=require(_0x3cc1('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3cc1('0x5'));router[_0x3cc1('0x6')]('/',auth['isAuthenticated'](),controller[_0x3cc1('0x7')]);router[_0x3cc1('0x6')](_0x3cc1('0x8'),auth[_0x3cc1('0x9')](),controller['show']);router['get'](_0x3cc1('0xa'),auth[_0x3cc1('0x9')](),controller[_0x3cc1('0xb')]);router[_0x3cc1('0x6')](_0x3cc1('0xc'),auth[_0x3cc1('0x9')](),controller[_0x3cc1('0xd')]);router['post']('/',auth[_0x3cc1('0x9')](),controller[_0x3cc1('0xe')]);router[_0x3cc1('0xf')]('/:id/queues',auth[_0x3cc1('0x9')](),controller[_0x3cc1('0x10')]);router[_0x3cc1('0xf')](_0x3cc1('0xc'),auth[_0x3cc1('0x9')](),controller['addAgents']);router[_0x3cc1('0x11')](_0x3cc1('0x8'),auth['isAuthenticated'](),controller[_0x3cc1('0x12')]);router[_0x3cc1('0x13')](_0x3cc1('0x8'),auth[_0x3cc1('0x9')](),controller['destroy']);router[_0x3cc1('0x13')](_0x3cc1('0xa'),auth[_0x3cc1('0x9')](),controller[_0x3cc1('0x14')]);router['delete'](_0x3cc1('0xc'),auth[_0x3cc1('0x9')](),controller[_0x3cc1('0x15')]);module[_0x3cc1('0x16')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 4fdfd76..a7b0172 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 _0xb2ee=['name','sequelize','exports','STRING'];(function(_0x2a46de,_0x19f9d6){var _0x4ef344=function(_0x4f5532){while(--_0x4f5532){_0x2a46de['push'](_0x2a46de['shift']());}};_0x4ef344(++_0x19f9d6);}(_0xb2ee,0xed));var _0xeb2e=function(_0x7c55bb,_0x49bc28){_0x7c55bb=_0x7c55bb-0x0;var _0x50576c=_0xb2ee[_0x7c55bb];return _0x50576c;};'use strict';var Sequelize=require(_0xeb2e('0x0'));module[_0xeb2e('0x1')]={'name':{'type':Sequelize[_0xeb2e('0x2')],'allowNull':![],'unique':_0xeb2e('0x3')},'description':{'type':Sequelize[_0xeb2e('0x2')]}}; \ No newline at end of file +var _0x936e=['STRING','sequelize','exports'];(function(_0x58c3c7,_0x302949){var _0xd9467f=function(_0x2d203d){while(--_0x2d203d){_0x58c3c7['push'](_0x58c3c7['shift']());}};_0xd9467f(++_0x302949);}(_0x936e,0x76));var _0xe936=function(_0x3b8bb3,_0x29136d){_0x3b8bb3=_0x3b8bb3-0x0;var _0x420eb8=_0x936e[_0x3b8bb3];return _0x420eb8;};'use strict';var Sequelize=require(_0xe936('0x0'));module[_0xe936('0x1')]={'name':{'type':Sequelize[_0xe936('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0xe936('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 7e76e7f..42e5295 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 _0xbe6b=['day','add','merge','map','filter','options','count','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','get','addQueues','Queues','toLowerCase','ids','addAgents','each','voice','chat','mail','sms','openchannel','User','voicePause','interface','UserVoiceQueueRt','upsert','isNil','SIP/%s','omit','spread','userTeam:save','removeAgents','userTeam:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','index','Team','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x388d9d,_0x2ceffd){var _0x2c9b7b=function(_0x1fd42e){while(--_0x1fd42e){_0x388d9d['push'](_0x388d9d['shift']());}};_0x2c9b7b(++_0x2ceffd);}(_0xbe6b,0x1ea));var _0xbbe6=function(_0x2e7dfb,_0x5195bd){_0x2e7dfb=_0x2e7dfb-0x0;var _0x408733=_0xbe6b[_0x2e7dfb];return _0x408733;};'use strict';var pdf=require(_0xbbe6('0x0'));var emlformat=require(_0xbbe6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbbe6('0x2'));var jsonpatch=require(_0xbbe6('0x3'));var rp=require(_0xbbe6('0x4'));var moment=require(_0xbbe6('0x5'));var BPromise=require(_0xbbe6('0x6'));var Mustache=require(_0xbbe6('0x7'));var util=require(_0xbbe6('0x8'));var path=require('path');var sox=require(_0xbbe6('0x9'));var csv=require(_0xbbe6('0xa'));var ejs=require(_0xbbe6('0xb'));var fs=require('fs');var _=require(_0xbbe6('0xc'));var squel=require('squel');var crypto=require(_0xbbe6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbbe6('0xe'));var toCsv=require(_0xbbe6('0xa'));var querystring=require(_0xbbe6('0xf'));var Papa=require(_0xbbe6('0x10'));var Redis=require(_0xbbe6('0x11'));var qs=require(_0xbbe6('0x12'));var logger=require('../../config/logger')(_0xbbe6('0x13'));var utils=require(_0xbbe6('0x14'));var config=require(_0xbbe6('0x15'));var db=require(_0xbbe6('0x16'))['db'];config[_0xbbe6('0x17')]=_['defaults'](config[_0xbbe6('0x17')],{'host':_0xbbe6('0x18'),'port':0x18eb});var socket=require(_0xbbe6('0x19'))(new Redis(config[_0xbbe6('0x17')]));require(_0xbbe6('0x1a'))[_0xbbe6('0x1b')](socket);function respondWithStatusCode(_0x34e2fa,_0x14f760){_0x14f760=_0x14f760||0xcc;return function(_0x84efe0){if(_0x84efe0){return _0x34e2fa[_0xbbe6('0x1c')](_0x14f760);}return _0x34e2fa[_0xbbe6('0x1d')](_0x14f760)[_0xbbe6('0x1e')]();};}function respondWithResult(_0x5847,_0x33d3cf){_0x33d3cf=_0x33d3cf||0xc8;return function(_0x12f251){if(_0x12f251){return _0x5847['status'](_0x33d3cf)[_0xbbe6('0x1f')](_0x12f251);}};}function respondWithFilteredResult(_0x22904e,_0x132707){return function(_0x3bf496){if(_0x3bf496){var _0x3aef45=_0x3bf496['count'],_0x1ddda4=_0x132707[_0xbbe6('0x20')],_0x4fd477=_0x132707['offset']+_0x132707[_0xbbe6('0x21')],_0x50c89f;if(_0x4fd477>=_0x3aef45){_0x4fd477=_0x3aef45;_0x50c89f=0xc8;}else{_0x50c89f=0xce;}_0x22904e[_0xbbe6('0x1d')](_0x50c89f);return _0x22904e[_0xbbe6('0x22')]('Content-Range',_0x1ddda4+'-'+_0x4fd477+'/'+_0x3aef45)['json'](_0x3bf496);}return null;};}function patchUpdates(_0x54849c){return function(_0x47d0b1){try{jsonpatch[_0xbbe6('0x23')](_0x47d0b1,_0x54849c,!![]);}catch(_0x27b62b){return BPromise[_0xbbe6('0x24')](_0x27b62b);}return _0x47d0b1[_0xbbe6('0x25')]();};}function saveUpdates(_0x9bc7b4,_0x8b049e){return function(_0x157920){if(_0x157920){return _0x157920[_0xbbe6('0x26')](_0x9bc7b4)[_0xbbe6('0x27')](function(_0x4dfdfe){return _0x4dfdfe;});}return null;};}function removeEntity(_0x59d9ac,_0xc81d19){return function(_0x1b25ef){if(_0x1b25ef){return _0x1b25ef[_0xbbe6('0x28')]()['then'](function(){_0x59d9ac[_0xbbe6('0x1d')](0xcc)[_0xbbe6('0x1e')]();});}};}function handleEntityNotFound(_0x6ee4ec,_0x4c8e04){return function(_0x3c2029){if(!_0x3c2029){_0x6ee4ec[_0xbbe6('0x1c')](0x194);}return _0x3c2029;};}function handleError(_0x834731,_0x448405){_0x448405=_0x448405||0x1f4;return function(_0x25f9a1){logger['error'](_0x25f9a1[_0xbbe6('0x29')]);if(_0x25f9a1[_0xbbe6('0x2a')]){delete _0x25f9a1['name'];}_0x834731[_0xbbe6('0x1d')](_0x448405)['send'](_0x25f9a1);};}exports[_0xbbe6('0x2b')]=function(_0x2a153b,_0x1dd517){var _0x48cd7a={},_0x123c06={},_0x2a7ebb={'count':0x0,'rows':[]};var _0x23c141=db[_0xbbe6('0x2c')]['rawAttributes'];_0x123c06[_0xbbe6('0x2d')]=_[_0xbbe6('0x2e')](_0x23c141);var _0x37f6d0={'dateStart':_0x2a153b[_0xbbe6('0x2f')][_0xbbe6('0x30')],'dateEnd':_0x2a153b[_0xbbe6('0x2f')][_0xbbe6('0x31')]};delete _0x2a153b[_0xbbe6('0x2f')][_0xbbe6('0x30')];delete _0x2a153b[_0xbbe6('0x2f')][_0xbbe6('0x31')];_0x123c06[_0xbbe6('0x2f')]=_['keys'](_0x2a153b['query']);_0x123c06[_0xbbe6('0x32')]=_[_0xbbe6('0x33')](_0x123c06['model'],_0x123c06[_0xbbe6('0x2f')]);_0x48cd7a[_0xbbe6('0x34')]=_[_0xbbe6('0x33')](_0x123c06['model'],qs[_0xbbe6('0x35')](_0x2a153b[_0xbbe6('0x2f')][_0xbbe6('0x35')]));_0x48cd7a[_0xbbe6('0x34')]=_0x48cd7a[_0xbbe6('0x34')][_0xbbe6('0x36')]?_0x48cd7a[_0xbbe6('0x34')]:_0x123c06[_0xbbe6('0x2d')];if(!_0x2a153b[_0xbbe6('0x2f')][_0xbbe6('0x37')](_0xbbe6('0x38'))){_0x48cd7a[_0xbbe6('0x21')]=qs[_0xbbe6('0x21')](_0x2a153b['query'][_0xbbe6('0x21')]);_0x48cd7a[_0xbbe6('0x20')]=qs[_0xbbe6('0x20')](_0x2a153b[_0xbbe6('0x2f')][_0xbbe6('0x20')]);}_0x48cd7a[_0xbbe6('0x39')]=qs['sort'](_0x2a153b[_0xbbe6('0x2f')][_0xbbe6('0x3a')]);_0x48cd7a[_0xbbe6('0x3b')]=qs[_0xbbe6('0x32')](_['pick'](_0x2a153b[_0xbbe6('0x2f')],_0x123c06[_0xbbe6('0x32')]));if(_0x37f6d0['dateStart']){if(_0x37f6d0[_0xbbe6('0x31')]){_0x37f6d0['dateEnd']=moment(_0x37f6d0[_0xbbe6('0x31')])['add'](0x1,_0xbbe6('0x3c'));}else{_0x37f6d0['dateEnd']=moment(_0x37f6d0[_0xbbe6('0x30')])[_0xbbe6('0x3d')](0x1,_0xbbe6('0x3c'));}_['merge'](_0x48cd7a[_0xbbe6('0x3b')],{'createdAt':{'$gte':_0x37f6d0[_0xbbe6('0x30')],'$lte':_0x37f6d0[_0xbbe6('0x31')]}});}if(_0x2a153b[_0xbbe6('0x2f')]['filter']){_0x48cd7a[_0xbbe6('0x3b')]=_[_0xbbe6('0x3e')](_0x48cd7a[_0xbbe6('0x3b')],{'$or':_[_0xbbe6('0x3f')](_0x48cd7a[_0xbbe6('0x34')],function(_0x53b69d){var _0x2c42a0={};_0x2c42a0[_0x53b69d]={'$like':'%'+_0x2a153b[_0xbbe6('0x2f')][_0xbbe6('0x40')]+'%'};return _0x2c42a0;})});}_0x48cd7a=_[_0xbbe6('0x3e')]({},_0x48cd7a,_0x2a153b[_0xbbe6('0x41')]);var _0x464d9c={'where':_0x48cd7a[_0xbbe6('0x3b')]};return db[_0xbbe6('0x2c')][_0xbbe6('0x42')](_0x464d9c)[_0xbbe6('0x27')](function(_0x5a8bdb){_0x2a7ebb[_0xbbe6('0x42')]=_0x5a8bdb;if(_0x2a153b[_0xbbe6('0x2f')]['includeAll']){_0x48cd7a[_0xbbe6('0x43')]=[{'all':!![]}];}return db['Team'][_0xbbe6('0x44')](_0x48cd7a);})[_0xbbe6('0x27')](function(_0x310ac9){_0x2a7ebb[_0xbbe6('0x45')]=_0x310ac9;return _0x2a7ebb;})[_0xbbe6('0x27')](respondWithFilteredResult(_0x1dd517,_0x48cd7a))[_0xbbe6('0x46')](handleError(_0x1dd517,null));};exports[_0xbbe6('0x47')]=function(_0x159440,_0x2d78e3){var _0x1c85c4={'raw':![],'where':{'id':_0x159440[_0xbbe6('0x48')]['id']}},_0x1bbf21={};_0x1bbf21[_0xbbe6('0x2d')]=_['keys'](db[_0xbbe6('0x2c')][_0xbbe6('0x49')]);_0x1bbf21[_0xbbe6('0x2f')]=_[_0xbbe6('0x2e')](_0x159440[_0xbbe6('0x2f')]);_0x1bbf21[_0xbbe6('0x32')]=_[_0xbbe6('0x33')](_0x1bbf21[_0xbbe6('0x2d')],_0x1bbf21[_0xbbe6('0x2f')]);_0x1c85c4['attributes']=_['intersection'](_0x1bbf21[_0xbbe6('0x2d')],qs['fields'](_0x159440[_0xbbe6('0x2f')][_0xbbe6('0x35')]));_0x1c85c4['attributes']=_0x1c85c4[_0xbbe6('0x34')][_0xbbe6('0x36')]?_0x1c85c4[_0xbbe6('0x34')]:_0x1bbf21[_0xbbe6('0x2d')];if(_0x159440['query']['includeAll']){_0x1c85c4['include']=[{'all':!![]}];}_0x1c85c4=_['merge']({},_0x1c85c4,_0x159440['options']);return db[_0xbbe6('0x2c')][_0xbbe6('0x4a')](_0x1c85c4)[_0xbbe6('0x27')](handleEntityNotFound(_0x2d78e3,null))[_0xbbe6('0x27')](respondWithResult(_0x2d78e3,null))[_0xbbe6('0x46')](handleError(_0x2d78e3,null));};exports['create']=function(_0x52cc63,_0xcb3520){return db['Team'][_0xbbe6('0x4b')](_0x52cc63[_0xbbe6('0x4c')],{})[_0xbbe6('0x27')](respondWithResult(_0xcb3520,0xc9))[_0xbbe6('0x46')](handleError(_0xcb3520,null));};exports[_0xbbe6('0x26')]=function(_0x5a1513,_0x5d55f9){if(_0x5a1513[_0xbbe6('0x4c')]['id']){delete _0x5a1513[_0xbbe6('0x4c')]['id'];}return db[_0xbbe6('0x2c')][_0xbbe6('0x4a')]({'where':{'id':_0x5a1513['params']['id']}})[_0xbbe6('0x27')](handleEntityNotFound(_0x5d55f9,null))['then'](saveUpdates(_0x5a1513[_0xbbe6('0x4c')],null))[_0xbbe6('0x27')](respondWithResult(_0x5d55f9,null))[_0xbbe6('0x46')](handleError(_0x5d55f9,null));};exports[_0xbbe6('0x28')]=function(_0x19882d,_0x50dbbe){return db[_0xbbe6('0x2c')]['find']({'where':{'id':_0x19882d['params']['id']}})[_0xbbe6('0x27')](handleEntityNotFound(_0x50dbbe,null))[_0xbbe6('0x27')](removeEntity(_0x50dbbe,null))[_0xbbe6('0x46')](handleError(_0x50dbbe,null));};exports[_0xbbe6('0x4d')]=function(_0x488c59,_0x1a2d5e,_0x3766b1){return db[_0xbbe6('0x2c')][_0xbbe6('0x4e')]({'where':{'id':_0x488c59[_0xbbe6('0x48')]['id']}})['then'](handleEntityNotFound(_0x1a2d5e,null))[_0xbbe6('0x27')](function(_0x432cfc){if(!_0x488c59['query'][_0xbbe6('0x4f')]||!utils[_0xbbe6('0x50')](_0x488c59[_0xbbe6('0x2f')][_0xbbe6('0x4f')])){throw new db[(_0xbbe6('0x51'))][(_0xbbe6('0x52'))](_0xbbe6('0x53'));}var _0x131b42={};var _0x1df46f={};_0x1df46f['model']=_['keys'](db[_[_0xbbe6('0x54')](_0x488c59[_0xbbe6('0x2f')][_0xbbe6('0x4f')]['toLowerCase']())+'Queue'][_0xbbe6('0x49')]);_0x1df46f['query']=_[_0xbbe6('0x2e')](_0x488c59[_0xbbe6('0x2f')]);_0x1df46f['filters']=_[_0xbbe6('0x33')](_0x1df46f[_0xbbe6('0x2d')],_0x1df46f[_0xbbe6('0x2f')]);_0x131b42['attributes']=_[_0xbbe6('0x33')](_0x1df46f['model'],qs[_0xbbe6('0x35')](_0x488c59[_0xbbe6('0x2f')][_0xbbe6('0x35')]));_0x131b42[_0xbbe6('0x34')]=_0x131b42[_0xbbe6('0x34')][_0xbbe6('0x36')]?_0x131b42[_0xbbe6('0x34')]:_0x1df46f['model'];_0x131b42[_0xbbe6('0x21')]=qs[_0xbbe6('0x21')](_0x488c59[_0xbbe6('0x2f')][_0xbbe6('0x21')]);_0x131b42['offset']=qs[_0xbbe6('0x20')](_0x488c59['query'][_0xbbe6('0x20')]);_0x131b42[_0xbbe6('0x39')]=qs[_0xbbe6('0x3a')](_0x488c59['query'][_0xbbe6('0x3a')]);_0x131b42[_0xbbe6('0x3b')]=qs['filters'](_['pick'](_0x488c59[_0xbbe6('0x2f')],_0x1df46f['filters']));_0x131b42=_['merge']({},_0x131b42,_0x488c59[_0xbbe6('0x41')]);return _0x432cfc[_0xbbe6('0x55')+_[_0xbbe6('0x54')](_0x488c59[_0xbbe6('0x2f')][_0xbbe6('0x4f')]['toLowerCase']())+'Queues'](_0x131b42);})[_0xbbe6('0x27')](respondWithResult(_0x1a2d5e,null))[_0xbbe6('0x46')](handleError(_0x1a2d5e,null));};exports[_0xbbe6('0x56')]=function(_0x49a63e,_0x4347d1,_0x3f90da){return db[_0xbbe6('0x2c')][_0xbbe6('0x4e')]({'where':{'id':_0x49a63e[_0xbbe6('0x48')]['id']}})[_0xbbe6('0x27')](function(_0x3043d8){if(_0x3043d8){if(!_0x49a63e[_0xbbe6('0x4c')][_0xbbe6('0x4f')]||!utils[_0xbbe6('0x50')](_0x49a63e['body'][_0xbbe6('0x4f')])){throw new db[(_0xbbe6('0x51'))]['ValidationError'](_0xbbe6('0x53'));}return _0x3043d8[_0xbbe6('0x3d')+_[_0xbbe6('0x54')](_0x49a63e[_0xbbe6('0x4c')]['channel']['toLowerCase']())+_0xbbe6('0x57')](_0x49a63e['body']['ids']);}return null;})['then'](handleEntityNotFound(_0x4347d1,null))[_0xbbe6('0x27')](respondWithStatusCode(_0x4347d1,null))[_0xbbe6('0x46')](handleError(_0x4347d1,null));};exports['removeQueues']=function(_0xd8f716,_0x541ecd,_0x262cb9){return db[_0xbbe6('0x2c')][_0xbbe6('0x4e')]({'where':{'id':_0xd8f716[_0xbbe6('0x48')]['id']}})[_0xbbe6('0x27')](function(_0x5a9452){if(_0x5a9452){if(!_0xd8f716[_0xbbe6('0x2f')][_0xbbe6('0x4f')]||!utils[_0xbbe6('0x50')](_0xd8f716[_0xbbe6('0x2f')][_0xbbe6('0x4f')])){throw new db[(_0xbbe6('0x51'))]['ValidationError'](_0xbbe6('0x53'));}return _0x5a9452['remove'+_['capitalize'](_0xd8f716[_0xbbe6('0x2f')][_0xbbe6('0x4f')][_0xbbe6('0x58')]())+'Queues'](_0xd8f716['query'][_0xbbe6('0x59')]);}return null;})[_0xbbe6('0x27')](handleEntityNotFound(_0x541ecd,null))[_0xbbe6('0x27')](respondWithStatusCode(_0x541ecd,null))[_0xbbe6('0x46')](handleError(_0x541ecd,null));};exports[_0xbbe6('0x5a')]=function(_0x50566a,_0x3d4e0e,_0x3ce395){return db[_0xbbe6('0x2c')]['find']({'where':{'id':_0x50566a['params']['id']}})[_0xbbe6('0x27')](handleEntityNotFound(_0x3d4e0e,null))['then'](function(_0x516b1e){if(_0x516b1e){return BPromise[_0xbbe6('0x5b')]([_0xbbe6('0x5c'),_0xbbe6('0x5d'),_0xbbe6('0x5e'),_0xbbe6('0x5f'),'fax',_0xbbe6('0x60')],function(_0x17407e){return _0x516b1e[_0xbbe6('0x55')+_[_0xbbe6('0x54')](_0x17407e)+_0xbbe6('0x57')]({'attributes':['id',_0xbbe6('0x2a')]})['then'](function(_0x5988ec){return BPromise['each'](_0x5988ec,function(_0x1d38b8){return _0x1d38b8[_0xbbe6('0x5a')](_0x50566a['body'][_0xbbe6('0x59')])[_0xbbe6('0x27')](function(){if(_0x17407e==='voice'){return db[_0xbbe6('0x61')]['findAll']({'where':{'id':_0x50566a[_0xbbe6('0x4c')][_0xbbe6('0x59')]},'attributes':['id','name','loginInPause',_0xbbe6('0x62'),_0xbbe6('0x63')],'raw':!![]});}})[_0xbbe6('0x27')](function(_0x328f34){if(_0x17407e===_0xbbe6('0x5c')){return BPromise[_0xbbe6('0x5b')](_0x328f34,function(_0x4d9494){return db[_0xbbe6('0x64')][_0xbbe6('0x65')]({'membername':_0x4d9494[_0xbbe6('0x2a')],'UserId':_0x4d9494['id'],'queue_name':_0x1d38b8['name'],'VoiceQueueId':_0x1d38b8['id'],'interface':_[_0xbbe6('0x66')](_0x4d9494[_0xbbe6('0x63')])?util['format'](_0xbbe6('0x67'),_0x4d9494['name']):_0x4d9494['interface'],'paused':_0x4d9494['voicePause']||![],'penalty':0x0});});}});});})[_0xbbe6('0x27')](function(){return _0x516b1e;});})[_0xbbe6('0x27')](function(){return _0x516b1e;});}})['then'](function(_0x4aa5ef){if(_0x4aa5ef){return _0x4aa5ef[_0xbbe6('0x5a')](_0x50566a[_0xbbe6('0x4c')][_0xbbe6('0x59')],_[_0xbbe6('0x68')](_0x50566a[_0xbbe6('0x4c')],[_0xbbe6('0x59'),'id'])||{})[_0xbbe6('0x69')](function(_0xbc6a2f){for(var _0x55e145=0x0;_0x55e145<_0x50566a[_0xbbe6('0x4c')][_0xbbe6('0x59')][_0xbbe6('0x36')];_0x55e145+=0x1){socket['emit'](_0xbbe6('0x6a'),{'UserId':_0x50566a[_0xbbe6('0x4c')][_0xbbe6('0x59')][_0x55e145],'TeamId':_0x50566a[_0xbbe6('0x48')]['id']});}return _0xbc6a2f;});}})[_0xbbe6('0x27')](respondWithResult(_0x3d4e0e,null))[_0xbbe6('0x46')](handleError(_0x3d4e0e,null));};exports[_0xbbe6('0x6b')]=function(_0x384933,_0x301a19,_0x241f37){var _0x579e53;return db[_0xbbe6('0x2c')][_0xbbe6('0x4a')]({'where':{'id':_0x384933[_0xbbe6('0x48')]['id']}})[_0xbbe6('0x27')](handleEntityNotFound(_0x301a19,null))[_0xbbe6('0x27')](function(_0x4e1ed0){if(_0x4e1ed0){return BPromise[_0xbbe6('0x5b')]([_0xbbe6('0x5c'),_0xbbe6('0x5d'),_0xbbe6('0x5e'),_0xbbe6('0x5f'),'fax',_0xbbe6('0x60')],function(_0x2843c9){return _0x4e1ed0['get'+_['capitalize'](_0x2843c9)+'Queues']({'attributes':['id',_0xbbe6('0x2a')]})[_0xbbe6('0x27')](function(_0xf4467a){return BPromise[_0xbbe6('0x5b')](_0xf4467a,function(_0x455ab2){return _0x455ab2[_0xbbe6('0x6b')](_0x384933[_0xbbe6('0x2f')][_0xbbe6('0x59')])[_0xbbe6('0x27')](function(){if(_0x2843c9===_0xbbe6('0x5c')){return db[_0xbbe6('0x64')][_0xbbe6('0x28')]({'where':{'VoiceQueueId':_0x455ab2['id'],'UserId':_0x384933['query'][_0xbbe6('0x59')]}});}});});})[_0xbbe6('0x27')](function(){return _0x4e1ed0;});})[_0xbbe6('0x27')](function(){return _0x4e1ed0;});}})['then'](function(_0x134cbb){if(_0x134cbb){return _0x134cbb['removeAgents'](_0x384933[_0xbbe6('0x2f')][_0xbbe6('0x59')])[_0xbbe6('0x27')](function(_0x3f32b7){if(_['isArray'](_0x384933[_0xbbe6('0x2f')]['ids'])){for(var _0x57311d=0x0;_0x57311d<_0x384933[_0xbbe6('0x2f')]['ids']['length'];_0x57311d+=0x1){socket['emit']('userTeam:remove',{'UserId':_0x384933['query'][_0xbbe6('0x59')][_0x57311d],'TeamId':_0x384933['params']['id']});}}else{socket['emit'](_0xbbe6('0x6c'),{'UserId':_0x384933['query'][_0xbbe6('0x59')],'TeamId':_0x384933['params']['id']});}});}})[_0xbbe6('0x27')](respondWithStatusCode(_0x301a19,null))[_0xbbe6('0x46')](handleError(_0x301a19,null));};exports['getAgents']=function(_0x1d2040,_0x2199c2,_0x3bc443){var _0x502dbd={};var _0x34f9e5={};var _0x571158;var _0x44e901;return db[_0xbbe6('0x2c')][_0xbbe6('0x4e')]({'where':{'id':_0x1d2040[_0xbbe6('0x48')]['id']}})[_0xbbe6('0x27')](handleEntityNotFound(_0x2199c2,null))[_0xbbe6('0x27')](function(_0x248018){if(_0x248018){_0x571158=_0x248018;_0x34f9e5[_0xbbe6('0x2d')]=_[_0xbbe6('0x2e')](db[_0xbbe6('0x61')]['rawAttributes']);_0x34f9e5[_0xbbe6('0x2f')]=_[_0xbbe6('0x2e')](_0x1d2040[_0xbbe6('0x2f')]);_0x34f9e5[_0xbbe6('0x32')]=_[_0xbbe6('0x33')](_0x34f9e5['model'],_0x34f9e5[_0xbbe6('0x2f')]);_0x502dbd[_0xbbe6('0x34')]=_[_0xbbe6('0x33')](_0x34f9e5[_0xbbe6('0x2d')],qs[_0xbbe6('0x35')](_0x1d2040[_0xbbe6('0x2f')][_0xbbe6('0x35')]));_0x502dbd[_0xbbe6('0x34')]=_0x502dbd[_0xbbe6('0x34')][_0xbbe6('0x36')]?_0x502dbd[_0xbbe6('0x34')]:_0x34f9e5['model'];_0x502dbd[_0xbbe6('0x39')]=qs['sort'](_0x1d2040['query'][_0xbbe6('0x3a')]);_0x502dbd[_0xbbe6('0x3b')]=qs[_0xbbe6('0x32')](_['pick'](_0x1d2040[_0xbbe6('0x2f')],_0x34f9e5[_0xbbe6('0x32')]));if(_0x1d2040['query'][_0xbbe6('0x40')]){_0x502dbd[_0xbbe6('0x3b')]=_[_0xbbe6('0x3e')](_0x502dbd[_0xbbe6('0x3b')],{'$or':_[_0xbbe6('0x3f')](_0x502dbd[_0xbbe6('0x34')],function(_0x2deb03){var _0x5f4a4c={};_0x5f4a4c[_0x2deb03]={'$like':'%'+_0x1d2040['query'][_0xbbe6('0x40')]+'%'};return _0x5f4a4c;})});}_0x502dbd=_[_0xbbe6('0x3e')]({},_0x502dbd,_0x1d2040[_0xbbe6('0x41')]);return _0x571158['getAgents'](_0x502dbd);}})[_0xbbe6('0x27')](function(_0x218d9b){if(_0x218d9b){_0x44e901=_0x218d9b[_0xbbe6('0x36')];if(!_0x1d2040[_0xbbe6('0x2f')]['hasOwnProperty'](_0xbbe6('0x38'))){_0x502dbd['limit']=qs['limit'](_0x1d2040[_0xbbe6('0x2f')][_0xbbe6('0x21')]);_0x502dbd[_0xbbe6('0x20')]=qs['offset'](_0x1d2040[_0xbbe6('0x2f')][_0xbbe6('0x20')]);}return _0x571158[_0xbbe6('0x6d')](_0x502dbd);}})[_0xbbe6('0x27')](function(_0x820b8){if(_0x820b8){return _0x820b8?{'count':_0x44e901,'rows':_0x820b8}:null;}})['then'](respondWithResult(_0x2199c2,null))[_0xbbe6('0x46')](handleError(_0x2199c2,null));}; \ No newline at end of file +var _0x2112=['includeAll','options','find','create','body','params','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','capitalize','toLowerCase','Queue','Queues','addQueues','Unknown\x20channel','ids','removeQueues','remove','addAgents','each','mail','sms','openchannel','get','voice','User','loginInPause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','voicePause','omit','spread','emit','userTeam:save','removeAgents','chat','fax','isArray','userTeam:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./team.socket','register','status','end','json','count','offset','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','rawAttributes','keys','query','dateStart','dateEnd','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','add','day','filter','map','merge','include','Team','findAll','rows','catch','filters'];(function(_0x42e7c2,_0x26dd7a){var _0x57dc35=function(_0x276082){while(--_0x276082){_0x42e7c2['push'](_0x42e7c2['shift']());}};_0x57dc35(++_0x26dd7a);}(_0x2112,0x117));var _0x2211=function(_0x10a6ff,_0xde548a){_0x10a6ff=_0x10a6ff-0x0;var _0x4357b5=_0x2112[_0x10a6ff];return _0x4357b5;};'use strict';var pdf=require(_0x2211('0x0'));var emlformat=require(_0x2211('0x1'));var rimraf=require(_0x2211('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2211('0x3'));var rp=require(_0x2211('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2211('0x5'));var util=require('util');var path=require('path');var sox=require(_0x2211('0x6'));var csv=require(_0x2211('0x7'));var ejs=require(_0x2211('0x8'));var fs=require('fs');var _=require(_0x2211('0x9'));var squel=require(_0x2211('0xa'));var crypto=require(_0x2211('0xb'));var jsforce=require(_0x2211('0xc'));var deskjs=require(_0x2211('0xd'));var toCsv=require(_0x2211('0x7'));var querystring=require(_0x2211('0xe'));var Papa=require('papaparse');var Redis=require(_0x2211('0xf'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x2211('0x10'));var utils=require('../../config/utils');var config=require(_0x2211('0x11'));var db=require(_0x2211('0x12'))['db'];config['redis']=_[_0x2211('0x13')](config[_0x2211('0x14')],{'host':_0x2211('0x15'),'port':0x18eb});var socket=require(_0x2211('0x16'))(new Redis(config[_0x2211('0x14')]));require(_0x2211('0x17'))[_0x2211('0x18')](socket);function respondWithStatusCode(_0x3e63d7,_0x3dd67c){_0x3dd67c=_0x3dd67c||0xcc;return function(_0x4032e3){if(_0x4032e3){return _0x3e63d7['sendStatus'](_0x3dd67c);}return _0x3e63d7[_0x2211('0x19')](_0x3dd67c)[_0x2211('0x1a')]();};}function respondWithResult(_0x9227cc,_0x1b9738){_0x1b9738=_0x1b9738||0xc8;return function(_0x5b543c){if(_0x5b543c){return _0x9227cc[_0x2211('0x19')](_0x1b9738)[_0x2211('0x1b')](_0x5b543c);}};}function respondWithFilteredResult(_0x164c6e,_0x56e9d8){return function(_0x12efb7){if(_0x12efb7){var _0x2a230c=_0x12efb7[_0x2211('0x1c')],_0x5a9a80=_0x56e9d8[_0x2211('0x1d')],_0x1ca174=_0x56e9d8[_0x2211('0x1d')]+_0x56e9d8['limit'],_0x45e8fc;if(_0x1ca174>=_0x2a230c){_0x1ca174=_0x2a230c;_0x45e8fc=0xc8;}else{_0x45e8fc=0xce;}_0x164c6e[_0x2211('0x19')](_0x45e8fc);return _0x164c6e['set']('Content-Range',_0x5a9a80+'-'+_0x1ca174+'/'+_0x2a230c)[_0x2211('0x1b')](_0x12efb7);}return null;};}function patchUpdates(_0x28ce76){return function(_0x59654d){try{jsonpatch[_0x2211('0x1e')](_0x59654d,_0x28ce76,!![]);}catch(_0x2113bf){return BPromise[_0x2211('0x1f')](_0x2113bf);}return _0x59654d[_0x2211('0x20')]();};}function saveUpdates(_0x497954,_0x137e2f){return function(_0x4be4e5){if(_0x4be4e5){return _0x4be4e5[_0x2211('0x21')](_0x497954)[_0x2211('0x22')](function(_0x13a309){return _0x13a309;});}return null;};}function removeEntity(_0x3d5426,_0x1cbeee){return function(_0x31ef97){if(_0x31ef97){return _0x31ef97[_0x2211('0x23')]()[_0x2211('0x22')](function(){_0x3d5426[_0x2211('0x19')](0xcc)[_0x2211('0x1a')]();});}};}function handleEntityNotFound(_0x5280e2,_0x405bc3){return function(_0x3bdb3e){if(!_0x3bdb3e){_0x5280e2[_0x2211('0x24')](0x194);}return _0x3bdb3e;};}function handleError(_0x3937a9,_0x49f323){_0x49f323=_0x49f323||0x1f4;return function(_0x5cd8b6){logger[_0x2211('0x25')](_0x5cd8b6[_0x2211('0x26')]);if(_0x5cd8b6['name']){delete _0x5cd8b6[_0x2211('0x27')];}_0x3937a9[_0x2211('0x19')](_0x49f323)[_0x2211('0x28')](_0x5cd8b6);};}exports['index']=function(_0x39ee25,_0x357cf9){var _0x17e479={},_0x30cebf={},_0x28951b={'count':0x0,'rows':[]};var _0x147c67=db['Team'][_0x2211('0x29')];_0x30cebf['model']=_[_0x2211('0x2a')](_0x147c67);var _0x2c0ae5={'dateStart':_0x39ee25[_0x2211('0x2b')][_0x2211('0x2c')],'dateEnd':_0x39ee25['query']['dateEnd']};delete _0x39ee25[_0x2211('0x2b')][_0x2211('0x2c')];delete _0x39ee25[_0x2211('0x2b')][_0x2211('0x2d')];_0x30cebf[_0x2211('0x2b')]=_[_0x2211('0x2a')](_0x39ee25[_0x2211('0x2b')]);_0x30cebf['filters']=_[_0x2211('0x2e')](_0x30cebf[_0x2211('0x2f')],_0x30cebf[_0x2211('0x2b')]);_0x17e479[_0x2211('0x30')]=_[_0x2211('0x2e')](_0x30cebf['model'],qs[_0x2211('0x31')](_0x39ee25[_0x2211('0x2b')][_0x2211('0x31')]));_0x17e479[_0x2211('0x30')]=_0x17e479[_0x2211('0x30')][_0x2211('0x32')]?_0x17e479[_0x2211('0x30')]:_0x30cebf['model'];if(!_0x39ee25['query'][_0x2211('0x33')](_0x2211('0x34'))){_0x17e479[_0x2211('0x35')]=qs[_0x2211('0x35')](_0x39ee25['query'][_0x2211('0x35')]);_0x17e479['offset']=qs[_0x2211('0x1d')](_0x39ee25[_0x2211('0x2b')][_0x2211('0x1d')]);}_0x17e479[_0x2211('0x36')]=qs[_0x2211('0x37')](_0x39ee25[_0x2211('0x2b')][_0x2211('0x37')]);_0x17e479[_0x2211('0x38')]=qs['filters'](_[_0x2211('0x39')](_0x39ee25['query'],_0x30cebf['filters']));if(_0x2c0ae5['dateStart']){if(_0x2c0ae5[_0x2211('0x2d')]){_0x2c0ae5[_0x2211('0x2d')]=moment(_0x2c0ae5['dateEnd'])[_0x2211('0x3a')](0x1,_0x2211('0x3b'));}else{_0x2c0ae5[_0x2211('0x2d')]=moment(_0x2c0ae5[_0x2211('0x2c')])[_0x2211('0x3a')](0x1,_0x2211('0x3b'));}_['merge'](_0x17e479[_0x2211('0x38')],{'createdAt':{'$gte':_0x2c0ae5[_0x2211('0x2c')],'$lte':_0x2c0ae5['dateEnd']}});}if(_0x39ee25[_0x2211('0x2b')][_0x2211('0x3c')]){_0x17e479['where']=_['merge'](_0x17e479[_0x2211('0x38')],{'$or':_[_0x2211('0x3d')](_0x17e479['attributes'],function(_0x3f88b4){var _0x264dc4={};_0x264dc4[_0x3f88b4]={'$like':'%'+_0x39ee25[_0x2211('0x2b')]['filter']+'%'};return _0x264dc4;})});}_0x17e479=_[_0x2211('0x3e')]({},_0x17e479,_0x39ee25['options']);var _0x1b054d={'where':_0x17e479[_0x2211('0x38')]};return db['Team']['count'](_0x1b054d)['then'](function(_0x3bb367){_0x28951b[_0x2211('0x1c')]=_0x3bb367;if(_0x39ee25[_0x2211('0x2b')]['includeAll']){_0x17e479[_0x2211('0x3f')]=[{'all':!![]}];}return db[_0x2211('0x40')][_0x2211('0x41')](_0x17e479);})['then'](function(_0x46d04e){_0x28951b[_0x2211('0x42')]=_0x46d04e;return _0x28951b;})[_0x2211('0x22')](respondWithFilteredResult(_0x357cf9,_0x17e479))[_0x2211('0x43')](handleError(_0x357cf9,null));};exports['show']=function(_0x5cfea3,_0x34ccd7){var _0x407684={'raw':![],'where':{'id':_0x5cfea3['params']['id']}},_0x28ddaf={};_0x28ddaf[_0x2211('0x2f')]=_[_0x2211('0x2a')](db[_0x2211('0x40')]['rawAttributes']);_0x28ddaf[_0x2211('0x2b')]=_['keys'](_0x5cfea3[_0x2211('0x2b')]);_0x28ddaf[_0x2211('0x44')]=_[_0x2211('0x2e')](_0x28ddaf[_0x2211('0x2f')],_0x28ddaf[_0x2211('0x2b')]);_0x407684[_0x2211('0x30')]=_['intersection'](_0x28ddaf[_0x2211('0x2f')],qs[_0x2211('0x31')](_0x5cfea3[_0x2211('0x2b')][_0x2211('0x31')]));_0x407684['attributes']=_0x407684[_0x2211('0x30')]['length']?_0x407684[_0x2211('0x30')]:_0x28ddaf[_0x2211('0x2f')];if(_0x5cfea3[_0x2211('0x2b')][_0x2211('0x45')]){_0x407684[_0x2211('0x3f')]=[{'all':!![]}];}_0x407684=_['merge']({},_0x407684,_0x5cfea3[_0x2211('0x46')]);return db['Team'][_0x2211('0x47')](_0x407684)[_0x2211('0x22')](handleEntityNotFound(_0x34ccd7,null))[_0x2211('0x22')](respondWithResult(_0x34ccd7,null))[_0x2211('0x43')](handleError(_0x34ccd7,null));};exports[_0x2211('0x48')]=function(_0x59f60a,_0x3c0a93){return db[_0x2211('0x40')][_0x2211('0x48')](_0x59f60a['body'],{})['then'](respondWithResult(_0x3c0a93,0xc9))[_0x2211('0x43')](handleError(_0x3c0a93,null));};exports[_0x2211('0x21')]=function(_0x278c12,_0x58907b){if(_0x278c12[_0x2211('0x49')]['id']){delete _0x278c12[_0x2211('0x49')]['id'];}return db['Team'][_0x2211('0x47')]({'where':{'id':_0x278c12['params']['id']}})[_0x2211('0x22')](handleEntityNotFound(_0x58907b,null))['then'](saveUpdates(_0x278c12[_0x2211('0x49')],null))[_0x2211('0x22')](respondWithResult(_0x58907b,null))[_0x2211('0x43')](handleError(_0x58907b,null));};exports[_0x2211('0x23')]=function(_0x18126e,_0x212779){return db['Team']['find']({'where':{'id':_0x18126e[_0x2211('0x4a')]['id']}})[_0x2211('0x22')](handleEntityNotFound(_0x212779,null))[_0x2211('0x22')](removeEntity(_0x212779,null))[_0x2211('0x43')](handleError(_0x212779,null));};exports[_0x2211('0x4b')]=function(_0xe71a9d,_0x4b3df4,_0x472a9c){return db[_0x2211('0x40')][_0x2211('0x4c')]({'where':{'id':_0xe71a9d[_0x2211('0x4a')]['id']}})[_0x2211('0x22')](handleEntityNotFound(_0x4b3df4,null))[_0x2211('0x22')](function(_0x3a891f){if(!_0xe71a9d[_0x2211('0x2b')][_0x2211('0x4d')]||!utils[_0x2211('0x4e')](_0xe71a9d['query'][_0x2211('0x4d')])){throw new db[(_0x2211('0x4f'))][(_0x2211('0x50'))]('Unknown\x20channel');}var _0x233b2d={};var _0x23161f={};_0x23161f['model']=_[_0x2211('0x2a')](db[_[_0x2211('0x51')](_0xe71a9d[_0x2211('0x2b')][_0x2211('0x4d')][_0x2211('0x52')]())+_0x2211('0x53')][_0x2211('0x29')]);_0x23161f[_0x2211('0x2b')]=_[_0x2211('0x2a')](_0xe71a9d['query']);_0x23161f[_0x2211('0x44')]=_[_0x2211('0x2e')](_0x23161f[_0x2211('0x2f')],_0x23161f[_0x2211('0x2b')]);_0x233b2d[_0x2211('0x30')]=_[_0x2211('0x2e')](_0x23161f[_0x2211('0x2f')],qs[_0x2211('0x31')](_0xe71a9d[_0x2211('0x2b')][_0x2211('0x31')]));_0x233b2d[_0x2211('0x30')]=_0x233b2d[_0x2211('0x30')][_0x2211('0x32')]?_0x233b2d[_0x2211('0x30')]:_0x23161f['model'];_0x233b2d[_0x2211('0x35')]=qs[_0x2211('0x35')](_0xe71a9d[_0x2211('0x2b')][_0x2211('0x35')]);_0x233b2d['offset']=qs[_0x2211('0x1d')](_0xe71a9d[_0x2211('0x2b')]['offset']);_0x233b2d[_0x2211('0x36')]=qs['sort'](_0xe71a9d[_0x2211('0x2b')][_0x2211('0x37')]);_0x233b2d[_0x2211('0x38')]=qs[_0x2211('0x44')](_[_0x2211('0x39')](_0xe71a9d[_0x2211('0x2b')],_0x23161f[_0x2211('0x44')]));_0x233b2d=_[_0x2211('0x3e')]({},_0x233b2d,_0xe71a9d[_0x2211('0x46')]);return _0x3a891f['get'+_[_0x2211('0x51')](_0xe71a9d['query'][_0x2211('0x4d')][_0x2211('0x52')]())+_0x2211('0x54')](_0x233b2d);})[_0x2211('0x22')](respondWithResult(_0x4b3df4,null))[_0x2211('0x43')](handleError(_0x4b3df4,null));};exports[_0x2211('0x55')]=function(_0x1df9c8,_0x2e96f8,_0x13ed15){return db[_0x2211('0x40')][_0x2211('0x4c')]({'where':{'id':_0x1df9c8[_0x2211('0x4a')]['id']}})[_0x2211('0x22')](function(_0x2a2082){if(_0x2a2082){if(!_0x1df9c8['body'][_0x2211('0x4d')]||!utils[_0x2211('0x4e')](_0x1df9c8[_0x2211('0x49')][_0x2211('0x4d')])){throw new db[(_0x2211('0x4f'))][(_0x2211('0x50'))](_0x2211('0x56'));}return _0x2a2082[_0x2211('0x3a')+_['capitalize'](_0x1df9c8['body'][_0x2211('0x4d')][_0x2211('0x52')]())+_0x2211('0x54')](_0x1df9c8[_0x2211('0x49')][_0x2211('0x57')]);}return null;})[_0x2211('0x22')](handleEntityNotFound(_0x2e96f8,null))[_0x2211('0x22')](respondWithStatusCode(_0x2e96f8,null))[_0x2211('0x43')](handleError(_0x2e96f8,null));};exports[_0x2211('0x58')]=function(_0x3cf7c2,_0x321642,_0x3dd09a){return db[_0x2211('0x40')][_0x2211('0x4c')]({'where':{'id':_0x3cf7c2[_0x2211('0x4a')]['id']}})[_0x2211('0x22')](function(_0x28692a){if(_0x28692a){if(!_0x3cf7c2['query'][_0x2211('0x4d')]||!utils[_0x2211('0x4e')](_0x3cf7c2[_0x2211('0x2b')]['channel'])){throw new db['Sequelize'][(_0x2211('0x50'))](_0x2211('0x56'));}return _0x28692a[_0x2211('0x59')+_[_0x2211('0x51')](_0x3cf7c2['query']['channel']['toLowerCase']())+_0x2211('0x54')](_0x3cf7c2['query'][_0x2211('0x57')]);}return null;})[_0x2211('0x22')](handleEntityNotFound(_0x321642,null))[_0x2211('0x22')](respondWithStatusCode(_0x321642,null))['catch'](handleError(_0x321642,null));};exports[_0x2211('0x5a')]=function(_0x57576f,_0x108fa6,_0x367c8c){return db[_0x2211('0x40')][_0x2211('0x47')]({'where':{'id':_0x57576f['params']['id']}})[_0x2211('0x22')](handleEntityNotFound(_0x108fa6,null))['then'](function(_0x3c3f9f){if(_0x3c3f9f){return BPromise[_0x2211('0x5b')](['voice','chat',_0x2211('0x5c'),_0x2211('0x5d'),'fax',_0x2211('0x5e')],function(_0x597528){return _0x3c3f9f[_0x2211('0x5f')+_[_0x2211('0x51')](_0x597528)+_0x2211('0x54')]({'attributes':['id',_0x2211('0x27')]})['then'](function(_0x48e2c4){return BPromise[_0x2211('0x5b')](_0x48e2c4,function(_0x1fa3e0){return _0x1fa3e0[_0x2211('0x5a')](_0x57576f[_0x2211('0x49')][_0x2211('0x57')])[_0x2211('0x22')](function(){if(_0x597528===_0x2211('0x60')){return db[_0x2211('0x61')][_0x2211('0x41')]({'where':{'id':_0x57576f['body']['ids']},'attributes':['id',_0x2211('0x27'),_0x2211('0x62'),'voicePause',_0x2211('0x63')],'raw':!![]});}})[_0x2211('0x22')](function(_0x5a8deb){if(_0x597528===_0x2211('0x60')){return BPromise[_0x2211('0x5b')](_0x5a8deb,function(_0x1cb780){return db[_0x2211('0x64')][_0x2211('0x65')]({'membername':_0x1cb780['name'],'UserId':_0x1cb780['id'],'queue_name':_0x1fa3e0['name'],'VoiceQueueId':_0x1fa3e0['id'],'interface':_[_0x2211('0x66')](_0x1cb780[_0x2211('0x63')])?util[_0x2211('0x67')](_0x2211('0x68'),_0x1cb780[_0x2211('0x27')]):_0x1cb780[_0x2211('0x63')],'paused':_0x1cb780[_0x2211('0x69')]||![],'penalty':0x0});});}});});})[_0x2211('0x22')](function(){return _0x3c3f9f;});})[_0x2211('0x22')](function(){return _0x3c3f9f;});}})[_0x2211('0x22')](function(_0x500b06){if(_0x500b06){return _0x500b06[_0x2211('0x5a')](_0x57576f[_0x2211('0x49')]['ids'],_[_0x2211('0x6a')](_0x57576f[_0x2211('0x49')],[_0x2211('0x57'),'id'])||{})[_0x2211('0x6b')](function(_0x415d58){for(var _0x574797=0x0;_0x574797<_0x57576f[_0x2211('0x49')][_0x2211('0x57')][_0x2211('0x32')];_0x574797+=0x1){socket[_0x2211('0x6c')](_0x2211('0x6d'),{'UserId':_0x57576f[_0x2211('0x49')][_0x2211('0x57')][_0x574797],'TeamId':_0x57576f[_0x2211('0x4a')]['id']});}return _0x415d58;});}})[_0x2211('0x22')](respondWithResult(_0x108fa6,null))['catch'](handleError(_0x108fa6,null));};exports[_0x2211('0x6e')]=function(_0x37f800,_0x571b27,_0x52f9e1){var _0x5ef048;return db[_0x2211('0x40')]['find']({'where':{'id':_0x37f800[_0x2211('0x4a')]['id']}})['then'](handleEntityNotFound(_0x571b27,null))[_0x2211('0x22')](function(_0x5f4cd2){if(_0x5f4cd2){return BPromise[_0x2211('0x5b')](['voice',_0x2211('0x6f'),_0x2211('0x5c'),_0x2211('0x5d'),_0x2211('0x70'),_0x2211('0x5e')],function(_0x3b96f4){return _0x5f4cd2['get'+_[_0x2211('0x51')](_0x3b96f4)+'Queues']({'attributes':['id',_0x2211('0x27')]})[_0x2211('0x22')](function(_0x146153){return BPromise[_0x2211('0x5b')](_0x146153,function(_0x440bcc){return _0x440bcc[_0x2211('0x6e')](_0x37f800[_0x2211('0x2b')][_0x2211('0x57')])[_0x2211('0x22')](function(){if(_0x3b96f4===_0x2211('0x60')){return db[_0x2211('0x64')][_0x2211('0x23')]({'where':{'VoiceQueueId':_0x440bcc['id'],'UserId':_0x37f800[_0x2211('0x2b')][_0x2211('0x57')]}});}});});})[_0x2211('0x22')](function(){return _0x5f4cd2;});})[_0x2211('0x22')](function(){return _0x5f4cd2;});}})[_0x2211('0x22')](function(_0x581de1){if(_0x581de1){return _0x581de1['removeAgents'](_0x37f800[_0x2211('0x2b')][_0x2211('0x57')])[_0x2211('0x22')](function(_0x15f260){if(_[_0x2211('0x71')](_0x37f800[_0x2211('0x2b')][_0x2211('0x57')])){for(var _0x566fe4=0x0;_0x566fe4<_0x37f800['query'][_0x2211('0x57')][_0x2211('0x32')];_0x566fe4+=0x1){socket['emit'](_0x2211('0x72'),{'UserId':_0x37f800['query']['ids'][_0x566fe4],'TeamId':_0x37f800['params']['id']});}}else{socket[_0x2211('0x6c')](_0x2211('0x72'),{'UserId':_0x37f800['query'][_0x2211('0x57')],'TeamId':_0x37f800[_0x2211('0x4a')]['id']});}});}})[_0x2211('0x22')](respondWithStatusCode(_0x571b27,null))[_0x2211('0x43')](handleError(_0x571b27,null));};exports[_0x2211('0x73')]=function(_0x3dcaa5,_0xa3535,_0x30dbc7){var _0x3f3090={};var _0x2c3ed1={};var _0x18f2fa;var _0x30abfa;return db[_0x2211('0x40')][_0x2211('0x4c')]({'where':{'id':_0x3dcaa5[_0x2211('0x4a')]['id']}})['then'](handleEntityNotFound(_0xa3535,null))[_0x2211('0x22')](function(_0x445ebc){if(_0x445ebc){_0x18f2fa=_0x445ebc;_0x2c3ed1[_0x2211('0x2f')]=_[_0x2211('0x2a')](db[_0x2211('0x61')][_0x2211('0x29')]);_0x2c3ed1[_0x2211('0x2b')]=_[_0x2211('0x2a')](_0x3dcaa5[_0x2211('0x2b')]);_0x2c3ed1[_0x2211('0x44')]=_[_0x2211('0x2e')](_0x2c3ed1[_0x2211('0x2f')],_0x2c3ed1[_0x2211('0x2b')]);_0x3f3090[_0x2211('0x30')]=_[_0x2211('0x2e')](_0x2c3ed1[_0x2211('0x2f')],qs[_0x2211('0x31')](_0x3dcaa5[_0x2211('0x2b')][_0x2211('0x31')]));_0x3f3090[_0x2211('0x30')]=_0x3f3090[_0x2211('0x30')][_0x2211('0x32')]?_0x3f3090[_0x2211('0x30')]:_0x2c3ed1['model'];_0x3f3090[_0x2211('0x36')]=qs['sort'](_0x3dcaa5['query'][_0x2211('0x37')]);_0x3f3090[_0x2211('0x38')]=qs[_0x2211('0x44')](_[_0x2211('0x39')](_0x3dcaa5['query'],_0x2c3ed1[_0x2211('0x44')]));if(_0x3dcaa5[_0x2211('0x2b')][_0x2211('0x3c')]){_0x3f3090[_0x2211('0x38')]=_[_0x2211('0x3e')](_0x3f3090[_0x2211('0x38')],{'$or':_[_0x2211('0x3d')](_0x3f3090[_0x2211('0x30')],function(_0x182a72){var _0x785189={};_0x785189[_0x182a72]={'$like':'%'+_0x3dcaa5['query'][_0x2211('0x3c')]+'%'};return _0x785189;})});}_0x3f3090=_[_0x2211('0x3e')]({},_0x3f3090,_0x3dcaa5[_0x2211('0x46')]);return _0x18f2fa['getAgents'](_0x3f3090);}})['then'](function(_0x42762d){if(_0x42762d){_0x30abfa=_0x42762d[_0x2211('0x32')];if(!_0x3dcaa5[_0x2211('0x2b')][_0x2211('0x33')](_0x2211('0x34'))){_0x3f3090[_0x2211('0x35')]=qs[_0x2211('0x35')](_0x3dcaa5[_0x2211('0x2b')][_0x2211('0x35')]);_0x3f3090[_0x2211('0x1d')]=qs['offset'](_0x3dcaa5[_0x2211('0x2b')][_0x2211('0x1d')]);}return _0x18f2fa['getAgents'](_0x3f3090);}})[_0x2211('0x22')](function(_0x37438b){if(_0x37438b){return _0x37438b?{'count':_0x30abfa,'rows':_0x37438b}:null;}})[_0x2211('0x22')](respondWithResult(_0xa3535,null))[_0x2211('0x43')](handleError(_0xa3535,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 9dbca82..a917c85 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 _0xc518=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners'];(function(_0x2ea05c,_0x5d3bec){var _0x28d6f3=function(_0x107893){while(--_0x107893){_0x2ea05c['push'](_0x2ea05c['shift']());}};_0x28d6f3(++_0x5d3bec);}(_0xc518,0x130));var _0x8c51=function(_0x582f4b,_0xb757d8){_0x582f4b=_0x582f4b-0x0;var _0x5385be=_0xc518[_0x582f4b];return _0x5385be;};'use strict';var EventEmitter=require(_0x8c51('0x0'));var Team=require(_0x8c51('0x1'))['db'][_0x8c51('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x8c51('0x3')](0x0);var events={'afterCreate':_0x8c51('0x4'),'afterUpdate':_0x8c51('0x5'),'afterDestroy':_0x8c51('0x6')};function emitEvent(_0x31d24d){return function(_0x2b9d2a,_0x138847,_0x5d1a97){TeamEvents[_0x8c51('0x7')](_0x31d24d+':'+_0x2b9d2a['id'],_0x2b9d2a);TeamEvents[_0x8c51('0x7')](_0x31d24d,_0x2b9d2a);_0x5d1a97(null);};}for(var e in events){if(events[_0x8c51('0x8')](e)){var event=events[e];Team[_0x8c51('0x9')](e,emitEvent(event));}}module[_0x8c51('0xa')]=TeamEvents; \ No newline at end of file +var _0x71a5=['hasOwnProperty','events','Team','setMaxListeners','save','remove','emit'];(function(_0x52174a,_0x25a877){var _0x7f7b39=function(_0x4f17b9){while(--_0x4f17b9){_0x52174a['push'](_0x52174a['shift']());}};_0x7f7b39(++_0x25a877);}(_0x71a5,0x182));var _0x571a=function(_0x175bb6,_0x5f36f8){_0x175bb6=_0x175bb6-0x0;var _0x4c29e9=_0x71a5[_0x175bb6];return _0x4c29e9;};'use strict';var EventEmitter=require(_0x571a('0x0'));var Team=require('../../mysqldb')['db'][_0x571a('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x571a('0x2')](0x0);var events={'afterCreate':_0x571a('0x3'),'afterUpdate':'update','afterDestroy':_0x571a('0x4')};function emitEvent(_0x1681fd){return function(_0xa2ebd5,_0x43e33c,_0x4edf60){TeamEvents[_0x571a('0x5')](_0x1681fd+':'+_0xa2ebd5['id'],_0xa2ebd5);TeamEvents['emit'](_0x1681fd,_0xa2ebd5);_0x4edf60(null);};}for(var e in events){if(events[_0x571a('0x6')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index dfe08c7..0cebcb8 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 _0x3e74=['moment','./team.attributes','define','Team','teams','lodash','../../config/logger','api'];(function(_0x1ea9a0,_0x2450f2){var _0x3418e3=function(_0x47143c){while(--_0x47143c){_0x1ea9a0['push'](_0x1ea9a0['shift']());}};_0x3418e3(++_0x2450f2);}(_0x3e74,0x175));var _0x43e7=function(_0x27fe5a,_0x6e0afa){_0x27fe5a=_0x27fe5a-0x0;var _0x2804ef=_0x3e74[_0x27fe5a];return _0x2804ef;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x43e7('0x4'));module['exports']=function(_0x128b0f,_0xe838b4){return _0x128b0f[_0x43e7('0x5')](_0x43e7('0x6'),attributes,{'tableName':_0x43e7('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['bluebird','request-promise','exports','define','Team','teams','lodash','util'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x55ca,0x126));var _0xa55c=function(_0x344128,_0x9b9e88){_0x344128=_0x344128-0x0;var _0x693fae=_0x55ca[_0x344128];return _0x693fae;};'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 attributes=require('./team.attributes');module[_0xa55c('0x4')]=function(_0x2db02a,_0xcb02e3){return _0x2db02a[_0xa55c('0x5')](_0xa55c('0x6'),attributes,{'tableName':_0xa55c('0x7'),'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 67a7249..fe9440f 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 _0x799b=['result','catch','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x5e2fc5,_0x47c442){var _0x3843cf=function(_0x1f6cda){while(--_0x1f6cda){_0x5e2fc5['push'](_0x5e2fc5['shift']());}};_0x3843cf(++_0x47c442);}(_0x799b,0x19a));var _0xb799=function(_0xd3c09f,_0x54b009){_0xd3c09f=_0xd3c09f-0x0;var _0x46e30c=_0x799b[_0xd3c09f];return _0x46e30c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb799('0x0'));var BPromise=require(_0xb799('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb799('0x2'))['db'];var utils=require(_0xb799('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xb799('0x4'));var jayson=require(_0xb799('0x5'));var client=jayson[_0xb799('0x6')][_0xb799('0x7')]({'port':0x232a});config[_0xb799('0x8')]=_[_0xb799('0x9')](config[_0xb799('0x8')],{'host':_0xb799('0xa'),'port':0x18eb});var socket=require(_0xb799('0xb'))(new Redis(config['redis']));require('./team.socket')[_0xb799('0xc')](socket);function respondWithRpcPromise(_0x287bf6,_0x5edb0c,_0x38c01f){return new BPromise(function(_0x3c387f,_0x50ce30){return client['request'](_0x287bf6,_0x38c01f)[_0xb799('0xd')](function(_0x4e1a83){logger[_0xb799('0xe')](_0xb799('0xf'),_0x5edb0c,_0xb799('0x10'));logger[_0xb799('0x11')](_0xb799('0x12'),_0x5edb0c,_0xb799('0x10'),JSON[_0xb799('0x13')](_0x4e1a83));if(_0x4e1a83[_0xb799('0x14')]){if(_0x4e1a83[_0xb799('0x14')]['code']===0x1f4){logger[_0xb799('0x14')](_0xb799('0xf'),_0x5edb0c,_0x4e1a83[_0xb799('0x14')][_0xb799('0x15')]);return _0x50ce30(_0x4e1a83[_0xb799('0x14')][_0xb799('0x15')]);}logger[_0xb799('0x14')](_0xb799('0xf'),_0x5edb0c,_0x4e1a83[_0xb799('0x14')]['message']);return _0x3c387f(_0x4e1a83[_0xb799('0x14')][_0xb799('0x15')]);}else{logger['info'](_0xb799('0xf'),_0x5edb0c,'request\x20sent');_0x3c387f(_0x4e1a83[_0xb799('0x16')][_0xb799('0x15')]);}})[_0xb799('0x17')](function(_0x43dfa0){logger['error'](_0xb799('0xf'),_0x5edb0c,_0x43dfa0);_0x50ce30(_0x43dfa0);});});} \ No newline at end of file +var _0x445b=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment'];(function(_0x8e8511,_0x58793d){var _0x4a5325=function(_0x26cdab){while(--_0x26cdab){_0x8e8511['push'](_0x8e8511['shift']());}};_0x4a5325(++_0x58793d);}(_0x445b,0x136));var _0xb445=function(_0x22345a,_0x62dd7e){_0x22345a=_0x22345a-0x0;var _0x42c4b2=_0x445b[_0x22345a];return _0x42c4b2;};'use strict';var _=require(_0xb445('0x0'));var util=require('util');var moment=require(_0xb445('0x1'));var BPromise=require('bluebird');var rs=require(_0xb445('0x2'));var fs=require('fs');var Redis=require(_0xb445('0x3'));var db=require(_0xb445('0x4'))['db'];var utils=require(_0xb445('0x5'));var logger=require(_0xb445('0x6'))(_0xb445('0x7'));var config=require(_0xb445('0x8'));var jayson=require(_0xb445('0x9'));var client=jayson['client'][_0xb445('0xa')]({'port':0x232a});config[_0xb445('0xb')]=_[_0xb445('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb445('0xd'))(new Redis(config[_0xb445('0xb')]));require(_0xb445('0xe'))[_0xb445('0xf')](socket);function respondWithRpcPromise(_0x127409,_0x294f28,_0x3f5c3c){return new BPromise(function(_0x39385b,_0x150979){return client[_0xb445('0x10')](_0x127409,_0x3f5c3c)[_0xb445('0x11')](function(_0x1681ff){logger[_0xb445('0x12')](_0xb445('0x13'),_0x294f28,_0xb445('0x14'));logger['debug'](_0xb445('0x15'),_0x294f28,'request\x20sent',JSON['stringify'](_0x1681ff));if(_0x1681ff[_0xb445('0x16')]){if(_0x1681ff[_0xb445('0x16')][_0xb445('0x17')]===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x294f28,_0x1681ff[_0xb445('0x16')][_0xb445('0x18')]);return _0x150979(_0x1681ff[_0xb445('0x16')][_0xb445('0x18')]);}logger['error']('Team,\x20%s,\x20%s',_0x294f28,_0x1681ff[_0xb445('0x16')][_0xb445('0x18')]);return _0x39385b(_0x1681ff[_0xb445('0x16')][_0xb445('0x18')]);}else{logger[_0xb445('0x12')](_0xb445('0x13'),_0x294f28,_0xb445('0x14'));_0x39385b(_0x1681ff['result'][_0xb445('0x18')]);}})[_0xb445('0x19')](function(_0x31a9d1){logger[_0xb445('0x16')](_0xb445('0x13'),_0x294f28,_0x31a9d1);_0x150979(_0x31a9d1);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 50805b4..af49bdc 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 _0x4a64=['update','emit','removeListener','length','./team.events','save','remove'];(function(_0x14fe1a,_0x18ac0f){var _0x51320b=function(_0x430170){while(--_0x430170){_0x14fe1a['push'](_0x14fe1a['shift']());}};_0x51320b(++_0x18ac0f);}(_0x4a64,0x1bd));var _0x44a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4a64[_0x3dd15e];return _0x231fd0;};'use strict';var TeamEvents=require(_0x44a6('0x0'));var events=[_0x44a6('0x1'),_0x44a6('0x2'),_0x44a6('0x3')];function createListener(_0xdaed75,_0x5b9ec7){return function(_0x2b3d3f){_0x5b9ec7[_0x44a6('0x4')](_0xdaed75,_0x2b3d3f);};}function removeListener(_0x3a5e63,_0xcab5b6){return function(){TeamEvents[_0x44a6('0x5')](_0x3a5e63,_0xcab5b6);};}exports['register']=function(_0x466137){for(var _0xf3d4d5=0x0,_0x57a194=events[_0x44a6('0x6')];_0xf3d4d5<_0x57a194;_0xf3d4d5++){var _0x382d57=events[_0xf3d4d5];var _0x475ad6=createListener('team:'+_0x382d57,_0x466137);TeamEvents['on'](_0x382d57,_0x475ad6);}}; \ No newline at end of file +var _0xe385=['update','removeListener','length','team:','./team.events','save'];(function(_0x50c114,_0x253fde){var _0xd645b4=function(_0x4ad11e){while(--_0x4ad11e){_0x50c114['push'](_0x50c114['shift']());}};_0xd645b4(++_0x253fde);}(_0xe385,0x15a));var _0x5e38=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xe385[_0x501510];return _0x1e6ee5;};'use strict';var TeamEvents=require(_0x5e38('0x0'));var events=[_0x5e38('0x1'),'remove',_0x5e38('0x2')];function createListener(_0xa0d10,_0x410531){return function(_0x5d97c1){_0x410531['emit'](_0xa0d10,_0x5d97c1);};}function removeListener(_0x5e8863,_0x153cc9){return function(){TeamEvents[_0x5e38('0x3')](_0x5e8863,_0x153cc9);};}exports['register']=function(_0x4ab475){for(var _0x1bde01=0x0,_0x490a44=events[_0x5e38('0x4')];_0x1bde01<_0x490a44;_0x1bde01++){var _0x4c85f6=events[_0x1bde01];var _0x197f93=createListener(_0x5e38('0x5')+_0x4c85f6,_0x4ab475);TeamEvents['on'](_0x4c85f6,_0x197f93);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 2f06c7a..10ea9b2 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 _0xe04d=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','put','delete','destroy','exports'];(function(_0x16640e,_0x4a60ff){var _0x44305a=function(_0x30f108){while(--_0x30f108){_0x16640e['push'](_0x16640e['shift']());}};_0x44305a(++_0x4a60ff);}(_0xe04d,0x110));var _0xde04=function(_0x27bd2c,_0x24bd98){_0x27bd2c=_0x27bd2c-0x0;var _0x3784ea=_0xe04d[_0x27bd2c];return _0x3784ea;};'use strict';var multer=require('multer');var util=require(_0xde04('0x0'));var path=require(_0xde04('0x1'));var timeout=require(_0xde04('0x2'));var express=require(_0xde04('0x3'));var router=express[_0xde04('0x4')]();var auth=require(_0xde04('0x5'));var interaction=require(_0xde04('0x6'));var config=require(_0xde04('0x7'));var controller=require('./template.controller');router['get']('/',auth[_0xde04('0x8')](),controller[_0xde04('0x9')]);router[_0xde04('0xa')](_0xde04('0xb'),auth[_0xde04('0x8')](),controller[_0xde04('0xc')]);router['post']('/',auth[_0xde04('0x8')](),controller['create']);router[_0xde04('0xd')](_0xde04('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xde04('0xe')](_0xde04('0xb'),auth['isAuthenticated'](),controller[_0xde04('0xf')]);module[_0xde04('0x10')]=router; \ No newline at end of file +var _0x0604=['put','/:id','update','delete','destroy','exports','multer','util','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','post','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0604,0x8d));var _0x4060=function(_0x3f6c40,_0x351a23){_0x3f6c40=_0x3f6c40-0x0;var _0x457819=_0x0604[_0x3f6c40];return _0x457819;};'use strict';var multer=require(_0x4060('0x0'));var util=require(_0x4060('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x4060('0x2'));var interaction=require(_0x4060('0x3'));var config=require('../../config/environment');var controller=require('./template.controller');router[_0x4060('0x4')]('/',auth[_0x4060('0x5')](),controller[_0x4060('0x6')]);router['get']('/:id',auth[_0x4060('0x5')](),controller['show']);router[_0x4060('0x7')]('/',auth[_0x4060('0x5')](),controller[_0x4060('0x8')]);router[_0x4060('0x9')](_0x4060('0xa'),auth[_0x4060('0x5')](),controller[_0x4060('0xb')]);router[_0x4060('0xc')](_0x4060('0xa'),auth[_0x4060('0x5')](),controller[_0x4060('0xd')]);module[_0x4060('0xe')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 03c6a23..ff9c528 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 _0xef10=['exports','STRING','sequelize'];(function(_0x28f47d,_0x596147){var _0x2f45f9=function(_0x400bdc){while(--_0x400bdc){_0x28f47d['push'](_0x28f47d['shift']());}};_0x2f45f9(++_0x596147);}(_0xef10,0x9e));var _0x0ef1=function(_0x1e6021,_0x121775){_0x1e6021=_0x1e6021-0x0;var _0x28456e=_0xef10[_0x1e6021];return _0x28456e;};'use strict';var Sequelize=require(_0x0ef1('0x0'));module[_0x0ef1('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0ef1('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x6c65=['TEXT','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x6c65,0xfd));var _0x56c6=function(_0x1243a5,_0x1c73f3){_0x1243a5=_0x1243a5-0x0;var _0x29f8ca=_0x6c65[_0x1243a5];return _0x29f8ca;};'use strict';var Sequelize=require('sequelize');module[_0x56c6('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x56c6('0x1')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index b8142ce..74e868a 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 _0xa786=['where','map','filter','options','count','then','includeAll','include','Template','findAll','rows','catch','show','find','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','set','Content-Range','apply','save','update','destroy','error','stack','name','index','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','pick','add','day','merge'];(function(_0x33c637,_0x597c26){var _0x14aa20=function(_0x32a8b5){while(--_0x32a8b5){_0x33c637['push'](_0x33c637['shift']());}};_0x14aa20(++_0x597c26);}(_0xa786,0x1d2));var _0x6a78=function(_0x98d06a,_0x8a6f5e){_0x98d06a=_0x98d06a-0x0;var _0x4a3a9e=_0xa786[_0x98d06a];return _0x4a3a9e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6a78('0x0'));var zipdir=require(_0x6a78('0x1'));var jsonpatch=require(_0x6a78('0x2'));var rp=require(_0x6a78('0x3'));var moment=require(_0x6a78('0x4'));var BPromise=require(_0x6a78('0x5'));var Mustache=require(_0x6a78('0x6'));var util=require('util');var path=require(_0x6a78('0x7'));var sox=require(_0x6a78('0x8'));var csv=require(_0x6a78('0x9'));var ejs=require(_0x6a78('0xa'));var fs=require('fs');var _=require(_0x6a78('0xb'));var squel=require(_0x6a78('0xc'));var crypto=require(_0x6a78('0xd'));var jsforce=require(_0x6a78('0xe'));var deskjs=require(_0x6a78('0xf'));var toCsv=require(_0x6a78('0x9'));var querystring=require(_0x6a78('0x10'));var Papa=require(_0x6a78('0x11'));var Redis=require(_0x6a78('0x12'));var qs=require(_0x6a78('0x13'));var logger=require(_0x6a78('0x14'))(_0x6a78('0x15'));var utils=require(_0x6a78('0x16'));var config=require(_0x6a78('0x17'));var db=require(_0x6a78('0x18'))['db'];function respondWithStatusCode(_0x595e3e,_0x54efda){_0x54efda=_0x54efda||0xcc;return function(_0x1aca08){if(_0x1aca08){return _0x595e3e[_0x6a78('0x19')](_0x54efda);}return _0x595e3e['status'](_0x54efda)[_0x6a78('0x1a')]();};}function respondWithResult(_0x35b334,_0xc2bc6a){_0xc2bc6a=_0xc2bc6a||0xc8;return function(_0xf14d6){if(_0xf14d6){return _0x35b334[_0x6a78('0x1b')](_0xc2bc6a)[_0x6a78('0x1c')](_0xf14d6);}};}function respondWithFilteredResult(_0x9df26e,_0x5ac964){return function(_0x56f140){if(_0x56f140){var _0x565f16=_0x56f140['count'],_0x36114f=_0x5ac964[_0x6a78('0x1d')],_0x2deaa9=_0x5ac964[_0x6a78('0x1d')]+_0x5ac964['limit'],_0xe2cf95;if(_0x2deaa9>=_0x565f16){_0x2deaa9=_0x565f16;_0xe2cf95=0xc8;}else{_0xe2cf95=0xce;}_0x9df26e[_0x6a78('0x1b')](_0xe2cf95);return _0x9df26e[_0x6a78('0x1e')](_0x6a78('0x1f'),_0x36114f+'-'+_0x2deaa9+'/'+_0x565f16)[_0x6a78('0x1c')](_0x56f140);}return null;};}function patchUpdates(_0x3f24ac){return function(_0xe0e5e6){try{jsonpatch[_0x6a78('0x20')](_0xe0e5e6,_0x3f24ac,!![]);}catch(_0x3c3e5d){return BPromise['reject'](_0x3c3e5d);}return _0xe0e5e6[_0x6a78('0x21')]();};}function saveUpdates(_0x5292eb,_0x216365){return function(_0xee82ac){if(_0xee82ac){return _0xee82ac[_0x6a78('0x22')](_0x5292eb)['then'](function(_0x3e0dfc){return _0x3e0dfc;});}return null;};}function removeEntity(_0x4ca779,_0x184637){return function(_0x5514e3){if(_0x5514e3){return _0x5514e3[_0x6a78('0x23')]()['then'](function(){_0x4ca779[_0x6a78('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bcc06,_0x5812ee){return function(_0x3b7bea){if(!_0x3b7bea){_0x4bcc06[_0x6a78('0x19')](0x194);}return _0x3b7bea;};}function handleError(_0x677af6,_0x590657){_0x590657=_0x590657||0x1f4;return function(_0x2746e4){logger[_0x6a78('0x24')](_0x2746e4[_0x6a78('0x25')]);if(_0x2746e4[_0x6a78('0x26')]){delete _0x2746e4['name'];}_0x677af6[_0x6a78('0x1b')](_0x590657)['send'](_0x2746e4);};}exports[_0x6a78('0x27')]=function(_0x14a3c6,_0x8e8513){var _0x20db54={},_0x501363={},_0x3eb79f={'count':0x0,'rows':[]};var _0x2c1893=db['Template'][_0x6a78('0x28')];_0x501363['model']=_[_0x6a78('0x29')](_0x2c1893);var _0x48c692={'dateStart':_0x14a3c6[_0x6a78('0x2a')][_0x6a78('0x2b')],'dateEnd':_0x14a3c6['query'][_0x6a78('0x2c')]};delete _0x14a3c6[_0x6a78('0x2a')]['dateStart'];delete _0x14a3c6[_0x6a78('0x2a')][_0x6a78('0x2c')];_0x501363['query']=_[_0x6a78('0x29')](_0x14a3c6[_0x6a78('0x2a')]);_0x501363[_0x6a78('0x2d')]=_[_0x6a78('0x2e')](_0x501363[_0x6a78('0x2f')],_0x501363[_0x6a78('0x2a')]);_0x20db54[_0x6a78('0x30')]=_['intersection'](_0x501363[_0x6a78('0x2f')],qs[_0x6a78('0x31')](_0x14a3c6['query'][_0x6a78('0x31')]));_0x20db54['attributes']=_0x20db54[_0x6a78('0x30')][_0x6a78('0x32')]?_0x20db54['attributes']:_0x501363[_0x6a78('0x2f')];if(!_0x14a3c6[_0x6a78('0x2a')]['hasOwnProperty'](_0x6a78('0x33'))){_0x20db54['limit']=qs[_0x6a78('0x34')](_0x14a3c6[_0x6a78('0x2a')]['limit']);_0x20db54['offset']=qs[_0x6a78('0x1d')](_0x14a3c6[_0x6a78('0x2a')][_0x6a78('0x1d')]);}_0x20db54[_0x6a78('0x35')]=qs['sort'](_0x14a3c6['query'][_0x6a78('0x36')]);_0x20db54['where']=qs[_0x6a78('0x2d')](_[_0x6a78('0x37')](_0x14a3c6['query'],_0x501363[_0x6a78('0x2d')]));if(_0x48c692['dateStart']){if(_0x48c692[_0x6a78('0x2c')]){_0x48c692[_0x6a78('0x2c')]=moment(_0x48c692['dateEnd'])[_0x6a78('0x38')](0x1,'day');}else{_0x48c692[_0x6a78('0x2c')]=moment(_0x48c692[_0x6a78('0x2b')])[_0x6a78('0x38')](0x1,_0x6a78('0x39'));}_[_0x6a78('0x3a')](_0x20db54[_0x6a78('0x3b')],{'createdAt':{'$gte':_0x48c692[_0x6a78('0x2b')],'$lte':_0x48c692[_0x6a78('0x2c')]}});}if(_0x14a3c6[_0x6a78('0x2a')]['filter']){_0x20db54[_0x6a78('0x3b')]=_[_0x6a78('0x3a')](_0x20db54[_0x6a78('0x3b')],{'$or':_[_0x6a78('0x3c')](_0x20db54[_0x6a78('0x30')],function(_0x17266c){var _0x403a67={};_0x403a67[_0x17266c]={'$like':'%'+_0x14a3c6[_0x6a78('0x2a')][_0x6a78('0x3d')]+'%'};return _0x403a67;})});}_0x20db54=_[_0x6a78('0x3a')]({},_0x20db54,_0x14a3c6[_0x6a78('0x3e')]);var _0x4d3ad7={'where':_0x20db54[_0x6a78('0x3b')]};return db['Template'][_0x6a78('0x3f')](_0x4d3ad7)[_0x6a78('0x40')](function(_0x3b9db8){_0x3eb79f['count']=_0x3b9db8;if(_0x14a3c6[_0x6a78('0x2a')][_0x6a78('0x41')]){_0x20db54[_0x6a78('0x42')]=[{'all':!![]}];}return db[_0x6a78('0x43')][_0x6a78('0x44')](_0x20db54);})[_0x6a78('0x40')](function(_0x1e6efd){_0x3eb79f[_0x6a78('0x45')]=_0x1e6efd;return _0x3eb79f;})[_0x6a78('0x40')](respondWithFilteredResult(_0x8e8513,_0x20db54))[_0x6a78('0x46')](handleError(_0x8e8513,null));};exports[_0x6a78('0x47')]=function(_0x4440c5,_0xd9d351){var _0x2e89ce={'raw':!![],'where':{'id':_0x4440c5['params']['id']}},_0x2fdfd0={};_0x2fdfd0[_0x6a78('0x2f')]=_[_0x6a78('0x29')](db[_0x6a78('0x43')][_0x6a78('0x28')]);_0x2fdfd0[_0x6a78('0x2a')]=_[_0x6a78('0x29')](_0x4440c5[_0x6a78('0x2a')]);_0x2fdfd0[_0x6a78('0x2d')]=_[_0x6a78('0x2e')](_0x2fdfd0['model'],_0x2fdfd0[_0x6a78('0x2a')]);_0x2e89ce[_0x6a78('0x30')]=_['intersection'](_0x2fdfd0[_0x6a78('0x2f')],qs[_0x6a78('0x31')](_0x4440c5[_0x6a78('0x2a')][_0x6a78('0x31')]));_0x2e89ce[_0x6a78('0x30')]=_0x2e89ce['attributes'][_0x6a78('0x32')]?_0x2e89ce['attributes']:_0x2fdfd0[_0x6a78('0x2f')];if(_0x4440c5[_0x6a78('0x2a')][_0x6a78('0x41')]){_0x2e89ce[_0x6a78('0x42')]=[{'all':!![]}];}_0x2e89ce=_[_0x6a78('0x3a')]({},_0x2e89ce,_0x4440c5[_0x6a78('0x3e')]);return db[_0x6a78('0x43')][_0x6a78('0x48')](_0x2e89ce)[_0x6a78('0x40')](handleEntityNotFound(_0xd9d351,null))[_0x6a78('0x40')](respondWithResult(_0xd9d351,null))[_0x6a78('0x46')](handleError(_0xd9d351,null));};exports['create']=function(_0x46669f,_0xa4f975){return db[_0x6a78('0x43')]['create'](_0x46669f[_0x6a78('0x49')],{})[_0x6a78('0x40')](respondWithResult(_0xa4f975,0xc9))[_0x6a78('0x46')](handleError(_0xa4f975,null));};exports[_0x6a78('0x22')]=function(_0x33b413,_0x36bea3){if(_0x33b413['body']['id']){delete _0x33b413['body']['id'];}return db['Template'][_0x6a78('0x48')]({'where':{'id':_0x33b413[_0x6a78('0x4a')]['id']}})[_0x6a78('0x40')](handleEntityNotFound(_0x36bea3,null))[_0x6a78('0x40')](saveUpdates(_0x33b413[_0x6a78('0x49')],null))[_0x6a78('0x40')](respondWithResult(_0x36bea3,null))[_0x6a78('0x46')](handleError(_0x36bea3,null));};exports[_0x6a78('0x23')]=function(_0x1d950a,_0x14d441){return db[_0x6a78('0x43')][_0x6a78('0x48')]({'where':{'id':_0x1d950a[_0x6a78('0x4a')]['id']}})[_0x6a78('0x40')](handleEntityNotFound(_0x14d441,null))[_0x6a78('0x40')](removeEntity(_0x14d441,null))[_0x6a78('0x46')](handleError(_0x14d441,null));}; \ No newline at end of file +var _0x0e76=['squel','crypto','desk.js','querystring','ioredis','../../config/logger','api','../../config/environment','status','end','count','limit','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','send','index','Template','model','keys','query','dateStart','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','dateEnd','day','add','merge','filter','map','options','includeAll','findAll','catch','show','params','rawAttributes','include','find','create','body','destroy','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash'];(function(_0xd534bf,_0x4356f7){var _0x14722f=function(_0x459397){while(--_0x459397){_0xd534bf['push'](_0xd534bf['shift']());}};_0x14722f(++_0x4356f7);}(_0x0e76,0xc4));var _0x60e7=function(_0x10b7de,_0x51cf9d){_0x10b7de=_0x10b7de-0x0;var _0xd51c81=_0x0e76[_0x10b7de];return _0xd51c81;};'use strict';var pdf=require(_0x60e7('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x60e7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x60e7('0x2'));var moment=require(_0x60e7('0x3'));var BPromise=require(_0x60e7('0x4'));var Mustache=require(_0x60e7('0x5'));var util=require(_0x60e7('0x6'));var path=require('path');var sox=require(_0x60e7('0x7'));var csv=require(_0x60e7('0x8'));var ejs=require(_0x60e7('0x9'));var fs=require('fs');var _=require(_0x60e7('0xa'));var squel=require(_0x60e7('0xb'));var crypto=require(_0x60e7('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x60e7('0xd'));var toCsv=require(_0x60e7('0x8'));var querystring=require(_0x60e7('0xe'));var Papa=require('papaparse');var Redis=require(_0x60e7('0xf'));var qs=require('../../components/parsers/qs');var logger=require(_0x60e7('0x10'))(_0x60e7('0x11'));var utils=require('../../config/utils');var config=require(_0x60e7('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x304841,_0x423f83){_0x423f83=_0x423f83||0xcc;return function(_0x520a5e){if(_0x520a5e){return _0x304841['sendStatus'](_0x423f83);}return _0x304841[_0x60e7('0x13')](_0x423f83)[_0x60e7('0x14')]();};}function respondWithResult(_0x243280,_0x301c5d){_0x301c5d=_0x301c5d||0xc8;return function(_0x505f70){if(_0x505f70){return _0x243280[_0x60e7('0x13')](_0x301c5d)['json'](_0x505f70);}};}function respondWithFilteredResult(_0x1d4c68,_0x1d97a5){return function(_0x490c0f){if(_0x490c0f){var _0x3007ad=_0x490c0f[_0x60e7('0x15')],_0x589b22=_0x1d97a5['offset'],_0x25bcd9=_0x1d97a5['offset']+_0x1d97a5[_0x60e7('0x16')],_0x388cd8;if(_0x25bcd9>=_0x3007ad){_0x25bcd9=_0x3007ad;_0x388cd8=0xc8;}else{_0x388cd8=0xce;}_0x1d4c68['status'](_0x388cd8);return _0x1d4c68[_0x60e7('0x17')](_0x60e7('0x18'),_0x589b22+'-'+_0x25bcd9+'/'+_0x3007ad)[_0x60e7('0x19')](_0x490c0f);}return null;};}function patchUpdates(_0x29625d){return function(_0x54a701){try{jsonpatch[_0x60e7('0x1a')](_0x54a701,_0x29625d,!![]);}catch(_0x4fd306){return BPromise[_0x60e7('0x1b')](_0x4fd306);}return _0x54a701[_0x60e7('0x1c')]();};}function saveUpdates(_0x323074,_0xeaaafc){return function(_0x200ac7){if(_0x200ac7){return _0x200ac7[_0x60e7('0x1d')](_0x323074)[_0x60e7('0x1e')](function(_0x878467){return _0x878467;});}return null;};}function removeEntity(_0x50e33a,_0x3dfbce){return function(_0x59c4b2){if(_0x59c4b2){return _0x59c4b2['destroy']()[_0x60e7('0x1e')](function(){_0x50e33a['status'](0xcc)[_0x60e7('0x14')]();});}};}function handleEntityNotFound(_0x352564,_0x397ca1){return function(_0x334bd9){if(!_0x334bd9){_0x352564[_0x60e7('0x1f')](0x194);}return _0x334bd9;};}function handleError(_0x4258a2,_0x54e17b){_0x54e17b=_0x54e17b||0x1f4;return function(_0x2902fa){logger[_0x60e7('0x20')](_0x2902fa[_0x60e7('0x21')]);if(_0x2902fa['name']){delete _0x2902fa['name'];}_0x4258a2[_0x60e7('0x13')](_0x54e17b)[_0x60e7('0x22')](_0x2902fa);};}exports[_0x60e7('0x23')]=function(_0xda9aa1,_0x598fb2){var _0x3c8084={},_0xa4945e={},_0x39a0a9={'count':0x0,'rows':[]};var _0x25bcb7=db[_0x60e7('0x24')]['rawAttributes'];_0xa4945e[_0x60e7('0x25')]=_[_0x60e7('0x26')](_0x25bcb7);var _0x24896b={'dateStart':_0xda9aa1[_0x60e7('0x27')][_0x60e7('0x28')],'dateEnd':_0xda9aa1[_0x60e7('0x27')]['dateEnd']};delete _0xda9aa1[_0x60e7('0x27')]['dateStart'];delete _0xda9aa1[_0x60e7('0x27')]['dateEnd'];_0xa4945e[_0x60e7('0x27')]=_[_0x60e7('0x26')](_0xda9aa1[_0x60e7('0x27')]);_0xa4945e[_0x60e7('0x29')]=_[_0x60e7('0x2a')](_0xa4945e[_0x60e7('0x25')],_0xa4945e[_0x60e7('0x27')]);_0x3c8084['attributes']=_[_0x60e7('0x2a')](_0xa4945e['model'],qs[_0x60e7('0x2b')](_0xda9aa1[_0x60e7('0x27')][_0x60e7('0x2b')]));_0x3c8084[_0x60e7('0x2c')]=_0x3c8084[_0x60e7('0x2c')][_0x60e7('0x2d')]?_0x3c8084[_0x60e7('0x2c')]:_0xa4945e[_0x60e7('0x25')];if(!_0xda9aa1['query'][_0x60e7('0x2e')]('nolimit')){_0x3c8084[_0x60e7('0x16')]=qs['limit'](_0xda9aa1['query']['limit']);_0x3c8084['offset']=qs['offset'](_0xda9aa1['query']['offset']);}_0x3c8084[_0x60e7('0x2f')]=qs['sort'](_0xda9aa1[_0x60e7('0x27')][_0x60e7('0x30')]);_0x3c8084[_0x60e7('0x31')]=qs[_0x60e7('0x29')](_[_0x60e7('0x32')](_0xda9aa1[_0x60e7('0x27')],_0xa4945e[_0x60e7('0x29')]));if(_0x24896b[_0x60e7('0x28')]){if(_0x24896b[_0x60e7('0x33')]){_0x24896b['dateEnd']=moment(_0x24896b[_0x60e7('0x33')])['add'](0x1,_0x60e7('0x34'));}else{_0x24896b[_0x60e7('0x33')]=moment(_0x24896b[_0x60e7('0x28')])[_0x60e7('0x35')](0x1,'day');}_[_0x60e7('0x36')](_0x3c8084[_0x60e7('0x31')],{'createdAt':{'$gte':_0x24896b[_0x60e7('0x28')],'$lte':_0x24896b[_0x60e7('0x33')]}});}if(_0xda9aa1[_0x60e7('0x27')][_0x60e7('0x37')]){_0x3c8084['where']=_[_0x60e7('0x36')](_0x3c8084[_0x60e7('0x31')],{'$or':_[_0x60e7('0x38')](_0x3c8084[_0x60e7('0x2c')],function(_0x395866){var _0x388187={};_0x388187[_0x395866]={'$like':'%'+_0xda9aa1[_0x60e7('0x27')][_0x60e7('0x37')]+'%'};return _0x388187;})});}_0x3c8084=_[_0x60e7('0x36')]({},_0x3c8084,_0xda9aa1[_0x60e7('0x39')]);var _0x2b949f={'where':_0x3c8084[_0x60e7('0x31')]};return db[_0x60e7('0x24')][_0x60e7('0x15')](_0x2b949f)[_0x60e7('0x1e')](function(_0x55c694){_0x39a0a9['count']=_0x55c694;if(_0xda9aa1[_0x60e7('0x27')][_0x60e7('0x3a')]){_0x3c8084['include']=[{'all':!![]}];}return db[_0x60e7('0x24')][_0x60e7('0x3b')](_0x3c8084);})[_0x60e7('0x1e')](function(_0x2ec96e){_0x39a0a9['rows']=_0x2ec96e;return _0x39a0a9;})[_0x60e7('0x1e')](respondWithFilteredResult(_0x598fb2,_0x3c8084))[_0x60e7('0x3c')](handleError(_0x598fb2,null));};exports[_0x60e7('0x3d')]=function(_0x2589a6,_0x5946ee){var _0x3e10bd={'raw':!![],'where':{'id':_0x2589a6[_0x60e7('0x3e')]['id']}},_0x2a43a8={};_0x2a43a8[_0x60e7('0x25')]=_[_0x60e7('0x26')](db[_0x60e7('0x24')][_0x60e7('0x3f')]);_0x2a43a8[_0x60e7('0x27')]=_['keys'](_0x2589a6[_0x60e7('0x27')]);_0x2a43a8[_0x60e7('0x29')]=_[_0x60e7('0x2a')](_0x2a43a8['model'],_0x2a43a8[_0x60e7('0x27')]);_0x3e10bd[_0x60e7('0x2c')]=_['intersection'](_0x2a43a8[_0x60e7('0x25')],qs['fields'](_0x2589a6[_0x60e7('0x27')]['fields']));_0x3e10bd[_0x60e7('0x2c')]=_0x3e10bd['attributes'][_0x60e7('0x2d')]?_0x3e10bd[_0x60e7('0x2c')]:_0x2a43a8[_0x60e7('0x25')];if(_0x2589a6[_0x60e7('0x27')][_0x60e7('0x3a')]){_0x3e10bd[_0x60e7('0x40')]=[{'all':!![]}];}_0x3e10bd=_[_0x60e7('0x36')]({},_0x3e10bd,_0x2589a6[_0x60e7('0x39')]);return db['Template'][_0x60e7('0x41')](_0x3e10bd)[_0x60e7('0x1e')](handleEntityNotFound(_0x5946ee,null))['then'](respondWithResult(_0x5946ee,null))['catch'](handleError(_0x5946ee,null));};exports[_0x60e7('0x42')]=function(_0x5e7133,_0x4107d4){return db['Template']['create'](_0x5e7133['body'],{})[_0x60e7('0x1e')](respondWithResult(_0x4107d4,0xc9))[_0x60e7('0x3c')](handleError(_0x4107d4,null));};exports['update']=function(_0x5bceb9,_0x59bf14){if(_0x5bceb9[_0x60e7('0x43')]['id']){delete _0x5bceb9[_0x60e7('0x43')]['id'];}return db[_0x60e7('0x24')][_0x60e7('0x41')]({'where':{'id':_0x5bceb9[_0x60e7('0x3e')]['id']}})[_0x60e7('0x1e')](handleEntityNotFound(_0x59bf14,null))[_0x60e7('0x1e')](saveUpdates(_0x5bceb9[_0x60e7('0x43')],null))['then'](respondWithResult(_0x59bf14,null))['catch'](handleError(_0x59bf14,null));};exports[_0x60e7('0x44')]=function(_0x48a85b,_0x36a5ef){return db[_0x60e7('0x24')][_0x60e7('0x41')]({'where':{'id':_0x48a85b[_0x60e7('0x3e')]['id']}})['then'](handleEntityNotFound(_0x36a5ef,null))['then'](removeEntity(_0x36a5ef,null))['catch'](handleError(_0x36a5ef,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 88e84ec..a29aa90 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 _0x9ff6=['./template.attributes','define','Template','tools_templates','lodash','util','api','moment','bluebird','request-promise'];(function(_0x4b95e9,_0x408999){var _0x108048=function(_0x206942){while(--_0x206942){_0x4b95e9['push'](_0x4b95e9['shift']());}};_0x108048(++_0x408999);}(_0x9ff6,0x86));var _0x69ff=function(_0x222077,_0x180f7c){_0x222077=_0x222077-0x0;var _0x59bf61=_0x9ff6[_0x222077];return _0x59bf61;};'use strict';var _=require(_0x69ff('0x0'));var util=require(_0x69ff('0x1'));var logger=require('../../config/logger')(_0x69ff('0x2'));var moment=require(_0x69ff('0x3'));var BPromise=require(_0x69ff('0x4'));var rp=require(_0x69ff('0x5'));var attributes=require(_0x69ff('0x6'));module['exports']=function(_0x2fe2b1,_0xc34938){return _0x2fe2b1[_0x69ff('0x7')](_0x69ff('0x8'),attributes,{'tableName':_0x69ff('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7469=['exports','define','Template','tools_templates','lodash','util','../../config/logger','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7469,0x154));var _0x9746=function(_0x23ae42,_0x716888){_0x23ae42=_0x23ae42-0x0;var _0x3a061b=_0x7469[_0x23ae42];return _0x3a061b;};'use strict';var _=require(_0x9746('0x0'));var util=require(_0x9746('0x1'));var logger=require(_0x9746('0x2'))('api');var moment=require(_0x9746('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./template.attributes');module[_0x9746('0x4')]=function(_0x3f4b6a,_0x56d247){return _0x3f4b6a[_0x9746('0x5')](_0x9746('0x6'),attributes,{'tableName':_0x9746('0x7'),'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 2b90624..c8a3eca 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 _0x3de4=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','Template,\x20%s,\x20%s','GetTemplate','findAll','options','raw','where','attributes','limit','include','map','model','debug','catch','lodash','moment','bluebird'];(function(_0x27dbb7,_0x2be24b){var _0x5f0212=function(_0x185ef9){while(--_0x185ef9){_0x27dbb7['push'](_0x27dbb7['shift']());}};_0x5f0212(++_0x2be24b);}(_0x3de4,0x1b0));var _0x43de=function(_0x345f5e,_0x1d08fd){_0x345f5e=_0x345f5e-0x0;var _0x3365e8=_0x3de4[_0x345f5e];return _0x3365e8;};'use strict';var _=require(_0x43de('0x0'));var util=require('util');var moment=require(_0x43de('0x1'));var BPromise=require(_0x43de('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x43de('0x3'))['db'];var utils=require(_0x43de('0x4'));var logger=require(_0x43de('0x5'))(_0x43de('0x6'));var config=require(_0x43de('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x43de('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1aa8c6,_0x37f1e0,_0x735f92){return new BPromise(function(_0x3dfdca,_0x254ab6){return client[_0x43de('0x9')](_0x1aa8c6,_0x735f92)['then'](function(_0x3c70c2){logger[_0x43de('0xa')]('Template,\x20%s,\x20%s',_0x37f1e0,_0x43de('0xb'));logger['debug'](_0x43de('0xc'),_0x37f1e0,_0x43de('0xb'),JSON[_0x43de('0xd')](_0x3c70c2));if(_0x3c70c2[_0x43de('0xe')]){if(_0x3c70c2['error']['code']===0x1f4){logger[_0x43de('0xe')]('Template,\x20%s,\x20%s',_0x37f1e0,_0x3c70c2[_0x43de('0xe')][_0x43de('0xf')]);return _0x254ab6(_0x3c70c2[_0x43de('0xe')][_0x43de('0xf')]);}logger['error'](_0x43de('0x10'),_0x37f1e0,_0x3c70c2[_0x43de('0xe')][_0x43de('0xf')]);return _0x3dfdca(_0x3c70c2[_0x43de('0xe')][_0x43de('0xf')]);}else{logger[_0x43de('0xa')](_0x43de('0x10'),_0x37f1e0,_0x43de('0xb'));_0x3dfdca(_0x3c70c2['result'][_0x43de('0xf')]);}})['catch'](function(_0x5c5429){logger[_0x43de('0xe')](_0x43de('0x10'),_0x37f1e0,_0x5c5429);_0x254ab6(_0x5c5429);});});}exports[_0x43de('0x11')]=function(_0x205365){var _0x12f664=this;return new Promise(function(_0x77e26e,_0x2575c0){return db['Template'][_0x43de('0x12')]({'raw':_0x205365[_0x43de('0x13')]?_0x205365[_0x43de('0x13')][_0x43de('0x14')]===undefined?!![]:![]:!![],'where':_0x205365[_0x43de('0x13')]?_0x205365[_0x43de('0x13')][_0x43de('0x15')]||null:null,'attributes':_0x205365['options']?_0x205365[_0x43de('0x13')][_0x43de('0x16')]||null:null,'limit':_0x205365[_0x43de('0x13')]?_0x205365[_0x43de('0x13')][_0x43de('0x17')]||null:null,'include':_0x205365['options']?_0x205365[_0x43de('0x13')][_0x43de('0x18')]?_[_0x43de('0x19')](_0x205365['options'][_0x43de('0x18')],function(_0x27c1dd){return{'model':db[_0x27c1dd[_0x43de('0x1a')]],'as':_0x27c1dd['as'],'attributes':_0x27c1dd[_0x43de('0x16')],'include':_0x27c1dd['include']?_[_0x43de('0x19')](_0x27c1dd['include'],function(_0x1b9490){return{'model':db[_0x1b9490['model']],'as':_0x1b9490['as'],'attributes':_0x1b9490[_0x43de('0x16')],'include':_0x1b9490[_0x43de('0x18')]?_[_0x43de('0x19')](_0x1b9490[_0x43de('0x18')],function(_0x5f047c){return{'model':db[_0x5f047c['model']],'as':_0x5f047c['as'],'attributes':_0x5f047c[_0x43de('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1af10b){logger['info'](_0x43de('0x11'),_0x205365);logger[_0x43de('0x1b')](_0x43de('0x11'),_0x205365,JSON['stringify'](_0x1af10b));_0x77e26e(_0x1af10b);})[_0x43de('0x1c')](function(_0x1a3e6f){logger[_0x43de('0xe')](_0x43de('0x11'),_0x1a3e6f[_0x43de('0xf')],_0x205365);_0x2575c0(_0x12f664[_0x43de('0xe')](0x1f4,_0x1a3e6f[_0x43de('0xf')]));});});}; \ No newline at end of file +var _0x3df3=['where','attributes','include','map','model','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','GetTemplate','Template','findAll','options','raw'];(function(_0x5dff0c,_0x2bdeb4){var _0x15615f=function(_0x22956e){while(--_0x22956e){_0x5dff0c['push'](_0x5dff0c['shift']());}};_0x15615f(++_0x2bdeb4);}(_0x3df3,0x1d7));var _0x33df=function(_0x79cd47,_0x16102d){_0x79cd47=_0x79cd47-0x0;var _0x3b9484=_0x3df3[_0x79cd47];return _0x3b9484;};'use strict';var _=require(_0x33df('0x0'));var util=require('util');var moment=require(_0x33df('0x1'));var BPromise=require(_0x33df('0x2'));var rs=require(_0x33df('0x3'));var fs=require('fs');var Redis=require(_0x33df('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x33df('0x5'));var logger=require(_0x33df('0x6'))(_0x33df('0x7'));var config=require(_0x33df('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x33df('0x9')][_0x33df('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8bb76b,_0x123b83,_0x51cc47){return new BPromise(function(_0x7aeeff,_0x103450){return client[_0x33df('0xb')](_0x8bb76b,_0x51cc47)['then'](function(_0x36b0d7){logger[_0x33df('0xc')](_0x33df('0xd'),_0x123b83,_0x33df('0xe'));logger[_0x33df('0xf')](_0x33df('0x10'),_0x123b83,_0x33df('0xe'),JSON[_0x33df('0x11')](_0x36b0d7));if(_0x36b0d7['error']){if(_0x36b0d7[_0x33df('0x12')]['code']===0x1f4){logger[_0x33df('0x12')](_0x33df('0xd'),_0x123b83,_0x36b0d7['error'][_0x33df('0x13')]);return _0x103450(_0x36b0d7['error'][_0x33df('0x13')]);}logger['error'](_0x33df('0xd'),_0x123b83,_0x36b0d7['error'][_0x33df('0x13')]);return _0x7aeeff(_0x36b0d7[_0x33df('0x12')][_0x33df('0x13')]);}else{logger[_0x33df('0xc')](_0x33df('0xd'),_0x123b83,_0x33df('0xe'));_0x7aeeff(_0x36b0d7['result']['message']);}})['catch'](function(_0x228cf8){logger['error'](_0x33df('0xd'),_0x123b83,_0x228cf8);_0x103450(_0x228cf8);});});}exports[_0x33df('0x14')]=function(_0x3397f9){var _0x48b6ce=this;return new Promise(function(_0x568cea,_0x5ce601){return db[_0x33df('0x15')][_0x33df('0x16')]({'raw':_0x3397f9['options']?_0x3397f9[_0x33df('0x17')][_0x33df('0x18')]===undefined?!![]:![]:!![],'where':_0x3397f9[_0x33df('0x17')]?_0x3397f9[_0x33df('0x17')][_0x33df('0x19')]||null:null,'attributes':_0x3397f9['options']?_0x3397f9[_0x33df('0x17')][_0x33df('0x1a')]||null:null,'limit':_0x3397f9[_0x33df('0x17')]?_0x3397f9[_0x33df('0x17')]['limit']||null:null,'include':_0x3397f9[_0x33df('0x17')]?_0x3397f9[_0x33df('0x17')][_0x33df('0x1b')]?_['map'](_0x3397f9[_0x33df('0x17')][_0x33df('0x1b')],function(_0x2b98ca){return{'model':db[_0x2b98ca['model']],'as':_0x2b98ca['as'],'attributes':_0x2b98ca[_0x33df('0x1a')],'include':_0x2b98ca[_0x33df('0x1b')]?_[_0x33df('0x1c')](_0x2b98ca[_0x33df('0x1b')],function(_0x55cb2c){return{'model':db[_0x55cb2c[_0x33df('0x1d')]],'as':_0x55cb2c['as'],'attributes':_0x55cb2c[_0x33df('0x1a')],'include':_0x55cb2c[_0x33df('0x1b')]?_[_0x33df('0x1c')](_0x55cb2c[_0x33df('0x1b')],function(_0x389f65){return{'model':db[_0x389f65[_0x33df('0x1d')]],'as':_0x389f65['as'],'attributes':_0x389f65[_0x33df('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x414fb7){logger[_0x33df('0xc')](_0x33df('0x14'),_0x3397f9);logger[_0x33df('0xf')](_0x33df('0x14'),_0x3397f9,JSON[_0x33df('0x11')](_0x414fb7));_0x568cea(_0x414fb7);})[_0x33df('0x1e')](function(_0x2c8314){logger[_0x33df('0x12')]('GetTemplate',_0x2c8314[_0x33df('0x13')],_0x3397f9);_0x5ce601(_0x48b6ce['error'](0x1f4,_0x2c8314[_0x33df('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 4608b71..75a1f6e 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 _0xc9af=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','index','/:id','isAuthenticated','show','/:id/all_conditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAnyCondition','addAction','update','delete'];(function(_0x4599cd,_0x2b1670){var _0x328fc2=function(_0x1d43d2){while(--_0x1d43d2){_0x4599cd['push'](_0x4599cd['shift']());}};_0x328fc2(++_0x2b1670);}(_0xc9af,0x1cd));var _0xfc9a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc9af[_0x46698a];return _0x356db0;};'use strict';var multer=require(_0xfc9a('0x0'));var util=require(_0xfc9a('0x1'));var path=require(_0xfc9a('0x2'));var timeout=require('connect-timeout');var express=require(_0xfc9a('0x3'));var router=express[_0xfc9a('0x4')]();var auth=require(_0xfc9a('0x5'));var interaction=require(_0xfc9a('0x6'));var config=require(_0xfc9a('0x7'));var controller=require(_0xfc9a('0x8'));router[_0xfc9a('0x9')]('/',auth['isAuthenticated'](),controller[_0xfc9a('0xa')]);router[_0xfc9a('0x9')](_0xfc9a('0xb'),auth[_0xfc9a('0xc')](),controller[_0xfc9a('0xd')]);router['get'](_0xfc9a('0xe'),auth[_0xfc9a('0xc')](),controller['getAllConditions']);router[_0xfc9a('0x9')](_0xfc9a('0xf'),auth[_0xfc9a('0xc')](),controller[_0xfc9a('0x10')]);router[_0xfc9a('0x9')](_0xfc9a('0x11'),auth[_0xfc9a('0xc')](),controller[_0xfc9a('0x12')]);router[_0xfc9a('0x13')]('/',auth['isAuthenticated'](),controller[_0xfc9a('0x14')]);router['post'](_0xfc9a('0xe'),auth['isAuthenticated'](),controller['addAllCondition']);router['post'](_0xfc9a('0xf'),auth[_0xfc9a('0xc')](),controller[_0xfc9a('0x15')]);router[_0xfc9a('0x13')](_0xfc9a('0x11'),auth['isAuthenticated'](),controller[_0xfc9a('0x16')]);router['put'](_0xfc9a('0xb'),auth['isAuthenticated'](),controller[_0xfc9a('0x17')]);router[_0xfc9a('0x18')]('/:id',auth[_0xfc9a('0xc')](),controller[_0xfc9a('0x19')]);module[_0xfc9a('0x1a')]=router; \ No newline at end of file +var _0x7b81=['/:id','isAuthenticated','show','/:id/all_conditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','addAction','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','index','get'];(function(_0x412818,_0xe8171a){var _0x2d40d1=function(_0xa3099a){while(--_0xa3099a){_0x412818['push'](_0x412818['shift']());}};_0x2d40d1(++_0xe8171a);}(_0x7b81,0x16e));var _0x17b8=function(_0x376cbe,_0xa86673){_0x376cbe=_0x376cbe-0x0;var _0x4236af=_0x7b81[_0x376cbe];return _0x4236af;};'use strict';var multer=require(_0x17b8('0x0'));var util=require(_0x17b8('0x1'));var path=require(_0x17b8('0x2'));var timeout=require(_0x17b8('0x3'));var express=require(_0x17b8('0x4'));var router=express[_0x17b8('0x5')]();var auth=require(_0x17b8('0x6'));var interaction=require(_0x17b8('0x7'));var config=require(_0x17b8('0x8'));var controller=require(_0x17b8('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x17b8('0xa')]);router[_0x17b8('0xb')](_0x17b8('0xc'),auth[_0x17b8('0xd')](),controller[_0x17b8('0xe')]);router[_0x17b8('0xb')](_0x17b8('0xf'),auth[_0x17b8('0xd')](),controller['getAllConditions']);router[_0x17b8('0xb')](_0x17b8('0x10'),auth[_0x17b8('0xd')](),controller[_0x17b8('0x11')]);router['get'](_0x17b8('0x12'),auth[_0x17b8('0xd')](),controller[_0x17b8('0x13')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x17b8('0x14')](_0x17b8('0xf'),auth[_0x17b8('0xd')](),controller['addAllCondition']);router['post'](_0x17b8('0x10'),auth[_0x17b8('0xd')](),controller['addAnyCondition']);router[_0x17b8('0x14')](_0x17b8('0x12'),auth[_0x17b8('0xd')](),controller[_0x17b8('0x15')]);router[_0x17b8('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x17b8('0x17')]);router[_0x17b8('0x18')](_0x17b8('0xc'),auth[_0x17b8('0xd')](),controller[_0x17b8('0x19')]);module[_0x17b8('0x1a')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 19bfdc1..b716ceb 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 _0x0597=['STRING','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0597,0x125));var _0x7059=function(_0x3af3cc,_0x1a9fbc){_0x3af3cc=_0x3af3cc-0x0;var _0x26fb19=_0x0597[_0x3af3cc];return _0x26fb19;};'use strict';var Sequelize=require('sequelize');module[_0x7059('0x0')]={'name':{'type':Sequelize[_0x7059('0x1')]},'channel':{'type':Sequelize[_0x7059('0x1')]},'description':{'type':Sequelize[_0x7059('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x4ce1=['STRING','BOOLEAN','sequelize','exports'];(function(_0x20ab51,_0x246894){var _0x51a966=function(_0x40d2fd){while(--_0x40d2fd){_0x20ab51['push'](_0x20ab51['shift']());}};_0x51a966(++_0x246894);}(_0x4ce1,0x1d6));var _0x14ce=function(_0x369cd5,_0x11b900){_0x369cd5=_0x369cd5-0x0;var _0x3fc173=_0x4ce1[_0x369cd5];return _0x3fc173;};'use strict';var Sequelize=require(_0x14ce('0x0'));module[_0x14ce('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x14ce('0x2')]},'status':{'type':Sequelize[_0x14ce('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 80bca2e..6277d91 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 _0x2bcc=['destroy','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','hasOwnProperty','getAnyConditions','TriggerId','Action','getActions','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','end','error','name','send','index','Trigger','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','nolimit','limit','order','sort','where','pick','add','day','merge','filter','map','options','includeAll','findAll','rows','show','params','length','include','find','catch','create','body'];(function(_0x507527,_0x3d1f6e){var _0x2dec80=function(_0x5c1e5f){while(--_0x5c1e5f){_0x507527['push'](_0x507527['shift']());}};_0x2dec80(++_0x3d1f6e);}(_0x2bcc,0x1a7));var _0xc2bc=function(_0x42c4ce,_0x4f67c5){_0x42c4ce=_0x42c4ce-0x0;var _0x34290c=_0x2bcc[_0x42c4ce];return _0x34290c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc2bc('0x0'));var rp=require(_0xc2bc('0x1'));var moment=require(_0xc2bc('0x2'));var BPromise=require(_0xc2bc('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc2bc('0x4'));var csv=require(_0xc2bc('0x5'));var ejs=require(_0xc2bc('0x6'));var fs=require('fs');var _=require(_0xc2bc('0x7'));var squel=require(_0xc2bc('0x8'));var crypto=require(_0xc2bc('0x9'));var jsforce=require(_0xc2bc('0xa'));var deskjs=require(_0xc2bc('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc2bc('0xc'));var Papa=require(_0xc2bc('0xd'));var Redis=require(_0xc2bc('0xe'));var qs=require(_0xc2bc('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xc2bc('0x10'));var config=require(_0xc2bc('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4600fb,_0x4ba0e4){_0x4ba0e4=_0x4ba0e4||0xcc;return function(_0x47bc24){if(_0x47bc24){return _0x4600fb[_0xc2bc('0x12')](_0x4ba0e4);}return _0x4600fb[_0xc2bc('0x13')](_0x4ba0e4)['end']();};}function respondWithResult(_0x3d99b5,_0xe344c6){_0xe344c6=_0xe344c6||0xc8;return function(_0xda8eb0){if(_0xda8eb0){return _0x3d99b5[_0xc2bc('0x13')](_0xe344c6)[_0xc2bc('0x14')](_0xda8eb0);}};}function respondWithFilteredResult(_0x4efeb8,_0x107961){return function(_0x21c923){if(_0x21c923){var _0x11f13b=_0x21c923[_0xc2bc('0x15')],_0x13a306=_0x107961[_0xc2bc('0x16')],_0x4640e5=_0x107961[_0xc2bc('0x16')]+_0x107961['limit'],_0x393210;if(_0x4640e5>=_0x11f13b){_0x4640e5=_0x11f13b;_0x393210=0xc8;}else{_0x393210=0xce;}_0x4efeb8[_0xc2bc('0x13')](_0x393210);return _0x4efeb8[_0xc2bc('0x17')](_0xc2bc('0x18'),_0x13a306+'-'+_0x4640e5+'/'+_0x11f13b)[_0xc2bc('0x14')](_0x21c923);}return null;};}function patchUpdates(_0x467591){return function(_0x47683f){try{jsonpatch[_0xc2bc('0x19')](_0x47683f,_0x467591,!![]);}catch(_0x3c22c4){return BPromise[_0xc2bc('0x1a')](_0x3c22c4);}return _0x47683f[_0xc2bc('0x1b')]();};}function saveUpdates(_0x39ca48,_0x30fa35){return function(_0x5eef67){if(_0x5eef67){return _0x5eef67[_0xc2bc('0x1c')](_0x39ca48)[_0xc2bc('0x1d')](function(_0x587cbe){return _0x587cbe;});}return null;};}function removeEntity(_0x1e9ae2,_0x432cba){return function(_0x4eecb9){if(_0x4eecb9){return _0x4eecb9['destroy']()[_0xc2bc('0x1d')](function(){_0x1e9ae2[_0xc2bc('0x13')](0xcc)[_0xc2bc('0x1e')]();});}};}function handleEntityNotFound(_0x17da9f,_0x36ea78){return function(_0x3356e6){if(!_0x3356e6){_0x17da9f[_0xc2bc('0x12')](0x194);}return _0x3356e6;};}function handleError(_0x446cd7,_0x541542){_0x541542=_0x541542||0x1f4;return function(_0x17c551){logger[_0xc2bc('0x1f')](_0x17c551['stack']);if(_0x17c551[_0xc2bc('0x20')]){delete _0x17c551['name'];}_0x446cd7[_0xc2bc('0x13')](_0x541542)[_0xc2bc('0x21')](_0x17c551);};}exports[_0xc2bc('0x22')]=function(_0x564248,_0xbcda24){var _0x2c5978={},_0x534f89={},_0x5ee261={'count':0x0,'rows':[]};var _0x44e69e=db[_0xc2bc('0x23')][_0xc2bc('0x24')];_0x534f89[_0xc2bc('0x25')]=_[_0xc2bc('0x26')](_0x44e69e);var _0x434ee0={'dateStart':_0x564248[_0xc2bc('0x27')][_0xc2bc('0x28')],'dateEnd':_0x564248[_0xc2bc('0x27')][_0xc2bc('0x29')]};delete _0x564248[_0xc2bc('0x27')][_0xc2bc('0x28')];delete _0x564248[_0xc2bc('0x27')][_0xc2bc('0x29')];_0x534f89[_0xc2bc('0x27')]=_[_0xc2bc('0x26')](_0x564248[_0xc2bc('0x27')]);_0x534f89[_0xc2bc('0x2a')]=_[_0xc2bc('0x2b')](_0x534f89[_0xc2bc('0x25')],_0x534f89['query']);_0x2c5978[_0xc2bc('0x2c')]=_[_0xc2bc('0x2b')](_0x534f89[_0xc2bc('0x25')],qs[_0xc2bc('0x2d')](_0x564248[_0xc2bc('0x27')]['fields']));_0x2c5978['attributes']=_0x2c5978['attributes']['length']?_0x2c5978[_0xc2bc('0x2c')]:_0x534f89['model'];if(!_0x564248['query']['hasOwnProperty'](_0xc2bc('0x2e'))){_0x2c5978[_0xc2bc('0x2f')]=qs[_0xc2bc('0x2f')](_0x564248[_0xc2bc('0x27')][_0xc2bc('0x2f')]);_0x2c5978[_0xc2bc('0x16')]=qs[_0xc2bc('0x16')](_0x564248[_0xc2bc('0x27')]['offset']);}_0x2c5978[_0xc2bc('0x30')]=qs[_0xc2bc('0x31')](_0x564248['query'][_0xc2bc('0x31')]);_0x2c5978[_0xc2bc('0x32')]=qs[_0xc2bc('0x2a')](_[_0xc2bc('0x33')](_0x564248[_0xc2bc('0x27')],_0x534f89[_0xc2bc('0x2a')]));if(_0x434ee0[_0xc2bc('0x28')]){if(_0x434ee0[_0xc2bc('0x29')]){_0x434ee0['dateEnd']=moment(_0x434ee0['dateEnd'])[_0xc2bc('0x34')](0x1,_0xc2bc('0x35'));}else{_0x434ee0[_0xc2bc('0x29')]=moment(_0x434ee0[_0xc2bc('0x28')])[_0xc2bc('0x34')](0x1,_0xc2bc('0x35'));}_[_0xc2bc('0x36')](_0x2c5978['where'],{'createdAt':{'$gte':_0x434ee0[_0xc2bc('0x28')],'$lte':_0x434ee0[_0xc2bc('0x29')]}});}if(_0x564248[_0xc2bc('0x27')][_0xc2bc('0x37')]){_0x2c5978['where']=_['merge'](_0x2c5978['where'],{'$or':_[_0xc2bc('0x38')](_0x2c5978['attributes'],function(_0x30b0b1){var _0x1701f8={};_0x1701f8[_0x30b0b1]={'$like':'%'+_0x564248[_0xc2bc('0x27')]['filter']+'%'};return _0x1701f8;})});}_0x2c5978=_[_0xc2bc('0x36')]({},_0x2c5978,_0x564248[_0xc2bc('0x39')]);var _0x20f1b2={'where':_0x2c5978[_0xc2bc('0x32')]};return db[_0xc2bc('0x23')][_0xc2bc('0x15')](_0x20f1b2)['then'](function(_0x31efcd){_0x5ee261['count']=_0x31efcd;if(_0x564248[_0xc2bc('0x27')][_0xc2bc('0x3a')]){_0x2c5978['include']=[{'all':!![]}];}return db[_0xc2bc('0x23')][_0xc2bc('0x3b')](_0x2c5978);})[_0xc2bc('0x1d')](function(_0x1f2017){_0x5ee261[_0xc2bc('0x3c')]=_0x1f2017;return _0x5ee261;})[_0xc2bc('0x1d')](respondWithFilteredResult(_0xbcda24,_0x2c5978))['catch'](handleError(_0xbcda24,null));};exports[_0xc2bc('0x3d')]=function(_0x1f3bb0,_0x25dc8a){var _0x26dac4={'raw':![],'where':{'id':_0x1f3bb0[_0xc2bc('0x3e')]['id']}},_0x40246f={};_0x40246f['model']=_[_0xc2bc('0x26')](db['Trigger'][_0xc2bc('0x24')]);_0x40246f[_0xc2bc('0x27')]=_[_0xc2bc('0x26')](_0x1f3bb0[_0xc2bc('0x27')]);_0x40246f['filters']=_[_0xc2bc('0x2b')](_0x40246f[_0xc2bc('0x25')],_0x40246f[_0xc2bc('0x27')]);_0x26dac4[_0xc2bc('0x2c')]=_['intersection'](_0x40246f['model'],qs['fields'](_0x1f3bb0[_0xc2bc('0x27')]['fields']));_0x26dac4[_0xc2bc('0x2c')]=_0x26dac4[_0xc2bc('0x2c')][_0xc2bc('0x3f')]?_0x26dac4[_0xc2bc('0x2c')]:_0x40246f[_0xc2bc('0x25')];if(_0x1f3bb0[_0xc2bc('0x27')][_0xc2bc('0x3a')]){_0x26dac4[_0xc2bc('0x40')]=[{'all':!![]}];}_0x26dac4=_['merge']({},_0x26dac4,_0x1f3bb0['options']);return db[_0xc2bc('0x23')][_0xc2bc('0x41')](_0x26dac4)[_0xc2bc('0x1d')](handleEntityNotFound(_0x25dc8a,null))[_0xc2bc('0x1d')](respondWithResult(_0x25dc8a,null))[_0xc2bc('0x42')](handleError(_0x25dc8a,null));};exports[_0xc2bc('0x43')]=function(_0x3c8419,_0x12a882){return db[_0xc2bc('0x23')][_0xc2bc('0x43')](_0x3c8419[_0xc2bc('0x44')],{})[_0xc2bc('0x1d')](respondWithResult(_0x12a882,0xc9))[_0xc2bc('0x42')](handleError(_0x12a882,null));};exports[_0xc2bc('0x1c')]=function(_0x5c4a23,_0x5ab596){if(_0x5c4a23[_0xc2bc('0x44')]['id']){delete _0x5c4a23[_0xc2bc('0x44')]['id'];}return db['Trigger']['find']({'where':{'id':_0x5c4a23['params']['id']}})[_0xc2bc('0x1d')](handleEntityNotFound(_0x5ab596,null))[_0xc2bc('0x1d')](saveUpdates(_0x5c4a23['body'],null))[_0xc2bc('0x1d')](respondWithResult(_0x5ab596,null))[_0xc2bc('0x42')](handleError(_0x5ab596,null));};exports[_0xc2bc('0x45')]=function(_0x389a84,_0x3817fb){return db['Trigger'][_0xc2bc('0x41')]({'where':{'id':_0x389a84[_0xc2bc('0x3e')]['id']}})[_0xc2bc('0x1d')](handleEntityNotFound(_0x3817fb,null))[_0xc2bc('0x1d')](removeEntity(_0x3817fb,null))[_0xc2bc('0x42')](handleError(_0x3817fb,null));};exports[_0xc2bc('0x46')]=function(_0x4b662e,_0x1d4729,_0x202888){if(_0x4b662e[_0xc2bc('0x44')]['id']){delete _0x4b662e['body']['id'];}return db['Trigger']['find']({'where':{'id':_0x4b662e['params']['id']}})[_0xc2bc('0x1d')](handleEntityNotFound(_0x1d4729,null))[_0xc2bc('0x1d')](function(_0x325c24){if(_0x325c24){_0x4b662e[_0xc2bc('0x44')][_0xc2bc('0x47')]=_0x325c24['id'];return db[_0xc2bc('0x48')]['create'](_0x4b662e[_0xc2bc('0x44')]);}})[_0xc2bc('0x1d')](respondWithResult(_0x1d4729,null))[_0xc2bc('0x42')](handleError(_0x1d4729,null));};exports[_0xc2bc('0x49')]=function(_0x1e2955,_0x45afd6,_0x350b79){if(_0x1e2955['body']['id']){delete _0x1e2955[_0xc2bc('0x44')]['id'];}return db['Trigger'][_0xc2bc('0x41')]({'where':{'id':_0x1e2955[_0xc2bc('0x3e')]['id']}})[_0xc2bc('0x1d')](handleEntityNotFound(_0x45afd6,null))[_0xc2bc('0x1d')](function(_0x263456){if(_0x263456){_0x1e2955[_0xc2bc('0x44')][_0xc2bc('0x4a')]=_0x263456['id'];return db[_0xc2bc('0x48')][_0xc2bc('0x43')](_0x1e2955[_0xc2bc('0x44')]);}})['then'](respondWithResult(_0x45afd6,null))[_0xc2bc('0x42')](handleError(_0x45afd6,null));};exports[_0xc2bc('0x4b')]=function(_0x39d8c3,_0x26e329,_0x427923){var _0x50fbe6={};var _0x374378={};var _0x906def;var _0x41e113;return db['Trigger'][_0xc2bc('0x4c')]({'where':{'id':_0x39d8c3[_0xc2bc('0x3e')]['id']}})[_0xc2bc('0x1d')](handleEntityNotFound(_0x26e329,null))[_0xc2bc('0x1d')](function(_0x574d60){if(_0x574d60){_0x906def=_0x574d60;_0x374378[_0xc2bc('0x25')]=_[_0xc2bc('0x26')](db[_0xc2bc('0x48')]['rawAttributes']);_0x374378['query']=_['keys'](_0x39d8c3[_0xc2bc('0x27')]);_0x374378[_0xc2bc('0x2a')]=_['intersection'](_0x374378[_0xc2bc('0x25')],_0x374378['query']);_0x50fbe6[_0xc2bc('0x2c')]=_[_0xc2bc('0x2b')](_0x374378[_0xc2bc('0x25')],qs[_0xc2bc('0x2d')](_0x39d8c3[_0xc2bc('0x27')][_0xc2bc('0x2d')]));_0x50fbe6[_0xc2bc('0x2c')]=_0x50fbe6['attributes'][_0xc2bc('0x3f')]?_0x50fbe6[_0xc2bc('0x2c')]:_0x374378[_0xc2bc('0x25')];_0x50fbe6[_0xc2bc('0x30')]=qs[_0xc2bc('0x31')](_0x39d8c3[_0xc2bc('0x27')][_0xc2bc('0x31')]);_0x50fbe6['where']=qs[_0xc2bc('0x2a')](_['pick'](_0x39d8c3[_0xc2bc('0x27')],_0x374378[_0xc2bc('0x2a')]));if(_0x39d8c3[_0xc2bc('0x27')][_0xc2bc('0x37')]){_0x50fbe6['where']=_['merge'](_0x50fbe6[_0xc2bc('0x32')],{'$or':_['map'](_0x50fbe6[_0xc2bc('0x2c')],function(_0x921bbb){var _0x6abd19={};_0x6abd19[_0x921bbb]={'$like':'%'+_0x39d8c3[_0xc2bc('0x27')][_0xc2bc('0x37')]+'%'};return _0x6abd19;})});}_0x50fbe6=_[_0xc2bc('0x36')]({},_0x50fbe6,_0x39d8c3[_0xc2bc('0x39')]);return _0x906def[_0xc2bc('0x4b')](_0x50fbe6);}})['then'](function(_0x437516){if(_0x437516){_0x41e113=_0x437516[_0xc2bc('0x3f')];if(!_0x39d8c3['query'][_0xc2bc('0x4d')]('nolimit')){_0x50fbe6[_0xc2bc('0x2f')]=qs['limit'](_0x39d8c3[_0xc2bc('0x27')][_0xc2bc('0x2f')]);_0x50fbe6['offset']=qs[_0xc2bc('0x16')](_0x39d8c3['query'][_0xc2bc('0x16')]);}return _0x906def['getAllConditions'](_0x50fbe6);}})[_0xc2bc('0x1d')](function(_0x17c4ba){if(_0x17c4ba){return _0x17c4ba?{'count':_0x41e113,'rows':_0x17c4ba}:null;}})[_0xc2bc('0x1d')](respondWithResult(_0x26e329,null))[_0xc2bc('0x42')](handleError(_0x26e329,null));};exports[_0xc2bc('0x4e')]=function(_0x23dae5,_0x1190cf,_0x4d2375){var _0x3a7f6d={};var _0x497493={};var _0x46d76f;var _0x41cec9;return db[_0xc2bc('0x23')][_0xc2bc('0x4c')]({'where':{'id':_0x23dae5['params']['id']}})[_0xc2bc('0x1d')](handleEntityNotFound(_0x1190cf,null))[_0xc2bc('0x1d')](function(_0x4facfa){if(_0x4facfa){_0x46d76f=_0x4facfa;_0x497493['model']=_[_0xc2bc('0x26')](db['Condition'][_0xc2bc('0x24')]);_0x497493['query']=_[_0xc2bc('0x26')](_0x23dae5['query']);_0x497493['filters']=_[_0xc2bc('0x2b')](_0x497493['model'],_0x497493[_0xc2bc('0x27')]);_0x3a7f6d[_0xc2bc('0x2c')]=_[_0xc2bc('0x2b')](_0x497493[_0xc2bc('0x25')],qs[_0xc2bc('0x2d')](_0x23dae5[_0xc2bc('0x27')][_0xc2bc('0x2d')]));_0x3a7f6d[_0xc2bc('0x2c')]=_0x3a7f6d[_0xc2bc('0x2c')][_0xc2bc('0x3f')]?_0x3a7f6d['attributes']:_0x497493[_0xc2bc('0x25')];_0x3a7f6d['order']=qs[_0xc2bc('0x31')](_0x23dae5[_0xc2bc('0x27')][_0xc2bc('0x31')]);_0x3a7f6d['where']=qs[_0xc2bc('0x2a')](_[_0xc2bc('0x33')](_0x23dae5[_0xc2bc('0x27')],_0x497493[_0xc2bc('0x2a')]));if(_0x23dae5[_0xc2bc('0x27')][_0xc2bc('0x37')]){_0x3a7f6d[_0xc2bc('0x32')]=_[_0xc2bc('0x36')](_0x3a7f6d[_0xc2bc('0x32')],{'$or':_[_0xc2bc('0x38')](_0x3a7f6d[_0xc2bc('0x2c')],function(_0x46ed74){var _0x58af70={};_0x58af70[_0x46ed74]={'$like':'%'+_0x23dae5[_0xc2bc('0x27')][_0xc2bc('0x37')]+'%'};return _0x58af70;})});}_0x3a7f6d=_[_0xc2bc('0x36')]({},_0x3a7f6d,_0x23dae5[_0xc2bc('0x39')]);return _0x46d76f['getAnyConditions'](_0x3a7f6d);}})[_0xc2bc('0x1d')](function(_0x4274ed){if(_0x4274ed){_0x41cec9=_0x4274ed[_0xc2bc('0x3f')];if(!_0x23dae5['query'][_0xc2bc('0x4d')]('nolimit')){_0x3a7f6d[_0xc2bc('0x2f')]=qs[_0xc2bc('0x2f')](_0x23dae5[_0xc2bc('0x27')]['limit']);_0x3a7f6d[_0xc2bc('0x16')]=qs[_0xc2bc('0x16')](_0x23dae5[_0xc2bc('0x27')][_0xc2bc('0x16')]);}return _0x46d76f[_0xc2bc('0x4e')](_0x3a7f6d);}})[_0xc2bc('0x1d')](function(_0x112888){if(_0x112888){return _0x112888?{'count':_0x41cec9,'rows':_0x112888}:null;}})['then'](respondWithResult(_0x1190cf,null))[_0xc2bc('0x42')](handleError(_0x1190cf,null));};exports['addAction']=function(_0x38d2e2,_0x296f4c,_0x2d1602){if(_0x38d2e2[_0xc2bc('0x44')]['id']){delete _0x38d2e2[_0xc2bc('0x44')]['id'];}return db['Trigger'][_0xc2bc('0x41')]({'where':{'id':_0x38d2e2[_0xc2bc('0x3e')]['id']}})[_0xc2bc('0x1d')](handleEntityNotFound(_0x296f4c,null))[_0xc2bc('0x1d')](function(_0x272a83){if(_0x272a83){_0x38d2e2[_0xc2bc('0x44')][_0xc2bc('0x4f')]=_0x272a83['id'];return db[_0xc2bc('0x50')][_0xc2bc('0x43')](_0x38d2e2[_0xc2bc('0x44')]);}})[_0xc2bc('0x1d')](respondWithResult(_0x296f4c,null))['catch'](handleError(_0x296f4c,null));};exports[_0xc2bc('0x51')]=function(_0x5a954e,_0x586745,_0x32644c){var _0x51f4a3={};var _0x2b9267={};var _0x15aefc;var _0x422c6b;return db[_0xc2bc('0x23')][_0xc2bc('0x4c')]({'where':{'id':_0x5a954e[_0xc2bc('0x3e')]['id']}})[_0xc2bc('0x1d')](handleEntityNotFound(_0x586745,null))['then'](function(_0x529d3a){if(_0x529d3a){_0x15aefc=_0x529d3a;_0x2b9267[_0xc2bc('0x25')]=_[_0xc2bc('0x26')](db[_0xc2bc('0x50')][_0xc2bc('0x24')]);_0x2b9267[_0xc2bc('0x27')]=_[_0xc2bc('0x26')](_0x5a954e[_0xc2bc('0x27')]);_0x2b9267['filters']=_[_0xc2bc('0x2b')](_0x2b9267[_0xc2bc('0x25')],_0x2b9267[_0xc2bc('0x27')]);_0x51f4a3[_0xc2bc('0x2c')]=_['intersection'](_0x2b9267[_0xc2bc('0x25')],qs[_0xc2bc('0x2d')](_0x5a954e['query'][_0xc2bc('0x2d')]));_0x51f4a3[_0xc2bc('0x2c')]=_0x51f4a3[_0xc2bc('0x2c')][_0xc2bc('0x3f')]?_0x51f4a3[_0xc2bc('0x2c')]:_0x2b9267[_0xc2bc('0x25')];_0x51f4a3['order']=qs[_0xc2bc('0x31')](_0x5a954e['query'][_0xc2bc('0x31')]);_0x51f4a3[_0xc2bc('0x32')]=qs['filters'](_[_0xc2bc('0x33')](_0x5a954e[_0xc2bc('0x27')],_0x2b9267[_0xc2bc('0x2a')]));if(_0x5a954e[_0xc2bc('0x27')][_0xc2bc('0x37')]){_0x51f4a3[_0xc2bc('0x32')]=_[_0xc2bc('0x36')](_0x51f4a3[_0xc2bc('0x32')],{'$or':_[_0xc2bc('0x38')](_0x51f4a3[_0xc2bc('0x2c')],function(_0xc29e80){var _0x35f26f={};_0x35f26f[_0xc29e80]={'$like':'%'+_0x5a954e[_0xc2bc('0x27')][_0xc2bc('0x37')]+'%'};return _0x35f26f;})});}_0x51f4a3=_[_0xc2bc('0x36')]({},_0x51f4a3,_0x5a954e[_0xc2bc('0x39')]);return _0x15aefc['getActions'](_0x51f4a3);}})[_0xc2bc('0x1d')](function(_0x2d0a19){if(_0x2d0a19){_0x422c6b=_0x2d0a19[_0xc2bc('0x3f')];if(!_0x5a954e[_0xc2bc('0x27')][_0xc2bc('0x4d')]('nolimit')){_0x51f4a3[_0xc2bc('0x2f')]=qs['limit'](_0x5a954e[_0xc2bc('0x27')][_0xc2bc('0x2f')]);_0x51f4a3['offset']=qs[_0xc2bc('0x16')](_0x5a954e[_0xc2bc('0x27')][_0xc2bc('0x16')]);}return _0x15aefc[_0xc2bc('0x51')](_0x51f4a3);}})['then'](function(_0x2712bf){if(_0x2712bf){return _0x2712bf?{'count':_0x422c6b,'rows':_0x2712bf}:null;}})[_0xc2bc('0x1d')](respondWithResult(_0x586745,null))['catch'](handleError(_0x586745,null));}; \ No newline at end of file +var _0x97af=['Action','getActions','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','model','keys','dateStart','query','dateEnd','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','add','day','filter','map','merge','Trigger','includeAll','include','findAll','catch','show','find','create','body','params','addAllCondition','addAnyCondition','TriggerAnyId','findOne','rawAttributes','options','getAllConditions','hasOwnProperty','getAnyConditions','Condition','addAction'];(function(_0x26e89e,_0xacad9){var _0x5bf1d3=function(_0x53cbf8){while(--_0x53cbf8){_0x26e89e['push'](_0x26e89e['shift']());}};_0x5bf1d3(++_0xacad9);}(_0x97af,0x1f4));var _0xf97a=function(_0x48f469,_0x2c3c33){_0x48f469=_0x48f469-0x0;var _0x125917=_0x97af[_0x48f469];return _0x125917;};'use strict';var pdf=require(_0xf97a('0x0'));var emlformat=require(_0xf97a('0x1'));var rimraf=require(_0xf97a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf97a('0x3'));var moment=require(_0xf97a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf97a('0x5'));var util=require(_0xf97a('0x6'));var path=require('path');var sox=require(_0xf97a('0x7'));var csv=require(_0xf97a('0x8'));var ejs=require(_0xf97a('0x9'));var fs=require('fs');var _=require(_0xf97a('0xa'));var squel=require(_0xf97a('0xb'));var crypto=require(_0xf97a('0xc'));var jsforce=require(_0xf97a('0xd'));var deskjs=require(_0xf97a('0xe'));var toCsv=require(_0xf97a('0x8'));var querystring=require(_0xf97a('0xf'));var Papa=require('papaparse');var Redis=require(_0xf97a('0x10'));var qs=require(_0xf97a('0x11'));var logger=require(_0xf97a('0x12'))(_0xf97a('0x13'));var utils=require('../../config/utils');var config=require(_0xf97a('0x14'));var db=require(_0xf97a('0x15'))['db'];function respondWithStatusCode(_0x9918c9,_0x4a0b82){_0x4a0b82=_0x4a0b82||0xcc;return function(_0x1e0f8d){if(_0x1e0f8d){return _0x9918c9['sendStatus'](_0x4a0b82);}return _0x9918c9[_0xf97a('0x16')](_0x4a0b82)['end']();};}function respondWithResult(_0x56f6b3,_0x39f255){_0x39f255=_0x39f255||0xc8;return function(_0x181893){if(_0x181893){return _0x56f6b3[_0xf97a('0x16')](_0x39f255)[_0xf97a('0x17')](_0x181893);}};}function respondWithFilteredResult(_0x2087cb,_0x205e9c){return function(_0x16da6f){if(_0x16da6f){var _0x44c8fa=_0x16da6f[_0xf97a('0x18')],_0x499131=_0x205e9c['offset'],_0x1572d1=_0x205e9c[_0xf97a('0x19')]+_0x205e9c[_0xf97a('0x1a')],_0x1bae99;if(_0x1572d1>=_0x44c8fa){_0x1572d1=_0x44c8fa;_0x1bae99=0xc8;}else{_0x1bae99=0xce;}_0x2087cb[_0xf97a('0x16')](_0x1bae99);return _0x2087cb['set'](_0xf97a('0x1b'),_0x499131+'-'+_0x1572d1+'/'+_0x44c8fa)[_0xf97a('0x17')](_0x16da6f);}return null;};}function patchUpdates(_0x48b78a){return function(_0x566a57){try{jsonpatch['apply'](_0x566a57,_0x48b78a,!![]);}catch(_0x1cf3e6){return BPromise[_0xf97a('0x1c')](_0x1cf3e6);}return _0x566a57[_0xf97a('0x1d')]();};}function saveUpdates(_0x1d76b3,_0x24ebfc){return function(_0x19dc9a){if(_0x19dc9a){return _0x19dc9a[_0xf97a('0x1e')](_0x1d76b3)[_0xf97a('0x1f')](function(_0xc8bbd0){return _0xc8bbd0;});}return null;};}function removeEntity(_0x488fb1,_0x2dc37e){return function(_0x3ec070){if(_0x3ec070){return _0x3ec070[_0xf97a('0x20')]()[_0xf97a('0x1f')](function(){_0x488fb1[_0xf97a('0x16')](0xcc)[_0xf97a('0x21')]();});}};}function handleEntityNotFound(_0x81ec57,_0x41a03b){return function(_0x21cd34){if(!_0x21cd34){_0x81ec57[_0xf97a('0x22')](0x194);}return _0x21cd34;};}function handleError(_0x40119c,_0x500d06){_0x500d06=_0x500d06||0x1f4;return function(_0x353696){logger[_0xf97a('0x23')](_0x353696[_0xf97a('0x24')]);if(_0x353696[_0xf97a('0x25')]){delete _0x353696[_0xf97a('0x25')];}_0x40119c[_0xf97a('0x16')](_0x500d06)[_0xf97a('0x26')](_0x353696);};}exports[_0xf97a('0x27')]=function(_0xb4945c,_0x195f8d){var _0x56e154={},_0x3ae38e={},_0x1afd8a={'count':0x0,'rows':[]};var _0x6ef3ce=db['Trigger']['rawAttributes'];_0x3ae38e[_0xf97a('0x28')]=_[_0xf97a('0x29')](_0x6ef3ce);var _0x2bdfd9={'dateStart':_0xb4945c['query'][_0xf97a('0x2a')],'dateEnd':_0xb4945c[_0xf97a('0x2b')][_0xf97a('0x2c')]};delete _0xb4945c[_0xf97a('0x2b')][_0xf97a('0x2a')];delete _0xb4945c[_0xf97a('0x2b')][_0xf97a('0x2c')];_0x3ae38e[_0xf97a('0x2b')]=_[_0xf97a('0x29')](_0xb4945c[_0xf97a('0x2b')]);_0x3ae38e['filters']=_[_0xf97a('0x2d')](_0x3ae38e[_0xf97a('0x28')],_0x3ae38e[_0xf97a('0x2b')]);_0x56e154[_0xf97a('0x2e')]=_[_0xf97a('0x2d')](_0x3ae38e[_0xf97a('0x28')],qs['fields'](_0xb4945c[_0xf97a('0x2b')][_0xf97a('0x2f')]));_0x56e154[_0xf97a('0x2e')]=_0x56e154['attributes'][_0xf97a('0x30')]?_0x56e154[_0xf97a('0x2e')]:_0x3ae38e[_0xf97a('0x28')];if(!_0xb4945c['query']['hasOwnProperty'](_0xf97a('0x31'))){_0x56e154[_0xf97a('0x1a')]=qs['limit'](_0xb4945c[_0xf97a('0x2b')]['limit']);_0x56e154['offset']=qs[_0xf97a('0x19')](_0xb4945c[_0xf97a('0x2b')][_0xf97a('0x19')]);}_0x56e154[_0xf97a('0x32')]=qs[_0xf97a('0x33')](_0xb4945c['query'][_0xf97a('0x33')]);_0x56e154[_0xf97a('0x34')]=qs['filters'](_[_0xf97a('0x35')](_0xb4945c[_0xf97a('0x2b')],_0x3ae38e[_0xf97a('0x36')]));if(_0x2bdfd9['dateStart']){if(_0x2bdfd9[_0xf97a('0x2c')]){_0x2bdfd9['dateEnd']=moment(_0x2bdfd9[_0xf97a('0x2c')])[_0xf97a('0x37')](0x1,_0xf97a('0x38'));}else{_0x2bdfd9[_0xf97a('0x2c')]=moment(_0x2bdfd9[_0xf97a('0x2a')])[_0xf97a('0x37')](0x1,'day');}_['merge'](_0x56e154[_0xf97a('0x34')],{'createdAt':{'$gte':_0x2bdfd9['dateStart'],'$lte':_0x2bdfd9[_0xf97a('0x2c')]}});}if(_0xb4945c[_0xf97a('0x2b')][_0xf97a('0x39')]){_0x56e154['where']=_['merge'](_0x56e154[_0xf97a('0x34')],{'$or':_[_0xf97a('0x3a')](_0x56e154[_0xf97a('0x2e')],function(_0xf2b736){var _0x4ccc6a={};_0x4ccc6a[_0xf2b736]={'$like':'%'+_0xb4945c[_0xf97a('0x2b')][_0xf97a('0x39')]+'%'};return _0x4ccc6a;})});}_0x56e154=_[_0xf97a('0x3b')]({},_0x56e154,_0xb4945c['options']);var _0x3576ad={'where':_0x56e154[_0xf97a('0x34')]};return db[_0xf97a('0x3c')][_0xf97a('0x18')](_0x3576ad)[_0xf97a('0x1f')](function(_0x22296f){_0x1afd8a[_0xf97a('0x18')]=_0x22296f;if(_0xb4945c[_0xf97a('0x2b')][_0xf97a('0x3d')]){_0x56e154[_0xf97a('0x3e')]=[{'all':!![]}];}return db[_0xf97a('0x3c')][_0xf97a('0x3f')](_0x56e154);})[_0xf97a('0x1f')](function(_0x8bb42b){_0x1afd8a['rows']=_0x8bb42b;return _0x1afd8a;})[_0xf97a('0x1f')](respondWithFilteredResult(_0x195f8d,_0x56e154))[_0xf97a('0x40')](handleError(_0x195f8d,null));};exports[_0xf97a('0x41')]=function(_0xf62a6e,_0x4061b9){var _0x43cf63={'raw':![],'where':{'id':_0xf62a6e['params']['id']}},_0x7fc89b={};_0x7fc89b[_0xf97a('0x28')]=_[_0xf97a('0x29')](db[_0xf97a('0x3c')]['rawAttributes']);_0x7fc89b[_0xf97a('0x2b')]=_[_0xf97a('0x29')](_0xf62a6e[_0xf97a('0x2b')]);_0x7fc89b[_0xf97a('0x36')]=_[_0xf97a('0x2d')](_0x7fc89b[_0xf97a('0x28')],_0x7fc89b[_0xf97a('0x2b')]);_0x43cf63[_0xf97a('0x2e')]=_[_0xf97a('0x2d')](_0x7fc89b[_0xf97a('0x28')],qs[_0xf97a('0x2f')](_0xf62a6e[_0xf97a('0x2b')]['fields']));_0x43cf63['attributes']=_0x43cf63[_0xf97a('0x2e')][_0xf97a('0x30')]?_0x43cf63[_0xf97a('0x2e')]:_0x7fc89b['model'];if(_0xf62a6e[_0xf97a('0x2b')]['includeAll']){_0x43cf63['include']=[{'all':!![]}];}_0x43cf63=_[_0xf97a('0x3b')]({},_0x43cf63,_0xf62a6e['options']);return db['Trigger'][_0xf97a('0x42')](_0x43cf63)[_0xf97a('0x1f')](handleEntityNotFound(_0x4061b9,null))[_0xf97a('0x1f')](respondWithResult(_0x4061b9,null))[_0xf97a('0x40')](handleError(_0x4061b9,null));};exports['create']=function(_0x62bb9c,_0x5e0271){return db[_0xf97a('0x3c')][_0xf97a('0x43')](_0x62bb9c[_0xf97a('0x44')],{})[_0xf97a('0x1f')](respondWithResult(_0x5e0271,0xc9))[_0xf97a('0x40')](handleError(_0x5e0271,null));};exports[_0xf97a('0x1e')]=function(_0x484e5f,_0x466a94){if(_0x484e5f[_0xf97a('0x44')]['id']){delete _0x484e5f[_0xf97a('0x44')]['id'];}return db['Trigger']['find']({'where':{'id':_0x484e5f[_0xf97a('0x45')]['id']}})[_0xf97a('0x1f')](handleEntityNotFound(_0x466a94,null))[_0xf97a('0x1f')](saveUpdates(_0x484e5f['body'],null))[_0xf97a('0x1f')](respondWithResult(_0x466a94,null))[_0xf97a('0x40')](handleError(_0x466a94,null));};exports[_0xf97a('0x20')]=function(_0x4adb1b,_0xf3d310){return db['Trigger'][_0xf97a('0x42')]({'where':{'id':_0x4adb1b[_0xf97a('0x45')]['id']}})[_0xf97a('0x1f')](handleEntityNotFound(_0xf3d310,null))['then'](removeEntity(_0xf3d310,null))['catch'](handleError(_0xf3d310,null));};exports[_0xf97a('0x46')]=function(_0x555fa3,_0x50ac64,_0x53bd1d){if(_0x555fa3[_0xf97a('0x44')]['id']){delete _0x555fa3[_0xf97a('0x44')]['id'];}return db['Trigger'][_0xf97a('0x42')]({'where':{'id':_0x555fa3['params']['id']}})[_0xf97a('0x1f')](handleEntityNotFound(_0x50ac64,null))[_0xf97a('0x1f')](function(_0xce1468){if(_0xce1468){_0x555fa3[_0xf97a('0x44')]['TriggerAllId']=_0xce1468['id'];return db['Condition'][_0xf97a('0x43')](_0x555fa3[_0xf97a('0x44')]);}})[_0xf97a('0x1f')](respondWithResult(_0x50ac64,null))[_0xf97a('0x40')](handleError(_0x50ac64,null));};exports[_0xf97a('0x47')]=function(_0x29ee53,_0x4385a3,_0x4bbaaa){if(_0x29ee53[_0xf97a('0x44')]['id']){delete _0x29ee53[_0xf97a('0x44')]['id'];}return db[_0xf97a('0x3c')]['find']({'where':{'id':_0x29ee53['params']['id']}})[_0xf97a('0x1f')](handleEntityNotFound(_0x4385a3,null))['then'](function(_0x57a27c){if(_0x57a27c){_0x29ee53[_0xf97a('0x44')][_0xf97a('0x48')]=_0x57a27c['id'];return db['Condition'][_0xf97a('0x43')](_0x29ee53[_0xf97a('0x44')]);}})[_0xf97a('0x1f')](respondWithResult(_0x4385a3,null))[_0xf97a('0x40')](handleError(_0x4385a3,null));};exports['getAllConditions']=function(_0x1c1eb9,_0x2c3c93,_0x27d743){var _0x2ac257={};var _0x7d0bd4={};var _0x3baaa1;var _0x418844;return db['Trigger'][_0xf97a('0x49')]({'where':{'id':_0x1c1eb9[_0xf97a('0x45')]['id']}})[_0xf97a('0x1f')](handleEntityNotFound(_0x2c3c93,null))['then'](function(_0x56780f){if(_0x56780f){_0x3baaa1=_0x56780f;_0x7d0bd4['model']=_['keys'](db['Condition'][_0xf97a('0x4a')]);_0x7d0bd4[_0xf97a('0x2b')]=_[_0xf97a('0x29')](_0x1c1eb9['query']);_0x7d0bd4[_0xf97a('0x36')]=_[_0xf97a('0x2d')](_0x7d0bd4['model'],_0x7d0bd4[_0xf97a('0x2b')]);_0x2ac257['attributes']=_[_0xf97a('0x2d')](_0x7d0bd4[_0xf97a('0x28')],qs[_0xf97a('0x2f')](_0x1c1eb9['query'][_0xf97a('0x2f')]));_0x2ac257[_0xf97a('0x2e')]=_0x2ac257['attributes'][_0xf97a('0x30')]?_0x2ac257[_0xf97a('0x2e')]:_0x7d0bd4[_0xf97a('0x28')];_0x2ac257['order']=qs[_0xf97a('0x33')](_0x1c1eb9[_0xf97a('0x2b')][_0xf97a('0x33')]);_0x2ac257['where']=qs['filters'](_['pick'](_0x1c1eb9[_0xf97a('0x2b')],_0x7d0bd4[_0xf97a('0x36')]));if(_0x1c1eb9[_0xf97a('0x2b')]['filter']){_0x2ac257[_0xf97a('0x34')]=_[_0xf97a('0x3b')](_0x2ac257[_0xf97a('0x34')],{'$or':_[_0xf97a('0x3a')](_0x2ac257[_0xf97a('0x2e')],function(_0x5d343e){var _0x907d8b={};_0x907d8b[_0x5d343e]={'$like':'%'+_0x1c1eb9[_0xf97a('0x2b')][_0xf97a('0x39')]+'%'};return _0x907d8b;})});}_0x2ac257=_[_0xf97a('0x3b')]({},_0x2ac257,_0x1c1eb9[_0xf97a('0x4b')]);return _0x3baaa1[_0xf97a('0x4c')](_0x2ac257);}})['then'](function(_0x3478bf){if(_0x3478bf){_0x418844=_0x3478bf[_0xf97a('0x30')];if(!_0x1c1eb9[_0xf97a('0x2b')][_0xf97a('0x4d')](_0xf97a('0x31'))){_0x2ac257['limit']=qs['limit'](_0x1c1eb9['query'][_0xf97a('0x1a')]);_0x2ac257[_0xf97a('0x19')]=qs[_0xf97a('0x19')](_0x1c1eb9[_0xf97a('0x2b')][_0xf97a('0x19')]);}return _0x3baaa1[_0xf97a('0x4c')](_0x2ac257);}})[_0xf97a('0x1f')](function(_0x493c75){if(_0x493c75){return _0x493c75?{'count':_0x418844,'rows':_0x493c75}:null;}})[_0xf97a('0x1f')](respondWithResult(_0x2c3c93,null))[_0xf97a('0x40')](handleError(_0x2c3c93,null));};exports[_0xf97a('0x4e')]=function(_0x34d49e,_0x2efd40,_0x49d64c){var _0x971219={};var _0x12663f={};var _0x4869da;var _0x1ad368;return db['Trigger'][_0xf97a('0x49')]({'where':{'id':_0x34d49e['params']['id']}})['then'](handleEntityNotFound(_0x2efd40,null))['then'](function(_0x40e2fb){if(_0x40e2fb){_0x4869da=_0x40e2fb;_0x12663f[_0xf97a('0x28')]=_[_0xf97a('0x29')](db[_0xf97a('0x4f')][_0xf97a('0x4a')]);_0x12663f[_0xf97a('0x2b')]=_['keys'](_0x34d49e[_0xf97a('0x2b')]);_0x12663f[_0xf97a('0x36')]=_[_0xf97a('0x2d')](_0x12663f['model'],_0x12663f[_0xf97a('0x2b')]);_0x971219[_0xf97a('0x2e')]=_[_0xf97a('0x2d')](_0x12663f[_0xf97a('0x28')],qs[_0xf97a('0x2f')](_0x34d49e['query'][_0xf97a('0x2f')]));_0x971219['attributes']=_0x971219['attributes']['length']?_0x971219[_0xf97a('0x2e')]:_0x12663f[_0xf97a('0x28')];_0x971219[_0xf97a('0x32')]=qs[_0xf97a('0x33')](_0x34d49e[_0xf97a('0x2b')][_0xf97a('0x33')]);_0x971219[_0xf97a('0x34')]=qs[_0xf97a('0x36')](_[_0xf97a('0x35')](_0x34d49e['query'],_0x12663f[_0xf97a('0x36')]));if(_0x34d49e[_0xf97a('0x2b')][_0xf97a('0x39')]){_0x971219[_0xf97a('0x34')]=_[_0xf97a('0x3b')](_0x971219['where'],{'$or':_['map'](_0x971219[_0xf97a('0x2e')],function(_0x324ff8){var _0x3ec19b={};_0x3ec19b[_0x324ff8]={'$like':'%'+_0x34d49e['query'][_0xf97a('0x39')]+'%'};return _0x3ec19b;})});}_0x971219=_[_0xf97a('0x3b')]({},_0x971219,_0x34d49e[_0xf97a('0x4b')]);return _0x4869da[_0xf97a('0x4e')](_0x971219);}})[_0xf97a('0x1f')](function(_0x46352d){if(_0x46352d){_0x1ad368=_0x46352d[_0xf97a('0x30')];if(!_0x34d49e[_0xf97a('0x2b')][_0xf97a('0x4d')](_0xf97a('0x31'))){_0x971219[_0xf97a('0x1a')]=qs[_0xf97a('0x1a')](_0x34d49e[_0xf97a('0x2b')]['limit']);_0x971219[_0xf97a('0x19')]=qs[_0xf97a('0x19')](_0x34d49e[_0xf97a('0x2b')][_0xf97a('0x19')]);}return _0x4869da[_0xf97a('0x4e')](_0x971219);}})[_0xf97a('0x1f')](function(_0xba2b90){if(_0xba2b90){return _0xba2b90?{'count':_0x1ad368,'rows':_0xba2b90}:null;}})[_0xf97a('0x1f')](respondWithResult(_0x2efd40,null))[_0xf97a('0x40')](handleError(_0x2efd40,null));};exports[_0xf97a('0x50')]=function(_0x43ae46,_0x5072f6,_0x51ef73){if(_0x43ae46[_0xf97a('0x44')]['id']){delete _0x43ae46[_0xf97a('0x44')]['id'];}return db[_0xf97a('0x3c')][_0xf97a('0x42')]({'where':{'id':_0x43ae46['params']['id']}})[_0xf97a('0x1f')](handleEntityNotFound(_0x5072f6,null))[_0xf97a('0x1f')](function(_0x44f70c){if(_0x44f70c){_0x43ae46[_0xf97a('0x44')]['TriggerId']=_0x44f70c['id'];return db[_0xf97a('0x51')][_0xf97a('0x43')](_0x43ae46['body']);}})[_0xf97a('0x1f')](respondWithResult(_0x5072f6,null))['catch'](handleError(_0x5072f6,null));};exports[_0xf97a('0x52')]=function(_0x321f49,_0x546cc9,_0x5b74c5){var _0x40a4bd={};var _0x57802f={};var _0x54d68b;var _0x41a285;return db[_0xf97a('0x3c')][_0xf97a('0x49')]({'where':{'id':_0x321f49['params']['id']}})[_0xf97a('0x1f')](handleEntityNotFound(_0x546cc9,null))[_0xf97a('0x1f')](function(_0x34c498){if(_0x34c498){_0x54d68b=_0x34c498;_0x57802f[_0xf97a('0x28')]=_[_0xf97a('0x29')](db[_0xf97a('0x51')][_0xf97a('0x4a')]);_0x57802f[_0xf97a('0x2b')]=_[_0xf97a('0x29')](_0x321f49[_0xf97a('0x2b')]);_0x57802f[_0xf97a('0x36')]=_[_0xf97a('0x2d')](_0x57802f[_0xf97a('0x28')],_0x57802f[_0xf97a('0x2b')]);_0x40a4bd[_0xf97a('0x2e')]=_[_0xf97a('0x2d')](_0x57802f['model'],qs['fields'](_0x321f49[_0xf97a('0x2b')][_0xf97a('0x2f')]));_0x40a4bd[_0xf97a('0x2e')]=_0x40a4bd[_0xf97a('0x2e')][_0xf97a('0x30')]?_0x40a4bd[_0xf97a('0x2e')]:_0x57802f[_0xf97a('0x28')];_0x40a4bd['order']=qs[_0xf97a('0x33')](_0x321f49[_0xf97a('0x2b')][_0xf97a('0x33')]);_0x40a4bd[_0xf97a('0x34')]=qs[_0xf97a('0x36')](_[_0xf97a('0x35')](_0x321f49[_0xf97a('0x2b')],_0x57802f[_0xf97a('0x36')]));if(_0x321f49[_0xf97a('0x2b')]['filter']){_0x40a4bd[_0xf97a('0x34')]=_['merge'](_0x40a4bd['where'],{'$or':_['map'](_0x40a4bd['attributes'],function(_0x1e69eb){var _0x510d2b={};_0x510d2b[_0x1e69eb]={'$like':'%'+_0x321f49[_0xf97a('0x2b')][_0xf97a('0x39')]+'%'};return _0x510d2b;})});}_0x40a4bd=_[_0xf97a('0x3b')]({},_0x40a4bd,_0x321f49[_0xf97a('0x4b')]);return _0x54d68b[_0xf97a('0x52')](_0x40a4bd);}})[_0xf97a('0x1f')](function(_0xe0d068){if(_0xe0d068){_0x41a285=_0xe0d068['length'];if(!_0x321f49[_0xf97a('0x2b')]['hasOwnProperty'](_0xf97a('0x31'))){_0x40a4bd['limit']=qs[_0xf97a('0x1a')](_0x321f49[_0xf97a('0x2b')][_0xf97a('0x1a')]);_0x40a4bd[_0xf97a('0x19')]=qs[_0xf97a('0x19')](_0x321f49[_0xf97a('0x2b')][_0xf97a('0x19')]);}return _0x54d68b[_0xf97a('0x52')](_0x40a4bd);}})[_0xf97a('0x1f')](function(_0x5c176c){if(_0x5c176c){return _0x5c176c?{'count':_0x41a285,'rows':_0x5c176c}:null;}})[_0xf97a('0x1f')](respondWithResult(_0x546cc9,null))[_0xf97a('0x40')](handleError(_0x546cc9,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 86c6088..302a836 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 _0x0c5b=['util','api','moment','./trigger.attributes','exports','define','Trigger'];(function(_0x1fc76c,_0x471f1b){var _0x301c64=function(_0x26f172){while(--_0x26f172){_0x1fc76c['push'](_0x1fc76c['shift']());}};_0x301c64(++_0x471f1b);}(_0x0c5b,0x18f));var _0xb0c5=function(_0x5acbc8,_0x466e3b){_0x5acbc8=_0x5acbc8-0x0;var _0x16392e=_0x0c5b[_0x5acbc8];return _0x16392e;};'use strict';var _=require('lodash');var util=require(_0xb0c5('0x0'));var logger=require('../../config/logger')(_0xb0c5('0x1'));var moment=require(_0xb0c5('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xb0c5('0x3'));module[_0xb0c5('0x4')]=function(_0x3740dd,_0x10417d){return _0x3740dd[_0xb0c5('0x5')](_0xb0c5('0x6'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ea1=['define','Trigger','tools_triggers','lodash','api','moment','bluebird','request-promise','./trigger.attributes'];(function(_0x13af04,_0x34696c){var _0xd04e49=function(_0x3e5475){while(--_0x3e5475){_0x13af04['push'](_0x13af04['shift']());}};_0xd04e49(++_0x34696c);}(_0x3ea1,0x16b));var _0x13ea=function(_0xd92ec8,_0x4d292b){_0xd92ec8=_0xd92ec8-0x0;var _0x281058=_0x3ea1[_0xd92ec8];return _0x281058;};'use strict';var _=require(_0x13ea('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x13ea('0x1'));var moment=require(_0x13ea('0x2'));var BPromise=require(_0x13ea('0x3'));var rp=require(_0x13ea('0x4'));var attributes=require(_0x13ea('0x5'));module['exports']=function(_0x4e66da,_0x3c0edf){return _0x4e66da[_0x13ea('0x6')](_0x13ea('0x7'),attributes,{'tableName':_0x13ea('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 48f379b..5968b93 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 _0x9071=['jayson/promise','client','http','request','then','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','Trigger','raw','options','limit','include','map','model','attributes','GetTrigger','ShowTrigger','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1f1654,_0x1b8cd9){var _0x177547=function(_0x3234ae){while(--_0x3234ae){_0x1f1654['push'](_0x1f1654['shift']());}};_0x177547(++_0x1b8cd9);}(_0x9071,0xce));var _0x1907=function(_0x1842db,_0x3225d7){_0x1842db=_0x1842db-0x0;var _0x16fba2=_0x9071[_0x1842db];return _0x16fba2;};'use strict';var _=require(_0x1907('0x0'));var util=require(_0x1907('0x1'));var moment=require(_0x1907('0x2'));var BPromise=require('bluebird');var rs=require(_0x1907('0x3'));var fs=require('fs');var Redis=require(_0x1907('0x4'));var db=require(_0x1907('0x5'))['db'];var utils=require(_0x1907('0x6'));var logger=require(_0x1907('0x7'))(_0x1907('0x8'));var config=require(_0x1907('0x9'));var jayson=require(_0x1907('0xa'));var client=jayson[_0x1907('0xb')][_0x1907('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5497af,_0x27c1c3,_0x279c82){return new BPromise(function(_0x27cca5,_0x3f1f78){return client[_0x1907('0xd')](_0x5497af,_0x279c82)[_0x1907('0xe')](function(_0x16625b){logger['info'](_0x1907('0xf'),_0x27c1c3,_0x1907('0x10'));logger[_0x1907('0x11')](_0x1907('0x12'),_0x27c1c3,_0x1907('0x10'),JSON[_0x1907('0x13')](_0x16625b));if(_0x16625b[_0x1907('0x14')]){if(_0x16625b['error']['code']===0x1f4){logger[_0x1907('0x14')](_0x1907('0xf'),_0x27c1c3,_0x16625b[_0x1907('0x14')][_0x1907('0x15')]);return _0x3f1f78(_0x16625b[_0x1907('0x14')][_0x1907('0x15')]);}logger[_0x1907('0x14')](_0x1907('0xf'),_0x27c1c3,_0x16625b['error'][_0x1907('0x15')]);return _0x27cca5(_0x16625b[_0x1907('0x14')][_0x1907('0x15')]);}else{logger[_0x1907('0x16')]('Trigger,\x20%s,\x20%s',_0x27c1c3,_0x1907('0x10'));_0x27cca5(_0x16625b[_0x1907('0x17')][_0x1907('0x15')]);}})[_0x1907('0x18')](function(_0x3a282a){logger['error']('Trigger,\x20%s,\x20%s',_0x27c1c3,_0x3a282a);_0x3f1f78(_0x3a282a);});});}exports['GetTrigger']=function(_0x4979dc){var _0x3670bf=this;return new Promise(function(_0x4d93ba,_0x17ae29){return db[_0x1907('0x19')]['findAll']({'raw':_0x4979dc['options']?_0x4979dc['options'][_0x1907('0x1a')]===undefined?!![]:![]:!![],'where':_0x4979dc['options']?_0x4979dc[_0x1907('0x1b')]['where']||null:null,'attributes':_0x4979dc[_0x1907('0x1b')]?_0x4979dc[_0x1907('0x1b')]['attributes']||null:null,'limit':_0x4979dc[_0x1907('0x1b')]?_0x4979dc['options'][_0x1907('0x1c')]||null:null,'include':_0x4979dc[_0x1907('0x1b')]?_0x4979dc[_0x1907('0x1b')][_0x1907('0x1d')]?_[_0x1907('0x1e')](_0x4979dc[_0x1907('0x1b')][_0x1907('0x1d')],function(_0x3e84a3){return{'model':db[_0x3e84a3[_0x1907('0x1f')]],'as':_0x3e84a3['as'],'attributes':_0x3e84a3['attributes'],'include':_0x3e84a3[_0x1907('0x1d')]?_[_0x1907('0x1e')](_0x3e84a3[_0x1907('0x1d')],function(_0x5834e1){return{'model':db[_0x5834e1[_0x1907('0x1f')]],'as':_0x5834e1['as'],'attributes':_0x5834e1['attributes'],'include':_0x5834e1[_0x1907('0x1d')]?_[_0x1907('0x1e')](_0x5834e1[_0x1907('0x1d')],function(_0x2ef2bd){return{'model':db[_0x2ef2bd['model']],'as':_0x2ef2bd['as'],'attributes':_0x2ef2bd[_0x1907('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1907('0xe')](function(_0x1fda1b){logger['info']('GetTrigger',_0x4979dc);logger[_0x1907('0x11')]('GetTrigger',_0x4979dc,JSON[_0x1907('0x13')](_0x1fda1b));_0x4d93ba(_0x1fda1b);})['catch'](function(_0x1e6e71){logger[_0x1907('0x14')](_0x1907('0x21'),_0x1e6e71[_0x1907('0x15')],_0x4979dc);_0x17ae29(_0x3670bf['error'](0x1f4,_0x1e6e71[_0x1907('0x15')]));});});};exports[_0x1907('0x22')]=function(_0x37c3bf){var _0x434e3c=this;return new Promise(function(_0x599620,_0x411c88){return db[_0x1907('0x19')]['find']({'raw':_0x37c3bf[_0x1907('0x1b')]?_0x37c3bf[_0x1907('0x1b')][_0x1907('0x1a')]===undefined?!![]:![]:!![],'where':_0x37c3bf[_0x1907('0x1b')]?_0x37c3bf[_0x1907('0x1b')][_0x1907('0x23')]||null:null,'attributes':_0x37c3bf[_0x1907('0x1b')]?_0x37c3bf[_0x1907('0x1b')]['attributes']||null:null,'include':_0x37c3bf['options']?_0x37c3bf[_0x1907('0x1b')][_0x1907('0x1d')]?_[_0x1907('0x1e')](_0x37c3bf['options'][_0x1907('0x1d')],function(_0x12764d){return{'model':db[_0x12764d[_0x1907('0x1f')]],'as':_0x12764d['as'],'attributes':_0x12764d[_0x1907('0x20')],'include':_0x12764d['include']?_['map'](_0x12764d['include'],function(_0x4f9a31){return{'model':db[_0x4f9a31[_0x1907('0x1f')]],'as':_0x4f9a31['as'],'attributes':_0x4f9a31[_0x1907('0x20')],'include':_0x4f9a31[_0x1907('0x1d')]?_[_0x1907('0x1e')](_0x4f9a31['include'],function(_0x55c5e4){return{'model':db[_0x55c5e4[_0x1907('0x1f')]],'as':_0x55c5e4['as'],'attributes':_0x55c5e4[_0x1907('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x53cab7){logger[_0x1907('0x16')](_0x1907('0x22'),_0x37c3bf);logger['debug'](_0x1907('0x22'),_0x37c3bf,JSON[_0x1907('0x13')](_0x53cab7));_0x599620(_0x53cab7);})['catch'](function(_0x780f6c){logger[_0x1907('0x14')](_0x1907('0x22'),_0x780f6c[_0x1907('0x15')],_0x37c3bf);_0x411c88(_0x434e3c[_0x1907('0x14')](0x1f4,_0x780f6c[_0x1907('0x15')]));});});}; \ No newline at end of file +var _0x44bd=['bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Trigger','findAll','options','raw','where','attributes','limit','include','model','map','GetTrigger','ShowTrigger','debug','lodash','util'];(function(_0x3536ed,_0x25894f){var _0x580b25=function(_0x1ba491){while(--_0x1ba491){_0x3536ed['push'](_0x3536ed['shift']());}};_0x580b25(++_0x25894f);}(_0x44bd,0x196));var _0xd44b=function(_0x16de0d,_0x59bbe2){_0x16de0d=_0x16de0d-0x0;var _0x29d1a8=_0x44bd[_0x16de0d];return _0x29d1a8;};'use strict';var _=require(_0xd44b('0x0'));var util=require(_0xd44b('0x1'));var moment=require('moment');var BPromise=require(_0xd44b('0x2'));var rs=require(_0xd44b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd44b('0x4'));var logger=require('../../config/logger')(_0xd44b('0x5'));var config=require(_0xd44b('0x6'));var jayson=require(_0xd44b('0x7'));var client=jayson[_0xd44b('0x8')][_0xd44b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x579c6f,_0x452073,_0x418b36){return new BPromise(function(_0x3de8ef,_0x562f89){return client['request'](_0x579c6f,_0x418b36)[_0xd44b('0xa')](function(_0x3d37f9){logger[_0xd44b('0xb')](_0xd44b('0xc'),_0x452073,_0xd44b('0xd'));logger['debug'](_0xd44b('0xe'),_0x452073,_0xd44b('0xd'),JSON[_0xd44b('0xf')](_0x3d37f9));if(_0x3d37f9[_0xd44b('0x10')]){if(_0x3d37f9[_0xd44b('0x10')][_0xd44b('0x11')]===0x1f4){logger[_0xd44b('0x10')](_0xd44b('0xc'),_0x452073,_0x3d37f9[_0xd44b('0x10')][_0xd44b('0x12')]);return _0x562f89(_0x3d37f9[_0xd44b('0x10')][_0xd44b('0x12')]);}logger[_0xd44b('0x10')](_0xd44b('0xc'),_0x452073,_0x3d37f9['error']['message']);return _0x3de8ef(_0x3d37f9['error']['message']);}else{logger[_0xd44b('0xb')](_0xd44b('0xc'),_0x452073,_0xd44b('0xd'));_0x3de8ef(_0x3d37f9[_0xd44b('0x13')]['message']);}})[_0xd44b('0x14')](function(_0x48de31){logger[_0xd44b('0x10')](_0xd44b('0xc'),_0x452073,_0x48de31);_0x562f89(_0x48de31);});});}exports['GetTrigger']=function(_0x5a1a2a){var _0x577772=this;return new Promise(function(_0x176f18,_0x37a862){return db[_0xd44b('0x15')][_0xd44b('0x16')]({'raw':_0x5a1a2a[_0xd44b('0x17')]?_0x5a1a2a['options'][_0xd44b('0x18')]===undefined?!![]:![]:!![],'where':_0x5a1a2a[_0xd44b('0x17')]?_0x5a1a2a['options'][_0xd44b('0x19')]||null:null,'attributes':_0x5a1a2a[_0xd44b('0x17')]?_0x5a1a2a[_0xd44b('0x17')][_0xd44b('0x1a')]||null:null,'limit':_0x5a1a2a[_0xd44b('0x17')]?_0x5a1a2a['options'][_0xd44b('0x1b')]||null:null,'include':_0x5a1a2a[_0xd44b('0x17')]?_0x5a1a2a['options'][_0xd44b('0x1c')]?_['map'](_0x5a1a2a['options'][_0xd44b('0x1c')],function(_0x885928){return{'model':db[_0x885928[_0xd44b('0x1d')]],'as':_0x885928['as'],'attributes':_0x885928[_0xd44b('0x1a')],'include':_0x885928[_0xd44b('0x1c')]?_[_0xd44b('0x1e')](_0x885928[_0xd44b('0x1c')],function(_0x1dfb7a){return{'model':db[_0x1dfb7a[_0xd44b('0x1d')]],'as':_0x1dfb7a['as'],'attributes':_0x1dfb7a[_0xd44b('0x1a')],'include':_0x1dfb7a[_0xd44b('0x1c')]?_[_0xd44b('0x1e')](_0x1dfb7a['include'],function(_0x3b850c){return{'model':db[_0x3b850c[_0xd44b('0x1d')]],'as':_0x3b850c['as'],'attributes':_0x3b850c[_0xd44b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x22cd73){logger[_0xd44b('0xb')](_0xd44b('0x1f'),_0x5a1a2a);logger['debug']('GetTrigger',_0x5a1a2a,JSON[_0xd44b('0xf')](_0x22cd73));_0x176f18(_0x22cd73);})[_0xd44b('0x14')](function(_0x4f3602){logger['error'](_0xd44b('0x1f'),_0x4f3602[_0xd44b('0x12')],_0x5a1a2a);_0x37a862(_0x577772['error'](0x1f4,_0x4f3602[_0xd44b('0x12')]));});});};exports[_0xd44b('0x20')]=function(_0x44dc44){var _0x6351fb=this;return new Promise(function(_0xb6f91e,_0x18c27e){return db[_0xd44b('0x15')]['find']({'raw':_0x44dc44[_0xd44b('0x17')]?_0x44dc44[_0xd44b('0x17')][_0xd44b('0x18')]===undefined?!![]:![]:!![],'where':_0x44dc44[_0xd44b('0x17')]?_0x44dc44[_0xd44b('0x17')][_0xd44b('0x19')]||null:null,'attributes':_0x44dc44[_0xd44b('0x17')]?_0x44dc44[_0xd44b('0x17')][_0xd44b('0x1a')]||null:null,'include':_0x44dc44['options']?_0x44dc44[_0xd44b('0x17')]['include']?_[_0xd44b('0x1e')](_0x44dc44[_0xd44b('0x17')][_0xd44b('0x1c')],function(_0x228e37){return{'model':db[_0x228e37['model']],'as':_0x228e37['as'],'attributes':_0x228e37['attributes'],'include':_0x228e37[_0xd44b('0x1c')]?_[_0xd44b('0x1e')](_0x228e37['include'],function(_0x47a86e){return{'model':db[_0x47a86e[_0xd44b('0x1d')]],'as':_0x47a86e['as'],'attributes':_0x47a86e[_0xd44b('0x1a')],'include':_0x47a86e[_0xd44b('0x1c')]?_['map'](_0x47a86e['include'],function(_0x376eaf){return{'model':db[_0x376eaf[_0xd44b('0x1d')]],'as':_0x376eaf['as'],'attributes':_0x376eaf[_0xd44b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd44b('0xa')](function(_0x156728){logger[_0xd44b('0xb')]('ShowTrigger',_0x44dc44);logger[_0xd44b('0x21')]('ShowTrigger',_0x44dc44,JSON[_0xd44b('0xf')](_0x156728));_0xb6f91e(_0x156728);})[_0xd44b('0x14')](function(_0x3ddb50){logger[_0xd44b('0x10')]('ShowTrigger',_0x3ddb50[_0xd44b('0x12')],_0x44dc44);_0x18c27e(_0x6351fb[_0xd44b('0x10')](0x1f4,_0x3ddb50[_0xd44b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index f4e9627..92490d3 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 _0x66e1=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','/:id','isAuthenticated','post','clone','create','update','delete','destroy','exports'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x66e1,0xf7));var _0x166e=function(_0x35af23,_0x9190f6){_0x35af23=_0x35af23-0x0;var _0x340506=_0x66e1[_0x35af23];return _0x340506;};'use strict';var multer=require(_0x166e('0x0'));var util=require(_0x166e('0x1'));var path=require(_0x166e('0x2'));var timeout=require(_0x166e('0x3'));var express=require(_0x166e('0x4'));var router=express['Router']();var auth=require(_0x166e('0x5'));var interaction=require(_0x166e('0x6'));var config=require(_0x166e('0x7'));var controller=require(_0x166e('0x8'));router[_0x166e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x166e('0xa'),auth[_0x166e('0xb')](),controller['show']);router[_0x166e('0xc')]('/:id/clone',auth[_0x166e('0xb')](),controller[_0x166e('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x166e('0xe')]);router['put'](_0x166e('0xa'),auth[_0x166e('0xb')](),controller[_0x166e('0xf')]);router[_0x166e('0x10')](_0x166e('0xa'),auth['isAuthenticated'](),controller[_0x166e('0x11')]);module[_0x166e('0x12')]=router; \ No newline at end of file +var _0x66e3=['/:id/clone','create','put','update','delete','destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x23450f,_0x4401fa){var _0x511591=function(_0x51dbda){while(--_0x51dbda){_0x23450f['push'](_0x23450f['shift']());}};_0x511591(++_0x4401fa);}(_0x66e3,0x16c));var _0x366e=function(_0x3e252a,_0x4dd00f){_0x3e252a=_0x3e252a-0x0;var _0x379a55=_0x66e3[_0x3e252a];return _0x379a55;};'use strict';var multer=require(_0x366e('0x0'));var util=require('util');var path=require(_0x366e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x366e('0x2')]();var auth=require(_0x366e('0x3'));var interaction=require(_0x366e('0x4'));var config=require(_0x366e('0x5'));var controller=require('./trunk.controller');router[_0x366e('0x6')]('/',auth[_0x366e('0x7')](),controller[_0x366e('0x8')]);router[_0x366e('0x6')](_0x366e('0x9'),auth['isAuthenticated'](),controller['show']);router['post'](_0x366e('0xa'),auth[_0x366e('0x7')](),controller['clone']);router['post']('/',auth['isAuthenticated'](),controller[_0x366e('0xb')]);router[_0x366e('0xc')](_0x366e('0x9'),auth[_0x366e('0x7')](),controller[_0x366e('0xd')]);router[_0x366e('0xe')](_0x366e('0x9'),auth[_0x366e('0x7')](),controller[_0x366e('0xf')]);module[_0x366e('0x10')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 405c214..e7348c7 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 _0xd8b0=['update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','always','accept','originate','uac','uas','pai','active','passive','dynamic','update,nonat','BOOLEAN','sequelize','exports','friend','user','peer','STRING','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','ENUM','rfc2833','info','shortinfo','inband','auto','yes','nonat'];(function(_0x34ad72,_0x1e43f6){var _0x5c9aa8=function(_0x144388){while(--_0x144388){_0x34ad72['push'](_0x34ad72['shift']());}};_0x5c9aa8(++_0x1e43f6);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0d8b('0x2'),_0x0d8b('0x3'),_0x0d8b('0x4')),'allowNull':![],'defaultValue':_0x0d8b('0x2')},'context':{'type':Sequelize[_0x0d8b('0x5')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize['ENUM'](_0x0d8b('0x6'),_0x0d8b('0x7'),_0x0d8b('0x8'),'ALLOWED',_0x0d8b('0x9'),_0x0d8b('0xa'),'PROHIB_FAILED_SCREEN',_0x0d8b('0xb'))},'deny':{'type':Sequelize[_0x0d8b('0x5')]},'permit':{'type':Sequelize[_0x0d8b('0x5')]},'secret':{'type':Sequelize[_0x0d8b('0x5')]},'md5secret':{'type':Sequelize[_0x0d8b('0x5')]},'remotesecret':{'type':Sequelize[_0x0d8b('0x5')]},'transport':{'type':Sequelize[_0x0d8b('0x5')],'defaultValue':_0x0d8b('0xc'),'set':function(_0x48fa16){this[_0x0d8b('0xd')]('transport',_0x48fa16?_0x48fa16[_0x0d8b('0xe')](','):null);},'get':function(){return this[_0x0d8b('0xf')](_0x0d8b('0x10'))?this[_0x0d8b('0xf')](_0x0d8b('0x10'))[_0x0d8b('0x11')](','):null;},'comment':_0x0d8b('0x12')},'dtmfmode':{'type':Sequelize[_0x0d8b('0x13')](_0x0d8b('0x14'),_0x0d8b('0x15'),_0x0d8b('0x16'),_0x0d8b('0x17'),_0x0d8b('0x18')),'defaultValue':_0x0d8b('0x14')},'directmedia':{'type':Sequelize['ENUM'](_0x0d8b('0x19'),'no',_0x0d8b('0x1a'),_0x0d8b('0x1b'),_0x0d8b('0x1c')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0d8b('0x13')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x0d8b('0x5')]},'directmediadeny':{'type':Sequelize[_0x0d8b('0x5')]},'nat':{'type':Sequelize[_0x0d8b('0x5')],'defaultValue':_0x0d8b('0x1d'),'set':function(_0x333674){this[_0x0d8b('0xd')](_0x0d8b('0x1e'),_0x333674?_0x333674[_0x0d8b('0xe')](','):null);},'get':function(){return this['getDataValue'](_0x0d8b('0x1e'))?this[_0x0d8b('0xf')](_0x0d8b('0x1e'))[_0x0d8b('0x11')](','):null;},'comment':_0x0d8b('0x1f')},'callgroup':{'type':Sequelize[_0x0d8b('0x5')]},'namedcallgroup':{'type':Sequelize[_0x0d8b('0x5')]},'pickupgroup':{'type':Sequelize[_0x0d8b('0x5')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0d8b('0x5')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0d8b('0x20'),'set':function(_0x2b924f){this[_0x0d8b('0xd')](_0x0d8b('0x21'),_0x2b924f?_0x2b924f[_0x0d8b('0xe')](';'):_0x0d8b('0x20'));},'get':function(){return this[_0x0d8b('0xf')](_0x0d8b('0x21'))?this[_0x0d8b('0xf')]('allow')[_0x0d8b('0x11')](';'):null;},'comment':_0x0d8b('0x22')},'autoframing':{'type':Sequelize['ENUM'](_0x0d8b('0x19'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x0d8b('0x23'),'set':function(_0x234bdd){this[_0x0d8b('0xd')]('insecure',_0x234bdd?_0x234bdd['join'](','):null);},'get':function(){return this[_0x0d8b('0xf')](_0x0d8b('0x24'))?this['getDataValue'](_0x0d8b('0x24'))['split'](','):null;},'comment':_0x0d8b('0x25')},'trustrpid':{'type':Sequelize['ENUM'](_0x0d8b('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x0d8b('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x0d8b('0x19'),'no','never')},'promiscredir':{'type':Sequelize[_0x0d8b('0x13')](_0x0d8b('0x19'),'no')},'useclientcode':{'type':Sequelize[_0x0d8b('0x13')]('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x0d8b('0x5')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x0d8b('0x5')]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x0d8b('0x19')},'busylevel':{'type':Sequelize[_0x0d8b('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0x0d8b('0x13')](_0x0d8b('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x0d8b('0x13')](_0x0d8b('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x0d8b('0x13')](_0x0d8b('0x19'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x0d8b('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0x0d8b('0x5')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x0d8b('0x13')](_0x0d8b('0x19'),'no',_0x0d8b('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x0d8b('0x13')](_0x0d8b('0x19'),'no')},'mailbox':{'type':Sequelize[_0x0d8b('0x5')]},'session_timers':{'type':Sequelize[_0x0d8b('0x13')](_0x0d8b('0x28'),'refuse',_0x0d8b('0x29'))},'session_expires':{'type':Sequelize[_0x0d8b('0x26')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x0d8b('0x13')](_0x0d8b('0x2a'),_0x0d8b('0x2b')),'defaultValue':_0x0d8b('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0x0d8b('0x5')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x0d8b('0x5')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x0d8b('0x19'),'no'),'defaultValue':_0x0d8b('0x19')},'keepalive':{'type':Sequelize[_0x0d8b('0x26')](0xb)},'defaultip':{'type':Sequelize[_0x0d8b('0x5')]},'defaultuser':{'type':Sequelize[_0x0d8b('0x5')]},'rtptimeout':{'type':Sequelize[_0x0d8b('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x0d8b('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0x0d8b('0x13')](_0x0d8b('0x19'),'no',_0x0d8b('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0d8b('0x5')]},'callbackextension':{'type':Sequelize[_0x0d8b('0x5')]},'timert1':{'type':Sequelize[_0x0d8b('0x26')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x0d8b('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0x0d8b('0x5')]},'contactdeny':{'type':Sequelize[_0x0d8b('0x5')]},'contactacl':{'type':Sequelize[_0x0d8b('0x5')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x0d8b('0x5')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x0d8b('0x13')](_0x0d8b('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0d8b('0x13')](_0x0d8b('0x19'),'no')},'force_avp':{'type':Sequelize[_0x0d8b('0x13')](_0x0d8b('0x19'),'no')},'icesupport':{'type':Sequelize[_0x0d8b('0x13')](_0x0d8b('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0x0d8b('0x13')](_0x0d8b('0x19'),'no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x0d8b('0x5')]},'dtlsprivatekey':{'type':Sequelize[_0x0d8b('0x5')]},'dtlscipher':{'type':Sequelize[_0x0d8b('0x5')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x0d8b('0x13')](_0x0d8b('0x2d'),_0x0d8b('0x2e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0d8b('0x5')]},'usereqphone':{'type':Sequelize[_0x0d8b('0x13')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x0d8b('0x5')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x0d8b('0x13')]('yes','no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x0d8b('0x19'),'no')},'vmexten':{'type':Sequelize[_0x0d8b('0x5')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x0d8b('0x5')],'defaultValue':_0x0d8b('0x2f')},'canreinvite':{'type':Sequelize[_0x0d8b('0x13')]('yes','no',_0x0d8b('0x1a'),_0x0d8b('0x1b'),_0x0d8b('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x0d8b('0x5')]},'otherFields':{'type':Sequelize[_0x0d8b('0x5')]},'active':{'type':Sequelize[_0x0d8b('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x0d8b('0x5')],'defaultValue':'no'}}; \ No newline at end of file +var _0x757a=['always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','exports','STRING','user','peer','friend','from-voip-provider','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','shortinfo','inband','auto','rfc2833','yes','nonat','update','outgoing','nat','join','getDataValue','split','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>'];(function(_0x288333,_0x38deee){var _0x51aa08=function(_0x343c71){while(--_0x343c71){_0x288333['push'](_0x288333['shift']());}};_0x51aa08(++_0x38deee);}(_0x757a,0xde));var _0xa757=function(_0x82b5c6,_0xc25cc4){_0x82b5c6=_0x82b5c6-0x0;var _0x3bebf6=_0x757a[_0x82b5c6];return _0x3bebf6;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('friend',_0xa757('0x2'),_0xa757('0x3')),'allowNull':![],'defaultValue':_0xa757('0x4')},'context':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'defaultValue':_0xa757('0x5')},'callingpres':{'type':Sequelize[_0xa757('0x6')]('ALLOWED_NOT_SCREENED',_0xa757('0x7'),_0xa757('0x8'),'ALLOWED',_0xa757('0x9'),_0xa757('0xa'),_0xa757('0xb'),_0xa757('0xc'))},'deny':{'type':Sequelize[_0xa757('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xa757('0x1')]},'md5secret':{'type':Sequelize[_0xa757('0x1')]},'remotesecret':{'type':Sequelize[_0xa757('0x1')]},'transport':{'type':Sequelize[_0xa757('0x1')],'defaultValue':_0xa757('0xd'),'set':function(_0x188ad5){this[_0xa757('0xe')]('transport',_0x188ad5?_0x188ad5['join'](','):null);},'get':function(){return this['getDataValue']('transport')?this['getDataValue'](_0xa757('0xf'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xa757('0x6')]('rfc2833','info',_0xa757('0x10'),_0xa757('0x11'),_0xa757('0x12')),'defaultValue':_0xa757('0x13')},'directmedia':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no',_0xa757('0x15'),_0xa757('0x16'),_0xa757('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xa757('0x6')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa757('0x1')]},'directmediadeny':{'type':Sequelize[_0xa757('0x1')]},'nat':{'type':Sequelize[_0xa757('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x54b305){this[_0xa757('0xe')](_0xa757('0x18'),_0x54b305?_0x54b305[_0xa757('0x19')](','):null);},'get':function(){return this[_0xa757('0x1a')](_0xa757('0x18'))?this[_0xa757('0x1a')]('nat')[_0xa757('0x1b')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xa757('0x1')]},'namedcallgroup':{'type':Sequelize[_0xa757('0x1')]},'pickupgroup':{'type':Sequelize[_0xa757('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xa757('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xa757('0x1')],'defaultValue':_0xa757('0x1c')},'allow':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'defaultValue':_0xa757('0x1d'),'set':function(_0x1d6e2){this[_0xa757('0xe')](_0xa757('0x1e'),_0x1d6e2?_0x1d6e2[_0xa757('0x19')](';'):_0xa757('0x1d'));},'get':function(){return this['getDataValue'](_0xa757('0x1e'))?this['getDataValue'](_0xa757('0x1e'))['split'](';'):null;},'comment':_0xa757('0x1f')},'autoframing':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0xa757('0x20'),'set':function(_0xcd98bd){this[_0xa757('0xe')](_0xa757('0x21'),_0xcd98bd?_0xcd98bd['join'](','):null);},'get':function(){return this[_0xa757('0x1a')]('insecure')?this['getDataValue']('insecure')['split'](','):null;},'comment':_0xa757('0x22')},'trustrpid':{'type':Sequelize['ENUM'](_0xa757('0x14'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xa757('0x6')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xa757('0x6')]('yes','no',_0xa757('0x23'))},'promiscredir':{'type':Sequelize[_0xa757('0x6')]('yes','no')},'useclientcode':{'type':Sequelize[_0xa757('0x6')]('yes','no')},'accountcode':{'type':Sequelize[_0xa757('0x24')](0xb)},'setvar':{'type':Sequelize[_0xa757('0x1')]},'callerid':{'type':Sequelize[_0xa757('0x1')],'defaultValue':_0xa757('0x25')},'amaflags':{'type':Sequelize[_0xa757('0x1')]},'callcounter':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no'),'defaultValue':_0xa757('0x14')},'busylevel':{'type':Sequelize[_0xa757('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no')},'allowsubscribe':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no')},'allowtransfer':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no')},'ignoresdpversion':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no')},'subscribecontext':{'type':Sequelize[_0xa757('0x1')]},'template':{'type':Sequelize[_0xa757('0x1')]},'videosupport':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no',_0xa757('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa757('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xa757('0x6')]('yes','no')},'mailbox':{'type':Sequelize[_0xa757('0x1')]},'session_timers':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x27'),_0xa757('0x28'),_0xa757('0x29'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xa757('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x2a'),_0xa757('0x2b')),'defaultValue':_0xa757('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0xa757('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0xa757('0x1')]},'fromuser':{'type':Sequelize[_0xa757('0x1')]},'port':{'type':Sequelize[_0xa757('0x24')](0x5)},'qualify':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no'),'defaultValue':_0xa757('0x14')},'keepalive':{'type':Sequelize[_0xa757('0x24')](0xb)},'defaultip':{'type':Sequelize[_0xa757('0x1')]},'defaultuser':{'type':Sequelize[_0xa757('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xa757('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xa757('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no',_0xa757('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xa757('0x1')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xa757('0x24')](0xb)},'timerb':{'type':Sequelize[_0xa757('0x24')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xa757('0x1')]},'contactacl':{'type':Sequelize[_0xa757('0x1')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xa757('0x24')](0xb)},'encryption':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xa757('0x14'),'no')},'force_avp':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no')},'icesupport':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xa757('0x14'),'no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0xa757('0x2d'),_0xa757('0x2e'))},'dtlsrekey':{'type':Sequelize[_0xa757('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0xa757('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0xa757('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xa757('0x1')]},'dtlssetup':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x2f'),_0xa757('0x30'),_0xa757('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xa757('0x1')]},'usereqphone':{'type':Sequelize['ENUM'](_0xa757('0x14'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xa757('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xa757('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xa757('0x14'),'no')},'subscribemwi':{'type':Sequelize[_0xa757('0x6')]('yes','no')},'vmexten':{'type':Sequelize[_0xa757('0x1')]},'mohinterpret':{'type':Sequelize[_0xa757('0x1')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xa757('0x1')]},'description':{'type':Sequelize[_0xa757('0x1')]},'host':{'type':Sequelize[_0xa757('0x1')],'defaultValue':_0xa757('0x32')},'canreinvite':{'type':Sequelize['ENUM'](_0xa757('0x14'),'no',_0xa757('0x15'),_0xa757('0x16'),_0xa757('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xa757('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'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 edc0831..25fe3f2 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 _0x3003=['squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','status','end','json','offset','limit','set','Content-Range','apply','save','update','sendStatus','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','add','day','filter','merge','map','Trunk','count','includeAll','include','findAll','rows','params','options','find','clone','get','createdAt','body','omit','create','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_trunks.conf','destroy','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','path','to-csv','ejs'];(function(_0x16b3bc,_0x10bb58){var _0x4784b7=function(_0x4c8896){while(--_0x4c8896){_0x16b3bc['push'](_0x16b3bc['shift']());}};_0x4784b7(++_0x10bb58);}(_0x3003,0x1d8));var _0x3300=function(_0x7c53fd,_0x545d44){_0x7c53fd=_0x7c53fd-0x0;var _0x14e282=_0x3003[_0x7c53fd];return _0x14e282;};'use strict';var pdf=require(_0x3300('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3300('0x1'));var zipdir=require(_0x3300('0x2'));var jsonpatch=require(_0x3300('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3300('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3300('0x5'));var sox=require('sox');var csv=require(_0x3300('0x6'));var ejs=require(_0x3300('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3300('0x8'));var crypto=require(_0x3300('0x9'));var jsforce=require(_0x3300('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3300('0xb'));var Papa=require(_0x3300('0xc'));var Redis=require(_0x3300('0xd'));var qs=require(_0x3300('0xe'));var logger=require('../../config/logger')(_0x3300('0xf'));var utils=require(_0x3300('0x10'));var config=require(_0x3300('0x11'));var db=require(_0x3300('0x12'))['db'];var jayson=require(_0x3300('0x13'));var client=jayson[_0x3300('0x14')][_0x3300('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x552eac,_0x2c1920,_0x4fa1fb,_0x1aeee7){return new BPromise(function(_0x1c644c,_0xcc14d){var _0x310733=_0x1aeee7||client;return _0x310733[_0x3300('0x16')](_0x552eac,_0x4fa1fb)[_0x3300('0x17')](function(_0xa82ef1){logger[_0x3300('0x18')](_0x3300('0x19'),_0x2c1920,'request\x20sent');logger[_0x3300('0x1a')]('Trunk,\x20%s,\x20%s,\x20%s',_0x2c1920,_0x3300('0x1b'),JSON['stringify'](_0xa82ef1));if(_0xa82ef1[_0x3300('0x1c')]){if(_0xa82ef1[_0x3300('0x1c')][_0x3300('0x1d')]===0x1f4){logger[_0x3300('0x1c')](_0x3300('0x19'),_0x2c1920,_0xa82ef1[_0x3300('0x1c')][_0x3300('0x1e')]);return _0xcc14d(_0xa82ef1[_0x3300('0x1c')][_0x3300('0x1e')]);}logger[_0x3300('0x1c')](_0x3300('0x19'),_0x2c1920,_0xa82ef1[_0x3300('0x1c')][_0x3300('0x1e')]);return _0x1c644c(_0xa82ef1[_0x3300('0x1c')][_0x3300('0x1e')]);}else{logger[_0x3300('0x18')](_0x3300('0x19'),_0x2c1920,_0x3300('0x1b'));_0x1c644c(_0xa82ef1[_0x3300('0x1f')]['message']);}})[_0x3300('0x20')](function(_0x5b2d89){logger[_0x3300('0x1c')](_0x3300('0x19'),_0x2c1920,_0x5b2d89);_0xcc14d(_0x5b2d89);});});}function respondWithStatusCode(_0x5e5655,_0x28d31d){_0x28d31d=_0x28d31d||0xcc;return function(_0x1bc39e){if(_0x1bc39e){return _0x5e5655['sendStatus'](_0x28d31d);}return _0x5e5655[_0x3300('0x21')](_0x28d31d)[_0x3300('0x22')]();};}function respondWithResult(_0x4ee45e,_0x427af6){_0x427af6=_0x427af6||0xc8;return function(_0x365a88){if(_0x365a88){return _0x4ee45e['status'](_0x427af6)[_0x3300('0x23')](_0x365a88);}};}function respondWithFilteredResult(_0x3a3984,_0x106848){return function(_0x2c484e){if(_0x2c484e){var _0x4f7f30=_0x2c484e['count'],_0x5e0c74=_0x106848[_0x3300('0x24')],_0x1cb129=_0x106848[_0x3300('0x24')]+_0x106848[_0x3300('0x25')],_0x3ced08;if(_0x1cb129>=_0x4f7f30){_0x1cb129=_0x4f7f30;_0x3ced08=0xc8;}else{_0x3ced08=0xce;}_0x3a3984[_0x3300('0x21')](_0x3ced08);return _0x3a3984[_0x3300('0x26')](_0x3300('0x27'),_0x5e0c74+'-'+_0x1cb129+'/'+_0x4f7f30)[_0x3300('0x23')](_0x2c484e);}return null;};}function patchUpdates(_0x664904){return function(_0x3d2e51){try{jsonpatch[_0x3300('0x28')](_0x3d2e51,_0x664904,!![]);}catch(_0x2f7bbb){return BPromise['reject'](_0x2f7bbb);}return _0x3d2e51[_0x3300('0x29')]();};}function saveUpdates(_0x29e9ad,_0x221f55){return function(_0x1ed766){if(_0x1ed766){return _0x1ed766[_0x3300('0x2a')](_0x29e9ad)[_0x3300('0x17')](function(_0x428011){return _0x428011;});}return null;};}function removeEntity(_0x4b362f,_0x231846){return function(_0x485229){if(_0x485229){return _0x485229['destroy']()[_0x3300('0x17')](function(){_0x4b362f['status'](0xcc)[_0x3300('0x22')]();});}};}function handleEntityNotFound(_0x5ed5ac,_0x3349db){return function(_0x1d6f86){if(!_0x1d6f86){_0x5ed5ac[_0x3300('0x2b')](0x194);}return _0x1d6f86;};}function handleError(_0x3b9d46,_0x6b1aa2){_0x6b1aa2=_0x6b1aa2||0x1f4;return function(_0x33104a){logger[_0x3300('0x1c')](_0x33104a['stack']);if(_0x33104a[_0x3300('0x2c')]){delete _0x33104a[_0x3300('0x2c')];}_0x3b9d46[_0x3300('0x21')](_0x6b1aa2)[_0x3300('0x2d')](_0x33104a);};}exports[_0x3300('0x2e')]=function(_0x5d46f8,_0x5619d1){var _0x2b2229={},_0x5f5455={},_0x45e0ea={'count':0x0,'rows':[]};var _0x4c3d2a=db['Trunk'][_0x3300('0x2f')];_0x5f5455[_0x3300('0x30')]=_[_0x3300('0x31')](_0x4c3d2a);var _0x6cc9a0={'dateStart':_0x5d46f8[_0x3300('0x32')][_0x3300('0x33')],'dateEnd':_0x5d46f8[_0x3300('0x32')][_0x3300('0x34')]};delete _0x5d46f8[_0x3300('0x32')]['dateStart'];delete _0x5d46f8[_0x3300('0x32')][_0x3300('0x34')];_0x5f5455[_0x3300('0x32')]=_['keys'](_0x5d46f8[_0x3300('0x32')]);_0x5f5455[_0x3300('0x35')]=_[_0x3300('0x36')](_0x5f5455[_0x3300('0x30')],_0x5f5455[_0x3300('0x32')]);_0x2b2229[_0x3300('0x37')]=_[_0x3300('0x36')](_0x5f5455[_0x3300('0x30')],qs['fields'](_0x5d46f8[_0x3300('0x32')][_0x3300('0x38')]));_0x2b2229[_0x3300('0x37')]=_0x2b2229[_0x3300('0x37')][_0x3300('0x39')]?_0x2b2229['attributes']:_0x5f5455[_0x3300('0x30')];if(!_0x5d46f8[_0x3300('0x32')][_0x3300('0x3a')]('nolimit')){_0x2b2229[_0x3300('0x25')]=qs[_0x3300('0x25')](_0x5d46f8[_0x3300('0x32')][_0x3300('0x25')]);_0x2b2229[_0x3300('0x24')]=qs[_0x3300('0x24')](_0x5d46f8[_0x3300('0x32')][_0x3300('0x24')]);}_0x2b2229[_0x3300('0x3b')]=qs[_0x3300('0x3c')](_0x5d46f8[_0x3300('0x32')][_0x3300('0x3c')]);_0x2b2229[_0x3300('0x3d')]=qs[_0x3300('0x35')](_['pick'](_0x5d46f8[_0x3300('0x32')],_0x5f5455['filters']));if(_0x6cc9a0['dateStart']){if(_0x6cc9a0['dateEnd']){_0x6cc9a0[_0x3300('0x34')]=moment(_0x6cc9a0[_0x3300('0x34')])[_0x3300('0x3e')](0x1,_0x3300('0x3f'));}else{_0x6cc9a0[_0x3300('0x34')]=moment(_0x6cc9a0[_0x3300('0x33')])['add'](0x1,'day');}_['merge'](_0x2b2229['where'],{'createdAt':{'$gte':_0x6cc9a0[_0x3300('0x33')],'$lte':_0x6cc9a0['dateEnd']}});}if(_0x5d46f8['query'][_0x3300('0x40')]){_0x2b2229[_0x3300('0x3d')]=_[_0x3300('0x41')](_0x2b2229[_0x3300('0x3d')],{'$or':_[_0x3300('0x42')](_0x2b2229[_0x3300('0x37')],function(_0x3bb58b){var _0x19cf83={};_0x19cf83[_0x3bb58b]={'$like':'%'+_0x5d46f8[_0x3300('0x32')][_0x3300('0x40')]+'%'};return _0x19cf83;})});}_0x2b2229=_['merge']({},_0x2b2229,_0x5d46f8['options']);var _0x52054a={'where':_0x2b2229[_0x3300('0x3d')]};return db[_0x3300('0x43')]['count'](_0x52054a)[_0x3300('0x17')](function(_0x404d1b){_0x45e0ea[_0x3300('0x44')]=_0x404d1b;if(_0x5d46f8[_0x3300('0x32')][_0x3300('0x45')]){_0x2b2229[_0x3300('0x46')]=[{'all':!![]}];}return db[_0x3300('0x43')][_0x3300('0x47')](_0x2b2229);})[_0x3300('0x17')](function(_0x5b2109){_0x45e0ea[_0x3300('0x48')]=_0x5b2109;return _0x45e0ea;})['then'](respondWithFilteredResult(_0x5619d1,_0x2b2229))[_0x3300('0x20')](handleError(_0x5619d1,null));};exports['show']=function(_0x43a6f8,_0x180d52){var _0x131767={'raw':![],'where':{'id':_0x43a6f8[_0x3300('0x49')]['id']}},_0x9bd75e={};_0x9bd75e[_0x3300('0x30')]=_[_0x3300('0x31')](db['Trunk'][_0x3300('0x2f')]);_0x9bd75e[_0x3300('0x32')]=_[_0x3300('0x31')](_0x43a6f8[_0x3300('0x32')]);_0x9bd75e[_0x3300('0x35')]=_['intersection'](_0x9bd75e[_0x3300('0x30')],_0x9bd75e['query']);_0x131767[_0x3300('0x37')]=_[_0x3300('0x36')](_0x9bd75e[_0x3300('0x30')],qs[_0x3300('0x38')](_0x43a6f8[_0x3300('0x32')]['fields']));_0x131767['attributes']=_0x131767[_0x3300('0x37')]['length']?_0x131767[_0x3300('0x37')]:_0x9bd75e[_0x3300('0x30')];if(_0x43a6f8[_0x3300('0x32')][_0x3300('0x45')]){_0x131767['include']=[{'all':!![]}];}_0x131767=_[_0x3300('0x41')]({},_0x131767,_0x43a6f8[_0x3300('0x4a')]);return db['Trunk'][_0x3300('0x4b')](_0x131767)[_0x3300('0x17')](handleEntityNotFound(_0x180d52,null))['then'](respondWithResult(_0x180d52,null))[_0x3300('0x20')](handleError(_0x180d52,null));};exports[_0x3300('0x4c')]=function(_0x1dac08,_0xc1826){var _0x3ce1d5={'raw':![],'where':{'id':_0x1dac08['params']['id']}},_0x189c7a={};_0x189c7a[_0x3300('0x30')]=_[_0x3300('0x31')](db[_0x3300('0x43')]['rawAttributes']);_0x3ce1d5[_0x3300('0x37')]=_[_0x3300('0x36')](_0x189c7a[_0x3300('0x30')],qs[_0x3300('0x38')](_0x1dac08[_0x3300('0x32')][_0x3300('0x38')]));_0x3ce1d5[_0x3300('0x37')]=_0x3ce1d5[_0x3300('0x37')][_0x3300('0x39')]?_0x3ce1d5[_0x3300('0x37')]:_0x189c7a[_0x3300('0x30')];if(_0x1dac08[_0x3300('0x32')][_0x3300('0x45')]){_0x3ce1d5['include']=[{'all':!![]}];}_0x3ce1d5=_[_0x3300('0x41')]({},_0x3ce1d5,_0x1dac08[_0x3300('0x4a')]);return db[_0x3300('0x43')][_0x3300('0x4b')](_0x3ce1d5)['then'](handleEntityNotFound(_0xc1826,null))[_0x3300('0x17')](function(_0x3b6ae6){if(_0x3b6ae6){var _0x275f07=_0x3b6ae6[_0x3300('0x4d')]({'plain':!![]});_0x275f07=qs['omit'](_0x275f07,['id',_0x3300('0x4e'),'updatedAt']);_0x1dac08[_0x3300('0x4f')]=_[_0x3300('0x50')](_0x1dac08[_0x3300('0x4f')],['id',_0x3300('0x4e'),'updatedAt']);return db[_0x3300('0x43')][_0x3300('0x51')](_['merge'](_0x275f07,_0x1dac08['body']),{'include':_0x1dac08[_0x3300('0x32')][_0x3300('0x45')]?[{'all':!![]}]:undefined});}})[_0x3300('0x17')](respondWithResult(_0xc1826,0xc9))[_0x3300('0x20')](handleError(_0xc1826,null));};exports['create']=function(_0x248409,_0x1ee8e1,_0x1985e7){var _0x13431f;return db[_0x3300('0x43')][_0x3300('0x51')](_0x248409[_0x3300('0x4f')],{'raw':!![]})['then'](function(_0x4341d4){_0x13431f=_0x4341d4;return db['Trunk'][_0x3300('0x47')]({'raw':!![]});})[_0x3300('0x17')](function(_0x2b4503){var _0x309554=fs[_0x3300('0x52')](path[_0x3300('0x53')](config[_0x3300('0x54')],_0x3300('0x55')),_0x3300('0x56'));var _0x186f76=fs[_0x3300('0x52')](path['join'](config[_0x3300('0x54')],'server/files/templates/registry.ejs'),_0x3300('0x56'));var _0x16c7cb=ejs[_0x3300('0x57')](_0x309554,{'trunks':_0x2b4503||[]});fs[_0x3300('0x58')]('/etc/asterisk/sip_xcally_trunks.conf',_0x16c7cb);if(_0x13431f[_0x3300('0x59')]){var _0x3d3fe3=ejs[_0x3300('0x57')](_0x186f76,{'trunks':_0x2b4503||[]});fs[_0x3300('0x58')](_0x3300('0x5a'),_0x3d3fe3);}})['then'](function(){return respondWithRpcPromise(_0x3300('0x5b'),_0x3300('0x51'),{'module':_0x3300('0x5c')});})[_0x3300('0x17')](function(){return _0x13431f;})['then'](respondWithResult(_0x1ee8e1,0xc9))[_0x3300('0x20')](handleError(_0x1ee8e1,null));};exports[_0x3300('0x2a')]=function(_0x427d57,_0x356088,_0x2527e9){var _0x26b355;return db[_0x3300('0x43')]['find']({'where':{'id':_0x427d57[_0x3300('0x49')]['id']}})[_0x3300('0x17')](handleEntityNotFound(_0x356088,null))[_0x3300('0x17')](saveUpdates(_0x427d57['body'],null))[_0x3300('0x17')](function(_0xd57db){if(_0xd57db){_0x26b355=_0xd57db;return db[_0x3300('0x43')]['findAll']({'raw':!![]});}})[_0x3300('0x17')](function(_0x553ca4){if(_0x553ca4){var _0x407195=fs['readFileSync'](path['join'](config[_0x3300('0x54')],_0x3300('0x55')),'utf8');var _0x4c0559=fs[_0x3300('0x52')](path['join'](config[_0x3300('0x54')],_0x3300('0x5d')),'utf8');var _0x28b18d=ejs['render'](_0x407195,{'trunks':_0x553ca4||[]});fs[_0x3300('0x58')](_0x3300('0x5e'),_0x28b18d);var _0x27db7f=ejs[_0x3300('0x57')](_0x4c0559,{'trunks':_0x553ca4||[]});fs['writeFileSync'](_0x3300('0x5a'),_0x27db7f);return respondWithRpcPromise('Reload',_0x3300('0x2a'),{'module':_0x3300('0x5c')});}return null;})[_0x3300('0x17')](function(_0x2c85a5){if(_0x2c85a5){return _0x26b355;}})[_0x3300('0x17')](respondWithResult(_0x356088,null))[_0x3300('0x20')](handleError(_0x356088,null));};exports[_0x3300('0x5f')]=function(_0x5dc856,_0x52c23a,_0x37c2f2){var _0x521104;return db['Trunk'][_0x3300('0x4b')]({'where':{'id':_0x5dc856['params']['id']}})['then'](handleEntityNotFound(_0x52c23a,null))[_0x3300('0x17')](removeEntity(_0x52c23a,null))[_0x3300('0x17')](function(){return db[_0x3300('0x43')]['findAll']({'raw':!![]});})[_0x3300('0x17')](function(_0x5a00e2){var _0x30870d=fs['readFileSync'](path[_0x3300('0x53')](config[_0x3300('0x54')],_0x3300('0x55')),_0x3300('0x56'));var _0x4683ac=fs[_0x3300('0x52')](path[_0x3300('0x53')](config['root'],_0x3300('0x5d')),_0x3300('0x56'));var _0x5ab589=ejs[_0x3300('0x57')](_0x30870d,{'trunks':_0x5a00e2});var _0x11df3e=ejs[_0x3300('0x57')](_0x4683ac,{'trunks':_0x5a00e2});fs[_0x3300('0x58')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5ab589);fs[_0x3300('0x58')](_0x3300('0x5a'),_0x11df3e);return respondWithRpcPromise(_0x3300('0x5b'),_0x3300('0x5f'),{'module':'chan_sip.so'});})[_0x3300('0x20')](handleError(_0x52c23a,null));}; \ No newline at end of file +var _0x08f6=['message','result','end','status','count','offset','set','Content-Range','apply','save','update','sendStatus','name','send','index','Trunk','rawAttributes','model','query','dateStart','dateEnd','keys','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filters','pick','add','day','merge','filter','map','options','includeAll','include','findAll','rows','catch','show','params','find','clone','get','omit','createdAt','updatedAt','body','create','readFileSync','root','server/files/templates/registry.ejs','render','registry','writeFileSync','join','utf8','/etc/asterisk/sip_xcally_trunks.conf','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','destroy','server/files/templates/trunk.ejs','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x35dfd7,_0x416c8e){var _0x5ea0f4=function(_0x5bb93b){while(--_0x5bb93b){_0x35dfd7['push'](_0x35dfd7['shift']());}};_0x5ea0f4(++_0x416c8e);}(_0x08f6,0x10b));var _0x608f=function(_0x54a2e4,_0x1ff92c){_0x54a2e4=_0x54a2e4-0x0;var _0x4742d0=_0x08f6[_0x54a2e4];return _0x4742d0;};'use strict';var pdf=require(_0x608f('0x0'));var emlformat=require(_0x608f('0x1'));var rimraf=require(_0x608f('0x2'));var zipdir=require(_0x608f('0x3'));var jsonpatch=require(_0x608f('0x4'));var rp=require('request-promise');var moment=require(_0x608f('0x5'));var BPromise=require(_0x608f('0x6'));var Mustache=require('mustache');var util=require(_0x608f('0x7'));var path=require('path');var sox=require(_0x608f('0x8'));var csv=require(_0x608f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x608f('0xa'));var jsforce=require(_0x608f('0xb'));var deskjs=require(_0x608f('0xc'));var toCsv=require(_0x608f('0x9'));var querystring=require(_0x608f('0xd'));var Papa=require(_0x608f('0xe'));var Redis=require('ioredis');var qs=require(_0x608f('0xf'));var logger=require(_0x608f('0x10'))(_0x608f('0x11'));var utils=require(_0x608f('0x12'));var config=require(_0x608f('0x13'));var db=require(_0x608f('0x14'))['db'];var jayson=require(_0x608f('0x15'));var client=jayson[_0x608f('0x16')][_0x608f('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x57885f,_0x37f38f,_0x110a00,_0xf8b60d){return new BPromise(function(_0x529017,_0x4229fb){var _0x66d44a=_0xf8b60d||client;return _0x66d44a[_0x608f('0x18')](_0x57885f,_0x110a00)[_0x608f('0x19')](function(_0x44fac9){logger[_0x608f('0x1a')](_0x608f('0x1b'),_0x37f38f,_0x608f('0x1c'));logger['debug'](_0x608f('0x1d'),_0x37f38f,_0x608f('0x1c'),JSON[_0x608f('0x1e')](_0x44fac9));if(_0x44fac9['error']){if(_0x44fac9[_0x608f('0x1f')][_0x608f('0x20')]===0x1f4){logger[_0x608f('0x1f')](_0x608f('0x1b'),_0x37f38f,_0x44fac9['error']['message']);return _0x4229fb(_0x44fac9[_0x608f('0x1f')][_0x608f('0x21')]);}logger['error'](_0x608f('0x1b'),_0x37f38f,_0x44fac9[_0x608f('0x1f')]['message']);return _0x529017(_0x44fac9[_0x608f('0x1f')][_0x608f('0x21')]);}else{logger[_0x608f('0x1a')](_0x608f('0x1b'),_0x37f38f,_0x608f('0x1c'));_0x529017(_0x44fac9[_0x608f('0x22')][_0x608f('0x21')]);}})['catch'](function(_0xee33c9){logger[_0x608f('0x1f')](_0x608f('0x1b'),_0x37f38f,_0xee33c9);_0x4229fb(_0xee33c9);});});}function respondWithStatusCode(_0x285904,_0x3eee4f){_0x3eee4f=_0x3eee4f||0xcc;return function(_0x4b07e9){if(_0x4b07e9){return _0x285904['sendStatus'](_0x3eee4f);}return _0x285904['status'](_0x3eee4f)[_0x608f('0x23')]();};}function respondWithResult(_0xbedace,_0x484dba){_0x484dba=_0x484dba||0xc8;return function(_0x26ecfc){if(_0x26ecfc){return _0xbedace[_0x608f('0x24')](_0x484dba)['json'](_0x26ecfc);}};}function respondWithFilteredResult(_0x2e9f6b,_0x3b9853){return function(_0x3feeef){if(_0x3feeef){var _0x2c147b=_0x3feeef[_0x608f('0x25')],_0x32165b=_0x3b9853[_0x608f('0x26')],_0x3322c2=_0x3b9853[_0x608f('0x26')]+_0x3b9853['limit'],_0x3ca939;if(_0x3322c2>=_0x2c147b){_0x3322c2=_0x2c147b;_0x3ca939=0xc8;}else{_0x3ca939=0xce;}_0x2e9f6b[_0x608f('0x24')](_0x3ca939);return _0x2e9f6b[_0x608f('0x27')](_0x608f('0x28'),_0x32165b+'-'+_0x3322c2+'/'+_0x2c147b)['json'](_0x3feeef);}return null;};}function patchUpdates(_0x4fa20a){return function(_0x1264d9){try{jsonpatch[_0x608f('0x29')](_0x1264d9,_0x4fa20a,!![]);}catch(_0xef2aba){return BPromise['reject'](_0xef2aba);}return _0x1264d9[_0x608f('0x2a')]();};}function saveUpdates(_0xb2ccf6,_0x43a797){return function(_0x57f081){if(_0x57f081){return _0x57f081[_0x608f('0x2b')](_0xb2ccf6)['then'](function(_0x53c3dd){return _0x53c3dd;});}return null;};}function removeEntity(_0x44db1a,_0x24d89d){return function(_0x560730){if(_0x560730){return _0x560730['destroy']()[_0x608f('0x19')](function(){_0x44db1a[_0x608f('0x24')](0xcc)[_0x608f('0x23')]();});}};}function handleEntityNotFound(_0x41802f,_0x44835e){return function(_0x38aa95){if(!_0x38aa95){_0x41802f[_0x608f('0x2c')](0x194);}return _0x38aa95;};}function handleError(_0x1f8f47,_0x11d288){_0x11d288=_0x11d288||0x1f4;return function(_0x426d5f){logger[_0x608f('0x1f')](_0x426d5f['stack']);if(_0x426d5f[_0x608f('0x2d')]){delete _0x426d5f[_0x608f('0x2d')];}_0x1f8f47[_0x608f('0x24')](_0x11d288)[_0x608f('0x2e')](_0x426d5f);};}exports[_0x608f('0x2f')]=function(_0x508d58,_0x1126f5){var _0x24d4c6={},_0x1a1edc={},_0x16e08c={'count':0x0,'rows':[]};var _0x5cf863=db[_0x608f('0x30')][_0x608f('0x31')];_0x1a1edc[_0x608f('0x32')]=_['keys'](_0x5cf863);var _0x53d11f={'dateStart':_0x508d58[_0x608f('0x33')][_0x608f('0x34')],'dateEnd':_0x508d58[_0x608f('0x33')][_0x608f('0x35')]};delete _0x508d58['query'][_0x608f('0x34')];delete _0x508d58[_0x608f('0x33')][_0x608f('0x35')];_0x1a1edc[_0x608f('0x33')]=_[_0x608f('0x36')](_0x508d58['query']);_0x1a1edc['filters']=_[_0x608f('0x37')](_0x1a1edc['model'],_0x1a1edc[_0x608f('0x33')]);_0x24d4c6['attributes']=_[_0x608f('0x37')](_0x1a1edc['model'],qs[_0x608f('0x38')](_0x508d58[_0x608f('0x33')][_0x608f('0x38')]));_0x24d4c6[_0x608f('0x39')]=_0x24d4c6[_0x608f('0x39')][_0x608f('0x3a')]?_0x24d4c6[_0x608f('0x39')]:_0x1a1edc[_0x608f('0x32')];if(!_0x508d58[_0x608f('0x33')]['hasOwnProperty'](_0x608f('0x3b'))){_0x24d4c6[_0x608f('0x3c')]=qs[_0x608f('0x3c')](_0x508d58['query'][_0x608f('0x3c')]);_0x24d4c6['offset']=qs[_0x608f('0x26')](_0x508d58[_0x608f('0x33')][_0x608f('0x26')]);}_0x24d4c6[_0x608f('0x3d')]=qs['sort'](_0x508d58[_0x608f('0x33')][_0x608f('0x3e')]);_0x24d4c6[_0x608f('0x3f')]=qs[_0x608f('0x40')](_[_0x608f('0x41')](_0x508d58[_0x608f('0x33')],_0x1a1edc[_0x608f('0x40')]));if(_0x53d11f[_0x608f('0x34')]){if(_0x53d11f[_0x608f('0x35')]){_0x53d11f[_0x608f('0x35')]=moment(_0x53d11f[_0x608f('0x35')])[_0x608f('0x42')](0x1,_0x608f('0x43'));}else{_0x53d11f[_0x608f('0x35')]=moment(_0x53d11f['dateStart'])[_0x608f('0x42')](0x1,_0x608f('0x43'));}_[_0x608f('0x44')](_0x24d4c6['where'],{'createdAt':{'$gte':_0x53d11f[_0x608f('0x34')],'$lte':_0x53d11f[_0x608f('0x35')]}});}if(_0x508d58[_0x608f('0x33')][_0x608f('0x45')]){_0x24d4c6['where']=_[_0x608f('0x44')](_0x24d4c6[_0x608f('0x3f')],{'$or':_[_0x608f('0x46')](_0x24d4c6[_0x608f('0x39')],function(_0x4681a1){var _0x2bd982={};_0x2bd982[_0x4681a1]={'$like':'%'+_0x508d58[_0x608f('0x33')][_0x608f('0x45')]+'%'};return _0x2bd982;})});}_0x24d4c6=_[_0x608f('0x44')]({},_0x24d4c6,_0x508d58[_0x608f('0x47')]);var _0x44c1d5={'where':_0x24d4c6['where']};return db[_0x608f('0x30')]['count'](_0x44c1d5)['then'](function(_0x17e94d){_0x16e08c[_0x608f('0x25')]=_0x17e94d;if(_0x508d58['query'][_0x608f('0x48')]){_0x24d4c6[_0x608f('0x49')]=[{'all':!![]}];}return db[_0x608f('0x30')][_0x608f('0x4a')](_0x24d4c6);})[_0x608f('0x19')](function(_0x1838e3){_0x16e08c[_0x608f('0x4b')]=_0x1838e3;return _0x16e08c;})[_0x608f('0x19')](respondWithFilteredResult(_0x1126f5,_0x24d4c6))[_0x608f('0x4c')](handleError(_0x1126f5,null));};exports[_0x608f('0x4d')]=function(_0x3bc03b,_0x5b3f0f){var _0x311543={'raw':![],'where':{'id':_0x3bc03b[_0x608f('0x4e')]['id']}},_0x1daf57={};_0x1daf57[_0x608f('0x32')]=_[_0x608f('0x36')](db['Trunk'][_0x608f('0x31')]);_0x1daf57['query']=_['keys'](_0x3bc03b['query']);_0x1daf57['filters']=_[_0x608f('0x37')](_0x1daf57['model'],_0x1daf57[_0x608f('0x33')]);_0x311543[_0x608f('0x39')]=_['intersection'](_0x1daf57[_0x608f('0x32')],qs[_0x608f('0x38')](_0x3bc03b[_0x608f('0x33')][_0x608f('0x38')]));_0x311543['attributes']=_0x311543[_0x608f('0x39')][_0x608f('0x3a')]?_0x311543['attributes']:_0x1daf57[_0x608f('0x32')];if(_0x3bc03b['query'][_0x608f('0x48')]){_0x311543[_0x608f('0x49')]=[{'all':!![]}];}_0x311543=_[_0x608f('0x44')]({},_0x311543,_0x3bc03b[_0x608f('0x47')]);return db['Trunk'][_0x608f('0x4f')](_0x311543)[_0x608f('0x19')](handleEntityNotFound(_0x5b3f0f,null))[_0x608f('0x19')](respondWithResult(_0x5b3f0f,null))[_0x608f('0x4c')](handleError(_0x5b3f0f,null));};exports[_0x608f('0x50')]=function(_0x580aa8,_0xe4546e){var _0xc3faa9={'raw':![],'where':{'id':_0x580aa8[_0x608f('0x4e')]['id']}},_0x4a4e60={};_0x4a4e60['model']=_['keys'](db['Trunk'][_0x608f('0x31')]);_0xc3faa9['attributes']=_[_0x608f('0x37')](_0x4a4e60['model'],qs['fields'](_0x580aa8['query'][_0x608f('0x38')]));_0xc3faa9[_0x608f('0x39')]=_0xc3faa9[_0x608f('0x39')]['length']?_0xc3faa9[_0x608f('0x39')]:_0x4a4e60[_0x608f('0x32')];if(_0x580aa8[_0x608f('0x33')][_0x608f('0x48')]){_0xc3faa9['include']=[{'all':!![]}];}_0xc3faa9=_[_0x608f('0x44')]({},_0xc3faa9,_0x580aa8[_0x608f('0x47')]);return db[_0x608f('0x30')]['find'](_0xc3faa9)['then'](handleEntityNotFound(_0xe4546e,null))['then'](function(_0x51523d){if(_0x51523d){var _0x8ba637=_0x51523d[_0x608f('0x51')]({'plain':!![]});_0x8ba637=qs[_0x608f('0x52')](_0x8ba637,['id',_0x608f('0x53'),_0x608f('0x54')]);_0x580aa8[_0x608f('0x55')]=_[_0x608f('0x52')](_0x580aa8['body'],['id',_0x608f('0x53'),_0x608f('0x54')]);return db[_0x608f('0x30')][_0x608f('0x56')](_[_0x608f('0x44')](_0x8ba637,_0x580aa8[_0x608f('0x55')]),{'include':_0x580aa8[_0x608f('0x33')][_0x608f('0x48')]?[{'all':!![]}]:undefined});}})[_0x608f('0x19')](respondWithResult(_0xe4546e,0xc9))[_0x608f('0x4c')](handleError(_0xe4546e,null));};exports[_0x608f('0x56')]=function(_0x1cb209,_0x1f9a7c,_0x40fcf3){var _0x4dac7c;return db[_0x608f('0x30')][_0x608f('0x56')](_0x1cb209[_0x608f('0x55')],{'raw':!![]})['then'](function(_0x194db2){_0x4dac7c=_0x194db2;return db['Trunk']['findAll']({'raw':!![]});})['then'](function(_0x5d6c7f){var _0x28b3e6=fs[_0x608f('0x57')](path['join'](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x4e46ca=fs[_0x608f('0x57')](path['join'](config[_0x608f('0x58')],_0x608f('0x59')),'utf8');var _0x343cd8=ejs[_0x608f('0x5a')](_0x28b3e6,{'trunks':_0x5d6c7f||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x343cd8);if(_0x4dac7c[_0x608f('0x5b')]){var _0x5d76c3=ejs['render'](_0x4e46ca,{'trunks':_0x5d6c7f||[]});fs[_0x608f('0x5c')]('/etc/asterisk/sip_xcally_registers.conf',_0x5d76c3);}})['then'](function(){return respondWithRpcPromise('Reload',_0x608f('0x56'),{'module':'chan_sip.so'});})[_0x608f('0x19')](function(){return _0x4dac7c;})[_0x608f('0x19')](respondWithResult(_0x1f9a7c,0xc9))[_0x608f('0x4c')](handleError(_0x1f9a7c,null));};exports['update']=function(_0x9a183c,_0x457917,_0x5e8a4a){var _0x4b6b76;return db[_0x608f('0x30')][_0x608f('0x4f')]({'where':{'id':_0x9a183c[_0x608f('0x4e')]['id']}})[_0x608f('0x19')](handleEntityNotFound(_0x457917,null))[_0x608f('0x19')](saveUpdates(_0x9a183c['body'],null))[_0x608f('0x19')](function(_0x29a099){if(_0x29a099){_0x4b6b76=_0x29a099;return db[_0x608f('0x30')][_0x608f('0x4a')]({'raw':!![]});}})[_0x608f('0x19')](function(_0x47887e){if(_0x47887e){var _0x3ffbcc=fs[_0x608f('0x57')](path[_0x608f('0x5d')](config[_0x608f('0x58')],'server/files/templates/trunk.ejs'),'utf8');var _0x22109f=fs[_0x608f('0x57')](path['join'](config['root'],_0x608f('0x59')),_0x608f('0x5e'));var _0x462fd4=ejs[_0x608f('0x5a')](_0x3ffbcc,{'trunks':_0x47887e||[]});fs[_0x608f('0x5c')](_0x608f('0x5f'),_0x462fd4);var _0x427a3d=ejs[_0x608f('0x5a')](_0x22109f,{'trunks':_0x47887e||[]});fs[_0x608f('0x5c')](_0x608f('0x60'),_0x427a3d);return respondWithRpcPromise('Reload',_0x608f('0x2b'),{'module':_0x608f('0x61')});}return null;})[_0x608f('0x19')](function(_0x49bbc7){if(_0x49bbc7){return _0x4b6b76;}})[_0x608f('0x19')](respondWithResult(_0x457917,null))[_0x608f('0x4c')](handleError(_0x457917,null));};exports[_0x608f('0x62')]=function(_0xfa15c0,_0x4f8783,_0x506b97){var _0xe1876e;return db[_0x608f('0x30')][_0x608f('0x4f')]({'where':{'id':_0xfa15c0[_0x608f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4f8783,null))[_0x608f('0x19')](removeEntity(_0x4f8783,null))[_0x608f('0x19')](function(){return db[_0x608f('0x30')][_0x608f('0x4a')]({'raw':!![]});})[_0x608f('0x19')](function(_0x176278){var _0x460712=fs[_0x608f('0x57')](path[_0x608f('0x5d')](config[_0x608f('0x58')],_0x608f('0x63')),_0x608f('0x5e'));var _0x3b5a44=fs[_0x608f('0x57')](path[_0x608f('0x5d')](config[_0x608f('0x58')],_0x608f('0x59')),_0x608f('0x5e'));var _0x14d0bd=ejs['render'](_0x460712,{'trunks':_0x176278});var _0xb03485=ejs['render'](_0x3b5a44,{'trunks':_0x176278});fs[_0x608f('0x5c')](_0x608f('0x5f'),_0x14d0bd);fs[_0x608f('0x5c')]('/etc/asterisk/sip_xcally_registers.conf',_0xb03485);return respondWithRpcPromise('Reload',_0x608f('0x62'),{'module':_0x608f('0x61')});})[_0x608f('0x4c')](handleError(_0x4f8783,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index bc89b68..cf0a102 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 _0x4b0a=['define','tools_trunks','util','api','moment','request-promise','./trunk.attributes','exports'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x4b0a,0x1f2));var _0xa4b0=function(_0x5ac8d4,_0x287ab6){_0x5ac8d4=_0x5ac8d4-0x0;var _0x31b1ca=_0x4b0a[_0x5ac8d4];return _0x31b1ca;};'use strict';var _=require('lodash');var util=require(_0xa4b0('0x0'));var logger=require('../../config/logger')(_0xa4b0('0x1'));var moment=require(_0xa4b0('0x2'));var BPromise=require('bluebird');var rp=require(_0xa4b0('0x3'));var attributes=require(_0xa4b0('0x4'));module[_0xa4b0('0x5')]=function(_0x5794ea,_0x1e6946){return _0x5794ea[_0xa4b0('0x6')]('Trunk',attributes,{'tableName':_0xa4b0('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd99=['bluebird','request-promise','exports','Trunk','tools_trunks','lodash','../../config/logger','moment'];(function(_0x3f6c29,_0x158f52){var _0x413a43=function(_0x114c94){while(--_0x114c94){_0x3f6c29['push'](_0x3f6c29['shift']());}};_0x413a43(++_0x158f52);}(_0xdd99,0xfd));var _0x9dd9=function(_0x50bb37,_0x5cc01c){_0x50bb37=_0x50bb37-0x0;var _0x4a7d42=_0xdd99[_0x50bb37];return _0x4a7d42;};'use strict';var _=require(_0x9dd9('0x0'));var util=require('util');var logger=require(_0x9dd9('0x1'))('api');var moment=require(_0x9dd9('0x2'));var BPromise=require(_0x9dd9('0x3'));var rp=require(_0x9dd9('0x4'));var attributes=require('./trunk.attributes');module[_0x9dd9('0x5')]=function(_0x218f81,_0x5072b7){return _0x218f81['define'](_0x9dd9('0x6'),attributes,{'tableName':_0x9dd9('0x7'),'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 609b440..8494a96 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 _0x45fe=['message','request\x20sent','result','catch','GetTrunk','Trunk','options','raw','where','limit','include','map','attributes','model','debug','ShowTrunk','find','lodash','util','randomstring','ioredis','rpc','../../config/environment','http','request','then','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x45fe,0x171));var _0xe45f=function(_0x1e6e4e,_0x2b1b09){_0x1e6e4e=_0x1e6e4e-0x0;var _0x3d746b=_0x45fe[_0x1e6e4e];return _0x3d746b;};'use strict';var _=require(_0xe45f('0x0'));var util=require(_0xe45f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe45f('0x2'));var fs=require('fs');var Redis=require(_0xe45f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe45f('0x4'));var config=require(_0xe45f('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe45f('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x17b90b,_0x2f1536,_0x4e48d4){return new BPromise(function(_0x2a17be,_0x336694){return client[_0xe45f('0x7')](_0x17b90b,_0x4e48d4)[_0xe45f('0x8')](function(_0x4a224c){logger[_0xe45f('0x9')](_0xe45f('0xa'),_0x2f1536,'request\x20sent');logger['debug'](_0xe45f('0xb'),_0x2f1536,'request\x20sent',JSON[_0xe45f('0xc')](_0x4a224c));if(_0x4a224c[_0xe45f('0xd')]){if(_0x4a224c[_0xe45f('0xd')][_0xe45f('0xe')]===0x1f4){logger[_0xe45f('0xd')](_0xe45f('0xa'),_0x2f1536,_0x4a224c[_0xe45f('0xd')][_0xe45f('0xf')]);return _0x336694(_0x4a224c[_0xe45f('0xd')][_0xe45f('0xf')]);}logger[_0xe45f('0xd')](_0xe45f('0xa'),_0x2f1536,_0x4a224c[_0xe45f('0xd')][_0xe45f('0xf')]);return _0x2a17be(_0x4a224c[_0xe45f('0xd')][_0xe45f('0xf')]);}else{logger[_0xe45f('0x9')](_0xe45f('0xa'),_0x2f1536,_0xe45f('0x10'));_0x2a17be(_0x4a224c[_0xe45f('0x11')][_0xe45f('0xf')]);}})[_0xe45f('0x12')](function(_0x41b165){logger['error'](_0xe45f('0xa'),_0x2f1536,_0x41b165);_0x336694(_0x41b165);});});}exports[_0xe45f('0x13')]=function(_0xa3759c){var _0x2eb057=this;return new Promise(function(_0x4f8e52,_0x411867){return db[_0xe45f('0x14')]['findAll']({'raw':_0xa3759c[_0xe45f('0x15')]?_0xa3759c[_0xe45f('0x15')][_0xe45f('0x16')]===undefined?!![]:![]:!![],'where':_0xa3759c[_0xe45f('0x15')]?_0xa3759c[_0xe45f('0x15')][_0xe45f('0x17')]||null:null,'attributes':_0xa3759c[_0xe45f('0x15')]?_0xa3759c[_0xe45f('0x15')]['attributes']||null:null,'limit':_0xa3759c[_0xe45f('0x15')]?_0xa3759c[_0xe45f('0x15')][_0xe45f('0x18')]||null:null,'include':_0xa3759c['options']?_0xa3759c['options'][_0xe45f('0x19')]?_[_0xe45f('0x1a')](_0xa3759c[_0xe45f('0x15')][_0xe45f('0x19')],function(_0x464316){return{'model':db[_0x464316['model']],'as':_0x464316['as'],'attributes':_0x464316[_0xe45f('0x1b')],'include':_0x464316[_0xe45f('0x19')]?_[_0xe45f('0x1a')](_0x464316[_0xe45f('0x19')],function(_0xb05d10){return{'model':db[_0xb05d10[_0xe45f('0x1c')]],'as':_0xb05d10['as'],'attributes':_0xb05d10[_0xe45f('0x1b')],'include':_0xb05d10['include']?_[_0xe45f('0x1a')](_0xb05d10[_0xe45f('0x19')],function(_0x11a12d){return{'model':db[_0x11a12d['model']],'as':_0x11a12d['as'],'attributes':_0x11a12d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x126da4){logger[_0xe45f('0x9')](_0xe45f('0x13'),_0xa3759c);logger[_0xe45f('0x1d')](_0xe45f('0x13'),_0xa3759c,JSON['stringify'](_0x126da4));_0x4f8e52(_0x126da4);})[_0xe45f('0x12')](function(_0x99f66b){logger[_0xe45f('0xd')](_0xe45f('0x13'),_0x99f66b[_0xe45f('0xf')],_0xa3759c);_0x411867(_0x2eb057[_0xe45f('0xd')](0x1f4,_0x99f66b['message']));});});};exports[_0xe45f('0x1e')]=function(_0x122b50){var _0x4f1ec6=this;return new Promise(function(_0x5669be,_0x4bd79b){return db[_0xe45f('0x14')][_0xe45f('0x1f')]({'raw':_0x122b50[_0xe45f('0x15')]?_0x122b50[_0xe45f('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x122b50[_0xe45f('0x15')]?_0x122b50[_0xe45f('0x15')][_0xe45f('0x17')]||null:null,'attributes':_0x122b50[_0xe45f('0x15')]?_0x122b50[_0xe45f('0x15')][_0xe45f('0x1b')]||null:null,'include':_0x122b50[_0xe45f('0x15')]?_0x122b50['options'][_0xe45f('0x19')]?_[_0xe45f('0x1a')](_0x122b50['options'][_0xe45f('0x19')],function(_0x52ec5b){return{'model':db[_0x52ec5b[_0xe45f('0x1c')]],'as':_0x52ec5b['as'],'attributes':_0x52ec5b['attributes'],'include':_0x52ec5b['include']?_[_0xe45f('0x1a')](_0x52ec5b[_0xe45f('0x19')],function(_0x5cdc26){return{'model':db[_0x5cdc26[_0xe45f('0x1c')]],'as':_0x5cdc26['as'],'attributes':_0x5cdc26[_0xe45f('0x1b')],'include':_0x5cdc26[_0xe45f('0x19')]?_[_0xe45f('0x1a')](_0x5cdc26[_0xe45f('0x19')],function(_0x42cdff){return{'model':db[_0x42cdff['model']],'as':_0x42cdff['as'],'attributes':_0x42cdff['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x56c1ec){logger['info'](_0xe45f('0x1e'),_0x122b50);logger[_0xe45f('0x1d')]('ShowTrunk',_0x122b50,JSON[_0xe45f('0xc')](_0x56c1ec));_0x5669be(_0x56c1ec);})['catch'](function(_0x2e7353){logger['error'](_0xe45f('0x1e'),_0x2e7353['message'],_0x122b50);_0x4bd79b(_0x4f1ec6[_0xe45f('0xd')](0x1f4,_0x2e7353['message']));});});}; \ No newline at end of file +var _0x7fc0=['error','code','message','result','catch','GetTrunk','Trunk','findAll','options','raw','limit','include','model','attributes','map','then','ShowTrunk','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3c4f1f,_0x20d3ec){var _0x19cb69=function(_0x2e04bc){while(--_0x2e04bc){_0x3c4f1f['push'](_0x3c4f1f['shift']());}};_0x19cb69(++_0x20d3ec);}(_0x7fc0,0xd1));var _0x07fc=function(_0x4b4950,_0x103d19){_0x4b4950=_0x4b4950-0x0;var _0x401a6e=_0x7fc0[_0x4b4950];return _0x401a6e;};'use strict';var _=require(_0x07fc('0x0'));var util=require(_0x07fc('0x1'));var moment=require(_0x07fc('0x2'));var BPromise=require(_0x07fc('0x3'));var rs=require(_0x07fc('0x4'));var fs=require('fs');var Redis=require(_0x07fc('0x5'));var db=require(_0x07fc('0x6'))['db'];var utils=require(_0x07fc('0x7'));var logger=require(_0x07fc('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x07fc('0x9'));var client=jayson[_0x07fc('0xa')][_0x07fc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38566e,_0x1ebefb,_0x3455e8){return new BPromise(function(_0x2f1c34,_0x2b5ca8){return client[_0x07fc('0xc')](_0x38566e,_0x3455e8)['then'](function(_0x5c754a){logger[_0x07fc('0xd')](_0x07fc('0xe'),_0x1ebefb,'request\x20sent');logger[_0x07fc('0xf')](_0x07fc('0x10'),_0x1ebefb,_0x07fc('0x11'),JSON[_0x07fc('0x12')](_0x5c754a));if(_0x5c754a[_0x07fc('0x13')]){if(_0x5c754a[_0x07fc('0x13')][_0x07fc('0x14')]===0x1f4){logger[_0x07fc('0x13')](_0x07fc('0xe'),_0x1ebefb,_0x5c754a[_0x07fc('0x13')][_0x07fc('0x15')]);return _0x2b5ca8(_0x5c754a[_0x07fc('0x13')][_0x07fc('0x15')]);}logger[_0x07fc('0x13')]('Trunk,\x20%s,\x20%s',_0x1ebefb,_0x5c754a[_0x07fc('0x13')]['message']);return _0x2f1c34(_0x5c754a['error']['message']);}else{logger[_0x07fc('0xd')](_0x07fc('0xe'),_0x1ebefb,_0x07fc('0x11'));_0x2f1c34(_0x5c754a[_0x07fc('0x16')][_0x07fc('0x15')]);}})[_0x07fc('0x17')](function(_0x54e2a0){logger[_0x07fc('0x13')](_0x07fc('0xe'),_0x1ebefb,_0x54e2a0);_0x2b5ca8(_0x54e2a0);});});}exports[_0x07fc('0x18')]=function(_0x44d28c){var _0x5c1fad=this;return new Promise(function(_0x1d0f6a,_0x1279e2){return db[_0x07fc('0x19')][_0x07fc('0x1a')]({'raw':_0x44d28c[_0x07fc('0x1b')]?_0x44d28c[_0x07fc('0x1b')][_0x07fc('0x1c')]===undefined?!![]:![]:!![],'where':_0x44d28c['options']?_0x44d28c[_0x07fc('0x1b')]['where']||null:null,'attributes':_0x44d28c[_0x07fc('0x1b')]?_0x44d28c[_0x07fc('0x1b')]['attributes']||null:null,'limit':_0x44d28c[_0x07fc('0x1b')]?_0x44d28c['options'][_0x07fc('0x1d')]||null:null,'include':_0x44d28c['options']?_0x44d28c[_0x07fc('0x1b')][_0x07fc('0x1e')]?_['map'](_0x44d28c['options'][_0x07fc('0x1e')],function(_0xfcace3){return{'model':db[_0xfcace3[_0x07fc('0x1f')]],'as':_0xfcace3['as'],'attributes':_0xfcace3[_0x07fc('0x20')],'include':_0xfcace3['include']?_['map'](_0xfcace3['include'],function(_0x51062e){return{'model':db[_0x51062e[_0x07fc('0x1f')]],'as':_0x51062e['as'],'attributes':_0x51062e[_0x07fc('0x20')],'include':_0x51062e['include']?_[_0x07fc('0x21')](_0x51062e[_0x07fc('0x1e')],function(_0x34e9f5){return{'model':db[_0x34e9f5[_0x07fc('0x1f')]],'as':_0x34e9f5['as'],'attributes':_0x34e9f5[_0x07fc('0x20')]};}):[]};}):[]};}):[]:[]})[_0x07fc('0x22')](function(_0x200bf0){logger[_0x07fc('0xd')]('GetTrunk',_0x44d28c);logger[_0x07fc('0xf')](_0x07fc('0x18'),_0x44d28c,JSON['stringify'](_0x200bf0));_0x1d0f6a(_0x200bf0);})['catch'](function(_0x5db4aa){logger[_0x07fc('0x13')](_0x07fc('0x18'),_0x5db4aa[_0x07fc('0x15')],_0x44d28c);_0x1279e2(_0x5c1fad[_0x07fc('0x13')](0x1f4,_0x5db4aa['message']));});});};exports[_0x07fc('0x23')]=function(_0x5815fc){var _0x1391b4=this;return new Promise(function(_0x4f1ea4,_0x99f91b){return db['Trunk'][_0x07fc('0x24')]({'raw':_0x5815fc[_0x07fc('0x1b')]?_0x5815fc[_0x07fc('0x1b')][_0x07fc('0x1c')]===undefined?!![]:![]:!![],'where':_0x5815fc[_0x07fc('0x1b')]?_0x5815fc[_0x07fc('0x1b')][_0x07fc('0x25')]||null:null,'attributes':_0x5815fc[_0x07fc('0x1b')]?_0x5815fc[_0x07fc('0x1b')][_0x07fc('0x20')]||null:null,'include':_0x5815fc[_0x07fc('0x1b')]?_0x5815fc[_0x07fc('0x1b')][_0x07fc('0x1e')]?_['map'](_0x5815fc[_0x07fc('0x1b')]['include'],function(_0x44c37d){return{'model':db[_0x44c37d['model']],'as':_0x44c37d['as'],'attributes':_0x44c37d['attributes'],'include':_0x44c37d[_0x07fc('0x1e')]?_[_0x07fc('0x21')](_0x44c37d['include'],function(_0x37b1f5){return{'model':db[_0x37b1f5[_0x07fc('0x1f')]],'as':_0x37b1f5['as'],'attributes':_0x37b1f5[_0x07fc('0x20')],'include':_0x37b1f5[_0x07fc('0x1e')]?_[_0x07fc('0x21')](_0x37b1f5[_0x07fc('0x1e')],function(_0x2618b4){return{'model':db[_0x2618b4[_0x07fc('0x1f')]],'as':_0x2618b4['as'],'attributes':_0x2618b4['attributes']};}):[]};}):[]};}):[]:[]})[_0x07fc('0x22')](function(_0x2fc23a){logger[_0x07fc('0xd')](_0x07fc('0x23'),_0x5815fc);logger[_0x07fc('0xf')](_0x07fc('0x23'),_0x5815fc,JSON['stringify'](_0x2fc23a));_0x4f1ea4(_0x2fc23a);})[_0x07fc('0x17')](function(_0xc00486){logger[_0x07fc('0x13')](_0x07fc('0x23'),_0xc00486[_0x07fc('0x15')],_0x5815fc);_0x99f91b(_0x1391b4[_0x07fc('0x13')](0x1f4,_0xc00486['message']));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 731b2b7..0810670 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 _0x96f9=['removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id/avatar','getAvatar','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/recordings','getRecordings','/:id/chat/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','getMailAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','post','/create_many','addContacts','create','/:id/queues','addQueues','diskStorage','join','root','format','%s-%s','now','originalname','file','addAvatar','/:id/login','login','unpause','/:id/chat_interactions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSquareProjects','update','put','changePassword','delete','removeQueues','removeTeams','/:id','destroy','removeMailInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts'];(function(_0x420952,_0x20d5b3){var _0x22b37f=function(_0x4c14e9){while(--_0x4c14e9){_0x420952['push'](_0x420952['shift']());}};_0x22b37f(++_0x20d5b3);}(_0x96f9,0x64));var _0x996f=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x96f9[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x996f('0x0'));var util=require(_0x996f('0x1'));var path=require(_0x996f('0x2'));var timeout=require(_0x996f('0x3'));var express=require(_0x996f('0x4'));var router=express[_0x996f('0x5')]();var auth=require(_0x996f('0x6'));var interaction=require(_0x996f('0x7'));var config=require(_0x996f('0x8'));var controller=require('./user.controller');router[_0x996f('0x9')]('/',auth[_0x996f('0xa')](),controller['index']);router[_0x996f('0x9')](_0x996f('0xb'),auth[_0x996f('0xa')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x996f('0x9')](_0x996f('0xc'),controller[_0x996f('0xd')]);router['get'](_0x996f('0xe'),auth[_0x996f('0xa')](),controller[_0x996f('0xf')]);router[_0x996f('0x9')]('/:id/queues',auth[_0x996f('0xa')](),controller[_0x996f('0x10')]);router['get'](_0x996f('0x11'),auth['isAuthenticated'](),controller[_0x996f('0x12')]);router[_0x996f('0x9')]('/:id/groups',auth[_0x996f('0xa')](),controller['getGroups']);router[_0x996f('0x9')](_0x996f('0x13'),auth[_0x996f('0xa')](),controller[_0x996f('0x14')]);router['get'](_0x996f('0x15'),auth[_0x996f('0xa')](),controller['getChatInteractions']);router[_0x996f('0x9')]('/:id/openchannel/interactions',auth['isAuthenticated'](),controller[_0x996f('0x16')]);router[_0x996f('0x9')](_0x996f('0x17'),auth['isAuthenticated'](),controller[_0x996f('0x18')]);router[_0x996f('0x9')]('/:id/sms/interactions',auth[_0x996f('0xa')](),controller[_0x996f('0x19')]);router[_0x996f('0x9')](_0x996f('0x1a'),auth['isAuthenticated'](),controller[_0x996f('0x1b')]);router['get'](_0x996f('0x1c'),auth['isAuthenticated'](),controller[_0x996f('0x1d')]);router[_0x996f('0x9')](_0x996f('0x1e'),auth[_0x996f('0xa')](),controller[_0x996f('0x1f')]);router[_0x996f('0x9')](_0x996f('0x20'),auth[_0x996f('0xa')](),controller[_0x996f('0x21')]);router['get'](_0x996f('0x22'),auth['isAuthenticated'](),controller[_0x996f('0x23')]);router[_0x996f('0x9')]('/:id/fax_accounts',auth[_0x996f('0xa')](),controller[_0x996f('0x24')]);router['get']('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x996f('0x25')]);router[_0x996f('0x9')]('/:id/openchannel_accounts',auth[_0x996f('0xa')](),controller['getOpenchannelAccounts']);router['get'](_0x996f('0x26'),auth[_0x996f('0xa')](),controller[_0x996f('0x27')]);router[_0x996f('0x9')](_0x996f('0x28'),auth[_0x996f('0xa')](),controller[_0x996f('0x29')]);router[_0x996f('0x9')](_0x996f('0x2a'),auth[_0x996f('0xa')](),controller[_0x996f('0x2b')]);router[_0x996f('0x9')](_0x996f('0x2c'),auth['isAuthenticated'](),controller[_0x996f('0x2d')]);router[_0x996f('0x2e')](_0x996f('0x2f'),auth[_0x996f('0xa')](),controller['bulkCreate']);router[_0x996f('0x2e')](_0x996f('0xe'),auth[_0x996f('0xa')](),controller[_0x996f('0x30')]);router['post']('/',auth['isAuthenticated'](),controller[_0x996f('0x31')]);router[_0x996f('0x2e')](_0x996f('0x32'),auth[_0x996f('0xa')](),controller[_0x996f('0x33')]);var upload=multer({'storage':multer[_0x996f('0x34')]({'destination':function(_0xa09ea6,_0x2aa97f,_0x1e2921){_0x1e2921(null,path[_0x996f('0x35')](config[_0x996f('0x36')],'server/files/images/'));},'filename':function(_0x218462,_0x38e35d,_0x1d60dd){_0x1d60dd(null,util[_0x996f('0x37')](_0x996f('0x38'),Date[_0x996f('0x39')](),_0x38e35d[_0x996f('0x3a')]));}})});router[_0x996f('0x2e')](_0x996f('0xc'),upload['single'](_0x996f('0x3b')),controller[_0x996f('0x3c')]);router[_0x996f('0x2e')](_0x996f('0x3d'),auth[_0x996f('0xa')](),controller[_0x996f('0x3e')]);router[_0x996f('0x2e')]('/:id/logout',auth[_0x996f('0xa')](),controller['logout']);router['post']('/:id/pause',auth[_0x996f('0xa')](),controller['pause']);router[_0x996f('0x2e')]('/:id/unpause',auth[_0x996f('0xa')](),controller[_0x996f('0x3f')]);router[_0x996f('0x2e')](_0x996f('0x1c'),auth['isAuthenticated'](),controller['addTeams']);router[_0x996f('0x2e')](_0x996f('0x40'),auth[_0x996f('0xa')](),controller['addChatInteractions']);router[_0x996f('0x2e')](_0x996f('0x41'),auth[_0x996f('0xa')](),controller['addMailInteractions']);router[_0x996f('0x2e')](_0x996f('0x42'),auth['isAuthenticated'](),controller[_0x996f('0x43')]);router[_0x996f('0x2e')](_0x996f('0x44'),auth[_0x996f('0xa')](),controller[_0x996f('0x45')]);router[_0x996f('0x2e')](_0x996f('0x46'),auth[_0x996f('0xa')](),controller[_0x996f('0x47')]);router[_0x996f('0x2e')]('/:id/fax_accounts',auth[_0x996f('0xa')](),controller[_0x996f('0x48')]);router[_0x996f('0x2e')](_0x996f('0x49'),auth[_0x996f('0xa')](),controller['addMailAccounts']);router['post'](_0x996f('0x4a'),auth[_0x996f('0xa')](),controller[_0x996f('0x4b')]);router[_0x996f('0x2e')](_0x996f('0x26'),auth['isAuthenticated'](),controller['addSmsAccounts']);router[_0x996f('0x2e')](_0x996f('0x28'),auth[_0x996f('0xa')](),controller['addChatWebsites']);router[_0x996f('0x2e')](_0x996f('0x2a'),auth['isAuthenticated'](),controller[_0x996f('0x4c')]);router['put']('/:id',auth[_0x996f('0xa')](),controller[_0x996f('0x4d')]);router[_0x996f('0x4e')]('/:id/password',auth[_0x996f('0xa')](),controller[_0x996f('0x4f')]);router[_0x996f('0x50')](_0x996f('0x32'),auth[_0x996f('0xa')](),controller[_0x996f('0x51')]);router[_0x996f('0x50')](_0x996f('0x1c'),auth['isAuthenticated'](),controller[_0x996f('0x52')]);router[_0x996f('0x50')](_0x996f('0x53'),auth['isAuthenticated'](),controller[_0x996f('0x54')]);router[_0x996f('0x50')](_0x996f('0x40'),auth[_0x996f('0xa')](),controller['removeChatInteractions']);router[_0x996f('0x50')](_0x996f('0x41'),auth[_0x996f('0xa')](),controller[_0x996f('0x55')]);router[_0x996f('0x50')](_0x996f('0x42'),auth[_0x996f('0xa')](),controller['removeFaxInteractions']);router['delete'](_0x996f('0x44'),auth[_0x996f('0xa')](),controller[_0x996f('0x56')]);router['delete'](_0x996f('0x46'),auth['isAuthenticated'](),controller[_0x996f('0x57')]);router[_0x996f('0x50')]('/:id/fax_accounts',auth[_0x996f('0xa')](),controller[_0x996f('0x58')]);router[_0x996f('0x50')]('/:id/mail_accounts',auth[_0x996f('0xa')](),controller[_0x996f('0x59')]);router['delete'](_0x996f('0x4a'),auth[_0x996f('0xa')](),controller[_0x996f('0x5a')]);router[_0x996f('0x50')](_0x996f('0x26'),auth[_0x996f('0xa')](),controller[_0x996f('0x5b')]);router[_0x996f('0x50')](_0x996f('0x28'),auth[_0x996f('0xa')](),controller[_0x996f('0x5c')]);router['delete'](_0x996f('0x2a'),auth[_0x996f('0xa')](),controller[_0x996f('0x5d')]);module[_0x996f('0x5e')]=router; \ No newline at end of file +var _0x74ca=['/:id/scheduled_calls','post','/create_many','bulkCreate','/:id/contacts','addContacts','create','diskStorage','root','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addSquareProjects','put','update','changePassword','delete','removeTeams','destroy','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeMailAccounts','removeOpenchannelAccounts','/:id/sms_accounts','removeChatWebsites','removeSquareProjects','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./user.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/avatar','getAvatar','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/teams','/:id/lists','getLists','getAgents','/:id/prefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/square_projects','getSquareProjects'];(function(_0x3dc4fe,_0x34752e){var _0x2fa8d1=function(_0x5bc2d3){while(--_0x5bc2d3){_0x3dc4fe['push'](_0x3dc4fe['shift']());}};_0x2fa8d1(++_0x34752e);}(_0x74ca,0xfa));var _0xa74c=function(_0x1b8005,_0x5ef04f){_0x1b8005=_0x1b8005-0x0;var _0x1ea62d=_0x74ca[_0x1b8005];return _0x1ea62d;};'use strict';var multer=require(_0xa74c('0x0'));var util=require(_0xa74c('0x1'));var path=require(_0xa74c('0x2'));var timeout=require(_0xa74c('0x3'));var express=require(_0xa74c('0x4'));var router=express[_0xa74c('0x5')]();var auth=require(_0xa74c('0x6'));var interaction=require(_0xa74c('0x7'));var config=require('../../config/environment');var controller=require(_0xa74c('0x8'));router[_0xa74c('0x9')]('/',auth[_0xa74c('0xa')](),controller[_0xa74c('0xb')]);router['get'](_0xa74c('0xc'),auth[_0xa74c('0xa')](),controller[_0xa74c('0xd')]);router[_0xa74c('0x9')](_0xa74c('0xe'),auth[_0xa74c('0xa')](),controller['show']);router[_0xa74c('0x9')](_0xa74c('0xf'),controller[_0xa74c('0x10')]);router[_0xa74c('0x9')]('/:id/contacts',auth[_0xa74c('0xa')](),controller[_0xa74c('0x11')]);router[_0xa74c('0x9')](_0xa74c('0x12'),auth[_0xa74c('0xa')](),controller[_0xa74c('0x13')]);router['get'](_0xa74c('0x14'),auth['isAuthenticated'](),controller[_0xa74c('0x15')]);router[_0xa74c('0x9')](_0xa74c('0x16'),auth['isAuthenticated'](),controller[_0xa74c('0x17')]);router[_0xa74c('0x9')](_0xa74c('0x18'),auth[_0xa74c('0xa')](),controller['getRecordings']);router[_0xa74c('0x9')](_0xa74c('0x19'),auth[_0xa74c('0xa')](),controller['getChatInteractions']);router['get'](_0xa74c('0x1a'),auth[_0xa74c('0xa')](),controller[_0xa74c('0x1b')]);router[_0xa74c('0x9')](_0xa74c('0x1c'),auth[_0xa74c('0xa')](),controller[_0xa74c('0x1d')]);router[_0xa74c('0x9')](_0xa74c('0x1e'),auth[_0xa74c('0xa')](),controller[_0xa74c('0x1f')]);router[_0xa74c('0x9')]('/:id/fax/interactions',auth['isAuthenticated'](),controller['getFaxInteractions']);router[_0xa74c('0x9')](_0xa74c('0x20'),auth[_0xa74c('0xa')](),controller['getTeams']);router[_0xa74c('0x9')](_0xa74c('0x21'),auth['isAuthenticated'](),controller[_0xa74c('0x22')]);router[_0xa74c('0x9')]('/:id/agents',auth['isAuthenticated'](),controller[_0xa74c('0x23')]);router['get'](_0xa74c('0x24'),auth[_0xa74c('0xa')](),controller['getVoicePrefixes']);router[_0xa74c('0x9')]('/:id/fax_accounts',auth[_0xa74c('0xa')](),controller[_0xa74c('0x25')]);router[_0xa74c('0x9')](_0xa74c('0x26'),auth['isAuthenticated'](),controller[_0xa74c('0x27')]);router['get'](_0xa74c('0x28'),auth['isAuthenticated'](),controller[_0xa74c('0x29')]);router[_0xa74c('0x9')]('/:id/sms_accounts',auth[_0xa74c('0xa')](),controller[_0xa74c('0x2a')]);router[_0xa74c('0x9')](_0xa74c('0x2b'),auth['isAuthenticated'](),controller[_0xa74c('0x2c')]);router[_0xa74c('0x9')](_0xa74c('0x2d'),auth[_0xa74c('0xa')](),controller[_0xa74c('0x2e')]);router[_0xa74c('0x9')](_0xa74c('0x2f'),auth['isAuthenticated'](),controller['getScheduledCalls']);router[_0xa74c('0x30')](_0xa74c('0x31'),auth[_0xa74c('0xa')](),controller[_0xa74c('0x32')]);router[_0xa74c('0x30')](_0xa74c('0x33'),auth[_0xa74c('0xa')](),controller[_0xa74c('0x34')]);router['post']('/',auth[_0xa74c('0xa')](),controller[_0xa74c('0x35')]);router[_0xa74c('0x30')](_0xa74c('0x12'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer[_0xa74c('0x36')]({'destination':function(_0x1e9f44,_0x438dd2,_0x4cbfbf){_0x4cbfbf(null,path['join'](config[_0xa74c('0x37')],'server/files/images/'));},'filename':function(_0x5d888d,_0x72af10,_0x3210e5){_0x3210e5(null,util[_0xa74c('0x38')](_0xa74c('0x39'),Date[_0xa74c('0x3a')](),_0x72af10[_0xa74c('0x3b')]));}})});router['post']('/:id/avatar',upload[_0xa74c('0x3c')](_0xa74c('0x3d')),controller[_0xa74c('0x3e')]);router[_0xa74c('0x30')](_0xa74c('0x3f'),auth[_0xa74c('0xa')](),controller[_0xa74c('0x40')]);router[_0xa74c('0x30')](_0xa74c('0x41'),auth['isAuthenticated'](),controller[_0xa74c('0x42')]);router['post'](_0xa74c('0x43'),auth['isAuthenticated'](),controller[_0xa74c('0x44')]);router[_0xa74c('0x30')](_0xa74c('0x45'),auth['isAuthenticated'](),controller['unpause']);router[_0xa74c('0x30')](_0xa74c('0x20'),auth['isAuthenticated'](),controller['addTeams']);router[_0xa74c('0x30')](_0xa74c('0x46'),auth[_0xa74c('0xa')](),controller['addChatInteractions']);router[_0xa74c('0x30')](_0xa74c('0x47'),auth[_0xa74c('0xa')](),controller[_0xa74c('0x48')]);router[_0xa74c('0x30')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0xa74c('0x49')]);router[_0xa74c('0x30')](_0xa74c('0x4a'),auth[_0xa74c('0xa')](),controller[_0xa74c('0x4b')]);router[_0xa74c('0x30')]('/:id/openchannel_interactions',auth[_0xa74c('0xa')](),controller[_0xa74c('0x4c')]);router['post'](_0xa74c('0x4d'),auth[_0xa74c('0xa')](),controller[_0xa74c('0x4e')]);router[_0xa74c('0x30')](_0xa74c('0x26'),auth['isAuthenticated'](),controller[_0xa74c('0x4f')]);router['post']('/:id/openchannel_accounts',auth[_0xa74c('0xa')](),controller[_0xa74c('0x50')]);router[_0xa74c('0x30')]('/:id/sms_accounts',auth[_0xa74c('0xa')](),controller[_0xa74c('0x51')]);router[_0xa74c('0x30')]('/:id/chat_websites',auth[_0xa74c('0xa')](),controller[_0xa74c('0x52')]);router[_0xa74c('0x30')](_0xa74c('0x2d'),auth[_0xa74c('0xa')](),controller[_0xa74c('0x53')]);router[_0xa74c('0x54')](_0xa74c('0xe'),auth[_0xa74c('0xa')](),controller[_0xa74c('0x55')]);router[_0xa74c('0x54')]('/:id/password',auth['isAuthenticated'](),controller[_0xa74c('0x56')]);router[_0xa74c('0x57')](_0xa74c('0x12'),auth['isAuthenticated'](),controller['removeQueues']);router[_0xa74c('0x57')](_0xa74c('0x20'),auth[_0xa74c('0xa')](),controller[_0xa74c('0x58')]);router['delete']('/:id',auth[_0xa74c('0xa')](),controller[_0xa74c('0x59')]);router[_0xa74c('0x57')]('/:id/chat_interactions',auth[_0xa74c('0xa')](),controller['removeChatInteractions']);router['delete'](_0xa74c('0x47'),auth[_0xa74c('0xa')](),controller['removeMailInteractions']);router[_0xa74c('0x57')](_0xa74c('0x5a'),auth[_0xa74c('0xa')](),controller[_0xa74c('0x5b')]);router[_0xa74c('0x57')]('/:id/sms_interactions',auth[_0xa74c('0xa')](),controller[_0xa74c('0x5c')]);router[_0xa74c('0x57')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0xa74c('0x5d')]);router[_0xa74c('0x57')](_0xa74c('0x4d'),auth['isAuthenticated'](),controller['removeFaxAccounts']);router['delete']('/:id/mail_accounts',auth[_0xa74c('0xa')](),controller[_0xa74c('0x5e')]);router[_0xa74c('0x57')]('/:id/openchannel_accounts',auth[_0xa74c('0xa')](),controller[_0xa74c('0x5f')]);router[_0xa74c('0x57')](_0xa74c('0x60'),auth[_0xa74c('0xa')](),controller['removeSmsAccounts']);router[_0xa74c('0x57')](_0xa74c('0x2b'),auth[_0xa74c('0xa')](),controller[_0xa74c('0x61')]);router[_0xa74c('0x57')](_0xa74c('0x2d'),auth[_0xa74c('0xa')](),controller[_0xa74c('0x62')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 4aa1b76..84db57b 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 _0xbaf0=['PROHIB','udp','transport','join','split','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','nonat','update,nonat','showWebBar','get','wss','encryption','avpf','icesupport','dtlsenable','rtcp_mux','force_avp','dtlsverify','dtlssetup','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','agent','telephone','INTEGER','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','user','peer','friend','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0baf('0x0'));var util=require(_0x0baf('0x1'));var _=require(_0x0baf('0x2'));module[_0x0baf('0x3')]={'name':{'type':Sequelize[_0x0baf('0x4')],'allowNull':![],'unique':_0x0baf('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x5a3e42){this[_0x0baf('0x6')](_0x0baf('0x5'),_0x5a3e42);this[_0x0baf('0x6')](_0x0baf('0x7'),_0x5a3e42);},'comment':_0x0baf('0x8')},'fullname':{'type':Sequelize[_0x0baf('0x4')],'allowNull':![],'set':function(_0x1a10b1){this[_0x0baf('0x6')](_0x0baf('0x9'),_0x1a10b1);this['setDataValue'](_0x0baf('0xa'),util['format'](_0x0baf('0xb'),_0x1a10b1,this[_0x0baf('0xc')](_0x0baf('0xd'))));}},'alias':{'type':Sequelize[_0x0baf('0x4')]},'email':{'type':Sequelize[_0x0baf('0x4')],'allowNull':![],'unique':_0x0baf('0xe'),'validate':{'isEmail':!![]},'set':function(_0x41cead){if(_0x41cead){this[_0x0baf('0x6')](_0x0baf('0xe'),_0x41cead[_0x0baf('0xf')]());}}},'role':{'type':Sequelize[_0x0baf('0x10')]('admin','user',_0x0baf('0x11'),_0x0baf('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x0baf('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0baf('0x4')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0baf('0x13')](0xb),'allowNull':![],'unique':'internal','set':function(_0x1c76a8){this[_0x0baf('0x6')](_0x0baf('0xd'),_0x1c76a8);this[_0x0baf('0x6')](_0x0baf('0x14'),_0x1c76a8);this[_0x0baf('0x6')]('callerid',util['format'](_0x0baf('0xb'),this[_0x0baf('0xc')](_0x0baf('0x9')),_0x1c76a8));}},'salt':{'type':Sequelize[_0x0baf('0x4')]},'phone':{'type':Sequelize[_0x0baf('0x4')]},'mobile':{'type':Sequelize[_0x0baf('0x4')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x0baf('0x4')]},'userpic':{'type':Sequelize[_0x0baf('0x4')]},'city':{'type':Sequelize[_0x0baf('0x4')]},'country':{'type':Sequelize[_0x0baf('0x4')]},'online':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0baf('0x16')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0baf('0x4')],'defaultValue':_0x0baf('0x17')},'lastPauseAt':{'type':Sequelize[_0x0baf('0x16')]},'chatCapacity':{'type':Sequelize[_0x0baf('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x0baf('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x0baf('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0baf('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x13c4},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![],'defaultValue':_0x0baf('0x18')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x0baf('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x0baf('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x0baf('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0baf('0x10')]('friend',_0x0baf('0x19'),_0x0baf('0x1a')),'allowNull':!![],'defaultValue':_0x0baf('0x1b')},'context':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x1c'),'ALLOWED_PASSED_SCREEN',_0x0baf('0x1d'),_0x0baf('0x1e'),_0x0baf('0x1f'),_0x0baf('0x20'),_0x0baf('0x21'),_0x0baf('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![],'defaultValue':_0x0baf('0x23'),'set':function(_0x275ea1){this[_0x0baf('0x6')](_0x0baf('0x24'),_0x275ea1?_0x275ea1[_0x0baf('0x25')](','):null);},'get':function(){return this[_0x0baf('0xc')](_0x0baf('0x24'))?this[_0x0baf('0xc')](_0x0baf('0x24'))[_0x0baf('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x0baf('0x10')]('rfc2833',_0x0baf('0x27'),_0x0baf('0x28'),_0x0baf('0x29'),_0x0baf('0x2a')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no','nonat',_0x0baf('0x2c'),_0x0baf('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![],'defaultValue':_0x0baf('0x2e'),'set':function(_0x4aa6ed){this[_0x0baf('0x6')](_0x0baf('0x2f'),_0x4aa6ed?_0x4aa6ed['join'](','):null);},'get':function(){return this[_0x0baf('0xc')]('nat')?this['getDataValue'](_0x0baf('0x2f'))[_0x0baf('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x0baf('0x4')]},'pickupgroup':{'type':Sequelize[_0x0baf('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x0baf('0x4')]},'language':{'type':Sequelize[_0x0baf('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0baf('0x4')]},'disallow':{'type':Sequelize[_0x0baf('0x4')],'allowNull':![],'defaultValue':_0x0baf('0x30')},'allow':{'type':Sequelize[_0x0baf('0x4')],'allowNull':![],'defaultValue':_0x0baf('0x31'),'set':function(_0x36c6d2){this[_0x0baf('0x6')](_0x0baf('0x32'),_0x36c6d2?_0x36c6d2[_0x0baf('0x25')](';'):_0x0baf('0x31'));},'get':function(){return this['getDataValue'](_0x0baf('0x32'))?this[_0x0baf('0xc')]('allow')[_0x0baf('0x26')](';'):null;},'comment':_0x0baf('0x33')},'autoframing':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![],'set':function(_0x456d0b){this['setDataValue'](_0x0baf('0x34'),_0x456d0b?_0x456d0b[_0x0baf('0x25')](','):null);},'get':function(){return this['getDataValue'](_0x0baf('0x34'))?this[_0x0baf('0xc')](_0x0baf('0x34'))[_0x0baf('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no',_0x0baf('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x0baf('0x10')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0baf('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![],'defaultValue':_0x0baf('0x36')},'amaflags':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x0baf('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x0baf('0x2b')},'busylevel':{'type':Sequelize[_0x0baf('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x0baf('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x0baf('0x2b'),'no',_0x0baf('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0baf('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x0baf('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x38'),_0x0baf('0x39'),_0x0baf('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0baf('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x3b'),_0x0baf('0x3c')),'allowNull':!![],'defaultValue':_0x0baf('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x0baf('0x2b')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x0baf('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x0baf('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x0baf('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0baf('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0baf('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0baf('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x0baf('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0baf('0x10')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x0baf('0x10')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x0baf('0x10')]('yes','no',_0x0baf('0x3d'),_0x0baf('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x0baf('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x3f'),_0x0baf('0x40'),_0x0baf('0x41')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x0baf('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x0baf('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no',_0x0baf('0x42'),_0x0baf('0x2c'),_0x0baf('0x43')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0baf('0x4')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'showWebBar':{'type':Sequelize[_0x0baf('0x13')],'defaultValue':0x0,'set':function(_0x27f580){this[_0x0baf('0x6')](_0x0baf('0x44'),_0x27f580);var _0x1c7d88=this[_0x0baf('0x45')]({'plain':!![]});switch(_0x27f580){case 0x0:case 0x1:var _0x14e6d0=_0x1c7d88[_0x0baf('0x24')]?_['isArray'](_0x1c7d88[_0x0baf('0x24')])?_0x1c7d88['transport'][_0x0baf('0x25')]():_0x1c7d88['transport']:'udp';if(_0x14e6d0===_0x0baf('0x46')){_0x14e6d0='udp';}this[_0x0baf('0x6')](_0x0baf('0x24'),_0x14e6d0);this['setDataValue'](_0x0baf('0x47'),'no');this[_0x0baf('0x6')](_0x0baf('0x48'),null);this['setDataValue']('force_avp',null);this[_0x0baf('0x6')](_0x0baf('0x49'),null);this[_0x0baf('0x6')](_0x0baf('0x4a'),null);this[_0x0baf('0x6')]('dtlsverify',null);this[_0x0baf('0x6')]('dtlssetup',null);this['setDataValue']('dtlscertfile',null);this[_0x0baf('0x6')]('dtlsprivatekey',null);this['setDataValue'](_0x0baf('0x4b'),'no');break;case 0x2:this[_0x0baf('0x6')](_0x0baf('0x24'),_0x0baf('0x46'));this[_0x0baf('0x6')](_0x0baf('0x47'),'yes');this[_0x0baf('0x6')](_0x0baf('0x48'),_0x0baf('0x2b'));this[_0x0baf('0x6')](_0x0baf('0x4c'),_0x0baf('0x2b'));this['setDataValue'](_0x0baf('0x49'),_0x0baf('0x2b'));this[_0x0baf('0x6')]('dtlsenable',_0x0baf('0x2b'));this[_0x0baf('0x6')](_0x0baf('0x4d'),'no');this[_0x0baf('0x6')](_0x0baf('0x4e'),_0x0baf('0x41'));this[_0x0baf('0x6')]('dtlscertfile',_0x1c7d88['dtlscertfile']||'/etc/pki/tls/certs/motion.crt');this[_0x0baf('0x6')](_0x0baf('0x4f'),_0x1c7d88[_0x0baf('0x4f')]||_0x0baf('0x50'));this[_0x0baf('0x6')](_0x0baf('0x4b'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x34c1f4){this['setDataValue'](_0x0baf('0x51'),_0x34c1f4?_0x34c1f4[_0x0baf('0x25')](','):[]);},'get':function(){return this['getDataValue'](_0x0baf('0x51'))?_[_0x0baf('0x52')](this[_0x0baf('0xc')](_0x0baf('0x51'))[_0x0baf('0x26')](','),function(_0x33a5af){return parseInt(_0x33a5af,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0baf('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x0baf('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x0baf('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x0baf('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x0baf('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x0baf('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x0baf('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x0baf('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':![]}}; \ No newline at end of file +var _0xe706=['admin','user','agent','telephone','local','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','nonat','get','isArray','wss','avpf','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','force_avp','icesupport','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','map','sequelize','moment','util','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','ENUM'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xe706,0xa3));var _0x6e70=function(_0x3d4876,_0x366386){_0x3d4876=_0x3d4876-0x0;var _0x58ca9d=_0xe706[_0x3d4876];return _0x58ca9d;};'use strict';var Sequelize=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var util=require(_0x6e70('0x2'));var _=require('lodash');module[_0x6e70('0x3')]={'name':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'unique':_0x6e70('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x7dfbc3){this[_0x6e70('0x6')](_0x6e70('0x5'),_0x7dfbc3);this[_0x6e70('0x6')](_0x6e70('0x7'),_0x7dfbc3);},'comment':_0x6e70('0x8')},'fullname':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'set':function(_0x36357b){this[_0x6e70('0x6')](_0x6e70('0x9'),_0x36357b);this[_0x6e70('0x6')](_0x6e70('0xa'),util[_0x6e70('0xb')](_0x6e70('0xc'),_0x36357b,this[_0x6e70('0xd')](_0x6e70('0xe'))));}},'alias':{'type':Sequelize[_0x6e70('0x4')]},'email':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'unique':_0x6e70('0xf'),'validate':{'isEmail':!![]},'set':function(_0x37b3e0){if(_0x37b3e0){this[_0x6e70('0x6')]('email',_0x37b3e0['toLowerCase']());}}},'role':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x11'),_0x6e70('0x12'),_0x6e70('0x13'),_0x6e70('0x14')),'allowNull':![]},'password':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':_0x6e70('0x15')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':'internal','set':function(_0x48bc72){this[_0x6e70('0x6')]('internal',_0x48bc72);this['setDataValue'](_0x6e70('0x16'),_0x48bc72);this[_0x6e70('0x6')]('callerid',util[_0x6e70('0xb')]('\x22%s\x22\x20<%s>',this[_0x6e70('0xd')](_0x6e70('0x9')),_0x48bc72));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x6e70('0x4')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x6e70('0x4')]},'userpic':{'type':Sequelize[_0x6e70('0x4')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x6e70('0x18')]},'voicePause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':_0x6e70('0x19')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x6e70('0x1a')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x6e70('0x1a')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x6e70('0x1a')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x6e70('0x1a')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x13c4},'phoneBarExpires':{'type':Sequelize[_0x6e70('0x1a')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![],'defaultValue':_0x6e70('0x1b')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x6e70('0x1a')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x6e70('0x1a')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x6e70('0x1a')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x1c'),_0x6e70('0x12'),_0x6e70('0x1d')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![],'defaultValue':_0x6e70('0x1e')},'callingpres':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x1f'),_0x6e70('0x20'),_0x6e70('0x21'),_0x6e70('0x22'),_0x6e70('0x23'),_0x6e70('0x24'),_0x6e70('0x25'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![],'defaultValue':_0x6e70('0x26'),'set':function(_0x56f6f7){this[_0x6e70('0x6')](_0x6e70('0x27'),_0x56f6f7?_0x56f6f7['join'](','):null);},'get':function(){return this[_0x6e70('0xd')](_0x6e70('0x27'))?this['getDataValue'](_0x6e70('0x27'))[_0x6e70('0x28')](','):null;},'comment':_0x6e70('0x29')},'dtmfmode':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2a'),_0x6e70('0x2b'),_0x6e70('0x2c'),_0x6e70('0x2d'),_0x6e70('0x2e')),'allowNull':!![],'defaultValue':_0x6e70('0x2a')},'directmedia':{'type':Sequelize['ENUM'](_0x6e70('0x2f'),'no','nonat',_0x6e70('0x30'),_0x6e70('0x31')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![],'defaultValue':_0x6e70('0x32'),'set':function(_0x80bebb){this[_0x6e70('0x6')](_0x6e70('0x33'),_0x80bebb?_0x80bebb[_0x6e70('0x34')](','):null);},'get':function(){return this[_0x6e70('0xd')]('nat')?this['getDataValue']('nat')[_0x6e70('0x28')](','):null;},'comment':_0x6e70('0x35')},'callgroup':{'type':Sequelize[_0x6e70('0x4')]},'namedcallgroup':{'type':Sequelize[_0x6e70('0x4')]},'pickupgroup':{'type':Sequelize[_0x6e70('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x6e70('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6e70('0x4')]},'disallow':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'defaultValue':_0x6e70('0x36')},'allow':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'defaultValue':_0x6e70('0x37'),'set':function(_0x37bf46){this[_0x6e70('0x6')](_0x6e70('0x38'),_0x37bf46?_0x37bf46['join'](';'):_0x6e70('0x37'));},'get':function(){return this[_0x6e70('0xd')](_0x6e70('0x38'))?this[_0x6e70('0xd')](_0x6e70('0x38'))[_0x6e70('0x28')](';'):null;},'comment':_0x6e70('0x39')},'autoframing':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x154e0c){this[_0x6e70('0x6')](_0x6e70('0x3a'),_0x154e0c?_0x154e0c[_0x6e70('0x34')](','):null);},'get':function(){return this[_0x6e70('0xd')]('insecure')?this[_0x6e70('0xd')](_0x6e70('0x3a'))[_0x6e70('0x28')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x6e70('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no',_0x6e70('0x3b')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x6e70('0x10')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x6e70('0x10')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x6e70('0x1a')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![],'defaultValue':_0x6e70('0x3c')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no'),'allowNull':!![],'defaultValue':_0x6e70('0x2f')},'busylevel':{'type':Sequelize[_0x6e70('0x1a')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x6e70('0x10')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x6e70('0x10')]('yes','no',_0x6e70('0x3d')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x6e70('0x3e'),_0x6e70('0x3f'),_0x6e70('0x40')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x41'),_0x6e70('0x42')),'allowNull':!![],'defaultValue':_0x6e70('0x42')},'t38pt_usertpsource':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no'),'allowNull':!![],'defaultValue':_0x6e70('0x2f')},'keepalive':{'type':Sequelize[_0x6e70('0x1a')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x6e70('0x1a')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x6e70('0x1a')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x6e70('0x1a')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x6e70('0x1a')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x6e70('0x1a')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x6e70('0x1a')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x6e70('0x1a')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x6e70('0x2f'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x6e70('0x10')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x6e70('0x2f'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no',_0x6e70('0x43'),_0x6e70('0x44')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x45'),_0x6e70('0x46'),_0x6e70('0x47')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x6e70('0x1a')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no',_0x6e70('0x48'),_0x6e70('0x30'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x6e70('0x4')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'showWebBar':{'type':Sequelize[_0x6e70('0x1a')],'defaultValue':0x0,'set':function(_0x692205){this[_0x6e70('0x6')]('showWebBar',_0x692205);var _0x51f268=this[_0x6e70('0x49')]({'plain':!![]});switch(_0x692205){case 0x0:case 0x1:var _0xd6bccd=_0x51f268[_0x6e70('0x27')]?_[_0x6e70('0x4a')](_0x51f268[_0x6e70('0x27')])?_0x51f268[_0x6e70('0x27')][_0x6e70('0x34')]():_0x51f268['transport']:'udp';if(_0xd6bccd===_0x6e70('0x4b')){_0xd6bccd=_0x6e70('0x26');}this[_0x6e70('0x6')](_0x6e70('0x27'),_0xd6bccd);this['setDataValue']('encryption','no');this[_0x6e70('0x6')](_0x6e70('0x4c'),null);this['setDataValue']('force_avp',null);this[_0x6e70('0x6')]('icesupport',null);this[_0x6e70('0x6')](_0x6e70('0x4d'),null);this[_0x6e70('0x6')](_0x6e70('0x4e'),null);this[_0x6e70('0x6')](_0x6e70('0x4f'),null);this[_0x6e70('0x6')](_0x6e70('0x50'),null);this['setDataValue'](_0x6e70('0x51'),null);this[_0x6e70('0x6')](_0x6e70('0x52'),'no');break;case 0x2:this[_0x6e70('0x6')](_0x6e70('0x27'),'wss');this['setDataValue']('encryption',_0x6e70('0x2f'));this[_0x6e70('0x6')](_0x6e70('0x4c'),'yes');this['setDataValue'](_0x6e70('0x53'),_0x6e70('0x2f'));this[_0x6e70('0x6')](_0x6e70('0x54'),_0x6e70('0x2f'));this[_0x6e70('0x6')]('dtlsenable',_0x6e70('0x2f'));this[_0x6e70('0x6')](_0x6e70('0x4e'),'no');this[_0x6e70('0x6')]('dtlssetup',_0x6e70('0x47'));this['setDataValue']('dtlscertfile',_0x51f268[_0x6e70('0x50')]||_0x6e70('0x55'));this[_0x6e70('0x6')](_0x6e70('0x51'),_0x51f268[_0x6e70('0x51')]||_0x6e70('0x56'));this['setDataValue'](_0x6e70('0x52'),_0x6e70('0x2f'));break;default:}}},'permissions':{'type':Sequelize[_0x6e70('0x57')],'set':function(_0x18e64c){this[_0x6e70('0x6')](_0x6e70('0x58'),_0x18e64c?_0x18e64c[_0x6e70('0x34')](','):[]);},'get':function(){return this[_0x6e70('0xd')](_0x6e70('0x58'))?_[_0x6e70('0x59')](this['getDataValue'](_0x6e70('0x58'))[_0x6e70('0x28')](','),function(_0x577c3b){return parseInt(_0x577c3b,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x6e70('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x6e70('0x1a')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x6e70('0x4')]},'passwordResetAt':{'type':Sequelize[_0x6e70('0x18')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 2e0fccb..253b9d6 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 _0x8ecb=['UserId','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','connection','remoteAddress','socket','UserVoiceQueue.penalty','MemberReport','forEach','all','YYYY-MM-DD\x20HH:mm:ss','push','LOGIN','PAUSE','LOGININPAUSE','concat','logout','pause','QueuePause','updateAttributes','getChannels','type','DEFAULT\x20PAUSE','mailPause','chatPause','faxPause','openchannelPause','smsPause','pauseType','unpause','manual','mail','chat','fax','sms','openchannel','Pause','getTeams','Team','addTeams','removeTeams','getLists','getAgents','Agents','getVoiceQueues','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','user_has_sms_interactions:remove','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','$and','$or','$gt','$gte','$lt','$eq','$not','$between','$notBetween','$notIn','$like','$notLike','$notILike','$contains','$contained','CmHopper','lastName','dialActive','VoiceQueue','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./user.socket','jayson/promise','client','http','request','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','json','offset','limit','status','set','Content-Range','apply','reject','update','then','end','stack','name','send','index','User','rawAttributes','model','password','salt','query','dateEnd','dateStart','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','day','merge','filter','map','sequelize','col','lower','options','count','includeAll','include','findAll','rows','catch','show','find','bulkCreate','body','params','describe','addContacts','omit','ids','agent','agent\x20role','role','telephone','user','../../config/license/util','getLicense','telephones','isNil','format','count\x20%s:\x20%s','create','Setting','findById','min_internal','max','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','mailbox','VoiceMail','fullname','email','permissions','102','103','110','105','106','108','109','100','111','changePassword','oldPassword','newPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','authenticate','ValidationError','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','admin','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','loginInPause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','emit','channel','voice','SIP/%s','voicePause','each','UserVoiceQueueRt','upsert','removeQueues','remove','destroy','addAvatar','userpic','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getContacts','findOne','CmContact','CmList','List','Tags','color','tag','getQueues','Queue','pick','get','getVoiceQueuesRt','getGroups','getRecordings','VoiceRecording'];(function(_0xa83612,_0x5989b9){var _0x5b0b5e=function(_0x1a94c7){while(--_0x1a94c7){_0xa83612['push'](_0xa83612['shift']());}};_0x5b0b5e(++_0x5989b9);}(_0x8ecb,0x1be));var _0xb8ec=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x8ecb[_0x618414];return _0x21c19a;};'use strict';var pdf=require(_0xb8ec('0x0'));var emlformat=require(_0xb8ec('0x1'));var rimraf=require(_0xb8ec('0x2'));var zipdir=require(_0xb8ec('0x3'));var jsonpatch=require(_0xb8ec('0x4'));var rp=require(_0xb8ec('0x5'));var moment=require(_0xb8ec('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb8ec('0x7'));var path=require(_0xb8ec('0x8'));var sox=require(_0xb8ec('0x9'));var csv=require(_0xb8ec('0xa'));var ejs=require(_0xb8ec('0xb'));var fs=require('fs');var _=require(_0xb8ec('0xc'));var squel=require(_0xb8ec('0xd'));var crypto=require(_0xb8ec('0xe'));var jsforce=require(_0xb8ec('0xf'));var deskjs=require(_0xb8ec('0x10'));var toCsv=require(_0xb8ec('0xa'));var querystring=require(_0xb8ec('0x11'));var Papa=require(_0xb8ec('0x12'));var Redis=require(_0xb8ec('0x13'));var qs=require(_0xb8ec('0x14'));var logger=require('../../config/logger')(_0xb8ec('0x15'));var utils=require(_0xb8ec('0x16'));var config=require(_0xb8ec('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xb8ec('0x18')](config[_0xb8ec('0x19')],{'host':_0xb8ec('0x1a'),'port':0x18eb});var socket=require(_0xb8ec('0x1b'))(new Redis(config[_0xb8ec('0x19')]));require(_0xb8ec('0x1c'))['register'](socket);var jayson=require(_0xb8ec('0x1d'));var client=jayson[_0xb8ec('0x1e')][_0xb8ec('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x33668c,_0x419cec,_0x5ef904,_0x1a242e){return new BPromise(function(_0x8f039e,_0x5eed01){var _0x75b6c0=_0x1a242e||client;return _0x75b6c0[_0xb8ec('0x20')](_0x33668c,_0x5ef904)['then'](function(_0x3cecdb){logger[_0xb8ec('0x21')](_0xb8ec('0x22'),_0x419cec,_0xb8ec('0x23'));logger['debug'](_0xb8ec('0x24'),_0x419cec,'request\x20sent',JSON[_0xb8ec('0x25')](_0x3cecdb));if(_0x3cecdb[_0xb8ec('0x26')]){if(_0x3cecdb[_0xb8ec('0x26')][_0xb8ec('0x27')]===0x1f4){logger[_0xb8ec('0x26')](_0xb8ec('0x22'),_0x419cec,_0x3cecdb[_0xb8ec('0x26')][_0xb8ec('0x28')]);return _0x5eed01(_0x3cecdb[_0xb8ec('0x26')][_0xb8ec('0x28')]);}logger[_0xb8ec('0x26')](_0xb8ec('0x22'),_0x419cec,_0x3cecdb['error'][_0xb8ec('0x28')]);return _0x8f039e(_0x3cecdb[_0xb8ec('0x26')]['message']);}else{logger[_0xb8ec('0x21')](_0xb8ec('0x22'),_0x419cec,'request\x20sent');_0x8f039e(_0x3cecdb['result'][_0xb8ec('0x28')]);}})['catch'](function(_0x3ad648){logger['error']('User,\x20%s,\x20%s',_0x419cec,_0x3ad648);_0x5eed01(_0x3ad648);});});}function respondWithStatusCode(_0x346990,_0x1de71c){_0x1de71c=_0x1de71c||0xcc;return function(_0x3c1020){if(_0x3c1020){return _0x346990[_0xb8ec('0x29')](_0x1de71c);}return _0x346990['status'](_0x1de71c)['end']();};}function respondWithResult(_0x2f20f4,_0x173ea8){_0x173ea8=_0x173ea8||0xc8;return function(_0x3ca6ea){if(_0x3ca6ea){return _0x2f20f4['status'](_0x173ea8)[_0xb8ec('0x2a')](_0x3ca6ea);}};}function respondWithFilteredResult(_0x4ea5f4,_0x5a2028){return function(_0x2b9667){if(_0x2b9667){var _0x1012d6=_0x2b9667['count'],_0x52c30e=_0x5a2028[_0xb8ec('0x2b')],_0x34709e=_0x5a2028[_0xb8ec('0x2b')]+_0x5a2028[_0xb8ec('0x2c')],_0x4fac23;if(_0x34709e>=_0x1012d6){_0x34709e=_0x1012d6;_0x4fac23=0xc8;}else{_0x4fac23=0xce;}_0x4ea5f4[_0xb8ec('0x2d')](_0x4fac23);return _0x4ea5f4[_0xb8ec('0x2e')](_0xb8ec('0x2f'),_0x52c30e+'-'+_0x34709e+'/'+_0x1012d6)['json'](_0x2b9667);}return null;};}function patchUpdates(_0x1d53ba){return function(_0x5aabd3){try{jsonpatch[_0xb8ec('0x30')](_0x5aabd3,_0x1d53ba,!![]);}catch(_0xcb600b){return BPromise[_0xb8ec('0x31')](_0xcb600b);}return _0x5aabd3['save']();};}function saveUpdates(_0x331f9b,_0x2db898){return function(_0x3d5055){if(_0x3d5055){return _0x3d5055[_0xb8ec('0x32')](_0x331f9b)['then'](function(_0x5b1bec){return _0x5b1bec;});}return null;};}function removeEntity(_0x3127a8,_0x4f8184){return function(_0x5a7b50){if(_0x5a7b50){return _0x5a7b50['destroy']()[_0xb8ec('0x33')](function(){_0x3127a8[_0xb8ec('0x2d')](0xcc)[_0xb8ec('0x34')]();});}};}function handleEntityNotFound(_0x1d9960,_0x58e3ee){return function(_0x317ed1){if(!_0x317ed1){_0x1d9960['sendStatus'](0x194);}return _0x317ed1;};}function handleError(_0x21e964,_0x39b2a1){_0x39b2a1=_0x39b2a1||0x1f4;return function(_0x515454){logger[_0xb8ec('0x26')](_0x515454[_0xb8ec('0x35')]);if(_0x515454[_0xb8ec('0x36')]){delete _0x515454[_0xb8ec('0x36')];}_0x21e964[_0xb8ec('0x2d')](_0x39b2a1)[_0xb8ec('0x37')](_0x515454);};}exports[_0xb8ec('0x38')]=function(_0xda584f,_0x392928){var _0x2b5dc8={},_0x3cdc01={},_0x2186f2={'count':0x0,'rows':[]};var _0x3cc0a2=db[_0xb8ec('0x39')][_0xb8ec('0x3a')];_0x3cdc01[_0xb8ec('0x3b')]=_['differenceBy'](_['keys'](_0x3cc0a2),[_0xb8ec('0x3c'),_0xb8ec('0x3d')]);var _0x3ea6d9={'dateStart':_0xda584f[_0xb8ec('0x3e')]['dateStart'],'dateEnd':_0xda584f['query'][_0xb8ec('0x3f')]};delete _0xda584f[_0xb8ec('0x3e')][_0xb8ec('0x40')];delete _0xda584f['query']['dateEnd'];_0x3cdc01[_0xb8ec('0x3e')]=_[_0xb8ec('0x41')](_0xda584f[_0xb8ec('0x3e')]);_0x3cdc01['filters']=_['intersection'](_0x3cdc01['model'],_0x3cdc01[_0xb8ec('0x3e')]);_0x2b5dc8[_0xb8ec('0x42')]=_[_0xb8ec('0x43')](_0x3cdc01[_0xb8ec('0x3b')],qs[_0xb8ec('0x44')](_0xda584f[_0xb8ec('0x3e')][_0xb8ec('0x44')]));_0x2b5dc8[_0xb8ec('0x42')]=_0x2b5dc8[_0xb8ec('0x42')][_0xb8ec('0x45')]?_0x2b5dc8[_0xb8ec('0x42')]:_0x3cdc01[_0xb8ec('0x3b')];if(!_0xda584f['query'][_0xb8ec('0x46')](_0xb8ec('0x47'))){_0x2b5dc8['limit']=qs[_0xb8ec('0x2c')](_0xda584f[_0xb8ec('0x3e')]['limit']);_0x2b5dc8[_0xb8ec('0x2b')]=qs['offset'](_0xda584f[_0xb8ec('0x3e')][_0xb8ec('0x2b')]);}_0x2b5dc8[_0xb8ec('0x48')]=qs['sort'](_0xda584f[_0xb8ec('0x3e')][_0xb8ec('0x49')]);_0x2b5dc8[_0xb8ec('0x4a')]=qs[_0xb8ec('0x4b')](_['pick'](_0xda584f[_0xb8ec('0x3e')],_0x3cdc01[_0xb8ec('0x4b')]));if(_0x3ea6d9[_0xb8ec('0x40')]){if(_0x3ea6d9['dateEnd']){_0x3ea6d9['dateEnd']=moment(_0x3ea6d9[_0xb8ec('0x3f')])['add'](0x1,_0xb8ec('0x4c'));}else{_0x3ea6d9[_0xb8ec('0x3f')]=moment(_0x3ea6d9[_0xb8ec('0x40')])['add'](0x1,'day');}_[_0xb8ec('0x4d')](_0x2b5dc8[_0xb8ec('0x4a')],{'createdAt':{'$gte':_0x3ea6d9[_0xb8ec('0x40')],'$lte':_0x3ea6d9['dateEnd']}});}if(_0xda584f['query'][_0xb8ec('0x4e')]){_0x2b5dc8[_0xb8ec('0x4a')]=_[_0xb8ec('0x4d')](_0x2b5dc8[_0xb8ec('0x4a')],{'$or':_[_0xb8ec('0x4f')](_0x2b5dc8[_0xb8ec('0x42')],function(_0x4f8045){return db[_0xb8ec('0x50')][_0xb8ec('0x4a')](db['sequelize']['fn']('lower',db[_0xb8ec('0x50')][_0xb8ec('0x51')](_0x4f8045)),{'$like':db[_0xb8ec('0x50')]['fn'](_0xb8ec('0x52'),'%'+_0xda584f[_0xb8ec('0x3e')][_0xb8ec('0x4e')]+'%')});})});}_0x2b5dc8=_[_0xb8ec('0x4d')]({},_0x2b5dc8,_0xda584f[_0xb8ec('0x53')]);var _0x47ff31={'where':_0x2b5dc8[_0xb8ec('0x4a')]};return db['User'][_0xb8ec('0x54')](_0x47ff31)[_0xb8ec('0x33')](function(_0xf28b2b){_0x2186f2[_0xb8ec('0x54')]=_0xf28b2b;if(_0xda584f[_0xb8ec('0x3e')][_0xb8ec('0x55')]){_0x2b5dc8[_0xb8ec('0x56')]=[{'all':!![]}];}return db[_0xb8ec('0x39')][_0xb8ec('0x57')](_0x2b5dc8);})[_0xb8ec('0x33')](function(_0x110bdc){_0x2186f2[_0xb8ec('0x58')]=_0x110bdc;return _0x2186f2;})['then'](respondWithFilteredResult(_0x392928,_0x2b5dc8))[_0xb8ec('0x59')](handleError(_0x392928,null));};exports[_0xb8ec('0x5a')]=function(_0x5529e5,_0x3fce87){var _0x537409={'raw':![],'where':{'id':_0x5529e5['params']['id']}},_0x25978a={};_0x25978a[_0xb8ec('0x3b')]=_['differenceBy'](_[_0xb8ec('0x41')](db[_0xb8ec('0x39')]['rawAttributes']),[_0xb8ec('0x3c'),'salt']);_0x25978a[_0xb8ec('0x3e')]=_['keys'](_0x5529e5[_0xb8ec('0x3e')]);_0x25978a[_0xb8ec('0x4b')]=_[_0xb8ec('0x43')](_0x25978a[_0xb8ec('0x3b')],_0x25978a[_0xb8ec('0x3e')]);_0x537409['attributes']=_['intersection'](_0x25978a[_0xb8ec('0x3b')],qs[_0xb8ec('0x44')](_0x5529e5['query']['fields']));_0x537409[_0xb8ec('0x42')]=_0x537409[_0xb8ec('0x42')][_0xb8ec('0x45')]?_0x537409[_0xb8ec('0x42')]:_0x25978a[_0xb8ec('0x3b')];if(_0x5529e5[_0xb8ec('0x3e')]['includeAll']){_0x537409[_0xb8ec('0x56')]=[{'all':!![]}];}_0x537409=_[_0xb8ec('0x4d')]({},_0x537409,_0x5529e5[_0xb8ec('0x53')]);return db[_0xb8ec('0x39')][_0xb8ec('0x5b')](_0x537409)[_0xb8ec('0x33')](handleEntityNotFound(_0x3fce87,null))[_0xb8ec('0x33')](respondWithResult(_0x3fce87,null))['catch'](handleError(_0x3fce87,null));};exports['bulkCreate']=function(_0x3c0bf9,_0x46b751){return db[_0xb8ec('0x39')][_0xb8ec('0x5c')](_0x3c0bf9['body'],{'raw':![],'individualHooks':!![]})[_0xb8ec('0x33')](respondWithResult(_0x46b751,0xc9))[_0xb8ec('0x59')](handleError(_0x46b751,null));};exports[_0xb8ec('0x32')]=function(_0x3b2b6f,_0x467b89){if(_0x3b2b6f[_0xb8ec('0x5d')]['id']){delete _0x3b2b6f['body']['id'];}return db[_0xb8ec('0x39')][_0xb8ec('0x5b')]({'where':{'id':_0x3b2b6f[_0xb8ec('0x5e')]['id']}})['then'](handleEntityNotFound(_0x467b89,null))[_0xb8ec('0x33')](saveUpdates(_0x3b2b6f['body'],null))[_0xb8ec('0x33')](respondWithResult(_0x467b89,null))['catch'](handleError(_0x467b89,null));};exports[_0xb8ec('0x5f')]=function(_0x4b9608,_0x3221cc){return db['User'][_0xb8ec('0x5f')]()[_0xb8ec('0x33')](respondWithResult(_0x3221cc,null))[_0xb8ec('0x59')](handleError(_0x3221cc,null));};exports[_0xb8ec('0x60')]=function(_0x5c7f4a,_0x5ae332,_0x4dd49e){return db['User'][_0xb8ec('0x5b')]({'where':{'id':_0x5c7f4a[_0xb8ec('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5ae332,null))[_0xb8ec('0x33')](function(_0x27bd3b){if(_0x27bd3b){return _0x27bd3b[_0xb8ec('0x60')](_0x5c7f4a['body']['ids'],_[_0xb8ec('0x61')](_0x5c7f4a[_0xb8ec('0x5d')],[_0xb8ec('0x62'),'id'])||{});}})[_0xb8ec('0x33')](respondWithResult(_0x5ae332,null))['catch'](handleError(_0x5ae332,null));};var getLicense=function(_0x4bd43f){return new BPromise(function(_0x46310c,_0x567a49){var _0x4c35e6=0x0;_0x4bd43f[_0xb8ec('0x5d')]['role']===_0xb8ec('0x63')&&_0x46310c(_0xb8ec('0x64'));return db[_0xb8ec('0x39')][_0xb8ec('0x54')]({'where':{'$or':[{'role':_0x4bd43f[_0xb8ec('0x5d')][_0xb8ec('0x65')]===_0xb8ec('0x66')?'telephone':['admin',_0xb8ec('0x67')]}]}})[_0xb8ec('0x33')](function(_0x3dac89){_0x4c35e6=_0x3dac89;return require(_0xb8ec('0x68'))[_0xb8ec('0x69')]();})['then'](function(_0x4ff459){var _0x20e166=_0x4bd43f[_0xb8ec('0x5d')][_0xb8ec('0x65')]===_0xb8ec('0x66')?_0xb8ec('0x6a'):'users';if(!_[_0xb8ec('0x6b')](_0x4ff459[_0x20e166])&&_0x4c35e6>=_0x4ff459[_0x20e166]){return _0x567a49({'message':'License\x20limit\x20reached'});}return _0x46310c(util[_0xb8ec('0x6c')](_0xb8ec('0x6d'),_0x20e166,_0x4c35e6));})[_0xb8ec('0x59')](function(_0x134f81){return _0x567a49(_0x134f81);});});};exports[_0xb8ec('0x6e')]=function(_0x12e257,_0x434e3b){return getLicense(_0x12e257)[_0xb8ec('0x33')](function(_0x40d13f){if(!_0x12e257[_0xb8ec('0x5d')]['internal']){var _0x26ebb9;return db[_0xb8ec('0x6f')][_0xb8ec('0x70')](0x1)['then'](function(_0x269d0e){_0x26ebb9=_0x269d0e[_0xb8ec('0x71')];return db['User'][_0xb8ec('0x72')]('internal');})[_0xb8ec('0x33')](function(_0x129634){if(_[_0xb8ec('0x6b')](_0x129634)){if(_0x26ebb9){_0x12e257[_0xb8ec('0x5d')]['internal']=_0x26ebb9;}else{_0x12e257[_0xb8ec('0x5d')][_0xb8ec('0x73')]=0x1;}}else{if(_['isNil'](_0x26ebb9)||_0x26ebb9==_0x129634){_0x12e257[_0xb8ec('0x5d')][_0xb8ec('0x73')]=_0x129634+0x1;}else if(_0x26ebb9>_0x129634){_0x12e257['body'][_0xb8ec('0x73')]=_0x26ebb9;}else{return db[_0xb8ec('0x50')][_0xb8ec('0x3e')](_0xb8ec('0x74'),{'type':db[_0xb8ec('0x50')][_0xb8ec('0x75')][_0xb8ec('0x76')]})['then'](function(_0xeed380){if(_0xeed380&&_0xeed380['length']){for(var _0x17e75c=0x0,_0x233cc3=_0xeed380[_0xb8ec('0x45')];_0x17e75c<_0x233cc3&&_['isNil'](_0x12e257[_0xb8ec('0x5d')]['internal']);_0x17e75c++){if(_0x26ebb9<=_0xeed380[_0x17e75c][_0xb8ec('0x77')]){_0x12e257[_0xb8ec('0x5d')]['internal']=_0xeed380[_0x17e75c]['from'];}else if(_0x26ebb9>_0xeed380[_0x17e75c][_0xb8ec('0x77')]&&_0x26ebb9<=_0xeed380[_0x17e75c]['to']){_0x12e257[_0xb8ec('0x5d')][_0xb8ec('0x73')]=_0x26ebb9;}}}if(_[_0xb8ec('0x6b')](_0x12e257[_0xb8ec('0x5d')][_0xb8ec('0x73')])){_0x12e257[_0xb8ec('0x5d')][_0xb8ec('0x73')]=_0x129634+0x1;}});}}});}})[_0xb8ec('0x33')](function(){if(_0x12e257[_0xb8ec('0x5d')][_0xb8ec('0x78')]){_0x12e257[_0xb8ec('0x5d')][_0xb8ec('0x79')]=_0x12e257[_0xb8ec('0x5d')][_0xb8ec('0x73')];_0x12e257['body'][_0xb8ec('0x7a')]={'mailbox':_0x12e257[_0xb8ec('0x5d')][_0xb8ec('0x73')],'password':_0x12e257[_0xb8ec('0x5d')]['password'],'fullname':_0x12e257[_0xb8ec('0x5d')][_0xb8ec('0x7b')],'email':_0x12e257['body'][_0xb8ec('0x7c')]};}if(_0x12e257['body']&&_0x12e257[_0xb8ec('0x5d')][_0xb8ec('0x65')]===_0xb8ec('0x63')){_0x12e257[_0xb8ec('0x5d')][_0xb8ec('0x7d')]=['101',_0xb8ec('0x7e'),_0xb8ec('0x7f'),_0xb8ec('0x80'),'104',_0xb8ec('0x81'),_0xb8ec('0x82'),'107',_0xb8ec('0x83'),_0xb8ec('0x84'),_0xb8ec('0x85'),_0xb8ec('0x86')];}return db[_0xb8ec('0x39')][_0xb8ec('0x6e')](_0x12e257['body'],{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})[_0xb8ec('0x33')](respondWithResult(_0x434e3b,0xc9))[_0xb8ec('0x59')](handleError(_0x434e3b,null));};exports[_0xb8ec('0x87')]=function(_0x4e3ac6,_0x656c9b,_0x67d279){if(_0x4e3ac6['body']['id']){delete _0x4e3ac6[_0xb8ec('0x5d')]['id'];}return db[_0xb8ec('0x39')][_0xb8ec('0x5b')]({'where':{'id':_0x4e3ac6[_0xb8ec('0x5e')]['id']}})[_0xb8ec('0x33')](function(_0x4ca996){if(_0x4ca996){if(_0x4ca996['id']==_0x4e3ac6[_0xb8ec('0x67')]['id']){if(!_0x4e3ac6[_0xb8ec('0x5d')][_0xb8ec('0x88')]||!_0x4e3ac6['body'][_0xb8ec('0x89')]){throw new db[(_0xb8ec('0x8a'))]['ValidationError'](_0xb8ec('0x8b'));}if(!_0x4ca996[_0xb8ec('0x8c')](_0x4e3ac6[_0xb8ec('0x5d')][_0xb8ec('0x88')])){throw new db[(_0xb8ec('0x8a'))][(_0xb8ec('0x8d'))](_0xb8ec('0x8e'));}if(_0x4e3ac6[_0xb8ec('0x5d')][_0xb8ec('0x88')]==_0x4e3ac6['body']['newPassword']){throw new db['Sequelize'][(_0xb8ec('0x8d'))](_0xb8ec('0x8f'));}return _0x4ca996;}else if(_0x4e3ac6[_0xb8ec('0x67')]['role']==_0xb8ec('0x90')){if(!_0x4e3ac6[_0xb8ec('0x5d')][_0xb8ec('0x89')]){throw new db['Sequelize']['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}return _0x4ca996;}else if(_0x4e3ac6[_0xb8ec('0x67')][_0xb8ec('0x65')]==_0xb8ec('0x67')){if(!_0x4e3ac6[_0xb8ec('0x5d')]['newPassword']){throw new db['Sequelize'][(_0xb8ec('0x8d'))](_0xb8ec('0x91'));}if(_0x4ca996[_0xb8ec('0x65')]!='agent'){throw new db[(_0xb8ec('0x8a'))][(_0xb8ec('0x8d'))](_0xb8ec('0x92'));}return _0x4ca996;}else{throw new db[(_0xb8ec('0x8a'))]['ValidationError'](_0xb8ec('0x92'));}}return null;})['then'](handleEntityNotFound(_0x656c9b,null))[_0xb8ec('0x33')](saveUpdates({'password':_0x4e3ac6[_0xb8ec('0x5d')][_0xb8ec('0x89')],'passwordResetAt':_0x4e3ac6[_0xb8ec('0x67')]['id']==_0x4e3ac6[_0xb8ec('0x5e')]['id']?moment():null},null))[_0xb8ec('0x33')](respondWithResult(_0x656c9b,null))[_0xb8ec('0x59')](handleError(_0x656c9b,null));};exports['addQueues']=function(_0x224a7f,_0x4b6de9,_0x28a7a7){var _0x2c40be;return db[_0xb8ec('0x39')][_0xb8ec('0x5b')]({'where':{'id':_0x224a7f[_0xb8ec('0x5e')]['id']},'attributes':['id',_0xb8ec('0x36'),_0xb8ec('0x65'),_0xb8ec('0x93'),'voicePause',_0xb8ec('0x94')]})['then'](handleEntityNotFound(_0x4b6de9,null))['then'](function(_0x241fdc){if(_0x241fdc){_0x2c40be=_0x241fdc;if(!utils[_0xb8ec('0x95')](_0x224a7f[_0xb8ec('0x5d')]['channel'])){throw new db[(_0xb8ec('0x8a'))][(_0xb8ec('0x8d'))](_0xb8ec('0x96'));}return _0x241fdc[_0xb8ec('0x97')+_[_0xb8ec('0x98')](_0x224a7f[_0xb8ec('0x5d')]['channel'][_0xb8ec('0x99')]())+_0xb8ec('0x9a')](_0x224a7f[_0xb8ec('0x5d')]['ids'],{'penalty':_0x224a7f[_0xb8ec('0x5d')][_0xb8ec('0x9b')]||0x0});}})['spread'](function(_0x12342b){for(var _0x40d7cd=0x0;_0x40d7cd<_0x224a7f['body'][_0xb8ec('0x62')][_0xb8ec('0x45')];_0x40d7cd+=0x1){var _0x4adfd7={'UserId':_0x224a7f[_0xb8ec('0x5e')]['id']};_0x4adfd7[_[_0xb8ec('0x98')](_0x224a7f[_0xb8ec('0x5d')]['channel']['toLowerCase']())+'QueueId']=_0x224a7f['body'][_0xb8ec('0x62')][_0x40d7cd];socket[_0xb8ec('0x9c')](_0xb8ec('0x67')+_[_0xb8ec('0x98')](_0x224a7f[_0xb8ec('0x5d')]['channel'][_0xb8ec('0x99')]())+'Queue:save',_0x4adfd7);}return _0x12342b;})['then'](function(){if(_0x224a7f[_0xb8ec('0x5d')][_0xb8ec('0x9d')]===_0xb8ec('0x9e')){return db['VoiceQueue'][_0xb8ec('0x57')]({'where':{'id':_0x224a7f[_0xb8ec('0x5d')][_0xb8ec('0x62')]||[]},'raw':!![],'attributes':['id',_0xb8ec('0x36')]});}})['then'](function(_0x1c2779){var _0x3ff265=[];if(_0x224a7f[_0xb8ec('0x5d')][_0xb8ec('0x9d')]===_0xb8ec('0x9e')&&_0x2c40be['role']==='agent'){for(var _0x50b593=0x0;_0x50b593<_0x1c2779[_0xb8ec('0x45')];_0x50b593+=0x1){_0x3ff265['push']({'membername':_0x2c40be[_0xb8ec('0x36')],'UserId':_0x2c40be['id'],'queue_name':_0x1c2779[_0x50b593][_0xb8ec('0x36')],'VoiceQueueId':_0x1c2779[_0x50b593]['id'],'interface':_[_0xb8ec('0x6b')](_0x2c40be[_0xb8ec('0x94')])?util[_0xb8ec('0x6c')](_0xb8ec('0x9f'),_0x2c40be[_0xb8ec('0x36')]):_0x2c40be[_0xb8ec('0x94')],'paused':_0x2c40be[_0xb8ec('0xa0')]||![],'penalty':_0x224a7f[_0xb8ec('0x5d')][_0xb8ec('0x9b')]||0x0});}return BPromise[_0xb8ec('0xa1')](_0x3ff265,function(_0x130af4){return db[_0xb8ec('0xa2')][_0xb8ec('0xa3')](_0x130af4);});}return _0x2c40be;})[_0xb8ec('0x33')](respondWithStatusCode(_0x4b6de9,null))['catch'](handleError(_0x4b6de9,null));};exports[_0xb8ec('0xa4')]=function(_0x3e9214,_0x536c38,_0x51e9b0){var _0x1be60d;return db[_0xb8ec('0x39')][_0xb8ec('0x5b')]({'where':{'id':_0x3e9214[_0xb8ec('0x5e')]['id']},'attributes':['id',_0xb8ec('0x36'),_0xb8ec('0x65')]})[_0xb8ec('0x33')](handleEntityNotFound(_0x536c38,null))[_0xb8ec('0x33')](function(_0x234fd5){if(_0x234fd5){_0x1be60d=_0x234fd5;if(!_0x3e9214[_0xb8ec('0x3e')][_0xb8ec('0x9d')]||!utils[_0xb8ec('0x95')](_0x3e9214['query'][_0xb8ec('0x9d')])){throw new db[(_0xb8ec('0x8a'))][(_0xb8ec('0x8d'))](_0xb8ec('0x96'));}return _0x234fd5[_0xb8ec('0xa5')+_[_0xb8ec('0x98')](_0x3e9214[_0xb8ec('0x3e')][_0xb8ec('0x9d')]['toLowerCase']())+_0xb8ec('0x9a')](_0x3e9214['query'][_0xb8ec('0x62')]);}})[_0xb8ec('0x33')](function(_0x692bf4){for(var _0x4a6b44=0x0;_0x4a6b44<_0x3e9214[_0xb8ec('0x3e')][_0xb8ec('0x62')][_0xb8ec('0x45')];_0x4a6b44+=0x1){var _0x4ffccf={'UserId':_0x3e9214[_0xb8ec('0x5e')]['id']};_0x4ffccf[_['capitalize'](_0x3e9214[_0xb8ec('0x3e')][_0xb8ec('0x9d')][_0xb8ec('0x99')]())+'QueueId']=_0x3e9214[_0xb8ec('0x3e')][_0xb8ec('0x62')][_0x4a6b44];socket[_0xb8ec('0x9c')](_0xb8ec('0x67')+_[_0xb8ec('0x98')](_0x3e9214['query'][_0xb8ec('0x9d')][_0xb8ec('0x99')]())+'Queue:remove',_0x4ffccf);}return _0x692bf4;})['then'](function(){if(_0x3e9214[_0xb8ec('0x3e')][_0xb8ec('0x9d')]===_0xb8ec('0x9e')){return db[_0xb8ec('0xa2')][_0xb8ec('0xa6')]({'where':{'UserId':_0x3e9214[_0xb8ec('0x5e')]['id'],'VoiceQueueId':_0x3e9214[_0xb8ec('0x3e')][_0xb8ec('0x62')]},'individualHooks':!![]})[_0xb8ec('0x33')](function(){return _0x1be60d;});}return _0x1be60d;})[_0xb8ec('0x33')](respondWithStatusCode(_0x536c38,null))['catch'](handleError(_0x536c38,null));};exports[_0xb8ec('0xa7')]=function(_0x41634d,_0x5332a2,_0x3814a1){_0x41634d['body'][_0xb8ec('0xa8')]=_0x41634d[_0xb8ec('0xa9')][_0xb8ec('0xaa')];return db['User'][_0xb8ec('0x5b')]({'where':{'id':_0x41634d[_0xb8ec('0x5e')]['id']}})[_0xb8ec('0x33')](handleEntityNotFound(_0x5332a2,null))[_0xb8ec('0x33')](saveUpdates(_0x41634d[_0xb8ec('0x5d')],null))[_0xb8ec('0x33')](respondWithResult(_0x5332a2,null))[_0xb8ec('0x59')](handleError(_0x5332a2,null));};exports[_0xb8ec('0xab')]=function(_0x28b383,_0x2c5f2b,_0x7e8a24){var _0x111ce6=path[_0xb8ec('0xac')](config[_0xb8ec('0xad')],_0xb8ec('0xae'));return db['User'][_0xb8ec('0x5b')]({'where':{'id':_0x28b383[_0xb8ec('0x5e')]['id']},'attributes':['id',_0xb8ec('0xa8')],'raw':!![]})[_0xb8ec('0x33')](handleEntityNotFound(_0x2c5f2b,null))[_0xb8ec('0x33')](function(_0xcca936){if(_0xcca936){if(_['isNil'](_0xcca936['userpic'])){return _0x2c5f2b[_0xb8ec('0xaf')](_0x111ce6);}else{if(!fs[_0xb8ec('0xb0')](path[_0xb8ec('0xac')](config['root'],_0xb8ec('0xb1'),_0xcca936['userpic']))){return _0x2c5f2b[_0xb8ec('0xaf')](_0x111ce6);}return _0x2c5f2b[_0xb8ec('0xaf')](path[_0xb8ec('0xac')](config[_0xb8ec('0xad')],_0xb8ec('0xb1'),_0xcca936[_0xb8ec('0xa8')]));}}})[_0xb8ec('0x59')](handleError(_0x2c5f2b,null));};exports[_0xb8ec('0xb2')]=function(_0x40d997,_0xaab276,_0x4ee904){var _0xf85355={};var _0x4f799a={};var _0x5b81d1;var _0x114e50;return db['User'][_0xb8ec('0xb3')]({'where':{'id':_0x40d997[_0xb8ec('0x5e')]['id']}})['then'](handleEntityNotFound(_0xaab276,null))[_0xb8ec('0x33')](function(_0x517e1a){if(_0x517e1a){_0x5b81d1=_0x517e1a;_0x4f799a['model']=_[_0xb8ec('0x41')](db[_0xb8ec('0xb4')][_0xb8ec('0x3a')]);_0x4f799a[_0xb8ec('0x3e')]=_['keys'](_0x40d997[_0xb8ec('0x3e')]);_0x4f799a[_0xb8ec('0x4b')]=_[_0xb8ec('0x43')](_0x4f799a[_0xb8ec('0x3b')],_0x4f799a[_0xb8ec('0x3e')]);_0xf85355[_0xb8ec('0x42')]=_[_0xb8ec('0x43')](_0x4f799a[_0xb8ec('0x3b')],qs[_0xb8ec('0x44')](_0x40d997[_0xb8ec('0x3e')][_0xb8ec('0x44')]));_0xf85355['attributes']=_0xf85355[_0xb8ec('0x42')][_0xb8ec('0x45')]?_0xf85355['attributes']:_0x4f799a[_0xb8ec('0x3b')];_0xf85355[_0xb8ec('0x48')]=qs[_0xb8ec('0x49')](_0x40d997[_0xb8ec('0x3e')][_0xb8ec('0x49')]);_0xf85355['where']=qs[_0xb8ec('0x4b')](_['pick'](_0x40d997[_0xb8ec('0x3e')],_0x4f799a[_0xb8ec('0x4b')]));if(_0x40d997[_0xb8ec('0x3e')][_0xb8ec('0x4e')]){_0xf85355[_0xb8ec('0x4a')]=_['merge'](_0xf85355['where'],{'$or':_[_0xb8ec('0x4f')](_0xf85355[_0xb8ec('0x42')],function(_0x1be020){var _0x429802={};_0x429802[_0x1be020]={'$like':'%'+_0x40d997['query']['filter']+'%'};return _0x429802;})});}_0xf85355=_['merge']({},_0xf85355,_0x40d997[_0xb8ec('0x53')]);return _0x5b81d1[_0xb8ec('0xb2')](_0xf85355);}})[_0xb8ec('0x33')](function(_0x55eb36){if(_0x55eb36){_0x114e50=_0x55eb36[_0xb8ec('0x45')];if(_0x40d997['query'][_0xb8ec('0x46')](_0xb8ec('0x55'))){_0xf85355[_0xb8ec('0x56')]=[{'model':db[_0xb8ec('0xb5')],'as':_0xb8ec('0xb6'),'required':![]},{'model':db['Tag'],'as':_0xb8ec('0xb7'),'attributes':['id',_0xb8ec('0x36'),_0xb8ec('0xb8')],'where':_0x40d997[_0xb8ec('0x3e')][_0xb8ec('0xb9')]?{'id':_0x40d997['query'][_0xb8ec('0xb9')]}:undefined,'required':_0x40d997[_0xb8ec('0x3e')][_0xb8ec('0xb9')]?!![]:![]}];}if(!_0x40d997['query'][_0xb8ec('0x46')](_0xb8ec('0x47'))){_0xf85355['limit']=qs['limit'](_0x40d997[_0xb8ec('0x3e')][_0xb8ec('0x2c')]);_0xf85355[_0xb8ec('0x2b')]=qs[_0xb8ec('0x2b')](_0x40d997[_0xb8ec('0x3e')][_0xb8ec('0x2b')]);}return _0x5b81d1[_0xb8ec('0xb2')](_0xf85355);}})[_0xb8ec('0x33')](function(_0x170ab7){if(_0x170ab7){return _0x170ab7?{'count':_0x114e50,'rows':_0x170ab7}:null;}})[_0xb8ec('0x33')](respondWithResult(_0xaab276,null))['catch'](handleError(_0xaab276,null));};exports[_0xb8ec('0xba')]=function(_0x5daf29,_0x419d04,_0x37b488){var _0x10cabe;var _0x279787;var _0x7a6166={};var _0x40bc8e;return db[_0xb8ec('0x39')]['findOne']({'where':{'id':_0x5daf29[_0xb8ec('0x5e')]['id']},'attributes':['id','name',_0xb8ec('0x65')]})[_0xb8ec('0x33')](handleEntityNotFound(_0x419d04,null))[_0xb8ec('0x33')](function(_0x2bbd86){if(!utils[_0xb8ec('0x95')](_0x5daf29['query'][_0xb8ec('0x9d')])){throw new db['Sequelize'][(_0xb8ec('0x8d'))](_0xb8ec('0x96'));}_0x10cabe=_0x2bbd86;var _0x4a66ae={};_0x4a66ae[_0xb8ec('0x3b')]=_[_0xb8ec('0x41')](db[_[_0xb8ec('0x98')](_0x5daf29['query']['channel'])+_0xb8ec('0xbb')][_0xb8ec('0x3a')]);_0x4a66ae[_0xb8ec('0x3e')]=_[_0xb8ec('0x41')](_0x5daf29[_0xb8ec('0x3e')]);_0x4a66ae[_0xb8ec('0x4b')]=_[_0xb8ec('0x43')](_0x4a66ae[_0xb8ec('0x3b')],_0x4a66ae['query']);_0x7a6166['attributes']=_['intersection'](_0x4a66ae['model'],qs[_0xb8ec('0x44')](_0x5daf29[_0xb8ec('0x3e')][_0xb8ec('0x44')]));_0x7a6166[_0xb8ec('0x42')]=_0x7a6166['attributes'][_0xb8ec('0x45')]?_0x7a6166[_0xb8ec('0x42')]:_0x4a66ae[_0xb8ec('0x3b')];_0x7a6166[_0xb8ec('0x48')]=qs['sort'](_0x5daf29[_0xb8ec('0x3e')]['sort']);_0x7a6166[_0xb8ec('0x4a')]=qs[_0xb8ec('0x4b')](_[_0xb8ec('0xbc')](_0x5daf29[_0xb8ec('0x3e')],_0x4a66ae[_0xb8ec('0x4b')]));if(_0x5daf29[_0xb8ec('0x3e')][_0xb8ec('0x4e')]){_0x7a6166[_0xb8ec('0x4a')]=_[_0xb8ec('0x4d')](_0x7a6166[_0xb8ec('0x4a')],{'$or':_[_0xb8ec('0x4f')](_0x7a6166['attributes'],function(_0x481d29){var _0x40a681={};_0x40a681[_0x481d29]={'$like':'%'+_0x5daf29[_0xb8ec('0x3e')][_0xb8ec('0x4e')]+'%'};return _0x40a681;})});}_0x7a6166=_[_0xb8ec('0x4d')]({},_0x7a6166,_0x5daf29['options']);switch(_0x10cabe['role']){case _0xb8ec('0x90'):return db[_[_0xb8ec('0x98')](_0x5daf29[_0xb8ec('0x3e')][_0xb8ec('0x9d')])+'Queue'][_0xb8ec('0x57')](_0x7a6166);case _0xb8ec('0x67'):case'agent':return _0x10cabe[_0xb8ec('0xbd')+_['capitalize'](_0x5daf29[_0xb8ec('0x3e')][_0xb8ec('0x9d')])+_0xb8ec('0x9a')](_0x7a6166);default:throw new db[(_0xb8ec('0x8a'))][(_0xb8ec('0x8d'))]('Unknown\x20role');}})[_0xb8ec('0x33')](function(_0x1324e3){_0x40bc8e=_0x1324e3[_0xb8ec('0x45')];if(!_0x5daf29[_0xb8ec('0x3e')]['hasOwnProperty'](_0xb8ec('0x47'))){_0x7a6166[_0xb8ec('0x2c')]=qs[_0xb8ec('0x2c')](_0x5daf29['query'][_0xb8ec('0x2c')]);_0x7a6166[_0xb8ec('0x2b')]=qs[_0xb8ec('0x2b')](_0x5daf29[_0xb8ec('0x3e')][_0xb8ec('0x2b')]);}switch(_0x10cabe['role']){case _0xb8ec('0x90'):return db[_[_0xb8ec('0x98')](_0x5daf29[_0xb8ec('0x3e')][_0xb8ec('0x9d')])+_0xb8ec('0xbb')][_0xb8ec('0x57')](_0x7a6166);case'user':case _0xb8ec('0x63'):return _0x10cabe['get'+_['capitalize'](_0x5daf29['query']['channel'])+_0xb8ec('0x9a')](_0x7a6166);}})['then'](function(_0x284278){return{'count':_0x40bc8e,'rows':_0x284278};})['then'](respondWithResult(_0x419d04,null))['catch'](handleError(_0x419d04,null));};exports['getVoiceQueuesRt']=function(_0x5bf2bc,_0x9ce56d,_0x2875aa){var _0x24bd46={};var _0x47ca01={};var _0x1506f1;var _0x523dfc;return db[_0xb8ec('0x39')][_0xb8ec('0xb3')]({'where':{'id':_0x5bf2bc[_0xb8ec('0x5e')]['id']}})[_0xb8ec('0x33')](handleEntityNotFound(_0x9ce56d,null))[_0xb8ec('0x33')](function(_0xa138b4){if(_0xa138b4){_0x1506f1=_0xa138b4;_0x47ca01['model']=_[_0xb8ec('0x41')](db[_0xb8ec('0xa2')]['rawAttributes']);_0x47ca01[_0xb8ec('0x3e')]=_[_0xb8ec('0x41')](_0x5bf2bc[_0xb8ec('0x3e')]);_0x47ca01[_0xb8ec('0x4b')]=_['intersection'](_0x47ca01[_0xb8ec('0x3b')],_0x47ca01[_0xb8ec('0x3e')]);_0x24bd46[_0xb8ec('0x42')]=_[_0xb8ec('0x43')](_0x47ca01[_0xb8ec('0x3b')],qs[_0xb8ec('0x44')](_0x5bf2bc['query']['fields']));_0x24bd46[_0xb8ec('0x42')]=_0x24bd46[_0xb8ec('0x42')][_0xb8ec('0x45')]?_0x24bd46[_0xb8ec('0x42')]:_0x47ca01['model'];_0x24bd46[_0xb8ec('0x48')]=qs[_0xb8ec('0x49')](_0x5bf2bc[_0xb8ec('0x3e')][_0xb8ec('0x49')]);_0x24bd46[_0xb8ec('0x4a')]=qs[_0xb8ec('0x4b')](_[_0xb8ec('0xbc')](_0x5bf2bc[_0xb8ec('0x3e')],_0x47ca01[_0xb8ec('0x4b')]));if(_0x5bf2bc[_0xb8ec('0x3e')][_0xb8ec('0x4e')]){_0x24bd46[_0xb8ec('0x4a')]=_[_0xb8ec('0x4d')](_0x24bd46[_0xb8ec('0x4a')],{'$or':_[_0xb8ec('0x4f')](_0x24bd46[_0xb8ec('0x42')],function(_0xc32eb){var _0x10fe68={};_0x10fe68[_0xc32eb]={'$like':'%'+_0x5bf2bc[_0xb8ec('0x3e')][_0xb8ec('0x4e')]+'%'};return _0x10fe68;})});}_0x24bd46=_[_0xb8ec('0x4d')]({},_0x24bd46,_0x5bf2bc[_0xb8ec('0x53')]);return _0x1506f1[_0xb8ec('0xbe')](_0x24bd46);}})[_0xb8ec('0x33')](function(_0x1d38d6){if(_0x1d38d6){_0x523dfc=_0x1d38d6[_0xb8ec('0x45')];if(!_0x5bf2bc[_0xb8ec('0x3e')][_0xb8ec('0x46')](_0xb8ec('0x47'))){_0x24bd46[_0xb8ec('0x2c')]=qs[_0xb8ec('0x2c')](_0x5bf2bc['query']['limit']);_0x24bd46['offset']=qs['offset'](_0x5bf2bc[_0xb8ec('0x3e')]['offset']);}return _0x1506f1[_0xb8ec('0xbe')](_0x24bd46);}})[_0xb8ec('0x33')](function(_0xb9c0eb){if(_0xb9c0eb){return _0xb9c0eb?{'count':_0x523dfc,'rows':_0xb9c0eb}:null;}})[_0xb8ec('0x33')](respondWithResult(_0x9ce56d,null))[_0xb8ec('0x59')](handleError(_0x9ce56d,null));};exports['getGroups']=function(_0x37ab7d,_0x37de0c,_0x3a156f){var _0x1f6603={};var _0x94b7b={};var _0x58f1ae;var _0x217d3c;return db[_0xb8ec('0x39')]['findOne']({'where':{'id':_0x37ab7d['params']['id']}})[_0xb8ec('0x33')](handleEntityNotFound(_0x37de0c,null))[_0xb8ec('0x33')](function(_0x590241){if(_0x590241){_0x58f1ae=_0x590241;_0x94b7b['model']=_[_0xb8ec('0x41')](db['ChatGroup'][_0xb8ec('0x3a')]);_0x94b7b['query']=_[_0xb8ec('0x41')](_0x37ab7d[_0xb8ec('0x3e')]);_0x94b7b[_0xb8ec('0x4b')]=_[_0xb8ec('0x43')](_0x94b7b[_0xb8ec('0x3b')],_0x94b7b[_0xb8ec('0x3e')]);_0x1f6603[_0xb8ec('0x42')]=_['intersection'](_0x94b7b[_0xb8ec('0x3b')],qs[_0xb8ec('0x44')](_0x37ab7d['query'][_0xb8ec('0x44')]));_0x1f6603[_0xb8ec('0x42')]=_0x1f6603[_0xb8ec('0x42')][_0xb8ec('0x45')]?_0x1f6603[_0xb8ec('0x42')]:_0x94b7b[_0xb8ec('0x3b')];_0x1f6603['order']=qs[_0xb8ec('0x49')](_0x37ab7d['query'][_0xb8ec('0x49')]);_0x1f6603[_0xb8ec('0x4a')]=qs[_0xb8ec('0x4b')](_['pick'](_0x37ab7d[_0xb8ec('0x3e')],_0x94b7b[_0xb8ec('0x4b')]));if(_0x37ab7d[_0xb8ec('0x3e')][_0xb8ec('0x4e')]){_0x1f6603['where']=_['merge'](_0x1f6603[_0xb8ec('0x4a')],{'$or':_['map'](_0x1f6603[_0xb8ec('0x42')],function(_0x5c945a){var _0x39ec12={};_0x39ec12[_0x5c945a]={'$like':'%'+_0x37ab7d[_0xb8ec('0x3e')][_0xb8ec('0x4e')]+'%'};return _0x39ec12;})});}_0x1f6603=_[_0xb8ec('0x4d')]({},_0x1f6603,_0x37ab7d['options']);return _0x58f1ae[_0xb8ec('0xbf')](_0x1f6603);}})[_0xb8ec('0x33')](function(_0x3faf79){if(_0x3faf79){_0x217d3c=_0x3faf79[_0xb8ec('0x45')];if(!_0x37ab7d[_0xb8ec('0x3e')][_0xb8ec('0x46')]('nolimit')){_0x1f6603[_0xb8ec('0x2c')]=qs[_0xb8ec('0x2c')](_0x37ab7d[_0xb8ec('0x3e')][_0xb8ec('0x2c')]);_0x1f6603[_0xb8ec('0x2b')]=qs[_0xb8ec('0x2b')](_0x37ab7d[_0xb8ec('0x3e')][_0xb8ec('0x2b')]);}return _0x58f1ae[_0xb8ec('0xbf')](_0x1f6603);}})[_0xb8ec('0x33')](function(_0x4927bc){if(_0x4927bc){return _0x4927bc?{'count':_0x217d3c,'rows':_0x4927bc}:null;}})['then'](respondWithResult(_0x37de0c,null))[_0xb8ec('0x59')](handleError(_0x37de0c,null));};exports[_0xb8ec('0xc0')]=function(_0x1bc996,_0x2d807a,_0x2cf766){var _0x28025f={'raw':!![],'where':{}};var _0x4531c0={};var _0x50dc11={'count':0x0,'rows':[]};return db[_0xb8ec('0x39')]['findOne']({'where':{'id':_0x1bc996[_0xb8ec('0x5e')]['id']}})[_0xb8ec('0x33')](handleEntityNotFound(_0x2d807a,null))['then'](function(_0x1900bb){if(_0x1900bb){_0x4531c0[_0xb8ec('0x3b')]=_[_0xb8ec('0x41')](db[_0xb8ec('0xc1')]['rawAttributes']);_0x4531c0[_0xb8ec('0x3e')]=_[_0xb8ec('0x41')](_0x1bc996[_0xb8ec('0x3e')]);_0x4531c0['filters']=_[_0xb8ec('0x43')](_0x4531c0['model'],_0x4531c0[_0xb8ec('0x3e')]);_0x28025f[_0xb8ec('0x42')]=_[_0xb8ec('0x43')](_0x4531c0['model'],qs[_0xb8ec('0x44')](_0x1bc996[_0xb8ec('0x3e')]['fields']));_0x28025f['attributes']=_0x28025f[_0xb8ec('0x42')][_0xb8ec('0x45')]?_0x28025f[_0xb8ec('0x42')]:_0x4531c0[_0xb8ec('0x3b')];if(!_0x1bc996[_0xb8ec('0x3e')][_0xb8ec('0x46')](_0xb8ec('0x47'))){_0x28025f[_0xb8ec('0x2c')]=qs[_0xb8ec('0x2c')](_0x1bc996[_0xb8ec('0x3e')][_0xb8ec('0x2c')]);_0x28025f['offset']=qs[_0xb8ec('0x2b')](_0x1bc996[_0xb8ec('0x3e')]['offset']);}_0x28025f['order']=qs[_0xb8ec('0x49')](_0x1bc996[_0xb8ec('0x3e')]['sort']);_0x28025f[_0xb8ec('0x4a')]=qs[_0xb8ec('0x4b')](_[_0xb8ec('0xbc')](_0x1bc996[_0xb8ec('0x3e')],_0x4531c0['filters']));_0x28025f['where'][_0xb8ec('0xc2')]=_0x1900bb['id'];if(_0x1bc996['query'][_0xb8ec('0x4e')]){_0x28025f[_0xb8ec('0x4a')]=_[_0xb8ec('0x4d')](_0x28025f[_0xb8ec('0x4a')],{'$or':_[_0xb8ec('0x4f')](_0x28025f['attributes'],function(_0x12e4cb){var _0x24a6f5={};_0x24a6f5[_0x12e4cb]={'$like':'%'+_0x1bc996[_0xb8ec('0x3e')][_0xb8ec('0x4e')]+'%'};return _0x24a6f5;})});}_0x28025f=_[_0xb8ec('0x4d')]({},_0x28025f,_0x1bc996['options']);return db[_0xb8ec('0xc1')][_0xb8ec('0x54')]({'where':_0x28025f[_0xb8ec('0x4a')]})[_0xb8ec('0x33')](function(_0x5259df){_0x50dc11['count']=_0x5259df;if(_0x1bc996['query']['includeAll']){_0x28025f[_0xb8ec('0x56')]=[{'all':!![]}];}return db[_0xb8ec('0xc1')][_0xb8ec('0x57')](_0x28025f);})[_0xb8ec('0x33')](function(_0x1565e6){_0x50dc11['rows']=_0x1565e6;return _0x50dc11;});}})['then'](respondWithFilteredResult(_0x2d807a,_0x28025f))['catch'](handleError(_0x2d807a,null));};exports[_0xb8ec('0xc3')]=function(_0x530e84,_0x31b5ac,_0x45fe2d){var _0x943996={};var _0x320098={};var _0x5678b5;var _0x49086a;return db[_0xb8ec('0x39')][_0xb8ec('0xb3')]({'where':{'id':_0x530e84[_0xb8ec('0x5e')]['id']}})[_0xb8ec('0x33')](handleEntityNotFound(_0x31b5ac,null))[_0xb8ec('0x33')](function(_0x5cef8d){if(_0x5cef8d){_0x5678b5=_0x5cef8d;_0x320098['model']=_['keys'](db[_0xb8ec('0xc4')][_0xb8ec('0x3a')]);_0x320098['query']=_[_0xb8ec('0x41')](_0x530e84['query']);_0x320098['filters']=_[_0xb8ec('0x43')](_0x320098[_0xb8ec('0x3b')],_0x320098['query']);_0x943996[_0xb8ec('0x42')]=_[_0xb8ec('0x43')](_0x320098[_0xb8ec('0x3b')],qs[_0xb8ec('0x44')](_0x530e84[_0xb8ec('0x3e')][_0xb8ec('0x44')]));_0x943996[_0xb8ec('0x42')]=_0x943996[_0xb8ec('0x42')][_0xb8ec('0x45')]?_0x943996[_0xb8ec('0x42')]:_0x320098[_0xb8ec('0x3b')];_0x943996[_0xb8ec('0x48')]=qs[_0xb8ec('0x49')](_0x530e84[_0xb8ec('0x3e')][_0xb8ec('0x49')]);_0x943996[_0xb8ec('0x4a')]=qs[_0xb8ec('0x4b')](_['pick'](_0x530e84[_0xb8ec('0x3e')],_0x320098[_0xb8ec('0x4b')]));if(_0x530e84[_0xb8ec('0x3e')][_0xb8ec('0x4e')]){_0x943996[_0xb8ec('0x4a')]=_['merge'](_0x943996[_0xb8ec('0x4a')],{'$or':_[_0xb8ec('0x4f')](_0x943996[_0xb8ec('0x42')],function(_0x5bb323){var _0x2ba114={};_0x2ba114[_0x5bb323]={'$like':'%'+_0x530e84[_0xb8ec('0x3e')]['filter']+'%'};return _0x2ba114;})});}_0x943996=_[_0xb8ec('0x4d')]({},_0x943996,_0x530e84[_0xb8ec('0x53')]);return _0x5678b5['getChatInteractions'](_0x943996);}})['then'](function(_0x3af5c7){if(_0x3af5c7){_0x49086a=_0x3af5c7[_0xb8ec('0x45')];if(!_0x530e84[_0xb8ec('0x3e')]['hasOwnProperty']('nolimit')){_0x943996[_0xb8ec('0x2c')]=qs['limit'](_0x530e84[_0xb8ec('0x3e')][_0xb8ec('0x2c')]);_0x943996['offset']=qs[_0xb8ec('0x2b')](_0x530e84[_0xb8ec('0x3e')][_0xb8ec('0x2b')]);}return _0x5678b5[_0xb8ec('0xc3')](_0x943996);}})[_0xb8ec('0x33')](function(_0x226b2d){if(_0x226b2d){return _0x226b2d?{'count':_0x49086a,'rows':_0x226b2d}:null;}})[_0xb8ec('0x33')](respondWithResult(_0x31b5ac,null))[_0xb8ec('0x59')](handleError(_0x31b5ac,null));};exports[_0xb8ec('0xc5')]=function(_0x3952fb,_0x258229,_0x260acd){var _0x174eec={};var _0x49e411={};var _0x3fec14;var _0x1b042a;return db[_0xb8ec('0x39')][_0xb8ec('0xb3')]({'where':{'id':_0x3952fb['params']['id']}})[_0xb8ec('0x33')](handleEntityNotFound(_0x258229,null))['then'](function(_0x468e61){if(_0x468e61){_0x3fec14=_0x468e61;_0x49e411['model']=_['keys'](db['OpenchannelInteraction'][_0xb8ec('0x3a')]);_0x49e411[_0xb8ec('0x3e')]=_[_0xb8ec('0x41')](_0x3952fb[_0xb8ec('0x3e')]);_0x49e411[_0xb8ec('0x4b')]=_[_0xb8ec('0x43')](_0x49e411[_0xb8ec('0x3b')],_0x49e411[_0xb8ec('0x3e')]);_0x174eec['attributes']=_[_0xb8ec('0x43')](_0x49e411['model'],qs[_0xb8ec('0x44')](_0x3952fb[_0xb8ec('0x3e')][_0xb8ec('0x44')]));_0x174eec[_0xb8ec('0x42')]=_0x174eec[_0xb8ec('0x42')]['length']?_0x174eec['attributes']:_0x49e411['model'];_0x174eec[_0xb8ec('0x48')]=qs['sort'](_0x3952fb[_0xb8ec('0x3e')][_0xb8ec('0x49')]);_0x174eec['where']=qs['filters'](_['pick'](_0x3952fb[_0xb8ec('0x3e')],_0x49e411[_0xb8ec('0x4b')]));if(_0x3952fb[_0xb8ec('0x3e')][_0xb8ec('0x4e')]){_0x174eec[_0xb8ec('0x4a')]=_[_0xb8ec('0x4d')](_0x174eec[_0xb8ec('0x4a')],{'$or':_[_0xb8ec('0x4f')](_0x174eec[_0xb8ec('0x42')],function(_0x5ed4c2){var _0x33228f={};_0x33228f[_0x5ed4c2]={'$like':'%'+_0x3952fb['query']['filter']+'%'};return _0x33228f;})});}_0x174eec=_[_0xb8ec('0x4d')]({},_0x174eec,_0x3952fb['options']);return _0x3fec14[_0xb8ec('0xc5')](_0x174eec);}})[_0xb8ec('0x33')](function(_0x491847){if(_0x491847){_0x1b042a=_0x491847[_0xb8ec('0x45')];if(!_0x3952fb[_0xb8ec('0x3e')]['hasOwnProperty'](_0xb8ec('0x47'))){_0x174eec[_0xb8ec('0x2c')]=qs[_0xb8ec('0x2c')](_0x3952fb[_0xb8ec('0x3e')]['limit']);_0x174eec[_0xb8ec('0x2b')]=qs[_0xb8ec('0x2b')](_0x3952fb['query'][_0xb8ec('0x2b')]);}return _0x3fec14[_0xb8ec('0xc5')](_0x174eec);}})[_0xb8ec('0x33')](function(_0x3295b6){if(_0x3295b6){return _0x3295b6?{'count':_0x1b042a,'rows':_0x3295b6}:null;}})[_0xb8ec('0x33')](respondWithResult(_0x258229,null))[_0xb8ec('0x59')](handleError(_0x258229,null));};exports[_0xb8ec('0xc6')]=function(_0x5a868b,_0x37f2a4,_0x202cb4){var _0x567547={'raw':!![],'where':{}};var _0xc228e9={};var _0x541f7f={'count':0x0,'rows':[]};return db[_0xb8ec('0x39')]['findOne']({'where':{'id':_0x5a868b[_0xb8ec('0x5e')]['id']}})['then'](handleEntityNotFound(_0x37f2a4,null))[_0xb8ec('0x33')](function(_0x6ce0b8){if(_0x6ce0b8){_0xc228e9['model']=_[_0xb8ec('0x41')](db[_0xb8ec('0xc7')][_0xb8ec('0x3a')]);_0xc228e9[_0xb8ec('0x3e')]=_[_0xb8ec('0x41')](_0x5a868b['query']);_0xc228e9[_0xb8ec('0x4b')]=_[_0xb8ec('0x43')](_0xc228e9[_0xb8ec('0x3b')],_0xc228e9[_0xb8ec('0x3e')]);_0x567547[_0xb8ec('0x42')]=_[_0xb8ec('0x43')](_0xc228e9[_0xb8ec('0x3b')],qs[_0xb8ec('0x44')](_0x5a868b['query'][_0xb8ec('0x44')]));_0x567547[_0xb8ec('0x42')]=_0x567547[_0xb8ec('0x42')][_0xb8ec('0x45')]?_0x567547['attributes']:_0xc228e9[_0xb8ec('0x3b')];if(!_0x5a868b['query'][_0xb8ec('0x46')](_0xb8ec('0x47'))){_0x567547['limit']=qs[_0xb8ec('0x2c')](_0x5a868b[_0xb8ec('0x3e')]['limit']);_0x567547['offset']=qs['offset'](_0x5a868b[_0xb8ec('0x3e')][_0xb8ec('0x2b')]);}_0x567547[_0xb8ec('0x48')]=qs[_0xb8ec('0x49')](_0x5a868b[_0xb8ec('0x3e')][_0xb8ec('0x49')]);_0x567547[_0xb8ec('0x4a')]=qs[_0xb8ec('0x4b')](_[_0xb8ec('0xbc')](_0x5a868b['query'],_0xc228e9[_0xb8ec('0x4b')]));_0x567547[_0xb8ec('0x4a')][_0xb8ec('0xc2')]=_0x6ce0b8['id'];if(_0x5a868b['query'][_0xb8ec('0x4e')]){_0x567547[_0xb8ec('0x4a')]=_[_0xb8ec('0x4d')](_0x567547[_0xb8ec('0x4a')],{'$or':_[_0xb8ec('0x4f')](_0x567547['attributes'],function(_0x33b318){var _0x3e2941={};_0x3e2941[_0x33b318]={'$like':'%'+_0x5a868b[_0xb8ec('0x3e')][_0xb8ec('0x4e')]+'%'};return _0x3e2941;})});}_0x567547=_[_0xb8ec('0x4d')]({},_0x567547,_0x5a868b[_0xb8ec('0x53')]);return db[_0xb8ec('0xc7')]['count']({'where':_0x567547[_0xb8ec('0x4a')]})[_0xb8ec('0x33')](function(_0x3e95be){_0x541f7f[_0xb8ec('0x54')]=_0x3e95be;if(_0x5a868b[_0xb8ec('0x3e')]['includeAll']){_0x567547[_0xb8ec('0x56')]=[{'all':!![]}];}return db[_0xb8ec('0xc7')]['findAll'](_0x567547);})[_0xb8ec('0x33')](function(_0x1ea967){_0x541f7f[_0xb8ec('0x58')]=_0x1ea967;return _0x541f7f;});}})['then'](respondWithFilteredResult(_0x37f2a4,_0x567547))[_0xb8ec('0x59')](handleError(_0x37f2a4,null));};exports[_0xb8ec('0xc8')]=function(_0x46c976,_0xd33914,_0x2d98e9){var _0x18db8e={};var _0x172d3f={};var _0x118648;var _0x295572;return db[_0xb8ec('0x39')][_0xb8ec('0xb3')]({'where':{'id':_0x46c976[_0xb8ec('0x5e')]['id']}})[_0xb8ec('0x33')](handleEntityNotFound(_0xd33914,null))[_0xb8ec('0x33')](function(_0x595ad5){if(_0x595ad5){_0x118648=_0x595ad5;_0x172d3f[_0xb8ec('0x3b')]=_[_0xb8ec('0x41')](db[_0xb8ec('0xc9')]['rawAttributes']);_0x172d3f[_0xb8ec('0x3e')]=_['keys'](_0x46c976[_0xb8ec('0x3e')]);_0x172d3f[_0xb8ec('0x4b')]=_[_0xb8ec('0x43')](_0x172d3f[_0xb8ec('0x3b')],_0x172d3f[_0xb8ec('0x3e')]);_0x18db8e[_0xb8ec('0x42')]=_['intersection'](_0x172d3f[_0xb8ec('0x3b')],qs['fields'](_0x46c976[_0xb8ec('0x3e')][_0xb8ec('0x44')]));_0x18db8e[_0xb8ec('0x42')]=_0x18db8e[_0xb8ec('0x42')][_0xb8ec('0x45')]?_0x18db8e[_0xb8ec('0x42')]:_0x172d3f[_0xb8ec('0x3b')];_0x18db8e[_0xb8ec('0x48')]=qs['sort'](_0x46c976[_0xb8ec('0x3e')][_0xb8ec('0x49')]);_0x18db8e[_0xb8ec('0x4a')]=qs['filters'](_[_0xb8ec('0xbc')](_0x46c976[_0xb8ec('0x3e')],_0x172d3f['filters']));if(_0x46c976[_0xb8ec('0x3e')][_0xb8ec('0x4e')]){_0x18db8e[_0xb8ec('0x4a')]=_[_0xb8ec('0x4d')](_0x18db8e[_0xb8ec('0x4a')],{'$or':_[_0xb8ec('0x4f')](_0x18db8e[_0xb8ec('0x42')],function(_0x12e805){var _0x419629={};_0x419629[_0x12e805]={'$like':'%'+_0x46c976[_0xb8ec('0x3e')][_0xb8ec('0x4e')]+'%'};return _0x419629;})});}_0x18db8e=_[_0xb8ec('0x4d')]({},_0x18db8e,_0x46c976['options']);return _0x118648['getSmsInteractions'](_0x18db8e);}})[_0xb8ec('0x33')](function(_0x2c2b21){if(_0x2c2b21){_0x295572=_0x2c2b21[_0xb8ec('0x45')];if(!_0x46c976[_0xb8ec('0x3e')][_0xb8ec('0x46')](_0xb8ec('0x47'))){_0x18db8e[_0xb8ec('0x2c')]=qs[_0xb8ec('0x2c')](_0x46c976[_0xb8ec('0x3e')][_0xb8ec('0x2c')]);_0x18db8e[_0xb8ec('0x2b')]=qs['offset'](_0x46c976['query'][_0xb8ec('0x2b')]);}return _0x118648[_0xb8ec('0xc8')](_0x18db8e);}})[_0xb8ec('0x33')](function(_0x3bade8){if(_0x3bade8){return _0x3bade8?{'count':_0x295572,'rows':_0x3bade8}:null;}})[_0xb8ec('0x33')](respondWithResult(_0xd33914,null))['catch'](handleError(_0xd33914,null));};exports[_0xb8ec('0xca')]=function(_0x230485,_0x1fae5d,_0x257eac){var _0x1d6818={};var _0x2f0681={};var _0x4803e8;var _0x285771;return db[_0xb8ec('0x39')]['findOne']({'where':{'id':_0x230485[_0xb8ec('0x5e')]['id']}})[_0xb8ec('0x33')](handleEntityNotFound(_0x1fae5d,null))[_0xb8ec('0x33')](function(_0x5732dc){if(_0x5732dc){_0x4803e8=_0x5732dc;_0x2f0681[_0xb8ec('0x3b')]=_[_0xb8ec('0x41')](db['FaxInteraction'][_0xb8ec('0x3a')]);_0x2f0681[_0xb8ec('0x3e')]=_['keys'](_0x230485[_0xb8ec('0x3e')]);_0x2f0681[_0xb8ec('0x4b')]=_[_0xb8ec('0x43')](_0x2f0681[_0xb8ec('0x3b')],_0x2f0681['query']);_0x1d6818['attributes']=_[_0xb8ec('0x43')](_0x2f0681[_0xb8ec('0x3b')],qs['fields'](_0x230485[_0xb8ec('0x3e')][_0xb8ec('0x44')]));_0x1d6818[_0xb8ec('0x42')]=_0x1d6818[_0xb8ec('0x42')][_0xb8ec('0x45')]?_0x1d6818[_0xb8ec('0x42')]:_0x2f0681[_0xb8ec('0x3b')];_0x1d6818[_0xb8ec('0x48')]=qs[_0xb8ec('0x49')](_0x230485[_0xb8ec('0x3e')][_0xb8ec('0x49')]);_0x1d6818['where']=qs[_0xb8ec('0x4b')](_['pick'](_0x230485[_0xb8ec('0x3e')],_0x2f0681['filters']));if(_0x230485[_0xb8ec('0x3e')][_0xb8ec('0x4e')]){_0x1d6818[_0xb8ec('0x4a')]=_[_0xb8ec('0x4d')](_0x1d6818[_0xb8ec('0x4a')],{'$or':_['map'](_0x1d6818['attributes'],function(_0x824191){var _0x1fad3d={};_0x1fad3d[_0x824191]={'$like':'%'+_0x230485[_0xb8ec('0x3e')][_0xb8ec('0x4e')]+'%'};return _0x1fad3d;})});}_0x1d6818=_[_0xb8ec('0x4d')]({},_0x1d6818,_0x230485[_0xb8ec('0x53')]);return _0x4803e8[_0xb8ec('0xca')](_0x1d6818);}})[_0xb8ec('0x33')](function(_0xafd672){if(_0xafd672){_0x285771=_0xafd672[_0xb8ec('0x45')];if(!_0x230485[_0xb8ec('0x3e')]['hasOwnProperty'](_0xb8ec('0x47'))){_0x1d6818['limit']=qs[_0xb8ec('0x2c')](_0x230485[_0xb8ec('0x3e')][_0xb8ec('0x2c')]);_0x1d6818['offset']=qs[_0xb8ec('0x2b')](_0x230485[_0xb8ec('0x3e')][_0xb8ec('0x2b')]);}return _0x4803e8[_0xb8ec('0xca')](_0x1d6818);}})[_0xb8ec('0x33')](function(_0x1452f5){if(_0x1452f5){return _0x1452f5?{'count':_0x285771,'rows':_0x1452f5}:null;}})[_0xb8ec('0x33')](respondWithResult(_0x1fae5d,null))[_0xb8ec('0x59')](handleError(_0x1fae5d,null));};exports[_0xb8ec('0xcb')]=function(_0x5bf125,_0x1de946,_0x4f6f0a){var _0x5298cb;var _0x106793;var _0x129dba;return db['User'][_0xb8ec('0x5b')]({'where':{'id':_0x5bf125[_0xb8ec('0x5e')]['id'],'role':'agent'},'attributes':['id',_0xb8ec('0x36'),_0xb8ec('0xcc'),_0xb8ec('0xcd'),'role',_0xb8ec('0x73'),_0xb8ec('0x93')]})[_0xb8ec('0x33')](handleEntityNotFound(_0x1de946,null))[_0xb8ec('0x33')](function(_0xbedcff){if(_0xbedcff){_0x5298cb=_0xbedcff;if(_0x5bf125[_0xb8ec('0x5d')][_0xb8ec('0x94')]){_0x129dba=util['format'](_0xb8ec('0xce'),_0x5298cb[_0x5bf125['body'][_0xb8ec('0x94')]]);}else if(_0x5bf125[_0xb8ec('0x5d')][_0xb8ec('0xcf')]){_0x129dba=util[_0xb8ec('0x6c')](_0xb8ec('0x9f'),_0x5bf125['body']['intrf']);}else{_0x129dba=util[_0xb8ec('0x6c')]('SIP/%s',_0x5298cb[_0xb8ec('0x36')]);}socket['to'](util[_0xb8ec('0x6c')](_0xb8ec('0xd0'),_0x5298cb[_0xb8ec('0x36')]))[_0xb8ec('0x9c')](_0xb8ec('0xd1'),{'ip':_0x5bf125[_0xb8ec('0xd2')]['x-forwarded-for']||_0x5bf125[_0xb8ec('0xd3')][_0xb8ec('0xd4')]||_0x5bf125[_0xb8ec('0xd5')][_0xb8ec('0xd4')]||_0x5bf125[_0xb8ec('0xd3')]['socket'][_0xb8ec('0xd4')]});return db[_0xb8ec('0xa2')][_0xb8ec('0xa6')]({'where':{'membername':_0x5298cb[_0xb8ec('0x36')]},'individualHooks':!![]});}})['then'](function(_0xabbfa3){if(_0x5298cb){return _0x5298cb['getVoiceQueues']({'raw':!![]});}})[_0xb8ec('0x33')](function(_0x5f05b3){var _0x3ac4ca=[];if(_0x5f05b3){_0x106793=_0x5f05b3;if(_0x106793[_0xb8ec('0x45')]){for(var _0x1e6acc=0x0;_0x1e6acc<_0x106793[_0xb8ec('0x45')];_0x1e6acc++){_0x3ac4ca['push']({'membername':_0x5298cb['name'],'UserId':_0x5298cb['id'],'queue_name':_0x106793[_0x1e6acc]['name'],'VoiceQueueId':_0x106793[_0x1e6acc]['id'],'interface':_0x129dba,'paused':_0x5298cb[_0xb8ec('0x93')]||![],'penalty':_0x106793[_0x1e6acc][_0xb8ec('0xd6')]||0x0});}return BPromise[_0xb8ec('0xa1')](_0x3ac4ca,function(_0x1e9585){return db[_0xb8ec('0xa2')][_0xb8ec('0xa3')](_0x1e9585);});}}})[_0xb8ec('0x33')](function(){return db[_0xb8ec('0xd7')][_0xb8ec('0x57')]({'where':{'membername':_0x5298cb[_0xb8ec('0x36')],'exitAt':null}});})[_0xb8ec('0x33')](function(_0x252b3f){var _0x12c2d4=[];_0x252b3f[_0xb8ec('0xd8')](function(_0x2dc7f3){_0x12c2d4['push'](_0x2dc7f3[_0xb8ec('0x32')]({'exitAt':moment()[_0xb8ec('0x6c')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xb8ec('0xd9')](_0x12c2d4);})[_0xb8ec('0x33')](function(){var _0x18d10=[];var _0x1ce844=[];var _0x13d2aa=utils['getChannels']();var _0x4a12ac={'membername':_0x5298cb[_0xb8ec('0x36')],'interface':_0x129dba,'enterAt':moment()[_0xb8ec('0x6c')](_0xb8ec('0xda')),'role':_0x5298cb[_0xb8ec('0x65')],'internal':_0x5298cb[_0xb8ec('0x73')]};_0x13d2aa[_0xb8ec('0xd8')](function(_0xf00b2){_0x18d10[_0xb8ec('0xdb')](_[_0xb8ec('0x4d')]({'channel':_0xf00b2,'type':_0xb8ec('0xdc'),'data1':_0x5bf125[_0xb8ec('0x5d')]['device'],'data2':_0x129dba},_0x4a12ac));if(_0x5298cb[_0xb8ec('0x93')]){_0x1ce844[_0xb8ec('0xdb')](_[_0xb8ec('0x4d')]({'channel':_0xf00b2,'type':_0xb8ec('0xdd'),'data1':_0xb8ec('0xde')},_0x4a12ac));}});return db[_0xb8ec('0xd7')][_0xb8ec('0x5c')](_0x18d10[_0xb8ec('0xdf')](_0x1ce844),{'individualHooks':!![]});})['then'](function(){return _0x5298cb[_0xb8ec('0x32')]({'online':!![],'lastLoginAt':moment()[_0xb8ec('0x6c')](_0xb8ec('0xda')),'voicePause':_0x5298cb[_0xb8ec('0x93')]||![],'mailPause':_0x5298cb['loginInPause']||![],'chatPause':_0x5298cb['loginInPause']||![],'faxPause':_0x5298cb['loginInPause']||![],'smsPause':_0x5298cb[_0xb8ec('0x93')]||![],'openchannelPause':_0x5298cb['loginInPause']||![],'pauseType':_0x5298cb['loginInPause']?'LOGININPAUSE':null,'interface':_0x129dba,'lastPauseAt':moment()['format'](_0xb8ec('0xda'))});})['then'](respondWithResult(_0x1de946,null))[_0xb8ec('0x59')](handleError(_0x1de946,null));};exports[_0xb8ec('0xe0')]=function(_0x58dbca,_0x44eb04,_0x53f2c4){var _0x36b6e7;return db['User'][_0xb8ec('0x5b')]({'where':{'id':_0x58dbca[_0xb8ec('0x5e')]['id'],'role':_0xb8ec('0x63')},'attributes':['id',_0xb8ec('0x36'),_0xb8ec('0x65')]})['then'](handleEntityNotFound(_0x44eb04,null))[_0xb8ec('0x33')](function(_0x4205f1){if(_0x4205f1){_0x36b6e7=_0x4205f1;return db['UserVoiceQueueRt'][_0xb8ec('0xa6')]({'where':{'membername':_0x36b6e7[_0xb8ec('0x36')]},'individualHooks':!![]});}})['then'](function(){return db[_0xb8ec('0xd7')][_0xb8ec('0x57')]({'where':{'membername':_0x36b6e7['name'],'exitAt':null}});})['then'](function(_0x2b505d){var _0x3ba000=[];_0x2b505d['forEach'](function(_0x232157){_0x3ba000[_0xb8ec('0xdb')](_0x232157['update']({'exitAt':moment()[_0xb8ec('0x6c')](_0xb8ec('0xda'))}));});return BPromise[_0xb8ec('0xd9')](_0x3ba000);})['then'](function(){return _0x36b6e7[_0xb8ec('0x32')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'interface':null});})[_0xb8ec('0x33')](respondWithResult(_0x44eb04,null))[_0xb8ec('0x59')](handleError(_0x44eb04,null));};exports[_0xb8ec('0xe1')]=function(_0x1fa931,_0x16bb5,_0x5cc439){var _0x3e2304;return db[_0xb8ec('0xa2')][_0xb8ec('0x32')]({'paused':0x1},{'where':{'UserId':_0x1fa931[_0xb8ec('0x5e')]['id']},'individualHooks':!![]})[_0xb8ec('0x33')](function(){return db[_0xb8ec('0x39')][_0xb8ec('0x5b')]({'where':{'id':_0x1fa931['params']['id'],'role':'agent'},'attributes':['id',_0xb8ec('0x36'),'role',_0xb8ec('0x73'),'interface']});})['then'](handleEntityNotFound(_0x16bb5,null))[_0xb8ec('0x33')](function(_0x5ceb90){if(_0x5ceb90){_0x3e2304=_0x5ceb90;return respondWithRpcPromise(_0xb8ec('0xe2'),'pause',{'id':_0x3e2304['id'],'name':_0x3e2304[_0xb8ec('0x36')],'pause':!![]});}})[_0xb8ec('0x33')](function(){if(_0x3e2304){return db[_0xb8ec('0xd7')][_0xb8ec('0x57')]({'where':{'membername':_0x3e2304[_0xb8ec('0x36')],'type':'PAUSE','exitAt':null}});}})[_0xb8ec('0x33')](function(_0x17de37){if(_0x17de37[_0xb8ec('0x45')]){var _0x362998=moment()[_0xb8ec('0x6c')](_0xb8ec('0xda'));for(var _0x5ca0d8=0x0,_0x174c1e=_0x17de37['length'];_0x5ca0d8<_0x174c1e;_0x5ca0d8++){_0x17de37[_0x5ca0d8][_0xb8ec('0xe3')]({'exitAt':_0x362998});}}})[_0xb8ec('0x33')](function(){var _0x11bf88=[];var _0x4727e9=utils[_0xb8ec('0xe4')]();_0x4727e9[_0xb8ec('0xd8')](function(_0xb1e223){_0x11bf88[_0xb8ec('0xdb')]({'channel':_0xb1e223,'membername':_0x3e2304[_0xb8ec('0x36')],'interface':_['isNil'](_0x3e2304['interface'])?util['format'](_0xb8ec('0x9f'),_0x3e2304['name']):_0x3e2304['interface'],'type':_0xb8ec('0xdd'),'enterAt':moment()[_0xb8ec('0x6c')](_0xb8ec('0xda')),'data1':_0x1fa931[_0xb8ec('0x5d')][_0xb8ec('0xe5')]||_0xb8ec('0xe6'),'role':_0x3e2304['role'],'internal':_0x3e2304['internal']});});return db[_0xb8ec('0xd7')][_0xb8ec('0x5c')](_0x11bf88,{'individualHooks':!![]});})['then'](function(){return _0x3e2304['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x1fa931[_0xb8ec('0x5d')][_0xb8ec('0xe5')]||_0xb8ec('0xe6'),'lastPauseAt':moment()[_0xb8ec('0x6c')](_0xb8ec('0xda'))});})[_0xb8ec('0x33')](respondWithResult(_0x16bb5,null))['catch'](handleError(_0x16bb5,null));};exports['unpause']=function(_0x3f1418,_0x3c948a,_0x5e031b){var _0x1e020c;return db[_0xb8ec('0x39')][_0xb8ec('0x5b')]({'where':{'id':_0x3f1418[_0xb8ec('0x5e')]['id']},'attributes':['id',_0xb8ec('0x36'),_0xb8ec('0x65'),_0xb8ec('0xa0'),_0xb8ec('0xe7'),_0xb8ec('0xe8'),_0xb8ec('0xe9'),_0xb8ec('0xea'),_0xb8ec('0xeb'),_0xb8ec('0xec'),'lastPauseAt']})[_0xb8ec('0x33')](handleEntityNotFound(_0x3c948a,null))['then'](function(_0x9a28f2){if(_0x9a28f2){_0x1e020c=_0x9a28f2;if(_0x3f1418['body'][_0xb8ec('0x9d')]&&!utils[_0xb8ec('0x95')](_0x3f1418[_0xb8ec('0x5d')]['channel'])){throw new db[(_0xb8ec('0x8a'))][(_0xb8ec('0x8d'))](_0xb8ec('0x96'));}switch(_0x3f1418[_0xb8ec('0x5d')][_0xb8ec('0x9d')]){case'voice':return respondWithRpcPromise(_0xb8ec('0xe2'),_0xb8ec('0xed'),{'id':_0x1e020c['id'],'name':_0x1e020c['name'],'pause':![]})['then'](function(){return db[_0xb8ec('0xa2')][_0xb8ec('0x32')]({'paused':0x0},{'where':{'UserId':_0x1e020c['id']},'individualHooks':!![]});})['then'](function(){return db['MemberReport'][_0xb8ec('0x5b')]({'where':{'channel':_0x3f1418['body'][_0xb8ec('0x9d')],'membername':_0x1e020c[_0xb8ec('0x36')],'type':_0xb8ec('0xdd'),'exitAt':null}});})[_0xb8ec('0x33')](function(_0x3383b1){if(_0x3383b1){return _0x3383b1['update']({'exitAt':moment()[_0xb8ec('0x6c')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xb8ec('0xee')},{'individualHooks':!![]});}return null;})[_0xb8ec('0x33')](function(){return _0x1e020c[_0xb8ec('0x32')]({'voicePause':![]});});case _0xb8ec('0xef'):case _0xb8ec('0xf0'):case _0xb8ec('0xf1'):case _0xb8ec('0xf2'):case _0xb8ec('0xf3'):return db[_0xb8ec('0xd7')][_0xb8ec('0x5b')]({'where':{'channel':_0x3f1418[_0xb8ec('0x5d')][_0xb8ec('0x9d')],'membername':_0x1e020c[_0xb8ec('0x36')],'type':_0xb8ec('0xdd'),'exitAt':null}})[_0xb8ec('0x33')](function(_0x4a405a){if(_0x4a405a){return _0x4a405a['update']({'exitAt':moment()[_0xb8ec('0x6c')](_0xb8ec('0xda')),'data2':_0xb8ec('0xee')},{'individualHooks':!![]});}return null;})[_0xb8ec('0x33')](function(){var _0x447211={};_[_0xb8ec('0x2e')](_0x447211,util[_0xb8ec('0x6c')]('%s%s',_0x3f1418['body'][_0xb8ec('0x9d')],_0xb8ec('0xf4')),![]);return _0x1e020c[_0xb8ec('0x32')](_0x447211);});default:return respondWithRpcPromise('QueuePause',_0xb8ec('0xed'),{'id':_0x1e020c['id'],'name':_0x1e020c[_0xb8ec('0x36')],'pause':![]})[_0xb8ec('0x33')](function(){return db[_0xb8ec('0xa2')]['update']({'paused':0x0},{'where':{'UserId':_0x1e020c['id']}});})['then'](function(){return db['MemberReport'][_0xb8ec('0x57')]({'where':{'membername':_0x1e020c['name'],'type':'PAUSE','exitAt':null}});})[_0xb8ec('0x33')](function(_0x584a52){var _0x1ec456=[];_0x584a52[_0xb8ec('0xd8')](function(_0x3f707c){_0x1ec456[_0xb8ec('0xdb')](_0x3f707c[_0xb8ec('0x32')]({'exitAt':moment()[_0xb8ec('0x6c')](_0xb8ec('0xda')),'data2':_0xb8ec('0xee')}));});return BPromise['all'](_0x1ec456);})[_0xb8ec('0x33')](function(){return _0x1e020c[_0xb8ec('0x32')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xb8ec('0x33')](respondWithResult(_0x3c948a,null))[_0xb8ec('0x59')](handleError(_0x3c948a,null));};exports[_0xb8ec('0xf5')]=function(_0x136e43,_0x3b8441,_0x13e6f5){var _0x483b55={};var _0x4406ec={};var _0x4a9cd6;var _0x1056c2;return db[_0xb8ec('0x39')][_0xb8ec('0xb3')]({'where':{'id':_0x136e43[_0xb8ec('0x5e')]['id']}})[_0xb8ec('0x33')](handleEntityNotFound(_0x3b8441,null))[_0xb8ec('0x33')](function(_0x422700){if(_0x422700){_0x4a9cd6=_0x422700;_0x4406ec[_0xb8ec('0x3b')]=_[_0xb8ec('0x41')](db[_0xb8ec('0xf6')][_0xb8ec('0x3a')]);_0x4406ec[_0xb8ec('0x3e')]=_['keys'](_0x136e43[_0xb8ec('0x3e')]);_0x4406ec[_0xb8ec('0x4b')]=_[_0xb8ec('0x43')](_0x4406ec['model'],_0x4406ec[_0xb8ec('0x3e')]);_0x483b55[_0xb8ec('0x42')]=_[_0xb8ec('0x43')](_0x4406ec[_0xb8ec('0x3b')],qs[_0xb8ec('0x44')](_0x136e43[_0xb8ec('0x3e')][_0xb8ec('0x44')]));_0x483b55[_0xb8ec('0x42')]=_0x483b55[_0xb8ec('0x42')][_0xb8ec('0x45')]?_0x483b55['attributes']:_0x4406ec[_0xb8ec('0x3b')];_0x483b55[_0xb8ec('0x48')]=qs[_0xb8ec('0x49')](_0x136e43[_0xb8ec('0x3e')][_0xb8ec('0x49')]);_0x483b55[_0xb8ec('0x4a')]=qs['filters'](_[_0xb8ec('0xbc')](_0x136e43['query'],_0x4406ec['filters']));if(_0x136e43['query'][_0xb8ec('0x4e')]){_0x483b55[_0xb8ec('0x4a')]=_[_0xb8ec('0x4d')](_0x483b55[_0xb8ec('0x4a')],{'$or':_[_0xb8ec('0x4f')](_0x483b55['attributes'],function(_0x50ceb9){var _0x1bd708={};_0x1bd708[_0x50ceb9]={'$like':'%'+_0x136e43[_0xb8ec('0x3e')][_0xb8ec('0x4e')]+'%'};return _0x1bd708;})});}_0x483b55=_[_0xb8ec('0x4d')]({},_0x483b55,_0x136e43[_0xb8ec('0x53')]);return _0x4a9cd6[_0xb8ec('0xf5')](_0x483b55);}})[_0xb8ec('0x33')](function(_0x75de76){if(_0x75de76){_0x1056c2=_0x75de76['length'];if(!_0x136e43[_0xb8ec('0x3e')][_0xb8ec('0x46')](_0xb8ec('0x47'))){_0x483b55['limit']=qs[_0xb8ec('0x2c')](_0x136e43[_0xb8ec('0x3e')][_0xb8ec('0x2c')]);_0x483b55['offset']=qs[_0xb8ec('0x2b')](_0x136e43[_0xb8ec('0x3e')][_0xb8ec('0x2b')]);}return _0x4a9cd6[_0xb8ec('0xf5')](_0x483b55);}})[_0xb8ec('0x33')](function(_0x52b71f){if(_0x52b71f){return _0x52b71f?{'count':_0x1056c2,'rows':_0x52b71f}:null;}})['then'](respondWithResult(_0x3b8441,null))['catch'](handleError(_0x3b8441,null));};exports[_0xb8ec('0xf7')]=function(_0x12f63a,_0x398678,_0x552d83){return db[_0xb8ec('0x39')][_0xb8ec('0x5b')]({'where':{'id':_0x12f63a['params']['id']}})[_0xb8ec('0x33')](handleEntityNotFound(_0x398678,null))[_0xb8ec('0x33')](function(_0xeb6cae){if(_0xeb6cae){return _0xeb6cae[_0xb8ec('0xf7')](_0x12f63a['body'][_0xb8ec('0x62')],_[_0xb8ec('0x61')](_0x12f63a[_0xb8ec('0x5d')],[_0xb8ec('0x62'),'id'])||{});}})[_0xb8ec('0x33')](respondWithResult(_0x398678,null))[_0xb8ec('0x59')](handleError(_0x398678,null));};exports[_0xb8ec('0xf8')]=function(_0x4c0b26,_0x84eee9,_0x21e8b0){var _0x336989;return db[_0xb8ec('0x39')][_0xb8ec('0x5b')]({'where':{'id':_0x4c0b26[_0xb8ec('0x5e')]['id']}})[_0xb8ec('0x33')](handleEntityNotFound(_0x84eee9,null))[_0xb8ec('0x33')](function(_0x304eab){if(_0x304eab){return _0x304eab[_0xb8ec('0xf8')](_0x4c0b26[_0xb8ec('0x3e')][_0xb8ec('0x62')]);}})['then'](respondWithStatusCode(_0x84eee9,null))[_0xb8ec('0x59')](handleError(_0x84eee9,null));};exports[_0xb8ec('0xf9')]=function(_0x319a6d,_0x2fe89e,_0x567db9){var _0x3c1c39={};var _0x3254b3={};var _0x2f5d1c;var _0x174239;return db['User'][_0xb8ec('0xb3')]({'where':{'id':_0x319a6d['params']['id']}})['then'](handleEntityNotFound(_0x2fe89e,null))[_0xb8ec('0x33')](function(_0x3fdc9a){if(_0x3fdc9a){_0x2f5d1c=_0x3fdc9a;_0x3254b3[_0xb8ec('0x3b')]=_['keys'](db[_0xb8ec('0xb5')][_0xb8ec('0x3a')]);_0x3254b3[_0xb8ec('0x3e')]=_[_0xb8ec('0x41')](_0x319a6d[_0xb8ec('0x3e')]);_0x3254b3[_0xb8ec('0x4b')]=_[_0xb8ec('0x43')](_0x3254b3['model'],_0x3254b3[_0xb8ec('0x3e')]);_0x3c1c39[_0xb8ec('0x42')]=_['intersection'](_0x3254b3['model'],qs[_0xb8ec('0x44')](_0x319a6d[_0xb8ec('0x3e')][_0xb8ec('0x44')]));_0x3c1c39[_0xb8ec('0x42')]=_0x3c1c39[_0xb8ec('0x42')][_0xb8ec('0x45')]?_0x3c1c39[_0xb8ec('0x42')]:_0x3254b3[_0xb8ec('0x3b')];_0x3c1c39['order']=qs['sort'](_0x319a6d['query'][_0xb8ec('0x49')]);_0x3c1c39['where']=qs[_0xb8ec('0x4b')](_[_0xb8ec('0xbc')](_0x319a6d[_0xb8ec('0x3e')],_0x3254b3[_0xb8ec('0x4b')]));if(_0x319a6d[_0xb8ec('0x3e')]['filter']){_0x3c1c39[_0xb8ec('0x4a')]=_['merge'](_0x3c1c39[_0xb8ec('0x4a')],{'$or':_[_0xb8ec('0x4f')](_0x3c1c39[_0xb8ec('0x42')],function(_0x4e0a8b){var _0x5709da={};_0x5709da[_0x4e0a8b]={'$like':'%'+_0x319a6d['query'][_0xb8ec('0x4e')]+'%'};return _0x5709da;})});}_0x3c1c39=_[_0xb8ec('0x4d')]({},_0x3c1c39,_0x319a6d[_0xb8ec('0x53')]);return _0x2f5d1c['getLists'](_0x3c1c39);}})[_0xb8ec('0x33')](function(_0x465ecd){if(_0x465ecd){_0x174239=_0x465ecd[_0xb8ec('0x45')];if(!_0x319a6d[_0xb8ec('0x3e')][_0xb8ec('0x46')]('nolimit')){_0x3c1c39[_0xb8ec('0x2c')]=qs[_0xb8ec('0x2c')](_0x319a6d[_0xb8ec('0x3e')][_0xb8ec('0x2c')]);_0x3c1c39[_0xb8ec('0x2b')]=qs[_0xb8ec('0x2b')](_0x319a6d[_0xb8ec('0x3e')]['offset']);}return _0x2f5d1c[_0xb8ec('0xf9')](_0x3c1c39);}})[_0xb8ec('0x33')](function(_0x4f319d){if(_0x4f319d){return _0x4f319d?{'count':_0x174239,'rows':_0x4f319d}:null;}})[_0xb8ec('0x33')](respondWithResult(_0x2fe89e,null))['catch'](handleError(_0x2fe89e,null));};exports[_0xb8ec('0xfa')]=function(_0x1f4c9e,_0x2c7f05,_0x2bcbb5){var _0xdf01d5={};var _0x25aa5f={};var _0x51ef28;var _0x532eb9;return db[_0xb8ec('0x39')][_0xb8ec('0xb3')]({'where':{'id':_0x1f4c9e[_0xb8ec('0x5e')]['id']}})[_0xb8ec('0x33')](handleEntityNotFound(_0x2c7f05,null))['then'](function(_0x194e70){if(_0x194e70){_0x51ef28=_0x194e70;_0x25aa5f['model']=_['keys'](db[_0xb8ec('0x39')]['rawAttributes']);_0x25aa5f[_0xb8ec('0x3e')]=_[_0xb8ec('0x41')](_0x1f4c9e[_0xb8ec('0x3e')]);_0x25aa5f['filters']=_['intersection'](_0x25aa5f[_0xb8ec('0x3b')],_0x25aa5f[_0xb8ec('0x3e')]);_0xdf01d5[_0xb8ec('0x42')]=_[_0xb8ec('0x43')](_0x25aa5f['model'],qs['fields'](_0x1f4c9e['query']['fields']));_0xdf01d5[_0xb8ec('0x42')]=_0xdf01d5[_0xb8ec('0x42')][_0xb8ec('0x45')]?_0xdf01d5[_0xb8ec('0x42')]:_0x25aa5f[_0xb8ec('0x3b')];_0xdf01d5['order']=qs['sort'](_0x1f4c9e[_0xb8ec('0x3e')][_0xb8ec('0x49')]);_0xdf01d5[_0xb8ec('0x4a')]=qs[_0xb8ec('0x4b')](_[_0xb8ec('0xbc')](_0x1f4c9e[_0xb8ec('0x3e')],_0x25aa5f[_0xb8ec('0x4b')]));if(_0x1f4c9e[_0xb8ec('0x3e')]['filter']){_0xdf01d5[_0xb8ec('0x4a')]=_[_0xb8ec('0x4d')](_0xdf01d5[_0xb8ec('0x4a')],{'$or':_['map'](_0xdf01d5['attributes'],function(_0x3d317d){var _0x5da3f1={};_0x5da3f1[_0x3d317d]={'$like':'%'+_0x1f4c9e[_0xb8ec('0x3e')][_0xb8ec('0x4e')]+'%'};return _0x5da3f1;})});}_0xdf01d5[_0xb8ec('0x3b')]=db[_0xb8ec('0x39')];_0xdf01d5['as']=_0xb8ec('0xfb');_0xdf01d5=_['merge']({},_0xdf01d5,_0x1f4c9e[_0xb8ec('0x53')]);return _0x51ef28[_0xb8ec('0xfc')]({'include':[_0xdf01d5]});}})[_0xb8ec('0x33')](function(_0x4d5150){if(_0x4d5150){var _0x1eb89f={},_0x2f2076=[],_0x45f197=0x0;for(var _0x4176ce=0x0;_0x4176ce<_0x4d5150[_0xb8ec('0x45')];_0x4176ce+=0x1){for(var _0x47f187=0x0,_0x4fd7ab;_0x47f187<_0x4d5150[_0x4176ce][_0xb8ec('0xfb')][_0xb8ec('0x45')];_0x47f187+=0x1){_0x4fd7ab=_0x4d5150[_0x4176ce][_0xb8ec('0xfb')][_0x47f187][_0xb8ec('0xbd')]({'plain':!![]});_0x1eb89f[_0x4fd7ab['id']]=_0x4fd7ab;}}_0x1eb89f=_[_0xb8ec('0xfd')](_0x1eb89f);for(var _0x11c555=qs[_0xb8ec('0x2b')](_0x1f4c9e[_0xb8ec('0x3e')][_0xb8ec('0x2b')]);_0x11c555<_0x1eb89f['length']&&_0x2f2076['length']=_0x425be3){_0x3dd0b9=_0x425be3;_0x398f68=0xc8;}else{_0x398f68=0xce;}_0x551a56[_0xde5a('0x26')](_0x398f68);return _0x551a56[_0xde5a('0x2a')]('Content-Range',_0x1c9659+'-'+_0x3dd0b9+'/'+_0x425be3)[_0xde5a('0x27')](_0x584139);}return null;};}function patchUpdates(_0x2346d0){return function(_0xd3d7dc){try{jsonpatch[_0xde5a('0x2b')](_0xd3d7dc,_0x2346d0,!![]);}catch(_0x53870f){return BPromise['reject'](_0x53870f);}return _0xd3d7dc[_0xde5a('0x2c')]();};}function saveUpdates(_0x3ea52b,_0x24fb02){return function(_0x507777){if(_0x507777){return _0x507777['update'](_0x3ea52b)['then'](function(_0x55e6b6){return _0x55e6b6;});}return null;};}function removeEntity(_0x23950b,_0x573247){return function(_0x19d05e){if(_0x19d05e){return _0x19d05e[_0xde5a('0x2d')]()[_0xde5a('0x1b')](function(){_0x23950b[_0xde5a('0x26')](0xcc)[_0xde5a('0x2e')]();});}};}function handleEntityNotFound(_0x14d931,_0x57f638){return function(_0x37c42d){if(!_0x37c42d){_0x14d931[_0xde5a('0x2f')](0x194);}return _0x37c42d;};}function handleError(_0x4b7df4,_0x4ebabb){_0x4ebabb=_0x4ebabb||0x1f4;return function(_0x360a41){logger[_0xde5a('0x21')](_0x360a41[_0xde5a('0x30')]);if(_0x360a41[_0xde5a('0x31')]){delete _0x360a41[_0xde5a('0x31')];}_0x4b7df4['status'](_0x4ebabb)['send'](_0x360a41);};}exports[_0xde5a('0x32')]=function(_0x17f18d,_0x5af3d4){var _0x18c05f={},_0x329a35={},_0x328b5e={'count':0x0,'rows':[]};var _0x33ec9b=db[_0xde5a('0x33')][_0xde5a('0x34')];_0x329a35[_0xde5a('0x35')]=_['differenceBy'](_['keys'](_0x33ec9b),['password',_0xde5a('0x36')]);var _0x3febf8={'dateStart':_0x17f18d[_0xde5a('0x37')][_0xde5a('0x38')],'dateEnd':_0x17f18d['query'][_0xde5a('0x39')]};delete _0x17f18d[_0xde5a('0x37')][_0xde5a('0x38')];delete _0x17f18d[_0xde5a('0x37')]['dateEnd'];_0x329a35[_0xde5a('0x37')]=_[_0xde5a('0x3a')](_0x17f18d[_0xde5a('0x37')]);_0x329a35[_0xde5a('0x3b')]=_['intersection'](_0x329a35[_0xde5a('0x35')],_0x329a35[_0xde5a('0x37')]);_0x18c05f[_0xde5a('0x3c')]=_[_0xde5a('0x3d')](_0x329a35['model'],qs['fields'](_0x17f18d[_0xde5a('0x37')][_0xde5a('0x3e')]));_0x18c05f[_0xde5a('0x3c')]=_0x18c05f[_0xde5a('0x3c')][_0xde5a('0x3f')]?_0x18c05f[_0xde5a('0x3c')]:_0x329a35[_0xde5a('0x35')];if(!_0x17f18d[_0xde5a('0x37')]['hasOwnProperty'](_0xde5a('0x40'))){_0x18c05f[_0xde5a('0x41')]=qs[_0xde5a('0x41')](_0x17f18d[_0xde5a('0x37')][_0xde5a('0x41')]);_0x18c05f[_0xde5a('0x29')]=qs[_0xde5a('0x29')](_0x17f18d[_0xde5a('0x37')][_0xde5a('0x29')]);}_0x18c05f[_0xde5a('0x42')]=qs['sort'](_0x17f18d[_0xde5a('0x37')][_0xde5a('0x43')]);_0x18c05f['where']=qs[_0xde5a('0x3b')](_[_0xde5a('0x44')](_0x17f18d[_0xde5a('0x37')],_0x329a35[_0xde5a('0x3b')]));if(_0x3febf8[_0xde5a('0x38')]){if(_0x3febf8[_0xde5a('0x39')]){_0x3febf8[_0xde5a('0x39')]=moment(_0x3febf8[_0xde5a('0x39')])['add'](0x1,_0xde5a('0x45'));}else{_0x3febf8['dateEnd']=moment(_0x3febf8[_0xde5a('0x38')])[_0xde5a('0x46')](0x1,_0xde5a('0x45'));}_[_0xde5a('0x47')](_0x18c05f[_0xde5a('0x48')],{'createdAt':{'$gte':_0x3febf8[_0xde5a('0x38')],'$lte':_0x3febf8['dateEnd']}});}if(_0x17f18d[_0xde5a('0x37')][_0xde5a('0x49')]){_0x18c05f[_0xde5a('0x48')]=_[_0xde5a('0x47')](_0x18c05f[_0xde5a('0x48')],{'$or':_[_0xde5a('0x4a')](_0x18c05f['attributes'],function(_0x27f304){return db[_0xde5a('0x4b')][_0xde5a('0x48')](db[_0xde5a('0x4b')]['fn'](_0xde5a('0x4c'),db[_0xde5a('0x4b')]['col'](_0x27f304)),{'$like':db[_0xde5a('0x4b')]['fn']('lower','%'+_0x17f18d[_0xde5a('0x37')][_0xde5a('0x49')]+'%')});})});}_0x18c05f=_[_0xde5a('0x47')]({},_0x18c05f,_0x17f18d[_0xde5a('0x4d')]);var _0x231d61={'where':_0x18c05f[_0xde5a('0x48')]};return db[_0xde5a('0x33')]['count'](_0x231d61)[_0xde5a('0x1b')](function(_0x1fb591){_0x328b5e[_0xde5a('0x28')]=_0x1fb591;if(_0x17f18d[_0xde5a('0x37')]['includeAll']){_0x18c05f[_0xde5a('0x4e')]=[{'all':!![]}];}return db[_0xde5a('0x33')][_0xde5a('0x4f')](_0x18c05f);})[_0xde5a('0x1b')](function(_0x53b638){_0x328b5e[_0xde5a('0x50')]=_0x53b638;return _0x328b5e;})[_0xde5a('0x1b')](respondWithFilteredResult(_0x5af3d4,_0x18c05f))[_0xde5a('0x25')](handleError(_0x5af3d4,null));};exports[_0xde5a('0x51')]=function(_0x1e11f9,_0x47d157){var _0x43dd0c={'raw':![],'where':{'id':_0x1e11f9[_0xde5a('0x52')]['id']}},_0x214e56={};_0x214e56['model']=_[_0xde5a('0x53')](_[_0xde5a('0x3a')](db[_0xde5a('0x33')][_0xde5a('0x34')]),[_0xde5a('0x54'),_0xde5a('0x36')]);_0x214e56[_0xde5a('0x37')]=_[_0xde5a('0x3a')](_0x1e11f9[_0xde5a('0x37')]);_0x214e56[_0xde5a('0x3b')]=_[_0xde5a('0x3d')](_0x214e56[_0xde5a('0x35')],_0x214e56[_0xde5a('0x37')]);_0x43dd0c[_0xde5a('0x3c')]=_[_0xde5a('0x3d')](_0x214e56[_0xde5a('0x35')],qs['fields'](_0x1e11f9[_0xde5a('0x37')][_0xde5a('0x3e')]));_0x43dd0c[_0xde5a('0x3c')]=_0x43dd0c[_0xde5a('0x3c')]['length']?_0x43dd0c['attributes']:_0x214e56['model'];if(_0x1e11f9[_0xde5a('0x37')][_0xde5a('0x55')]){_0x43dd0c[_0xde5a('0x4e')]=[{'all':!![]}];}_0x43dd0c=_['merge']({},_0x43dd0c,_0x1e11f9['options']);return db[_0xde5a('0x33')][_0xde5a('0x56')](_0x43dd0c)['then'](handleEntityNotFound(_0x47d157,null))[_0xde5a('0x1b')](respondWithResult(_0x47d157,null))[_0xde5a('0x25')](handleError(_0x47d157,null));};exports[_0xde5a('0x57')]=function(_0x34b826,_0x14ca1c){return db[_0xde5a('0x33')][_0xde5a('0x57')](_0x34b826[_0xde5a('0x58')],{'raw':![],'individualHooks':!![]})[_0xde5a('0x1b')](respondWithResult(_0x14ca1c,0xc9))[_0xde5a('0x25')](handleError(_0x14ca1c,null));};exports[_0xde5a('0x59')]=function(_0x554bf6,_0x4df3cf){if(_0x554bf6[_0xde5a('0x58')]['id']){delete _0x554bf6[_0xde5a('0x58')]['id'];}return db[_0xde5a('0x33')][_0xde5a('0x56')]({'where':{'id':_0x554bf6[_0xde5a('0x52')]['id']}})[_0xde5a('0x1b')](handleEntityNotFound(_0x4df3cf,null))['then'](saveUpdates(_0x554bf6[_0xde5a('0x58')],null))[_0xde5a('0x1b')](respondWithResult(_0x4df3cf,null))[_0xde5a('0x25')](handleError(_0x4df3cf,null));};exports['describe']=function(_0x45881b,_0x2ea5c1){return db[_0xde5a('0x33')][_0xde5a('0x5a')]()[_0xde5a('0x1b')](respondWithResult(_0x2ea5c1,null))[_0xde5a('0x25')](handleError(_0x2ea5c1,null));};exports[_0xde5a('0x5b')]=function(_0x17d10e,_0x3d7d19,_0x18b3d5){return db[_0xde5a('0x33')][_0xde5a('0x56')]({'where':{'id':_0x17d10e['params']['id']}})[_0xde5a('0x1b')](handleEntityNotFound(_0x3d7d19,null))[_0xde5a('0x1b')](function(_0x25f6b0){if(_0x25f6b0){return _0x25f6b0['addContacts'](_0x17d10e[_0xde5a('0x58')][_0xde5a('0x5c')],_['omit'](_0x17d10e[_0xde5a('0x58')],[_0xde5a('0x5c'),'id'])||{});}})[_0xde5a('0x1b')](respondWithResult(_0x3d7d19,null))[_0xde5a('0x25')](handleError(_0x3d7d19,null));};var getLicense=function(_0x2501cc){return new BPromise(function(_0x2437ec,_0x2c6374){var _0x87d85c=0x0;_0x2501cc['body'][_0xde5a('0x5d')]===_0xde5a('0x5e')&&_0x2437ec(_0xde5a('0x5f'));return db[_0xde5a('0x33')][_0xde5a('0x28')]({'where':{'$or':[{'role':_0x2501cc['body'][_0xde5a('0x5d')]===_0xde5a('0x60')?_0xde5a('0x60'):[_0xde5a('0x61'),_0xde5a('0x62')]}]}})[_0xde5a('0x1b')](function(_0xb7cc44){_0x87d85c=_0xb7cc44;return require(_0xde5a('0x63'))[_0xde5a('0x64')]();})[_0xde5a('0x1b')](function(_0x25e5e3){var _0xa61d74=_0x2501cc[_0xde5a('0x58')][_0xde5a('0x5d')]==='telephone'?_0xde5a('0x65'):'users';if(!_[_0xde5a('0x66')](_0x25e5e3[_0xa61d74])&&_0x87d85c>=_0x25e5e3[_0xa61d74]){return _0x2c6374({'message':_0xde5a('0x67')});}return _0x2437ec(util['format']('count\x20%s:\x20%s',_0xa61d74,_0x87d85c));})[_0xde5a('0x25')](function(_0x1777d5){return _0x2c6374(_0x1777d5);});});};exports[_0xde5a('0x68')]=function(_0x42213a,_0x50ce3e){return getLicense(_0x42213a)[_0xde5a('0x1b')](function(_0x25a4e4){if(!_0x42213a[_0xde5a('0x58')][_0xde5a('0x69')]){var _0x349fff;return db[_0xde5a('0x6a')][_0xde5a('0x6b')](0x1)['then'](function(_0x3ebbd6){_0x349fff=_0x3ebbd6['min_internal'];return db[_0xde5a('0x33')][_0xde5a('0x6c')](_0xde5a('0x69'));})[_0xde5a('0x1b')](function(_0x4e78a1){if(_[_0xde5a('0x66')](_0x4e78a1)){if(_0x349fff){_0x42213a['body'][_0xde5a('0x69')]=_0x349fff;}else{_0x42213a['body'][_0xde5a('0x69')]=0x1;}}else{if(_['isNil'](_0x349fff)||_0x349fff==_0x4e78a1){_0x42213a[_0xde5a('0x58')][_0xde5a('0x69')]=_0x4e78a1+0x1;}else if(_0x349fff>_0x4e78a1){_0x42213a[_0xde5a('0x58')][_0xde5a('0x69')]=_0x349fff;}else{return db[_0xde5a('0x4b')][_0xde5a('0x37')](_0xde5a('0x6d'),{'type':db[_0xde5a('0x4b')]['QueryTypes'][_0xde5a('0x6e')]})[_0xde5a('0x1b')](function(_0x10baba){if(_0x10baba&&_0x10baba['length']){for(var _0x9e7e23=0x0,_0x24302e=_0x10baba[_0xde5a('0x3f')];_0x9e7e23<_0x24302e&&_[_0xde5a('0x66')](_0x42213a[_0xde5a('0x58')][_0xde5a('0x69')]);_0x9e7e23++){if(_0x349fff<=_0x10baba[_0x9e7e23][_0xde5a('0x6f')]){_0x42213a[_0xde5a('0x58')][_0xde5a('0x69')]=_0x10baba[_0x9e7e23][_0xde5a('0x6f')];}else if(_0x349fff>_0x10baba[_0x9e7e23][_0xde5a('0x6f')]&&_0x349fff<=_0x10baba[_0x9e7e23]['to']){_0x42213a[_0xde5a('0x58')][_0xde5a('0x69')]=_0x349fff;}}}if(_[_0xde5a('0x66')](_0x42213a[_0xde5a('0x58')][_0xde5a('0x69')])){_0x42213a['body']['internal']=_0x4e78a1+0x1;}});}}});}})[_0xde5a('0x1b')](function(){if(_0x42213a[_0xde5a('0x58')]['voicemail']){_0x42213a['body']['mailbox']=_0x42213a[_0xde5a('0x58')][_0xde5a('0x69')];_0x42213a[_0xde5a('0x58')][_0xde5a('0x70')]={'mailbox':_0x42213a['body'][_0xde5a('0x69')],'password':_0x42213a[_0xde5a('0x58')]['password'],'fullname':_0x42213a[_0xde5a('0x58')][_0xde5a('0x71')],'email':_0x42213a[_0xde5a('0x58')]['email']};}if(_0x42213a[_0xde5a('0x58')]&&_0x42213a['body'][_0xde5a('0x5d')]==='agent'){_0x42213a[_0xde5a('0x58')][_0xde5a('0x72')]=[_0xde5a('0x73'),_0xde5a('0x74'),_0xde5a('0x75'),'110',_0xde5a('0x76'),'105',_0xde5a('0x77'),_0xde5a('0x78'),_0xde5a('0x79'),'109',_0xde5a('0x7a'),_0xde5a('0x7b')];}return db[_0xde5a('0x33')][_0xde5a('0x68')](_0x42213a[_0xde5a('0x58')],{'include':[{'model':db[_0xde5a('0x70')],'as':_0xde5a('0x70')}]});})[_0xde5a('0x1b')](respondWithResult(_0x50ce3e,0xc9))[_0xde5a('0x25')](handleError(_0x50ce3e,null));};exports[_0xde5a('0x7c')]=function(_0xdf2bda,_0x34fa62,_0x2c81b9){if(_0xdf2bda[_0xde5a('0x58')]['id']){delete _0xdf2bda[_0xde5a('0x58')]['id'];}return db['User'][_0xde5a('0x56')]({'where':{'id':_0xdf2bda[_0xde5a('0x52')]['id']}})[_0xde5a('0x1b')](function(_0x237683){if(_0x237683){if(_0x237683['id']==_0xdf2bda[_0xde5a('0x62')]['id']){if(!_0xdf2bda[_0xde5a('0x58')][_0xde5a('0x7d')]||!_0xdf2bda['body'][_0xde5a('0x7e')]){throw new db[(_0xde5a('0x7f'))][(_0xde5a('0x80'))](_0xde5a('0x81'));}if(!_0x237683[_0xde5a('0x82')](_0xdf2bda[_0xde5a('0x58')][_0xde5a('0x7d')])){throw new db[(_0xde5a('0x7f'))][(_0xde5a('0x80'))](_0xde5a('0x83'));}if(_0xdf2bda['body'][_0xde5a('0x7d')]==_0xdf2bda[_0xde5a('0x58')][_0xde5a('0x7e')]){throw new db[(_0xde5a('0x7f'))][(_0xde5a('0x80'))](_0xde5a('0x84'));}return _0x237683;}else if(_0xdf2bda[_0xde5a('0x62')][_0xde5a('0x5d')]==_0xde5a('0x61')){if(!_0xdf2bda[_0xde5a('0x58')][_0xde5a('0x7e')]){throw new db['Sequelize'][(_0xde5a('0x80'))](_0xde5a('0x85'));}return _0x237683;}else if(_0xdf2bda[_0xde5a('0x62')][_0xde5a('0x5d')]==_0xde5a('0x62')){if(!_0xdf2bda[_0xde5a('0x58')][_0xde5a('0x7e')]){throw new db[(_0xde5a('0x7f'))][(_0xde5a('0x80'))](_0xde5a('0x85'));}if(_0x237683['role']!=_0xde5a('0x5e')){throw new db[(_0xde5a('0x7f'))][(_0xde5a('0x80'))](_0xde5a('0x86'));}return _0x237683;}else{throw new db[(_0xde5a('0x7f'))]['ValidationError'](_0xde5a('0x86'));}}return null;})[_0xde5a('0x1b')](handleEntityNotFound(_0x34fa62,null))[_0xde5a('0x1b')](saveUpdates({'password':_0xdf2bda[_0xde5a('0x58')][_0xde5a('0x7e')],'passwordResetAt':_0xdf2bda[_0xde5a('0x62')]['id']==_0xdf2bda['params']['id']?moment():null},null))['then'](respondWithResult(_0x34fa62,null))['catch'](handleError(_0x34fa62,null));};exports[_0xde5a('0x87')]=function(_0x2e8734,_0x42bafa,_0x39dc17){var _0x5e9bc2;return db[_0xde5a('0x33')][_0xde5a('0x56')]({'where':{'id':_0x2e8734[_0xde5a('0x52')]['id']},'attributes':['id',_0xde5a('0x31'),_0xde5a('0x5d'),'loginInPause',_0xde5a('0x88'),'interface']})[_0xde5a('0x1b')](handleEntityNotFound(_0x42bafa,null))[_0xde5a('0x1b')](function(_0x884f7c){if(_0x884f7c){_0x5e9bc2=_0x884f7c;if(!utils['isValidChannel'](_0x2e8734[_0xde5a('0x58')][_0xde5a('0x89')])){throw new db['Sequelize'][(_0xde5a('0x80'))](_0xde5a('0x8a'));}return _0x884f7c[_0xde5a('0x46')+_[_0xde5a('0x8b')](_0x2e8734[_0xde5a('0x58')][_0xde5a('0x89')][_0xde5a('0x8c')]())+_0xde5a('0x8d')](_0x2e8734[_0xde5a('0x58')][_0xde5a('0x5c')],{'penalty':_0x2e8734['body'][_0xde5a('0x8e')]||0x0});}})[_0xde5a('0x8f')](function(_0x3c974c){for(var _0x62a340=0x0;_0x62a340<_0x2e8734[_0xde5a('0x58')][_0xde5a('0x5c')][_0xde5a('0x3f')];_0x62a340+=0x1){var _0x2b857a={'UserId':_0x2e8734['params']['id']};_0x2b857a[_[_0xde5a('0x8b')](_0x2e8734[_0xde5a('0x58')]['channel'][_0xde5a('0x8c')]())+_0xde5a('0x90')]=_0x2e8734[_0xde5a('0x58')]['ids'][_0x62a340];socket[_0xde5a('0x91')](_0xde5a('0x62')+_[_0xde5a('0x8b')](_0x2e8734[_0xde5a('0x58')][_0xde5a('0x89')][_0xde5a('0x8c')]())+'Queue:save',_0x2b857a);}return _0x3c974c;})[_0xde5a('0x1b')](function(){if(_0x2e8734[_0xde5a('0x58')][_0xde5a('0x89')]===_0xde5a('0x92')){return db[_0xde5a('0x93')][_0xde5a('0x4f')]({'where':{'id':_0x2e8734[_0xde5a('0x58')][_0xde5a('0x5c')]||[]},'raw':!![],'attributes':['id','name']});}})[_0xde5a('0x1b')](function(_0x2769e5){var _0x136581=[];if(_0x2e8734[_0xde5a('0x58')][_0xde5a('0x89')]==='voice'&&_0x5e9bc2['role']===_0xde5a('0x5e')){for(var _0x3b3ef8=0x0;_0x3b3ef8<_0x2769e5[_0xde5a('0x3f')];_0x3b3ef8+=0x1){_0x136581[_0xde5a('0x94')]({'membername':_0x5e9bc2['name'],'UserId':_0x5e9bc2['id'],'queue_name':_0x2769e5[_0x3b3ef8][_0xde5a('0x31')],'VoiceQueueId':_0x2769e5[_0x3b3ef8]['id'],'interface':_[_0xde5a('0x66')](_0x5e9bc2[_0xde5a('0x95')])?util[_0xde5a('0x96')](_0xde5a('0x97'),_0x5e9bc2[_0xde5a('0x31')]):_0x5e9bc2['interface'],'paused':_0x5e9bc2[_0xde5a('0x88')]||![],'penalty':_0x2e8734[_0xde5a('0x58')]['penalty']||0x0});}return BPromise[_0xde5a('0x98')](_0x136581,function(_0x41b55f){return db[_0xde5a('0x99')][_0xde5a('0x9a')](_0x41b55f);});}return _0x5e9bc2;})[_0xde5a('0x1b')](respondWithStatusCode(_0x42bafa,null))[_0xde5a('0x25')](handleError(_0x42bafa,null));};exports[_0xde5a('0x9b')]=function(_0x21fc8b,_0x3a40da,_0x29bb43){var _0x5e053a;return db[_0xde5a('0x33')][_0xde5a('0x56')]({'where':{'id':_0x21fc8b[_0xde5a('0x52')]['id']},'attributes':['id',_0xde5a('0x31'),_0xde5a('0x5d')]})[_0xde5a('0x1b')](handleEntityNotFound(_0x3a40da,null))['then'](function(_0x43cf79){if(_0x43cf79){_0x5e053a=_0x43cf79;if(!_0x21fc8b[_0xde5a('0x37')][_0xde5a('0x89')]||!utils[_0xde5a('0x9c')](_0x21fc8b[_0xde5a('0x37')][_0xde5a('0x89')])){throw new db[(_0xde5a('0x7f'))][(_0xde5a('0x80'))](_0xde5a('0x8a'));}return _0x43cf79[_0xde5a('0x9d')+_[_0xde5a('0x8b')](_0x21fc8b[_0xde5a('0x37')][_0xde5a('0x89')][_0xde5a('0x8c')]())+'Queues'](_0x21fc8b[_0xde5a('0x37')]['ids']);}})[_0xde5a('0x1b')](function(_0x819125){for(var _0x379297=0x0;_0x379297<_0x21fc8b[_0xde5a('0x37')]['ids']['length'];_0x379297+=0x1){var _0x43face={'UserId':_0x21fc8b['params']['id']};_0x43face[_['capitalize'](_0x21fc8b['query'][_0xde5a('0x89')]['toLowerCase']())+_0xde5a('0x90')]=_0x21fc8b[_0xde5a('0x37')][_0xde5a('0x5c')][_0x379297];socket[_0xde5a('0x91')](_0xde5a('0x62')+_[_0xde5a('0x8b')](_0x21fc8b[_0xde5a('0x37')]['channel'][_0xde5a('0x8c')]())+'Queue:remove',_0x43face);}return _0x819125;})[_0xde5a('0x1b')](function(){if(_0x21fc8b[_0xde5a('0x37')][_0xde5a('0x89')]===_0xde5a('0x92')){return db['UserVoiceQueueRt'][_0xde5a('0x2d')]({'where':{'UserId':_0x21fc8b['params']['id'],'VoiceQueueId':_0x21fc8b[_0xde5a('0x37')][_0xde5a('0x5c')]},'individualHooks':!![]})['then'](function(){return _0x5e053a;});}return _0x5e053a;})[_0xde5a('0x1b')](respondWithStatusCode(_0x3a40da,null))[_0xde5a('0x25')](handleError(_0x3a40da,null));};exports[_0xde5a('0x9e')]=function(_0x3edbf4,_0x31d2a8,_0xc7096){_0x3edbf4['body']['userpic']=_0x3edbf4['file'][_0xde5a('0x9f')];return db[_0xde5a('0x33')]['find']({'where':{'id':_0x3edbf4['params']['id']}})[_0xde5a('0x1b')](handleEntityNotFound(_0x31d2a8,null))[_0xde5a('0x1b')](saveUpdates(_0x3edbf4[_0xde5a('0x58')],null))[_0xde5a('0x1b')](respondWithResult(_0x31d2a8,null))['catch'](handleError(_0x31d2a8,null));};exports['getAvatar']=function(_0x2beed0,_0x4eb3df,_0x494fc6){var _0x449fe5=path[_0xde5a('0xa0')](config[_0xde5a('0xa1')],_0xde5a('0xa2'));return db[_0xde5a('0x33')][_0xde5a('0x56')]({'where':{'id':_0x2beed0[_0xde5a('0x52')]['id']},'attributes':['id',_0xde5a('0xa3')],'raw':!![]})[_0xde5a('0x1b')](handleEntityNotFound(_0x4eb3df,null))[_0xde5a('0x1b')](function(_0x2288f9){if(_0x2288f9){if(_[_0xde5a('0x66')](_0x2288f9[_0xde5a('0xa3')])){return _0x4eb3df[_0xde5a('0xa4')](_0x449fe5);}else{if(!fs[_0xde5a('0xa5')](path[_0xde5a('0xa0')](config[_0xde5a('0xa1')],'server/files/images/',_0x2288f9[_0xde5a('0xa3')]))){return _0x4eb3df['download'](_0x449fe5);}return _0x4eb3df[_0xde5a('0xa4')](path[_0xde5a('0xa0')](config[_0xde5a('0xa1')],_0xde5a('0xa6'),_0x2288f9['userpic']));}}})[_0xde5a('0x25')](handleError(_0x4eb3df,null));};exports['getContacts']=function(_0x3830a1,_0x572848,_0x2a813d){var _0x5018bc={};var _0x28f62e={};var _0x3bd343;var _0x33791b;return db[_0xde5a('0x33')][_0xde5a('0xa7')]({'where':{'id':_0x3830a1[_0xde5a('0x52')]['id']}})[_0xde5a('0x1b')](handleEntityNotFound(_0x572848,null))[_0xde5a('0x1b')](function(_0x1da9c3){if(_0x1da9c3){_0x3bd343=_0x1da9c3;_0x28f62e['model']=_[_0xde5a('0x3a')](db['CmContact']['rawAttributes']);_0x28f62e[_0xde5a('0x37')]=_['keys'](_0x3830a1[_0xde5a('0x37')]);_0x28f62e[_0xde5a('0x3b')]=_['intersection'](_0x28f62e[_0xde5a('0x35')],_0x28f62e[_0xde5a('0x37')]);_0x5018bc[_0xde5a('0x3c')]=_[_0xde5a('0x3d')](_0x28f62e[_0xde5a('0x35')],qs['fields'](_0x3830a1['query'][_0xde5a('0x3e')]));_0x5018bc['attributes']=_0x5018bc['attributes']['length']?_0x5018bc[_0xde5a('0x3c')]:_0x28f62e['model'];_0x5018bc[_0xde5a('0x42')]=qs['sort'](_0x3830a1['query'][_0xde5a('0x43')]);_0x5018bc['where']=qs[_0xde5a('0x3b')](_[_0xde5a('0x44')](_0x3830a1[_0xde5a('0x37')],_0x28f62e[_0xde5a('0x3b')]));if(_0x3830a1[_0xde5a('0x37')]['filter']){_0x5018bc[_0xde5a('0x48')]=_[_0xde5a('0x47')](_0x5018bc[_0xde5a('0x48')],{'$or':_['map'](_0x5018bc[_0xde5a('0x3c')],function(_0x161ae0){var _0x43e0b9={};_0x43e0b9[_0x161ae0]={'$like':'%'+_0x3830a1['query'][_0xde5a('0x49')]+'%'};return _0x43e0b9;})});}_0x5018bc=_[_0xde5a('0x47')]({},_0x5018bc,_0x3830a1[_0xde5a('0x4d')]);return _0x3bd343['getContacts'](_0x5018bc);}})['then'](function(_0x53e5c6){if(_0x53e5c6){_0x33791b=_0x53e5c6[_0xde5a('0x3f')];if(_0x3830a1[_0xde5a('0x37')]['hasOwnProperty']('includeAll')){_0x5018bc['include']=[{'model':db[_0xde5a('0xa8')],'as':_0xde5a('0xa9'),'required':![]},{'model':db[_0xde5a('0xaa')],'as':_0xde5a('0xab'),'attributes':['id',_0xde5a('0x31'),_0xde5a('0xac')],'where':_0x3830a1['query'][_0xde5a('0xad')]?{'id':_0x3830a1[_0xde5a('0x37')]['tag']}:undefined,'required':_0x3830a1['query'][_0xde5a('0xad')]?!![]:![]}];}if(!_0x3830a1[_0xde5a('0x37')][_0xde5a('0xae')](_0xde5a('0x40'))){_0x5018bc[_0xde5a('0x41')]=qs[_0xde5a('0x41')](_0x3830a1['query']['limit']);_0x5018bc[_0xde5a('0x29')]=qs[_0xde5a('0x29')](_0x3830a1[_0xde5a('0x37')][_0xde5a('0x29')]);}return _0x3bd343[_0xde5a('0xaf')](_0x5018bc);}})[_0xde5a('0x1b')](function(_0x237e5c){if(_0x237e5c){return _0x237e5c?{'count':_0x33791b,'rows':_0x237e5c}:null;}})[_0xde5a('0x1b')](respondWithResult(_0x572848,null))[_0xde5a('0x25')](handleError(_0x572848,null));};exports[_0xde5a('0xb0')]=function(_0x5d40d5,_0x126832,_0x1acae2){var _0x12d00c;var _0x208589;var _0xb63357={};var _0x513902;return db[_0xde5a('0x33')][_0xde5a('0xa7')]({'where':{'id':_0x5d40d5[_0xde5a('0x52')]['id']},'attributes':['id',_0xde5a('0x31'),_0xde5a('0x5d')]})[_0xde5a('0x1b')](handleEntityNotFound(_0x126832,null))[_0xde5a('0x1b')](function(_0x3acd0f){if(!utils[_0xde5a('0x9c')](_0x5d40d5[_0xde5a('0x37')][_0xde5a('0x89')])){throw new db[(_0xde5a('0x7f'))][(_0xde5a('0x80'))](_0xde5a('0x8a'));}_0x12d00c=_0x3acd0f;var _0x210ed2={};_0x210ed2[_0xde5a('0x35')]=_[_0xde5a('0x3a')](db[_[_0xde5a('0x8b')](_0x5d40d5[_0xde5a('0x37')]['channel'])+_0xde5a('0xb1')][_0xde5a('0x34')]);_0x210ed2['query']=_['keys'](_0x5d40d5[_0xde5a('0x37')]);_0x210ed2[_0xde5a('0x3b')]=_['intersection'](_0x210ed2[_0xde5a('0x35')],_0x210ed2[_0xde5a('0x37')]);_0xb63357['attributes']=_['intersection'](_0x210ed2[_0xde5a('0x35')],qs['fields'](_0x5d40d5['query'][_0xde5a('0x3e')]));_0xb63357[_0xde5a('0x3c')]=_0xb63357[_0xde5a('0x3c')][_0xde5a('0x3f')]?_0xb63357[_0xde5a('0x3c')]:_0x210ed2['model'];_0xb63357[_0xde5a('0x42')]=qs[_0xde5a('0x43')](_0x5d40d5[_0xde5a('0x37')]['sort']);_0xb63357[_0xde5a('0x48')]=qs['filters'](_[_0xde5a('0x44')](_0x5d40d5[_0xde5a('0x37')],_0x210ed2[_0xde5a('0x3b')]));if(_0x5d40d5[_0xde5a('0x37')][_0xde5a('0x49')]){_0xb63357[_0xde5a('0x48')]=_[_0xde5a('0x47')](_0xb63357[_0xde5a('0x48')],{'$or':_[_0xde5a('0x4a')](_0xb63357[_0xde5a('0x3c')],function(_0x3cd850){var _0x107ca4={};_0x107ca4[_0x3cd850]={'$like':'%'+_0x5d40d5['query'][_0xde5a('0x49')]+'%'};return _0x107ca4;})});}_0xb63357=_['merge']({},_0xb63357,_0x5d40d5[_0xde5a('0x4d')]);switch(_0x12d00c[_0xde5a('0x5d')]){case _0xde5a('0x61'):return db[_[_0xde5a('0x8b')](_0x5d40d5[_0xde5a('0x37')][_0xde5a('0x89')])+_0xde5a('0xb1')]['findAll'](_0xb63357);case _0xde5a('0x62'):case'agent':return _0x12d00c[_0xde5a('0xb2')+_[_0xde5a('0x8b')](_0x5d40d5[_0xde5a('0x37')]['channel'])+_0xde5a('0x8d')](_0xb63357);default:throw new db[(_0xde5a('0x7f'))]['ValidationError'](_0xde5a('0xb3'));}})[_0xde5a('0x1b')](function(_0x24930b){_0x513902=_0x24930b[_0xde5a('0x3f')];if(!_0x5d40d5[_0xde5a('0x37')][_0xde5a('0xae')]('nolimit')){_0xb63357[_0xde5a('0x41')]=qs[_0xde5a('0x41')](_0x5d40d5['query'][_0xde5a('0x41')]);_0xb63357['offset']=qs[_0xde5a('0x29')](_0x5d40d5[_0xde5a('0x37')][_0xde5a('0x29')]);}switch(_0x12d00c[_0xde5a('0x5d')]){case _0xde5a('0x61'):return db[_[_0xde5a('0x8b')](_0x5d40d5[_0xde5a('0x37')][_0xde5a('0x89')])+_0xde5a('0xb1')]['findAll'](_0xb63357);case _0xde5a('0x62'):case _0xde5a('0x5e'):return _0x12d00c['get'+_[_0xde5a('0x8b')](_0x5d40d5['query'][_0xde5a('0x89')])+_0xde5a('0x8d')](_0xb63357);}})[_0xde5a('0x1b')](function(_0xa95c5a){return{'count':_0x513902,'rows':_0xa95c5a};})[_0xde5a('0x1b')](respondWithResult(_0x126832,null))['catch'](handleError(_0x126832,null));};exports['getVoiceQueuesRt']=function(_0x3bdcfd,_0x2ef132,_0x52520a){var _0x4ba802={};var _0x588d9d={};var _0x1bccfe;var _0x40d6b4;return db['User'][_0xde5a('0xa7')]({'where':{'id':_0x3bdcfd['params']['id']}})[_0xde5a('0x1b')](handleEntityNotFound(_0x2ef132,null))[_0xde5a('0x1b')](function(_0x137ad4){if(_0x137ad4){_0x1bccfe=_0x137ad4;_0x588d9d['model']=_[_0xde5a('0x3a')](db[_0xde5a('0x99')][_0xde5a('0x34')]);_0x588d9d[_0xde5a('0x37')]=_[_0xde5a('0x3a')](_0x3bdcfd[_0xde5a('0x37')]);_0x588d9d['filters']=_[_0xde5a('0x3d')](_0x588d9d['model'],_0x588d9d[_0xde5a('0x37')]);_0x4ba802[_0xde5a('0x3c')]=_['intersection'](_0x588d9d[_0xde5a('0x35')],qs[_0xde5a('0x3e')](_0x3bdcfd[_0xde5a('0x37')][_0xde5a('0x3e')]));_0x4ba802[_0xde5a('0x3c')]=_0x4ba802[_0xde5a('0x3c')][_0xde5a('0x3f')]?_0x4ba802[_0xde5a('0x3c')]:_0x588d9d[_0xde5a('0x35')];_0x4ba802['order']=qs[_0xde5a('0x43')](_0x3bdcfd['query'][_0xde5a('0x43')]);_0x4ba802[_0xde5a('0x48')]=qs['filters'](_[_0xde5a('0x44')](_0x3bdcfd[_0xde5a('0x37')],_0x588d9d[_0xde5a('0x3b')]));if(_0x3bdcfd[_0xde5a('0x37')][_0xde5a('0x49')]){_0x4ba802[_0xde5a('0x48')]=_[_0xde5a('0x47')](_0x4ba802[_0xde5a('0x48')],{'$or':_[_0xde5a('0x4a')](_0x4ba802[_0xde5a('0x3c')],function(_0x1efdcc){var _0x1d24bc={};_0x1d24bc[_0x1efdcc]={'$like':'%'+_0x3bdcfd['query'][_0xde5a('0x49')]+'%'};return _0x1d24bc;})});}_0x4ba802=_[_0xde5a('0x47')]({},_0x4ba802,_0x3bdcfd['options']);return _0x1bccfe['getVoiceQueuesRt'](_0x4ba802);}})[_0xde5a('0x1b')](function(_0x193e20){if(_0x193e20){_0x40d6b4=_0x193e20[_0xde5a('0x3f')];if(!_0x3bdcfd['query']['hasOwnProperty']('nolimit')){_0x4ba802['limit']=qs[_0xde5a('0x41')](_0x3bdcfd[_0xde5a('0x37')][_0xde5a('0x41')]);_0x4ba802[_0xde5a('0x29')]=qs[_0xde5a('0x29')](_0x3bdcfd['query'][_0xde5a('0x29')]);}return _0x1bccfe[_0xde5a('0xb4')](_0x4ba802);}})[_0xde5a('0x1b')](function(_0x3fdc7c){if(_0x3fdc7c){return _0x3fdc7c?{'count':_0x40d6b4,'rows':_0x3fdc7c}:null;}})[_0xde5a('0x1b')](respondWithResult(_0x2ef132,null))['catch'](handleError(_0x2ef132,null));};exports[_0xde5a('0xb5')]=function(_0x1a4bc6,_0x4994da,_0x20de0e){var _0x74c249={};var _0x3cb4c2={};var _0x25732d;var _0x56fc40;return db[_0xde5a('0x33')][_0xde5a('0xa7')]({'where':{'id':_0x1a4bc6['params']['id']}})[_0xde5a('0x1b')](handleEntityNotFound(_0x4994da,null))['then'](function(_0x4a8a03){if(_0x4a8a03){_0x25732d=_0x4a8a03;_0x3cb4c2[_0xde5a('0x35')]=_['keys'](db['ChatGroup'][_0xde5a('0x34')]);_0x3cb4c2[_0xde5a('0x37')]=_[_0xde5a('0x3a')](_0x1a4bc6['query']);_0x3cb4c2[_0xde5a('0x3b')]=_[_0xde5a('0x3d')](_0x3cb4c2[_0xde5a('0x35')],_0x3cb4c2[_0xde5a('0x37')]);_0x74c249[_0xde5a('0x3c')]=_['intersection'](_0x3cb4c2['model'],qs[_0xde5a('0x3e')](_0x1a4bc6[_0xde5a('0x37')][_0xde5a('0x3e')]));_0x74c249[_0xde5a('0x3c')]=_0x74c249[_0xde5a('0x3c')][_0xde5a('0x3f')]?_0x74c249[_0xde5a('0x3c')]:_0x3cb4c2['model'];_0x74c249[_0xde5a('0x42')]=qs['sort'](_0x1a4bc6[_0xde5a('0x37')][_0xde5a('0x43')]);_0x74c249[_0xde5a('0x48')]=qs[_0xde5a('0x3b')](_['pick'](_0x1a4bc6['query'],_0x3cb4c2[_0xde5a('0x3b')]));if(_0x1a4bc6[_0xde5a('0x37')][_0xde5a('0x49')]){_0x74c249[_0xde5a('0x48')]=_[_0xde5a('0x47')](_0x74c249['where'],{'$or':_[_0xde5a('0x4a')](_0x74c249[_0xde5a('0x3c')],function(_0x2971a4){var _0xc3611c={};_0xc3611c[_0x2971a4]={'$like':'%'+_0x1a4bc6[_0xde5a('0x37')]['filter']+'%'};return _0xc3611c;})});}_0x74c249=_[_0xde5a('0x47')]({},_0x74c249,_0x1a4bc6['options']);return _0x25732d[_0xde5a('0xb5')](_0x74c249);}})[_0xde5a('0x1b')](function(_0x36241e){if(_0x36241e){_0x56fc40=_0x36241e['length'];if(!_0x1a4bc6['query']['hasOwnProperty'](_0xde5a('0x40'))){_0x74c249[_0xde5a('0x41')]=qs[_0xde5a('0x41')](_0x1a4bc6[_0xde5a('0x37')]['limit']);_0x74c249['offset']=qs[_0xde5a('0x29')](_0x1a4bc6[_0xde5a('0x37')][_0xde5a('0x29')]);}return _0x25732d['getGroups'](_0x74c249);}})[_0xde5a('0x1b')](function(_0x301470){if(_0x301470){return _0x301470?{'count':_0x56fc40,'rows':_0x301470}:null;}})[_0xde5a('0x1b')](respondWithResult(_0x4994da,null))['catch'](handleError(_0x4994da,null));};exports[_0xde5a('0xb6')]=function(_0x4482d1,_0x51992c,_0x276e6b){var _0x5aa3f9={'raw':!![],'where':{}};var _0x36c8e8={};var _0xfe2caa={'count':0x0,'rows':[]};return db[_0xde5a('0x33')][_0xde5a('0xa7')]({'where':{'id':_0x4482d1['params']['id']}})['then'](handleEntityNotFound(_0x51992c,null))[_0xde5a('0x1b')](function(_0x143bbc){if(_0x143bbc){_0x36c8e8[_0xde5a('0x35')]=_[_0xde5a('0x3a')](db[_0xde5a('0xb7')][_0xde5a('0x34')]);_0x36c8e8[_0xde5a('0x37')]=_[_0xde5a('0x3a')](_0x4482d1[_0xde5a('0x37')]);_0x36c8e8[_0xde5a('0x3b')]=_['intersection'](_0x36c8e8['model'],_0x36c8e8[_0xde5a('0x37')]);_0x5aa3f9[_0xde5a('0x3c')]=_['intersection'](_0x36c8e8[_0xde5a('0x35')],qs[_0xde5a('0x3e')](_0x4482d1[_0xde5a('0x37')][_0xde5a('0x3e')]));_0x5aa3f9['attributes']=_0x5aa3f9[_0xde5a('0x3c')]['length']?_0x5aa3f9[_0xde5a('0x3c')]:_0x36c8e8[_0xde5a('0x35')];if(!_0x4482d1['query'][_0xde5a('0xae')]('nolimit')){_0x5aa3f9[_0xde5a('0x41')]=qs[_0xde5a('0x41')](_0x4482d1[_0xde5a('0x37')][_0xde5a('0x41')]);_0x5aa3f9[_0xde5a('0x29')]=qs['offset'](_0x4482d1[_0xde5a('0x37')][_0xde5a('0x29')]);}_0x5aa3f9[_0xde5a('0x42')]=qs[_0xde5a('0x43')](_0x4482d1[_0xde5a('0x37')][_0xde5a('0x43')]);_0x5aa3f9[_0xde5a('0x48')]=qs[_0xde5a('0x3b')](_[_0xde5a('0x44')](_0x4482d1['query'],_0x36c8e8[_0xde5a('0x3b')]));_0x5aa3f9['where']['UserId']=_0x143bbc['id'];if(_0x4482d1[_0xde5a('0x37')][_0xde5a('0x49')]){_0x5aa3f9['where']=_['merge'](_0x5aa3f9[_0xde5a('0x48')],{'$or':_[_0xde5a('0x4a')](_0x5aa3f9['attributes'],function(_0x58a5cb){var _0x51f6bc={};_0x51f6bc[_0x58a5cb]={'$like':'%'+_0x4482d1[_0xde5a('0x37')][_0xde5a('0x49')]+'%'};return _0x51f6bc;})});}_0x5aa3f9=_[_0xde5a('0x47')]({},_0x5aa3f9,_0x4482d1[_0xde5a('0x4d')]);return db[_0xde5a('0xb7')][_0xde5a('0x28')]({'where':_0x5aa3f9[_0xde5a('0x48')]})[_0xde5a('0x1b')](function(_0x760931){_0xfe2caa[_0xde5a('0x28')]=_0x760931;if(_0x4482d1[_0xde5a('0x37')][_0xde5a('0x55')]){_0x5aa3f9['include']=[{'all':!![]}];}return db[_0xde5a('0xb7')][_0xde5a('0x4f')](_0x5aa3f9);})[_0xde5a('0x1b')](function(_0x92a63d){_0xfe2caa[_0xde5a('0x50')]=_0x92a63d;return _0xfe2caa;});}})[_0xde5a('0x1b')](respondWithFilteredResult(_0x51992c,_0x5aa3f9))[_0xde5a('0x25')](handleError(_0x51992c,null));};exports[_0xde5a('0xb8')]=function(_0x402309,_0x4bb6fa,_0x203c30){var _0x1ad3ae={};var _0x17e3ba={};var _0xcb26f4;var _0x3d8f70;return db[_0xde5a('0x33')][_0xde5a('0xa7')]({'where':{'id':_0x402309['params']['id']}})[_0xde5a('0x1b')](handleEntityNotFound(_0x4bb6fa,null))[_0xde5a('0x1b')](function(_0x3d00f4){if(_0x3d00f4){_0xcb26f4=_0x3d00f4;_0x17e3ba['model']=_[_0xde5a('0x3a')](db[_0xde5a('0xb9')]['rawAttributes']);_0x17e3ba['query']=_['keys'](_0x402309['query']);_0x17e3ba[_0xde5a('0x3b')]=_[_0xde5a('0x3d')](_0x17e3ba[_0xde5a('0x35')],_0x17e3ba[_0xde5a('0x37')]);_0x1ad3ae[_0xde5a('0x3c')]=_[_0xde5a('0x3d')](_0x17e3ba[_0xde5a('0x35')],qs[_0xde5a('0x3e')](_0x402309[_0xde5a('0x37')][_0xde5a('0x3e')]));_0x1ad3ae[_0xde5a('0x3c')]=_0x1ad3ae[_0xde5a('0x3c')]['length']?_0x1ad3ae[_0xde5a('0x3c')]:_0x17e3ba['model'];_0x1ad3ae[_0xde5a('0x42')]=qs[_0xde5a('0x43')](_0x402309['query']['sort']);_0x1ad3ae['where']=qs['filters'](_[_0xde5a('0x44')](_0x402309[_0xde5a('0x37')],_0x17e3ba[_0xde5a('0x3b')]));if(_0x402309[_0xde5a('0x37')][_0xde5a('0x49')]){_0x1ad3ae[_0xde5a('0x48')]=_[_0xde5a('0x47')](_0x1ad3ae[_0xde5a('0x48')],{'$or':_[_0xde5a('0x4a')](_0x1ad3ae[_0xde5a('0x3c')],function(_0x11f62e){var _0x293c61={};_0x293c61[_0x11f62e]={'$like':'%'+_0x402309[_0xde5a('0x37')][_0xde5a('0x49')]+'%'};return _0x293c61;})});}_0x1ad3ae=_['merge']({},_0x1ad3ae,_0x402309[_0xde5a('0x4d')]);return _0xcb26f4['getChatInteractions'](_0x1ad3ae);}})[_0xde5a('0x1b')](function(_0x4a4c8a){if(_0x4a4c8a){_0x3d8f70=_0x4a4c8a[_0xde5a('0x3f')];if(!_0x402309[_0xde5a('0x37')][_0xde5a('0xae')](_0xde5a('0x40'))){_0x1ad3ae[_0xde5a('0x41')]=qs[_0xde5a('0x41')](_0x402309['query'][_0xde5a('0x41')]);_0x1ad3ae[_0xde5a('0x29')]=qs[_0xde5a('0x29')](_0x402309[_0xde5a('0x37')][_0xde5a('0x29')]);}return _0xcb26f4[_0xde5a('0xb8')](_0x1ad3ae);}})[_0xde5a('0x1b')](function(_0x5e9218){if(_0x5e9218){return _0x5e9218?{'count':_0x3d8f70,'rows':_0x5e9218}:null;}})['then'](respondWithResult(_0x4bb6fa,null))[_0xde5a('0x25')](handleError(_0x4bb6fa,null));};exports[_0xde5a('0xba')]=function(_0x3935e2,_0xa7303c,_0x37b86){var _0x4b674b={};var _0x543dd7={};var _0x37b1c3;var _0x1274cd;return db['User']['findOne']({'where':{'id':_0x3935e2[_0xde5a('0x52')]['id']}})[_0xde5a('0x1b')](handleEntityNotFound(_0xa7303c,null))[_0xde5a('0x1b')](function(_0x450340){if(_0x450340){_0x37b1c3=_0x450340;_0x543dd7['model']=_[_0xde5a('0x3a')](db[_0xde5a('0xbb')]['rawAttributes']);_0x543dd7[_0xde5a('0x37')]=_[_0xde5a('0x3a')](_0x3935e2['query']);_0x543dd7['filters']=_['intersection'](_0x543dd7[_0xde5a('0x35')],_0x543dd7[_0xde5a('0x37')]);_0x4b674b['attributes']=_[_0xde5a('0x3d')](_0x543dd7['model'],qs['fields'](_0x3935e2['query'][_0xde5a('0x3e')]));_0x4b674b[_0xde5a('0x3c')]=_0x4b674b['attributes']['length']?_0x4b674b[_0xde5a('0x3c')]:_0x543dd7['model'];_0x4b674b['order']=qs[_0xde5a('0x43')](_0x3935e2[_0xde5a('0x37')][_0xde5a('0x43')]);_0x4b674b['where']=qs[_0xde5a('0x3b')](_[_0xde5a('0x44')](_0x3935e2[_0xde5a('0x37')],_0x543dd7[_0xde5a('0x3b')]));if(_0x3935e2[_0xde5a('0x37')]['filter']){_0x4b674b[_0xde5a('0x48')]=_['merge'](_0x4b674b[_0xde5a('0x48')],{'$or':_[_0xde5a('0x4a')](_0x4b674b[_0xde5a('0x3c')],function(_0x3dd37e){var _0x46c820={};_0x46c820[_0x3dd37e]={'$like':'%'+_0x3935e2[_0xde5a('0x37')][_0xde5a('0x49')]+'%'};return _0x46c820;})});}_0x4b674b=_[_0xde5a('0x47')]({},_0x4b674b,_0x3935e2['options']);return _0x37b1c3[_0xde5a('0xba')](_0x4b674b);}})[_0xde5a('0x1b')](function(_0x1253c3){if(_0x1253c3){_0x1274cd=_0x1253c3[_0xde5a('0x3f')];if(!_0x3935e2[_0xde5a('0x37')]['hasOwnProperty']('nolimit')){_0x4b674b[_0xde5a('0x41')]=qs[_0xde5a('0x41')](_0x3935e2[_0xde5a('0x37')][_0xde5a('0x41')]);_0x4b674b[_0xde5a('0x29')]=qs[_0xde5a('0x29')](_0x3935e2[_0xde5a('0x37')][_0xde5a('0x29')]);}return _0x37b1c3[_0xde5a('0xba')](_0x4b674b);}})[_0xde5a('0x1b')](function(_0x5d7614){if(_0x5d7614){return _0x5d7614?{'count':_0x1274cd,'rows':_0x5d7614}:null;}})['then'](respondWithResult(_0xa7303c,null))[_0xde5a('0x25')](handleError(_0xa7303c,null));};exports[_0xde5a('0xbc')]=function(_0x5a5bcd,_0x183f82,_0x1ba290){var _0x29d008={'raw':!![],'where':{}};var _0xb14303={};var _0x3beeee={'count':0x0,'rows':[]};return db[_0xde5a('0x33')][_0xde5a('0xa7')]({'where':{'id':_0x5a5bcd[_0xde5a('0x52')]['id']}})['then'](handleEntityNotFound(_0x183f82,null))[_0xde5a('0x1b')](function(_0x163fc4){if(_0x163fc4){_0xb14303[_0xde5a('0x35')]=_['keys'](db[_0xde5a('0xbd')][_0xde5a('0x34')]);_0xb14303[_0xde5a('0x37')]=_[_0xde5a('0x3a')](_0x5a5bcd[_0xde5a('0x37')]);_0xb14303[_0xde5a('0x3b')]=_[_0xde5a('0x3d')](_0xb14303[_0xde5a('0x35')],_0xb14303['query']);_0x29d008[_0xde5a('0x3c')]=_['intersection'](_0xb14303[_0xde5a('0x35')],qs['fields'](_0x5a5bcd[_0xde5a('0x37')]['fields']));_0x29d008[_0xde5a('0x3c')]=_0x29d008['attributes'][_0xde5a('0x3f')]?_0x29d008[_0xde5a('0x3c')]:_0xb14303[_0xde5a('0x35')];if(!_0x5a5bcd[_0xde5a('0x37')][_0xde5a('0xae')](_0xde5a('0x40'))){_0x29d008[_0xde5a('0x41')]=qs[_0xde5a('0x41')](_0x5a5bcd[_0xde5a('0x37')][_0xde5a('0x41')]);_0x29d008['offset']=qs[_0xde5a('0x29')](_0x5a5bcd[_0xde5a('0x37')]['offset']);}_0x29d008['order']=qs[_0xde5a('0x43')](_0x5a5bcd[_0xde5a('0x37')][_0xde5a('0x43')]);_0x29d008['where']=qs[_0xde5a('0x3b')](_[_0xde5a('0x44')](_0x5a5bcd[_0xde5a('0x37')],_0xb14303[_0xde5a('0x3b')]));_0x29d008[_0xde5a('0x48')][_0xde5a('0xbe')]=_0x163fc4['id'];if(_0x5a5bcd[_0xde5a('0x37')][_0xde5a('0x49')]){_0x29d008[_0xde5a('0x48')]=_[_0xde5a('0x47')](_0x29d008[_0xde5a('0x48')],{'$or':_[_0xde5a('0x4a')](_0x29d008['attributes'],function(_0x225790){var _0x1edde9={};_0x1edde9[_0x225790]={'$like':'%'+_0x5a5bcd[_0xde5a('0x37')][_0xde5a('0x49')]+'%'};return _0x1edde9;})});}_0x29d008=_['merge']({},_0x29d008,_0x5a5bcd[_0xde5a('0x4d')]);return db[_0xde5a('0xbd')]['count']({'where':_0x29d008[_0xde5a('0x48')]})['then'](function(_0x301fd6){_0x3beeee['count']=_0x301fd6;if(_0x5a5bcd['query'][_0xde5a('0x55')]){_0x29d008['include']=[{'all':!![]}];}return db[_0xde5a('0xbd')][_0xde5a('0x4f')](_0x29d008);})['then'](function(_0x2ad43f){_0x3beeee[_0xde5a('0x50')]=_0x2ad43f;return _0x3beeee;});}})[_0xde5a('0x1b')](respondWithFilteredResult(_0x183f82,_0x29d008))[_0xde5a('0x25')](handleError(_0x183f82,null));};exports[_0xde5a('0xbf')]=function(_0x2e660c,_0x19315e,_0x154332){var _0x3cb4b9={};var _0x56436b={};var _0x542b80;var _0x3ef83b;return db[_0xde5a('0x33')]['findOne']({'where':{'id':_0x2e660c[_0xde5a('0x52')]['id']}})[_0xde5a('0x1b')](handleEntityNotFound(_0x19315e,null))[_0xde5a('0x1b')](function(_0x2212da){if(_0x2212da){_0x542b80=_0x2212da;_0x56436b[_0xde5a('0x35')]=_[_0xde5a('0x3a')](db[_0xde5a('0xc0')]['rawAttributes']);_0x56436b[_0xde5a('0x37')]=_[_0xde5a('0x3a')](_0x2e660c['query']);_0x56436b[_0xde5a('0x3b')]=_[_0xde5a('0x3d')](_0x56436b['model'],_0x56436b[_0xde5a('0x37')]);_0x3cb4b9[_0xde5a('0x3c')]=_[_0xde5a('0x3d')](_0x56436b['model'],qs[_0xde5a('0x3e')](_0x2e660c[_0xde5a('0x37')][_0xde5a('0x3e')]));_0x3cb4b9['attributes']=_0x3cb4b9['attributes'][_0xde5a('0x3f')]?_0x3cb4b9[_0xde5a('0x3c')]:_0x56436b[_0xde5a('0x35')];_0x3cb4b9[_0xde5a('0x42')]=qs['sort'](_0x2e660c[_0xde5a('0x37')][_0xde5a('0x43')]);_0x3cb4b9[_0xde5a('0x48')]=qs[_0xde5a('0x3b')](_[_0xde5a('0x44')](_0x2e660c[_0xde5a('0x37')],_0x56436b[_0xde5a('0x3b')]));if(_0x2e660c[_0xde5a('0x37')][_0xde5a('0x49')]){_0x3cb4b9[_0xde5a('0x48')]=_['merge'](_0x3cb4b9['where'],{'$or':_[_0xde5a('0x4a')](_0x3cb4b9[_0xde5a('0x3c')],function(_0x5accdc){var _0x1211c2={};_0x1211c2[_0x5accdc]={'$like':'%'+_0x2e660c[_0xde5a('0x37')]['filter']+'%'};return _0x1211c2;})});}_0x3cb4b9=_[_0xde5a('0x47')]({},_0x3cb4b9,_0x2e660c[_0xde5a('0x4d')]);return _0x542b80[_0xde5a('0xbf')](_0x3cb4b9);}})[_0xde5a('0x1b')](function(_0x2f80da){if(_0x2f80da){_0x3ef83b=_0x2f80da[_0xde5a('0x3f')];if(!_0x2e660c[_0xde5a('0x37')][_0xde5a('0xae')](_0xde5a('0x40'))){_0x3cb4b9[_0xde5a('0x41')]=qs['limit'](_0x2e660c[_0xde5a('0x37')][_0xde5a('0x41')]);_0x3cb4b9[_0xde5a('0x29')]=qs[_0xde5a('0x29')](_0x2e660c['query'][_0xde5a('0x29')]);}return _0x542b80[_0xde5a('0xbf')](_0x3cb4b9);}})[_0xde5a('0x1b')](function(_0x2e0aa9){if(_0x2e0aa9){return _0x2e0aa9?{'count':_0x3ef83b,'rows':_0x2e0aa9}:null;}})['then'](respondWithResult(_0x19315e,null))[_0xde5a('0x25')](handleError(_0x19315e,null));};exports[_0xde5a('0xc1')]=function(_0x46ab7e,_0x4e1bdb,_0x4daa25){var _0x2f77ae={};var _0x12729e={};var _0x4a03b3;var _0x23d8f5;return db[_0xde5a('0x33')][_0xde5a('0xa7')]({'where':{'id':_0x46ab7e[_0xde5a('0x52')]['id']}})[_0xde5a('0x1b')](handleEntityNotFound(_0x4e1bdb,null))['then'](function(_0x5df86a){if(_0x5df86a){_0x4a03b3=_0x5df86a;_0x12729e[_0xde5a('0x35')]=_[_0xde5a('0x3a')](db[_0xde5a('0xc2')]['rawAttributes']);_0x12729e[_0xde5a('0x37')]=_['keys'](_0x46ab7e[_0xde5a('0x37')]);_0x12729e[_0xde5a('0x3b')]=_[_0xde5a('0x3d')](_0x12729e['model'],_0x12729e[_0xde5a('0x37')]);_0x2f77ae[_0xde5a('0x3c')]=_['intersection'](_0x12729e[_0xde5a('0x35')],qs[_0xde5a('0x3e')](_0x46ab7e[_0xde5a('0x37')][_0xde5a('0x3e')]));_0x2f77ae[_0xde5a('0x3c')]=_0x2f77ae[_0xde5a('0x3c')]['length']?_0x2f77ae[_0xde5a('0x3c')]:_0x12729e['model'];_0x2f77ae[_0xde5a('0x42')]=qs[_0xde5a('0x43')](_0x46ab7e[_0xde5a('0x37')]['sort']);_0x2f77ae[_0xde5a('0x48')]=qs['filters'](_[_0xde5a('0x44')](_0x46ab7e[_0xde5a('0x37')],_0x12729e[_0xde5a('0x3b')]));if(_0x46ab7e['query']['filter']){_0x2f77ae['where']=_[_0xde5a('0x47')](_0x2f77ae[_0xde5a('0x48')],{'$or':_[_0xde5a('0x4a')](_0x2f77ae[_0xde5a('0x3c')],function(_0x56f2f2){var _0x34ff44={};_0x34ff44[_0x56f2f2]={'$like':'%'+_0x46ab7e[_0xde5a('0x37')]['filter']+'%'};return _0x34ff44;})});}_0x2f77ae=_['merge']({},_0x2f77ae,_0x46ab7e['options']);return _0x4a03b3['getFaxInteractions'](_0x2f77ae);}})[_0xde5a('0x1b')](function(_0x52351d){if(_0x52351d){_0x23d8f5=_0x52351d[_0xde5a('0x3f')];if(!_0x46ab7e['query'][_0xde5a('0xae')]('nolimit')){_0x2f77ae[_0xde5a('0x41')]=qs['limit'](_0x46ab7e[_0xde5a('0x37')][_0xde5a('0x41')]);_0x2f77ae['offset']=qs[_0xde5a('0x29')](_0x46ab7e[_0xde5a('0x37')]['offset']);}return _0x4a03b3[_0xde5a('0xc1')](_0x2f77ae);}})[_0xde5a('0x1b')](function(_0x6bbbae){if(_0x6bbbae){return _0x6bbbae?{'count':_0x23d8f5,'rows':_0x6bbbae}:null;}})['then'](respondWithResult(_0x4e1bdb,null))[_0xde5a('0x25')](handleError(_0x4e1bdb,null));};exports[_0xde5a('0xc3')]=function(_0x434261,_0xbdeeed,_0x102207){var _0x3c5600;var _0x56b10c;var _0x3a5dc8;return db[_0xde5a('0x33')][_0xde5a('0x56')]({'where':{'id':_0x434261[_0xde5a('0x52')]['id'],'role':_0xde5a('0x5e')},'attributes':['id',_0xde5a('0x31'),_0xde5a('0xc4'),'mobile',_0xde5a('0x5d'),_0xde5a('0x69'),'loginInPause']})[_0xde5a('0x1b')](handleEntityNotFound(_0xbdeeed,null))[_0xde5a('0x1b')](function(_0x278544){if(_0x278544){_0x3c5600=_0x278544;if(_0x434261[_0xde5a('0x58')][_0xde5a('0x95')]){_0x3a5dc8=util[_0xde5a('0x96')]('LOCAL/%s@from-sip/n',_0x3c5600[_0x434261[_0xde5a('0x58')][_0xde5a('0x95')]]);}else if(_0x434261['body'][_0xde5a('0xc5')]){_0x3a5dc8=util['format'](_0xde5a('0x97'),_0x434261[_0xde5a('0x58')][_0xde5a('0xc5')]);}else{_0x3a5dc8=util['format']('SIP/%s',_0x3c5600[_0xde5a('0x31')]);}socket['to'](util['format'](_0xde5a('0xc6'),_0x3c5600[_0xde5a('0x31')]))[_0xde5a('0x91')]('user:forcelogout',{'ip':_0x434261[_0xde5a('0xc7')][_0xde5a('0xc8')]||_0x434261['connection']['remoteAddress']||_0x434261[_0xde5a('0xc9')][_0xde5a('0xca')]||_0x434261[_0xde5a('0xcb')][_0xde5a('0xc9')][_0xde5a('0xca')]});return db[_0xde5a('0x99')][_0xde5a('0x2d')]({'where':{'membername':_0x3c5600[_0xde5a('0x31')]},'individualHooks':!![]});}})[_0xde5a('0x1b')](function(_0x13a0ab){if(_0x3c5600){return _0x3c5600['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x40bdf8){var _0x1948bf=[];if(_0x40bdf8){_0x56b10c=_0x40bdf8;if(_0x56b10c['length']){for(var _0x560d77=0x0;_0x560d77<_0x56b10c[_0xde5a('0x3f')];_0x560d77++){_0x1948bf[_0xde5a('0x94')]({'membername':_0x3c5600[_0xde5a('0x31')],'UserId':_0x3c5600['id'],'queue_name':_0x56b10c[_0x560d77][_0xde5a('0x31')],'VoiceQueueId':_0x56b10c[_0x560d77]['id'],'interface':_0x3a5dc8,'paused':_0x3c5600[_0xde5a('0xcc')]||![],'penalty':_0x56b10c[_0x560d77][_0xde5a('0xcd')]||0x0});}return BPromise[_0xde5a('0x98')](_0x1948bf,function(_0x45fad9){return db[_0xde5a('0x99')][_0xde5a('0x9a')](_0x45fad9);});}}})[_0xde5a('0x1b')](function(){return db[_0xde5a('0xce')]['findAll']({'where':{'membername':_0x3c5600[_0xde5a('0x31')],'exitAt':null}});})[_0xde5a('0x1b')](function(_0x43be17){var _0x58879d=[];_0x43be17[_0xde5a('0xcf')](function(_0x95d6d1){_0x58879d[_0xde5a('0x94')](_0x95d6d1[_0xde5a('0x59')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xde5a('0xd0')](_0x58879d);})[_0xde5a('0x1b')](function(){var _0xed6f6a=[];var _0x1123c2=[];var _0x3f17d1=utils[_0xde5a('0xd1')]();var _0x382101={'membername':_0x3c5600[_0xde5a('0x31')],'interface':_0x3a5dc8,'enterAt':moment()[_0xde5a('0x96')](_0xde5a('0xd2')),'role':_0x3c5600['role'],'internal':_0x3c5600[_0xde5a('0x69')]};_0x3f17d1['forEach'](function(_0x2a22f3){_0xed6f6a['push'](_[_0xde5a('0x47')]({'channel':_0x2a22f3,'type':_0xde5a('0xd3'),'data1':_0x434261['body'][_0xde5a('0xd4')],'data2':_0x3a5dc8},_0x382101));if(_0x3c5600[_0xde5a('0xcc')]){_0x1123c2[_0xde5a('0x94')](_[_0xde5a('0x47')]({'channel':_0x2a22f3,'type':'PAUSE','data1':'LOGININPAUSE'},_0x382101));}});return db[_0xde5a('0xce')][_0xde5a('0x57')](_0xed6f6a[_0xde5a('0xd5')](_0x1123c2),{'individualHooks':!![]});})[_0xde5a('0x1b')](function(){return _0x3c5600['update']({'online':!![],'lastLoginAt':moment()[_0xde5a('0x96')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x3c5600['loginInPause']||![],'mailPause':_0x3c5600['loginInPause']||![],'chatPause':_0x3c5600[_0xde5a('0xcc')]||![],'faxPause':_0x3c5600[_0xde5a('0xcc')]||![],'smsPause':_0x3c5600['loginInPause']||![],'openchannelPause':_0x3c5600[_0xde5a('0xcc')]||![],'pauseType':_0x3c5600[_0xde5a('0xcc')]?_0xde5a('0xd6'):null,'interface':_0x3a5dc8,'lastPauseAt':moment()[_0xde5a('0x96')](_0xde5a('0xd2'))});})['then'](respondWithResult(_0xbdeeed,null))[_0xde5a('0x25')](handleError(_0xbdeeed,null));};exports[_0xde5a('0xd7')]=function(_0x2fd91a,_0xf60d4a,_0x7c4759){var _0x291c48;return db['User'][_0xde5a('0x56')]({'where':{'id':_0x2fd91a[_0xde5a('0x52')]['id'],'role':'agent'},'attributes':['id',_0xde5a('0x31'),'role']})[_0xde5a('0x1b')](handleEntityNotFound(_0xf60d4a,null))[_0xde5a('0x1b')](function(_0x2ffa43){if(_0x2ffa43){_0x291c48=_0x2ffa43;return db[_0xde5a('0x99')][_0xde5a('0x2d')]({'where':{'membername':_0x291c48[_0xde5a('0x31')]},'individualHooks':!![]});}})[_0xde5a('0x1b')](function(){return db[_0xde5a('0xce')][_0xde5a('0x4f')]({'where':{'membername':_0x291c48[_0xde5a('0x31')],'exitAt':null}});})[_0xde5a('0x1b')](function(_0xd11ce){var _0x207bad=[];_0xd11ce[_0xde5a('0xcf')](function(_0x23a214){_0x207bad[_0xde5a('0x94')](_0x23a214[_0xde5a('0x59')]({'exitAt':moment()['format'](_0xde5a('0xd2'))}));});return BPromise[_0xde5a('0xd0')](_0x207bad);})[_0xde5a('0x1b')](function(){return _0x291c48[_0xde5a('0x59')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'interface':null});})[_0xde5a('0x1b')](respondWithResult(_0xf60d4a,null))[_0xde5a('0x25')](handleError(_0xf60d4a,null));};exports[_0xde5a('0xd8')]=function(_0x35ae4c,_0x2137b1,_0x406cf2){var _0x2bbbcf;return db[_0xde5a('0x99')][_0xde5a('0x59')]({'paused':0x1},{'where':{'UserId':_0x35ae4c[_0xde5a('0x52')]['id']},'individualHooks':!![]})['then'](function(){return db['User'][_0xde5a('0x56')]({'where':{'id':_0x35ae4c[_0xde5a('0x52')]['id'],'role':_0xde5a('0x5e')},'attributes':['id','name',_0xde5a('0x5d'),'internal','interface']});})[_0xde5a('0x1b')](handleEntityNotFound(_0x2137b1,null))[_0xde5a('0x1b')](function(_0x1a80af){if(_0x1a80af){_0x2bbbcf=_0x1a80af;return respondWithRpcPromise(_0xde5a('0xd9'),_0xde5a('0xd8'),{'id':_0x2bbbcf['id'],'name':_0x2bbbcf[_0xde5a('0x31')],'pause':!![]});}})['then'](function(){if(_0x2bbbcf){return db[_0xde5a('0xce')][_0xde5a('0x4f')]({'where':{'membername':_0x2bbbcf[_0xde5a('0x31')],'type':_0xde5a('0xda'),'exitAt':null}});}})[_0xde5a('0x1b')](function(_0x22bd50){if(_0x22bd50[_0xde5a('0x3f')]){var _0x30d47a=moment()[_0xde5a('0x96')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5db5e6=0x0,_0x3bb1b2=_0x22bd50['length'];_0x5db5e6<_0x3bb1b2;_0x5db5e6++){_0x22bd50[_0x5db5e6][_0xde5a('0xdb')]({'exitAt':_0x30d47a});}}})[_0xde5a('0x1b')](function(){var _0x19d4cb=[];var _0x29ead4=utils[_0xde5a('0xd1')]();_0x29ead4[_0xde5a('0xcf')](function(_0x1b0d2f){_0x19d4cb['push']({'channel':_0x1b0d2f,'membername':_0x2bbbcf['name'],'interface':_[_0xde5a('0x66')](_0x2bbbcf['interface'])?util[_0xde5a('0x96')]('SIP/%s',_0x2bbbcf[_0xde5a('0x31')]):_0x2bbbcf[_0xde5a('0x95')],'type':_0xde5a('0xda'),'enterAt':moment()[_0xde5a('0x96')](_0xde5a('0xd2')),'data1':_0x35ae4c[_0xde5a('0x58')][_0xde5a('0xdc')]||'DEFAULT\x20PAUSE','role':_0x2bbbcf[_0xde5a('0x5d')],'internal':_0x2bbbcf['internal']});});return db[_0xde5a('0xce')][_0xde5a('0x57')](_0x19d4cb,{'individualHooks':!![]});})[_0xde5a('0x1b')](function(){return _0x2bbbcf[_0xde5a('0x59')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x35ae4c['body'][_0xde5a('0xdc')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xde5a('0x96')](_0xde5a('0xd2'))});})[_0xde5a('0x1b')](respondWithResult(_0x2137b1,null))[_0xde5a('0x25')](handleError(_0x2137b1,null));};exports[_0xde5a('0xdd')]=function(_0x424b07,_0x45c2f7,_0x536c82){var _0x14e200;return db[_0xde5a('0x33')][_0xde5a('0x56')]({'where':{'id':_0x424b07[_0xde5a('0x52')]['id']},'attributes':['id',_0xde5a('0x31'),_0xde5a('0x5d'),_0xde5a('0x88'),_0xde5a('0xde'),_0xde5a('0xdf'),_0xde5a('0xe0'),_0xde5a('0xe1'),'smsPause',_0xde5a('0xe2'),'lastPauseAt']})['then'](handleEntityNotFound(_0x45c2f7,null))[_0xde5a('0x1b')](function(_0xfe8bb5){if(_0xfe8bb5){_0x14e200=_0xfe8bb5;if(_0x424b07[_0xde5a('0x58')][_0xde5a('0x89')]&&!utils[_0xde5a('0x9c')](_0x424b07[_0xde5a('0x58')][_0xde5a('0x89')])){throw new db[(_0xde5a('0x7f'))][(_0xde5a('0x80'))]('Unknown\x20channel');}switch(_0x424b07['body']['channel']){case _0xde5a('0x92'):return respondWithRpcPromise(_0xde5a('0xd9'),_0xde5a('0xdd'),{'id':_0x14e200['id'],'name':_0x14e200[_0xde5a('0x31')],'pause':![]})[_0xde5a('0x1b')](function(){return db['UserVoiceQueueRt'][_0xde5a('0x59')]({'paused':0x0},{'where':{'UserId':_0x14e200['id']},'individualHooks':!![]});})['then'](function(){return db[_0xde5a('0xce')]['find']({'where':{'channel':_0x424b07['body'][_0xde5a('0x89')],'membername':_0x14e200[_0xde5a('0x31')],'type':'PAUSE','exitAt':null}});})['then'](function(_0x5c77b0){if(_0x5c77b0){return _0x5c77b0[_0xde5a('0x59')]({'exitAt':moment()[_0xde5a('0x96')](_0xde5a('0xd2')),'data2':_0xde5a('0xe3')},{'individualHooks':!![]});}return null;})[_0xde5a('0x1b')](function(){return _0x14e200[_0xde5a('0x59')]({'voicePause':![]});});case _0xde5a('0xe4'):case _0xde5a('0xe5'):case'fax':case'sms':case _0xde5a('0xe6'):return db['MemberReport'][_0xde5a('0x56')]({'where':{'channel':_0x424b07[_0xde5a('0x58')][_0xde5a('0x89')],'membername':_0x14e200['name'],'type':_0xde5a('0xda'),'exitAt':null}})['then'](function(_0x4fab9e){if(_0x4fab9e){return _0x4fab9e[_0xde5a('0x59')]({'exitAt':moment()[_0xde5a('0x96')](_0xde5a('0xd2')),'data2':_0xde5a('0xe3')},{'individualHooks':!![]});}return null;})[_0xde5a('0x1b')](function(){var _0x1bc264={};_[_0xde5a('0x2a')](_0x1bc264,util[_0xde5a('0x96')](_0xde5a('0xe7'),_0x424b07[_0xde5a('0x58')][_0xde5a('0x89')],'Pause'),![]);return _0x14e200[_0xde5a('0x59')](_0x1bc264);});default:return respondWithRpcPromise(_0xde5a('0xd9'),'unpause',{'id':_0x14e200['id'],'name':_0x14e200[_0xde5a('0x31')],'pause':![]})[_0xde5a('0x1b')](function(){return db[_0xde5a('0x99')][_0xde5a('0x59')]({'paused':0x0},{'where':{'UserId':_0x14e200['id']}});})[_0xde5a('0x1b')](function(){return db[_0xde5a('0xce')]['findAll']({'where':{'membername':_0x14e200[_0xde5a('0x31')],'type':_0xde5a('0xda'),'exitAt':null}});})[_0xde5a('0x1b')](function(_0x18448e){var _0x14d1f1=[];_0x18448e[_0xde5a('0xcf')](function(_0x1fb2a4){_0x14d1f1[_0xde5a('0x94')](_0x1fb2a4['update']({'exitAt':moment()[_0xde5a('0x96')](_0xde5a('0xd2')),'data2':'manual'}));});return BPromise['all'](_0x14d1f1);})[_0xde5a('0x1b')](function(){return _0x14e200[_0xde5a('0x59')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x45c2f7,null))['catch'](handleError(_0x45c2f7,null));};exports[_0xde5a('0xe8')]=function(_0x28de47,_0x20c893,_0x1bc383){var _0x1e6b7a={};var _0x618f02={};var _0x30e7df;var _0x55a91f;return db[_0xde5a('0x33')][_0xde5a('0xa7')]({'where':{'id':_0x28de47['params']['id']}})[_0xde5a('0x1b')](handleEntityNotFound(_0x20c893,null))[_0xde5a('0x1b')](function(_0x2d44c2){if(_0x2d44c2){_0x30e7df=_0x2d44c2;_0x618f02[_0xde5a('0x35')]=_['keys'](db[_0xde5a('0xe9')][_0xde5a('0x34')]);_0x618f02[_0xde5a('0x37')]=_[_0xde5a('0x3a')](_0x28de47[_0xde5a('0x37')]);_0x618f02[_0xde5a('0x3b')]=_[_0xde5a('0x3d')](_0x618f02['model'],_0x618f02['query']);_0x1e6b7a[_0xde5a('0x3c')]=_['intersection'](_0x618f02['model'],qs[_0xde5a('0x3e')](_0x28de47[_0xde5a('0x37')][_0xde5a('0x3e')]));_0x1e6b7a['attributes']=_0x1e6b7a[_0xde5a('0x3c')][_0xde5a('0x3f')]?_0x1e6b7a[_0xde5a('0x3c')]:_0x618f02[_0xde5a('0x35')];_0x1e6b7a[_0xde5a('0x42')]=qs[_0xde5a('0x43')](_0x28de47[_0xde5a('0x37')][_0xde5a('0x43')]);_0x1e6b7a[_0xde5a('0x48')]=qs['filters'](_['pick'](_0x28de47['query'],_0x618f02[_0xde5a('0x3b')]));if(_0x28de47[_0xde5a('0x37')]['filter']){_0x1e6b7a['where']=_[_0xde5a('0x47')](_0x1e6b7a[_0xde5a('0x48')],{'$or':_[_0xde5a('0x4a')](_0x1e6b7a[_0xde5a('0x3c')],function(_0x4df72e){var _0x58ab07={};_0x58ab07[_0x4df72e]={'$like':'%'+_0x28de47[_0xde5a('0x37')][_0xde5a('0x49')]+'%'};return _0x58ab07;})});}_0x1e6b7a=_['merge']({},_0x1e6b7a,_0x28de47['options']);return _0x30e7df[_0xde5a('0xe8')](_0x1e6b7a);}})[_0xde5a('0x1b')](function(_0x54431d){if(_0x54431d){_0x55a91f=_0x54431d['length'];if(!_0x28de47['query'][_0xde5a('0xae')](_0xde5a('0x40'))){_0x1e6b7a[_0xde5a('0x41')]=qs['limit'](_0x28de47[_0xde5a('0x37')][_0xde5a('0x41')]);_0x1e6b7a['offset']=qs['offset'](_0x28de47[_0xde5a('0x37')][_0xde5a('0x29')]);}return _0x30e7df[_0xde5a('0xe8')](_0x1e6b7a);}})['then'](function(_0x26845d){if(_0x26845d){return _0x26845d?{'count':_0x55a91f,'rows':_0x26845d}:null;}})[_0xde5a('0x1b')](respondWithResult(_0x20c893,null))[_0xde5a('0x25')](handleError(_0x20c893,null));};exports[_0xde5a('0xea')]=function(_0x136298,_0x47ae6e,_0x1a2f33){return db[_0xde5a('0x33')][_0xde5a('0x56')]({'where':{'id':_0x136298['params']['id']}})[_0xde5a('0x1b')](handleEntityNotFound(_0x47ae6e,null))[_0xde5a('0x1b')](function(_0x5009bc){if(_0x5009bc){return _0x5009bc[_0xde5a('0xea')](_0x136298['body'][_0xde5a('0x5c')],_[_0xde5a('0xeb')](_0x136298['body'],['ids','id'])||{});}})[_0xde5a('0x1b')](respondWithResult(_0x47ae6e,null))[_0xde5a('0x25')](handleError(_0x47ae6e,null));};exports[_0xde5a('0xec')]=function(_0x15b107,_0x1026a1,_0x2dbc48){var _0xccdf59;return db[_0xde5a('0x33')][_0xde5a('0x56')]({'where':{'id':_0x15b107[_0xde5a('0x52')]['id']}})[_0xde5a('0x1b')](handleEntityNotFound(_0x1026a1,null))['then'](function(_0x52aa5e){if(_0x52aa5e){return _0x52aa5e[_0xde5a('0xec')](_0x15b107[_0xde5a('0x37')]['ids']);}})[_0xde5a('0x1b')](respondWithStatusCode(_0x1026a1,null))[_0xde5a('0x25')](handleError(_0x1026a1,null));};exports[_0xde5a('0xed')]=function(_0x5ada2a,_0x5656e4,_0x1769fe){var _0x5b4d04={};var _0x4e8d93={};var _0x2e869c;var _0x2ebb84;return db[_0xde5a('0x33')][_0xde5a('0xa7')]({'where':{'id':_0x5ada2a['params']['id']}})[_0xde5a('0x1b')](handleEntityNotFound(_0x5656e4,null))[_0xde5a('0x1b')](function(_0x2cf68d){if(_0x2cf68d){_0x2e869c=_0x2cf68d;_0x4e8d93['model']=_['keys'](db['CmList'][_0xde5a('0x34')]);_0x4e8d93[_0xde5a('0x37')]=_['keys'](_0x5ada2a[_0xde5a('0x37')]);_0x4e8d93['filters']=_[_0xde5a('0x3d')](_0x4e8d93[_0xde5a('0x35')],_0x4e8d93[_0xde5a('0x37')]);_0x5b4d04['attributes']=_['intersection'](_0x4e8d93[_0xde5a('0x35')],qs['fields'](_0x5ada2a[_0xde5a('0x37')]['fields']));_0x5b4d04[_0xde5a('0x3c')]=_0x5b4d04[_0xde5a('0x3c')][_0xde5a('0x3f')]?_0x5b4d04[_0xde5a('0x3c')]:_0x4e8d93[_0xde5a('0x35')];_0x5b4d04[_0xde5a('0x42')]=qs['sort'](_0x5ada2a[_0xde5a('0x37')][_0xde5a('0x43')]);_0x5b4d04[_0xde5a('0x48')]=qs[_0xde5a('0x3b')](_[_0xde5a('0x44')](_0x5ada2a[_0xde5a('0x37')],_0x4e8d93['filters']));if(_0x5ada2a['query']['filter']){_0x5b4d04['where']=_[_0xde5a('0x47')](_0x5b4d04['where'],{'$or':_[_0xde5a('0x4a')](_0x5b4d04[_0xde5a('0x3c')],function(_0x1b4968){var _0x491ad8={};_0x491ad8[_0x1b4968]={'$like':'%'+_0x5ada2a[_0xde5a('0x37')][_0xde5a('0x49')]+'%'};return _0x491ad8;})});}_0x5b4d04=_[_0xde5a('0x47')]({},_0x5b4d04,_0x5ada2a[_0xde5a('0x4d')]);return _0x2e869c[_0xde5a('0xed')](_0x5b4d04);}})[_0xde5a('0x1b')](function(_0x3f6e5b){if(_0x3f6e5b){_0x2ebb84=_0x3f6e5b[_0xde5a('0x3f')];if(!_0x5ada2a[_0xde5a('0x37')][_0xde5a('0xae')](_0xde5a('0x40'))){_0x5b4d04[_0xde5a('0x41')]=qs[_0xde5a('0x41')](_0x5ada2a[_0xde5a('0x37')][_0xde5a('0x41')]);_0x5b4d04[_0xde5a('0x29')]=qs['offset'](_0x5ada2a['query'][_0xde5a('0x29')]);}return _0x2e869c[_0xde5a('0xed')](_0x5b4d04);}})['then'](function(_0xac35a4){if(_0xac35a4){return _0xac35a4?{'count':_0x2ebb84,'rows':_0xac35a4}:null;}})[_0xde5a('0x1b')](respondWithResult(_0x5656e4,null))[_0xde5a('0x25')](handleError(_0x5656e4,null));};exports[_0xde5a('0xee')]=function(_0x1bedf8,_0x48ceac,_0x270fb3){var _0x333c88={};var _0xab2a08={};var _0x1e150f;var _0x35a03d;return db[_0xde5a('0x33')][_0xde5a('0xa7')]({'where':{'id':_0x1bedf8[_0xde5a('0x52')]['id']}})[_0xde5a('0x1b')](handleEntityNotFound(_0x48ceac,null))[_0xde5a('0x1b')](function(_0x34d7ab){if(_0x34d7ab){_0x1e150f=_0x34d7ab;_0xab2a08[_0xde5a('0x35')]=_[_0xde5a('0x3a')](db['User'][_0xde5a('0x34')]);_0xab2a08[_0xde5a('0x37')]=_[_0xde5a('0x3a')](_0x1bedf8[_0xde5a('0x37')]);_0xab2a08[_0xde5a('0x3b')]=_['intersection'](_0xab2a08[_0xde5a('0x35')],_0xab2a08['query']);_0x333c88[_0xde5a('0x3c')]=_[_0xde5a('0x3d')](_0xab2a08['model'],qs['fields'](_0x1bedf8[_0xde5a('0x37')]['fields']));_0x333c88[_0xde5a('0x3c')]=_0x333c88[_0xde5a('0x3c')][_0xde5a('0x3f')]?_0x333c88['attributes']:_0xab2a08[_0xde5a('0x35')];_0x333c88[_0xde5a('0x42')]=qs[_0xde5a('0x43')](_0x1bedf8['query'][_0xde5a('0x43')]);_0x333c88[_0xde5a('0x48')]=qs['filters'](_[_0xde5a('0x44')](_0x1bedf8[_0xde5a('0x37')],_0xab2a08['filters']));if(_0x1bedf8['query'][_0xde5a('0x49')]){_0x333c88[_0xde5a('0x48')]=_[_0xde5a('0x47')](_0x333c88[_0xde5a('0x48')],{'$or':_[_0xde5a('0x4a')](_0x333c88[_0xde5a('0x3c')],function(_0x341033){var _0x731a44={};_0x731a44[_0x341033]={'$like':'%'+_0x1bedf8[_0xde5a('0x37')][_0xde5a('0x49')]+'%'};return _0x731a44;})});}_0x333c88[_0xde5a('0x35')]=db[_0xde5a('0x33')];_0x333c88['as']=_0xde5a('0xef');_0x333c88=_[_0xde5a('0x47')]({},_0x333c88,_0x1bedf8[_0xde5a('0x4d')]);return _0x1e150f['getVoiceQueues']({'include':[_0x333c88]});}})[_0xde5a('0x1b')](function(_0xa637aa){if(_0xa637aa){var _0x5b8537={},_0x4b6b7f=[],_0x3043ed=0x0;for(var _0x259587=0x0;_0x259587<_0xa637aa[_0xde5a('0x3f')];_0x259587+=0x1){for(var _0x212e3f=0x0,_0x4f10d7;_0x212e3f<_0xa637aa[_0x259587][_0xde5a('0xef')][_0xde5a('0x3f')];_0x212e3f+=0x1){_0x4f10d7=_0xa637aa[_0x259587][_0xde5a('0xef')][_0x212e3f]['get']({'plain':!![]});_0x5b8537[_0x4f10d7['id']]=_0x4f10d7;}}_0x5b8537=_[_0xde5a('0xf0')](_0x5b8537);for(var _0x5b7758=qs[_0xde5a('0x29')](_0x1bedf8[_0xde5a('0x37')][_0xde5a('0x29')]);_0x5b7758<_0x5b8537['length']&&_0x4b6b7f[_0xde5a('0x3f')]=_0x165fe9[_0xbb10('0x55')]){throw new Error(_0xbb10('0x56'));}})[_0xbb10('0x11')](function(){if(_0xd9e743){return db['UserVoiceQueueRt'][_0xbb10('0x4e')]({'where':{'membername':_0xd9e743[_0xbb10('0x2a')]},'individualHooks':!![]});}})[_0xbb10('0x11')](function(){if(_0xd9e743){return _0xd9e743[_0xbb10('0x57')]({'raw':!![]});}})[_0xbb10('0x11')](function(_0x27f42f){if(_0xd9e743){if(_0x27f42f){var _0x174395=[];_0x3a9677=_0x27f42f;if(_0x3a9677['length']){for(var _0x387b10=0x0;_0x387b10<_0x3a9677[_0xbb10('0x4f')];_0x387b10++){_0x174395[_0xbb10('0x34')](db[_0xbb10('0x2d')][_0xbb10('0x58')]({'membername':_0xd9e743[_0xbb10('0x2a')],'UserId':_0xd9e743['id'],'queue_name':_0x3a9677[_0x387b10][_0xbb10('0x2a')],'VoiceQueueId':_0x3a9677[_0x387b10]['id'],'interface':_0x1ad2ed,'paused':_0xd9e743[_0xbb10('0x51')]||![],'penalty':_0x3a9677[_0x387b10]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xbb10('0x4c')](_0x174395);}}}})[_0xbb10('0x11')](function(){if(_0xd9e743){return db[_0xbb10('0x2e')]['findAll']({'where':{'membername':_0xd9e743['name'],'exitAt':null}});}})['then'](function(_0x23286d){if(_0xd9e743){if(_0x23286d&&_0x23286d['length']){var _0x4e3d6a=[];_0x23286d[_0xbb10('0x33')](function(_0x3ee56b){_0x4e3d6a[_0xbb10('0x34')](_0x3ee56b[_0xbb10('0x44')]({'exitAt':moment()[_0xbb10('0x30')](_0xbb10('0x38'))}));});return BPromise[_0xbb10('0x4c')](_0x4e3d6a);}}})[_0xbb10('0x11')](function(_0x188b97){if(_0xd9e743){var _0x5206e1=[];var _0x318a14=[];var _0x1351eb=utils[_0xbb10('0x32')]();var _0x35b811={'membername':_0xd9e743['name'],'interface':_0x1ad2ed,'enterAt':moment()['format'](_0xbb10('0x38')),'role':_0xd9e743[_0xbb10('0x2b')],'internal':_0xd9e743[_0xbb10('0x3b')]};_0x1351eb[_0xbb10('0x33')](function(_0x5ee705){_0x5206e1[_0xbb10('0x34')](_[_0xbb10('0x59')]({'channel':_0x5ee705,'type':_0xbb10('0x5a'),'data1':_0xbb10('0x5b'),'data2':_0x1ad2ed},_0x35b811));if(_0xd9e743[_0xbb10('0x51')]){_0x318a14['push'](_['merge']({'channel':_0x5ee705,'type':_0xbb10('0x37'),'data1':_0xbb10('0x5c')},_0x35b811));}});return db[_0xbb10('0x2e')]['bulkCreate'](_0x5206e1[_0xbb10('0x5d')](_0x318a14),{'individualHooks':!![]});}})[_0xbb10('0x11')](function(){if(_0xd9e743){return _0xd9e743['update']({'online':!![],'lastLoginAt':moment()['format'](_0xbb10('0x38')),'voicePause':_0xd9e743[_0xbb10('0x51')]||![],'mailPause':_0xd9e743[_0xbb10('0x51')]||![],'chatPause':_0xd9e743['loginInPause']||![],'faxPause':_0xd9e743[_0xbb10('0x51')]||![],'smsPause':_0xd9e743[_0xbb10('0x51')]||![],'openchannelPause':_0xd9e743[_0xbb10('0x51')]||![],'pauseType':_0xd9e743[_0xbb10('0x51')]?_0xbb10('0x5c'):null,'lastPauseAt':moment()[_0xbb10('0x30')](_0xbb10('0x38')),'interface':_0x1ad2ed});}})[_0xbb10('0x11')](function(_0x3e6246){_0x46f462(_0x3e6246);})['catch'](function(_0x3367d4){_0x1b11c0(_0x5cd089[_0xbb10('0x17')](0x1f4,_0x3367d4[_0xbb10('0x1a')]));});});}; \ No newline at end of file +var _0xb10b=['destroy','length','LoginUser','loginInPause','count','agent','../../config/license/util','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./user.socket','register','request','then','info','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','User,\x20%s,\x20%s','message','result','catch','GetUser','User','options','where','attributes','limit','include','map','model','ShowUser','find','raw','PauseUser','name','role','interface','UserVoiceQueueRt','MemberReport','findAll','format','updateAttributes','getChannels','forEach','push','isNil','SIP/%s','PAUSE','YYYY-MM-DD\x20HH:mm:ss','body','DEFAULT\x20PAUSE','internal','uniqueid','bulkCreate','type','UnpauseUser','findOne','channel','isValidChannel','Unknown\x20channel','update','system','chat','fax','sms','openchannel','set','Pause','all','LogoutUser'];(function(_0x2f0177,_0x3421b1){var _0x25d44c=function(_0x1fe9dd){while(--_0x1fe9dd){_0x2f0177['push'](_0x2f0177['shift']());}};_0x25d44c(++_0x3421b1);}(_0xb10b,0x12a));var _0xbb10=function(_0x187842,_0x58331c){_0x187842=_0x187842-0x0;var _0x5dbcf3=_0xb10b[_0x187842];return _0x5dbcf3;};'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')]('User,\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')]('User,\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')]['findAll']({'raw':_0x19f48d[_0xbb10('0x1f')]?_0x19f48d[_0xbb10('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x19f48d['options']?_0x19f48d[_0xbb10('0x1f')][_0xbb10('0x20')]||null:null,'attributes':_0x19f48d[_0xbb10('0x1f')]?_0x19f48d[_0xbb10('0x1f')][_0xbb10('0x21')]||null:null,'limit':_0x19f48d[_0xbb10('0x1f')]?_0x19f48d[_0xbb10('0x1f')][_0xbb10('0x22')]||null:null,'include':_0x19f48d[_0xbb10('0x1f')]?_0x19f48d[_0xbb10('0x1f')][_0xbb10('0x23')]?_[_0xbb10('0x24')](_0x19f48d['options']['include'],function(_0x4fb5e0){return{'model':db[_0x4fb5e0[_0xbb10('0x25')]],'as':_0x4fb5e0['as'],'attributes':_0x4fb5e0[_0xbb10('0x21')],'include':_0x4fb5e0[_0xbb10('0x23')]?_['map'](_0x4fb5e0[_0xbb10('0x23')],function(_0x24d586){return{'model':db[_0x24d586[_0xbb10('0x25')]],'as':_0x24d586['as'],'attributes':_0x24d586[_0xbb10('0x21')],'include':_0x24d586[_0xbb10('0x23')]?_[_0xbb10('0x24')](_0x24d586[_0xbb10('0x23')],function(_0x4aabb9){return{'model':db[_0x4aabb9[_0xbb10('0x25')]],'as':_0x4aabb9['as'],'attributes':_0x4aabb9[_0xbb10('0x21')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0x11')](function(_0x2e0249){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger['debug'](_0xbb10('0x1d'),_0x19f48d,JSON['stringify'](_0x2e0249));_0x109908(_0x2e0249);})[_0xbb10('0x1c')](function(_0x56f2da){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x56f2da[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x56f2da['message']));});});};exports[_0xbb10('0x26')]=function(_0x34f65e){var _0x4f590d=this;return new Promise(function(_0x359ad4,_0x37dde7){return db[_0xbb10('0x1e')][_0xbb10('0x27')]({'raw':_0x34f65e[_0xbb10('0x1f')]?_0x34f65e[_0xbb10('0x1f')][_0xbb10('0x28')]===undefined?!![]:![]:!![],'where':_0x34f65e['options']?_0x34f65e[_0xbb10('0x1f')][_0xbb10('0x20')]||null:null,'attributes':_0x34f65e[_0xbb10('0x1f')]?_0x34f65e[_0xbb10('0x1f')][_0xbb10('0x21')]||null:null,'include':_0x34f65e[_0xbb10('0x1f')]?_0x34f65e[_0xbb10('0x1f')][_0xbb10('0x23')]?_[_0xbb10('0x24')](_0x34f65e['options'][_0xbb10('0x23')],function(_0x150107){return{'model':db[_0x150107[_0xbb10('0x25')]],'as':_0x150107['as'],'attributes':_0x150107[_0xbb10('0x21')],'include':_0x150107['include']?_[_0xbb10('0x24')](_0x150107['include'],function(_0x4e2754){return{'model':db[_0x4e2754[_0xbb10('0x25')]],'as':_0x4e2754['as'],'attributes':_0x4e2754[_0xbb10('0x21')],'include':_0x4e2754[_0xbb10('0x23')]?_[_0xbb10('0x24')](_0x4e2754[_0xbb10('0x23')],function(_0x29d11a){return{'model':db[_0x29d11a['model']],'as':_0x29d11a['as'],'attributes':_0x29d11a[_0xbb10('0x21')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0x11')](function(_0x52de31){logger['info']('ShowUser',_0x34f65e);logger[_0xbb10('0x14')](_0xbb10('0x26'),_0x34f65e,JSON[_0xbb10('0x16')](_0x52de31));_0x359ad4(_0x52de31);})['catch'](function(_0x3c0cd7){logger[_0xbb10('0x17')](_0xbb10('0x26'),_0x3c0cd7['message'],_0x34f65e);_0x37dde7(_0x4f590d[_0xbb10('0x17')](0x1f4,_0x3c0cd7[_0xbb10('0x1a')]));});});};exports[_0xbb10('0x29')]=function(_0x446f49){var _0x4f1cdd=this;return new Promise(function(_0xd238e9,_0x110eb5){var _0x5835fd;return db[_0xbb10('0x1e')][_0xbb10('0x27')]({'where':_0x446f49[_0xbb10('0x1f')][_0xbb10('0x20')]||{},'attributes':['id',_0xbb10('0x2a'),_0xbb10('0x2b'),'internal',_0xbb10('0x2c')]})[_0xbb10('0x11')](function(_0x3e7b4c){if(_0x3e7b4c){_0x5835fd=_0x3e7b4c;return db[_0xbb10('0x2d')]['update']({'paused':0x1},{'where':{'UserId':_0x5835fd['id']},'individualHooks':!![]});}})[_0xbb10('0x11')](function(){if(_0x5835fd){return db[_0xbb10('0x2e')][_0xbb10('0x2f')]({'where':{'membername':_0x5835fd[_0xbb10('0x2a')],'type':'PAUSE','exitAt':null}});}})[_0xbb10('0x11')](function(_0x202c60){if(_0x5835fd){if(_0x202c60&&_0x202c60['length']){var _0x5d9a4f=moment()[_0xbb10('0x30')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x318984=0x0,_0x180933=_0x202c60['length'];_0x318984<_0x180933;_0x318984++){_0x202c60[_0x318984][_0xbb10('0x31')]({'exitAt':_0x5d9a4f});}}}})[_0xbb10('0x11')](function(){if(_0x5835fd){var _0x474e99=[];var _0x5cf4f8=utils[_0xbb10('0x32')]();_0x5cf4f8[_0xbb10('0x33')](function(_0x3b9fdf){_0x474e99[_0xbb10('0x34')]({'channel':_0x3b9fdf,'membername':_0x5835fd[_0xbb10('0x2a')],'interface':_[_0xbb10('0x35')](_0x5835fd[_0xbb10('0x2c')])?util[_0xbb10('0x30')](_0xbb10('0x36'),_0x5835fd[_0xbb10('0x2a')]):_0x5835fd[_0xbb10('0x2c')],'type':_0xbb10('0x37'),'enterAt':moment()['format'](_0xbb10('0x38')),'data1':_0x446f49[_0xbb10('0x39')]['type']||_0xbb10('0x3a'),'role':_0x5835fd[_0xbb10('0x2b')],'internal':_0x5835fd[_0xbb10('0x3b')],'uniqueid':_0x446f49[_0xbb10('0x39')][_0xbb10('0x3c')]||null});});return db[_0xbb10('0x2e')][_0xbb10('0x3d')](_0x474e99,{'individualHooks':!![]});}})['then'](function(){if(_0x5835fd){return _0x5835fd['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x446f49[_0xbb10('0x39')][_0xbb10('0x3e')]||_0xbb10('0x3a'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xbb10('0x11')](function(_0x34cf4e){_0xd238e9(_0x34cf4e);})[_0xbb10('0x1c')](function(_0xf820fe){_0x110eb5(_0x4f1cdd[_0xbb10('0x17')](0x1f4,_0xf820fe[_0xbb10('0x1a')]));});});};exports[_0xbb10('0x3f')]=function(_0x460788){var _0x2626d8=this;return new Promise(function(_0x3d7e7e,_0x550111){var _0x5eafac;return db[_0xbb10('0x1e')][_0xbb10('0x40')]({'where':_0x460788[_0xbb10('0x1f')][_0xbb10('0x20')]||{},'attributes':['id',_0xbb10('0x2a')]})[_0xbb10('0x11')](function(_0x358e7e){if(_0x358e7e){_0x5eafac=_0x358e7e;if(_0x460788[_0xbb10('0x39')][_0xbb10('0x41')]&&!utils[_0xbb10('0x42')](_0x460788[_0xbb10('0x39')][_0xbb10('0x41')])){throw new Error(_0xbb10('0x43'));}switch(_0x460788[_0xbb10('0x39')][_0xbb10('0x41')]){case'voice':return db[_0xbb10('0x2d')]['update']({'paused':0x0},{'where':{'UserId':_0x5eafac['id']}})[_0xbb10('0x11')](function(){return db[_0xbb10('0x2e')][_0xbb10('0x27')]({'where':{'channel':_0x460788[_0xbb10('0x39')][_0xbb10('0x41')],'membername':_0x5eafac[_0xbb10('0x2a')],'type':_0xbb10('0x37'),'exitAt':null}});})[_0xbb10('0x11')](function(_0x180400){if(_0x180400){return _0x180400[_0xbb10('0x44')]({'exitAt':moment()[_0xbb10('0x30')](_0xbb10('0x38')),'data2':_0xbb10('0x45')},{'individualHooks':!![]});}return null;})[_0xbb10('0x11')](function(){return _0x5eafac[_0xbb10('0x44')]({'voicePause':![]});});case'mail':case _0xbb10('0x46'):case _0xbb10('0x47'):case _0xbb10('0x48'):case _0xbb10('0x49'):return db[_0xbb10('0x2e')][_0xbb10('0x27')]({'where':{'channel':_0x460788['body'][_0xbb10('0x41')],'membername':_0x5eafac[_0xbb10('0x2a')],'type':_0xbb10('0x37'),'exitAt':null}})[_0xbb10('0x11')](function(_0x432728){return _0x432728[_0xbb10('0x44')]({'exitAt':moment()[_0xbb10('0x30')](_0xbb10('0x38')),'data2':_0xbb10('0x45')},{'individualHooks':!![]});})[_0xbb10('0x11')](function(){var _0x2eb05a={};_[_0xbb10('0x4a')](_0x2eb05a,util[_0xbb10('0x30')]('%s%s',_0x460788['body'][_0xbb10('0x41')],_0xbb10('0x4b')),![]);return _0x5eafac[_0xbb10('0x44')](_0x2eb05a);});default:return db[_0xbb10('0x2d')]['update']({'paused':0x0},{'where':{'UserId':_0x5eafac['id']}})['then'](function(){return db[_0xbb10('0x2e')][_0xbb10('0x2f')]({'where':{'membername':_0x5eafac[_0xbb10('0x2a')],'type':_0xbb10('0x37'),'exitAt':null}});})[_0xbb10('0x11')](function(_0x3e9753){var _0x45c0dc=[];_0x3e9753['forEach'](function(_0x117e84){_0x45c0dc[_0xbb10('0x34')](_0x117e84['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xbb10('0x45')}));});return BPromise[_0xbb10('0x4c')](_0x45c0dc);})[_0xbb10('0x11')](function(){return _0x5eafac['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})['then'](function(_0x5846d1){_0x3d7e7e(_0x5846d1);})[_0xbb10('0x1c')](function(_0x249b33){_0x550111(_0x2626d8[_0xbb10('0x17')](0x1f4,_0x249b33['message']));});});};exports[_0xbb10('0x4d')]=function(_0x13131c){var _0x5a6538=this;return new Promise(function(_0x4a560c,_0x27d7b9){var _0x308896;return db[_0xbb10('0x1e')][_0xbb10('0x40')]({'where':_0x13131c['options'][_0xbb10('0x20')]||{},'attributes':['id',_0xbb10('0x2a')]})[_0xbb10('0x11')](function(_0x5202d7){if(_0x5202d7){_0x308896=_0x5202d7;return db[_0xbb10('0x2d')][_0xbb10('0x4e')]({'where':{'membername':_0x308896[_0xbb10('0x2a')]},'individualHooks':!![]});}})['then'](function(){if(_0x308896){return db[_0xbb10('0x2e')][_0xbb10('0x2f')]({'where':{'membername':_0x308896[_0xbb10('0x2a')],'exitAt':null}});}})[_0xbb10('0x11')](function(_0x5e4a6e){if(_0x308896){if(_0x5e4a6e&&_0x5e4a6e[_0xbb10('0x4f')]){var _0x258e55=[];_0x5e4a6e[_0xbb10('0x33')](function(_0x2d0f4b){_0x258e55['push'](_0x2d0f4b[_0xbb10('0x44')]({'exitAt':moment()[_0xbb10('0x30')](_0xbb10('0x38'))}));});return BPromise[_0xbb10('0x4c')](_0x258e55);}}})[_0xbb10('0x11')](function(){if(_0x308896){return _0x308896[_0xbb10('0x44')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xbb10('0x11')](function(_0x4a30c5){_0x4a560c(_0x4a30c5);})['catch'](function(_0x5acd5e){_0x27d7b9(_0x5a6538[_0xbb10('0x17')](0x1f4,_0x5acd5e[_0xbb10('0x1a')]));});});};exports[_0xbb10('0x50')]=function(_0x5c9afc){var _0x5cd089=this;return new Promise(function(_0x46f462,_0x1b11c0){var _0xd9e743;var _0x3a9677;var _0x260e06;var _0x1ad2ed;return db['User'][_0xbb10('0x40')]({'where':_0x5c9afc[_0xbb10('0x1f')][_0xbb10('0x20')]||{},'attributes':['id',_0xbb10('0x2a'),_0xbb10('0x2b'),'mobile','phone','internal',_0xbb10('0x51'),_0xbb10('0x2c')]})[_0xbb10('0x11')](function(_0x21459e){if(_0x21459e){_0xd9e743=_0x21459e;_0x1ad2ed=_0x5c9afc[_0xbb10('0x39')][_0xbb10('0x2c')]?_0x5c9afc['body'][_0xbb10('0x2c')]:util['format']('SIP/%s',_0xd9e743['name']);return db[_0xbb10('0x1e')][_0xbb10('0x52')]({'where':{'role':_0xbb10('0x53'),'online':!![],'id':{'$ne':_0xd9e743['id']}}});}})[_0xbb10('0x11')](function(_0x5ce94f){if(_0x5ce94f){_0x260e06=_0x5ce94f;return require(_0xbb10('0x54'))['getLicense']();}})['then'](function(_0x165fe9){if(_0x165fe9&&_0x165fe9[_0xbb10('0x55')]&&_0x260e06>=_0x165fe9[_0xbb10('0x55')]){throw new Error(_0xbb10('0x56'));}})[_0xbb10('0x11')](function(){if(_0xd9e743){return db['UserVoiceQueueRt'][_0xbb10('0x4e')]({'where':{'membername':_0xd9e743[_0xbb10('0x2a')]},'individualHooks':!![]});}})[_0xbb10('0x11')](function(){if(_0xd9e743){return _0xd9e743[_0xbb10('0x57')]({'raw':!![]});}})[_0xbb10('0x11')](function(_0x27f42f){if(_0xd9e743){if(_0x27f42f){var _0x174395=[];_0x3a9677=_0x27f42f;if(_0x3a9677['length']){for(var _0x387b10=0x0;_0x387b10<_0x3a9677[_0xbb10('0x4f')];_0x387b10++){_0x174395[_0xbb10('0x34')](db[_0xbb10('0x2d')][_0xbb10('0x58')]({'membername':_0xd9e743[_0xbb10('0x2a')],'UserId':_0xd9e743['id'],'queue_name':_0x3a9677[_0x387b10][_0xbb10('0x2a')],'VoiceQueueId':_0x3a9677[_0x387b10]['id'],'interface':_0x1ad2ed,'paused':_0xd9e743[_0xbb10('0x51')]||![],'penalty':_0x3a9677[_0x387b10]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xbb10('0x4c')](_0x174395);}}}})[_0xbb10('0x11')](function(){if(_0xd9e743){return db[_0xbb10('0x2e')]['findAll']({'where':{'membername':_0xd9e743['name'],'exitAt':null}});}})['then'](function(_0x23286d){if(_0xd9e743){if(_0x23286d&&_0x23286d['length']){var _0x4e3d6a=[];_0x23286d[_0xbb10('0x33')](function(_0x3ee56b){_0x4e3d6a[_0xbb10('0x34')](_0x3ee56b[_0xbb10('0x44')]({'exitAt':moment()[_0xbb10('0x30')](_0xbb10('0x38'))}));});return BPromise[_0xbb10('0x4c')](_0x4e3d6a);}}})[_0xbb10('0x11')](function(_0x188b97){if(_0xd9e743){var _0x5206e1=[];var _0x318a14=[];var _0x1351eb=utils[_0xbb10('0x32')]();var _0x35b811={'membername':_0xd9e743['name'],'interface':_0x1ad2ed,'enterAt':moment()['format'](_0xbb10('0x38')),'role':_0xd9e743[_0xbb10('0x2b')],'internal':_0xd9e743[_0xbb10('0x3b')]};_0x1351eb[_0xbb10('0x33')](function(_0x5ee705){_0x5206e1[_0xbb10('0x34')](_[_0xbb10('0x59')]({'channel':_0x5ee705,'type':_0xbb10('0x5a'),'data1':_0xbb10('0x5b'),'data2':_0x1ad2ed},_0x35b811));if(_0xd9e743[_0xbb10('0x51')]){_0x318a14['push'](_['merge']({'channel':_0x5ee705,'type':_0xbb10('0x37'),'data1':_0xbb10('0x5c')},_0x35b811));}});return db[_0xbb10('0x2e')]['bulkCreate'](_0x5206e1[_0xbb10('0x5d')](_0x318a14),{'individualHooks':!![]});}})[_0xbb10('0x11')](function(){if(_0xd9e743){return _0xd9e743['update']({'online':!![],'lastLoginAt':moment()['format'](_0xbb10('0x38')),'voicePause':_0xd9e743[_0xbb10('0x51')]||![],'mailPause':_0xd9e743[_0xbb10('0x51')]||![],'chatPause':_0xd9e743['loginInPause']||![],'faxPause':_0xd9e743[_0xbb10('0x51')]||![],'smsPause':_0xd9e743[_0xbb10('0x51')]||![],'openchannelPause':_0xd9e743[_0xbb10('0x51')]||![],'pauseType':_0xd9e743[_0xbb10('0x51')]?_0xbb10('0x5c'):null,'lastPauseAt':moment()[_0xbb10('0x30')](_0xbb10('0x38')),'interface':_0x1ad2ed});}})[_0xbb10('0x11')](function(_0x3e6246){_0x46f462(_0x3e6246);})['catch'](function(_0x3367d4){_0x1b11c0(_0x5cd089[_0xbb10('0x17')](0x1f4,_0x3367d4[_0xbb10('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index f30dcef..29fb042 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 _0xdda6=['length','user:','./user.events','remove','removeListener','register'];(function(_0xe68bc7,_0x29d7f1){var _0x113019=function(_0x21acb5){while(--_0x21acb5){_0xe68bc7['push'](_0xe68bc7['shift']());}};_0x113019(++_0x29d7f1);}(_0xdda6,0xfe));var _0x6dda=function(_0x2b76c9,_0x46eaee){_0x2b76c9=_0x2b76c9-0x0;var _0x230b98=_0xdda6[_0x2b76c9];return _0x230b98;};'use strict';var UserEvents=require(_0x6dda('0x0'));var events=['save',_0x6dda('0x1'),'update'];function createListener(_0x49a54f,_0x2e3f5f){return function(_0x74b131){_0x2e3f5f['emit'](_0x49a54f,_0x74b131);};}function removeListener(_0x4f08fd,_0x44d91b){return function(){UserEvents[_0x6dda('0x2')](_0x4f08fd,_0x44d91b);};}exports[_0x6dda('0x3')]=function(_0x1f7e10){for(var _0x470392=0x0,_0xf2ca15=events[_0x6dda('0x4')];_0x470392<_0xf2ca15;_0x470392++){var _0x2e3997=events[_0x470392];var _0x11cf76=createListener(_0x6dda('0x5')+_0x2e3997,_0x1f7e10);UserEvents['on'](_0x2e3997,_0x11cf76);}}; \ No newline at end of file +var _0xfc11=['user:','./user.events','save','remove','update','emit','removeListener','length'];(function(_0x4d7a09,_0xba64fa){var _0x5a1bf9=function(_0x120529){while(--_0x120529){_0x4d7a09['push'](_0x4d7a09['shift']());}};_0x5a1bf9(++_0xba64fa);}(_0xfc11,0xe1));var _0x1fc1=function(_0x30626c,_0x32c5ae){_0x30626c=_0x30626c-0x0;var _0x1c251a=_0xfc11[_0x30626c];return _0x1c251a;};'use strict';var UserEvents=require(_0x1fc1('0x0'));var events=[_0x1fc1('0x1'),_0x1fc1('0x2'),_0x1fc1('0x3')];function createListener(_0x503bb0,_0x4db610){return function(_0x51fe80){_0x4db610[_0x1fc1('0x4')](_0x503bb0,_0x51fe80);};}function removeListener(_0x5dd819,_0x4eab23){return function(){UserEvents[_0x1fc1('0x5')](_0x5dd819,_0x4eab23);};}exports['register']=function(_0x586dd2){for(var _0xb33b41=0x0,_0x12cd16=events[_0x1fc1('0x6')];_0xb33b41<_0x12cd16;_0xb33b41++){var _0x2e8230=events[_0xb33b41];var _0x4a16ee=createListener(_0x1fc1('0x7')+_0x2e8230,_0x586dd2);UserEvents['on'](_0x2e8230,_0x4a16ee);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index d5232a6..bf5fd7c 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 _0x0309=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','path','express'];(function(_0x2cd846,_0x1cf265){var _0x1fd13b=function(_0x569215){while(--_0x569215){_0x2cd846['push'](_0x2cd846['shift']());}};_0x1fd13b(++_0x1cf265);}(_0x0309,0x165));var _0x9030=function(_0x170344,_0x2dd75a){_0x170344=_0x170344-0x0;var _0x5d638a=_0x0309[_0x170344];return _0x5d638a;};'use strict';var multer=require(_0x9030('0x0'));var util=require('util');var path=require(_0x9030('0x1'));var timeout=require('connect-timeout');var express=require(_0x9030('0x2'));var router=express[_0x9030('0x3')]();var auth=require(_0x9030('0x4'));var interaction=require(_0x9030('0x5'));var config=require(_0x9030('0x6'));module[_0x9030('0x7')]=router; \ No newline at end of file +var _0x5ff9=['multer','util','connect-timeout','express','../../components/interaction/service'];(function(_0x349b8a,_0x35b021){var _0x1d5645=function(_0x1deb06){while(--_0x1deb06){_0x349b8a['push'](_0x349b8a['shift']());}};_0x1d5645(++_0x35b021);}(_0x5ff9,0xa0));var _0x95ff=function(_0x2c3675,_0x13aaf4){_0x2c3675=_0x2c3675-0x0;var _0x1bf0b2=_0x5ff9[_0x2c3675];return _0x1bf0b2;};'use strict';var multer=require(_0x95ff('0x0'));var util=require(_0x95ff('0x1'));var path=require('path');var timeout=require(_0x95ff('0x2'));var express=require(_0x95ff('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x95ff('0x4'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 28d7101..52e8398 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 _0x3256=['exports','INTEGER'];(function(_0x3b6940,_0xb1bf67){var _0x53dcf6=function(_0x2b57cc){while(--_0x2b57cc){_0x3b6940['push'](_0x3b6940['shift']());}};_0x53dcf6(++_0xb1bf67);}(_0x3256,0x162));var _0x6325=function(_0x47b265,_0xa7bfa0){_0x47b265=_0x47b265-0x0;var _0x1cd848=_0x3256[_0x47b265];return _0x1cd848;};'use strict';var Sequelize=require('sequelize');module[_0x6325('0x0')]={'penalty':{'type':Sequelize[_0x6325('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa4db=['exports','INTEGER','sequelize'];(function(_0x157f2b,_0x1c2078){var _0x44ffd7=function(_0x306ab3){while(--_0x306ab3){_0x157f2b['push'](_0x157f2b['shift']());}};_0x44ffd7(++_0x1c2078);}(_0xa4db,0x1b8));var _0xba4d=function(_0x5c418f,_0x4dfa3d){_0x5c418f=_0x5c418f-0x0;var _0x220371=_0xa4db[_0x5c418f];return _0x220371;};'use strict';var Sequelize=require(_0xba4d('0x0'));module[_0xba4d('0x1')]={'penalty':{'type':Sequelize[_0xba4d('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index fa90e0c..62f17e2 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 _0xac4a=['util','../../config/logger','api','moment','bluebird','exports','UserChatQueue','lodash'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xac4a,0x13f));var _0xaac4=function(_0x649be8,_0x1b184f){_0x649be8=_0x649be8-0x0;var _0x1cb424=_0xac4a[_0x649be8];return _0x1cb424;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var moment=require(_0xaac4('0x4'));var BPromise=require(_0xaac4('0x5'));var rp=require('request-promise');var attributes=require('./userChatQueue.attributes');module[_0xaac4('0x6')]=function(_0x2a5762,_0x32d34c){return _0x2a5762['define'](_0xaac4('0x7'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x777d=['../../config/logger','api','bluebird','request-promise','UserChatQueue','util'];(function(_0x207114,_0x25902e){var _0x14d3b4=function(_0x4f8fe3){while(--_0x4f8fe3){_0x207114['push'](_0x207114['shift']());}};_0x14d3b4(++_0x25902e);}(_0x777d,0xe9));var _0xd777=function(_0x599c94,_0x464f0e){_0x599c94=_0x599c94-0x0;var _0x34e215=_0x777d[_0x599c94];return _0x34e215;};'use strict';var _=require('lodash');var util=require(_0xd777('0x0'));var logger=require(_0xd777('0x1'))(_0xd777('0x2'));var moment=require('moment');var BPromise=require(_0xd777('0x3'));var rp=require(_0xd777('0x4'));var attributes=require('./userChatQueue.attributes');module['exports']=function(_0x514817,_0x40b685){return _0x514817['define'](_0xd777('0x5'),attributes,{'tableName':'user_has_chat_queues','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 05e9c75..f77e2cd 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 _0x676a=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','result','catch','util'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x676a,0x14f));var _0xa676=function(_0x2dc343,_0xf015a2){_0x2dc343=_0x2dc343-0x0;var _0x51eac5=_0x676a[_0x2dc343];return _0x51eac5;};'use strict';var _=require('lodash');var util=require(_0xa676('0x0'));var moment=require(_0xa676('0x1'));var BPromise=require(_0xa676('0x2'));var rs=require(_0xa676('0x3'));var fs=require('fs');var Redis=require(_0xa676('0x4'));var db=require(_0xa676('0x5'))['db'];var utils=require(_0xa676('0x6'));var logger=require(_0xa676('0x7'))('rpc');var config=require(_0xa676('0x8'));var jayson=require(_0xa676('0x9'));var client=jayson[_0xa676('0xa')][_0xa676('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4cc396,_0x553f47,_0x547c03){return new BPromise(function(_0x4b8a9f,_0x24f2f6){return client[_0xa676('0xc')](_0x4cc396,_0x547c03)[_0xa676('0xd')](function(_0x5d3e41){logger[_0xa676('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x553f47,_0xa676('0xf'));logger[_0xa676('0x10')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x553f47,_0xa676('0xf'),JSON[_0xa676('0x11')](_0x5d3e41));if(_0x5d3e41[_0xa676('0x12')]){if(_0x5d3e41[_0xa676('0x12')][_0xa676('0x13')]===0x1f4){logger[_0xa676('0x12')](_0xa676('0x14'),_0x553f47,_0x5d3e41[_0xa676('0x12')][_0xa676('0x15')]);return _0x24f2f6(_0x5d3e41[_0xa676('0x12')]['message']);}logger[_0xa676('0x12')](_0xa676('0x14'),_0x553f47,_0x5d3e41[_0xa676('0x12')]['message']);return _0x4b8a9f(_0x5d3e41['error'][_0xa676('0x15')]);}else{logger[_0xa676('0xe')](_0xa676('0x14'),_0x553f47,_0xa676('0xf'));_0x4b8a9f(_0x5d3e41[_0xa676('0x16')][_0xa676('0x15')]);}})[_0xa676('0x17')](function(_0x2afbb3){logger[_0xa676('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x553f47,_0x2afbb3);_0x24f2f6(_0x2afbb3);});});} \ No newline at end of file +var _0x8ed2=['then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x3ca9d1,_0x23c132){var _0x40df99=function(_0x206498){while(--_0x206498){_0x3ca9d1['push'](_0x3ca9d1['shift']());}};_0x40df99(++_0x23c132);}(_0x8ed2,0x1ee));var _0x28ed=function(_0x3dd1e1,_0xc09b67){_0x3dd1e1=_0x3dd1e1-0x0;var _0x27ce19=_0x8ed2[_0x3dd1e1];return _0x27ce19;};'use strict';var _=require(_0x28ed('0x0'));var util=require(_0x28ed('0x1'));var moment=require('moment');var BPromise=require(_0x28ed('0x2'));var rs=require(_0x28ed('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x28ed('0x4'))['db'];var utils=require(_0x28ed('0x5'));var logger=require('../../config/logger')(_0x28ed('0x6'));var config=require(_0x28ed('0x7'));var jayson=require(_0x28ed('0x8'));var client=jayson[_0x28ed('0x9')][_0x28ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe828f0,_0x2bdf1f,_0x22f88d){return new BPromise(function(_0x2e4217,_0x4e1c98){return client[_0x28ed('0xb')](_0xe828f0,_0x22f88d)[_0x28ed('0xc')](function(_0x14a2ee){logger['info'](_0x28ed('0xd'),_0x2bdf1f,_0x28ed('0xe'));logger[_0x28ed('0xf')](_0x28ed('0x10'),_0x2bdf1f,_0x28ed('0xe'),JSON[_0x28ed('0x11')](_0x14a2ee));if(_0x14a2ee[_0x28ed('0x12')]){if(_0x14a2ee[_0x28ed('0x12')]['code']===0x1f4){logger['error'](_0x28ed('0xd'),_0x2bdf1f,_0x14a2ee[_0x28ed('0x12')][_0x28ed('0x13')]);return _0x4e1c98(_0x14a2ee['error'][_0x28ed('0x13')]);}logger[_0x28ed('0x12')](_0x28ed('0xd'),_0x2bdf1f,_0x14a2ee['error'][_0x28ed('0x13')]);return _0x2e4217(_0x14a2ee[_0x28ed('0x12')][_0x28ed('0x13')]);}else{logger[_0x28ed('0x14')](_0x28ed('0xd'),_0x2bdf1f,_0x28ed('0xe'));_0x2e4217(_0x14a2ee[_0x28ed('0x15')]['message']);}})[_0x28ed('0x16')](function(_0x49e91f){logger[_0x28ed('0x12')](_0x28ed('0xd'),_0x2bdf1f,_0x49e91f);_0x4e1c98(_0x49e91f);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 86bc9b2..bb541f4 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 _0xe714=['../../components/interaction/service','exports','multer','path','connect-timeout','express','Router'];(function(_0x2d79bd,_0x2d5d96){var _0x43d57d=function(_0x41566f){while(--_0x41566f){_0x2d79bd['push'](_0x2d79bd['shift']());}};_0x43d57d(++_0x2d5d96);}(_0xe714,0xe2));var _0x4e71=function(_0xbd31cb,_0x42d76f){_0xbd31cb=_0xbd31cb-0x0;var _0x133185=_0xe714[_0xbd31cb];return _0x133185;};'use strict';var multer=require(_0x4e71('0x0'));var util=require('util');var path=require(_0x4e71('0x1'));var timeout=require(_0x4e71('0x2'));var express=require(_0x4e71('0x3'));var router=express[_0x4e71('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4e71('0x5'));var config=require('../../config/environment');module[_0x4e71('0x6')]=router; \ No newline at end of file +var _0x5fab=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','connect-timeout'];(function(_0x291f8b,_0x3b5591){var _0x275171=function(_0xb33d67){while(--_0xb33d67){_0x291f8b['push'](_0x291f8b['shift']());}};_0x275171(++_0x3b5591);}(_0x5fab,0x177));var _0xb5fa=function(_0x1920ad,_0x4e7462){_0x1920ad=_0x1920ad-0x0;var _0x1024af=_0x5fab[_0x1920ad];return _0x1024af;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var auth=require(_0xb5fa('0x5'));var interaction=require(_0xb5fa('0x6'));var config=require(_0xb5fa('0x7'));module[_0xb5fa('0x8')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 595962f..df6f297 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 _0xc1d8=['sequelize','exports','INTEGER','STRING'];(function(_0x12425a,_0x50536e){var _0x4115f3=function(_0xc7e807){while(--_0xc7e807){_0x12425a['push'](_0x12425a['shift']());}};_0x4115f3(++_0x50536e);}(_0xc1d8,0xec));var _0x8c1d=function(_0x1de85e,_0x5e2ad7){_0x1de85e=_0x1de85e-0x0;var _0x472cbc=_0xc1d8[_0x1de85e];return _0x472cbc;};'use strict';var Sequelize=require(_0x8c1d('0x0'));module[_0x8c1d('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x8c1d('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x8c1d('0x3')]}}; \ No newline at end of file +var _0xa45c=['STRING','sequelize','exports'];(function(_0x21b359,_0x4dc80e){var _0x57b8e7=function(_0x135adb){while(--_0x135adb){_0x21b359['push'](_0x21b359['shift']());}};_0x57b8e7(++_0x4dc80e);}(_0xa45c,0x6d));var _0xca45=function(_0x2539a4,_0x227738){_0x2539a4=_0x2539a4-0x0;var _0x6695e0=_0xa45c[_0x2539a4];return _0x6695e0;};'use strict';var Sequelize=require(_0xca45('0x0'));module[_0xca45('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xca45('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index a53f1f2..31df75f 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 _0x5178=['user_has_fax_queues','util','../../config/logger','api','moment','bluebird','exports','define'];(function(_0x6e915b,_0x1aca16){var _0x80fa60=function(_0x4241eb){while(--_0x4241eb){_0x6e915b['push'](_0x6e915b['shift']());}};_0x80fa60(++_0x1aca16);}(_0x5178,0x171));var _0x8517=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5178[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x8517('0x0'));var logger=require(_0x8517('0x1'))(_0x8517('0x2'));var moment=require(_0x8517('0x3'));var BPromise=require(_0x8517('0x4'));var rp=require('request-promise');var attributes=require('./userFaxQueue.attributes');module[_0x8517('0x5')]=function(_0x221184,_0x4ccd73){return _0x221184[_0x8517('0x6')]('UserFaxQueue',attributes,{'tableName':_0x8517('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d0e=['user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./userFaxQueue.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x5d3e4e,_0xd1bd01){_0x5d3e4e=_0x5d3e4e-0x0;var _0xa08078=_0x8d0e[_0x5d3e4e];return _0xa08078;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var logger=require(_0xe8d0('0x2'))(_0xe8d0('0x3'));var moment=require(_0xe8d0('0x4'));var BPromise=require(_0xe8d0('0x5'));var rp=require(_0xe8d0('0x6'));var attributes=require(_0xe8d0('0x7'));module[_0xe8d0('0x8')]=function(_0x579cb9,_0x39caa6){return _0x579cb9['define']('UserFaxQueue',attributes,{'tableName':_0xe8d0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 3994320..363ae13 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 _0x85b6=['result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','request\x20sent'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0x85b6,0xa3));var _0x685b=function(_0x2de9c0,_0x2ae1f2){_0x2de9c0=_0x2de9c0-0x0;var _0x1c4daa=_0x85b6[_0x2de9c0];return _0x1c4daa;};'use strict';var _=require(_0x685b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x685b('0x1'));var rs=require(_0x685b('0x2'));var fs=require('fs');var Redis=require(_0x685b('0x3'));var db=require(_0x685b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x685b('0x5'))(_0x685b('0x6'));var config=require(_0x685b('0x7'));var jayson=require(_0x685b('0x8'));var client=jayson[_0x685b('0x9')][_0x685b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13bec7,_0x329eaf,_0x1514eb){return new BPromise(function(_0x5a1c81,_0x3ac2c7){return client['request'](_0x13bec7,_0x1514eb)[_0x685b('0xb')](function(_0x4c22bc){logger[_0x685b('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0x329eaf,'request\x20sent');logger[_0x685b('0xd')](_0x685b('0xe'),_0x329eaf,'request\x20sent',JSON[_0x685b('0xf')](_0x4c22bc));if(_0x4c22bc[_0x685b('0x10')]){if(_0x4c22bc[_0x685b('0x10')][_0x685b('0x11')]===0x1f4){logger[_0x685b('0x10')](_0x685b('0x12'),_0x329eaf,_0x4c22bc[_0x685b('0x10')][_0x685b('0x13')]);return _0x3ac2c7(_0x4c22bc[_0x685b('0x10')]['message']);}logger[_0x685b('0x10')](_0x685b('0x12'),_0x329eaf,_0x4c22bc[_0x685b('0x10')]['message']);return _0x5a1c81(_0x4c22bc[_0x685b('0x10')]['message']);}else{logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x329eaf,_0x685b('0x14'));_0x5a1c81(_0x4c22bc[_0x685b('0x15')][_0x685b('0x13')]);}})[_0x685b('0x16')](function(_0x2beda6){logger['error'](_0x685b('0x12'),_0x329eaf,_0x2beda6);_0x3ac2c7(_0x2beda6);});});} \ No newline at end of file +var _0x5463=['jayson/promise','client','http','request','request\x20sent','debug','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x86b92,_0x1941c9){var _0x3719d9=function(_0x2fff4e){while(--_0x2fff4e){_0x86b92['push'](_0x86b92['shift']());}};_0x3719d9(++_0x1941c9);}(_0x5463,0x1db));var _0x3546=function(_0x1c1e12,_0x51f090){_0x1c1e12=_0x1c1e12-0x0;var _0x42055a=_0x5463[_0x1c1e12];return _0x42055a;};'use strict';var _=require(_0x3546('0x0'));var util=require('util');var moment=require(_0x3546('0x1'));var BPromise=require(_0x3546('0x2'));var rs=require(_0x3546('0x3'));var fs=require('fs');var Redis=require(_0x3546('0x4'));var db=require(_0x3546('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3546('0x6'));var config=require(_0x3546('0x7'));var jayson=require(_0x3546('0x8'));var client=jayson[_0x3546('0x9')][_0x3546('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf9b561,_0x434c7b,_0x2b74df){return new BPromise(function(_0x1dd041,_0x47559e){return client[_0x3546('0xb')](_0xf9b561,_0x2b74df)['then'](function(_0xf0f7a0){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x434c7b,_0x3546('0xc'));logger[_0x3546('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x434c7b,_0x3546('0xc'),JSON[_0x3546('0xe')](_0xf0f7a0));if(_0xf0f7a0[_0x3546('0xf')]){if(_0xf0f7a0[_0x3546('0xf')][_0x3546('0x10')]===0x1f4){logger['error'](_0x3546('0x11'),_0x434c7b,_0xf0f7a0['error'][_0x3546('0x12')]);return _0x47559e(_0xf0f7a0[_0x3546('0xf')][_0x3546('0x12')]);}logger[_0x3546('0xf')](_0x3546('0x11'),_0x434c7b,_0xf0f7a0[_0x3546('0xf')]['message']);return _0x1dd041(_0xf0f7a0[_0x3546('0xf')][_0x3546('0x12')]);}else{logger[_0x3546('0x13')](_0x3546('0x11'),_0x434c7b,_0x3546('0xc'));_0x1dd041(_0xf0f7a0[_0x3546('0x14')][_0x3546('0x12')]);}})['catch'](function(_0x5e12bb){logger[_0x3546('0xf')](_0x3546('0x11'),_0x434c7b,_0x5e12bb);_0x47559e(_0x5e12bb);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 3258a70..632cd80 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 _0xa786=['exports','multer','util','path','express','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa786,0x71));var _0x6a78=function(_0x52d3ca,_0x57163b){_0x52d3ca=_0x52d3ca-0x0;var _0x38f5ad=_0xa786[_0x52d3ca];return _0x38f5ad;};'use strict';var multer=require(_0x6a78('0x0'));var util=require(_0x6a78('0x1'));var path=require(_0x6a78('0x2'));var timeout=require('connect-timeout');var express=require(_0x6a78('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6a78('0x4'));var config=require(_0x6a78('0x5'));module[_0x6a78('0x6')]=router; \ No newline at end of file +var _0x68fd=['exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4fb8ff,_0x6a9d12){var _0xbb8175=function(_0x3b7b65){while(--_0x3b7b65){_0x4fb8ff['push'](_0x4fb8ff['shift']());}};_0xbb8175(++_0x6a9d12);}(_0x68fd,0x1e9));var _0xd68f=function(_0x5ea3e4,_0x43a041){_0x5ea3e4=_0x5ea3e4-0x0;var _0x26b561=_0x68fd[_0x5ea3e4];return _0x26b561;};'use strict';var multer=require(_0xd68f('0x0'));var util=require('util');var path=require(_0xd68f('0x1'));var timeout=require(_0xd68f('0x2'));var express=require('express');var router=express[_0xd68f('0x3')]();var auth=require(_0xd68f('0x4'));var interaction=require(_0xd68f('0x5'));var config=require(_0xd68f('0x6'));module[_0xd68f('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index d1fa849..2990f2b 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 _0x167e=['sequelize','exports','INTEGER'];(function(_0x5d86f9,_0x324b1a){var _0x9a0e0d=function(_0x5e81fa){while(--_0x5e81fa){_0x5d86f9['push'](_0x5d86f9['shift']());}};_0x9a0e0d(++_0x324b1a);}(_0x167e,0x19b));var _0xe167=function(_0x3e9d61,_0x1e89e7){_0x3e9d61=_0x3e9d61-0x0;var _0x43691b=_0x167e[_0x3e9d61];return _0x43691b;};'use strict';var Sequelize=require(_0xe167('0x0'));module[_0xe167('0x1')]={'penalty':{'type':Sequelize[_0xe167('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x615c=['sequelize','exports'];(function(_0x5bffa3,_0xa537b7){var _0x5abc94=function(_0x316292){while(--_0x316292){_0x5bffa3['push'](_0x5bffa3['shift']());}};_0x5abc94(++_0xa537b7);}(_0x615c,0xb4));var _0xc615=function(_0xc73b7a,_0x5043d8){_0xc73b7a=_0xc73b7a-0x0;var _0x29b837=_0x615c[_0xc73b7a];return _0x29b837;};'use strict';var Sequelize=require(_0xc615('0x0'));module[_0xc615('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 429b509..10e00ea 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 _0xb846=['lodash','api','moment','bluebird','request-promise','define','UserMailQueue','user_has_mail_queues'];(function(_0x3eebd2,_0x576908){var _0x204d9d=function(_0x1325e5){while(--_0x1325e5){_0x3eebd2['push'](_0x3eebd2['shift']());}};_0x204d9d(++_0x576908);}(_0xb846,0x1d0));var _0x6b84=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb846[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6b84('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6b84('0x1'));var moment=require(_0x6b84('0x2'));var BPromise=require(_0x6b84('0x3'));var rp=require(_0x6b84('0x4'));var attributes=require('./userMailQueue.attributes');module['exports']=function(_0xa68b33,_0x39d119){return _0xa68b33[_0x6b84('0x5')](_0x6b84('0x6'),attributes,{'tableName':_0x6b84('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x531a=['exports','define','user_has_mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./userMailQueue.attributes'];(function(_0x44039a,_0x2ac8a8){var _0x525de5=function(_0x1dc635){while(--_0x1dc635){_0x44039a['push'](_0x44039a['shift']());}};_0x525de5(++_0x2ac8a8);}(_0x531a,0x100));var _0xa531=function(_0x1d3f74,_0x553ddc){_0x1d3f74=_0x1d3f74-0x0;var _0x4bb62d=_0x531a[_0x1d3f74];return _0x4bb62d;};'use strict';var _=require(_0xa531('0x0'));var util=require(_0xa531('0x1'));var logger=require(_0xa531('0x2'))(_0xa531('0x3'));var moment=require(_0xa531('0x4'));var BPromise=require(_0xa531('0x5'));var rp=require(_0xa531('0x6'));var attributes=require(_0xa531('0x7'));module[_0xa531('0x8')]=function(_0x27609d,_0x5b63d7){return _0x27609d[_0xa531('0x9')]('UserMailQueue',attributes,{'tableName':_0xa531('0xa'),'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 99a7df1..37e3717 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 _0x7ab2=['debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x36bab3,_0x19ce33){var _0x2d3989=function(_0x2a4f60){while(--_0x2a4f60){_0x36bab3['push'](_0x36bab3['shift']());}};_0x2d3989(++_0x19ce33);}(_0x7ab2,0x147));var _0x27ab=function(_0x50f1b4,_0x408367){_0x50f1b4=_0x50f1b4-0x0;var _0x2885cc=_0x7ab2[_0x50f1b4];return _0x2885cc;};'use strict';var _=require(_0x27ab('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x27ab('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x27ab('0x2'));var logger=require(_0x27ab('0x3'))(_0x27ab('0x4'));var config=require(_0x27ab('0x5'));var jayson=require(_0x27ab('0x6'));var client=jayson[_0x27ab('0x7')][_0x27ab('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xcd6160,_0x239ba6,_0x2559e6){return new BPromise(function(_0x25d9b8,_0x29a227){return client[_0x27ab('0x9')](_0xcd6160,_0x2559e6)['then'](function(_0x59acfb){logger[_0x27ab('0xa')](_0x27ab('0xb'),_0x239ba6,_0x27ab('0xc'));logger[_0x27ab('0xd')](_0x27ab('0xe'),_0x239ba6,'request\x20sent',JSON[_0x27ab('0xf')](_0x59acfb));if(_0x59acfb[_0x27ab('0x10')]){if(_0x59acfb[_0x27ab('0x10')]['code']===0x1f4){logger[_0x27ab('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x239ba6,_0x59acfb[_0x27ab('0x10')][_0x27ab('0x11')]);return _0x29a227(_0x59acfb[_0x27ab('0x10')][_0x27ab('0x11')]);}logger[_0x27ab('0x10')](_0x27ab('0xb'),_0x239ba6,_0x59acfb[_0x27ab('0x10')][_0x27ab('0x11')]);return _0x25d9b8(_0x59acfb[_0x27ab('0x10')][_0x27ab('0x11')]);}else{logger[_0x27ab('0xa')](_0x27ab('0xb'),_0x239ba6,'request\x20sent');_0x25d9b8(_0x59acfb[_0x27ab('0x12')][_0x27ab('0x11')]);}})[_0x27ab('0x13')](function(_0x3dbd22){logger[_0x27ab('0x10')](_0x27ab('0xb'),_0x239ba6,_0x3dbd22);_0x29a227(_0x3dbd22);});});} \ No newline at end of file +var _0xa7c6=['info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','jayson/promise','http','request','then'];(function(_0x447d04,_0x17d2ce){var _0x36a9e7=function(_0x49aa85){while(--_0x49aa85){_0x447d04['push'](_0x447d04['shift']());}};_0x36a9e7(++_0x17d2ce);}(_0xa7c6,0xb6));var _0x6a7c=function(_0x417ff9,_0x460bb3){_0x417ff9=_0x417ff9-0x0;var _0x1397de=_0xa7c6[_0x417ff9];return _0x1397de;};'use strict';var _=require(_0x6a7c('0x0'));var util=require(_0x6a7c('0x1'));var moment=require('moment');var BPromise=require(_0x6a7c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6a7c('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6a7c('0x4'));var client=jayson['client'][_0x6a7c('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x168d1a,_0x496e21,_0x1f7fd4){return new BPromise(function(_0x510937,_0x254d2c){return client[_0x6a7c('0x6')](_0x168d1a,_0x1f7fd4)[_0x6a7c('0x7')](function(_0x4a6170){logger[_0x6a7c('0x8')](_0x6a7c('0x9'),_0x496e21,_0x6a7c('0xa'));logger[_0x6a7c('0xb')](_0x6a7c('0xc'),_0x496e21,_0x6a7c('0xa'),JSON[_0x6a7c('0xd')](_0x4a6170));if(_0x4a6170[_0x6a7c('0xe')]){if(_0x4a6170[_0x6a7c('0xe')][_0x6a7c('0xf')]===0x1f4){logger[_0x6a7c('0xe')](_0x6a7c('0x9'),_0x496e21,_0x4a6170[_0x6a7c('0xe')][_0x6a7c('0x10')]);return _0x254d2c(_0x4a6170[_0x6a7c('0xe')]['message']);}logger[_0x6a7c('0xe')](_0x6a7c('0x9'),_0x496e21,_0x4a6170[_0x6a7c('0xe')][_0x6a7c('0x10')]);return _0x510937(_0x4a6170['error'][_0x6a7c('0x10')]);}else{logger[_0x6a7c('0x8')](_0x6a7c('0x9'),_0x496e21,_0x6a7c('0xa'));_0x510937(_0x4a6170[_0x6a7c('0x11')]['message']);}})[_0x6a7c('0x12')](function(_0x1261af){logger['error'](_0x6a7c('0x9'),_0x496e21,_0x1261af);_0x254d2c(_0x1261af);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 4ca3c0a..0ccc8bf 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 _0xac6a=['../../config/environment','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x67a5fe,_0x5b1510){var _0x2703c3=function(_0x13ba71){while(--_0x13ba71){_0x67a5fe['push'](_0x67a5fe['shift']());}};_0x2703c3(++_0x5b1510);}(_0xac6a,0xc2));var _0xaac6=function(_0x32f50b,_0x715b84){_0x32f50b=_0x32f50b-0x0;var _0x5f215a=_0xac6a[_0x32f50b];return _0x5f215a;};'use strict';var multer=require(_0xaac6('0x0'));var util=require(_0xaac6('0x1'));var path=require(_0xaac6('0x2'));var timeout=require(_0xaac6('0x3'));var express=require(_0xaac6('0x4'));var router=express['Router']();var auth=require(_0xaac6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaac6('0x6'));module[_0xaac6('0x7')]=router; \ No newline at end of file +var _0x9576=['../../config/environment','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x9576,0x182));var _0x6957=function(_0x16ece6,_0x3e85c6){_0x16ece6=_0x16ece6-0x0;var _0x1d2548=_0x9576[_0x16ece6];return _0x1d2548;};'use strict';var multer=require(_0x6957('0x0'));var util=require(_0x6957('0x1'));var path=require(_0x6957('0x2'));var timeout=require(_0x6957('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x6957('0x4'));var interaction=require(_0x6957('0x5'));var config=require(_0x6957('0x6'));module[_0x6957('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 823b1e1..660dd2e 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 _0x46d3=['exports','INTEGER'];(function(_0x234ae1,_0x42bdd6){var _0x227ba0=function(_0x1f6531){while(--_0x1f6531){_0x234ae1['push'](_0x234ae1['shift']());}};_0x227ba0(++_0x42bdd6);}(_0x46d3,0x74));var _0x346d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x46d3[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x346d('0x0')]={'penalty':{'type':Sequelize[_0x346d('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3e26=['sequelize','exports','INTEGER'];(function(_0x4d1403,_0x2d3614){var _0x5a0b6c=function(_0x4c60fe){while(--_0x4c60fe){_0x4d1403['push'](_0x4d1403['shift']());}};_0x5a0b6c(++_0x2d3614);}(_0x3e26,0x15c));var _0x63e2=function(_0x383a9f,_0x1112a0){_0x383a9f=_0x383a9f-0x0;var _0x1f3dae=_0x3e26[_0x383a9f];return _0x1f3dae;};'use strict';var Sequelize=require(_0x63e2('0x0'));module[_0x63e2('0x1')]={'penalty':{'type':Sequelize[_0x63e2('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 9d18c97..51bf59c 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 _0xa772=['define','user_has_openchannel_queues','util','../../config/logger','api','moment','bluebird','request-promise','./userOpenchannelQueue.attributes'];(function(_0x931081,_0x351467){var _0x5bf54d=function(_0x2bf2ca){while(--_0x2bf2ca){_0x931081['push'](_0x931081['shift']());}};_0x5bf54d(++_0x351467);}(_0xa772,0x1b2));var _0x2a77=function(_0x5ac5d6,_0x51eb3e){_0x5ac5d6=_0x5ac5d6-0x0;var _0x2c8e34=_0xa772[_0x5ac5d6];return _0x2c8e34;};'use strict';var _=require('lodash');var util=require(_0x2a77('0x0'));var logger=require(_0x2a77('0x1'))(_0x2a77('0x2'));var moment=require(_0x2a77('0x3'));var BPromise=require(_0x2a77('0x4'));var rp=require(_0x2a77('0x5'));var attributes=require(_0x2a77('0x6'));module['exports']=function(_0x303d56,_0x2053f8){return _0x303d56[_0x2a77('0x7')]('UserOpenchannelQueue',attributes,{'tableName':_0x2a77('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96cb=['request-promise','./userOpenchannelQueue.attributes','UserOpenchannelQueue','user_has_openchannel_queues','../../config/logger'];(function(_0x59342a,_0x16827b){var _0x17abc9=function(_0x2f7bfc){while(--_0x2f7bfc){_0x59342a['push'](_0x59342a['shift']());}};_0x17abc9(++_0x16827b);}(_0x96cb,0x86));var _0xb96c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x96cb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb96c('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb96c('0x1'));var attributes=require(_0xb96c('0x2'));module['exports']=function(_0x5b6415,_0x580218){return _0x5b6415['define'](_0xb96c('0x3'),attributes,{'tableName':_0xb96c('0x4'),'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 db627cf..8169a8b 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 _0xf687=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserOpenchannelQueue,\x20%s,\x20%s','message','result','lodash','moment','bluebird','ioredis'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0xf687,0x1f4));var _0x7f68=function(_0x1a38de,_0x3d2192){_0x1a38de=_0x1a38de-0x0;var _0x4d4729=_0xf687[_0x1a38de];return _0x4d4729;};'use strict';var _=require(_0x7f68('0x0'));var util=require('util');var moment=require(_0x7f68('0x1'));var BPromise=require(_0x7f68('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f68('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f68('0x4'));var logger=require('../../config/logger')(_0x7f68('0x5'));var config=require(_0x7f68('0x6'));var jayson=require(_0x7f68('0x7'));var client=jayson[_0x7f68('0x8')][_0x7f68('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x361bb3,_0x4b695a,_0x39ed04){return new BPromise(function(_0xed1f0,_0x7de0ed){return client[_0x7f68('0xa')](_0x361bb3,_0x39ed04)[_0x7f68('0xb')](function(_0x229260){logger[_0x7f68('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4b695a,_0x7f68('0xd'));logger[_0x7f68('0xe')](_0x7f68('0xf'),_0x4b695a,_0x7f68('0xd'),JSON[_0x7f68('0x10')](_0x229260));if(_0x229260[_0x7f68('0x11')]){if(_0x229260[_0x7f68('0x11')]['code']===0x1f4){logger[_0x7f68('0x11')](_0x7f68('0x12'),_0x4b695a,_0x229260[_0x7f68('0x11')][_0x7f68('0x13')]);return _0x7de0ed(_0x229260['error']['message']);}logger[_0x7f68('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4b695a,_0x229260['error']['message']);return _0xed1f0(_0x229260[_0x7f68('0x11')][_0x7f68('0x13')]);}else{logger[_0x7f68('0xc')](_0x7f68('0x12'),_0x4b695a,'request\x20sent');_0xed1f0(_0x229260[_0x7f68('0x14')][_0x7f68('0x13')]);}})['catch'](function(_0x132704){logger[_0x7f68('0x11')](_0x7f68('0x12'),_0x4b695a,_0x132704);_0x7de0ed(_0x132704);});});} \ No newline at end of file +var _0x195c=['UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request'];(function(_0x44d129,_0x2f7f0e){var _0x59dc25=function(_0x3f223c){while(--_0x3f223c){_0x44d129['push'](_0x44d129['shift']());}};_0x59dc25(++_0x2f7f0e);}(_0x195c,0x1d1));var _0xc195=function(_0x1cd674,_0x8d3638){_0x1cd674=_0x1cd674-0x0;var _0x27928f=_0x195c[_0x1cd674];return _0x27928f;};'use strict';var _=require(_0xc195('0x0'));var util=require('util');var moment=require(_0xc195('0x1'));var BPromise=require('bluebird');var rs=require(_0xc195('0x2'));var fs=require('fs');var Redis=require(_0xc195('0x3'));var db=require(_0xc195('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc195('0x5'))(_0xc195('0x6'));var config=require('../../config/environment');var jayson=require(_0xc195('0x7'));var client=jayson['client'][_0xc195('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x6cff7a,_0xa88f88,_0x5885bf){return new BPromise(function(_0x511629,_0x2f12fb){return client[_0xc195('0x9')](_0x6cff7a,_0x5885bf)['then'](function(_0x5983b5){logger['info'](_0xc195('0xa'),_0xa88f88,_0xc195('0xb'));logger[_0xc195('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0xa88f88,_0xc195('0xb'),JSON[_0xc195('0xd')](_0x5983b5));if(_0x5983b5['error']){if(_0x5983b5['error'][_0xc195('0xe')]===0x1f4){logger[_0xc195('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0xa88f88,_0x5983b5[_0xc195('0xf')][_0xc195('0x10')]);return _0x2f12fb(_0x5983b5[_0xc195('0xf')][_0xc195('0x10')]);}logger['error'](_0xc195('0xa'),_0xa88f88,_0x5983b5[_0xc195('0xf')][_0xc195('0x10')]);return _0x511629(_0x5983b5[_0xc195('0xf')]['message']);}else{logger['info'](_0xc195('0xa'),_0xa88f88,'request\x20sent');_0x511629(_0x5983b5[_0xc195('0x11')][_0xc195('0x10')]);}})[_0xc195('0x12')](function(_0x53f483){logger[_0xc195('0xf')](_0xc195('0xa'),_0xa88f88,_0x53f483);_0x2f12fb(_0x53f483);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index b72f8df..e014ea8 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 _0xde81=['util','path','connect-timeout','express','Router','../../config/environment','multer'];(function(_0x487eaf,_0x5e09cc){var _0x4e5471=function(_0x8f2447){while(--_0x8f2447){_0x487eaf['push'](_0x487eaf['shift']());}};_0x4e5471(++_0x5e09cc);}(_0xde81,0x109));var _0x1de8=function(_0xb1d702,_0x2267ff){_0xb1d702=_0xb1d702-0x0;var _0x45f1e7=_0xde81[_0xb1d702];return _0x45f1e7;};'use strict';var multer=require(_0x1de8('0x0'));var util=require(_0x1de8('0x1'));var path=require(_0x1de8('0x2'));var timeout=require(_0x1de8('0x3'));var express=require(_0x1de8('0x4'));var router=express[_0x1de8('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1de8('0x6'));module['exports']=router; \ No newline at end of file +var _0xa46e=['connect-timeout','express','Router','../../components/interaction/service','exports','multer','util'];(function(_0x18b344,_0x271f68){var _0x5ef6bb=function(_0x3345b3){while(--_0x3345b3){_0x18b344['push'](_0x18b344['shift']());}};_0x5ef6bb(++_0x271f68);}(_0xa46e,0x8a));var _0xea46=function(_0x280ae7,_0x456fb1){_0x280ae7=_0x280ae7-0x0;var _0x418b9e=_0xa46e[_0x280ae7];return _0x418b9e;};'use strict';var multer=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var path=require('path');var timeout=require(_0xea46('0x2'));var express=require(_0xea46('0x3'));var router=express[_0xea46('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xea46('0x5'));var config=require('../../config/environment');module[_0xea46('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 354996c..252119e 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 _0xa2fb=['sequelize','INTEGER'];(function(_0x47abd0,_0x27e329){var _0x5797d8=function(_0x203343){while(--_0x203343){_0x47abd0['push'](_0x47abd0['shift']());}};_0x5797d8(++_0x27e329);}(_0xa2fb,0x8a));var _0xba2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa2fb[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xba2f('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xba2f('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2b44=['sequelize','exports','INTEGER'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x2b44,0x162));var _0x42b4=function(_0xa35fcf,_0x11dd5f){_0xa35fcf=_0xa35fcf-0x0;var _0x17570a=_0x2b44[_0xa35fcf];return _0x17570a;};'use strict';var Sequelize=require(_0x42b4('0x0'));module[_0x42b4('0x1')]={'penalty':{'type':Sequelize[_0x42b4('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 8768aea..b8fa364 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 _0x4d46=['UserSmsQueue','user_has_sms_queues','util','api','moment','bluebird','request-promise','exports','define'];(function(_0x18a795,_0x4b10cd){var _0xd133d8=function(_0x17e7f2){while(--_0x17e7f2){_0x18a795['push'](_0x18a795['shift']());}};_0xd133d8(++_0x4b10cd);}(_0x4d46,0x119));var _0x64d4=function(_0xa41df9,_0x20fed0){_0xa41df9=_0xa41df9-0x0;var _0x342a45=_0x4d46[_0xa41df9];return _0x342a45;};'use strict';var _=require('lodash');var util=require(_0x64d4('0x0'));var logger=require('../../config/logger')(_0x64d4('0x1'));var moment=require(_0x64d4('0x2'));var BPromise=require(_0x64d4('0x3'));var rp=require(_0x64d4('0x4'));var attributes=require('./userSmsQueue.attributes');module[_0x64d4('0x5')]=function(_0x298b69,_0x2a655c){return _0x298b69[_0x64d4('0x6')](_0x64d4('0x7'),attributes,{'tableName':_0x64d4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ef0=['UserSmsQueue','user_has_sms_queues','../../config/logger','api','moment','bluebird','./userSmsQueue.attributes','exports','define'];(function(_0x43576f,_0x1356ed){var _0x4d2466=function(_0x865deb){while(--_0x865deb){_0x43576f['push'](_0x43576f['shift']());}};_0x4d2466(++_0x1356ed);}(_0x2ef0,0xb6));var _0x02ef=function(_0x3f0dc6,_0x3b8c12){_0x3f0dc6=_0x3f0dc6-0x0;var _0x2a9828=_0x2ef0[_0x3f0dc6];return _0x2a9828;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x02ef('0x0'))(_0x02ef('0x1'));var moment=require(_0x02ef('0x2'));var BPromise=require(_0x02ef('0x3'));var rp=require('request-promise');var attributes=require(_0x02ef('0x4'));module[_0x02ef('0x5')]=function(_0xdb13e5,_0x2e0fcf){return _0xdb13e5[_0x02ef('0x6')](_0x02ef('0x7'),attributes,{'tableName':_0x02ef('0x8'),'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 4b7de67..1310d54 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 _0x42ce=['jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','message','UserSmsQueue,\x20%s,\x20%s','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x5c5cc8,_0x18ad5d){var _0x196bbb=function(_0x2284fc){while(--_0x2284fc){_0x5c5cc8['push'](_0x5c5cc8['shift']());}};_0x196bbb(++_0x18ad5d);}(_0x42ce,0x1c6));var _0xe42c=function(_0x536907,_0x4ef187){_0x536907=_0x536907-0x0;var _0x6d0484=_0x42ce[_0x536907];return _0x6d0484;};'use strict';var _=require(_0xe42c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe42c('0x1'));var rs=require(_0xe42c('0x2'));var fs=require('fs');var Redis=require(_0xe42c('0x3'));var db=require(_0xe42c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe42c('0x5'))(_0xe42c('0x6'));var config=require(_0xe42c('0x7'));var jayson=require(_0xe42c('0x8'));var client=jayson[_0xe42c('0x9')][_0xe42c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3df3eb,_0x570bb3,_0x4c48c6){return new BPromise(function(_0x216d33,_0x5c915e){return client[_0xe42c('0xb')](_0x3df3eb,_0x4c48c6)[_0xe42c('0xc')](function(_0x19fbcf){logger[_0xe42c('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x570bb3,_0xe42c('0xe'));logger[_0xe42c('0xf')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x570bb3,_0xe42c('0xe'),JSON['stringify'](_0x19fbcf));if(_0x19fbcf[_0xe42c('0x10')]){if(_0x19fbcf[_0xe42c('0x10')][_0xe42c('0x11')]===0x1f4){logger[_0xe42c('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x570bb3,_0x19fbcf['error'][_0xe42c('0x12')]);return _0x5c915e(_0x19fbcf[_0xe42c('0x10')][_0xe42c('0x12')]);}logger[_0xe42c('0x10')](_0xe42c('0x13'),_0x570bb3,_0x19fbcf[_0xe42c('0x10')]['message']);return _0x216d33(_0x19fbcf[_0xe42c('0x10')][_0xe42c('0x12')]);}else{logger[_0xe42c('0xd')](_0xe42c('0x13'),_0x570bb3,_0xe42c('0xe'));_0x216d33(_0x19fbcf['result']['message']);}})[_0xe42c('0x14')](function(_0x7b04ea){logger[_0xe42c('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x570bb3,_0x7b04ea);_0x5c915e(_0x7b04ea);});});} \ No newline at end of file +var _0xe70a=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x595cb9,_0x47db3a){var _0x316de8=function(_0x992fe2){while(--_0x992fe2){_0x595cb9['push'](_0x595cb9['shift']());}};_0x316de8(++_0x47db3a);}(_0xe70a,0xfb));var _0xae70=function(_0x56122f,_0x2711f8){_0x56122f=_0x56122f-0x0;var _0x92d496=_0xe70a[_0x56122f];return _0x92d496;};'use strict';var _=require(_0xae70('0x0'));var util=require(_0xae70('0x1'));var moment=require(_0xae70('0x2'));var BPromise=require(_0xae70('0x3'));var rs=require(_0xae70('0x4'));var fs=require('fs');var Redis=require(_0xae70('0x5'));var db=require(_0xae70('0x6'))['db'];var utils=require(_0xae70('0x7'));var logger=require(_0xae70('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xae70('0x9'));var client=jayson[_0xae70('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc903b2,_0x830565,_0x39a3b5){return new BPromise(function(_0x4afb48,_0x3379e1){return client[_0xae70('0xb')](_0xc903b2,_0x39a3b5)[_0xae70('0xc')](function(_0x3b8e4d){logger[_0xae70('0xd')](_0xae70('0xe'),_0x830565,_0xae70('0xf'));logger[_0xae70('0x10')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x830565,_0xae70('0xf'),JSON[_0xae70('0x11')](_0x3b8e4d));if(_0x3b8e4d[_0xae70('0x12')]){if(_0x3b8e4d[_0xae70('0x12')][_0xae70('0x13')]===0x1f4){logger[_0xae70('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x830565,_0x3b8e4d[_0xae70('0x12')][_0xae70('0x14')]);return _0x3379e1(_0x3b8e4d[_0xae70('0x12')]['message']);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x830565,_0x3b8e4d[_0xae70('0x12')][_0xae70('0x14')]);return _0x4afb48(_0x3b8e4d['error'][_0xae70('0x14')]);}else{logger[_0xae70('0xd')](_0xae70('0xe'),_0x830565,_0xae70('0xf'));_0x4afb48(_0x3b8e4d[_0xae70('0x15')][_0xae70('0x14')]);}})[_0xae70('0x16')](function(_0x18c841){logger['error'](_0xae70('0xe'),_0x830565,_0x18c841);_0x3379e1(_0x18c841);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 2bc324f..4ba43cb 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 _0xc14a=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc14a,0xa9));var _0xac14=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc14a[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xac14('0x0'));var util=require(_0xac14('0x1'));var path=require(_0xac14('0x2'));var timeout=require(_0xac14('0x3'));var express=require(_0xac14('0x4'));var router=express['Router']();var auth=require(_0xac14('0x5'));var interaction=require(_0xac14('0x6'));var config=require('../../config/environment');module[_0xac14('0x7')]=router; \ No newline at end of file +var _0x2484=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x2484,0x178));var _0x4248=function(_0x290a36,_0x561046){_0x290a36=_0x290a36-0x0;var _0xc59237=_0x2484[_0x290a36];return _0xc59237;};'use strict';var multer=require(_0x4248('0x0'));var util=require(_0x4248('0x1'));var path=require('path');var timeout=require(_0x4248('0x2'));var express=require(_0x4248('0x3'));var router=express[_0x4248('0x4')]();var auth=require(_0x4248('0x5'));var interaction=require(_0x4248('0x6'));var config=require(_0x4248('0x7'));module[_0x4248('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index ca9d516..9006424 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 _0x567d=['INTEGER','sequelize','exports'];(function(_0x2dc6ac,_0x3ba8ae){var _0xca8c34=function(_0x204676){while(--_0x204676){_0x2dc6ac['push'](_0x2dc6ac['shift']());}};_0xca8c34(++_0x3ba8ae);}(_0x567d,0x100));var _0xd567=function(_0x3da12d,_0x1b9dd5){_0x3da12d=_0x3da12d-0x0;var _0x1b950f=_0x567d[_0x3da12d];return _0x1b950f;};'use strict';var Sequelize=require(_0xd567('0x0'));module[_0xd567('0x1')]={'penalty':{'type':Sequelize[_0xd567('0x2')],'defaultValue':0x0}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index a95e582..ac8c624 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 _0x6437=['request-promise','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','../../config/logger','moment','bluebird'];(function(_0x5788bd,_0x5e28e4){var _0xa2e3d8=function(_0x29397d){while(--_0x29397d){_0x5788bd['push'](_0x5788bd['shift']());}};_0xa2e3d8(++_0x5e28e4);}(_0x6437,0x153));var _0x7643=function(_0x5964d6,_0x1a27ea){_0x5964d6=_0x5964d6-0x0;var _0x43c351=_0x6437[_0x5964d6];return _0x43c351;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7643('0x0'))('api');var moment=require(_0x7643('0x1'));var BPromise=require(_0x7643('0x2'));var rp=require(_0x7643('0x3'));var attributes=require(_0x7643('0x4'));module[_0x7643('0x5')]=function(_0x2eedc3,_0x121d70){return _0x2eedc3[_0x7643('0x6')](_0x7643('0x7'),attributes,{'tableName':_0x7643('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5aa4=['bluebird','request-promise','./userVoiceQueue.attributes','exports','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment'];(function(_0x11673b,_0x3d4cc9){var _0x598586=function(_0x51491b){while(--_0x51491b){_0x11673b['push'](_0x11673b['shift']());}};_0x598586(++_0x3d4cc9);}(_0x5aa4,0xab));var _0x45aa=function(_0x547ff4,_0x416fa1){_0x547ff4=_0x547ff4-0x0;var _0xe41057=_0x5aa4[_0x547ff4];return _0xe41057;};'use strict';var _=require(_0x45aa('0x0'));var util=require(_0x45aa('0x1'));var logger=require(_0x45aa('0x2'))(_0x45aa('0x3'));var moment=require(_0x45aa('0x4'));var BPromise=require(_0x45aa('0x5'));var rp=require(_0x45aa('0x6'));var attributes=require(_0x45aa('0x7'));module[_0x45aa('0x8')]=function(_0x118832,_0x31bee8){return _0x118832['define'](_0x45aa('0x9'),attributes,{'tableName':_0x45aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 92b282e..8596609 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 _0x0624=['UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info'];(function(_0x497839,_0x34da86){var _0x342037=function(_0x17e71d){while(--_0x17e71d){_0x497839['push'](_0x497839['shift']());}};_0x342037(++_0x34da86);}(_0x0624,0x126));var _0x4062=function(_0x32ced4,_0x7104c){_0x32ced4=_0x32ced4-0x0;var _0x238c8c=_0x0624[_0x32ced4];return _0x238c8c;};'use strict';var _=require(_0x4062('0x0'));var util=require(_0x4062('0x1'));var moment=require(_0x4062('0x2'));var BPromise=require(_0x4062('0x3'));var rs=require(_0x4062('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4062('0x5'))['db'];var utils=require(_0x4062('0x6'));var logger=require(_0x4062('0x7'))(_0x4062('0x8'));var config=require(_0x4062('0x9'));var jayson=require(_0x4062('0xa'));var client=jayson[_0x4062('0xb')][_0x4062('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x160f65,_0x549cf2,_0x350895){return new BPromise(function(_0x312c0f,_0x5d500f){return client['request'](_0x160f65,_0x350895)['then'](function(_0x38190f){logger[_0x4062('0xd')](_0x4062('0xe'),_0x549cf2,_0x4062('0xf'));logger['debug'](_0x4062('0x10'),_0x549cf2,_0x4062('0xf'),JSON[_0x4062('0x11')](_0x38190f));if(_0x38190f[_0x4062('0x12')]){if(_0x38190f[_0x4062('0x12')]['code']===0x1f4){logger[_0x4062('0x12')](_0x4062('0xe'),_0x549cf2,_0x38190f['error'][_0x4062('0x13')]);return _0x5d500f(_0x38190f[_0x4062('0x12')][_0x4062('0x13')]);}logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x549cf2,_0x38190f[_0x4062('0x12')]['message']);return _0x312c0f(_0x38190f[_0x4062('0x12')][_0x4062('0x13')]);}else{logger[_0x4062('0xd')](_0x4062('0xe'),_0x549cf2,'request\x20sent');_0x312c0f(_0x38190f[_0x4062('0x14')][_0x4062('0x13')]);}})[_0x4062('0x15')](function(_0x2b4e08){logger[_0x4062('0x12')](_0x4062('0xe'),_0x549cf2,_0x2b4e08);_0x5d500f(_0x2b4e08);});});} \ No newline at end of file +var _0xdf10=['rpc','jayson/promise','client','http','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4f1191,_0x2418af){var _0x32b183=function(_0x1869b2){while(--_0x1869b2){_0x4f1191['push'](_0x4f1191['shift']());}};_0x32b183(++_0x2418af);}(_0xdf10,0x175));var _0x0df1=function(_0xefb43e,_0x44ed3f){_0xefb43e=_0xefb43e-0x0;var _0x2c0303=_0xdf10[_0xefb43e];return _0x2c0303;};'use strict';var _=require(_0x0df1('0x0'));var util=require('util');var moment=require(_0x0df1('0x1'));var BPromise=require('bluebird');var rs=require(_0x0df1('0x2'));var fs=require('fs');var Redis=require(_0x0df1('0x3'));var db=require(_0x0df1('0x4'))['db'];var utils=require(_0x0df1('0x5'));var logger=require(_0x0df1('0x6'))(_0x0df1('0x7'));var config=require('../../config/environment');var jayson=require(_0x0df1('0x8'));var client=jayson[_0x0df1('0x9')][_0x0df1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x398c9c,_0x285205,_0x26b9be){return new BPromise(function(_0x3fcb0d,_0x4f2e0e){return client['request'](_0x398c9c,_0x26b9be)['then'](function(_0x33c6a9){logger['info'](_0x0df1('0xb'),_0x285205,_0x0df1('0xc'));logger[_0x0df1('0xd')](_0x0df1('0xe'),_0x285205,_0x0df1('0xc'),JSON[_0x0df1('0xf')](_0x33c6a9));if(_0x33c6a9[_0x0df1('0x10')]){if(_0x33c6a9[_0x0df1('0x10')]['code']===0x1f4){logger['error'](_0x0df1('0xb'),_0x285205,_0x33c6a9[_0x0df1('0x10')][_0x0df1('0x11')]);return _0x4f2e0e(_0x33c6a9[_0x0df1('0x10')][_0x0df1('0x11')]);}logger[_0x0df1('0x10')](_0x0df1('0xb'),_0x285205,_0x33c6a9[_0x0df1('0x10')][_0x0df1('0x11')]);return _0x3fcb0d(_0x33c6a9[_0x0df1('0x10')][_0x0df1('0x11')]);}else{logger[_0x0df1('0x12')](_0x0df1('0xb'),_0x285205,_0x0df1('0xc'));_0x3fcb0d(_0x33c6a9[_0x0df1('0x13')][_0x0df1('0x11')]);}})['catch'](function(_0x339b91){logger['error'](_0x0df1('0xb'),_0x285205,_0x339b91);_0x4f2e0e(_0x339b91);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 0a058ce..6ef6ae8 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 _0x02a7=['../../components/interaction/service','../../config/environment','exports','util','express','Router','../../components/auth/service'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x02a7,0x7a));var _0x702a=function(_0x9b0599,_0x281041){_0x9b0599=_0x9b0599-0x0;var _0x13ef1a=_0x02a7[_0x9b0599];return _0x13ef1a;};'use strict';var multer=require('multer');var util=require(_0x702a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x702a('0x1'));var router=express[_0x702a('0x2')]();var auth=require(_0x702a('0x3'));var interaction=require(_0x702a('0x4'));var config=require(_0x702a('0x5'));module[_0x702a('0x6')]=router; \ No newline at end of file +var _0xf8af=['../../components/interaction/service','../../config/environment','exports','multer','path','connect-timeout','express','Router'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xf8af,0x8b));var _0xff8a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf8af[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xff8a('0x0'));var util=require('util');var path=require(_0xff8a('0x1'));var timeout=require(_0xff8a('0x2'));var express=require(_0xff8a('0x3'));var router=express[_0xff8a('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xff8a('0x5'));var config=require(_0xff8a('0x6'));module[_0xff8a('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 6f75770..03d0d9d 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 _0x8ce3=['queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x10d341,_0x57ff35){var _0xddc36d=function(_0x1c24f0){while(--_0x1c24f0){_0x10d341['push'](_0x10d341['shift']());}};_0xddc36d(++_0x57ff35);}(_0x8ce3,0xd9));var _0x38ce=function(_0x528fd5,_0x116c22){_0x528fd5=_0x528fd5-0x0;var _0x43f1f8=_0x8ce3[_0x528fd5];return _0x43f1f8;};'use strict';var Sequelize=require(_0x38ce('0x0'));module[_0x38ce('0x1')]={'uniqueid':{'type':Sequelize[_0x38ce('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x38ce('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x38ce('0x3')},'UserId':{'type':Sequelize[_0x38ce('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x38ce('0x4')],'allowNull':![],'unique':_0x38ce('0x5'),'comment':_0x38ce('0x3')},'VoiceQueueId':{'type':Sequelize[_0x38ce('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x38ce('0x4')],'allowNull':![],'unique':_0x38ce('0x5'),'comment':_0x38ce('0x3')},'penalty':{'type':Sequelize[_0x38ce('0x2')](0xb),'defaultValue':0x0,'comment':_0x38ce('0x3')},'paused':{'type':Sequelize[_0x38ce('0x2')](0xb),'defaultValue':0x0,'comment':_0x38ce('0x3')}}; \ No newline at end of file +var _0xe0a0=['INTEGER','Required\x20by\x20Asterisk','queue_interface','STRING','sequelize','exports'];(function(_0xc3804e,_0x5e5938){var _0xd13ff=function(_0x53ccbc){while(--_0x53ccbc){_0xc3804e['push'](_0xc3804e['shift']());}};_0xd13ff(++_0x5e5938);}(_0xe0a0,0x1d2));var _0x0e0a=function(_0x389a31,_0x466596){_0x389a31=_0x389a31-0x0;var _0x1cf542=_0xe0a0[_0x389a31];return _0x1cf542;};'use strict';var Sequelize=require(_0x0e0a('0x0'));module[_0x0e0a('0x1')]={'uniqueid':{'type':Sequelize[_0x0e0a('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x0e0a('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x0e0a('0x3')},'UserId':{'type':Sequelize[_0x0e0a('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0e0a('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x0e0a('0x5')],'allowNull':![],'unique':_0x0e0a('0x4'),'comment':_0x0e0a('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x0e0a('0x3')},'paused':{'type':Sequelize[_0x0e0a('0x2')](0xb),'defaultValue':0x0,'comment':_0x0e0a('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index fa7ec22..f525740 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 _0x9892=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0xe69ab9,_0x31f228){var _0x195f44=function(_0x2ebbf6){while(--_0x2ebbf6){_0xe69ab9['push'](_0xe69ab9['shift']());}};_0x195f44(++_0x31f228);}(_0x9892,0x182));var _0x2989=function(_0x1a2da7,_0x35884e){_0x1a2da7=_0x1a2da7-0x0;var _0x27fc98=_0x9892[_0x1a2da7];return _0x27fc98;};'use strict';var EventEmitter=require(_0x2989('0x0'));var UserVoiceQueueRt=require(_0x2989('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2989('0x2'),'afterUpdate':_0x2989('0x3'),'afterDestroy':_0x2989('0x4')};function emitEvent(_0x593b68){return function(_0x412ee8,_0x1cd7ef,_0x521ce9){UserVoiceQueueRtEvents[_0x2989('0x5')](_0x593b68+':'+_0x412ee8['id'],_0x412ee8);UserVoiceQueueRtEvents[_0x2989('0x5')](_0x593b68,_0x412ee8);_0x521ce9(null);};}for(var e in events){if(events[_0x2989('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x2989('0x7')](e,emitEvent(event));}}module[_0x2989('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x8837=['remove','emit','hasOwnProperty','hook','exports','events','UserVoiceQueueRt','setMaxListeners','save','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8837,0xeb));var _0x7883=function(_0x164ff6,_0x31e0a3){_0x164ff6=_0x164ff6-0x0;var _0x42555a=_0x8837[_0x164ff6];return _0x42555a;};'use strict';var EventEmitter=require(_0x7883('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x7883('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x7883('0x2')](0x0);var events={'afterCreate':_0x7883('0x3'),'afterUpdate':_0x7883('0x4'),'afterDestroy':_0x7883('0x5')};function emitEvent(_0x252f19){return function(_0x1435ae,_0xcb8a1a,_0xa8652e){UserVoiceQueueRtEvents['emit'](_0x252f19+':'+_0x1435ae['id'],_0x1435ae);UserVoiceQueueRtEvents[_0x7883('0x6')](_0x252f19,_0x1435ae);_0xa8652e(null);};}for(var e in events){if(events[_0x7883('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x7883('0x8')](e,emitEvent(event));}}module[_0x7883('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 600a2e1..2cf485a 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 _0x3dfc=['../../config/logger','api','moment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util'];(function(_0x584b87,_0x3542b8){var _0x3e7b7e=function(_0xe8964d){while(--_0xe8964d){_0x584b87['push'](_0x584b87['shift']());}};_0x3e7b7e(++_0x3542b8);}(_0x3dfc,0x184));var _0xc3df=function(_0x2e0763,_0x37e6e4){_0x2e0763=_0x2e0763-0x0;var _0x189643=_0x3dfc[_0x2e0763];return _0x189643;};'use strict';var _=require(_0xc3df('0x0'));var util=require(_0xc3df('0x1'));var logger=require(_0xc3df('0x2'))(_0xc3df('0x3'));var moment=require(_0xc3df('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xc3df('0x5'));module[_0xc3df('0x6')]=function(_0x114c47,_0x2e9728){return _0x114c47[_0xc3df('0x7')](_0xc3df('0x8'),attributes,{'tableName':_0xc3df('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x19e6=['moment','bluebird','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger'];(function(_0x550fb1,_0x165920){var _0x451a4f=function(_0x5eb202){while(--_0x5eb202){_0x550fb1['push'](_0x550fb1['shift']());}};_0x451a4f(++_0x165920);}(_0x19e6,0x133));var _0x619e=function(_0x148b2b,_0x4d617a){_0x148b2b=_0x148b2b-0x0;var _0x119049=_0x19e6[_0x148b2b];return _0x119049;};'use strict';var _=require(_0x619e('0x0'));var util=require(_0x619e('0x1'));var logger=require(_0x619e('0x2'))('api');var moment=require(_0x619e('0x3'));var BPromise=require(_0x619e('0x4'));var rp=require('request-promise');var attributes=require(_0x619e('0x5'));module[_0x619e('0x6')]=function(_0x4e097d,_0x2953b8){return _0x4e097d[_0x619e('0x7')](_0x619e('0x8'),attributes,{'tableName':_0x619e('0x9'),'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 f8dceeb..97b93c3 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 _0x3aad=['`paused`\x20=\x201,\x201,\x20null','debug','GetVoiceQueueRtPauses','lodash','util','moment','randomstring','rpc','../../config/environment','client','http','redis','defaults','./userVoiceQueueRt.socket','register','then','request\x20sent','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','info','result','catch','UserVoiceQueueRt','findAll','options','where','sequelize'];(function(_0x179b53,_0x31f6fe){var _0x38a146=function(_0x33f0c2){while(--_0x33f0c2){_0x179b53['push'](_0x179b53['shift']());}};_0x38a146(++_0x31f6fe);}(_0x3aad,0x111));var _0xd3aa=function(_0x3cf2ef,_0x37754b){_0x3cf2ef=_0x3cf2ef-0x0;var _0x3c3176=_0x3aad[_0x3cf2ef];return _0x3c3176;};'use strict';var _=require(_0xd3aa('0x0'));var util=require(_0xd3aa('0x1'));var moment=require(_0xd3aa('0x2'));var BPromise=require('bluebird');var rs=require(_0xd3aa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd3aa('0x4'));var config=require(_0xd3aa('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xd3aa('0x6')][_0xd3aa('0x7')]({'port':0x232a});config[_0xd3aa('0x8')]=_[_0xd3aa('0x9')](config[_0xd3aa('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd3aa('0xa'))[_0xd3aa('0xb')](socket);function respondWithRpcPromise(_0x3d2925,_0x31b610,_0x3efb79){return new BPromise(function(_0x4ab60a,_0x167299){return client['request'](_0x3d2925,_0x3efb79)[_0xd3aa('0xc')](function(_0x2abeff){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x31b610,_0xd3aa('0xd'));logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x31b610,_0xd3aa('0xd'),JSON[_0xd3aa('0xe')](_0x2abeff));if(_0x2abeff['error']){if(_0x2abeff[_0xd3aa('0xf')][_0xd3aa('0x10')]===0x1f4){logger[_0xd3aa('0xf')](_0xd3aa('0x11'),_0x31b610,_0x2abeff[_0xd3aa('0xf')]['message']);return _0x167299(_0x2abeff[_0xd3aa('0xf')][_0xd3aa('0x12')]);}logger[_0xd3aa('0xf')](_0xd3aa('0x11'),_0x31b610,_0x2abeff[_0xd3aa('0xf')]['message']);return _0x4ab60a(_0x2abeff[_0xd3aa('0xf')][_0xd3aa('0x12')]);}else{logger[_0xd3aa('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x31b610,'request\x20sent');_0x4ab60a(_0x2abeff[_0xd3aa('0x14')][_0xd3aa('0x12')]);}})[_0xd3aa('0x15')](function(_0x3aa47c){logger[_0xd3aa('0xf')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x31b610,_0x3aa47c);_0x167299(_0x3aa47c);});});}exports['GetVoiceQueueRtPauses']=function(_0x2e1d2d){var _0x147280=this;return new Promise(function(_0x5b6419,_0x313620){return db[_0xd3aa('0x16')][_0xd3aa('0x17')]({'raw':_0x2e1d2d[_0xd3aa('0x18')]?_0x2e1d2d[_0xd3aa('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2e1d2d['options']?_0x2e1d2d[_0xd3aa('0x18')][_0xd3aa('0x19')]||null:null,'attributes':[[db[_0xd3aa('0x1a')]['fn']('COUNT',db[_0xd3aa('0x1a')]['fn']('IF',db[_0xd3aa('0x1a')]['literal'](_0xd3aa('0x1b')))),'outboundQueuePauses']]})[_0xd3aa('0xc')](function(_0x14e526){logger['info']('GetVoiceQueueRtPauses',_0x2e1d2d);logger[_0xd3aa('0x1c')]('GetVoiceQueueRtPauses',_0x2e1d2d,JSON[_0xd3aa('0xe')](_0x14e526));_0x5b6419(_0x14e526);})[_0xd3aa('0x15')](function(_0x50be61){logger[_0xd3aa('0xf')](_0xd3aa('0x1d'),_0x50be61[_0xd3aa('0x12')],_0x2e1d2d);_0x313620(_0x147280[_0xd3aa('0xf')](0x1f4,_0x50be61['message']));});});}; \ No newline at end of file +var _0x7855=['options','raw','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','stringify','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll'];(function(_0x5e7a26,_0x2d6ed2){var _0x393c2a=function(_0x505107){while(--_0x505107){_0x5e7a26['push'](_0x5e7a26['shift']());}};_0x393c2a(++_0x2d6ed2);}(_0x7855,0xb8));var _0x5785=function(_0x290330,_0x16b4db){_0x290330=_0x290330-0x0;var _0x2665fe=_0x7855[_0x290330];return _0x2665fe;};'use strict';var _=require(_0x5785('0x0'));var util=require(_0x5785('0x1'));var moment=require('moment');var BPromise=require(_0x5785('0x2'));var rs=require(_0x5785('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5785('0x4'))['db'];var utils=require(_0x5785('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x5785('0x6'));var jayson=require(_0x5785('0x7'));var client=jayson['client'][_0x5785('0x8')]({'port':0x232a});config[_0x5785('0x9')]=_[_0x5785('0xa')](config[_0x5785('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userVoiceQueueRt.socket')[_0x5785('0xb')](socket);function respondWithRpcPromise(_0x5a8e7b,_0x3b9490,_0x3bc55b){return new BPromise(function(_0x173102,_0x19b803){return client[_0x5785('0xc')](_0x5a8e7b,_0x3bc55b)[_0x5785('0xd')](function(_0x416763){logger[_0x5785('0xe')](_0x5785('0xf'),_0x3b9490,'request\x20sent');logger['debug'](_0x5785('0x10'),_0x3b9490,_0x5785('0x11'),JSON['stringify'](_0x416763));if(_0x416763[_0x5785('0x12')]){if(_0x416763[_0x5785('0x12')][_0x5785('0x13')]===0x1f4){logger[_0x5785('0x12')](_0x5785('0xf'),_0x3b9490,_0x416763[_0x5785('0x12')][_0x5785('0x14')]);return _0x19b803(_0x416763[_0x5785('0x12')]['message']);}logger[_0x5785('0x12')](_0x5785('0xf'),_0x3b9490,_0x416763['error'][_0x5785('0x14')]);return _0x173102(_0x416763['error'][_0x5785('0x14')]);}else{logger[_0x5785('0xe')](_0x5785('0xf'),_0x3b9490,_0x5785('0x11'));_0x173102(_0x416763[_0x5785('0x15')][_0x5785('0x14')]);}})[_0x5785('0x16')](function(_0x36038e){logger[_0x5785('0x12')](_0x5785('0xf'),_0x3b9490,_0x36038e);_0x19b803(_0x36038e);});});}exports[_0x5785('0x17')]=function(_0x3faf12){var _0x1fb9b6=this;return new Promise(function(_0x564d11,_0x345b31){return db[_0x5785('0x18')][_0x5785('0x19')]({'raw':_0x3faf12[_0x5785('0x1a')]?_0x3faf12['options'][_0x5785('0x1b')]===undefined?!![]:![]:!![],'where':_0x3faf12['options']?_0x3faf12['options'][_0x5785('0x1c')]||null:null,'attributes':[[db[_0x5785('0x1d')]['fn'](_0x5785('0x1e'),db[_0x5785('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x5785('0x1f')))),_0x5785('0x20')]]})['then'](function(_0x5b81b0){logger['info'](_0x5785('0x17'),_0x3faf12);logger[_0x5785('0x21')](_0x5785('0x17'),_0x3faf12,JSON[_0x5785('0x22')](_0x5b81b0));_0x564d11(_0x5b81b0);})['catch'](function(_0x3638ad){logger[_0x5785('0x12')]('GetVoiceQueueRtPauses',_0x3638ad['message'],_0x3faf12);_0x345b31(_0x1fb9b6['error'](0x1f4,_0x3638ad[_0x5785('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index abeb42d..a5a2330 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 _0xe14b=['removeListener','register','length','./userVoiceQueueRt.events','save','emit'];(function(_0x30fe8c,_0x272cb9){var _0x4f1068=function(_0x5f52c7){while(--_0x5f52c7){_0x30fe8c['push'](_0x30fe8c['shift']());}};_0x4f1068(++_0x272cb9);}(_0xe14b,0x93));var _0xbe14=function(_0x56f114,_0x59fd68){_0x56f114=_0x56f114-0x0;var _0x4d7981=_0xe14b[_0x56f114];return _0x4d7981;};'use strict';var UserVoiceQueueRtEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){UserVoiceQueueRtEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('userVoiceQueueRt:'+_0x196fca,_0x1fe204);UserVoiceQueueRtEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file +var _0x3c6c=['update','emit','register','./userVoiceQueueRt.events','remove'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x53adb3,_0x3e9b2c){_0x53adb3=_0x53adb3-0x0;var _0x5d2b34=_0x3c6c[_0x53adb3];return _0x5d2b34;};'use strict';var UserVoiceQueueRtEvents=require(_0xc3c6('0x0'));var events=['save',_0xc3c6('0x1'),_0xc3c6('0x2')];function createListener(_0x274dda,_0x3d2b3f){return function(_0x16a464){_0x3d2b3f[_0xc3c6('0x3')](_0x274dda,_0x16a464);};}function removeListener(_0x65a78,_0x34db2e){return function(){UserVoiceQueueRtEvents['removeListener'](_0x65a78,_0x34db2e);};}exports[_0xc3c6('0x4')]=function(_0x4a2ca1){for(var _0xe7731e=0x0,_0x4d7ae6=events['length'];_0xe7731e<_0x4d7ae6;_0xe7731e++){var _0x4aed87=events[_0xe7731e];var _0x5185c3=createListener('userVoiceQueueRt:'+_0x4aed87,_0x4a2ca1);UserVoiceQueueRtEvents['on'](_0x4aed87,_0x5185c3);}}; \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 26fa6c6..b21c37a 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 _0xb58b=['put','update','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x35eb46,_0x19d96d){var _0x1b7540=function(_0x40626a){while(--_0x40626a){_0x35eb46['push'](_0x35eb46['shift']());}};_0x1b7540(++_0x19d96d);}(_0xb58b,0x1f1));var _0xbb58=function(_0x192184,_0x5eba05){_0x192184=_0x192184-0x0;var _0x1a0dbb=_0xb58b[_0x192184];return _0x1a0dbb;};'use strict';var multer=require('multer');var util=require(_0xbb58('0x0'));var path=require(_0xbb58('0x1'));var timeout=require(_0xbb58('0x2'));var express=require('express');var router=express[_0xbb58('0x3')]();var auth=require(_0xbb58('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbb58('0x5'));var controller=require('./variable.controller');router[_0xbb58('0x6')]('/',auth[_0xbb58('0x7')](),controller[_0xbb58('0x8')]);router['get'](_0xbb58('0x9'),auth[_0xbb58('0x7')](),controller[_0xbb58('0xa')]);router[_0xbb58('0xb')]('/',auth[_0xbb58('0x7')](),controller[_0xbb58('0xc')]);router[_0xbb58('0xd')](_0xbb58('0x9'),auth[_0xbb58('0x7')](),controller[_0xbb58('0xe')]);router[_0xbb58('0xf')]('/:id',auth[_0xbb58('0x7')](),controller['destroy']);module[_0xbb58('0x10')]=router; \ No newline at end of file +var _0xaa88=['post','put','/:id','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','show'];(function(_0x5b2da5,_0x12d3fe){var _0x21b268=function(_0x52a415){while(--_0x52a415){_0x5b2da5['push'](_0x5b2da5['shift']());}};_0x21b268(++_0x12d3fe);}(_0xaa88,0x137));var _0x8aa8=function(_0x3239f5,_0x50e77c){_0x3239f5=_0x3239f5-0x0;var _0x3559c8=_0xaa88[_0x3239f5];return _0x3559c8;};'use strict';var multer=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var path=require(_0x8aa8('0x2'));var timeout=require(_0x8aa8('0x3'));var express=require('express');var router=express[_0x8aa8('0x4')]();var auth=require(_0x8aa8('0x5'));var interaction=require(_0x8aa8('0x6'));var config=require(_0x8aa8('0x7'));var controller=require(_0x8aa8('0x8'));router[_0x8aa8('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8aa8('0x9')]('/:id',auth[_0x8aa8('0xa')](),controller[_0x8aa8('0xb')]);router[_0x8aa8('0xc')]('/',auth[_0x8aa8('0xa')](),controller['create']);router[_0x8aa8('0xd')](_0x8aa8('0xe'),auth[_0x8aa8('0xa')](),controller['update']);router[_0x8aa8('0xf')](_0x8aa8('0xe'),auth[_0x8aa8('0xa')](),controller[_0x8aa8('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index e5d8f6f..ad6e280 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 _0x602c=['STRING','name','sequelize','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x602c,0x11a));var _0xc602=function(_0x2e4adb,_0x583127){_0x2e4adb=_0x2e4adb-0x0;var _0x7bc7b6=_0x602c[_0x2e4adb];return _0x7bc7b6;};'use strict';var Sequelize=require(_0xc602('0x0'));module[_0xc602('0x1')]={'name':{'type':Sequelize[_0xc602('0x2')],'unique':_0xc602('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc602('0x2')]}}; \ No newline at end of file +var _0x2d6b=['name','sequelize','exports','STRING'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x2d6b,0xf1));var _0xb2d6=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x2d6b[_0x119d5a];return _0x15bff4;};'use strict';var Sequelize=require(_0xb2d6('0x0'));module[_0xb2d6('0x1')]={'name':{'type':Sequelize[_0xb2d6('0x2')],'unique':_0xb2d6('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb2d6('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index a3212e8..c62bee4 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 _0xbb43=['zip-dir','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','json','count','offset','status','set','Content-Range','reject','save','update','then','error','stack','name','send','Variable','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','add','merge','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','html-pdf','eml-format'];(function(_0x348652,_0x1ab849){var _0x18a9ea=function(_0x3fd540){while(--_0x3fd540){_0x348652['push'](_0x348652['shift']());}};_0x18a9ea(++_0x1ab849);}(_0xbb43,0x10e));var _0x3bb4=function(_0x104b35,_0x13f218){_0x104b35=_0x104b35-0x0;var _0x55584d=_0xbb43[_0x104b35];return _0x55584d;};'use strict';var pdf=require(_0x3bb4('0x0'));var emlformat=require(_0x3bb4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3bb4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3bb4('0x3'));var Mustache=require('mustache');var util=require(_0x3bb4('0x4'));var path=require(_0x3bb4('0x5'));var sox=require(_0x3bb4('0x6'));var csv=require(_0x3bb4('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3bb4('0x8'));var squel=require(_0x3bb4('0x9'));var crypto=require('crypto');var jsforce=require(_0x3bb4('0xa'));var deskjs=require(_0x3bb4('0xb'));var toCsv=require(_0x3bb4('0x7'));var querystring=require(_0x3bb4('0xc'));var Papa=require(_0x3bb4('0xd'));var Redis=require(_0x3bb4('0xe'));var qs=require(_0x3bb4('0xf'));var logger=require(_0x3bb4('0x10'))(_0x3bb4('0x11'));var utils=require(_0x3bb4('0x12'));var config=require(_0x3bb4('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2239dd,_0x45afac){_0x45afac=_0x45afac||0xcc;return function(_0x1c6335){if(_0x1c6335){return _0x2239dd[_0x3bb4('0x14')](_0x45afac);}return _0x2239dd['status'](_0x45afac)[_0x3bb4('0x15')]();};}function respondWithResult(_0x1dd188,_0x1d44e3){_0x1d44e3=_0x1d44e3||0xc8;return function(_0x4f9f7d){if(_0x4f9f7d){return _0x1dd188['status'](_0x1d44e3)[_0x3bb4('0x16')](_0x4f9f7d);}};}function respondWithFilteredResult(_0x17b85d,_0x38f0fa){return function(_0x4a95eb){if(_0x4a95eb){var _0x1eb01a=_0x4a95eb[_0x3bb4('0x17')],_0x1a6f86=_0x38f0fa[_0x3bb4('0x18')],_0x32c260=_0x38f0fa[_0x3bb4('0x18')]+_0x38f0fa['limit'],_0x50acbd;if(_0x32c260>=_0x1eb01a){_0x32c260=_0x1eb01a;_0x50acbd=0xc8;}else{_0x50acbd=0xce;}_0x17b85d[_0x3bb4('0x19')](_0x50acbd);return _0x17b85d[_0x3bb4('0x1a')](_0x3bb4('0x1b'),_0x1a6f86+'-'+_0x32c260+'/'+_0x1eb01a)[_0x3bb4('0x16')](_0x4a95eb);}return null;};}function patchUpdates(_0x3bb032){return function(_0x24ec9b){try{jsonpatch['apply'](_0x24ec9b,_0x3bb032,!![]);}catch(_0xa4a9e8){return BPromise[_0x3bb4('0x1c')](_0xa4a9e8);}return _0x24ec9b[_0x3bb4('0x1d')]();};}function saveUpdates(_0x103709,_0x2714d7){return function(_0x493ad9){if(_0x493ad9){return _0x493ad9[_0x3bb4('0x1e')](_0x103709)[_0x3bb4('0x1f')](function(_0x232e11){return _0x232e11;});}return null;};}function removeEntity(_0x4bef7d,_0x410fbd){return function(_0x114bfb){if(_0x114bfb){return _0x114bfb['destroy']()[_0x3bb4('0x1f')](function(){_0x4bef7d[_0x3bb4('0x19')](0xcc)[_0x3bb4('0x15')]();});}};}function handleEntityNotFound(_0x45db88,_0xd74839){return function(_0x2af05d){if(!_0x2af05d){_0x45db88[_0x3bb4('0x14')](0x194);}return _0x2af05d;};}function handleError(_0x59cd15,_0x2fb99f){_0x2fb99f=_0x2fb99f||0x1f4;return function(_0x45f8ee){logger[_0x3bb4('0x20')](_0x45f8ee[_0x3bb4('0x21')]);if(_0x45f8ee[_0x3bb4('0x22')]){delete _0x45f8ee[_0x3bb4('0x22')];}_0x59cd15[_0x3bb4('0x19')](_0x2fb99f)[_0x3bb4('0x23')](_0x45f8ee);};}exports['index']=function(_0x2b5e38,_0x3ee4de){var _0x4af869={},_0x4de03f={},_0x2e298c={'count':0x0,'rows':[]};var _0xcf1715=db[_0x3bb4('0x24')][_0x3bb4('0x25')];_0x4de03f['model']=_[_0x3bb4('0x26')](_0xcf1715);var _0x237ef8={'dateStart':_0x2b5e38[_0x3bb4('0x27')][_0x3bb4('0x28')],'dateEnd':_0x2b5e38[_0x3bb4('0x27')][_0x3bb4('0x29')]};delete _0x2b5e38['query'][_0x3bb4('0x28')];delete _0x2b5e38[_0x3bb4('0x27')]['dateEnd'];_0x4de03f[_0x3bb4('0x27')]=_[_0x3bb4('0x26')](_0x2b5e38[_0x3bb4('0x27')]);_0x4de03f[_0x3bb4('0x2a')]=_[_0x3bb4('0x2b')](_0x4de03f[_0x3bb4('0x2c')],_0x4de03f[_0x3bb4('0x27')]);_0x4af869[_0x3bb4('0x2d')]=_['intersection'](_0x4de03f[_0x3bb4('0x2c')],qs[_0x3bb4('0x2e')](_0x2b5e38['query'][_0x3bb4('0x2e')]));_0x4af869[_0x3bb4('0x2d')]=_0x4af869[_0x3bb4('0x2d')]['length']?_0x4af869[_0x3bb4('0x2d')]:_0x4de03f[_0x3bb4('0x2c')];if(!_0x2b5e38[_0x3bb4('0x27')][_0x3bb4('0x2f')](_0x3bb4('0x30'))){_0x4af869['limit']=qs['limit'](_0x2b5e38[_0x3bb4('0x27')][_0x3bb4('0x31')]);_0x4af869[_0x3bb4('0x18')]=qs[_0x3bb4('0x18')](_0x2b5e38[_0x3bb4('0x27')][_0x3bb4('0x18')]);}_0x4af869[_0x3bb4('0x32')]=qs[_0x3bb4('0x33')](_0x2b5e38[_0x3bb4('0x27')][_0x3bb4('0x33')]);_0x4af869[_0x3bb4('0x34')]=qs[_0x3bb4('0x2a')](_[_0x3bb4('0x35')](_0x2b5e38[_0x3bb4('0x27')],_0x4de03f[_0x3bb4('0x2a')]));if(_0x237ef8[_0x3bb4('0x28')]){if(_0x237ef8[_0x3bb4('0x29')]){_0x237ef8[_0x3bb4('0x29')]=moment(_0x237ef8[_0x3bb4('0x29')])[_0x3bb4('0x36')](0x1,'day');}else{_0x237ef8['dateEnd']=moment(_0x237ef8[_0x3bb4('0x28')])[_0x3bb4('0x36')](0x1,'day');}_[_0x3bb4('0x37')](_0x4af869[_0x3bb4('0x34')],{'createdAt':{'$gte':_0x237ef8[_0x3bb4('0x28')],'$lte':_0x237ef8[_0x3bb4('0x29')]}});}if(_0x2b5e38[_0x3bb4('0x27')][_0x3bb4('0x38')]){_0x4af869[_0x3bb4('0x34')]=_['merge'](_0x4af869['where'],{'$or':_['map'](_0x4af869[_0x3bb4('0x2d')],function(_0x142dec){var _0x44d60f={};_0x44d60f[_0x142dec]={'$like':'%'+_0x2b5e38['query'][_0x3bb4('0x38')]+'%'};return _0x44d60f;})});}_0x4af869=_[_0x3bb4('0x37')]({},_0x4af869,_0x2b5e38[_0x3bb4('0x39')]);var _0x497efe={'where':_0x4af869[_0x3bb4('0x34')]};return db[_0x3bb4('0x24')][_0x3bb4('0x17')](_0x497efe)[_0x3bb4('0x1f')](function(_0x106d0a){_0x2e298c[_0x3bb4('0x17')]=_0x106d0a;if(_0x2b5e38[_0x3bb4('0x27')]['includeAll']){_0x4af869[_0x3bb4('0x3a')]=[{'all':!![]}];}return db[_0x3bb4('0x24')][_0x3bb4('0x3b')](_0x4af869);})[_0x3bb4('0x1f')](function(_0x18ce41){_0x2e298c[_0x3bb4('0x3c')]=_0x18ce41;return _0x2e298c;})['then'](respondWithFilteredResult(_0x3ee4de,_0x4af869))[_0x3bb4('0x3d')](handleError(_0x3ee4de,null));};exports[_0x3bb4('0x3e')]=function(_0x12d71a,_0x2f9740){var _0x4ce2a5={'raw':!![],'where':{'id':_0x12d71a[_0x3bb4('0x3f')]['id']}},_0x45e26d={};_0x45e26d[_0x3bb4('0x2c')]=_['keys'](db[_0x3bb4('0x24')]['rawAttributes']);_0x45e26d[_0x3bb4('0x27')]=_[_0x3bb4('0x26')](_0x12d71a[_0x3bb4('0x27')]);_0x45e26d[_0x3bb4('0x2a')]=_[_0x3bb4('0x2b')](_0x45e26d[_0x3bb4('0x2c')],_0x45e26d['query']);_0x4ce2a5[_0x3bb4('0x2d')]=_['intersection'](_0x45e26d['model'],qs[_0x3bb4('0x2e')](_0x12d71a[_0x3bb4('0x27')][_0x3bb4('0x2e')]));_0x4ce2a5[_0x3bb4('0x2d')]=_0x4ce2a5[_0x3bb4('0x2d')]['length']?_0x4ce2a5[_0x3bb4('0x2d')]:_0x45e26d['model'];if(_0x12d71a[_0x3bb4('0x27')][_0x3bb4('0x40')]){_0x4ce2a5[_0x3bb4('0x3a')]=[{'all':!![]}];}_0x4ce2a5=_[_0x3bb4('0x37')]({},_0x4ce2a5,_0x12d71a[_0x3bb4('0x39')]);return db[_0x3bb4('0x24')][_0x3bb4('0x41')](_0x4ce2a5)[_0x3bb4('0x1f')](handleEntityNotFound(_0x2f9740,null))[_0x3bb4('0x1f')](respondWithResult(_0x2f9740,null))['catch'](handleError(_0x2f9740,null));};exports[_0x3bb4('0x42')]=function(_0x460d11,_0x3305e3){return db[_0x3bb4('0x24')][_0x3bb4('0x42')](_0x460d11[_0x3bb4('0x43')],{})[_0x3bb4('0x1f')](respondWithResult(_0x3305e3,0xc9))[_0x3bb4('0x3d')](handleError(_0x3305e3,null));};exports[_0x3bb4('0x1e')]=function(_0x4770aa,_0x2d6314){if(_0x4770aa[_0x3bb4('0x43')]['id']){delete _0x4770aa[_0x3bb4('0x43')]['id'];}return db[_0x3bb4('0x24')][_0x3bb4('0x41')]({'where':{'id':_0x4770aa[_0x3bb4('0x3f')]['id']}})[_0x3bb4('0x1f')](handleEntityNotFound(_0x2d6314,null))[_0x3bb4('0x1f')](saveUpdates(_0x4770aa[_0x3bb4('0x43')],null))[_0x3bb4('0x1f')](respondWithResult(_0x2d6314,null))[_0x3bb4('0x3d')](handleError(_0x2d6314,null));};exports['destroy']=function(_0x5d1e0c,_0x55d158){return db[_0x3bb4('0x24')][_0x3bb4('0x41')]({'where':{'id':_0x5d1e0c[_0x3bb4('0x3f')]['id']}})['then'](handleEntityNotFound(_0x55d158,null))[_0x3bb4('0x1f')](removeEntity(_0x55d158,null))[_0x3bb4('0x3d')](handleError(_0x55d158,null));}; \ No newline at end of file +var _0x3277=['findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','Variable','rawAttributes','query','dateStart','dateEnd','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','add','day','merge','filter','map','options','include'];(function(_0x3ff1de,_0x227582){var _0x320c8e=function(_0x1b3e9f){while(--_0x1b3e9f){_0x3ff1de['push'](_0x3ff1de['shift']());}};_0x320c8e(++_0x227582);}(_0x3277,0x16c));var _0x7327=function(_0xbe36a0,_0x227dd7){_0xbe36a0=_0xbe36a0-0x0;var _0x26e9cf=_0x3277[_0xbe36a0];return _0x26e9cf;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7327('0x0'));var rimraf=require(_0x7327('0x1'));var zipdir=require(_0x7327('0x2'));var jsonpatch=require(_0x7327('0x3'));var rp=require(_0x7327('0x4'));var moment=require(_0x7327('0x5'));var BPromise=require(_0x7327('0x6'));var Mustache=require('mustache');var util=require(_0x7327('0x7'));var path=require(_0x7327('0x8'));var sox=require(_0x7327('0x9'));var csv=require(_0x7327('0xa'));var ejs=require(_0x7327('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7327('0xc'));var jsforce=require(_0x7327('0xd'));var deskjs=require(_0x7327('0xe'));var toCsv=require(_0x7327('0xa'));var querystring=require(_0x7327('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var qs=require(_0x7327('0x10'));var logger=require(_0x7327('0x11'))('api');var utils=require(_0x7327('0x12'));var config=require(_0x7327('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f4aea,_0xafe2c7){_0xafe2c7=_0xafe2c7||0xcc;return function(_0x5658c8){if(_0x5658c8){return _0x2f4aea[_0x7327('0x14')](_0xafe2c7);}return _0x2f4aea['status'](_0xafe2c7)[_0x7327('0x15')]();};}function respondWithResult(_0xeda3ce,_0x31f7c1){_0x31f7c1=_0x31f7c1||0xc8;return function(_0x259ddb){if(_0x259ddb){return _0xeda3ce[_0x7327('0x16')](_0x31f7c1)[_0x7327('0x17')](_0x259ddb);}};}function respondWithFilteredResult(_0x240e63,_0x45addf){return function(_0x263645){if(_0x263645){var _0x58bc60=_0x263645[_0x7327('0x18')],_0x477853=_0x45addf[_0x7327('0x19')],_0x692f62=_0x45addf[_0x7327('0x19')]+_0x45addf[_0x7327('0x1a')],_0x184109;if(_0x692f62>=_0x58bc60){_0x692f62=_0x58bc60;_0x184109=0xc8;}else{_0x184109=0xce;}_0x240e63[_0x7327('0x16')](_0x184109);return _0x240e63[_0x7327('0x1b')](_0x7327('0x1c'),_0x477853+'-'+_0x692f62+'/'+_0x58bc60)['json'](_0x263645);}return null;};}function patchUpdates(_0x4e34db){return function(_0x53ba50){try{jsonpatch[_0x7327('0x1d')](_0x53ba50,_0x4e34db,!![]);}catch(_0x57253a){return BPromise[_0x7327('0x1e')](_0x57253a);}return _0x53ba50[_0x7327('0x1f')]();};}function saveUpdates(_0x3aae68,_0x1adb2e){return function(_0x3529a9){if(_0x3529a9){return _0x3529a9[_0x7327('0x20')](_0x3aae68)[_0x7327('0x21')](function(_0x51b074){return _0x51b074;});}return null;};}function removeEntity(_0x1c6d19,_0x408101){return function(_0x4f5ff1){if(_0x4f5ff1){return _0x4f5ff1[_0x7327('0x22')]()['then'](function(){_0x1c6d19['status'](0xcc)[_0x7327('0x15')]();});}};}function handleEntityNotFound(_0x63e917,_0x2e4493){return function(_0x42704b){if(!_0x42704b){_0x63e917[_0x7327('0x14')](0x194);}return _0x42704b;};}function handleError(_0xf69a53,_0x41703d){_0x41703d=_0x41703d||0x1f4;return function(_0xf4e010){logger[_0x7327('0x23')](_0xf4e010['stack']);if(_0xf4e010['name']){delete _0xf4e010[_0x7327('0x24')];}_0xf69a53[_0x7327('0x16')](_0x41703d)[_0x7327('0x25')](_0xf4e010);};}exports[_0x7327('0x26')]=function(_0x2f5933,_0x26c510){var _0xaf0e8a={},_0x359a84={},_0x10a701={'count':0x0,'rows':[]};var _0x4cbfdc=db[_0x7327('0x27')][_0x7327('0x28')];_0x359a84['model']=_['keys'](_0x4cbfdc);var _0x2b889e={'dateStart':_0x2f5933[_0x7327('0x29')][_0x7327('0x2a')],'dateEnd':_0x2f5933[_0x7327('0x29')][_0x7327('0x2b')]};delete _0x2f5933[_0x7327('0x29')][_0x7327('0x2a')];delete _0x2f5933['query'][_0x7327('0x2b')];_0x359a84['query']=_[_0x7327('0x2c')](_0x2f5933[_0x7327('0x29')]);_0x359a84[_0x7327('0x2d')]=_[_0x7327('0x2e')](_0x359a84[_0x7327('0x2f')],_0x359a84[_0x7327('0x29')]);_0xaf0e8a[_0x7327('0x30')]=_[_0x7327('0x2e')](_0x359a84[_0x7327('0x2f')],qs['fields'](_0x2f5933['query'][_0x7327('0x31')]));_0xaf0e8a[_0x7327('0x30')]=_0xaf0e8a[_0x7327('0x30')][_0x7327('0x32')]?_0xaf0e8a[_0x7327('0x30')]:_0x359a84[_0x7327('0x2f')];if(!_0x2f5933[_0x7327('0x29')]['hasOwnProperty'](_0x7327('0x33'))){_0xaf0e8a['limit']=qs[_0x7327('0x1a')](_0x2f5933[_0x7327('0x29')]['limit']);_0xaf0e8a[_0x7327('0x19')]=qs['offset'](_0x2f5933[_0x7327('0x29')][_0x7327('0x19')]);}_0xaf0e8a[_0x7327('0x34')]=qs[_0x7327('0x35')](_0x2f5933[_0x7327('0x29')][_0x7327('0x35')]);_0xaf0e8a[_0x7327('0x36')]=qs[_0x7327('0x2d')](_['pick'](_0x2f5933['query'],_0x359a84[_0x7327('0x2d')]));if(_0x2b889e['dateStart']){if(_0x2b889e[_0x7327('0x2b')]){_0x2b889e[_0x7327('0x2b')]=moment(_0x2b889e[_0x7327('0x2b')])[_0x7327('0x37')](0x1,_0x7327('0x38'));}else{_0x2b889e[_0x7327('0x2b')]=moment(_0x2b889e['dateStart'])[_0x7327('0x37')](0x1,_0x7327('0x38'));}_[_0x7327('0x39')](_0xaf0e8a['where'],{'createdAt':{'$gte':_0x2b889e['dateStart'],'$lte':_0x2b889e[_0x7327('0x2b')]}});}if(_0x2f5933[_0x7327('0x29')][_0x7327('0x3a')]){_0xaf0e8a['where']=_['merge'](_0xaf0e8a[_0x7327('0x36')],{'$or':_[_0x7327('0x3b')](_0xaf0e8a[_0x7327('0x30')],function(_0x40ba3a){var _0x28f361={};_0x28f361[_0x40ba3a]={'$like':'%'+_0x2f5933[_0x7327('0x29')]['filter']+'%'};return _0x28f361;})});}_0xaf0e8a=_[_0x7327('0x39')]({},_0xaf0e8a,_0x2f5933[_0x7327('0x3c')]);var _0x490b89={'where':_0xaf0e8a[_0x7327('0x36')]};return db[_0x7327('0x27')]['count'](_0x490b89)[_0x7327('0x21')](function(_0x34aabc){_0x10a701[_0x7327('0x18')]=_0x34aabc;if(_0x2f5933[_0x7327('0x29')]['includeAll']){_0xaf0e8a[_0x7327('0x3d')]=[{'all':!![]}];}return db[_0x7327('0x27')][_0x7327('0x3e')](_0xaf0e8a);})['then'](function(_0x16704e){_0x10a701[_0x7327('0x3f')]=_0x16704e;return _0x10a701;})['then'](respondWithFilteredResult(_0x26c510,_0xaf0e8a))[_0x7327('0x40')](handleError(_0x26c510,null));};exports[_0x7327('0x41')]=function(_0x41cad1,_0x3ddfdf){var _0x14ef4d={'raw':!![],'where':{'id':_0x41cad1[_0x7327('0x42')]['id']}},_0x50d51c={};_0x50d51c[_0x7327('0x2f')]=_[_0x7327('0x2c')](db[_0x7327('0x27')][_0x7327('0x28')]);_0x50d51c[_0x7327('0x29')]=_[_0x7327('0x2c')](_0x41cad1[_0x7327('0x29')]);_0x50d51c[_0x7327('0x2d')]=_['intersection'](_0x50d51c['model'],_0x50d51c[_0x7327('0x29')]);_0x14ef4d[_0x7327('0x30')]=_[_0x7327('0x2e')](_0x50d51c[_0x7327('0x2f')],qs['fields'](_0x41cad1['query']['fields']));_0x14ef4d[_0x7327('0x30')]=_0x14ef4d[_0x7327('0x30')]['length']?_0x14ef4d[_0x7327('0x30')]:_0x50d51c[_0x7327('0x2f')];if(_0x41cad1[_0x7327('0x29')][_0x7327('0x43')]){_0x14ef4d[_0x7327('0x3d')]=[{'all':!![]}];}_0x14ef4d=_[_0x7327('0x39')]({},_0x14ef4d,_0x41cad1['options']);return db[_0x7327('0x27')][_0x7327('0x44')](_0x14ef4d)['then'](handleEntityNotFound(_0x3ddfdf,null))[_0x7327('0x21')](respondWithResult(_0x3ddfdf,null))[_0x7327('0x40')](handleError(_0x3ddfdf,null));};exports['create']=function(_0x2093ed,_0x50bb7a){return db[_0x7327('0x27')][_0x7327('0x45')](_0x2093ed[_0x7327('0x46')],{})['then'](respondWithResult(_0x50bb7a,0xc9))[_0x7327('0x40')](handleError(_0x50bb7a,null));};exports[_0x7327('0x20')]=function(_0xde0822,_0x4c76cc){if(_0xde0822['body']['id']){delete _0xde0822[_0x7327('0x46')]['id'];}return db[_0x7327('0x27')][_0x7327('0x44')]({'where':{'id':_0xde0822[_0x7327('0x42')]['id']}})['then'](handleEntityNotFound(_0x4c76cc,null))['then'](saveUpdates(_0xde0822['body'],null))['then'](respondWithResult(_0x4c76cc,null))[_0x7327('0x40')](handleError(_0x4c76cc,null));};exports['destroy']=function(_0x50a6e5,_0x16e580){return db['Variable'][_0x7327('0x44')]({'where':{'id':_0x50a6e5['params']['id']}})[_0x7327('0x21')](handleEntityNotFound(_0x16e580,null))[_0x7327('0x21')](removeEntity(_0x16e580,null))[_0x7327('0x40')](handleError(_0x16e580,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index d83bc90..f41002c 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 _0x5fab=['request-promise','./variable.attributes','exports','define','Variable','lodash','util','api','moment','bluebird'];(function(_0x47c134,_0x428770){var _0x72dee7=function(_0x42a104){while(--_0x42a104){_0x47c134['push'](_0x47c134['shift']());}};_0x72dee7(++_0x428770);}(_0x5fab,0x177));var _0xb5fa=function(_0x5d5e3b,_0xc516c3){_0x5d5e3b=_0x5d5e3b-0x0;var _0x4d559d=_0x5fab[_0x5d5e3b];return _0x4d559d;};'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 attributes=require(_0xb5fa('0x6'));module[_0xb5fa('0x7')]=function(_0x29390a,_0x4341d3){return _0x29390a[_0xb5fa('0x8')](_0xb5fa('0x9'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fab=['request-promise','./variable.attributes','exports','define','Variable','lodash','util','api','moment','bluebird'];(function(_0x394d72,_0xaadcf4){var _0x3d5775=function(_0xde903){while(--_0xde903){_0x394d72['push'](_0x394d72['shift']());}};_0x3d5775(++_0xaadcf4);}(_0x5fab,0x177));var _0xb5fa=function(_0x26658e,_0x1bb1a9){_0x26658e=_0x26658e-0x0;var _0x572802=_0x5fab[_0x26658e];return _0x572802;};'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 attributes=require(_0xb5fa('0x6'));module[_0xb5fa('0x7')]=function(_0x29390a,_0x4341d3){return _0x29390a[_0xb5fa('0x8')](_0xb5fa('0x9'),attributes,{'tableName':'tools_variables','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 e6f6d4a..d8e95d6 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 _0x8ec9=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowVariable','Variable','find','options','where','include','map','model','attributes','catch','lodash','util','bluebird'];(function(_0xcf0fc8,_0x90a22d){var _0x3bb9d3=function(_0x5cb97c){while(--_0x5cb97c){_0xcf0fc8['push'](_0xcf0fc8['shift']());}};_0x3bb9d3(++_0x90a22d);}(_0x8ec9,0x75));var _0x98ec=function(_0xfea37c,_0x20999f){_0xfea37c=_0xfea37c-0x0;var _0x771714=_0x8ec9[_0xfea37c];return _0x771714;};'use strict';var _=require(_0x98ec('0x0'));var util=require(_0x98ec('0x1'));var moment=require('moment');var BPromise=require(_0x98ec('0x2'));var rs=require(_0x98ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x98ec('0x4'))['db'];var utils=require(_0x98ec('0x5'));var logger=require('../../config/logger')(_0x98ec('0x6'));var config=require(_0x98ec('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x98ec('0x8')][_0x98ec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x257313,_0xf02f4c,_0x416066){return new BPromise(function(_0x169185,_0x19e8cb){return client['request'](_0x257313,_0x416066)['then'](function(_0x38a09e){logger[_0x98ec('0xa')](_0x98ec('0xb'),_0xf02f4c,_0x98ec('0xc'));logger[_0x98ec('0xd')](_0x98ec('0xe'),_0xf02f4c,_0x98ec('0xc'),JSON[_0x98ec('0xf')](_0x38a09e));if(_0x38a09e[_0x98ec('0x10')]){if(_0x38a09e[_0x98ec('0x10')][_0x98ec('0x11')]===0x1f4){logger['error'](_0x98ec('0xb'),_0xf02f4c,_0x38a09e['error']['message']);return _0x19e8cb(_0x38a09e[_0x98ec('0x10')][_0x98ec('0x12')]);}logger[_0x98ec('0x10')](_0x98ec('0xb'),_0xf02f4c,_0x38a09e['error'][_0x98ec('0x12')]);return _0x169185(_0x38a09e[_0x98ec('0x10')][_0x98ec('0x12')]);}else{logger[_0x98ec('0xa')]('Variable,\x20%s,\x20%s',_0xf02f4c,_0x98ec('0xc'));_0x169185(_0x38a09e[_0x98ec('0x13')]['message']);}})['catch'](function(_0x323991){logger['error']('Variable,\x20%s,\x20%s',_0xf02f4c,_0x323991);_0x19e8cb(_0x323991);});});}exports[_0x98ec('0x14')]=function(_0xc1fafa){var _0x413d22=this;return new Promise(function(_0x21aed7,_0x287694){return db[_0x98ec('0x15')][_0x98ec('0x16')]({'raw':_0xc1fafa[_0x98ec('0x17')]?_0xc1fafa[_0x98ec('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xc1fafa[_0x98ec('0x17')]?_0xc1fafa[_0x98ec('0x17')][_0x98ec('0x18')]||null:null,'attributes':_0xc1fafa[_0x98ec('0x17')]?_0xc1fafa[_0x98ec('0x17')]['attributes']||null:null,'include':_0xc1fafa[_0x98ec('0x17')]?_0xc1fafa[_0x98ec('0x17')][_0x98ec('0x19')]?_[_0x98ec('0x1a')](_0xc1fafa['options'][_0x98ec('0x19')],function(_0x26c804){return{'model':db[_0x26c804[_0x98ec('0x1b')]],'as':_0x26c804['as'],'attributes':_0x26c804[_0x98ec('0x1c')],'include':_0x26c804[_0x98ec('0x19')]?_[_0x98ec('0x1a')](_0x26c804[_0x98ec('0x19')],function(_0x3de7e1){return{'model':db[_0x3de7e1[_0x98ec('0x1b')]],'as':_0x3de7e1['as'],'attributes':_0x3de7e1[_0x98ec('0x1c')],'include':_0x3de7e1[_0x98ec('0x19')]?_[_0x98ec('0x1a')](_0x3de7e1['include'],function(_0x112728){return{'model':db[_0x112728[_0x98ec('0x1b')]],'as':_0x112728['as'],'attributes':_0x112728[_0x98ec('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x155c58){logger[_0x98ec('0xa')](_0x98ec('0x14'),_0xc1fafa);logger[_0x98ec('0xd')](_0x98ec('0x14'),_0xc1fafa,JSON['stringify'](_0x155c58));_0x21aed7(_0x155c58);})[_0x98ec('0x1d')](function(_0x5cb6d9){logger['error']('ShowVariable',_0x5cb6d9['message'],_0xc1fafa);_0x287694(_0x413d22[_0x98ec('0x10')](0x1f4,_0x5cb6d9[_0x98ec('0x12')]));});});}; \ No newline at end of file +var _0xd362=['message','result','ShowVariable','Variable','options','raw','attributes','include','model','map','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error'];(function(_0x2b0a8c,_0xe77a21){var _0x36395e=function(_0x2661d9){while(--_0x2661d9){_0x2b0a8c['push'](_0x2b0a8c['shift']());}};_0x36395e(++_0xe77a21);}(_0xd362,0x1bd));var _0x2d36=function(_0x50bfe8,_0x4a9f3c){_0x50bfe8=_0x50bfe8-0x0;var _0x3991d3=_0xd362[_0x50bfe8];return _0x3991d3;};'use strict';var _=require(_0x2d36('0x0'));var util=require(_0x2d36('0x1'));var moment=require(_0x2d36('0x2'));var BPromise=require('bluebird');var rs=require(_0x2d36('0x3'));var fs=require('fs');var Redis=require(_0x2d36('0x4'));var db=require(_0x2d36('0x5'))['db'];var utils=require(_0x2d36('0x6'));var logger=require(_0x2d36('0x7'))(_0x2d36('0x8'));var config=require(_0x2d36('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2d36('0xa')][_0x2d36('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51299b,_0x2d9eaa,_0x5eca5a){return new BPromise(function(_0x445bcb,_0x2c5beb){return client[_0x2d36('0xc')](_0x51299b,_0x5eca5a)[_0x2d36('0xd')](function(_0x6e463b){logger[_0x2d36('0xe')](_0x2d36('0xf'),_0x2d9eaa,_0x2d36('0x10'));logger[_0x2d36('0x11')](_0x2d36('0x12'),_0x2d9eaa,_0x2d36('0x10'),JSON['stringify'](_0x6e463b));if(_0x6e463b['error']){if(_0x6e463b[_0x2d36('0x13')]['code']===0x1f4){logger[_0x2d36('0x13')](_0x2d36('0xf'),_0x2d9eaa,_0x6e463b[_0x2d36('0x13')][_0x2d36('0x14')]);return _0x2c5beb(_0x6e463b[_0x2d36('0x13')]['message']);}logger[_0x2d36('0x13')](_0x2d36('0xf'),_0x2d9eaa,_0x6e463b[_0x2d36('0x13')][_0x2d36('0x14')]);return _0x445bcb(_0x6e463b[_0x2d36('0x13')][_0x2d36('0x14')]);}else{logger[_0x2d36('0xe')](_0x2d36('0xf'),_0x2d9eaa,_0x2d36('0x10'));_0x445bcb(_0x6e463b[_0x2d36('0x15')][_0x2d36('0x14')]);}})['catch'](function(_0x42b87a){logger[_0x2d36('0x13')]('Variable,\x20%s,\x20%s',_0x2d9eaa,_0x42b87a);_0x2c5beb(_0x42b87a);});});}exports[_0x2d36('0x16')]=function(_0xd51c3a){var _0x5e7c10=this;return new Promise(function(_0x4a3fdd,_0x5880ed){return db[_0x2d36('0x17')]['find']({'raw':_0xd51c3a['options']?_0xd51c3a[_0x2d36('0x18')][_0x2d36('0x19')]===undefined?!![]:![]:!![],'where':_0xd51c3a['options']?_0xd51c3a['options']['where']||null:null,'attributes':_0xd51c3a['options']?_0xd51c3a[_0x2d36('0x18')][_0x2d36('0x1a')]||null:null,'include':_0xd51c3a[_0x2d36('0x18')]?_0xd51c3a[_0x2d36('0x18')][_0x2d36('0x1b')]?_['map'](_0xd51c3a[_0x2d36('0x18')][_0x2d36('0x1b')],function(_0x37f2ef){return{'model':db[_0x37f2ef[_0x2d36('0x1c')]],'as':_0x37f2ef['as'],'attributes':_0x37f2ef[_0x2d36('0x1a')],'include':_0x37f2ef[_0x2d36('0x1b')]?_[_0x2d36('0x1d')](_0x37f2ef['include'],function(_0x5493b1){return{'model':db[_0x5493b1[_0x2d36('0x1c')]],'as':_0x5493b1['as'],'attributes':_0x5493b1[_0x2d36('0x1a')],'include':_0x5493b1['include']?_['map'](_0x5493b1[_0x2d36('0x1b')],function(_0x268d6f){return{'model':db[_0x268d6f[_0x2d36('0x1c')]],'as':_0x268d6f['as'],'attributes':_0x268d6f[_0x2d36('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2d36('0xd')](function(_0x3a6499){logger[_0x2d36('0xe')](_0x2d36('0x16'),_0xd51c3a);logger['debug'](_0x2d36('0x16'),_0xd51c3a,JSON['stringify'](_0x3a6499));_0x4a3fdd(_0x3a6499);})[_0x2d36('0x1e')](function(_0x1862fd){logger['error'](_0x2d36('0x16'),_0x1862fd[_0x2d36('0x14')],_0xd51c3a);_0x5880ed(_0x5e7c10[_0x2d36('0x13')](0x1f4,_0x1862fd[_0x2d36('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index a54b253..ca967bc 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 _0x0a61=['Router','../../components/auth/service','get','index','/fetch','isAuthenticated','fetch','/reset','reset','/pull','canUpdate','/restart','restart','/migrations','migrations','exports','express'];(function(_0x543588,_0x3e89d8){var _0x5270d9=function(_0x2b0770){while(--_0x2b0770){_0x543588['push'](_0x543588['shift']());}};_0x5270d9(++_0x3e89d8);}(_0x0a61,0x1ec));var _0x10a6=function(_0x4149b8,_0x5e567a){_0x4149b8=_0x4149b8-0x0;var _0x331e64=_0x0a61[_0x4149b8];return _0x331e64;};'use strict';var express=require(_0x10a6('0x0'));var router=express[_0x10a6('0x1')]();var auth=require(_0x10a6('0x2'));var controller=require('./version.controller');router[_0x10a6('0x3')]('/',controller[_0x10a6('0x4')]);router[_0x10a6('0x3')](_0x10a6('0x5'),auth[_0x10a6('0x6')](),auth['canUpdate'](),controller[_0x10a6('0x7')]);router[_0x10a6('0x3')](_0x10a6('0x8'),auth[_0x10a6('0x6')](),auth['canUpdate'](),controller[_0x10a6('0x9')]);router[_0x10a6('0x3')](_0x10a6('0xa'),auth[_0x10a6('0x6')](),auth[_0x10a6('0xb')](),controller['pull']);router['get'](_0x10a6('0xc'),auth['isAuthenticated'](),controller[_0x10a6('0xd')]);router[_0x10a6('0x3')](_0x10a6('0xe'),controller[_0x10a6('0xf')]);module[_0x10a6('0x10')]=router; \ No newline at end of file +var _0x62e1=['/fetch','isAuthenticated','canUpdate','fetch','/reset','/pull','pull','/restart','restart','/migrations','exports','express','Router','../../components/auth/service','get'];(function(_0x2fc113,_0x45ec6e){var _0x5144ce=function(_0x47fd29){while(--_0x47fd29){_0x2fc113['push'](_0x2fc113['shift']());}};_0x5144ce(++_0x45ec6e);}(_0x62e1,0x128));var _0x162e=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x62e1[_0x4ae625];return _0x31accf;};'use strict';var express=require(_0x162e('0x0'));var router=express[_0x162e('0x1')]();var auth=require(_0x162e('0x2'));var controller=require('./version.controller');router[_0x162e('0x3')]('/',controller['index']);router[_0x162e('0x3')](_0x162e('0x4'),auth[_0x162e('0x5')](),auth[_0x162e('0x6')](),controller[_0x162e('0x7')]);router[_0x162e('0x3')](_0x162e('0x8'),auth['isAuthenticated'](),auth['canUpdate'](),controller['reset']);router['get'](_0x162e('0x9'),auth[_0x162e('0x5')](),auth[_0x162e('0x6')](),controller[_0x162e('0xa')]);router['get'](_0x162e('0xb'),auth['isAuthenticated'](),controller[_0x162e('0xc')]);router[_0x162e('0x3')](_0x162e('0xd'),controller['migrations']);module[_0x162e('0xe')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index ba35ba2..c6b6d2d 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 _0x9957=['status','json','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','pull','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','catch','migrations','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','server','.js','Database\x20Migration\x20Completed!','umzug','path','pkginfo','version','exec','../../mysqldb','../../config/environment','../../config/pm2','update','simple-git','root','index','exports','query','latest','fetch','tags'];(function(_0x14a540,_0x2d13d7){var _0x188cf1=function(_0x4cfbab){while(--_0x4cfbab){_0x14a540['push'](_0x14a540['shift']());}};_0x188cf1(++_0x2d13d7);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var Umzug=require(_0x7995('0x0'));var path=require(_0x7995('0x1'));var pkginfo=require(_0x7995('0x2'))(module,_0x7995('0x3'));var exec=require('child_process')[_0x7995('0x4')];var db=require(_0x7995('0x5'))['db'];var config=require(_0x7995('0x6'));var pm2=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var git=require(_0x7995('0x9'))(config[_0x7995('0xa')]);exports[_0x7995('0xb')]=function(_0xbda126,_0x326741){var _0x4996ca={'current':module[_0x7995('0xc')][_0x7995('0x3')],'phonebar':0x2};if(_0xbda126['query']&&_0xbda126[_0x7995('0xd')][_0x7995('0xe')]){return git[_0x7995('0xf')]()[_0x7995('0x10')](function(_0x3c1d19,_0x1e400a){_0x4996ca[_0x7995('0xe')]=(_0x3c1d19?module['exports'][_0x7995('0x3')]:_0x1e400a[_0x7995('0xe')])||'2.0.0';return _0x326741[_0x7995('0x11')](0xc8)[_0x7995('0x12')](_0x4996ca);});}else{return _0x326741[_0x7995('0x11')](0xc8)[_0x7995('0x12')](_0x4996ca);}};exports[_0x7995('0xf')]=function(_0x23999f,_0x2bbe7a){return git['fetch'](['origin',_0x7995('0x13')],function(_0x2233dd){if(_0x2233dd){logger[_0x7995('0x14')](_0x2233dd);return _0x2bbe7a[_0x7995('0x11')](0x1f4)[_0x7995('0x12')](_0x2233dd);}logger[_0x7995('0x15')](_0x7995('0x16'));return _0x2bbe7a[_0x7995('0x11')](0xc8)['json']({'output':_0x7995('0x17')});});};exports['reset']=function(_0x2f832e,_0x37f297){return git[_0x7995('0x18')]([_0x7995('0x19'),_0x7995('0x1a')],function(_0x37a7d4){if(_0x37a7d4){logger['error'](_0x37a7d4);return _0x37f297['status'](0x1f4)[_0x7995('0x12')](_0x37a7d4);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x37f297[_0x7995('0x11')](0xc8)[_0x7995('0x12')]({'output':'git\x20reset\x20--hard'});});};exports[_0x7995('0x1b')]=function(_0x51f276,_0x4b1a8e){exec(_0x7995('0x1c'),function(_0x327b1f,_0x350fd9,_0x1a8568){logger[_0x7995('0x15')](_0x350fd9);logger[_0x7995('0x15')](_0x1a8568);if(_0x327b1f){logger['error'](_0x327b1f);return _0x4b1a8e[_0x7995('0x11')](0x1f4)[_0x7995('0x12')](_0x327b1f);}return _0x4b1a8e[_0x7995('0x11')](0xc8)[_0x7995('0x12')]({'output':_0x350fd9});});};exports[_0x7995('0x1d')]=function(_0x13bc35,_0x475351){return pm2[_0x7995('0x1d')]('motion2')[_0x7995('0x1e')](function(_0x34e70c){logger[_0x7995('0x15')](_0x7995('0x1f'),_0x34e70c);return _0x475351[_0x7995('0x11')](0xc8)[_0x7995('0x12')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x7995('0x20')](function(_0x5911c3){logger[_0x7995('0x14')](_0x5911c3);return _0x475351[_0x7995('0x11')](0x1f4)[_0x7995('0x12')](_0x5911c3);});};exports[_0x7995('0x21')]=function(_0x11c1eb,_0x4b6f99){var _0x9b2a15=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x7995('0x22')],'modelName':_0x7995('0x22'),'columnName':_0x7995('0x3')},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db['sequelize'][_0x7995('0x23')],function(){throw new Error(_0x7995('0x24'));}],'path':path[_0x7995('0x25')](config[_0x7995('0xa')],_0x7995('0x26'),_0x7995('0x21')),'pattern':/\.js$/}});_0x9b2a15['up']({'from':module['exports']['version']+_0x7995('0x27')})['then'](function(){return _0x4b6f99[_0x7995('0x11')](0xc8)[_0x7995('0x12')]({'output':_0x7995('0x28')});})[_0x7995('0x20')](function(_0x1f7d27){return _0x4b6f99['status'](0x1f4)[_0x7995('0x12')](_0x1f7d27);});}; \ No newline at end of file +var _0xa9e0=['master','error','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','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.','root','server','exports','.js','catch','umzug','path','pkginfo','exec','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index','version','latest','fetch','tags','status','json','origin'];(function(_0x1e6411,_0x1a90d4){var _0x135132=function(_0x12fb07){while(--_0x12fb07){_0x1e6411['push'](_0x1e6411['shift']());}};_0x135132(++_0x1a90d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var Umzug=require(_0x0a9e('0x0'));var path=require(_0x0a9e('0x1'));var pkginfo=require(_0x0a9e('0x2'))(module,'version');var exec=require('child_process')[_0x0a9e('0x3')];var db=require('../../mysqldb')['db'];var config=require(_0x0a9e('0x4'));var pm2=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var git=require(_0x0a9e('0x8'))(config['root']);exports[_0x0a9e('0x9')]=function(_0x441e3a,_0x2cc193){var _0x5f41ea={'current':module['exports'][_0x0a9e('0xa')],'phonebar':0x2};if(_0x441e3a['query']&&_0x441e3a['query'][_0x0a9e('0xb')]){return git[_0x0a9e('0xc')]()[_0x0a9e('0xd')](function(_0x3ab53f,_0xfeb75b){_0x5f41ea[_0x0a9e('0xb')]=(_0x3ab53f?module['exports']['version']:_0xfeb75b['latest'])||'2.0.0';return _0x2cc193[_0x0a9e('0xe')](0xc8)[_0x0a9e('0xf')](_0x5f41ea);});}else{return _0x2cc193[_0x0a9e('0xe')](0xc8)[_0x0a9e('0xf')](_0x5f41ea);}};exports[_0x0a9e('0xc')]=function(_0x69aeb7,_0x5db4b0){return git[_0x0a9e('0xc')]([_0x0a9e('0x10'),_0x0a9e('0x11')],function(_0x281129){if(_0x281129){logger[_0x0a9e('0x12')](_0x281129);return _0x5db4b0[_0x0a9e('0xe')](0x1f4)['json'](_0x281129);}logger[_0x0a9e('0x13')]('git\x20fetch');return _0x5db4b0[_0x0a9e('0xe')](0xc8)['json']({'output':_0x0a9e('0x14')});});};exports[_0x0a9e('0x15')]=function(_0x48f32d,_0x225616){return git['reset']([_0x0a9e('0x16'),_0x0a9e('0x17')],function(_0x106033){if(_0x106033){logger[_0x0a9e('0x12')](_0x106033);return _0x225616[_0x0a9e('0xe')](0x1f4)[_0x0a9e('0xf')](_0x106033);}logger[_0x0a9e('0x13')](_0x0a9e('0x18'));return _0x225616[_0x0a9e('0xe')](0xc8)[_0x0a9e('0xf')]({'output':_0x0a9e('0x19')});});};exports[_0x0a9e('0x1a')]=function(_0x4bb1e3,_0x2c3407){exec(_0x0a9e('0x1b'),function(_0x53682f,_0x20f109,_0x5a09ef){logger['info'](_0x20f109);logger[_0x0a9e('0x13')](_0x5a09ef);if(_0x53682f){logger[_0x0a9e('0x12')](_0x53682f);return _0x2c3407[_0x0a9e('0xe')](0x1f4)[_0x0a9e('0xf')](_0x53682f);}return _0x2c3407['status'](0xc8)[_0x0a9e('0xf')]({'output':_0x20f109});});};exports[_0x0a9e('0x1c')]=function(_0x3b45bc,_0x4d00e6){return pm2[_0x0a9e('0x1c')](_0x0a9e('0x1d'))[_0x0a9e('0x1e')](function(_0x5ea472){logger['info'](_0x0a9e('0x1f'),_0x5ea472);return _0x4d00e6[_0x0a9e('0xe')](0xc8)[_0x0a9e('0xf')]({'output':_0x0a9e('0x20')});})['catch'](function(_0x384319){logger['error'](_0x384319);return _0x4d00e6[_0x0a9e('0xe')](0x1f4)['json'](_0x384319);});};exports[_0x0a9e('0x21')]=function(_0x34dc65,_0x25fba9){var _0x14433c=new Umzug({'storage':_0x0a9e('0x22'),'storageOptions':{'model':db[_0x0a9e('0x23')],'modelName':_0x0a9e('0x23'),'columnName':_0x0a9e('0xa')},'migrations':{'params':[db['sequelize'][_0x0a9e('0x24')](),db[_0x0a9e('0x22')][_0x0a9e('0x25')],function(){throw new Error(_0x0a9e('0x26'));}],'path':path['join'](config[_0x0a9e('0x27')],_0x0a9e('0x28'),_0x0a9e('0x21')),'pattern':/\.js$/}});_0x14433c['up']({'from':module[_0x0a9e('0x29')][_0x0a9e('0xa')]+_0x0a9e('0x2a')})[_0x0a9e('0x1e')](function(){return _0x25fba9[_0x0a9e('0xe')](0xc8)[_0x0a9e('0xf')]({'output':'Database\x20Migration\x20Completed!'});})[_0x0a9e('0x2b')](function(_0x5d1e0e){return _0x25fba9[_0x0a9e('0xe')](0x1f4)[_0x0a9e('0xf')](_0x5d1e0e);});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 20dfb32..2c10e68 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 _0x0a6b=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','post','create','put','update','/:id','destroy','exports','multer','express'];(function(_0x24b7da,_0x5c096e){var _0x26cbbd=function(_0x509059){while(--_0x509059){_0x24b7da['push'](_0x24b7da['shift']());}};_0x26cbbd(++_0x5c096e);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x419f08,_0x140060){_0x419f08=_0x419f08-0x0;var _0x47b5f8=_0x0a6b[_0x419f08];return _0x47b5f8;};'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('./voiceAgentReport.controller');router[_0xb0a6('0x5')]('/',auth['isAuthenticated'](),controller[_0xb0a6('0x6')]);router[_0xb0a6('0x5')]('/describe',auth[_0xb0a6('0x7')](),controller[_0xb0a6('0x8')]);router[_0xb0a6('0x5')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xb0a6('0x9')]('/',auth[_0xb0a6('0x7')](),controller[_0xb0a6('0xa')]);router[_0xb0a6('0xb')]('/:id',auth[_0xb0a6('0x7')](),controller[_0xb0a6('0xc')]);router['delete'](_0xb0a6('0xd'),auth[_0xb0a6('0x7')](),controller[_0xb0a6('0xe')]);module[_0xb0a6('0xf')]=router; \ No newline at end of file +var _0x0295=['exports','multer','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','/:id','show','put','delete'];(function(_0x119602,_0x36ae98){var _0x3e447f=function(_0x4bce42){while(--_0x4bce42){_0x119602['push'](_0x119602['shift']());}};_0x3e447f(++_0x36ae98);}(_0x0295,0x1f0));var _0x5029=function(_0x4b85a3,_0x55a93f){_0x4b85a3=_0x4b85a3-0x0;var _0xcf8bc7=_0x0295[_0x4b85a3];return _0xcf8bc7;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x5029('0x2'));var interaction=require(_0x5029('0x3'));var config=require(_0x5029('0x4'));var controller=require(_0x5029('0x5'));router[_0x5029('0x6')]('/',auth[_0x5029('0x7')](),controller[_0x5029('0x8')]);router[_0x5029('0x6')](_0x5029('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x5029('0xa'),auth['isAuthenticated'](),controller[_0x5029('0xb')]);router['post']('/',auth[_0x5029('0x7')](),controller['create']);router[_0x5029('0xc')](_0x5029('0xa'),auth[_0x5029('0x7')](),controller['update']);router[_0x5029('0xd')](_0x5029('0xa'),auth[_0x5029('0x7')](),controller['destroy']);module[_0x5029('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 08c802e..8db3636 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 _0xc985=['BOOLEAN','sequelize','STRING','DATE','INTEGER'];(function(_0x25813b,_0x1b4aca){var _0x2247ae=function(_0xb60f32){while(--_0xb60f32){_0x25813b['push'](_0x25813b['shift']());}};_0x2247ae(++_0x1b4aca);}(_0xc985,0xfb));var _0x5c98=function(_0x2cf314,_0x62f3f5){_0x2cf314=_0x2cf314-0x0;var _0x4a08a3=_0xc985[_0x2cf314];return _0x4a08a3;};'use strict';var Sequelize=require(_0x5c98('0x0'));module['exports']={'type':{'type':Sequelize[_0x5c98('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x5c98('0x1')]},'calleridname':{'type':Sequelize[_0x5c98('0x1')]},'queue':{'type':Sequelize[_0x5c98('0x1')]},'interface':{'type':Sequelize[_0x5c98('0x1')]},'membername':{'type':Sequelize[_0x5c98('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x5c98('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x5c98('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x5c98('0x2')]},'agentdumpAt':{'type':Sequelize[_0x5c98('0x2')]},'holdtime':{'type':Sequelize[_0x5c98('0x3')]},'agentcomplete':{'type':Sequelize[_0x5c98('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x5c98('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x5c98('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x5c98('0x3')]},'reason':{'type':Sequelize[_0x5c98('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5c98('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x5c98('0x1')]},'connectedlinenum':{'type':Sequelize[_0x5c98('0x1')]},'connectedlinename':{'type':Sequelize[_0x5c98('0x1')]},'language':{'type':Sequelize[_0x5c98('0x1')]},'accountcode':{'type':Sequelize[_0x5c98('0x1')]},'context':{'type':Sequelize[_0x5c98('0x1')]},'exten':{'type':Sequelize[_0x5c98('0x1')]},'priority':{'type':Sequelize[_0x5c98('0x1')]},'destchannel':{'type':Sequelize[_0x5c98('0x1')]},'destchannelstate':{'type':Sequelize[_0x5c98('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x5c98('0x1')]},'destcalleridnum':{'type':Sequelize[_0x5c98('0x1')]},'destcalleridname':{'type':Sequelize[_0x5c98('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x5c98('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x5c98('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x5c98('0x1')]},'destcontext':{'type':Sequelize[_0x5c98('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x5c98('0x1')]}}; \ No newline at end of file +var _0x70ec=['BOOLEAN','exports','STRING','DATE','INTEGER'];(function(_0x5df343,_0x3e3c6d){var _0x40a7f1=function(_0x55388b){while(--_0x55388b){_0x5df343['push'](_0x5df343['shift']());}};_0x40a7f1(++_0x3e3c6d);}(_0x70ec,0x1f0));var _0xc70e=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x70ec[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require('sequelize');module[_0xc70e('0x0')]={'type':{'type':Sequelize[_0xc70e('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc70e('0x1')]},'calleridname':{'type':Sequelize[_0xc70e('0x1')]},'queue':{'type':Sequelize[_0xc70e('0x1')]},'interface':{'type':Sequelize[_0xc70e('0x1')]},'membername':{'type':Sequelize[_0xc70e('0x1')]},'agentcalledAt':{'type':Sequelize[_0xc70e('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xc70e('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xc70e('0x2')]},'agentdumpAt':{'type':Sequelize[_0xc70e('0x2')]},'holdtime':{'type':Sequelize[_0xc70e('0x3')]},'agentcomplete':{'type':Sequelize[_0xc70e('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xc70e('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xc70e('0x3')]},'agentacw':{'type':Sequelize[_0xc70e('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc70e('0x3')]},'reason':{'type':Sequelize[_0xc70e('0x1')]},'lastevent':{'type':Sequelize[_0xc70e('0x1')]},'channel':{'type':Sequelize[_0xc70e('0x1')]},'channelstate':{'type':Sequelize[_0xc70e('0x3')]},'channelstatedesc':{'type':Sequelize[_0xc70e('0x1')]},'connectedlinenum':{'type':Sequelize[_0xc70e('0x1')]},'connectedlinename':{'type':Sequelize[_0xc70e('0x1')]},'language':{'type':Sequelize[_0xc70e('0x1')]},'accountcode':{'type':Sequelize[_0xc70e('0x1')]},'context':{'type':Sequelize[_0xc70e('0x1')]},'exten':{'type':Sequelize[_0xc70e('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xc70e('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xc70e('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xc70e('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xc70e('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xc70e('0x1')]},'destaccountcode':{'type':Sequelize[_0xc70e('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xc70e('0x1')]},'destuniqueid':{'type':Sequelize[_0xc70e('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xc70e('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xc70e('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 9b3b161..2e5519e 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 _0xe007=['Content-Range','apply','save','update','then','sendStatus','error','stack','name','send','VoiceAgentReport','rawAttributes','model','keys','dateEnd','query','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filters','pick','add','day','merge','dateStart','filter','options','findAll','rows','catch','params','includeAll','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','status','end','json','count','offset','set'];(function(_0x191d52,_0x250701){var _0x1ecc49=function(_0x22870e){while(--_0x22870e){_0x191d52['push'](_0x191d52['shift']());}};_0x1ecc49(++_0x250701);}(_0xe007,0x103));var _0x7e00=function(_0xcae906,_0x36549a){_0xcae906=_0xcae906-0x0;var _0x94aedc=_0xe007[_0xcae906];return _0x94aedc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7e00('0x0'));var rimraf=require(_0x7e00('0x1'));var zipdir=require(_0x7e00('0x2'));var jsonpatch=require(_0x7e00('0x3'));var rp=require(_0x7e00('0x4'));var moment=require(_0x7e00('0x5'));var BPromise=require(_0x7e00('0x6'));var Mustache=require(_0x7e00('0x7'));var util=require(_0x7e00('0x8'));var path=require(_0x7e00('0x9'));var sox=require(_0x7e00('0xa'));var csv=require(_0x7e00('0xb'));var ejs=require(_0x7e00('0xc'));var fs=require('fs');var _=require(_0x7e00('0xd'));var squel=require('squel');var crypto=require(_0x7e00('0xe'));var jsforce=require(_0x7e00('0xf'));var deskjs=require(_0x7e00('0x10'));var toCsv=require(_0x7e00('0xb'));var querystring=require(_0x7e00('0x11'));var Papa=require('papaparse');var Redis=require(_0x7e00('0x12'));var qs=require(_0x7e00('0x13'));var logger=require(_0x7e00('0x14'))(_0x7e00('0x15'));var utils=require(_0x7e00('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52f511,_0x549a24){_0x549a24=_0x549a24||0xcc;return function(_0x4b555f){if(_0x4b555f){return _0x52f511['sendStatus'](_0x549a24);}return _0x52f511[_0x7e00('0x17')](_0x549a24)[_0x7e00('0x18')]();};}function respondWithResult(_0x106c0d,_0x11c8a8){_0x11c8a8=_0x11c8a8||0xc8;return function(_0x195785){if(_0x195785){return _0x106c0d[_0x7e00('0x17')](_0x11c8a8)[_0x7e00('0x19')](_0x195785);}};}function respondWithFilteredResult(_0x31211c,_0x1922bd){return function(_0x35db4b){if(_0x35db4b){var _0x7badb1=_0x35db4b[_0x7e00('0x1a')],_0x429908=_0x1922bd[_0x7e00('0x1b')],_0x56d769=_0x1922bd[_0x7e00('0x1b')]+_0x1922bd['limit'],_0x565d35;if(_0x56d769>=_0x7badb1){_0x56d769=_0x7badb1;_0x565d35=0xc8;}else{_0x565d35=0xce;}_0x31211c[_0x7e00('0x17')](_0x565d35);return _0x31211c[_0x7e00('0x1c')](_0x7e00('0x1d'),_0x429908+'-'+_0x56d769+'/'+_0x7badb1)[_0x7e00('0x19')](_0x35db4b);}return null;};}function patchUpdates(_0x3e845e){return function(_0x4ec9ea){try{jsonpatch[_0x7e00('0x1e')](_0x4ec9ea,_0x3e845e,!![]);}catch(_0x5a431b){return BPromise['reject'](_0x5a431b);}return _0x4ec9ea[_0x7e00('0x1f')]();};}function saveUpdates(_0xa7eb29,_0x354ddc){return function(_0x49cc71){if(_0x49cc71){return _0x49cc71[_0x7e00('0x20')](_0xa7eb29)['then'](function(_0x1f4315){return _0x1f4315;});}return null;};}function removeEntity(_0x3921fe,_0x48b7da){return function(_0x3b1f74){if(_0x3b1f74){return _0x3b1f74['destroy']()[_0x7e00('0x21')](function(){_0x3921fe[_0x7e00('0x17')](0xcc)[_0x7e00('0x18')]();});}};}function handleEntityNotFound(_0x254593,_0x458c16){return function(_0x3fd559){if(!_0x3fd559){_0x254593[_0x7e00('0x22')](0x194);}return _0x3fd559;};}function handleError(_0x44b005,_0x5a9862){_0x5a9862=_0x5a9862||0x1f4;return function(_0x47b730){logger[_0x7e00('0x23')](_0x47b730[_0x7e00('0x24')]);if(_0x47b730[_0x7e00('0x25')]){delete _0x47b730[_0x7e00('0x25')];}_0x44b005[_0x7e00('0x17')](_0x5a9862)[_0x7e00('0x26')](_0x47b730);};}exports['index']=function(_0x33a7a2,_0x31fb05){var _0xeb5163={},_0x263a33={},_0x2b8270={'count':0x0,'rows':[]};var _0x4d5bfb=db[_0x7e00('0x27')][_0x7e00('0x28')];_0x263a33[_0x7e00('0x29')]=_[_0x7e00('0x2a')](_0x4d5bfb);var _0x4cfbcc={'dateStart':_0x33a7a2['query']['dateStart'],'dateEnd':_0x33a7a2['query'][_0x7e00('0x2b')]};delete _0x33a7a2[_0x7e00('0x2c')]['dateStart'];delete _0x33a7a2[_0x7e00('0x2c')]['dateEnd'];_0x263a33[_0x7e00('0x2c')]=_[_0x7e00('0x2a')](_0x33a7a2[_0x7e00('0x2c')]);_0x263a33['filters']=_['intersection'](_0x263a33[_0x7e00('0x29')],_0x263a33[_0x7e00('0x2c')]);_0xeb5163['attributes']=_[_0x7e00('0x2d')](_0x263a33[_0x7e00('0x29')],qs[_0x7e00('0x2e')](_0x33a7a2[_0x7e00('0x2c')][_0x7e00('0x2e')]));_0xeb5163[_0x7e00('0x2f')]=_0xeb5163['attributes'][_0x7e00('0x30')]?_0xeb5163['attributes']:_0x263a33[_0x7e00('0x29')];if(!_0x33a7a2[_0x7e00('0x2c')][_0x7e00('0x31')]('nolimit')){_0xeb5163['limit']=qs[_0x7e00('0x32')](_0x33a7a2[_0x7e00('0x2c')][_0x7e00('0x32')]);_0xeb5163[_0x7e00('0x1b')]=qs[_0x7e00('0x1b')](_0x33a7a2[_0x7e00('0x2c')][_0x7e00('0x1b')]);}_0xeb5163[_0x7e00('0x33')]=qs['sort'](_0x33a7a2[_0x7e00('0x2c')][_0x7e00('0x34')]);_0xeb5163[_0x7e00('0x35')]=qs[_0x7e00('0x36')](_[_0x7e00('0x37')](_0x33a7a2[_0x7e00('0x2c')],_0x263a33[_0x7e00('0x36')]));if(_0x4cfbcc['dateStart']){if(_0x4cfbcc['dateEnd']){_0x4cfbcc[_0x7e00('0x2b')]=moment(_0x4cfbcc[_0x7e00('0x2b')])[_0x7e00('0x38')](0x1,_0x7e00('0x39'));}else{_0x4cfbcc[_0x7e00('0x2b')]=moment(_0x4cfbcc['dateStart'])[_0x7e00('0x38')](0x1,_0x7e00('0x39'));}_[_0x7e00('0x3a')](_0xeb5163[_0x7e00('0x35')],{'createdAt':{'$gte':_0x4cfbcc[_0x7e00('0x3b')],'$lte':_0x4cfbcc[_0x7e00('0x2b')]}});}if(_0x33a7a2['query'][_0x7e00('0x3c')]){_0xeb5163['where']=_['merge'](_0xeb5163[_0x7e00('0x35')],{'$or':_['map'](_0xeb5163['attributes'],function(_0x4aac65){var _0x35c224={};_0x35c224[_0x4aac65]={'$like':'%'+_0x33a7a2[_0x7e00('0x2c')][_0x7e00('0x3c')]+'%'};return _0x35c224;})});}_0xeb5163=_[_0x7e00('0x3a')]({},_0xeb5163,_0x33a7a2[_0x7e00('0x3d')]);var _0x4c77e2={'where':_0xeb5163[_0x7e00('0x35')]};return db[_0x7e00('0x27')][_0x7e00('0x1a')](_0x4c77e2)[_0x7e00('0x21')](function(_0xa05fb9){_0x2b8270[_0x7e00('0x1a')]=_0xa05fb9;if(_0x33a7a2[_0x7e00('0x2c')]['includeAll']){_0xeb5163['include']=[{'all':!![]}];}return db['VoiceAgentReport'][_0x7e00('0x3e')](_0xeb5163);})[_0x7e00('0x21')](function(_0x30c937){_0x2b8270[_0x7e00('0x3f')]=_0x30c937;return _0x2b8270;})['then'](respondWithFilteredResult(_0x31fb05,_0xeb5163))[_0x7e00('0x40')](handleError(_0x31fb05,null));};exports['show']=function(_0x14fd49,_0x4fce04){var _0x1c76e7={'raw':![],'where':{'id':_0x14fd49[_0x7e00('0x41')]['id']}},_0x3d8f30={};_0x3d8f30[_0x7e00('0x29')]=_[_0x7e00('0x2a')](db[_0x7e00('0x27')][_0x7e00('0x28')]);_0x3d8f30[_0x7e00('0x2c')]=_[_0x7e00('0x2a')](_0x14fd49[_0x7e00('0x2c')]);_0x3d8f30[_0x7e00('0x36')]=_[_0x7e00('0x2d')](_0x3d8f30[_0x7e00('0x29')],_0x3d8f30['query']);_0x1c76e7['attributes']=_['intersection'](_0x3d8f30[_0x7e00('0x29')],qs['fields'](_0x14fd49[_0x7e00('0x2c')]['fields']));_0x1c76e7[_0x7e00('0x2f')]=_0x1c76e7['attributes'][_0x7e00('0x30')]?_0x1c76e7['attributes']:_0x3d8f30[_0x7e00('0x29')];if(_0x14fd49['query'][_0x7e00('0x42')]){_0x1c76e7['include']=[{'all':!![]}];}_0x1c76e7=_[_0x7e00('0x3a')]({},_0x1c76e7,_0x14fd49['options']);return db[_0x7e00('0x27')][_0x7e00('0x43')](_0x1c76e7)[_0x7e00('0x21')](handleEntityNotFound(_0x4fce04,null))[_0x7e00('0x21')](respondWithResult(_0x4fce04,null))[_0x7e00('0x40')](handleError(_0x4fce04,null));};exports[_0x7e00('0x44')]=function(_0x205b9b,_0x48afed){return db[_0x7e00('0x27')][_0x7e00('0x44')](_0x205b9b[_0x7e00('0x45')],{})[_0x7e00('0x21')](respondWithResult(_0x48afed,0xc9))[_0x7e00('0x40')](handleError(_0x48afed,null));};exports[_0x7e00('0x20')]=function(_0x5ab921,_0x434d36){if(_0x5ab921[_0x7e00('0x45')]['id']){delete _0x5ab921[_0x7e00('0x45')]['id'];}return db[_0x7e00('0x27')]['find']({'where':{'id':_0x5ab921['params']['id']}})[_0x7e00('0x21')](handleEntityNotFound(_0x434d36,null))[_0x7e00('0x21')](saveUpdates(_0x5ab921[_0x7e00('0x45')],null))[_0x7e00('0x21')](respondWithResult(_0x434d36,null))[_0x7e00('0x40')](handleError(_0x434d36,null));};exports[_0x7e00('0x46')]=function(_0x413bc3,_0x9f0702){return db[_0x7e00('0x27')][_0x7e00('0x43')]({'where':{'id':_0x413bc3[_0x7e00('0x41')]['id']}})[_0x7e00('0x21')](handleEntityNotFound(_0x9f0702,null))[_0x7e00('0x21')](removeEntity(_0x9f0702,null))['catch'](handleError(_0x9f0702,null));};exports[_0x7e00('0x47')]=function(_0x45661b,_0x4b997d){return db[_0x7e00('0x27')][_0x7e00('0x47')]()[_0x7e00('0x21')](respondWithResult(_0x4b997d,null))[_0x7e00('0x40')](handleError(_0x4b997d,null));}; \ No newline at end of file +var _0x427c=['stack','name','send','index','rawAttributes','model','query','dateStart','dateEnd','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','day','merge','filter','map','options','VoiceAgentReport','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','squel','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','status','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','end','error'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x427c,0x17d));var _0xc427=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x427c[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xc427('0x0'));var emlformat=require(_0xc427('0x1'));var rimraf=require(_0xc427('0x2'));var zipdir=require(_0xc427('0x3'));var jsonpatch=require(_0xc427('0x4'));var rp=require('request-promise');var moment=require(_0xc427('0x5'));var BPromise=require(_0xc427('0x6'));var Mustache=require('mustache');var util=require(_0xc427('0x7'));var path=require(_0xc427('0x8'));var sox=require(_0xc427('0x9'));var csv=require(_0xc427('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xc427('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc427('0xa'));var querystring=require('querystring');var Papa=require(_0xc427('0xc'));var Redis=require(_0xc427('0xd'));var qs=require(_0xc427('0xe'));var logger=require(_0xc427('0xf'))(_0xc427('0x10'));var utils=require(_0xc427('0x11'));var config=require('../../config/environment');var db=require(_0xc427('0x12'))['db'];function respondWithStatusCode(_0x4fe654,_0x1dc3ac){_0x1dc3ac=_0x1dc3ac||0xcc;return function(_0x1b5312){if(_0x1b5312){return _0x4fe654['sendStatus'](_0x1dc3ac);}return _0x4fe654[_0xc427('0x13')](_0x1dc3ac)['end']();};}function respondWithResult(_0x56b2cb,_0x255441){_0x255441=_0x255441||0xc8;return function(_0x537381){if(_0x537381){return _0x56b2cb['status'](_0x255441)['json'](_0x537381);}};}function respondWithFilteredResult(_0x33ae0c,_0x54e64e){return function(_0x563e6d){if(_0x563e6d){var _0x4b614e=_0x563e6d[_0xc427('0x14')],_0x2ffe90=_0x54e64e[_0xc427('0x15')],_0x5b83b3=_0x54e64e[_0xc427('0x15')]+_0x54e64e[_0xc427('0x16')],_0x53eec1;if(_0x5b83b3>=_0x4b614e){_0x5b83b3=_0x4b614e;_0x53eec1=0xc8;}else{_0x53eec1=0xce;}_0x33ae0c[_0xc427('0x13')](_0x53eec1);return _0x33ae0c[_0xc427('0x17')](_0xc427('0x18'),_0x2ffe90+'-'+_0x5b83b3+'/'+_0x4b614e)[_0xc427('0x19')](_0x563e6d);}return null;};}function patchUpdates(_0x4bd231){return function(_0x45d588){try{jsonpatch[_0xc427('0x1a')](_0x45d588,_0x4bd231,!![]);}catch(_0x18e78c){return BPromise['reject'](_0x18e78c);}return _0x45d588[_0xc427('0x1b')]();};}function saveUpdates(_0x3597b3,_0x1a11fa){return function(_0x42147a){if(_0x42147a){return _0x42147a[_0xc427('0x1c')](_0x3597b3)[_0xc427('0x1d')](function(_0x27ef66){return _0x27ef66;});}return null;};}function removeEntity(_0x150c8f,_0x21de8d){return function(_0x42ec9b){if(_0x42ec9b){return _0x42ec9b[_0xc427('0x1e')]()[_0xc427('0x1d')](function(){_0x150c8f[_0xc427('0x13')](0xcc)[_0xc427('0x1f')]();});}};}function handleEntityNotFound(_0x42766d,_0x11146a){return function(_0xf708fb){if(!_0xf708fb){_0x42766d['sendStatus'](0x194);}return _0xf708fb;};}function handleError(_0x56fef2,_0x3e3b9c){_0x3e3b9c=_0x3e3b9c||0x1f4;return function(_0x4d2aef){logger[_0xc427('0x20')](_0x4d2aef[_0xc427('0x21')]);if(_0x4d2aef['name']){delete _0x4d2aef[_0xc427('0x22')];}_0x56fef2[_0xc427('0x13')](_0x3e3b9c)[_0xc427('0x23')](_0x4d2aef);};}exports[_0xc427('0x24')]=function(_0x4158e6,_0x13cb65){var _0x3d9417={},_0x2b29d0={},_0xde45ca={'count':0x0,'rows':[]};var _0xc44ea9=db['VoiceAgentReport'][_0xc427('0x25')];_0x2b29d0[_0xc427('0x26')]=_['keys'](_0xc44ea9);var _0x75dbc={'dateStart':_0x4158e6[_0xc427('0x27')][_0xc427('0x28')],'dateEnd':_0x4158e6['query'][_0xc427('0x29')]};delete _0x4158e6[_0xc427('0x27')]['dateStart'];delete _0x4158e6['query'][_0xc427('0x29')];_0x2b29d0[_0xc427('0x27')]=_[_0xc427('0x2a')](_0x4158e6['query']);_0x2b29d0['filters']=_[_0xc427('0x2b')](_0x2b29d0[_0xc427('0x26')],_0x2b29d0[_0xc427('0x27')]);_0x3d9417[_0xc427('0x2c')]=_[_0xc427('0x2b')](_0x2b29d0[_0xc427('0x26')],qs[_0xc427('0x2d')](_0x4158e6['query'][_0xc427('0x2d')]));_0x3d9417[_0xc427('0x2c')]=_0x3d9417[_0xc427('0x2c')][_0xc427('0x2e')]?_0x3d9417[_0xc427('0x2c')]:_0x2b29d0[_0xc427('0x26')];if(!_0x4158e6[_0xc427('0x27')][_0xc427('0x2f')]('nolimit')){_0x3d9417['limit']=qs[_0xc427('0x16')](_0x4158e6[_0xc427('0x27')][_0xc427('0x16')]);_0x3d9417[_0xc427('0x15')]=qs[_0xc427('0x15')](_0x4158e6[_0xc427('0x27')][_0xc427('0x15')]);}_0x3d9417[_0xc427('0x30')]=qs[_0xc427('0x31')](_0x4158e6[_0xc427('0x27')][_0xc427('0x31')]);_0x3d9417[_0xc427('0x32')]=qs[_0xc427('0x33')](_['pick'](_0x4158e6[_0xc427('0x27')],_0x2b29d0['filters']));if(_0x75dbc[_0xc427('0x28')]){if(_0x75dbc[_0xc427('0x29')]){_0x75dbc[_0xc427('0x29')]=moment(_0x75dbc[_0xc427('0x29')])['add'](0x1,_0xc427('0x34'));}else{_0x75dbc[_0xc427('0x29')]=moment(_0x75dbc[_0xc427('0x28')])['add'](0x1,_0xc427('0x34'));}_[_0xc427('0x35')](_0x3d9417[_0xc427('0x32')],{'createdAt':{'$gte':_0x75dbc[_0xc427('0x28')],'$lte':_0x75dbc[_0xc427('0x29')]}});}if(_0x4158e6[_0xc427('0x27')][_0xc427('0x36')]){_0x3d9417[_0xc427('0x32')]=_['merge'](_0x3d9417[_0xc427('0x32')],{'$or':_[_0xc427('0x37')](_0x3d9417['attributes'],function(_0x5a61d8){var _0xa7b66e={};_0xa7b66e[_0x5a61d8]={'$like':'%'+_0x4158e6[_0xc427('0x27')]['filter']+'%'};return _0xa7b66e;})});}_0x3d9417=_['merge']({},_0x3d9417,_0x4158e6[_0xc427('0x38')]);var _0x27eea3={'where':_0x3d9417['where']};return db[_0xc427('0x39')][_0xc427('0x14')](_0x27eea3)[_0xc427('0x1d')](function(_0x3a6503){_0xde45ca[_0xc427('0x14')]=_0x3a6503;if(_0x4158e6[_0xc427('0x27')][_0xc427('0x3a')]){_0x3d9417[_0xc427('0x3b')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0xc427('0x3c')](_0x3d9417);})[_0xc427('0x1d')](function(_0x5db792){_0xde45ca[_0xc427('0x3d')]=_0x5db792;return _0xde45ca;})[_0xc427('0x1d')](respondWithFilteredResult(_0x13cb65,_0x3d9417))[_0xc427('0x3e')](handleError(_0x13cb65,null));};exports[_0xc427('0x3f')]=function(_0x11ff0e,_0xbfcaed){var _0x193914={'raw':![],'where':{'id':_0x11ff0e['params']['id']}},_0x5452c8={};_0x5452c8[_0xc427('0x26')]=_[_0xc427('0x2a')](db[_0xc427('0x39')][_0xc427('0x25')]);_0x5452c8[_0xc427('0x27')]=_[_0xc427('0x2a')](_0x11ff0e['query']);_0x5452c8[_0xc427('0x33')]=_[_0xc427('0x2b')](_0x5452c8['model'],_0x5452c8[_0xc427('0x27')]);_0x193914['attributes']=_[_0xc427('0x2b')](_0x5452c8['model'],qs[_0xc427('0x2d')](_0x11ff0e[_0xc427('0x27')][_0xc427('0x2d')]));_0x193914[_0xc427('0x2c')]=_0x193914['attributes']['length']?_0x193914[_0xc427('0x2c')]:_0x5452c8[_0xc427('0x26')];if(_0x11ff0e[_0xc427('0x27')][_0xc427('0x3a')]){_0x193914['include']=[{'all':!![]}];}_0x193914=_[_0xc427('0x35')]({},_0x193914,_0x11ff0e[_0xc427('0x38')]);return db[_0xc427('0x39')][_0xc427('0x40')](_0x193914)[_0xc427('0x1d')](handleEntityNotFound(_0xbfcaed,null))[_0xc427('0x1d')](respondWithResult(_0xbfcaed,null))['catch'](handleError(_0xbfcaed,null));};exports[_0xc427('0x41')]=function(_0x2c58c3,_0x2b2cf4){return db[_0xc427('0x39')][_0xc427('0x41')](_0x2c58c3['body'],{})[_0xc427('0x1d')](respondWithResult(_0x2b2cf4,0xc9))[_0xc427('0x3e')](handleError(_0x2b2cf4,null));};exports[_0xc427('0x1c')]=function(_0x2e33f2,_0x5e4627){if(_0x2e33f2[_0xc427('0x42')]['id']){delete _0x2e33f2[_0xc427('0x42')]['id'];}return db['VoiceAgentReport'][_0xc427('0x40')]({'where':{'id':_0x2e33f2[_0xc427('0x43')]['id']}})[_0xc427('0x1d')](handleEntityNotFound(_0x5e4627,null))[_0xc427('0x1d')](saveUpdates(_0x2e33f2['body'],null))[_0xc427('0x1d')](respondWithResult(_0x5e4627,null))[_0xc427('0x3e')](handleError(_0x5e4627,null));};exports[_0xc427('0x1e')]=function(_0x38fe7e,_0x4d4898){return db[_0xc427('0x39')][_0xc427('0x40')]({'where':{'id':_0x38fe7e[_0xc427('0x43')]['id']}})[_0xc427('0x1d')](handleEntityNotFound(_0x4d4898,null))[_0xc427('0x1d')](removeEntity(_0x4d4898,null))[_0xc427('0x3e')](handleError(_0x4d4898,null));};exports[_0xc427('0x44')]=function(_0x1fe123,_0x2745f2){return db[_0xc427('0x39')]['describe']()[_0xc427('0x1d')](respondWithResult(_0x2745f2,null))['catch'](handleError(_0x2745f2,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 0994af4..8c23797 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 _0xa890=['uniqueid','lodash','util','../../config/logger','api','moment','request-promise','./voiceAgentReport.attributes','define','VoiceAgentReport'];(function(_0x2e8775,_0x310049){var _0x4cbf35=function(_0x103483){while(--_0x103483){_0x2e8775['push'](_0x2e8775['shift']());}};_0x4cbf35(++_0x310049);}(_0xa890,0x105));var _0x0a89=function(_0xe45118,_0x5dffbc){_0xe45118=_0xe45118-0x0;var _0x15e15d=_0xa890[_0xe45118];return _0x15e15d;};'use strict';var _=require(_0x0a89('0x0'));var util=require(_0x0a89('0x1'));var logger=require(_0x0a89('0x2'))(_0x0a89('0x3'));var moment=require(_0x0a89('0x4'));var BPromise=require('bluebird');var rp=require(_0x0a89('0x5'));var attributes=require(_0x0a89('0x6'));module['exports']=function(_0x152548,_0x334042){return _0x152548[_0x0a89('0x7')](_0x0a89('0x8'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x0a89('0x9'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2638=['destuniqueid','lodash','util','api','moment','bluebird','request-promise','./voiceAgentReport.attributes','define','VoiceAgentReport','report_agent','uniqueid'];(function(_0x639772,_0x19d681){var _0x54da9f=function(_0x1ef32b){while(--_0x1ef32b){_0x639772['push'](_0x639772['shift']());}};_0x54da9f(++_0x19d681);}(_0x2638,0xb5));var _0x8263=function(_0x352580,_0x40db47){_0x352580=_0x352580-0x0;var _0x459385=_0x2638[_0x352580];return _0x459385;};'use strict';var _=require(_0x8263('0x0'));var util=require(_0x8263('0x1'));var logger=require('../../config/logger')(_0x8263('0x2'));var moment=require(_0x8263('0x3'));var BPromise=require(_0x8263('0x4'));var rp=require(_0x8263('0x5'));var attributes=require(_0x8263('0x6'));module['exports']=function(_0x2f63cc,_0x2f6c15){return _0x2f63cc[_0x8263('0x7')](_0x8263('0x8'),attributes,{'tableName':_0x8263('0x9'),'paranoid':![],'indexes':[{'fields':[_0x8263('0xa'),_0x8263('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index dde6749..9840f15 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 _0x814b=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateVoiceAgentReport','body','raw','stringify','VoiceAgentReport','update','options','where','attributes','limit','UpdateVoiceAgentReport','lodash','util'];(function(_0x23f4cc,_0x4b6d1a){var _0x8d3d1a=function(_0xec5fd1){while(--_0xec5fd1){_0x23f4cc['push'](_0x23f4cc['shift']());}};_0x8d3d1a(++_0x4b6d1a);}(_0x814b,0x1a2));var _0xb814=function(_0x27638d,_0x4094db){_0x27638d=_0x27638d-0x0;var _0x35da35=_0x814b[_0x27638d];return _0x35da35;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['VoiceAgentReport']['create'](_0x55ba16[_0xb814('0x19')],{'raw':_0x55ba16['options']?_0x55ba16['options'][_0xb814('0x1a')]===undefined?!![]:![]:!![]})[_0xb814('0xd')](function(_0x25b6b6){logger['info'](_0xb814('0x18'),_0x55ba16);logger['debug'](_0xb814('0x18'),_0x55ba16,JSON[_0xb814('0x1b')](_0x25b6b6));_0xfac75b(_0x25b6b6);})[_0xb814('0x17')](function(_0x470e81){logger[_0xb814('0x13')](_0xb814('0x18'),_0x470e81[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x470e81[_0xb814('0x15')]));});});};exports['UpdateVoiceAgentReport']=function(_0x3f81d0){var _0x457dac=this;return new Promise(function(_0x31c7ec,_0x208927){return db[_0xb814('0x1c')][_0xb814('0x1d')](_0x3f81d0[_0xb814('0x19')],{'raw':_0x3f81d0['options']?_0x3f81d0[_0xb814('0x1e')][_0xb814('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f81d0[_0xb814('0x1e')]?_0x3f81d0[_0xb814('0x1e')][_0xb814('0x1f')]||null:null,'attributes':_0x3f81d0[_0xb814('0x1e')]?_0x3f81d0[_0xb814('0x1e')][_0xb814('0x20')]||null:null,'limit':_0x3f81d0['options']?_0x3f81d0[_0xb814('0x1e')][_0xb814('0x21')]||null:null})['then'](function(_0x9008b2){logger[_0xb814('0xe')](_0xb814('0x22'),_0x3f81d0);logger['debug'](_0xb814('0x22'),_0x3f81d0,JSON[_0xb814('0x1b')](_0x9008b2));_0x31c7ec(_0x9008b2);})['catch'](function(_0x338a28){logger['error'](_0xb814('0x22'),_0x338a28['message'],_0x3f81d0);_0x208927(_0x457dac['error'](0x1f4,_0x338a28[_0xb814('0x15')]));});});}; \ No newline at end of file +var _0x9957=['catch','CreateVoiceAgentReport','create','options','raw','UpdateVoiceAgentReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x5f10e5,_0xe1ac8e){var _0x355b1f=function(_0x374dcb){while(--_0x374dcb){_0x5f10e5['push'](_0x5f10e5['shift']());}};_0x355b1f(++_0xe1ac8e);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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']('VoiceAgentReport,\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['VoiceAgentReport'][_0x7995('0x19')](_0x291317['body'],{'raw':_0x291317['options']?_0x291317[_0x7995('0x1a')][_0x7995('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3a9b54){logger['info']('CreateVoiceAgentReport',_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x3a9b54));_0x37a7d4(_0x3a9b54);})[_0x7995('0x17')](function(_0x460924){logger[_0x7995('0x13')]('CreateVoiceAgentReport',_0x460924[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x460924[_0x7995('0x15')]));});});};exports[_0x7995('0x1c')]=function(_0x563799){var _0x13bc35=this;return new Promise(function(_0x475351,_0x472195){return db['VoiceAgentReport'][_0x7995('0x1d')](_0x563799[_0x7995('0x1e')],{'raw':_0x563799[_0x7995('0x1a')]?_0x563799[_0x7995('0x1a')][_0x7995('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x563799[_0x7995('0x1a')]?_0x563799['options'][_0x7995('0x1f')]||null:null,'attributes':_0x563799['options']?_0x563799[_0x7995('0x1a')][_0x7995('0x20')]||null:null,'limit':_0x563799[_0x7995('0x1a')]?_0x563799[_0x7995('0x1a')][_0x7995('0x21')]||null:null})['then'](function(_0x9b2a15){logger['info'](_0x7995('0x1c'),_0x563799);logger[_0x7995('0x10')](_0x7995('0x1c'),_0x563799,JSON['stringify'](_0x9b2a15));_0x475351(_0x9b2a15);})['catch'](function(_0x48e573){logger[_0x7995('0x13')](_0x7995('0x1c'),_0x48e573[_0x7995('0x15')],_0x563799);_0x472195(_0x13bc35[_0x7995('0x13')](0x1f4,_0x48e573[_0x7995('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 35651cd..fe103d4 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 _0xdc93=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','post','create','put','/:id','delete','destroy','exports','multer','path','express'];(function(_0x3605ec,_0x235dc7){var _0x4f9857=function(_0x33f514){while(--_0x33f514){_0x3605ec['push'](_0x3605ec['shift']());}};_0x4f9857(++_0x235dc7);}(_0xdc93,0x1c8));var _0x3dc9=function(_0x2984d0,_0x1a7211){_0x2984d0=_0x2984d0-0x0;var _0x2885f2=_0xdc93[_0x2984d0];return _0x2885f2;};'use strict';var multer=require(_0x3dc9('0x0'));var util=require('util');var path=require(_0x3dc9('0x1'));var timeout=require('connect-timeout');var express=require(_0x3dc9('0x2'));var router=express['Router']();var auth=require(_0x3dc9('0x3'));var interaction=require(_0x3dc9('0x4'));var config=require(_0x3dc9('0x5'));var controller=require('./voiceCallReport.controller');router[_0x3dc9('0x6')]('/',auth[_0x3dc9('0x7')](),controller['index']);router['get'](_0x3dc9('0x8'),auth[_0x3dc9('0x7')](),controller[_0x3dc9('0x9')]);router[_0x3dc9('0x6')]('/:id',auth[_0x3dc9('0x7')](),controller['show']);router[_0x3dc9('0xa')]('/',auth[_0x3dc9('0x7')](),controller[_0x3dc9('0xb')]);router[_0x3dc9('0xc')](_0x3dc9('0xd'),auth[_0x3dc9('0x7')](),controller['update']);router[_0x3dc9('0xe')](_0x3dc9('0xd'),auth[_0x3dc9('0x7')](),controller[_0x3dc9('0xf')]);module[_0x3dc9('0x10')]=router; \ No newline at end of file +var _0x8cb2=['create','put','delete','util','path','express','Router','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x3baaf2,_0x894e3d){var _0x50e8b0=function(_0x35dd6f){while(--_0x35dd6f){_0x3baaf2['push'](_0x3baaf2['shift']());}};_0x50e8b0(++_0x894e3d);}(_0x8cb2,0x18f));var _0x28cb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8cb2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x28cb('0x0'));var path=require(_0x28cb('0x1'));var timeout=require('connect-timeout');var express=require(_0x28cb('0x2'));var router=express[_0x28cb('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x28cb('0x4'));var config=require(_0x28cb('0x5'));var controller=require(_0x28cb('0x6'));router[_0x28cb('0x7')]('/',auth[_0x28cb('0x8')](),controller[_0x28cb('0x9')]);router['get'](_0x28cb('0xa'),auth[_0x28cb('0x8')](),controller[_0x28cb('0xb')]);router[_0x28cb('0x7')](_0x28cb('0xc'),auth[_0x28cb('0x8')](),controller[_0x28cb('0xd')]);router[_0x28cb('0xe')]('/',auth[_0x28cb('0x8')](),controller[_0x28cb('0xf')]);router[_0x28cb('0x10')](_0x28cb('0xc'),auth[_0x28cb('0x8')](),controller['update']);router[_0x28cb('0x11')](_0x28cb('0xc'),auth['isAuthenticated'](),controller['destroy']);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 1ac7372..44c866d 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 _0xe3c2=['outbound','inbound-fax','STRING','TEXT','DATE','INTEGER','exports','ENUM','internal'];(function(_0x56d776,_0x252211){var _0x2be469=function(_0x59e159){while(--_0x59e159){_0x56d776['push'](_0x56d776['shift']());}};_0x2be469(++_0x252211);}(_0xe3c2,0x10b));var _0x2e3c=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xe3c2[_0x55f8b4];return _0x2475f9;};'use strict';var Sequelize=require('sequelize');module[_0x2e3c('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2e3c('0x1')]('inbound',_0x2e3c('0x2'),_0x2e3c('0x3'),_0x2e3c('0x4'),'outbound-fax','dialer')},'tag':{'type':Sequelize[_0x2e3c('0x5')]},'accountcode':{'type':Sequelize[_0x2e3c('0x5')]},'source':{'type':Sequelize[_0x2e3c('0x5')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x2e3c('0x5')]},'channel':{'type':Sequelize[_0x2e3c('0x5')]},'destinationchannel':{'type':Sequelize[_0x2e3c('0x5')]},'lastapplication':{'type':Sequelize[_0x2e3c('0x5')]},'lastdata':{'type':Sequelize[_0x2e3c('0x6')]},'starttime':{'type':Sequelize[_0x2e3c('0x7')]},'answertime':{'type':Sequelize[_0x2e3c('0x7')]},'endtime':{'type':Sequelize[_0x2e3c('0x7')]},'duration':{'type':Sequelize[_0x2e3c('0x8')]},'billableseconds':{'type':Sequelize[_0x2e3c('0x8')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x2e3c('0x5')]},'amaflags':{'type':Sequelize[_0x2e3c('0x5')]},'userfield':{'type':Sequelize[_0x2e3c('0x5')]},'userDisposition':{'type':Sequelize[_0x2e3c('0x5')]},'note':{'type':Sequelize[_0x2e3c('0x5')]},'prefix':{'type':Sequelize[_0x2e3c('0x5')]},'routeid':{'type':Sequelize[_0x2e3c('0x8')]}}; \ No newline at end of file +var _0x80e0=['DATE','INTEGER','sequelize','STRING','ENUM','internal','inbound-fax','outbound-fax','dialer','TEXT'];(function(_0x382201,_0x3f8f89){var _0xb375ea=function(_0x1356ef){while(--_0x1356ef){_0x382201['push'](_0x382201['shift']());}};_0xb375ea(++_0x3f8f89);}(_0x80e0,0x1d8));var _0x080e=function(_0x55e383,_0x29ca50){_0x55e383=_0x55e383-0x0;var _0x3feac2=_0x80e0[_0x55e383];return _0x3feac2;};'use strict';var Sequelize=require(_0x080e('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x080e('0x1')]},'type':{'type':Sequelize[_0x080e('0x2')]('inbound',_0x080e('0x3'),'outbound',_0x080e('0x4'),_0x080e('0x5'),_0x080e('0x6'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x080e('0x1')]},'source':{'type':Sequelize[_0x080e('0x1')]},'destination':{'type':Sequelize[_0x080e('0x1')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x080e('0x1')]},'destinationchannel':{'type':Sequelize[_0x080e('0x1')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x080e('0x7')]},'starttime':{'type':Sequelize[_0x080e('0x8')]},'answertime':{'type':Sequelize[_0x080e('0x8')]},'endtime':{'type':Sequelize[_0x080e('0x8')]},'duration':{'type':Sequelize[_0x080e('0x9')]},'billableseconds':{'type':Sequelize[_0x080e('0x9')]},'mohtime':{'type':Sequelize[_0x080e('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x080e('0x1')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x080e('0x1')]},'userDisposition':{'type':Sequelize[_0x080e('0x1')]},'note':{'type':Sequelize[_0x080e('0x1')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x080e('0x9')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 46175c4..e981584 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 _0x6b38=['add','day','merge','filter','options','includeAll','fullname','alias','User','findAll','catch','show','params','length','include','find','create','body','describe','update','uniqueid','user','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','name','send','VoiceCallReport','rawAttributes','keys','dateStart','query','dateEnd','intersection','attributes','model','fields','order','sort','where','filters'];(function(_0x30faec,_0x18940b){var _0x29484f=function(_0x169ae8){while(--_0x169ae8){_0x30faec['push'](_0x30faec['shift']());}};_0x29484f(++_0x18940b);}(_0x6b38,0xee));var _0x86b3=function(_0x276d0a,_0x37b86c){_0x276d0a=_0x276d0a-0x0;var _0x4baea7=_0x6b38[_0x276d0a];return _0x4baea7;};'use strict';var pdf=require(_0x86b3('0x0'));var emlformat=require(_0x86b3('0x1'));var rimraf=require(_0x86b3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x86b3('0x3'));var rp=require(_0x86b3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x86b3('0x5'));var util=require(_0x86b3('0x6'));var path=require('path');var sox=require(_0x86b3('0x7'));var csv=require(_0x86b3('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x86b3('0x9'));var squel=require(_0x86b3('0xa'));var crypto=require(_0x86b3('0xb'));var jsforce=require(_0x86b3('0xc'));var deskjs=require(_0x86b3('0xd'));var toCsv=require(_0x86b3('0x8'));var querystring=require(_0x86b3('0xe'));var Papa=require(_0x86b3('0xf'));var Redis=require(_0x86b3('0x10'));var qs=require(_0x86b3('0x11'));var logger=require(_0x86b3('0x12'))(_0x86b3('0x13'));var utils=require(_0x86b3('0x14'));var config=require('../../config/environment');var db=require(_0x86b3('0x15'))['db'];function respondWithStatusCode(_0xdbc540,_0x1cd6b3){_0x1cd6b3=_0x1cd6b3||0xcc;return function(_0x25c7f1){if(_0x25c7f1){return _0xdbc540['sendStatus'](_0x1cd6b3);}return _0xdbc540['status'](_0x1cd6b3)[_0x86b3('0x16')]();};}function respondWithResult(_0x445be4,_0x1d45db){_0x1d45db=_0x1d45db||0xc8;return function(_0x39c09a){if(_0x39c09a){return _0x445be4[_0x86b3('0x17')](_0x1d45db)[_0x86b3('0x18')](_0x39c09a);}};}function respondWithFilteredResult(_0x24de99,_0x5bc0d2){return function(_0x16d347){if(_0x16d347){var _0xff1f00=_0x16d347[_0x86b3('0x19')],_0x4b9d30=_0x5bc0d2[_0x86b3('0x1a')],_0x563706=_0x5bc0d2[_0x86b3('0x1a')]+_0x5bc0d2[_0x86b3('0x1b')],_0x338804;if(_0x563706>=_0xff1f00){_0x563706=_0xff1f00;_0x338804=0xc8;}else{_0x338804=0xce;}_0x24de99[_0x86b3('0x17')](_0x338804);return _0x24de99[_0x86b3('0x1c')](_0x86b3('0x1d'),_0x4b9d30+'-'+_0x563706+'/'+_0xff1f00)[_0x86b3('0x18')](_0x16d347);}return null;};}function patchUpdates(_0x88eb12){return function(_0x2a3157){try{jsonpatch[_0x86b3('0x1e')](_0x2a3157,_0x88eb12,!![]);}catch(_0x9bc5d3){return BPromise[_0x86b3('0x1f')](_0x9bc5d3);}return _0x2a3157['save']();};}function saveUpdates(_0x3e7854,_0x1fe6be){return function(_0x2a9cbd){if(_0x2a9cbd){return _0x2a9cbd['update'](_0x3e7854)[_0x86b3('0x20')](function(_0x3f3d03){return _0x3f3d03;});}return null;};}function removeEntity(_0x4d6aa1,_0x26851e){return function(_0x4b95b4){if(_0x4b95b4){return _0x4b95b4[_0x86b3('0x21')]()[_0x86b3('0x20')](function(){_0x4d6aa1[_0x86b3('0x17')](0xcc)[_0x86b3('0x16')]();});}};}function handleEntityNotFound(_0x24d152,_0x4b5d70){return function(_0x5818d2){if(!_0x5818d2){_0x24d152['sendStatus'](0x194);}return _0x5818d2;};}function handleError(_0xe1a464,_0x24954c){_0x24954c=_0x24954c||0x1f4;return function(_0x28eabe){logger['error'](_0x28eabe['stack']);if(_0x28eabe[_0x86b3('0x22')]){delete _0x28eabe[_0x86b3('0x22')];}_0xe1a464[_0x86b3('0x17')](_0x24954c)[_0x86b3('0x23')](_0x28eabe);};}exports['index']=function(_0x157df4,_0x3c3ced){var _0x244c66={},_0x3e2bf1={},_0x431a81={'count':0x0,'rows':[]};var _0x1ba5da=db[_0x86b3('0x24')][_0x86b3('0x25')];_0x3e2bf1['model']=_[_0x86b3('0x26')](_0x1ba5da);var _0x493807={'dateStart':_0x157df4['query'][_0x86b3('0x27')],'dateEnd':_0x157df4[_0x86b3('0x28')][_0x86b3('0x29')]};delete _0x157df4['query'][_0x86b3('0x27')];delete _0x157df4['query'][_0x86b3('0x29')];_0x3e2bf1[_0x86b3('0x28')]=_[_0x86b3('0x26')](_0x157df4[_0x86b3('0x28')]);_0x3e2bf1['filters']=_[_0x86b3('0x2a')](_0x3e2bf1['model'],_0x3e2bf1[_0x86b3('0x28')]);_0x244c66[_0x86b3('0x2b')]=_[_0x86b3('0x2a')](_0x3e2bf1[_0x86b3('0x2c')],qs[_0x86b3('0x2d')](_0x157df4['query'][_0x86b3('0x2d')]));_0x244c66[_0x86b3('0x2b')]=_0x244c66[_0x86b3('0x2b')]['length']?_0x244c66[_0x86b3('0x2b')]:_0x3e2bf1[_0x86b3('0x2c')];if(!_0x157df4['query']['hasOwnProperty']('nolimit')){_0x244c66['limit']=qs[_0x86b3('0x1b')](_0x157df4[_0x86b3('0x28')][_0x86b3('0x1b')]);_0x244c66[_0x86b3('0x1a')]=qs[_0x86b3('0x1a')](_0x157df4['query'][_0x86b3('0x1a')]);}_0x244c66[_0x86b3('0x2e')]=qs[_0x86b3('0x2f')](_0x157df4[_0x86b3('0x28')]['sort']);_0x244c66[_0x86b3('0x30')]=qs[_0x86b3('0x31')](_['pick'](_0x157df4[_0x86b3('0x28')],_0x3e2bf1[_0x86b3('0x31')]));if(_0x493807[_0x86b3('0x27')]){if(_0x493807[_0x86b3('0x29')]){_0x493807[_0x86b3('0x29')]=moment(_0x493807[_0x86b3('0x29')])['add'](0x1,'day');}else{_0x493807[_0x86b3('0x29')]=moment(_0x493807[_0x86b3('0x27')])[_0x86b3('0x32')](0x1,_0x86b3('0x33'));}_[_0x86b3('0x34')](_0x244c66[_0x86b3('0x30')],{'createdAt':{'$gte':_0x493807[_0x86b3('0x27')],'$lte':_0x493807[_0x86b3('0x29')]}});}if(_0x157df4['query'][_0x86b3('0x35')]){_0x244c66[_0x86b3('0x30')]=_[_0x86b3('0x34')](_0x244c66[_0x86b3('0x30')],{'$or':_['map'](_0x244c66[_0x86b3('0x2b')],function(_0x1abd1e){var _0x40c76d={};_0x40c76d[_0x1abd1e]={'$like':'%'+_0x157df4[_0x86b3('0x28')][_0x86b3('0x35')]+'%'};return _0x40c76d;})});}_0x244c66=_[_0x86b3('0x34')]({},_0x244c66,_0x157df4[_0x86b3('0x36')]);var _0x33f0fc={'where':_0x244c66[_0x86b3('0x30')]};return db[_0x86b3('0x24')]['count'](_0x33f0fc)['then'](function(_0x39c3e7){_0x431a81[_0x86b3('0x19')]=_0x39c3e7;if(_0x157df4['query'][_0x86b3('0x37')]){_0x244c66['include']=[{'attributes':['id','name',_0x86b3('0x38'),_0x86b3('0x39')],'model':db[_0x86b3('0x3a')],'as':'User'}];}return db[_0x86b3('0x24')][_0x86b3('0x3b')](_0x244c66);})[_0x86b3('0x20')](function(_0x3a6cb9){_0x431a81['rows']=_0x3a6cb9;return _0x431a81;})[_0x86b3('0x20')](respondWithFilteredResult(_0x3c3ced,_0x244c66))[_0x86b3('0x3c')](handleError(_0x3c3ced,null));};exports[_0x86b3('0x3d')]=function(_0x48ba1b,_0x5eb1c3){var _0x578393={'raw':!![],'where':{'id':_0x48ba1b[_0x86b3('0x3e')]['id']}},_0x337fd2={};_0x337fd2[_0x86b3('0x2c')]=_[_0x86b3('0x26')](db['VoiceCallReport']['rawAttributes']);_0x337fd2[_0x86b3('0x28')]=_[_0x86b3('0x26')](_0x48ba1b[_0x86b3('0x28')]);_0x337fd2[_0x86b3('0x31')]=_['intersection'](_0x337fd2['model'],_0x337fd2[_0x86b3('0x28')]);_0x578393['attributes']=_['intersection'](_0x337fd2[_0x86b3('0x2c')],qs[_0x86b3('0x2d')](_0x48ba1b[_0x86b3('0x28')][_0x86b3('0x2d')]));_0x578393[_0x86b3('0x2b')]=_0x578393[_0x86b3('0x2b')][_0x86b3('0x3f')]?_0x578393[_0x86b3('0x2b')]:_0x337fd2[_0x86b3('0x2c')];if(_0x48ba1b[_0x86b3('0x28')][_0x86b3('0x37')]){_0x578393[_0x86b3('0x40')]=[{'all':!![]}];}_0x578393=_[_0x86b3('0x34')]({},_0x578393,_0x48ba1b[_0x86b3('0x36')]);return db[_0x86b3('0x24')][_0x86b3('0x41')](_0x578393)[_0x86b3('0x20')](handleEntityNotFound(_0x5eb1c3,null))[_0x86b3('0x20')](respondWithResult(_0x5eb1c3,null))[_0x86b3('0x3c')](handleError(_0x5eb1c3,null));};exports[_0x86b3('0x42')]=function(_0x226e2d,_0x148eab){return db[_0x86b3('0x24')]['create'](_0x226e2d[_0x86b3('0x43')],{})[_0x86b3('0x20')](respondWithResult(_0x148eab,0xc9))[_0x86b3('0x3c')](handleError(_0x148eab,null));};exports[_0x86b3('0x21')]=function(_0x146425,_0x11ae3b){return db[_0x86b3('0x24')]['find']({'where':{'id':_0x146425[_0x86b3('0x3e')]['id']}})[_0x86b3('0x20')](handleEntityNotFound(_0x11ae3b,null))[_0x86b3('0x20')](removeEntity(_0x11ae3b,null))[_0x86b3('0x3c')](handleError(_0x11ae3b,null));};exports[_0x86b3('0x44')]=function(_0x1f1900,_0x4536b3){return db['VoiceCallReport']['describe']()[_0x86b3('0x20')](respondWithResult(_0x4536b3,null))[_0x86b3('0x3c')](handleError(_0x4536b3,null));};exports[_0x86b3('0x45')]=function(_0x49baa0,_0x577b9a){if(_0x49baa0[_0x86b3('0x43')][_0x86b3('0x46')]){delete _0x49baa0[_0x86b3('0x43')][_0x86b3('0x46')];}return db[_0x86b3('0x24')][_0x86b3('0x41')]({'where':{'uniqueid':_0x49baa0[_0x86b3('0x3e')]['id'],'UserId':{'$or':[null,_0x49baa0[_0x86b3('0x47')]['id']]}}})['then'](handleEntityNotFound(_0x577b9a,null))['then'](saveUpdates(_0x49baa0[_0x86b3('0x43')],null))[_0x86b3('0x20')](respondWithResult(_0x577b9a,null))[_0x86b3('0x3c')](handleError(_0x577b9a,null));}; \ No newline at end of file +var _0x1242=['api','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','then','stack','name','index','VoiceCallReport','rawAttributes','query','dateStart','dateEnd','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','limit','order','sort','where','day','merge','filter','options','include','fullname','alias','User','findAll','rows','catch','show','params','includeAll','find','create','body','destroy','describe','update','uniqueid','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','papaparse','ioredis','../../config/logger'];(function(_0x114a18,_0x284f10){var _0x250d0e=function(_0x32ec79){while(--_0x32ec79){_0x114a18['push'](_0x114a18['shift']());}};_0x250d0e(++_0x284f10);}(_0x1242,0x1e0));var _0x2124=function(_0x5f12b5,_0xaddf89){_0x5f12b5=_0x5f12b5-0x0;var _0x581586=_0x1242[_0x5f12b5];return _0x581586;};'use strict';var pdf=require(_0x2124('0x0'));var emlformat=require(_0x2124('0x1'));var rimraf=require(_0x2124('0x2'));var zipdir=require(_0x2124('0x3'));var jsonpatch=require(_0x2124('0x4'));var rp=require(_0x2124('0x5'));var moment=require('moment');var BPromise=require(_0x2124('0x6'));var Mustache=require(_0x2124('0x7'));var util=require(_0x2124('0x8'));var path=require(_0x2124('0x9'));var sox=require('sox');var csv=require(_0x2124('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2124('0xb'));var squel=require(_0x2124('0xc'));var crypto=require('crypto');var jsforce=require(_0x2124('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2124('0xa'));var querystring=require('querystring');var Papa=require(_0x2124('0xe'));var Redis=require(_0x2124('0xf'));var qs=require('../../components/parsers/qs');var logger=require(_0x2124('0x10'))(_0x2124('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x2124('0x12'))['db'];function respondWithStatusCode(_0x19c84c,_0x434d7c){_0x434d7c=_0x434d7c||0xcc;return function(_0x3424fb){if(_0x3424fb){return _0x19c84c[_0x2124('0x13')](_0x434d7c);}return _0x19c84c[_0x2124('0x14')](_0x434d7c)[_0x2124('0x15')]();};}function respondWithResult(_0x2d5c37,_0x69d4e0){_0x69d4e0=_0x69d4e0||0xc8;return function(_0x5cac61){if(_0x5cac61){return _0x2d5c37[_0x2124('0x14')](_0x69d4e0)[_0x2124('0x16')](_0x5cac61);}};}function respondWithFilteredResult(_0x5bf92a,_0x50c3e7){return function(_0x42e30f){if(_0x42e30f){var _0x5ee1ca=_0x42e30f[_0x2124('0x17')],_0x1dd01a=_0x50c3e7[_0x2124('0x18')],_0x348cc1=_0x50c3e7[_0x2124('0x18')]+_0x50c3e7['limit'],_0x81730c;if(_0x348cc1>=_0x5ee1ca){_0x348cc1=_0x5ee1ca;_0x81730c=0xc8;}else{_0x81730c=0xce;}_0x5bf92a[_0x2124('0x14')](_0x81730c);return _0x5bf92a[_0x2124('0x19')](_0x2124('0x1a'),_0x1dd01a+'-'+_0x348cc1+'/'+_0x5ee1ca)[_0x2124('0x16')](_0x42e30f);}return null;};}function patchUpdates(_0x2f230d){return function(_0x5188fd){try{jsonpatch[_0x2124('0x1b')](_0x5188fd,_0x2f230d,!![]);}catch(_0x2df26a){return BPromise['reject'](_0x2df26a);}return _0x5188fd[_0x2124('0x1c')]();};}function saveUpdates(_0x13f4df,_0x46dcbe){return function(_0x11d22e){if(_0x11d22e){return _0x11d22e['update'](_0x13f4df)[_0x2124('0x1d')](function(_0x108434){return _0x108434;});}return null;};}function removeEntity(_0x4561a5,_0x1b24a3){return function(_0x50d55a){if(_0x50d55a){return _0x50d55a['destroy']()[_0x2124('0x1d')](function(){_0x4561a5[_0x2124('0x14')](0xcc)[_0x2124('0x15')]();});}};}function handleEntityNotFound(_0x56bcfe,_0x513c3a){return function(_0x1ab752){if(!_0x1ab752){_0x56bcfe[_0x2124('0x13')](0x194);}return _0x1ab752;};}function handleError(_0x10b823,_0x1b921d){_0x1b921d=_0x1b921d||0x1f4;return function(_0x3c496e){logger['error'](_0x3c496e[_0x2124('0x1e')]);if(_0x3c496e[_0x2124('0x1f')]){delete _0x3c496e[_0x2124('0x1f')];}_0x10b823['status'](_0x1b921d)['send'](_0x3c496e);};}exports[_0x2124('0x20')]=function(_0x3207b7,_0xf64dcc){var _0x51c49e={},_0x2c9de7={},_0x4c249b={'count':0x0,'rows':[]};var _0x583d09=db[_0x2124('0x21')][_0x2124('0x22')];_0x2c9de7['model']=_['keys'](_0x583d09);var _0x42640d={'dateStart':_0x3207b7[_0x2124('0x23')][_0x2124('0x24')],'dateEnd':_0x3207b7['query'][_0x2124('0x25')]};delete _0x3207b7[_0x2124('0x23')]['dateStart'];delete _0x3207b7[_0x2124('0x23')]['dateEnd'];_0x2c9de7[_0x2124('0x23')]=_[_0x2124('0x26')](_0x3207b7[_0x2124('0x23')]);_0x2c9de7[_0x2124('0x27')]=_[_0x2124('0x28')](_0x2c9de7['model'],_0x2c9de7[_0x2124('0x23')]);_0x51c49e[_0x2124('0x29')]=_[_0x2124('0x28')](_0x2c9de7[_0x2124('0x2a')],qs['fields'](_0x3207b7[_0x2124('0x23')][_0x2124('0x2b')]));_0x51c49e['attributes']=_0x51c49e[_0x2124('0x29')][_0x2124('0x2c')]?_0x51c49e[_0x2124('0x29')]:_0x2c9de7[_0x2124('0x2a')];if(!_0x3207b7[_0x2124('0x23')][_0x2124('0x2d')]('nolimit')){_0x51c49e['limit']=qs[_0x2124('0x2e')](_0x3207b7[_0x2124('0x23')][_0x2124('0x2e')]);_0x51c49e[_0x2124('0x18')]=qs[_0x2124('0x18')](_0x3207b7['query'][_0x2124('0x18')]);}_0x51c49e[_0x2124('0x2f')]=qs[_0x2124('0x30')](_0x3207b7[_0x2124('0x23')][_0x2124('0x30')]);_0x51c49e[_0x2124('0x31')]=qs[_0x2124('0x27')](_['pick'](_0x3207b7[_0x2124('0x23')],_0x2c9de7[_0x2124('0x27')]));if(_0x42640d[_0x2124('0x24')]){if(_0x42640d['dateEnd']){_0x42640d[_0x2124('0x25')]=moment(_0x42640d['dateEnd'])['add'](0x1,_0x2124('0x32'));}else{_0x42640d[_0x2124('0x25')]=moment(_0x42640d[_0x2124('0x24')])['add'](0x1,_0x2124('0x32'));}_[_0x2124('0x33')](_0x51c49e[_0x2124('0x31')],{'createdAt':{'$gte':_0x42640d['dateStart'],'$lte':_0x42640d['dateEnd']}});}if(_0x3207b7[_0x2124('0x23')]['filter']){_0x51c49e[_0x2124('0x31')]=_['merge'](_0x51c49e[_0x2124('0x31')],{'$or':_['map'](_0x51c49e[_0x2124('0x29')],function(_0x2330a1){var _0xcd4a12={};_0xcd4a12[_0x2330a1]={'$like':'%'+_0x3207b7['query'][_0x2124('0x34')]+'%'};return _0xcd4a12;})});}_0x51c49e=_[_0x2124('0x33')]({},_0x51c49e,_0x3207b7[_0x2124('0x35')]);var _0x3a4788={'where':_0x51c49e[_0x2124('0x31')]};return db[_0x2124('0x21')][_0x2124('0x17')](_0x3a4788)[_0x2124('0x1d')](function(_0x71f67c){_0x4c249b[_0x2124('0x17')]=_0x71f67c;if(_0x3207b7['query']['includeAll']){_0x51c49e[_0x2124('0x36')]=[{'attributes':['id',_0x2124('0x1f'),_0x2124('0x37'),_0x2124('0x38')],'model':db[_0x2124('0x39')],'as':'User'}];}return db[_0x2124('0x21')][_0x2124('0x3a')](_0x51c49e);})[_0x2124('0x1d')](function(_0x523629){_0x4c249b[_0x2124('0x3b')]=_0x523629;return _0x4c249b;})['then'](respondWithFilteredResult(_0xf64dcc,_0x51c49e))[_0x2124('0x3c')](handleError(_0xf64dcc,null));};exports[_0x2124('0x3d')]=function(_0x568706,_0x4eeab8){var _0x313581={'raw':!![],'where':{'id':_0x568706[_0x2124('0x3e')]['id']}},_0xd0abae={};_0xd0abae[_0x2124('0x2a')]=_[_0x2124('0x26')](db['VoiceCallReport'][_0x2124('0x22')]);_0xd0abae['query']=_['keys'](_0x568706[_0x2124('0x23')]);_0xd0abae[_0x2124('0x27')]=_[_0x2124('0x28')](_0xd0abae[_0x2124('0x2a')],_0xd0abae['query']);_0x313581[_0x2124('0x29')]=_['intersection'](_0xd0abae[_0x2124('0x2a')],qs['fields'](_0x568706[_0x2124('0x23')][_0x2124('0x2b')]));_0x313581[_0x2124('0x29')]=_0x313581[_0x2124('0x29')][_0x2124('0x2c')]?_0x313581[_0x2124('0x29')]:_0xd0abae['model'];if(_0x568706[_0x2124('0x23')][_0x2124('0x3f')]){_0x313581['include']=[{'all':!![]}];}_0x313581=_[_0x2124('0x33')]({},_0x313581,_0x568706[_0x2124('0x35')]);return db[_0x2124('0x21')][_0x2124('0x40')](_0x313581)[_0x2124('0x1d')](handleEntityNotFound(_0x4eeab8,null))['then'](respondWithResult(_0x4eeab8,null))['catch'](handleError(_0x4eeab8,null));};exports[_0x2124('0x41')]=function(_0x3fcab2,_0x5ce245){return db[_0x2124('0x21')][_0x2124('0x41')](_0x3fcab2[_0x2124('0x42')],{})['then'](respondWithResult(_0x5ce245,0xc9))['catch'](handleError(_0x5ce245,null));};exports[_0x2124('0x43')]=function(_0x59927b,_0xce9542){return db[_0x2124('0x21')]['find']({'where':{'id':_0x59927b['params']['id']}})[_0x2124('0x1d')](handleEntityNotFound(_0xce9542,null))[_0x2124('0x1d')](removeEntity(_0xce9542,null))['catch'](handleError(_0xce9542,null));};exports[_0x2124('0x44')]=function(_0x38827b,_0x3b7a03){return db[_0x2124('0x21')][_0x2124('0x44')]()[_0x2124('0x1d')](respondWithResult(_0x3b7a03,null))[_0x2124('0x3c')](handleError(_0x3b7a03,null));};exports[_0x2124('0x45')]=function(_0x5ba530,_0x27ed29){if(_0x5ba530[_0x2124('0x42')][_0x2124('0x46')]){delete _0x5ba530['body']['uniqueid'];}return db[_0x2124('0x21')][_0x2124('0x40')]({'where':{'uniqueid':_0x5ba530[_0x2124('0x3e')]['id'],'UserId':{'$or':[null,_0x5ba530['user']['id']]}}})['then'](handleEntityNotFound(_0x27ed29,null))[_0x2124('0x1d')](saveUpdates(_0x5ba530[_0x2124('0x42')],null))[_0x2124('0x1d')](respondWithResult(_0x27ed29,null))[_0x2124('0x3c')](handleError(_0x27ed29,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index c21acdd..dce3337 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 _0x4113=['./voiceCallReport.attributes','exports','define','report_call','lodash','util','moment'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x4113,0xb3));var _0x3411=function(_0x4b38f3,_0x50abe0){_0x4b38f3=_0x4b38f3-0x0;var _0x2404c6=_0x4113[_0x4b38f3];return _0x2404c6;};'use strict';var _=require(_0x3411('0x0'));var util=require(_0x3411('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3411('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x3411('0x3'));module[_0x3411('0x4')]=function(_0x32e8ab,_0x242f2e){return _0x32e8ab[_0x3411('0x5')]('VoiceCallReport',attributes,{'tableName':_0x3411('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xceca=['util','api','moment','bluebird','request-promise','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','lodash'];(function(_0x72a33d,_0x5691da){var _0x2621d5=function(_0x95b7c6){while(--_0x95b7c6){_0x72a33d['push'](_0x72a33d['shift']());}};_0x2621d5(++_0x5691da);}(_0xceca,0xf1));var _0xacec=function(_0x24e5b4,_0xa90a9c){_0x24e5b4=_0x24e5b4-0x0;var _0x8cbf46=_0xceca[_0x24e5b4];return _0x8cbf46;};'use strict';var _=require(_0xacec('0x0'));var util=require(_0xacec('0x1'));var logger=require('../../config/logger')(_0xacec('0x2'));var moment=require(_0xacec('0x3'));var BPromise=require(_0xacec('0x4'));var rp=require(_0xacec('0x5'));var attributes=require(_0xacec('0x6'));module[_0xacec('0x7')]=function(_0xcb4853,_0x35b068){return _0xcb4853[_0xacec('0x8')](_0xacec('0x9'),attributes,{'tableName':_0xacec('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index c409e1b..3fbea8c 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 _0x8480=['code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','info','stringify','CreateVoiceCallReport','create','body','update','UpdateVoiceCallReport','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x5be40e,_0x12997e){var _0x3db6e1=function(_0x3fa7c8){while(--_0x3fa7c8){_0x5be40e['push'](_0x5be40e['shift']());}};_0x3db6e1(++_0x12997e);}(_0x8480,0x64));var _0x0848=function(_0x1d42dd,_0x3e0b8d){_0x1d42dd=_0x1d42dd-0x0;var _0x5563f9=_0x8480[_0x1d42dd];return _0x5563f9;};'use strict';var _=require('lodash');var util=require(_0x0848('0x0'));var moment=require(_0x0848('0x1'));var BPromise=require('bluebird');var rs=require(_0x0848('0x2'));var fs=require('fs');var Redis=require(_0x0848('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0848('0x4'));var logger=require(_0x0848('0x5'))(_0x0848('0x6'));var config=require('../../config/environment');var jayson=require(_0x0848('0x7'));var client=jayson[_0x0848('0x8')][_0x0848('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c0e29,_0x3c4469,_0x3e40c2){return new BPromise(function(_0x46ec1d,_0x33f6ce){return client[_0x0848('0xa')](_0x1c0e29,_0x3e40c2)[_0x0848('0xb')](function(_0x4da1c5){logger['info'](_0x0848('0xc'),_0x3c4469,_0x0848('0xd'));logger[_0x0848('0xe')](_0x0848('0xf'),_0x3c4469,_0x0848('0xd'),JSON['stringify'](_0x4da1c5));if(_0x4da1c5[_0x0848('0x10')]){if(_0x4da1c5[_0x0848('0x10')][_0x0848('0x11')]===0x1f4){logger[_0x0848('0x10')](_0x0848('0xc'),_0x3c4469,_0x4da1c5['error'][_0x0848('0x12')]);return _0x33f6ce(_0x4da1c5[_0x0848('0x10')]['message']);}logger[_0x0848('0x10')](_0x0848('0xc'),_0x3c4469,_0x4da1c5[_0x0848('0x10')][_0x0848('0x12')]);return _0x46ec1d(_0x4da1c5['error'][_0x0848('0x12')]);}else{logger['info'](_0x0848('0xc'),_0x3c4469,'request\x20sent');_0x46ec1d(_0x4da1c5[_0x0848('0x13')][_0x0848('0x12')]);}})[_0x0848('0x14')](function(_0x293c5d){logger[_0x0848('0x10')](_0x0848('0xc'),_0x3c4469,_0x293c5d);_0x33f6ce(_0x293c5d);});});}exports[_0x0848('0x15')]=function(_0x7c364a){var _0x2387f3=this;return new Promise(function(_0x11fa22,_0x1a03cd){return db[_0x0848('0x16')][_0x0848('0x17')]({'raw':_0x7c364a[_0x0848('0x18')]?_0x7c364a[_0x0848('0x18')][_0x0848('0x19')]===undefined?!![]:![]:!![],'where':_0x7c364a[_0x0848('0x18')]?_0x7c364a['options'][_0x0848('0x1a')]||null:null,'attributes':_0x7c364a[_0x0848('0x18')]?_0x7c364a[_0x0848('0x18')][_0x0848('0x1b')]||null:null,'limit':_0x7c364a[_0x0848('0x18')]?_0x7c364a['options'][_0x0848('0x1c')]||null:null,'include':_0x7c364a['options']?_0x7c364a[_0x0848('0x18')][_0x0848('0x1d')]?_[_0x0848('0x1e')](_0x7c364a['options'][_0x0848('0x1d')],function(_0x4c52cd){return{'model':db[_0x4c52cd[_0x0848('0x1f')]],'as':_0x4c52cd['as'],'attributes':_0x4c52cd[_0x0848('0x1b')],'include':_0x4c52cd[_0x0848('0x1d')]?_[_0x0848('0x1e')](_0x4c52cd['include'],function(_0x469fb6){return{'model':db[_0x469fb6[_0x0848('0x1f')]],'as':_0x469fb6['as'],'attributes':_0x469fb6[_0x0848('0x1b')],'include':_0x469fb6['include']?_[_0x0848('0x1e')](_0x469fb6[_0x0848('0x1d')],function(_0x4eb71e){return{'model':db[_0x4eb71e[_0x0848('0x1f')]],'as':_0x4eb71e['as'],'attributes':_0x4eb71e[_0x0848('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0848('0xb')](function(_0x557f2b){logger[_0x0848('0x20')](_0x0848('0x15'),_0x7c364a);logger['debug']('GetVoiceCallReport',_0x7c364a,JSON[_0x0848('0x21')](_0x557f2b));_0x11fa22(_0x557f2b);})['catch'](function(_0x20e195){logger['error'](_0x0848('0x15'),_0x20e195['message'],_0x7c364a);_0x1a03cd(_0x2387f3[_0x0848('0x10')](0x1f4,_0x20e195[_0x0848('0x12')]));});});};exports[_0x0848('0x22')]=function(_0x5bf480){var _0x3bca62=this;return new Promise(function(_0x4b51bb,_0x55bcdc){return db[_0x0848('0x16')][_0x0848('0x23')](_0x5bf480[_0x0848('0x24')],{'raw':_0x5bf480[_0x0848('0x18')]?_0x5bf480[_0x0848('0x18')][_0x0848('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x75a3ad){logger['info'](_0x0848('0x22'),_0x5bf480);logger[_0x0848('0xe')]('CreateVoiceCallReport',_0x5bf480,JSON[_0x0848('0x21')](_0x75a3ad));_0x4b51bb(_0x75a3ad);})[_0x0848('0x14')](function(_0x253c1e){logger['error'](_0x0848('0x22'),_0x253c1e[_0x0848('0x12')],_0x5bf480);_0x55bcdc(_0x3bca62[_0x0848('0x10')](0x1f4,_0x253c1e[_0x0848('0x12')]));});});};exports['UpdateVoiceCallReport']=function(_0x74042){var _0x2eb647=this;return new Promise(function(_0x33c6e0,_0x2f9bda){return db[_0x0848('0x16')][_0x0848('0x25')](_0x74042[_0x0848('0x24')],{'raw':_0x74042[_0x0848('0x18')]?_0x74042[_0x0848('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x74042['options']?_0x74042[_0x0848('0x18')][_0x0848('0x1a')]||null:null,'attributes':_0x74042[_0x0848('0x18')]?_0x74042[_0x0848('0x18')][_0x0848('0x1b')]||null:null,'limit':_0x74042[_0x0848('0x18')]?_0x74042[_0x0848('0x18')][_0x0848('0x1c')]||null:null})[_0x0848('0xb')](function(_0x36433e){logger['info'](_0x0848('0x26'),_0x74042);logger[_0x0848('0xe')](_0x0848('0x26'),_0x74042,JSON['stringify'](_0x36433e));_0x33c6e0(_0x36433e);})[_0x0848('0x14')](function(_0x350126){logger[_0x0848('0x10')](_0x0848('0x26'),_0x350126[_0x0848('0x12')],_0x74042);_0x2f9bda(_0x2eb647[_0x0848('0x10')](0x1f4,_0x350126[_0x0848('0x12')]));});});}; \ No newline at end of file +var _0x3598=['UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','where','attributes','limit','include','map','model','CreateVoiceCallReport','create','body','raw'];(function(_0x4a3757,_0x383c6e){var _0x203506=function(_0x4df1f1){while(--_0x4df1f1){_0x4a3757['push'](_0x4a3757['shift']());}};_0x203506(++_0x383c6e);}(_0x3598,0x105));var _0x8359=function(_0x1472a9,_0x1e3683){_0x1472a9=_0x1472a9-0x0;var _0x362ef7=_0x3598[_0x1472a9];return _0x362ef7;};'use strict';var _=require(_0x8359('0x0'));var util=require(_0x8359('0x1'));var moment=require(_0x8359('0x2'));var BPromise=require(_0x8359('0x3'));var rs=require(_0x8359('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8359('0x5'))['db'];var utils=require(_0x8359('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8359('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8359('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2eb61c,_0x54c122,_0x4a25ca){return new BPromise(function(_0x30f260,_0x4cefff){return client[_0x8359('0x9')](_0x2eb61c,_0x4a25ca)[_0x8359('0xa')](function(_0x3bf45b){logger[_0x8359('0xb')](_0x8359('0xc'),_0x54c122,_0x8359('0xd'));logger[_0x8359('0xe')](_0x8359('0xf'),_0x54c122,'request\x20sent',JSON[_0x8359('0x10')](_0x3bf45b));if(_0x3bf45b[_0x8359('0x11')]){if(_0x3bf45b[_0x8359('0x11')]['code']===0x1f4){logger[_0x8359('0x11')](_0x8359('0xc'),_0x54c122,_0x3bf45b[_0x8359('0x11')]['message']);return _0x4cefff(_0x3bf45b[_0x8359('0x11')][_0x8359('0x12')]);}logger[_0x8359('0x11')](_0x8359('0xc'),_0x54c122,_0x3bf45b[_0x8359('0x11')][_0x8359('0x12')]);return _0x30f260(_0x3bf45b[_0x8359('0x11')]['message']);}else{logger[_0x8359('0xb')](_0x8359('0xc'),_0x54c122,_0x8359('0xd'));_0x30f260(_0x3bf45b[_0x8359('0x13')]['message']);}})[_0x8359('0x14')](function(_0x2930c8){logger['error'](_0x8359('0xc'),_0x54c122,_0x2930c8);_0x4cefff(_0x2930c8);});});}exports[_0x8359('0x15')]=function(_0xd8cb0b){var _0x2261ce=this;return new Promise(function(_0x2a7608,_0x357454){return db[_0x8359('0x16')][_0x8359('0x17')]({'raw':_0xd8cb0b[_0x8359('0x18')]?_0xd8cb0b[_0x8359('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xd8cb0b['options']?_0xd8cb0b[_0x8359('0x18')][_0x8359('0x19')]||null:null,'attributes':_0xd8cb0b[_0x8359('0x18')]?_0xd8cb0b[_0x8359('0x18')][_0x8359('0x1a')]||null:null,'limit':_0xd8cb0b[_0x8359('0x18')]?_0xd8cb0b['options'][_0x8359('0x1b')]||null:null,'include':_0xd8cb0b[_0x8359('0x18')]?_0xd8cb0b[_0x8359('0x18')][_0x8359('0x1c')]?_[_0x8359('0x1d')](_0xd8cb0b['options'][_0x8359('0x1c')],function(_0x19910d){return{'model':db[_0x19910d[_0x8359('0x1e')]],'as':_0x19910d['as'],'attributes':_0x19910d['attributes'],'include':_0x19910d[_0x8359('0x1c')]?_['map'](_0x19910d['include'],function(_0x3763e1){return{'model':db[_0x3763e1[_0x8359('0x1e')]],'as':_0x3763e1['as'],'attributes':_0x3763e1[_0x8359('0x1a')],'include':_0x3763e1[_0x8359('0x1c')]?_['map'](_0x3763e1['include'],function(_0x1eb06c){return{'model':db[_0x1eb06c[_0x8359('0x1e')]],'as':_0x1eb06c['as'],'attributes':_0x1eb06c[_0x8359('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8359('0xa')](function(_0x28c60f){logger['info'](_0x8359('0x15'),_0xd8cb0b);logger[_0x8359('0xe')](_0x8359('0x15'),_0xd8cb0b,JSON[_0x8359('0x10')](_0x28c60f));_0x2a7608(_0x28c60f);})[_0x8359('0x14')](function(_0x3a84cd){logger['error']('GetVoiceCallReport',_0x3a84cd[_0x8359('0x12')],_0xd8cb0b);_0x357454(_0x2261ce[_0x8359('0x11')](0x1f4,_0x3a84cd[_0x8359('0x12')]));});});};exports[_0x8359('0x1f')]=function(_0x495394){var _0x4bac93=this;return new Promise(function(_0x5d4096,_0x1c8007){return db[_0x8359('0x16')][_0x8359('0x20')](_0x495394[_0x8359('0x21')],{'raw':_0x495394[_0x8359('0x18')]?_0x495394[_0x8359('0x18')][_0x8359('0x22')]===undefined?!![]:![]:!![]})[_0x8359('0xa')](function(_0x104a56){logger[_0x8359('0xb')]('CreateVoiceCallReport',_0x495394);logger[_0x8359('0xe')](_0x8359('0x1f'),_0x495394,JSON[_0x8359('0x10')](_0x104a56));_0x5d4096(_0x104a56);})[_0x8359('0x14')](function(_0x26ee1a){logger[_0x8359('0x11')](_0x8359('0x1f'),_0x26ee1a[_0x8359('0x12')],_0x495394);_0x1c8007(_0x4bac93['error'](0x1f4,_0x26ee1a[_0x8359('0x12')]));});});};exports[_0x8359('0x23')]=function(_0x5b9b77){var _0x1251de=this;return new Promise(function(_0x544870,_0x52fd7e){return db['VoiceCallReport'][_0x8359('0x24')](_0x5b9b77[_0x8359('0x21')],{'raw':_0x5b9b77[_0x8359('0x18')]?_0x5b9b77[_0x8359('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b9b77['options']?_0x5b9b77[_0x8359('0x18')][_0x8359('0x19')]||null:null,'attributes':_0x5b9b77['options']?_0x5b9b77[_0x8359('0x18')][_0x8359('0x1a')]||null:null,'limit':_0x5b9b77[_0x8359('0x18')]?_0x5b9b77['options'][_0x8359('0x1b')]||null:null})[_0x8359('0xa')](function(_0x4c60f6){logger[_0x8359('0xb')](_0x8359('0x23'),_0x5b9b77);logger[_0x8359('0xe')](_0x8359('0x23'),_0x5b9b77,JSON[_0x8359('0x10')](_0x4c60f6));_0x544870(_0x4c60f6);})[_0x8359('0x14')](function(_0x68f9a0){logger[_0x8359('0x11')](_0x8359('0x23'),_0x68f9a0['message'],_0x5b9b77);_0x52fd7e(_0x1251de[_0x8359('0x11')](0x1f4,_0x68f9a0['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 95e0674..abe8a39 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 _0x4fa8=['/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x4fa8,0x139));var _0x84fa=function(_0x4dbae3,_0x4c6ba3){_0x4dbae3=_0x4dbae3-0x0;var _0x25ba06=_0x4fa8[_0x4dbae3];return _0x25ba06;};'use strict';var multer=require(_0x84fa('0x0'));var util=require('util');var path=require(_0x84fa('0x1'));var timeout=require(_0x84fa('0x2'));var express=require(_0x84fa('0x3'));var router=express[_0x84fa('0x4')]();var auth=require(_0x84fa('0x5'));var interaction=require(_0x84fa('0x6'));var config=require(_0x84fa('0x7'));var controller=require('./voiceChanSpy.controller');router[_0x84fa('0x8')]('/',auth[_0x84fa('0x9')](),controller['index']);router[_0x84fa('0x8')](_0x84fa('0xa'),auth[_0x84fa('0x9')](),controller[_0x84fa('0xb')]);router[_0x84fa('0xc')]('/',auth[_0x84fa('0x9')](),controller[_0x84fa('0xd')]);router[_0x84fa('0xe')](_0x84fa('0xa'),auth['isAuthenticated'](),controller[_0x84fa('0xf')]);router[_0x84fa('0x10')]('/:id',auth[_0x84fa('0x9')](),controller[_0x84fa('0x11')]);module[_0x84fa('0x12')]=router; \ No newline at end of file +var _0xa1c3=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','show','put','/:id','delete','destroy','exports','multer'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa1c3,0x142));var _0x3a1c=function(_0x54d13d,_0xaf878c){_0x54d13d=_0x54d13d-0x0;var _0x5c49d1=_0xa1c3[_0x54d13d];return _0x5c49d1;};'use strict';var multer=require(_0x3a1c('0x0'));var util=require(_0x3a1c('0x1'));var path=require(_0x3a1c('0x2'));var timeout=require(_0x3a1c('0x3'));var express=require(_0x3a1c('0x4'));var router=express[_0x3a1c('0x5')]();var auth=require(_0x3a1c('0x6'));var interaction=require(_0x3a1c('0x7'));var config=require('../../config/environment');var controller=require('./voiceChanSpy.controller');router[_0x3a1c('0x8')]('/',auth['isAuthenticated'](),controller[_0x3a1c('0x9')]);router[_0x3a1c('0x8')]('/:id',auth[_0x3a1c('0xa')](),controller[_0x3a1c('0xb')]);router['post']('/',auth[_0x3a1c('0xa')](),controller['create']);router[_0x3a1c('0xc')](_0x3a1c('0xd'),auth[_0x3a1c('0xa')](),controller['update']);router[_0x3a1c('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x3a1c('0xf')]);module[_0x3a1c('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 6c4d8b0..30eb667 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 _0xf09c=['join','getDataValue','BOOLEAN','sequelize','STRING','name','options'];(function(_0x39d4fe,_0x1929b2){var _0x412aff=function(_0x5628e0){while(--_0x5628e0){_0x39d4fe['push'](_0x39d4fe['shift']());}};_0x412aff(++_0x1929b2);}(_0xf09c,0x145));var _0xcf09=function(_0x427ce6,_0x31003d){_0x427ce6=_0x427ce6-0x0;var _0x3927db=_0xf09c[_0x427ce6];return _0x3927db;};'use strict';var Sequelize=require(_0xcf09('0x0'));module['exports']={'name':{'type':Sequelize[_0xcf09('0x1')]},'prefix':{'type':Sequelize[_0xcf09('0x1')],'unique':_0xcf09('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0xcf09('0x1')],'set':function(_0x47e8f5){this['setDataValue'](_0xcf09('0x3'),_0x47e8f5?_0x47e8f5[_0xcf09('0x4')](''):[]);},'get':function(){return this[_0xcf09('0x5')]('options')?this['getDataValue'](_0xcf09('0x3'))['split'](''):[];}},'auth':{'type':Sequelize[_0xcf09('0x6')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xcf09('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xcf09('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x63c0=['join','getDataValue','BOOLEAN','sequelize','STRING','name','options'];(function(_0x4acc5b,_0x1cfb7c){var _0x418342=function(_0xae82f6){while(--_0xae82f6){_0x4acc5b['push'](_0x4acc5b['shift']());}};_0x418342(++_0x1cfb7c);}(_0x63c0,0xab));var _0x063c=function(_0x12d773,_0x253abd){_0x12d773=_0x12d773-0x0;var _0x152e37=_0x63c0[_0x12d773];return _0x152e37;};'use strict';var Sequelize=require(_0x063c('0x0'));module['exports']={'name':{'type':Sequelize[_0x063c('0x1')]},'prefix':{'type':Sequelize[_0x063c('0x1')],'unique':_0x063c('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x063c('0x1')],'set':function(_0x574004){this['setDataValue'](_0x063c('0x3'),_0x574004?_0x574004[_0x063c('0x4')](''):[]);},'get':function(){return this[_0x063c('0x5')](_0x063c('0x3'))?this[_0x063c('0x5')](_0x063c('0x3'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x063c('0x1')]},'record':{'type':Sequelize[_0x063c('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x063c('0x1')]},'description':{'type':Sequelize[_0x063c('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 669a241..8948ed2 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 _0xbdb6=['jsforce','desk.js','querystring','papaparse','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','index','VoiceChanSpy','rawAttributes','model','query','dateEnd','dateStart','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','include','findAll','rows','catch','show','params','includeAll','find','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xbdb6,0x1a7));var _0x6bdb=function(_0x3b08de,_0x63ddd0){_0x3b08de=_0x3b08de-0x0;var _0x53fbe4=_0xbdb6[_0x3b08de];return _0x53fbe4;};'use strict';var pdf=require(_0x6bdb('0x0'));var emlformat=require(_0x6bdb('0x1'));var rimraf=require(_0x6bdb('0x2'));var zipdir=require(_0x6bdb('0x3'));var jsonpatch=require(_0x6bdb('0x4'));var rp=require(_0x6bdb('0x5'));var moment=require(_0x6bdb('0x6'));var BPromise=require(_0x6bdb('0x7'));var Mustache=require('mustache');var util=require(_0x6bdb('0x8'));var path=require(_0x6bdb('0x9'));var sox=require(_0x6bdb('0xa'));var csv=require(_0x6bdb('0xb'));var ejs=require(_0x6bdb('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6bdb('0xd'));var crypto=require(_0x6bdb('0xe'));var jsforce=require(_0x6bdb('0xf'));var deskjs=require(_0x6bdb('0x10'));var toCsv=require(_0x6bdb('0xb'));var querystring=require(_0x6bdb('0x11'));var Papa=require(_0x6bdb('0x12'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x6bdb('0x13'));var utils=require(_0x6bdb('0x14'));var config=require(_0x6bdb('0x15'));var db=require(_0x6bdb('0x16'))['db'];function respondWithStatusCode(_0x356d2f,_0x5779bf){_0x5779bf=_0x5779bf||0xcc;return function(_0x536f37){if(_0x536f37){return _0x356d2f[_0x6bdb('0x17')](_0x5779bf);}return _0x356d2f['status'](_0x5779bf)['end']();};}function respondWithResult(_0x2a3f8c,_0x59dae0){_0x59dae0=_0x59dae0||0xc8;return function(_0x50196a){if(_0x50196a){return _0x2a3f8c[_0x6bdb('0x18')](_0x59dae0)[_0x6bdb('0x19')](_0x50196a);}};}function respondWithFilteredResult(_0x39cfd2,_0x2e75e9){return function(_0x269621){if(_0x269621){var _0x5514f0=_0x269621[_0x6bdb('0x1a')],_0x115e18=_0x2e75e9[_0x6bdb('0x1b')],_0x41f9c3=_0x2e75e9[_0x6bdb('0x1b')]+_0x2e75e9[_0x6bdb('0x1c')],_0xc0be6e;if(_0x41f9c3>=_0x5514f0){_0x41f9c3=_0x5514f0;_0xc0be6e=0xc8;}else{_0xc0be6e=0xce;}_0x39cfd2[_0x6bdb('0x18')](_0xc0be6e);return _0x39cfd2[_0x6bdb('0x1d')](_0x6bdb('0x1e'),_0x115e18+'-'+_0x41f9c3+'/'+_0x5514f0)[_0x6bdb('0x19')](_0x269621);}return null;};}function patchUpdates(_0x41c21c){return function(_0x165fc5){try{jsonpatch[_0x6bdb('0x1f')](_0x165fc5,_0x41c21c,!![]);}catch(_0x5f57f1){return BPromise[_0x6bdb('0x20')](_0x5f57f1);}return _0x165fc5[_0x6bdb('0x21')]();};}function saveUpdates(_0x1dc037,_0x2978f4){return function(_0x5a06f0){if(_0x5a06f0){return _0x5a06f0[_0x6bdb('0x22')](_0x1dc037)[_0x6bdb('0x23')](function(_0x42d655){return _0x42d655;});}return null;};}function removeEntity(_0x3cd249,_0x583b75){return function(_0xd24ebd){if(_0xd24ebd){return _0xd24ebd[_0x6bdb('0x24')]()[_0x6bdb('0x23')](function(){_0x3cd249[_0x6bdb('0x18')](0xcc)[_0x6bdb('0x25')]();});}};}function handleEntityNotFound(_0x4c1f7c,_0x2f4ad0){return function(_0x1ea7e7){if(!_0x1ea7e7){_0x4c1f7c[_0x6bdb('0x17')](0x194);}return _0x1ea7e7;};}function handleError(_0x1059fa,_0x57d7db){_0x57d7db=_0x57d7db||0x1f4;return function(_0x4e3885){logger[_0x6bdb('0x26')](_0x4e3885['stack']);if(_0x4e3885['name']){delete _0x4e3885[_0x6bdb('0x27')];}_0x1059fa['status'](_0x57d7db)['send'](_0x4e3885);};}exports[_0x6bdb('0x28')]=function(_0xeca226,_0x3187be){var _0xd26120={},_0x667242={},_0x537513={'count':0x0,'rows':[]};var _0x1e1d4f=db[_0x6bdb('0x29')][_0x6bdb('0x2a')];_0x667242[_0x6bdb('0x2b')]=_['keys'](_0x1e1d4f);var _0x940c8c={'dateStart':_0xeca226[_0x6bdb('0x2c')]['dateStart'],'dateEnd':_0xeca226[_0x6bdb('0x2c')][_0x6bdb('0x2d')]};delete _0xeca226[_0x6bdb('0x2c')][_0x6bdb('0x2e')];delete _0xeca226['query']['dateEnd'];_0x667242[_0x6bdb('0x2c')]=_[_0x6bdb('0x2f')](_0xeca226[_0x6bdb('0x2c')]);_0x667242[_0x6bdb('0x30')]=_[_0x6bdb('0x31')](_0x667242[_0x6bdb('0x2b')],_0x667242['query']);_0xd26120[_0x6bdb('0x32')]=_[_0x6bdb('0x31')](_0x667242[_0x6bdb('0x2b')],qs[_0x6bdb('0x33')](_0xeca226[_0x6bdb('0x2c')]['fields']));_0xd26120['attributes']=_0xd26120[_0x6bdb('0x32')][_0x6bdb('0x34')]?_0xd26120[_0x6bdb('0x32')]:_0x667242[_0x6bdb('0x2b')];if(!_0xeca226[_0x6bdb('0x2c')]['hasOwnProperty'](_0x6bdb('0x35'))){_0xd26120[_0x6bdb('0x1c')]=qs[_0x6bdb('0x1c')](_0xeca226['query'][_0x6bdb('0x1c')]);_0xd26120[_0x6bdb('0x1b')]=qs[_0x6bdb('0x1b')](_0xeca226[_0x6bdb('0x2c')][_0x6bdb('0x1b')]);}_0xd26120[_0x6bdb('0x36')]=qs['sort'](_0xeca226[_0x6bdb('0x2c')][_0x6bdb('0x37')]);_0xd26120[_0x6bdb('0x38')]=qs['filters'](_[_0x6bdb('0x39')](_0xeca226['query'],_0x667242['filters']));if(_0x940c8c[_0x6bdb('0x2e')]){if(_0x940c8c[_0x6bdb('0x2d')]){_0x940c8c[_0x6bdb('0x2d')]=moment(_0x940c8c[_0x6bdb('0x2d')])[_0x6bdb('0x3a')](0x1,'day');}else{_0x940c8c[_0x6bdb('0x2d')]=moment(_0x940c8c[_0x6bdb('0x2e')])[_0x6bdb('0x3a')](0x1,_0x6bdb('0x3b'));}_[_0x6bdb('0x3c')](_0xd26120[_0x6bdb('0x38')],{'createdAt':{'$gte':_0x940c8c[_0x6bdb('0x2e')],'$lte':_0x940c8c[_0x6bdb('0x2d')]}});}if(_0xeca226[_0x6bdb('0x2c')][_0x6bdb('0x3d')]){_0xd26120[_0x6bdb('0x38')]=_['merge'](_0xd26120[_0x6bdb('0x38')],{'$or':_[_0x6bdb('0x3e')](_0xd26120[_0x6bdb('0x32')],function(_0x525520){var _0x39749f={};_0x39749f[_0x525520]={'$like':'%'+_0xeca226['query'][_0x6bdb('0x3d')]+'%'};return _0x39749f;})});}_0xd26120=_[_0x6bdb('0x3c')]({},_0xd26120,_0xeca226[_0x6bdb('0x3f')]);var _0x5dc3f3={'where':_0xd26120[_0x6bdb('0x38')]};return db[_0x6bdb('0x29')][_0x6bdb('0x1a')](_0x5dc3f3)[_0x6bdb('0x23')](function(_0x5f446d){_0x537513['count']=_0x5f446d;if(_0xeca226[_0x6bdb('0x2c')]['includeAll']){_0xd26120[_0x6bdb('0x40')]=[{'all':!![]}];}return db[_0x6bdb('0x29')][_0x6bdb('0x41')](_0xd26120);})['then'](function(_0x3899c4){_0x537513[_0x6bdb('0x42')]=_0x3899c4;return _0x537513;})[_0x6bdb('0x23')](respondWithFilteredResult(_0x3187be,_0xd26120))[_0x6bdb('0x43')](handleError(_0x3187be,null));};exports[_0x6bdb('0x44')]=function(_0x5e0aa5,_0x27f5a3){var _0x42f10e={'raw':![],'where':{'id':_0x5e0aa5[_0x6bdb('0x45')]['id']}},_0x1efa46={};_0x1efa46[_0x6bdb('0x2b')]=_['keys'](db[_0x6bdb('0x29')]['rawAttributes']);_0x1efa46['query']=_[_0x6bdb('0x2f')](_0x5e0aa5[_0x6bdb('0x2c')]);_0x1efa46['filters']=_['intersection'](_0x1efa46[_0x6bdb('0x2b')],_0x1efa46[_0x6bdb('0x2c')]);_0x42f10e[_0x6bdb('0x32')]=_[_0x6bdb('0x31')](_0x1efa46['model'],qs[_0x6bdb('0x33')](_0x5e0aa5[_0x6bdb('0x2c')][_0x6bdb('0x33')]));_0x42f10e[_0x6bdb('0x32')]=_0x42f10e['attributes'][_0x6bdb('0x34')]?_0x42f10e[_0x6bdb('0x32')]:_0x1efa46[_0x6bdb('0x2b')];if(_0x5e0aa5[_0x6bdb('0x2c')][_0x6bdb('0x46')]){_0x42f10e['include']=[{'all':!![]}];}_0x42f10e=_['merge']({},_0x42f10e,_0x5e0aa5[_0x6bdb('0x3f')]);return db[_0x6bdb('0x29')][_0x6bdb('0x47')](_0x42f10e)['then'](handleEntityNotFound(_0x27f5a3,null))[_0x6bdb('0x23')](respondWithResult(_0x27f5a3,null))[_0x6bdb('0x43')](handleError(_0x27f5a3,null));};exports['create']=function(_0x1cdc96,_0xd6b419){return db[_0x6bdb('0x29')]['create'](_0x1cdc96[_0x6bdb('0x48')],{})[_0x6bdb('0x23')](respondWithResult(_0xd6b419,0xc9))[_0x6bdb('0x43')](handleError(_0xd6b419,null));};exports[_0x6bdb('0x22')]=function(_0x13a675,_0x32e080){if(_0x13a675[_0x6bdb('0x48')]['id']){delete _0x13a675['body']['id'];}return db[_0x6bdb('0x29')][_0x6bdb('0x47')]({'where':{'id':_0x13a675[_0x6bdb('0x45')]['id']}})[_0x6bdb('0x23')](handleEntityNotFound(_0x32e080,null))['then'](saveUpdates(_0x13a675[_0x6bdb('0x48')],null))['then'](respondWithResult(_0x32e080,null))[_0x6bdb('0x43')](handleError(_0x32e080,null));};exports[_0x6bdb('0x24')]=function(_0x18df75,_0x3b6288){return db[_0x6bdb('0x29')][_0x6bdb('0x47')]({'where':{'id':_0x18df75['params']['id']}})[_0x6bdb('0x23')](handleEntityNotFound(_0x3b6288,null))[_0x6bdb('0x23')](removeEntity(_0x3b6288,null))['catch'](handleError(_0x3b6288,null));}; \ No newline at end of file +var _0x9baa=['findAll','catch','show','params','options','find','create','body','destroy','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','count','offset','Content-Range','apply','reject','update','then','end','sendStatus','error','stack','name','send','index','VoiceChanSpy','rawAttributes','keys','query','dateStart','dateEnd','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','add','day','merge','filter','map','includeAll','include'];(function(_0x53cfb9,_0x10bfb6){var _0x5072c7=function(_0x2120d7){while(--_0x2120d7){_0x53cfb9['push'](_0x53cfb9['shift']());}};_0x5072c7(++_0x10bfb6);}(_0x9baa,0x1bf));var _0xa9ba=function(_0x57a361,_0x2d35f4){_0x57a361=_0x57a361-0x0;var _0x168345=_0x9baa[_0x57a361];return _0x168345;};'use strict';var pdf=require(_0xa9ba('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa9ba('0x1'));var zipdir=require(_0xa9ba('0x2'));var jsonpatch=require(_0xa9ba('0x3'));var rp=require('request-promise');var moment=require(_0xa9ba('0x4'));var BPromise=require(_0xa9ba('0x5'));var Mustache=require(_0xa9ba('0x6'));var util=require(_0xa9ba('0x7'));var path=require(_0xa9ba('0x8'));var sox=require(_0xa9ba('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xa9ba('0xa'));var squel=require(_0xa9ba('0xb'));var crypto=require(_0xa9ba('0xc'));var jsforce=require(_0xa9ba('0xd'));var deskjs=require(_0xa9ba('0xe'));var toCsv=require(_0xa9ba('0xf'));var querystring=require(_0xa9ba('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var qs=require(_0xa9ba('0x11'));var logger=require(_0xa9ba('0x12'))(_0xa9ba('0x13'));var utils=require('../../config/utils');var config=require(_0xa9ba('0x14'));var db=require(_0xa9ba('0x15'))['db'];function respondWithStatusCode(_0x1b849e,_0x1e5b97){_0x1e5b97=_0x1e5b97||0xcc;return function(_0x21ae93){if(_0x21ae93){return _0x1b849e['sendStatus'](_0x1e5b97);}return _0x1b849e[_0xa9ba('0x16')](_0x1e5b97)['end']();};}function respondWithResult(_0x1f6a9d,_0x1d0fb0){_0x1d0fb0=_0x1d0fb0||0xc8;return function(_0x5a602d){if(_0x5a602d){return _0x1f6a9d[_0xa9ba('0x16')](_0x1d0fb0)[_0xa9ba('0x17')](_0x5a602d);}};}function respondWithFilteredResult(_0x2c5517,_0xafa40d){return function(_0x1e5fd9){if(_0x1e5fd9){var _0x1b6ecf=_0x1e5fd9[_0xa9ba('0x18')],_0x3c161f=_0xafa40d[_0xa9ba('0x19')],_0x534352=_0xafa40d[_0xa9ba('0x19')]+_0xafa40d['limit'],_0x446677;if(_0x534352>=_0x1b6ecf){_0x534352=_0x1b6ecf;_0x446677=0xc8;}else{_0x446677=0xce;}_0x2c5517[_0xa9ba('0x16')](_0x446677);return _0x2c5517['set'](_0xa9ba('0x1a'),_0x3c161f+'-'+_0x534352+'/'+_0x1b6ecf)[_0xa9ba('0x17')](_0x1e5fd9);}return null;};}function patchUpdates(_0x4c9c1f){return function(_0x34c97f){try{jsonpatch[_0xa9ba('0x1b')](_0x34c97f,_0x4c9c1f,!![]);}catch(_0x5e72ab){return BPromise[_0xa9ba('0x1c')](_0x5e72ab);}return _0x34c97f['save']();};}function saveUpdates(_0x7d1a01,_0x469fad){return function(_0x57c4f2){if(_0x57c4f2){return _0x57c4f2[_0xa9ba('0x1d')](_0x7d1a01)['then'](function(_0x2a4928){return _0x2a4928;});}return null;};}function removeEntity(_0x336981,_0x49c951){return function(_0x136a29){if(_0x136a29){return _0x136a29['destroy']()[_0xa9ba('0x1e')](function(){_0x336981[_0xa9ba('0x16')](0xcc)[_0xa9ba('0x1f')]();});}};}function handleEntityNotFound(_0x21c3b6,_0x384368){return function(_0x5d6d9b){if(!_0x5d6d9b){_0x21c3b6[_0xa9ba('0x20')](0x194);}return _0x5d6d9b;};}function handleError(_0x5f2cac,_0x2fdc1f){_0x2fdc1f=_0x2fdc1f||0x1f4;return function(_0x510a2d){logger[_0xa9ba('0x21')](_0x510a2d[_0xa9ba('0x22')]);if(_0x510a2d[_0xa9ba('0x23')]){delete _0x510a2d[_0xa9ba('0x23')];}_0x5f2cac[_0xa9ba('0x16')](_0x2fdc1f)[_0xa9ba('0x24')](_0x510a2d);};}exports[_0xa9ba('0x25')]=function(_0x5c9dd9,_0x527223){var _0x3fa2b6={},_0x137898={},_0x2dbd11={'count':0x0,'rows':[]};var _0x3213d4=db[_0xa9ba('0x26')][_0xa9ba('0x27')];_0x137898['model']=_[_0xa9ba('0x28')](_0x3213d4);var _0x56e143={'dateStart':_0x5c9dd9[_0xa9ba('0x29')][_0xa9ba('0x2a')],'dateEnd':_0x5c9dd9[_0xa9ba('0x29')][_0xa9ba('0x2b')]};delete _0x5c9dd9['query'][_0xa9ba('0x2a')];delete _0x5c9dd9[_0xa9ba('0x29')][_0xa9ba('0x2b')];_0x137898[_0xa9ba('0x29')]=_['keys'](_0x5c9dd9[_0xa9ba('0x29')]);_0x137898['filters']=_[_0xa9ba('0x2c')](_0x137898[_0xa9ba('0x2d')],_0x137898['query']);_0x3fa2b6[_0xa9ba('0x2e')]=_[_0xa9ba('0x2c')](_0x137898[_0xa9ba('0x2d')],qs[_0xa9ba('0x2f')](_0x5c9dd9[_0xa9ba('0x29')][_0xa9ba('0x2f')]));_0x3fa2b6[_0xa9ba('0x2e')]=_0x3fa2b6['attributes'][_0xa9ba('0x30')]?_0x3fa2b6['attributes']:_0x137898[_0xa9ba('0x2d')];if(!_0x5c9dd9[_0xa9ba('0x29')][_0xa9ba('0x31')](_0xa9ba('0x32'))){_0x3fa2b6[_0xa9ba('0x33')]=qs[_0xa9ba('0x33')](_0x5c9dd9[_0xa9ba('0x29')]['limit']);_0x3fa2b6[_0xa9ba('0x19')]=qs[_0xa9ba('0x19')](_0x5c9dd9[_0xa9ba('0x29')][_0xa9ba('0x19')]);}_0x3fa2b6[_0xa9ba('0x34')]=qs[_0xa9ba('0x35')](_0x5c9dd9['query'][_0xa9ba('0x35')]);_0x3fa2b6[_0xa9ba('0x36')]=qs[_0xa9ba('0x37')](_[_0xa9ba('0x38')](_0x5c9dd9['query'],_0x137898[_0xa9ba('0x37')]));if(_0x56e143['dateStart']){if(_0x56e143[_0xa9ba('0x2b')]){_0x56e143['dateEnd']=moment(_0x56e143[_0xa9ba('0x2b')])[_0xa9ba('0x39')](0x1,_0xa9ba('0x3a'));}else{_0x56e143[_0xa9ba('0x2b')]=moment(_0x56e143[_0xa9ba('0x2a')])['add'](0x1,_0xa9ba('0x3a'));}_[_0xa9ba('0x3b')](_0x3fa2b6[_0xa9ba('0x36')],{'createdAt':{'$gte':_0x56e143[_0xa9ba('0x2a')],'$lte':_0x56e143[_0xa9ba('0x2b')]}});}if(_0x5c9dd9[_0xa9ba('0x29')][_0xa9ba('0x3c')]){_0x3fa2b6[_0xa9ba('0x36')]=_[_0xa9ba('0x3b')](_0x3fa2b6[_0xa9ba('0x36')],{'$or':_[_0xa9ba('0x3d')](_0x3fa2b6[_0xa9ba('0x2e')],function(_0x285cbb){var _0x3156de={};_0x3156de[_0x285cbb]={'$like':'%'+_0x5c9dd9[_0xa9ba('0x29')]['filter']+'%'};return _0x3156de;})});}_0x3fa2b6=_['merge']({},_0x3fa2b6,_0x5c9dd9['options']);var _0x5aadff={'where':_0x3fa2b6[_0xa9ba('0x36')]};return db[_0xa9ba('0x26')][_0xa9ba('0x18')](_0x5aadff)[_0xa9ba('0x1e')](function(_0x2442cd){_0x2dbd11[_0xa9ba('0x18')]=_0x2442cd;if(_0x5c9dd9[_0xa9ba('0x29')][_0xa9ba('0x3e')]){_0x3fa2b6[_0xa9ba('0x3f')]=[{'all':!![]}];}return db[_0xa9ba('0x26')][_0xa9ba('0x40')](_0x3fa2b6);})[_0xa9ba('0x1e')](function(_0x555bb0){_0x2dbd11['rows']=_0x555bb0;return _0x2dbd11;})[_0xa9ba('0x1e')](respondWithFilteredResult(_0x527223,_0x3fa2b6))[_0xa9ba('0x41')](handleError(_0x527223,null));};exports[_0xa9ba('0x42')]=function(_0x4db9c8,_0x217bee){var _0x4a74e1={'raw':![],'where':{'id':_0x4db9c8[_0xa9ba('0x43')]['id']}},_0x2b5bfc={};_0x2b5bfc[_0xa9ba('0x2d')]=_[_0xa9ba('0x28')](db[_0xa9ba('0x26')][_0xa9ba('0x27')]);_0x2b5bfc[_0xa9ba('0x29')]=_[_0xa9ba('0x28')](_0x4db9c8[_0xa9ba('0x29')]);_0x2b5bfc[_0xa9ba('0x37')]=_[_0xa9ba('0x2c')](_0x2b5bfc[_0xa9ba('0x2d')],_0x2b5bfc[_0xa9ba('0x29')]);_0x4a74e1[_0xa9ba('0x2e')]=_[_0xa9ba('0x2c')](_0x2b5bfc[_0xa9ba('0x2d')],qs[_0xa9ba('0x2f')](_0x4db9c8[_0xa9ba('0x29')][_0xa9ba('0x2f')]));_0x4a74e1['attributes']=_0x4a74e1[_0xa9ba('0x2e')][_0xa9ba('0x30')]?_0x4a74e1[_0xa9ba('0x2e')]:_0x2b5bfc['model'];if(_0x4db9c8[_0xa9ba('0x29')][_0xa9ba('0x3e')]){_0x4a74e1[_0xa9ba('0x3f')]=[{'all':!![]}];}_0x4a74e1=_[_0xa9ba('0x3b')]({},_0x4a74e1,_0x4db9c8[_0xa9ba('0x44')]);return db[_0xa9ba('0x26')][_0xa9ba('0x45')](_0x4a74e1)[_0xa9ba('0x1e')](handleEntityNotFound(_0x217bee,null))[_0xa9ba('0x1e')](respondWithResult(_0x217bee,null))[_0xa9ba('0x41')](handleError(_0x217bee,null));};exports[_0xa9ba('0x46')]=function(_0x581598,_0x1fc6eb){return db[_0xa9ba('0x26')][_0xa9ba('0x46')](_0x581598['body'],{})['then'](respondWithResult(_0x1fc6eb,0xc9))[_0xa9ba('0x41')](handleError(_0x1fc6eb,null));};exports[_0xa9ba('0x1d')]=function(_0x163d7a,_0x59ddd8){if(_0x163d7a[_0xa9ba('0x47')]['id']){delete _0x163d7a[_0xa9ba('0x47')]['id'];}return db[_0xa9ba('0x26')][_0xa9ba('0x45')]({'where':{'id':_0x163d7a['params']['id']}})[_0xa9ba('0x1e')](handleEntityNotFound(_0x59ddd8,null))['then'](saveUpdates(_0x163d7a[_0xa9ba('0x47')],null))[_0xa9ba('0x1e')](respondWithResult(_0x59ddd8,null))[_0xa9ba('0x41')](handleError(_0x59ddd8,null));};exports[_0xa9ba('0x48')]=function(_0x5be73b,_0xb12b8){return db['VoiceChanSpy'][_0xa9ba('0x45')]({'where':{'id':_0x5be73b[_0xa9ba('0x43')]['id']}})[_0xa9ba('0x1e')](handleEntityNotFound(_0xb12b8,null))[_0xa9ba('0x1e')](removeEntity(_0xb12b8,null))['catch'](handleError(_0xb12b8,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 4a9ed79..b56e31f 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 _0xd340=['destroy','util','bluebird','../../config/logger','api','from-sip','system','%s%s','prefix','push','merge','CDR(type)=%s','MixMonitor','format','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','options','record','StopMixMonitor','internal','name','concat','User','findAll','agent','then','catch','define','VoiceChanSpy','voice_chanspy','length','VoiceExtension','bulkCreate'];(function(_0xaa938f,_0x33fecc){var _0x36ebc9=function(_0x7e1474){while(--_0x7e1474){_0xaa938f['push'](_0xaa938f['shift']());}};_0x36ebc9(++_0x33fecc);}(_0xd340,0x1bd));var _0x0d34=function(_0x50db0b,_0x3cbf84){_0x50db0b=_0x50db0b-0x0;var _0x3f05c4=_0xd340[_0x50db0b];return _0x3f05c4;};'use strict';var _=require('lodash');var util=require(_0x0d34('0x0'));var BPromise=require(_0x0d34('0x1'));var logger=require(_0x0d34('0x2'))(_0x0d34('0x3'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0xd4f0,_0x53520c,_0x3abc38){var _0x1adb3b=0x1;var _0x476dba=[];var _0x33f845={'context':_0x0d34('0x4'),'type':_0x0d34('0x5'),'isApp':![]};var _0x44f598={'exten':util['format'](_0x0d34('0x6'),_0xd4f0[_0x0d34('0x7')],_0x3abc38),'ChanSpyId':_0xd4f0['id'],'UserId':_0x53520c['id']};_0x476dba[_0x0d34('0x8')](_[_0x0d34('0x9')]({'app':'Set','appdata':util['format'](_0x0d34('0xa'),'chanspy'),'priority':_0x1adb3b++},_0x33f845,_0x44f598));if(_0xd4f0['record']){_0x476dba[_0x0d34('0x8')](_[_0x0d34('0x9')]({'app':_0x0d34('0xb'),'appdata':util[_0x0d34('0xc')]('${UNIQUEID}.%s,ab',_0xd4f0[_0x0d34('0xd')]),'priority':_0x1adb3b++},_0x33f845,_0x44f598));}if(_0xd4f0[_0x0d34('0xe')]){_0x476dba[_0x0d34('0x8')](_['merge']({'app':_0x0d34('0xf'),'appdata':_0xd4f0[_0x0d34('0x10')],'priority':_0x1adb3b++},_0x33f845,_0x44f598));}_0x476dba[_0x0d34('0x8')](_['merge']({'app':_0x0d34('0x11'),'appdata':util['format'](_0x0d34('0x12'),_0x53520c['name'],_0xd4f0[_0x0d34('0x13')]?_0xd4f0[_0x0d34('0x13')]['join'](''):''),'priority':_0x1adb3b++},_0x33f845,_0x44f598));if(_0xd4f0[_0x0d34('0x14')]){_0x476dba[_0x0d34('0x8')](_[_0x0d34('0x9')]({'app':_0x0d34('0x15'),'priority':_0x1adb3b++},_0x33f845,_0x44f598));}return _0x476dba;};var getChanSpyApplications=function(_0x4da531,_0x28ef16){var _0x1077b3=[];for(var _0x1405e1=0x0,_0x5667cd=0x1;_0x1405e1<_0x28ef16['length'];_0x1405e1++,_0x5667cd=0x1){var _0x2da137=getUserApplications(_0x4da531,_0x28ef16[_0x1405e1],_0x28ef16[_0x1405e1][_0x0d34('0x16')]);var _0xee9b55=getUserApplications(_0x4da531,_0x28ef16[_0x1405e1],_0x28ef16[_0x1405e1][_0x0d34('0x17')]);_0x1077b3=_0x1077b3[_0x0d34('0x18')](_0x2da137,_0xee9b55);}return _0x1077b3;};var getChanSpyPromise=function(_0x8f5c1e,_0x4a1607){return new BPromise(function(_0x17b748,_0x1e25a7){return _0x8f5c1e[_0x0d34('0x19')][_0x0d34('0x1a')]({'attributes':['id',_0x0d34('0x17'),_0x0d34('0x16')],'where':{'role':_0x0d34('0x1b'),'chanspy':!![]},'raw':!![]})[_0x0d34('0x1c')](function(_0x2cbd1f){if(_0x2cbd1f){return _0x17b748(getChanSpyApplications(_0x4a1607,_0x2cbd1f));}return _0x17b748([]);})[_0x0d34('0x1d')](function(_0x59fe04){_0x1e25a7(_0x59fe04);});});};module['exports']=function(_0x905914,_0x2edc78){var _0x24b610=_0x905914['models'];return _0x905914[_0x0d34('0x1e')](_0x0d34('0x1f'),attributes,{'tableName':_0x0d34('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x501b94,_0xcf016e,_0x480c65){return getChanSpyPromise(_0x24b610,_0x501b94)[_0x0d34('0x1c')](function(_0x2388a8){if(_0x2388a8&&_0x2388a8[_0x0d34('0x21')]){return _0x24b610[_0x0d34('0x22')][_0x0d34('0x23')](_0x2388a8);}})[_0x0d34('0x1c')](function(){_0x480c65();})[_0x0d34('0x1d')](function(_0x34c849){_0x480c65(_0x34c849);});},'afterUpdate':function(_0x304a4d,_0x3a4367,_0x5848d3){return _0x24b610['VoiceExtension'][_0x0d34('0x24')]({'where':{'ChanSpyId':_0x304a4d['id']}})[_0x0d34('0x1c')](function(){return getChanSpyPromise(_0x24b610,_0x304a4d);})[_0x0d34('0x1c')](function(_0x4f2cef){if(_0x4f2cef&&_0x4f2cef[_0x0d34('0x21')]){return _0x24b610[_0x0d34('0x22')][_0x0d34('0x23')](_0x4f2cef);}})[_0x0d34('0x1c')](function(){_0x5848d3();})[_0x0d34('0x1d')](function(_0x5c2200){_0x5848d3(_0x5c2200);});},'afterDestroy':function(_0x27b280,_0x37bc2d,_0x1a3fbe){return _0x24b610['VoiceExtension'][_0x0d34('0x24')]({'where':{'ChanSpyId':_0x27b280['id']}})[_0x0d34('0x1c')](function(){_0x1a3fbe();})['catch'](function(_0x4cfa63){_0x1a3fbe(_0x4cfa63);});}}});}; \ No newline at end of file +var _0xabba=['./voiceChanSpy.attributes','format','push','merge','Set','CDR(type)=%s','chanspy','record','${UNIQUEID}.%s,ab','auth','Authenticate','password','ChanSpy','SIP/%s,%s','options','join','StopMixMonitor','length','internal','name','User','agent','then','exports','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','catch','destroy','lodash','util','bluebird','../../config/logger','api'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xabba,0x1cf));var _0xaabb=function(_0x2b966e,_0x27cf65){_0x2b966e=_0x2b966e-0x0;var _0x26bac8=_0xabba[_0x2b966e];return _0x26bac8;};'use strict';var _=require(_0xaabb('0x0'));var util=require(_0xaabb('0x1'));var BPromise=require(_0xaabb('0x2'));var logger=require(_0xaabb('0x3'))(_0xaabb('0x4'));var attributes=require(_0xaabb('0x5'));var getUserApplications=function(_0x3eff15,_0x4f6c56,_0x729308){var _0x49ea95=0x1;var _0x498adc=[];var _0x4592b7={'context':'from-sip','type':'system','isApp':![]};var _0x1eb662={'exten':util[_0xaabb('0x6')]('%s%s',_0x3eff15['prefix'],_0x729308),'ChanSpyId':_0x3eff15['id'],'UserId':_0x4f6c56['id']};_0x498adc[_0xaabb('0x7')](_[_0xaabb('0x8')]({'app':_0xaabb('0x9'),'appdata':util[_0xaabb('0x6')](_0xaabb('0xa'),_0xaabb('0xb')),'priority':_0x49ea95++},_0x4592b7,_0x1eb662));if(_0x3eff15[_0xaabb('0xc')]){_0x498adc[_0xaabb('0x7')](_[_0xaabb('0x8')]({'app':'MixMonitor','appdata':util[_0xaabb('0x6')](_0xaabb('0xd'),_0x3eff15['recordingFormat']),'priority':_0x49ea95++},_0x4592b7,_0x1eb662));}if(_0x3eff15[_0xaabb('0xe')]){_0x498adc['push'](_[_0xaabb('0x8')]({'app':_0xaabb('0xf'),'appdata':_0x3eff15[_0xaabb('0x10')],'priority':_0x49ea95++},_0x4592b7,_0x1eb662));}_0x498adc[_0xaabb('0x7')](_[_0xaabb('0x8')]({'app':_0xaabb('0x11'),'appdata':util['format'](_0xaabb('0x12'),_0x4f6c56['name'],_0x3eff15[_0xaabb('0x13')]?_0x3eff15[_0xaabb('0x13')][_0xaabb('0x14')](''):''),'priority':_0x49ea95++},_0x4592b7,_0x1eb662));if(_0x3eff15[_0xaabb('0xc')]){_0x498adc[_0xaabb('0x7')](_[_0xaabb('0x8')]({'app':_0xaabb('0x15'),'priority':_0x49ea95++},_0x4592b7,_0x1eb662));}return _0x498adc;};var getChanSpyApplications=function(_0xcb1ab5,_0x1703b4){var _0xe54bae=[];for(var _0x752879=0x0,_0x39fbc5=0x1;_0x752879<_0x1703b4[_0xaabb('0x16')];_0x752879++,_0x39fbc5=0x1){var _0x2b28bd=getUserApplications(_0xcb1ab5,_0x1703b4[_0x752879],_0x1703b4[_0x752879][_0xaabb('0x17')]);var _0x2940ab=getUserApplications(_0xcb1ab5,_0x1703b4[_0x752879],_0x1703b4[_0x752879][_0xaabb('0x18')]);_0xe54bae=_0xe54bae['concat'](_0x2b28bd,_0x2940ab);}return _0xe54bae;};var getChanSpyPromise=function(_0x45d8ba,_0x9aeec9){return new BPromise(function(_0x1e7c0a,_0x258a2e){return _0x45d8ba[_0xaabb('0x19')]['findAll']({'attributes':['id','name',_0xaabb('0x17')],'where':{'role':_0xaabb('0x1a'),'chanspy':!![]},'raw':!![]})[_0xaabb('0x1b')](function(_0x574db8){if(_0x574db8){return _0x1e7c0a(getChanSpyApplications(_0x9aeec9,_0x574db8));}return _0x1e7c0a([]);})['catch'](function(_0x307fe1){_0x258a2e(_0x307fe1);});});};module[_0xaabb('0x1c')]=function(_0x5b9260,_0x6076f7){var _0x16db8b=_0x5b9260['models'];return _0x5b9260[_0xaabb('0x1d')](_0xaabb('0x1e'),attributes,{'tableName':_0xaabb('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x16f922,_0x21cf10,_0x7570d6){return getChanSpyPromise(_0x16db8b,_0x16f922)[_0xaabb('0x1b')](function(_0x26ab97){if(_0x26ab97&&_0x26ab97[_0xaabb('0x16')]){return _0x16db8b[_0xaabb('0x20')][_0xaabb('0x21')](_0x26ab97);}})[_0xaabb('0x1b')](function(){_0x7570d6();})[_0xaabb('0x22')](function(_0x241a97){_0x7570d6(_0x241a97);});},'afterUpdate':function(_0x394f88,_0x3cbe21,_0x270532){return _0x16db8b[_0xaabb('0x20')][_0xaabb('0x23')]({'where':{'ChanSpyId':_0x394f88['id']}})[_0xaabb('0x1b')](function(){return getChanSpyPromise(_0x16db8b,_0x394f88);})['then'](function(_0x55dfcc){if(_0x55dfcc&&_0x55dfcc[_0xaabb('0x16')]){return _0x16db8b[_0xaabb('0x20')][_0xaabb('0x21')](_0x55dfcc);}})[_0xaabb('0x1b')](function(){_0x270532();})[_0xaabb('0x22')](function(_0x5aff5c){_0x270532(_0x5aff5c);});},'afterDestroy':function(_0xdae30b,_0x1252a7,_0x2fee7a){return _0x16db8b[_0xaabb('0x20')]['destroy']({'where':{'ChanSpyId':_0xdae30b['id']}})[_0xaabb('0x1b')](function(){_0x2fee7a();})['catch'](function(_0x2dbc09){_0x2fee7a(_0x2dbc09);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 53678a4..2b542ff 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 _0xae1a=['request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xae1a,0xba));var _0xaae1=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xae1a[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0xaae1('0x0'));var util=require(_0xaae1('0x1'));var moment=require(_0xaae1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaae1('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaae1('0x4'))(_0xaae1('0x5'));var config=require(_0xaae1('0x6'));var jayson=require(_0xaae1('0x7'));var client=jayson[_0xaae1('0x8')][_0xaae1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46ff9b,_0x51228c,_0x2bf14b){return new BPromise(function(_0x181aa4,_0x366677){return client[_0xaae1('0xa')](_0x46ff9b,_0x2bf14b)[_0xaae1('0xb')](function(_0x366017){logger[_0xaae1('0xc')](_0xaae1('0xd'),_0x51228c,_0xaae1('0xe'));logger['debug'](_0xaae1('0xf'),_0x51228c,_0xaae1('0xe'),JSON[_0xaae1('0x10')](_0x366017));if(_0x366017[_0xaae1('0x11')]){if(_0x366017['error'][_0xaae1('0x12')]===0x1f4){logger[_0xaae1('0x11')](_0xaae1('0xd'),_0x51228c,_0x366017['error']['message']);return _0x366677(_0x366017['error'][_0xaae1('0x13')]);}logger['error'](_0xaae1('0xd'),_0x51228c,_0x366017['error']['message']);return _0x181aa4(_0x366017[_0xaae1('0x11')][_0xaae1('0x13')]);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x51228c,_0xaae1('0xe'));_0x181aa4(_0x366017['result'][_0xaae1('0x13')]);}})['catch'](function(_0x11cabd){logger[_0xaae1('0x11')](_0xaae1('0xd'),_0x51228c,_0x11cabd);_0x366677(_0x11cabd);});});} \ No newline at end of file +var _0x9b8c=['VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','request','info'];(function(_0x1e21bf,_0x3ad5d5){var _0x1c7696=function(_0x59c5da){while(--_0x59c5da){_0x1e21bf['push'](_0x1e21bf['shift']());}};_0x1c7696(++_0x3ad5d5);}(_0x9b8c,0x16f));var _0xc9b8=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x9b8c[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0xc9b8('0x0'));var util=require(_0xc9b8('0x1'));var moment=require(_0xc9b8('0x2'));var BPromise=require('bluebird');var rs=require(_0xc9b8('0x3'));var fs=require('fs');var Redis=require(_0xc9b8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc9b8('0x5'));var logger=require('../../config/logger')(_0xc9b8('0x6'));var config=require('../../config/environment');var jayson=require(_0xc9b8('0x7'));var client=jayson[_0xc9b8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3602e7,_0x24547a,_0x4f1ba2){return new BPromise(function(_0x1b977c,_0x2999c2){return client[_0xc9b8('0x9')](_0x3602e7,_0x4f1ba2)['then'](function(_0x1574c3){logger[_0xc9b8('0xa')](_0xc9b8('0xb'),_0x24547a,_0xc9b8('0xc'));logger[_0xc9b8('0xd')](_0xc9b8('0xe'),_0x24547a,_0xc9b8('0xc'),JSON[_0xc9b8('0xf')](_0x1574c3));if(_0x1574c3[_0xc9b8('0x10')]){if(_0x1574c3[_0xc9b8('0x10')][_0xc9b8('0x11')]===0x1f4){logger[_0xc9b8('0x10')](_0xc9b8('0xb'),_0x24547a,_0x1574c3[_0xc9b8('0x10')]['message']);return _0x2999c2(_0x1574c3[_0xc9b8('0x10')][_0xc9b8('0x12')]);}logger[_0xc9b8('0x10')](_0xc9b8('0xb'),_0x24547a,_0x1574c3['error']['message']);return _0x1b977c(_0x1574c3[_0xc9b8('0x10')]['message']);}else{logger[_0xc9b8('0xa')](_0xc9b8('0xb'),_0x24547a,_0xc9b8('0xc'));_0x1b977c(_0x1574c3[_0xc9b8('0x13')][_0xc9b8('0x12')]);}})[_0xc9b8('0x14')](function(_0x2eaa7e){logger[_0xc9b8('0x10')](_0xc9b8('0xb'),_0x24547a,_0x2eaa7e);_0x2999c2(_0x2eaa7e);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 668d19c..154c625 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 _0xfff0=['show','isAuthenticated','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','get','index','/:id'];(function(_0x21b7f2,_0x55c1d4){var _0x1c86da=function(_0xf445ef){while(--_0xf445ef){_0x21b7f2['push'](_0x21b7f2['shift']());}};_0x1c86da(++_0x55c1d4);}(_0xfff0,0x139));var _0x0fff=function(_0x6904dd,_0x159a8e){_0x6904dd=_0x6904dd-0x0;var _0x1bb4ef=_0xfff0[_0x6904dd];return _0x1bb4ef;};'use strict';var multer=require('multer');var util=require(_0x0fff('0x0'));var path=require(_0x0fff('0x1'));var timeout=require(_0x0fff('0x2'));var express=require('express');var router=express[_0x0fff('0x3')]();var auth=require(_0x0fff('0x4'));var interaction=require(_0x0fff('0x5'));var config=require('../../config/environment');var controller=require(_0x0fff('0x6'));router[_0x0fff('0x7')]('/',auth['isAuthenticated'](),controller[_0x0fff('0x8')]);router[_0x0fff('0x7')](_0x0fff('0x9'),auth['isAuthenticated'](),controller[_0x0fff('0xa')]);router['post']('/',auth[_0x0fff('0xb')](),controller['create']);router[_0x0fff('0xc')](_0x0fff('0x9'),auth['isAuthenticated'](),controller[_0x0fff('0xd')]);router[_0x0fff('0xe')](_0x0fff('0x9'),auth[_0x0fff('0xb')](),controller[_0x0fff('0xf')]);module[_0x0fff('0x10')]=router; \ No newline at end of file +var _0x3588=['put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','/:id','show','create'];(function(_0x2ac620,_0x1e643c){var _0x540017=function(_0x2ee61e){while(--_0x2ee61e){_0x2ac620['push'](_0x2ac620['shift']());}};_0x540017(++_0x1e643c);}(_0x3588,0x82));var _0x8358=function(_0x4766f2,_0x38b8a1){_0x4766f2=_0x4766f2-0x0;var _0xe746c2=_0x3588[_0x4766f2];return _0xe746c2;};'use strict';var multer=require(_0x8358('0x0'));var util=require(_0x8358('0x1'));var path=require(_0x8358('0x2'));var timeout=require(_0x8358('0x3'));var express=require(_0x8358('0x4'));var router=express[_0x8358('0x5')]();var auth=require(_0x8358('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8358('0x7'));var controller=require(_0x8358('0x8'));router[_0x8358('0x9')]('/',auth[_0x8358('0xa')](),controller['index']);router[_0x8358('0x9')](_0x8358('0xb'),auth['isAuthenticated'](),controller[_0x8358('0xc')]);router['post']('/',auth[_0x8358('0xa')](),controller[_0x8358('0xd')]);router[_0x8358('0xe')](_0x8358('0xb'),auth['isAuthenticated'](),controller[_0x8358('0xf')]);router['delete'](_0x8358('0xb'),auth[_0x8358('0xa')](),controller[_0x8358('0x10')]);module[_0x8358('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 297e0ab..34b3e7b 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 _0xa389=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x441195,_0x304a76){var _0x8de790=function(_0x57f910){while(--_0x57f910){_0x441195['push'](_0x441195['shift']());}};_0x8de790(++_0x304a76);}(_0xa389,0x11f));var _0x9a38=function(_0x28eb22,_0x20106a){_0x28eb22=_0x28eb22-0x0;var _0x98ebf3=_0xa389[_0x28eb22];return _0x98ebf3;};'use strict';var Sequelize=require(_0x9a38('0x0'));module[_0x9a38('0x1')]={'name':{'type':Sequelize[_0x9a38('0x2')],'unique':_0x9a38('0x3')},'description':{'type':Sequelize[_0x9a38('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x9a38('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe1c2=['name','BOOLEAN','sequelize','exports'];(function(_0x301ce2,_0x2dbe0f){var _0x80a4af=function(_0x42762e){while(--_0x42762e){_0x301ce2['push'](_0x301ce2['shift']());}};_0x80a4af(++_0x2dbe0f);}(_0xe1c2,0x17a));var _0x2e1c=function(_0x180ddc,_0x4ce2a7){_0x180ddc=_0x180ddc-0x0;var _0x4faf2d=_0xe1c2[_0x180ddc];return _0x4faf2d;};'use strict';var Sequelize=require(_0x2e1c('0x0'));module[_0x2e1c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2e1c('0x2')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x2e1c('0x3')],'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 97ab147..b89a7a5 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 _0x7a54=['path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/parsers/qs','api','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','send','rawAttributes','keys','query','dateStart','dateEnd','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','day','add','filter','merge','map','options','VoiceContext','includeAll','findAll','rows','show','params','intersection','length','include','find','create','body','join','root','writeFileSync','Reload','readFileSync','render','chan_sip.so','utf8','/etc/asterisk/extensions_xcally_contexts.conf','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7a54,0x106));var _0x47a5=function(_0x15e4ff,_0x30d16e){_0x15e4ff=_0x15e4ff-0x0;var _0x91567d=_0x7a54[_0x15e4ff];return _0x91567d;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var qs=require(_0x47a5('0xf'));var logger=require('../../config/logger')(_0x47a5('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x47a5('0x11'))['db'];var jayson=require(_0x47a5('0x12'));var client=jayson[_0x47a5('0x13')][_0x47a5('0x14')]({'port':0x232a});function respondWithRpcPromise(_0xd612dd,_0xd308b8,_0x1eae59,_0x5beb89){return new BPromise(function(_0x44bd3e,_0x221b54){var _0x1cf309=_0x5beb89||client;return _0x1cf309[_0x47a5('0x15')](_0xd612dd,_0x1eae59)[_0x47a5('0x16')](function(_0x620ee9){logger[_0x47a5('0x17')](_0x47a5('0x18'),_0xd308b8,'request\x20sent');logger[_0x47a5('0x19')](_0x47a5('0x1a'),_0xd308b8,_0x47a5('0x1b'),JSON[_0x47a5('0x1c')](_0x620ee9));if(_0x620ee9[_0x47a5('0x1d')]){if(_0x620ee9['error']['code']===0x1f4){logger[_0x47a5('0x1d')]('VoiceContext,\x20%s,\x20%s',_0xd308b8,_0x620ee9['error'][_0x47a5('0x1e')]);return _0x221b54(_0x620ee9[_0x47a5('0x1d')][_0x47a5('0x1e')]);}logger[_0x47a5('0x1d')](_0x47a5('0x18'),_0xd308b8,_0x620ee9[_0x47a5('0x1d')][_0x47a5('0x1e')]);return _0x44bd3e(_0x620ee9[_0x47a5('0x1d')][_0x47a5('0x1e')]);}else{logger['info'](_0x47a5('0x18'),_0xd308b8,_0x47a5('0x1b'));_0x44bd3e(_0x620ee9['result'][_0x47a5('0x1e')]);}})[_0x47a5('0x1f')](function(_0x36874d){logger['error'](_0x47a5('0x18'),_0xd308b8,_0x36874d);_0x221b54(_0x36874d);});});}function respondWithStatusCode(_0x2f142b,_0x23db32){_0x23db32=_0x23db32||0xcc;return function(_0x7a9f9e){if(_0x7a9f9e){return _0x2f142b['sendStatus'](_0x23db32);}return _0x2f142b[_0x47a5('0x20')](_0x23db32)[_0x47a5('0x21')]();};}function respondWithResult(_0x513981,_0x28747d){_0x28747d=_0x28747d||0xc8;return function(_0xc4cd63){if(_0xc4cd63){return _0x513981[_0x47a5('0x20')](_0x28747d)[_0x47a5('0x22')](_0xc4cd63);}};}function respondWithFilteredResult(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(_0x53078a){var _0x136745=_0x53078a[_0x47a5('0x23')],_0x5686db=_0x50bf17[_0x47a5('0x24')],_0x1ea9c8=_0x50bf17[_0x47a5('0x24')]+_0x50bf17[_0x47a5('0x25')],_0x5b6c4e;if(_0x1ea9c8>=_0x136745){_0x1ea9c8=_0x136745;_0x5b6c4e=0xc8;}else{_0x5b6c4e=0xce;}_0x3abd6a[_0x47a5('0x20')](_0x5b6c4e);return _0x3abd6a[_0x47a5('0x26')](_0x47a5('0x27'),_0x5686db+'-'+_0x1ea9c8+'/'+_0x136745)[_0x47a5('0x22')](_0x53078a);}return null;};}function patchUpdates(_0x16631f){return function(_0x361bfa){try{jsonpatch[_0x47a5('0x28')](_0x361bfa,_0x16631f,!![]);}catch(_0x11a4fa){return BPromise[_0x47a5('0x29')](_0x11a4fa);}return _0x361bfa['save']();};}function saveUpdates(_0x243210,_0x51833b){return function(_0x2ef875){if(_0x2ef875){return _0x2ef875[_0x47a5('0x2a')](_0x243210)[_0x47a5('0x16')](function(_0x4d6b57){return _0x4d6b57;});}return null;};}function removeEntity(_0x256650,_0x625952){return function(_0x39b50b){if(_0x39b50b){return _0x39b50b[_0x47a5('0x2b')]()['then'](function(){_0x256650['status'](0xcc)[_0x47a5('0x21')]();});}};}function handleEntityNotFound(_0xfb5ddb,_0x5bd7eb){return function(_0x4e1006){if(!_0x4e1006){_0xfb5ddb[_0x47a5('0x2c')](0x194);}return _0x4e1006;};}function handleError(_0x51544e,_0x57bff6){_0x57bff6=_0x57bff6||0x1f4;return function(_0x42f70c){logger['error'](_0x42f70c[_0x47a5('0x2d')]);if(_0x42f70c[_0x47a5('0x2e')]){delete _0x42f70c['name'];}_0x51544e['status'](_0x57bff6)[_0x47a5('0x2f')](_0x42f70c);};}exports['index']=function(_0x403028,_0x87e4c9){var _0xf269a8={},_0x52749b={},_0x18f7e9={'count':0x0,'rows':[]};var _0x50c086=db['VoiceContext'][_0x47a5('0x30')];_0x52749b['model']=_[_0x47a5('0x31')](_0x50c086);var _0x5ef577={'dateStart':_0x403028[_0x47a5('0x32')][_0x47a5('0x33')],'dateEnd':_0x403028[_0x47a5('0x32')][_0x47a5('0x34')]};delete _0x403028[_0x47a5('0x32')][_0x47a5('0x33')];delete _0x403028[_0x47a5('0x32')][_0x47a5('0x34')];_0x52749b[_0x47a5('0x32')]=_['keys'](_0x403028[_0x47a5('0x32')]);_0x52749b[_0x47a5('0x35')]=_['intersection'](_0x52749b[_0x47a5('0x36')],_0x52749b[_0x47a5('0x32')]);_0xf269a8[_0x47a5('0x37')]=_['intersection'](_0x52749b[_0x47a5('0x36')],qs[_0x47a5('0x38')](_0x403028['query'][_0x47a5('0x38')]));_0xf269a8[_0x47a5('0x37')]=_0xf269a8['attributes']['length']?_0xf269a8['attributes']:_0x52749b[_0x47a5('0x36')];if(!_0x403028['query'][_0x47a5('0x39')](_0x47a5('0x3a'))){_0xf269a8[_0x47a5('0x25')]=qs[_0x47a5('0x25')](_0x403028[_0x47a5('0x32')][_0x47a5('0x25')]);_0xf269a8[_0x47a5('0x24')]=qs[_0x47a5('0x24')](_0x403028[_0x47a5('0x32')][_0x47a5('0x24')]);}_0xf269a8[_0x47a5('0x3b')]=qs[_0x47a5('0x3c')](_0x403028[_0x47a5('0x32')]['sort']);_0xf269a8[_0x47a5('0x3d')]=qs[_0x47a5('0x35')](_[_0x47a5('0x3e')](_0x403028[_0x47a5('0x32')],_0x52749b['filters']));if(_0x5ef577[_0x47a5('0x33')]){if(_0x5ef577['dateEnd']){_0x5ef577['dateEnd']=moment(_0x5ef577['dateEnd'])['add'](0x1,_0x47a5('0x3f'));}else{_0x5ef577['dateEnd']=moment(_0x5ef577[_0x47a5('0x33')])[_0x47a5('0x40')](0x1,_0x47a5('0x3f'));}_['merge'](_0xf269a8[_0x47a5('0x3d')],{'createdAt':{'$gte':_0x5ef577[_0x47a5('0x33')],'$lte':_0x5ef577['dateEnd']}});}if(_0x403028['query'][_0x47a5('0x41')]){_0xf269a8['where']=_[_0x47a5('0x42')](_0xf269a8[_0x47a5('0x3d')],{'$or':_[_0x47a5('0x43')](_0xf269a8[_0x47a5('0x37')],function(_0x34a9ae){var _0xf0edbb={};_0xf0edbb[_0x34a9ae]={'$like':'%'+_0x403028[_0x47a5('0x32')][_0x47a5('0x41')]+'%'};return _0xf0edbb;})});}_0xf269a8=_[_0x47a5('0x42')]({},_0xf269a8,_0x403028[_0x47a5('0x44')]);var _0x24ecb1={'where':_0xf269a8[_0x47a5('0x3d')]};return db[_0x47a5('0x45')][_0x47a5('0x23')](_0x24ecb1)[_0x47a5('0x16')](function(_0x3a2b38){_0x18f7e9['count']=_0x3a2b38;if(_0x403028[_0x47a5('0x32')][_0x47a5('0x46')]){_0xf269a8['include']=[{'all':!![]}];}return db['VoiceContext'][_0x47a5('0x47')](_0xf269a8);})['then'](function(_0x13750d){_0x18f7e9[_0x47a5('0x48')]=_0x13750d;return _0x18f7e9;})['then'](respondWithFilteredResult(_0x87e4c9,_0xf269a8))['catch'](handleError(_0x87e4c9,null));};exports[_0x47a5('0x49')]=function(_0x52d409,_0x2d147c){var _0x1d1039={'raw':![],'where':{'id':_0x52d409[_0x47a5('0x4a')]['id']}},_0x3548bc={};_0x3548bc[_0x47a5('0x36')]=_[_0x47a5('0x31')](db[_0x47a5('0x45')]['rawAttributes']);_0x3548bc['query']=_[_0x47a5('0x31')](_0x52d409[_0x47a5('0x32')]);_0x3548bc[_0x47a5('0x35')]=_[_0x47a5('0x4b')](_0x3548bc[_0x47a5('0x36')],_0x3548bc[_0x47a5('0x32')]);_0x1d1039[_0x47a5('0x37')]=_['intersection'](_0x3548bc[_0x47a5('0x36')],qs[_0x47a5('0x38')](_0x52d409[_0x47a5('0x32')]['fields']));_0x1d1039[_0x47a5('0x37')]=_0x1d1039['attributes'][_0x47a5('0x4c')]?_0x1d1039[_0x47a5('0x37')]:_0x3548bc[_0x47a5('0x36')];if(_0x52d409[_0x47a5('0x32')]['includeAll']){_0x1d1039[_0x47a5('0x4d')]=[{'all':!![]}];}_0x1d1039=_[_0x47a5('0x42')]({},_0x1d1039,_0x52d409[_0x47a5('0x44')]);return db[_0x47a5('0x45')][_0x47a5('0x4e')](_0x1d1039)[_0x47a5('0x16')](handleEntityNotFound(_0x2d147c,null))[_0x47a5('0x16')](respondWithResult(_0x2d147c,null))['catch'](handleError(_0x2d147c,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e,_0x8da9fb){var _0x3329aa;return db[_0x47a5('0x45')]['create'](_0x43721b[_0x47a5('0x50')],{'raw':!![]})[_0x47a5('0x16')](function(_0x1aa581){_0x3329aa=_0x1aa581;return db['VoiceContext'][_0x47a5('0x47')]({'raw':!![]});})[_0x47a5('0x16')](function(_0x183b3c){var _0x5d8d4a=fs['readFileSync'](path[_0x47a5('0x51')](config[_0x47a5('0x52')],'server/files/templates/context.ejs'),'utf8');var _0x6d6b2b=ejs['render'](_0x5d8d4a,{'contexts':_0x183b3c||[]});fs[_0x47a5('0x53')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x6d6b2b);})['then'](function(){return respondWithRpcPromise(_0x47a5('0x54'),_0x47a5('0x4f'),{'module':'chan_sip.so'});})[_0x47a5('0x16')](function(){return _0x3329aa;})[_0x47a5('0x16')](respondWithResult(_0x187d7e,0xc9))['catch'](handleError(_0x187d7e,null));};exports['update']=function(_0x16b4fd,_0x30d482,_0x867da0){var _0x2931e4;return db['VoiceContext'][_0x47a5('0x4e')]({'where':{'id':_0x16b4fd[_0x47a5('0x4a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x30d482,null))['then'](saveUpdates(_0x16b4fd[_0x47a5('0x50')],null))['then'](function(_0x485e3c){if(_0x485e3c){_0x2931e4=_0x485e3c;return db[_0x47a5('0x45')][_0x47a5('0x47')]({'raw':!![]});}})[_0x47a5('0x16')](function(_0x3603b7){var _0x4966af=fs[_0x47a5('0x55')](path['join'](config['root'],'server/files/templates/context.ejs'),'utf8');var _0x212d92=ejs[_0x47a5('0x56')](_0x4966af,{'contexts':_0x3603b7||[]});fs[_0x47a5('0x53')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x212d92);})['then'](function(){return respondWithRpcPromise(_0x47a5('0x54'),_0x47a5('0x2a'),{'module':_0x47a5('0x57')});})[_0x47a5('0x16')](function(){return _0x2931e4;})[_0x47a5('0x16')](respondWithResult(_0x30d482,null))['catch'](handleError(_0x30d482,null));};exports[_0x47a5('0x2b')]=function(_0x519e9e,_0x22c886,_0x274d31){var _0x4d545f;return db[_0x47a5('0x45')][_0x47a5('0x4e')]({'where':{'id':_0x519e9e[_0x47a5('0x4a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x22c886,null))[_0x47a5('0x16')](removeEntity(_0x22c886,null))[_0x47a5('0x16')](function(){return db[_0x47a5('0x45')][_0x47a5('0x47')]({'raw':!![]});})['then'](function(_0x2dcc3b){var _0x2a3a57=fs[_0x47a5('0x55')](path[_0x47a5('0x51')](config[_0x47a5('0x52')],'server/files/templates/context.ejs'),_0x47a5('0x58'));var _0xdfcecc=ejs[_0x47a5('0x56')](_0x2a3a57,{'contexts':_0x2dcc3b});fs[_0x47a5('0x53')](_0x47a5('0x59'),_0xdfcecc);return respondWithRpcPromise(_0x47a5('0x54'),_0x47a5('0x2b'),{'module':_0x47a5('0x57')});})[_0x47a5('0x1f')](handleError(_0x22c886,null));}; \ No newline at end of file +var _0x7a54=['path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/parsers/qs','api','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','send','rawAttributes','keys','query','dateStart','dateEnd','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','day','add','filter','merge','map','options','VoiceContext','includeAll','findAll','rows','show','params','intersection','length','include','find','create','body','join','root','writeFileSync','Reload','readFileSync','render','chan_sip.so','utf8','/etc/asterisk/extensions_xcally_contexts.conf','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x126ce5,_0x4013dd){_0x126ce5=_0x126ce5-0x0;var _0x3fe1d9=_0x7a54[_0x126ce5];return _0x3fe1d9;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var qs=require(_0x47a5('0xf'));var logger=require('../../config/logger')(_0x47a5('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x47a5('0x11'))['db'];var jayson=require(_0x47a5('0x12'));var client=jayson[_0x47a5('0x13')][_0x47a5('0x14')]({'port':0x232a});function respondWithRpcPromise(_0xd612dd,_0xd308b8,_0x1eae59,_0x5beb89){return new BPromise(function(_0x44bd3e,_0x221b54){var _0x1cf309=_0x5beb89||client;return _0x1cf309[_0x47a5('0x15')](_0xd612dd,_0x1eae59)[_0x47a5('0x16')](function(_0x620ee9){logger[_0x47a5('0x17')](_0x47a5('0x18'),_0xd308b8,'request\x20sent');logger[_0x47a5('0x19')](_0x47a5('0x1a'),_0xd308b8,_0x47a5('0x1b'),JSON[_0x47a5('0x1c')](_0x620ee9));if(_0x620ee9[_0x47a5('0x1d')]){if(_0x620ee9['error']['code']===0x1f4){logger[_0x47a5('0x1d')]('VoiceContext,\x20%s,\x20%s',_0xd308b8,_0x620ee9['error'][_0x47a5('0x1e')]);return _0x221b54(_0x620ee9[_0x47a5('0x1d')][_0x47a5('0x1e')]);}logger[_0x47a5('0x1d')](_0x47a5('0x18'),_0xd308b8,_0x620ee9[_0x47a5('0x1d')][_0x47a5('0x1e')]);return _0x44bd3e(_0x620ee9[_0x47a5('0x1d')][_0x47a5('0x1e')]);}else{logger['info'](_0x47a5('0x18'),_0xd308b8,_0x47a5('0x1b'));_0x44bd3e(_0x620ee9['result'][_0x47a5('0x1e')]);}})[_0x47a5('0x1f')](function(_0x36874d){logger['error'](_0x47a5('0x18'),_0xd308b8,_0x36874d);_0x221b54(_0x36874d);});});}function respondWithStatusCode(_0x2f142b,_0x23db32){_0x23db32=_0x23db32||0xcc;return function(_0x7a9f9e){if(_0x7a9f9e){return _0x2f142b['sendStatus'](_0x23db32);}return _0x2f142b[_0x47a5('0x20')](_0x23db32)[_0x47a5('0x21')]();};}function respondWithResult(_0x513981,_0x28747d){_0x28747d=_0x28747d||0xc8;return function(_0xc4cd63){if(_0xc4cd63){return _0x513981[_0x47a5('0x20')](_0x28747d)[_0x47a5('0x22')](_0xc4cd63);}};}function respondWithFilteredResult(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(_0x53078a){var _0x136745=_0x53078a[_0x47a5('0x23')],_0x5686db=_0x50bf17[_0x47a5('0x24')],_0x1ea9c8=_0x50bf17[_0x47a5('0x24')]+_0x50bf17[_0x47a5('0x25')],_0x5b6c4e;if(_0x1ea9c8>=_0x136745){_0x1ea9c8=_0x136745;_0x5b6c4e=0xc8;}else{_0x5b6c4e=0xce;}_0x3abd6a[_0x47a5('0x20')](_0x5b6c4e);return _0x3abd6a[_0x47a5('0x26')](_0x47a5('0x27'),_0x5686db+'-'+_0x1ea9c8+'/'+_0x136745)[_0x47a5('0x22')](_0x53078a);}return null;};}function patchUpdates(_0x16631f){return function(_0x361bfa){try{jsonpatch[_0x47a5('0x28')](_0x361bfa,_0x16631f,!![]);}catch(_0x11a4fa){return BPromise[_0x47a5('0x29')](_0x11a4fa);}return _0x361bfa['save']();};}function saveUpdates(_0x243210,_0x51833b){return function(_0x2ef875){if(_0x2ef875){return _0x2ef875[_0x47a5('0x2a')](_0x243210)[_0x47a5('0x16')](function(_0x4d6b57){return _0x4d6b57;});}return null;};}function removeEntity(_0x256650,_0x625952){return function(_0x39b50b){if(_0x39b50b){return _0x39b50b[_0x47a5('0x2b')]()['then'](function(){_0x256650['status'](0xcc)[_0x47a5('0x21')]();});}};}function handleEntityNotFound(_0xfb5ddb,_0x5bd7eb){return function(_0x4e1006){if(!_0x4e1006){_0xfb5ddb[_0x47a5('0x2c')](0x194);}return _0x4e1006;};}function handleError(_0x51544e,_0x57bff6){_0x57bff6=_0x57bff6||0x1f4;return function(_0x42f70c){logger['error'](_0x42f70c[_0x47a5('0x2d')]);if(_0x42f70c[_0x47a5('0x2e')]){delete _0x42f70c['name'];}_0x51544e['status'](_0x57bff6)[_0x47a5('0x2f')](_0x42f70c);};}exports['index']=function(_0x403028,_0x87e4c9){var _0xf269a8={},_0x52749b={},_0x18f7e9={'count':0x0,'rows':[]};var _0x50c086=db['VoiceContext'][_0x47a5('0x30')];_0x52749b['model']=_[_0x47a5('0x31')](_0x50c086);var _0x5ef577={'dateStart':_0x403028[_0x47a5('0x32')][_0x47a5('0x33')],'dateEnd':_0x403028[_0x47a5('0x32')][_0x47a5('0x34')]};delete _0x403028[_0x47a5('0x32')][_0x47a5('0x33')];delete _0x403028[_0x47a5('0x32')][_0x47a5('0x34')];_0x52749b[_0x47a5('0x32')]=_['keys'](_0x403028[_0x47a5('0x32')]);_0x52749b[_0x47a5('0x35')]=_['intersection'](_0x52749b[_0x47a5('0x36')],_0x52749b[_0x47a5('0x32')]);_0xf269a8[_0x47a5('0x37')]=_['intersection'](_0x52749b[_0x47a5('0x36')],qs[_0x47a5('0x38')](_0x403028['query'][_0x47a5('0x38')]));_0xf269a8[_0x47a5('0x37')]=_0xf269a8['attributes']['length']?_0xf269a8['attributes']:_0x52749b[_0x47a5('0x36')];if(!_0x403028['query'][_0x47a5('0x39')](_0x47a5('0x3a'))){_0xf269a8[_0x47a5('0x25')]=qs[_0x47a5('0x25')](_0x403028[_0x47a5('0x32')][_0x47a5('0x25')]);_0xf269a8[_0x47a5('0x24')]=qs[_0x47a5('0x24')](_0x403028[_0x47a5('0x32')][_0x47a5('0x24')]);}_0xf269a8[_0x47a5('0x3b')]=qs[_0x47a5('0x3c')](_0x403028[_0x47a5('0x32')]['sort']);_0xf269a8[_0x47a5('0x3d')]=qs[_0x47a5('0x35')](_[_0x47a5('0x3e')](_0x403028[_0x47a5('0x32')],_0x52749b['filters']));if(_0x5ef577[_0x47a5('0x33')]){if(_0x5ef577['dateEnd']){_0x5ef577['dateEnd']=moment(_0x5ef577['dateEnd'])['add'](0x1,_0x47a5('0x3f'));}else{_0x5ef577['dateEnd']=moment(_0x5ef577[_0x47a5('0x33')])[_0x47a5('0x40')](0x1,_0x47a5('0x3f'));}_['merge'](_0xf269a8[_0x47a5('0x3d')],{'createdAt':{'$gte':_0x5ef577[_0x47a5('0x33')],'$lte':_0x5ef577['dateEnd']}});}if(_0x403028['query'][_0x47a5('0x41')]){_0xf269a8['where']=_[_0x47a5('0x42')](_0xf269a8[_0x47a5('0x3d')],{'$or':_[_0x47a5('0x43')](_0xf269a8[_0x47a5('0x37')],function(_0x34a9ae){var _0xf0edbb={};_0xf0edbb[_0x34a9ae]={'$like':'%'+_0x403028[_0x47a5('0x32')][_0x47a5('0x41')]+'%'};return _0xf0edbb;})});}_0xf269a8=_[_0x47a5('0x42')]({},_0xf269a8,_0x403028[_0x47a5('0x44')]);var _0x24ecb1={'where':_0xf269a8[_0x47a5('0x3d')]};return db[_0x47a5('0x45')][_0x47a5('0x23')](_0x24ecb1)[_0x47a5('0x16')](function(_0x3a2b38){_0x18f7e9['count']=_0x3a2b38;if(_0x403028[_0x47a5('0x32')][_0x47a5('0x46')]){_0xf269a8['include']=[{'all':!![]}];}return db['VoiceContext'][_0x47a5('0x47')](_0xf269a8);})['then'](function(_0x13750d){_0x18f7e9[_0x47a5('0x48')]=_0x13750d;return _0x18f7e9;})['then'](respondWithFilteredResult(_0x87e4c9,_0xf269a8))['catch'](handleError(_0x87e4c9,null));};exports[_0x47a5('0x49')]=function(_0x52d409,_0x2d147c){var _0x1d1039={'raw':![],'where':{'id':_0x52d409[_0x47a5('0x4a')]['id']}},_0x3548bc={};_0x3548bc[_0x47a5('0x36')]=_[_0x47a5('0x31')](db[_0x47a5('0x45')]['rawAttributes']);_0x3548bc['query']=_[_0x47a5('0x31')](_0x52d409[_0x47a5('0x32')]);_0x3548bc[_0x47a5('0x35')]=_[_0x47a5('0x4b')](_0x3548bc[_0x47a5('0x36')],_0x3548bc[_0x47a5('0x32')]);_0x1d1039[_0x47a5('0x37')]=_['intersection'](_0x3548bc[_0x47a5('0x36')],qs[_0x47a5('0x38')](_0x52d409[_0x47a5('0x32')]['fields']));_0x1d1039[_0x47a5('0x37')]=_0x1d1039['attributes'][_0x47a5('0x4c')]?_0x1d1039[_0x47a5('0x37')]:_0x3548bc[_0x47a5('0x36')];if(_0x52d409[_0x47a5('0x32')]['includeAll']){_0x1d1039[_0x47a5('0x4d')]=[{'all':!![]}];}_0x1d1039=_[_0x47a5('0x42')]({},_0x1d1039,_0x52d409[_0x47a5('0x44')]);return db[_0x47a5('0x45')][_0x47a5('0x4e')](_0x1d1039)[_0x47a5('0x16')](handleEntityNotFound(_0x2d147c,null))[_0x47a5('0x16')](respondWithResult(_0x2d147c,null))['catch'](handleError(_0x2d147c,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e,_0x8da9fb){var _0x3329aa;return db[_0x47a5('0x45')]['create'](_0x43721b[_0x47a5('0x50')],{'raw':!![]})[_0x47a5('0x16')](function(_0x1aa581){_0x3329aa=_0x1aa581;return db['VoiceContext'][_0x47a5('0x47')]({'raw':!![]});})[_0x47a5('0x16')](function(_0x183b3c){var _0x5d8d4a=fs['readFileSync'](path[_0x47a5('0x51')](config[_0x47a5('0x52')],'server/files/templates/context.ejs'),'utf8');var _0x6d6b2b=ejs['render'](_0x5d8d4a,{'contexts':_0x183b3c||[]});fs[_0x47a5('0x53')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x6d6b2b);})['then'](function(){return respondWithRpcPromise(_0x47a5('0x54'),_0x47a5('0x4f'),{'module':'chan_sip.so'});})[_0x47a5('0x16')](function(){return _0x3329aa;})[_0x47a5('0x16')](respondWithResult(_0x187d7e,0xc9))['catch'](handleError(_0x187d7e,null));};exports['update']=function(_0x16b4fd,_0x30d482,_0x867da0){var _0x2931e4;return db['VoiceContext'][_0x47a5('0x4e')]({'where':{'id':_0x16b4fd[_0x47a5('0x4a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x30d482,null))['then'](saveUpdates(_0x16b4fd[_0x47a5('0x50')],null))['then'](function(_0x485e3c){if(_0x485e3c){_0x2931e4=_0x485e3c;return db[_0x47a5('0x45')][_0x47a5('0x47')]({'raw':!![]});}})[_0x47a5('0x16')](function(_0x3603b7){var _0x4966af=fs[_0x47a5('0x55')](path['join'](config['root'],'server/files/templates/context.ejs'),'utf8');var _0x212d92=ejs[_0x47a5('0x56')](_0x4966af,{'contexts':_0x3603b7||[]});fs[_0x47a5('0x53')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x212d92);})['then'](function(){return respondWithRpcPromise(_0x47a5('0x54'),_0x47a5('0x2a'),{'module':_0x47a5('0x57')});})[_0x47a5('0x16')](function(){return _0x2931e4;})[_0x47a5('0x16')](respondWithResult(_0x30d482,null))['catch'](handleError(_0x30d482,null));};exports[_0x47a5('0x2b')]=function(_0x519e9e,_0x22c886,_0x274d31){var _0x4d545f;return db[_0x47a5('0x45')][_0x47a5('0x4e')]({'where':{'id':_0x519e9e[_0x47a5('0x4a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x22c886,null))[_0x47a5('0x16')](removeEntity(_0x22c886,null))[_0x47a5('0x16')](function(){return db[_0x47a5('0x45')][_0x47a5('0x47')]({'raw':!![]});})['then'](function(_0x2dcc3b){var _0x2a3a57=fs[_0x47a5('0x55')](path[_0x47a5('0x51')](config[_0x47a5('0x52')],'server/files/templates/context.ejs'),_0x47a5('0x58'));var _0xdfcecc=ejs[_0x47a5('0x56')](_0x2a3a57,{'contexts':_0x2dcc3b});fs[_0x47a5('0x53')](_0x47a5('0x59'),_0xdfcecc);return respondWithRpcPromise(_0x47a5('0x54'),_0x47a5('0x2b'),{'module':_0x47a5('0x57')});})[_0x47a5('0x1f')](handleError(_0x22c886,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 4ebe307..100fa8d 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 _0x76d3=['define','voice_contexts','util','api','moment','bluebird','exports'];(function(_0x4f11cb,_0x14e174){var _0x491488=function(_0x2904a9){while(--_0x2904a9){_0x4f11cb['push'](_0x4f11cb['shift']());}};_0x491488(++_0x14e174);}(_0x76d3,0x13d));var _0x376d=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x76d3[_0x16d10f];return _0x50c823;};'use strict';var _=require('lodash');var util=require(_0x376d('0x0'));var logger=require('../../config/logger')(_0x376d('0x1'));var moment=require(_0x376d('0x2'));var BPromise=require(_0x376d('0x3'));var rp=require('request-promise');var attributes=require('./voiceContext.attributes');module[_0x376d('0x4')]=function(_0x25ad7a,_0x316c24){return _0x25ad7a[_0x376d('0x5')]('VoiceContext',attributes,{'tableName':_0x376d('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac96=['request-promise','./voiceContext.attributes','exports','define','VoiceContext','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac96,0x1e2));var _0x6ac9=function(_0x36d8f2,_0x1b4c6a){_0x36d8f2=_0x36d8f2-0x0;var _0x51f1b0=_0xac96[_0x36d8f2];return _0x51f1b0;};'use strict';var _=require(_0x6ac9('0x0'));var util=require(_0x6ac9('0x1'));var logger=require(_0x6ac9('0x2'))(_0x6ac9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6ac9('0x4'));var attributes=require(_0x6ac9('0x5'));module[_0x6ac9('0x6')]=function(_0x115cd5,_0x56a7a6){return _0x115cd5[_0x6ac9('0x7')](_0x6ac9('0x8'),attributes,{'tableName':'voice_contexts','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 dd836da..0429304 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 _0xf92d=['error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s'];(function(_0x3e2c33,_0x579090){var _0x533aa0=function(_0x40f12a){while(--_0x40f12a){_0x3e2c33['push'](_0x3e2c33['shift']());}};_0x533aa0(++_0x579090);}(_0xf92d,0x6f));var _0xdf92=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xf92d[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0xdf92('0x0'));var util=require(_0xdf92('0x1'));var moment=require(_0xdf92('0x2'));var BPromise=require(_0xdf92('0x3'));var rs=require(_0xdf92('0x4'));var fs=require('fs');var Redis=require(_0xdf92('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf92('0x6'));var logger=require(_0xdf92('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xdf92('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x428798,_0x44e86c,_0x335246){return new BPromise(function(_0x5e36e6,_0x2188ab){return client[_0xdf92('0x9')](_0x428798,_0x335246)[_0xdf92('0xa')](function(_0x3da387){logger[_0xdf92('0xb')](_0xdf92('0xc'),_0x44e86c,_0xdf92('0xd'));logger['debug'](_0xdf92('0xe'),_0x44e86c,_0xdf92('0xd'),JSON['stringify'](_0x3da387));if(_0x3da387['error']){if(_0x3da387[_0xdf92('0xf')][_0xdf92('0x10')]===0x1f4){logger['error'](_0xdf92('0xc'),_0x44e86c,_0x3da387[_0xdf92('0xf')][_0xdf92('0x11')]);return _0x2188ab(_0x3da387[_0xdf92('0xf')][_0xdf92('0x11')]);}logger[_0xdf92('0xf')]('VoiceContext,\x20%s,\x20%s',_0x44e86c,_0x3da387[_0xdf92('0xf')][_0xdf92('0x11')]);return _0x5e36e6(_0x3da387[_0xdf92('0xf')][_0xdf92('0x11')]);}else{logger[_0xdf92('0xb')](_0xdf92('0xc'),_0x44e86c,_0xdf92('0xd'));_0x5e36e6(_0x3da387['result'][_0xdf92('0x11')]);}})['catch'](function(_0x5b3489){logger[_0xdf92('0xf')](_0xdf92('0xc'),_0x44e86c,_0x5b3489);_0x2188ab(_0x5b3489);});});} \ No newline at end of file +var _0xc5b3=['code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x524dfb,_0x954399){var _0x3bec28=function(_0x3d6c89){while(--_0x3d6c89){_0x524dfb['push'](_0x524dfb['shift']());}};_0x3bec28(++_0x954399);}(_0xc5b3,0x117));var _0x3c5b=function(_0x595bd1,_0xb1e7a){_0x595bd1=_0x595bd1-0x0;var _0xd0344f=_0xc5b3[_0x595bd1];return _0xd0344f;};'use strict';var _=require('lodash');var util=require(_0x3c5b('0x0'));var moment=require(_0x3c5b('0x1'));var BPromise=require(_0x3c5b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3c5b('0x3'));var db=require(_0x3c5b('0x4'))['db'];var utils=require(_0x3c5b('0x5'));var logger=require(_0x3c5b('0x6'))(_0x3c5b('0x7'));var config=require(_0x3c5b('0x8'));var jayson=require(_0x3c5b('0x9'));var client=jayson[_0x3c5b('0xa')][_0x3c5b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2859cd,_0x2bde91,_0x5b7791){return new BPromise(function(_0x2b51d4,_0xe8ee94){return client[_0x3c5b('0xc')](_0x2859cd,_0x5b7791)[_0x3c5b('0xd')](function(_0x5506ba){logger[_0x3c5b('0xe')](_0x3c5b('0xf'),_0x2bde91,'request\x20sent');logger[_0x3c5b('0x10')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x2bde91,_0x3c5b('0x11'),JSON[_0x3c5b('0x12')](_0x5506ba));if(_0x5506ba[_0x3c5b('0x13')]){if(_0x5506ba[_0x3c5b('0x13')][_0x3c5b('0x14')]===0x1f4){logger[_0x3c5b('0x13')](_0x3c5b('0xf'),_0x2bde91,_0x5506ba[_0x3c5b('0x13')][_0x3c5b('0x15')]);return _0xe8ee94(_0x5506ba['error'][_0x3c5b('0x15')]);}logger['error'](_0x3c5b('0xf'),_0x2bde91,_0x5506ba[_0x3c5b('0x13')]['message']);return _0x2b51d4(_0x5506ba[_0x3c5b('0x13')][_0x3c5b('0x15')]);}else{logger[_0x3c5b('0xe')](_0x3c5b('0xf'),_0x2bde91,'request\x20sent');_0x2b51d4(_0x5506ba[_0x3c5b('0x16')][_0x3c5b('0x15')]);}})['catch'](function(_0x13eb07){logger[_0x3c5b('0x13')](_0x3c5b('0xf'),_0x2bde91,_0x13eb07);_0xe8ee94(_0x13eb07);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 4423e76..882d3d8 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 _0x5a24=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller'];(function(_0x3cda37,_0x546342){var _0x432e19=function(_0x4aed72){while(--_0x4aed72){_0x3cda37['push'](_0x3cda37['shift']());}};_0x432e19(++_0x546342);}(_0x5a24,0x15c));var _0x45a2=function(_0x4c7bf1,_0x3d657a){_0x4c7bf1=_0x4c7bf1-0x0;var _0x1de74b=_0x5a24[_0x4c7bf1];return _0x1de74b;};'use strict';var multer=require(_0x45a2('0x0'));var util=require(_0x45a2('0x1'));var path=require(_0x45a2('0x2'));var timeout=require(_0x45a2('0x3'));var express=require(_0x45a2('0x4'));var router=express['Router']();var auth=require(_0x45a2('0x5'));var interaction=require(_0x45a2('0x6'));var config=require(_0x45a2('0x7'));var controller=require(_0x45a2('0x8'));router[_0x45a2('0x9')]('/',auth[_0x45a2('0xa')](),controller[_0x45a2('0xb')]);router['get'](_0x45a2('0xc'),auth[_0x45a2('0xa')](),controller[_0x45a2('0xd')]);router[_0x45a2('0x9')](_0x45a2('0xe'),auth['isAuthenticated'](),controller[_0x45a2('0xf')]);router[_0x45a2('0x10')]('/',auth[_0x45a2('0xa')](),controller[_0x45a2('0x11')]);router['put'](_0x45a2('0xe'),auth[_0x45a2('0xa')](),controller[_0x45a2('0x12')]);router[_0x45a2('0x13')](_0x45a2('0xe'),auth[_0x45a2('0xa')](),controller['destroy']);module[_0x45a2('0x14')]=router; \ No newline at end of file +var _0xae48=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','path'];(function(_0x369fb5,_0x177be9){var _0x524685=function(_0xc1e13){while(--_0xc1e13){_0x369fb5['push'](_0x369fb5['shift']());}};_0x524685(++_0x177be9);}(_0xae48,0x167));var _0x8ae4=function(_0x38a155,_0x2aa026){_0x38a155=_0x38a155-0x0;var _0x269403=_0xae48[_0x38a155];return _0x269403;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8ae4('0x0'));var timeout=require(_0x8ae4('0x1'));var express=require(_0x8ae4('0x2'));var router=express[_0x8ae4('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x8ae4('0x4'));var config=require(_0x8ae4('0x5'));var controller=require('./voiceDialReport.controller');router[_0x8ae4('0x6')]('/',auth[_0x8ae4('0x7')](),controller[_0x8ae4('0x8')]);router[_0x8ae4('0x6')](_0x8ae4('0x9'),auth[_0x8ae4('0x7')](),controller[_0x8ae4('0xa')]);router[_0x8ae4('0x6')](_0x8ae4('0xb'),auth['isAuthenticated'](),controller[_0x8ae4('0xc')]);router[_0x8ae4('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8ae4('0xe')]('/:id',auth[_0x8ae4('0x7')](),controller[_0x8ae4('0xf')]);router[_0x8ae4('0x10')]('/:id',auth[_0x8ae4('0x7')](),controller[_0x8ae4('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 344511b..61ff28d 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 _0xaf76=['sequelize','exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xaf76,0x1b6));var _0x6af7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaf76[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6af7('0x0'));module[_0x6af7('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x6af7('0x2')]},'channelstate':{'type':Sequelize[_0x6af7('0x3')]},'channelstatedesc':{'type':Sequelize[_0x6af7('0x2')]},'calleridnum':{'type':Sequelize[_0x6af7('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x6af7('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x6af7('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x6af7('0x2')]},'linkedid':{'type':Sequelize[_0x6af7('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x6af7('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x6af7('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x6af7('0x2')]},'destlanguage':{'type':Sequelize[_0x6af7('0x2')]},'destaccountcode':{'type':Sequelize[_0x6af7('0x2')]},'destcontext':{'type':Sequelize[_0x6af7('0x2')]},'destexten':{'type':Sequelize[_0x6af7('0x2')]},'destpriority':{'type':Sequelize[_0x6af7('0x3')]},'destuniqueid':{'type':Sequelize[_0x6af7('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x6af7('0x2')]},'dialstatus':{'type':Sequelize[_0x6af7('0x2')]},'starttime':{'type':Sequelize[_0x6af7('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x6af7('0x4')]},'lastevent':{'type':Sequelize[_0x6af7('0x2')],'comment':_0x6af7('0x5')},'routeId':{'type':Sequelize[_0x6af7('0x3')]},'duration':{'type':Sequelize[_0x6af7('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x6af7('0x3')]}}; \ No newline at end of file +var _0x857f=['INTEGER','DATE','sequelize','exports','STRING'];(function(_0x106487,_0x23de58){var _0xc1da08=function(_0x2b06db){while(--_0x2b06db){_0x106487['push'](_0x106487['shift']());}};_0xc1da08(++_0x23de58);}(_0x857f,0x1c9));var _0xf857=function(_0x5b791d,_0x49cc81){_0x5b791d=_0x5b791d-0x0;var _0xdd1c36=_0x857f[_0x5b791d];return _0xdd1c36;};'use strict';var Sequelize=require(_0xf857('0x0'));module[_0xf857('0x1')]={'privilege':{'type':Sequelize[_0xf857('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xf857('0x2')]},'calleridnum':{'type':Sequelize[_0xf857('0x2')]},'calleridname':{'type':Sequelize[_0xf857('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xf857('0x2')]},'language':{'type':Sequelize[_0xf857('0x2')]},'accountcode':{'type':Sequelize[_0xf857('0x2')]},'context':{'type':Sequelize[_0xf857('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xf857('0x3')]},'uniqueid':{'type':Sequelize[_0xf857('0x2')]},'linkedid':{'type':Sequelize[_0xf857('0x2')]},'destchannel':{'type':Sequelize[_0xf857('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xf857('0x2')]},'destcalleridnum':{'type':Sequelize[_0xf857('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xf857('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xf857('0x2')]},'destaccountcode':{'type':Sequelize[_0xf857('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xf857('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xf857('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0xf857('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xf857('0x4')]},'answertime':{'type':Sequelize[_0xf857('0x4')]},'endtime':{'type':Sequelize[_0xf857('0x4')]},'lastevent':{'type':Sequelize[_0xf857('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xf857('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xf857('0x3')]},'billableseconds':{'type':Sequelize[_0xf857('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 3c119d2..a560833 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 _0x4a73=['filter','map','then','includeAll','findAll','rows','catch','show','intersection','include','options','find','create','body','destroy','params','describe','html-pdf','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','sendStatus','error','stack','name','send','index','VoiceDialReport','rawAttributes','keys','query','dateStart','dateEnd','filters','attributes','model','fields','length','nolimit','order','sort','where','pick','add','day','merge'];(function(_0x11f7e2,_0x332304){var _0x236c98=function(_0x13942d){while(--_0x13942d){_0x11f7e2['push'](_0x11f7e2['shift']());}};_0x236c98(++_0x332304);}(_0x4a73,0xa9));var _0x34a7=function(_0x4fd42b,_0x588cac){_0x4fd42b=_0x4fd42b-0x0;var _0xb47bb2=_0x4a73[_0x4fd42b];return _0xb47bb2;};'use strict';var pdf=require(_0x34a7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x34a7('0x1'));var zipdir=require(_0x34a7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x34a7('0x3'));var moment=require('moment');var BPromise=require(_0x34a7('0x4'));var Mustache=require('mustache');var util=require(_0x34a7('0x5'));var path=require(_0x34a7('0x6'));var sox=require(_0x34a7('0x7'));var csv=require(_0x34a7('0x8'));var ejs=require(_0x34a7('0x9'));var fs=require('fs');var _=require(_0x34a7('0xa'));var squel=require(_0x34a7('0xb'));var crypto=require(_0x34a7('0xc'));var jsforce=require(_0x34a7('0xd'));var deskjs=require(_0x34a7('0xe'));var toCsv=require(_0x34a7('0x8'));var querystring=require(_0x34a7('0xf'));var Papa=require(_0x34a7('0x10'));var Redis=require('ioredis');var qs=require(_0x34a7('0x11'));var logger=require(_0x34a7('0x12'))(_0x34a7('0x13'));var utils=require(_0x34a7('0x14'));var config=require(_0x34a7('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c806c,_0x3ca42e){_0x3ca42e=_0x3ca42e||0xcc;return function(_0x35a217){if(_0x35a217){return _0x1c806c['sendStatus'](_0x3ca42e);}return _0x1c806c[_0x34a7('0x16')](_0x3ca42e)[_0x34a7('0x17')]();};}function respondWithResult(_0x37f4e5,_0x3db4e5){_0x3db4e5=_0x3db4e5||0xc8;return function(_0x3eb1e9){if(_0x3eb1e9){return _0x37f4e5['status'](_0x3db4e5)[_0x34a7('0x18')](_0x3eb1e9);}};}function respondWithFilteredResult(_0x51afd3,_0x4adbf2){return function(_0x1b5ec2){if(_0x1b5ec2){var _0x254204=_0x1b5ec2[_0x34a7('0x19')],_0x388f30=_0x4adbf2[_0x34a7('0x1a')],_0x14a6b9=_0x4adbf2[_0x34a7('0x1a')]+_0x4adbf2[_0x34a7('0x1b')],_0x305cf0;if(_0x14a6b9>=_0x254204){_0x14a6b9=_0x254204;_0x305cf0=0xc8;}else{_0x305cf0=0xce;}_0x51afd3['status'](_0x305cf0);return _0x51afd3[_0x34a7('0x1c')](_0x34a7('0x1d'),_0x388f30+'-'+_0x14a6b9+'/'+_0x254204)[_0x34a7('0x18')](_0x1b5ec2);}return null;};}function patchUpdates(_0x1a9bd4){return function(_0x186adc){try{jsonpatch[_0x34a7('0x1e')](_0x186adc,_0x1a9bd4,!![]);}catch(_0x41543f){return BPromise[_0x34a7('0x1f')](_0x41543f);}return _0x186adc[_0x34a7('0x20')]();};}function saveUpdates(_0x4abfeb,_0x16597d){return function(_0x3e2524){if(_0x3e2524){return _0x3e2524[_0x34a7('0x21')](_0x4abfeb)['then'](function(_0x7be413){return _0x7be413;});}return null;};}function removeEntity(_0x41b186,_0x3980a4){return function(_0x210a9e){if(_0x210a9e){return _0x210a9e['destroy']()['then'](function(){_0x41b186[_0x34a7('0x16')](0xcc)[_0x34a7('0x17')]();});}};}function handleEntityNotFound(_0x571d3b,_0x110223){return function(_0x1805e8){if(!_0x1805e8){_0x571d3b[_0x34a7('0x22')](0x194);}return _0x1805e8;};}function handleError(_0x5f444d,_0xd95cab){_0xd95cab=_0xd95cab||0x1f4;return function(_0x100985){logger[_0x34a7('0x23')](_0x100985[_0x34a7('0x24')]);if(_0x100985[_0x34a7('0x25')]){delete _0x100985[_0x34a7('0x25')];}_0x5f444d[_0x34a7('0x16')](_0xd95cab)[_0x34a7('0x26')](_0x100985);};}exports[_0x34a7('0x27')]=function(_0x45000b,_0x539f66){var _0x57eac0={},_0x5167f0={},_0x26aed7={'count':0x0,'rows':[]};var _0x65f0e8=db[_0x34a7('0x28')][_0x34a7('0x29')];_0x5167f0['model']=_[_0x34a7('0x2a')](_0x65f0e8);var _0x7826fe={'dateStart':_0x45000b[_0x34a7('0x2b')][_0x34a7('0x2c')],'dateEnd':_0x45000b[_0x34a7('0x2b')][_0x34a7('0x2d')]};delete _0x45000b[_0x34a7('0x2b')][_0x34a7('0x2c')];delete _0x45000b['query'][_0x34a7('0x2d')];_0x5167f0[_0x34a7('0x2b')]=_[_0x34a7('0x2a')](_0x45000b[_0x34a7('0x2b')]);_0x5167f0[_0x34a7('0x2e')]=_['intersection'](_0x5167f0['model'],_0x5167f0[_0x34a7('0x2b')]);_0x57eac0[_0x34a7('0x2f')]=_['intersection'](_0x5167f0[_0x34a7('0x30')],qs[_0x34a7('0x31')](_0x45000b['query'][_0x34a7('0x31')]));_0x57eac0[_0x34a7('0x2f')]=_0x57eac0['attributes'][_0x34a7('0x32')]?_0x57eac0[_0x34a7('0x2f')]:_0x5167f0[_0x34a7('0x30')];if(!_0x45000b[_0x34a7('0x2b')]['hasOwnProperty'](_0x34a7('0x33'))){_0x57eac0[_0x34a7('0x1b')]=qs[_0x34a7('0x1b')](_0x45000b[_0x34a7('0x2b')][_0x34a7('0x1b')]);_0x57eac0[_0x34a7('0x1a')]=qs[_0x34a7('0x1a')](_0x45000b[_0x34a7('0x2b')][_0x34a7('0x1a')]);}_0x57eac0[_0x34a7('0x34')]=qs[_0x34a7('0x35')](_0x45000b['query']['sort']);_0x57eac0[_0x34a7('0x36')]=qs[_0x34a7('0x2e')](_[_0x34a7('0x37')](_0x45000b['query'],_0x5167f0[_0x34a7('0x2e')]));if(_0x7826fe[_0x34a7('0x2c')]){if(_0x7826fe[_0x34a7('0x2d')]){_0x7826fe['dateEnd']=moment(_0x7826fe[_0x34a7('0x2d')])[_0x34a7('0x38')](0x1,_0x34a7('0x39'));}else{_0x7826fe[_0x34a7('0x2d')]=moment(_0x7826fe['dateStart'])['add'](0x1,_0x34a7('0x39'));}_[_0x34a7('0x3a')](_0x57eac0[_0x34a7('0x36')],{'createdAt':{'$gte':_0x7826fe[_0x34a7('0x2c')],'$lte':_0x7826fe[_0x34a7('0x2d')]}});}if(_0x45000b[_0x34a7('0x2b')][_0x34a7('0x3b')]){_0x57eac0[_0x34a7('0x36')]=_[_0x34a7('0x3a')](_0x57eac0[_0x34a7('0x36')],{'$or':_[_0x34a7('0x3c')](_0x57eac0[_0x34a7('0x2f')],function(_0x516464){var _0x45e813={};_0x45e813[_0x516464]={'$like':'%'+_0x45000b[_0x34a7('0x2b')]['filter']+'%'};return _0x45e813;})});}_0x57eac0=_[_0x34a7('0x3a')]({},_0x57eac0,_0x45000b['options']);var _0x4cf147={'where':_0x57eac0['where']};return db['VoiceDialReport'][_0x34a7('0x19')](_0x4cf147)[_0x34a7('0x3d')](function(_0x1765b6){_0x26aed7[_0x34a7('0x19')]=_0x1765b6;if(_0x45000b['query'][_0x34a7('0x3e')]){_0x57eac0['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0x34a7('0x3f')](_0x57eac0);})[_0x34a7('0x3d')](function(_0x96eb19){_0x26aed7[_0x34a7('0x40')]=_0x96eb19;return _0x26aed7;})[_0x34a7('0x3d')](respondWithFilteredResult(_0x539f66,_0x57eac0))[_0x34a7('0x41')](handleError(_0x539f66,null));};exports[_0x34a7('0x42')]=function(_0x5772bb,_0x22daf5){var _0x509ff3={'raw':!![],'where':{'id':_0x5772bb['params']['id']}},_0x162de5={};_0x162de5['model']=_['keys'](db[_0x34a7('0x28')][_0x34a7('0x29')]);_0x162de5['query']=_[_0x34a7('0x2a')](_0x5772bb[_0x34a7('0x2b')]);_0x162de5[_0x34a7('0x2e')]=_[_0x34a7('0x43')](_0x162de5[_0x34a7('0x30')],_0x162de5[_0x34a7('0x2b')]);_0x509ff3[_0x34a7('0x2f')]=_[_0x34a7('0x43')](_0x162de5['model'],qs['fields'](_0x5772bb[_0x34a7('0x2b')][_0x34a7('0x31')]));_0x509ff3[_0x34a7('0x2f')]=_0x509ff3[_0x34a7('0x2f')][_0x34a7('0x32')]?_0x509ff3[_0x34a7('0x2f')]:_0x162de5[_0x34a7('0x30')];if(_0x5772bb['query'][_0x34a7('0x3e')]){_0x509ff3[_0x34a7('0x44')]=[{'all':!![]}];}_0x509ff3=_[_0x34a7('0x3a')]({},_0x509ff3,_0x5772bb[_0x34a7('0x45')]);return db[_0x34a7('0x28')][_0x34a7('0x46')](_0x509ff3)[_0x34a7('0x3d')](handleEntityNotFound(_0x22daf5,null))[_0x34a7('0x3d')](respondWithResult(_0x22daf5,null))[_0x34a7('0x41')](handleError(_0x22daf5,null));};exports[_0x34a7('0x47')]=function(_0x5bd175,_0x39892c){return db['VoiceDialReport']['create'](_0x5bd175[_0x34a7('0x48')],{})[_0x34a7('0x3d')](respondWithResult(_0x39892c,0xc9))[_0x34a7('0x41')](handleError(_0x39892c,null));};exports['update']=function(_0x4d49bc,_0x35e7d2){if(_0x4d49bc[_0x34a7('0x48')]['id']){delete _0x4d49bc[_0x34a7('0x48')]['id'];}return db[_0x34a7('0x28')][_0x34a7('0x46')]({'where':{'id':_0x4d49bc['params']['id']}})['then'](handleEntityNotFound(_0x35e7d2,null))['then'](saveUpdates(_0x4d49bc[_0x34a7('0x48')],null))[_0x34a7('0x3d')](respondWithResult(_0x35e7d2,null))[_0x34a7('0x41')](handleError(_0x35e7d2,null));};exports[_0x34a7('0x49')]=function(_0x3c7aec,_0x2dee9a){return db['VoiceDialReport'][_0x34a7('0x46')]({'where':{'id':_0x3c7aec[_0x34a7('0x4a')]['id']}})[_0x34a7('0x3d')](handleEntityNotFound(_0x2dee9a,null))[_0x34a7('0x3d')](removeEntity(_0x2dee9a,null))['catch'](handleError(_0x2dee9a,null));};exports['describe']=function(_0x166ee5,_0x4f539e){return db[_0x34a7('0x28')][_0x34a7('0x4b')]()['then'](respondWithResult(_0x4f539e,null))['catch'](handleError(_0x4f539e,null));}; \ No newline at end of file +var _0x97c6=['then','destroy','stack','name','send','index','VoiceDialReport','rawAttributes','model','query','dateEnd','dateStart','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','pick','add','day','merge','filter','where','includeAll','include','findAll','catch','params','options','find','create','body','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','reject','save','update'];(function(_0x555223,_0x2f924b){var _0x94b316=function(_0x2c71bb){while(--_0x2c71bb){_0x555223['push'](_0x555223['shift']());}};_0x94b316(++_0x2f924b);}(_0x97c6,0x12e));var _0x697c=function(_0x4de9e8,_0x565ffa){_0x4de9e8=_0x4de9e8-0x0;var _0x4db0de=_0x97c6[_0x4de9e8];return _0x4db0de;};'use strict';var pdf=require(_0x697c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x697c('0x1'));var jsonpatch=require(_0x697c('0x2'));var rp=require(_0x697c('0x3'));var moment=require(_0x697c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x697c('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x697c('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x697c('0x7'));var squel=require(_0x697c('0x8'));var crypto=require(_0x697c('0x9'));var jsforce=require(_0x697c('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x697c('0x6'));var querystring=require(_0x697c('0xb'));var Papa=require(_0x697c('0xc'));var Redis=require(_0x697c('0xd'));var qs=require(_0x697c('0xe'));var logger=require(_0x697c('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x697c('0x10'));var db=require(_0x697c('0x11'))['db'];function respondWithStatusCode(_0x9fb6b0,_0x5470e8){_0x5470e8=_0x5470e8||0xcc;return function(_0x5be367){if(_0x5be367){return _0x9fb6b0[_0x697c('0x12')](_0x5470e8);}return _0x9fb6b0[_0x697c('0x13')](_0x5470e8)[_0x697c('0x14')]();};}function respondWithResult(_0x3a9c6f,_0x11967c){_0x11967c=_0x11967c||0xc8;return function(_0x216da0){if(_0x216da0){return _0x3a9c6f[_0x697c('0x13')](_0x11967c)['json'](_0x216da0);}};}function respondWithFilteredResult(_0x579ab3,_0x5eb88b){return function(_0x3fa02a){if(_0x3fa02a){var _0x143906=_0x3fa02a[_0x697c('0x15')],_0x38616c=_0x5eb88b['offset'],_0x1a625f=_0x5eb88b['offset']+_0x5eb88b[_0x697c('0x16')],_0x132187;if(_0x1a625f>=_0x143906){_0x1a625f=_0x143906;_0x132187=0xc8;}else{_0x132187=0xce;}_0x579ab3[_0x697c('0x13')](_0x132187);return _0x579ab3[_0x697c('0x17')](_0x697c('0x18'),_0x38616c+'-'+_0x1a625f+'/'+_0x143906)['json'](_0x3fa02a);}return null;};}function patchUpdates(_0x1ac072){return function(_0x506cb0){try{jsonpatch['apply'](_0x506cb0,_0x1ac072,!![]);}catch(_0x380ee1){return BPromise[_0x697c('0x19')](_0x380ee1);}return _0x506cb0[_0x697c('0x1a')]();};}function saveUpdates(_0x4dd1ae,_0x277f3b){return function(_0x30168c){if(_0x30168c){return _0x30168c[_0x697c('0x1b')](_0x4dd1ae)[_0x697c('0x1c')](function(_0x484184){return _0x484184;});}return null;};}function removeEntity(_0x48731b,_0x11ba22){return function(_0x52499d){if(_0x52499d){return _0x52499d[_0x697c('0x1d')]()['then'](function(){_0x48731b[_0x697c('0x13')](0xcc)[_0x697c('0x14')]();});}};}function handleEntityNotFound(_0x3bfd0b,_0x4580dc){return function(_0x28b7f4){if(!_0x28b7f4){_0x3bfd0b[_0x697c('0x12')](0x194);}return _0x28b7f4;};}function handleError(_0x1f562e,_0x3d83ea){_0x3d83ea=_0x3d83ea||0x1f4;return function(_0x2040ee){logger['error'](_0x2040ee[_0x697c('0x1e')]);if(_0x2040ee[_0x697c('0x1f')]){delete _0x2040ee['name'];}_0x1f562e[_0x697c('0x13')](_0x3d83ea)[_0x697c('0x20')](_0x2040ee);};}exports[_0x697c('0x21')]=function(_0x538caf,_0x27dea6){var _0x5acf7b={},_0x3d607e={},_0x4b51df={'count':0x0,'rows':[]};var _0x4b290b=db[_0x697c('0x22')][_0x697c('0x23')];_0x3d607e[_0x697c('0x24')]=_['keys'](_0x4b290b);var _0x29b778={'dateStart':_0x538caf['query']['dateStart'],'dateEnd':_0x538caf[_0x697c('0x25')][_0x697c('0x26')]};delete _0x538caf[_0x697c('0x25')][_0x697c('0x27')];delete _0x538caf[_0x697c('0x25')][_0x697c('0x26')];_0x3d607e['query']=_[_0x697c('0x28')](_0x538caf[_0x697c('0x25')]);_0x3d607e[_0x697c('0x29')]=_[_0x697c('0x2a')](_0x3d607e[_0x697c('0x24')],_0x3d607e['query']);_0x5acf7b[_0x697c('0x2b')]=_[_0x697c('0x2a')](_0x3d607e[_0x697c('0x24')],qs[_0x697c('0x2c')](_0x538caf[_0x697c('0x25')][_0x697c('0x2c')]));_0x5acf7b[_0x697c('0x2b')]=_0x5acf7b[_0x697c('0x2b')][_0x697c('0x2d')]?_0x5acf7b['attributes']:_0x3d607e[_0x697c('0x24')];if(!_0x538caf[_0x697c('0x25')][_0x697c('0x2e')]('nolimit')){_0x5acf7b[_0x697c('0x16')]=qs[_0x697c('0x16')](_0x538caf[_0x697c('0x25')][_0x697c('0x16')]);_0x5acf7b[_0x697c('0x2f')]=qs[_0x697c('0x2f')](_0x538caf[_0x697c('0x25')]['offset']);}_0x5acf7b[_0x697c('0x30')]=qs[_0x697c('0x31')](_0x538caf[_0x697c('0x25')][_0x697c('0x31')]);_0x5acf7b['where']=qs[_0x697c('0x29')](_[_0x697c('0x32')](_0x538caf['query'],_0x3d607e[_0x697c('0x29')]));if(_0x29b778['dateStart']){if(_0x29b778[_0x697c('0x26')]){_0x29b778[_0x697c('0x26')]=moment(_0x29b778[_0x697c('0x26')])[_0x697c('0x33')](0x1,_0x697c('0x34'));}else{_0x29b778[_0x697c('0x26')]=moment(_0x29b778[_0x697c('0x27')])[_0x697c('0x33')](0x1,_0x697c('0x34'));}_[_0x697c('0x35')](_0x5acf7b['where'],{'createdAt':{'$gte':_0x29b778[_0x697c('0x27')],'$lte':_0x29b778[_0x697c('0x26')]}});}if(_0x538caf[_0x697c('0x25')][_0x697c('0x36')]){_0x5acf7b[_0x697c('0x37')]=_[_0x697c('0x35')](_0x5acf7b[_0x697c('0x37')],{'$or':_['map'](_0x5acf7b['attributes'],function(_0x30d62b){var _0x3299d1={};_0x3299d1[_0x30d62b]={'$like':'%'+_0x538caf['query'][_0x697c('0x36')]+'%'};return _0x3299d1;})});}_0x5acf7b=_[_0x697c('0x35')]({},_0x5acf7b,_0x538caf['options']);var _0x270a13={'where':_0x5acf7b[_0x697c('0x37')]};return db[_0x697c('0x22')][_0x697c('0x15')](_0x270a13)['then'](function(_0x4fd5b1){_0x4b51df[_0x697c('0x15')]=_0x4fd5b1;if(_0x538caf[_0x697c('0x25')][_0x697c('0x38')]){_0x5acf7b[_0x697c('0x39')]=[{'all':!![]}];}return db[_0x697c('0x22')][_0x697c('0x3a')](_0x5acf7b);})[_0x697c('0x1c')](function(_0xc403dc){_0x4b51df['rows']=_0xc403dc;return _0x4b51df;})[_0x697c('0x1c')](respondWithFilteredResult(_0x27dea6,_0x5acf7b))[_0x697c('0x3b')](handleError(_0x27dea6,null));};exports['show']=function(_0x1a44ff,_0x53e679){var _0x5a533a={'raw':!![],'where':{'id':_0x1a44ff[_0x697c('0x3c')]['id']}},_0x4896cc={};_0x4896cc[_0x697c('0x24')]=_[_0x697c('0x28')](db[_0x697c('0x22')][_0x697c('0x23')]);_0x4896cc['query']=_[_0x697c('0x28')](_0x1a44ff[_0x697c('0x25')]);_0x4896cc[_0x697c('0x29')]=_[_0x697c('0x2a')](_0x4896cc[_0x697c('0x24')],_0x4896cc[_0x697c('0x25')]);_0x5a533a['attributes']=_[_0x697c('0x2a')](_0x4896cc[_0x697c('0x24')],qs[_0x697c('0x2c')](_0x1a44ff[_0x697c('0x25')]['fields']));_0x5a533a['attributes']=_0x5a533a[_0x697c('0x2b')][_0x697c('0x2d')]?_0x5a533a['attributes']:_0x4896cc[_0x697c('0x24')];if(_0x1a44ff['query']['includeAll']){_0x5a533a[_0x697c('0x39')]=[{'all':!![]}];}_0x5a533a=_[_0x697c('0x35')]({},_0x5a533a,_0x1a44ff[_0x697c('0x3d')]);return db['VoiceDialReport'][_0x697c('0x3e')](_0x5a533a)['then'](handleEntityNotFound(_0x53e679,null))[_0x697c('0x1c')](respondWithResult(_0x53e679,null))[_0x697c('0x3b')](handleError(_0x53e679,null));};exports[_0x697c('0x3f')]=function(_0xc4a8b5,_0x565952){return db[_0x697c('0x22')]['create'](_0xc4a8b5[_0x697c('0x40')],{})[_0x697c('0x1c')](respondWithResult(_0x565952,0xc9))[_0x697c('0x3b')](handleError(_0x565952,null));};exports['update']=function(_0x2eafc4,_0x498776){if(_0x2eafc4[_0x697c('0x40')]['id']){delete _0x2eafc4[_0x697c('0x40')]['id'];}return db[_0x697c('0x22')][_0x697c('0x3e')]({'where':{'id':_0x2eafc4[_0x697c('0x3c')]['id']}})[_0x697c('0x1c')](handleEntityNotFound(_0x498776,null))[_0x697c('0x1c')](saveUpdates(_0x2eafc4[_0x697c('0x40')],null))[_0x697c('0x1c')](respondWithResult(_0x498776,null))[_0x697c('0x3b')](handleError(_0x498776,null));};exports['destroy']=function(_0x3987b1,_0x56dcc0){return db[_0x697c('0x22')][_0x697c('0x3e')]({'where':{'id':_0x3987b1[_0x697c('0x3c')]['id']}})['then'](handleEntityNotFound(_0x56dcc0,null))[_0x697c('0x1c')](removeEntity(_0x56dcc0,null))[_0x697c('0x3b')](handleError(_0x56dcc0,null));};exports[_0x697c('0x41')]=function(_0x3da940,_0x68499d){return db[_0x697c('0x22')][_0x697c('0x41')]()[_0x697c('0x1c')](respondWithResult(_0x68499d,null))[_0x697c('0x3b')](handleError(_0x68499d,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 5906020..5850e29 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 _0xc57b=['exports','VoiceDialReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./voiceDialReport.attributes'];(function(_0x3065de,_0x349b0d){var _0x472f9f=function(_0x585937){while(--_0x585937){_0x3065de['push'](_0x3065de['shift']());}};_0x472f9f(++_0x349b0d);}(_0xc57b,0x19c));var _0xbc57=function(_0x22eaff,_0x55fa0f){_0x22eaff=_0x22eaff-0x0;var _0xce5b55=_0xc57b[_0x22eaff];return _0xce5b55;};'use strict';var _=require(_0xbc57('0x0'));var util=require(_0xbc57('0x1'));var logger=require(_0xbc57('0x2'))(_0xbc57('0x3'));var moment=require(_0xbc57('0x4'));var BPromise=require(_0xbc57('0x5'));var rp=require(_0xbc57('0x6'));var attributes=require(_0xbc57('0x7'));module[_0xbc57('0x8')]=function(_0x14759d,_0x364b8b){return _0x14759d['define'](_0xbc57('0x9'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x38c5=['VoiceDialReport','util','moment','exports','define'];(function(_0xf43e5c,_0x2034ed){var _0x2454c5=function(_0x403100){while(--_0x403100){_0xf43e5c['push'](_0xf43e5c['shift']());}};_0x2454c5(++_0x2034ed);}(_0x38c5,0x1e1));var _0x538c=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x38c5[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0x538c('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x538c('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./voiceDialReport.attributes');module[_0x538c('0x2')]=function(_0x2eef61,_0x217349){return _0x2eef61[_0x538c('0x3')](_0x538c('0x4'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 6eae41b..2514870 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 _0x9f75=['UpdateVoiceDialReport','VoiceDialReport','update','where','limit','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateVoiceDialReport','create','body','options','raw','stringify'];(function(_0x1fc1f9,_0x454fb2){var _0x4987ca=function(_0x5e90dd){while(--_0x5e90dd){_0x1fc1f9['push'](_0x1fc1f9['shift']());}};_0x4987ca(++_0x454fb2);}(_0x9f75,0x15a));var _0x59f7=function(_0x565d89,_0x54b390){_0x565d89=_0x565d89-0x0;var _0x57b9c9=_0x9f75[_0x565d89];return _0x57b9c9;};'use strict';var _=require(_0x59f7('0x0'));var util=require('util');var moment=require(_0x59f7('0x1'));var BPromise=require(_0x59f7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x59f7('0x3'))['db'];var utils=require(_0x59f7('0x4'));var logger=require(_0x59f7('0x5'))(_0x59f7('0x6'));var config=require('../../config/environment');var jayson=require(_0x59f7('0x7'));var client=jayson[_0x59f7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5483bc,_0xeb6d1e,_0x15903b){return new BPromise(function(_0x3bf8e1,_0x21e3e5){return client[_0x59f7('0x9')](_0x5483bc,_0x15903b)[_0x59f7('0xa')](function(_0x553357){logger[_0x59f7('0xb')](_0x59f7('0xc'),_0xeb6d1e,_0x59f7('0xd'));logger[_0x59f7('0xe')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0xeb6d1e,_0x59f7('0xd'),JSON['stringify'](_0x553357));if(_0x553357[_0x59f7('0xf')]){if(_0x553357['error'][_0x59f7('0x10')]===0x1f4){logger[_0x59f7('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0xeb6d1e,_0x553357['error'][_0x59f7('0x11')]);return _0x21e3e5(_0x553357[_0x59f7('0xf')][_0x59f7('0x11')]);}logger[_0x59f7('0xf')](_0x59f7('0xc'),_0xeb6d1e,_0x553357[_0x59f7('0xf')]['message']);return _0x3bf8e1(_0x553357['error']['message']);}else{logger[_0x59f7('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0xeb6d1e,_0x59f7('0xd'));_0x3bf8e1(_0x553357[_0x59f7('0x12')][_0x59f7('0x11')]);}})[_0x59f7('0x13')](function(_0x34a5d7){logger[_0x59f7('0xf')](_0x59f7('0xc'),_0xeb6d1e,_0x34a5d7);_0x21e3e5(_0x34a5d7);});});}exports[_0x59f7('0x14')]=function(_0x2f1d2b){var _0xd619db=this;return new Promise(function(_0x1f14f4,_0x129f55){return db['VoiceDialReport'][_0x59f7('0x15')](_0x2f1d2b[_0x59f7('0x16')],{'raw':_0x2f1d2b[_0x59f7('0x17')]?_0x2f1d2b[_0x59f7('0x17')][_0x59f7('0x18')]===undefined?!![]:![]:!![]})[_0x59f7('0xa')](function(_0x4986ce){logger[_0x59f7('0xb')](_0x59f7('0x14'),_0x2f1d2b);logger['debug'](_0x59f7('0x14'),_0x2f1d2b,JSON[_0x59f7('0x19')](_0x4986ce));_0x1f14f4(_0x4986ce);})[_0x59f7('0x13')](function(_0x2ca762){logger[_0x59f7('0xf')](_0x59f7('0x14'),_0x2ca762[_0x59f7('0x11')],_0x2f1d2b);_0x129f55(_0xd619db[_0x59f7('0xf')](0x1f4,_0x2ca762[_0x59f7('0x11')]));});});};exports[_0x59f7('0x1a')]=function(_0x1cdb9f){var _0x454fa4=this;return new Promise(function(_0x1d7a77,_0x104194){return db[_0x59f7('0x1b')][_0x59f7('0x1c')](_0x1cdb9f[_0x59f7('0x16')],{'raw':_0x1cdb9f[_0x59f7('0x17')]?_0x1cdb9f[_0x59f7('0x17')][_0x59f7('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cdb9f[_0x59f7('0x17')]?_0x1cdb9f['options'][_0x59f7('0x1d')]||null:null,'attributes':_0x1cdb9f['options']?_0x1cdb9f[_0x59f7('0x17')]['attributes']||null:null,'limit':_0x1cdb9f[_0x59f7('0x17')]?_0x1cdb9f[_0x59f7('0x17')][_0x59f7('0x1e')]||null:null})['then'](function(_0x659655){logger[_0x59f7('0xb')](_0x59f7('0x1a'),_0x1cdb9f);logger[_0x59f7('0xe')](_0x59f7('0x1a'),_0x1cdb9f,JSON['stringify'](_0x659655));_0x1d7a77(_0x659655);})[_0x59f7('0x13')](function(_0x4165ff){logger[_0x59f7('0xf')](_0x59f7('0x1a'),_0x4165ff[_0x59f7('0x11')],_0x1cdb9f);_0x104194(_0x454fa4[_0x59f7('0xf')](0x1f4,_0x4165ff[_0x59f7('0x11')]));});});}; \ No newline at end of file +var _0xce9b=['error','code','VoiceDialReport,\x20%s,\x20%s','message','result','catch','CreateVoiceDialReport','VoiceDialReport','body','options','raw','then','stringify','UpdateVoiceDialReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1df564,_0x4f0480){var _0xfa0d5e=function(_0x292ea3){while(--_0x292ea3){_0x1df564['push'](_0x1df564['shift']());}};_0xfa0d5e(++_0x4f0480);}(_0xce9b,0xc6));var _0xbce9=function(_0x1b9ea1,_0xe73f86){_0x1b9ea1=_0x1b9ea1-0x0;var _0x4c37c3=_0xce9b[_0x1b9ea1];return _0x4c37c3;};'use strict';var _=require(_0xbce9('0x0'));var util=require(_0xbce9('0x1'));var moment=require(_0xbce9('0x2'));var BPromise=require(_0xbce9('0x3'));var rs=require(_0xbce9('0x4'));var fs=require('fs');var Redis=require(_0xbce9('0x5'));var db=require(_0xbce9('0x6'))['db'];var utils=require(_0xbce9('0x7'));var logger=require('../../config/logger')(_0xbce9('0x8'));var config=require(_0xbce9('0x9'));var jayson=require(_0xbce9('0xa'));var client=jayson[_0xbce9('0xb')][_0xbce9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c336a,_0x10a645,_0x562634){return new BPromise(function(_0x5d92c3,_0x46a249){return client[_0xbce9('0xd')](_0x2c336a,_0x562634)['then'](function(_0x1f9621){logger[_0xbce9('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x10a645,'request\x20sent');logger[_0xbce9('0xf')](_0xbce9('0x10'),_0x10a645,_0xbce9('0x11'),JSON['stringify'](_0x1f9621));if(_0x1f9621['error']){if(_0x1f9621[_0xbce9('0x12')][_0xbce9('0x13')]===0x1f4){logger[_0xbce9('0x12')](_0xbce9('0x14'),_0x10a645,_0x1f9621[_0xbce9('0x12')][_0xbce9('0x15')]);return _0x46a249(_0x1f9621[_0xbce9('0x12')][_0xbce9('0x15')]);}logger[_0xbce9('0x12')](_0xbce9('0x14'),_0x10a645,_0x1f9621['error'][_0xbce9('0x15')]);return _0x5d92c3(_0x1f9621[_0xbce9('0x12')][_0xbce9('0x15')]);}else{logger[_0xbce9('0xe')](_0xbce9('0x14'),_0x10a645,'request\x20sent');_0x5d92c3(_0x1f9621[_0xbce9('0x16')][_0xbce9('0x15')]);}})[_0xbce9('0x17')](function(_0x6017a6){logger[_0xbce9('0x12')](_0xbce9('0x14'),_0x10a645,_0x6017a6);_0x46a249(_0x6017a6);});});}exports[_0xbce9('0x18')]=function(_0x2b1104){var _0x371483=this;return new Promise(function(_0x23a2db,_0x114599){return db[_0xbce9('0x19')]['create'](_0x2b1104[_0xbce9('0x1a')],{'raw':_0x2b1104[_0xbce9('0x1b')]?_0x2b1104[_0xbce9('0x1b')][_0xbce9('0x1c')]===undefined?!![]:![]:!![]})[_0xbce9('0x1d')](function(_0x14576b){logger['info'](_0xbce9('0x18'),_0x2b1104);logger[_0xbce9('0xf')](_0xbce9('0x18'),_0x2b1104,JSON[_0xbce9('0x1e')](_0x14576b));_0x23a2db(_0x14576b);})[_0xbce9('0x17')](function(_0x1b00d4){logger[_0xbce9('0x12')](_0xbce9('0x18'),_0x1b00d4[_0xbce9('0x15')],_0x2b1104);_0x114599(_0x371483[_0xbce9('0x12')](0x1f4,_0x1b00d4[_0xbce9('0x15')]));});});};exports[_0xbce9('0x1f')]=function(_0x379567){var _0x473645=this;return new Promise(function(_0x39e3b8,_0xcd9ce3){return db[_0xbce9('0x19')][_0xbce9('0x20')](_0x379567['body'],{'raw':_0x379567['options']?_0x379567[_0xbce9('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x379567[_0xbce9('0x1b')]?_0x379567[_0xbce9('0x1b')][_0xbce9('0x21')]||null:null,'attributes':_0x379567[_0xbce9('0x1b')]?_0x379567[_0xbce9('0x1b')][_0xbce9('0x22')]||null:null,'limit':_0x379567[_0xbce9('0x1b')]?_0x379567[_0xbce9('0x1b')][_0xbce9('0x23')]||null:null})[_0xbce9('0x1d')](function(_0x5ee458){logger['info'](_0xbce9('0x1f'),_0x379567);logger['debug'](_0xbce9('0x1f'),_0x379567,JSON[_0xbce9('0x1e')](_0x5ee458));_0x39e3b8(_0x5ee458);})['catch'](function(_0x1b0cc0){logger['error'](_0xbce9('0x1f'),_0x1b0cc0['message'],_0x379567);_0xcd9ce3(_0x473645['error'](0x1f4,_0x1b0cc0[_0xbce9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 96c0f8c..6e38ce0 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 _0xc900=['post','create','/:id/applications','addApplications','put','update','delete','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','/:id','show'];(function(_0x240d8c,_0x979f5){var _0x4e0720=function(_0x3aef9d){while(--_0x3aef9d){_0x240d8c['push'](_0x240d8c['shift']());}};_0x4e0720(++_0x979f5);}(_0xc900,0xb3));var _0x0c90=function(_0x28c1e5,_0x19c973){_0x28c1e5=_0x28c1e5-0x0;var _0xb9e118=_0xc900[_0x28c1e5];return _0xb9e118;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0c90('0x0'));var timeout=require(_0x0c90('0x1'));var express=require(_0x0c90('0x2'));var router=express['Router']();var auth=require(_0x0c90('0x3'));var interaction=require(_0x0c90('0x4'));var config=require('../../config/environment');var controller=require(_0x0c90('0x5'));router[_0x0c90('0x6')]('/',auth[_0x0c90('0x7')](),controller[_0x0c90('0x8')]);router[_0x0c90('0x6')](_0x0c90('0x9'),auth['isAuthenticated'](),controller[_0x0c90('0xa')]);router[_0x0c90('0xb')]('/',auth[_0x0c90('0x7')](),controller[_0x0c90('0xc')]);router[_0x0c90('0xb')](_0x0c90('0xd'),auth[_0x0c90('0x7')](),controller[_0x0c90('0xe')]);router[_0x0c90('0xf')](_0x0c90('0x9'),auth[_0x0c90('0x7')](),controller[_0x0c90('0x10')]);router[_0x0c90('0x11')]('/:id',auth[_0x0c90('0x7')](),controller['destroy']);module[_0x0c90('0x12')]=router; \ No newline at end of file +var _0x9f0e=['./voiceExtension.controller','get','isAuthenticated','/:id','show','create','post','/:id/applications','addApplications','put','delete','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9f0e,0x116));var _0xe9f0=function(_0x69efb8,_0xcc8c17){_0x69efb8=_0x69efb8-0x0;var _0x2aa8f1=_0x9f0e[_0x69efb8];return _0x2aa8f1;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var path=require(_0xe9f0('0x2'));var timeout=require(_0xe9f0('0x3'));var express=require(_0xe9f0('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe9f0('0x5'));var config=require(_0xe9f0('0x6'));var controller=require(_0xe9f0('0x7'));router[_0xe9f0('0x8')]('/',auth[_0xe9f0('0x9')](),controller['index']);router['get'](_0xe9f0('0xa'),auth[_0xe9f0('0x9')](),controller[_0xe9f0('0xb')]);router['post']('/',auth[_0xe9f0('0x9')](),controller[_0xe9f0('0xc')]);router[_0xe9f0('0xd')](_0xe9f0('0xe'),auth[_0xe9f0('0x9')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x10')](_0xe9f0('0xa'),auth[_0xe9f0('0x9')](),controller['update']);router[_0xe9f0('0x11')](_0xe9f0('0xa'),auth[_0xe9f0('0x9')](),controller['destroy']);module[_0xe9f0('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 8f67a9c..212a3fe 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 _0xd47d=['inbound-fax','outbound-fax','system','any','INTEGER','BOOLEAN','sequelize','exports','compositeIndex','STRING','NoOp','ENUM','inbound','outbound','internal'];(function(_0x150607,_0x4b7feb){var _0x434af5=function(_0x639395){while(--_0x639395){_0x150607['push'](_0x150607['shift']());}};_0x434af5(++_0x4b7feb);}(_0xd47d,0xd8));var _0xdd47=function(_0x40015a,_0x415db5){_0x40015a=_0x40015a-0x0;var _0x42f8a4=_0xd47d[_0x40015a];return _0x42f8a4;};'use strict';var Sequelize=require(_0xdd47('0x0'));module[_0xdd47('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xdd47('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xdd47('0x3')],'allowNull':![],'unique':_0xdd47('0x2')},'priority':{'type':Sequelize[_0xdd47('0x3')],'allowNull':![],'defaultValue':'1','unique':_0xdd47('0x2')},'tag':{'type':Sequelize[_0xdd47('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xdd47('0x3')],'allowNull':![],'defaultValue':_0xdd47('0x4')},'appdata':{'type':Sequelize[_0xdd47('0x3')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xdd47('0x5')](_0xdd47('0x6'),_0xdd47('0x7'),_0xdd47('0x8'),_0xdd47('0x9'),_0xdd47('0xa'),_0xdd47('0xb'),_0xdd47('0xc')),'allowNull':![]},'description':{'type':Sequelize[_0xdd47('0x3')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xdd47('0xd')]},'isApp':{'type':Sequelize[_0xdd47('0xe')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0xdd47('0x3')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xdd47('0xd')]},'recordingFormat':{'type':Sequelize[_0xdd47('0x3')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0xdd47('0xe')],'defaultValue':!![]}}; \ No newline at end of file +var _0x28ef=['outbound-fax','system','any','INTEGER','BOOLEAN','wav','exports','STRING','compositeIndex','ENUM','inbound-fax'];(function(_0x22a52f,_0x23f297){var _0x1f5328=function(_0x1c0e0e){while(--_0x1c0e0e){_0x22a52f['push'](_0x22a52f['shift']());}};_0x1f5328(++_0x23f297);}(_0x28ef,0x1df));var _0xf28e=function(_0x4d5efa,_0x52af25){_0x4d5efa=_0x4d5efa-0x0;var _0xf2c89f=_0x28ef[_0x4d5efa];return _0xf2c89f;};'use strict';var Sequelize=require('sequelize');module[_0xf28e('0x0')]={'context':{'type':Sequelize[_0xf28e('0x1')],'allowNull':![],'unique':_0xf28e('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0xf28e('0x1')],'allowNull':![],'defaultValue':'1','unique':_0xf28e('0x2')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xf28e('0x3')]('inbound','outbound','internal',_0xf28e('0x4'),_0xf28e('0x5'),_0xf28e('0x6'),_0xf28e('0x7')),'allowNull':![]},'description':{'type':Sequelize[_0xf28e('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xf28e('0x8')]},'isApp':{'type':Sequelize[_0xf28e('0x9')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xf28e('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0xf28e('0x1')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xf28e('0x8')]},'recordingFormat':{'type':Sequelize[_0xf28e('0x1')],'defaultValue':_0xf28e('0xa')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 3dd6e3b..5c4883b 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 _0x4729=['recordingFormat','cutdigits','sequelize','transaction','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','json','count','offset','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','VoiceExtension','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','add','day','merge','filter','map','options','includeAll','include','findAll','catch','show','params','find','create','body','type','startsWith','concat','exten','update','context','description'];(function(_0x3fa646,_0x387c64){var _0x2d0e71=function(_0x5de533){while(--_0x5de533){_0x3fa646['push'](_0x3fa646['shift']());}};_0x2d0e71(++_0x387c64);}(_0x4729,0x68));var _0x9472=function(_0x269094,_0x55e47e){_0x269094=_0x269094-0x0;var _0x139afa=_0x4729[_0x269094];return _0x139afa;};'use strict';var pdf=require(_0x9472('0x0'));var emlformat=require(_0x9472('0x1'));var rimraf=require(_0x9472('0x2'));var zipdir=require(_0x9472('0x3'));var jsonpatch=require(_0x9472('0x4'));var rp=require(_0x9472('0x5'));var moment=require(_0x9472('0x6'));var BPromise=require(_0x9472('0x7'));var Mustache=require(_0x9472('0x8'));var util=require(_0x9472('0x9'));var path=require(_0x9472('0xa'));var sox=require(_0x9472('0xb'));var csv=require(_0x9472('0xc'));var ejs=require(_0x9472('0xd'));var fs=require('fs');var _=require(_0x9472('0xe'));var squel=require(_0x9472('0xf'));var crypto=require(_0x9472('0x10'));var jsforce=require(_0x9472('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x9472('0xc'));var querystring=require('querystring');var Papa=require(_0x9472('0x12'));var Redis=require(_0x9472('0x13'));var qs=require(_0x9472('0x14'));var logger=require(_0x9472('0x15'))(_0x9472('0x16'));var utils=require(_0x9472('0x17'));var config=require(_0x9472('0x18'));var db=require(_0x9472('0x19'))['db'];config[_0x9472('0x1a')]=_[_0x9472('0x1b')](config[_0x9472('0x1a')],{'host':_0x9472('0x1c'),'port':0x18eb});var socket=require(_0x9472('0x1d'))(new Redis(config['redis']));require(_0x9472('0x1e'))[_0x9472('0x1f')](socket);function respondWithStatusCode(_0x4af4ae,_0x50b80e){_0x50b80e=_0x50b80e||0xcc;return function(_0x3db429){if(_0x3db429){return _0x4af4ae[_0x9472('0x20')](_0x50b80e);}return _0x4af4ae['status'](_0x50b80e)[_0x9472('0x21')]();};}function respondWithResult(_0x4dfd49,_0x5c1ff3){_0x5c1ff3=_0x5c1ff3||0xc8;return function(_0x32b63c){if(_0x32b63c){return _0x4dfd49['status'](_0x5c1ff3)[_0x9472('0x22')](_0x32b63c);}};}function respondWithFilteredResult(_0x2de68e,_0x124729){return function(_0x52be02){if(_0x52be02){var _0xdda964=_0x52be02[_0x9472('0x23')],_0x154a15=_0x124729[_0x9472('0x24')],_0x5647d2=_0x124729[_0x9472('0x24')]+_0x124729['limit'],_0xc0b658;if(_0x5647d2>=_0xdda964){_0x5647d2=_0xdda964;_0xc0b658=0xc8;}else{_0xc0b658=0xce;}_0x2de68e[_0x9472('0x25')](_0xc0b658);return _0x2de68e[_0x9472('0x26')](_0x9472('0x27'),_0x154a15+'-'+_0x5647d2+'/'+_0xdda964)[_0x9472('0x22')](_0x52be02);}return null;};}function patchUpdates(_0xeea56d){return function(_0x574078){try{jsonpatch[_0x9472('0x28')](_0x574078,_0xeea56d,!![]);}catch(_0x531815){return BPromise[_0x9472('0x29')](_0x531815);}return _0x574078[_0x9472('0x2a')]();};}function saveUpdates(_0xa080f1,_0x1ece6d){return function(_0x3c3345){if(_0x3c3345){return _0x3c3345['update'](_0xa080f1)[_0x9472('0x2b')](function(_0x1d44b8){return _0x1d44b8;});}return null;};}function removeEntity(_0x2508f2,_0x1a6fd9){return function(_0x4c0cd6){if(_0x4c0cd6){return _0x4c0cd6[_0x9472('0x2c')]()[_0x9472('0x2b')](function(){_0x2508f2['status'](0xcc)[_0x9472('0x21')]();});}};}function handleEntityNotFound(_0x5b1ba5,_0x2b99c8){return function(_0x517a8a){if(!_0x517a8a){_0x5b1ba5[_0x9472('0x20')](0x194);}return _0x517a8a;};}function handleError(_0x268308,_0x567e99){_0x567e99=_0x567e99||0x1f4;return function(_0xc8be84){logger[_0x9472('0x2d')](_0xc8be84[_0x9472('0x2e')]);if(_0xc8be84[_0x9472('0x2f')]){delete _0xc8be84[_0x9472('0x2f')];}_0x268308[_0x9472('0x25')](_0x567e99)[_0x9472('0x30')](_0xc8be84);};}exports[_0x9472('0x31')]=function(_0x2b8d7a,_0x41a1ba){var _0x563caa={},_0x56a465={},_0x39f097={'count':0x0,'rows':[]};var _0x5c7d48=db[_0x9472('0x32')][_0x9472('0x33')];_0x56a465[_0x9472('0x34')]=_[_0x9472('0x35')](_0x5c7d48);var _0x12aa90={'dateStart':_0x2b8d7a[_0x9472('0x36')][_0x9472('0x37')],'dateEnd':_0x2b8d7a['query']['dateEnd']};delete _0x2b8d7a['query'][_0x9472('0x37')];delete _0x2b8d7a[_0x9472('0x36')][_0x9472('0x38')];_0x56a465['query']=_['keys'](_0x2b8d7a[_0x9472('0x36')]);_0x56a465[_0x9472('0x39')]=_[_0x9472('0x3a')](_0x56a465[_0x9472('0x34')],_0x56a465[_0x9472('0x36')]);_0x563caa[_0x9472('0x3b')]=_[_0x9472('0x3a')](_0x56a465[_0x9472('0x34')],qs[_0x9472('0x3c')](_0x2b8d7a[_0x9472('0x36')][_0x9472('0x3c')]));_0x563caa[_0x9472('0x3b')]=_0x563caa[_0x9472('0x3b')][_0x9472('0x3d')]?_0x563caa[_0x9472('0x3b')]:_0x56a465[_0x9472('0x34')];if(!_0x2b8d7a[_0x9472('0x36')][_0x9472('0x3e')]('nolimit')){_0x563caa[_0x9472('0x3f')]=qs[_0x9472('0x3f')](_0x2b8d7a['query']['limit']);_0x563caa[_0x9472('0x24')]=qs[_0x9472('0x24')](_0x2b8d7a['query'][_0x9472('0x24')]);}_0x563caa[_0x9472('0x40')]=qs[_0x9472('0x41')](_0x2b8d7a[_0x9472('0x36')][_0x9472('0x41')]);_0x563caa[_0x9472('0x42')]=qs['filters'](_[_0x9472('0x43')](_0x2b8d7a[_0x9472('0x36')],_0x56a465[_0x9472('0x39')]));if(_0x12aa90[_0x9472('0x37')]){if(_0x12aa90[_0x9472('0x38')]){_0x12aa90[_0x9472('0x38')]=moment(_0x12aa90[_0x9472('0x38')])[_0x9472('0x44')](0x1,_0x9472('0x45'));}else{_0x12aa90[_0x9472('0x38')]=moment(_0x12aa90['dateStart'])[_0x9472('0x44')](0x1,_0x9472('0x45'));}_[_0x9472('0x46')](_0x563caa[_0x9472('0x42')],{'createdAt':{'$gte':_0x12aa90[_0x9472('0x37')],'$lte':_0x12aa90[_0x9472('0x38')]}});}if(_0x2b8d7a[_0x9472('0x36')][_0x9472('0x47')]){_0x563caa[_0x9472('0x42')]=_[_0x9472('0x46')](_0x563caa[_0x9472('0x42')],{'$or':_[_0x9472('0x48')](_0x563caa[_0x9472('0x3b')],function(_0x316739){var _0x4c43e9={};_0x4c43e9[_0x316739]={'$like':'%'+_0x2b8d7a[_0x9472('0x36')][_0x9472('0x47')]+'%'};return _0x4c43e9;})});}_0x563caa=_['merge']({},_0x563caa,_0x2b8d7a[_0x9472('0x49')]);var _0x57b366={'where':_0x563caa[_0x9472('0x42')]};return db['VoiceExtension']['count'](_0x57b366)['then'](function(_0x475e49){_0x39f097[_0x9472('0x23')]=_0x475e49;if(_0x2b8d7a[_0x9472('0x36')][_0x9472('0x4a')]){_0x563caa[_0x9472('0x4b')]=[{'all':!![]}];}return db[_0x9472('0x32')][_0x9472('0x4c')](_0x563caa);})['then'](function(_0x3710c4){_0x39f097['rows']=_0x3710c4;return _0x39f097;})[_0x9472('0x2b')](respondWithFilteredResult(_0x41a1ba,_0x563caa))[_0x9472('0x4d')](handleError(_0x41a1ba,null));};exports[_0x9472('0x4e')]=function(_0x85e019,_0x3fc778){var _0x2aae44={'raw':![],'where':{'id':_0x85e019[_0x9472('0x4f')]['id']}},_0x528eb1={};_0x528eb1[_0x9472('0x34')]=_['keys'](db[_0x9472('0x32')][_0x9472('0x33')]);_0x528eb1[_0x9472('0x36')]=_[_0x9472('0x35')](_0x85e019[_0x9472('0x36')]);_0x528eb1[_0x9472('0x39')]=_[_0x9472('0x3a')](_0x528eb1['model'],_0x528eb1['query']);_0x2aae44[_0x9472('0x3b')]=_[_0x9472('0x3a')](_0x528eb1[_0x9472('0x34')],qs['fields'](_0x85e019[_0x9472('0x36')][_0x9472('0x3c')]));_0x2aae44[_0x9472('0x3b')]=_0x2aae44['attributes'][_0x9472('0x3d')]?_0x2aae44[_0x9472('0x3b')]:_0x528eb1[_0x9472('0x34')];if(_0x85e019[_0x9472('0x36')][_0x9472('0x4a')]){_0x2aae44[_0x9472('0x4b')]=[{'all':!![]}];}_0x2aae44=_[_0x9472('0x46')]({},_0x2aae44,_0x85e019[_0x9472('0x49')]);return db[_0x9472('0x32')][_0x9472('0x50')](_0x2aae44)['then'](handleEntityNotFound(_0x3fc778,null))['then'](respondWithResult(_0x3fc778,null))[_0x9472('0x4d')](handleError(_0x3fc778,null));};exports[_0x9472('0x2c')]=function(_0x2acdde,_0x2adedf){return db['VoiceExtension'][_0x9472('0x50')]({'where':{'id':_0x2acdde[_0x9472('0x4f')]['id']}})[_0x9472('0x2b')](handleEntityNotFound(_0x2adedf,null))[_0x9472('0x2b')](removeEntity(_0x2adedf,null))[_0x9472('0x4d')](handleError(_0x2adedf,null));};exports[_0x9472('0x51')]=function(_0x329ce9,_0x98d520){if(_0x329ce9[_0x9472('0x52')][_0x9472('0x53')]==='outbound'&&!_[_0x9472('0x54')](_0x329ce9[_0x9472('0x52')]['exten'],'_')){_0x329ce9[_0x9472('0x52')]['exten']='_'[_0x9472('0x55')](_0x329ce9[_0x9472('0x52')][_0x9472('0x56')]);}return db[_0x9472('0x32')][_0x9472('0x51')](_0x329ce9[_0x9472('0x52')],{'raw':![]})[_0x9472('0x2b')](respondWithResult(_0x98d520,0xc9))[_0x9472('0x4d')](handleError(_0x98d520,null));};exports[_0x9472('0x57')]=function(_0x4a16ea,_0x5a7d0c){if(_0x4a16ea[_0x9472('0x52')]['id']){delete _0x4a16ea['body']['id'];}return db[_0x9472('0x32')][_0x9472('0x50')]({'where':{'id':_0x4a16ea[_0x9472('0x4f')]['id']}})[_0x9472('0x2b')](handleEntityNotFound(_0x5a7d0c,null))['then'](function(_0x3efed3){if(_0x3efed3){return db[_0x9472('0x32')][_0x9472('0x57')](_[_0x9472('0x43')](_0x4a16ea[_0x9472('0x52')],[_0x9472('0x56'),_0x9472('0x58'),_0x9472('0x59'),_0x9472('0x5a'),_0x9472('0x5b')]),{'where':{'context':_0x3efed3['context'],'exten':_0x3efed3[_0x9472('0x56')]},'individualHooks':!![]})[_0x9472('0x2b')](function(_0x794c6b){return _0x794c6b;});}return null;})[_0x9472('0x2b')](respondWithStatusCode(_0x5a7d0c,null))[_0x9472('0x4d')](handleError(_0x5a7d0c,null));};exports['addApplications']=function(_0x26d93d,_0x553e19,_0x3e77a9){return db[_0x9472('0x32')]['findOne']({'where':{'id':_0x26d93d[_0x9472('0x4f')]['id']}})[_0x9472('0x2b')](handleEntityNotFound(_0x553e19,null))[_0x9472('0x2b')](function(_0x33a987){if(_0x33a987){return db[_0x9472('0x5c')][_0x9472('0x5d')](function(_0x3d9c8f){return db[_0x9472('0x32')][_0x9472('0x2c')]({'where':{'VoiceExtensionId':_0x26d93d[_0x9472('0x4f')]['id']},'transaction':_0x3d9c8f})[_0x9472('0x2b')](function(_0x41ca72){var _0x410b00=_[_0x9472('0x48')](_0x26d93d['body'],function(_0x65aa28){_0x65aa28['VoiceExtensionId']=_0x26d93d['params']['id'];return _0x65aa28;});return db[_0x9472('0x32')][_0x9472('0x5e')](_0x410b00,{'transaction':_0x3d9c8f});});})[_0x9472('0x2b')](function(){return db['VoiceExtension'][_0x9472('0x5f')]({'where':{'isApp':!![],'VoiceExtensionId':_0x26d93d[_0x9472('0x4f')]['id']},'order':_0x9472('0x60')});});}})[_0x9472('0x2b')](respondWithResult(_0x553e19,null))['catch'](handleError(_0x553e19,null));}; \ No newline at end of file +var _0x88aa=['destroy','stack','name','send','index','VoiceExtension','rawAttributes','model','keys','dateStart','query','dateEnd','filters','intersection','attributes','fields','order','sort','where','pick','add','day','filter','map','merge','options','includeAll','include','findAll','rows','show','length','find','catch','body','type','outbound','startsWith','exten','create','params','context','recordingFormat','cutdigits','addApplications','findOne','sequelize','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','update','then'];(function(_0x21fd72,_0x2a332a){var _0x5cdbf4=function(_0x3083d4){while(--_0x3083d4){_0x21fd72['push'](_0x21fd72['shift']());}};_0x5cdbf4(++_0x2a332a);}(_0x88aa,0x1e6));var _0xa88a=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x88aa[_0x21a9d9];return _0x46adce;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa88a('0x0'));var rimraf=require(_0xa88a('0x1'));var zipdir=require(_0xa88a('0x2'));var jsonpatch=require(_0xa88a('0x3'));var rp=require(_0xa88a('0x4'));var moment=require(_0xa88a('0x5'));var BPromise=require(_0xa88a('0x6'));var Mustache=require(_0xa88a('0x7'));var util=require(_0xa88a('0x8'));var path=require(_0xa88a('0x9'));var sox=require('sox');var csv=require(_0xa88a('0xa'));var ejs=require(_0xa88a('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa88a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa88a('0xd'));var toCsv=require(_0xa88a('0xa'));var querystring=require(_0xa88a('0xe'));var Papa=require(_0xa88a('0xf'));var Redis=require(_0xa88a('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0xa88a('0x11'))(_0xa88a('0x12'));var utils=require(_0xa88a('0x13'));var config=require(_0xa88a('0x14'));var db=require(_0xa88a('0x15'))['db'];config['redis']=_['defaults'](config[_0xa88a('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xa88a('0x17'))(new Redis(config[_0xa88a('0x16')]));require('./voiceExtension.socket')['register'](socket);function respondWithStatusCode(_0x50d136,_0x1ae0e9){_0x1ae0e9=_0x1ae0e9||0xcc;return function(_0x56a963){if(_0x56a963){return _0x50d136[_0xa88a('0x18')](_0x1ae0e9);}return _0x50d136[_0xa88a('0x19')](_0x1ae0e9)[_0xa88a('0x1a')]();};}function respondWithResult(_0x8e75af,_0x344289){_0x344289=_0x344289||0xc8;return function(_0x402914){if(_0x402914){return _0x8e75af[_0xa88a('0x19')](_0x344289)['json'](_0x402914);}};}function respondWithFilteredResult(_0x4ec154,_0x2e9729){return function(_0x2d2510){if(_0x2d2510){var _0x209744=_0x2d2510[_0xa88a('0x1b')],_0x1b669a=_0x2e9729[_0xa88a('0x1c')],_0xe58ef1=_0x2e9729[_0xa88a('0x1c')]+_0x2e9729[_0xa88a('0x1d')],_0x51643d;if(_0xe58ef1>=_0x209744){_0xe58ef1=_0x209744;_0x51643d=0xc8;}else{_0x51643d=0xce;}_0x4ec154[_0xa88a('0x19')](_0x51643d);return _0x4ec154[_0xa88a('0x1e')](_0xa88a('0x1f'),_0x1b669a+'-'+_0xe58ef1+'/'+_0x209744)['json'](_0x2d2510);}return null;};}function patchUpdates(_0x100f4e){return function(_0x45a6cd){try{jsonpatch[_0xa88a('0x20')](_0x45a6cd,_0x100f4e,!![]);}catch(_0x4bbdaa){return BPromise[_0xa88a('0x21')](_0x4bbdaa);}return _0x45a6cd['save']();};}function saveUpdates(_0x3612c8,_0x3566cb){return function(_0x4b8e5a){if(_0x4b8e5a){return _0x4b8e5a[_0xa88a('0x22')](_0x3612c8)[_0xa88a('0x23')](function(_0x4a585b){return _0x4a585b;});}return null;};}function removeEntity(_0x11a79b,_0x2362d6){return function(_0x3973c4){if(_0x3973c4){return _0x3973c4[_0xa88a('0x24')]()[_0xa88a('0x23')](function(){_0x11a79b[_0xa88a('0x19')](0xcc)[_0xa88a('0x1a')]();});}};}function handleEntityNotFound(_0x5376a9,_0xe3a620){return function(_0x23db0d){if(!_0x23db0d){_0x5376a9['sendStatus'](0x194);}return _0x23db0d;};}function handleError(_0x305fa6,_0x843c74){_0x843c74=_0x843c74||0x1f4;return function(_0x2a53b9){logger['error'](_0x2a53b9[_0xa88a('0x25')]);if(_0x2a53b9[_0xa88a('0x26')]){delete _0x2a53b9[_0xa88a('0x26')];}_0x305fa6[_0xa88a('0x19')](_0x843c74)[_0xa88a('0x27')](_0x2a53b9);};}exports[_0xa88a('0x28')]=function(_0x309f92,_0xfc0fde){var _0x60e34b={},_0xa8f7d4={},_0x56c803={'count':0x0,'rows':[]};var _0x3f4c4b=db[_0xa88a('0x29')][_0xa88a('0x2a')];_0xa8f7d4[_0xa88a('0x2b')]=_[_0xa88a('0x2c')](_0x3f4c4b);var _0x1a1d4d={'dateStart':_0x309f92['query'][_0xa88a('0x2d')],'dateEnd':_0x309f92[_0xa88a('0x2e')][_0xa88a('0x2f')]};delete _0x309f92['query'][_0xa88a('0x2d')];delete _0x309f92[_0xa88a('0x2e')][_0xa88a('0x2f')];_0xa8f7d4[_0xa88a('0x2e')]=_[_0xa88a('0x2c')](_0x309f92[_0xa88a('0x2e')]);_0xa8f7d4[_0xa88a('0x30')]=_[_0xa88a('0x31')](_0xa8f7d4[_0xa88a('0x2b')],_0xa8f7d4[_0xa88a('0x2e')]);_0x60e34b[_0xa88a('0x32')]=_['intersection'](_0xa8f7d4[_0xa88a('0x2b')],qs[_0xa88a('0x33')](_0x309f92['query'][_0xa88a('0x33')]));_0x60e34b[_0xa88a('0x32')]=_0x60e34b[_0xa88a('0x32')]['length']?_0x60e34b[_0xa88a('0x32')]:_0xa8f7d4[_0xa88a('0x2b')];if(!_0x309f92[_0xa88a('0x2e')]['hasOwnProperty']('nolimit')){_0x60e34b[_0xa88a('0x1d')]=qs[_0xa88a('0x1d')](_0x309f92['query'][_0xa88a('0x1d')]);_0x60e34b[_0xa88a('0x1c')]=qs[_0xa88a('0x1c')](_0x309f92[_0xa88a('0x2e')][_0xa88a('0x1c')]);}_0x60e34b[_0xa88a('0x34')]=qs[_0xa88a('0x35')](_0x309f92['query']['sort']);_0x60e34b[_0xa88a('0x36')]=qs[_0xa88a('0x30')](_[_0xa88a('0x37')](_0x309f92[_0xa88a('0x2e')],_0xa8f7d4[_0xa88a('0x30')]));if(_0x1a1d4d['dateStart']){if(_0x1a1d4d['dateEnd']){_0x1a1d4d[_0xa88a('0x2f')]=moment(_0x1a1d4d[_0xa88a('0x2f')])[_0xa88a('0x38')](0x1,_0xa88a('0x39'));}else{_0x1a1d4d[_0xa88a('0x2f')]=moment(_0x1a1d4d[_0xa88a('0x2d')])['add'](0x1,_0xa88a('0x39'));}_['merge'](_0x60e34b['where'],{'createdAt':{'$gte':_0x1a1d4d[_0xa88a('0x2d')],'$lte':_0x1a1d4d[_0xa88a('0x2f')]}});}if(_0x309f92[_0xa88a('0x2e')][_0xa88a('0x3a')]){_0x60e34b['where']=_['merge'](_0x60e34b['where'],{'$or':_[_0xa88a('0x3b')](_0x60e34b[_0xa88a('0x32')],function(_0x1cbfcf){var _0x461e66={};_0x461e66[_0x1cbfcf]={'$like':'%'+_0x309f92[_0xa88a('0x2e')][_0xa88a('0x3a')]+'%'};return _0x461e66;})});}_0x60e34b=_[_0xa88a('0x3c')]({},_0x60e34b,_0x309f92[_0xa88a('0x3d')]);var _0x45ff7c={'where':_0x60e34b['where']};return db[_0xa88a('0x29')]['count'](_0x45ff7c)['then'](function(_0x1d4c4c){_0x56c803[_0xa88a('0x1b')]=_0x1d4c4c;if(_0x309f92['query'][_0xa88a('0x3e')]){_0x60e34b[_0xa88a('0x3f')]=[{'all':!![]}];}return db[_0xa88a('0x29')][_0xa88a('0x40')](_0x60e34b);})[_0xa88a('0x23')](function(_0x5cdaf9){_0x56c803[_0xa88a('0x41')]=_0x5cdaf9;return _0x56c803;})['then'](respondWithFilteredResult(_0xfc0fde,_0x60e34b))['catch'](handleError(_0xfc0fde,null));};exports[_0xa88a('0x42')]=function(_0x353298,_0x125d29){var _0x3ae9f8={'raw':![],'where':{'id':_0x353298['params']['id']}},_0x2cd538={};_0x2cd538[_0xa88a('0x2b')]=_['keys'](db[_0xa88a('0x29')][_0xa88a('0x2a')]);_0x2cd538[_0xa88a('0x2e')]=_[_0xa88a('0x2c')](_0x353298[_0xa88a('0x2e')]);_0x2cd538['filters']=_['intersection'](_0x2cd538[_0xa88a('0x2b')],_0x2cd538[_0xa88a('0x2e')]);_0x3ae9f8[_0xa88a('0x32')]=_[_0xa88a('0x31')](_0x2cd538['model'],qs[_0xa88a('0x33')](_0x353298['query'][_0xa88a('0x33')]));_0x3ae9f8['attributes']=_0x3ae9f8[_0xa88a('0x32')][_0xa88a('0x43')]?_0x3ae9f8['attributes']:_0x2cd538[_0xa88a('0x2b')];if(_0x353298['query']['includeAll']){_0x3ae9f8['include']=[{'all':!![]}];}_0x3ae9f8=_['merge']({},_0x3ae9f8,_0x353298[_0xa88a('0x3d')]);return db[_0xa88a('0x29')][_0xa88a('0x44')](_0x3ae9f8)[_0xa88a('0x23')](handleEntityNotFound(_0x125d29,null))[_0xa88a('0x23')](respondWithResult(_0x125d29,null))['catch'](handleError(_0x125d29,null));};exports['destroy']=function(_0x2b4394,_0x5f2e44){return db[_0xa88a('0x29')][_0xa88a('0x44')]({'where':{'id':_0x2b4394['params']['id']}})[_0xa88a('0x23')](handleEntityNotFound(_0x5f2e44,null))['then'](removeEntity(_0x5f2e44,null))[_0xa88a('0x45')](handleError(_0x5f2e44,null));};exports['create']=function(_0x19107,_0x5cef91){if(_0x19107[_0xa88a('0x46')][_0xa88a('0x47')]===_0xa88a('0x48')&&!_[_0xa88a('0x49')](_0x19107[_0xa88a('0x46')][_0xa88a('0x4a')],'_')){_0x19107[_0xa88a('0x46')][_0xa88a('0x4a')]='_'['concat'](_0x19107[_0xa88a('0x46')][_0xa88a('0x4a')]);}return db[_0xa88a('0x29')][_0xa88a('0x4b')](_0x19107['body'],{'raw':![]})[_0xa88a('0x23')](respondWithResult(_0x5cef91,0xc9))[_0xa88a('0x45')](handleError(_0x5cef91,null));};exports[_0xa88a('0x22')]=function(_0x34ab44,_0x50aca1){if(_0x34ab44[_0xa88a('0x46')]['id']){delete _0x34ab44[_0xa88a('0x46')]['id'];}return db[_0xa88a('0x29')][_0xa88a('0x44')]({'where':{'id':_0x34ab44[_0xa88a('0x4c')]['id']}})[_0xa88a('0x23')](handleEntityNotFound(_0x50aca1,null))[_0xa88a('0x23')](function(_0x260840){if(_0x260840){return db[_0xa88a('0x29')][_0xa88a('0x22')](_[_0xa88a('0x37')](_0x34ab44[_0xa88a('0x46')],['exten',_0xa88a('0x4d'),'description',_0xa88a('0x4e'),_0xa88a('0x4f')]),{'where':{'context':_0x260840[_0xa88a('0x4d')],'exten':_0x260840[_0xa88a('0x4a')]},'individualHooks':!![]})[_0xa88a('0x23')](function(_0x15849c){return _0x15849c;});}return null;})[_0xa88a('0x23')](respondWithStatusCode(_0x50aca1,null))['catch'](handleError(_0x50aca1,null));};exports[_0xa88a('0x50')]=function(_0x2b8fd6,_0x30ea5c,_0x368a75){return db[_0xa88a('0x29')][_0xa88a('0x51')]({'where':{'id':_0x2b8fd6['params']['id']}})[_0xa88a('0x23')](handleEntityNotFound(_0x30ea5c,null))[_0xa88a('0x23')](function(_0x838bab){if(_0x838bab){return db[_0xa88a('0x52')][_0xa88a('0x53')](function(_0x25b449){return db[_0xa88a('0x29')]['destroy']({'where':{'VoiceExtensionId':_0x2b8fd6[_0xa88a('0x4c')]['id']},'transaction':_0x25b449})['then'](function(_0x185eb7){var _0x242208=_[_0xa88a('0x3b')](_0x2b8fd6['body'],function(_0x549c5d){_0x549c5d[_0xa88a('0x54')]=_0x2b8fd6['params']['id'];return _0x549c5d;});return db[_0xa88a('0x29')][_0xa88a('0x55')](_0x242208,{'transaction':_0x25b449});});})[_0xa88a('0x23')](function(){return db[_0xa88a('0x29')][_0xa88a('0x56')]({'where':{'isApp':!![],'VoiceExtensionId':_0x2b8fd6[_0xa88a('0x4c')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})['then'](respondWithResult(_0x30ea5c,null))[_0xa88a('0x45')](handleError(_0x30ea5c,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 54e2e51..cb152f0 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 _0x875f=['hasOwnProperty','hook','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove','emit'];(function(_0x18b344,_0x271f68){var _0x5ef6bb=function(_0x3345b3){while(--_0x3345b3){_0x18b344['push'](_0x18b344['shift']());}};_0x5ef6bb(++_0x271f68);}(_0x875f,0x192));var _0xf875=function(_0x36b046,_0x38ad70){_0x36b046=_0x36b046-0x0;var _0x505ad4=_0x875f[_0x36b046];return _0x505ad4;};'use strict';var EventEmitter=require(_0xf875('0x0'));var VoiceExtension=require(_0xf875('0x1'))['db'][_0xf875('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xf875('0x3')](0x0);var events={'afterCreate':_0xf875('0x4'),'afterUpdate':_0xf875('0x5'),'afterDestroy':_0xf875('0x6')};function emitEvent(_0x47a4f7){return function(_0x2b6492,_0x431a79,_0x481877){VoiceExtensionEvents[_0xf875('0x7')](_0x47a4f7+':'+_0x2b6492['id'],_0x2b6492);VoiceExtensionEvents[_0xf875('0x7')](_0x47a4f7,_0x2b6492);_0x481877(null);};}for(var e in events){if(events[_0xf875('0x8')](e)){var event=events[e];VoiceExtension[_0xf875('0x9')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0xc761=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','emit'];(function(_0x42e62f,_0x44fef7){var _0x546d65=function(_0x5de986){while(--_0x5de986){_0x42e62f['push'](_0x42e62f['shift']());}};_0x546d65(++_0x44fef7);}(_0xc761,0x160));var _0x1c76=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0xc761[_0x5cc8b9];return _0x58892e;};'use strict';var EventEmitter=require(_0x1c76('0x0'));var VoiceExtension=require(_0x1c76('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x1c76('0x2')](0x0);var events={'afterCreate':_0x1c76('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x59c141){return function(_0x5ab6ec,_0x38c7b7,_0x5239a5){VoiceExtensionEvents[_0x1c76('0x4')](_0x59c141+':'+_0x5ab6ec['id'],_0x5ab6ec);VoiceExtensionEvents[_0x1c76('0x4')](_0x59c141,_0x5ab6ec);_0x5239a5(null);};}for(var e in events){if(events[_0x1c76('0x5')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x1c76('0x6')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 8cb201b..e4c8c8b 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 _0xd3f7=['bluebird','request-promise','./voiceExtension.attributes','exports','define','VoiceExtension','voice_extensions','lodash','util','../../config/logger'];(function(_0x97fc4e,_0x493241){var _0x2ff264=function(_0x9af3f2){while(--_0x9af3f2){_0x97fc4e['push'](_0x97fc4e['shift']());}};_0x2ff264(++_0x493241);}(_0xd3f7,0x197));var _0x7d3f=function(_0x37e307,_0x378e6c){_0x37e307=_0x37e307-0x0;var _0x44a38c=_0xd3f7[_0x37e307];return _0x44a38c;};'use strict';var _=require(_0x7d3f('0x0'));var util=require(_0x7d3f('0x1'));var logger=require(_0x7d3f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7d3f('0x3'));var rp=require(_0x7d3f('0x4'));var attributes=require(_0x7d3f('0x5'));module[_0x7d3f('0x6')]=function(_0x4aacff,_0x57777f){return _0x4aacff[_0x7d3f('0x7')](_0x7d3f('0x8'),attributes,{'tableName':_0x7d3f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f48=['exports','define','lodash','api','moment','bluebird','request-promise','./voiceExtension.attributes'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x8f48,0xc2));var _0x88f4=function(_0x12254f,_0x100cfe){_0x12254f=_0x12254f-0x0;var _0x3a4fa2=_0x8f48[_0x12254f];return _0x3a4fa2;};'use strict';var _=require(_0x88f4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x88f4('0x1'));var moment=require(_0x88f4('0x2'));var BPromise=require(_0x88f4('0x3'));var rp=require(_0x88f4('0x4'));var attributes=require(_0x88f4('0x5'));module[_0x88f4('0x6')]=function(_0x49848f,_0x9e9be3){return _0x49848f[_0x88f4('0x7')]('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 f4f6fc3..817cd08 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 _0x0713=['raw','where','limit','include','map','attributes','model','debug','GetVoiceExtension','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','error','message','result','catch','VoiceExtension','options'];(function(_0x19e630,_0x26d755){var _0x503fde=function(_0x21ba06){while(--_0x21ba06){_0x19e630['push'](_0x19e630['shift']());}};_0x503fde(++_0x26d755);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});config[_0x3071('0xb')]=_[_0x3071('0xc')](config[_0x3071('0xb')],{'host':_0x3071('0xd'),'port':0x18eb});var socket=require(_0x3071('0xe'))(new Redis(config[_0x3071('0xb')]));require(_0x3071('0xf'))['register'](socket);function respondWithRpcPromise(_0x3457cd,_0x2610b4,_0x937259){return new BPromise(function(_0xff9a29,_0x1ce844){return client['request'](_0x3457cd,_0x937259)[_0x3071('0x10')](function(_0x11a7ee){logger[_0x3071('0x11')](_0x3071('0x12'),_0x2610b4,_0x3071('0x13'));logger['debug']('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x2610b4,_0x3071('0x13'),JSON['stringify'](_0x11a7ee));if(_0x11a7ee[_0x3071('0x14')]){if(_0x11a7ee[_0x3071('0x14')]['code']===0x1f4){logger[_0x3071('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x2610b4,_0x11a7ee[_0x3071('0x14')][_0x3071('0x15')]);return _0x1ce844(_0x11a7ee[_0x3071('0x14')][_0x3071('0x15')]);}logger[_0x3071('0x14')](_0x3071('0x12'),_0x2610b4,_0x11a7ee[_0x3071('0x14')][_0x3071('0x15')]);return _0xff9a29(_0x11a7ee[_0x3071('0x14')][_0x3071('0x15')]);}else{logger['info'](_0x3071('0x12'),_0x2610b4,_0x3071('0x13'));_0xff9a29(_0x11a7ee[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x17aee2){logger[_0x3071('0x14')](_0x3071('0x12'),_0x2610b4,_0x17aee2);_0x1ce844(_0x17aee2);});});}exports['GetVoiceExtension']=function(_0x359e66){var _0x2bfa33=this;return new Promise(function(_0xd3e23d,_0x56c267){return db[_0x3071('0x18')]['findAll']({'raw':_0x359e66[_0x3071('0x19')]?_0x359e66[_0x3071('0x19')][_0x3071('0x1a')]===undefined?!![]:![]:!![],'where':_0x359e66[_0x3071('0x19')]?_0x359e66[_0x3071('0x19')][_0x3071('0x1b')]||null:null,'attributes':_0x359e66[_0x3071('0x19')]?_0x359e66[_0x3071('0x19')]['attributes']||null:null,'limit':_0x359e66['options']?_0x359e66[_0x3071('0x19')][_0x3071('0x1c')]||null:null,'include':_0x359e66[_0x3071('0x19')]?_0x359e66[_0x3071('0x19')][_0x3071('0x1d')]?_[_0x3071('0x1e')](_0x359e66[_0x3071('0x19')][_0x3071('0x1d')],function(_0x1de5fb){return{'model':db[_0x1de5fb['model']],'as':_0x1de5fb['as'],'attributes':_0x1de5fb[_0x3071('0x1f')],'include':_0x1de5fb[_0x3071('0x1d')]?_[_0x3071('0x1e')](_0x1de5fb['include'],function(_0x4fb1ca){return{'model':db[_0x4fb1ca[_0x3071('0x20')]],'as':_0x4fb1ca['as'],'attributes':_0x4fb1ca[_0x3071('0x1f')],'include':_0x4fb1ca[_0x3071('0x1d')]?_[_0x3071('0x1e')](_0x4fb1ca[_0x3071('0x1d')],function(_0x177b5f){return{'model':db[_0x177b5f[_0x3071('0x20')]],'as':_0x177b5f['as'],'attributes':_0x177b5f[_0x3071('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3071('0x10')](function(_0x254fc8){logger['info']('GetVoiceExtension',_0x359e66);logger[_0x3071('0x21')](_0x3071('0x22'),_0x359e66,JSON[_0x3071('0x23')](_0x254fc8));_0xd3e23d(_0x254fc8);})[_0x3071('0x17')](function(_0x3f6d90){logger[_0x3071('0x14')](_0x3071('0x22'),_0x3f6d90[_0x3071('0x15')],_0x359e66);_0x56c267(_0x2bfa33['error'](0x1f4,_0x3f6d90['message']));});});}; \ No newline at end of file +var _0xe706=['model','then','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetVoiceExtension','VoiceExtension','findAll','options','raw','attributes','include','map'];(function(_0x361ff8,_0x4085ca){var _0x31a6cf=function(_0x5e7f17){while(--_0x5e7f17){_0x361ff8['push'](_0x361ff8['shift']());}};_0x31a6cf(++_0x4085ca);}(_0xe706,0xa3));var _0x6e70=function(_0x3c6c4d,_0x3b3c92){_0x3c6c4d=_0x3c6c4d-0x0;var _0x3bea7c=_0xe706[_0x3c6c4d];return _0x3bea7c;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});config[_0x6e70('0xd')]=_[_0x6e70('0xe')](config[_0x6e70('0xd')],{'host':_0x6e70('0xf'),'port':0x18eb});var socket=require(_0x6e70('0x10'))(new Redis(config[_0x6e70('0xd')]));require(_0x6e70('0x11'))[_0x6e70('0x12')](socket);function respondWithRpcPromise(_0x100eb7,_0x463853,_0x743eb5){return new BPromise(function(_0x3f474a,_0x37b3e0){return client[_0x6e70('0x13')](_0x100eb7,_0x743eb5)['then'](function(_0x47f6b2){logger[_0x6e70('0x14')](_0x6e70('0x15'),_0x463853,_0x6e70('0x16'));logger[_0x6e70('0x17')](_0x6e70('0x18'),_0x463853,_0x6e70('0x16'),JSON[_0x6e70('0x19')](_0x47f6b2));if(_0x47f6b2[_0x6e70('0x1a')]){if(_0x47f6b2['error']['code']===0x1f4){logger['error'](_0x6e70('0x15'),_0x463853,_0x47f6b2['error']['message']);return _0x37b3e0(_0x47f6b2[_0x6e70('0x1a')][_0x6e70('0x1b')]);}logger['error'](_0x6e70('0x15'),_0x463853,_0x47f6b2['error'][_0x6e70('0x1b')]);return _0x3f474a(_0x47f6b2[_0x6e70('0x1a')]['message']);}else{logger['info'](_0x6e70('0x15'),_0x463853,'request\x20sent');_0x3f474a(_0x47f6b2[_0x6e70('0x1c')][_0x6e70('0x1b')]);}})['catch'](function(_0x497d61){logger[_0x6e70('0x1a')](_0x6e70('0x15'),_0x463853,_0x497d61);_0x37b3e0(_0x497d61);});});}exports[_0x6e70('0x1d')]=function(_0x3a9978){var _0x3af484=this;return new Promise(function(_0xcdf9f2,_0x1b2453){return db[_0x6e70('0x1e')][_0x6e70('0x1f')]({'raw':_0x3a9978[_0x6e70('0x20')]?_0x3a9978['options'][_0x6e70('0x21')]===undefined?!![]:![]:!![],'where':_0x3a9978[_0x6e70('0x20')]?_0x3a9978[_0x6e70('0x20')]['where']||null:null,'attributes':_0x3a9978[_0x6e70('0x20')]?_0x3a9978[_0x6e70('0x20')][_0x6e70('0x22')]||null:null,'limit':_0x3a9978['options']?_0x3a9978[_0x6e70('0x20')]['limit']||null:null,'include':_0x3a9978['options']?_0x3a9978['options'][_0x6e70('0x23')]?_[_0x6e70('0x24')](_0x3a9978['options'][_0x6e70('0x23')],function(_0x1196ed){return{'model':db[_0x1196ed['model']],'as':_0x1196ed['as'],'attributes':_0x1196ed[_0x6e70('0x22')],'include':_0x1196ed[_0x6e70('0x23')]?_[_0x6e70('0x24')](_0x1196ed['include'],function(_0x54a5fe){return{'model':db[_0x54a5fe[_0x6e70('0x25')]],'as':_0x54a5fe['as'],'attributes':_0x54a5fe[_0x6e70('0x22')],'include':_0x54a5fe[_0x6e70('0x23')]?_[_0x6e70('0x24')](_0x54a5fe[_0x6e70('0x23')],function(_0x5d772a){return{'model':db[_0x5d772a[_0x6e70('0x25')]],'as':_0x5d772a['as'],'attributes':_0x5d772a[_0x6e70('0x22')]};}):[]};}):[]};}):[]:[]})[_0x6e70('0x26')](function(_0x2864a0){logger[_0x6e70('0x14')](_0x6e70('0x1d'),_0x3a9978);logger[_0x6e70('0x17')](_0x6e70('0x1d'),_0x3a9978,JSON[_0x6e70('0x19')](_0x2864a0));_0xcdf9f2(_0x2864a0);})[_0x6e70('0x27')](function(_0x4b1229){logger[_0x6e70('0x1a')]('GetVoiceExtension',_0x4b1229[_0x6e70('0x1b')],_0x3a9978);_0x1b2453(_0x3af484['error'](0x1f4,_0x4b1229[_0x6e70('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index c5e900a..f750cb1 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 _0xc9bb=['update','emit','removeListener','register','length','voiceExtension:','save','remove'];(function(_0x5ca94c,_0x552cdf){var _0x38f09f=function(_0x24fe9c){while(--_0x24fe9c){_0x5ca94c['push'](_0x5ca94c['shift']());}};_0x38f09f(++_0x552cdf);}(_0xc9bb,0x166));var _0xbc9b=function(_0x173092,_0xf3ab29){_0x173092=_0x173092-0x0;var _0xb506a4=_0xc9bb[_0x173092];return _0xb506a4;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0xbc9b('0x0'),_0xbc9b('0x1'),_0xbc9b('0x2')];function createListener(_0x596ad0,_0x287b72){return function(_0x1122b7){_0x287b72[_0xbc9b('0x3')](_0x596ad0,_0x1122b7);};}function removeListener(_0x42eeca,_0x3e48da){return function(){VoiceExtensionEvents[_0xbc9b('0x4')](_0x42eeca,_0x3e48da);};}exports[_0xbc9b('0x5')]=function(_0x35b1f4){for(var _0x523d86=0x0,_0x291afd=events[_0xbc9b('0x6')];_0x523d86<_0x291afd;_0x523d86++){var _0x382ed6=events[_0x523d86];var _0x1733a6=createListener(_0xbc9b('0x7')+_0x382ed6,_0x35b1f4);VoiceExtensionEvents['on'](_0x382ed6,_0x1733a6);}}; \ No newline at end of file +var _0xb4c7=['removeListener','register','remove','emit'];(function(_0x5798d6,_0x40ad65){var _0x3c42de=function(_0x312a75){while(--_0x312a75){_0x5798d6['push'](_0x5798d6['shift']());}};_0x3c42de(++_0x40ad65);}(_0xb4c7,0xa6));var _0x7b4c=function(_0x5df711,_0x50213a){_0x5df711=_0x5df711-0x0;var _0x4a6daa=_0xb4c7[_0x5df711];return _0x4a6daa;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=['save',_0x7b4c('0x0'),'update'];function createListener(_0x399e13,_0x1018eb){return function(_0x1ce666){_0x1018eb[_0x7b4c('0x1')](_0x399e13,_0x1ce666);};}function removeListener(_0x1540d1,_0x4f96f4){return function(){VoiceExtensionEvents[_0x7b4c('0x2')](_0x1540d1,_0x4f96f4);};}exports[_0x7b4c('0x3')]=function(_0x43276b){for(var _0x232d6e=0x0,_0x5c1ce2=events['length'];_0x232d6e<_0x5c1ce2;_0x232d6e++){var _0x4e7eb9=events[_0x232d6e];var _0x28c502=createListener('voiceExtension:'+_0x4e7eb9,_0x43276b);VoiceExtensionEvents['on'](_0x4e7eb9,_0x28c502);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 5345457..d5f09df 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 _0x9cdd=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','put','update','delete','destroy'];(function(_0x4f8722,_0x47e4ae){var _0x1430eb=function(_0x2c8812){while(--_0x2c8812){_0x4f8722['push'](_0x4f8722['shift']());}};_0x1430eb(++_0x47e4ae);}(_0x9cdd,0x11d));var _0xd9cd=function(_0x4cbf12,_0x10fb21){_0x4cbf12=_0x4cbf12-0x0;var _0x568b6d=_0x9cdd[_0x4cbf12];return _0x568b6d;};'use strict';var multer=require(_0xd9cd('0x0'));var util=require(_0xd9cd('0x1'));var path=require(_0xd9cd('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9cd('0x3'));var router=express[_0xd9cd('0x4')]();var auth=require(_0xd9cd('0x5'));var interaction=require(_0xd9cd('0x6'));var config=require('../../config/environment');var controller=require('./voiceMail.controller');router[_0xd9cd('0x7')]('/',auth[_0xd9cd('0x8')](),controller[_0xd9cd('0x9')]);router['get'](_0xd9cd('0xa'),auth[_0xd9cd('0x8')](),controller[_0xd9cd('0xb')]);router[_0xd9cd('0x7')](_0xd9cd('0xc'),auth[_0xd9cd('0x8')](),controller[_0xd9cd('0xd')]);router[_0xd9cd('0xe')]('/',auth[_0xd9cd('0x8')](),controller['create']);router[_0xd9cd('0xf')](_0xd9cd('0xa'),auth[_0xd9cd('0x8')](),controller[_0xd9cd('0x10')]);router[_0xd9cd('0x11')](_0xd9cd('0xa'),auth[_0xd9cd('0x8')](),controller[_0xd9cd('0x12')]);module['exports']=router; \ No newline at end of file +var _0x432d=['/:id/messages','post','create','/:id','update','delete','destroy','exports','util','path','express','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','index'];(function(_0x3f8743,_0x33973f){var _0x1f844c=function(_0x568841){while(--_0x568841){_0x3f8743['push'](_0x3f8743['shift']());}};_0x1f844c(++_0x33973f);}(_0x432d,0xc8));var _0xd432=function(_0x574162,_0x2425ea){_0x574162=_0x574162-0x0;var _0x39c245=_0x432d[_0x574162];return _0x39c245;};'use strict';var multer=require('multer');var util=require(_0xd432('0x0'));var path=require(_0xd432('0x1'));var timeout=require('connect-timeout');var express=require(_0xd432('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xd432('0x3'));var config=require('../../config/environment');var controller=require(_0xd432('0x4'));router[_0xd432('0x5')]('/',auth[_0xd432('0x6')](),controller[_0xd432('0x7')]);router[_0xd432('0x5')]('/:id',auth[_0xd432('0x6')](),controller['show']);router[_0xd432('0x5')](_0xd432('0x8'),auth[_0xd432('0x6')](),controller['getMessages']);router[_0xd432('0x9')]('/',auth[_0xd432('0x6')](),controller[_0xd432('0xa')]);router['put'](_0xd432('0xb'),auth['isAuthenticated'](),controller[_0xd432('0xc')]);router[_0xd432('0xd')](_0xd432('0xb'),auth[_0xd432('0x6')](),controller[_0xd432('0xe')]);module[_0xd432('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index b5e0e73..99f5d65 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 _0xd7de=['exports','STRING','from-voicemail','contest_mailbox','setDataValue','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER'];(function(_0x453222,_0xd17a0e){var _0x236ed6=function(_0x35bb82){while(--_0x35bb82){_0x453222['push'](_0x453222['shift']());}};_0x236ed6(++_0xd17a0e);}(_0xd7de,0x186));var _0xed7d=function(_0x413998,_0x3fc953){_0x413998=_0x413998-0x0;var _0x5b6c75=_0xd7de[_0x413998];return _0x5b6c75;};'use strict';var Sequelize=require('sequelize');module[_0xed7d('0x0')]={'customer_id':{'type':Sequelize[_0xed7d('0x1')]},'context':{'type':Sequelize[_0xed7d('0x1')],'defaultValue':_0xed7d('0x2'),'unique':_0xed7d('0x3')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xed7d('0x3')},'password':{'type':Sequelize[_0xed7d('0x1')]},'fullname':{'type':Sequelize[_0xed7d('0x1')]},'email':{'type':Sequelize[_0xed7d('0x1')],'validate':{'isEmail':!![]},'set':function(_0x1d8736){this[_0xed7d('0x4')]('email',typeof _0x1d8736===_0xed7d('0x5')&&_0x1d8736[_0xed7d('0x6')]()?_0x1d8736[_0xed7d('0x6')]():null);}},'pager':{'type':Sequelize[_0xed7d('0x1')]},'tz':{'type':Sequelize[_0xed7d('0x1')],'defaultValue':_0xed7d('0x7')},'attach':{'type':Sequelize[_0xed7d('0x8')](_0xed7d('0x9'),'no'),'defaultValue':_0xed7d('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0xed7d('0x8')](_0xed7d('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xed7d('0x1')]},'callback':{'type':Sequelize[_0xed7d('0x1')]},'review':{'type':Sequelize[_0xed7d('0x8')](_0xed7d('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xed7d('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xed7d('0x8')](_0xed7d('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xed7d('0x8')](_0xed7d('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xed7d('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xed7d('0x8')](_0xed7d('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0xed7d('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xed7d('0x8')]('yes','no'),'defaultValue':_0xed7d('0x9'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0xed7d('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xed7d('0x8')](_0xed7d('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xed7d('0x8')](_0xed7d('0x9'),'no'),'defaultValue':_0xed7d('0x9'),'allowNull':![]},'stamp':{'type':_0xed7d('0xb')},'emailsubject':{'type':Sequelize[_0xed7d('0x1')]},'emailbody':{'type':Sequelize[_0xed7d('0x1')]},'name':{'type':Sequelize[_0xed7d('0x1')]},'maxsecs':{'type':Sequelize[_0xed7d('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xed7d('0xc')](0xff),'defaultValue':0x64,'allowNull':![]}}; \ No newline at end of file +var _0xcce3=['central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','sequelize','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim'];(function(_0x2a5c62,_0x3fb3bc){var _0x3a30a0=function(_0x4b4f13){while(--_0x4b4f13){_0x2a5c62['push'](_0x2a5c62['shift']());}};_0x3a30a0(++_0x3fb3bc);}(_0xcce3,0xf4));var _0x3cce=function(_0x38b2d9,_0x19fd42){_0x38b2d9=_0x38b2d9-0x0;var _0x23a3e1=_0xcce3[_0x38b2d9];return _0x23a3e1;};'use strict';var Sequelize=require(_0x3cce('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x3cce('0x1')]},'context':{'type':Sequelize[_0x3cce('0x1')],'defaultValue':_0x3cce('0x2'),'unique':_0x3cce('0x3')},'mailbox':{'type':Sequelize[_0x3cce('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x3cce('0x1')]},'fullname':{'type':Sequelize[_0x3cce('0x1')]},'email':{'type':Sequelize[_0x3cce('0x1')],'validate':{'isEmail':!![]},'set':function(_0x3e6dc2){this[_0x3cce('0x4')](_0x3cce('0x5'),typeof _0x3e6dc2===_0x3cce('0x6')&&_0x3e6dc2[_0x3cce('0x7')]()?_0x3e6dc2[_0x3cce('0x7')]():null);}},'pager':{'type':Sequelize[_0x3cce('0x1')]},'tz':{'type':Sequelize[_0x3cce('0x1')],'defaultValue':_0x3cce('0x8')},'attach':{'type':Sequelize[_0x3cce('0x9')]('yes','no'),'defaultValue':_0x3cce('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x3cce('0x9')](_0x3cce('0xa'),'no'),'defaultValue':_0x3cce('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x3cce('0x1')]},'callback':{'type':Sequelize[_0x3cce('0x1')]},'review':{'type':Sequelize[_0x3cce('0x9')](_0x3cce('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x3cce('0x9')](_0x3cce('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x3cce('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x3cce('0x9')](_0x3cce('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x3cce('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x3cce('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x3cce('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x3cce('0xa'),'no'),'defaultValue':_0x3cce('0xa'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x3cce('0x9')](_0x3cce('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x3cce('0x9')](_0x3cce('0xa'),'no'),'defaultValue':_0x3cce('0xa'),'allowNull':![]},'stamp':{'type':_0x3cce('0xc')},'emailsubject':{'type':Sequelize[_0x3cce('0x1')]},'emailbody':{'type':Sequelize[_0x3cce('0x1')]},'name':{'type':Sequelize[_0x3cce('0x1')]},'maxsecs':{'type':Sequelize[_0x3cce('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x3cce('0xd')](0xff),'defaultValue':0x64,'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 756f5f4..113bebf 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 _0x1e8f=['end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','VoiceMail','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','add','filter','merge','map','options','findAll','rows','show','fields','includeAll','include','find','catch','body','params','getMessages','VoiceMailMessage','mailbox','findAndCountAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x76ece1,_0x4dc51f){var _0x1e0022=function(_0x3a759d){while(--_0x3a759d){_0x76ece1['push'](_0x76ece1['shift']());}};_0x1e0022(++_0x4dc51f);}(_0x1e8f,0xd6));var _0xf1e8=function(_0x40c043,_0x1d064e){_0x40c043=_0x40c043-0x0;var _0x5c2c8d=_0x1e8f[_0x40c043];return _0x5c2c8d;};'use strict';var pdf=require(_0xf1e8('0x0'));var emlformat=require(_0xf1e8('0x1'));var rimraf=require(_0xf1e8('0x2'));var zipdir=require(_0xf1e8('0x3'));var jsonpatch=require(_0xf1e8('0x4'));var rp=require('request-promise');var moment=require(_0xf1e8('0x5'));var BPromise=require(_0xf1e8('0x6'));var Mustache=require(_0xf1e8('0x7'));var util=require(_0xf1e8('0x8'));var path=require(_0xf1e8('0x9'));var sox=require(_0xf1e8('0xa'));var csv=require(_0xf1e8('0xb'));var ejs=require(_0xf1e8('0xc'));var fs=require('fs');var _=require(_0xf1e8('0xd'));var squel=require(_0xf1e8('0xe'));var crypto=require(_0xf1e8('0xf'));var jsforce=require(_0xf1e8('0x10'));var deskjs=require(_0xf1e8('0x11'));var toCsv=require(_0xf1e8('0xb'));var querystring=require(_0xf1e8('0x12'));var Papa=require(_0xf1e8('0x13'));var Redis=require(_0xf1e8('0x14'));var qs=require(_0xf1e8('0x15'));var logger=require(_0xf1e8('0x16'))(_0xf1e8('0x17'));var utils=require(_0xf1e8('0x18'));var config=require(_0xf1e8('0x19'));var db=require(_0xf1e8('0x1a'))['db'];function respondWithStatusCode(_0x533dcc,_0x262854){_0x262854=_0x262854||0xcc;return function(_0x240dd1){if(_0x240dd1){return _0x533dcc[_0xf1e8('0x1b')](_0x262854);}return _0x533dcc[_0xf1e8('0x1c')](_0x262854)[_0xf1e8('0x1d')]();};}function respondWithResult(_0x56f7f4,_0x2d2db4){_0x2d2db4=_0x2d2db4||0xc8;return function(_0x14eb86){if(_0x14eb86){return _0x56f7f4[_0xf1e8('0x1c')](_0x2d2db4)[_0xf1e8('0x1e')](_0x14eb86);}};}function respondWithFilteredResult(_0x299dc2,_0x5d14d5){return function(_0x5b3226){if(_0x5b3226){var _0x56545c=_0x5b3226[_0xf1e8('0x1f')],_0x3a8039=_0x5d14d5[_0xf1e8('0x20')],_0x2f6694=_0x5d14d5[_0xf1e8('0x20')]+_0x5d14d5[_0xf1e8('0x21')],_0x53ec97;if(_0x2f6694>=_0x56545c){_0x2f6694=_0x56545c;_0x53ec97=0xc8;}else{_0x53ec97=0xce;}_0x299dc2['status'](_0x53ec97);return _0x299dc2['set'](_0xf1e8('0x22'),_0x3a8039+'-'+_0x2f6694+'/'+_0x56545c)[_0xf1e8('0x1e')](_0x5b3226);}return null;};}function patchUpdates(_0x31e4e5){return function(_0x129076){try{jsonpatch[_0xf1e8('0x23')](_0x129076,_0x31e4e5,!![]);}catch(_0x5915b7){return BPromise['reject'](_0x5915b7);}return _0x129076[_0xf1e8('0x24')]();};}function saveUpdates(_0x20a5eb,_0x40a896){return function(_0x34897d){if(_0x34897d){return _0x34897d[_0xf1e8('0x25')](_0x20a5eb)[_0xf1e8('0x26')](function(_0x445932){return _0x445932;});}return null;};}function removeEntity(_0x14c8ec,_0x466701){return function(_0x2d3149){if(_0x2d3149){return _0x2d3149[_0xf1e8('0x27')]()[_0xf1e8('0x26')](function(){_0x14c8ec[_0xf1e8('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x368203,_0x112531){return function(_0x22403a){if(!_0x22403a){_0x368203[_0xf1e8('0x1b')](0x194);}return _0x22403a;};}function handleError(_0x5dcb32,_0xcd1c25){_0xcd1c25=_0xcd1c25||0x1f4;return function(_0x50c88d){logger[_0xf1e8('0x28')](_0x50c88d[_0xf1e8('0x29')]);if(_0x50c88d['name']){delete _0x50c88d[_0xf1e8('0x2a')];}_0x5dcb32[_0xf1e8('0x1c')](_0xcd1c25)[_0xf1e8('0x2b')](_0x50c88d);};}exports[_0xf1e8('0x2c')]=function(_0x5ec010,_0x10c9a4){var _0x1c691c={},_0x1b179d={},_0x6107e3={'count':0x0,'rows':[]};var _0x4ab2f2=db[_0xf1e8('0x2d')][_0xf1e8('0x2e')];_0x1b179d[_0xf1e8('0x2f')]=_[_0xf1e8('0x30')](_0x4ab2f2);var _0x386799={'dateStart':_0x5ec010[_0xf1e8('0x31')][_0xf1e8('0x32')],'dateEnd':_0x5ec010[_0xf1e8('0x31')][_0xf1e8('0x33')]};delete _0x5ec010[_0xf1e8('0x31')][_0xf1e8('0x32')];delete _0x5ec010[_0xf1e8('0x31')]['dateEnd'];_0x1b179d[_0xf1e8('0x31')]=_[_0xf1e8('0x30')](_0x5ec010[_0xf1e8('0x31')]);_0x1b179d[_0xf1e8('0x34')]=_['intersection'](_0x1b179d['model'],_0x1b179d[_0xf1e8('0x31')]);_0x1c691c[_0xf1e8('0x35')]=_[_0xf1e8('0x36')](_0x1b179d[_0xf1e8('0x2f')],qs['fields'](_0x5ec010['query']['fields']));_0x1c691c['attributes']=_0x1c691c['attributes'][_0xf1e8('0x37')]?_0x1c691c[_0xf1e8('0x35')]:_0x1b179d[_0xf1e8('0x2f')];if(!_0x5ec010[_0xf1e8('0x31')][_0xf1e8('0x38')](_0xf1e8('0x39'))){_0x1c691c[_0xf1e8('0x21')]=qs['limit'](_0x5ec010['query'][_0xf1e8('0x21')]);_0x1c691c[_0xf1e8('0x20')]=qs[_0xf1e8('0x20')](_0x5ec010[_0xf1e8('0x31')][_0xf1e8('0x20')]);}_0x1c691c[_0xf1e8('0x3a')]=qs['sort'](_0x5ec010[_0xf1e8('0x31')][_0xf1e8('0x3b')]);_0x1c691c[_0xf1e8('0x3c')]=qs[_0xf1e8('0x34')](_[_0xf1e8('0x3d')](_0x5ec010[_0xf1e8('0x31')],_0x1b179d['filters']));if(_0x386799['dateStart']){if(_0x386799['dateEnd']){_0x386799[_0xf1e8('0x33')]=moment(_0x386799[_0xf1e8('0x33')])[_0xf1e8('0x3e')](0x1,'day');}else{_0x386799[_0xf1e8('0x33')]=moment(_0x386799['dateStart'])['add'](0x1,'day');}_['merge'](_0x1c691c[_0xf1e8('0x3c')],{'createdAt':{'$gte':_0x386799[_0xf1e8('0x32')],'$lte':_0x386799[_0xf1e8('0x33')]}});}if(_0x5ec010[_0xf1e8('0x31')][_0xf1e8('0x3f')]){_0x1c691c['where']=_[_0xf1e8('0x40')](_0x1c691c[_0xf1e8('0x3c')],{'$or':_[_0xf1e8('0x41')](_0x1c691c[_0xf1e8('0x35')],function(_0x29bbf0){var _0x3108a5={};_0x3108a5[_0x29bbf0]={'$like':'%'+_0x5ec010['query'][_0xf1e8('0x3f')]+'%'};return _0x3108a5;})});}_0x1c691c=_[_0xf1e8('0x40')]({},_0x1c691c,_0x5ec010[_0xf1e8('0x42')]);var _0x546647={'where':_0x1c691c[_0xf1e8('0x3c')]};return db[_0xf1e8('0x2d')][_0xf1e8('0x1f')](_0x546647)[_0xf1e8('0x26')](function(_0x7888f1){_0x6107e3['count']=_0x7888f1;if(_0x5ec010[_0xf1e8('0x31')]['includeAll']){_0x1c691c['include']=[{'all':!![]}];}return db['VoiceMail'][_0xf1e8('0x43')](_0x1c691c);})['then'](function(_0xb02d75){_0x6107e3[_0xf1e8('0x44')]=_0xb02d75;return _0x6107e3;})[_0xf1e8('0x26')](respondWithFilteredResult(_0x10c9a4,_0x1c691c))['catch'](handleError(_0x10c9a4,null));};exports[_0xf1e8('0x45')]=function(_0x506f23,_0x24e997){var _0x1dd002={'raw':!![],'where':{'id':_0x506f23['params']['id']}},_0x23ad4f={};_0x23ad4f[_0xf1e8('0x2f')]=_[_0xf1e8('0x30')](db[_0xf1e8('0x2d')][_0xf1e8('0x2e')]);_0x23ad4f[_0xf1e8('0x31')]=_[_0xf1e8('0x30')](_0x506f23[_0xf1e8('0x31')]);_0x23ad4f[_0xf1e8('0x34')]=_['intersection'](_0x23ad4f[_0xf1e8('0x2f')],_0x23ad4f[_0xf1e8('0x31')]);_0x1dd002[_0xf1e8('0x35')]=_[_0xf1e8('0x36')](_0x23ad4f[_0xf1e8('0x2f')],qs[_0xf1e8('0x46')](_0x506f23[_0xf1e8('0x31')]['fields']));_0x1dd002['attributes']=_0x1dd002[_0xf1e8('0x35')][_0xf1e8('0x37')]?_0x1dd002[_0xf1e8('0x35')]:_0x23ad4f[_0xf1e8('0x2f')];if(_0x506f23['query'][_0xf1e8('0x47')]){_0x1dd002[_0xf1e8('0x48')]=[{'all':!![]}];}_0x1dd002=_[_0xf1e8('0x40')]({},_0x1dd002,_0x506f23[_0xf1e8('0x42')]);return db[_0xf1e8('0x2d')][_0xf1e8('0x49')](_0x1dd002)[_0xf1e8('0x26')](handleEntityNotFound(_0x24e997,null))[_0xf1e8('0x26')](respondWithResult(_0x24e997,null))[_0xf1e8('0x4a')](handleError(_0x24e997,null));};exports['create']=function(_0x2f2b33,_0x4d0f84){return db[_0xf1e8('0x2d')]['create'](_0x2f2b33[_0xf1e8('0x4b')],{})[_0xf1e8('0x26')](respondWithResult(_0x4d0f84,0xc9))['catch'](handleError(_0x4d0f84,null));};exports['update']=function(_0x3a1101,_0x231108){if(_0x3a1101['body']['id']){delete _0x3a1101[_0xf1e8('0x4b')]['id'];}return db[_0xf1e8('0x2d')]['find']({'where':{'id':_0x3a1101['params']['id']}})[_0xf1e8('0x26')](handleEntityNotFound(_0x231108,null))['then'](saveUpdates(_0x3a1101[_0xf1e8('0x4b')],null))[_0xf1e8('0x26')](respondWithResult(_0x231108,null))['catch'](handleError(_0x231108,null));};exports['destroy']=function(_0x2001db,_0x1e3b4d){return db[_0xf1e8('0x2d')][_0xf1e8('0x49')]({'where':{'id':_0x2001db[_0xf1e8('0x4c')]['id']}})[_0xf1e8('0x26')](handleEntityNotFound(_0x1e3b4d,null))[_0xf1e8('0x26')](removeEntity(_0x1e3b4d,null))[_0xf1e8('0x4a')](handleError(_0x1e3b4d,null));};exports[_0xf1e8('0x4d')]=function(_0x1ccb64,_0x476d2e,_0x4a1665){return db['VoiceMail']['findOne']({'where':{'id':_0x1ccb64[_0xf1e8('0x4c')]['id']}})[_0xf1e8('0x26')](handleEntityNotFound(_0x476d2e,null))[_0xf1e8('0x26')](function(_0x4fbf8f){var _0x1a2311;var _0x970e19={},_0x4ef71b={};_0x4ef71b['model']=_[_0xf1e8('0x30')](db[_0xf1e8('0x4e')]['rawAttributes']);_0x4ef71b[_0xf1e8('0x31')]=_[_0xf1e8('0x30')](_0x1ccb64[_0xf1e8('0x31')]);_0x4ef71b[_0xf1e8('0x34')]=_[_0xf1e8('0x36')](_0x4ef71b[_0xf1e8('0x2f')],_0x4ef71b['query']);_0x970e19[_0xf1e8('0x35')]=_[_0xf1e8('0x36')](_0x4ef71b['model'],qs[_0xf1e8('0x46')](_0x1ccb64[_0xf1e8('0x31')][_0xf1e8('0x46')]));_0x970e19['attributes']=_0x970e19[_0xf1e8('0x35')][_0xf1e8('0x37')]?_0x970e19[_0xf1e8('0x35')]:_0x4ef71b[_0xf1e8('0x2f')];if(!_0x1ccb64[_0xf1e8('0x31')][_0xf1e8('0x38')](_0xf1e8('0x39'))){_0x970e19[_0xf1e8('0x21')]=qs[_0xf1e8('0x21')](_0x1ccb64[_0xf1e8('0x31')][_0xf1e8('0x21')]);_0x970e19['offset']=qs[_0xf1e8('0x20')](_0x1ccb64[_0xf1e8('0x31')][_0xf1e8('0x20')]);}_0x970e19['order']=qs[_0xf1e8('0x3b')](_0x1ccb64['query'][_0xf1e8('0x3b')]);_0x970e19[_0xf1e8('0x3c')]=qs[_0xf1e8('0x34')](_[_0xf1e8('0x3d')](_0x1ccb64[_0xf1e8('0x31')],_0x4ef71b[_0xf1e8('0x34')]));if(_0x1ccb64[_0xf1e8('0x31')][_0xf1e8('0x3f')]){_0x970e19[_0xf1e8('0x3c')]=_[_0xf1e8('0x40')](_0x970e19[_0xf1e8('0x3c')],{'$or':_[_0xf1e8('0x41')](_0x970e19[_0xf1e8('0x35')],function(_0x2f2d48){var _0x1ae08f={};_0x1ae08f[_0x2f2d48]={'$like':'%'+_0x1ccb64[_0xf1e8('0x31')]['filter']+'%'};return _0x1ae08f;})});}_0x970e19[_0xf1e8('0x3c')]=_[_0xf1e8('0x40')](_0x970e19['where'],{'mailboxuser':_0x4fbf8f[_0xf1e8('0x4f')]});_0x970e19=_[_0xf1e8('0x40')]({},_0x970e19,_0x1ccb64['options']);return db[_0xf1e8('0x4e')][_0xf1e8('0x50')](_0x970e19)['then'](respondWithFilteredResult(_0x476d2e,_0x970e19));})[_0xf1e8('0x4a')](handleError(_0x476d2e,null));}; \ No newline at end of file +var _0x73e1=['path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','VoiceMail','rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','add','day','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','length','create','body','params','find','getMessages','findOne','mailbox','VoiceMailMessage','findAndCountAll','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x187602,_0x209f79){var _0x4cd6b4=function(_0x527236){while(--_0x527236){_0x187602['push'](_0x187602['shift']());}};_0x4cd6b4(++_0x209f79);}(_0x73e1,0x98));var _0x173e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x73e1[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x173e('0x0'));var emlformat=require(_0x173e('0x1'));var rimraf=require(_0x173e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x173e('0x3'));var rp=require(_0x173e('0x4'));var moment=require(_0x173e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x173e('0x6'));var util=require(_0x173e('0x7'));var path=require(_0x173e('0x8'));var sox=require(_0x173e('0x9'));var csv=require('to-csv');var ejs=require(_0x173e('0xa'));var fs=require('fs');var _=require(_0x173e('0xb'));var squel=require(_0x173e('0xc'));var crypto=require('crypto');var jsforce=require(_0x173e('0xd'));var deskjs=require(_0x173e('0xe'));var toCsv=require('to-csv');var querystring=require(_0x173e('0xf'));var Papa=require(_0x173e('0x10'));var Redis=require(_0x173e('0x11'));var qs=require('../../components/parsers/qs');var logger=require(_0x173e('0x12'))(_0x173e('0x13'));var utils=require('../../config/utils');var config=require(_0x173e('0x14'));var db=require(_0x173e('0x15'))['db'];function respondWithStatusCode(_0x3d3110,_0x30230a){_0x30230a=_0x30230a||0xcc;return function(_0x711660){if(_0x711660){return _0x3d3110[_0x173e('0x16')](_0x30230a);}return _0x3d3110['status'](_0x30230a)[_0x173e('0x17')]();};}function respondWithResult(_0x294c2e,_0x1b3d43){_0x1b3d43=_0x1b3d43||0xc8;return function(_0x3775d7){if(_0x3775d7){return _0x294c2e[_0x173e('0x18')](_0x1b3d43)[_0x173e('0x19')](_0x3775d7);}};}function respondWithFilteredResult(_0x4a0597,_0xb2c87){return function(_0x3b93d0){if(_0x3b93d0){var _0x225528=_0x3b93d0[_0x173e('0x1a')],_0x4a212c=_0xb2c87[_0x173e('0x1b')],_0x112074=_0xb2c87['offset']+_0xb2c87[_0x173e('0x1c')],_0x25d501;if(_0x112074>=_0x225528){_0x112074=_0x225528;_0x25d501=0xc8;}else{_0x25d501=0xce;}_0x4a0597['status'](_0x25d501);return _0x4a0597[_0x173e('0x1d')](_0x173e('0x1e'),_0x4a212c+'-'+_0x112074+'/'+_0x225528)[_0x173e('0x19')](_0x3b93d0);}return null;};}function patchUpdates(_0x3922a3){return function(_0x1a86a6){try{jsonpatch[_0x173e('0x1f')](_0x1a86a6,_0x3922a3,!![]);}catch(_0x6863dc){return BPromise[_0x173e('0x20')](_0x6863dc);}return _0x1a86a6[_0x173e('0x21')]();};}function saveUpdates(_0xae785d,_0x2d4d0d){return function(_0x5040ab){if(_0x5040ab){return _0x5040ab[_0x173e('0x22')](_0xae785d)[_0x173e('0x23')](function(_0x264dad){return _0x264dad;});}return null;};}function removeEntity(_0x4a889e,_0x59de3b){return function(_0xfffbdf){if(_0xfffbdf){return _0xfffbdf[_0x173e('0x24')]()[_0x173e('0x23')](function(){_0x4a889e[_0x173e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51f710,_0x2e3e20){return function(_0x387d00){if(!_0x387d00){_0x51f710[_0x173e('0x16')](0x194);}return _0x387d00;};}function handleError(_0x144715,_0x5cb07a){_0x5cb07a=_0x5cb07a||0x1f4;return function(_0xe15d41){logger['error'](_0xe15d41[_0x173e('0x25')]);if(_0xe15d41[_0x173e('0x26')]){delete _0xe15d41[_0x173e('0x26')];}_0x144715[_0x173e('0x18')](_0x5cb07a)[_0x173e('0x27')](_0xe15d41);};}exports[_0x173e('0x28')]=function(_0x56da06,_0x19c9d9){var _0x11aceb={},_0x30d792={},_0x48bd47={'count':0x0,'rows':[]};var _0x5dad19=db[_0x173e('0x29')][_0x173e('0x2a')];_0x30d792[_0x173e('0x2b')]=_['keys'](_0x5dad19);var _0x20662e={'dateStart':_0x56da06[_0x173e('0x2c')][_0x173e('0x2d')],'dateEnd':_0x56da06[_0x173e('0x2c')][_0x173e('0x2e')]};delete _0x56da06['query']['dateStart'];delete _0x56da06[_0x173e('0x2c')][_0x173e('0x2e')];_0x30d792[_0x173e('0x2c')]=_[_0x173e('0x2f')](_0x56da06[_0x173e('0x2c')]);_0x30d792[_0x173e('0x30')]=_[_0x173e('0x31')](_0x30d792['model'],_0x30d792[_0x173e('0x2c')]);_0x11aceb['attributes']=_[_0x173e('0x31')](_0x30d792['model'],qs[_0x173e('0x32')](_0x56da06[_0x173e('0x2c')][_0x173e('0x32')]));_0x11aceb[_0x173e('0x33')]=_0x11aceb['attributes']['length']?_0x11aceb['attributes']:_0x30d792[_0x173e('0x2b')];if(!_0x56da06['query'][_0x173e('0x34')](_0x173e('0x35'))){_0x11aceb['limit']=qs['limit'](_0x56da06[_0x173e('0x2c')][_0x173e('0x1c')]);_0x11aceb['offset']=qs['offset'](_0x56da06[_0x173e('0x2c')][_0x173e('0x1b')]);}_0x11aceb[_0x173e('0x36')]=qs[_0x173e('0x37')](_0x56da06[_0x173e('0x2c')][_0x173e('0x37')]);_0x11aceb[_0x173e('0x38')]=qs[_0x173e('0x30')](_[_0x173e('0x39')](_0x56da06[_0x173e('0x2c')],_0x30d792[_0x173e('0x30')]));if(_0x20662e['dateStart']){if(_0x20662e[_0x173e('0x2e')]){_0x20662e[_0x173e('0x2e')]=moment(_0x20662e[_0x173e('0x2e')])[_0x173e('0x3a')](0x1,_0x173e('0x3b'));}else{_0x20662e[_0x173e('0x2e')]=moment(_0x20662e['dateStart'])[_0x173e('0x3a')](0x1,_0x173e('0x3b'));}_['merge'](_0x11aceb['where'],{'createdAt':{'$gte':_0x20662e[_0x173e('0x2d')],'$lte':_0x20662e['dateEnd']}});}if(_0x56da06[_0x173e('0x2c')][_0x173e('0x3c')]){_0x11aceb[_0x173e('0x38')]=_[_0x173e('0x3d')](_0x11aceb[_0x173e('0x38')],{'$or':_[_0x173e('0x3e')](_0x11aceb['attributes'],function(_0x28c073){var _0x3f3c46={};_0x3f3c46[_0x28c073]={'$like':'%'+_0x56da06[_0x173e('0x2c')][_0x173e('0x3c')]+'%'};return _0x3f3c46;})});}_0x11aceb=_['merge']({},_0x11aceb,_0x56da06[_0x173e('0x3f')]);var _0x59dee6={'where':_0x11aceb['where']};return db[_0x173e('0x29')][_0x173e('0x1a')](_0x59dee6)[_0x173e('0x23')](function(_0x184436){_0x48bd47[_0x173e('0x1a')]=_0x184436;if(_0x56da06[_0x173e('0x2c')][_0x173e('0x40')]){_0x11aceb[_0x173e('0x41')]=[{'all':!![]}];}return db[_0x173e('0x29')][_0x173e('0x42')](_0x11aceb);})[_0x173e('0x23')](function(_0x4b7e1d){_0x48bd47[_0x173e('0x43')]=_0x4b7e1d;return _0x48bd47;})['then'](respondWithFilteredResult(_0x19c9d9,_0x11aceb))[_0x173e('0x44')](handleError(_0x19c9d9,null));};exports[_0x173e('0x45')]=function(_0x63b19e,_0x2bf0dc){var _0x557f83={'raw':!![],'where':{'id':_0x63b19e['params']['id']}},_0x4ac133={};_0x4ac133['model']=_[_0x173e('0x2f')](db[_0x173e('0x29')][_0x173e('0x2a')]);_0x4ac133[_0x173e('0x2c')]=_['keys'](_0x63b19e[_0x173e('0x2c')]);_0x4ac133['filters']=_['intersection'](_0x4ac133[_0x173e('0x2b')],_0x4ac133[_0x173e('0x2c')]);_0x557f83[_0x173e('0x33')]=_['intersection'](_0x4ac133[_0x173e('0x2b')],qs['fields'](_0x63b19e[_0x173e('0x2c')]['fields']));_0x557f83['attributes']=_0x557f83[_0x173e('0x33')][_0x173e('0x46')]?_0x557f83[_0x173e('0x33')]:_0x4ac133[_0x173e('0x2b')];if(_0x63b19e[_0x173e('0x2c')][_0x173e('0x40')]){_0x557f83[_0x173e('0x41')]=[{'all':!![]}];}_0x557f83=_[_0x173e('0x3d')]({},_0x557f83,_0x63b19e[_0x173e('0x3f')]);return db[_0x173e('0x29')]['find'](_0x557f83)[_0x173e('0x23')](handleEntityNotFound(_0x2bf0dc,null))[_0x173e('0x23')](respondWithResult(_0x2bf0dc,null))[_0x173e('0x44')](handleError(_0x2bf0dc,null));};exports[_0x173e('0x47')]=function(_0x8cdbdd,_0x419cfa){return db[_0x173e('0x29')][_0x173e('0x47')](_0x8cdbdd[_0x173e('0x48')],{})[_0x173e('0x23')](respondWithResult(_0x419cfa,0xc9))[_0x173e('0x44')](handleError(_0x419cfa,null));};exports[_0x173e('0x22')]=function(_0x596281,_0x4cb56d){if(_0x596281[_0x173e('0x48')]['id']){delete _0x596281[_0x173e('0x48')]['id'];}return db[_0x173e('0x29')]['find']({'where':{'id':_0x596281[_0x173e('0x49')]['id']}})[_0x173e('0x23')](handleEntityNotFound(_0x4cb56d,null))[_0x173e('0x23')](saveUpdates(_0x596281[_0x173e('0x48')],null))[_0x173e('0x23')](respondWithResult(_0x4cb56d,null))[_0x173e('0x44')](handleError(_0x4cb56d,null));};exports[_0x173e('0x24')]=function(_0x43a62d,_0xbe7df4){return db['VoiceMail'][_0x173e('0x4a')]({'where':{'id':_0x43a62d[_0x173e('0x49')]['id']}})['then'](handleEntityNotFound(_0xbe7df4,null))[_0x173e('0x23')](removeEntity(_0xbe7df4,null))[_0x173e('0x44')](handleError(_0xbe7df4,null));};exports[_0x173e('0x4b')]=function(_0x141dfc,_0x1cd514,_0x458702){return db[_0x173e('0x29')][_0x173e('0x4c')]({'where':{'id':_0x141dfc['params']['id']}})[_0x173e('0x23')](handleEntityNotFound(_0x1cd514,null))[_0x173e('0x23')](function(_0x3eddbd){var _0x30f8fc;var _0x4f59bd={},_0x39c74f={};_0x39c74f['model']=_[_0x173e('0x2f')](db['VoiceMailMessage'][_0x173e('0x2a')]);_0x39c74f[_0x173e('0x2c')]=_['keys'](_0x141dfc[_0x173e('0x2c')]);_0x39c74f[_0x173e('0x30')]=_[_0x173e('0x31')](_0x39c74f[_0x173e('0x2b')],_0x39c74f[_0x173e('0x2c')]);_0x4f59bd[_0x173e('0x33')]=_[_0x173e('0x31')](_0x39c74f['model'],qs[_0x173e('0x32')](_0x141dfc[_0x173e('0x2c')][_0x173e('0x32')]));_0x4f59bd[_0x173e('0x33')]=_0x4f59bd[_0x173e('0x33')][_0x173e('0x46')]?_0x4f59bd[_0x173e('0x33')]:_0x39c74f['model'];if(!_0x141dfc['query'][_0x173e('0x34')]('nolimit')){_0x4f59bd[_0x173e('0x1c')]=qs[_0x173e('0x1c')](_0x141dfc['query'][_0x173e('0x1c')]);_0x4f59bd[_0x173e('0x1b')]=qs[_0x173e('0x1b')](_0x141dfc[_0x173e('0x2c')][_0x173e('0x1b')]);}_0x4f59bd[_0x173e('0x36')]=qs[_0x173e('0x37')](_0x141dfc[_0x173e('0x2c')][_0x173e('0x37')]);_0x4f59bd['where']=qs[_0x173e('0x30')](_[_0x173e('0x39')](_0x141dfc[_0x173e('0x2c')],_0x39c74f[_0x173e('0x30')]));if(_0x141dfc[_0x173e('0x2c')]['filter']){_0x4f59bd[_0x173e('0x38')]=_[_0x173e('0x3d')](_0x4f59bd[_0x173e('0x38')],{'$or':_[_0x173e('0x3e')](_0x4f59bd[_0x173e('0x33')],function(_0x57fea8){var _0x5f21d0={};_0x5f21d0[_0x57fea8]={'$like':'%'+_0x141dfc[_0x173e('0x2c')][_0x173e('0x3c')]+'%'};return _0x5f21d0;})});}_0x4f59bd[_0x173e('0x38')]=_[_0x173e('0x3d')](_0x4f59bd[_0x173e('0x38')],{'mailboxuser':_0x3eddbd[_0x173e('0x4d')]});_0x4f59bd=_[_0x173e('0x3d')]({},_0x4f59bd,_0x141dfc[_0x173e('0x3f')]);return db[_0x173e('0x4e')][_0x173e('0x4f')](_0x4f59bd)[_0x173e('0x23')](respondWithFilteredResult(_0x1cd514,_0x4f59bd));})[_0x173e('0x44')](handleError(_0x1cd514,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 59c79ef..6b42ac8 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 _0xf738=['VoiceMail','mailbox','context','util','api','bluebird','request-promise','./voiceMail.attributes'];(function(_0x1b91c7,_0x539acd){var _0xbbe014=function(_0x57ff15){while(--_0x57ff15){_0x1b91c7['push'](_0x1b91c7['shift']());}};_0xbbe014(++_0x539acd);}(_0xf738,0xab));var _0x8f73=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf738[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x8f73('0x0'));var logger=require('../../config/logger')(_0x8f73('0x1'));var moment=require('moment');var BPromise=require(_0x8f73('0x2'));var rp=require(_0x8f73('0x3'));var attributes=require(_0x8f73('0x4'));module['exports']=function(_0x12c927,_0xd909f){return _0x12c927['define'](_0x8f73('0x5'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x8f73('0x6'),_0x8f73('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3048=['voice_voicemail','mailbox_context','mailbox','context','util','../../config/logger','api','moment','bluebird','./voiceMail.attributes','exports','define','VoiceMail'];(function(_0x2f0849,_0x3021ba){var _0x5eafd9=function(_0x3a86d9){while(--_0x3a86d9){_0x2f0849['push'](_0x2f0849['shift']());}};_0x5eafd9(++_0x3021ba);}(_0x3048,0xc7));var _0x8304=function(_0x4df85d,_0x582ad7){_0x4df85d=_0x4df85d-0x0;var _0x45e4aa=_0x3048[_0x4df85d];return _0x45e4aa;};'use strict';var _=require('lodash');var util=require(_0x8304('0x0'));var logger=require(_0x8304('0x1'))(_0x8304('0x2'));var moment=require(_0x8304('0x3'));var BPromise=require(_0x8304('0x4'));var rp=require('request-promise');var attributes=require(_0x8304('0x5'));module[_0x8304('0x6')]=function(_0x3de421,_0xa5aec9){return _0x3de421[_0x8304('0x7')](_0x8304('0x8'),attributes,{'tableName':_0x8304('0x9'),'paranoid':![],'indexes':[{'name':_0x8304('0xa'),'fields':[_0x8304('0xb'),_0x8304('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 57c839b..039d06e 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 _0x3001=['http','request','then','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client'];(function(_0x1280a1,_0x5967cd){var _0x240d6f=function(_0x480ee9){while(--_0x480ee9){_0x1280a1['push'](_0x1280a1['shift']());}};_0x240d6f(++_0x5967cd);}(_0x3001,0xb5));var _0x1300=function(_0x4b9657,_0x104103){_0x4b9657=_0x4b9657-0x0;var _0x3c4365=_0x3001[_0x4b9657];return _0x3c4365;};'use strict';var _=require(_0x1300('0x0'));var util=require(_0x1300('0x1'));var moment=require('moment');var BPromise=require(_0x1300('0x2'));var rs=require(_0x1300('0x3'));var fs=require('fs');var Redis=require(_0x1300('0x4'));var db=require(_0x1300('0x5'))['db'];var utils=require(_0x1300('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1300('0x7')][_0x1300('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x70ab5e,_0xfa602a,_0x4b0b3a){return new BPromise(function(_0x292375,_0x5ca3db){return client[_0x1300('0x9')](_0x70ab5e,_0x4b0b3a)[_0x1300('0xa')](function(_0x10cea3){logger['info'](_0x1300('0xb'),_0xfa602a,'request\x20sent');logger[_0x1300('0xc')](_0x1300('0xd'),_0xfa602a,_0x1300('0xe'),JSON[_0x1300('0xf')](_0x10cea3));if(_0x10cea3[_0x1300('0x10')]){if(_0x10cea3[_0x1300('0x10')]['code']===0x1f4){logger[_0x1300('0x10')](_0x1300('0xb'),_0xfa602a,_0x10cea3[_0x1300('0x10')][_0x1300('0x11')]);return _0x5ca3db(_0x10cea3[_0x1300('0x10')]['message']);}logger[_0x1300('0x10')]('VoiceMail,\x20%s,\x20%s',_0xfa602a,_0x10cea3[_0x1300('0x10')][_0x1300('0x11')]);return _0x292375(_0x10cea3[_0x1300('0x10')][_0x1300('0x11')]);}else{logger[_0x1300('0x12')](_0x1300('0xb'),_0xfa602a,'request\x20sent');_0x292375(_0x10cea3[_0x1300('0x13')][_0x1300('0x11')]);}})[_0x1300('0x14')](function(_0x3c439b){logger[_0x1300('0x10')](_0x1300('0xb'),_0xfa602a,_0x3c439b);_0x5ca3db(_0x3c439b);});});} \ No newline at end of file +var _0xcc74=['jayson/promise','http','then','info','request\x20sent','debug','stringify','error','message','VoiceMail,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x5f058f,_0x458952){var _0x2b831a=function(_0x35b337){while(--_0x35b337){_0x5f058f['push'](_0x5f058f['shift']());}};_0x2b831a(++_0x458952);}(_0xcc74,0xd0));var _0x4cc7=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xcc74[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x4cc7('0x0'));var util=require(_0x4cc7('0x1'));var moment=require(_0x4cc7('0x2'));var BPromise=require(_0x4cc7('0x3'));var rs=require(_0x4cc7('0x4'));var fs=require('fs');var Redis=require(_0x4cc7('0x5'));var db=require(_0x4cc7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4cc7('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4cc7('0x8'));var client=jayson['client'][_0x4cc7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x500542,_0x6d6593,_0x1f8b29){return new BPromise(function(_0x39541f,_0x35ca7a){return client['request'](_0x500542,_0x1f8b29)[_0x4cc7('0xa')](function(_0x5baef8){logger[_0x4cc7('0xb')]('VoiceMail,\x20%s,\x20%s',_0x6d6593,_0x4cc7('0xc'));logger[_0x4cc7('0xd')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x6d6593,'request\x20sent',JSON[_0x4cc7('0xe')](_0x5baef8));if(_0x5baef8[_0x4cc7('0xf')]){if(_0x5baef8[_0x4cc7('0xf')]['code']===0x1f4){logger['error']('VoiceMail,\x20%s,\x20%s',_0x6d6593,_0x5baef8['error'][_0x4cc7('0x10')]);return _0x35ca7a(_0x5baef8[_0x4cc7('0xf')][_0x4cc7('0x10')]);}logger[_0x4cc7('0xf')]('VoiceMail,\x20%s,\x20%s',_0x6d6593,_0x5baef8['error']['message']);return _0x39541f(_0x5baef8[_0x4cc7('0xf')][_0x4cc7('0x10')]);}else{logger[_0x4cc7('0xb')](_0x4cc7('0x11'),_0x6d6593,_0x4cc7('0xc'));_0x39541f(_0x5baef8['result'][_0x4cc7('0x10')]);}})['catch'](function(_0x28bb9d){logger[_0x4cc7('0xf')]('VoiceMail,\x20%s,\x20%s',_0x6d6593,_0x28bb9d);_0x35ca7a(_0x28bb9d);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 62772dc..ed661e9 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 _0x12eb=['show','download','post','create','/:id','update','destroy','util','path','Router','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','isAuthenticated','index','get'];(function(_0x4d7379,_0x4b4e63){var _0x46d7cf=function(_0x53f5f0){while(--_0x53f5f0){_0x4d7379['push'](_0x4d7379['shift']());}};_0x46d7cf(++_0x4b4e63);}(_0x12eb,0x177));var _0xb12e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x12eb[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require('multer');var util=require(_0xb12e('0x0'));var path=require(_0xb12e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb12e('0x2')]();var auth=require(_0xb12e('0x3'));var interaction=require(_0xb12e('0x4'));var config=require('../../config/environment');var controller=require(_0xb12e('0x5'));router['get']('/',auth[_0xb12e('0x6')](),controller[_0xb12e('0x7')]);router[_0xb12e('0x8')]('/:id',auth[_0xb12e('0x6')](),controller[_0xb12e('0x9')]);router[_0xb12e('0x8')]('/:id/download',auth[_0xb12e('0x6')](),controller[_0xb12e('0xa')]);router[_0xb12e('0xb')]('/',auth[_0xb12e('0x6')](),controller[_0xb12e('0xc')]);router['put'](_0xb12e('0xd'),auth[_0xb12e('0x6')](),controller[_0xb12e('0xe')]);router['delete'](_0xb12e('0xd'),auth['isAuthenticated'](),controller[_0xb12e('0xf')]);module['exports']=router; \ No newline at end of file +var _0x1681=['get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x1681,0x85));var _0x1168=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1681[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1168('0x0'));var util=require('util');var path=require(_0x1168('0x1'));var timeout=require(_0x1168('0x2'));var express=require('express');var router=express[_0x1168('0x3')]();var auth=require(_0x1168('0x4'));var interaction=require(_0x1168('0x5'));var config=require('../../config/environment');var controller=require(_0x1168('0x6'));router[_0x1168('0x7')]('/',auth[_0x1168('0x8')](),controller[_0x1168('0x9')]);router[_0x1168('0x7')](_0x1168('0xa'),auth[_0x1168('0x8')](),controller[_0x1168('0xb')]);router['get'](_0x1168('0xc'),auth[_0x1168('0x8')](),controller[_0x1168('0xd')]);router[_0x1168('0xe')]('/',auth[_0x1168('0x8')](),controller[_0x1168('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1168('0x10')]);router[_0x1168('0x11')](_0x1168('0xa'),auth['isAuthenticated'](),controller[_0x1168('0x12')]);module[_0x1168('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 66c7e0a..44fd3a8 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 _0x791b=['TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long'];(function(_0x1cf5ce,_0x578174){var _0x4ae95f=function(_0x516a3a){while(--_0x516a3a){_0x1cf5ce['push'](_0x1cf5ce['shift']());}};_0x4ae95f(++_0x578174);}(_0x791b,0xd9));var _0xb791=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x791b[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0xb791('0x0'));module[_0xb791('0x1')]={'name':{'type':Sequelize[_0xb791('0x2')],'get':function(_0x3b23eb){return this[_0xb791('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xb791('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xb791('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xb791('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xb791('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xb791('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xb791('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xb791('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xb791('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xb791('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xb791('0x6')](_0xb791('0x7')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xb791('0x5')],'defaultValue':''},'stamp':{'type':_0xb791('0x8'),'allowNull':![]}}; \ No newline at end of file +var _0x009a=['TIMESTAMP','sequelize','VIRTUAL','getDataValue','STRING','long'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x009a,0x12d));var _0xa009=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x009a[_0xdc37a1];return _0x99b4fe;};'use strict';var Sequelize=require(_0xa009('0x0'));module['exports']={'name':{'type':Sequelize[_0xa009('0x1')],'get':function(_0x3fd5ec){return this[_0xa009('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xa009('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xa009('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xa009('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0xa009('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0xa009('0x3')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xa009('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xa009('0x3')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xa009('0x4')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xa009('0x3')],'defaultValue':''},'stamp':{'type':_0xa009('0x5'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index c471ec8..6c7a1df 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 _0x5f2f=['fields','hasOwnProperty','nolimit','order','sort','pick','day','add','merge','where','filter','map','options','includeAll','include','rows','catch','show','params','keys','length','find','create','update','body','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','stack','name','send','index','VoiceMailMessage','rawAttributes','model','differenceBy','query','dateStart','dateEnd','filters','attributes','intersection'];(function(_0x5275b8,_0x51e5dd){var _0x568a9b=function(_0x583a71){while(--_0x583a71){_0x5275b8['push'](_0x5275b8['shift']());}};_0x568a9b(++_0x51e5dd);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2c9237,_0x6f0f9b){_0x2c9237=_0x2c9237-0x0;var _0x2426ec=_0x5f2f[_0x2c9237];return _0x2426ec;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0xa'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var qs=require(_0xf5f2('0x12'));var logger=require('../../config/logger')(_0xf5f2('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xf5f2('0x14'))['db'];function respondWithStatusCode(_0x151aba,_0x4b78cd){_0x4b78cd=_0x4b78cd||0xcc;return function(_0x336f6b){if(_0x336f6b){return _0x151aba[_0xf5f2('0x15')](_0x4b78cd);}return _0x151aba[_0xf5f2('0x16')](_0x4b78cd)[_0xf5f2('0x17')]();};}function respondWithResult(_0x59bb6c,_0x3e5956){_0x3e5956=_0x3e5956||0xc8;return function(_0x5c01b8){if(_0x5c01b8){return _0x59bb6c[_0xf5f2('0x16')](_0x3e5956)[_0xf5f2('0x18')](_0x5c01b8);}};}function respondWithFilteredResult(_0x269909,_0x1c1a5c){return function(_0x422b55){if(_0x422b55){var _0x4d97fc=_0x422b55[_0xf5f2('0x19')],_0xafe430=_0x1c1a5c[_0xf5f2('0x1a')],_0x286197=_0x1c1a5c[_0xf5f2('0x1a')]+_0x1c1a5c[_0xf5f2('0x1b')],_0x17d656;if(_0x286197>=_0x4d97fc){_0x286197=_0x4d97fc;_0x17d656=0xc8;}else{_0x17d656=0xce;}_0x269909[_0xf5f2('0x16')](_0x17d656);return _0x269909[_0xf5f2('0x1c')](_0xf5f2('0x1d'),_0xafe430+'-'+_0x286197+'/'+_0x4d97fc)[_0xf5f2('0x18')](_0x422b55);}return null;};}function patchUpdates(_0x28e097){return function(_0x4ff59b){try{jsonpatch[_0xf5f2('0x1e')](_0x4ff59b,_0x28e097,!![]);}catch(_0x3cf5ea){return BPromise[_0xf5f2('0x1f')](_0x3cf5ea);}return _0x4ff59b[_0xf5f2('0x20')]();};}function saveUpdates(_0x56acc5,_0x34706d){return function(_0x47101e){if(_0x47101e){return _0x47101e['update'](_0x56acc5)['then'](function(_0x2d2805){return _0x2d2805;});}return null;};}function removeEntity(_0x388e6c,_0x4ae323){return function(_0x45b74f){if(_0x45b74f){return _0x45b74f[_0xf5f2('0x21')]()[_0xf5f2('0x22')](function(){_0x388e6c[_0xf5f2('0x16')](0xcc)[_0xf5f2('0x17')]();});}};}function handleEntityNotFound(_0x4c691a,_0x21cd91){return function(_0x4669a6){if(!_0x4669a6){_0x4c691a[_0xf5f2('0x15')](0x194);}return _0x4669a6;};}function handleError(_0x2833fe,_0x287ad5){_0x287ad5=_0x287ad5||0x1f4;return function(_0x5bdf4a){logger['error'](_0x5bdf4a[_0xf5f2('0x23')]);if(_0x5bdf4a[_0xf5f2('0x24')]){delete _0x5bdf4a[_0xf5f2('0x24')];}_0x2833fe[_0xf5f2('0x16')](_0x287ad5)[_0xf5f2('0x25')](_0x5bdf4a);};}exports[_0xf5f2('0x26')]=function(_0x13a3be,_0x281ec8){var _0x294414={},_0x4ab014={},_0xaa2602={'count':0x0,'rows':[]};var _0x102449=db[_0xf5f2('0x27')][_0xf5f2('0x28')];_0x4ab014[_0xf5f2('0x29')]=_[_0xf5f2('0x2a')](_['keys'](_0x102449),['name']);var _0x22c826={'dateStart':_0x13a3be[_0xf5f2('0x2b')][_0xf5f2('0x2c')],'dateEnd':_0x13a3be['query']['dateEnd']};delete _0x13a3be[_0xf5f2('0x2b')][_0xf5f2('0x2c')];delete _0x13a3be[_0xf5f2('0x2b')][_0xf5f2('0x2d')];_0x4ab014[_0xf5f2('0x2b')]=_['keys'](_0x13a3be['query']);_0x4ab014[_0xf5f2('0x2e')]=_['intersection'](_0x4ab014[_0xf5f2('0x29')],_0x4ab014['query']);_0x294414[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x4ab014[_0xf5f2('0x29')],qs[_0xf5f2('0x31')](_0x13a3be[_0xf5f2('0x2b')][_0xf5f2('0x31')]));_0x294414[_0xf5f2('0x2f')]=_0x294414[_0xf5f2('0x2f')]['length']?_0x294414[_0xf5f2('0x2f')]:_0x4ab014[_0xf5f2('0x29')];if(!_0x13a3be[_0xf5f2('0x2b')][_0xf5f2('0x32')](_0xf5f2('0x33'))){_0x294414[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x13a3be['query'][_0xf5f2('0x1b')]);_0x294414[_0xf5f2('0x1a')]=qs['offset'](_0x13a3be[_0xf5f2('0x2b')]['offset']);}_0x294414[_0xf5f2('0x34')]=qs[_0xf5f2('0x35')](_0x13a3be[_0xf5f2('0x2b')][_0xf5f2('0x35')]);_0x294414['where']=qs['filters'](_[_0xf5f2('0x36')](_0x13a3be[_0xf5f2('0x2b')],_0x4ab014[_0xf5f2('0x2e')]));if(_0x22c826['dateStart']){if(_0x22c826[_0xf5f2('0x2d')]){_0x22c826['dateEnd']=moment(_0x22c826[_0xf5f2('0x2d')])['add'](0x1,_0xf5f2('0x37'));}else{_0x22c826[_0xf5f2('0x2d')]=moment(_0x22c826['dateStart'])[_0xf5f2('0x38')](0x1,_0xf5f2('0x37'));}_[_0xf5f2('0x39')](_0x294414[_0xf5f2('0x3a')],{'createdAt':{'$gte':_0x22c826['dateStart'],'$lte':_0x22c826['dateEnd']}});}if(_0x13a3be[_0xf5f2('0x2b')][_0xf5f2('0x3b')]){_0x294414[_0xf5f2('0x3a')]=_[_0xf5f2('0x39')](_0x294414[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x3c')](_0x294414[_0xf5f2('0x2f')],function(_0x4c0ac7){var _0x110fe5={};_0x110fe5[_0x4c0ac7]={'$like':'%'+_0x13a3be[_0xf5f2('0x2b')]['filter']+'%'};return _0x110fe5;})});}_0x294414=_[_0xf5f2('0x39')]({},_0x294414,_0x13a3be[_0xf5f2('0x3d')]);var _0x71b0e7={'where':_0x294414[_0xf5f2('0x3a')]};return db[_0xf5f2('0x27')][_0xf5f2('0x19')](_0x71b0e7)[_0xf5f2('0x22')](function(_0x2083b3){_0xaa2602['count']=_0x2083b3;if(_0x13a3be[_0xf5f2('0x2b')][_0xf5f2('0x3e')]){_0x294414[_0xf5f2('0x3f')]=[{'all':!![]}];}return db['VoiceMailMessage']['findAll'](_0x294414);})['then'](function(_0x76d21b){_0xaa2602[_0xf5f2('0x40')]=_0x76d21b;return _0xaa2602;})['then'](respondWithFilteredResult(_0x281ec8,_0x294414))[_0xf5f2('0x41')](handleError(_0x281ec8,null));};exports[_0xf5f2('0x42')]=function(_0x28e33f,_0x31f86c){var _0x354c34={'raw':!![],'where':{'id':_0x28e33f[_0xf5f2('0x43')]['id']}},_0x2b3b1c={};_0x2b3b1c[_0xf5f2('0x29')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x27')][_0xf5f2('0x28')]);_0x2b3b1c[_0xf5f2('0x2b')]=_[_0xf5f2('0x44')](_0x28e33f[_0xf5f2('0x2b')]);_0x2b3b1c['filters']=_[_0xf5f2('0x30')](_0x2b3b1c['model'],_0x2b3b1c[_0xf5f2('0x2b')]);_0x354c34[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x2b3b1c[_0xf5f2('0x29')],qs[_0xf5f2('0x31')](_0x28e33f[_0xf5f2('0x2b')]['fields']));_0x354c34[_0xf5f2('0x2f')]=_0x354c34[_0xf5f2('0x2f')][_0xf5f2('0x45')]?_0x354c34[_0xf5f2('0x2f')]:_0x2b3b1c[_0xf5f2('0x29')];if(_0x28e33f[_0xf5f2('0x2b')][_0xf5f2('0x3e')]){_0x354c34[_0xf5f2('0x3f')]=[{'all':!![]}];}_0x354c34=_['merge']({},_0x354c34,_0x28e33f[_0xf5f2('0x3d')]);return db[_0xf5f2('0x27')][_0xf5f2('0x46')](_0x354c34)['then'](handleEntityNotFound(_0x31f86c,null))[_0xf5f2('0x22')](respondWithResult(_0x31f86c,null))[_0xf5f2('0x41')](handleError(_0x31f86c,null));};exports[_0xf5f2('0x47')]=function(_0x5e761c,_0x57a7cb){return db[_0xf5f2('0x27')][_0xf5f2('0x47')](_0x5e761c['body'],{})[_0xf5f2('0x22')](respondWithResult(_0x57a7cb,0xc9))['catch'](handleError(_0x57a7cb,null));};exports[_0xf5f2('0x48')]=function(_0x497eb8,_0x2cbd9d){if(_0x497eb8['body']['id']){delete _0x497eb8[_0xf5f2('0x49')]['id'];}return db[_0xf5f2('0x27')][_0xf5f2('0x46')]({'where':{'id':_0x497eb8[_0xf5f2('0x43')]['id']}})['then'](handleEntityNotFound(_0x2cbd9d,null))[_0xf5f2('0x22')](saveUpdates(_0x497eb8[_0xf5f2('0x49')],null))['then'](respondWithResult(_0x2cbd9d,null))['catch'](handleError(_0x2cbd9d,null));};exports[_0xf5f2('0x21')]=function(_0x3dc0c4,_0x57782c){return db[_0xf5f2('0x27')][_0xf5f2('0x46')]({'where':{'id':_0x3dc0c4[_0xf5f2('0x43')]['id']}})[_0xf5f2('0x22')](handleEntityNotFound(_0x57782c,null))['then'](removeEntity(_0x57782c,null))['catch'](handleError(_0x57782c,null));};exports[_0xf5f2('0x4a')]=function(_0xa3cc67,_0x4b62fc,_0x40eef){return db[_0xf5f2('0x27')][_0xf5f2('0x46')]({'where':{'id':_0xa3cc67[_0xf5f2('0x43')]['id']},'attributes':['id',_0xf5f2('0x4b'),_0xf5f2('0x4c')]})[_0xf5f2('0x22')](handleEntityNotFound(_0x4b62fc,null))['then'](function(_0x59e8ef){if(_0x59e8ef){if(!_0x59e8ef[_0xf5f2('0x4b')]){throw new db[(_0xf5f2('0x4d'))][(_0xf5f2('0x4e'))](_0xf5f2('0x4f'));}var _0x21b0d3={'Content-Type':'audio/wav','Content-Disposition':_0xf5f2('0x50')};if(_0x59e8ef[_0xf5f2('0x4c')]){_0x21b0d3[_0xf5f2('0x51')]='attachment;\x20filename=\x22'+_0x59e8ef[_0xf5f2('0x4c')]+'.wav\x22';}_0x4b62fc[_0xf5f2('0x1c')](_0x21b0d3);return _0x4b62fc[_0xf5f2('0x25')](new Buffer(_0x59e8ef[_0xf5f2('0x4b')]));}})[_0xf5f2('0x41')](handleError(_0x4b62fc,null));}; \ No newline at end of file +var _0x955f=['fields','length','hasOwnProperty','sort','where','day','add','merge','map','options','includeAll','include','findAll','rows','catch','params','find','create','body','download','recording','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','then','error','stack','name','send','index','VoiceMailMessage','rawAttributes','model','differenceBy','keys','query','dateEnd','dateStart','filters','intersection','attributes'];(function(_0x36f841,_0x558dbe){var _0x273ed1=function(_0x33cd3c){while(--_0x33cd3c){_0x36f841['push'](_0x36f841['shift']());}};_0x273ed1(++_0x558dbe);}(_0x955f,0x1eb));var _0xf955=function(_0x332465,_0x55a424){_0x332465=_0x332465-0x0;var _0x27891a=_0x955f[_0x332465];return _0x27891a;};'use strict';var pdf=require(_0xf955('0x0'));var emlformat=require(_0xf955('0x1'));var rimraf=require(_0xf955('0x2'));var zipdir=require(_0xf955('0x3'));var jsonpatch=require(_0xf955('0x4'));var rp=require('request-promise');var moment=require(_0xf955('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf955('0x6'));var path=require('path');var sox=require(_0xf955('0x7'));var csv=require(_0xf955('0x8'));var ejs=require(_0xf955('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf955('0xa'));var crypto=require(_0xf955('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf955('0xc'));var toCsv=require(_0xf955('0x8'));var querystring=require(_0xf955('0xd'));var Papa=require(_0xf955('0xe'));var Redis=require(_0xf955('0xf'));var qs=require(_0xf955('0x10'));var logger=require(_0xf955('0x11'))('api');var utils=require(_0xf955('0x12'));var config=require('../../config/environment');var db=require(_0xf955('0x13'))['db'];function respondWithStatusCode(_0x5d6211,_0x394cfd){_0x394cfd=_0x394cfd||0xcc;return function(_0x5757b6){if(_0x5757b6){return _0x5d6211[_0xf955('0x14')](_0x394cfd);}return _0x5d6211['status'](_0x394cfd)[_0xf955('0x15')]();};}function respondWithResult(_0x50d9a9,_0x19c94a){_0x19c94a=_0x19c94a||0xc8;return function(_0x2ff7e5){if(_0x2ff7e5){return _0x50d9a9[_0xf955('0x16')](_0x19c94a)[_0xf955('0x17')](_0x2ff7e5);}};}function respondWithFilteredResult(_0x2080c4,_0x341b8c){return function(_0x1c3235){if(_0x1c3235){var _0x2783f2=_0x1c3235[_0xf955('0x18')],_0x3c6af7=_0x341b8c['offset'],_0x24e75c=_0x341b8c[_0xf955('0x19')]+_0x341b8c[_0xf955('0x1a')],_0x5350e4;if(_0x24e75c>=_0x2783f2){_0x24e75c=_0x2783f2;_0x5350e4=0xc8;}else{_0x5350e4=0xce;}_0x2080c4[_0xf955('0x16')](_0x5350e4);return _0x2080c4[_0xf955('0x1b')]('Content-Range',_0x3c6af7+'-'+_0x24e75c+'/'+_0x2783f2)['json'](_0x1c3235);}return null;};}function patchUpdates(_0x1e20d1){return function(_0xe6de5c){try{jsonpatch[_0xf955('0x1c')](_0xe6de5c,_0x1e20d1,!![]);}catch(_0x4d7b5b){return BPromise[_0xf955('0x1d')](_0x4d7b5b);}return _0xe6de5c[_0xf955('0x1e')]();};}function saveUpdates(_0x423824,_0x3f960e){return function(_0x3ae4fb){if(_0x3ae4fb){return _0x3ae4fb['update'](_0x423824)[_0xf955('0x1f')](function(_0x3dbbe8){return _0x3dbbe8;});}return null;};}function removeEntity(_0xfb8102,_0x488d04){return function(_0x43a5f2){if(_0x43a5f2){return _0x43a5f2['destroy']()[_0xf955('0x1f')](function(){_0xfb8102[_0xf955('0x16')](0xcc)[_0xf955('0x15')]();});}};}function handleEntityNotFound(_0xa4ebb4,_0x160071){return function(_0x565641){if(!_0x565641){_0xa4ebb4[_0xf955('0x14')](0x194);}return _0x565641;};}function handleError(_0x5fab1c,_0x3585c7){_0x3585c7=_0x3585c7||0x1f4;return function(_0x13a1a7){logger[_0xf955('0x20')](_0x13a1a7[_0xf955('0x21')]);if(_0x13a1a7[_0xf955('0x22')]){delete _0x13a1a7['name'];}_0x5fab1c[_0xf955('0x16')](_0x3585c7)[_0xf955('0x23')](_0x13a1a7);};}exports[_0xf955('0x24')]=function(_0x406632,_0x2dcd55){var _0x13a86d={},_0x3796f7={},_0x51f3ab={'count':0x0,'rows':[]};var _0x3caea6=db[_0xf955('0x25')][_0xf955('0x26')];_0x3796f7[_0xf955('0x27')]=_[_0xf955('0x28')](_[_0xf955('0x29')](_0x3caea6),['name']);var _0x2232a7={'dateStart':_0x406632[_0xf955('0x2a')]['dateStart'],'dateEnd':_0x406632[_0xf955('0x2a')][_0xf955('0x2b')]};delete _0x406632[_0xf955('0x2a')][_0xf955('0x2c')];delete _0x406632['query'][_0xf955('0x2b')];_0x3796f7['query']=_[_0xf955('0x29')](_0x406632[_0xf955('0x2a')]);_0x3796f7[_0xf955('0x2d')]=_[_0xf955('0x2e')](_0x3796f7[_0xf955('0x27')],_0x3796f7[_0xf955('0x2a')]);_0x13a86d[_0xf955('0x2f')]=_[_0xf955('0x2e')](_0x3796f7['model'],qs[_0xf955('0x30')](_0x406632[_0xf955('0x2a')][_0xf955('0x30')]));_0x13a86d[_0xf955('0x2f')]=_0x13a86d['attributes'][_0xf955('0x31')]?_0x13a86d[_0xf955('0x2f')]:_0x3796f7[_0xf955('0x27')];if(!_0x406632[_0xf955('0x2a')][_0xf955('0x32')]('nolimit')){_0x13a86d['limit']=qs['limit'](_0x406632[_0xf955('0x2a')][_0xf955('0x1a')]);_0x13a86d[_0xf955('0x19')]=qs[_0xf955('0x19')](_0x406632[_0xf955('0x2a')][_0xf955('0x19')]);}_0x13a86d['order']=qs[_0xf955('0x33')](_0x406632['query'][_0xf955('0x33')]);_0x13a86d[_0xf955('0x34')]=qs[_0xf955('0x2d')](_['pick'](_0x406632[_0xf955('0x2a')],_0x3796f7['filters']));if(_0x2232a7[_0xf955('0x2c')]){if(_0x2232a7[_0xf955('0x2b')]){_0x2232a7[_0xf955('0x2b')]=moment(_0x2232a7[_0xf955('0x2b')])['add'](0x1,_0xf955('0x35'));}else{_0x2232a7[_0xf955('0x2b')]=moment(_0x2232a7['dateStart'])[_0xf955('0x36')](0x1,_0xf955('0x35'));}_[_0xf955('0x37')](_0x13a86d['where'],{'createdAt':{'$gte':_0x2232a7[_0xf955('0x2c')],'$lte':_0x2232a7[_0xf955('0x2b')]}});}if(_0x406632[_0xf955('0x2a')]['filter']){_0x13a86d[_0xf955('0x34')]=_[_0xf955('0x37')](_0x13a86d[_0xf955('0x34')],{'$or':_[_0xf955('0x38')](_0x13a86d[_0xf955('0x2f')],function(_0x3c4b29){var _0x2b614d={};_0x2b614d[_0x3c4b29]={'$like':'%'+_0x406632[_0xf955('0x2a')]['filter']+'%'};return _0x2b614d;})});}_0x13a86d=_[_0xf955('0x37')]({},_0x13a86d,_0x406632[_0xf955('0x39')]);var _0x2aacdf={'where':_0x13a86d[_0xf955('0x34')]};return db[_0xf955('0x25')][_0xf955('0x18')](_0x2aacdf)[_0xf955('0x1f')](function(_0x206651){_0x51f3ab[_0xf955('0x18')]=_0x206651;if(_0x406632[_0xf955('0x2a')][_0xf955('0x3a')]){_0x13a86d[_0xf955('0x3b')]=[{'all':!![]}];}return db[_0xf955('0x25')][_0xf955('0x3c')](_0x13a86d);})[_0xf955('0x1f')](function(_0x248f60){_0x51f3ab[_0xf955('0x3d')]=_0x248f60;return _0x51f3ab;})[_0xf955('0x1f')](respondWithFilteredResult(_0x2dcd55,_0x13a86d))[_0xf955('0x3e')](handleError(_0x2dcd55,null));};exports['show']=function(_0x281605,_0x25d809){var _0x2db18d={'raw':!![],'where':{'id':_0x281605[_0xf955('0x3f')]['id']}},_0x5f0ef9={};_0x5f0ef9['model']=_[_0xf955('0x29')](db['VoiceMailMessage'][_0xf955('0x26')]);_0x5f0ef9[_0xf955('0x2a')]=_[_0xf955('0x29')](_0x281605[_0xf955('0x2a')]);_0x5f0ef9['filters']=_[_0xf955('0x2e')](_0x5f0ef9[_0xf955('0x27')],_0x5f0ef9[_0xf955('0x2a')]);_0x2db18d['attributes']=_['intersection'](_0x5f0ef9[_0xf955('0x27')],qs[_0xf955('0x30')](_0x281605[_0xf955('0x2a')][_0xf955('0x30')]));_0x2db18d['attributes']=_0x2db18d[_0xf955('0x2f')][_0xf955('0x31')]?_0x2db18d[_0xf955('0x2f')]:_0x5f0ef9['model'];if(_0x281605[_0xf955('0x2a')]['includeAll']){_0x2db18d[_0xf955('0x3b')]=[{'all':!![]}];}_0x2db18d=_[_0xf955('0x37')]({},_0x2db18d,_0x281605[_0xf955('0x39')]);return db['VoiceMailMessage'][_0xf955('0x40')](_0x2db18d)[_0xf955('0x1f')](handleEntityNotFound(_0x25d809,null))[_0xf955('0x1f')](respondWithResult(_0x25d809,null))[_0xf955('0x3e')](handleError(_0x25d809,null));};exports['create']=function(_0xa8edda,_0x4ff0f1){return db[_0xf955('0x25')][_0xf955('0x41')](_0xa8edda[_0xf955('0x42')],{})['then'](respondWithResult(_0x4ff0f1,0xc9))[_0xf955('0x3e')](handleError(_0x4ff0f1,null));};exports['update']=function(_0x35c23c,_0x5b5621){if(_0x35c23c[_0xf955('0x42')]['id']){delete _0x35c23c['body']['id'];}return db['VoiceMailMessage'][_0xf955('0x40')]({'where':{'id':_0x35c23c[_0xf955('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5b5621,null))[_0xf955('0x1f')](saveUpdates(_0x35c23c['body'],null))['then'](respondWithResult(_0x5b5621,null))['catch'](handleError(_0x5b5621,null));};exports['destroy']=function(_0x3c37e2,_0x1abe1c){return db['VoiceMailMessage']['find']({'where':{'id':_0x3c37e2[_0xf955('0x3f')]['id']}})[_0xf955('0x1f')](handleEntityNotFound(_0x1abe1c,null))[_0xf955('0x1f')](removeEntity(_0x1abe1c,null))[_0xf955('0x3e')](handleError(_0x1abe1c,null));};exports[_0xf955('0x43')]=function(_0xa56483,_0x190500,_0x3a69ca){return db[_0xf955('0x25')][_0xf955('0x40')]({'where':{'id':_0xa56483[_0xf955('0x3f')]['id']},'attributes':['id',_0xf955('0x44'),'msg_id']})[_0xf955('0x1f')](handleEntityNotFound(_0x190500,null))[_0xf955('0x1f')](function(_0x1d0e0c){if(_0x1d0e0c){if(!_0x1d0e0c[_0xf955('0x44')]){throw new db[(_0xf955('0x45'))]['ValidationError'](_0xf955('0x46'));}var _0x31992b={'Content-Type':_0xf955('0x47'),'Content-Disposition':_0xf955('0x48')};if(_0x1d0e0c[_0xf955('0x49')]){_0x31992b[_0xf955('0x4a')]=_0xf955('0x4b')+_0x1d0e0c[_0xf955('0x49')]+_0xf955('0x4c');}_0x190500[_0xf955('0x1b')](_0x31992b);return _0x190500['send'](new Buffer(_0x1d0e0c[_0xf955('0x44')]));}})[_0xf955('0x3e')](handleError(_0x190500,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 2337e7c..fcc5052 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 _0x542d=['./voiceMailMessage.attributes','voice_voicemail_messages','dir','util','../../config/logger','bluebird','request-promise'];(function(_0x392d68,_0x48897e){var _0x36aa86=function(_0x58e700){while(--_0x58e700){_0x392d68['push'](_0x392d68['shift']());}};_0x36aa86(++_0x48897e);}(_0x542d,0xc7));var _0xd542=function(_0x4dc52c,_0x272fd0){_0x4dc52c=_0x4dc52c-0x0;var _0x1a35d1=_0x542d[_0x4dc52c];return _0x1a35d1;};'use strict';var _=require('lodash');var util=require(_0xd542('0x0'));var logger=require(_0xd542('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd542('0x2'));var rp=require(_0xd542('0x3'));var attributes=require(_0xd542('0x4'));module['exports']=function(_0x5196c9,_0x4b92e5){return _0x5196c9['define']('VoiceMailMessage',attributes,{'tableName':_0xd542('0x5'),'paranoid':![],'indexes':[{'name':_0xd542('0x6'),'fields':[_0xd542('0x6')]}],'timestamps':![]});}; \ No newline at end of file +var _0xb8ad=['moment','request-promise','./voiceMailMessage.attributes','define','voice_voicemail_messages','dir','lodash','util','../../config/logger','api'];(function(_0x4a4347,_0x5d472c){var _0x1d6017=function(_0xef6eb9){while(--_0xef6eb9){_0x4a4347['push'](_0x4a4347['shift']());}};_0x1d6017(++_0x5d472c);}(_0xb8ad,0x196));var _0xdb8a=function(_0x2354ba,_0x14c8b0){_0x2354ba=_0x2354ba-0x0;var _0x28ec41=_0xb8ad[_0x2354ba];return _0x28ec41;};'use strict';var _=require(_0xdb8a('0x0'));var util=require(_0xdb8a('0x1'));var logger=require(_0xdb8a('0x2'))(_0xdb8a('0x3'));var moment=require(_0xdb8a('0x4'));var BPromise=require('bluebird');var rp=require(_0xdb8a('0x5'));var attributes=require(_0xdb8a('0x6'));module['exports']=function(_0x8b5c1d,_0x56b861){return _0x8b5c1d[_0xdb8a('0x7')]('VoiceMailMessage',attributes,{'tableName':_0xdb8a('0x8'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0xdb8a('0x9')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 5ec8350..25735b1 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 _0xeaaf=['bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment'];(function(_0x9b89ee,_0x3f74cf){var _0x569b36=function(_0x39274b){while(--_0x39274b){_0x9b89ee['push'](_0x9b89ee['shift']());}};_0x569b36(++_0x3f74cf);}(_0xeaaf,0x1ca));var _0xfeaa=function(_0x17f6eb,_0x1da779){_0x17f6eb=_0x17f6eb-0x0;var _0x37b732=_0xeaaf[_0x17f6eb];return _0x37b732;};'use strict';var _=require('lodash');var util=require(_0xfeaa('0x0'));var moment=require(_0xfeaa('0x1'));var BPromise=require(_0xfeaa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfeaa('0x3'));var db=require(_0xfeaa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfeaa('0x5'))('rpc');var config=require(_0xfeaa('0x6'));var jayson=require(_0xfeaa('0x7'));var client=jayson[_0xfeaa('0x8')][_0xfeaa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33da82,_0x141b77,_0x5baf0c){return new BPromise(function(_0x421063,_0x3715a6){return client[_0xfeaa('0xa')](_0x33da82,_0x5baf0c)['then'](function(_0xcead7){logger[_0xfeaa('0xb')](_0xfeaa('0xc'),_0x141b77,_0xfeaa('0xd'));logger[_0xfeaa('0xe')](_0xfeaa('0xf'),_0x141b77,_0xfeaa('0xd'),JSON['stringify'](_0xcead7));if(_0xcead7[_0xfeaa('0x10')]){if(_0xcead7[_0xfeaa('0x10')][_0xfeaa('0x11')]===0x1f4){logger[_0xfeaa('0x10')](_0xfeaa('0xc'),_0x141b77,_0xcead7[_0xfeaa('0x10')][_0xfeaa('0x12')]);return _0x3715a6(_0xcead7[_0xfeaa('0x10')][_0xfeaa('0x12')]);}logger[_0xfeaa('0x10')](_0xfeaa('0xc'),_0x141b77,_0xcead7[_0xfeaa('0x10')][_0xfeaa('0x12')]);return _0x421063(_0xcead7['error'][_0xfeaa('0x12')]);}else{logger['info'](_0xfeaa('0xc'),_0x141b77,_0xfeaa('0xd'));_0x421063(_0xcead7['result'][_0xfeaa('0x12')]);}})[_0xfeaa('0x13')](function(_0x45801f){logger[_0xfeaa('0x10')](_0xfeaa('0xc'),_0x141b77,_0x45801f);_0x3715a6(_0x45801f);});});} \ No newline at end of file +var _0xb48e=['VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x593ff6,_0x49bcd0){var _0x5eff78=function(_0x224e28){while(--_0x224e28){_0x593ff6['push'](_0x593ff6['shift']());}};_0x5eff78(++_0x49bcd0);}(_0xb48e,0x125));var _0xeb48=function(_0x3c7def,_0x4f6969){_0x3c7def=_0x3c7def-0x0;var _0x10a248=_0xb48e[_0x3c7def];return _0x10a248;};'use strict';var _=require(_0xeb48('0x0'));var util=require('util');var moment=require(_0xeb48('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeb48('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xeb48('0x3'))(_0xeb48('0x4'));var config=require(_0xeb48('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xeb48('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bf6c8,_0x1ace98,_0x5254e8){return new BPromise(function(_0x5cff4e,_0x5d17f1){return client[_0xeb48('0x7')](_0x1bf6c8,_0x5254e8)[_0xeb48('0x8')](function(_0x2f9034){logger[_0xeb48('0x9')](_0xeb48('0xa'),_0x1ace98,_0xeb48('0xb'));logger[_0xeb48('0xc')](_0xeb48('0xd'),_0x1ace98,_0xeb48('0xb'),JSON[_0xeb48('0xe')](_0x2f9034));if(_0x2f9034[_0xeb48('0xf')]){if(_0x2f9034[_0xeb48('0xf')]['code']===0x1f4){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x1ace98,_0x2f9034[_0xeb48('0xf')][_0xeb48('0x10')]);return _0x5d17f1(_0x2f9034[_0xeb48('0xf')][_0xeb48('0x10')]);}logger[_0xeb48('0xf')](_0xeb48('0xa'),_0x1ace98,_0x2f9034[_0xeb48('0xf')][_0xeb48('0x10')]);return _0x5cff4e(_0x2f9034[_0xeb48('0xf')]['message']);}else{logger[_0xeb48('0x9')](_0xeb48('0xa'),_0x1ace98,_0xeb48('0xb'));_0x5cff4e(_0x2f9034['result'][_0xeb48('0x10')]);}})[_0xeb48('0x11')](function(_0x40f9fd){logger[_0xeb48('0xf')](_0xeb48('0xa'),_0x1ace98,_0x40f9fd);_0x5d17f1(_0x40f9fd);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 8c18385..98f3b64 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 _0xc6d8=['put','destroy','delete','/:id/sounds/:id2','removeSound','exports','multer','path','express','../../components/auth/service','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','/:id/sounds','post','create','addSound'];(function(_0x3f7c9b,_0x332f51){var _0x9365f9=function(_0x3d1b92){while(--_0x3d1b92){_0x3f7c9b['push'](_0x3f7c9b['shift']());}};_0x9365f9(++_0x332f51);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x2e1777,_0x1f056a){_0x2e1777=_0x2e1777-0x0;var _0x35628f=_0xc6d8[_0x2e1777];return _0x35628f;};'use strict';var multer=require(_0x8c6d('0x0'));var util=require('util');var path=require(_0x8c6d('0x1'));var timeout=require('connect-timeout');var express=require(_0x8c6d('0x2'));var router=express['Router']();var auth=require(_0x8c6d('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8c6d('0x4'));router[_0x8c6d('0x5')]('/',auth[_0x8c6d('0x6')](),controller[_0x8c6d('0x7')]);router[_0x8c6d('0x5')](_0x8c6d('0x8'),auth[_0x8c6d('0x6')](),controller['show']);router[_0x8c6d('0x5')](_0x8c6d('0x9'),auth[_0x8c6d('0x6')](),controller['getSounds']);router[_0x8c6d('0xa')]('/',auth[_0x8c6d('0x6')](),controller[_0x8c6d('0xb')]);router[_0x8c6d('0xa')](_0x8c6d('0x9'),auth[_0x8c6d('0x6')](),controller[_0x8c6d('0xc')]);router[_0x8c6d('0xd')]('/:id',auth[_0x8c6d('0x6')](),controller['update']);router['delete'](_0x8c6d('0x8'),auth[_0x8c6d('0x6')](),controller[_0x8c6d('0xe')]);router[_0x8c6d('0xf')](_0x8c6d('0x10'),auth[_0x8c6d('0x6')](),controller[_0x8c6d('0x11')]);module[_0x8c6d('0x12')]=router; \ No newline at end of file +var _0x9a19=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','/:id/sounds','create','post','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports'];(function(_0x192add,_0x4490e4){var _0x1b9d9d=function(_0x55084d){while(--_0x55084d){_0x192add['push'](_0x192add['shift']());}};_0x1b9d9d(++_0x4490e4);}(_0x9a19,0x114));var _0x99a1=function(_0x544099,_0x372b30){_0x544099=_0x544099-0x0;var _0x20ab09=_0x9a19[_0x544099];return _0x20ab09;};'use strict';var multer=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var path=require(_0x99a1('0x2'));var timeout=require('connect-timeout');var express=require(_0x99a1('0x3'));var router=express[_0x99a1('0x4')]();var auth=require(_0x99a1('0x5'));var interaction=require(_0x99a1('0x6'));var config=require(_0x99a1('0x7'));var controller=require(_0x99a1('0x8'));router[_0x99a1('0x9')]('/',auth[_0x99a1('0xa')](),controller[_0x99a1('0xb')]);router[_0x99a1('0x9')](_0x99a1('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0x99a1('0xd'),auth[_0x99a1('0xa')](),controller['getSounds']);router['post']('/',auth[_0x99a1('0xa')](),controller[_0x99a1('0xe')]);router[_0x99a1('0xf')](_0x99a1('0xd'),auth[_0x99a1('0xa')](),controller['addSound']);router[_0x99a1('0x10')](_0x99a1('0xc'),auth[_0x99a1('0xa')](),controller[_0x99a1('0x11')]);router[_0x99a1('0x12')](_0x99a1('0xc'),auth[_0x99a1('0xa')](),controller[_0x99a1('0x13')]);router[_0x99a1('0x12')](_0x99a1('0x14'),auth[_0x99a1('0xa')](),controller[_0x99a1('0x15')]);module[_0x99a1('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 4199e48..1d455cb 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 _0xe6ef=['files','mp3nb','quietmp3','mp3','alpha','TIMESTAMP','STRING','name','ENUM'];(function(_0x3d7411,_0x4afa6d){var _0xcdb708=function(_0x3774a1){while(--_0x3774a1){_0x3d7411['push'](_0x3d7411['shift']());}};_0xcdb708(++_0x4afa6d);}(_0xe6ef,0xba));var _0xfe6e=function(_0x172a1a,_0x36108a){_0x172a1a=_0x172a1a-0x0;var _0x41acee=_0xe6ef[_0x172a1a];return _0x41acee;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xfe6e('0x0')],'allowNull':![],'unique':_0xfe6e('0x1')},'mode':{'type':Sequelize[_0xfe6e('0x2')]('custom',_0xfe6e('0x3'),_0xfe6e('0x4'),'quietmp3nb',_0xfe6e('0x5'),_0xfe6e('0x6')),'allowNull':!![],'defaultValue':_0xfe6e('0x3')},'directory':{'type':Sequelize[_0xfe6e('0x0')],'allowNull':!![]},'application':{'type':Sequelize[_0xfe6e('0x0')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xfe6e('0x0')],'allowNull':!![],'defaultValue':_0xfe6e('0x7')},'format':{'type':Sequelize[_0xfe6e('0x0')],'allowNull':!![]},'stamp':{'type':_0xfe6e('0x8')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5304=['ENUM','files','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING'];(function(_0x45dfde,_0x597ea9){var _0x26ca3b=function(_0x35598a){while(--_0x35598a){_0x45dfde['push'](_0x45dfde['shift']());}};_0x26ca3b(++_0x597ea9);}(_0x5304,0x17e));var _0x4530=function(_0x12e3e3,_0x501eaf){_0x12e3e3=_0x12e3e3-0x0;var _0x26602e=_0x5304[_0x12e3e3];return _0x26602e;};'use strict';var Sequelize=require(_0x4530('0x0'));module[_0x4530('0x1')]={'name':{'type':Sequelize[_0x4530('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x4530('0x3')]('custom',_0x4530('0x4'),'mp3nb',_0x4530('0x5'),_0x4530('0x6'),_0x4530('0x7')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x4530('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x4530('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x4530('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x4530('0x8')},'format':{'type':Sequelize[_0x4530('0x2')],'allowNull':!![]},'stamp':{'type':_0x4530('0x9')},'defaultEntry':{'type':Sequelize[_0x4530('0xa')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index b9c7ef4..9931c72 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 _0x5b5a=['mkdirSync','0777','transaction','readdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','extname','symlinkSync','removeSound','id2','unlinkSync','getSounds','map','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','limit','status','apply','reject','save','update','destroy','then','error','stack','name','VoiceMusicOnHold','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','pick','day','add','merge','where','filter','options','count','include','findAll','rows','catch','show','params','length','includeAll','find','body','create','sequelize','mode','directory','join','root','server/files/moh'];(function(_0x19a6d8,_0x240df2){var _0x414aa8=function(_0x10d6ea){while(--_0x10d6ea){_0x19a6d8['push'](_0x19a6d8['shift']());}};_0x414aa8(++_0x240df2);}(_0x5b5a,0x13d));var _0xa5b5=function(_0x52cbc6,_0x3a9e07){_0x52cbc6=_0x52cbc6-0x0;var _0x5b7ee5=_0x5b5a[_0x52cbc6];return _0x5b7ee5;};'use strict';var pdf=require(_0xa5b5('0x0'));var emlformat=require(_0xa5b5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa5b5('0x2'));var jsonpatch=require(_0xa5b5('0x3'));var rp=require(_0xa5b5('0x4'));var moment=require(_0xa5b5('0x5'));var BPromise=require(_0xa5b5('0x6'));var Mustache=require('mustache');var util=require(_0xa5b5('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa5b5('0x8'));var fs=require('fs');var _=require(_0xa5b5('0x9'));var squel=require(_0xa5b5('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa5b5('0xb'));var Papa=require(_0xa5b5('0xc'));var Redis=require(_0xa5b5('0xd'));var qs=require(_0xa5b5('0xe'));var logger=require(_0xa5b5('0xf'))(_0xa5b5('0x10'));var utils=require(_0xa5b5('0x11'));var config=require(_0xa5b5('0x12'));var db=require(_0xa5b5('0x13'))['db'];function respondWithStatusCode(_0x12cac2,_0x55be37){_0x55be37=_0x55be37||0xcc;return function(_0x104bee){if(_0x104bee){return _0x12cac2[_0xa5b5('0x14')](_0x55be37);}return _0x12cac2['status'](_0x55be37)[_0xa5b5('0x15')]();};}function respondWithResult(_0x4d644d,_0x1f6aab){_0x1f6aab=_0x1f6aab||0xc8;return function(_0x2906c8){if(_0x2906c8){return _0x4d644d['status'](_0x1f6aab)[_0xa5b5('0x16')](_0x2906c8);}};}function respondWithFilteredResult(_0x4da7e2,_0xf34ecb){return function(_0x292011){if(_0x292011){var _0x20011a=_0x292011['count'],_0x1fedc5=_0xf34ecb['offset'],_0x1bdd82=_0xf34ecb['offset']+_0xf34ecb[_0xa5b5('0x17')],_0x25cd54;if(_0x1bdd82>=_0x20011a){_0x1bdd82=_0x20011a;_0x25cd54=0xc8;}else{_0x25cd54=0xce;}_0x4da7e2[_0xa5b5('0x18')](_0x25cd54);return _0x4da7e2['set']('Content-Range',_0x1fedc5+'-'+_0x1bdd82+'/'+_0x20011a)['json'](_0x292011);}return null;};}function patchUpdates(_0x1318b4){return function(_0x434975){try{jsonpatch[_0xa5b5('0x19')](_0x434975,_0x1318b4,!![]);}catch(_0x361649){return BPromise[_0xa5b5('0x1a')](_0x361649);}return _0x434975[_0xa5b5('0x1b')]();};}function saveUpdates(_0x2d29c1,_0x1d3aad){return function(_0x900860){if(_0x900860){return _0x900860[_0xa5b5('0x1c')](_0x2d29c1)['then'](function(_0x5b8206){return _0x5b8206;});}return null;};}function removeEntity(_0x4afe95,_0x566542){return function(_0x320f48){if(_0x320f48){return _0x320f48[_0xa5b5('0x1d')]()[_0xa5b5('0x1e')](function(){_0x4afe95['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4eff16,_0xf4a88d){return function(_0x11e868){if(!_0x11e868){_0x4eff16[_0xa5b5('0x14')](0x194);}return _0x11e868;};}function handleError(_0x3482ff,_0x329c1d){_0x329c1d=_0x329c1d||0x1f4;return function(_0x58c2d2){logger[_0xa5b5('0x1f')](_0x58c2d2[_0xa5b5('0x20')]);if(_0x58c2d2['name']){delete _0x58c2d2[_0xa5b5('0x21')];}_0x3482ff['status'](_0x329c1d)['send'](_0x58c2d2);};}exports['index']=function(_0x6d34b7,_0x455aa1){var _0x2cec0d={},_0x1521e2={},_0x3336e0={'count':0x0,'rows':[]};var _0x2d447d=db[_0xa5b5('0x22')][_0xa5b5('0x23')];_0x1521e2[_0xa5b5('0x24')]=_[_0xa5b5('0x25')](_0x2d447d);var _0x246138={'dateStart':_0x6d34b7[_0xa5b5('0x26')][_0xa5b5('0x27')],'dateEnd':_0x6d34b7['query']['dateEnd']};delete _0x6d34b7[_0xa5b5('0x26')][_0xa5b5('0x27')];delete _0x6d34b7[_0xa5b5('0x26')][_0xa5b5('0x28')];_0x1521e2[_0xa5b5('0x26')]=_['keys'](_0x6d34b7[_0xa5b5('0x26')]);_0x1521e2[_0xa5b5('0x29')]=_[_0xa5b5('0x2a')](_0x1521e2[_0xa5b5('0x24')],_0x1521e2[_0xa5b5('0x26')]);_0x2cec0d[_0xa5b5('0x2b')]=_[_0xa5b5('0x2a')](_0x1521e2[_0xa5b5('0x24')],qs[_0xa5b5('0x2c')](_0x6d34b7[_0xa5b5('0x26')][_0xa5b5('0x2c')]));_0x2cec0d[_0xa5b5('0x2b')]=_0x2cec0d[_0xa5b5('0x2b')]['length']?_0x2cec0d[_0xa5b5('0x2b')]:_0x1521e2[_0xa5b5('0x24')];if(!_0x6d34b7[_0xa5b5('0x26')][_0xa5b5('0x2d')](_0xa5b5('0x2e'))){_0x2cec0d[_0xa5b5('0x17')]=qs['limit'](_0x6d34b7[_0xa5b5('0x26')][_0xa5b5('0x17')]);_0x2cec0d['offset']=qs[_0xa5b5('0x2f')](_0x6d34b7[_0xa5b5('0x26')]['offset']);}_0x2cec0d[_0xa5b5('0x30')]=qs[_0xa5b5('0x31')](_0x6d34b7[_0xa5b5('0x26')][_0xa5b5('0x31')]);_0x2cec0d['where']=qs[_0xa5b5('0x29')](_[_0xa5b5('0x32')](_0x6d34b7[_0xa5b5('0x26')],_0x1521e2[_0xa5b5('0x29')]));if(_0x246138['dateStart']){if(_0x246138[_0xa5b5('0x28')]){_0x246138[_0xa5b5('0x28')]=moment(_0x246138[_0xa5b5('0x28')])['add'](0x1,_0xa5b5('0x33'));}else{_0x246138[_0xa5b5('0x28')]=moment(_0x246138[_0xa5b5('0x27')])[_0xa5b5('0x34')](0x1,_0xa5b5('0x33'));}_[_0xa5b5('0x35')](_0x2cec0d[_0xa5b5('0x36')],{'createdAt':{'$gte':_0x246138['dateStart'],'$lte':_0x246138['dateEnd']}});}if(_0x6d34b7[_0xa5b5('0x26')][_0xa5b5('0x37')]){_0x2cec0d[_0xa5b5('0x36')]=_[_0xa5b5('0x35')](_0x2cec0d[_0xa5b5('0x36')],{'$or':_['map'](_0x2cec0d[_0xa5b5('0x2b')],function(_0x383f83){var _0x574cda={};_0x574cda[_0x383f83]={'$like':'%'+_0x6d34b7[_0xa5b5('0x26')]['filter']+'%'};return _0x574cda;})});}_0x2cec0d=_['merge']({},_0x2cec0d,_0x6d34b7[_0xa5b5('0x38')]);var _0x3d9f6f={'where':_0x2cec0d['where']};return db['VoiceMusicOnHold'][_0xa5b5('0x39')](_0x3d9f6f)[_0xa5b5('0x1e')](function(_0x55301b){_0x3336e0[_0xa5b5('0x39')]=_0x55301b;if(_0x6d34b7[_0xa5b5('0x26')]['includeAll']){_0x2cec0d[_0xa5b5('0x3a')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xa5b5('0x3b')](_0x2cec0d);})[_0xa5b5('0x1e')](function(_0x67b17b){_0x3336e0[_0xa5b5('0x3c')]=_0x67b17b;return _0x3336e0;})[_0xa5b5('0x1e')](respondWithFilteredResult(_0x455aa1,_0x2cec0d))[_0xa5b5('0x3d')](handleError(_0x455aa1,null));};exports[_0xa5b5('0x3e')]=function(_0x53b506,_0xb13469){var _0x33c04c={'raw':![],'where':{'id':_0x53b506[_0xa5b5('0x3f')]['id']}},_0x36c001={};_0x36c001[_0xa5b5('0x24')]=_[_0xa5b5('0x25')](db[_0xa5b5('0x22')][_0xa5b5('0x23')]);_0x36c001[_0xa5b5('0x26')]=_[_0xa5b5('0x25')](_0x53b506[_0xa5b5('0x26')]);_0x36c001[_0xa5b5('0x29')]=_[_0xa5b5('0x2a')](_0x36c001[_0xa5b5('0x24')],_0x36c001['query']);_0x33c04c['attributes']=_[_0xa5b5('0x2a')](_0x36c001['model'],qs[_0xa5b5('0x2c')](_0x53b506[_0xa5b5('0x26')][_0xa5b5('0x2c')]));_0x33c04c[_0xa5b5('0x2b')]=_0x33c04c[_0xa5b5('0x2b')][_0xa5b5('0x40')]?_0x33c04c['attributes']:_0x36c001[_0xa5b5('0x24')];if(_0x53b506[_0xa5b5('0x26')][_0xa5b5('0x41')]){_0x33c04c[_0xa5b5('0x3a')]=[{'all':!![]}];}_0x33c04c=_['merge']({},_0x33c04c,_0x53b506['options']);return db[_0xa5b5('0x22')][_0xa5b5('0x42')](_0x33c04c)[_0xa5b5('0x1e')](handleEntityNotFound(_0xb13469,null))['then'](respondWithResult(_0xb13469,null))['catch'](handleError(_0xb13469,null));};exports[_0xa5b5('0x1c')]=function(_0x33c701,_0x23e0dc){if(_0x33c701['body']['id']){delete _0x33c701[_0xa5b5('0x43')]['id'];}return db[_0xa5b5('0x22')][_0xa5b5('0x42')]({'where':{'id':_0x33c701[_0xa5b5('0x3f')]['id']}})[_0xa5b5('0x1e')](handleEntityNotFound(_0x23e0dc,null))['then'](saveUpdates(_0x33c701[_0xa5b5('0x43')],null))['then'](respondWithResult(_0x23e0dc,null))[_0xa5b5('0x3d')](handleError(_0x23e0dc,null));};exports[_0xa5b5('0x44')]=function(_0x58b873,_0x1a486d,_0x1a8788){return db[_0xa5b5('0x45')]['transaction'](function(_0x3a0976){if(_0x58b873[_0xa5b5('0x43')][_0xa5b5('0x46')]==='files'){_0x58b873[_0xa5b5('0x43')][_0xa5b5('0x47')]=path[_0xa5b5('0x48')](config[_0xa5b5('0x49')],_0xa5b5('0x4a'),_0x58b873[_0xa5b5('0x43')][_0xa5b5('0x21')]);}return db[_0xa5b5('0x22')][_0xa5b5('0x44')](_0x58b873['body'],{'transaction':_0x3a0976})['then'](function(_0x143e89){if(_0x58b873['body'][_0xa5b5('0x46')]==='files'){fs[_0xa5b5('0x4b')](_0x143e89[_0xa5b5('0x47')],parseInt(_0xa5b5('0x4c'),0x8));}return _0x143e89;});})[_0xa5b5('0x1e')](respondWithResult(_0x1a486d,0xc9))[_0xa5b5('0x3d')](handleError(_0x1a486d,null));};exports[_0xa5b5('0x1d')]=function(_0x1de652,_0x55f1ee,_0x204f40){var _0xc1dde1;return db[_0xa5b5('0x22')][_0xa5b5('0x42')]({'where':{'id':_0x1de652[_0xa5b5('0x3f')]['id']}})[_0xa5b5('0x1e')](function(_0x5b63ed){if(_0x5b63ed){return db[_0xa5b5('0x45')][_0xa5b5('0x4d')](function(_0x37b214){return _0x5b63ed[_0xa5b5('0x1d')]({'transaction':_0x37b214,'raw':!![]})['then'](function(_0xbdab01){if(_0xbdab01['directory']){fs[_0xa5b5('0x4e')](_0xbdab01[_0xa5b5('0x47')])['forEach'](function(_0x1f41b5){fs['unlinkSync'](path[_0xa5b5('0x48')](_0xbdab01['directory'],_0x1f41b5));});fs['rmdirSync'](_0xbdab01[_0xa5b5('0x47')]);}return _0xbdab01;});})[_0xa5b5('0x3d')](function(_0x44e0bf){throw new db[(_0xa5b5('0x4f'))][(_0xa5b5('0x50'))](_0x44e0bf[_0xa5b5('0x51')]);});}})['then'](handleEntityNotFound(_0x55f1ee,null))[_0xa5b5('0x1e')](removeEntity(_0x55f1ee,null))['catch'](handleError(_0x55f1ee,null));};exports[_0xa5b5('0x52')]=function(_0x3340cd,_0xa2fc50,_0x37378c){return db['sequelize'][_0xa5b5('0x4d')](function(_0x3b3dee){var _0x111fed;return db['VoiceMusicOnHold'][_0xa5b5('0x42')]({'where':{'id':_0x3340cd['params']['id']}})[_0xa5b5('0x1e')](function(_0xb7254b){if(_0xb7254b){_0x111fed=_0xb7254b;return _0xb7254b[_0xa5b5('0x52')](_0x3340cd[_0xa5b5('0x43')]['id'],{'transaction':_0x3b3dee});}})[_0xa5b5('0x1e')](function(_0x33d006){if(_0x33d006){return db[_0xa5b5('0x53')][_0xa5b5('0x54')]({'where':{'id':_0x3340cd[_0xa5b5('0x43')]['id']},'attributes':['id',_0xa5b5('0x21'),_0xa5b5('0x55'),_0xa5b5('0x56'),_0xa5b5('0x57')],'raw':!![]});}})[_0xa5b5('0x1e')](function(_0x58f8c4){if(_0x58f8c4){var _0x52a491=path[_0xa5b5('0x48')](config[_0xa5b5('0x49')],_0xa5b5('0x58'),util[_0xa5b5('0x59')](_0xa5b5('0x5a'),path['basename'](_0x58f8c4[_0xa5b5('0x55')],path[_0xa5b5('0x5b')](_0x58f8c4[_0xa5b5('0x55')])),_0x58f8c4[_0xa5b5('0x56')]));var _0x218df2=path[_0xa5b5('0x48')](config['root'],'server/files/moh',_0x111fed[_0xa5b5('0x21')],util[_0xa5b5('0x59')](_0xa5b5('0x5a'),_0x58f8c4[_0xa5b5('0x21')],_0x58f8c4[_0xa5b5('0x56')]));fs[_0xa5b5('0x5c')](_0x52a491,_0x218df2);return _0x58f8c4;}})['catch'](function(_0x53449a){throw new db['Sequelize'][(_0xa5b5('0x50'))](_0x53449a[_0xa5b5('0x51')]);});})['then'](handleEntityNotFound(_0xa2fc50,null))['then'](respondWithResult(_0xa2fc50,0xc9))[_0xa5b5('0x3d')](handleError(_0xa2fc50,null));};exports[_0xa5b5('0x5d')]=function(_0x3ee46b,_0x2ef7f4,_0x50d71d){return db[_0xa5b5('0x45')][_0xa5b5('0x4d')](function(_0x26f6ad){var _0x451e6d;return db[_0xa5b5('0x22')][_0xa5b5('0x54')]({'where':{'id':_0x3ee46b[_0xa5b5('0x3f')]['id']}})[_0xa5b5('0x1e')](handleEntityNotFound(_0x2ef7f4,null))[_0xa5b5('0x1e')](function(_0x5562b7){if(_0x5562b7){_0x451e6d=_0x5562b7;return _0x5562b7['removeSound'](_0x3ee46b['params'][_0xa5b5('0x5e')]);}})['then'](function(_0x389634){if(_0x389634){return db[_0xa5b5('0x53')][_0xa5b5('0x54')]({'where':{'id':_0x3ee46b[_0xa5b5('0x3f')][_0xa5b5('0x5e')]},'attributes':['id',_0xa5b5('0x21'),_0xa5b5('0x55'),'converted_format',_0xa5b5('0x57')],'raw':!![]});}})[_0xa5b5('0x1e')](function(_0x71690b){if(_0x71690b){fs[_0xa5b5('0x5f')](path[_0xa5b5('0x48')](_0x451e6d[_0xa5b5('0x47')],util['format'](_0xa5b5('0x5a'),_0x71690b[_0xa5b5('0x21')],_0x71690b[_0xa5b5('0x56')])));return _0x71690b;}})['catch'](function(_0x40a843){throw new db[(_0xa5b5('0x4f'))][(_0xa5b5('0x50'))](_0x40a843['message']);});})[_0xa5b5('0x1e')](handleEntityNotFound(_0x2ef7f4,null))[_0xa5b5('0x1e')](respondWithStatusCode(_0x2ef7f4,0xcc))[_0xa5b5('0x3d')](handleError(_0x2ef7f4,null));};exports[_0xa5b5('0x60')]=function(_0x301289,_0x3e7cbd,_0x2715e6){var _0xc4bffa={};var _0x5b3ffa={};var _0x2986bd;var _0x5ec886;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x301289[_0xa5b5('0x3f')]['id']}})[_0xa5b5('0x1e')](handleEntityNotFound(_0x3e7cbd,null))['then'](function(_0x41df7e){if(_0x41df7e){_0x2986bd=_0x41df7e;_0x5b3ffa[_0xa5b5('0x24')]=_[_0xa5b5('0x25')](db[_0xa5b5('0x53')]['rawAttributes']);_0x5b3ffa[_0xa5b5('0x26')]=_[_0xa5b5('0x25')](_0x301289[_0xa5b5('0x26')]);_0x5b3ffa['filters']=_[_0xa5b5('0x2a')](_0x5b3ffa[_0xa5b5('0x24')],_0x5b3ffa[_0xa5b5('0x26')]);_0xc4bffa[_0xa5b5('0x2b')]=_[_0xa5b5('0x2a')](_0x5b3ffa[_0xa5b5('0x24')],qs[_0xa5b5('0x2c')](_0x301289[_0xa5b5('0x26')][_0xa5b5('0x2c')]));_0xc4bffa[_0xa5b5('0x2b')]=_0xc4bffa[_0xa5b5('0x2b')][_0xa5b5('0x40')]?_0xc4bffa[_0xa5b5('0x2b')]:_0x5b3ffa[_0xa5b5('0x24')];_0xc4bffa[_0xa5b5('0x30')]=qs[_0xa5b5('0x31')](_0x301289['query']['sort']);_0xc4bffa[_0xa5b5('0x36')]=qs[_0xa5b5('0x29')](_[_0xa5b5('0x32')](_0x301289[_0xa5b5('0x26')],_0x5b3ffa[_0xa5b5('0x29')]));if(_0x301289['query'][_0xa5b5('0x37')]){_0xc4bffa['where']=_['merge'](_0xc4bffa['where'],{'$or':_[_0xa5b5('0x61')](_0xc4bffa['attributes'],function(_0x29fcb4){var _0x2c7f6b={};_0x2c7f6b[_0x29fcb4]={'$like':'%'+_0x301289[_0xa5b5('0x26')][_0xa5b5('0x37')]+'%'};return _0x2c7f6b;})});}_0xc4bffa=_[_0xa5b5('0x35')]({},_0xc4bffa,_0x301289[_0xa5b5('0x38')]);return _0x2986bd[_0xa5b5('0x60')](_0xc4bffa);}})[_0xa5b5('0x1e')](function(_0x1a9163){if(_0x1a9163){_0x5ec886=_0x1a9163[_0xa5b5('0x40')];if(!_0x301289['query'][_0xa5b5('0x2d')]('nolimit')){_0xc4bffa[_0xa5b5('0x17')]=qs[_0xa5b5('0x17')](_0x301289[_0xa5b5('0x26')][_0xa5b5('0x17')]);_0xc4bffa['offset']=qs[_0xa5b5('0x2f')](_0x301289[_0xa5b5('0x26')][_0xa5b5('0x2f')]);}return _0x2986bd[_0xa5b5('0x60')](_0xc4bffa);}})[_0xa5b5('0x1e')](function(_0x1ca530){if(_0x1ca530){return _0x1ca530?{'count':_0x5ec886,'rows':_0x1ca530}:null;}})['then'](respondWithResult(_0x3e7cbd,null))['catch'](handleError(_0x3e7cbd,null));}; \ No newline at end of file +var _0x895a=['rows','catch','show','length','find','body','sequelize','transaction','mode','directory','join','server/files/moh','create','files','mkdirSync','destroy','params','readdirSync','forEach','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','root','format','%s.%s','extname','symlinkSync','removeSound','id2','unlinkSync','order','map','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','error','stack','name','send','VoiceMusicOnHold','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','pick','add','day','filter','where','merge','options','includeAll','include'];(function(_0x34d693,_0x38d303){var _0x156fae=function(_0x380919){while(--_0x380919){_0x34d693['push'](_0x34d693['shift']());}};_0x156fae(++_0x38d303);}(_0x895a,0x14c));var _0xa895=function(_0x3f15ff,_0x3e9502){_0x3f15ff=_0x3f15ff-0x0;var _0x53629e=_0x895a[_0x3f15ff];return _0x53629e;};'use strict';var pdf=require(_0xa895('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa895('0x1'));var zipdir=require(_0xa895('0x2'));var jsonpatch=require(_0xa895('0x3'));var rp=require(_0xa895('0x4'));var moment=require('moment');var BPromise=require(_0xa895('0x5'));var Mustache=require('mustache');var util=require(_0xa895('0x6'));var path=require(_0xa895('0x7'));var sox=require(_0xa895('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa895('0x9'));var crypto=require(_0xa895('0xa'));var jsforce=require(_0xa895('0xb'));var deskjs=require(_0xa895('0xc'));var toCsv=require(_0xa895('0xd'));var querystring=require(_0xa895('0xe'));var Papa=require(_0xa895('0xf'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xa895('0x10'))(_0xa895('0x11'));var utils=require(_0xa895('0x12'));var config=require('../../config/environment');var db=require(_0xa895('0x13'))['db'];function respondWithStatusCode(_0x5db0ea,_0x19fd04){_0x19fd04=_0x19fd04||0xcc;return function(_0xab0873){if(_0xab0873){return _0x5db0ea[_0xa895('0x14')](_0x19fd04);}return _0x5db0ea['status'](_0x19fd04)[_0xa895('0x15')]();};}function respondWithResult(_0x282cc1,_0x3e484c){_0x3e484c=_0x3e484c||0xc8;return function(_0x5dd240){if(_0x5dd240){return _0x282cc1[_0xa895('0x16')](_0x3e484c)[_0xa895('0x17')](_0x5dd240);}};}function respondWithFilteredResult(_0x2cbbaf,_0x4dd6a6){return function(_0x4618e6){if(_0x4618e6){var _0x3f483d=_0x4618e6[_0xa895('0x18')],_0x344169=_0x4dd6a6[_0xa895('0x19')],_0x101a3b=_0x4dd6a6[_0xa895('0x19')]+_0x4dd6a6[_0xa895('0x1a')],_0x4552b5;if(_0x101a3b>=_0x3f483d){_0x101a3b=_0x3f483d;_0x4552b5=0xc8;}else{_0x4552b5=0xce;}_0x2cbbaf[_0xa895('0x16')](_0x4552b5);return _0x2cbbaf[_0xa895('0x1b')](_0xa895('0x1c'),_0x344169+'-'+_0x101a3b+'/'+_0x3f483d)[_0xa895('0x17')](_0x4618e6);}return null;};}function patchUpdates(_0x12f04b){return function(_0x2a5f7d){try{jsonpatch[_0xa895('0x1d')](_0x2a5f7d,_0x12f04b,!![]);}catch(_0x5e1015){return BPromise['reject'](_0x5e1015);}return _0x2a5f7d[_0xa895('0x1e')]();};}function saveUpdates(_0x2111e8,_0xf3b26d){return function(_0x4a6e35){if(_0x4a6e35){return _0x4a6e35[_0xa895('0x1f')](_0x2111e8)[_0xa895('0x20')](function(_0x4b1611){return _0x4b1611;});}return null;};}function removeEntity(_0x4067c4,_0x272096){return function(_0x3f5ccb){if(_0x3f5ccb){return _0x3f5ccb['destroy']()[_0xa895('0x20')](function(){_0x4067c4[_0xa895('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x524ede,_0x3ab9a6){return function(_0x7d52ac){if(!_0x7d52ac){_0x524ede[_0xa895('0x14')](0x194);}return _0x7d52ac;};}function handleError(_0x3c0623,_0x4aac4b){_0x4aac4b=_0x4aac4b||0x1f4;return function(_0x5adbea){logger[_0xa895('0x21')](_0x5adbea[_0xa895('0x22')]);if(_0x5adbea['name']){delete _0x5adbea[_0xa895('0x23')];}_0x3c0623[_0xa895('0x16')](_0x4aac4b)[_0xa895('0x24')](_0x5adbea);};}exports['index']=function(_0x2b7c13,_0x57f562){var _0x1753f7={},_0x1600b1={},_0xd70377={'count':0x0,'rows':[]};var _0x1f37bf=db[_0xa895('0x25')][_0xa895('0x26')];_0x1600b1[_0xa895('0x27')]=_[_0xa895('0x28')](_0x1f37bf);var _0x1cc7cf={'dateStart':_0x2b7c13['query']['dateStart'],'dateEnd':_0x2b7c13[_0xa895('0x29')][_0xa895('0x2a')]};delete _0x2b7c13[_0xa895('0x29')][_0xa895('0x2b')];delete _0x2b7c13['query'][_0xa895('0x2a')];_0x1600b1[_0xa895('0x29')]=_[_0xa895('0x28')](_0x2b7c13['query']);_0x1600b1[_0xa895('0x2c')]=_[_0xa895('0x2d')](_0x1600b1[_0xa895('0x27')],_0x1600b1[_0xa895('0x29')]);_0x1753f7['attributes']=_[_0xa895('0x2d')](_0x1600b1[_0xa895('0x27')],qs[_0xa895('0x2e')](_0x2b7c13[_0xa895('0x29')][_0xa895('0x2e')]));_0x1753f7[_0xa895('0x2f')]=_0x1753f7[_0xa895('0x2f')]['length']?_0x1753f7[_0xa895('0x2f')]:_0x1600b1['model'];if(!_0x2b7c13['query'][_0xa895('0x30')](_0xa895('0x31'))){_0x1753f7[_0xa895('0x1a')]=qs[_0xa895('0x1a')](_0x2b7c13['query']['limit']);_0x1753f7[_0xa895('0x19')]=qs[_0xa895('0x19')](_0x2b7c13[_0xa895('0x29')][_0xa895('0x19')]);}_0x1753f7['order']=qs[_0xa895('0x32')](_0x2b7c13[_0xa895('0x29')][_0xa895('0x32')]);_0x1753f7['where']=qs[_0xa895('0x2c')](_[_0xa895('0x33')](_0x2b7c13['query'],_0x1600b1[_0xa895('0x2c')]));if(_0x1cc7cf[_0xa895('0x2b')]){if(_0x1cc7cf['dateEnd']){_0x1cc7cf[_0xa895('0x2a')]=moment(_0x1cc7cf['dateEnd'])[_0xa895('0x34')](0x1,'day');}else{_0x1cc7cf[_0xa895('0x2a')]=moment(_0x1cc7cf['dateStart'])[_0xa895('0x34')](0x1,_0xa895('0x35'));}_['merge'](_0x1753f7['where'],{'createdAt':{'$gte':_0x1cc7cf[_0xa895('0x2b')],'$lte':_0x1cc7cf[_0xa895('0x2a')]}});}if(_0x2b7c13[_0xa895('0x29')][_0xa895('0x36')]){_0x1753f7['where']=_['merge'](_0x1753f7[_0xa895('0x37')],{'$or':_['map'](_0x1753f7[_0xa895('0x2f')],function(_0x29270e){var _0x4cdd59={};_0x4cdd59[_0x29270e]={'$like':'%'+_0x2b7c13[_0xa895('0x29')][_0xa895('0x36')]+'%'};return _0x4cdd59;})});}_0x1753f7=_[_0xa895('0x38')]({},_0x1753f7,_0x2b7c13[_0xa895('0x39')]);var _0x489d7c={'where':_0x1753f7[_0xa895('0x37')]};return db[_0xa895('0x25')][_0xa895('0x18')](_0x489d7c)[_0xa895('0x20')](function(_0x35e5c6){_0xd70377[_0xa895('0x18')]=_0x35e5c6;if(_0x2b7c13[_0xa895('0x29')][_0xa895('0x3a')]){_0x1753f7[_0xa895('0x3b')]=[{'all':!![]}];}return db[_0xa895('0x25')]['findAll'](_0x1753f7);})[_0xa895('0x20')](function(_0x3a3d45){_0xd70377[_0xa895('0x3c')]=_0x3a3d45;return _0xd70377;})[_0xa895('0x20')](respondWithFilteredResult(_0x57f562,_0x1753f7))[_0xa895('0x3d')](handleError(_0x57f562,null));};exports[_0xa895('0x3e')]=function(_0x1dcef6,_0x285b6f){var _0x55aa44={'raw':![],'where':{'id':_0x1dcef6['params']['id']}},_0x33a621={};_0x33a621[_0xa895('0x27')]=_[_0xa895('0x28')](db[_0xa895('0x25')][_0xa895('0x26')]);_0x33a621[_0xa895('0x29')]=_[_0xa895('0x28')](_0x1dcef6['query']);_0x33a621[_0xa895('0x2c')]=_['intersection'](_0x33a621['model'],_0x33a621[_0xa895('0x29')]);_0x55aa44[_0xa895('0x2f')]=_[_0xa895('0x2d')](_0x33a621[_0xa895('0x27')],qs[_0xa895('0x2e')](_0x1dcef6[_0xa895('0x29')][_0xa895('0x2e')]));_0x55aa44['attributes']=_0x55aa44['attributes'][_0xa895('0x3f')]?_0x55aa44['attributes']:_0x33a621[_0xa895('0x27')];if(_0x1dcef6[_0xa895('0x29')][_0xa895('0x3a')]){_0x55aa44[_0xa895('0x3b')]=[{'all':!![]}];}_0x55aa44=_[_0xa895('0x38')]({},_0x55aa44,_0x1dcef6['options']);return db[_0xa895('0x25')][_0xa895('0x40')](_0x55aa44)['then'](handleEntityNotFound(_0x285b6f,null))[_0xa895('0x20')](respondWithResult(_0x285b6f,null))[_0xa895('0x3d')](handleError(_0x285b6f,null));};exports['update']=function(_0x1e6903,_0xc4f80a){if(_0x1e6903[_0xa895('0x41')]['id']){delete _0x1e6903['body']['id'];}return db[_0xa895('0x25')][_0xa895('0x40')]({'where':{'id':_0x1e6903['params']['id']}})[_0xa895('0x20')](handleEntityNotFound(_0xc4f80a,null))[_0xa895('0x20')](saveUpdates(_0x1e6903['body'],null))[_0xa895('0x20')](respondWithResult(_0xc4f80a,null))[_0xa895('0x3d')](handleError(_0xc4f80a,null));};exports['create']=function(_0x3c67f0,_0x27b38c,_0x57c440){return db[_0xa895('0x42')][_0xa895('0x43')](function(_0x3e20ce){if(_0x3c67f0[_0xa895('0x41')][_0xa895('0x44')]==='files'){_0x3c67f0[_0xa895('0x41')][_0xa895('0x45')]=path[_0xa895('0x46')](config['root'],_0xa895('0x47'),_0x3c67f0['body'][_0xa895('0x23')]);}return db[_0xa895('0x25')][_0xa895('0x48')](_0x3c67f0[_0xa895('0x41')],{'transaction':_0x3e20ce})[_0xa895('0x20')](function(_0x12a483){if(_0x3c67f0['body'][_0xa895('0x44')]===_0xa895('0x49')){fs[_0xa895('0x4a')](_0x12a483[_0xa895('0x45')],parseInt('0777',0x8));}return _0x12a483;});})['then'](respondWithResult(_0x27b38c,0xc9))[_0xa895('0x3d')](handleError(_0x27b38c,null));};exports[_0xa895('0x4b')]=function(_0x4a6a9e,_0x125eed,_0x1afc8f){var _0x321f2a;return db['VoiceMusicOnHold'][_0xa895('0x40')]({'where':{'id':_0x4a6a9e[_0xa895('0x4c')]['id']}})['then'](function(_0x548d23){if(_0x548d23){return db[_0xa895('0x42')][_0xa895('0x43')](function(_0x2c8023){return _0x548d23[_0xa895('0x4b')]({'transaction':_0x2c8023,'raw':!![]})[_0xa895('0x20')](function(_0x401ac0){if(_0x401ac0[_0xa895('0x45')]){fs[_0xa895('0x4d')](_0x401ac0['directory'])[_0xa895('0x4e')](function(_0x257457){fs['unlinkSync'](path[_0xa895('0x46')](_0x401ac0[_0xa895('0x45')],_0x257457));});fs['rmdirSync'](_0x401ac0['directory']);}return _0x401ac0;});})[_0xa895('0x3d')](function(_0x5c8ecd){throw new db[(_0xa895('0x4f'))][(_0xa895('0x50'))](_0x5c8ecd[_0xa895('0x51')]);});}})[_0xa895('0x20')](handleEntityNotFound(_0x125eed,null))['then'](removeEntity(_0x125eed,null))[_0xa895('0x3d')](handleError(_0x125eed,null));};exports['addSound']=function(_0x347b43,_0x234bb3,_0x5e5ca8){return db['sequelize'][_0xa895('0x43')](function(_0x44861f){var _0x572753;return db[_0xa895('0x25')]['find']({'where':{'id':_0x347b43[_0xa895('0x4c')]['id']}})[_0xa895('0x20')](function(_0x48943c){if(_0x48943c){_0x572753=_0x48943c;return _0x48943c[_0xa895('0x52')](_0x347b43[_0xa895('0x41')]['id'],{'transaction':_0x44861f});}})[_0xa895('0x20')](function(_0x53f518){if(_0x53f518){return db[_0xa895('0x53')][_0xa895('0x54')]({'where':{'id':_0x347b43[_0xa895('0x41')]['id']},'attributes':['id','name',_0xa895('0x55'),_0xa895('0x56'),_0xa895('0x57')],'raw':!![]});}})[_0xa895('0x20')](function(_0x8c35f9){if(_0x8c35f9){var _0x28b340=path[_0xa895('0x46')](config[_0xa895('0x58')],'server/files/sounds/converted',util[_0xa895('0x59')](_0xa895('0x5a'),path['basename'](_0x8c35f9[_0xa895('0x55')],path[_0xa895('0x5b')](_0x8c35f9[_0xa895('0x55')])),_0x8c35f9[_0xa895('0x56')]));var _0x4db021=path[_0xa895('0x46')](config['root'],'server/files/moh',_0x572753[_0xa895('0x23')],util[_0xa895('0x59')](_0xa895('0x5a'),_0x8c35f9['name'],_0x8c35f9[_0xa895('0x56')]));fs[_0xa895('0x5c')](_0x28b340,_0x4db021);return _0x8c35f9;}})[_0xa895('0x3d')](function(_0x3aa980){throw new db[(_0xa895('0x4f'))][(_0xa895('0x50'))](_0x3aa980[_0xa895('0x51')]);});})[_0xa895('0x20')](handleEntityNotFound(_0x234bb3,null))['then'](respondWithResult(_0x234bb3,0xc9))['catch'](handleError(_0x234bb3,null));};exports[_0xa895('0x5d')]=function(_0x627714,_0x160cfc,_0x32aeb1){return db[_0xa895('0x42')][_0xa895('0x43')](function(_0x443cdd){var _0x2b172b;return db[_0xa895('0x25')][_0xa895('0x54')]({'where':{'id':_0x627714['params']['id']}})[_0xa895('0x20')](handleEntityNotFound(_0x160cfc,null))[_0xa895('0x20')](function(_0x15b790){if(_0x15b790){_0x2b172b=_0x15b790;return _0x15b790[_0xa895('0x5d')](_0x627714[_0xa895('0x4c')][_0xa895('0x5e')]);}})['then'](function(_0x4454b1){if(_0x4454b1){return db[_0xa895('0x53')][_0xa895('0x54')]({'where':{'id':_0x627714['params'][_0xa895('0x5e')]},'attributes':['id',_0xa895('0x23'),'save_name',_0xa895('0x56'),_0xa895('0x57')],'raw':!![]});}})[_0xa895('0x20')](function(_0x4d9a36){if(_0x4d9a36){fs[_0xa895('0x5f')](path[_0xa895('0x46')](_0x2b172b[_0xa895('0x45')],util['format']('%s.%s',_0x4d9a36[_0xa895('0x23')],_0x4d9a36['converted_format'])));return _0x4d9a36;}})[_0xa895('0x3d')](function(_0x3e7973){throw new db[(_0xa895('0x4f'))][(_0xa895('0x50'))](_0x3e7973[_0xa895('0x51')]);});})[_0xa895('0x20')](handleEntityNotFound(_0x160cfc,null))[_0xa895('0x20')](respondWithStatusCode(_0x160cfc,0xcc))[_0xa895('0x3d')](handleError(_0x160cfc,null));};exports['getSounds']=function(_0x2e0772,_0xc4a751,_0x214b7e){var _0xd104f5={};var _0x243807={};var _0x236a66;var _0x53a61b;return db[_0xa895('0x25')][_0xa895('0x54')]({'where':{'id':_0x2e0772[_0xa895('0x4c')]['id']}})[_0xa895('0x20')](handleEntityNotFound(_0xc4a751,null))[_0xa895('0x20')](function(_0x4519ee){if(_0x4519ee){_0x236a66=_0x4519ee;_0x243807[_0xa895('0x27')]=_['keys'](db[_0xa895('0x53')][_0xa895('0x26')]);_0x243807['query']=_['keys'](_0x2e0772['query']);_0x243807[_0xa895('0x2c')]=_[_0xa895('0x2d')](_0x243807[_0xa895('0x27')],_0x243807[_0xa895('0x29')]);_0xd104f5[_0xa895('0x2f')]=_[_0xa895('0x2d')](_0x243807[_0xa895('0x27')],qs['fields'](_0x2e0772[_0xa895('0x29')][_0xa895('0x2e')]));_0xd104f5[_0xa895('0x2f')]=_0xd104f5[_0xa895('0x2f')][_0xa895('0x3f')]?_0xd104f5[_0xa895('0x2f')]:_0x243807['model'];_0xd104f5[_0xa895('0x60')]=qs[_0xa895('0x32')](_0x2e0772['query'][_0xa895('0x32')]);_0xd104f5[_0xa895('0x37')]=qs[_0xa895('0x2c')](_[_0xa895('0x33')](_0x2e0772[_0xa895('0x29')],_0x243807[_0xa895('0x2c')]));if(_0x2e0772[_0xa895('0x29')][_0xa895('0x36')]){_0xd104f5['where']=_[_0xa895('0x38')](_0xd104f5[_0xa895('0x37')],{'$or':_[_0xa895('0x61')](_0xd104f5[_0xa895('0x2f')],function(_0x5bb6ec){var _0x2e1053={};_0x2e1053[_0x5bb6ec]={'$like':'%'+_0x2e0772[_0xa895('0x29')][_0xa895('0x36')]+'%'};return _0x2e1053;})});}_0xd104f5=_[_0xa895('0x38')]({},_0xd104f5,_0x2e0772[_0xa895('0x39')]);return _0x236a66['getSounds'](_0xd104f5);}})[_0xa895('0x20')](function(_0x31e060){if(_0x31e060){_0x53a61b=_0x31e060[_0xa895('0x3f')];if(!_0x2e0772[_0xa895('0x29')][_0xa895('0x30')]('nolimit')){_0xd104f5[_0xa895('0x1a')]=qs[_0xa895('0x1a')](_0x2e0772[_0xa895('0x29')][_0xa895('0x1a')]);_0xd104f5[_0xa895('0x19')]=qs[_0xa895('0x19')](_0x2e0772[_0xa895('0x29')][_0xa895('0x19')]);}return _0x236a66['getSounds'](_0xd104f5);}})[_0xa895('0x20')](function(_0xc88719){if(_0xc88719){return _0xc88719?{'count':_0x53a61b,'rows':_0xc88719}:null;}})[_0xa895('0x20')](respondWithResult(_0xc4a751,null))[_0xa895('0x3d')](handleError(_0xc4a751,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 8f51aa5..f3256d1 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 _0x1e0f=['exports','define','VoiceMusicOnHold','voice_musiconhold','api','moment','bluebird','request-promise','./voiceMusicOnHold.attributes'];(function(_0x2ca616,_0x384ec8){var _0x53155f=function(_0x108627){while(--_0x108627){_0x2ca616['push'](_0x2ca616['shift']());}};_0x53155f(++_0x384ec8);}(_0x1e0f,0x1bd));var _0xf1e0=function(_0xad6884,_0x3ec8c9){_0xad6884=_0xad6884-0x0;var _0x16fb8f=_0x1e0f[_0xad6884];return _0x16fb8f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf1e0('0x0'));var moment=require(_0xf1e0('0x1'));var BPromise=require(_0xf1e0('0x2'));var rp=require(_0xf1e0('0x3'));var attributes=require(_0xf1e0('0x4'));module[_0xf1e0('0x5')]=function(_0x1e2438,_0xe076d1){return _0x1e2438[_0xf1e0('0x6')](_0xf1e0('0x7'),attributes,{'tableName':_0xf1e0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6cd9=['voice_musiconhold','lodash','util','../../config/logger','api','bluebird','request-promise','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold'];(function(_0x4a2fde,_0x3a2d4a){var _0x224d77=function(_0x5c0f4e){while(--_0x5c0f4e){_0x4a2fde['push'](_0x4a2fde['shift']());}};_0x224d77(++_0x3a2d4a);}(_0x6cd9,0x1af));var _0x96cd=function(_0x128da8,_0x103045){_0x128da8=_0x128da8-0x0;var _0x1b1c9=_0x6cd9[_0x128da8];return _0x1b1c9;};'use strict';var _=require(_0x96cd('0x0'));var util=require(_0x96cd('0x1'));var logger=require(_0x96cd('0x2'))(_0x96cd('0x3'));var moment=require('moment');var BPromise=require(_0x96cd('0x4'));var rp=require(_0x96cd('0x5'));var attributes=require(_0x96cd('0x6'));module[_0x96cd('0x7')]=function(_0x356cbc,_0x2c172c){return _0x356cbc['define'](_0x96cd('0x8'),attributes,{'tableName':_0x96cd('0x9'),'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 e3ab5fb..e96d57e 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 _0x1c32=['rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1c62c0,_0xafefea){var _0x4bda29=function(_0x23073a){while(--_0x23073a){_0x1c62c0['push'](_0x1c62c0['shift']());}};_0x4bda29(++_0xafefea);}(_0x1c32,0xb8));var _0x21c3=function(_0x1d128e,_0x2c87de){_0x1d128e=_0x1d128e-0x0;var _0x3d5236=_0x1c32[_0x1d128e];return _0x3d5236;};'use strict';var _=require(_0x21c3('0x0'));var util=require(_0x21c3('0x1'));var moment=require(_0x21c3('0x2'));var BPromise=require('bluebird');var rs=require(_0x21c3('0x3'));var fs=require('fs');var Redis=require(_0x21c3('0x4'));var db=require(_0x21c3('0x5'))['db'];var utils=require(_0x21c3('0x6'));var logger=require(_0x21c3('0x7'))(_0x21c3('0x8'));var config=require(_0x21c3('0x9'));var jayson=require(_0x21c3('0xa'));var client=jayson[_0x21c3('0xb')][_0x21c3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x15c78e,_0x2cbee8,_0x2aed42){return new BPromise(function(_0x19add2,_0x236c50){return client[_0x21c3('0xd')](_0x15c78e,_0x2aed42)['then'](function(_0x1fb656){logger[_0x21c3('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2cbee8,_0x21c3('0xf'));logger[_0x21c3('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2cbee8,_0x21c3('0xf'),JSON[_0x21c3('0x11')](_0x1fb656));if(_0x1fb656[_0x21c3('0x12')]){if(_0x1fb656[_0x21c3('0x12')][_0x21c3('0x13')]===0x1f4){logger[_0x21c3('0x12')](_0x21c3('0x14'),_0x2cbee8,_0x1fb656['error'][_0x21c3('0x15')]);return _0x236c50(_0x1fb656[_0x21c3('0x12')][_0x21c3('0x15')]);}logger['error'](_0x21c3('0x14'),_0x2cbee8,_0x1fb656[_0x21c3('0x12')]['message']);return _0x19add2(_0x1fb656[_0x21c3('0x12')]['message']);}else{logger['info'](_0x21c3('0x14'),_0x2cbee8,_0x21c3('0xf'));_0x19add2(_0x1fb656[_0x21c3('0x16')]['message']);}})[_0x21c3('0x17')](function(_0x975d68){logger[_0x21c3('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2cbee8,_0x975d68);_0x236c50(_0x975d68);});});} \ No newline at end of file +var _0x023b=['jayson/promise','client','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xc0fe0c,_0x3663a2){var _0x36c5f7=function(_0x42858e){while(--_0x42858e){_0xc0fe0c['push'](_0xc0fe0c['shift']());}};_0x36c5f7(++_0x3663a2);}(_0x023b,0x123));var _0xb023=function(_0x349b55,_0x4ce603){_0x349b55=_0x349b55-0x0;var _0x5f46a9=_0x023b[_0x349b55];return _0x5f46a9;};'use strict';var _=require(_0xb023('0x0'));var util=require('util');var moment=require(_0xb023('0x1'));var BPromise=require('bluebird');var rs=require(_0xb023('0x2'));var fs=require('fs');var Redis=require(_0xb023('0x3'));var db=require(_0xb023('0x4'))['db'];var utils=require(_0xb023('0x5'));var logger=require(_0xb023('0x6'))(_0xb023('0x7'));var config=require(_0xb023('0x8'));var jayson=require(_0xb023('0x9'));var client=jayson[_0xb023('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x445780,_0x4366f1,_0x3c16a3){return new BPromise(function(_0x3ab1db,_0x56f95f){return client['request'](_0x445780,_0x3c16a3)[_0xb023('0xb')](function(_0x233525){logger[_0xb023('0xc')](_0xb023('0xd'),_0x4366f1,_0xb023('0xe'));logger['debug'](_0xb023('0xf'),_0x4366f1,_0xb023('0xe'),JSON['stringify'](_0x233525));if(_0x233525['error']){if(_0x233525[_0xb023('0x10')][_0xb023('0x11')]===0x1f4){logger[_0xb023('0x10')](_0xb023('0xd'),_0x4366f1,_0x233525[_0xb023('0x10')][_0xb023('0x12')]);return _0x56f95f(_0x233525[_0xb023('0x10')][_0xb023('0x12')]);}logger[_0xb023('0x10')](_0xb023('0xd'),_0x4366f1,_0x233525[_0xb023('0x10')][_0xb023('0x12')]);return _0x3ab1db(_0x233525[_0xb023('0x10')]['message']);}else{logger[_0xb023('0xc')](_0xb023('0xd'),_0x4366f1,_0xb023('0xe'));_0x3ab1db(_0x233525['result']['message']);}})[_0xb023('0x13')](function(_0x5805de){logger[_0xb023('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4366f1,_0x5805de);_0x56f95f(_0x5805de);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 033b512..73570ec 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 _0x758e=['get','isAuthenticated','/describe','/:id','getAgents','post','create','/:id/users','addAgents','update','delete','destroy','removeAgents','multer','connect-timeout','express','Router','../../config/environment','./voicePrefix.controller'];(function(_0x304d1f,_0x41e22f){var _0x3e3583=function(_0x2a47e3){while(--_0x2a47e3){_0x304d1f['push'](_0x304d1f['shift']());}};_0x3e3583(++_0x41e22f);}(_0x758e,0x1af));var _0xe758=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x758e[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require(_0xe758('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe758('0x1'));var express=require(_0xe758('0x2'));var router=express[_0xe758('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe758('0x4'));var controller=require(_0xe758('0x5'));router[_0xe758('0x6')]('/',auth[_0xe758('0x7')](),controller['index']);router[_0xe758('0x6')](_0xe758('0x8'),auth[_0xe758('0x7')](),controller['describe']);router['get'](_0xe758('0x9'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/users',auth[_0xe758('0x7')](),controller[_0xe758('0xa')]);router[_0xe758('0xb')]('/',auth['isAuthenticated'](),controller[_0xe758('0xc')]);router['post'](_0xe758('0xd'),auth[_0xe758('0x7')](),controller[_0xe758('0xe')]);router['put'](_0xe758('0x9'),auth['isAuthenticated'](),controller[_0xe758('0xf')]);router[_0xe758('0x10')](_0xe758('0x9'),auth[_0xe758('0x7')](),controller[_0xe758('0x11')]);router[_0xe758('0x10')](_0xe758('0xd'),auth[_0xe758('0x7')](),controller[_0xe758('0x12')]);module['exports']=router; \ No newline at end of file +var _0x1689=['getAgents','post','create','/:id/users','addAgents','update','delete','destroy','removeAgents','exports','path','connect-timeout','express','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x1689,0x19a));var _0x9168=function(_0x47a3b4,_0x227f94){_0x47a3b4=_0x47a3b4-0x0;var _0x9eb242=_0x1689[_0x47a3b4];return _0x9eb242;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9168('0x0'));var timeout=require(_0x9168('0x1'));var express=require(_0x9168('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9168('0x3'));var controller=require(_0x9168('0x4'));router[_0x9168('0x5')]('/',auth[_0x9168('0x6')](),controller[_0x9168('0x7')]);router['get']('/describe',auth[_0x9168('0x6')](),controller[_0x9168('0x8')]);router['get'](_0x9168('0x9'),auth[_0x9168('0x6')](),controller['show']);router['get']('/:id/users',auth[_0x9168('0x6')](),controller[_0x9168('0xa')]);router[_0x9168('0xb')]('/',auth[_0x9168('0x6')](),controller[_0x9168('0xc')]);router[_0x9168('0xb')](_0x9168('0xd'),auth[_0x9168('0x6')](),controller[_0x9168('0xe')]);router['put'](_0x9168('0x9'),auth[_0x9168('0x6')](),controller[_0x9168('0xf')]);router[_0x9168('0x10')](_0x9168('0x9'),auth[_0x9168('0x6')](),controller[_0x9168('0x11')]);router[_0x9168('0x10')](_0x9168('0xd'),auth[_0x9168('0x6')](),controller[_0x9168('0x12')]);module[_0x9168('0x13')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 1a41e1f..365e31f 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 _0x19d2=['getDataValue','INTEGER','sequelize','STRING','name','system-'];(function(_0x2e476a,_0x1c655d){var _0x188142=function(_0x4936ef){while(--_0x4936ef){_0x2e476a['push'](_0x2e476a['shift']());}};_0x188142(++_0x1c655d);}(_0x19d2,0x1b2));var _0x219d=function(_0x49d293,_0x59a1ad){_0x49d293=_0x49d293-0x0;var _0x24ea4e=_0x19d2[_0x49d293];return _0x24ea4e;};'use strict';var Sequelize=require(_0x219d('0x0'));module['exports']={'name':{'type':Sequelize[_0x219d('0x1')],'allowNull':![],'unique':_0x219d('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x3c48fa){return _0x219d('0x3')+this[_0x219d('0x4')](_0x219d('0x2'))+'-';}},'description':{'type':Sequelize[_0x219d('0x1')]},'callerIdAll':{'type':Sequelize[_0x219d('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x219d('0x5')]}}; \ No newline at end of file +var _0x8ef4=['getDataValue','STRING','INTEGER','sequelize','name','VIRTUAL','system-'];(function(_0xc28d5b,_0x15facf){var _0x2b857b=function(_0x411259){while(--_0x411259){_0xc28d5b['push'](_0xc28d5b['shift']());}};_0x2b857b(++_0x15facf);}(_0x8ef4,0x17d));var _0x48ef=function(_0x1d3a5d,_0x17fc32){_0x1d3a5d=_0x1d3a5d-0x0;var _0x257078=_0x8ef4[_0x1d3a5d];return _0x257078;};'use strict';var Sequelize=require(_0x48ef('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x48ef('0x1')},'prefix':{'type':Sequelize[_0x48ef('0x2')],'get':function(_0x5c63d9){return _0x48ef('0x3')+this[_0x48ef('0x4')](_0x48ef('0x1'))+'-';}},'description':{'type':Sequelize[_0x48ef('0x5')]},'callerIdAll':{'type':Sequelize[_0x48ef('0x5')]},'VoiceExtensionId':{'type':Sequelize[_0x48ef('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index a22a639..0c2ea59 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 _0x7046=['Content-Range','apply','reject','save','update','then','destroy','end','error','stack','send','index','VoicePrefix','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','add','day','merge','map','filter','options','includeAll','include','show','params','rawAttributes','catch','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','context','from-sip','type','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','get','bulkCreate','Extensions\x20creation\x20failed','CDR(prefix)=','name','callerIdAll','push','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','json','count','offset','set'];(function(_0x5e7541,_0x712ede){var _0x182040=function(_0x4fc478){while(--_0x4fc478){_0x5e7541['push'](_0x5e7541['shift']());}};_0x182040(++_0x712ede);}(_0x7046,0x144));var _0x6704=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x7046[_0x42cae2];return _0x5f256f;};'use strict';var pdf=require(_0x6704('0x0'));var emlformat=require(_0x6704('0x1'));var rimraf=require(_0x6704('0x2'));var zipdir=require(_0x6704('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6704('0x4'));var moment=require(_0x6704('0x5'));var BPromise=require(_0x6704('0x6'));var Mustache=require('mustache');var util=require(_0x6704('0x7'));var path=require(_0x6704('0x8'));var sox=require(_0x6704('0x9'));var csv=require(_0x6704('0xa'));var ejs=require(_0x6704('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6704('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6704('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6704('0xe'));var Redis=require(_0x6704('0xf'));var qs=require(_0x6704('0x10'));var logger=require(_0x6704('0x11'))(_0x6704('0x12'));var utils=require(_0x6704('0x13'));var config=require(_0x6704('0x14'));var db=require(_0x6704('0x15'))['db'];config['redis']=_[_0x6704('0x16')](config[_0x6704('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x6704('0x18'))(new Redis(config[_0x6704('0x17')]));require(_0x6704('0x19'))[_0x6704('0x1a')](socket);function respondWithStatusCode(_0x34a538,_0x1ec91e){_0x1ec91e=_0x1ec91e||0xcc;return function(_0x17b9bc){if(_0x17b9bc){return _0x34a538[_0x6704('0x1b')](_0x1ec91e);}return _0x34a538[_0x6704('0x1c')](_0x1ec91e)['end']();};}function respondWithResult(_0x168258,_0x1752bc){_0x1752bc=_0x1752bc||0xc8;return function(_0x35082b){if(_0x35082b){return _0x168258['status'](_0x1752bc)[_0x6704('0x1d')](_0x35082b);}};}function respondWithFilteredResult(_0x244537,_0x3e7d1f){return function(_0x29fa46){if(_0x29fa46){var _0x37fa47=_0x29fa46[_0x6704('0x1e')],_0x5adb35=_0x3e7d1f[_0x6704('0x1f')],_0x1e5f6e=_0x3e7d1f[_0x6704('0x1f')]+_0x3e7d1f['limit'],_0x31d732;if(_0x1e5f6e>=_0x37fa47){_0x1e5f6e=_0x37fa47;_0x31d732=0xc8;}else{_0x31d732=0xce;}_0x244537[_0x6704('0x1c')](_0x31d732);return _0x244537[_0x6704('0x20')](_0x6704('0x21'),_0x5adb35+'-'+_0x1e5f6e+'/'+_0x37fa47)[_0x6704('0x1d')](_0x29fa46);}return null;};}function patchUpdates(_0x35eb99){return function(_0x301fea){try{jsonpatch[_0x6704('0x22')](_0x301fea,_0x35eb99,!![]);}catch(_0x5bb33e){return BPromise[_0x6704('0x23')](_0x5bb33e);}return _0x301fea[_0x6704('0x24')]();};}function saveUpdates(_0x318e2c,_0x59dc43){return function(_0x4dca58){if(_0x4dca58){return _0x4dca58[_0x6704('0x25')](_0x318e2c)[_0x6704('0x26')](function(_0x3cd12e){return _0x3cd12e;});}return null;};}function removeEntity(_0x4ecf4c,_0x41f89e){return function(_0x56d1e1){if(_0x56d1e1){return _0x56d1e1[_0x6704('0x27')]()[_0x6704('0x26')](function(){_0x4ecf4c[_0x6704('0x1c')](0xcc)[_0x6704('0x28')]();});}};}function handleEntityNotFound(_0x16b6b9,_0x2476d6){return function(_0x2acafd){if(!_0x2acafd){_0x16b6b9[_0x6704('0x1b')](0x194);}return _0x2acafd;};}function handleError(_0x896227,_0x1587c5){_0x1587c5=_0x1587c5||0x1f4;return function(_0x36bea4){logger[_0x6704('0x29')](_0x36bea4[_0x6704('0x2a')]);if(_0x36bea4['name']){delete _0x36bea4['name'];}_0x896227[_0x6704('0x1c')](_0x1587c5)[_0x6704('0x2b')](_0x36bea4);};}exports[_0x6704('0x2c')]=function(_0x38f9fe,_0x4a9c3e){var _0x1def46={},_0x18cd98={},_0x5c229d={'count':0x0,'rows':[]};var _0x588814=db[_0x6704('0x2d')]['rawAttributes'];_0x18cd98[_0x6704('0x2e')]=_['keys'](_0x588814);var _0x53b2af={'dateStart':_0x38f9fe[_0x6704('0x2f')][_0x6704('0x30')],'dateEnd':_0x38f9fe[_0x6704('0x2f')]['dateEnd']};delete _0x38f9fe[_0x6704('0x2f')][_0x6704('0x30')];delete _0x38f9fe[_0x6704('0x2f')][_0x6704('0x31')];_0x18cd98[_0x6704('0x2f')]=_[_0x6704('0x32')](_0x38f9fe[_0x6704('0x2f')]);_0x18cd98[_0x6704('0x33')]=_[_0x6704('0x34')](_0x18cd98[_0x6704('0x2e')],_0x18cd98[_0x6704('0x2f')]);_0x1def46[_0x6704('0x35')]=_[_0x6704('0x34')](_0x18cd98[_0x6704('0x2e')],qs[_0x6704('0x36')](_0x38f9fe[_0x6704('0x2f')][_0x6704('0x36')]));_0x1def46[_0x6704('0x35')]=_0x1def46[_0x6704('0x35')][_0x6704('0x37')]?_0x1def46[_0x6704('0x35')]:_0x18cd98[_0x6704('0x2e')];if(!_0x38f9fe[_0x6704('0x2f')][_0x6704('0x38')](_0x6704('0x39'))){_0x1def46['limit']=qs['limit'](_0x38f9fe['query'][_0x6704('0x3a')]);_0x1def46[_0x6704('0x1f')]=qs[_0x6704('0x1f')](_0x38f9fe['query'][_0x6704('0x1f')]);}_0x1def46['order']=qs[_0x6704('0x3b')](_0x38f9fe[_0x6704('0x2f')][_0x6704('0x3b')]);_0x1def46[_0x6704('0x3c')]=qs[_0x6704('0x33')](_[_0x6704('0x3d')](_0x38f9fe[_0x6704('0x2f')],_0x18cd98[_0x6704('0x33')]));if(_0x53b2af['dateStart']){if(_0x53b2af['dateEnd']){_0x53b2af[_0x6704('0x31')]=moment(_0x53b2af[_0x6704('0x31')])['add'](0x1,'day');}else{_0x53b2af[_0x6704('0x31')]=moment(_0x53b2af['dateStart'])[_0x6704('0x3e')](0x1,_0x6704('0x3f'));}_[_0x6704('0x40')](_0x1def46[_0x6704('0x3c')],{'createdAt':{'$gte':_0x53b2af['dateStart'],'$lte':_0x53b2af[_0x6704('0x31')]}});}if(_0x38f9fe[_0x6704('0x2f')]['filter']){_0x1def46[_0x6704('0x3c')]=_['merge'](_0x1def46[_0x6704('0x3c')],{'$or':_[_0x6704('0x41')](_0x1def46[_0x6704('0x35')],function(_0x5862e3){var _0x32c552={};_0x32c552[_0x5862e3]={'$like':'%'+_0x38f9fe[_0x6704('0x2f')][_0x6704('0x42')]+'%'};return _0x32c552;})});}_0x1def46=_['merge']({},_0x1def46,_0x38f9fe[_0x6704('0x43')]);var _0x444d36={'where':_0x1def46[_0x6704('0x3c')]};return db[_0x6704('0x2d')]['count'](_0x444d36)[_0x6704('0x26')](function(_0x50cc74){_0x5c229d[_0x6704('0x1e')]=_0x50cc74;if(_0x38f9fe[_0x6704('0x2f')][_0x6704('0x44')]){_0x1def46[_0x6704('0x45')]=[{'all':!![]}];}return db['VoicePrefix']['findAll'](_0x1def46);})['then'](function(_0x2bf82d){_0x5c229d['rows']=_0x2bf82d;return _0x5c229d;})[_0x6704('0x26')](respondWithFilteredResult(_0x4a9c3e,_0x1def46))['catch'](handleError(_0x4a9c3e,null));};exports[_0x6704('0x46')]=function(_0xa1e913,_0x56a344){var _0x3ea2a5={'raw':![],'where':{'id':_0xa1e913[_0x6704('0x47')]['id']}},_0x19ddb9={};_0x19ddb9[_0x6704('0x2e')]=_[_0x6704('0x32')](db['VoicePrefix'][_0x6704('0x48')]);_0x19ddb9[_0x6704('0x2f')]=_[_0x6704('0x32')](_0xa1e913[_0x6704('0x2f')]);_0x19ddb9[_0x6704('0x33')]=_['intersection'](_0x19ddb9[_0x6704('0x2e')],_0x19ddb9['query']);_0x3ea2a5[_0x6704('0x35')]=_[_0x6704('0x34')](_0x19ddb9[_0x6704('0x2e')],qs[_0x6704('0x36')](_0xa1e913[_0x6704('0x2f')]['fields']));_0x3ea2a5[_0x6704('0x35')]=_0x3ea2a5[_0x6704('0x35')]['length']?_0x3ea2a5[_0x6704('0x35')]:_0x19ddb9[_0x6704('0x2e')];if(_0xa1e913[_0x6704('0x2f')][_0x6704('0x44')]){_0x3ea2a5[_0x6704('0x45')]=[{'all':!![]}];}_0x3ea2a5=_[_0x6704('0x40')]({},_0x3ea2a5,_0xa1e913['options']);return db[_0x6704('0x2d')]['find'](_0x3ea2a5)[_0x6704('0x26')](handleEntityNotFound(_0x56a344,null))['then'](respondWithResult(_0x56a344,null))[_0x6704('0x49')](handleError(_0x56a344,null));};exports['destroy']=function(_0x58a085,_0x1532d5){return db[_0x6704('0x2d')][_0x6704('0x4a')]({'where':{'id':_0x58a085[_0x6704('0x47')]['id']}})[_0x6704('0x26')](handleEntityNotFound(_0x1532d5,null))[_0x6704('0x26')](removeEntity(_0x1532d5,null))['catch'](handleError(_0x1532d5,null));};exports['describe']=function(_0x254cf7,_0x3c01a0){return db[_0x6704('0x2d')][_0x6704('0x4b')]()[_0x6704('0x26')](respondWithResult(_0x3c01a0,null))[_0x6704('0x49')](handleError(_0x3c01a0,null));};exports[_0x6704('0x4c')]=function(_0x2f0d31,_0x1fcfb0){var _0x44e4a5;return db[_0x6704('0x4d')][_0x6704('0x4e')](function(_0x26fe5a){return db[_0x6704('0x2d')][_0x6704('0x4c')](_0x2f0d31[_0x6704('0x4f')],{'transaction':_0x26fe5a})[_0x6704('0x26')](function(_0x493083){_0x44e4a5=_0x493083['get']({'plain':!![]});return db[_0x6704('0x50')][_0x6704('0x4a')]({'where':{'id':_0x44e4a5[_0x6704('0x51')]},'raw':!![]})[_0x6704('0x26')](function(_0x57b4f1){return createVoicePrefixExtensions(_0x44e4a5,_0x57b4f1,_0x26fe5a);});});})[_0x6704('0x26')](function(){return _0x44e4a5;})[_0x6704('0x26')](respondWithResult(_0x1fcfb0,null))[_0x6704('0x49')](handleError(_0x1fcfb0,null));};function Extension(_0x45510e,_0x51971f,_0x345ed3,_0x20dfc0){this[_0x6704('0x52')]=_0x6704('0x53');this['exten']=_0x45510e;this['app']=_0x345ed3;this[_0x6704('0x54')]=_0x6704('0x55');this[_0x6704('0x56')]=_0x6704('0x57');this[_0x6704('0x58')]=_0x51971f;this[_0x6704('0x59')]=_0x20dfc0;}function createVoicePrefixExtensions(_0x5e5e58,_0x1ceb48,_0x5361dd){return new BPromise(function(_0x71b2a4,_0x58b651){var _0x5034be=new Extension(formatPrefixName(_0x5e5e58[_0x6704('0x5a')]),0x1,_0x6704('0x5b'),_0x6704('0x5c'));_0x5034be[_0x6704('0x5d')]=_0x5e5e58['id'];return db[_0x6704('0x50')][_0x6704('0x4c')](_0x5034be,{'transaction':_0x5361dd})['then'](function(_0x54216a){var _0x46c386=_0x54216a[_0x6704('0x5e')]({'plain':!![]});var _0x436fd5=_[_0x6704('0x41')](addVoicePrefixExtensions(_0x5e5e58,_0x1ceb48),function(_0x3d6c5b){_0x3d6c5b[_0x6704('0x51')]=_0x46c386['id'];_0x3d6c5b['VoicePrefixId']=_0x5e5e58['id'];return _0x3d6c5b;});return db[_0x6704('0x50')][_0x6704('0x5f')](_0x436fd5,{'transaction':_0x5361dd})[_0x6704('0x26')](function(_0x14c3c8){if(!_0x14c3c8){return _0x58b651(_0x6704('0x60'));}else{return _0x71b2a4(_0x14c3c8);}})[_0x6704('0x49')](function(_0x30da98){return _0x58b651(_0x30da98);});});;});};function addVoicePrefixExtensions(_0x5395b1,_0x547b89){var _0x280e28=[];var _0x3954d5=formatPrefixName(_0x5395b1[_0x6704('0x5a')]);_0x280e28['push'](new Extension(_0x3954d5,0x2,'Set',_0x6704('0x61')+_0x5395b1[_0x6704('0x62')]));if(_0x5395b1[_0x6704('0x63')]){_0x280e28[_0x6704('0x64')](new Extension(_0x3954d5,0x3,'Set',_0x6704('0x65')+_0x5395b1[_0x6704('0x63')]));}else{_0x280e28['push'](new Extension(_0x3954d5,0x3,'NoOp',_0x6704('0x66')));}_0x280e28[_0x6704('0x64')](new Extension(_0x3954d5,0x4,_0x6704('0x67'),_0x547b89[_0x6704('0x52')]+','+_0x6704('0x68')+(0x8+_0x5395b1[_0x6704('0x62')][_0x6704('0x37')])+'}'+','+0x1));return _0x280e28;}function formatPrefixName(_0x533107){var _0x4876ad='_';for(var _0x40f1f8=0x0;_0x40f1f8<_0x533107[_0x6704('0x37')];_0x40f1f8++){if(_0x533107[_0x6704('0x69')](_0x40f1f8)=='-'){_0x4876ad+=_0x533107[_0x6704('0x69')](_0x40f1f8);}else{_0x4876ad+='['+_0x533107[_0x6704('0x69')](_0x40f1f8)+']';}}_0x4876ad+='.';return _0x4876ad;}exports[_0x6704('0x25')]=function(_0x10264d,_0x1b81d6,_0x3e99c6){var _0x748a0=_0x10264d[_0x6704('0x4f')];_0x748a0[_0x6704('0x5a')]=_0x6704('0x6a')+_0x748a0[_0x6704('0x62')]+'-';return db[_0x6704('0x4d')][_0x6704('0x4e')](function(_0x21af13){return db[_0x6704('0x2d')]['update'](_0x748a0,{'where':{'id':_0x748a0['id']},'transaction':_0x21af13})[_0x6704('0x26')](function(){return db[_0x6704('0x50')][_0x6704('0x27')]({'where':{'VoicePrefixId':_0x748a0['id']},'transaction':_0x21af13})[_0x6704('0x26')](function(){return db['VoiceExtension']['find']({'where':{'id':_0x748a0[_0x6704('0x51')]},'raw':!![]})['then'](function(_0x49dbca){return createVoicePrefixExtensions(_0x748a0,_0x49dbca,_0x21af13);});});});})[_0x6704('0x26')](function(){return db['VoicePrefix'][_0x6704('0x6b')](_0x748a0['id']);})['then'](respondWithResult(_0x1b81d6,null))[_0x6704('0x49')](handleError(_0x1b81d6,null));};exports['addAgents']=function(_0x9d941b,_0x16acc3,_0x2f0b65){return db['VoicePrefix']['find']({'where':{'id':_0x9d941b[_0x6704('0x47')]['id']}})['then'](handleEntityNotFound(_0x16acc3,null))[_0x6704('0x26')](function(_0x545af4){if(_0x545af4){return _0x545af4[_0x6704('0x6c')](_0x9d941b[_0x6704('0x4f')][_0x6704('0x6d')],_[_0x6704('0x6e')](_0x9d941b[_0x6704('0x4f')],[_0x6704('0x6d'),'id'])||{})[_0x6704('0x6f')](function(_0x2e08dc){for(var _0x5b5ca9=0x0;_0x5b5ca9<_0x9d941b['body'][_0x6704('0x6d')][_0x6704('0x37')];_0x5b5ca9+=0x1){socket[_0x6704('0x70')](_0x6704('0x71'),{'UserId':_0x9d941b[_0x6704('0x4f')]['ids'][_0x5b5ca9],'VoicePrefixId':_0x9d941b[_0x6704('0x47')]['id']});}return _0x2e08dc;});}})[_0x6704('0x26')](respondWithResult(_0x16acc3,null))[_0x6704('0x49')](handleError(_0x16acc3,null));};exports[_0x6704('0x72')]=function(_0x20a5ce,_0x531b92,_0x144b3e){var _0xe72686;return db[_0x6704('0x2d')]['find']({'where':{'id':_0x20a5ce['params']['id']}})[_0x6704('0x26')](handleEntityNotFound(_0x531b92,null))[_0x6704('0x26')](function(_0x2daeee){if(_0x2daeee){return _0x2daeee[_0x6704('0x72')](_0x20a5ce['query']['ids'])['then'](function(_0x24d820){if(_[_0x6704('0x73')](_0x20a5ce['query']['ids'])){for(var _0x86eca0=0x0;_0x86eca0<_0x20a5ce[_0x6704('0x2f')][_0x6704('0x6d')][_0x6704('0x37')];_0x86eca0+=0x1){socket[_0x6704('0x70')]('userVoicePrefix:remove',{'UserId':_0x20a5ce[_0x6704('0x2f')][_0x6704('0x6d')][_0x86eca0],'VoicePrefixId':_0x20a5ce[_0x6704('0x47')]['id']});}}else{socket[_0x6704('0x70')](_0x6704('0x74'),{'UserId':_0x20a5ce[_0x6704('0x2f')][_0x6704('0x6d')],'VoicePrefixId':_0x20a5ce[_0x6704('0x47')]['id']});}});}})[_0x6704('0x26')](respondWithStatusCode(_0x531b92,null))['catch'](handleError(_0x531b92,null));};exports[_0x6704('0x75')]=function(_0x41a5b4,_0x361f12,_0x230511){var _0x2254c5={};var _0x588204={};var _0x370e44;var _0x5208ce;return db[_0x6704('0x2d')][_0x6704('0x76')]({'where':{'id':_0x41a5b4[_0x6704('0x47')]['id']}})[_0x6704('0x26')](handleEntityNotFound(_0x361f12,null))[_0x6704('0x26')](function(_0x2e2961){if(_0x2e2961){_0x370e44=_0x2e2961;_0x588204[_0x6704('0x2e')]=_[_0x6704('0x32')](db['User']['rawAttributes']);_0x588204[_0x6704('0x2f')]=_[_0x6704('0x32')](_0x41a5b4[_0x6704('0x2f')]);_0x588204[_0x6704('0x33')]=_[_0x6704('0x34')](_0x588204[_0x6704('0x2e')],_0x588204['query']);_0x2254c5[_0x6704('0x35')]=_['intersection'](_0x588204[_0x6704('0x2e')],qs[_0x6704('0x36')](_0x41a5b4[_0x6704('0x2f')][_0x6704('0x36')]));_0x2254c5[_0x6704('0x35')]=_0x2254c5[_0x6704('0x35')][_0x6704('0x37')]?_0x2254c5[_0x6704('0x35')]:_0x588204[_0x6704('0x2e')];_0x2254c5['order']=qs[_0x6704('0x3b')](_0x41a5b4[_0x6704('0x2f')][_0x6704('0x3b')]);_0x2254c5['where']=qs[_0x6704('0x33')](_[_0x6704('0x3d')](_0x41a5b4[_0x6704('0x2f')],_0x588204[_0x6704('0x33')]));if(_0x41a5b4['query']['filter']){_0x2254c5[_0x6704('0x3c')]=_['merge'](_0x2254c5[_0x6704('0x3c')],{'$or':_[_0x6704('0x41')](_0x2254c5[_0x6704('0x35')],function(_0x4fb5e2){var _0x35f9d5={};_0x35f9d5[_0x4fb5e2]={'$like':'%'+_0x41a5b4['query'][_0x6704('0x42')]+'%'};return _0x35f9d5;})});}_0x2254c5=_[_0x6704('0x40')]({},_0x2254c5,_0x41a5b4[_0x6704('0x43')]);return _0x370e44['getAgents'](_0x2254c5);}})['then'](function(_0x50c290){if(_0x50c290){_0x5208ce=_0x50c290[_0x6704('0x37')];if(!_0x41a5b4[_0x6704('0x2f')][_0x6704('0x38')]('nolimit')){_0x2254c5[_0x6704('0x3a')]=qs['limit'](_0x41a5b4[_0x6704('0x2f')]['limit']);_0x2254c5[_0x6704('0x1f')]=qs['offset'](_0x41a5b4[_0x6704('0x2f')][_0x6704('0x1f')]);}return _0x370e44['getAgents'](_0x2254c5);}})[_0x6704('0x26')](function(_0x35199b){if(_0x35199b){return _0x35199b?{'count':_0x5208ce,'rows':_0x35199b}:null;}})[_0x6704('0x26')](respondWithResult(_0x361f12,null))['catch'](handleError(_0x361f12,null));}; \ No newline at end of file +var _0x82c4=['../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','Content-Range','reject','save','then','error','stack','name','send','VoicePrefix','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','add','day','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','destroy','describe','create','transaction','body','VoiceExtensionId','context','exten','app','type','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','get','map','bulkCreate','push','CDR(prefix)=','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','system-','sequelize','update','findById','addAgents','ids','omit','spread','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','getAgents','findOne','User','order','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x12e073,_0x4d43db){var _0x267748=function(_0x381284){while(--_0x381284){_0x12e073['push'](_0x12e073['shift']());}};_0x267748(++_0x4d43db);}(_0x82c4,0x1ca));var _0x482c=function(_0x287b93,_0x65d733){_0x287b93=_0x287b93-0x0;var _0x13ca78=_0x82c4[_0x287b93];return _0x13ca78;};'use strict';var pdf=require(_0x482c('0x0'));var emlformat=require(_0x482c('0x1'));var rimraf=require(_0x482c('0x2'));var zipdir=require(_0x482c('0x3'));var jsonpatch=require(_0x482c('0x4'));var rp=require(_0x482c('0x5'));var moment=require(_0x482c('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x482c('0x7'));var util=require('util');var path=require(_0x482c('0x8'));var sox=require('sox');var csv=require(_0x482c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x482c('0xa'));var squel=require(_0x482c('0xb'));var crypto=require(_0x482c('0xc'));var jsforce=require(_0x482c('0xd'));var deskjs=require(_0x482c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x482c('0xf'));var Papa=require(_0x482c('0x10'));var Redis=require(_0x482c('0x11'));var qs=require(_0x482c('0x12'));var logger=require(_0x482c('0x13'))(_0x482c('0x14'));var utils=require('../../config/utils');var config=require(_0x482c('0x15'));var db=require(_0x482c('0x16'))['db'];config[_0x482c('0x17')]=_['defaults'](config[_0x482c('0x17')],{'host':_0x482c('0x18'),'port':0x18eb});var socket=require(_0x482c('0x19'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x482c('0x1a')](socket);function respondWithStatusCode(_0x30e02b,_0x59837f){_0x59837f=_0x59837f||0xcc;return function(_0x56ee17){if(_0x56ee17){return _0x30e02b[_0x482c('0x1b')](_0x59837f);}return _0x30e02b[_0x482c('0x1c')](_0x59837f)[_0x482c('0x1d')]();};}function respondWithResult(_0x3dfbc8,_0x37a4f0){_0x37a4f0=_0x37a4f0||0xc8;return function(_0x119635){if(_0x119635){return _0x3dfbc8[_0x482c('0x1c')](_0x37a4f0)[_0x482c('0x1e')](_0x119635);}};}function respondWithFilteredResult(_0x3fc79c,_0x1758fb){return function(_0x363403){if(_0x363403){var _0xedaee0=_0x363403[_0x482c('0x1f')],_0x4bdf15=_0x1758fb[_0x482c('0x20')],_0x244bb9=_0x1758fb['offset']+_0x1758fb['limit'],_0x5b6f7e;if(_0x244bb9>=_0xedaee0){_0x244bb9=_0xedaee0;_0x5b6f7e=0xc8;}else{_0x5b6f7e=0xce;}_0x3fc79c[_0x482c('0x1c')](_0x5b6f7e);return _0x3fc79c['set'](_0x482c('0x21'),_0x4bdf15+'-'+_0x244bb9+'/'+_0xedaee0)[_0x482c('0x1e')](_0x363403);}return null;};}function patchUpdates(_0x281c60){return function(_0x3f97ae){try{jsonpatch['apply'](_0x3f97ae,_0x281c60,!![]);}catch(_0x1c9a7b){return BPromise[_0x482c('0x22')](_0x1c9a7b);}return _0x3f97ae[_0x482c('0x23')]();};}function saveUpdates(_0xd18658,_0x14d832){return function(_0x58ed18){if(_0x58ed18){return _0x58ed18['update'](_0xd18658)[_0x482c('0x24')](function(_0x147d05){return _0x147d05;});}return null;};}function removeEntity(_0x180feb,_0x5c4e9c){return function(_0x3d5490){if(_0x3d5490){return _0x3d5490['destroy']()[_0x482c('0x24')](function(){_0x180feb[_0x482c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x466583,_0x5436e2){return function(_0x589bc6){if(!_0x589bc6){_0x466583[_0x482c('0x1b')](0x194);}return _0x589bc6;};}function handleError(_0x27f1b5,_0x36b25c){_0x36b25c=_0x36b25c||0x1f4;return function(_0x1f4501){logger[_0x482c('0x25')](_0x1f4501[_0x482c('0x26')]);if(_0x1f4501[_0x482c('0x27')]){delete _0x1f4501['name'];}_0x27f1b5[_0x482c('0x1c')](_0x36b25c)[_0x482c('0x28')](_0x1f4501);};}exports['index']=function(_0xb01bc3,_0x52b6fc){var _0x54782d={},_0x207441={},_0x5af04c={'count':0x0,'rows':[]};var _0x1ac1c4=db[_0x482c('0x29')][_0x482c('0x2a')];_0x207441[_0x482c('0x2b')]=_[_0x482c('0x2c')](_0x1ac1c4);var _0x11950f={'dateStart':_0xb01bc3[_0x482c('0x2d')][_0x482c('0x2e')],'dateEnd':_0xb01bc3[_0x482c('0x2d')][_0x482c('0x2f')]};delete _0xb01bc3[_0x482c('0x2d')][_0x482c('0x2e')];delete _0xb01bc3[_0x482c('0x2d')][_0x482c('0x2f')];_0x207441[_0x482c('0x2d')]=_[_0x482c('0x2c')](_0xb01bc3[_0x482c('0x2d')]);_0x207441[_0x482c('0x30')]=_['intersection'](_0x207441['model'],_0x207441['query']);_0x54782d[_0x482c('0x31')]=_[_0x482c('0x32')](_0x207441[_0x482c('0x2b')],qs[_0x482c('0x33')](_0xb01bc3['query'][_0x482c('0x33')]));_0x54782d['attributes']=_0x54782d[_0x482c('0x31')][_0x482c('0x34')]?_0x54782d[_0x482c('0x31')]:_0x207441[_0x482c('0x2b')];if(!_0xb01bc3[_0x482c('0x2d')][_0x482c('0x35')](_0x482c('0x36'))){_0x54782d[_0x482c('0x37')]=qs['limit'](_0xb01bc3['query'][_0x482c('0x37')]);_0x54782d['offset']=qs[_0x482c('0x20')](_0xb01bc3[_0x482c('0x2d')][_0x482c('0x20')]);}_0x54782d['order']=qs[_0x482c('0x38')](_0xb01bc3[_0x482c('0x2d')][_0x482c('0x38')]);_0x54782d[_0x482c('0x39')]=qs['filters'](_[_0x482c('0x3a')](_0xb01bc3['query'],_0x207441[_0x482c('0x30')]));if(_0x11950f['dateStart']){if(_0x11950f[_0x482c('0x2f')]){_0x11950f['dateEnd']=moment(_0x11950f[_0x482c('0x2f')])[_0x482c('0x3b')](0x1,'day');}else{_0x11950f[_0x482c('0x2f')]=moment(_0x11950f['dateStart'])['add'](0x1,_0x482c('0x3c'));}_['merge'](_0x54782d['where'],{'createdAt':{'$gte':_0x11950f['dateStart'],'$lte':_0x11950f['dateEnd']}});}if(_0xb01bc3[_0x482c('0x2d')][_0x482c('0x3d')]){_0x54782d[_0x482c('0x39')]=_[_0x482c('0x3e')](_0x54782d[_0x482c('0x39')],{'$or':_['map'](_0x54782d[_0x482c('0x31')],function(_0x43b8c8){var _0x45c8c2={};_0x45c8c2[_0x43b8c8]={'$like':'%'+_0xb01bc3[_0x482c('0x2d')]['filter']+'%'};return _0x45c8c2;})});}_0x54782d=_['merge']({},_0x54782d,_0xb01bc3[_0x482c('0x3f')]);var _0x44bedf={'where':_0x54782d[_0x482c('0x39')]};return db[_0x482c('0x29')][_0x482c('0x1f')](_0x44bedf)[_0x482c('0x24')](function(_0x1a7257){_0x5af04c[_0x482c('0x1f')]=_0x1a7257;if(_0xb01bc3[_0x482c('0x2d')][_0x482c('0x40')]){_0x54782d[_0x482c('0x41')]=[{'all':!![]}];}return db['VoicePrefix'][_0x482c('0x42')](_0x54782d);})[_0x482c('0x24')](function(_0x393ca2){_0x5af04c[_0x482c('0x43')]=_0x393ca2;return _0x5af04c;})[_0x482c('0x24')](respondWithFilteredResult(_0x52b6fc,_0x54782d))[_0x482c('0x44')](handleError(_0x52b6fc,null));};exports[_0x482c('0x45')]=function(_0x4bea94,_0x48dcd9){var _0x2769e6={'raw':![],'where':{'id':_0x4bea94[_0x482c('0x46')]['id']}},_0x18f76a={};_0x18f76a['model']=_[_0x482c('0x2c')](db['VoicePrefix'][_0x482c('0x2a')]);_0x18f76a[_0x482c('0x2d')]=_[_0x482c('0x2c')](_0x4bea94[_0x482c('0x2d')]);_0x18f76a['filters']=_[_0x482c('0x32')](_0x18f76a[_0x482c('0x2b')],_0x18f76a[_0x482c('0x2d')]);_0x2769e6['attributes']=_[_0x482c('0x32')](_0x18f76a[_0x482c('0x2b')],qs[_0x482c('0x33')](_0x4bea94['query']['fields']));_0x2769e6['attributes']=_0x2769e6['attributes']['length']?_0x2769e6['attributes']:_0x18f76a[_0x482c('0x2b')];if(_0x4bea94['query'][_0x482c('0x40')]){_0x2769e6[_0x482c('0x41')]=[{'all':!![]}];}_0x2769e6=_[_0x482c('0x3e')]({},_0x2769e6,_0x4bea94[_0x482c('0x3f')]);return db[_0x482c('0x29')][_0x482c('0x47')](_0x2769e6)[_0x482c('0x24')](handleEntityNotFound(_0x48dcd9,null))[_0x482c('0x24')](respondWithResult(_0x48dcd9,null))[_0x482c('0x44')](handleError(_0x48dcd9,null));};exports[_0x482c('0x48')]=function(_0x3a8ee6,_0x3f7ff7){return db[_0x482c('0x29')][_0x482c('0x47')]({'where':{'id':_0x3a8ee6[_0x482c('0x46')]['id']}})[_0x482c('0x24')](handleEntityNotFound(_0x3f7ff7,null))[_0x482c('0x24')](removeEntity(_0x3f7ff7,null))[_0x482c('0x44')](handleError(_0x3f7ff7,null));};exports[_0x482c('0x49')]=function(_0x495aaa,_0x107b1b){return db[_0x482c('0x29')]['describe']()[_0x482c('0x24')](respondWithResult(_0x107b1b,null))[_0x482c('0x44')](handleError(_0x107b1b,null));};exports[_0x482c('0x4a')]=function(_0x170310,_0x3d08a7){var _0x500e3a;return db['sequelize'][_0x482c('0x4b')](function(_0x199054){return db[_0x482c('0x29')][_0x482c('0x4a')](_0x170310[_0x482c('0x4c')],{'transaction':_0x199054})[_0x482c('0x24')](function(_0x348db6){_0x500e3a=_0x348db6['get']({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x500e3a[_0x482c('0x4d')]},'raw':!![]})[_0x482c('0x24')](function(_0x3e5bfe){return createVoicePrefixExtensions(_0x500e3a,_0x3e5bfe,_0x199054);});});})[_0x482c('0x24')](function(){return _0x500e3a;})[_0x482c('0x24')](respondWithResult(_0x3d08a7,null))[_0x482c('0x44')](handleError(_0x3d08a7,null));};function Extension(_0xf4e7a3,_0x43fa40,_0x409729,_0x2d6657){this[_0x482c('0x4e')]='from-sip';this[_0x482c('0x4f')]=_0xf4e7a3;this[_0x482c('0x50')]=_0x409729;this[_0x482c('0x51')]=_0x482c('0x52');this[_0x482c('0x53')]=_0x482c('0x54');this[_0x482c('0x55')]=_0x43fa40;this[_0x482c('0x56')]=_0x2d6657;}function createVoicePrefixExtensions(_0x369e91,_0x3f3db6,_0x3981cf){return new BPromise(function(_0x1ff536,_0x5422f9){var _0x5f579a=new Extension(formatPrefixName(_0x369e91[_0x482c('0x57')]),0x1,_0x482c('0x58'),_0x482c('0x59'));_0x5f579a[_0x482c('0x5a')]=_0x369e91['id'];return db[_0x482c('0x5b')][_0x482c('0x4a')](_0x5f579a,{'transaction':_0x3981cf})['then'](function(_0x231353){var _0x732d17=_0x231353[_0x482c('0x5c')]({'plain':!![]});var _0x1f44f0=_[_0x482c('0x5d')](addVoicePrefixExtensions(_0x369e91,_0x3f3db6),function(_0x4fcc6a){_0x4fcc6a[_0x482c('0x4d')]=_0x732d17['id'];_0x4fcc6a[_0x482c('0x5a')]=_0x369e91['id'];return _0x4fcc6a;});return db[_0x482c('0x5b')][_0x482c('0x5e')](_0x1f44f0,{'transaction':_0x3981cf})[_0x482c('0x24')](function(_0x2ccb62){if(!_0x2ccb62){return _0x5422f9('Extensions\x20creation\x20failed');}else{return _0x1ff536(_0x2ccb62);}})[_0x482c('0x44')](function(_0x4e83b3){return _0x5422f9(_0x4e83b3);});});;});};function addVoicePrefixExtensions(_0x6efdda,_0x1bb8d1){var _0x3a7b29=[];var _0x1a9c83=formatPrefixName(_0x6efdda[_0x482c('0x57')]);_0x3a7b29[_0x482c('0x5f')](new Extension(_0x1a9c83,0x2,'Set',_0x482c('0x60')+_0x6efdda[_0x482c('0x27')]));if(_0x6efdda['callerIdAll']){_0x3a7b29['push'](new Extension(_0x1a9c83,0x3,_0x482c('0x61'),_0x482c('0x62')+_0x6efdda['callerIdAll']));}else{_0x3a7b29[_0x482c('0x5f')](new Extension(_0x1a9c83,0x3,_0x482c('0x58'),_0x482c('0x63')));}_0x3a7b29[_0x482c('0x5f')](new Extension(_0x1a9c83,0x4,'goto',_0x1bb8d1[_0x482c('0x4e')]+','+_0x482c('0x64')+(0x8+_0x6efdda[_0x482c('0x27')][_0x482c('0x34')])+'}'+','+0x1));return _0x3a7b29;}function formatPrefixName(_0x3a37f5){var _0x2fc65f='_';for(var _0x574068=0x0;_0x574068<_0x3a37f5['length'];_0x574068++){if(_0x3a37f5[_0x482c('0x65')](_0x574068)=='-'){_0x2fc65f+=_0x3a37f5[_0x482c('0x65')](_0x574068);}else{_0x2fc65f+='['+_0x3a37f5[_0x482c('0x65')](_0x574068)+']';}}_0x2fc65f+='.';return _0x2fc65f;}exports['update']=function(_0x23349f,_0x2b7551,_0x48724c){var _0x3b7951=_0x23349f[_0x482c('0x4c')];_0x3b7951[_0x482c('0x57')]=_0x482c('0x66')+_0x3b7951[_0x482c('0x27')]+'-';return db[_0x482c('0x67')]['transaction'](function(_0x4794c2){return db[_0x482c('0x29')][_0x482c('0x68')](_0x3b7951,{'where':{'id':_0x3b7951['id']},'transaction':_0x4794c2})['then'](function(){return db['VoiceExtension'][_0x482c('0x48')]({'where':{'VoicePrefixId':_0x3b7951['id']},'transaction':_0x4794c2})[_0x482c('0x24')](function(){return db[_0x482c('0x5b')]['find']({'where':{'id':_0x3b7951['VoiceExtensionId']},'raw':!![]})['then'](function(_0x64f27e){return createVoicePrefixExtensions(_0x3b7951,_0x64f27e,_0x4794c2);});});});})[_0x482c('0x24')](function(){return db[_0x482c('0x29')][_0x482c('0x69')](_0x3b7951['id']);})[_0x482c('0x24')](respondWithResult(_0x2b7551,null))[_0x482c('0x44')](handleError(_0x2b7551,null));};exports['addAgents']=function(_0x5e5e76,_0x2ec137,_0x1d878f){return db[_0x482c('0x29')][_0x482c('0x47')]({'where':{'id':_0x5e5e76[_0x482c('0x46')]['id']}})[_0x482c('0x24')](handleEntityNotFound(_0x2ec137,null))[_0x482c('0x24')](function(_0x445edb){if(_0x445edb){return _0x445edb[_0x482c('0x6a')](_0x5e5e76[_0x482c('0x4c')][_0x482c('0x6b')],_[_0x482c('0x6c')](_0x5e5e76['body'],[_0x482c('0x6b'),'id'])||{})[_0x482c('0x6d')](function(_0x2d5ca0){for(var _0x58ff47=0x0;_0x58ff47<_0x5e5e76[_0x482c('0x4c')][_0x482c('0x6b')][_0x482c('0x34')];_0x58ff47+=0x1){socket['emit'](_0x482c('0x6e'),{'UserId':_0x5e5e76['body']['ids'][_0x58ff47],'VoicePrefixId':_0x5e5e76[_0x482c('0x46')]['id']});}return _0x2d5ca0;});}})[_0x482c('0x24')](respondWithResult(_0x2ec137,null))[_0x482c('0x44')](handleError(_0x2ec137,null));};exports[_0x482c('0x6f')]=function(_0xcc3fe7,_0x30dc86,_0x3b293f){var _0x58f479;return db[_0x482c('0x29')][_0x482c('0x47')]({'where':{'id':_0xcc3fe7['params']['id']}})[_0x482c('0x24')](handleEntityNotFound(_0x30dc86,null))['then'](function(_0x5a45c2){if(_0x5a45c2){return _0x5a45c2['removeAgents'](_0xcc3fe7[_0x482c('0x2d')]['ids'])['then'](function(_0xc7bebc){if(_[_0x482c('0x70')](_0xcc3fe7['query'][_0x482c('0x6b')])){for(var _0x51de5a=0x0;_0x51de5a<_0xcc3fe7['query']['ids'][_0x482c('0x34')];_0x51de5a+=0x1){socket[_0x482c('0x71')]('userVoicePrefix:remove',{'UserId':_0xcc3fe7['query']['ids'][_0x51de5a],'VoicePrefixId':_0xcc3fe7[_0x482c('0x46')]['id']});}}else{socket[_0x482c('0x71')](_0x482c('0x72'),{'UserId':_0xcc3fe7['query']['ids'],'VoicePrefixId':_0xcc3fe7[_0x482c('0x46')]['id']});}});}})['then'](respondWithStatusCode(_0x30dc86,null))[_0x482c('0x44')](handleError(_0x30dc86,null));};exports[_0x482c('0x73')]=function(_0x4cb228,_0x426e4a,_0x5b804f){var _0x48b9c2={};var _0x2c0056={};var _0x4d6926;var _0x9c9732;return db['VoicePrefix'][_0x482c('0x74')]({'where':{'id':_0x4cb228['params']['id']}})[_0x482c('0x24')](handleEntityNotFound(_0x426e4a,null))[_0x482c('0x24')](function(_0x7d0261){if(_0x7d0261){_0x4d6926=_0x7d0261;_0x2c0056['model']=_[_0x482c('0x2c')](db[_0x482c('0x75')][_0x482c('0x2a')]);_0x2c0056['query']=_[_0x482c('0x2c')](_0x4cb228[_0x482c('0x2d')]);_0x2c0056[_0x482c('0x30')]=_[_0x482c('0x32')](_0x2c0056[_0x482c('0x2b')],_0x2c0056[_0x482c('0x2d')]);_0x48b9c2[_0x482c('0x31')]=_['intersection'](_0x2c0056[_0x482c('0x2b')],qs[_0x482c('0x33')](_0x4cb228[_0x482c('0x2d')]['fields']));_0x48b9c2['attributes']=_0x48b9c2['attributes'][_0x482c('0x34')]?_0x48b9c2['attributes']:_0x2c0056['model'];_0x48b9c2[_0x482c('0x76')]=qs['sort'](_0x4cb228[_0x482c('0x2d')][_0x482c('0x38')]);_0x48b9c2[_0x482c('0x39')]=qs[_0x482c('0x30')](_['pick'](_0x4cb228[_0x482c('0x2d')],_0x2c0056['filters']));if(_0x4cb228[_0x482c('0x2d')][_0x482c('0x3d')]){_0x48b9c2[_0x482c('0x39')]=_['merge'](_0x48b9c2['where'],{'$or':_[_0x482c('0x5d')](_0x48b9c2[_0x482c('0x31')],function(_0x5e1d81){var _0x4335d7={};_0x4335d7[_0x5e1d81]={'$like':'%'+_0x4cb228['query'][_0x482c('0x3d')]+'%'};return _0x4335d7;})});}_0x48b9c2=_[_0x482c('0x3e')]({},_0x48b9c2,_0x4cb228[_0x482c('0x3f')]);return _0x4d6926['getAgents'](_0x48b9c2);}})[_0x482c('0x24')](function(_0x3b8170){if(_0x3b8170){_0x9c9732=_0x3b8170[_0x482c('0x34')];if(!_0x4cb228['query'][_0x482c('0x35')](_0x482c('0x36'))){_0x48b9c2[_0x482c('0x37')]=qs['limit'](_0x4cb228['query'][_0x482c('0x37')]);_0x48b9c2[_0x482c('0x20')]=qs[_0x482c('0x20')](_0x4cb228['query'][_0x482c('0x20')]);}return _0x4d6926[_0x482c('0x73')](_0x48b9c2);}})['then'](function(_0x3cc57d){if(_0x3cc57d){return _0x3cc57d?{'count':_0x9c9732,'rows':_0x3cc57d}:null;}})['then'](respondWithResult(_0x426e4a,null))[_0x482c('0x44')](handleError(_0x426e4a,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index dad215d..e11cf43 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 _0x2123=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove'];(function(_0x4d26ff,_0x3d5291){var _0x19df45=function(_0x1e1fc7){while(--_0x1e1fc7){_0x4d26ff['push'](_0x4d26ff['shift']());}};_0x19df45(++_0x3d5291);}(_0x2123,0x190));var _0x3212=function(_0x394045,_0x44d08d){_0x394045=_0x394045-0x0;var _0x5f7aeb=_0x2123[_0x394045];return _0x5f7aeb;};'use strict';var EventEmitter=require(_0x3212('0x0'));var VoicePrefix=require(_0x3212('0x1'))['db'][_0x3212('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x3212('0x3')](0x0);var events={'afterCreate':_0x3212('0x4'),'afterUpdate':_0x3212('0x5'),'afterDestroy':_0x3212('0x6')};function emitEvent(_0x2e951f){return function(_0x304f80,_0x6ca653,_0x37058e){VoicePrefixEvents[_0x3212('0x7')](_0x2e951f+':'+_0x304f80['id'],_0x304f80);VoicePrefixEvents['emit'](_0x2e951f,_0x304f80);_0x37058e(null);};}for(var e in events){if(events[_0x3212('0x8')](e)){var event=events[e];VoicePrefix[_0x3212('0x9')](e,emitEvent(event));}}module[_0x3212('0xa')]=VoicePrefixEvents; \ No newline at end of file +var _0x4c4e=['remove','emit','hasOwnProperty','hook','exports','events','VoicePrefix','setMaxListeners','save'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x4c4e,0x152));var _0xe4c4=function(_0x2f2678,_0x238a71){_0x2f2678=_0x2f2678-0x0;var _0x56d243=_0x4c4e[_0x2f2678];return _0x56d243;};'use strict';var EventEmitter=require(_0xe4c4('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0xe4c4('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xe4c4('0x2')](0x0);var events={'afterCreate':_0xe4c4('0x3'),'afterUpdate':'update','afterDestroy':_0xe4c4('0x4')};function emitEvent(_0x7d7655){return function(_0x1a4483,_0x4cd652,_0x2d3bb7){VoicePrefixEvents['emit'](_0x7d7655+':'+_0x1a4483['id'],_0x1a4483);VoicePrefixEvents[_0xe4c4('0x5')](_0x7d7655,_0x1a4483);_0x2d3bb7(null);};}for(var e in events){if(events[_0xe4c4('0x6')](e)){var event=events[e];VoicePrefix[_0xe4c4('0x7')](e,emitEvent(event));}}module[_0xe4c4('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 a36ba3c..376b41a 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 _0xb4e6=['lodash','util','../../config/logger','api','moment','bluebird','./voicePrefix.attributes','define','VoicePrefix'];(function(_0x37f6e5,_0x34df0e){var _0x187842=function(_0x5770bf){while(--_0x5770bf){_0x37f6e5['push'](_0x37f6e5['shift']());}};_0x187842(++_0x34df0e);}(_0xb4e6,0xd8));var _0x6b4e=function(_0x425716,_0x3e9d1c){_0x425716=_0x425716-0x0;var _0x2d39af=_0xb4e6[_0x425716];return _0x2d39af;};'use strict';var _=require(_0x6b4e('0x0'));var util=require(_0x6b4e('0x1'));var logger=require(_0x6b4e('0x2'))(_0x6b4e('0x3'));var moment=require(_0x6b4e('0x4'));var BPromise=require(_0x6b4e('0x5'));var rp=require('request-promise');var attributes=require(_0x6b4e('0x6'));module['exports']=function(_0x1f75ee,_0x154d36){return _0x1f75ee[_0x6b4e('0x7')](_0x6b4e('0x8'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c7b=['lodash','../../config/logger','moment','bluebird','./voicePrefix.attributes','define','VoicePrefix','voice_prefixes'];(function(_0x392c6e,_0x31d6a0){var _0x3ad125=function(_0x427689){while(--_0x427689){_0x392c6e['push'](_0x392c6e['shift']());}};_0x3ad125(++_0x31d6a0);}(_0x4c7b,0x128));var _0xb4c7=function(_0x6f392e,_0x49933d){_0x6f392e=_0x6f392e-0x0;var _0x3b7514=_0x4c7b[_0x6f392e];return _0x3b7514;};'use strict';var _=require(_0xb4c7('0x0'));var util=require('util');var logger=require(_0xb4c7('0x1'))('api');var moment=require(_0xb4c7('0x2'));var BPromise=require(_0xb4c7('0x3'));var rp=require('request-promise');var attributes=require(_0xb4c7('0x4'));module['exports']=function(_0x319e4d,_0x4123ac){return _0x319e4d[_0xb4c7('0x5')](_0xb4c7('0x6'),attributes,{'tableName':_0xb4c7('0x7'),'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 ec8c338..a374878 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 _0x8059=['VoicePrefix,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./voicePrefix.socket','request','info','request\x20sent','debug','stringify','error','code'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8059,0xdb));var _0x9805=function(_0x2652ef,_0x234230){_0x2652ef=_0x2652ef-0x0;var _0x2db578=_0x8059[_0x2652ef];return _0x2db578;};'use strict';var _=require(_0x9805('0x0'));var util=require(_0x9805('0x1'));var moment=require(_0x9805('0x2'));var BPromise=require(_0x9805('0x3'));var rs=require(_0x9805('0x4'));var fs=require('fs');var Redis=require(_0x9805('0x5'));var db=require(_0x9805('0x6'))['db'];var utils=require(_0x9805('0x7'));var logger=require(_0x9805('0x8'))(_0x9805('0x9'));var config=require(_0x9805('0xa'));var jayson=require(_0x9805('0xb'));var client=jayson[_0x9805('0xc')]['http']({'port':0x232a});config[_0x9805('0xd')]=_[_0x9805('0xe')](config[_0x9805('0xd')],{'host':_0x9805('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9805('0x10'))['register'](socket);function respondWithRpcPromise(_0xfa71de,_0x4724bc,_0x403331){return new BPromise(function(_0x43719f,_0x8463be){return client[_0x9805('0x11')](_0xfa71de,_0x403331)['then'](function(_0x5e00a8){logger[_0x9805('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x4724bc,_0x9805('0x13'));logger[_0x9805('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x4724bc,_0x9805('0x13'),JSON[_0x9805('0x15')](_0x5e00a8));if(_0x5e00a8['error']){if(_0x5e00a8[_0x9805('0x16')][_0x9805('0x17')]===0x1f4){logger['error'](_0x9805('0x18'),_0x4724bc,_0x5e00a8[_0x9805('0x16')][_0x9805('0x19')]);return _0x8463be(_0x5e00a8[_0x9805('0x16')]['message']);}logger[_0x9805('0x16')](_0x9805('0x18'),_0x4724bc,_0x5e00a8[_0x9805('0x16')][_0x9805('0x19')]);return _0x43719f(_0x5e00a8[_0x9805('0x16')]['message']);}else{logger[_0x9805('0x12')](_0x9805('0x18'),_0x4724bc,_0x9805('0x13'));_0x43719f(_0x5e00a8[_0x9805('0x1a')]['message']);}})['catch'](function(_0x49f272){logger['error'](_0x9805('0x18'),_0x4724bc,_0x49f272);_0x8463be(_0x49f272);});});} \ No newline at end of file +var _0x9c9e=['error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x46974e,_0x23284d){var _0xd28476=function(_0x4c3d01){while(--_0x4c3d01){_0x46974e['push'](_0x46974e['shift']());}};_0xd28476(++_0x23284d);}(_0x9c9e,0x153));var _0xe9c9=function(_0x56ff49,_0x1d1e19){_0x56ff49=_0x56ff49-0x0;var _0x5dddd1=_0x9c9e[_0x56ff49];return _0x5dddd1;};'use strict';var _=require(_0xe9c9('0x0'));var util=require(_0xe9c9('0x1'));var moment=require(_0xe9c9('0x2'));var BPromise=require('bluebird');var rs=require(_0xe9c9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe9c9('0x4'))['db'];var utils=require(_0xe9c9('0x5'));var logger=require(_0xe9c9('0x6'))(_0xe9c9('0x7'));var config=require(_0xe9c9('0x8'));var jayson=require(_0xe9c9('0x9'));var client=jayson[_0xe9c9('0xa')][_0xe9c9('0xb')]({'port':0x232a});config[_0xe9c9('0xc')]=_[_0xe9c9('0xd')](config[_0xe9c9('0xc')],{'host':_0xe9c9('0xe'),'port':0x18eb});var socket=require(_0xe9c9('0xf'))(new Redis(config['redis']));require(_0xe9c9('0x10'))[_0xe9c9('0x11')](socket);function respondWithRpcPromise(_0xa8a864,_0x7113b5,_0x231d92){return new BPromise(function(_0x5e6d0d,_0x220120){return client[_0xe9c9('0x12')](_0xa8a864,_0x231d92)[_0xe9c9('0x13')](function(_0x226764){logger[_0xe9c9('0x14')](_0xe9c9('0x15'),_0x7113b5,'request\x20sent');logger[_0xe9c9('0x16')](_0xe9c9('0x17'),_0x7113b5,'request\x20sent',JSON[_0xe9c9('0x18')](_0x226764));if(_0x226764['error']){if(_0x226764['error']['code']===0x1f4){logger[_0xe9c9('0x19')](_0xe9c9('0x15'),_0x7113b5,_0x226764['error'][_0xe9c9('0x1a')]);return _0x220120(_0x226764[_0xe9c9('0x19')][_0xe9c9('0x1a')]);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x7113b5,_0x226764[_0xe9c9('0x19')][_0xe9c9('0x1a')]);return _0x5e6d0d(_0x226764[_0xe9c9('0x19')]['message']);}else{logger[_0xe9c9('0x14')](_0xe9c9('0x15'),_0x7113b5,'request\x20sent');_0x5e6d0d(_0x226764['result'][_0xe9c9('0x1a')]);}})[_0xe9c9('0x1b')](function(_0x18c698){logger[_0xe9c9('0x19')](_0xe9c9('0x15'),_0x7113b5,_0x18c698);_0x220120(_0x18c698);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 7e83001..300d665 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 _0xbeac=['voicePrefix:','./voicePrefix.events','save','remove','emit','removeListener','register','length'];(function(_0x22672b,_0x3dea8d){var _0x30fd53=function(_0x396810){while(--_0x396810){_0x22672b['push'](_0x22672b['shift']());}};_0x30fd53(++_0x3dea8d);}(_0xbeac,0x191));var _0xcbea=function(_0x5d031a,_0x20b287){_0x5d031a=_0x5d031a-0x0;var _0x2720a4=_0xbeac[_0x5d031a];return _0x2720a4;};'use strict';var VoicePrefixEvents=require(_0xcbea('0x0'));var events=[_0xcbea('0x1'),_0xcbea('0x2'),'update'];function createListener(_0x40bd35,_0x3c127e){return function(_0xddcd4c){_0x3c127e[_0xcbea('0x3')](_0x40bd35,_0xddcd4c);};}function removeListener(_0x4f0eb8,_0x39b9f7){return function(){VoicePrefixEvents[_0xcbea('0x4')](_0x4f0eb8,_0x39b9f7);};}exports[_0xcbea('0x5')]=function(_0x2c2b2b){for(var _0x2a0d38=0x0,_0x248f78=events[_0xcbea('0x6')];_0x2a0d38<_0x248f78;_0x2a0d38++){var _0x43c77b=events[_0x2a0d38];var _0x5ba439=createListener(_0xcbea('0x7')+_0x43c77b,_0x2c2b2b);VoicePrefixEvents['on'](_0x43c77b,_0x5ba439);}}; \ No newline at end of file +var _0x3bf5=['removeListener','./voicePrefix.events','remove','update'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x3bf5,0xd5));var _0x53bf=function(_0xabbd2f,_0x44d05a){_0xabbd2f=_0xabbd2f-0x0;var _0x34a040=_0x3bf5[_0xabbd2f];return _0x34a040;};'use strict';var VoicePrefixEvents=require(_0x53bf('0x0'));var events=['save',_0x53bf('0x1'),_0x53bf('0x2')];function createListener(_0x44932c,_0x2574b3){return function(_0x508c95){_0x2574b3['emit'](_0x44932c,_0x508c95);};}function removeListener(_0x38d6b4,_0x493d18){return function(){VoicePrefixEvents[_0x53bf('0x3')](_0x38d6b4,_0x493d18);};}exports['register']=function(_0x3ea770){for(var _0x2f8106=0x0,_0x52a78c=events['length'];_0x2f8106<_0x52a78c;_0x2f8106++){var _0x1b3b09=events[_0x2f8106];var _0x5b1f0b=createListener('voicePrefix:'+_0x1b3b09,_0x3ea770);VoicePrefixEvents['on'](_0x1b3b09,_0x5b1f0b);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index a7a952a..3a9a86b 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 _0xa9e0=['removeTeams','removeBlackLists','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','/:id','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','addTeams','addAgents','addBlackLists','put','update','delete','destroy'];(function(_0x40dc42,_0x112d1f){var _0x59f454=function(_0x17e566){while(--_0x17e566){_0x40dc42['push'](_0x40dc42['shift']());}};_0x59f454(++_0x112d1f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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['getHoppers']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),auth['isAuthenticated'](),controller['getHopperFinals']);router['get']('/:id/hopper_black',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('0x7')](_0x0a9e('0x13'),auth[_0x0a9e('0x8')](),controller['getMembers']);router[_0x0a9e('0x7')]('/:id/lists',auth[_0x0a9e('0x8')](),controller['getLists']);router[_0x0a9e('0x7')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x16')]);router[_0x0a9e('0x17')](_0x0a9e('0x18'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x17')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x17')](_0x0a9e('0x11'),auth['isAuthenticated'](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x17')]('/:id/lists',auth[_0x0a9e('0x8')](),controller['addLists']);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x1d')]('/:id',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1e')]);router[_0x0a9e('0x1f')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x1f')]('/:id/teams',auth['isAuthenticated'](),controller[_0x0a9e('0x21')]);router[_0x0a9e('0x1f')](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller['removeAgents']);router[_0x0a9e('0x1f')]('/:id/lists',auth[_0x0a9e('0x8')](),controller['removeLists']);router[_0x0a9e('0x1f')](_0x0a9e('0x14'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x22')]);module[_0x0a9e('0x23')]=router; \ No newline at end of file +var _0xb10b=['/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','getAgents','/:id/members','getMembers','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addTeams','/:id/users','addBlackLists','put','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated'];(function(_0x2fd7dc,_0x241c6e){var _0x50ff25=function(_0x525dc9){while(--_0x525dc9){_0x2fd7dc['push'](_0x2fd7dc['shift']());}};_0x50ff25(++_0x241c6e);}(_0xb10b,0x12a));var _0xbb10=function(_0x38a660,_0x3a6593){_0x38a660=_0x38a660-0x0;var _0x5a601c=_0xb10b[_0x38a660];return _0x5a601c;};'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['getHopperHistories']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x8')](_0xbb10('0x13'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x8')]('/:id/users',auth[_0xbb10('0x9')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x8')](_0xbb10('0x16'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x8')](_0xbb10('0x18'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x19')]);router['get'](_0xbb10('0x1a'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x1c')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x1d')]);router[_0xbb10('0x1c')](_0xbb10('0x1e'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1f')]);router['post'](_0xbb10('0x13'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1c')](_0xbb10('0x21'),auth[_0xbb10('0x9')](),controller['addAgents']);router[_0xbb10('0x1c')](_0xbb10('0x18'),auth['isAuthenticated'](),controller['addLists']);router[_0xbb10('0x1c')](_0xbb10('0x1a'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x22')]);router[_0xbb10('0x23')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x26')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x21'),auth['isAuthenticated'](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x29')]);router[_0xbb10('0x25')](_0xbb10('0x1a'),auth['isAuthenticated'](),controller[_0xbb10('0x2a')]);module[_0xbb10('0x2b')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index e12beed..bba33e6 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 _0x7a54=['booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','sequelize','exports','STRING','ENUM','inbound','default','leastrecent','random','rrmemory','wrandom','setDataValue','strategy','getDataValue','dialMethod'];(function(_0x1ab180,_0x382b2c){var _0xfb2c2d=function(_0x1c5fd3){while(--_0x1c5fd3){_0x1ab180['push'](_0x1ab180['shift']());}};_0xfb2c2d(++_0x382b2c);}(_0x7a54,0x106));var _0x47a5=function(_0x44a194,_0x23feaa){_0x44a194=_0x44a194-0x0;var _0x28d289=_0x7a54[_0x44a194];return _0x28d289;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'name':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x47a5('0x3')](_0x47a5('0x4'),'outbound'),'allowNull':![],'defaultValue':_0x47a5('0x4')},'musiconhold':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':_0x47a5('0x5')},'announce':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x47a5('0x3')]('rr','ringall',_0x47a5('0x6'),'fewestcalls',_0x47a5('0x7'),_0x47a5('0x8'),'linear',_0x47a5('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x582352){this[_0x47a5('0xa')](_0x47a5('0xb'),_0x582352?_0x582352:'rrmemory');},'get':function(){var _0x2eb0dd=this['getDataValue']('type');var _0x1f47f4=this[_0x47a5('0xc')](_0x47a5('0xd'));var _0x250fad=this[_0x47a5('0xc')](_0x47a5('0xb'));if(_0x2eb0dd===_0x47a5('0x4')){return _0x250fad;}if(_0x1f47f4==='booked'&&_0x250fad===_0x47a5('0x8')||_0x1f47f4===_0x47a5('0xe')&&_0x250fad===_0x47a5('0xf')){return _0x250fad;}if(_0x1f47f4===_0x47a5('0x10')||_0x1f47f4===_0x47a5('0x11')||_0x1f47f4===_0x47a5('0x12')){return _0x250fad;}return null;}},'servicelevel':{'type':Sequelize[_0x47a5('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x47a5('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x47a5('0x13')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x47a5('0x2')]},'weight':{'type':Sequelize[_0x47a5('0x13')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x47a5('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x47a5('0x14')},'autopause':{'type':Sequelize['ENUM']('yes','no',_0x47a5('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x47a5('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x47a5('0x3')](_0x47a5('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x47a5('0x3')](_0x47a5('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x47a5('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x47a5('0x3')](_0x47a5('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x47a5('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x47a5('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x47a5('0x3')](_0x47a5('0x14'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x47a5('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x47a5('0x13')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x47a5('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x47a5('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x47a5('0x3')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x47a5('0x3')](_0x47a5('0x14'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x47a5('0x3')](_0x47a5('0x14'),'no',_0x47a5('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x47a5('0x3')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x47a5('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x47a5('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x47a5('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x47a5('0x2')]},'queue_quantity1':{'type':Sequelize[_0x47a5('0x2')]},'queue_quantity2':{'type':Sequelize[_0x47a5('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x47a5('0x2')]},'queue_less_than':{'type':Sequelize[_0x47a5('0x2')]},'periodic_announce':{'type':Sequelize[_0x47a5('0x17')],'set':function(_0x528582){this[_0x47a5('0xa')]('periodic_announce',_0x528582?_0x528582[_0x47a5('0x18')](','):[]);},'get':function(){return this[_0x47a5('0xc')](_0x47a5('0x19'))?this['getDataValue'](_0x47a5('0x19'))[_0x47a5('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':_0x47a5('0x14'),'set':function(_0x51cc81){this['setDataValue'](_0x47a5('0x1b'),_0x51cc81?_0x51cc81[_0x47a5('0x18')](','):[]);},'get':function(){return this['getDataValue']('joinempty')?this[_0x47a5('0xc')](_0x47a5('0x1b'))['split'](','):[];}},'leavewhenempty':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':'no','set':function(_0x53119b){this[_0x47a5('0xa')](_0x47a5('0x1c'),_0x53119b?_0x53119b['join'](','):[]);},'get':function(){return this['getDataValue'](_0x47a5('0x1c'))?this['getDataValue'](_0x47a5('0x1c'))[_0x47a5('0x1a')](','):[];}},'reportholdtime':{'type':Sequelize[_0x47a5('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x47a5('0x3')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x47a5('0x3')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x47a5('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x47a5('0x1d')],'defaultValue':0x0,'set':function(_0x3534cb){this[_0x47a5('0xa')](_0x47a5('0x1e'),_0x3534cb);if(_0x3534cb){if(this[_0x47a5('0xc')](_0x47a5('0x1f'))<0x2){this[_0x47a5('0xa')](_0x47a5('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x47a5('0x13')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x47a5('0x20')},'dialMethod':{'type':Sequelize[_0x47a5('0x3')]('preview',_0x47a5('0x10'),_0x47a5('0x12'),_0x47a5('0x11'),'booked'),'defaultValue':_0x47a5('0x10'),'comment':_0x47a5('0x21')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x47a5('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x47a5('0x23')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x47a5('0x24')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x47a5('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x47a5('0x3')](_0x47a5('0x26'),_0x47a5('0x27')),'defaultValue':_0x47a5('0x27'),'comment':_0x47a5('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x47a5('0x24')](0x2)[_0x47a5('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x47a5('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x47a5('0x13')](0x3)[_0x47a5('0x22')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x47a5('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize[_0x47a5('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x47a5('0x13')](0x3)[_0x47a5('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x47a5('0x2b')},'dialQueueOptions':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':'tTxX','comment':_0x47a5('0x2c')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x47a5('0x2d')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x47a5('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x47a5('0x2e')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x47a5('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x47a5('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x47a5('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x47a5('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x47a5('0x30')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x47a5('0x13')](0x3)[_0x47a5('0x22')],'defaultValue':0x3,'comment':_0x47a5('0x31')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x47a5('0x13')](0x5)[_0x47a5('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x47a5('0x32')},'dialGlobalMaxRetry':{'type':Sequelize[_0x47a5('0x13')](0x3)[_0x47a5('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x47a5('0x33')},'dialTimezone':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':_0x47a5('0x34')},'dialPrefix':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x47a5('0x3')](_0x47a5('0x35'),'never',_0x47a5('0x36')),'defaultValue':_0x47a5('0x35')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x47a5('0x13')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x47a5('0x37')},'dialAMDGreeting':{'type':Sequelize[_0x47a5('0x13')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x47a5('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x47a5('0x38')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x47a5('0x13')](0x9)[_0x47a5('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x47a5('0x39')},'dialAMDMinWordLength':{'type':Sequelize[_0x47a5('0x13')](0x9)[_0x47a5('0x22')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x47a5('0x3a')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x47a5('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x47a5('0x13')](0x9)[_0x47a5('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x47a5('0x3c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x47a5('0x13')](0x5)[_0x47a5('0x22')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x47a5('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x47a5('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x47a5('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x47a5('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x47a5('0x3f')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x47a5('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0x47a5('0x3')](_0x47a5('0x41'),_0x47a5('0x42')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x47a5('0x2')],'comment':_0x47a5('0x2d')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x47a5('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x47a5('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x47a5('0x13')](0x3)[_0x47a5('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x47a5('0x43')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x47a5('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x47a5('0x44')}}; \ No newline at end of file +var _0x7a54=['booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','sequelize','exports','STRING','ENUM','inbound','default','leastrecent','random','rrmemory','wrandom','setDataValue','strategy','getDataValue','dialMethod'];(function(_0x11da1e,_0x597cc5){var _0x404daa=function(_0x3de8f7){while(--_0x3de8f7){_0x11da1e['push'](_0x11da1e['shift']());}};_0x404daa(++_0x597cc5);}(_0x7a54,0x106));var _0x47a5=function(_0x271201,_0x19e536){_0x271201=_0x271201-0x0;var _0x5dbcbf=_0x7a54[_0x271201];return _0x5dbcbf;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'name':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x47a5('0x3')](_0x47a5('0x4'),'outbound'),'allowNull':![],'defaultValue':_0x47a5('0x4')},'musiconhold':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':_0x47a5('0x5')},'announce':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x47a5('0x3')]('rr','ringall',_0x47a5('0x6'),'fewestcalls',_0x47a5('0x7'),_0x47a5('0x8'),'linear',_0x47a5('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x582352){this[_0x47a5('0xa')](_0x47a5('0xb'),_0x582352?_0x582352:'rrmemory');},'get':function(){var _0x2eb0dd=this['getDataValue']('type');var _0x1f47f4=this[_0x47a5('0xc')](_0x47a5('0xd'));var _0x250fad=this[_0x47a5('0xc')](_0x47a5('0xb'));if(_0x2eb0dd===_0x47a5('0x4')){return _0x250fad;}if(_0x1f47f4==='booked'&&_0x250fad===_0x47a5('0x8')||_0x1f47f4===_0x47a5('0xe')&&_0x250fad===_0x47a5('0xf')){return _0x250fad;}if(_0x1f47f4===_0x47a5('0x10')||_0x1f47f4===_0x47a5('0x11')||_0x1f47f4===_0x47a5('0x12')){return _0x250fad;}return null;}},'servicelevel':{'type':Sequelize[_0x47a5('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x47a5('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x47a5('0x13')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x47a5('0x2')]},'weight':{'type':Sequelize[_0x47a5('0x13')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x47a5('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x47a5('0x14')},'autopause':{'type':Sequelize['ENUM']('yes','no',_0x47a5('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x47a5('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x47a5('0x3')](_0x47a5('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x47a5('0x3')](_0x47a5('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x47a5('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x47a5('0x3')](_0x47a5('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x47a5('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x47a5('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x47a5('0x3')](_0x47a5('0x14'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x47a5('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x47a5('0x13')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x47a5('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x47a5('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x47a5('0x3')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x47a5('0x3')](_0x47a5('0x14'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x47a5('0x3')](_0x47a5('0x14'),'no',_0x47a5('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x47a5('0x3')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x47a5('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x47a5('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x47a5('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x47a5('0x2')]},'queue_quantity1':{'type':Sequelize[_0x47a5('0x2')]},'queue_quantity2':{'type':Sequelize[_0x47a5('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x47a5('0x2')]},'queue_less_than':{'type':Sequelize[_0x47a5('0x2')]},'periodic_announce':{'type':Sequelize[_0x47a5('0x17')],'set':function(_0x528582){this[_0x47a5('0xa')]('periodic_announce',_0x528582?_0x528582[_0x47a5('0x18')](','):[]);},'get':function(){return this[_0x47a5('0xc')](_0x47a5('0x19'))?this['getDataValue'](_0x47a5('0x19'))[_0x47a5('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':_0x47a5('0x14'),'set':function(_0x51cc81){this['setDataValue'](_0x47a5('0x1b'),_0x51cc81?_0x51cc81[_0x47a5('0x18')](','):[]);},'get':function(){return this['getDataValue']('joinempty')?this[_0x47a5('0xc')](_0x47a5('0x1b'))['split'](','):[];}},'leavewhenempty':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':'no','set':function(_0x53119b){this[_0x47a5('0xa')](_0x47a5('0x1c'),_0x53119b?_0x53119b['join'](','):[]);},'get':function(){return this['getDataValue'](_0x47a5('0x1c'))?this['getDataValue'](_0x47a5('0x1c'))[_0x47a5('0x1a')](','):[];}},'reportholdtime':{'type':Sequelize[_0x47a5('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x47a5('0x3')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x47a5('0x3')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x47a5('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x47a5('0x1d')],'defaultValue':0x0,'set':function(_0x3534cb){this[_0x47a5('0xa')](_0x47a5('0x1e'),_0x3534cb);if(_0x3534cb){if(this[_0x47a5('0xc')](_0x47a5('0x1f'))<0x2){this[_0x47a5('0xa')](_0x47a5('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x47a5('0x13')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x47a5('0x20')},'dialMethod':{'type':Sequelize[_0x47a5('0x3')]('preview',_0x47a5('0x10'),_0x47a5('0x12'),_0x47a5('0x11'),'booked'),'defaultValue':_0x47a5('0x10'),'comment':_0x47a5('0x21')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x47a5('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x47a5('0x23')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x47a5('0x24')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x47a5('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x47a5('0x3')](_0x47a5('0x26'),_0x47a5('0x27')),'defaultValue':_0x47a5('0x27'),'comment':_0x47a5('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x47a5('0x24')](0x2)[_0x47a5('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x47a5('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x47a5('0x13')](0x3)[_0x47a5('0x22')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x47a5('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize[_0x47a5('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x47a5('0x13')](0x3)[_0x47a5('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x47a5('0x2b')},'dialQueueOptions':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':'tTxX','comment':_0x47a5('0x2c')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x47a5('0x2d')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x47a5('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x47a5('0x2e')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x47a5('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x47a5('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x47a5('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x47a5('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x47a5('0x30')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x47a5('0x13')](0x3)[_0x47a5('0x22')],'defaultValue':0x3,'comment':_0x47a5('0x31')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x47a5('0x13')](0x5)[_0x47a5('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x47a5('0x32')},'dialGlobalMaxRetry':{'type':Sequelize[_0x47a5('0x13')](0x3)[_0x47a5('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x47a5('0x33')},'dialTimezone':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':_0x47a5('0x34')},'dialPrefix':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x47a5('0x3')](_0x47a5('0x35'),'never',_0x47a5('0x36')),'defaultValue':_0x47a5('0x35')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x47a5('0x13')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x47a5('0x37')},'dialAMDGreeting':{'type':Sequelize[_0x47a5('0x13')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x47a5('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x47a5('0x38')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x47a5('0x13')](0x9)[_0x47a5('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x47a5('0x39')},'dialAMDMinWordLength':{'type':Sequelize[_0x47a5('0x13')](0x9)[_0x47a5('0x22')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x47a5('0x3a')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x47a5('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x47a5('0x13')](0x9)[_0x47a5('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x47a5('0x3c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x47a5('0x13')](0x5)[_0x47a5('0x22')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x47a5('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x47a5('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x47a5('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x47a5('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x47a5('0x3f')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x47a5('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0x47a5('0x3')](_0x47a5('0x41'),_0x47a5('0x42')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x47a5('0x2')],'comment':_0x47a5('0x2d')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x47a5('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x47a5('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x47a5('0x13')](0x3)[_0x47a5('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x47a5('0x43')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x47a5('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x47a5('0x44')}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 03b8933..6b2892c 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 _0xb458=['getTeams','Team','addTeams','ids','User','Agents','union','addAgents','removeAgents','removeTeams','spread','emit','userVoiceQueue:save','loginInPause','voicePause','UserVoiceQueueRt','upsert','interface','SIP/%s','penalty','all','isArray','userVoiceQueue:remove','getAgents','getMembers','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','select','field','NOW()','CmListId','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','VoiceQueueId\x20=\x20?','onlyIfOpen','ListId','cm_contacts','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','push','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','./voiceQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','reject','then','name','VoiceQueue','rawAttributes','keys','dateStart','query','dateEnd','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','add','day','map','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','clone','get','omit','createdAt','updatedAt','destroy','findOne','CmHopper','VoiceQueueId','getHopperHistories','CmHopperHistory','hasOwnProperty','pick','getHopperFinals','CmHopperFinal','CmHopperBlack'];(function(_0x11f63c,_0xf997c2){var _0xf968b4=function(_0x1e1388){while(--_0x1e1388){_0x11f63c['push'](_0x11f63c['shift']());}};_0xf968b4(++_0xf997c2);}(_0xb458,0xca));var _0x8b45=function(_0x3d0ab3,_0x2e1926){_0x3d0ab3=_0x3d0ab3-0x0;var _0x17fd2c=_0xb458[_0x3d0ab3];return _0x17fd2c;};'use strict';var pdf=require(_0x8b45('0x0'));var emlformat=require(_0x8b45('0x1'));var rimraf=require(_0x8b45('0x2'));var zipdir=require(_0x8b45('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8b45('0x4'));var moment=require(_0x8b45('0x5'));var BPromise=require(_0x8b45('0x6'));var Mustache=require(_0x8b45('0x7'));var util=require(_0x8b45('0x8'));var path=require(_0x8b45('0x9'));var sox=require(_0x8b45('0xa'));var csv=require(_0x8b45('0xb'));var ejs=require(_0x8b45('0xc'));var fs=require('fs');var _=require(_0x8b45('0xd'));var squel=require(_0x8b45('0xe'));var crypto=require(_0x8b45('0xf'));var jsforce=require(_0x8b45('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x8b45('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8b45('0x11'));var qs=require(_0x8b45('0x12'));var logger=require(_0x8b45('0x13'))('api');var utils=require(_0x8b45('0x14'));var config=require('../../config/environment');var db=require(_0x8b45('0x15'))['db'];config[_0x8b45('0x16')]=_[_0x8b45('0x17')](config[_0x8b45('0x16')],{'host':_0x8b45('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8b45('0x19'))[_0x8b45('0x1a')](socket);function respondWithStatusCode(_0x37a714,_0x157149){_0x157149=_0x157149||0xcc;return function(_0x3b7c99){if(_0x3b7c99){return _0x37a714[_0x8b45('0x1b')](_0x157149);}return _0x37a714[_0x8b45('0x1c')](_0x157149)[_0x8b45('0x1d')]();};}function respondWithResult(_0x2fb210,_0x83c355){_0x83c355=_0x83c355||0xc8;return function(_0x300dc9){if(_0x300dc9){return _0x2fb210[_0x8b45('0x1c')](_0x83c355)[_0x8b45('0x1e')](_0x300dc9);}};}function respondWithFilteredResult(_0x433010,_0x3ce169){return function(_0x59547e){if(_0x59547e){var _0x54db6e=_0x59547e[_0x8b45('0x1f')],_0x777072=_0x3ce169[_0x8b45('0x20')],_0x110e76=_0x3ce169['offset']+_0x3ce169[_0x8b45('0x21')],_0xfb84af;if(_0x110e76>=_0x54db6e){_0x110e76=_0x54db6e;_0xfb84af=0xc8;}else{_0xfb84af=0xce;}_0x433010['status'](_0xfb84af);return _0x433010[_0x8b45('0x22')]('Content-Range',_0x777072+'-'+_0x110e76+'/'+_0x54db6e)[_0x8b45('0x1e')](_0x59547e);}return null;};}function patchUpdates(_0x18b08f){return function(_0x3dfe62){try{jsonpatch['apply'](_0x3dfe62,_0x18b08f,!![]);}catch(_0xc924dd){return BPromise[_0x8b45('0x23')](_0xc924dd);}return _0x3dfe62['save']();};}function saveUpdates(_0x1459c8,_0x33a03d){return function(_0x2319c6){if(_0x2319c6){return _0x2319c6['update'](_0x1459c8)[_0x8b45('0x24')](function(_0x3bb575){return _0x3bb575;});}return null;};}function removeEntity(_0x8c73f,_0x557f5b){return function(_0x1dc7c2){if(_0x1dc7c2){return _0x1dc7c2['destroy']()['then'](function(){_0x8c73f[_0x8b45('0x1c')](0xcc)[_0x8b45('0x1d')]();});}};}function handleEntityNotFound(_0xbc5c09,_0x1c38a3){return function(_0x40510c){if(!_0x40510c){_0xbc5c09['sendStatus'](0x194);}return _0x40510c;};}function handleError(_0x3dc3b8,_0x120b37){_0x120b37=_0x120b37||0x1f4;return function(_0x4acd00){logger['error'](_0x4acd00['stack']);if(_0x4acd00[_0x8b45('0x25')]){delete _0x4acd00[_0x8b45('0x25')];}_0x3dc3b8['status'](_0x120b37)['send'](_0x4acd00);};}exports['index']=function(_0x531ae2,_0x4db45d){var _0x2b24f3={},_0x53a363={},_0x28d540={'count':0x0,'rows':[]};var _0x275c07=db[_0x8b45('0x26')][_0x8b45('0x27')];_0x53a363['model']=_[_0x8b45('0x28')](_0x275c07);var _0x556ce3={'dateStart':_0x531ae2['query'][_0x8b45('0x29')],'dateEnd':_0x531ae2[_0x8b45('0x2a')][_0x8b45('0x2b')]};delete _0x531ae2[_0x8b45('0x2a')][_0x8b45('0x29')];delete _0x531ae2[_0x8b45('0x2a')][_0x8b45('0x2b')];_0x53a363[_0x8b45('0x2a')]=_[_0x8b45('0x28')](_0x531ae2[_0x8b45('0x2a')]);_0x53a363[_0x8b45('0x2c')]=_[_0x8b45('0x2d')](_0x53a363[_0x8b45('0x2e')],_0x53a363[_0x8b45('0x2a')]);_0x2b24f3[_0x8b45('0x2f')]=_[_0x8b45('0x2d')](_0x53a363['model'],qs[_0x8b45('0x30')](_0x531ae2[_0x8b45('0x2a')]['fields']));_0x2b24f3[_0x8b45('0x2f')]=_0x2b24f3[_0x8b45('0x2f')][_0x8b45('0x31')]?_0x2b24f3['attributes']:_0x53a363[_0x8b45('0x2e')];if(!_0x531ae2[_0x8b45('0x2a')]['hasOwnProperty'](_0x8b45('0x32'))){_0x2b24f3['limit']=qs[_0x8b45('0x21')](_0x531ae2['query']['limit']);_0x2b24f3['offset']=qs[_0x8b45('0x20')](_0x531ae2[_0x8b45('0x2a')][_0x8b45('0x20')]);}_0x2b24f3[_0x8b45('0x33')]=qs[_0x8b45('0x34')](_0x531ae2[_0x8b45('0x2a')]['sort']);_0x2b24f3[_0x8b45('0x35')]=qs[_0x8b45('0x2c')](_['pick'](_0x531ae2['query'],_0x53a363[_0x8b45('0x2c')]));if(_0x556ce3[_0x8b45('0x29')]){if(_0x556ce3[_0x8b45('0x2b')]){_0x556ce3[_0x8b45('0x2b')]=moment(_0x556ce3[_0x8b45('0x2b')])['add'](0x1,'day');}else{_0x556ce3[_0x8b45('0x2b')]=moment(_0x556ce3['dateStart'])[_0x8b45('0x36')](0x1,_0x8b45('0x37'));}_['merge'](_0x2b24f3[_0x8b45('0x35')],{'createdAt':{'$gte':_0x556ce3[_0x8b45('0x29')],'$lte':_0x556ce3['dateEnd']}});}if(_0x531ae2[_0x8b45('0x2a')]['filter']){_0x2b24f3[_0x8b45('0x35')]=_['merge'](_0x2b24f3[_0x8b45('0x35')],{'$or':_[_0x8b45('0x38')](_0x2b24f3[_0x8b45('0x2f')],function(_0x2ad48f){var _0x2dc570={};_0x2dc570[_0x2ad48f]={'$like':'%'+_0x531ae2[_0x8b45('0x2a')][_0x8b45('0x39')]+'%'};return _0x2dc570;})});}_0x2b24f3=_[_0x8b45('0x3a')]({},_0x2b24f3,_0x531ae2[_0x8b45('0x3b')]);var _0xebc105={'where':_0x2b24f3[_0x8b45('0x35')]};return db[_0x8b45('0x26')][_0x8b45('0x1f')](_0xebc105)[_0x8b45('0x24')](function(_0x587b00){_0x28d540[_0x8b45('0x1f')]=_0x587b00;if(_0x531ae2[_0x8b45('0x2a')][_0x8b45('0x3c')]){_0x2b24f3[_0x8b45('0x3d')]=[{'all':!![]}];}return db[_0x8b45('0x26')][_0x8b45('0x3e')](_0x2b24f3);})[_0x8b45('0x24')](function(_0x3192ea){_0x28d540[_0x8b45('0x3f')]=_0x3192ea;return _0x28d540;})[_0x8b45('0x24')](respondWithFilteredResult(_0x4db45d,_0x2b24f3))['catch'](handleError(_0x4db45d,null));};exports[_0x8b45('0x40')]=function(_0x47d5cb,_0x3138f5){var _0x2929c0={'raw':![],'where':{'id':_0x47d5cb[_0x8b45('0x41')]['id']}},_0x4d5390={};_0x4d5390[_0x8b45('0x2e')]=_[_0x8b45('0x28')](db[_0x8b45('0x26')][_0x8b45('0x27')]);_0x4d5390[_0x8b45('0x2a')]=_[_0x8b45('0x28')](_0x47d5cb[_0x8b45('0x2a')]);_0x4d5390['filters']=_[_0x8b45('0x2d')](_0x4d5390[_0x8b45('0x2e')],_0x4d5390[_0x8b45('0x2a')]);_0x2929c0[_0x8b45('0x2f')]=_[_0x8b45('0x2d')](_0x4d5390[_0x8b45('0x2e')],qs[_0x8b45('0x30')](_0x47d5cb[_0x8b45('0x2a')]['fields']));_0x2929c0[_0x8b45('0x2f')]=_0x2929c0[_0x8b45('0x2f')][_0x8b45('0x31')]?_0x2929c0[_0x8b45('0x2f')]:_0x4d5390['model'];if(_0x47d5cb['query'][_0x8b45('0x3c')]){_0x2929c0[_0x8b45('0x3d')]=[{'all':!![]}];}_0x2929c0=_[_0x8b45('0x3a')]({},_0x2929c0,_0x47d5cb['options']);return db[_0x8b45('0x26')][_0x8b45('0x42')](_0x2929c0)[_0x8b45('0x24')](handleEntityNotFound(_0x3138f5,null))[_0x8b45('0x24')](respondWithResult(_0x3138f5,null))[_0x8b45('0x43')](handleError(_0x3138f5,null));};exports[_0x8b45('0x44')]=function(_0x274f02,_0x5de949){return db[_0x8b45('0x26')][_0x8b45('0x44')](_0x274f02[_0x8b45('0x45')],{})[_0x8b45('0x24')](respondWithResult(_0x5de949,0xc9))[_0x8b45('0x43')](handleError(_0x5de949,null));};exports[_0x8b45('0x46')]=function(_0xb7d73b,_0xbbe7e2){var _0x1b57eb={'raw':![],'where':{'id':_0xb7d73b[_0x8b45('0x41')]['id']}},_0x62cb00={};_0x62cb00[_0x8b45('0x2e')]=_[_0x8b45('0x28')](db[_0x8b45('0x26')][_0x8b45('0x27')]);_0x1b57eb['attributes']=_[_0x8b45('0x2d')](_0x62cb00[_0x8b45('0x2e')],qs[_0x8b45('0x30')](_0xb7d73b['query'][_0x8b45('0x30')]));_0x1b57eb[_0x8b45('0x2f')]=_0x1b57eb[_0x8b45('0x2f')][_0x8b45('0x31')]?_0x1b57eb[_0x8b45('0x2f')]:_0x62cb00[_0x8b45('0x2e')];if(_0xb7d73b['query'][_0x8b45('0x3c')]){_0x1b57eb['include']=[{'all':!![]}];}_0x1b57eb=_['merge']({},_0x1b57eb,_0xb7d73b[_0x8b45('0x3b')]);return db[_0x8b45('0x26')][_0x8b45('0x42')](_0x1b57eb)[_0x8b45('0x24')](handleEntityNotFound(_0xbbe7e2,null))['then'](function(_0x2259ec){if(_0x2259ec){var _0x4de2a7=_0x2259ec[_0x8b45('0x47')]({'plain':!![]});_0x4de2a7=qs[_0x8b45('0x48')](_0x4de2a7,['id','createdAt','updatedAt']);_0xb7d73b[_0x8b45('0x45')]=_['omit'](_0xb7d73b['body'],['id',_0x8b45('0x49'),_0x8b45('0x4a')]);return db[_0x8b45('0x26')]['create'](_[_0x8b45('0x3a')](_0x4de2a7,_0xb7d73b['body']),{'include':_0xb7d73b[_0x8b45('0x2a')][_0x8b45('0x3c')]?[{'all':!![]}]:undefined});}})[_0x8b45('0x24')](respondWithResult(_0xbbe7e2,0xc9))[_0x8b45('0x43')](handleError(_0xbbe7e2,null));};exports['update']=function(_0x36363c,_0x5c1a3c){if(_0x36363c[_0x8b45('0x45')]['id']){delete _0x36363c[_0x8b45('0x45')]['id'];}return db[_0x8b45('0x26')][_0x8b45('0x42')]({'where':{'id':_0x36363c[_0x8b45('0x41')]['id']}})[_0x8b45('0x24')](handleEntityNotFound(_0x5c1a3c,null))[_0x8b45('0x24')](saveUpdates(_0x36363c[_0x8b45('0x45')],null))[_0x8b45('0x24')](respondWithResult(_0x5c1a3c,null))[_0x8b45('0x43')](handleError(_0x5c1a3c,null));};exports[_0x8b45('0x4b')]=function(_0x2d1e71,_0x14e7a7){return db[_0x8b45('0x26')]['find']({'where':{'id':_0x2d1e71['params']['id']}})['then'](handleEntityNotFound(_0x14e7a7,null))['then'](removeEntity(_0x14e7a7,null))[_0x8b45('0x43')](handleError(_0x14e7a7,null));};exports['getHoppers']=function(_0x3044b8,_0x2f3737,_0x31539e){var _0x516032={'raw':![],'where':{}};var _0x39e576={};var _0x3fa926={'count':0x0,'rows':[]};return db[_0x8b45('0x26')][_0x8b45('0x4c')]({'where':{'id':_0x3044b8[_0x8b45('0x41')]['id']}})[_0x8b45('0x24')](handleEntityNotFound(_0x2f3737,null))[_0x8b45('0x24')](function(_0x34b71f){if(_0x34b71f){_0x39e576[_0x8b45('0x2e')]=_['keys'](db[_0x8b45('0x4d')][_0x8b45('0x27')]);_0x39e576[_0x8b45('0x2a')]=_[_0x8b45('0x28')](_0x3044b8[_0x8b45('0x2a')]);_0x39e576[_0x8b45('0x2c')]=_[_0x8b45('0x2d')](_0x39e576[_0x8b45('0x2e')],_0x39e576[_0x8b45('0x2a')]);_0x516032[_0x8b45('0x2f')]=_[_0x8b45('0x2d')](_0x39e576[_0x8b45('0x2e')],qs['fields'](_0x3044b8[_0x8b45('0x2a')]['fields']));_0x516032['attributes']=_0x516032['attributes'][_0x8b45('0x31')]?_0x516032[_0x8b45('0x2f')]:_0x39e576[_0x8b45('0x2e')];if(!_0x3044b8[_0x8b45('0x2a')]['hasOwnProperty'](_0x8b45('0x32'))){_0x516032[_0x8b45('0x21')]=qs[_0x8b45('0x21')](_0x3044b8['query'][_0x8b45('0x21')]);_0x516032['offset']=qs[_0x8b45('0x20')](_0x3044b8[_0x8b45('0x2a')]['offset']);}_0x516032[_0x8b45('0x33')]=qs['sort'](_0x3044b8[_0x8b45('0x2a')]['sort']);_0x516032['where']=qs[_0x8b45('0x2c')](_['pick'](_0x3044b8[_0x8b45('0x2a')],_0x39e576[_0x8b45('0x2c')]));_0x516032[_0x8b45('0x35')][_0x8b45('0x4e')]=_0x34b71f['id'];if(_0x3044b8['query']['filter']){_0x516032['where']=_[_0x8b45('0x3a')](_0x516032[_0x8b45('0x35')],{'$or':_['map'](_0x516032['attributes'],function(_0x2fbe9c){var _0x3f9c76={};_0x3f9c76[_0x2fbe9c]={'$like':'%'+_0x3044b8[_0x8b45('0x2a')]['filter']+'%'};return _0x3f9c76;})});}_0x516032=_[_0x8b45('0x3a')]({},_0x516032,_0x3044b8[_0x8b45('0x3b')]);return db[_0x8b45('0x4d')][_0x8b45('0x1f')]({'where':_0x516032['where']})[_0x8b45('0x24')](function(_0x29b3c5){_0x3fa926[_0x8b45('0x1f')]=_0x29b3c5;if(_0x3044b8[_0x8b45('0x2a')]['includeAll']){_0x516032['include']=[{'all':!![]}];}return db[_0x8b45('0x4d')][_0x8b45('0x3e')](_0x516032);})[_0x8b45('0x24')](function(_0x303a0e){_0x3fa926[_0x8b45('0x3f')]=_0x303a0e;return _0x3fa926;});}})[_0x8b45('0x24')](respondWithFilteredResult(_0x2f3737,_0x516032))[_0x8b45('0x43')](handleError(_0x2f3737,null));};exports[_0x8b45('0x4f')]=function(_0x3c7752,_0x75887a,_0x170d30){var _0x35c5f4={'raw':!![],'where':{}};var _0x1c6740={};var _0x2562c3={'count':0x0,'rows':[]};return db[_0x8b45('0x26')]['findOne']({'where':{'id':_0x3c7752['params']['id']}})[_0x8b45('0x24')](handleEntityNotFound(_0x75887a,null))[_0x8b45('0x24')](function(_0x219524){if(_0x219524){_0x1c6740[_0x8b45('0x2e')]=_[_0x8b45('0x28')](db[_0x8b45('0x50')][_0x8b45('0x27')]);_0x1c6740[_0x8b45('0x2a')]=_[_0x8b45('0x28')](_0x3c7752[_0x8b45('0x2a')]);_0x1c6740[_0x8b45('0x2c')]=_[_0x8b45('0x2d')](_0x1c6740[_0x8b45('0x2e')],_0x1c6740[_0x8b45('0x2a')]);_0x35c5f4[_0x8b45('0x2f')]=_[_0x8b45('0x2d')](_0x1c6740[_0x8b45('0x2e')],qs[_0x8b45('0x30')](_0x3c7752[_0x8b45('0x2a')][_0x8b45('0x30')]));_0x35c5f4['attributes']=_0x35c5f4[_0x8b45('0x2f')][_0x8b45('0x31')]?_0x35c5f4[_0x8b45('0x2f')]:_0x1c6740[_0x8b45('0x2e')];if(!_0x3c7752[_0x8b45('0x2a')][_0x8b45('0x51')](_0x8b45('0x32'))){_0x35c5f4[_0x8b45('0x21')]=qs[_0x8b45('0x21')](_0x3c7752['query'][_0x8b45('0x21')]);_0x35c5f4[_0x8b45('0x20')]=qs[_0x8b45('0x20')](_0x3c7752[_0x8b45('0x2a')]['offset']);}_0x35c5f4[_0x8b45('0x33')]=qs[_0x8b45('0x34')](_0x3c7752[_0x8b45('0x2a')]['sort']);_0x35c5f4[_0x8b45('0x35')]=qs[_0x8b45('0x2c')](_[_0x8b45('0x52')](_0x3c7752[_0x8b45('0x2a')],_0x1c6740['filters']));_0x35c5f4[_0x8b45('0x35')][_0x8b45('0x4e')]=_0x219524['id'];if(_0x3c7752[_0x8b45('0x2a')][_0x8b45('0x39')]){_0x35c5f4['where']=_['merge'](_0x35c5f4[_0x8b45('0x35')],{'$or':_[_0x8b45('0x38')](_0x35c5f4['attributes'],function(_0xfbef7b){var _0x1b37cc={};_0x1b37cc[_0xfbef7b]={'$like':'%'+_0x3c7752[_0x8b45('0x2a')][_0x8b45('0x39')]+'%'};return _0x1b37cc;})});}_0x35c5f4=_[_0x8b45('0x3a')]({},_0x35c5f4,_0x3c7752[_0x8b45('0x3b')]);return db[_0x8b45('0x50')][_0x8b45('0x1f')]({'where':_0x35c5f4['where']})['then'](function(_0x5c4a5b){_0x2562c3[_0x8b45('0x1f')]=_0x5c4a5b;if(_0x3c7752[_0x8b45('0x2a')][_0x8b45('0x3c')]){_0x35c5f4['include']=[{'all':!![]}];}return db[_0x8b45('0x50')]['findAll'](_0x35c5f4);})[_0x8b45('0x24')](function(_0x1e6276){_0x2562c3[_0x8b45('0x3f')]=_0x1e6276;return _0x2562c3;});}})[_0x8b45('0x24')](respondWithFilteredResult(_0x75887a,_0x35c5f4))[_0x8b45('0x43')](handleError(_0x75887a,null));};exports[_0x8b45('0x53')]=function(_0x500046,_0xaf27eb,_0x43d0d6){var _0x116958={'raw':!![],'where':{}};var _0x30baa3={};var _0x541dbd={'count':0x0,'rows':[]};return db[_0x8b45('0x26')][_0x8b45('0x4c')]({'where':{'id':_0x500046[_0x8b45('0x41')]['id']}})[_0x8b45('0x24')](handleEntityNotFound(_0xaf27eb,null))[_0x8b45('0x24')](function(_0x37c160){if(_0x37c160){_0x30baa3['model']=_[_0x8b45('0x28')](db[_0x8b45('0x54')]['rawAttributes']);_0x30baa3[_0x8b45('0x2a')]=_['keys'](_0x500046[_0x8b45('0x2a')]);_0x30baa3[_0x8b45('0x2c')]=_[_0x8b45('0x2d')](_0x30baa3[_0x8b45('0x2e')],_0x30baa3[_0x8b45('0x2a')]);_0x116958['attributes']=_[_0x8b45('0x2d')](_0x30baa3[_0x8b45('0x2e')],qs[_0x8b45('0x30')](_0x500046[_0x8b45('0x2a')][_0x8b45('0x30')]));_0x116958[_0x8b45('0x2f')]=_0x116958[_0x8b45('0x2f')]['length']?_0x116958[_0x8b45('0x2f')]:_0x30baa3[_0x8b45('0x2e')];if(!_0x500046[_0x8b45('0x2a')][_0x8b45('0x51')](_0x8b45('0x32'))){_0x116958[_0x8b45('0x21')]=qs[_0x8b45('0x21')](_0x500046[_0x8b45('0x2a')][_0x8b45('0x21')]);_0x116958[_0x8b45('0x20')]=qs[_0x8b45('0x20')](_0x500046[_0x8b45('0x2a')][_0x8b45('0x20')]);}_0x116958[_0x8b45('0x33')]=qs[_0x8b45('0x34')](_0x500046[_0x8b45('0x2a')][_0x8b45('0x34')]);_0x116958[_0x8b45('0x35')]=qs[_0x8b45('0x2c')](_['pick'](_0x500046[_0x8b45('0x2a')],_0x30baa3[_0x8b45('0x2c')]));_0x116958[_0x8b45('0x35')][_0x8b45('0x4e')]=_0x37c160['id'];if(_0x500046[_0x8b45('0x2a')][_0x8b45('0x39')]){_0x116958['where']=_[_0x8b45('0x3a')](_0x116958[_0x8b45('0x35')],{'$or':_['map'](_0x116958[_0x8b45('0x2f')],function(_0x4f18cd){var _0x43844c={};_0x43844c[_0x4f18cd]={'$like':'%'+_0x500046[_0x8b45('0x2a')]['filter']+'%'};return _0x43844c;})});}_0x116958=_[_0x8b45('0x3a')]({},_0x116958,_0x500046[_0x8b45('0x3b')]);return db[_0x8b45('0x54')][_0x8b45('0x1f')]({'where':_0x116958[_0x8b45('0x35')]})[_0x8b45('0x24')](function(_0x534d65){_0x541dbd[_0x8b45('0x1f')]=_0x534d65;if(_0x500046['query'][_0x8b45('0x3c')]){_0x116958[_0x8b45('0x3d')]=[{'all':!![]}];}return db[_0x8b45('0x54')][_0x8b45('0x3e')](_0x116958);})['then'](function(_0x3fdcb3){_0x541dbd[_0x8b45('0x3f')]=_0x3fdcb3;return _0x541dbd;});}})[_0x8b45('0x24')](respondWithFilteredResult(_0xaf27eb,_0x116958))[_0x8b45('0x43')](handleError(_0xaf27eb,null));};exports['getHopperBlacks']=function(_0x17cf9c,_0x483545,_0x15c6a5){var _0x5332e9={'raw':!![],'where':{}};var _0x15189e={};var _0x5c8ca7={'count':0x0,'rows':[]};return db[_0x8b45('0x26')][_0x8b45('0x4c')]({'where':{'id':_0x17cf9c[_0x8b45('0x41')]['id']}})[_0x8b45('0x24')](handleEntityNotFound(_0x483545,null))[_0x8b45('0x24')](function(_0x555ecf){if(_0x555ecf){_0x15189e[_0x8b45('0x2e')]=_['keys'](db[_0x8b45('0x55')][_0x8b45('0x27')]);_0x15189e[_0x8b45('0x2a')]=_[_0x8b45('0x28')](_0x17cf9c[_0x8b45('0x2a')]);_0x15189e[_0x8b45('0x2c')]=_[_0x8b45('0x2d')](_0x15189e[_0x8b45('0x2e')],_0x15189e['query']);_0x5332e9['attributes']=_[_0x8b45('0x2d')](_0x15189e[_0x8b45('0x2e')],qs[_0x8b45('0x30')](_0x17cf9c['query'][_0x8b45('0x30')]));_0x5332e9[_0x8b45('0x2f')]=_0x5332e9['attributes'][_0x8b45('0x31')]?_0x5332e9[_0x8b45('0x2f')]:_0x15189e[_0x8b45('0x2e')];if(!_0x17cf9c[_0x8b45('0x2a')][_0x8b45('0x51')](_0x8b45('0x32'))){_0x5332e9[_0x8b45('0x21')]=qs['limit'](_0x17cf9c[_0x8b45('0x2a')][_0x8b45('0x21')]);_0x5332e9['offset']=qs[_0x8b45('0x20')](_0x17cf9c[_0x8b45('0x2a')]['offset']);}_0x5332e9[_0x8b45('0x33')]=qs[_0x8b45('0x34')](_0x17cf9c[_0x8b45('0x2a')]['sort']);_0x5332e9[_0x8b45('0x35')]=qs[_0x8b45('0x2c')](_[_0x8b45('0x52')](_0x17cf9c[_0x8b45('0x2a')],_0x15189e[_0x8b45('0x2c')]));_0x5332e9[_0x8b45('0x35')]['VoiceQueueId']=_0x555ecf['id'];if(_0x17cf9c['query'][_0x8b45('0x39')]){_0x5332e9['where']=_['merge'](_0x5332e9[_0x8b45('0x35')],{'$or':_[_0x8b45('0x38')](_0x5332e9['attributes'],function(_0x22d1e1){var _0x165c50={};_0x165c50[_0x22d1e1]={'$like':'%'+_0x17cf9c[_0x8b45('0x2a')][_0x8b45('0x39')]+'%'};return _0x165c50;})});}_0x5332e9=_['merge']({},_0x5332e9,_0x17cf9c[_0x8b45('0x3b')]);return db[_0x8b45('0x55')][_0x8b45('0x1f')]({'where':_0x5332e9[_0x8b45('0x35')]})['then'](function(_0x554d8c){_0x5c8ca7[_0x8b45('0x1f')]=_0x554d8c;if(_0x17cf9c['query'][_0x8b45('0x3c')]){_0x5332e9[_0x8b45('0x3d')]=[{'all':!![]}];}return db[_0x8b45('0x55')][_0x8b45('0x3e')](_0x5332e9);})[_0x8b45('0x24')](function(_0x216489){_0x5c8ca7[_0x8b45('0x3f')]=_0x216489;return _0x5c8ca7;});}})['then'](respondWithFilteredResult(_0x483545,_0x5332e9))[_0x8b45('0x43')](handleError(_0x483545,null));};exports[_0x8b45('0x56')]=function(_0x5660f1,_0x3a8310,_0x55b640){var _0x517962={};var _0xb4338d={};var _0x5047a7;var _0x174676;return db[_0x8b45('0x26')]['findOne']({'where':{'id':_0x5660f1[_0x8b45('0x41')]['id']}})[_0x8b45('0x24')](handleEntityNotFound(_0x3a8310,null))['then'](function(_0x48cdb6){if(_0x48cdb6){_0x5047a7=_0x48cdb6;_0xb4338d[_0x8b45('0x2e')]=_[_0x8b45('0x28')](db[_0x8b45('0x57')][_0x8b45('0x27')]);_0xb4338d[_0x8b45('0x2a')]=_[_0x8b45('0x28')](_0x5660f1[_0x8b45('0x2a')]);_0xb4338d[_0x8b45('0x2c')]=_[_0x8b45('0x2d')](_0xb4338d[_0x8b45('0x2e')],_0xb4338d[_0x8b45('0x2a')]);_0x517962[_0x8b45('0x2f')]=_['intersection'](_0xb4338d[_0x8b45('0x2e')],qs[_0x8b45('0x30')](_0x5660f1[_0x8b45('0x2a')][_0x8b45('0x30')]));_0x517962[_0x8b45('0x2f')]=_0x517962[_0x8b45('0x2f')][_0x8b45('0x31')]?_0x517962[_0x8b45('0x2f')]:_0xb4338d[_0x8b45('0x2e')];_0x517962[_0x8b45('0x33')]=qs[_0x8b45('0x34')](_0x5660f1[_0x8b45('0x2a')][_0x8b45('0x34')]);_0x517962['where']=qs[_0x8b45('0x2c')](_[_0x8b45('0x52')](_0x5660f1[_0x8b45('0x2a')],_0xb4338d['filters']));if(_0x5660f1['query']['filter']){_0x517962[_0x8b45('0x35')]=_[_0x8b45('0x3a')](_0x517962['where'],{'$or':_['map'](_0x517962[_0x8b45('0x2f')],function(_0x11968b){var _0x2e9129={};_0x2e9129[_0x11968b]={'$like':'%'+_0x5660f1[_0x8b45('0x2a')][_0x8b45('0x39')]+'%'};return _0x2e9129;})});}_0x517962=_[_0x8b45('0x3a')]({},_0x517962,_0x5660f1['options']);return _0x5047a7[_0x8b45('0x56')](_0x517962);}})[_0x8b45('0x24')](function(_0x493e76){if(_0x493e76){_0x174676=_0x493e76[_0x8b45('0x31')];if(!_0x5660f1[_0x8b45('0x2a')][_0x8b45('0x51')](_0x8b45('0x32'))){_0x517962[_0x8b45('0x21')]=qs[_0x8b45('0x21')](_0x5660f1['query']['limit']);_0x517962[_0x8b45('0x20')]=qs[_0x8b45('0x20')](_0x5660f1['query']['offset']);}return _0x5047a7[_0x8b45('0x56')](_0x517962);}})[_0x8b45('0x24')](function(_0x3fa2a7){if(_0x3fa2a7){return _0x3fa2a7?{'count':_0x174676,'rows':_0x3fa2a7}:null;}})[_0x8b45('0x24')](respondWithResult(_0x3a8310,null))[_0x8b45('0x43')](handleError(_0x3a8310,null));};exports[_0x8b45('0x58')]=function(_0x4adad7,_0x306894,_0x2e67ac){var _0x49e968=[];var _0x38eebb;return db[_0x8b45('0x57')][_0x8b45('0x3e')]({'where':{'id':_0x4adad7[_0x8b45('0x45')][_0x8b45('0x59')]},'attributes':['id'],'include':[{'model':db[_0x8b45('0x5a')],'as':_0x8b45('0x5b'),'attributes':['id'],'raw':!![]}]})[_0x8b45('0x24')](function(_0x30b036){if(_0x30b036){for(var _0x4e549e=0x0;_0x4e549e<_0x30b036[_0x8b45('0x31')];_0x4e549e+=0x1){for(var _0x442494=0x0;_0x442494<_0x30b036[_0x4e549e]['Agents'][_0x8b45('0x31')];_0x442494+=0x1){_0x49e968=_[_0x8b45('0x5c')](_0x49e968,[_0x30b036[_0x4e549e][_0x8b45('0x5b')][_0x442494]['id']]);}}return _0x49e968;}})[_0x8b45('0x24')](function(_0x5653b2){if(_0x5653b2){return db[_0x8b45('0x26')][_0x8b45('0x42')]({'where':{'id':_0x4adad7['params']['id']}});}})[_0x8b45('0x24')](function(_0x404d34){if(_0x404d34){_0x38eebb=_0x404d34;return _0x38eebb[_0x8b45('0x5d')](_0x49e968,{'penalty':_0x4adad7[_0x8b45('0x45')]['penalty']});}})[_0x8b45('0x24')](function(_0x3d6bac){if(_0x3d6bac){return _0x38eebb['addTeams'](_0x4adad7[_0x8b45('0x45')][_0x8b45('0x59')]);}})[_0x8b45('0x24')](handleEntityNotFound(_0x306894,null))['then'](respondWithStatusCode(_0x306894,null))[_0x8b45('0x43')](handleError(_0x306894,null));};exports['removeTeams']=function(_0x3b3db4,_0x34df12,_0x16b4c3){var _0x4cf404=[];var _0x258c6f;return db['Team'][_0x8b45('0x3e')]({'where':{'id':_0x3b3db4[_0x8b45('0x2a')][_0x8b45('0x59')]},'attributes':['id'],'include':[{'model':db[_0x8b45('0x5a')],'as':_0x8b45('0x5b'),'attributes':['id'],'raw':!![]}]})[_0x8b45('0x24')](function(_0x105529){if(_0x105529){for(var _0x1d4faa=0x0;_0x1d4faa<_0x105529['length'];_0x1d4faa+=0x1){for(var _0x2eb308=0x0;_0x2eb308<_0x105529[_0x1d4faa][_0x8b45('0x5b')][_0x8b45('0x31')];_0x2eb308+=0x1){_0x4cf404=_['union'](_0x4cf404,[_0x105529[_0x1d4faa][_0x8b45('0x5b')][_0x2eb308]['id']]);}}return _0x4cf404;}})[_0x8b45('0x24')](function(_0x2e7013){if(_0x2e7013){return db['VoiceQueue'][_0x8b45('0x42')]({'where':{'id':_0x3b3db4[_0x8b45('0x41')]['id']}});}})[_0x8b45('0x24')](function(_0x1e35f4){if(_0x1e35f4){_0x258c6f=_0x1e35f4;return _0x258c6f[_0x8b45('0x5e')](_0x4cf404);}})[_0x8b45('0x24')](function(_0x4e4490){if(_0x258c6f){return _0x258c6f[_0x8b45('0x5f')](_0x3b3db4[_0x8b45('0x2a')][_0x8b45('0x59')]);}})[_0x8b45('0x24')](handleEntityNotFound(_0x34df12,null))['then'](respondWithStatusCode(_0x34df12,null))[_0x8b45('0x43')](handleError(_0x34df12,null));};exports[_0x8b45('0x5d')]=function(_0x1e77f1,_0x86d923,_0x44189f){var _0x331653,_0xb83331;return db['VoiceQueue'][_0x8b45('0x42')]({'where':{'id':_0x1e77f1[_0x8b45('0x41')]['id']}})[_0x8b45('0x24')](handleEntityNotFound(_0x86d923,null))['then'](function(_0x36874b){if(_0x36874b){_0xb83331=_0x36874b;return _0x36874b[_0x8b45('0x5d')](_0x1e77f1['body'][_0x8b45('0x59')],_[_0x8b45('0x48')](_0x1e77f1[_0x8b45('0x45')],[_0x8b45('0x59'),'id'])||{})[_0x8b45('0x60')](function(_0x2d6d65){for(var _0x3e5744=0x0;_0x3e5744<_0x1e77f1[_0x8b45('0x45')][_0x8b45('0x59')][_0x8b45('0x31')];_0x3e5744+=0x1){socket[_0x8b45('0x61')](_0x8b45('0x62'),{'UserId':_0x1e77f1[_0x8b45('0x45')][_0x8b45('0x59')][_0x3e5744],'VoiceQueueId':_0x1e77f1[_0x8b45('0x41')]['id']});}return _0x2d6d65;});}})['then'](function(_0x5a2f8f){_0x331653=_0x5a2f8f||[];if(_0xb83331){return db[_0x8b45('0x5a')][_0x8b45('0x3e')]({'where':{'id':_0x1e77f1[_0x8b45('0x45')][_0x8b45('0x59')]},'attributes':['id',_0x8b45('0x25'),_0x8b45('0x63'),_0x8b45('0x64'),'interface'],'raw':!![]});}})['then'](function(_0x3e4b60){if(_0x3e4b60&&_0x3e4b60[_0x8b45('0x31')]){var _0x410184=[];for(var _0x2d1f55=0x0;_0x2d1f55<_0x3e4b60[_0x8b45('0x31')];_0x2d1f55++){_0x410184['push'](db[_0x8b45('0x65')][_0x8b45('0x66')]({'membername':_0x3e4b60[_0x2d1f55][_0x8b45('0x25')],'UserId':_0x3e4b60[_0x2d1f55]['id'],'queue_name':_0xb83331['name'],'VoiceQueueId':_0xb83331['id'],'interface':_['isNil'](_0x3e4b60[_0x2d1f55][_0x8b45('0x67')])?util['format'](_0x8b45('0x68'),_0x3e4b60[_0x2d1f55][_0x8b45('0x25')]):_0x3e4b60[_0x2d1f55][_0x8b45('0x67')],'paused':_0x3e4b60[_0x2d1f55][_0x8b45('0x64')]||![],'penalty':_0x1e77f1[_0x8b45('0x45')][_0x8b45('0x69')]||0x0}));}return BPromise[_0x8b45('0x6a')](_0x410184);}})[_0x8b45('0x24')](function(_0x26437d){return _0x331653;})[_0x8b45('0x24')](respondWithResult(_0x86d923,null))[_0x8b45('0x43')](handleError(_0x86d923,null));};exports[_0x8b45('0x5e')]=function(_0x23247d,_0x1ee3b8,_0x235f8e){var _0x341c8e;return db[_0x8b45('0x26')]['find']({'where':{'id':_0x23247d[_0x8b45('0x41')]['id']}})[_0x8b45('0x24')](handleEntityNotFound(_0x1ee3b8,null))['then'](function(_0x332846){if(_0x332846){return _0x332846[_0x8b45('0x5e')](_0x23247d[_0x8b45('0x2a')][_0x8b45('0x59')])[_0x8b45('0x24')](function(_0x513f66){if(_[_0x8b45('0x6b')](_0x23247d[_0x8b45('0x2a')][_0x8b45('0x59')])){for(var _0x38cc85=0x0;_0x38cc85<_0x23247d[_0x8b45('0x2a')]['ids']['length'];_0x38cc85+=0x1){socket[_0x8b45('0x61')](_0x8b45('0x6c'),{'UserId':_0x23247d['query'][_0x8b45('0x59')][_0x38cc85],'VoiceQueueId':_0x23247d[_0x8b45('0x41')]['id']});}}else{socket[_0x8b45('0x61')](_0x8b45('0x6c'),{'UserId':_0x23247d[_0x8b45('0x2a')]['ids'],'VoiceQueueId':_0x23247d[_0x8b45('0x41')]['id']});}});}})[_0x8b45('0x24')](function(_0x2465f2){if(_0x23247d[_0x8b45('0x2a')]['realtime']){_0x341c8e=_0x2465f2;return db[_0x8b45('0x65')][_0x8b45('0x4b')]({'where':{'VoiceQueueId':_0x23247d[_0x8b45('0x41')]['id'],'UserId':_0x23247d[_0x8b45('0x2a')][_0x8b45('0x59')]}})['then'](function(){return _0x341c8e;});}})[_0x8b45('0x24')](respondWithStatusCode(_0x1ee3b8,null))[_0x8b45('0x43')](handleError(_0x1ee3b8,null));};exports[_0x8b45('0x6d')]=function(_0x5720ad,_0x21197e,_0x44868e){var _0x33cc40={};var _0x4627be={};var _0x270ce5;var _0x858966;return db[_0x8b45('0x26')]['findOne']({'where':{'id':_0x5720ad[_0x8b45('0x41')]['id']}})['then'](handleEntityNotFound(_0x21197e,null))[_0x8b45('0x24')](function(_0x3d7bec){if(_0x3d7bec){_0x270ce5=_0x3d7bec;_0x4627be[_0x8b45('0x2e')]=_[_0x8b45('0x28')](db[_0x8b45('0x5a')][_0x8b45('0x27')]);_0x4627be['query']=_['keys'](_0x5720ad['query']);_0x4627be[_0x8b45('0x2c')]=_['intersection'](_0x4627be['model'],_0x4627be[_0x8b45('0x2a')]);_0x33cc40[_0x8b45('0x2f')]=_[_0x8b45('0x2d')](_0x4627be['model'],qs['fields'](_0x5720ad[_0x8b45('0x2a')][_0x8b45('0x30')]));_0x33cc40[_0x8b45('0x2f')]=_0x33cc40[_0x8b45('0x2f')][_0x8b45('0x31')]?_0x33cc40[_0x8b45('0x2f')]:_0x4627be[_0x8b45('0x2e')];_0x33cc40[_0x8b45('0x33')]=qs['sort'](_0x5720ad[_0x8b45('0x2a')]['sort']);_0x33cc40[_0x8b45('0x35')]=qs['filters'](_[_0x8b45('0x52')](_0x5720ad['query'],_0x4627be[_0x8b45('0x2c')]));if(_0x5720ad['query'][_0x8b45('0x39')]){_0x33cc40[_0x8b45('0x35')]=_['merge'](_0x33cc40['where'],{'$or':_[_0x8b45('0x38')](_0x33cc40[_0x8b45('0x2f')],function(_0x4d9c5d){var _0x37cb93={};_0x37cb93[_0x4d9c5d]={'$like':'%'+_0x5720ad[_0x8b45('0x2a')][_0x8b45('0x39')]+'%'};return _0x37cb93;})});}_0x33cc40=_[_0x8b45('0x3a')]({},_0x33cc40,_0x5720ad[_0x8b45('0x3b')]);return _0x270ce5['getAgents'](_0x33cc40);}})[_0x8b45('0x24')](function(_0xbc0cde){if(_0xbc0cde){_0x858966=_0xbc0cde[_0x8b45('0x31')];if(!_0x5720ad[_0x8b45('0x2a')][_0x8b45('0x51')](_0x8b45('0x32'))){_0x33cc40[_0x8b45('0x21')]=qs['limit'](_0x5720ad[_0x8b45('0x2a')][_0x8b45('0x21')]);_0x33cc40[_0x8b45('0x20')]=qs[_0x8b45('0x20')](_0x5720ad['query'][_0x8b45('0x20')]);}return _0x270ce5[_0x8b45('0x6d')](_0x33cc40);}})[_0x8b45('0x24')](function(_0x1f527f){if(_0x1f527f){return _0x1f527f?{'count':_0x858966,'rows':_0x1f527f}:null;}})[_0x8b45('0x24')](respondWithResult(_0x21197e,null))[_0x8b45('0x43')](handleError(_0x21197e,null));};exports['getMembers']=function(_0x51fea3,_0x4e9b15,_0x3cf91e){var _0x332f81={};var _0x4cd681={};var _0xbef88;var _0x552e87;return db[_0x8b45('0x26')]['findOne']({'where':{'id':_0x51fea3[_0x8b45('0x41')]['id']}})[_0x8b45('0x24')](handleEntityNotFound(_0x4e9b15,null))[_0x8b45('0x24')](function(_0x1af3b5){if(_0x1af3b5){_0xbef88=_0x1af3b5;_0x4cd681[_0x8b45('0x2e')]=_[_0x8b45('0x28')](db['UserVoiceQueueRt'][_0x8b45('0x27')]);_0x4cd681['query']=_['keys'](_0x51fea3[_0x8b45('0x2a')]);_0x4cd681[_0x8b45('0x2c')]=_[_0x8b45('0x2d')](_0x4cd681[_0x8b45('0x2e')],_0x4cd681['query']);_0x332f81['attributes']=_['intersection'](_0x4cd681['model'],qs[_0x8b45('0x30')](_0x51fea3[_0x8b45('0x2a')][_0x8b45('0x30')]));_0x332f81[_0x8b45('0x2f')]=_0x332f81[_0x8b45('0x2f')][_0x8b45('0x31')]?_0x332f81[_0x8b45('0x2f')]:_0x4cd681[_0x8b45('0x2e')];_0x332f81[_0x8b45('0x33')]=qs['sort'](_0x51fea3['query']['sort']);_0x332f81[_0x8b45('0x35')]=qs[_0x8b45('0x2c')](_[_0x8b45('0x52')](_0x51fea3[_0x8b45('0x2a')],_0x4cd681['filters']));if(_0x51fea3['query'][_0x8b45('0x39')]){_0x332f81['where']=_[_0x8b45('0x3a')](_0x332f81[_0x8b45('0x35')],{'$or':_[_0x8b45('0x38')](_0x332f81[_0x8b45('0x2f')],function(_0x3f4b2b){var _0x491619={};_0x491619[_0x3f4b2b]={'$like':'%'+_0x51fea3[_0x8b45('0x2a')][_0x8b45('0x39')]+'%'};return _0x491619;})});}_0x332f81=_[_0x8b45('0x3a')]({},_0x332f81,_0x51fea3['options']);return _0xbef88[_0x8b45('0x6e')](_0x332f81);}})[_0x8b45('0x24')](function(_0x3a5a1e){if(_0x3a5a1e){_0x552e87=_0x3a5a1e['length'];if(!_0x51fea3[_0x8b45('0x2a')]['hasOwnProperty'](_0x8b45('0x32'))){_0x332f81[_0x8b45('0x21')]=qs[_0x8b45('0x21')](_0x51fea3[_0x8b45('0x2a')]['limit']);_0x332f81[_0x8b45('0x20')]=qs[_0x8b45('0x20')](_0x51fea3[_0x8b45('0x2a')][_0x8b45('0x20')]);}return _0xbef88[_0x8b45('0x6e')](_0x332f81);}})[_0x8b45('0x24')](function(_0x55b93d){return _0x55b93d?{'count':_0x552e87,'rows':_0x55b93d}:null;})[_0x8b45('0x24')](respondWithResult(_0x4e9b15,null))[_0x8b45('0x43')](handleError(_0x4e9b15,null));};exports['getLists']=function(_0x4161b9,_0x34939f,_0x21c5a1){var _0x44ad01={};var _0x32407d={};var _0x2e634e;var _0x1f3d9d;return db[_0x8b45('0x26')]['findOne']({'where':{'id':_0x4161b9['params']['id']}})[_0x8b45('0x24')](handleEntityNotFound(_0x34939f,null))['then'](function(_0x2a65b2){if(_0x2a65b2){_0x2e634e=_0x2a65b2;_0x32407d[_0x8b45('0x2e')]=_[_0x8b45('0x28')](db[_0x8b45('0x6f')]['rawAttributes']);_0x32407d[_0x8b45('0x2a')]=_['keys'](_0x4161b9[_0x8b45('0x2a')]);_0x32407d[_0x8b45('0x2c')]=_[_0x8b45('0x2d')](_0x32407d[_0x8b45('0x2e')],_0x32407d[_0x8b45('0x2a')]);_0x44ad01[_0x8b45('0x2f')]=_[_0x8b45('0x2d')](_0x32407d[_0x8b45('0x2e')],qs['fields'](_0x4161b9[_0x8b45('0x2a')][_0x8b45('0x30')]));_0x44ad01[_0x8b45('0x2f')]=_0x44ad01[_0x8b45('0x2f')]['length']?_0x44ad01[_0x8b45('0x2f')]:_0x32407d[_0x8b45('0x2e')];_0x44ad01[_0x8b45('0x33')]=qs[_0x8b45('0x34')](_0x4161b9[_0x8b45('0x2a')][_0x8b45('0x34')]);_0x44ad01[_0x8b45('0x35')]=qs[_0x8b45('0x2c')](_[_0x8b45('0x52')](_0x4161b9[_0x8b45('0x2a')],_0x32407d[_0x8b45('0x2c')]));if(_0x4161b9[_0x8b45('0x2a')][_0x8b45('0x39')]){_0x44ad01[_0x8b45('0x35')]=_['merge'](_0x44ad01[_0x8b45('0x35')],{'$or':_[_0x8b45('0x38')](_0x44ad01[_0x8b45('0x2f')],function(_0x58cb32){var _0x4570d1={};_0x4570d1[_0x58cb32]={'$like':'%'+_0x4161b9[_0x8b45('0x2a')]['filter']+'%'};return _0x4570d1;})});}_0x44ad01=_[_0x8b45('0x3a')]({},_0x44ad01,_0x4161b9[_0x8b45('0x3b')]);return _0x2e634e['getLists'](_0x44ad01);}})[_0x8b45('0x24')](function(_0x1fe686){if(_0x1fe686){_0x1f3d9d=_0x1fe686[_0x8b45('0x31')];if(!_0x4161b9[_0x8b45('0x2a')][_0x8b45('0x51')](_0x8b45('0x32'))){_0x44ad01['limit']=qs[_0x8b45('0x21')](_0x4161b9['query']['limit']);_0x44ad01[_0x8b45('0x20')]=qs[_0x8b45('0x20')](_0x4161b9[_0x8b45('0x2a')][_0x8b45('0x20')]);}return _0x2e634e['getLists'](_0x44ad01);}})['then'](function(_0x243f26){if(_0x243f26){return _0x243f26?{'count':_0x1f3d9d,'rows':_0x243f26}:null;}})['then'](respondWithResult(_0x34939f,null))[_0x8b45('0x43')](handleError(_0x34939f,null));};exports['addLists']=function(_0xdb711b,_0x397096,_0x159368){var _0x4c71ec,_0x89db45;return db[_0x8b45('0x26')][_0x8b45('0x42')]({'where':{'id':_0xdb711b[_0x8b45('0x41')]['id']}})['then'](handleEntityNotFound(_0x397096,null))['then'](function(_0x249839){if(_0x249839){_0x89db45=_0x249839;return _0x249839[_0x8b45('0x70')](_0xdb711b[_0x8b45('0x45')][_0x8b45('0x59')],_[_0x8b45('0x48')](_0xdb711b[_0x8b45('0x45')],[_0x8b45('0x59'),'id'])||{});}return null;})[_0x8b45('0x60')](function(_0x648f91){var _0x3542fc;_0x4c71ec=_0x648f91||[];var _0x553906=[];if(_0x648f91){for(var _0x54694b=0x0;_0x54694b<_0x648f91['length'];_0x54694b+=0x1){var _0x523077=_0x648f91[_0x54694b][_0x8b45('0x47')]({'plain':!![]});_0x89db45['dialCheckDuplicateType']=_0xdb711b[_0x8b45('0x45')][_0x8b45('0x71')]?_0xdb711b[_0x8b45('0x45')][_0x8b45('0x71')]:_0x89db45[_0x8b45('0x71')];switch(_0x89db45[_0x8b45('0x71')]){case'always':_0x3542fc=squel[_0x8b45('0x72')]()[_0x8b45('0x73')](_0x8b45('0x74'))[_0x8b45('0x75')]([_0x8b45('0x76'),_0x8b45('0x77'),_0x8b45('0x78'),'ListId',_0x8b45('0x4e'),'createdAt',_0x8b45('0x4a')],squel[_0x8b45('0x79')]()[_0x8b45('0x7a')](_0x8b45('0x76'),_0x8b45('0x76'))[_0x8b45('0x7a')](_0x8b45('0x7b'),_0x8b45('0x77'))[_0x8b45('0x7a')]('id',_0x8b45('0x78'))[_0x8b45('0x7a')](_0x523077[_0x8b45('0x7c')][_0x8b45('0x7d')](),'ListId')[_0x8b45('0x7a')](_0xdb711b[_0x8b45('0x41')]['id'][_0x8b45('0x7d')](),_0x8b45('0x4e'))['field']('NOW()',_0x8b45('0x49'))[_0x8b45('0x7a')](_0x8b45('0x7b'),_0x8b45('0x4a'))[_0x8b45('0x7e')]('cm_contacts')[_0x8b45('0x35')](_0x8b45('0x7f'))[_0x8b45('0x35')](_0x8b45('0x80'),_0x523077[_0x8b45('0x7c')][_0x8b45('0x7d')]())[_0x8b45('0x35')](_0x8b45('0x81'))[_0x8b45('0x35')](_0x8b45('0x82'),squel['select']()[_0x8b45('0x7a')](_0x8b45('0x83'))[_0x8b45('0x7e')](_0x8b45('0x84'))[_0x8b45('0x35')](_0x8b45('0x85'),_0xdb711b[_0x8b45('0x41')]['id'][_0x8b45('0x7d')]()))[_0x8b45('0x35')](_0x8b45('0x82'),squel['select']()['field'](_0x8b45('0x76'))[_0x8b45('0x7e')]('cm_hopper')['where'](_0x8b45('0x85'),_0xdb711b[_0x8b45('0x41')]['id'][_0x8b45('0x7d')]())))[_0x8b45('0x7d')]();break;case _0x8b45('0x86'):_0x3542fc=squel['insert']()[_0x8b45('0x73')]('cm_hopper')[_0x8b45('0x75')]([_0x8b45('0x76'),_0x8b45('0x77'),_0x8b45('0x78'),_0x8b45('0x87'),_0x8b45('0x4e'),_0x8b45('0x49'),_0x8b45('0x4a')],squel[_0x8b45('0x79')]()[_0x8b45('0x7a')](_0x8b45('0x76'),_0x8b45('0x76'))[_0x8b45('0x7a')](_0x8b45('0x7b'),_0x8b45('0x77'))['field']('id',_0x8b45('0x78'))[_0x8b45('0x7a')](_0x523077[_0x8b45('0x7c')][_0x8b45('0x7d')](),_0x8b45('0x87'))[_0x8b45('0x7a')](_0xdb711b[_0x8b45('0x41')]['id']['toString'](),_0x8b45('0x4e'))[_0x8b45('0x7a')](_0x8b45('0x7b'),_0x8b45('0x49'))[_0x8b45('0x7a')]('NOW()',_0x8b45('0x4a'))[_0x8b45('0x7e')](_0x8b45('0x88'))['where'](_0x8b45('0x7f'))[_0x8b45('0x35')](_0x8b45('0x80'),_0x523077[_0x8b45('0x7c')][_0x8b45('0x7d')]())[_0x8b45('0x35')](_0x8b45('0x81'))[_0x8b45('0x35')](_0x8b45('0x82'),squel[_0x8b45('0x79')]()[_0x8b45('0x7a')](_0x8b45('0x76'))[_0x8b45('0x7e')](_0x8b45('0x74'))['where'](_0x8b45('0x85'),_0xdb711b[_0x8b45('0x41')]['id'][_0x8b45('0x7d')]())))['toString']();break;default:_0x3542fc=squel[_0x8b45('0x72')]()['into'](_0x8b45('0x74'))[_0x8b45('0x75')]([_0x8b45('0x76'),_0x8b45('0x77'),'ContactId',_0x8b45('0x87'),_0x8b45('0x4e'),'createdAt','updatedAt'],squel['select']()[_0x8b45('0x7a')](_0x8b45('0x76'),'phone')[_0x8b45('0x7a')](_0x8b45('0x7b'),_0x8b45('0x77'))[_0x8b45('0x7a')]('id',_0x8b45('0x78'))[_0x8b45('0x7a')](_0x523077[_0x8b45('0x7c')][_0x8b45('0x7d')](),_0x8b45('0x87'))[_0x8b45('0x7a')](_0xdb711b[_0x8b45('0x41')]['id']['toString'](),_0x8b45('0x4e'))[_0x8b45('0x7a')]('NOW()','createdAt')['field'](_0x8b45('0x7b'),_0x8b45('0x4a'))[_0x8b45('0x7e')](_0x8b45('0x88'))[_0x8b45('0x35')](_0x8b45('0x7f'))[_0x8b45('0x35')](_0x8b45('0x80'),_0x523077[_0x8b45('0x7c')][_0x8b45('0x7d')]())[_0x8b45('0x35')](_0x8b45('0x81')))[_0x8b45('0x7d')]();}_0x553906['push'](db[_0x8b45('0x89')][_0x8b45('0x2a')](_0x3542fc));}return BPromise[_0x8b45('0x6a')](_0x553906);}})[_0x8b45('0x24')](function(){return _0x4c71ec;})[_0x8b45('0x24')](respondWithResult(_0x397096,null))[_0x8b45('0x43')](handleError(_0x397096,null));};exports[_0x8b45('0x8a')]=function(_0x4e572b,_0x167ecc,_0x1ffac8){var _0x19c12f;return db[_0x8b45('0x26')]['find']({'where':{'id':_0x4e572b['params']['id']}})[_0x8b45('0x24')](handleEntityNotFound(_0x167ecc,null))[_0x8b45('0x24')](function(_0x22ca77){if(_0x22ca77){return _0x22ca77[_0x8b45('0x8a')](_0x4e572b[_0x8b45('0x2a')][_0x8b45('0x59')]);}})['then'](function(_0x31fbb7){if(_0x31fbb7){_0x19c12f=_0x31fbb7;return db[_0x8b45('0x4d')][_0x8b45('0x4b')]({'where':{'ListId':_0x4e572b[_0x8b45('0x2a')][_0x8b45('0x59')],'VoiceQueueId':_0x4e572b[_0x8b45('0x41')]['id']}})[_0x8b45('0x24')](function(){return _0x19c12f;});}})[_0x8b45('0x24')](respondWithStatusCode(_0x167ecc,null))[_0x8b45('0x43')](handleError(_0x167ecc,null));};exports[_0x8b45('0x8b')]=function(_0x1dc735,_0x1b5cc2,_0x46293e){var _0x23adfa={};var _0x5bab0c={};var _0x32817c;var _0x4d6ef3;return db[_0x8b45('0x26')][_0x8b45('0x4c')]({'where':{'id':_0x1dc735[_0x8b45('0x41')]['id']}})['then'](handleEntityNotFound(_0x1b5cc2,null))[_0x8b45('0x24')](function(_0x39a04d){if(_0x39a04d){_0x32817c=_0x39a04d;_0x5bab0c[_0x8b45('0x2e')]=_[_0x8b45('0x28')](db[_0x8b45('0x6f')]['rawAttributes']);_0x5bab0c[_0x8b45('0x2a')]=_[_0x8b45('0x28')](_0x1dc735[_0x8b45('0x2a')]);_0x5bab0c[_0x8b45('0x2c')]=_[_0x8b45('0x2d')](_0x5bab0c[_0x8b45('0x2e')],_0x5bab0c[_0x8b45('0x2a')]);_0x23adfa[_0x8b45('0x2f')]=_[_0x8b45('0x2d')](_0x5bab0c[_0x8b45('0x2e')],qs[_0x8b45('0x30')](_0x1dc735[_0x8b45('0x2a')][_0x8b45('0x30')]));_0x23adfa['attributes']=_0x23adfa['attributes']['length']?_0x23adfa[_0x8b45('0x2f')]:_0x5bab0c['model'];_0x23adfa[_0x8b45('0x33')]=qs['sort'](_0x1dc735['query'][_0x8b45('0x34')]);_0x23adfa[_0x8b45('0x35')]=qs[_0x8b45('0x2c')](_['pick'](_0x1dc735['query'],_0x5bab0c[_0x8b45('0x2c')]));if(_0x1dc735[_0x8b45('0x2a')][_0x8b45('0x39')]){_0x23adfa[_0x8b45('0x35')]=_['merge'](_0x23adfa[_0x8b45('0x35')],{'$or':_['map'](_0x23adfa[_0x8b45('0x2f')],function(_0x5574d4){var _0x3adef7={};_0x3adef7[_0x5574d4]={'$like':'%'+_0x1dc735[_0x8b45('0x2a')][_0x8b45('0x39')]+'%'};return _0x3adef7;})});}_0x23adfa=_[_0x8b45('0x3a')]({},_0x23adfa,_0x1dc735[_0x8b45('0x3b')]);return _0x32817c[_0x8b45('0x8b')](_0x23adfa);}})[_0x8b45('0x24')](function(_0x391094){if(_0x391094){_0x4d6ef3=_0x391094[_0x8b45('0x31')];if(!_0x1dc735[_0x8b45('0x2a')][_0x8b45('0x51')](_0x8b45('0x32'))){_0x23adfa['limit']=qs[_0x8b45('0x21')](_0x1dc735[_0x8b45('0x2a')]['limit']);_0x23adfa[_0x8b45('0x20')]=qs[_0x8b45('0x20')](_0x1dc735['query'][_0x8b45('0x20')]);}return _0x32817c['getBlackLists'](_0x23adfa);}})[_0x8b45('0x24')](function(_0x40c93e){if(_0x40c93e){return _0x40c93e?{'count':_0x4d6ef3,'rows':_0x40c93e}:null;}})[_0x8b45('0x24')](respondWithResult(_0x1b5cc2,null))[_0x8b45('0x43')](handleError(_0x1b5cc2,null));};exports[_0x8b45('0x8c')]=function(_0x26ba09,_0x39c882,_0x2e84fc){var _0x21643e,_0x442d7f;return db['VoiceQueue'][_0x8b45('0x42')]({'where':{'id':_0x26ba09['params']['id']}})[_0x8b45('0x24')](handleEntityNotFound(_0x39c882,null))[_0x8b45('0x24')](function(_0x506155){if(_0x506155){_0x442d7f=_0x506155;return _0x506155[_0x8b45('0x8c')](_0x26ba09[_0x8b45('0x45')]['ids'],_['omit'](_0x26ba09[_0x8b45('0x45')],[_0x8b45('0x59'),'id'])||{});}return null;})[_0x8b45('0x60')](function(_0x29d65e){var _0x41c178;_0x21643e=_0x29d65e||[];var _0x223f23=[];if(_0x29d65e){for(var _0xd49972=0x0;_0xd49972<_0x29d65e[_0x8b45('0x31')];_0xd49972+=0x1){var _0x32a3a5=_0x29d65e[_0xd49972][_0x8b45('0x47')]({'plain':!![]});_0x41c178=squel['insert']()['into'](_0x8b45('0x8d'))[_0x8b45('0x75')]([_0x8b45('0x76'),_0x8b45('0x78'),'ListId',_0x8b45('0x4e'),_0x8b45('0x49'),'updatedAt'],squel[_0x8b45('0x79')]()[_0x8b45('0x7a')](_0x8b45('0x76'),_0x8b45('0x76'))[_0x8b45('0x7a')]('id',_0x8b45('0x78'))['field'](_0x32a3a5[_0x8b45('0x7c')][_0x8b45('0x7d')](),_0x8b45('0x87'))[_0x8b45('0x7a')](_0x26ba09[_0x8b45('0x41')]['id'][_0x8b45('0x7d')](),'VoiceQueueId')[_0x8b45('0x7a')](_0x8b45('0x7b'),_0x8b45('0x49'))[_0x8b45('0x7a')](_0x8b45('0x7b'),_0x8b45('0x4a'))[_0x8b45('0x7e')](_0x8b45('0x88'))[_0x8b45('0x35')]('deletedAt\x20IS\x20NULL')[_0x8b45('0x35')](_0x8b45('0x80'),_0x32a3a5[_0x8b45('0x7c')][_0x8b45('0x7d')]())[_0x8b45('0x35')](_0x8b45('0x81')))[_0x8b45('0x7d')]();_0x223f23[_0x8b45('0x8e')](db['sequelize']['query'](_0x41c178));}return BPromise['all'](_0x223f23);}})[_0x8b45('0x24')](function(){return _0x21643e;})[_0x8b45('0x24')](respondWithResult(_0x39c882,null))[_0x8b45('0x43')](handleError(_0x39c882,null));};exports['removeBlackLists']=function(_0x8305ba,_0x334dde,_0x1bbf6b){var _0x43d7d0;return db['VoiceQueue'][_0x8b45('0x42')]({'where':{'id':_0x8305ba['params']['id']}})[_0x8b45('0x24')](handleEntityNotFound(_0x334dde,null))['then'](function(_0x30fd64){if(_0x30fd64){return _0x30fd64[_0x8b45('0x8f')](_0x8305ba['query'][_0x8b45('0x59')]);}})[_0x8b45('0x24')](function(_0x55b066){if(_0x55b066){_0x43d7d0=_0x55b066;return db[_0x8b45('0x55')][_0x8b45('0x4b')]({'where':{'ListId':_0x8305ba[_0x8b45('0x2a')][_0x8b45('0x59')],'VoiceQueueId':_0x8305ba[_0x8b45('0x41')]['id']}})[_0x8b45('0x24')](function(){return _0x43d7d0;});}})['then'](respondWithStatusCode(_0x334dde,null))['catch'](handleError(_0x334dde,null));}; \ No newline at end of file +var _0x4e6e=['then','destroy','name','send','index','VoiceQueue','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','add','day','merge','filter','map','includeAll','rows','catch','params','fields','options','find','create','body','clone','length','omit','createdAt','updatedAt','update','getHoppers','pick','VoiceQueueId','CmHopper','include','findAll','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','order','CmHopperBlack','getTeams','addTeams','ids','User','Agents','penalty','removeTeams','union','addAgents','spread','emit','userVoiceQueue:save','voicePause','push','UserVoiceQueueRt','upsert','isNil','interface','format','SIP/%s','removeAgents','isArray','userVoiceQueue:remove','realtime','getAgents','getMembers','CmList','getLists','addLists','get','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','field','phone','NOW()','ContactId','from','toString','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper_final','VoiceQueueId\x20=\x20?','onlyIfOpen','ListId','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','sequelize','all','removeLists','getBlackLists','addBlackLists','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','count','offset','limit','set','json','apply','reject','save'];(function(_0x2d284c,_0x59aa64){var _0x4f5756=function(_0x2f110e){while(--_0x2f110e){_0x2d284c['push'](_0x2d284c['shift']());}};_0x4f5756(++_0x59aa64);}(_0x4e6e,0x70));var _0xe4e6=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x4e6e[_0x2faddb];return _0x273c05;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe4e6('0x0'));var rimraf=require(_0xe4e6('0x1'));var zipdir=require(_0xe4e6('0x2'));var jsonpatch=require(_0xe4e6('0x3'));var rp=require(_0xe4e6('0x4'));var moment=require(_0xe4e6('0x5'));var BPromise=require(_0xe4e6('0x6'));var Mustache=require(_0xe4e6('0x7'));var util=require(_0xe4e6('0x8'));var path=require(_0xe4e6('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe4e6('0xa'));var fs=require('fs');var _=require(_0xe4e6('0xb'));var squel=require(_0xe4e6('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe4e6('0xd'));var querystring=require(_0xe4e6('0xe'));var Papa=require(_0xe4e6('0xf'));var Redis=require(_0xe4e6('0x10'));var qs=require(_0xe4e6('0x11'));var logger=require(_0xe4e6('0x12'))('api');var utils=require(_0xe4e6('0x13'));var config=require(_0xe4e6('0x14'));var db=require(_0xe4e6('0x15'))['db'];config[_0xe4e6('0x16')]=_[_0xe4e6('0x17')](config[_0xe4e6('0x16')],{'host':_0xe4e6('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueue.socket')[_0xe4e6('0x19')](socket);function respondWithStatusCode(_0x5223d8,_0x3efb8e){_0x3efb8e=_0x3efb8e||0xcc;return function(_0x2fc417){if(_0x2fc417){return _0x5223d8[_0xe4e6('0x1a')](_0x3efb8e);}return _0x5223d8[_0xe4e6('0x1b')](_0x3efb8e)['end']();};}function respondWithResult(_0x2c385e,_0x3638fd){_0x3638fd=_0x3638fd||0xc8;return function(_0x3b15bb){if(_0x3b15bb){return _0x2c385e[_0xe4e6('0x1b')](_0x3638fd)['json'](_0x3b15bb);}};}function respondWithFilteredResult(_0x264d97,_0x62d79e){return function(_0x3dbd42){if(_0x3dbd42){var _0x1c0bd7=_0x3dbd42[_0xe4e6('0x1c')],_0x3d58dd=_0x62d79e[_0xe4e6('0x1d')],_0x2e6c1c=_0x62d79e['offset']+_0x62d79e[_0xe4e6('0x1e')],_0x263ba4;if(_0x2e6c1c>=_0x1c0bd7){_0x2e6c1c=_0x1c0bd7;_0x263ba4=0xc8;}else{_0x263ba4=0xce;}_0x264d97[_0xe4e6('0x1b')](_0x263ba4);return _0x264d97[_0xe4e6('0x1f')]('Content-Range',_0x3d58dd+'-'+_0x2e6c1c+'/'+_0x1c0bd7)[_0xe4e6('0x20')](_0x3dbd42);}return null;};}function patchUpdates(_0x6c9c6){return function(_0x79efe8){try{jsonpatch[_0xe4e6('0x21')](_0x79efe8,_0x6c9c6,!![]);}catch(_0x4bb01c){return BPromise[_0xe4e6('0x22')](_0x4bb01c);}return _0x79efe8[_0xe4e6('0x23')]();};}function saveUpdates(_0x41cc95,_0xd1c266){return function(_0x2256bf){if(_0x2256bf){return _0x2256bf['update'](_0x41cc95)[_0xe4e6('0x24')](function(_0x3d5f88){return _0x3d5f88;});}return null;};}function removeEntity(_0x41594f,_0x2cd18a){return function(_0xc9287b){if(_0xc9287b){return _0xc9287b[_0xe4e6('0x25')]()[_0xe4e6('0x24')](function(){_0x41594f[_0xe4e6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x414639,_0x3f9efe){return function(_0x2c39dd){if(!_0x2c39dd){_0x414639[_0xe4e6('0x1a')](0x194);}return _0x2c39dd;};}function handleError(_0x530425,_0x252ba9){_0x252ba9=_0x252ba9||0x1f4;return function(_0x18b5f5){logger['error'](_0x18b5f5['stack']);if(_0x18b5f5[_0xe4e6('0x26')]){delete _0x18b5f5['name'];}_0x530425[_0xe4e6('0x1b')](_0x252ba9)[_0xe4e6('0x27')](_0x18b5f5);};}exports[_0xe4e6('0x28')]=function(_0x3eef9a,_0x4a35b3){var _0xee4683={},_0x489919={},_0x4065e9={'count':0x0,'rows':[]};var _0x13281f=db[_0xe4e6('0x29')][_0xe4e6('0x2a')];_0x489919[_0xe4e6('0x2b')]=_[_0xe4e6('0x2c')](_0x13281f);var _0x8e3598={'dateStart':_0x3eef9a[_0xe4e6('0x2d')][_0xe4e6('0x2e')],'dateEnd':_0x3eef9a['query'][_0xe4e6('0x2f')]};delete _0x3eef9a[_0xe4e6('0x2d')][_0xe4e6('0x2e')];delete _0x3eef9a[_0xe4e6('0x2d')][_0xe4e6('0x2f')];_0x489919[_0xe4e6('0x2d')]=_[_0xe4e6('0x2c')](_0x3eef9a[_0xe4e6('0x2d')]);_0x489919[_0xe4e6('0x30')]=_[_0xe4e6('0x31')](_0x489919[_0xe4e6('0x2b')],_0x489919[_0xe4e6('0x2d')]);_0xee4683[_0xe4e6('0x32')]=_['intersection'](_0x489919[_0xe4e6('0x2b')],qs['fields'](_0x3eef9a[_0xe4e6('0x2d')]['fields']));_0xee4683[_0xe4e6('0x32')]=_0xee4683[_0xe4e6('0x32')]['length']?_0xee4683['attributes']:_0x489919[_0xe4e6('0x2b')];if(!_0x3eef9a[_0xe4e6('0x2d')][_0xe4e6('0x33')](_0xe4e6('0x34'))){_0xee4683[_0xe4e6('0x1e')]=qs[_0xe4e6('0x1e')](_0x3eef9a['query'][_0xe4e6('0x1e')]);_0xee4683[_0xe4e6('0x1d')]=qs[_0xe4e6('0x1d')](_0x3eef9a[_0xe4e6('0x2d')][_0xe4e6('0x1d')]);}_0xee4683['order']=qs[_0xe4e6('0x35')](_0x3eef9a[_0xe4e6('0x2d')]['sort']);_0xee4683[_0xe4e6('0x36')]=qs['filters'](_['pick'](_0x3eef9a[_0xe4e6('0x2d')],_0x489919[_0xe4e6('0x30')]));if(_0x8e3598[_0xe4e6('0x2e')]){if(_0x8e3598['dateEnd']){_0x8e3598['dateEnd']=moment(_0x8e3598[_0xe4e6('0x2f')])[_0xe4e6('0x37')](0x1,_0xe4e6('0x38'));}else{_0x8e3598[_0xe4e6('0x2f')]=moment(_0x8e3598[_0xe4e6('0x2e')])[_0xe4e6('0x37')](0x1,_0xe4e6('0x38'));}_[_0xe4e6('0x39')](_0xee4683[_0xe4e6('0x36')],{'createdAt':{'$gte':_0x8e3598['dateStart'],'$lte':_0x8e3598[_0xe4e6('0x2f')]}});}if(_0x3eef9a[_0xe4e6('0x2d')][_0xe4e6('0x3a')]){_0xee4683['where']=_['merge'](_0xee4683['where'],{'$or':_[_0xe4e6('0x3b')](_0xee4683['attributes'],function(_0x382a73){var _0x4ea717={};_0x4ea717[_0x382a73]={'$like':'%'+_0x3eef9a[_0xe4e6('0x2d')][_0xe4e6('0x3a')]+'%'};return _0x4ea717;})});}_0xee4683=_[_0xe4e6('0x39')]({},_0xee4683,_0x3eef9a['options']);var _0x3026c0={'where':_0xee4683[_0xe4e6('0x36')]};return db[_0xe4e6('0x29')][_0xe4e6('0x1c')](_0x3026c0)['then'](function(_0x3d7b0d){_0x4065e9['count']=_0x3d7b0d;if(_0x3eef9a[_0xe4e6('0x2d')][_0xe4e6('0x3c')]){_0xee4683['include']=[{'all':!![]}];}return db[_0xe4e6('0x29')]['findAll'](_0xee4683);})['then'](function(_0x5ac910){_0x4065e9[_0xe4e6('0x3d')]=_0x5ac910;return _0x4065e9;})['then'](respondWithFilteredResult(_0x4a35b3,_0xee4683))[_0xe4e6('0x3e')](handleError(_0x4a35b3,null));};exports['show']=function(_0x34ff57,_0xe07a2b){var _0x32e5b0={'raw':![],'where':{'id':_0x34ff57[_0xe4e6('0x3f')]['id']}},_0x351e57={};_0x351e57[_0xe4e6('0x2b')]=_[_0xe4e6('0x2c')](db[_0xe4e6('0x29')]['rawAttributes']);_0x351e57[_0xe4e6('0x2d')]=_[_0xe4e6('0x2c')](_0x34ff57[_0xe4e6('0x2d')]);_0x351e57['filters']=_[_0xe4e6('0x31')](_0x351e57['model'],_0x351e57[_0xe4e6('0x2d')]);_0x32e5b0[_0xe4e6('0x32')]=_['intersection'](_0x351e57[_0xe4e6('0x2b')],qs[_0xe4e6('0x40')](_0x34ff57['query'][_0xe4e6('0x40')]));_0x32e5b0[_0xe4e6('0x32')]=_0x32e5b0[_0xe4e6('0x32')]['length']?_0x32e5b0['attributes']:_0x351e57[_0xe4e6('0x2b')];if(_0x34ff57[_0xe4e6('0x2d')][_0xe4e6('0x3c')]){_0x32e5b0['include']=[{'all':!![]}];}_0x32e5b0=_['merge']({},_0x32e5b0,_0x34ff57[_0xe4e6('0x41')]);return db['VoiceQueue'][_0xe4e6('0x42')](_0x32e5b0)['then'](handleEntityNotFound(_0xe07a2b,null))[_0xe4e6('0x24')](respondWithResult(_0xe07a2b,null))[_0xe4e6('0x3e')](handleError(_0xe07a2b,null));};exports[_0xe4e6('0x43')]=function(_0x329a9d,_0x529589){return db['VoiceQueue'][_0xe4e6('0x43')](_0x329a9d[_0xe4e6('0x44')],{})['then'](respondWithResult(_0x529589,0xc9))[_0xe4e6('0x3e')](handleError(_0x529589,null));};exports[_0xe4e6('0x45')]=function(_0x2e9bdd,_0x165f68){var _0x36db4a={'raw':![],'where':{'id':_0x2e9bdd[_0xe4e6('0x3f')]['id']}},_0x270989={};_0x270989['model']=_['keys'](db[_0xe4e6('0x29')]['rawAttributes']);_0x36db4a[_0xe4e6('0x32')]=_[_0xe4e6('0x31')](_0x270989[_0xe4e6('0x2b')],qs[_0xe4e6('0x40')](_0x2e9bdd[_0xe4e6('0x2d')]['fields']));_0x36db4a[_0xe4e6('0x32')]=_0x36db4a[_0xe4e6('0x32')][_0xe4e6('0x46')]?_0x36db4a['attributes']:_0x270989[_0xe4e6('0x2b')];if(_0x2e9bdd[_0xe4e6('0x2d')][_0xe4e6('0x3c')]){_0x36db4a['include']=[{'all':!![]}];}_0x36db4a=_['merge']({},_0x36db4a,_0x2e9bdd[_0xe4e6('0x41')]);return db[_0xe4e6('0x29')][_0xe4e6('0x42')](_0x36db4a)[_0xe4e6('0x24')](handleEntityNotFound(_0x165f68,null))[_0xe4e6('0x24')](function(_0x93d75){if(_0x93d75){var _0x18b744=_0x93d75['get']({'plain':!![]});_0x18b744=qs[_0xe4e6('0x47')](_0x18b744,['id',_0xe4e6('0x48'),_0xe4e6('0x49')]);_0x2e9bdd['body']=_['omit'](_0x2e9bdd[_0xe4e6('0x44')],['id','createdAt','updatedAt']);return db[_0xe4e6('0x29')][_0xe4e6('0x43')](_['merge'](_0x18b744,_0x2e9bdd['body']),{'include':_0x2e9bdd['query']['includeAll']?[{'all':!![]}]:undefined});}})[_0xe4e6('0x24')](respondWithResult(_0x165f68,0xc9))[_0xe4e6('0x3e')](handleError(_0x165f68,null));};exports[_0xe4e6('0x4a')]=function(_0x2c1ef1,_0x4ef102){if(_0x2c1ef1['body']['id']){delete _0x2c1ef1[_0xe4e6('0x44')]['id'];}return db[_0xe4e6('0x29')][_0xe4e6('0x42')]({'where':{'id':_0x2c1ef1[_0xe4e6('0x3f')]['id']}})[_0xe4e6('0x24')](handleEntityNotFound(_0x4ef102,null))[_0xe4e6('0x24')](saveUpdates(_0x2c1ef1[_0xe4e6('0x44')],null))[_0xe4e6('0x24')](respondWithResult(_0x4ef102,null))[_0xe4e6('0x3e')](handleError(_0x4ef102,null));};exports['destroy']=function(_0x98ccd8,_0x39e3f4){return db[_0xe4e6('0x29')]['find']({'where':{'id':_0x98ccd8[_0xe4e6('0x3f')]['id']}})[_0xe4e6('0x24')](handleEntityNotFound(_0x39e3f4,null))['then'](removeEntity(_0x39e3f4,null))[_0xe4e6('0x3e')](handleError(_0x39e3f4,null));};exports[_0xe4e6('0x4b')]=function(_0x3c3e16,_0xef9c1c,_0xe712d1){var _0x55970a={'raw':![],'where':{}};var _0x42b5e6={};var _0x2a30c2={'count':0x0,'rows':[]};return db[_0xe4e6('0x29')]['findOne']({'where':{'id':_0x3c3e16[_0xe4e6('0x3f')]['id']}})[_0xe4e6('0x24')](handleEntityNotFound(_0xef9c1c,null))['then'](function(_0x2ad3f0){if(_0x2ad3f0){_0x42b5e6[_0xe4e6('0x2b')]=_[_0xe4e6('0x2c')](db['CmHopper'][_0xe4e6('0x2a')]);_0x42b5e6[_0xe4e6('0x2d')]=_[_0xe4e6('0x2c')](_0x3c3e16['query']);_0x42b5e6[_0xe4e6('0x30')]=_[_0xe4e6('0x31')](_0x42b5e6[_0xe4e6('0x2b')],_0x42b5e6[_0xe4e6('0x2d')]);_0x55970a[_0xe4e6('0x32')]=_[_0xe4e6('0x31')](_0x42b5e6['model'],qs[_0xe4e6('0x40')](_0x3c3e16[_0xe4e6('0x2d')][_0xe4e6('0x40')]));_0x55970a[_0xe4e6('0x32')]=_0x55970a['attributes']['length']?_0x55970a['attributes']:_0x42b5e6[_0xe4e6('0x2b')];if(!_0x3c3e16[_0xe4e6('0x2d')][_0xe4e6('0x33')](_0xe4e6('0x34'))){_0x55970a[_0xe4e6('0x1e')]=qs[_0xe4e6('0x1e')](_0x3c3e16[_0xe4e6('0x2d')]['limit']);_0x55970a[_0xe4e6('0x1d')]=qs[_0xe4e6('0x1d')](_0x3c3e16['query'][_0xe4e6('0x1d')]);}_0x55970a['order']=qs[_0xe4e6('0x35')](_0x3c3e16['query'][_0xe4e6('0x35')]);_0x55970a[_0xe4e6('0x36')]=qs[_0xe4e6('0x30')](_[_0xe4e6('0x4c')](_0x3c3e16[_0xe4e6('0x2d')],_0x42b5e6['filters']));_0x55970a[_0xe4e6('0x36')][_0xe4e6('0x4d')]=_0x2ad3f0['id'];if(_0x3c3e16['query']['filter']){_0x55970a[_0xe4e6('0x36')]=_[_0xe4e6('0x39')](_0x55970a['where'],{'$or':_[_0xe4e6('0x3b')](_0x55970a[_0xe4e6('0x32')],function(_0x45daa2){var _0x512ee8={};_0x512ee8[_0x45daa2]={'$like':'%'+_0x3c3e16[_0xe4e6('0x2d')][_0xe4e6('0x3a')]+'%'};return _0x512ee8;})});}_0x55970a=_[_0xe4e6('0x39')]({},_0x55970a,_0x3c3e16[_0xe4e6('0x41')]);return db[_0xe4e6('0x4e')][_0xe4e6('0x1c')]({'where':_0x55970a[_0xe4e6('0x36')]})[_0xe4e6('0x24')](function(_0x3d81c3){_0x2a30c2[_0xe4e6('0x1c')]=_0x3d81c3;if(_0x3c3e16['query'][_0xe4e6('0x3c')]){_0x55970a[_0xe4e6('0x4f')]=[{'all':!![]}];}return db[_0xe4e6('0x4e')][_0xe4e6('0x50')](_0x55970a);})[_0xe4e6('0x24')](function(_0x4b7b5a){_0x2a30c2['rows']=_0x4b7b5a;return _0x2a30c2;});}})[_0xe4e6('0x24')](respondWithFilteredResult(_0xef9c1c,_0x55970a))[_0xe4e6('0x3e')](handleError(_0xef9c1c,null));};exports['getHopperHistories']=function(_0x44077c,_0x5483e0,_0x5e9662){var _0x2c95f2={'raw':!![],'where':{}};var _0x561463={};var _0x119fd1={'count':0x0,'rows':[]};return db[_0xe4e6('0x29')][_0xe4e6('0x51')]({'where':{'id':_0x44077c[_0xe4e6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5483e0,null))[_0xe4e6('0x24')](function(_0x7f70d8){if(_0x7f70d8){_0x561463[_0xe4e6('0x2b')]=_[_0xe4e6('0x2c')](db[_0xe4e6('0x52')][_0xe4e6('0x2a')]);_0x561463['query']=_['keys'](_0x44077c[_0xe4e6('0x2d')]);_0x561463[_0xe4e6('0x30')]=_[_0xe4e6('0x31')](_0x561463[_0xe4e6('0x2b')],_0x561463[_0xe4e6('0x2d')]);_0x2c95f2[_0xe4e6('0x32')]=_[_0xe4e6('0x31')](_0x561463[_0xe4e6('0x2b')],qs[_0xe4e6('0x40')](_0x44077c[_0xe4e6('0x2d')][_0xe4e6('0x40')]));_0x2c95f2[_0xe4e6('0x32')]=_0x2c95f2[_0xe4e6('0x32')][_0xe4e6('0x46')]?_0x2c95f2[_0xe4e6('0x32')]:_0x561463[_0xe4e6('0x2b')];if(!_0x44077c[_0xe4e6('0x2d')]['hasOwnProperty'](_0xe4e6('0x34'))){_0x2c95f2[_0xe4e6('0x1e')]=qs[_0xe4e6('0x1e')](_0x44077c[_0xe4e6('0x2d')][_0xe4e6('0x1e')]);_0x2c95f2[_0xe4e6('0x1d')]=qs['offset'](_0x44077c['query']['offset']);}_0x2c95f2['order']=qs['sort'](_0x44077c[_0xe4e6('0x2d')][_0xe4e6('0x35')]);_0x2c95f2['where']=qs['filters'](_['pick'](_0x44077c['query'],_0x561463[_0xe4e6('0x30')]));_0x2c95f2[_0xe4e6('0x36')][_0xe4e6('0x4d')]=_0x7f70d8['id'];if(_0x44077c[_0xe4e6('0x2d')][_0xe4e6('0x3a')]){_0x2c95f2[_0xe4e6('0x36')]=_[_0xe4e6('0x39')](_0x2c95f2[_0xe4e6('0x36')],{'$or':_[_0xe4e6('0x3b')](_0x2c95f2['attributes'],function(_0x32314c){var _0x1c8805={};_0x1c8805[_0x32314c]={'$like':'%'+_0x44077c['query'][_0xe4e6('0x3a')]+'%'};return _0x1c8805;})});}_0x2c95f2=_[_0xe4e6('0x39')]({},_0x2c95f2,_0x44077c['options']);return db[_0xe4e6('0x52')][_0xe4e6('0x1c')]({'where':_0x2c95f2[_0xe4e6('0x36')]})['then'](function(_0x42caf0){_0x119fd1['count']=_0x42caf0;if(_0x44077c['query'][_0xe4e6('0x3c')]){_0x2c95f2[_0xe4e6('0x4f')]=[{'all':!![]}];}return db[_0xe4e6('0x52')][_0xe4e6('0x50')](_0x2c95f2);})['then'](function(_0x16c338){_0x119fd1[_0xe4e6('0x3d')]=_0x16c338;return _0x119fd1;});}})['then'](respondWithFilteredResult(_0x5483e0,_0x2c95f2))['catch'](handleError(_0x5483e0,null));};exports[_0xe4e6('0x53')]=function(_0x5593e2,_0x2f42aa,_0x9cf238){var _0x257a39={'raw':!![],'where':{}};var _0x3444b2={};var _0x375ddb={'count':0x0,'rows':[]};return db[_0xe4e6('0x29')][_0xe4e6('0x51')]({'where':{'id':_0x5593e2[_0xe4e6('0x3f')]['id']}})[_0xe4e6('0x24')](handleEntityNotFound(_0x2f42aa,null))[_0xe4e6('0x24')](function(_0x535f1d){if(_0x535f1d){_0x3444b2[_0xe4e6('0x2b')]=_[_0xe4e6('0x2c')](db[_0xe4e6('0x54')][_0xe4e6('0x2a')]);_0x3444b2['query']=_['keys'](_0x5593e2[_0xe4e6('0x2d')]);_0x3444b2[_0xe4e6('0x30')]=_[_0xe4e6('0x31')](_0x3444b2[_0xe4e6('0x2b')],_0x3444b2[_0xe4e6('0x2d')]);_0x257a39[_0xe4e6('0x32')]=_['intersection'](_0x3444b2[_0xe4e6('0x2b')],qs[_0xe4e6('0x40')](_0x5593e2[_0xe4e6('0x2d')][_0xe4e6('0x40')]));_0x257a39[_0xe4e6('0x32')]=_0x257a39[_0xe4e6('0x32')][_0xe4e6('0x46')]?_0x257a39[_0xe4e6('0x32')]:_0x3444b2[_0xe4e6('0x2b')];if(!_0x5593e2['query'][_0xe4e6('0x33')](_0xe4e6('0x34'))){_0x257a39['limit']=qs[_0xe4e6('0x1e')](_0x5593e2[_0xe4e6('0x2d')][_0xe4e6('0x1e')]);_0x257a39[_0xe4e6('0x1d')]=qs[_0xe4e6('0x1d')](_0x5593e2[_0xe4e6('0x2d')][_0xe4e6('0x1d')]);}_0x257a39['order']=qs[_0xe4e6('0x35')](_0x5593e2[_0xe4e6('0x2d')][_0xe4e6('0x35')]);_0x257a39[_0xe4e6('0x36')]=qs[_0xe4e6('0x30')](_[_0xe4e6('0x4c')](_0x5593e2[_0xe4e6('0x2d')],_0x3444b2['filters']));_0x257a39[_0xe4e6('0x36')][_0xe4e6('0x4d')]=_0x535f1d['id'];if(_0x5593e2[_0xe4e6('0x2d')][_0xe4e6('0x3a')]){_0x257a39[_0xe4e6('0x36')]=_[_0xe4e6('0x39')](_0x257a39['where'],{'$or':_['map'](_0x257a39['attributes'],function(_0x8d3d5){var _0x514621={};_0x514621[_0x8d3d5]={'$like':'%'+_0x5593e2[_0xe4e6('0x2d')][_0xe4e6('0x3a')]+'%'};return _0x514621;})});}_0x257a39=_[_0xe4e6('0x39')]({},_0x257a39,_0x5593e2[_0xe4e6('0x41')]);return db[_0xe4e6('0x54')][_0xe4e6('0x1c')]({'where':_0x257a39['where']})[_0xe4e6('0x24')](function(_0x2886f4){_0x375ddb[_0xe4e6('0x1c')]=_0x2886f4;if(_0x5593e2[_0xe4e6('0x2d')][_0xe4e6('0x3c')]){_0x257a39[_0xe4e6('0x4f')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xe4e6('0x50')](_0x257a39);})[_0xe4e6('0x24')](function(_0x59d6f){_0x375ddb[_0xe4e6('0x3d')]=_0x59d6f;return _0x375ddb;});}})['then'](respondWithFilteredResult(_0x2f42aa,_0x257a39))['catch'](handleError(_0x2f42aa,null));};exports[_0xe4e6('0x55')]=function(_0x18096b,_0x1f5a49,_0x58ea2e){var _0xe5ec80={'raw':!![],'where':{}};var _0xbde14b={};var _0x53e73d={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xe4e6('0x51')]({'where':{'id':_0x18096b[_0xe4e6('0x3f')]['id']}})[_0xe4e6('0x24')](handleEntityNotFound(_0x1f5a49,null))[_0xe4e6('0x24')](function(_0x12475b){if(_0x12475b){_0xbde14b[_0xe4e6('0x2b')]=_[_0xe4e6('0x2c')](db['CmHopperBlack'][_0xe4e6('0x2a')]);_0xbde14b[_0xe4e6('0x2d')]=_[_0xe4e6('0x2c')](_0x18096b[_0xe4e6('0x2d')]);_0xbde14b[_0xe4e6('0x30')]=_[_0xe4e6('0x31')](_0xbde14b['model'],_0xbde14b[_0xe4e6('0x2d')]);_0xe5ec80[_0xe4e6('0x32')]=_['intersection'](_0xbde14b[_0xe4e6('0x2b')],qs['fields'](_0x18096b[_0xe4e6('0x2d')][_0xe4e6('0x40')]));_0xe5ec80['attributes']=_0xe5ec80[_0xe4e6('0x32')][_0xe4e6('0x46')]?_0xe5ec80['attributes']:_0xbde14b[_0xe4e6('0x2b')];if(!_0x18096b[_0xe4e6('0x2d')][_0xe4e6('0x33')](_0xe4e6('0x34'))){_0xe5ec80[_0xe4e6('0x1e')]=qs[_0xe4e6('0x1e')](_0x18096b[_0xe4e6('0x2d')][_0xe4e6('0x1e')]);_0xe5ec80[_0xe4e6('0x1d')]=qs[_0xe4e6('0x1d')](_0x18096b[_0xe4e6('0x2d')][_0xe4e6('0x1d')]);}_0xe5ec80[_0xe4e6('0x56')]=qs[_0xe4e6('0x35')](_0x18096b[_0xe4e6('0x2d')][_0xe4e6('0x35')]);_0xe5ec80[_0xe4e6('0x36')]=qs[_0xe4e6('0x30')](_[_0xe4e6('0x4c')](_0x18096b[_0xe4e6('0x2d')],_0xbde14b[_0xe4e6('0x30')]));_0xe5ec80[_0xe4e6('0x36')][_0xe4e6('0x4d')]=_0x12475b['id'];if(_0x18096b['query'][_0xe4e6('0x3a')]){_0xe5ec80[_0xe4e6('0x36')]=_[_0xe4e6('0x39')](_0xe5ec80[_0xe4e6('0x36')],{'$or':_['map'](_0xe5ec80[_0xe4e6('0x32')],function(_0xb6320c){var _0x205d70={};_0x205d70[_0xb6320c]={'$like':'%'+_0x18096b['query'][_0xe4e6('0x3a')]+'%'};return _0x205d70;})});}_0xe5ec80=_[_0xe4e6('0x39')]({},_0xe5ec80,_0x18096b[_0xe4e6('0x41')]);return db[_0xe4e6('0x57')]['count']({'where':_0xe5ec80[_0xe4e6('0x36')]})[_0xe4e6('0x24')](function(_0x29e42a){_0x53e73d[_0xe4e6('0x1c')]=_0x29e42a;if(_0x18096b['query']['includeAll']){_0xe5ec80[_0xe4e6('0x4f')]=[{'all':!![]}];}return db[_0xe4e6('0x57')][_0xe4e6('0x50')](_0xe5ec80);})[_0xe4e6('0x24')](function(_0x1d2665){_0x53e73d[_0xe4e6('0x3d')]=_0x1d2665;return _0x53e73d;});}})['then'](respondWithFilteredResult(_0x1f5a49,_0xe5ec80))[_0xe4e6('0x3e')](handleError(_0x1f5a49,null));};exports[_0xe4e6('0x58')]=function(_0x4b3a36,_0x34fc62,_0x4f0dff){var _0x28cb72={};var _0x30ced0={};var _0x2a0204;var _0x3a7c51;return db['VoiceQueue'][_0xe4e6('0x51')]({'where':{'id':_0x4b3a36['params']['id']}})['then'](handleEntityNotFound(_0x34fc62,null))[_0xe4e6('0x24')](function(_0x4d0efb){if(_0x4d0efb){_0x2a0204=_0x4d0efb;_0x30ced0[_0xe4e6('0x2b')]=_[_0xe4e6('0x2c')](db['Team'][_0xe4e6('0x2a')]);_0x30ced0['query']=_[_0xe4e6('0x2c')](_0x4b3a36[_0xe4e6('0x2d')]);_0x30ced0[_0xe4e6('0x30')]=_[_0xe4e6('0x31')](_0x30ced0[_0xe4e6('0x2b')],_0x30ced0[_0xe4e6('0x2d')]);_0x28cb72[_0xe4e6('0x32')]=_[_0xe4e6('0x31')](_0x30ced0['model'],qs[_0xe4e6('0x40')](_0x4b3a36[_0xe4e6('0x2d')][_0xe4e6('0x40')]));_0x28cb72[_0xe4e6('0x32')]=_0x28cb72[_0xe4e6('0x32')]['length']?_0x28cb72[_0xe4e6('0x32')]:_0x30ced0['model'];_0x28cb72[_0xe4e6('0x56')]=qs[_0xe4e6('0x35')](_0x4b3a36[_0xe4e6('0x2d')][_0xe4e6('0x35')]);_0x28cb72[_0xe4e6('0x36')]=qs[_0xe4e6('0x30')](_[_0xe4e6('0x4c')](_0x4b3a36[_0xe4e6('0x2d')],_0x30ced0[_0xe4e6('0x30')]));if(_0x4b3a36[_0xe4e6('0x2d')][_0xe4e6('0x3a')]){_0x28cb72[_0xe4e6('0x36')]=_['merge'](_0x28cb72[_0xe4e6('0x36')],{'$or':_['map'](_0x28cb72[_0xe4e6('0x32')],function(_0x2c7943){var _0x3684b3={};_0x3684b3[_0x2c7943]={'$like':'%'+_0x4b3a36['query'][_0xe4e6('0x3a')]+'%'};return _0x3684b3;})});}_0x28cb72=_[_0xe4e6('0x39')]({},_0x28cb72,_0x4b3a36[_0xe4e6('0x41')]);return _0x2a0204[_0xe4e6('0x58')](_0x28cb72);}})['then'](function(_0x4e15e3){if(_0x4e15e3){_0x3a7c51=_0x4e15e3[_0xe4e6('0x46')];if(!_0x4b3a36[_0xe4e6('0x2d')][_0xe4e6('0x33')](_0xe4e6('0x34'))){_0x28cb72[_0xe4e6('0x1e')]=qs[_0xe4e6('0x1e')](_0x4b3a36['query'][_0xe4e6('0x1e')]);_0x28cb72[_0xe4e6('0x1d')]=qs[_0xe4e6('0x1d')](_0x4b3a36['query']['offset']);}return _0x2a0204['getTeams'](_0x28cb72);}})['then'](function(_0x2112f8){if(_0x2112f8){return _0x2112f8?{'count':_0x3a7c51,'rows':_0x2112f8}:null;}})[_0xe4e6('0x24')](respondWithResult(_0x34fc62,null))[_0xe4e6('0x3e')](handleError(_0x34fc62,null));};exports[_0xe4e6('0x59')]=function(_0x514a9a,_0x426b3e,_0x3670a8){var _0x4fca4f=[];var _0x19457b;return db['Team'][_0xe4e6('0x50')]({'where':{'id':_0x514a9a[_0xe4e6('0x44')][_0xe4e6('0x5a')]},'attributes':['id'],'include':[{'model':db[_0xe4e6('0x5b')],'as':_0xe4e6('0x5c'),'attributes':['id'],'raw':!![]}]})[_0xe4e6('0x24')](function(_0x52fa41){if(_0x52fa41){for(var _0x37a9eb=0x0;_0x37a9eb<_0x52fa41['length'];_0x37a9eb+=0x1){for(var _0x51d060=0x0;_0x51d060<_0x52fa41[_0x37a9eb][_0xe4e6('0x5c')][_0xe4e6('0x46')];_0x51d060+=0x1){_0x4fca4f=_['union'](_0x4fca4f,[_0x52fa41[_0x37a9eb][_0xe4e6('0x5c')][_0x51d060]['id']]);}}return _0x4fca4f;}})[_0xe4e6('0x24')](function(_0x2fbf37){if(_0x2fbf37){return db[_0xe4e6('0x29')]['find']({'where':{'id':_0x514a9a['params']['id']}});}})[_0xe4e6('0x24')](function(_0x1ae645){if(_0x1ae645){_0x19457b=_0x1ae645;return _0x19457b['addAgents'](_0x4fca4f,{'penalty':_0x514a9a[_0xe4e6('0x44')][_0xe4e6('0x5d')]});}})[_0xe4e6('0x24')](function(_0x3ed458){if(_0x3ed458){return _0x19457b[_0xe4e6('0x59')](_0x514a9a[_0xe4e6('0x44')][_0xe4e6('0x5a')]);}})[_0xe4e6('0x24')](handleEntityNotFound(_0x426b3e,null))[_0xe4e6('0x24')](respondWithStatusCode(_0x426b3e,null))[_0xe4e6('0x3e')](handleError(_0x426b3e,null));};exports[_0xe4e6('0x5e')]=function(_0x4da3aa,_0x284ada,_0x212a0e){var _0x31d740=[];var _0x3db719;return db['Team'][_0xe4e6('0x50')]({'where':{'id':_0x4da3aa['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xe4e6('0x5b')],'as':_0xe4e6('0x5c'),'attributes':['id'],'raw':!![]}]})[_0xe4e6('0x24')](function(_0x32fd54){if(_0x32fd54){for(var _0x4ca732=0x0;_0x4ca732<_0x32fd54[_0xe4e6('0x46')];_0x4ca732+=0x1){for(var _0x63635d=0x0;_0x63635d<_0x32fd54[_0x4ca732][_0xe4e6('0x5c')]['length'];_0x63635d+=0x1){_0x31d740=_[_0xe4e6('0x5f')](_0x31d740,[_0x32fd54[_0x4ca732][_0xe4e6('0x5c')][_0x63635d]['id']]);}}return _0x31d740;}})[_0xe4e6('0x24')](function(_0x51d027){if(_0x51d027){return db[_0xe4e6('0x29')][_0xe4e6('0x42')]({'where':{'id':_0x4da3aa['params']['id']}});}})[_0xe4e6('0x24')](function(_0x5ba0e3){if(_0x5ba0e3){_0x3db719=_0x5ba0e3;return _0x3db719['removeAgents'](_0x31d740);}})[_0xe4e6('0x24')](function(_0x54ae6f){if(_0x3db719){return _0x3db719['removeTeams'](_0x4da3aa[_0xe4e6('0x2d')][_0xe4e6('0x5a')]);}})['then'](handleEntityNotFound(_0x284ada,null))['then'](respondWithStatusCode(_0x284ada,null))[_0xe4e6('0x3e')](handleError(_0x284ada,null));};exports[_0xe4e6('0x60')]=function(_0x56a5da,_0x4ebb2b,_0x8ce7f3){var _0x53d6dd,_0x3d1311;return db['VoiceQueue'][_0xe4e6('0x42')]({'where':{'id':_0x56a5da[_0xe4e6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4ebb2b,null))[_0xe4e6('0x24')](function(_0x477ab6){if(_0x477ab6){_0x3d1311=_0x477ab6;return _0x477ab6[_0xe4e6('0x60')](_0x56a5da[_0xe4e6('0x44')]['ids'],_['omit'](_0x56a5da['body'],['ids','id'])||{})[_0xe4e6('0x61')](function(_0x45b2e3){for(var _0x7e0535=0x0;_0x7e0535<_0x56a5da[_0xe4e6('0x44')]['ids'][_0xe4e6('0x46')];_0x7e0535+=0x1){socket[_0xe4e6('0x62')](_0xe4e6('0x63'),{'UserId':_0x56a5da[_0xe4e6('0x44')][_0xe4e6('0x5a')][_0x7e0535],'VoiceQueueId':_0x56a5da[_0xe4e6('0x3f')]['id']});}return _0x45b2e3;});}})['then'](function(_0x34ef14){_0x53d6dd=_0x34ef14||[];if(_0x3d1311){return db['User']['findAll']({'where':{'id':_0x56a5da[_0xe4e6('0x44')]['ids']},'attributes':['id','name','loginInPause',_0xe4e6('0x64'),'interface'],'raw':!![]});}})[_0xe4e6('0x24')](function(_0x2f9bb5){if(_0x2f9bb5&&_0x2f9bb5['length']){var _0x1c0811=[];for(var _0x235d1d=0x0;_0x235d1d<_0x2f9bb5[_0xe4e6('0x46')];_0x235d1d++){_0x1c0811[_0xe4e6('0x65')](db[_0xe4e6('0x66')][_0xe4e6('0x67')]({'membername':_0x2f9bb5[_0x235d1d][_0xe4e6('0x26')],'UserId':_0x2f9bb5[_0x235d1d]['id'],'queue_name':_0x3d1311[_0xe4e6('0x26')],'VoiceQueueId':_0x3d1311['id'],'interface':_[_0xe4e6('0x68')](_0x2f9bb5[_0x235d1d][_0xe4e6('0x69')])?util[_0xe4e6('0x6a')](_0xe4e6('0x6b'),_0x2f9bb5[_0x235d1d][_0xe4e6('0x26')]):_0x2f9bb5[_0x235d1d][_0xe4e6('0x69')],'paused':_0x2f9bb5[_0x235d1d]['voicePause']||![],'penalty':_0x56a5da[_0xe4e6('0x44')][_0xe4e6('0x5d')]||0x0}));}return BPromise['all'](_0x1c0811);}})['then'](function(_0x378b49){return _0x53d6dd;})['then'](respondWithResult(_0x4ebb2b,null))[_0xe4e6('0x3e')](handleError(_0x4ebb2b,null));};exports[_0xe4e6('0x6c')]=function(_0x5c1992,_0x13774e,_0x3fb7fa){var _0x27c947;return db['VoiceQueue'][_0xe4e6('0x42')]({'where':{'id':_0x5c1992['params']['id']}})['then'](handleEntityNotFound(_0x13774e,null))[_0xe4e6('0x24')](function(_0xf433da){if(_0xf433da){return _0xf433da[_0xe4e6('0x6c')](_0x5c1992[_0xe4e6('0x2d')]['ids'])[_0xe4e6('0x24')](function(_0x55dd0d){if(_[_0xe4e6('0x6d')](_0x5c1992[_0xe4e6('0x2d')][_0xe4e6('0x5a')])){for(var _0x15ea31=0x0;_0x15ea31<_0x5c1992[_0xe4e6('0x2d')][_0xe4e6('0x5a')][_0xe4e6('0x46')];_0x15ea31+=0x1){socket[_0xe4e6('0x62')](_0xe4e6('0x6e'),{'UserId':_0x5c1992[_0xe4e6('0x2d')]['ids'][_0x15ea31],'VoiceQueueId':_0x5c1992[_0xe4e6('0x3f')]['id']});}}else{socket[_0xe4e6('0x62')]('userVoiceQueue:remove',{'UserId':_0x5c1992[_0xe4e6('0x2d')]['ids'],'VoiceQueueId':_0x5c1992[_0xe4e6('0x3f')]['id']});}});}})[_0xe4e6('0x24')](function(_0x44cd25){if(_0x5c1992['query'][_0xe4e6('0x6f')]){_0x27c947=_0x44cd25;return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x5c1992[_0xe4e6('0x3f')]['id'],'UserId':_0x5c1992['query'][_0xe4e6('0x5a')]}})[_0xe4e6('0x24')](function(){return _0x27c947;});}})[_0xe4e6('0x24')](respondWithStatusCode(_0x13774e,null))[_0xe4e6('0x3e')](handleError(_0x13774e,null));};exports['getAgents']=function(_0x164d95,_0x17e222,_0x229c0d){var _0x3f3e3b={};var _0x1046a4={};var _0x407653;var _0x4a637c;return db[_0xe4e6('0x29')][_0xe4e6('0x51')]({'where':{'id':_0x164d95[_0xe4e6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x17e222,null))[_0xe4e6('0x24')](function(_0x6e5da7){if(_0x6e5da7){_0x407653=_0x6e5da7;_0x1046a4[_0xe4e6('0x2b')]=_['keys'](db[_0xe4e6('0x5b')][_0xe4e6('0x2a')]);_0x1046a4[_0xe4e6('0x2d')]=_[_0xe4e6('0x2c')](_0x164d95['query']);_0x1046a4['filters']=_[_0xe4e6('0x31')](_0x1046a4[_0xe4e6('0x2b')],_0x1046a4[_0xe4e6('0x2d')]);_0x3f3e3b['attributes']=_[_0xe4e6('0x31')](_0x1046a4[_0xe4e6('0x2b')],qs[_0xe4e6('0x40')](_0x164d95[_0xe4e6('0x2d')][_0xe4e6('0x40')]));_0x3f3e3b[_0xe4e6('0x32')]=_0x3f3e3b[_0xe4e6('0x32')][_0xe4e6('0x46')]?_0x3f3e3b[_0xe4e6('0x32')]:_0x1046a4[_0xe4e6('0x2b')];_0x3f3e3b[_0xe4e6('0x56')]=qs['sort'](_0x164d95[_0xe4e6('0x2d')][_0xe4e6('0x35')]);_0x3f3e3b['where']=qs['filters'](_[_0xe4e6('0x4c')](_0x164d95[_0xe4e6('0x2d')],_0x1046a4[_0xe4e6('0x30')]));if(_0x164d95['query']['filter']){_0x3f3e3b[_0xe4e6('0x36')]=_['merge'](_0x3f3e3b[_0xe4e6('0x36')],{'$or':_[_0xe4e6('0x3b')](_0x3f3e3b[_0xe4e6('0x32')],function(_0x1dd0f9){var _0x196e14={};_0x196e14[_0x1dd0f9]={'$like':'%'+_0x164d95['query'][_0xe4e6('0x3a')]+'%'};return _0x196e14;})});}_0x3f3e3b=_['merge']({},_0x3f3e3b,_0x164d95['options']);return _0x407653[_0xe4e6('0x70')](_0x3f3e3b);}})[_0xe4e6('0x24')](function(_0x471f74){if(_0x471f74){_0x4a637c=_0x471f74[_0xe4e6('0x46')];if(!_0x164d95[_0xe4e6('0x2d')][_0xe4e6('0x33')](_0xe4e6('0x34'))){_0x3f3e3b[_0xe4e6('0x1e')]=qs[_0xe4e6('0x1e')](_0x164d95['query'][_0xe4e6('0x1e')]);_0x3f3e3b['offset']=qs[_0xe4e6('0x1d')](_0x164d95[_0xe4e6('0x2d')][_0xe4e6('0x1d')]);}return _0x407653[_0xe4e6('0x70')](_0x3f3e3b);}})['then'](function(_0x4577c7){if(_0x4577c7){return _0x4577c7?{'count':_0x4a637c,'rows':_0x4577c7}:null;}})[_0xe4e6('0x24')](respondWithResult(_0x17e222,null))[_0xe4e6('0x3e')](handleError(_0x17e222,null));};exports[_0xe4e6('0x71')]=function(_0x2bcbb9,_0x7a83b8,_0x58f6fc){var _0x5c9f1e={};var _0x46b27c={};var _0x2c8da5;var _0x417f1b;return db[_0xe4e6('0x29')][_0xe4e6('0x51')]({'where':{'id':_0x2bcbb9['params']['id']}})[_0xe4e6('0x24')](handleEntityNotFound(_0x7a83b8,null))['then'](function(_0x1327bf){if(_0x1327bf){_0x2c8da5=_0x1327bf;_0x46b27c[_0xe4e6('0x2b')]=_[_0xe4e6('0x2c')](db[_0xe4e6('0x66')][_0xe4e6('0x2a')]);_0x46b27c['query']=_[_0xe4e6('0x2c')](_0x2bcbb9[_0xe4e6('0x2d')]);_0x46b27c[_0xe4e6('0x30')]=_['intersection'](_0x46b27c[_0xe4e6('0x2b')],_0x46b27c[_0xe4e6('0x2d')]);_0x5c9f1e[_0xe4e6('0x32')]=_['intersection'](_0x46b27c[_0xe4e6('0x2b')],qs['fields'](_0x2bcbb9['query'][_0xe4e6('0x40')]));_0x5c9f1e[_0xe4e6('0x32')]=_0x5c9f1e[_0xe4e6('0x32')]['length']?_0x5c9f1e[_0xe4e6('0x32')]:_0x46b27c['model'];_0x5c9f1e[_0xe4e6('0x56')]=qs['sort'](_0x2bcbb9[_0xe4e6('0x2d')][_0xe4e6('0x35')]);_0x5c9f1e['where']=qs[_0xe4e6('0x30')](_[_0xe4e6('0x4c')](_0x2bcbb9[_0xe4e6('0x2d')],_0x46b27c['filters']));if(_0x2bcbb9[_0xe4e6('0x2d')][_0xe4e6('0x3a')]){_0x5c9f1e[_0xe4e6('0x36')]=_[_0xe4e6('0x39')](_0x5c9f1e[_0xe4e6('0x36')],{'$or':_[_0xe4e6('0x3b')](_0x5c9f1e[_0xe4e6('0x32')],function(_0x590dfb){var _0x187ba8={};_0x187ba8[_0x590dfb]={'$like':'%'+_0x2bcbb9[_0xe4e6('0x2d')][_0xe4e6('0x3a')]+'%'};return _0x187ba8;})});}_0x5c9f1e=_['merge']({},_0x5c9f1e,_0x2bcbb9[_0xe4e6('0x41')]);return _0x2c8da5[_0xe4e6('0x71')](_0x5c9f1e);}})[_0xe4e6('0x24')](function(_0x3d2786){if(_0x3d2786){_0x417f1b=_0x3d2786[_0xe4e6('0x46')];if(!_0x2bcbb9[_0xe4e6('0x2d')][_0xe4e6('0x33')](_0xe4e6('0x34'))){_0x5c9f1e[_0xe4e6('0x1e')]=qs[_0xe4e6('0x1e')](_0x2bcbb9['query']['limit']);_0x5c9f1e[_0xe4e6('0x1d')]=qs[_0xe4e6('0x1d')](_0x2bcbb9[_0xe4e6('0x2d')]['offset']);}return _0x2c8da5[_0xe4e6('0x71')](_0x5c9f1e);}})[_0xe4e6('0x24')](function(_0x328e04){return _0x328e04?{'count':_0x417f1b,'rows':_0x328e04}:null;})['then'](respondWithResult(_0x7a83b8,null))['catch'](handleError(_0x7a83b8,null));};exports['getLists']=function(_0x2da507,_0x146260,_0x470319){var _0x3031bc={};var _0x1be7be={};var _0x587c99;var _0x32c87a;return db['VoiceQueue'][_0xe4e6('0x51')]({'where':{'id':_0x2da507[_0xe4e6('0x3f')]['id']}})[_0xe4e6('0x24')](handleEntityNotFound(_0x146260,null))[_0xe4e6('0x24')](function(_0xd76c9c){if(_0xd76c9c){_0x587c99=_0xd76c9c;_0x1be7be[_0xe4e6('0x2b')]=_[_0xe4e6('0x2c')](db[_0xe4e6('0x72')]['rawAttributes']);_0x1be7be[_0xe4e6('0x2d')]=_[_0xe4e6('0x2c')](_0x2da507[_0xe4e6('0x2d')]);_0x1be7be['filters']=_[_0xe4e6('0x31')](_0x1be7be['model'],_0x1be7be[_0xe4e6('0x2d')]);_0x3031bc[_0xe4e6('0x32')]=_['intersection'](_0x1be7be['model'],qs[_0xe4e6('0x40')](_0x2da507[_0xe4e6('0x2d')]['fields']));_0x3031bc[_0xe4e6('0x32')]=_0x3031bc[_0xe4e6('0x32')][_0xe4e6('0x46')]?_0x3031bc['attributes']:_0x1be7be[_0xe4e6('0x2b')];_0x3031bc['order']=qs['sort'](_0x2da507[_0xe4e6('0x2d')][_0xe4e6('0x35')]);_0x3031bc[_0xe4e6('0x36')]=qs['filters'](_[_0xe4e6('0x4c')](_0x2da507['query'],_0x1be7be['filters']));if(_0x2da507[_0xe4e6('0x2d')][_0xe4e6('0x3a')]){_0x3031bc[_0xe4e6('0x36')]=_[_0xe4e6('0x39')](_0x3031bc['where'],{'$or':_['map'](_0x3031bc[_0xe4e6('0x32')],function(_0x3e3a40){var _0x5c07e6={};_0x5c07e6[_0x3e3a40]={'$like':'%'+_0x2da507['query'][_0xe4e6('0x3a')]+'%'};return _0x5c07e6;})});}_0x3031bc=_['merge']({},_0x3031bc,_0x2da507[_0xe4e6('0x41')]);return _0x587c99[_0xe4e6('0x73')](_0x3031bc);}})[_0xe4e6('0x24')](function(_0x376bcd){if(_0x376bcd){_0x32c87a=_0x376bcd[_0xe4e6('0x46')];if(!_0x2da507[_0xe4e6('0x2d')]['hasOwnProperty'](_0xe4e6('0x34'))){_0x3031bc['limit']=qs['limit'](_0x2da507[_0xe4e6('0x2d')]['limit']);_0x3031bc[_0xe4e6('0x1d')]=qs[_0xe4e6('0x1d')](_0x2da507[_0xe4e6('0x2d')][_0xe4e6('0x1d')]);}return _0x587c99[_0xe4e6('0x73')](_0x3031bc);}})[_0xe4e6('0x24')](function(_0x1dc934){if(_0x1dc934){return _0x1dc934?{'count':_0x32c87a,'rows':_0x1dc934}:null;}})[_0xe4e6('0x24')](respondWithResult(_0x146260,null))[_0xe4e6('0x3e')](handleError(_0x146260,null));};exports[_0xe4e6('0x74')]=function(_0x241c43,_0x59852b,_0x328f7c){var _0x26bf21,_0x29f411;return db[_0xe4e6('0x29')]['find']({'where':{'id':_0x241c43[_0xe4e6('0x3f')]['id']}})[_0xe4e6('0x24')](handleEntityNotFound(_0x59852b,null))[_0xe4e6('0x24')](function(_0x4b0371){if(_0x4b0371){_0x29f411=_0x4b0371;return _0x4b0371[_0xe4e6('0x74')](_0x241c43['body'][_0xe4e6('0x5a')],_[_0xe4e6('0x47')](_0x241c43[_0xe4e6('0x44')],[_0xe4e6('0x5a'),'id'])||{});}return null;})[_0xe4e6('0x61')](function(_0xf15cd3){var _0x26a979;_0x26bf21=_0xf15cd3||[];var _0x249996=[];if(_0xf15cd3){for(var _0x440021=0x0;_0x440021<_0xf15cd3[_0xe4e6('0x46')];_0x440021+=0x1){var _0x4134df=_0xf15cd3[_0x440021][_0xe4e6('0x75')]({'plain':!![]});_0x29f411[_0xe4e6('0x76')]=_0x241c43[_0xe4e6('0x44')][_0xe4e6('0x76')]?_0x241c43[_0xe4e6('0x44')]['dialCheckDuplicateType']:_0x29f411[_0xe4e6('0x76')];switch(_0x29f411[_0xe4e6('0x76')]){case _0xe4e6('0x77'):_0x26a979=squel[_0xe4e6('0x78')]()[_0xe4e6('0x79')](_0xe4e6('0x7a'))[_0xe4e6('0x7b')](['phone',_0xe4e6('0x7c'),'ContactId','ListId',_0xe4e6('0x4d'),'createdAt',_0xe4e6('0x49')],squel['select']()[_0xe4e6('0x7d')](_0xe4e6('0x7e'),_0xe4e6('0x7e'))[_0xe4e6('0x7d')](_0xe4e6('0x7f'),_0xe4e6('0x7c'))[_0xe4e6('0x7d')]('id',_0xe4e6('0x80'))['field'](_0x4134df['CmListId']['toString'](),'ListId')['field'](_0x241c43[_0xe4e6('0x3f')]['id']['toString'](),_0xe4e6('0x4d'))[_0xe4e6('0x7d')]('NOW()','createdAt')[_0xe4e6('0x7d')]('NOW()','updatedAt')[_0xe4e6('0x81')]('cm_contacts')[_0xe4e6('0x36')]('deletedAt\x20IS\x20NULL')[_0xe4e6('0x36')]('ListId\x20=\x20?',_0x4134df['CmListId'][_0xe4e6('0x82')]())['where'](_0xe4e6('0x83'))[_0xe4e6('0x36')](_0xe4e6('0x84'),squel[_0xe4e6('0x85')]()[_0xe4e6('0x7d')]('calleridnum')[_0xe4e6('0x81')](_0xe4e6('0x86'))['where'](_0xe4e6('0x87'),_0x241c43[_0xe4e6('0x3f')]['id'][_0xe4e6('0x82')]()))['where'](_0xe4e6('0x84'),squel[_0xe4e6('0x85')]()[_0xe4e6('0x7d')]('phone')['from'](_0xe4e6('0x7a'))[_0xe4e6('0x36')]('VoiceQueueId\x20=\x20?',_0x241c43['params']['id'][_0xe4e6('0x82')]())))['toString']();break;case _0xe4e6('0x88'):_0x26a979=squel[_0xe4e6('0x78')]()[_0xe4e6('0x79')]('cm_hopper')[_0xe4e6('0x7b')]([_0xe4e6('0x7e'),'scheduledAt',_0xe4e6('0x80'),_0xe4e6('0x89'),_0xe4e6('0x4d'),_0xe4e6('0x48'),_0xe4e6('0x49')],squel['select']()['field']('phone',_0xe4e6('0x7e'))[_0xe4e6('0x7d')](_0xe4e6('0x7f'),_0xe4e6('0x7c'))['field']('id','ContactId')[_0xe4e6('0x7d')](_0x4134df[_0xe4e6('0x8a')][_0xe4e6('0x82')](),_0xe4e6('0x89'))[_0xe4e6('0x7d')](_0x241c43[_0xe4e6('0x3f')]['id'][_0xe4e6('0x82')](),_0xe4e6('0x4d'))[_0xe4e6('0x7d')](_0xe4e6('0x7f'),_0xe4e6('0x48'))[_0xe4e6('0x7d')](_0xe4e6('0x7f'),_0xe4e6('0x49'))[_0xe4e6('0x81')](_0xe4e6('0x8b'))[_0xe4e6('0x36')](_0xe4e6('0x8c'))[_0xe4e6('0x36')](_0xe4e6('0x8d'),_0x4134df[_0xe4e6('0x8a')][_0xe4e6('0x82')]())[_0xe4e6('0x36')]('phone\x20IS\x20NOT\x20NULL')[_0xe4e6('0x36')](_0xe4e6('0x84'),squel[_0xe4e6('0x85')]()[_0xe4e6('0x7d')](_0xe4e6('0x7e'))[_0xe4e6('0x81')](_0xe4e6('0x7a'))[_0xe4e6('0x36')](_0xe4e6('0x87'),_0x241c43[_0xe4e6('0x3f')]['id']['toString']())))['toString']();break;default:_0x26a979=squel['insert']()[_0xe4e6('0x79')](_0xe4e6('0x7a'))[_0xe4e6('0x7b')]([_0xe4e6('0x7e'),_0xe4e6('0x7c'),_0xe4e6('0x80'),_0xe4e6('0x89'),'VoiceQueueId',_0xe4e6('0x48'),_0xe4e6('0x49')],squel[_0xe4e6('0x85')]()[_0xe4e6('0x7d')](_0xe4e6('0x7e'),_0xe4e6('0x7e'))[_0xe4e6('0x7d')](_0xe4e6('0x7f'),_0xe4e6('0x7c'))[_0xe4e6('0x7d')]('id',_0xe4e6('0x80'))[_0xe4e6('0x7d')](_0x4134df[_0xe4e6('0x8a')][_0xe4e6('0x82')](),_0xe4e6('0x89'))['field'](_0x241c43[_0xe4e6('0x3f')]['id'][_0xe4e6('0x82')](),'VoiceQueueId')[_0xe4e6('0x7d')](_0xe4e6('0x7f'),_0xe4e6('0x48'))[_0xe4e6('0x7d')](_0xe4e6('0x7f'),'updatedAt')[_0xe4e6('0x81')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xe4e6('0x36')](_0xe4e6('0x8d'),_0x4134df['CmListId'][_0xe4e6('0x82')]())['where'](_0xe4e6('0x83')))[_0xe4e6('0x82')]();}_0x249996[_0xe4e6('0x65')](db[_0xe4e6('0x8e')][_0xe4e6('0x2d')](_0x26a979));}return BPromise[_0xe4e6('0x8f')](_0x249996);}})['then'](function(){return _0x26bf21;})[_0xe4e6('0x24')](respondWithResult(_0x59852b,null))['catch'](handleError(_0x59852b,null));};exports[_0xe4e6('0x90')]=function(_0x15c5bf,_0x41e44d,_0x239c08){var _0x34088a;return db[_0xe4e6('0x29')][_0xe4e6('0x42')]({'where':{'id':_0x15c5bf[_0xe4e6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x41e44d,null))['then'](function(_0x593bde){if(_0x593bde){return _0x593bde['removeLists'](_0x15c5bf[_0xe4e6('0x2d')][_0xe4e6('0x5a')]);}})[_0xe4e6('0x24')](function(_0x2dc4e2){if(_0x2dc4e2){_0x34088a=_0x2dc4e2;return db[_0xe4e6('0x4e')][_0xe4e6('0x25')]({'where':{'ListId':_0x15c5bf[_0xe4e6('0x2d')][_0xe4e6('0x5a')],'VoiceQueueId':_0x15c5bf['params']['id']}})['then'](function(){return _0x34088a;});}})[_0xe4e6('0x24')](respondWithStatusCode(_0x41e44d,null))['catch'](handleError(_0x41e44d,null));};exports[_0xe4e6('0x91')]=function(_0x5509cf,_0x4b0673,_0x525c91){var _0x7f1d3a={};var _0x234227={};var _0x423ff3;var _0x195e76;return db[_0xe4e6('0x29')]['findOne']({'where':{'id':_0x5509cf[_0xe4e6('0x3f')]['id']}})[_0xe4e6('0x24')](handleEntityNotFound(_0x4b0673,null))[_0xe4e6('0x24')](function(_0x33d7cb){if(_0x33d7cb){_0x423ff3=_0x33d7cb;_0x234227['model']=_[_0xe4e6('0x2c')](db[_0xe4e6('0x72')][_0xe4e6('0x2a')]);_0x234227[_0xe4e6('0x2d')]=_[_0xe4e6('0x2c')](_0x5509cf[_0xe4e6('0x2d')]);_0x234227[_0xe4e6('0x30')]=_[_0xe4e6('0x31')](_0x234227[_0xe4e6('0x2b')],_0x234227[_0xe4e6('0x2d')]);_0x7f1d3a[_0xe4e6('0x32')]=_[_0xe4e6('0x31')](_0x234227['model'],qs[_0xe4e6('0x40')](_0x5509cf[_0xe4e6('0x2d')][_0xe4e6('0x40')]));_0x7f1d3a[_0xe4e6('0x32')]=_0x7f1d3a['attributes'][_0xe4e6('0x46')]?_0x7f1d3a['attributes']:_0x234227[_0xe4e6('0x2b')];_0x7f1d3a[_0xe4e6('0x56')]=qs[_0xe4e6('0x35')](_0x5509cf['query']['sort']);_0x7f1d3a[_0xe4e6('0x36')]=qs[_0xe4e6('0x30')](_[_0xe4e6('0x4c')](_0x5509cf['query'],_0x234227['filters']));if(_0x5509cf['query'][_0xe4e6('0x3a')]){_0x7f1d3a[_0xe4e6('0x36')]=_[_0xe4e6('0x39')](_0x7f1d3a['where'],{'$or':_[_0xe4e6('0x3b')](_0x7f1d3a[_0xe4e6('0x32')],function(_0x1ce8df){var _0x5e7776={};_0x5e7776[_0x1ce8df]={'$like':'%'+_0x5509cf[_0xe4e6('0x2d')][_0xe4e6('0x3a')]+'%'};return _0x5e7776;})});}_0x7f1d3a=_[_0xe4e6('0x39')]({},_0x7f1d3a,_0x5509cf[_0xe4e6('0x41')]);return _0x423ff3['getBlackLists'](_0x7f1d3a);}})[_0xe4e6('0x24')](function(_0x552514){if(_0x552514){_0x195e76=_0x552514[_0xe4e6('0x46')];if(!_0x5509cf[_0xe4e6('0x2d')][_0xe4e6('0x33')](_0xe4e6('0x34'))){_0x7f1d3a[_0xe4e6('0x1e')]=qs['limit'](_0x5509cf[_0xe4e6('0x2d')][_0xe4e6('0x1e')]);_0x7f1d3a['offset']=qs['offset'](_0x5509cf['query'][_0xe4e6('0x1d')]);}return _0x423ff3[_0xe4e6('0x91')](_0x7f1d3a);}})[_0xe4e6('0x24')](function(_0xb33ce5){if(_0xb33ce5){return _0xb33ce5?{'count':_0x195e76,'rows':_0xb33ce5}:null;}})[_0xe4e6('0x24')](respondWithResult(_0x4b0673,null))[_0xe4e6('0x3e')](handleError(_0x4b0673,null));};exports['addBlackLists']=function(_0x559b5c,_0x1bcf33,_0x82d2fb){var _0x1be76a,_0x1337fe;return db[_0xe4e6('0x29')][_0xe4e6('0x42')]({'where':{'id':_0x559b5c[_0xe4e6('0x3f')]['id']}})[_0xe4e6('0x24')](handleEntityNotFound(_0x1bcf33,null))['then'](function(_0x19cacf){if(_0x19cacf){_0x1337fe=_0x19cacf;return _0x19cacf[_0xe4e6('0x92')](_0x559b5c[_0xe4e6('0x44')][_0xe4e6('0x5a')],_[_0xe4e6('0x47')](_0x559b5c[_0xe4e6('0x44')],[_0xe4e6('0x5a'),'id'])||{});}return null;})['spread'](function(_0x29a82a){var _0x3ff8ba;_0x1be76a=_0x29a82a||[];var _0x405725=[];if(_0x29a82a){for(var _0xe0fc8c=0x0;_0xe0fc8c<_0x29a82a[_0xe4e6('0x46')];_0xe0fc8c+=0x1){var _0x165d35=_0x29a82a[_0xe0fc8c]['get']({'plain':!![]});_0x3ff8ba=squel[_0xe4e6('0x78')]()[_0xe4e6('0x79')]('cm_hopper_black')[_0xe4e6('0x7b')]([_0xe4e6('0x7e'),'ContactId',_0xe4e6('0x89'),_0xe4e6('0x4d'),_0xe4e6('0x48'),_0xe4e6('0x49')],squel[_0xe4e6('0x85')]()[_0xe4e6('0x7d')](_0xe4e6('0x7e'),'phone')[_0xe4e6('0x7d')]('id',_0xe4e6('0x80'))[_0xe4e6('0x7d')](_0x165d35[_0xe4e6('0x8a')][_0xe4e6('0x82')](),'ListId')[_0xe4e6('0x7d')](_0x559b5c[_0xe4e6('0x3f')]['id'][_0xe4e6('0x82')](),_0xe4e6('0x4d'))[_0xe4e6('0x7d')](_0xe4e6('0x7f'),_0xe4e6('0x48'))['field'](_0xe4e6('0x7f'),_0xe4e6('0x49'))[_0xe4e6('0x81')]('cm_contacts')['where'](_0xe4e6('0x8c'))[_0xe4e6('0x36')](_0xe4e6('0x8d'),_0x165d35[_0xe4e6('0x8a')]['toString']())[_0xe4e6('0x36')](_0xe4e6('0x83')))[_0xe4e6('0x82')]();_0x405725[_0xe4e6('0x65')](db[_0xe4e6('0x8e')]['query'](_0x3ff8ba));}return BPromise['all'](_0x405725);}})[_0xe4e6('0x24')](function(){return _0x1be76a;})[_0xe4e6('0x24')](respondWithResult(_0x1bcf33,null))[_0xe4e6('0x3e')](handleError(_0x1bcf33,null));};exports[_0xe4e6('0x93')]=function(_0x5693f8,_0x1c3ea7,_0x740fc2){var _0x293193;return db[_0xe4e6('0x29')][_0xe4e6('0x42')]({'where':{'id':_0x5693f8[_0xe4e6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1c3ea7,null))[_0xe4e6('0x24')](function(_0x22fb75){if(_0x22fb75){return _0x22fb75['removeBlackLists'](_0x5693f8[_0xe4e6('0x2d')][_0xe4e6('0x5a')]);}})[_0xe4e6('0x24')](function(_0x1a739f){if(_0x1a739f){_0x293193=_0x1a739f;return db[_0xe4e6('0x57')][_0xe4e6('0x25')]({'where':{'ListId':_0x5693f8[_0xe4e6('0x2d')][_0xe4e6('0x5a')],'VoiceQueueId':_0x5693f8[_0xe4e6('0x3f')]['id']}})[_0xe4e6('0x24')](function(){return _0x293193;});}})[_0xe4e6('0x24')](respondWithStatusCode(_0x1c3ea7,null))['catch'](handleError(_0x1c3ea7,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 9cbf529..af351ea 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 _0x86a8=['VoiceQueue','setMaxListeners','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x34e3d0,_0x38eead){var _0x1f092d=function(_0x516c6c){while(--_0x516c6c){_0x34e3d0['push'](_0x34e3d0['shift']());}};_0x1f092d(++_0x38eead);}(_0x86a8,0x1ae));var _0x886a=function(_0x33203e,_0x517440){_0x33203e=_0x33203e-0x0;var _0x3bb424=_0x86a8[_0x33203e];return _0x3bb424;};'use strict';var EventEmitter=require(_0x886a('0x0'));var VoiceQueue=require(_0x886a('0x1'))['db'][_0x886a('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x886a('0x3')](0x0);var events={'afterCreate':_0x886a('0x4'),'afterUpdate':_0x886a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x27ad3b){return function(_0x42cd35,_0x4e929b,_0x462f33){VoiceQueueEvents[_0x886a('0x6')](_0x27ad3b+':'+_0x42cd35['id'],_0x42cd35);VoiceQueueEvents['emit'](_0x27ad3b,_0x42cd35);_0x462f33(null);};}for(var e in events){if(events[_0x886a('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x886a('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0xb4e6=['update','remove','emit','hook','events','VoiceQueue','setMaxListeners','save'];(function(_0x5c3e2e,_0x3c59a4){var _0x3a3883=function(_0x2b6caf){while(--_0x2b6caf){_0x5c3e2e['push'](_0x5c3e2e['shift']());}};_0x3a3883(++_0x3c59a4);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x218972,_0x1f9794){_0x218972=_0x218972-0x0;var _0x1bb1a8=_0xb4e6[_0x218972];return _0x1bb1a8;};'use strict';var EventEmitter=require(_0x6b4e('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x6b4e('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x6b4e('0x2')](0x0);var events={'afterCreate':_0x6b4e('0x3'),'afterUpdate':_0x6b4e('0x4'),'afterDestroy':_0x6b4e('0x5')};function emitEvent(_0x31e8ad){return function(_0x1929b8,_0x52313b,_0x40da90){VoiceQueueEvents[_0x6b4e('0x6')](_0x31e8ad+':'+_0x1929b8['id'],_0x1929b8);VoiceQueueEvents[_0x6b4e('0x6')](_0x31e8ad,_0x1929b8);_0x40da90(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x6b4e('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 4b44ea2..8f8eaf4 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 _0xa230=['moment','bluebird','request-promise','./voiceQueue.attributes','exports','define','voice_queues','lodash','util','../../config/logger','api'];(function(_0x2494cf,_0x59de74){var _0xfd192f=function(_0x4e725b){while(--_0x4e725b){_0x2494cf['push'](_0x2494cf['shift']());}};_0xfd192f(++_0x59de74);}(_0xa230,0xac));var _0x0a23=function(_0x3d737a,_0x53b569){_0x3d737a=_0x3d737a-0x0;var _0x408355=_0xa230[_0x3d737a];return _0x408355;};'use strict';var _=require(_0x0a23('0x0'));var util=require(_0x0a23('0x1'));var logger=require(_0x0a23('0x2'))(_0x0a23('0x3'));var moment=require(_0x0a23('0x4'));var BPromise=require(_0x0a23('0x5'));var rp=require(_0x0a23('0x6'));var attributes=require(_0x0a23('0x7'));module[_0x0a23('0x8')]=function(_0x1ec2f0,_0x1b35f4){return _0x1ec2f0[_0x0a23('0x9')]('VoiceQueue',attributes,{'tableName':_0x0a23('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54f6=['request-promise','exports','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x54f6,0xed));var _0x654f=function(_0x1c6826,_0x485fb2){_0x1c6826=_0x1c6826-0x0;var _0x2a91f6=_0x54f6[_0x1c6826];return _0x2a91f6;};'use strict';var _=require(_0x654f('0x0'));var util=require(_0x654f('0x1'));var logger=require(_0x654f('0x2'))(_0x654f('0x3'));var moment=require(_0x654f('0x4'));var BPromise=require(_0x654f('0x5'));var rp=require(_0x654f('0x6'));var attributes=require('./voiceQueue.attributes');module[_0x654f('0x7')]=function(_0x3e2886,_0x89e6cc){return _0x3e2886[_0x654f('0x8')]('VoiceQueue',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 5444244..788614e 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 _0x9957=['register','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','options','raw','where','attributes','limit','include','model','map','catch','GetVoiceQueue','ShowVoiceQueue','VoiceQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket'];(function(_0x5b47ba,_0x29b2eb){var _0x41b776=function(_0x3789d5){while(--_0x3789d5){_0x5b47ba['push'](_0x5b47ba['shift']());}};_0x41b776(++_0x29b2eb);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});config[_0x7995('0xc')]=_[_0x7995('0xd')](config['redis'],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require(_0x7995('0xf'))(new Redis(config['redis']));require(_0x7995('0x10'))[_0x7995('0x11')](socket);function respondWithRpcPromise(_0x18c8a3,_0x35b5fe,_0x3c1d19){return new BPromise(function(_0x1e400a,_0x341672){return client['request'](_0x18c8a3,_0x3c1d19)[_0x7995('0x12')](function(_0x41c652){logger['info'](_0x7995('0x13'),_0x35b5fe,_0x7995('0x14'));logger[_0x7995('0x15')](_0x7995('0x16'),_0x35b5fe,_0x7995('0x14'),JSON[_0x7995('0x17')](_0x41c652));if(_0x41c652[_0x7995('0x18')]){if(_0x41c652['error']['code']===0x1f4){logger[_0x7995('0x18')](_0x7995('0x13'),_0x35b5fe,_0x41c652[_0x7995('0x18')][_0x7995('0x19')]);return _0x341672(_0x41c652[_0x7995('0x18')][_0x7995('0x19')]);}logger[_0x7995('0x18')](_0x7995('0x13'),_0x35b5fe,_0x41c652['error'][_0x7995('0x19')]);return _0x1e400a(_0x41c652['error'][_0x7995('0x19')]);}else{logger[_0x7995('0x1a')](_0x7995('0x13'),_0x35b5fe,_0x7995('0x14'));_0x1e400a(_0x41c652[_0x7995('0x1b')][_0x7995('0x19')]);}})['catch'](function(_0x54c9ae){logger[_0x7995('0x18')]('VoiceQueue,\x20%s,\x20%s',_0x35b5fe,_0x54c9ae);_0x341672(_0x54c9ae);});});}exports['GetVoiceQueue']=function(_0x3ec178){var _0x3d463e=this;return new Promise(function(_0x4cbe10,_0x3a9b54){return db['VoiceQueue']['findAll']({'raw':_0x3ec178[_0x7995('0x1c')]?_0x3ec178[_0x7995('0x1c')][_0x7995('0x1d')]===undefined?!![]:![]:!![],'where':_0x3ec178[_0x7995('0x1c')]?_0x3ec178[_0x7995('0x1c')][_0x7995('0x1e')]||null:null,'attributes':_0x3ec178['options']?_0x3ec178[_0x7995('0x1c')][_0x7995('0x1f')]||null:null,'limit':_0x3ec178[_0x7995('0x1c')]?_0x3ec178[_0x7995('0x1c')][_0x7995('0x20')]||null:null,'include':_0x3ec178[_0x7995('0x1c')]?_0x3ec178[_0x7995('0x1c')][_0x7995('0x21')]?_['map'](_0x3ec178[_0x7995('0x1c')][_0x7995('0x21')],function(_0x401dc3){return{'model':db[_0x401dc3[_0x7995('0x22')]],'as':_0x401dc3['as'],'attributes':_0x401dc3[_0x7995('0x1f')],'include':_0x401dc3[_0x7995('0x21')]?_['map'](_0x401dc3[_0x7995('0x21')],function(_0x5911c3){return{'model':db[_0x5911c3[_0x7995('0x22')]],'as':_0x5911c3['as'],'attributes':_0x5911c3[_0x7995('0x1f')],'include':_0x5911c3[_0x7995('0x21')]?_[_0x7995('0x23')](_0x5911c3[_0x7995('0x21')],function(_0x4b6f99){return{'model':db[_0x4b6f99[_0x7995('0x22')]],'as':_0x4b6f99['as'],'attributes':_0x4b6f99['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x3250e0){logger[_0x7995('0x1a')]('GetVoiceQueue',_0x3ec178);logger['debug']('GetVoiceQueue',_0x3ec178,JSON[_0x7995('0x17')](_0x3250e0));_0x4cbe10(_0x3250e0);})[_0x7995('0x24')](function(_0x327a81){logger[_0x7995('0x18')](_0x7995('0x25'),_0x327a81[_0x7995('0x19')],_0x3ec178);_0x3a9b54(_0x3d463e['error'](0x1f4,_0x327a81['message']));});});};exports[_0x7995('0x26')]=function(_0x5524af){var _0x553671=this;return new Promise(function(_0x3eb566,_0x29fac5){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':_0x5524af['options']?_0x5524af[_0x7995('0x1c')][_0x7995('0x1d')]===undefined?!![]:![]:!![],'where':_0x5524af['options']?_0x5524af['options']['where']||null:null,'attributes':_0x5524af[_0x7995('0x1c')]?_0x5524af[_0x7995('0x1c')]['attributes']||null:null,'include':_0x5524af[_0x7995('0x1c')]?_0x5524af['options'][_0x7995('0x21')]?_[_0x7995('0x23')](_0x5524af[_0x7995('0x1c')]['include'],function(_0x52d76d){return{'model':db[_0x52d76d[_0x7995('0x22')]],'as':_0x52d76d['as'],'attributes':_0x52d76d['attributes'],'include':_0x52d76d['include']?_[_0x7995('0x23')](_0x52d76d[_0x7995('0x21')],function(_0x5212ff){return{'model':db[_0x5212ff[_0x7995('0x22')]],'as':_0x5212ff['as'],'attributes':_0x5212ff[_0x7995('0x1f')],'include':_0x5212ff[_0x7995('0x21')]?_[_0x7995('0x23')](_0x5212ff[_0x7995('0x21')],function(_0x53002a){return{'model':db[_0x53002a[_0x7995('0x22')]],'as':_0x53002a['as'],'attributes':_0x53002a[_0x7995('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x1d60b8){logger['info'](_0x7995('0x26'),_0x5524af);logger[_0x7995('0x15')](_0x7995('0x26'),_0x5524af,JSON[_0x7995('0x17')](_0x1d60b8));_0x3eb566(_0x1d60b8);})[_0x7995('0x24')](function(_0x1035dc){logger['error'](_0x7995('0x26'),_0x1035dc[_0x7995('0x19')],_0x5524af);_0x29fac5(_0x553671[_0x7995('0x18')](0x1f4,_0x1035dc[_0x7995('0x19')]));});});}; \ No newline at end of file +var _0x9957=['register','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','options','raw','where','attributes','limit','include','model','map','catch','GetVoiceQueue','ShowVoiceQueue','VoiceQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket'];(function(_0x4de63f,_0x687e6c){var _0x43e381=function(_0x121983){while(--_0x121983){_0x4de63f['push'](_0x4de63f['shift']());}};_0x43e381(++_0x687e6c);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});config[_0x7995('0xc')]=_[_0x7995('0xd')](config['redis'],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require(_0x7995('0xf'))(new Redis(config['redis']));require(_0x7995('0x10'))[_0x7995('0x11')](socket);function respondWithRpcPromise(_0x18c8a3,_0x35b5fe,_0x3c1d19){return new BPromise(function(_0x1e400a,_0x341672){return client['request'](_0x18c8a3,_0x3c1d19)[_0x7995('0x12')](function(_0x41c652){logger['info'](_0x7995('0x13'),_0x35b5fe,_0x7995('0x14'));logger[_0x7995('0x15')](_0x7995('0x16'),_0x35b5fe,_0x7995('0x14'),JSON[_0x7995('0x17')](_0x41c652));if(_0x41c652[_0x7995('0x18')]){if(_0x41c652['error']['code']===0x1f4){logger[_0x7995('0x18')](_0x7995('0x13'),_0x35b5fe,_0x41c652[_0x7995('0x18')][_0x7995('0x19')]);return _0x341672(_0x41c652[_0x7995('0x18')][_0x7995('0x19')]);}logger[_0x7995('0x18')](_0x7995('0x13'),_0x35b5fe,_0x41c652['error'][_0x7995('0x19')]);return _0x1e400a(_0x41c652['error'][_0x7995('0x19')]);}else{logger[_0x7995('0x1a')](_0x7995('0x13'),_0x35b5fe,_0x7995('0x14'));_0x1e400a(_0x41c652[_0x7995('0x1b')][_0x7995('0x19')]);}})['catch'](function(_0x54c9ae){logger[_0x7995('0x18')]('VoiceQueue,\x20%s,\x20%s',_0x35b5fe,_0x54c9ae);_0x341672(_0x54c9ae);});});}exports['GetVoiceQueue']=function(_0x3ec178){var _0x3d463e=this;return new Promise(function(_0x4cbe10,_0x3a9b54){return db['VoiceQueue']['findAll']({'raw':_0x3ec178[_0x7995('0x1c')]?_0x3ec178[_0x7995('0x1c')][_0x7995('0x1d')]===undefined?!![]:![]:!![],'where':_0x3ec178[_0x7995('0x1c')]?_0x3ec178[_0x7995('0x1c')][_0x7995('0x1e')]||null:null,'attributes':_0x3ec178['options']?_0x3ec178[_0x7995('0x1c')][_0x7995('0x1f')]||null:null,'limit':_0x3ec178[_0x7995('0x1c')]?_0x3ec178[_0x7995('0x1c')][_0x7995('0x20')]||null:null,'include':_0x3ec178[_0x7995('0x1c')]?_0x3ec178[_0x7995('0x1c')][_0x7995('0x21')]?_['map'](_0x3ec178[_0x7995('0x1c')][_0x7995('0x21')],function(_0x401dc3){return{'model':db[_0x401dc3[_0x7995('0x22')]],'as':_0x401dc3['as'],'attributes':_0x401dc3[_0x7995('0x1f')],'include':_0x401dc3[_0x7995('0x21')]?_['map'](_0x401dc3[_0x7995('0x21')],function(_0x5911c3){return{'model':db[_0x5911c3[_0x7995('0x22')]],'as':_0x5911c3['as'],'attributes':_0x5911c3[_0x7995('0x1f')],'include':_0x5911c3[_0x7995('0x21')]?_[_0x7995('0x23')](_0x5911c3[_0x7995('0x21')],function(_0x4b6f99){return{'model':db[_0x4b6f99[_0x7995('0x22')]],'as':_0x4b6f99['as'],'attributes':_0x4b6f99['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x3250e0){logger[_0x7995('0x1a')]('GetVoiceQueue',_0x3ec178);logger['debug']('GetVoiceQueue',_0x3ec178,JSON[_0x7995('0x17')](_0x3250e0));_0x4cbe10(_0x3250e0);})[_0x7995('0x24')](function(_0x327a81){logger[_0x7995('0x18')](_0x7995('0x25'),_0x327a81[_0x7995('0x19')],_0x3ec178);_0x3a9b54(_0x3d463e['error'](0x1f4,_0x327a81['message']));});});};exports[_0x7995('0x26')]=function(_0x5524af){var _0x553671=this;return new Promise(function(_0x3eb566,_0x29fac5){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':_0x5524af['options']?_0x5524af[_0x7995('0x1c')][_0x7995('0x1d')]===undefined?!![]:![]:!![],'where':_0x5524af['options']?_0x5524af['options']['where']||null:null,'attributes':_0x5524af[_0x7995('0x1c')]?_0x5524af[_0x7995('0x1c')]['attributes']||null:null,'include':_0x5524af[_0x7995('0x1c')]?_0x5524af['options'][_0x7995('0x21')]?_[_0x7995('0x23')](_0x5524af[_0x7995('0x1c')]['include'],function(_0x52d76d){return{'model':db[_0x52d76d[_0x7995('0x22')]],'as':_0x52d76d['as'],'attributes':_0x52d76d['attributes'],'include':_0x52d76d['include']?_[_0x7995('0x23')](_0x52d76d[_0x7995('0x21')],function(_0x5212ff){return{'model':db[_0x5212ff[_0x7995('0x22')]],'as':_0x5212ff['as'],'attributes':_0x5212ff[_0x7995('0x1f')],'include':_0x5212ff[_0x7995('0x21')]?_[_0x7995('0x23')](_0x5212ff[_0x7995('0x21')],function(_0x53002a){return{'model':db[_0x53002a[_0x7995('0x22')]],'as':_0x53002a['as'],'attributes':_0x53002a[_0x7995('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x1d60b8){logger['info'](_0x7995('0x26'),_0x5524af);logger[_0x7995('0x15')](_0x7995('0x26'),_0x5524af,JSON[_0x7995('0x17')](_0x1d60b8));_0x3eb566(_0x1d60b8);})[_0x7995('0x24')](function(_0x1035dc){logger['error'](_0x7995('0x26'),_0x1035dc[_0x7995('0x19')],_0x5524af);_0x29fac5(_0x553671[_0x7995('0x18')](0x1f4,_0x1035dc[_0x7995('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 846dbaa..c91de36 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 _0x167a=['emit','removeListener','register','length','remove','update'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x167a,0x7c));var _0xa167=function(_0x540d2d,_0x30d4bd){_0x540d2d=_0x540d2d-0x0;var _0x183e31=_0x167a[_0x540d2d];return _0x183e31;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=['save',_0xa167('0x0'),_0xa167('0x1')];function createListener(_0xebc833,_0x1c0943){return function(_0x3f5a40){_0x1c0943[_0xa167('0x2')](_0xebc833,_0x3f5a40);};}function removeListener(_0x4e2d83,_0x3d7015){return function(){VoiceQueueEvents[_0xa167('0x3')](_0x4e2d83,_0x3d7015);};}exports[_0xa167('0x4')]=function(_0x56dd0e){for(var _0x1b34f9=0x0,_0x2b82d3=events[_0xa167('0x5')];_0x1b34f9<_0x2b82d3;_0x1b34f9++){var _0x4a05d6=events[_0x1b34f9];var _0x3a60b7=createListener('voiceQueue:'+_0x4a05d6,_0x56dd0e);VoiceQueueEvents['on'](_0x4a05d6,_0x3a60b7);}}; \ No newline at end of file +var _0x6309=['save','update','emit','register','voiceQueue:','./voiceQueue.events'];(function(_0x5c6374,_0x2e596e){var _0x47ea2b=function(_0x32ad9c){while(--_0x32ad9c){_0x5c6374['push'](_0x5c6374['shift']());}};_0x47ea2b(++_0x2e596e);}(_0x6309,0x107));var _0x9630=function(_0x39a2d6,_0x477459){_0x39a2d6=_0x39a2d6-0x0;var _0x23af66=_0x6309[_0x39a2d6];return _0x23af66;};'use strict';var VoiceQueueEvents=require(_0x9630('0x0'));var events=[_0x9630('0x1'),'remove',_0x9630('0x2')];function createListener(_0x36cfa6,_0x498cdf){return function(_0x5f3691){_0x498cdf[_0x9630('0x3')](_0x36cfa6,_0x5f3691);};}function removeListener(_0x2dc0ac,_0x242930){return function(){VoiceQueueEvents['removeListener'](_0x2dc0ac,_0x242930);};}exports[_0x9630('0x4')]=function(_0xb0ecea){for(var _0x47e310=0x0,_0x5cc2aa=events['length'];_0x47e310<_0x5cc2aa;_0x47e310++){var _0x191d26=events[_0x47e310];var _0xffbe35=createListener(_0x9630('0x5')+_0x191d26,_0xb0ecea);VoiceQueueEvents['on'](_0x191d26,_0xffbe35);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index b6a1be3..1fe5745 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 _0x0a96=['../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','/describe','describe','get','/index','/:id','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0xd0fae4,_0x2f5610){var _0x4838da=function(_0x3d9b36){while(--_0x3d9b36){_0xd0fae4['push'](_0xd0fae4['shift']());}};_0x4838da(++_0x2f5610);}(_0x0a96,0x16f));var _0x60a9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0a96[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x60a9('0x0'));var util=require(_0x60a9('0x1'));var path=require(_0x60a9('0x2'));var timeout=require(_0x60a9('0x3'));var express=require(_0x60a9('0x4'));var router=express['Router']();var auth=require(_0x60a9('0x5'));var interaction=require(_0x60a9('0x6'));var config=require(_0x60a9('0x7'));var controller=require(_0x60a9('0x8'));router['get']('/',auth[_0x60a9('0x9')](),controller[_0x60a9('0xa')]);router['get'](_0x60a9('0xb'),auth[_0x60a9('0x9')](),controller[_0x60a9('0xc')]);router[_0x60a9('0xd')](_0x60a9('0xe'),auth[_0x60a9('0x9')](),controller['getVoiceQueuesReport']);router[_0x60a9('0xd')](_0x60a9('0xf'),auth[_0x60a9('0x9')](),controller[_0x60a9('0x10')]);router[_0x60a9('0x11')]('/',auth[_0x60a9('0x9')](),controller[_0x60a9('0x12')]);router[_0x60a9('0x13')](_0x60a9('0xf'),auth[_0x60a9('0x9')](),controller['update']);router[_0x60a9('0x14')]('/:id',auth[_0x60a9('0x9')](),controller[_0x60a9('0x15')]);module['exports']=router; \ No newline at end of file +var _0x98c9=['update','delete','util','connect-timeout','express','Router','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','/describe','describe','get','/index','getVoiceQueuesReport','/:id','show','put'];(function(_0x562385,_0x401498){var _0x490084=function(_0x4d1334){while(--_0x4d1334){_0x562385['push'](_0x562385['shift']());}};_0x490084(++_0x401498);}(_0x98c9,0x1c4));var _0x998c=function(_0xdd827a,_0x482ad2){_0xdd827a=_0xdd827a-0x0;var _0x2f46f1=_0x98c9[_0xdd827a];return _0x2f46f1;};'use strict';var multer=require('multer');var util=require(_0x998c('0x0'));var path=require('path');var timeout=require(_0x998c('0x1'));var express=require(_0x998c('0x2'));var router=express[_0x998c('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x998c('0x4'));var controller=require(_0x998c('0x5'));router['get']('/',auth[_0x998c('0x6')](),controller[_0x998c('0x7')]);router['get'](_0x998c('0x8'),auth[_0x998c('0x6')](),controller[_0x998c('0x9')]);router[_0x998c('0xa')](_0x998c('0xb'),auth[_0x998c('0x6')](),controller[_0x998c('0xc')]);router[_0x998c('0xa')](_0x998c('0xd'),auth['isAuthenticated'](),controller[_0x998c('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x998c('0xf')](_0x998c('0xd'),auth[_0x998c('0x6')](),controller[_0x998c('0x10')]);router[_0x998c('0x11')](_0x998c('0xd'),auth[_0x998c('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index ba1265a..34ee594 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 _0x6faa=['queuecallerleaveAt','holdtime','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue'];(function(_0x1265e9,_0x2c175e){var _0x5c6d18=function(_0x4168de){while(--_0x4168de){_0x1265e9['push'](_0x1265e9['shift']());}};_0x5c6d18(++_0x2c175e);}(_0x6faa,0x1d1));var _0xa6fa=function(_0x16f46a,_0x52a368){_0x16f46a=_0x16f46a-0x0;var _0x112629=_0x6faa[_0x16f46a];return _0x112629;};'use strict';var Sequelize=require(_0xa6fa('0x0'));var moment=require(_0xa6fa('0x1'));module['exports']={'type':{'type':Sequelize[_0xa6fa('0x2')]},'uniqueid':{'type':Sequelize[_0xa6fa('0x2')]},'calleridnum':{'type':Sequelize[_0xa6fa('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xa6fa('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0xa6fa('0x3')],'set':function(_0x2dbad3){var _0x4954de=moment(_0x2dbad3);var _0x20c475=moment(this[_0xa6fa('0x4')](_0xa6fa('0x5')))[_0xa6fa('0x6')](_0xa6fa('0x7'));var _0x110fab=_0x4954de[_0xa6fa('0x8')](_0x20c475,_0xa6fa('0x9'));this[_0xa6fa('0xa')](_0xa6fa('0xb'),_0x2dbad3);this[_0xa6fa('0xa')](_0xa6fa('0xc'),_0x110fab||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xa6fa('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xa6fa('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0xa6fa('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xa6fa('0xe')},'originalposition':{'type':Sequelize[_0xa6fa('0xf')]},'channel':{'type':Sequelize[_0xa6fa('0x2')]},'connectedlinenum':{'type':Sequelize[_0xa6fa('0x2')]},'connectedlinename':{'type':Sequelize[_0xa6fa('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xa6fa('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xa6fa('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xa6fa('0xf')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xa6fa('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xa6fa('0x2')]},'transfer':{'type':Sequelize[_0xa6fa('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa6fa('0x2')],'comment':_0xa6fa('0x10')},'transferexten':{'type':Sequelize[_0xa6fa('0x2')]},'transferuniqueid':{'type':Sequelize[_0xa6fa('0x2')]},'disposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0xa6fa('0xf')],'defaultValue':0x0}}; \ No newline at end of file +var _0xead2=['DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','STRING'];(function(_0x42c3a9,_0x1e8d19){var _0x3bc476=function(_0x38bddd){while(--_0x38bddd){_0x42c3a9['push'](_0x42c3a9['shift']());}};_0x3bc476(++_0x1e8d19);}(_0xead2,0x147));var _0x2ead=function(_0x4203f4,_0xdf3495){_0x4203f4=_0x4203f4-0x0;var _0x21b749=_0xead2[_0x4203f4];return _0x21b749;};'use strict';var Sequelize=require(_0x2ead('0x0'));var moment=require(_0x2ead('0x1'));module['exports']={'type':{'type':Sequelize[_0x2ead('0x2')]},'uniqueid':{'type':Sequelize[_0x2ead('0x2')]},'calleridnum':{'type':Sequelize[_0x2ead('0x2')]},'calleridname':{'type':Sequelize[_0x2ead('0x2')]},'queue':{'type':Sequelize[_0x2ead('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x2ead('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x4e07d8){var _0x529b8c=moment(_0x4e07d8);var _0x307906=moment(this[_0x2ead('0x4')](_0x2ead('0x5')))[_0x2ead('0x6')](_0x2ead('0x7'));var _0x33b0f8=_0x529b8c[_0x2ead('0x8')](_0x307906,_0x2ead('0x9'));this['setDataValue'](_0x2ead('0xa'),_0x4e07d8);this['setDataValue'](_0x2ead('0xb'),_0x33b0f8||null);}},'position':{'type':Sequelize[_0x2ead('0xc')]},'count':{'type':Sequelize[_0x2ead('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x2ead('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x2ead('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x2ead('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x2ead('0x3')]},'queuecallerexit':{'type':Sequelize[_0x2ead('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x2ead('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x2ead('0x2')],'comment':_0x2ead('0xe')},'originalposition':{'type':Sequelize[_0x2ead('0xc')]},'channel':{'type':Sequelize[_0x2ead('0x2')]},'connectedlinenum':{'type':Sequelize[_0x2ead('0x2')]},'connectedlinename':{'type':Sequelize[_0x2ead('0x2')]},'accountcode':{'type':Sequelize[_0x2ead('0x2')]},'context':{'type':Sequelize[_0x2ead('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x2ead('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x2ead('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x2ead('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x2ead('0x2')]},'transfer':{'type':Sequelize[_0x2ead('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x2ead('0x2')]},'transferuniqueid':{'type':Sequelize[_0x2ead('0x2')]},'disposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x2ead('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 c1cb739..bbd1532 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 _0x6aa7=['./voiceQueueReport.socket','register','end','json','count','offset','status','set','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','name','send','index','VoiceQueueReport','rawAttributes','model','keys','query','dateStart','dateEnd','intersection','attributes','length','nolimit','limit','order','sort','filters','pick','add','day','merge','where','filter','map','options','includeAll','rows','catch','params','fields','find','create','body','update','describe','getVoiceQueuesReport','hasOwnProperty','include','findAll','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter'];(function(_0x5027b1,_0x1409a5){var _0x4a46cf=function(_0x121920){while(--_0x121920){_0x5027b1['push'](_0x5027b1['shift']());}};_0x4a46cf(++_0x1409a5);}(_0x6aa7,0x178));var _0x76aa=function(_0x57a79c,_0x592cdf){_0x57a79c=_0x57a79c-0x0;var _0xf19b40=_0x6aa7[_0x57a79c];return _0xf19b40;};'use strict';var pdf=require(_0x76aa('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x76aa('0x1'));var zipdir=require(_0x76aa('0x2'));var jsonpatch=require(_0x76aa('0x3'));var rp=require(_0x76aa('0x4'));var moment=require('moment');var BPromise=require(_0x76aa('0x5'));var Mustache=require(_0x76aa('0x6'));var util=require(_0x76aa('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x76aa('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0x8'));var querystring=require(_0x76aa('0xd'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xe'));var qs=require(_0x76aa('0xf'));var logger=require(_0x76aa('0x10'))(_0x76aa('0x11'));var utils=require(_0x76aa('0x12'));var config=require(_0x76aa('0x13'));var db=require(_0x76aa('0x14'))['db'];config[_0x76aa('0x15')]=_[_0x76aa('0x16')](config[_0x76aa('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x76aa('0x17'))(new Redis(config['redis']));require(_0x76aa('0x18'))[_0x76aa('0x19')](socket);function respondWithStatusCode(_0x3f8f6b,_0x8e44ed){_0x8e44ed=_0x8e44ed||0xcc;return function(_0x10432c){if(_0x10432c){return _0x3f8f6b['sendStatus'](_0x8e44ed);}return _0x3f8f6b['status'](_0x8e44ed)[_0x76aa('0x1a')]();};}function respondWithResult(_0x4cfc34,_0x180d92){_0x180d92=_0x180d92||0xc8;return function(_0x319bf1){if(_0x319bf1){return _0x4cfc34['status'](_0x180d92)[_0x76aa('0x1b')](_0x319bf1);}};}function respondWithFilteredResult(_0x550d9a,_0x328381){return function(_0x5181d2){if(_0x5181d2){var _0x1515e9=_0x5181d2[_0x76aa('0x1c')],_0x413cf6=_0x328381[_0x76aa('0x1d')],_0x2ab30b=_0x328381['offset']+_0x328381['limit'],_0x21c16d;if(_0x2ab30b>=_0x1515e9){_0x2ab30b=_0x1515e9;_0x21c16d=0xc8;}else{_0x21c16d=0xce;}_0x550d9a[_0x76aa('0x1e')](_0x21c16d);return _0x550d9a[_0x76aa('0x1f')](_0x76aa('0x20'),_0x413cf6+'-'+_0x2ab30b+'/'+_0x1515e9)[_0x76aa('0x1b')](_0x5181d2);}return null;};}function patchUpdates(_0x15109b){return function(_0x191560){try{jsonpatch[_0x76aa('0x21')](_0x191560,_0x15109b,!![]);}catch(_0x2eaf48){return BPromise[_0x76aa('0x22')](_0x2eaf48);}return _0x191560['save']();};}function saveUpdates(_0x39ac5a,_0x21064c){return function(_0x338a6b){if(_0x338a6b){return _0x338a6b['update'](_0x39ac5a)[_0x76aa('0x23')](function(_0x189cb6){return _0x189cb6;});}return null;};}function removeEntity(_0x31252f,_0x2bd2c6){return function(_0x29c50c){if(_0x29c50c){return _0x29c50c[_0x76aa('0x24')]()[_0x76aa('0x23')](function(){_0x31252f[_0x76aa('0x1e')](0xcc)[_0x76aa('0x1a')]();});}};}function handleEntityNotFound(_0x2cba6d,_0x37f1ab){return function(_0x26b75e){if(!_0x26b75e){_0x2cba6d[_0x76aa('0x25')](0x194);}return _0x26b75e;};}function handleError(_0x4ef9b0,_0xb5e8a9){_0xb5e8a9=_0xb5e8a9||0x1f4;return function(_0x1d6d15){logger[_0x76aa('0x26')](_0x1d6d15[_0x76aa('0x27')]);if(_0x1d6d15[_0x76aa('0x28')]){delete _0x1d6d15[_0x76aa('0x28')];}_0x4ef9b0[_0x76aa('0x1e')](_0xb5e8a9)[_0x76aa('0x29')](_0x1d6d15);};}exports[_0x76aa('0x2a')]=function(_0x1bdc3d,_0x545b06){var _0x3fcb7f={},_0x5a8030={},_0x994550={'count':0x0,'rows':[]};var _0x365ff8=db[_0x76aa('0x2b')][_0x76aa('0x2c')];_0x5a8030[_0x76aa('0x2d')]=_[_0x76aa('0x2e')](_0x365ff8);var _0x2ee0f9={'dateStart':_0x1bdc3d[_0x76aa('0x2f')][_0x76aa('0x30')],'dateEnd':_0x1bdc3d[_0x76aa('0x2f')]['dateEnd']};delete _0x1bdc3d[_0x76aa('0x2f')][_0x76aa('0x30')];delete _0x1bdc3d[_0x76aa('0x2f')][_0x76aa('0x31')];_0x5a8030[_0x76aa('0x2f')]=_[_0x76aa('0x2e')](_0x1bdc3d[_0x76aa('0x2f')]);_0x5a8030['filters']=_[_0x76aa('0x32')](_0x5a8030[_0x76aa('0x2d')],_0x5a8030['query']);_0x3fcb7f[_0x76aa('0x33')]=_['intersection'](_0x5a8030[_0x76aa('0x2d')],qs['fields'](_0x1bdc3d[_0x76aa('0x2f')]['fields']));_0x3fcb7f['attributes']=_0x3fcb7f[_0x76aa('0x33')][_0x76aa('0x34')]?_0x3fcb7f[_0x76aa('0x33')]:_0x5a8030[_0x76aa('0x2d')];if(!_0x1bdc3d['query']['hasOwnProperty'](_0x76aa('0x35'))){_0x3fcb7f[_0x76aa('0x36')]=qs[_0x76aa('0x36')](_0x1bdc3d[_0x76aa('0x2f')][_0x76aa('0x36')]);_0x3fcb7f['offset']=qs[_0x76aa('0x1d')](_0x1bdc3d['query']['offset']);}_0x3fcb7f[_0x76aa('0x37')]=qs[_0x76aa('0x38')](_0x1bdc3d[_0x76aa('0x2f')][_0x76aa('0x38')]);_0x3fcb7f['where']=qs[_0x76aa('0x39')](_[_0x76aa('0x3a')](_0x1bdc3d[_0x76aa('0x2f')],_0x5a8030['filters']));if(_0x2ee0f9[_0x76aa('0x30')]){if(_0x2ee0f9[_0x76aa('0x31')]){_0x2ee0f9[_0x76aa('0x31')]=moment(_0x2ee0f9[_0x76aa('0x31')])[_0x76aa('0x3b')](0x1,_0x76aa('0x3c'));}else{_0x2ee0f9[_0x76aa('0x31')]=moment(_0x2ee0f9[_0x76aa('0x30')])[_0x76aa('0x3b')](0x1,'day');}_[_0x76aa('0x3d')](_0x3fcb7f[_0x76aa('0x3e')],{'createdAt':{'$gte':_0x2ee0f9[_0x76aa('0x30')],'$lte':_0x2ee0f9[_0x76aa('0x31')]}});}if(_0x1bdc3d[_0x76aa('0x2f')][_0x76aa('0x3f')]){_0x3fcb7f['where']=_['merge'](_0x3fcb7f[_0x76aa('0x3e')],{'$or':_[_0x76aa('0x40')](_0x3fcb7f[_0x76aa('0x33')],function(_0x365612){var _0x50599f={};_0x50599f[_0x365612]={'$like':'%'+_0x1bdc3d[_0x76aa('0x2f')][_0x76aa('0x3f')]+'%'};return _0x50599f;})});}_0x3fcb7f=_[_0x76aa('0x3d')]({},_0x3fcb7f,_0x1bdc3d[_0x76aa('0x41')]);var _0x1138b5={'where':_0x3fcb7f['where']};return db[_0x76aa('0x2b')]['count'](_0x1138b5)[_0x76aa('0x23')](function(_0x54b8fd){_0x994550['count']=_0x54b8fd;if(_0x1bdc3d['query'][_0x76aa('0x42')]){_0x3fcb7f['include']=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x3fcb7f);})[_0x76aa('0x23')](function(_0x3fd153){_0x994550[_0x76aa('0x43')]=_0x3fd153;return _0x994550;})[_0x76aa('0x23')](respondWithFilteredResult(_0x545b06,_0x3fcb7f))[_0x76aa('0x44')](handleError(_0x545b06,null));};exports['show']=function(_0x715e7a,_0x14df8c){var _0x2a629d={'raw':![],'where':{'id':_0x715e7a[_0x76aa('0x45')]['id']}},_0x2d6b7f={};_0x2d6b7f['model']=_[_0x76aa('0x2e')](db[_0x76aa('0x2b')]['rawAttributes']);_0x2d6b7f[_0x76aa('0x2f')]=_['keys'](_0x715e7a[_0x76aa('0x2f')]);_0x2d6b7f[_0x76aa('0x39')]=_[_0x76aa('0x32')](_0x2d6b7f[_0x76aa('0x2d')],_0x2d6b7f[_0x76aa('0x2f')]);_0x2a629d[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x2d6b7f[_0x76aa('0x2d')],qs[_0x76aa('0x46')](_0x715e7a[_0x76aa('0x2f')]['fields']));_0x2a629d[_0x76aa('0x33')]=_0x2a629d['attributes'][_0x76aa('0x34')]?_0x2a629d[_0x76aa('0x33')]:_0x2d6b7f[_0x76aa('0x2d')];if(_0x715e7a[_0x76aa('0x2f')]['includeAll']){_0x2a629d['include']=[{'all':!![]}];}_0x2a629d=_[_0x76aa('0x3d')]({},_0x2a629d,_0x715e7a['options']);return db[_0x76aa('0x2b')][_0x76aa('0x47')](_0x2a629d)[_0x76aa('0x23')](handleEntityNotFound(_0x14df8c,null))[_0x76aa('0x23')](respondWithResult(_0x14df8c,null))[_0x76aa('0x44')](handleError(_0x14df8c,null));};exports[_0x76aa('0x48')]=function(_0x5b567b,_0x564546){return db[_0x76aa('0x2b')][_0x76aa('0x48')](_0x5b567b[_0x76aa('0x49')],{})[_0x76aa('0x23')](respondWithResult(_0x564546,0xc9))[_0x76aa('0x44')](handleError(_0x564546,null));};exports[_0x76aa('0x4a')]=function(_0x4c52d5,_0x95b7c5){if(_0x4c52d5[_0x76aa('0x49')]['id']){delete _0x4c52d5[_0x76aa('0x49')]['id'];}return db['VoiceQueueReport'][_0x76aa('0x47')]({'where':{'id':_0x4c52d5['params']['id']}})[_0x76aa('0x23')](handleEntityNotFound(_0x95b7c5,null))['then'](saveUpdates(_0x4c52d5[_0x76aa('0x49')],null))[_0x76aa('0x23')](respondWithResult(_0x95b7c5,null))[_0x76aa('0x44')](handleError(_0x95b7c5,null));};exports[_0x76aa('0x24')]=function(_0x37a4d9,_0x316de3){return db[_0x76aa('0x2b')]['find']({'where':{'id':_0x37a4d9[_0x76aa('0x45')]['id']}})['then'](handleEntityNotFound(_0x316de3,null))[_0x76aa('0x23')](removeEntity(_0x316de3,null))[_0x76aa('0x44')](handleError(_0x316de3,null));};exports[_0x76aa('0x4b')]=function(_0x53be10,_0x3fa7ec){return db[_0x76aa('0x2b')][_0x76aa('0x4b')]()['then'](respondWithResult(_0x3fa7ec,null))[_0x76aa('0x44')](handleError(_0x3fa7ec,null));};exports[_0x76aa('0x4c')]=function(_0x27fc84,_0x1fd2b6){var _0x5c742c={},_0xb9401b={},_0x163440={'count':0x0,'rows':[]};_0xb9401b[_0x76aa('0x2d')]=_[_0x76aa('0x2e')](db[_0x76aa('0x2b')][_0x76aa('0x2c')]);var _0x4e6c09={'dateStart':_0x27fc84[_0x76aa('0x2f')][_0x76aa('0x30')],'dateEnd':_0x27fc84[_0x76aa('0x2f')][_0x76aa('0x31')]};delete _0x27fc84[_0x76aa('0x2f')][_0x76aa('0x30')];delete _0x27fc84[_0x76aa('0x2f')]['dateEnd'];_0xb9401b['query']=_[_0x76aa('0x2e')](_0x27fc84[_0x76aa('0x2f')]);_0xb9401b['filters']=_[_0x76aa('0x32')](_0xb9401b[_0x76aa('0x2d')],_0xb9401b['query']);_0x5c742c[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0xb9401b[_0x76aa('0x2d')],qs[_0x76aa('0x46')](_0x27fc84[_0x76aa('0x2f')][_0x76aa('0x46')]));_0x5c742c[_0x76aa('0x33')]=_0x5c742c[_0x76aa('0x33')][_0x76aa('0x34')]?_0x5c742c['attributes']:_0xb9401b[_0x76aa('0x2d')];if(!_0x27fc84['query'][_0x76aa('0x4d')](_0x76aa('0x35'))){_0x5c742c[_0x76aa('0x36')]=qs[_0x76aa('0x36')](_0x27fc84[_0x76aa('0x2f')][_0x76aa('0x36')]);_0x5c742c[_0x76aa('0x1d')]=qs[_0x76aa('0x1d')](_0x27fc84[_0x76aa('0x2f')]['offset']);}_0x5c742c[_0x76aa('0x37')]=qs[_0x76aa('0x38')](_0x27fc84[_0x76aa('0x2f')][_0x76aa('0x38')]);_0x5c742c[_0x76aa('0x3e')]=qs[_0x76aa('0x39')](_[_0x76aa('0x3a')](_0x27fc84[_0x76aa('0x2f')],_0xb9401b['filters']));if(_0x4e6c09[_0x76aa('0x30')]){if(_0x4e6c09['dateEnd']){_0x4e6c09[_0x76aa('0x31')]=moment(_0x4e6c09[_0x76aa('0x31')])[_0x76aa('0x3b')](0x1,_0x76aa('0x3c'));}else{_0x4e6c09[_0x76aa('0x31')]=moment(_0x4e6c09[_0x76aa('0x30')])[_0x76aa('0x3b')](0x1,'day');}_[_0x76aa('0x3d')](_0x5c742c[_0x76aa('0x3e')],{'createdAt':{'$gte':_0x4e6c09['dateStart'],'$lte':_0x4e6c09['dateEnd']}});}if(_0x27fc84[_0x76aa('0x2f')][_0x76aa('0x3f')]){_0x5c742c['where']=_[_0x76aa('0x3d')](_0x5c742c[_0x76aa('0x3e')],{'$or':_[_0x76aa('0x40')](_0x5c742c['attributes'],function(_0x446073){var _0x47f733={};_0x47f733[_0x446073]={'$like':'%'+_0x27fc84[_0x76aa('0x2f')][_0x76aa('0x3f')]+'%'};return _0x47f733;})});}_0x5c742c=_[_0x76aa('0x3d')]({},_0x5c742c,_0x27fc84[_0x76aa('0x41')]);var _0x55ca84={'where':_0x5c742c['where']};return db[_0x76aa('0x2b')]['count'](_0x55ca84)[_0x76aa('0x23')](function(_0x28feb2){_0x163440[_0x76aa('0x1c')]=_0x28feb2;if(_0x27fc84[_0x76aa('0x2f')][_0x76aa('0x42')]){_0x5c742c[_0x76aa('0x4e')]=[{'all':!![]}];}return db[_0x76aa('0x2b')][_0x76aa('0x4f')](_0x5c742c);})[_0x76aa('0x23')](function(_0x54390f){_0x163440[_0x76aa('0x43')]=_0x54390f;return _0x163440;})[_0x76aa('0x23')](respondWithFilteredResult(_0x1fd2b6,_0x5c742c,_0x76aa('0x4c')))[_0x76aa('0x44')](handleError(_0x1fd2b6,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x9957=['ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','count','offset','apply','save','update','then','destroy','error','name','send','index','VoiceQueueReport','rawAttributes','query','dateStart','dateEnd','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','map','includeAll','rows','catch','keys','fields','length','options','find','create','body','describe','getVoiceQueuesReport','limit','include','findAll','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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 qs=require(_0x7995('0x13'));var logger=require(_0x7995('0x14'))(_0x7995('0x15'));var utils=require(_0x7995('0x16'));var config=require('../../config/environment');var db=require(_0x7995('0x17'))['db'];config[_0x7995('0x18')]=_['defaults'](config[_0x7995('0x18')],{'host':_0x7995('0x19'),'port':0x18eb});var socket=require(_0x7995('0x1a'))(new Redis(config[_0x7995('0x18')]));require(_0x7995('0x1b'))[_0x7995('0x1c')](socket);function respondWithStatusCode(_0x2bbe7a,_0x4cc004){_0x4cc004=_0x4cc004||0xcc;return function(_0x58f5ad){if(_0x58f5ad){return _0x2bbe7a[_0x7995('0x1d')](_0x4cc004);}return _0x2bbe7a[_0x7995('0x1e')](_0x4cc004)[_0x7995('0x1f')]();};}function respondWithResult(_0x321ae8,_0x3f1d3e){_0x3f1d3e=_0x3f1d3e||0xc8;return function(_0x1a5310){if(_0x1a5310){return _0x321ae8[_0x7995('0x1e')](_0x3f1d3e)[_0x7995('0x20')](_0x1a5310);}};}function respondWithFilteredResult(_0x5377e5,_0x2eeacc){return function(_0x565d97){if(_0x565d97){var _0x2f832e=_0x565d97[_0x7995('0x21')],_0x37f297=_0x2eeacc[_0x7995('0x22')],_0x43d4b8=_0x2eeacc['offset']+_0x2eeacc['limit'],_0x291317;if(_0x43d4b8>=_0x2f832e){_0x43d4b8=_0x2f832e;_0x291317=0xc8;}else{_0x291317=0xce;}_0x5377e5[_0x7995('0x1e')](_0x291317);return _0x5377e5['set']('Content-Range',_0x37f297+'-'+_0x43d4b8+'/'+_0x2f832e)[_0x7995('0x20')](_0x565d97);}return null;};}function patchUpdates(_0x3d463e){return function(_0x4cbe10){try{jsonpatch[_0x7995('0x23')](_0x4cbe10,_0x3d463e,!![]);}catch(_0x51f276){return BPromise['reject'](_0x51f276);}return _0x4cbe10[_0x7995('0x24')]();};}function saveUpdates(_0x327b1f,_0x350fd9){return function(_0x1a8568){if(_0x1a8568){return _0x1a8568[_0x7995('0x25')](_0x327b1f)[_0x7995('0x26')](function(_0x5d40ae){return _0x5d40ae;});}return null;};}function removeEntity(_0x32a09a,_0x46ee4b){return function(_0x204507){if(_0x204507){return _0x204507[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x32a09a[_0x7995('0x1e')](0xcc)[_0x7995('0x1f')]();});}};}function handleEntityNotFound(_0x472195,_0x59405a){return function(_0x39df42){if(!_0x39df42){_0x472195[_0x7995('0x1d')](0x194);}return _0x39df42;};}function handleError(_0x401dc3,_0x268ce7){_0x268ce7=_0x268ce7||0x1f4;return function(_0x3a3fcf){logger[_0x7995('0x28')](_0x3a3fcf['stack']);if(_0x3a3fcf[_0x7995('0x29')]){delete _0x3a3fcf['name'];}_0x401dc3[_0x7995('0x1e')](_0x268ce7)[_0x7995('0x2a')](_0x3a3fcf);};}exports[_0x7995('0x2b')]=function(_0x132a42,_0x11c1eb){var _0x4b6f99={},_0x9b2a15={},_0x514445={'count':0x0,'rows':[]};var _0x456a28=db[_0x7995('0x2c')][_0x7995('0x2d')];_0x9b2a15['model']=_['keys'](_0x456a28);var _0x48e573={'dateStart':_0x132a42[_0x7995('0x2e')][_0x7995('0x2f')],'dateEnd':_0x132a42[_0x7995('0x2e')][_0x7995('0x30')]};delete _0x132a42[_0x7995('0x2e')][_0x7995('0x2f')];delete _0x132a42['query']['dateEnd'];_0x9b2a15[_0x7995('0x2e')]=_['keys'](_0x132a42[_0x7995('0x2e')]);_0x9b2a15[_0x7995('0x31')]=_[_0x7995('0x32')](_0x9b2a15[_0x7995('0x33')],_0x9b2a15[_0x7995('0x2e')]);_0x4b6f99['attributes']=_[_0x7995('0x32')](_0x9b2a15[_0x7995('0x33')],qs['fields'](_0x132a42['query']['fields']));_0x4b6f99[_0x7995('0x34')]=_0x4b6f99[_0x7995('0x34')]['length']?_0x4b6f99[_0x7995('0x34')]:_0x9b2a15['model'];if(!_0x132a42[_0x7995('0x2e')][_0x7995('0x35')](_0x7995('0x36'))){_0x4b6f99['limit']=qs['limit'](_0x132a42[_0x7995('0x2e')]['limit']);_0x4b6f99['offset']=qs[_0x7995('0x22')](_0x132a42[_0x7995('0x2e')]['offset']);}_0x4b6f99[_0x7995('0x37')]=qs[_0x7995('0x38')](_0x132a42[_0x7995('0x2e')][_0x7995('0x38')]);_0x4b6f99[_0x7995('0x39')]=qs['filters'](_[_0x7995('0x3a')](_0x132a42[_0x7995('0x2e')],_0x9b2a15[_0x7995('0x31')]));if(_0x48e573[_0x7995('0x2f')]){if(_0x48e573['dateEnd']){_0x48e573[_0x7995('0x30')]=moment(_0x48e573[_0x7995('0x30')])[_0x7995('0x3b')](0x1,_0x7995('0x3c'));}else{_0x48e573[_0x7995('0x30')]=moment(_0x48e573[_0x7995('0x2f')])['add'](0x1,_0x7995('0x3c'));}_[_0x7995('0x3d')](_0x4b6f99[_0x7995('0x39')],{'createdAt':{'$gte':_0x48e573[_0x7995('0x2f')],'$lte':_0x48e573[_0x7995('0x30')]}});}if(_0x132a42[_0x7995('0x2e')][_0x7995('0x3e')]){_0x4b6f99[_0x7995('0x39')]=_[_0x7995('0x3d')](_0x4b6f99[_0x7995('0x39')],{'$or':_[_0x7995('0x3f')](_0x4b6f99[_0x7995('0x34')],function(_0x7b4e67){var _0x53cda2={};_0x53cda2[_0x7b4e67]={'$like':'%'+_0x132a42['query'][_0x7995('0x3e')]+'%'};return _0x53cda2;})});}_0x4b6f99=_[_0x7995('0x3d')]({},_0x4b6f99,_0x132a42['options']);var _0x4b0855={'where':_0x4b6f99[_0x7995('0x39')]};return db['VoiceQueueReport']['count'](_0x4b0855)[_0x7995('0x26')](function(_0x36e28b){_0x514445[_0x7995('0x21')]=_0x36e28b;if(_0x132a42['query'][_0x7995('0x40')]){_0x4b6f99['include']=[{'all':!![]}];}return db[_0x7995('0x2c')]['findAll'](_0x4b6f99);})['then'](function(_0x39c5b8){_0x514445[_0x7995('0x41')]=_0x39c5b8;return _0x514445;})[_0x7995('0x26')](respondWithFilteredResult(_0x11c1eb,_0x4b6f99))[_0x7995('0x42')](handleError(_0x11c1eb,null));};exports['show']=function(_0x3c5cde,_0x40fc68){var _0x31b347={'raw':![],'where':{'id':_0x3c5cde['params']['id']}},_0x6c7bec={};_0x6c7bec['model']=_[_0x7995('0x43')](db['VoiceQueueReport'][_0x7995('0x2d')]);_0x6c7bec['query']=_[_0x7995('0x43')](_0x3c5cde['query']);_0x6c7bec[_0x7995('0x31')]=_[_0x7995('0x32')](_0x6c7bec['model'],_0x6c7bec[_0x7995('0x2e')]);_0x31b347[_0x7995('0x34')]=_[_0x7995('0x32')](_0x6c7bec[_0x7995('0x33')],qs['fields'](_0x3c5cde[_0x7995('0x2e')][_0x7995('0x44')]));_0x31b347[_0x7995('0x34')]=_0x31b347['attributes'][_0x7995('0x45')]?_0x31b347[_0x7995('0x34')]:_0x6c7bec[_0x7995('0x33')];if(_0x3c5cde[_0x7995('0x2e')][_0x7995('0x40')]){_0x31b347['include']=[{'all':!![]}];}_0x31b347=_[_0x7995('0x3d')]({},_0x31b347,_0x3c5cde[_0x7995('0x46')]);return db['VoiceQueueReport'][_0x7995('0x47')](_0x31b347)['then'](handleEntityNotFound(_0x40fc68,null))[_0x7995('0x26')](respondWithResult(_0x40fc68,null))[_0x7995('0x42')](handleError(_0x40fc68,null));};exports[_0x7995('0x48')]=function(_0x30e220,_0xddf537){return db[_0x7995('0x2c')][_0x7995('0x48')](_0x30e220['body'],{})[_0x7995('0x26')](respondWithResult(_0xddf537,0xc9))[_0x7995('0x42')](handleError(_0xddf537,null));};exports[_0x7995('0x25')]=function(_0x4ffc8a,_0x19da63){if(_0x4ffc8a[_0x7995('0x49')]['id']){delete _0x4ffc8a[_0x7995('0x49')]['id'];}return db['VoiceQueueReport']['find']({'where':{'id':_0x4ffc8a['params']['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](saveUpdates(_0x4ffc8a['body'],null))[_0x7995('0x26')](respondWithResult(_0x19da63,null))[_0x7995('0x42')](handleError(_0x19da63,null));};exports[_0x7995('0x27')]=function(_0x1a9bd7,_0xc04004){return db['VoiceQueueReport'][_0x7995('0x47')]({'where':{'id':_0x1a9bd7['params']['id']}})[_0x7995('0x26')](handleEntityNotFound(_0xc04004,null))[_0x7995('0x26')](removeEntity(_0xc04004,null))[_0x7995('0x42')](handleError(_0xc04004,null));};exports['describe']=function(_0x5e1f34,_0x54e2b1){return db['VoiceQueueReport'][_0x7995('0x4a')]()[_0x7995('0x26')](respondWithResult(_0x54e2b1,null))[_0x7995('0x42')](handleError(_0x54e2b1,null));};exports[_0x7995('0x4b')]=function(_0x1d957e,_0x357e60){var _0x1f4270={},_0xda6ce8={},_0x328671={'count':0x0,'rows':[]};_0xda6ce8[_0x7995('0x33')]=_[_0x7995('0x43')](db[_0x7995('0x2c')][_0x7995('0x2d')]);var _0x35bea3={'dateStart':_0x1d957e[_0x7995('0x2e')][_0x7995('0x2f')],'dateEnd':_0x1d957e[_0x7995('0x2e')][_0x7995('0x30')]};delete _0x1d957e[_0x7995('0x2e')]['dateStart'];delete _0x1d957e[_0x7995('0x2e')][_0x7995('0x30')];_0xda6ce8[_0x7995('0x2e')]=_[_0x7995('0x43')](_0x1d957e['query']);_0xda6ce8['filters']=_[_0x7995('0x32')](_0xda6ce8[_0x7995('0x33')],_0xda6ce8[_0x7995('0x2e')]);_0x1f4270[_0x7995('0x34')]=_['intersection'](_0xda6ce8[_0x7995('0x33')],qs[_0x7995('0x44')](_0x1d957e[_0x7995('0x2e')][_0x7995('0x44')]));_0x1f4270['attributes']=_0x1f4270['attributes'][_0x7995('0x45')]?_0x1f4270[_0x7995('0x34')]:_0xda6ce8[_0x7995('0x33')];if(!_0x1d957e[_0x7995('0x2e')][_0x7995('0x35')](_0x7995('0x36'))){_0x1f4270[_0x7995('0x4c')]=qs[_0x7995('0x4c')](_0x1d957e[_0x7995('0x2e')]['limit']);_0x1f4270[_0x7995('0x22')]=qs[_0x7995('0x22')](_0x1d957e[_0x7995('0x2e')][_0x7995('0x22')]);}_0x1f4270['order']=qs['sort'](_0x1d957e[_0x7995('0x2e')][_0x7995('0x38')]);_0x1f4270['where']=qs[_0x7995('0x31')](_[_0x7995('0x3a')](_0x1d957e[_0x7995('0x2e')],_0xda6ce8[_0x7995('0x31')]));if(_0x35bea3[_0x7995('0x2f')]){if(_0x35bea3['dateEnd']){_0x35bea3[_0x7995('0x30')]=moment(_0x35bea3['dateEnd'])[_0x7995('0x3b')](0x1,_0x7995('0x3c'));}else{_0x35bea3[_0x7995('0x30')]=moment(_0x35bea3[_0x7995('0x2f')])[_0x7995('0x3b')](0x1,_0x7995('0x3c'));}_[_0x7995('0x3d')](_0x1f4270[_0x7995('0x39')],{'createdAt':{'$gte':_0x35bea3[_0x7995('0x2f')],'$lte':_0x35bea3[_0x7995('0x30')]}});}if(_0x1d957e[_0x7995('0x2e')][_0x7995('0x3e')]){_0x1f4270['where']=_[_0x7995('0x3d')](_0x1f4270[_0x7995('0x39')],{'$or':_[_0x7995('0x3f')](_0x1f4270[_0x7995('0x34')],function(_0x2c6548){var _0x54a2e0={};_0x54a2e0[_0x2c6548]={'$like':'%'+_0x1d957e['query'][_0x7995('0x3e')]+'%'};return _0x54a2e0;})});}_0x1f4270=_[_0x7995('0x3d')]({},_0x1f4270,_0x1d957e[_0x7995('0x46')]);var _0xae6166={'where':_0x1f4270['where']};return db[_0x7995('0x2c')]['count'](_0xae6166)['then'](function(_0xca8238){_0x328671[_0x7995('0x21')]=_0xca8238;if(_0x1d957e[_0x7995('0x2e')][_0x7995('0x40')]){_0x1f4270[_0x7995('0x4d')]=[{'all':!![]}];}return db[_0x7995('0x2c')][_0x7995('0x4e')](_0x1f4270);})[_0x7995('0x26')](function(_0x3fde86){_0x328671[_0x7995('0x41')]=_0x3fde86;return _0x328671;})['then'](respondWithFilteredResult(_0x357e60,_0x1f4270,_0x7995('0x4b')))[_0x7995('0x42')](handleError(_0x357e60,null,_0x7995('0x4b')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 3f4806b..0889806 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 _0x7299=['VoiceQueueReport','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7299,0x14b));var _0x9729=function(_0x255dba,_0x363b3c){_0x255dba=_0x255dba-0x0;var _0x4764e2=_0x7299[_0x255dba];return _0x4764e2;};'use strict';var EventEmitter=require(_0x9729('0x0'));var VoiceQueueReport=require(_0x9729('0x1'))['db'][_0x9729('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9729('0x3'),'afterUpdate':_0x9729('0x4'),'afterDestroy':'remove'};function emitEvent(_0x13673f){return function(_0x443349,_0x52307a,_0xee9647){VoiceQueueReportEvents['emit'](_0x13673f+':'+_0x443349['id'],_0x443349);VoiceQueueReportEvents[_0x9729('0x5')](_0x13673f,_0x443349);_0xee9647(null);};}for(var e in events){if(events[_0x9729('0x6')](e)){var event=events[e];VoiceQueueReport[_0x9729('0x7')](e,emitEvent(event));}}module[_0x9729('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xf7f8=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save'];(function(_0x3725ee,_0x543bd9){var _0x399c71=function(_0xaf9400){while(--_0xaf9400){_0x3725ee['push'](_0x3725ee['shift']());}};_0x399c71(++_0x543bd9);}(_0xf7f8,0x13b));var _0x8f7f=function(_0x40dea3,_0x35749c){_0x40dea3=_0x40dea3-0x0;var _0x2f4c0c=_0xf7f8[_0x40dea3];return _0x2f4c0c;};'use strict';var EventEmitter=require(_0x8f7f('0x0'));var VoiceQueueReport=require(_0x8f7f('0x1'))['db'][_0x8f7f('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x8f7f('0x3')](0x0);var events={'afterCreate':_0x8f7f('0x4'),'afterUpdate':_0x8f7f('0x5'),'afterDestroy':_0x8f7f('0x6')};function emitEvent(_0xc55059){return function(_0x2ca35c,_0x337189,_0x1340d9){VoiceQueueReportEvents[_0x8f7f('0x7')](_0xc55059+':'+_0x2ca35c['id'],_0x2ca35c);VoiceQueueReportEvents['emit'](_0xc55059,_0x2ca35c);_0x1340d9(null);};}for(var e in events){if(events[_0x8f7f('0x8')](e)){var event=events[e];VoiceQueueReport[_0x8f7f('0x9')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 76f00c4..d37c8e0 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 _0x9fa1=['calleridnum','util','../../config/logger','api','moment','bluebird','define','VoiceQueueReport','report_queue','uniqueid'];(function(_0x549301,_0x45a3c2){var _0x41ea39=function(_0x12a836){while(--_0x12a836){_0x549301['push'](_0x549301['shift']());}};_0x41ea39(++_0x45a3c2);}(_0x9fa1,0x10f));var _0x19fa=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9fa1[_0x2b7764];return _0x848dcb;};'use strict';var _=require('lodash');var util=require(_0x19fa('0x0'));var logger=require(_0x19fa('0x1'))(_0x19fa('0x2'));var moment=require(_0x19fa('0x3'));var BPromise=require(_0x19fa('0x4'));var rp=require('request-promise');var attributes=require('./voiceQueueReport.attributes');module['exports']=function(_0x52ba66,_0x212322){return _0x52ba66[_0x19fa('0x5')](_0x19fa('0x6'),attributes,{'tableName':_0x19fa('0x7'),'paranoid':![],'indexes':[{'fields':[_0x19fa('0x8')]},{'fields':[_0x19fa('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbfb5=['api','bluebird','request-promise','./voiceQueueReport.attributes','exports','VoiceQueueReport','uniqueid','calleridnum','util','../../config/logger'];(function(_0x5b4a94,_0x39e9ae){var _0x97d164=function(_0x490f24){while(--_0x490f24){_0x5b4a94['push'](_0x5b4a94['shift']());}};_0x97d164(++_0x39e9ae);}(_0xbfb5,0xb2));var _0x5bfb=function(_0x187cfe,_0x5cad42){_0x187cfe=_0x187cfe-0x0;var _0x5eacc4=_0xbfb5[_0x187cfe];return _0x5eacc4;};'use strict';var _=require('lodash');var util=require(_0x5bfb('0x0'));var logger=require(_0x5bfb('0x1'))(_0x5bfb('0x2'));var moment=require('moment');var BPromise=require(_0x5bfb('0x3'));var rp=require(_0x5bfb('0x4'));var attributes=require(_0x5bfb('0x5'));module[_0x5bfb('0x6')]=function(_0x288380,_0x152add){return _0x288380['define'](_0x5bfb('0x7'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x5bfb('0x8')]},{'fields':[_0x5bfb('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 2278995..a4e3c5f 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 _0x4ced=['body','UpdateVoiceQueueReport','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','./voiceQueueReport.socket','register','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','CreateVoiceQueueReport','create'];(function(_0x7b1852,_0x5a90f6){var _0x5c0d48=function(_0x5d5186){while(--_0x5d5186){_0x7b1852['push'](_0x7b1852['shift']());}};_0x5c0d48(++_0x5a90f6);}(_0x4ced,0x7d));var _0xd4ce=function(_0x5cd89a,_0x1fd7f2){_0x5cd89a=_0x5cd89a-0x0;var _0x2cc6ce=_0x4ced[_0x5cd89a];return _0x2cc6ce;};'use strict';var _=require(_0xd4ce('0x0'));var util=require(_0xd4ce('0x1'));var moment=require('moment');var BPromise=require(_0xd4ce('0x2'));var rs=require(_0xd4ce('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4ce('0x4'))['db'];var utils=require(_0xd4ce('0x5'));var logger=require(_0xd4ce('0x6'))('rpc');var config=require(_0xd4ce('0x7'));var jayson=require(_0xd4ce('0x8'));var client=jayson['client'][_0xd4ce('0x9')]({'port':0x232a});config[_0xd4ce('0xa')]=_[_0xd4ce('0xb')](config[_0xd4ce('0xa')],{'host':_0xd4ce('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd4ce('0xa')]));require(_0xd4ce('0xd'))[_0xd4ce('0xe')](socket);function respondWithRpcPromise(_0x509fae,_0x20eceb,_0x15d4a0){return new BPromise(function(_0x344786,_0x1f1433){return client['request'](_0x509fae,_0x15d4a0)[_0xd4ce('0xf')](function(_0xe92e72){logger[_0xd4ce('0x10')](_0xd4ce('0x11'),_0x20eceb,_0xd4ce('0x12'));logger[_0xd4ce('0x13')](_0xd4ce('0x14'),_0x20eceb,_0xd4ce('0x12'),JSON[_0xd4ce('0x15')](_0xe92e72));if(_0xe92e72[_0xd4ce('0x16')]){if(_0xe92e72['error']['code']===0x1f4){logger[_0xd4ce('0x16')](_0xd4ce('0x11'),_0x20eceb,_0xe92e72[_0xd4ce('0x16')][_0xd4ce('0x17')]);return _0x1f1433(_0xe92e72[_0xd4ce('0x16')][_0xd4ce('0x17')]);}logger[_0xd4ce('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x20eceb,_0xe92e72[_0xd4ce('0x16')][_0xd4ce('0x17')]);return _0x344786(_0xe92e72[_0xd4ce('0x16')][_0xd4ce('0x17')]);}else{logger[_0xd4ce('0x10')](_0xd4ce('0x11'),_0x20eceb,_0xd4ce('0x12'));_0x344786(_0xe92e72[_0xd4ce('0x18')][_0xd4ce('0x17')]);}})[_0xd4ce('0x19')](function(_0xb572c6){logger[_0xd4ce('0x16')](_0xd4ce('0x11'),_0x20eceb,_0xb572c6);_0x1f1433(_0xb572c6);});});}exports[_0xd4ce('0x1a')]=function(_0x4df305){var _0x289690=this;return new Promise(function(_0x58ac1f,_0x271fd1){return db[_0xd4ce('0x1b')][_0xd4ce('0x1c')]({'raw':_0x4df305[_0xd4ce('0x1d')]?_0x4df305['options'][_0xd4ce('0x1e')]===undefined?!![]:![]:!![],'where':_0x4df305[_0xd4ce('0x1d')]?_0x4df305[_0xd4ce('0x1d')][_0xd4ce('0x1f')]||null:null,'attributes':_0x4df305['options']?_0x4df305['options'][_0xd4ce('0x20')]||null:null,'limit':_0x4df305[_0xd4ce('0x1d')]?_0x4df305[_0xd4ce('0x1d')][_0xd4ce('0x21')]||null:null,'include':_0x4df305[_0xd4ce('0x1d')]?_0x4df305[_0xd4ce('0x1d')][_0xd4ce('0x22')]?_[_0xd4ce('0x23')](_0x4df305['options']['include'],function(_0x2853dd){return{'model':db[_0x2853dd[_0xd4ce('0x24')]],'as':_0x2853dd['as'],'attributes':_0x2853dd[_0xd4ce('0x20')],'include':_0x2853dd[_0xd4ce('0x22')]?_[_0xd4ce('0x23')](_0x2853dd[_0xd4ce('0x22')],function(_0xebac25){return{'model':db[_0xebac25['model']],'as':_0xebac25['as'],'attributes':_0xebac25['attributes'],'include':_0xebac25[_0xd4ce('0x22')]?_[_0xd4ce('0x23')](_0xebac25[_0xd4ce('0x22')],function(_0x1660af){return{'model':db[_0x1660af[_0xd4ce('0x24')]],'as':_0x1660af['as'],'attributes':_0x1660af['attributes']};}):[]};}):[]};}):[]:[]})[_0xd4ce('0xf')](function(_0x249aff){logger['info'](_0xd4ce('0x1a'),_0x4df305);logger['debug'](_0xd4ce('0x1a'),_0x4df305,JSON[_0xd4ce('0x15')](_0x249aff));_0x58ac1f(_0x249aff);})[_0xd4ce('0x19')](function(_0x532cdc){logger[_0xd4ce('0x16')](_0xd4ce('0x1a'),_0x532cdc[_0xd4ce('0x17')],_0x4df305);_0x271fd1(_0x289690[_0xd4ce('0x16')](0x1f4,_0x532cdc[_0xd4ce('0x17')]));});});};exports[_0xd4ce('0x25')]=function(_0xe12636){var _0x1612ba=this;return new Promise(function(_0x1ff94b,_0x276698){return db[_0xd4ce('0x1b')][_0xd4ce('0x26')](_0xe12636[_0xd4ce('0x27')],{'raw':_0xe12636[_0xd4ce('0x1d')]?_0xe12636[_0xd4ce('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xd4ce('0xf')](function(_0x475313){logger[_0xd4ce('0x10')]('CreateVoiceQueueReport',_0xe12636);logger['debug'](_0xd4ce('0x25'),_0xe12636,JSON['stringify'](_0x475313));_0x1ff94b(_0x475313);})['catch'](function(_0x3eb82a){logger[_0xd4ce('0x16')]('CreateVoiceQueueReport',_0x3eb82a['message'],_0xe12636);_0x276698(_0x1612ba[_0xd4ce('0x16')](0x1f4,_0x3eb82a['message']));});});};exports[_0xd4ce('0x28')]=function(_0x4c2bad){var _0x603b=this;return new Promise(function(_0x1c9481,_0x49142a){return db[_0xd4ce('0x1b')]['update'](_0x4c2bad[_0xd4ce('0x27')],{'raw':_0x4c2bad[_0xd4ce('0x1d')]?_0x4c2bad['options'][_0xd4ce('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c2bad[_0xd4ce('0x1d')]?_0x4c2bad['options'][_0xd4ce('0x1f')]||null:null,'attributes':_0x4c2bad[_0xd4ce('0x1d')]?_0x4c2bad[_0xd4ce('0x1d')]['attributes']||null:null,'limit':_0x4c2bad[_0xd4ce('0x1d')]?_0x4c2bad['options']['limit']||null:null})[_0xd4ce('0xf')](function(_0x4aeee3){logger['info'](_0xd4ce('0x28'),_0x4c2bad);logger[_0xd4ce('0x13')](_0xd4ce('0x28'),_0x4c2bad,JSON['stringify'](_0x4aeee3));_0x1c9481(_0x4aeee3);})[_0xd4ce('0x19')](function(_0x2bf378){logger[_0xd4ce('0x16')](_0xd4ce('0x28'),_0x2bf378['message'],_0x4c2bad);_0x49142a(_0x603b[_0xd4ce('0x16')](0x1f4,_0x2bf378['message']));});});}; \ No newline at end of file +var _0xfb90=['request\x20sent','debug','stringify','error','message','info','result','catch','GetVoiceQueueReport','findAll','options','attributes','limit','map','include','model','CreateVoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','where','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./voiceQueueReport.socket','register','request','then','VoiceQueueReport,\x20%s,\x20%s'];(function(_0x302f30,_0x10266d){var _0x101158=function(_0x3d0a69){while(--_0x3d0a69){_0x302f30['push'](_0x302f30['shift']());}};_0x101158(++_0x10266d);}(_0xfb90,0x1a6));var _0x0fb9=function(_0x204d21,_0x5d3952){_0x204d21=_0x204d21-0x0;var _0x55df50=_0xfb90[_0x204d21];return _0x55df50;};'use strict';var _=require(_0x0fb9('0x0'));var util=require('util');var moment=require(_0x0fb9('0x1'));var BPromise=require(_0x0fb9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0fb9('0x3'));var db=require(_0x0fb9('0x4'))['db'];var utils=require(_0x0fb9('0x5'));var logger=require(_0x0fb9('0x6'))(_0x0fb9('0x7'));var config=require(_0x0fb9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0fb9('0x9')][_0x0fb9('0xa')]({'port':0x232a});config[_0x0fb9('0xb')]=_['defaults'](config[_0x0fb9('0xb')],{'host':_0x0fb9('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0fb9('0xb')]));require(_0x0fb9('0xd'))[_0x0fb9('0xe')](socket);function respondWithRpcPromise(_0x39b519,_0x2cffa7,_0x55164e){return new BPromise(function(_0x20e973,_0x371f6c){return client[_0x0fb9('0xf')](_0x39b519,_0x55164e)[_0x0fb9('0x10')](function(_0x52329c){logger['info'](_0x0fb9('0x11'),_0x2cffa7,_0x0fb9('0x12'));logger[_0x0fb9('0x13')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x2cffa7,_0x0fb9('0x12'),JSON[_0x0fb9('0x14')](_0x52329c));if(_0x52329c[_0x0fb9('0x15')]){if(_0x52329c[_0x0fb9('0x15')]['code']===0x1f4){logger[_0x0fb9('0x15')](_0x0fb9('0x11'),_0x2cffa7,_0x52329c['error'][_0x0fb9('0x16')]);return _0x371f6c(_0x52329c[_0x0fb9('0x15')][_0x0fb9('0x16')]);}logger[_0x0fb9('0x15')](_0x0fb9('0x11'),_0x2cffa7,_0x52329c[_0x0fb9('0x15')][_0x0fb9('0x16')]);return _0x20e973(_0x52329c[_0x0fb9('0x15')][_0x0fb9('0x16')]);}else{logger[_0x0fb9('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x2cffa7,_0x0fb9('0x12'));_0x20e973(_0x52329c[_0x0fb9('0x18')][_0x0fb9('0x16')]);}})[_0x0fb9('0x19')](function(_0x4bc0e8){logger[_0x0fb9('0x15')](_0x0fb9('0x11'),_0x2cffa7,_0x4bc0e8);_0x371f6c(_0x4bc0e8);});});}exports[_0x0fb9('0x1a')]=function(_0x3c2a29){var _0x20241d=this;return new Promise(function(_0x28cb6c,_0x1bf93d){return db['VoiceQueueReport'][_0x0fb9('0x1b')]({'raw':_0x3c2a29[_0x0fb9('0x1c')]?_0x3c2a29[_0x0fb9('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3c2a29[_0x0fb9('0x1c')]?_0x3c2a29[_0x0fb9('0x1c')]['where']||null:null,'attributes':_0x3c2a29[_0x0fb9('0x1c')]?_0x3c2a29['options'][_0x0fb9('0x1d')]||null:null,'limit':_0x3c2a29[_0x0fb9('0x1c')]?_0x3c2a29[_0x0fb9('0x1c')][_0x0fb9('0x1e')]||null:null,'include':_0x3c2a29['options']?_0x3c2a29[_0x0fb9('0x1c')]['include']?_[_0x0fb9('0x1f')](_0x3c2a29[_0x0fb9('0x1c')][_0x0fb9('0x20')],function(_0x1861ab){return{'model':db[_0x1861ab[_0x0fb9('0x21')]],'as':_0x1861ab['as'],'attributes':_0x1861ab[_0x0fb9('0x1d')],'include':_0x1861ab[_0x0fb9('0x20')]?_[_0x0fb9('0x1f')](_0x1861ab[_0x0fb9('0x20')],function(_0x15337b){return{'model':db[_0x15337b[_0x0fb9('0x21')]],'as':_0x15337b['as'],'attributes':_0x15337b['attributes'],'include':_0x15337b[_0x0fb9('0x20')]?_[_0x0fb9('0x1f')](_0x15337b[_0x0fb9('0x20')],function(_0x21f799){return{'model':db[_0x21f799[_0x0fb9('0x21')]],'as':_0x21f799['as'],'attributes':_0x21f799[_0x0fb9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0fb9('0x10')](function(_0x3a64a8){logger['info'](_0x0fb9('0x1a'),_0x3c2a29);logger[_0x0fb9('0x13')](_0x0fb9('0x1a'),_0x3c2a29,JSON[_0x0fb9('0x14')](_0x3a64a8));_0x28cb6c(_0x3a64a8);})['catch'](function(_0x14e21d){logger[_0x0fb9('0x15')](_0x0fb9('0x1a'),_0x14e21d[_0x0fb9('0x16')],_0x3c2a29);_0x1bf93d(_0x20241d[_0x0fb9('0x15')](0x1f4,_0x14e21d[_0x0fb9('0x16')]));});});};exports[_0x0fb9('0x22')]=function(_0x43052b){var _0x51a4d4=this;return new Promise(function(_0x3dd1a1,_0x1107db){return db['VoiceQueueReport'][_0x0fb9('0x23')](_0x43052b[_0x0fb9('0x24')],{'raw':_0x43052b[_0x0fb9('0x1c')]?_0x43052b['options'][_0x0fb9('0x25')]===undefined?!![]:![]:!![]})[_0x0fb9('0x10')](function(_0x5aea7e){logger[_0x0fb9('0x17')]('CreateVoiceQueueReport',_0x43052b);logger[_0x0fb9('0x13')](_0x0fb9('0x22'),_0x43052b,JSON[_0x0fb9('0x14')](_0x5aea7e));_0x3dd1a1(_0x5aea7e);})[_0x0fb9('0x19')](function(_0x3c76e3){logger[_0x0fb9('0x15')](_0x0fb9('0x22'),_0x3c76e3['message'],_0x43052b);_0x1107db(_0x51a4d4['error'](0x1f4,_0x3c76e3[_0x0fb9('0x16')]));});});};exports[_0x0fb9('0x26')]=function(_0x28d74d){var _0x39f1dd=this;return new Promise(function(_0xc35fb8,_0x3f0811){return db['VoiceQueueReport']['update'](_0x28d74d[_0x0fb9('0x24')],{'raw':_0x28d74d[_0x0fb9('0x1c')]?_0x28d74d[_0x0fb9('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28d74d[_0x0fb9('0x1c')]?_0x28d74d['options'][_0x0fb9('0x27')]||null:null,'attributes':_0x28d74d[_0x0fb9('0x1c')]?_0x28d74d[_0x0fb9('0x1c')][_0x0fb9('0x1d')]||null:null,'limit':_0x28d74d[_0x0fb9('0x1c')]?_0x28d74d[_0x0fb9('0x1c')][_0x0fb9('0x1e')]||null:null})[_0x0fb9('0x10')](function(_0x17e535){logger[_0x0fb9('0x17')](_0x0fb9('0x26'),_0x28d74d);logger[_0x0fb9('0x13')](_0x0fb9('0x26'),_0x28d74d,JSON[_0x0fb9('0x14')](_0x17e535));_0xc35fb8(_0x17e535);})[_0x0fb9('0x19')](function(_0x180c43){logger['error'](_0x0fb9('0x26'),_0x180c43[_0x0fb9('0x16')],_0x28d74d);_0x3f0811(_0x39f1dd[_0x0fb9('0x15')](0x1f4,_0x180c43[_0x0fb9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index f082016..69045a8 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 _0x347a=['removeListener','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit'];(function(_0xea81ab,_0x23eb5e){var _0xb98237=function(_0x132024){while(--_0x132024){_0xea81ab['push'](_0xea81ab['shift']());}};_0xb98237(++_0x23eb5e);}(_0x347a,0x12f));var _0xa347=function(_0x23b1c2,_0x4e40ea){_0x23b1c2=_0x23b1c2-0x0;var _0x254a78=_0x347a[_0x23b1c2];return _0x254a78;};'use strict';var VoiceQueueReportEvents=require(_0xa347('0x0'));var events=[_0xa347('0x1'),_0xa347('0x2'),_0xa347('0x3')];function createListener(_0x36c348,_0x3bfd10){return function(_0x44727a){_0x3bfd10[_0xa347('0x4')](_0x36c348,_0x44727a);};}function removeListener(_0x275fe4,_0x36ea23){return function(){VoiceQueueReportEvents[_0xa347('0x5')](_0x275fe4,_0x36ea23);};}exports['register']=function(_0x5cb45b){for(var _0x48ad21=0x0,_0x17a8ae=events['length'];_0x48ad21<_0x17a8ae;_0x48ad21++){var _0x571bfb=events[_0x48ad21];var _0x423916=createListener(_0xa347('0x6')+_0x571bfb,_0x5cb45b);VoiceQueueReportEvents['on'](_0x571bfb,_0x423916);}}; \ No newline at end of file +var _0x359e=['voiceQueueReport:','./voiceQueueReport.events','remove','update','emit','register','length'];(function(_0x272819,_0x4c7247){var _0x220027=function(_0x53ea53){while(--_0x53ea53){_0x272819['push'](_0x272819['shift']());}};_0x220027(++_0x4c7247);}(_0x359e,0xda));var _0xe359=function(_0x2b5dd7,_0x3cb856){_0x2b5dd7=_0x2b5dd7-0x0;var _0x2bd2e4=_0x359e[_0x2b5dd7];return _0x2bd2e4;};'use strict';var VoiceQueueReportEvents=require(_0xe359('0x0'));var events=['save',_0xe359('0x1'),_0xe359('0x2')];function createListener(_0x6b5bca,_0x320427){return function(_0x80184b){_0x320427[_0xe359('0x3')](_0x6b5bca,_0x80184b);};}function removeListener(_0x2feb39,_0x4166bd){return function(){VoiceQueueReportEvents['removeListener'](_0x2feb39,_0x4166bd);};}exports[_0xe359('0x4')]=function(_0x53d7bd){for(var _0x3df56c=0x0,_0x3a4fe0=events[_0xe359('0x5')];_0x3df56c<_0x3a4fe0;_0x3df56c++){var _0x152ac7=events[_0x3df56c];var _0x16d685=createListener(_0xe359('0x6')+_0x152ac7,_0x53d7bd);VoiceQueueReportEvents['on'](_0x152ac7,_0x16d685);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index e59514e..4f42c7f 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 _0xa467=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','post','create','put','delete','exports','multer'];(function(_0x2d970d,_0x4259f0){var _0x227024=function(_0x2caf1f){while(--_0x2caf1f){_0x2d970d['push'](_0x2d970d['shift']());}};_0x227024(++_0x4259f0);}(_0xa467,0x143));var _0x7a46=function(_0x2d2c39,_0x5c93a2){_0x2d2c39=_0x2d2c39-0x0;var _0x457af8=_0xa467[_0x2d2c39];return _0x457af8;};'use strict';var multer=require(_0x7a46('0x0'));var util=require(_0x7a46('0x1'));var path=require(_0x7a46('0x2'));var timeout=require(_0x7a46('0x3'));var express=require(_0x7a46('0x4'));var router=express[_0x7a46('0x5')]();var auth=require(_0x7a46('0x6'));var interaction=require(_0x7a46('0x7'));var config=require(_0x7a46('0x8'));var controller=require('./voiceQueuesLog.controller');router['get']('/',auth[_0x7a46('0x9')](),controller[_0x7a46('0xa')]);router[_0x7a46('0xb')](_0x7a46('0xc'),auth[_0x7a46('0x9')](),controller['show']);router[_0x7a46('0xd')]('/',auth[_0x7a46('0x9')](),controller[_0x7a46('0xe')]);router[_0x7a46('0xf')](_0x7a46('0xc'),auth[_0x7a46('0x9')](),controller['update']);router[_0x7a46('0x10')]('/:id',auth[_0x7a46('0x9')](),controller['destroy']);module[_0x7a46('0x11')]=router; \ No newline at end of file +var _0x349f=['show','post','create','put','/:id','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index'];(function(_0x44abd2,_0x2d34c8){var _0x4938dc=function(_0x437fdb){while(--_0x437fdb){_0x44abd2['push'](_0x44abd2['shift']());}};_0x4938dc(++_0x2d34c8);}(_0x349f,0xa8));var _0xf349=function(_0xa54823,_0x234249){_0xa54823=_0xa54823-0x0;var _0x2d42d6=_0x349f[_0xa54823];return _0x2d42d6;};'use strict';var multer=require(_0xf349('0x0'));var util=require(_0xf349('0x1'));var path=require(_0xf349('0x2'));var timeout=require('connect-timeout');var express=require(_0xf349('0x3'));var router=express[_0xf349('0x4')]();var auth=require(_0xf349('0x5'));var interaction=require(_0xf349('0x6'));var config=require(_0xf349('0x7'));var controller=require(_0xf349('0x8'));router[_0xf349('0x9')]('/',auth[_0xf349('0xa')](),controller[_0xf349('0xb')]);router[_0xf349('0x9')]('/:id',auth[_0xf349('0xa')](),controller[_0xf349('0xc')]);router[_0xf349('0xd')]('/',auth[_0xf349('0xa')](),controller[_0xf349('0xe')]);router[_0xf349('0xf')](_0xf349('0x10'),auth['isAuthenticated'](),controller['update']);router[_0xf349('0x11')](_0xf349('0x10'),auth[_0xf349('0xa')](),controller[_0xf349('0x12')]);module[_0xf349('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index a94bffd..487483a 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 _0x7217=['sequelize','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x35d4e9,_0x298c61){var _0x5c2770=function(_0x2f326a){while(--_0x2f326a){_0x35d4e9['push'](_0x35d4e9['shift']());}};_0x5c2770(++_0x298c61);}(_0x7217,0x19e));var _0x7721=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x7217[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x7721('0x0'));var moment=require('moment');module[_0x7721('0x1')]={'time':{'type':Sequelize[_0x7721('0x2')]},'callid':{'type':Sequelize[_0x7721('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x7721('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x7721('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x7721('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x7721('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x7721('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x7721('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x7721('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x7721('0x3')],'allowNull':![],'defaultValue':moment()[_0x7721('0x4')](_0x7721('0x5'))}}; \ No newline at end of file +var _0x5fd1=['format','sequelize','exports','STRING','DATE'];(function(_0x56740a,_0x568894){var _0x257144=function(_0x2b8cc5){while(--_0x2b8cc5){_0x56740a['push'](_0x56740a['shift']());}};_0x257144(++_0x568894);}(_0x5fd1,0x155));var _0x15fd=function(_0x5e1fbc,_0xe6fb4d){_0x5e1fbc=_0x5e1fbc-0x0;var _0x146813=_0x5fd1[_0x5e1fbc];return _0x146813;};'use strict';var Sequelize=require(_0x15fd('0x0'));var moment=require('moment');module[_0x15fd('0x1')]={'time':{'type':Sequelize[_0x15fd('0x2')]},'callid':{'type':Sequelize[_0x15fd('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x15fd('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x15fd('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x15fd('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x15fd('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x15fd('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x15fd('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x15fd('0x3')],'allowNull':![],'defaultValue':moment()[_0x15fd('0x4')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 9cb5810..4a2a6c3 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 _0xede3=['apply','reject','save','update','destroy','then','error','stack','name','index','VoiceQueuesLog','rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','add','day','merge','map','filter','options','count','includeAll','findAll','rows','catch','show','include','create','body','find','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set'];(function(_0x5de9cf,_0x521e10){var _0x4d809b=function(_0xcb5a2c){while(--_0xcb5a2c){_0x5de9cf['push'](_0x5de9cf['shift']());}};_0x4d809b(++_0x521e10);}(_0xede3,0xc0));var _0x3ede=function(_0xd3a025,_0xa307ef){_0xd3a025=_0xd3a025-0x0;var _0x35cf62=_0xede3[_0xd3a025];return _0x35cf62;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3ede('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3ede('0x1'));var jsonpatch=require(_0x3ede('0x2'));var rp=require(_0x3ede('0x3'));var moment=require(_0x3ede('0x4'));var BPromise=require(_0x3ede('0x5'));var Mustache=require(_0x3ede('0x6'));var util=require(_0x3ede('0x7'));var path=require(_0x3ede('0x8'));var sox=require(_0x3ede('0x9'));var csv=require(_0x3ede('0xa'));var ejs=require(_0x3ede('0xb'));var fs=require('fs');var _=require(_0x3ede('0xc'));var squel=require(_0x3ede('0xd'));var crypto=require(_0x3ede('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3ede('0xf'));var toCsv=require(_0x3ede('0xa'));var querystring=require(_0x3ede('0x10'));var Papa=require('papaparse');var Redis=require(_0x3ede('0x11'));var qs=require(_0x3ede('0x12'));var logger=require(_0x3ede('0x13'))(_0x3ede('0x14'));var utils=require(_0x3ede('0x15'));var config=require('../../config/environment');var db=require(_0x3ede('0x16'))['db'];function respondWithStatusCode(_0x16077b,_0x3a22b8){_0x3a22b8=_0x3a22b8||0xcc;return function(_0xdeba4e){if(_0xdeba4e){return _0x16077b[_0x3ede('0x17')](_0x3a22b8);}return _0x16077b[_0x3ede('0x18')](_0x3a22b8)[_0x3ede('0x19')]();};}function respondWithResult(_0xf1a93b,_0x449111){_0x449111=_0x449111||0xc8;return function(_0x3875f0){if(_0x3875f0){return _0xf1a93b[_0x3ede('0x18')](_0x449111)[_0x3ede('0x1a')](_0x3875f0);}};}function respondWithFilteredResult(_0x470bba,_0x5d2d69){return function(_0x4e03a5){if(_0x4e03a5){var _0x33224b=_0x4e03a5['count'],_0x4b6191=_0x5d2d69[_0x3ede('0x1b')],_0x2ac4d5=_0x5d2d69[_0x3ede('0x1b')]+_0x5d2d69[_0x3ede('0x1c')],_0x59c338;if(_0x2ac4d5>=_0x33224b){_0x2ac4d5=_0x33224b;_0x59c338=0xc8;}else{_0x59c338=0xce;}_0x470bba['status'](_0x59c338);return _0x470bba[_0x3ede('0x1d')]('Content-Range',_0x4b6191+'-'+_0x2ac4d5+'/'+_0x33224b)['json'](_0x4e03a5);}return null;};}function patchUpdates(_0x390421){return function(_0x430327){try{jsonpatch[_0x3ede('0x1e')](_0x430327,_0x390421,!![]);}catch(_0x54aeb9){return BPromise[_0x3ede('0x1f')](_0x54aeb9);}return _0x430327[_0x3ede('0x20')]();};}function saveUpdates(_0x4fdcc6,_0x4d6d00){return function(_0x51020e){if(_0x51020e){return _0x51020e[_0x3ede('0x21')](_0x4fdcc6)['then'](function(_0x38ebd6){return _0x38ebd6;});}return null;};}function removeEntity(_0x5a45ff,_0x257d25){return function(_0x2de9f4){if(_0x2de9f4){return _0x2de9f4[_0x3ede('0x22')]()[_0x3ede('0x23')](function(){_0x5a45ff[_0x3ede('0x18')](0xcc)[_0x3ede('0x19')]();});}};}function handleEntityNotFound(_0x582d19,_0x4703ac){return function(_0x6f002c){if(!_0x6f002c){_0x582d19[_0x3ede('0x17')](0x194);}return _0x6f002c;};}function handleError(_0x19e9aa,_0x313699){_0x313699=_0x313699||0x1f4;return function(_0x10636f){logger[_0x3ede('0x24')](_0x10636f[_0x3ede('0x25')]);if(_0x10636f[_0x3ede('0x26')]){delete _0x10636f[_0x3ede('0x26')];}_0x19e9aa['status'](_0x313699)['send'](_0x10636f);};}exports[_0x3ede('0x27')]=function(_0x40f4ad,_0x248e17){var _0x8e750c={},_0x1f0b36={},_0x43363a={'count':0x0,'rows':[]};var _0x5299a0=db[_0x3ede('0x28')][_0x3ede('0x29')];_0x1f0b36[_0x3ede('0x2a')]=_['keys'](_0x5299a0);var _0x26f04e={'dateStart':_0x40f4ad[_0x3ede('0x2b')][_0x3ede('0x2c')],'dateEnd':_0x40f4ad['query'][_0x3ede('0x2d')]};delete _0x40f4ad['query'][_0x3ede('0x2c')];delete _0x40f4ad[_0x3ede('0x2b')]['dateEnd'];_0x1f0b36['query']=_[_0x3ede('0x2e')](_0x40f4ad[_0x3ede('0x2b')]);_0x1f0b36[_0x3ede('0x2f')]=_[_0x3ede('0x30')](_0x1f0b36[_0x3ede('0x2a')],_0x1f0b36[_0x3ede('0x2b')]);_0x8e750c[_0x3ede('0x31')]=_[_0x3ede('0x30')](_0x1f0b36[_0x3ede('0x2a')],qs[_0x3ede('0x32')](_0x40f4ad['query'][_0x3ede('0x32')]));_0x8e750c[_0x3ede('0x31')]=_0x8e750c['attributes'][_0x3ede('0x33')]?_0x8e750c[_0x3ede('0x31')]:_0x1f0b36[_0x3ede('0x2a')];if(!_0x40f4ad['query'][_0x3ede('0x34')]('nolimit')){_0x8e750c[_0x3ede('0x1c')]=qs[_0x3ede('0x1c')](_0x40f4ad[_0x3ede('0x2b')]['limit']);_0x8e750c['offset']=qs[_0x3ede('0x1b')](_0x40f4ad[_0x3ede('0x2b')][_0x3ede('0x1b')]);}_0x8e750c[_0x3ede('0x35')]=qs[_0x3ede('0x36')](_0x40f4ad['query'][_0x3ede('0x36')]);_0x8e750c[_0x3ede('0x37')]=qs[_0x3ede('0x2f')](_[_0x3ede('0x38')](_0x40f4ad['query'],_0x1f0b36[_0x3ede('0x2f')]));if(_0x26f04e[_0x3ede('0x2c')]){if(_0x26f04e[_0x3ede('0x2d')]){_0x26f04e['dateEnd']=moment(_0x26f04e['dateEnd'])[_0x3ede('0x39')](0x1,_0x3ede('0x3a'));}else{_0x26f04e[_0x3ede('0x2d')]=moment(_0x26f04e[_0x3ede('0x2c')])[_0x3ede('0x39')](0x1,_0x3ede('0x3a'));}_[_0x3ede('0x3b')](_0x8e750c['where'],{'createdAt':{'$gte':_0x26f04e[_0x3ede('0x2c')],'$lte':_0x26f04e[_0x3ede('0x2d')]}});}if(_0x40f4ad[_0x3ede('0x2b')]['filter']){_0x8e750c['where']=_['merge'](_0x8e750c[_0x3ede('0x37')],{'$or':_[_0x3ede('0x3c')](_0x8e750c[_0x3ede('0x31')],function(_0x2bf934){var _0x204029={};_0x204029[_0x2bf934]={'$like':'%'+_0x40f4ad[_0x3ede('0x2b')][_0x3ede('0x3d')]+'%'};return _0x204029;})});}_0x8e750c=_[_0x3ede('0x3b')]({},_0x8e750c,_0x40f4ad[_0x3ede('0x3e')]);var _0x4ca389={'where':_0x8e750c[_0x3ede('0x37')]};return db[_0x3ede('0x28')][_0x3ede('0x3f')](_0x4ca389)['then'](function(_0x461428){_0x43363a[_0x3ede('0x3f')]=_0x461428;if(_0x40f4ad[_0x3ede('0x2b')][_0x3ede('0x40')]){_0x8e750c['include']=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x3ede('0x41')](_0x8e750c);})[_0x3ede('0x23')](function(_0x441864){_0x43363a[_0x3ede('0x42')]=_0x441864;return _0x43363a;})['then'](respondWithFilteredResult(_0x248e17,_0x8e750c))[_0x3ede('0x43')](handleError(_0x248e17,null));};exports[_0x3ede('0x44')]=function(_0x5c0c22,_0x53c1fe){var _0x51332c={'raw':!![],'where':{'id':_0x5c0c22['params']['id']}},_0xcc177d={};_0xcc177d['model']=_['keys'](db[_0x3ede('0x28')][_0x3ede('0x29')]);_0xcc177d[_0x3ede('0x2b')]=_[_0x3ede('0x2e')](_0x5c0c22[_0x3ede('0x2b')]);_0xcc177d[_0x3ede('0x2f')]=_['intersection'](_0xcc177d[_0x3ede('0x2a')],_0xcc177d['query']);_0x51332c['attributes']=_[_0x3ede('0x30')](_0xcc177d[_0x3ede('0x2a')],qs[_0x3ede('0x32')](_0x5c0c22['query']['fields']));_0x51332c[_0x3ede('0x31')]=_0x51332c[_0x3ede('0x31')][_0x3ede('0x33')]?_0x51332c['attributes']:_0xcc177d[_0x3ede('0x2a')];if(_0x5c0c22[_0x3ede('0x2b')][_0x3ede('0x40')]){_0x51332c[_0x3ede('0x45')]=[{'all':!![]}];}_0x51332c=_[_0x3ede('0x3b')]({},_0x51332c,_0x5c0c22[_0x3ede('0x3e')]);return db[_0x3ede('0x28')]['find'](_0x51332c)['then'](handleEntityNotFound(_0x53c1fe,null))['then'](respondWithResult(_0x53c1fe,null))['catch'](handleError(_0x53c1fe,null));};exports['create']=function(_0x341100,_0x44ba2a){return db[_0x3ede('0x28')][_0x3ede('0x46')](_0x341100[_0x3ede('0x47')],{})[_0x3ede('0x23')](respondWithResult(_0x44ba2a,0xc9))[_0x3ede('0x43')](handleError(_0x44ba2a,null));};exports['update']=function(_0x52d97e,_0x14966b){if(_0x52d97e[_0x3ede('0x47')]['id']){delete _0x52d97e[_0x3ede('0x47')]['id'];}return db[_0x3ede('0x28')][_0x3ede('0x48')]({'where':{'id':_0x52d97e[_0x3ede('0x49')]['id']}})['then'](handleEntityNotFound(_0x14966b,null))[_0x3ede('0x23')](saveUpdates(_0x52d97e[_0x3ede('0x47')],null))[_0x3ede('0x23')](respondWithResult(_0x14966b,null))[_0x3ede('0x43')](handleError(_0x14966b,null));};exports[_0x3ede('0x22')]=function(_0x21bd6e,_0x2e8a41){return db[_0x3ede('0x28')]['find']({'where':{'id':_0x21bd6e['params']['id']}})['then'](handleEntityNotFound(_0x2e8a41,null))[_0x3ede('0x23')](removeEntity(_0x2e8a41,null))[_0x3ede('0x43')](handleError(_0x2e8a41,null));}; \ No newline at end of file +var _0x7dbc=['count','rows','catch','show','params','includeAll','include','find','create','body','destroy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','Content-Range','apply','reject','save','update','then','error','name','index','VoiceQueuesLog','rawAttributes','model','dateStart','query','dateEnd','keys','filters','intersection','attributes','fields','nolimit','limit','order','sort','pick','add','day','merge','filter','where','map','options'];(function(_0x1cd19a,_0x21f9eb){var _0x32c0a4=function(_0x13a82d){while(--_0x13a82d){_0x1cd19a['push'](_0x1cd19a['shift']());}};_0x32c0a4(++_0x21f9eb);}(_0x7dbc,0xe0));var _0xc7db=function(_0x9b4225,_0x7730e2){_0x9b4225=_0x9b4225-0x0;var _0x1c2a2c=_0x7dbc[_0x9b4225];return _0x1c2a2c;};'use strict';var pdf=require(_0xc7db('0x0'));var emlformat=require(_0xc7db('0x1'));var rimraf=require(_0xc7db('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc7db('0x3'));var rp=require(_0xc7db('0x4'));var moment=require(_0xc7db('0x5'));var BPromise=require(_0xc7db('0x6'));var Mustache=require('mustache');var util=require(_0xc7db('0x7'));var path=require(_0xc7db('0x8'));var sox=require('sox');var csv=require(_0xc7db('0x9'));var ejs=require(_0xc7db('0xa'));var fs=require('fs');var _=require(_0xc7db('0xb'));var squel=require(_0xc7db('0xc'));var crypto=require(_0xc7db('0xd'));var jsforce=require(_0xc7db('0xe'));var deskjs=require(_0xc7db('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc7db('0x10'));var Redis=require('ioredis');var qs=require(_0xc7db('0x11'));var logger=require(_0xc7db('0x12'))(_0xc7db('0x13'));var utils=require(_0xc7db('0x14'));var config=require(_0xc7db('0x15'));var db=require(_0xc7db('0x16'))['db'];function respondWithStatusCode(_0x355e79,_0x4eeed1){_0x4eeed1=_0x4eeed1||0xcc;return function(_0x5aae8c){if(_0x5aae8c){return _0x355e79[_0xc7db('0x17')](_0x4eeed1);}return _0x355e79['status'](_0x4eeed1)[_0xc7db('0x18')]();};}function respondWithResult(_0x23a7d1,_0x634618){_0x634618=_0x634618||0xc8;return function(_0x5039bc){if(_0x5039bc){return _0x23a7d1[_0xc7db('0x19')](_0x634618)[_0xc7db('0x1a')](_0x5039bc);}};}function respondWithFilteredResult(_0x269faf,_0x4b4a99){return function(_0x5e91da){if(_0x5e91da){var _0x272a80=_0x5e91da['count'],_0x14a3a=_0x4b4a99[_0xc7db('0x1b')],_0x35476f=_0x4b4a99[_0xc7db('0x1b')]+_0x4b4a99['limit'],_0x3c1182;if(_0x35476f>=_0x272a80){_0x35476f=_0x272a80;_0x3c1182=0xc8;}else{_0x3c1182=0xce;}_0x269faf[_0xc7db('0x19')](_0x3c1182);return _0x269faf['set'](_0xc7db('0x1c'),_0x14a3a+'-'+_0x35476f+'/'+_0x272a80)[_0xc7db('0x1a')](_0x5e91da);}return null;};}function patchUpdates(_0x33fca1){return function(_0x5402ce){try{jsonpatch[_0xc7db('0x1d')](_0x5402ce,_0x33fca1,!![]);}catch(_0xfa98b1){return BPromise[_0xc7db('0x1e')](_0xfa98b1);}return _0x5402ce[_0xc7db('0x1f')]();};}function saveUpdates(_0x2d7d41,_0x244303){return function(_0x4edbf5){if(_0x4edbf5){return _0x4edbf5[_0xc7db('0x20')](_0x2d7d41)[_0xc7db('0x21')](function(_0x289f3c){return _0x289f3c;});}return null;};}function removeEntity(_0x13979e,_0x594713){return function(_0xdc7b0){if(_0xdc7b0){return _0xdc7b0['destroy']()[_0xc7db('0x21')](function(){_0x13979e['status'](0xcc)[_0xc7db('0x18')]();});}};}function handleEntityNotFound(_0x2d5892,_0x1f4226){return function(_0x3e8b2c){if(!_0x3e8b2c){_0x2d5892['sendStatus'](0x194);}return _0x3e8b2c;};}function handleError(_0x515c17,_0x538d0d){_0x538d0d=_0x538d0d||0x1f4;return function(_0x5595f3){logger[_0xc7db('0x22')](_0x5595f3['stack']);if(_0x5595f3[_0xc7db('0x23')]){delete _0x5595f3['name'];}_0x515c17[_0xc7db('0x19')](_0x538d0d)['send'](_0x5595f3);};}exports[_0xc7db('0x24')]=function(_0x588f61,_0x9367a5){var _0x8fef5b={},_0x18caec={},_0x5dca2b={'count':0x0,'rows':[]};var _0x24a0b3=db[_0xc7db('0x25')][_0xc7db('0x26')];_0x18caec[_0xc7db('0x27')]=_['keys'](_0x24a0b3);var _0x2e39cd={'dateStart':_0x588f61['query'][_0xc7db('0x28')],'dateEnd':_0x588f61[_0xc7db('0x29')][_0xc7db('0x2a')]};delete _0x588f61[_0xc7db('0x29')][_0xc7db('0x28')];delete _0x588f61[_0xc7db('0x29')][_0xc7db('0x2a')];_0x18caec[_0xc7db('0x29')]=_[_0xc7db('0x2b')](_0x588f61[_0xc7db('0x29')]);_0x18caec[_0xc7db('0x2c')]=_[_0xc7db('0x2d')](_0x18caec[_0xc7db('0x27')],_0x18caec['query']);_0x8fef5b[_0xc7db('0x2e')]=_['intersection'](_0x18caec[_0xc7db('0x27')],qs[_0xc7db('0x2f')](_0x588f61[_0xc7db('0x29')][_0xc7db('0x2f')]));_0x8fef5b[_0xc7db('0x2e')]=_0x8fef5b[_0xc7db('0x2e')]['length']?_0x8fef5b['attributes']:_0x18caec[_0xc7db('0x27')];if(!_0x588f61[_0xc7db('0x29')]['hasOwnProperty'](_0xc7db('0x30'))){_0x8fef5b[_0xc7db('0x31')]=qs['limit'](_0x588f61[_0xc7db('0x29')]['limit']);_0x8fef5b[_0xc7db('0x1b')]=qs['offset'](_0x588f61['query'][_0xc7db('0x1b')]);}_0x8fef5b[_0xc7db('0x32')]=qs[_0xc7db('0x33')](_0x588f61[_0xc7db('0x29')]['sort']);_0x8fef5b['where']=qs[_0xc7db('0x2c')](_[_0xc7db('0x34')](_0x588f61[_0xc7db('0x29')],_0x18caec[_0xc7db('0x2c')]));if(_0x2e39cd[_0xc7db('0x28')]){if(_0x2e39cd[_0xc7db('0x2a')]){_0x2e39cd['dateEnd']=moment(_0x2e39cd[_0xc7db('0x2a')])[_0xc7db('0x35')](0x1,_0xc7db('0x36'));}else{_0x2e39cd[_0xc7db('0x2a')]=moment(_0x2e39cd['dateStart'])[_0xc7db('0x35')](0x1,_0xc7db('0x36'));}_[_0xc7db('0x37')](_0x8fef5b['where'],{'createdAt':{'$gte':_0x2e39cd[_0xc7db('0x28')],'$lte':_0x2e39cd[_0xc7db('0x2a')]}});}if(_0x588f61[_0xc7db('0x29')][_0xc7db('0x38')]){_0x8fef5b['where']=_['merge'](_0x8fef5b[_0xc7db('0x39')],{'$or':_[_0xc7db('0x3a')](_0x8fef5b[_0xc7db('0x2e')],function(_0x4c4584){var _0x2ce99d={};_0x2ce99d[_0x4c4584]={'$like':'%'+_0x588f61[_0xc7db('0x29')][_0xc7db('0x38')]+'%'};return _0x2ce99d;})});}_0x8fef5b=_['merge']({},_0x8fef5b,_0x588f61[_0xc7db('0x3b')]);var _0x4315d1={'where':_0x8fef5b[_0xc7db('0x39')]};return db[_0xc7db('0x25')][_0xc7db('0x3c')](_0x4315d1)[_0xc7db('0x21')](function(_0x5eea48){_0x5dca2b[_0xc7db('0x3c')]=_0x5eea48;if(_0x588f61[_0xc7db('0x29')]['includeAll']){_0x8fef5b['include']=[{'all':!![]}];}return db[_0xc7db('0x25')]['findAll'](_0x8fef5b);})[_0xc7db('0x21')](function(_0x1ea862){_0x5dca2b[_0xc7db('0x3d')]=_0x1ea862;return _0x5dca2b;})[_0xc7db('0x21')](respondWithFilteredResult(_0x9367a5,_0x8fef5b))[_0xc7db('0x3e')](handleError(_0x9367a5,null));};exports[_0xc7db('0x3f')]=function(_0x4fd599,_0x46ed33){var _0x45cbca={'raw':!![],'where':{'id':_0x4fd599[_0xc7db('0x40')]['id']}},_0x3c94e9={};_0x3c94e9['model']=_[_0xc7db('0x2b')](db[_0xc7db('0x25')][_0xc7db('0x26')]);_0x3c94e9[_0xc7db('0x29')]=_[_0xc7db('0x2b')](_0x4fd599['query']);_0x3c94e9[_0xc7db('0x2c')]=_['intersection'](_0x3c94e9[_0xc7db('0x27')],_0x3c94e9[_0xc7db('0x29')]);_0x45cbca['attributes']=_['intersection'](_0x3c94e9[_0xc7db('0x27')],qs[_0xc7db('0x2f')](_0x4fd599[_0xc7db('0x29')][_0xc7db('0x2f')]));_0x45cbca['attributes']=_0x45cbca[_0xc7db('0x2e')]['length']?_0x45cbca[_0xc7db('0x2e')]:_0x3c94e9[_0xc7db('0x27')];if(_0x4fd599[_0xc7db('0x29')][_0xc7db('0x41')]){_0x45cbca[_0xc7db('0x42')]=[{'all':!![]}];}_0x45cbca=_[_0xc7db('0x37')]({},_0x45cbca,_0x4fd599[_0xc7db('0x3b')]);return db[_0xc7db('0x25')][_0xc7db('0x43')](_0x45cbca)[_0xc7db('0x21')](handleEntityNotFound(_0x46ed33,null))[_0xc7db('0x21')](respondWithResult(_0x46ed33,null))[_0xc7db('0x3e')](handleError(_0x46ed33,null));};exports[_0xc7db('0x44')]=function(_0x4a0b2c,_0x5eca8e){return db[_0xc7db('0x25')][_0xc7db('0x44')](_0x4a0b2c[_0xc7db('0x45')],{})['then'](respondWithResult(_0x5eca8e,0xc9))['catch'](handleError(_0x5eca8e,null));};exports[_0xc7db('0x20')]=function(_0x50fe89,_0x12e287){if(_0x50fe89['body']['id']){delete _0x50fe89[_0xc7db('0x45')]['id'];}return db[_0xc7db('0x25')]['find']({'where':{'id':_0x50fe89[_0xc7db('0x40')]['id']}})[_0xc7db('0x21')](handleEntityNotFound(_0x12e287,null))['then'](saveUpdates(_0x50fe89['body'],null))[_0xc7db('0x21')](respondWithResult(_0x12e287,null))[_0xc7db('0x3e')](handleError(_0x12e287,null));};exports[_0xc7db('0x46')]=function(_0xc8ded3,_0x59e375){return db[_0xc7db('0x25')]['find']({'where':{'id':_0xc8ded3[_0xc7db('0x40')]['id']}})[_0xc7db('0x21')](handleEntityNotFound(_0x59e375,null))[_0xc7db('0x21')](removeEntity(_0x59e375,null))[_0xc7db('0x3e')](handleError(_0x59e375,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index ce78e66..a87dd92 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 _0xee8f=['moment','bluebird','request-promise','define','VoiceQueuesLog','event_dtm','event','util','api'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xee8f,0x1ed));var _0xfee8=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xee8f[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0xfee8('0x0'));var logger=require('../../config/logger')(_0xfee8('0x1'));var moment=require(_0xfee8('0x2'));var BPromise=require(_0xfee8('0x3'));var rp=require(_0xfee8('0x4'));var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x55be8b,_0x1652fc){return _0x55be8b[_0xfee8('0x5')](_0xfee8('0x6'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xfee8('0x7'),'fields':[_0xfee8('0x8'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0xe75a=['./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event_dtm','lodash','util','api','moment','bluebird','request-promise'];(function(_0xf83b70,_0x494eac){var _0xe9d83d=function(_0x2f5b4b){while(--_0x2f5b4b){_0xf83b70['push'](_0xf83b70['shift']());}};_0xe9d83d(++_0x494eac);}(_0xe75a,0x1de));var _0xae75=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xe75a[_0x4d613c];return _0x301fe3;};'use strict';var _=require(_0xae75('0x0'));var util=require(_0xae75('0x1'));var logger=require('../../config/logger')(_0xae75('0x2'));var moment=require(_0xae75('0x3'));var BPromise=require(_0xae75('0x4'));var rp=require(_0xae75('0x5'));var attributes=require(_0xae75('0x6'));module[_0xae75('0x7')]=function(_0x3bead2,_0x2f27a8){return _0x3bead2[_0xae75('0x8')](_0xae75('0x9'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xae75('0xa'),'fields':['event','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 a71e5c0..6a4b9d4 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 _0xf7b4=['result','catch','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','VoiceQueuesLog,\x20%s,\x20%s','message'];(function(_0x5c12ba,_0x229eee){var _0x4ed0fa=function(_0x410943){while(--_0x410943){_0x5c12ba['push'](_0x5c12ba['shift']());}};_0x4ed0fa(++_0x229eee);}(_0xf7b4,0x152));var _0x4f7b=function(_0x81c6db,_0x31b844){_0x81c6db=_0x81c6db-0x0;var _0x3b116d=_0xf7b4[_0x81c6db];return _0x3b116d;};'use strict';var _=require(_0x4f7b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4f7b('0x1'));var rs=require(_0x4f7b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4f7b('0x3'));var logger=require(_0x4f7b('0x4'))(_0x4f7b('0x5'));var config=require(_0x4f7b('0x6'));var jayson=require(_0x4f7b('0x7'));var client=jayson[_0x4f7b('0x8')][_0x4f7b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ad135,_0x173784,_0x351036){return new BPromise(function(_0x36ea9c,_0x3ef6e1){return client[_0x4f7b('0xa')](_0x3ad135,_0x351036)['then'](function(_0x433563){logger[_0x4f7b('0xb')]('VoiceQueuesLog,\x20%s,\x20%s',_0x173784,_0x4f7b('0xc'));logger[_0x4f7b('0xd')](_0x4f7b('0xe'),_0x173784,_0x4f7b('0xc'),JSON[_0x4f7b('0xf')](_0x433563));if(_0x433563['error']){if(_0x433563[_0x4f7b('0x10')]['code']===0x1f4){logger['error'](_0x4f7b('0x11'),_0x173784,_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);return _0x3ef6e1(_0x433563[_0x4f7b('0x10')]['message']);}logger[_0x4f7b('0x10')](_0x4f7b('0x11'),_0x173784,_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);return _0x36ea9c(_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);}else{logger[_0x4f7b('0xb')](_0x4f7b('0x11'),_0x173784,_0x4f7b('0xc'));_0x36ea9c(_0x433563[_0x4f7b('0x13')][_0x4f7b('0x12')]);}})[_0x4f7b('0x14')](function(_0x50a161){logger[_0x4f7b('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x173784,_0x50a161);_0x3ef6e1(_0x50a161);});});} \ No newline at end of file +var _0x3e93=['rpc','jayson/promise','client','http','request','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x442087,_0x520b79){var _0x134cb5=function(_0x1591e9){while(--_0x1591e9){_0x442087['push'](_0x442087['shift']());}};_0x134cb5(++_0x520b79);}(_0x3e93,0x82));var _0x33e9=function(_0x99b94a,_0x5640eb){_0x99b94a=_0x99b94a-0x0;var _0x4886ed=_0x3e93[_0x99b94a];return _0x4886ed;};'use strict';var _=require(_0x33e9('0x0'));var util=require(_0x33e9('0x1'));var moment=require(_0x33e9('0x2'));var BPromise=require('bluebird');var rs=require(_0x33e9('0x3'));var fs=require('fs');var Redis=require(_0x33e9('0x4'));var db=require(_0x33e9('0x5'))['db'];var utils=require(_0x33e9('0x6'));var logger=require(_0x33e9('0x7'))(_0x33e9('0x8'));var config=require('../../config/environment');var jayson=require(_0x33e9('0x9'));var client=jayson[_0x33e9('0xa')][_0x33e9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14ea51,_0x5b849e,_0x3d0676){return new BPromise(function(_0x42f728,_0x310dec){return client[_0x33e9('0xc')](_0x14ea51,_0x3d0676)[_0x33e9('0xd')](function(_0x243e90){logger['info'](_0x33e9('0xe'),_0x5b849e,_0x33e9('0xf'));logger[_0x33e9('0x10')](_0x33e9('0x11'),_0x5b849e,_0x33e9('0xf'),JSON['stringify'](_0x243e90));if(_0x243e90[_0x33e9('0x12')]){if(_0x243e90['error'][_0x33e9('0x13')]===0x1f4){logger[_0x33e9('0x12')](_0x33e9('0xe'),_0x5b849e,_0x243e90[_0x33e9('0x12')][_0x33e9('0x14')]);return _0x310dec(_0x243e90[_0x33e9('0x12')][_0x33e9('0x14')]);}logger[_0x33e9('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x5b849e,_0x243e90[_0x33e9('0x12')][_0x33e9('0x14')]);return _0x42f728(_0x243e90[_0x33e9('0x12')][_0x33e9('0x14')]);}else{logger['info'](_0x33e9('0xe'),_0x5b849e,_0x33e9('0xf'));_0x42f728(_0x243e90[_0x33e9('0x15')][_0x33e9('0x14')]);}})[_0x33e9('0x16')](function(_0x84e3fc){logger[_0x33e9('0x12')](_0x33e9('0xe'),_0x5b849e,_0x84e3fc);_0x310dec(_0x84e3fc);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index e39d101..e923fe4 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 _0xb0b9=['../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download','download','/:id/downloads','downloads','post','/:id','update','multer','connect-timeout','express','Router','../../components/auth/service'];(function(_0x189029,_0x4acf21){var _0x234408=function(_0x14e81c){while(--_0x14e81c){_0x189029['push'](_0x189029['shift']());}};_0x234408(++_0x4acf21);}(_0xb0b9,0x1f3));var _0x9b0b=function(_0x4d8134,_0x57e5ac){_0x4d8134=_0x4d8134-0x0;var _0x2f85e2=_0xb0b9[_0x4d8134];return _0x2f85e2;};'use strict';var multer=require(_0x9b0b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9b0b('0x1'));var express=require(_0x9b0b('0x2'));var router=express[_0x9b0b('0x3')]();var auth=require(_0x9b0b('0x4'));var interaction=require(_0x9b0b('0x5'));var config=require(_0x9b0b('0x6'));var controller=require(_0x9b0b('0x7'));router[_0x9b0b('0x8')]('/',auth[_0x9b0b('0x9')](),controller[_0x9b0b('0xa')]);router[_0x9b0b('0x8')](_0x9b0b('0xb'),auth[_0x9b0b('0x9')](),controller[_0x9b0b('0xc')]);router['get']('/:id',auth[_0x9b0b('0x9')](),controller[_0x9b0b('0xd')]);router[_0x9b0b('0x8')](_0x9b0b('0xe'),auth[_0x9b0b('0x9')](),controller[_0x9b0b('0xf')]);router['get'](_0x9b0b('0x10'),controller[_0x9b0b('0x11')]);router[_0x9b0b('0x12')]('/',auth[_0x9b0b('0x9')](),controller['create']);router['put'](_0x9b0b('0x13'),auth['isAuthenticated'](),controller[_0x9b0b('0x14')]);router['delete'](_0x9b0b('0x13'),auth[_0x9b0b('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0fd9=['update','delete','destroy','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','/:id/downloads','downloads','post','put'];(function(_0x40c0dd,_0x171ea5){var _0x2d4984=function(_0x28088a){while(--_0x28088a){_0x40c0dd['push'](_0x40c0dd['shift']());}};_0x2d4984(++_0x171ea5);}(_0x0fd9,0xa3));var _0x90fd=function(_0x1d930e,_0x20d8b8){_0x1d930e=_0x1d930e-0x0;var _0x5bbd66=_0x0fd9[_0x1d930e];return _0x5bbd66;};'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')]('/',auth[_0x90fd('0x8')](),controller[_0x90fd('0x9')]);router['get']('/describe',auth[_0x90fd('0x8')](),controller['describe']);router['get'](_0x90fd('0xa'),auth[_0x90fd('0x8')](),controller['show']);router[_0x90fd('0x7')](_0x90fd('0xb'),auth[_0x90fd('0x8')](),controller[_0x90fd('0xc')]);router[_0x90fd('0x7')](_0x90fd('0xd'),controller[_0x90fd('0xe')]);router[_0x90fd('0xf')]('/',auth[_0x90fd('0x8')](),controller['create']);router[_0x90fd('0x10')](_0x90fd('0xa'),auth['isAuthenticated'](),controller[_0x90fd('0x11')]);router[_0x90fd('0x12')](_0x90fd('0xa'),auth['isAuthenticated'](),controller[_0x90fd('0x13')]);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 4f1d3ff..7538f63 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 _0x7745=['membername','split','INTEGER','createdAt','MM-DD-YYYY\x20HH:mm','toString','DATE','format','sequelize','moment','path','exports','VIRTUAL','getDataValue','value','STRING','setDataValue','channel'];(function(_0x188337,_0x4e3280){var _0x205fde=function(_0x1ed4fd){while(--_0x1ed4fd){_0x188337['push'](_0x188337['shift']());}};_0x205fde(++_0x4e3280);}(_0x7745,0x194));var _0x5774=function(_0x56f7e2,_0x145392){_0x56f7e2=_0x56f7e2-0x0;var _0x36240b=_0x7745[_0x56f7e2];return _0x36240b;};'use strict';var Sequelize=require(_0x5774('0x0'));var moment=require(_0x5774('0x1'));var path=require(_0x5774('0x2'));module[_0x5774('0x3')]={'format':{'type':Sequelize[_0x5774('0x4')],'get':function(){return this[_0x5774('0x5')](_0x5774('0x6'))?path['extname'](this[_0x5774('0x5')](_0x5774('0x6'))):undefined;}},'uniqueid':{'type':Sequelize[_0x5774('0x7')]},'channel':{'type':Sequelize[_0x5774('0x7')],'set':function(_0x1842e6){if(_0x1842e6){this[_0x5774('0x8')](_0x5774('0x9'),_0x1842e6);this[_0x5774('0x8')](_0x5774('0xa'),_0x1842e6[_0x5774('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x5774('0x7')]},'calleridnum':{'type':Sequelize[_0x5774('0x7')]},'calleridname':{'type':Sequelize[_0x5774('0x7')]},'connectedlinenum':{'type':Sequelize[_0x5774('0x7')]},'connectedlinename':{'type':Sequelize[_0x5774('0x7')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x5774('0x7')]},'exten':{'type':Sequelize[_0x5774('0x7')]},'value':{'type':Sequelize[_0x5774('0x7')]},'type':{'type':Sequelize[_0x5774('0x7')]},'rating':{'type':Sequelize[_0x5774('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x5774('0x7')]},'userDisposition':{'type':Sequelize[_0x5774('0x7')]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x5774('0x5')](_0x5774('0xd')))['format'](_0x5774('0xe'))[_0x5774('0xf')]();}},'updatedAt':{'type':Sequelize[_0x5774('0x10')],'get':function(){return moment(this[_0x5774('0x5')]('updatedAt'))[_0x5774('0x11')](_0x5774('0xe'))[_0x5774('0xf')]();}}}; \ No newline at end of file +var _0xe563=['STRING','channel','setDataValue','membername','split','DATE','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','exports','value','extname','getDataValue'];(function(_0x15b0c7,_0xa0313b){var _0x445e3c=function(_0x41bfeb){while(--_0x41bfeb){_0x15b0c7['push'](_0x15b0c7['shift']());}};_0x445e3c(++_0xa0313b);}(_0xe563,0x1cd));var _0x3e56=function(_0x2d11f2,_0x11e5ab){_0x2d11f2=_0x2d11f2-0x0;var _0x58e3bb=_0xe563[_0x2d11f2];return _0x58e3bb;};'use strict';var Sequelize=require(_0x3e56('0x0'));var moment=require(_0x3e56('0x1'));var path=require(_0x3e56('0x2'));module[_0x3e56('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x3e56('0x4'))?path[_0x3e56('0x5')](this[_0x3e56('0x6')](_0x3e56('0x4'))):undefined;}},'uniqueid':{'type':Sequelize[_0x3e56('0x7')]},'channel':{'type':Sequelize[_0x3e56('0x7')],'set':function(_0x1bbc29){if(_0x1bbc29){this['setDataValue'](_0x3e56('0x8'),_0x1bbc29);this[_0x3e56('0x9')](_0x3e56('0xa'),_0x1bbc29[_0x3e56('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3e56('0x7')]},'connectedlinenum':{'type':Sequelize[_0x3e56('0x7')]},'connectedlinename':{'type':Sequelize[_0x3e56('0x7')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x3e56('0x7')]},'exten':{'type':Sequelize[_0x3e56('0x7')]},'value':{'type':Sequelize[_0x3e56('0x7')]},'type':{'type':Sequelize[_0x3e56('0x7')]},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x3e56('0x7')]},'userDisposition':{'type':Sequelize[_0x3e56('0x7')]},'createdAt':{'type':Sequelize[_0x3e56('0xc')],'get':function(){return moment(this[_0x3e56('0x6')](_0x3e56('0xd')))[_0x3e56('0xe')](_0x3e56('0xf'))[_0x3e56('0x10')]();}},'updatedAt':{'type':Sequelize[_0x3e56('0xc')],'get':function(){return moment(this[_0x3e56('0x6')](_0x3e56('0x11')))[_0x3e56('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x3e56('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 3a85190..fe12003 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 _0x9e6e=['hasOwnProperty','nolimit','order','sort','pick','add','day','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','find','body','describe','download','type','uniqueid','value','recording','existsSync','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','../../components/encryptor','sequelize','MD5','col','token','$and','push','%s.cypher','decryptFile','secrets','ValidationError','html-pdf','rimraf','fast-json-patch','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','VoiceRecording','rawAttributes','model','differenceBy','keys','format','query','dateStart','dateEnd','filters','intersection','attributes','fields','length'];(function(_0x1a5cf6,_0x442d44){var _0x4e07c3=function(_0x1937f7){while(--_0x1937f7){_0x1a5cf6['push'](_0x1a5cf6['shift']());}};_0x4e07c3(++_0x442d44);}(_0x9e6e,0x88));var _0xe9e6=function(_0x15fd2c,_0x2efe29){_0x15fd2c=_0x15fd2c-0x0;var _0x314c47=_0x9e6e[_0x15fd2c];return _0x314c47;};'use strict';var pdf=require(_0xe9e6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe9e6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9e6('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe9e6('0x3'));var util=require('util');var path=require(_0xe9e6('0x4'));var sox=require(_0xe9e6('0x5'));var csv=require(_0xe9e6('0x6'));var ejs=require(_0xe9e6('0x7'));var fs=require('fs');var _=require(_0xe9e6('0x8'));var squel=require(_0xe9e6('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe9e6('0xa'));var toCsv=require(_0xe9e6('0x6'));var querystring=require(_0xe9e6('0xb'));var Papa=require(_0xe9e6('0xc'));var Redis=require(_0xe9e6('0xd'));var qs=require(_0xe9e6('0xe'));var logger=require(_0xe9e6('0xf'))(_0xe9e6('0x10'));var utils=require(_0xe9e6('0x11'));var config=require(_0xe9e6('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5326ee,_0x58e21d){_0x58e21d=_0x58e21d||0xcc;return function(_0xf691d9){if(_0xf691d9){return _0x5326ee['sendStatus'](_0x58e21d);}return _0x5326ee[_0xe9e6('0x13')](_0x58e21d)[_0xe9e6('0x14')]();};}function respondWithResult(_0x97b16a,_0x14b543){_0x14b543=_0x14b543||0xc8;return function(_0xf87573){if(_0xf87573){return _0x97b16a['status'](_0x14b543)[_0xe9e6('0x15')](_0xf87573);}};}function respondWithFilteredResult(_0x522e04,_0x4eb54a){return function(_0x1bbc8d){if(_0x1bbc8d){var _0x15bb61=_0x1bbc8d[_0xe9e6('0x16')],_0x5a5818=_0x4eb54a[_0xe9e6('0x17')],_0x5c68f2=_0x4eb54a[_0xe9e6('0x17')]+_0x4eb54a[_0xe9e6('0x18')],_0x52a22f;if(_0x5c68f2>=_0x15bb61){_0x5c68f2=_0x15bb61;_0x52a22f=0xc8;}else{_0x52a22f=0xce;}_0x522e04[_0xe9e6('0x13')](_0x52a22f);return _0x522e04['set']('Content-Range',_0x5a5818+'-'+_0x5c68f2+'/'+_0x15bb61)[_0xe9e6('0x15')](_0x1bbc8d);}return null;};}function patchUpdates(_0xb7f833){return function(_0x2a2e15){try{jsonpatch[_0xe9e6('0x19')](_0x2a2e15,_0xb7f833,!![]);}catch(_0x491564){return BPromise['reject'](_0x491564);}return _0x2a2e15[_0xe9e6('0x1a')]();};}function saveUpdates(_0x288100,_0x1c8e6c){return function(_0x5d8fb5){if(_0x5d8fb5){return _0x5d8fb5[_0xe9e6('0x1b')](_0x288100)[_0xe9e6('0x1c')](function(_0x1f7a4c){return _0x1f7a4c;});}return null;};}function removeEntity(_0x1a50d4,_0x3cf1ff){return function(_0x4b6886){if(_0x4b6886){return _0x4b6886[_0xe9e6('0x1d')]()[_0xe9e6('0x1c')](function(){_0x1a50d4['status'](0xcc)[_0xe9e6('0x14')]();});}};}function handleEntityNotFound(_0x247226,_0x1a95cd){return function(_0x58a14b){if(!_0x58a14b){_0x247226[_0xe9e6('0x1e')](0x194);}return _0x58a14b;};}function handleError(_0x467c15,_0x343267){_0x343267=_0x343267||0x1f4;return function(_0x4fc811){logger[_0xe9e6('0x1f')](_0x4fc811[_0xe9e6('0x20')]);if(_0x4fc811[_0xe9e6('0x21')]){delete _0x4fc811[_0xe9e6('0x21')];}_0x467c15[_0xe9e6('0x13')](_0x343267)[_0xe9e6('0x22')](_0x4fc811);};}exports[_0xe9e6('0x23')]=function(_0x3ebdc2,_0x3e1391){var _0x4fb3a3={},_0x3b4d80={},_0x4a56fa={'count':0x0,'rows':[]};var _0x9305fc=db[_0xe9e6('0x24')][_0xe9e6('0x25')];_0x3b4d80[_0xe9e6('0x26')]=_[_0xe9e6('0x27')](_[_0xe9e6('0x28')](_0x9305fc),[_0xe9e6('0x29')]);var _0x193857={'dateStart':_0x3ebdc2[_0xe9e6('0x2a')][_0xe9e6('0x2b')],'dateEnd':_0x3ebdc2[_0xe9e6('0x2a')][_0xe9e6('0x2c')]};delete _0x3ebdc2[_0xe9e6('0x2a')]['dateStart'];delete _0x3ebdc2[_0xe9e6('0x2a')][_0xe9e6('0x2c')];_0x3b4d80[_0xe9e6('0x2a')]=_[_0xe9e6('0x28')](_0x3ebdc2[_0xe9e6('0x2a')]);_0x3b4d80[_0xe9e6('0x2d')]=_[_0xe9e6('0x2e')](_0x3b4d80['model'],_0x3b4d80[_0xe9e6('0x2a')]);_0x4fb3a3[_0xe9e6('0x2f')]=_[_0xe9e6('0x2e')](_0x3b4d80[_0xe9e6('0x26')],qs[_0xe9e6('0x30')](_0x3ebdc2[_0xe9e6('0x2a')][_0xe9e6('0x30')]));_0x4fb3a3['attributes']=_0x4fb3a3[_0xe9e6('0x2f')][_0xe9e6('0x31')]?_0x4fb3a3[_0xe9e6('0x2f')]:_0x3b4d80[_0xe9e6('0x26')];if(!_0x3ebdc2[_0xe9e6('0x2a')][_0xe9e6('0x32')](_0xe9e6('0x33'))){_0x4fb3a3['limit']=qs[_0xe9e6('0x18')](_0x3ebdc2[_0xe9e6('0x2a')][_0xe9e6('0x18')]);_0x4fb3a3[_0xe9e6('0x17')]=qs['offset'](_0x3ebdc2[_0xe9e6('0x2a')]['offset']);}_0x4fb3a3[_0xe9e6('0x34')]=qs[_0xe9e6('0x35')](_0x3ebdc2[_0xe9e6('0x2a')]['sort']);_0x4fb3a3['where']=qs[_0xe9e6('0x2d')](_[_0xe9e6('0x36')](_0x3ebdc2['query'],_0x3b4d80[_0xe9e6('0x2d')]));if(_0x193857[_0xe9e6('0x2b')]){if(_0x193857[_0xe9e6('0x2c')]){_0x193857[_0xe9e6('0x2c')]=moment(_0x193857[_0xe9e6('0x2c')])[_0xe9e6('0x37')](0x1,_0xe9e6('0x38'));}else{_0x193857[_0xe9e6('0x2c')]=moment(_0x193857[_0xe9e6('0x2b')])[_0xe9e6('0x37')](0x1,_0xe9e6('0x38'));}_['merge'](_0x4fb3a3[_0xe9e6('0x39')],{'createdAt':{'$gte':_0x193857[_0xe9e6('0x2b')],'$lte':_0x193857[_0xe9e6('0x2c')]}});}if(_0x3ebdc2[_0xe9e6('0x2a')][_0xe9e6('0x3a')]){_0x4fb3a3[_0xe9e6('0x39')]=_[_0xe9e6('0x3b')](_0x4fb3a3[_0xe9e6('0x39')],{'$or':_['map'](_0x4fb3a3[_0xe9e6('0x2f')],function(_0x49105d){var _0x33e7fa={};_0x33e7fa[_0x49105d]={'$like':'%'+_0x3ebdc2[_0xe9e6('0x2a')]['filter']+'%'};return _0x33e7fa;})});}_0x4fb3a3=_[_0xe9e6('0x3b')]({},_0x4fb3a3,_0x3ebdc2[_0xe9e6('0x3c')]);var _0x12eb74={'where':_0x4fb3a3['where']};return db[_0xe9e6('0x24')][_0xe9e6('0x16')](_0x12eb74)[_0xe9e6('0x1c')](function(_0xe9b38b){_0x4a56fa['count']=_0xe9b38b;if(_0x3ebdc2[_0xe9e6('0x2a')][_0xe9e6('0x3d')]){_0x4fb3a3['include']=[{'all':!![]}];}return db[_0xe9e6('0x24')][_0xe9e6('0x3e')](_0x4fb3a3);})[_0xe9e6('0x1c')](function(_0x5e70f1){_0x4a56fa[_0xe9e6('0x3f')]=_0x5e70f1;return _0x4a56fa;})['then'](respondWithFilteredResult(_0x3e1391,_0x4fb3a3))[_0xe9e6('0x40')](handleError(_0x3e1391,null));};exports[_0xe9e6('0x41')]=function(_0xcf5b1d,_0xa34558){var _0x25ef77={'raw':![],'where':{'id':_0xcf5b1d[_0xe9e6('0x42')]['id']}},_0x345826={};_0x345826[_0xe9e6('0x26')]=_[_0xe9e6('0x28')](db[_0xe9e6('0x24')][_0xe9e6('0x25')]);_0x345826[_0xe9e6('0x2a')]=_[_0xe9e6('0x28')](_0xcf5b1d[_0xe9e6('0x2a')]);_0x345826['filters']=_[_0xe9e6('0x2e')](_0x345826[_0xe9e6('0x26')],_0x345826['query']);_0x25ef77[_0xe9e6('0x2f')]=_[_0xe9e6('0x2e')](_0x345826[_0xe9e6('0x26')],qs[_0xe9e6('0x30')](_0xcf5b1d[_0xe9e6('0x2a')][_0xe9e6('0x30')]));_0x25ef77['attributes']=_0x25ef77[_0xe9e6('0x2f')]['length']?_0x25ef77['attributes']:_0x345826[_0xe9e6('0x26')];if(_0xcf5b1d[_0xe9e6('0x2a')][_0xe9e6('0x3d')]){_0x25ef77[_0xe9e6('0x43')]=[{'all':!![]}];}_0x25ef77=_[_0xe9e6('0x3b')]({},_0x25ef77,_0xcf5b1d['options']);return db['VoiceRecording'][_0xe9e6('0x44')](_0x25ef77)[_0xe9e6('0x1c')](handleEntityNotFound(_0xa34558,null))[_0xe9e6('0x1c')](respondWithResult(_0xa34558,null))[_0xe9e6('0x40')](handleError(_0xa34558,null));};exports['create']=function(_0xf71462,_0x1ff74a){return db[_0xe9e6('0x24')]['create'](_0xf71462[_0xe9e6('0x45')],{})[_0xe9e6('0x1c')](respondWithResult(_0x1ff74a,0xc9))[_0xe9e6('0x40')](handleError(_0x1ff74a,null));};exports[_0xe9e6('0x1b')]=function(_0x1b7788,_0x6b7d68){if(_0x1b7788[_0xe9e6('0x45')]['id']){delete _0x1b7788[_0xe9e6('0x45')]['id'];}return db[_0xe9e6('0x24')][_0xe9e6('0x44')]({'where':{'id':_0x1b7788['params']['id']}})[_0xe9e6('0x1c')](handleEntityNotFound(_0x6b7d68,null))[_0xe9e6('0x1c')](saveUpdates(_0x1b7788['body'],null))[_0xe9e6('0x1c')](respondWithResult(_0x6b7d68,null))[_0xe9e6('0x40')](handleError(_0x6b7d68,null));};exports[_0xe9e6('0x1d')]=function(_0x3aa42f,_0x4bcd3b){return db[_0xe9e6('0x24')]['find']({'where':{'id':_0x3aa42f['params']['id']}})[_0xe9e6('0x1c')](handleEntityNotFound(_0x4bcd3b,null))[_0xe9e6('0x1c')](removeEntity(_0x4bcd3b,null))['catch'](handleError(_0x4bcd3b,null));};exports['describe']=function(_0x5c7dc2,_0x17c571){return db[_0xe9e6('0x24')][_0xe9e6('0x46')]()[_0xe9e6('0x1c')](respondWithResult(_0x17c571,null))[_0xe9e6('0x40')](handleError(_0x17c571,null));};exports[_0xe9e6('0x47')]=function(_0x552d79,_0x935f0b,_0x5c75f0){var _0x270a34=require('../../components/encryptor');var _0x3d9c94=![];var _0xca86ca={};if(_0x552d79[_0xe9e6('0x2a')][_0xe9e6('0x48')]&&_0x552d79['query'][_0xe9e6('0x48')]==='uniqueid'){_0xca86ca[_0xe9e6('0x49')]=_0x552d79[_0xe9e6('0x42')]['id'];}else{_0xca86ca['id']=_0x552d79['params']['id'];}return db[_0xe9e6('0x24')][_0xe9e6('0x44')]({'where':_0xca86ca,'attributes':['id','value'],'raw':!![]})[_0xe9e6('0x1c')](handleEntityNotFound(_0x935f0b,null))[_0xe9e6('0x1c')](function(_0x21deff){if(_0x21deff){var _0x5c1581=util['format']('%s.cypher',_0x21deff['value']);if(fs['existsSync'](_0x5c1581)){_0x3d9c94=!![];return _0x270a34['decryptFile'](_0x5c1581,_0x21deff[_0xe9e6('0x4a')],config['secrets'][_0xe9e6('0x4b')])['then'](function(){return _0x21deff;});}return _0x21deff;}})[_0xe9e6('0x1c')](function(_0x4617c8){if(_0x4617c8){if(!fs[_0xe9e6('0x4c')](_0x4617c8[_0xe9e6('0x4a')])){throw new db[(_0xe9e6('0x4d'))]['ValidationError'](_0xe9e6('0x4e'));}if(_0x4617c8[_0xe9e6('0x4f')]){return _0x935f0b[_0xe9e6('0x47')](_0x4617c8[_0xe9e6('0x4a')],_0x4617c8[_0xe9e6('0x4f')]+path[_0xe9e6('0x50')](_0x4617c8[_0xe9e6('0x4a')]),function(){if(_0x3d9c94){fs[_0xe9e6('0x51')](_0x4617c8[_0xe9e6('0x4a')]);}});}else{return _0x935f0b[_0xe9e6('0x47')](_0x4617c8['value'],function(_0x366988){if(_0x3d9c94){fs[_0xe9e6('0x51')](_0x4617c8[_0xe9e6('0x4a')]);}});}}})[_0xe9e6('0x40')](handleError(_0x935f0b,null));};exports['downloads']=function(_0x3e6147,_0x5f3fdc,_0x3a401e){var _0xb7050f=require(_0xe9e6('0x52'));var _0x193974=![];var _0x1d183f={'$and':[db[_0xe9e6('0x53')][_0xe9e6('0x39')](db[_0xe9e6('0x53')]['fn'](_0xe9e6('0x54'),db[_0xe9e6('0x53')][_0xe9e6('0x55')](_0xe9e6('0x49'))),_0x3e6147['query'][_0xe9e6('0x56')])]};if(_0x3e6147['query'][_0xe9e6('0x48')]&&_0x3e6147[_0xe9e6('0x2a')]['type']===_0xe9e6('0x49')){_0x1d183f[_0xe9e6('0x57')][_0xe9e6('0x58')]({'uniqueid':_0x3e6147[_0xe9e6('0x42')]['id']});}else{_0x1d183f[_0xe9e6('0x57')][_0xe9e6('0x58')]({'id':_0x3e6147[_0xe9e6('0x42')]['id']});}return db[_0xe9e6('0x24')][_0xe9e6('0x44')]({'where':_0x1d183f,'attributes':['id',_0xe9e6('0x4a')],'raw':!![]})[_0xe9e6('0x1c')](handleEntityNotFound(_0x5f3fdc,null))[_0xe9e6('0x1c')](function(_0x84f8eb){if(_0x84f8eb){var _0x340c07=util['format'](_0xe9e6('0x59'),_0x84f8eb[_0xe9e6('0x4a')]);if(fs[_0xe9e6('0x4c')](_0x340c07)){_0x193974=!![];return _0xb7050f[_0xe9e6('0x5a')](_0x340c07,_0x84f8eb['value'],config[_0xe9e6('0x5b')][_0xe9e6('0x4b')])['then'](function(){return _0x84f8eb;});}return _0x84f8eb;}})[_0xe9e6('0x1c')](function(_0x2aa7b9){if(_0x2aa7b9){if(!fs[_0xe9e6('0x4c')](_0x2aa7b9[_0xe9e6('0x4a')])){throw new db[(_0xe9e6('0x4d'))][(_0xe9e6('0x5c'))](_0xe9e6('0x4e'));}if(_0x2aa7b9['filename']){return _0x5f3fdc[_0xe9e6('0x47')](_0x2aa7b9[_0xe9e6('0x4a')],_0x2aa7b9['filename']+path['extname'](_0x2aa7b9['value']),function(){if(_0x193974){fs[_0xe9e6('0x51')](_0x2aa7b9[_0xe9e6('0x4a')]);}});}else{return _0x5f3fdc['download'](_0x2aa7b9[_0xe9e6('0x4a')],function(_0x3232e9){if(_0x193974){fs[_0xe9e6('0x51')](_0x2aa7b9[_0xe9e6('0x4a')]);}});}}})[_0xe9e6('0x40')](handleError(_0x5f3fdc,null));}; \ No newline at end of file +var _0x57e3=['limit','set','Content-Range','apply','reject','then','destroy','stack','name','send','index','VoiceRecording','rawAttributes','model','differenceBy','keys','format','query','dateStart','dateEnd','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','map','filter','include','findAll','show','params','intersection','fields','options','find','catch','create','body','update','describe','download','../../components/encryptor','type','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','downloads','sequelize','MD5','token','$and','push','Sequelize','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x57e3,0x168));var _0x357e=function(_0x486dba,_0x38598c){_0x486dba=_0x486dba-0x0;var _0x2df067=_0x57e3[_0x486dba];return _0x2df067;};'use strict';var pdf=require(_0x357e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x357e('0x1'));var zipdir=require(_0x357e('0x2'));var jsonpatch=require(_0x357e('0x3'));var rp=require('request-promise');var moment=require(_0x357e('0x4'));var BPromise=require(_0x357e('0x5'));var Mustache=require(_0x357e('0x6'));var util=require('util');var path=require(_0x357e('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x357e('0x8'));var fs=require('fs');var _=require(_0x357e('0x9'));var squel=require(_0x357e('0xa'));var crypto=require(_0x357e('0xb'));var jsforce=require(_0x357e('0xc'));var deskjs=require(_0x357e('0xd'));var toCsv=require(_0x357e('0xe'));var querystring=require(_0x357e('0xf'));var Papa=require(_0x357e('0x10'));var Redis=require(_0x357e('0x11'));var qs=require(_0x357e('0x12'));var logger=require(_0x357e('0x13'))('api');var utils=require(_0x357e('0x14'));var config=require('../../config/environment');var db=require(_0x357e('0x15'))['db'];function respondWithStatusCode(_0x36eb9b,_0x26e66f){_0x26e66f=_0x26e66f||0xcc;return function(_0x231d2b){if(_0x231d2b){return _0x36eb9b[_0x357e('0x16')](_0x26e66f);}return _0x36eb9b[_0x357e('0x17')](_0x26e66f)[_0x357e('0x18')]();};}function respondWithResult(_0x327626,_0x255b9e){_0x255b9e=_0x255b9e||0xc8;return function(_0x2c9673){if(_0x2c9673){return _0x327626['status'](_0x255b9e)[_0x357e('0x19')](_0x2c9673);}};}function respondWithFilteredResult(_0x585c38,_0x13ff36){return function(_0x209b9e){if(_0x209b9e){var _0xecde92=_0x209b9e[_0x357e('0x1a')],_0x9674ae=_0x13ff36[_0x357e('0x1b')],_0x152226=_0x13ff36[_0x357e('0x1b')]+_0x13ff36[_0x357e('0x1c')],_0x9ab731;if(_0x152226>=_0xecde92){_0x152226=_0xecde92;_0x9ab731=0xc8;}else{_0x9ab731=0xce;}_0x585c38['status'](_0x9ab731);return _0x585c38[_0x357e('0x1d')](_0x357e('0x1e'),_0x9674ae+'-'+_0x152226+'/'+_0xecde92)[_0x357e('0x19')](_0x209b9e);}return null;};}function patchUpdates(_0x713f70){return function(_0x222c54){try{jsonpatch[_0x357e('0x1f')](_0x222c54,_0x713f70,!![]);}catch(_0x21ff64){return BPromise[_0x357e('0x20')](_0x21ff64);}return _0x222c54['save']();};}function saveUpdates(_0x299ab9,_0x5551e7){return function(_0x185c51){if(_0x185c51){return _0x185c51['update'](_0x299ab9)[_0x357e('0x21')](function(_0x2eb215){return _0x2eb215;});}return null;};}function removeEntity(_0x3cd700,_0x1d537f){return function(_0x22c6ad){if(_0x22c6ad){return _0x22c6ad[_0x357e('0x22')]()[_0x357e('0x21')](function(){_0x3cd700[_0x357e('0x17')](0xcc)[_0x357e('0x18')]();});}};}function handleEntityNotFound(_0x2d47ea,_0x377821){return function(_0x9876cb){if(!_0x9876cb){_0x2d47ea[_0x357e('0x16')](0x194);}return _0x9876cb;};}function handleError(_0x35793e,_0x32c972){_0x32c972=_0x32c972||0x1f4;return function(_0x4ef457){logger['error'](_0x4ef457[_0x357e('0x23')]);if(_0x4ef457[_0x357e('0x24')]){delete _0x4ef457['name'];}_0x35793e[_0x357e('0x17')](_0x32c972)[_0x357e('0x25')](_0x4ef457);};}exports[_0x357e('0x26')]=function(_0x1d56b7,_0x12f21d){var _0x3df80c={},_0x20fdfb={},_0x2789b3={'count':0x0,'rows':[]};var _0x4b1e8d=db[_0x357e('0x27')][_0x357e('0x28')];_0x20fdfb[_0x357e('0x29')]=_[_0x357e('0x2a')](_[_0x357e('0x2b')](_0x4b1e8d),[_0x357e('0x2c')]);var _0x22dd25={'dateStart':_0x1d56b7[_0x357e('0x2d')][_0x357e('0x2e')],'dateEnd':_0x1d56b7[_0x357e('0x2d')][_0x357e('0x2f')]};delete _0x1d56b7[_0x357e('0x2d')]['dateStart'];delete _0x1d56b7[_0x357e('0x2d')]['dateEnd'];_0x20fdfb[_0x357e('0x2d')]=_[_0x357e('0x2b')](_0x1d56b7[_0x357e('0x2d')]);_0x20fdfb[_0x357e('0x30')]=_['intersection'](_0x20fdfb[_0x357e('0x29')],_0x20fdfb[_0x357e('0x2d')]);_0x3df80c[_0x357e('0x31')]=_['intersection'](_0x20fdfb[_0x357e('0x29')],qs['fields'](_0x1d56b7[_0x357e('0x2d')]['fields']));_0x3df80c['attributes']=_0x3df80c[_0x357e('0x31')][_0x357e('0x32')]?_0x3df80c['attributes']:_0x20fdfb[_0x357e('0x29')];if(!_0x1d56b7[_0x357e('0x2d')][_0x357e('0x33')](_0x357e('0x34'))){_0x3df80c['limit']=qs[_0x357e('0x1c')](_0x1d56b7[_0x357e('0x2d')][_0x357e('0x1c')]);_0x3df80c[_0x357e('0x1b')]=qs[_0x357e('0x1b')](_0x1d56b7['query'][_0x357e('0x1b')]);}_0x3df80c[_0x357e('0x35')]=qs['sort'](_0x1d56b7[_0x357e('0x2d')][_0x357e('0x36')]);_0x3df80c[_0x357e('0x37')]=qs[_0x357e('0x30')](_[_0x357e('0x38')](_0x1d56b7[_0x357e('0x2d')],_0x20fdfb[_0x357e('0x30')]));if(_0x22dd25[_0x357e('0x2e')]){if(_0x22dd25[_0x357e('0x2f')]){_0x22dd25[_0x357e('0x2f')]=moment(_0x22dd25[_0x357e('0x2f')])[_0x357e('0x39')](0x1,'day');}else{_0x22dd25[_0x357e('0x2f')]=moment(_0x22dd25[_0x357e('0x2e')])[_0x357e('0x39')](0x1,_0x357e('0x3a'));}_['merge'](_0x3df80c[_0x357e('0x37')],{'createdAt':{'$gte':_0x22dd25['dateStart'],'$lte':_0x22dd25[_0x357e('0x2f')]}});}if(_0x1d56b7[_0x357e('0x2d')]['filter']){_0x3df80c[_0x357e('0x37')]=_[_0x357e('0x3b')](_0x3df80c[_0x357e('0x37')],{'$or':_[_0x357e('0x3c')](_0x3df80c['attributes'],function(_0x5d87d2){var _0x581577={};_0x581577[_0x5d87d2]={'$like':'%'+_0x1d56b7[_0x357e('0x2d')][_0x357e('0x3d')]+'%'};return _0x581577;})});}_0x3df80c=_['merge']({},_0x3df80c,_0x1d56b7['options']);var _0x27f9b3={'where':_0x3df80c[_0x357e('0x37')]};return db[_0x357e('0x27')]['count'](_0x27f9b3)[_0x357e('0x21')](function(_0x54661b){_0x2789b3[_0x357e('0x1a')]=_0x54661b;if(_0x1d56b7[_0x357e('0x2d')]['includeAll']){_0x3df80c[_0x357e('0x3e')]=[{'all':!![]}];}return db['VoiceRecording'][_0x357e('0x3f')](_0x3df80c);})[_0x357e('0x21')](function(_0x56dd3a){_0x2789b3['rows']=_0x56dd3a;return _0x2789b3;})['then'](respondWithFilteredResult(_0x12f21d,_0x3df80c))['catch'](handleError(_0x12f21d,null));};exports[_0x357e('0x40')]=function(_0x258d77,_0x3663a1){var _0x5e8acd={'raw':![],'where':{'id':_0x258d77[_0x357e('0x41')]['id']}},_0x54b779={};_0x54b779[_0x357e('0x29')]=_['keys'](db[_0x357e('0x27')][_0x357e('0x28')]);_0x54b779['query']=_[_0x357e('0x2b')](_0x258d77[_0x357e('0x2d')]);_0x54b779[_0x357e('0x30')]=_[_0x357e('0x42')](_0x54b779[_0x357e('0x29')],_0x54b779[_0x357e('0x2d')]);_0x5e8acd[_0x357e('0x31')]=_['intersection'](_0x54b779['model'],qs[_0x357e('0x43')](_0x258d77[_0x357e('0x2d')]['fields']));_0x5e8acd[_0x357e('0x31')]=_0x5e8acd[_0x357e('0x31')][_0x357e('0x32')]?_0x5e8acd[_0x357e('0x31')]:_0x54b779[_0x357e('0x29')];if(_0x258d77['query']['includeAll']){_0x5e8acd[_0x357e('0x3e')]=[{'all':!![]}];}_0x5e8acd=_[_0x357e('0x3b')]({},_0x5e8acd,_0x258d77[_0x357e('0x44')]);return db['VoiceRecording'][_0x357e('0x45')](_0x5e8acd)[_0x357e('0x21')](handleEntityNotFound(_0x3663a1,null))[_0x357e('0x21')](respondWithResult(_0x3663a1,null))[_0x357e('0x46')](handleError(_0x3663a1,null));};exports['create']=function(_0x59f149,_0x2a5b18){return db[_0x357e('0x27')][_0x357e('0x47')](_0x59f149[_0x357e('0x48')],{})[_0x357e('0x21')](respondWithResult(_0x2a5b18,0xc9))['catch'](handleError(_0x2a5b18,null));};exports[_0x357e('0x49')]=function(_0x3dad20,_0x2dcbf7){if(_0x3dad20[_0x357e('0x48')]['id']){delete _0x3dad20['body']['id'];}return db[_0x357e('0x27')][_0x357e('0x45')]({'where':{'id':_0x3dad20[_0x357e('0x41')]['id']}})['then'](handleEntityNotFound(_0x2dcbf7,null))[_0x357e('0x21')](saveUpdates(_0x3dad20[_0x357e('0x48')],null))[_0x357e('0x21')](respondWithResult(_0x2dcbf7,null))['catch'](handleError(_0x2dcbf7,null));};exports['destroy']=function(_0x475281,_0xe5c9e5){return db[_0x357e('0x27')][_0x357e('0x45')]({'where':{'id':_0x475281['params']['id']}})['then'](handleEntityNotFound(_0xe5c9e5,null))[_0x357e('0x21')](removeEntity(_0xe5c9e5,null))[_0x357e('0x46')](handleError(_0xe5c9e5,null));};exports[_0x357e('0x4a')]=function(_0x35e299,_0x43ea9d){return db[_0x357e('0x27')][_0x357e('0x4a')]()['then'](respondWithResult(_0x43ea9d,null))['catch'](handleError(_0x43ea9d,null));};exports[_0x357e('0x4b')]=function(_0x324a2e,_0x2fd217,_0x2b81bc){var _0xa0d772=require(_0x357e('0x4c'));var _0x368335=![];var _0x3137e7={};if(_0x324a2e[_0x357e('0x2d')][_0x357e('0x4d')]&&_0x324a2e[_0x357e('0x2d')][_0x357e('0x4d')]===_0x357e('0x4e')){_0x3137e7['uniqueid']=_0x324a2e[_0x357e('0x41')]['id'];}else{_0x3137e7['id']=_0x324a2e['params']['id'];}return db[_0x357e('0x27')][_0x357e('0x45')]({'where':_0x3137e7,'attributes':['id',_0x357e('0x4f')],'raw':!![]})[_0x357e('0x21')](handleEntityNotFound(_0x2fd217,null))[_0x357e('0x21')](function(_0x5c88b5){if(_0x5c88b5){var _0x562165=util[_0x357e('0x2c')](_0x357e('0x50'),_0x5c88b5['value']);if(fs[_0x357e('0x51')](_0x562165)){_0x368335=!![];return _0xa0d772[_0x357e('0x52')](_0x562165,_0x5c88b5[_0x357e('0x4f')],config[_0x357e('0x53')][_0x357e('0x54')])[_0x357e('0x21')](function(){return _0x5c88b5;});}return _0x5c88b5;}})['then'](function(_0x5a1377){if(_0x5a1377){if(!fs[_0x357e('0x51')](_0x5a1377['value'])){throw new db['Sequelize'][(_0x357e('0x55'))](_0x357e('0x56'));}if(_0x5a1377[_0x357e('0x57')]){return _0x2fd217[_0x357e('0x4b')](_0x5a1377[_0x357e('0x4f')],_0x5a1377[_0x357e('0x57')]+path[_0x357e('0x58')](_0x5a1377['value']),function(){if(_0x368335){fs['unlink'](_0x5a1377[_0x357e('0x4f')]);}});}else{return _0x2fd217[_0x357e('0x4b')](_0x5a1377[_0x357e('0x4f')],function(_0x4c49b9){if(_0x368335){fs[_0x357e('0x59')](_0x5a1377[_0x357e('0x4f')]);}});}}})[_0x357e('0x46')](handleError(_0x2fd217,null));};exports[_0x357e('0x5a')]=function(_0x4f80cd,_0x45ecb4,_0x1a2044){var _0x2e86ac=require(_0x357e('0x4c'));var _0x3530b7=![];var _0x1d149f={'$and':[db[_0x357e('0x5b')][_0x357e('0x37')](db[_0x357e('0x5b')]['fn'](_0x357e('0x5c'),db[_0x357e('0x5b')]['col']('uniqueid')),_0x4f80cd[_0x357e('0x2d')][_0x357e('0x5d')])]};if(_0x4f80cd[_0x357e('0x2d')][_0x357e('0x4d')]&&_0x4f80cd[_0x357e('0x2d')][_0x357e('0x4d')]===_0x357e('0x4e')){_0x1d149f[_0x357e('0x5e')]['push']({'uniqueid':_0x4f80cd[_0x357e('0x41')]['id']});}else{_0x1d149f[_0x357e('0x5e')][_0x357e('0x5f')]({'id':_0x4f80cd[_0x357e('0x41')]['id']});}return db[_0x357e('0x27')][_0x357e('0x45')]({'where':_0x1d149f,'attributes':['id','value'],'raw':!![]})[_0x357e('0x21')](handleEntityNotFound(_0x45ecb4,null))[_0x357e('0x21')](function(_0x54efa7){if(_0x54efa7){var _0x23cdf8=util[_0x357e('0x2c')](_0x357e('0x50'),_0x54efa7['value']);if(fs[_0x357e('0x51')](_0x23cdf8)){_0x3530b7=!![];return _0x2e86ac[_0x357e('0x52')](_0x23cdf8,_0x54efa7['value'],config['secrets']['recording'])[_0x357e('0x21')](function(){return _0x54efa7;});}return _0x54efa7;}})[_0x357e('0x21')](function(_0x28e242){if(_0x28e242){if(!fs[_0x357e('0x51')](_0x28e242[_0x357e('0x4f')])){throw new db[(_0x357e('0x60'))][(_0x357e('0x55'))]('VoiceRecording\x20not\x20found');}if(_0x28e242['filename']){return _0x45ecb4['download'](_0x28e242[_0x357e('0x4f')],_0x28e242[_0x357e('0x57')]+path[_0x357e('0x58')](_0x28e242[_0x357e('0x4f')]),function(){if(_0x3530b7){fs[_0x357e('0x59')](_0x28e242[_0x357e('0x4f')]);}});}else{return _0x45ecb4['download'](_0x28e242[_0x357e('0x4f')],function(_0x39d3f9){if(_0x3530b7){fs['unlink'](_0x28e242[_0x357e('0x4f')]);}});}}})[_0x357e('0x46')](handleError(_0x45ecb4,null));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 46560c0..5935f84 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 _0x0146=['exports','define','VoiceRecording','voice_recordings','uniqueid','util','../../config/logger','moment'];(function(_0x27fa65,_0x4e02ee){var _0x456594=function(_0x43b6da){while(--_0x43b6da){_0x27fa65['push'](_0x27fa65['shift']());}};_0x456594(++_0x4e02ee);}(_0x0146,0x7d));var _0x6014=function(_0x473ee7,_0x4dd754){_0x473ee7=_0x473ee7-0x0;var _0x30f0d4=_0x0146[_0x473ee7];return _0x30f0d4;};'use strict';var _=require('lodash');var util=require(_0x6014('0x0'));var logger=require(_0x6014('0x1'))('api');var moment=require(_0x6014('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./voiceRecording.attributes');module[_0x6014('0x3')]=function(_0x3bba80,_0x5c9310){return _0x3bba80[_0x6014('0x4')](_0x6014('0x5'),attributes,{'tableName':_0x6014('0x6'),'paranoid':![],'indexes':[{'name':_0x6014('0x7'),'fields':[_0x6014('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x83b4=['define','VoiceRecording','voice_recordings','uniqueid','lodash','util','api','moment','request-promise','./voiceRecording.attributes'];(function(_0x24dfac,_0x2260aa){var _0x138489=function(_0x25a437){while(--_0x25a437){_0x24dfac['push'](_0x24dfac['shift']());}};_0x138489(++_0x2260aa);}(_0x83b4,0x194));var _0x483b=function(_0x290e4e,_0x13b4b8){_0x290e4e=_0x290e4e-0x0;var _0x4a9242=_0x83b4[_0x290e4e];return _0x4a9242;};'use strict';var _=require(_0x483b('0x0'));var util=require(_0x483b('0x1'));var logger=require('../../config/logger')(_0x483b('0x2'));var moment=require(_0x483b('0x3'));var BPromise=require('bluebird');var rp=require(_0x483b('0x4'));var attributes=require(_0x483b('0x5'));module['exports']=function(_0x4cabb5,_0x2751f6){return _0x4cabb5[_0x483b('0x6')](_0x483b('0x7'),attributes,{'tableName':_0x483b('0x8'),'paranoid':![],'indexes':[{'name':_0x483b('0x9'),'fields':[_0x483b('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 7e19a1a..f69de57 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 _0x63df=['request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceRecording,\x20%s,\x20%s','result','catch','UpdateVoiceRecording','VoiceRecording','body','options','where','limit','../../components/encryptor','Setting','callRecordingEncryption','create','value','%s.cypher','encryptFile','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','http','request','then','info'];(function(_0x52a857,_0xc99fa1){var _0x4e2aae=function(_0x5410d9){while(--_0x5410d9){_0x52a857['push'](_0x52a857['shift']());}};_0x4e2aae(++_0xc99fa1);}(_0x63df,0x1ef));var _0xf63d=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x63df[_0x27af45];return _0x18df21;};'use strict';var _=require('lodash');var util=require(_0xf63d('0x0'));var moment=require(_0xf63d('0x1'));var BPromise=require(_0xf63d('0x2'));var rs=require(_0xf63d('0x3'));var fs=require('fs');var Redis=require(_0xf63d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf63d('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf63d('0x6'));var client=jayson[_0xf63d('0x7')][_0xf63d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x271e16,_0xcc8c53,_0x8129fc){return new BPromise(function(_0x51802d,_0x1ea564){return client[_0xf63d('0x9')](_0x271e16,_0x8129fc)[_0xf63d('0xa')](function(_0x2bdc84){logger[_0xf63d('0xb')]('VoiceRecording,\x20%s,\x20%s',_0xcc8c53,_0xf63d('0xc'));logger[_0xf63d('0xd')](_0xf63d('0xe'),_0xcc8c53,_0xf63d('0xc'),JSON[_0xf63d('0xf')](_0x2bdc84));if(_0x2bdc84[_0xf63d('0x10')]){if(_0x2bdc84['error'][_0xf63d('0x11')]===0x1f4){logger[_0xf63d('0x10')]('VoiceRecording,\x20%s,\x20%s',_0xcc8c53,_0x2bdc84[_0xf63d('0x10')][_0xf63d('0x12')]);return _0x1ea564(_0x2bdc84[_0xf63d('0x10')][_0xf63d('0x12')]);}logger[_0xf63d('0x10')]('VoiceRecording,\x20%s,\x20%s',_0xcc8c53,_0x2bdc84[_0xf63d('0x10')][_0xf63d('0x12')]);return _0x51802d(_0x2bdc84[_0xf63d('0x10')][_0xf63d('0x12')]);}else{logger['info'](_0xf63d('0x13'),_0xcc8c53,_0xf63d('0xc'));_0x51802d(_0x2bdc84[_0xf63d('0x14')][_0xf63d('0x12')]);}})[_0xf63d('0x15')](function(_0x236d6f){logger[_0xf63d('0x10')]('VoiceRecording,\x20%s,\x20%s',_0xcc8c53,_0x236d6f);_0x1ea564(_0x236d6f);});});}exports[_0xf63d('0x16')]=function(_0x1d0f11){var _0x32ff77=this;return new Promise(function(_0x132338,_0x3de01a){return db[_0xf63d('0x17')]['update'](_0x1d0f11[_0xf63d('0x18')],{'raw':_0x1d0f11['options']?_0x1d0f11[_0xf63d('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d0f11[_0xf63d('0x19')]?_0x1d0f11[_0xf63d('0x19')][_0xf63d('0x1a')]||null:null,'attributes':_0x1d0f11[_0xf63d('0x19')]?_0x1d0f11[_0xf63d('0x19')]['attributes']||null:null,'limit':_0x1d0f11['options']?_0x1d0f11[_0xf63d('0x19')][_0xf63d('0x1b')]||null:null})[_0xf63d('0xa')](function(_0x57769e){logger[_0xf63d('0xb')]('UpdateVoiceRecording',_0x1d0f11);logger[_0xf63d('0xd')](_0xf63d('0x16'),_0x1d0f11,JSON['stringify'](_0x57769e));_0x132338(_0x57769e);})[_0xf63d('0x15')](function(_0x29c0ea){logger['error'](_0xf63d('0x16'),_0x29c0ea['message'],_0x1d0f11);_0x3de01a(_0x32ff77[_0xf63d('0x10')](0x1f4,_0x29c0ea[_0xf63d('0x12')]));});});};exports['CreateVoiceRecording']=function(_0x3e9022){var _0x2886b2=this;return new Promise(function(_0x5511a0,_0xefe351){var _0x4a2cfb=require(_0xf63d('0x1c'));var _0x4754e3;return db[_0xf63d('0x1d')]['findOne']({'attributes':['id',_0xf63d('0x1e')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x1d1e0a){_0x4754e3=_0x1d1e0a;return db[_0xf63d('0x17')][_0xf63d('0x1f')](_0x3e9022[_0xf63d('0x18')]);})[_0xf63d('0xa')](function(_0x49ea4e){if(_0x4754e3[_0xf63d('0x1e')]&&fs['existsSync'](_0x49ea4e[_0xf63d('0x20')])){var _0x29167e=util['format'](_0xf63d('0x21'),_0x49ea4e[_0xf63d('0x20')]);return _0x4a2cfb[_0xf63d('0x22')](_0x49ea4e[_0xf63d('0x20')],_0x29167e,config[_0xf63d('0x23')][_0xf63d('0x24')])[_0xf63d('0xa')](function(){fs['unlink'](_0x49ea4e[_0xf63d('0x20')]);logger[_0xf63d('0xb')](_0xf63d('0x25'));return _0x49ea4e;});}return _0x49ea4e;})[_0xf63d('0xa')](function(_0x5c3172){logger['info']('CreateVoiceRecording',_0x3e9022);logger[_0xf63d('0xd')]('CreateVoiceRecording',_0x3e9022,JSON[_0xf63d('0xf')](_0x5c3172));_0x5511a0(_0x5c3172);})[_0xf63d('0x15')](function(_0x320886){logger[_0xf63d('0x10')](_0xf63d('0x26'),_0x320886[_0xf63d('0x12')],_0x3e9022);_0xefe351(_0x2886b2[_0xf63d('0x10')](0x1f4,_0x320886['message']));});});}; \ No newline at end of file +var _0x28ac=['attributes','limit','CreateVoiceRecording','../../components/encryptor','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','recording','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw','where'];(function(_0x47f21b,_0x5c1a14){var _0x180bb2=function(_0x303850){while(--_0x303850){_0x47f21b['push'](_0x47f21b['shift']());}};_0x180bb2(++_0x5c1a14);}(_0x28ac,0x109));var _0xc28a=function(_0x4dbb00,_0x2eb248){_0x4dbb00=_0x4dbb00-0x0;var _0x5aa5ff=_0x28ac[_0x4dbb00];return _0x5aa5ff;};'use strict';var _=require(_0xc28a('0x0'));var util=require(_0xc28a('0x1'));var moment=require(_0xc28a('0x2'));var BPromise=require(_0xc28a('0x3'));var rs=require(_0xc28a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc28a('0x5'));var logger=require(_0xc28a('0x6'))(_0xc28a('0x7'));var config=require(_0xc28a('0x8'));var jayson=require(_0xc28a('0x9'));var client=jayson['client'][_0xc28a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fd17a,_0x3fe26b,_0x2febb6){return new BPromise(function(_0x2d769d,_0xe8b308){return client[_0xc28a('0xb')](_0x3fd17a,_0x2febb6)[_0xc28a('0xc')](function(_0x1decfd){logger[_0xc28a('0xd')](_0xc28a('0xe'),_0x3fe26b,_0xc28a('0xf'));logger[_0xc28a('0x10')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x3fe26b,_0xc28a('0xf'),JSON[_0xc28a('0x11')](_0x1decfd));if(_0x1decfd[_0xc28a('0x12')]){if(_0x1decfd[_0xc28a('0x12')][_0xc28a('0x13')]===0x1f4){logger[_0xc28a('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x3fe26b,_0x1decfd[_0xc28a('0x12')]['message']);return _0xe8b308(_0x1decfd[_0xc28a('0x12')]['message']);}logger['error'](_0xc28a('0xe'),_0x3fe26b,_0x1decfd[_0xc28a('0x12')][_0xc28a('0x14')]);return _0x2d769d(_0x1decfd['error'][_0xc28a('0x14')]);}else{logger[_0xc28a('0xd')](_0xc28a('0xe'),_0x3fe26b,_0xc28a('0xf'));_0x2d769d(_0x1decfd[_0xc28a('0x15')]['message']);}})[_0xc28a('0x16')](function(_0x410242){logger[_0xc28a('0x12')](_0xc28a('0xe'),_0x3fe26b,_0x410242);_0xe8b308(_0x410242);});});}exports[_0xc28a('0x17')]=function(_0x46ea74){var _0x40a0ec=this;return new Promise(function(_0x1e415e,_0x5a27eb){return db[_0xc28a('0x18')]['update'](_0x46ea74[_0xc28a('0x19')],{'raw':_0x46ea74[_0xc28a('0x1a')]?_0x46ea74[_0xc28a('0x1a')][_0xc28a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46ea74[_0xc28a('0x1a')]?_0x46ea74[_0xc28a('0x1a')][_0xc28a('0x1c')]||null:null,'attributes':_0x46ea74['options']?_0x46ea74[_0xc28a('0x1a')][_0xc28a('0x1d')]||null:null,'limit':_0x46ea74['options']?_0x46ea74[_0xc28a('0x1a')][_0xc28a('0x1e')]||null:null})[_0xc28a('0xc')](function(_0x30f8da){logger[_0xc28a('0xd')](_0xc28a('0x17'),_0x46ea74);logger[_0xc28a('0x10')](_0xc28a('0x17'),_0x46ea74,JSON[_0xc28a('0x11')](_0x30f8da));_0x1e415e(_0x30f8da);})[_0xc28a('0x16')](function(_0x1a4269){logger['error'](_0xc28a('0x17'),_0x1a4269[_0xc28a('0x14')],_0x46ea74);_0x5a27eb(_0x40a0ec[_0xc28a('0x12')](0x1f4,_0x1a4269[_0xc28a('0x14')]));});});};exports[_0xc28a('0x1f')]=function(_0x6180ae){var _0x39ed6e=this;return new Promise(function(_0x10b833,_0x4c1361){var _0x1bd013=require(_0xc28a('0x20'));var _0xfe2054;return db['Setting'][_0xc28a('0x21')]({'attributes':['id',_0xc28a('0x22')],'where':{'id':0x1},'raw':!![]})[_0xc28a('0xc')](function(_0xebab36){_0xfe2054=_0xebab36;return db[_0xc28a('0x18')][_0xc28a('0x23')](_0x6180ae[_0xc28a('0x19')]);})['then'](function(_0x4a0425){if(_0xfe2054[_0xc28a('0x22')]&&fs[_0xc28a('0x24')](_0x4a0425[_0xc28a('0x25')])){var _0x2e5452=util[_0xc28a('0x26')](_0xc28a('0x27'),_0x4a0425[_0xc28a('0x25')]);return _0x1bd013[_0xc28a('0x28')](_0x4a0425[_0xc28a('0x25')],_0x2e5452,config['secrets'][_0xc28a('0x29')])[_0xc28a('0xc')](function(){fs['unlink'](_0x4a0425['value']);logger[_0xc28a('0xd')]('CreateVoiceRecording\x20file\x20encrypted');return _0x4a0425;});}return _0x4a0425;})['then'](function(_0x3b9e05){logger[_0xc28a('0xd')](_0xc28a('0x1f'),_0x6180ae);logger[_0xc28a('0x10')](_0xc28a('0x1f'),_0x6180ae,JSON[_0xc28a('0x11')](_0x3b9e05));_0x10b833(_0x3b9e05);})[_0xc28a('0x16')](function(_0x10cab4){logger[_0xc28a('0x12')](_0xc28a('0x1f'),_0x10cab4[_0xc28a('0x14')],_0x6180ae);_0x4c1361(_0x39ed6e[_0xc28a('0x12')](0x1f4,_0x10cab4[_0xc28a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index e7b54d3..1a13c9a 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 _0x6249=['./voiceTransferReport.controller','get','isAuthenticated','show','post','put','/:id','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6249,0x1bb));var _0x9624=function(_0x3e157d,_0x1ceeeb){_0x3e157d=_0x3e157d-0x0;var _0x51a60d=_0x6249[_0x3e157d];return _0x51a60d;};'use strict';var multer=require(_0x9624('0x0'));var util=require(_0x9624('0x1'));var path=require(_0x9624('0x2'));var timeout=require(_0x9624('0x3'));var express=require(_0x9624('0x4'));var router=express[_0x9624('0x5')]();var auth=require(_0x9624('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9624('0x7'));router[_0x9624('0x8')]('/',auth[_0x9624('0x9')](),controller['index']);router['get']('/:id',auth[_0x9624('0x9')](),controller[_0x9624('0xa')]);router[_0x9624('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9624('0xc')](_0x9624('0xd'),auth['isAuthenticated'](),controller[_0x9624('0xe')]);router['delete'](_0x9624('0xd'),auth[_0x9624('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xba2e=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','path'];(function(_0x50f0a9,_0x2b0c57){var _0x5a33d9=function(_0x40338e){while(--_0x40338e){_0x50f0a9['push'](_0x50f0a9['shift']());}};_0x5a33d9(++_0x2b0c57);}(_0xba2e,0x18d));var _0xeba2=function(_0x371024,_0x11ceb6){_0x371024=_0x371024-0x0;var _0xe20e7d=_0xba2e[_0x371024];return _0xe20e7d;};'use strict';var multer=require(_0xeba2('0x0'));var util=require('util');var path=require(_0xeba2('0x1'));var timeout=require(_0xeba2('0x2'));var express=require(_0xeba2('0x3'));var router=express[_0xeba2('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xeba2('0x5'));var config=require(_0xeba2('0x6'));var controller=require(_0xeba2('0x7'));router[_0xeba2('0x8')]('/',auth[_0xeba2('0x9')](),controller[_0xeba2('0xa')]);router[_0xeba2('0x8')](_0xeba2('0xb'),auth[_0xeba2('0x9')](),controller[_0xeba2('0xc')]);router[_0xeba2('0xd')]('/',auth[_0xeba2('0x9')](),controller[_0xeba2('0xe')]);router[_0xeba2('0xf')](_0xeba2('0xb'),auth[_0xeba2('0x9')](),controller[_0xeba2('0x10')]);router[_0xeba2('0x11')](_0xeba2('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xeba2('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 48d358c..8c4800d 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 _0xbfb9=['STRING','exports','ENUM','blind'];(function(_0x2f1114,_0x4561f1){var _0x2fe856=function(_0x8397f8){while(--_0x8397f8){_0x2f1114['push'](_0x2f1114['shift']());}};_0x2fe856(++_0x4561f1);}(_0xbfb9,0x129));var _0x9bfb=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xbfb9[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x9bfb('0x0')]={'type':{'type':Sequelize[_0x9bfb('0x1')](_0x9bfb('0x2'),'attended')},'result':{'type':Sequelize[_0x9bfb('0x3')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x9bfb('0x3')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x9bfb('0x3')]},'transfereraccountcode':{'type':Sequelize[_0x9bfb('0x3')]},'transferercontext':{'type':Sequelize[_0x9bfb('0x3')]},'transfererexten':{'type':Sequelize[_0x9bfb('0x3')]},'transfererlinkedid':{'type':Sequelize[_0x9bfb('0x3')]},'transfereechannel':{'type':Sequelize[_0x9bfb('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0x9bfb('0x3')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x9bfb('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0x9bfb('0x3')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x9bfb('0x3')]},'transfereeexten':{'type':Sequelize[_0x9bfb('0x3')]},'transfereelinkedid':{'type':Sequelize[_0x9bfb('0x3')]},'isexternal':{'type':Sequelize[_0x9bfb('0x1')]('Yes','No')},'context':{'type':Sequelize[_0x9bfb('0x3')]},'extension':{'type':Sequelize[_0x9bfb('0x3')]}}; \ No newline at end of file +var _0x54c9=['attended','STRING','Yes','moment','exports','ENUM','blind'];(function(_0x227875,_0x1abaa8){var _0x7d7fdb=function(_0x1de5a2){while(--_0x1de5a2){_0x227875['push'](_0x227875['shift']());}};_0x7d7fdb(++_0x1abaa8);}(_0x54c9,0x129));var _0x954c=function(_0x347256,_0xe284bf){_0x347256=_0x347256-0x0;var _0xb51e98=_0x54c9[_0x347256];return _0xb51e98;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x954c('0x0'));module[_0x954c('0x1')]={'type':{'type':Sequelize[_0x954c('0x2')](_0x954c('0x3'),_0x954c('0x4'))},'result':{'type':Sequelize[_0x954c('0x5')]},'transfererchannel':{'type':Sequelize[_0x954c('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x954c('0x5')]},'transferercalleridname':{'type':Sequelize[_0x954c('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x954c('0x5')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x954c('0x5')]},'transferercontext':{'type':Sequelize[_0x954c('0x5')]},'transfererexten':{'type':Sequelize[_0x954c('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x954c('0x5')]},'transfereechannel':{'type':Sequelize[_0x954c('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x954c('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x954c('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x954c('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x954c('0x5')]},'transfereecontext':{'type':Sequelize[_0x954c('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x954c('0x5')]},'isexternal':{'type':Sequelize[_0x954c('0x2')](_0x954c('0x6'),'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 c840c73..70d59a7 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 _0xadb5=['name','send','VoiceTransferReport','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','attributes','nolimit','order','sort','where','add','day','filter','merge','map','options','include','findAll','rows','show','fields','length','find','catch','body','params','destroy','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/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','end','sendStatus','error','stack'];(function(_0x28210f,_0x4f87d9){var _0x312b9c=function(_0x48bc83){while(--_0x48bc83){_0x28210f['push'](_0x28210f['shift']());}};_0x312b9c(++_0x4f87d9);}(_0xadb5,0xad));var _0x5adb=function(_0xb8d01,_0x1f41c2){_0xb8d01=_0xb8d01-0x0;var _0x4ba26b=_0xadb5[_0xb8d01];return _0x4ba26b;};'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 qs=require(_0x5adb('0x12'));var logger=require(_0x5adb('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x5adb('0x14'));var db=require(_0x5adb('0x15'))['db'];function respondWithStatusCode(_0x82e67e,_0x53b772){_0x53b772=_0x53b772||0xcc;return function(_0x29f0d5){if(_0x29f0d5){return _0x82e67e['sendStatus'](_0x53b772);}return _0x82e67e[_0x5adb('0x16')](_0x53b772)['end']();};}function respondWithResult(_0x8cfcc6,_0x39a0b3){_0x39a0b3=_0x39a0b3||0xc8;return function(_0x44abe3){if(_0x44abe3){return _0x8cfcc6['status'](_0x39a0b3)[_0x5adb('0x17')](_0x44abe3);}};}function respondWithFilteredResult(_0x34af2c,_0xf82f72){return function(_0x5263ec){if(_0x5263ec){var _0x2312de=_0x5263ec[_0x5adb('0x18')],_0x518823=_0xf82f72[_0x5adb('0x19')],_0x367d82=_0xf82f72[_0x5adb('0x19')]+_0xf82f72[_0x5adb('0x1a')],_0x42a482;if(_0x367d82>=_0x2312de){_0x367d82=_0x2312de;_0x42a482=0xc8;}else{_0x42a482=0xce;}_0x34af2c[_0x5adb('0x16')](_0x42a482);return _0x34af2c[_0x5adb('0x1b')](_0x5adb('0x1c'),_0x518823+'-'+_0x367d82+'/'+_0x2312de)['json'](_0x5263ec);}return null;};}function patchUpdates(_0x3fff62){return function(_0x5de028){try{jsonpatch[_0x5adb('0x1d')](_0x5de028,_0x3fff62,!![]);}catch(_0x558f76){return BPromise[_0x5adb('0x1e')](_0x558f76);}return _0x5de028['save']();};}function saveUpdates(_0x5e218c,_0x1fbaa5){return function(_0x1bed20){if(_0x1bed20){return _0x1bed20[_0x5adb('0x1f')](_0x5e218c)[_0x5adb('0x20')](function(_0x99bc6c){return _0x99bc6c;});}return null;};}function removeEntity(_0x5af69d,_0x3255b3){return function(_0x5c296e){if(_0x5c296e){return _0x5c296e['destroy']()[_0x5adb('0x20')](function(){_0x5af69d[_0x5adb('0x16')](0xcc)[_0x5adb('0x21')]();});}};}function handleEntityNotFound(_0x1a8014,_0x1e9ccf){return function(_0x413911){if(!_0x413911){_0x1a8014[_0x5adb('0x22')](0x194);}return _0x413911;};}function handleError(_0x4ca150,_0x4b1957){_0x4b1957=_0x4b1957||0x1f4;return function(_0x373cc3){logger[_0x5adb('0x23')](_0x373cc3[_0x5adb('0x24')]);if(_0x373cc3[_0x5adb('0x25')]){delete _0x373cc3['name'];}_0x4ca150[_0x5adb('0x16')](_0x4b1957)[_0x5adb('0x26')](_0x373cc3);};}exports['index']=function(_0x1feecf,_0x1ded9f){var _0x1a0acd={},_0x55b40a={},_0x13ad1d={'count':0x0,'rows':[]};var _0xbe21b1=db[_0x5adb('0x27')][_0x5adb('0x28')];_0x55b40a[_0x5adb('0x29')]=_[_0x5adb('0x2a')](_0xbe21b1);var _0x4a5d46={'dateStart':_0x1feecf['query']['dateStart'],'dateEnd':_0x1feecf[_0x5adb('0x2b')][_0x5adb('0x2c')]};delete _0x1feecf[_0x5adb('0x2b')][_0x5adb('0x2d')];delete _0x1feecf[_0x5adb('0x2b')]['dateEnd'];_0x55b40a[_0x5adb('0x2b')]=_[_0x5adb('0x2a')](_0x1feecf[_0x5adb('0x2b')]);_0x55b40a[_0x5adb('0x2e')]=_[_0x5adb('0x2f')](_0x55b40a[_0x5adb('0x29')],_0x55b40a[_0x5adb('0x2b')]);_0x1a0acd[_0x5adb('0x30')]=_[_0x5adb('0x2f')](_0x55b40a[_0x5adb('0x29')],qs['fields'](_0x1feecf[_0x5adb('0x2b')]['fields']));_0x1a0acd[_0x5adb('0x30')]=_0x1a0acd[_0x5adb('0x30')]['length']?_0x1a0acd[_0x5adb('0x30')]:_0x55b40a[_0x5adb('0x29')];if(!_0x1feecf[_0x5adb('0x2b')]['hasOwnProperty'](_0x5adb('0x31'))){_0x1a0acd[_0x5adb('0x1a')]=qs['limit'](_0x1feecf['query'][_0x5adb('0x1a')]);_0x1a0acd['offset']=qs[_0x5adb('0x19')](_0x1feecf[_0x5adb('0x2b')][_0x5adb('0x19')]);}_0x1a0acd[_0x5adb('0x32')]=qs[_0x5adb('0x33')](_0x1feecf['query'][_0x5adb('0x33')]);_0x1a0acd[_0x5adb('0x34')]=qs[_0x5adb('0x2e')](_['pick'](_0x1feecf['query'],_0x55b40a[_0x5adb('0x2e')]));if(_0x4a5d46[_0x5adb('0x2d')]){if(_0x4a5d46['dateEnd']){_0x4a5d46[_0x5adb('0x2c')]=moment(_0x4a5d46['dateEnd'])[_0x5adb('0x35')](0x1,'day');}else{_0x4a5d46[_0x5adb('0x2c')]=moment(_0x4a5d46['dateStart'])[_0x5adb('0x35')](0x1,_0x5adb('0x36'));}_['merge'](_0x1a0acd[_0x5adb('0x34')],{'createdAt':{'$gte':_0x4a5d46['dateStart'],'$lte':_0x4a5d46[_0x5adb('0x2c')]}});}if(_0x1feecf[_0x5adb('0x2b')][_0x5adb('0x37')]){_0x1a0acd['where']=_[_0x5adb('0x38')](_0x1a0acd[_0x5adb('0x34')],{'$or':_[_0x5adb('0x39')](_0x1a0acd[_0x5adb('0x30')],function(_0x22aa95){var _0x52d74f={};_0x52d74f[_0x22aa95]={'$like':'%'+_0x1feecf['query']['filter']+'%'};return _0x52d74f;})});}_0x1a0acd=_['merge']({},_0x1a0acd,_0x1feecf[_0x5adb('0x3a')]);var _0x2fbe14={'where':_0x1a0acd[_0x5adb('0x34')]};return db[_0x5adb('0x27')][_0x5adb('0x18')](_0x2fbe14)[_0x5adb('0x20')](function(_0x2c69a8){_0x13ad1d[_0x5adb('0x18')]=_0x2c69a8;if(_0x1feecf['query']['includeAll']){_0x1a0acd[_0x5adb('0x3b')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x5adb('0x3c')](_0x1a0acd);})[_0x5adb('0x20')](function(_0x299746){_0x13ad1d[_0x5adb('0x3d')]=_0x299746;return _0x13ad1d;})[_0x5adb('0x20')](respondWithFilteredResult(_0x1ded9f,_0x1a0acd))['catch'](handleError(_0x1ded9f,null));};exports[_0x5adb('0x3e')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x29')]=_[_0x5adb('0x2a')](db[_0x5adb('0x27')][_0x5adb('0x28')]);_0x1a256c[_0x5adb('0x2b')]=_[_0x5adb('0x2a')](_0x565b03[_0x5adb('0x2b')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x29')],_0x1a256c[_0x5adb('0x2b')]);_0x4160ad[_0x5adb('0x30')]=_[_0x5adb('0x2f')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2b')][_0x5adb('0x3f')]));_0x4160ad[_0x5adb('0x30')]=_0x4160ad[_0x5adb('0x30')][_0x5adb('0x40')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x29')];if(_0x565b03[_0x5adb('0x2b')]['includeAll']){_0x4160ad[_0x5adb('0x3b')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x38')]({},_0x4160ad,_0x565b03[_0x5adb('0x3a')]);return db[_0x5adb('0x27')][_0x5adb('0x41')](_0x4160ad)[_0x5adb('0x20')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x20')](respondWithResult(_0x508690,null))[_0x5adb('0x42')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceTransferReport']['create'](_0x3a925b[_0x5adb('0x43')],{})[_0x5adb('0x20')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x42')](handleError(_0x57dc8b,null));};exports['update']=function(_0x2ad69d,_0x5cbab5){if(_0x2ad69d[_0x5adb('0x43')]['id']){delete _0x2ad69d[_0x5adb('0x43')]['id'];}return db[_0x5adb('0x27')]['find']({'where':{'id':_0x2ad69d[_0x5adb('0x44')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x20')](saveUpdates(_0x2ad69d[_0x5adb('0x43')],null))['then'](respondWithResult(_0x5cbab5,null))[_0x5adb('0x42')](handleError(_0x5cbab5,null));};exports[_0x5adb('0x45')]=function(_0x3594e3,_0x101008){return db[_0x5adb('0x27')]['find']({'where':{'id':_0x3594e3[_0x5adb('0x44')]['id']}})[_0x5adb('0x20')](handleEntityNotFound(_0x101008,null))[_0x5adb('0x20')](removeEntity(_0x101008,null))[_0x5adb('0x42')](handleError(_0x101008,null));}; \ No newline at end of file +var _0x5f66=['filter','map','options','count','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','limit','set','Content-Range','reject','update','destroy','then','end','sendStatus','error','stack','name','send','VoiceTransferReport','model','keys','dateEnd','query','dateStart','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','day','add','merge'];(function(_0x207426,_0x2bad35){var _0x101dd2=function(_0x371172){while(--_0x371172){_0x207426['push'](_0x207426['shift']());}};_0x101dd2(++_0x2bad35);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};'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 qs=require(_0x65f6('0xe'));var logger=require(_0x65f6('0xf'))(_0x65f6('0x10'));var utils=require(_0x65f6('0x11'));var config=require('../../config/environment');var db=require(_0x65f6('0x12'))['db'];function respondWithStatusCode(_0x571436,_0x497cf3){_0x497cf3=_0x497cf3||0xcc;return function(_0x2d2dfa){if(_0x2d2dfa){return _0x571436['sendStatus'](_0x497cf3);}return _0x571436[_0x65f6('0x13')](_0x497cf3)['end']();};}function respondWithResult(_0x2f964a,_0x186a6a){_0x186a6a=_0x186a6a||0xc8;return function(_0x2c4ee5){if(_0x2c4ee5){return _0x2f964a[_0x65f6('0x13')](_0x186a6a)[_0x65f6('0x14')](_0x2c4ee5);}};}function respondWithFilteredResult(_0x1d29fd,_0x44144b){return function(_0xb1d40a){if(_0xb1d40a){var _0x46dbc6=_0xb1d40a['count'],_0x3440af=_0x44144b['offset'],_0x59154e=_0x44144b[_0x65f6('0x15')]+_0x44144b[_0x65f6('0x16')],_0x19b9ff;if(_0x59154e>=_0x46dbc6){_0x59154e=_0x46dbc6;_0x19b9ff=0xc8;}else{_0x19b9ff=0xce;}_0x1d29fd[_0x65f6('0x13')](_0x19b9ff);return _0x1d29fd[_0x65f6('0x17')](_0x65f6('0x18'),_0x3440af+'-'+_0x59154e+'/'+_0x46dbc6)[_0x65f6('0x14')](_0xb1d40a);}return null;};}function patchUpdates(_0xc8660c){return function(_0x18380e){try{jsonpatch['apply'](_0x18380e,_0xc8660c,!![]);}catch(_0x4d79a1){return BPromise[_0x65f6('0x19')](_0x4d79a1);}return _0x18380e['save']();};}function saveUpdates(_0x4c81f3,_0x5c5b91){return function(_0x365159){if(_0x365159){return _0x365159[_0x65f6('0x1a')](_0x4c81f3)['then'](function(_0x39e19f){return _0x39e19f;});}return null;};}function removeEntity(_0x270893,_0xbee6a4){return function(_0x3876ed){if(_0x3876ed){return _0x3876ed[_0x65f6('0x1b')]()[_0x65f6('0x1c')](function(){_0x270893['status'](0xcc)[_0x65f6('0x1d')]();});}};}function handleEntityNotFound(_0x4bb39e,_0x5b9e2a){return function(_0x212247){if(!_0x212247){_0x4bb39e[_0x65f6('0x1e')](0x194);}return _0x212247;};}function handleError(_0x524e42,_0x1eeaaa){_0x1eeaaa=_0x1eeaaa||0x1f4;return function(_0x471a33){logger[_0x65f6('0x1f')](_0x471a33[_0x65f6('0x20')]);if(_0x471a33['name']){delete _0x471a33[_0x65f6('0x21')];}_0x524e42[_0x65f6('0x13')](_0x1eeaaa)[_0x65f6('0x22')](_0x471a33);};}exports['index']=function(_0x5cb131,_0x4fde2f){var _0x29abdb={},_0x16cde8={},_0x4b2292={'count':0x0,'rows':[]};var _0x296cd9=db[_0x65f6('0x23')]['rawAttributes'];_0x16cde8[_0x65f6('0x24')]=_[_0x65f6('0x25')](_0x296cd9);var _0x28d0df={'dateStart':_0x5cb131['query']['dateStart'],'dateEnd':_0x5cb131['query'][_0x65f6('0x26')]};delete _0x5cb131[_0x65f6('0x27')][_0x65f6('0x28')];delete _0x5cb131[_0x65f6('0x27')][_0x65f6('0x26')];_0x16cde8[_0x65f6('0x27')]=_[_0x65f6('0x25')](_0x5cb131['query']);_0x16cde8['filters']=_[_0x65f6('0x29')](_0x16cde8[_0x65f6('0x24')],_0x16cde8['query']);_0x29abdb['attributes']=_[_0x65f6('0x29')](_0x16cde8[_0x65f6('0x24')],qs[_0x65f6('0x2a')](_0x5cb131[_0x65f6('0x27')][_0x65f6('0x2a')]));_0x29abdb[_0x65f6('0x2b')]=_0x29abdb['attributes'][_0x65f6('0x2c')]?_0x29abdb[_0x65f6('0x2b')]:_0x16cde8[_0x65f6('0x24')];if(!_0x5cb131['query'][_0x65f6('0x2d')](_0x65f6('0x2e'))){_0x29abdb[_0x65f6('0x16')]=qs[_0x65f6('0x16')](_0x5cb131[_0x65f6('0x27')][_0x65f6('0x16')]);_0x29abdb['offset']=qs[_0x65f6('0x15')](_0x5cb131[_0x65f6('0x27')]['offset']);}_0x29abdb[_0x65f6('0x2f')]=qs['sort'](_0x5cb131[_0x65f6('0x27')]['sort']);_0x29abdb[_0x65f6('0x30')]=qs[_0x65f6('0x31')](_['pick'](_0x5cb131[_0x65f6('0x27')],_0x16cde8[_0x65f6('0x31')]));if(_0x28d0df[_0x65f6('0x28')]){if(_0x28d0df['dateEnd']){_0x28d0df['dateEnd']=moment(_0x28d0df[_0x65f6('0x26')])['add'](0x1,_0x65f6('0x32'));}else{_0x28d0df['dateEnd']=moment(_0x28d0df[_0x65f6('0x28')])[_0x65f6('0x33')](0x1,'day');}_[_0x65f6('0x34')](_0x29abdb['where'],{'createdAt':{'$gte':_0x28d0df['dateStart'],'$lte':_0x28d0df[_0x65f6('0x26')]}});}if(_0x5cb131[_0x65f6('0x27')][_0x65f6('0x35')]){_0x29abdb[_0x65f6('0x30')]=_[_0x65f6('0x34')](_0x29abdb[_0x65f6('0x30')],{'$or':_[_0x65f6('0x36')](_0x29abdb[_0x65f6('0x2b')],function(_0x4f933b){var _0x3aa254={};_0x3aa254[_0x4f933b]={'$like':'%'+_0x5cb131['query'][_0x65f6('0x35')]+'%'};return _0x3aa254;})});}_0x29abdb=_[_0x65f6('0x34')]({},_0x29abdb,_0x5cb131[_0x65f6('0x37')]);var _0x2ea7f7={'where':_0x29abdb['where']};return db[_0x65f6('0x23')][_0x65f6('0x38')](_0x2ea7f7)[_0x65f6('0x1c')](function(_0x3fb1c6){_0x4b2292[_0x65f6('0x38')]=_0x3fb1c6;if(_0x5cb131[_0x65f6('0x27')][_0x65f6('0x39')]){_0x29abdb[_0x65f6('0x3a')]=[{'all':!![]}];}return db[_0x65f6('0x23')]['findAll'](_0x29abdb);})[_0x65f6('0x1c')](function(_0x400ed2){_0x4b2292[_0x65f6('0x3b')]=_0x400ed2;return _0x4b2292;})[_0x65f6('0x1c')](respondWithFilteredResult(_0x4fde2f,_0x29abdb))[_0x65f6('0x3c')](handleError(_0x4fde2f,null));};exports[_0x65f6('0x3d')]=function(_0xe0b72d,_0x2e91e8){var _0x461393={'raw':!![],'where':{'id':_0xe0b72d[_0x65f6('0x3e')]['id']}},_0x2abbed={};_0x2abbed[_0x65f6('0x24')]=_[_0x65f6('0x25')](db[_0x65f6('0x23')][_0x65f6('0x3f')]);_0x2abbed[_0x65f6('0x27')]=_['keys'](_0xe0b72d[_0x65f6('0x27')]);_0x2abbed[_0x65f6('0x31')]=_[_0x65f6('0x29')](_0x2abbed[_0x65f6('0x24')],_0x2abbed['query']);_0x461393[_0x65f6('0x2b')]=_[_0x65f6('0x29')](_0x2abbed[_0x65f6('0x24')],qs['fields'](_0xe0b72d[_0x65f6('0x27')][_0x65f6('0x2a')]));_0x461393[_0x65f6('0x2b')]=_0x461393[_0x65f6('0x2b')]['length']?_0x461393[_0x65f6('0x2b')]:_0x2abbed['model'];if(_0xe0b72d[_0x65f6('0x27')][_0x65f6('0x39')]){_0x461393['include']=[{'all':!![]}];}_0x461393=_[_0x65f6('0x34')]({},_0x461393,_0xe0b72d['options']);return db[_0x65f6('0x23')][_0x65f6('0x40')](_0x461393)[_0x65f6('0x1c')](handleEntityNotFound(_0x2e91e8,null))[_0x65f6('0x1c')](respondWithResult(_0x2e91e8,null))[_0x65f6('0x3c')](handleError(_0x2e91e8,null));};exports[_0x65f6('0x41')]=function(_0x4d30c5,_0x51bf6c){return db[_0x65f6('0x23')][_0x65f6('0x41')](_0x4d30c5[_0x65f6('0x42')],{})[_0x65f6('0x1c')](respondWithResult(_0x51bf6c,0xc9))[_0x65f6('0x3c')](handleError(_0x51bf6c,null));};exports[_0x65f6('0x1a')]=function(_0x149c28,_0x41690c){if(_0x149c28[_0x65f6('0x42')]['id']){delete _0x149c28['body']['id'];}return db[_0x65f6('0x23')][_0x65f6('0x40')]({'where':{'id':_0x149c28[_0x65f6('0x3e')]['id']}})['then'](handleEntityNotFound(_0x41690c,null))[_0x65f6('0x1c')](saveUpdates(_0x149c28[_0x65f6('0x42')],null))['then'](respondWithResult(_0x41690c,null))[_0x65f6('0x3c')](handleError(_0x41690c,null));};exports[_0x65f6('0x1b')]=function(_0x57eb04,_0x309ec6){return db['VoiceTransferReport'][_0x65f6('0x40')]({'where':{'id':_0x57eb04[_0x65f6('0x3e')]['id']}})[_0x65f6('0x1c')](handleEntityNotFound(_0x309ec6,null))['then'](removeEntity(_0x309ec6,null))[_0x65f6('0x3c')](handleError(_0x309ec6,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index f14c669..ff53188 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 _0xf0d6=['moment','bluebird','request-promise','define','lodash','api'];(function(_0x29e3b6,_0x40b0b4){var _0x55d4b0=function(_0x55c58e){while(--_0x55c58e){_0x29e3b6['push'](_0x29e3b6['shift']());}};_0x55d4b0(++_0x40b0b4);}(_0xf0d6,0x1ae));var _0x6f0d=function(_0x435125,_0x42b6b4){_0x435125=_0x435125-0x0;var _0x3f6242=_0xf0d6[_0x435125];return _0x3f6242;};'use strict';var _=require(_0x6f0d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6f0d('0x1'));var moment=require(_0x6f0d('0x2'));var BPromise=require(_0x6f0d('0x3'));var rp=require(_0x6f0d('0x4'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x5795ca,_0x5492ed){return _0x5795ca[_0x6f0d('0x5')]('VoiceTransferReport',attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b56=['VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','exports','define'];(function(_0x3bf126,_0x38c5f7){var _0x4d2ca1=function(_0x42bcc8){while(--_0x42bcc8){_0x3bf126['push'](_0x3bf126['shift']());}};_0x4d2ca1(++_0x38c5f7);}(_0x6b56,0xd1));var _0x66b5=function(_0x1465e2,_0x7e5150){_0x1465e2=_0x1465e2-0x0;var _0x38f758=_0x6b56[_0x1465e2];return _0x38f758;};'use strict';var _=require(_0x66b5('0x0'));var util=require(_0x66b5('0x1'));var logger=require(_0x66b5('0x2'))(_0x66b5('0x3'));var moment=require(_0x66b5('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./voiceTransferReport.attributes');module[_0x66b5('0x5')]=function(_0x853156,_0x3b750d){return _0x853156[_0x66b5('0x6')](_0x66b5('0x7'),attributes,{'tableName':_0x66b5('0x8'),'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 17f7db4..953a90e 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 _0xa5a8=['ioredis','../../mysqldb','rpc','jayson/promise','client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceTransferReport','create','raw','lodash','util','moment','randomstring'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xa5a8,0xec));var _0x8a5a=function(_0x354849,_0x54ceae){_0x354849=_0x354849-0x0;var _0x4eba23=_0xa5a8[_0x354849];return _0x4eba23;};'use strict';var _=require(_0x8a5a('0x0'));var util=require(_0x8a5a('0x1'));var moment=require(_0x8a5a('0x2'));var BPromise=require('bluebird');var rs=require(_0x8a5a('0x3'));var fs=require('fs');var Redis=require(_0x8a5a('0x4'));var db=require(_0x8a5a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8a5a('0x6'));var config=require('../../config/environment');var jayson=require(_0x8a5a('0x7'));var client=jayson[_0x8a5a('0x8')][_0x8a5a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a393e,_0x1bf8b4,_0x2443c5){return new BPromise(function(_0x1508d7,_0x37e8f4){return client['request'](_0x1a393e,_0x2443c5)[_0x8a5a('0xa')](function(_0x71cbab){logger[_0x8a5a('0xb')](_0x8a5a('0xc'),_0x1bf8b4,_0x8a5a('0xd'));logger[_0x8a5a('0xe')](_0x8a5a('0xf'),_0x1bf8b4,_0x8a5a('0xd'),JSON[_0x8a5a('0x10')](_0x71cbab));if(_0x71cbab[_0x8a5a('0x11')]){if(_0x71cbab[_0x8a5a('0x11')]['code']===0x1f4){logger[_0x8a5a('0x11')](_0x8a5a('0xc'),_0x1bf8b4,_0x71cbab[_0x8a5a('0x11')][_0x8a5a('0x12')]);return _0x37e8f4(_0x71cbab['error']['message']);}logger['error'](_0x8a5a('0xc'),_0x1bf8b4,_0x71cbab[_0x8a5a('0x11')][_0x8a5a('0x12')]);return _0x1508d7(_0x71cbab['error'][_0x8a5a('0x12')]);}else{logger[_0x8a5a('0xb')](_0x8a5a('0xc'),_0x1bf8b4,'request\x20sent');_0x1508d7(_0x71cbab[_0x8a5a('0x13')]['message']);}})[_0x8a5a('0x14')](function(_0x3134dc){logger['error'](_0x8a5a('0xc'),_0x1bf8b4,_0x3134dc);_0x37e8f4(_0x3134dc);});});}exports[_0x8a5a('0x15')]=function(_0x5f5d0d){var _0x5e07f9=this;return new Promise(function(_0x1d3d1e,_0x11e04c){return db['VoiceTransferReport'][_0x8a5a('0x16')](_0x5f5d0d['body'],{'raw':_0x5f5d0d['options']?_0x5f5d0d['options'][_0x8a5a('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0xf84c21){logger['info'](_0x8a5a('0x15'),_0x5f5d0d);logger[_0x8a5a('0xe')]('CreateVoiceTransferReport',_0x5f5d0d,JSON[_0x8a5a('0x10')](_0xf84c21));_0x1d3d1e(_0xf84c21);})[_0x8a5a('0x14')](function(_0x47d302){logger['error']('CreateVoiceTransferReport',_0x47d302[_0x8a5a('0x12')],_0x5f5d0d);_0x11e04c(_0x5e07f9[_0x8a5a('0x11')](0x1f4,_0x47d302[_0x8a5a('0x12')]));});});}; \ No newline at end of file +var _0x5de9=['message','CreateVoiceTransferReport','create','raw','stringify','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x5de9,0x126));var _0x95de=function(_0x706091,_0x5e07d9){_0x706091=_0x706091-0x0;var _0x4aee6f=_0x5de9[_0x706091];return _0x4aee6f;};'use strict';var _=require(_0x95de('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x95de('0x1'));var rs=require(_0x95de('0x2'));var fs=require('fs');var Redis=require(_0x95de('0x3'));var db=require(_0x95de('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x95de('0x5'));var config=require(_0x95de('0x6'));var jayson=require(_0x95de('0x7'));var client=jayson[_0x95de('0x8')][_0x95de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3656d0,_0x484753,_0x17a0d9){return new BPromise(function(_0x4b7a94,_0x3dfd72){return client[_0x95de('0xa')](_0x3656d0,_0x17a0d9)[_0x95de('0xb')](function(_0x43df48){logger[_0x95de('0xc')](_0x95de('0xd'),_0x484753,_0x95de('0xe'));logger['debug'](_0x95de('0xf'),_0x484753,_0x95de('0xe'),JSON['stringify'](_0x43df48));if(_0x43df48['error']){if(_0x43df48[_0x95de('0x10')][_0x95de('0x11')]===0x1f4){logger[_0x95de('0x10')](_0x95de('0xd'),_0x484753,_0x43df48[_0x95de('0x10')]['message']);return _0x3dfd72(_0x43df48[_0x95de('0x10')]['message']);}logger[_0x95de('0x10')](_0x95de('0xd'),_0x484753,_0x43df48[_0x95de('0x10')][_0x95de('0x12')]);return _0x4b7a94(_0x43df48['error'][_0x95de('0x12')]);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x484753,_0x95de('0xe'));_0x4b7a94(_0x43df48['result']['message']);}})['catch'](function(_0x4dcf96){logger[_0x95de('0x10')](_0x95de('0xd'),_0x484753,_0x4dcf96);_0x3dfd72(_0x4dcf96);});});}exports[_0x95de('0x13')]=function(_0x48f7d5){var _0x2fe446=this;return new Promise(function(_0x5c9a2e,_0x2989e4){return db['VoiceTransferReport'][_0x95de('0x14')](_0x48f7d5['body'],{'raw':_0x48f7d5['options']?_0x48f7d5['options'][_0x95de('0x15')]===undefined?!![]:![]:!![]})[_0x95de('0xb')](function(_0x3e1a00){logger[_0x95de('0xc')](_0x95de('0x13'),_0x48f7d5);logger['debug'](_0x95de('0x13'),_0x48f7d5,JSON[_0x95de('0x16')](_0x3e1a00));_0x5c9a2e(_0x3e1a00);})[_0x95de('0x17')](function(_0x105915){logger['error'](_0x95de('0x13'),_0x105915['message'],_0x48f7d5);_0x2989e4(_0x2fe446[_0x95de('0x10')](0x1f4,_0x105915[_0x95de('0x12')]));});});}; \ No newline at end of file diff --git a/server/app.js b/server/app.js index 86cfd8e..37d2961 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d5c=['./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat','sequelize','sync','listen','start','info','then','map','filter','online','name','join','Offline\x20apps:','status','None','seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9d5c,0xfa));var _0xc9d5=function(_0x2a5398,_0x2fd756){_0x2a5398=_0x2a5398-0x0;var _0x36d991=_0x9d5c[_0x2a5398];return _0x36d991;};'use strict';var _=require('lodash');var mysqldb=require(_0xc9d5('0x0'));var rpc=require('./rpc');var config=require(_0xc9d5('0x1'));var logger=require(_0xc9d5('0x2'))(_0xc9d5('0x3'));var pm2=require('./config/pm2');var pm2Config=require(_0xc9d5('0x4'));var schedule=require(_0xc9d5('0x5'));var chat=require(_0xc9d5('0x6'));function main(){return mysqldb['db'][_0xc9d5('0x7')][_0xc9d5('0x8')]()['then'](function(){return rpc[_0xc9d5('0x9')]();})['then'](function(_0x3042f3){logger['info'](_0x3042f3);return chat['start']();})['then'](function(){return schedule[_0xc9d5('0xa')]();})['then'](function(_0x52abb9){logger[_0xc9d5('0xb')](_0x52abb9);return pm2[_0xc9d5('0xa')](pm2Config);})[_0xc9d5('0xc')](function(_0x34d13f){logger['info']('Online\x20apps:',_[_0xc9d5('0xd')](_[_0xc9d5('0xe')](_0x34d13f,{'status':_0xc9d5('0xf')}),_0xc9d5('0x10'))[_0xc9d5('0x11')]());logger[_0xc9d5('0xb')](_0xc9d5('0x12'),_[_0xc9d5('0xd')](_[_0xc9d5('0xe')](_0x34d13f,function(_0x53362f){return _0x53362f[_0xc9d5('0x13')]!==_0xc9d5('0xf');}),'name')[_0xc9d5('0x11')]()||_0xc9d5('0x14'));config[_0xc9d5('0x15')]&&require('./config/seedDB')[_0xc9d5('0x16')]();require(_0xc9d5('0x17'))[_0xc9d5('0x16')]();})[_0xc9d5('0x18')](function(_0x11ae64){logger[_0xc9d5('0x19')](_0xc9d5('0x1a'),_0x11ae64);process[_0xc9d5('0x1b')](0x1);});}main(); \ No newline at end of file +var _0x449a=['seedDB','default','./config/license','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','sequelize','listen','start','then','info','Online\x20apps:','map','filter','online','join','Offline\x20apps:','status','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x449a,0xa8));var _0xa449=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x449a[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0xa449('0x0'));var mysqldb=require(_0xa449('0x1'));var rpc=require(_0xa449('0x2'));var config=require('./config/environment');var logger=require(_0xa449('0x3'))('app');var pm2=require(_0xa449('0x4'));var pm2Config=require(_0xa449('0x5'));var schedule=require(_0xa449('0x6'));var chat=require(_0xa449('0x7'));function main(){return mysqldb['db'][_0xa449('0x8')]['sync']()['then'](function(){return rpc[_0xa449('0x9')]();})['then'](function(_0x61bca){logger['info'](_0x61bca);return chat['start']();})['then'](function(){return schedule[_0xa449('0xa')]();})[_0xa449('0xb')](function(_0x4ba76c){logger[_0xa449('0xc')](_0x4ba76c);return pm2[_0xa449('0xa')](pm2Config);})[_0xa449('0xb')](function(_0x196a79){logger[_0xa449('0xc')](_0xa449('0xd'),_[_0xa449('0xe')](_[_0xa449('0xf')](_0x196a79,{'status':_0xa449('0x10')}),'name')[_0xa449('0x11')]());logger[_0xa449('0xc')](_0xa449('0x12'),_['map'](_['filter'](_0x196a79,function(_0x280dff){return _0x280dff[_0xa449('0x13')]!==_0xa449('0x10');}),_0xa449('0x14'))[_0xa449('0x11')]()||'None');config[_0xa449('0x15')]&&require('./config/seedDB')[_0xa449('0x16')]();require(_0xa449('0x17'))[_0xa449('0x16')]();})[_0xa449('0x18')](function(_0x307363){logger['error'](_0xa449('0x19'),_0x307363);process[_0xa449('0x1a')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index e499311..9c39a4f 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 _0x621e=['faxPause','smsPause','openchannelPause','pauseType','showWebBar','phoneBarRemoteControl','use','ChatInteraction','findOne','params','closed','disposition','then','unmanaged','json','Unmanaged.','catch','headers','startsWith','find','pass','status','Wrong\x20credentials.','authorization','Bearer','Unknown\x20authorization\x20format.','user','User\x20object\x20not\x20found.','isAuthenticated','getLicense','sign','signToken','hasRole','Required\x20role\x20needs\x20to\x20be\x20set','userRoles','indexOf','Forbidden','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','motion.user','stringify','redirect','/dashboards/general','../../mysqldb','jsonwebtoken','basic-auth','ipaddr.js','role','fullname','name','internal','email','permissions','voicePause','chatPause','mailPause'];(function(_0x3f39cf,_0x5dc177){var _0x1176cb=function(_0x49fea4){while(--_0x49fea4){_0x3f39cf['push'](_0x3f39cf['shift']());}};_0x1176cb(++_0x5dc177);}(_0x621e,0xdb));var _0xe621=function(_0x339763,_0x2cf1c){_0x339763=_0x339763-0x0;var _0x58be9b=_0x621e[_0x339763];return _0x58be9b;};'use strict';var db=require(_0xe621('0x0'))['db'];var config=require('../../config/environment');var _=require('lodash');var jwt=require(_0xe621('0x1'));var expressJwt=require('express-jwt');var compose=require('composable-middleware');var basicAuth=require(_0xe621('0x2'));var ipaddr=require(_0xe621('0x3'));var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id',_0xe621('0x4'),_0xe621('0x5'),_0xe621('0x6'),_0xe621('0x7'),_0xe621('0x8'),'userpic',_0xe621('0x9'),_0xe621('0xa'),_0xe621('0xb'),_0xe621('0xc'),_0xe621('0xd'),_0xe621('0xe'),_0xe621('0xf'),_0xe621('0x10'),_0xe621('0x11'),'phoneBarRemoteControlPort',_0xe621('0x12'),'interface'];exports['isChatInteractionAuthorized']=function(){return isAuthenticated(!![])[_0xe621('0x13')](function(_0x1d1a46,_0x66689b,_0x392467){if(_0x1d1a46['user']){_0x392467();}else{return db[_0xe621('0x14')][_0xe621('0x15')]({'where':{'id':_0x1d1a46[_0xe621('0x16')]['id']},'attributes':['id',_0xe621('0x17'),_0xe621('0x18')],'raw':!![]})[_0xe621('0x19')](function(_0x3a22f1){if(_0x3a22f1&&_0x3a22f1[_0xe621('0x17')]){return _0x66689b['status'](_0x3a22f1[_0xe621('0x18')]===_0xe621('0x1a')?0x195:0x193)[_0xe621('0x1b')]({'message':_0x3a22f1[_0xe621('0x18')]===_0xe621('0x1a')?_0xe621('0x1c'):'Forbidden.'});}else{_0x392467();}})[_0xe621('0x1d')](function(_0x5e36f4){_0x392467(_0x5e36f4);});}});};function isAuthenticated(_0x33269a){return compose()[_0xe621('0x13')](function(_0x14bc9c,_0x5a8f97,_0x1f5f5e){if(_0x14bc9c[_0xe621('0x1e')]['authorization']){if(_[_0xe621('0x1f')](_0x14bc9c[_0xe621('0x1e')]['authorization'],'Basic')){var _0x39cb1e=basicAuth(_0x14bc9c);db['User'][_0xe621('0x20')]({'where':{'name':_0x39cb1e[_0xe621('0x6')]}})['then'](function(_0x16ceab){if(!_0x16ceab||!_0x16ceab['authenticate'](_0x39cb1e[_0xe621('0x21')])){return _0x5a8f97[_0xe621('0x22')](0x191)['json']({'message':_0xe621('0x23')});}_0x14bc9c['user']={'id':_0x16ceab['id']};_0x1f5f5e();})['catch'](function(_0x5c4995){_0x1f5f5e(_0x5c4995);});}else if(_[_0xe621('0x1f')](_0x14bc9c[_0xe621('0x1e')][_0xe621('0x24')],_0xe621('0x25'))){validateJwt(_0x14bc9c,_0x5a8f97,_0x1f5f5e);}}else{if(_0x33269a){_0x1f5f5e();}else{return _0x5a8f97['status'](0x191)['json']({'message':_0xe621('0x26')});}}})[_0xe621('0x13')](function(_0x250d40,_0x9a3c88,_0x191c8f){if(_0x250d40[_0xe621('0x27')]){db['User'][_0xe621('0x20')]({'where':{'id':_0x250d40['user']['id']},'attributes':userAttributes})[_0xe621('0x19')](function(_0x258c4f){if(!_0x258c4f){return _0x9a3c88[_0xe621('0x22')](0x194)[_0xe621('0x1b')]({'message':'User\x20not\x20found.'});}_0x250d40['user']=_0x258c4f;_0x191c8f();})[_0xe621('0x1d')](function(_0x286f99){_0x191c8f(_0x286f99);});}else if(_0x33269a){_0x191c8f();}else{return _0x9a3c88['status'](0x194)[_0xe621('0x1b')]({'message':_0xe621('0x28')});}});}exports[_0xe621('0x29')]=isAuthenticated;function canUpdate(){return compose()[_0xe621('0x13')](function(_0xeaae6f,_0x56d8cc,_0x5154af){return require('../../config/license/util')[_0xe621('0x2a')]()['then'](function(_0x13665b){if(_0x13665b['update']){_0x5154af();}else{return _0x56d8cc[_0xe621('0x22')](0x193)[_0xe621('0x1b')]({'message':'Forbidden'});}})[_0xe621('0x1d')](function(_0x31da7b){_0x5154af(_0x31da7b);});});}exports['canUpdate']=canUpdate;function signToken(_0x4f338d,_0x4827a9){return jwt[_0xe621('0x2b')]({'id':_0x4f338d,'role':_0x4827a9},config['secrets']['session'],{'expiresIn':0x15180});}exports[_0xe621('0x2c')]=signToken;exports[_0xe621('0x2d')]=function(_0x126465){if(!_0x126465){throw new Error(_0xe621('0x2e'));}return compose()[_0xe621('0x13')](isAuthenticated())[_0xe621('0x13')](function meetsRequirements(_0xfb75c,_0x1fc84c,_0x9694df){if(config[_0xe621('0x2f')]['indexOf'](_0xfb75c['user']['role'])>=config[_0xe621('0x2f')][_0xe621('0x30')](_0x126465)){return _0x9694df();}else{return _0x1fc84c[_0xe621('0x22')](0x193)[_0xe621('0x1b')]({'message':_0xe621('0x31')});}});};exports[_0xe621('0x32')]=function(_0x243ff2,_0x55f8bd){if(!_0x243ff2[_0xe621('0x27')]){return _0x55f8bd[_0xe621('0x22')](0x194)[_0xe621('0x1b')]({'message':_0xe621('0x33')});}var _0x1991db=signToken(_0x243ff2['user']['id'],_0x243ff2[_0xe621('0x27')]['role']);_0x55f8bd[_0xe621('0x34')](_0xe621('0x35'),_0x1991db);_0x55f8bd[_0xe621('0x34')](_0xe621('0x36'),JSON[_0xe621('0x37')](_['pick'](_0x243ff2['user'],userAttributes)));_0x55f8bd[_0xe621('0x38')](_0xe621('0x39'));}; \ No newline at end of file +var _0x0b6a=['User','User\x20not\x20found.','User\x20object\x20not\x20found.','../../config/license/util','getLicense','update','Forbidden','sign','signToken','hasRole','Required\x20role\x20needs\x20to\x20be\x20set','userRoles','indexOf','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','stringify','pick','redirect','../../mysqldb','../../config/environment','lodash','jsonwebtoken','express-jwt','composable-middleware','ipaddr.js','secrets','session','role','fullname','name','internal','userpic','permissions','voicePause','chatPause','mailPause','openchannelPause','showWebBar','phoneBarRemoteControl','interface','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','catch','headers','authorization','Basic','find','Wrong\x20credentials.','startsWith','Bearer'];(function(_0x31f36a,_0x2e294e){var _0x566934=function(_0xbab1d3){while(--_0xbab1d3){_0x31f36a['push'](_0x31f36a['shift']());}};_0x566934(++_0x2e294e);}(_0x0b6a,0x107));var _0xa0b6=function(_0x35e80a,_0x20f4f0){_0x35e80a=_0x35e80a-0x0;var _0x2a8b03=_0x0b6a[_0x35e80a];return _0x2a8b03;};'use strict';var db=require(_0xa0b6('0x0'))['db'];var config=require(_0xa0b6('0x1'));var _=require(_0xa0b6('0x2'));var jwt=require(_0xa0b6('0x3'));var expressJwt=require(_0xa0b6('0x4'));var compose=require(_0xa0b6('0x5'));var basicAuth=require('basic-auth');var ipaddr=require(_0xa0b6('0x6'));var validateJwt=expressJwt({'secret':config[_0xa0b6('0x7')][_0xa0b6('0x8')]});var userAttributes=['id',_0xa0b6('0x9'),_0xa0b6('0xa'),_0xa0b6('0xb'),_0xa0b6('0xc'),'email',_0xa0b6('0xd'),_0xa0b6('0xe'),_0xa0b6('0xf'),_0xa0b6('0x10'),_0xa0b6('0x11'),'faxPause','smsPause',_0xa0b6('0x12'),'pauseType',_0xa0b6('0x13'),'phoneBarRemoteControlPort',_0xa0b6('0x14'),_0xa0b6('0x15')];exports[_0xa0b6('0x16')]=function(){return isAuthenticated(!![])[_0xa0b6('0x17')](function(_0x3174fa,_0xecf73b,_0x5269a4){if(_0x3174fa[_0xa0b6('0x18')]){_0x5269a4();}else{return db[_0xa0b6('0x19')][_0xa0b6('0x1a')]({'where':{'id':_0x3174fa[_0xa0b6('0x1b')]['id']},'attributes':['id',_0xa0b6('0x1c'),_0xa0b6('0x1d')],'raw':!![]})[_0xa0b6('0x1e')](function(_0x1559d5){if(_0x1559d5&&_0x1559d5[_0xa0b6('0x1c')]){return _0xecf73b[_0xa0b6('0x1f')](_0x1559d5['disposition']===_0xa0b6('0x20')?0x195:0x193)[_0xa0b6('0x21')]({'message':_0x1559d5[_0xa0b6('0x1d')]===_0xa0b6('0x20')?'Unmanaged.':'Forbidden.'});}else{_0x5269a4();}})[_0xa0b6('0x22')](function(_0x5454e5){_0x5269a4(_0x5454e5);});}});};function isAuthenticated(_0x3f291f){return compose()['use'](function(_0x3a183d,_0x130d33,_0x5e4085){if(_0x3a183d[_0xa0b6('0x23')][_0xa0b6('0x24')]){if(_['startsWith'](_0x3a183d['headers'][_0xa0b6('0x24')],_0xa0b6('0x25'))){var _0xb6799=basicAuth(_0x3a183d);db['User'][_0xa0b6('0x26')]({'where':{'name':_0xb6799['name']}})['then'](function(_0x29ff17){if(!_0x29ff17||!_0x29ff17['authenticate'](_0xb6799['pass'])){return _0x130d33[_0xa0b6('0x1f')](0x191)[_0xa0b6('0x21')]({'message':_0xa0b6('0x27')});}_0x3a183d[_0xa0b6('0x18')]={'id':_0x29ff17['id']};_0x5e4085();})['catch'](function(_0xaa53b4){_0x5e4085(_0xaa53b4);});}else if(_[_0xa0b6('0x28')](_0x3a183d[_0xa0b6('0x23')][_0xa0b6('0x24')],_0xa0b6('0x29'))){validateJwt(_0x3a183d,_0x130d33,_0x5e4085);}}else{if(_0x3f291f){_0x5e4085();}else{return _0x130d33['status'](0x191)['json']({'message':'Unknown\x20authorization\x20format.'});}}})['use'](function(_0x4d8464,_0x396ada,_0x2e35e8){if(_0x4d8464[_0xa0b6('0x18')]){db[_0xa0b6('0x2a')][_0xa0b6('0x26')]({'where':{'id':_0x4d8464[_0xa0b6('0x18')]['id']},'attributes':userAttributes})[_0xa0b6('0x1e')](function(_0x1c8fd2){if(!_0x1c8fd2){return _0x396ada[_0xa0b6('0x1f')](0x194)['json']({'message':_0xa0b6('0x2b')});}_0x4d8464[_0xa0b6('0x18')]=_0x1c8fd2;_0x2e35e8();})['catch'](function(_0x2f47e0){_0x2e35e8(_0x2f47e0);});}else if(_0x3f291f){_0x2e35e8();}else{return _0x396ada['status'](0x194)[_0xa0b6('0x21')]({'message':_0xa0b6('0x2c')});}});}exports['isAuthenticated']=isAuthenticated;function canUpdate(){return compose()[_0xa0b6('0x17')](function(_0x38386f,_0x2b14c7,_0x1cb29d){return require(_0xa0b6('0x2d'))[_0xa0b6('0x2e')]()[_0xa0b6('0x1e')](function(_0x28ec92){if(_0x28ec92[_0xa0b6('0x2f')]){_0x1cb29d();}else{return _0x2b14c7[_0xa0b6('0x1f')](0x193)[_0xa0b6('0x21')]({'message':_0xa0b6('0x30')});}})[_0xa0b6('0x22')](function(_0x1d5f35){_0x1cb29d(_0x1d5f35);});});}exports['canUpdate']=canUpdate;function signToken(_0x28a53a,_0x3864e0){return jwt[_0xa0b6('0x31')]({'id':_0x28a53a,'role':_0x3864e0},config[_0xa0b6('0x7')]['session'],{'expiresIn':0x15180});}exports[_0xa0b6('0x32')]=signToken;exports[_0xa0b6('0x33')]=function(_0x483490){if(!_0x483490){throw new Error(_0xa0b6('0x34'));}return compose()[_0xa0b6('0x17')](isAuthenticated())[_0xa0b6('0x17')](function meetsRequirements(_0x4cd6cc,_0x23ba39,_0x4007a7){if(config[_0xa0b6('0x35')][_0xa0b6('0x36')](_0x4cd6cc[_0xa0b6('0x18')]['role'])>=config[_0xa0b6('0x35')][_0xa0b6('0x36')](_0x483490)){return _0x4007a7();}else{return _0x23ba39[_0xa0b6('0x1f')](0x193)[_0xa0b6('0x21')]({'message':_0xa0b6('0x30')});}});};exports['setTokenCookie']=function(_0xf27d81,_0x379fbf){if(!_0xf27d81[_0xa0b6('0x18')]){return _0x379fbf[_0xa0b6('0x1f')](0x194)[_0xa0b6('0x21')]({'message':_0xa0b6('0x37')});}var _0x17b857=signToken(_0xf27d81[_0xa0b6('0x18')]['id'],_0xf27d81[_0xa0b6('0x18')][_0xa0b6('0x9')]);_0x379fbf[_0xa0b6('0x38')](_0xa0b6('0x39'),_0x17b857);_0x379fbf[_0xa0b6('0x38')]('motion.user',JSON[_0xa0b6('0x3a')](_[_0xa0b6('0x3b')](_0xf27d81[_0xa0b6('0x18')],userAttributes)));_0x379fbf[_0xa0b6('0x3c')]('/dashboards/general');}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index f421ca5..4b4b103 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 _0x1071=['aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','data','update','end','final','binary','write','close','unlink','decryptFile','crypto','bluebird'];(function(_0x1da289,_0x417651){var _0x41c889=function(_0x2cea8c){while(--_0x2cea8c){_0x1da289['push'](_0x1da289['shift']());}};_0x41c889(++_0x417651);}(_0x1071,0x7c));var _0x1107=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1071[_0x19e35c];return _0x3e1fe8;};'use strict';var crypto=require(_0x1107('0x0'));var fs=require('fs');var BPromise=require(_0x1107('0x1'));var defaultOptions={'algorithm':_0x1107('0x2')};function combineOptions(_0x2dc7a2){var _0x33d468={};for(var _0x3140b7 in defaultOptions){if(defaultOptions[_0x1107('0x3')](_0x3140b7)){_0x33d468[_0x3140b7]=defaultOptions[_0x3140b7];}}if(_0x2dc7a2){for(var _0x9bee36 in _0x2dc7a2){if(_0x2dc7a2[_0x1107('0x3')](_0x9bee36)){_0x33d468[_0x9bee36]=_0x2dc7a2[_0x9bee36];}}}return _0x33d468;}exports[_0x1107('0x4')]=function(_0x1c0bec,_0x2db6e0,_0x48f819,_0x2e68fa){return new BPromise(function(_0x16cf42,_0x454e9c){_0x2e68fa=combineOptions(_0x2e68fa);var _0x1f7d12=new Buffer(_0x48f819);var _0x621f94=fs[_0x1107('0x5')](_0x1c0bec);var _0x4461ab=fs[_0x1107('0x6')](_0x2db6e0);var _0x28fa82=crypto[_0x1107('0x7')](_0x2e68fa[_0x1107('0x8')],_0x1f7d12);_0x621f94['on'](_0x1107('0x9'),function(_0x24d0af){var _0x3a142a=new Buffer(_0x28fa82[_0x1107('0xa')](_0x24d0af),'binary');_0x4461ab['write'](_0x3a142a);});_0x621f94['on'](_0x1107('0xb'),function(){try{var _0x244648=new Buffer(_0x28fa82[_0x1107('0xc')](_0x1107('0xd')),_0x1107('0xd'));_0x4461ab[_0x1107('0xe')](_0x244648);_0x4461ab[_0x1107('0xb')]();_0x4461ab['on'](_0x1107('0xf'),function(){return _0x16cf42(_0x2db6e0);});}catch(_0xff4ff0){fs[_0x1107('0x10')](_0x2db6e0);return _0x454e9c(_0xff4ff0);}});});};exports[_0x1107('0x11')]=function(_0x159a71,_0x261e40,_0x541a78,_0x39f029){return new BPromise(function(_0x5e63fc,_0x415674){_0x39f029=combineOptions(_0x39f029);var _0x5416ce=new Buffer(_0x541a78);var _0x1dfbed=fs[_0x1107('0x5')](_0x159a71);var _0xc421a=fs['createWriteStream'](_0x261e40);var _0x2fd6c7=crypto['createDecipher'](_0x39f029[_0x1107('0x8')],_0x5416ce);_0x1dfbed['on']('data',function(_0x4a6817){var _0x33ace1=new Buffer(_0x2fd6c7[_0x1107('0xa')](_0x4a6817),_0x1107('0xd'));_0xc421a[_0x1107('0xe')](_0x33ace1);});_0x1dfbed['on'](_0x1107('0xb'),function(){try{var _0x419df2=new Buffer(_0x2fd6c7[_0x1107('0xc')](_0x1107('0xd')),_0x1107('0xd'));_0xc421a[_0x1107('0xe')](_0x419df2);_0xc421a[_0x1107('0xb')]();_0xc421a['on'](_0x1107('0xf'),function(){return _0x5e63fc(_0x261e40);});}catch(_0x23951a){fs[_0x1107('0x10')](_0x261e40);return _0x415674(_0x23951a);}});});}; \ No newline at end of file +var _0x276c=['algorithm','crypto','bluebird','aes192','hasOwnProperty','encryptFile','createReadStream','createCipher','data','update','binary','write','final','end','close','unlink','decryptFile','createWriteStream','createDecipher'];(function(_0x21abfb,_0x419da4){var _0x298e7c=function(_0xebd71e){while(--_0xebd71e){_0x21abfb['push'](_0x21abfb['shift']());}};_0x298e7c(++_0x419da4);}(_0x276c,0xe5));var _0xc276=function(_0x33ceaa,_0x16fbda){_0x33ceaa=_0x33ceaa-0x0;var _0x24a541=_0x276c[_0x33ceaa];return _0x24a541;};'use strict';var crypto=require(_0xc276('0x0'));var fs=require('fs');var BPromise=require(_0xc276('0x1'));var defaultOptions={'algorithm':_0xc276('0x2')};function combineOptions(_0x54149b){var _0x4e7e9d={};for(var _0x21c279 in defaultOptions){if(defaultOptions[_0xc276('0x3')](_0x21c279)){_0x4e7e9d[_0x21c279]=defaultOptions[_0x21c279];}}if(_0x54149b){for(var _0x46da9c in _0x54149b){if(_0x54149b['hasOwnProperty'](_0x46da9c)){_0x4e7e9d[_0x46da9c]=_0x54149b[_0x46da9c];}}}return _0x4e7e9d;}exports[_0xc276('0x4')]=function(_0x52525a,_0x18cf14,_0x1dd4a4,_0x46115a){return new BPromise(function(_0x4c9b82,_0x1a4f49){_0x46115a=combineOptions(_0x46115a);var _0xf5878=new Buffer(_0x1dd4a4);var _0xbaa44a=fs[_0xc276('0x5')](_0x52525a);var _0x1ea285=fs['createWriteStream'](_0x18cf14);var _0xa60674=crypto[_0xc276('0x6')](_0x46115a['algorithm'],_0xf5878);_0xbaa44a['on'](_0xc276('0x7'),function(_0x1b9205){var _0xf1b48e=new Buffer(_0xa60674[_0xc276('0x8')](_0x1b9205),_0xc276('0x9'));_0x1ea285[_0xc276('0xa')](_0xf1b48e);});_0xbaa44a['on']('end',function(){try{var _0x3e4fb9=new Buffer(_0xa60674[_0xc276('0xb')](_0xc276('0x9')),_0xc276('0x9'));_0x1ea285[_0xc276('0xa')](_0x3e4fb9);_0x1ea285[_0xc276('0xc')]();_0x1ea285['on'](_0xc276('0xd'),function(){return _0x4c9b82(_0x18cf14);});}catch(_0x4e354d){fs[_0xc276('0xe')](_0x18cf14);return _0x1a4f49(_0x4e354d);}});});};exports[_0xc276('0xf')]=function(_0xf9ae4f,_0x2c261c,_0x53f841,_0x5a0e43){return new BPromise(function(_0x19c56d,_0x9d02fb){_0x5a0e43=combineOptions(_0x5a0e43);var _0x377beb=new Buffer(_0x53f841);var _0xf4aed8=fs[_0xc276('0x5')](_0xf9ae4f);var _0x2739ad=fs[_0xc276('0x10')](_0x2c261c);var _0xaf5c68=crypto[_0xc276('0x11')](_0x5a0e43[_0xc276('0x12')],_0x377beb);_0xf4aed8['on']('data',function(_0x42a71a){var _0x53f1b1=new Buffer(_0xaf5c68['update'](_0x42a71a),_0xc276('0x9'));_0x2739ad['write'](_0x53f1b1);});_0xf4aed8['on'](_0xc276('0xc'),function(){try{var _0x134855=new Buffer(_0xaf5c68[_0xc276('0xb')](_0xc276('0x9')),'binary');_0x2739ad[_0xc276('0xa')](_0x134855);_0x2739ad[_0xc276('0xc')]();_0x2739ad['on'](_0xc276('0xd'),function(){return _0x19c56d(_0x2c261c);});}catch(_0x49ea75){fs['unlink'](_0x2c261c);return _0x9d02fb(_0x49ea75);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 7742c22..9d8dec1 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 _0x91e5=['info','format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.csv','join','mkdirSync','each','csv','%s.%s','writeFileSync','zip','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','analytics','argv','savename','AnalyticExtractedReport','update'];(function(_0x31ef02,_0x517141){var _0x309387=function(_0x567796){while(--_0x567796){_0x31ef02['push'](_0x31ef02['shift']());}};_0x309387(++_0x517141);}(_0x91e5,0x1ce));var _0x591e=function(_0x47378d,_0x5ef2c3){_0x47378d=_0x47378d-0x0;var _0x552647=_0x91e5[_0x47378d];return _0x552647;};'use strict';var util=require('util');var path=require('path');var _=require(_0x591e('0x0'));var csv=require(_0x591e('0x1'));var fs=require('fs');var BPromise=require(_0x591e('0x2'));var zipdir=require(_0x591e('0x3'));var rimraf=require(_0x591e('0x4'));var db=require(_0x591e('0x5'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require('../../config/logger')(_0x591e('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x591e('0x7')][0x2]);var QUERY=process[_0x591e('0x7')][0x3];var PATH=process[_0x591e('0x7')][0x4];function analyticExtractedReport(_0x300218,_0x1118d6){var _0x2f30c1={'status':_0x300218};var _0x3440a2={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1118d6){_0x2f30c1[_0x591e('0x8')]=_0x1118d6;}return db[_0x591e('0x9')][_0x591e('0xa')](_0x2f30c1,_0x3440a2);}function main(){var _0x26e6ea=0x1388;var _0x196634;logger[_0x591e('0xb')](util[_0x591e('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x591e('0xd')));return db[_0x591e('0xe')][_0x591e('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x591e('0x10'),_0x591e('0x11')]})['then'](function(_0xb2c132){if(_0xb2c132){_0x196634=_0xb2c132;_0x26e6ea=_0x196634['splitSizeCsv']||0x1388;}})[_0x591e('0x12')](function(){return dbH[_0x591e('0x13')][_0x591e('0x14')](util[_0x591e('0xc')](_0x591e('0x15'),QUERY),{'type':dbH[_0x591e('0x13')][_0x591e('0x16')][_0x591e('0x17')]});})[_0x591e('0x12')](function(_0x4a8231){if(!_0x4a8231[0x0][_0x591e('0x18')]){return analyticExtractedReport(_0x591e('0x19'));}var _0x263167=[];var _0x1e082a=0x0;var _0x23ee12=!![];if(_0x4a8231&&_0x4a8231[_0x591e('0x1a')]){var _0x46e4c6=_0x4a8231[0x0][_0x591e('0x18')]%(_0x1e082a+_0x26e6ea);if(_0x196634[_0x591e('0x10')]){for(;_0x23ee12;_0x1e082a+=_0x26e6ea,_0x46e4c6=_0x4a8231[0x0][_0x591e('0x18')]%(_0x1e082a+_0x26e6ea)){if(_0x46e4c6==0x0||_0x46e4c6==_0x4a8231[0x0][_0x591e('0x18')]){_0x23ee12=![];}_0x263167['push'](dbH[_0x591e('0x13')][_0x591e('0x14')](util[_0x591e('0xc')](_0x591e('0x1b'),QUERY,_0x26e6ea,_0x1e082a),{'type':dbH['sequelize']['QueryTypes'][_0x591e('0x17')]}));}}else{_0x263167[_0x591e('0x1c')](dbH[_0x591e('0x13')][_0x591e('0x14')](QUERY,{'type':dbH[_0x591e('0x13')][_0x591e('0x16')][_0x591e('0x17')]}));}}var _0x5a797b=path[_0x591e('0x1d')](PATH);var _0x3dab99=path[_0x591e('0x1e')](PATH,_0x591e('0x1f'));var _0xd20866=_0x196634['split']&&_0x263167[_0x591e('0x1a')]>0x1;var _0x1e1d30=[];if(!fs['existsSync'](path[_0x591e('0x20')](_0x5a797b,_0x3dab99))&&_0xd20866){fs[_0x591e('0x21')](path[_0x591e('0x20')](_0x5a797b,_0x3dab99));}return BPromise[_0x591e('0x22')](_0x263167,function(_0x1e84f5){_0x1e1d30[_0x591e('0x1c')](_0x1e84f5);})[_0x591e('0x12')](function(){for(var _0x3f6a10=0x0;_0x3f6a10<_0x1e1d30[_0x591e('0x1a')];_0x3f6a10+=0x1){var _0x2bf87e;var _0x24310a=_0x1e1d30[_0x3f6a10];if(_0xd20866){_0x2bf87e=path[_0x591e('0x20')](_0x5a797b,_0x3dab99,util[_0x591e('0xc')]('%s%d.%s',_0x3dab99,_0x3f6a10,_0x591e('0x23')));}else{_0x2bf87e=path[_0x591e('0x20')](_0x5a797b,util[_0x591e('0xc')](_0x591e('0x24'),_0x3dab99,_0x591e('0x23')));}fs[_0x591e('0x25')](_0x2bf87e,csv(_0x24310a));}})['then'](function(){if(_0xd20866){zipdir(path[_0x591e('0x20')](_0x5a797b,_0x3dab99),{'saveTo':path[_0x591e('0x20')](_0x5a797b,util[_0x591e('0xc')]('%s.%s',_0x3dab99,_0x591e('0x26')))},function(_0x3d11d3,_0x5ca5ba){});rimraf(path['join'](_0x5a797b,_0x3dab99),function(){});}})[_0x591e('0x12')](function(){logger[_0x591e('0xb')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x591e('0xd')));return analyticExtractedReport(_0x591e('0x27'),_0xd20866?util['format'](_0x591e('0x24'),_0x3dab99,_0xd20866?_0x591e('0x26'):'csv'):null);});})[_0x591e('0x28')](function(_0x4f79a7){logger[_0x591e('0xb')](util['format'](_0x591e('0x29'),EXTRACTED_REPORT_ID,_0x591e('0xd')),util['inspect'](_0x4f79a7,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x591e('0x2a'));});}main(); \ No newline at end of file +var _0x7859=['%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.csv','join','mkdirSync','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','split','splitSizeCsv','then','sequelize','QueryTypes','Empty','length','num','push','query'];(function(_0x3b4c26,_0x2b0fff){var _0xe8e974=function(_0x457ac0){while(--_0x457ac0){_0x3b4c26['push'](_0x3b4c26['shift']());}};_0xe8e974(++_0x2b0fff);}(_0x7859,0xca));var _0x9785=function(_0x183d04,_0x2c64b5){_0x183d04=_0x183d04-0x0;var _0x47ecd0=_0x7859[_0x183d04];return _0x47ecd0;};'use strict';var util=require(_0x9785('0x0'));var path=require(_0x9785('0x1'));var _=require(_0x9785('0x2'));var csv=require(_0x9785('0x3'));var fs=require('fs');var BPromise=require(_0x9785('0x4'));var zipdir=require(_0x9785('0x5'));var rimraf=require(_0x9785('0x6'));var db=require('../../mysqldb')['db'];var dbH=require(_0x9785('0x7'))[_0x9785('0x8')];var logger=require(_0x9785('0x9'))(_0x9785('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x9785('0xb')][0x2]);var QUERY=process[_0x9785('0xb')][0x3];var PATH=process[_0x9785('0xb')][0x4];function analyticExtractedReport(_0x8d7669,_0x6d0f20){var _0x1aa9b3={'status':_0x8d7669};var _0x21cb6d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x6d0f20){_0x1aa9b3[_0x9785('0xc')]=_0x6d0f20;}return db['AnalyticExtractedReport'][_0x9785('0xd')](_0x1aa9b3,_0x21cb6d);}function main(){var _0x275fa5=0x1388;var _0x1802d6;logger[_0x9785('0xe')](util[_0x9785('0xf')](_0x9785('0x10'),EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0x9785('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9785('0x12'),_0x9785('0x13')]})[_0x9785('0x14')](function(_0x3261de){if(_0x3261de){_0x1802d6=_0x3261de;_0x275fa5=_0x1802d6[_0x9785('0x13')]||0x1388;}})['then'](function(){return dbH[_0x9785('0x15')]['query'](util[_0x9785('0xf')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x9785('0x16')]['SELECT']});})[_0x9785('0x14')](function(_0x5e69f8){if(!_0x5e69f8[0x0]['num']){return analyticExtractedReport(_0x9785('0x17'));}var _0x518da0=[];var _0x5db202=0x0;var _0x11bd59=!![];if(_0x5e69f8&&_0x5e69f8[_0x9785('0x18')]){var _0x527bfb=_0x5e69f8[0x0][_0x9785('0x19')]%(_0x5db202+_0x275fa5);if(_0x1802d6[_0x9785('0x12')]){for(;_0x11bd59;_0x5db202+=_0x275fa5,_0x527bfb=_0x5e69f8[0x0][_0x9785('0x19')]%(_0x5db202+_0x275fa5)){if(_0x527bfb==0x0||_0x527bfb==_0x5e69f8[0x0]['num']){_0x11bd59=![];}_0x518da0[_0x9785('0x1a')](dbH[_0x9785('0x15')][_0x9785('0x1b')](util[_0x9785('0xf')](_0x9785('0x1c'),QUERY,_0x275fa5,_0x5db202),{'type':dbH['sequelize']['QueryTypes'][_0x9785('0x1d')]}));}}else{_0x518da0['push'](dbH[_0x9785('0x15')][_0x9785('0x1b')](QUERY,{'type':dbH[_0x9785('0x15')][_0x9785('0x16')][_0x9785('0x1d')]}));}}var _0x391fd0=path[_0x9785('0x1e')](PATH);var _0xf08f6d=path[_0x9785('0x1f')](PATH,_0x9785('0x20'));var _0x435333=_0x1802d6[_0x9785('0x12')]&&_0x518da0[_0x9785('0x18')]>0x1;var _0x3c03a4=[];if(!fs['existsSync'](path[_0x9785('0x21')](_0x391fd0,_0xf08f6d))&&_0x435333){fs[_0x9785('0x22')](path[_0x9785('0x21')](_0x391fd0,_0xf08f6d));}return BPromise['each'](_0x518da0,function(_0xf2e929){_0x3c03a4['push'](_0xf2e929);})[_0x9785('0x14')](function(){for(var _0x47fafd=0x0;_0x47fafd<_0x3c03a4[_0x9785('0x18')];_0x47fafd+=0x1){var _0x48eb93;var _0xd19b22=_0x3c03a4[_0x47fafd];if(_0x435333){_0x48eb93=path['join'](_0x391fd0,_0xf08f6d,util[_0x9785('0xf')](_0x9785('0x23'),_0xf08f6d,_0x47fafd,_0x9785('0x24')));}else{_0x48eb93=path[_0x9785('0x21')](_0x391fd0,util[_0x9785('0xf')](_0x9785('0x25'),_0xf08f6d,_0x9785('0x24')));}fs[_0x9785('0x26')](_0x48eb93,csv(_0xd19b22));}})[_0x9785('0x14')](function(){if(_0x435333){zipdir(path[_0x9785('0x21')](_0x391fd0,_0xf08f6d),{'saveTo':path['join'](_0x391fd0,util['format'](_0x9785('0x25'),_0xf08f6d,_0x9785('0x27')))},function(_0x408ba8,_0x4a6abf){});rimraf(path['join'](_0x391fd0,_0xf08f6d),function(){});}})['then'](function(){logger[_0x9785('0xe')](util[_0x9785('0xf')](_0x9785('0x28'),EXTRACTED_REPORT_ID,_0x9785('0x29')));return analyticExtractedReport(_0x9785('0x2a'),_0x435333?util[_0x9785('0xf')](_0x9785('0x25'),_0xf08f6d,_0x435333?_0x9785('0x27'):_0x9785('0x24')):null);});})[_0x9785('0x2b')](function(_0x18a8b1){logger['info'](util['format'](_0x9785('0x2c'),EXTRACTED_REPORT_ID,_0x9785('0x29')),util['inspect'](_0x18a8b1,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x9785('0x2d'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index dc9abe9..4d0405f 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 _0x05ac=['mkdirSync','join','each','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','black','body','hasOwnProperty','toString','content','/fonts/Roboto-Regular.ttf','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','%s%d.%s','pdf','%s.%s','pipe','finish','log','err','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','AnalyticExtractedReport','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','bluebird','util','path','moment','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','tableHeader','num','Empty','dirname','basename','.pdf','then','splitSizePdf','length','push','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync'];(function(_0x3c4a57,_0x6b0248){var _0x11fe10=function(_0x5d8e2b){while(--_0x5d8e2b){_0x3c4a57['push'](_0x3c4a57['shift']());}};_0x11fe10(++_0x6b0248);}(_0x05ac,0xea));var _0xc05a=function(_0x93262e,_0x4c6ebb){_0x93262e=_0x93262e-0x0;var _0x1cbe7e=_0x05ac[_0x93262e];return _0x1cbe7e;};'use strict';var _=require(_0xc05a('0x0'));var fs=require('fs');var BPromise=require(_0xc05a('0x1'));var util=require(_0xc05a('0x2'));var path=require(_0xc05a('0x3'));var moment=require(_0xc05a('0x4'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xc05a('0x5'));var rimraf=require('rimraf');var db=require(_0xc05a('0x6'))['db'];var dbH=require(_0xc05a('0x6'))[_0xc05a('0x7')];var logger=require(_0xc05a('0x8'))(_0xc05a('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xc05a('0xa')][0x3];var PATH=process[_0xc05a('0xa')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xc05a('0xb');var _extractedReport;function analyticExtractedReport(_0x3245a6,_0x3e40ff){var _0x2a9653={'status':_0x3245a6};var _0x1088a2={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3e40ff){_0x2a9653[_0xc05a('0xc')]=_0x3e40ff;}return db['AnalyticExtractedReport'][_0xc05a('0xd')](_0x2a9653,_0x1088a2);}function getHeader(_0x4c97f4){var _0x4052c2=[];for(var _0x3335be in _0x4c97f4){if(_0x4c97f4['hasOwnProperty'](_0x3335be)){_0x4052c2['push']({'text':_0x3335be,'style':_0xc05a('0xe')});}}return _0x4052c2;}function extractReport(_0x598de3){var _0x22bdf6=0x1388;var _0x3289e2;if(!_0x598de3[0x0][_0xc05a('0xf')]){return analyticExtractedReport(_0xc05a('0x10'));}var _0x5b05d5=[];var _0x56aadd=0x0;var _0x4a73b7=!![];var _0x3a502f=path[_0xc05a('0x11')](PATH);var _0x5f0efb=path[_0xc05a('0x12')](PATH,_0xc05a('0x13'));var _0x58679f=![];var _0x31825c=[];return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizePdf']})[_0xc05a('0x14')](function(_0x349743){if(_0x349743){_0x3289e2=_0x349743;_0x22bdf6=_0x3289e2[_0xc05a('0x15')]||0x3e8;}})[_0xc05a('0x14')](function(){if(_0x598de3&&_0x598de3[_0xc05a('0x16')]){var _0x23b499=_0x598de3[0x0][_0xc05a('0xf')]%(_0x56aadd+_0x22bdf6);if(_0x3289e2['split']){for(;_0x4a73b7;_0x56aadd+=_0x22bdf6,_0x23b499=_0x598de3[0x0][_0xc05a('0xf')]%(_0x56aadd+_0x22bdf6)){if(_0x23b499==0x0||_0x23b499==_0x598de3[0x0]['num']){_0x4a73b7=![];}_0x5b05d5[_0xc05a('0x17')](dbH[_0xc05a('0x18')][_0xc05a('0x19')](util['format'](_0xc05a('0x1a'),QUERY,_0x22bdf6,_0x56aadd),{'type':dbH[_0xc05a('0x18')][_0xc05a('0x1b')][_0xc05a('0x1c')]}));}}else{_0x5b05d5[_0xc05a('0x17')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0xc05a('0x18')][_0xc05a('0x1b')][_0xc05a('0x1c')]}));}}_0x58679f=_0x3289e2['split']&&_0x5b05d5[_0xc05a('0x16')]>0x1;if(!fs[_0xc05a('0x1d')](path['join'](_0x3a502f,_0x5f0efb))&&_0x58679f){fs[_0xc05a('0x1e')](path[_0xc05a('0x1f')](_0x3a502f,_0x5f0efb));}return BPromise[_0xc05a('0x20')](_0x5b05d5,function(_0x14232b){_0x31825c[_0xc05a('0x17')](_0x14232b);});})[_0xc05a('0x14')](function(){return BPromise[_0xc05a('0x20')](_0x5b05d5,function(_0x163eec,_0x42ceec){var _0x257951;var _0x335c96=util[_0xc05a('0x21')](_0xc05a('0x22'),NAME,_extractedReport[_0xc05a('0x23')],moment(_extractedReport[_0xc05a('0x24')])[_0xc05a('0x21')](FORMAT),moment(_extractedReport[_0xc05a('0x25')])[_0xc05a('0x21')](FORMAT));var _0x3c1ca9={'pageSize':'A4','pageOrientation':'landscape','content':[{'text':_0x335c96,'style':_0xc05a('0x26')}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xc05a('0x27')}}};var _0x3a2be8={'headerRows':0x1,'body':[]};_0x3a2be8[_0xc05a('0x28')]['push'](getHeader(_0x163eec[0x0]));var _0xc5da91;for(var _0x3996a8=0x0;_0x3996a8<_0x163eec[_0xc05a('0x16')];_0x3996a8+=0x1){_0xc5da91=[];for(var _0x3fb42a in _0x163eec[_0x3996a8]){if(_0x163eec[_0x3996a8][_0xc05a('0x29')](_0x3fb42a)){_0xc5da91[_0xc05a('0x17')](_0x163eec[_0x3996a8][_0x3fb42a]?_[_0xc05a('0x2a')](_0x163eec[_0x3996a8][_0x3fb42a]):'');}}_0x3a2be8[_0xc05a('0x28')]['push'](_0xc5da91);}_0x3c1ca9[_0xc05a('0x2b')][_0xc05a('0x17')]({'table':_0x3a2be8});return new BPromise(function(_0x114310,_0x313ed2){var _0x3c3a70=new PdfPrinter({'Roboto':{'normal':__dirname+_0xc05a('0x2c'),'bold':__dirname+_0xc05a('0x2d'),'italics':__dirname+_0xc05a('0x2e'),'bolditalics':__dirname+_0xc05a('0x2f')}});var _0x35e91b=_0x3c3a70['createPdfKitDocument'](_0x3c1ca9);if(_0x58679f){_0x257951=path[_0xc05a('0x1f')](_0x3a502f,_0x5f0efb,util[_0xc05a('0x21')](_0xc05a('0x30'),_0x5f0efb,_0x42ceec,_0xc05a('0x31')));}else{_0x257951=path[_0xc05a('0x1f')](_0x3a502f,util['format'](_0xc05a('0x32'),_0x5f0efb,'pdf'));}var _0x49601f=_0x35e91b[_0xc05a('0x33')](fs['createWriteStream'](_0x257951));_0x49601f['on'](_0xc05a('0x34'),function(){_0x114310();});_0x49601f['on']('error',function(_0x53a8f7){console[_0xc05a('0x35')](_0xc05a('0x36'),_0x53a8f7);_0x313ed2(_0x53a8f7);});_0x35e91b['end']();});});})[_0xc05a('0x14')](function(){if(_0x58679f){return new BPromise(function(_0x15686f,_0x6b513){zipdir(path[_0xc05a('0x1f')](_0x3a502f,_0x5f0efb),{'saveTo':path[_0xc05a('0x1f')](_0x3a502f,util[_0xc05a('0x21')](_0xc05a('0x32'),_0x5f0efb,_0xc05a('0x37')))},function(_0x36966){if(_0x36966){_0x6b513(_0x36966);}else{_0x15686f();}});});}})[_0xc05a('0x14')](function(){if(_0x58679f){rimraf(path[_0xc05a('0x1f')](_0x3a502f,_0x5f0efb),function(){});}})[_0xc05a('0x14')](function(){logger[_0xc05a('0x38')](util[_0xc05a('0x21')](_0xc05a('0x39'),EXTRACTED_REPORT_ID,_0xc05a('0x3a')));return analyticExtractedReport('Completed',_0x58679f?util[_0xc05a('0x21')](_0xc05a('0x32'),_0x5f0efb,_0x58679f?_0xc05a('0x37'):_0xc05a('0x31')):null);});}function main(){logger[_0xc05a('0x38')](util[_0xc05a('0x21')](_0xc05a('0x3b'),EXTRACTED_REPORT_ID,_0xc05a('0x3c')));return db[_0xc05a('0x3d')][_0xc05a('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1464fb){_extractedReport=_0x1464fb;return dbH[_0xc05a('0x18')][_0xc05a('0x19')](util[_0xc05a('0x21')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xc05a('0x18')]['QueryTypes']['SELECT']});})[_0xc05a('0x14')](extractReport)[_0xc05a('0x3f')](function(_0x3523a8){logger[_0xc05a('0x38')](util['format'](_0xc05a('0x40'),EXTRACTED_REPORT_ID,_0xc05a('0x3c')),util['inspect'](_0x3523a8,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xc05a('0x41'));});}main(); \ No newline at end of file +var _0x1323=['findOne','query','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','bluebird','path','moment','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','push','tableHeader','num','Empty','dirname','basename','.pdf','find','splitSizePdf','then','length','split','sequelize','format','QueryTypes','SELECT','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','endDate','header','black','body','toString','content','/fonts/Roboto-Regular.ttf','/fonts/Roboto-Medium.ttf','/fonts/Roboto-MediumItalic.ttf','%s%d.%s','pdf','%s.%s','createWriteStream','finish','error','err','end','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','zip','PDF'];(function(_0x79eb30,_0x45cfde){var _0x2e4a1d=function(_0x2d20c4){while(--_0x2d20c4){_0x79eb30['push'](_0x79eb30['shift']());}};_0x2e4a1d(++_0x45cfde);}(_0x1323,0x1c6));var _0x3132=function(_0x5246b8,_0x4b9fd0){_0x5246b8=_0x5246b8-0x0;var _0x522e54=_0x1323[_0x5246b8];return _0x522e54;};'use strict';var _=require('lodash');var fs=require('fs');var BPromise=require(_0x3132('0x0'));var util=require('util');var path=require(_0x3132('0x1'));var moment=require(_0x3132('0x2'));var PdfPrinter=require(_0x3132('0x3'));var zipdir=require(_0x3132('0x4'));var rimraf=require(_0x3132('0x5'));var db=require(_0x3132('0x6'))['db'];var dbH=require('../../mysqldb')[_0x3132('0x7')];var logger=require(_0x3132('0x8'))(_0x3132('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x3132('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x3132('0xa')][0x4];var NAME=process[_0x3132('0xa')][0x5];var FORMAT=_0x3132('0xb');var _extractedReport;function analyticExtractedReport(_0x1410f1,_0x4ebc96){var _0x27a692={'status':_0x1410f1};var _0x4ba8ac={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4ebc96){_0x27a692[_0x3132('0xc')]=_0x4ebc96;}return db[_0x3132('0xd')]['update'](_0x27a692,_0x4ba8ac);}function getHeader(_0x4d14f8){var _0x85162=[];for(var _0x320321 in _0x4d14f8){if(_0x4d14f8[_0x3132('0xe')](_0x320321)){_0x85162[_0x3132('0xf')]({'text':_0x320321,'style':_0x3132('0x10')});}}return _0x85162;}function extractReport(_0x2ef0e1){var _0x43bcf2=0x1388;var _0x38a6bf;if(!_0x2ef0e1[0x0][_0x3132('0x11')]){return analyticExtractedReport(_0x3132('0x12'));}var _0x126785=[];var _0x505ee5=0x0;var _0xaf56ce=!![];var _0x5df16c=path[_0x3132('0x13')](PATH);var _0x254716=path[_0x3132('0x14')](PATH,_0x3132('0x15'));var _0x3ba5a8=![];var _0x574774=[];return db['Setting'][_0x3132('0x16')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x3132('0x17')]})[_0x3132('0x18')](function(_0x3a1b70){if(_0x3a1b70){_0x38a6bf=_0x3a1b70;_0x43bcf2=_0x38a6bf[_0x3132('0x17')]||0x3e8;}})[_0x3132('0x18')](function(){if(_0x2ef0e1&&_0x2ef0e1[_0x3132('0x19')]){var _0x952ed8=_0x2ef0e1[0x0][_0x3132('0x11')]%(_0x505ee5+_0x43bcf2);if(_0x38a6bf[_0x3132('0x1a')]){for(;_0xaf56ce;_0x505ee5+=_0x43bcf2,_0x952ed8=_0x2ef0e1[0x0]['num']%(_0x505ee5+_0x43bcf2)){if(_0x952ed8==0x0||_0x952ed8==_0x2ef0e1[0x0]['num']){_0xaf56ce=![];}_0x126785[_0x3132('0xf')](dbH[_0x3132('0x1b')]['query'](util[_0x3132('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x43bcf2,_0x505ee5),{'type':dbH[_0x3132('0x1b')][_0x3132('0x1d')]['SELECT']}));}}else{_0x126785['push'](dbH[_0x3132('0x1b')]['query'](QUERY,{'type':dbH[_0x3132('0x1b')][_0x3132('0x1d')][_0x3132('0x1e')]}));}}_0x3ba5a8=_0x38a6bf[_0x3132('0x1a')]&&_0x126785[_0x3132('0x19')]>0x1;if(!fs['existsSync'](path[_0x3132('0x1f')](_0x5df16c,_0x254716))&&_0x3ba5a8){fs[_0x3132('0x20')](path[_0x3132('0x1f')](_0x5df16c,_0x254716));}return BPromise[_0x3132('0x21')](_0x126785,function(_0x4c0f22){_0x574774[_0x3132('0xf')](_0x4c0f22);});})[_0x3132('0x18')](function(){return BPromise[_0x3132('0x21')](_0x126785,function(_0x462379,_0x27da6f){var _0x1ae257;var _0x59b906=util[_0x3132('0x1c')](_0x3132('0x22'),NAME,_extractedReport['name'],moment(_extractedReport['startDate'])[_0x3132('0x1c')](FORMAT),moment(_extractedReport[_0x3132('0x23')])[_0x3132('0x1c')](FORMAT));var _0x234d1f={'pageSize':'A4','pageOrientation':'landscape','content':[{'text':_0x59b906,'style':_0x3132('0x24')}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x3132('0x25')}}};var _0x17003a={'headerRows':0x1,'body':[]};_0x17003a[_0x3132('0x26')][_0x3132('0xf')](getHeader(_0x462379[0x0]));var _0x2e4b9a;for(var _0x3fa57e=0x0;_0x3fa57e<_0x462379[_0x3132('0x19')];_0x3fa57e+=0x1){_0x2e4b9a=[];for(var _0x14884a in _0x462379[_0x3fa57e]){if(_0x462379[_0x3fa57e][_0x3132('0xe')](_0x14884a)){_0x2e4b9a['push'](_0x462379[_0x3fa57e][_0x14884a]?_[_0x3132('0x27')](_0x462379[_0x3fa57e][_0x14884a]):'');}}_0x17003a[_0x3132('0x26')]['push'](_0x2e4b9a);}_0x234d1f[_0x3132('0x28')]['push']({'table':_0x17003a});return new BPromise(function(_0x2ea31b,_0x2c81d2){var _0x36b25a=new PdfPrinter({'Roboto':{'normal':__dirname+_0x3132('0x29'),'bold':__dirname+_0x3132('0x2a'),'italics':__dirname+'/fonts/Roboto-Italic.ttf','bolditalics':__dirname+_0x3132('0x2b')}});var _0x176815=_0x36b25a['createPdfKitDocument'](_0x234d1f);if(_0x3ba5a8){_0x1ae257=path[_0x3132('0x1f')](_0x5df16c,_0x254716,util['format'](_0x3132('0x2c'),_0x254716,_0x27da6f,_0x3132('0x2d')));}else{_0x1ae257=path[_0x3132('0x1f')](_0x5df16c,util[_0x3132('0x1c')](_0x3132('0x2e'),_0x254716,_0x3132('0x2d')));}var _0xa99371=_0x176815['pipe'](fs[_0x3132('0x2f')](_0x1ae257));_0xa99371['on'](_0x3132('0x30'),function(){_0x2ea31b();});_0xa99371['on'](_0x3132('0x31'),function(_0x2238fb){console['log'](_0x3132('0x32'),_0x2238fb);_0x2c81d2(_0x2238fb);});_0x176815[_0x3132('0x33')]();});});})[_0x3132('0x18')](function(){if(_0x3ba5a8){return new BPromise(function(_0x416da6,_0x5631eb){zipdir(path[_0x3132('0x1f')](_0x5df16c,_0x254716),{'saveTo':path[_0x3132('0x1f')](_0x5df16c,util[_0x3132('0x1c')]('%s.%s',_0x254716,'zip'))},function(_0xe97262){if(_0xe97262){_0x5631eb(_0xe97262);}else{_0x416da6();}});});}})[_0x3132('0x18')](function(){if(_0x3ba5a8){rimraf(path['join'](_0x5df16c,_0x254716),function(){});}})[_0x3132('0x18')](function(){logger[_0x3132('0x34')](util[_0x3132('0x1c')](_0x3132('0x35'),EXTRACTED_REPORT_ID,_0x3132('0x36')));return analyticExtractedReport(_0x3132('0x37'),_0x3ba5a8?util[_0x3132('0x1c')](_0x3132('0x2e'),_0x254716,_0x3ba5a8?_0x3132('0x38'):_0x3132('0x2d')):null);});}function main(){logger[_0x3132('0x34')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x3132('0x39')));return db[_0x3132('0xd')][_0x3132('0x3a')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x3132('0x18')](function(_0x130ae0){_extractedReport=_0x130ae0;return dbH[_0x3132('0x1b')][_0x3132('0x3b')](util[_0x3132('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x3132('0x1b')][_0x3132('0x1d')][_0x3132('0x1e')]});})[_0x3132('0x18')](extractReport)[_0x3132('0x3c')](function(_0x282e6a){logger[_0x3132('0x34')](util['format'](_0x3132('0x3d'),EXTRACTED_REPORT_ID,'PDF'),util[_0x3132('0x3e')](_0x282e6a,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x3132('0x3f'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 12d4701..c97ba8d 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 _0x658e=['find','split','then','splitSizeXlsx','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','length','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting'];(function(_0xd379c8,_0x4f3ce7){var _0x491744=function(_0x3bd214){while(--_0x3bd214){_0xd379c8['push'](_0xd379c8['shift']());}};_0x491744(++_0x4f3ce7);}(_0x658e,0x1e9));var _0xe658=function(_0x4dc0ea,_0x3a7ade){_0x4dc0ea=_0x4dc0ea-0x0;var _0x4bcca1=_0x658e[_0x4dc0ea];return _0x4bcca1;};'use strict';var util=require(_0xe658('0x0'));var path=require(_0xe658('0x1'));var _=require(_0xe658('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xe658('0x3'));var zipdir=require(_0xe658('0x4'));var rimraf=require(_0xe658('0x5'));var db=require(_0xe658('0x6'))['db'];var dbH=require(_0xe658('0x6'))[_0xe658('0x7')];var logger=require('../../config/logger')(_0xe658('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xe658('0x9')][0x2]);var QUERY=process[_0xe658('0x9')][0x3];var PATH=process[_0xe658('0x9')][0x4];function analyticExtractedReport(_0x31b321,_0x239e2a){var _0x3e7571={'status':_0x31b321};var _0x13fe2b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x239e2a){_0x3e7571[_0xe658('0xa')]=_0x239e2a;}return db[_0xe658('0xb')]['update'](_0x3e7571,_0x13fe2b);}function main(){var _0x3e5ae8=0x1388;var _0x16e7f0;logger[_0xe658('0xc')](util[_0xe658('0xd')](_0xe658('0xe'),EXTRACTED_REPORT_ID,_0xe658('0xf')));return db[_0xe658('0x10')][_0xe658('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe658('0x12'),'splitSizeXlsx']})[_0xe658('0x13')](function(_0x4737d8){if(_0x4737d8){_0x16e7f0=_0x4737d8;_0x3e5ae8=_0x16e7f0[_0xe658('0x14')]||0x1388;}})['then'](function(){return dbH[_0xe658('0x15')]['query'](util[_0xe658('0xd')](_0xe658('0x16'),QUERY),{'type':dbH[_0xe658('0x15')][_0xe658('0x17')][_0xe658('0x18')]});})[_0xe658('0x13')](function(_0x2a436b){if(!_0x2a436b[0x0][_0xe658('0x19')]){return analyticExtractedReport('Empty');}var _0x18344a=[];var _0x37b960=0x0;var _0x21fcbb=!![];if(_0x16e7f0['split']){if(_0x2a436b&&_0x2a436b['length']){var _0x574496=_0x2a436b[0x0]['num']%(_0x37b960+_0x3e5ae8);for(;_0x21fcbb;_0x37b960+=_0x3e5ae8,_0x574496=_0x2a436b[0x0][_0xe658('0x19')]%(_0x37b960+_0x3e5ae8)){if(_0x574496==0x0||_0x574496==_0x2a436b[0x0][_0xe658('0x19')]){_0x21fcbb=![];}_0x18344a[_0xe658('0x1a')](dbH['sequelize'][_0xe658('0x1b')](util[_0xe658('0xd')](_0xe658('0x1c'),QUERY,_0x3e5ae8,_0x37b960),{'type':dbH['sequelize'][_0xe658('0x17')][_0xe658('0x18')]}));}}}else{_0x18344a[_0xe658('0x1a')](dbH[_0xe658('0x15')][_0xe658('0x1b')](QUERY,{'type':dbH[_0xe658('0x15')][_0xe658('0x17')][_0xe658('0x18')]}));}var _0x4382ca=path['dirname'](PATH);var _0x2ed94d=path[_0xe658('0x1d')](PATH,_0xe658('0x1e'));var _0x493563=_0x16e7f0[_0xe658('0x12')]&&_0x18344a[_0xe658('0x1f')]>0x1;var _0x1479f2=[];if(!fs[_0xe658('0x20')](path[_0xe658('0x21')](_0x4382ca,_0x2ed94d))&&_0x493563){fs[_0xe658('0x22')](path[_0xe658('0x21')](_0x4382ca,_0x2ed94d));}return BPromise[_0xe658('0x23')](_0x18344a,function(_0x2957ec){_0x1479f2['push'](_0x2957ec);})[_0xe658('0x13')](function(){for(var _0x13f401=0x0;_0x13f401<_0x1479f2['length'];_0x13f401+=0x1){var _0x3fbe3e;var _0x56ab2d=_0x1479f2[_0x13f401];if(_0x493563){_0x3fbe3e=path[_0xe658('0x21')](_0x4382ca,_0x2ed94d,util[_0xe658('0xd')](_0xe658('0x24'),_0x2ed94d,_0x13f401,_0xe658('0x25')));}else{_0x3fbe3e=path[_0xe658('0x21')](_0x4382ca,util['format'](_0xe658('0x26'),_0x2ed94d,_0xe658('0x25')));}fs[_0xe658('0x27')](_0x3fbe3e,json2xls(_0x56ab2d),_0xe658('0x28'));}})[_0xe658('0x13')](function(){if(_0x493563){zipdir(path[_0xe658('0x21')](_0x4382ca,_0x2ed94d),{'saveTo':path['join'](_0x4382ca,util['format'](_0xe658('0x26'),_0x2ed94d,'zip'))},function(_0x3ea957,_0x38b53f){});rimraf(path[_0xe658('0x21')](_0x4382ca,_0x2ed94d),function(){});}})[_0xe658('0x13')](function(){logger[_0xe658('0xc')](util[_0xe658('0xd')](_0xe658('0x29'),EXTRACTED_REPORT_ID,_0xe658('0xf')));return analyticExtractedReport(_0xe658('0x2a'),_0x493563?util[_0xe658('0xd')]('%s.%s',_0x2ed94d,_0x493563?'zip':'xlsx'):null);});})['catch'](function(_0x20b50d){logger[_0xe658('0xc')](util[_0xe658('0xd')](_0xe658('0x2b'),EXTRACTED_REPORT_ID,_0xe658('0xf')),util[_0xe658('0x2c')](_0x20b50d,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xe658('0x2d'));});}main(); \ No newline at end of file +var _0xcb2c=['find','splitSizeXlsx','then','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','split','push','dirname','basename','.xlsx','existsSync','mkdirSync','join','xlsx','%s.%s','writeFileSync','binary','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','info','XLSX','Setting'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcb2c,0x15b));var _0xccb2=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xcb2c[_0x618414];return _0x21c19a;};'use strict';var util=require(_0xccb2('0x0'));var path=require('path');var _=require('lodash');var fs=require('fs');var json2xls=require(_0xccb2('0x1'));var BPromise=require('bluebird');var zipdir=require(_0xccb2('0x2'));var rimraf=require(_0xccb2('0x3'));var db=require(_0xccb2('0x4'))['db'];var dbH=require(_0xccb2('0x4'))[_0xccb2('0x5')];var logger=require(_0xccb2('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xccb2('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xccb2('0x7')][0x4];function analyticExtractedReport(_0x5a503e,_0x195f17){var _0x11b1dc={'status':_0x5a503e};var _0x87d111={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x195f17){_0x11b1dc[_0xccb2('0x8')]=_0x195f17;}return db[_0xccb2('0x9')]['update'](_0x11b1dc,_0x87d111);}function main(){var _0x37f997=0x1388;var _0x3403d2;logger[_0xccb2('0xa')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xccb2('0xb')));return db[_0xccb2('0xc')][_0xccb2('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xccb2('0xe')]})[_0xccb2('0xf')](function(_0x237923){if(_0x237923){_0x3403d2=_0x237923;_0x37f997=_0x3403d2['splitSizeXlsx']||0x1388;}})[_0xccb2('0xf')](function(){return dbH['sequelize'][_0xccb2('0x10')](util[_0xccb2('0x11')](_0xccb2('0x12'),QUERY),{'type':dbH[_0xccb2('0x13')][_0xccb2('0x14')][_0xccb2('0x15')]});})[_0xccb2('0xf')](function(_0x17927a){if(!_0x17927a[0x0][_0xccb2('0x16')]){return analyticExtractedReport('Empty');}var _0x3be13a=[];var _0xf96607=0x0;var _0x2eda35=!![];if(_0x3403d2[_0xccb2('0x17')]){if(_0x17927a&&_0x17927a['length']){var _0x1f5266=_0x17927a[0x0][_0xccb2('0x16')]%(_0xf96607+_0x37f997);for(;_0x2eda35;_0xf96607+=_0x37f997,_0x1f5266=_0x17927a[0x0][_0xccb2('0x16')]%(_0xf96607+_0x37f997)){if(_0x1f5266==0x0||_0x1f5266==_0x17927a[0x0][_0xccb2('0x16')]){_0x2eda35=![];}_0x3be13a['push'](dbH['sequelize'][_0xccb2('0x10')](util[_0xccb2('0x11')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x37f997,_0xf96607),{'type':dbH['sequelize'][_0xccb2('0x14')][_0xccb2('0x15')]}));}}}else{_0x3be13a[_0xccb2('0x18')](dbH[_0xccb2('0x13')][_0xccb2('0x10')](QUERY,{'type':dbH[_0xccb2('0x13')][_0xccb2('0x14')]['SELECT']}));}var _0x5a90dc=path[_0xccb2('0x19')](PATH);var _0x55a8f1=path[_0xccb2('0x1a')](PATH,_0xccb2('0x1b'));var _0xec7c25=_0x3403d2[_0xccb2('0x17')]&&_0x3be13a['length']>0x1;var _0x28ba74=[];if(!fs[_0xccb2('0x1c')](path['join'](_0x5a90dc,_0x55a8f1))&&_0xec7c25){fs[_0xccb2('0x1d')](path['join'](_0x5a90dc,_0x55a8f1));}return BPromise['each'](_0x3be13a,function(_0x261b2c){_0x28ba74['push'](_0x261b2c);})['then'](function(){for(var _0x1f625b=0x0;_0x1f625b<_0x28ba74['length'];_0x1f625b+=0x1){var _0xd2d469;var _0x12f278=_0x28ba74[_0x1f625b];if(_0xec7c25){_0xd2d469=path[_0xccb2('0x1e')](_0x5a90dc,_0x55a8f1,util[_0xccb2('0x11')]('%s%d.%s',_0x55a8f1,_0x1f625b,_0xccb2('0x1f')));}else{_0xd2d469=path[_0xccb2('0x1e')](_0x5a90dc,util[_0xccb2('0x11')](_0xccb2('0x20'),_0x55a8f1,_0xccb2('0x1f')));}fs[_0xccb2('0x21')](_0xd2d469,json2xls(_0x12f278),_0xccb2('0x22'));}})[_0xccb2('0xf')](function(){if(_0xec7c25){zipdir(path[_0xccb2('0x1e')](_0x5a90dc,_0x55a8f1),{'saveTo':path[_0xccb2('0x1e')](_0x5a90dc,util[_0xccb2('0x11')](_0xccb2('0x20'),_0x55a8f1,_0xccb2('0x23')))},function(_0x360723,_0x554659){});rimraf(path[_0xccb2('0x1e')](_0x5a90dc,_0x55a8f1),function(){});}})[_0xccb2('0xf')](function(){logger[_0xccb2('0xa')](util[_0xccb2('0x11')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport('Completed',_0xec7c25?util[_0xccb2('0x11')]('%s.%s',_0x55a8f1,_0xec7c25?'zip':_0xccb2('0x1f')):null);});})[_0xccb2('0x24')](function(_0x58ee67){logger['info'](util[_0xccb2('0x11')](_0xccb2('0x25'),EXTRACTED_REPORT_ID,'XLSX'),util[_0xccb2('0x26')](_0x58ee67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xccb2('0x27'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index cae7536..019a758 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 _0xd31f=['queue','hasOwnProperty','progress','priority','extensions','push','type','context','Set','format','CDR(type)=%s','length','updatedAt','interval','map','filter','tag','CDR(tag)=','VoiceExtensionId','callerID','CALLERID(all)=','indexOf','app','toLowerCase','appType','custom','answer','Answer','recordingFormat','record','MixMonitor',',ab','StopMixMonitor','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','sortBy','catch','error','lodash','util','models','Interval','findAll','intervals','VoiceExtension','IntervalId','then','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','groupBy'];(function(_0x3cf40c,_0x576cf0){var _0x3003aa=function(_0xe9b4bd){while(--_0xe9b4bd){_0x3cf40c['push'](_0x3cf40c['shift']());}};_0x3003aa(++_0x576cf0);}(_0xd31f,0x1b3));var _0xfd31=function(_0x275717,_0x28df88){_0x275717=_0x275717-0x0;var _0x438fef=_0xd31f[_0x275717];return _0x438fef;};'use strict';var _=require(_0xfd31('0x0'));var util=require(_0xfd31('0x1'));function rewrite(_0x458b6d,_0xdec3a1){var _0x566fe6=this;return _0x458b6d[_0xfd31('0x2')][_0xfd31('0x3')][_0xfd31('0x4')]({'raw':!![]})['then'](function(_0x1f3847){_0x566fe6[_0xfd31('0x5')]=_0x1f3847;return _0x458b6d[_0xfd31('0x2')][_0xfd31('0x6')]['findAll']({'where':{'IntervalId':_0xdec3a1[_0xfd31('0x7')]},'raw':!![]});})[_0xfd31('0x8')](function(_0x2310e4){return _0x458b6d[_0xfd31('0x2')][_0xfd31('0x6')][_0xfd31('0x4')]({'where':{'exten':{'$in':_[_0xfd31('0x9')](_['map'](_0x2310e4,_0xfd31('0xa')))},'isApp':!![]},'order':[{'raw':_0xfd31('0xb')}],'raw':!![]});})[_0xfd31('0x8')](function(_0x95792b){var _0x209a88=_[_0xfd31('0xc')](_0x95792b,_0xfd31('0xa'));var _0x18f42e=[_0xfd31('0xd'),'playback'];var _0x35ee42=[];var _0x5728e6=[];for(var _0x577bb3 in _0x209a88){if(_0x209a88[_0xfd31('0xe')](_0x577bb3)){_0x566fe6['answer']=![];_0x566fe6[_0xfd31('0xf')]=![];_0x566fe6[_0xfd31('0x10')]=0x2;_0x566fe6[_0xfd31('0x11')]=[];_0x566fe6['extensions'][_0xfd31('0x12')]({'type':_0x209a88[_0x577bb3][0x0][_0xfd31('0x13')],'context':_0x209a88[_0x577bb3][0x0][_0xfd31('0x14')],'exten':_0x209a88[_0x577bb3][0x0][_0xfd31('0xa')],'priority':_0x566fe6['priority']++,'app':_0xfd31('0x15'),'appdata':util[_0xfd31('0x16')](_0xfd31('0x17'),_0x209a88[_0x577bb3][0x0][_0xfd31('0x13')]),'VoiceExtensionId':_0x209a88[_0x577bb3][0x0]['VoiceExtensionId']});for(var _0x5b8f94=0x0,_0x56e625=0x0;_0x5b8f94<_0x209a88[_0x577bb3][_0xfd31('0x18')];_0x5b8f94+=0x1,_0x56e625=0x0){var _0x486095=_0x209a88[_0x577bb3][_0x5b8f94];var _0xb55c72=[];var _0x4ffd68=[];delete _0x486095['id'];delete _0x486095['createdAt'];delete _0x486095[_0xfd31('0x19')];var _0x365a36=_0x486095['interval']!=='*,*,*,*'?[_0x486095[_0xfd31('0x1a')]]:_0x486095[_0xfd31('0x7')]?_[_0xfd31('0x1b')](_[_0xfd31('0x1c')](_0x566fe6[_0xfd31('0x5')],{'IntervalId':_0x486095[_0xfd31('0x7')]}),'interval'):[];if(_0x486095['hasOwnProperty']('tag')){if(_0x486095[_0xfd31('0x1d')]&&_0x486095[_0xfd31('0x1d')]!=='--'){_0xb55c72[_0xfd31('0x12')]({'type':_0x486095[_0xfd31('0x13')],'app':_0xfd31('0x15'),'appdata':_0xfd31('0x1e')+_0x486095[_0xfd31('0x1d')],'context':_0x486095['context'],'exten':_0x486095[_0xfd31('0xa')],'priority':_0x365a36['length']+_0x566fe6['priority']+_0x56e625++,'VoiceExtensionId':_0x209a88[_0x577bb3][0x0][_0xfd31('0x1f')]});}}if(_0x486095['hasOwnProperty'](_0xfd31('0x20'))){if(_0x486095[_0xfd31('0x20')]){_0xb55c72['push']({'type':_0x486095[_0xfd31('0x13')],'app':_0xfd31('0x15'),'appdata':_0xfd31('0x21')+_0x486095[_0xfd31('0x20')],'context':_0x486095[_0xfd31('0x14')],'exten':_0x486095['exten'],'priority':_0x365a36[_0xfd31('0x18')]+_0x566fe6[_0xfd31('0x10')]+_0x56e625++,'VoiceExtensionId':_0x209a88[_0x577bb3][0x0][_0xfd31('0x1f')]});}}if(_0x486095[_0xfd31('0xe')]('answer')){if(_0x18f42e[_0xfd31('0x22')](_0x486095[_0xfd31('0x23')][_0xfd31('0x24')]())>=0x0&&_0x486095[_0xfd31('0x25')]!==_0xfd31('0x26')){if(!_0x566fe6[_0xfd31('0x27')]&&_0x486095[_0xfd31('0x27')]){_0x566fe6[_0xfd31('0x27')]=!![];_0xb55c72[_0xfd31('0x12')]({'type':_0x486095['type'],'app':_0xfd31('0x28'),'context':_0x486095[_0xfd31('0x14')],'exten':_0x486095[_0xfd31('0xa')],'priority':_0x365a36['length']+_0x566fe6[_0xfd31('0x10')]+_0x56e625++,'VoiceExtensionId':_0x209a88[_0x577bb3][0x0][_0xfd31('0x1f')]});}if(!_0x566fe6[_0xfd31('0x27')]&&!_0x566fe6['progress']&&!_0x486095['answer']){_0x566fe6[_0xfd31('0xf')]=!![];_0xb55c72[_0xfd31('0x12')]({'type':_0x486095[_0xfd31('0x13')],'app':'Progress','context':_0x486095[_0xfd31('0x14')],'exten':_0x486095[_0xfd31('0xa')],'priority':_0x365a36[_0xfd31('0x18')]+_0x566fe6[_0xfd31('0x10')]+_0x56e625++,'VoiceExtensionId':_0x209a88[_0x577bb3][0x0][_0xfd31('0x1f')]});}}}if(_0x486095[_0xfd31('0xe')]('record')&&_0x486095['hasOwnProperty'](_0xfd31('0x29'))){if(_0x486095[_0xfd31('0x2a')]){_0xb55c72[_0xfd31('0x12')]({'type':_0x486095['type'],'app':_0xfd31('0x2b'),'appdata':'${UNIQUEID}.'+_0x486095[_0xfd31('0x29')]+_0xfd31('0x2c'),'context':_0x486095[_0xfd31('0x14')],'exten':_0x486095['exten'],'priority':_0x365a36[_0xfd31('0x18')]+_0x566fe6['priority']+_0x56e625++,'VoiceExtensionId':_0x209a88[_0x577bb3][0x0][_0xfd31('0x1f')]});}}if(_0x486095[_0xfd31('0xe')]('record')&&_0x486095[_0xfd31('0xe')](_0xfd31('0x29'))){if(_0x486095['record']){_0x4ffd68[_0xfd31('0x12')]({'type':_0x486095['type'],'app':_0xfd31('0x2d'),'appdata':null,'context':_0x486095[_0xfd31('0x14')],'exten':_0x486095['exten'],'priority':_0x365a36[_0xfd31('0x18')]+_0x566fe6[_0xfd31('0x10')]+_0x56e625++ +0x1,'VoiceExtensionId':_0x209a88[_0x577bb3][0x0][_0xfd31('0x1f')]});}}for(var _0x4823a4=0x0;_0x4823a4<_0x365a36[_0xfd31('0x18')];_0x4823a4+=0x1){var _0x6e2af5=_0x566fe6[_0xfd31('0x10')]+_0x365a36[_0xfd31('0x18')];var _0x4434f2=_0x4823a4===_0x365a36[_0xfd31('0x18')]-0x1?_0x566fe6[_0xfd31('0x10')]+_0xb55c72[_0xfd31('0x18')]+_0x4ffd68[_0xfd31('0x18')]+0x2:_0x566fe6[_0xfd31('0x10')]+_0x4823a4+0x1;_0xb55c72[_0xfd31('0x2e')](_0x4823a4,0x0,{'type':_0x486095['type'],'app':_0xfd31('0x2f'),'appdata':_0x365a36[_0x4823a4]+'?'+_0x486095[_0xfd31('0x14')]+_0xfd31('0x30')+_0x6e2af5+':'+_0x486095[_0xfd31('0x14')]+',${EXTEN},'+_0x4434f2,'exten':_0x486095['exten'],'context':_0x486095[_0xfd31('0x14')],'priority':_0x566fe6[_0xfd31('0x10')]+_0x4823a4,'VoiceExtensionId':_0x209a88[_0x577bb3][0x0][_0xfd31('0x1f')]});}_0x486095[_0xfd31('0x10')]=_0xb55c72[_0xfd31('0x18')]?_['last'](_0xb55c72)[_0xfd31('0x10')]+0x1:_0x566fe6[_0xfd31('0x10')];_0x566fe6[_0xfd31('0x10')]=(_0x4ffd68[_0xfd31('0x18')]?_[_0xfd31('0x31')](_0x4ffd68)['priority']:_0x486095[_0xfd31('0x10')])+0x1;_0x566fe6['extensions']=_[_0xfd31('0x32')](_0x566fe6[_0xfd31('0x11')],_0xb55c72,[_0x486095],_0x4ffd68);}_0x566fe6['extensions'][_0xfd31('0x12')]({'type':_0x209a88[_0x577bb3][0x0][_0xfd31('0x13')],'app':_0xfd31('0x33'),'exten':_0x209a88[_0x577bb3][0x0][_0xfd31('0xa')],'context':_0x209a88[_0x577bb3][0x0][_0xfd31('0x14')],'priority':_0x566fe6['priority'],'VoiceExtensionId':_0x209a88[_0x577bb3][0x0][_0xfd31('0x1f')]});_0x35ee42[_0xfd31('0x12')](_0x209a88[_0x577bb3][0x0][_0xfd31('0x1f')]);_0x5728e6=_['concat'](_0x5728e6,_0x566fe6[_0xfd31('0x11')]);}}return _0x458b6d[_0xfd31('0x34')](function(_0x29f927){return _0x458b6d[_0xfd31('0x2')][_0xfd31('0x6')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x35ee42}},'transaction':_0x29f927})[_0xfd31('0x8')](function(_0x41d4e4){return _0x458b6d[_0xfd31('0x2')][_0xfd31('0x6')]['bulkCreate'](_[_0xfd31('0x35')](_0x5728e6,_0xfd31('0x10')),{'transaction':_0x29f927});});});})[_0xfd31('0x36')](function(_0x26e74a){console[_0xfd31('0x37')](_0x26e74a);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0x3a53=['type','context','VoiceExtensionId','interval','*,*,*,*','filter','intervals','IntervalId','tag','CDR(tag)=','length','callerID','push','CALLERID(all)=','indexOf','appType','Answer','Progress','record','recordingFormat','MixMonitor','${UNIQUEID}.',',ab','splice',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','then','VoiceExtension','map','exten','CAST(priority\x20AS\x20UNSIGNED)','groupBy','playback','hasOwnProperty','answer','progress','priority','extensions'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3a53,0x1ed));var _0x33a5=function(_0x1f9744,_0x54a947){_0x1f9744=_0x1f9744-0x0;var _0x5aba67=_0x3a53[_0x1f9744];return _0x5aba67;};'use strict';var _=require(_0x33a5('0x0'));var util=require(_0x33a5('0x1'));function rewrite(_0x2bd228,_0x41697f){var _0x1b8f53=this;return _0x2bd228[_0x33a5('0x2')][_0x33a5('0x3')][_0x33a5('0x4')]({'raw':!![]})[_0x33a5('0x5')](function(_0x57bee8){_0x1b8f53['intervals']=_0x57bee8;return _0x2bd228[_0x33a5('0x2')][_0x33a5('0x6')][_0x33a5('0x4')]({'where':{'IntervalId':_0x41697f['IntervalId']},'raw':!![]});})[_0x33a5('0x5')](function(_0x3fbe94){return _0x2bd228[_0x33a5('0x2')][_0x33a5('0x6')][_0x33a5('0x4')]({'where':{'exten':{'$in':_['uniq'](_[_0x33a5('0x7')](_0x3fbe94,_0x33a5('0x8')))},'isApp':!![]},'order':[{'raw':_0x33a5('0x9')}],'raw':!![]});})[_0x33a5('0x5')](function(_0x2bb1fc){var _0x414f90=_[_0x33a5('0xa')](_0x2bb1fc,_0x33a5('0x8'));var _0x1c34e3=['queue',_0x33a5('0xb')];var _0x310867=[];var _0xb30bcb=[];for(var _0x2a38e2 in _0x414f90){if(_0x414f90[_0x33a5('0xc')](_0x2a38e2)){_0x1b8f53[_0x33a5('0xd')]=![];_0x1b8f53[_0x33a5('0xe')]=![];_0x1b8f53[_0x33a5('0xf')]=0x2;_0x1b8f53[_0x33a5('0x10')]=[];_0x1b8f53[_0x33a5('0x10')]['push']({'type':_0x414f90[_0x2a38e2][0x0][_0x33a5('0x11')],'context':_0x414f90[_0x2a38e2][0x0][_0x33a5('0x12')],'exten':_0x414f90[_0x2a38e2][0x0][_0x33a5('0x8')],'priority':_0x1b8f53[_0x33a5('0xf')]++,'app':'Set','appdata':util['format']('CDR(type)=%s',_0x414f90[_0x2a38e2][0x0][_0x33a5('0x11')]),'VoiceExtensionId':_0x414f90[_0x2a38e2][0x0][_0x33a5('0x13')]});for(var _0x20d646=0x0,_0x5f3afc=0x0;_0x20d646<_0x414f90[_0x2a38e2]['length'];_0x20d646+=0x1,_0x5f3afc=0x0){var _0x2948a7=_0x414f90[_0x2a38e2][_0x20d646];var _0x5da9e0=[];var _0x6d7305=[];delete _0x2948a7['id'];delete _0x2948a7['createdAt'];delete _0x2948a7['updatedAt'];var _0x5f2557=_0x2948a7[_0x33a5('0x14')]!==_0x33a5('0x15')?[_0x2948a7[_0x33a5('0x14')]]:_0x2948a7['IntervalId']?_[_0x33a5('0x7')](_[_0x33a5('0x16')](_0x1b8f53[_0x33a5('0x17')],{'IntervalId':_0x2948a7[_0x33a5('0x18')]}),_0x33a5('0x14')):[];if(_0x2948a7['hasOwnProperty'](_0x33a5('0x19'))){if(_0x2948a7[_0x33a5('0x19')]&&_0x2948a7[_0x33a5('0x19')]!=='--'){_0x5da9e0['push']({'type':_0x2948a7[_0x33a5('0x11')],'app':'Set','appdata':_0x33a5('0x1a')+_0x2948a7['tag'],'context':_0x2948a7['context'],'exten':_0x2948a7[_0x33a5('0x8')],'priority':_0x5f2557[_0x33a5('0x1b')]+_0x1b8f53[_0x33a5('0xf')]+_0x5f3afc++,'VoiceExtensionId':_0x414f90[_0x2a38e2][0x0][_0x33a5('0x13')]});}}if(_0x2948a7[_0x33a5('0xc')](_0x33a5('0x1c'))){if(_0x2948a7['callerID']){_0x5da9e0[_0x33a5('0x1d')]({'type':_0x2948a7['type'],'app':'Set','appdata':_0x33a5('0x1e')+_0x2948a7[_0x33a5('0x1c')],'context':_0x2948a7[_0x33a5('0x12')],'exten':_0x2948a7[_0x33a5('0x8')],'priority':_0x5f2557[_0x33a5('0x1b')]+_0x1b8f53[_0x33a5('0xf')]+_0x5f3afc++,'VoiceExtensionId':_0x414f90[_0x2a38e2][0x0]['VoiceExtensionId']});}}if(_0x2948a7[_0x33a5('0xc')](_0x33a5('0xd'))){if(_0x1c34e3[_0x33a5('0x1f')](_0x2948a7['app']['toLowerCase']())>=0x0&&_0x2948a7[_0x33a5('0x20')]!=='custom'){if(!_0x1b8f53[_0x33a5('0xd')]&&_0x2948a7['answer']){_0x1b8f53[_0x33a5('0xd')]=!![];_0x5da9e0['push']({'type':_0x2948a7[_0x33a5('0x11')],'app':_0x33a5('0x21'),'context':_0x2948a7[_0x33a5('0x12')],'exten':_0x2948a7['exten'],'priority':_0x5f2557[_0x33a5('0x1b')]+_0x1b8f53[_0x33a5('0xf')]+_0x5f3afc++,'VoiceExtensionId':_0x414f90[_0x2a38e2][0x0]['VoiceExtensionId']});}if(!_0x1b8f53[_0x33a5('0xd')]&&!_0x1b8f53[_0x33a5('0xe')]&&!_0x2948a7['answer']){_0x1b8f53[_0x33a5('0xe')]=!![];_0x5da9e0['push']({'type':_0x2948a7[_0x33a5('0x11')],'app':_0x33a5('0x22'),'context':_0x2948a7[_0x33a5('0x12')],'exten':_0x2948a7[_0x33a5('0x8')],'priority':_0x5f2557['length']+_0x1b8f53['priority']+_0x5f3afc++,'VoiceExtensionId':_0x414f90[_0x2a38e2][0x0][_0x33a5('0x13')]});}}}if(_0x2948a7[_0x33a5('0xc')](_0x33a5('0x23'))&&_0x2948a7[_0x33a5('0xc')](_0x33a5('0x24'))){if(_0x2948a7[_0x33a5('0x23')]){_0x5da9e0['push']({'type':_0x2948a7['type'],'app':_0x33a5('0x25'),'appdata':_0x33a5('0x26')+_0x2948a7[_0x33a5('0x24')]+_0x33a5('0x27'),'context':_0x2948a7[_0x33a5('0x12')],'exten':_0x2948a7[_0x33a5('0x8')],'priority':_0x5f2557[_0x33a5('0x1b')]+_0x1b8f53[_0x33a5('0xf')]+_0x5f3afc++,'VoiceExtensionId':_0x414f90[_0x2a38e2][0x0][_0x33a5('0x13')]});}}if(_0x2948a7['hasOwnProperty'](_0x33a5('0x23'))&&_0x2948a7[_0x33a5('0xc')]('recordingFormat')){if(_0x2948a7['record']){_0x6d7305[_0x33a5('0x1d')]({'type':_0x2948a7[_0x33a5('0x11')],'app':'StopMixMonitor','appdata':null,'context':_0x2948a7[_0x33a5('0x12')],'exten':_0x2948a7[_0x33a5('0x8')],'priority':_0x5f2557[_0x33a5('0x1b')]+_0x1b8f53[_0x33a5('0xf')]+_0x5f3afc++ +0x1,'VoiceExtensionId':_0x414f90[_0x2a38e2][0x0][_0x33a5('0x13')]});}}for(var _0x109f6a=0x0;_0x109f6a<_0x5f2557[_0x33a5('0x1b')];_0x109f6a+=0x1){var _0x5a4d5d=_0x1b8f53[_0x33a5('0xf')]+_0x5f2557[_0x33a5('0x1b')];var _0x410a37=_0x109f6a===_0x5f2557[_0x33a5('0x1b')]-0x1?_0x1b8f53[_0x33a5('0xf')]+_0x5da9e0['length']+_0x6d7305[_0x33a5('0x1b')]+0x2:_0x1b8f53[_0x33a5('0xf')]+_0x109f6a+0x1;_0x5da9e0[_0x33a5('0x28')](_0x109f6a,0x0,{'type':_0x2948a7[_0x33a5('0x11')],'app':'GotoIfTime','appdata':_0x5f2557[_0x109f6a]+'?'+_0x2948a7['context']+_0x33a5('0x29')+_0x5a4d5d+':'+_0x2948a7[_0x33a5('0x12')]+',${EXTEN},'+_0x410a37,'exten':_0x2948a7[_0x33a5('0x8')],'context':_0x2948a7[_0x33a5('0x12')],'priority':_0x1b8f53['priority']+_0x109f6a,'VoiceExtensionId':_0x414f90[_0x2a38e2][0x0][_0x33a5('0x13')]});}_0x2948a7[_0x33a5('0xf')]=_0x5da9e0[_0x33a5('0x1b')]?_[_0x33a5('0x2a')](_0x5da9e0)[_0x33a5('0xf')]+0x1:_0x1b8f53[_0x33a5('0xf')];_0x1b8f53[_0x33a5('0xf')]=(_0x6d7305[_0x33a5('0x1b')]?_[_0x33a5('0x2a')](_0x6d7305)[_0x33a5('0xf')]:_0x2948a7[_0x33a5('0xf')])+0x1;_0x1b8f53[_0x33a5('0x10')]=_[_0x33a5('0x2b')](_0x1b8f53[_0x33a5('0x10')],_0x5da9e0,[_0x2948a7],_0x6d7305);}_0x1b8f53[_0x33a5('0x10')][_0x33a5('0x1d')]({'type':_0x414f90[_0x2a38e2][0x0]['type'],'app':_0x33a5('0x2c'),'exten':_0x414f90[_0x2a38e2][0x0]['exten'],'context':_0x414f90[_0x2a38e2][0x0]['context'],'priority':_0x1b8f53[_0x33a5('0xf')],'VoiceExtensionId':_0x414f90[_0x2a38e2][0x0][_0x33a5('0x13')]});_0x310867['push'](_0x414f90[_0x2a38e2][0x0]['VoiceExtensionId']);_0xb30bcb=_[_0x33a5('0x2b')](_0xb30bcb,_0x1b8f53['extensions']);}}return _0x2bd228['transaction'](function(_0x3026b2){return _0x2bd228[_0x33a5('0x2')]['VoiceExtension'][_0x33a5('0x2d')]({'where':{'VoiceExtensionId':{'$in':_0x310867}},'transaction':_0x3026b2})[_0x33a5('0x5')](function(_0xcfa40a){return _0x2bd228[_0x33a5('0x2')][_0x33a5('0x6')][_0x33a5('0x2e')](_[_0x33a5('0x2f')](_0xb30bcb,_0x33a5('0xf')),{'transaction':_0x3026b2});});});})[_0x33a5('0x30')](function(_0x817d81){console[_0x33a5('0x31')](_0x817d81);});}exports[_0x33a5('0x32')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 2acd445..c7a1610 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 _0xd5d7=['firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','CmContact','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','inspect','into','fromQuery','phone','ContactId','ListId','createdAt','updatedAt','select','field','NOW()','scheduledAt','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper','\x20=\x20?','id\x20IN\x20?','phone\x20IS\x20NOT\x20NULL','calleridnum','str','insert','cm_hopper_black','findAll','outbound','dialCheckDuplicateType','Lists','get','sequelize','query','VoiceQueueId','onlyIfOpen','all','VoiceQueue','CmList','CampaignId','Campaign','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','finally','emit','contact:csv_','resume','resolve','Unable\x20to\x20delete\x20temp\x20file:','info','createReadStream','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','hasOwnProperty','data','firstName'];(function(_0x258b93,_0x188ccc){var _0x35484b=function(_0x2563ea){while(--_0x2563ea){_0x258b93['push'](_0x258b93['shift']());}};_0x35484b(++_0x188ccc);}(_0xd5d7,0x197));var _0x7d5d=function(_0x921bf9,_0xbc639a){_0x921bf9=_0x921bf9-0x0;var _0x3f90c9=_0xd5d7[_0x921bf9];return _0x3f90c9;};'use strict';var BPromise=require(_0x7d5d('0x0'));var util=require(_0x7d5d('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0x7d5d('0x2'));var Papa=require(_0x7d5d('0x3'));var Redis=require(_0x7d5d('0x4'));var db=require(_0x7d5d('0x5'))['db'];var config=require(_0x7d5d('0x6'));var logger=require(_0x7d5d('0x7'))('api');config[_0x7d5d('0x8')]=_[_0x7d5d('0x9')](config['redis'],{'host':_0x7d5d('0xa'),'port':0x18eb});var socket=require(_0x7d5d('0xb'))(new Redis(config[_0x7d5d('0x8')]));require(_0x7d5d('0xc'))[_0x7d5d('0xd')](socket);try{if(!process[_0x7d5d('0xe')][0x2]||process[_0x7d5d('0xe')][0x2]===_0x7d5d('0xf')||process[_0x7d5d('0xe')][0x2]===_0x7d5d('0x10')){throw new Error(_0x7d5d('0x11'));}var FILEPATH=process[_0x7d5d('0xe')][0x2];if(!process['argv'][0x3]||process['argv'][0x3]===_0x7d5d('0xf')||process['argv'][0x3]===_0x7d5d('0x10')||!process[_0x7d5d('0xe')][0x4]||process[_0x7d5d('0xe')][0x4]===_0x7d5d('0xf')||process[_0x7d5d('0xe')][0x4]===_0x7d5d('0x10')){throw new Error(_0x7d5d('0x12'));}var FIELDS=_[_0x7d5d('0x13')](process[_0x7d5d('0xe')][0x3]['split'](','),process[_0x7d5d('0xe')][0x4][_0x7d5d('0x14')](','));if(!process[_0x7d5d('0xe')][0x5]||process[_0x7d5d('0xe')][0x5]===_0x7d5d('0xf')||process[_0x7d5d('0xe')][0x5]===_0x7d5d('0x10')){throw new Error(_0x7d5d('0x15'));}var LISTID=process[_0x7d5d('0xe')][0x5];var COMPANYID=process[_0x7d5d('0xe')][0x6]&&process[_0x7d5d('0xe')][0x6]!==_0x7d5d('0xf')&&process[_0x7d5d('0xe')][0x6]!==_0x7d5d('0x10')?process[_0x7d5d('0xe')][0x6]:null;var DUPLICATES=process[_0x7d5d('0xe')][0x7]&&process[_0x7d5d('0xe')][0x7]!==_0x7d5d('0xf')&&process[_0x7d5d('0xe')][0x7]!==_0x7d5d('0x10')?process['argv'][0x7]:null;if(!process['argv'][0x8]||process['argv'][0x8]===_0x7d5d('0xf')||process[_0x7d5d('0xe')][0x8]===_0x7d5d('0x10')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x7d5d('0xe')][0x8];}catch(_0x1e91d9){logger['error'](_0x1e91d9);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(_0x45a855,_0x2118d7,_0x589cfd,_0x42be31){var _0x12bc26={'message':_0x2118d7};_0x12bc26[_0x45a855]=!![];if(_0x589cfd){_0x12bc26['contact']=_0x589cfd;}if(_0x42be31){_0x12bc26[_0x7d5d('0x16')]=_0x42be31;}return _0x12bc26;}function isEmail(_0x1f2362){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))*$/[_0x7d5d('0x17')](_0x1f2362);}function checkRow(_0x5ecb5e,_0x4baae4,_0x1fba77){return new BPromise(function(_0x4a923f,_0x83722a){if(_['isNil'](_0x5ecb5e)){return _0x83722a(handleCheckRowError(_0x7d5d('0x18'),_0x7d5d('0x19'),null,_0x1fba77));}if(_0x5ecb5e[_0x7d5d('0x1a')]&&_0x5ecb5e['errors'][_0x7d5d('0x1b')]){var _0x389ada=_[_0x7d5d('0x1c')](_0x5ecb5e[_0x7d5d('0x1a')],'message')[_0x7d5d('0x1d')](';');return _0x83722a(handleCheckRowError('error',_0x389ada,null,_0x1fba77));}var _0x5a5976={};for(var _0x47bfb8 in FIELDS){if(FIELDS[_0x7d5d('0x1e')](_0x47bfb8)&&FIELDS[_0x47bfb8]){_0x5a5976[_0x47bfb8]=_0x5ecb5e[_0x7d5d('0x1f')][0x0][FIELDS[_0x47bfb8]]||_0x5ecb5e[_0x7d5d('0x1f')][0x0]['\ufeff'+FIELDS[_0x47bfb8]];}}if(!_0x5a5976[_0x7d5d('0x20')]){return _0x83722a(handleCheckRowError(_0x7d5d('0x18'),_0x7d5d('0x21'),null,_0x1fba77));}if(!_0x5a5976['phone']){return _0x83722a(handleCheckRowError(_0x7d5d('0x18'),'phone\x20not\x20specified!',null,_0x1fba77));}if(_0x5a5976[_0x7d5d('0x22')]){var _0x3964e0=moment(_0x5a5976[_0x7d5d('0x22')],_0x7d5d('0x23'));if(!_0x3964e0[_0x7d5d('0x24')]()){return _0x83722a(handleCheckRowError(_0x7d5d('0x18'),_0x7d5d('0x25'),null,_0x1fba77));}}if(_0x5a5976[_0x7d5d('0x26')]){if(!isEmail(_0x5a5976['email'])){return _0x83722a(handleCheckRowError(_0x7d5d('0x18'),_0x7d5d('0x27'),null,_0x1fba77));}}_0x5a5976['ListId']=LISTID;_0x5a5976[_0x7d5d('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x7d5d('0x1b')]&&_0x4baae4){var _0x1add8c={};for(var _0x5532e9=0x0,_0x43d101=DUPLICATES[_0x7d5d('0x1b')];_0x5532e9<_0x43d101;_0x5532e9+=0x1){_0x1add8c[DUPLICATES[_0x5532e9]]=_0x5a5976[DUPLICATES[_0x5532e9]];}var _0x18c4c5=_[_0x7d5d('0x29')](_0x4baae4,_0x1add8c);if(_0x18c4c5){return _0x83722a(handleCheckRowError(_0x7d5d('0x2a'),'Duplicate\x20Contact',_0x18c4c5,_0x1fba77));}}return db[_0x7d5d('0x2b')][_0x7d5d('0x2c')](_0x5a5976,{'raw':!![],'hooks':![],'fields':_['keys'](_0x5a5976)})[_0x7d5d('0x2d')](function(_0x2f19bb){if(DUPLICATES&&DUPLICATES[_0x7d5d('0x1b')]&&_0x4baae4){_0x4baae4[_0x7d5d('0x2e')](_[_0x7d5d('0x2f')](_0x5a5976,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2f19bb['id'];return _0x4a923f();})[_0x7d5d('0x30')](function(_0x475247){return _0x83722a(handleCheckRowError(_0x7d5d('0x18'),_0x7d5d('0x31')+(_0x475247[_0x7d5d('0x32')]||JSON[_0x7d5d('0x33')](_0x475247)),null,_0x1fba77));});});}function checkHopper(){function _0x5c6d72(){return function(_0x10f41a){logger['error'](_0x7d5d('0x34'),_0x7d5d('0x35'),util[_0x7d5d('0x36')](_0x10f41a,{'showHidden':![],'depth':null}));};}var _0x4556f5=function(_0xb6f51f,_0x48bc97){var _0x33f10d=squel['insert']()[_0x7d5d('0x37')]('cm_hopper')[_0x7d5d('0x38')]([_0x7d5d('0x39'),'scheduledAt',_0x7d5d('0x3a'),_0x7d5d('0x3b'),_0x48bc97,_0x7d5d('0x3c'),_0x7d5d('0x3d')],squel[_0x7d5d('0x3e')]()[_0x7d5d('0x3f')](_0x7d5d('0x39'),_0x7d5d('0x39'))[_0x7d5d('0x3f')](_0x7d5d('0x40'),_0x7d5d('0x41'))['field']('id',_0x7d5d('0x3a'))[_0x7d5d('0x3f')](LISTID['toString'](),_0x7d5d('0x3b'))['field'](_0xb6f51f['id'][_0x7d5d('0x42')](),_0x48bc97)[_0x7d5d('0x3f')]('NOW()','createdAt')[_0x7d5d('0x3f')]('NOW()','updatedAt')[_0x7d5d('0x43')](_0x7d5d('0x44'))['where'](_0x7d5d('0x45'))[_0x7d5d('0x46')](_0x7d5d('0x47'),LISTID[_0x7d5d('0x42')]())[_0x7d5d('0x46')]('phone\x20IS\x20NOT\x20NULL')[_0x7d5d('0x46')](_0x7d5d('0x48'),squel[_0x7d5d('0x3e')]()[_0x7d5d('0x3f')](_0x7d5d('0x39'))[_0x7d5d('0x43')](_0x7d5d('0x49'))[_0x7d5d('0x46')](_0x48bc97+_0x7d5d('0x4a'),_0xb6f51f['id']['toString']())))[_0x7d5d('0x42')]();return _0x33f10d;};var _0x22a479=function(_0x4611d5,_0xc85444){var _0x320d96=squel['insert']()[_0x7d5d('0x37')](_0x7d5d('0x49'))[_0x7d5d('0x38')]([_0x7d5d('0x39'),_0x7d5d('0x41'),_0x7d5d('0x3a'),'ListId',_0xc85444,_0x7d5d('0x3c'),_0x7d5d('0x3d')],squel['select']()[_0x7d5d('0x3f')](_0x7d5d('0x39'),'phone')[_0x7d5d('0x3f')](_0x7d5d('0x40'),'scheduledAt')['field']('id','ContactId')['field'](LISTID[_0x7d5d('0x42')](),_0x7d5d('0x3b'))[_0x7d5d('0x3f')](_0x4611d5['id']['toString'](),_0xc85444)[_0x7d5d('0x3f')](_0x7d5d('0x40'),'createdAt')[_0x7d5d('0x3f')](_0x7d5d('0x40'),'updatedAt')[_0x7d5d('0x43')]('cm_contacts')[_0x7d5d('0x46')](_0x7d5d('0x45'))['where'](_0x7d5d('0x47'),LISTID[_0x7d5d('0x42')]())['where'](_0x7d5d('0x4b'),squel['str'](hopperContacts))[_0x7d5d('0x46')](_0x7d5d('0x4c'))[_0x7d5d('0x46')](_0x7d5d('0x48'),squel[_0x7d5d('0x3e')]()[_0x7d5d('0x3f')](_0x7d5d('0x4d'))[_0x7d5d('0x43')]('cm_hopper_final')[_0x7d5d('0x46')](_0xc85444+'\x20=\x20?',_0x4611d5['id'][_0x7d5d('0x42')]()))[_0x7d5d('0x46')](_0x7d5d('0x48'),squel['select']()[_0x7d5d('0x3f')](_0x7d5d('0x39'))[_0x7d5d('0x43')](_0x7d5d('0x49'))['where'](_0xc85444+_0x7d5d('0x4a'),_0x4611d5['id'][_0x7d5d('0x42')]())))[_0x7d5d('0x42')]();return _0x320d96;};function _0x1dc8aa(_0x21f285,_0x4d08a9){var _0x3bcb5c=squel['insert']()[_0x7d5d('0x37')]('cm_hopper')[_0x7d5d('0x38')]([_0x7d5d('0x39'),_0x7d5d('0x41'),_0x7d5d('0x3a'),_0x7d5d('0x3b'),_0x4d08a9,_0x7d5d('0x3c'),_0x7d5d('0x3d')],squel[_0x7d5d('0x3e')]()[_0x7d5d('0x3f')]('phone',_0x7d5d('0x39'))['field'](_0x7d5d('0x40'),_0x7d5d('0x41'))[_0x7d5d('0x3f')]('id',_0x7d5d('0x3a'))[_0x7d5d('0x3f')](LISTID['toString'](),_0x7d5d('0x3b'))[_0x7d5d('0x3f')](_0x21f285['id'][_0x7d5d('0x42')](),_0x4d08a9)['field'](_0x7d5d('0x40'),_0x7d5d('0x3c'))[_0x7d5d('0x3f')](_0x7d5d('0x40'),_0x7d5d('0x3d'))[_0x7d5d('0x43')]('cm_contacts')[_0x7d5d('0x46')](_0x7d5d('0x45'))[_0x7d5d('0x46')](_0x7d5d('0x47'),LISTID[_0x7d5d('0x42')]())[_0x7d5d('0x46')]('id\x20IN\x20?',squel[_0x7d5d('0x4e')](hopperContacts))[_0x7d5d('0x46')](_0x7d5d('0x4c')))[_0x7d5d('0x42')]();return _0x3bcb5c;}function _0x310fa1(_0x3e4565,_0x5864bc){var _0x584fbf=squel[_0x7d5d('0x4f')]()['into'](_0x7d5d('0x50'))[_0x7d5d('0x38')]([_0x7d5d('0x39'),'ContactId',_0x7d5d('0x3b'),_0x5864bc,_0x7d5d('0x3c'),_0x7d5d('0x3d')],squel[_0x7d5d('0x3e')]()[_0x7d5d('0x3f')](_0x7d5d('0x39'),_0x7d5d('0x39'))[_0x7d5d('0x3f')]('id',_0x7d5d('0x3a'))[_0x7d5d('0x3f')](LISTID[_0x7d5d('0x42')](),_0x7d5d('0x3b'))[_0x7d5d('0x3f')](_0x3e4565['id'][_0x7d5d('0x42')](),_0x5864bc)['field'](_0x7d5d('0x40'),'createdAt')[_0x7d5d('0x3f')]('NOW()','updatedAt')[_0x7d5d('0x43')]('cm_contacts')[_0x7d5d('0x46')](_0x7d5d('0x45'))[_0x7d5d('0x46')](_0x7d5d('0x47'),LISTID['toString']())['where'](_0x7d5d('0x4b'),squel['str'](hopperContacts))[_0x7d5d('0x46')](_0x7d5d('0x4c')))['toString']();return _0x584fbf;}return db['VoiceQueue'][_0x7d5d('0x51')]({'where':{'type':_0x7d5d('0x52')},'attributes':['id',_0x7d5d('0x53')],'include':[{'model':db['CmList'],'as':_0x7d5d('0x54'),'where':{'id':LISTID}}]})[_0x7d5d('0x2d')](function(_0x12798d){var _0x5024bb=[];if(_0x12798d){var _0x521a18;for(var _0x4b6284=0x0,_0x1ccecb;_0x4b6284<_0x12798d[_0x7d5d('0x1b')];_0x4b6284+=0x1){_0x1ccecb=_0x12798d[_0x4b6284][_0x7d5d('0x55')]({'plain':!![]});switch(_0x1ccecb[_0x7d5d('0x53')]){case'always':_0x5024bb[_0x7d5d('0x2e')](db[_0x7d5d('0x56')][_0x7d5d('0x57')](_0x22a479(_0x1ccecb,_0x7d5d('0x58')))[_0x7d5d('0x2d')](function(){})['catch'](_0x5c6d72()));break;case _0x7d5d('0x59'):_0x5024bb[_0x7d5d('0x2e')](db[_0x7d5d('0x56')]['query'](_0x4556f5(_0x1ccecb,_0x7d5d('0x58')))['then'](function(){})[_0x7d5d('0x30')](_0x5c6d72()));break;default:_0x5024bb[_0x7d5d('0x2e')](db[_0x7d5d('0x56')][_0x7d5d('0x57')](_0x1dc8aa(_0x1ccecb,'VoiceQueueId'))[_0x7d5d('0x2d')](function(){})[_0x7d5d('0x30')](_0x5c6d72()));}}}return _0x5024bb;})[_0x7d5d('0x5a')]()[_0x7d5d('0x2d')](function(){return db[_0x7d5d('0x5b')][_0x7d5d('0x51')]({'where':{'type':_0x7d5d('0x52')},'attributes':['id'],'include':[{'model':db[_0x7d5d('0x5c')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x2cf6a8){var _0x570291=[];if(_0x2cf6a8){var _0x5cd8fc;for(var _0x43ea86=0x0,_0x409750;_0x43ea86<_0x2cf6a8[_0x7d5d('0x1b')];_0x43ea86+=0x1){_0x409750=_0x2cf6a8[_0x43ea86][_0x7d5d('0x55')]({'plain':!![]});_0x570291[_0x7d5d('0x2e')](db['sequelize'][_0x7d5d('0x57')](_0x310fa1(_0x409750,_0x7d5d('0x58')))[_0x7d5d('0x2d')](function(){})['catch'](_0x5c6d72()));}}return _0x570291;})['all']();})[_0x7d5d('0x2d')](function(){return db['Campaign'][_0x7d5d('0x51')]({'attributes':['id',_0x7d5d('0x53')],'include':[{'model':db[_0x7d5d('0x5c')],'as':_0x7d5d('0x54'),'where':{'id':LISTID}}]})[_0x7d5d('0x2d')](function(_0x524359){var _0x352bcc=[];if(_0x524359){for(var _0x1f2de4=0x0,_0x1fbb50;_0x1f2de4<_0x524359['length'];_0x1f2de4+=0x1){_0x1fbb50=_0x524359[_0x1f2de4][_0x7d5d('0x55')]({'plain':!![]});switch(_0x1fbb50['dialCheckDuplicateType']){case'always':_0x352bcc['push'](db['sequelize']['query'](_0x22a479(_0x1fbb50,_0x7d5d('0x5d')))[_0x7d5d('0x2d')](function(){})['catch'](_0x5c6d72()));break;case'onlyIfOpen':_0x352bcc[_0x7d5d('0x2e')](db[_0x7d5d('0x56')][_0x7d5d('0x57')](_0x4556f5(_0x1fbb50,'CampaignId'))[_0x7d5d('0x2d')](function(){})['catch'](_0x5c6d72()));break;default:_0x352bcc[_0x7d5d('0x2e')](db[_0x7d5d('0x56')]['query'](_0x1dc8aa(_0x1fbb50,_0x7d5d('0x5d')))[_0x7d5d('0x2d')](function(){})[_0x7d5d('0x30')](_0x5c6d72()));}}}return _0x352bcc;})[_0x7d5d('0x5a')]();})[_0x7d5d('0x2d')](function(){return db[_0x7d5d('0x5e')][_0x7d5d('0x51')]({'attributes':['id'],'include':[{'model':db[_0x7d5d('0x5c')],'as':_0x7d5d('0x5f'),'where':{'id':LISTID}}]})['then'](function(_0x4074a1){var _0x48ccb7=[];if(_0x4074a1){for(var _0x74763f=0x0,_0xd08a6e;_0x74763f<_0x4074a1['length'];_0x74763f+=0x1){_0xd08a6e=_0x4074a1[_0x74763f][_0x7d5d('0x55')]({'plain':!![]});_0x48ccb7[_0x7d5d('0x2e')](db[_0x7d5d('0x56')][_0x7d5d('0x57')](_0x310fa1(_0xd08a6e,_0x7d5d('0x5d')))[_0x7d5d('0x2d')](function(){})[_0x7d5d('0x30')](_0x5c6d72()));}}return _0x48ccb7;})['all']();})[_0x7d5d('0x30')](function(_0x7f2f50){logger[_0x7d5d('0x18')](_0x7d5d('0x60'),_0x7d5d('0x61'),_0x7f2f50['message']);});}var processPromises=function(_0x5b8005){return BPromise['all'](promises)[_0x7d5d('0x2d')](function(_0x4847ce){})[_0x7d5d('0x30')](function(_0x29d7c6){logger[_0x7d5d('0x18')]('Error\x20processing\x20rows\x20block:',JSON['stringify'](_0x29d7c6));})[_0x7d5d('0x62')](function(){socket[_0x7d5d('0x63')](_0x7d5d('0x64')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5b8005){return _0x5b8005[_0x7d5d('0x65')]();}});};var endCsv=function(){return BPromise[_0x7d5d('0x66')]()[_0x7d5d('0x2d')](function(){if(hopperContacts){return checkHopper();}})[_0x7d5d('0x2d')](function(){socket[_0x7d5d('0x63')](_0x7d5d('0x64')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x5b896c){logger[_0x7d5d('0x18')](_0x7d5d('0x67'),JSON[_0x7d5d('0x33')](_0x5b896c));}finally{process['exit'](0x0);}});};process['on']('SIGINT',function(){logger[_0x7d5d('0x68')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x7d5d('0x66')]()[_0x7d5d('0x2d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x7d5d('0x2b')][_0x7d5d('0x51')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7d5d('0x2d')](function(_0x465ed3){var _0x475bff=fs[_0x7d5d('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x475bff,{'header':!![],'skipEmptyLines':!![],'step':function(_0x170794,_0x5d5ac6){total+=0x1;var _0x1209d4=total;promises[_0x7d5d('0x2e')](checkRow(_0x170794,_0x465ed3,_0x1209d4)[_0x7d5d('0x2d')](function(){success+=0x1;})[_0x7d5d('0x30')](function(_0x4ec9de){if(_0x4ec9de[_0x7d5d('0x18')]){errors+=0x1;delete _0x4ec9de[_0x7d5d('0x18')];}else if(_0x4ec9de['duplicate']){duplicates+=0x1;delete _0x4ec9de[_0x7d5d('0x2a')];}rows[_0x7d5d('0x2e')](_0x4ec9de);}));if(total%0xc8===0x0){_0x5d5ac6[_0x7d5d('0x6a')]();return processPromises(_0x5d5ac6);}},'complete':function(){return processPromises()['then'](function(){logger[_0x7d5d('0x68')](_0x7d5d('0x6b'));endCsv();});},'error':function(_0x106be6,_0x15df61){logger['info'](_0x7d5d('0x6c'),JSON[_0x7d5d('0x33')](_0x106be6));endCsv();}});})['catch'](function(_0x41c2bc){logger[_0x7d5d('0x18')](_0x7d5d('0x6d'),JSON[_0x7d5d('0x33')](_0x41c2bc));});}main(); \ No newline at end of file +var _0xc8eb=['Missing\x20socket_timestamp\x20parameter!','error','contact','test','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','hasOwnProperty','data','firstName','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','ContactId','field','NOW()','scheduledAt','toString','createdAt','updatedAt','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','select','\x20=\x20?','from','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','findAll','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!'];(function(_0x3e6ae2,_0x5be240){var _0x4e56e5=function(_0x5f0ffd){while(--_0x5f0ffd){_0x3e6ae2['push'](_0x3e6ae2['shift']());}};_0x4e56e5(++_0x5be240);}(_0xc8eb,0x145));var _0xbc8e=function(_0x3bd52b,_0xbbc735){_0x3bd52b=_0x3bd52b-0x0;var _0x1e5b89=_0xc8eb[_0x3bd52b];return _0x1e5b89;};'use strict';var BPromise=require(_0xbc8e('0x0'));var util=require(_0xbc8e('0x1'));var _=require(_0xbc8e('0x2'));var fs=require('fs');var squel=require(_0xbc8e('0x3'));var Papa=require('papaparse');var Redis=require('ioredis');var db=require(_0xbc8e('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0xbc8e('0x5'))(_0xbc8e('0x6'));config[_0xbc8e('0x7')]=_[_0xbc8e('0x8')](config['redis'],{'host':_0xbc8e('0x9'),'port':0x18eb});var socket=require(_0xbc8e('0xa'))(new Redis(config[_0xbc8e('0x7')]));require(_0xbc8e('0xb'))[_0xbc8e('0xc')](socket);try{if(!process['argv'][0x2]||process[_0xbc8e('0xd')][0x2]===_0xbc8e('0xe')||process['argv'][0x2]===_0xbc8e('0xf')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process['argv'][0x3]||process[_0xbc8e('0xd')][0x3]===_0xbc8e('0xe')||process['argv'][0x3]==='null'||!process[_0xbc8e('0xd')][0x4]||process[_0xbc8e('0xd')][0x4]===_0xbc8e('0xe')||process[_0xbc8e('0xd')][0x4]==='null'){throw new Error(_0xbc8e('0x10'));}var FIELDS=_[_0xbc8e('0x11')](process[_0xbc8e('0xd')][0x3]['split'](','),process[_0xbc8e('0xd')][0x4][_0xbc8e('0x12')](','));if(!process['argv'][0x5]||process['argv'][0x5]==='undefined'||process[_0xbc8e('0xd')][0x5]===_0xbc8e('0xf')){throw new Error(_0xbc8e('0x13'));}var LISTID=process[_0xbc8e('0xd')][0x5];var COMPANYID=process[_0xbc8e('0xd')][0x6]&&process[_0xbc8e('0xd')][0x6]!==_0xbc8e('0xe')&&process[_0xbc8e('0xd')][0x6]!=='null'?process['argv'][0x6]:null;var DUPLICATES=process[_0xbc8e('0xd')][0x7]&&process[_0xbc8e('0xd')][0x7]!=='undefined'&&process['argv'][0x7]!==_0xbc8e('0xf')?process[_0xbc8e('0xd')][0x7]:null;if(!process['argv'][0x8]||process[_0xbc8e('0xd')][0x8]===_0xbc8e('0xe')||process[_0xbc8e('0xd')][0x8]===_0xbc8e('0xf')){throw new Error(_0xbc8e('0x14'));}var SOCKET_TIMESTAMP=process[_0xbc8e('0xd')][0x8];}catch(_0x58a2da){logger[_0xbc8e('0x15')](_0x58a2da);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(_0x31c47d,_0x1c6ac5,_0x40c87c,_0x354a5d){var _0xb1b7f0={'message':_0x1c6ac5};_0xb1b7f0[_0x31c47d]=!![];if(_0x40c87c){_0xb1b7f0[_0xbc8e('0x16')]=_0x40c87c;}if(_0x354a5d){_0xb1b7f0['index']=_0x354a5d;}return _0xb1b7f0;}function isEmail(_0x35d160){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))*$/[_0xbc8e('0x17')](_0x35d160);}function checkRow(_0x33d9bc,_0x3190ac,_0xf1f859){return new BPromise(function(_0x44fd95,_0x15a512){if(_['isNil'](_0x33d9bc)){return _0x15a512(handleCheckRowError(_0xbc8e('0x15'),_0xbc8e('0x18'),null,_0xf1f859));}if(_0x33d9bc['errors']&&_0x33d9bc[_0xbc8e('0x19')][_0xbc8e('0x1a')]){var _0x2acf51=_[_0xbc8e('0x1b')](_0x33d9bc['errors'],_0xbc8e('0x1c'))['join'](';');return _0x15a512(handleCheckRowError(_0xbc8e('0x15'),_0x2acf51,null,_0xf1f859));}var _0x34e342={};for(var _0x381037 in FIELDS){if(FIELDS[_0xbc8e('0x1d')](_0x381037)&&FIELDS[_0x381037]){_0x34e342[_0x381037]=_0x33d9bc[_0xbc8e('0x1e')][0x0][FIELDS[_0x381037]]||_0x33d9bc[_0xbc8e('0x1e')][0x0]['\ufeff'+FIELDS[_0x381037]];}}if(!_0x34e342[_0xbc8e('0x1f')]){return _0x15a512(handleCheckRowError(_0xbc8e('0x15'),'firstName\x20not\x20specified!',null,_0xf1f859));}if(!_0x34e342[_0xbc8e('0x20')]){return _0x15a512(handleCheckRowError('error',_0xbc8e('0x21'),null,_0xf1f859));}if(_0x34e342['birthDate']){var _0x59283f=moment(_0x34e342[_0xbc8e('0x22')],_0xbc8e('0x23'));if(!_0x59283f['isValid']()){return _0x15a512(handleCheckRowError(_0xbc8e('0x15'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0xf1f859));}}if(_0x34e342[_0xbc8e('0x24')]){if(!isEmail(_0x34e342[_0xbc8e('0x24')])){return _0x15a512(handleCheckRowError(_0xbc8e('0x15'),_0xbc8e('0x25'),null,_0xf1f859));}}_0x34e342[_0xbc8e('0x26')]=LISTID;_0x34e342[_0xbc8e('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xbc8e('0x1a')]&&_0x3190ac){var _0x4a4591={};for(var _0x47e6ee=0x0,_0x2f7cb1=DUPLICATES[_0xbc8e('0x1a')];_0x47e6ee<_0x2f7cb1;_0x47e6ee+=0x1){_0x4a4591[DUPLICATES[_0x47e6ee]]=_0x34e342[DUPLICATES[_0x47e6ee]];}var _0x5ccaaa=_[_0xbc8e('0x28')](_0x3190ac,_0x4a4591);if(_0x5ccaaa){return _0x15a512(handleCheckRowError(_0xbc8e('0x29'),_0xbc8e('0x2a'),_0x5ccaaa,_0xf1f859));}}return db[_0xbc8e('0x2b')][_0xbc8e('0x2c')](_0x34e342,{'raw':!![],'hooks':![],'fields':_[_0xbc8e('0x2d')](_0x34e342)})[_0xbc8e('0x2e')](function(_0x3d41bc){if(DUPLICATES&&DUPLICATES[_0xbc8e('0x1a')]&&_0x3190ac){_0x3190ac[_0xbc8e('0x2f')](_[_0xbc8e('0x30')](_0x34e342,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3d41bc['id'];return _0x44fd95();})[_0xbc8e('0x31')](function(_0x4d8b1c){return _0x15a512(handleCheckRowError(_0xbc8e('0x15'),_0xbc8e('0x32')+(_0x4d8b1c[_0xbc8e('0x1c')]||JSON[_0xbc8e('0x33')](_0x4d8b1c)),null,_0xf1f859));});});}function checkHopper(){function _0x13f2c0(){return function(_0x416368){logger['error'](_0xbc8e('0x34'),_0xbc8e('0x35'),util[_0xbc8e('0x36')](_0x416368,{'showHidden':![],'depth':null}));};}var _0x3e9e84=function(_0x51f459,_0x2db939){var _0x2ab29e=squel[_0xbc8e('0x37')]()[_0xbc8e('0x38')](_0xbc8e('0x39'))[_0xbc8e('0x3a')](['phone','scheduledAt',_0xbc8e('0x3b'),_0xbc8e('0x26'),_0x2db939,'createdAt','updatedAt'],squel['select']()[_0xbc8e('0x3c')]('phone','phone')[_0xbc8e('0x3c')](_0xbc8e('0x3d'),_0xbc8e('0x3e'))[_0xbc8e('0x3c')]('id','ContactId')[_0xbc8e('0x3c')](LISTID['toString'](),_0xbc8e('0x26'))[_0xbc8e('0x3c')](_0x51f459['id'][_0xbc8e('0x3f')](),_0x2db939)[_0xbc8e('0x3c')](_0xbc8e('0x3d'),_0xbc8e('0x40'))[_0xbc8e('0x3c')](_0xbc8e('0x3d'),_0xbc8e('0x41'))['from'](_0xbc8e('0x42'))[_0xbc8e('0x43')](_0xbc8e('0x44'))[_0xbc8e('0x43')](_0xbc8e('0x45'),LISTID[_0xbc8e('0x3f')]())['where']('phone\x20IS\x20NOT\x20NULL')['where'](_0xbc8e('0x46'),squel[_0xbc8e('0x47')]()['field'](_0xbc8e('0x20'))['from'](_0xbc8e('0x39'))['where'](_0x2db939+_0xbc8e('0x48'),_0x51f459['id'][_0xbc8e('0x3f')]())))[_0xbc8e('0x3f')]();return _0x2ab29e;};var _0x1ddd87=function(_0x43792f,_0x2bcaab){var _0x5e2603=squel['insert']()['into'](_0xbc8e('0x39'))['fromQuery']([_0xbc8e('0x20'),'scheduledAt',_0xbc8e('0x3b'),_0xbc8e('0x26'),_0x2bcaab,_0xbc8e('0x40'),'updatedAt'],squel[_0xbc8e('0x47')]()[_0xbc8e('0x3c')](_0xbc8e('0x20'),_0xbc8e('0x20'))['field'](_0xbc8e('0x3d'),_0xbc8e('0x3e'))[_0xbc8e('0x3c')]('id',_0xbc8e('0x3b'))[_0xbc8e('0x3c')](LISTID[_0xbc8e('0x3f')](),'ListId')[_0xbc8e('0x3c')](_0x43792f['id'][_0xbc8e('0x3f')](),_0x2bcaab)['field']('NOW()',_0xbc8e('0x40'))[_0xbc8e('0x3c')]('NOW()',_0xbc8e('0x41'))[_0xbc8e('0x49')](_0xbc8e('0x42'))[_0xbc8e('0x43')](_0xbc8e('0x44'))[_0xbc8e('0x43')](_0xbc8e('0x45'),LISTID[_0xbc8e('0x3f')]())[_0xbc8e('0x43')](_0xbc8e('0x4a'),squel[_0xbc8e('0x4b')](hopperContacts))['where'](_0xbc8e('0x4c'))[_0xbc8e('0x43')]('phone\x20NOT\x20IN\x20(?)',squel[_0xbc8e('0x47')]()['field'](_0xbc8e('0x4d'))[_0xbc8e('0x49')](_0xbc8e('0x4e'))['where'](_0x2bcaab+_0xbc8e('0x48'),_0x43792f['id'][_0xbc8e('0x3f')]()))[_0xbc8e('0x43')](_0xbc8e('0x46'),squel['select']()[_0xbc8e('0x3c')](_0xbc8e('0x20'))[_0xbc8e('0x49')](_0xbc8e('0x39'))[_0xbc8e('0x43')](_0x2bcaab+_0xbc8e('0x48'),_0x43792f['id'][_0xbc8e('0x3f')]())))[_0xbc8e('0x3f')]();return _0x5e2603;};function _0x51dcdc(_0x4f5faa,_0x56fe2d){var _0xc006c6=squel[_0xbc8e('0x37')]()[_0xbc8e('0x38')](_0xbc8e('0x39'))[_0xbc8e('0x3a')](['phone','scheduledAt','ContactId',_0xbc8e('0x26'),_0x56fe2d,_0xbc8e('0x40'),_0xbc8e('0x41')],squel[_0xbc8e('0x47')]()[_0xbc8e('0x3c')](_0xbc8e('0x20'),'phone')[_0xbc8e('0x3c')](_0xbc8e('0x3d'),'scheduledAt')[_0xbc8e('0x3c')]('id',_0xbc8e('0x3b'))['field'](LISTID[_0xbc8e('0x3f')](),_0xbc8e('0x26'))[_0xbc8e('0x3c')](_0x4f5faa['id'][_0xbc8e('0x3f')](),_0x56fe2d)[_0xbc8e('0x3c')](_0xbc8e('0x3d'),_0xbc8e('0x40'))[_0xbc8e('0x3c')](_0xbc8e('0x3d'),_0xbc8e('0x41'))['from'](_0xbc8e('0x42'))[_0xbc8e('0x43')]('deletedAt\x20IS\x20NULL')['where'](_0xbc8e('0x45'),LISTID[_0xbc8e('0x3f')]())[_0xbc8e('0x43')](_0xbc8e('0x4a'),squel[_0xbc8e('0x4b')](hopperContacts))[_0xbc8e('0x43')](_0xbc8e('0x4c')))['toString']();return _0xc006c6;}function _0x2e3041(_0x444c2f,_0x3e23bc){var _0x8d17ae=squel[_0xbc8e('0x37')]()[_0xbc8e('0x38')](_0xbc8e('0x4f'))[_0xbc8e('0x3a')]([_0xbc8e('0x20'),_0xbc8e('0x3b'),_0xbc8e('0x26'),_0x3e23bc,'createdAt',_0xbc8e('0x41')],squel[_0xbc8e('0x47')]()[_0xbc8e('0x3c')](_0xbc8e('0x20'),'phone')[_0xbc8e('0x3c')]('id',_0xbc8e('0x3b'))['field'](LISTID[_0xbc8e('0x3f')](),_0xbc8e('0x26'))['field'](_0x444c2f['id'][_0xbc8e('0x3f')](),_0x3e23bc)[_0xbc8e('0x3c')](_0xbc8e('0x3d'),_0xbc8e('0x40'))[_0xbc8e('0x3c')]('NOW()','updatedAt')[_0xbc8e('0x49')](_0xbc8e('0x42'))[_0xbc8e('0x43')]('deletedAt\x20IS\x20NULL')[_0xbc8e('0x43')](_0xbc8e('0x45'),LISTID[_0xbc8e('0x3f')]())[_0xbc8e('0x43')](_0xbc8e('0x4a'),squel['str'](hopperContacts))[_0xbc8e('0x43')](_0xbc8e('0x4c')))[_0xbc8e('0x3f')]();return _0x8d17ae;}return db[_0xbc8e('0x50')]['findAll']({'where':{'type':_0xbc8e('0x51')},'attributes':['id',_0xbc8e('0x52')],'include':[{'model':db[_0xbc8e('0x53')],'as':_0xbc8e('0x54'),'where':{'id':LISTID}}]})[_0xbc8e('0x2e')](function(_0x2ea83f){var _0x1d7870=[];if(_0x2ea83f){var _0x578553;for(var _0x14f1f3=0x0,_0x2a2d84;_0x14f1f3<_0x2ea83f['length'];_0x14f1f3+=0x1){_0x2a2d84=_0x2ea83f[_0x14f1f3][_0xbc8e('0x55')]({'plain':!![]});switch(_0x2a2d84[_0xbc8e('0x52')]){case _0xbc8e('0x56'):_0x1d7870[_0xbc8e('0x2f')](db[_0xbc8e('0x57')]['query'](_0x1ddd87(_0x2a2d84,_0xbc8e('0x58')))[_0xbc8e('0x2e')](function(){})[_0xbc8e('0x31')](_0x13f2c0()));break;case _0xbc8e('0x59'):_0x1d7870[_0xbc8e('0x2f')](db['sequelize'][_0xbc8e('0x5a')](_0x3e9e84(_0x2a2d84,_0xbc8e('0x58')))[_0xbc8e('0x2e')](function(){})['catch'](_0x13f2c0()));break;default:_0x1d7870['push'](db[_0xbc8e('0x57')][_0xbc8e('0x5a')](_0x51dcdc(_0x2a2d84,_0xbc8e('0x58')))['then'](function(){})['catch'](_0x13f2c0()));}}}return _0x1d7870;})[_0xbc8e('0x5b')]()[_0xbc8e('0x2e')](function(){return db[_0xbc8e('0x50')][_0xbc8e('0x5c')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xbc8e('0x53')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xbc8e('0x2e')](function(_0x2b50d7){var _0x1c2706=[];if(_0x2b50d7){var _0x3bea7e;for(var _0x39b6c8=0x0,_0x5db8c3;_0x39b6c8<_0x2b50d7[_0xbc8e('0x1a')];_0x39b6c8+=0x1){_0x5db8c3=_0x2b50d7[_0x39b6c8][_0xbc8e('0x55')]({'plain':!![]});_0x1c2706['push'](db[_0xbc8e('0x57')]['query'](_0x2e3041(_0x5db8c3,'VoiceQueueId'))[_0xbc8e('0x2e')](function(){})[_0xbc8e('0x31')](_0x13f2c0()));}}return _0x1c2706;})[_0xbc8e('0x5b')]();})['then'](function(){return db[_0xbc8e('0x5d')][_0xbc8e('0x5c')]({'attributes':['id',_0xbc8e('0x52')],'include':[{'model':db[_0xbc8e('0x53')],'as':_0xbc8e('0x54'),'where':{'id':LISTID}}]})['then'](function(_0x4fa806){var _0x102d6d=[];if(_0x4fa806){for(var _0x292726=0x0,_0xc2dd89;_0x292726<_0x4fa806[_0xbc8e('0x1a')];_0x292726+=0x1){_0xc2dd89=_0x4fa806[_0x292726][_0xbc8e('0x55')]({'plain':!![]});switch(_0xc2dd89[_0xbc8e('0x52')]){case _0xbc8e('0x56'):_0x102d6d['push'](db[_0xbc8e('0x57')][_0xbc8e('0x5a')](_0x1ddd87(_0xc2dd89,_0xbc8e('0x5e')))[_0xbc8e('0x2e')](function(){})[_0xbc8e('0x31')](_0x13f2c0()));break;case _0xbc8e('0x59'):_0x102d6d[_0xbc8e('0x2f')](db[_0xbc8e('0x57')][_0xbc8e('0x5a')](_0x3e9e84(_0xc2dd89,_0xbc8e('0x5e')))['then'](function(){})[_0xbc8e('0x31')](_0x13f2c0()));break;default:_0x102d6d[_0xbc8e('0x2f')](db[_0xbc8e('0x57')][_0xbc8e('0x5a')](_0x51dcdc(_0xc2dd89,_0xbc8e('0x5e')))['then'](function(){})[_0xbc8e('0x31')](_0x13f2c0()));}}}return _0x102d6d;})[_0xbc8e('0x5b')]();})[_0xbc8e('0x2e')](function(){return db[_0xbc8e('0x5d')]['findAll']({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0xbc8e('0x2e')](function(_0x168a87){var _0x5075b5=[];if(_0x168a87){for(var _0x19ddf2=0x0,_0x12aa5c;_0x19ddf2<_0x168a87[_0xbc8e('0x1a')];_0x19ddf2+=0x1){_0x12aa5c=_0x168a87[_0x19ddf2][_0xbc8e('0x55')]({'plain':!![]});_0x5075b5[_0xbc8e('0x2f')](db[_0xbc8e('0x57')][_0xbc8e('0x5a')](_0x2e3041(_0x12aa5c,_0xbc8e('0x5e')))[_0xbc8e('0x2e')](function(){})['catch'](_0x13f2c0()));}}return _0x5075b5;})['all']();})[_0xbc8e('0x31')](function(_0x59035d){logger[_0xbc8e('0x15')](_0xbc8e('0x5f'),_0xbc8e('0x60'),_0x59035d[_0xbc8e('0x1c')]);});}var processPromises=function(_0x5d489e){return BPromise[_0xbc8e('0x5b')](promises)['then'](function(_0x22847c){})[_0xbc8e('0x31')](function(_0x1d5c72){logger[_0xbc8e('0x15')](_0xbc8e('0x61'),JSON[_0xbc8e('0x33')](_0x1d5c72));})[_0xbc8e('0x62')](function(){socket['emit'](_0xbc8e('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5d489e){return _0x5d489e[_0xbc8e('0x64')]();}});};var endCsv=function(){return BPromise[_0xbc8e('0x65')]()[_0xbc8e('0x2e')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xbc8e('0x66')](_0xbc8e('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xbc8e('0x67')](FILEPATH);}catch(_0x4549ff){logger[_0xbc8e('0x15')](_0xbc8e('0x68'),JSON[_0xbc8e('0x33')](_0x4549ff));}finally{process[_0xbc8e('0x69')](0x0);}});};process['on'](_0xbc8e('0x6a'),function(){logger['info'](_0xbc8e('0x6b'));endCsv();});function main(){return BPromise['resolve']()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xbc8e('0x12')](',');return db['CmContact'][_0xbc8e('0x5c')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xbc8e('0x2e')](function(_0x2766ae){var _0x3df421=fs[_0xbc8e('0x6c')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xbc8e('0x6d')](_0x3df421,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5682a6,_0x1139a0){total+=0x1;var _0x33fba3=total;promises[_0xbc8e('0x2f')](checkRow(_0x5682a6,_0x2766ae,_0x33fba3)['then'](function(){success+=0x1;})['catch'](function(_0x275484){if(_0x275484[_0xbc8e('0x15')]){errors+=0x1;delete _0x275484[_0xbc8e('0x15')];}else if(_0x275484[_0xbc8e('0x29')]){duplicates+=0x1;delete _0x275484[_0xbc8e('0x29')];}rows[_0xbc8e('0x2f')](_0x275484);}));if(total%0xc8===0x0){_0x1139a0[_0xbc8e('0x6e')]();return processPromises(_0x1139a0);}},'complete':function(){return processPromises()[_0xbc8e('0x2e')](function(){logger[_0xbc8e('0x6f')](_0xbc8e('0x70'));endCsv();});},'error':function(_0x34b5d0,_0x54a1ff){logger[_0xbc8e('0x6f')](_0xbc8e('0x71'),JSON[_0xbc8e('0x33')](_0x34b5d0));endCsv();}});})[_0xbc8e('0x31')](function(_0x52a733){logger[_0xbc8e('0x15')](_0xbc8e('0x72'),JSON[_0xbc8e('0x33')](_0x52a733));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index f68700d..a522322 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 _0x909f=['data','length','rows','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','isNaN','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','appendFileSync','Abort\x20parser','abort','step','duplicates','cm_contacts_','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns','CampaignId','campaigns_has_cm_blacklists','then','finish','affectedRows','exit','complete','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','papaparse','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','select','field','phone','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_hopper','toString','cm_hopper_black','cm_contacts.phone\x20NOT\x20IN\x20(?)','ListId\x20=\x20?','\x20=\x20?','concat','keys','CompanyId','into','id\x20IN\x20?','group','info','Received\x20SIGINT','error','errors','push','code','message','sequelize','query','catch','main','stringify','send','start','binding','socket_timestamp','root','header','parse','createReadStream'];(function(_0x3acf0d,_0x3f2eb9){var _0x50c10d=function(_0x44756e){while(--_0x44756e){_0x3acf0d['push'](_0x3acf0d['shift']());}};_0x50c10d(++_0x3f2eb9);}(_0x909f,0xb0));var _0xf909=function(_0x5d0739,_0xc8f432){_0x5d0739=_0x5d0739-0x0;var _0x3a5bb4=_0x909f[_0x5d0739];return _0x3a5bb4;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0xf909('0x0'));var util=require('util');var BPromise=require(_0xf909('0x1'));var moment=require(_0xf909('0x2'));var squel=require('squel');var Redis=require(_0xf909('0x3'));var db=require(_0xf909('0x4'))['db'];var config=require(_0xf909('0x5'));var logger=require(_0xf909('0x6'))('import');config[_0xf909('0x7')]=_[_0xf909('0x8')](config[_0xf909('0x7')],{'host':_0xf909('0x9'),'port':0x18eb});var socket=require(_0xf909('0xa'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xf909('0xb')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x21c80e){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'](_0x21c80e);}function selectNotIn(_0x48bdf6,_0x53c141,_0x5404ed,_0x2afcd1,_0x4b8df7){return squel[_0xf909('0xc')]()[_0xf909('0xd')](_0xf909('0xe'))[_0xf909('0xf')](_0x2afcd1)['join'](_0x53c141,null,_0x53c141+_0xf909('0x10')+_0x2afcd1+'.'+_0x5404ed)[_0xf909('0x11')](_0x2afcd1+'.'+_0x5404ed+_0xf909('0x12')+_0x48bdf6+'.'+_0x5404ed)['where'](_0x53c141+_0xf909('0x13')+_0x4b8df7[_0xf909('0x14')]()+')');}function insertCmHopper(_0x245967,_0x111581,_0x2868d3,_0x3f006a,_0x56ed16){var _0x3847a0=[_0xf909('0x15'),_0xf909('0x16'),_0xf909('0x17'),_0xf909('0x18'),_0x111581+'.'+_0x3f006a,_0xf909('0x19'),_0xf909('0x1a'),_0xf909('0x1b'),_0xf909('0x1c'),'\x22'+_0x56ed16+'\x22'];return squel[_0xf909('0x1d')]()['into']('cm_hopper')[_0xf909('0x1e')]([_0xf909('0xe'),_0xf909('0x1f'),_0xf909('0x20'),_0xf909('0x21'),_0x3f006a,_0xf909('0x22'),_0xf909('0x23'),_0xf909('0x24'),_0xf909('0x25'),_0xf909('0x26')],squel[_0xf909('0xc')]()[_0xf909('0x27')](_0x3847a0)['from'](_0x111581)[_0xf909('0x14')](_0xf909('0x28'),null,_0xf909('0x29')+_0x111581+_0xf909('0x2a'))[_0xf909('0x14')](_0x2868d3,null,_0x2868d3+_0xf909('0x10')+_0x111581+'.'+_0x3f006a)[_0xf909('0x11')](_0x111581+'.CmListId\x20=\x20?',_0x245967)[_0xf909('0x11')](_0xf909('0x2b'),NOW)[_0xf909('0x11')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x111581,_0x2868d3,_0x3f006a,_0xf909('0x2c'),['\x22always\x22','\x22onlyIfOpen\x22']))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x111581,_0x2868d3,_0x3f006a,_0xf909('0x2c'),['\x22always\x22'])))[_0xf909('0x2d')]();}function insertCmHopperBlack(_0x5a4d5b,_0x33991d,_0x4c8ff5,_0x21e1fd){var _0x5d3a78=[_0xf909('0x15'),_0xf909('0x17'),_0xf909('0x18'),_0x33991d+'.'+_0x21e1fd,_0xf909('0x19'),_0xf909('0x1a')];return squel[_0xf909('0x1d')]()['into'](_0xf909('0x2e'))[_0xf909('0x1e')]([_0xf909('0xe'),'ContactId',_0xf909('0x21'),_0x21e1fd,_0xf909('0x22'),'updatedAt'],squel[_0xf909('0xc')]()[_0xf909('0x27')](_0x5d3a78)[_0xf909('0xf')](_0x33991d)[_0xf909('0x14')](_0xf909('0x28'),null,_0xf909('0x29')+_0x33991d+_0xf909('0x2a'))[_0xf909('0x14')](_0x4c8ff5,null,_0x4c8ff5+_0xf909('0x10')+_0x33991d+'.'+_0x21e1fd)[_0xf909('0x11')](_0x33991d+'.CmListId\x20=\x20?',_0x5a4d5b)[_0xf909('0x11')](_0xf909('0x2b'),NOW)['where'](_0xf909('0x2f'),squel['select']()[_0xf909('0xd')](_0xf909('0xe'))['from']('cm_hopper_black')[_0xf909('0x11')](_0xf909('0x30'),_0x5a4d5b)[_0xf909('0x11')](_0x21e1fd+_0xf909('0x31'),_0x33991d+'.'+_0x21e1fd)))[_0xf909('0x2d')]();}function insertCmContact(_0x3c13ca,_0xa1982b,_0x2e9741,_0x1707d4){var _0x12a6bb=_[_0xf909('0x32')](_[_0xf909('0x33')](_0x1707d4),[_0xf909('0x21'),_0xf909('0x34'),_0xf909('0x22'),'updatedAt']);return squel[_0xf909('0x1d')]()[_0xf909('0x35')](_0xf909('0x28'))[_0xf909('0x1e')](_0x12a6bb,squel[_0xf909('0xc')]()['fields'](_0x12a6bb)['from'](_0xa1982b)[_0xf909('0x11')]('('+_0x2e9741[_0xf909('0x14')](',')+')\x20NOT\x20IN\x20?',squel[_0xf909('0xc')]()[_0xf909('0x27')](_0x2e9741)[_0xf909('0xf')](_0xf909('0x28'))[_0xf909('0x11')](_0xf909('0x30'),_0x3c13ca))[_0xf909('0x11')](_0xf909('0x36'),squel['select']()['field']('MIN(id)','min_id')['from'](_0xa1982b)[_0xf909('0x37')](_0x2e9741[_0xf909('0x14')](','))))[_0xf909('0x2d')]();}function handleStop(){logger[_0xf909('0x38')](_0xf909('0x39'));stopped=!![];}function handleUncaughtException(_0x14a7ad){logger[_0xf909('0x3a')](_0x14a7ad['message']);process['exit'](0x1);}function handleError(_0x4633c8,_0x583f35){stats[_0xf909('0x3b')][_0xf909('0x3c')]({'name':_0x583f35[_0xf909('0x3d')],'message':_0x583f35[_0xf909('0x3e')],'row':_0x4633c8});}function handleQuery(_0x2ca94d){logger[_0xf909('0x38')](_0x2ca94d);return db[_0xf909('0x3f')][_0xf909('0x40')](_0x2ca94d)['spread'](function(_0x5e21bf){results[_0xf909('0x3c')](_0x5e21bf);})[_0xf909('0x41')](function(_0x1569e6){logger[_0xf909('0x3a')](_0x1569e6[_0xf909('0x3e')]);});}function main(_0x22e6b5,_0x4b3ce9,_0x2b0019,_0x25b8ec){logger['info'](_0xf909('0x42'),_0x22e6b5,JSON[_0xf909('0x43')](_0x4b3ce9));process[_0xf909('0x44')](_0xf909('0x45'));var _0x470ee3=_0x4b3ce9[_0xf909('0x46')];var _0xed340e=_0x4b3ce9[_0xf909('0x47')];var _0x48ef03=path[_0xf909('0x14')](config[_0xf909('0x48')],'server/files/tmp',_0xed340e+'.csv');var _0x10c7e0=_[_0xf909('0x33')](_0x470ee3)[_0xf909('0x14')]();logger[_0xf909('0x38')](_0xf909('0x49'),_0x10c7e0);fs['writeFileSync'](_0x48ef03,_0x10c7e0+'\x0a');Papa[_0xf909('0x4a')](fs[_0xf909('0x4b')](_0x22e6b5),{'header':!![],'skipEmptyLines':!![],'step':function(_0xb154d4,_0x1bf071){try{for(var _0x43ea0b=0x0,_0x4cd624=[];_0x43ea0b<_0xb154d4[_0xf909('0x4c')][_0xf909('0x4d')];_0x43ea0b++){stats[_0xf909('0x4e')]+=0x1;if(_0xb154d4[_0xf909('0x3b')][_0x43ea0b]){handleError(_0xb154d4[_0xf909('0x4c')][_0x43ea0b],_0xb154d4[_0xf909('0x3b')][_0x43ea0b]);}else{var _0x4ab8cd=[];for(var _0x5669f6 in _0x470ee3){if(_0x470ee3[_0xf909('0x4f')](_0x5669f6)){if(_0xb154d4[_0xf909('0x4c')][_0x43ea0b][_0x470ee3[_0x5669f6]]){var _0x50156f=_[_0xf909('0x50')](_0xb154d4[_0xf909('0x4c')][_0x43ea0b][_0x470ee3[_0x5669f6]][_0xf909('0x51')](/"/g,'\x27'));switch(_0x5669f6){case _0xf909('0x1f'):var _0x260747=moment(_0x50156f,_0xf909('0x52'),!![]);if(_0x260747[_0xf909('0x53')]()){_0x4cd624[_0xf909('0x3c')]('\x22'+_0x50156f+'\x22');}else{_0x4ab8cd[_0xf909('0x3c')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xf909('0x24'):var _0x2fc780=parseInt(_0x50156f);_0x50156f=_[_0xf909('0x54')](_0x2fc780)||_0x2fc780<0x0||_0x2fc780>0x4?_0x25b8ec?0x3:0x2:_0x2fc780;_0x4cd624[_0xf909('0x3c')]('\x22'+_0x50156f+'\x22');break;case _0xf909('0x25'):var _0x35a68d=parseInt(_0x50156f);if(_[_0xf909('0x55')](_0x35a68d)&&_[_0xf909('0x56')](_0x2b0019,_0x35a68d)){_0x4cd624[_0xf909('0x3c')]('\x22'+_0x35a68d+'\x22');}else{_0x4ab8cd[_0xf909('0x3c')](_0xf909('0x57'));}break;case _0xf909('0x58'):if(isEmail(_0x50156f)){_0x4cd624[_0xf909('0x3c')]('\x22'+_0x50156f+'\x22');}else{_0x4ab8cd[_0xf909('0x3c')]('email\x20wrong\x20format');}break;case _0xf909('0x59'):var _0x23bb05=moment(_0x50156f,_0xf909('0x5a'),!![]);if(_0x23bb05['isValid']()){_0x4cd624['push']('\x22'+_0x50156f+'\x22');}else{_0x4ab8cd['push'](_0xf909('0x5b'));}break;default:_0x4cd624['push']('\x22'+_0x50156f+'\x22');}}else{switch(_0x5669f6){case _0xf909('0x5c'):case _0xf909('0xe'):_0x4ab8cd['push'](_0x5669f6+_0xf909('0x5d'));break;default:_0x4cd624[_0xf909('0x3c')]('\x22\x22');}}}}if(_0x4ab8cd['length']){handleError(_0xb154d4[_0xf909('0x4c')][_0x43ea0b],{'code':'SystemRow','message':_0x4ab8cd[_0xf909('0x14')]()});}else{fs[_0xf909('0x5e')](_0x48ef03,_0x4cd624['join']()+'\x0a');}_0x4cd624=[];}if(!(stats['rows']%0xc8)){socket['emit']('contact:import:'+_0xed340e,stats);stats[_0xf909('0x3b')]=[];}}if(stopped){logger[_0xf909('0x38')](_0xf909('0x5f'));_0x1bf071[_0xf909('0x60')]();}}catch(_0x1bfb94){handleError(_0xb154d4[_0xf909('0x4c')][_0x43ea0b],{'code':'SystemError','message':_0x1bfb94['message']});logger[_0xf909('0x3a')](_0xf909('0x61'),_0x1bfb94[_0xf909('0x3e')]);}},'complete':function(){try{var _0x906af5=[];var _0x4f5655=_0xf909('0x28');if(_0x4b3ce9[_0xf909('0x62')]&&_0x4b3ce9['duplicates']['length']){_0x4f5655=_0xf909('0x63')+_0xed340e;_0x906af5[_0xf909('0x3c')]('CREATE\x20TABLE\x20'+_0x4f5655+'\x20LIKE\x20cm_contacts;');}var _0x235ae9=util['format'](_0xf909('0x64'),_0x48ef03,_0x4f5655,_0x10c7e0,_0x4b3ce9[_0xf909('0x21')],_0x4b3ce9[_0xf909('0x34')]||null,NOW,NOW);if(_['isNil'](_0x470ee3[_0xf909('0x1f')])){_0x235ae9+=_0xf909('0x65');}_0x906af5[_0xf909('0x3c')](_0x235ae9);if(_0x4b3ce9['duplicates']&&_0x4b3ce9[_0xf909('0x62')][_0xf909('0x4d')]){_0x906af5[_0xf909('0x3c')](insertCmContact(_0x4b3ce9[_0xf909('0x21')],_0x4f5655,_0x4b3ce9[_0xf909('0x62')],_0x470ee3));_0x906af5[_0xf909('0x3c')](_0xf909('0x66')+_0x4f5655+';');}_0x906af5[_0xf909('0x3c')](insertCmHopper(_0x4b3ce9[_0xf909('0x21')],'voice_queues_has_cm_lists',_0xf909('0x67'),_0xf909('0x68'),_0x25b8ec));_0x906af5[_0xf909('0x3c')](insertCmHopperBlack(_0x4b3ce9[_0xf909('0x21')],_0xf909('0x69'),_0xf909('0x67'),'VoiceQueueId'));_0x906af5[_0xf909('0x3c')](insertCmHopper(_0x4b3ce9[_0xf909('0x21')],'campaigns_has_cm_lists',_0xf909('0x6a'),_0xf909('0x6b'),_0x25b8ec));_0x906af5['push'](insertCmHopperBlack(_0x4b3ce9[_0xf909('0x21')],_0xf909('0x6c'),_0xf909('0x6a'),_0xf909('0x6b')));BPromise['each'](_0x906af5,handleQuery)[_0xf909('0x6d')](function(_0x5d661c){stats[_0xf909('0x6e')]=!![];stats[_0xf909('0x6f')]=_0x4b3ce9[_0xf909('0x62')]&&_0x4b3ce9[_0xf909('0x62')][_0xf909('0x4d')]?results[0x2]['affectedRows']:results[0x0]['affectedRows'];socket['emit']('contact:import:'+_0xed340e,stats);fs['unlink'](_0x22e6b5);fs['unlink'](_0x48ef03);process[_0xf909('0x70')](0x0);})[_0xf909('0x41')](function(_0xb58002){logger[_0xf909('0x3a')](_0xb58002[_0xf909('0x3e')]);process['exit'](0x1);});}catch(_0xc93095){logger[_0xf909('0x3a')](_0xf909('0x71'),_0xc93095['message']);process[_0xf909('0x70')](0x1);}},'error':function(_0x4ac664,_0x47079d,_0x2515a7,_0x3d242e){throw new Error(_0x3d242e);}});}function validate(){if(process['argv']&&process[_0xf909('0x72')][_0xf909('0x4d')]<0x4){throw new Error(_0xf909('0x73'));}var _0x6b36a6=path[_0xf909('0x14')](config[_0xf909('0x48')],_0xf909('0x74'),process[_0xf909('0x72')][0x2]);if(!fs[_0xf909('0x75')](_0x6b36a6)){throw new Error(_0xf909('0x76'));}var _0x35d22b={};try{_0x35d22b=JSON[_0xf909('0x4a')](process[_0xf909('0x72')][0x3]);if(!_0x35d22b[_0xf909('0x46')]){throw new Error(_0xf909('0x77'));}if(!_0x35d22b[_0xf909('0x46')][_0xf909('0xe')]){throw new Error(_0xf909('0x78'));}if(!_0x35d22b[_0xf909('0x46')][_0xf909('0x5c')]){throw new Error('firstName\x20is\x20mandatory');}var _0x1c29d0=0x0;if(_0x35d22b[_0xf909('0x46')][_0xf909('0x25')]){_0x1c29d0=0x1;}if(!_0x35d22b['ListId']){throw new Error(_0xf909('0x79'));}}catch(_0xf29598){throw new Error(_0xf909('0x7a'));}var _0x381faa=[];try{_0x381faa=_['map'](JSON['parse'](process['argv'][0x4]),'id');}catch(_0xd52731){logger['info'](_0xf909('0x7b'));}main(_0x6b36a6,_0x35d22b,_0x381faa,_0x1c29d0);}validate();process['on'](_0xf909('0x7c'),handleStop);process['on'](_0xf909('0x7d'),handleUncaughtException); \ No newline at end of file +var _0x2697=['../../../mysqldb','../../../config/environment','../../../config/logger','import','defaults','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','cm_contacts.updatedAt','cm_hopper_black','cm_contacts.createdAt\x20=\x20?','\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','fields','ListId\x20=\x20?','id\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','error','message','exit','push','code','info','sequelize','main','stringify','send','root','.csv','writeFileSync','parse','data','rows','errors','trim','isValid','isNaN','isNumber','includes','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','length','SystemRow','appendFileSync','emit','Abort\x20parser','abort','SystemError','step','duplicates','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','finish','affectedRows','contact:import:','unlink','catch','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','SIGINT','uncaughtException','path','lodash','util','bluebird','squel','ioredis'];(function(_0x4ea021,_0x419fec){var _0x23bac8=function(_0x213341){while(--_0x213341){_0x4ea021['push'](_0x4ea021['shift']());}};_0x23bac8(++_0x419fec);}(_0x2697,0x102));var _0x7269=function(_0x4828b1,_0x5c8cf3){_0x4828b1=_0x4828b1-0x0;var _0x1fec1b=_0x2697[_0x4828b1];return _0x1fec1b;};'use strict';var fs=require('fs');var path=require(_0x7269('0x0'));var _=require(_0x7269('0x1'));var Papa=require('papaparse');var util=require(_0x7269('0x2'));var BPromise=require(_0x7269('0x3'));var moment=require('moment');var squel=require(_0x7269('0x4'));var Redis=require(_0x7269('0x5'));var db=require(_0x7269('0x6'))['db'];var config=require(_0x7269('0x7'));var logger=require(_0x7269('0x8'))(_0x7269('0x9'));config['redis']=_[_0x7269('0xa')](config[_0x7269('0xb')],{'host':_0x7269('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7269('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x7269('0xd')](_0x7269('0xe'));function isEmail(_0x493a5b){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))*$/[_0x7269('0xf')](_0x493a5b);}function selectNotIn(_0x518589,_0x24d236,_0x342e51,_0x21e682,_0x33be77){return squel[_0x7269('0x10')]()[_0x7269('0x11')](_0x7269('0x12'))['from'](_0x21e682)[_0x7269('0x13')](_0x24d236,null,_0x24d236+_0x7269('0x14')+_0x21e682+'.'+_0x342e51)['where'](_0x21e682+'.'+_0x342e51+_0x7269('0x15')+_0x518589+'.'+_0x342e51)[_0x7269('0x16')](_0x24d236+_0x7269('0x17')+_0x33be77[_0x7269('0x13')]()+')');}function insertCmHopper(_0x207e4f,_0x57436f,_0x5a2dbc,_0x5bb0c7,_0x8826a1){var _0x8d17d1=[_0x7269('0x18'),_0x7269('0x19'),_0x7269('0x1a'),'cm_contacts.ListId',_0x57436f+'.'+_0x5bb0c7,_0x7269('0x1b'),'cm_contacts.updatedAt','cm_contacts.priority',_0x7269('0x1c'),'\x22'+_0x8826a1+'\x22'];return squel[_0x7269('0x1d')]()[_0x7269('0x1e')](_0x7269('0x1f'))[_0x7269('0x20')]([_0x7269('0x12'),_0x7269('0x21'),_0x7269('0x22'),_0x7269('0x23'),_0x5bb0c7,_0x7269('0x24'),_0x7269('0x25'),_0x7269('0x26'),_0x7269('0x27'),_0x7269('0x28')],squel[_0x7269('0x10')]()['fields'](_0x8d17d1)[_0x7269('0x29')](_0x57436f)[_0x7269('0x13')](_0x7269('0x2a'),null,_0x7269('0x2b')+_0x57436f+_0x7269('0x2c'))['join'](_0x5a2dbc,null,_0x5a2dbc+_0x7269('0x14')+_0x57436f+'.'+_0x5bb0c7)[_0x7269('0x16')](_0x57436f+_0x7269('0x2d'),_0x207e4f)[_0x7269('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x7269('0x16')](_0x7269('0x2e'),selectNotIn(_0x57436f,_0x5a2dbc,_0x5bb0c7,_0x7269('0x1f'),['\x22always\x22',_0x7269('0x2f')]))['where'](_0x7269('0x2e'),selectNotIn(_0x57436f,_0x5a2dbc,_0x5bb0c7,_0x7269('0x1f'),['\x22always\x22'])))[_0x7269('0x30')]();}function insertCmHopperBlack(_0x41b9b0,_0x45ca1a,_0xf8c8f8,_0x3a1e22){var _0x5c2be8=[_0x7269('0x18'),_0x7269('0x1a'),_0x7269('0x31'),_0x45ca1a+'.'+_0x3a1e22,'cm_contacts.createdAt',_0x7269('0x32')];return squel[_0x7269('0x1d')]()['into'](_0x7269('0x33'))['fromQuery']([_0x7269('0x12'),_0x7269('0x22'),_0x7269('0x23'),_0x3a1e22,'createdAt',_0x7269('0x25')],squel[_0x7269('0x10')]()['fields'](_0x5c2be8)[_0x7269('0x29')](_0x45ca1a)[_0x7269('0x13')](_0x7269('0x2a'),null,'cm_contacts.ListId\x20=\x20'+_0x45ca1a+_0x7269('0x2c'))[_0x7269('0x13')](_0xf8c8f8,null,_0xf8c8f8+_0x7269('0x14')+_0x45ca1a+'.'+_0x3a1e22)[_0x7269('0x16')](_0x45ca1a+_0x7269('0x2d'),_0x41b9b0)['where'](_0x7269('0x34'),NOW)['where'](_0x7269('0x2e'),squel[_0x7269('0x10')]()[_0x7269('0x11')]('phone')['from']('cm_hopper_black')[_0x7269('0x16')]('ListId\x20=\x20?',_0x41b9b0)[_0x7269('0x16')](_0x3a1e22+_0x7269('0x35'),_0x45ca1a+'.'+_0x3a1e22)))[_0x7269('0x30')]();}function insertCmContact(_0x291562,_0x3631a7,_0x53f09c,_0x42f6e2){var _0x28aa9e=_[_0x7269('0x36')](_[_0x7269('0x37')](_0x42f6e2),['ListId','CompanyId','createdAt',_0x7269('0x25')]);return squel[_0x7269('0x1d')]()[_0x7269('0x1e')](_0x7269('0x2a'))[_0x7269('0x20')](_0x28aa9e,squel[_0x7269('0x10')]()['fields'](_0x28aa9e)[_0x7269('0x29')](_0x3631a7)[_0x7269('0x16')]('('+_0x53f09c[_0x7269('0x13')](',')+_0x7269('0x38'),squel[_0x7269('0x10')]()[_0x7269('0x39')](_0x53f09c)[_0x7269('0x29')]('cm_contacts')[_0x7269('0x16')](_0x7269('0x3a'),_0x291562))[_0x7269('0x16')](_0x7269('0x3b'),squel[_0x7269('0x10')]()['field'](_0x7269('0x3c'),_0x7269('0x3d'))[_0x7269('0x29')](_0x3631a7)[_0x7269('0x3e')](_0x53f09c['join'](','))))[_0x7269('0x30')]();}function handleStop(){logger['info'](_0x7269('0x3f'));stopped=!![];}function handleUncaughtException(_0x33e84a){logger[_0x7269('0x40')](_0x33e84a[_0x7269('0x41')]);process[_0x7269('0x42')](0x1);}function handleError(_0x5d3c6f,_0x2b5886){stats['errors'][_0x7269('0x43')]({'name':_0x2b5886[_0x7269('0x44')],'message':_0x2b5886[_0x7269('0x41')],'row':_0x5d3c6f});}function handleQuery(_0x3983c8){logger[_0x7269('0x45')](_0x3983c8);return db[_0x7269('0x46')]['query'](_0x3983c8)['spread'](function(_0x564747){results['push'](_0x564747);})['catch'](function(_0x25ccbd){logger[_0x7269('0x40')](_0x25ccbd[_0x7269('0x41')]);});}function main(_0xfdd6c0,_0x58d7ff,_0x3a545c,_0x4550b6){logger[_0x7269('0x45')](_0x7269('0x47'),_0xfdd6c0,JSON[_0x7269('0x48')](_0x58d7ff));process[_0x7269('0x49')]('start');var _0x379b39=_0x58d7ff['binding'];var _0x37058f=_0x58d7ff['socket_timestamp'];var _0x6a1327=path['join'](config[_0x7269('0x4a')],'server/files/tmp',_0x37058f+_0x7269('0x4b'));var _0x5c70e7=_[_0x7269('0x37')](_0x379b39)[_0x7269('0x13')]();logger[_0x7269('0x45')]('header',_0x5c70e7);fs[_0x7269('0x4c')](_0x6a1327,_0x5c70e7+'\x0a');Papa[_0x7269('0x4d')](fs['createReadStream'](_0xfdd6c0),{'header':!![],'skipEmptyLines':!![],'step':function(_0x495a24,_0x2e3728){try{for(var _0x57f3f6=0x0,_0x8d2264=[];_0x57f3f6<_0x495a24[_0x7269('0x4e')]['length'];_0x57f3f6++){stats[_0x7269('0x4f')]+=0x1;if(_0x495a24[_0x7269('0x50')][_0x57f3f6]){handleError(_0x495a24[_0x7269('0x4e')][_0x57f3f6],_0x495a24[_0x7269('0x50')][_0x57f3f6]);}else{var _0x5b8064=[];for(var _0xdd0e89 in _0x379b39){if(_0x379b39['hasOwnProperty'](_0xdd0e89)){if(_0x495a24[_0x7269('0x4e')][_0x57f3f6][_0x379b39[_0xdd0e89]]){var _0x40916e=_[_0x7269('0x51')](_0x495a24[_0x7269('0x4e')][_0x57f3f6][_0x379b39[_0xdd0e89]]['replace'](/"/g,'\x27'));switch(_0xdd0e89){case'scheduledat':var _0x11919e=moment(_0x40916e,_0x7269('0xe'),!![]);if(_0x11919e[_0x7269('0x52')]()){_0x8d2264[_0x7269('0x43')]('\x22'+_0x40916e+'\x22');}else{_0x5b8064[_0x7269('0x43')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x170367=parseInt(_0x40916e);_0x40916e=_[_0x7269('0x53')](_0x170367)||_0x170367<0x0||_0x170367>0x4?_0x4550b6?0x3:0x2:_0x170367;_0x8d2264[_0x7269('0x43')]('\x22'+_0x40916e+'\x22');break;case'UserId':var _0x274508=parseInt(_0x40916e);if(_[_0x7269('0x54')](_0x274508)&&_[_0x7269('0x55')](_0x3a545c,_0x274508)){_0x8d2264[_0x7269('0x43')]('\x22'+_0x274508+'\x22');}else{_0x5b8064[_0x7269('0x43')]('agent\x20not\x20exists');}break;case _0x7269('0x56'):if(isEmail(_0x40916e)){_0x8d2264[_0x7269('0x43')]('\x22'+_0x40916e+'\x22');}else{_0x5b8064[_0x7269('0x43')](_0x7269('0x57'));}break;case _0x7269('0x58'):var _0x27df13=moment(_0x40916e,_0x7269('0x59'),!![]);if(_0x27df13[_0x7269('0x52')]()){_0x8d2264[_0x7269('0x43')]('\x22'+_0x40916e+'\x22');}else{_0x5b8064[_0x7269('0x43')](_0x7269('0x5a'));}break;default:_0x8d2264[_0x7269('0x43')]('\x22'+_0x40916e+'\x22');}}else{switch(_0xdd0e89){case'firstName':case _0x7269('0x12'):_0x5b8064[_0x7269('0x43')](_0xdd0e89+_0x7269('0x5b'));break;default:_0x8d2264['push']('\x22\x22');}}}}if(_0x5b8064[_0x7269('0x5c')]){handleError(_0x495a24[_0x7269('0x4e')][_0x57f3f6],{'code':_0x7269('0x5d'),'message':_0x5b8064[_0x7269('0x13')]()});}else{fs[_0x7269('0x5e')](_0x6a1327,_0x8d2264[_0x7269('0x13')]()+'\x0a');}_0x8d2264=[];}if(!(stats['rows']%0xc8)){socket[_0x7269('0x5f')]('contact:import:'+_0x37058f,stats);stats[_0x7269('0x50')]=[];}}if(stopped){logger[_0x7269('0x45')](_0x7269('0x60'));_0x2e3728[_0x7269('0x61')]();}}catch(_0xc82cc5){handleError(_0x495a24[_0x7269('0x4e')][_0x57f3f6],{'code':_0x7269('0x62'),'message':_0xc82cc5[_0x7269('0x41')]});logger[_0x7269('0x40')](_0x7269('0x63'),_0xc82cc5['message']);}},'complete':function(){try{var _0x524f93=[];var _0x555d5a=_0x7269('0x2a');if(_0x58d7ff[_0x7269('0x64')]&&_0x58d7ff['duplicates'][_0x7269('0x5c')]){_0x555d5a='cm_contacts_'+_0x37058f;_0x524f93[_0x7269('0x43')]('CREATE\x20TABLE\x20'+_0x555d5a+'\x20LIKE\x20cm_contacts;');}var _0x52c4fd=util[_0x7269('0xd')](_0x7269('0x65'),_0x6a1327,_0x555d5a,_0x5c70e7,_0x58d7ff[_0x7269('0x23')],_0x58d7ff['CompanyId']||null,NOW,NOW);if(_[_0x7269('0x66')](_0x379b39[_0x7269('0x21')])){_0x52c4fd+=_0x7269('0x67');}_0x524f93[_0x7269('0x43')](_0x52c4fd);if(_0x58d7ff[_0x7269('0x64')]&&_0x58d7ff[_0x7269('0x64')][_0x7269('0x5c')]){_0x524f93[_0x7269('0x43')](insertCmContact(_0x58d7ff['ListId'],_0x555d5a,_0x58d7ff[_0x7269('0x64')],_0x379b39));_0x524f93[_0x7269('0x43')](_0x7269('0x68')+_0x555d5a+';');}_0x524f93['push'](insertCmHopper(_0x58d7ff['ListId'],_0x7269('0x69'),_0x7269('0x6a'),_0x7269('0x6b'),_0x4550b6));_0x524f93[_0x7269('0x43')](insertCmHopperBlack(_0x58d7ff['ListId'],'voice_queues_has_cm_blacklists',_0x7269('0x6a'),'VoiceQueueId'));_0x524f93[_0x7269('0x43')](insertCmHopper(_0x58d7ff['ListId'],_0x7269('0x6c'),_0x7269('0x6d'),_0x7269('0x6e'),_0x4550b6));_0x524f93['push'](insertCmHopperBlack(_0x58d7ff[_0x7269('0x23')],_0x7269('0x6f'),'campaigns',_0x7269('0x6e')));BPromise[_0x7269('0x70')](_0x524f93,handleQuery)['then'](function(_0x4d8f5f){stats[_0x7269('0x71')]=!![];stats[_0x7269('0x72')]=_0x58d7ff[_0x7269('0x64')]&&_0x58d7ff[_0x7269('0x64')][_0x7269('0x5c')]?results[0x2][_0x7269('0x72')]:results[0x0]['affectedRows'];socket['emit'](_0x7269('0x73')+_0x37058f,stats);fs[_0x7269('0x74')](_0xfdd6c0);fs[_0x7269('0x74')](_0x6a1327);process[_0x7269('0x42')](0x0);})[_0x7269('0x75')](function(_0x4c4915){logger[_0x7269('0x40')](_0x4c4915[_0x7269('0x41')]);process[_0x7269('0x42')](0x1);});}catch(_0x1365c3){logger[_0x7269('0x40')]('complete',_0x1365c3[_0x7269('0x41')]);process[_0x7269('0x42')](0x1);}},'error':function(_0x4aec32,_0x5cde17,_0x6885bb,_0x2189b0){throw new Error(_0x2189b0);}});}function validate(){if(process['argv']&&process[_0x7269('0x76')][_0x7269('0x5c')]<0x4){throw new Error(_0x7269('0x77'));}var _0x586ea2=path[_0x7269('0x13')](config[_0x7269('0x4a')],_0x7269('0x78'),process[_0x7269('0x76')][0x2]);if(!fs[_0x7269('0x79')](_0x586ea2)){throw new Error(_0x7269('0x7a'));}var _0x1d7a85={};try{_0x1d7a85=JSON['parse'](process['argv'][0x3]);if(!_0x1d7a85[_0x7269('0x7b')]){throw new Error(_0x7269('0x7c'));}if(!_0x1d7a85['binding']['phone']){throw new Error(_0x7269('0x7d'));}if(!_0x1d7a85[_0x7269('0x7b')][_0x7269('0x7e')]){throw new Error(_0x7269('0x7f'));}var _0x5ae1a8=0x0;if(_0x1d7a85[_0x7269('0x7b')][_0x7269('0x27')]){_0x5ae1a8=0x1;}if(!_0x1d7a85[_0x7269('0x23')]){throw new Error(_0x7269('0x80'));}}catch(_0x4e8009){throw new Error('body\x20id\x20mandatory');}var _0x5e55eb=[];try{_0x5e55eb=_[_0x7269('0x81')](JSON[_0x7269('0x4d')](process[_0x7269('0x76')][0x4]),'id');}catch(_0x4e2108){logger['info']('No\x20agent\x20available');}main(_0x586ea2,_0x1d7a85,_0x5e55eb,_0x5ae1a8);}validate();process['on'](_0x7269('0x82'),handleStop);process['on'](_0x7269('0x83'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index cc90701..fa3610d 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 _0x5636=['Hold\x20Time','holdtime','Talk\x20Time','Member\x20Name','membername','UniqueId','uniqueid','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','getSubjects','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','calleridnum','outbound','string','Outbound\x20Call','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Call\x20To','destexten','Queue','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcalledAt','Agent\x20Connect','Agent\x20Complete','agentcompleteAt'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x5636,0x102));var _0x6563=function(_0x1e8533,_0x1e4832){_0x1e8533=_0x1e8533-0x0;var _0x372e32=_0x5636[_0x1e8533];return _0x372e32;};'use strict';exports[_0x6563('0x0')]=function(_0x8c30f6,_0x492943){var _0x4ab349=[{'type':'string','content':_0x6563('0x1'),'variableName':null}];switch(_0x8c30f6[_0x6563('0x2')]()){case _0x6563('0x3'):switch(_0x492943['toLowerCase']()){case _0x6563('0x4'):_0x4ab349[_0x6563('0x5')]({'type':_0x6563('0x6'),'content':'','variableName':_0x6563('0x7')});_0x4ab349[_0x6563('0x5')]({'type':_0x6563('0x6'),'content':'','variableName':_0x6563('0x8')});break;case _0x6563('0x9'):_0x4ab349[_0x6563('0x5')]({'type':_0x6563('0xa'),'content':_0x6563('0xb'),'variableName':null});_0x4ab349[_0x6563('0x5')]({'type':_0x6563('0x6'),'content':'','variableName':'destcalleridnum'});break;}}return _0x4ab349;};exports['getDescriptions']=function(_0x2946f3,_0x129fa3){var _0x490a56=[];switch(_0x2946f3['toLowerCase']()){case'voice':switch(_0x129fa3[_0x6563('0x2')]()){case _0x6563('0x4'):_0x490a56=[{'type':_0x6563('0xa'),'content':_0x6563('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x6563('0xd'),'content':'','key':_0x6563('0xe'),'keyType':_0x6563('0x6'),'variableName':_0x6563('0x8')},{'type':_0x6563('0xd'),'content':'','key':'Caller\x20Name','keyType':_0x6563('0x6'),'variableName':'calleridname'},{'type':_0x6563('0xd'),'content':'','key':_0x6563('0xf'),'keyType':_0x6563('0x6'),'variableName':_0x6563('0x10')},{'type':'keyValue','content':'','key':_0x6563('0x11'),'keyType':_0x6563('0x6'),'variableName':_0x6563('0x7')},{'type':_0x6563('0xd'),'content':'','key':'UniqueId','keyType':_0x6563('0x6'),'variableName':'uniqueid'},{'type':'keyValue','content':'','key':'Date','keyType':_0x6563('0x6'),'variableName':'agentcalledAt'},{'type':'string','content':_0x6563('0x12'),'key':null,'keyType':null,'variableName':null},{'type':_0x6563('0xd'),'content':'','key':_0x6563('0x13'),'keyType':_0x6563('0x6'),'variableName':_0x6563('0x14')},{'type':_0x6563('0xd'),'content':'','key':_0x6563('0x15'),'keyType':_0x6563('0x6'),'variableName':_0x6563('0x16')},{'type':'string','content':_0x6563('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0x6563('0xd'),'content':'','key':_0x6563('0x18'),'keyType':'variable','variableName':_0x6563('0x19')},{'type':'keyValue','content':'','key':_0x6563('0x1a'),'keyType':_0x6563('0x6'),'variableName':'agentconnectAt'},{'type':'keyValue','content':'','key':_0x6563('0x1b'),'keyType':'variable','variableName':_0x6563('0x1c')},{'type':_0x6563('0xd'),'content':'','key':_0x6563('0x1d'),'keyType':'variable','variableName':_0x6563('0x1e')},{'type':'keyValue','content':'','key':_0x6563('0x1f'),'keyType':_0x6563('0x6'),'variableName':'talktime'}];break;case _0x6563('0x9'):_0x490a56=[{'type':_0x6563('0xa'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0x6563('0xd'),'content':'','key':'Called\x20Number','keyType':_0x6563('0x6'),'keyContent':'','variableName':'destcalleridnum'},{'type':'keyValue','content':'','key':_0x6563('0x20'),'keyType':_0x6563('0x6'),'keyContent':'','variableName':_0x6563('0x21')},{'type':_0x6563('0xd'),'content':'','key':_0x6563('0x22'),'keyType':'variable','keyContent':'','variableName':_0x6563('0x23')},{'type':'keyValue','content':'','key':'Date','keyType':_0x6563('0x6'),'keyContent':'','variableName':_0x6563('0x24')},{'type':_0x6563('0xa'),'content':_0x6563('0x17')},{'type':_0x6563('0xd'),'content':'','key':_0x6563('0x25'),'keyType':_0x6563('0x6'),'keyContent':'','variableName':_0x6563('0x26')},{'type':_0x6563('0xd'),'content':'','key':_0x6563('0x27'),'keyType':'variable','keyContent':'','variableName':_0x6563('0x28')}];break;}}return _0x490a56;}; \ No newline at end of file +var _0xb4e6=['voice','push','variable','queue','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridnum','calleridname','Call\x20To','destexten','Queue','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','Agent\x20Connect','agentconnectAt','Hold\x20Time','holdtime','Talk\x20Time','outbound','Member\x20Name','membername','starttime','Answer\x20Time','Complete\x20Time','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase'];(function(_0x4000c7,_0x312276){var _0x302cd2=function(_0x57b5b9){while(--_0x57b5b9){_0x4000c7['push'](_0x4000c7['shift']());}};_0x302cd2(++_0x312276);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x16539a,_0x31409a){_0x16539a=_0x16539a-0x0;var _0x200796=_0xb4e6[_0x16539a];return _0x200796;};'use strict';exports[_0x6b4e('0x0')]=function(_0x50cce5,_0x2708ca){var _0x1afd20=[{'type':_0x6b4e('0x1'),'content':_0x6b4e('0x2'),'variableName':null}];switch(_0x50cce5[_0x6b4e('0x3')]()){case _0x6b4e('0x4'):switch(_0x2708ca[_0x6b4e('0x3')]()){case'inbound':_0x1afd20[_0x6b4e('0x5')]({'type':_0x6b4e('0x6'),'content':'','variableName':_0x6b4e('0x7')});_0x1afd20['push']({'type':_0x6b4e('0x6'),'content':'','variableName':'calleridnum'});break;case'outbound':_0x1afd20[_0x6b4e('0x5')]({'type':'string','content':'Outbound\x20Call','variableName':null});_0x1afd20[_0x6b4e('0x5')]({'type':_0x6b4e('0x6'),'content':'','variableName':_0x6b4e('0x8')});break;}}return _0x1afd20;};exports[_0x6b4e('0x9')]=function(_0x14cf84,_0x46cbe1){var _0x323487=[];switch(_0x14cf84['toLowerCase']()){case _0x6b4e('0x4'):switch(_0x46cbe1[_0x6b4e('0x3')]()){case'inbound':_0x323487=[{'type':_0x6b4e('0x1'),'content':_0x6b4e('0xa'),'key':null,'keyType':null,'variableName':null},{'type':_0x6b4e('0xb'),'content':'','key':_0x6b4e('0xc'),'keyType':_0x6b4e('0x6'),'variableName':_0x6b4e('0xd')},{'type':_0x6b4e('0xb'),'content':'','key':'Caller\x20Name','keyType':_0x6b4e('0x6'),'variableName':_0x6b4e('0xe')},{'type':'keyValue','content':'','key':_0x6b4e('0xf'),'keyType':'variable','variableName':_0x6b4e('0x10')},{'type':_0x6b4e('0xb'),'content':'','key':_0x6b4e('0x11'),'keyType':_0x6b4e('0x6'),'variableName':_0x6b4e('0x7')},{'type':_0x6b4e('0xb'),'content':'','key':'UniqueId','keyType':'variable','variableName':_0x6b4e('0x12')},{'type':_0x6b4e('0xb'),'content':'','key':_0x6b4e('0x13'),'keyType':_0x6b4e('0x6'),'variableName':_0x6b4e('0x14')},{'type':_0x6b4e('0x1'),'content':_0x6b4e('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0x6b4e('0xb'),'content':'','key':_0x6b4e('0x16'),'keyType':_0x6b4e('0x6'),'variableName':_0x6b4e('0x17')},{'type':'keyValue','content':'','key':_0x6b4e('0x18'),'keyType':_0x6b4e('0x6'),'variableName':_0x6b4e('0x8')},{'type':_0x6b4e('0x1'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x6b4e('0xb'),'content':'','key':'Agent\x20Ring','keyType':_0x6b4e('0x6'),'variableName':_0x6b4e('0x14')},{'type':_0x6b4e('0xb'),'content':'','key':_0x6b4e('0x19'),'keyType':_0x6b4e('0x6'),'variableName':_0x6b4e('0x1a')},{'type':_0x6b4e('0xb'),'content':'','key':'Agent\x20Complete','keyType':_0x6b4e('0x6'),'variableName':'agentcompleteAt'},{'type':_0x6b4e('0xb'),'content':'','key':_0x6b4e('0x1b'),'keyType':_0x6b4e('0x6'),'variableName':_0x6b4e('0x1c')},{'type':'keyValue','content':'','key':_0x6b4e('0x1d'),'keyType':_0x6b4e('0x6'),'variableName':'talktime'}];break;case _0x6b4e('0x1e'):_0x323487=[{'type':_0x6b4e('0x1'),'content':_0x6b4e('0xa'),'variableName':null},{'type':_0x6b4e('0xb'),'content':'','key':'Called\x20Number','keyType':_0x6b4e('0x6'),'keyContent':'','variableName':_0x6b4e('0x8')},{'type':'keyValue','content':'','key':_0x6b4e('0x1f'),'keyType':_0x6b4e('0x6'),'keyContent':'','variableName':_0x6b4e('0x20')},{'type':_0x6b4e('0xb'),'content':'','key':'UniqueId','keyType':_0x6b4e('0x6'),'keyContent':'','variableName':_0x6b4e('0x12')},{'type':'keyValue','content':'','key':_0x6b4e('0x13'),'keyType':_0x6b4e('0x6'),'keyContent':'','variableName':_0x6b4e('0x21')},{'type':'string','content':'***\x20Time\x20Info\x20***'},{'type':_0x6b4e('0xb'),'content':'','key':_0x6b4e('0x22'),'keyType':_0x6b4e('0x6'),'keyContent':'','variableName':'answertime'},{'type':_0x6b4e('0xb'),'content':'','key':_0x6b4e('0x23'),'keyType':_0x6b4e('0x6'),'keyContent':'','variableName':'endtime'}];break;}}return _0x323487;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 67372e5..887008c 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 _0x4829=['catch','error','tracked','user','query','body','phone','fax','mobile','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','sms-interactions','chat-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','null','Interaction','findOne','then','update'];(function(_0x2c63a4,_0x18a34f){var _0x210eb8=function(_0x300bb0){while(--_0x300bb0){_0x2c63a4['push'](_0x2c63a4['shift']());}};_0x210eb8(++_0x18a34f);}(_0x4829,0xcd));var _0x9482=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0x4829[_0x3ce2c4];return _0x4047c1;};'use strict';var _=require('lodash');var db=require(_0x9482('0x0'))['db'];var loggers={'openchannel':require(_0x9482('0x1'))(_0x9482('0x2')),'mail':require(_0x9482('0x1'))(_0x9482('0x3')),'fax':require(_0x9482('0x1'))('fax-interactions'),'sms':require(_0x9482('0x1'))(_0x9482('0x4')),'chat':require('../../config/logger')(_0x9482('0x5'))};function getInteractionId(_0x5e734f,_0x244e22,_0x66fe4b){if(_0x5e734f&&_0x5e734f[_[_0x9482('0x6')](_0x66fe4b)+_0x9482('0x7')]){return _0x5e734f[_['upperFirst'](_0x66fe4b)+_0x9482('0x7')];}else if(_0x5e734f&&_0x5e734f['id']){return _0x5e734f['id'];}else if(_0x244e22&&_0x244e22['id']){return _0x244e22['id'];}else{return _0x9482('0x8');}}function log(_0x5b1d72,_0x5668a3,_0x528c3a,_0x2bd795,_0x1eaa90,_0x20c7b6){loggers[_0x1eaa90[_0x9482('0x9')]()][_0x5b1d72](_0x9482('0xa'),_0x20c7b6[_0x9482('0xb')](),_0x5668a3?_0x5668a3['id']:null,_0x5668a3?_0x5668a3[_0x9482('0xc')]:null,_0x5668a3?_0x5668a3[_0x9482('0xd')]:null,getInteractionId(_0x528c3a,_0x2bd795,_0x1eaa90),_0x528c3a?JSON['stringify'](_0x528c3a):_0x9482('0xe'));}function updateUser(_0x16bc73,_0x494f3f,_0x217eae,_0x2dcb05,_0x485dfe){db[_[_0x9482('0x6')](_0x2dcb05)+_0x9482('0xf')][_0x9482('0x10')]({'where':{'id':getInteractionId(_0x494f3f,_0x217eae,_0x2dcb05)}})[_0x9482('0x11')](function(_0x3962cc){if(_0x3962cc){return _0x3962cc[_0x9482('0x12')]({'UserId':_0x16bc73?_0x16bc73['id']:null});}})[_0x9482('0x11')](function(_0xf48a39){if(_0xf48a39){log('info',_0x16bc73,_0x494f3f,_0x217eae,_0x2dcb05,_0x485dfe);}})[_0x9482('0x13')](function(){log(_0x9482('0x14'),_0x16bc73,_0x494f3f,_0x217eae,_0x2dcb05,_0x485dfe);});}exports[_0x9482('0x15')]=function(_0xac53e9,_0x258854){return function(_0x3638b1,_0x34df06,_0x2e0450){var _0x334ea3=_0x3638b1[_0x9482('0x16')];var _0x10272e={};var _0x29dd9e=_0x3638b1[_0x9482('0x17')];if(_0x10272e){_0x10272e=_['clone'](_0x3638b1[_0x9482('0x18')]);_0x10272e=_['omit'](_0x10272e,[_0x9482('0x18'),'html',_0x9482('0x19'),_0x9482('0x1a'),_0x9482('0x1b')]);}updateUser(_0x334ea3,_0x10272e,_0x29dd9e,_0xac53e9,_0x258854);_0x2e0450(null);};}; \ No newline at end of file +var _0x15b2=['toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','stringify','null','Interaction','findOne','update','then','info','catch','error','user','query','clone','body','omit','html','phone','fax','mobile','lodash','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','InteractionId','upperFirst'];(function(_0x10d5ad,_0x3f9f08){var _0x5ae8d8=function(_0x288a5b){while(--_0x288a5b){_0x10d5ad['push'](_0x10d5ad['shift']());}};_0x5ae8d8(++_0x3f9f08);}(_0x15b2,0xa1));var _0x215b=function(_0x2e7426,_0x21caa7){_0x2e7426=_0x2e7426-0x0;var _0x4ddeb6=_0x15b2[_0x2e7426];return _0x4ddeb6;};'use strict';var _=require(_0x215b('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x215b('0x1'))(_0x215b('0x2')),'mail':require('../../config/logger')(_0x215b('0x3')),'fax':require('../../config/logger')(_0x215b('0x4')),'sms':require('../../config/logger')('sms-interactions'),'chat':require(_0x215b('0x1'))('chat-interactions')};function getInteractionId(_0x32ec8e,_0x4d14a0,_0xf1af02){if(_0x32ec8e&&_0x32ec8e[_['upperFirst'](_0xf1af02)+_0x215b('0x5')]){return _0x32ec8e[_[_0x215b('0x6')](_0xf1af02)+_0x215b('0x5')];}else if(_0x32ec8e&&_0x32ec8e['id']){return _0x32ec8e['id'];}else if(_0x4d14a0&&_0x4d14a0['id']){return _0x4d14a0['id'];}else{return'unknown';}}function log(_0x581fd4,_0x2cdeb8,_0x4af047,_0x2e74c6,_0x454e22,_0x34a871){loggers[_0x454e22[_0x215b('0x7')]()][_0x581fd4](_0x215b('0x8'),_0x34a871['toUpperCase'](),_0x2cdeb8?_0x2cdeb8['id']:null,_0x2cdeb8?_0x2cdeb8[_0x215b('0x9')]:null,_0x2cdeb8?_0x2cdeb8['role']:null,getInteractionId(_0x4af047,_0x2e74c6,_0x454e22),_0x4af047?JSON[_0x215b('0xa')](_0x4af047):_0x215b('0xb'));}function updateUser(_0x52ee0b,_0x2b0169,_0x38e129,_0x4b7016,_0xbb281a){db[_[_0x215b('0x6')](_0x4b7016)+_0x215b('0xc')][_0x215b('0xd')]({'where':{'id':getInteractionId(_0x2b0169,_0x38e129,_0x4b7016)}})['then'](function(_0x205259){if(_0x205259){return _0x205259[_0x215b('0xe')]({'UserId':_0x52ee0b?_0x52ee0b['id']:null});}})[_0x215b('0xf')](function(_0x3d6be2){if(_0x3d6be2){log(_0x215b('0x10'),_0x52ee0b,_0x2b0169,_0x38e129,_0x4b7016,_0xbb281a);}})[_0x215b('0x11')](function(){log(_0x215b('0x12'),_0x52ee0b,_0x2b0169,_0x38e129,_0x4b7016,_0xbb281a);});}exports['tracked']=function(_0x25bada,_0x2ded31){return function(_0x2b3ae4,_0x5099a9,_0x424199){var _0x38f367=_0x2b3ae4[_0x215b('0x13')];var _0x7bcdd1={};var _0x149679=_0x2b3ae4[_0x215b('0x14')];if(_0x7bcdd1){_0x7bcdd1=_[_0x215b('0x15')](_0x2b3ae4[_0x215b('0x16')]);_0x7bcdd1=_[_0x215b('0x17')](_0x7bcdd1,[_0x215b('0x16'),_0x215b('0x18'),_0x215b('0x19'),_0x215b('0x1a'),_0x215b('0x1b')]);}updateUser(_0x38f367,_0x7bcdd1,_0x149679,_0x25bada,_0x2ded31);_0x424199(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index a6eae4d..ec77482 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 _0x5fa9=['json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','crypto','util','composable-middleware','../../config/environment','license','data1','split','aes-256-ctr','format','base64','utf8','final','hasOwnProperty','use','License','then'];(function(_0x2eb030,_0x1121bf){var _0x414618=function(_0x21d762){while(--_0x21d762){_0x2eb030['push'](_0x2eb030['shift']());}};_0x414618(++_0x1121bf);}(_0x5fa9,0x150));var _0x95fa=function(_0x7538c5,_0xa5d8ac){_0x7538c5=_0x7538c5-0x0;var _0x8b56be=_0x5fa9[_0x7538c5];return _0x8b56be;};'use strict';var crypto=require(_0x95fa('0x0'));var util=require(_0x95fa('0x1'));var compose=require(_0x95fa('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x95fa('0x3'));function getValueFromLicense(_0x2b2797,_0x531b0f){if(_0x2b2797&&_0x531b0f){if(_0x531b0f['data1']&&_0x531b0f[_0x95fa('0x4')]){var _0x4c7e67=_0x531b0f[_0x95fa('0x5')];var _0x5ce1ce=_0x531b0f['license'];var _0x24f217=_0x4c7e67['split']('-')[0x4];var _0x3afc2b=_0x4c7e67[_0x95fa('0x6')]('-')[0x0];var _0x1b12f9=crypto['createDecipher'](_0x95fa('0x7'),util[_0x95fa('0x8')]('%s:%s:%s',_0x24f217,_0x4c7e67,_0x3afc2b));var _0x4fe2c2=_0x1b12f9['update'](_0x5ce1ce,_0x95fa('0x9'),_0x95fa('0xa'));_0x4fe2c2+=_0x1b12f9[_0x95fa('0xb')](_0x95fa('0xa'));var _0x19883e=JSON['parse'](_0x4fe2c2);return _0x19883e[_0x95fa('0xc')](_0x2b2797)?_0x19883e[_0x2b2797]:null;}}return null;}function isLimit(_0x483e5e,_0x2c1914,_0x40d16c,_0x1c1ade){var _0x1b8c50=_0x2c1914;return compose()[_0x95fa('0xd')](function(_0x35f82a,_0x1a4a75,_0x30e4b7){return db[_0x95fa('0xe')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x95fa('0xf')](function(_0x1927e0){var _0xb5368=getValueFromLicense(_0x483e5e,_0x1927e0);return _0xb5368?_0xb5368:_0x1b8c50;})[_0x95fa('0xf')](function(_0x5d7f0c){_0x1b8c50=_0x5d7f0c;return _0x40d16c['count'](_0x1c1ade);})['then'](function(_0x6bc1a8){if(_0x6bc1a8>=_0x1b8c50){return _0x1a4a75['status'](0x193)[_0x95fa('0x10')]({'message':util['format'](_0x95fa('0x11'),_0x483e5e)});}_0x30e4b7();})[_0x95fa('0x12')](function(_0x15c615){_0x30e4b7(_0x15c615);});});}function isUserLimit(){return isLimit(_0x95fa('0x13'),0x1,db[_0x95fa('0x14')],{'where':{'$or':[{'role':_0x95fa('0x15')},{'role':'user'}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0xa23f=['Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','data1','license','format','%s:%s:%s','update','utf8','final','parse','use','findOne','then','status','json'];(function(_0x4ce885,_0x4a64c6){var _0x189899=function(_0x12ebb2){while(--_0x12ebb2){_0x4ce885['push'](_0x4ce885['shift']());}};_0x189899(++_0x4a64c6);}(_0xa23f,0x18d));var _0xfa23=function(_0x891641,_0x1072d0){_0x891641=_0x891641-0x0;var _0x1d49e9=_0xa23f[_0x891641];return _0x1d49e9;};'use strict';var crypto=require(_0xfa23('0x0'));var util=require(_0xfa23('0x1'));var compose=require(_0xfa23('0x2'));var db=require(_0xfa23('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x536924,_0x9b4fd7){if(_0x536924&&_0x9b4fd7){if(_0x9b4fd7[_0xfa23('0x4')]&&_0x9b4fd7[_0xfa23('0x5')]){var _0x7b862a=_0x9b4fd7[_0xfa23('0x4')];var _0x512af2=_0x9b4fd7[_0xfa23('0x5')];var _0x1c38a4=_0x7b862a['split']('-')[0x4];var _0x40cd0c=_0x7b862a['split']('-')[0x0];var _0x46d5cc=crypto['createDecipher']('aes-256-ctr',util[_0xfa23('0x6')](_0xfa23('0x7'),_0x1c38a4,_0x7b862a,_0x40cd0c));var _0x2ed0f4=_0x46d5cc[_0xfa23('0x8')](_0x512af2,'base64',_0xfa23('0x9'));_0x2ed0f4+=_0x46d5cc[_0xfa23('0xa')](_0xfa23('0x9'));var _0x182cbf=JSON[_0xfa23('0xb')](_0x2ed0f4);return _0x182cbf['hasOwnProperty'](_0x536924)?_0x182cbf[_0x536924]:null;}}return null;}function isLimit(_0x5a70d9,_0x26a740,_0x5389eb,_0x4a9fe9){var _0x50f710=_0x26a740;return compose()[_0xfa23('0xc')](function(_0x22aff6,_0x34a46e,_0x47681c){return db['License'][_0xfa23('0xd')]({'where':{'id':0x1},'raw':!![]})[_0xfa23('0xe')](function(_0x8c0382){var _0xf76ad1=getValueFromLicense(_0x5a70d9,_0x8c0382);return _0xf76ad1?_0xf76ad1:_0x50f710;})['then'](function(_0x73d8d){_0x50f710=_0x73d8d;return _0x5389eb['count'](_0x4a9fe9);})['then'](function(_0x56640d){if(_0x56640d>=_0x50f710){return _0x34a46e[_0xfa23('0xf')](0x193)[_0xfa23('0x10')]({'message':util[_0xfa23('0x6')](_0xfa23('0x11'),_0x5a70d9)});}_0x47681c();})['catch'](function(_0x192d21){_0x47681c(_0x192d21);});});}function isUserLimit(){return isLimit(_0xfa23('0x12'),0x1,db[_0xfa23('0x13')],{'where':{'$or':[{'role':_0xfa23('0x14')},{'role':_0xfa23('0x15')}]}});}exports[_0xfa23('0x16')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 070773d..6cc991a 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 _0x0585=['map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','length','isArray','unset','fields','split','isEmpty','forOwn','offset','sort'];(function(_0x140609,_0x4b8c40){var _0x12b45a=function(_0x42d4c7){while(--_0x42d4c7){_0x140609['push'](_0x140609['shift']());}};_0x12b45a(++_0x4b8c40);}(_0x0585,0x92));var _0x5058=function(_0x349aeb,_0x2361ba){_0x349aeb=_0x349aeb-0x0;var _0x3f4354=_0x0585[_0x349aeb];return _0x3f4354;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var LIMIT_VALUE=0xfa;exports[_0x5058('0x0')]=function(_0x159633){var _0x436c0a=null;if(_0x159633){_0x436c0a=_0x159633[_0x5058('0x1')](',');}return _0x436c0a;};exports['filters']=function(_0x281b6a){var _0x31de16={};if(!_[_0x5058('0x2')](_0x281b6a)){_0x31de16={};_[_0x5058('0x3')](_0x281b6a,function(_0x4469bb,_0x5022d0){try{_0x31de16[_0x5022d0]=JSON['parse'](_0x4469bb);}catch(_0x2440ce){_0x31de16[_0x5022d0]=_0x4469bb[_0x5058('0x1')](',');}});}return _0x31de16;};exports['limit']=function(_0x211814){_0x211814=parseInt(_0x211814,0xa);if(!_0x211814||_0x211814<0x0){_0x211814=LIMIT_VALUE;}return _0x211814;};exports[_0x5058('0x4')]=function(_0x3e68cb){_0x3e68cb=parseInt(_0x3e68cb,0xa);if(!_0x3e68cb||_0x3e68cb<0x0){_0x3e68cb=0x0;}return _0x3e68cb;};exports[_0x5058('0x5')]=function(_0x5c33a8){var _0x329213,_0x37079d=null;if(_0x5c33a8){_0x329213=_0x5c33a8['split'](',');_0x37079d=_[_0x5058('0x6')](_0x329213,function(_0x13af9e){if(_0x13af9e[_0x5058('0x7')]('-')===0x0){return[_0x13af9e===_0x5058('0x8')?sequelize[_0x5058('0x9')](sequelize[_0x5058('0xa')]('priority'),_0x5058('0xb')):_0x13af9e[_0x5058('0xc')](0x1),_0x5058('0xd')];}else{return[_0x13af9e===_0x5058('0x8')?sequelize[_0x5058('0x9')](sequelize[_0x5058('0xa')](_0x5058('0x8')),_0x5058('0xb')):_0x13af9e,_0x5058('0xe')];}});}return _0x37079d;};exports[_0x5058('0xf')]=function(_0x3ccc38,_0x9710f7){if(_[_0x5058('0x2')](_0x3ccc38)){return _0x3ccc38;}if(_['isArray'](_0x3ccc38)){for(var _0xab70c0=0x0;_0xab70c0<_0x3ccc38[_0x5058('0x10')];_0xab70c0+=0x1){_0x3ccc38[_0xab70c0]=this['omit'](_0x3ccc38[_0xab70c0],_0x9710f7);}return _0x3ccc38;}if(!_['isObject'](_0x3ccc38)){return _0x3ccc38;}if(_['isString'](_0x9710f7)){_0x9710f7=[_0x9710f7];}if(!_[_0x5058('0x11')](_0x9710f7)){return _0x3ccc38;}for(var _0x49450d=0x0;_0x49450d<_0x9710f7[_0x5058('0x10')];_0x49450d+=0x1){_[_0x5058('0x12')](_0x3ccc38,_0x9710f7[_0x49450d]);}for(var _0x52e7e2 in _0x3ccc38){if(_0x3ccc38['hasOwnProperty'](_0x52e7e2)){_0x3ccc38[_0x52e7e2]=this[_0x5058('0xf')](_0x3ccc38[_0x52e7e2],_0x9710f7);}}return _0x3ccc38;}; \ No newline at end of file +var _0x0596=['col','unsigned','DESC','isArray','length','omit','isObject','isString','unset','hasOwnProperty','lodash','fields','split','filters','isEmpty','forOwn','parse','offset','sort','map','priority','cast'];(function(_0x4bfd22,_0x5d4ec1){var _0x45df47=function(_0x18b70e){while(--_0x18b70e){_0x4bfd22['push'](_0x4bfd22['shift']());}};_0x45df47(++_0x5d4ec1);}(_0x0596,0x13e));var _0x6059=function(_0x33e760,_0x194bf0){_0x33e760=_0x33e760-0x0;var _0x100de2=_0x0596[_0x33e760];return _0x100de2;};'use strict';var _=require(_0x6059('0x0'));var sequelize=require('sequelize');var LIMIT_VALUE=0xfa;exports[_0x6059('0x1')]=function(_0x55e4ab){var _0x11f790=null;if(_0x55e4ab){_0x11f790=_0x55e4ab[_0x6059('0x2')](',');}return _0x11f790;};exports[_0x6059('0x3')]=function(_0x5e70b9){var _0x406c58={};if(!_[_0x6059('0x4')](_0x5e70b9)){_0x406c58={};_[_0x6059('0x5')](_0x5e70b9,function(_0x597f06,_0x2ad298){try{_0x406c58[_0x2ad298]=JSON[_0x6059('0x6')](_0x597f06);}catch(_0x425cc){_0x406c58[_0x2ad298]=_0x597f06[_0x6059('0x2')](',');}});}return _0x406c58;};exports['limit']=function(_0x399d88){_0x399d88=parseInt(_0x399d88,0xa);if(!_0x399d88||_0x399d88<0x0){_0x399d88=LIMIT_VALUE;}return _0x399d88;};exports[_0x6059('0x7')]=function(_0x1fe315){_0x1fe315=parseInt(_0x1fe315,0xa);if(!_0x1fe315||_0x1fe315<0x0){_0x1fe315=0x0;}return _0x1fe315;};exports[_0x6059('0x8')]=function(_0x554dd7){var _0x5a0b82,_0x47938e=null;if(_0x554dd7){_0x5a0b82=_0x554dd7[_0x6059('0x2')](',');_0x47938e=_[_0x6059('0x9')](_0x5a0b82,function(_0x1a2635){if(_0x1a2635['indexOf']('-')===0x0){return[_0x1a2635===_0x6059('0xa')?sequelize[_0x6059('0xb')](sequelize[_0x6059('0xc')]('priority'),_0x6059('0xd')):_0x1a2635['substr'](0x1),_0x6059('0xe')];}else{return[_0x1a2635===_0x6059('0xa')?sequelize['cast'](sequelize[_0x6059('0xc')]('priority'),_0x6059('0xd')):_0x1a2635,'ASC'];}});}return _0x47938e;};exports['omit']=function(_0x272257,_0x3ea912){if(_[_0x6059('0x4')](_0x272257)){return _0x272257;}if(_[_0x6059('0xf')](_0x272257)){for(var _0x491c8b=0x0;_0x491c8b<_0x272257[_0x6059('0x10')];_0x491c8b+=0x1){_0x272257[_0x491c8b]=this[_0x6059('0x11')](_0x272257[_0x491c8b],_0x3ea912);}return _0x272257;}if(!_[_0x6059('0x12')](_0x272257)){return _0x272257;}if(_[_0x6059('0x13')](_0x3ea912)){_0x3ea912=[_0x3ea912];}if(!_[_0x6059('0xf')](_0x3ea912)){return _0x272257;}for(var _0x53bc49=0x0;_0x53bc49<_0x3ea912[_0x6059('0x10')];_0x53bc49+=0x1){_[_0x6059('0x14')](_0x272257,_0x3ea912[_0x53bc49]);}for(var _0x1b36d7 in _0x272257){if(_0x272257[_0x6059('0x15')](_0x1b36d7)){_0x272257[_0x1b36d7]=this[_0x6059('0x11')](_0x272257[_0x1b36d7],_0x3ea912);}}return _0x272257;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index cd6d133..9ff6880 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['50mb','express','serve-favicon','body-parser','errorhandler','passport','cors','moment','./environment','../mysqldb','get','use','public','favicon.ico','set','appPath','join','root','client','json\x20replacer','toISOString','views','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded'];(function(_0xb6e43,_0x1568fc){var _0x47c40f=function(_0x107786){while(--_0x107786){_0xb6e43['push'](_0xb6e43['shift']());}};_0x47c40f(++_0x1568fc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var express=require(_0x0a9e('0x0'));var favicon=require(_0x0a9e('0x1'));var bodyParser=require(_0x0a9e('0x2'));var methodOverride=require('method-override');var cookieParser=require('cookie-parser');var errorHandler=require(_0x0a9e('0x3'));var path=require('path');var passport=require(_0x0a9e('0x4'));var cors=require(_0x0a9e('0x5'));var moment=require(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var db=require(_0x0a9e('0x8'))['db'];exports['default']=function(_0x219af0){var _0x441e3a=_0x219af0[_0x0a9e('0x9')]('env');if(_0x441e3a==='production'){_0x219af0[_0x0a9e('0xa')](favicon(path['join'](config['root'],_0x0a9e('0xb'),_0x0a9e('0xc'))));_0x219af0[_0x0a9e('0xd')](_0x0a9e('0xe'),path[_0x0a9e('0xf')](config[_0x0a9e('0x10')],'public'));}if(_0x441e3a==='development'||_0x441e3a==='test'){_0x219af0['use'](favicon(path[_0x0a9e('0xf')](config[_0x0a9e('0x10')],_0x0a9e('0x11'),_0x0a9e('0xc'))));_0x219af0[_0x0a9e('0xd')](_0x0a9e('0xe'),path['join'](config[_0x0a9e('0x10')],_0x0a9e('0x11')));_0x219af0[_0x0a9e('0xa')](errorHandler());}_0x219af0[_0x0a9e('0xd')](_0x0a9e('0x12'),function(_0x4d5611,_0x52a03d){if(this[_0x4d5611]instanceof Date){_0x52a03d=this[_0x4d5611][_0x0a9e('0x13')]()['split']('.')[0x0]+'Z';}return _0x52a03d;});_0x219af0[_0x0a9e('0xa')](express['static'](_0x219af0[_0x0a9e('0x9')](_0x0a9e('0xe'))));_0x219af0['set'](_0x0a9e('0x14'),config['root']+_0x0a9e('0x15'));_0x219af0[_0x0a9e('0x16')](_0x0a9e('0x17'),require(_0x0a9e('0x18'))[_0x0a9e('0x19')]);_0x219af0[_0x0a9e('0xd')](_0x0a9e('0x1a'),_0x0a9e('0x17'));_0x219af0[_0x0a9e('0xa')](bodyParser[_0x0a9e('0x1b')]({'limit':_0x0a9e('0x1c'),'extended':!![]}));_0x219af0[_0x0a9e('0xa')](bodyParser['json']({'limit':_0x0a9e('0x1c')}));_0x219af0[_0x0a9e('0xa')](cors());_0x219af0['use'](methodOverride());_0x219af0[_0x0a9e('0xa')](cookieParser());_0x219af0['use'](passport['initialize']());}; \ No newline at end of file +var _0xe706=['toISOString','engine','html','view\x20engine','urlencoded','50mb','json','initialize','express','serve-favicon','body-parser','cookie-parser','errorhandler','path','passport','cors','moment','./environment','../mysqldb','default','get','env','production','use','join','root','public','favicon.ico','set','appPath','client'];(function(_0x42aabd,_0x217ade){var _0x2e83fb=function(_0x1508d8){while(--_0x1508d8){_0x42aabd['push'](_0x42aabd['shift']());}};_0x2e83fb(++_0x217ade);}(_0xe706,0xa3));var _0x6e70=function(_0x2e10b1,_0x845b82){_0x2e10b1=_0x2e10b1-0x0;var _0x41de8b=_0xe706[_0x2e10b1];return _0x41de8b;};'use strict';var express=require(_0x6e70('0x0'));var favicon=require(_0x6e70('0x1'));var bodyParser=require(_0x6e70('0x2'));var methodOverride=require('method-override');var cookieParser=require(_0x6e70('0x3'));var errorHandler=require(_0x6e70('0x4'));var path=require(_0x6e70('0x5'));var passport=require(_0x6e70('0x6'));var cors=require(_0x6e70('0x7'));var moment=require(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var db=require(_0x6e70('0xa'))['db'];exports[_0x6e70('0xb')]=function(_0x4381d1){var _0x36357b=_0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'));if(_0x36357b===_0x6e70('0xe')){_0x4381d1[_0x6e70('0xf')](favicon(path[_0x6e70('0x10')](config[_0x6e70('0x11')],_0x6e70('0x12'),_0x6e70('0x13'))));_0x4381d1[_0x6e70('0x14')](_0x6e70('0x15'),path[_0x6e70('0x10')](config[_0x6e70('0x11')],_0x6e70('0x12')));}if(_0x36357b==='development'||_0x36357b==='test'){_0x4381d1[_0x6e70('0xf')](favicon(path[_0x6e70('0x10')](config[_0x6e70('0x11')],_0x6e70('0x16'),_0x6e70('0x13'))));_0x4381d1[_0x6e70('0x14')](_0x6e70('0x15'),path[_0x6e70('0x10')](config['root'],'client'));_0x4381d1['use'](errorHandler());}_0x4381d1[_0x6e70('0x14')]('json\x20replacer',function(_0x53aed0,_0x304716){if(this[_0x53aed0]instanceof Date){_0x304716=this[_0x53aed0][_0x6e70('0x17')]()['split']('.')[0x0]+'Z';}return _0x304716;});_0x4381d1[_0x6e70('0xf')](express['static'](_0x4381d1[_0x6e70('0xc')](_0x6e70('0x15'))));_0x4381d1['set']('views',config[_0x6e70('0x11')]+'/server/views');_0x4381d1[_0x6e70('0x18')](_0x6e70('0x19'),require('ejs')['renderFile']);_0x4381d1[_0x6e70('0x14')](_0x6e70('0x1a'),_0x6e70('0x19'));_0x4381d1[_0x6e70('0xf')](bodyParser[_0x6e70('0x1b')]({'limit':_0x6e70('0x1c'),'extended':!![]}));_0x4381d1[_0x6e70('0xf')](bodyParser[_0x6e70('0x1d')]({'limit':_0x6e70('0x1c')}));_0x4381d1[_0x6e70('0xf')](cors());_0x4381d1['use'](methodOverride());_0x4381d1[_0x6e70('0xf')](cookieParser());_0x4381d1[_0x6e70('0xf')](passport[_0x6e70('0x1e')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index f73216c..8980c7e 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 _0x2ff8=['macAddress','ipAddress','substring','lodash','crypto','child_process','execSync','networkInterfaces','orderBy','keys','family','IPv4','internal','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','md5','update','digest','hex','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname'];(function(_0x51595b,_0x2550c0){var _0x19c9e5=function(_0x156346){while(--_0x156346){_0x51595b['push'](_0x51595b['shift']());}};_0x19c9e5(++_0x2550c0);}(_0x2ff8,0x1b0));var _0x82ff=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x2ff8[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x82ff('0x0'));var os=require('os');var crypto=require(_0x82ff('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0x82ff('0x2'))[_0x82ff('0x3')];function getInterfaces(){var _0x2d9bd3=[];var _0x9ac2e1=os[_0x82ff('0x4')]();var _0x3f5c5a=_[_0x82ff('0x5')](_[_0x82ff('0x6')](_0x9ac2e1));for(var _0x416f8b=0x0;_0x416f8b<_0x3f5c5a['length'];_0x416f8b++){var _0x57facd=_0x9ac2e1[_0x3f5c5a[_0x416f8b]]['filter'](function(_0x4406cd){return _0x4406cd[_0x82ff('0x7')]===_0x82ff('0x8')&&_0x4406cd[_0x82ff('0x9')]===![];});_0x2d9bd3=_0x2d9bd3['concat'](_0x57facd);}return _0x2d9bd3;}function getFirstInterface(){var _0x3e2dba=_[_0x82ff('0xa')](getInterfaces());return{'macAddress':_0x3e2dba&&_0x3e2dba[_0x82ff('0xb')]?_0x3e2dba['mac']:_0x82ff('0xc'),'ipAddress':_0x3e2dba&&_0x3e2dba[_0x82ff('0xd')]?_0x3e2dba['address']:_0x82ff('0xe')};}exports[_0x82ff('0xf')]=getFirstInterface;function getCPUhash(){var _0xbdfdf2=_[_0x82ff('0x5')](os[_0x82ff('0x10')]()[_0x82ff('0x11')](function(_0x1eb988){return _0x1eb988[_0x82ff('0x12')];}))[_0x82ff('0x13')](':');return crypto[_0x82ff('0x14')](_0x82ff('0x15'))[_0x82ff('0x16')](_0xbdfdf2)[_0x82ff('0x17')](_0x82ff('0x18'));}exports['getUuid']=function(){switch(os['platform']()){case _0x82ff('0x19'):return exec(_0x82ff('0x1a'),{'encoding':_0x82ff('0x1b')})[_0x82ff('0x1c')]('\x0d\x0a','');default:var _0x1bdec5=getFirstInterface();var _0x42c7e2=getCPUhash();var _0x2da573=_0x42c7e2+'|'+os[_0x82ff('0x1d')]()+'|'+_0x1bdec5[_0x82ff('0x1e')]+'|'+_0x1bdec5[_0x82ff('0x1f')];var _0x400443=crypto['createHash'](_0x82ff('0x15'))[_0x82ff('0x16')](_0x2da573)[_0x82ff('0x17')](_0x82ff('0x18'));return _0x400443['substring'](0x0,0x8)+'-'+_0x400443[_0x82ff('0x20')](0x8,0xc)+'-'+_0x400443['substring'](0xc,0x10)+'-'+_0x400443[_0x82ff('0x20')](0x10,0x14)+'-'+_0x400443['substring'](0x14);}}; \ No newline at end of file +var _0xadbd=['filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','join','createHash','md5','update','digest','hex','getUuid','win32','replace','hostname','macAddress','ipAddress','substring','lodash','child_process','networkInterfaces','orderBy','length'];(function(_0x126332,_0x3a0437){var _0x1c4a42=function(_0x52ff2c){while(--_0x52ff2c){_0x126332['push'](_0x126332['shift']());}};_0x1c4a42(++_0x3a0437);}(_0xadbd,0x150));var _0xdadb=function(_0x3dba5d,_0x55dfc5){_0x3dba5d=_0x3dba5d-0x0;var _0x1da134=_0xadbd[_0x3dba5d];return _0x1da134;};'use strict';var _=require(_0xdadb('0x0'));var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require(_0xdadb('0x1'))['execSync'];function getInterfaces(){var _0x4ab270=[];var _0x409879=os[_0xdadb('0x2')]();var _0x2c4147=_[_0xdadb('0x3')](_['keys'](_0x409879));for(var _0x5564c8=0x0;_0x5564c8<_0x2c4147[_0xdadb('0x4')];_0x5564c8++){var _0x42f856=_0x409879[_0x2c4147[_0x5564c8]][_0xdadb('0x5')](function(_0x42be24){return _0x42be24[_0xdadb('0x6')]===_0xdadb('0x7')&&_0x42be24[_0xdadb('0x8')]===![];});_0x4ab270=_0x4ab270[_0xdadb('0x9')](_0x42f856);}return _0x4ab270;}function getFirstInterface(){var _0x4b5013=_[_0xdadb('0xa')](getInterfaces());return{'macAddress':_0x4b5013&&_0x4b5013['mac']?_0x4b5013[_0xdadb('0xb')]:_0xdadb('0xc'),'ipAddress':_0x4b5013&&_0x4b5013[_0xdadb('0xd')]?_0x4b5013[_0xdadb('0xd')]:_0xdadb('0xe')};}exports[_0xdadb('0xf')]=getFirstInterface;function getCPUhash(){var _0x37cc8e=_[_0xdadb('0x3')](os[_0xdadb('0x10')]()[_0xdadb('0x11')](function(_0x33298d){return _0x33298d['model'];}))[_0xdadb('0x12')](':');return crypto[_0xdadb('0x13')](_0xdadb('0x14'))[_0xdadb('0x15')](_0x37cc8e)[_0xdadb('0x16')](_0xdadb('0x17'));}exports[_0xdadb('0x18')]=function(){switch(os['platform']()){case _0xdadb('0x19'):return exec('dmidecode\x20--string\x20system-uuid',{'encoding':'utf8'})[_0xdadb('0x1a')]('\x0d\x0a','');default:var _0x4ae881=getFirstInterface();var _0x5f0407=getCPUhash();var _0x23c144=_0x5f0407+'|'+os[_0xdadb('0x1b')]()+'|'+_0x4ae881[_0xdadb('0x1c')]+'|'+_0x4ae881[_0xdadb('0x1d')];var _0x943781=crypto[_0xdadb('0x13')](_0xdadb('0x14'))[_0xdadb('0x15')](_0x23c144)[_0xdadb('0x16')](_0xdadb('0x17'));return _0x943781[_0xdadb('0x1e')](0x0,0x8)+'-'+_0x943781[_0xdadb('0x1e')](0x8,0xc)+'-'+_0x943781['substring'](0xc,0x10)+'-'+_0x943781[_0xdadb('0x1e')](0x10,0x14)+'-'+_0x943781[_0xdadb('0x1e')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 140fc22..9588906 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 _0xa770=['version','GET','application/json','request','setEncoding','data','end','parse','error','createCipher','aes-256-ctr','secrets','session','utf8','base64','final','createDecipher','update','User','findOne','admin','fullname','|reason|','|uuid|','|machineUuid|','|name|','|email|','email','then','ipAddress','openIssue','get','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','data1','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','catch','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','util','https','crypto','bluebird','pkginfo','../../mysqldb','../environment','./hardware','../logger','license','../../api/jira/jira.controller','www.xcallymotion.com','format','exports'];(function(_0x5e1b91,_0x236f17){var _0x59b52f=function(_0x5c05ed){while(--_0x5c05ed){_0x5e1b91['push'](_0x5e1b91['shift']());}};_0x59b52f(++_0x236f17);}(_0xa770,0x76));var _0x0a77=function(_0x587cea,_0x35cc47){_0x587cea=_0x587cea-0x0;var _0x1ee97f=_0xa770[_0x587cea];return _0x1ee97f;};'use strict';var util=require(_0x0a77('0x0'));var https=require(_0x0a77('0x1'));var crypto=require(_0x0a77('0x2'));var moment=require('moment');var BPromise=require(_0x0a77('0x3'));var pkginfo=require(_0x0a77('0x4'))(module,'version');var db=require(_0x0a77('0x5'))['db'];var config=require(_0x0a77('0x6'));var hardware=require(_0x0a77('0x7'));var logger=require(_0x0a77('0x8'))(_0x0a77('0x9'));var jira=require(_0x0a77('0xa'));var HOST=_0x0a77('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;function httpRequest(_0x1ff804){return new BPromise(function(_0x3fef80,_0x1e8bbc){var _0x11a4c1={'host':HOST,'port':0x1bb,'path':util[_0x0a77('0xc')]('/api/servers/%s/check?version=%s',_0x1ff804,module[_0x0a77('0xd')][_0x0a77('0xe')]),'method':_0x0a77('0xf'),'timeout':0xea60,'headers':{'Content-Type':_0x0a77('0x10')}};var _0x2f1b6c=https[_0x0a77('0x11')](_0x11a4c1,function(_0x22f473){_0x22f473[_0x0a77('0x12')]('utf8');var _0x49b956='';_0x22f473['on'](_0x0a77('0x13'),function(_0x339f7a){_0x49b956+=_0x339f7a;});_0x22f473['on'](_0x0a77('0x14'),function(){try{_0x3fef80(JSON[_0x0a77('0x15')](_0x49b956));}catch(_0x7f378f){_0x1e8bbc(_0x7f378f);}});});_0x2f1b6c['on'](_0x0a77('0x16'),_0x1e8bbc);_0x2f1b6c['end']();});}function encryptDate(_0x1634ce){var _0x5d139b=crypto[_0x0a77('0x17')](_0x0a77('0x18'),config[_0x0a77('0x19')][_0x0a77('0x1a')]);var _0x53d05d=_0x5d139b['update'](_0x1634ce,_0x0a77('0x1b'),_0x0a77('0x1c'));_0x53d05d+=_0x5d139b[_0x0a77('0x1d')](_0x0a77('0x1c'));return _0x53d05d;}function decryptDate(_0x44693a){var _0x4dac0d=crypto[_0x0a77('0x1e')](_0x0a77('0x18'),config[_0x0a77('0x19')][_0x0a77('0x1a')]);var _0x677403=_0x4dac0d[_0x0a77('0x1f')](_0x44693a,_0x0a77('0x1c'),'utf8');_0x677403+=_0x4dac0d['final'](_0x0a77('0x1b'));return _0x677403;}function sendJiraAlert(_0x20e78a,_0x375f93,_0xe25f8d){var _0x3862c1='||FIELD||VALUE||\x0a';return db[_0x0a77('0x20')][_0x0a77('0x21')]({'where':{'role':_0x0a77('0x22')},'attributes':[_0x0a77('0x23'),'email'],'raw':!![]})['then'](function(_0x712fa0){ADMIN=_0x712fa0;_0x3862c1+=_0x0a77('0x24')+_0xe25f8d+'|\x0a';_0x3862c1+=_0x0a77('0x25')+_0x20e78a+'|\x0a';_0x3862c1+=_0x0a77('0x26')+_0x375f93+'|\x0a';_0x3862c1+=_0x0a77('0x27')+ADMIN['fullname']+'|\x0a';_0x3862c1+=_0x0a77('0x28')+ADMIN[_0x0a77('0x29')]+'|\x0a';return _0x3862c1;})[_0x0a77('0x2a')](function(_0x5cd9d8){var _0x4cfb54=hardware['getFirstInterface']()[_0x0a77('0x2b')];return jira[_0x0a77('0x2c')]({'key':'MOTLICENSE','summary':'Motion\x20License\x20Alert','description':_0x5cd9d8,'issuetype':'Alert','oldToken':_0x20e78a,'newToken':_0x375f93,'email':ADMIN['email'],'name':ADMIN[_0x0a77('0x23')],'reason':GRAY_PERIOD_REASON,'ip':_0x4cfb54});});}function manageLicense(_0x4ca7ac,_0x4efc74){var _0x3ce35c=_0x4efc74[_0x0a77('0x2d')]({'plain':!![]});httpRequest(_0x4ca7ac)[_0x0a77('0x2a')](function(_0x106922){if(_0x106922['active']){if(!_0x3ce35c['license']&&_0x3ce35c[_0x0a77('0x9')]!=_0x106922[_0x0a77('0x9')]||_0x3ce35c[_0x0a77('0x9')]&&_0x3ce35c[_0x0a77('0x2e')]){logger[_0x0a77('0x2f')](_0x0a77('0x30'));}if(_0x3ce35c['license']&&!_0x3ce35c[_0x0a77('0x2e')]&&_0x3ce35c[_0x0a77('0x9')]!=_0x106922['license']){logger[_0x0a77('0x2f')](_0x0a77('0x31'));}if(_0x3ce35c[_0x0a77('0x9')]&&!_0x3ce35c[_0x0a77('0x2e')]&&_0x3ce35c[_0x0a77('0x9')]==_0x106922[_0x0a77('0x9')]){return _0x4efc74;}return _0x4efc74[_0x0a77('0x1f')]({'data1':_0x4ca7ac,'data2':null,'license':_0x106922[_0x0a77('0x9')]});}else{if(_0x106922[_0x0a77('0x9')]||_0x3ce35c['license']){if(!_0x3ce35c[_0x0a77('0x2e')]){if(_0x3ce35c['data1']==_0x4ca7ac){GRAY_PERIOD_REASON=_0x0a77('0x32');logger[_0x0a77('0x2f')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';logger['info'](_0x0a77('0x33'),_0x3ce35c[_0x0a77('0x34')],_0x4ca7ac);}sendJiraAlert(_0x3ce35c[_0x0a77('0x34')],_0x106922[_0x0a77('0x35')],GRAY_PERIOD_REASON);logger['info'](_0x0a77('0x36'),GRAY_PERIOD_REASON[_0x0a77('0x37')](),moment()[_0x0a77('0xc')]('YYYY-MM-DD\x20HH:mm'));return _0x4efc74['update']({'data2':encryptDate(moment()[_0x0a77('0xc')](_0x0a77('0x38')))});}else{if(moment()[_0x0a77('0x39')](decryptDate(_0x3ce35c[_0x0a77('0x2e')]),_0x0a77('0x3a'))>DAYS){logger[_0x0a77('0x2f')](_0x0a77('0x3b'),moment()[_0x0a77('0xc')](_0x0a77('0x38')));return _0x4efc74['update']({'data1':_0x4ca7ac,'data2':null,'license':null});}}}else{if(_0x3ce35c[_0x0a77('0x34')]!=_0x4ca7ac){logger[_0x0a77('0x2f')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x3ce35c[_0x0a77('0x34')],_0x4ca7ac);return _0x4efc74[_0x0a77('0x1f')]({'data1':_0x4ca7ac,'data2':null,'license':null});}}}return _0x4efc74;})[_0x0a77('0x2a')](function(_0x5c6774){_0x4efc74=_0x5c6774;})[_0x0a77('0x3c')](function(_0x3cc378){logger[_0x0a77('0x16')](_0x3cc378['message']);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x0a77('0x3d')](),_0x4efc74);},TIME);});}function defaultLicense(){var _0x57f20c=hardware[_0x0a77('0x3d')]();if(_0x57f20c){return db['License'][_0x0a77('0x3e')]({'where':{'id':0x1},'defaults':{'data1':_0x57f20c}})[_0x0a77('0x3f')](function(_0xf3f3fb,_0x8e34e6){logger[_0x0a77('0x2f')](_0x0a77('0x40'),_0x57f20c);manageLicense(_0x57f20c,_0xf3f3fb);})[_0x0a77('0x3c')](function(_0x26228f){logger[_0x0a77('0x16')](_0x26228f[_0x0a77('0x41')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0xc9c3=['catch','util','crypto','bluebird','pkginfo','version','../../mysqldb','../environment','./hardware','../logger','../../api/jira/jira.controller','format','/api/servers/%s/check?version=%s','exports','GET','application/json','request','setEncoding','data','error','end','aes-256-ctr','secrets','session','update','utf8','final','base64','createDecipher','admin','fullname','email','then','|reason|','|uuid|','|machineUuid|','getFirstInterface','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','get','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','days','DEMO\x20START\x20AT\x20%s','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s'];(function(_0x100a78,_0x40d980){var _0xc14a5d=function(_0x22519a){while(--_0x22519a){_0x100a78['push'](_0x100a78['shift']());}};_0xc14a5d(++_0x40d980);}(_0xc9c3,0x146));var _0x3c9c=function(_0x7b1bda,_0x41424a){_0x7b1bda=_0x7b1bda-0x0;var _0x1f5515=_0xc9c3[_0x7b1bda];return _0x1f5515;};'use strict';var util=require(_0x3c9c('0x0'));var https=require('https');var crypto=require(_0x3c9c('0x1'));var moment=require('moment');var BPromise=require(_0x3c9c('0x2'));var pkginfo=require(_0x3c9c('0x3'))(module,_0x3c9c('0x4'));var db=require(_0x3c9c('0x5'))['db'];var config=require(_0x3c9c('0x6'));var hardware=require(_0x3c9c('0x7'));var logger=require(_0x3c9c('0x8'))('license');var jira=require(_0x3c9c('0x9'));var HOST='www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;function httpRequest(_0x1c6149){return new BPromise(function(_0x1008ba,_0x3d1b68){var _0x31489a={'host':HOST,'port':0x1bb,'path':util[_0x3c9c('0xa')](_0x3c9c('0xb'),_0x1c6149,module[_0x3c9c('0xc')]['version']),'method':_0x3c9c('0xd'),'timeout':0xea60,'headers':{'Content-Type':_0x3c9c('0xe')}};var _0x4040db=https[_0x3c9c('0xf')](_0x31489a,function(_0x427de5){_0x427de5[_0x3c9c('0x10')]('utf8');var _0x5545f8='';_0x427de5['on'](_0x3c9c('0x11'),function(_0x496829){_0x5545f8+=_0x496829;});_0x427de5['on']('end',function(){try{_0x1008ba(JSON['parse'](_0x5545f8));}catch(_0x2d9cbf){_0x3d1b68(_0x2d9cbf);}});});_0x4040db['on'](_0x3c9c('0x12'),_0x3d1b68);_0x4040db[_0x3c9c('0x13')]();});}function encryptDate(_0x54d2d5){var _0x552bab=crypto['createCipher'](_0x3c9c('0x14'),config[_0x3c9c('0x15')][_0x3c9c('0x16')]);var _0x1163e0=_0x552bab[_0x3c9c('0x17')](_0x54d2d5,_0x3c9c('0x18'),'base64');_0x1163e0+=_0x552bab[_0x3c9c('0x19')](_0x3c9c('0x1a'));return _0x1163e0;}function decryptDate(_0x59ae55){var _0x4fed96=crypto[_0x3c9c('0x1b')]('aes-256-ctr',config[_0x3c9c('0x15')][_0x3c9c('0x16')]);var _0x389206=_0x4fed96['update'](_0x59ae55,_0x3c9c('0x1a'),_0x3c9c('0x18'));_0x389206+=_0x4fed96[_0x3c9c('0x19')](_0x3c9c('0x18'));return _0x389206;}function sendJiraAlert(_0x364b86,_0x4dccb6,_0x130426){var _0xb91e1b='||FIELD||VALUE||\x0a';return db['User']['findOne']({'where':{'role':_0x3c9c('0x1c')},'attributes':[_0x3c9c('0x1d'),_0x3c9c('0x1e')],'raw':!![]})[_0x3c9c('0x1f')](function(_0x287edf){ADMIN=_0x287edf;_0xb91e1b+=_0x3c9c('0x20')+_0x130426+'|\x0a';_0xb91e1b+=_0x3c9c('0x21')+_0x364b86+'|\x0a';_0xb91e1b+=_0x3c9c('0x22')+_0x4dccb6+'|\x0a';_0xb91e1b+='|name|'+ADMIN[_0x3c9c('0x1d')]+'|\x0a';_0xb91e1b+='|email|'+ADMIN[_0x3c9c('0x1e')]+'|\x0a';return _0xb91e1b;})[_0x3c9c('0x1f')](function(_0x691fc1){var _0x430f1e=hardware[_0x3c9c('0x23')]()[_0x3c9c('0x24')];return jira[_0x3c9c('0x25')]({'key':_0x3c9c('0x26'),'summary':_0x3c9c('0x27'),'description':_0x691fc1,'issuetype':_0x3c9c('0x28'),'oldToken':_0x364b86,'newToken':_0x4dccb6,'email':ADMIN[_0x3c9c('0x1e')],'name':ADMIN[_0x3c9c('0x1d')],'reason':GRAY_PERIOD_REASON,'ip':_0x430f1e});});}function manageLicense(_0x2f89e1,_0x11b174){var _0x47818a=_0x11b174[_0x3c9c('0x29')]({'plain':!![]});httpRequest(_0x2f89e1)[_0x3c9c('0x1f')](function(_0x33abd2){if(_0x33abd2[_0x3c9c('0x2a')]){if(!_0x47818a[_0x3c9c('0x2b')]&&_0x47818a[_0x3c9c('0x2b')]!=_0x33abd2[_0x3c9c('0x2b')]||_0x47818a['license']&&_0x47818a['data2']){logger[_0x3c9c('0x2c')](_0x3c9c('0x2d'));}if(_0x47818a[_0x3c9c('0x2b')]&&!_0x47818a['data2']&&_0x47818a[_0x3c9c('0x2b')]!=_0x33abd2[_0x3c9c('0x2b')]){logger[_0x3c9c('0x2c')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x47818a[_0x3c9c('0x2b')]&&!_0x47818a[_0x3c9c('0x2e')]&&_0x47818a['license']==_0x33abd2[_0x3c9c('0x2b')]){return _0x11b174;}return _0x11b174[_0x3c9c('0x17')]({'data1':_0x2f89e1,'data2':null,'license':_0x33abd2['license']});}else{if(_0x33abd2['license']||_0x47818a[_0x3c9c('0x2b')]){if(!_0x47818a[_0x3c9c('0x2e')]){if(_0x47818a[_0x3c9c('0x2f')]==_0x2f89e1){GRAY_PERIOD_REASON=_0x3c9c('0x30');logger[_0x3c9c('0x2c')](_0x3c9c('0x31'));}else{GRAY_PERIOD_REASON=_0x3c9c('0x32');logger[_0x3c9c('0x2c')](_0x3c9c('0x33'),_0x47818a[_0x3c9c('0x2f')],_0x2f89e1);}sendJiraAlert(_0x47818a[_0x3c9c('0x2f')],_0x33abd2[_0x3c9c('0x34')],GRAY_PERIOD_REASON);logger[_0x3c9c('0x2c')](_0x3c9c('0x35'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x3c9c('0xa')](_0x3c9c('0x36')));return _0x11b174['update']({'data2':encryptDate(moment()[_0x3c9c('0xa')](_0x3c9c('0x36')))});}else{if(moment()['diff'](decryptDate(_0x47818a['data2']),_0x3c9c('0x37'))>DAYS){logger[_0x3c9c('0x2c')](_0x3c9c('0x38'),moment()[_0x3c9c('0xa')]('YYYY-MM-DD\x20HH:mm'));return _0x11b174[_0x3c9c('0x17')]({'data1':_0x2f89e1,'data2':null,'license':null});}}}else{if(_0x47818a['data1']!=_0x2f89e1){logger['info'](_0x3c9c('0x33'),_0x47818a[_0x3c9c('0x2f')],_0x2f89e1);return _0x11b174[_0x3c9c('0x17')]({'data1':_0x2f89e1,'data2':null,'license':null});}}}return _0x11b174;})['then'](function(_0xe0a2f7){_0x11b174=_0xe0a2f7;})['catch'](function(_0x56ed33){logger[_0x3c9c('0x12')](_0x56ed33[_0x3c9c('0x39')]);})[_0x3c9c('0x3a')](function(){setTimeout(function(){manageLicense(hardware[_0x3c9c('0x3b')](),_0x11b174);},TIME);});}function defaultLicense(){var _0x3d2662=hardware[_0x3c9c('0x3b')]();if(_0x3d2662){return db[_0x3c9c('0x3c')][_0x3c9c('0x3d')]({'where':{'id':0x1},'defaults':{'data1':_0x3d2662}})[_0x3c9c('0x3e')](function(_0x1b7cb6,_0x7979ee){logger[_0x3c9c('0x2c')](_0x3c9c('0x3f'),_0x3d2662);manageLicense(_0x3d2662,_0x1b7cb6);})[_0x3c9c('0x40')](function(_0x33eb67){logger[_0x3c9c('0x12')](_0x33eb67['message']);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 6e69634..4a69138 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 _0x7a18=['getLicense','License','find','defaults','then','crypto','util','lodash','./hardware','../environment','../../mysqldb','License\x20key\x20value\x20not\x20found','data1','data2','split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','demo','getUuid','createDecipher','add','days','grayReason','uuid','changed','disabled','2027-01-01T00:00:00.000Z','Demo\x20license'];(function(_0x21cd26,_0x26655c){var _0x46c104=function(_0x3582d4){while(--_0x3582d4){_0x21cd26['push'](_0x21cd26['shift']());}};_0x46c104(++_0x26655c);}(_0x7a18,0x115));var _0x87a1=function(_0x1f6f84,_0x2bab55){_0x1f6f84=_0x1f6f84-0x0;var _0x177f40=_0x7a18[_0x1f6f84];return _0x177f40;};'use strict';var crypto=require(_0x87a1('0x0'));var util=require(_0x87a1('0x1'));var _=require(_0x87a1('0x2'));var moment=require('moment');var hardware=require(_0x87a1('0x3'));var config=require(_0x87a1('0x4'));var db=require(_0x87a1('0x5'))['db'];function checkLicense(_0x12d733,_0x121ac4){if(_0x12d733){try{var _0x19e7d2=_0x121ac4||_0x12d733['license'];if(_['isEmpty'](_0x19e7d2)){throw new Error(_0x87a1('0x6'));}var _0x283918=_0x12d733[_0x87a1('0x7')];var _0x3e04e4=_0x12d733[_0x87a1('0x8')];var _0x4e23e9=_0x283918[_0x87a1('0x9')]('-')[0x4];var _0x4b1e89=_0x283918[_0x87a1('0x9')]('-')[0x0];var _0x9111c0=crypto['createDecipher'](_0x87a1('0xa'),util[_0x87a1('0xb')](_0x87a1('0xc'),_0x4e23e9,_0x283918,_0x4b1e89));var _0x54d860=_0x9111c0[_0x87a1('0xd')](_0x19e7d2,_0x87a1('0xe'),_0x87a1('0xf'));_0x54d860+=_0x9111c0[_0x87a1('0x10')](_0x87a1('0xf'));var _0x3e6a53=JSON[_0x87a1('0x11')](_0x54d860);_0x3e6a53[_0x87a1('0x12')]=![];_0x3e6a53['uuid']=_0x283918;_0x3e6a53['machineUuid']=hardware[_0x87a1('0x13')]();if(_0x3e04e4){var _0x24f744=crypto[_0x87a1('0x14')]('aes-256-ctr',config['secrets']['session']);var _0x2dff12=_0x24f744[_0x87a1('0xd')](_0x3e04e4,_0x87a1('0xe'),_0x87a1('0xf'));_0x2dff12+=_0x24f744[_0x87a1('0x10')](_0x87a1('0xf'));_0x3e6a53['gray']=_0x2dff12;_0x3e6a53['deadline']=moment(_0x2dff12)[_0x87a1('0x15')](0x7,_0x87a1('0x16'))['format']();_0x3e6a53[_0x87a1('0x17')]=_0x3e6a53[_0x87a1('0x18')]!=_0x3e6a53['machineUuid']?_0x87a1('0x19'):_0x87a1('0x1a');}return _0x3e6a53;}catch(_0x42fd39){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','uuid':_0x12d733[_0x87a1('0x7')],'machineUuid':hardware[_0x87a1('0x13')](),'message':_0x42fd39['message'],'virtual':0x0,'voice':!![],'preferred':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x87a1('0x1b'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x87a1('0x1c'),'uuid':_0x12d733['data1'],'machineUuid':hardware[_0x87a1('0x13')](),'virtual':0x0,'voice':!![],'preferred':![]};}exports[_0x87a1('0x1d')]=function(_0x585e03){return db[_0x87a1('0x1e')][_0x87a1('0x1f')](_[_0x87a1('0x20')](_0x585e03,{'raw':!![],'where':{'id':0x1}}))[_0x87a1('0x21')](function(_0x1b1229){return checkLicense(_0x1b1229,null);});};exports['checkLicense']=checkLicense; \ No newline at end of file +var _0xaf32=['update','base64','deadline','add','days','format','grayReason','changed','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','message','Demo\x20license','getLicense','License','find','crypto','util','lodash','moment','./hardware','../environment','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','createDecipher','aes-256-ctr','%s:%s:%s','final','utf8','parse','demo','machineUuid','getUuid','secrets'];(function(_0x518b9e,_0x5a7924){var _0x115234=function(_0x5c2c29){while(--_0x5c2c29){_0x518b9e['push'](_0x518b9e['shift']());}};_0x115234(++_0x5a7924);}(_0xaf32,0x166));var _0x2af3=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xaf32[_0x5f3f88];return _0xd08119;};'use strict';var crypto=require(_0x2af3('0x0'));var util=require(_0x2af3('0x1'));var _=require(_0x2af3('0x2'));var moment=require(_0x2af3('0x3'));var hardware=require(_0x2af3('0x4'));var config=require(_0x2af3('0x5'));var db=require('../../mysqldb')['db'];function checkLicense(_0x346638,_0x276258){if(_0x346638){try{var _0x4b3f8e=_0x276258||_0x346638[_0x2af3('0x6')];if(_[_0x2af3('0x7')](_0x4b3f8e)){throw new Error(_0x2af3('0x8'));}var _0x1913d8=_0x346638[_0x2af3('0x9')];var _0x5bd420=_0x346638[_0x2af3('0xa')];var _0x2d4b22=_0x1913d8['split']('-')[0x4];var _0x10bc88=_0x1913d8[_0x2af3('0xb')]('-')[0x0];var _0x2303eb=crypto[_0x2af3('0xc')](_0x2af3('0xd'),util['format'](_0x2af3('0xe'),_0x2d4b22,_0x1913d8,_0x10bc88));var _0x4e0cb5=_0x2303eb['update'](_0x4b3f8e,'base64','utf8');_0x4e0cb5+=_0x2303eb[_0x2af3('0xf')](_0x2af3('0x10'));var _0x3ebea7=JSON[_0x2af3('0x11')](_0x4e0cb5);_0x3ebea7[_0x2af3('0x12')]=![];_0x3ebea7['uuid']=_0x1913d8;_0x3ebea7[_0x2af3('0x13')]=hardware[_0x2af3('0x14')]();if(_0x5bd420){var _0x4fb3f4=crypto[_0x2af3('0xc')](_0x2af3('0xd'),config[_0x2af3('0x15')]['session']);var _0x284ea4=_0x4fb3f4[_0x2af3('0x16')](_0x5bd420,_0x2af3('0x17'),_0x2af3('0x10'));_0x284ea4+=_0x4fb3f4[_0x2af3('0xf')](_0x2af3('0x10'));_0x3ebea7['gray']=_0x284ea4;_0x3ebea7[_0x2af3('0x18')]=moment(_0x284ea4)[_0x2af3('0x19')](0x7,_0x2af3('0x1a'))[_0x2af3('0x1b')]();_0x3ebea7[_0x2af3('0x1c')]=_0x3ebea7['uuid']!=_0x3ebea7['machineUuid']?_0x2af3('0x1d'):_0x2af3('0x1e');}return _0x3ebea7;}catch(_0x5636b4){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x2af3('0x1f'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x2af3('0x20'),'uuid':_0x346638[_0x2af3('0x9')],'machineUuid':hardware[_0x2af3('0x14')](),'message':_0x5636b4[_0x2af3('0x21')],'virtual':0x0,'voice':!![],'preferred':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x2af3('0x1f'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x2af3('0x22'),'uuid':_0x346638[_0x2af3('0x9')],'machineUuid':hardware[_0x2af3('0x14')](),'virtual':0x0,'voice':!![],'preferred':![]};}exports[_0x2af3('0x23')]=function(_0x47079e){return db[_0x2af3('0x24')][_0x2af3('0x25')](_['defaults'](_0x47079e,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x4d6e2a){return checkLicense(_0x4d6e2a,null);});};exports['checkLicense']=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index caed09b..f442efa 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 _0x279d=['exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x2e9930,_0x55a359){var _0x3aa37b=function(_0x117a4b){while(--_0x117a4b){_0x2e9930['push'](_0x2e9930['shift']());}};_0x3aa37b(++_0x55a359);}(_0x279d,0x1d8));var _0xd279=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x279d[_0xbd08b4];return _0x314f1e;};'use strict';module[_0xd279('0x0')]={'DOMAIN':_0xd279('0x1'),'SESSION_SECRET':_0xd279('0x2'),'GOOGLE_ID':_0xd279('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x8c99=['http://localhost:9000','myappanuglar-secret','app-id','secret','exports'];(function(_0x3ac901,_0x35c9bc){var _0x3153b9=function(_0x8763f9){while(--_0x8763f9){_0x3ac901['push'](_0x3ac901['shift']());}};_0x3153b9(++_0x35c9bc);}(_0x8c99,0x1a8));var _0x98c9=function(_0x3c97e3,_0x321677){_0x3c97e3=_0x3c97e3-0x0;var _0x9bb0ed=_0x8c99[_0x3c97e3];return _0x9bb0ed;};'use strict';module[_0x98c9('0x0')]={'DOMAIN':_0x98c9('0x1'),'SESSION_SECRET':_0x98c9('0x2'),'GOOGLE_ID':_0x98c9('0x3'),'GOOGLE_SECRET':_0x98c9('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 9905c91..556f94a 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd222=['debugLevel','moment','/var','log','xcally','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message','Logger','File','%s-%s','error','transports','info','Console','env'];(function(_0x590766,_0x26a057){var _0x4e2f10=function(_0x5d96a4){while(--_0x5d96a4){_0x590766['push'](_0x590766['shift']());}};_0x4e2f10(++_0x26a057);}(_0xd222,0x157));var _0x2d22=function(_0x4eec9b,_0x4aea09){_0x4eec9b=_0x4eec9b-0x0;var _0x2e3849=_0xd222[_0x4eec9b];return _0x2e3849;};'use strict';var moment=require(_0x2d22('0x0'));var winston=require('winston');var util=require('util');var path=require('path');var debugLevel='INFO';function filename(_0x277a43,_0x12ce89){return path['join'](_0x2d22('0x1'),_0x2d22('0x2'),_0x2d22('0x3'),util[_0x2d22('0x4')]('%s-%s.log',_0x277a43,_0x12ce89));}function formatter(_0x582b72,_0xd0994a){return util[_0x2d22('0x4')](_0x2d22('0x5'),moment()['format'](_0x2d22('0x6')),_0xd0994a[_0x2d22('0x7')][_0x2d22('0x8')](),_0x582b72,_0xd0994a[_0x2d22('0x9')]);}module['exports']=function(_0x4c9b45){return new winston[(_0x2d22('0xa'))]({'transports':[new winston['transports'][(_0x2d22('0xb'))]({'name':util[_0x2d22('0x4')](_0x2d22('0xc'),_0x4c9b45,_0x2d22('0xd')),'filename':filename(_0x4c9b45,_0x2d22('0xd')),'level':_0x2d22('0xd'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4e43b9){return formatter(_0x4c9b45,_0x4e43b9);}}),new winston[(_0x2d22('0xe'))][(_0x2d22('0xb'))]({'name':util[_0x2d22('0x4')](_0x2d22('0xc'),_0x4c9b45,_0x2d22('0xf')),'filename':filename(_0x4c9b45,_0x2d22('0xf')),'level':_0x2d22('0xf'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x249c55){return formatter(_0x4c9b45,_0x249c55);}}),new winston[(_0x2d22('0xe'))][(_0x2d22('0x10'))]({'level':process[_0x2d22('0x11')][_0x2d22('0x12')]||debugLevel,'json':![],'formatter':function(_0x108bed){return formatter(_0x4c9b45,_0x108bed);}})]});}; \ No newline at end of file +var _0x424f=['Console','env','debugLevel','moment','winston','util','INFO','join','/var','%s-%s.log','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','message','transports','File','%s-%s','error','info'];(function(_0x1cdb2d,_0x8f1f76){var _0x4dafe3=function(_0xec694e){while(--_0xec694e){_0x1cdb2d['push'](_0x1cdb2d['shift']());}};_0x4dafe3(++_0x8f1f76);}(_0x424f,0x8f));var _0xf424=function(_0x5dfaf3,_0x572974){_0x5dfaf3=_0x5dfaf3-0x0;var _0x4debc6=_0x424f[_0x5dfaf3];return _0x4debc6;};'use strict';var moment=require(_0xf424('0x0'));var winston=require(_0xf424('0x1'));var util=require(_0xf424('0x2'));var path=require('path');var debugLevel=_0xf424('0x3');function filename(_0xb99cdc,_0x2bc7c5){return path[_0xf424('0x4')](_0xf424('0x5'),'log','xcally',util['format'](_0xf424('0x6'),_0xb99cdc,_0x2bc7c5));}function formatter(_0x57256a,_0x375dfa){return util[_0xf424('0x7')](_0xf424('0x8'),moment()[_0xf424('0x7')](_0xf424('0x9')),_0x375dfa[_0xf424('0xa')]['toUpperCase'](),_0x57256a,_0x375dfa[_0xf424('0xb')]);}module['exports']=function(_0x540ecf){return new winston['Logger']({'transports':[new winston[(_0xf424('0xc'))][(_0xf424('0xd'))]({'name':util['format'](_0xf424('0xe'),_0x540ecf,_0xf424('0xf')),'filename':filename(_0x540ecf,_0xf424('0xf')),'level':_0xf424('0xf'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3c0d75){return formatter(_0x540ecf,_0x3c0d75);}}),new winston[(_0xf424('0xc'))][(_0xf424('0xd'))]({'name':util[_0xf424('0x7')](_0xf424('0xe'),_0x540ecf,_0xf424('0x10')),'filename':filename(_0x540ecf,_0xf424('0x10')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4d8a8d){return formatter(_0x540ecf,_0x4d8a8d);}}),new winston[(_0xf424('0xc'))][(_0xf424('0x11'))]({'level':process[_0xf424('0x12')][_0xf424('0x13')]||debugLevel,'json':![],'formatter':function(_0x12aaf5){return formatter(_0x540ecf,_0x12aaf5);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 03e2ae3..355d89b 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 _0x9d6a=['xdr','../../services/xdr/index.js','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js'];(function(_0x2953ed,_0x12a100){var _0x418465=function(_0x5b0ebb){while(--_0x5b0ebb){_0x2953ed['push'](_0x2953ed['shift']());}};_0x418465(++_0x12a100);}(_0x9d6a,0x1d0));var _0xa9d6=function(_0x4ab3d9,_0x36ac73){_0x4ab3d9=_0x4ab3d9-0x0;var _0x3b0b2f=_0x9d6a[_0x4ab3d9];return _0x3b0b2f;};'use strict';var path=require(_0xa9d6('0x0'));var os=require('os');var config={'apps':[{'name':_0xa9d6('0x1'),'script':path[_0xa9d6('0x2')](__dirname,_0xa9d6('0x3'))},{'name':_0xa9d6('0x4'),'script':path['join'](__dirname,_0xa9d6('0x5'))},{'name':_0xa9d6('0x6'),'script':path[_0xa9d6('0x2')](__dirname,_0xa9d6('0x7'))},{'name':_0xa9d6('0x8'),'script':path['join'](__dirname,_0xa9d6('0x9'))},{'name':_0xa9d6('0xa'),'script':path[_0xa9d6('0x2')](__dirname,_0xa9d6('0xb'))},{'name':_0xa9d6('0xc'),'script':path[_0xa9d6('0x2')](__dirname,_0xa9d6('0xd'))}]};module['exports']=config; \ No newline at end of file +var _0x1288=['../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','join','../../services/express/index.js','ami'];(function(_0x457086,_0x418cc8){var _0x4a005b=function(_0x47e4e6){while(--_0x47e4e6){_0x457086['push'](_0x457086['shift']());}};_0x4a005b(++_0x418cc8);}(_0x1288,0x14c));var _0x8128=function(_0x47500b,_0x302762){_0x47500b=_0x47500b-0x0;var _0x492943=_0x1288[_0x47500b];return _0x492943;};'use strict';var path=require(_0x8128('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0x8128('0x1')](__dirname,_0x8128('0x2'))},{'name':_0x8128('0x3'),'script':path[_0x8128('0x1')](__dirname,_0x8128('0x4'))},{'name':_0x8128('0x5'),'script':path[_0x8128('0x1')](__dirname,_0x8128('0x6'))},{'name':_0x8128('0x7'),'script':path[_0x8128('0x1')](__dirname,_0x8128('0x8'))},{'name':_0x8128('0x9'),'script':path['join'](__dirname,_0x8128('0xa'))},{'name':_0x8128('0xb'),'script':path[_0x8128('0x1')](__dirname,_0x8128('0xc'))}]};module[_0x8128('0xd')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 06919e0..1e07585 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 _0x9957=['stop','disconnect','restart','list','describe','delete','dump','pm2','bluebird','./config','connect','connected','start','then'];(function(_0x12d951,_0x249808){var _0x44de17=function(_0x182fd9){while(--_0x182fd9){_0x12d951['push'](_0x12d951['shift']());}};_0x44de17(++_0x249808);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var pm2=require(_0x7995('0x0'));var BPromise=require(_0x7995('0x1'));var config=require(_0x7995('0x2'));function connect(){return new BPromise(function(_0x10a05d,_0x5b96eb){return pm2[_0x7995('0x3')](function(_0x3c58eb){if(_0x3c58eb){return _0x5b96eb(_0x3c58eb);}return _0x10a05d(_0x7995('0x4'));});});};exports[_0x7995('0x5')]=function(_0x576d89){return connect()[_0x7995('0x6')](function(){return new BPromise(function(_0x1a36d8,_0x137b6b){return pm2[_0x7995('0x5')](_0x576d89,function(_0xbda126,_0x326741){if(_0xbda126){return _0x137b6b(_0xbda126);}pm2['disconnect']();return _0x1a36d8(_0x326741);});});});};exports[_0x7995('0x7')]=function(_0x1cad37){return connect()['then'](function(){return new BPromise(function(_0xa2e5f0,_0x3116fb){return pm2[_0x7995('0x7')](_0x1cad37,function(_0x35b5fe,_0x3c1d19){if(_0x35b5fe){return _0x3116fb(_0x35b5fe);}pm2[_0x7995('0x8')]();return _0xa2e5f0(_0x3c1d19);});});});};exports[_0x7995('0x9')]=function(_0x524f7b){return connect()[_0x7995('0x6')](function(){return new BPromise(function(_0x41c652,_0x581f22){return pm2[_0x7995('0x9')](_0x524f7b,function(_0x2cb37a,_0x19a27e){if(_0x2cb37a){return _0x581f22(_0x2cb37a);}pm2[_0x7995('0x8')]();return _0x41c652(_0x19a27e);});});});};exports[_0x7995('0xa')]=function(){return connect()[_0x7995('0x6')](function(){return new BPromise(function(_0x2bbe7a,_0x4cc004){return pm2['list'](function(_0x2b4e94,_0x2233dd){if(_0x2b4e94){return _0x4cc004(_0x2b4e94);}pm2[_0x7995('0x8')]();return _0x2bbe7a(_0x2233dd);});});});};exports[_0x7995('0xb')]=function(_0x3f1d3e){return connect()[_0x7995('0x6')](function(){return new BPromise(function(_0x2202ce,_0x41cbf0){return pm2['describe'](_0x3f1d3e,function(_0x2eeacc,_0x565d97){if(_0x2eeacc){return _0x41cbf0(_0x2eeacc);}pm2[_0x7995('0x8')]();return _0x2202ce(_0x565d97);});});});};exports[_0x7995('0xc')]=function(_0x43d4b8){return connect()[_0x7995('0x6')](function(){return new BPromise(function(_0x1e1415,_0x37a7d4){return pm2['delete'](_0x43d4b8,function(_0x54c9ae,_0x2536c8){if(_0x54c9ae){return _0x37a7d4(_0x54c9ae);}pm2['disconnect']();return _0x1e1415(_0x2536c8);});});});};exports['dump']=function(){return connect()[_0x7995('0x6')](function(){return new BPromise(function(_0x3d463e,_0x4cbe10){return pm2[_0x7995('0xd')](function(_0x51f276){if(_0x51f276){return _0x4cbe10(_0x51f276);}return _0x3d463e('saved');});});});}; \ No newline at end of file +var _0x3e74=['saved','pm2','./config','connected','then','start','disconnect','stop','list','describe','delete','dump'];(function(_0x67f155,_0x4cc941){var _0x1226bc=function(_0x544dd3){while(--_0x544dd3){_0x67f155['push'](_0x67f155['shift']());}};_0x1226bc(++_0x4cc941);}(_0x3e74,0x175));var _0x43e7=function(_0x3ece55,_0x40aeec){_0x3ece55=_0x3ece55-0x0;var _0x5f380b=_0x3e74[_0x3ece55];return _0x5f380b;};'use strict';var pm2=require(_0x43e7('0x0'));var BPromise=require('bluebird');var config=require(_0x43e7('0x1'));function connect(){return new BPromise(function(_0x287a1d,_0x151ad2){return pm2['connect'](function(_0x490ced){if(_0x490ced){return _0x151ad2(_0x490ced);}return _0x287a1d(_0x43e7('0x2'));});});};exports['start']=function(_0x128b0f){return connect()[_0x43e7('0x3')](function(){return new BPromise(function(_0xe78cb7,_0x1c503b){return pm2[_0x43e7('0x4')](_0x128b0f,function(_0x503698,_0x45a0d1){if(_0x503698){return _0x1c503b(_0x503698);}pm2[_0x43e7('0x5')]();return _0xe78cb7(_0x45a0d1);});});});};exports[_0x43e7('0x6')]=function(_0x8528fc){return connect()[_0x43e7('0x3')](function(){return new BPromise(function(_0x516b4d,_0x212c6c){return pm2['stop'](_0x8528fc,function(_0x54948c,_0x39c8bd){if(_0x54948c){return _0x212c6c(_0x54948c);}pm2[_0x43e7('0x5')]();return _0x516b4d(_0x39c8bd);});});});};exports['restart']=function(_0x2803d9){return connect()['then'](function(){return new BPromise(function(_0xf7c520,_0x37302c){return pm2['restart'](_0x2803d9,function(_0x3eb206,_0xc960ea){if(_0x3eb206){return _0x37302c(_0x3eb206);}pm2[_0x43e7('0x5')]();return _0xf7c520(_0xc960ea);});});});};exports[_0x43e7('0x7')]=function(){return connect()['then'](function(){return new BPromise(function(_0x583d85,_0x2fcb36){return pm2[_0x43e7('0x7')](function(_0x44b0bd,_0x51b974){if(_0x44b0bd){return _0x2fcb36(_0x44b0bd);}pm2['disconnect']();return _0x583d85(_0x51b974);});});});};exports[_0x43e7('0x8')]=function(_0x14c146){return connect()[_0x43e7('0x3')](function(){return new BPromise(function(_0x328445,_0x4de324){return pm2['describe'](_0x14c146,function(_0xdf16c,_0x264575){if(_0xdf16c){return _0x4de324(_0xdf16c);}pm2[_0x43e7('0x5')]();return _0x328445(_0x264575);});});});};exports['delete']=function(_0x4b5a6b){return connect()[_0x43e7('0x3')](function(){return new BPromise(function(_0x1ca758,_0x9037d3){return pm2[_0x43e7('0x9')](_0x4b5a6b,function(_0x3776f5,_0x1f24fb){if(_0x3776f5){return _0x9037d3(_0x3776f5);}pm2[_0x43e7('0x5')]();return _0x1ca758(_0x1f24fb);});});});};exports[_0x43e7('0xa')]=function(){return connect()[_0x43e7('0x3')](function(){return new BPromise(function(_0xab63cf,_0x191dd5){return pm2[_0x43e7('0xa')](function(_0x4b5d64){if(_0x4b5d64){return _0x191dd5(_0x4b5d64);}return _0xab63cf(_0x43e7('0xb'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index aacc2ed..050e99b 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 _0x2f90=['then','update','timeout','format','map','length','emit','chatInteraction:update','error','moment','ioredis','../../mysqldb','../../config/environment','redis','defaults','localhost','socket.io-emitter','Setting','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes'];(function(_0x35e421,_0x569738){var _0x46d70e=function(_0x86063f){while(--_0x86063f){_0x35e421['push'](_0x35e421['shift']());}};_0x46d70e(++_0x569738);}(_0x2f90,0x1e9));var _0x02f9=function(_0x40e7c7,_0x5a9bb3){_0x40e7c7=_0x40e7c7-0x0;var _0x41c9cd=_0x2f90[_0x40e7c7];return _0x41c9cd;};'use strict';var _=require('lodash');var moment=require(_0x02f9('0x0'));var Redis=require(_0x02f9('0x1'));var db=require(_0x02f9('0x2'))['db'];var config=require(_0x02f9('0x3'));config[_0x02f9('0x4')]=_[_0x02f9('0x5')](config[_0x02f9('0x4')],{'host':_0x02f9('0x6'),'port':0x18eb});var io=require(_0x02f9('0x7'))(new Redis(config['redis']));function closeInteractions(){var _0x312c2c=0x0;var _0x259c76=[];return db[_0x02f9('0x8')]['find']({'raw':!![],'attributes':['id',_0x02f9('0x9')],'where':{'id':0x1}})['then'](function(_0x34135f){_0x312c2c=_0x34135f[_0x02f9('0x9')];if(_0x312c2c){return db[_0x02f9('0xa')][_0x02f9('0xb')]({'raw':!![],'attributes':['id',_0x02f9('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x02f9('0xd')](_0x34135f[_0x02f9('0x9')],_0x02f9('0xe'))}}});}else{return[];}})[_0x02f9('0xf')](function(_0x312a4a){_0x259c76=_0x312a4a;if(_0x312c2c){return db[_0x02f9('0xa')][_0x02f9('0x10')]({'closeReason':'system','disposition':_0x02f9('0x11'),'closed':!![],'closedAt':moment()[_0x02f9('0x12')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_[_0x02f9('0x13')](_0x259c76||[],'id')}});}})[_0x02f9('0xf')](function(_0x5a8561){for(var _0x399bde=0x0;_0x399bde<_0x259c76[_0x02f9('0x14')];_0x399bde++){io[_0x02f9('0x15')](_0x02f9('0x16'),{'id':_0x259c76[_0x399bde]['id'],'closed':!![]});}})['catch'](function(_0x1fd253){console[_0x02f9('0x17')](_0x1fd253);});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x6e6c=['../../config/environment','redis','socket.io-emitter','find','chatTimeout','findAll','subtract','minutes','then','ChatInteraction','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','length','chatInteraction:update','catch','error','start','lodash','moment','../../mysqldb'];(function(_0x1bc581,_0x108433){var _0x54bcce=function(_0x21591b){while(--_0x21591b){_0x1bc581['push'](_0x1bc581['shift']());}};_0x54bcce(++_0x108433);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xc6e6('0x0'));var moment=require(_0xc6e6('0x1'));var Redis=require('ioredis');var db=require(_0xc6e6('0x2'))['db'];var config=require(_0xc6e6('0x3'));config['redis']=_['defaults'](config[_0xc6e6('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xc6e6('0x5'))(new Redis(config['redis']));function closeInteractions(){var _0xe59212=0x0;var _0x1182c7=[];return db['Setting'][_0xc6e6('0x6')]({'raw':!![],'attributes':['id',_0xc6e6('0x7')],'where':{'id':0x1}})['then'](function(_0x324706){_0xe59212=_0x324706[_0xc6e6('0x7')];if(_0xe59212){return db['ChatInteraction'][_0xc6e6('0x8')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xc6e6('0x9')](_0x324706[_0xc6e6('0x7')],_0xc6e6('0xa'))}}});}else{return[];}})[_0xc6e6('0xb')](function(_0x12596b){_0x1182c7=_0x12596b;if(_0xe59212){return db[_0xc6e6('0xc')][_0xc6e6('0xd')]({'closeReason':_0xc6e6('0xe'),'disposition':_0xc6e6('0xf'),'closed':!![],'closedAt':moment()['format'](_0xc6e6('0x10'))},{'where':{'id':_['map'](_0x1182c7||[],'id')}});}})[_0xc6e6('0xb')](function(_0x314d0f){for(var _0x33aea0=0x0;_0x33aea0<_0x1182c7[_0xc6e6('0x11')];_0x33aea0++){io['emit'](_0xc6e6('0x12'),{'id':_0x1182c7[_0x33aea0]['id'],'closed':!![]});}})[_0xc6e6('0x13')](function(_0x13be73){console[_0xc6e6('0x14')](_0x13be73);});}exports[_0xc6e6('0x15')]=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 7f95f1d..d29dd8a 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 _0xb13d=['toString','keyBy','intersection','exists','stop','deleteJob','delete\x20cron','toRun','length','my\x20id','resolve','cron','endAt','add','stop\x20cron','active','update','update\x20cron','run','start','util','path','lodash','bluebird','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','pass','format','\x22%s\x22\x20<%s>','name','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','../../files/reports','savename','%s.%s','zip','existsSync','status','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','request','SendMail','then','error','error\x20mail','stringify','catch','isNil','subtractUnit','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','CustomReportId','exec\x20custom\x20report\x20id:%s','MailServerOut','jobs','map'];(function(_0x473769,_0x2bc628){var _0xe7445d=function(_0x132557){while(--_0x132557){_0x473769['push'](_0x473769['shift']());}};_0xe7445d(++_0x2bc628);}(_0xb13d,0x1ee));var _0xdb13=function(_0x5ddba6,_0x41f638){_0x5ddba6=_0x5ddba6-0x0;var _0x2964e3=_0xb13d[_0x5ddba6];return _0x2964e3;};'use strict';var fs=require('fs');var util=require(_0xdb13('0x0'));var path=require(_0xdb13('0x1'));var _=require(_0xdb13('0x2'));var moment=require('moment');var CronJobManager=require('cron-job-manager');var jayson=require('jayson/promise');var BPromise=require(_0xdb13('0x3'));var logger=require(_0xdb13('0x4'))(_0xdb13('0x5'));var db=require(_0xdb13('0x6'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xdb13('0x7'));var client=jayson[_0xdb13('0x8')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5f1071,_0x7ecd2d){return function(){logger['info'](_0xdb13('0x9'),_0x5f1071[_0xdb13('0xa')]);var _0x2fd8fa=!![];var _0xec3a16={'tls':{'rejectUnauthorized':![]}};if(_0x5f1071[_0xdb13('0xb')][_0xdb13('0xc')][_0xdb13('0xd')]){_0xec3a16[_0xdb13('0xd')]=_0x5f1071[_0xdb13('0xb')][_0xdb13('0xc')][_0xdb13('0xd')];}else{_0xec3a16['host']=_0x5f1071[_0xdb13('0xb')][_0xdb13('0xc')][_0xdb13('0xe')];_0xec3a16[_0xdb13('0xf')]=_0x5f1071[_0xdb13('0xb')][_0xdb13('0xc')][_0xdb13('0xf')];_0xec3a16[_0xdb13('0x10')]=_0x5f1071[_0xdb13('0xb')]['Smtp'][_0xdb13('0x10')];}if(_0x5f1071['MailAccount'][_0xdb13('0xc')][_0xdb13('0x11')]){_0xec3a16[_0xdb13('0x12')]={'user':_0x5f1071[_0xdb13('0xb')]['Smtp']['user'],'pass':_0x5f1071[_0xdb13('0xb')][_0xdb13('0xc')][_0xdb13('0x13')]};}var _0x29ade3={'account':_0xec3a16,'message':{'from':util[_0xdb13('0x14')](_0xdb13('0x15'),_0x5f1071['MailAccount'][_0xdb13('0x16')],_0x5f1071['MailAccount'][_0xdb13('0xa')]||_0x5f1071[_0xdb13('0xb')][_0xdb13('0xc')][_0xdb13('0x17')]),'to':_0x5f1071[_0xdb13('0xa')],'cc':_0x5f1071['cc'],'bcc':_0x5f1071[_0xdb13('0x18')],'subject':util['format'](_0xdb13('0x19'),_0x7ecd2d[_0xdb13('0x16')],_0x5f1071[_0xdb13('0x1a')],_0x5f1071['subtractUnit'])}};var _0x2ec88e=path['join'](__dirname,_0xdb13('0x1b'));var _0x4c4ec0=_0x7ecd2d[_0xdb13('0x1c')];var _0x426972=util['format'](_0xdb13('0x1d'),path['basename'](_0x7ecd2d[_0xdb13('0x1c')],path['extname'](_0x7ecd2d[_0xdb13('0x1c')])),_0xdb13('0x1e'));var _0x3ff388=path['join'](_0x2ec88e,_0x4c4ec0);var _0x31f0d2=path['join'](_0x2ec88e,_0x426972);if(fs[_0xdb13('0x1f')](_0x3ff388)){_0x7ecd2d[_0xdb13('0x20')]='Sent';_0x29ade3[_0xdb13('0x21')][_0xdb13('0x22')]=[{'filename':_0x4c4ec0,'path':_0x3ff388}];_0x29ade3['message']['text']=util[_0xdb13('0x14')](_0xdb13('0x23'),JSON['stringify'](_0x7ecd2d,null,0x2));}else if(fs['existsSync'](_0x31f0d2)){_0x7ecd2d[_0xdb13('0x20')]='Sent';_0x29ade3['message'][_0xdb13('0x22')]=[{'filename':_0x426972,'path':_0x31f0d2}];}else{_0x29ade3[_0xdb13('0x21')][_0xdb13('0x24')]=_0xdb13('0x25');if(!_0x5f1071[_0xdb13('0x26')]){_0x2fd8fa=![];logger[_0xdb13('0x27')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x2fd8fa){return client[_0xdb13('0x28')](_0xdb13('0x29'),_0x29ade3)[_0xdb13('0x2a')](function(_0x4ae426){if(_0x4ae426['error']){return logger[_0xdb13('0x2b')](_0xdb13('0x2c'),JSON[_0xdb13('0x2d')](_0x4ae426));}return logger[_0xdb13('0x27')]('email\x20sent');})[_0xdb13('0x2e')](function(_0x413642){return logger[_0xdb13('0x2b')](_0xdb13('0x2c'),JSON[_0xdb13('0x2d')](_0x413642));});}};}function handleError(){return function(_0x2089b3){return logger['error'](JSON[_0xdb13('0x2d')](_0x2089b3));};}function handleResult(_0x5d775a){return function(_0x386705){logger['info']('data',JSON['stringify'](_0x386705));if(_0x5d775a['MailAccount']&&_0x5d775a[_0xdb13('0xb')][_0xdb13('0xc')]&&!_[_0xdb13('0x2f')](_0x5d775a[_0xdb13('0xa')])){setTimeout(handleSendEmail(_0x5d775a,_0x386705),0x3c*0x3e8);}};}function handleJob(_0x156887){return function(){try{if(_[_0xdb13('0x2f')](_0x156887[_0xdb13('0x1a')])){return logger[_0xdb13('0x27')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xdb13('0x2f')](_0x156887[_0xdb13('0x30')])){return logger[_0xdb13('0x27')](_0xdb13('0x31'));}var _0x2cfbac={'startDate':moment()['subtract'](_0x156887[_0xdb13('0x1a')],_0x156887['subtractUnit'])[_0xdb13('0x14')](_0xdb13('0x32')),'endDate':moment()[_0xdb13('0x14')](_0xdb13('0x32')),'type':_0xdb13('0x33'),'output':_0x156887[_0xdb13('0x34')],'name':_0x156887[_0xdb13('0x16')]};if(!_['isNil'](_0x156887[_0xdb13('0x35')])){logger[_0xdb13('0x27')]('exec\x20defaul\x20report\x20id:%s',_0x156887[_0xdb13('0x35')]);return analyticDefaultReportController['runReport']({'id':_0x156887[_0xdb13('0x35')]},_0x2cfbac)[_0xdb13('0x2a')](handleResult(_0x156887))['catch'](handleError());}if(!_[_0xdb13('0x2f')](_0x156887[_0xdb13('0x36')])){logger[_0xdb13('0x27')](_0xdb13('0x37'),_0x156887[_0xdb13('0x36')]);return analyticCustomReportController['runReport']({'id':_0x156887['CustomReportId']},_0x2cfbac)[_0xdb13('0x2a')](handleResult(_0x156887))[_0xdb13('0x2e')](handleError());}}catch(_0x5acfff){logger[_0xdb13('0x2b')](JSON[_0xdb13('0x2d')](_0x5acfff));}return logger[_0xdb13('0x27')]('no\x20report\x20id');};}function getJobs(_0x1f15c6){var _0x179233={};if(_0x1f15c6){_0x179233['id']=_0x1f15c6;}return db['Schedule']['findAll']({'where':_0x179233,'include':[{'model':db[_0xdb13('0xb')],'attributes':['id','name',_0xdb13('0xa')],'include':[{'model':db[_0xdb13('0x38')],'as':'Smtp'}]}]})[_0xdb13('0x2a')](function(_0x59cd61){var _0x4dc8b3=_['keys'](manager[_0xdb13('0x39')]);var _0x5d744d=_[_0xdb13('0x3a')](_0x59cd61,function(_0x30c4e5){return _0x30c4e5['id'][_0xdb13('0x3b')]();});var _0x186501=_[_0xdb13('0x3c')](_0x59cd61,function(_0x1d029c){return _0x1d029c['id'][_0xdb13('0x3b')]();});var _0x309b07=_0x1f15c6?_0x5d744d:_['difference'](_0x5d744d,_0x4dc8b3);var _0x5190f9=_[_0xdb13('0x3d')](_0x5d744d,_0x4dc8b3);var _0x1f00ab=_['difference'](_0x4dc8b3,_0x5d744d);var _0x4606d1;var _0x28934a;for(_0x4606d1=0x0;_0x4606d1<_0x1f00ab['length']&&!_0x1f15c6;_0x4606d1+=0x1){_0x28934a=_0x1f00ab[_0x4606d1][_0xdb13('0x3b')]();if(manager[_0xdb13('0x3e')](_0x28934a)){manager[_0xdb13('0x3f')](_0x28934a);manager[_0xdb13('0x40')](_0x28934a);logger[_0xdb13('0x27')](_0xdb13('0x41'),_0x28934a);}}logger['info'](_0xdb13('0x42'),JSON[_0xdb13('0x2d')](_0x309b07));for(_0x4606d1=0x0;_0x4606d1<_0x309b07[_0xdb13('0x43')];_0x4606d1+=0x1){_0x28934a=_0x309b07[_0x4606d1][_0xdb13('0x3b')]();logger['info']('index',_0x28934a);if(_0x1f15c6){logger[_0xdb13('0x27')](_0xdb13('0x44'),_0x1f15c6);logger[_0xdb13('0x27')](JSON[_0xdb13('0x2d')](_0x186501[_0x28934a]));BPromise[_0xdb13('0x45')]()['then'](handleJob(_0x186501[_0x28934a]));logger['info']('run\x20job',_0x186501[_0x28934a][_0xdb13('0x16')],_0x186501[_0x28934a][_0xdb13('0x46')]);}else if(_0x186501[_0x28934a][_0xdb13('0x46')]&&_0x186501[_0x28934a]['active']&&moment()['isBetween'](_0x186501[_0x28934a]['startAt'],_0x186501[_0x28934a][_0xdb13('0x47')])){manager[_0xdb13('0x48')](_0x28934a,_0x186501[_0x28934a][_0xdb13('0x46')],handleJob(_0x186501[_0x28934a]));manager['start'](_0x28934a);logger[_0xdb13('0x27')]('add\x20cron',_0x186501[_0x28934a][_0xdb13('0x16')],_0x186501[_0x28934a][_0xdb13('0x46')]);}else if(manager['exists'](_0x28934a)){manager[_0xdb13('0x3f')](_0x28934a);manager[_0xdb13('0x40')](_0x28934a);logger['info'](_0xdb13('0x49'),_0x186501[_0x28934a]['name'],_0x186501[_0x28934a][_0xdb13('0x46')]);}}for(_0x4606d1=0x0,_0x28934a;_0x4606d1<_0x5190f9['length']&&!_0x1f15c6;_0x4606d1+=0x1){_0x28934a=_0x5190f9[_0x4606d1][_0xdb13('0x3b')]();if(manager[_0xdb13('0x3e')](_0x28934a)){if(_0x186501[_0x28934a][_0xdb13('0x46')]&&_0x186501[_0x28934a][_0xdb13('0x4a')]&&moment()['isBetween'](_0x186501[_0x28934a]['startAt'],_0x186501[_0x28934a][_0xdb13('0x47')])){manager[_0xdb13('0x4b')](_0x28934a,_0x186501[_0x28934a]['cron'],handleJob(_0x186501[_0x28934a]));logger[_0xdb13('0x27')](_0xdb13('0x4c'),_0x186501[_0x28934a]['name'],_0x186501[_0x28934a][_0xdb13('0x46')]);}else{manager[_0xdb13('0x3f')](_0x28934a);manager[_0xdb13('0x40')](_0x28934a);logger[_0xdb13('0x27')](_0xdb13('0x49'),_0x186501[_0x28934a][_0xdb13('0x16')],_0x186501[_0x28934a][_0xdb13('0x46')]);}}}})[_0xdb13('0x2e')](function(_0x8a489c){logger[_0xdb13('0x2b')](JSON[_0xdb13('0x2d')](_0x8a489c));});}exports[_0xdb13('0x4d')]=function(_0x1b1551){return getJobs(_0x1b1551);};exports[_0xdb13('0x4e')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x71d6=['Try\x20to\x20send\x20a\x20mail\x20to','Smtp','service','MailAccount','host','port','secure','authentication','auth','user','pass','\x22%s\x22\x20<%s>','email','name','subtractUnit','join','../../files/reports','savename','format','%s.%s','basename','zip','existsSync','status','Sent','attachments','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','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','SendMail','error','error\x20mail','email\x20sent','catch','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','exec\x20custom\x20report\x20id:%s','CustomReportId','findAll','keys','map','toString','keyBy','intersection','length','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','cron','active','isBetween','startAt','add','start','add\x20cron','stop\x20cron','exists','endAt','update','update\x20cron','run','path','lodash','moment','cron-job-manager','bluebird','../logger','schedule','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info'];(function(_0x30a28b,_0xbdbb83){var _0x2151e7=function(_0xf02871){while(--_0xf02871){_0x30a28b['push'](_0x30a28b['shift']());}};_0x2151e7(++_0xbdbb83);}(_0x71d6,0x151));var _0x671d=function(_0x549d33,_0x10ca1b){_0x549d33=_0x549d33-0x0;var _0x5b8b8d=_0x71d6[_0x549d33];return _0x5b8b8d;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x671d('0x0'));var _=require(_0x671d('0x1'));var moment=require(_0x671d('0x2'));var CronJobManager=require(_0x671d('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0x671d('0x4'));var logger=require(_0x671d('0x5'))(_0x671d('0x6'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x671d('0x7'));var client=jayson[_0x671d('0x8')][_0x671d('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x288d84,_0x22450c){return function(){logger[_0x671d('0xa')](_0x671d('0xb'),_0x288d84['email']);var _0x405500=!![];var _0x2650bf={'tls':{'rejectUnauthorized':![]}};if(_0x288d84['MailAccount'][_0x671d('0xc')][_0x671d('0xd')]){_0x2650bf['service']=_0x288d84[_0x671d('0xe')]['Smtp'][_0x671d('0xd')];}else{_0x2650bf[_0x671d('0xf')]=_0x288d84[_0x671d('0xe')][_0x671d('0xc')][_0x671d('0xf')];_0x2650bf[_0x671d('0x10')]=_0x288d84[_0x671d('0xe')][_0x671d('0xc')]['port'];_0x2650bf[_0x671d('0x11')]=_0x288d84[_0x671d('0xe')][_0x671d('0xc')]['secure'];}if(_0x288d84['MailAccount'][_0x671d('0xc')][_0x671d('0x12')]){_0x2650bf[_0x671d('0x13')]={'user':_0x288d84['MailAccount'][_0x671d('0xc')][_0x671d('0x14')],'pass':_0x288d84[_0x671d('0xe')][_0x671d('0xc')][_0x671d('0x15')]};}var _0x359451={'account':_0x2650bf,'message':{'from':util['format'](_0x671d('0x16'),_0x288d84[_0x671d('0xe')]['name'],_0x288d84['MailAccount'][_0x671d('0x17')]||_0x288d84['MailAccount'][_0x671d('0xc')]['user']),'to':_0x288d84['email'],'cc':_0x288d84['cc'],'bcc':_0x288d84['bcc'],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x22450c[_0x671d('0x18')],_0x288d84['subtractNumber'],_0x288d84[_0x671d('0x19')])}};var _0xe9bf40=path[_0x671d('0x1a')](__dirname,_0x671d('0x1b'));var _0x28055c=_0x22450c[_0x671d('0x1c')];var _0x4cbb67=util[_0x671d('0x1d')](_0x671d('0x1e'),path[_0x671d('0x1f')](_0x22450c['savename'],path['extname'](_0x22450c[_0x671d('0x1c')])),_0x671d('0x20'));var _0xe626ae=path[_0x671d('0x1a')](_0xe9bf40,_0x28055c);var _0x4ec5c0=path['join'](_0xe9bf40,_0x4cbb67);if(fs[_0x671d('0x21')](_0xe626ae)){_0x22450c[_0x671d('0x22')]=_0x671d('0x23');_0x359451['message'][_0x671d('0x24')]=[{'filename':_0x28055c,'path':_0xe626ae}];_0x359451[_0x671d('0x25')]['text']=util['format'](_0x671d('0x26'),JSON[_0x671d('0x27')](_0x22450c,null,0x2));}else if(fs[_0x671d('0x21')](_0x4ec5c0)){_0x22450c[_0x671d('0x22')]=_0x671d('0x23');_0x359451['message'][_0x671d('0x24')]=[{'filename':_0x4cbb67,'path':_0x4ec5c0}];}else{_0x359451[_0x671d('0x25')]['text']='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x288d84[_0x671d('0x28')]){_0x405500=![];logger[_0x671d('0xa')](_0x671d('0x29'));}}if(_0x405500){return client['request'](_0x671d('0x2a'),_0x359451)['then'](function(_0x3eb617){if(_0x3eb617[_0x671d('0x2b')]){return logger[_0x671d('0x2b')](_0x671d('0x2c'),JSON[_0x671d('0x27')](_0x3eb617));}return logger[_0x671d('0xa')](_0x671d('0x2d'));})[_0x671d('0x2e')](function(_0x3bc06a){return logger[_0x671d('0x2b')](_0x671d('0x2c'),JSON[_0x671d('0x27')](_0x3bc06a));});}};}function handleError(){return function(_0xd6f09d){return logger[_0x671d('0x2b')](JSON[_0x671d('0x27')](_0xd6f09d));};}function handleResult(_0x3ac38a){return function(_0x5f39f4){logger[_0x671d('0xa')]('data',JSON[_0x671d('0x27')](_0x5f39f4));if(_0x3ac38a[_0x671d('0xe')]&&_0x3ac38a[_0x671d('0xe')][_0x671d('0xc')]&&!_[_0x671d('0x2f')](_0x3ac38a[_0x671d('0x17')])){setTimeout(handleSendEmail(_0x3ac38a,_0x5f39f4),0x3c*0x3e8);}};}function handleJob(_0x497d0b){return function(){try{if(_[_0x671d('0x2f')](_0x497d0b[_0x671d('0x30')])){return logger['info'](_0x671d('0x31'));}if(_[_0x671d('0x2f')](_0x497d0b['subtractUnit'])){return logger[_0x671d('0xa')](_0x671d('0x32'));}var _0x33b2e4={'startDate':moment()[_0x671d('0x33')](_0x497d0b['subtractNumber'],_0x497d0b['subtractUnit'])[_0x671d('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x671d('0x34'),'output':_0x497d0b[_0x671d('0x35')],'name':_0x497d0b[_0x671d('0x18')]};if(!_[_0x671d('0x2f')](_0x497d0b[_0x671d('0x36')])){logger[_0x671d('0xa')](_0x671d('0x37'),_0x497d0b[_0x671d('0x36')]);return analyticDefaultReportController[_0x671d('0x38')]({'id':_0x497d0b[_0x671d('0x36')]},_0x33b2e4)[_0x671d('0x39')](handleResult(_0x497d0b))['catch'](handleError());}if(!_[_0x671d('0x2f')](_0x497d0b['CustomReportId'])){logger[_0x671d('0xa')](_0x671d('0x3a'),_0x497d0b[_0x671d('0x3b')]);return analyticCustomReportController[_0x671d('0x38')]({'id':_0x497d0b[_0x671d('0x3b')]},_0x33b2e4)[_0x671d('0x39')](handleResult(_0x497d0b))[_0x671d('0x2e')](handleError());}}catch(_0x9c37c4){logger[_0x671d('0x2b')](JSON[_0x671d('0x27')](_0x9c37c4));}return logger['info']('no\x20report\x20id');};}function getJobs(_0x3029bd){var _0x2d9ab8={};if(_0x3029bd){_0x2d9ab8['id']=_0x3029bd;}return db['Schedule'][_0x671d('0x3c')]({'where':_0x2d9ab8,'include':[{'model':db['MailAccount'],'attributes':['id',_0x671d('0x18'),_0x671d('0x17')],'include':[{'model':db['MailServerOut'],'as':_0x671d('0xc')}]}]})[_0x671d('0x39')](function(_0x57b57f){var _0x140c8b=_[_0x671d('0x3d')](manager['jobs']);var _0x2d5b0d=_[_0x671d('0x3e')](_0x57b57f,function(_0x4f17c8){return _0x4f17c8['id'][_0x671d('0x3f')]();});var _0x100d2c=_[_0x671d('0x40')](_0x57b57f,function(_0x273a28){return _0x273a28['id'][_0x671d('0x3f')]();});var _0x52acf6=_0x3029bd?_0x2d5b0d:_['difference'](_0x2d5b0d,_0x140c8b);var _0x18b994=_[_0x671d('0x41')](_0x2d5b0d,_0x140c8b);var _0x1b36d8=_['difference'](_0x140c8b,_0x2d5b0d);var _0x1203f1;var _0x130d11;for(_0x1203f1=0x0;_0x1203f1<_0x1b36d8[_0x671d('0x42')]&&!_0x3029bd;_0x1203f1+=0x1){_0x130d11=_0x1b36d8[_0x1203f1][_0x671d('0x3f')]();if(manager['exists'](_0x130d11)){manager[_0x671d('0x43')](_0x130d11);manager[_0x671d('0x44')](_0x130d11);logger['info'](_0x671d('0x45'),_0x130d11);}}logger[_0x671d('0xa')](_0x671d('0x46'),JSON[_0x671d('0x27')](_0x52acf6));for(_0x1203f1=0x0;_0x1203f1<_0x52acf6[_0x671d('0x42')];_0x1203f1+=0x1){_0x130d11=_0x52acf6[_0x1203f1][_0x671d('0x3f')]();logger[_0x671d('0xa')](_0x671d('0x47'),_0x130d11);if(_0x3029bd){logger[_0x671d('0xa')](_0x671d('0x48'),_0x3029bd);logger[_0x671d('0xa')](JSON[_0x671d('0x27')](_0x100d2c[_0x130d11]));BPromise[_0x671d('0x49')]()[_0x671d('0x39')](handleJob(_0x100d2c[_0x130d11]));logger[_0x671d('0xa')]('run\x20job',_0x100d2c[_0x130d11]['name'],_0x100d2c[_0x130d11][_0x671d('0x4a')]);}else if(_0x100d2c[_0x130d11][_0x671d('0x4a')]&&_0x100d2c[_0x130d11][_0x671d('0x4b')]&&moment()[_0x671d('0x4c')](_0x100d2c[_0x130d11][_0x671d('0x4d')],_0x100d2c[_0x130d11]['endAt'])){manager[_0x671d('0x4e')](_0x130d11,_0x100d2c[_0x130d11]['cron'],handleJob(_0x100d2c[_0x130d11]));manager[_0x671d('0x4f')](_0x130d11);logger['info'](_0x671d('0x50'),_0x100d2c[_0x130d11]['name'],_0x100d2c[_0x130d11][_0x671d('0x4a')]);}else if(manager['exists'](_0x130d11)){manager['stop'](_0x130d11);manager[_0x671d('0x44')](_0x130d11);logger[_0x671d('0xa')](_0x671d('0x51'),_0x100d2c[_0x130d11][_0x671d('0x18')],_0x100d2c[_0x130d11][_0x671d('0x4a')]);}}for(_0x1203f1=0x0,_0x130d11;_0x1203f1<_0x18b994[_0x671d('0x42')]&&!_0x3029bd;_0x1203f1+=0x1){_0x130d11=_0x18b994[_0x1203f1][_0x671d('0x3f')]();if(manager[_0x671d('0x52')](_0x130d11)){if(_0x100d2c[_0x130d11]['cron']&&_0x100d2c[_0x130d11]['active']&&moment()[_0x671d('0x4c')](_0x100d2c[_0x130d11]['startAt'],_0x100d2c[_0x130d11][_0x671d('0x53')])){manager[_0x671d('0x54')](_0x130d11,_0x100d2c[_0x130d11][_0x671d('0x4a')],handleJob(_0x100d2c[_0x130d11]));logger[_0x671d('0xa')](_0x671d('0x55'),_0x100d2c[_0x130d11]['name'],_0x100d2c[_0x130d11][_0x671d('0x4a')]);}else{manager[_0x671d('0x43')](_0x130d11);manager['deleteJob'](_0x130d11);logger[_0x671d('0xa')]('stop\x20cron',_0x100d2c[_0x130d11][_0x671d('0x18')],_0x100d2c[_0x130d11][_0x671d('0x4a')]);}}}})[_0x671d('0x2e')](function(_0x50fbad){logger['error'](JSON[_0x671d('0x27')](_0x50fbad));});}exports[_0x671d('0x56')]=function(_0x4f562e){return getJobs(_0x4f562e);};exports[_0x671d('0x4f')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index af8e952..3126d11 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd88=['innocenzo.biondo','@xcally.com','now','CmContact','destroy','bulkCreate','log','finished\x20populating','contacts1','CmHopper','then','hopper1','hopper2','catch','../mysqldb','push','Innocenzo','Biondo'];(function(_0x368414,_0x520966){var _0x1b5cfa=function(_0x42377f){while(--_0x42377f){_0x368414['push'](_0x368414['shift']());}};_0x1b5cfa(++_0x520966);}(_0xfd88,0x19a));var _0x8fd8=function(_0x5ad0d7,_0x2645f8){_0x5ad0d7=_0x5ad0d7-0x0;var _0xd83bd=_0xfd88[_0x5ad0d7];return _0xd83bd;};'use strict';var util=require('util');var db=require(_0x8fd8('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x8fd8('0x1')]({'id':i,'firstName':_0x8fd8('0x2')+i,'lastName':_0x8fd8('0x3')+i,'phone':0xf879fb460+i,'email':_0x8fd8('0x4')+i+_0x8fd8('0x5')});}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[_0x8fd8('0x6')](),'updatedAt':Date[_0x8fd8('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x8fd8('0x2')+i,'lastName':_0x8fd8('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x8fd8('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x8fd8('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x8fd8('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x8fd8('0x6')](),'updatedAt':Date[_0x8fd8('0x6')]()});}db[_0x8fd8('0x7')][_0x8fd8('0x8')]({'where':{}})['then'](function(){return db[_0x8fd8('0x7')][_0x8fd8('0x9')](contacts);})['then'](function(){console[_0x8fd8('0xa')](_0x8fd8('0xb'),_0x8fd8('0xc'));return db[_0x8fd8('0xd')][_0x8fd8('0x8')]({'where':{}});})[_0x8fd8('0xe')](function(){return db[_0x8fd8('0xd')][_0x8fd8('0x9')](hopper);})[_0x8fd8('0xe')](function(){console[_0x8fd8('0xa')](_0x8fd8('0xb'),_0x8fd8('0xf'));return db[_0x8fd8('0x7')][_0x8fd8('0x9')](contacts2);})['then'](function(){console['log'](_0x8fd8('0xb'),'contacts2');return db[_0x8fd8('0xd')][_0x8fd8('0x9')](hopper2);})['then'](function(){console[_0x8fd8('0xa')]('finished\x20populating',_0x8fd8('0x10'));})[_0x8fd8('0x11')](function(_0x79b6b5){console['log'](_0x79b6b5);}); \ No newline at end of file +var _0x7b36=['Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','log','finished\x20populating','CmHopper','contacts2','hopper2','util','push'];(function(_0x1fc3aa,_0x1b92fd){var _0x11dd40=function(_0x4b8205){while(--_0x4b8205){_0x1fc3aa['push'](_0x1fc3aa['shift']());}};_0x11dd40(++_0x1b92fd);}(_0x7b36,0x9e));var _0x67b3=function(_0x554517,_0x28a14a){_0x554517=_0x554517-0x0;var _0x559c02=_0x7b36[_0x554517];return _0x559c02;};'use strict';var util=require(_0x67b3('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x67b3('0x1')]({'id':i,'firstName':_0x67b3('0x2')+i,'lastName':_0x67b3('0x3')+i,'phone':0xf879fb460+i,'email':_0x67b3('0x4')+i+_0x67b3('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x67b3('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x67b3('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x67b3('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x67b3('0x2')+i,'lastName':_0x67b3('0x3')+i,'phone':0xf879fb460+i,'email':_0x67b3('0x4')+i+_0x67b3('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x67b3('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x67b3('0x6')](),'updatedAt':Date[_0x67b3('0x6')]()});}db[_0x67b3('0x7')][_0x67b3('0x8')]({'where':{}})[_0x67b3('0x9')](function(){return db[_0x67b3('0x7')][_0x67b3('0xa')](contacts);})[_0x67b3('0x9')](function(){console[_0x67b3('0xb')](_0x67b3('0xc'),'contacts1');return db[_0x67b3('0xd')][_0x67b3('0x8')]({'where':{}});})['then'](function(){return db['CmHopper'][_0x67b3('0xa')](hopper);})['then'](function(){console[_0x67b3('0xb')](_0x67b3('0xc'),'hopper1');return db['CmContact'][_0x67b3('0xa')](contacts2);})['then'](function(){console[_0x67b3('0xb')](_0x67b3('0xc'),_0x67b3('0xe'));return db['CmHopper'][_0x67b3('0xa')](hopper2);})[_0x67b3('0x9')](function(){console[_0x67b3('0xb')](_0x67b3('0xc'),_0x67b3('0xf'));})['catch'](function(_0x1273ff){console[_0x67b3('0xb')](_0x1273ff);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 42b0d01..34ab1f9 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca1d=['format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','bulkCreate','log','add\x20user','catch','../mysqldb'];(function(_0x458dd7,_0xe5602b){var _0x2a12f3=function(_0x547dee){while(--_0x547dee){_0x458dd7['push'](_0x458dd7['shift']());}};_0x2a12f3(++_0xe5602b);}(_0xca1d,0x1da));var _0xdca1=function(_0x3860b4,_0x442451){_0x3860b4=_0x3860b4-0x0;var _0x442a64=_0xca1d[_0x3860b4];return _0x442a64;};'use strict';var util=require('util');var db=require(_0xdca1('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xdca1('0x1')](_0xdca1('0x2'),_0xdca1('0x3'),i),'fullname':util['format'](_0xdca1('0x2'),_0xdca1('0x3'),i),'email':util[_0xdca1('0x1')](_0xdca1('0x4'),_0xdca1('0x3'),i),'role':'agent','password':_0xdca1('0x5'),'internal':0xfa0+i,'type':_0xdca1('0x6'),'transport':[_0xdca1('0x7'),'ws',_0xdca1('0x8')],'disallow':['all'],'allow':[_0xdca1('0x9')],'defaultuser':util[_0xdca1('0x1')](_0xdca1('0x2'),'agent',i),'encryption':_0xdca1('0xa'),'avpf':'yes','force_avp':'yes','icesupport':_0xdca1('0xa'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xdca1('0xb'),'dtlsprivatekey':_0xdca1('0xc'),'dtlssetup':_0xdca1('0xd'),'callerid':util[_0xdca1('0x1')](_0xdca1('0xe'),util['format'](_0xdca1('0x2'),_0xdca1('0x3'),i),0xfa0+i)});}db['User'][_0xdca1('0xf')](users)['then'](function(){console[_0xdca1('0x10')](_0xdca1('0x11'));})[_0xdca1('0x12')](function(_0x36e372){console[_0xdca1('0x10')](_0x36e372);}); \ No newline at end of file +var _0xe1cd=['yes','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','format','%s%s','agent','%s%s@xcally.com','password','udp','wss','ulaw'];(function(_0x57e4aa,_0x482b33){var _0x203e32=function(_0xf03c77){while(--_0xf03c77){_0x57e4aa['push'](_0x57e4aa['shift']());}};_0x203e32(++_0x482b33);}(_0xe1cd,0xed));var _0xde1c=function(_0x47b782,_0x5f5296){_0x47b782=_0x47b782-0x0;var _0x3de9c3=_0xe1cd[_0x47b782];return _0x3de9c3;};'use strict';var util=require(_0xde1c('0x0'));var db=require(_0xde1c('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xde1c('0x2')](_0xde1c('0x3'),_0xde1c('0x4'),i),'fullname':util[_0xde1c('0x2')](_0xde1c('0x3'),'agent',i),'email':util[_0xde1c('0x2')](_0xde1c('0x5'),_0xde1c('0x4'),i),'role':_0xde1c('0x4'),'password':_0xde1c('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0xde1c('0x7'),'ws',_0xde1c('0x8')],'disallow':['all'],'allow':[_0xde1c('0x9')],'defaultuser':util[_0xde1c('0x2')]('%s%s',_0xde1c('0x4'),i),'encryption':_0xde1c('0xa'),'avpf':_0xde1c('0xa'),'force_avp':_0xde1c('0xa'),'icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0xde1c('0xb'),'callerid':util[_0xde1c('0x2')](_0xde1c('0xc'),util['format'](_0xde1c('0x3'),_0xde1c('0x4'),i),0xfa0+i)});}db[_0xde1c('0xd')][_0xde1c('0xe')](users)[_0xde1c('0xf')](function(){console[_0xde1c('0x10')](_0xde1c('0x11'));})[_0xde1c('0x12')](function(_0x378442){console[_0xde1c('0x10')](_0x378442);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 89435a6..899f9e6 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6ccc=['trunk:%s','campaign:%s:%s','leave','map','removeChatInteractions','emit','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','catch','log','join','connection','setMaxListeners','request','remotePort','connectedAt','nsp','disconnect','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','role','agent','type','ivr','format','%s:queue:%s','length','user:%s','query','User','find','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','voice:inbound','voice:outbound','include','push','VoiceQueue','findAll','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','Campaign','user','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getVoiceQueues','getOpenchannelQueues','all','then','chat','fax','sms','mail','telephone:%s'];(function(_0xdae89c,_0x4b4a3e){var _0x59a664=function(_0x6e6c8e){while(--_0x6e6c8e){_0xdae89c['push'](_0xdae89c['shift']());}};_0x59a664(++_0x4b4a3e);}(_0x6ccc,0x14d));var _0xc6cc=function(_0x699049,_0x51d7d6){_0x699049=_0x699049-0x0;var _0x5e25e4=_0x6ccc[_0x699049];return _0x5e25e4;};'use strict';var _=require(_0xc6cc('0x0'));var util=require(_0xc6cc('0x1'));var BPromise=require(_0xc6cc('0x2'));var db=require(_0xc6cc('0x3'))['db'];var config=require(_0xc6cc('0x4'));var queryQueues={'attributes':['id',_0xc6cc('0x5')],'include':[{'as':_0xc6cc('0x6'),'model':db['User'],'attributes':['id',_0xc6cc('0x5'),_0xc6cc('0x7')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xc6cc('0x5')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xc6cc('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xc6cc('0x5'),_0xc6cc('0x9')],'where':{'type':_0xc6cc('0xa')}};function joinOrLeaveQueues(_0x585d67,_0x4b4888,_0xe1b01b,_0x5ad794){_0x585d67[_0x4b4888](util[_0xc6cc('0xb')](_0xc6cc('0xc'),_0xe1b01b,_0x5ad794['name']));if(_0x5ad794[_0xc6cc('0x6')]){for(var _0x2a8ca3=0x0;_0x2a8ca3<_0x5ad794[_0xc6cc('0x6')][_0xc6cc('0xd')];_0x2a8ca3+=0x1){_0x585d67[_0x4b4888](util[_0xc6cc('0xb')](_0xc6cc('0xe'),_0x5ad794[_0xc6cc('0x6')][_0x2a8ca3]['name']));}}}function joinOrLeave(_0x2a4368,_0x3d8c8a,_0x47aa5a){var _0x500dfc;if(_0x2a4368['handshake'][_0xc6cc('0xf')]['id']){db[_0xc6cc('0x10')][_0xc6cc('0x11')]({'attributes':['id',_0xc6cc('0x5'),_0xc6cc('0x7')],'where':{'id':_0x2a4368['handshake']['query']['id']},'include':[{'model':db['ChatInteraction'],'as':_0xc6cc('0x12'),'attributes':['id'],'raw':!![]},{'model':db[_0xc6cc('0x13')],'as':_0xc6cc('0x14'),'attributes':['id'],'raw':!![]},{'model':db[_0xc6cc('0x15')],'as':_0xc6cc('0x16'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xc6cc('0x17'),'attributes':['id'],'raw':!![]},{'model':db[_0xc6cc('0x18')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]}]})['then'](function(_0x4ca2ac){if(_0x4ca2ac){_0x500dfc=_0x4ca2ac;_0x2a4368[_0x3d8c8a](util[_0xc6cc('0xb')]('user:%s',_0x4ca2ac[_0xc6cc('0x5')]));var _0x23245b=[];switch(_0x4ca2ac[_0xc6cc('0x7')]){case'admin':_0x2a4368[_0x3d8c8a](_0xc6cc('0x19'));_0x2a4368[_0x3d8c8a](_0xc6cc('0x1a'));if(queryQueues['hasOwnProperty'](_0xc6cc('0x1b'))){delete queryQueues['include'];}_0x23245b[_0xc6cc('0x1c')](db[_0xc6cc('0x1d')][_0xc6cc('0x1e')](queryQueues));_0x23245b[_0xc6cc('0x1c')](db[_0xc6cc('0x1f')][_0xc6cc('0x1e')](queryQueues));_0x23245b[_0xc6cc('0x1c')](db[_0xc6cc('0x20')]['findAll'](queryQueues));_0x23245b[_0xc6cc('0x1c')](db[_0xc6cc('0x21')][_0xc6cc('0x1e')](queryQueues));_0x23245b[_0xc6cc('0x1c')](db[_0xc6cc('0x22')][_0xc6cc('0x1e')](queryQueues));_0x23245b['push'](db[_0xc6cc('0x23')][_0xc6cc('0x1e')](queryQueues));_0x23245b[_0xc6cc('0x1c')](db['User'][_0xc6cc('0x1e')](queryTelephones));_0x23245b[_0xc6cc('0x1c')](db[_0xc6cc('0x24')][_0xc6cc('0x1e')](queryTrunks));_0x23245b[_0xc6cc('0x1c')](db[_0xc6cc('0x25')][_0xc6cc('0x1e')](queryCampaigns));_0x23245b[_0xc6cc('0x1c')](db[_0xc6cc('0x10')]['findAll'](queryAgents));break;case _0xc6cc('0x26'):_0x2a4368[_0x3d8c8a](_0xc6cc('0x19'));_0x2a4368[_0x3d8c8a](_0xc6cc('0x1a'));_0x23245b[_0xc6cc('0x1c')](_0x4ca2ac['getVoiceQueues'](queryQueues));_0x23245b[_0xc6cc('0x1c')](_0x4ca2ac[_0xc6cc('0x27')](queryQueues));_0x23245b['push'](_0x4ca2ac[_0xc6cc('0x28')](queryQueues));_0x23245b[_0xc6cc('0x1c')](_0x4ca2ac[_0xc6cc('0x29')](queryQueues));_0x23245b[_0xc6cc('0x1c')](_0x4ca2ac[_0xc6cc('0x2a')](queryQueues));_0x23245b[_0xc6cc('0x1c')](_0x4ca2ac['getOpenchannelQueues'](queryQueues));_0x23245b['push'](db['User'][_0xc6cc('0x1e')](queryTelephones));_0x23245b['push'](db[_0xc6cc('0x24')][_0xc6cc('0x1e')](queryTrunks));_0x23245b[_0xc6cc('0x1c')](db[_0xc6cc('0x25')]['findAll'](queryCampaigns));_0x23245b[_0xc6cc('0x1c')](db[_0xc6cc('0x10')][_0xc6cc('0x1e')](queryAgents));break;case _0xc6cc('0x8'):_0x2a4368[_0x3d8c8a](_0xc6cc('0x19'));_0x2a4368[_0x3d8c8a](_0xc6cc('0x1a'));_0x23245b['push'](_0x4ca2ac[_0xc6cc('0x2b')]({'attributes':['id',_0xc6cc('0x5')]}));_0x23245b[_0xc6cc('0x1c')](_0x4ca2ac['getChatQueues']({'attributes':['id',_0xc6cc('0x5')]}));_0x23245b[_0xc6cc('0x1c')](_0x4ca2ac[_0xc6cc('0x28')]({'attributes':['id',_0xc6cc('0x5')]}));_0x23245b['push'](_0x4ca2ac['getSmsQueues']({'attributes':['id',_0xc6cc('0x5')]}));_0x23245b[_0xc6cc('0x1c')](_0x4ca2ac['getMailQueues']({'attributes':['id',_0xc6cc('0x5')]}));_0x23245b[_0xc6cc('0x1c')](_0x4ca2ac[_0xc6cc('0x2c')]({'attributes':['id',_0xc6cc('0x5')]}));break;}return BPromise[_0xc6cc('0x2d')](_0x23245b);}})[_0xc6cc('0x2e')](function(_0x43354d){if(_0x43354d&&_0x43354d[_0xc6cc('0xd')]){for(var _0x587757=0x0;_0x587757<_0x43354d[_0xc6cc('0xd')];_0x587757+=0x1){for(var _0x251651=0x0;_0x251651<_0x43354d[_0x587757][_0xc6cc('0xd')];_0x251651+=0x1){switch(_0x587757){case 0x0:joinOrLeaveQueues(_0x2a4368,_0x3d8c8a,'voice',_0x43354d[_0x587757][_0x251651]);break;case 0x1:joinOrLeaveQueues(_0x2a4368,_0x3d8c8a,_0xc6cc('0x2f'),_0x43354d[_0x587757][_0x251651]);break;case 0x2:joinOrLeaveQueues(_0x2a4368,_0x3d8c8a,_0xc6cc('0x30'),_0x43354d[_0x587757][_0x251651]);break;case 0x3:joinOrLeaveQueues(_0x2a4368,_0x3d8c8a,_0xc6cc('0x31'),_0x43354d[_0x587757][_0x251651]);break;case 0x4:joinOrLeaveQueues(_0x2a4368,_0x3d8c8a,_0xc6cc('0x32'),_0x43354d[_0x587757][_0x251651]);break;case 0x5:joinOrLeaveQueues(_0x2a4368,_0x3d8c8a,'openchannel',_0x43354d[_0x587757][_0x251651]);break;case 0x6:_0x2a4368[_0x3d8c8a](util[_0xc6cc('0xb')](_0xc6cc('0x33'),_0x43354d[_0x587757][_0x251651][_0xc6cc('0x5')]));break;case 0x7:_0x2a4368[_0x3d8c8a](util['format'](_0xc6cc('0x34'),_0x43354d[_0x587757][_0x251651][_0xc6cc('0x5')]));break;case 0x8:_0x2a4368[_0x3d8c8a](util[_0xc6cc('0xb')](_0xc6cc('0x35'),_0x43354d[_0x587757][_0x251651][_0xc6cc('0x9')],_0x43354d[_0x587757][_0x251651][_0xc6cc('0x5')]));break;case 0x9:_0x2a4368[_0x3d8c8a](util['format']('user:%s',_0x43354d[_0x587757][_0x251651][_0xc6cc('0x5')]));break;}}}}})[_0xc6cc('0x2e')](function(){if(_0x3d8c8a===_0xc6cc('0x36')){var _0x50ba99=_[_0xc6cc('0x37')](_0x500dfc[_0xc6cc('0x12')],'id');return _0x500dfc[_0xc6cc('0x38')](_0x50ba99)['then'](function(){for(var _0x6b08e1=0x0;_0x6b08e1<_0x50ba99['length'];_0x6b08e1+=0x1){_0x47aa5a[_0xc6cc('0x39')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x50ba99[_0x6b08e1]),'UserId':Number(_0x500dfc['id'])});}});}})[_0xc6cc('0x2e')](function(){if(_0x3d8c8a===_0xc6cc('0x36')){var _0x5b27ea=_[_0xc6cc('0x37')](_0x500dfc[_0xc6cc('0x14')],'id');return _0x500dfc[_0xc6cc('0x3a')](_0x5b27ea)['then'](function(){for(var _0x41f85f=0x0;_0x41f85f<_0x5b27ea[_0xc6cc('0xd')];_0x41f85f+=0x1){_0x47aa5a[_0xc6cc('0x39')](_0xc6cc('0x3b'),{'MailInteractionId':Number(_0x5b27ea[_0x41f85f]),'UserId':Number(_0x500dfc['id'])});}});}})[_0xc6cc('0x2e')](function(){if(_0x3d8c8a==='leave'){var _0x5cb19f=_[_0xc6cc('0x37')](_0x500dfc[_0xc6cc('0x16')],'id');return _0x500dfc[_0xc6cc('0x3c')](_0x5cb19f)[_0xc6cc('0x2e')](function(){for(var _0x5cf354=0x0;_0x5cf354<_0x5cb19f[_0xc6cc('0xd')];_0x5cf354+=0x1){_0x47aa5a['emit'](_0xc6cc('0x3d'),{'FaxInteractionId':Number(_0x5cb19f[_0x5cf354]),'UserId':Number(_0x500dfc['id'])});}});}})[_0xc6cc('0x2e')](function(){if(_0x3d8c8a==='leave'){var _0x9dc4d7=_[_0xc6cc('0x37')](_0x500dfc[_0xc6cc('0x17')],'id');return _0x500dfc[_0xc6cc('0x3e')](_0x9dc4d7)['then'](function(){for(var _0x3ff4ed=0x0;_0x3ff4ed<_0x9dc4d7[_0xc6cc('0xd')];_0x3ff4ed+=0x1){_0x47aa5a[_0xc6cc('0x39')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x9dc4d7[_0x3ff4ed]),'UserId':Number(_0x500dfc['id'])});}});}})[_0xc6cc('0x2e')](function(){if(_0x3d8c8a===_0xc6cc('0x36')){var _0x4dfecf=_[_0xc6cc('0x37')](_0x500dfc[_0xc6cc('0x3f')],'id');return _0x500dfc[_0xc6cc('0x40')](_0x4dfecf)[_0xc6cc('0x2e')](function(){for(var _0x506e6a=0x0;_0x506e6a<_0x4dfecf[_0xc6cc('0xd')];_0x506e6a+=0x1){_0x47aa5a[_0xc6cc('0x39')](_0xc6cc('0x41'),{'OpenchannelInteractionId':Number(_0x4dfecf[_0x506e6a]),'UserId':Number(_0x500dfc['id'])});}});}})[_0xc6cc('0x42')](function(_0x37ab94){_0x2a4368[_0xc6cc('0x43')](_0x37ab94);});}}function onDisconnect(_0x1dc1d9,_0x523a4b){joinOrLeave(_0x1dc1d9,'leave',_0x523a4b);}function onConnect(_0x147d86){joinOrLeave(_0x147d86,_0xc6cc('0x44'));}exports['default']=function(_0x5785ae){_0x5785ae['on'](_0xc6cc('0x45'),function(_0x33d321){_0x33d321[_0xc6cc('0x46')](0x0);_0x33d321['address']=_0x33d321[_0xc6cc('0x47')][_0xc6cc('0x45')]['remoteAddress']+':'+_0x33d321['request']['connection'][_0xc6cc('0x48')];_0x33d321[_0xc6cc('0x49')]=new Date();_0x33d321[_0xc6cc('0x43')]=function(_0x5e558c){console[_0xc6cc('0x43')]('SocketIO\x20'+_0x33d321[_0xc6cc('0x4a')][_0xc6cc('0x5')]+'['+_0x33d321['address']+']',_0x5e558c);};_0x33d321['on'](_0xc6cc('0x4b'),function(){onDisconnect(_0x33d321,_0x5785ae);_0x33d321[_0xc6cc('0x43')]('DISCONNECTED');});onConnect(_0x33d321);_0x33d321[_0xc6cc('0x43')](_0xc6cc('0x4c'));});}; \ No newline at end of file +var _0xe674=['agent','telephone','type','format','length','user:%s','query','User','find','role','handshake','ChatInteraction','MailInteraction','MailInteractions','FaxInteractions','OpenchannelInteraction','OpenchannelInteractions','then','admin','voice:inbound','voice:outbound','hasOwnProperty','include','findAll','FaxQueue','push','MailQueue','OpenchannelQueue','Campaign','user','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','fax','telephone:%s','campaign:%s:%s','leave','map','ChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_openchannel_interactions:remove','catch','log','join','default','setMaxListeners','address','request','remoteAddress','connection','remotePort','connectedAt','SocketIO\x20','disconnect','CONNECTED','util','bluebird','../mysqldb','./environment','name','Agents'];(function(_0x2725cb,_0x4af1c9){var _0xf4bac1=function(_0x454ce9){while(--_0x454ce9){_0x2725cb['push'](_0x2725cb['shift']());}};_0xf4bac1(++_0x4af1c9);}(_0xe674,0x84));var _0x4e67=function(_0x246538,_0x35a110){_0x246538=_0x246538-0x0;var _0x3d9c52=_0xe674[_0x246538];return _0x3d9c52;};'use strict';var _=require('lodash');var util=require(_0x4e67('0x0'));var BPromise=require(_0x4e67('0x1'));var db=require(_0x4e67('0x2'))['db'];var config=require(_0x4e67('0x3'));var queryQueues={'attributes':['id',_0x4e67('0x4')],'include':[{'as':_0x4e67('0x5'),'model':db['User'],'attributes':['id',_0x4e67('0x4'),'role'],'raw':!![],'where':{'role':_0x4e67('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x4e67('0x4')],'where':{'role':_0x4e67('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x4e67('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x4e67('0x4')],'where':{'role':_0x4e67('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x4e67('0x4'),_0x4e67('0x8')],'where':{'type':'ivr'}};function joinOrLeaveQueues(_0xcd7bc8,_0x274e7d,_0x3207ff,_0x767d96){_0xcd7bc8[_0x274e7d](util[_0x4e67('0x9')]('%s:queue:%s',_0x3207ff,_0x767d96[_0x4e67('0x4')]));if(_0x767d96['Agents']){for(var _0x33cbbf=0x0;_0x33cbbf<_0x767d96[_0x4e67('0x5')][_0x4e67('0xa')];_0x33cbbf+=0x1){_0xcd7bc8[_0x274e7d](util[_0x4e67('0x9')](_0x4e67('0xb'),_0x767d96[_0x4e67('0x5')][_0x33cbbf][_0x4e67('0x4')]));}}}function joinOrLeave(_0x7039ef,_0x2c65e8,_0x3e7394){var _0x33565a;if(_0x7039ef['handshake'][_0x4e67('0xc')]['id']){db[_0x4e67('0xd')][_0x4e67('0xe')]({'attributes':['id','name',_0x4e67('0xf')],'where':{'id':_0x7039ef[_0x4e67('0x10')]['query']['id']},'include':[{'model':db[_0x4e67('0x11')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x4e67('0x12')],'as':_0x4e67('0x13'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x4e67('0x14'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x4e67('0x15')],'as':_0x4e67('0x16'),'attributes':['id'],'raw':!![]}]})[_0x4e67('0x17')](function(_0x361da8){if(_0x361da8){_0x33565a=_0x361da8;_0x7039ef[_0x2c65e8](util[_0x4e67('0x9')](_0x4e67('0xb'),_0x361da8[_0x4e67('0x4')]));var _0x148335=[];switch(_0x361da8[_0x4e67('0xf')]){case _0x4e67('0x18'):_0x7039ef[_0x2c65e8](_0x4e67('0x19'));_0x7039ef[_0x2c65e8](_0x4e67('0x1a'));if(queryQueues[_0x4e67('0x1b')](_0x4e67('0x1c'))){delete queryQueues['include'];}_0x148335['push'](db['VoiceQueue'][_0x4e67('0x1d')](queryQueues));_0x148335['push'](db['ChatQueue']['findAll'](queryQueues));_0x148335['push'](db[_0x4e67('0x1e')][_0x4e67('0x1d')](queryQueues));_0x148335[_0x4e67('0x1f')](db['SmsQueue'][_0x4e67('0x1d')](queryQueues));_0x148335[_0x4e67('0x1f')](db[_0x4e67('0x20')][_0x4e67('0x1d')](queryQueues));_0x148335[_0x4e67('0x1f')](db[_0x4e67('0x21')][_0x4e67('0x1d')](queryQueues));_0x148335['push'](db[_0x4e67('0xd')][_0x4e67('0x1d')](queryTelephones));_0x148335['push'](db['Trunk']['findAll'](queryTrunks));_0x148335[_0x4e67('0x1f')](db[_0x4e67('0x22')]['findAll'](queryCampaigns));_0x148335[_0x4e67('0x1f')](db[_0x4e67('0xd')][_0x4e67('0x1d')](queryAgents));break;case _0x4e67('0x23'):_0x7039ef[_0x2c65e8](_0x4e67('0x19'));_0x7039ef[_0x2c65e8]('voice:outbound');_0x148335[_0x4e67('0x1f')](_0x361da8[_0x4e67('0x24')](queryQueues));_0x148335[_0x4e67('0x1f')](_0x361da8[_0x4e67('0x25')](queryQueues));_0x148335['push'](_0x361da8[_0x4e67('0x26')](queryQueues));_0x148335[_0x4e67('0x1f')](_0x361da8[_0x4e67('0x27')](queryQueues));_0x148335[_0x4e67('0x1f')](_0x361da8[_0x4e67('0x28')](queryQueues));_0x148335[_0x4e67('0x1f')](_0x361da8['getOpenchannelQueues'](queryQueues));_0x148335['push'](db[_0x4e67('0xd')][_0x4e67('0x1d')](queryTelephones));_0x148335[_0x4e67('0x1f')](db['Trunk']['findAll'](queryTrunks));_0x148335[_0x4e67('0x1f')](db['Campaign'][_0x4e67('0x1d')](queryCampaigns));_0x148335[_0x4e67('0x1f')](db[_0x4e67('0xd')]['findAll'](queryAgents));break;case _0x4e67('0x6'):_0x7039ef[_0x2c65e8]('voice:inbound');_0x7039ef[_0x2c65e8](_0x4e67('0x1a'));_0x148335[_0x4e67('0x1f')](_0x361da8[_0x4e67('0x24')]({'attributes':['id',_0x4e67('0x4')]}));_0x148335[_0x4e67('0x1f')](_0x361da8['getChatQueues']({'attributes':['id',_0x4e67('0x4')]}));_0x148335[_0x4e67('0x1f')](_0x361da8[_0x4e67('0x26')]({'attributes':['id','name']}));_0x148335['push'](_0x361da8[_0x4e67('0x27')]({'attributes':['id',_0x4e67('0x4')]}));_0x148335[_0x4e67('0x1f')](_0x361da8[_0x4e67('0x28')]({'attributes':['id',_0x4e67('0x4')]}));_0x148335['push'](_0x361da8[_0x4e67('0x29')]({'attributes':['id',_0x4e67('0x4')]}));break;}return BPromise['all'](_0x148335);}})[_0x4e67('0x17')](function(_0x5ae39f){if(_0x5ae39f&&_0x5ae39f[_0x4e67('0xa')]){for(var _0xd80c0e=0x0;_0xd80c0e<_0x5ae39f[_0x4e67('0xa')];_0xd80c0e+=0x1){for(var _0x58cf45=0x0;_0x58cf45<_0x5ae39f[_0xd80c0e]['length'];_0x58cf45+=0x1){switch(_0xd80c0e){case 0x0:joinOrLeaveQueues(_0x7039ef,_0x2c65e8,'voice',_0x5ae39f[_0xd80c0e][_0x58cf45]);break;case 0x1:joinOrLeaveQueues(_0x7039ef,_0x2c65e8,'chat',_0x5ae39f[_0xd80c0e][_0x58cf45]);break;case 0x2:joinOrLeaveQueues(_0x7039ef,_0x2c65e8,_0x4e67('0x2a'),_0x5ae39f[_0xd80c0e][_0x58cf45]);break;case 0x3:joinOrLeaveQueues(_0x7039ef,_0x2c65e8,'sms',_0x5ae39f[_0xd80c0e][_0x58cf45]);break;case 0x4:joinOrLeaveQueues(_0x7039ef,_0x2c65e8,'mail',_0x5ae39f[_0xd80c0e][_0x58cf45]);break;case 0x5:joinOrLeaveQueues(_0x7039ef,_0x2c65e8,'openchannel',_0x5ae39f[_0xd80c0e][_0x58cf45]);break;case 0x6:_0x7039ef[_0x2c65e8](util[_0x4e67('0x9')](_0x4e67('0x2b'),_0x5ae39f[_0xd80c0e][_0x58cf45][_0x4e67('0x4')]));break;case 0x7:_0x7039ef[_0x2c65e8](util['format']('trunk:%s',_0x5ae39f[_0xd80c0e][_0x58cf45][_0x4e67('0x4')]));break;case 0x8:_0x7039ef[_0x2c65e8](util[_0x4e67('0x9')](_0x4e67('0x2c'),_0x5ae39f[_0xd80c0e][_0x58cf45]['type'],_0x5ae39f[_0xd80c0e][_0x58cf45][_0x4e67('0x4')]));break;case 0x9:_0x7039ef[_0x2c65e8](util[_0x4e67('0x9')](_0x4e67('0xb'),_0x5ae39f[_0xd80c0e][_0x58cf45][_0x4e67('0x4')]));break;}}}}})[_0x4e67('0x17')](function(){if(_0x2c65e8===_0x4e67('0x2d')){var _0x1bcdb4=_[_0x4e67('0x2e')](_0x33565a[_0x4e67('0x2f')],'id');return _0x33565a['removeChatInteractions'](_0x1bcdb4)[_0x4e67('0x17')](function(){for(var _0xb8bca4=0x0;_0xb8bca4<_0x1bcdb4['length'];_0xb8bca4+=0x1){_0x3e7394[_0x4e67('0x30')](_0x4e67('0x31'),{'ChatInteractionId':Number(_0x1bcdb4[_0xb8bca4]),'UserId':Number(_0x33565a['id'])});}});}})[_0x4e67('0x17')](function(){if(_0x2c65e8==='leave'){var _0x96d7e7=_[_0x4e67('0x2e')](_0x33565a[_0x4e67('0x13')],'id');return _0x33565a[_0x4e67('0x32')](_0x96d7e7)[_0x4e67('0x17')](function(){for(var _0x438b22=0x0;_0x438b22<_0x96d7e7[_0x4e67('0xa')];_0x438b22+=0x1){_0x3e7394[_0x4e67('0x30')](_0x4e67('0x33'),{'MailInteractionId':Number(_0x96d7e7[_0x438b22]),'UserId':Number(_0x33565a['id'])});}});}})[_0x4e67('0x17')](function(){if(_0x2c65e8===_0x4e67('0x2d')){var _0x13e1cb=_[_0x4e67('0x2e')](_0x33565a[_0x4e67('0x14')],'id');return _0x33565a['removeFaxInteractions'](_0x13e1cb)[_0x4e67('0x17')](function(){for(var _0x2bee3d=0x0;_0x2bee3d<_0x13e1cb[_0x4e67('0xa')];_0x2bee3d+=0x1){_0x3e7394[_0x4e67('0x30')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x13e1cb[_0x2bee3d]),'UserId':Number(_0x33565a['id'])});}});}})[_0x4e67('0x17')](function(){if(_0x2c65e8==='leave'){var _0x5bbaf4=_[_0x4e67('0x2e')](_0x33565a[_0x4e67('0x34')],'id');return _0x33565a[_0x4e67('0x35')](_0x5bbaf4)[_0x4e67('0x17')](function(){for(var _0x542a3c=0x0;_0x542a3c<_0x5bbaf4['length'];_0x542a3c+=0x1){_0x3e7394['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x5bbaf4[_0x542a3c]),'UserId':Number(_0x33565a['id'])});}});}})['then'](function(){if(_0x2c65e8===_0x4e67('0x2d')){var _0xa99aa4=_[_0x4e67('0x2e')](_0x33565a[_0x4e67('0x16')],'id');return _0x33565a['removeOpenchannelInteractions'](_0xa99aa4)[_0x4e67('0x17')](function(){for(var _0x175c37=0x0;_0x175c37<_0xa99aa4[_0x4e67('0xa')];_0x175c37+=0x1){_0x3e7394[_0x4e67('0x30')](_0x4e67('0x36'),{'OpenchannelInteractionId':Number(_0xa99aa4[_0x175c37]),'UserId':Number(_0x33565a['id'])});}});}})[_0x4e67('0x37')](function(_0x2b6f33){_0x7039ef[_0x4e67('0x38')](_0x2b6f33);});}}function onDisconnect(_0x45092a,_0x38e946){joinOrLeave(_0x45092a,'leave',_0x38e946);}function onConnect(_0x29ab25){joinOrLeave(_0x29ab25,_0x4e67('0x39'));}exports[_0x4e67('0x3a')]=function(_0x51da37){_0x51da37['on']('connection',function(_0x4fa158){_0x4fa158[_0x4e67('0x3b')](0x0);_0x4fa158[_0x4e67('0x3c')]=_0x4fa158[_0x4e67('0x3d')]['connection'][_0x4e67('0x3e')]+':'+_0x4fa158[_0x4e67('0x3d')][_0x4e67('0x3f')][_0x4e67('0x40')];_0x4fa158[_0x4e67('0x41')]=new Date();_0x4fa158[_0x4e67('0x38')]=function(_0x573e87){console[_0x4e67('0x38')](_0x4e67('0x42')+_0x4fa158['nsp'][_0x4e67('0x4')]+'['+_0x4fa158['address']+']',_0x573e87);};_0x4fa158['on'](_0x4e67('0x43'),function(){onDisconnect(_0x4fa158,_0x51da37);_0x4fa158[_0x4e67('0x38')]('DISCONNECTED');});onConnect(_0x4fa158);_0x4fa158[_0x4e67('0x38')](_0x4e67('0x44'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index ea29bf7..7ef5eea 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 _0xc816=['newmessage','FaxInteraction','Fax','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','request','EventManager','info','Trigger,\x20%s','error','code','catch','get','channel','event','direction','User','find','UserId','name','interface','format','SIP/%s','incomingmessage','opened','changed','closed','default','length','hasOwnProperty','model','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','ChatMessage','Sms','SmsInteraction','closedinteraction','SmsMessage'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xc816,0x162));var _0x6c81=function(_0x232a9d,_0x2fc734){_0x232a9d=_0x232a9d-0x0;var _0x178df6=_0xc816[_0x232a9d];return _0x178df6;};'use strict';var util=require(_0x6c81('0x0'));var db=require(_0x6c81('0x1'))['db'];var jayson=require(_0x6c81('0x2'));var logger=require(_0x6c81('0x3'))(_0x6c81('0x4'));var client=jayson[_0x6c81('0x5')][_0x6c81('0x6')]({'port':0x232a});var triggers=[{'channel':_0x6c81('0x7'),'model':_0x6c81('0x8'),'event':_0x6c81('0x9'),'condition':_0x6c81('0xa'),'callback':afterCreate},{'channel':_0x6c81('0x7'),'model':_0x6c81('0x8'),'event':_0x6c81('0xb'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Chat','model':_0x6c81('0xc'),'event':_0x6c81('0x9'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x6c81('0xd'),'model':_0x6c81('0xe'),'event':_0x6c81('0x9'),'condition':_0x6c81('0xa'),'callback':afterCreate},{'channel':_0x6c81('0xd'),'model':_0x6c81('0xe'),'event':_0x6c81('0xb'),'condition':_0x6c81('0xf'),'callback':afterUpdate},{'channel':_0x6c81('0xd'),'model':_0x6c81('0x10'),'event':_0x6c81('0x9'),'condition':_0x6c81('0x11'),'callback':afterCreateMessage},{'channel':'Fax','model':_0x6c81('0x12'),'event':_0x6c81('0x9'),'condition':_0x6c81('0xa'),'callback':afterCreate},{'channel':_0x6c81('0x13'),'model':_0x6c81('0x12'),'event':_0x6c81('0xb'),'condition':_0x6c81('0xf'),'callback':afterUpdate},{'channel':_0x6c81('0x13'),'model':_0x6c81('0x14'),'event':_0x6c81('0x9'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x6c81('0x15'),'model':_0x6c81('0x16'),'event':_0x6c81('0x9'),'condition':_0x6c81('0xa'),'callback':afterCreate},{'channel':_0x6c81('0x15'),'model':'MailInteraction','event':_0x6c81('0xb'),'condition':_0x6c81('0xf'),'callback':afterUpdate},{'channel':'Mail','model':_0x6c81('0x17'),'event':'afterCreate','condition':_0x6c81('0x11'),'callback':afterCreateMessage},{'channel':_0x6c81('0x18'),'model':'OpenchannelInteraction','event':_0x6c81('0x9'),'condition':_0x6c81('0xa'),'callback':afterCreate},{'channel':_0x6c81('0x18'),'model':'OpenchannelInteraction','event':_0x6c81('0xb'),'condition':_0x6c81('0xf'),'callback':afterUpdate},{'channel':_0x6c81('0x18'),'model':'OpenchannelMessage','event':'afterCreate','condition':_0x6c81('0x11'),'callback':afterCreateMessage}];function request(_0x34e750){return client[_0x6c81('0x19')](_0x6c81('0x1a'),_0x34e750)['then'](function(_0x194c2b){logger[_0x6c81('0x1b')](_0x6c81('0x1c'),_0x6c81('0x1a'),_0x194c2b);if(_0x194c2b[_0x6c81('0x1d')]){if(_0x194c2b[_0x6c81('0x1d')][_0x6c81('0x1e')]===0x1f4){logger[_0x6c81('0x1d')](_0x6c81('0x1c'),'EventManager',_0x194c2b[_0x6c81('0x1d')]);}}})[_0x6c81('0x1f')](function(_0x371602){logger[_0x6c81('0x1d')](_0x6c81('0x1c'),_0x6c81('0x1a'),_0x371602);});}function afterCreateMessage(_0x96cc08,_0x5ed1d9){return function(_0x4c616f,_0x341f87){_0x4c616f=_0x4c616f[_0x6c81('0x20')]({'plain':!![]});_0x4c616f[_0x6c81('0x21')]=_0x96cc08;_0x4c616f[_0x6c81('0x22')]=_0x4c616f[_0x6c81('0x23')];if(_0x4c616f['UserId']){return db[_0x6c81('0x24')][_0x6c81('0x25')]({'where':{'id':_0x4c616f[_0x6c81('0x26')]},'attributes':['id',_0x6c81('0x27')],'raw':!![]})['then'](function(_0x4b9fd4){_0x4c616f[_0x6c81('0x28')]=util[_0x6c81('0x29')](_0x6c81('0x2a'),_0x4b9fd4[_0x6c81('0x27')]);_0x4c616f[_0x6c81('0x21')]=_0x96cc08;return request({'event':_0x6c81('0x2b'),'message':_0x4c616f});})[_0x6c81('0x1f')](function(_0x393ba8){console[_0x6c81('0x1d')](_0x393ba8);});}else{return request({'event':'outgoingmessage','message':_0x4c616f});}};}function afterCreate(_0x2ddd84,_0x260130){return function(_0x46edb3,_0x40c6f8){_0x46edb3=_0x46edb3[_0x6c81('0x20')]({'plain':!![]});_0x46edb3['channel']=_0x2ddd84;_0x46edb3['event']=_0x6c81('0x2c');return request({'event':_0x260130,'message':_0x46edb3});};}function afterUpdate(_0x354e07,_0x4a3736){return function(_0xafc864,_0x479bed){if(_0xafc864[_0x6c81('0x2d')](_0x6c81('0x2e'))&&_0xafc864['closed']){_0xafc864=_0xafc864[_0x6c81('0x20')]({'plain':!![]});_0xafc864[_0x6c81('0x21')]=_0x354e07;_0xafc864['event']=_0x6c81('0x2e');if(_0xafc864['UserId']){return db['User'][_0x6c81('0x25')]({'where':{'id':_0xafc864['UserId']},'attributes':['id',_0x6c81('0x27')],'raw':!![]})['then'](function(_0x5bc899){_0xafc864['interface']=util[_0x6c81('0x29')](_0x6c81('0x2a'),_0x5bc899['name']);return request({'event':_0x4a3736,'message':_0xafc864});})['catch'](function(_0x344c88){console[_0x6c81('0x1d')](_0x344c88);});}else{return request({'event':_0x4a3736,'message':_0xafc864});}}};}exports[_0x6c81('0x2f')]=function(){for(var _0x47e5c0=0x0;_0x47e5c00x3){var _0x16b701=/\((.+)\)/;var _0x338480=_0x2b2780['rx'][_0xf6a0('0x17')](_0x16b701);if(_0x338480){_0x58d493=_0x338480[0x1];}else{_0x58d493=null;}}else{_0x58d493=null;}_0x2b2780['cb'](null,{'code':_0x31bc10,'result':_0x20a935,'extra':_0x58d493});}});_0x3af1a3['on'](_0xf6a0('0x18'),function(_0x6e4a77){_0xcd1698[_0xf6a0('0xa')](_0xf6a0('0x18'),new AGIError(_0xf6a0('0x19'),_0x6e4a77[_0xf6a0('0x1a')]));});_0x3af1a3['on'](_0xf6a0('0x1b'),function(){_0xcd1698[_0xf6a0('0xa')](_0xf6a0('0x1b'),new AGIError(_0xf6a0('0x1c')));});_0x3af1a3['on'](_0xf6a0('0x1d'),function(){_0xcd1698[_0xf6a0('0xa')](_0xf6a0('0x1d'),new AGIError(_0xf6a0('0x1e')));_0x3af1a3[_0xf6a0('0x1f')]();});_0x3af1a3['pipe'](_0x1ccc06);this[_0xf6a0('0x20')]=function(_0x209795,_0x5d7b73){var _0x209795=_0x209795||'',_0x5d7b73=typeof _0x5d7b73==_0xf6a0('0xf')?_0x5d7b73:new Function();_0x2b2780={'tx':_0x209795,'rx':'','cb':_0x5d7b73};_0x3af1a3[_0xf6a0('0x21')](_0x209795+'\x0a');},this[_0xf6a0('0x1b')]=function(){_0x3af1a3[_0xf6a0('0x1f')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x4acb23){return this[_0xf6a0('0x20')][_0xf6a0('0x22')](this,_0x4acb23);};AGIChannel[_0xf6a0('0x23')][_0xf6a0('0x24')]=function(){return this[_0xf6a0('0x25')](_0xf6a0('0x26'));};AGIChannel[_0xf6a0('0x23')]['getData']=function(_0x3e12e0,_0x35a2c4,_0x35a2a5){_0x3e12e0=_0x3e12e0===undefined?_0xf6a0('0x27'):_0x3e12e0;_0x35a2c4=_0x35a2c4===undefined?'5':_0x35a2c4;_0x35a2a5=_0x35a2a5===undefined?'1':_0x35a2a5;return this[_0xf6a0('0x25')](util[_0xf6a0('0x28')](_0xf6a0('0x29'),_0x3e12e0,_0x35a2c4*0x3e8,_0x35a2a5));};AGIChannel[_0xf6a0('0x23')][_0xf6a0('0x2a')]=function(_0x4e3fdc){_0x4e3fdc=_0x4e3fdc||_0xf6a0('0x2b');return this[_0xf6a0('0x25')](util[_0xf6a0('0x28')](_0xf6a0('0x2c'),_0x4e3fdc));};AGIChannel[_0xf6a0('0x23')]['exec']=function(_0x5c1398,_0xf7bd4c){if(_['isArray'](_0xf7bd4c)){return this[_0xf6a0('0x25')](util[_0xf6a0('0x28')](_0xf6a0('0x2d'),_0x5c1398,_0xf7bd4c[_0xf6a0('0x2e')](',')));}return this['sendRequest'](util[_0xf6a0('0x28')](_0xf6a0('0x2d'),_0x5c1398,_0xf7bd4c));};AGIChannel['prototype'][_0xf6a0('0x2f')]=function(_0x452fad){return this['sendRequest'](util['format']('SET\x20CONTEXT\x20%s',_0x452fad));};AGIChannel[_0xf6a0('0x23')]['setExtension']=function(_0x1c9c9a){return this[_0xf6a0('0x25')](util[_0xf6a0('0x28')](_0xf6a0('0x30'),_0x1c9c9a));};AGIChannel[_0xf6a0('0x23')][_0xf6a0('0x31')]=function(_0x111585){return this[_0xf6a0('0x25')](util[_0xf6a0('0x28')](_0xf6a0('0x32'),_0x111585));};AGIChannel['prototype'][_0xf6a0('0xc')]=function(){return this[_0xf6a0('0x25')](_0xf6a0('0x33'));};AGIChannel['prototype'][_0xf6a0('0x34')]=function(_0x196212,_0x4280cb){return this[_0xf6a0('0x25')](util[_0xf6a0('0x28')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x196212,_0x4280cb?_0x4280cb[_0xf6a0('0x35')]()[_0xf6a0('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xf6a0('0x23')][_0xf6a0('0x36')]=function(_0x314c62,_0x10cb16){return this['sendRequest'](util[_0xf6a0('0x28')](_0xf6a0('0x37'),_0x314c62,_0x10cb16));};AGIChannel[_0xf6a0('0x23')]['sayDigits']=function(_0x1aa5ad,_0x531ff2){return this[_0xf6a0('0x25')](util[_0xf6a0('0x28')](_0xf6a0('0x38'),_0x1aa5ad,_0x531ff2));};AGIChannel['prototype'][_0xf6a0('0x39')]=function(_0x378b2a,_0x1fc781){return this[_0xf6a0('0x25')](util[_0xf6a0('0x28')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x378b2a,_0x1fc781));};AGIChannel[_0xf6a0('0x23')][_0xf6a0('0x3a')]=function(_0x464e0e,_0xde77ce,_0x397307){_0xde77ce=_0xde77ce||this[_0xf6a0('0x3b')];_0x397307=_0x397307||0x1;this['setContext'](_0x464e0e);this[_0xf6a0('0x3c')](_0xde77ce);this['setPriority'](_0x397307);return this['noop'](util[_0xf6a0('0x28')]('GOTO\x20%s\x20%s\x20%s',_0x464e0e,_0xde77ce,_0x397307));};AGIChannel[_0xf6a0('0x23')][_0xf6a0('0x3d')]=function(_0x92078c){return this[_0xf6a0('0x25')](util[_0xf6a0('0x28')](_0xf6a0('0x3e'),_0x92078c));};AGIChannel[_0xf6a0('0x23')][_0xf6a0('0x3f')]=function(_0xcee71a,_0x2acee4,_0x254dbc,_0x7b62f2,_0x318c40,_0x154aad){_0x2acee4=_0x2acee4||_0xf6a0('0x40');_0x254dbc=_0x254dbc||'';_0x7b62f2=_0x7b62f2===undefined?-0x1:_0x7b62f2==='-1'?-0x1:_0x7b62f2*0x3e8;_0x318c40=_0x318c40===undefined?'':'s='+_0x318c40;_0x154aad=_0x154aad?'BEEP':'';return this['sendRequest'](util[_0xf6a0('0x28')](_0xf6a0('0x41'),_0xcee71a,_0x2acee4,_0x254dbc,_0x7b62f2,_0x154aad,_0x318c40));};AGIChannel[_0xf6a0('0x23')]['streamFile']=function(_0x181772,_0x874144){_0x874144=_0x874144||'';return this['sendRequest'](util['format'](_0xf6a0('0x42'),_0x181772,_0x874144));};AGIChannel[_0xf6a0('0x23')][_0xf6a0('0x43')]=function(_0x5258b6){return this[_0xf6a0('0x44')]('AGI',_0x5258b6);};AGIChannel[_0xf6a0('0x23')]['wait']=function(_0x33bdd3){return this['exec'](_0xf6a0('0x45'),_0x33bdd3);};AGIChannel['prototype'][_0xf6a0('0x18')]=function(_0x5119d1,_0x2a2df0){this['noop'](util[_0xf6a0('0x28')](_0xf6a0('0x46'),_0x5119d1['id'],_0x5119d1[_0xf6a0('0x47')],_0x2a2df0));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x9b4c=['write','inherits','prototype','sendRequest','command','answer','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','exec','isArray','join','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','HANGUP','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','call','utf8','setTimeout','setEncoding','ready','line','toLowerCase','hangup','emit','search','520\x20End\x20of\x20proper','substring','replace','result=','indexOf','startsWith','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','function'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x9b4c,0x110));var _0xc9b4=function(_0x142156,_0x5169f8){_0x142156=_0x142156-0x0;var _0x5b1ea3=_0x9b4c[_0x142156];return _0x5b1ea3;};'use strict';var util=require(_0xc9b4('0x0'));var _=require(_0xc9b4('0x1'));var EventEmitter=require(_0xc9b4('0x2'))[_0xc9b4('0x3')];var AGIReply=require(_0xc9b4('0x4'));var AGIError=require('./error');function AGIChannel(_0xb653ef){var _0x44b7dc=this,_0x3c7b65=new AGIReply(),_0xaae049=![],_0x451bf0={};EventEmitter[_0xc9b4('0x5')](_0x44b7dc);_0xb653ef['setEncoding'](_0xc9b4('0x6'));_0xb653ef[_0xc9b4('0x7')](0x8*0x3c*0x3c*0x3e8);_0x3c7b65[_0xc9b4('0x8')](_0xc9b4('0x6'));_0x3c7b65['on']('headers',function(_0x2662d1){for(var _0x248b22 in _0x2662d1){_0x44b7dc[_0x248b22]=_0x2662d1[_0x248b22];}_0x44b7dc['emit'](_0xc9b4('0x9'));});_0x3c7b65['on'](_0xc9b4('0xa'),function(_0x2a3f4f){if(_0x2a3f4f[_0xc9b4('0xb')]()==_0xc9b4('0xc')){_0x44b7dc[_0xc9b4('0xd')](_0xc9b4('0xc'));return;}if(_0x2a3f4f['substring'](0x0,0xb)=='520-Invalid'){_0xaae049=!![];}if(_0xaae049){_0x451bf0['rx']+=_0x2a3f4f+'\x0a';if(_0x2a3f4f[_0xc9b4('0xe')](_0xc9b4('0xf'))!=-0x1){_0xaae049=![];}}else{_0x451bf0['rx']=_0x2a3f4f;}if(_0xaae049){return;}if(typeof _0x451bf0['cb']=='function'){var _0x4a72b2=_0x451bf0['rx'][_0xc9b4('0x10')](0x0,0x3),_0x238a5f=null,_0x43677a=null;_0x4a72b2=parseInt(_0x4a72b2);if(isNaN(_0x4a72b2)){_0x451bf0['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x4a72b2!=0xc8){_0x451bf0['cb'](null,{'code':_0x4a72b2,'result':-0x1,'extra':'KO'});return;}_0x238a5f=_0x451bf0['rx'][_0xc9b4('0x10')](0x4)[_0xc9b4('0x11')](_0xc9b4('0x12'),'');if(_0x238a5f[_0xc9b4('0x13')]('\x20')!=-0x1){_0x238a5f=_0x238a5f['substr'](0x0,_0x238a5f[_0xc9b4('0x13')]('\x20'));}if(_[_0xc9b4('0x14')](_0x238a5f,'-1')){_0x238a5f=parseInt(_0x238a5f);}_0x43677a=_0x451bf0['rx']['split']('\x20');if(_0x43677a['length']==0x3){_0x43677a=_0x43677a[0x2][_0xc9b4('0x10')](0x1,_0x43677a[0x2][_0xc9b4('0x15')]-0x1);}else if(_0x43677a[_0xc9b4('0x15')]>0x3){var _0x9f4c62=/\((.+)\)/;var _0x40c0ee=_0x451bf0['rx']['match'](_0x9f4c62);if(_0x40c0ee){_0x43677a=_0x40c0ee[0x1];}else{_0x43677a=null;}}else{_0x43677a=null;}_0x451bf0['cb'](null,{'code':_0x4a72b2,'result':_0x238a5f,'extra':_0x43677a});}});_0xb653ef['on'](_0xc9b4('0x16'),function(_0x5416d7){_0x44b7dc[_0xc9b4('0xd')](_0xc9b4('0x16'),new AGIError(_0xc9b4('0x17'),_0x5416d7[_0xc9b4('0x18')]));});_0xb653ef['on'](_0xc9b4('0x19'),function(){_0x44b7dc[_0xc9b4('0xd')]('close',new AGIError(_0xc9b4('0x1a')));});_0xb653ef['on'](_0xc9b4('0x1b'),function(){_0x44b7dc[_0xc9b4('0xd')](_0xc9b4('0x1b'),new AGIError(_0xc9b4('0x1c')));_0xb653ef[_0xc9b4('0x1d')]();});_0xb653ef[_0xc9b4('0x1e')](_0x3c7b65);this['command']=function(_0x25cfc5,_0xa79f45){var _0x25cfc5=_0x25cfc5||'',_0xa79f45=typeof _0xa79f45==_0xc9b4('0x1f')?_0xa79f45:new Function();_0x451bf0={'tx':_0x25cfc5,'rx':'','cb':_0xa79f45};_0xb653ef[_0xc9b4('0x20')](_0x25cfc5+'\x0a');},this['close']=function(){_0xb653ef[_0xc9b4('0x1d')]();};}util[_0xc9b4('0x21')](AGIChannel,EventEmitter);AGIChannel[_0xc9b4('0x22')][_0xc9b4('0x23')]=function(_0x40d35f){return this[_0xc9b4('0x24')]['sync'](this,_0x40d35f);};AGIChannel[_0xc9b4('0x22')][_0xc9b4('0x25')]=function(){return this['sendRequest'](_0xc9b4('0x26'));};AGIChannel[_0xc9b4('0x22')][_0xc9b4('0x27')]=function(_0x50bd8,_0x5a2105,_0x330020){_0x50bd8=_0x50bd8===undefined?'beep':_0x50bd8;_0x5a2105=_0x5a2105===undefined?'5':_0x5a2105;_0x330020=_0x330020===undefined?'1':_0x330020;return this[_0xc9b4('0x23')](util[_0xc9b4('0x28')](_0xc9b4('0x29'),_0x50bd8,_0x5a2105*0x3e8,_0x330020));};AGIChannel[_0xc9b4('0x22')][_0xc9b4('0x2a')]=function(_0x5bc878){_0x5bc878=_0x5bc878||_0xc9b4('0x2b');return this[_0xc9b4('0x23')](util['format']('VERBOSE\x20\x22%s\x22',_0x5bc878));};AGIChannel[_0xc9b4('0x22')][_0xc9b4('0x2c')]=function(_0x556190,_0x529857){if(_[_0xc9b4('0x2d')](_0x529857)){return this[_0xc9b4('0x23')](util[_0xc9b4('0x28')]('EXEC\x20%s\x20%s',_0x556190,_0x529857[_0xc9b4('0x2e')](',')));}return this[_0xc9b4('0x23')](util[_0xc9b4('0x28')](_0xc9b4('0x2f'),_0x556190,_0x529857));};AGIChannel[_0xc9b4('0x22')][_0xc9b4('0x30')]=function(_0x583c7c){return this[_0xc9b4('0x23')](util[_0xc9b4('0x28')](_0xc9b4('0x31'),_0x583c7c));};AGIChannel['prototype'][_0xc9b4('0x32')]=function(_0x41cf92){return this[_0xc9b4('0x23')](util[_0xc9b4('0x28')](_0xc9b4('0x33'),_0x41cf92));};AGIChannel['prototype']['setPriority']=function(_0x420368){return this[_0xc9b4('0x23')](util[_0xc9b4('0x28')]('SET\x20PRIORITY\x20%s',_0x420368));};AGIChannel[_0xc9b4('0x22')][_0xc9b4('0xc')]=function(){return this[_0xc9b4('0x23')](_0xc9b4('0x34'));};AGIChannel[_0xc9b4('0x22')]['setVariable']=function(_0x4dba1e,_0x13689a){return this[_0xc9b4('0x23')](util['format'](_0xc9b4('0x35'),_0x4dba1e,_0x13689a?_0x13689a['toString']()[_0xc9b4('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xc9b4('0x22')][_0xc9b4('0x36')]=function(_0x5dd4e8,_0x117553){return this[_0xc9b4('0x23')](util[_0xc9b4('0x28')]('SAY\x20NUMBER\x20%s\x20%s',_0x5dd4e8,_0x117553));};AGIChannel[_0xc9b4('0x22')][_0xc9b4('0x37')]=function(_0x474b18,_0x551955){return this[_0xc9b4('0x23')](util[_0xc9b4('0x28')](_0xc9b4('0x38'),_0x474b18,_0x551955));};AGIChannel[_0xc9b4('0x22')][_0xc9b4('0x39')]=function(_0x246d81,_0xcb184d){return this[_0xc9b4('0x23')](util[_0xc9b4('0x28')](_0xc9b4('0x3a'),_0x246d81,_0xcb184d));};AGIChannel[_0xc9b4('0x22')]['continueAt']=function(_0x486fd8,_0x2c1b50,_0x246c77){_0x2c1b50=_0x2c1b50||this[_0xc9b4('0x3b')];_0x246c77=_0x246c77||0x1;this[_0xc9b4('0x30')](_0x486fd8);this[_0xc9b4('0x32')](_0x2c1b50);this['setPriority'](_0x246c77);return this[_0xc9b4('0x2a')](util['format'](_0xc9b4('0x3c'),_0x486fd8,_0x2c1b50,_0x246c77));};AGIChannel[_0xc9b4('0x22')][_0xc9b4('0x3d')]=function(_0x5dba56){return this['sendRequest'](util[_0xc9b4('0x28')](_0xc9b4('0x3e'),_0x5dba56));};AGIChannel[_0xc9b4('0x22')][_0xc9b4('0x3f')]=function(_0xf2815b,_0x3e84c9,_0x450fc1,_0x408d77,_0x5ce4db,_0x46369a){_0x3e84c9=_0x3e84c9||_0xc9b4('0x40');_0x450fc1=_0x450fc1||'';_0x408d77=_0x408d77===undefined?-0x1:_0x408d77==='-1'?-0x1:_0x408d77*0x3e8;_0x5ce4db=_0x5ce4db===undefined?'':'s='+_0x5ce4db;_0x46369a=_0x46369a?_0xc9b4('0x41'):'';return this[_0xc9b4('0x23')](util[_0xc9b4('0x28')](_0xc9b4('0x42'),_0xf2815b,_0x3e84c9,_0x450fc1,_0x408d77,_0x46369a,_0x5ce4db));};AGIChannel[_0xc9b4('0x22')][_0xc9b4('0x43')]=function(_0x2b5cfe,_0x2cf501){_0x2cf501=_0x2cf501||'';return this[_0xc9b4('0x23')](util['format'](_0xc9b4('0x44'),_0x2b5cfe,_0x2cf501));};AGIChannel[_0xc9b4('0x22')][_0xc9b4('0x45')]=function(_0x42cace){return this['exec'](_0xc9b4('0x46'),_0x42cace);};AGIChannel[_0xc9b4('0x22')][_0xc9b4('0x47')]=function(_0x33367e){return this[_0xc9b4('0x2c')](_0xc9b4('0x48'),_0x33367e);};AGIChannel['prototype'][_0xc9b4('0x16')]=function(_0x2e4caf,_0xb1ecc3){this[_0xc9b4('0x2a')](util[_0xc9b4('0x28')](_0xc9b4('0x49'),_0x2e4caf['id'],_0x2e4caf[_0xc9b4('0x4a')],_0xb1ecc3));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xc9b4('0x4b')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 6fad73d..7cfaf9e 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 _0x8466=['Undefined\x20error.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','util'];(function(_0x29950e,_0x34e499){var _0x4c97b0=function(_0x306344){while(--_0x306344){_0x29950e['push'](_0x29950e['shift']());}};_0x4c97b0(++_0x34e499);}(_0x8466,0xff));var _0x6846=function(_0x40aeba,_0x516450){_0x40aeba=_0x40aeba-0x0;var _0x31929f=_0x8466[_0x40aeba];return _0x31929f;};'use strict';var util=require(_0x6846('0x0'));var error={'E_AGI_UNDEFINED':_0x6846('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x6846('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x6846('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x6846('0x4'),'E_AGI_SOCKET_ERROR':_0x6846('0x5'),'E_AGI_SOCKET_CLOSE':_0x6846('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x6846('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x6846('0x8'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x11832c){var _0x11832c=_0x11832c||null,_0x1a6a10=_0x1a6a10||[],_0x5de3fc=0x1,_0x410c83='';if(!error[_0x11832c]){_0x11832c=_0x6846('0x9');}_0x1a6a10[_0x6846('0xa')](error[_0x11832c]);while(arguments[_0x5de3fc]){_0x1a6a10[_0x6846('0xa')](arguments[_0x5de3fc]);_0x5de3fc++;}_0x410c83=util[_0x6846('0xb')][_0x6846('0xc')](util,_0x1a6a10);this[_0x6846('0xd')]=_0x410c83;this[_0x6846('0xe')]=_0x11832c;}module[_0x6846('0xf')]=AGIError; \ No newline at end of file +var _0x868c=['Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','util','Undefined\x20error.','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\x20error.\x20Code:\x20%s.'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x868c,0xbf));var _0xc868=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x868c[_0x42bc91];return _0x3f5507;};'use strict';var util=require(_0xc868('0x0'));var error={'E_AGI_UNDEFINED':_0xc868('0x1'),'E_AGI_ARGUMENT_PORT':_0xc868('0x2'),'E_AGI_SERVER_ERROR':_0xc868('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xc868('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xc868('0x5'),'E_AGI_SOCKET_ERROR':_0xc868('0x6'),'E_AGI_SOCKET_CLOSE':_0xc868('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xc868('0x8'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xc868('0x9'),'E_AGI_IVR_ENTRY':_0xc868('0xa')};function AGIError(_0xe62d57){var _0xe62d57=_0xe62d57||null,_0x15ab48=_0x15ab48||[],_0x5be10a=0x1,_0x31b2de='';if(!error[_0xe62d57]){_0xe62d57=_0xc868('0xb');}_0x15ab48[_0xc868('0xc')](error[_0xe62d57]);while(arguments[_0x5be10a]){_0x15ab48[_0xc868('0xc')](arguments[_0x5be10a]);_0x5be10a++;}_0x31b2de=util[_0xc868('0xd')][_0xc868('0xe')](util,_0x15ab48);this[_0xc868('0xf')]=_0x31b2de;this[_0xc868('0x10')]=_0xe62d57;}module[_0xc868('0x11')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 6878f8e..89abc9e 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 _0x4bde=['length','no\x20edge/s\x20available','condition','agicommand','vswitch','target','default','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','getdigits','getsecretdigits','vertices','edges','prototype','addVertex','push','numberOfEdges','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0x4bde,0x1b1));var _0xe4bd=function(_0x669bd7,_0x3d77c9){_0x669bd7=_0x669bd7-0x0;var _0x3cea5c=_0x4bde[_0x669bd7];return _0x3cea5c;};'use strict';var _=require(_0xe4bd('0x0'));var logger=require(_0xe4bd('0x1'))(_0xe4bd('0x2'));var verticesWithRetry=['menu',_0xe4bd('0x3'),_0xe4bd('0x4')];var Graph=function(){this[_0xe4bd('0x5')]={};this[_0xe4bd('0x6')]={};this['numberOfEdges']=0x0;};Graph[_0xe4bd('0x7')][_0xe4bd('0x8')]=function(_0x364f09){this[_0xe4bd('0x5')][_0x364f09['id']]=_0x364f09;this[_0xe4bd('0x6')][_0x364f09['id']]=[];};Graph[_0xe4bd('0x7')]['addEdge']=function(_0x2cf33d,_0xbd04ce,_0x262295){this[_0xe4bd('0x6')][_0x2cf33d][_0xe4bd('0x9')]({'target':_0xbd04ce,'condition':_0x262295});this[_0xe4bd('0xa')]+=0x1;};Graph['prototype']['size']=function(){return _['size'](this[_0xe4bd('0x5')]);};Graph[_0xe4bd('0x7')][_0xe4bd('0xb')]=function(){return this['numberOfEdges'];};Graph[_0xe4bd('0x7')][_0xe4bd('0xc')]=function(_0xea66e4){return this[_0xe4bd('0x5')][_0xea66e4];};Graph['prototype'][_0xe4bd('0xd')]=function(_0x5188e9,_0x44baa7){if(!this['vertices'][_0x5188e9]){return logger[_0xe4bd('0xe')](_0xe4bd('0xf'));}var _0x25b993=_0x44baa7(this[_0xe4bd('0x5')][_0x5188e9]);if(!_0x25b993){return logger[_0xe4bd('0xe')](_0xe4bd('0x10'));}if(this[_0xe4bd('0x6')][_0x5188e9][_0xe4bd('0x11')]===0x0){return logger[_0xe4bd('0xe')](_0xe4bd('0x12'));}for(var _0x355922=0x0,_0x4337f7=[],_0x470cd1=![];_0x355922\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','start','joinAt','omit','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','finally','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','./server','connection','xml2json','lodash','syncho','util','moment','../../config/environment','./graph','./vertices','agi','defaults','127.0.0.1','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[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','[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','uniqueid','evtHangup','toJson','mxGraphModel','root','agicommand','addVertex'];(function(_0x2bb512,_0x2ea486){var _0x1bc090=function(_0x127420){while(--_0x127420){_0x2bb512['push'](_0x2bb512['shift']());}};_0x1bc090(++_0x2ea486);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x403cff,_0x1cf463){_0x403cff=_0x403cff-0x0;var _0x5a7c56=_0xa1f6[_0x403cff];return _0x5a7c56;};'use strict';var parser=require(_0x6a1f('0x0'));var _=require(_0x6a1f('0x1'));var syncho=require(_0x6a1f('0x2'));var util=require(_0x6a1f('0x3'));var moment=require(_0x6a1f('0x4'));var config=require(_0x6a1f('0x5'));var logger=require('../../config/logger')('agi');var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require(_0x6a1f('0x6'));var Vertices=require(_0x6a1f('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x6a1f('0x8')]=_[_0x6a1f('0x9')](config[_0x6a1f('0x8')],{'ip':_0x6a1f('0xa'),'port':0x11dd});function connectionHandler(_0x36c00b){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x36c00b);agiHandler(_0x36c00b);}catch(_0x42b89f){logger[_0x6a1f('0xb')](_0x42b89f[_0x6a1f('0xc')]);}});});}function listeningHandler(){console[_0x6a1f('0xd')](_0x6a1f('0xe'),config['agi'][_0x6a1f('0xf')]);logger[_0x6a1f('0x10')](util[_0x6a1f('0x11')](_0x6a1f('0x12'),config['agi']['ip'],config[_0x6a1f('0x8')]['port']));}function errorHandler(_0xd0c92b){if(_0xd0c92b&&_0xd0c92b[_0x6a1f('0x13')]&&_0xd0c92b[_0x6a1f('0x14')]){logger[_0x6a1f('0xb')](util[_0x6a1f('0x11')](_0x6a1f('0x15'),_0xd0c92b[_0x6a1f('0x13')],_0xd0c92b[_0x6a1f('0x14')]));}else{logger[_0x6a1f('0xb')](util[_0x6a1f('0x11')](_0x6a1f('0x16'),_0xd0c92b[_0x6a1f('0xc')]));}}function closeHandler(){logger[_0x6a1f('0x10')](util[_0x6a1f('0x11')](_0x6a1f('0x17'),this[_0x6a1f('0x18')],this[_0x6a1f('0x19')],this[_0x6a1f('0x1a')],this[_0x6a1f('0x1b')],this['uniqueid']));try{createSquareReport(this);}catch(_0x392ccb){logger[_0x6a1f('0xb')](_0x392ccb[_0x6a1f('0xc')]);}}function timeoutHandler(){logger[_0x6a1f('0x10')](util[_0x6a1f('0x11')](_0x6a1f('0x1c'),this[_0x6a1f('0x18')],this[_0x6a1f('0x19')],this['callerid'],this[_0x6a1f('0x1b')],this['uniqueid']));}function hangupHandler(){logger[_0x6a1f('0x10')](util[_0x6a1f('0x11')](_0x6a1f('0x1d'),this[_0x6a1f('0x18')],this[_0x6a1f('0x19')],this['callerid'],this[_0x6a1f('0x1b')],this[_0x6a1f('0x1e')]));this[_0x6a1f('0x1f')]=!![];}function getRoot(_0x1be0c3){return parser[_0x6a1f('0x20')](_0x1be0c3,{'object':!![]})[_0x6a1f('0x21')][_0x6a1f('0x22')];}function addVertex(_0x2736ab,_0x53229b,_0x1eb146){_0x53229b[_0x6a1f('0x23')]=_0x1eb146;if(_0x53229b['hasOwnProperty']('retry')){_0x53229b['maxRetry']=parseInt(_0x53229b['retry'],0xa);}_0x2736ab[_0x6a1f('0x24')](_['omit'](_0x53229b,'mxCell'));}function initGraph(_0x28adcf,_0x286d1d){var _0x2b53ca=new Graph();for(var _0x1e8db8 in _0x28adcf){if(_0x28adcf[_0x6a1f('0x25')](_0x1e8db8)){if(_[_0x6a1f('0x26')](_0x28adcf[_0x1e8db8])){for(var _0x42f00e=0x0;_0x42f00e<_0x28adcf[_0x1e8db8][_0x6a1f('0x27')];_0x42f00e+=0x1){addVertex(_0x2b53ca,_0x28adcf[_0x1e8db8][_0x42f00e],_0x1e8db8);}}else{addVertex(_0x2b53ca,_0x28adcf[_0x1e8db8],_0x1e8db8);}}}for(var _0x4f6433=0x0;_0x4f6433<_0x286d1d[_0x6a1f('0x27')];_0x4f6433+=0x1){if(_0x286d1d[_0x4f6433][_0x6a1f('0x28')]&&_0x286d1d[_0x4f6433][_0x6a1f('0x29')]){_0x2b53ca['addEdge'](_0x286d1d[_0x4f6433][_0x6a1f('0x28')],_0x286d1d[_0x4f6433][_0x6a1f('0x29')],_0x286d1d[_0x4f6433][_0x6a1f('0x2a')]);}}return _0x2b53ca;}function getSquareProject(_0x113422,_0x2e71a5){rpc[_0x6a1f('0x2b')](_0x113422)[_0x6a1f('0x2c')](function(_0x58d879){_0x2e71a5(null,_0x58d879);})['catch'](function(_0x3aa41a){_0x2e71a5(null,_0x3aa41a);});}function createSquareReport(_0x40ef37,_0x43a3ba){rpc[_0x6a1f('0x2d')](_0x40ef37)[_0x6a1f('0x2c')](function(_0x2ad1d2){if(_0x43a3ba){_0x43a3ba(null,_0x2ad1d2);}})[_0x6a1f('0x2e')](function(_0x4cdc6c){if(_0x43a3ba){_0x43a3ba(null,_0x4cdc6c);}});}function setChannelVariables(_0x3d0f3c){for(var _0x32600d in _0x3d0f3c){if(_0x3d0f3c['hasOwnProperty'](_0x32600d)){if(_0x32600d[_0x6a1f('0x2f')](_0x6a1f('0x30'))===0x0){_0x3d0f3c[_0x32600d[_0x6a1f('0x31')](0x4)]=_0x3d0f3c[_0x32600d];delete _0x3d0f3c[_0x32600d];}}}}function getLogFromObject(_0x5a393c){return util['inspect'](_0x5a393c,{'showHidden':![],'depth':null});}function agiHandler(_0x5b003e){var _0x38df36,_0x2ac386,_0x563ee2,_0x596469,_0x15b4ff;logger[_0x6a1f('0x32')](_0x6a1f('0x33'),JSON[_0x6a1f('0x34')](_0x5b003e,null,0x2));logger[_0x6a1f('0x10')](util[_0x6a1f('0x11')](_0x6a1f('0x35'),_0x5b003e['arg_1'],_0x5b003e[_0x6a1f('0x19')],_0x5b003e['callerid'],_0x5b003e[_0x6a1f('0x1b')],_0x5b003e[_0x6a1f('0x1e')]));_0x5b003e['on']('error',errorHandler);_0x5b003e['on'](_0x6a1f('0x36'),closeHandler);_0x5b003e['on'](_0x6a1f('0x37'),timeoutHandler);_0x5b003e['evtHangup']=![];_0x5b003e['on'](_0x6a1f('0x38'),hangupHandler);var _0x48c033=getSquareProject[_0x6a1f('0x39')](null,_0x5b003e['arg_1']);if(_0x48c033){if(_0x48c033[_0x6a1f('0x3a')]){_0x38df36=getRoot(_0x48c033['production']);if(_0x38df36&&_0x38df36[_0x6a1f('0x3b')]){logger[_0x6a1f('0x32')]('root',JSON[_0x6a1f('0x34')](_0x38df36,null,0x2));_0x5b003e[_0x6a1f('0x3c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2ac386=initGraph(_[_0x6a1f('0x3d')](_0x38df36,_0x6a1f('0x3e')),_0x38df36[_0x6a1f('0x3e')]);_0x563ee2=new Vertices(_0x5b003e,rpc,mailRpc);logger[_0x6a1f('0x10')](util[_0x6a1f('0x11')](_0x6a1f('0x3f'),_0x5b003e['arg_1'],_0x5b003e[_0x6a1f('0x19')],_0x5b003e[_0x6a1f('0x1a')],_0x5b003e[_0x6a1f('0x1b')],_0x5b003e[_0x6a1f('0x1e')]));_0x2ac386[_0x6a1f('0x40')](_0x38df36[_0x6a1f('0x3b')]['id'],function(_0x27be0a){try{_0x27be0a=_0x563ee2[_0x6a1f('0x41')](_0x27be0a);logger[_0x6a1f('0x32')](_0x6a1f('0x42'),JSON[_0x6a1f('0x34')](_0x27be0a,null,0x2));if(_0x27be0a['agicommand']===_0x6a1f('0x43')){logger[_0x6a1f('0x10')](_0x6a1f('0x44'));_0x5b003e[_0x6a1f('0x45')]=_0x27be0a[_0x6a1f('0x45')]||_0x5b003e[_0x6a1f('0x45')];_0x5b003e['extension']=_0x27be0a[_0x6a1f('0x46')];_0x5b003e['priority']=_0x27be0a[_0x6a1f('0x47')]?_0x27be0a[_0x6a1f('0x47')]-0x1:0x1;return null;}else if(_0x27be0a&&_0x563ee2[_0x27be0a[_0x6a1f('0x23')]]){_0x15b4ff=_0x563ee2[_0x27be0a[_0x6a1f('0x23')]](_0x27be0a);logger[_0x6a1f('0x10')](_0x6a1f('0x48'),JSON['stringify'](_0x15b4ff,null,0x2));if(_0x15b4ff&&_0x15b4ff[_0x6a1f('0x49')]===AGI_CODE_SUCCESS&&_0x15b4ff[_0x6a1f('0x4a')]!==AGI_RESULT_ERROR&&!_0x5b003e[_0x6a1f('0x1f')]){logger[_0x6a1f('0x32')](_0x6a1f('0x48'),getLogFromObject(_0x15b4ff));return _[_0x6a1f('0x4b')](_0x15b4ff[_0x6a1f('0x4a')])?null:_0x15b4ff[_0x6a1f('0x4a')][_0x6a1f('0x4c')]();}else{logger[_0x6a1f('0xb')]('response',getLogFromObject(_0x15b4ff));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x19368f){logger[_0x6a1f('0xb')](_0x19368f[_0x6a1f('0xc')]);return null;}});if(_0x38df36[_0x6a1f('0x4d')]){logger[_0x6a1f('0x10')](util[_0x6a1f('0x11')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5b003e[_0x6a1f('0x18')],_0x5b003e['calleridname'],_0x5b003e[_0x6a1f('0x1a')],_0x5b003e[_0x6a1f('0x1b')],_0x5b003e['uniqueid']));_0x2ac386[_0x6a1f('0x40')](_0x38df36['finally']['id'],function(_0x43f798){try{_0x43f798=_0x563ee2[_0x6a1f('0x41')](_0x43f798);logger[_0x6a1f('0x32')](_0x6a1f('0x42'),JSON[_0x6a1f('0x34')](_0x43f798,null,0x2));if(_0x43f798&&_0x563ee2[_0x43f798[_0x6a1f('0x23')]]){_0x15b4ff=_0x563ee2[_0x43f798['agicommand']](_0x43f798);if(_0x15b4ff){logger[_0x6a1f('0x32')](_0x6a1f('0x48'),getLogFromObject(_0x15b4ff));return _[_0x6a1f('0x4b')](_0x15b4ff[_0x6a1f('0x4a')])?null:_0x15b4ff[_0x6a1f('0x4a')][_0x6a1f('0x4c')]();}else{logger[_0x6a1f('0xb')](_0x6a1f('0x48'),getLogFromObject(_0x15b4ff));return null;}}else{logger['error'](_0x6a1f('0x4e'));return null;}}catch(_0x28b793){logger[_0x6a1f('0xb')](_0x28b793['stack']);return null;}});}logger[_0x6a1f('0x10')](util['format'](_0x6a1f('0x4f'),_0x5b003e['arg_1'],_0x5b003e[_0x6a1f('0x19')],_0x5b003e['callerid'],_0x5b003e[_0x6a1f('0x1b')],_0x5b003e[_0x6a1f('0x1e')]));logger[_0x6a1f('0x10')](util['format'](_0x6a1f('0x50'),_0x5b003e['context'],_0x5b003e[_0x6a1f('0x46')],parseInt(_0x5b003e['priority'],0xa)+0x1));_0x5b003e['continueAt'](_0x5b003e[_0x6a1f('0x45')],_0x5b003e[_0x6a1f('0x46')],parseInt(_0x5b003e['priority'],0xa)+0x1);_0x5b003e[_0x6a1f('0x36')]();}}else{logger[_0x6a1f('0xb')](util[_0x6a1f('0x11')]('Project\x20%s\x20not\x20published',_0x5b003e[_0x6a1f('0x18')]));_0x5b003e[_0x6a1f('0x51')](_0x5b003e[_0x6a1f('0x45')],_0x5b003e[_0x6a1f('0x46')],parseInt(_0x5b003e[_0x6a1f('0x47')],0xa)+0x1);_0x5b003e[_0x6a1f('0x36')]();}}else{logger['error'](util[_0x6a1f('0x11')](_0x6a1f('0x52'),_0x5b003e[_0x6a1f('0x18')]));_0x5b003e[_0x6a1f('0x51')](_0x5b003e[_0x6a1f('0x45')],_0x5b003e['extension'],parseInt(_0x5b003e['priority'],0xa)+0x1);_0x5b003e[_0x6a1f('0x36')]();}}function main(){var _0x514b97;return utilLicense[_0x6a1f('0x53')]()[_0x6a1f('0x2c')](function(_0x3f9018){if(_0x3f9018){if(_0x3f9018[_0x6a1f('0x54')]){if(_0x3f9018[_0x6a1f('0x55')]&&_0x3f9018['callysquare']>0x0){logger[_0x6a1f('0x10')](util['format'](_0x6a1f('0x56'),_0x3f9018[_0x6a1f('0x55')]));_0x514b97=_0x3f9018[_0x6a1f('0x55')];}else{logger[_0x6a1f('0x10')](_0x6a1f('0x57'));}}else{logger[_0x6a1f('0x10')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x514b97=-0x1;}}})[_0x6a1f('0x2e')](function(_0x4af217){logger['error']('[LICENSE]',_0x4af217[_0x6a1f('0xc')]);})[_0x6a1f('0x4d')](function(){var _0x5b686d=require(_0x6a1f('0x58'))(config[_0x6a1f('0x8')][_0x6a1f('0xf')],config['agi']['ip'],_0x514b97);_0x5b686d['on'](_0x6a1f('0xb'),errorHandler);_0x5b686d['on']('listening',listeningHandler);_0x5b686d['on'](_0x6a1f('0x59'),connectionHandler);_0x5b686d['on'](_0x6a1f('0x36'),closeHandler);});}main(); \ No newline at end of file +var _0x17ba=['[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','agicommand','maxRetry','retry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','getSquareProject','then','createSquareReport','catch','hasOwnProperty','agi_','substring','inspect','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','hangup','sync','production','start','root','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','stringify','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20published','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','lodash','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','defaults','127.0.0.1','nextTick','error','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','[%s]\x20%s','[ERROR]\x20%s'];(function(_0xa1e9f2,_0x48aa1d){var _0x4ceafa=function(_0x2609c0){while(--_0x2609c0){_0xa1e9f2['push'](_0xa1e9f2['shift']());}};_0x4ceafa(++_0x48aa1d);}(_0x17ba,0xab));var _0xa17b=function(_0x1e1a6e,_0x3346ab){_0x1e1a6e=_0x1e1a6e-0x0;var _0x199a48=_0x17ba[_0x1e1a6e];return _0x199a48;};'use strict';var parser=require(_0xa17b('0x0'));var _=require(_0xa17b('0x1'));var syncho=require('syncho');var util=require(_0xa17b('0x2'));var moment=require(_0xa17b('0x3'));var config=require(_0xa17b('0x4'));var logger=require(_0xa17b('0x5'))(_0xa17b('0x6'));var utilLicense=require(_0xa17b('0x7'));var rpc=require(_0xa17b('0x8'));var mailRpc=require(_0xa17b('0x9'));var Graph=require(_0xa17b('0xa'));var Vertices=require(_0xa17b('0xb'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xa17b('0x6')]=_[_0xa17b('0xc')](config[_0xa17b('0x6')],{'ip':_0xa17b('0xd'),'port':0x11dd});function connectionHandler(_0x2ca4d3){process[_0xa17b('0xe')](function(){syncho(function(){try{setChannelVariables(_0x2ca4d3);agiHandler(_0x2ca4d3);}catch(_0x2d7aa4){logger[_0xa17b('0xf')](_0x2d7aa4[_0xa17b('0x10')]);}});});}function listeningHandler(){console['log'](_0xa17b('0x11'),config[_0xa17b('0x6')][_0xa17b('0x12')]);logger[_0xa17b('0x13')](util[_0xa17b('0x14')](_0xa17b('0x15'),config[_0xa17b('0x6')]['ip'],config['agi'][_0xa17b('0x12')]));}function errorHandler(_0x3e92e4){if(_0x3e92e4&&_0x3e92e4[_0xa17b('0x16')]&&_0x3e92e4['message']){logger[_0xa17b('0xf')](util[_0xa17b('0x14')](_0xa17b('0x17'),_0x3e92e4[_0xa17b('0x16')],_0x3e92e4['message']));}else{logger[_0xa17b('0xf')](util['format'](_0xa17b('0x18'),_0x3e92e4[_0xa17b('0x10')]));}}function closeHandler(){logger['info'](util[_0xa17b('0x14')](_0xa17b('0x19'),this[_0xa17b('0x1a')],this[_0xa17b('0x1b')],this['callerid'],this[_0xa17b('0x1c')],this['uniqueid']));try{createSquareReport(this);}catch(_0x4d5592){logger['error'](_0x4d5592[_0xa17b('0x10')]);}}function timeoutHandler(){logger[_0xa17b('0x13')](util['format'](_0xa17b('0x1d'),this[_0xa17b('0x1a')],this[_0xa17b('0x1b')],this[_0xa17b('0x1e')],this[_0xa17b('0x1c')],this[_0xa17b('0x1f')]));}function hangupHandler(){logger[_0xa17b('0x13')](util['format'](_0xa17b('0x20'),this[_0xa17b('0x1a')],this[_0xa17b('0x1b')],this['callerid'],this[_0xa17b('0x1c')],this[_0xa17b('0x1f')]));this[_0xa17b('0x21')]=!![];}function getRoot(_0xbbbb62){return parser[_0xa17b('0x22')](_0xbbbb62,{'object':!![]})[_0xa17b('0x23')]['root'];}function addVertex(_0x3df11f,_0x4d4a65,_0xa34739){_0x4d4a65[_0xa17b('0x24')]=_0xa34739;if(_0x4d4a65['hasOwnProperty']('retry')){_0x4d4a65[_0xa17b('0x25')]=parseInt(_0x4d4a65[_0xa17b('0x26')],0xa);}_0x3df11f[_0xa17b('0x27')](_[_0xa17b('0x28')](_0x4d4a65,_0xa17b('0x29')));}function initGraph(_0x3a64f5,_0x4cd38e){var _0x47aff8=new Graph();for(var _0x5c98fe in _0x3a64f5){if(_0x3a64f5['hasOwnProperty'](_0x5c98fe)){if(_[_0xa17b('0x2a')](_0x3a64f5[_0x5c98fe])){for(var _0x5ef356=0x0;_0x5ef356<_0x3a64f5[_0x5c98fe][_0xa17b('0x2b')];_0x5ef356+=0x1){addVertex(_0x47aff8,_0x3a64f5[_0x5c98fe][_0x5ef356],_0x5c98fe);}}else{addVertex(_0x47aff8,_0x3a64f5[_0x5c98fe],_0x5c98fe);}}}for(var _0x4ff3f8=0x0;_0x4ff3f8<_0x4cd38e[_0xa17b('0x2b')];_0x4ff3f8+=0x1){if(_0x4cd38e[_0x4ff3f8][_0xa17b('0x2c')]&&_0x4cd38e[_0x4ff3f8][_0xa17b('0x2d')]){_0x47aff8[_0xa17b('0x2e')](_0x4cd38e[_0x4ff3f8][_0xa17b('0x2c')],_0x4cd38e[_0x4ff3f8][_0xa17b('0x2d')],_0x4cd38e[_0x4ff3f8][_0xa17b('0x2f')]);}}return _0x47aff8;}function getSquareProject(_0x366b47,_0x43b1f5){rpc[_0xa17b('0x30')](_0x366b47)[_0xa17b('0x31')](function(_0x573585){_0x43b1f5(null,_0x573585);})['catch'](function(_0x58d7b6){_0x43b1f5(null,_0x58d7b6);});}function createSquareReport(_0x404369,_0x11070a){rpc[_0xa17b('0x32')](_0x404369)[_0xa17b('0x31')](function(_0x16dd1f){if(_0x11070a){_0x11070a(null,_0x16dd1f);}})[_0xa17b('0x33')](function(_0x312ac3){if(_0x11070a){_0x11070a(null,_0x312ac3);}});}function setChannelVariables(_0x1bdd09){for(var _0x5884af in _0x1bdd09){if(_0x1bdd09[_0xa17b('0x34')](_0x5884af)){if(_0x5884af['indexOf'](_0xa17b('0x35'))===0x0){_0x1bdd09[_0x5884af[_0xa17b('0x36')](0x4)]=_0x1bdd09[_0x5884af];delete _0x1bdd09[_0x5884af];}}}}function getLogFromObject(_0x198ceb){return util[_0xa17b('0x37')](_0x198ceb,{'showHidden':![],'depth':null});}function agiHandler(_0x4ec38d){var _0x243876,_0x596d48,_0x3031b5,_0xc33f5e,_0x323e0e;logger[_0xa17b('0x38')](_0xa17b('0x39'),JSON['stringify'](_0x4ec38d,null,0x2));logger[_0xa17b('0x13')](util['format'](_0xa17b('0x3a'),_0x4ec38d['arg_1'],_0x4ec38d[_0xa17b('0x1b')],_0x4ec38d[_0xa17b('0x1e')],_0x4ec38d['dnid'],_0x4ec38d[_0xa17b('0x1f')]));_0x4ec38d['on'](_0xa17b('0xf'),errorHandler);_0x4ec38d['on']('close',closeHandler);_0x4ec38d['on'](_0xa17b('0x3b'),timeoutHandler);_0x4ec38d[_0xa17b('0x21')]=![];_0x4ec38d['on'](_0xa17b('0x3c'),hangupHandler);var _0x55c1b6=getSquareProject[_0xa17b('0x3d')](null,_0x4ec38d['arg_1']);if(_0x55c1b6){if(_0x55c1b6[_0xa17b('0x3e')]){_0x243876=getRoot(_0x55c1b6['production']);if(_0x243876&&_0x243876[_0xa17b('0x3f')]){logger['debug'](_0xa17b('0x40'),JSON['stringify'](_0x243876,null,0x2));_0x4ec38d[_0xa17b('0x41')]=moment()['format'](_0xa17b('0x42'));_0x596d48=initGraph(_['omit'](_0x243876,_0xa17b('0x29')),_0x243876[_0xa17b('0x29')]);_0x3031b5=new Vertices(_0x4ec38d,rpc,mailRpc);logger[_0xa17b('0x13')](util[_0xa17b('0x14')](_0xa17b('0x43'),_0x4ec38d[_0xa17b('0x1a')],_0x4ec38d[_0xa17b('0x1b')],_0x4ec38d[_0xa17b('0x1e')],_0x4ec38d['dnid'],_0x4ec38d[_0xa17b('0x1f')]));_0x596d48[_0xa17b('0x44')](_0x243876['start']['id'],function(_0x477922){try{_0x477922=_0x3031b5[_0xa17b('0x45')](_0x477922);logger[_0xa17b('0x38')](_0xa17b('0x46'),JSON[_0xa17b('0x47')](_0x477922,null,0x2));if(_0x477922[_0xa17b('0x24')]==='gotoc'){logger[_0xa17b('0x13')](_0xa17b('0x48'));_0x4ec38d[_0xa17b('0x49')]=_0x477922['context']||_0x4ec38d['context'];_0x4ec38d['extension']=_0x477922[_0xa17b('0x4a')];_0x4ec38d[_0xa17b('0x4b')]=_0x477922[_0xa17b('0x4b')]?_0x477922[_0xa17b('0x4b')]-0x1:0x1;return null;}else if(_0x477922&&_0x3031b5[_0x477922[_0xa17b('0x24')]]){_0x323e0e=_0x3031b5[_0x477922[_0xa17b('0x24')]](_0x477922);logger[_0xa17b('0x13')](_0xa17b('0x4c'),JSON[_0xa17b('0x47')](_0x323e0e,null,0x2));if(_0x323e0e&&_0x323e0e[_0xa17b('0x4d')]===AGI_CODE_SUCCESS&&_0x323e0e[_0xa17b('0x4e')]!==AGI_RESULT_ERROR&&!_0x4ec38d[_0xa17b('0x21')]){logger['debug'](_0xa17b('0x4c'),getLogFromObject(_0x323e0e));return _[_0xa17b('0x4f')](_0x323e0e[_0xa17b('0x4e')])?null:_0x323e0e[_0xa17b('0x4e')][_0xa17b('0x50')]();}else{logger[_0xa17b('0xf')]('response',getLogFromObject(_0x323e0e));return null;}}else{logger[_0xa17b('0xf')](_0xa17b('0x51'));return null;}}catch(_0x5e04f1){logger[_0xa17b('0xf')](_0x5e04f1[_0xa17b('0x10')]);return null;}});if(_0x243876['finally']){logger[_0xa17b('0x13')](util[_0xa17b('0x14')](_0xa17b('0x52'),_0x4ec38d[_0xa17b('0x1a')],_0x4ec38d['calleridname'],_0x4ec38d[_0xa17b('0x1e')],_0x4ec38d[_0xa17b('0x1c')],_0x4ec38d[_0xa17b('0x1f')]));_0x596d48[_0xa17b('0x44')](_0x243876[_0xa17b('0x53')]['id'],function(_0x19dee2){try{_0x19dee2=_0x3031b5[_0xa17b('0x45')](_0x19dee2);logger['debug'](_0xa17b('0x46'),JSON[_0xa17b('0x47')](_0x19dee2,null,0x2));if(_0x19dee2&&_0x3031b5[_0x19dee2['agicommand']]){_0x323e0e=_0x3031b5[_0x19dee2[_0xa17b('0x24')]](_0x19dee2);if(_0x323e0e){logger[_0xa17b('0x38')](_0xa17b('0x4c'),getLogFromObject(_0x323e0e));return _['isUndefined'](_0x323e0e[_0xa17b('0x4e')])?null:_0x323e0e[_0xa17b('0x4e')]['toString']();}else{logger[_0xa17b('0xf')](_0xa17b('0x4c'),getLogFromObject(_0x323e0e));return null;}}else{logger['error'](_0xa17b('0x51'));return null;}}catch(_0x347436){logger['error'](_0x347436[_0xa17b('0x10')]);return null;}});}logger[_0xa17b('0x13')](util[_0xa17b('0x14')](_0xa17b('0x54'),_0x4ec38d[_0xa17b('0x1a')],_0x4ec38d[_0xa17b('0x1b')],_0x4ec38d[_0xa17b('0x1e')],_0x4ec38d['dnid'],_0x4ec38d[_0xa17b('0x1f')]));logger[_0xa17b('0x13')](util[_0xa17b('0x14')](_0xa17b('0x55'),_0x4ec38d[_0xa17b('0x49')],_0x4ec38d[_0xa17b('0x4a')],parseInt(_0x4ec38d[_0xa17b('0x4b')],0xa)+0x1));_0x4ec38d[_0xa17b('0x56')](_0x4ec38d[_0xa17b('0x49')],_0x4ec38d[_0xa17b('0x4a')],parseInt(_0x4ec38d[_0xa17b('0x4b')],0xa)+0x1);_0x4ec38d[_0xa17b('0x57')]();}}else{logger[_0xa17b('0xf')](util['format'](_0xa17b('0x58'),_0x4ec38d[_0xa17b('0x1a')]));_0x4ec38d[_0xa17b('0x56')](_0x4ec38d[_0xa17b('0x49')],_0x4ec38d[_0xa17b('0x4a')],parseInt(_0x4ec38d[_0xa17b('0x4b')],0xa)+0x1);_0x4ec38d[_0xa17b('0x57')]();}}else{logger[_0xa17b('0xf')](util[_0xa17b('0x14')]('Project\x20%s\x20not\x20found',_0x4ec38d['arg_1']));_0x4ec38d[_0xa17b('0x56')](_0x4ec38d[_0xa17b('0x49')],_0x4ec38d['extension'],parseInt(_0x4ec38d['priority'],0xa)+0x1);_0x4ec38d['close']();}}function main(){var _0x471cb2;return utilLicense[_0xa17b('0x59')]()[_0xa17b('0x31')](function(_0x5c6a15){if(_0x5c6a15){if(_0x5c6a15[_0xa17b('0x5a')]){if(_0x5c6a15[_0xa17b('0x5b')]&&_0x5c6a15['callysquare']>0x0){logger['info'](util['format']('[LICENSE]\x20CHANNELS:\x20%s',_0x5c6a15['callysquare']));_0x471cb2=_0x5c6a15[_0xa17b('0x5b')];}else{logger[_0xa17b('0x13')](_0xa17b('0x5c'));}}else{logger[_0xa17b('0x13')](_0xa17b('0x5d'));_0x471cb2=-0x1;}}})[_0xa17b('0x33')](function(_0x3270a0){logger['error'](_0xa17b('0x5e'),_0x3270a0[_0xa17b('0x10')]);})[_0xa17b('0x53')](function(){var _0x2d744d=require(_0xa17b('0x5f'))(config[_0xa17b('0x6')][_0xa17b('0x12')],config[_0xa17b('0x6')]['ip'],_0x471cb2);_0x2d744d['on'](_0xa17b('0xf'),errorHandler);_0x2d744d['on'](_0xa17b('0x60'),listeningHandler);_0x2d744d['on'](_0xa17b('0x61'),connectionHandler);_0x2d744d['on'](_0xa17b('0x57'),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 0a38b36..4c3b62d 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(_0x32879a,_0x37e8ea){var _0x15f40e=function(_0x3234d1){while(--_0x3234d1){_0x32879a['push'](_0x32879a['shift']());}};_0x15f40e(++_0x37e8ea);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x47d3ff,_0xd33ab3){var _0x3adc16=function(_0x231a04){while(--_0x231a04){_0x47d3ff['push'](_0x47d3ff['shift']());}};_0x3adc16(++_0xd33ab3);}(_0x814b,0x1a2));var _0xb814=function(_0x5df033,_0x29458b){_0x5df033=_0x5df033-0x0;var _0x445829=_0x814b[_0x5df033];return _0x445829;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 40d4ba2..041ccb7 100644 --- a/server/services/agi/reply.js +++ b/server/services/agi/reply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x3164b1,_0x4afd29){var _0x4f40b2=function(_0x59eeba){while(--_0x59eeba){_0x3164b1['push'](_0x3164b1['shift']());}};_0x4f40b2(++_0x4afd29);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4b91e6,_0x4003bd){_0x4b91e6=_0x4b91e6-0x0;var _0x592c2a=_0x5f2f[_0x4b91e6];return _0x592c2a;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file +var _0x7a54=['substring','length','split','indexOf','slice','trim','emit','util','stream','Transform','call','_localBuffer','inherits','prototype','_transform','toString','_inBody'];(function(_0x1459d9,_0x380230){var _0x488424=function(_0x222866){while(--_0x222866){_0x1459d9['push'](_0x1459d9['shift']());}};_0x488424(++_0x380230);}(_0x7a54,0x106));var _0x47a5=function(_0x4b0c58,_0x4f49f5){_0x4b0c58=_0x4b0c58-0x0;var _0x21c0a7=_0x7a54[_0x4b0c58];return _0x21c0a7;};'use strict';var util=require(_0x47a5('0x0'));var Transform=require(_0x47a5('0x1'))[_0x47a5('0x2')];function AGIReply(_0x58157c){Transform[_0x47a5('0x3')](this,_0x58157c);this[_0x47a5('0x4')]='';this['_inBody']=![];}util[_0x47a5('0x5')](AGIReply,Transform);AGIReply[_0x47a5('0x6')][_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){var _0x3d5629='\x0a',_0x59199c=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x343372=-0x1,_0x30e405=-0x1,_0x506eda='',_0x194fb0=0x0,_0x5077f3='',_0x5d90b3='';this[_0x47a5('0x4')]+=_0x3717e1[_0x47a5('0x8')]();_0x5077f3=this['_localBuffer'];if(!this[_0x47a5('0x9')]){_0x194fb0=0x0;while(_0x59199c[_0x194fb0]){while((_0x30e405=_0x5077f3['indexOf'](_0x59199c[_0x194fb0]))!=-0x1){_0x506eda=_0x59199c[_0x194fb0];_0x5d90b3=_0x5077f3['substring'](0x0,_0x30e405);_0x5077f3=_0x5077f3[_0x47a5('0xa')](_0x30e405+_0x506eda[_0x47a5('0xb')]);var _0x2f399b=_0x5d90b3[_0x47a5('0xc')](_0x3d5629),_0x250fad=0x0,_0xd612dd={},_0xd308b8='',_0x1eae59='',_0x5beb89=-0x1;while(_0x2f399b[_0x250fad]){_0x5beb89=_0x2f399b[_0x250fad][_0x47a5('0xd')](':');if(_0x5beb89!=-0x1){_0xd308b8=_0x2f399b[_0x250fad][_0x47a5('0xe')](0x0,_0x5beb89)[_0x47a5('0xf')]();_0x1eae59=_0x2f399b[_0x250fad][_0x47a5('0xe')](_0x5beb89+0x1)[_0x47a5('0xf')]();if(_0xd308b8[_0x47a5('0xb')]>0x0){_0xd612dd[_0xd308b8]=_0x1eae59;}}else{}_0x250fad++;}this[_0x47a5('0x10')]('headers',_0xd612dd);this[_0x47a5('0x9')]=!![];}_0x194fb0++;}this[_0x47a5('0x4')]=_0x5077f3;}else{while((_0x343372=_0x5077f3[_0x47a5('0xd')](_0x3d5629))!=-0x1){_0x5d90b3=_0x5077f3[_0x47a5('0xa')](0x0,_0x343372);this[_0x47a5('0x10')]('line',_0x5d90b3);_0x5077f3=_0x5077f3['substring'](_0x343372+_0x3d5629[_0x47a5('0xb')]);}this['_localBuffer']=_0x5077f3;}_0x545a97();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 99abd1c..a5b231e 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 _0xdd8e=['ShowSquareOdbc','dsn','getUserById','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','phone','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','bluebird','lodash','util','jayson/promise','client','http','request','then','error','result','catch','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById'];(function(_0x5817e6,_0x44a2d0){var _0x51916a=function(_0x1a56e3){while(--_0x1a56e3){_0x5817e6['push'](_0x5817e6['shift']());}};_0x51916a(++_0x44a2d0);}(_0xdd8e,0x1f4));var _0xedd8=function(_0x1d0cb7,_0x311bf4){_0x1d0cb7=_0x1d0cb7-0x0;var _0x4708e4=_0xdd8e[_0x1d0cb7];return _0x4708e4;};'use strict';var BPromise=require(_0xedd8('0x0'));var moment=require('moment');var _=require(_0xedd8('0x1'));var util=require(_0xedd8('0x2'));var jayson=require(_0xedd8('0x3'));var client=jayson[_0xedd8('0x4')][_0xedd8('0x5')]({'port':0x2329});function request(_0x40d9c5,_0x367f69){return new BPromise(function(_0x2213cd,_0x2a73c7){return client[_0xedd8('0x6')](_0x40d9c5,_0x367f69)[_0xedd8('0x7')](function(_0x3d28bc){if(_0x3d28bc[_0xedd8('0x8')]){return _0x2a73c7(_0x3d28bc[_0xedd8('0x8')]['message']);}else{return _0x2213cd(_0x3d28bc[_0xedd8('0x9')]);}})[_0xedd8('0xa')](function(_0x32f2ee){return _0x2a73c7(_0x32f2ee);});});}exports['getSquareProject']=function(_0x20fc89){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x20fc89},'attributes':['production']}});};exports[_0xedd8('0xb')]=function(_0x2b7270){return request(_0xedd8('0xc'),{'options':{'raw':![],'where':{'id':_0x2b7270},'include':[{'model':_0xedd8('0xd'),'as':_0xedd8('0xe')}],'attributes':['id',_0xedd8('0xf'),'email']}});};exports[_0xedd8('0x10')]=function(_0x3fa070){return request('ShowSquareProject',{'options':{'where':{'id':_0x3fa070},'attributes':[_0xedd8('0xf')]}});};exports[_0xedd8('0x11')]=function(_0x2d9728){return request(_0xedd8('0x12'),{'options':{'where':{'id':_0x2d9728},'attributes':['name']}});};exports[_0xedd8('0x13')]=function(_0x3238e2){return request(_0xedd8('0x14'),{'options':{'where':{'id':_0x3238e2},'attributes':['name']}});};exports[_0xedd8('0x15')]=function(_0x26c9d9){return request(_0xedd8('0x16'),{'options':{'where':{'id':_0x26c9d9},'attributes':[_0xedd8('0x17')]}});};exports[_0xedd8('0x18')]=function(_0x6692db){return request('ShowUser',{'options':{'where':{'id':_0x6692db},'attributes':[_0xedd8('0xf')]}});};exports[_0xedd8('0x19')]=function(_0x4211d0){return request(_0xedd8('0x1a'),{'options':{'where':{'id':_0x4211d0},'attributes':[_0xedd8('0xf')]}});};exports[_0xedd8('0x1b')]=function(_0x2a4c94){return request('ShowSound',{'options':{'where':{'id':_0x2a4c94},'attributes':[_0xedd8('0x1c')]}});};exports[_0xedd8('0x1d')]=function(_0x3625ac){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x3625ac},'include':[{'model':_0xedd8('0x1e'),'as':_0xedd8('0x1f')}]}});};exports[_0xedd8('0x20')]=function(_0x2e97fa){return request(_0xedd8('0x21'),{'options':{'where':{'id':_0x2e97fa},'attributes':['id',_0xedd8('0xf')]}});};exports['createSmsMessage']=function(_0x110ab7){return request(_0xedd8('0x22'),{'body':_0x110ab7});};exports[_0xedd8('0x23')]=function(_0x593ecc){return request(_0xedd8('0x24'),{'body':_0x593ecc});};exports['createSquareReport']=function(_0x1542a){return request(_0xedd8('0x25'),{'body':_[_0xedd8('0x26')](_0x1542a,{'project_name':_0x1542a[_0xedd8('0x27')],'prev_project_name':_0x1542a[_0xedd8('0x28')]||'','is_subproject':_0x1542a['arg_2']?!![]:![],'leaveAt':moment()[_0xedd8('0x29')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xedd8('0x2a')]=function(_0x4d316a){return request(_0xedd8('0x2b'),{'body':_0x4d316a});};exports[_0xedd8('0x2c')]=function(_0xebeb34){return request(_0xedd8('0x2d'),{'body':_0xebeb34});};exports[_0xedd8('0x2e')]=function(_0x49c405){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x49c405[_0xedd8('0x2f')],'ListId':_0x49c405['ListId']}}})['then'](function(_0x57263a){if(_0x57263a){return _0x57263a;}return request(_0xedd8('0x30'),{'body':_0x49c405});});};exports[_0xedd8('0x31')]=function(_0xa38bb5){return request(_0xedd8('0x32'),{'options':{'where':{'id':_0xa38bb5},'attributes':[_0xedd8('0xf')]}});};exports[_0xedd8('0x33')]=function(_0x34d589,_0x15e06d){return request(_0xedd8('0x34'),{'body':{'interface':_0x15e06d},'options':{'where':_0x34d589}});};exports[_0xedd8('0x35')]=function(_0x4c33dd,_0x3d3304,_0x48a7db){return request(_0xedd8('0x36'),{'body':{'type':_0x3d3304,'uniqueid':_0x48a7db},'options':{'where':_0x4c33dd}});};exports['agentUnpause']=function(_0x4d2f9d){return request(_0xedd8('0x37'),{'body':{},'options':{'where':_0x4d2f9d}});};exports[_0xedd8('0x38')]=function(_0x5603bb){return request(_0xedd8('0x39'),{'body':{},'options':{'where':_0x5603bb}});}; \ No newline at end of file +var _0x7e22=['getIntervalById','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','createCmContact','ListId','CreateCmContact','getPauseById','ShowPause','agentPause','PauseUser','agentUnpause','UnpauseUser','bluebird','lodash','util','jayson/promise','client','http','request','then','error','message','result','catch','getSquareProject','ShowSquareProject','production','ShowMailAccount','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','ShowTrunk','ShowSound','save_name'];(function(_0x6a6d38,_0x2cd6bc){var _0x3412b8=function(_0x31bfb5){while(--_0x31bfb5){_0x6a6d38['push'](_0x6a6d38['shift']());}};_0x3412b8(++_0x2cd6bc);}(_0x7e22,0x1d8));var _0x27e2=function(_0x483fb6,_0x4f1ecd){_0x483fb6=_0x483fb6-0x0;var _0x60f97a=_0x7e22[_0x483fb6];return _0x60f97a;};'use strict';var BPromise=require(_0x27e2('0x0'));var moment=require('moment');var _=require(_0x27e2('0x1'));var util=require(_0x27e2('0x2'));var jayson=require(_0x27e2('0x3'));var client=jayson[_0x27e2('0x4')][_0x27e2('0x5')]({'port':0x2329});function request(_0x36ce04,_0x5e5b08){return new BPromise(function(_0x43868c,_0x4b2588){return client[_0x27e2('0x6')](_0x36ce04,_0x5e5b08)[_0x27e2('0x7')](function(_0x3eb3cd){if(_0x3eb3cd[_0x27e2('0x8')]){return _0x4b2588(_0x3eb3cd['error'][_0x27e2('0x9')]);}else{return _0x43868c(_0x3eb3cd[_0x27e2('0xa')]);}})[_0x27e2('0xb')](function(_0x49591c){return _0x4b2588(_0x49591c);});});}exports[_0x27e2('0xc')]=function(_0xadcc3e){return request(_0x27e2('0xd'),{'options':{'raw':![],'where':{'name':_0xadcc3e},'attributes':[_0x27e2('0xe')]}});};exports['getMailAccountById']=function(_0x3303bb){return request(_0x27e2('0xf'),{'options':{'raw':![],'where':{'id':_0x3303bb},'include':[{'model':'MailServerOut','as':_0x27e2('0x10')}],'attributes':['id',_0x27e2('0x11'),_0x27e2('0x12')]}});};exports[_0x27e2('0x13')]=function(_0x5f5603){return request(_0x27e2('0xd'),{'options':{'where':{'id':_0x5f5603},'attributes':['name']}});};exports[_0x27e2('0x14')]=function(_0x396d33){return request(_0x27e2('0x15'),{'options':{'where':{'id':_0x396d33},'attributes':[_0x27e2('0x11')]}});};exports[_0x27e2('0x16')]=function(_0x563b96){return request(_0x27e2('0x17'),{'options':{'where':{'id':_0x563b96},'attributes':['name']}});};exports[_0x27e2('0x18')]=function(_0x5c625){return request(_0x27e2('0x19'),{'options':{'where':{'id':_0x5c625},'attributes':[_0x27e2('0x1a')]}});};exports[_0x27e2('0x1b')]=function(_0x20ed2c){return request(_0x27e2('0x1c'),{'options':{'where':{'id':_0x20ed2c},'attributes':[_0x27e2('0x11')]}});};exports['getTrunkById']=function(_0x59d968){return request(_0x27e2('0x1d'),{'options':{'where':{'id':_0x59d968},'attributes':[_0x27e2('0x11')]}});};exports['getSoundById']=function(_0x88d0a3){return request(_0x27e2('0x1e'),{'options':{'where':{'id':_0x88d0a3},'attributes':[_0x27e2('0x1f')]}});};exports[_0x27e2('0x20')]=function(_0x127d7e){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x127d7e},'include':[{'model':_0x27e2('0x21'),'as':_0x27e2('0x22')}]}});};exports[_0x27e2('0x23')]=function(_0x4c3e17){return request(_0x27e2('0x24'),{'options':{'where':{'id':_0x4c3e17},'attributes':['id',_0x27e2('0x11')]}});};exports['createSmsMessage']=function(_0x4d9e52){return request(_0x27e2('0x25'),{'body':_0x4d9e52});};exports[_0x27e2('0x26')]=function(_0x2e9b70){return request(_0x27e2('0x27'),{'body':_0x2e9b70});};exports[_0x27e2('0x28')]=function(_0xfa78e4){return request(_0x27e2('0x29'),{'body':_['merge'](_0xfa78e4,{'project_name':_0xfa78e4['arg_1'],'prev_project_name':_0xfa78e4[_0x27e2('0x2a')]||'','is_subproject':_0xfa78e4[_0x27e2('0x2a')]?!![]:![],'leaveAt':moment()[_0x27e2('0x2b')](_0x27e2('0x2c'))})});};exports[_0x27e2('0x2d')]=function(_0x20cf21){return request('CreateSquareRecording',{'body':_0x20cf21});};exports[_0x27e2('0x2e')]=function(_0x30b0a9){return request('CreateSquareMessage',{'body':_0x30b0a9});};exports[_0x27e2('0x2f')]=function(_0x361ba5){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x361ba5['phone'],'ListId':_0x361ba5[_0x27e2('0x30')]}}})[_0x27e2('0x7')](function(_0x3ede2e){if(_0x3ede2e){return _0x3ede2e;}return request(_0x27e2('0x31'),{'body':_0x361ba5});});};exports[_0x27e2('0x32')]=function(_0x2fe650){return request(_0x27e2('0x33'),{'options':{'where':{'id':_0x2fe650},'attributes':[_0x27e2('0x11')]}});};exports['agentLogin']=function(_0x5000f4,_0x2a2da3){return request('LoginUser',{'body':{'interface':_0x2a2da3},'options':{'where':_0x5000f4}});};exports[_0x27e2('0x34')]=function(_0x4e49bb,_0x16412d,_0x11c310){return request(_0x27e2('0x35'),{'body':{'type':_0x16412d,'uniqueid':_0x11c310},'options':{'where':_0x4e49bb}});};exports[_0x27e2('0x36')]=function(_0x14203d){return request(_0x27e2('0x37'),{'body':{},'options':{'where':_0x14203d}});};exports['agentLogout']=function(_0x1eb259){return request('LogoutUser',{'body':{},'options':{'where':_0x1eb259}});}; \ 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 b2afc85..eec9b3d 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 _0x2d35=['exports','./lex'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2d35,0x1cf));var _0x52d3=function(_0x4325e2,_0x5a42ea){_0x4325e2=_0x4325e2-0x0;var _0x56601c=_0x2d35[_0x4325e2];return _0x56601c;};var polly=require('./polly');var lex=require(_0x52d3('0x0'));module[_0x52d3('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xf16f=['./polly','./lex'];(function(_0x3e6478,_0x58d025){var _0x3f821a=function(_0x3daeae){while(--_0x3daeae){_0x3e6478['push'](_0x3e6478['shift']());}};_0x3f821a(++_0x58d025);}(_0xf16f,0x10c));var _0xff16=function(_0x463676,_0x53c379){_0x463676=_0x463676-0x0;var _0x25fb05=_0xf16f[_0x463676];return _0x25fb05;};var polly=require(_0xff16('0x0'));var lex=require(_0xff16('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index a0bf508..4fc8667 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 _0x9d02=['./lib/api'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x9d02,0x118));var _0x29d0=function(_0x9b56de,_0x5a93d4){_0x9b56de=_0x9b56de-0x0;var _0x1df08e=_0x9d02[_0x9b56de];return _0x1df08e;};'use strict';var lex=require(_0x29d0('0x0'));module['exports']=function(_0x38b711,_0x55c4d1,_0x4519be,_0x48ea60,_0x10d9e4,_0x13171d){return lex(_0x38b711,_0x55c4d1,_0x4519be,_0x48ea60,_0x10d9e4,_0x13171d);}; \ No newline at end of file +var _0x180f=['exports','./lib/api'];(function(_0x480bd6,_0x42a764){var _0x49055c=function(_0x5ae8f2){while(--_0x5ae8f2){_0x480bd6['push'](_0x480bd6['shift']());}};_0x49055c(++_0x42a764);}(_0x180f,0xf3));var _0xf180=function(_0x34f701,_0x37e407){_0x34f701=_0x34f701-0x0;var _0x3e2429=_0x180f[_0x34f701];return _0x3e2429;};'use strict';var lex=require(_0xf180('0x0'));module[_0xf180('0x1')]=function(_0x49bb6e,_0x43cae2,_0x3cc668,_0x5ca18d,_0x1bd2a7,_0x12cfa8){return lex(_0x49bb6e,_0x43cae2,_0x3cc668,_0x5ca18d,_0x1bd2a7,_0x12cfa8);}; \ 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 3eea54a..09e8223 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 _0xd77c=['postText','slots','hasOwnProperty','slot_','exports','LexRuntime','bluebird','aws-sdk'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xd77c,0xc6));var _0xcd77=function(_0x248fc4,_0x58f3ea){_0x248fc4=_0x248fc4-0x0;var _0x4edced=_0xd77c[_0x248fc4];return _0x4edced;};'use strict';var BPromise=require(_0xcd77('0x0'));var AWS=require(_0xcd77('0x1'));function lexResult(_0x318cca,_0x23fd2d){return new BPromise(function(_0x156980,_0x3af57f){_0x318cca[_0xcd77('0x2')](_0x23fd2d,function(_0x47039a,_0x5c4eed){if(_0x47039a){_0x3af57f(_0x47039a);}if(_0x5c4eed[_0xcd77('0x3')]){for(const _0x22dc0d in _0x5c4eed[_0xcd77('0x3')]){if(_0x5c4eed[_0xcd77('0x3')][_0xcd77('0x4')](_0x22dc0d)){var _0x4ef807=_0x5c4eed[_0xcd77('0x3')][_0x22dc0d];_0x5c4eed[_0xcd77('0x5')+_0x22dc0d]=_0x4ef807;}}}_0x156980(_0x5c4eed);});});}module[_0xcd77('0x6')]=function(_0x426f75,_0x16a52f,_0x2eaa90,_0x5e52fc,_0x990eb6,_0x50124d){var _0x583092=new AWS[(_0xcd77('0x7'))]({'accessKeyId':_0x16a52f,'secretAccessKey':_0x2eaa90,'region':_0x5e52fc});var _0x13ca16={'botAlias':'$LATEST','botName':_0x50124d,'inputText':_0x990eb6,'userId':_0x426f75};return lexResult(_0x583092,_0x13ca16);}; \ No newline at end of file +var _0x32e2=['postText','slots','slot_','exports','LexRuntime','$LATEST','aws-sdk'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x32e2,0x141));var _0x232e=function(_0x171fdc,_0x16ae91){_0x171fdc=_0x171fdc-0x0;var _0x3782ea=_0x32e2[_0x171fdc];return _0x3782ea;};'use strict';var BPromise=require('bluebird');var AWS=require(_0x232e('0x0'));function lexResult(_0x389b19,_0x34a0c6){return new BPromise(function(_0x47a2cf,_0x1b1faa){_0x389b19[_0x232e('0x1')](_0x34a0c6,function(_0x3cbd01,_0x504091){if(_0x3cbd01){_0x1b1faa(_0x3cbd01);}if(_0x504091[_0x232e('0x2')]){for(const _0x35776f in _0x504091[_0x232e('0x2')]){if(_0x504091[_0x232e('0x2')]['hasOwnProperty'](_0x35776f)){var _0x2a0ff5=_0x504091[_0x232e('0x2')][_0x35776f];_0x504091[_0x232e('0x3')+_0x35776f]=_0x2a0ff5;}}}_0x47a2cf(_0x504091);});});}module[_0x232e('0x4')]=function(_0x55e3ee,_0x4c4f04,_0x5f0eaf,_0x37624d,_0x51726c,_0x26092d){var _0x4ff76d=new AWS[(_0x232e('0x5'))]({'accessKeyId':_0x4c4f04,'secretAccessKey':_0x5f0eaf,'region':_0x37624d});var _0x435baa={'botAlias':_0x232e('0x6'),'botName':_0x26092d,'inputText':_0x51726c,'userId':_0x55e3ee};return lexResult(_0x4ff76d,_0x435baa);}; \ 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 84ebf61..59cdc28 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 _0x0a79=['exports','./lib/api'];(function(_0x29a39d,_0x4c9e6c){var _0x561210=function(_0x55f6ba){while(--_0x55f6ba){_0x29a39d['push'](_0x29a39d['shift']());}};_0x561210(++_0x4c9e6c);}(_0x0a79,0x159));var _0x90a7=function(_0x5e74ea,_0xb77b7a){_0x5e74ea=_0x5e74ea-0x0;var _0x5e5a34=_0x0a79[_0x5e74ea];return _0x5e5a34;};'use strict';var polly=require(_0x90a7('0x0'));module[_0x90a7('0x1')]=function(_0x2b711d,_0x4b67a8,_0x47ecff,_0x6a3977,_0x43f243,_0x14ea1d,_0x724877){return polly(_0x2b711d,_0x4b67a8,_0x47ecff,_0x6a3977,_0x43f243,_0x14ea1d,_0x724877);}; \ No newline at end of file +var _0xf7fb=['exports','./lib/api'];(function(_0x19ec80,_0x17b069){var _0x1883a2=function(_0x5c3888){while(--_0x5c3888){_0x19ec80['push'](_0x19ec80['shift']());}};_0x1883a2(++_0x17b069);}(_0xf7fb,0x65));var _0xbf7f=function(_0x15b0f3,_0x3024f2){_0x15b0f3=_0x15b0f3-0x0;var _0x7b7700=_0xf7fb[_0x15b0f3];return _0x7b7700;};'use strict';var polly=require(_0xbf7f('0x0'));module[_0xbf7f('0x1')]=function(_0x40a6da,_0x1a7ffb,_0x206b2a,_0x53523e,_0x7d7670,_0xb4d15b,_0x450104){return polly(_0x40a6da,_0x1a7ffb,_0x206b2a,_0x53523e,_0x7d7670,_0xb4d15b,_0x450104);}; \ 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 44f5042..7c8a8e5 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 _0xdacb=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','mp3','path','randomstring','synthesizeSpeech','AudioStream','writeFile'];(function(_0x1370a9,_0x2fc150){var _0x5698a1=function(_0x2e5fa6){while(--_0x2e5fa6){_0x1370a9['push'](_0x1370a9['shift']());}};_0x5698a1(++_0x2fc150);}(_0xdacb,0x124));var _0xbdac=function(_0x6af47,_0x22c4fd){_0x6af47=_0x6af47-0x0;var _0x2c9f99=_0xdacb[_0x6af47];return _0x2c9f99;};'use strict';var fs=require('fs');var path=require(_0xbdac('0x0'));var BPromise=require('bluebird');var rs=require(_0xbdac('0x1'));var AWS=require('aws-sdk');function pollyResult(_0x363999,_0x565c55,_0x2d0d23){return new BPromise(function(_0x3701b5,_0x32f134){_0x363999[_0xbdac('0x2')](_0x565c55,function(_0x3da85c,_0x3995a3){if(_0x3da85c){_0x32f134(_0x3da85c);}else if(_0x3995a3){if(_0x3995a3[_0xbdac('0x3')]instanceof Buffer){fs[_0xbdac('0x4')](_0x2d0d23,_0x3995a3[_0xbdac('0x3')],function(_0x1e0051){if(_0x1e0051){_0x32f134(_0x1e0051);}else{_0x3701b5();}});}else{_0x32f134(new Error(_0xbdac('0x5')));}}else{_0x32f134(new Error(_0xbdac('0x6')));}});});}module['exports']=function(_0x4416ab,_0xa648a1,_0xfd26ba,_0xdec681,_0x4826eb,_0x4295dd,_0x56ec54){var _0x8cd8c2=new AWS[(_0xbdac('0x7'))]({'accessKeyId':_0x4416ab,'secretAccessKey':_0xa648a1,'region':_0xfd26ba});var _0x5d83be={'Text':_0x4826eb,'TextType':_0x4295dd||'text','OutputFormat':_0xbdac('0x8'),'VoiceId':_0xdec681};return pollyResult(_0x8cd8c2,_0x5d83be,_0x56ec54);}; \ No newline at end of file +var _0xa939=['writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','mp3','path','randomstring','aws-sdk'];(function(_0x241c64,_0x2e5474){var _0x2fd401=function(_0x53da3e){while(--_0x53da3e){_0x241c64['push'](_0x241c64['shift']());}};_0x2fd401(++_0x2e5474);}(_0xa939,0x1bd));var _0x9a93=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa939[_0xf0bcac];return _0x4e4c65;};'use strict';var fs=require('fs');var path=require(_0x9a93('0x0'));var BPromise=require('bluebird');var rs=require(_0x9a93('0x1'));var AWS=require(_0x9a93('0x2'));function pollyResult(_0x3fe895,_0x3dd516,_0x13a379){return new BPromise(function(_0x146f98,_0x28b35f){_0x3fe895['synthesizeSpeech'](_0x3dd516,function(_0xaf31f6,_0x1fbedc){if(_0xaf31f6){_0x28b35f(_0xaf31f6);}else if(_0x1fbedc){if(_0x1fbedc['AudioStream']instanceof Buffer){fs[_0x9a93('0x3')](_0x13a379,_0x1fbedc['AudioStream'],function(_0x3aab49){if(_0x3aab49){_0x28b35f(_0x3aab49);}else{_0x146f98();}});}else{_0x28b35f(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x28b35f(new Error(_0x9a93('0x4')));}});});}module['exports']=function(_0x103233,_0x15a778,_0xa4c94c,_0x711d36,_0x4fd34a,_0x4c5c0e,_0x38380a){var _0x17daaa=new AWS[(_0x9a93('0x5'))]({'accessKeyId':_0x103233,'secretAccessKey':_0x15a778,'region':_0xa4c94c});var _0x2e8942={'Text':_0x4fd34a,'TextType':_0x4c5c0e||'text','OutputFormat':_0x9a93('0x6'),'VoiceId':_0x711d36};return pollyResult(_0x17daaa,_0x2e8942,_0x38380a);}; \ 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 4dd368f..057f21e 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 _0xd6dc=['./lib/api'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xd6dc,0x1d7));var _0xcd6d=function(_0x2667f1,_0x4698ce){_0x2667f1=_0x2667f1-0x0;var _0x2b8873=_0xd6dc[_0x2667f1];return _0x2b8873;};'use strict';var asr=require(_0xcd6d('0x0'));module['exports']=function(_0x46e081,_0x82e762,_0x9cf8b9,_0x21cd27){return asr(_0x46e081,_0x82e762,_0x9cf8b9);}; \ No newline at end of file +var _0x7c59=['exports'];(function(_0x1c0c7c,_0x2ede87){var _0x1eeae0=function(_0x6d671b){while(--_0x6d671b){_0x1c0c7c['push'](_0x1c0c7c['shift']());}};_0x1eeae0(++_0x2ede87);}(_0x7c59,0x147));var _0x97c5=function(_0x558487,_0x45341e){_0x558487=_0x558487-0x0;var _0x8f0cf5=_0x7c59[_0x558487];return _0x8f0cf5;};'use strict';var asr=require('./lib/api');module[_0x97c5('0x0')]=function(_0x1f363c,_0x93f019,_0x35025b,_0x5b31f4){return asr(_0x1f363c,_0x93f019,_0x35025b);}; \ 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 e5d2a12..65723c1 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 _0x81a6=['url','bluebird','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','8000'];(function(_0x2ee4f5,_0x5b790e){var _0x276d6b=function(_0x1516c8){while(--_0x1516c8){_0x2ee4f5['push'](_0x2ee4f5['shift']());}};_0x276d6b(++_0x5b790e);}(_0x81a6,0x152));var _0x681a=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x81a6[_0xdc37a1];return _0x99b4fe;};'use strict';var url=require(_0x681a('0x0'));var BPromise=require(_0x681a('0x1'));var fs=require('fs');var host=_0x681a('0x2');module[_0x681a('0x3')]=function(_0x25b40a,_0x549bf3,_0x242b22){return new BPromise(function(_0x411f2c,_0x473e81){var _0x2f1405;if(typeof _0x25b40a!=='string'||_0x25b40a[_0x681a('0x4')]===0x0){return _0x473e81(_0x681a('0x5'));}if(typeof _0x549bf3!==_0x681a('0x6')||_0x549bf3[_0x681a('0x4')]===0x0){return _0x473e81(_0x681a('0x7'));}if(typeof _0x242b22!==_0x681a('0x8')&&(typeof _0x242b22!==_0x681a('0x6')||_0x242b22['length']===0x0)){return _0x473e81(_0x681a('0x9'));}try{_0x2f1405=fs[_0x681a('0xa')](_0x25b40a)[_0x681a('0xb')]('base64');}catch(_0x82eef6){return _0x473e81(_0x82eef6);}return _0x411f2c({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0x549bf3,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x681a('0xc'),'languageCode':_0x242b22},'audio':{'content':_0x2f1405}},'json':!![]});});}; \ No newline at end of file +var _0x5f91=['undefined','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string'];(function(_0x131e82,_0x585d15){var _0x448867=function(_0xfb5f32){while(--_0xfb5f32){_0x131e82['push'](_0x131e82['shift']());}};_0x448867(++_0x585d15);}(_0x5f91,0x188));var _0x15f9=function(_0x3ff109,_0x2102dd){_0x3ff109=_0x3ff109-0x0;var _0x14b72f=_0x5f91[_0x3ff109];return _0x14b72f;};'use strict';var url=require(_0x15f9('0x0'));var BPromise=require(_0x15f9('0x1'));var fs=require('fs');var host=_0x15f9('0x2');module[_0x15f9('0x3')]=function(_0x16e841,_0x145c56,_0x50f845){return new BPromise(function(_0x37a016,_0x419a89){var _0x3b6ac1;if(typeof _0x16e841!==_0x15f9('0x4')||_0x16e841[_0x15f9('0x5')]===0x0){return _0x419a89(_0x15f9('0x6'));}if(typeof _0x145c56!=='string'||_0x145c56[_0x15f9('0x5')]===0x0){return _0x419a89(_0x15f9('0x7'));}if(typeof _0x50f845!==_0x15f9('0x8')&&(typeof _0x50f845!==_0x15f9('0x4')||_0x50f845['length']===0x0)){return _0x419a89(_0x15f9('0x9'));}try{_0x3b6ac1=fs[_0x15f9('0xa')](_0x16e841)['toString'](_0x15f9('0xb'));}catch(_0x3db7bb){return _0x419a89(_0x3db7bb);}return _0x37a016({'method':_0x15f9('0xc'),'uri':host+_0x15f9('0xd')+_0x145c56,'body':{'config':{'encoding':_0x15f9('0xe'),'sampleRateHertz':_0x15f9('0xf'),'languageCode':_0x50f845},'audio':{'content':_0x3b6ac1}},'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 a993df9..6f5887b 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 _0x34e8=['./asr','exports'];(function(_0x43f552,_0x42808c){var _0x17911b=function(_0x4407a7){while(--_0x4407a7){_0x43f552['push'](_0x43f552['shift']());}};_0x17911b(++_0x42808c);}(_0x34e8,0x12c));var _0x834e=function(_0x1c7027,_0x3d0827){_0x1c7027=_0x1c7027-0x0;var _0x59d690=_0x34e8[_0x1c7027];return _0x59d690;};var asr=require(_0x834e('0x0'));module[_0x834e('0x1')]={'asr':asr}; \ No newline at end of file +var _0x34e8=['./asr','exports'];(function(_0xa90718,_0x2fd952){var _0x56ed79=function(_0x41cff1){while(--_0x41cff1){_0xa90718['push'](_0xa90718['shift']());}};_0x56ed79(++_0x2fd952);}(_0x34e8,0x12c));var _0x834e=function(_0xd35254,_0x5debf1){_0xd35254=_0xd35254-0x0;var _0x270b09=_0x34e8[_0xd35254];return _0x270b09;};var asr=require(_0x834e('0x0'));module[_0x834e('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 cc79684..fb15a8c 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 _0xa2b8=['googleTTS','info','resolve','tmp','then','generate','chmodSync','777','split','googleASR','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','textRequest','stringify','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','isFallbackIntent','tildeASR','asr','Tilde\x20ASR\x20confidence','awsPolly','.mp3','polly','.wav','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','freeform=3','parse','sestekNDA','nda','channelData','CustomActionData','dirName','path','url','bluebird','randomstring','sox','request-promise','util','moment','google-tts-api','apiai-promise','md5','./google','./aws','./tilde','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','close','unlink','download\x20error','end','https:','get','statusMessage','data','transcode','error\x20convert','finish\x20to\x20convert','start','toString','base64'];(function(_0x5e9319,_0x16430b){var _0x599b54=function(_0x16c371){while(--_0x16c371){_0x5e9319['push'](_0x5e9319['shift']());}};_0x599b54(++_0x16430b);}(_0xa2b8,0x14d));var _0x8a2b=function(_0xcdc5b7,_0x3f36ca){_0xcdc5b7=_0xcdc5b7-0x0;var _0x504e04=_0xa2b8[_0xcdc5b7];return _0x504e04;};'use strict';var fs=require('fs');var path=require(_0x8a2b('0x0'));var http=require('http');var https=require('https');var urlParse=require(_0x8a2b('0x1'))['parse'];var BPromise=require(_0x8a2b('0x2'));var rs=require(_0x8a2b('0x3'));var sox=require(_0x8a2b('0x4'));var rp=require(_0x8a2b('0x5'));var util=require(_0x8a2b('0x6'));var querystring=require('querystring');var moment=require(_0x8a2b('0x7'));var tts=require(_0x8a2b('0x8'));var apiai=require(_0x8a2b('0x9'));var md5=require(_0x8a2b('0xa'));var google=require(_0x8a2b('0xb'));var aws=require(_0x8a2b('0xc'));var tilde=require(_0x8a2b('0xd'));var sestek=require(_0x8a2b('0xe'));var logger=require(_0x8a2b('0xf'))(_0x8a2b('0x10'));var ISPEECH_API=_0x8a2b('0x11');function downloadFile(_0x2e0b94,_0x456640){return new BPromise(function(_0x3cef95,_0x2d6f79){var _0x3d91c4=urlParse(_0x2e0b94);var _0x4896a8=_0x3d91c4[_0x8a2b('0x12')]==='https:'?https:http;var _0xdf2f2e={'host':_0x3d91c4[_0x8a2b('0x13')],'path':_0x3d91c4[_0x8a2b('0x0')],'headers':{'user-agent':_0x8a2b('0x14')}};_0x4896a8['get'](_0xdf2f2e,function(_0x254e2a){if(_0x254e2a['statusCode']!==0xc8){logger[_0x8a2b('0x15')](_0x8a2b('0x16')+_0x2e0b94+'\x20failed,\x20status\x20code\x20=\x20'+_0x254e2a['statusCode']+'\x20('+_0x254e2a['statusMessage']+')');_0x2d6f79(new Error(_0x8a2b('0x16')+_0x2e0b94+_0x8a2b('0x17')+_0x254e2a[_0x8a2b('0x18')]+'\x20('+_0x254e2a['statusMessage']+')'));return;}var _0x36a59a=fs['createWriteStream'](_0x456640);_0x36a59a['on']('finish',function(){logger['info']('finish\x20download\x20file');_0x36a59a[_0x8a2b('0x19')](_0x3cef95);});_0x36a59a['on'](_0x8a2b('0x15'),function(_0x2b47d2){fs[_0x8a2b('0x1a')](_0x456640);logger[_0x8a2b('0x15')](_0x8a2b('0x1b'),_0x2b47d2);_0x2d6f79(_0x2b47d2);});_0x254e2a['pipe'](_0x36a59a);})['on']('error',function(_0x5ab9ae){logger['error'](_0x5ab9ae);_0x2d6f79(_0x5ab9ae);})[_0x8a2b('0x1c')]();});}function uploadFile(_0x490219){return new BPromise(function(_0x439707,_0x178cb6){var _0x5bdc24=urlParse(_0x490219);var _0x3f70d2=_0x5bdc24[_0x8a2b('0x12')]===_0x8a2b('0x1d')?https:http;var _0x304c86={'host':_0x5bdc24['host'],'path':_0x5bdc24[_0x8a2b('0x0')],'headers':{'user-agent':'WHAT_EVER'}};_0x3f70d2[_0x8a2b('0x1e')](_0x304c86,function(_0x2eeaab){if(_0x2eeaab[_0x8a2b('0x18')]!==0xc8){_0x178cb6(new Error(_0x8a2b('0x16')+_0x490219+_0x8a2b('0x17')+_0x2eeaab[_0x8a2b('0x18')]+'\x20('+_0x2eeaab[_0x8a2b('0x1f')]+')'));return;}var _0x49de29='';_0x2eeaab['on'](_0x8a2b('0x20'),function(_0x7eec19){_0x49de29+=_0x7eec19;});_0x2eeaab['on']('end',function(){_0x439707(_0x49de29);});})['on'](_0x8a2b('0x15'),function(_0x3e5335){_0x178cb6(_0x3e5335);})['end']();});}function convertFile(_0x5c6313,_0x68d1de){return new BPromise(function(_0x5a04fe,_0x3db78a){var _0x165d12=sox[_0x8a2b('0x21')](_0x5c6313,_0x68d1de,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x165d12['on'](_0x8a2b('0x15'),function(_0x4e001e){logger[_0x8a2b('0x15')](_0x8a2b('0x22'),_0x4e001e);_0x3db78a(_0x4e001e);});_0x165d12['on']('end',function(){logger['info'](_0x8a2b('0x23'));_0x5a04fe();});_0x165d12[_0x8a2b('0x24')]();});}function base64Encode(_0x55ad70){var _0x4eadd6=fs['readFileSync'](_0x55ad70);return new Buffer(_0x4eadd6)[_0x8a2b('0x25')](_0x8a2b('0x26'));}exports[_0x8a2b('0x27')]=function(_0x1b115f,_0x58ae04){var _0x131946,_0x5cda9f;return tts(_0x1b115f,_0x58ae04||'en',0x1)['then'](function(_0x21dc1a){logger[_0x8a2b('0x28')](_0x21dc1a);_0x131946=path[_0x8a2b('0x29')](__dirname,_0x8a2b('0x2a'),rs['generate'](0x4)+'.mp3');return downloadFile(_0x21dc1a,_0x131946);})[_0x8a2b('0x2b')](function(){_0x5cda9f=path[_0x8a2b('0x29')](__dirname,_0x8a2b('0x2a'),rs[_0x8a2b('0x2c')](0x4)+'.wav');return convertFile(_0x131946,_0x5cda9f);})[_0x8a2b('0x2b')](function(){try{fs[_0x8a2b('0x1a')](_0x131946);fs[_0x8a2b('0x2d')](_0x5cda9f,_0x8a2b('0x2e'));}catch(_0x97de9d){logger[_0x8a2b('0x15')](_0x97de9d);}logger['info']('goggleTTS\x20path',_0x5cda9f[_0x8a2b('0x2f')]('.')[0x0]);return _0x5cda9f[_0x8a2b('0x2f')]('.')[0x0];});};exports[_0x8a2b('0x30')]=function(_0x307cd7,_0x143a1d,_0x1306c9){return google['asr'](_0x307cd7,_0x143a1d,_0x1306c9)[_0x8a2b('0x2b')](function(_0x436b83){logger['info'](_0x436b83[_0x8a2b('0x31')]);return rp(_0x436b83);})[_0x8a2b('0x2b')](function(_0xb1bc4e){var _0x2730b7='';var _0x213d93=0x0;try{fs[_0x8a2b('0x1a')](_0x307cd7);}catch(_0x5413f6){logger[_0x8a2b('0x15')](_0x5413f6);}if(_0xb1bc4e&&_0xb1bc4e['results']){_0x2730b7=_0xb1bc4e[_0x8a2b('0x32')][_0x8a2b('0x33')](function(_0x241f7e){return _0x241f7e&&_0x241f7e[_0x8a2b('0x34')][0x0]&&_0x241f7e[_0x8a2b('0x34')][0x0][_0x8a2b('0x35')]?_0x241f7e[_0x8a2b('0x34')][0x0][_0x8a2b('0x35')]:'';})[_0x8a2b('0x36')]('\x0a');_0x213d93=_0xb1bc4e[_0x8a2b('0x32')][_0x8a2b('0x33')](function(_0x2470de){return _0x2470de&&_0x2470de[_0x8a2b('0x34')][0x0]&&_0x2470de[_0x8a2b('0x34')][0x0][_0x8a2b('0x37')]?_0x2470de[_0x8a2b('0x34')][0x0]['confidence']:0x0;})[_0x8a2b('0x36')]('\x0a');}logger[_0x8a2b('0x28')]('googleASR\x20transcription',_0x2730b7);logger[_0x8a2b('0x28')](_0x8a2b('0x38'),_0x213d93);return{'transcript':_0x2730b7,'confidence':_0x213d93};})[_0x8a2b('0x39')](function(_0x2bd211){logger['error'](_0x8a2b('0x3a'),_0x2bd211[_0x8a2b('0x18')],_0x2bd211[_0x8a2b('0x3b')],_0x2bd211[_0x8a2b('0x3c')]);});};exports['googleDialogflow']=function(_0x29f7db,_0x3f5656,_0x3d3986,_0x103c23){var _0x416f56=apiai(_0x3f5656,{'language':_0x103c23||'en'});return _0x416f56[_0x8a2b('0x3d')](_0x3d3986,{'sessionId':md5(_0x29f7db)})['then'](function(_0x27d61e){logger[_0x8a2b('0x28')](JSON[_0x8a2b('0x3e')](_0x27d61e));return{'source':_0x27d61e[_0x8a2b('0x3f')][_0x8a2b('0x40')],'resolvedQuery':_0x27d61e[_0x8a2b('0x3f')][_0x8a2b('0x41')],'action':_0x27d61e[_0x8a2b('0x3f')][_0x8a2b('0x42')],'actionIncomplete':_0x27d61e[_0x8a2b('0x3f')][_0x8a2b('0x43')],'speech':_0x27d61e[_0x8a2b('0x3f')][_0x8a2b('0x44')][_0x8a2b('0x45')],'score':_0x27d61e[_0x8a2b('0x3f')][_0x8a2b('0x46')],'statusCode':_0x27d61e[_0x8a2b('0x47')][_0x8a2b('0x48')],'endConversation':_0x27d61e[_0x8a2b('0x3f')][_0x8a2b('0x49')]['endConversation']||![],'isFallbackIntent':_0x27d61e[_0x8a2b('0x3f')][_0x8a2b('0x49')][_0x8a2b('0x4a')]};});};exports[_0x8a2b('0x4b')]=function(_0x9b708c,_0x4459cf,_0x1bb596,_0x1bb04b){return tilde[_0x8a2b('0x4c')](_0x9b708c,_0x4459cf,_0x1bb596,_0x1bb04b)[_0x8a2b('0x2b')](function(_0x20df81){try{fs[_0x8a2b('0x1a')](_0x9b708c);}catch(_0x3b8e1f){logger[_0x8a2b('0x15')](_0x3b8e1f);}logger[_0x8a2b('0x28')]('Tilde\x20ASR\x20transcription',_0x20df81[_0x8a2b('0x35')]);logger['info'](_0x8a2b('0x4d'),_0x20df81[_0x8a2b('0x37')]);return _0x20df81;});};exports[_0x8a2b('0x4e')]=function(_0x546ce3,_0x22b688,_0x2c9a32,_0x53e85a,_0x4f95fb,_0x230ef3){var _0xf44192=path['resolve'](__dirname,'tmp',rs[_0x8a2b('0x2c')](0x4)+_0x8a2b('0x4f'));var _0x4a3a72;return aws[_0x8a2b('0x50')](_0x546ce3,_0x22b688,_0x2c9a32,_0x53e85a,_0x4f95fb,_0x230ef3,_0xf44192)['then'](function(){_0x4a3a72=path[_0x8a2b('0x29')](__dirname,'tmp',rs['generate'](0x4)+_0x8a2b('0x51'));return convertFile(_0xf44192,_0x4a3a72);})[_0x8a2b('0x2b')](function(){try{fs['unlink'](_0xf44192);fs[_0x8a2b('0x2d')](_0x4a3a72,_0x8a2b('0x2e'));}catch(_0xc44e39){logger[_0x8a2b('0x15')](_0xc44e39);}return _0x4a3a72[_0x8a2b('0x2f')]('.')[0x0];});};exports[_0x8a2b('0x52')]=function(_0x5ca255,_0xf6296b,_0x1a9b68,_0x2e5596,_0x338088,_0x2d4441){return aws[_0x8a2b('0x53')](_0x5ca255,_0xf6296b,_0x1a9b68,_0x2e5596,_0x338088,_0x2d4441)[_0x8a2b('0x2b')](function(_0x1d9f44){logger[_0x8a2b('0x28')](JSON[_0x8a2b('0x3e')](_0x1d9f44));return _0x1d9f44;});};exports['ispeechTTS']=function(_0x40f6c4,_0x5a5f9f,_0x3d8054,_0x1844f1){var _0x5cc5b6=util[_0x8a2b('0x54')](_0x8a2b('0x55'),ISPEECH_API,_0x40f6c4,encodeURIComponent(_0x5a5f9f),_0x3d8054,_0x1844f1);var _0x15dfc8=path['resolve'](__dirname,'tmp',rs[_0x8a2b('0x2c')](0x4)+_0x8a2b('0x4f'));var _0x53fabf;return downloadFile(_0x5cc5b6,_0x15dfc8)[_0x8a2b('0x2b')](function(){_0x53fabf=path[_0x8a2b('0x29')](__dirname,_0x8a2b('0x2a'),rs[_0x8a2b('0x2c')](0x4)+_0x8a2b('0x51'));return convertFile(_0x15dfc8,_0x53fabf);})[_0x8a2b('0x2b')](function(){try{fs['unlink'](_0x15dfc8);fs[_0x8a2b('0x2d')](_0x53fabf,'777');}catch(_0x5f4c2b){logger['error'](_0x5f4c2b);}return _0x53fabf['split']('.')[0x0];});};exports['ispeechASR']=function(_0x47a845,_0x5bed14,_0x2c150a,_0x1cc495){var _0x174f14=util[_0x8a2b('0x54')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x5bed14,_0x2c150a,base64Encode(_0x47a845),_0x1cc495?util[_0x8a2b('0x54')]('model=%s',encodeURIComponent(_0x1cc495)):_0x8a2b('0x56'));return uploadFile(_0x174f14)[_0x8a2b('0x2b')](function(_0x10f3db){return querystring[_0x8a2b('0x57')](_0x10f3db);});};exports[_0x8a2b('0x58')]=function(_0x8a7308,_0x4d1f48){return sestek[_0x8a2b('0x59')](_0x8a7308,_0x4d1f48)[_0x8a2b('0x2b')](function(_0x10177a){logger[_0x8a2b('0x28')](JSON[_0x8a2b('0x3e')](_0x10177a));return{'speech':_0x10177a['text'],'action':_0x10177a[_0x8a2b('0x5a')]?_0x10177a[_0x8a2b('0x5a')]['CustomAction']:undefined,'actiondata':_0x10177a['channelData']?_0x10177a[_0x8a2b('0x5a')][_0x8a2b('0x5b')]:undefined};});};exports[_0x8a2b('0x5c')]=function(){return __dirname;}; \ No newline at end of file +var _0xe50b=['end','https:','get','data','transcode','wav','error\x20convert','start','readFileSync','toString','base64','googleTTS','then','resolve','tmp','.mp3','generate','.wav','unlink','chmodSync','777','split','googleASR','asr','results','map','transcript','alternatives','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','stringify','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','model=%s','freeform=3','parse','sestekNDA','channelData','CustomAction','CustomActionData','dirName','http','https','url','bluebird','randomstring','sox','request-promise','util','querystring','google-tts-api','apiai-promise','md5','./google','./aws','./tilde','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','path','WHAT_EVER','statusCode','error','finish','info','finish\x20download\x20file','close','download\x20error'];(function(_0x495c2d,_0x36768e){var _0x58bfcd=function(_0x346d22){while(--_0x346d22){_0x495c2d['push'](_0x495c2d['shift']());}};_0x58bfcd(++_0x36768e);}(_0xe50b,0x1c8));var _0xbe50=function(_0x42e0ab,_0x25e406){_0x42e0ab=_0x42e0ab-0x0;var _0x580cf2=_0xe50b[_0x42e0ab];return _0x580cf2;};'use strict';var fs=require('fs');var path=require('path');var http=require(_0xbe50('0x0'));var https=require(_0xbe50('0x1'));var urlParse=require(_0xbe50('0x2'))['parse'];var BPromise=require(_0xbe50('0x3'));var rs=require(_0xbe50('0x4'));var sox=require(_0xbe50('0x5'));var rp=require(_0xbe50('0x6'));var util=require(_0xbe50('0x7'));var querystring=require(_0xbe50('0x8'));var moment=require('moment');var tts=require(_0xbe50('0x9'));var apiai=require(_0xbe50('0xa'));var md5=require(_0xbe50('0xb'));var google=require(_0xbe50('0xc'));var aws=require(_0xbe50('0xd'));var tilde=require(_0xbe50('0xe'));var sestek=require(_0xbe50('0xf'));var logger=require(_0xbe50('0x10'))(_0xbe50('0x11'));var ISPEECH_API=_0xbe50('0x12');function downloadFile(_0x2d0370,_0x478451){return new BPromise(function(_0x52c9c5,_0x174806){var _0x367591=urlParse(_0x2d0370);var _0x242c6e=_0x367591[_0xbe50('0x13')]==='https:'?https:http;var _0x1e8dae={'host':_0x367591['host'],'path':_0x367591[_0xbe50('0x14')],'headers':{'user-agent':_0xbe50('0x15')}};_0x242c6e['get'](_0x1e8dae,function(_0xab5748){if(_0xab5748[_0xbe50('0x16')]!==0xc8){logger[_0xbe50('0x17')]('request\x20to\x20'+_0x2d0370+'\x20failed,\x20status\x20code\x20=\x20'+_0xab5748[_0xbe50('0x16')]+'\x20('+_0xab5748['statusMessage']+')');_0x174806(new Error('request\x20to\x20'+_0x2d0370+'\x20failed,\x20status\x20code\x20=\x20'+_0xab5748[_0xbe50('0x16')]+'\x20('+_0xab5748['statusMessage']+')'));return;}var _0x206985=fs['createWriteStream'](_0x478451);_0x206985['on'](_0xbe50('0x18'),function(){logger[_0xbe50('0x19')](_0xbe50('0x1a'));_0x206985[_0xbe50('0x1b')](_0x52c9c5);});_0x206985['on']('error',function(_0x1596ce){fs['unlink'](_0x478451);logger[_0xbe50('0x17')](_0xbe50('0x1c'),_0x1596ce);_0x174806(_0x1596ce);});_0xab5748['pipe'](_0x206985);})['on'](_0xbe50('0x17'),function(_0x966f45){logger['error'](_0x966f45);_0x174806(_0x966f45);})[_0xbe50('0x1d')]();});}function uploadFile(_0x3ca6db){return new BPromise(function(_0x42f26c,_0x55755c){var _0x27af32=urlParse(_0x3ca6db);var _0x3f134d=_0x27af32[_0xbe50('0x13')]===_0xbe50('0x1e')?https:http;var _0x544107={'host':_0x27af32['host'],'path':_0x27af32['path'],'headers':{'user-agent':_0xbe50('0x15')}};_0x3f134d[_0xbe50('0x1f')](_0x544107,function(_0x59d4c5){if(_0x59d4c5[_0xbe50('0x16')]!==0xc8){_0x55755c(new Error('request\x20to\x20'+_0x3ca6db+'\x20failed,\x20status\x20code\x20=\x20'+_0x59d4c5[_0xbe50('0x16')]+'\x20('+_0x59d4c5['statusMessage']+')'));return;}var _0x178549='';_0x59d4c5['on'](_0xbe50('0x20'),function(_0x5d8e2b){_0x178549+=_0x5d8e2b;});_0x59d4c5['on'](_0xbe50('0x1d'),function(){_0x42f26c(_0x178549);});})['on']('error',function(_0x118290){_0x55755c(_0x118290);})[_0xbe50('0x1d')]();});}function convertFile(_0xff19a7,_0x52f256){return new BPromise(function(_0x3a52f7,_0x469c83){var _0x1a11ff=sox[_0xbe50('0x21')](_0xff19a7,_0x52f256,{'sampleRate':0x1f40,'format':_0xbe50('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1a11ff['on'](_0xbe50('0x17'),function(_0x427945){logger[_0xbe50('0x17')](_0xbe50('0x23'),_0x427945);_0x469c83(_0x427945);});_0x1a11ff['on'](_0xbe50('0x1d'),function(){logger[_0xbe50('0x19')]('finish\x20to\x20convert');_0x3a52f7();});_0x1a11ff[_0xbe50('0x24')]();});}function base64Encode(_0x390fc6){var _0x3654b5=fs[_0xbe50('0x25')](_0x390fc6);return new Buffer(_0x3654b5)[_0xbe50('0x26')](_0xbe50('0x27'));}exports[_0xbe50('0x28')]=function(_0x23dc9b,_0x2bb99e){var _0x5eb0af,_0x3b1f2c;return tts(_0x23dc9b,_0x2bb99e||'en',0x1)[_0xbe50('0x29')](function(_0x3d439c){logger['info'](_0x3d439c);_0x5eb0af=path[_0xbe50('0x2a')](__dirname,_0xbe50('0x2b'),rs['generate'](0x4)+_0xbe50('0x2c'));return downloadFile(_0x3d439c,_0x5eb0af);})['then'](function(){_0x3b1f2c=path[_0xbe50('0x2a')](__dirname,_0xbe50('0x2b'),rs[_0xbe50('0x2d')](0x4)+_0xbe50('0x2e'));return convertFile(_0x5eb0af,_0x3b1f2c);})[_0xbe50('0x29')](function(){try{fs[_0xbe50('0x2f')](_0x5eb0af);fs[_0xbe50('0x30')](_0x3b1f2c,_0xbe50('0x31'));}catch(_0x4ee0fc){logger[_0xbe50('0x17')](_0x4ee0fc);}logger[_0xbe50('0x19')]('goggleTTS\x20path',_0x3b1f2c[_0xbe50('0x32')]('.')[0x0]);return _0x3b1f2c[_0xbe50('0x32')]('.')[0x0];});};exports[_0xbe50('0x33')]=function(_0x335207,_0x53aa3b,_0x242988){return google[_0xbe50('0x34')](_0x335207,_0x53aa3b,_0x242988)[_0xbe50('0x29')](function(_0x4ea641){logger['info'](_0x4ea641['uri']);return rp(_0x4ea641);})[_0xbe50('0x29')](function(_0x7c5919){var _0x520ae2='';var _0x41756d=0x0;try{fs[_0xbe50('0x2f')](_0x335207);}catch(_0x5a17fa){logger['error'](_0x5a17fa);}if(_0x7c5919&&_0x7c5919[_0xbe50('0x35')]){_0x520ae2=_0x7c5919['results'][_0xbe50('0x36')](function(_0x2cd079){return _0x2cd079&&_0x2cd079['alternatives'][0x0]&&_0x2cd079['alternatives'][0x0][_0xbe50('0x37')]?_0x2cd079[_0xbe50('0x38')][0x0][_0xbe50('0x37')]:'';})[_0xbe50('0x39')]('\x0a');_0x41756d=_0x7c5919[_0xbe50('0x35')][_0xbe50('0x36')](function(_0x4b3fde){return _0x4b3fde&&_0x4b3fde[_0xbe50('0x38')][0x0]&&_0x4b3fde[_0xbe50('0x38')][0x0][_0xbe50('0x3a')]?_0x4b3fde[_0xbe50('0x38')][0x0][_0xbe50('0x3a')]:0x0;})[_0xbe50('0x39')]('\x0a');}logger[_0xbe50('0x19')](_0xbe50('0x3b'),_0x520ae2);logger[_0xbe50('0x19')](_0xbe50('0x3c'),_0x41756d);return{'transcript':_0x520ae2,'confidence':_0x41756d};})[_0xbe50('0x3d')](function(_0x15c6f9){logger[_0xbe50('0x17')](_0xbe50('0x3e'),_0x15c6f9[_0xbe50('0x16')],_0x15c6f9['name'],_0x15c6f9[_0xbe50('0x3f')]);});};exports[_0xbe50('0x40')]=function(_0x253e0b,_0x1230df,_0x58b342,_0x2ee68e){var _0x4b5488=apiai(_0x1230df,{'language':_0x2ee68e||'en'});return _0x4b5488[_0xbe50('0x41')](_0x58b342,{'sessionId':md5(_0x253e0b)})[_0xbe50('0x29')](function(_0x89c13c){logger[_0xbe50('0x19')](JSON[_0xbe50('0x42')](_0x89c13c));return{'source':_0x89c13c[_0xbe50('0x43')]['source'],'resolvedQuery':_0x89c13c[_0xbe50('0x43')][_0xbe50('0x44')],'action':_0x89c13c[_0xbe50('0x43')][_0xbe50('0x45')],'actionIncomplete':_0x89c13c[_0xbe50('0x43')][_0xbe50('0x46')],'speech':_0x89c13c[_0xbe50('0x43')][_0xbe50('0x47')][_0xbe50('0x48')],'score':_0x89c13c[_0xbe50('0x43')][_0xbe50('0x49')],'statusCode':_0x89c13c[_0xbe50('0x4a')][_0xbe50('0x4b')],'endConversation':_0x89c13c[_0xbe50('0x43')][_0xbe50('0x4c')][_0xbe50('0x4d')]||![],'isFallbackIntent':_0x89c13c['result']['metadata'][_0xbe50('0x4e')]};});};exports[_0xbe50('0x4f')]=function(_0x26f4b3,_0x462443,_0x49d8da,_0x194754){return tilde[_0xbe50('0x34')](_0x26f4b3,_0x462443,_0x49d8da,_0x194754)[_0xbe50('0x29')](function(_0x371150){try{fs[_0xbe50('0x2f')](_0x26f4b3);}catch(_0x47b454){logger['error'](_0x47b454);}logger['info'](_0xbe50('0x50'),_0x371150[_0xbe50('0x37')]);logger[_0xbe50('0x19')](_0xbe50('0x51'),_0x371150[_0xbe50('0x3a')]);return _0x371150;});};exports[_0xbe50('0x52')]=function(_0x2e71df,_0x46ad7b,_0x9a465a,_0x5163f8,_0x10236a,_0x3b8606){var _0x1a8ecb=path[_0xbe50('0x2a')](__dirname,'tmp',rs[_0xbe50('0x2d')](0x4)+_0xbe50('0x2c'));var _0x3e8d49;return aws[_0xbe50('0x53')](_0x2e71df,_0x46ad7b,_0x9a465a,_0x5163f8,_0x10236a,_0x3b8606,_0x1a8ecb)[_0xbe50('0x29')](function(){_0x3e8d49=path[_0xbe50('0x2a')](__dirname,_0xbe50('0x2b'),rs[_0xbe50('0x2d')](0x4)+_0xbe50('0x2e'));return convertFile(_0x1a8ecb,_0x3e8d49);})[_0xbe50('0x29')](function(){try{fs['unlink'](_0x1a8ecb);fs[_0xbe50('0x30')](_0x3e8d49,_0xbe50('0x31'));}catch(_0x2a1845){logger['error'](_0x2a1845);}return _0x3e8d49[_0xbe50('0x32')]('.')[0x0];});};exports[_0xbe50('0x54')]=function(_0x4512a0,_0x4b03b1,_0x466f20,_0xc3a9b2,_0x354a54,_0x30373b){return aws[_0xbe50('0x55')](_0x4512a0,_0x4b03b1,_0x466f20,_0xc3a9b2,_0x354a54,_0x30373b)[_0xbe50('0x29')](function(_0x27b8d2){logger[_0xbe50('0x19')](JSON[_0xbe50('0x42')](_0x27b8d2));return _0x27b8d2;});};exports['ispeechTTS']=function(_0x4c9a3f,_0x4107cd,_0x1dcc07,_0xd083d2){var _0xba48ef=util['format'](_0xbe50('0x56'),ISPEECH_API,_0x4c9a3f,encodeURIComponent(_0x4107cd),_0x1dcc07,_0xd083d2);var _0x2d4665=path['resolve'](__dirname,_0xbe50('0x2b'),rs[_0xbe50('0x2d')](0x4)+_0xbe50('0x2c'));var _0x1e0f38;return downloadFile(_0xba48ef,_0x2d4665)[_0xbe50('0x29')](function(){_0x1e0f38=path['resolve'](__dirname,_0xbe50('0x2b'),rs[_0xbe50('0x2d')](0x4)+_0xbe50('0x2e'));return convertFile(_0x2d4665,_0x1e0f38);})['then'](function(){try{fs[_0xbe50('0x2f')](_0x2d4665);fs[_0xbe50('0x30')](_0x1e0f38,'777');}catch(_0x24cbe8){logger['error'](_0x24cbe8);}return _0x1e0f38[_0xbe50('0x32')]('.')[0x0];});};exports[_0xbe50('0x57')]=function(_0x3ab46e,_0x9e3a8,_0x5348f7,_0x652a33){var _0x352d48=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x9e3a8,_0x5348f7,base64Encode(_0x3ab46e),_0x652a33?util[_0xbe50('0x58')](_0xbe50('0x59'),encodeURIComponent(_0x652a33)):_0xbe50('0x5a'));return uploadFile(_0x352d48)[_0xbe50('0x29')](function(_0x1ed36e){return querystring[_0xbe50('0x5b')](_0x1ed36e);});};exports[_0xbe50('0x5c')]=function(_0x25b866,_0x48b2dc){return sestek['nda'](_0x25b866,_0x48b2dc)['then'](function(_0x482a07){logger[_0xbe50('0x19')](JSON['stringify'](_0x482a07));return{'speech':_0x482a07['text'],'action':_0x482a07[_0xbe50('0x5d')]?_0x482a07[_0xbe50('0x5d')][_0xbe50('0x5e')]:undefined,'actiondata':_0x482a07['channelData']?_0x482a07[_0xbe50('0x5d')][_0xbe50('0x5f')]:undefined};});};exports[_0xbe50('0x60')]=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 815b8e6..04dc1f1 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 _0x47dc=['./nda','exports'];(function(_0x5f2295,_0x29fbf5){var _0x1c94d5=function(_0x4171bb){while(--_0x4171bb){_0x5f2295['push'](_0x5f2295['shift']());}};_0x1c94d5(++_0x29fbf5);}(_0x47dc,0x9c));var _0xc47d=function(_0x5752d1,_0x2d3b31){_0x5752d1=_0x5752d1-0x0;var _0xe28801=_0x47dc[_0x5752d1];return _0xe28801;};var nda=require(_0xc47d('0x0'));module[_0xc47d('0x1')]={'nda':nda}; \ No newline at end of file +var _0x272e=['exports','./nda'];(function(_0x1c57a5,_0x433064){var _0x3dadb9=function(_0x5cf957){while(--_0x5cf957){_0x1c57a5['push'](_0x1c57a5['shift']());}};_0x3dadb9(++_0x433064);}(_0x272e,0xfb));var _0xe272=function(_0x1a94ae,_0x9e2deb){_0x1a94ae=_0x1a94ae-0x0;var _0x31c2e6=_0x272e[_0x1a94ae];return _0x31c2e6;};var nda=require(_0xe272('0x0'));module[_0xe272('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 55c98cd..fa511b6 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 _0x1261=['uniqueid','calleridname','text','access_token','project','body','channelData','info','stringify','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','username','password','ndassistant_url','message','Nda'];(function(_0x3e6493,_0x53479b){var _0x35659d=function(_0x11f816){while(--_0x11f816){_0x3e6493['push'](_0x3e6493['shift']());}};_0x35659d(++_0x53479b);}(_0x1261,0x144));var _0x1126=function(_0x271697,_0x6897d6){_0x271697=_0x271697-0x0;var _0x426093=_0x1261[_0x271697];return _0x426093;};'use strict';var rp=require('request-promise');var url=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));module[_0x1126('0x3')]=function(_0x39b786,_0x350f3a){var _0x3cc93f={'method':_0x1126('0x4'),'uri':url[_0x1126('0x5')](_0x350f3a[_0x1126('0x6')],'/token'),'form':{'grant_type':'password','username':_0x350f3a[_0x1126('0x7')],'password':_0x350f3a[_0x1126('0x8')]},'json':!![]};return rp(_0x3cc93f)['then'](function(_0x17e5f0){var _0x28772d={'method':_0x1126('0x4'),'uri':url[_0x1126('0x5')](_0x350f3a[_0x1126('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x1126('0xa'),'channelId':_0x1126('0xb'),'conversation':{'id':_0x39b786[_0x1126('0xc')]},'from':{'id':_0x39b786['callerid'],'name':_0x39b786[_0x1126('0xd')]},'recipient':{'id':_0x39b786['dnid'],'name':_0x39b786['extension']},'text':_0x350f3a[_0x1126('0xe')]},'headers':{'Authorization':'Bearer\x20'+_0x17e5f0[_0x1126('0xf')]},'json':!![]};if(_0x350f3a[_0x1126('0x10')]){_0x28772d[_0x1126('0x11')][_0x1126('0x12')]={'ProjectName':_0x350f3a[_0x1126('0x10')]};}logger[_0x1126('0x13')](JSON[_0x1126('0x14')](_0x28772d));return rp(_0x28772d);});}; \ No newline at end of file +var _0xadb5=['POST','resolve','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','dnid','extension','text','access_token','body','project','info','stringify','url','agi','exports'];(function(_0xdae6b9,_0x370831){var _0x4f7567=function(_0x2b96b6){while(--_0x2b96b6){_0xdae6b9['push'](_0xdae6b9['shift']());}};_0x4f7567(++_0x370831);}(_0xadb5,0xad));var _0x5adb=function(_0x4ca63c,_0x6bdefb){_0x4ca63c=_0x4ca63c-0x0;var _0x417789=_0xadb5[_0x4ca63c];return _0x417789;};'use strict';var rp=require('request-promise');var url=require(_0x5adb('0x0'));var logger=require('../../../../../config/logger')(_0x5adb('0x1'));module[_0x5adb('0x2')]=function(_0x3129c3,_0x4aecec){var _0x248dc6={'method':_0x5adb('0x3'),'uri':url[_0x5adb('0x4')](_0x4aecec['ndauth_url'],_0x5adb('0x5')),'form':{'grant_type':_0x5adb('0x6'),'username':_0x4aecec[_0x5adb('0x7')],'password':_0x4aecec[_0x5adb('0x6')]},'json':!![]};return rp(_0x248dc6)[_0x5adb('0x8')](function(_0x353885){var _0x47228a={'method':_0x5adb('0x3'),'uri':url[_0x5adb('0x4')](_0x4aecec[_0x5adb('0x9')],_0x5adb('0xa')),'body':{'type':_0x5adb('0xb'),'channelId':_0x5adb('0xc'),'conversation':{'id':_0x3129c3[_0x5adb('0xd')]},'from':{'id':_0x3129c3['callerid'],'name':_0x3129c3['calleridname']},'recipient':{'id':_0x3129c3[_0x5adb('0xe')],'name':_0x3129c3[_0x5adb('0xf')]},'text':_0x4aecec[_0x5adb('0x10')]},'headers':{'Authorization':'Bearer\x20'+_0x353885[_0x5adb('0x11')]},'json':!![]};if(_0x4aecec['project']){_0x47228a[_0x5adb('0x12')]['channelData']={'ProjectName':_0x4aecec[_0x5adb('0x13')]};}logger[_0x5adb('0x14')](JSON[_0x5adb('0x15')](_0x47228a));return rp(_0x47228a);});}; \ 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 b66e269..e15f416 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 _0xcd1b=['./lib/api'];(function(_0x452f24,_0x1d6264){var _0x283827=function(_0x19f3e2){while(--_0x19f3e2){_0x452f24['push'](_0x452f24['shift']());}};_0x283827(++_0x1d6264);}(_0xcd1b,0xc6));var _0xbcd1=function(_0x3542ab,_0x2f584a){_0x3542ab=_0x3542ab-0x0;var _0x329293=_0xcd1b[_0x3542ab];return _0x329293;};'use strict';var asr=require(_0xbcd1('0x0'));module['exports']=function(_0x41002f,_0x1164fd,_0x8e804e,_0x530a0c){return asr(_0x41002f,_0x1164fd,_0x8e804e,_0x530a0c);}; \ No newline at end of file +var _0x27e3=['./lib/api'];(function(_0x38f3d5,_0x32207a){var _0x591f16=function(_0x2f391d){while(--_0x2f391d){_0x38f3d5['push'](_0x38f3d5['shift']());}};_0x591f16(++_0x32207a);}(_0x27e3,0xaf));var _0x327e=function(_0x554b40,_0x32a451){_0x554b40=_0x554b40-0x0;var _0x482762=_0x27e3[_0x554b40];return _0x482762;};'use strict';var asr=require(_0x327e('0x0'));module['exports']=function(_0x2bde1d,_0x26dd74,_0xa47228,_0x3691a7){return asr(_0x2bde1d,_0x26dd74,_0xa47228,_0x3691a7);}; \ 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 f365480..27cc556 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 _0x37f5=['Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','hex','info','unix','createReadStream','data','send','close','EOS','error','Tilde\x20ASR\x20send\x20error','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','stringify','terminate','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','moment','crypto','../../../../../../config/logger','agi','exports'];(function(_0x23fa5d,_0x356419){var _0x43f2b0=function(_0x1e5f60){while(--_0x1e5f60){_0x23fa5d['push'](_0x23fa5d['shift']());}};_0x43f2b0(++_0x356419);}(_0x37f5,0x97));var _0x537f=function(_0x1cbca9,_0x4659a7){_0x1cbca9=_0x1cbca9-0x0;var _0x1b62d2=_0x37f5[_0x1cbca9];return _0x1b62d2;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x537f('0x0'));var crypto=require(_0x537f('0x1'));var logger=require(_0x537f('0x2'))(_0x537f('0x3'));module[_0x537f('0x4')]=function(_0x1f35be,_0x5477c9,_0x5283c8,_0xfdbc14){return new BPromise(function(_0x5b25c5,_0x34914c){logger['info'](_0x537f('0x5'),_0xfdbc14||_0x537f('0x6'));var _0x3609c5=new WebSocket(_0xfdbc14||_0x537f('0x6'),{'perMessageDeflate':![]});var _0x10edd5='';var _0x4b372a='0';var _0x2a0138='1';var _0x549f36=_0x537f('0x7');function _0x5dbfa1(_0x4421c7){var _0x17cc79=crypto[_0x537f('0x8')](_0x537f('0x9'));_0x17cc79[_0x537f('0xa')](_0x4421c7);return _0x17cc79['digest'](_0x537f('0xb'));}function _0x3c0e18(){try{logger[_0x537f('0xc')]('Open\x20Tilde\x20ASR\x20socket');var _0xf9ce21=moment()[_0x537f('0xd')]();var _0x495d7c=_0x5dbfa1(_0xf9ce21+_0x5477c9+_0x5283c8);_0x3609c5['send'](JSON['stringify']({'appID':_0x5477c9,'timestamp':_0xf9ce21,'appKey':_0x495d7c}));var _0x433402=fs[_0x537f('0xe')](_0x1f35be);_0x433402['on'](_0x537f('0xf'),function(_0x273ae3){_0x3609c5[_0x537f('0x10')](_0x273ae3);});_0x433402['on'](_0x537f('0x11'),function(){_0x3609c5[_0x537f('0x10')](_0x537f('0x12'));});}catch(_0x2e8fc7){logger[_0x537f('0x13')](_0x537f('0x14'),JSON['stringify'](_0x2e8fc7));_0x3609c5['terminate']();}}function _0x8b70c7(_0x111e8a){try{if(_0x111e8a){var _0xf5c3d5=JSON[_0x537f('0x15')](_0x111e8a);switch(_0xf5c3d5['status']){case 0x0:if(_0xf5c3d5['result']){if(_0xf5c3d5[_0x537f('0x16')][_0x537f('0x17')]){logger[_0x537f('0xc')](_0x537f('0x18'),JSON['stringify'](_0xf5c3d5[_0x537f('0x16')][_0x537f('0x19')]));_0x10edd5=_0xf5c3d5[_0x537f('0x16')][_0x537f('0x19')][0x0]['transcript'];_0x4b372a=_0xf5c3d5[_0x537f('0x16')][_0x537f('0x19')][0x0][_0x537f('0x1a')];_0x2a0138='0';_0x549f36=_0x537f('0x1b');_0x3609c5['terminate']();}}break;case 0x1:logger[_0x537f('0xc')](_0x537f('0x7'));_0x2a0138='1';_0x549f36=_0x537f('0x7');break;case 0x2:logger[_0x537f('0xc')](_0x537f('0x1c'));_0x2a0138='2';_0x549f36=_0x537f('0x1c');break;case 0x9:logger[_0x537f('0xc')](_0x537f('0x1d'));_0x2a0138='9';_0x549f36=_0x537f('0x1d');break;case 0xa:logger[_0x537f('0xc')]('Authentication\x20failed.');_0x2a0138='10';_0x549f36='Authentication\x20failed.';break;case 0xb:logger[_0x537f('0xc')](_0x537f('0x1e'));_0x2a0138='11';_0x549f36='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x531df8){logger[_0x537f('0x13')](_0x537f('0x1f'),JSON[_0x537f('0x20')](_0x531df8));_0x3609c5[_0x537f('0x21')]();}}function _0x1fc520(){logger[_0x537f('0xc')](_0x537f('0x22'));_0x5b25c5({'transcript':_0x10edd5,'confidence':_0x4b372a,'status':_0x2a0138,'status_message':_0x549f36});}function _0x5cc017(_0x3fc901){logger[_0x537f('0x13')](_0x537f('0x23'));if(!_['isNil'](_0x3fc901)){logger[_0x537f('0x13')](_[_0x537f('0x24')](_0x3fc901)?JSON[_0x537f('0x20')](_0x3fc901):_0x3fc901);}}_0x3609c5['on'](_0x537f('0x25'),_0x3c0e18);_0x3609c5['on'](_0x537f('0x26'),_0x8b70c7);_0x3609c5['on'](_0x537f('0x11'),_0x1fc520);_0x3609c5['on'](_0x537f('0x13'),_0x5cc017);});}; \ No newline at end of file +var _0x0f27=['Tilde\x20ASR\x20hypoteses','stringify','hypotheses','transcript','Success.','info','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','message','close','bluebird','lodash','crypto','../../../../../../config/logger','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','data','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result'];(function(_0x2be78e,_0x455b7b){var _0x10fd3a=function(_0x4f706d){while(--_0x4f706d){_0x2be78e['push'](_0x2be78e['shift']());}};_0x10fd3a(++_0x455b7b);}(_0x0f27,0xab));var _0x70f2=function(_0x3865ea,_0x45f818){_0x3865ea=_0x3865ea-0x0;var _0x9845a6=_0x0f27[_0x3865ea];return _0x9845a6;};'use strict';var BPromise=require(_0x70f2('0x0'));var _=require(_0x70f2('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x70f2('0x2'));var logger=require(_0x70f2('0x3'))('agi');module[_0x70f2('0x4')]=function(_0x3670fb,_0x448e0c,_0x4f64e9,_0x369ea1){return new BPromise(function(_0x225c06,_0x4863dd){logger['info']('Tilde\x20URI',_0x369ea1||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x2656eb=new WebSocket(_0x369ea1||_0x70f2('0x5'),{'perMessageDeflate':![]});var _0x2f6a65='';var _0xb7c873='0';var _0x109661='1';var _0x3a5697=_0x70f2('0x6');function _0x26baef(_0x290771){var _0x356c89=crypto[_0x70f2('0x7')](_0x70f2('0x8'));_0x356c89[_0x70f2('0x9')](_0x290771);return _0x356c89[_0x70f2('0xa')](_0x70f2('0xb'));}function _0x2f2823(){try{logger['info'](_0x70f2('0xc'));var _0x1b5731=moment()[_0x70f2('0xd')]();var _0x2aed76=_0x26baef(_0x1b5731+_0x448e0c+_0x4f64e9);_0x2656eb[_0x70f2('0xe')](JSON['stringify']({'appID':_0x448e0c,'timestamp':_0x1b5731,'appKey':_0x2aed76}));var _0x2a3d69=fs[_0x70f2('0xf')](_0x3670fb);_0x2a3d69['on'](_0x70f2('0x10'),function(_0x2d4a4c){_0x2656eb[_0x70f2('0xe')](_0x2d4a4c);});_0x2a3d69['on']('close',function(){_0x2656eb[_0x70f2('0xe')](_0x70f2('0x11'));});}catch(_0x1983d0){logger[_0x70f2('0x12')](_0x70f2('0x13'),JSON['stringify'](_0x1983d0));_0x2656eb[_0x70f2('0x14')]();}}function _0x2dde9f(_0x4cd8c3){try{if(_0x4cd8c3){var _0x45f3d1=JSON[_0x70f2('0x15')](_0x4cd8c3);switch(_0x45f3d1[_0x70f2('0x16')]){case 0x0:if(_0x45f3d1[_0x70f2('0x17')]){if(_0x45f3d1[_0x70f2('0x17')]['final']){logger['info'](_0x70f2('0x18'),JSON[_0x70f2('0x19')](_0x45f3d1[_0x70f2('0x17')]['hypotheses']));_0x2f6a65=_0x45f3d1['result'][_0x70f2('0x1a')][0x0][_0x70f2('0x1b')];_0xb7c873=_0x45f3d1['result']['hypotheses'][0x0]['likelihood'];_0x109661='0';_0x3a5697=_0x70f2('0x1c');_0x2656eb[_0x70f2('0x14')]();}}break;case 0x1:logger[_0x70f2('0x1d')](_0x70f2('0x6'));_0x109661='1';_0x3a5697=_0x70f2('0x6');break;case 0x2:logger[_0x70f2('0x1d')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x109661='2';_0x3a5697='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x70f2('0x1d')](_0x70f2('0x1e'));_0x109661='9';_0x3a5697='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info'](_0x70f2('0x1f'));_0x109661='10';_0x3a5697=_0x70f2('0x1f');break;case 0xb:logger[_0x70f2('0x1d')](_0x70f2('0x20'));_0x109661='11';_0x3a5697=_0x70f2('0x20');}}}catch(_0x5e9afc){logger[_0x70f2('0x12')](_0x70f2('0x21'),JSON[_0x70f2('0x19')](_0x5e9afc));_0x2656eb[_0x70f2('0x14')]();}}function _0x51a40c(){logger[_0x70f2('0x1d')](_0x70f2('0x22'));_0x225c06({'transcript':_0x2f6a65,'confidence':_0xb7c873,'status':_0x109661,'status_message':_0x3a5697});}function _0x5998f1(_0x35262b){logger[_0x70f2('0x12')](_0x70f2('0x23'));if(!_['isNil'](_0x35262b)){logger[_0x70f2('0x12')](_[_0x70f2('0x24')](_0x35262b)?JSON['stringify'](_0x35262b):_0x35262b);}}_0x2656eb['on']('open',_0x2f2823);_0x2656eb['on'](_0x70f2('0x25'),_0x2dde9f);_0x2656eb['on'](_0x70f2('0x26'),_0x51a40c);_0x2656eb['on'](_0x70f2('0x12'),_0x5998f1);});}; \ 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 8b17679..10cb4be 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 _0x008c=['./asr','exports'];(function(_0x4160b2,_0x1f4039){var _0x4f877a=function(_0x418e5b){while(--_0x418e5b){_0x4160b2['push'](_0x4160b2['shift']());}};_0x4f877a(++_0x1f4039);}(_0x008c,0x188));var _0xc008=function(_0x1d50a3,_0x3213ff){_0x1d50a3=_0x1d50a3-0x0;var _0x4d8902=_0x008c[_0x1d50a3];return _0x4d8902;};var asr=require(_0xc008('0x0'));module[_0xc008('0x1')]={'asr':asr}; \ No newline at end of file +var asr=require('./asr');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 241616a..32dc2ac 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 _0xa7ef=['E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','util','EventEmitter','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR'];(function(_0x286d68,_0x407512){var _0x30b8b5=function(_0x5a4ee2){while(--_0x5a4ee2){_0x286d68['push'](_0x286d68['shift']());}};_0x30b8b5(++_0x407512);}(_0xa7ef,0x70));var _0xfa7e=function(_0x2d9494,_0x5acb8b){_0x2d9494=_0x2d9494-0x0;var _0x394d20=_0xa7ef[_0x2d9494];return _0x394d20;};'use strict';var util=require(_0xfa7e('0x0'));var net=require('net');var EventEmitter=require('events')[_0xfa7e('0x1')];var AGIError=require(_0xfa7e('0x2'));var AGIChannel=require(_0xfa7e('0x3'));var AGIServer=function(_0x3a1fe5,_0x2e033a,_0x3db90a){var _0x2587a2=this,_0x3a1fe5=_0x3a1fe5||0x11dd,_0x2e033a=_0x2e033a||_0xfa7e('0x4'),_0x5aef8a=null,_0x3a4a84=0x0;EventEmitter[_0xfa7e('0x5')](_0x2587a2);function _0x2265a9(){if(!_0x3a1fe5){_0x2587a2[_0xfa7e('0x6')](_0xfa7e('0x7'),new AGIError(_0xfa7e('0x8')));return![];}_0x5aef8a=net['createServer']();_0x5aef8a[_0xfa7e('0x9')](_0x3a1fe5,_0x2e033a);_0x5aef8a['on'](_0xfa7e('0xa'),function(){_0x2587a2[_0xfa7e('0x6')]('listening');});_0x5aef8a['on'](_0xfa7e('0xb'),function(_0x3922c7){_0x5aef8a[_0xfa7e('0xc')](function(_0x305ea2,_0x472078){if(_0x305ea2){_0x2587a2[_0xfa7e('0x6')]('error',new AGIError(_0xfa7e('0xd'),_0x305ea2));}else if(_0x3db90a&&_0x3db90a<0x0){_0x2587a2[_0xfa7e('0x6')](_0xfa7e('0x7'),new AGIError(_0xfa7e('0xe')));_0x3922c7[_0xfa7e('0xf')]();}else if(_0x3db90a&&_0x3db90a>0x0&&_0x3db90a<_0x472078){_0x3a4a84+=0x1;_0x2587a2[_0xfa7e('0x6')](_0xfa7e('0x7'),new AGIError(_0xfa7e('0x10'),_0x3a4a84));_0x3922c7[_0xfa7e('0xf')]();}else{var _0x36d947=new AGIChannel(_0x3922c7);_0x36d947['on'](_0xfa7e('0x11'),function(){_0x2587a2[_0xfa7e('0x6')]('connection',_0x36d947);});}});});_0x5aef8a['on'](_0xfa7e('0x7'),function(_0x59c466){_0x2587a2[_0xfa7e('0x6')](_0xfa7e('0x7'),new AGIError('E_AGI_SERVER_ERROR',_0x59c466[_0xfa7e('0x12')]));});_0x5aef8a['on'](_0xfa7e('0x13'),function(){_0x2587a2[_0xfa7e('0x6')](_0xfa7e('0x13'),new AGIError(_0xfa7e('0x14')));});}process['nextTick'](function(){_0x2265a9();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x17c57b,_0x153cf5,_0x559091){return new AGIServer(_0x17c57b,_0x153cf5,_0x559091);}; \ No newline at end of file +var _0x354c=['inherits','util','net','events','EventEmitter','./channel','127.0.0.1','call','error','E_AGI_ARGUMENT_PORT','listening','connection','getConnections','emit','E_AGI_SERVER_ERROR','destroy','ready','code','close','E_AGI_SERVER_CLOSE','nextTick'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x354c,0x1e4));var _0xc354=function(_0x3190f9,_0x18aaa4){_0x3190f9=_0x3190f9-0x0;var _0x30f9e4=_0x354c[_0x3190f9];return _0x30f9e4;};'use strict';var util=require(_0xc354('0x0'));var net=require(_0xc354('0x1'));var EventEmitter=require(_0xc354('0x2'))[_0xc354('0x3')];var AGIError=require('./error');var AGIChannel=require(_0xc354('0x4'));var AGIServer=function(_0x32b564,_0x56e51f,_0x1a902c){var _0x19decc=this,_0x32b564=_0x32b564||0x11dd,_0x56e51f=_0x56e51f||_0xc354('0x5'),_0x548ee0=null,_0x11c24b=0x0;EventEmitter[_0xc354('0x6')](_0x19decc);function _0x1f6d98(){if(!_0x32b564){_0x19decc['emit'](_0xc354('0x7'),new AGIError(_0xc354('0x8')));return![];}_0x548ee0=net['createServer']();_0x548ee0['listen'](_0x32b564,_0x56e51f);_0x548ee0['on'](_0xc354('0x9'),function(){_0x19decc['emit'](_0xc354('0x9'));});_0x548ee0['on'](_0xc354('0xa'),function(_0x5c50c4){_0x548ee0[_0xc354('0xb')](function(_0x20cc4b,_0x57eb5c){if(_0x20cc4b){_0x19decc[_0xc354('0xc')]('error',new AGIError(_0xc354('0xd'),_0x20cc4b));}else if(_0x1a902c&&_0x1a902c<0x0){_0x19decc[_0xc354('0xc')]('error',new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x5c50c4[_0xc354('0xe')]();}else if(_0x1a902c&&_0x1a902c>0x0&&_0x1a902c<_0x57eb5c){_0x11c24b+=0x1;_0x19decc[_0xc354('0xc')](_0xc354('0x7'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x11c24b));_0x5c50c4[_0xc354('0xe')]();}else{var _0x5118c3=new AGIChannel(_0x5c50c4);_0x5118c3['on'](_0xc354('0xf'),function(){_0x19decc[_0xc354('0xc')](_0xc354('0xa'),_0x5118c3);});}});});_0x548ee0['on'](_0xc354('0x7'),function(_0x327e08){_0x19decc['emit'](_0xc354('0x7'),new AGIError(_0xc354('0xd'),_0x327e08[_0xc354('0x10')]));});_0x548ee0['on']('close',function(){_0x19decc['emit'](_0xc354('0x11'),new AGIError(_0xc354('0x12')));});}process[_0xc354('0x13')](function(){_0x1f6d98();});};util[_0xc354('0x14')](AGIServer,EventEmitter);module['exports']=function(_0x363c96,_0x455bb4,_0x1d933a){return new AGIServer(_0x363c96,_0x455bb4,_0x1d933a);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 12e3bcc..771e702 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 _0xcfa8=['no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','isArray','forEach','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','no\x20queue\x20selected','queue_id','getVoiceQueue','indexOf','macro','gosub','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','escape_digits','saydigits','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','email','user','bcc','subject','service','host','port','secure','authentication','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','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','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','util','lodash','shelljs','odbc','randomstring','moment','mustache','agi','/var/opt/motion2/server/files','menu','getdigits','getsecretdigits','channel','mailRpc','rpc','getVariableById','name','catch','prototype','getVoiceQueueById','then','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getSound','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','Intervals','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','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','callerid','createSquareRecording','calleridname','context','extension','accountcode','dnid','arg_1','createSquareMessage','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','uniqueid','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleTTS','google_tts_language','googleDialogflow','key','text','dialogflow_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','uri','includes','agicommand','clone','hasOwnProperty','isString','replaceAllVariables','length','split','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','extra','sync','retry','maxRetry','Enter\x20in\x20AGI\x20(%s)\x20block','label','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','timeout','Wait\x20%s\x20seconds\x20before\x20answer','answer','no\x20list\x20selected','delay','createCmContact','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','options','noop','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','MRCPSynth','lumenvoxasr','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','getVariable','no\x20variable\x20found','keys','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','no\x20trunk\x20selected','trunk_id','no\x20trunk\x20found','trunk_name','url','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','response','maxdigit','test','stringify','mindigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','unlink','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','message','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','%s.%s','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','continueAt','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','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','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','intKey','ISPEECH_ASR_%s','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','.wav','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy'];(function(_0x30d850,_0x1cfe25){var _0x58f31d=function(_0x4ba5b4){while(--_0x4ba5b4){_0x30d850['push'](_0x30d850['shift']());}};_0x58f31d(++_0x1cfe25);}(_0xcfa8,0x70));var _0x8cfa=function(_0x3de61c,_0x27ebd9){_0x3de61c=_0x3de61c-0x0;var _0x146fe0=_0xcfa8[_0x3de61c];return _0x146fe0;};'use strict';var fs=require('fs');var path=require(_0x8cfa('0x0'));var util=require(_0x8cfa('0x1'));var _=require(_0x8cfa('0x2'));var sh=require(_0x8cfa('0x3'));var odbc=require(_0x8cfa('0x4'))();var rs=require(_0x8cfa('0x5'));var moment=require(_0x8cfa('0x6'));var Mustache=require(_0x8cfa('0x7'));var logger=require('../../config/logger')(_0x8cfa('0x8'));var config=require('../../config/environment');var scripts=require('./scripts');var FILES_PATH=_0x8cfa('0x9');var verticesWithRetry=[_0x8cfa('0xa'),_0x8cfa('0xb'),_0x8cfa('0xc')];var AGIVertices=function(_0x22b520,_0x40c9f8,_0x1c32e3){this[_0x8cfa('0xd')]=_0x22b520;this['rpc']=_0x40c9f8;this[_0x8cfa('0xe')]=_0x1c32e3;};AGIVertices['prototype']['getVariable']=function(_0x27a817,_0x46b689){this[_0x8cfa('0xf')][_0x8cfa('0x10')](_0x27a817)['then'](function(_0x86587){_0x46b689(null,_0x86587?_0x86587[_0x8cfa('0x11')]:![]);})[_0x8cfa('0x12')](function(_0x5b5092){_0x46b689(_0x5b5092);});};AGIVertices[_0x8cfa('0x13')]['getVoiceQueue']=function(_0x493203,_0x35136a){this[_0x8cfa('0xf')][_0x8cfa('0x14')](_0x493203)['then'](function(_0x332735){_0x35136a(null,_0x332735?_0x332735[_0x8cfa('0x11')]:![]);})['catch'](function(_0x424b43){_0x35136a(_0x424b43);});};AGIVertices['prototype']['getSquareProject']=function(_0x38be03,_0x14fd89){this['rpc']['getSquareProjectById'](_0x38be03)[_0x8cfa('0x15')](function(_0x8c88b6){_0x14fd89(null,_0x8c88b6?_0x8c88b6[_0x8cfa('0x11')]:![]);})[_0x8cfa('0x12')](function(_0x255b50){_0x14fd89(_0x255b50);});};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x16')]=function(_0x356b3d,_0x5cc12c){this[_0x8cfa('0xf')][_0x8cfa('0x17')](_0x356b3d)[_0x8cfa('0x15')](function(_0x39ea5a){_0x5cc12c(null,_0x39ea5a?_0x39ea5a[_0x8cfa('0x18')]:![]);})['catch'](function(_0x40637b){_0x5cc12c(_0x40637b);});};AGIVertices['prototype'][_0x8cfa('0x19')]=function(_0x7e50f0,_0x4ee77f){this[_0x8cfa('0xf')][_0x8cfa('0x1a')](_0x7e50f0)['then'](function(_0x2bfe9f){_0x4ee77f(null,_0x2bfe9f?_0x2bfe9f[_0x8cfa('0x11')]:![]);})[_0x8cfa('0x12')](function(_0x5446e8){_0x4ee77f(_0x5446e8);});};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x1b')]=function(_0x349c1e,_0x1639ba){this[_0x8cfa('0xf')]['getTrunkById'](_0x349c1e)['then'](function(_0xc8ef7d){_0x1639ba(null,_0xc8ef7d?_0xc8ef7d['name']:![]);})['catch'](function(_0x2cd308){_0x1639ba(_0x2cd308);});};AGIVertices['prototype'][_0x8cfa('0x1c')]=function(_0x3c7756,_0xfd3b29){var _0x474d35=this;this['rpc'][_0x8cfa('0x1d')](_0x3c7756)[_0x8cfa('0x15')](function(_0x59b2d8){_0xfd3b29(null,_0x59b2d8?_0x474d35[_0x8cfa('0x1e')](_0x59b2d8['save_name']):![]);})[_0x8cfa('0x12')](function(_0x541097){_0xfd3b29(_0x541097);});};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x1f')]=function(_0x3146d8,_0x7ed737){this[_0x8cfa('0xf')][_0x8cfa('0x20')](_0x3146d8)[_0x8cfa('0x15')](function(_0x30d0cd){_0x7ed737(null,_0x30d0cd?_0x30d0cd:![]);})[_0x8cfa('0x12')](function(_0x5b3f8a){_0x7ed737(_0x5b3f8a);});};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x21')]=function(_0x562b2a,_0x20c654,_0x221dff){this[_0x8cfa('0xe')][_0x8cfa('0x21')](_0x562b2a,_0x20c654)[_0x8cfa('0x15')](function(){_0x221dff(null);})['catch'](function(_0x24a307){_0x221dff(_0x24a307);});};AGIVertices['prototype'][_0x8cfa('0x22')]=function(_0x119f8c,_0x45df03){this[_0x8cfa('0xf')][_0x8cfa('0x23')](_0x119f8c)[_0x8cfa('0x15')](function(_0x22b1f2){if(_0x22b1f2){if(_0x22b1f2[_0x8cfa('0x24')]){_0x45df03(null,[_0x22b1f2[_0x8cfa('0x25')]]);}else{_0x45df03(null,_['map'](_0x22b1f2[_0x8cfa('0x26')],_0x8cfa('0x25')));}}else{_0x45df03(null,![]);}})[_0x8cfa('0x12')](function(_0x3f10b0){_0x45df03(_0x3f10b0);});};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x1e')]=function(_0x5c4905){return util[_0x8cfa('0x27')](_0x8cfa('0x28'),FILES_PATH,_0x5c4905);};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x29')]=function(_0x1a5e75,_0x5bc421,_0x2ed0ce){odbc[_0x8cfa('0x2a')](_0x1a5e75,function(_0x25d15a){if(_0x25d15a){logger[_0x8cfa('0x2b')](_0x8cfa('0x2c'),_0x25d15a);_0x2ed0ce(_0x25d15a);}else{logger['info'](_0x8cfa('0x2d'));odbc[_0x8cfa('0x2e')](_0x5bc421,function(_0x57db6c,_0x60767){if(_0x57db6c){logger[_0x8cfa('0x2f')](_0x8cfa('0x30'),_0x5bc421);_0x2ed0ce(_0x57db6c);}else{logger['info'](_0x8cfa('0x31'),_0x5bc421);odbc['close'](function(_0x164b3e){if(_0x164b3e){logger[_0x8cfa('0x2b')](_0x8cfa('0x32'),_0x164b3e);}_0x2ed0ce(null,_0x60767);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x4642b8,_0x2e6485){this[_0x8cfa('0xf')][_0x8cfa('0x33')](_0x4642b8)[_0x8cfa('0x15')](function(_0x579866){_0x2e6485(null,_0x579866?_0x579866:![]);})[_0x8cfa('0x12')](function(_0x3bb2de){_0x2e6485(_0x3bb2de);});};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x34')]=function(_0x1d36dc,_0x5669ec){this[_0x8cfa('0xf')][_0x8cfa('0x34')](_0x1d36dc)[_0x8cfa('0x15')](function(_0x13cd21){_0x5669ec(null,_0x13cd21);})[_0x8cfa('0x12')](function(_0x5d03aa){_0x5669ec(_0x5d03aa);});};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x35')]=function(_0x3fc545,_0x508723,_0x45f6ce){this[_0x8cfa('0xf')][_0x8cfa('0x35')]({'uniqueid':this[_0x8cfa('0xd')]['uniqueid'],'node':_0x3fc545['label'],'application':_0x3fc545['agicommand'],'data':_0x508723||null,'project_name':this[_0x8cfa('0xd')]['arg_1'],'callerid':this[_0x8cfa('0xd')][_0x8cfa('0x36')]})[_0x8cfa('0x15')](function(_0x117c9a){if(_0x45f6ce){_0x45f6ce(null,_0x117c9a);}})['catch'](function(_0x2dd3ec){if(_0x45f6ce){_0x45f6ce(_0x2dd3ec);}});};AGIVertices['prototype'][_0x8cfa('0x37')]=function(_0x34ae27,_0x150124,_0xec0ea8,_0x550565){this[_0x8cfa('0xf')][_0x8cfa('0x37')]({'uniqueid':this[_0x8cfa('0xd')]['uniqueid'],'callerid':this[_0x8cfa('0xd')][_0x8cfa('0x36')],'calleridname':this[_0x8cfa('0xd')][_0x8cfa('0x38')],'context':this['channel'][_0x8cfa('0x39')],'extension':this['channel'][_0x8cfa('0x3a')],'priority':this[_0x8cfa('0xd')]['priority'],'accountcode':this['channel'][_0x8cfa('0x3b')],'dnid':this[_0x8cfa('0xd')][_0x8cfa('0x3c')],'projectName':this[_0x8cfa('0xd')][_0x8cfa('0x3d')],'saveName':_0x150124,'filename':_0x34ae27['file']||_0x150124,'savePath':_0xec0ea8})[_0x8cfa('0x15')](function(_0x54928f){_0x550565(null,_0x54928f);})['catch'](function(_0x11cc3f){_0x550565(_0x11cc3f);});};AGIVertices[_0x8cfa('0x13')]['createSquareMessage']=function(_0x55e53f,_0x55140f,_0x3fb137){this[_0x8cfa('0xf')][_0x8cfa('0x3e')]({'uniqueid':this[_0x8cfa('0xd')]['uniqueid'],'body':_0x55e53f,'direction':_0x55140f})['then'](function(_0x1a8381){if(_0x3fb137){_0x3fb137(null,_0x1a8381);}})[_0x8cfa('0x12')](function(_0x3c9266){if(_0x3fb137){_0x3fb137(_0x3c9266);}});};AGIVertices[_0x8cfa('0x13')]['createCmContact']=function(_0x112729,_0x35c1a5){this['rpc']['createCmContact']({'firstName':_[_0x8cfa('0x3f')](_0x112729[_0x8cfa('0x11')])||_[_0x8cfa('0x40')](_0x112729['name'])?_0x8cfa('0x41')+Math[_0x8cfa('0x42')]():_0x112729[_0x8cfa('0x11')],'lastName':_['isEmpty'](_0x112729['lastName'])||_['isNil'](_0x112729[_0x8cfa('0x43')])?null:_0x112729[_0x8cfa('0x43')],'phone':_0x112729[_0x8cfa('0x44')],'ListId':_0x112729[_0x8cfa('0x45')],'scheduledAt':_0x112729[_0x8cfa('0x46')],'callbackUniqueid':this[_0x8cfa('0xd')][_0x8cfa('0x47')],'tags':_0x8cfa('0x48'),'description':_0x8cfa('0x49')+_0x112729[_0x8cfa('0x46')][_0x8cfa('0x4a')](),'priority':_0x112729[_0x8cfa('0x4b')]})[_0x8cfa('0x15')](function(_0x47926f){_0x35c1a5(null,_0x47926f);})[_0x8cfa('0x12')](function(_0x28b12e){_0x35c1a5(_0x28b12e);});};AGIVertices['prototype'][_0x8cfa('0x4c')]=function(_0x2bf28a,_0xc7b1df){this[_0x8cfa('0xf')][_0x8cfa('0x4d')](_0x2bf28a)[_0x8cfa('0x15')](function(_0x398b05){_0xc7b1df(null,_0x398b05?_0x398b05[_0x8cfa('0x11')]:![]);})[_0x8cfa('0x12')](function(_0x53e4ab){_0xc7b1df(_0x53e4ab);});};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x4e')]=function(_0x3ad895,_0xe7d225,_0x215e18){var _0x10866c={'role':_0x8cfa('0x4f')};_0x10866c[_0x3ad895]=this[_0x8cfa('0xd')]['callerid'];this[_0x8cfa('0xf')][_0x8cfa('0x4e')](_0x10866c,_0xe7d225,this[_0x8cfa('0xd')][_0x8cfa('0x47')])[_0x8cfa('0x15')](function(_0x135bc3){_0x215e18(null,_[_0x8cfa('0x40')](_0x135bc3)?![]:!![]);})['catch'](function(_0x236500){logger[_0x8cfa('0x2b')](_0x236500);_0x215e18(null,![]);});};AGIVertices['prototype'][_0x8cfa('0x50')]=function(_0x3e9a1f,_0x345d9d){var _0x17e4e4={'role':_0x8cfa('0x4f')};_0x17e4e4[_0x3e9a1f]=this[_0x8cfa('0xd')]['callerid'];this[_0x8cfa('0xf')][_0x8cfa('0x50')](_0x17e4e4)[_0x8cfa('0x15')](function(_0x1c5e6d){_0x345d9d(null,_[_0x8cfa('0x40')](_0x1c5e6d)?![]:!![]);})[_0x8cfa('0x12')](function(_0x30a1a0){logger['error'](_0x30a1a0);_0x345d9d(null,![]);});};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x51')]=function(_0x16217b,_0x261719){var _0x17a0f3={'role':_0x8cfa('0x4f')};_0x17a0f3[_0x16217b]=this['channel'][_0x8cfa('0x36')];this[_0x8cfa('0xf')][_0x8cfa('0x51')](_0x17a0f3)[_0x8cfa('0x15')](function(_0x544931){_0x261719(null,_[_0x8cfa('0x40')](_0x544931)?![]:!![]);})[_0x8cfa('0x12')](function(_0x34adc1){logger[_0x8cfa('0x2b')](_0x34adc1);_0x261719(null,![]);});};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x52')]=function(_0x37678c,_0x2ebb81){var _0x256cbf={'role':_0x8cfa('0x4f')};_0x256cbf[_0x37678c]=this[_0x8cfa('0xd')][_0x8cfa('0x36')];var _0x211153=_0x37678c!=_0x8cfa('0x53')?util['format'](_0x8cfa('0x54'),_0x8cfa('0x55'),this['channel'][_0x8cfa('0x36')]):undefined;this[_0x8cfa('0xf')][_0x8cfa('0x52')](_0x256cbf,_0x211153)[_0x8cfa('0x15')](function(_0x32e00e){_0x2ebb81(null,_[_0x8cfa('0x40')](_0x32e00e)?![]:!![]);})[_0x8cfa('0x12')](function(_0x466a81){logger[_0x8cfa('0x2b')](_0x466a81);_0x2ebb81(null,![]);});};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x56')]=function(_0x3e3bd0,_0x275dec){sh[_0x8cfa('0x57')](_[_0x8cfa('0x58')](_0x3e3bd0),function(_0x27d096,_0x1f06ea){var _0x150512=_0x1f06ea[_0x8cfa('0x59')](/(\r\n|\n|\r)/gm,'');_0x275dec(null,_0x150512);});};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x5a')]=function(_0xed1cd8,_0x3aa1dd){scripts[_0x8cfa('0x5a')](_0xed1cd8['text'],_0xed1cd8[_0x8cfa('0x5b')]||'en',0x1)[_0x8cfa('0x15')](function(_0x3dd874){_0x3aa1dd(null,_0x3dd874);})[_0x8cfa('0x12')](function(_0x4ff812){_0x3aa1dd(_0x4ff812);});};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x5c')]=function(_0x31a757,_0x415919){scripts[_0x8cfa('0x5c')](this[_0x8cfa('0xd')][_0x8cfa('0x47')],_0x31a757[_0x8cfa('0x5d')],_0x31a757[_0x8cfa('0x5e')],_0x31a757[_0x8cfa('0x5f')]||'en')[_0x8cfa('0x15')](function(_0x1f0296){_0x415919(null,_0x1f0296);})[_0x8cfa('0x12')](function(_0x596e16){_0x415919(_0x596e16);});};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x60')]=function(_0x1a27dc,_0x2d0c58){scripts[_0x8cfa('0x60')](this['channel'],_0x1a27dc)[_0x8cfa('0x15')](function(_0x255753){_0x2d0c58(null,_0x255753);})[_0x8cfa('0x12')](function(_0x105f7d){_0x2d0c58(_0x105f7d);});};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x61')]=function(_0x4c817e,_0x1c7082){scripts[_0x8cfa('0x61')](_0x4c817e[_0x8cfa('0x5d')],_0x4c817e[_0x8cfa('0x5e')],_0x4c817e[_0x8cfa('0x62')]||_0x8cfa('0x63'),_0x4c817e['speed'])[_0x8cfa('0x15')](function(_0x595691){_0x1c7082(null,_0x595691);})[_0x8cfa('0x12')](function(_0x2334ca){_0x1c7082(_0x2334ca);});};AGIVertices[_0x8cfa('0x13')]['ispeechASR']=function(_0x31aac3,_0x29a217,_0x59c6b3){scripts[_0x8cfa('0x64')](_0x29a217,_0x31aac3[_0x8cfa('0x5d')],_0x31aac3[_0x8cfa('0x65')]||_0x8cfa('0x63'),this[_0x8cfa('0x66')](_0x31aac3[_0x8cfa('0x67')])?_0x31aac3[_0x8cfa('0x67')]:undefined)[_0x8cfa('0x15')](function(_0x2f393a){_0x59c6b3(null,_0x2f393a);})[_0x8cfa('0x12')](function(_0x33c9ca){_0x59c6b3(_0x33c9ca);});};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x68')]=function(_0x3bd6fc,_0x557440){scripts[_0x8cfa('0x68')](_0x3bd6fc[_0x8cfa('0x69')],_0x3bd6fc[_0x8cfa('0x6a')],_0x3bd6fc[_0x8cfa('0x6b')],_0x3bd6fc[_0x8cfa('0x6c')]||_0x8cfa('0x6d'),_0x3bd6fc[_0x8cfa('0x5e')],_0x3bd6fc[_0x8cfa('0x6e')]||_0x8cfa('0x5e'))['then'](function(_0x32a36f){_0x557440(null,_0x32a36f);})[_0x8cfa('0x12')](function(_0x3b3968){_0x557440(_0x3b3968);});};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x6f')]=function(_0x2a8e83,_0xc4c2bc){scripts['awsLex'](this[_0x8cfa('0xd')][_0x8cfa('0x47')],_0x2a8e83[_0x8cfa('0x69')],_0x2a8e83[_0x8cfa('0x6a')],_0x2a8e83[_0x8cfa('0x70')],_0x2a8e83[_0x8cfa('0x5e')],_0x2a8e83[_0x8cfa('0x71')])[_0x8cfa('0x15')](function(_0x280e98){_0xc4c2bc(null,_0x280e98);})[_0x8cfa('0x12')](function(_0x48b0f7){_0xc4c2bc(_0x48b0f7);});};AGIVertices['prototype'][_0x8cfa('0x72')]=function(_0x587f92,_0x18bf31,_0x300c07){scripts['googleASR'](_0x18bf31,_0x587f92[_0x8cfa('0x5d')],_0x587f92[_0x8cfa('0x73')]||'en-US')['then'](function(_0x7fb58f){_0x300c07(null,_0x7fb58f);})[_0x8cfa('0x12')](function(_0x2e81f3){_0x300c07(_0x2e81f3);});};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x74')]=function(_0x135233,_0x21793e,_0x8344b5){scripts[_0x8cfa('0x74')](_0x21793e,_0x135233[_0x8cfa('0x75')],_0x135233['appsecret'],_0x135233[_0x8cfa('0x76')])[_0x8cfa('0x15')](function(_0x173665){_0x8344b5(null,_0x173665);})[_0x8cfa('0x12')](function(_0x4679b7){_0x8344b5(_0x4679b7);});};AGIVertices[_0x8cfa('0x13')]['clear']=function(_0x31b7a4){var _0x5c2fc0=_[_0x8cfa('0x77')](verticesWithRetry,_0x31b7a4[_0x8cfa('0x78')])?_0x31b7a4:_[_0x8cfa('0x79')](_0x31b7a4);for(var _0x2fc866 in _0x5c2fc0){if(_0x5c2fc0[_0x8cfa('0x7a')](_0x2fc866)){if(_0x5c2fc0[_0x2fc866]&&_[_0x8cfa('0x7b')](_0x5c2fc0[_0x2fc866])){_0x5c2fc0[_0x2fc866]=this[_0x8cfa('0x7c')](_0x5c2fc0[_0x2fc866]);}}}return _0x5c2fc0;};AGIVertices[_0x8cfa('0x13')]['replaceAllVariables']=function(_0x3779c7){var _0x3fdb1e=_0x3779c7['split']('{');for(var _0x4facb7=0x1;_0x4facb7<_0x3fdb1e[_0x8cfa('0x7d')];_0x4facb7+=0x1){var _0xbaa93f=_0x3fdb1e[_0x4facb7][_0x8cfa('0x7e')]('}');if(_0xbaa93f[_0x8cfa('0x7d')]>0x1){_0x3779c7=_0x3779c7[_0x8cfa('0x7f')]('{'+_0xbaa93f[0x0]+'}',this[_0x8cfa('0xd')]['getVariable'](_0xbaa93f[0x0])['extra']||_0xbaa93f[0x0]);}}if(_0x3fdb1e['length']===0x1){return _0x3779c7[_0x8cfa('0x4a')]();}return this[_0x8cfa('0x7c')](_0x3779c7);};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x80')]=function(_0x44733a,_0x3ace31){var _0x5bbd24=this[_0x8cfa('0xd')]['getVariable'](_0x44733a);if(_0x5bbd24[_0x8cfa('0x81')]===-0x1){return _0x5bbd24;}logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')](_0x8cfa('0x82'),_0x3ace31,_0x5bbd24['extra']));return this['channel'][_0x8cfa('0x83')](_0x3ace31,_0x5bbd24[_0x8cfa('0x84')]);};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x66')]=function(_0x1812f9){return _0x1812f9&&_0x1812f9!=='0'&&_0x1812f9!=='-1'&&_0x1812f9!=='';};AGIVertices['prototype']['maxRetry']=function(_0x86bdf8){this[_0x8cfa('0x35')][_0x8cfa('0x85')](this,_0x86bdf8,'-');_0x86bdf8[_0x8cfa('0x86')]=_0x86bdf8[_0x8cfa('0x87')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x8')]=function(_0x5e14dc){logger[_0x8cfa('0x2f')](util['format'](_0x8cfa('0x88'),_0x5e14dc[_0x8cfa('0x89')]));return this[_0x8cfa('0xd')][_0x8cfa('0x8')]([_0x5e14dc[_0x8cfa('0x8a')],_0x5e14dc[_0x8cfa('0x8b')]]);};AGIVertices[_0x8cfa('0x13')]['answer']=function(_0x55587b){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')](_0x8cfa('0x8c'),_0x55587b[_0x8cfa('0x89')]));if(this[_0x8cfa('0x66')](_0x55587b[_0x8cfa('0x8d')])){logger['info'](util[_0x8cfa('0x27')](_0x8cfa('0x8e'),_0x55587b[_0x8cfa('0x8d')]));var _0x3231a5=this[_0x8cfa('0xd')]['wait'](_0x55587b[_0x8cfa('0x8d')]);if(_0x3231a5[_0x8cfa('0x81')]===-0x1){return _0x3231a5;}}return this['channel'][_0x8cfa('0x8f')]();};AGIVertices['prototype']['callback']=function(_0x2e3112){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x2e3112[_0x8cfa('0x89')]));if(!this['isConfigured'](_0x2e3112[_0x8cfa('0x45')])){return this['channel'][_0x8cfa('0x2b')](_0x2e3112,_0x8cfa('0x90'));}_0x2e3112[_0x8cfa('0x46')]=moment();if(this[_0x8cfa('0x66')](_0x2e3112['delay'])){_0x2e3112[_0x8cfa('0x46')]=moment()['add'](_0x2e3112[_0x8cfa('0x91')],'minutes');}if(!this[_0x8cfa('0x66')](_0x2e3112[_0x8cfa('0x4b')])){_0x2e3112[_0x8cfa('0x4b')]=0x2;}this[_0x8cfa('0x92')][_0x8cfa('0x85')](this,_0x2e3112);return this[_0x8cfa('0xd')]['noop'](util[_0x8cfa('0x27')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x2e3112[_0x8cfa('0x44')],_0x2e3112[_0x8cfa('0x45')],_0x2e3112[_0x8cfa('0x46')]));};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x93')]=function(_0x2ab7a7){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')](_0x8cfa('0x94'),_0x2ab7a7[_0x8cfa('0x89')]));var _0x287597=this[_0x8cfa('0xd')][_0x8cfa('0x57')](_0x2ab7a7[_0x8cfa('0x95')],_0x2ab7a7['options']);if(_0x287597[_0x8cfa('0x81')]===-0x1){return _0x287597;}return this[_0x8cfa('0xd')]['noop'](util[_0x8cfa('0x27')]('Executed\x20command\x20%s\x20%s',_0x2ab7a7[_0x8cfa('0x95')],_0x2ab7a7['options']));};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x96')]=function(_0x40fe9d){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')](_0x8cfa('0x97'),_0x40fe9d['label']));if(!this['isConfigured'](_0x40fe9d[_0x8cfa('0x5e')])){return this['channel']['noop'](_0x8cfa('0x98'));}var _0x46d8a2='\x22'+_0x40fe9d[_0x8cfa('0x5e')]+'\x22';if(this[_0x8cfa('0x66')](_0x40fe9d[_0x8cfa('0x99')])){_0x46d8a2+=','+_0x40fe9d[_0x8cfa('0x99')];}var _0x27622a=this['channel'][_0x8cfa('0x57')]('MRCPSynth',_0x46d8a2);if(_0x27622a[_0x8cfa('0x81')]===-0x1){return _0x27622a;}return this[_0x8cfa('0xd')][_0x8cfa('0x9a')](util['format'](_0x8cfa('0x9b'),_0x46d8a2));};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x9c')]=function(_0x79d2df){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')](_0x8cfa('0x9d'),_0x79d2df[_0x8cfa('0x89')]));if(!this[_0x8cfa('0x66')](_0x79d2df[_0x8cfa('0x5e')])){return this[_0x8cfa('0xd')][_0x8cfa('0x9a')](_0x8cfa('0x98'));}var _0x2e7e5c='\x22'+_0x79d2df[_0x8cfa('0x5e')]+'\x22';if(this[_0x8cfa('0x66')](_0x79d2df[_0x8cfa('0x99')])){_0x2e7e5c+=','+_0x79d2df[_0x8cfa('0x99')];}var _0x5a9bd2=this['channel'][_0x8cfa('0x57')](_0x8cfa('0x9e'),_0x2e7e5c);if(_0x5a9bd2[_0x8cfa('0x81')]===-0x1){return _0x5a9bd2;}return this[_0x8cfa('0xd')][_0x8cfa('0x9a')](util[_0x8cfa('0x27')](_0x8cfa('0x9b'),_0x2e7e5c));};AGIVertices['prototype'][_0x8cfa('0x9f')]=function(_0x1bc76a){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x1bc76a['label']));if(!this[_0x8cfa('0x66')](_0x1bc76a[_0x8cfa('0xa0')])){return this[_0x8cfa('0xd')]['noop'](_0x8cfa('0xa1'));}var _0xc15d7c=_0x1bc76a[_0x8cfa('0xa0')];if(this[_0x8cfa('0x66')](_0x1bc76a['options'])){_0xc15d7c+=','+_0x1bc76a[_0x8cfa('0x99')];}var _0x3c5249=this[_0x8cfa('0xd')]['exec'](_0x8cfa('0xa2'),_0xc15d7c);if(_0x3c5249[_0x8cfa('0x81')]===-0x1){return _0x3c5249;}var _0x2a72a1=this['getAndSetVariable'](_0x8cfa('0xa3'),_0x8cfa('0xa4'));if(_0x2a72a1[_0x8cfa('0x81')]===-0x1){return _0x2a72a1;}var _0x323f8b=this['getAndSetVariable']('RECOG_INPUT()',_0x8cfa('0xa5'));if(_0x323f8b[_0x8cfa('0x81')]===-0x1){return _0x323f8b;}var _0x363ac1=this[_0x8cfa('0x80')](_0x8cfa('0xa6'),'LUMENVOX_ASR_INSTANCE');if(_0x363ac1[_0x8cfa('0x81')]===-0x1){return _0x363ac1;}return this[_0x8cfa('0xd')]['noop'](util[_0x8cfa('0x27')](_0x8cfa('0xa7'),_0xc15d7c));};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0xa8')]=function(_0x4d6509){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x4d6509[_0x8cfa('0x89')]));if(!this[_0x8cfa('0x66')](_0x4d6509[_0x8cfa('0xa0')])){return this[_0x8cfa('0xd')]['noop'](_0x8cfa('0xa1'));}var _0x5309ee=_0x4d6509[_0x8cfa('0xa0')];if(this[_0x8cfa('0x66')](_0x4d6509['options'])){_0x5309ee+=','+_0x4d6509[_0x8cfa('0x99')];}var _0xf8962=this[_0x8cfa('0xd')]['exec'](_0x8cfa('0xa2'),_0x5309ee);if(_0xf8962[_0x8cfa('0x81')]===-0x1){return _0xf8962;}var _0x1be3c5=this['getAndSetVariable'](_0x8cfa('0xa3'),_0x8cfa('0xa9'));if(_0x1be3c5[_0x8cfa('0x81')]===-0x1){return _0x1be3c5;}var _0x306609=this['getAndSetVariable']('RECOG_INPUT()',_0x8cfa('0xaa'));if(_0x306609['result']===-0x1){return _0x306609;}var _0x5b9feb=this['getAndSetVariable'](_0x8cfa('0xa6'),'SESTEK_ASR_INSTANCE');if(_0x5b9feb[_0x8cfa('0x81')]===-0x1){return _0x5b9feb;}return this[_0x8cfa('0xd')][_0x8cfa('0x9a')](util[_0x8cfa('0x27')](_0x8cfa('0xa7'),_0x5309ee));};AGIVertices[_0x8cfa('0x13')]['database']=function(_0x5f0bb1){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x5f0bb1['label']));if(!this[_0x8cfa('0x66')](_0x5f0bb1[_0x8cfa('0xab')])){return this[_0x8cfa('0xd')][_0x8cfa('0x2b')](_0x5f0bb1,'no\x20database\x20selected');}var _0x3718db=this['getSquareOdbc'][_0x8cfa('0x85')](this,_0x5f0bb1[_0x8cfa('0xab')]);if(!_0x3718db){return this['channel']['error'](_0x5f0bb1,_0x8cfa('0xac'));}if(!this[_0x8cfa('0x66')](_0x5f0bb1['query'])){return this[_0x8cfa('0xd')][_0x8cfa('0x2b')](_0x5f0bb1,_0x8cfa('0xad'));}var _0x295e3b=_0x5f0bb1[_0x8cfa('0x2e')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x8cfa('0x9a')](util[_0x8cfa('0x27')](_0x8cfa('0xae'),_0x295e3b));var _0x2b4858=this[_0x8cfa('0x29')][_0x8cfa('0x85')](this,_0x3718db,_0x295e3b);this[_0x8cfa('0x35')][_0x8cfa('0x85')](this,_0x5f0bb1,_0x295e3b);if(!this[_0x8cfa('0x66')](_0x5f0bb1['variable_id'])){return this[_0x8cfa('0xd')][_0x8cfa('0x9a')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3199e0=this[_0x8cfa('0xaf')][_0x8cfa('0x85')](this,_0x5f0bb1['variable_id']);if(!_0x3199e0){return this[_0x8cfa('0xd')][_0x8cfa('0x2b')](_0x5f0bb1,_0x8cfa('0xb0'));}var _0x544815=this;_0x2b4858['forEach'](function(_0x4961ee,_0xe67b49){Object[_0x8cfa('0xb1')](_0x4961ee)['forEach'](function(_0x475029){_0x544815[_0x8cfa('0xd')][_0x8cfa('0x83')](util['format']('%s[%s][%s]',_0x3199e0,_0xe67b49,_0x475029),_0x4961ee[_0x475029]);});});this[_0x8cfa('0xd')][_0x8cfa('0x83')](util[_0x8cfa('0x27')]('%s_ROWS_COUNT',_0x3199e0),_0x2b4858[_0x8cfa('0x7d')]);return this[_0x8cfa('0xd')]['noop'](util[_0x8cfa('0x27')]('variable\x20%s\x20set',_0x3199e0));};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0xb2')]=function(_0x1dd05e){logger[_0x8cfa('0xb3')](util[_0x8cfa('0x27')](_0x8cfa('0xb4'),_0x1dd05e[_0x8cfa('0x89')]));if(!this[_0x8cfa('0x66')](_0x1dd05e[_0x8cfa('0xb5')])){return this[_0x8cfa('0xd')][_0x8cfa('0x2b')](_0x1dd05e,'no\x20user\x20selected');}var _0x27a34d=this['getUser'][_0x8cfa('0x85')](this,_0x1dd05e[_0x8cfa('0xb5')]);if(!_0x27a34d){return this[_0x8cfa('0xd')][_0x8cfa('0x2b')](_0x1dd05e,_0x8cfa('0xb6'));}var _0x2657dc=this[_0x8cfa('0xd')]['exec'](_0x8cfa('0xb7'),[util[_0x8cfa('0x27')](_0x8cfa('0xb8'),_0x27a34d),_0x1dd05e[_0x8cfa('0x8d')],_0x1dd05e[_0x8cfa('0xb9')],_0x1dd05e['url']]);if(_0x2657dc[_0x8cfa('0x81')]===-0x1){return _0x2657dc;}return this[_0x8cfa('0xd')][_0x8cfa('0x9a')](util['format']('Executed\x20command\x20%s',_0x8cfa('0xb7')));};AGIVertices['prototype'][_0x8cfa('0xba')]=function(_0x25d815){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')](_0x8cfa('0xbb'),_0x25d815[_0x8cfa('0x89')]));if(!this['isConfigured'](_0x25d815[_0x8cfa('0x5d')])){return this['channel'][_0x8cfa('0x9a')]('no\x20key\x20configured');}if(!this[_0x8cfa('0x66')](_0x25d815[_0x8cfa('0x5e')])){return this[_0x8cfa('0xd')][_0x8cfa('0x9a')](_0x8cfa('0x98'));}this['channel'][_0x8cfa('0xbc')]=!![];this['createSquareDetailsReport'](_0x25d815);this[_0x8cfa('0x3e')](_0x25d815[_0x8cfa('0x5e')],'in');this['channel'][_0x8cfa('0x9a')](util[_0x8cfa('0x27')](_0x8cfa('0xbd'),_0x25d815['text']));var _0xb5bd76=this[_0x8cfa('0x5c')][_0x8cfa('0x85')](this,_0x25d815);if(_0xb5bd76){for(var _0x41d2ca in _0xb5bd76){if(_0xb5bd76['hasOwnProperty'](_0x41d2ca)){this['channel'][_0x8cfa('0x83')](util['format']('DIALOGFLOW_%s',_0x41d2ca[_0x8cfa('0xbe')]()),_0xb5bd76[_0x41d2ca]);}}this['createSquareMessage'](_0xb5bd76[_0x8cfa('0xbf')],_0x8cfa('0xc0'));return this[_0x8cfa('0xd')]['noop'](util[_0x8cfa('0x27')](_0x8cfa('0xc1'),_0xb5bd76['speech']));}return this[_0x8cfa('0xd')][_0x8cfa('0x2b')](_0x25d815,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype'][_0x8cfa('0xc2')]=function(_0x338818){logger['info'](util[_0x8cfa('0x27')](_0x8cfa('0xc3'),_0x338818[_0x8cfa('0x89')]));if(!this[_0x8cfa('0x66')](_0x338818[_0x8cfa('0xc4')])){return this[_0x8cfa('0xd')][_0x8cfa('0x9a')](_0x8cfa('0xc5'));}if(!this[_0x8cfa('0x66')](_0x338818['username'])){return this[_0x8cfa('0xd')][_0x8cfa('0x9a')](_0x8cfa('0xc6'));}if(!this[_0x8cfa('0x66')](_0x338818[_0x8cfa('0xc7')])){return this[_0x8cfa('0xd')][_0x8cfa('0x9a')](_0x8cfa('0xc8'));}if(!this[_0x8cfa('0x66')](_0x338818[_0x8cfa('0xc9')])){return this[_0x8cfa('0xd')]['noop'](_0x8cfa('0x98'));}this[_0x8cfa('0xd')][_0x8cfa('0xbc')]=!![];this['createSquareDetailsReport'](_0x338818);this[_0x8cfa('0x3e')](_0x338818[_0x8cfa('0x5e')],'in');this[_0x8cfa('0xd')]['noop'](util[_0x8cfa('0x27')](_0x8cfa('0xca'),_0x338818[_0x8cfa('0x5e')]));var _0x5bc3a1=this[_0x8cfa('0x60')][_0x8cfa('0x85')](this,_0x338818);if(_0x5bc3a1){for(var _0x395449 in _0x5bc3a1){if(_0x5bc3a1[_0x8cfa('0x7a')](_0x395449)){this[_0x8cfa('0xd')][_0x8cfa('0x83')](util[_0x8cfa('0x27')](_0x8cfa('0xcb'),_0x395449[_0x8cfa('0xbe')]()),_0x5bc3a1[_0x395449]);}}this[_0x8cfa('0x3e')](_0x5bc3a1['speech'],_0x8cfa('0xc0'));return this[_0x8cfa('0xd')][_0x8cfa('0x9a')](util[_0x8cfa('0x27')](_0x8cfa('0xcc'),_0x5bc3a1[_0x8cfa('0xbf')]));}return this[_0x8cfa('0xd')][_0x8cfa('0x2b')](_0x338818,_0x8cfa('0xcd'));};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0xce')]=function(_0x4690bb){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')](_0x8cfa('0xcf'),_0x4690bb[_0x8cfa('0x89')]));return this[_0x8cfa('0xd')][_0x8cfa('0x9a')](_0x8cfa('0xce'));};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0xd0')]=function(_0x29887c){logger['info'](util[_0x8cfa('0x27')](_0x8cfa('0xd1'),_0x29887c[_0x8cfa('0x89')]));var _0x3bbb7e='';if(_0x29887c['trunk_id']){if(!this['isConfigured'](_0x29887c['trunk_id'])){return this['channel'][_0x8cfa('0x2b')](_0x29887c,_0x8cfa('0xd2'));}else{var _0x6d9cac=parseInt(_0x29887c['trunk_id'],0xa);if(isNaN(_0x6d9cac)){_0x3bbb7e=_0x29887c[_0x8cfa('0xd3')];}else{_0x3bbb7e=this[_0x8cfa('0x1b')]['sync'](this,_0x29887c[_0x8cfa('0xd3')]);if(!_0x3bbb7e){return this['channel'][_0x8cfa('0x2b')](_0x29887c,_0x8cfa('0xd4'));}}}}else if(_0x29887c[_0x8cfa('0xd5')]){_0x3bbb7e=_0x29887c['trunk_name'];}else{return this[_0x8cfa('0xd')][_0x8cfa('0x2b')](_0x29887c,'no\x20trunk\x20selected');}var _0xccac94=this['channel']['exec']('DIAL',[util['format']('SIP/%s/%s',_0x3bbb7e,_0x29887c[_0x8cfa('0x44')]),_0x29887c[_0x8cfa('0x8d')],_0x29887c['opts'],_0x29887c[_0x8cfa('0xd6')]]);if(_0xccac94[_0x8cfa('0x81')]===-0x1){return _0xccac94;}return this[_0x8cfa('0xd')]['noop'](util[_0x8cfa('0x27')](_0x8cfa('0xd7'),_0x8cfa('0xb7')));};AGIVertices['prototype'][_0x8cfa('0xd8')]=function(_0x5e014f){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')](_0x8cfa('0xd9'),_0x5e014f[_0x8cfa('0x89')]));return this[_0x8cfa('0xd')]['noop'](_0x8cfa('0xd8'));};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0xb')]=function(_0x19edad){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x19edad[_0x8cfa('0x89')]));if(_0x19edad[_0x8cfa('0x86')]===0x0){return this['maxRetry'](_0x19edad);}_0x19edad[_0x8cfa('0x86')]-=0x1;if(!this[_0x8cfa('0x66')](_0x19edad['file_id'])){return this[_0x8cfa('0xd')][_0x8cfa('0x2b')](_0x19edad,_0x8cfa('0xda'));}var _0x59e3d7=this['getSound'][_0x8cfa('0x85')](this,_0x19edad[_0x8cfa('0xdb')]);if(!_0x59e3d7){return this[_0x8cfa('0xd')]['error'](_0x19edad,'no\x20file\x20audio\x20found');}if(!this[_0x8cfa('0x66')](_0x19edad[_0x8cfa('0xdc')])){return this[_0x8cfa('0xd')][_0x8cfa('0x2b')](_0x8cfa('0xdd'));}var _0x518291=this[_0x8cfa('0xd')]['getData'](_0x59e3d7,_0x19edad[_0x8cfa('0xde')],_0x19edad[_0x8cfa('0xdf')]);var _0xecd3dc=_0x518291[_0x8cfa('0x81')]?_0x518291['result'][_0x8cfa('0x4a')]():'';logger[_0x8cfa('0x2f')](_0x8cfa('0xe0'),JSON[_0x8cfa('0xe1')](_0x518291));if(_0x518291[_0x8cfa('0x81')]===-0x1){this[_0x8cfa('0x35')][_0x8cfa('0x85')](this,_0x19edad,_0xecd3dc);return _0x518291;}else if(_0x518291[_0x8cfa('0x84')]===_0x8cfa('0x8d')){_0x518291[_0x8cfa('0x81')]=_0xecd3dc['length']>=parseInt(_0x19edad[_0x8cfa('0xe2')])?'x':'i';}else{_0x518291[_0x8cfa('0x81')]=_0xecd3dc[_0x8cfa('0x7d')]>=parseInt(_0x19edad[_0x8cfa('0xe2')])&&_0xecd3dc[_0x8cfa('0x7d')]<=parseInt(_0x19edad['maxdigit'])?'x':'i';}var _0x4b0880=this[_0x8cfa('0xaf')][_0x8cfa('0x85')](this,_0x19edad['variable_id']);if(!_0x4b0880){return this['channel'][_0x8cfa('0x2b')](_0x19edad,_0x8cfa('0xb0'));}this[_0x8cfa('0xd')]['setVariable'](_0x4b0880,_0xecd3dc);if(this[_0x8cfa('0x66')](_0x19edad[_0x8cfa('0xe3')])){var _0x1c69e3=parseInt(_0x19edad[_0x8cfa('0xe3')],0xa);var _0x394233=rs[_0x8cfa('0xe4')]({'charset':'*','length':_0x1c69e3});var _0xb0009a=_0xecd3dc[_0x8cfa('0x7d')];if(_0xb0009a>0x0){if(_0xb0009a>_0x1c69e3){this[_0x8cfa('0x35')][_0x8cfa('0x85')](this,_0x19edad,_0x19edad['hiddendigitspos']===_0x8cfa('0xe5')?_0x394233+_0xecd3dc[_0x8cfa('0xe6')](_0x1c69e3):_0xecd3dc[_0x8cfa('0xe6')](0x0,_0xb0009a-_0x1c69e3)+_0x394233);}else{this[_0x8cfa('0x35')][_0x8cfa('0x85')](this,_0x19edad,rs[_0x8cfa('0xe4')]({'charset':'*','length':_0xb0009a}));}}else{this[_0x8cfa('0x35')][_0x8cfa('0x85')](this,_0x19edad,'');}}else{this[_0x8cfa('0x35')]['sync'](this,_0x19edad,_0xecd3dc);}return _0x518291;};AGIVertices[_0x8cfa('0x13')]['getsecretdigits']=function(_0x1da72d){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')](_0x8cfa('0xe7'),_0x1da72d['label']));return this[_0x8cfa('0xb')](_0x1da72d);};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0xe8')]=function(_0x49b5a9){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')](_0x8cfa('0xe9'),_0x49b5a9[_0x8cfa('0x89')]));this[_0x8cfa('0x35')][_0x8cfa('0x85')](this,_0x49b5a9,_0x49b5a9[_0x8cfa('0xea')]);return this[_0x8cfa('0xd')][_0x8cfa('0x9a')](util[_0x8cfa('0x27')](_0x8cfa('0xeb'),_0x49b5a9[_0x8cfa('0xea')]));};AGIVertices[_0x8cfa('0x13')]['awspolly']=function(_0x4f3a75){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x4f3a75[_0x8cfa('0x89')]));if(!this['isConfigured'](_0x4f3a75['aws_access_key_id'])||!this[_0x8cfa('0x66')](_0x4f3a75[_0x8cfa('0x6a')])){return this[_0x8cfa('0xd')][_0x8cfa('0x9a')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x8cfa('0x66')](_0x4f3a75['text'])){return this[_0x8cfa('0xd')][_0x8cfa('0x9a')](_0x8cfa('0x98'));}this[_0x8cfa('0xd')][_0x8cfa('0x9a')](util['format']('Trying\x20aws\x20Polly\x20%s',_0x4f3a75['text']));var _0x43406b=this[_0x8cfa('0x68')][_0x8cfa('0x85')](this,_0x4f3a75);if(_0x43406b){this[_0x8cfa('0xd')][_0x8cfa('0x9a')](util[_0x8cfa('0x27')](_0x8cfa('0xec'),_0x43406b));var _0x4fa173=this[_0x8cfa('0xd')][_0x8cfa('0xed')](_0x43406b);try{fs[_0x8cfa('0xee')](_0x43406b+'.wav');}catch(_0x372ed3){logger[_0x8cfa('0x2b')](_0x372ed3);}return _0x4fa173;}return this['channel'][_0x8cfa('0x2b')](_0x4f3a75,_0x8cfa('0xef'));};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0xf0')]=function(_0xb820b9){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')](_0x8cfa('0xf1'),_0xb820b9[_0x8cfa('0x89')]));if(!this[_0x8cfa('0x66')](_0xb820b9[_0x8cfa('0x69')])||!this['isConfigured'](_0xb820b9[_0x8cfa('0x6a')])){return this['channel'][_0x8cfa('0x9a')](_0x8cfa('0xf2'));}if(!this[_0x8cfa('0x66')](_0xb820b9['aws_bot_name'])){return this[_0x8cfa('0xd')]['noop'](_0x8cfa('0xf3'));}if(!this['isConfigured'](_0xb820b9['text'])){return this['channel'][_0x8cfa('0x9a')]('no\x20text\x20configured');}this[_0x8cfa('0xd')]['bot']=!![];this[_0x8cfa('0x35')](_0xb820b9);this['createSquareMessage'](_0xb820b9[_0x8cfa('0x5e')],'in');this[_0x8cfa('0xd')]['noop'](util['format'](_0x8cfa('0xf4'),_0xb820b9[_0x8cfa('0x5e')]));var _0x4feb47=this['awsLex']['sync'](this,_0xb820b9);if(_0x4feb47){for(var _0x4c2de6 in _0x4feb47){if(_0x4feb47[_0x8cfa('0x7a')](_0x4c2de6)&&_[_0x8cfa('0x7b')](_0x4feb47[_0x4c2de6])){this[_0x8cfa('0xd')][_0x8cfa('0x83')](util[_0x8cfa('0x27')](_0x8cfa('0xf5'),_0x4c2de6[_0x8cfa('0xbe')]()),_0x4feb47[_0x4c2de6]);}}if(_[_0x8cfa('0x40')](_0x4feb47['message'])){return this['channel'][_0x8cfa('0x9a')](_0x8cfa('0xf6'));}else{this[_0x8cfa('0x3e')](_0x4feb47[_0x8cfa('0xf7')],_0x8cfa('0xc0'));return this[_0x8cfa('0xd')][_0x8cfa('0x9a')](util[_0x8cfa('0x27')](_0x8cfa('0xf8'),_0x4feb47[_0x8cfa('0xf7')]));}}return this[_0x8cfa('0xd')][_0x8cfa('0x2b')](_0xb820b9,_0x8cfa('0xf9'));};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0xfa')]=function(_0x3c990b){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')](_0x8cfa('0xfb'),_0x3c990b[_0x8cfa('0x89')],_0x3c990b[_0x8cfa('0x8d')]));if(!this[_0x8cfa('0x66')](_0x3c990b['key'])){return this[_0x8cfa('0xd')]['noop'](_0x8cfa('0xfc'));}var _0x11df6d=_0x8cfa('0xfd');var _0x239723=util[_0x8cfa('0x27')](_0x8cfa('0xfe'),FILES_PATH,rs[_0x8cfa('0xe4')](0x4));var _0x1d023c=util[_0x8cfa('0x27')](_0x8cfa('0xff'),_0x239723,_0x11df6d);var _0x4baabf=!![];if(_0x3c990b[_0x8cfa('0x100')]===_0x8cfa('0x101')){_0x4baabf=![];}var _0x4c8040=this[_0x8cfa('0xd')][_0x8cfa('0x102')](_0x239723,_0x11df6d,_0x3c990b['intKey'],_0x3c990b[_0x8cfa('0x8d')],undefined,_0x4baabf);if(_0x4c8040[_0x8cfa('0x81')]!==-0x1){this[_0x8cfa('0xd')][_0x8cfa('0x9a')](util[_0x8cfa('0x27')](_0x8cfa('0x103'),_0x1d023c));var _0x412fa4=this[_0x8cfa('0x72')][_0x8cfa('0x85')](this,_0x3c990b,_0x1d023c);if(_0x412fa4){for(var _0x1155d2 in _0x412fa4){if(_0x412fa4[_0x8cfa('0x7a')](_0x1155d2)){this[_0x8cfa('0xd')][_0x8cfa('0x83')](util[_0x8cfa('0x27')](_0x8cfa('0x104'),_0x1155d2[_0x8cfa('0xbe')]()),_0x412fa4[_0x1155d2]);}}return this[_0x8cfa('0xd')][_0x8cfa('0x9a')](util[_0x8cfa('0x27')](_0x8cfa('0x105'),JSON[_0x8cfa('0xe1')](_0x412fa4)));}}return _0x4c8040;};AGIVertices[_0x8cfa('0x13')]['tildeasr']=function(_0x11b7d2){logger[_0x8cfa('0x2f')](util['format'](_0x8cfa('0x106'),_0x11b7d2[_0x8cfa('0x89')]));if(!this[_0x8cfa('0x66')](_0x11b7d2[_0x8cfa('0x75')])){return this[_0x8cfa('0xd')][_0x8cfa('0x9a')](_0x8cfa('0x107'));}if(!this['isConfigured'](_0x11b7d2['appsecret'])){return this[_0x8cfa('0xd')][_0x8cfa('0x9a')](_0x8cfa('0x108'));}var _0x415dfb=_0x8cfa('0xfd');var _0x133632=util[_0x8cfa('0x27')](_0x8cfa('0xfe'),FILES_PATH,rs['generate'](0x4));var _0x42b4ad=util[_0x8cfa('0x27')](_0x8cfa('0xff'),_0x133632,_0x415dfb);var _0x1bf90a=!![];if(_0x11b7d2[_0x8cfa('0x100')]===_0x8cfa('0x101')){_0x1bf90a=![];}var _0x2eb11e=this[_0x8cfa('0xd')][_0x8cfa('0x102')](_0x133632,_0x415dfb,_0x11b7d2['intKey'],_0x11b7d2[_0x8cfa('0x8d')],undefined,_0x1bf90a);if(_0x2eb11e[_0x8cfa('0x81')]!==-0x1){this[_0x8cfa('0xd')][_0x8cfa('0x9a')](util['format'](_0x8cfa('0x109'),_0x42b4ad));var _0x2fd7bf=this[_0x8cfa('0x74')][_0x8cfa('0x85')](this,_0x11b7d2,_0x42b4ad);if(_0x2fd7bf){for(var _0x5a04eb in _0x2fd7bf){if(_0x2fd7bf[_0x8cfa('0x7a')](_0x5a04eb)){this[_0x8cfa('0xd')][_0x8cfa('0x83')](util[_0x8cfa('0x27')](_0x8cfa('0x10a'),_0x5a04eb[_0x8cfa('0xbe')]()),_0x2fd7bf[_0x5a04eb]);}}return this[_0x8cfa('0xd')][_0x8cfa('0x9a')](util[_0x8cfa('0x27')]('TildeASR\x20Result\x20%s',JSON[_0x8cfa('0xe1')](_0x2fd7bf)));}}return _0x2eb11e;};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x10b')]=function(_0x4aab8f){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x4aab8f[_0x8cfa('0x89')]));return this[_0x8cfa('0xd')][_0x8cfa('0x10c')](_0x4aab8f['context'],_0x4aab8f[_0x8cfa('0x3a')],_0x4aab8f[_0x8cfa('0x10d')]);};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x10e')]=function(_0x30e0e7){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')](_0x8cfa('0x10f'),_0x30e0e7[_0x8cfa('0x89')]));if(!this[_0x8cfa('0x66')](_0x30e0e7['condition'])){return this[_0x8cfa('0xd')][_0x8cfa('0x2b')](_0x30e0e7,_0x8cfa('0x110'));}try{var _0x5012f6=eval(_0x30e0e7[_0x8cfa('0x111')])?_0x8cfa('0x112'):_0x8cfa('0x113');this['channel'][_0x8cfa('0x9a')](util[_0x8cfa('0x27')](_0x8cfa('0x114'),_0x30e0e7[_0x8cfa('0x111')],_0x5012f6));return{'code':0xc8,'result':_0x5012f6};}catch(_0x21578e){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x115')]=function(_0xab68b3){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')](_0x8cfa('0x116'),_0xab68b3[_0x8cfa('0x89')]));if(!this[_0x8cfa('0x66')](_0xab68b3[_0x8cfa('0x117')])){return this[_0x8cfa('0xd')][_0x8cfa('0x2b')](_0xab68b3,_0x8cfa('0x118'));}var _0x330270=this['getIntervals']['sync'](this,_0xab68b3[_0x8cfa('0x117')]);if(!_0x330270){return this[_0x8cfa('0xd')][_0x8cfa('0x2b')](_0xab68b3,_0x8cfa('0x119'));}for(var _0x22b404=0x0;_0x22b404<_0x330270[_0x8cfa('0x7d')];_0x22b404+=0x1){var _0x358960=this[_0x8cfa('0xd')]['getVariable'](util[_0x8cfa('0x27')](_0x8cfa('0x11a'),_0x330270[_0x22b404]));if(_0x358960[_0x8cfa('0x81')]===-0x1){return _0x358960;}logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')](_0x8cfa('0x11b'),_0x330270[_0x22b404],_0x358960[_0x8cfa('0x84')]));if(_0x358960[_0x8cfa('0x84')]===_0x8cfa('0x112')){logger[_0x8cfa('0x2f')](util['format'](_0x8cfa('0x11b'),_0x330270[_0x22b404],_0x8cfa('0x112')));this[_0x8cfa('0xd')][_0x8cfa('0x9a')](util['format'](_0x8cfa('0x11b'),_0x330270[_0x22b404],_0x8cfa('0x112')));return{'code':0xc8,'result':_0x8cfa('0x112')};}else{logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')](_0x8cfa('0x11b'),_0x330270[_0x22b404],'false'));this[_0x8cfa('0xd')]['noop'](util['format'](_0x8cfa('0x11b'),_0x330270[_0x22b404],_0x8cfa('0x113')));}}return{'code':0xc8,'result':_0x8cfa('0x113')};};AGIVertices[_0x8cfa('0x13')]['hangup']=function(_0x195d18){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')](_0x8cfa('0x11c'),_0x195d18[_0x8cfa('0x89')]));return this['channel'][_0x8cfa('0x11d')]();};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x11e')]=function(_0xe907f0){logger[_0x8cfa('0x2f')](util['format'](_0x8cfa('0x11f'),_0xe907f0['label']));if(!this[_0x8cfa('0x66')](_0xe907f0[_0x8cfa('0x5d')])){return this['channel'][_0x8cfa('0x9a')](_0x8cfa('0xfc'));}var _0x2c1258=_0x8cfa('0xfd');var _0x4ef3f3=util[_0x8cfa('0x27')](_0x8cfa('0xfe'),FILES_PATH,rs[_0x8cfa('0xe4')](0x4));var _0x5095d6=util['format']('%s.%s',_0x4ef3f3,_0x2c1258);var _0x21ac10=!![];if(_0xe907f0[_0x8cfa('0x100')]===_0x8cfa('0x101')){_0x21ac10=![];}var _0x4c40e7=this[_0x8cfa('0xd')][_0x8cfa('0x102')](_0x4ef3f3,_0x2c1258,_0xe907f0[_0x8cfa('0x120')],_0xe907f0[_0x8cfa('0x8d')],undefined,_0x21ac10);if(_0x4c40e7[_0x8cfa('0x81')]!==-0x1){this[_0x8cfa('0xd')][_0x8cfa('0x9a')](util[_0x8cfa('0x27')]('ispeech\x20%s\x20file\x20created',_0x5095d6));var _0x302a25=this[_0x8cfa('0x64')][_0x8cfa('0x85')](this,_0xe907f0,_0x5095d6);if(_0x302a25){for(var _0x3a4cd1 in _0x302a25){if(_0x302a25[_0x8cfa('0x7a')](_0x3a4cd1)){this['channel'][_0x8cfa('0x83')](util[_0x8cfa('0x27')](_0x8cfa('0x121'),_0x3a4cd1[_0x8cfa('0xbe')]()),_0x302a25[_0x3a4cd1]);}}return this[_0x8cfa('0xd')][_0x8cfa('0x9a')](util[_0x8cfa('0x27')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x302a25)));}}return _0x4c40e7;};AGIVertices[_0x8cfa('0x13')]['ispeechtts']=function(_0x50e4f3){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x50e4f3[_0x8cfa('0x89')]));if(!this[_0x8cfa('0x66')](_0x50e4f3[_0x8cfa('0x5d')])){return this[_0x8cfa('0xd')][_0x8cfa('0x9a')](_0x8cfa('0xfc'));}if(!this[_0x8cfa('0x66')](_0x50e4f3[_0x8cfa('0x5e')])){return this[_0x8cfa('0xd')][_0x8cfa('0x9a')](_0x8cfa('0x98'));}this[_0x8cfa('0xd')]['noop'](util[_0x8cfa('0x27')](_0x8cfa('0x122'),_0x50e4f3[_0x8cfa('0x5e')]));var _0x2a23f7=this[_0x8cfa('0x61')][_0x8cfa('0x85')](this,_0x50e4f3);if(_0x2a23f7){this[_0x8cfa('0xd')][_0x8cfa('0x9a')](util[_0x8cfa('0x27')](_0x8cfa('0x123'),_0x2a23f7));var _0x36ecb3=this[_0x8cfa('0xd')][_0x8cfa('0xed')](_0x2a23f7,_0x50e4f3[_0x8cfa('0x120')]);try{fs[_0x8cfa('0xee')](_0x2a23f7+_0x8cfa('0x124'));}catch(_0x213136){logger['error'](_0x213136);}return _0x36ecb3;}return this['channel'][_0x8cfa('0x2b')](_0x50e4f3,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x8cfa('0x125')]=function(_0x5e67fd){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')](_0x8cfa('0x126'),_0x5e67fd[_0x8cfa('0x89')]));if(!this['isConfigured'](_0x5e67fd[_0x8cfa('0x127')])){return this[_0x8cfa('0xd')][_0x8cfa('0x2b')](_0x5e67fd,_0x8cfa('0x128'));}logger[_0x8cfa('0x2f')](util['format'](_0x8cfa('0x129'),this['channel'][_0x8cfa('0x36')],_0x5e67fd[_0x8cfa('0x127')]));var _0x19c01f=this[_0x8cfa('0x52')][_0x8cfa('0x85')](this,_0x5e67fd[_0x8cfa('0x127')]);if(_0x19c01f){logger['info'](util['format'](_0x8cfa('0x12a'),this[_0x8cfa('0xd')]['callerid'],_0x5e67fd['findBy']));this[_0x8cfa('0xd')][_0x8cfa('0x9a')](util[_0x8cfa('0x27')](_0x8cfa('0x12a'),this[_0x8cfa('0xd')]['callerid'],_0x5e67fd[_0x8cfa('0x127')]));return{'code':0xc8,'result':'success'};}else{logger[_0x8cfa('0x2f')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x8cfa('0x36')],_0x5e67fd[_0x8cfa('0x127')]));this[_0x8cfa('0xd')]['noop'](util[_0x8cfa('0x27')](_0x8cfa('0x12b'),this[_0x8cfa('0xd')][_0x8cfa('0x36')],_0x5e67fd[_0x8cfa('0x127')]));return{'code':0xc8,'result':_0x8cfa('0x12c')};}};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x12d')]=function(_0x7ce421){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')](_0x8cfa('0x12e'),_0x7ce421[_0x8cfa('0x89')]));if(!this['isConfigured'](_0x7ce421['findBy'])){return this[_0x8cfa('0xd')][_0x8cfa('0x2b')](_0x7ce421,_0x8cfa('0x128'));}logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8cfa('0xd')][_0x8cfa('0x36')],_0x7ce421[_0x8cfa('0x127')]));var _0x48cdd5=this['agentLogout'][_0x8cfa('0x85')](this,_0x7ce421['findBy']);if(_0x48cdd5){logger['info'](util[_0x8cfa('0x27')](_0x8cfa('0x12a'),this['channel'][_0x8cfa('0x36')],_0x7ce421[_0x8cfa('0x127')]));this[_0x8cfa('0xd')][_0x8cfa('0x9a')](util[_0x8cfa('0x27')](_0x8cfa('0x12a'),this[_0x8cfa('0xd')][_0x8cfa('0x36')],_0x7ce421['findBy']));return{'code':0xc8,'result':_0x8cfa('0x12f')};}else{logger['info'](util[_0x8cfa('0x27')](_0x8cfa('0x12b'),this[_0x8cfa('0xd')][_0x8cfa('0x36')],_0x7ce421['findBy']));this['channel'][_0x8cfa('0x9a')](util['format'](_0x8cfa('0x12b'),this[_0x8cfa('0xd')][_0x8cfa('0x36')],_0x7ce421[_0x8cfa('0x127')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x130')]=function(_0x16c61b){logger['info'](util['format'](_0x8cfa('0x131'),_0x16c61b[_0x8cfa('0x89')]));if(!this['isConfigured'](_0x16c61b[_0x8cfa('0x132')])){return this[_0x8cfa('0xd')][_0x8cfa('0x2b')](_0x16c61b,_0x8cfa('0x133'));}this[_0x8cfa('0xd')]['noop'](util[_0x8cfa('0x27')](_0x8cfa('0x134'),_0x16c61b['operation']));var _0x3e105d=eval(_0x16c61b[_0x8cfa('0x132')]);if(!this['isConfigured'](_0x16c61b['variable_id'])){return this['channel'][_0x8cfa('0x9a')](_0x8cfa('0xdd'));}var _0xc2f64e=this[_0x8cfa('0xaf')][_0x8cfa('0x85')](this,_0x16c61b['variable_id']);if(!_0xc2f64e){return this[_0x8cfa('0xd')][_0x8cfa('0x2b')](_0x16c61b,_0x8cfa('0xb0'));}if(_[_0x8cfa('0x135')](_0x3e105d)){var _0xdb2983=this;_0x3e105d[_0x8cfa('0x136')](function(_0x256a6a,_0x12f1e7){_0xdb2983[_0x8cfa('0xd')][_0x8cfa('0x83')](util[_0x8cfa('0x27')]('%s[%s]',_0xc2f64e,_0x12f1e7),_0x256a6a);});return this[_0x8cfa('0xd')][_0x8cfa('0x9a')](util[_0x8cfa('0x27')](_0x8cfa('0x137'),_0xc2f64e));}else{return this[_0x8cfa('0xd')][_0x8cfa('0x83')](_0xc2f64e,_0x3e105d);}};AGIVertices[_0x8cfa('0x13')]['menu']=function(_0x2d9126){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')](_0x8cfa('0x138'),_0x2d9126['label']));if(_0x2d9126[_0x8cfa('0x86')]===0x0){return this[_0x8cfa('0x87')](_0x2d9126);}_0x2d9126[_0x8cfa('0x86')]-=0x1;if(!this[_0x8cfa('0x66')](_0x2d9126[_0x8cfa('0xdb')])){return this[_0x8cfa('0xd')][_0x8cfa('0x2b')](_0x2d9126,_0x8cfa('0xda'));}var _0x12b9ca=this[_0x8cfa('0x1c')][_0x8cfa('0x85')](this,_0x2d9126[_0x8cfa('0xdb')]);if(!_0x12b9ca){return this['channel']['error'](_0x2d9126,_0x8cfa('0x139'));}var _0x1bdfdc=this[_0x8cfa('0xd')]['getData'](_0x12b9ca,_0x2d9126[_0x8cfa('0xde')],_0x2d9126[_0x8cfa('0x13a')]);var _0x5a704=_0x1bdfdc[_0x8cfa('0x81')];if(_0x1bdfdc[_0x8cfa('0x81')]===-0x1){this[_0x8cfa('0x35')][_0x8cfa('0x85')](this,_0x2d9126,'-1');return _0x1bdfdc;}else if(_0x1bdfdc['extra']===_0x8cfa('0x8d')){_0x1bdfdc[_0x8cfa('0x81')]=_0x1bdfdc[_0x8cfa('0x81')][_0x8cfa('0x7d')]>0x0?_0x1bdfdc[_0x8cfa('0x81')]:'t';}else if(_['isEmpty'](_0x1bdfdc[_0x8cfa('0x81')])){_0x1bdfdc[_0x8cfa('0x81')]='#';_0x5a704='#';}if(!this[_0x8cfa('0x66')](_0x2d9126[_0x8cfa('0xdc')])){this['channel'][_0x8cfa('0x9a')](_0x8cfa('0xdd'));}else{var _0x336944=this['getVariable']['sync'](this,_0x2d9126[_0x8cfa('0xdc')]);if(!_0x336944){return this[_0x8cfa('0xd')][_0x8cfa('0x2b')](_0x2d9126,'no\x20variable\x20found');}this[_0x8cfa('0xd')][_0x8cfa('0x83')](_0x336944,_0x5a704);}this[_0x8cfa('0x35')][_0x8cfa('0x85')](this,_0x2d9126,_0x5a704);return _0x1bdfdc;};AGIVertices['prototype'][_0x8cfa('0x9a')]=function(_0x5ebb55){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')](_0x8cfa('0x13b'),_0x5ebb55[_0x8cfa('0x89')]));return this[_0x8cfa('0xd')][_0x8cfa('0x9a')](_0x5ebb55['output']||_0x5ebb55[_0x8cfa('0x89')]);};AGIVertices['prototype']['pause']=function(_0x8f533b){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x8f533b[_0x8cfa('0x89')]));if(!this[_0x8cfa('0x66')](_0x8f533b[_0x8cfa('0x127')])){return this['channel'][_0x8cfa('0x2b')](_0x8f533b,_0x8cfa('0x128'));}logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0x8f533b[_0x8cfa('0x127')]));var _0x4b0672=this['getPause'][_0x8cfa('0x85')](this,_0x8f533b[_0x8cfa('0x13c')]);var _0x3f5d34=this[_0x8cfa('0x4e')]['sync'](this,_0x8f533b[_0x8cfa('0x127')],_0x4b0672);if(_0x3f5d34){logger['info'](util[_0x8cfa('0x27')](_0x8cfa('0x12a'),this[_0x8cfa('0xd')][_0x8cfa('0x36')],_0x8f533b['findBy']));this['channel'][_0x8cfa('0x9a')](util[_0x8cfa('0x27')](_0x8cfa('0x12a'),this[_0x8cfa('0xd')][_0x8cfa('0x36')],_0x8f533b['findBy']));return{'code':0xc8,'result':_0x8cfa('0x12f')};}else{logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')](_0x8cfa('0x12b'),this[_0x8cfa('0xd')][_0x8cfa('0x36')],_0x8f533b[_0x8cfa('0x127')]));this[_0x8cfa('0xd')][_0x8cfa('0x9a')](util[_0x8cfa('0x27')](_0x8cfa('0x12a'),this[_0x8cfa('0xd')]['callerid'],_0x8f533b[_0x8cfa('0x127')]));return{'code':0xc8,'result':_0x8cfa('0x12c')};}};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x13d')]=function(_0x3c8453){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')](_0x8cfa('0x13e'),_0x3c8453[_0x8cfa('0x89')]));if(!this['isConfigured'](_0x3c8453['file_id'])){return this['channel'][_0x8cfa('0x2b')](_0x3c8453,'no\x20file\x20audio\x20selected');}var _0x2ddac5=this[_0x8cfa('0x1c')][_0x8cfa('0x85')](this,_0x3c8453[_0x8cfa('0xdb')]);if(!_0x2ddac5){return this[_0x8cfa('0xd')]['error'](_0x3c8453,_0x8cfa('0x139'));}var _0x466b50=this[_0x8cfa('0xd')][_0x8cfa('0x57')](_0x8cfa('0x13f'),[_0x2ddac5,_0x3c8453[_0x8cfa('0xb9')]]);if(_0x466b50['result']===-0x1){return _0x466b50;}return this['channel'][_0x8cfa('0x9a')](util[_0x8cfa('0x27')](_0x8cfa('0x140'),_0x8cfa('0x13f'),_0x2ddac5));};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x141')]=function(_0x32272f){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x32272f[_0x8cfa('0x89')]));if(!this[_0x8cfa('0x66')](_0x32272f['queue_id'])){return this['channel'][_0x8cfa('0x2b')](_0x32272f,_0x8cfa('0x142'));}var _0x5c3452='';var _0x28173c=parseInt(_0x32272f[_0x8cfa('0x143')],0xa);if(isNaN(_0x28173c)){_0x5c3452=_0x32272f[_0x8cfa('0x143')];}else{_0x5c3452=this[_0x8cfa('0x144')]['sync'](this,_0x32272f['queue_id']);if(!_0x5c3452){return this[_0x8cfa('0xd')][_0x8cfa('0x2b')](_0x32272f,'no\x20queue\x20found');}}var _0x17de59='';if(this[_0x8cfa('0x66')](_0x32272f[_0x8cfa('0xdb')])){var _0x1d73d3=this[_0x8cfa('0x1c')][_0x8cfa('0x85')](this,_0x32272f[_0x8cfa('0xdb')]);if(_0x1d73d3){_0x17de59=_0x1d73d3;}}this[_0x8cfa('0x35')]['sync'](this,_0x32272f,_0x5c3452);if(_0x32272f[_0x8cfa('0xb9')][_0x8cfa('0x145')]('x')<0x0){_0x32272f[_0x8cfa('0xb9')]+='x';}if(_0x32272f['opts'][_0x8cfa('0x145')]('X')<0x0){_0x32272f['opts']+='X';}this['channel']['setVariable']('XMCS-QUEUE',_0x5c3452?_0x5c3452['toLowerCase']():'');var _0x4e4fd4=this['channel'][_0x8cfa('0x57')]('QUEUE',[_0x5c3452,_0x32272f[_0x8cfa('0xb9')],_0x32272f['url'],_0x17de59,_0x32272f[_0x8cfa('0x8d')],_0x32272f[_0x8cfa('0x8')],_0x32272f[_0x8cfa('0x146')],_0x32272f[_0x8cfa('0x147')],'',_0x32272f['position']]);if(_0x4e4fd4[_0x8cfa('0x81')]===-0x1){return _0x4e4fd4;}return this[_0x8cfa('0xd')][_0x8cfa('0x9a')](util[_0x8cfa('0x27')](_0x8cfa('0x140'),_0x8cfa('0x148'),_0x5c3452));};AGIVertices['prototype'][_0x8cfa('0x149')]=function(_0x53a947){logger[_0x8cfa('0x2f')](util['format'](_0x8cfa('0x14a'),_0x53a947[_0x8cfa('0x89')]));var _0x9386df=_0x53a947[_0x8cfa('0x14b')]||'wav';var _0x1c07ff=util[_0x8cfa('0x27')](_0x8cfa('0x14c'),this[_0x8cfa('0xd')][_0x8cfa('0x47')],rs[_0x8cfa('0xe4')](0x5));var _0x431037=util[_0x8cfa('0x27')]('%s/recordings/%s.%s',FILES_PATH,_0x1c07ff,_0x9386df);var _0x23ce38=util[_0x8cfa('0x27')](_0x8cfa('0xfe'),FILES_PATH,_0x1c07ff);this[_0x8cfa('0x37')]['sync'](this,_0x53a947,_0x1c07ff,_0x431037);this['channel']['setVariable'](_0x8cfa('0x14d'),_0x1c07ff);logger[_0x8cfa('0x2f')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x23ce38,_0x9386df,_0x53a947[_0x8cfa('0x14e')],_0x53a947[_0x8cfa('0x8d')]);return this['channel']['recordFile'](_0x23ce38,_0x9386df,_0x53a947[_0x8cfa('0x14e')],_0x53a947['timeout'],undefined,!![]);};AGIVertices['prototype'][_0x8cfa('0x14f')]=function(_0x24674c){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x24674c[_0x8cfa('0x89')]));return this[_0x8cfa('0xd')][_0x8cfa('0x150')](_0x24674c['digits']['replace'](/\s+/g,''),_0x24674c['escape_digits']);};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x151')]=function(_0x40ee70){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')](_0x8cfa('0x152'),_0x40ee70[_0x8cfa('0x89')]));return this[_0x8cfa('0xd')][_0x8cfa('0x153')](_0x40ee70[_0x8cfa('0x154')][_0x8cfa('0x59')](/\s+/g,''),_0x40ee70[_0x8cfa('0x14e')]);};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x155')]=function(_0xbadc24){logger['info'](util['format'](_0x8cfa('0x156'),_0xbadc24['label']));return this[_0x8cfa('0xd')][_0x8cfa('0x157')](_0xbadc24[_0x8cfa('0x5e')],_0xbadc24[_0x8cfa('0x14e')]);};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x158')]=function(_0x43e976){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')](_0x8cfa('0x159'),_0x43e976[_0x8cfa('0x89')]));if(!this[_0x8cfa('0x66')](_0x43e976[_0x8cfa('0x15a')])){return this[_0x8cfa('0xd')][_0x8cfa('0x9a')](_0x8cfa('0x15b'));}var _0x3a20d1=this[_0x8cfa('0x1f')][_0x8cfa('0x85')](this,_0x43e976['account_id']);if(!_0x3a20d1||!_0x3a20d1[_0x8cfa('0x15c')]){return this['channel']['error'](_0x43e976,'no\x20mail\x20account\x20found');}var _0x3b1c74={'from':util['format']('\x22%s\x22\x20<%s>',_0x3a20d1['name'],_0x3a20d1[_0x8cfa('0x15d')]||_0x3a20d1[_0x8cfa('0x15c')][_0x8cfa('0x15e')]),'to':_0x43e976['to']||'','cc':_0x43e976['cc']||'','bcc':_0x43e976[_0x8cfa('0x15f')]||'','subject':_0x43e976[_0x8cfa('0x160')],'html':_0x43e976[_0x8cfa('0x5e')],'text':_0x43e976[_0x8cfa('0x5e')]};var _0x3d60cf={'tls':{'rejectUnauthorized':![]}};if(_0x3a20d1[_0x8cfa('0x15c')][_0x8cfa('0x161')]){_0x3d60cf[_0x8cfa('0x161')]=_0x3a20d1[_0x8cfa('0x15c')][_0x8cfa('0x161')];}else{_0x3d60cf[_0x8cfa('0x162')]=_0x3a20d1[_0x8cfa('0x15c')]['host'];_0x3d60cf[_0x8cfa('0x163')]=_0x3a20d1[_0x8cfa('0x15c')][_0x8cfa('0x163')];_0x3d60cf['secure']=_0x3a20d1[_0x8cfa('0x15c')][_0x8cfa('0x164')];}if(_0x3a20d1['Smtp'][_0x8cfa('0x165')]){_0x3d60cf['auth']={'user':_0x3a20d1[_0x8cfa('0x15c')]['user'],'pass':_0x3a20d1[_0x8cfa('0x15c')][_0x8cfa('0x166')]};}if(this[_0x8cfa('0x66')](_0x43e976[_0x8cfa('0x167')])){}logger[_0x8cfa('0xb3')](_0x8cfa('0x168'),JSON['stringify'](_0x3b1c74));this[_0x8cfa('0x35')][_0x8cfa('0x85')](this,_0x43e976,_0x43e976['account_id']);this[_0x8cfa('0xd')][_0x8cfa('0x9a')](util[_0x8cfa('0x27')](_0x8cfa('0x169'),_0x3a20d1[_0x8cfa('0x11')]));this[_0x8cfa('0x21')][_0x8cfa('0x85')](this,_0x3d60cf,_0x3b1c74);return this[_0x8cfa('0xd')][_0x8cfa('0x9a')](_0x8cfa('0x16a'));};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x16b')]=function(_0x13e18e){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')](_0x8cfa('0x16c'),_0x13e18e[_0x8cfa('0x89')]));return this[_0x8cfa('0xd')][_0x8cfa('0x9a')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x16d')]=function(_0x4818cd){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')](_0x8cfa('0x16e'),_0x4818cd['label']));if(!this[_0x8cfa('0x66')](_0x4818cd[_0x8cfa('0x16f')])){return this[_0x8cfa('0xd')][_0x8cfa('0x9a')](_0x8cfa('0x170'));}var _0x5a1890=this['getSmsAccount'][_0x8cfa('0x85')](this,_0x4818cd['sms_account_id']);if(!_0x5a1890){return this[_0x8cfa('0xd')]['error'](_0x4818cd,_0x8cfa('0x171'));}var _0x4a9f85={'body':_0x4818cd[_0x8cfa('0x172')],'phone':_0x4818cd['to']||'','SmsAccountId':_0x5a1890['id']};logger[_0x8cfa('0xb3')](_0x8cfa('0x173'),JSON[_0x8cfa('0xe1')](_0x4a9f85));this['createSquareDetailsReport'][_0x8cfa('0x85')](this,_0x4818cd,_0x4818cd[_0x8cfa('0x16f')]);this[_0x8cfa('0xd')][_0x8cfa('0x9a')](util[_0x8cfa('0x27')](_0x8cfa('0x174'),_0x5a1890[_0x8cfa('0x11')]));this[_0x8cfa('0x34')][_0x8cfa('0x85')](this,_0x4a9f85);return this[_0x8cfa('0xd')]['noop'](_0x8cfa('0x175'));};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x176')]=function(_0x37b418){logger[_0x8cfa('0x2f')](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x37b418['label']));if(!this[_0x8cfa('0x66')](_0x37b418[_0x8cfa('0xdc')])){return this['channel'][_0x8cfa('0x2b')](_0x37b418,_0x8cfa('0x177'));}var _0xd2bf1a=this[_0x8cfa('0xaf')][_0x8cfa('0x85')](this,_0x37b418[_0x8cfa('0xdc')]);if(!_0xd2bf1a){return this[_0x8cfa('0xd')]['error'](_0x37b418,'no\x20variable\x20found');}return this[_0x8cfa('0xd')][_0x8cfa('0x83')](_0xd2bf1a,_0x37b418[_0x8cfa('0x178')]);};AGIVertices['prototype'][_0x8cfa('0x179')]=function(_0x36f90d){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')]('Enter\x20in\x20START\x20(%s)\x20block',_0x36f90d[_0x8cfa('0x89')]));this[_0x8cfa('0xd')][_0x8cfa('0x9a')](_0x8cfa('0x17a'));if(_0x36f90d[_0x8cfa('0x8f')]===_0x8cfa('0x17b')){this[_0x8cfa('0xd')][_0x8cfa('0x9a')](_0x8cfa('0x17c'));return this[_0x8cfa('0xd')][_0x8cfa('0x8f')]();}return this['channel']['noop'](_0x8cfa('0x17d'));};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x17e')]=function(_0x224a78){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x224a78[_0x8cfa('0x89')]));if(!this['isConfigured'](_0x224a78[_0x8cfa('0x17f')])){return this[_0x8cfa('0xd')][_0x8cfa('0x2b')](_0x224a78,_0x8cfa('0x180'));}var _0x54624b=this[_0x8cfa('0x181')][_0x8cfa('0x85')](this,_0x224a78[_0x8cfa('0x17f')]);if(!this[_0x8cfa('0x66')](_0x54624b)){return this[_0x8cfa('0xd')][_0x8cfa('0x2b')](_0x224a78,util[_0x8cfa('0x27')](_0x8cfa('0x182'),_0x224a78[_0x8cfa('0x17f')]));}if(_0x54624b===this['channel'][_0x8cfa('0x3d')]){return this[_0x8cfa('0xd')][_0x8cfa('0x2b')](_0x224a78,_0x8cfa('0x183'));}this[_0x8cfa('0x35')][_0x8cfa('0x85')](this,_0x224a78,_0x54624b);var _0x227eb7=this[_0x8cfa('0xd')]['exec'](_0x8cfa('0x184'),util[_0x8cfa('0x27')](_0x8cfa('0x185'),config['agi'][_0x8cfa('0x162')]||_0x8cfa('0x186'),_0x54624b,this[_0x8cfa('0xd')][_0x8cfa('0x3d')]));if(_0x227eb7[_0x8cfa('0x81')]===-0x1){return _0x227eb7;}return this['channel'][_0x8cfa('0x9a')](util[_0x8cfa('0x27')]('Executed\x20command\x20%s\x20%s',_0x8cfa('0x184'),_0x54624b));};AGIVertices[_0x8cfa('0x13')]['system']=function(_0x5b2500){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')](_0x8cfa('0x187'),_0x5b2500[_0x8cfa('0x89')]));var _0x34d2b4=this['shellCommand'][_0x8cfa('0x85')](this,_0x5b2500['command']);this[_0x8cfa('0x35')][_0x8cfa('0x85')](this,_0x5b2500,_0x5b2500[_0x8cfa('0x8a')]);if(this[_0x8cfa('0x66')](_0x5b2500['variable_id'])){var _0x45f3a8=this[_0x8cfa('0xaf')][_0x8cfa('0x85')](this,_0x5b2500[_0x8cfa('0xdc')]);if(_0x45f3a8){this[_0x8cfa('0xd')][_0x8cfa('0x83')](_0x45f3a8,_0x34d2b4);return this[_0x8cfa('0xd')][_0x8cfa('0x9a')](util['format'](_0x8cfa('0x188'),_0x5b2500['command'],_0x45f3a8));}}return this['channel'][_0x8cfa('0x9a')](util[_0x8cfa('0x27')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x5b2500[_0x8cfa('0x8a')]));};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x189')]=function(_0x2dfca6){logger['info'](util[_0x8cfa('0x27')](_0x8cfa('0x18a'),_0x2dfca6[_0x8cfa('0x89')]));if(!this[_0x8cfa('0x66')](_0x2dfca6[_0x8cfa('0x5e')])){return this[_0x8cfa('0xd')][_0x8cfa('0x9a')](_0x8cfa('0x98'));}this[_0x8cfa('0xd')][_0x8cfa('0x9a')](util[_0x8cfa('0x27')](_0x8cfa('0x18b'),_0x2dfca6[_0x8cfa('0x5e')]));var _0x830a64=this[_0x8cfa('0x5a')][_0x8cfa('0x85')](this,_0x2dfca6);if(_0x830a64){this[_0x8cfa('0xd')][_0x8cfa('0x9a')](util[_0x8cfa('0x27')](_0x8cfa('0x18c'),_0x830a64));var _0x1eacf2=this['channel'][_0x8cfa('0xed')](_0x830a64);try{fs[_0x8cfa('0xee')](_0x830a64+_0x8cfa('0x124'));}catch(_0x2bd8d0){logger[_0x8cfa('0x2b')](_0x2bd8d0);}return _0x1eacf2;}return this[_0x8cfa('0xd')][_0x8cfa('0x2b')](_0x2dfca6,_0x8cfa('0x18d'));};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x18e')]=function(_0x587ca1){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')](_0x8cfa('0x18f'),_0x587ca1[_0x8cfa('0x89')]));if(!this['isConfigured'](_0x587ca1['findBy'])){return this[_0x8cfa('0xd')][_0x8cfa('0x2b')](_0x587ca1,_0x8cfa('0x128'));}logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')](_0x8cfa('0x129'),this['channel']['callerid'],_0x587ca1[_0x8cfa('0x127')]));var _0x31e966=this[_0x8cfa('0x50')]['sync'](this,_0x587ca1[_0x8cfa('0x127')]);if(_0x31e966){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8cfa('0xd')][_0x8cfa('0x36')],_0x587ca1[_0x8cfa('0x127')]));this[_0x8cfa('0xd')][_0x8cfa('0x9a')](util[_0x8cfa('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8cfa('0xd')]['callerid'],_0x587ca1[_0x8cfa('0x127')]));return{'code':0xc8,'result':_0x8cfa('0x12f')};}else{logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')](_0x8cfa('0x12b'),this[_0x8cfa('0xd')][_0x8cfa('0x36')],_0x587ca1[_0x8cfa('0x127')]));this[_0x8cfa('0xd')]['noop'](util[_0x8cfa('0x27')](_0x8cfa('0x12b'),this[_0x8cfa('0xd')][_0x8cfa('0x36')],_0x587ca1['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x190')]=function(_0x4562a0){logger[_0x8cfa('0x2f')](util[_0x8cfa('0x27')](_0x8cfa('0x191'),_0x4562a0[_0x8cfa('0x89')]));var _0x12207e=this[_0x8cfa('0xd')][_0x8cfa('0x57')](_0x8cfa('0x192'),[_0x4562a0[_0x8cfa('0x193')],_0x4562a0[_0x8cfa('0x99')]]);if(_0x12207e[_0x8cfa('0x81')]===-0x1){return _0x12207e;}return this[_0x8cfa('0xd')]['noop'](util[_0x8cfa('0x27')](_0x8cfa('0x140'),_0x8cfa('0x192'),_0x4562a0['mailbox']));};AGIVertices[_0x8cfa('0x13')][_0x8cfa('0x194')]=function(_0xd3774c){logger['info'](util[_0x8cfa('0x27')](_0x8cfa('0x195'),_0xd3774c[_0x8cfa('0x89')]));if(!this[_0x8cfa('0x66')](_0xd3774c[_0x8cfa('0xdc')])){return this[_0x8cfa('0xd')][_0x8cfa('0x2b')](_0xd3774c,_0x8cfa('0x177'));}var _0x52f445=this[_0x8cfa('0xaf')][_0x8cfa('0x85')](this,_0xd3774c[_0x8cfa('0xdc')]);if(!_0x52f445){return this[_0x8cfa('0xd')][_0x8cfa('0x2b')](_0xd3774c,'no\x20variable\x20found');}var _0xc906e2=this['channel'][_0x8cfa('0xaf')](_0x52f445);return{'code':0xc8,'result':_0xc906e2['extra']?_0xc906e2['extra']:'-'};};String[_0x8cfa('0x13')]['replaceAll']=function(_0x3e21a8,_0x12c5b7){return this[_0x8cfa('0x7e')](_0x3e21a8)[_0x8cfa('0x196')](_0x12c5b7);};module[_0x8cfa('0x197')]=AGIVertices; \ No newline at end of file +var _0x75f2=['user','subject','service','host','port','secure','authentication','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','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','answer','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20no\x20stored','tts','.wav','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','util','lodash','odbc','randomstring','moment','mustache','../../config/logger','agi','./scripts','/var/opt/motion2/server/files','menu','channel','rpc','mailRpc','prototype','getVariableById','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','IntervalId','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','calleridname','context','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','scheduledAt','callback','toString','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','%s/%s@from-sip/n','shellCommand','replace','googleTTS','text','google_tts_language','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','uri','clear','includes','isString','replaceAllVariables','split','length','replaceAll','getVariable','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','setVariable','maxRetry','retry','Enter\x20in\x20AGI\x20(%s)\x20block','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','timeout','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','add','minutes','callback_priority','sync','noop','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','exec','options','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','database','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','hasOwnProperty','DIALOGFLOW_%s','toUpperCase','speech','sesteknda','username','password','no\x20password\x20configured','SESTEK_NDA_%s','out','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','url','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','generate','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_access_key_id','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','unlink','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','%s.%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','%s/recordings/%s','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','stringify','Enter\x20in\x20GOTO\x20(%s)\x20block','gotoif','condition','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','findBy','agentLogin','AGENT\x20%s\x20FOUND\x20BY','success','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20NOT\x20FOUND\x20BY','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','isArray','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','file_id','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','failure','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x75f2,0x1ca));var _0x275f=function(_0x37edaa,_0xec4303){_0x37edaa=_0x37edaa-0x0;var _0x11e262=_0x75f2[_0x37edaa];return _0x11e262;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x275f('0x0'));var _=require(_0x275f('0x1'));var sh=require('shelljs');var odbc=require(_0x275f('0x2'))();var rs=require(_0x275f('0x3'));var moment=require(_0x275f('0x4'));var Mustache=require(_0x275f('0x5'));var logger=require(_0x275f('0x6'))(_0x275f('0x7'));var config=require('../../config/environment');var scripts=require(_0x275f('0x8'));var FILES_PATH=_0x275f('0x9');var verticesWithRetry=[_0x275f('0xa'),'getdigits','getsecretdigits'];var AGIVertices=function(_0x175630,_0x1ae68b,_0x5f155e){this[_0x275f('0xb')]=_0x175630;this[_0x275f('0xc')]=_0x1ae68b;this[_0x275f('0xd')]=_0x5f155e;};AGIVertices[_0x275f('0xe')]['getVariable']=function(_0x3a2cc4,_0x5eea0a){this[_0x275f('0xc')][_0x275f('0xf')](_0x3a2cc4)[_0x275f('0x10')](function(_0x120554){_0x5eea0a(null,_0x120554?_0x120554[_0x275f('0x11')]:![]);})['catch'](function(_0xfa60ab){_0x5eea0a(_0xfa60ab);});};AGIVertices[_0x275f('0xe')][_0x275f('0x12')]=function(_0x29d738,_0x5a907b){this['rpc'][_0x275f('0x13')](_0x29d738)['then'](function(_0x4635f3){_0x5a907b(null,_0x4635f3?_0x4635f3[_0x275f('0x11')]:![]);})[_0x275f('0x14')](function(_0xf216a5){_0x5a907b(_0xf216a5);});};AGIVertices[_0x275f('0xe')][_0x275f('0x15')]=function(_0x29eea6,_0x324187){this[_0x275f('0xc')][_0x275f('0x16')](_0x29eea6)['then'](function(_0x4be215){_0x324187(null,_0x4be215?_0x4be215[_0x275f('0x11')]:![]);})['catch'](function(_0x214de){_0x324187(_0x214de);});};AGIVertices[_0x275f('0xe')][_0x275f('0x17')]=function(_0x5b8a11,_0x523956){this['rpc'][_0x275f('0x18')](_0x5b8a11)[_0x275f('0x10')](function(_0x545140){_0x523956(null,_0x545140?_0x545140[_0x275f('0x19')]:![]);})[_0x275f('0x14')](function(_0x36a154){_0x523956(_0x36a154);});};AGIVertices[_0x275f('0xe')][_0x275f('0x1a')]=function(_0x24e569,_0x5a18e1){this[_0x275f('0xc')][_0x275f('0x1b')](_0x24e569)[_0x275f('0x10')](function(_0x437a6a){_0x5a18e1(null,_0x437a6a?_0x437a6a[_0x275f('0x11')]:![]);})[_0x275f('0x14')](function(_0x10f775){_0x5a18e1(_0x10f775);});};AGIVertices[_0x275f('0xe')][_0x275f('0x1c')]=function(_0x252aa0,_0x2f68cb){this[_0x275f('0xc')][_0x275f('0x1d')](_0x252aa0)[_0x275f('0x10')](function(_0x1bfca8){_0x2f68cb(null,_0x1bfca8?_0x1bfca8[_0x275f('0x11')]:![]);})[_0x275f('0x14')](function(_0x3e768e){_0x2f68cb(_0x3e768e);});};AGIVertices[_0x275f('0xe')]['getSound']=function(_0x563fbc,_0x815bcb){var _0x6a45b0=this;this[_0x275f('0xc')][_0x275f('0x1e')](_0x563fbc)[_0x275f('0x10')](function(_0x5ebbdb){_0x815bcb(null,_0x5ebbdb?_0x6a45b0[_0x275f('0x1f')](_0x5ebbdb[_0x275f('0x20')]):![]);})[_0x275f('0x14')](function(_0x5b9fe9){_0x815bcb(_0x5b9fe9);});};AGIVertices[_0x275f('0xe')][_0x275f('0x21')]=function(_0x1da392,_0x567d24){this[_0x275f('0xc')][_0x275f('0x22')](_0x1da392)['then'](function(_0x38e7d2){_0x567d24(null,_0x38e7d2?_0x38e7d2:![]);})[_0x275f('0x14')](function(_0x17d71b){_0x567d24(_0x17d71b);});};AGIVertices[_0x275f('0xe')]['sendMailMessage']=function(_0x36beb3,_0x12fd85,_0x5460c5){this[_0x275f('0xd')][_0x275f('0x23')](_0x36beb3,_0x12fd85)[_0x275f('0x10')](function(){_0x5460c5(null);})['catch'](function(_0x5cc40b){_0x5460c5(_0x5cc40b);});};AGIVertices[_0x275f('0xe')]['getIntervals']=function(_0x570397,_0x58fe85){this['rpc']['getIntervalById'](_0x570397)[_0x275f('0x10')](function(_0x51ae50){if(_0x51ae50){if(_0x51ae50[_0x275f('0x24')]){_0x58fe85(null,[_0x51ae50['interval']]);}else{_0x58fe85(null,_[_0x275f('0x25')](_0x51ae50[_0x275f('0x26')],'interval'));}}else{_0x58fe85(null,![]);}})[_0x275f('0x14')](function(_0x26d9b9){_0x58fe85(_0x26d9b9);});};AGIVertices[_0x275f('0xe')]['getSoundPath']=function(_0x366a0e){return util[_0x275f('0x27')](_0x275f('0x28'),FILES_PATH,_0x366a0e);};AGIVertices[_0x275f('0xe')][_0x275f('0x29')]=function(_0x1d039e,_0x584d16,_0x368313){odbc[_0x275f('0x2a')](_0x1d039e,function(_0x443142){if(_0x443142){logger[_0x275f('0x2b')](_0x275f('0x2c'),_0x443142);_0x368313(_0x443142);}else{logger[_0x275f('0x2d')]('ODBC\x20connection\x20successfully');odbc[_0x275f('0x2e')](_0x584d16,function(_0x1ac76c,_0x4293d7){if(_0x1ac76c){logger[_0x275f('0x2d')](_0x275f('0x2f'),_0x584d16);_0x368313(_0x1ac76c);}else{logger[_0x275f('0x2d')](_0x275f('0x30'),_0x584d16);odbc['close'](function(_0x1f4f27){if(_0x1f4f27){logger[_0x275f('0x2b')](_0x275f('0x31'),_0x1f4f27);}_0x368313(null,_0x4293d7);});}});}});};AGIVertices[_0x275f('0xe')][_0x275f('0x32')]=function(_0x9030db,_0x29bf8d){this['rpc']['getSmsAccountById'](_0x9030db)[_0x275f('0x10')](function(_0x50cfe9){_0x29bf8d(null,_0x50cfe9?_0x50cfe9:![]);})['catch'](function(_0x57a1f5){_0x29bf8d(_0x57a1f5);});};AGIVertices[_0x275f('0xe')][_0x275f('0x33')]=function(_0x5d47eb,_0x188fab){this['rpc'][_0x275f('0x33')](_0x5d47eb)[_0x275f('0x10')](function(_0x436542){_0x188fab(null,_0x436542);})['catch'](function(_0x12698f){_0x188fab(_0x12698f);});};AGIVertices[_0x275f('0xe')]['createSquareDetailsReport']=function(_0x1ea70c,_0x152720,_0x70b29b){this[_0x275f('0xc')][_0x275f('0x34')]({'uniqueid':this[_0x275f('0xb')][_0x275f('0x35')],'node':_0x1ea70c[_0x275f('0x36')],'application':_0x1ea70c[_0x275f('0x37')],'data':_0x152720||null,'project_name':this[_0x275f('0xb')][_0x275f('0x38')],'callerid':this[_0x275f('0xb')]['callerid']})[_0x275f('0x10')](function(_0x19be1e){if(_0x70b29b){_0x70b29b(null,_0x19be1e);}})[_0x275f('0x14')](function(_0x50dac4){if(_0x70b29b){_0x70b29b(_0x50dac4);}});};AGIVertices[_0x275f('0xe')]['createSquareRecording']=function(_0x7fb8c2,_0x4915bf,_0x53a0a7,_0x48f885){this[_0x275f('0xc')][_0x275f('0x39')]({'uniqueid':this[_0x275f('0xb')][_0x275f('0x35')],'callerid':this['channel'][_0x275f('0x3a')],'calleridname':this['channel'][_0x275f('0x3b')],'context':this['channel'][_0x275f('0x3c')],'extension':this[_0x275f('0xb')]['extension'],'priority':this[_0x275f('0xb')][_0x275f('0x3d')],'accountcode':this[_0x275f('0xb')]['accountcode'],'dnid':this[_0x275f('0xb')][_0x275f('0x3e')],'projectName':this['channel'][_0x275f('0x38')],'saveName':_0x4915bf,'filename':_0x7fb8c2[_0x275f('0x3f')]||_0x4915bf,'savePath':_0x53a0a7})[_0x275f('0x10')](function(_0x28ffec){_0x48f885(null,_0x28ffec);})[_0x275f('0x14')](function(_0x407dc7){_0x48f885(_0x407dc7);});};AGIVertices['prototype'][_0x275f('0x40')]=function(_0xd6ba3d,_0x3e32ef,_0x19ab9e){this['rpc']['createSquareMessage']({'uniqueid':this[_0x275f('0xb')][_0x275f('0x35')],'body':_0xd6ba3d,'direction':_0x3e32ef})[_0x275f('0x10')](function(_0x48819a){if(_0x19ab9e){_0x19ab9e(null,_0x48819a);}})[_0x275f('0x14')](function(_0x630944){if(_0x19ab9e){_0x19ab9e(_0x630944);}});};AGIVertices[_0x275f('0xe')][_0x275f('0x41')]=function(_0x305c68,_0x4ba976){this[_0x275f('0xc')][_0x275f('0x41')]({'firstName':_[_0x275f('0x42')](_0x305c68[_0x275f('0x11')])||_[_0x275f('0x43')](_0x305c68[_0x275f('0x11')])?_0x275f('0x44')+Math[_0x275f('0x45')]():_0x305c68[_0x275f('0x11')],'lastName':_[_0x275f('0x42')](_0x305c68[_0x275f('0x46')])||_[_0x275f('0x43')](_0x305c68[_0x275f('0x46')])?null:_0x305c68[_0x275f('0x46')],'phone':_0x305c68[_0x275f('0x47')],'ListId':_0x305c68['list_id'],'scheduledAt':_0x305c68[_0x275f('0x48')],'callbackUniqueid':this['channel'][_0x275f('0x35')],'tags':_0x275f('0x49'),'description':'Callback\x20scheduled\x20at\x20'+_0x305c68['scheduledAt'][_0x275f('0x4a')](),'priority':_0x305c68['callback_priority']})[_0x275f('0x10')](function(_0x4aa732){_0x4ba976(null,_0x4aa732);})[_0x275f('0x14')](function(_0x47ff4c){_0x4ba976(_0x47ff4c);});};AGIVertices['prototype'][_0x275f('0x4b')]=function(_0x343916,_0x1cff85){this[_0x275f('0xc')][_0x275f('0x4c')](_0x343916)[_0x275f('0x10')](function(_0x4205ae){_0x1cff85(null,_0x4205ae?_0x4205ae[_0x275f('0x11')]:![]);})['catch'](function(_0x2eaf39){_0x1cff85(_0x2eaf39);});};AGIVertices[_0x275f('0xe')][_0x275f('0x4d')]=function(_0x3dec2d,_0x2bd79e,_0x2c1afe){var _0x36471c={'role':_0x275f('0x4e')};_0x36471c[_0x3dec2d]=this['channel'][_0x275f('0x3a')];this[_0x275f('0xc')][_0x275f('0x4d')](_0x36471c,_0x2bd79e,this[_0x275f('0xb')][_0x275f('0x35')])[_0x275f('0x10')](function(_0x4c4e29){_0x2c1afe(null,_['isNil'](_0x4c4e29)?![]:!![]);})[_0x275f('0x14')](function(_0x5c7d34){logger['error'](_0x5c7d34);_0x2c1afe(null,![]);});};AGIVertices[_0x275f('0xe')][_0x275f('0x4f')]=function(_0x25eb81,_0x4320e2){var _0xef6c90={'role':'agent'};_0xef6c90[_0x25eb81]=this[_0x275f('0xb')][_0x275f('0x3a')];this[_0x275f('0xc')][_0x275f('0x4f')](_0xef6c90)[_0x275f('0x10')](function(_0x5f2037){_0x4320e2(null,_[_0x275f('0x43')](_0x5f2037)?![]:!![]);})[_0x275f('0x14')](function(_0x137b63){logger['error'](_0x137b63);_0x4320e2(null,![]);});};AGIVertices[_0x275f('0xe')][_0x275f('0x50')]=function(_0x4ab1c0,_0x3b84e0){var _0x1428ce={'role':_0x275f('0x4e')};_0x1428ce[_0x4ab1c0]=this['channel'][_0x275f('0x3a')];this[_0x275f('0xc')][_0x275f('0x50')](_0x1428ce)[_0x275f('0x10')](function(_0x28fa1a){_0x3b84e0(null,_[_0x275f('0x43')](_0x28fa1a)?![]:!![]);})['catch'](function(_0x27df25){logger[_0x275f('0x2b')](_0x27df25);_0x3b84e0(null,![]);});};AGIVertices[_0x275f('0xe')]['agentLogin']=function(_0x14cfa7,_0x49a496){var _0x267872={'role':_0x275f('0x4e')};_0x267872[_0x14cfa7]=this[_0x275f('0xb')]['callerid'];var _0x4abd19=_0x14cfa7!='internal'?util[_0x275f('0x27')](_0x275f('0x51'),'LOCAL',this['channel'][_0x275f('0x3a')]):undefined;this['rpc']['agentLogin'](_0x267872,_0x4abd19)['then'](function(_0x3a5e8a){_0x49a496(null,_['isNil'](_0x3a5e8a)?![]:!![]);})[_0x275f('0x14')](function(_0x181a2e){logger[_0x275f('0x2b')](_0x181a2e);_0x49a496(null,![]);});};AGIVertices[_0x275f('0xe')][_0x275f('0x52')]=function(_0x269a76,_0x2c7201){sh['exec'](_['trim'](_0x269a76),function(_0x2258d2,_0x43b61d){var _0x457dcc=_0x43b61d[_0x275f('0x53')](/(\r\n|\n|\r)/gm,'');_0x2c7201(null,_0x457dcc);});};AGIVertices['prototype'][_0x275f('0x54')]=function(_0x23d65a,_0x3752a7){scripts[_0x275f('0x54')](_0x23d65a[_0x275f('0x55')],_0x23d65a[_0x275f('0x56')]||'en',0x1)[_0x275f('0x10')](function(_0x3a7307){_0x3752a7(null,_0x3a7307);})[_0x275f('0x14')](function(_0x299bc1){_0x3752a7(_0x299bc1);});};AGIVertices[_0x275f('0xe')]['googleDialogflow']=function(_0x1aef7a,_0x1d30b5){scripts[_0x275f('0x57')](this['channel'][_0x275f('0x35')],_0x1aef7a[_0x275f('0x58')],_0x1aef7a[_0x275f('0x55')],_0x1aef7a[_0x275f('0x59')]||'en')[_0x275f('0x10')](function(_0x1999c7){_0x1d30b5(null,_0x1999c7);})[_0x275f('0x14')](function(_0x46e6f7){_0x1d30b5(_0x46e6f7);});};AGIVertices[_0x275f('0xe')][_0x275f('0x5a')]=function(_0x2076b7,_0x2a01d0){scripts[_0x275f('0x5a')](this[_0x275f('0xb')],_0x2076b7)[_0x275f('0x10')](function(_0x123bd5){_0x2a01d0(null,_0x123bd5);})['catch'](function(_0x53d8ae){_0x2a01d0(_0x53d8ae);});};AGIVertices[_0x275f('0xe')][_0x275f('0x5b')]=function(_0x494520,_0x20a6a0){scripts[_0x275f('0x5b')](_0x494520[_0x275f('0x58')],_0x494520[_0x275f('0x55')],_0x494520[_0x275f('0x5c')]||_0x275f('0x5d'),_0x494520[_0x275f('0x5e')])[_0x275f('0x10')](function(_0x9096ad){_0x20a6a0(null,_0x9096ad);})[_0x275f('0x14')](function(_0x1ffea7){_0x20a6a0(_0x1ffea7);});};AGIVertices['prototype'][_0x275f('0x5f')]=function(_0x4f891c,_0x5bd8fe,_0x2c40a9){scripts[_0x275f('0x5f')](_0x5bd8fe,_0x4f891c['key'],_0x4f891c[_0x275f('0x60')]||'en-US',this[_0x275f('0x61')](_0x4f891c['model'])?_0x4f891c[_0x275f('0x62')]:undefined)[_0x275f('0x10')](function(_0x4ed5c7){_0x2c40a9(null,_0x4ed5c7);})[_0x275f('0x14')](function(_0x226bf5){_0x2c40a9(_0x226bf5);});};AGIVertices[_0x275f('0xe')][_0x275f('0x63')]=function(_0x8246cf,_0x214b03){scripts['awsPolly'](_0x8246cf['aws_access_key_id'],_0x8246cf[_0x275f('0x64')],_0x8246cf['aws_polly_region'],_0x8246cf['aws_polly_voice']||_0x275f('0x65'),_0x8246cf['text'],_0x8246cf[_0x275f('0x66')]||'text')[_0x275f('0x10')](function(_0x1d1a1d){_0x214b03(null,_0x1d1a1d);})[_0x275f('0x14')](function(_0x24fc98){_0x214b03(_0x24fc98);});};AGIVertices['prototype'][_0x275f('0x67')]=function(_0x56edaf,_0x18dfce){scripts[_0x275f('0x67')](this[_0x275f('0xb')][_0x275f('0x35')],_0x56edaf['aws_access_key_id'],_0x56edaf[_0x275f('0x64')],_0x56edaf[_0x275f('0x68')],_0x56edaf[_0x275f('0x55')],_0x56edaf[_0x275f('0x69')])[_0x275f('0x10')](function(_0xdb1a20){_0x18dfce(null,_0xdb1a20);})[_0x275f('0x14')](function(_0x10df29){_0x18dfce(_0x10df29);});};AGIVertices[_0x275f('0xe')][_0x275f('0x6a')]=function(_0x5cbc56,_0xe4059c,_0x437538){scripts['googleASR'](_0xe4059c,_0x5cbc56[_0x275f('0x58')],_0x5cbc56[_0x275f('0x6b')]||_0x275f('0x5d'))[_0x275f('0x10')](function(_0xbbc6c3){_0x437538(null,_0xbbc6c3);})[_0x275f('0x14')](function(_0x493ff1){_0x437538(_0x493ff1);});};AGIVertices['prototype'][_0x275f('0x6c')]=function(_0x7bf9c6,_0x1d23f0,_0x129fc3){scripts[_0x275f('0x6c')](_0x1d23f0,_0x7bf9c6['appid'],_0x7bf9c6[_0x275f('0x6d')],_0x7bf9c6[_0x275f('0x6e')])['then'](function(_0x8678bc){_0x129fc3(null,_0x8678bc);})['catch'](function(_0x410ba7){_0x129fc3(_0x410ba7);});};AGIVertices['prototype'][_0x275f('0x6f')]=function(_0x5a1587){var _0x2614d1=_[_0x275f('0x70')](verticesWithRetry,_0x5a1587[_0x275f('0x37')])?_0x5a1587:_['clone'](_0x5a1587);for(var _0xab25e2 in _0x2614d1){if(_0x2614d1['hasOwnProperty'](_0xab25e2)){if(_0x2614d1[_0xab25e2]&&_[_0x275f('0x71')](_0x2614d1[_0xab25e2])){_0x2614d1[_0xab25e2]=this[_0x275f('0x72')](_0x2614d1[_0xab25e2]);}}}return _0x2614d1;};AGIVertices['prototype'][_0x275f('0x72')]=function(_0x390a4b){var _0x39f787=_0x390a4b[_0x275f('0x73')]('{');for(var _0x219c27=0x1;_0x219c27<_0x39f787[_0x275f('0x74')];_0x219c27+=0x1){var _0x56346c=_0x39f787[_0x219c27]['split']('}');if(_0x56346c[_0x275f('0x74')]>0x1){_0x390a4b=_0x390a4b[_0x275f('0x75')]('{'+_0x56346c[0x0]+'}',this['channel'][_0x275f('0x76')](_0x56346c[0x0])['extra']||_0x56346c[0x0]);}}if(_0x39f787[_0x275f('0x74')]===0x1){return _0x390a4b['toString']();}return this['replaceAllVariables'](_0x390a4b);};AGIVertices[_0x275f('0xe')][_0x275f('0x77')]=function(_0x3f2dce,_0x4e4a2e){var _0x223a28=this[_0x275f('0xb')][_0x275f('0x76')](_0x3f2dce);if(_0x223a28[_0x275f('0x78')]===-0x1){return _0x223a28;}logger[_0x275f('0x2d')](util[_0x275f('0x27')](_0x275f('0x79'),_0x4e4a2e,_0x223a28[_0x275f('0x7a')]));return this['channel'][_0x275f('0x7b')](_0x4e4a2e,_0x223a28[_0x275f('0x7a')]);};AGIVertices[_0x275f('0xe')]['isConfigured']=function(_0x3a4d2b){return _0x3a4d2b&&_0x3a4d2b!=='0'&&_0x3a4d2b!=='-1'&&_0x3a4d2b!=='';};AGIVertices[_0x275f('0xe')][_0x275f('0x7c')]=function(_0x57ee26){this[_0x275f('0x34')]['sync'](this,_0x57ee26,'-');_0x57ee26[_0x275f('0x7d')]=_0x57ee26[_0x275f('0x7c')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x275f('0xe')][_0x275f('0x7')]=function(_0x536cd9){logger['info'](util[_0x275f('0x27')](_0x275f('0x7e'),_0x536cd9['label']));return this[_0x275f('0xb')][_0x275f('0x7')]([_0x536cd9['command'],_0x536cd9[_0x275f('0x7f')]]);};AGIVertices[_0x275f('0xe')]['answer']=function(_0x182980){logger[_0x275f('0x2d')](util[_0x275f('0x27')](_0x275f('0x80'),_0x182980[_0x275f('0x36')]));if(this[_0x275f('0x61')](_0x182980[_0x275f('0x81')])){logger[_0x275f('0x2d')](util['format'](_0x275f('0x82'),_0x182980['timeout']));var _0xc4985=this[_0x275f('0xb')][_0x275f('0x83')](_0x182980['timeout']);if(_0xc4985[_0x275f('0x78')]===-0x1){return _0xc4985;}}return this[_0x275f('0xb')]['answer']();};AGIVertices[_0x275f('0xe')]['callback']=function(_0x40fad1){logger[_0x275f('0x2d')](util[_0x275f('0x27')](_0x275f('0x84'),_0x40fad1[_0x275f('0x36')]));if(!this[_0x275f('0x61')](_0x40fad1[_0x275f('0x85')])){return this[_0x275f('0xb')]['error'](_0x40fad1,_0x275f('0x86'));}_0x40fad1[_0x275f('0x48')]=moment();if(this[_0x275f('0x61')](_0x40fad1[_0x275f('0x87')])){_0x40fad1[_0x275f('0x48')]=moment()[_0x275f('0x88')](_0x40fad1['delay'],_0x275f('0x89'));}if(!this['isConfigured'](_0x40fad1[_0x275f('0x8a')])){_0x40fad1[_0x275f('0x8a')]=0x2;}this[_0x275f('0x41')][_0x275f('0x8b')](this,_0x40fad1);return this['channel'][_0x275f('0x8c')](util['format'](_0x275f('0x8d'),_0x40fad1['phone'],_0x40fad1['list_id'],_0x40fad1[_0x275f('0x48')]));};AGIVertices[_0x275f('0xe')]['custom_app']=function(_0xf15c84){logger[_0x275f('0x2d')](util['format'](_0x275f('0x8e'),_0xf15c84[_0x275f('0x36')]));var _0x351854=this[_0x275f('0xb')][_0x275f('0x8f')](_0xf15c84['application'],_0xf15c84[_0x275f('0x90')]);if(_0x351854[_0x275f('0x78')]===-0x1){return _0x351854;}return this[_0x275f('0xb')][_0x275f('0x8c')](util[_0x275f('0x27')](_0x275f('0x91'),_0xf15c84[_0x275f('0x92')],_0xf15c84['options']));};AGIVertices[_0x275f('0xe')][_0x275f('0x93')]=function(_0x17ad90){logger['info'](util[_0x275f('0x27')](_0x275f('0x94'),_0x17ad90[_0x275f('0x36')]));if(!this[_0x275f('0x61')](_0x17ad90[_0x275f('0x55')])){return this['channel'][_0x275f('0x8c')](_0x275f('0x95'));}var _0x39c5f7='\x22'+_0x17ad90[_0x275f('0x55')]+'\x22';if(this[_0x275f('0x61')](_0x17ad90[_0x275f('0x90')])){_0x39c5f7+=','+_0x17ad90[_0x275f('0x90')];}var _0x5e1655=this[_0x275f('0xb')][_0x275f('0x8f')](_0x275f('0x96'),_0x39c5f7);if(_0x5e1655['result']===-0x1){return _0x5e1655;}return this[_0x275f('0xb')]['noop'](util[_0x275f('0x27')](_0x275f('0x97'),_0x39c5f7));};AGIVertices[_0x275f('0xe')][_0x275f('0x98')]=function(_0x244d7b){logger[_0x275f('0x2d')](util['format'](_0x275f('0x99'),_0x244d7b[_0x275f('0x36')]));if(!this[_0x275f('0x61')](_0x244d7b['text'])){return this[_0x275f('0xb')][_0x275f('0x8c')](_0x275f('0x95'));}var _0x2063b9='\x22'+_0x244d7b[_0x275f('0x55')]+'\x22';if(this[_0x275f('0x61')](_0x244d7b[_0x275f('0x90')])){_0x2063b9+=','+_0x244d7b[_0x275f('0x90')];}var _0x39e91f=this[_0x275f('0xb')]['exec'](_0x275f('0x96'),_0x2063b9);if(_0x39e91f[_0x275f('0x78')]===-0x1){return _0x39e91f;}return this['channel'][_0x275f('0x8c')](util[_0x275f('0x27')](_0x275f('0x97'),_0x2063b9));};AGIVertices[_0x275f('0xe')][_0x275f('0x9a')]=function(_0x2db2c7){logger[_0x275f('0x2d')](util['format'](_0x275f('0x9b'),_0x2db2c7['label']));if(!this[_0x275f('0x61')](_0x2db2c7[_0x275f('0x9c')])){return this[_0x275f('0xb')]['noop'](_0x275f('0x9d'));}var _0x4c2c52=_0x2db2c7[_0x275f('0x9c')];if(this[_0x275f('0x61')](_0x2db2c7[_0x275f('0x90')])){_0x4c2c52+=','+_0x2db2c7[_0x275f('0x90')];}var _0x3e6da3=this[_0x275f('0xb')][_0x275f('0x8f')](_0x275f('0x9e'),_0x4c2c52);if(_0x3e6da3['result']===-0x1){return _0x3e6da3;}var _0x19f9bc=this[_0x275f('0x77')](_0x275f('0x9f'),_0x275f('0xa0'));if(_0x19f9bc['result']===-0x1){return _0x19f9bc;}var _0x44514d=this[_0x275f('0x77')](_0x275f('0xa1'),_0x275f('0xa2'));if(_0x44514d[_0x275f('0x78')]===-0x1){return _0x44514d;}var _0x17528a=this[_0x275f('0x77')](_0x275f('0xa3'),_0x275f('0xa4'));if(_0x17528a['result']===-0x1){return _0x17528a;}return this[_0x275f('0xb')][_0x275f('0x8c')](util[_0x275f('0x27')]('Executed\x20command\x20MRCPRecog\x20%s',_0x4c2c52));};AGIVertices[_0x275f('0xe')]['sestekasr']=function(_0x5c3b0f){logger[_0x275f('0x2d')](util[_0x275f('0x27')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x5c3b0f[_0x275f('0x36')]));if(!this[_0x275f('0x61')](_0x5c3b0f['grammar'])){return this[_0x275f('0xb')]['noop'](_0x275f('0x9d'));}var _0x45ed52=_0x5c3b0f[_0x275f('0x9c')];if(this[_0x275f('0x61')](_0x5c3b0f[_0x275f('0x90')])){_0x45ed52+=','+_0x5c3b0f[_0x275f('0x90')];}var _0x31671d=this[_0x275f('0xb')][_0x275f('0x8f')]('MRCPRecog',_0x45ed52);if(_0x31671d[_0x275f('0x78')]===-0x1){return _0x31671d;}var _0x2ba5fd=this[_0x275f('0x77')](_0x275f('0x9f'),_0x275f('0xa5'));if(_0x2ba5fd['result']===-0x1){return _0x2ba5fd;}var _0x42a55e=this[_0x275f('0x77')](_0x275f('0xa1'),_0x275f('0xa6'));if(_0x42a55e['result']===-0x1){return _0x42a55e;}var _0x3c8783=this[_0x275f('0x77')](_0x275f('0xa3'),_0x275f('0xa7'));if(_0x3c8783['result']===-0x1){return _0x3c8783;}return this[_0x275f('0xb')][_0x275f('0x8c')](util['format'](_0x275f('0xa8'),_0x45ed52));};AGIVertices['prototype'][_0x275f('0xa9')]=function(_0xba5a39){logger['info'](util[_0x275f('0x27')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0xba5a39['label']));if(!this[_0x275f('0x61')](_0xba5a39[_0x275f('0xaa')])){return this['channel'][_0x275f('0x2b')](_0xba5a39,_0x275f('0xab'));}var _0x3310df=this[_0x275f('0x17')][_0x275f('0x8b')](this,_0xba5a39[_0x275f('0xaa')]);if(!_0x3310df){return this[_0x275f('0xb')][_0x275f('0x2b')](_0xba5a39,_0x275f('0xac'));}if(!this[_0x275f('0x61')](_0xba5a39[_0x275f('0x2e')])){return this['channel'][_0x275f('0x2b')](_0xba5a39,_0x275f('0xad'));}var _0x4845cf=_0xba5a39['query'][_0x275f('0x53')](/(\r\n|\n|\r)/gm,'\x20');this[_0x275f('0xb')][_0x275f('0x8c')](util[_0x275f('0x27')]('query:\x20%s',_0x4845cf));var _0x1abb85=this['getQueryOdbc'][_0x275f('0x8b')](this,_0x3310df,_0x4845cf);this[_0x275f('0x34')][_0x275f('0x8b')](this,_0xba5a39,_0x4845cf);if(!this[_0x275f('0x61')](_0xba5a39[_0x275f('0xae')])){return this['channel']['noop'](_0x275f('0xaf'));}var _0x33cd3c=this['getVariable'][_0x275f('0x8b')](this,_0xba5a39[_0x275f('0xae')]);if(!_0x33cd3c){return this['channel']['error'](_0xba5a39,'no\x20variable\x20found');}var _0xe230cc=this;_0x1abb85[_0x275f('0xb0')](function(_0x3b52a7,_0x2a1de2){Object[_0x275f('0xb1')](_0x3b52a7)[_0x275f('0xb0')](function(_0x59bf87){_0xe230cc[_0x275f('0xb')]['setVariable'](util[_0x275f('0x27')](_0x275f('0xb2'),_0x33cd3c,_0x2a1de2,_0x59bf87),_0x3b52a7[_0x59bf87]);});});this[_0x275f('0xb')]['setVariable'](util[_0x275f('0x27')](_0x275f('0xb3'),_0x33cd3c),_0x1abb85['length']);return this[_0x275f('0xb')][_0x275f('0x8c')](util[_0x275f('0x27')](_0x275f('0xb4'),_0x33cd3c));};AGIVertices[_0x275f('0xe')]['dial']=function(_0x14faa1){logger[_0x275f('0xb5')](util[_0x275f('0x27')](_0x275f('0xb6'),_0x14faa1[_0x275f('0x36')]));if(!this[_0x275f('0x61')](_0x14faa1[_0x275f('0xb7')])){return this[_0x275f('0xb')][_0x275f('0x2b')](_0x14faa1,_0x275f('0xb8'));}var _0x4afecc=this[_0x275f('0x1a')][_0x275f('0x8b')](this,_0x14faa1[_0x275f('0xb7')]);if(!_0x4afecc){return this[_0x275f('0xb')][_0x275f('0x2b')](_0x14faa1,_0x275f('0xb9'));}var _0x593a70=this['channel'][_0x275f('0x8f')](_0x275f('0xba'),[util[_0x275f('0x27')]('SIP/%s',_0x4afecc),_0x14faa1[_0x275f('0x81')],_0x14faa1[_0x275f('0xbb')],_0x14faa1['url']]);if(_0x593a70[_0x275f('0x78')]===-0x1){return _0x593a70;}return this[_0x275f('0xb')][_0x275f('0x8c')](util[_0x275f('0x27')]('Executed\x20command\x20%s',_0x275f('0xba')));};AGIVertices[_0x275f('0xe')][_0x275f('0xbc')]=function(_0x56f420){logger[_0x275f('0x2d')](util[_0x275f('0x27')](_0x275f('0xbd'),_0x56f420[_0x275f('0x36')]));if(!this[_0x275f('0x61')](_0x56f420[_0x275f('0x58')])){return this[_0x275f('0xb')]['noop'](_0x275f('0xbe'));}if(!this['isConfigured'](_0x56f420['text'])){return this[_0x275f('0xb')][_0x275f('0x8c')](_0x275f('0x95'));}this[_0x275f('0xb')][_0x275f('0xbf')]=!![];this[_0x275f('0x34')](_0x56f420);this[_0x275f('0x40')](_0x56f420[_0x275f('0x55')],'in');this['channel'][_0x275f('0x8c')](util[_0x275f('0x27')](_0x275f('0xc0'),_0x56f420[_0x275f('0x55')]));var _0x425088=this[_0x275f('0x57')][_0x275f('0x8b')](this,_0x56f420);if(_0x425088){for(var _0x109b54 in _0x425088){if(_0x425088[_0x275f('0xc1')](_0x109b54)){this[_0x275f('0xb')][_0x275f('0x7b')](util[_0x275f('0x27')](_0x275f('0xc2'),_0x109b54[_0x275f('0xc3')]()),_0x425088[_0x109b54]);}}this[_0x275f('0x40')](_0x425088['speech'],'out');return this['channel'][_0x275f('0x8c')](util[_0x275f('0x27')]('Dialogflow\x20Result\x20%s',_0x425088[_0x275f('0xc4')]));}return this[_0x275f('0xb')][_0x275f('0x2b')](_0x56f420,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x275f('0xe')][_0x275f('0xc5')]=function(_0x1e7225){logger[_0x275f('0x2d')](util[_0x275f('0x27')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x1e7225[_0x275f('0x36')]));if(!this[_0x275f('0x61')](_0x1e7225['ndauth_url'])){return this[_0x275f('0xb')][_0x275f('0x8c')]('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x1e7225[_0x275f('0xc6')])){return this[_0x275f('0xb')][_0x275f('0x8c')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x1e7225[_0x275f('0xc7')])){return this['channel'][_0x275f('0x8c')](_0x275f('0xc8'));}if(!this[_0x275f('0x61')](_0x1e7225['ndassistant_url'])){return this[_0x275f('0xb')][_0x275f('0x8c')](_0x275f('0x95'));}this['channel'][_0x275f('0xbf')]=!![];this[_0x275f('0x34')](_0x1e7225);this['createSquareMessage'](_0x1e7225[_0x275f('0x55')],'in');this[_0x275f('0xb')][_0x275f('0x8c')](util[_0x275f('0x27')]('Trying\x20SestekNDA:\x20%s',_0x1e7225[_0x275f('0x55')]));var _0x56d0c1=this[_0x275f('0x5a')][_0x275f('0x8b')](this,_0x1e7225);if(_0x56d0c1){for(var _0x1cb022 in _0x56d0c1){if(_0x56d0c1['hasOwnProperty'](_0x1cb022)){this[_0x275f('0xb')][_0x275f('0x7b')](util['format'](_0x275f('0xc9'),_0x1cb022['toUpperCase']()),_0x56d0c1[_0x1cb022]);}}this['createSquareMessage'](_0x56d0c1['speech'],_0x275f('0xca'));return this[_0x275f('0xb')][_0x275f('0x8c')](util[_0x275f('0x27')]('SestekNDA\x20Result\x20%s',_0x56d0c1[_0x275f('0xc4')]));}return this['channel']['error'](_0x1e7225,_0x275f('0xcb'));};AGIVertices[_0x275f('0xe')][_0x275f('0xcc')]=function(_0x1b5745){logger[_0x275f('0x2d')](util[_0x275f('0x27')](_0x275f('0xcd'),_0x1b5745[_0x275f('0x36')]));return this[_0x275f('0xb')][_0x275f('0x8c')]('end');};AGIVertices[_0x275f('0xe')][_0x275f('0xce')]=function(_0x16b523){logger['info'](util[_0x275f('0x27')](_0x275f('0xcf'),_0x16b523[_0x275f('0x36')]));var _0x26646d='';if(_0x16b523[_0x275f('0xd0')]){if(!this[_0x275f('0x61')](_0x16b523[_0x275f('0xd0')])){return this[_0x275f('0xb')][_0x275f('0x2b')](_0x16b523,_0x275f('0xd1'));}else{var _0x1069a0=parseInt(_0x16b523[_0x275f('0xd0')],0xa);if(isNaN(_0x1069a0)){_0x26646d=_0x16b523[_0x275f('0xd0')];}else{_0x26646d=this[_0x275f('0x1c')]['sync'](this,_0x16b523[_0x275f('0xd0')]);if(!_0x26646d){return this['channel'][_0x275f('0x2b')](_0x16b523,_0x275f('0xd2'));}}}}else if(_0x16b523[_0x275f('0xd3')]){_0x26646d=_0x16b523[_0x275f('0xd3')];}else{return this['channel']['error'](_0x16b523,'no\x20trunk\x20selected');}var _0x367b02=this['channel']['exec'](_0x275f('0xba'),[util[_0x275f('0x27')](_0x275f('0xd4'),_0x26646d,_0x16b523['phone']),_0x16b523[_0x275f('0x81')],_0x16b523[_0x275f('0xbb')],_0x16b523[_0x275f('0xd5')]]);if(_0x367b02[_0x275f('0x78')]===-0x1){return _0x367b02;}return this['channel']['noop'](util[_0x275f('0x27')](_0x275f('0xd6'),_0x275f('0xba')));};AGIVertices[_0x275f('0xe')][_0x275f('0xd7')]=function(_0x383e5e){logger[_0x275f('0x2d')](util[_0x275f('0x27')](_0x275f('0xd8'),_0x383e5e['label']));return this[_0x275f('0xb')][_0x275f('0x8c')](_0x275f('0xd7'));};AGIVertices['prototype'][_0x275f('0xd9')]=function(_0x45e9c3){logger[_0x275f('0x2d')](util[_0x275f('0x27')](_0x275f('0xda'),_0x45e9c3[_0x275f('0x36')]));if(_0x45e9c3[_0x275f('0x7d')]===0x0){return this[_0x275f('0x7c')](_0x45e9c3);}_0x45e9c3['retry']-=0x1;if(!this[_0x275f('0x61')](_0x45e9c3['file_id'])){return this['channel'][_0x275f('0x2b')](_0x45e9c3,_0x275f('0xdb'));}var _0x74ec51=this[_0x275f('0xdc')][_0x275f('0x8b')](this,_0x45e9c3['file_id']);if(!_0x74ec51){return this[_0x275f('0xb')][_0x275f('0x2b')](_0x45e9c3,_0x275f('0xdd'));}if(!this['isConfigured'](_0x45e9c3[_0x275f('0xae')])){return this[_0x275f('0xb')][_0x275f('0x2b')](_0x275f('0xaf'));}var _0x5cf06d=this[_0x275f('0xb')][_0x275f('0xde')](_0x74ec51,_0x45e9c3[_0x275f('0xdf')],_0x45e9c3[_0x275f('0xe0')]);var _0x4b8a47=_0x5cf06d['result']?_0x5cf06d['result'][_0x275f('0x4a')]():'';logger[_0x275f('0x2d')](_0x275f('0xe1'),JSON['stringify'](_0x5cf06d));if(_0x5cf06d[_0x275f('0x78')]===-0x1){this['createSquareDetailsReport'][_0x275f('0x8b')](this,_0x45e9c3,_0x4b8a47);return _0x5cf06d;}else if(_0x5cf06d[_0x275f('0x7a')]===_0x275f('0x81')){_0x5cf06d['result']=_0x4b8a47[_0x275f('0x74')]>=parseInt(_0x45e9c3[_0x275f('0xe2')])?'x':'i';}else{_0x5cf06d[_0x275f('0x78')]=_0x4b8a47['length']>=parseInt(_0x45e9c3[_0x275f('0xe2')])&&_0x4b8a47[_0x275f('0x74')]<=parseInt(_0x45e9c3['maxdigit'])?'x':'i';}var _0x3a1616=this['getVariable'][_0x275f('0x8b')](this,_0x45e9c3[_0x275f('0xae')]);if(!_0x3a1616){return this[_0x275f('0xb')][_0x275f('0x2b')](_0x45e9c3,_0x275f('0xe3'));}this['channel'][_0x275f('0x7b')](_0x3a1616,_0x4b8a47);if(this[_0x275f('0x61')](_0x45e9c3['hiddendigitsnum'])){var _0x2c6328=parseInt(_0x45e9c3['hiddendigitsnum'],0xa);var _0x54dc31=rs[_0x275f('0xe4')]({'charset':'*','length':_0x2c6328});var _0x4eb78e=_0x4b8a47['length'];if(_0x4eb78e>0x0){if(_0x4eb78e>_0x2c6328){this['createSquareDetailsReport'][_0x275f('0x8b')](this,_0x45e9c3,_0x45e9c3['hiddendigitspos']===_0x275f('0xe5')?_0x54dc31+_0x4b8a47[_0x275f('0xe6')](_0x2c6328):_0x4b8a47[_0x275f('0xe6')](0x0,_0x4eb78e-_0x2c6328)+_0x54dc31);}else{this[_0x275f('0x34')][_0x275f('0x8b')](this,_0x45e9c3,rs[_0x275f('0xe4')]({'charset':'*','length':_0x4eb78e}));}}else{this[_0x275f('0x34')]['sync'](this,_0x45e9c3,'');}}else{this['createSquareDetailsReport'][_0x275f('0x8b')](this,_0x45e9c3,_0x4b8a47);}return _0x5cf06d;};AGIVertices[_0x275f('0xe')][_0x275f('0xe7')]=function(_0x7ec71){logger['info'](util[_0x275f('0x27')](_0x275f('0xe8'),_0x7ec71[_0x275f('0x36')]));return this[_0x275f('0xd9')](_0x7ec71);};AGIVertices[_0x275f('0xe')]['goal']=function(_0x1d49cf){logger[_0x275f('0x2d')](util[_0x275f('0x27')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x1d49cf[_0x275f('0x36')]));this['createSquareDetailsReport']['sync'](this,_0x1d49cf,_0x1d49cf[_0x275f('0xe9')]);return this['channel']['noop'](util[_0x275f('0x27')](_0x275f('0xea'),_0x1d49cf[_0x275f('0xe9')]));};AGIVertices[_0x275f('0xe')]['awspolly']=function(_0x42c3d9){logger['info'](util[_0x275f('0x27')](_0x275f('0xeb'),_0x42c3d9[_0x275f('0x36')]));if(!this['isConfigured'](_0x42c3d9[_0x275f('0xec')])||!this[_0x275f('0x61')](_0x42c3d9[_0x275f('0x64')])){return this[_0x275f('0xb')][_0x275f('0x8c')](_0x275f('0xed'));}if(!this['isConfigured'](_0x42c3d9[_0x275f('0x55')])){return this['channel'][_0x275f('0x8c')](_0x275f('0x95'));}this['channel'][_0x275f('0x8c')](util['format'](_0x275f('0xee'),_0x42c3d9[_0x275f('0x55')]));var _0x260a12=this['awsPolly'][_0x275f('0x8b')](this,_0x42c3d9);if(_0x260a12){this[_0x275f('0xb')][_0x275f('0x8c')](util['format'](_0x275f('0xef'),_0x260a12));var _0x343aab=this['channel'][_0x275f('0xf0')](_0x260a12);try{fs[_0x275f('0xf1')](_0x260a12+'.wav');}catch(_0x3180a6){logger[_0x275f('0x2b')](_0x3180a6);}return _0x343aab;}return this['channel'][_0x275f('0x2b')](_0x42c3d9,_0x275f('0xf2'));};AGIVertices[_0x275f('0xe')][_0x275f('0xf3')]=function(_0x131add){logger[_0x275f('0x2d')](util[_0x275f('0x27')](_0x275f('0xf4'),_0x131add[_0x275f('0x36')]));if(!this[_0x275f('0x61')](_0x131add[_0x275f('0xec')])||!this['isConfigured'](_0x131add[_0x275f('0x64')])){return this[_0x275f('0xb')]['noop'](_0x275f('0xed'));}if(!this[_0x275f('0x61')](_0x131add[_0x275f('0x69')])){return this['channel'][_0x275f('0x8c')](_0x275f('0xf5'));}if(!this['isConfigured'](_0x131add[_0x275f('0x55')])){return this['channel'][_0x275f('0x8c')](_0x275f('0x95'));}this['channel'][_0x275f('0xbf')]=!![];this[_0x275f('0x34')](_0x131add);this[_0x275f('0x40')](_0x131add[_0x275f('0x55')],'in');this[_0x275f('0xb')][_0x275f('0x8c')](util[_0x275f('0x27')](_0x275f('0xf6'),_0x131add[_0x275f('0x55')]));var _0x40c3f8=this[_0x275f('0x67')][_0x275f('0x8b')](this,_0x131add);if(_0x40c3f8){for(var _0x553e4d in _0x40c3f8){if(_0x40c3f8[_0x275f('0xc1')](_0x553e4d)&&_[_0x275f('0x71')](_0x40c3f8[_0x553e4d])){this[_0x275f('0xb')][_0x275f('0x7b')](util[_0x275f('0x27')](_0x275f('0xf7'),_0x553e4d['toUpperCase']()),_0x40c3f8[_0x553e4d]);}}if(_[_0x275f('0x43')](_0x40c3f8[_0x275f('0xf8')])){return this[_0x275f('0xb')][_0x275f('0x8c')](_0x275f('0xf9'));}else{this[_0x275f('0x40')](_0x40c3f8[_0x275f('0xf8')],'out');return this['channel'][_0x275f('0x8c')](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x40c3f8[_0x275f('0xf8')]));}}return this['channel'][_0x275f('0x2b')](_0x131add,_0x275f('0xfa'));};AGIVertices['prototype'][_0x275f('0xfb')]=function(_0x38abb1){logger['info'](util[_0x275f('0x27')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x38abb1['label'],_0x38abb1['timeout']));if(!this['isConfigured'](_0x38abb1['key'])){return this[_0x275f('0xb')][_0x275f('0x8c')]('no\x20key\x20configured');}var _0x487165=_0x275f('0xfc');var _0x4b96ac=util[_0x275f('0x27')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x40b999=util[_0x275f('0x27')](_0x275f('0xfd'),_0x4b96ac,_0x487165);var _0xae6bce=!![];if(_0x38abb1[_0x275f('0xfe')]===_0x275f('0xff')){_0xae6bce=![];}var _0x1e9f99=this[_0x275f('0xb')][_0x275f('0x100')](_0x4b96ac,_0x487165,_0x38abb1[_0x275f('0x101')],_0x38abb1[_0x275f('0x81')],undefined,_0xae6bce);if(_0x1e9f99[_0x275f('0x78')]!==-0x1){this[_0x275f('0xb')][_0x275f('0x8c')](util[_0x275f('0x27')](_0x275f('0x102'),_0x40b999));var _0x1ba24c=this[_0x275f('0x6a')]['sync'](this,_0x38abb1,_0x40b999);if(_0x1ba24c){for(var _0x1919a6 in _0x1ba24c){if(_0x1ba24c['hasOwnProperty'](_0x1919a6)){this[_0x275f('0xb')][_0x275f('0x7b')](util[_0x275f('0x27')](_0x275f('0x103'),_0x1919a6[_0x275f('0xc3')]()),_0x1ba24c[_0x1919a6]);}}return this[_0x275f('0xb')][_0x275f('0x8c')](util[_0x275f('0x27')](_0x275f('0x104'),JSON['stringify'](_0x1ba24c)));}}return _0x1e9f99;};AGIVertices[_0x275f('0xe')]['tildeasr']=function(_0x42acbb){logger[_0x275f('0x2d')](util[_0x275f('0x27')](_0x275f('0x105'),_0x42acbb['label']));if(!this[_0x275f('0x61')](_0x42acbb[_0x275f('0x106')])){return this[_0x275f('0xb')][_0x275f('0x8c')]('no\x20appid\x20configured');}if(!this['isConfigured'](_0x42acbb[_0x275f('0x6d')])){return this[_0x275f('0xb')][_0x275f('0x8c')]('no\x20appsecret\x20configured');}var _0x330f6a='wav';var _0x202a8a=util[_0x275f('0x27')](_0x275f('0x107'),FILES_PATH,rs[_0x275f('0xe4')](0x4));var _0x3bdc5=util[_0x275f('0x27')](_0x275f('0xfd'),_0x202a8a,_0x330f6a);var _0x328a50=!![];if(_0x42acbb[_0x275f('0xfe')]==='NOBEEP'){_0x328a50=![];}var _0xb156ca=this['channel'][_0x275f('0x100')](_0x202a8a,_0x330f6a,_0x42acbb[_0x275f('0x101')],_0x42acbb[_0x275f('0x81')],undefined,_0x328a50);if(_0xb156ca[_0x275f('0x78')]!==-0x1){this[_0x275f('0xb')][_0x275f('0x8c')](util['format'](_0x275f('0x108'),_0x3bdc5));var _0x110d07=this[_0x275f('0x6c')][_0x275f('0x8b')](this,_0x42acbb,_0x3bdc5);if(_0x110d07){for(var _0x567280 in _0x110d07){if(_0x110d07['hasOwnProperty'](_0x567280)){this['channel'][_0x275f('0x7b')](util['format'](_0x275f('0x109'),_0x567280['toUpperCase']()),_0x110d07[_0x567280]);}}return this[_0x275f('0xb')][_0x275f('0x8c')](util['format'](_0x275f('0x10a'),JSON[_0x275f('0x10b')](_0x110d07)));}}return _0xb156ca;};AGIVertices[_0x275f('0xe')]['gotoc']=function(_0xfc612a){logger[_0x275f('0x2d')](util[_0x275f('0x27')](_0x275f('0x10c'),_0xfc612a[_0x275f('0x36')]));return this[_0x275f('0xb')]['continueAt'](_0xfc612a[_0x275f('0x3c')],_0xfc612a['extension'],_0xfc612a[_0x275f('0x3d')]);};AGIVertices[_0x275f('0xe')][_0x275f('0x10d')]=function(_0x1a5932){logger[_0x275f('0x2d')](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x1a5932[_0x275f('0x36')]));if(!this[_0x275f('0x61')](_0x1a5932['condition'])){return this[_0x275f('0xb')][_0x275f('0x2b')](_0x1a5932,'no\x20condition\x20configured');}try{var _0x5a8b83=eval(_0x1a5932[_0x275f('0x10e')])?_0x275f('0x10f'):'false';this['channel'][_0x275f('0x8c')](util[_0x275f('0x27')]('EVAL\x20CONDITION\x20%s\x20%s',_0x1a5932[_0x275f('0x10e')],_0x5a8b83));return{'code':0xc8,'result':_0x5a8b83};}catch(_0x78a642){return{'code':0xc8,'result':_0x275f('0x110')};}};AGIVertices[_0x275f('0xe')][_0x275f('0x111')]=function(_0x3a862a){logger[_0x275f('0x2d')](util['format'](_0x275f('0x112'),_0x3a862a[_0x275f('0x36')]));if(!this[_0x275f('0x61')](_0x3a862a[_0x275f('0x113')])){return this['channel'][_0x275f('0x2b')](_0x3a862a,_0x275f('0x114'));}var _0x5e780b=this[_0x275f('0x115')][_0x275f('0x8b')](this,_0x3a862a[_0x275f('0x113')]);if(!_0x5e780b){return this['channel'][_0x275f('0x2b')](_0x3a862a,_0x275f('0x116'));}for(var _0x4a0ea3=0x0;_0x4a0ea3<_0x5e780b[_0x275f('0x74')];_0x4a0ea3+=0x1){var _0x436064=this['channel'][_0x275f('0x76')](util[_0x275f('0x27')](_0x275f('0x117'),_0x5e780b[_0x4a0ea3]));if(_0x436064[_0x275f('0x78')]===-0x1){return _0x436064;}logger['info'](util[_0x275f('0x27')](_0x275f('0x118'),_0x5e780b[_0x4a0ea3],_0x436064['extra']));if(_0x436064[_0x275f('0x7a')]===_0x275f('0x10f')){logger[_0x275f('0x2d')](util[_0x275f('0x27')](_0x275f('0x118'),_0x5e780b[_0x4a0ea3],'true'));this[_0x275f('0xb')][_0x275f('0x8c')](util[_0x275f('0x27')](_0x275f('0x118'),_0x5e780b[_0x4a0ea3],_0x275f('0x10f')));return{'code':0xc8,'result':_0x275f('0x10f')};}else{logger[_0x275f('0x2d')](util[_0x275f('0x27')](_0x275f('0x118'),_0x5e780b[_0x4a0ea3],'false'));this[_0x275f('0xb')]['noop'](util['format'](_0x275f('0x118'),_0x5e780b[_0x4a0ea3],'false'));}}return{'code':0xc8,'result':_0x275f('0x110')};};AGIVertices[_0x275f('0xe')][_0x275f('0x119')]=function(_0x294149){logger[_0x275f('0x2d')](util[_0x275f('0x27')](_0x275f('0x11a'),_0x294149[_0x275f('0x36')]));return this[_0x275f('0xb')][_0x275f('0x119')]();};AGIVertices[_0x275f('0xe')][_0x275f('0x11b')]=function(_0xa7bad1){logger['info'](util[_0x275f('0x27')](_0x275f('0x11c'),_0xa7bad1['label']));if(!this[_0x275f('0x61')](_0xa7bad1['key'])){return this[_0x275f('0xb')][_0x275f('0x8c')](_0x275f('0xbe'));}var _0x26b448=_0x275f('0xfc');var _0x47d4ec=util[_0x275f('0x27')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x470418=util[_0x275f('0x27')](_0x275f('0xfd'),_0x47d4ec,_0x26b448);var _0x64f276=!![];if(_0xa7bad1[_0x275f('0xfe')]===_0x275f('0xff')){_0x64f276=![];}var _0x163436=this[_0x275f('0xb')]['recordFile'](_0x47d4ec,_0x26b448,_0xa7bad1[_0x275f('0x101')],_0xa7bad1['timeout'],undefined,_0x64f276);if(_0x163436['result']!==-0x1){this[_0x275f('0xb')][_0x275f('0x8c')](util[_0x275f('0x27')](_0x275f('0x11d'),_0x470418));var _0x19e0ac=this[_0x275f('0x5f')][_0x275f('0x8b')](this,_0xa7bad1,_0x470418);if(_0x19e0ac){for(var _0x54221e in _0x19e0ac){if(_0x19e0ac['hasOwnProperty'](_0x54221e)){this[_0x275f('0xb')]['setVariable'](util[_0x275f('0x27')](_0x275f('0x11e'),_0x54221e[_0x275f('0xc3')]()),_0x19e0ac[_0x54221e]);}}return this[_0x275f('0xb')][_0x275f('0x8c')](util[_0x275f('0x27')](_0x275f('0x11f'),JSON[_0x275f('0x10b')](_0x19e0ac)));}}return _0x163436;};AGIVertices[_0x275f('0xe')][_0x275f('0x120')]=function(_0x177ed8){logger[_0x275f('0x2d')](util['format'](_0x275f('0x121'),_0x177ed8[_0x275f('0x36')]));if(!this[_0x275f('0x61')](_0x177ed8[_0x275f('0x58')])){return this[_0x275f('0xb')][_0x275f('0x8c')](_0x275f('0xbe'));}if(!this['isConfigured'](_0x177ed8[_0x275f('0x55')])){return this[_0x275f('0xb')][_0x275f('0x8c')](_0x275f('0x95'));}this[_0x275f('0xb')][_0x275f('0x8c')](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x177ed8['text']));var _0x35e4f6=this['ispeechTTS'][_0x275f('0x8b')](this,_0x177ed8);if(_0x35e4f6){this[_0x275f('0xb')][_0x275f('0x8c')](util[_0x275f('0x27')](_0x275f('0x11d'),_0x35e4f6));var _0x5ea01a=this[_0x275f('0xb')][_0x275f('0xf0')](_0x35e4f6,_0x177ed8[_0x275f('0x101')]);try{fs['unlink'](_0x35e4f6+'.wav');}catch(_0x33acf5){logger[_0x275f('0x2b')](_0x33acf5);}return _0x5ea01a;}return this[_0x275f('0xb')]['error'](_0x177ed8,_0x275f('0x122'));};AGIVertices[_0x275f('0xe')][_0x275f('0x123')]=function(_0x32b68d){logger[_0x275f('0x2d')](util['format'](_0x275f('0x124'),_0x32b68d[_0x275f('0x36')]));if(!this[_0x275f('0x61')](_0x32b68d['findBy'])){return this[_0x275f('0xb')][_0x275f('0x2b')](_0x32b68d,_0x275f('0x125'));}logger['info'](util[_0x275f('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x275f('0xb')][_0x275f('0x3a')],_0x32b68d[_0x275f('0x126')]));var _0x5020c4=this[_0x275f('0x127')][_0x275f('0x8b')](this,_0x32b68d[_0x275f('0x126')]);if(_0x5020c4){logger[_0x275f('0x2d')](util[_0x275f('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x275f('0xb')]['callerid'],_0x32b68d[_0x275f('0x126')]));this[_0x275f('0xb')]['noop'](util[_0x275f('0x27')](_0x275f('0x128'),this[_0x275f('0xb')]['callerid'],_0x32b68d[_0x275f('0x126')]));return{'code':0xc8,'result':_0x275f('0x129')};}else{logger['info'](util[_0x275f('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x275f('0xb')][_0x275f('0x3a')],_0x32b68d['findBy']));this[_0x275f('0xb')][_0x275f('0x8c')](util[_0x275f('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x275f('0xb')][_0x275f('0x3a')],_0x32b68d[_0x275f('0x126')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x275f('0x12a')]=function(_0x108268){logger[_0x275f('0x2d')](util['format'](_0x275f('0x12b'),_0x108268[_0x275f('0x36')]));if(!this[_0x275f('0x61')](_0x108268[_0x275f('0x126')])){return this[_0x275f('0xb')][_0x275f('0x2b')](_0x108268,_0x275f('0x125'));}logger['info'](util[_0x275f('0x27')](_0x275f('0x12c'),this[_0x275f('0xb')][_0x275f('0x3a')],_0x108268[_0x275f('0x126')]));var _0x5694a0=this[_0x275f('0x50')][_0x275f('0x8b')](this,_0x108268[_0x275f('0x126')]);if(_0x5694a0){logger[_0x275f('0x2d')](util[_0x275f('0x27')](_0x275f('0x128'),this['channel'][_0x275f('0x3a')],_0x108268[_0x275f('0x126')]));this['channel']['noop'](util[_0x275f('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x275f('0xb')][_0x275f('0x3a')],_0x108268[_0x275f('0x126')]));return{'code':0xc8,'result':_0x275f('0x129')};}else{logger['info'](util[_0x275f('0x27')](_0x275f('0x12d'),this[_0x275f('0xb')][_0x275f('0x3a')],_0x108268[_0x275f('0x126')]));this[_0x275f('0xb')][_0x275f('0x8c')](util[_0x275f('0x27')](_0x275f('0x12d'),this['channel'][_0x275f('0x3a')],_0x108268[_0x275f('0x126')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x275f('0xe')][_0x275f('0x12e')]=function(_0xff5bf){logger[_0x275f('0x2d')](util[_0x275f('0x27')](_0x275f('0x12f'),_0xff5bf[_0x275f('0x36')]));if(!this[_0x275f('0x61')](_0xff5bf[_0x275f('0x130')])){return this[_0x275f('0xb')][_0x275f('0x2b')](_0xff5bf,_0x275f('0x131'));}this[_0x275f('0xb')]['noop'](util['format'](_0x275f('0x132'),_0xff5bf['operation']));var _0x4a2991=eval(_0xff5bf['operation']);if(!this['isConfigured'](_0xff5bf[_0x275f('0xae')])){return this[_0x275f('0xb')][_0x275f('0x8c')](_0x275f('0xaf'));}var _0x28875f=this[_0x275f('0x76')][_0x275f('0x8b')](this,_0xff5bf[_0x275f('0xae')]);if(!_0x28875f){return this[_0x275f('0xb')][_0x275f('0x2b')](_0xff5bf,_0x275f('0xe3'));}if(_[_0x275f('0x133')](_0x4a2991)){var _0x1a5273=this;_0x4a2991[_0x275f('0xb0')](function(_0x4245f7,_0x175117){_0x1a5273[_0x275f('0xb')]['setVariable'](util[_0x275f('0x27')](_0x275f('0x134'),_0x28875f,_0x175117),_0x4245f7);});return this['channel']['noop'](util[_0x275f('0x27')](_0x275f('0x135'),_0x28875f));}else{return this[_0x275f('0xb')]['setVariable'](_0x28875f,_0x4a2991);}};AGIVertices['prototype'][_0x275f('0xa')]=function(_0x38780a){logger[_0x275f('0x2d')](util[_0x275f('0x27')](_0x275f('0x136'),_0x38780a[_0x275f('0x36')]));if(_0x38780a[_0x275f('0x7d')]===0x0){return this[_0x275f('0x7c')](_0x38780a);}_0x38780a[_0x275f('0x7d')]-=0x1;if(!this['isConfigured'](_0x38780a[_0x275f('0x137')])){return this[_0x275f('0xb')][_0x275f('0x2b')](_0x38780a,_0x275f('0xdb'));}var _0x15ba7e=this[_0x275f('0xdc')]['sync'](this,_0x38780a['file_id']);if(!_0x15ba7e){return this[_0x275f('0xb')][_0x275f('0x2b')](_0x38780a,_0x275f('0xdd'));}var _0x564817=this[_0x275f('0xb')][_0x275f('0xde')](_0x15ba7e,_0x38780a[_0x275f('0xdf')],_0x38780a[_0x275f('0x138')]);var _0x296c0b=_0x564817['result'];if(_0x564817[_0x275f('0x78')]===-0x1){this[_0x275f('0x34')][_0x275f('0x8b')](this,_0x38780a,'-1');return _0x564817;}else if(_0x564817[_0x275f('0x7a')]==='timeout'){_0x564817['result']=_0x564817[_0x275f('0x78')][_0x275f('0x74')]>0x0?_0x564817[_0x275f('0x78')]:'t';}else if(_[_0x275f('0x42')](_0x564817['result'])){_0x564817[_0x275f('0x78')]='#';_0x296c0b='#';}if(!this[_0x275f('0x61')](_0x38780a['variable_id'])){this['channel']['noop'](_0x275f('0xaf'));}else{var _0x35aeba=this[_0x275f('0x76')][_0x275f('0x8b')](this,_0x38780a[_0x275f('0xae')]);if(!_0x35aeba){return this[_0x275f('0xb')][_0x275f('0x2b')](_0x38780a,_0x275f('0xe3'));}this[_0x275f('0xb')]['setVariable'](_0x35aeba,_0x296c0b);}this[_0x275f('0x34')][_0x275f('0x8b')](this,_0x38780a,_0x296c0b);return _0x564817;};AGIVertices[_0x275f('0xe')]['noop']=function(_0x1484cd){logger[_0x275f('0x2d')](util[_0x275f('0x27')](_0x275f('0x139'),_0x1484cd[_0x275f('0x36')]));return this['channel'][_0x275f('0x8c')](_0x1484cd['output']||_0x1484cd[_0x275f('0x36')]);};AGIVertices['prototype'][_0x275f('0x13a')]=function(_0x216ab4){logger[_0x275f('0x2d')](util[_0x275f('0x27')](_0x275f('0x13b'),_0x216ab4[_0x275f('0x36')]));if(!this[_0x275f('0x61')](_0x216ab4[_0x275f('0x126')])){return this[_0x275f('0xb')]['error'](_0x216ab4,_0x275f('0x125'));}logger['info'](util[_0x275f('0x27')](_0x275f('0x12c'),this[_0x275f('0xb')]['callerid'],_0x216ab4['findBy']));var _0xb8f38a=this['getPause']['sync'](this,_0x216ab4[_0x275f('0x13c')]);var _0x1af6f5=this[_0x275f('0x4d')][_0x275f('0x8b')](this,_0x216ab4['findBy'],_0xb8f38a);if(_0x1af6f5){logger[_0x275f('0x2d')](util[_0x275f('0x27')](_0x275f('0x128'),this[_0x275f('0xb')][_0x275f('0x3a')],_0x216ab4['findBy']));this[_0x275f('0xb')][_0x275f('0x8c')](util[_0x275f('0x27')](_0x275f('0x128'),this['channel'][_0x275f('0x3a')],_0x216ab4[_0x275f('0x126')]));return{'code':0xc8,'result':_0x275f('0x129')};}else{logger[_0x275f('0x2d')](util['format'](_0x275f('0x12d'),this['channel'][_0x275f('0x3a')],_0x216ab4['findBy']));this[_0x275f('0xb')]['noop'](util['format'](_0x275f('0x128'),this[_0x275f('0xb')][_0x275f('0x3a')],_0x216ab4[_0x275f('0x126')]));return{'code':0xc8,'result':_0x275f('0x13d')};}};AGIVertices[_0x275f('0xe')]['playback']=function(_0x444867){logger['info'](util['format']('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x444867['label']));if(!this[_0x275f('0x61')](_0x444867[_0x275f('0x137')])){return this[_0x275f('0xb')]['error'](_0x444867,_0x275f('0xdb'));}var _0x54ff72=this[_0x275f('0xdc')]['sync'](this,_0x444867[_0x275f('0x137')]);if(!_0x54ff72){return this['channel'][_0x275f('0x2b')](_0x444867,_0x275f('0xdd'));}var _0x420952=this['channel'][_0x275f('0x8f')]('PLAYBACK',[_0x54ff72,_0x444867['opts']]);if(_0x420952[_0x275f('0x78')]===-0x1){return _0x420952;}return this[_0x275f('0xb')][_0x275f('0x8c')](util['format'](_0x275f('0x91'),_0x275f('0x13e'),_0x54ff72));};AGIVertices[_0x275f('0xe')][_0x275f('0x13f')]=function(_0x202e98){logger[_0x275f('0x2d')](util[_0x275f('0x27')](_0x275f('0x140'),_0x202e98[_0x275f('0x36')]));if(!this[_0x275f('0x61')](_0x202e98['queue_id'])){return this[_0x275f('0xb')][_0x275f('0x2b')](_0x202e98,_0x275f('0x141'));}var _0x29502b='';var _0x5f070a=parseInt(_0x202e98[_0x275f('0x142')],0xa);if(isNaN(_0x5f070a)){_0x29502b=_0x202e98[_0x275f('0x142')];}else{_0x29502b=this[_0x275f('0x12')][_0x275f('0x8b')](this,_0x202e98[_0x275f('0x142')]);if(!_0x29502b){return this[_0x275f('0xb')][_0x275f('0x2b')](_0x202e98,'no\x20queue\x20found');}}var _0x16b0f3='';if(this['isConfigured'](_0x202e98[_0x275f('0x137')])){var _0x4dd6ca=this[_0x275f('0xdc')][_0x275f('0x8b')](this,_0x202e98[_0x275f('0x137')]);if(_0x4dd6ca){_0x16b0f3=_0x4dd6ca;}}this[_0x275f('0x34')][_0x275f('0x8b')](this,_0x202e98,_0x29502b);if(_0x202e98[_0x275f('0xbb')][_0x275f('0x143')]('x')<0x0){_0x202e98['opts']+='x';}if(_0x202e98['opts'][_0x275f('0x143')]('X')<0x0){_0x202e98['opts']+='X';}this['channel'][_0x275f('0x7b')](_0x275f('0x144'),_0x29502b?_0x29502b[_0x275f('0x145')]():'');var _0x548992=this['channel'][_0x275f('0x8f')](_0x275f('0x146'),[_0x29502b,_0x202e98[_0x275f('0xbb')],_0x202e98[_0x275f('0xd5')],_0x16b0f3,_0x202e98[_0x275f('0x81')],_0x202e98[_0x275f('0x7')],_0x202e98[_0x275f('0x147')],_0x202e98[_0x275f('0x148')],'',_0x202e98['position']]);if(_0x548992[_0x275f('0x78')]===-0x1){return _0x548992;}return this[_0x275f('0xb')][_0x275f('0x8c')](util[_0x275f('0x27')]('Executed\x20command\x20%s\x20%s','QUEUE',_0x29502b));};AGIVertices[_0x275f('0xe')]['record']=function(_0x51ed96){logger[_0x275f('0x2d')](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x51ed96['label']));var _0x5aa8da=_0x51ed96[_0x275f('0x149')]||_0x275f('0xfc');var _0x5475c7=util[_0x275f('0x27')](_0x275f('0x14a'),this[_0x275f('0xb')][_0x275f('0x35')],rs['generate'](0x5));var _0x3b4e42=util[_0x275f('0x27')]('%s/recordings/%s.%s',FILES_PATH,_0x5475c7,_0x5aa8da);var _0x32eca3=util[_0x275f('0x27')]('%s/recordings/%s',FILES_PATH,_0x5475c7);this[_0x275f('0x39')][_0x275f('0x8b')](this,_0x51ed96,_0x5475c7,_0x3b4e42);this[_0x275f('0xb')]['setVariable'](_0x275f('0x14b'),_0x5475c7);logger[_0x275f('0x2d')](_0x275f('0x14c'),_0x32eca3,_0x5aa8da,_0x51ed96[_0x275f('0x14d')],_0x51ed96['timeout']);return this['channel']['recordFile'](_0x32eca3,_0x5aa8da,_0x51ed96[_0x275f('0x14d')],_0x51ed96[_0x275f('0x81')],undefined,!![]);};AGIVertices[_0x275f('0xe')][_0x275f('0x14e')]=function(_0x39a00e){logger['info'](util[_0x275f('0x27')](_0x275f('0x14f'),_0x39a00e[_0x275f('0x36')]));return this[_0x275f('0xb')][_0x275f('0x150')](_0x39a00e[_0x275f('0x151')][_0x275f('0x53')](/\s+/g,''),_0x39a00e[_0x275f('0x14d')]);};AGIVertices[_0x275f('0xe')][_0x275f('0x152')]=function(_0x19798a){logger['info'](util[_0x275f('0x27')](_0x275f('0x153'),_0x19798a[_0x275f('0x36')]));return this[_0x275f('0xb')][_0x275f('0x154')](_0x19798a['number'][_0x275f('0x53')](/\s+/g,''),_0x19798a[_0x275f('0x14d')]);};AGIVertices[_0x275f('0xe')][_0x275f('0x155')]=function(_0x4c6543){logger[_0x275f('0x2d')](util[_0x275f('0x27')](_0x275f('0x156'),_0x4c6543[_0x275f('0x36')]));return this[_0x275f('0xb')][_0x275f('0x157')](_0x4c6543['text'],_0x4c6543[_0x275f('0x14d')]);};AGIVertices[_0x275f('0xe')][_0x275f('0x158')]=function(_0x5a1376){logger[_0x275f('0x2d')](util['format'](_0x275f('0x159'),_0x5a1376['label']));if(!this[_0x275f('0x61')](_0x5a1376[_0x275f('0x15a')])){return this[_0x275f('0xb')]['noop'](_0x275f('0x15b'));}var _0x2c294d=this[_0x275f('0x21')][_0x275f('0x8b')](this,_0x5a1376[_0x275f('0x15a')]);if(!_0x2c294d||!_0x2c294d[_0x275f('0x15c')]){return this[_0x275f('0xb')][_0x275f('0x2b')](_0x5a1376,_0x275f('0x15d'));}var _0x663c07={'from':util[_0x275f('0x27')](_0x275f('0x15e'),_0x2c294d[_0x275f('0x11')],_0x2c294d[_0x275f('0x15f')]||_0x2c294d[_0x275f('0x15c')][_0x275f('0x160')]),'to':_0x5a1376['to']||'','cc':_0x5a1376['cc']||'','bcc':_0x5a1376['bcc']||'','subject':_0x5a1376[_0x275f('0x161')],'html':_0x5a1376[_0x275f('0x55')],'text':_0x5a1376[_0x275f('0x55')]};var _0x27d4c3={'tls':{'rejectUnauthorized':![]}};if(_0x2c294d[_0x275f('0x15c')]['service']){_0x27d4c3[_0x275f('0x162')]=_0x2c294d[_0x275f('0x15c')][_0x275f('0x162')];}else{_0x27d4c3[_0x275f('0x163')]=_0x2c294d[_0x275f('0x15c')][_0x275f('0x163')];_0x27d4c3[_0x275f('0x164')]=_0x2c294d['Smtp'][_0x275f('0x164')];_0x27d4c3['secure']=_0x2c294d[_0x275f('0x15c')][_0x275f('0x165')];}if(_0x2c294d[_0x275f('0x15c')][_0x275f('0x166')]){_0x27d4c3['auth']={'user':_0x2c294d[_0x275f('0x15c')]['user'],'pass':_0x2c294d[_0x275f('0x15c')]['pass']};}if(this[_0x275f('0x61')](_0x5a1376['template_id'])){}logger[_0x275f('0xb5')]('sendMail\x20message',JSON[_0x275f('0x10b')](_0x663c07));this[_0x275f('0x34')][_0x275f('0x8b')](this,_0x5a1376,_0x5a1376['account_id']);this[_0x275f('0xb')][_0x275f('0x8c')](util[_0x275f('0x27')](_0x275f('0x167'),_0x2c294d[_0x275f('0x11')]));this[_0x275f('0x23')][_0x275f('0x8b')](this,_0x27d4c3,_0x663c07);return this[_0x275f('0xb')]['noop'](_0x275f('0x168'));};AGIVertices[_0x275f('0xe')][_0x275f('0x169')]=function(_0x589202){logger[_0x275f('0x2d')](util['format'](_0x275f('0x16a'),_0x589202[_0x275f('0x36')]));return this[_0x275f('0xb')][_0x275f('0x8c')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x275f('0xe')][_0x275f('0x16b')]=function(_0x379835){logger[_0x275f('0x2d')](util[_0x275f('0x27')](_0x275f('0x16c'),_0x379835[_0x275f('0x36')]));if(!this[_0x275f('0x61')](_0x379835['sms_account_id'])){return this[_0x275f('0xb')][_0x275f('0x8c')](_0x275f('0x16d'));}var _0x530395=this[_0x275f('0x32')][_0x275f('0x8b')](this,_0x379835[_0x275f('0x16e')]);if(!_0x530395){return this[_0x275f('0xb')][_0x275f('0x2b')](_0x379835,_0x275f('0x16f'));}var _0x54766a={'body':_0x379835[_0x275f('0x170')],'phone':_0x379835['to']||'','SmsAccountId':_0x530395['id']};logger[_0x275f('0xb5')](_0x275f('0x171'),JSON[_0x275f('0x10b')](_0x54766a));this[_0x275f('0x34')][_0x275f('0x8b')](this,_0x379835,_0x379835['sms_account_id']);this[_0x275f('0xb')]['noop'](util[_0x275f('0x27')](_0x275f('0x172'),_0x530395[_0x275f('0x11')]));this[_0x275f('0x33')][_0x275f('0x8b')](this,_0x54766a);return this['channel'][_0x275f('0x8c')](_0x275f('0x173'));};AGIVertices[_0x275f('0xe')][_0x275f('0x174')]=function(_0x854f22){logger[_0x275f('0x2d')](util[_0x275f('0x27')](_0x275f('0x175'),_0x854f22[_0x275f('0x36')]));if(!this[_0x275f('0x61')](_0x854f22['variable_id'])){return this[_0x275f('0xb')][_0x275f('0x2b')](_0x854f22,'no\x20variable\x20selected');}var _0x2765c5=this['getVariable'][_0x275f('0x8b')](this,_0x854f22[_0x275f('0xae')]);if(!_0x2765c5){return this[_0x275f('0xb')][_0x275f('0x2b')](_0x854f22,_0x275f('0xe3'));}return this[_0x275f('0xb')]['setVariable'](_0x2765c5,_0x854f22[_0x275f('0x176')]);};AGIVertices[_0x275f('0xe')]['start']=function(_0x4788b0){logger['info'](util[_0x275f('0x27')](_0x275f('0x177'),_0x4788b0[_0x275f('0x36')]));this[_0x275f('0xb')][_0x275f('0x8c')](_0x275f('0x178'));if(_0x4788b0[_0x275f('0x179')]===_0x275f('0x17a')){this['channel'][_0x275f('0x8c')](_0x275f('0x17b'));return this[_0x275f('0xb')]['answer']();}return this[_0x275f('0xb')][_0x275f('0x8c')](_0x275f('0x17c'));};AGIVertices[_0x275f('0xe')]['subproject']=function(_0x3b2723){logger[_0x275f('0x2d')](util[_0x275f('0x27')](_0x275f('0x17d'),_0x3b2723['label']));if(!this[_0x275f('0x61')](_0x3b2723[_0x275f('0x17e')])){return this['channel'][_0x275f('0x2b')](_0x3b2723,_0x275f('0x17f'));}var _0x5b98ff=this['getSquareProject'][_0x275f('0x8b')](this,_0x3b2723['project_id']);if(!this[_0x275f('0x61')](_0x5b98ff)){return this[_0x275f('0xb')][_0x275f('0x2b')](_0x3b2723,util[_0x275f('0x27')](_0x275f('0x180'),_0x3b2723[_0x275f('0x17e')]));}if(_0x5b98ff===this['channel'][_0x275f('0x38')]){return this['channel'][_0x275f('0x2b')](_0x3b2723,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x275f('0x34')][_0x275f('0x8b')](this,_0x3b2723,_0x5b98ff);var _0x3005ce=this[_0x275f('0xb')][_0x275f('0x8f')](_0x275f('0x181'),util['format'](_0x275f('0x182'),config['agi'][_0x275f('0x163')]||_0x275f('0x183'),_0x5b98ff,this[_0x275f('0xb')]['arg_1']));if(_0x3005ce[_0x275f('0x78')]===-0x1){return _0x3005ce;}return this[_0x275f('0xb')][_0x275f('0x8c')](util['format'](_0x275f('0x91'),_0x275f('0x181'),_0x5b98ff));};AGIVertices[_0x275f('0xe')][_0x275f('0x184')]=function(_0x571f01){logger[_0x275f('0x2d')](util[_0x275f('0x27')](_0x275f('0x185'),_0x571f01[_0x275f('0x36')]));var _0x165850=this[_0x275f('0x52')][_0x275f('0x8b')](this,_0x571f01[_0x275f('0x186')]);this['createSquareDetailsReport'][_0x275f('0x8b')](this,_0x571f01,_0x571f01['command']);if(this[_0x275f('0x61')](_0x571f01['variable_id'])){var _0x51a207=this['getVariable'][_0x275f('0x8b')](this,_0x571f01[_0x275f('0xae')]);if(_0x51a207){this[_0x275f('0xb')][_0x275f('0x7b')](_0x51a207,_0x165850);return this[_0x275f('0xb')]['noop'](util[_0x275f('0x27')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x571f01[_0x275f('0x186')],_0x51a207));}}return this[_0x275f('0xb')][_0x275f('0x8c')](util[_0x275f('0x27')](_0x275f('0x187'),_0x571f01['command']));};AGIVertices[_0x275f('0xe')][_0x275f('0x188')]=function(_0x3756ad){logger[_0x275f('0x2d')](util[_0x275f('0x27')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x3756ad[_0x275f('0x36')]));if(!this[_0x275f('0x61')](_0x3756ad[_0x275f('0x55')])){return this[_0x275f('0xb')][_0x275f('0x8c')](_0x275f('0x95'));}this[_0x275f('0xb')][_0x275f('0x8c')](util['format']('Trying\x20Google\x20TTS\x20%s',_0x3756ad[_0x275f('0x55')]));var _0x16f412=this[_0x275f('0x54')]['sync'](this,_0x3756ad);if(_0x16f412){this[_0x275f('0xb')][_0x275f('0x8c')](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x16f412));var _0x5c982c=this[_0x275f('0xb')][_0x275f('0xf0')](_0x16f412);try{fs['unlink'](_0x16f412+_0x275f('0x189'));}catch(_0x51c869){logger[_0x275f('0x2b')](_0x51c869);}return _0x5c982c;}return this['channel']['error'](_0x3756ad,_0x275f('0x18a'));};AGIVertices[_0x275f('0xe')][_0x275f('0x18b')]=function(_0x244a4e){logger[_0x275f('0x2d')](util[_0x275f('0x27')](_0x275f('0x18c'),_0x244a4e[_0x275f('0x36')]));if(!this[_0x275f('0x61')](_0x244a4e[_0x275f('0x126')])){return this[_0x275f('0xb')][_0x275f('0x2b')](_0x244a4e,_0x275f('0x125'));}logger[_0x275f('0x2d')](util[_0x275f('0x27')](_0x275f('0x12c'),this['channel'][_0x275f('0x3a')],_0x244a4e['findBy']));var _0x39b3f3=this[_0x275f('0x4f')][_0x275f('0x8b')](this,_0x244a4e[_0x275f('0x126')]);if(_0x39b3f3){logger[_0x275f('0x2d')](util[_0x275f('0x27')](_0x275f('0x128'),this['channel'][_0x275f('0x3a')],_0x244a4e[_0x275f('0x126')]));this[_0x275f('0xb')][_0x275f('0x8c')](util['format'](_0x275f('0x128'),this[_0x275f('0xb')][_0x275f('0x3a')],_0x244a4e[_0x275f('0x126')]));return{'code':0xc8,'result':_0x275f('0x129')};}else{logger[_0x275f('0x2d')](util[_0x275f('0x27')](_0x275f('0x12d'),this[_0x275f('0xb')][_0x275f('0x3a')],_0x244a4e[_0x275f('0x126')]));this[_0x275f('0xb')][_0x275f('0x8c')](util[_0x275f('0x27')](_0x275f('0x12d'),this[_0x275f('0xb')][_0x275f('0x3a')],_0x244a4e['findBy']));return{'code':0xc8,'result':_0x275f('0x13d')};}};AGIVertices[_0x275f('0xe')][_0x275f('0x18d')]=function(_0x1df276){logger[_0x275f('0x2d')](util[_0x275f('0x27')](_0x275f('0x18e'),_0x1df276[_0x275f('0x36')]));var _0x2b9bc9=this[_0x275f('0xb')][_0x275f('0x8f')]('VOICEMAIL',[_0x1df276[_0x275f('0x18f')],_0x1df276[_0x275f('0x90')]]);if(_0x2b9bc9[_0x275f('0x78')]===-0x1){return _0x2b9bc9;}return this['channel']['noop'](util[_0x275f('0x27')](_0x275f('0x91'),_0x275f('0x190'),_0x1df276[_0x275f('0x18f')]));};AGIVertices[_0x275f('0xe')]['vswitch']=function(_0x29a10b){logger[_0x275f('0x2d')](util['format'](_0x275f('0x191'),_0x29a10b[_0x275f('0x36')]));if(!this[_0x275f('0x61')](_0x29a10b[_0x275f('0xae')])){return this[_0x275f('0xb')][_0x275f('0x2b')](_0x29a10b,_0x275f('0x192'));}var _0x2cee62=this[_0x275f('0x76')][_0x275f('0x8b')](this,_0x29a10b[_0x275f('0xae')]);if(!_0x2cee62){return this['channel'][_0x275f('0x2b')](_0x29a10b,_0x275f('0xe3'));}var _0x2418b7=this['channel'][_0x275f('0x76')](_0x2cee62);return{'code':0xc8,'result':_0x2418b7[_0x275f('0x7a')]?_0x2418b7[_0x275f('0x7a')]:'-'};};String[_0x275f('0xe')][_0x275f('0x75')]=function(_0x597ee2,_0x6a3b88){return this[_0x275f('0x73')](_0x597ee2)[_0x275f('0x193')](_0x6a3b88);};module[_0x275f('0x194')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 932dd33..965b06c 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 _0x33c5=['hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','interface','queue','Action','QueuePause','ACW','then','getAgent','voicePause','info','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','uniqueid','update','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','finally','[ACW][START]\x20%s','message','[ACW][TIMERS]','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','isNil','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','all','Auto-Pause','exports','lodash','moment','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind'];(function(_0xce793a,_0x138edd){var _0x38c414=function(_0x52332e){while(--_0x52332e){_0xce793a['push'](_0xce793a['shift']());}};_0x38c414(++_0x138edd);}(_0x33c5,0xe6));var _0x533c=function(_0x3b87f4,_0x112243){_0x3b87f4=_0x3b87f4-0x0;var _0x63d16e=_0x33c5[_0x3b87f4];return _0x63d16e;};'use strict';var util=require('util');var _=require(_0x533c('0x0'));var moment=require(_0x533c('0x1'));var ami=require('../ami');var logger=require(_0x533c('0x2'))(_0x533c('0x3'));var RpcUser=require(_0x533c('0x4'));var RpcVoiceAgentReport=require(_0x533c('0x5'));function Acw(_0x358127){this['voiceQueues']=_0x358127[_0x533c('0x6')];this[_0x533c('0x7')]=_0x358127[_0x533c('0x7')];this[_0x533c('0x8')]=_0x358127[_0x533c('0x8')];this[_0x533c('0x9')]={};ami['on'](_0x533c('0xa'),this[_0x533c('0xb')][_0x533c('0xc')](this));ami['on'](_0x533c('0xd'),this[_0x533c('0xe')][_0x533c('0xc')](this));ami['on'](_0x533c('0xf'),this[_0x533c('0x10')][_0x533c('0xc')](this));ami['on'](_0x533c('0x11'),this['syncAgentRingNoAnswer'][_0x533c('0xc')](this));ami['on'](_0x533c('0x12'),this[_0x533c('0x13')][_0x533c('0xc')](this));ami['on'](_0x533c('0x14'),this[_0x533c('0x15')]['bind'](this));ami['on'](_0x533c('0x16'),this[_0x533c('0x17')][_0x533c('0xc')](this));}function getDiff(_0x12ecae){var _0x2d5bc8=moment()[_0x533c('0x18')](0x0);var _0x8d7c66=moment(_0x12ecae)[_0x533c('0x18')](0x0);return _0x2d5bc8['diff'](_0x8d7c66,_0x533c('0x19'));}Acw[_0x533c('0x1a')][_0x533c('0x1b')]=function(_0x3e544f){try{var _0x56dfb7=this;var _0x1031e7=this[_0x533c('0x9')][_0x3e544f][_0x533c('0x1c')];var _0x311700=this[_0x533c('0x9')][_0x3e544f][_0x533c('0x1d')];ami[_0x533c('0x1e')]({'action':_0x533c('0x1f'),'interface':_0x1031e7,'paused':!![],'reason':_0x533c('0x20')})[_0x533c('0x21')](function(_0x287b9e){if(_0x56dfb7[_0x533c('0x7')][_0x1031e7]){return RpcUser[_0x533c('0x22')](_0x56dfb7[_0x533c('0x7')][_0x1031e7]['id'])[_0x533c('0x21')](function(_0x3de9fa){if(_0x3de9fa&&!_0x3de9fa[_0x533c('0x23')]){logger[_0x533c('0x24')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x3e544f,_0x1031e7,_0x311700);return RpcUser[_0x533c('0x25')](_0x56dfb7['agents'][_0x1031e7],'ACW',_0x3e544f)[_0x533c('0x21')](function(_0x36d4e4){_0x56dfb7['timers'][_0x1031e7]={};logger[_0x533c('0x24')](_0x533c('0x26'),_0x3e544f,_0x56dfb7[_0x533c('0x6')][_0x311700][_0x533c('0x27')],_0x1031e7,_0x311700);_0x56dfb7['timers'][_0x1031e7][_0x533c('0x28')]=setTimeout(_0x56dfb7[_0x533c('0x29')][_0x533c('0xc')](_0x56dfb7,_0x1031e7),_0x56dfb7[_0x533c('0x6')][_0x311700][_0x533c('0x27')]*0x3e8);_0x56dfb7[_0x533c('0x8')][_0x1031e7][_0x533c('0x2a')]=_0x36d4e4[_0x533c('0x2a')];_0x56dfb7[_0x533c('0x8')][_0x1031e7][_0x533c('0x2b')]=_0x3e544f;_0x56dfb7['timers'][_0x1031e7][_0x533c('0x1d')]=_0x311700;_0x56dfb7[_0x533c('0x8')][_0x1031e7]['updateAcw']=function(){var _0x3caaa5=getDiff(_0x56dfb7['timers'][_0x1031e7][_0x533c('0x2a')]);clearTimeout(_0x56dfb7[_0x533c('0x8')][_0x1031e7][_0x533c('0x28')]);RpcVoiceAgentReport[_0x533c('0x2c')]({'acwtime':_0x3caaa5},_0x56dfb7[_0x533c('0x8')][_0x1031e7][_0x533c('0x2b')],_0x1031e7)[_0x533c('0x21')](function(_0x38d886){logger[_0x533c('0x24')](_0x533c('0x2d'),_0x3e544f,_0x3caaa5,_0x38d886);})[_0x533c('0x2e')](function(_0x73c0){logger['error'](_0x533c('0x2f'),_0x3e544f,_0x73c0);});delete _0x56dfb7['timers'][_0x1031e7];};});}else{logger[_0x533c('0x24')](_0x533c('0x30'),_0x3e544f,_0x1031e7,_0x311700);}});}})[_0x533c('0x2e')](function(_0xa42b78){logger[_0x533c('0x31')](_0x533c('0x26'),_0x3e544f,_0x56dfb7[_0x533c('0x6')][_0x311700][_0x533c('0x27')],_0x1031e7,_0x311700);})[_0x533c('0x32')](function(){delete _0x56dfb7[_0x533c('0x9')][_0x3e544f];});}catch(_0x1bbcb7){logger[_0x533c('0x31')](_0x533c('0x33'),_0x1bbcb7[_0x533c('0x34')]);}};Acw[_0x533c('0x1a')]['stopAcw']=function(_0x2b801e){try{var _0x182d69=this;if(_0x182d69[_0x533c('0x8')][_0x2b801e]){var _0x31129f=_0x182d69['timers'][_0x2b801e][_0x533c('0x2b')];var _0x31b4e4=_0x182d69[_0x533c('0x8')][_0x2b801e][_0x533c('0x1d')];var _0x1255b1=_0x182d69['voiceQueues'][_0x31b4e4]['acwTimeout'];logger['info']('[TIMER][STOP][AGENT:%s]',_0x2b801e);RpcUser['saveUnpause'](this[_0x533c('0x7')][_0x2b801e]);RpcVoiceAgentReport['update']({'acwtime':_0x1255b1,'agentacw':!![]},_0x31129f,_0x2b801e)[_0x533c('0x21')](function(_0x55726a){logger[_0x533c('0x24')](_0x533c('0x2d'),_0x31129f,_0x1255b1,_0x55726a);})[_0x533c('0x2e')](function(_0x56adcc){logger[_0x533c('0x31')](_0x533c('0x2f'),_0x31129f,_0x56adcc);});}else{logger[_0x533c('0x31')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x2b801e);if(_0x182d69[_0x533c('0x8')]){logger[_0x533c('0x24')](_0x533c('0x35'),JSON['stringify'](_0x182d69[_0x533c('0x8')]));}}}catch(_0xdfeb18){logger[_0x533c('0x31')](_0x533c('0x36'),_0xdfeb18[_0x533c('0x34')]);}};Acw[_0x533c('0x1a')][_0x533c('0xb')]=function(_0x2dbd81){try{if(this[_0x533c('0x6')][_0x2dbd81[_0x533c('0x1d')]]&&this[_0x533c('0x6')][_0x2dbd81['queue']][_0x533c('0x3')]){if(this[_0x533c('0x7')][_0x2dbd81[_0x533c('0x1c')]]){this[_0x533c('0x9')][_0x2dbd81[_0x533c('0x2b')]]={'queue':_0x2dbd81[_0x533c('0x1d')],'interface':_0x2dbd81['interface']};}}}catch(_0x88ea5d){logger[_0x533c('0x31')](_0x533c('0x37'),_0x88ea5d['message']);}};Acw[_0x533c('0x1a')][_0x533c('0x17')]=function(_0x315e67){try{if(this[_0x533c('0x6')][_0x315e67['queue']]&&this[_0x533c('0x6')][_0x315e67['queue']][_0x533c('0x3')]){if(this[_0x533c('0x7')][_0x315e67['interface']]){this[_0x533c('0x9')][_0x315e67[_0x533c('0x2b')]]={'queue':_0x315e67[_0x533c('0x1d')],'interface':_0x315e67['interface']};}}}catch(_0x4d96cf){logger['error']('[ACW][syncAgentConnectPreview]\x20%s',_0x4d96cf[_0x533c('0x34')]);}};Acw['prototype'][_0x533c('0xe')]=function(_0x503852){try{if(this[_0x533c('0x9')][_0x503852['uniqueid']]&&_[_0x533c('0x38')](this[_0x533c('0x9')][_0x503852['uniqueid']][_0x533c('0x39')])){logger[_0x533c('0x24')](_0x533c('0x3a'),_0x503852[_0x533c('0x2b')]);this[_0x533c('0x1b')](_0x503852['uniqueid']);}else if(this[_0x533c('0x9')][_0x503852[_0x533c('0x3b')]]&&_[_0x533c('0x38')](this[_0x533c('0x9')][_0x503852['linkedid']][_0x533c('0x39')])){logger[_0x533c('0x24')]('[%s][HANGUP:LINKEDID]',_0x503852['linkedid']);this[_0x533c('0x1b')](_0x503852['linkedid']);}}catch(_0x2619b0){logger[_0x533c('0x31')](_0x533c('0x3c'),_0x2619b0[_0x533c('0x34')]);}};Acw[_0x533c('0x1a')][_0x533c('0x10')]=function(_0xa34f64){try{if(this[_0x533c('0x9')][_0xa34f64['uniqueid']]&&this[_0x533c('0x9')][_0xa34f64[_0x533c('0x2b')]][_0x533c('0x39')]){logger['info'](_0x533c('0x3d'),_0xa34f64[_0x533c('0x2b')]);this['startAcw'](_0xa34f64[_0x533c('0x2b')]);}else if(this['channels'][_0xa34f64[_0x533c('0x3b')]]&&this[_0x533c('0x9')][_0xa34f64[_0x533c('0x3b')]][_0x533c('0x39')]){logger[_0x533c('0x24')](_0x533c('0x3e'),_0xa34f64[_0x533c('0x3b')]);this['startAcw'](_0xa34f64[_0x533c('0x3b')]);}}catch(_0x24c2f4){logger[_0x533c('0x31')](_0x533c('0x3f'),_0x24c2f4[_0x533c('0x34')]);}};Acw[_0x533c('0x1a')][_0x533c('0x13')]=function(_0x50d5a2){try{if(!_['isNil'](this['channels'][_0x50d5a2['transfereeuniqueid']])){this[_0x533c('0x1b')](_0x50d5a2[_0x533c('0x40')]);if(this['channels'][_0x50d5a2[_0x533c('0x41')]]){this[_0x533c('0x9')][_0x50d5a2[_0x533c('0x41')]]['attended']=!![];this[_0x533c('0x9')][_0x50d5a2['transfertargetuniqueid']]=this['channels'][_0x50d5a2[_0x533c('0x41')]];delete this[_0x533c('0x9')][_0x50d5a2[_0x533c('0x41')]];}}else if(!_[_0x533c('0x42')](this[_0x533c('0x9')][_0x50d5a2[_0x533c('0x43')]])){this[_0x533c('0x1b')](_0x50d5a2['transfertargetuniqueid']);if(this[_0x533c('0x9')][_0x50d5a2['origtransfereruniqueid']]){this[_0x533c('0x9')][_0x50d5a2[_0x533c('0x44')]][_0x533c('0x39')]=!![];this[_0x533c('0x9')][_0x50d5a2[_0x533c('0x40')]]=this[_0x533c('0x9')][_0x50d5a2[_0x533c('0x44')]];delete this[_0x533c('0x9')][_0x50d5a2['origtransfereruniqueid']];}}}catch(_0x9d321f){logger[_0x533c('0x31')](_0x533c('0x45'),_0x9d321f[_0x533c('0x34')]);}};Acw[_0x533c('0x1a')][_0x533c('0x15')]=function(_0x534859){try{if(this[_0x533c('0x9')][_0x534859['transfereruniqueid']]){logger[_0x533c('0x24')](_0x533c('0x46'),JSON[_0x533c('0x47')](_0x534859[_0x533c('0x48')]));this[_0x533c('0x1b')](_0x534859[_0x533c('0x48')]);}else if(this['channels'][_0x534859['transfererlinkedid']]){logger[_0x533c('0x24')](_0x533c('0x49'),JSON[_0x533c('0x47')](_0x534859[_0x533c('0x4a')]));this['startAcw'](_0x534859[_0x533c('0x4a')]);}}catch(_0x301cba){logger[_0x533c('0x31')](_0x533c('0x4b'),_0x301cba[_0x533c('0x34')]);}};Acw[_0x533c('0x1a')][_0x533c('0x4c')]=function(_0x3cc209){try{if(this[_0x533c('0x6')][_0x3cc209[_0x533c('0x1d')]]&&this[_0x533c('0x6')][_0x3cc209[_0x533c('0x1d')]][_0x533c('0x4d')]===_0x533c('0x4e')){if(this[_0x533c('0x7')][_0x3cc209[_0x533c('0x1c')]]){logger[_0x533c('0x24')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x3cc209[_0x533c('0x2b')],_0x3cc209['interface'],_0x3cc209['queue']);return RpcUser[_0x533c('0x25')](this[_0x533c('0x7')][_0x3cc209[_0x533c('0x1c')]],_0x533c('0x4f'),_0x3cc209[_0x533c('0x2b')]);}}}catch(_0x1eaf34){logger[_0x533c('0x31')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x1eaf34[_0x533c('0x34')]);}};module[_0x533c('0x50')]=Acw; \ No newline at end of file +var _0x9c5a=['ACW','then','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','savePause','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','stopAcw','acwTimeout','lastPauseAt','uniqueid','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','update','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','syncAgentConnect','bind','syncHangupRequest','syncHangup','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','channels','interface','queue','Action','QueuePause'];(function(_0x447725,_0x49753b){var _0x399167=function(_0x1e47d9){while(--_0x1e47d9){_0x447725['push'](_0x447725['shift']());}};_0x399167(++_0x49753b);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x732487,_0x5623d1){_0x732487=_0x732487-0x0;var _0x8906d4=_0x9c5a[_0x732487];return _0x8906d4;};'use strict';var util=require(_0xa9c5('0x0'));var _=require(_0xa9c5('0x1'));var moment=require('moment');var ami=require(_0xa9c5('0x2'));var logger=require(_0xa9c5('0x3'))(_0xa9c5('0x4'));var RpcUser=require(_0xa9c5('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x2acfaf){this[_0xa9c5('0x6')]=_0x2acfaf['voiceQueues'];this[_0xa9c5('0x7')]=_0x2acfaf['agents'];this[_0xa9c5('0x8')]=_0x2acfaf[_0xa9c5('0x8')];this['channels']={};ami['on']('agentconnect',this[_0xa9c5('0x9')][_0xa9c5('0xa')](this));ami['on']('hanguprequest',this[_0xa9c5('0xb')][_0xa9c5('0xa')](this));ami['on']('hangup',this[_0xa9c5('0xc')][_0xa9c5('0xa')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0xa9c5('0xa')](this));ami['on'](_0xa9c5('0xd'),this[_0xa9c5('0xe')][_0xa9c5('0xa')](this));ami['on'](_0xa9c5('0xf'),this[_0xa9c5('0x10')][_0xa9c5('0xa')](this));ami['on'](_0xa9c5('0x11'),this[_0xa9c5('0x12')][_0xa9c5('0xa')](this));}function getDiff(_0x5915ad){var _0x390ca2=moment()[_0xa9c5('0x13')](0x0);var _0x7df76d=moment(_0x5915ad)[_0xa9c5('0x13')](0x0);return _0x390ca2[_0xa9c5('0x14')](_0x7df76d,_0xa9c5('0x15'));}Acw[_0xa9c5('0x16')][_0xa9c5('0x17')]=function(_0x19a43e){try{var _0xcf13f2=this;var _0x4bb57e=this[_0xa9c5('0x18')][_0x19a43e][_0xa9c5('0x19')];var _0x1ee5ac=this['channels'][_0x19a43e][_0xa9c5('0x1a')];ami[_0xa9c5('0x1b')]({'action':_0xa9c5('0x1c'),'interface':_0x4bb57e,'paused':!![],'reason':_0xa9c5('0x1d')})[_0xa9c5('0x1e')](function(_0x349f27){if(_0xcf13f2[_0xa9c5('0x7')][_0x4bb57e]){return RpcUser[_0xa9c5('0x1f')](_0xcf13f2[_0xa9c5('0x7')][_0x4bb57e]['id'])[_0xa9c5('0x1e')](function(_0x113c8f){if(_0x113c8f&&!_0x113c8f[_0xa9c5('0x20')]){logger['info'](_0xa9c5('0x21'),_0x19a43e,_0x4bb57e,_0x1ee5ac);return RpcUser[_0xa9c5('0x22')](_0xcf13f2['agents'][_0x4bb57e],'ACW',_0x19a43e)[_0xa9c5('0x1e')](function(_0x366f5c){_0xcf13f2[_0xa9c5('0x8')][_0x4bb57e]={};logger[_0xa9c5('0x23')](_0xa9c5('0x24'),_0x19a43e,_0xcf13f2[_0xa9c5('0x6')][_0x1ee5ac]['acwTimeout'],_0x4bb57e,_0x1ee5ac);_0xcf13f2['timers'][_0x4bb57e][_0xa9c5('0x25')]=setTimeout(_0xcf13f2[_0xa9c5('0x26')]['bind'](_0xcf13f2,_0x4bb57e),_0xcf13f2[_0xa9c5('0x6')][_0x1ee5ac][_0xa9c5('0x27')]*0x3e8);_0xcf13f2[_0xa9c5('0x8')][_0x4bb57e][_0xa9c5('0x28')]=_0x366f5c[_0xa9c5('0x28')];_0xcf13f2[_0xa9c5('0x8')][_0x4bb57e][_0xa9c5('0x29')]=_0x19a43e;_0xcf13f2['timers'][_0x4bb57e]['queue']=_0x1ee5ac;_0xcf13f2[_0xa9c5('0x8')][_0x4bb57e]['updateAcw']=function(){var _0x1762ac=getDiff(_0xcf13f2[_0xa9c5('0x8')][_0x4bb57e]['lastPauseAt']);clearTimeout(_0xcf13f2[_0xa9c5('0x8')][_0x4bb57e][_0xa9c5('0x25')]);RpcVoiceAgentReport['update']({'acwtime':_0x1762ac},_0xcf13f2[_0xa9c5('0x8')][_0x4bb57e][_0xa9c5('0x29')],_0x4bb57e)[_0xa9c5('0x1e')](function(_0x185eb8){logger[_0xa9c5('0x23')]('[%s][UPDATE][ACWTIME:%s]',_0x19a43e,_0x1762ac,_0x185eb8);})[_0xa9c5('0x2a')](function(_0x4cee90){logger[_0xa9c5('0x2b')](_0xa9c5('0x2c'),_0x19a43e,_0x4cee90);});delete _0xcf13f2[_0xa9c5('0x8')][_0x4bb57e];};});}else{logger['info'](_0xa9c5('0x2d'),_0x19a43e,_0x4bb57e,_0x1ee5ac);}});}})[_0xa9c5('0x2a')](function(_0x5bc9bb){logger[_0xa9c5('0x2b')](_0xa9c5('0x24'),_0x19a43e,_0xcf13f2[_0xa9c5('0x6')][_0x1ee5ac][_0xa9c5('0x27')],_0x4bb57e,_0x1ee5ac);})[_0xa9c5('0x2e')](function(){delete _0xcf13f2[_0xa9c5('0x18')][_0x19a43e];});}catch(_0x3a66d8){logger['error'](_0xa9c5('0x2f'),_0x3a66d8[_0xa9c5('0x30')]);}};Acw[_0xa9c5('0x16')][_0xa9c5('0x26')]=function(_0x1c617c){try{var _0x2de191=this;if(_0x2de191[_0xa9c5('0x8')][_0x1c617c]){var _0x36b599=_0x2de191['timers'][_0x1c617c]['uniqueid'];var _0x1487a4=_0x2de191[_0xa9c5('0x8')][_0x1c617c][_0xa9c5('0x1a')];var _0x1313b2=_0x2de191[_0xa9c5('0x6')][_0x1487a4][_0xa9c5('0x27')];logger['info']('[TIMER][STOP][AGENT:%s]',_0x1c617c);RpcUser['saveUnpause'](this[_0xa9c5('0x7')][_0x1c617c]);RpcVoiceAgentReport[_0xa9c5('0x31')]({'acwtime':_0x1313b2,'agentacw':!![]},_0x36b599,_0x1c617c)['then'](function(_0x13a1f5){logger['info'](_0xa9c5('0x32'),_0x36b599,_0x1313b2,_0x13a1f5);})[_0xa9c5('0x2a')](function(_0x2567be){logger[_0xa9c5('0x2b')]('[%s][UPDATE][ERRORS:%s]',_0x36b599,_0x2567be);});}else{logger[_0xa9c5('0x2b')](_0xa9c5('0x33'),_0x1c617c);if(_0x2de191[_0xa9c5('0x8')]){logger[_0xa9c5('0x23')](_0xa9c5('0x34'),JSON[_0xa9c5('0x35')](_0x2de191[_0xa9c5('0x8')]));}}}catch(_0x251812){logger['error'](_0xa9c5('0x36'),_0x251812[_0xa9c5('0x30')]);}};Acw[_0xa9c5('0x16')][_0xa9c5('0x9')]=function(_0x1132e0){try{if(this[_0xa9c5('0x6')][_0x1132e0['queue']]&&this[_0xa9c5('0x6')][_0x1132e0['queue']][_0xa9c5('0x4')]){if(this['agents'][_0x1132e0[_0xa9c5('0x19')]]){this[_0xa9c5('0x18')][_0x1132e0[_0xa9c5('0x29')]]={'queue':_0x1132e0['queue'],'interface':_0x1132e0[_0xa9c5('0x19')]};}}}catch(_0x1ddd72){logger[_0xa9c5('0x2b')](_0xa9c5('0x37'),_0x1ddd72['message']);}};Acw[_0xa9c5('0x16')][_0xa9c5('0x12')]=function(_0x3db918){try{if(this[_0xa9c5('0x6')][_0x3db918[_0xa9c5('0x1a')]]&&this['voiceQueues'][_0x3db918[_0xa9c5('0x1a')]]['acw']){if(this[_0xa9c5('0x7')][_0x3db918[_0xa9c5('0x19')]]){this[_0xa9c5('0x18')][_0x3db918[_0xa9c5('0x29')]]={'queue':_0x3db918[_0xa9c5('0x1a')],'interface':_0x3db918[_0xa9c5('0x19')]};}}}catch(_0xf35cb3){logger[_0xa9c5('0x2b')](_0xa9c5('0x38'),_0xf35cb3[_0xa9c5('0x30')]);}};Acw['prototype'][_0xa9c5('0xb')]=function(_0x786982){try{if(this[_0xa9c5('0x18')][_0x786982[_0xa9c5('0x29')]]&&_[_0xa9c5('0x39')](this[_0xa9c5('0x18')][_0x786982['uniqueid']][_0xa9c5('0x3a')])){logger[_0xa9c5('0x23')]('[%s][HANGUP:UNIQUEID]',_0x786982['uniqueid']);this['startAcw'](_0x786982['uniqueid']);}else if(this['channels'][_0x786982[_0xa9c5('0x3b')]]&&_[_0xa9c5('0x39')](this[_0xa9c5('0x18')][_0x786982[_0xa9c5('0x3b')]][_0xa9c5('0x3a')])){logger[_0xa9c5('0x23')](_0xa9c5('0x3c'),_0x786982[_0xa9c5('0x3b')]);this[_0xa9c5('0x17')](_0x786982[_0xa9c5('0x3b')]);}}catch(_0x414ffb){logger[_0xa9c5('0x2b')](_0xa9c5('0x3d'),_0x414ffb['message']);}};Acw[_0xa9c5('0x16')]['syncHangup']=function(_0x447335){try{if(this[_0xa9c5('0x18')][_0x447335['uniqueid']]&&this['channels'][_0x447335[_0xa9c5('0x29')]][_0xa9c5('0x3a')]){logger[_0xa9c5('0x23')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x447335['uniqueid']);this[_0xa9c5('0x17')](_0x447335[_0xa9c5('0x29')]);}else if(this['channels'][_0x447335[_0xa9c5('0x3b')]]&&this[_0xa9c5('0x18')][_0x447335[_0xa9c5('0x3b')]][_0xa9c5('0x3a')]){logger[_0xa9c5('0x23')](_0xa9c5('0x3e'),_0x447335['linkedid']);this['startAcw'](_0x447335['linkedid']);}}catch(_0x4317d8){logger[_0xa9c5('0x2b')](_0xa9c5('0x3f'),_0x4317d8[_0xa9c5('0x30')]);}};Acw[_0xa9c5('0x16')][_0xa9c5('0xe')]=function(_0x56bc1d){try{if(!_[_0xa9c5('0x40')](this[_0xa9c5('0x18')][_0x56bc1d[_0xa9c5('0x41')]])){this[_0xa9c5('0x17')](_0x56bc1d[_0xa9c5('0x41')]);if(this[_0xa9c5('0x18')][_0x56bc1d['secondtransfereruniqueid']]){this['channels'][_0x56bc1d[_0xa9c5('0x42')]]['attended']=!![];this[_0xa9c5('0x18')][_0x56bc1d['transfertargetuniqueid']]=this[_0xa9c5('0x18')][_0x56bc1d[_0xa9c5('0x42')]];delete this[_0xa9c5('0x18')][_0x56bc1d['secondtransfereruniqueid']];}}else if(!_[_0xa9c5('0x40')](this[_0xa9c5('0x18')][_0x56bc1d[_0xa9c5('0x43')]])){this[_0xa9c5('0x17')](_0x56bc1d['transfertargetuniqueid']);if(this['channels'][_0x56bc1d[_0xa9c5('0x44')]]){this[_0xa9c5('0x18')][_0x56bc1d[_0xa9c5('0x44')]]['attended']=!![];this[_0xa9c5('0x18')][_0x56bc1d[_0xa9c5('0x41')]]=this[_0xa9c5('0x18')][_0x56bc1d[_0xa9c5('0x44')]];delete this[_0xa9c5('0x18')][_0x56bc1d[_0xa9c5('0x44')]];}}}catch(_0x24fc67){logger[_0xa9c5('0x2b')]('[ACW][syncAttendedTransfer]\x20%s',_0x24fc67[_0xa9c5('0x30')]);}};Acw['prototype'][_0xa9c5('0x10')]=function(_0x2b9d39){try{if(this[_0xa9c5('0x18')][_0x2b9d39['transfereruniqueid']]){logger[_0xa9c5('0x23')](_0xa9c5('0x45'),JSON['stringify'](_0x2b9d39[_0xa9c5('0x46')]));this[_0xa9c5('0x17')](_0x2b9d39[_0xa9c5('0x46')]);}else if(this[_0xa9c5('0x18')][_0x2b9d39['transfererlinkedid']]){logger[_0xa9c5('0x23')](_0xa9c5('0x47'),JSON[_0xa9c5('0x35')](_0x2b9d39[_0xa9c5('0x48')]));this['startAcw'](_0x2b9d39['transfererlinkedid']);}}catch(_0x367727){logger[_0xa9c5('0x2b')](_0xa9c5('0x49'),_0x367727[_0xa9c5('0x30')]);}};Acw[_0xa9c5('0x16')][_0xa9c5('0x4a')]=function(_0x4b51f9){try{if(this[_0xa9c5('0x6')][_0x4b51f9[_0xa9c5('0x1a')]]&&this[_0xa9c5('0x6')][_0x4b51f9[_0xa9c5('0x1a')]][_0xa9c5('0x4b')]===_0xa9c5('0x4c')){if(this[_0xa9c5('0x7')][_0x4b51f9[_0xa9c5('0x19')]]){logger[_0xa9c5('0x23')](_0xa9c5('0x4d'),_0x4b51f9['uniqueid'],_0x4b51f9['interface'],_0x4b51f9[_0xa9c5('0x1a')]);return RpcUser[_0xa9c5('0x22')](this[_0xa9c5('0x7')][_0x4b51f9[_0xa9c5('0x19')]],'Auto-Pause',_0x4b51f9[_0xa9c5('0x29')]);}}}catch(_0x4aa699){logger[_0xa9c5('0x2b')](_0xa9c5('0x4e'),_0x4aa699[_0xa9c5('0x30')]);}};module[_0xa9c5('0x4f')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index ce9d708..09b4cf9 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 _0x2160=['../../config/logger','ami','../../config/environment','asterisk','port','username','password','keepConnected','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','log','exports','asterisk-manager','bluebird','moment','util','lodash'];(function(_0x4883cb,_0x3df63c){var _0x33aad7=function(_0x2e901e){while(--_0x2e901e){_0x4883cb['push'](_0x4883cb['shift']());}};_0x33aad7(++_0x3df63c);}(_0x2160,0x1c9));var _0x0216=function(_0x396a98,_0xf277b9){_0x396a98=_0x396a98-0x0;var _0x18fac0=_0x2160[_0x396a98];return _0x18fac0;};'use strict';var Manager=require(_0x0216('0x0'));var BPromise=require(_0x0216('0x1'));var moment=require(_0x0216('0x2'));var util=require(_0x0216('0x3'));var _=require(_0x0216('0x4'));var logger=require(_0x0216('0x5'))(_0x0216('0x6'));var config=require(_0x0216('0x7'));var ami=new Manager(config[_0x0216('0x8')][_0x0216('0x9')],config[_0x0216('0x8')]['ip'],config[_0x0216('0x8')][_0x0216('0xa')],config[_0x0216('0x8')][_0x0216('0xb')],!![]);ami[_0x0216('0xc')]();ami[_0x0216('0xd')]=BPromise['promisify'](ami[_0x0216('0xe')]);function error(_0x503701){logger[_0x0216('0xf')](util[_0x0216('0x10')](_0x0216('0x11'),config['asterisk']['username'],config[_0x0216('0x8')]['ip'],config['asterisk']['port'],util[_0x0216('0x12')](_0x503701,![],null)));}function close(){logger[_0x0216('0xf')](util['format'](_0x0216('0x13'),config[_0x0216('0x8')]['username'],config[_0x0216('0x8')]['ip'],config['asterisk'][_0x0216('0x9')]));}ami[_0x0216('0x14')]=function(){return function(){return ami[_0x0216('0xd')]({'action':_0x0216('0x15')});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':_0x0216('0x16')});};};ami[_0x0216('0x17')]=function(){return function(){return ami[_0x0216('0xd')]({'action':_0x0216('0x18')});};};ami[_0x0216('0x19')]=function(){return function(){return ami[_0x0216('0xd')]({'action':_0x0216('0x1a')});};};ami[_0x0216('0x1b')]=function(){return function(){return ami[_0x0216('0xd')]({'action':_0x0216('0x1c')});};};function connect(_0x5eeaab){logger[_0x0216('0x1d')](util[_0x0216('0x10')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config['asterisk'][_0x0216('0xa')],config[_0x0216('0x8')]['ip'],config[_0x0216('0x8')][_0x0216('0x9')]));ami[_0x0216('0x1e')](_0x0216('0xf'),error);ami['once'](_0x0216('0x1f'),close);}ami['on'](_0x0216('0x20'),connect);ami['on'](_0x0216('0x21'),function(_0x3c3c15){logger[_0x0216('0x1d')](util[_0x0216('0x10')](_0x0216('0x22'),config[_0x0216('0x8')]['username'],config['asterisk']['ip'],config[_0x0216('0x8')]['port'],util[_0x0216('0x12')](_0x3c3c15,![],null)));});ami['on'](_0x0216('0x23'),function(_0x3b9053){logger[_0x0216('0x1d')](util[_0x0216('0x10')](_0x0216('0x24'),config[_0x0216('0x8')][_0x0216('0xa')],config[_0x0216('0x8')]['ip'],config[_0x0216('0x8')][_0x0216('0x9')]));return BPromise[_0x0216('0x25')]()[_0x0216('0x26')](ami['actionSipShowRegistry']())[_0x0216('0x26')](ami['actionDeviceStateList']())[_0x0216('0x26')](ami[_0x0216('0x17')]())[_0x0216('0x26')](ami[_0x0216('0x19')]())[_0x0216('0x26')](ami['actionCoreShowChannels']())[_0x0216('0x27')](function(_0x3e193c){console[_0x0216('0x28')](_0x3e193c);});});ami['once'](_0x0216('0xf'),error);ami[_0x0216('0x1e')](_0x0216('0x1f'),close);module[_0x0216('0x29')]=ami; \ No newline at end of file +var _0xe03a=['Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','info','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','catch','log','exports','asterisk-manager','bluebird','moment','util','lodash','../../config/logger','ami','../../config/environment','asterisk','port','username','password','keepConnected','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Action','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close'];(function(_0x232e4e,_0x5eb705){var _0x44bec8=function(_0x259d15){while(--_0x259d15){_0x232e4e['push'](_0x232e4e['shift']());}};_0x44bec8(++_0x5eb705);}(_0xe03a,0x15f));var _0xae03=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe03a[_0x3dd15e];return _0x231fd0;};'use strict';var Manager=require(_0xae03('0x0'));var BPromise=require(_0xae03('0x1'));var moment=require(_0xae03('0x2'));var util=require(_0xae03('0x3'));var _=require(_0xae03('0x4'));var logger=require(_0xae03('0x5'))(_0xae03('0x6'));var config=require(_0xae03('0x7'));var ami=new Manager(config[_0xae03('0x8')][_0xae03('0x9')],config[_0xae03('0x8')]['ip'],config['asterisk'][_0xae03('0xa')],config[_0xae03('0x8')][_0xae03('0xb')],!![]);ami[_0xae03('0xc')]();ami['Action']=BPromise[_0xae03('0xd')](ami[_0xae03('0xe')]);function error(_0x4c299a){logger[_0xae03('0xf')](util[_0xae03('0x10')](_0xae03('0x11'),config[_0xae03('0x8')]['username'],config[_0xae03('0x8')]['ip'],config[_0xae03('0x8')][_0xae03('0x9')],util[_0xae03('0x12')](_0x4c299a,![],null)));}function close(){logger[_0xae03('0xf')](util[_0xae03('0x10')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xae03('0x8')][_0xae03('0xa')],config['asterisk']['ip'],config[_0xae03('0x8')][_0xae03('0x9')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xae03('0x13')]({'action':_0xae03('0x14')});};};ami[_0xae03('0x15')]=function(){return function(){return ami['Action']({'action':'devicestatelist'});};};ami[_0xae03('0x16')]=function(){return function(){return ami[_0xae03('0x13')]({'action':_0xae03('0x17')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0xae03('0x13')]({'action':'queuesummary'});};};ami[_0xae03('0x18')]=function(){return function(){return ami[_0xae03('0x13')]({'action':_0xae03('0x19')});};};function connect(_0x473bcf){logger['info'](util['format'](_0xae03('0x1a'),config[_0xae03('0x8')]['username'],config['asterisk']['ip'],config[_0xae03('0x8')]['port']));ami[_0xae03('0x1b')](_0xae03('0xf'),error);ami[_0xae03('0x1b')](_0xae03('0x1c'),close);}ami['on']('connect',connect);ami['on']('shutdown',function(_0x422c60){logger['info'](util[_0xae03('0x10')](_0xae03('0x1d'),config[_0xae03('0x8')][_0xae03('0xa')],config['asterisk']['ip'],config[_0xae03('0x8')]['port'],util[_0xae03('0x12')](_0x422c60,![],null)));});ami['on']('fullybooted',function(_0x4ef2d0){logger[_0xae03('0x1e')](util[_0xae03('0x10')](_0xae03('0x1f'),config['asterisk']['username'],config[_0xae03('0x8')]['ip'],config[_0xae03('0x8')][_0xae03('0x9')]));return BPromise[_0xae03('0x20')]()[_0xae03('0x21')](ami[_0xae03('0x22')]())['then'](ami[_0xae03('0x15')]())[_0xae03('0x21')](ami[_0xae03('0x16')]())[_0xae03('0x21')](ami['actionQueueSummary']())[_0xae03('0x21')](ami['actionCoreShowChannels']())[_0xae03('0x23')](function(_0x441153){console[_0xae03('0x24')](_0x441153);});});ami['once'](_0xae03('0xf'),error);ami[_0xae03('0x1b')](_0xae03('0x1c'),close);module[_0xae03('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 23dd744..17fdede 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 _0x3c3b=['exports','ami','http','Request','request','then','debug','rpc','error','memberReport','message','result','catch'];(function(_0x2d236a,_0xc5ceba){var _0x452568=function(_0x28cfa6){while(--_0x28cfa6){_0x2d236a['push'](_0x2d236a['shift']());}};_0x452568(++_0xc5ceba);}(_0x3c3b,0x1bb));var _0xb3c3=function(_0x3e0f9b,_0xeeb4d4){_0x3e0f9b=_0x3e0f9b-0x0;var _0x44dbd4=_0x3c3b[_0x3e0f9b];return _0x44dbd4;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require('../../config/logger')(_0xb3c3('0x0'));var client=jayson['client'][_0xb3c3('0x1')]({'port':0x2329});client[_0xb3c3('0x2')]=function(_0x458944,_0xfff6fb){return new BPromise(function(_0x343c95,_0x2a5894){return client[_0xb3c3('0x3')](_0x458944,_0xfff6fb)[_0xb3c3('0x4')](function(_0x38575c){logger[_0xb3c3('0x5')](_0xb3c3('0x6'),'memberReport',_0x458944,_0xfff6fb,_0x38575c);if(_0x38575c[_0xb3c3('0x7')]){logger[_0xb3c3('0x7')](_0xb3c3('0x6'),_0xb3c3('0x8'),_0x458944,_0x38575c[_0xb3c3('0x7')][_0xb3c3('0x9')],_0xfff6fb);return _0x2a5894(_0x38575c[_0xb3c3('0x7')][_0xb3c3('0x9')]);}else{return _0x343c95(_0x38575c[_0xb3c3('0xa')]);}})[_0xb3c3('0xb')](function(_0x3751a1){logger[_0xb3c3('0x7')](_0xb3c3('0x6'),_0xb3c3('0x8'),_0x458944,_0x3751a1,_0xfff6fb);return _0x2a5894(_0x3751a1);});});};module[_0xb3c3('0xc')]=client; \ No newline at end of file +var _0xdc43=['then','debug','rpc','memberReport','error','message','result','catch','exports','jayson/promise','bluebird','client','http','Request','request'];(function(_0x489b87,_0xd51c93){var _0x1823b6=function(_0x451c70){while(--_0x451c70){_0x489b87['push'](_0x489b87['shift']());}};_0x1823b6(++_0xd51c93);}(_0xdc43,0xdb));var _0x3dc4=function(_0x5e0c9b,_0x2803ee){_0x5e0c9b=_0x5e0c9b-0x0;var _0x3fb49e=_0xdc43[_0x5e0c9b];return _0x3fb49e;};'use strict';var jayson=require(_0x3dc4('0x0'));var BPromise=require(_0x3dc4('0x1'));var logger=require('../../config/logger')('ami');var client=jayson[_0x3dc4('0x2')][_0x3dc4('0x3')]({'port':0x2329});client[_0x3dc4('0x4')]=function(_0x30574e,_0x578cb2){return new BPromise(function(_0x3842ae,_0x4df048){return client[_0x3dc4('0x5')](_0x30574e,_0x578cb2)[_0x3dc4('0x6')](function(_0x517cb6){logger[_0x3dc4('0x7')](_0x3dc4('0x8'),_0x3dc4('0x9'),_0x30574e,_0x578cb2,_0x517cb6);if(_0x517cb6['error']){logger[_0x3dc4('0xa')]('rpc',_0x3dc4('0x9'),_0x30574e,_0x517cb6[_0x3dc4('0xa')][_0x3dc4('0xb')],_0x578cb2);return _0x4df048(_0x517cb6[_0x3dc4('0xa')][_0x3dc4('0xb')]);}else{return _0x3842ae(_0x517cb6[_0x3dc4('0xc')]);}})[_0x3dc4('0xd')](function(_0x4a1887){logger[_0x3dc4('0xa')](_0x3dc4('0x8'),_0x3dc4('0x9'),_0x30574e,_0x4a1887,_0x578cb2);return _0x4df048(_0x4a1887);});});};module[_0x3dc4('0xe')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index a3e2bc3..c6dfa67 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 _0x90db=['string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','prototype','getQueue','exports','lodash','moment','isNil'];(function(_0x20ab51,_0x246894){var _0x51a966=function(_0x40d2fd){while(--_0x40d2fd){_0x20ab51['push'](_0x20ab51['shift']());}};_0x51a966(++_0x246894);}(_0x90db,0x1c0));var _0xb90d=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0x90db[_0x75f869];return _0x10af8b;};'use strict';var util=require('util');var _=require(_0xb90d('0x0'));var moment=require(_0xb90d('0x1'));function checkNameSurname(_0x102d9e,_0x5050f4,_0x4fc4c2){var _0x4faf3d='';if(!_['isNil'](_0x5050f4)&&'string'===typeof _0x5050f4){_0x4faf3d+=_0x5050f4;}if(!_[_0xb90d('0x2')](_0x4fc4c2)&&_0xb90d('0x3')===typeof _0x4fc4c2){_0x4faf3d+='\x20'+_0x4fc4c2;}if(_0x4faf3d!==''){return _0x4faf3d;}return _0x102d9e;}function Action(_0x95ea24,_0x380149,_0x1e7a52){this[_0xb90d('0x4')]=_0x95ea24;this[_0xb90d('0x5')]=_0x1e7a52||undefined;this[_0xb90d('0x6')]=checkNameSurname(_0x380149[_0xb90d('0x7')][_0xb90d('0x8')],_0x380149[_0xb90d('0x7')][_0xb90d('0x9')],_0x380149['Contact'][_0xb90d('0xa')]);this[_0xb90d('0xb')]=_0x380149[_0xb90d('0x7')]['phone'];this[_0xb90d('0xc')]=_0x95ea24[_0xb90d('0x6')];this[_0xb90d('0xd')]=_0x380149[_0xb90d('0xd')]||![];this[_0xb90d('0xe')]=_0x95ea24['type'];this[_0xb90d('0xf')]=_0x95ea24['dialQueueTimeout']||0x3;this[_0xb90d('0x10')]=_0x380149[_0xb90d('0x10')];this[_0xb90d('0x11')]=_0x380149[_0xb90d('0x11')];this[_0xb90d('0x12')]=_0x380149[_0xb90d('0x12')];this[_0xb90d('0x13')]=_0x380149['countnoanswerretry'];this[_0xb90d('0x14')]=_0x380149['ContactId'];this[_0xb90d('0x15')]=_0x380149[_0xb90d('0x15')];this['UserId']=_0x380149[_0xb90d('0x16')];this['VoiceQueueId']=_0x380149[_0xb90d('0x17')];this[_0xb90d('0x18')]=_0x380149[_0xb90d('0x18')];this[_0xb90d('0x19')]=_0x380149['id'];this[_0xb90d('0x1a')]=_0x380149['Contact'][_0xb90d('0x9')]||'';this['starttime']=moment()[_0xb90d('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this['callback']=_0x380149[_0xb90d('0x1c')];this[_0xb90d('0x1d')]=_0x380149[_0xb90d('0x1d')];this[_0xb90d('0x1e')]=_0x380149[_0xb90d('0x1e')];this[_0xb90d('0x1f')]=_0x380149['recallme'];this[_0xb90d('0x20')]='';this[_0xb90d('0x21')]='';}Action['prototype'][_0xb90d('0x22')]=function(){return util[_0xb90d('0x1b')](_0xb90d('0x23'),this[_0xb90d('0x6')],this[_0xb90d('0x4')][_0xb90d('0x24')]>0x0?this[_0xb90d('0xb')][_0xb90d('0x25')](this[_0xb90d('0x4')][_0xb90d('0x24')]):this[_0xb90d('0xb')]);};Action[_0xb90d('0x26')][_0xb90d('0x27')]=function(){return this['queue'];};module[_0xb90d('0x28')]=Action; \ No newline at end of file +var _0xef3d=['format','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','number','substring','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','ContactId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime'];(function(_0x23c2b1,_0x4c139d){var _0x2e61a9=function(_0x13eeda){while(--_0x13eeda){_0x23c2b1['push'](_0x23c2b1['shift']());}};_0x2e61a9(++_0x4c139d);}(_0xef3d,0x85));var _0xdef3=function(_0x15fda8,_0x2c77d2){_0x15fda8=_0x15fda8-0x0;var _0x81b3f4=_0xef3d[_0x15fda8];return _0x81b3f4;};'use strict';var util=require(_0xdef3('0x0'));var _=require(_0xdef3('0x1'));var moment=require(_0xdef3('0x2'));function checkNameSurname(_0x5b0a41,_0x58456a,_0x5af3a8){var _0x305796='';if(!_[_0xdef3('0x3')](_0x58456a)&&_0xdef3('0x4')===typeof _0x58456a){_0x305796+=_0x58456a;}if(!_[_0xdef3('0x3')](_0x5af3a8)&&'string'===typeof _0x5af3a8){_0x305796+='\x20'+_0x5af3a8;}if(_0x305796!==''){return _0x305796;}return _0x5b0a41;}function Action(_0x943c73,_0x26e688,_0x40458e){this[_0xdef3('0x5')]=_0x943c73;this[_0xdef3('0x6')]=_0x40458e||undefined;this[_0xdef3('0x7')]=checkNameSurname(_0x26e688[_0xdef3('0x8')][_0xdef3('0x9')],_0x26e688['Contact'][_0xdef3('0xa')],_0x26e688[_0xdef3('0x8')][_0xdef3('0xb')]);this['number']=_0x26e688[_0xdef3('0x8')][_0xdef3('0x9')];this[_0xdef3('0xc')]=_0x943c73[_0xdef3('0x7')];this[_0xdef3('0xd')]=_0x26e688[_0xdef3('0xd')]||![];this[_0xdef3('0xe')]=_0x943c73[_0xdef3('0xe')];this[_0xdef3('0xf')]=_0x943c73[_0xdef3('0xf')]||0x3;this[_0xdef3('0x10')]=_0x26e688[_0xdef3('0x10')];this[_0xdef3('0x11')]=_0x26e688['countbusyretry'];this[_0xdef3('0x12')]=_0x26e688[_0xdef3('0x12')];this[_0xdef3('0x13')]=_0x26e688[_0xdef3('0x13')];this['ContactId']=_0x26e688[_0xdef3('0x14')];this['ListId']=_0x26e688['ListId'];this[_0xdef3('0x15')]=_0x26e688[_0xdef3('0x15')];this[_0xdef3('0x16')]=_0x26e688[_0xdef3('0x16')];this[_0xdef3('0x17')]=_0x26e688[_0xdef3('0x17')];this[_0xdef3('0x18')]=_0x26e688['id'];this[_0xdef3('0x19')]=_0x26e688[_0xdef3('0x8')]['firstName']||'';this[_0xdef3('0x1a')]=moment()[_0xdef3('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xdef3('0x1c')]=_0x26e688[_0xdef3('0x1c')];this['callbackuniqueid']=_0x26e688[_0xdef3('0x1d')];this[_0xdef3('0x1e')]=_0x26e688[_0xdef3('0x1e')];this[_0xdef3('0x1f')]=_0x26e688['recallme'];this['originatecalleridnum']='';this[_0xdef3('0x20')]='';}Action[_0xdef3('0x21')][_0xdef3('0x22')]=function(){return util[_0xdef3('0x1b')](_0xdef3('0x23'),this[_0xdef3('0x7')],this[_0xdef3('0x5')][_0xdef3('0x24')]>0x0?this[_0xdef3('0x25')][_0xdef3('0x26')](this[_0xdef3('0x5')][_0xdef3('0x24')]):this['number']);};Action['prototype']['getQueue']=function(){return this['queue'];};module[_0xdef3('0x27')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index c0fd583..2f9ff88 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 _0xcdd8=['uniqueid','calleridname','name','number','starttime','answertime','endtime','ringtime','responsetime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x4f9240,_0x42a118){var _0x4b9678=function(_0x57f093){while(--_0x57f093){_0x4f9240['push'](_0x4f9240['shift']());}};_0x4b9678(++_0x42a118);}(_0xcdd8,0x1c5));var _0x8cdd=function(_0x194a4e,_0x573cac){_0x194a4e=_0x194a4e-0x0;var _0x593cbd=_0xcdd8[_0x194a4e];return _0x593cbd;};'use strict';var util=require(_0x8cdd('0x0'));var _=require(_0x8cdd('0x1'));var moment=require(_0x8cdd('0x2'));function getSeconds(_0x10d5d4,_0x25c27f){var _0x1c9c20=moment(_0x10d5d4)[_0x8cdd('0x3')](0x0);var _0x43c295=moment(_0x25c27f)[_0x8cdd('0x3')](0x0);return _0x1c9c20[_0x8cdd('0x4')](_0x43c295,'seconds');}function AgentComplete(_0x53492f,_0x506948){this[_0x8cdd('0x5')]=0x4;this['statedesc']=_0x8cdd('0x6');this[_0x8cdd('0x7')]=_0x53492f[_0x8cdd('0x7')];this[_0x8cdd('0x8')]=_0x53492f['type'];this[_0x8cdd('0x9')]=_0x53492f[_0x8cdd('0x8')]===_0x8cdd('0xa')?_0x8cdd('0xb'):_0x53492f[_0x8cdd('0x8')];this[_0x8cdd('0xc')]=_0x53492f['countbusyretry'];this[_0x8cdd('0xd')]=_0x53492f[_0x8cdd('0xd')];this[_0x8cdd('0xe')]=_0x53492f[_0x8cdd('0xe')];this['countglobal']=_0x53492f['countbusyretry']+_0x53492f[_0x8cdd('0xd')]+_0x53492f[_0x8cdd('0xe')];this[_0x8cdd('0xf')]=_0x506948[_0x8cdd('0xf')];this[_0x8cdd('0x10')]=_0x53492f[_0x8cdd('0x11')];this['calleridnum']=_0x53492f[_0x8cdd('0x12')];this['starttime']=_0x53492f[_0x8cdd('0x13')];this['responsetime']=_0x53492f['responsetime'];this[_0x8cdd('0x14')]=_0x53492f[_0x8cdd('0x14')];this[_0x8cdd('0x15')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x8cdd('0x16')]=getSeconds(_0x53492f[_0x8cdd('0x17')],_0x53492f['starttime']);this['holdtime']=getSeconds(_0x53492f[_0x8cdd('0x14')],_0x53492f[_0x8cdd('0x17')]);this[_0x8cdd('0x18')]=getSeconds(this[_0x8cdd('0x15')],_0x53492f[_0x8cdd('0x14')]);this['queue']=_0x506948[_0x8cdd('0xb')];this[_0x8cdd('0x19')]=_0x506948[_0x8cdd('0x19')];this[_0x8cdd('0x1a')]=_0x506948[_0x8cdd('0x1a')];this[_0x8cdd('0x1b')]=_0x53492f[_0x8cdd('0x1b')];this['callbackuniqueid']=_0x53492f[_0x8cdd('0x1c')];this[_0x8cdd('0x1d')]=_0x53492f[_0x8cdd('0x1d')];this[_0x8cdd('0x1e')]=_0x53492f[_0x8cdd('0x1e')];this[_0x8cdd('0x1f')]=_0x53492f[_0x8cdd('0x1f')];this[_0x8cdd('0x20')]=_0x53492f['ListId'];this[_0x8cdd('0x21')]=_0x53492f[_0x8cdd('0x21')];this[_0x8cdd('0x22')]=_0x53492f[_0x8cdd('0x22')];this[_0x8cdd('0x23')]=_0x53492f[_0x8cdd('0x23')];this[_0x8cdd('0x24')]=_0x53492f[_0x8cdd('0x24')]||'';this['originatecalleridname']=_0x53492f[_0x8cdd('0x25')]||'';}module[_0x8cdd('0x26')]=AgentComplete; \ No newline at end of file +var _0xc66a=['countbusyretry','countnoanswerretry','countglobal','countcongestionretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','seconds','state','statedesc','scheduledat','type','campaigntype','outbound'];(function(_0x4aea0c,_0x24de55){var _0x2f6782=function(_0x3832e9){while(--_0x3832e9){_0x4aea0c['push'](_0x4aea0c['shift']());}};_0x2f6782(++_0x24de55);}(_0xc66a,0x1b9));var _0xac66=function(_0x469b66,_0x5a971f){_0x469b66=_0x469b66-0x0;var _0x51d22d=_0xc66a[_0x469b66];return _0x51d22d;};'use strict';var util=require(_0xac66('0x0'));var _=require('lodash');var moment=require(_0xac66('0x1'));function getSeconds(_0x35f89c,_0x3df805){var _0x2899a3=moment(_0x35f89c)['milliseconds'](0x0);var _0x16849a=moment(_0x3df805)[_0xac66('0x2')](0x0);return _0x2899a3['diff'](_0x16849a,_0xac66('0x3'));}function AgentComplete(_0x1002d0,_0x50895){this[_0xac66('0x4')]=0x4;this[_0xac66('0x5')]='Answer';this[_0xac66('0x6')]=_0x1002d0['scheduledat'];this[_0xac66('0x7')]=_0x1002d0[_0xac66('0x7')];this[_0xac66('0x8')]=_0x1002d0[_0xac66('0x7')]===_0xac66('0x9')?'queue':_0x1002d0[_0xac66('0x7')];this[_0xac66('0xa')]=_0x1002d0['countbusyretry'];this['countcongestionretry']=_0x1002d0['countcongestionretry'];this[_0xac66('0xb')]=_0x1002d0['countnoanswerretry'];this[_0xac66('0xc')]=_0x1002d0[_0xac66('0xa')]+_0x1002d0[_0xac66('0xd')]+_0x1002d0[_0xac66('0xb')];this[_0xac66('0xe')]=_0x50895[_0xac66('0xe')];this[_0xac66('0xf')]=_0x1002d0['name'];this[_0xac66('0x10')]=_0x1002d0[_0xac66('0x11')];this[_0xac66('0x12')]=_0x1002d0[_0xac66('0x12')];this[_0xac66('0x13')]=_0x1002d0[_0xac66('0x13')];this[_0xac66('0x14')]=_0x1002d0['answertime'];this[_0xac66('0x15')]=moment()[_0xac66('0x16')](_0xac66('0x17'));this[_0xac66('0x18')]=getSeconds(_0x1002d0[_0xac66('0x13')],_0x1002d0[_0xac66('0x12')]);this[_0xac66('0x19')]=getSeconds(_0x1002d0[_0xac66('0x14')],_0x1002d0['responsetime']);this[_0xac66('0x1a')]=getSeconds(this[_0xac66('0x15')],_0x1002d0[_0xac66('0x14')]);this[_0xac66('0x1b')]=_0x50895[_0xac66('0x1b')];this[_0xac66('0x1c')]=_0x50895[_0xac66('0x1c')];this[_0xac66('0x1d')]=_0x50895[_0xac66('0x1d')];this[_0xac66('0x1e')]=_0x1002d0[_0xac66('0x1e')];this[_0xac66('0x1f')]=_0x1002d0[_0xac66('0x1f')];this[_0xac66('0x20')]=_0x1002d0[_0xac66('0x20')];this[_0xac66('0x21')]=_0x1002d0['recallme'];this[_0xac66('0x22')]=_0x1002d0[_0xac66('0x22')];this[_0xac66('0x23')]=_0x1002d0[_0xac66('0x23')];this[_0xac66('0x24')]=_0x1002d0[_0xac66('0x24')];this[_0xac66('0x25')]=_0x1002d0[_0xac66('0x25')];this[_0xac66('0x26')]=_0x1002d0['CampaignId'];this[_0xac66('0x27')]=_0x1002d0[_0xac66('0x27')]||'';this['originatecalleridname']=_0x1002d0[_0xac66('0x28')]||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 165672a..9f955d0 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 _0xe928=['uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0xe928,0x145));var _0x8e92=function(_0xe2f48d,_0x220acc){_0xe2f48d=_0xe2f48d-0x0;var _0x5a7ed5=_0xe928[_0xe2f48d];return _0x5a7ed5;};'use strict';var util=require(_0x8e92('0x0'));var _=require(_0x8e92('0x1'));var moment=require(_0x8e92('0x2'));function getSeconds(_0x540afe,_0x226ab9){var _0x577acb=moment(_0x540afe)[_0x8e92('0x3')](0x0);var _0x44fc50=moment(_0x226ab9)[_0x8e92('0x3')](0x0);return _0x577acb[_0x8e92('0x4')](_0x44fc50,'seconds');}function Final(_0x1af27f){this['uniqueid']=_0x1af27f[_0x8e92('0x5')];this[_0x8e92('0x6')]=_0x1af27f[_0x8e92('0x6')];this[_0x8e92('0x7')]=_0x1af27f['type'];this[_0x8e92('0x8')]=_0x1af27f['type']===_0x8e92('0x9')?_0x8e92('0xa'):_0x1af27f[_0x8e92('0x7')];this[_0x8e92('0xb')]=_0x1af27f[_0x8e92('0xb')];this[_0x8e92('0xc')]=_0x1af27f['countcongestionretry'];this[_0x8e92('0xd')]=_0x1af27f[_0x8e92('0xd')];this[_0x8e92('0xe')]=_0x1af27f['countbusyretry']+_0x1af27f[_0x8e92('0xc')]+_0x1af27f[_0x8e92('0xd')];this[_0x8e92('0xa')]=_0x1af27f[_0x8e92('0xa')];this[_0x8e92('0xf')]=_0x1af27f[_0x8e92('0xf')];this[_0x8e92('0x10')]=_0x1af27f['calleridnum'];this[_0x8e92('0x11')]=_0x1af27f['starttime'];this[_0x8e92('0x12')]=_0x1af27f[_0x8e92('0x12')];this['endtime']=_0x1af27f[_0x8e92('0x12')];this['ringtime']=_0x1af27f[_0x8e92('0x13')]||0x0;this[_0x8e92('0x14')]=_0x1af27f[_0x8e92('0x14')]||0x0;this[_0x8e92('0x15')]=_0x1af27f[_0x8e92('0x15')]||0x0;this[_0x8e92('0x16')]=_0x1af27f[_0x8e92('0x16')];this[_0x8e92('0x17')]=_0x1af27f['callbackuniqueid'];this[_0x8e92('0x18')]=_0x1af27f[_0x8e92('0x18')];this[_0x8e92('0x19')]=_0x1af27f[_0x8e92('0x19')];this[_0x8e92('0x1a')]=_0x1af27f['ContactId'];this[_0x8e92('0x1b')]=_0x1af27f[_0x8e92('0x1b')];this['UserId']=_0x1af27f['UserId'];this['VoiceQueueId']=_0x1af27f[_0x8e92('0x1c')];this['CampaignId']=_0x1af27f[_0x8e92('0x1d')];this[_0x8e92('0x1e')]=_0x1af27f[_0x8e92('0x1e')]||'';this[_0x8e92('0x1f')]=_0x1af27f[_0x8e92('0x1f')]||'';}module[_0x8e92('0x20')]=Final; \ No newline at end of file +var _0xb7de=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','queue','calleridname','calleridnum','starttime','responsetime','ringtime','talktime','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x3f7a0d,_0x29e65b){var _0x2f9129=function(_0x291172){while(--_0x291172){_0x3f7a0d['push'](_0x3f7a0d['shift']());}};_0x2f9129(++_0x29e65b);}(_0xb7de,0xc7));var _0xeb7d=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xb7de[_0x411add];return _0x238242;};'use strict';var util=require(_0xeb7d('0x0'));var _=require(_0xeb7d('0x1'));var moment=require(_0xeb7d('0x2'));function getSeconds(_0x55dc83,_0x170bd9){var _0x1e399b=moment(_0x55dc83)[_0xeb7d('0x3')](0x0);var _0x219063=moment(_0x170bd9)[_0xeb7d('0x3')](0x0);return _0x1e399b['diff'](_0x219063,_0xeb7d('0x4'));}function Final(_0x2cf936){this[_0xeb7d('0x5')]=_0x2cf936[_0xeb7d('0x5')];this[_0xeb7d('0x6')]=_0x2cf936['scheduledat'];this['type']=_0x2cf936[_0xeb7d('0x7')];this[_0xeb7d('0x8')]=_0x2cf936[_0xeb7d('0x7')]===_0xeb7d('0x9')?'queue':_0x2cf936[_0xeb7d('0x7')];this[_0xeb7d('0xa')]=_0x2cf936[_0xeb7d('0xa')];this['countcongestionretry']=_0x2cf936['countcongestionretry'];this[_0xeb7d('0xb')]=_0x2cf936['countnoanswerretry'];this[_0xeb7d('0xc')]=_0x2cf936[_0xeb7d('0xa')]+_0x2cf936[_0xeb7d('0xd')]+_0x2cf936[_0xeb7d('0xb')];this[_0xeb7d('0xe')]=_0x2cf936[_0xeb7d('0xe')];this['calleridname']=_0x2cf936[_0xeb7d('0xf')];this[_0xeb7d('0x10')]=_0x2cf936[_0xeb7d('0x10')];this[_0xeb7d('0x11')]=_0x2cf936[_0xeb7d('0x11')];this['responsetime']=_0x2cf936[_0xeb7d('0x12')];this['endtime']=_0x2cf936[_0xeb7d('0x12')];this[_0xeb7d('0x13')]=_0x2cf936[_0xeb7d('0x13')]||0x0;this['holdtime']=_0x2cf936['holdtime']||0x0;this[_0xeb7d('0x14')]=_0x2cf936[_0xeb7d('0x14')]||0x0;this['callback']=_0x2cf936['callback'];this[_0xeb7d('0x15')]=_0x2cf936[_0xeb7d('0x15')];this['callbackat']=_0x2cf936[_0xeb7d('0x16')];this[_0xeb7d('0x17')]=_0x2cf936[_0xeb7d('0x17')];this[_0xeb7d('0x18')]=_0x2cf936[_0xeb7d('0x18')];this[_0xeb7d('0x19')]=_0x2cf936[_0xeb7d('0x19')];this[_0xeb7d('0x1a')]=_0x2cf936[_0xeb7d('0x1a')];this['VoiceQueueId']=_0x2cf936[_0xeb7d('0x1b')];this['CampaignId']=_0x2cf936[_0xeb7d('0x1c')];this[_0xeb7d('0x1d')]=_0x2cf936[_0xeb7d('0x1d')]||'';this['originatecalleridname']=_0x2cf936[_0xeb7d('0x1e')]||'';}module[_0xeb7d('0x1f')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 1354cd0..ac9b7a2 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 _0x9957=['state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','uniqueid','calleridname','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','seconds'];(function(_0x53e78f,_0x507154){var _0x4d1e90=function(_0x1f8a7b){while(--_0x1f8a7b){_0x53e78f['push'](_0x53e78f['shift']());}};_0x4d1e90(++_0x507154);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var util=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));function getSeconds(_0x10a05d,_0x5b96eb){var _0x86c128=moment(_0x10a05d)[_0x7995('0x3')](0x0);var _0x1902b4=moment(_0x5b96eb)[_0x7995('0x3')](0x0);return _0x86c128['diff'](_0x1902b4,_0x7995('0x4'));}function Hangup(_0x1a36d8,_0x137b6b){this[_0x7995('0x5')]=0x4;this[_0x7995('0x6')]=_0x7995('0x7');this['scheduledat']=_0x1a36d8[_0x7995('0x8')];this[_0x7995('0x9')]=_0x1a36d8['type'];this[_0x7995('0xa')]=_0x1a36d8[_0x7995('0x9')]===_0x7995('0xb')?_0x7995('0xc'):_0x1a36d8[_0x7995('0x9')];this[_0x7995('0xd')]=_0x1a36d8[_0x7995('0xd')];this['countcongestionretry']=_0x1a36d8[_0x7995('0xe')];this[_0x7995('0xf')]=_0x1a36d8['countnoanswerretry'];this[_0x7995('0x10')]=_0x1a36d8[_0x7995('0xd')]+_0x1a36d8[_0x7995('0xe')]+_0x1a36d8[_0x7995('0xf')];this[_0x7995('0x11')]=_0x137b6b[_0x7995('0x11')];this[_0x7995('0x12')]=_0x1a36d8['name'];this['calleridnum']=_0x1a36d8[_0x7995('0x13')];this[_0x7995('0x14')]=_0x1a36d8[_0x7995('0x14')];this[_0x7995('0x15')]=_0x1a36d8[_0x7995('0x15')];this[_0x7995('0x16')]=moment()[_0x7995('0x17')](_0x7995('0x18'));this['ringtime']=getSeconds(_0x1a36d8[_0x7995('0x15')],_0x1a36d8['starttime']);this[_0x7995('0x19')]=0x0;this[_0x7995('0x1a')]=getSeconds(this[_0x7995('0x16')],_0x1a36d8[_0x7995('0x15')]);this[_0x7995('0xc')]=_0x1a36d8[_0x7995('0xc')];this['membername']='IVR';this[_0x7995('0x1b')]=_0x137b6b['cause-txt'];this['callback']=_0x1a36d8[_0x7995('0x1c')];this[_0x7995('0x1d')]=_0x1a36d8['callbackuniqueid'];this[_0x7995('0x1e')]=_0x1a36d8['callbackat'];this['recallme']=_0x1a36d8[_0x7995('0x1f')];this[_0x7995('0x20')]=_0x1a36d8[_0x7995('0x20')];this[_0x7995('0x21')]=_0x1a36d8[_0x7995('0x21')];this[_0x7995('0x22')]=_0x1a36d8['UserId'];this[_0x7995('0x23')]=_0x1a36d8[_0x7995('0x23')];this[_0x7995('0x24')]=_0x1a36d8[_0x7995('0x24')];}module[_0x7995('0x25')]=Hangup; \ No newline at end of file +var _0xa9e0=['countglobal','countcongestionretry','countnoanswerretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','type','outbound','queue','countbusyretry'];(function(_0x120bc0,_0x40e780){var _0x49d52a=function(_0x41c990){while(--_0x41c990){_0x120bc0['push'](_0x120bc0['shift']());}};_0x49d52a(++_0x40e780);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function getSeconds(_0x5dd881,_0x550fbc){var _0x18d5c9=moment(_0x5dd881)['milliseconds'](0x0);var _0x333808=moment(_0x550fbc)[_0x0a9e('0x3')](0x0);return _0x18d5c9[_0x0a9e('0x4')](_0x333808,_0x0a9e('0x5'));}function Hangup(_0x981158,_0x57b080){this[_0x0a9e('0x6')]=0x4;this[_0x0a9e('0x7')]=_0x0a9e('0x8');this['scheduledat']=_0x981158['scheduledat'];this[_0x0a9e('0x9')]=_0x981158['type'];this['campaigntype']=_0x981158[_0x0a9e('0x9')]===_0x0a9e('0xa')?_0x0a9e('0xb'):_0x981158[_0x0a9e('0x9')];this[_0x0a9e('0xc')]=_0x981158[_0x0a9e('0xc')];this['countcongestionretry']=_0x981158['countcongestionretry'];this['countnoanswerretry']=_0x981158['countnoanswerretry'];this[_0x0a9e('0xd')]=_0x981158[_0x0a9e('0xc')]+_0x981158[_0x0a9e('0xe')]+_0x981158[_0x0a9e('0xf')];this[_0x0a9e('0x10')]=_0x57b080[_0x0a9e('0x10')];this['calleridname']=_0x981158[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x981158[_0x0a9e('0x13')];this[_0x0a9e('0x14')]=_0x981158[_0x0a9e('0x14')];this[_0x0a9e('0x15')]=_0x981158['responsetime'];this[_0x0a9e('0x16')]=moment()['format'](_0x0a9e('0x17'));this['ringtime']=getSeconds(_0x981158[_0x0a9e('0x15')],_0x981158[_0x0a9e('0x14')]);this['holdtime']=0x0;this[_0x0a9e('0x18')]=getSeconds(this['endtime'],_0x981158[_0x0a9e('0x15')]);this[_0x0a9e('0xb')]=_0x981158[_0x0a9e('0xb')];this[_0x0a9e('0x19')]=_0x0a9e('0x1a');this[_0x0a9e('0x1b')]=_0x57b080[_0x0a9e('0x1c')];this[_0x0a9e('0x1d')]=_0x981158[_0x0a9e('0x1d')];this[_0x0a9e('0x1e')]=_0x981158[_0x0a9e('0x1e')];this[_0x0a9e('0x1f')]=_0x981158['callbackat'];this[_0x0a9e('0x20')]=_0x981158[_0x0a9e('0x20')];this['ContactId']=_0x981158[_0x0a9e('0x21')];this['ListId']=_0x981158['ListId'];this[_0x0a9e('0x22')]=_0x981158[_0x0a9e('0x22')];this[_0x0a9e('0x23')]=_0x981158[_0x0a9e('0x23')];this['CampaignId']=_0x981158[_0x0a9e('0x24')];}module[_0x0a9e('0x25')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 60ce289..a584f1b 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 _0x64a8=['util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports'];(function(_0xe3bbea,_0x3ae4d3){var _0x18713d=function(_0x453117){while(--_0x453117){_0xe3bbea['push'](_0xe3bbea['shift']());}};_0x18713d(++_0x3ae4d3);}(_0x64a8,0x8c));var _0x864a=function(_0x25af3f,_0x2bf1fc){_0x25af3f=_0x25af3f-0x0;var _0x58a821=_0x64a8[_0x25af3f];return _0x58a821;};'use strict';var util=require(_0x864a('0x0'));var _=require(_0x864a('0x1'));var moment=require(_0x864a('0x2'));function getSeconds(_0x413c0e,_0x28d346){var _0x34efdf=moment(_0x413c0e)[_0x864a('0x3')](0x0);var _0x2d3595=moment(_0x28d346)[_0x864a('0x3')](0x0);return _0x34efdf[_0x864a('0x4')](_0x2d3595,_0x864a('0x5'));}function History(_0x523470){this[_0x864a('0x6')]=_0x523470['uniqueid'];this['scheduledat']=_0x523470[_0x864a('0x7')]||undefined;this[_0x864a('0x8')]=_0x523470[_0x864a('0x8')];this[_0x864a('0x9')]=_0x523470[_0x864a('0x8')]===_0x864a('0xa')?_0x864a('0xb'):_0x523470[_0x864a('0x8')];this[_0x864a('0xc')]=_0x523470[_0x864a('0xc')];this[_0x864a('0xd')]=_0x523470[_0x864a('0xd')];this[_0x864a('0xe')]=_0x523470['countnoanswerretry'];this['countglobal']=_0x523470[_0x864a('0xc')]+_0x523470[_0x864a('0xd')]+_0x523470[_0x864a('0xe')];this[_0x864a('0xb')]=_0x523470[_0x864a('0xb')];this['calleridname']=_0x523470[_0x864a('0xf')];this[_0x864a('0x10')]=_0x523470[_0x864a('0x11')];this[_0x864a('0x12')]=_0x523470[_0x864a('0x12')];this[_0x864a('0x13')]=_0x523470[_0x864a('0x13')];this[_0x864a('0x14')]=_0x523470[_0x864a('0x13')];this[_0x864a('0x15')]=getSeconds(_0x523470[_0x864a('0x13')],_0x523470[_0x864a('0x12')]);this[_0x864a('0x16')]=0x0;this['talktime']=0x0;this[_0x864a('0x17')]=_0x523470[_0x864a('0x17')];this[_0x864a('0x18')]=_0x523470[_0x864a('0x18')];this[_0x864a('0x19')]=_0x523470[_0x864a('0x19')];this[_0x864a('0x1a')]=_0x523470['recallme'];this[_0x864a('0x1b')]=_0x523470[_0x864a('0x1b')];this[_0x864a('0x1c')]=_0x523470[_0x864a('0x1c')];this[_0x864a('0x1d')]=_0x523470['UserId'];this[_0x864a('0x1e')]=_0x523470[_0x864a('0x1e')];this['CampaignId']=_0x523470[_0x864a('0x1f')];this[_0x864a('0x20')]=_0x523470[_0x864a('0x20')]||'';this['originatecalleridname']=_0x523470[_0x864a('0x21')]||'';}module[_0x864a('0x22')]=History; \ No newline at end of file +var _0xf772=['countnoanswerretry','countglobal','calleridname','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf772,0x1bb));var _0x2f77=function(_0x5d7020,_0x48a0be){_0x5d7020=_0x5d7020-0x0;var _0x445e31=_0xf772[_0x5d7020];return _0x445e31;};'use strict';var util=require(_0x2f77('0x0'));var _=require(_0x2f77('0x1'));var moment=require('moment');function getSeconds(_0x4fdacd,_0x180af9){var _0x1e7c54=moment(_0x4fdacd)[_0x2f77('0x2')](0x0);var _0x2bed3d=moment(_0x180af9)[_0x2f77('0x2')](0x0);return _0x1e7c54['diff'](_0x2bed3d,_0x2f77('0x3'));}function History(_0x607222){this[_0x2f77('0x4')]=_0x607222[_0x2f77('0x4')];this[_0x2f77('0x5')]=_0x607222[_0x2f77('0x5')]||undefined;this[_0x2f77('0x6')]=_0x607222[_0x2f77('0x6')];this[_0x2f77('0x7')]=_0x607222[_0x2f77('0x6')]===_0x2f77('0x8')?_0x2f77('0x9'):_0x607222['type'];this[_0x2f77('0xa')]=_0x607222['countbusyretry'];this[_0x2f77('0xb')]=_0x607222['countcongestionretry'];this['countnoanswerretry']=_0x607222[_0x2f77('0xc')];this[_0x2f77('0xd')]=_0x607222[_0x2f77('0xa')]+_0x607222[_0x2f77('0xb')]+_0x607222[_0x2f77('0xc')];this[_0x2f77('0x9')]=_0x607222[_0x2f77('0x9')];this[_0x2f77('0xe')]=_0x607222['name'];this[_0x2f77('0xf')]=_0x607222[_0x2f77('0x10')];this[_0x2f77('0x11')]=_0x607222[_0x2f77('0x11')];this[_0x2f77('0x12')]=_0x607222[_0x2f77('0x12')];this[_0x2f77('0x13')]=_0x607222['responsetime'];this[_0x2f77('0x14')]=getSeconds(_0x607222[_0x2f77('0x12')],_0x607222['starttime']);this[_0x2f77('0x15')]=0x0;this[_0x2f77('0x16')]=0x0;this[_0x2f77('0x17')]=_0x607222[_0x2f77('0x17')];this['callbackuniqueid']=_0x607222[_0x2f77('0x18')];this[_0x2f77('0x19')]=_0x607222[_0x2f77('0x19')];this[_0x2f77('0x1a')]=_0x607222[_0x2f77('0x1a')];this['ContactId']=_0x607222[_0x2f77('0x1b')];this['ListId']=_0x607222[_0x2f77('0x1c')];this[_0x2f77('0x1d')]=_0x607222[_0x2f77('0x1d')];this[_0x2f77('0x1e')]=_0x607222['VoiceQueueId'];this[_0x2f77('0x1f')]=_0x607222[_0x2f77('0x1f')];this[_0x2f77('0x20')]=_0x607222[_0x2f77('0x20')]||'';this[_0x2f77('0x21')]=_0x607222[_0x2f77('0x21')]||'';}module[_0x2f77('0x22')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 40656c1..72828d7 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 _0x2032=['[Catch][Preview][syncQueueStatusComplete]','ContactId','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','iftime\x20%s,%s','content','indexOf','true','command','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','checkDialMethod','handlePower','power','dialPowerLevel','Queue','launchHandleIvr','handleIvr','dialActive','checkIfTime','dialGlobalInterval','dialTimezone','[syncQueueSummary]','syncCampaigns','[syncCampaigns]','\x5cw{0,','pow','replace','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','OriginateError','[originate][error]','originate\x20action\x20Error','responsetime','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countbusyretry','countcongestionretry','countnoanswerretry','dialGlobalMaxRetry','minutes','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','add','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','object','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','[syncAgentComplete][createHistory][0]','reason\x200\x20no\x20such\x20number....','NoAnswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','createStateFinal','stateGlobal','Busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','countglobal','reason\x208\x20congestion','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalLowerLimit','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive][First]','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive][Date]','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','erlangCalls','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','agent\x20max\x20free\x20','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','[startMethodPredictive][StartPredictive][First]','getDataPredictive','startMethodPredictive','[averageHandleTime][ErlangB]\x20','[startMethodPredictive][StartPredictive][Repeat]','dialPredictiveOptimization','outboundQueuePauses','predictiveIntervalDroppedCallsCallersExit','[CatchErlangB]','busyFactor','[getDataPredictive]','check\x20failure','erlangCallToSecond','[startMethodPredictive]','[handlePredictive]','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','temp','dialOrderByScheduledAt','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','RUNNING','[getContactDialer2]','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[abandonmentRate]','\x20m\x20=\x20','\x20Ts\x20=\x20','\x20p\x20=\x20','\x20Amax\x20=\x20','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','[busyFactor]','\x20interval\x20=\x20','\x20Umin\x20=\x20','interval\x20=\x20','exports','lodash','bluebird','uuid','md5','ioredis','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./history','./final','127.0.0.1','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','queueBooked','agentconnect','syncAgentConnect','queuecallerabandon','originateresponse','syncOriginateResponse','bind','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','Intervals','\x20INTERVAL_IS_NULL','isEmpty','Error','stringify','milliseconds','seconds','emit','type','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','talking','total','unmanaged','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','originated','Trunk','active','callerid','voice_queue:save','ivr','format','predictiveIntervalTotalCalls','info','[checkGetDataPredictive][avgTalktime]','[checkGetDataPredictive][avgHoldtime]','[checkGetDataPredictive][totalCalls]','[checkGetDataPredictive][objIsEmpty]','[checkGetDataPredictive][obj]','[ErlangB]','merge','startProgressive','[freeVariablesPredictive]','handlePredictive','outbound','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','waiting','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','hasOwnProperty','isNil','Action','status','channel','catch','updateOriginated','queue','[Dialer][checkChannel][ivr]','then','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','resolve','[rescheduleContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','loggerHandler','emptyContact','notFound','saveInDb','pick','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','uniqueid','variable','exten','dialAMDActive','value','HANGUP','state','HangupInAMD','membername','AMD','[syncHangupInAMD][createHistory]','MACHINE','Machine','[syncMachine][createHistory]','[syncMachine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','amd','[syncMachineIvr][createHistory]','[syncMachineIvr]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','YYYY-MM-DD\x20HH:mm:ss','queueCallerAbandonCreateState','syncQueueCallerAbandon','droptime','dialQueueTimeout','Drop','dropreason','TIMEOUT','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','actionid','locked','paused','stateinterface','rrmemory','push','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','roundrobin','run','idHopper'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x2032,0xd9));var _0x2203=function(_0x5c3301,_0xa8a1f3){_0x5c3301=_0x5c3301-0x0;var _0x5b0bcc=_0x2032[_0x5c3301];return _0x5b0bcc;};'use strict';var util=require('util');var _=require(_0x2203('0x0'));var BPromise=require(_0x2203('0x1'));var uuid=require(_0x2203('0x2'));var moment=require('moment');var rr=require('rr');var md5=require(_0x2203('0x3'));var Redis=require(_0x2203('0x4'));var config=require('../../../config/environment/');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var loggerBooked=require(_0x2203('0x5'))(_0x2203('0x7'));var loggerPredictive=require(_0x2203('0x5'))(_0x2203('0x8'));var loggerPredictiveCalls=require(_0x2203('0x5'))(_0x2203('0x9'));var loggerSyncQueueSummary=require(_0x2203('0x5'))(_0x2203('0xa'));var ami=require(_0x2203('0xb'));config['redis']=_['defaults'](config[_0x2203('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x2203('0xd'))(new Redis(config[_0x2203('0xc')]));var cmHopper=require(_0x2203('0xe'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x2203('0xf'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x2203('0x10'));var Action=require('./action');var History=require(_0x2203('0x11'));var Final=require(_0x2203('0x12'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require('./hangup');var ipAgi=process['env']['XCALLY_IP_AGI']||_0x2203('0x13');var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0x2203('0x14')][_0x2203('0x15')]=function(_0x1c1ead){this[_0x2203('0x16')]=this[_0x2203('0x16')]?this[_0x2203('0x16')][_0x2203('0x17')](_0x1c1ead):_0x1c1ead();};function Dialer(_0x2c085c,_0xdf9d0b){this[_0x2203('0x18')]=new Sequence();this['preview']=_0xdf9d0b;this[_0x2203('0x19')]=_0x2c085c[_0x2203('0x19')];this['campaigns']=_0x2c085c[_0x2203('0x1a')];this[_0x2203('0x1b')]=_0x2c085c['agents'];this[_0x2203('0x1c')]=_0x2c085c['trunks'];this[_0x2203('0x1d')]=config[_0x2203('0x1d')]||0x2;this[_0x2203('0x1e')]={};this[_0x2203('0x1f')]={};this[_0x2203('0x20')]={};this[_0x2203('0x21')]={};this['optionPredictive']={};this[_0x2203('0x22')]={};this['startProgressive']={};this['ivrOriginated']={};this[_0x2203('0x23')]={};this['queueBookedRR']={};ami['on'](_0x2203('0x24'),this[_0x2203('0x25')]['bind'](this));ami['on'](_0x2203('0x26'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0x2203('0x27'),this[_0x2203('0x28')][_0x2203('0x29')](this));ami['on'](_0x2203('0x2a'),this[_0x2203('0x2b')][_0x2203('0x29')](this));ami['on'](_0x2203('0x2c'),this[_0x2203('0xa')]['bind'](this));ami['on'](_0x2203('0x2d'),this[_0x2203('0x2e')][_0x2203('0x29')](this));ami['on']('newexten',this[_0x2203('0x2f')][_0x2203('0x29')](this));ami['on']('varset',this[_0x2203('0x30')][_0x2203('0x29')](this));ami['on'](_0x2203('0x31'),this[_0x2203('0x32')][_0x2203('0x29')](this));ami['on'](_0x2203('0x33'),this[_0x2203('0x34')]['bind'](this));this[_0x2203('0x35')]();this[_0x2203('0x36')]();}function isNotNull(_0x406ce9){return _0x406ce9!==null&&!_[_0x2203('0x37')](_0x406ce9);}function checkIsLoggedIn(_0x52a426,_0x3a8e23){return function(){if(_0x3a8e23<=0x0){_0x52a426[_0x2203('0x38')]=_0x2203('0x39');throw _0x52a426[_0x2203('0x3a')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0xea1637){return _0xea1637;}function checkIsActive(_0x50aa17,_0x5e6560){return function(){if(!isActive(_0x5e6560)){_0x50aa17['message']=_0x2203('0x3b');throw _0x50aa17['name']+'\x20NOT\x20Active';}};}function checkInterval(_0x125dfc){return function(){if(!isNotNull(_0x125dfc[_0x2203('0x3c')])){_0x125dfc[_0x2203('0x38')]=_0x2203('0x3d');throw _0x125dfc[_0x2203('0x3a')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x125dfc[_0x2203('0x3c')][_0x2203('0x3e')])){_0x125dfc['message']=_0x2203('0x3d');throw _0x125dfc[_0x2203('0x3a')]+_0x2203('0x3f');}if(!isNotNull(_[_0x2203('0x40')](_0x125dfc[_0x2203('0x3c')][_0x2203('0x3e')]))){_0x125dfc[_0x2203('0x38')]=_0x2203('0x3d');throw _0x125dfc[_0x2203('0x3a')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x15c0ad,_0x347d3e,_0x56f9b2){return{'action':_0x15c0ad,'response':_0x347d3e,'message':_0x56f9b2};}function myreject(_0x54b90b){return function(_0x2c58b1){return _0x54b90b(msgResponse('[ifTime][Action]',_0x2203('0x41'),JSON[_0x2203('0x42')](_0x2c58b1)));};}function getSeconds(_0x127ee3,_0x5221f0){var _0x5a2b90=moment(_0x127ee3)[_0x2203('0x43')](0x0);var _0x47c93a=moment(_0x5221f0)[_0x2203('0x43')](0x0);return _0x5a2b90['diff'](_0x47c93a,_0x2203('0x44'));}function emit(_0x4b6fc5,_0x86097c,_0x13ed9e){io['to'](_0x4b6fc5)[_0x2203('0x45')](_0x86097c,_0x13ed9e);}function emitVoiceQueueSummary(_0x40a793){if(_0x40a793[_0x2203('0x46')]==='outbound'){var _0x5f1561={'id':_0x40a793['id'],'name':_0x40a793['name'],'strategy':_0x40a793[_0x2203('0x47')],'answered':_0x40a793[_0x2203('0x48')],'available':_0x40a793[_0x2203('0x49')],'loggedIn':_0x40a793[_0x2203('0x4a')],'pTalking':_0x40a793[_0x2203('0x4b')],'sumBillable':_0x40a793[_0x2203('0x4c')],'sumDuration':_0x40a793[_0x2203('0x4d')],'sumHoldTime':_0x40a793['sumHoldTime']||0x0,'talking':_0x40a793[_0x2203('0x4e')],'total':_0x40a793[_0x2203('0x4f')],'type':_0x40a793[_0x2203('0x46')],'unmanaged':_0x40a793[_0x2203('0x50')],'abandoned':_0x40a793['abandoned'],'waiting':_0x40a793['waiting'],'loggedInDb':_0x40a793[_0x2203('0x51')],'dialActive':_0x40a793['dialActive'],'dialMethod':_0x40a793[_0x2203('0x52')],'dialOriginateCallerIdName':_0x40a793[_0x2203('0x53')],'dialOriginateCallerIdNumber':_0x40a793[_0x2203('0x54')],'dialOriginateTimeout':_0x40a793['dialOriginateTimeout'],'dialPrefix':_0x40a793['dialPrefix'],'outboundAnswerAgiCallsDay':_0x40a793[_0x2203('0x55')],'outboundAnswerCallsDay':_0x40a793[_0x2203('0x56')],'outboundBlacklistCallsDay':_0x40a793[_0x2203('0x57')],'outboundBusyCallsDay':_0x40a793[_0x2203('0x58')],'outboundCongestionCallsDay':_0x40a793[_0x2203('0x59')],'outboundDropCallsDayACS':_0x40a793[_0x2203('0x5a')],'outboundDropCallsDayCallersExit':_0x40a793['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x40a793[_0x2203('0x5b')],'outboundNoAnswerCallsDay':_0x40a793[_0x2203('0x5c')],'outboundNoSuchCallsDay':_0x40a793[_0x2203('0x5d')],'outboundOriginateFailureCallsDay':_0x40a793[_0x2203('0x5e')],'outboundReCallsDay':_0x40a793[_0x2203('0x5f')],'outboundRejectCallsDay':_0x40a793[_0x2203('0x60')],'outboundUnknownCallsDay':_0x40a793[_0x2203('0x61')],'predictiveIntervalAnsweredCalls':_0x40a793[_0x2203('0x62')],'predictiveIntervalAvgHoldtime':_0x40a793[_0x2203('0x63')],'predictiveIntervalAvgTalktime':_0x40a793[_0x2203('0x64')],'predictiveIntervalDroppedCallsCallersExit':_0x40a793['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x40a793[_0x2203('0x65')],'predictiveIntervalErlangCalls':_0x40a793[_0x2203('0x66')],'predictiveIntervalErlangCallsDroppedCalls':_0x40a793[_0x2203('0x67')],'predictiveIntervalHitRate':_0x40a793[_0x2203('0x68')],'predictiveIntervalLowerLimit':_0x40a793['predictiveIntervalLowerLimit'],'predictiveIntervalMultiplicativeFactor':_0x40a793['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x40a793[_0x2203('0x69')],'predictiveIntervalTotalCalls':_0x40a793['predictiveIntervalTotalCalls'],'message':_0x40a793[_0x2203('0x38')],'originated':_0x40a793[_0x2203('0x6a')]};if(_0x40a793[_0x2203('0x6b')]){_0x5f1561[_0x2203('0x6b')]={'id':_0x40a793['Trunk']['id'],'name':_0x40a793[_0x2203('0x6b')][_0x2203('0x3a')],'active':_0x40a793['Trunk'][_0x2203('0x6c')],'callerid':_0x40a793[_0x2203('0x6b')][_0x2203('0x6d')]};}if(_0x40a793[_0x2203('0x3c')]){_0x5f1561['Interval']={'id':_0x40a793['Interval']['id'],'name':_0x40a793[_0x2203('0x3c')]['name']};}var _0x543fde=md5(JSON[_0x2203('0x42')](_0x5f1561));if(_0x40a793[_0x2203('0x3')]!==_0x543fde){_0x40a793[_0x2203('0x3')]=_0x543fde;emit(util['format']('voice:queue:%s',_0x5f1561[_0x2203('0x3a')]),_0x2203('0x6e'),_0x5f1561);}}}function emitCampaignSummary(_0x12d7fa){if(_0x12d7fa[_0x2203('0x46')]===_0x2203('0x6f')){emit(util[_0x2203('0x70')]('campaign:ivr:%s',_0x12d7fa[_0x2203('0x3a')]),'campaign:save',_0x12d7fa);}}function checkGetDataPredictive(_0x3f7685){if(isNotNull(_0x3f7685)){if(!_[_0x2203('0x40')](_0x3f7685)){if(_0x3f7685[_0x2203('0x71')]>0x0){if(!_[_0x2203('0x37')](_0x3f7685['predictiveIntervalAvgTalktime'])&&_0x3f7685['predictiveIntervalAvgTalktime']>0x0){return!![];}else{loggerPredictive[_0x2203('0x72')](_0x2203('0x73'),JSON[_0x2203('0x42')](_0x3f7685));}if(!_[_0x2203('0x37')](_0x3f7685['predictiveIntervalAvgHoldtime'])&&_0x3f7685['predictiveIntervalAvgHoldtime']>0x0){return!![];}else{loggerPredictive['info'](_0x2203('0x74'),JSON[_0x2203('0x42')](_0x3f7685));}}else{loggerPredictive['info'](_0x2203('0x75'),JSON[_0x2203('0x42')](_0x3f7685));}}else{loggerPredictive['info'](_0x2203('0x76'),JSON[_0x2203('0x42')](_0x3f7685));}}else{loggerPredictive[_0x2203('0x72')](_0x2203('0x77'),JSON['stringify'](_0x3f7685));}return![];}function mergeDataErlangB(_0x120db1){return function(_0x5268d6){loggerPredictive[_0x2203('0x72')](_0x2203('0x78'),JSON['stringify'](_0x5268d6));_[_0x2203('0x79')](_0x120db1,_0x5268d6);};}function getDiff(_0x8d089e){var _0x11c581=moment()[_0x2203('0x43')](0x0);var _0x3f335a=moment(_0x8d089e)[_0x2203('0x43')](0x0);return _0x11c581['diff'](_0x3f335a,'seconds');}function ifInterval(_0x2f2537,_0x524356){if(_['isUndefined'](_0x524356)){return![];}if(getDiff(_0x524356)<_0x2f2537*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0xfddc3b){if(isNotNull(_0xfddc3b)){if(!_[_0x2203('0x37')](_0xfddc3b[_0x2203('0x7a')])){_0xfddc3b['startProgressive']=undefined;loggerPredictive[_0x2203('0x72')]('[freeVariablesPredictive]','startProgressive',_0xfddc3b[_0x2203('0x3a')]);}if(!_['isUndefined'](_0xfddc3b['startPredictive'])){_0xfddc3b['startPredictive']=undefined;loggerPredictive[_0x2203('0x72')](_0x2203('0x7b'),_0x2203('0x22'),_0xfddc3b[_0x2203('0x3a')]);}if(!_[_0x2203('0x37')](_0xfddc3b[_0x2203('0x7c')])){clearInterval(_0xfddc3b[_0x2203('0x7c')]);_0xfddc3b[_0x2203('0x7c')]=undefined;loggerPredictive[_0x2203('0x72')](_0x2203('0x7b'),_0x2203('0x7c'),_0xfddc3b[_0x2203('0x3a')]);}}}function erlangb(_0x58ff57,_0x585bde){if(_0x585bde===0x0){return 0x0;}var _0x2cd752=0x1;for(var _0x43d8c0=0x1;_0x43d8c0<=_0x585bde;_0x43d8c0+=0x1){_0x2cd752=0x1+_0x2cd752*_0x43d8c0/_0x58ff57;}return 0x1/_0x2cd752;}function isVoiceQueueOutbound(_0x2511bd){return _0x2511bd===_0x2203('0x7d');}function isNotPreview(_0x26382f){return _0x26382f!==_0x2203('0x7e');}function isCampaignIvr(_0x4f8b8e){return _0x4f8b8e==='ivr';}function getCallerId(_0xb49120,_0x34358e,_0x21ee59){if(!_[_0x2203('0x37')](_0x21ee59)&&_0x2203('0x7f')===typeof _0x21ee59&&!_[_0x2203('0x40')](_0x21ee59)){if(!_[_0x2203('0x37')](_0x34358e)&&_0x2203('0x7f')===typeof _0x34358e&&!_[_0x2203('0x40')](_0x34358e)){return util[_0x2203('0x70')](_0x2203('0x80'),_0x34358e,_0x21ee59);}return util['format'](_0x2203('0x80'),_0x21ee59,_0x21ee59);}if(!_[_0x2203('0x37')](_0xb49120)&&_0x2203('0x7f')===typeof _0xb49120&&!_[_0x2203('0x40')](_0xb49120)){return _0xb49120;}return _0x2203('0x81');}function loggerCatchQueueSummary(_0x44e7ab,_0x52c159){return function(_0x544756){freeVariablesPredictive(_0x52c159);emitVoiceQueueSummary(_0x52c159);emitCampaignSummary(_0x52c159);loggerSyncQueueSummary[_0x2203('0x82')](_0x44e7ab,util[_0x2203('0x83')](_0x544756,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x49e795,_0x6ea7e8){return function(_0x3795e6){loggerPredictive[_0x2203('0x82')](_0x49e795,JSON[_0x2203('0x42')](_0x3795e6));freeVariablesPredictive(_0x6ea7e8);};}function loggerCatch(_0x34e820){return function(_0x1e44c){logger[_0x2203('0x82')](_0x34e820,util[_0x2203('0x83')](_0x1e44c,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2015b1){return _0x2015b1&&!_['isUndefined'](_0x2015b1)&&_0x2015b1[_0x2203('0x84')]>0x0;}function decremetOriginate(_0x3d0285){if(!_[_0x2203('0x37')](_0x3d0285)&&_0x3d0285!==null){if(_0x3d0285['hasOwnProperty'](_0x2203('0x6a'))){if(_0x3d0285[_0x2203('0x6a')]>0x0){_0x3d0285[_0x2203('0x6a')]-=0x1;}else{logger[_0x2203('0x82')](_0x2203('0x85'));}}}else{logger['error'](_0x2203('0x86'));}}function checkContactLowerLimitOriginate(_0x11243d,_0x1c63bf,_0x4dde80){if(_0x1c63bf>_0x4dde80){for(var _0x5507b6=0x0;_0x5507b6<_0x1c63bf-_0x4dde80;_0x5507b6+=0x1){decremetOriginate(_0x11243d);}}}function loggerGetContactDialer(_0x5d9ae2,_0x485e5b,_0x595814){return function(_0x418d48){checkContactLowerLimitOriginate(_0x485e5b,_0x595814,0x0);logger[_0x2203('0x82')](_0x5d9ae2,util[_0x2203('0x83')](_0x418d48,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x145c59){return function(_0x4287f4){if(isNotNull(_0x4287f4)&&isNotNull(_0x4287f4[0x0])){if(_0x4287f4[0x0][_0x2203('0x87')]>0x0){_0x145c59[_0x2203('0x38')]=_0x2203('0x88');logger['info']('[getContactDialer2][ReScheduled]'+_0x145c59[_0x2203('0x3a')],_0x4287f4[0x0][_0x2203('0x87')],_0x2203('0x89'));}else{_0x145c59[_0x2203('0x38')]=_0x2203('0x8a');logger[_0x2203('0x72')](_0x2203('0x8b')+_0x145c59[_0x2203('0x3a')]);}}};}function notSendMessagesQueue(_0x450f1d){if(_0x450f1d[_0x2203('0x8c')]){freeVariablesPredictive(_0x450f1d);if(_0x450f1d[_0x2203('0x6a')]===0x0&&_0x450f1d[_0x2203('0x4e')]===0x0&&_0x450f1d[_0x2203('0x8d')]===0x0&&(_0x450f1d[_0x2203('0x4b')]||0x0)===0x0){_0x450f1d[_0x2203('0x8c')]=![];_0x450f1d[_0x2203('0x49')]=0x0;_0x450f1d[_0x2203('0x38')]=_0x2203('0x3b');loggerSyncQueueSummary[_0x2203('0x82')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x450f1d[_0x2203('0x3a')],'is\x20not\x20active');}else{_0x450f1d[_0x2203('0x38')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x2203('0x82')](_0x2203('0x8e'),_0x450f1d[_0x2203('0x3a')],_0x2203('0x8f'));}emitVoiceQueueSummary(_0x450f1d);}}function notSendMessagesCampaign(_0x29c37d){if(_0x29c37d[_0x2203('0x8c')]){if(_0x29c37d[_0x2203('0x6a')]===0x0){_0x29c37d[_0x2203('0x8c')]=![];_0x29c37d['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0x2203('0x82')](_0x2203('0x90'),_0x29c37d[_0x2203('0x3a')],'is\x20not\x20active');}else{_0x29c37d['message']='IS_DISACTIVED';loggerSyncQueueSummary[_0x2203('0x82')](_0x2203('0x90'),_0x29c37d[_0x2203('0x3a')],_0x2203('0x8f'));}emitCampaignSummary(_0x29c37d);}}function createObjHistory(_0x5b01ec,_0x2f7850,_0x47a2c7,_0x48bd5,_0x26016e){_0x5b01ec[_0x2203('0x38')]=_0x47a2c7;var _0x36106b=new Action(_0x5b01ec,_0x2f7850);var _0xf8584f=new History(_0x36106b);_0xf8584f['state']=_0x48bd5;_0xf8584f[_0x2203('0x91')]=_0x26016e;_0xf8584f[_0x2203('0x92')]=_0x36106b[_0x2203('0x93')];return _0xf8584f;}Dialer['prototype'][_0x2203('0x36')]=function(){var _0x45d235=this;setInterval(function(){_0x45d235[_0x2203('0x94')](_0x45d235[_0x2203('0x21')],_0x2203('0x95'));_0x45d235[_0x2203('0x94')](_0x45d235[_0x2203('0x1f')],_0x2203('0x96'));},0x32c8);};Dialer[_0x2203('0x14')][_0x2203('0x94')]=function(_0x112385,_0x5db33f){var _0x1adfa6=this;for(var _0x7f71b8 in _0x112385){if(_0x112385[_0x2203('0x97')](_0x7f71b8)){this[_0x2203('0x18')][_0x2203('0x15')](function(){if(!_[_0x2203('0x98')](_0x112385[_0x7f71b8])){return ami[_0x2203('0x99')]({'action':_0x2203('0x9a'),'channel':_0x112385[_0x7f71b8][_0x2203('0x9b')]})[_0x2203('0x9c')](function(_0x1210c5){if(_0x1210c5[_0x2203('0x38')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x112385[_0x7f71b8]&&_0x112385[_0x7f71b8]['type']!==_0x2203('0x6f')){_0x1adfa6[_0x2203('0x9d')](_0x1adfa6[_0x2203('0x19')][_0x112385[_0x7f71b8][_0x2203('0x9e')]]);logger[_0x2203('0x82')]('[Dialer][checkChannel]',_0x5db33f,_0x7f71b8,_0x112385[_0x7f71b8][_0x2203('0x9e')]);delete _0x112385[_0x7f71b8];}if(_0x112385[_0x7f71b8]&&_0x112385[_0x7f71b8][_0x2203('0x46')]==='ivr'){_0x1adfa6['updateOriginated'](_0x1adfa6['campaigns'][_0x112385[_0x7f71b8]['queue']]);logger['error'](_0x2203('0x9f'),_0x5db33f,_0x7f71b8,_0x112385[_0x7f71b8][_0x2203('0x9e')]);delete _0x112385[_0x7f71b8];}},0x2328);}});}});}}};Dialer[_0x2203('0x14')]['countReScheduled']=function(_0x48a5d6){return BPromise['resolve']()[_0x2203('0xa0')](cmHopper[_0x2203('0xa1')](_0x48a5d6))[_0x2203('0x9c')](loggerCatch(_0x2203('0xa2')));};Dialer[_0x2203('0x14')][_0x2203('0xa3')]=function(_0x3d1797){return BPromise['resolve']()[_0x2203('0xa0')](cmHopperBlack[_0x2203('0xa3')](_0x3d1797))[_0x2203('0x9c')](loggerCatch(_0x2203('0xa4')));};Dialer[_0x2203('0x14')][_0x2203('0xa5')]=function(_0x13e11f){return BPromise['resolve']()[_0x2203('0xa0')](cmHopperBlack['checkIsBlackListIvr'](_0x13e11f))['catch'](loggerCatch(_0x2203('0xa6')));};Dialer['prototype'][_0x2203('0xa7')]=function(_0x39e7b9){return BPromise['resolve']()[_0x2203('0xa0')](cmHopperHistory[_0x2203('0xa8')](_0x39e7b9))[_0x2203('0x9c')](loggerCatch(_0x2203('0xa9')));};Dialer[_0x2203('0x14')][_0x2203('0xaa')]=function(_0x4cca59){return BPromise[_0x2203('0xab')]()[_0x2203('0xa0')](cmHopper['rescheduleContact'](_0x4cca59))['catch'](loggerCatch(_0x2203('0xac')));};Dialer[_0x2203('0x14')][_0x2203('0xad')]=function(_0xa88b4f,_0x416b38,_0x29d9de,_0x430ea4){return BPromise[_0x2203('0xab')]()[_0x2203('0xa0')](cmHopper[_0x2203('0xad')](_0xa88b4f,_0x416b38,_0x29d9de,_0x430ea4))[_0x2203('0x9c')](loggerCatch(_0x2203('0xae')));};Dialer[_0x2203('0x14')][_0x2203('0xaf')]=function(_0x7589a7,_0x2e92f0,_0x5f34f8){return BPromise['resolve']()[_0x2203('0xa0')](cmHopper[_0x2203('0xaf')](_0x7589a7,_0x2e92f0,_0x5f34f8))['catch'](loggerCatch(_0x2203('0xae')));};Dialer[_0x2203('0x14')]['getVoiceQueueRtPauses']=function(_0x54014d){return BPromise[_0x2203('0xab')]()['then'](voiceQueueRt[_0x2203('0xb0')](_0x54014d))[_0x2203('0x9c')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x2203('0x14')][_0x2203('0xb1')]=function(_0x3cfe3f){return BPromise[_0x2203('0xab')]()['then'](cmHopper['moveContactManagedDialer'](_0x3cfe3f))[_0x2203('0x9c')](loggerCatch(_0x2203('0xb2')));};Dialer[_0x2203('0x14')]['createHistory']=function(_0x5ef759){return BPromise[_0x2203('0xab')]()[_0x2203('0xa0')](cmHopperHistory[_0x2203('0xb3')](_0x5ef759))['catch'](loggerCatch('[createHistory]\x20'));};Dialer[_0x2203('0x14')][_0x2203('0x9d')]=function(_0x54fe33){if(!_[_0x2203('0x37')](_0x54fe33)&&_0x54fe33!==null){if(_0x54fe33[_0x2203('0x97')]('originated')){if(_0x54fe33[_0x2203('0x6a')]>0x0){_0x54fe33['originated']-=0x1;}else{logger[_0x2203('0x82')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x2203('0x14')][_0x2203('0xb4')]=function(_0x50c276,_0x2afbfc){var _0x2d92b1=this;return function(_0x47215d){_0x2d92b1['updateOriginated'](_0x2afbfc);logger[_0x2203('0x82')](_0x50c276,util['inspect'](_0x47215d,{'showHidden':![],'depth':null}));};};Dialer[_0x2203('0x14')][_0x2203('0xb5')]=function(_0x486563,_0x4358c1,_0x4096f4){var _0x5bd4e4={'state':0x19,'statedesc':_0x2203('0xb6')};this[_0x2203('0x9d')](_0x4358c1);this[_0x2203('0xb7')](_[_0x2203('0x79')](_0x5bd4e4,_[_0x2203('0xb8')](_0x4096f4,['ContactId',_0x2203('0xb9'),_0x2203('0xba'),_0x2203('0xbb'),_0x2203('0xbc')])),_0x2203('0xbd'),_0x2203('0xbe'));logger['error'](_0x486563);};Dialer[_0x2203('0x14')][_0x2203('0xbf')]=function(_0x49ebb9){return _0x49ebb9===_0x2203('0xc0');};Dialer['prototype'][_0x2203('0xc1')]=function(_0x41eaa5){return!_[_0x2203('0x37')](_0x41eaa5)&&_0x41eaa5&&!_['isUndefined'](_0x41eaa5[_0x2203('0x3a')])&&!_[_0x2203('0x37')](_0x41eaa5[_0x2203('0x6c')])&&_0x41eaa5[_0x2203('0x6c')]&&(this[_0x2203('0x1c')][util[_0x2203('0x70')](_0x2203('0xc2'),_0x41eaa5['name'])]['status']===_0x2203('0xc3')||this[_0x2203('0x1c')][util[_0x2203('0x70')](_0x2203('0xc2'),_0x41eaa5[_0x2203('0x3a')])][_0x2203('0x9a')]===_0x2203('0xc4'));};Dialer['prototype'][_0x2203('0xb7')]=function(_0x7b699b,_0x5d331b,_0x1f18cd){this['createHistory'](_0x7b699b)[_0x2203('0x9c')](loggerCatch(_0x5d331b));this[_0x2203('0xb1')](_0x7b699b)['catch'](loggerCatch(_0x1f18cd));};Dialer[_0x2203('0x14')][_0x2203('0x30')]=function(_0x266d7e){var _0x9d0f9b=this[_0x2203('0x21')][_0x266d7e[_0x2203('0xc5')]];var _0x14a14d;if(!_[_0x2203('0x98')](_0x266d7e)&&!_[_0x2203('0x98')](_0x266d7e[_0x2203('0xc6')])&&!_[_0x2203('0x98')](_0x266d7e[_0x2203('0xc6')]['amdstatus'])&&_0x266d7e[_0x2203('0xc7')]==='xcally-motion-dialer'&&_0x9d0f9b){if(_0x9d0f9b[_0x2203('0x46')]!==_0x2203('0x6f')&&this[_0x2203('0x19')][_0x9d0f9b[_0x2203('0x9e')]][_0x2203('0xc8')]&&_0x266d7e[_0x2203('0xc9')]===_0x2203('0xca')){delete this[_0x2203('0x21')][_0x266d7e[_0x2203('0xc5')]];this[_0x2203('0x9d')](this[_0x2203('0x19')][_0x9d0f9b['queue']]);this[_0x2203('0x19')][_0x9d0f9b['queue']][_0x2203('0x56')]+=0x1;this[_0x2203('0x19')][_0x9d0f9b[_0x2203('0x9e')]]['outboundAnswerAgiCallsDay']+=0x1;_0x14a14d=new Hangup(_0x9d0f9b,_0x266d7e);_0x14a14d[_0x2203('0xcb')]=0x12;_0x14a14d[_0x2203('0x91')]=_0x2203('0xcc');_0x14a14d[_0x2203('0xcd')]=_0x2203('0xce');this['saveInDb'](_0x14a14d,_0x2203('0xcf'),'[syncHangupInAMD]');}if(_0x9d0f9b[_0x2203('0x46')]!==_0x2203('0x6f')&&this['voiceQueues'][_0x9d0f9b[_0x2203('0x9e')]][_0x2203('0xc8')]&&_0x266d7e[_0x2203('0xc9')]===_0x2203('0xd0')){delete this['uniqueId'][_0x266d7e[_0x2203('0xc5')]];this['updateOriginated'](this['voiceQueues'][_0x9d0f9b[_0x2203('0x9e')]]);this[_0x2203('0x19')][_0x9d0f9b[_0x2203('0x9e')]][_0x2203('0x56')]+=0x1;this[_0x2203('0x19')][_0x9d0f9b[_0x2203('0x9e')]][_0x2203('0x55')]+=0x1;_0x14a14d=new Hangup(_0x9d0f9b,_0x266d7e);_0x14a14d['state']=0x13;_0x14a14d[_0x2203('0x91')]=_0x2203('0xd1');_0x14a14d[_0x2203('0xcd')]='AMD';_0x14a14d['amd']=!![];this['saveInDb'](_0x14a14d,_0x2203('0xd2'),_0x2203('0xd3'));}if(_0x9d0f9b[_0x2203('0x46')]===_0x2203('0x6f')&&this['campaigns'][_0x9d0f9b[_0x2203('0x9e')]][_0x2203('0xc8')]&&_0x266d7e[_0x2203('0xc9')]===_0x2203('0xca')){delete this['uniqueId'][_0x266d7e['uniqueid']];this[_0x2203('0x9d')](this[_0x2203('0x1a')][_0x9d0f9b[_0x2203('0x9e')]]);_0x14a14d=new Hangup(_0x9d0f9b,_0x266d7e);_0x14a14d['state']=0x12;_0x14a14d[_0x2203('0x91')]=_0x2203('0xcc');_0x14a14d[_0x2203('0xcd')]=_0x2203('0xce');this[_0x2203('0xb7')](_0x14a14d,_0x2203('0xd4'),_0x2203('0xd5'));}if(_0x9d0f9b['type']===_0x2203('0x6f')&&this[_0x2203('0x1a')][_0x9d0f9b[_0x2203('0x9e')]][_0x2203('0xc8')]&&_0x266d7e[_0x2203('0xc9')]===_0x2203('0xd0')){delete this[_0x2203('0x21')][_0x266d7e[_0x2203('0xc5')]];this[_0x2203('0x9d')](this['campaigns'][_0x9d0f9b[_0x2203('0x9e')]]);_0x14a14d=new Hangup(_0x9d0f9b,_0x266d7e);_0x14a14d[_0x2203('0xcb')]=0x13;_0x14a14d[_0x2203('0x91')]=_0x2203('0xd1');_0x14a14d['membername']=_0x2203('0xce');_0x14a14d[_0x2203('0xd6')]=!![];this[_0x2203('0xb7')](_0x14a14d,_0x2203('0xd7'),_0x2203('0xd8'));}}};Dialer[_0x2203('0x14')][_0x2203('0x2e')]=function(_0x1a1528){var _0x241a04=this['uniqueId'][_0x1a1528['uniqueid']];var _0x225ea1=this;var _0x4670e4;if(_0x241a04&&_0x241a04[_0x2203('0x46')]===_0x2203('0x6f')){delete this['uniqueId'][_0x1a1528[_0x2203('0xc5')]];this[_0x2203('0x9d')](this['campaigns'][_0x241a04[_0x2203('0x9e')]]);this[_0x2203('0x1a')][_0x241a04[_0x2203('0x9e')]][_0x2203('0xd9')]+=0x1;_0x4670e4=new Hangup(_0x241a04,_0x1a1528);this['createHistory'](_0x4670e4)[_0x2203('0x9c')](loggerCatch(_0x2203('0xda')));this[_0x2203('0xb1')](_0x4670e4)['catch'](loggerCatch(_0x2203('0xdb')));}if(_0x241a04&&_0x241a04[_0x2203('0x46')]!==_0x2203('0x6f')&&isNotNull(this['voiceQueues'][_0x241a04['queue']][_0x2203('0xdc')])){delete this[_0x2203('0x21')][_0x1a1528[_0x2203('0xc5')]];this[_0x2203('0x9d')](this['voiceQueues'][_0x241a04[_0x2203('0x9e')]]);this[_0x2203('0x19')][_0x241a04[_0x2203('0x9e')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x241a04[_0x2203('0x9e')]][_0x2203('0x55')]+=0x1;_0x4670e4=new Hangup(_0x241a04,_0x1a1528);_0x4670e4[_0x2203('0xcb')]=0x10;_0x4670e4[_0x2203('0x91')]=_0x2203('0xdd');_0x4670e4[_0x2203('0xcd')]=_0x2203('0xde');this[_0x2203('0xb3')](_0x4670e4)[_0x2203('0x9c')](loggerCatch(_0x2203('0xda')));this[_0x2203('0xb1')](_0x4670e4)['catch'](loggerCatch(_0x2203('0xdb')));}if(_0x241a04&&_0x241a04['type']!==_0x2203('0x6f')&&!isNotNull(this[_0x2203('0x19')][_0x241a04[_0x2203('0x9e')]][_0x2203('0xdc')])){delete this[_0x2203('0x21')][_0x1a1528['uniqueid']];this[_0x2203('0x9d')](this[_0x2203('0x19')][_0x241a04[_0x2203('0x9e')]]);this['voiceQueues'][_0x241a04[_0x2203('0x9e')]][_0x2203('0x61')]+=0x1;_0x4670e4=new Hangup(_0x241a04,_0x1a1528);_0x4670e4[_0x2203('0xcb')]=0xc;_0x4670e4[_0x2203('0x91')]=_0x1a1528['cause-txt'];_0x4670e4[_0x2203('0xcd')]=_0x2203('0xdf');this[_0x2203('0xb3')](_0x4670e4)[_0x2203('0x9c')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x2203('0xb1')](_0x4670e4)[_0x2203('0x9c')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x2203('0x14')][_0x2203('0x2b')]=function(_0x5e296f){var _0x5cb5be=this['uniqueId'][_0x5e296f['uniqueid']];var _0x1ef216=this;if(this['voiceQueues'][_0x5e296f[_0x2203('0x9e')]]){if(_0x5cb5be&&_0x5cb5be['type']!=='ivr'){delete this[_0x2203('0x21')][_0x5e296f['uniqueid']];this[_0x2203('0x19')][_0x5e296f['queue']][_0x2203('0x56')]+=0x1;var _0x3dcda4=new AgentComplete(_0x5cb5be,_0x5e296f);if(_0x5e296f[_0x2203('0xe0')]===_0x2203('0xe1')){_0x3dcda4[_0x2203('0xe2')]=this[_0x2203('0x19')][_0x5e296f[_0x2203('0x9e')]][_0x2203('0xe3')]&&this[_0x2203('0x19')][_0x5e296f[_0x2203('0x9e')]][_0x2203('0xe4')]?moment()[_0x2203('0x70')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x2203('0xb3')](_0x3dcda4)[_0x2203('0x9c')](loggerCatch(_0x2203('0xe5')));this[_0x2203('0xb1')](_0x3dcda4)[_0x2203('0x9c')](loggerCatch(_0x2203('0xe6')));}}};Dialer['prototype'][_0x2203('0x25')]=function(_0x367bb3){if(this[_0x2203('0x19')][_0x367bb3[_0x2203('0x9e')]]){if(this[_0x2203('0x21')][_0x367bb3[_0x2203('0xc5')]]&&this['uniqueId'][_0x367bb3[_0x2203('0xc5')]][_0x2203('0x46')]!==_0x2203('0x6f')){this['updateOriginated'](this[_0x2203('0x19')][_0x367bb3[_0x2203('0x9e')]]);this[_0x2203('0x21')][_0x367bb3[_0x2203('0xc5')]]['answertime']=moment()[_0x2203('0x70')](_0x2203('0xe7'));}}};Dialer[_0x2203('0x14')][_0x2203('0xe8')]=function(_0x3a8450){this[_0x2203('0xb3')](_0x3a8450)[_0x2203('0x9c')](loggerCatch(_0x2203('0xe5')));this['moveContactManagedDialer'](_0x3a8450)['catch'](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0x2203('0x14')][_0x2203('0xe9')]=function(_0x344dda){var _0xed2e6d=this['uniqueId'][_0x344dda['uniqueid']];var _0x1a2af4=this;if(this[_0x2203('0x19')][_0x344dda['queue']]){if(_0xed2e6d&&_0xed2e6d[_0x2203('0x46')]!==_0x2203('0x6f')){delete this[_0x2203('0x21')][_0x344dda['uniqueid']];this[_0x2203('0x9d')](this['voiceQueues'][_0x344dda[_0x2203('0x9e')]]);_0xed2e6d['droptime']=moment()[_0x2203('0x70')](_0x2203('0xe7'));var _0x7c1f2b=new QueueCallerAbandon(_0xed2e6d,_0x344dda);if(getSeconds(_0xed2e6d[_0x2203('0xea')],_0xed2e6d['responsetime'])>=_0xed2e6d[_0x2203('0xeb')]){this['voiceQueues'][_0x344dda[_0x2203('0x9e')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x2203('0x19')][_0x344dda[_0x2203('0x9e')]][_0x2203('0x5b')]+=0x1;this[_0x2203('0x19')][_0x344dda['queue']][_0x2203('0x67')]+=0x1;_0x7c1f2b[_0x2203('0xcb')]=0xa;_0x7c1f2b[_0x2203('0x91')]=_0x2203('0xec');_0x7c1f2b[_0x2203('0xed')]=_0x2203('0xee');_0x7c1f2b[_0x2203('0xe2')]=this[_0x2203('0x19')][_0x344dda[_0x2203('0x9e')]][_0x2203('0xe3')]?moment()[_0x2203('0x70')](_0x2203('0xe7')):undefined;this[_0x2203('0xe8')](_0x7c1f2b);}else{this[_0x2203('0x19')][_0x344dda[_0x2203('0x9e')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this['voiceQueues'][_0x344dda['queue']][_0x2203('0xef')]+=0x1;_0x7c1f2b[_0x2203('0xcb')]=0xb;_0x7c1f2b[_0x2203('0x91')]=_0x2203('0xf0');_0x7c1f2b[_0x2203('0xed')]=_0x2203('0xf1');this['queueCallerAbandonCreateState'](_0x7c1f2b);}}}};Dialer[_0x2203('0x14')][_0x2203('0x2f')]=function(_0x57785e){if(this['actions'][_0x57785e[_0x2203('0xc5')]]){this['actions'][_0x57785e[_0x2203('0xc5')]][_0x2203('0x9b')]=_0x57785e['channel'];}if(this[_0x2203('0x21')][_0x57785e[_0x2203('0xc5')]]){this['uniqueId'][_0x57785e[_0x2203('0xc5')]]['channel']=_0x57785e[_0x2203('0x9b')];}};Dialer[_0x2203('0x14')][_0x2203('0x32')]=function(_0x5359b7){if(strategy[this[_0x2203('0x19')][this[_0x2203('0x1f')][_0x5359b7[_0x2203('0xf2')]][_0x2203('0x9e')]][_0x2203('0x47')]]==='roundrobin'){if(this[_0x2203('0x1f')][_0x5359b7[_0x2203('0xf2')]]&&_[_0x2203('0x98')](this[_0x2203('0x1f')][_0x5359b7['actionid']][_0x2203('0xf3')])&&_0x5359b7[_0x2203('0x9a')]==='1'&&_0x5359b7[_0x2203('0xf4')]==='0'){if(this[_0x2203('0x1b')][_0x5359b7[_0x2203('0xf5')]]){if(!this['agents'][_0x5359b7[_0x2203('0xf5')]]['locked']){this[_0x2203('0x1b')][_0x5359b7[_0x2203('0xf5')]][_0x2203('0xf3')]=!![];this[_0x2203('0x1f')][_0x5359b7['actionid']][_0x2203('0xf3')]=!![];this[_0x2203('0x1f')][_0x5359b7[_0x2203('0xf2')]][_0x2203('0xf5')]=_0x5359b7[_0x2203('0xf5')];}}}}else if((strategy[this[_0x2203('0x19')][this[_0x2203('0x1f')][_0x5359b7[_0x2203('0xf2')]][_0x2203('0x9e')]][_0x2203('0x47')]]||_0x2203('0xf6'))===_0x2203('0xf6')){if(this[_0x2203('0x1f')][_0x5359b7[_0x2203('0xf2')]]){if(this[_0x2203('0x1b')][_0x5359b7[_0x2203('0xf5')]]){this['actions'][_0x5359b7['actionid']]['stateinterface']=_0x5359b7[_0x2203('0xf5')];if(_[_0x2203('0x98')](this[_0x2203('0x23')][this['actions'][_0x5359b7[_0x2203('0xf2')]][_0x2203('0x9e')]])){this[_0x2203('0x23')][this[_0x2203('0x1f')][_0x5359b7[_0x2203('0xf2')]]['queue']]=[];}this[_0x2203('0x23')][this[_0x2203('0x1f')][_0x5359b7[_0x2203('0xf2')]][_0x2203('0x9e')]][_0x2203('0xf7')](_['merge'](_[_0x2203('0xb8')](this[_0x2203('0x1f')][_0x5359b7['actionid']],['idHopper',_0x2203('0xf5')]),{'status':_0x5359b7[_0x2203('0x9a')],'paused':_0x5359b7[_0x2203('0xf4')]}));}}}};function unlockQueueStatus(_0x141dfc,_0x52a31b){setTimeout(function(){if(_[_0x2203('0x37')](_0x141dfc['queueStatusComplete'])){loggerBooked['error'](_0x2203('0xf8'),_0x52a31b);}_0x141dfc[_0x2203('0xf9')]=!![];loggerBooked[_0x2203('0x72')](_0x2203('0xfa'),_0x52a31b,JSON['stringify'](_[_0x2203('0xb8')](_0x141dfc,[_0x2203('0x3a'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x2203('0x14')]['syncQueueStatusComplete']=function(_0x65b03f){var _0x329bbe=this;var _0x510463=_0x329bbe['voiceQueues'][_0x329bbe[_0x2203('0x1f')][_0x65b03f[_0x2203('0xf2')]]['queue']];if(strategy[this[_0x2203('0x19')][this['actions'][_0x65b03f[_0x2203('0xf2')]]['queue']][_0x2203('0x47')]]===_0x2203('0xfb')){if(this[_0x2203('0x1f')][_0x65b03f['actionid']]&&this[_0x2203('0x1f')][_0x65b03f[_0x2203('0xf2')]][_0x2203('0xf5')]){this[_0x2203('0x7e')][_0x2203('0xfc')](this[_0x2203('0x1f')][_0x65b03f[_0x2203('0xf2')]][_0x2203('0xfd')],this[_0x2203('0x1f')][_0x65b03f[_0x2203('0xf2')]]['stateinterface'])[_0x2203('0x9c')](function(_0x5c4dd0){logger[_0x2203('0x82')](_0x2203('0xfe'),util[_0x2203('0x83')](_0x5c4dd0,{'showHidden':![],'depth':null}));})[_0x2203('0x17')](function(){_0x329bbe['updateOriginated'](_0x329bbe['voiceQueues'][_0x329bbe[_0x2203('0x1f')][_0x65b03f['actionid']][_0x2203('0x9e')]]);_0x329bbe['agents'][_0x329bbe[_0x2203('0x1f')][_0x65b03f['actionid']]['stateinterface']][_0x2203('0xf3')]=![];delete _0x329bbe[_0x2203('0x1f')][_0x65b03f['actionid']];unlockQueueStatus(_0x510463);});}else{this[_0x2203('0x9d')](this[_0x2203('0x19')][this[_0x2203('0x1f')][_0x65b03f[_0x2203('0xf2')]][_0x2203('0x9e')]]);this[_0x2203('0xaa')]({'active':![],'ContactId':this[_0x2203('0x1f')][_0x65b03f['actionid']][_0x2203('0xff')],'ListId':this[_0x2203('0x1f')][_0x65b03f[_0x2203('0xf2')]][_0x2203('0xb9')],'VoiceQueueId':this[_0x2203('0x1f')][_0x65b03f[_0x2203('0xf2')]][_0x2203('0xbb')]||undefined,'CampaignId':this[_0x2203('0x1f')][_0x65b03f[_0x2203('0xf2')]][_0x2203('0xbc')]||undefined})['catch'](loggerCatch(_0x2203('0x100')));delete this[_0x2203('0x1f')][_0x65b03f[_0x2203('0xf2')]];unlockQueueStatus(_0x510463);}}else if((strategy[this[_0x2203('0x19')][this[_0x2203('0x1f')][_0x65b03f[_0x2203('0xf2')]][_0x2203('0x9e')]][_0x2203('0x47')]]||_0x2203('0xf6'))===_0x2203('0xf6')){var _0x149b88;if(this[_0x2203('0x1f')][_0x65b03f[_0x2203('0xf2')]]&&!_['isEmpty'](this[_0x2203('0x23')][this[_0x2203('0x1f')][_0x65b03f['actionid']][_0x2203('0x9e')]])){if(this[_0x2203('0x101')][_0x329bbe[_0x2203('0x1f')][_0x65b03f[_0x2203('0xf2')]][_0x2203('0x9e')]]){this[_0x2203('0x101')][_0x329bbe[_0x2203('0x1f')][_0x65b03f[_0x2203('0xf2')]][_0x2203('0x9e')]]=this['queueBookedRR'][this[_0x2203('0x1f')][_0x65b03f[_0x2203('0xf2')]][_0x2203('0x9e')]]?this[_0x2203('0x101')][this[_0x2203('0x1f')][_0x65b03f[_0x2203('0xf2')]][_0x2203('0x9e')]]:this[_0x2203('0x23')][this['actions'][_0x65b03f[_0x2203('0xf2')]]['queue']]?this[_0x2203('0x23')][this['actions'][_0x65b03f[_0x2203('0xf2')]]['queue']][_0x2203('0x102')]||0x0:0x0;}this[_0x2203('0x23')][this[_0x2203('0x1f')][_0x65b03f[_0x2203('0xf2')]][_0x2203('0x9e')]]['_rr']=this[_0x2203('0x101')][this[_0x2203('0x1f')][_0x65b03f[_0x2203('0xf2')]][_0x2203('0x9e')]];for(var _0x203956=0x0;_0x203956=0x0?!![]:![];})[_0x2203('0x9c')](myreject(_0x4a3038)));}}else{_0x48ce67['push'](ami[_0x2203('0x99')]({'action':_0x2203('0x11d'),'command':util['format'](_0x2203('0x119'),_0x2a2bbe,!_['isUndefined'](config[_0x2203('0x115')][_0x2ccf01])?_0x2ccf01:'')})['then'](function(_0x3e1b56){return _0x3e1b56[_0x2203('0x11a')][_0x2203('0x11b')](_0x2203('0x11c'))>=0x0?!![]:![];})[_0x2203('0x9c')](myreject(_0x4a3038)));}BPromise[_0x2203('0x11e')](_0x48ce67)[_0x2203('0xa0')](function(_0x48f227){var _0x1cbdb6=_['some'](_0x48f227);if(_0x1cbdb6){return _0x44f6b1(_0x1cbdb6);}else{_0x5670e3[_0x2203('0x38')]=_0x1c3fdf?_0x2203('0x11f'):_0x2203('0x120');return _0x4a3038(msgResponse(_0x2203('0x121'),_0x2203('0x112'),_0x2203('0x122')+_0x1c3fdf+'\x20'+_0x18e8c1+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x2a2bbe,{'showHidden':![],'depth':null})+_0x2203('0x123')+_0x2ccf01));}})[_0x2203('0x9c')](function(_0x9f4276){return _0x4a3038(msgResponse('ifTime',_0x2203('0x112'),JSON[_0x2203('0x42')](_0x9f4276)));});});};Dialer[_0x2203('0x14')][_0x2203('0x124')]=function(_0x2bbf94){var _0x471135=this;return function(){switch(_0x2bbf94[_0x2203('0x52')]){case'progressive':freeVariablesPredictive(_0x2bbf94);_0x471135[_0x2203('0x125')](_0x2bbf94,0x1);break;case _0x2203('0x126'):freeVariablesPredictive(_0x2bbf94);_0x471135[_0x2203('0x125')](_0x2bbf94,_0x2bbf94[_0x2203('0x127')]);break;case _0x2203('0x8'):_0x471135[_0x2203('0x8')](_0x2bbf94);break;case _0x2203('0x7'):freeVariablesPredictive(_0x2bbf94);_0x471135[_0x2203('0x125')](_0x2bbf94,0x1);break;default:freeVariablesPredictive(_0x2bbf94);logger[_0x2203('0x82')](_0x2203('0x128'),_0x2bbf94[_0x2203('0x3a')],'method\x20not\x20recognized');}};};Dialer[_0x2203('0x14')][_0x2203('0x129')]=function(_0x46b290){var _0x3f7415=this;return function(){_0x3f7415[_0x2203('0x12a')](_0x46b290);};};Dialer['prototype'][_0x2203('0xa')]=function(_0x4d4684){var _0x362eb2=this;if(isNotPreview(_0x4d4684[_0x2203('0x52')])){if(isVoiceQueueOutbound(_0x4d4684[_0x2203('0x46')])&&isActive(_0x4d4684[_0x2203('0x12b')])){_0x4d4684[_0x2203('0x8c')]=!![];BPromise[_0x2203('0xab')]()[_0x2203('0xa0')](checkIsLoggedIn(_0x4d4684,_0x4d4684[_0x2203('0x4a')]))[_0x2203('0xa0')](checkIsActive(_0x4d4684,_0x4d4684[_0x2203('0x12b')]))[_0x2203('0xa0')](checkInterval(_0x4d4684))[_0x2203('0xa0')](_0x362eb2['checkIsTrunkReachable'](_0x4d4684))[_0x2203('0xa0')](_0x362eb2[_0x2203('0x12c')](_0x4d4684[_0x2203('0x12d')],_0x4d4684[_0x2203('0x12e')],_0x4d4684[_0x2203('0x3a')],_0x4d4684))[_0x2203('0xa0')](_0x362eb2[_0x2203('0x111')](_0x4d4684[_0x2203('0x3c')],_0x4d4684[_0x2203('0x12e')],_0x4d4684[_0x2203('0x3a')],_0x4d4684))[_0x2203('0xa0')](_0x362eb2[_0x2203('0x124')](_0x4d4684))['catch'](loggerCatchQueueSummary(_0x2203('0x12f'),_0x4d4684));}else{notSendMessagesQueue(_0x4d4684);}}else{freeVariablesPredictive(_0x4d4684);}};Dialer[_0x2203('0x14')][_0x2203('0x130')]=function(){var _0x113e2a=this;var _0x5e0aa5;for(var _0x7a3db2 in this[_0x2203('0x1a')]){if(this[_0x2203('0x1a')][_0x2203('0x97')](_0x7a3db2)){_0x5e0aa5=this[_0x2203('0x1a')][_0x7a3db2];if(isCampaignIvr(_0x5e0aa5['type'])&&isActive(_0x5e0aa5[_0x2203('0x6c')])){_0x5e0aa5['sendMessageOneNotActive']=!![];BPromise[_0x2203('0xab')]()['then'](checkIsActive(_0x5e0aa5,_0x5e0aa5[_0x2203('0x6c')]))[_0x2203('0xa0')](checkInterval(_0x5e0aa5))[_0x2203('0xa0')](_0x113e2a[_0x2203('0x10c')](_0x5e0aa5))['then'](_0x113e2a[_0x2203('0x12c')](_0x5e0aa5['dialGlobalInterval'],_0x5e0aa5['dialTimezone'],_0x5e0aa5[_0x2203('0x3a')],_0x5e0aa5))[_0x2203('0xa0')](_0x113e2a[_0x2203('0x111')](_0x5e0aa5[_0x2203('0x3c')],_0x5e0aa5[_0x2203('0x12e')],_0x5e0aa5['name'],_0x5e0aa5))['then'](_0x113e2a[_0x2203('0x129')](_0x5e0aa5))[_0x2203('0x9c')](loggerCatchQueueSummary(_0x2203('0x131'),_0x5e0aa5));}else{notSendMessagesCampaign(_0x5e0aa5);}}}};function getCallerIdRandom(_0x1d18b9,_0x1361db){var _0x13d111,_0x212357,_0x3f65d8;if(_0x1361db<=0x0){_0x1361db=0x1;}_0x13d111=new RegExp(_0x2203('0x132')+_0x1361db+'}$');_0x212357=Math[_0x2203('0x133')](0xa,_0x1361db-0x1);_0x3f65d8=Math[_0x2203('0x133')](0xa,_0x1361db)-0x1;return util['format']('%s',_[_0x2203('0x134')](_0x1d18b9,_0x13d111,_['random'](_0x212357,_0x3f65d8)));}function extractCalleridName(_0x1921da){var _0x599977=_0x1921da[_0x2203('0x135')](/"(.*?)"/);return _0x599977?_0x599977[0x1]:_0x1921da;}function extractCalleridNumber(_0x3c703b){var _0x29e826=_0x3c703b[_0x2203('0x135')](/<(.*?)>/);return _0x29e826?_0x29e826[0x1]:_0x3c703b;}Dialer[_0x2203('0x14')][_0x2203('0x136')]=function(_0x26c653,_0x35809a){var _0x3590c5=this;var _0x5747a5=uuid['v4']();this[_0x2203('0x1f')][_0x5747a5]=new Action(_0x26c653,_0x35809a,_0x5747a5);return new BPromise(function(_0x4f49bf,_0x1aa5e6){if(_[_0x2203('0x37')](_0x26c653)&&'object'!==typeof _0x26c653){return _0x1aa5e6(msgResponse(_0x2203('0x137'),_0x2203('0x112'),_0x2203('0x138')));}if(_[_0x2203('0x37')](_0x35809a[_0x2203('0x139')][_0x2203('0x13a')])||_0x35809a[_0x2203('0x139')][_0x2203('0x13a')]===null){return _0x1aa5e6(msgResponse('originate','Failure',_0x2203('0x13b')));}var _0x48665b={'XMD-CALLERID':_0x3590c5[_0x2203('0x1f')][_0x5747a5][_0x2203('0x13c')](),'XMD-AGI':_0x26c653[_0x2203('0xdc')]?util['format'](_0x2203('0x13d'),ipAgi,_0x26c653[_0x2203('0xdc')]):'NONE','XMD-AGIAFTER':_0x26c653[_0x2203('0xe3')]?util['format'](_0x2203('0x13d'),ipAgi,_0x26c653['dialQueueProject2']):_0x2203('0x13e'),'XMD-QUEUE':_0x26c653[_0x2203('0x46')]===_0x2203('0x7d')?util[_0x2203('0x70')](_0x2203('0x13f'),_0x26c653['name'],_0x26c653[_0x2203('0x140')]||'',_0x26c653[_0x2203('0xe4')]?'c':'',_0x26c653[_0x2203('0xeb')]||0x3):'NONE','XMD-CONTACTID':_0x35809a[_0x2203('0xff')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x3590c5[_0x2203('0x1f')][_0x5747a5][_0x2203('0x13c')](),'XMD-AMD':_0x26c653['dialAMDActive']?_0x2203('0x141'):_0x2203('0x13e'),'XMD-DESTINATION':_0x2203('0x142')};if(_0x26c653[_0x2203('0xc8')]){_0x48665b[_0x2203('0x143')]=_0x26c653[_0x2203('0x144')]||0x9c4;_0x48665b[_0x2203('0x145')]=_0x26c653[_0x2203('0x146')]||0x5dc;_0x48665b[_0x2203('0x147')]=_0x26c653[_0x2203('0x148')]||0x320;_0x48665b['XMD-AMDTOTALANALYSISTIME']=_0x26c653['dialAMDTotalAnalysisTime']||0x1388;_0x48665b[_0x2203('0x149')]=_0x26c653[_0x2203('0x14a')]||0x64;_0x48665b[_0x2203('0x14b')]=_0x26c653['dialAMDBetweenWordsSilence']||0x32;_0x48665b['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x26c653['dialAMDMaximumNumberOfWords']||0x3;_0x48665b[_0x2203('0x14c')]=_0x26c653[_0x2203('0x14d')]||0x100;_0x48665b[_0x2203('0x14e')]=_0x26c653['dialAMDMaximumWordLength']||0x1388;}if(_0x26c653['type']===_0x2203('0x7d')){_0x48665b['XMD-VOICEQUEUEID']=_0x35809a[_0x2203('0xbb')];}else{_0x48665b['XMD-CAMPAIGNID']=_0x35809a[_0x2203('0xbc')];}for(var _0x17ce35 in _0x35809a[_0x2203('0x139')]){if(_0x35809a[_0x2203('0x139')][_0x2203('0x97')](_0x17ce35)){if(isNotNull(_0x35809a[_0x2203('0x139')][_0x17ce35])&&_0x17ce35!=='id'&&_0x17ce35!==_0x2203('0x14f')&&_0x17ce35!==_0x2203('0x150')&&_0x17ce35!==_0x2203('0x151')){_0x48665b[util[_0x2203('0x70')](_0x2203('0x152'),_0x2203('0x153'),_[_0x2203('0x154')](_0x17ce35))]=_0x35809a[_0x2203('0x139')][_0x17ce35];}}}var _0x4351e1=_0x3590c5['isTrunkReachable'](_0x26c653[_0x2203('0x6b')])?getCallerId(_0x26c653[_0x2203('0x6b')][_0x2203('0x6d')],_0x26c653[_0x2203('0x53')],_0x26c653['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x26c653['dialOriginateCallerIdNumber'],_0x26c653['dialRandomLastDigitCallerIdNumber']):_0x26c653[_0x2203('0x54')]):getCallerId(_['isNil'](_0x26c653[_0x2203('0x10d')])?_0x26c653[_0x2203('0x6b')][_0x2203('0x6d')]:_0x26c653['TrunkBackup'][_0x2203('0x6d')],_0x26c653['dialOriginateCallerIdName'],_0x26c653[_0x2203('0x155')]>0x0?getCallerIdRandom(_0x26c653['dialOriginateCallerIdNumber'],_0x26c653['dialRandomLastDigitCallerIdNumber']):_0x26c653[_0x2203('0x54')]);if(_0x4351e1){_0x48665b[_0x2203('0x156')]=_0x3590c5['actions'][_0x5747a5][_0x2203('0x157')]=extractCalleridName(_0x4351e1);_0x48665b[_0x2203('0x158')]=_0x3590c5[_0x2203('0x1f')][_0x5747a5]['originatecalleridnum']=extractCalleridNumber(_0x4351e1);}return ami[_0x2203('0x99')]({'actionid':_0x5747a5,'action':_0x2203('0x137'),'channel':_0x3590c5[_0x2203('0xc1')](_0x26c653[_0x2203('0x6b')])?util[_0x2203('0x70')](_0x2203('0x159'),_0x26c653[_0x2203('0x6b')][_0x2203('0x3a')],isNotNull(_0x26c653[_0x2203('0x15a')])?_0x26c653[_0x2203('0x15a')][_0x2203('0x15b')]()||'':'',_0x26c653[_0x2203('0x15c')]>0x0?_0x35809a['Contact'][_0x2203('0x13a')][_0x2203('0x15d')](_0x26c653[_0x2203('0x15c')]):_0x35809a[_0x2203('0x139')]['phone']):util[_0x2203('0x70')](_0x2203('0x159'),_[_0x2203('0x98')](_0x26c653[_0x2203('0x10d')])?_0x26c653[_0x2203('0x6b')][_0x2203('0x3a')]:_0x26c653[_0x2203('0x10d')][_0x2203('0x3a')],isNotNull(_0x26c653[_0x2203('0x15a')])?_0x26c653[_0x2203('0x15a')][_0x2203('0x15b')]()||'':'',_0x26c653['dialCutDigit']>0x0?_0x35809a[_0x2203('0x139')][_0x2203('0x13a')]['substring'](_0x26c653[_0x2203('0x15c')]):_0x35809a[_0x2203('0x139')]['phone']),'callerid':_0x4351e1,'Exten':_0x2203('0x142'),'Context':'from-sip','Priority':'1','variable':_0x48665b,'timeout':(_0x26c653['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x5747a5})[_0x2203('0xa0')](function(_0x4c6b1f){return _0x4f49bf(_0x4c6b1f);})[_0x2203('0x9c')](function(_0x4495f5){_0x26c653[_0x2203('0x5e')]+=0x1;var _0x5015ae=new History(_0x3590c5[_0x2203('0x1f')][_0x5747a5]);logger[_0x2203('0x82')](util[_0x2203('0x70')]('[originateError]:\x20%s',JSON['stringify'](_0x4495f5)));_0x5015ae[_0x2203('0xcb')]=0xe;_0x5015ae[_0x2203('0x91')]=_0x2203('0x15e');_0x5015ae['starttime']=moment()['format'](_0x2203('0xe7'));_0x5015ae[_0x2203('0x92')]=_0x5015ae[_0x2203('0x93')];_0x3590c5['createHistory'](_0x5015ae)['catch'](loggerCatch(_0x2203('0x15f')));_0x3590c5['moveContactManagedDialer'](_0x5015ae)[_0x2203('0x9c')](loggerCatch('[originate][error]'))['finally'](function(){delete _0x3590c5[_0x2203('0x1f')][_0x5747a5];return _0x1aa5e6(msgResponse(_0x2203('0x137'),_0x2203('0x41'),_0x2203('0x160')));});});});};Dialer[_0x2203('0x14')][_0x2203('0x28')]=function(_0x413ccd){var _0x460df5=this['actions'][_0x413ccd[_0x2203('0xf2')]];var _0x3e4f5d=this;if(_0x460df5){delete this[_0x2203('0x1f')][_0x413ccd[_0x2203('0xf2')]];_0x460df5[_0x2203('0x161')]=moment()[_0x2203('0x70')](_0x2203('0xe7'));var _0x266c2f=_0x460df5[_0x2203('0x46')]===_0x2203('0x6f')?this['campaigns'][_0x460df5[_0x2203('0x9e')]]:this[_0x2203('0x19')][_0x460df5['getQueue']()];if(!this[_0x2203('0xbf')](_0x413ccd[_0x2203('0x162')])){this[_0x2203('0x9d')](_0x266c2f);return this[_0x2203('0x163')](_0x460df5,_0x266c2f,_0x413ccd)['then'](function(_0xcb2757){})[_0x2203('0x9c')](loggerCatch(_0x2203('0x164')));}else{this[_0x2203('0x21')][_0x413ccd['uniqueid']]=_0x460df5;}}};Dialer['prototype'][_0x2203('0x165')]=function(_0x2b0aed,_0x3c85b8,_0x3fafe9){var _0x4d7169=new History(_0x3c85b8);if(_0x4d7169[_0x2203('0x166')]+_0x4d7169[_0x2203('0x167')]+_0x4d7169[_0x2203('0x168')]>=_0x3fafe9[_0x2203('0x169')]-0x1){return!![];}switch(_0x2b0aed){case 0x3:if(_0x4d7169[_0x2203('0x168')]>=_0x3fafe9['dialNoAnswerMaxRetry']-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnoanswerretry':_0x4d7169['countnoanswerretry']+=0x1,'scheduledat':moment()['add'](_0x3fafe9['dialNoAnswerRetryFrequency'],_0x2203('0x16a'))[_0x2203('0x70')](_0x2203('0xe7')),'ContactId':_0x4d7169[_0x2203('0xff')],'ListId':_0x4d7169['ListId'],'VoiceQueueId':_0x4d7169[_0x2203('0xbb')]||undefined,'CampaignId':_0x4d7169[_0x2203('0xbc')]||undefined})[_0x2203('0x9c')](loggerCatch(_0x2203('0x16b')));}break;case 0x5:if(_0x4d7169[_0x2203('0x166')]>=_0x3fafe9[_0x2203('0x16c')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countbusyretry':_0x4d7169['countbusyretry']+=0x1,'scheduledat':moment()['add'](_0x3fafe9[_0x2203('0x16d')],_0x2203('0x16a'))[_0x2203('0x70')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4d7169[_0x2203('0xff')],'ListId':_0x4d7169[_0x2203('0xb9')],'VoiceQueueId':_0x4d7169[_0x2203('0xbb')]||undefined,'CampaignId':_0x4d7169['CampaignId']||undefined})[_0x2203('0x9c')](loggerCatch(_0x2203('0x16e')));}break;case 0x8:if(_0x4d7169['countcongestionretry']>=_0x3fafe9[_0x2203('0x16f')]-0x1){return!![];}else{this[_0x2203('0xaa')]({'active':![],'countcongestionretry':_0x4d7169['countcongestionretry']+=0x1,'scheduledat':moment()[_0x2203('0x170')](_0x3fafe9[_0x2203('0x171')],_0x2203('0x16a'))[_0x2203('0x70')](_0x2203('0xe7')),'ContactId':_0x4d7169[_0x2203('0xff')],'ListId':_0x4d7169[_0x2203('0xb9')],'VoiceQueueId':_0x4d7169['VoiceQueueId']||undefined,'CampaignId':_0x4d7169['CampaignId']||undefined})[_0x2203('0x9c')](loggerCatch(_0x2203('0x172')));}break;default:return!![];}};Dialer['prototype'][_0x2203('0x163')]=function(_0x40b2e5,_0x413c13,_0x3156df){var _0x46af87=this;var _0x4cce99=new History(_0x40b2e5);return new BPromise(function(_0x7a189d,_0x285622){if(_['isUndefined'](_0x413c13)&&_0x2203('0x173')!==typeof _0x413c13){return _0x285622(msgResponse(_0x2203('0x174'),_0x2203('0x112'),_0x2203('0x175')));}if(_[_0x2203('0x37')](_0x3156df)&&'object'!==typeof _0x3156df){return _0x285622(msgResponse(_0x2203('0x174'),_0x2203('0x112'),_0x2203('0x176')));}switch(_0x3156df['reason']){case'0':_0x413c13[_0x2203('0x5d')]+=0x1;_0x4cce99[_0x2203('0xcb')]=0x0;_0x4cce99[_0x2203('0x91')]=_0x2203('0x177');_0x46af87[_0x2203('0xb3')](_0x4cce99)['catch'](loggerCatch(_0x2203('0x178')));if(_0x46af87['checkRetriveMax'](0x0,_0x40b2e5,_0x413c13)){if(_0x4cce99['countbusyretry']+_0x4cce99[_0x2203('0x167')]+_0x4cce99['countnoanswerretry']>=_0x413c13[_0x2203('0x169')]){_0x46af87['stateGlobal'](_0x4cce99,_0x7a189d,_0x285622,'reason\x200\x20no\x20such\x20number....');}else{_0x46af87['createStateFinal'](_0x4cce99,_0x7a189d,_0x285622,_0x2203('0x179'));}}break;case'3':_0x413c13[_0x2203('0x5c')]+=0x1;_0x4cce99['state']=0x3;_0x4cce99[_0x2203('0x91')]=_0x2203('0x17a');_0x4cce99[_0x2203('0x168')]+=0x1;_0x4cce99['countglobal']+=0x1;_0x46af87[_0x2203('0xb3')](_0x4cce99)[_0x2203('0x9c')](loggerCatch(_0x2203('0x17b')));if(_0x46af87[_0x2203('0x165')](0x3,_0x40b2e5,_0x413c13)){if(_0x4cce99['countnoanswerretry']>=_0x413c13[_0x2203('0x17c')]){_0x46af87[_0x2203('0x17d')](_0x4cce99,_0x7a189d,_0x285622,'reason\x203\x20ringing\x20no\x20answer');}else{_0x46af87[_0x2203('0x17e')](_0x4cce99,_0x7a189d,_0x285622,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x413c13[_0x2203('0x58')]+=0x1;_0x4cce99['state']=0x5;_0x4cce99[_0x2203('0x91')]=_0x2203('0x17f');_0x4cce99[_0x2203('0x166')]+=0x1;_0x4cce99['countglobal']+=0x1;_0x46af87['createHistory'](_0x4cce99)['catch'](loggerCatch(_0x2203('0x180')));if(_0x46af87[_0x2203('0x165')](0x5,_0x40b2e5,_0x413c13)){if(_0x4cce99['countbusyretry']>=_0x413c13[_0x2203('0x16c')]){_0x46af87['createStateFinal'](_0x4cce99,_0x7a189d,_0x285622,_0x2203('0x181'));}else{_0x46af87['stateGlobal'](_0x4cce99,_0x7a189d,_0x285622,_0x2203('0x181'));}}break;case'8':_0x413c13['outboundCongestionCallsDay']+=0x1;_0x4cce99[_0x2203('0xcb')]=0x8;_0x4cce99[_0x2203('0x91')]=_0x2203('0x182');_0x4cce99[_0x2203('0x167')]+=0x1;_0x4cce99[_0x2203('0x183')]+=0x1;_0x46af87[_0x2203('0xb3')](_0x4cce99)['catch'](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x46af87[_0x2203('0x165')](0x8,_0x40b2e5,_0x413c13)){if(_0x4cce99[_0x2203('0x167')]>=_0x413c13[_0x2203('0x16f')]){_0x46af87[_0x2203('0x17d')](_0x4cce99,_0x7a189d,_0x285622,_0x2203('0x184'));}else{_0x46af87[_0x2203('0x17e')](_0x4cce99,_0x7a189d,_0x285622,_0x2203('0x184'));}}break;default:_0x413c13[_0x2203('0x61')]+=0x1;_0x4cce99[_0x2203('0xcb')]=0xc;_0x4cce99[_0x2203('0x91')]=_0x3156df['reason'];_0x46af87[_0x2203('0xb3')](_0x4cce99)[_0x2203('0x9c')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x46af87['checkRetriveMax'](_0x3156df[_0x2203('0xe0')],_0x40b2e5,_0x413c13)){if(_0x4cce99['countbusyretry']+_0x4cce99[_0x2203('0x167')]+_0x4cce99[_0x2203('0x168')]>=_0x413c13[_0x2203('0x169')]){_0x46af87['stateGlobal'](_0x4cce99,_0x7a189d,_0x285622,_0x3156df[_0x2203('0xe0')]);}else{_0x46af87[_0x2203('0x17d')](_0x4cce99,_0x7a189d,_0x285622,_0x3156df['reason']);}}}});};Dialer['prototype'][_0x2203('0x17e')]=function(_0x1363d2,_0x5ae868,_0x27d009,_0x52fecc){var _0x2b72e2=new Final(_0x1363d2);_0x2b72e2[_0x2203('0xcb')]=0xf;_0x2b72e2[_0x2203('0x91')]='Global';this[_0x2203('0x17d')](_0x2b72e2,_0x5ae868,_0x27d009,_0x52fecc);};Dialer[_0x2203('0x14')][_0x2203('0x17d')]=function(_0x5564e6,_0xb096dd,_0x43a9af,_0x39e22d){this[_0x2203('0xb1')](_0x5564e6)[_0x2203('0xa0')](function(_0x225ab6){return _0xb096dd(msgResponse(_0x2203('0x174'),'Success',_0x39e22d));})[_0x2203('0x9c')](function(_0x550b4c){return _0x43a9af(msgResponse(_0x2203('0x185'),'Failure',_0x2203('0x186')));});};Dialer[_0x2203('0x14')][_0x2203('0x8')]=function(_0x52b9b3){var _0x14bd8d=this;var _0x229e40=_0x52b9b3[_0x2203('0x187')]/0x64;var _0x4aa271=_0x52b9b3['outboundDropCallsDayTimeout']/(_0x52b9b3[_0x2203('0x5b')]+_0x52b9b3[_0x2203('0x56')]);var _0x329725=_0x52b9b3[_0x2203('0x4a')]-_0x52b9b3[_0x2203('0x69')]-_0x52b9b3['waiting']-_0x52b9b3[_0x2203('0x6a')]-_0x52b9b3[_0x2203('0x4e')];var _0xb95343=(_0x52b9b3['loggedIn']-_0x52b9b3[_0x2203('0x69')])*_0x52b9b3[_0x2203('0x188')];var _0x55bb6d=Math[_0x2203('0x189')](_0x52b9b3['erlangCalls']*_0x52b9b3['erlangAbandonmentRate']*_0x52b9b3['predictiveIntervalHitRate']*_0x52b9b3[_0x2203('0x18a')]);if(_[_0x2203('0x37')](_0x52b9b3['startProgressive'])){loggerPredictive[_0x2203('0x72')](_0x2203('0x18b'));if(!_[_0x2203('0x37')](_0x52b9b3['startPredictive'])){_0x52b9b3['startPredictive']=undefined;loggerPredictive[_0x2203('0x82')](_0x2203('0x18c'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x2203('0x37')](_0x52b9b3[_0x2203('0x7c')])){loggerPredictive['error'](_0x2203('0x18c'),_0x2203('0x18d'));clearInterval(_0x52b9b3['handlePredictive']);_0x52b9b3[_0x2203('0x7c')]=undefined;}_0x52b9b3['startProgressive']=moment()[_0x2203('0x70')](_0x2203('0xe7'));loggerPredictive['info'](_0x2203('0x18e'),_0x52b9b3[_0x2203('0x7a')],_0x52b9b3['name']);this[_0x2203('0x125')](_0x52b9b3,0x1);}else if(ifInterval(_0x52b9b3[_0x2203('0x18f')],_0x52b9b3[_0x2203('0x7a')])){this['handlePower'](_0x52b9b3,0x1);loggerPredictiveCalls['info'](_0x2203('0x190'),_0x52b9b3[_0x2203('0x7a')],_0x52b9b3['name']);_0x52b9b3[_0x2203('0x191')]=0x0;_0x52b9b3[_0x2203('0x67')]=0x0;}else if(_0x229e40<_0x4aa271&&_0x52b9b3['dialPredictiveOptimization']===_0x2203('0x192')){freeVariablesPredictive(_0x52b9b3);loggerPredictive['info'](_0x2203('0x193'),'Dropped\x20calls\x20day',_0x4aa271,_0x2203('0x7a'),_0x52b9b3['name']);}else if(_0x329725>_0xb95343){freeVariablesPredictive(_0x52b9b3);loggerPredictive[_0x2203('0x72')]('[stopMethodPredictive][ReStartProgressive][LowerLimitInterval]','Agent\x20free',_0x329725,_0x2203('0x194'),_0xb95343);}else if(_0x55bb6d<_0x52b9b3[_0x2203('0x67')]&&_0x52b9b3['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x52b9b3);loggerPredictive[_0x2203('0x72')](_0x2203('0x195'),_0x2203('0x196'),_0x55bb6d,_0x2203('0x197'),_0x52b9b3['predictiveIntervalErlangCallsDroppedCalls'],_0x2203('0x7a'),_0x52b9b3['name']);}else if(!ifInterval(_0x52b9b3[_0x2203('0x18f')],_0x52b9b3['startProgressive'])&&_[_0x2203('0x37')](_0x52b9b3[_0x2203('0x22')])&&!_[_0x2203('0x37')](_0x52b9b3[_0x2203('0x7a')])){_0x52b9b3[_0x2203('0x22')]=moment()[_0x2203('0x70')](_0x2203('0xe7'));loggerPredictive[_0x2203('0x72')](_0x2203('0x198'),_0x52b9b3[_0x2203('0x22')],_0x52b9b3['name']);this[_0x2203('0xa7')](_0x52b9b3[_0x2203('0x18f')])[_0x2203('0xa0')](this[_0x2203('0x199')](_0x52b9b3))['then'](mergeDataErlangB(_0x52b9b3))['then'](this[_0x2203('0x19a')](_0x52b9b3))[_0x2203('0x9c')](loggerCatchPredictive(_0x2203('0x19b'),_0x52b9b3));}else if(!ifInterval(_0x52b9b3['dialPredictiveInterval'],_0x52b9b3[_0x2203('0x22')])){_0x52b9b3[_0x2203('0x67')]=0x0;_0x52b9b3[_0x2203('0x22')]=moment()[_0x2203('0x70')](_0x2203('0xe7'));loggerPredictive['info'](_0x2203('0x19c'),_0x52b9b3[_0x2203('0x22')],_0x52b9b3['name']);clearInterval(_0x52b9b3[_0x2203('0x7c')]);_0x52b9b3[_0x2203('0x7c')]=undefined;this['averageHandleTime'](_0x52b9b3[_0x2203('0x18f')])[_0x2203('0xa0')](this['getDataPredictive'](_0x52b9b3))[_0x2203('0xa0')](mergeDataErlangB(_0x52b9b3))[_0x2203('0xa0')](this[_0x2203('0x19a')](_0x52b9b3))[_0x2203('0x9c')](loggerCatchPredictive(_0x2203('0x19b'),_0x52b9b3));}};Dialer['prototype'][_0x2203('0x199')]=function(_0x32597f){var _0x91c182=this;return function(_0x1bda33){return new BPromise(function(_0x23e8a2,_0x214ca1){_[_0x2203('0x79')](_0x32597f,_0x1bda33[0x0]);if(checkGetDataPredictive(_0x1bda33[0x0])){loggerPredictive['info'](JSON[_0x2203('0x42')](_0x1bda33[0x0]));if(_0x32597f[_0x2203('0x19d')]==='dropRate'){return _0x91c182[_0x2203('0xb0')](_0x32597f['id'])[_0x2203('0xa0')](function(_0x2c16a1){var _0x29057c=_0x32597f[_0x2203('0x4a')]-_0x2c16a1[0x0][_0x2203('0x19e')];var _0x1b7be1=_0x32597f[_0x2203('0x18f')]*0x3c;var _0x4ac8e4=_0x1bda33[0x0][_0x2203('0x64')]+_0x1bda33[0x0][_0x2203('0x63')];var _0x203c6c=(_0x1bda33[0x0]['predictiveIntervalAnsweredCalls']+_0x1bda33[0x0][_0x2203('0x65')]+_0x1bda33[0x0][_0x2203('0x19f')])/_0x1bda33[0x0][_0x2203('0x71')];var _0x4ffa19=_0x32597f[_0x2203('0x187')]/0x64;_0x32597f[_0x2203('0x69')]=_0x2c16a1[0x0][_0x2203('0x19e')]||0x0;_0x32597f[_0x2203('0x68')]=_0x203c6c>0x0?_0x203c6c:0x1;return _0x91c182['abandonmentRate'](_0x29057c,_0x1b7be1,_0x4ac8e4,_0x203c6c,_0x4ffa19);})['then'](function(_0x1e2723){return _0x23e8a2(_0x1e2723);})[_0x2203('0x9c')](function(_0x48960a){return _0x214ca1(msgResponse(_0x2203('0x1a0'),_0x2203('0x112'),JSON[_0x2203('0x42')](_0x48960a)));});}if(_0x32597f[_0x2203('0x19d')]==='agentBusyFactor'){return _0x91c182['getVoiceQueueRtPauses'](_0x32597f['id'])[_0x2203('0xa0')](function(_0x3687c6){var _0xed971d=_0x32597f['loggedIn']-_0x3687c6[0x0][_0x2203('0x19e')];var _0x29a2fc=_0x32597f['dialPredictiveInterval']*0x3c;var _0x43ac51=_0x1bda33[0x0][_0x2203('0x64')]+_0x1bda33[0x0][_0x2203('0x63')];var _0x3ff97f=(_0x1bda33[0x0][_0x2203('0x62')]+_0x1bda33[0x0][_0x2203('0x65')]+_0x1bda33[0x0][_0x2203('0x19f')])/_0x1bda33[0x0][_0x2203('0x71')];var _0x44e194=_0x32597f[_0x2203('0x187')]/0x64;_0x32597f[_0x2203('0x69')]=_0x3687c6[0x0][_0x2203('0x19e')]||0x0;_0x32597f[_0x2203('0x68')]=_0x3ff97f>0x0?_0x3ff97f:0x1;return _0x91c182[_0x2203('0x1a1')](_0xed971d,_0x29a2fc,_0x43ac51,_0x3ff97f,_0x44e194);})[_0x2203('0xa0')](function(_0x57a10b){return _0x23e8a2(_0x57a10b);})[_0x2203('0x9c')](function(_0xc39196){return _0x214ca1(msgResponse('[CatchErlangB]',_0x2203('0x112'),JSON[_0x2203('0x42')](_0xc39196)));});}}else{return _0x214ca1(msgResponse(_0x2203('0x1a2'),_0x2203('0x112'),_0x2203('0x1a3')));}});};};Dialer[_0x2203('0x14')][_0x2203('0x19a')]=function(_0x399ec2){var _0x50d268=this;return function(){var _0x56017d=0x0;var _0x2062e1=Math[_0x2203('0x189')](_0x399ec2[_0x2203('0x1a4')]*0x3e8);if(_0x2062e1>0x0){_0x2062e1=_0x2062e1<0x64?0x64:_0x2062e1;loggerPredictive[_0x2203('0x72')](_0x2203('0x1a5'),_0x2062e1);_0x399ec2[_0x2203('0x7c')]=setInterval(function(){_0x50d268['handlePredictive'](_0x399ec2);loggerPredictiveCalls[_0x2203('0x72')](_0x2203('0x1a6'),_0x56017d+=0x1);},_0x2062e1);}else{loggerPredictive['info']('[startMethodPredictive][milliseconds]\x20','Failure\x20',_0x2062e1);}};};Dialer[_0x2203('0x14')][_0x2203('0x1a7')]=function(_0x250403,_0x303dbb){var _0x3f9801=this;return function(_0x5849c0){if(_['isEmpty'](_0x5849c0)){if(_[_0x2203('0x98')](_0x303dbb['UserId'])||!_0x303dbb[_0x2203('0x1a8')]){if(_0x250403[_0x2203('0x52')]===_0x2203('0x7')){_0x250403['queueStatusComplete']=_[_0x2203('0x37')](_0x250403[_0x2203('0xf9')])?!![]:_0x250403[_0x2203('0xf9')];var _0x4b469a=uuid['v4']();_0x3f9801['actions'][_0x4b469a]=new Action(_0x250403,_0x303dbb,_0x4b469a);loggerBooked[_0x2203('0x72')](_0x2203('0x1a9'),_0x4b469a,_0x2203('0x1aa'),JSON[_0x2203('0x42')](_0x250403[_0x2203('0xf9')]),_0x2203('0x1ab'),_0x250403[_0x2203('0x3a')]);if(_0x250403['queueStatusComplete']){_0x250403['queueStatusComplete']=![];_0x3f9801[_0x2203('0x23')][_0x3f9801[_0x2203('0x1f')][_0x4b469a][_0x2203('0x9e')]]=[];ami[_0x2203('0x99')]({'actionid':_0x4b469a,'action':_0x2203('0x1ac'),'queue':_0x250403[_0x2203('0x3a')]})[_0x2203('0x9c')](function(_0x24ce22){_0x3f9801[_0x2203('0x9d')](_0x250403);_0x3f9801['rescheduleContact']({'active':![],'ContactId':_0x3f9801[_0x2203('0x1f')][_0x4b469a][_0x2203('0xff')],'ListId':_0x3f9801[_0x2203('0x1f')][_0x4b469a][_0x2203('0xb9')],'VoiceQueueId':_0x3f9801[_0x2203('0x1f')][_0x4b469a][_0x2203('0xbb')]||undefined,'CampaignId':_0x3f9801[_0x2203('0x1f')][_0x4b469a][_0x2203('0xbc')]||undefined})[_0x2203('0x9c')](loggerCatch(_0x2203('0x1ad')));delete _0x3f9801[_0x2203('0x1f')][_0x4b469a];});}else{loggerBooked[_0x2203('0x72')](_0x2203('0x1ae'),JSON[_0x2203('0x42')](_0x250403['queueStatusComplete']),_0x2203('0x1ab'),_0x250403[_0x2203('0x3a')]);_0x3f9801[_0x2203('0x9d')](_0x250403);_0x3f9801['rescheduleContact']({'active':![],'ContactId':_0x3f9801['actions'][_0x4b469a][_0x2203('0xff')],'ListId':_0x3f9801[_0x2203('0x1f')][_0x4b469a][_0x2203('0xb9')],'VoiceQueueId':_0x3f9801[_0x2203('0x1f')][_0x4b469a]['VoiceQueueId']||undefined,'CampaignId':_0x3f9801['actions'][_0x4b469a][_0x2203('0xbc')]||undefined})[_0x2203('0x9c')](loggerCatch(_0x2203('0x1ad')));delete _0x3f9801['actions'][_0x4b469a];}}else{return _0x3f9801[_0x2203('0x136')](_0x250403,_0x303dbb);}}else{if(getDiff(_0x303dbb[_0x2203('0x1af')])<_0x250403[_0x2203('0x1b0')]*0x3c){_0x3f9801['preview'][_0x2203('0xfc')](_0x303dbb['id'])[_0x2203('0x17')](function(){_0x3f9801[_0x2203('0x9d')](_0x250403);});}else{_0x250403[_0x2203('0x5f')]+=0x1;_0x3f9801[_0x2203('0x9d')](_0x250403);if(_0x250403[_0x2203('0x1b1')]){_0x3f9801[_0x2203('0xaa')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x303dbb[_0x2203('0xff')],'ListId':_0x303dbb[_0x2203('0xb9')],'VoiceQueueId':_0x303dbb[_0x2203('0xbb')]||undefined,'CampaignId':_0x303dbb[_0x2203('0xbc')]||undefined})[_0x2203('0x9c')](loggerCatch(_0x2203('0x1b2')));_0x3f9801[_0x2203('0xb3')](createObjHistory(_0x250403,_0x303dbb,_0x2203('0x1b3'),0x17,_0x2203('0x1b4')))['catch'](loggerCatch(_0x2203('0x1b5')));}else{_0x3f9801['saveInDb'](createObjHistory(_0x250403,_0x303dbb,_0x2203('0x1b6'),0x16,_0x2203('0x1b7')),'[Originate][HistoryRecallClose][historyCatch]',_0x2203('0x1b8'));}}}}else{_0x250403[_0x2203('0x57')]+=0x1;_0x3f9801[_0x2203('0xb7')](createObjHistory(_0x250403,_0x303dbb,_0x2203('0x1b9'),0xd,_0x2203('0x1ba')),_0x2203('0x1bb'),_0x2203('0x1bc'));throw'inBlackList';}};};Dialer[_0x2203('0x14')][_0x2203('0x12a')]=function(_0x3dc3e6){var _0x3e3ec6=this;var _0x3a7d68=[];var _0x29145d=_0x3dc3e6[_0x2203('0x1bd')]-_0x3dc3e6[_0x2203('0x6a')]-_0x3dc3e6[_0x2203('0x1be')];emitCampaignSummary(_0x3dc3e6);if(_0x29145d>0x0){if(_0x29145d>this[_0x2203('0x1d')]){_0x29145d=this['maxNumberOriginate'];}_0x3dc3e6[_0x2203('0x1be')]+=_0x29145d;this['getContactDialerIvr'](_0x3dc3e6['id'],_0x29145d,_0x3dc3e6[_0x2203('0x1bf')])[_0x2203('0xa0')](function(_0x16a194){_0x3dc3e6[_0x2203('0x1be')]-=_0x29145d;_0x3dc3e6[_0x2203('0x1be')]=_0x3dc3e6['temp']>0x0?_0x3dc3e6[_0x2203('0x1be')]:0x0;if(!checkContactEmpty(_0x16a194)){_0x3dc3e6[_0x2203('0x38')]=_0x2203('0x8a');logger[_0x2203('0x72')]('[getContactCampaign2][Empty]'+_0x3dc3e6['name']);}else{_0x3dc3e6[_0x2203('0x6a')]+=_0x16a194[_0x2203('0x84')];_0x3dc3e6[_0x2203('0x38')]='RUNNING';for(var _0xa87e75=0x0;_0xa87e75<_0x16a194['length'];_0xa87e75+=0x1){_0x3dc3e6['ivrTotalCallsDays']+=0x1;if(_[_0x2203('0x98')](_0x16a194[_0xa87e75])||_['isNil'](_0x16a194[_0xa87e75][_0x2203('0x139')])||_[_0x2203('0x98')](_0x16a194[_0xa87e75][_0x2203('0x139')][_0x2203('0x13a')])){_0x3e3ec6[_0x2203('0xb5')](_0x2203('0x1c0'),_0x3dc3e6,_0x16a194[_0xa87e75]);}else{_0x3e3ec6[_0x2203('0xa5')](_[_0x2203('0xb8')](_0x16a194[_0xa87e75],['CampaignId',_0x2203('0x1c1')]))['then'](_0x3e3ec6[_0x2203('0x1a7')](_0x3dc3e6,_0x16a194[_0xa87e75]))[_0x2203('0x9c')](_0x3e3ec6[_0x2203('0xb4')](_0x2203('0x1c2'),_0x3dc3e6));}}}})['catch'](loggerGetContactDialer('[getContactCampaign2]',_0x3dc3e6,_0x29145d));}};Dialer[_0x2203('0x14')][_0x2203('0x125')]=function(_0xa0061d,_0x1afd7d){var _0x25c546=this;var _0x3de7dd=[];var _0x2df884=_0x1afd7d>=0x1?_0x1afd7d:0x1;var _0x17951f=[];if(_0xa0061d[_0x2203('0x52')]==='booked'){_0x2df884=0x1;}var _0x21de25=Math[_0x2203('0x189')](_0xa0061d['available']*_0x2df884)-_0xa0061d[_0x2203('0x6a')]-_0xa0061d['temp'];emitVoiceQueueSummary(_0xa0061d);if(_0xa0061d[_0x2203('0x1c3')]>0x0){var _0x43d031=_0xa0061d['dialLimitQueue']-_0xa0061d[_0x2203('0x6a')]-_0xa0061d[_0x2203('0x4e')]-_0xa0061d[_0x2203('0x1be')]-_0xa0061d[_0x2203('0x4b')];if(_0x21de25>_0x43d031){_0x21de25=_0x43d031;}}if(_0x21de25>0x0){if(_0xa0061d[_0x2203('0x52')]===_0x2203('0x7')){_0x21de25=0x1;}if(_0x21de25>this[_0x2203('0x1d')]){_0x21de25=this[_0x2203('0x1d')];}_0xa0061d[_0x2203('0x1be')]+=_0x21de25;for(var _0x1927d8 in this[_0x2203('0x1b')]){if(this['agents']['hasOwnProperty'](_0x1927d8)){if(this['agents'][_0x1927d8]['state']===_0x2203('0x1c4')&&this['agents'][_0x1927d8][_0x2203('0x9a')]==='reachable'){_0x3de7dd[_0x2203('0xf7')](this[_0x2203('0x1b')][_0x1927d8]['id']);}}}this[_0x2203('0xad')](_0xa0061d['id'],_0x3de7dd,_0x21de25,_0xa0061d[_0x2203('0x1bf')])[_0x2203('0xa0')](function(_0x300920){_0xa0061d[_0x2203('0x1be')]-=_0x21de25;_0xa0061d['temp']=_0xa0061d['temp']>0x0?_0xa0061d[_0x2203('0x1be')]:0x0;if(!checkContactEmpty(_0x300920)){_0x25c546[_0x2203('0xa1')](_0xa0061d)['then'](sendMessageReschedule(_0xa0061d))[_0x2203('0x9c')](loggerCatch(_0x2203('0xa2')));}else{_0xa0061d[_0x2203('0x6a')]+=_0x300920[_0x2203('0x84')];_0xa0061d['message']=_0xa0061d[_0x2203('0x52')]==='booked'?_0x2203('0x141'):_0x2203('0x1c5');for(var _0x4cd28f=0x0;_0x4cd28f<_0x300920[_0x2203('0x84')];_0x4cd28f+=0x1){if(_[_0x2203('0x98')](_0x300920[_0x4cd28f])||_[_0x2203('0x98')](_0x300920[_0x4cd28f]['Contact'])||_[_0x2203('0x98')](_0x300920[_0x4cd28f][_0x2203('0x139')][_0x2203('0x13a')])){_0x25c546[_0x2203('0xb5')](_0x2203('0x1c0'),_0xa0061d,_0x300920[_0x4cd28f]);}else{_0x25c546[_0x2203('0xa3')](_[_0x2203('0xb8')](_0x300920[_0x4cd28f],[_0x2203('0xbb'),'Contact.phone']))['then'](_0x25c546[_0x2203('0x1a7')](_0xa0061d,_0x300920[_0x4cd28f]))[_0x2203('0x9c')](_0x25c546[_0x2203('0xb4')](_0x2203('0x1c0'),_0xa0061d));}}}})[_0x2203('0x9c')](loggerGetContactDialer(_0x2203('0x1c6'),_0xa0061d,_0x21de25));}};Dialer[_0x2203('0x14')]['handlePredictive']=function(_0x21ca92){var _0x38368a=this;if(_0x21ca92[_0x2203('0x1c3')]>0x0){var _0x2f1b7b=_0x21ca92[_0x2203('0x1c3')]-_0x21ca92['originated']-_0x21ca92['talking'];if(_0x2f1b7b>0x0){this['tryOriginatePredictive'](_0x21ca92);}else{loggerPredictiveCalls['info'](_0x2203('0x1c7'));}}else{this['tryOriginatePredictive'](_0x21ca92);}};Dialer[_0x2203('0x14')]['tryOriginatePredictive']=function(_0x5783d7){var _0x527323=this;var _0x2be883=[];_0x5783d7[_0x2203('0x6a')]+=0x1;for(var _0x39c512 in this[_0x2203('0x1b')]){if(this[_0x2203('0x1b')][_0x2203('0x97')](_0x39c512)){if(this[_0x2203('0x1b')][_0x39c512][_0x2203('0xcb')]===_0x2203('0x1c4')&&this['agents'][_0x39c512][_0x2203('0x9a')]===_0x2203('0xc3')){_0x2be883['push'](this['agents'][_0x39c512]['id']);}}}this['getContactDialer'](_0x5783d7['id'],_0x2be883,0x1,_0x5783d7[_0x2203('0x1bf')])['then'](function(_0x5cab78){if(!checkContactEmpty(_0x5cab78)){checkContactLowerLimitOriginate(_0x5783d7,0x1,0x0);_0x527323['countReScheduled'](_0x5783d7)[_0x2203('0xa0')](sendMessageReschedule(_0x5783d7))[_0x2203('0x9c')](loggerCatch(_0x2203('0xa2')));}else{_0x5783d7['message']=_0x2203('0x1c5');if(_[_0x2203('0x98')](_0x5cab78[0x0])||_['isNil'](_0x5cab78[0x0][_0x2203('0x139')])||_[_0x2203('0x98')](_0x5cab78[0x0][_0x2203('0x139')][_0x2203('0x13a')])){_0x527323[_0x2203('0xb5')](_0x2203('0x1c0'),_0x5783d7,_0x5cab78[0x0]);}else{_0x527323['checkIsBlackList'](_[_0x2203('0xb8')](_0x5cab78[0x0],[_0x2203('0xbb'),_0x2203('0x1c1')]))[_0x2203('0xa0')](_0x527323[_0x2203('0x1a7')](_0x5783d7,_0x5cab78[0x0]))[_0x2203('0x9c')](_0x527323[_0x2203('0xb4')](_0x2203('0x1c8'),_0x5783d7));}}})[_0x2203('0x9c')](loggerGetContactDialer('[getContactDialerPredictive]',_0x5783d7,0x1));emitVoiceQueueSummary(_0x5783d7);};Dialer['prototype']['abandonmentRate']=function(_0xd9c935,_0x4300b5,_0x35f453,_0x41e108,_0x3a69d8,_0x271ec4){loggerPredictive[_0x2203('0x72')](_0x2203('0x1c9'),_0x2203('0x1ca'),_0xd9c935,'\x20interval\x20=\x20',_0x4300b5,_0x2203('0x1cb'),_0x35f453,_0x2203('0x1cc'),_0x41e108,_0x2203('0x1cd'),_0x3a69d8);return new BPromise(function(_0x61d4c,_0x23b7c1){if(_0xd9c935<=0x0||isNaN(_0xd9c935)){return _0x23b7c1(msgResponse('[abandonmentRate]','Error',_0x2203('0x1ce')+_0xd9c935));}if(_0x35f453<=0x0||isNaN(_0x35f453)){return _0x23b7c1(msgResponse(_0x2203('0x1c9'),_0x2203('0x41'),_0x2203('0x1cf')+_0x35f453));}if(_0x41e108<=0x0||isNaN(_0x41e108)){return _0x23b7c1(msgResponse('[abandonmentRate]',_0x2203('0x41'),_0x2203('0x1d0')+_0x41e108));}if(_0x4300b5<=0x0||isNaN(_0x4300b5)){return _0x23b7c1(msgResponse('[abandonmentRate]','Error','interval\x20=\x20'+_0x4300b5));}if(_0x3a69d8<=0x0||isNaN(_0x3a69d8)){return _0x23b7c1(msgResponse(_0x2203('0x1c9'),'Error',_0x2203('0x1d1')+_0x3a69d8));}_0x271ec4=_0x271ec4||0x0;var _0x5b4998=0x1/_0x35f453;var _0x402e60=0x0;var _0x3d159e=0x0;var _0x2766de=0x0;var _0x81343c=0x0;for(var _0x45b5d9=0x0;_0x2766de<_0x3a69d8;_0x45b5d9+=0x1){_0x3d159e=_0x45b5d9/_0x4300b5;_0x402e60=(_0x41e108*_0x3d159e+_0x271ec4)/_0x5b4998;_0x2766de=erlangb(_0x402e60,_0xd9c935);_0x81343c=_0x402e60/_0xd9c935*(0x1-erlangb(_0x402e60,_0xd9c935));}return _0x61d4c({'erlangCalls':_0x45b5d9,'erlangCallToSecond':_0x4300b5/_0x45b5d9,'erlangAbandonmentRate':_0x2766de,'erlangBusyFactor':_0x81343c});});};Dialer[_0x2203('0x14')][_0x2203('0x1a1')]=function(_0x1f32aa,_0x4b2655,_0x2c72b7,_0x38a1f0,_0x1e07e1,_0xd2ddb3){loggerPredictive[_0x2203('0x72')](_0x2203('0x1d2'),'\x20m\x20=\x20',_0x1f32aa,_0x2203('0x1d3'),_0x4b2655,'\x20Ts\x20=\x20',_0x2c72b7,_0x2203('0x1cc'),_0x38a1f0,_0x2203('0x1d4'),_0x1e07e1);return new BPromise(function(_0x575cf9,_0x48c929){if(_0x1f32aa<=0x0||isNaN(_0x1f32aa)){return _0x48c929(msgResponse('[abandonmentRate]',_0x2203('0x41'),'m\x20=\x20'+_0x1f32aa));}if(_0x2c72b7<=0x0||isNaN(_0x2c72b7)){return _0x48c929(msgResponse(_0x2203('0x1c9'),'Error','Ts\x20=\x20'+_0x2c72b7));}if(_0x38a1f0<=0x0||isNaN(_0x38a1f0)){return _0x48c929(msgResponse(_0x2203('0x1c9'),_0x2203('0x41'),'p\x20=\x20'+_0x38a1f0));}if(_0x4b2655<=0x0||isNaN(_0x4b2655)){return _0x48c929(msgResponse('[abandonmentRate]',_0x2203('0x41'),_0x2203('0x1d5')+_0x4b2655));}if(_0x1e07e1<=0x0||isNaN(_0x1e07e1)){return _0x48c929(msgResponse('[abandonmentRate]',_0x2203('0x41'),_0x2203('0x1d1')+_0x1e07e1));}_0xd2ddb3=_0xd2ddb3||0x0;var _0x5d4613=0x1/_0x2c72b7;var _0x563497=0x0;var _0x1bd377=0x0;var _0x244a1f=0x0;var _0x5d2982=0x0;for(var _0xfb6418=0x0;_0x5d2982<_0x1e07e1;_0xfb6418+=0x1){_0x1bd377=_0xfb6418/_0x4b2655;_0x563497=(_0x38a1f0*_0x1bd377+_0xd2ddb3)/_0x5d4613;_0x244a1f=erlangb(_0x563497,_0x1f32aa);_0x5d2982=_0x563497/_0x1f32aa*(0x1-erlangb(_0x563497,_0x1f32aa));}return _0x575cf9({'erlangCalls':_0xfb6418,'erlangCallToSecond':_0x4b2655/_0xfb6418,'erlangAbandonmentRate':_0x244a1f,'erlangBusyFactor':_0x5d2982});});};module[_0x2203('0x1d6')]=Dialer; \ No newline at end of file +var _0x955f=['\x20Amax\x20=\x20','Error','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','[busyFactor]','\x20Umin\x20=\x20','Amax\x20=\x20','exports','util','lodash','bluebird','uuid','moment','ioredis','dialer','booked','../../../config/logger','predictive','predictiveCalls','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./final','./queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','syncQueueSummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopClearZombieChannels','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','[ifTime][Action]','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalLowerLimit','predictiveIntervalMultiplicativeFactor','originated','Trunk','md5','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','predictiveIntervalTotalCalls','predictiveIntervalAvgHoldtime','info','[checkGetDataPredictive][totalCalls]','[checkGetDataPredictive][objIsEmpty]','[checkGetDataPredictive][obj]','[ErlangB]','merge','startProgressive','[freeVariablesPredictive]','handlePredictive','string','isEmpty','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','length','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','isNil','Action','channel','No\x20such\x20channel','queue','updateOriginated','countReScheduled','resolve','catch','checkIsBlackList','then','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','rescheduleContact','[rescheduleContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','hasOwnProperty','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact]','isSuccess','Success','isTrunkReachable','active','SIP/%s','reachable','status','unmonitored','saveInDb','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','HangupInAMD','membername','[syncHangupInAMD]','MACHINE','Machine','[syncMachine][createHistory]','AMD','[syncHangupInAMDIvr][createHistory]','amd','[syncMachineIvr][createHistory]','[syncMachineIvr]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','Unknow','reason','agiafterat','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','YYYY-MM-DD\x20HH:mm:ss','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','dialQueueProject2','CALLEREXIT','actionid','stateinterface','locked','queueBooked','pick','idHopper','paused','queueStatusComplete','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','syncCampaigns','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','push','command','iftime\x20%s,%s','interval','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','handlePower','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','Contact','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueTimeout','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','%s%s','toUpper','dialRandomLastDigitCallerIdNumber','callerid','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','responsetime','response','[callProgressDetecting]\x20','countbusyretry','dialGlobalMaxRetry','dialNoAnswerMaxRetry','countnoanswerretry','add','dialNoAnswerRetryFrequency','minutes','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','countcongestionretry','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','callProgressDetecting','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','[syncAgentComplete][createHistory][0]','checkRetriveMax','stateGlobal','reason\x200\x20no\x20such\x20number....','createStateFinal','NoAnswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','countglobal','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalPauses','floor','erlangAbandonmentRate','[startMethodPredictive][StartProgressive][First]','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','Agent\x20free','agent\x20max\x20free\x20','predictiveIntervalErlangCallsDroppedCalls','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','[startMethodPredictive][StartPredictive][First]','averageHandleTime','dialPredictiveInterval','getDataPredictive','startMethodPredictive','[averageHandleTime][ErlangB]\x20','[startMethodPredictive][StartPredictive][Repeat]','outboundQueuePauses','abandonmentRate','agentBusyFactor','busyFactor','[CatchErlangB]','check\x20failure','erlangCallToSecond','[startMethodPredictive]','[startMethodPredictive][milliseconds]\x20','Failure\x20','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','BLACKLIST','[Originate][historyBlacklist]','inBlackList','temp','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','dialLimitQueue','talking','not_inuse','dialOrderByScheduledAt','[countReScheduled]\x20','tryOriginatePredictive','[handlePredictive][limitChannel]','[getContactDialerPredictive]','[abandonmentRate]','\x20m\x20=\x20','\x20interval\x20=\x20','\x20Ts\x20=\x20','\x20p\x20=\x20'];(function(_0x2002b3,_0x11e91c){var _0x2756f0=function(_0x4bf0b3){while(--_0x4bf0b3){_0x2002b3['push'](_0x2002b3['shift']());}};_0x2756f0(++_0x11e91c);}(_0x955f,0x1eb));var _0xf955=function(_0x4ff92a,_0x35a582){_0x4ff92a=_0x4ff92a-0x0;var _0x53a3d7=_0x955f[_0x4ff92a];return _0x53a3d7;};'use strict';var util=require(_0xf955('0x0'));var _=require(_0xf955('0x1'));var BPromise=require(_0xf955('0x2'));var uuid=require(_0xf955('0x3'));var moment=require(_0xf955('0x4'));var rr=require('rr');var md5=require('md5');var Redis=require(_0xf955('0x5'));var config=require('../../../config/environment/');var logger=require('../../../config/logger')(_0xf955('0x6'));var loggerBooked=require('../../../config/logger')(_0xf955('0x7'));var loggerPredictive=require(_0xf955('0x8'))(_0xf955('0x9'));var loggerPredictiveCalls=require('../../../config/logger')(_0xf955('0xa'));var loggerSyncQueueSummary=require(_0xf955('0x8'))('syncQueueSummary');var ami=require(_0xf955('0xb'));config[_0xf955('0xc')]=_[_0xf955('0xd')](config[_0xf955('0xc')],{'host':_0xf955('0xe'),'port':0x18eb});var io=require(_0xf955('0xf'))(new Redis(config[_0xf955('0xc')]));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0xf955('0x10'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xf955('0x11'));var voiceQueueRt=require(_0xf955('0x12'));var Action=require(_0xf955('0x13'));var History=require('./history');var Final=require(_0xf955('0x14'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0xf955('0x15'));var Hangup=require('./hangup');var ipAgi=process[_0xf955('0x16')][_0xf955('0x17')]||_0xf955('0x18');var strategy={'rrmemory':_0xf955('0x19'),'roundrobin':_0xf955('0x1a')};var Sequence=function(){};Sequence[_0xf955('0x1b')][_0xf955('0x1c')]=function(_0x2783f2){this[_0xf955('0x1d')]=this[_0xf955('0x1d')]?this['tail'][_0xf955('0x1e')](_0x2783f2):_0x2783f2();};function Dialer(_0x54e60b,_0x3139d5){this[_0xf955('0x1f')]=new Sequence();this[_0xf955('0x20')]=_0x3139d5;this[_0xf955('0x21')]=_0x54e60b['voiceQueues'];this['campaigns']=_0x54e60b[_0xf955('0x22')];this[_0xf955('0x23')]=_0x54e60b[_0xf955('0x23')];this['trunks']=_0x54e60b[_0xf955('0x24')];this[_0xf955('0x25')]=config[_0xf955('0x25')]||0x2;this[_0xf955('0x26')]={};this[_0xf955('0x27')]={};this['contactsId']={};this[_0xf955('0x28')]={};this[_0xf955('0x29')]={};this[_0xf955('0x2a')]={};this['startProgressive']={};this[_0xf955('0x2b')]={};this['queueBooked']={};this[_0xf955('0x2c')]={};ami['on'](_0xf955('0x2d'),this[_0xf955('0x2e')][_0xf955('0x2f')](this));ami['on'](_0xf955('0x30'),this['syncQueueCallerAbandon'][_0xf955('0x2f')](this));ami['on'](_0xf955('0x31'),this[_0xf955('0x32')][_0xf955('0x2f')](this));ami['on'](_0xf955('0x33'),this[_0xf955('0x34')][_0xf955('0x2f')](this));ami['on']('custom:queuesummary',this[_0xf955('0x35')][_0xf955('0x2f')](this));ami['on'](_0xf955('0x36'),this[_0xf955('0x37')][_0xf955('0x2f')](this));ami['on'](_0xf955('0x38'),this[_0xf955('0x39')]['bind'](this));ami['on'](_0xf955('0x3a'),this[_0xf955('0x3b')][_0xf955('0x2f')](this));ami['on'](_0xf955('0x3c'),this[_0xf955('0x3d')][_0xf955('0x2f')](this));ami['on']('queuestatuscomplete',this[_0xf955('0x3e')][_0xf955('0x2f')](this));this['loopCampaigns']();this[_0xf955('0x3f')]();}function isNotNull(_0x2c8df1){return _0x2c8df1!==null&&!_[_0xf955('0x40')](_0x2c8df1);}function checkIsLoggedIn(_0x1ef794,_0x59bfb5){return function(){if(_0x59bfb5<=0x0){_0x1ef794[_0xf955('0x41')]='AGENTS_NOT_LOGGED';throw _0x1ef794[_0xf955('0x42')]+_0xf955('0x43');}};}function isActive(_0x44eacf){return _0x44eacf;}function checkIsActive(_0x4069fe,_0x1e8024){return function(){if(!isActive(_0x1e8024)){_0x4069fe[_0xf955('0x41')]=_0xf955('0x44');throw _0x4069fe[_0xf955('0x42')]+'\x20NOT\x20Active';}};}function checkInterval(_0x45e913){return function(){if(!isNotNull(_0x45e913[_0xf955('0x45')])){_0x45e913[_0xf955('0x41')]=_0xf955('0x46');throw _0x45e913['name']+_0xf955('0x47');}if(!isNotNull(_0x45e913[_0xf955('0x45')][_0xf955('0x48')])){_0x45e913[_0xf955('0x41')]=_0xf955('0x46');throw _0x45e913['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0x45e913[_0xf955('0x45')][_0xf955('0x48')]))){_0x45e913[_0xf955('0x41')]=_0xf955('0x46');throw _0x45e913[_0xf955('0x42')]+_0xf955('0x47');}};}function msgResponse(_0x5acb00,_0x3acc4b,_0x515dc6){return{'action':_0x5acb00,'response':_0x3acc4b,'message':_0x515dc6};}function myreject(_0x8f842f){return function(_0x2371e4){return _0x8f842f(msgResponse(_0xf955('0x49'),'Error',JSON[_0xf955('0x4a')](_0x2371e4)));};}function getSeconds(_0x4bef80,_0x2bc1a0){var _0x40edaf=moment(_0x4bef80)[_0xf955('0x4b')](0x0);var _0x45b78d=moment(_0x2bc1a0)['milliseconds'](0x0);return _0x40edaf[_0xf955('0x4c')](_0x45b78d,_0xf955('0x4d'));}function emit(_0x5a48be,_0x430e12,_0x460aa7){io['to'](_0x5a48be)[_0xf955('0x4e')](_0x430e12,_0x460aa7);}function emitVoiceQueueSummary(_0x547ed9){if(_0x547ed9[_0xf955('0x4f')]===_0xf955('0x50')){var _0x11b7e2={'id':_0x547ed9['id'],'name':_0x547ed9['name'],'strategy':_0x547ed9[_0xf955('0x51')],'answered':_0x547ed9[_0xf955('0x52')],'available':_0x547ed9[_0xf955('0x53')],'loggedIn':_0x547ed9[_0xf955('0x54')],'pTalking':_0x547ed9[_0xf955('0x55')],'sumBillable':_0x547ed9[_0xf955('0x56')],'sumDuration':_0x547ed9[_0xf955('0x57')],'sumHoldTime':_0x547ed9[_0xf955('0x58')]||0x0,'talking':_0x547ed9['talking'],'total':_0x547ed9[_0xf955('0x59')],'type':_0x547ed9[_0xf955('0x4f')],'unmanaged':_0x547ed9[_0xf955('0x5a')],'abandoned':_0x547ed9[_0xf955('0x5b')],'waiting':_0x547ed9[_0xf955('0x5c')],'loggedInDb':_0x547ed9[_0xf955('0x5d')],'dialActive':_0x547ed9[_0xf955('0x5e')],'dialMethod':_0x547ed9[_0xf955('0x5f')],'dialOriginateCallerIdName':_0x547ed9[_0xf955('0x60')],'dialOriginateCallerIdNumber':_0x547ed9[_0xf955('0x61')],'dialOriginateTimeout':_0x547ed9[_0xf955('0x62')],'dialPrefix':_0x547ed9[_0xf955('0x63')],'outboundAnswerAgiCallsDay':_0x547ed9[_0xf955('0x64')],'outboundAnswerCallsDay':_0x547ed9[_0xf955('0x65')],'outboundBlacklistCallsDay':_0x547ed9[_0xf955('0x66')],'outboundBusyCallsDay':_0x547ed9[_0xf955('0x67')],'outboundCongestionCallsDay':_0x547ed9[_0xf955('0x68')],'outboundDropCallsDayACS':_0x547ed9[_0xf955('0x69')],'outboundDropCallsDayCallersExit':_0x547ed9[_0xf955('0x6a')],'outboundDropCallsDayTimeout':_0x547ed9['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x547ed9[_0xf955('0x6b')],'outboundNoSuchCallsDay':_0x547ed9[_0xf955('0x6c')],'outboundOriginateFailureCallsDay':_0x547ed9[_0xf955('0x6d')],'outboundReCallsDay':_0x547ed9['outboundReCallsDay'],'outboundRejectCallsDay':_0x547ed9[_0xf955('0x6e')],'outboundUnknownCallsDay':_0x547ed9['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x547ed9[_0xf955('0x6f')],'predictiveIntervalAvgHoldtime':_0x547ed9['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x547ed9[_0xf955('0x70')],'predictiveIntervalDroppedCallsCallersExit':_0x547ed9[_0xf955('0x71')],'predictiveIntervalDroppedCallsTimeout':_0x547ed9[_0xf955('0x72')],'predictiveIntervalErlangCalls':_0x547ed9[_0xf955('0x73')],'predictiveIntervalErlangCallsDroppedCalls':_0x547ed9['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x547ed9[_0xf955('0x74')],'predictiveIntervalLowerLimit':_0x547ed9[_0xf955('0x75')],'predictiveIntervalMultiplicativeFactor':_0x547ed9[_0xf955('0x76')],'predictiveIntervalPauses':_0x547ed9['predictiveIntervalPauses'],'predictiveIntervalTotalCalls':_0x547ed9['predictiveIntervalTotalCalls'],'message':_0x547ed9[_0xf955('0x41')],'originated':_0x547ed9[_0xf955('0x77')]};if(_0x547ed9[_0xf955('0x78')]){_0x11b7e2[_0xf955('0x78')]={'id':_0x547ed9['Trunk']['id'],'name':_0x547ed9[_0xf955('0x78')][_0xf955('0x42')],'active':_0x547ed9[_0xf955('0x78')]['active'],'callerid':_0x547ed9[_0xf955('0x78')]['callerid']};}if(_0x547ed9[_0xf955('0x45')]){_0x11b7e2[_0xf955('0x45')]={'id':_0x547ed9[_0xf955('0x45')]['id'],'name':_0x547ed9['Interval'][_0xf955('0x42')]};}var _0x3c8634=md5(JSON[_0xf955('0x4a')](_0x11b7e2));if(_0x547ed9[_0xf955('0x79')]!==_0x3c8634){_0x547ed9['md5']=_0x3c8634;emit(util[_0xf955('0x7a')](_0xf955('0x7b'),_0x11b7e2[_0xf955('0x42')]),_0xf955('0x7c'),_0x11b7e2);}}}function emitCampaignSummary(_0x2c992c){if(_0x2c992c['type']===_0xf955('0x7d')){emit(util['format'](_0xf955('0x7e'),_0x2c992c['name']),_0xf955('0x7f'),_0x2c992c);}}function checkGetDataPredictive(_0x55e625){if(isNotNull(_0x55e625)){if(!_['isEmpty'](_0x55e625)){if(_0x55e625[_0xf955('0x80')]>0x0){if(!_[_0xf955('0x40')](_0x55e625['predictiveIntervalAvgTalktime'])&&_0x55e625[_0xf955('0x70')]>0x0){return!![];}else{loggerPredictive['info']('[checkGetDataPredictive][avgTalktime]',JSON['stringify'](_0x55e625));}if(!_['isUndefined'](_0x55e625[_0xf955('0x81')])&&_0x55e625[_0xf955('0x81')]>0x0){return!![];}else{loggerPredictive['info']('[checkGetDataPredictive][avgHoldtime]',JSON[_0xf955('0x4a')](_0x55e625));}}else{loggerPredictive[_0xf955('0x82')](_0xf955('0x83'),JSON[_0xf955('0x4a')](_0x55e625));}}else{loggerPredictive[_0xf955('0x82')](_0xf955('0x84'),JSON[_0xf955('0x4a')](_0x55e625));}}else{loggerPredictive[_0xf955('0x82')](_0xf955('0x85'),JSON[_0xf955('0x4a')](_0x55e625));}return![];}function mergeDataErlangB(_0x1b7b73){return function(_0x350873){loggerPredictive['info'](_0xf955('0x86'),JSON[_0xf955('0x4a')](_0x350873));_[_0xf955('0x87')](_0x1b7b73,_0x350873);};}function getDiff(_0x24322a){var _0x3242fe=moment()['milliseconds'](0x0);var _0xf5d575=moment(_0x24322a)[_0xf955('0x4b')](0x0);return _0x3242fe[_0xf955('0x4c')](_0xf5d575,_0xf955('0x4d'));}function ifInterval(_0x1e0ef0,_0x9057df){if(_[_0xf955('0x40')](_0x9057df)){return![];}if(getDiff(_0x9057df)<_0x1e0ef0*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x60c8a2){if(isNotNull(_0x60c8a2)){if(!_[_0xf955('0x40')](_0x60c8a2[_0xf955('0x88')])){_0x60c8a2['startProgressive']=undefined;loggerPredictive[_0xf955('0x82')](_0xf955('0x89'),_0xf955('0x88'),_0x60c8a2[_0xf955('0x42')]);}if(!_[_0xf955('0x40')](_0x60c8a2[_0xf955('0x2a')])){_0x60c8a2[_0xf955('0x2a')]=undefined;loggerPredictive[_0xf955('0x82')](_0xf955('0x89'),_0xf955('0x2a'),_0x60c8a2[_0xf955('0x42')]);}if(!_[_0xf955('0x40')](_0x60c8a2['handlePredictive'])){clearInterval(_0x60c8a2[_0xf955('0x8a')]);_0x60c8a2[_0xf955('0x8a')]=undefined;loggerPredictive[_0xf955('0x82')](_0xf955('0x89'),_0xf955('0x8a'),_0x60c8a2[_0xf955('0x42')]);}}}function erlangb(_0x1c4e2d,_0x50e16c){if(_0x50e16c===0x0){return 0x0;}var _0x5301bb=0x1;for(var _0x5e73ff=0x1;_0x5e73ff<=_0x50e16c;_0x5e73ff+=0x1){_0x5301bb=0x1+_0x5301bb*_0x5e73ff/_0x1c4e2d;}return 0x1/_0x5301bb;}function isVoiceQueueOutbound(_0x13c711){return _0x13c711==='outbound';}function isNotPreview(_0x570b6a){return _0x570b6a!==_0xf955('0x20');}function isCampaignIvr(_0x533e0f){return _0x533e0f===_0xf955('0x7d');}function getCallerId(_0x3fa5b5,_0x158469,_0x30cb80){if(!_['isUndefined'](_0x30cb80)&&_0xf955('0x8b')===typeof _0x30cb80&&!_[_0xf955('0x8c')](_0x30cb80)){if(!_[_0xf955('0x40')](_0x158469)&&_0xf955('0x8b')===typeof _0x158469&&!_[_0xf955('0x8c')](_0x158469)){return util['format'](_0xf955('0x8d'),_0x158469,_0x30cb80);}return util['format'](_0xf955('0x8d'),_0x30cb80,_0x30cb80);}if(!_[_0xf955('0x40')](_0x3fa5b5)&&_0xf955('0x8b')===typeof _0x3fa5b5&&!_['isEmpty'](_0x3fa5b5)){return _0x3fa5b5;}return _0xf955('0x8e');}function loggerCatchQueueSummary(_0x40ca54,_0x16831f){return function(_0x379aa){freeVariablesPredictive(_0x16831f);emitVoiceQueueSummary(_0x16831f);emitCampaignSummary(_0x16831f);loggerSyncQueueSummary[_0xf955('0x8f')](_0x40ca54,util[_0xf955('0x90')](_0x379aa,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x3761f2,_0x47e5de){return function(_0x5f2d6c){loggerPredictive[_0xf955('0x8f')](_0x3761f2,JSON[_0xf955('0x4a')](_0x5f2d6c));freeVariablesPredictive(_0x47e5de);};}function loggerCatch(_0x3390f3){return function(_0x3f0873){logger[_0xf955('0x8f')](_0x3390f3,util[_0xf955('0x90')](_0x3f0873,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x52803a){return _0x52803a&&!_[_0xf955('0x40')](_0x52803a)&&_0x52803a[_0xf955('0x91')]>0x0;}function decremetOriginate(_0x2d20af){if(!_[_0xf955('0x40')](_0x2d20af)&&_0x2d20af!==null){if(_0x2d20af['hasOwnProperty'](_0xf955('0x77'))){if(_0x2d20af['originated']>0x0){_0x2d20af[_0xf955('0x77')]-=0x1;}else{logger['error']('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xf955('0x8f')](_0xf955('0x92'));}}function checkContactLowerLimitOriginate(_0x51c8a4,_0x1e95c3,_0x28e662){if(_0x1e95c3>_0x28e662){for(var _0x5e8f86=0x0;_0x5e8f86<_0x1e95c3-_0x28e662;_0x5e8f86+=0x1){decremetOriginate(_0x51c8a4);}}}function loggerGetContactDialer(_0x50b722,_0x1e418,_0xdf351a){return function(_0x46f0e2){checkContactLowerLimitOriginate(_0x1e418,_0xdf351a,0x0);logger['error'](_0x50b722,util[_0xf955('0x90')](_0x46f0e2,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x29763d){return function(_0x32ce33){if(isNotNull(_0x32ce33)&&isNotNull(_0x32ce33[0x0])){if(_0x32ce33[0x0][_0xf955('0x93')]>0x0){_0x29763d[_0xf955('0x41')]=_0xf955('0x94');logger[_0xf955('0x82')](_0xf955('0x95')+_0x29763d['name'],_0x32ce33[0x0][_0xf955('0x93')],_0xf955('0x96'));}else{_0x29763d['message']=_0xf955('0x97');logger[_0xf955('0x82')](_0xf955('0x98')+_0x29763d[_0xf955('0x42')]);}}};}function notSendMessagesQueue(_0x4e0e3f){if(_0x4e0e3f[_0xf955('0x99')]){freeVariablesPredictive(_0x4e0e3f);if(_0x4e0e3f[_0xf955('0x77')]===0x0&&_0x4e0e3f['talking']===0x0&&_0x4e0e3f['waiting']===0x0&&(_0x4e0e3f[_0xf955('0x55')]||0x0)===0x0){_0x4e0e3f[_0xf955('0x99')]=![];_0x4e0e3f[_0xf955('0x53')]=0x0;_0x4e0e3f[_0xf955('0x41')]='NOT_ACTIVE';loggerSyncQueueSummary[_0xf955('0x8f')](_0xf955('0x9a'),_0x4e0e3f[_0xf955('0x42')],_0xf955('0x9b'));}else{_0x4e0e3f[_0xf955('0x41')]=_0xf955('0x9c');loggerSyncQueueSummary[_0xf955('0x8f')](_0xf955('0x9a'),_0x4e0e3f[_0xf955('0x42')],_0xf955('0x9d'));}emitVoiceQueueSummary(_0x4e0e3f);}}function notSendMessagesCampaign(_0x2c7ba5){if(_0x2c7ba5[_0xf955('0x99')]){if(_0x2c7ba5[_0xf955('0x77')]===0x0){_0x2c7ba5['sendMessageOneNotActive']=![];_0x2c7ba5[_0xf955('0x41')]=_0xf955('0x44');loggerSyncQueueSummary[_0xf955('0x8f')](_0xf955('0x9e'),_0x2c7ba5['name'],_0xf955('0x9b'));}else{_0x2c7ba5[_0xf955('0x41')]=_0xf955('0x9c');loggerSyncQueueSummary[_0xf955('0x8f')](_0xf955('0x9e'),_0x2c7ba5[_0xf955('0x42')],_0xf955('0x9d'));}emitCampaignSummary(_0x2c7ba5);}}function createObjHistory(_0x46a692,_0x52a73c,_0xeaa3b7,_0x2893ae,_0x57426b){_0x46a692[_0xf955('0x41')]=_0xeaa3b7;var _0x1c8c8a=new Action(_0x46a692,_0x52a73c);var _0x26ba0b=new History(_0x1c8c8a);_0x26ba0b[_0xf955('0x9f')]=_0x2893ae;_0x26ba0b[_0xf955('0xa0')]=_0x57426b;_0x26ba0b[_0xf955('0xa1')]=_0x1c8c8a[_0xf955('0xa2')];return _0x26ba0b;}Dialer['prototype'][_0xf955('0x3f')]=function(){var _0x503749=this;setInterval(function(){_0x503749[_0xf955('0xa3')](_0x503749['uniqueId'],_0xf955('0xa4'));_0x503749[_0xf955('0xa3')](_0x503749[_0xf955('0x27')],_0xf955('0xa5'));},0x32c8);};Dialer[_0xf955('0x1b')][_0xf955('0xa3')]=function(_0x4d0f28,_0x1e8926){var _0x2b0c75=this;for(var _0xf9ec26 in _0x4d0f28){if(_0x4d0f28['hasOwnProperty'](_0xf9ec26)){this['sequence'][_0xf955('0x1c')](function(){if(!_[_0xf955('0xa6')](_0x4d0f28[_0xf9ec26])){return ami[_0xf955('0xa7')]({'action':'status','channel':_0x4d0f28[_0xf9ec26][_0xf955('0xa8')]})['catch'](function(_0x36c23e){if(_0x36c23e['message']===_0xf955('0xa9')){setTimeout(function(){if(_0x4d0f28[_0xf9ec26]&&_0x4d0f28[_0xf9ec26][_0xf955('0x4f')]!==_0xf955('0x7d')){_0x2b0c75['updateOriginated'](_0x2b0c75[_0xf955('0x21')][_0x4d0f28[_0xf9ec26][_0xf955('0xaa')]]);logger[_0xf955('0x8f')]('[Dialer][checkChannel]',_0x1e8926,_0xf9ec26,_0x4d0f28[_0xf9ec26][_0xf955('0xaa')]);delete _0x4d0f28[_0xf9ec26];}if(_0x4d0f28[_0xf9ec26]&&_0x4d0f28[_0xf9ec26][_0xf955('0x4f')]===_0xf955('0x7d')){_0x2b0c75[_0xf955('0xab')](_0x2b0c75[_0xf955('0x22')][_0x4d0f28[_0xf9ec26][_0xf955('0xaa')]]);logger[_0xf955('0x8f')]('[Dialer][checkChannel][ivr]',_0x1e8926,_0xf9ec26,_0x4d0f28[_0xf9ec26][_0xf955('0xaa')]);delete _0x4d0f28[_0xf9ec26];}},0x2328);}});}});}}};Dialer[_0xf955('0x1b')][_0xf955('0xac')]=function(_0x347078){return BPromise[_0xf955('0xad')]()['then'](cmHopper[_0xf955('0xac')](_0x347078))[_0xf955('0xae')](loggerCatch('[countReScheduled]\x20'));};Dialer['prototype'][_0xf955('0xaf')]=function(_0x405bb8){return BPromise[_0xf955('0xad')]()[_0xf955('0xb0')](cmHopperBlack['checkIsBlackList'](_0x405bb8))[_0xf955('0xae')](loggerCatch('[checkIsBlackList]\x20'));};Dialer['prototype'][_0xf955('0xb1')]=function(_0x272f30){return BPromise['resolve']()['then'](cmHopperBlack[_0xf955('0xb1')](_0x272f30))[_0xf955('0xae')](loggerCatch(_0xf955('0xb2')));};Dialer['prototype']['averageHandleTime']=function(_0x406366){return BPromise[_0xf955('0xad')]()[_0xf955('0xb0')](cmHopperHistory['avgHandleTime'](_0x406366))['catch'](loggerCatch('[averageHandleTime]\x20'));};Dialer['prototype'][_0xf955('0xb3')]=function(_0x567604){return BPromise[_0xf955('0xad')]()[_0xf955('0xb0')](cmHopper[_0xf955('0xb3')](_0x567604))[_0xf955('0xae')](loggerCatch(_0xf955('0xb4')));};Dialer['prototype'][_0xf955('0xb5')]=function(_0x1aea40,_0x1d9c48,_0x39b7b4,_0x571fbd){return BPromise[_0xf955('0xad')]()[_0xf955('0xb0')](cmHopper['getContactDialer'](_0x1aea40,_0x1d9c48,_0x39b7b4,_0x571fbd))[_0xf955('0xae')](loggerCatch(_0xf955('0xb6')));};Dialer[_0xf955('0x1b')][_0xf955('0xb7')]=function(_0x835b08,_0x3d83a9,_0x58080b){return BPromise['resolve']()[_0xf955('0xb0')](cmHopper['getContactDialerIvr'](_0x835b08,_0x3d83a9,_0x58080b))[_0xf955('0xae')](loggerCatch(_0xf955('0xb6')));};Dialer[_0xf955('0x1b')][_0xf955('0xb8')]=function(_0x550faf){return BPromise['resolve']()[_0xf955('0xb0')](voiceQueueRt[_0xf955('0xb8')](_0x550faf))[_0xf955('0xae')](loggerCatch(_0xf955('0xb9')));};Dialer[_0xf955('0x1b')]['moveContactManagedDialer']=function(_0x21f45e){return BPromise[_0xf955('0xad')]()[_0xf955('0xb0')](cmHopper[_0xf955('0xba')](_0x21f45e))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0xf955('0x1b')][_0xf955('0xbb')]=function(_0x568b39){return BPromise[_0xf955('0xad')]()[_0xf955('0xb0')](cmHopperHistory[_0xf955('0xbb')](_0x568b39))[_0xf955('0xae')](loggerCatch('[createHistory]\x20'));};Dialer[_0xf955('0x1b')][_0xf955('0xab')]=function(_0x34b879){if(!_[_0xf955('0x40')](_0x34b879)&&_0x34b879!==null){if(_0x34b879[_0xf955('0xbc')](_0xf955('0x77'))){if(_0x34b879[_0xf955('0x77')]>0x0){_0x34b879['originated']-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xf955('0x8f')](_0xf955('0xbd'));}};Dialer[_0xf955('0x1b')][_0xf955('0xbe')]=function(_0x1a672b,_0x35aa70){var _0x17e25c=this;return function(_0x4d4ede){_0x17e25c[_0xf955('0xab')](_0x35aa70);logger[_0xf955('0x8f')](_0x1a672b,util['inspect'](_0x4d4ede,{'showHidden':![],'depth':null}));};};Dialer[_0xf955('0x1b')][_0xf955('0xbf')]=function(_0x101655,_0x906f64,_0x1747ab){var _0x1eb23={'state':0x19,'statedesc':_0xf955('0xc0')};this[_0xf955('0xab')](_0x906f64);this['saveInDb'](_['merge'](_0x1eb23,_['pick'](_0x1747ab,[_0xf955('0xc1'),_0xf955('0xc2'),_0xf955('0xc3'),_0xf955('0xc4'),_0xf955('0xc5')])),'[emptyContact][createHistory]',_0xf955('0xc6'));logger[_0xf955('0x8f')](_0x101655);};Dialer[_0xf955('0x1b')][_0xf955('0xc7')]=function(_0x43e078){return _0x43e078===_0xf955('0xc8');};Dialer[_0xf955('0x1b')][_0xf955('0xc9')]=function(_0x226335){return!_['isUndefined'](_0x226335)&&_0x226335&&!_[_0xf955('0x40')](_0x226335['name'])&&!_[_0xf955('0x40')](_0x226335[_0xf955('0xca')])&&_0x226335[_0xf955('0xca')]&&(this[_0xf955('0x24')][util[_0xf955('0x7a')](_0xf955('0xcb'),_0x226335[_0xf955('0x42')])]['status']===_0xf955('0xcc')||this['trunks'][util[_0xf955('0x7a')](_0xf955('0xcb'),_0x226335['name'])][_0xf955('0xcd')]===_0xf955('0xce'));};Dialer[_0xf955('0x1b')][_0xf955('0xcf')]=function(_0x40920f,_0x541a22,_0xa0e929){this['createHistory'](_0x40920f)[_0xf955('0xae')](loggerCatch(_0x541a22));this[_0xf955('0xba')](_0x40920f)['catch'](loggerCatch(_0xa0e929));};Dialer[_0xf955('0x1b')][_0xf955('0x3b')]=function(_0x4bbba6){var _0x47d89d=this[_0xf955('0x28')][_0x4bbba6[_0xf955('0xd0')]];var _0x8b45aa;if(!_['isNil'](_0x4bbba6)&&!_[_0xf955('0xa6')](_0x4bbba6[_0xf955('0xd1')])&&!_[_0xf955('0xa6')](_0x4bbba6[_0xf955('0xd1')][_0xf955('0xd2')])&&_0x4bbba6[_0xf955('0xd3')]===_0xf955('0xd4')&&_0x47d89d){if(_0x47d89d[_0xf955('0x4f')]!==_0xf955('0x7d')&&this[_0xf955('0x21')][_0x47d89d[_0xf955('0xaa')]][_0xf955('0xd5')]&&_0x4bbba6[_0xf955('0xd6')]===_0xf955('0xd7')){delete this['uniqueId'][_0x4bbba6['uniqueid']];this[_0xf955('0xab')](this[_0xf955('0x21')][_0x47d89d[_0xf955('0xaa')]]);this[_0xf955('0x21')][_0x47d89d[_0xf955('0xaa')]]['outboundAnswerCallsDay']+=0x1;this[_0xf955('0x21')][_0x47d89d[_0xf955('0xaa')]]['outboundAnswerAgiCallsDay']+=0x1;_0x8b45aa=new Hangup(_0x47d89d,_0x4bbba6);_0x8b45aa[_0xf955('0x9f')]=0x12;_0x8b45aa[_0xf955('0xa0')]=_0xf955('0xd8');_0x8b45aa[_0xf955('0xd9')]='AMD';this[_0xf955('0xcf')](_0x8b45aa,'[syncHangupInAMD][createHistory]',_0xf955('0xda'));}if(_0x47d89d[_0xf955('0x4f')]!==_0xf955('0x7d')&&this[_0xf955('0x21')][_0x47d89d['queue']][_0xf955('0xd5')]&&_0x4bbba6[_0xf955('0xd6')]===_0xf955('0xdb')){delete this[_0xf955('0x28')][_0x4bbba6[_0xf955('0xd0')]];this['updateOriginated'](this[_0xf955('0x21')][_0x47d89d[_0xf955('0xaa')]]);this[_0xf955('0x21')][_0x47d89d['queue']][_0xf955('0x65')]+=0x1;this[_0xf955('0x21')][_0x47d89d[_0xf955('0xaa')]][_0xf955('0x64')]+=0x1;_0x8b45aa=new Hangup(_0x47d89d,_0x4bbba6);_0x8b45aa[_0xf955('0x9f')]=0x13;_0x8b45aa[_0xf955('0xa0')]=_0xf955('0xdc');_0x8b45aa['membername']='AMD';_0x8b45aa['amd']=!![];this[_0xf955('0xcf')](_0x8b45aa,_0xf955('0xdd'),'[syncMachine]');}if(_0x47d89d[_0xf955('0x4f')]===_0xf955('0x7d')&&this[_0xf955('0x22')][_0x47d89d['queue']][_0xf955('0xd5')]&&_0x4bbba6[_0xf955('0xd6')]==='HANGUP'){delete this['uniqueId'][_0x4bbba6[_0xf955('0xd0')]];this[_0xf955('0xab')](this[_0xf955('0x22')][_0x47d89d[_0xf955('0xaa')]]);_0x8b45aa=new Hangup(_0x47d89d,_0x4bbba6);_0x8b45aa[_0xf955('0x9f')]=0x12;_0x8b45aa['statedesc']=_0xf955('0xd8');_0x8b45aa[_0xf955('0xd9')]=_0xf955('0xde');this[_0xf955('0xcf')](_0x8b45aa,_0xf955('0xdf'),'[syncHangupInAMDIvr]');}if(_0x47d89d[_0xf955('0x4f')]===_0xf955('0x7d')&&this[_0xf955('0x22')][_0x47d89d[_0xf955('0xaa')]]['dialAMDActive']&&_0x4bbba6[_0xf955('0xd6')]===_0xf955('0xdb')){delete this[_0xf955('0x28')][_0x4bbba6[_0xf955('0xd0')]];this[_0xf955('0xab')](this['campaigns'][_0x47d89d[_0xf955('0xaa')]]);_0x8b45aa=new Hangup(_0x47d89d,_0x4bbba6);_0x8b45aa[_0xf955('0x9f')]=0x13;_0x8b45aa['statedesc']=_0xf955('0xdc');_0x8b45aa[_0xf955('0xd9')]=_0xf955('0xde');_0x8b45aa[_0xf955('0xe0')]=!![];this[_0xf955('0xcf')](_0x8b45aa,_0xf955('0xe1'),_0xf955('0xe2'));}}};Dialer[_0xf955('0x1b')][_0xf955('0x37')]=function(_0x176712){var _0x478d05=this['uniqueId'][_0x176712[_0xf955('0xd0')]];var _0x161a62=this;var _0x28ce41;if(_0x478d05&&_0x478d05[_0xf955('0x4f')]==='ivr'){delete this[_0xf955('0x28')][_0x176712[_0xf955('0xd0')]];this['updateOriginated'](this['campaigns'][_0x478d05[_0xf955('0xaa')]]);this[_0xf955('0x22')][_0x478d05[_0xf955('0xaa')]][_0xf955('0xe3')]+=0x1;_0x28ce41=new Hangup(_0x478d05,_0x176712);this['createHistory'](_0x28ce41)[_0xf955('0xae')](loggerCatch(_0xf955('0xe4')));this[_0xf955('0xba')](_0x28ce41)[_0xf955('0xae')](loggerCatch(_0xf955('0xe5')));}if(_0x478d05&&_0x478d05[_0xf955('0x4f')]!==_0xf955('0x7d')&&isNotNull(this[_0xf955('0x21')][_0x478d05['queue']][_0xf955('0xe6')])){delete this[_0xf955('0x28')][_0x176712[_0xf955('0xd0')]];this[_0xf955('0xab')](this[_0xf955('0x21')][_0x478d05[_0xf955('0xaa')]]);this[_0xf955('0x21')][_0x478d05[_0xf955('0xaa')]][_0xf955('0x65')]+=0x1;this[_0xf955('0x21')][_0x478d05['queue']][_0xf955('0x64')]+=0x1;_0x28ce41=new Hangup(_0x478d05,_0x176712);_0x28ce41[_0xf955('0x9f')]=0x10;_0x28ce41[_0xf955('0xa0')]=_0xf955('0xe7');_0x28ce41[_0xf955('0xd9')]=_0xf955('0xe8');this[_0xf955('0xbb')](_0x28ce41)['catch'](loggerCatch(_0xf955('0xe4')));this['moveContactManagedDialer'](_0x28ce41)[_0xf955('0xae')](loggerCatch(_0xf955('0xe5')));}if(_0x478d05&&_0x478d05[_0xf955('0x4f')]!==_0xf955('0x7d')&&!isNotNull(this[_0xf955('0x21')][_0x478d05[_0xf955('0xaa')]][_0xf955('0xe6')])){delete this[_0xf955('0x28')][_0x176712[_0xf955('0xd0')]];this['updateOriginated'](this[_0xf955('0x21')][_0x478d05[_0xf955('0xaa')]]);this[_0xf955('0x21')][_0x478d05[_0xf955('0xaa')]][_0xf955('0xe9')]+=0x1;_0x28ce41=new Hangup(_0x478d05,_0x176712);_0x28ce41[_0xf955('0x9f')]=0xc;_0x28ce41['statedesc']=_0x176712[_0xf955('0xea')];_0x28ce41[_0xf955('0xd9')]=_0xf955('0xeb');this['createHistory'](_0x28ce41)[_0xf955('0xae')](loggerCatch(_0xf955('0xe4')));this[_0xf955('0xba')](_0x28ce41)[_0xf955('0xae')](loggerCatch(_0xf955('0xe5')));}};Dialer[_0xf955('0x1b')]['syncAgentComplete']=function(_0x13c0ce){var _0x4775bd=this[_0xf955('0x28')][_0x13c0ce[_0xf955('0xd0')]];var _0x438f9c=this;if(this[_0xf955('0x21')][_0x13c0ce['queue']]){if(_0x4775bd&&_0x4775bd[_0xf955('0x4f')]!=='ivr'){delete this['uniqueId'][_0x13c0ce['uniqueid']];this['voiceQueues'][_0x13c0ce[_0xf955('0xaa')]]['outboundAnswerCallsDay']+=0x1;var _0x54102e=new AgentComplete(_0x4775bd,_0x13c0ce);if(_0x13c0ce[_0xf955('0xec')]==='agent'){_0x54102e[_0xf955('0xed')]=this['voiceQueues'][_0x13c0ce[_0xf955('0xaa')]]['dialQueueProject2']&&this[_0xf955('0x21')][_0x13c0ce[_0xf955('0xaa')]][_0xf955('0xee')]?moment()[_0xf955('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0xf955('0xbb')](_0x54102e)['catch'](loggerCatch(_0xf955('0xef')));this[_0xf955('0xba')](_0x54102e)[_0xf955('0xae')](loggerCatch(_0xf955('0xf0')));}}};Dialer[_0xf955('0x1b')][_0xf955('0x2e')]=function(_0x1cc042){if(this[_0xf955('0x21')][_0x1cc042[_0xf955('0xaa')]]){if(this[_0xf955('0x28')][_0x1cc042['uniqueid']]&&this[_0xf955('0x28')][_0x1cc042[_0xf955('0xd0')]][_0xf955('0x4f')]!==_0xf955('0x7d')){this[_0xf955('0xab')](this[_0xf955('0x21')][_0x1cc042[_0xf955('0xaa')]]);this['uniqueId'][_0x1cc042[_0xf955('0xd0')]][_0xf955('0xf1')]=moment()[_0xf955('0x7a')](_0xf955('0xf2'));}}};Dialer[_0xf955('0x1b')][_0xf955('0xf3')]=function(_0x392191){this[_0xf955('0xbb')](_0x392191)[_0xf955('0xae')](loggerCatch(_0xf955('0xef')));this['moveContactManagedDialer'](_0x392191)[_0xf955('0xae')](loggerCatch(_0xf955('0xf4')));};Dialer[_0xf955('0x1b')][_0xf955('0xf5')]=function(_0x1342c6){var _0x14e019=this[_0xf955('0x28')][_0x1342c6[_0xf955('0xd0')]];var _0x5d1f3d=this;if(this[_0xf955('0x21')][_0x1342c6[_0xf955('0xaa')]]){if(_0x14e019&&_0x14e019[_0xf955('0x4f')]!==_0xf955('0x7d')){delete this[_0xf955('0x28')][_0x1342c6[_0xf955('0xd0')]];this[_0xf955('0xab')](this[_0xf955('0x21')][_0x1342c6['queue']]);_0x14e019['droptime']=moment()[_0xf955('0x7a')](_0xf955('0xf2'));var _0xeae468=new QueueCallerAbandon(_0x14e019,_0x1342c6);if(getSeconds(_0x14e019[_0xf955('0xf6')],_0x14e019['responsetime'])>=_0x14e019['dialQueueTimeout']){this[_0xf955('0x21')][_0x1342c6[_0xf955('0xaa')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xf955('0x21')][_0x1342c6[_0xf955('0xaa')]][_0xf955('0xf7')]+=0x1;this[_0xf955('0x21')][_0x1342c6[_0xf955('0xaa')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0xeae468[_0xf955('0x9f')]=0xa;_0xeae468[_0xf955('0xa0')]=_0xf955('0xf8');_0xeae468[_0xf955('0xf9')]=_0xf955('0xfa');_0xeae468['agiafterat']=this[_0xf955('0x21')][_0x1342c6['queue']][_0xf955('0xfb')]?moment()['format'](_0xf955('0xf2')):undefined;this[_0xf955('0xf3')](_0xeae468);}else{this[_0xf955('0x21')][_0x1342c6[_0xf955('0xaa')]][_0xf955('0x71')]+=0x1;this[_0xf955('0x21')][_0x1342c6[_0xf955('0xaa')]][_0xf955('0x6a')]+=0x1;_0xeae468[_0xf955('0x9f')]=0xb;_0xeae468[_0xf955('0xa0')]='Abandoned';_0xeae468['dropreason']=_0xf955('0xfc');this[_0xf955('0xf3')](_0xeae468);}}}};Dialer[_0xf955('0x1b')][_0xf955('0x39')]=function(_0x5e6e24){if(this['actions'][_0x5e6e24[_0xf955('0xd0')]]){this['actions'][_0x5e6e24['uniqueid']][_0xf955('0xa8')]=_0x5e6e24['channel'];}if(this[_0xf955('0x28')][_0x5e6e24[_0xf955('0xd0')]]){this['uniqueId'][_0x5e6e24['uniqueid']][_0xf955('0xa8')]=_0x5e6e24[_0xf955('0xa8')];}};Dialer[_0xf955('0x1b')][_0xf955('0x3d')]=function(_0x30e0a1){if(strategy[this['voiceQueues'][this[_0xf955('0x27')][_0x30e0a1['actionid']]['queue']]['strategy']]===_0xf955('0x1a')){if(this[_0xf955('0x27')][_0x30e0a1[_0xf955('0xfd')]]&&_['isNil'](this['actions'][_0x30e0a1[_0xf955('0xfd')]]['locked'])&&_0x30e0a1[_0xf955('0xcd')]==='1'&&_0x30e0a1['paused']==='0'){if(this[_0xf955('0x23')][_0x30e0a1[_0xf955('0xfe')]]){if(!this['agents'][_0x30e0a1[_0xf955('0xfe')]]['locked']){this[_0xf955('0x23')][_0x30e0a1[_0xf955('0xfe')]][_0xf955('0xff')]=!![];this[_0xf955('0x27')][_0x30e0a1[_0xf955('0xfd')]]['locked']=!![];this['actions'][_0x30e0a1[_0xf955('0xfd')]][_0xf955('0xfe')]=_0x30e0a1[_0xf955('0xfe')];}}}}else if((strategy[this[_0xf955('0x21')][this[_0xf955('0x27')][_0x30e0a1[_0xf955('0xfd')]][_0xf955('0xaa')]][_0xf955('0x51')]]||_0xf955('0x19'))==='rrmemory'){if(this[_0xf955('0x27')][_0x30e0a1[_0xf955('0xfd')]]){if(this[_0xf955('0x23')][_0x30e0a1[_0xf955('0xfe')]]){this[_0xf955('0x27')][_0x30e0a1['actionid']][_0xf955('0xfe')]=_0x30e0a1[_0xf955('0xfe')];if(_['isNil'](this[_0xf955('0x100')][this['actions'][_0x30e0a1['actionid']][_0xf955('0xaa')]])){this[_0xf955('0x100')][this[_0xf955('0x27')][_0x30e0a1[_0xf955('0xfd')]]['queue']]=[];}this[_0xf955('0x100')][this[_0xf955('0x27')][_0x30e0a1[_0xf955('0xfd')]][_0xf955('0xaa')]]['push'](_[_0xf955('0x87')](_[_0xf955('0x101')](this['actions'][_0x30e0a1[_0xf955('0xfd')]],[_0xf955('0x102'),_0xf955('0xfe')]),{'status':_0x30e0a1['status'],'paused':_0x30e0a1[_0xf955('0x103')]}));}}}};function unlockQueueStatus(_0x181fb2,_0x346e87){setTimeout(function(){if(_['isUndefined'](_0x181fb2[_0xf955('0x104')])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x346e87);}_0x181fb2['queueStatusComplete']=!![];loggerBooked[_0xf955('0x82')](_0xf955('0x105'),_0x346e87,JSON[_0xf955('0x4a')](_[_0xf955('0x101')](_0x181fb2,[_0xf955('0x42'),_0xf955('0x104')])));},0x1f3);}Dialer['prototype'][_0xf955('0x3e')]=function(_0x67ef9a){var _0x363b64=this;var _0x37a8e2=_0x363b64[_0xf955('0x21')][_0x363b64[_0xf955('0x27')][_0x67ef9a[_0xf955('0xfd')]][_0xf955('0xaa')]];if(strategy[this[_0xf955('0x21')][this[_0xf955('0x27')][_0x67ef9a['actionid']][_0xf955('0xaa')]][_0xf955('0x51')]]===_0xf955('0x1a')){if(this['actions'][_0x67ef9a['actionid']]&&this[_0xf955('0x27')][_0x67ef9a['actionid']][_0xf955('0xfe')]){this[_0xf955('0x20')][_0xf955('0x106')](this[_0xf955('0x27')][_0x67ef9a['actionid']][_0xf955('0x102')],this[_0xf955('0x27')][_0x67ef9a[_0xf955('0xfd')]]['stateinterface'])[_0xf955('0xae')](function(_0x55c0ba){logger[_0xf955('0x8f')](_0xf955('0x107'),util[_0xf955('0x90')](_0x55c0ba,{'showHidden':![],'depth':null}));})[_0xf955('0x1e')](function(){_0x363b64['updateOriginated'](_0x363b64[_0xf955('0x21')][_0x363b64[_0xf955('0x27')][_0x67ef9a[_0xf955('0xfd')]]['queue']]);_0x363b64[_0xf955('0x23')][_0x363b64['actions'][_0x67ef9a[_0xf955('0xfd')]]['stateinterface']][_0xf955('0xff')]=![];delete _0x363b64['actions'][_0x67ef9a[_0xf955('0xfd')]];unlockQueueStatus(_0x37a8e2);});}else{this['updateOriginated'](this['voiceQueues'][this['actions'][_0x67ef9a[_0xf955('0xfd')]]['queue']]);this['rescheduleContact']({'active':![],'ContactId':this[_0xf955('0x27')][_0x67ef9a[_0xf955('0xfd')]][_0xf955('0xc1')],'ListId':this[_0xf955('0x27')][_0x67ef9a[_0xf955('0xfd')]][_0xf955('0xc2')],'VoiceQueueId':this[_0xf955('0x27')][_0x67ef9a[_0xf955('0xfd')]]['VoiceQueueId']||undefined,'CampaignId':this[_0xf955('0x27')][_0x67ef9a[_0xf955('0xfd')]][_0xf955('0xc5')]||undefined})[_0xf955('0xae')](loggerCatch(_0xf955('0x108')));delete this[_0xf955('0x27')][_0x67ef9a[_0xf955('0xfd')]];unlockQueueStatus(_0x37a8e2);}}else if((strategy[this[_0xf955('0x21')][this[_0xf955('0x27')][_0x67ef9a['actionid']][_0xf955('0xaa')]][_0xf955('0x51')]]||_0xf955('0x19'))===_0xf955('0x19')){var _0x914d41;if(this[_0xf955('0x27')][_0x67ef9a['actionid']]&&!_[_0xf955('0x8c')](this[_0xf955('0x100')][this[_0xf955('0x27')][_0x67ef9a[_0xf955('0xfd')]][_0xf955('0xaa')]])){if(this['queueBookedRR'][_0x363b64[_0xf955('0x27')][_0x67ef9a[_0xf955('0xfd')]]['queue']]){this['queueBookedRR'][_0x363b64['actions'][_0x67ef9a[_0xf955('0xfd')]][_0xf955('0xaa')]]=this[_0xf955('0x2c')][this[_0xf955('0x27')][_0x67ef9a[_0xf955('0xfd')]][_0xf955('0xaa')]]?this[_0xf955('0x2c')][this[_0xf955('0x27')][_0x67ef9a[_0xf955('0xfd')]][_0xf955('0xaa')]]:this['queueBooked'][this[_0xf955('0x27')][_0x67ef9a[_0xf955('0xfd')]][_0xf955('0xaa')]]?this[_0xf955('0x100')][this[_0xf955('0x27')][_0x67ef9a['actionid']][_0xf955('0xaa')]][_0xf955('0x109')]||0x0:0x0;}this['queueBooked'][this[_0xf955('0x27')][_0x67ef9a[_0xf955('0xfd')]][_0xf955('0xaa')]]['_rr']=this[_0xf955('0x2c')][this[_0xf955('0x27')][_0x67ef9a[_0xf955('0xfd')]][_0xf955('0xaa')]];for(var _0x1a7da8=0x0;_0x1a7da8=0x0?!![]:![];})[_0xf955('0xae')](myreject(_0x556463)));}}else{_0x3468e5[_0xf955('0x11f')](ami['Action']({'action':_0xf955('0x120'),'command':util[_0xf955('0x7a')]('iftime\x20%s,%s',_0x2c0ad2,!_[_0xf955('0x40')](config[_0xf955('0x11b')][_0x3254dc])?_0x3254dc:'')})[_0xf955('0xb0')](function(_0x2e7128){return _0x2e7128[_0xf955('0x123')][_0xf955('0x124')](_0xf955('0x125'))>=0x0?!![]:![];})['catch'](myreject(_0x556463)));}BPromise[_0xf955('0x126')](_0x3468e5)[_0xf955('0xb0')](function(_0x23b9fb){var _0xbbd8d0=_[_0xf955('0x127')](_0x23b9fb);if(_0xbbd8d0){return _0x132163(_0xbbd8d0);}else{_0x193fb4[_0xf955('0x41')]=_0x94b3bf?_0xf955('0x128'):'INTERVAL_IS_OVERTIME';return _0x556463(msgResponse(_0xf955('0x129'),_0xf955('0x11a'),_0xf955('0x12a')+_0x94b3bf+'\x20'+_0x172c70+_0xf955('0x12b')+util[_0xf955('0x90')](_0x2c0ad2,{'showHidden':![],'depth':null})+_0xf955('0x12c')+_0x3254dc));}})['catch'](function(_0x16661a){return _0x556463(msgResponse(_0xf955('0x116'),_0xf955('0x11a'),JSON[_0xf955('0x4a')](_0x16661a)));});});};Dialer['prototype']['checkDialMethod']=function(_0x25fb80){var _0x974c11=this;return function(){switch(_0x25fb80[_0xf955('0x5f')]){case'progressive':freeVariablesPredictive(_0x25fb80);_0x974c11[_0xf955('0x12d')](_0x25fb80,0x1);break;case'power':freeVariablesPredictive(_0x25fb80);_0x974c11[_0xf955('0x12d')](_0x25fb80,_0x25fb80['dialPowerLevel']);break;case'predictive':_0x974c11['predictive'](_0x25fb80);break;case _0xf955('0x7'):freeVariablesPredictive(_0x25fb80);_0x974c11[_0xf955('0x12d')](_0x25fb80,0x1);break;default:freeVariablesPredictive(_0x25fb80);logger[_0xf955('0x8f')](_0xf955('0x12e'),_0x25fb80[_0xf955('0x42')],_0xf955('0x12f'));}};};Dialer['prototype'][_0xf955('0x130')]=function(_0xdddd95){var _0xfcf598=this;return function(){_0xfcf598[_0xf955('0x131')](_0xdddd95);};};Dialer[_0xf955('0x1b')][_0xf955('0x35')]=function(_0x1c2557){var _0x5498ff=this;if(isNotPreview(_0x1c2557[_0xf955('0x5f')])){if(isVoiceQueueOutbound(_0x1c2557[_0xf955('0x4f')])&&isActive(_0x1c2557['dialActive'])){_0x1c2557[_0xf955('0x99')]=!![];BPromise[_0xf955('0xad')]()[_0xf955('0xb0')](checkIsLoggedIn(_0x1c2557,_0x1c2557[_0xf955('0x54')]))[_0xf955('0xb0')](checkIsActive(_0x1c2557,_0x1c2557['dialActive']))[_0xf955('0xb0')](checkInterval(_0x1c2557))[_0xf955('0xb0')](_0x5498ff[_0xf955('0x132')](_0x1c2557))[_0xf955('0xb0')](_0x5498ff[_0xf955('0x115')](_0x1c2557[_0xf955('0x133')],_0x1c2557[_0xf955('0x134')],_0x1c2557[_0xf955('0x42')],_0x1c2557))[_0xf955('0xb0')](_0x5498ff[_0xf955('0x117')](_0x1c2557[_0xf955('0x45')],_0x1c2557[_0xf955('0x134')],_0x1c2557[_0xf955('0x42')],_0x1c2557))[_0xf955('0xb0')](_0x5498ff['checkDialMethod'](_0x1c2557))[_0xf955('0xae')](loggerCatchQueueSummary(_0xf955('0x135'),_0x1c2557));}else{notSendMessagesQueue(_0x1c2557);}}else{freeVariablesPredictive(_0x1c2557);}};Dialer[_0xf955('0x1b')][_0xf955('0x112')]=function(){var _0x98de30=this;var _0x41ff13;for(var _0x27bb38 in this[_0xf955('0x22')]){if(this[_0xf955('0x22')][_0xf955('0xbc')](_0x27bb38)){_0x41ff13=this[_0xf955('0x22')][_0x27bb38];if(isCampaignIvr(_0x41ff13['type'])&&isActive(_0x41ff13[_0xf955('0xca')])){_0x41ff13['sendMessageOneNotActive']=!![];BPromise[_0xf955('0xad')]()[_0xf955('0xb0')](checkIsActive(_0x41ff13,_0x41ff13[_0xf955('0xca')]))[_0xf955('0xb0')](checkInterval(_0x41ff13))[_0xf955('0xb0')](_0x98de30[_0xf955('0x132')](_0x41ff13))['then'](_0x98de30[_0xf955('0x115')](_0x41ff13['dialGlobalInterval'],_0x41ff13[_0xf955('0x134')],_0x41ff13['name'],_0x41ff13))[_0xf955('0xb0')](_0x98de30['checkIfTimeIntervals'](_0x41ff13['Interval'],_0x41ff13[_0xf955('0x134')],_0x41ff13[_0xf955('0x42')],_0x41ff13))[_0xf955('0xb0')](_0x98de30['launchHandleIvr'](_0x41ff13))[_0xf955('0xae')](loggerCatchQueueSummary(_0xf955('0x136'),_0x41ff13));}else{notSendMessagesCampaign(_0x41ff13);}}}};function getCallerIdRandom(_0x5c4cfc,_0x12ad4d){var _0x14339c,_0x1a9209,_0x4d55fa;if(_0x12ad4d<=0x0){_0x12ad4d=0x1;}_0x14339c=new RegExp(_0xf955('0x137')+_0x12ad4d+'}$');_0x1a9209=Math[_0xf955('0x138')](0xa,_0x12ad4d-0x1);_0x4d55fa=Math[_0xf955('0x138')](0xa,_0x12ad4d)-0x1;return util[_0xf955('0x7a')]('%s',_[_0xf955('0x139')](_0x5c4cfc,_0x14339c,_[_0xf955('0x13a')](_0x1a9209,_0x4d55fa)));}function extractCalleridName(_0x3a42ea){var _0x5095fc=_0x3a42ea[_0xf955('0x13b')](/"(.*?)"/);return _0x5095fc?_0x5095fc[0x1]:_0x3a42ea;}function extractCalleridNumber(_0x475008){var _0x586245=_0x475008[_0xf955('0x13b')](/<(.*?)>/);return _0x586245?_0x586245[0x1]:_0x475008;}Dialer['prototype'][_0xf955('0x13c')]=function(_0x5c8e2e,_0x3f43f4){var _0x5b9bd7=this;var _0xcdc0fb=uuid['v4']();this[_0xf955('0x27')][_0xcdc0fb]=new Action(_0x5c8e2e,_0x3f43f4,_0xcdc0fb);return new BPromise(function(_0x22291f,_0x18abd2){if(_[_0xf955('0x40')](_0x5c8e2e)&&_0xf955('0x13d')!==typeof _0x5c8e2e){return _0x18abd2(msgResponse(_0xf955('0x13e'),_0xf955('0x11a'),'voiceQueue\x20is\x20undefine'));}if(_[_0xf955('0x40')](_0x3f43f4[_0xf955('0x13f')][_0xf955('0x140')])||_0x3f43f4[_0xf955('0x13f')][_0xf955('0x140')]===null){return _0x18abd2(msgResponse(_0xf955('0x13e'),_0xf955('0x11a'),'contact\x20is\x20undefine'));}var _0x42d099={'XMD-CALLERID':_0x5b9bd7[_0xf955('0x27')][_0xcdc0fb][_0xf955('0x141')](),'XMD-AGI':_0x5c8e2e[_0xf955('0xe6')]?util[_0xf955('0x7a')](_0xf955('0x142'),ipAgi,_0x5c8e2e[_0xf955('0xe6')]):'NONE','XMD-AGIAFTER':_0x5c8e2e[_0xf955('0xfb')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x5c8e2e[_0xf955('0xfb')]):_0xf955('0x143'),'XMD-QUEUE':_0x5c8e2e[_0xf955('0x4f')]===_0xf955('0x50')?util[_0xf955('0x7a')](_0xf955('0x144'),_0x5c8e2e['name'],_0x5c8e2e['dialQueueOptions']||'',_0x5c8e2e[_0xf955('0xee')]?'c':'',_0x5c8e2e[_0xf955('0x145')]||0x3):_0xf955('0x143'),'XMD-CONTACTID':_0x3f43f4['ContactId'],'XMD-CDRTYPE':_0xf955('0x6'),'CALLERID(all)':_0x5b9bd7[_0xf955('0x27')][_0xcdc0fb][_0xf955('0x141')](),'XMD-AMD':_0x5c8e2e[_0xf955('0xd5')]?_0xf955('0x146'):_0xf955('0x143'),'XMD-DESTINATION':_0xf955('0xd4')};if(_0x5c8e2e['dialAMDActive']){_0x42d099[_0xf955('0x147')]=_0x5c8e2e[_0xf955('0x148')]||0x9c4;_0x42d099['XMD-AMDGREETING']=_0x5c8e2e['dialAMDGreeting']||0x5dc;_0x42d099[_0xf955('0x149')]=_0x5c8e2e[_0xf955('0x14a')]||0x320;_0x42d099[_0xf955('0x14b')]=_0x5c8e2e[_0xf955('0x14c')]||0x1388;_0x42d099[_0xf955('0x14d')]=_0x5c8e2e['dialAMDMinWordLength']||0x64;_0x42d099[_0xf955('0x14e')]=_0x5c8e2e[_0xf955('0x14f')]||0x32;_0x42d099[_0xf955('0x150')]=_0x5c8e2e[_0xf955('0x151')]||0x3;_0x42d099[_0xf955('0x152')]=_0x5c8e2e['dialAMDSilenceThreshold']||0x100;_0x42d099[_0xf955('0x153')]=_0x5c8e2e[_0xf955('0x154')]||0x1388;}if(_0x5c8e2e[_0xf955('0x4f')]==='outbound'){_0x42d099[_0xf955('0x155')]=_0x3f43f4[_0xf955('0xc4')];}else{_0x42d099[_0xf955('0x156')]=_0x3f43f4[_0xf955('0xc5')];}for(var _0x3a8a7a in _0x3f43f4['Contact']){if(_0x3f43f4[_0xf955('0x13f')][_0xf955('0xbc')](_0x3a8a7a)){if(isNotNull(_0x3f43f4[_0xf955('0x13f')][_0x3a8a7a])&&_0x3a8a7a!=='id'&&_0x3a8a7a!==_0xf955('0x157')&&_0x3a8a7a!=='createdAt'&&_0x3a8a7a!=='updatedAt'){_0x42d099[util[_0xf955('0x7a')](_0xf955('0x158'),'XMD-',_[_0xf955('0x159')](_0x3a8a7a))]=_0x3f43f4[_0xf955('0x13f')][_0x3a8a7a];}}}var _0x1ecab4=_0x5b9bd7[_0xf955('0xc9')](_0x5c8e2e[_0xf955('0x78')])?getCallerId(_0x5c8e2e[_0xf955('0x78')]['callerid'],_0x5c8e2e[_0xf955('0x60')],_0x5c8e2e[_0xf955('0x15a')]>0x0?getCallerIdRandom(_0x5c8e2e['dialOriginateCallerIdNumber'],_0x5c8e2e[_0xf955('0x15a')]):_0x5c8e2e[_0xf955('0x61')]):getCallerId(_[_0xf955('0xa6')](_0x5c8e2e[_0xf955('0x113')])?_0x5c8e2e[_0xf955('0x78')][_0xf955('0x15b')]:_0x5c8e2e[_0xf955('0x113')]['callerid'],_0x5c8e2e[_0xf955('0x60')],_0x5c8e2e[_0xf955('0x15a')]>0x0?getCallerIdRandom(_0x5c8e2e[_0xf955('0x61')],_0x5c8e2e[_0xf955('0x15a')]):_0x5c8e2e[_0xf955('0x61')]);if(_0x1ecab4){_0x42d099[_0xf955('0x15c')]=_0x5b9bd7[_0xf955('0x27')][_0xcdc0fb][_0xf955('0x15d')]=extractCalleridName(_0x1ecab4);_0x42d099[_0xf955('0x15e')]=_0x5b9bd7['actions'][_0xcdc0fb][_0xf955('0x15f')]=extractCalleridNumber(_0x1ecab4);}return ami[_0xf955('0xa7')]({'actionid':_0xcdc0fb,'action':'originate','channel':_0x5b9bd7[_0xf955('0xc9')](_0x5c8e2e['Trunk'])?util[_0xf955('0x7a')](_0xf955('0x160'),_0x5c8e2e[_0xf955('0x78')]['name'],isNotNull(_0x5c8e2e['dialPrefix'])?_0x5c8e2e[_0xf955('0x63')][_0xf955('0x161')]()||'':'',_0x5c8e2e[_0xf955('0x162')]>0x0?_0x3f43f4['Contact']['phone'][_0xf955('0x163')](_0x5c8e2e[_0xf955('0x162')]):_0x3f43f4['Contact'][_0xf955('0x140')]):util['format'](_0xf955('0x160'),_['isNil'](_0x5c8e2e[_0xf955('0x113')])?_0x5c8e2e['Trunk'][_0xf955('0x42')]:_0x5c8e2e[_0xf955('0x113')][_0xf955('0x42')],isNotNull(_0x5c8e2e[_0xf955('0x63')])?_0x5c8e2e[_0xf955('0x63')][_0xf955('0x161')]()||'':'',_0x5c8e2e[_0xf955('0x162')]>0x0?_0x3f43f4['Contact']['phone'][_0xf955('0x163')](_0x5c8e2e[_0xf955('0x162')]):_0x3f43f4[_0xf955('0x13f')][_0xf955('0x140')]),'callerid':_0x1ecab4,'Exten':_0xf955('0xd4'),'Context':_0xf955('0x164'),'Priority':'1','variable':_0x42d099,'timeout':(_0x5c8e2e[_0xf955('0x62')]||0x1e)*0x3e8,'async':!![],'channelid':_0xcdc0fb})['then'](function(_0x35d810){return _0x22291f(_0x35d810);})[_0xf955('0xae')](function(_0x53f9d3){_0x5c8e2e[_0xf955('0x6d')]+=0x1;var _0x2286de=new History(_0x5b9bd7[_0xf955('0x27')][_0xcdc0fb]);logger[_0xf955('0x8f')](util[_0xf955('0x7a')](_0xf955('0x165'),JSON[_0xf955('0x4a')](_0x53f9d3)));_0x2286de[_0xf955('0x9f')]=0xe;_0x2286de['statedesc']=_0xf955('0x166');_0x2286de[_0xf955('0xa2')]=moment()[_0xf955('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');_0x2286de[_0xf955('0xa1')]=_0x2286de[_0xf955('0xa2')];_0x5b9bd7[_0xf955('0xbb')](_0x2286de)['catch'](loggerCatch('[originate][error]'));_0x5b9bd7[_0xf955('0xba')](_0x2286de)[_0xf955('0xae')](loggerCatch(_0xf955('0x167')))[_0xf955('0x1e')](function(){delete _0x5b9bd7[_0xf955('0x27')][_0xcdc0fb];return _0x18abd2(msgResponse(_0xf955('0x13e'),'Error','originate\x20action\x20Error'));});});});};Dialer[_0xf955('0x1b')][_0xf955('0x32')]=function(_0x4b20c7){var _0x26b810=this[_0xf955('0x27')][_0x4b20c7[_0xf955('0xfd')]];var _0x58bbaa=this;if(_0x26b810){delete this['actions'][_0x4b20c7[_0xf955('0xfd')]];_0x26b810[_0xf955('0x168')]=moment()[_0xf955('0x7a')](_0xf955('0xf2'));var _0x21f987=_0x26b810[_0xf955('0x4f')]===_0xf955('0x7d')?this[_0xf955('0x22')][_0x26b810[_0xf955('0xaa')]]:this[_0xf955('0x21')][_0x26b810['getQueue']()];if(!this[_0xf955('0xc7')](_0x4b20c7[_0xf955('0x169')])){this[_0xf955('0xab')](_0x21f987);return this['callProgressDetecting'](_0x26b810,_0x21f987,_0x4b20c7)['then'](function(_0x6b917d){})[_0xf955('0xae')](loggerCatch(_0xf955('0x16a')));}else{this[_0xf955('0x28')][_0x4b20c7[_0xf955('0xd0')]]=_0x26b810;}}};Dialer[_0xf955('0x1b')]['checkRetriveMax']=function(_0x26b1c5,_0x43b7ce,_0x314082){var _0x3cb953=new History(_0x43b7ce);if(_0x3cb953[_0xf955('0x16b')]+_0x3cb953['countcongestionretry']+_0x3cb953['countnoanswerretry']>=_0x314082[_0xf955('0x16c')]-0x1){return!![];}switch(_0x26b1c5){case 0x3:if(_0x3cb953['countnoanswerretry']>=_0x314082[_0xf955('0x16d')]-0x1){return!![];}else{this[_0xf955('0xb3')]({'active':![],'countnoanswerretry':_0x3cb953[_0xf955('0x16e')]+=0x1,'scheduledat':moment()[_0xf955('0x16f')](_0x314082[_0xf955('0x170')],_0xf955('0x171'))['format'](_0xf955('0xf2')),'ContactId':_0x3cb953['ContactId'],'ListId':_0x3cb953['ListId'],'VoiceQueueId':_0x3cb953[_0xf955('0xc4')]||undefined,'CampaignId':_0x3cb953[_0xf955('0xc5')]||undefined})[_0xf955('0xae')](loggerCatch(_0xf955('0x172')));}break;case 0x5:if(_0x3cb953[_0xf955('0x16b')]>=_0x314082[_0xf955('0x173')]-0x1){return!![];}else{this[_0xf955('0xb3')]({'active':![],'countbusyretry':_0x3cb953[_0xf955('0x16b')]+=0x1,'scheduledat':moment()[_0xf955('0x16f')](_0x314082[_0xf955('0x174')],'minutes')[_0xf955('0x7a')](_0xf955('0xf2')),'ContactId':_0x3cb953[_0xf955('0xc1')],'ListId':_0x3cb953[_0xf955('0xc2')],'VoiceQueueId':_0x3cb953[_0xf955('0xc4')]||undefined,'CampaignId':_0x3cb953[_0xf955('0xc5')]||undefined})['catch'](loggerCatch(_0xf955('0x175')));}break;case 0x8:if(_0x3cb953[_0xf955('0x176')]>=_0x314082[_0xf955('0x177')]-0x1){return!![];}else{this[_0xf955('0xb3')]({'active':![],'countcongestionretry':_0x3cb953[_0xf955('0x176')]+=0x1,'scheduledat':moment()['add'](_0x314082[_0xf955('0x178')],_0xf955('0x171'))[_0xf955('0x7a')](_0xf955('0xf2')),'ContactId':_0x3cb953[_0xf955('0xc1')],'ListId':_0x3cb953[_0xf955('0xc2')],'VoiceQueueId':_0x3cb953[_0xf955('0xc4')]||undefined,'CampaignId':_0x3cb953['CampaignId']||undefined})[_0xf955('0xae')](loggerCatch(_0xf955('0x179')));}break;default:return!![];}};Dialer['prototype'][_0xf955('0x17a')]=function(_0x56bdc6,_0x215776,_0x190fed){var _0x284a2b=this;var _0xc3e36b=new History(_0x56bdc6);return new BPromise(function(_0x2bca9a,_0x513221){if(_[_0xf955('0x40')](_0x215776)&&_0xf955('0x13d')!==typeof _0x215776){return _0x513221(msgResponse(_0xf955('0x17b'),_0xf955('0x11a'),_0xf955('0x17c')));}if(_[_0xf955('0x40')](_0x190fed)&&'object'!==typeof _0x190fed){return _0x513221(msgResponse('[callProgressDetecting]',_0xf955('0x11a'),_0xf955('0x17d')));}switch(_0x190fed[_0xf955('0xec')]){case'0':_0x215776[_0xf955('0x6c')]+=0x1;_0xc3e36b[_0xf955('0x9f')]=0x0;_0xc3e36b[_0xf955('0xa0')]=_0xf955('0x17e');_0x284a2b[_0xf955('0xbb')](_0xc3e36b)[_0xf955('0xae')](loggerCatch(_0xf955('0x17f')));if(_0x284a2b[_0xf955('0x180')](0x0,_0x56bdc6,_0x215776)){if(_0xc3e36b[_0xf955('0x16b')]+_0xc3e36b[_0xf955('0x176')]+_0xc3e36b[_0xf955('0x16e')]>=_0x215776[_0xf955('0x16c')]){_0x284a2b[_0xf955('0x181')](_0xc3e36b,_0x2bca9a,_0x513221,_0xf955('0x182'));}else{_0x284a2b[_0xf955('0x183')](_0xc3e36b,_0x2bca9a,_0x513221,_0xf955('0x182'));}}break;case'3':_0x215776[_0xf955('0x6b')]+=0x1;_0xc3e36b[_0xf955('0x9f')]=0x3;_0xc3e36b[_0xf955('0xa0')]=_0xf955('0x184');_0xc3e36b[_0xf955('0x16e')]+=0x1;_0xc3e36b['countglobal']+=0x1;_0x284a2b[_0xf955('0xbb')](_0xc3e36b)[_0xf955('0xae')](loggerCatch(_0xf955('0x185')));if(_0x284a2b[_0xf955('0x180')](0x3,_0x56bdc6,_0x215776)){if(_0xc3e36b['countnoanswerretry']>=_0x215776[_0xf955('0x16d')]){_0x284a2b['createStateFinal'](_0xc3e36b,_0x2bca9a,_0x513221,_0xf955('0x186'));}else{_0x284a2b[_0xf955('0x181')](_0xc3e36b,_0x2bca9a,_0x513221,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x215776[_0xf955('0x67')]+=0x1;_0xc3e36b[_0xf955('0x9f')]=0x5;_0xc3e36b[_0xf955('0xa0')]=_0xf955('0x187');_0xc3e36b['countbusyretry']+=0x1;_0xc3e36b[_0xf955('0x188')]+=0x1;_0x284a2b['createHistory'](_0xc3e36b)[_0xf955('0xae')](loggerCatch(_0xf955('0x189')));if(_0x284a2b[_0xf955('0x180')](0x5,_0x56bdc6,_0x215776)){if(_0xc3e36b[_0xf955('0x16b')]>=_0x215776[_0xf955('0x173')]){_0x284a2b['createStateFinal'](_0xc3e36b,_0x2bca9a,_0x513221,'reason\x205\x20busy');}else{_0x284a2b[_0xf955('0x181')](_0xc3e36b,_0x2bca9a,_0x513221,_0xf955('0x18a'));}}break;case'8':_0x215776['outboundCongestionCallsDay']+=0x1;_0xc3e36b[_0xf955('0x9f')]=0x8;_0xc3e36b[_0xf955('0xa0')]=_0xf955('0x18b');_0xc3e36b['countcongestionretry']+=0x1;_0xc3e36b[_0xf955('0x188')]+=0x1;_0x284a2b['createHistory'](_0xc3e36b)['catch'](loggerCatch(_0xf955('0x18c')));if(_0x284a2b[_0xf955('0x180')](0x8,_0x56bdc6,_0x215776)){if(_0xc3e36b[_0xf955('0x176')]>=_0x215776['dialCongestionMaxRetry']){_0x284a2b['createStateFinal'](_0xc3e36b,_0x2bca9a,_0x513221,'reason\x208\x20congestion');}else{_0x284a2b[_0xf955('0x181')](_0xc3e36b,_0x2bca9a,_0x513221,_0xf955('0x18d'));}}break;default:_0x215776[_0xf955('0xe9')]+=0x1;_0xc3e36b['state']=0xc;_0xc3e36b[_0xf955('0xa0')]=_0x190fed[_0xf955('0xec')];_0x284a2b[_0xf955('0xbb')](_0xc3e36b)[_0xf955('0xae')](loggerCatch(_0xf955('0x18e')));if(_0x284a2b[_0xf955('0x180')](_0x190fed[_0xf955('0xec')],_0x56bdc6,_0x215776)){if(_0xc3e36b['countbusyretry']+_0xc3e36b['countcongestionretry']+_0xc3e36b[_0xf955('0x16e')]>=_0x215776[_0xf955('0x16c')]){_0x284a2b[_0xf955('0x181')](_0xc3e36b,_0x2bca9a,_0x513221,_0x190fed[_0xf955('0xec')]);}else{_0x284a2b['createStateFinal'](_0xc3e36b,_0x2bca9a,_0x513221,_0x190fed[_0xf955('0xec')]);}}}});};Dialer[_0xf955('0x1b')][_0xf955('0x181')]=function(_0xda19b9,_0x5d3200,_0x50b3e7,_0x4de334){var _0x38a765=new Final(_0xda19b9);_0x38a765['state']=0xf;_0x38a765['statedesc']=_0xf955('0x18f');this[_0xf955('0x183')](_0x38a765,_0x5d3200,_0x50b3e7,_0x4de334);};Dialer[_0xf955('0x1b')][_0xf955('0x183')]=function(_0x1efcc8,_0x2d19d4,_0x283683,_0x48456f){this[_0xf955('0xba')](_0x1efcc8)[_0xf955('0xb0')](function(_0xdd6728){return _0x2d19d4(msgResponse('[callProgressDetecting]',_0xf955('0xc8'),_0x48456f));})['catch'](function(_0x360935){return _0x283683(msgResponse(_0xf955('0x190'),_0xf955('0x11a'),_0xf955('0x191')));});};Dialer[_0xf955('0x1b')]['predictive']=function(_0x5482cb){var _0x501bbb=this;var _0x378028=_0x5482cb[_0xf955('0x192')]/0x64;var _0x5f113c=_0x5482cb['outboundDropCallsDayTimeout']/(_0x5482cb['outboundDropCallsDayTimeout']+_0x5482cb[_0xf955('0x65')]);var _0x5d1eac=_0x5482cb['loggedIn']-_0x5482cb[_0xf955('0x193')]-_0x5482cb[_0xf955('0x5c')]-_0x5482cb[_0xf955('0x77')]-_0x5482cb['talking'];var _0x458219=(_0x5482cb[_0xf955('0x54')]-_0x5482cb[_0xf955('0x193')])*_0x5482cb[_0xf955('0x75')];var _0x234146=Math[_0xf955('0x194')](_0x5482cb['erlangCalls']*_0x5482cb[_0xf955('0x195')]*_0x5482cb['predictiveIntervalHitRate']*_0x5482cb[_0xf955('0x76')]);if(_[_0xf955('0x40')](_0x5482cb[_0xf955('0x88')])){loggerPredictive[_0xf955('0x82')](_0xf955('0x196'));if(!_['isUndefined'](_0x5482cb[_0xf955('0x2a')])){_0x5482cb[_0xf955('0x2a')]=undefined;loggerPredictive['error'](_0xf955('0x197'),_0xf955('0x198'));}if(!_[_0xf955('0x40')](_0x5482cb['handlePredictive'])){loggerPredictive[_0xf955('0x8f')](_0xf955('0x197'),_0xf955('0x199'));clearInterval(_0x5482cb[_0xf955('0x8a')]);_0x5482cb['handlePredictive']=undefined;}_0x5482cb[_0xf955('0x88')]=moment()[_0xf955('0x7a')](_0xf955('0xf2'));loggerPredictive[_0xf955('0x82')]('[startMethodPredictive][StartProgressive][Date]',_0x5482cb[_0xf955('0x88')],_0x5482cb[_0xf955('0x42')]);this[_0xf955('0x12d')](_0x5482cb,0x1);}else if(ifInterval(_0x5482cb['dialPredictiveInterval'],_0x5482cb['startProgressive'])){this[_0xf955('0x12d')](_0x5482cb,0x1);loggerPredictiveCalls['info'](_0xf955('0x19a'),_0x5482cb[_0xf955('0x88')],_0x5482cb[_0xf955('0x42')]);_0x5482cb['erlangCalls']=0x0;_0x5482cb['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x378028<_0x5f113c&&_0x5482cb[_0xf955('0x19b')]===_0xf955('0x19c')){freeVariablesPredictive(_0x5482cb);loggerPredictive[_0xf955('0x82')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0xf955('0x19d'),_0x5f113c,_0xf955('0x88'),_0x5482cb[_0xf955('0x42')]);}else if(_0x5d1eac>_0x458219){freeVariablesPredictive(_0x5482cb);loggerPredictive[_0xf955('0x82')]('[stopMethodPredictive][ReStartProgressive][LowerLimitInterval]',_0xf955('0x19e'),_0x5d1eac,_0xf955('0x19f'),_0x458219);}else if(_0x234146<_0x5482cb[_0xf955('0x1a0')]&&_0x5482cb[_0xf955('0x19b')]===_0xf955('0x19c')){freeVariablesPredictive(_0x5482cb);loggerPredictive[_0xf955('0x82')](_0xf955('0x1a1'),'Max\x20Drop\x20',_0x234146,_0xf955('0x1a2'),_0x5482cb[_0xf955('0x1a0')],_0xf955('0x88'),_0x5482cb[_0xf955('0x42')]);}else if(!ifInterval(_0x5482cb['dialPredictiveInterval'],_0x5482cb['startProgressive'])&&_[_0xf955('0x40')](_0x5482cb[_0xf955('0x2a')])&&!_[_0xf955('0x40')](_0x5482cb[_0xf955('0x88')])){_0x5482cb[_0xf955('0x2a')]=moment()[_0xf955('0x7a')](_0xf955('0xf2'));loggerPredictive[_0xf955('0x82')](_0xf955('0x1a3'),_0x5482cb[_0xf955('0x2a')],_0x5482cb[_0xf955('0x42')]);this[_0xf955('0x1a4')](_0x5482cb[_0xf955('0x1a5')])['then'](this[_0xf955('0x1a6')](_0x5482cb))[_0xf955('0xb0')](mergeDataErlangB(_0x5482cb))[_0xf955('0xb0')](this[_0xf955('0x1a7')](_0x5482cb))[_0xf955('0xae')](loggerCatchPredictive(_0xf955('0x1a8'),_0x5482cb));}else if(!ifInterval(_0x5482cb['dialPredictiveInterval'],_0x5482cb[_0xf955('0x2a')])){_0x5482cb[_0xf955('0x1a0')]=0x0;_0x5482cb[_0xf955('0x2a')]=moment()[_0xf955('0x7a')](_0xf955('0xf2'));loggerPredictive[_0xf955('0x82')](_0xf955('0x1a9'),_0x5482cb[_0xf955('0x2a')],_0x5482cb[_0xf955('0x42')]);clearInterval(_0x5482cb[_0xf955('0x8a')]);_0x5482cb[_0xf955('0x8a')]=undefined;this[_0xf955('0x1a4')](_0x5482cb[_0xf955('0x1a5')])[_0xf955('0xb0')](this[_0xf955('0x1a6')](_0x5482cb))[_0xf955('0xb0')](mergeDataErlangB(_0x5482cb))[_0xf955('0xb0')](this[_0xf955('0x1a7')](_0x5482cb))['catch'](loggerCatchPredictive(_0xf955('0x1a8'),_0x5482cb));}};Dialer[_0xf955('0x1b')]['getDataPredictive']=function(_0x3f7cdb){var _0x3d6a14=this;return function(_0xe00467){return new BPromise(function(_0x188d9e,_0x3dd645){_[_0xf955('0x87')](_0x3f7cdb,_0xe00467[0x0]);if(checkGetDataPredictive(_0xe00467[0x0])){loggerPredictive['info'](JSON[_0xf955('0x4a')](_0xe00467[0x0]));if(_0x3f7cdb[_0xf955('0x19b')]===_0xf955('0x19c')){return _0x3d6a14[_0xf955('0xb8')](_0x3f7cdb['id'])[_0xf955('0xb0')](function(_0x584e00){var _0x1a88f1=_0x3f7cdb[_0xf955('0x54')]-_0x584e00[0x0][_0xf955('0x1aa')];var _0x3f76a0=_0x3f7cdb[_0xf955('0x1a5')]*0x3c;var _0x114e5e=_0xe00467[0x0][_0xf955('0x70')]+_0xe00467[0x0][_0xf955('0x81')];var _0x340ace=(_0xe00467[0x0][_0xf955('0x6f')]+_0xe00467[0x0]['predictiveIntervalDroppedCallsTimeout']+_0xe00467[0x0][_0xf955('0x71')])/_0xe00467[0x0][_0xf955('0x80')];var _0x4ce22d=_0x3f7cdb[_0xf955('0x192')]/0x64;_0x3f7cdb[_0xf955('0x193')]=_0x584e00[0x0][_0xf955('0x1aa')]||0x0;_0x3f7cdb[_0xf955('0x74')]=_0x340ace>0x0?_0x340ace:0x1;return _0x3d6a14[_0xf955('0x1ab')](_0x1a88f1,_0x3f76a0,_0x114e5e,_0x340ace,_0x4ce22d);})[_0xf955('0xb0')](function(_0x3be319){return _0x188d9e(_0x3be319);})['catch'](function(_0x51e5e5){return _0x3dd645(msgResponse('[CatchErlangB]',_0xf955('0x11a'),JSON[_0xf955('0x4a')](_0x51e5e5)));});}if(_0x3f7cdb[_0xf955('0x19b')]===_0xf955('0x1ac')){return _0x3d6a14[_0xf955('0xb8')](_0x3f7cdb['id'])[_0xf955('0xb0')](function(_0x26df3b){var _0x201b73=_0x3f7cdb['loggedIn']-_0x26df3b[0x0]['outboundQueuePauses'];var _0x596b0f=_0x3f7cdb[_0xf955('0x1a5')]*0x3c;var _0x385a31=_0xe00467[0x0][_0xf955('0x70')]+_0xe00467[0x0][_0xf955('0x81')];var _0xaf69bf=(_0xe00467[0x0]['predictiveIntervalAnsweredCalls']+_0xe00467[0x0][_0xf955('0x72')]+_0xe00467[0x0][_0xf955('0x71')])/_0xe00467[0x0][_0xf955('0x80')];var _0x343d51=_0x3f7cdb[_0xf955('0x192')]/0x64;_0x3f7cdb[_0xf955('0x193')]=_0x26df3b[0x0]['outboundQueuePauses']||0x0;_0x3f7cdb['predictiveIntervalHitRate']=_0xaf69bf>0x0?_0xaf69bf:0x1;return _0x3d6a14[_0xf955('0x1ad')](_0x201b73,_0x596b0f,_0x385a31,_0xaf69bf,_0x343d51);})[_0xf955('0xb0')](function(_0x4a1643){return _0x188d9e(_0x4a1643);})[_0xf955('0xae')](function(_0xba4d3f){return _0x3dd645(msgResponse(_0xf955('0x1ae'),_0xf955('0x11a'),JSON[_0xf955('0x4a')](_0xba4d3f)));});}}else{return _0x3dd645(msgResponse('[getDataPredictive]','Failure',_0xf955('0x1af')));}});};};Dialer['prototype'][_0xf955('0x1a7')]=function(_0xe17396){var _0x5dda02=this;return function(){var _0x7f78b=0x0;var _0x5c57b2=Math[_0xf955('0x194')](_0xe17396[_0xf955('0x1b0')]*0x3e8);if(_0x5c57b2>0x0){_0x5c57b2=_0x5c57b2<0x64?0x64:_0x5c57b2;loggerPredictive['info'](_0xf955('0x1b1'),_0x5c57b2);_0xe17396[_0xf955('0x8a')]=setInterval(function(){_0x5dda02['handlePredictive'](_0xe17396);loggerPredictiveCalls[_0xf955('0x82')]('[handlePredictive]',_0x7f78b+=0x1);},_0x5c57b2);}else{loggerPredictive[_0xf955('0x82')](_0xf955('0x1b2'),_0xf955('0x1b3'),_0x5c57b2);}};};Dialer[_0xf955('0x1b')][_0xf955('0x1b4')]=function(_0x88337e,_0x5b72a4){var _0x56776a=this;return function(_0x12c732){if(_[_0xf955('0x8c')](_0x12c732)){if(_[_0xf955('0xa6')](_0x5b72a4[_0xf955('0xc3')])||!_0x5b72a4[_0xf955('0x1b5')]){if(_0x88337e['dialMethod']==='booked'){_0x88337e['queueStatusComplete']=_[_0xf955('0x40')](_0x88337e[_0xf955('0x104')])?!![]:_0x88337e[_0xf955('0x104')];var _0x18aabd=uuid['v4']();_0x56776a['actions'][_0x18aabd]=new Action(_0x88337e,_0x5b72a4,_0x18aabd);loggerBooked['info'](_0xf955('0x1b6'),_0x18aabd,_0xf955('0x1b7'),JSON['stringify'](_0x88337e[_0xf955('0x104')]),'Queue:\x20',_0x88337e['name']);if(_0x88337e[_0xf955('0x104')]){_0x88337e[_0xf955('0x104')]=![];_0x56776a[_0xf955('0x100')][_0x56776a[_0xf955('0x27')][_0x18aabd][_0xf955('0xaa')]]=[];ami[_0xf955('0xa7')]({'actionid':_0x18aabd,'action':_0xf955('0x1b8'),'queue':_0x88337e[_0xf955('0x42')]})['catch'](function(_0x3a0460){_0x56776a[_0xf955('0xab')](_0x88337e);_0x56776a['rescheduleContact']({'active':![],'ContactId':_0x56776a[_0xf955('0x27')][_0x18aabd][_0xf955('0xc1')],'ListId':_0x56776a[_0xf955('0x27')][_0x18aabd]['ListId'],'VoiceQueueId':_0x56776a['actions'][_0x18aabd][_0xf955('0xc4')]||undefined,'CampaignId':_0x56776a[_0xf955('0x27')][_0x18aabd][_0xf955('0xc5')]||undefined})[_0xf955('0xae')](loggerCatch(_0xf955('0x1b9')));delete _0x56776a[_0xf955('0x27')][_0x18aabd];});}else{loggerBooked['info'](_0xf955('0x1ba'),JSON[_0xf955('0x4a')](_0x88337e[_0xf955('0x104')]),'Queue:\x20',_0x88337e['name']);_0x56776a[_0xf955('0xab')](_0x88337e);_0x56776a[_0xf955('0xb3')]({'active':![],'ContactId':_0x56776a[_0xf955('0x27')][_0x18aabd]['ContactId'],'ListId':_0x56776a[_0xf955('0x27')][_0x18aabd][_0xf955('0xc2')],'VoiceQueueId':_0x56776a[_0xf955('0x27')][_0x18aabd]['VoiceQueueId']||undefined,'CampaignId':_0x56776a['actions'][_0x18aabd][_0xf955('0xc5')]||undefined})[_0xf955('0xae')](loggerCatch(_0xf955('0x1b9')));delete _0x56776a[_0xf955('0x27')][_0x18aabd];}}else{return _0x56776a[_0xf955('0x13c')](_0x88337e,_0x5b72a4);}}else{if(getDiff(_0x5b72a4[_0xf955('0x1bb')])<_0x88337e[_0xf955('0x1bc')]*0x3c){_0x56776a['preview'][_0xf955('0x106')](_0x5b72a4['id'])[_0xf955('0x1e')](function(){_0x56776a[_0xf955('0xab')](_0x88337e);});}else{_0x88337e['outboundReCallsDay']+=0x1;_0x56776a[_0xf955('0xab')](_0x88337e);if(_0x88337e[_0xf955('0x1bd')]){_0x56776a[_0xf955('0xb3')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5b72a4[_0xf955('0xc1')],'ListId':_0x5b72a4[_0xf955('0xc2')],'VoiceQueueId':_0x5b72a4[_0xf955('0xc4')]||undefined,'CampaignId':_0x5b72a4[_0xf955('0xc5')]||undefined})['catch'](loggerCatch(_0xf955('0x1be')));_0x56776a[_0xf955('0xbb')](createObjHistory(_0x88337e,_0x5b72a4,_0xf955('0x1bf'),0x17,'RecallInQueue'))[_0xf955('0xae')](loggerCatch(_0xf955('0x1c0')));}else{_0x56776a[_0xf955('0xcf')](createObjHistory(_0x88337e,_0x5b72a4,_0xf955('0x1c1'),0x16,_0xf955('0x1c2')),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x88337e[_0xf955('0x66')]+=0x1;_0x56776a['saveInDb'](createObjHistory(_0x88337e,_0x5b72a4,_0xf955('0x1c3'),0xd,'Blacklist'),_0xf955('0x1c4'),'[Originate][MoveBlacklist]');throw _0xf955('0x1c5');}};};Dialer[_0xf955('0x1b')][_0xf955('0x131')]=function(_0x3a8c60){var _0x2d96e2=this;var _0x331d11=[];var _0x15b0b0=_0x3a8c60['limitCalls']-_0x3a8c60['originated']-_0x3a8c60['temp'];emitCampaignSummary(_0x3a8c60);if(_0x15b0b0>0x0){if(_0x15b0b0>this[_0xf955('0x25')]){_0x15b0b0=this['maxNumberOriginate'];}_0x3a8c60[_0xf955('0x1c6')]+=_0x15b0b0;this['getContactDialerIvr'](_0x3a8c60['id'],_0x15b0b0,_0x3a8c60['dialOrderByScheduledAt'])[_0xf955('0xb0')](function(_0x2e1d97){_0x3a8c60[_0xf955('0x1c6')]-=_0x15b0b0;_0x3a8c60[_0xf955('0x1c6')]=_0x3a8c60[_0xf955('0x1c6')]>0x0?_0x3a8c60['temp']:0x0;if(!checkContactEmpty(_0x2e1d97)){_0x3a8c60[_0xf955('0x41')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xf955('0x82')](_0xf955('0x1c7')+_0x3a8c60[_0xf955('0x42')]);}else{_0x3a8c60[_0xf955('0x77')]+=_0x2e1d97[_0xf955('0x91')];_0x3a8c60[_0xf955('0x41')]=_0xf955('0x1c8');for(var _0x1a004f=0x0;_0x1a004f<_0x2e1d97[_0xf955('0x91')];_0x1a004f+=0x1){_0x3a8c60['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x2e1d97[_0x1a004f])||_[_0xf955('0xa6')](_0x2e1d97[_0x1a004f][_0xf955('0x13f')])||_['isNil'](_0x2e1d97[_0x1a004f][_0xf955('0x13f')]['phone'])){_0x2d96e2['emptyContact'](_0xf955('0x1c9'),_0x3a8c60,_0x2e1d97[_0x1a004f]);}else{_0x2d96e2[_0xf955('0xb1')](_[_0xf955('0x101')](_0x2e1d97[_0x1a004f],[_0xf955('0xc5'),_0xf955('0x1ca')]))[_0xf955('0xb0')](_0x2d96e2[_0xf955('0x1b4')](_0x3a8c60,_0x2e1d97[_0x1a004f]))['catch'](_0x2d96e2[_0xf955('0xbe')](_0xf955('0x1cb'),_0x3a8c60));}}}})[_0xf955('0xae')](loggerGetContactDialer('[getContactCampaign2]',_0x3a8c60,_0x15b0b0));}};Dialer[_0xf955('0x1b')]['handlePower']=function(_0x56156a,_0x576afd){var _0x33db30=this;var _0x4e6dae=[];var _0x49e688=_0x576afd>=0x1?_0x576afd:0x1;var _0x5dd8e6=[];if(_0x56156a[_0xf955('0x5f')]===_0xf955('0x7')){_0x49e688=0x1;}var _0x478c7e=Math[_0xf955('0x194')](_0x56156a[_0xf955('0x53')]*_0x49e688)-_0x56156a[_0xf955('0x77')]-_0x56156a[_0xf955('0x1c6')];emitVoiceQueueSummary(_0x56156a);if(_0x56156a[_0xf955('0x1cc')]>0x0){var _0x360c92=_0x56156a[_0xf955('0x1cc')]-_0x56156a['originated']-_0x56156a[_0xf955('0x1cd')]-_0x56156a[_0xf955('0x1c6')]-_0x56156a[_0xf955('0x55')];if(_0x478c7e>_0x360c92){_0x478c7e=_0x360c92;}}if(_0x478c7e>0x0){if(_0x56156a[_0xf955('0x5f')]===_0xf955('0x7')){_0x478c7e=0x1;}if(_0x478c7e>this[_0xf955('0x25')]){_0x478c7e=this[_0xf955('0x25')];}_0x56156a[_0xf955('0x1c6')]+=_0x478c7e;for(var _0x1ce002 in this[_0xf955('0x23')]){if(this[_0xf955('0x23')][_0xf955('0xbc')](_0x1ce002)){if(this[_0xf955('0x23')][_0x1ce002][_0xf955('0x9f')]===_0xf955('0x1ce')&&this[_0xf955('0x23')][_0x1ce002]['status']===_0xf955('0xcc')){_0x4e6dae['push'](this[_0xf955('0x23')][_0x1ce002]['id']);}}}this[_0xf955('0xb5')](_0x56156a['id'],_0x4e6dae,_0x478c7e,_0x56156a[_0xf955('0x1cf')])[_0xf955('0xb0')](function(_0x1b2415){_0x56156a[_0xf955('0x1c6')]-=_0x478c7e;_0x56156a['temp']=_0x56156a['temp']>0x0?_0x56156a[_0xf955('0x1c6')]:0x0;if(!checkContactEmpty(_0x1b2415)){_0x33db30['countReScheduled'](_0x56156a)[_0xf955('0xb0')](sendMessageReschedule(_0x56156a))[_0xf955('0xae')](loggerCatch(_0xf955('0x1d0')));}else{_0x56156a[_0xf955('0x77')]+=_0x1b2415[_0xf955('0x91')];_0x56156a[_0xf955('0x41')]=_0x56156a[_0xf955('0x5f')]===_0xf955('0x7')?_0xf955('0x146'):_0xf955('0x1c8');for(var _0x5eb630=0x0;_0x5eb630<_0x1b2415[_0xf955('0x91')];_0x5eb630+=0x1){if(_[_0xf955('0xa6')](_0x1b2415[_0x5eb630])||_[_0xf955('0xa6')](_0x1b2415[_0x5eb630][_0xf955('0x13f')])||_[_0xf955('0xa6')](_0x1b2415[_0x5eb630][_0xf955('0x13f')][_0xf955('0x140')])){_0x33db30['emptyContact']('[actionOriginate]\x20',_0x56156a,_0x1b2415[_0x5eb630]);}else{_0x33db30[_0xf955('0xaf')](_['pick'](_0x1b2415[_0x5eb630],[_0xf955('0xc4'),'Contact.phone']))[_0xf955('0xb0')](_0x33db30['checkContactBlack'](_0x56156a,_0x1b2415[_0x5eb630]))['catch'](_0x33db30[_0xf955('0xbe')](_0xf955('0x1c9'),_0x56156a));}}}})[_0xf955('0xae')](loggerGetContactDialer('[getContactDialer2]',_0x56156a,_0x478c7e));}};Dialer[_0xf955('0x1b')][_0xf955('0x8a')]=function(_0x263d48){var _0x1dbff2=this;if(_0x263d48[_0xf955('0x1cc')]>0x0){var _0x53e9d5=_0x263d48[_0xf955('0x1cc')]-_0x263d48[_0xf955('0x77')]-_0x263d48[_0xf955('0x1cd')];if(_0x53e9d5>0x0){this[_0xf955('0x1d1')](_0x263d48);}else{loggerPredictiveCalls[_0xf955('0x82')](_0xf955('0x1d2'));}}else{this[_0xf955('0x1d1')](_0x263d48);}};Dialer['prototype'][_0xf955('0x1d1')]=function(_0x4c9c4f){var _0x592d1b=this;var _0xcfcb5d=[];_0x4c9c4f[_0xf955('0x77')]+=0x1;for(var _0xb69b95 in this['agents']){if(this[_0xf955('0x23')][_0xf955('0xbc')](_0xb69b95)){if(this[_0xf955('0x23')][_0xb69b95]['state']===_0xf955('0x1ce')&&this[_0xf955('0x23')][_0xb69b95][_0xf955('0xcd')]==='reachable'){_0xcfcb5d[_0xf955('0x11f')](this[_0xf955('0x23')][_0xb69b95]['id']);}}}this[_0xf955('0xb5')](_0x4c9c4f['id'],_0xcfcb5d,0x1,_0x4c9c4f['dialOrderByScheduledAt'])['then'](function(_0x25b734){if(!checkContactEmpty(_0x25b734)){checkContactLowerLimitOriginate(_0x4c9c4f,0x1,0x0);_0x592d1b[_0xf955('0xac')](_0x4c9c4f)[_0xf955('0xb0')](sendMessageReschedule(_0x4c9c4f))[_0xf955('0xae')](loggerCatch(_0xf955('0x1d0')));}else{_0x4c9c4f[_0xf955('0x41')]=_0xf955('0x1c8');if(_['isNil'](_0x25b734[0x0])||_['isNil'](_0x25b734[0x0][_0xf955('0x13f')])||_['isNil'](_0x25b734[0x0][_0xf955('0x13f')][_0xf955('0x140')])){_0x592d1b[_0xf955('0xbf')](_0xf955('0x1c9'),_0x4c9c4f,_0x25b734[0x0]);}else{_0x592d1b['checkIsBlackList'](_[_0xf955('0x101')](_0x25b734[0x0],[_0xf955('0xc4'),_0xf955('0x1ca')]))['then'](_0x592d1b[_0xf955('0x1b4')](_0x4c9c4f,_0x25b734[0x0]))['catch'](_0x592d1b[_0xf955('0xbe')]('[actionOriginatePredictive]\x20',_0x4c9c4f));}}})[_0xf955('0xae')](loggerGetContactDialer(_0xf955('0x1d3'),_0x4c9c4f,0x1));emitVoiceQueueSummary(_0x4c9c4f);};Dialer['prototype'][_0xf955('0x1ab')]=function(_0x2a4441,_0x55a01d,_0x5b6aa7,_0x3a5035,_0x239773,_0x54a24a){loggerPredictive[_0xf955('0x82')](_0xf955('0x1d4'),_0xf955('0x1d5'),_0x2a4441,_0xf955('0x1d6'),_0x55a01d,_0xf955('0x1d7'),_0x5b6aa7,_0xf955('0x1d8'),_0x3a5035,_0xf955('0x1d9'),_0x239773);return new BPromise(function(_0x235d0f,_0x3405a1){if(_0x2a4441<=0x0||isNaN(_0x2a4441)){return _0x3405a1(msgResponse(_0xf955('0x1d4'),_0xf955('0x1da'),'m\x20=\x20'+_0x2a4441));}if(_0x5b6aa7<=0x0||isNaN(_0x5b6aa7)){return _0x3405a1(msgResponse(_0xf955('0x1d4'),'Error',_0xf955('0x1db')+_0x5b6aa7));}if(_0x3a5035<=0x0||isNaN(_0x3a5035)){return _0x3405a1(msgResponse('[abandonmentRate]','Error',_0xf955('0x1dc')+_0x3a5035));}if(_0x55a01d<=0x0||isNaN(_0x55a01d)){return _0x3405a1(msgResponse(_0xf955('0x1d4'),_0xf955('0x1da'),_0xf955('0x1dd')+_0x55a01d));}if(_0x239773<=0x0||isNaN(_0x239773)){return _0x3405a1(msgResponse(_0xf955('0x1d4'),_0xf955('0x1da'),'Amax\x20=\x20'+_0x239773));}_0x54a24a=_0x54a24a||0x0;var _0x29500d=0x1/_0x5b6aa7;var _0x2ed35c=0x0;var _0x3d9525=0x0;var _0xfd3991=0x0;var _0x277fe1=0x0;for(var _0x17c330=0x0;_0xfd3991<_0x239773;_0x17c330+=0x1){_0x3d9525=_0x17c330/_0x55a01d;_0x2ed35c=(_0x3a5035*_0x3d9525+_0x54a24a)/_0x29500d;_0xfd3991=erlangb(_0x2ed35c,_0x2a4441);_0x277fe1=_0x2ed35c/_0x2a4441*(0x1-erlangb(_0x2ed35c,_0x2a4441));}return _0x235d0f({'erlangCalls':_0x17c330,'erlangCallToSecond':_0x55a01d/_0x17c330,'erlangAbandonmentRate':_0xfd3991,'erlangBusyFactor':_0x277fe1});});};Dialer[_0xf955('0x1b')][_0xf955('0x1ad')]=function(_0x27f07b,_0x54c566,_0x4e890e,_0x4619eb,_0x25281a,_0xe9468){loggerPredictive[_0xf955('0x82')](_0xf955('0x1de'),_0xf955('0x1d5'),_0x27f07b,_0xf955('0x1d6'),_0x54c566,_0xf955('0x1d7'),_0x4e890e,_0xf955('0x1d8'),_0x4619eb,_0xf955('0x1df'),_0x25281a);return new BPromise(function(_0x66708c,_0x5d9dca){if(_0x27f07b<=0x0||isNaN(_0x27f07b)){return _0x5d9dca(msgResponse(_0xf955('0x1d4'),_0xf955('0x1da'),'m\x20=\x20'+_0x27f07b));}if(_0x4e890e<=0x0||isNaN(_0x4e890e)){return _0x5d9dca(msgResponse(_0xf955('0x1d4'),_0xf955('0x1da'),_0xf955('0x1db')+_0x4e890e));}if(_0x4619eb<=0x0||isNaN(_0x4619eb)){return _0x5d9dca(msgResponse(_0xf955('0x1d4'),_0xf955('0x1da'),'p\x20=\x20'+_0x4619eb));}if(_0x54c566<=0x0||isNaN(_0x54c566)){return _0x5d9dca(msgResponse(_0xf955('0x1d4'),_0xf955('0x1da'),_0xf955('0x1dd')+_0x54c566));}if(_0x25281a<=0x0||isNaN(_0x25281a)){return _0x5d9dca(msgResponse('[abandonmentRate]',_0xf955('0x1da'),_0xf955('0x1e0')+_0x25281a));}_0xe9468=_0xe9468||0x0;var _0x5582f2=0x1/_0x4e890e;var _0x3627f9=0x0;var _0x4ad144=0x0;var _0xcb9f21=0x0;var _0x28d631=0x0;for(var _0x2ecf1f=0x0;_0x28d631<_0x25281a;_0x2ecf1f+=0x1){_0x4ad144=_0x2ecf1f/_0x54c566;_0x3627f9=(_0x4619eb*_0x4ad144+_0xe9468)/_0x5582f2;_0xcb9f21=erlangb(_0x3627f9,_0x27f07b);_0x28d631=_0x3627f9/_0x27f07b*(0x1-erlangb(_0x3627f9,_0x27f07b));}return _0x66708c({'erlangCalls':_0x2ecf1f,'erlangCallToSecond':_0x54c566/_0x2ecf1f,'erlangAbandonmentRate':_0xcb9f21,'erlangBusyFactor':_0x28d631});});};module[_0xf955('0x1e1')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 4f484c8..4999455 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 _0xede0=['type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','uniqueid','name','number','responsetime','droptime','endtime','ringtime','starttime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','diff','seconds','scheduledat'];(function(_0x5a46ca,_0x3f30a5){var _0x1606db=function(_0x48a0a3){while(--_0x48a0a3){_0x5a46ca['push'](_0x5a46ca['shift']());}};_0x1606db(++_0x3f30a5);}(_0xede0,0x67));var _0x0ede=function(_0x2dfeb0,_0x33b9a4){_0x2dfeb0=_0x2dfeb0-0x0;var _0xd823ea=_0xede0[_0x2dfeb0];return _0xd823ea;};'use strict';var util=require(_0x0ede('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x37f735,_0x22a83a){var _0x573e39=moment(_0x37f735)[_0x0ede('0x1')](0x0);var _0x204df2=moment(_0x22a83a)[_0x0ede('0x1')](0x0);return _0x573e39[_0x0ede('0x2')](_0x204df2,_0x0ede('0x3'));}function QueueCallerAbandon(_0x59f068,_0x4d4001){this[_0x0ede('0x4')]=_0x59f068[_0x0ede('0x4')];this[_0x0ede('0x5')]=_0x59f068[_0x0ede('0x5')];this[_0x0ede('0x6')]=_0x59f068[_0x0ede('0x5')]===_0x0ede('0x7')?_0x0ede('0x8'):_0x59f068[_0x0ede('0x5')];this[_0x0ede('0x9')]=_0x59f068[_0x0ede('0x9')];this[_0x0ede('0xa')]=_0x59f068['countcongestionretry'];this[_0x0ede('0xb')]=_0x59f068[_0x0ede('0xb')];this[_0x0ede('0xc')]=_0x59f068[_0x0ede('0x9')]+_0x59f068[_0x0ede('0xa')]+_0x59f068['countnoanswerretry'];this[_0x0ede('0xd')]=_0x4d4001['uniqueid'];this['calleridname']=_0x59f068[_0x0ede('0xe')];this['calleridnum']=_0x59f068[_0x0ede('0xf')];this['starttime']=_0x59f068['starttime'];this[_0x0ede('0x10')]=_0x59f068[_0x0ede('0x10')];this[_0x0ede('0x11')]=_0x59f068[_0x0ede('0x11')];this[_0x0ede('0x12')]=this[_0x0ede('0x11')];this[_0x0ede('0x13')]=getSeconds(_0x59f068['responsetime'],_0x59f068[_0x0ede('0x14')]);this[_0x0ede('0x15')]=getSeconds(this[_0x0ede('0x11')],_0x59f068[_0x0ede('0x10')]);this[_0x0ede('0x16')]=0x0;this[_0x0ede('0x8')]=_0x4d4001[_0x0ede('0x8')];this[_0x0ede('0x17')]=_0x4d4001[_0x0ede('0x18')];this[_0x0ede('0x19')]=_0x4d4001[_0x0ede('0x19')];this[_0x0ede('0x1a')]=_0x59f068[_0x0ede('0x1a')];this[_0x0ede('0x1b')]=_0x59f068['callbackuniqueid'];this[_0x0ede('0x1c')]=_0x59f068['callbackat'];this[_0x0ede('0x1d')]=_0x59f068['recallme'];this['ContactId']=_0x59f068['ContactId'];this['ListId']=_0x59f068[_0x0ede('0x1e')];this[_0x0ede('0x1f')]=_0x59f068[_0x0ede('0x1f')];this['VoiceQueueId']=_0x59f068['VoiceQueueId'];this[_0x0ede('0x20')]=_0x59f068['CampaignId'];this['originatecalleridnum']=_0x59f068[_0x0ede('0x21')]||'';this[_0x0ede('0x22')]=_0x59f068[_0x0ede('0x22')]||'';}module[_0x0ede('0x23')]=QueueCallerAbandon; \ No newline at end of file +var _0xc2f2=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','uniqueid','calleridname','calleridnum','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','scheduledat','type','campaigntype'];(function(_0x275567,_0x12c032){var _0x28341c=function(_0x39b911){while(--_0x39b911){_0x275567['push'](_0x275567['shift']());}};_0x28341c(++_0x12c032);}(_0xc2f2,0x14f));var _0x2c2f=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xc2f2[_0x521929];return _0x632436;};'use strict';var util=require('util');var _=require(_0x2c2f('0x0'));var moment=require(_0x2c2f('0x1'));function getSeconds(_0x4a2b25,_0x31fea9){var _0xf39ae1=moment(_0x4a2b25)[_0x2c2f('0x2')](0x0);var _0x342017=moment(_0x31fea9)[_0x2c2f('0x2')](0x0);return _0xf39ae1[_0x2c2f('0x3')](_0x342017,'seconds');}function QueueCallerAbandon(_0x4b31b3,_0x55f604){this[_0x2c2f('0x4')]=_0x4b31b3['scheduledat'];this[_0x2c2f('0x5')]=_0x4b31b3[_0x2c2f('0x5')];this[_0x2c2f('0x6')]=_0x4b31b3['type']===_0x2c2f('0x7')?_0x2c2f('0x8'):_0x4b31b3[_0x2c2f('0x5')];this[_0x2c2f('0x9')]=_0x4b31b3[_0x2c2f('0x9')];this[_0x2c2f('0xa')]=_0x4b31b3['countcongestionretry'];this[_0x2c2f('0xb')]=_0x4b31b3[_0x2c2f('0xb')];this[_0x2c2f('0xc')]=_0x4b31b3[_0x2c2f('0x9')]+_0x4b31b3[_0x2c2f('0xa')]+_0x4b31b3['countnoanswerretry'];this[_0x2c2f('0xd')]=_0x55f604[_0x2c2f('0xd')];this[_0x2c2f('0xe')]=_0x4b31b3['name'];this[_0x2c2f('0xf')]=_0x4b31b3['number'];this[_0x2c2f('0x10')]=_0x4b31b3[_0x2c2f('0x10')];this[_0x2c2f('0x11')]=_0x4b31b3[_0x2c2f('0x11')];this['droptime']=_0x4b31b3[_0x2c2f('0x12')];this[_0x2c2f('0x13')]=this[_0x2c2f('0x12')];this[_0x2c2f('0x14')]=getSeconds(_0x4b31b3[_0x2c2f('0x11')],_0x4b31b3[_0x2c2f('0x10')]);this[_0x2c2f('0x15')]=getSeconds(this[_0x2c2f('0x12')],_0x4b31b3[_0x2c2f('0x11')]);this[_0x2c2f('0x16')]=0x0;this['queue']=_0x55f604[_0x2c2f('0x8')];this[_0x2c2f('0x17')]=_0x55f604[_0x2c2f('0x18')];this[_0x2c2f('0x19')]=_0x55f604['reason'];this[_0x2c2f('0x1a')]=_0x4b31b3['callback'];this[_0x2c2f('0x1b')]=_0x4b31b3[_0x2c2f('0x1b')];this[_0x2c2f('0x1c')]=_0x4b31b3[_0x2c2f('0x1c')];this[_0x2c2f('0x1d')]=_0x4b31b3['recallme'];this[_0x2c2f('0x1e')]=_0x4b31b3[_0x2c2f('0x1e')];this[_0x2c2f('0x1f')]=_0x4b31b3[_0x2c2f('0x1f')];this[_0x2c2f('0x20')]=_0x4b31b3[_0x2c2f('0x20')];this[_0x2c2f('0x21')]=_0x4b31b3[_0x2c2f('0x21')];this[_0x2c2f('0x22')]=_0x4b31b3[_0x2c2f('0x22')];this[_0x2c2f('0x23')]=_0x4b31b3[_0x2c2f('0x23')]||'';this[_0x2c2f('0x24')]=_0x4b31b3[_0x2c2f('0x24')]||'';}module[_0x2c2f('0x25')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 5ef65ad..6d46fd9 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 _0xe497=['Trunk','name','fax','localstationid','headerinfo','path','AttachmentId','util','moment','uniqueid','%s/%s/%s','tech'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe497,0x11b));var _0x7e49=function(_0x3ea83b,_0x13ece2){_0x3ea83b=_0x3ea83b-0x0;var _0x56415d=_0xe497[_0x3ea83b];return _0x56415d;};'use strict';var util=require(_0x7e49('0x0'));var _=require('lodash');var moment=require(_0x7e49('0x1'));function Action(_0x48a789,_0x2eb412,_0x5c7878){this[_0x7e49('0x2')]=_0x48a789||undefined;this['channel']=util['format'](_0x7e49('0x3'),_0x2eb412[_0x7e49('0x4')],_0x2eb412[_0x7e49('0x5')][_0x7e49('0x6')],_0x5c7878[_0x7e49('0x7')]);this[_0x7e49('0x8')]=_0x2eb412[_0x7e49('0x8')];this['headerinfo']=_0x2eb412[_0x7e49('0x9')];this[_0x7e49('0xa')]=_0x5c7878['path'];this['AttachmentId']=_0x5c7878[_0x7e49('0xb')];}module['exports']=Action; \ No newline at end of file +var _0xb904=['exports','util','lodash','moment','uniqueid','channel','%s/%s/%s','fax','localstationid','headerinfo','path','AttachmentId'];(function(_0x1afd5e,_0x5bf97a){var _0x21e210=function(_0x3f0bff){while(--_0x3f0bff){_0x1afd5e['push'](_0x1afd5e['shift']());}};_0x21e210(++_0x5bf97a);}(_0xb904,0x115));var _0x4b90=function(_0x1ab7de,_0x36992b){_0x1ab7de=_0x1ab7de-0x0;var _0x9bc1db=_0xb904[_0x1ab7de];return _0x9bc1db;};'use strict';var util=require(_0x4b90('0x0'));var _=require(_0x4b90('0x1'));var moment=require(_0x4b90('0x2'));function Action(_0xa55110,_0xa97cfc,_0x32a7d5){this[_0x4b90('0x3')]=_0xa55110||undefined;this[_0x4b90('0x4')]=util['format'](_0x4b90('0x5'),_0xa97cfc['tech'],_0xa97cfc['Trunk']['name'],_0x32a7d5[_0x4b90('0x6')]);this['localstationid']=_0xa97cfc[_0x4b90('0x7')];this[_0x4b90('0x8')]=_0xa97cfc[_0x4b90('0x8')];this[_0x4b90('0x9')]=_0x32a7d5[_0x4b90('0x9')];this[_0x4b90('0xa')]=_0x32a7d5[_0x4b90('0xa')];}module[_0x4b90('0xb')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index ba47734..580edb9 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 _0x2d73=['util','lodash','bluebird','uuid','path','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','bind','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','actions','\x20syncNewchannel\x20','value','channelstate','channelstatedesc','variable','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','.pdf','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','AttachmentId','update','SENDING\x20FAILED\x20','then','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','faxpages','faxstatusstring','SENDING\x20FAILED','send','execOriginate','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','unmonitored','checkTrunk','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports'];(function(_0x4aa4e6,_0x278c45){var _0x322588=function(_0x19279d){while(--_0x19279d){_0x4aa4e6['push'](_0x4aa4e6['shift']());}};_0x322588(++_0x278c45);}(_0x2d73,0x78));var _0x32d7=function(_0x22ee1e,_0x3eff80){_0x22ee1e=_0x22ee1e-0x0;var _0x49a5c9=_0x2d73[_0x22ee1e];return _0x49a5c9;};'use strict';var util=require(_0x32d7('0x0'));var _=require(_0x32d7('0x1'));var BPromise=require(_0x32d7('0x2'));var uuid=require(_0x32d7('0x3'));var moment=require('moment');var path=require(_0x32d7('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x32d7('0x5'));var logger=require(_0x32d7('0x6'))(_0x32d7('0x7'));var ami=require(_0x32d7('0x8'));var rpcDb=require(_0x32d7('0x9'));var Channel=require(_0x32d7('0xa'));var ut=require(_0x32d7('0xb'));var Action=require(_0x32d7('0xc'));var faxAccount=require(_0x32d7('0xd'));var attachment=require(_0x32d7('0xe'));var faxMessage=require(_0x32d7('0xf'));function Fax(_0x1dbfc9){this[_0x32d7('0x10')]={};this[_0x32d7('0x11')]=_0x1dbfc9[_0x32d7('0x11')];this[_0x32d7('0x12')]=_0x1dbfc9['trunks'];this['actions']={};ami['on'](_0x32d7('0x13'),this[_0x32d7('0x14')][_0x32d7('0x15')](this));ami['on']('varset',this[_0x32d7('0x16')][_0x32d7('0x15')](this));ami['on'](_0x32d7('0x17'),this[_0x32d7('0x18')][_0x32d7('0x15')](this));ami['on'](_0x32d7('0x19'),this[_0x32d7('0x1a')][_0x32d7('0x15')](this));ami['on'](_0x32d7('0x1b'),this[_0x32d7('0x1c')][_0x32d7('0x15')](this));ami['on'](_0x32d7('0x1d'),this[_0x32d7('0x1e')][_0x32d7('0x15')](this));ami['on'](_0x32d7('0x1f'),this[_0x32d7('0x20')][_0x32d7('0x15')](this));ami['on'](_0x32d7('0x21'),this[_0x32d7('0x22')][_0x32d7('0x15')](this));}Fax[_0x32d7('0x23')][_0x32d7('0x14')]=function(_0x339b1f){if(_0x339b1f['context']===_0x32d7('0x24')){for(var _0x2e1c67 in this['faxAccounts']){if(this[_0x32d7('0x11')][_0x32d7('0x25')](_0x2e1c67)){if(_0x339b1f[_0x32d7('0x26')]===this['faxAccounts'][_0x2e1c67][_0x32d7('0x27')]){this[_0x32d7('0x10')][_0x339b1f['uniqueid']]={};this[_0x32d7('0x10')][_0x339b1f[_0x32d7('0x28')]][_0x32d7('0x29')]=_0x339b1f[_0x32d7('0x29')];this[_0x32d7('0x10')][_0x339b1f[_0x32d7('0x28')]]['id']=this[_0x32d7('0x11')][_0x2e1c67]['id'];this[_0x32d7('0x10')][_0x339b1f['uniqueid']][_0x32d7('0x2a')]=this[_0x32d7('0x11')][_0x2e1c67][_0x32d7('0x2a')];logger[_0x32d7('0x2b')](_0x339b1f[_0x32d7('0x28')],'\x20syncNewchannel\x20');}}}}if(this[_0x32d7('0x2c')][_0x339b1f[_0x32d7('0x28')]]){this['channels'][_0x339b1f[_0x32d7('0x28')]]={};this[_0x32d7('0x10')][_0x339b1f['uniqueid']]['channel']=_0x339b1f[_0x32d7('0x29')];logger['info'](_0x339b1f[_0x32d7('0x28')],_0x32d7('0x2d'));}};Fax['prototype'][_0x32d7('0x16')]=function(_0x287b77){if(this[_0x32d7('0x10')][_0x287b77['uniqueid']]){for(var _0x3828ed in _0x287b77['variable']){if(_0x287b77['variable'][_0x32d7('0x25')](_0x3828ed)){this[_0x32d7('0x10')][_0x287b77[_0x32d7('0x28')]][_0x3828ed]=_0x287b77[_0x32d7('0x2e')];}}}};Fax['prototype'][_0x32d7('0x18')]=function(_0x572fde){if(this[_0x32d7('0x10')][_0x572fde[_0x32d7('0x28')]]){this['channels'][_0x572fde['uniqueid']][_0x32d7('0x2f')]=_0x572fde[_0x32d7('0x2f')];this[_0x32d7('0x10')][_0x572fde[_0x32d7('0x28')]][_0x32d7('0x30')]=_0x572fde[_0x32d7('0x30')];}};Fax[_0x32d7('0x23')][_0x32d7('0x1a')]=function(_0x5bb195){if(this[_0x32d7('0x10')][_0x5bb195[_0x32d7('0x28')]]){for(var _0x371769 in _0x5bb195[_0x32d7('0x31')]){if(_0x5bb195['variable']['hasOwnProperty'](_0x371769)){this[_0x32d7('0x10')][_0x5bb195[_0x32d7('0x28')]][_0x371769]=_0x5bb195[_0x32d7('0x2e')];}}}};Fax['prototype']['syncFaxStatus']=function(_0x23b2a1){if(this[_0x32d7('0x10')][_0x23b2a1['uniqueid']]){this[_0x32d7('0x10')][_0x23b2a1['uniqueid']][_0x32d7('0x32')]=_0x23b2a1[_0x32d7('0x32')];this[_0x32d7('0x10')][_0x23b2a1[_0x32d7('0x28')]][_0x32d7('0x33')]=_0x23b2a1[_0x32d7('0x33')];this[_0x32d7('0x10')][_0x23b2a1['uniqueid']]['localstationid']=_0x23b2a1[_0x32d7('0x27')];this[_0x32d7('0x10')][_0x23b2a1[_0x32d7('0x28')]][_0x32d7('0x34')]=_0x23b2a1[_0x32d7('0x34')];logger[_0x32d7('0x2b')](_0x23b2a1[_0x32d7('0x28')],'\x20syncFaxStatus\x20');}};Fax['prototype']['syncReceiveFax']=function(_0x54be40){var _0x4b5039=this;if(this[_0x32d7('0x10')][_0x54be40[_0x32d7('0x28')]]){var _0x502425=this[_0x32d7('0x10')][_0x54be40[_0x32d7('0x28')]]['id'];this[_0x32d7('0x10')][_0x54be40['uniqueid']][_0x32d7('0x35')]=_0x54be40['remotestationid'];this[_0x32d7('0x10')][_0x54be40['uniqueid']]['pagestransferred']=_0x54be40[_0x32d7('0x36')];this[_0x32d7('0x10')][_0x54be40['uniqueid']]['localstationid']=_0x54be40[_0x32d7('0x27')];this[_0x32d7('0x10')][_0x54be40[_0x32d7('0x28')]][_0x32d7('0x37')]=_0x54be40[_0x32d7('0x37')];this['channels'][_0x54be40[_0x32d7('0x28')]]['transferrate']=_0x54be40[_0x32d7('0x38')];this[_0x32d7('0x10')][_0x54be40[_0x32d7('0x28')]][_0x32d7('0x34')]=_0x54be40['filename'];this[_0x32d7('0x10')][_0x54be40['uniqueid']][_0x32d7('0x39')]=_0x54be40[_0x32d7('0x39')];if(this[_0x32d7('0x10')][_0x54be40[_0x32d7('0x28')]][_0x32d7('0x36')]>0x0){tiff2pdf(_0x54be40[_0x32d7('0x34')],_0x32d7('0x3a'),function(_0x3f1bc5){logger['info'](_0x54be40[_0x32d7('0x28')],_0x32d7('0x3b'),_0x3f1bc5['message']);attachment[_0x32d7('0x3c')]({'name':path['parse'](_0x54be40['filename'])[_0x32d7('0x2a')],'basename':path[_0x32d7('0x3d')](_0x54be40['filename'])[_0x32d7('0x2a')]+_0x32d7('0x3e'),'type':'application/pdf'})['then'](function(_0x37b204){faxAccount[_0x32d7('0x3f')](_0x502425,{'from':_0x54be40[_0x32d7('0x39')],'mapKey':_0x32d7('0x7'),'body':path[_0x32d7('0x3d')](_0x54be40[_0x32d7('0x34')])[_0x32d7('0x2a')]+_0x32d7('0x3e'),'AttachmentId':_0x37b204['id']})[_0x32d7('0x40')](function(_0x1452c1){logger[_0x32d7('0x41')](_0x54be40[_0x32d7('0x28')],_0x32d7('0x42'),JSON['stringify'](_0x1452c1));});})[_0x32d7('0x40')](function(_0x5b7621){logger['error'](_0x54be40['uniqueid'],'\x20receiveFax\x20',JSON[_0x32d7('0x43')](_0x5b7621));});});}logger[_0x32d7('0x2b')](_0x54be40[_0x32d7('0x28')],_0x32d7('0x44'));}};Fax[_0x32d7('0x23')]['syncOriginateResponse']=function(_0x43b3b5){if(this['actions'][_0x43b3b5[_0x32d7('0x28')]]){_[_0x32d7('0x45')](this[_0x32d7('0x10')][_0x43b3b5[_0x32d7('0x28')]],_[_0x32d7('0x46')](_0x43b3b5,['response','reason']));}};function updateStatus(_0x3f5b2b){if(_0x3f5b2b[_0x32d7('0x47')]){faxMessage[_0x32d7('0x48')](_0x3f5b2b['AttachmentId'],{'failMessage':_0x32d7('0x49')})[_0x32d7('0x4a')](function(_0x1a22fd){ut[_0x32d7('0x4b')](_0x32d7('0x4c'),_0x1a22fd);})['catch'](function(_0x384d73){ut['logger'](_0x32d7('0x4d'),_0x384d73);});}else{ut[_0x32d7('0x4b')](_0x32d7('0x4e'));}}Fax[_0x32d7('0x23')]['updateStatus']=function(_0xa8a7c2,_0x3d88a7,_0x461be8){var _0x2c09df=this;var _0x157aa3={};if(_0x3d88a7){_0x157aa3={'read':_0x3d88a7};}else{_0x157aa3={'failMessage':_0x461be8};}if(this[_0x32d7('0x2c')][_0xa8a7c2][_0x32d7('0x47')]){faxMessage['update'](this[_0x32d7('0x2c')][_0xa8a7c2]['AttachmentId'],_0x157aa3)[_0x32d7('0x4a')](function(_0x2d2721){ut['logger'](_0x32d7('0x4f'),_0x2d2721);})[_0x32d7('0x40')](function(_0x325b5f){ut['logger'](_0x32d7('0x50'),_0x325b5f);})[_0x32d7('0x51')](function(){delete _0x2c09df['channels'][_0xa8a7c2];delete _0x2c09df[_0x32d7('0x2c')][_0xa8a7c2];});}else{ut[_0x32d7('0x4b')](_0x32d7('0x52'));delete this[_0x32d7('0x10')][_0xa8a7c2];delete this[_0x32d7('0x2c')][_0xa8a7c2];}};Fax[_0x32d7('0x23')][_0x32d7('0x20')]=function(_0x2615ad){var _0x5ed3b8=this;if(this['channels'][_0x2615ad['uniqueid']]){if(this[_0x32d7('0x2c')][_0x2615ad['uniqueid']]){this[_0x32d7('0x10')][_0x2615ad[_0x32d7('0x28')]]['id']=this[_0x32d7('0x2c')][_0x2615ad[_0x32d7('0x28')]]['id'];this[_0x32d7('0x10')][_0x2615ad[_0x32d7('0x28')]]['name']=this[_0x32d7('0x2c')][_0x2615ad['uniqueid']][_0x32d7('0x2a')];}logger['info'](_0x2615ad[_0x32d7('0x28')],this['actions'][_0x2615ad[_0x32d7('0x28')]]?_0x32d7('0x53'):'\x20hangup\x20faxRiceive\x20',JSON['stringify'](this[_0x32d7('0x10')][_0x2615ad[_0x32d7('0x28')]]));if(this['actions'][_0x2615ad[_0x32d7('0x28')]]){if(this['channels'][_0x2615ad[_0x32d7('0x28')]][_0x32d7('0x54')]>0x0&&this[_0x32d7('0x10')][_0x2615ad[_0x32d7('0x28')]][_0x32d7('0x1b')]==='SUCCESS'){this['updateStatus'](_0x2615ad[_0x32d7('0x28')],!![]);}else{this['updateStatus'](_0x2615ad['uniqueid'],![],this[_0x32d7('0x10')][_0x2615ad[_0x32d7('0x28')]][_0x32d7('0x55')]?'SENDING\x20FAILED:\x20'+this[_0x32d7('0x10')][_0x2615ad['uniqueid']][_0x32d7('0x55')]:_0x32d7('0x56'));}}}};Fax[_0x32d7('0x23')][_0x32d7('0x57')]=function(_0x4691a8){var _0x12bbdc=this;return new BPromise(function(_0x3ff8d3,_0x333f2f){_0x12bbdc[_0x32d7('0x58')](_0x4691a8,_0x12bbdc[_0x32d7('0x11')][_0x4691a8['FaxAccountId']])[_0x32d7('0x4a')](function(_0x3a381d){ut[_0x32d7('0x4b')]('[Fax][execOriginate][success]',_0x3a381d);_0x3ff8d3(ut[_0x32d7('0x59')](_0x32d7('0x5a')));})[_0x32d7('0x40')](function(_0x2cebcc){ut[_0x32d7('0x4b')](_0x32d7('0x5b'),_0x2cebcc);updateStatus(_0x4691a8);_0x333f2f(ut[_0x32d7('0x59')](_0x32d7('0x5c')));});});};Fax[_0x32d7('0x23')][_0x32d7('0x5d')]=function(_0x36d597){var _0x4a9d8d=this;return new BPromise(function(_0x52be88,_0x5a7b4a){var _0xa580ac=_0x4a9d8d['checkTrunk'](_0x4a9d8d[_0x32d7('0x11')][_0x36d597[_0x32d7('0x5e')]][_0x32d7('0x5f')],_0x36d597);if(_0xa580ac[_0x32d7('0x60')]){_0x52be88(ut[_0x32d7('0x59')](_0x32d7('0x61')));}else{_0x5a7b4a(ut[_0x32d7('0x59')](_0xa580ac[_0x32d7('0x59')]));}});};function originate(_0x40a487,_0x5f107d,_0x59e3ad){return new BPromise(function(_0x4c5257,_0x21e73a){if(_0x59e3ad){var _0x34c7f6=util[_0x32d7('0x62')](_0x32d7('0x63'),path['parse'](_0x40a487[_0x32d7('0x4')])['name'],_0x40a487[_0x32d7('0x4')]);gs[_0x32d7('0x64')](_0x34c7f6)['then'](function(){_0x40a487[_0x32d7('0x4')]=util[_0x32d7('0x62')](_0x32d7('0x65'),path[_0x32d7('0x3d')](_0x40a487[_0x32d7('0x4')])['dir'],path['parse'](_0x40a487['path'])['name']);_0x5f107d[_0x32d7('0x66')]=_0x40a487[_0x32d7('0x4')];ut[_0x32d7('0x4b')](_0x32d7('0x67'),'');ami[_0x32d7('0x68')](ut[_0x32d7('0x69')](_0x40a487,_0x5f107d))[_0x32d7('0x4a')](function(_0x3766d5){_0x4c5257(_0x3766d5);})['catch'](function(_0xff82a7){_0x21e73a(_0xff82a7);});})[_0x32d7('0x40')](function(_0x1843bd){_0x21e73a(_0x1843bd);});}else{ami['Action'](ut[_0x32d7('0x69')](_0x40a487,_0x5f107d))[_0x32d7('0x4a')](function(_0x25f3e7){_0x4c5257(_0x25f3e7);})[_0x32d7('0x40')](function(_0x181900){_0x21e73a(_0x181900);});}});}Fax[_0x32d7('0x23')][_0x32d7('0x58')]=function(_0x1ddfa4,_0x2a917f){var _0x45037e=this;return new BPromise(function(_0x4763c8,_0x1c0325){var _0x1a1544=uuid['v4']();var _0x25842c=ut[_0x32d7('0x6a')](_0x1ddfa4,_0x2a917f);_0x45037e[_0x32d7('0x2c')][_0x1a1544]=new Action(_0x1a1544,_0x2a917f,_0x1ddfa4);var _0x4e177b=_0x45037e[_0x32d7('0x2c')][_0x1a1544];if(path[_0x32d7('0x3d')](_0x1ddfa4[_0x32d7('0x4')])['ext']===_0x32d7('0x3e')){originate(_0x4e177b,_0x25842c,!![])[_0x32d7('0x4a')](function(_0x1e5bd8){_0x4763c8(_0x1e5bd8);})[_0x32d7('0x40')](function(_0x45874f){_0x1c0325(_0x45874f);});}else{originate(_0x4e177b,_0x25842c,![])[_0x32d7('0x4a')](function(_0x5cb53c){_0x4763c8(_0x5cb53c);})['catch'](function(_0x4de872){_0x1c0325(_0x4de872);});}});};Fax[_0x32d7('0x23')][_0x32d7('0x6b')]=function(_0x5ac361){return!_[_0x32d7('0x6c')](_0x5ac361)&&!_[_0x32d7('0x6c')](_0x5ac361[_0x32d7('0x2a')])&&!_[_0x32d7('0x6c')](_0x5ac361[_0x32d7('0x6d')])&&_0x5ac361[_0x32d7('0x6d')]&&!_[_0x32d7('0x6c')](this[_0x32d7('0x12')][util[_0x32d7('0x62')](_0x32d7('0x6e'),_0x5ac361['name'])])&&!_['isNil'](this['trunks'][util['format'](_0x32d7('0x6e'),_0x5ac361['name'])][_0x32d7('0x33')])&&(this['trunks'][util['format'](_0x32d7('0x6e'),_0x5ac361['name'])]['status']==='reachable'||this[_0x32d7('0x12')][util[_0x32d7('0x62')]('SIP/%s',_0x5ac361['name'])]['status']===_0x32d7('0x6f'));};Fax[_0x32d7('0x23')][_0x32d7('0x70')]=function(_0xc9b3,_0x4f02f8){if(!this['isTrunkReachable'](_0xc9b3)){ut['logger']('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x32d7('0x6c')](_0xc9b3)?'':_0xc9b3['name']+_0x32d7('0x71'));return{'isValid':![],'message':_0x32d7('0x72')};}if(_[_0x32d7('0x6c')](_0x4f02f8['fax'])){ut[_0x32d7('0x4b')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x32d7('0x43')](_0x4f02f8));return{'isValid':![],'message':_0x32d7('0x73')};}if(_[_0x32d7('0x6c')](_0x4f02f8[_0x32d7('0x4')])){ut[_0x32d7('0x4b')](_0x32d7('0x74'),JSON['stringify'](_0x4f02f8));return{'isValid':![],'message':_0x32d7('0x75')};}return{'isValid':!![],'message':_0x32d7('0x76')};};module[_0x32d7('0x77')]=Fax; \ No newline at end of file +var _0x05d4=['status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','\x20receiveFax\x20','stringify','merge','pick','response','reason','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','updateStatus','AttachmentId','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','send','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','format','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','./util/gs','../../../config/logger','fax','./rpcDb','./action','../rpc/faxMessage','channels','faxAccounts','trunks','varset','newstate','newexten','syncNewExten','bind','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','syncNewchannel','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','variable','syncNewState','channelstate','channelstatedesc','operation'];(function(_0x204a08,_0x2c9eaf){var _0x1a243d=function(_0x2aa702){while(--_0x2aa702){_0x204a08['push'](_0x204a08['shift']());}};_0x1a243d(++_0x2c9eaf);}(_0x05d4,0xba));var _0x405d=function(_0x43e0a7,_0x379636){_0x43e0a7=_0x43e0a7-0x0;var _0xe4d4f1=_0x05d4[_0x43e0a7];return _0xe4d4f1;};'use strict';var util=require(_0x405d('0x0'));var _=require(_0x405d('0x1'));var BPromise=require(_0x405d('0x2'));var uuid=require(_0x405d('0x3'));var moment=require(_0x405d('0x4'));var path=require('path');var tiff2pdf=require('tiff2pdf');var gs=require(_0x405d('0x5'));var logger=require(_0x405d('0x6'))(_0x405d('0x7'));var ami=require('../ami');var rpcDb=require(_0x405d('0x8'));var Channel=require('./channel');var ut=require('./util/util');var Action=require(_0x405d('0x9'));var faxAccount=require('../rpc/faxAccount');var attachment=require('../rpc/attachment');var faxMessage=require(_0x405d('0xa'));function Fax(_0x49f16a){this[_0x405d('0xb')]={};this[_0x405d('0xc')]=_0x49f16a[_0x405d('0xc')];this[_0x405d('0xd')]=_0x49f16a['trunks'];this['actions']={};ami['on']('newchannel',this['syncNewchannel']['bind'](this));ami['on'](_0x405d('0xe'),this['syncVarSet']['bind'](this));ami['on'](_0x405d('0xf'),this['syncNewState']['bind'](this));ami['on'](_0x405d('0x10'),this[_0x405d('0x11')][_0x405d('0x12')](this));ami['on'](_0x405d('0x13'),this[_0x405d('0x14')][_0x405d('0x12')](this));ami['on'](_0x405d('0x15'),this[_0x405d('0x16')][_0x405d('0x12')](this));ami['on'](_0x405d('0x17'),this[_0x405d('0x18')]['bind'](this));ami['on'](_0x405d('0x19'),this[_0x405d('0x1a')]['bind'](this));}Fax[_0x405d('0x1b')][_0x405d('0x1c')]=function(_0x4fefd7){if(_0x4fefd7['context']==='from-voip-provider'){for(var _0x3d9a3f in this[_0x405d('0xc')]){if(this['faxAccounts'][_0x405d('0x1d')](_0x3d9a3f)){if(_0x4fefd7['exten']===this[_0x405d('0xc')][_0x3d9a3f][_0x405d('0x1e')]){this[_0x405d('0xb')][_0x4fefd7[_0x405d('0x1f')]]={};this['channels'][_0x4fefd7[_0x405d('0x1f')]][_0x405d('0x20')]=_0x4fefd7[_0x405d('0x20')];this[_0x405d('0xb')][_0x4fefd7[_0x405d('0x1f')]]['id']=this['faxAccounts'][_0x3d9a3f]['id'];this['channels'][_0x4fefd7[_0x405d('0x1f')]][_0x405d('0x21')]=this[_0x405d('0xc')][_0x3d9a3f][_0x405d('0x21')];logger[_0x405d('0x22')](_0x4fefd7['uniqueid'],_0x405d('0x23'));}}}}if(this[_0x405d('0x24')][_0x4fefd7[_0x405d('0x1f')]]){this[_0x405d('0xb')][_0x4fefd7[_0x405d('0x1f')]]={};this[_0x405d('0xb')][_0x4fefd7[_0x405d('0x1f')]][_0x405d('0x20')]=_0x4fefd7[_0x405d('0x20')];logger[_0x405d('0x22')](_0x4fefd7[_0x405d('0x1f')],_0x405d('0x23'));}};Fax[_0x405d('0x1b')]['syncVarSet']=function(_0x313cec){if(this[_0x405d('0xb')][_0x313cec['uniqueid']]){for(var _0x58a6d2 in _0x313cec[_0x405d('0x25')]){if(_0x313cec['variable'][_0x405d('0x1d')](_0x58a6d2)){this[_0x405d('0xb')][_0x313cec[_0x405d('0x1f')]][_0x58a6d2]=_0x313cec['value'];}}}};Fax[_0x405d('0x1b')][_0x405d('0x26')]=function(_0xf724bf){if(this[_0x405d('0xb')][_0xf724bf[_0x405d('0x1f')]]){this['channels'][_0xf724bf[_0x405d('0x1f')]]['channelstate']=_0xf724bf[_0x405d('0x27')];this[_0x405d('0xb')][_0xf724bf[_0x405d('0x1f')]][_0x405d('0x28')]=_0xf724bf['channelstatedesc'];}};Fax[_0x405d('0x1b')][_0x405d('0x11')]=function(_0x368781){if(this[_0x405d('0xb')][_0x368781[_0x405d('0x1f')]]){for(var _0xa932 in _0x368781['variable']){if(_0x368781[_0x405d('0x25')]['hasOwnProperty'](_0xa932)){this['channels'][_0x368781['uniqueid']][_0xa932]=_0x368781['value'];}}}};Fax[_0x405d('0x1b')][_0x405d('0x14')]=function(_0x55d322){if(this[_0x405d('0xb')][_0x55d322['uniqueid']]){this[_0x405d('0xb')][_0x55d322['uniqueid']][_0x405d('0x29')]=_0x55d322[_0x405d('0x29')];this['channels'][_0x55d322['uniqueid']][_0x405d('0x2a')]=_0x55d322[_0x405d('0x2a')];this[_0x405d('0xb')][_0x55d322[_0x405d('0x1f')]][_0x405d('0x1e')]=_0x55d322[_0x405d('0x1e')];this[_0x405d('0xb')][_0x55d322[_0x405d('0x1f')]][_0x405d('0x2b')]=_0x55d322[_0x405d('0x2b')];logger[_0x405d('0x22')](_0x55d322[_0x405d('0x1f')],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0x405d('0x16')]=function(_0x492e89){var _0x34e7d4=this;if(this[_0x405d('0xb')][_0x492e89[_0x405d('0x1f')]]){var _0x2c14a4=this[_0x405d('0xb')][_0x492e89[_0x405d('0x1f')]]['id'];this[_0x405d('0xb')][_0x492e89[_0x405d('0x1f')]]['remotestationid']=_0x492e89[_0x405d('0x2c')];this[_0x405d('0xb')][_0x492e89[_0x405d('0x1f')]][_0x405d('0x2d')]=_0x492e89['pagestransferred'];this[_0x405d('0xb')][_0x492e89['uniqueid']][_0x405d('0x1e')]=_0x492e89[_0x405d('0x1e')];this['channels'][_0x492e89[_0x405d('0x1f')]][_0x405d('0x2e')]=_0x492e89[_0x405d('0x2e')];this[_0x405d('0xb')][_0x492e89[_0x405d('0x1f')]]['transferrate']=_0x492e89[_0x405d('0x2f')];this['channels'][_0x492e89[_0x405d('0x1f')]][_0x405d('0x2b')]=_0x492e89['filename'];this[_0x405d('0xb')][_0x492e89[_0x405d('0x1f')]][_0x405d('0x30')]=_0x492e89[_0x405d('0x30')];if(this['channels'][_0x492e89[_0x405d('0x1f')]]['pagestransferred']>0x0){tiff2pdf(_0x492e89['filename'],'/var/opt/motion2/server/files/attachments/',function(_0x56ed39){logger[_0x405d('0x22')](_0x492e89[_0x405d('0x1f')],_0x405d('0x31'),_0x56ed39[_0x405d('0x32')]);attachment[_0x405d('0x33')]({'name':path[_0x405d('0x34')](_0x492e89[_0x405d('0x2b')])['name'],'basename':path[_0x405d('0x34')](_0x492e89['filename'])[_0x405d('0x21')]+_0x405d('0x35'),'type':_0x405d('0x36')})[_0x405d('0x37')](function(_0x4ac413){faxAccount[_0x405d('0x38')](_0x2c14a4,{'from':_0x492e89[_0x405d('0x30')],'mapKey':_0x405d('0x7'),'body':path['parse'](_0x492e89[_0x405d('0x2b')])[_0x405d('0x21')]+_0x405d('0x35'),'AttachmentId':_0x4ac413['id']})[_0x405d('0x39')](function(_0x217902){logger[_0x405d('0x3a')](_0x492e89['uniqueid'],_0x405d('0x3b'),JSON['stringify'](_0x217902));});})[_0x405d('0x39')](function(_0x286cd1){logger[_0x405d('0x3a')](_0x492e89[_0x405d('0x1f')],_0x405d('0x3c'),JSON[_0x405d('0x3d')](_0x286cd1));});});}logger[_0x405d('0x22')](_0x492e89[_0x405d('0x1f')],_0x405d('0x3c'));}};Fax[_0x405d('0x1b')]['syncOriginateResponse']=function(_0x29308c){if(this[_0x405d('0x24')][_0x29308c[_0x405d('0x1f')]]){_[_0x405d('0x3e')](this[_0x405d('0xb')][_0x29308c[_0x405d('0x1f')]],_[_0x405d('0x3f')](_0x29308c,[_0x405d('0x40'),_0x405d('0x41')]));}};function updateStatus(_0x1ee77c){if(_0x1ee77c['AttachmentId']){faxMessage[_0x405d('0x42')](_0x1ee77c['AttachmentId'],{'failMessage':_0x405d('0x43')})[_0x405d('0x37')](function(_0x33d6e0){ut[_0x405d('0x44')](_0x405d('0x45'),_0x33d6e0);})[_0x405d('0x39')](function(_0x377aa4){ut[_0x405d('0x44')](_0x405d('0x46'),_0x377aa4);});}else{ut[_0x405d('0x44')]('[Fax][Message][Error][NoUpdate2]');}}Fax['prototype'][_0x405d('0x47')]=function(_0x2260c8,_0x52ffb6,_0x1c9ab8){var _0x4422b1=this;var _0x5068ea={};if(_0x52ffb6){_0x5068ea={'read':_0x52ffb6};}else{_0x5068ea={'failMessage':_0x1c9ab8};}if(this[_0x405d('0x24')][_0x2260c8][_0x405d('0x48')]){faxMessage['update'](this[_0x405d('0x24')][_0x2260c8]['AttachmentId'],_0x5068ea)['then'](function(_0x3553da){ut[_0x405d('0x44')](_0x405d('0x49'),_0x3553da);})[_0x405d('0x39')](function(_0x433808){ut['logger'](_0x405d('0x4a'),_0x433808);})[_0x405d('0x4b')](function(){delete _0x4422b1[_0x405d('0xb')][_0x2260c8];delete _0x4422b1[_0x405d('0x24')][_0x2260c8];});}else{ut[_0x405d('0x44')](_0x405d('0x4c'));delete this[_0x405d('0xb')][_0x2260c8];delete this['actions'][_0x2260c8];}};Fax[_0x405d('0x1b')]['syncHangup']=function(_0x50fdb4){var _0x3beb23=this;if(this['channels'][_0x50fdb4[_0x405d('0x1f')]]){if(this[_0x405d('0x24')][_0x50fdb4[_0x405d('0x1f')]]){this[_0x405d('0xb')][_0x50fdb4[_0x405d('0x1f')]]['id']=this[_0x405d('0x24')][_0x50fdb4[_0x405d('0x1f')]]['id'];this[_0x405d('0xb')][_0x50fdb4[_0x405d('0x1f')]][_0x405d('0x21')]=this[_0x405d('0x24')][_0x50fdb4[_0x405d('0x1f')]]['name'];}logger['info'](_0x50fdb4[_0x405d('0x1f')],this[_0x405d('0x24')][_0x50fdb4['uniqueid']]?_0x405d('0x4d'):_0x405d('0x4e'),JSON[_0x405d('0x3d')](this[_0x405d('0xb')][_0x50fdb4['uniqueid']]));if(this['actions'][_0x50fdb4['uniqueid']]){if(this[_0x405d('0xb')][_0x50fdb4[_0x405d('0x1f')]][_0x405d('0x4f')]>0x0&&this[_0x405d('0xb')][_0x50fdb4['uniqueid']]['faxstatus']==='SUCCESS'){this[_0x405d('0x47')](_0x50fdb4[_0x405d('0x1f')],!![]);}else{this[_0x405d('0x47')](_0x50fdb4['uniqueid'],![],this[_0x405d('0xb')][_0x50fdb4[_0x405d('0x1f')]][_0x405d('0x50')]?_0x405d('0x51')+this['channels'][_0x50fdb4['uniqueid']][_0x405d('0x50')]:'SENDING\x20FAILED');}}}};Fax[_0x405d('0x1b')][_0x405d('0x52')]=function(_0xdbdc06){var _0x5c6053=this;return new BPromise(function(_0x4ec4bb,_0x5c098a){_0x5c6053['execOriginate'](_0xdbdc06,_0x5c6053[_0x405d('0xc')][_0xdbdc06[_0x405d('0x53')]])['then'](function(_0x349883){ut['logger']('[Fax][execOriginate][success]',_0x349883);_0x4ec4bb(ut[_0x405d('0x32')](_0x405d('0x54')));})[_0x405d('0x39')](function(_0x5c5eac){ut[_0x405d('0x44')](_0x405d('0x55'),_0x5c5eac);updateStatus(_0xdbdc06);_0x5c098a(ut[_0x405d('0x32')](_0x405d('0x56')));});});};Fax[_0x405d('0x1b')][_0x405d('0x57')]=function(_0x4a80e8){var _0x157515=this;return new BPromise(function(_0x4ff1b5,_0x32aa1f){var _0x3c0846=_0x157515[_0x405d('0x58')](_0x157515[_0x405d('0xc')][_0x4a80e8[_0x405d('0x53')]][_0x405d('0x59')],_0x4a80e8);if(_0x3c0846['isValid']){_0x4ff1b5(ut['message']('Trunk\x20Reachable'));}else{_0x32aa1f(ut[_0x405d('0x32')](_0x3c0846[_0x405d('0x32')]));}});};function originate(_0x569660,_0x11191a,_0x261862){return new BPromise(function(_0x11a147,_0x4c720d){if(_0x261862){var _0x1c5e2e=util['format'](_0x405d('0x5a'),path[_0x405d('0x34')](_0x569660[_0x405d('0x5b')])['name'],_0x569660[_0x405d('0x5b')]);gs[_0x405d('0x5c')](_0x1c5e2e)['then'](function(){_0x569660[_0x405d('0x5b')]=util[_0x405d('0x5d')](_0x405d('0x5e'),path[_0x405d('0x34')](_0x569660[_0x405d('0x5b')])[_0x405d('0x5f')],path[_0x405d('0x34')](_0x569660[_0x405d('0x5b')])['name']);_0x11191a['XMF-PATH']=_0x569660[_0x405d('0x5b')];ut[_0x405d('0x44')](_0x405d('0x60'),'');ami[_0x405d('0x61')](ut[_0x405d('0x62')](_0x569660,_0x11191a))[_0x405d('0x37')](function(_0x5cd027){_0x11a147(_0x5cd027);})['catch'](function(_0x710dba){_0x4c720d(_0x710dba);});})['catch'](function(_0x36021c){_0x4c720d(_0x36021c);});}else{ami[_0x405d('0x61')](ut[_0x405d('0x62')](_0x569660,_0x11191a))['then'](function(_0x4b1adc){_0x11a147(_0x4b1adc);})[_0x405d('0x39')](function(_0x2640ce){_0x4c720d(_0x2640ce);});}});}Fax[_0x405d('0x1b')][_0x405d('0x63')]=function(_0x3bc756,_0x5cc0cd){var _0x42be30=this;return new BPromise(function(_0x53d64f,_0x2d6697){var _0x1cc5ee=uuid['v4']();var _0x5dd385=ut[_0x405d('0x64')](_0x3bc756,_0x5cc0cd);_0x42be30['actions'][_0x1cc5ee]=new Action(_0x1cc5ee,_0x5cc0cd,_0x3bc756);var _0x6255e4=_0x42be30['actions'][_0x1cc5ee];if(path[_0x405d('0x34')](_0x3bc756[_0x405d('0x5b')])[_0x405d('0x65')]===_0x405d('0x35')){originate(_0x6255e4,_0x5dd385,!![])[_0x405d('0x37')](function(_0x4ff30c){_0x53d64f(_0x4ff30c);})[_0x405d('0x39')](function(_0x3085b3){_0x2d6697(_0x3085b3);});}else{originate(_0x6255e4,_0x5dd385,![])[_0x405d('0x37')](function(_0x40db26){_0x53d64f(_0x40db26);})[_0x405d('0x39')](function(_0x3f1a46){_0x2d6697(_0x3f1a46);});}});};Fax[_0x405d('0x1b')]['isTrunkReachable']=function(_0x328ece){return!_[_0x405d('0x66')](_0x328ece)&&!_[_0x405d('0x66')](_0x328ece['name'])&&!_[_0x405d('0x66')](_0x328ece['active'])&&_0x328ece[_0x405d('0x67')]&&!_['isNil'](this[_0x405d('0xd')][util[_0x405d('0x5d')]('SIP/%s',_0x328ece[_0x405d('0x21')])])&&!_[_0x405d('0x66')](this[_0x405d('0xd')][util[_0x405d('0x5d')](_0x405d('0x68'),_0x328ece['name'])][_0x405d('0x2a')])&&(this[_0x405d('0xd')][util[_0x405d('0x5d')](_0x405d('0x68'),_0x328ece[_0x405d('0x21')])][_0x405d('0x2a')]===_0x405d('0x69')||this[_0x405d('0xd')][util['format'](_0x405d('0x68'),_0x328ece[_0x405d('0x21')])][_0x405d('0x2a')]===_0x405d('0x6a'));};Fax[_0x405d('0x1b')][_0x405d('0x58')]=function(_0x3473b8,_0x136047){if(!this['isTrunkReachable'](_0x3473b8)){ut[_0x405d('0x44')](_0x405d('0x6b'),_['isNil'](_0x3473b8)?'':_0x3473b8[_0x405d('0x21')]+_0x405d('0x6c'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x405d('0x66')](_0x136047['fax'])){ut[_0x405d('0x44')](_0x405d('0x6d'),JSON[_0x405d('0x3d')](_0x136047));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x405d('0x66')](_0x136047[_0x405d('0x5b')])){ut['logger'](_0x405d('0x6e'),JSON['stringify'](_0x136047));return{'isValid':![],'message':_0x405d('0x6f')};}return{'isValid':!![],'message':_0x405d('0x70')};};module[_0x405d('0x71')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 99f36e9..3a1a957 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 _0xa9fa=['bluebird','../../../config/logger','lodash','error','notify','then','util'];(function(_0x5d49c8,_0x184a80){var _0xc4b6ab=function(_0x39ecec){while(--_0x39ecec){_0x5d49c8['push'](_0x5d49c8['shift']());}};_0xc4b6ab(++_0x184a80);}(_0xa9fa,0x1e2));var _0xaa9f=function(_0x53e866,_0x95d4cc){_0x53e866=_0x53e866-0x0;var _0x5ed2a5=_0xa9fa[_0x53e866];return _0x5ed2a5;};'use strict';var util=require(_0xaa9f('0x0'));var BPromise=require(_0xaa9f('0x1'));var logger=require(_0xaa9f('0x2'))('preview');var _=require(_0xaa9f('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x54a51c){return function(_0x23e012){logger[_0xaa9f('0x4')](_0x54a51c,util['inspect'](_0x23e012,{'showHidden':![],'depth':null}));};}exports[_0xaa9f('0x5')]=function(_0x23c8a5,_0x37a0f0){return BPromise['resolve']()[_0xaa9f('0x6')](faxAccount[_0xaa9f('0x5')](_0x23c8a5,_0x37a0f0))['catch'](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x0e50=['util','bluebird','../../../config/logger','lodash','../rpc/faxAccount','error','notify','resolve','then','catch'];(function(_0x4ab99,_0x219ed2){var _0x29e39c=function(_0x2dd986){while(--_0x2dd986){_0x4ab99['push'](_0x4ab99['shift']());}};_0x29e39c(++_0x219ed2);}(_0x0e50,0x168));var _0x00e5=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x0e50[_0x1b2ff7];return _0x31656a;};'use strict';var util=require(_0x00e5('0x0'));var BPromise=require(_0x00e5('0x1'));var logger=require(_0x00e5('0x2'))('preview');var _=require(_0x00e5('0x3'));var faxAccount=require(_0x00e5('0x4'));function loggerCatch(_0x4a0533){return function(_0x12c933){logger[_0x00e5('0x5')](_0x4a0533,util['inspect'](_0x12c933,{'showHidden':![],'depth':null}));};}exports[_0x00e5('0x6')]=function(_0x4c30b9,_0x3efbe7){return BPromise[_0x00e5('0x7')]()[_0x00e5('0x8')](faxAccount[_0x00e5('0x6')](_0x4c30b9,_0x3efbe7))[_0x00e5('0x9')](loggerCatch('[Notify]\x20'));}; \ 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 3e39ed9..2dc20f7 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 _0x987f=['inspect','../../../../config/logger','fax','bluebird','child_process','execute','info','Exec\x20gs','\x20Error\x20:'];(function(_0x333abf,_0x44dffc){var _0x142e93=function(_0x4bd0de){while(--_0x4bd0de){_0x333abf['push'](_0x333abf['shift']());}};_0x142e93(++_0x44dffc);}(_0x987f,0xac));var _0xf987=function(_0x480a51,_0x3aecea){_0x480a51=_0x480a51-0x0;var _0x19673b=_0x987f[_0x480a51];return _0x19673b;};'use strict';var util=require('util');var logger=require(_0xf987('0x0'))(_0xf987('0x1'));var BPromise=require(_0xf987('0x2'));var exec=require(_0xf987('0x3'))['exec'];exports[_0xf987('0x4')]=function(_0x174a01){return new BPromise(function(_0x4b377f,_0xf20411){exec(_0x174a01,function(_0x552ca2,_0x419789,_0x50d650){logger[_0xf987('0x5')](_0xf987('0x6'),_0x419789);if(_0x552ca2){logger[_0xf987('0x5')]('Exec\x20gs',_0xf987('0x7'),util[_0xf987('0x8')](_0x552ca2,{'showHidden':![],'depth':null}),_0x419789,_0x50d650);_0xf20411(_0x552ca2);}_0x4b377f(_0x419789);});});}; \ No newline at end of file +var _0xe475=['\x20Error\x20:','inspect','util','../../../../config/logger','bluebird','child_process','execute','info','Exec\x20gs'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xe475,0x77));var _0x5e47=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe475[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x5e47('0x0'));var logger=require(_0x5e47('0x1'))('fax');var BPromise=require(_0x5e47('0x2'));var exec=require(_0x5e47('0x3'))['exec'];exports[_0x5e47('0x4')]=function(_0x2511c3){return new BPromise(function(_0x3f07ec,_0x5edd70){exec(_0x2511c3,function(_0x2c6b45,_0x2c42c9,_0x29f078){logger[_0x5e47('0x5')](_0x5e47('0x6'),_0x2c42c9);if(_0x2c6b45){logger[_0x5e47('0x5')]('Exec\x20gs',_0x5e47('0x7'),util[_0x5e47('0x8')](_0x2c6b45,{'showHidden':![],'depth':null}),_0x2c42c9,_0x29f078);_0x5edd70(_0x2c6b45);}_0x3f07ec(_0x2c42c9);});});}; \ 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 0516a2f..458b3fc 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 _0x5422=['localstationid','path','variablesAction','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','uniqueid','util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','format','\x22%s\x22','modem','gateway','faxdetect'];(function(_0x524080,_0x183c33){var _0x5beb1b=function(_0x4b334f){while(--_0x4b334f){_0x524080['push'](_0x524080['shift']());}};_0x5beb1b(++_0x183c33);}(_0x5422,0x84));var _0x2542=function(_0x15dc91,_0x2109e5){_0x15dc91=_0x15dc91-0x0;var _0x3ea859=_0x5422[_0x15dc91];return _0x3ea859;};'use strict';var util=require(_0x2542('0x0'));var _=require(_0x2542('0x1'));var moment=require(_0x2542('0x2'));var logger=require(_0x2542('0x3'))(_0x2542('0x4'));exports[_0x2542('0x5')]=function(_0xb52b9f){return{'message':_0xb52b9f};};exports[_0x2542('0x6')]=function(_0x148ad4,_0x53c796){logger[_0x2542('0x7')](_0x148ad4,util[_0x2542('0x8')](_0x53c796,{'showHidden':![],'depth':null}));};exports[_0x2542('0x9')]=function(_0x230835,_0x2ef55b){var _0x24ad91={'XMF-ECM':_0x2ef55b[_0x2542('0xa')],'XMF-HEADERINFO':_0x2ef55b[_0x2542('0xb')],'XMF-MINRATE':_0x2ef55b[_0x2542('0xc')],'XMF-MAXRATE':_0x2ef55b['maxrate'],'XMF-MODEM':util[_0x2542('0xd')](_0x2542('0xe'),_0x2ef55b[_0x2542('0xf')]),'XMF-GATEWAY':_0x2ef55b[_0x2542('0x10')],'XMF-FAXDETECT':_0x2ef55b[_0x2542('0x11')],'XMF-T38TIMEOUT':_0x2ef55b['t38timeout'],'XMF-LOCALSTATIONID':_0x2ef55b[_0x2542('0x12')],'XMF-PATH':_0x230835[_0x2542('0x13')]};return _0x24ad91;};exports[_0x2542('0x14')]=function(_0x2dcf5c,_0x33bb44){return{'actionid':_0x2dcf5c['uniqueid'],'action':'originate','channel':_0x2dcf5c['channel'],'Exten':_0x2542('0x15'),'Context':_0x2542('0x16'),'Priority':'1','callerid':util['format'](_0x2542('0x17'),_0x2dcf5c[_0x2542('0xb')]?_0x2dcf5c['headerinfo']:'',_0x2dcf5c['localstationid']),'variable':_0x33bb44,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2dcf5c[_0x2542('0x18')]};}; \ No newline at end of file +var _0xb36c=['faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','channel','from-sip','headerinfo','moment','../../../../config/logger','fax','message','logger','info','addVariables','ecm','minrate','maxrate','format','modem','gateway'];(function(_0x198cbc,_0x2d63f4){var _0x4b9214=function(_0x2c94b8){while(--_0x2c94b8){_0x198cbc['push'](_0x198cbc['shift']());}};_0x4b9214(++_0x2d63f4);}(_0xb36c,0x17f));var _0xcb36=function(_0x3615a3,_0x43f988){_0x3615a3=_0x3615a3-0x0;var _0x47c66a=_0xb36c[_0x3615a3];return _0x47c66a;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xcb36('0x0'));var logger=require(_0xcb36('0x1'))(_0xcb36('0x2'));exports[_0xcb36('0x3')]=function(_0xf707fc){return{'message':_0xf707fc};};exports[_0xcb36('0x4')]=function(_0x5b3a6,_0x27e7cf){logger[_0xcb36('0x5')](_0x5b3a6,util['inspect'](_0x27e7cf,{'showHidden':![],'depth':null}));};exports[_0xcb36('0x6')]=function(_0xb6ea00,_0x541205){var _0x4ece0a={'XMF-ECM':_0x541205[_0xcb36('0x7')],'XMF-HEADERINFO':_0x541205['headerinfo'],'XMF-MINRATE':_0x541205[_0xcb36('0x8')],'XMF-MAXRATE':_0x541205[_0xcb36('0x9')],'XMF-MODEM':util[_0xcb36('0xa')]('\x22%s\x22',_0x541205[_0xcb36('0xb')]),'XMF-GATEWAY':_0x541205[_0xcb36('0xc')],'XMF-FAXDETECT':_0x541205[_0xcb36('0xd')],'XMF-T38TIMEOUT':_0x541205[_0xcb36('0xe')],'XMF-LOCALSTATIONID':_0x541205[_0xcb36('0xf')],'XMF-PATH':_0xb6ea00[_0xcb36('0x10')]};return _0x4ece0a;};exports[_0xcb36('0x11')]=function(_0x5bca8e,_0x2ab53a){return{'actionid':_0x5bca8e[_0xcb36('0x12')],'action':'originate','channel':_0x5bca8e[_0xcb36('0x13')],'Exten':'xcally-motion-fax','Context':_0xcb36('0x14'),'Priority':'1','callerid':util[_0xcb36('0xa')]('\x22%s\x22\x20<%s>',_0x5bca8e[_0xcb36('0x15')]?_0x5bca8e['headerinfo']:'',_0x5bca8e['localstationid']),'variable':_0x2ab53a,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5bca8e[_0xcb36('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index f8267ab..05467ef 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 _0x567e=['getTrunks','initTrunks','getVoiceQueues','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','log','listen','sync','catch','bluebird','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','hour','get','then','getAgents','initAgents','getTelephones','initTelephones'];(function(_0x557fd2,_0x2c0a7a){var _0x1b54a2=function(_0x2e439b){while(--_0x2e439b){_0x557fd2['push'](_0x557fd2['shift']());}};_0x1b54a2(++_0x2c0a7a);}(_0x567e,0xd8));var _0xe567=function(_0x3eb3b0,_0x4229f1){_0x3eb3b0=_0x3eb3b0-0x0;var _0x54fce1=_0x567e[_0x3eb3b0];return _0x54fce1;};'use strict';var BPromise=require(_0xe567('0x0'));var util=require('util');var moment=require('moment');var server=require(_0xe567('0x1'));var Realtime=require(_0xe567('0x2'));var Report=require(_0xe567('0x3'));var Acw=require(_0xe567('0x4'));var Trigger=require(_0xe567('0x5'));var Dialer=require(_0xe567('0x6'));var Preview=require(_0xe567('0x7'));var Fax=require(_0xe567('0x8'));var user=require(_0xe567('0x9'));var voiceQueue=require(_0xe567('0xa'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xe567('0xb'));var trunk=require(_0xe567('0xc'));var trigger=require(_0xe567('0xd'));var template=require(_0xe567('0xe'));var cmHopperHistory=require(_0xe567('0xf'));var campaign=require(_0xe567('0x10'));var voiceExtension=require(_0xe567('0x11'));var faxAccount=require(_0xe567('0x12'));var zendesk=require(_0xe567('0x13'));var salesforce=require(_0xe567('0x14'));var sugarcrm=require(_0xe567('0x15'));var freshdesk=require(_0xe567('0x16'));var desk=require(_0xe567('0x17'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0xe567('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0xe567('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xe567('0x1a')](_0xe567('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0xe567('0x1b')](user[_0xe567('0x1c')]())['then'](realtime[_0xe567('0x1d')]())[_0xe567('0x1b')](user[_0xe567('0x1e')]())[_0xe567('0x1b')](realtime[_0xe567('0x1f')]())[_0xe567('0x1b')](trunk[_0xe567('0x20')]())[_0xe567('0x1b')](realtime[_0xe567('0x21')]())['then'](voiceQueue[_0xe567('0x22')]())[_0xe567('0x1b')](realtime['initVoiceQueues']())[_0xe567('0x1b')](trigger['getTriggers']())['then'](realtime[_0xe567('0x23')]())[_0xe567('0x1b')](template[_0xe567('0x24')]())[_0xe567('0x1b')](realtime[_0xe567('0x25')]())[_0xe567('0x1b')](zendesk['getZendeskAccounts']())[_0xe567('0x1b')](realtime[_0xe567('0x26')]())[_0xe567('0x1b')](salesforce['getSalesforceAccounts']())[_0xe567('0x1b')](realtime['initSalesforceAccounts']())['then'](sugarcrm[_0xe567('0x27')]())[_0xe567('0x1b')](realtime['initSugarcrmAccounts']())[_0xe567('0x1b')](freshdesk[_0xe567('0x28')]())[_0xe567('0x1b')](realtime[_0xe567('0x29')]())[_0xe567('0x1b')](desk[_0xe567('0x2a')]())[_0xe567('0x1b')](realtime['initDeskAccounts']())[_0xe567('0x1b')](zoho['getZohoAccounts']())['then'](realtime[_0xe567('0x2b')]())[_0xe567('0x1b')](vtiger[_0xe567('0x2c')]())[_0xe567('0x1b')](realtime[_0xe567('0x2d')]())[_0xe567('0x1b')](campaign[_0xe567('0x2e')]())[_0xe567('0x1b')](realtime[_0xe567('0x2f')]())[_0xe567('0x1b')](voiceExtension['getVoiceExtensions']())[_0xe567('0x1b')](realtime[_0xe567('0x30')]())[_0xe567('0x1b')](faxAccount[_0xe567('0x31')]())[_0xe567('0x1b')](realtime[_0xe567('0x32')]())[_0xe567('0x1b')](function(){return realtime;});}function initParams(){return BPromise[_0xe567('0x33')]()[_0xe567('0x1b')](voiceQueueReport[_0xe567('0x34')]())[_0xe567('0x1b')](realtime['initVoiceQueueReports']())[_0xe567('0x1b')](cmHopperHistory[_0xe567('0x35')]())[_0xe567('0x1b')](realtime[_0xe567('0x36')]())[_0xe567('0x1b')](cmHopperHistory[_0xe567('0x37')]())['then'](realtime['initCampaignHopperHistory']())['then'](voiceCallReport[_0xe567('0x38')]())[_0xe567('0x1b')](realtime[_0xe567('0x39')]())[_0xe567('0x1b')](function(_0x4d37c4){})['catch'](function(_0x3c0944){console[_0xe567('0x3a')](_0x3c0944);});}function main(){return server[_0xe567('0x3b')](realtime,preview,fax)['then'](function(_0x31ab4a){return initRealtime();})[_0xe567('0x1b')](function(){return initParams();})['then'](function(){report[_0xe567('0x3c')]();setInterval(initRealtime,0x1388);})[_0xe567('0x3d')](function(_0x1d5ae0){console[_0xe567('0x3a')](_0x1d5ae0);});}main(); \ No newline at end of file +var _0x2391=['getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','moment','./server','./realtime','./acw','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','get','hour','resolve','then','getAgents','initAgents','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','getCampaigns','initCampaigns'];(function(_0x149451,_0x137f98){var _0x27d4be=function(_0x4e3dfc){while(--_0x4e3dfc){_0x149451['push'](_0x149451['shift']());}};_0x27d4be(++_0x137f98);}(_0x2391,0xc9));var _0x1239=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x2391[_0x1ac595];return _0x455fff;};'use strict';var BPromise=require('bluebird');var util=require('util');var moment=require(_0x1239('0x0'));var server=require(_0x1239('0x1'));var Realtime=require(_0x1239('0x2'));var Report=require('./report');var Acw=require(_0x1239('0x3'));var Trigger=require(_0x1239('0x4'));var Dialer=require('./dialer');var Preview=require(_0x1239('0x5'));var Fax=require(_0x1239('0x6'));var user=require(_0x1239('0x7'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x1239('0x8'));var voiceCallReport=require(_0x1239('0x9'));var trunk=require(_0x1239('0xa'));var trigger=require('./rpc/trigger');var template=require(_0x1239('0xb'));var cmHopperHistory=require(_0x1239('0xc'));var campaign=require(_0x1239('0xd'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x1239('0xe'));var zendesk=require(_0x1239('0xf'));var salesforce=require(_0x1239('0x10'));var sugarcrm=require(_0x1239('0x11'));var freshdesk=require(_0x1239('0x12'));var desk=require(_0x1239('0x13'));var zoho=require(_0x1239('0x14'));var vtiger=require(_0x1239('0x15'));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()[_0x1239('0x16')](_0x1239('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x1239('0x16')](_0x1239('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x1239('0x18')]()[_0x1239('0x19')](user[_0x1239('0x1a')]())[_0x1239('0x19')](realtime[_0x1239('0x1b')]())[_0x1239('0x19')](user['getTelephones']())[_0x1239('0x19')](realtime[_0x1239('0x1c')]())[_0x1239('0x19')](trunk['getTrunks']())[_0x1239('0x19')](realtime[_0x1239('0x1d')]())[_0x1239('0x19')](voiceQueue[_0x1239('0x1e')]())['then'](realtime[_0x1239('0x1f')]())[_0x1239('0x19')](trigger[_0x1239('0x20')]())['then'](realtime[_0x1239('0x21')]())[_0x1239('0x19')](template[_0x1239('0x22')]())[_0x1239('0x19')](realtime[_0x1239('0x23')]())[_0x1239('0x19')](zendesk['getZendeskAccounts']())[_0x1239('0x19')](realtime['initZendeskAccounts']())[_0x1239('0x19')](salesforce[_0x1239('0x24')]())['then'](realtime[_0x1239('0x25')]())[_0x1239('0x19')](sugarcrm[_0x1239('0x26')]())[_0x1239('0x19')](realtime[_0x1239('0x27')]())[_0x1239('0x19')](freshdesk['getFreshdeskAccounts']())[_0x1239('0x19')](realtime[_0x1239('0x28')]())['then'](desk[_0x1239('0x29')]())[_0x1239('0x19')](realtime['initDeskAccounts']())[_0x1239('0x19')](zoho[_0x1239('0x2a')]())[_0x1239('0x19')](realtime[_0x1239('0x2b')]())[_0x1239('0x19')](vtiger['getVtigerAccounts']())[_0x1239('0x19')](realtime[_0x1239('0x2c')]())['then'](campaign[_0x1239('0x2d')]())[_0x1239('0x19')](realtime[_0x1239('0x2e')]())['then'](voiceExtension[_0x1239('0x2f')]())[_0x1239('0x19')](realtime[_0x1239('0x30')]())[_0x1239('0x19')](faxAccount['getFaxAccounts']())['then'](realtime[_0x1239('0x31')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x1239('0x18')]()[_0x1239('0x19')](voiceQueueReport[_0x1239('0x32')]())['then'](realtime[_0x1239('0x33')]())[_0x1239('0x19')](cmHopperHistory[_0x1239('0x34')]())['then'](realtime[_0x1239('0x35')]())[_0x1239('0x19')](cmHopperHistory[_0x1239('0x36')]())[_0x1239('0x19')](realtime[_0x1239('0x37')]())['then'](voiceCallReport[_0x1239('0x38')]())['then'](realtime[_0x1239('0x39')]())[_0x1239('0x19')](function(_0x420602){})[_0x1239('0x3a')](function(_0x221253){console[_0x1239('0x3b')](_0x221253);});}function main(){return server[_0x1239('0x3c')](realtime,preview,fax)['then'](function(_0x2c652c){return initRealtime();})[_0x1239('0x19')](function(){return initParams();})[_0x1239('0x19')](function(){report[_0x1239('0x3d')]();setInterval(initRealtime,0x1388);})[_0x1239('0x3a')](function(_0x3e39c3){console['log'](_0x3e39c3);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 32c6ffb..5c5c11a 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 _0x806b=['status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','local','md5','prototype','updateStatusRealtime','not_inuse','idle','inuse','talking','statePause','toNumber','format','stateTime','onhold','user:%s','emit','user:save','exports','lodash','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown'];(function(_0x43e9ed,_0xe5a03d){var _0x523323=function(_0x3a6bc1){while(--_0x3a6bc1){_0x43e9ed['push'](_0x43e9ed['shift']());}};_0x523323(++_0xe5a03d);}(_0x806b,0x104));var _0xb806=function(_0x309cf8,_0x24a600){_0x309cf8=_0x309cf8-0x0;var _0x24bbbe=_0x806b[_0x309cf8];return _0x24bbbe;};'use strict';var _=require(_0xb806('0x0'));var util=require(_0xb806('0x1'));var moment=require('moment');var md5=require('md5');var Redis=require(_0xb806('0x2'));var config=require('../../../config/environment');config[_0xb806('0x3')]=_[_0xb806('0x4')](config['redis'],{'host':_0xb806('0x5'),'port':0x18eb});var io=require(_0xb806('0x6'))(new Redis(config[_0xb806('0x3')]));function Agent(_0x547eb5){this['id']=_0x547eb5['id']||0x0;this['name']=_0x547eb5[_0xb806('0x7')]||'';this[_0xb806('0x8')]=_0x547eb5['email']||'';this[_0xb806('0x9')]=_0x547eb5[_0xb806('0x9')]||'';this[_0xb806('0xa')]=_0x547eb5['fullname']||'';this[_0xb806('0xb')]=_0xb806('0xc');this['stateTime']=0x0;this[_0xb806('0xd')]=_0xb806('0xc');this[_0xb806('0xe')]='';this[_0xb806('0xf')]='';this[_0xb806('0x10')]='';this[_0xb806('0x11')]='';this[_0xb806('0x12')]=_0x547eb5[_0xb806('0x12')]||![];this[_0xb806('0x13')]='unknown';this[_0xb806('0x14')]=0x0;this[_0xb806('0x15')]='';this['voiceStatusQueue']='';this['onhold']=![];this[_0xb806('0x16')]=![];this[_0xb806('0x17')]='';}Agent[_0xb806('0x18')][_0xb806('0x19')]=function(_0x3d3ab3){var _0x5c9962;if(_0x3d3ab3&&_0x3d3ab3['state']){_0x5c9962=_0x3d3ab3[_0xb806('0xb')]['toLowerCase']();switch(_0x5c9962){case _0xb806('0x1a'):_0x5c9962=_0xb806('0x1b');break;case _0xb806('0x1c'):_0x5c9962=_0xb806('0x1d');break;}}if(_0x5c9962&&this[_0xb806('0x13')]!==_0x5c9962||_0x3d3ab3[_0xb806('0x1e')]){this['voiceStatusTime']=_[_0xb806('0x1f')](moment()[_0xb806('0x20')]('x'));}if(_0x5c9962){this[_0xb806('0x13')]=_0x5c9962;}var _0x5e8c72={'id':this['id'],'name':this['name'],'email':this[_0xb806('0x8')],'accountcode':this[_0xb806('0x9')],'fullname':this[_0xb806('0xa')],'state':this[_0xb806('0xb')],'stateTime':this[_0xb806('0x21')],'status':this[_0xb806('0xd')],'address':this[_0xb806('0xe')],'online':this[_0xb806('0x12')],'voiceStatus':this[_0xb806('0x13')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0xb806('0x15')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0xb806('0x11')],'onhold':this[_0xb806('0x22')]};var _0x5677ac=md5(JSON['stringify'](_0x5e8c72));if(this[_0xb806('0x17')]!==_0x5677ac){this[_0xb806('0x17')]=_0x5677ac;io['to'](util['format'](_0xb806('0x23'),_0x5e8c72['name']))[_0xb806('0x24')](_0xb806('0x25'),_0x5e8c72);}};module[_0xb806('0x26')]=Agent; \ No newline at end of file +var _0x39e8=['md5','ioredis','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','state','unknown','stateTime','status','phone','online','voiceStatus','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','updateStatusRealtime','toLowerCase','not_inuse','inuse','talking','statePause','toNumber','format','fullname','address','voiceStatusTime','interface','stringify','user:%s','user:save','exports','util','moment'];(function(_0x1c01ea,_0x312143){var _0x314753=function(_0x33d9bc){while(--_0x33d9bc){_0x1c01ea['push'](_0x1c01ea['shift']());}};_0x314753(++_0x312143);}(_0x39e8,0x12e));var _0x839e=function(_0x6f42f9,_0x28df9c){_0x6f42f9=_0x6f42f9-0x0;var _0x3d9527=_0x39e8[_0x6f42f9];return _0x3d9527;};'use strict';var _=require('lodash');var util=require(_0x839e('0x0'));var moment=require(_0x839e('0x1'));var md5=require(_0x839e('0x2'));var Redis=require(_0x839e('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x839e('0x4')](config[_0x839e('0x5')],{'host':_0x839e('0x6'),'port':0x18eb});var io=require(_0x839e('0x7'))(new Redis(config[_0x839e('0x5')]));function Agent(_0x195199){this['id']=_0x195199['id']||0x0;this[_0x839e('0x8')]=_0x195199[_0x839e('0x8')]||'';this[_0x839e('0x9')]=_0x195199[_0x839e('0x9')]||'';this[_0x839e('0xa')]=_0x195199['accountcode']||'';this['fullname']=_0x195199['fullname']||'';this[_0x839e('0xb')]=_0x839e('0xc');this[_0x839e('0xd')]=0x0;this[_0x839e('0xe')]='unknown';this['address']='';this[_0x839e('0xf')]='';this['mobile']='';this['interface']='';this[_0x839e('0x10')]=_0x195199[_0x839e('0x10')]||![];this[_0x839e('0x11')]=_0x839e('0xc');this['voiceStatusTime']=0x0;this[_0x839e('0x12')]='';this[_0x839e('0x13')]='';this[_0x839e('0x14')]=![];this[_0x839e('0x15')]=![];this[_0x839e('0x2')]='';}Agent['prototype'][_0x839e('0x16')]=function(_0x1ef33d){var _0x59c1a6;if(_0x1ef33d&&_0x1ef33d[_0x839e('0xb')]){_0x59c1a6=_0x1ef33d[_0x839e('0xb')][_0x839e('0x17')]();switch(_0x59c1a6){case _0x839e('0x18'):_0x59c1a6='idle';break;case _0x839e('0x19'):_0x59c1a6=_0x839e('0x1a');break;}}if(_0x59c1a6&&this[_0x839e('0x11')]!==_0x59c1a6||_0x1ef33d[_0x839e('0x1b')]){this['voiceStatusTime']=_[_0x839e('0x1c')](moment()[_0x839e('0x1d')]('x'));}if(_0x59c1a6){this['voiceStatus']=_0x59c1a6;}var _0xdeb42a={'id':this['id'],'name':this[_0x839e('0x8')],'email':this[_0x839e('0x9')],'accountcode':this[_0x839e('0xa')],'fullname':this[_0x839e('0x1e')],'state':this[_0x839e('0xb')],'stateTime':this[_0x839e('0xd')],'status':this[_0x839e('0xe')],'address':this[_0x839e('0x1f')],'online':this['online'],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x839e('0x20')],'voiceStatusCallerIdNumber':this[_0x839e('0x12')],'voiceStatusQueue':this[_0x839e('0x13')],'interface':this[_0x839e('0x21')],'onhold':this[_0x839e('0x14')]};var _0xda889=md5(JSON[_0x839e('0x22')](_0xdeb42a));if(this['md5']!==_0xda889){this['md5']=_0xda889;io['to'](util['format'](_0x839e('0x23'),_0xdeb42a[_0x839e('0x8')]))['emit'](_0x839e('0x24'),_0xdeb42a);}};module[_0x839e('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 50f8e27..7db807c 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 _0x0647=['Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x0647,0xd0));var _0x7064=function(_0x29c3b2,_0x3c12ac){_0x29c3b2=_0x29c3b2-0x0;var _0x4b3aa7=_0x0647[_0x29c3b2];return _0x4b3aa7;};'use strict';function Campaign(_0x482ad2){this['id']=_0x482ad2['id']||0x0;this['name']=_0x482ad2[_0x7064('0x0')]||'';this[_0x7064('0x1')]=_0x482ad2[_0x7064('0x1')]||_0x7064('0x2');this[_0x7064('0x3')]=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x7064('0x4')]=0x0;this[_0x7064('0x5')]='';this[_0x7064('0x6')]=!![];this[_0x7064('0x7')]=_0x482ad2[_0x7064('0x7')];this[_0x7064('0x8')]=_0x482ad2['limitCalls'];this['dialTimezone']=_0x482ad2[_0x7064('0x9')]||null;this[_0x7064('0xa')]=_0x482ad2[_0x7064('0xa')]?_0x482ad2['dialGlobalInterval']:null;this[_0x7064('0xb')]=_0x482ad2[_0x7064('0xb')];this['dialOriginateCallerIdNumber']=_0x482ad2[_0x7064('0xc')];this[_0x7064('0xd')]=_0x482ad2[_0x7064('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x482ad2[_0x7064('0xe')];this[_0x7064('0xf')]=_0x482ad2[_0x7064('0xf')];this[_0x7064('0x10')]=_0x482ad2['dialBusyMaxRetry'];this[_0x7064('0x11')]=_0x482ad2[_0x7064('0x11')];this[_0x7064('0x12')]=_0x482ad2[_0x7064('0x12')];this[_0x7064('0x13')]=_0x482ad2[_0x7064('0x13')];this[_0x7064('0x14')]=_0x482ad2[_0x7064('0x14')];this['dialOrderByScheduledAt']=_0x482ad2['dialOrderByScheduledAt']||'DESC';this[_0x7064('0x15')]=_0x482ad2[_0x7064('0x15')]||undefined;this[_0x7064('0x16')]=_0x482ad2['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x7064('0x17')]=_0x482ad2[_0x7064('0x17')]||undefined;this['TrunkBackup']=_0x482ad2[_0x7064('0x18')]?_0x482ad2[_0x7064('0x18')]:undefined;this[_0x7064('0x19')]=_0x482ad2[_0x7064('0x19')]?_0x482ad2[_0x7064('0x19')]:undefined;this[_0x7064('0x1a')]=_0x482ad2[_0x7064('0x1a')]?_0x482ad2[_0x7064('0x1a')]:undefined;this[_0x7064('0x1b')]=_0x482ad2[_0x7064('0x1b')]?_0x482ad2[_0x7064('0x1b')]:undefined;this[_0x7064('0x1c')]=_0x482ad2[_0x7064('0x1b')]?_0x482ad2['SquareProject'][_0x7064('0x0')]:undefined;this[_0x7064('0x1d')]=_0x482ad2[_0x7064('0x1d')]||![];this[_0x7064('0x1e')]=_0x482ad2['dialAMDInitialSilence'];this[_0x7064('0x1f')]=_0x482ad2['dialAMDGreeting'];this[_0x7064('0x20')]=_0x482ad2[_0x7064('0x20')];this['dialAMDTotalAnalysisTime']=_0x482ad2[_0x7064('0x21')];this[_0x7064('0x22')]=_0x482ad2[_0x7064('0x22')];this[_0x7064('0x23')]=_0x482ad2[_0x7064('0x23')];this['dialAMDMaximumNumberOfWords']=_0x482ad2['dialAMDMaximumNumberOfWords'];this[_0x7064('0x24')]=_0x482ad2['dialAMDSilenceThreshold'];this[_0x7064('0x25')]=_0x482ad2[_0x7064('0x25')];}module[_0x7064('0x26')]=Campaign; \ No newline at end of file +var _0x76dc=['dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrAnswerCallsDay','sendMessageOneNotActive','active','dialTimezone','dialGlobalInterval'];(function(_0x1504ce,_0x44fdc0){var _0x2ef647=function(_0x2921fe){while(--_0x2921fe){_0x1504ce['push'](_0x1504ce['shift']());}};_0x2ef647(++_0x44fdc0);}(_0x76dc,0x1f2));var _0xc76d=function(_0xda6ae4,_0x403947){_0xda6ae4=_0xda6ae4-0x0;var _0x571cfd=_0x76dc[_0xda6ae4];return _0x571cfd;};'use strict';function Campaign(_0x10240b){this['id']=_0x10240b['id']||0x0;this[_0xc76d('0x0')]=_0x10240b[_0xc76d('0x0')]||'';this[_0xc76d('0x1')]=_0x10240b['type']||_0xc76d('0x2');this[_0xc76d('0x3')]=0x0;this['temp']=0x0;this[_0xc76d('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this[_0xc76d('0x5')]=!![];this[_0xc76d('0x6')]=_0x10240b[_0xc76d('0x6')];this['limitCalls']=_0x10240b['limitCalls'];this[_0xc76d('0x7')]=_0x10240b[_0xc76d('0x7')]||null;this[_0xc76d('0x8')]=_0x10240b['dialGlobalInterval']?_0x10240b['dialGlobalInterval']:null;this[_0xc76d('0x9')]=_0x10240b[_0xc76d('0x9')];this['dialOriginateCallerIdNumber']=_0x10240b[_0xc76d('0xa')];this['dialOriginateTimeout']=_0x10240b[_0xc76d('0xb')]||0x1e;this[_0xc76d('0xc')]=_0x10240b[_0xc76d('0xc')];this[_0xc76d('0xd')]=_0x10240b[_0xc76d('0xd')];this[_0xc76d('0xe')]=_0x10240b[_0xc76d('0xe')];this[_0xc76d('0xf')]=_0x10240b[_0xc76d('0xf')];this[_0xc76d('0x10')]=_0x10240b[_0xc76d('0x10')];this[_0xc76d('0x11')]=_0x10240b[_0xc76d('0x11')];this[_0xc76d('0x12')]=_0x10240b['dialGlobalMaxRetry'];this[_0xc76d('0x13')]=_0x10240b[_0xc76d('0x13')]||'DESC';this[_0xc76d('0x14')]=_0x10240b[_0xc76d('0x14')]||undefined;this[_0xc76d('0x15')]=_0x10240b[_0xc76d('0x15')]||undefined;this['dialCutDigit']=_0x10240b[_0xc76d('0x16')]||undefined;this['TrunkBackup']=_0x10240b['TrunkBackup']?_0x10240b[_0xc76d('0x17')]:undefined;this[_0xc76d('0x18')]=_0x10240b[_0xc76d('0x18')]?_0x10240b[_0xc76d('0x18')]:undefined;this[_0xc76d('0x19')]=_0x10240b['Interval']?_0x10240b[_0xc76d('0x19')]:undefined;this[_0xc76d('0x1a')]=_0x10240b[_0xc76d('0x1a')]?_0x10240b[_0xc76d('0x1a')]:undefined;this[_0xc76d('0x1b')]=_0x10240b['SquareProject']?_0x10240b[_0xc76d('0x1a')][_0xc76d('0x0')]:undefined;this['dialAMDActive']=_0x10240b[_0xc76d('0x1c')]||![];this[_0xc76d('0x1d')]=_0x10240b[_0xc76d('0x1d')];this[_0xc76d('0x1e')]=_0x10240b[_0xc76d('0x1e')];this[_0xc76d('0x1f')]=_0x10240b[_0xc76d('0x1f')];this[_0xc76d('0x20')]=_0x10240b[_0xc76d('0x20')];this[_0xc76d('0x21')]=_0x10240b[_0xc76d('0x21')];this['dialAMDBetweenWordsSilence']=_0x10240b[_0xc76d('0x22')];this[_0xc76d('0x23')]=_0x10240b['dialAMDMaximumNumberOfWords'];this[_0xc76d('0x24')]=_0x10240b[_0xc76d('0x24')];this['dialAMDMaximumWordLength']=_0x10240b[_0xc76d('0x25')];}module[_0xc76d('0x26')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index ab790cb..26459c3 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 _0x9512=['exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','context','uniqueid','linkedid','exten','answered','answertime','endtime','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','tag','disposition','monitor','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','mohtime'];(function(_0x38f1fa,_0x4115f1){var _0x5c4561=function(_0x25853a){while(--_0x25853a){_0x38f1fa['push'](_0x38f1fa['shift']());}};_0x5c4561(++_0x4115f1);}(_0x9512,0x75));var _0x2951=function(_0x5db99b,_0xdee23a){_0x5db99b=_0x5db99b-0x0;var _0x4b2d0e=_0x9512[_0x5db99b];return _0x4b2d0e;};'use strict';function Channel(){this[_0x2951('0x0')]=null;this[_0x2951('0x1')]='';this[_0x2951('0x2')]='';this[_0x2951('0x3')]=0x0;this[_0x2951('0x4')]='';this[_0x2951('0x5')]=undefined;this[_0x2951('0x6')]=undefined;this['accountcode']=0x0;this[_0x2951('0x7')]='';this[_0x2951('0x8')]=0x0;this[_0x2951('0x9')]=0x0;this[_0x2951('0xa')]=0x0;this[_0x2951('0xb')]=![];this[_0x2951('0xc')]=null;this[_0x2951('0xd')]=null;this['unmanaged']=![];this[_0x2951('0xe')]=![];this[_0x2951('0xf')]='';this[_0x2951('0x10')]='';this[_0x2951('0x11')]=0x0;this[_0x2951('0x12')]=0x0;this[_0x2951('0x13')]=0x0;this['type']=null;this[_0x2951('0x14')]=null;this[_0x2951('0x15')]=null;this[_0x2951('0x16')]=![];this[_0x2951('0x17')]=null;this['queue']=null;this[_0x2951('0x18')]=[];this[_0x2951('0x19')]=undefined;this[_0x2951('0x1a')]=undefined;this[_0x2951('0x1b')]=0x0;}module[_0x2951('0x1c')]=Channel; \ No newline at end of file +var _0xce14=['tag','disposition','monitorFilename','queue','monitors','transfercalleridnum','mohtime','exports','channel','calleridnum','calleridname','connectedlinename','accountcode','context','uniqueid','linkedid','answered','answertime','endtime','unmanaged','lastapplication','lastdata','duration','holdtime','type'];(function(_0x1e91eb,_0x5829a3){var _0x2af75a=function(_0x1815d1){while(--_0x1815d1){_0x1e91eb['push'](_0x1e91eb['shift']());}};_0x2af75a(++_0x5829a3);}(_0xce14,0x17f));var _0x4ce1=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xce14[_0x2f5ac5];return _0x37c9a8;};'use strict';function Channel(){this['starttime']=null;this[_0x4ce1('0x0')]='';this['destinationchannel']='';this[_0x4ce1('0x1')]=0x0;this[_0x4ce1('0x2')]='';this['connectedlinenum']=undefined;this[_0x4ce1('0x3')]=undefined;this[_0x4ce1('0x4')]=0x0;this[_0x4ce1('0x5')]='';this[_0x4ce1('0x6')]=0x0;this[_0x4ce1('0x7')]=0x0;this['exten']=0x0;this[_0x4ce1('0x8')]=![];this[_0x4ce1('0x9')]=null;this[_0x4ce1('0xa')]=null;this[_0x4ce1('0xb')]=![];this['abandoned']=![];this[_0x4ce1('0xc')]='';this[_0x4ce1('0xd')]='';this[_0x4ce1('0xe')]=0x0;this['billableseconds']=0x0;this[_0x4ce1('0xf')]=0x0;this[_0x4ce1('0x10')]=null;this[_0x4ce1('0x11')]=null;this[_0x4ce1('0x12')]=null;this['monitor']=![];this[_0x4ce1('0x13')]=null;this[_0x4ce1('0x14')]=null;this[_0x4ce1('0x15')]=[];this[_0x4ce1('0x16')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x4ce1('0x17')]=0x0;}module[_0x4ce1('0x18')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 4f03e29..4cde3bf 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 _0x39f5=['token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret'];(function(_0x4911a7,_0x41f9b7){var _0x3a855e=function(_0x5c8aa9){while(--_0x5c8aa9){_0x4911a7['push'](_0x4911a7['shift']());}};_0x3a855e(++_0x41f9b7);}(_0x39f5,0x1da));var _0x539f=function(_0x10179f,_0x1d2770){_0x10179f=_0x10179f-0x0;var _0x103612=_0x39f5[_0x10179f];return _0x103612;};'use strict';function DeskAccount(_0x1c8238){this['id']=_0x1c8238['id']||0x0;this[_0x539f('0x0')]=_0x1c8238[_0x539f('0x0')]||'';this[_0x539f('0x1')]=_0x1c8238[_0x539f('0x1')]||'';this[_0x539f('0x2')]=_0x1c8238[_0x539f('0x2')]||'';this['authType']=_0x1c8238[_0x539f('0x3')]||'';this[_0x539f('0x4')]=_0x1c8238[_0x539f('0x4')]||'';this[_0x539f('0x5')]=_0x1c8238[_0x539f('0x5')]||'';this[_0x539f('0x6')]=_0x1c8238[_0x539f('0x6')]||'';this[_0x539f('0x7')]=_0x1c8238[_0x539f('0x7')]||'';this['tokenSecret']=_0x1c8238[_0x539f('0x8')]||'';this['type']=_0x1c8238[_0x539f('0x9')]||'';this[_0x539f('0xa')]=_0x1c8238[_0x539f('0xa')]||'';this[_0x539f('0xb')]=_0x1c8238['Configurations']||{};}module[_0x539f('0xc')]=DeskAccount; \ No newline at end of file +var _0x2553=['exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations'];(function(_0x532112,_0x37d94b){var _0x23e5fb=function(_0x690ac8){while(--_0x690ac8){_0x532112['push'](_0x532112['shift']());}};_0x23e5fb(++_0x37d94b);}(_0x2553,0x1d5));var _0x3255=function(_0x37f6d8,_0x444925){_0x37f6d8=_0x37f6d8-0x0;var _0x49f67b=_0x2553[_0x37f6d8];return _0x49f67b;};'use strict';function DeskAccount(_0x2200d0){this['id']=_0x2200d0['id']||0x0;this[_0x3255('0x0')]=_0x2200d0['name']||'';this[_0x3255('0x1')]=_0x2200d0['username']||'';this[_0x3255('0x2')]=_0x2200d0[_0x3255('0x2')]||'';this[_0x3255('0x3')]=_0x2200d0[_0x3255('0x3')]||'';this['password']=_0x2200d0[_0x3255('0x4')]||'';this[_0x3255('0x5')]=_0x2200d0['consumerKey']||'';this[_0x3255('0x6')]=_0x2200d0[_0x3255('0x6')]||'';this[_0x3255('0x7')]=_0x2200d0[_0x3255('0x7')]||'';this[_0x3255('0x8')]=_0x2200d0[_0x3255('0x8')]||'';this[_0x3255('0x9')]=_0x2200d0['type']||'';this['serverUrl']=_0x2200d0[_0x3255('0xa')]||'';this[_0x3255('0xb')]=_0x2200d0['Configurations']||{};}module[_0x3255('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 1ca36a4..de4a19b 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 _0xd8b0=['ListId','key','exports','name','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk'];(function(_0x484c03,_0x13c1d2){var _0x294127=function(_0x45a834){while(--_0x45a834){_0x484c03['push'](_0x484c03['shift']());}};_0x294127(++_0x13c1d2);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';function FaxAccount(_0x5d04de){this['id']=_0x5d04de['id']||0x0;this[_0x0d8b('0x0')]=_0x5d04de['name']||'';this['description']=_0x5d04de['description'];this[_0x0d8b('0x1')]=_0x5d04de[_0x0d8b('0x1')];this[_0x0d8b('0x2')]=_0x5d04de[_0x0d8b('0x2')];this[_0x0d8b('0x3')]=_0x5d04de['localstationid'];this['minrate']=_0x5d04de[_0x0d8b('0x4')]||0x960;this[_0x0d8b('0x5')]=_0x5d04de[_0x0d8b('0x5')]||0x3840;this['modem']=_0x5d04de[_0x0d8b('0x6')]||_0x0d8b('0x7');this['gateway']=_0x5d04de[_0x0d8b('0x8')]||'no';this[_0x0d8b('0x9')]=_0x5d04de[_0x0d8b('0x9')]||'no';this[_0x0d8b('0xa')]=_0x5d04de[_0x0d8b('0xa')]||0x1388;this[_0x0d8b('0xb')]=_0x5d04de[_0x0d8b('0xb')]||_0x0d8b('0xc');this['Trunk']=_0x5d04de[_0x0d8b('0xd')]?_0x5d04de['Trunk']:undefined;this[_0x0d8b('0xe')]=_0x5d04de[_0x0d8b('0xe')];this[_0x0d8b('0xf')]=_0x5d04de[_0x0d8b('0xf')];}module[_0x0d8b('0x10')]=FaxAccount; \ No newline at end of file +var _0x6f7a=['ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name','description'];(function(_0x45b2f5,_0x3dbfff){var _0x114ff7=function(_0x74ee47){while(--_0x74ee47){_0x45b2f5['push'](_0x45b2f5['shift']());}};_0x114ff7(++_0x3dbfff);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x1a3967,_0x123e8d){_0x1a3967=_0x1a3967-0x0;var _0x417223=_0x6f7a[_0x1a3967];return _0x417223;};'use strict';function FaxAccount(_0x31411a){this['id']=_0x31411a['id']||0x0;this[_0xa6f7('0x0')]=_0x31411a[_0xa6f7('0x0')]||'';this[_0xa6f7('0x1')]=_0x31411a['description'];this[_0xa6f7('0x2')]=_0x31411a[_0xa6f7('0x2')];this[_0xa6f7('0x3')]=_0x31411a[_0xa6f7('0x3')];this[_0xa6f7('0x4')]=_0x31411a[_0xa6f7('0x4')];this[_0xa6f7('0x5')]=_0x31411a[_0xa6f7('0x5')]||0x960;this[_0xa6f7('0x6')]=_0x31411a[_0xa6f7('0x6')]||0x3840;this[_0xa6f7('0x7')]=_0x31411a['modem']||'v17,v27,v29';this[_0xa6f7('0x8')]=_0x31411a[_0xa6f7('0x8')]||'no';this[_0xa6f7('0x9')]=_0x31411a[_0xa6f7('0x9')]||'no';this[_0xa6f7('0xa')]=_0x31411a['t38timeout']||0x1388;this['tech']=_0x31411a[_0xa6f7('0xb')]||_0xa6f7('0xc');this['Trunk']=_0x31411a[_0xa6f7('0xd')]?_0x31411a['Trunk']:undefined;this[_0xa6f7('0xe')]=_0x31411a[_0xa6f7('0xe')];this[_0xa6f7('0xf')]=_0x31411a[_0xa6f7('0xf')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 7b004f3..9f9ce8e 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 _0xf06c=['exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x4ef4fd,_0x79e502){var _0x105ef=function(_0x15f9a3){while(--_0x15f9a3){_0x4ef4fd['push'](_0x4ef4fd['shift']());}};_0x105ef(++_0x79e502);}(_0xf06c,0x197));var _0xcf06=function(_0x2d03c0,_0x49efbc){_0x2d03c0=_0x2d03c0-0x0;var _0xe98bfa=_0xf06c[_0x2d03c0];return _0xe98bfa;};'use strict';function FreshdeskAccount(_0x2d7ac5){this['id']=_0x2d7ac5['id']||0x0;this[_0xcf06('0x0')]=_0x2d7ac5[_0xcf06('0x0')]||'';this['username']=_0x2d7ac5[_0xcf06('0x1')]||'';this[_0xcf06('0x2')]=_0x2d7ac5[_0xcf06('0x3')]||'';this[_0xcf06('0x4')]=_0x2d7ac5[_0xcf06('0x4')]||'';this[_0xcf06('0x5')]=_0x2d7ac5[_0xcf06('0x5')]||'';this['Configurations']=_0x2d7ac5['Configurations']||{};}module[_0xcf06('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0xa573=['exports','name','username','apiKey','remoteUri','serverUrl','Configurations'];(function(_0x598e5c,_0x18ab01){var _0x30a48f=function(_0x1cad67){while(--_0x1cad67){_0x598e5c['push'](_0x598e5c['shift']());}};_0x30a48f(++_0x18ab01);}(_0xa573,0xb0));var _0x3a57=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa573[_0x3dd15e];return _0x231fd0;};'use strict';function FreshdeskAccount(_0x443bab){this['id']=_0x443bab['id']||0x0;this[_0x3a57('0x0')]=_0x443bab['name']||'';this[_0x3a57('0x1')]=_0x443bab[_0x3a57('0x1')]||'';this[_0x3a57('0x2')]=_0x443bab['token']||'';this[_0x3a57('0x3')]=_0x443bab['remoteUri']||'';this['serverUrl']=_0x443bab[_0x3a57('0x4')]||'';this[_0x3a57('0x5')]=_0x443bab[_0x3a57('0x5')]||{};}module[_0x3a57('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index cf73238..f81c108 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 _0xfabd=['channel','connectedlinenum','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','mohtime','variables','exports','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit'];(function(_0x4d14e3,_0x206242){var _0x44b579=function(_0x5183ad){while(--_0x5183ad){_0x4d14e3['push'](_0x4d14e3['shift']());}};_0x44b579(++_0x206242);}(_0xfabd,0x89));var _0xdfab=function(_0x4099f3,_0x5dd21c){_0x4099f3=_0x4099f3-0x0;var _0x15bd95=_0xfabd[_0x4099f3];return _0x15bd95;};'use strict';function QueueReport(){this['type']=_0xdfab('0x0');this[_0xdfab('0x1')]='';this[_0xdfab('0x2')]='';this[_0xdfab('0x3')]='';this[_0xdfab('0x4')]='';this[_0xdfab('0x5')]=null;this[_0xdfab('0x6')]=null;this[_0xdfab('0x7')]=0x1;this['count']=0x1;this[_0xdfab('0x8')]=![];this[_0xdfab('0x9')]=null;this[_0xdfab('0xa')]=![];this[_0xdfab('0xb')]=null;this[_0xdfab('0xc')]=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this[_0xdfab('0xd')]='';this[_0xdfab('0xe')]='';this['connectedlinename']='';this[_0xdfab('0xf')]='';this[_0xdfab('0x10')]='';this[_0xdfab('0x11')]='';this[_0xdfab('0x12')]='';this[_0xdfab('0x13')]=0x0;this[_0xdfab('0x14')]=![];this[_0xdfab('0x15')]='';this[_0xdfab('0x16')]=0x0;this[_0xdfab('0x17')]={};}module[_0xdfab('0x18')]=QueueReport; \ No newline at end of file +var _0x1dd8=['queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','connectedlinenum','connectedlinename','accountcode','exten','priority','holdtime','assigned','lastAssignedTo','mohtime','variables','exports','type','inbound','calleridnum','calleridname','queue','queuecallerjoinAt'];(function(_0x1f767d,_0x4543db){var _0x501143=function(_0x621891){while(--_0x621891){_0x1f767d['push'](_0x1f767d['shift']());}};_0x501143(++_0x4543db);}(_0x1dd8,0x13c));var _0x81dd=function(_0x18afca,_0x4219d9){_0x18afca=_0x18afca-0x0;var _0x11603f=_0x1dd8[_0x18afca];return _0x11603f;};'use strict';function QueueReport(){this[_0x81dd('0x0')]=_0x81dd('0x1');this['uniqueid']='';this[_0x81dd('0x2')]='';this[_0x81dd('0x3')]='';this[_0x81dd('0x4')]='';this[_0x81dd('0x5')]=null;this['queuecallerleaveAt']=null;this['position']=0x1;this['count']=0x1;this[_0x81dd('0x6')]=![];this[_0x81dd('0x7')]=null;this[_0x81dd('0x8')]=![];this[_0x81dd('0x9')]=null;this[_0x81dd('0xa')]=![];this[_0x81dd('0xb')]=null;this['originalposition']=0x1;this['channel']='';this[_0x81dd('0xc')]='';this[_0x81dd('0xd')]='';this[_0x81dd('0xe')]='';this['context']='';this[_0x81dd('0xf')]='';this[_0x81dd('0x10')]='';this[_0x81dd('0x11')]=0x0;this[_0x81dd('0x12')]=![];this[_0x81dd('0x13')]='';this[_0x81dd('0x14')]=0x0;this[_0x81dd('0x15')]={};}module[_0x81dd('0x16')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index bdbab64..2ed5732 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 _0xb6de=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId'];(function(_0x53eb76,_0x2e3cdd){var _0x342e8f=function(_0x5a7749){while(--_0x5a7749){_0x53eb76['push'](_0x53eb76['shift']());}};_0x342e8f(++_0x2e3cdd);}(_0xb6de,0xc7));var _0xeb6d=function(_0x156406,_0x411393){_0x156406=_0x156406-0x0;var _0x23b241=_0xb6de[_0x156406];return _0x23b241;};'use strict';function SalesforceAccount(_0x54d6bb){this['id']=_0x54d6bb['id']||0x0;this[_0xeb6d('0x0')]=_0x54d6bb[_0xeb6d('0x0')]||'';this[_0xeb6d('0x1')]=_0x54d6bb[_0xeb6d('0x1')]||'';this[_0xeb6d('0x2')]=_0x54d6bb[_0xeb6d('0x2')]||'';this[_0xeb6d('0x3')]=_0x54d6bb[_0xeb6d('0x3')]||'';this[_0xeb6d('0x4')]=_0x54d6bb[_0xeb6d('0x4')]||'';this['clientSecret']=_0x54d6bb[_0xeb6d('0x5')]||'';this['securityToken']=_0x54d6bb[_0xeb6d('0x6')]||'';this[_0xeb6d('0x7')]=_0x54d6bb[_0xeb6d('0x7')]||_0xeb6d('0x8');this[_0xeb6d('0x9')]=_0x54d6bb[_0xeb6d('0x9')]||'';this[_0xeb6d('0xa')]=_0x54d6bb['Configurations']||{};}module[_0xeb6d('0xb')]=SalesforceAccount; \ No newline at end of file +var _0xc901=['serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab'];(function(_0x5241ba,_0x41a1d4){var _0x26e7c5=function(_0x2b85ec){while(--_0x2b85ec){_0x5241ba['push'](_0x5241ba['shift']());}};_0x26e7c5(++_0x41a1d4);}(_0xc901,0x15f));var _0x1c90=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xc901[_0x59ee6f];return _0x4c0979;};'use strict';function SalesforceAccount(_0x5b56ca){this['id']=_0x5b56ca['id']||0x0;this['name']=_0x5b56ca[_0x1c90('0x0')]||'';this[_0x1c90('0x1')]=_0x5b56ca[_0x1c90('0x1')]||'';this[_0x1c90('0x2')]=_0x5b56ca[_0x1c90('0x2')]||'';this[_0x1c90('0x3')]=_0x5b56ca[_0x1c90('0x3')]||'';this['clientId']=_0x5b56ca[_0x1c90('0x4')]||'';this[_0x1c90('0x5')]=_0x5b56ca[_0x1c90('0x5')]||'';this[_0x1c90('0x6')]=_0x5b56ca['securityToken']||'';this[_0x1c90('0x7')]=_0x5b56ca[_0x1c90('0x7')]||_0x1c90('0x8');this[_0x1c90('0x9')]=_0x5b56ca['serverUrl']||'';this[_0x1c90('0xa')]=_0x5b56ca[_0x1c90('0xa')]||{};}module[_0x1c90('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 85e67c8..97fe503 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 _0xe21b=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x371c8f,_0xb3bccf){var _0x163c37=function(_0x5638c1){while(--_0x5638c1){_0x371c8f['push'](_0x371c8f['shift']());}};_0x163c37(++_0xb3bccf);}(_0xe21b,0xe6));var _0xbe21=function(_0x5b38f4,_0x149deb){_0x5b38f4=_0x5b38f4-0x0;var _0x1addb1=_0xe21b[_0x5b38f4];return _0x1addb1;};'use strict';function SugarcrmAccount(_0x5beab3){this['id']=_0x5beab3['id']||0x0;this['name']=_0x5beab3[_0xbe21('0x0')]||'';this[_0xbe21('0x1')]=_0x5beab3['username']||'';this[_0xbe21('0x2')]=_0x5beab3[_0xbe21('0x2')]||'';this[_0xbe21('0x3')]=_0x5beab3[_0xbe21('0x3')]||'';this['serverUrl']=_0x5beab3[_0xbe21('0x4')]||'';this[_0xbe21('0x5')]=_0x5beab3['Configurations']||{};}module[_0xbe21('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xd8d2=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x511a21,_0x4959da){var _0x1a3f1c=function(_0x255c2d){while(--_0x255c2d){_0x511a21['push'](_0x511a21['shift']());}};_0x1a3f1c(++_0x4959da);}(_0xd8d2,0x73));var _0x2d8d=function(_0x3d529d,_0xa2e33c){_0x3d529d=_0x3d529d-0x0;var _0x334f87=_0xd8d2[_0x3d529d];return _0x334f87;};'use strict';function SugarcrmAccount(_0x4686fe){this['id']=_0x4686fe['id']||0x0;this[_0x2d8d('0x0')]=_0x4686fe['name']||'';this['username']=_0x4686fe[_0x2d8d('0x1')]||'';this[_0x2d8d('0x2')]=_0x4686fe['password']||'';this[_0x2d8d('0x3')]=_0x4686fe[_0x2d8d('0x3')]||'';this[_0x2d8d('0x4')]=_0x4686fe[_0x2d8d('0x4')]||'';this[_0x2d8d('0x5')]=_0x4686fe[_0x2d8d('0x5')]||{};}module[_0x2d8d('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 ae72cbd..43a15b8 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 _0xb71f=['address','exports','name','accountcode','state','unknown','stateTime','status'];(function(_0x6cc087,_0x3d1958){var _0x496889=function(_0x3fc1bc){while(--_0x3fc1bc){_0x6cc087['push'](_0x6cc087['shift']());}};_0x496889(++_0x3d1958);}(_0xb71f,0x8a));var _0xfb71=function(_0x295a3d,_0x56d487){_0x295a3d=_0x295a3d-0x0;var _0x23a732=_0xb71f[_0x295a3d];return _0x23a732;};'use strict';function Telephone(_0x427cd5){this['id']=_0x427cd5['id']||0x0;this[_0xfb71('0x0')]=_0x427cd5[_0xfb71('0x0')]||'';this[_0xfb71('0x1')]=_0x427cd5['accountcode']||'';this[_0xfb71('0x2')]=_0xfb71('0x3');this[_0xfb71('0x4')]=0x0;this[_0xfb71('0x5')]=_0xfb71('0x3');this[_0xfb71('0x6')]='';}module[_0xfb71('0x7')]=Telephone; \ No newline at end of file +var _0xf8d6=['unknown','name','accountcode','state','stateTime','status'];(function(_0x4a29ff,_0xc83f09){var _0x4ba0bd=function(_0x3fcf1d){while(--_0x3fcf1d){_0x4a29ff['push'](_0x4a29ff['shift']());}};_0x4ba0bd(++_0xc83f09);}(_0xf8d6,0x67));var _0x6f8d=function(_0x648163,_0x241576){_0x648163=_0x648163-0x0;var _0x199d4d=_0xf8d6[_0x648163];return _0x199d4d;};'use strict';function Telephone(_0xa917e0){this['id']=_0xa917e0['id']||0x0;this['name']=_0xa917e0[_0x6f8d('0x0')]||'';this[_0x6f8d('0x1')]=_0xa917e0[_0x6f8d('0x1')]||'';this[_0x6f8d('0x2')]='unknown';this[_0x6f8d('0x3')]=0x0;this[_0x6f8d('0x4')]=_0x6f8d('0x5');this['address']='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index be4851f..447358e 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 _0x5c12=['html','exports','name'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x5c12,0x188));var _0x25c1=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x5c12[_0x4c445a];return _0x2f611c;};'use strict';function template(_0x2cb5ca){this['id']=_0x2cb5ca['id']||0x0;this[_0x25c1('0x0')]=_0x2cb5ca[_0x25c1('0x0')]||'';this['html']=_0x2cb5ca[_0x25c1('0x1')]||'';}module[_0x25c1('0x2')]=template; \ No newline at end of file +var _0x153f=['html','exports','name'];(function(_0x7ad6cb,_0xffee6c){var _0x22a0ba=function(_0x47f291){while(--_0x47f291){_0x7ad6cb['push'](_0x7ad6cb['shift']());}};_0x22a0ba(++_0xffee6c);}(_0x153f,0x15b));var _0xf153=function(_0x253d90,_0x31169b){_0x253d90=_0x253d90-0x0;var _0x20f34e=_0x153f[_0x253d90];return _0x20f34e;};'use strict';function template(_0x2bbc4c){this['id']=_0x2bbc4c['id']||0x0;this[_0xf153('0x0')]=_0x2bbc4c[_0xf153('0x0')]||'';this[_0xf153('0x1')]=_0x2bbc4c[_0xf153('0x1')]||'';}module[_0xf153('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 3113598..96b3d44 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 _0x519c=['name','channel','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x1a8e45,_0x22ed02){var _0x30bffd=function(_0x36454e){while(--_0x36454e){_0x1a8e45['push'](_0x1a8e45['shift']());}};_0x30bffd(++_0x22ed02);}(_0x519c,0xcb));var _0xc519=function(_0x5e64a8,_0x2c7917){_0x5e64a8=_0x5e64a8-0x0;var _0x40d644=_0x519c[_0x5e64a8];return _0x40d644;};'use strict';function Trigger(_0x1515a1){this['id']=_0x1515a1['id']||0x0;this[_0xc519('0x0')]=_0x1515a1[_0xc519('0x0')]||'';this[_0xc519('0x1')]=_0x1515a1['channel']||'voice';this[_0xc519('0x2')]=_0x1515a1[_0xc519('0x2')]||![];this[_0xc519('0x3')]=_0x1515a1[_0xc519('0x3')]||[];this[_0xc519('0x4')]=_0x1515a1[_0xc519('0x4')]||[];this[_0xc519('0x5')]=_0x1515a1['Actions']||[];}module[_0xc519('0x6')]=Trigger; \ No newline at end of file +var _0xb9b0=['Actions','exports','name','channel','status','AllConditions','AnyConditions'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xb9b0,0x167));var _0x0b9b=function(_0x2bae14,_0x38735e){_0x2bae14=_0x2bae14-0x0;var _0xb92050=_0xb9b0[_0x2bae14];return _0xb92050;};'use strict';function Trigger(_0x5385cf){this['id']=_0x5385cf['id']||0x0;this[_0x0b9b('0x0')]=_0x5385cf[_0x0b9b('0x0')]||'';this[_0x0b9b('0x1')]=_0x5385cf[_0x0b9b('0x1')]||'voice';this['status']=_0x5385cf[_0x0b9b('0x2')]||![];this['AllConditions']=_0x5385cf[_0x0b9b('0x3')]||[];this[_0x0b9b('0x4')]=_0x5385cf[_0x0b9b('0x4')]||[];this['Actions']=_0x5385cf[_0x0b9b('0x5')]||[];}module[_0x0b9b('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 5e1b9e9..4a88a77 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 _0x13cf=['state','unknown','stateTime','status','registry','split','host','domain','domainport','refresh','stateRegistry','registrationtime','address','exports','active','name'];(function(_0x200ba8,_0x56f6a1){var _0x4d7f97=function(_0x46053d){while(--_0x46053d){_0x200ba8['push'](_0x200ba8['shift']());}};_0x4d7f97(++_0x56f6a1);}(_0x13cf,0xfe));var _0xf13c=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0x13cf[_0x266618];return _0x54dbf5;};'use strict';function Trunk(_0x458f9b){this['id']=_0x458f9b['id']||0x0;this[_0xf13c('0x0')]=_0x458f9b[_0xf13c('0x0')]||![];this['name']=_0x458f9b[_0xf13c('0x1')]||'';this[_0xf13c('0x2')]=_0xf13c('0x3');this[_0xf13c('0x4')]=0x0;this[_0xf13c('0x5')]='unknown';this['registry']=_0x458f9b[_0xf13c('0x6')]&&_0x458f9b[_0xf13c('0x6')]['indexOf'](':')?_0x458f9b[_0xf13c('0x6')][_0xf13c('0x7')](':')[0x0]:'';this[_0xf13c('0x8')]='';this['port']='';this[_0xf13c('0x9')]='';this[_0xf13c('0xa')]='';this[_0xf13c('0xb')]='';this[_0xf13c('0xc')]=_0xf13c('0x3');this[_0xf13c('0xd')]='';this[_0xf13c('0xe')]='';}module[_0xf13c('0xf')]=Trunk; \ No newline at end of file +var _0x6cf5=['unknown','registry','indexOf','split','host','port','domain','domainport','address','exports','active','name','state','stateTime','status'];(function(_0x1e2a27,_0x40dfea){var _0x5f5c19=function(_0x3fe57d){while(--_0x3fe57d){_0x1e2a27['push'](_0x1e2a27['shift']());}};_0x5f5c19(++_0x40dfea);}(_0x6cf5,0xbe));var _0x56cf=function(_0x4c573b,_0x5c66f2){_0x4c573b=_0x4c573b-0x0;var _0x387788=_0x6cf5[_0x4c573b];return _0x387788;};'use strict';function Trunk(_0x147f04){this['id']=_0x147f04['id']||0x0;this[_0x56cf('0x0')]=_0x147f04[_0x56cf('0x0')]||![];this[_0x56cf('0x1')]=_0x147f04[_0x56cf('0x1')]||'';this[_0x56cf('0x2')]='unknown';this[_0x56cf('0x3')]=0x0;this[_0x56cf('0x4')]=_0x56cf('0x5');this[_0x56cf('0x6')]=_0x147f04['registry']&&_0x147f04['registry'][_0x56cf('0x7')](':')?_0x147f04[_0x56cf('0x6')][_0x56cf('0x8')](':')[0x0]:'';this[_0x56cf('0x9')]='';this[_0x56cf('0xa')]='';this[_0x56cf('0xb')]='';this[_0x56cf('0xc')]='';this['refresh']='';this['stateRegistry']=_0x56cf('0x5');this['registrationtime']='';this[_0x56cf('0xd')]='';}module[_0x56cf('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 6663854..01d3e6d 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 _0x4ea3=['none','exten','recordingFormat'];(function(_0x28a42e,_0x1d114b){var _0x2d4867=function(_0x50c09f){while(--_0x50c09f){_0x28a42e['push'](_0x28a42e['shift']());}};_0x2d4867(++_0x1d114b);}(_0x4ea3,0x70));var _0x34ea=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x4ea3[_0xbca1b1];return _0x4e1686;};'use strict';function voiceExtension(_0x26a5bf){this['id']=_0x26a5bf['id']||0x0;this[_0x34ea('0x0')]=_0x26a5bf[_0x34ea('0x0')]||'';this[_0x34ea('0x1')]=_0x26a5bf['recordingFormat']||_0x34ea('0x2');}module['exports']=voiceExtension; \ No newline at end of file +var _0x0713=['none','exports','exten','recordingFormat'];(function(_0x1d3601,_0x5946d){var _0x59a424=function(_0x17f4a0){while(--_0x17f4a0){_0x1d3601['push'](_0x1d3601['shift']());}};_0x59a424(++_0x5946d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';function voiceExtension(_0x4bf247){this['id']=_0x4bf247['id']||0x0;this['exten']=_0x4bf247[_0x3071('0x0')]||'';this[_0x3071('0x1')]=_0x4bf247[_0x3071('0x1')]||_0x3071('0x2');}module[_0x3071('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 46314de..7c37ac4 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 _0x002a=['dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundReCallsDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalLowerLimit','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','exports','unknown','not_inuse','inuse','busy','unavailable','ringing','ringinuse','onhold','wav','wav49','roundrobin','name','monitor_format','type','inbound','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber'];(function(_0x1ff575,_0xdba21f){var _0x48fc9e=function(_0x51cf97){while(--_0x51cf97){_0x1ff575['push'](_0x1ff575['shift']());}};_0x48fc9e(++_0xdba21f);}(_0x002a,0x177));var _0xa002=function(_0x480924,_0x2e7284){_0x480924=_0x480924-0x0;var _0x2b9b03=_0x002a[_0x480924];return _0x2b9b03;};'use strict';var statusDesc=[_0xa002('0x0'),_0xa002('0x1'),_0xa002('0x2'),_0xa002('0x3'),'invalid',_0xa002('0x4'),_0xa002('0x5'),_0xa002('0x6'),_0xa002('0x7')];var monitorFormat={'wav':_0xa002('0x8'),'wav49':_0xa002('0x9'),'gsm':'gsm'};var strategy={'rrmemory':'rrmemory','roundrobin':_0xa002('0xa')};function VoiceQueue(_0x1df0b3){this['id']=_0x1df0b3['id']||0x0;this[_0xa002('0xb')]=_0x1df0b3[_0xa002('0xb')]||'';this[_0xa002('0xc')]=_0x1df0b3[_0xa002('0xc')]||'';this[_0xa002('0xd')]=_0x1df0b3[_0xa002('0xd')]||_0xa002('0xe');this['waiting']=0x0;this[_0xa002('0xf')]=0x0;this[_0xa002('0x10')]=0x0;this[_0xa002('0x11')]=0x0;this[_0xa002('0x12')]=0x0;this[_0xa002('0x13')]=0x0;this[_0xa002('0x14')]=0x0;this[_0xa002('0x15')]=0x0;this[_0xa002('0x16')]=0x0;this['loggedIn']=0x0;this['available']=0x0;this[_0xa002('0x17')]=_0x1df0b3[_0xa002('0x17')]||![];this[_0xa002('0x18')]=_0x1df0b3['acwTimeout']||0xa;this[_0xa002('0x19')]=_0x1df0b3['autopause']||'no';this[_0xa002('0x1a')]=!![];this[_0xa002('0x1b')]='';this[_0xa002('0x1c')]=0x0;this[_0xa002('0x1d')]=0x0;this[_0xa002('0x1e')]=_0x1df0b3['dialTimezone']||null;this[_0xa002('0x1f')]=_0x1df0b3['dialGlobalInterval']?_0x1df0b3[_0xa002('0x1f')]:null;this['dialActive']=_0x1df0b3[_0xa002('0x20')];this[_0xa002('0x21')]=_0x1df0b3[_0xa002('0x21')]||_0xa002('0x22');this[_0xa002('0x23')]=_0x1df0b3[_0xa002('0x23')]||0x0;this[_0xa002('0x24')]=_0x1df0b3[_0xa002('0x24')]||0x0;this[_0xa002('0x25')]=_0x1df0b3[_0xa002('0x25')]||0x1;this[_0xa002('0x26')]=_0x1df0b3[_0xa002('0x26')]||_0xa002('0x27');this[_0xa002('0x28')]=_0x1df0b3['dialPredictiveOptimizationPercentage']||0.03;this['dialPredictiveInterval']=_0x1df0b3[_0xa002('0x29')]||0x258;this[_0xa002('0x2a')]=_0x1df0b3[_0xa002('0x2a')]||_0xa002('0x2b');this[_0xa002('0x2c')]=_0x1df0b3[_0xa002('0x2c')]||'anonymous';this[_0xa002('0x2d')]=_0x1df0b3[_0xa002('0x2d')]||0x1e;this[_0xa002('0x2e')]=_0x1df0b3['dialQueueOptions']||'tTxX';this['dialQueueTimeout']=_0x1df0b3[_0xa002('0x2f')]||0x3;this['dialQueueProject']=_0x1df0b3[_0xa002('0x30')]||undefined;this['dialCongestionMaxRetry']=_0x1df0b3[_0xa002('0x31')]||0x3;this[_0xa002('0x32')]=_0x1df0b3[_0xa002('0x32')]||0x96;this['dialBusyMaxRetry']=_0x1df0b3[_0xa002('0x33')]||0x3;this['dialBusyRetryFrequency']=_0x1df0b3[_0xa002('0x34')]||0x96;this[_0xa002('0x35')]=_0x1df0b3[_0xa002('0x35')]||0x3;this[_0xa002('0x36')]=_0x1df0b3['dialNoAnswerRetryFrequency']||0x96;this[_0xa002('0x37')]=_0x1df0b3['dialGlobalMaxRetry']||0x4;this['Trunk']=_0x1df0b3[_0xa002('0x38')]?_0x1df0b3[_0xa002('0x38')]:undefined;this[_0xa002('0x39')]=_0x1df0b3[_0xa002('0x39')]?_0x1df0b3[_0xa002('0x39')]:undefined;this[_0xa002('0x3a')]=_0x1df0b3['dialPrefix']||undefined;this[_0xa002('0x3b')]=_0x1df0b3['Interval']?_0x1df0b3[_0xa002('0x3b')]:undefined;this['dialOrderByScheduledAt']=_0x1df0b3[_0xa002('0x3c')]||_0xa002('0x3d');this[_0xa002('0x3e')]=_0x1df0b3[_0xa002('0x3e')]||undefined;this['dialCutDigit']=_0x1df0b3[_0xa002('0x3f')]||undefined;this[_0xa002('0x40')]=strategy[_0x1df0b3[_0xa002('0x40')]]||_0xa002('0x41');this[_0xa002('0x42')]=!![];this[_0xa002('0x43')]=_0x1df0b3[_0xa002('0x43')]||![];this[_0xa002('0x44')]=_0x1df0b3[_0xa002('0x44')];this['dialAMDGreeting']=_0x1df0b3[_0xa002('0x45')];this[_0xa002('0x46')]=_0x1df0b3[_0xa002('0x46')];this[_0xa002('0x47')]=_0x1df0b3[_0xa002('0x47')];this[_0xa002('0x48')]=_0x1df0b3['dialAMDMinWordLength'];this[_0xa002('0x49')]=_0x1df0b3[_0xa002('0x49')];this[_0xa002('0x4a')]=_0x1df0b3['dialAMDMaximumNumberOfWords'];this[_0xa002('0x4b')]=_0x1df0b3[_0xa002('0x4b')];this[_0xa002('0x4c')]=_0x1df0b3[_0xa002('0x4c')];this[_0xa002('0x4d')]=0x0;this['pTalking']=0x0;this[_0xa002('0x4e')]=_0x1df0b3[_0xa002('0x4e')];this[_0xa002('0x4f')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xa002('0x50')]=0x0;this[_0xa002('0x51')]=0x0;this[_0xa002('0x52')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0xa002('0x53')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xa002('0x54')]=0x0;this[_0xa002('0x55')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xa002('0x56')]=0x0;this['startProgressive']=undefined;this[_0xa002('0x57')]=undefined;this[_0xa002('0x58')]=undefined;this[_0xa002('0x59')]=1.05;this[_0xa002('0x5a')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xa002('0x5b')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xa002('0x5c')]=0x0;this[_0xa002('0x5d')]=0x0;this[_0xa002('0x5e')]=0.4;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0xa002('0x5f')]=0x1;this[_0xa002('0x60')]=0x0;this[_0xa002('0x61')]=0x0;this[_0xa002('0x62')]=0x0;this['erlangBusyFactor']=0x0;this[_0xa002('0x63')]=_0x1df0b3[_0xa002('0x63')]||0x1e;this[_0xa002('0x64')]=_0x1df0b3[_0xa002('0x64')]||![];this['dialQueueProject2']=_0x1df0b3[_0xa002('0x65')]||undefined;this[_0xa002('0x66')]=_0x1df0b3[_0xa002('0x66')]||![];this[_0xa002('0x67')]=_0x1df0b3[_0xa002('0x67')]||![];this[_0xa002('0xc')]=monitorFormat[_0x1df0b3[_0xa002('0xc')]]?monitorFormat[_0x1df0b3['monitor_format']]:undefined;}module[_0xa002('0x68')]=VoiceQueue; \ No newline at end of file +var _0x68ff=['dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalLowerLimit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','exports','unknown','not_inuse','busy','invalid','unavailable','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitQueue','dialPowerLevel','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68ff,0x1cf));var _0xf68f=function(_0x4a7be9,_0x389a6d){_0x4a7be9=_0x4a7be9-0x0;var _0x181f5b=_0x68ff[_0x4a7be9];return _0x181f5b;};'use strict';var statusDesc=[_0xf68f('0x0'),_0xf68f('0x1'),'inuse',_0xf68f('0x2'),_0xf68f('0x3'),_0xf68f('0x4'),'ringing',_0xf68f('0x5'),_0xf68f('0x6')];var monitorFormat={'wav':_0xf68f('0x7'),'wav49':_0xf68f('0x8'),'gsm':_0xf68f('0x9')};var strategy={'rrmemory':_0xf68f('0xa'),'roundrobin':_0xf68f('0xb')};function VoiceQueue(_0x2cc6f7){this['id']=_0x2cc6f7['id']||0x0;this[_0xf68f('0xc')]=_0x2cc6f7[_0xf68f('0xc')]||'';this[_0xf68f('0xd')]=_0x2cc6f7[_0xf68f('0xd')]||'';this['type']=_0x2cc6f7[_0xf68f('0xe')]||_0xf68f('0xf');this[_0xf68f('0x10')]=0x0;this[_0xf68f('0x11')]=0x0;this['total']=0x0;this[_0xf68f('0x12')]=0x0;this[_0xf68f('0x13')]=0x0;this[_0xf68f('0x14')]=0x0;this[_0xf68f('0x15')]=0x0;this[_0xf68f('0x16')]=0x0;this['abandoned']=0x0;this[_0xf68f('0x17')]=0x0;this[_0xf68f('0x18')]=0x0;this[_0xf68f('0x19')]=_0x2cc6f7['acw']||![];this[_0xf68f('0x1a')]=_0x2cc6f7[_0xf68f('0x1a')]||0xa;this['autopause']=_0x2cc6f7[_0xf68f('0x1b')]||'no';this[_0xf68f('0x1c')]=!![];this['message']='';this[_0xf68f('0x1d')]=0x0;this[_0xf68f('0x1e')]=0x0;this[_0xf68f('0x1f')]=_0x2cc6f7[_0xf68f('0x1f')]||null;this['dialGlobalInterval']=_0x2cc6f7[_0xf68f('0x20')]?_0x2cc6f7[_0xf68f('0x20')]:null;this[_0xf68f('0x21')]=_0x2cc6f7[_0xf68f('0x21')];this['dialMethod']=_0x2cc6f7[_0xf68f('0x22')]||_0xf68f('0x23');this['dialLimitChannel']=_0x2cc6f7['dialLimitChannel']||0x0;this['dialLimitQueue']=_0x2cc6f7[_0xf68f('0x24')]||0x0;this[_0xf68f('0x25')]=_0x2cc6f7[_0xf68f('0x25')]||0x1;this['dialPredictiveOptimization']=_0x2cc6f7['dialPredictiveOptimization']||_0xf68f('0x26');this[_0xf68f('0x27')]=_0x2cc6f7[_0xf68f('0x27')]||0.03;this['dialPredictiveInterval']=_0x2cc6f7[_0xf68f('0x28')]||0x258;this[_0xf68f('0x29')]=_0x2cc6f7[_0xf68f('0x29')]||_0xf68f('0x2a');this[_0xf68f('0x2b')]=_0x2cc6f7[_0xf68f('0x2b')]||_0xf68f('0x2a');this['dialOriginateTimeout']=_0x2cc6f7['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x2cc6f7['dialQueueOptions']||_0xf68f('0x2c');this[_0xf68f('0x2d')]=_0x2cc6f7[_0xf68f('0x2d')]||0x3;this[_0xf68f('0x2e')]=_0x2cc6f7[_0xf68f('0x2e')]||undefined;this[_0xf68f('0x2f')]=_0x2cc6f7[_0xf68f('0x2f')]||0x3;this[_0xf68f('0x30')]=_0x2cc6f7[_0xf68f('0x30')]||0x96;this['dialBusyMaxRetry']=_0x2cc6f7['dialBusyMaxRetry']||0x3;this[_0xf68f('0x31')]=_0x2cc6f7[_0xf68f('0x31')]||0x96;this[_0xf68f('0x32')]=_0x2cc6f7[_0xf68f('0x32')]||0x3;this[_0xf68f('0x33')]=_0x2cc6f7['dialNoAnswerRetryFrequency']||0x96;this['dialGlobalMaxRetry']=_0x2cc6f7['dialGlobalMaxRetry']||0x4;this['Trunk']=_0x2cc6f7['Trunk']?_0x2cc6f7['Trunk']:undefined;this[_0xf68f('0x34')]=_0x2cc6f7['TrunkBackup']?_0x2cc6f7[_0xf68f('0x34')]:undefined;this[_0xf68f('0x35')]=_0x2cc6f7['dialPrefix']||undefined;this[_0xf68f('0x36')]=_0x2cc6f7['Interval']?_0x2cc6f7[_0xf68f('0x36')]:undefined;this[_0xf68f('0x37')]=_0x2cc6f7[_0xf68f('0x37')]||_0xf68f('0x38');this[_0xf68f('0x39')]=_0x2cc6f7[_0xf68f('0x39')]||undefined;this[_0xf68f('0x3a')]=_0x2cc6f7[_0xf68f('0x3a')]||undefined;this[_0xf68f('0x3b')]=strategy[_0x2cc6f7[_0xf68f('0x3b')]]||_0xf68f('0xa');this[_0xf68f('0x3c')]=!![];this[_0xf68f('0x3d')]=_0x2cc6f7['dialAMDActive']||![];this[_0xf68f('0x3e')]=_0x2cc6f7[_0xf68f('0x3e')];this['dialAMDGreeting']=_0x2cc6f7[_0xf68f('0x3f')];this[_0xf68f('0x40')]=_0x2cc6f7[_0xf68f('0x40')];this[_0xf68f('0x41')]=_0x2cc6f7[_0xf68f('0x41')];this[_0xf68f('0x42')]=_0x2cc6f7[_0xf68f('0x42')];this[_0xf68f('0x43')]=_0x2cc6f7['dialAMDBetweenWordsSilence'];this[_0xf68f('0x44')]=_0x2cc6f7['dialAMDMaximumNumberOfWords'];this[_0xf68f('0x45')]=_0x2cc6f7[_0xf68f('0x45')];this[_0xf68f('0x46')]=_0x2cc6f7[_0xf68f('0x46')];this[_0xf68f('0x47')]=0x0;this[_0xf68f('0x48')]=0x0;this[_0xf68f('0x49')]=_0x2cc6f7[_0xf68f('0x49')];this[_0xf68f('0x4a')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xf68f('0x4b')]=0x0;this[_0xf68f('0x4c')]=0x0;this[_0xf68f('0x4d')]=0x0;this[_0xf68f('0x4e')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xf68f('0x4f')]=0x0;this[_0xf68f('0x50')]=0x0;this[_0xf68f('0x51')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xf68f('0x52')]=0x0;this[_0xf68f('0x53')]=0x0;this['startProgressive']=undefined;this[_0xf68f('0x54')]=undefined;this['handlePredictive']=undefined;this[_0xf68f('0x55')]=1.05;this[_0xf68f('0x56')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0xf68f('0x57')]=0x0;this[_0xf68f('0x58')]=0x0;this[_0xf68f('0x59')]=0x0;this[_0xf68f('0x5a')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xf68f('0x5b')]=0.4;this[_0xf68f('0x5c')]=0x0;this[_0xf68f('0x5d')]=0x0;this[_0xf68f('0x5e')]=0x1;this[_0xf68f('0x5f')]=0x0;this[_0xf68f('0x60')]=0x0;this[_0xf68f('0x61')]=0x0;this['erlangBusyFactor']=0x0;this[_0xf68f('0x62')]=_0x2cc6f7[_0xf68f('0x62')]||0x1e;this[_0xf68f('0x63')]=_0x2cc6f7['dialRecallInQueue']||![];this[_0xf68f('0x64')]=_0x2cc6f7[_0xf68f('0x64')]||undefined;this['dialAgiAfterHangupClient']=_0x2cc6f7[_0xf68f('0x65')]||![];this['dialAgiAfterHangupAgent']=_0x2cc6f7[_0xf68f('0x66')]||![];this[_0xf68f('0xd')]=monitorFormat[_0x2cc6f7[_0xf68f('0xd')]]?monitorFormat[_0x2cc6f7[_0xf68f('0xd')]]:undefined;}module[_0xf68f('0x67')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 2ac62c9..a4f7463 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 _0x577c=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x3e1e1b,_0x560c1e){var _0x3f78a4=function(_0x52669e){while(--_0x52669e){_0x3e1e1b['push'](_0x3e1e1b['shift']());}};_0x3f78a4(++_0x560c1e);}(_0x577c,0x1ef));var _0xc577=function(_0x50e778,_0x4764b4){_0x50e778=_0x50e778-0x0;var _0x219f78=_0x577c[_0x50e778];return _0x219f78;};'use strict';function VtigerAccount(_0x15c242){this['id']=_0x15c242['id']||0x0;this['name']=_0x15c242[_0xc577('0x0')]||'';this[_0xc577('0x1')]=_0x15c242[_0xc577('0x1')]||'';this[_0xc577('0x2')]=_0x15c242['accessKey']||'';this[_0xc577('0x3')]=_0x15c242['remoteUri']||'';this[_0xc577('0x4')]=_0x15c242[_0xc577('0x4')]||'';this[_0xc577('0x5')]=_0x15c242['Configurations']||{};}module[_0xc577('0x6')]=VtigerAccount; \ No newline at end of file +var _0x2a27=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x9fb081,_0x48f480){var _0x43f8b0=function(_0x418570){while(--_0x418570){_0x9fb081['push'](_0x9fb081['shift']());}};_0x43f8b0(++_0x48f480);}(_0x2a27,0x1d6));var _0x72a2=function(_0x303598,_0x2f97b0){_0x303598=_0x303598-0x0;var _0x5be763=_0x2a27[_0x303598];return _0x5be763;};'use strict';function VtigerAccount(_0x4b88cf){this['id']=_0x4b88cf['id']||0x0;this[_0x72a2('0x0')]=_0x4b88cf[_0x72a2('0x0')]||'';this[_0x72a2('0x1')]=_0x4b88cf[_0x72a2('0x1')]||'';this['accessKey']=_0x4b88cf[_0x72a2('0x2')]||'';this[_0x72a2('0x3')]=_0x4b88cf[_0x72a2('0x3')]||'';this[_0x72a2('0x4')]=_0x4b88cf[_0x72a2('0x4')]||'';this[_0x72a2('0x5')]=_0x4b88cf[_0x72a2('0x5')]||{};}module[_0x72a2('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 978d090..7b02388 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 _0x66fd=['Configurations','name','username','token','remoteUri','authType','type','integrationTab','serverUrl'];(function(_0x28579f,_0x5469b8){var _0x9ed974=function(_0x507a86){while(--_0x507a86){_0x28579f['push'](_0x28579f['shift']());}};_0x9ed974(++_0x5469b8);}(_0x66fd,0x91));var _0xd66f=function(_0x5662ce,_0x4a5dcf){_0x5662ce=_0x5662ce-0x0;var _0x2ef963=_0x66fd[_0x5662ce];return _0x2ef963;};'use strict';function ZendeskAccount(_0x5616e1){this['id']=_0x5616e1['id']||0x0;this['name']=_0x5616e1[_0xd66f('0x0')]||'';this[_0xd66f('0x1')]=_0x5616e1[_0xd66f('0x1')]||'';this['password']=_0x5616e1['password']||'';this[_0xd66f('0x2')]=_0x5616e1[_0xd66f('0x2')]||'';this[_0xd66f('0x3')]=_0x5616e1[_0xd66f('0x3')]||'';this[_0xd66f('0x4')]=_0x5616e1['authType']||'';this[_0xd66f('0x5')]=_0x5616e1[_0xd66f('0x5')]||_0xd66f('0x6');this[_0xd66f('0x7')]=_0x5616e1[_0xd66f('0x7')]||'';this[_0xd66f('0x8')]=_0x5616e1[_0xd66f('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x92c9=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password'];(function(_0x30d87a,_0xf3a07f){var _0x48f64b=function(_0x2078b7){while(--_0x2078b7){_0x30d87a['push'](_0x30d87a['shift']());}};_0x48f64b(++_0xf3a07f);}(_0x92c9,0x81));var _0x992c=function(_0x58331c,_0x151ee3){_0x58331c=_0x58331c-0x0;var _0x2ba2f3=_0x92c9[_0x58331c];return _0x2ba2f3;};'use strict';function ZendeskAccount(_0x27af42){this['id']=_0x27af42['id']||0x0;this['name']=_0x27af42[_0x992c('0x0')]||'';this['username']=_0x27af42[_0x992c('0x1')]||'';this[_0x992c('0x2')]=_0x27af42['password']||'';this['token']=_0x27af42[_0x992c('0x3')]||'';this['remoteUri']=_0x27af42[_0x992c('0x4')]||'';this['authType']=_0x27af42[_0x992c('0x5')]||'';this[_0x992c('0x6')]=_0x27af42[_0x992c('0x6')]||_0x992c('0x7');this['serverUrl']=_0x27af42[_0x992c('0x8')]||'';this[_0x992c('0x9')]=_0x27af42['Configurations']||{};}module[_0x992c('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 49a2f08..0ca0355 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 _0x2675=['serverUrl','exports','authToken','host','Configurations'];(function(_0x28e987,_0x399360){var _0x3634f0=function(_0x1d92fe){while(--_0x1d92fe){_0x28e987['push'](_0x28e987['shift']());}};_0x3634f0(++_0x399360);}(_0x2675,0x75));var _0x5267=function(_0x11ed62,_0x8bea3c){_0x11ed62=_0x11ed62-0x0;var _0x303f14=_0x2675[_0x11ed62];return _0x303f14;};'use strict';function ZohoAccount(_0x1ee0d4){this['id']=_0x1ee0d4['id']||0x0;this['name']=_0x1ee0d4['name']||'';this['authToken']=_0x1ee0d4[_0x5267('0x0')]||'';this[_0x5267('0x1')]=_0x1ee0d4['host']||'';this[_0x5267('0x2')]=_0x1ee0d4[_0x5267('0x2')]||{};this['serverUrl']=_0x1ee0d4[_0x5267('0x3')]||'';}module[_0x5267('0x4')]=ZohoAccount; \ No newline at end of file +var _0xacf4=['Configurations','serverUrl','exports','name','authToken','host'];(function(_0x4073e1,_0x5ac0a9){var _0x25faf5=function(_0x1dcc3d){while(--_0x1dcc3d){_0x4073e1['push'](_0x4073e1['shift']());}};_0x25faf5(++_0x5ac0a9);}(_0xacf4,0xe7));var _0x4acf=function(_0xe86b41,_0x362f23){_0xe86b41=_0xe86b41-0x0;var _0x26e14e=_0xacf4[_0xe86b41];return _0x26e14e;};'use strict';function ZohoAccount(_0x51f8a0){this['id']=_0x51f8a0['id']||0x0;this['name']=_0x51f8a0[_0x4acf('0x0')]||'';this[_0x4acf('0x1')]=_0x51f8a0[_0x4acf('0x1')]||'';this[_0x4acf('0x2')]=_0x51f8a0[_0x4acf('0x2')]||'';this[_0x4acf('0x3')]=_0x51f8a0[_0x4acf('0x3')]||{};this['serverUrl']=_0x51f8a0[_0x4acf('0x4')]||'';}module[_0x4acf('0x5')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 48b1b35..2256293 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 _0x3405=['lodash','moment','isNil','string','uniqueid','idContact','name','type','campaigntype','membername','Agent','channelAgent','format','calleridname','Contact','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','\x22%s\x22\x20<%s>','number','exports','util'];(function(_0x160814,_0x57b5c6){var _0x427a69=function(_0x3f1485){while(--_0x3f1485){_0x160814['push'](_0x160814['shift']());}};_0x427a69(++_0x57b5c6);}(_0x3405,0x18b));var _0x5340=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x3405[_0x62c958];return _0x57ec61;};'use strict';var util=require(_0x5340('0x0'));var _=require(_0x5340('0x1'));var moment=require(_0x5340('0x2'));function checkNameSurname(_0x30bb6e,_0x341d57,_0x3e5312){var _0x2d51b8='';if(!_[_0x5340('0x3')](_0x341d57)&&_0x5340('0x4')===typeof _0x341d57){_0x2d51b8+=_0x341d57;}if(!_[_0x5340('0x3')](_0x3e5312)&&_0x5340('0x4')===typeof _0x3e5312){_0x2d51b8+='\x20'+_0x3e5312;}if(_0x2d51b8!==''){return _0x2d51b8;}return _0x30bb6e;}function Action(_0x314277,_0x488b52,_0x18883d,_0x26b5c0,_0x1d47b9){this[_0x5340('0x5')]=_0x18883d||undefined;this[_0x5340('0x6')]=_0x314277['id'];this['queue']=_0x488b52[_0x5340('0x7')];this[_0x5340('0x8')]=_0x488b52['type'];this[_0x5340('0x9')]='queue';this['dialAnswer']=![];this[_0x5340('0xa')]=_[_0x5340('0x3')](_0x314277['Agent'])?undefined:_0x314277[_0x5340('0xb')][_0x5340('0x7')];this[_0x5340('0xc')]=this[_0x5340('0xa')]?util[_0x5340('0xd')]('SIP/%s',this['membername']):_0x26b5c0||undefined;this[_0x5340('0xe')]=checkNameSurname(_0x314277[_0x5340('0xf')]['phone'],_0x314277['Contact']['firstName'],_0x314277[_0x5340('0xf')]['lastName']);this[_0x5340('0x10')]=_0x314277[_0x5340('0x10')]||![];this[_0x5340('0x11')]=_0x314277[_0x5340('0xf')][_0x5340('0x12')];this['scheduledat']=_0x314277[_0x5340('0x13')];this[_0x5340('0x14')]=_0x314277[_0x5340('0x14')]||0x0;this[_0x5340('0x15')]=_0x314277[_0x5340('0x15')]||0x0;this[_0x5340('0x16')]=_0x314277[_0x5340('0x16')]||0x0;this['countglobal']=(_0x314277[_0x5340('0x14')]||0x0)+(_0x314277[_0x5340('0x15')]||0x0)+(_0x314277[_0x5340('0x16')]||0x0);this[_0x5340('0x17')]=_0x314277[_0x5340('0x17')];this[_0x5340('0x18')]=_0x314277[_0x5340('0x18')];this[_0x5340('0x19')]=_0x314277['callbackat'];this[_0x5340('0x1a')]=_0x314277[_0x5340('0x1a')];this[_0x5340('0x1b')]=_0x314277[_0x5340('0x1b')];this[_0x5340('0x1c')]=_0x314277[_0x5340('0x1c')];this[_0x5340('0x1d')]=_[_0x5340('0x3')](_0x314277['Agent'])?_0x314277['UserId']:_0x314277[_0x5340('0xb')]['id'];this[_0x5340('0x1e')]=_0x314277['VoiceQueueId'];this[_0x5340('0x1f')]='';this[_0x5340('0x20')]='';}Action['prototype']['getCaller']=function(){return util[_0x5340('0xd')](_0x5340('0x21'),this['calleridname'],this[_0x5340('0x22')]);};module[_0x5340('0x23')]=Action; \ No newline at end of file +var _0xb62c=['Agent','name','channelAgent','SIP/%s','calleridname','phone','Contact','active','calleridnum','scheduledat','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','number','util','lodash','moment','isNil','string','uniqueid','idContact','type','campaigntype','queue'];(function(_0x4cac7b,_0x5e1530){var _0x586683=function(_0x3ebae8){while(--_0x3ebae8){_0x4cac7b['push'](_0x4cac7b['shift']());}};_0x586683(++_0x5e1530);}(_0xb62c,0x198));var _0xcb62=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb62c[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xcb62('0x0'));var _=require(_0xcb62('0x1'));var moment=require(_0xcb62('0x2'));function checkNameSurname(_0x1725a2,_0x1d2245,_0x3f3ab2){var _0x34eeb4='';if(!_['isNil'](_0x1d2245)&&'string'===typeof _0x1d2245){_0x34eeb4+=_0x1d2245;}if(!_[_0xcb62('0x3')](_0x3f3ab2)&&_0xcb62('0x4')===typeof _0x3f3ab2){_0x34eeb4+='\x20'+_0x3f3ab2;}if(_0x34eeb4!==''){return _0x34eeb4;}return _0x1725a2;}function Action(_0x4dc122,_0x2d534b,_0x1548d8,_0x15f23a,_0xbb232b){this[_0xcb62('0x5')]=_0x1548d8||undefined;this[_0xcb62('0x6')]=_0x4dc122['id'];this['queue']=_0x2d534b['name'];this[_0xcb62('0x7')]=_0x2d534b[_0xcb62('0x7')];this[_0xcb62('0x8')]=_0xcb62('0x9');this['dialAnswer']=![];this['membername']=_['isNil'](_0x4dc122[_0xcb62('0xa')])?undefined:_0x4dc122[_0xcb62('0xa')][_0xcb62('0xb')];this[_0xcb62('0xc')]=this['membername']?util['format'](_0xcb62('0xd'),this['membername']):_0x15f23a||undefined;this[_0xcb62('0xe')]=checkNameSurname(_0x4dc122['Contact'][_0xcb62('0xf')],_0x4dc122[_0xcb62('0x10')]['firstName'],_0x4dc122[_0xcb62('0x10')]['lastName']);this[_0xcb62('0x11')]=_0x4dc122[_0xcb62('0x11')]||![];this[_0xcb62('0x12')]=_0x4dc122[_0xcb62('0x10')][_0xcb62('0xf')];this[_0xcb62('0x13')]=_0x4dc122[_0xcb62('0x13')];this['countbusyretry']=_0x4dc122['countbusyretry']||0x0;this['countcongestionretry']=_0x4dc122[_0xcb62('0x14')]||0x0;this[_0xcb62('0x15')]=_0x4dc122[_0xcb62('0x15')]||0x0;this[_0xcb62('0x16')]=(_0x4dc122[_0xcb62('0x17')]||0x0)+(_0x4dc122[_0xcb62('0x14')]||0x0)+(_0x4dc122[_0xcb62('0x15')]||0x0);this['callback']=_0x4dc122['callback'];this[_0xcb62('0x18')]=_0x4dc122[_0xcb62('0x18')];this[_0xcb62('0x19')]=_0x4dc122['callbackat'];this[_0xcb62('0x1a')]=_0x4dc122[_0xcb62('0x1a')];this[_0xcb62('0x1b')]=_0x4dc122[_0xcb62('0x1b')];this[_0xcb62('0x1c')]=_0x4dc122[_0xcb62('0x1c')];this[_0xcb62('0x1d')]=_[_0xcb62('0x3')](_0x4dc122[_0xcb62('0xa')])?_0x4dc122['UserId']:_0x4dc122[_0xcb62('0xa')]['id'];this[_0xcb62('0x1e')]=_0x4dc122['VoiceQueueId'];this[_0xcb62('0x1f')]='';this[_0xcb62('0x20')]='';}Action[_0xcb62('0x21')][_0xcb62('0x22')]=function(){return util[_0xcb62('0x23')](_0xcb62('0x24'),this[_0xcb62('0xe')],this[_0xcb62('0x25')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 4f09674..c665e70 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 _0x73a8=['run','then','logger2','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','emit','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','BUSY','countbusyretry','Busy','Global','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','rescheduleContact','scheduledAt','unlockAgent','NOANSWER','NoAnswer','[callProgressDetectingCustomer][logNoAnswer]','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','activeContact','countcongestionretry','Congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','dialBusyRetryFrequency','CANCEL','AgentReject','[syncHangupRequest][logAgentReject]','unlockContact','idContact','disableContact','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','callProgressDetectingAgent','isUndefined','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','Call\x20failed','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','status','reachable','unmonitored','execRun','unlock','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','Agent','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','trim','dialCutDigit','substring','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','originatecalleridname','originatecalleridnum','extractCalleridNumber','merge','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','clone','isFailure','response','rejected','[syncHangup][talking]','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','keys','variable','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','./rpcDb','./action','./util/util','defaults','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','outbound','name','strategy','answered','loggedIn','pTalking','sumBillable','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalLowerLimit','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','message','originated','Trunk','active','callerid','Interval','voice_queue:save','format','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','syncCampaigns','hasOwnProperty','preview','clearZombieChannels','setMessage','recallMe','clearZombieChannel','sequence','isNil','actions','info','[clearZombieChannels][talking]','Queue','queue','stringify','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','channel','catch','No\x20such\x20channel','updateOriginated','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','length','getDiff','scheduledat','dialRecallMeTimeout'];(function(_0x1cb017,_0x5837b9){var _0x471dca=function(_0x1798e5){while(--_0x1798e5){_0x1cb017['push'](_0x1cb017['shift']());}};_0x471dca(++_0x5837b9);}(_0x73a8,0xb1));var _0x873a=function(_0x1e32f9,_0x1ff128){_0x1e32f9=_0x1e32f9-0x0;var _0x2d1cf3=_0x73a8[_0x1e32f9];return _0x2d1cf3;};'use strict';var util=require(_0x873a('0x0'));var _=require(_0x873a('0x1'));var BPromise=require(_0x873a('0x2'));var uuid=require(_0x873a('0x3'));var moment=require(_0x873a('0x4'));var md5=require(_0x873a('0x5'));var Redis=require(_0x873a('0x6'));var config=require(_0x873a('0x7'));var logger=require(_0x873a('0x8'))('preview');var loggerAction=require(_0x873a('0x8'))('actionPreview');var ami=require('../ami');var rpcDb=require(_0x873a('0x9'));var Action=require(_0x873a('0xa'));var ut=require(_0x873a('0xb'));config['redis']=_[_0x873a('0xc')](config[_0x873a('0xd')],{'host':_0x873a('0xe'),'port':0x18eb});var io=require(_0x873a('0xf'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x873a('0x10')][_0x873a('0x11')]=function(_0x23d0af){this[_0x873a('0x12')]=this[_0x873a('0x12')]?this[_0x873a('0x12')][_0x873a('0x13')](_0x23d0af):_0x23d0af();};function Preview(_0x4059bf){this['sequence']=new Sequence();this[_0x873a('0x14')]=_0x4059bf[_0x873a('0x15')];this[_0x873a('0x16')]=_0x4059bf[_0x873a('0x16')];this['actions']={};this[_0x873a('0x17')]=_0x4059bf[_0x873a('0x17')];this[_0x873a('0x18')]=0x0;ami['on'](_0x873a('0x19'),this[_0x873a('0x1a')][_0x873a('0x1b')](this));ami['on'](_0x873a('0x1c'),this[_0x873a('0x1d')][_0x873a('0x1b')](this));ami['on'](_0x873a('0x1e'),this[_0x873a('0x1f')][_0x873a('0x1b')](this));ami['on'](_0x873a('0x20'),this[_0x873a('0x21')]['bind'](this));ami['on']('newexten',this[_0x873a('0x22')]['bind'](this));ami['on'](_0x873a('0x23'),this[_0x873a('0x24')][_0x873a('0x1b')](this));ami['on'](_0x873a('0x25'),this[_0x873a('0x26')][_0x873a('0x1b')](this));ami['on'](_0x873a('0x27'),this[_0x873a('0x28')]['bind'](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x44d00c,_0x16d856,_0x69643a){io['to'](_0x44d00c)['emit'](_0x16d856,_0x69643a);}function emitCampaignPreview(_0x440c5c){if(_0x440c5c['type']===_0x873a('0x29')){var _0x28c438={'id':_0x440c5c['id'],'name':_0x440c5c[_0x873a('0x2a')],'strategy':_0x440c5c[_0x873a('0x2b')],'answered':_0x440c5c[_0x873a('0x2c')],'available':_0x440c5c['available'],'loggedIn':_0x440c5c[_0x873a('0x2d')],'pTalking':_0x440c5c[_0x873a('0x2e')],'sumBillable':_0x440c5c[_0x873a('0x2f')],'sumDuration':_0x440c5c['sumDuration'],'sumHoldTime':_0x440c5c['sumHoldTime']||0x0,'talking':_0x440c5c[_0x873a('0x30')],'total':_0x440c5c[_0x873a('0x31')],'type':_0x440c5c[_0x873a('0x32')],'unmanaged':_0x440c5c[_0x873a('0x33')],'abandoned':_0x440c5c[_0x873a('0x34')],'waiting':_0x440c5c[_0x873a('0x35')],'loggedInDb':_0x440c5c[_0x873a('0x36')],'dialActive':_0x440c5c[_0x873a('0x37')],'dialMethod':_0x440c5c[_0x873a('0x38')],'dialOriginateCallerIdName':_0x440c5c[_0x873a('0x39')],'dialOriginateCallerIdNumber':_0x440c5c['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x440c5c['dialOriginateTimeout'],'dialPrefix':_0x440c5c[_0x873a('0x3a')],'outboundAnswerAgiCallsDay':_0x440c5c['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x440c5c[_0x873a('0x3b')],'outboundBlacklistCallsDay':_0x440c5c[_0x873a('0x3c')],'outboundBusyCallsDay':_0x440c5c[_0x873a('0x3d')],'outboundCongestionCallsDay':_0x440c5c[_0x873a('0x3e')],'outboundDropCallsDayACS':_0x440c5c[_0x873a('0x3f')],'outboundDropCallsDayCallersExit':_0x440c5c[_0x873a('0x40')],'outboundDropCallsDayTimeout':_0x440c5c[_0x873a('0x41')],'outboundNoAnswerCallsDay':_0x440c5c[_0x873a('0x42')],'outboundNoSuchCallsDay':_0x440c5c[_0x873a('0x43')],'outboundOriginateFailureCallsDay':_0x440c5c[_0x873a('0x44')],'outboundReCallsDay':_0x440c5c[_0x873a('0x45')],'outboundRejectCallsDay':_0x440c5c[_0x873a('0x46')],'outboundUnknownCallsDay':_0x440c5c[_0x873a('0x47')],'predictiveIntervalAnsweredCalls':_0x440c5c['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x440c5c['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x440c5c['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x440c5c[_0x873a('0x48')],'predictiveIntervalDroppedCallsTimeout':_0x440c5c[_0x873a('0x49')],'predictiveIntervalErlangCalls':_0x440c5c[_0x873a('0x4a')],'predictiveIntervalErlangCallsDroppedCalls':_0x440c5c[_0x873a('0x4b')],'predictiveIntervalHitRate':_0x440c5c['predictiveIntervalHitRate'],'predictiveIntervalLowerLimit':_0x440c5c[_0x873a('0x4c')],'predictiveIntervalMultiplicativeFactor':_0x440c5c[_0x873a('0x4d')],'predictiveIntervalPauses':_0x440c5c['predictiveIntervalPauses'],'predictiveIntervalTotalCalls':_0x440c5c[_0x873a('0x4e')],'message':_0x440c5c[_0x873a('0x4f')],'originated':_0x440c5c[_0x873a('0x50')]};if(_0x440c5c[_0x873a('0x51')]){_0x28c438[_0x873a('0x51')]={'id':_0x440c5c[_0x873a('0x51')]['id'],'name':_0x440c5c[_0x873a('0x51')]['name'],'active':_0x440c5c[_0x873a('0x51')][_0x873a('0x52')],'callerid':_0x440c5c[_0x873a('0x51')][_0x873a('0x53')]};}if(_0x440c5c[_0x873a('0x54')]){_0x28c438[_0x873a('0x54')]={'id':_0x440c5c[_0x873a('0x54')]['id'],'name':_0x440c5c[_0x873a('0x54')][_0x873a('0x2a')]};}var _0x403733=md5(JSON['stringify'](_0x28c438));if(_0x440c5c[_0x873a('0x5')]!==_0x403733){_0x440c5c['md5']=_0x403733;emit(util['format']('voice:queue:%s',_0x28c438[_0x873a('0x2a')]),_0x873a('0x55'),_0x28c438);}}}function emitVoiceQueueChannelRemove(_0x57b3bb){emit(util[_0x873a('0x56')](_0x873a('0x57'),_0x57b3bb[_0x873a('0x2a')]),_0x873a('0x58'),_0x57b3bb);}function notSendMessagesQueue(_0x128094){if(_0x128094[_0x873a('0x59')]){if(_0x128094[_0x873a('0x50')]===0x0&&_0x128094[_0x873a('0x2e')]===0x0){_0x128094[_0x873a('0x59')]=![];_0x128094['available']=0x0;_0x128094[_0x873a('0x5a')]=0x0;_0x128094['message']=_0x873a('0x5b');ut[_0x873a('0x5c')](_0x873a('0x5d'),_0x128094[_0x873a('0x2a')]+_0x873a('0x5e'));}else{_0x128094[_0x873a('0x4f')]=_0x873a('0x5f');ut[_0x873a('0x5c')](_0x873a('0x5d'),_0x128094[_0x873a('0x2a')]+'\x20is\x20disactive');}emitCampaignPreview(_0x128094);}}Preview['prototype']['loopCampaigns']=function(){var _0x4ce8e9=this;setInterval(function(){_0x4ce8e9[_0x873a('0x60')]();},0x7cf);};Preview[_0x873a('0x10')][_0x873a('0x60')]=function(){var _0x55a864=this[_0x873a('0x14')];this[_0x873a('0x18')]+=0x1;for(var _0x3edac7 in _0x55a864){if(_0x55a864[_0x873a('0x61')](_0x3edac7)&&(_0x55a864[_0x3edac7]['dialMethod']===_0x873a('0x62')||_0x55a864[_0x3edac7][_0x873a('0x38')]==='booked')&&_0x55a864[_0x3edac7]['type']===_0x873a('0x29')){if(this[_0x873a('0x18')]>0x7){this[_0x873a('0x18')]=0x0;this[_0x873a('0x63')]();}}if(_0x55a864['hasOwnProperty'](_0x3edac7)&&_0x55a864[_0x3edac7][_0x873a('0x38')]===_0x873a('0x62')&&_0x55a864[_0x3edac7]['type']==='outbound'){if(_0x55a864[_0x3edac7][_0x873a('0x37')]){this[_0x873a('0x64')](_0x55a864[_0x3edac7]);this[_0x873a('0x65')](_0x55a864[_0x3edac7]);}else{notSendMessagesQueue(_0x55a864[_0x3edac7]);}}}};Preview['prototype'][_0x873a('0x66')]=function(_0xeed8e1){var _0x3a2f1b=this;this[_0x873a('0x67')][_0x873a('0x11')](function(){if(!_[_0x873a('0x68')](_0x3a2f1b[_0x873a('0x69')][_0xeed8e1])){loggerAction[_0x873a('0x6a')](_0x873a('0x6b'),_0xeed8e1,_0x873a('0x6c'),_0x3a2f1b['actions'][_0xeed8e1][_0x873a('0x6d')],'originated:\x20',JSON[_0x873a('0x6e')](_0x3a2f1b[_0x873a('0x14')][_0x3a2f1b['actions'][_0xeed8e1][_0x873a('0x6d')]]['originated']),_0x873a('0x6f'),JSON['stringify'](_0x3a2f1b[_0x873a('0x14')][_0x3a2f1b[_0x873a('0x69')][_0xeed8e1][_0x873a('0x6d')]][_0x873a('0x2e')]),JSON[_0x873a('0x6e')](_0x3a2f1b[_0x873a('0x69')][_0xeed8e1][_0x873a('0x70')]),JSON['stringify'](_[_0x873a('0x71')](_0x3a2f1b[_0x873a('0x69')][_0xeed8e1],[_0x873a('0x72'),_0x873a('0x73'),_0x873a('0x74'),_0x873a('0x75')])));return ami[_0x873a('0x76')]({'action':'status','channel':_0x3a2f1b[_0x873a('0x69')][_0xeed8e1][_0x873a('0x77')]})[_0x873a('0x78')](function(_0x498853){if(_0x498853['message']===_0x873a('0x79')){setTimeout(function(){if(_0x3a2f1b[_0x873a('0x69')][_0xeed8e1]){ut[_0x873a('0x7a')](_0x3a2f1b['campaignsPreview'][_0x3a2f1b[_0x873a('0x69')][_0xeed8e1][_0x873a('0x6d')]],'[clearZombieChannel]');if(_0x3a2f1b['actions'][_0xeed8e1]['dialAnswer']===!![]){ut[_0x873a('0x7b')](_0x3a2f1b[_0x873a('0x14')][_0x3a2f1b[_0x873a('0x69')][_0xeed8e1]['queue']],'[clearZombieChannel]');ut[_0x873a('0x7c')](_0x873a('0x7d')+_0xeed8e1,_0x3a2f1b[_0x873a('0x69')][_0xeed8e1]['queue']);}ut[_0x873a('0x7c')](_0x873a('0x7e')+_0xeed8e1,_0x3a2f1b[_0x873a('0x69')][_0xeed8e1]['queue']);delete _0x3a2f1b['actions'][_0xeed8e1];}},0x2328);}});}});};Preview[_0x873a('0x10')][_0x873a('0x63')]=function(){var _0x482b80=this;loggerAction[_0x873a('0x6a')](_0x873a('0x7f'),_[_0x873a('0x80')](this[_0x873a('0x69')]));for(var _0x1c6853 in this[_0x873a('0x69')]){if(_0x482b80[_0x873a('0x69')][_0x873a('0x61')](_0x1c6853)){_0x482b80[_0x873a('0x66')](_0x1c6853);}}};Preview[_0x873a('0x10')][_0x873a('0x65')]=function(_0xc6ee99){var _0x32408c=this;rpcDb[_0x873a('0x81')](_0xc6ee99['id'],ut[_0x873a('0x82')](this[_0x873a('0x17')]))['then'](function(_0x3ce2f2){if(!_[_0x873a('0x68')](_0x3ce2f2)){for(var _0x419022=0x0;_0x419022<_0x3ce2f2[_0x873a('0x83')];_0x419022+=0x1){if(ut[_0x873a('0x84')](_0x3ce2f2[_0x419022][_0x873a('0x85')])<_0xc6ee99[_0x873a('0x86')]*0x3c){_0x32408c[_0x873a('0x87')](_0x3ce2f2[_0x419022]['id'])[_0x873a('0x88')](ut['logger2']('[RecallMe]'))[_0x873a('0x78')](ut[_0x873a('0x89')]('[RecallMe]'));}else{var _0x5201b4=new Action(_0x3ce2f2[_0x419022],_0xc6ee99);_0x5201b4[_0x873a('0x8a')]=moment()[_0x873a('0x56')](_0x873a('0x8b'));_0xc6ee99['outboundReCallsDay']+=0x1;ut[_0x873a('0x8c')](_0x5201b4,0x17,_0x873a('0x8d'));if(_0xc6ee99['dialRecallInQueue']){rpcDb[_0x873a('0x8e')](ut[_0x873a('0x8f')](_0x3ce2f2[_0x419022]));rpcDb['createCustomerHistory'](_0x5201b4,_0x873a('0x90'));}else{ut[_0x873a('0x8c')](_0x5201b4,0x16,_0x873a('0x91'));rpcDb[_0x873a('0x92')](_0x5201b4,_0x873a('0x93'));rpcDb[_0x873a('0x94')](_0x5201b4,_0x873a('0x93'));}}}}})['catch'](ut[_0x873a('0x89')](_0x873a('0x95')));};Preview[_0x873a('0x10')][_0x873a('0x64')]=function(_0x567059){_0x567059[_0x873a('0x59')]=!![];if(ut[_0x873a('0x96')](_0x567059[_0x873a('0x2d')])){_0x567059[_0x873a('0x4f')]=_0x873a('0x97');}else if(!ut[_0x873a('0x98')](_0x567059['dialActive'])){_0x567059[_0x873a('0x4f')]=_0x873a('0x5b');}else if(!this[_0x873a('0x99')](_0x567059[_0x873a('0x51')])){if(!this[_0x873a('0x99')](_0x567059[_0x873a('0x9a')])){_0x567059['message']=_0x873a('0x9b');}else{_0x567059['message']=_0x873a('0x9c');}}else{_0x567059[_0x873a('0x4f')]=_0x873a('0x9c');}emitCampaignPreview(_0x567059);};Preview[_0x873a('0x10')][_0x873a('0x9d')]=function(_0x23de88,_0xcdbd5,_0x1bd6aa){var _0x1c11ca=this;var _0x2d940f=this[_0x873a('0x69')][_0xcdbd5];var _0x5a8f41=this['campaignsPreview'][_0x2d940f[_0x873a('0x6d')]];var _0x287a29;if(_0x5a8f41){switch(_0x1bd6aa){case'1':_0x5a8f41[_0x873a('0x43')]+=0x1;_0x2d940f[_0x873a('0x9e')]=ut[_0x873a('0x9f')](_0x2d940f);ut['logCustomer'](_0x2d940f,0x0,_0x873a('0xa0'));rpcDb[_0x873a('0x92')](_0x2d940f,_0x873a('0xa1'));if(ut[_0x873a('0x9f')](_0x2d940f)>=_0x5a8f41[_0x873a('0xa2')]){_0x287a29=ut[_0x873a('0xa3')](_0x2d940f,0xf,'Global');rpcDb['createCustomerFinal'](_0x287a29,_0x873a('0xa4'));}else{rpcDb[_0x873a('0x94')](_0x2d940f,_0x873a('0xa4'));}delete this['actions'][_0x23de88[_0x873a('0xa5')]];break;case _0x873a('0xa6'):var _0x36a7fb=moment()[_0x873a('0x56')](_0x873a('0x8b'));_0x2d940f[_0x873a('0xa7')]=_0x36a7fb;_0x2d940f[_0x873a('0xa8')]=_0x36a7fb;_0x2d940f[_0x873a('0x70')]=!![];_0x5a8f41['pTalking']+=0x1;logger[_0x873a('0x6a')](_0x873a('0xa9'),_0x2d940f[_0x873a('0xaa')],_0x873a('0xab'),_0x5a8f41[_0x873a('0x2a')],'pTalking:\x20',_0x5a8f41[_0x873a('0x2e')]);ami[_0x873a('0xac')]('custom:agentconnect',ut[_0x873a('0xad')](_0x2d940f,_0x873a('0xae')));if(_0x5a8f41[_0x873a('0xaf')]){ami[_0x873a('0xac')](_0x873a('0xb0'),ut[_0x873a('0xb1')](_0x2d940f));}break;case'16':ami[_0x873a('0xac')](_0x873a('0xb2'),ut[_0x873a('0xad')](_0x2d940f,'complete'));emitVoiceQueueChannelRemove(ut[_0x873a('0xad')](_0x2d940f,_0x873a('0xb3')));_0x5a8f41[_0x873a('0x3b')]+=0x1;_0x5a8f41['total']+=0x1;_0x5a8f41[_0x873a('0x2c')]+=0x1;ut[_0x873a('0x7b')](_0x5a8f41,_0x873a('0xb4'));_0x2d940f[_0x873a('0x9e')]=ut[_0x873a('0x9f')](_0x2d940f);ut[_0x873a('0x8c')](_0x2d940f,0x4,_0x873a('0xb5'));rpcDb[_0x873a('0x92')](_0x2d940f,_0x873a('0xb6'));rpcDb[_0x873a('0x94')](_0x2d940f,_0x873a('0xb7'));rpcDb[_0x873a('0xb8')](_0x2d940f);_0x5a8f41[_0x873a('0xb9')]+=_0x2d940f[_0x873a('0xba')];_0x5a8f41['sumBillable']+=_0x2d940f[_0x873a('0xba')];logger[_0x873a('0x6a')]('[syncHangup][talking][decrement]',_0x2d940f[_0x873a('0xaa')],'\x20Queue',_0x5a8f41['name'],'pTalking:\x20',_0x5a8f41[_0x873a('0x2e')]);delete this['actions'][_0x23de88[_0x873a('0xa5')]];break;case _0x873a('0xbb'):_0x5a8f41[_0x873a('0x3d')]+=0x1;_0x2d940f[_0x873a('0xbc')]+=0x1;_0x2d940f[_0x873a('0x9e')]=ut[_0x873a('0x9f')](_0x2d940f);ut[_0x873a('0x8c')](_0x2d940f,0x5,_0x873a('0xbd'));rpcDb['createCustomerHistory'](_0x2d940f,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x873a('0x9f')](_0x2d940f)>=_0x5a8f41[_0x873a('0xa2')]){_0x287a29=ut[_0x873a('0xa3')](_0x2d940f,0xf,_0x873a('0xbe'));rpcDb[_0x873a('0x94')](_0x287a29,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x2d940f[_0x873a('0xbc')]>=_0x5a8f41[_0x873a('0xbf')]){rpcDb[_0x873a('0x94')](_0x2d940f,_0x873a('0xc0'));}else{rpcDb[_0x873a('0xc1')](ut[_0x873a('0xc2')](_0x2d940f,_0x873a('0xbc'),_0x5a8f41['dialBusyRetryFrequency']),_0x2d940f[_0x873a('0xc3')],_0x2d940f['activeContact']);}}break;case _0x873a('0xc4'):_0x5a8f41[_0x873a('0x42')]+=0x1;_0x2d940f['countnoanswerretry']+=0x1;_0x2d940f[_0x873a('0x9e')]=ut[_0x873a('0x9f')](_0x2d940f);ut['logCustomer'](_0x2d940f,0x3,_0x873a('0xc5'));rpcDb['createCustomerHistory'](_0x2d940f,_0x873a('0xc6'));if(ut[_0x873a('0x9f')](_0x2d940f)>=_0x5a8f41[_0x873a('0xa2')]){_0x287a29=ut['cloneAction'](_0x2d940f,0xf,_0x873a('0xbe'));rpcDb[_0x873a('0x94')](_0x287a29,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x2d940f[_0x873a('0xc7')]>=_0x5a8f41[_0x873a('0xc8')]){rpcDb[_0x873a('0x94')](_0x2d940f,_0x873a('0xc6'));}else{rpcDb['rescheduleContact'](ut[_0x873a('0xc2')](_0x2d940f,_0x873a('0xc7'),_0x5a8f41[_0x873a('0xc9')]),_0x2d940f[_0x873a('0xc3')],_0x2d940f[_0x873a('0xca')]);}}break;case'CONGESTION':_0x5a8f41[_0x873a('0x3e')]+=0x1;_0x2d940f[_0x873a('0xcb')]+=0x1;_0x2d940f[_0x873a('0x9e')]=ut[_0x873a('0x9f')](_0x2d940f);ut[_0x873a('0x8c')](_0x2d940f,0x8,_0x873a('0xcc'));rpcDb[_0x873a('0x92')](_0x2d940f,'[callProgressDetectingCustomer][logCongestion]');if(ut['totalGlobal'](_0x2d940f)>=_0x5a8f41[_0x873a('0xa2')]){_0x287a29=ut[_0x873a('0xa3')](_0x2d940f,0xf,'Global');rpcDb[_0x873a('0x94')](_0x287a29,_0x873a('0xcd'));}else{if(_0x2d940f['countcongestionretry']>=_0x5a8f41[_0x873a('0xce')]){rpcDb[_0x873a('0x94')](_0x2d940f,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x873a('0xc1')](ut[_0x873a('0xc2')](_0x2d940f,'countcongestionretry',_0x5a8f41[_0x873a('0xcf')]),_0x2d940f[_0x873a('0xc3')],_0x2d940f['activeContact']);}}break;case _0x873a('0xd0'):_0x5a8f41['outboundRejectCallsDay']+=0x1;_0x2d940f[_0x873a('0x9e')]=ut[_0x873a('0x9f')](_0x2d940f);ut[_0x873a('0x8c')](_0x2d940f,0x14,_0x873a('0xd1'));rpcDb['createCustomerHistory'](_0x2d940f,_0x873a('0xd2'));if(_0x2d940f[_0x873a('0xc3')]){rpcDb[_0x873a('0xd3')](_0x2d940f[_0x873a('0xd4')]);}if(_0x2d940f[_0x873a('0xca')]){rpcDb[_0x873a('0xd5')](_0x2d940f[_0x873a('0xd4')]);}break;default:if(_0x2d940f['dialAnswer']){ut['decrementTalkink'](_0x5a8f41,_0x873a('0xd6'));ut[_0x873a('0x7c')](_0x873a('0xd7')+_0x5a8f41[_0x873a('0x2a')],_0x23de88);}_0x5a8f41[_0x873a('0x47')]+=0x1;_0x2d940f[_0x873a('0x9e')]=ut['totalGlobal'](_0x2d940f);ut[_0x873a('0x8c')](_0x2d940f,0xc,_0x23de88[_0x873a('0xd8')]||_0x23de88[_0x873a('0xd9')]);rpcDb[_0x873a('0x92')](_0x2d940f,_0x873a('0xda'));if(ut['totalGlobal'](_0x2d940f)>=_0x5a8f41['dialGlobalMaxRetry']){_0x287a29=ut[_0x873a('0xa3')](_0x2d940f,0xf,_0x873a('0xbe'));rpcDb['createCustomerFinal'](_0x287a29,_0x873a('0xdb'));}else{rpcDb[_0x873a('0x94')](_0x2d940f,_0x873a('0xdb'));}delete this[_0x873a('0x69')][_0x23de88[_0x873a('0xa5')]];}if(!(_0x2d940f[_0x873a('0x70')]&&_0x1bd6aa==='16')){ut['updateOriginated'](_0x5a8f41,_0x873a('0xdc'));logger['info'](_0x873a('0xdd'),_0x2d940f['uniqueid'],_0x873a('0xab'),_0x5a8f41['name'],_0x873a('0xde'),_0x5a8f41[_0x873a('0x50')]);}if(_0x1bd6aa!==_0x873a('0xa6')){delete this[_0x873a('0x69')][_0x23de88[_0x873a('0xa5')]];delete this[_0x873a('0x69')][_0x23de88[_0x873a('0xdf')]];}}};Preview[_0x873a('0x10')][_0x873a('0xe0')]=function(_0x1225a0,_0x12b046,_0x3bbd6a){if(_['isUndefined'](_0x12b046)&&'object'!==typeof _0x12b046){return;}if(_[_0x873a('0xe1')](_0x3bbd6a)&&'object'!==typeof _0x3bbd6a){return;}switch(_0x3bbd6a[_0x873a('0xe2')]){case'0':ut[_0x873a('0xe3')](_0x1225a0,0x0,'NoSuchNumber');rpcDb[_0x873a('0xe4')](_0x1225a0,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x873a('0xe3')](_0x1225a0,0x3,_0x873a('0xc5'));rpcDb[_0x873a('0xe4')](_0x1225a0,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x873a('0xe3')](_0x1225a0,0x5,_0x873a('0xbd'));rpcDb['createAgentHistory'](_0x1225a0,_0x873a('0xe5'));break;case'8':ut[_0x873a('0xe3')](_0x1225a0,0x8,_0x873a('0xcc'));rpcDb[_0x873a('0xe4')](_0x1225a0,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut['logAgent'](_0x1225a0,0x16,'AnswerAGI');rpcDb[_0x873a('0xe4')](_0x1225a0,_0x873a('0xe6'));break;default:ut[_0x873a('0xe3')](_0x1225a0,0xc,_0x3bbd6a[_0x873a('0xe2')]);rpcDb[_0x873a('0xe4')](_0x1225a0,'[callProgressDetectingAgent][logCongestion]');}ut[_0x873a('0x7a')](_0x12b046,_0x873a('0xe7'));logger[_0x873a('0x6a')](_0x873a('0xe8'),_0x1225a0[_0x873a('0xaa')],_0x873a('0xab'),_0x12b046['name'],'originated:\x20',_0x12b046[_0x873a('0x50')]);delete this['actions'][_0x1225a0[_0x873a('0xaa')]];};Preview[_0x873a('0x10')][_0x873a('0xe9')]=function(_0x39ea7d,_0x1af2ab,_0x2b50ca,_0x37f004,_0x479764){var _0x3bdf83=this;return new BPromise(function(_0x4e3ba0,_0x11e897){if(_[_0x873a('0x68')](_0x1af2ab)||_['isNil'](_0x1af2ab['Contact'])||_[_0x873a('0x68')](_0x1af2ab[_0x873a('0xea')][_0x873a('0xeb')])||_[_0x873a('0x68')](_0x1af2ab[_0x873a('0x74')])){_0x11e897(ut[_0x873a('0x4f')]('Contact\x20is\x20undefined',_0x37f004,_0x479764));return;}var _0x36d326=uuid['v4']();var _0x72eb94=_0x3bdf83['campaignsPreview'][_0x1af2ab[_0x873a('0x6c')][_0x873a('0x2a')]];var _0x55c4ff=_0x2b50ca?_0x3bdf83[_0x873a('0x17')][_0x2b50ca]['id']:undefined;_0x3bdf83['actions'][_0x36d326]=new Action(_0x1af2ab,_0x72eb94,_0x36d326,_0x2b50ca,_0x55c4ff);var _0x3a95eb=_0x3bdf83[_0x873a('0x69')][_0x36d326];_0x3a95eb[_0x873a('0xc3')]=_0x37f004;_0x3a95eb['activeContact']=_0x479764;_0x3a95eb[_0x873a('0xec')]=_0x2b50ca;if(_[_0x873a('0xed')](_0x39ea7d)){_0x3bdf83['execCall'](_0x3a95eb,_0x72eb94,_0x1af2ab,_0x2b50ca)['then'](function(_0x11d244){logger[_0x873a('0x6a')](_0x873a('0xee'),_0x873a('0xef')+_0x3a95eb[_0x873a('0x6d')]+_0x873a('0xf0')+_0x3a95eb[_0x873a('0xd4')],JSON['stringify'](_0x11d244));ami[_0x873a('0xac')](_0x873a('0xf1'),ut[_0x873a('0xad')](_0x3a95eb,_0x873a('0xf2')));_0x4e3ba0(ut[_0x873a('0x4f')](_0x873a('0xf3')));})['catch'](function(_0xb385){ut[_0x873a('0x5c')]('[Preview][execCall][failure]',_0xb385);_0x11e897(ut[_0x873a('0x4f')](_0x873a('0xf4'),_0x37f004,_0x479764));});}else{_0x72eb94['outboundBlacklistCallsDay']+=0x1;ut['logBlacklist'](_0x3a95eb);rpcDb[_0x873a('0xf5')](_0x3a95eb,_0x873a('0xf6'));delete _0x3bdf83[_0x873a('0x69')][_0x36d326];_0x11e897(ut[_0x873a('0x4f')](_0x873a('0xf7'),_0x37f004,_0x479764));}});};Preview[_0x873a('0x10')][_0x873a('0x99')]=function(_0x119ecc){return!_[_0x873a('0x68')](_0x119ecc)&&!_[_0x873a('0x68')](_0x119ecc[_0x873a('0x2a')])&&!_[_0x873a('0x68')](_0x119ecc[_0x873a('0x52')])&&_0x119ecc[_0x873a('0x52')]&&!_['isNil'](this[_0x873a('0x16')][util[_0x873a('0x56')](_0x873a('0xf8'),_0x119ecc[_0x873a('0x2a')])])&&!_[_0x873a('0x68')](this['trunks'][util[_0x873a('0x56')](_0x873a('0xf8'),_0x119ecc['name'])][_0x873a('0xf9')])&&(this[_0x873a('0x16')][util[_0x873a('0x56')](_0x873a('0xf8'),_0x119ecc[_0x873a('0x2a')])][_0x873a('0xf9')]===_0x873a('0xfa')||this['trunks'][util[_0x873a('0x56')](_0x873a('0xf8'),_0x119ecc[_0x873a('0x2a')])][_0x873a('0xf9')]===_0x873a('0xfb'));};Preview[_0x873a('0x10')]['run']=function(_0x769233,_0x69b2b1){var _0x296054=this;return new BPromise(function(_0xe50cd4,_0x535bd2){_0x296054[_0x873a('0xfc')](_0x769233,_0x69b2b1)['then'](function(_0x4d7af7){_0xe50cd4(_[_0x873a('0x71')](_0x4d7af7,[_0x873a('0x4f')]));})[_0x873a('0x78')](function(_0x173c5f){if(_0x173c5f[_0x873a('0xfd')]){rpcDb[_0x873a('0xd3')](_0x769233);}if(_0x173c5f[_0x873a('0x52')]){rpcDb[_0x873a('0xd5')](_0x769233);}_0x535bd2(_['pick'](_0x173c5f,[_0x873a('0x4f')]));});});};Preview[_0x873a('0x10')][_0x873a('0xfc')]=function(_0x34a933,_0x4621b3){var _0xd6acc=this;return new BPromise(function(_0x4888f7,_0xf9d62a){var _0x140810,_0x22a85c;rpcDb[_0x873a('0xfe')](_0x34a933)[_0x873a('0x88')](function(_0x31fa7e){if(!_[_0x873a('0x68')](_0x31fa7e[0x0])){_0x22a85c=_0x31fa7e[0x0]['recallme']?![]:!![];_0x140810=_0x31fa7e[0x0][_0x873a('0xff')]?!![]:![];_0x140810=_0x4621b3?!![]:_0x140810;}var _0x179b20=_0xd6acc[_0x873a('0x100')](_0x31fa7e);if(_0x179b20[_0x873a('0x101')]){rpcDb[_0x873a('0x102')](_[_0x873a('0x71')](_0x31fa7e[0x0],['VoiceQueueId',_0x873a('0x103')]))[_0x873a('0x88')](function(_0x49f188){_0xd6acc[_0x873a('0xe9')](_0x49f188,_0x31fa7e[0x0],_0x4621b3,_0x22a85c,_0x140810)[_0x873a('0x88')](function(_0x4cc538){_0x4888f7(_0x4cc538);})[_0x873a('0x78')](function(_0x1dd045){_0xf9d62a(_0x1dd045);});})['catch'](function(_0x4af549){ut[_0x873a('0x5c')](_0x873a('0x104'),_0x4af549);_0xf9d62a(ut[_0x873a('0x4f')](_0x873a('0x105'),_0x22a85c,_0x140810));});}else{_0xf9d62a(ut[_0x873a('0x4f')](_0x179b20[_0x873a('0x4f')],_0x22a85c,_0x140810));}})[_0x873a('0x78')](function(_0x30bb8e){ut[_0x873a('0x5c')]('[Preview][getContactPreview]',_0x30bb8e);_0xf9d62a(ut[_0x873a('0x4f')](_0x873a('0x105'),![],!![]));});});};Preview[_0x873a('0x10')][_0x873a('0x100')]=function(_0x294c65){if(_[_0x873a('0x68')](_0x294c65)||_['isEmpty'](_0x294c65)||!_['isNil'](_0x294c65[0x0][_0x873a('0x106')])&&_[_0x873a('0x68')](_0x294c65[0x0][_0x873a('0x106')][_0x873a('0x2a')])){ut[_0x873a('0x5c')](_0x873a('0x107'),_0x294c65);return{'isValid':![],'message':_0x873a('0x108')};}var _0x4f58fb=this[_0x873a('0x14')][_0x294c65[0x0][_0x873a('0x6c')][_0x873a('0x2a')]];_0x4f58fb[_0x873a('0x4f')]='ACTIVE';if(_[_0x873a('0x68')](_0x4f58fb)){ut['logger'](_0x873a('0x109'),_0x4f58fb);return{'isValid':![],'message':_0x873a('0x10a')};}if(!this[_0x873a('0x99')](_0x4f58fb[_0x873a('0x51')])){ut[_0x873a('0x5c')](_0x873a('0x10b'),_0x873a('0x10c')+_0x4f58fb['name']+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x873a('0x99')](_0x4f58fb[_0x873a('0x9a')])){ut['logger'](_0x873a('0x10b'),_0x4f58fb[_0x873a('0x2a')]+_0x873a('0x10d'));return{'isValid':![],'message':_0x873a('0x10e')};}}if(!ut[_0x873a('0x98')](_0x4f58fb[_0x873a('0x37')])){ut[_0x873a('0x5c')]('[Preview][validateContact][Campaign\x20Active]',_0x4f58fb[_0x873a('0x2a')]+_0x873a('0x10f'));return{'isValid':![],'message':_0x873a('0x10c')+_0x4f58fb['name']+_0x873a('0x10f')};}return{'isValid':!![],'message':_0x873a('0x110')};};Preview[_0x873a('0x10')][_0x873a('0x111')]=function(_0xbc44a6,_0x2a0213,_0x309b5c,_0x250a6f){var _0x4b810d=this;return new BPromise(function(_0x504abd,_0x4add49){var _0x5aa47d=_0xbc44a6[_0x873a('0xaa')];var _0x5031ee=_0x4b810d['isTrunkReachable'](_0x2a0213['Trunk'])?util[_0x873a('0x56')](_0x873a('0x112'),_0x2a0213[_0x873a('0x51')][_0x873a('0x2a')],_['isNil'](_0x2a0213['dialPrefix'])?'':_0x2a0213[_0x873a('0x3a')][_0x873a('0x113')]()||'',_0x2a0213[_0x873a('0x114')]>0x0?_0x309b5c[_0x873a('0xea')]['phone'][_0x873a('0x115')](_0x2a0213[_0x873a('0x114')]):_0x309b5c['Contact'][_0x873a('0xeb')]):util['format'](_0x873a('0x112'),_[_0x873a('0x68')](_0x2a0213[_0x873a('0x9a')])?_0x2a0213[_0x873a('0x51')][_0x873a('0x2a')]:_0x2a0213[_0x873a('0x9a')][_0x873a('0x2a')],_[_0x873a('0x68')](_0x2a0213[_0x873a('0x3a')])?'':_0x2a0213[_0x873a('0x3a')][_0x873a('0x113')]()||'',_0x2a0213['dialCutDigit']>0x0?_0x309b5c[_0x873a('0xea')][_0x873a('0xeb')][_0x873a('0x115')](_0x2a0213[_0x873a('0x114')]):_0x309b5c[_0x873a('0xea')][_0x873a('0xeb')]);var _0xe2d299=_0x4b810d[_0x873a('0x99')](_0x2a0213[_0x873a('0x51')])?ut['getCallerId'](_0x2a0213[_0x873a('0x51')]['callerid'],_0x2a0213[_0x873a('0x39')],_0x2a0213[_0x873a('0x116')]>0x0?ut[_0x873a('0x117')](_0x2a0213[_0x873a('0x118')],_0x2a0213[_0x873a('0x116')]):_0x2a0213[_0x873a('0x118')]):ut[_0x873a('0x119')](_[_0x873a('0x68')](_0x2a0213[_0x873a('0x9a')])?_0x2a0213['Trunk'][_0x873a('0x53')]:_0x2a0213[_0x873a('0x9a')][_0x873a('0x53')],_0x2a0213['dialOriginateCallerIdName'],_0x2a0213['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x873a('0x117')](_0x2a0213['dialOriginateCallerIdNumber'],_0x2a0213['dialRandomLastDigitCallerIdNumber']):_0x2a0213[_0x873a('0x118')]);if(_0xe2d299){_0xbc44a6[_0x873a('0x11a')]=ut['extractCalleridName'](_0xe2d299);_0xbc44a6[_0x873a('0x11b')]=ut[_0x873a('0x11c')](_0xe2d299);}var _0x56a8b3=ut['addVariables'](_0x2a0213,_0x309b5c,_0x5031ee,_0xe2d299,_0x5aa47d,_0xbc44a6);_[_0x873a('0x11d')](_0xbc44a6,ut['toLowerVariables'](_0x56a8b3));_0xbc44a6[_0x873a('0x8a')]=moment()[_0x873a('0x56')](_0x873a('0x8b'));ami['Action'](ut[_0x873a('0x11e')](_0xbc44a6,_0x2a0213,_0x56a8b3,_0xbc44a6[_0x873a('0xca')],_0x250a6f))['then'](function(_0x5bea98){_0x2a0213[_0x873a('0x50')]+=0x1;logger['info'](_0x873a('0x11f'),_0x5aa47d,_0x873a('0xab'),_0x2a0213[_0x873a('0x2a')],_0x873a('0xde'),_0x2a0213['originated']);_0x504abd(_0x5bea98);})['catch'](function(_0x15c5ec){ut[_0x873a('0xe3')](_0xbc44a6,0xe,_0x873a('0x120'));rpcDb[_0x873a('0xe4')](_0xbc44a6,_0x873a('0x121'));_0x4add49(_0x15c5ec);});});};Preview[_0x873a('0x10')]['syncNewExten']=function(_0x3a5c45){if(this[_0x873a('0x69')][_0x3a5c45[_0x873a('0xa5')]]){this[_0x873a('0x69')][_0x3a5c45[_0x873a('0xa5')]][_0x873a('0x77')]=_0x3a5c45[_0x873a('0x77')];}};Preview[_0x873a('0x10')][_0x873a('0x1a')]=function(_0x335a71){var _0x170cab=this;var _0x3a2753=this[_0x873a('0x69')][_0x335a71['actionid']];if(_0x3a2753){if(_0x3a2753[_0x873a('0xec')]&&this[_0x873a('0x17')][_0x3a2753[_0x873a('0xec')]]){ut['logLookAgent'](_0x3a2753,this[_0x873a('0x17')][_0x3a2753['lookAgent']][_0x873a('0x2a')],this[_0x873a('0x17')][_0x3a2753[_0x873a('0xec')]]['id']);}var _0x27fcd7=_[_0x873a('0x122')](_0x3a2753);_0x27fcd7[_0x873a('0xa7')]=moment()[_0x873a('0x56')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3de590=_0x170cab[_0x873a('0x14')][_0x3a2753[_0x873a('0x6d')]];if(ut[_0x873a('0x123')](_0x335a71[_0x873a('0x124')])){if(_0x3a2753[_0x873a('0xc3')]){rpcDb[_0x873a('0xd3')](_0x3a2753[_0x873a('0xd4')]);}if(_0x3a2753[_0x873a('0xca')]){rpcDb[_0x873a('0xd5')](_0x3a2753[_0x873a('0xd4')]);}ami['emit']('custom:agentringnoanswer',ut[_0x873a('0xad')](_0x3a2753,_0x873a('0x125')));this[_0x873a('0xe0')](_0x27fcd7,_0x3de590,_0x335a71);}else{_0x3a2753['starttime']=moment()[_0x873a('0x56')]('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x27fcd7,0x4,'Answer');rpcDb['createAgentHistory'](_0x27fcd7,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x873a('0x10')]['syncHangup']=function(_0x305fbb){var _0xff80c3=this;var _0x21af38=this[_0x873a('0x69')][_0x305fbb['linkedid']];var _0x58d298;if(_0x21af38){_0x58d298=this[_0x873a('0x14')][_0x21af38[_0x873a('0x6d')]];logger['info'](_0x873a('0x126'),_0x305fbb[_0x873a('0xa5')],_0x873a('0xab'),_0x58d298[_0x873a('0x2a')],'pTalking:\x20',_0x58d298['pTalking']);}if(this['actions'][_0x305fbb[_0x873a('0xa5')]]&&_0x305fbb['linkedid']!==_0x305fbb[_0x873a('0xaa')]){if(_0x305fbb[_0x873a('0x127')]==='16'&&this[_0x873a('0x69')][_0x305fbb[_0x873a('0xa5')]][_0x873a('0x70')]){this[_0x873a('0x9d')](_0x305fbb,_0x305fbb[_0x873a('0xa5')],_0x305fbb[_0x873a('0x127')]);}else if(this[_0x873a('0x69')][_0x305fbb['linkedid']][_0x873a('0x70')]){logger[_0x873a('0x6a')]('[syncHangup][talking][cause]',_0x305fbb['linkedid'],_0x305fbb[_0x873a('0x127')],_0x873a('0xab'),_0x58d298[_0x873a('0x2a')],'pTalking:\x20',_0x58d298[_0x873a('0x2e')]);this['callProgressDetectingCustomer'](_0x305fbb,_0x305fbb[_0x873a('0xa5')],_0x305fbb[_0x873a('0x127')]);}}else if(_0x21af38&&_['isNil'](_0x21af38[_0x873a('0x128')])&&_0x58d298[_0x873a('0x129')]&&_0x305fbb[_0x873a('0xa5')]===_0x305fbb[_0x873a('0xaa')]&&_[_0x873a('0x68')](_0x305fbb[_0x873a('0xe2')])&&_0x305fbb[_0x873a('0x127')]==='16'&&_0x305fbb[_0x873a('0x12a')]==='6'&&_[_0x873a('0xe1')](_0x21af38[_0x873a('0x12b')])){if(_0x21af38[_0x873a('0xc3')]){rpcDb['unlockContact'](_0x21af38[_0x873a('0xd4')]);}if(_0x21af38[_0x873a('0xca')]){rpcDb[_0x873a('0xd5')](_0x21af38[_0x873a('0xd4')]);}_0x305fbb[_0x873a('0xe2')]='22';this[_0x873a('0xe0')](_0x21af38,_0x58d298,_0x305fbb);}else if(_0x21af38&&_0x21af38['transfer']){if(_0x305fbb[_0x873a('0x127')]==='16'&&this['actions'][_0x305fbb['linkedid']][_0x873a('0x70')]){logger[_0x873a('0x6a')](_0x873a('0x12c'),_0x305fbb[_0x873a('0xa5')],_0x305fbb[_0x873a('0x127')],_0x873a('0xab'),_0x58d298[_0x873a('0x2a')],_0x873a('0x6f'),_0x58d298[_0x873a('0x2e')]);this[_0x873a('0x9d')](_0x305fbb,_0x305fbb[_0x873a('0xa5')],_0x305fbb[_0x873a('0x127')]);}else if(this[_0x873a('0x69')][_0x305fbb[_0x873a('0xa5')]][_0x873a('0x70')]){logger[_0x873a('0x6a')]('[syncHangup][talking][cause]',_0x305fbb['linkedid'],_0x305fbb[_0x873a('0x127')],_0x873a('0xab'),_0x58d298[_0x873a('0x2a')],_0x873a('0x6f'),_0x58d298[_0x873a('0x2e')]);this[_0x873a('0x9d')](_0x305fbb,_0x305fbb[_0x873a('0xa5')],_0x305fbb[_0x873a('0x127')]);}}};Preview[_0x873a('0x10')]['syncDialEnd']=function(_0x14929a){if(this[_0x873a('0x69')][_0x14929a[_0x873a('0xdf')]]&&_0x14929a['destlinkedid']!==_0x14929a[_0x873a('0x12d')]){this['callProgressDetectingCustomer'](_0x14929a,_0x14929a[_0x873a('0xdf')],_0x14929a[_0x873a('0xd9')]);}};Preview[_0x873a('0x10')][_0x873a('0x1f')]=function(_0x56198d){if(this[_0x873a('0x69')][_0x56198d[_0x873a('0xa5')]]&&_0x56198d['linkedid']!==_0x56198d[_0x873a('0xaa')]&&!this[_0x873a('0x69')][_0x56198d[_0x873a('0xa5')]][_0x873a('0x70')]){if(_0x56198d[_0x873a('0x127')]==='1'){this[_0x873a('0x9d')](_0x56198d,_0x56198d[_0x873a('0xa5')],_0x56198d[_0x873a('0x127')]);}}};Preview[_0x873a('0x10')][_0x873a('0x12e')]=function(_0xda1f0a,_0x385526,_0x4153cc){if(this[_0x873a('0x69')][_0xda1f0a]){if(_[_0x873a('0x68')](this[_0x873a('0x69')][_0xda1f0a][_0x873a('0x12f')])){this[_0x873a('0x69')][_0xda1f0a]['variables']={};}this['actions'][_0xda1f0a][_0x873a('0x12f')][_0x385526]=_0x4153cc;}};Preview[_0x873a('0x10')]['syncVarSet']=function(_0x3d55bc){try{if(!_[_0x873a('0x68')](_0x3d55bc)){if(ut['filterKey'](_[_0x873a('0x130')](_0x3d55bc[_0x873a('0x131')])[0x0])){this[_0x873a('0x12e')](_0x3d55bc['uniqueid'],_['keys'](_0x3d55bc[_0x873a('0x131')])[0x0],_0x3d55bc['value']);}}}catch(_0x241cfd){logger[_0x873a('0x132')](_0x873a('0x133'),util[_0x873a('0x134')](_0x241cfd,{'showHidden':![],'depth':null}));}};Preview[_0x873a('0x10')][_0x873a('0x26')]=function(_0x8c7280){if(_0x8c7280){if(this[_0x873a('0x69')][_0x8c7280[_0x873a('0x135')]]){this['actions'][_0x8c7280[_0x873a('0x135')]][_0x873a('0x12b')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x3566ee){if(_0x3566ee){if(this[_0x873a('0x69')][_0x3566ee['transfererlinkedid']]){this['actions'][_0x3566ee[_0x873a('0x136')]][_0x873a('0x12b')]=!![];}}};module[_0x873a('0x137')]=Preview; \ No newline at end of file +var _0x5385=['called','Calling','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlock','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','isEmpty','Agent','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','[Preview][validateContact][Campaign\x20Active]','Is\x20Valid','SIP/%s/%s%s','trim','substring','dialCutDigit','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','callerid','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','[originateFailure][logOriginateFailure]','channel','actionid','logLookAgent','YYYY-MM-DD\x20HH:mm:ss','response','custom:agentringnoanswer','rejected','starttime','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','cause','statedesc','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destuniqueid','variables','filterKey','keys','variable','value','error','inspect','transfertargetlinkedid','transfererlinkedid','exports','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','preview','actionPreview','./util/util','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','campaignsPreview','trunks','actions','agents','originateresponse','syncOriginateResponse','bind','hangup','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','available','pTalking','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalLowerLimit','predictiveIntervalTotalCalls','message','originated','Trunk','name','active','Interval','stringify','format','voice:queue:%s','voice_queue:save','voice_queue_channel:remove','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','syncCampaigns','clockClearZombieChannels','clearZombieChannels','setMessage','clearZombieChannel','sequence','isNil','info','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[action]','size','hasOwnProperty','recallMe','getContactRecallMe','agentReadyId','length','scheduledat','run','then','logger2','[RecallMe]','catch','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','sendMessageOneNotActive','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','totalGlobal','NoSuchNumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','ANSWER','responsetime','answertime','uniqueid','\x20Queue','custom:agentconnect','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','linkedid','BUSY','countbusyretry','Busy','[callProgressDetectingCustomer][logBusy]','dialBusyMaxRetry','rescheduleContact','scheduledAt','dialBusyRetryFrequency','activeContact','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','unlockAgent','CANCEL','unlockContact','idContact','disableContact','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20'];(function(_0x49f340,_0x33e696){var _0x293fdd=function(_0x44d44d){while(--_0x44d44d){_0x49f340['push'](_0x49f340['shift']());}};_0x293fdd(++_0x33e696);}(_0x5385,0x17e));var _0x5538=function(_0xe6d3d,_0x37bbcd){_0xe6d3d=_0xe6d3d-0x0;var _0x220c5f=_0x5385[_0xe6d3d];return _0x220c5f;};'use strict';var util=require('util');var _=require(_0x5538('0x0'));var BPromise=require(_0x5538('0x1'));var uuid=require(_0x5538('0x2'));var moment=require(_0x5538('0x3'));var md5=require(_0x5538('0x4'));var Redis=require(_0x5538('0x5'));var config=require(_0x5538('0x6'));var logger=require('../../../config/logger')(_0x5538('0x7'));var loggerAction=require('../../../config/logger')(_0x5538('0x8'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Action=require('./action');var ut=require(_0x5538('0x9'));config['redis']=_[_0x5538('0xa')](config['redis'],{'host':_0x5538('0xb'),'port':0x18eb});var io=require(_0x5538('0xc'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x5538('0xd')][_0x5538('0xe')]=function(_0x207e97){this['tail']=this[_0x5538('0xf')]?this[_0x5538('0xf')][_0x5538('0x10')](_0x207e97):_0x207e97();};function Preview(_0x2443b5){this['sequence']=new Sequence();this[_0x5538('0x11')]=_0x2443b5['voiceQueues'];this[_0x5538('0x12')]=_0x2443b5[_0x5538('0x12')];this[_0x5538('0x13')]={};this[_0x5538('0x14')]=_0x2443b5['agents'];this['clockClearZombieChannels']=0x0;ami['on'](_0x5538('0x15'),this[_0x5538('0x16')][_0x5538('0x17')](this));ami['on'](_0x5538('0x18'),this['syncHangup'][_0x5538('0x17')](this));ami['on']('hanguprequest',this[_0x5538('0x19')][_0x5538('0x17')](this));ami['on'](_0x5538('0x1a'),this[_0x5538('0x1b')]['bind'](this));ami['on'](_0x5538('0x1c'),this[_0x5538('0x1d')][_0x5538('0x17')](this));ami['on'](_0x5538('0x1e'),this[_0x5538('0x1f')][_0x5538('0x17')](this));ami['on'](_0x5538('0x20'),this[_0x5538('0x21')]['bind'](this));ami['on']('blindtransfer',this[_0x5538('0x22')]['bind'](this));this[_0x5538('0x23')](this['campaignsPreview']);}function emit(_0x1e7d04,_0x2b3b03,_0x24e611){io['to'](_0x1e7d04)[_0x5538('0x24')](_0x2b3b03,_0x24e611);}function emitCampaignPreview(_0x6b180f){if(_0x6b180f[_0x5538('0x25')]===_0x5538('0x26')){var _0x13de7a={'id':_0x6b180f['id'],'name':_0x6b180f['name'],'strategy':_0x6b180f['strategy'],'answered':_0x6b180f['answered'],'available':_0x6b180f[_0x5538('0x27')],'loggedIn':_0x6b180f['loggedIn'],'pTalking':_0x6b180f[_0x5538('0x28')],'sumBillable':_0x6b180f['sumBillable'],'sumDuration':_0x6b180f[_0x5538('0x29')],'sumHoldTime':_0x6b180f[_0x5538('0x2a')]||0x0,'talking':_0x6b180f[_0x5538('0x2b')],'total':_0x6b180f[_0x5538('0x2c')],'type':_0x6b180f[_0x5538('0x25')],'unmanaged':_0x6b180f[_0x5538('0x2d')],'abandoned':_0x6b180f[_0x5538('0x2e')],'waiting':_0x6b180f['waiting'],'loggedInDb':_0x6b180f[_0x5538('0x2f')],'dialActive':_0x6b180f[_0x5538('0x30')],'dialMethod':_0x6b180f[_0x5538('0x31')],'dialOriginateCallerIdName':_0x6b180f['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x6b180f['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x6b180f[_0x5538('0x32')],'dialPrefix':_0x6b180f[_0x5538('0x33')],'outboundAnswerAgiCallsDay':_0x6b180f[_0x5538('0x34')],'outboundAnswerCallsDay':_0x6b180f['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x6b180f[_0x5538('0x35')],'outboundBusyCallsDay':_0x6b180f[_0x5538('0x36')],'outboundCongestionCallsDay':_0x6b180f[_0x5538('0x37')],'outboundDropCallsDayACS':_0x6b180f[_0x5538('0x38')],'outboundDropCallsDayCallersExit':_0x6b180f[_0x5538('0x39')],'outboundDropCallsDayTimeout':_0x6b180f[_0x5538('0x3a')],'outboundNoAnswerCallsDay':_0x6b180f['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x6b180f[_0x5538('0x3b')],'outboundOriginateFailureCallsDay':_0x6b180f[_0x5538('0x3c')],'outboundReCallsDay':_0x6b180f[_0x5538('0x3d')],'outboundRejectCallsDay':_0x6b180f[_0x5538('0x3e')],'outboundUnknownCallsDay':_0x6b180f[_0x5538('0x3f')],'predictiveIntervalAnsweredCalls':_0x6b180f['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x6b180f[_0x5538('0x40')],'predictiveIntervalAvgTalktime':_0x6b180f[_0x5538('0x41')],'predictiveIntervalDroppedCallsCallersExit':_0x6b180f['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x6b180f['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x6b180f[_0x5538('0x42')],'predictiveIntervalErlangCallsDroppedCalls':_0x6b180f[_0x5538('0x43')],'predictiveIntervalHitRate':_0x6b180f['predictiveIntervalHitRate'],'predictiveIntervalLowerLimit':_0x6b180f[_0x5538('0x44')],'predictiveIntervalMultiplicativeFactor':_0x6b180f['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x6b180f['predictiveIntervalPauses'],'predictiveIntervalTotalCalls':_0x6b180f[_0x5538('0x45')],'message':_0x6b180f[_0x5538('0x46')],'originated':_0x6b180f[_0x5538('0x47')]};if(_0x6b180f[_0x5538('0x48')]){_0x13de7a[_0x5538('0x48')]={'id':_0x6b180f['Trunk']['id'],'name':_0x6b180f['Trunk'][_0x5538('0x49')],'active':_0x6b180f[_0x5538('0x48')][_0x5538('0x4a')],'callerid':_0x6b180f[_0x5538('0x48')]['callerid']};}if(_0x6b180f[_0x5538('0x4b')]){_0x13de7a[_0x5538('0x4b')]={'id':_0x6b180f[_0x5538('0x4b')]['id'],'name':_0x6b180f[_0x5538('0x4b')][_0x5538('0x49')]};}var _0x5d0fd9=md5(JSON[_0x5538('0x4c')](_0x13de7a));if(_0x6b180f[_0x5538('0x4')]!==_0x5d0fd9){_0x6b180f[_0x5538('0x4')]=_0x5d0fd9;emit(util[_0x5538('0x4d')](_0x5538('0x4e'),_0x13de7a['name']),_0x5538('0x4f'),_0x13de7a);}}}function emitVoiceQueueChannelRemove(_0x151fa0){emit(util['format'](_0x5538('0x4e'),_0x151fa0[_0x5538('0x49')]),_0x5538('0x50'),_0x151fa0);}function notSendMessagesQueue(_0x5808d0){if(_0x5808d0['sendMessageOneNotActive']){if(_0x5808d0[_0x5538('0x47')]===0x0&&_0x5808d0[_0x5538('0x28')]===0x0){_0x5808d0['sendMessageOneNotActive']=![];_0x5808d0[_0x5538('0x27')]=0x0;_0x5808d0[_0x5538('0x51')]=0x0;_0x5808d0[_0x5538('0x46')]=_0x5538('0x52');ut[_0x5538('0x53')](_0x5538('0x54'),_0x5808d0['name']+_0x5538('0x55'));}else{_0x5808d0[_0x5538('0x46')]=_0x5538('0x56');ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x5808d0[_0x5538('0x49')]+'\x20is\x20disactive');}emitCampaignPreview(_0x5808d0);}}Preview[_0x5538('0xd')][_0x5538('0x23')]=function(){var _0x1b9bbe=this;setInterval(function(){_0x1b9bbe[_0x5538('0x57')]();},0x7cf);};Preview['prototype'][_0x5538('0x57')]=function(){var _0x573081=this[_0x5538('0x11')];this[_0x5538('0x58')]+=0x1;for(var _0x5125c2 in _0x573081){if(_0x573081['hasOwnProperty'](_0x5125c2)&&(_0x573081[_0x5125c2][_0x5538('0x31')]==='preview'||_0x573081[_0x5125c2][_0x5538('0x31')]==='booked')&&_0x573081[_0x5125c2][_0x5538('0x25')]==='outbound'){if(this[_0x5538('0x58')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x5538('0x59')]();}}if(_0x573081['hasOwnProperty'](_0x5125c2)&&_0x573081[_0x5125c2][_0x5538('0x31')]==='preview'&&_0x573081[_0x5125c2][_0x5538('0x25')]===_0x5538('0x26')){if(_0x573081[_0x5125c2][_0x5538('0x30')]){this[_0x5538('0x5a')](_0x573081[_0x5125c2]);this['recallMe'](_0x573081[_0x5125c2]);}else{notSendMessagesQueue(_0x573081[_0x5125c2]);}}}};Preview['prototype'][_0x5538('0x5b')]=function(_0x20c965){var _0x58de6e=this;this[_0x5538('0x5c')][_0x5538('0xe')](function(){if(!_[_0x5538('0x5d')](_0x58de6e[_0x5538('0x13')][_0x20c965])){loggerAction[_0x5538('0x5e')](_0x5538('0x5f'),_0x20c965,_0x5538('0x60'),_0x58de6e['actions'][_0x20c965][_0x5538('0x61')],_0x5538('0x62'),JSON[_0x5538('0x4c')](_0x58de6e[_0x5538('0x11')][_0x58de6e[_0x5538('0x13')][_0x20c965][_0x5538('0x61')]][_0x5538('0x47')]),_0x5538('0x63'),JSON[_0x5538('0x4c')](_0x58de6e[_0x5538('0x11')][_0x58de6e['actions'][_0x20c965]['queue']][_0x5538('0x28')]),JSON[_0x5538('0x4c')](_0x58de6e['actions'][_0x20c965]['dialAnswer']),JSON['stringify'](_[_0x5538('0x64')](_0x58de6e[_0x5538('0x13')][_0x20c965],[_0x5538('0x65'),_0x5538('0x66'),_0x5538('0x67'),_0x5538('0x68')])));return ami[_0x5538('0x69')]({'action':_0x5538('0x6a'),'channel':_0x58de6e[_0x5538('0x13')][_0x20c965]['channel']})['catch'](function(_0x17e99c){if(_0x17e99c[_0x5538('0x46')]===_0x5538('0x6b')){setTimeout(function(){if(_0x58de6e[_0x5538('0x13')][_0x20c965]){ut[_0x5538('0x6c')](_0x58de6e[_0x5538('0x11')][_0x58de6e[_0x5538('0x13')][_0x20c965][_0x5538('0x61')]],_0x5538('0x6d'));if(_0x58de6e[_0x5538('0x13')][_0x20c965][_0x5538('0x6e')]===!![]){ut[_0x5538('0x6f')](_0x58de6e[_0x5538('0x11')][_0x58de6e[_0x5538('0x13')][_0x20c965]['queue']],_0x5538('0x6d'));ut[_0x5538('0x70')](_0x5538('0x71')+_0x20c965,_0x58de6e[_0x5538('0x13')][_0x20c965]['queue']);}ut[_0x5538('0x70')]('[Dialer][checkChannel][Preview]'+_0x20c965,_0x58de6e[_0x5538('0x13')][_0x20c965][_0x5538('0x61')]);delete _0x58de6e['actions'][_0x20c965];}},0x2328);}});}});};Preview[_0x5538('0xd')][_0x5538('0x59')]=function(){var _0x5afe03=this;loggerAction[_0x5538('0x5e')](_0x5538('0x72'),_[_0x5538('0x73')](this[_0x5538('0x13')]));for(var _0x2a6c91 in this['actions']){if(_0x5afe03[_0x5538('0x13')][_0x5538('0x74')](_0x2a6c91)){_0x5afe03[_0x5538('0x5b')](_0x2a6c91);}}};Preview['prototype'][_0x5538('0x75')]=function(_0x48a7a7){var _0x4cdb61=this;rpcDb[_0x5538('0x76')](_0x48a7a7['id'],ut[_0x5538('0x77')](this[_0x5538('0x14')]))['then'](function(_0x529df7){if(!_['isNil'](_0x529df7)){for(var _0x42383d=0x0;_0x42383d<_0x529df7[_0x5538('0x78')];_0x42383d+=0x1){if(ut['getDiff'](_0x529df7[_0x42383d][_0x5538('0x79')])<_0x48a7a7['dialRecallMeTimeout']*0x3c){_0x4cdb61[_0x5538('0x7a')](_0x529df7[_0x42383d]['id'])[_0x5538('0x7b')](ut[_0x5538('0x7c')](_0x5538('0x7d')))[_0x5538('0x7e')](ut[_0x5538('0x7c')](_0x5538('0x7d')));}else{var _0x20285b=new Action(_0x529df7[_0x42383d],_0x48a7a7);_0x20285b['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x48a7a7['outboundReCallsDay']+=0x1;ut[_0x5538('0x7f')](_0x20285b,0x17,_0x5538('0x80'));if(_0x48a7a7[_0x5538('0x81')]){rpcDb[_0x5538('0x82')](ut[_0x5538('0x83')](_0x529df7[_0x42383d]));rpcDb[_0x5538('0x84')](_0x20285b,_0x5538('0x85'));}else{ut[_0x5538('0x7f')](_0x20285b,0x16,_0x5538('0x86'));rpcDb['createCustomerHistory'](_0x20285b,_0x5538('0x87'));rpcDb[_0x5538('0x88')](_0x20285b,'[HistoryRecallClose]');}}}}})[_0x5538('0x7e')](ut[_0x5538('0x7c')](_0x5538('0x89')));};Preview[_0x5538('0xd')][_0x5538('0x5a')]=function(_0x3e3a35){_0x3e3a35[_0x5538('0x8a')]=!![];if(ut[_0x5538('0x8b')](_0x3e3a35['loggedIn'])){_0x3e3a35[_0x5538('0x46')]=_0x5538('0x8c');}else if(!ut['isActive'](_0x3e3a35[_0x5538('0x30')])){_0x3e3a35['message']=_0x5538('0x52');}else if(!this['isTrunkReachable'](_0x3e3a35['Trunk'])){if(!this[_0x5538('0x8d')](_0x3e3a35[_0x5538('0x8e')])){_0x3e3a35[_0x5538('0x46')]=_0x5538('0x8f');}else{_0x3e3a35['message']=_0x5538('0x90');}}else{_0x3e3a35[_0x5538('0x46')]=_0x5538('0x90');}emitCampaignPreview(_0x3e3a35);};Preview[_0x5538('0xd')][_0x5538('0x91')]=function(_0x3a2467,_0x4ac907,_0x2ef3e5){var _0x464851=this;var _0x4dda5b=this['actions'][_0x4ac907];var _0x57b4f3=this[_0x5538('0x11')][_0x4dda5b[_0x5538('0x61')]];var _0x1a35b5;if(_0x57b4f3){switch(_0x2ef3e5){case'1':_0x57b4f3[_0x5538('0x3b')]+=0x1;_0x4dda5b['countglobal']=ut[_0x5538('0x92')](_0x4dda5b);ut['logCustomer'](_0x4dda5b,0x0,_0x5538('0x93'));rpcDb[_0x5538('0x84')](_0x4dda5b,_0x5538('0x94'));if(ut[_0x5538('0x92')](_0x4dda5b)>=_0x57b4f3[_0x5538('0x95')]){_0x1a35b5=ut[_0x5538('0x96')](_0x4dda5b,0xf,_0x5538('0x97'));rpcDb[_0x5538('0x88')](_0x1a35b5,_0x5538('0x98'));}else{rpcDb['createCustomerFinal'](_0x4dda5b,_0x5538('0x98'));}delete this[_0x5538('0x13')][_0x3a2467['linkedid']];break;case _0x5538('0x99'):var _0x4b6461=moment()[_0x5538('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x4dda5b[_0x5538('0x9a')]=_0x4b6461;_0x4dda5b[_0x5538('0x9b')]=_0x4b6461;_0x4dda5b[_0x5538('0x6e')]=!![];_0x57b4f3['pTalking']+=0x1;logger[_0x5538('0x5e')]('[syncHangup][talking][increment]',_0x4dda5b[_0x5538('0x9c')],_0x5538('0x9d'),_0x57b4f3[_0x5538('0x49')],_0x5538('0x63'),_0x57b4f3[_0x5538('0x28')]);ami[_0x5538('0x24')](_0x5538('0x9e'),ut[_0x5538('0x9f')](_0x4dda5b,_0x5538('0xa0')));if(_0x57b4f3[_0x5538('0xa1')]){ami[_0x5538('0x24')](_0x5538('0xa2'),ut[_0x5538('0xa3')](_0x4dda5b));}break;case'16':ami[_0x5538('0x24')](_0x5538('0xa4'),ut[_0x5538('0x9f')](_0x4dda5b,'complete'));emitVoiceQueueChannelRemove(ut[_0x5538('0x9f')](_0x4dda5b,_0x5538('0xa5')));_0x57b4f3[_0x5538('0xa6')]+=0x1;_0x57b4f3[_0x5538('0x2c')]+=0x1;_0x57b4f3['answered']+=0x1;ut[_0x5538('0x6f')](_0x57b4f3,_0x5538('0xa7'));_0x4dda5b[_0x5538('0xa8')]=ut[_0x5538('0x92')](_0x4dda5b);ut['logCustomer'](_0x4dda5b,0x4,_0x5538('0xa9'));rpcDb[_0x5538('0x84')](_0x4dda5b,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x5538('0x88')](_0x4dda5b,_0x5538('0xaa'));rpcDb['crateCustomerReportQueue'](_0x4dda5b);_0x57b4f3[_0x5538('0x29')]+=_0x4dda5b[_0x5538('0xab')];_0x57b4f3['sumBillable']+=_0x4dda5b[_0x5538('0xab')];logger[_0x5538('0x5e')]('[syncHangup][talking][decrement]',_0x4dda5b['uniqueid'],'\x20Queue',_0x57b4f3[_0x5538('0x49')],_0x5538('0x63'),_0x57b4f3[_0x5538('0x28')]);delete this['actions'][_0x3a2467[_0x5538('0xac')]];break;case _0x5538('0xad'):_0x57b4f3[_0x5538('0x36')]+=0x1;_0x4dda5b[_0x5538('0xae')]+=0x1;_0x4dda5b[_0x5538('0xa8')]=ut['totalGlobal'](_0x4dda5b);ut['logCustomer'](_0x4dda5b,0x5,_0x5538('0xaf'));rpcDb[_0x5538('0x84')](_0x4dda5b,_0x5538('0xb0'));if(ut[_0x5538('0x92')](_0x4dda5b)>=_0x57b4f3[_0x5538('0x95')]){_0x1a35b5=ut[_0x5538('0x96')](_0x4dda5b,0xf,_0x5538('0x97'));rpcDb[_0x5538('0x88')](_0x1a35b5,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x4dda5b[_0x5538('0xae')]>=_0x57b4f3[_0x5538('0xb1')]){rpcDb[_0x5538('0x88')](_0x4dda5b,_0x5538('0xb0'));}else{rpcDb[_0x5538('0xb2')](ut[_0x5538('0xb3')](_0x4dda5b,_0x5538('0xae'),_0x57b4f3[_0x5538('0xb4')]),_0x4dda5b['unlockAgent'],_0x4dda5b[_0x5538('0xb5')]);}}break;case _0x5538('0xb6'):_0x57b4f3[_0x5538('0xb7')]+=0x1;_0x4dda5b[_0x5538('0xb8')]+=0x1;_0x4dda5b[_0x5538('0xa8')]=ut['totalGlobal'](_0x4dda5b);ut[_0x5538('0x7f')](_0x4dda5b,0x3,'NoAnswer');rpcDb[_0x5538('0x84')](_0x4dda5b,_0x5538('0xb9'));if(ut[_0x5538('0x92')](_0x4dda5b)>=_0x57b4f3[_0x5538('0x95')]){_0x1a35b5=ut[_0x5538('0x96')](_0x4dda5b,0xf,'Global');rpcDb[_0x5538('0x88')](_0x1a35b5,_0x5538('0xba'));}else{if(_0x4dda5b[_0x5538('0xb8')]>=_0x57b4f3['dialNoAnswerMaxRetry']){rpcDb[_0x5538('0x88')](_0x4dda5b,_0x5538('0xb9'));}else{rpcDb[_0x5538('0xb2')](ut['scheduledAt'](_0x4dda5b,'countnoanswerretry',_0x57b4f3[_0x5538('0xbb')]),_0x4dda5b['unlockAgent'],_0x4dda5b[_0x5538('0xb5')]);}}break;case _0x5538('0xbc'):_0x57b4f3[_0x5538('0x37')]+=0x1;_0x4dda5b[_0x5538('0xbd')]+=0x1;_0x4dda5b['countglobal']=ut[_0x5538('0x92')](_0x4dda5b);ut[_0x5538('0x7f')](_0x4dda5b,0x8,_0x5538('0xbe'));rpcDb[_0x5538('0x84')](_0x4dda5b,_0x5538('0xbf'));if(ut[_0x5538('0x92')](_0x4dda5b)>=_0x57b4f3[_0x5538('0x95')]){_0x1a35b5=ut[_0x5538('0x96')](_0x4dda5b,0xf,'Global');rpcDb[_0x5538('0x88')](_0x1a35b5,_0x5538('0xc0'));}else{if(_0x4dda5b[_0x5538('0xbd')]>=_0x57b4f3[_0x5538('0xc1')]){rpcDb[_0x5538('0x88')](_0x4dda5b,_0x5538('0xbf'));}else{rpcDb[_0x5538('0xb2')](ut['scheduledAt'](_0x4dda5b,'countcongestionretry',_0x57b4f3[_0x5538('0xb4')]),_0x4dda5b[_0x5538('0xc2')],_0x4dda5b['activeContact']);}}break;case _0x5538('0xc3'):_0x57b4f3['outboundRejectCallsDay']+=0x1;_0x4dda5b['countglobal']=ut[_0x5538('0x92')](_0x4dda5b);ut[_0x5538('0x7f')](_0x4dda5b,0x14,'AgentReject');rpcDb[_0x5538('0x84')](_0x4dda5b,'[syncHangupRequest][logAgentReject]');if(_0x4dda5b[_0x5538('0xc2')]){rpcDb[_0x5538('0xc4')](_0x4dda5b[_0x5538('0xc5')]);}if(_0x4dda5b[_0x5538('0xb5')]){rpcDb[_0x5538('0xc6')](_0x4dda5b[_0x5538('0xc5')]);}break;default:if(_0x4dda5b[_0x5538('0x6e')]){ut['decrementTalkink'](_0x57b4f3,_0x5538('0xc7'));ut[_0x5538('0x70')](_0x5538('0xc8')+_0x57b4f3[_0x5538('0x49')],_0x3a2467);}_0x57b4f3[_0x5538('0x3f')]+=0x1;_0x4dda5b[_0x5538('0xa8')]=ut[_0x5538('0x92')](_0x4dda5b);ut[_0x5538('0x7f')](_0x4dda5b,0xc,_0x3a2467[_0x5538('0xc9')]||_0x3a2467[_0x5538('0xca')]);rpcDb[_0x5538('0x84')](_0x4dda5b,_0x5538('0xcb'));if(ut[_0x5538('0x92')](_0x4dda5b)>=_0x57b4f3[_0x5538('0x95')]){_0x1a35b5=ut['cloneAction'](_0x4dda5b,0xf,_0x5538('0x97'));rpcDb[_0x5538('0x88')](_0x1a35b5,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x5538('0x88')](_0x4dda5b,_0x5538('0xcc'));}delete this[_0x5538('0x13')][_0x3a2467[_0x5538('0xac')]];}if(!(_0x4dda5b['dialAnswer']&&_0x2ef3e5==='16')){ut[_0x5538('0x6c')](_0x57b4f3,_0x5538('0xcd'));logger[_0x5538('0x5e')](_0x5538('0xce'),_0x4dda5b[_0x5538('0x9c')],_0x5538('0x9d'),_0x57b4f3[_0x5538('0x49')],'originated:\x20',_0x57b4f3[_0x5538('0x47')]);}if(_0x2ef3e5!=='ANSWER'){delete this[_0x5538('0x13')][_0x3a2467[_0x5538('0xac')]];delete this[_0x5538('0x13')][_0x3a2467[_0x5538('0xcf')]];}}};Preview[_0x5538('0xd')]['callProgressDetectingAgent']=function(_0x1cf19b,_0x424447,_0x27b867){if(_[_0x5538('0xd0')](_0x424447)&&_0x5538('0xd1')!==typeof _0x424447){return;}if(_[_0x5538('0xd0')](_0x27b867)&&_0x5538('0xd1')!==typeof _0x27b867){return;}switch(_0x27b867[_0x5538('0xd2')]){case'0':ut[_0x5538('0xd3')](_0x1cf19b,0x0,_0x5538('0x93'));rpcDb[_0x5538('0xd4')](_0x1cf19b,_0x5538('0xd5'));break;case'3':ut[_0x5538('0xd3')](_0x1cf19b,0x3,_0x5538('0xd6'));rpcDb[_0x5538('0xd4')](_0x1cf19b,_0x5538('0xd7'));break;case'5':ut[_0x5538('0xd3')](_0x1cf19b,0x5,'Busy');rpcDb['createAgentHistory'](_0x1cf19b,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x1cf19b,0x8,_0x5538('0xbe'));rpcDb[_0x5538('0xd4')](_0x1cf19b,_0x5538('0xd8'));break;case'22':ut[_0x5538('0xd3')](_0x1cf19b,0x16,_0x5538('0xd9'));rpcDb[_0x5538('0xd4')](_0x1cf19b,_0x5538('0xda'));break;default:ut[_0x5538('0xd3')](_0x1cf19b,0xc,_0x27b867[_0x5538('0xd2')]);rpcDb[_0x5538('0xd4')](_0x1cf19b,_0x5538('0xd8'));}ut['updateOriginated'](_0x424447,_0x5538('0xdb'));logger[_0x5538('0x5e')](_0x5538('0xdc'),_0x1cf19b[_0x5538('0x9c')],_0x5538('0x9d'),_0x424447['name'],_0x5538('0x62'),_0x424447[_0x5538('0x47')]);delete this[_0x5538('0x13')][_0x1cf19b[_0x5538('0x9c')]];};Preview[_0x5538('0xd')][_0x5538('0xdd')]=function(_0x2fe28d,_0x299b12,_0x16e71d,_0x22e36d,_0x4b0fb6){var _0x304876=this;return new BPromise(function(_0x4e6aca,_0x7904b3){if(_[_0x5538('0x5d')](_0x299b12)||_[_0x5538('0x5d')](_0x299b12[_0x5538('0xde')])||_['isNil'](_0x299b12['Contact'][_0x5538('0xdf')])||_[_0x5538('0x5d')](_0x299b12[_0x5538('0x67')])){_0x7904b3(ut[_0x5538('0x46')](_0x5538('0xe0'),_0x22e36d,_0x4b0fb6));return;}var _0x5cacf8=uuid['v4']();var _0x1b12d5=_0x304876[_0x5538('0x11')][_0x299b12[_0x5538('0x60')]['name']];var _0x392ae4=_0x16e71d?_0x304876[_0x5538('0x14')][_0x16e71d]['id']:undefined;_0x304876[_0x5538('0x13')][_0x5cacf8]=new Action(_0x299b12,_0x1b12d5,_0x5cacf8,_0x16e71d,_0x392ae4);var _0x83454a=_0x304876[_0x5538('0x13')][_0x5cacf8];_0x83454a[_0x5538('0xc2')]=_0x22e36d;_0x83454a[_0x5538('0xb5')]=_0x4b0fb6;_0x83454a[_0x5538('0xe1')]=_0x16e71d;if(_['isEmpty'](_0x2fe28d)){_0x304876[_0x5538('0xe2')](_0x83454a,_0x1b12d5,_0x299b12,_0x16e71d)[_0x5538('0x7b')](function(_0x480a72){logger[_0x5538('0x5e')](_0x5538('0xe3'),_0x5538('0xe4')+_0x83454a[_0x5538('0x61')]+_0x5538('0xe5')+_0x83454a[_0x5538('0xc5')],JSON[_0x5538('0x4c')](_0x480a72));ami[_0x5538('0x24')]('custom:agentcalled',ut[_0x5538('0x9f')](_0x83454a,_0x5538('0xe6')));_0x4e6aca(ut[_0x5538('0x46')](_0x5538('0xe7')));})[_0x5538('0x7e')](function(_0x54552d){ut[_0x5538('0x53')]('[Preview][execCall][failure]',_0x54552d);_0x7904b3(ut[_0x5538('0x46')]('Call\x20failed',_0x22e36d,_0x4b0fb6));});}else{_0x1b12d5[_0x5538('0x35')]+=0x1;ut['logBlacklist'](_0x83454a);rpcDb[_0x5538('0xe8')](_0x83454a,_0x5538('0xe9'));delete _0x304876['actions'][_0x5cacf8];_0x7904b3(ut[_0x5538('0x46')](_0x5538('0xea'),_0x22e36d,_0x4b0fb6));}});};Preview[_0x5538('0xd')]['isTrunkReachable']=function(_0x24e680){return!_['isNil'](_0x24e680)&&!_[_0x5538('0x5d')](_0x24e680[_0x5538('0x49')])&&!_[_0x5538('0x5d')](_0x24e680[_0x5538('0x4a')])&&_0x24e680[_0x5538('0x4a')]&&!_[_0x5538('0x5d')](this[_0x5538('0x12')][util[_0x5538('0x4d')](_0x5538('0xeb'),_0x24e680[_0x5538('0x49')])])&&!_[_0x5538('0x5d')](this[_0x5538('0x12')][util[_0x5538('0x4d')]('SIP/%s',_0x24e680[_0x5538('0x49')])][_0x5538('0x6a')])&&(this[_0x5538('0x12')][util[_0x5538('0x4d')](_0x5538('0xeb'),_0x24e680['name'])][_0x5538('0x6a')]===_0x5538('0xec')||this[_0x5538('0x12')][util[_0x5538('0x4d')](_0x5538('0xeb'),_0x24e680[_0x5538('0x49')])][_0x5538('0x6a')]===_0x5538('0xed'));};Preview[_0x5538('0xd')][_0x5538('0x7a')]=function(_0x48216f,_0x3454be){var _0xbc4d1a=this;return new BPromise(function(_0x3ffc2a,_0x41a545){_0xbc4d1a[_0x5538('0xee')](_0x48216f,_0x3454be)[_0x5538('0x7b')](function(_0x25219d){_0x3ffc2a(_[_0x5538('0x64')](_0x25219d,[_0x5538('0x46')]));})[_0x5538('0x7e')](function(_0x403c13){if(_0x403c13[_0x5538('0xef')]){rpcDb[_0x5538('0xc4')](_0x48216f);}if(_0x403c13[_0x5538('0x4a')]){rpcDb['disableContact'](_0x48216f);}_0x41a545(_['pick'](_0x403c13,[_0x5538('0x46')]));});});};Preview[_0x5538('0xd')]['execRun']=function(_0x42d275,_0x5c3bba){var _0x4b0604=this;return new BPromise(function(_0x360cbb,_0x538ec8){var _0x4bea06,_0x1a0dff;rpcDb[_0x5538('0xf0')](_0x42d275)['then'](function(_0x470fd3){if(!_[_0x5538('0x5d')](_0x470fd3[0x0])){_0x1a0dff=_0x470fd3[0x0][_0x5538('0xf1')]?![]:!![];_0x4bea06=_0x470fd3[0x0][_0x5538('0xf1')]?!![]:![];_0x4bea06=_0x5c3bba?!![]:_0x4bea06;}var _0x406d5c=_0x4b0604[_0x5538('0xf2')](_0x470fd3);if(_0x406d5c[_0x5538('0xf3')]){rpcDb[_0x5538('0xf4')](_['pick'](_0x470fd3[0x0],[_0x5538('0x67'),_0x5538('0xf5')]))['then'](function(_0x29a5b9){_0x4b0604[_0x5538('0xdd')](_0x29a5b9,_0x470fd3[0x0],_0x5c3bba,_0x1a0dff,_0x4bea06)[_0x5538('0x7b')](function(_0x4e5fef){_0x360cbb(_0x4e5fef);})['catch'](function(_0x2f3354){_0x538ec8(_0x2f3354);});})[_0x5538('0x7e')](function(_0x8e6da5){ut[_0x5538('0x53')](_0x5538('0xf6'),_0x8e6da5);_0x538ec8(ut[_0x5538('0x46')](_0x5538('0xf7'),_0x1a0dff,_0x4bea06));});}else{_0x538ec8(ut['message'](_0x406d5c['message'],_0x1a0dff,_0x4bea06));}})[_0x5538('0x7e')](function(_0x4cf394){ut[_0x5538('0x53')]('[Preview][getContactPreview]',_0x4cf394);_0x538ec8(ut[_0x5538('0x46')](_0x5538('0xf7'),![],!![]));});});};Preview[_0x5538('0xd')][_0x5538('0xf2')]=function(_0x54c1db){if(_[_0x5538('0x5d')](_0x54c1db)||_[_0x5538('0xf8')](_0x54c1db)||!_['isNil'](_0x54c1db[0x0][_0x5538('0xf9')])&&_['isNil'](_0x54c1db[0x0]['Agent']['name'])){ut[_0x5538('0x53')]('[Preview][validateContact][Empty\x20Contact]',_0x54c1db);return{'isValid':![],'message':_0x5538('0xfa')};}var _0x2f13b3=this[_0x5538('0x11')][_0x54c1db[0x0][_0x5538('0x60')]['name']];_0x2f13b3[_0x5538('0x46')]=_0x5538('0x90');if(_['isNil'](_0x2f13b3)){ut['logger'](_0x5538('0xfb'),_0x2f13b3);return{'isValid':![],'message':_0x5538('0xfc')};}if(!this[_0x5538('0x8d')](_0x2f13b3['Trunk'])){ut['logger'](_0x5538('0xfd'),_0x5538('0xfe')+_0x2f13b3[_0x5538('0x49')]+_0x5538('0xff'));if(!this[_0x5538('0x8d')](_0x2f13b3[_0x5538('0x8e')])){ut[_0x5538('0x53')](_0x5538('0xfd'),_0x2f13b3['name']+_0x5538('0x100'));return{'isValid':![],'message':_0x5538('0x101')};}}if(!ut[_0x5538('0x102')](_0x2f13b3[_0x5538('0x30')])){ut[_0x5538('0x53')](_0x5538('0x103'),_0x2f13b3[_0x5538('0x49')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x5538('0xfe')+_0x2f13b3[_0x5538('0x49')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x5538('0x104')};};Preview[_0x5538('0xd')][_0x5538('0xe2')]=function(_0x486aee,_0x4e6f8d,_0xe901c8,_0x56185c){var _0x2bce61=this;return new BPromise(function(_0x1b31a5,_0x46e2a0){var _0x1beaa0=_0x486aee['uniqueid'];var _0x16649a=_0x2bce61[_0x5538('0x8d')](_0x4e6f8d[_0x5538('0x48')])?util['format'](_0x5538('0x105'),_0x4e6f8d[_0x5538('0x48')][_0x5538('0x49')],_[_0x5538('0x5d')](_0x4e6f8d[_0x5538('0x33')])?'':_0x4e6f8d[_0x5538('0x33')][_0x5538('0x106')]()||'',_0x4e6f8d['dialCutDigit']>0x0?_0xe901c8[_0x5538('0xde')][_0x5538('0xdf')][_0x5538('0x107')](_0x4e6f8d[_0x5538('0x108')]):_0xe901c8[_0x5538('0xde')]['phone']):util[_0x5538('0x4d')](_0x5538('0x105'),_['isNil'](_0x4e6f8d['TrunkBackup'])?_0x4e6f8d['Trunk'][_0x5538('0x49')]:_0x4e6f8d[_0x5538('0x8e')][_0x5538('0x49')],_['isNil'](_0x4e6f8d['dialPrefix'])?'':_0x4e6f8d[_0x5538('0x33')][_0x5538('0x106')]()||'',_0x4e6f8d[_0x5538('0x108')]>0x0?_0xe901c8[_0x5538('0xde')][_0x5538('0xdf')]['substring'](_0x4e6f8d[_0x5538('0x108')]):_0xe901c8[_0x5538('0xde')]['phone']);var _0x471f5c=_0x2bce61[_0x5538('0x8d')](_0x4e6f8d[_0x5538('0x48')])?ut[_0x5538('0x109')](_0x4e6f8d[_0x5538('0x48')]['callerid'],_0x4e6f8d[_0x5538('0x10a')],_0x4e6f8d[_0x5538('0x10b')]>0x0?ut[_0x5538('0x10c')](_0x4e6f8d['dialOriginateCallerIdNumber'],_0x4e6f8d[_0x5538('0x10b')]):_0x4e6f8d[_0x5538('0x10d')]):ut[_0x5538('0x109')](_[_0x5538('0x5d')](_0x4e6f8d[_0x5538('0x8e')])?_0x4e6f8d[_0x5538('0x48')][_0x5538('0x10e')]:_0x4e6f8d[_0x5538('0x8e')][_0x5538('0x10e')],_0x4e6f8d[_0x5538('0x10a')],_0x4e6f8d[_0x5538('0x10b')]>0x0?ut[_0x5538('0x10c')](_0x4e6f8d[_0x5538('0x10d')],_0x4e6f8d[_0x5538('0x10b')]):_0x4e6f8d[_0x5538('0x10d')]);if(_0x471f5c){_0x486aee[_0x5538('0x10f')]=ut[_0x5538('0x110')](_0x471f5c);_0x486aee[_0x5538('0x111')]=ut[_0x5538('0x112')](_0x471f5c);}var _0x2720fc=ut[_0x5538('0x113')](_0x4e6f8d,_0xe901c8,_0x16649a,_0x471f5c,_0x1beaa0,_0x486aee);_[_0x5538('0x114')](_0x486aee,ut['toLowerVariables'](_0x2720fc));_0x486aee['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ami[_0x5538('0x69')](ut['variablesAction'](_0x486aee,_0x4e6f8d,_0x2720fc,_0x486aee[_0x5538('0xb5')],_0x56185c))[_0x5538('0x7b')](function(_0x4cbfca){_0x4e6f8d[_0x5538('0x47')]+=0x1;logger[_0x5538('0x5e')]('[originated][increment]',_0x1beaa0,_0x5538('0x9d'),_0x4e6f8d[_0x5538('0x49')],_0x5538('0x62'),_0x4e6f8d['originated']);_0x1b31a5(_0x4cbfca);})[_0x5538('0x7e')](function(_0x595d98){ut[_0x5538('0xd3')](_0x486aee,0xe,'OriginateError');rpcDb[_0x5538('0xd4')](_0x486aee,_0x5538('0x115'));_0x46e2a0(_0x595d98);});});};Preview[_0x5538('0xd')][_0x5538('0x1d')]=function(_0x453756){if(this[_0x5538('0x13')][_0x453756[_0x5538('0xac')]]){this[_0x5538('0x13')][_0x453756[_0x5538('0xac')]][_0x5538('0x116')]=_0x453756['channel'];}};Preview[_0x5538('0xd')]['syncOriginateResponse']=function(_0x4c512b){var _0x452ef3=this;var _0x58cc1b=this[_0x5538('0x13')][_0x4c512b[_0x5538('0x117')]];if(_0x58cc1b){if(_0x58cc1b['lookAgent']&&this[_0x5538('0x14')][_0x58cc1b[_0x5538('0xe1')]]){ut[_0x5538('0x118')](_0x58cc1b,this['agents'][_0x58cc1b[_0x5538('0xe1')]][_0x5538('0x49')],this[_0x5538('0x14')][_0x58cc1b[_0x5538('0xe1')]]['id']);}var _0x196552=_['clone'](_0x58cc1b);_0x196552[_0x5538('0x9a')]=moment()[_0x5538('0x4d')](_0x5538('0x119'));var _0x318510=_0x452ef3[_0x5538('0x11')][_0x58cc1b[_0x5538('0x61')]];if(ut['isFailure'](_0x4c512b[_0x5538('0x11a')])){if(_0x58cc1b['unlockAgent']){rpcDb['unlockContact'](_0x58cc1b['idContact']);}if(_0x58cc1b[_0x5538('0xb5')]){rpcDb[_0x5538('0xc6')](_0x58cc1b['idContact']);}ami['emit'](_0x5538('0x11b'),ut[_0x5538('0x9f')](_0x58cc1b,_0x5538('0x11c')));this['callProgressDetectingAgent'](_0x196552,_0x318510,_0x4c512b);}else{_0x58cc1b[_0x5538('0x11d')]=moment()[_0x5538('0x4d')](_0x5538('0x119'));ut['logAgent'](_0x196552,0x4,_0x5538('0xa9'));rpcDb['createAgentHistory'](_0x196552,_0x5538('0x11e'));}}};Preview[_0x5538('0xd')][_0x5538('0x11f')]=function(_0xdfa1fb){var _0x34db7d=this;var _0x31c7f1=this['actions'][_0xdfa1fb[_0x5538('0xac')]];var _0x2d91c9;if(_0x31c7f1){_0x2d91c9=this['campaignsPreview'][_0x31c7f1[_0x5538('0x61')]];logger[_0x5538('0x5e')](_0x5538('0x120'),_0xdfa1fb[_0x5538('0xac')],_0x5538('0x9d'),_0x2d91c9['name'],'pTalking:\x20',_0x2d91c9[_0x5538('0x28')]);}if(this['actions'][_0xdfa1fb[_0x5538('0xac')]]&&_0xdfa1fb[_0x5538('0xac')]!==_0xdfa1fb[_0x5538('0x9c')]){if(_0xdfa1fb[_0x5538('0x121')]==='16'&&this['actions'][_0xdfa1fb[_0x5538('0xac')]][_0x5538('0x6e')]){this[_0x5538('0x91')](_0xdfa1fb,_0xdfa1fb[_0x5538('0xac')],_0xdfa1fb[_0x5538('0x121')]);}else if(this[_0x5538('0x13')][_0xdfa1fb['linkedid']][_0x5538('0x6e')]){logger['info']('[syncHangup][talking][cause]',_0xdfa1fb[_0x5538('0xac')],_0xdfa1fb[_0x5538('0x121')],_0x5538('0x9d'),_0x2d91c9[_0x5538('0x49')],'pTalking:\x20',_0x2d91c9['pTalking']);this[_0x5538('0x91')](_0xdfa1fb,_0xdfa1fb[_0x5538('0xac')],_0xdfa1fb['cause']);}}else if(_0x31c7f1&&_[_0x5538('0x5d')](_0x31c7f1[_0x5538('0x122')])&&_0x2d91c9['dialQueueProject']&&_0xdfa1fb['linkedid']===_0xdfa1fb[_0x5538('0x9c')]&&_[_0x5538('0x5d')](_0xdfa1fb[_0x5538('0xd2')])&&_0xdfa1fb[_0x5538('0x121')]==='16'&&_0xdfa1fb[_0x5538('0x123')]==='6'&&_[_0x5538('0xd0')](_0x31c7f1[_0x5538('0x124')])){if(_0x31c7f1[_0x5538('0xc2')]){rpcDb[_0x5538('0xc4')](_0x31c7f1['idContact']);}if(_0x31c7f1['activeContact']){rpcDb[_0x5538('0xc6')](_0x31c7f1[_0x5538('0xc5')]);}_0xdfa1fb[_0x5538('0xd2')]='22';this['callProgressDetectingAgent'](_0x31c7f1,_0x2d91c9,_0xdfa1fb);}else if(_0x31c7f1&&_0x31c7f1[_0x5538('0x124')]){if(_0xdfa1fb['cause']==='16'&&this[_0x5538('0x13')][_0xdfa1fb[_0x5538('0xac')]][_0x5538('0x6e')]){logger[_0x5538('0x5e')](_0x5538('0x125'),_0xdfa1fb[_0x5538('0xac')],_0xdfa1fb[_0x5538('0x121')],_0x5538('0x9d'),_0x2d91c9[_0x5538('0x49')],_0x5538('0x63'),_0x2d91c9['pTalking']);this[_0x5538('0x91')](_0xdfa1fb,_0xdfa1fb[_0x5538('0xac')],_0xdfa1fb[_0x5538('0x121')]);}else if(this[_0x5538('0x13')][_0xdfa1fb['linkedid']][_0x5538('0x6e')]){logger[_0x5538('0x5e')](_0x5538('0x126'),_0xdfa1fb[_0x5538('0xac')],_0xdfa1fb[_0x5538('0x121')],_0x5538('0x9d'),_0x2d91c9['name'],_0x5538('0x63'),_0x2d91c9[_0x5538('0x28')]);this[_0x5538('0x91')](_0xdfa1fb,_0xdfa1fb[_0x5538('0xac')],_0xdfa1fb[_0x5538('0x121')]);}}};Preview['prototype']['syncDialEnd']=function(_0x1ad65c){if(this[_0x5538('0x13')][_0x1ad65c[_0x5538('0xcf')]]&&_0x1ad65c['destlinkedid']!==_0x1ad65c[_0x5538('0x127')]){this[_0x5538('0x91')](_0x1ad65c,_0x1ad65c[_0x5538('0xcf')],_0x1ad65c[_0x5538('0xca')]);}};Preview['prototype'][_0x5538('0x19')]=function(_0x58766a){if(this['actions'][_0x58766a['linkedid']]&&_0x58766a[_0x5538('0xac')]!==_0x58766a[_0x5538('0x9c')]&&!this['actions'][_0x58766a[_0x5538('0xac')]]['dialAnswer']){if(_0x58766a[_0x5538('0x121')]==='1'){this['callProgressDetectingCustomer'](_0x58766a,_0x58766a[_0x5538('0xac')],_0x58766a['cause']);}}};Preview[_0x5538('0xd')]['addVariable']=function(_0x1623ee,_0x2bfa17,_0x2bac87){if(this[_0x5538('0x13')][_0x1623ee]){if(_[_0x5538('0x5d')](this[_0x5538('0x13')][_0x1623ee][_0x5538('0x128')])){this[_0x5538('0x13')][_0x1623ee][_0x5538('0x128')]={};}this[_0x5538('0x13')][_0x1623ee][_0x5538('0x128')][_0x2bfa17]=_0x2bac87;}};Preview[_0x5538('0xd')]['syncVarSet']=function(_0x1c2e3a){try{if(!_[_0x5538('0x5d')](_0x1c2e3a)){if(ut[_0x5538('0x129')](_[_0x5538('0x12a')](_0x1c2e3a[_0x5538('0x12b')])[0x0])){this['addVariable'](_0x1c2e3a[_0x5538('0x9c')],_[_0x5538('0x12a')](_0x1c2e3a[_0x5538('0x12b')])[0x0],_0x1c2e3a[_0x5538('0x12c')]);}}}catch(_0x5ba3a8){logger[_0x5538('0x12d')]('[syncVarSet][Preview]',util[_0x5538('0x12e')](_0x5ba3a8,{'showHidden':![],'depth':null}));}};Preview[_0x5538('0xd')]['syncAttendedTransfer']=function(_0x19075f){if(_0x19075f){if(this[_0x5538('0x13')][_0x19075f[_0x5538('0x12f')]]){this[_0x5538('0x13')][_0x19075f['transfertargetlinkedid']][_0x5538('0x124')]=!![];}}};Preview[_0x5538('0xd')][_0x5538('0x22')]=function(_0x4f9f3c){if(_0x4f9f3c){if(this[_0x5538('0x13')][_0x4f9f3c[_0x5538('0x130')]]){this['actions'][_0x4f9f3c[_0x5538('0x130')]][_0x5538('0x124')]=!![];}}};module[_0x5538('0x131')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 7a27639..a8b9f24 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 _0x74f0=['../rpc/voiceQueueReport','error','inspect','then','createHistory','catch','[createHistory]\x20','resolve','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[activeContact]\x20','crateCustomerReportQueue','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','membername','exten','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory'];(function(_0x4d150a,_0x25f904){var _0x885bd4=function(_0x552a7d){while(--_0x552a7d){_0x4d150a['push'](_0x4d150a['shift']());}};_0x885bd4(++_0x25f904);}(_0x74f0,0xf8));var _0x074f=function(_0x3b5e02,_0x535469){_0x3b5e02=_0x3b5e02-0x0;var _0x59464c=_0x74f0[_0x3b5e02];return _0x59464c;};'use strict';var util=require(_0x074f('0x0'));var BPromise=require('bluebird');var logger=require(_0x074f('0x1'))(_0x074f('0x2'));var _=require(_0x074f('0x3'));var cmHopper=require(_0x074f('0x4'));var cmHopperFinal=require(_0x074f('0x5'));var cmHopperHistory=require(_0x074f('0x6'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x074f('0x7'));function loggerCatch(_0xf21d62){return function(_0xe3889d){logger[_0x074f('0x8')](_0xf21d62,util[_0x074f('0x9')](_0xe3889d,{'showHidden':![],'depth':null}));};}function create(_0x4eedbf){return BPromise['resolve']()[_0x074f('0xa')](cmHopperHistory[_0x074f('0xb')](_0x4eedbf))[_0x074f('0xc')](loggerCatch(_0x074f('0xd')));}function createAgent(_0x2f5937){return BPromise[_0x074f('0xe')]()[_0x074f('0xa')](agentReportPreview[_0x074f('0xb')](_0x2f5937))[_0x074f('0xc')](loggerCatch(_0x074f('0xd')));}function moveContact(_0x5c82fe){return BPromise[_0x074f('0xe')]()['then'](cmHopper[_0x074f('0xf')](_0x5c82fe,!![]))[_0x074f('0xc')](loggerCatch(_0x074f('0x10')));}exports['checkIsBlackList']=function(_0x53235e){return BPromise[_0x074f('0xe')]()[_0x074f('0xa')](cmHopperBlack[_0x074f('0x11')](_0x53235e))[_0x074f('0xc')](loggerCatch(_0x074f('0x12')));};exports[_0x074f('0x13')]=function(_0x4c032f){return BPromise[_0x074f('0xe')]()['then'](cmHopper['getContactPreview'](_0x4c032f))[_0x074f('0xc')](loggerCatch(_0x074f('0x14')));};exports[_0x074f('0xb')]=function(_0x2091e7,_0x23eeda){create(_0x2091e7)['catch'](loggerCatch(_0x23eeda));moveContact(_0x2091e7)[_0x074f('0xc')](loggerCatch(_0x23eeda));};exports[_0x074f('0x15')]=function(_0x334cbd,_0x37ee02){createAgent(_0x334cbd)['catch'](loggerCatch(_0x37ee02));};exports['createCustomerHistory']=function(_0x5ede54,_0x31a968){create(_0x5ede54)[_0x074f('0xc')](loggerCatch(_0x31a968));};exports[_0x074f('0x16')]=function(_0x3cdef4,_0x4716b1){moveContact(_0x3cdef4)[_0x074f('0xc')](loggerCatch(_0x4716b1));};exports[_0x074f('0x17')]=function(_0x5dda92,_0x4d7439,_0x2dabab){if(_0x4d7439){_0x5dda92['UserId']=null;}if(_0x2dabab){_0x5dda92['active']=![];}return BPromise[_0x074f('0xe')]()['then'](cmHopper[_0x074f('0x17')](_0x5dda92))[_0x074f('0xc')](loggerCatch(_0x074f('0x18')));};exports[_0x074f('0x19')]=function(_0x118054){return BPromise[_0x074f('0xe')]()['then'](cmHopper['countReScheduled'](_0x118054))[_0x074f('0xc')](loggerCatch(_0x074f('0x1a')));};exports[_0x074f('0x1b')]=function(_0x104c0a){return BPromise[_0x074f('0xe')]()['then'](cmHopper[_0x074f('0x1b')]({'UserId':null},_0x104c0a,0x1))[_0x074f('0xc')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x3ccdc9){return BPromise[_0x074f('0xe')]()[_0x074f('0xa')](cmHopper[_0x074f('0x1b')]({'active':![]},_0x3ccdc9,0x1))[_0x074f('0xc')](loggerCatch(_0x074f('0x1c')));};exports[_0x074f('0x1d')]=function(_0x3f748b){var _0x21c5da={};_0x21c5da['type']=_0x3f748b['type'];_0x21c5da['uniqueid']=_0x3f748b[_0x074f('0x1e')];_0x21c5da[_0x074f('0x1f')]=_0x3f748b[_0x074f('0x1f')];_0x21c5da['calleridname']=_0x3f748b[_0x074f('0x20')];_0x21c5da[_0x074f('0x21')]=_0x3f748b[_0x074f('0x21')];_0x21c5da[_0x074f('0x22')]=_0x3f748b[_0x074f('0x23')];_0x21c5da[_0x074f('0x24')]=_0x3f748b[_0x074f('0x23')];_0x21c5da[_0x074f('0x25')]=0x1;_0x21c5da[_0x074f('0x26')]=_0x3f748b[_0x074f('0x27')];_0x21c5da['connectedlinename']=_0x3f748b[_0x074f('0x28')];_0x21c5da['context']='from-sip';_0x21c5da[_0x074f('0x29')]='xcally-motion-preview';_0x21c5da['holdtime']=0x0;_0x21c5da[_0x074f('0x2a')]=0x1;_0x21c5da[_0x074f('0x2b')]=_0x3f748b['membername'];_0x21c5da[_0x074f('0x2c')]=_0x074f('0x2d');return BPromise[_0x074f('0xe')]()[_0x074f('0xa')](voiceQueueReport[_0x074f('0x2e')](_0x21c5da))[_0x074f('0xc')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x074f('0x2f')]=function(_0x2965c0,_0x626e1d){return BPromise[_0x074f('0xe')]()[_0x074f('0xa')](cmHopper['getContactRecallMe'](_0x2965c0,_0x626e1d))['catch'](loggerCatch(_0x074f('0x30')));};exports[_0x074f('0x31')]=function(_0x372abf){return BPromise['resolve']()[_0x074f('0xa')](cmHopper[_0x074f('0x17')](_0x372abf,!![],!![]))[_0x074f('0xc')](loggerCatch(_0x074f('0x32')));}; \ No newline at end of file +var _0xf37d=['[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','context','from-sip','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20'];(function(_0x392cd9,_0x31df7d){var _0x2e2fa3=function(_0xf77ea0){while(--_0xf77ea0){_0x392cd9['push'](_0x392cd9['shift']());}};_0x2e2fa3(++_0x31df7d);}(_0xf37d,0xb5));var _0xdf37=function(_0x3dee92,_0x55e1eb){_0x3dee92=_0x3dee92-0x0;var _0x44d36e=_0xf37d[_0x3dee92];return _0x44d36e;};'use strict';var util=require(_0xdf37('0x0'));var BPromise=require(_0xdf37('0x1'));var logger=require(_0xdf37('0x2'))(_0xdf37('0x3'));var _=require('lodash');var cmHopper=require(_0xdf37('0x4'));var cmHopperFinal=require(_0xdf37('0x5'));var cmHopperHistory=require(_0xdf37('0x6'));var cmHopperBlack=require(_0xdf37('0x7'));var voiceQueueRt=require(_0xdf37('0x8'));var agentReportPreview=require(_0xdf37('0x9'));var voiceQueueReport=require(_0xdf37('0xa'));function loggerCatch(_0xc6957d){return function(_0x19470c){logger[_0xdf37('0xb')](_0xc6957d,util[_0xdf37('0xc')](_0x19470c,{'showHidden':![],'depth':null}));};}function create(_0x2c7fc1){return BPromise[_0xdf37('0xd')]()['then'](cmHopperHistory[_0xdf37('0xe')](_0x2c7fc1))[_0xdf37('0xf')](loggerCatch(_0xdf37('0x10')));}function createAgent(_0x58b850){return BPromise[_0xdf37('0xd')]()[_0xdf37('0x11')](agentReportPreview[_0xdf37('0xe')](_0x58b850))['catch'](loggerCatch(_0xdf37('0x10')));}function moveContact(_0x2ff319){return BPromise['resolve']()['then'](cmHopper[_0xdf37('0x12')](_0x2ff319,!![]))[_0xdf37('0xf')](loggerCatch(_0xdf37('0x13')));}exports[_0xdf37('0x14')]=function(_0x1e0419){return BPromise[_0xdf37('0xd')]()[_0xdf37('0x11')](cmHopperBlack[_0xdf37('0x14')](_0x1e0419))['catch'](loggerCatch(_0xdf37('0x15')));};exports[_0xdf37('0x16')]=function(_0x487783){return BPromise[_0xdf37('0xd')]()[_0xdf37('0x11')](cmHopper['getContactPreview'](_0x487783))[_0xdf37('0xf')](loggerCatch(_0xdf37('0x17')));};exports[_0xdf37('0xe')]=function(_0x484aff,_0x378a2f){create(_0x484aff)['catch'](loggerCatch(_0x378a2f));moveContact(_0x484aff)[_0xdf37('0xf')](loggerCatch(_0x378a2f));};exports[_0xdf37('0x18')]=function(_0x5e49cf,_0x29a881){createAgent(_0x5e49cf)[_0xdf37('0xf')](loggerCatch(_0x29a881));};exports[_0xdf37('0x19')]=function(_0x4c4e9f,_0x4e6507){create(_0x4c4e9f)[_0xdf37('0xf')](loggerCatch(_0x4e6507));};exports['createCustomerFinal']=function(_0xf33337,_0x27396c){moveContact(_0xf33337)[_0xdf37('0xf')](loggerCatch(_0x27396c));};exports[_0xdf37('0x1a')]=function(_0x2c2e26,_0x5e6932,_0x236807){if(_0x5e6932){_0x2c2e26[_0xdf37('0x1b')]=null;}if(_0x236807){_0x2c2e26[_0xdf37('0x1c')]=![];}return BPromise[_0xdf37('0xd')]()[_0xdf37('0x11')](cmHopper[_0xdf37('0x1a')](_0x2c2e26))[_0xdf37('0xf')](loggerCatch(_0xdf37('0x1d')));};exports[_0xdf37('0x1e')]=function(_0x2c074a){return BPromise[_0xdf37('0xd')]()[_0xdf37('0x11')](cmHopper[_0xdf37('0x1e')](_0x2c074a))[_0xdf37('0xf')](loggerCatch(_0xdf37('0x1f')));};exports['unlockContact']=function(_0x375c49){return BPromise['resolve']()[_0xdf37('0x11')](cmHopper[_0xdf37('0x20')]({'UserId':null},_0x375c49,0x1))['catch'](loggerCatch(_0xdf37('0x21')));};exports[_0xdf37('0x22')]=function(_0x29da43){return BPromise[_0xdf37('0xd')]()[_0xdf37('0x11')](cmHopper[_0xdf37('0x20')]({'active':![]},_0x29da43,0x1))[_0xdf37('0xf')](loggerCatch(_0xdf37('0x23')));};exports[_0xdf37('0x24')]=function(_0x2246a5){var _0x5e5ed2={};_0x5e5ed2['type']=_0x2246a5['type'];_0x5e5ed2[_0xdf37('0x25')]=_0x2246a5[_0xdf37('0x25')];_0x5e5ed2[_0xdf37('0x26')]=_0x2246a5[_0xdf37('0x26')];_0x5e5ed2[_0xdf37('0x27')]=_0x2246a5[_0xdf37('0x27')];_0x5e5ed2[_0xdf37('0x28')]=_0x2246a5['queue'];_0x5e5ed2[_0xdf37('0x29')]=_0x2246a5[_0xdf37('0x2a')];_0x5e5ed2[_0xdf37('0x2b')]=_0x2246a5['answertime'];_0x5e5ed2[_0xdf37('0x2c')]=0x1;_0x5e5ed2['queuecallercompleteAt']=_0x2246a5[_0xdf37('0x2d')];_0x5e5ed2[_0xdf37('0x2e')]=_0x2246a5[_0xdf37('0x2f')];_0x5e5ed2[_0xdf37('0x30')]=_0xdf37('0x31');_0x5e5ed2['exten']=_0xdf37('0x32');_0x5e5ed2[_0xdf37('0x33')]=0x0;_0x5e5ed2[_0xdf37('0x34')]=0x1;_0x5e5ed2[_0xdf37('0x35')]=_0x2246a5[_0xdf37('0x2f')];_0x5e5ed2[_0xdf37('0x36')]=_0xdf37('0x37');return BPromise['resolve']()[_0xdf37('0x11')](voiceQueueReport[_0xdf37('0x38')](_0x5e5ed2))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports[_0xdf37('0x39')]=function(_0x3c7f85,_0x25d0ad){return BPromise['resolve']()[_0xdf37('0x11')](cmHopper[_0xdf37('0x39')](_0x3c7f85,_0x25d0ad))[_0xdf37('0xf')](loggerCatch(_0xdf37('0x3a')));};exports['rescheduleContactInQueue']=function(_0x1a5e4f){return BPromise[_0xdf37('0xd')]()[_0xdf37('0x11')](cmHopper[_0xdf37('0x1a')](_0x1a5e4f,!![],!![]))[_0xdf37('0xf')](loggerCatch(_0xdf37('0x3b')));}; \ 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 3585e67..cfc90ec 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 _0xe156=['xcally-motion-preview','from-sip','timeout','countbusyretry','countcongestionretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ContactId','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','buildAcw','interface','uniqueid','agentReadyId','not_inuse','reachable','push','getDiff','diff','filterKey','type','campaigntype','dialAnswer','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','sipcallid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','util','lodash','../../../../config/logger','preview','env','127.0.0.1','milliseconds','seconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','isEmpty','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','addVariables','Queue','name','calleridname','calleridnum','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','isNil','tags','%s%s','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','endtime','logAgent','responsetime','logLookAgent','membername','UserId','logCustomer','ringtime','talktime','answertime','variablesAction','RECALL','BOOKED','channelAgent'];(function(_0x135c14,_0x41c790){var _0x19e640=function(_0x75c561){while(--_0x75c561){_0x135c14['push'](_0x135c14['shift']());}};_0x19e640(++_0x41c790);}(_0xe156,0xce));var _0x6e15=function(_0x58999b,_0xea4695){_0x58999b=_0x58999b-0x0;var _0x5efc3a=_0xe156[_0x58999b];return _0x5efc3a;};'use strict';var util=require(_0x6e15('0x0'));var _=require(_0x6e15('0x1'));var moment=require('moment');var logger=require(_0x6e15('0x2'))(_0x6e15('0x3'));var ipAgi=process[_0x6e15('0x4')]['XCALLY_IP_AGI']||_0x6e15('0x5');function getSeconds(_0x318381,_0x46cf7a){var _0xa22ecc=moment(_0x318381)[_0x6e15('0x6')](0x0);var _0x6afe27=moment(_0x46cf7a)[_0x6e15('0x6')](0x0);return _0xa22ecc['diff'](_0x6afe27,_0x6e15('0x7'));}exports[_0x6e15('0x8')]=function(_0x30bc28){return function(_0x544cf3){logger[_0x6e15('0x9')](_0x30bc28,util[_0x6e15('0xa')](_0x544cf3,{'showHidden':![],'depth':null}));};};exports[_0x6e15('0xb')]=function(_0x501b53,_0x259235){logger[_0x6e15('0xc')](_0x501b53,util[_0x6e15('0xa')](_0x259235,{'showHidden':![],'depth':null}));};exports[_0x6e15('0xd')]=function(_0x56efa8,_0x356616){logger['error'](_0x56efa8,util[_0x6e15('0xa')](_0x356616,{'showHidden':![],'depth':null}));};exports[_0x6e15('0xe')]=function(_0x156206){return function(_0x2a8ca0){logger[_0x6e15('0xc')](_0x156206,util[_0x6e15('0xa')](_0x2a8ca0,{'showHidden':![],'depth':null}));};};exports[_0x6e15('0xf')]=function(_0x528781,_0x293c3a,_0x5c131e){return{'message':_0x528781,'unlock':_0x293c3a,'active':_0x5c131e};};exports[_0x6e15('0x10')]=function(_0x9a377d,_0x4268aa,_0x58c128){if(!_[_0x6e15('0x11')](_0x58c128)&&'string'===typeof _0x58c128&&!_[_0x6e15('0x12')](_0x58c128)){if(!_[_0x6e15('0x11')](_0x4268aa)&&_0x6e15('0x13')===typeof _0x4268aa&&!_[_0x6e15('0x12')](_0x4268aa)){return util[_0x6e15('0x14')](_0x6e15('0x15'),_0x4268aa,_0x58c128);}return util['format'](_0x6e15('0x15'),_0x58c128,_0x58c128);}if(!_['isUndefined'](_0x9a377d)&&_0x6e15('0x13')===typeof _0x9a377d&&!_[_0x6e15('0x12')](_0x9a377d)){return _0x9a377d;}return _0x6e15('0x16');};exports['isActive']=function(_0x2307d4){if(_['isNil'](_0x2307d4)){return![];}return _0x2307d4;};exports[_0x6e15('0x17')]=function(_0x66420a,_0x1808ff,_0x4b2cbf,_0x4236c1,_0xa97e7b,_0x3a3280){var _0x4a9465={'XMD-QUEUE':_0x1808ff[_0x6e15('0x18')]?_0x1808ff[_0x6e15('0x18')][_0x6e15('0x19')]:'','XMD-CALLERID':_0x4236c1,'XMD-CALLERID-PREVIEW':_0x3a3280?util[_0x6e15('0x14')](_0x6e15('0x15'),_0x3a3280[_0x6e15('0x1a')],_0x3a3280[_0x6e15('0x1b')]):_0x4236c1,'XMD-DIALID':_0xa97e7b,'XMD-CONTACTID':_0x1808ff['ContactId'],'XMD-CDRTYPE':_0x6e15('0x1c'),'CALLERID(all)':_0x4236c1,'XMD-VOICEQUEUEID':_0x1808ff[_0x6e15('0x1d')],'XMD-DIALCHANNEL':_0x4b2cbf,'XMD-DIALTIMEOUT':_0x66420a[_0x6e15('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0x6e15('0x14')](_0x6e15('0x1f'),_0x66420a[_0x6e15('0x20')]?'g':'',_['isEmpty'](_0x66420a[_0x6e15('0x21')])?'':_0x6e15('0x22')),'XMD-DIALURL':_0x66420a['dialPreviewUrl']||'','XMD-AGI':_0x66420a[_0x6e15('0x23')]?util[_0x6e15('0x14')](_0x6e15('0x24'),ipAgi,_0x66420a[_0x6e15('0x23')]):'NONE','XMD-AGIAFTER':_0x66420a[_0x6e15('0x20')]?util[_0x6e15('0x14')](_0x6e15('0x24'),ipAgi,_0x66420a[_0x6e15('0x20')]):_0x6e15('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x3a3280?_0x3a3280[_0x6e15('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x3a3280?_0x3a3280['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0x6e15('0x12')](_0x66420a[_0x6e15('0x21')])){_0x4a9465[util[_0x6e15('0x14')]('%s',_0x6e15('0x27'))]=_0x66420a[_0x6e15('0x21')];_0x4a9465[util[_0x6e15('0x14')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0xa97e7b;}if(_0x1808ff&&_0x1808ff['Contact']){for(var _0x57951d in _0x1808ff[_0x6e15('0x28')]){if(_0x1808ff[_0x6e15('0x28')][_0x6e15('0x29')](_0x57951d)){if(!_[_0x6e15('0x2a')](_0x1808ff[_0x6e15('0x28')][_0x57951d])&&_0x57951d!=='id'&&_0x57951d!==_0x6e15('0x2b')&&_0x57951d!=='createdAt'&&_0x57951d!=='updatedAt'){_0x4a9465[util['format'](_0x6e15('0x2c'),'XMD-',_[_0x6e15('0x2d')](_0x57951d))]=_0x1808ff[_0x6e15('0x28')][_0x57951d];}}}}return _0x4a9465;};exports[_0x6e15('0x2e')]=function(_0xff1ca3){var _0x11f052={};for(var _0x434b83 in _0xff1ca3){if(_0xff1ca3[_0x6e15('0x29')](_0x434b83)){_0x11f052[util[_0x6e15('0x14')]('%s',_[_0x6e15('0x2f')](_0x434b83))]=_0xff1ca3[_0x434b83];}}return{'variables':_0x11f052};};exports[_0x6e15('0x30')]=function(_0x405efd,_0x2c9214){if(!_['isNil'](_0x405efd)){if(_0x405efd['hasOwnProperty'](_0x6e15('0x31'))){if(_0x405efd[_0x6e15('0x31')]>0x0){_0x405efd['originated']-=0x1;}else{logger[_0x6e15('0x9')](_0x6e15('0x32'),_0x2c9214);}}}else{logger[_0x6e15('0x9')](_0x6e15('0x33'),_0x2c9214);}};exports[_0x6e15('0x34')]=function(_0x45cdef){var _0x1d60e4=moment()['format'](_0x6e15('0x35'));_0x45cdef[_0x6e15('0x36')]=0xd;_0x45cdef[_0x6e15('0x37')]=_0x6e15('0x38');_0x45cdef[_0x6e15('0x39')]=_0x1d60e4;_0x45cdef['responsetime']=_0x1d60e4;_0x45cdef[_0x6e15('0x3a')]=_0x1d60e4;};exports[_0x6e15('0x3b')]=function(_0x12e9e6,_0x5217fc,_0x2464b4){var _0x66e72a=moment()[_0x6e15('0x14')](_0x6e15('0x35'));_0x12e9e6[_0x6e15('0x36')]=_0x5217fc;_0x12e9e6[_0x6e15('0x37')]=_0x2464b4;_0x12e9e6[_0x6e15('0x3c')]=_0x66e72a;_0x12e9e6['ringtime']=getSeconds(_0x12e9e6[_0x6e15('0x3c')],_0x12e9e6['starttime']);};exports[_0x6e15('0x3d')]=function(_0x37ec4e,_0x2fd1ba,_0x595970){_0x37ec4e[_0x6e15('0x3e')]=_0x2fd1ba;_0x37ec4e[_0x6e15('0x3f')]=_0x595970;};exports[_0x6e15('0x40')]=function(_0x4fcb8c,_0x2d2f42,_0x31070d){var _0xde6944=moment()[_0x6e15('0x14')](_0x6e15('0x35'));_0x4fcb8c[_0x6e15('0x36')]=_0x2d2f42;_0x4fcb8c[_0x6e15('0x37')]=_0x31070d;_0x4fcb8c[_0x6e15('0x3c')]=_0x4fcb8c[_0x6e15('0x3c')]?_0x4fcb8c[_0x6e15('0x3c')]:_0xde6944;_0x4fcb8c['endtime']=_0x4fcb8c[_0x6e15('0x3a')]?_0x4fcb8c[_0x6e15('0x3a')]:_0xde6944;_0x4fcb8c[_0x6e15('0x41')]=getSeconds(_0x4fcb8c[_0x6e15('0x3c')]||0x0,_0x4fcb8c[_0x6e15('0x39')]||0x0);_0x4fcb8c[_0x6e15('0x42')]=_0x4fcb8c['answertime']?getSeconds(_0x4fcb8c[_0x6e15('0x3a')],_0x4fcb8c[_0x6e15('0x43')]):0x0;};exports['isFailure']=function(_0x5a1a62){return _0x5a1a62==='Failure';};exports[_0x6e15('0x44')]=function(_0x16d5f6,_0xaf402c,_0x5f4598,_0x4a6133,_0x38002a){var _0x392676=_0x4a6133?_0x6e15('0x45'):_0x16d5f6[_0x6e15('0x1a')];_0x392676=_0x38002a?_0x6e15('0x46'):_0x392676;return{'actionid':_0x16d5f6['uniqueid'],'action':'originate','channel':_0x16d5f6[_0x6e15('0x47')],'callerid':util[_0x6e15('0x14')](_0x6e15('0x15'),_0x392676,_0x16d5f6[_0x6e15('0x1b')]),'Exten':_0x6e15('0x48'),'Context':_0x6e15('0x49'),'Priority':'1','variable':_0x5f4598,'timeout':(_0xaf402c[_0x6e15('0x4a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x16d5f6['uniqueid']};};exports['totalGlobal']=function(_0x5362cd){return _0x5362cd[_0x6e15('0x4b')]+_0x5362cd[_0x6e15('0x4c')]+_0x5362cd['countnoanswerretry'];};exports[_0x6e15('0x4d')]=function(_0x43bebc){var _0x1be484=_[_0x6e15('0x4e')](_0x43bebc);_0x1be484['state']=0xf;_0x1be484['statedesc']=_0x6e15('0x4f');return _0x1be484;};exports[_0x6e15('0x50')]=function(_0x4cf494,_0x52c14f,_0x3a5a56){var _0x2b571c={};_0x2b571c[_0x52c14f]=_0x4cf494[_0x52c14f];_0x2b571c[_0x6e15('0x51')]=![];_0x2b571c[_0x6e15('0x52')]=moment()[_0x6e15('0x53')](_0x3a5a56,_0x6e15('0x54'))[_0x6e15('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x2b571c[_0x6e15('0x55')]=_0x4cf494[_0x6e15('0x55')];_0x2b571c[_0x6e15('0x56')]=_0x4cf494[_0x6e15('0x56')];_0x2b571c['VoiceQueueId']=_0x4cf494[_0x6e15('0x1d')]||undefined;return _0x2b571c;};exports['decrementTalkink']=function(_0xf16a83,_0x31eb75){if(!_[_0x6e15('0x2a')](_0xf16a83)){if(_0xf16a83[_0x6e15('0x57')]>0x0){_0xf16a83[_0x6e15('0x57')]-=0x1;}else{logger['error'](_0x31eb75,_0x6e15('0x58'));}}else{logger['error'](_0x31eb75,_0x6e15('0x59'));}};exports[_0x6e15('0x5a')]=function(_0x52a398){if(_0x52a398<=0x0){return!![];}return![];};exports[_0x6e15('0x5b')]=function(_0x38a8ac,_0x1b5ba2){_0x38a8ac[_0x6e15('0x5c')]=_0x1b5ba2;_0x38a8ac[_0x6e15('0x19')]=_0x38a8ac[_0x6e15('0x5d')];_0x38a8ac['interface']=_0x38a8ac[_0x6e15('0x47')];return _0x38a8ac;};exports[_0x6e15('0x5e')]=function(_0x4a5fde){var _0x316169={};_0x316169[_0x6e15('0x5d')]=_0x4a5fde[_0x6e15('0x5d')];_0x316169[_0x6e15('0x5f')]=_0x4a5fde[_0x6e15('0x47')];_0x316169[_0x6e15('0x60')]=_0x4a5fde[_0x6e15('0x60')];return _0x316169;};exports[_0x6e15('0x61')]=function(_0x319fe9){var _0x10a26b=[];for(var _0x3af3fc in _0x319fe9){if(_0x319fe9['hasOwnProperty'](_0x3af3fc)){if(!_[_0x6e15('0x2a')](_0x319fe9[_0x3af3fc])&&_0x319fe9[_0x3af3fc]['state']===_0x6e15('0x62')&&_0x319fe9[_0x3af3fc]['status']===_0x6e15('0x63')){_0x10a26b[_0x6e15('0x64')](_0x319fe9[_0x3af3fc]['id']);}}}return _0x10a26b;};exports[_0x6e15('0x65')]=function(_0xaaaa55){var _0x802331=moment()[_0x6e15('0x6')](0x0);var _0x2baaf2=moment(_0xaaaa55)[_0x6e15('0x6')](0x0);return _0x802331[_0x6e15('0x66')](_0x2baaf2,_0x6e15('0x7'));};exports['createBody']=function(_0x8b297d){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x8b297d[_0x6e15('0x55')],'ListId':_0x8b297d[_0x6e15('0x56')],'VoiceQueueId':_0x8b297d[_0x6e15('0x1d')]||undefined,'CampaignId':_0x8b297d['CampaignId']||undefined};};exports[_0x6e15('0x67')]=function(_0x86f3f9){if(_0x86f3f9===_0x6e15('0x60')||_0x86f3f9==='idContact'||_0x86f3f9===_0x6e15('0x5d')||_0x86f3f9===_0x6e15('0x68')||_0x86f3f9===_0x6e15('0x69')||_0x86f3f9===_0x6e15('0x6a')||_0x86f3f9===_0x6e15('0x3e')||_0x86f3f9===_0x6e15('0x47')||_0x86f3f9===_0x6e15('0x1a')||_0x86f3f9==='active'||_0x86f3f9===_0x6e15('0x1b')||_0x86f3f9===_0x6e15('0x52')||_0x86f3f9===_0x6e15('0x4b')||_0x86f3f9===_0x6e15('0x4c')||_0x86f3f9===_0x6e15('0x6b')||_0x86f3f9===_0x6e15('0x6c')||_0x86f3f9===_0x6e15('0x6d')||_0x86f3f9===_0x6e15('0x6e')||_0x86f3f9===_0x6e15('0x6f')||_0x86f3f9==='recallme'||_0x86f3f9==='ContactId'||_0x86f3f9===_0x6e15('0x56')||_0x86f3f9==='UserId'||_0x86f3f9===_0x6e15('0x1d')||_0x86f3f9===_0x6e15('0x70')||_0x86f3f9==='xmd-voicequeueid'||_0x86f3f9===_0x6e15('0x71')||_0x86f3f9==='xmd-phone'||_0x86f3f9===_0x6e15('0x72')||_0x86f3f9===_0x6e15('0x73')||_0x86f3f9===_0x6e15('0x74')||_0x86f3f9===_0x6e15('0x75')||_0x86f3f9==='xmd-dialid'||_0x86f3f9===_0x6e15('0x76')||_0x86f3f9==='xmd-contactid'||_0x86f3f9===_0x6e15('0x77')||_0x86f3f9===_0x6e15('0x78')||_0x86f3f9===_0x6e15('0x79')||_0x86f3f9===_0x6e15('0x7a')||_0x86f3f9===_0x6e15('0x7b')||_0x86f3f9===_0x6e15('0x7c')||_0x86f3f9==='rtpaudioqosjitter'||_0x86f3f9===_0x6e15('0x7d')||_0x86f3f9===_0x6e15('0x7e')||_0x86f3f9===_0x6e15('0x7f')||_0x86f3f9===_0x6e15('0x80')||_0x86f3f9===_0x6e15('0x81')||_0x86f3f9==='rtpaudioqos'||_0x86f3f9===_0x6e15('0x7c')||_0x86f3f9===_0x6e15('0x82')||_0x86f3f9===_0x6e15('0x7d')||_0x86f3f9===_0x6e15('0x7e')||_0x86f3f9==='rtpaudioqoslossbridged'||_0x86f3f9===_0x6e15('0x80')||_0x86f3f9===_0x6e15('0x81')||_0x86f3f9==='bridgepeer'||_0x86f3f9===_0x6e15('0x83')||_0x86f3f9===_0x6e15('0x36')||_0x86f3f9===_0x6e15('0x37')){return![];}return!![];};exports[_0x6e15('0x84')]=function(_0x1b06fa,_0x23c85d){var _0xf728cb,_0x318ef4,_0x92cff1;if(_0x23c85d<=0x0){_0x23c85d=0x1;}_0xf728cb=new RegExp(_0x6e15('0x85')+_0x23c85d+'}$');_0x318ef4=Math['pow'](0xa,_0x23c85d-0x1);_0x92cff1=Math[_0x6e15('0x86')](0xa,_0x23c85d)-0x1;return util[_0x6e15('0x14')]('%s',_[_0x6e15('0x87')](_0x1b06fa,_0xf728cb,_[_0x6e15('0x88')](_0x318ef4,_0x92cff1)));};exports[_0x6e15('0x89')]=function(_0x5b2ce2){var _0x1674eb=_0x5b2ce2[_0x6e15('0x8a')](/"(.*?)"/);return _0x1674eb?_0x1674eb[0x1]:_0x5b2ce2;};exports['extractCalleridNumber']=function(_0x11c6f3){var _0x41e9de=_0x11c6f3[_0x6e15('0x8a')](/<(.*?)>/);return _0x41e9de?_0x41e9de[0x1]:_0x11c6f3;}; \ No newline at end of file +var _0x3d85=['tags','createdAt','updatedAt','%s%s','XMD-','toLowerVariables','toLower','updateOriginated','originated','state','statedesc','starttime','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','ringtime','logLookAgent','membername','UserId','talktime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','cloneAction','clone','Global','scheduledAt','active','add','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','name','queue','interface','buildAcw','agentReadyId','reachable','push','CampaignId','filterKey','idContact','type','campaigntype','countglobal','callback','callbackat','recallme','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosjitter','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','dialPreviewUrl','dialQueueProject','format','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3d85,0xe2));var _0x53d8=function(_0x2fd741,_0x4408ce){_0x2fd741=_0x2fd741-0x0;var _0x37b6b5=_0x3d85[_0x2fd741];return _0x37b6b5;};'use strict';var util=require(_0x53d8('0x0'));var _=require(_0x53d8('0x1'));var moment=require(_0x53d8('0x2'));var logger=require(_0x53d8('0x3'))(_0x53d8('0x4'));var ipAgi=process[_0x53d8('0x5')][_0x53d8('0x6')]||'127.0.0.1';function getSeconds(_0x525e42,_0x183bbf){var _0x5b1f7b=moment(_0x525e42)[_0x53d8('0x7')](0x0);var _0x1b2cd8=moment(_0x183bbf)[_0x53d8('0x7')](0x0);return _0x5b1f7b[_0x53d8('0x8')](_0x1b2cd8,_0x53d8('0x9'));}exports[_0x53d8('0xa')]=function(_0x6828b0){return function(_0x4f7279){logger[_0x53d8('0xb')](_0x6828b0,util[_0x53d8('0xc')](_0x4f7279,{'showHidden':![],'depth':null}));};};exports[_0x53d8('0xd')]=function(_0x1463ea,_0x9cb54d){logger[_0x53d8('0xe')](_0x1463ea,util[_0x53d8('0xc')](_0x9cb54d,{'showHidden':![],'depth':null}));};exports[_0x53d8('0xf')]=function(_0x57f2bc,_0x4ed1f2){logger[_0x53d8('0xb')](_0x57f2bc,util[_0x53d8('0xc')](_0x4ed1f2,{'showHidden':![],'depth':null}));};exports[_0x53d8('0x10')]=function(_0x243017){return function(_0x553496){logger[_0x53d8('0xe')](_0x243017,util['inspect'](_0x553496,{'showHidden':![],'depth':null}));};};exports[_0x53d8('0x11')]=function(_0x1daeb9,_0x535fe5,_0x2fc1b6){return{'message':_0x1daeb9,'unlock':_0x535fe5,'active':_0x2fc1b6};};exports[_0x53d8('0x12')]=function(_0x40231b,_0x386945,_0x300a13){if(!_[_0x53d8('0x13')](_0x300a13)&&_0x53d8('0x14')===typeof _0x300a13&&!_[_0x53d8('0x15')](_0x300a13)){if(!_[_0x53d8('0x13')](_0x386945)&&'string'===typeof _0x386945&&!_['isEmpty'](_0x386945)){return util['format'](_0x53d8('0x16'),_0x386945,_0x300a13);}return util['format']('\x22%s\x22\x20<%s>',_0x300a13,_0x300a13);}if(!_[_0x53d8('0x13')](_0x40231b)&&_0x53d8('0x14')===typeof _0x40231b&&!_[_0x53d8('0x15')](_0x40231b)){return _0x40231b;}return _0x53d8('0x17');};exports[_0x53d8('0x18')]=function(_0x26a1bc){if(_[_0x53d8('0x19')](_0x26a1bc)){return![];}return _0x26a1bc;};exports[_0x53d8('0x1a')]=function(_0x4369ae,_0x42b4b9,_0x3ea5f0,_0x24d18f,_0x565f80,_0x479cf7){var _0x26be90={'XMD-QUEUE':_0x42b4b9[_0x53d8('0x1b')]?_0x42b4b9[_0x53d8('0x1b')]['name']:'','XMD-CALLERID':_0x24d18f,'XMD-CALLERID-PREVIEW':_0x479cf7?util['format'](_0x53d8('0x16'),_0x479cf7[_0x53d8('0x1c')],_0x479cf7[_0x53d8('0x1d')]):_0x24d18f,'XMD-DIALID':_0x565f80,'XMD-CONTACTID':_0x42b4b9[_0x53d8('0x1e')],'XMD-CDRTYPE':_0x53d8('0x1f'),'CALLERID(all)':_0x24d18f,'XMD-VOICEQUEUEID':_0x42b4b9[_0x53d8('0x20')],'XMD-DIALCHANNEL':_0x3ea5f0,'XMD-DIALTIMEOUT':_0x4369ae[_0x53d8('0x21')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x53d8('0x22'),_0x4369ae['dialQueueProject2']?'g':'',_['isEmpty'](_0x4369ae[_0x53d8('0x23')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x4369ae[_0x53d8('0x24')]||'','XMD-AGI':_0x4369ae[_0x53d8('0x25')]?util[_0x53d8('0x26')](_0x53d8('0x27'),ipAgi,_0x4369ae[_0x53d8('0x25')]):_0x53d8('0x28'),'XMD-AGIAFTER':_0x4369ae[_0x53d8('0x29')]?util[_0x53d8('0x26')](_0x53d8('0x27'),ipAgi,_0x4369ae['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0x479cf7?_0x479cf7[_0x53d8('0x2a')]:'','XMD-ORIGINATECALLERIDNAME':_0x479cf7?_0x479cf7[_0x53d8('0x2b')]:'','XMD-DESTINATION':_0x53d8('0x2c')};if(!_[_0x53d8('0x15')](_0x4369ae[_0x53d8('0x23')])){_0x26be90[util[_0x53d8('0x26')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x4369ae[_0x53d8('0x23')];_0x26be90[util[_0x53d8('0x26')]('%s',_0x53d8('0x2d'))]=_0x565f80;}if(_0x42b4b9&&_0x42b4b9[_0x53d8('0x2e')]){for(var _0x431ab8 in _0x42b4b9[_0x53d8('0x2e')]){if(_0x42b4b9['Contact'][_0x53d8('0x2f')](_0x431ab8)){if(!_[_0x53d8('0x19')](_0x42b4b9[_0x53d8('0x2e')][_0x431ab8])&&_0x431ab8!=='id'&&_0x431ab8!==_0x53d8('0x30')&&_0x431ab8!==_0x53d8('0x31')&&_0x431ab8!==_0x53d8('0x32')){_0x26be90[util[_0x53d8('0x26')](_0x53d8('0x33'),_0x53d8('0x34'),_['toUpper'](_0x431ab8))]=_0x42b4b9['Contact'][_0x431ab8];}}}}return _0x26be90;};exports[_0x53d8('0x35')]=function(_0x7945ad){var _0x10471a={};for(var _0x3cddc8 in _0x7945ad){if(_0x7945ad['hasOwnProperty'](_0x3cddc8)){_0x10471a[util[_0x53d8('0x26')]('%s',_[_0x53d8('0x36')](_0x3cddc8))]=_0x7945ad[_0x3cddc8];}}return{'variables':_0x10471a};};exports[_0x53d8('0x37')]=function(_0x7d611b,_0x5a5a4c){if(!_['isNil'](_0x7d611b)){if(_0x7d611b['hasOwnProperty'](_0x53d8('0x38'))){if(_0x7d611b[_0x53d8('0x38')]>0x0){_0x7d611b[_0x53d8('0x38')]-=0x1;}else{logger[_0x53d8('0xb')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x5a5a4c);}}}else{logger[_0x53d8('0xb')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x5a5a4c);}};exports['logBlacklist']=function(_0x4c03ee){var _0x1bfbce=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4c03ee[_0x53d8('0x39')]=0xd;_0x4c03ee[_0x53d8('0x3a')]='Blacklist';_0x4c03ee[_0x53d8('0x3b')]=_0x1bfbce;_0x4c03ee[_0x53d8('0x3c')]=_0x1bfbce;_0x4c03ee[_0x53d8('0x3d')]=_0x1bfbce;};exports[_0x53d8('0x3e')]=function(_0x4369bd,_0x549a2c,_0x204e0f){var _0x42770f=moment()[_0x53d8('0x26')](_0x53d8('0x3f'));_0x4369bd[_0x53d8('0x39')]=_0x549a2c;_0x4369bd[_0x53d8('0x3a')]=_0x204e0f;_0x4369bd['responsetime']=_0x42770f;_0x4369bd[_0x53d8('0x40')]=getSeconds(_0x4369bd['responsetime'],_0x4369bd[_0x53d8('0x3b')]);};exports[_0x53d8('0x41')]=function(_0x36af84,_0x430992,_0x28fc5f){_0x36af84[_0x53d8('0x42')]=_0x430992;_0x36af84[_0x53d8('0x43')]=_0x28fc5f;};exports['logCustomer']=function(_0x3e210d,_0x1238ea,_0x11379b){var _0x137165=moment()[_0x53d8('0x26')](_0x53d8('0x3f'));_0x3e210d[_0x53d8('0x39')]=_0x1238ea;_0x3e210d[_0x53d8('0x3a')]=_0x11379b;_0x3e210d[_0x53d8('0x3c')]=_0x3e210d['responsetime']?_0x3e210d[_0x53d8('0x3c')]:_0x137165;_0x3e210d[_0x53d8('0x3d')]=_0x3e210d[_0x53d8('0x3d')]?_0x3e210d['endtime']:_0x137165;_0x3e210d[_0x53d8('0x40')]=getSeconds(_0x3e210d[_0x53d8('0x3c')]||0x0,_0x3e210d[_0x53d8('0x3b')]||0x0);_0x3e210d[_0x53d8('0x44')]=_0x3e210d['answertime']?getSeconds(_0x3e210d['endtime'],_0x3e210d[_0x53d8('0x45')]):0x0;};exports[_0x53d8('0x46')]=function(_0x6a156d){return _0x6a156d===_0x53d8('0x47');};exports['variablesAction']=function(_0x219dba,_0xf92d5a,_0x276e75,_0x435680,_0x5e1958){var _0x16d580=_0x435680?_0x53d8('0x48'):_0x219dba[_0x53d8('0x1c')];_0x16d580=_0x5e1958?_0x53d8('0x49'):_0x16d580;return{'actionid':_0x219dba[_0x53d8('0x4a')],'action':_0x53d8('0x4b'),'channel':_0x219dba[_0x53d8('0x4c')],'callerid':util[_0x53d8('0x26')](_0x53d8('0x16'),_0x16d580,_0x219dba[_0x53d8('0x1d')]),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x276e75,'timeout':(_0xf92d5a[_0x53d8('0x4d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x219dba[_0x53d8('0x4a')]};};exports[_0x53d8('0x4e')]=function(_0x4bbd7a){return _0x4bbd7a[_0x53d8('0x4f')]+_0x4bbd7a[_0x53d8('0x50')]+_0x4bbd7a[_0x53d8('0x51')];};exports[_0x53d8('0x52')]=function(_0x2e795f){var _0xf21896=_[_0x53d8('0x53')](_0x2e795f);_0xf21896[_0x53d8('0x39')]=0xf;_0xf21896[_0x53d8('0x3a')]=_0x53d8('0x54');return _0xf21896;};exports[_0x53d8('0x55')]=function(_0x514ed1,_0xe5ad86,_0x362f34){var _0x2462ab={};_0x2462ab[_0xe5ad86]=_0x514ed1[_0xe5ad86];_0x2462ab[_0x53d8('0x56')]=![];_0x2462ab['scheduledat']=moment()[_0x53d8('0x57')](_0x362f34,'minutes')[_0x53d8('0x26')](_0x53d8('0x3f'));_0x2462ab[_0x53d8('0x1e')]=_0x514ed1[_0x53d8('0x1e')];_0x2462ab['ListId']=_0x514ed1[_0x53d8('0x58')];_0x2462ab[_0x53d8('0x20')]=_0x514ed1['VoiceQueueId']||undefined;return _0x2462ab;};exports[_0x53d8('0x59')]=function(_0x4499ab,_0xa723d1){if(!_[_0x53d8('0x19')](_0x4499ab)){if(_0x4499ab[_0x53d8('0x5a')]>0x0){_0x4499ab[_0x53d8('0x5a')]-=0x1;}else{logger[_0x53d8('0xb')](_0xa723d1,_0x53d8('0x5b'));}}else{logger[_0x53d8('0xb')](_0xa723d1,_0x53d8('0x5c'));}};exports['IsNotLoggedIn']=function(_0x58a8fa){if(_0x58a8fa<=0x0){return!![];}return![];};exports['buildObj']=function(_0x5dc3b1,_0x2f3bcb){_0x5dc3b1[_0x53d8('0x5d')]=_0x2f3bcb;_0x5dc3b1[_0x53d8('0x5e')]=_0x5dc3b1[_0x53d8('0x5f')];_0x5dc3b1[_0x53d8('0x60')]=_0x5dc3b1[_0x53d8('0x4c')];return _0x5dc3b1;};exports[_0x53d8('0x61')]=function(_0x54edc0){var _0x29f35c={};_0x29f35c[_0x53d8('0x5f')]=_0x54edc0[_0x53d8('0x5f')];_0x29f35c[_0x53d8('0x60')]=_0x54edc0[_0x53d8('0x4c')];_0x29f35c[_0x53d8('0x4a')]=_0x54edc0[_0x53d8('0x4a')];return _0x29f35c;};exports[_0x53d8('0x62')]=function(_0x53cef2){var _0x282a8c=[];for(var _0x14fd64 in _0x53cef2){if(_0x53cef2[_0x53d8('0x2f')](_0x14fd64)){if(!_[_0x53d8('0x19')](_0x53cef2[_0x14fd64])&&_0x53cef2[_0x14fd64]['state']==='not_inuse'&&_0x53cef2[_0x14fd64]['status']===_0x53d8('0x63')){_0x282a8c[_0x53d8('0x64')](_0x53cef2[_0x14fd64]['id']);}}}return _0x282a8c;};exports['getDiff']=function(_0x1454e2){var _0xd0ef32=moment()[_0x53d8('0x7')](0x0);var _0xb08917=moment(_0x1454e2)['milliseconds'](0x0);return _0xd0ef32[_0x53d8('0x8')](_0xb08917,_0x53d8('0x9'));};exports['createBody']=function(_0x52d577){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x52d577[_0x53d8('0x1e')],'ListId':_0x52d577[_0x53d8('0x58')],'VoiceQueueId':_0x52d577['VoiceQueueId']||undefined,'CampaignId':_0x52d577[_0x53d8('0x65')]||undefined};};exports[_0x53d8('0x66')]=function(_0x13abfc){if(_0x13abfc===_0x53d8('0x4a')||_0x13abfc===_0x53d8('0x67')||_0x13abfc==='queue'||_0x13abfc===_0x53d8('0x68')||_0x13abfc===_0x53d8('0x69')||_0x13abfc==='dialAnswer'||_0x13abfc===_0x53d8('0x42')||_0x13abfc===_0x53d8('0x4c')||_0x13abfc===_0x53d8('0x1c')||_0x13abfc===_0x53d8('0x56')||_0x13abfc===_0x53d8('0x1d')||_0x13abfc==='scheduledat'||_0x13abfc===_0x53d8('0x4f')||_0x13abfc===_0x53d8('0x50')||_0x13abfc===_0x53d8('0x51')||_0x13abfc===_0x53d8('0x6a')||_0x13abfc===_0x53d8('0x6b')||_0x13abfc==='callbackuniqueid'||_0x13abfc===_0x53d8('0x6c')||_0x13abfc===_0x53d8('0x6d')||_0x13abfc===_0x53d8('0x1e')||_0x13abfc===_0x53d8('0x58')||_0x13abfc==='UserId'||_0x13abfc===_0x53d8('0x20')||_0x13abfc===_0x53d8('0x6e')||_0x13abfc==='xmd-voicequeueid'||_0x13abfc===_0x53d8('0x6f')||_0x13abfc===_0x53d8('0x70')||_0x13abfc===_0x53d8('0x71')||_0x13abfc===_0x53d8('0x72')||_0x13abfc===_0x53d8('0x73')||_0x13abfc===_0x53d8('0x74')||_0x13abfc==='xmd-dialid'||_0x13abfc===_0x53d8('0x75')||_0x13abfc==='xmd-contactid'||_0x13abfc==='xmd-cdrtype'||_0x13abfc===_0x53d8('0x76')||_0x13abfc===_0x53d8('0x77')||_0x13abfc===_0x53d8('0x78')||_0x13abfc===_0x53d8('0x79')||_0x13abfc===_0x53d8('0x7a')||_0x13abfc==='rtpaudioqosjitter'||_0x13abfc===_0x53d8('0x7b')||_0x13abfc===_0x53d8('0x7c')||_0x13abfc===_0x53d8('0x7d')||_0x13abfc===_0x53d8('0x7e')||_0x13abfc==='rtpaudioqosrttbridged'||_0x13abfc===_0x53d8('0x79')||_0x13abfc===_0x53d8('0x7a')||_0x13abfc===_0x53d8('0x7f')||_0x13abfc===_0x53d8('0x7b')||_0x13abfc===_0x53d8('0x7c')||_0x13abfc==='rtpaudioqoslossbridged'||_0x13abfc===_0x53d8('0x7e')||_0x13abfc===_0x53d8('0x80')||_0x13abfc===_0x53d8('0x81')||_0x13abfc===_0x53d8('0x82')||_0x13abfc===_0x53d8('0x39')||_0x13abfc===_0x53d8('0x3a')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x2e50d8,_0x5e3b4a){var _0x41e657,_0x252d6e,_0x22706b;if(_0x5e3b4a<=0x0){_0x5e3b4a=0x1;}_0x41e657=new RegExp(_0x53d8('0x83')+_0x5e3b4a+'}$');_0x252d6e=Math[_0x53d8('0x84')](0xa,_0x5e3b4a-0x1);_0x22706b=Math['pow'](0xa,_0x5e3b4a)-0x1;return util[_0x53d8('0x26')]('%s',_[_0x53d8('0x85')](_0x2e50d8,_0x41e657,_['random'](_0x252d6e,_0x22706b)));};exports[_0x53d8('0x86')]=function(_0x257c1f){var _0x19ecc6=_0x257c1f[_0x53d8('0x87')](/"(.*?)"/);return _0x19ecc6?_0x19ecc6[0x1]:_0x257c1f;};exports[_0x53d8('0x88')]=function(_0x1c757f){var _0x20ab76=_0x1c757f[_0x53d8('0x87')](/<(.*?)>/);return _0x20ab76?_0x20ab76[0x1]:_0x1c757f;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 8659d62..e8b535d 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 _0xf873=['boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','string','number'];(function(_0x138036,_0x389c8c){var _0x22b902=function(_0x4f7910){while(--_0x4f7910){_0x138036['push'](_0x138036['shift']());}};_0x22b902(++_0x389c8c);}(_0xf873,0xb2));var _0x3f87=function(_0x2a4124,_0x2defe6){_0x2a4124=_0x2a4124-0x0;var _0x7a21e7=_0xf873[_0x2a4124];return _0x7a21e7;};'use strict';exports['queueadd']={'queue':{'type':_0x3f87('0x0'),'required':!![]},'interface':{'type':_0x3f87('0x0'),'required':!![]},'membername':{'type':_0x3f87('0x0'),'required':!![]},'penalty':{'type':_0x3f87('0x1'),'required':![]},'paused':{'type':_0x3f87('0x2'),'required':![]}};exports[_0x3f87('0x3')]={'queue':{'type':_0x3f87('0x0'),'required':!![]},'interface':{'type':_0x3f87('0x0'),'required':!![]}};exports[_0x3f87('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0x3f87('0x2')},'reason':{'type':_0x3f87('0x0'),'required':![]}};exports[_0x3f87('0x5')]={'module':{'type':'string','required':![]}};exports[_0x3f87('0x6')]={'uniqueid':{'type':_0x3f87('0x0'),'required':!![]}};exports[_0x3f87('0x7')]={'uniqueid':{'type':_0x3f87('0x0'),'required':!![]},'filename':{'type':_0x3f87('0x0')},'format':{'type':_0x3f87('0x0')},'mixmonitorid':{'type':'string'}};exports[_0x3f87('0x8')]={'uniqueid':{'type':_0x3f87('0x0'),'required':!![]}};exports[_0x3f87('0x9')]={'uniqueid':{'type':_0x3f87('0x0'),'required':!![]},'exten':{'type':_0x3f87('0x0'),'required':!![]},'context':{'type':_0x3f87('0x0')}}; \ No newline at end of file +var _0xc569=['voicequeuechannelredirect','queueadd','string','number','boolean','queuepause','reload','voicechannel'];(function(_0x44fb64,_0x1666f0){var _0x5af4f4=function(_0x5d6b54){while(--_0x5d6b54){_0x44fb64['push'](_0x44fb64['shift']());}};_0x5af4f4(++_0x1666f0);}(_0xc569,0x159));var _0x9c56=function(_0x435504,_0x3afcbe){_0x435504=_0x435504-0x0;var _0x963925=_0xc569[_0x435504];return _0x963925;};'use strict';exports[_0x9c56('0x0')]={'queue':{'type':_0x9c56('0x1'),'required':!![]},'interface':{'type':_0x9c56('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x9c56('0x2'),'required':![]},'paused':{'type':_0x9c56('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x9c56('0x1'),'required':!![]},'interface':{'type':_0x9c56('0x1'),'required':!![]}};exports[_0x9c56('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0x9c56('0x3')},'reason':{'type':_0x9c56('0x1'),'required':![]}};exports[_0x9c56('0x5')]={'module':{'type':_0x9c56('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x9c56('0x1'),'required':!![]}};exports[_0x9c56('0x6')]={'uniqueid':{'type':_0x9c56('0x1'),'required':!![]},'filename':{'type':_0x9c56('0x1')},'format':{'type':_0x9c56('0x1')},'mixmonitorid':{'type':'string'}};exports['voicequeuechannelhangup']={'uniqueid':{'type':'string','required':!![]}};exports[_0x9c56('0x7')]={'uniqueid':{'type':_0x9c56('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x9c56('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index a8a19b0..89770fb 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 _0xd7af=['templates','outbound','voiceExtensions','queueChannels','outboundChannels','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','isNil','interface','format','total','answered','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','abandoned','sumHoldTime','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','initTriggers','initTemplates','zendeskAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initVtigerAccounts','merge','initVoiceQueueReports','queue','queuecallerexit','unmanaged','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaignHopperHistory','exports','bluebird','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/campaign','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns'];(function(_0x424c40,_0x4b1c21){var _0x21546e=function(_0x1c2f74){while(--_0x1c2f74){_0x424c40['push'](_0x424c40['shift']());}};_0x21546e(++_0x4b1c21);}(_0xd7af,0x15f));var _0xfd7a=function(_0x49ed14,_0x439d75){_0x49ed14=_0x49ed14-0x0;var _0x5f254f=_0xd7af[_0x49ed14];return _0x5f254f;};'use strict';var BPromise=require(_0xfd7a('0x0'));var util=require('util');var _=require(_0xfd7a('0x1'));var moment=require(_0xfd7a('0x2'));var Agent=require(_0xfd7a('0x3'));var Telephone=require(_0xfd7a('0x4'));var Trunk=require(_0xfd7a('0x5'));var VoiceQueue=require(_0xfd7a('0x6'));var Trigger=require('../model/trigger');var Template=require('../model/template');var Campaign=require(_0xfd7a('0x7'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0xfd7a('0x8'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xfd7a('0x9'));var SugarcrmAccount=require(_0xfd7a('0xa'));var ZohoAccount=require(_0xfd7a('0xb'));var DeskAccount=require(_0xfd7a('0xc'));var VtigerAccount=require(_0xfd7a('0xd'));var FaxAccount=require(_0xfd7a('0xe'));var Realtime=function(){this[_0xfd7a('0xf')]={};this[_0xfd7a('0x10')]={};this[_0xfd7a('0x11')]={};this[_0xfd7a('0x12')]={};this[_0xfd7a('0x13')]={};this[_0xfd7a('0x14')]={};this[_0xfd7a('0x15')]={};this[_0xfd7a('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xfd7a('0x17')]={};this['channels']={};this[_0xfd7a('0x18')]={};this[_0xfd7a('0x19')]={};this['timers']={};this['zendeskAccounts']={};this[_0xfd7a('0x1a')]={};this[_0xfd7a('0x1b')]={};this[_0xfd7a('0x1c')]={};this[_0xfd7a('0x1d')]={};this[_0xfd7a('0x1e')]={};this[_0xfd7a('0x1f')]={};this[_0xfd7a('0x20')]={};};function freeIsNotKey(_0xf56fa9,_0x2a2b15,_0x5120b7){var _0x15559d=_[_0xfd7a('0x21')](_0xf56fa9,function(_0x2de103,_0x56c94a){return _0x2de103[_0x5120b7];});for(var _0x1bdea7 in _0x2a2b15){if(_0x2a2b15[_0xfd7a('0x22')](_0x1bdea7)){if(!_0x15559d[_0x1bdea7]){delete _0x2a2b15[_0x1bdea7];}}}}function freeIsNotKeySip(_0x4ff771,_0x2ad8fe){var _0x3a0561=_[_0xfd7a('0x21')](_0x4ff771,function(_0x59e070,_0x2e8635){return util['format'](_0xfd7a('0x23'),_0x59e070[_0xfd7a('0x24')]);});for(var _0x2a5fb1 in _0x2ad8fe){if(_0x2ad8fe[_0xfd7a('0x22')](_0x2a5fb1)){if(!_0x3a0561[_0x2a5fb1]){delete _0x2ad8fe[_0x2a5fb1];}}}}function freeIsNotKeyAgent(_0x27b704,_0x6e5f92){var _0xaf0539=_[_0xfd7a('0x21')](_0x27b704,function(_0x51ff18,_0x5e3ad4){var _0x5c8d19=_[_0xfd7a('0x25')](_0x51ff18[_0xfd7a('0x26')])?util[_0xfd7a('0x27')](_0xfd7a('0x23'),_0x51ff18[_0xfd7a('0x24')]):_0x51ff18[_0xfd7a('0x26')];return _0x5c8d19;});for(var _0x9db0da in _0x6e5f92){if(_0x6e5f92[_0xfd7a('0x22')](_0x9db0da)){if(!_0xaf0539[_0x9db0da]){delete _0x6e5f92[_0x9db0da];}}}}function clearVoiceCallReports(_0x13cbf9){_0x13cbf9[_0xfd7a('0x28')]=0x0;_0x13cbf9[_0xfd7a('0x29')]=0x0;_0x13cbf9['sumHoldTime']=0x0;_0x13cbf9[_0xfd7a('0x2a')]=0x0;_0x13cbf9[_0xfd7a('0x2b')]=0x0;}function clearCampaigns(_0x52452e){if(!_[_0xfd7a('0x2c')](_0x52452e)){for(var _0x27553d in _0x52452e){if(_0x52452e[_0xfd7a('0x22')](_0x27553d)){_0x52452e[_0x27553d][_0xfd7a('0x2d')]=0x0;_0x52452e[_0x27553d][_0xfd7a('0x2e')]=0x0;}}}}function clearVoiceQueues(_0x1605ed){if(!_[_0xfd7a('0x2c')](_0x1605ed)){for(var _0x2af10d in _0x1605ed){if(_0x1605ed[_0xfd7a('0x22')](_0x2af10d)){_0x1605ed[_0x2af10d][_0xfd7a('0x28')]=0x0;_0x1605ed[_0x2af10d]['answered']=0x0;_0x1605ed[_0x2af10d]['unmanaged']=0x0;_0x1605ed[_0x2af10d][_0xfd7a('0x2f')]=0x0;_0x1605ed[_0x2af10d][_0xfd7a('0x30')]=0x0;_0x1605ed[_0x2af10d][_0xfd7a('0x2a')]=0x0;_0x1605ed[_0x2af10d][_0xfd7a('0x2b')]=0x0;_0x1605ed[_0x2af10d]['outboundAnswerAgiCallsDay']=0x0;_0x1605ed[_0x2af10d][_0xfd7a('0x31')]=0x0;_0x1605ed[_0x2af10d][_0xfd7a('0x32')]=0x0;_0x1605ed[_0x2af10d][_0xfd7a('0x33')]=0x0;_0x1605ed[_0x2af10d][_0xfd7a('0x34')]=0x0;_0x1605ed[_0x2af10d][_0xfd7a('0x35')]=0x0;_0x1605ed[_0x2af10d]['outboundDropCallsDayTimeout']=0x0;_0x1605ed[_0x2af10d][_0xfd7a('0x36')]=0x0;_0x1605ed[_0x2af10d]['outboundBlacklistCallsDay']=0x0;_0x1605ed[_0x2af10d]['outboundOriginateFailureCallsDay']=0x0;_0x1605ed[_0x2af10d][_0xfd7a('0x37')]=0x0;_0x1605ed[_0x2af10d][_0xfd7a('0x38')]=0x0;_0x1605ed[_0x2af10d][_0xfd7a('0x39')]=0x0;_0x1605ed[_0x2af10d][_0xfd7a('0x3a')]=0x0;_0x1605ed[_0x2af10d][_0xfd7a('0x3b')]=!![];}}}}Realtime[_0xfd7a('0x3c')][_0xfd7a('0x3d')]=function(_0xda4e95,_0x4068f4){for(var _0x31f402 in _0x4068f4){if(_0xda4e95[_0xfd7a('0x22')](_0x31f402)){_0xda4e95[_0x31f402]=_0x4068f4[_0x31f402];}}};Realtime[_0xfd7a('0x3c')][_0xfd7a('0x3e')]=function(){var _0x5c32cd=this;return function(_0x1b4549){if(_0x1b4549){freeIsNotKeyAgent(_0x1b4549,_0x5c32cd[_0xfd7a('0xf')]);for(var _0x491216=0x0,_0x3e61b2={},_0x431f74={};_0x491216<_0x1b4549[_0xfd7a('0x3f')];_0x491216+=0x1){_0x3e61b2=_0x1b4549[_0x491216];var _0x41dea1=_[_0xfd7a('0x25')](_0x3e61b2[_0xfd7a('0x26')])?util['format']('SIP/%s',_0x3e61b2[_0xfd7a('0x24')]):_0x3e61b2[_0xfd7a('0x26')];if(_[_0xfd7a('0x40')](_0x5c32cd[_0xfd7a('0xf')][_0x41dea1])){_0x5c32cd[_0xfd7a('0xf')][_0x41dea1]=new Agent(_0x3e61b2);}else{_0x5c32cd[_0xfd7a('0x3d')](_0x5c32cd[_0xfd7a('0xf')][_0x41dea1],_0x3e61b2);}}}return _0x5c32cd[_0xfd7a('0xf')];};};Realtime[_0xfd7a('0x3c')][_0xfd7a('0x41')]=function(){var _0x2dff96=this;return function(_0x1e4b48){if(_0x1e4b48){freeIsNotKeySip(_0x1e4b48,_0x2dff96[_0xfd7a('0x10')]);for(var _0x53c08c=0x0,_0x16ab50={},_0x1ce83c={};_0x53c08c<_0x1e4b48['length'];_0x53c08c+=0x1){_0x16ab50=_0x1e4b48[_0x53c08c];if(_[_0xfd7a('0x40')](_0x2dff96[_0xfd7a('0x10')][util['format'](_0xfd7a('0x23'),_0x16ab50['name'])])){_0x2dff96[_0xfd7a('0x10')][util['format'](_0xfd7a('0x23'),_0x16ab50['name'])]=new Telephone(_0x16ab50);}else{_0x2dff96[_0xfd7a('0x3d')](_0x2dff96['telephones'][util['format'](_0xfd7a('0x23'),_0x16ab50[_0xfd7a('0x24')])],_0x16ab50);}}}return _0x2dff96[_0xfd7a('0x10')];};};Realtime[_0xfd7a('0x3c')]['initTrunks']=function(){var _0x35f375=this;return function(_0x15dd7a){if(_0x15dd7a){freeIsNotKeySip(_0x15dd7a,_0x35f375[_0xfd7a('0x11')]);for(var _0x22b48e=0x0,_0x1e8e2b={},_0x1679b2={};_0x22b48e<_0x15dd7a[_0xfd7a('0x3f')];_0x22b48e+=0x1){_0x1e8e2b=_0x15dd7a[_0x22b48e];if(_[_0xfd7a('0x40')](_0x35f375[_0xfd7a('0x11')][util[_0xfd7a('0x27')]('SIP/%s',_0x1e8e2b['name'])])){_0x35f375[_0xfd7a('0x11')][util[_0xfd7a('0x27')](_0xfd7a('0x23'),_0x1e8e2b[_0xfd7a('0x24')])]=new Trunk(_0x1e8e2b);}else{_0x35f375[_0xfd7a('0x3d')](_0x35f375[_0xfd7a('0x11')][util[_0xfd7a('0x27')](_0xfd7a('0x23'),_0x1e8e2b[_0xfd7a('0x24')])],_0x1e8e2b);}}}return _0x35f375[_0xfd7a('0x11')];};};Realtime[_0xfd7a('0x3c')]['initVoiceQueues']=function(){var _0x58498f=this;return function(_0x342b11){if(_0x342b11){freeIsNotKey(_0x342b11,_0x58498f[_0xfd7a('0x12')],'name');for(var _0x2115a0=0x0,_0x1e4c3d={},_0x4de923={};_0x2115a0<_0x342b11[_0xfd7a('0x3f')];_0x2115a0+=0x1){_0x1e4c3d=_0x342b11[_0x2115a0];if(_[_0xfd7a('0x40')](_0x58498f['voiceQueues'][_0x1e4c3d[_0xfd7a('0x24')]])){_0x58498f['voiceQueues'][_0x1e4c3d[_0xfd7a('0x24')]]=new VoiceQueue(_0x1e4c3d);}else{_0x58498f[_0xfd7a('0x3d')](_0x58498f[_0xfd7a('0x12')][_0x1e4c3d[_0xfd7a('0x24')]],_0x1e4c3d);}}}return _0x58498f['voiceQueues'];};};Realtime['prototype'][_0xfd7a('0x42')]=function(){var _0x4bfeea=this;return function(_0x3d492e){if(_0x3d492e){freeIsNotKey(_0x3d492e,_0x4bfeea[_0xfd7a('0x13')],'id');for(var _0x5abbc8=0x0,_0x2026f4={},_0x576747={};_0x5abbc8<_0x3d492e[_0xfd7a('0x3f')];_0x5abbc8+=0x1){_0x2026f4=_0x3d492e[_0x5abbc8];if(_['isUndefined'](_0x4bfeea[_0xfd7a('0x13')][_0x2026f4['id']])){_0x4bfeea[_0xfd7a('0x13')][_0x2026f4['id']]=new Trigger(_0x2026f4);}else{_0x4bfeea[_0xfd7a('0x3d')](_0x4bfeea[_0xfd7a('0x13')][_0x2026f4['id']],_0x2026f4);}}}return _0x4bfeea[_0xfd7a('0x13')];};};Realtime['prototype'][_0xfd7a('0x43')]=function(){var _0x7d9a0=this;return function(_0xfb658b){if(_0xfb658b){freeIsNotKey(_0xfb658b,_0x7d9a0[_0xfd7a('0x15')],'id');for(var _0x1da78c=0x0,_0xaf25c3={},_0x37af2a={};_0x1da78c<_0xfb658b['length'];_0x1da78c+=0x1){_0xaf25c3=_0xfb658b[_0x1da78c];if(_[_0xfd7a('0x40')](_0x7d9a0['templates'][_0xaf25c3['id']])){_0x7d9a0[_0xfd7a('0x15')][_0xaf25c3['id']]=new Template(_0xaf25c3);}else{_0x7d9a0[_0xfd7a('0x3d')](_0x7d9a0[_0xfd7a('0x15')][_0xaf25c3['id']],_0xaf25c3);}}}return _0x7d9a0[_0xfd7a('0x15')];};};Realtime['prototype']['initZendeskAccounts']=function(){var _0xca8a72=this;return function(_0x3539e9){if(_0x3539e9){freeIsNotKey(_0x3539e9,_0xca8a72[_0xfd7a('0x44')],'id');for(var _0x2bdad0=0x0,_0x3c3a4b={},_0x4a8777={};_0x2bdad0<_0x3539e9[_0xfd7a('0x3f')];_0x2bdad0+=0x1){_0x3c3a4b=_0x3539e9[_0x2bdad0];if(_[_0xfd7a('0x40')](_0xca8a72[_0xfd7a('0x44')][_0x3c3a4b['id']])){_0xca8a72[_0xfd7a('0x44')][_0x3c3a4b['id']]=new ZendeskAccount(_0x3c3a4b);}else{_0xca8a72[_0xfd7a('0x3d')](_0xca8a72[_0xfd7a('0x44')][_0x3c3a4b['id']],_0x3c3a4b);}}}return _0xca8a72['zendeskAccounts'];};};Realtime[_0xfd7a('0x3c')]['initSalesforceAccounts']=function(){var _0x3073ac=this;return function(_0x4d345a){if(_0x4d345a){freeIsNotKey(_0x4d345a,_0x3073ac['salesforceAccounts'],'id');for(var _0x45099b=0x0,_0x2bc38c={},_0x14d752={};_0x45099b<_0x4d345a['length'];_0x45099b+=0x1){_0x2bc38c=_0x4d345a[_0x45099b];if(_[_0xfd7a('0x40')](_0x3073ac[_0xfd7a('0x1a')][_0x2bc38c['id']])){_0x3073ac[_0xfd7a('0x1a')][_0x2bc38c['id']]=new SalesforceAccount(_0x2bc38c);}else{_0x3073ac[_0xfd7a('0x3d')](_0x3073ac[_0xfd7a('0x1a')][_0x2bc38c['id']],_0x2bc38c);}}}return _0x3073ac[_0xfd7a('0x1a')];};};Realtime[_0xfd7a('0x3c')][_0xfd7a('0x45')]=function(){var _0x39856=this;return function(_0xbf677){if(_0xbf677){freeIsNotKey(_0xbf677,_0x39856['freshdeskAccounts'],'id');for(var _0xea0eb8=0x0,_0x1075d1={},_0x274c6e={};_0xea0eb8<_0xbf677[_0xfd7a('0x3f')];_0xea0eb8+=0x1){_0x1075d1=_0xbf677[_0xea0eb8];if(_['isUndefined'](_0x39856[_0xfd7a('0x1c')][_0x1075d1['id']])){_0x39856[_0xfd7a('0x1c')][_0x1075d1['id']]=new FreshdeskAccount(_0x1075d1);}else{_0x39856[_0xfd7a('0x3d')](_0x39856[_0xfd7a('0x1c')][_0x1075d1['id']],_0x1075d1);}}}return _0x39856[_0xfd7a('0x1c')];};};Realtime['prototype'][_0xfd7a('0x46')]=function(){var _0x4a50a4=this;return function(_0x23193a){if(_0x23193a){freeIsNotKey(_0x23193a,_0x4a50a4[_0xfd7a('0x1d')],'id');for(var _0x572e1c=0x0,_0xdb4f63={},_0x4581c8={};_0x572e1c<_0x23193a[_0xfd7a('0x3f')];_0x572e1c+=0x1){_0xdb4f63=_0x23193a[_0x572e1c];if(_[_0xfd7a('0x40')](_0x4a50a4[_0xfd7a('0x1d')][_0xdb4f63['id']])){_0x4a50a4[_0xfd7a('0x1d')][_0xdb4f63['id']]=new ZohoAccount(_0xdb4f63);}else{_0x4a50a4['mergeFromDatabase'](_0x4a50a4['zohoAccounts'][_0xdb4f63['id']],_0xdb4f63);}}}return _0x4a50a4[_0xfd7a('0x1d')];};};Realtime[_0xfd7a('0x3c')][_0xfd7a('0x47')]=function(){var _0x140e8b=this;return function(_0x9988ce){if(_0x9988ce){freeIsNotKey(_0x9988ce,_0x140e8b[_0xfd7a('0x1e')],'id');for(var _0x46ad54=0x0,_0x1996e0={},_0x2913e7={};_0x46ad54<_0x9988ce['length'];_0x46ad54+=0x1){_0x1996e0=_0x9988ce[_0x46ad54];if(_[_0xfd7a('0x40')](_0x140e8b['deskAccounts'][_0x1996e0['id']])){_0x140e8b['deskAccounts'][_0x1996e0['id']]=new DeskAccount(_0x1996e0);}else{_0x140e8b['mergeFromDatabase'](_0x140e8b[_0xfd7a('0x1e')][_0x1996e0['id']],_0x1996e0);}}}return _0x140e8b[_0xfd7a('0x1e')];};};Realtime['prototype']['initSugarcrmAccounts']=function(){var _0x348b21=this;return function(_0x3dd188){if(_0x3dd188){freeIsNotKey(_0x3dd188,_0x348b21[_0xfd7a('0x1b')],'id');for(var _0xdab56e=0x0,_0x1a049a={},_0xf44d2={};_0xdab56e<_0x3dd188['length'];_0xdab56e+=0x1){_0x1a049a=_0x3dd188[_0xdab56e];if(_[_0xfd7a('0x40')](_0x348b21[_0xfd7a('0x1b')][_0x1a049a['id']])){_0x348b21[_0xfd7a('0x1b')][_0x1a049a['id']]=new SugarcrmAccount(_0x1a049a);}else{_0x348b21['mergeFromDatabase'](_0x348b21[_0xfd7a('0x1b')][_0x1a049a['id']],_0x1a049a);}}}return _0x348b21[_0xfd7a('0x1b')];};};Realtime[_0xfd7a('0x3c')][_0xfd7a('0x48')]=function(){var _0x36a9d4=this;return function(_0x5294b4){if(_0x5294b4){freeIsNotKey(_0x5294b4,_0x36a9d4[_0xfd7a('0x1f')],'id');for(var _0x357f39=0x0,_0x2b6c20={},_0x373c96={};_0x357f39<_0x5294b4[_0xfd7a('0x3f')];_0x357f39+=0x1){_0x2b6c20=_0x5294b4[_0x357f39];if(_['isUndefined'](_0x36a9d4[_0xfd7a('0x1f')][_0x2b6c20['id']])){_0x36a9d4[_0xfd7a('0x1f')][_0x2b6c20['id']]=new VtigerAccount(_0x2b6c20);}else{_0x36a9d4['mergeFromDatabase'](_0x36a9d4[_0xfd7a('0x1f')][_0x2b6c20['id']],_0x2b6c20);}}}return _0x36a9d4[_0xfd7a('0x1f')];};};Realtime[_0xfd7a('0x3c')]['initVoiceQueueHopperHistory']=function(){var _0x2cf265=this;return function(_0x14c64a){for(var _0x1ca8d4=0x0;_0x1ca8d4<_0x14c64a['length'];_0x1ca8d4+=0x1){_[_0xfd7a('0x49')](_0x2cf265[_0xfd7a('0x12')][_0x14c64a[_0x1ca8d4][_0xfd7a('0x24')]],_0x14c64a[_0x1ca8d4]);}return _0x2cf265[_0xfd7a('0x12')];};};Realtime[_0xfd7a('0x3c')][_0xfd7a('0x4a')]=function(){var _0x23266d=this;return function(_0x4e4315){clearVoiceQueues(_0x23266d[_0xfd7a('0x12')]);if(_0x4e4315){_0x4e4315=_['groupBy'](_0x4e4315,'uniqueid');for(var _0x3902c1 in _0x4e4315){if(_0x4e4315[_0xfd7a('0x22')](_0x3902c1)){var _0x5a3bad={};for(var _0x4cc55e=0x0;_0x4cc55e<_0x4e4315[_0x3902c1]['length'];_0x4cc55e+=0x1){var _0x2259d4=_0x4e4315[_0x3902c1][_0x4cc55e][_0xfd7a('0x4b')];if(_0x23266d['voiceQueues'][_0x2259d4]){if(_0x4e4315[_0x3902c1][_0x4cc55e][_0xfd7a('0x4c')]){_0x23266d[_0xfd7a('0x12')][_0x2259d4][_0xfd7a('0x4d')]+=0x1;}if(_0x4e4315[_0x3902c1][_0x4cc55e][_0xfd7a('0x4e')]){_0x23266d[_0xfd7a('0x12')][_0x2259d4][_0xfd7a('0x2f')]+=0x1;}_0x23266d[_0xfd7a('0x12')][_0x2259d4]['sumHoldTime']+=moment(_0x4e4315[_0x3902c1][_0x4cc55e][_0xfd7a('0x4f')])[_0xfd7a('0x50')](moment(_0x4e4315[_0x3902c1][_0x4cc55e][_0xfd7a('0x51')]),_0xfd7a('0x52'))||0x0;if(_0x4cc55e===_0x4e4315[_0x3902c1][_0xfd7a('0x3f')]-0x1){_0x23266d[_0xfd7a('0x12')][_0x2259d4][_0xfd7a('0x2a')]+=moment(_0x4e4315[_0x3902c1][_0x4cc55e][_0xfd7a('0x53')]||_0x4e4315[_0x3902c1][_0x4cc55e]['queuecallerabandonAt']||_0x4e4315[_0x3902c1][_0x4cc55e][_0xfd7a('0x54')])['diff'](moment(_0x4e4315[_0x3902c1][_0x4cc55e][_0xfd7a('0x51')]),_0xfd7a('0x52'))||0x0;_0x23266d[_0xfd7a('0x12')][_0x2259d4][_0xfd7a('0x28')]+=0x1;if(_0x4e4315[_0x3902c1][_0x4cc55e][_0xfd7a('0x55')]){_0x23266d[_0xfd7a('0x12')][_0x2259d4]['answered']+=0x1;_0x23266d[_0xfd7a('0x12')][_0x2259d4][_0xfd7a('0x2b')]+=moment(_0x4e4315[_0x3902c1][_0x4cc55e]['queuecallercompleteAt'])[_0xfd7a('0x50')](moment(_0x4e4315[_0x3902c1][_0x4cc55e][_0xfd7a('0x4f')]),_0xfd7a('0x52'))||0x0;}}else{_0x23266d[_0xfd7a('0x12')][_0x2259d4][_0xfd7a('0x2a')]+=_0x23266d[_0xfd7a('0x12')][_0x2259d4][_0xfd7a('0x30')]||0x0;}}}}}}return _0x23266d[_0xfd7a('0x12')];};};Realtime[_0xfd7a('0x3c')][_0xfd7a('0x56')]=function(){var _0x3d9fdc=this;return function(_0x55a467){clearVoiceCallReports(_0x3d9fdc[_0xfd7a('0x16')]);if(_0x55a467){for(var _0x29276f=0x0;_0x29276f<_0x55a467[_0xfd7a('0x3f')];_0x29276f+=0x1){_0x3d9fdc[_0xfd7a('0x16')]['total']+=0x1;_0x3d9fdc[_0xfd7a('0x16')][_0xfd7a('0x2a')]+=_0x55a467[_0x29276f][_0xfd7a('0x57')];if(_0x55a467[_0x29276f][_0xfd7a('0x58')]===_0xfd7a('0x59')){_0x3d9fdc[_0xfd7a('0x16')][_0xfd7a('0x29')]+=0x1;_0x3d9fdc[_0xfd7a('0x16')]['sumHoldTime']+=_0x55a467[_0x29276f][_0xfd7a('0x57')]-_0x55a467[_0x29276f][_0xfd7a('0x5a')]||0x0;_0x3d9fdc[_0xfd7a('0x16')][_0xfd7a('0x2b')]+=_0x55a467[_0x29276f][_0xfd7a('0x5a')];}}}return _0x3d9fdc['outbound'];};};Realtime[_0xfd7a('0x3c')]['initCampaigns']=function(){var _0x4470e6=this;return function(_0x4c7c9b){if(_0x4c7c9b){freeIsNotKey(_0x4c7c9b,_0x4470e6['campaigns'],_0xfd7a('0x24'));for(var _0x3c04ea=0x0,_0x154d27={};_0x3c04ea<_0x4c7c9b[_0xfd7a('0x3f')];_0x3c04ea+=0x1){_0x154d27=_0x4c7c9b[_0x3c04ea];if(_[_0xfd7a('0x40')](_0x4470e6[_0xfd7a('0x14')][_0x154d27['name']])){_0x4470e6[_0xfd7a('0x14')][_0x154d27['name']]=new Campaign(_0x154d27);}else{_0x4470e6['mergeFromDatabase'](_0x4470e6[_0xfd7a('0x14')][_0x154d27[_0xfd7a('0x24')]],_0x154d27);}}}return _0x4470e6[_0xfd7a('0x14')];};};Realtime[_0xfd7a('0x3c')]['initVoiceExtensions']=function(){var _0x5731df=this;return function(_0x59bcb0){if(_0x59bcb0){freeIsNotKey(_0x59bcb0,_0x5731df[_0xfd7a('0x17')],'id');for(var _0x41a36f=0x0,_0x3afd28={};_0x41a36f<_0x59bcb0['length'];_0x41a36f+=0x1){_0x3afd28=_0x59bcb0[_0x41a36f];if(_['isUndefined'](_0x5731df[_0xfd7a('0x17')][_0x3afd28['id']])){_0x5731df['voiceExtensions'][_0x3afd28['id']]=new VoiceExtension(_0x3afd28);}else{_0x5731df[_0xfd7a('0x3d')](_0x5731df[_0xfd7a('0x17')][_0x3afd28['id']],_0x3afd28);}}}return _0x5731df['voiceExtensions'];};};Realtime[_0xfd7a('0x3c')][_0xfd7a('0x5b')]=function(){var _0x5ceaaa=this;return function(_0xb9ff31){clearCampaigns(_0x5ceaaa['campaigns']);for(var _0x178464=0x0;_0x178464<_0xb9ff31[_0xfd7a('0x3f')];_0x178464+=0x1){_['merge'](_0x5ceaaa[_0xfd7a('0x14')][_0xb9ff31[_0x178464]['name']],_0xb9ff31[_0x178464]);}return _0x5ceaaa[_0xfd7a('0x14')];};};Realtime['prototype']['initFaxAccounts']=function(){var _0x296687=this;return function(_0xc205d0){if(_0xc205d0){freeIsNotKey(_0xc205d0,_0x296687[_0xfd7a('0x20')],'id');for(var _0x25b6bc=0x0,_0x41c4e8={},_0x9695d0={};_0x25b6bc<_0xc205d0[_0xfd7a('0x3f')];_0x25b6bc+=0x1){_0x41c4e8=_0xc205d0[_0x25b6bc];if(_[_0xfd7a('0x40')](_0x296687['faxAccounts'][_0x41c4e8['id']])){_0x296687[_0xfd7a('0x20')][_0x41c4e8['id']]=new FaxAccount(_0x41c4e8);}else{_0x296687[_0xfd7a('0x3d')](_0x296687[_0xfd7a('0x20')][_0x41c4e8['id']],_0x41c4e8);}}}return _0x296687[_0xfd7a('0x20')];};};module[_0xfd7a('0x5c')]=Realtime; \ No newline at end of file +var _0x89a6=['outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','isNil','interface','isUndefined','initTelephones','length','mergeFromDatabase','initTrunks','trunks','initVoiceQueues','initTriggers','initTemplates','templates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','seconds','queuecallercomplete','initVoiceCallReports','outbound','duration','ANSWERED','billableseconds','initCampaigns','campaigns','voiceExtensions','initFaxAccounts','bluebird','util','moment','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','agents','telephones','voiceQueues','triggers','channels','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','total','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','answered','unmanaged','abandoned'];(function(_0x3a6a05,_0x5bced5){var _0x494ef1=function(_0x2233f8){while(--_0x2233f8){_0x3a6a05['push'](_0x3a6a05['shift']());}};_0x494ef1(++_0x5bced5);}(_0x89a6,0xf1));var _0x689a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x89a6[_0x321bb2];return _0x9c12ed;};'use strict';var BPromise=require(_0x689a('0x0'));var util=require(_0x689a('0x1'));var _=require('lodash');var moment=require(_0x689a('0x2'));var Agent=require(_0x689a('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x689a('0x4'));var VoiceQueue=require(_0x689a('0x5'));var Trigger=require(_0x689a('0x6'));var Template=require(_0x689a('0x7'));var Campaign=require(_0x689a('0x8'));var VoiceExtension=require(_0x689a('0x9'));var ZendeskAccount=require(_0x689a('0xa'));var SalesforceAccount=require(_0x689a('0xb'));var FreshdeskAccount=require(_0x689a('0xc'));var SugarcrmAccount=require(_0x689a('0xd'));var ZohoAccount=require(_0x689a('0xe'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require('../model/vtigerAccount');var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x689a('0xf')]={};this[_0x689a('0x10')]={};this['trunks']={};this[_0x689a('0x11')]={};this[_0x689a('0x12')]={};this['campaigns']={};this['templates']={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x689a('0x13')]={};this['queueChannels']={};this['outboundChannels']={};this['timers']={};this['zendeskAccounts']={};this[_0x689a('0x14')]={};this[_0x689a('0x15')]={};this['freshdeskAccounts']={};this[_0x689a('0x16')]={};this[_0x689a('0x17')]={};this[_0x689a('0x18')]={};this[_0x689a('0x19')]={};};function freeIsNotKey(_0x3de76b,_0x1271aa,_0x1e8c6e){var _0x48bc0a=_[_0x689a('0x1a')](_0x3de76b,function(_0x4de4d5,_0x178a80){return _0x4de4d5[_0x1e8c6e];});for(var _0x2eb201 in _0x1271aa){if(_0x1271aa[_0x689a('0x1b')](_0x2eb201)){if(!_0x48bc0a[_0x2eb201]){delete _0x1271aa[_0x2eb201];}}}}function freeIsNotKeySip(_0xfd22ae,_0x41cf8f){var _0xf5f46f=_[_0x689a('0x1a')](_0xfd22ae,function(_0x400127,_0x5ed998){return util[_0x689a('0x1c')](_0x689a('0x1d'),_0x400127[_0x689a('0x1e')]);});for(var _0x3fba28 in _0x41cf8f){if(_0x41cf8f[_0x689a('0x1b')](_0x3fba28)){if(!_0xf5f46f[_0x3fba28]){delete _0x41cf8f[_0x3fba28];}}}}function freeIsNotKeyAgent(_0x416216,_0x51d342){var _0x5e1ca3=_['mapKeys'](_0x416216,function(_0x4c6439,_0x2d3379){var _0x384074=_['isNil'](_0x4c6439['interface'])?util[_0x689a('0x1c')](_0x689a('0x1d'),_0x4c6439[_0x689a('0x1e')]):_0x4c6439['interface'];return _0x384074;});for(var _0x3541dc in _0x51d342){if(_0x51d342[_0x689a('0x1b')](_0x3541dc)){if(!_0x5e1ca3[_0x3541dc]){delete _0x51d342[_0x3541dc];}}}}function clearVoiceCallReports(_0x45e322){_0x45e322[_0x689a('0x1f')]=0x0;_0x45e322['answered']=0x0;_0x45e322[_0x689a('0x20')]=0x0;_0x45e322[_0x689a('0x21')]=0x0;_0x45e322[_0x689a('0x22')]=0x0;}function clearCampaigns(_0xede912){if(!_[_0x689a('0x23')](_0xede912)){for(var _0x552ce7 in _0xede912){if(_0xede912[_0x689a('0x1b')](_0x552ce7)){_0xede912[_0x552ce7][_0x689a('0x24')]=0x0;_0xede912[_0x552ce7][_0x689a('0x25')]=0x0;}}}}function clearVoiceQueues(_0x521cce){if(!_[_0x689a('0x23')](_0x521cce)){for(var _0x5e2b4c in _0x521cce){if(_0x521cce[_0x689a('0x1b')](_0x5e2b4c)){_0x521cce[_0x5e2b4c][_0x689a('0x1f')]=0x0;_0x521cce[_0x5e2b4c][_0x689a('0x26')]=0x0;_0x521cce[_0x5e2b4c][_0x689a('0x27')]=0x0;_0x521cce[_0x5e2b4c][_0x689a('0x28')]=0x0;_0x521cce[_0x5e2b4c][_0x689a('0x20')]=0x0;_0x521cce[_0x5e2b4c]['sumDuration']=0x0;_0x521cce[_0x5e2b4c][_0x689a('0x22')]=0x0;_0x521cce[_0x5e2b4c][_0x689a('0x29')]=0x0;_0x521cce[_0x5e2b4c][_0x689a('0x2a')]=0x0;_0x521cce[_0x5e2b4c][_0x689a('0x2b')]=0x0;_0x521cce[_0x5e2b4c]['outboundCongestionCallsDay']=0x0;_0x521cce[_0x5e2b4c][_0x689a('0x2c')]=0x0;_0x521cce[_0x5e2b4c]['outboundUnknownCallsDay']=0x0;_0x521cce[_0x5e2b4c]['outboundDropCallsDayTimeout']=0x0;_0x521cce[_0x5e2b4c][_0x689a('0x2d')]=0x0;_0x521cce[_0x5e2b4c]['outboundBlacklistCallsDay']=0x0;_0x521cce[_0x5e2b4c][_0x689a('0x2e')]=0x0;_0x521cce[_0x5e2b4c]['outboundRejectCallsDay']=0x0;_0x521cce[_0x5e2b4c][_0x689a('0x2f')]=0x0;_0x521cce[_0x5e2b4c][_0x689a('0x29')]=0x0;_0x521cce[_0x5e2b4c][_0x689a('0x30')]=0x0;_0x521cce[_0x5e2b4c][_0x689a('0x31')]=!![];}}}}Realtime[_0x689a('0x32')]['mergeFromDatabase']=function(_0xbbee9e,_0x1965f9){for(var _0x3a6c06 in _0x1965f9){if(_0xbbee9e[_0x689a('0x1b')](_0x3a6c06)){_0xbbee9e[_0x3a6c06]=_0x1965f9[_0x3a6c06];}}};Realtime[_0x689a('0x32')][_0x689a('0x33')]=function(){var _0x55331e=this;return function(_0x280bb3){if(_0x280bb3){freeIsNotKeyAgent(_0x280bb3,_0x55331e[_0x689a('0xf')]);for(var _0x437559=0x0,_0x47f467={},_0x260f9a={};_0x437559<_0x280bb3['length'];_0x437559+=0x1){_0x47f467=_0x280bb3[_0x437559];var _0x51f7ea=_[_0x689a('0x34')](_0x47f467[_0x689a('0x35')])?util[_0x689a('0x1c')](_0x689a('0x1d'),_0x47f467[_0x689a('0x1e')]):_0x47f467[_0x689a('0x35')];if(_[_0x689a('0x36')](_0x55331e['agents'][_0x51f7ea])){_0x55331e[_0x689a('0xf')][_0x51f7ea]=new Agent(_0x47f467);}else{_0x55331e['mergeFromDatabase'](_0x55331e[_0x689a('0xf')][_0x51f7ea],_0x47f467);}}}return _0x55331e['agents'];};};Realtime[_0x689a('0x32')][_0x689a('0x37')]=function(){var _0x5a6e94=this;return function(_0x13a78d){if(_0x13a78d){freeIsNotKeySip(_0x13a78d,_0x5a6e94[_0x689a('0x10')]);for(var _0x3ebc2e=0x0,_0x355fa1={},_0x2461d2={};_0x3ebc2e<_0x13a78d[_0x689a('0x38')];_0x3ebc2e+=0x1){_0x355fa1=_0x13a78d[_0x3ebc2e];if(_[_0x689a('0x36')](_0x5a6e94['telephones'][util[_0x689a('0x1c')](_0x689a('0x1d'),_0x355fa1[_0x689a('0x1e')])])){_0x5a6e94[_0x689a('0x10')][util['format'](_0x689a('0x1d'),_0x355fa1[_0x689a('0x1e')])]=new Telephone(_0x355fa1);}else{_0x5a6e94[_0x689a('0x39')](_0x5a6e94['telephones'][util[_0x689a('0x1c')](_0x689a('0x1d'),_0x355fa1[_0x689a('0x1e')])],_0x355fa1);}}}return _0x5a6e94[_0x689a('0x10')];};};Realtime['prototype'][_0x689a('0x3a')]=function(){var _0x374099=this;return function(_0x57cdfd){if(_0x57cdfd){freeIsNotKeySip(_0x57cdfd,_0x374099[_0x689a('0x3b')]);for(var _0x3d2d87=0x0,_0x3f7f39={},_0x108cb1={};_0x3d2d87<_0x57cdfd['length'];_0x3d2d87+=0x1){_0x3f7f39=_0x57cdfd[_0x3d2d87];if(_['isUndefined'](_0x374099['trunks'][util[_0x689a('0x1c')](_0x689a('0x1d'),_0x3f7f39['name'])])){_0x374099['trunks'][util[_0x689a('0x1c')](_0x689a('0x1d'),_0x3f7f39[_0x689a('0x1e')])]=new Trunk(_0x3f7f39);}else{_0x374099[_0x689a('0x39')](_0x374099[_0x689a('0x3b')][util[_0x689a('0x1c')]('SIP/%s',_0x3f7f39[_0x689a('0x1e')])],_0x3f7f39);}}}return _0x374099['trunks'];};};Realtime[_0x689a('0x32')][_0x689a('0x3c')]=function(){var _0x37aaa8=this;return function(_0xe661aa){if(_0xe661aa){freeIsNotKey(_0xe661aa,_0x37aaa8['voiceQueues'],'name');for(var _0x3f4d54=0x0,_0x109ee1={},_0x496e14={};_0x3f4d54<_0xe661aa['length'];_0x3f4d54+=0x1){_0x109ee1=_0xe661aa[_0x3f4d54];if(_['isUndefined'](_0x37aaa8[_0x689a('0x11')][_0x109ee1[_0x689a('0x1e')]])){_0x37aaa8[_0x689a('0x11')][_0x109ee1[_0x689a('0x1e')]]=new VoiceQueue(_0x109ee1);}else{_0x37aaa8[_0x689a('0x39')](_0x37aaa8[_0x689a('0x11')][_0x109ee1[_0x689a('0x1e')]],_0x109ee1);}}}return _0x37aaa8['voiceQueues'];};};Realtime[_0x689a('0x32')][_0x689a('0x3d')]=function(){var _0x1f9822=this;return function(_0x5c2fab){if(_0x5c2fab){freeIsNotKey(_0x5c2fab,_0x1f9822[_0x689a('0x12')],'id');for(var _0x3637f5=0x0,_0x531a93={},_0x526d6a={};_0x3637f5<_0x5c2fab[_0x689a('0x38')];_0x3637f5+=0x1){_0x531a93=_0x5c2fab[_0x3637f5];if(_['isUndefined'](_0x1f9822[_0x689a('0x12')][_0x531a93['id']])){_0x1f9822['triggers'][_0x531a93['id']]=new Trigger(_0x531a93);}else{_0x1f9822[_0x689a('0x39')](_0x1f9822[_0x689a('0x12')][_0x531a93['id']],_0x531a93);}}}return _0x1f9822[_0x689a('0x12')];};};Realtime[_0x689a('0x32')][_0x689a('0x3e')]=function(){var _0x82aa77=this;return function(_0x4756ee){if(_0x4756ee){freeIsNotKey(_0x4756ee,_0x82aa77[_0x689a('0x3f')],'id');for(var _0xc25b61=0x0,_0x485889={},_0x238161={};_0xc25b61<_0x4756ee[_0x689a('0x38')];_0xc25b61+=0x1){_0x485889=_0x4756ee[_0xc25b61];if(_['isUndefined'](_0x82aa77[_0x689a('0x3f')][_0x485889['id']])){_0x82aa77[_0x689a('0x3f')][_0x485889['id']]=new Template(_0x485889);}else{_0x82aa77['mergeFromDatabase'](_0x82aa77[_0x689a('0x3f')][_0x485889['id']],_0x485889);}}}return _0x82aa77[_0x689a('0x3f')];};};Realtime[_0x689a('0x32')][_0x689a('0x40')]=function(){var _0x57bb13=this;return function(_0x4f6470){if(_0x4f6470){freeIsNotKey(_0x4f6470,_0x57bb13[_0x689a('0x41')],'id');for(var _0x4e8efd=0x0,_0x306f65={},_0x1fb1f6={};_0x4e8efd<_0x4f6470[_0x689a('0x38')];_0x4e8efd+=0x1){_0x306f65=_0x4f6470[_0x4e8efd];if(_[_0x689a('0x36')](_0x57bb13[_0x689a('0x41')][_0x306f65['id']])){_0x57bb13[_0x689a('0x41')][_0x306f65['id']]=new ZendeskAccount(_0x306f65);}else{_0x57bb13['mergeFromDatabase'](_0x57bb13[_0x689a('0x41')][_0x306f65['id']],_0x306f65);}}}return _0x57bb13[_0x689a('0x41')];};};Realtime[_0x689a('0x32')][_0x689a('0x42')]=function(){var _0xa7be39=this;return function(_0x339e5f){if(_0x339e5f){freeIsNotKey(_0x339e5f,_0xa7be39[_0x689a('0x14')],'id');for(var _0x8bad09=0x0,_0x203085={},_0x435656={};_0x8bad09<_0x339e5f[_0x689a('0x38')];_0x8bad09+=0x1){_0x203085=_0x339e5f[_0x8bad09];if(_[_0x689a('0x36')](_0xa7be39[_0x689a('0x14')][_0x203085['id']])){_0xa7be39[_0x689a('0x14')][_0x203085['id']]=new SalesforceAccount(_0x203085);}else{_0xa7be39[_0x689a('0x39')](_0xa7be39['salesforceAccounts'][_0x203085['id']],_0x203085);}}}return _0xa7be39[_0x689a('0x14')];};};Realtime['prototype'][_0x689a('0x43')]=function(){var _0x22389a=this;return function(_0x26d820){if(_0x26d820){freeIsNotKey(_0x26d820,_0x22389a[_0x689a('0x44')],'id');for(var _0x3f123b=0x0,_0x1b2a35={},_0x4780b3={};_0x3f123b<_0x26d820[_0x689a('0x38')];_0x3f123b+=0x1){_0x1b2a35=_0x26d820[_0x3f123b];if(_['isUndefined'](_0x22389a['freshdeskAccounts'][_0x1b2a35['id']])){_0x22389a[_0x689a('0x44')][_0x1b2a35['id']]=new FreshdeskAccount(_0x1b2a35);}else{_0x22389a[_0x689a('0x39')](_0x22389a[_0x689a('0x44')][_0x1b2a35['id']],_0x1b2a35);}}}return _0x22389a['freshdeskAccounts'];};};Realtime[_0x689a('0x32')][_0x689a('0x45')]=function(){var _0xcec7=this;return function(_0x1c56a4){if(_0x1c56a4){freeIsNotKey(_0x1c56a4,_0xcec7['zohoAccounts'],'id');for(var _0x496eaf=0x0,_0x4ed2db={},_0x3300db={};_0x496eaf<_0x1c56a4[_0x689a('0x38')];_0x496eaf+=0x1){_0x4ed2db=_0x1c56a4[_0x496eaf];if(_[_0x689a('0x36')](_0xcec7[_0x689a('0x16')][_0x4ed2db['id']])){_0xcec7['zohoAccounts'][_0x4ed2db['id']]=new ZohoAccount(_0x4ed2db);}else{_0xcec7['mergeFromDatabase'](_0xcec7['zohoAccounts'][_0x4ed2db['id']],_0x4ed2db);}}}return _0xcec7[_0x689a('0x16')];};};Realtime['prototype'][_0x689a('0x46')]=function(){var _0x17c3be=this;return function(_0x2d2d20){if(_0x2d2d20){freeIsNotKey(_0x2d2d20,_0x17c3be[_0x689a('0x17')],'id');for(var _0x486a35=0x0,_0x485a89={},_0x15d47d={};_0x486a35<_0x2d2d20[_0x689a('0x38')];_0x486a35+=0x1){_0x485a89=_0x2d2d20[_0x486a35];if(_[_0x689a('0x36')](_0x17c3be[_0x689a('0x17')][_0x485a89['id']])){_0x17c3be[_0x689a('0x17')][_0x485a89['id']]=new DeskAccount(_0x485a89);}else{_0x17c3be[_0x689a('0x39')](_0x17c3be[_0x689a('0x17')][_0x485a89['id']],_0x485a89);}}}return _0x17c3be['deskAccounts'];};};Realtime[_0x689a('0x32')]['initSugarcrmAccounts']=function(){var _0x5a367e=this;return function(_0x5d6e44){if(_0x5d6e44){freeIsNotKey(_0x5d6e44,_0x5a367e[_0x689a('0x15')],'id');for(var _0x2a8d3f=0x0,_0xe50a88={},_0x5dffe3={};_0x2a8d3f<_0x5d6e44[_0x689a('0x38')];_0x2a8d3f+=0x1){_0xe50a88=_0x5d6e44[_0x2a8d3f];if(_[_0x689a('0x36')](_0x5a367e[_0x689a('0x15')][_0xe50a88['id']])){_0x5a367e[_0x689a('0x15')][_0xe50a88['id']]=new SugarcrmAccount(_0xe50a88);}else{_0x5a367e[_0x689a('0x39')](_0x5a367e[_0x689a('0x15')][_0xe50a88['id']],_0xe50a88);}}}return _0x5a367e[_0x689a('0x15')];};};Realtime[_0x689a('0x32')][_0x689a('0x47')]=function(){var _0x388188=this;return function(_0x34e159){if(_0x34e159){freeIsNotKey(_0x34e159,_0x388188[_0x689a('0x18')],'id');for(var _0x5eb609=0x0,_0x7dfff4={},_0x380a18={};_0x5eb609<_0x34e159['length'];_0x5eb609+=0x1){_0x7dfff4=_0x34e159[_0x5eb609];if(_['isUndefined'](_0x388188[_0x689a('0x18')][_0x7dfff4['id']])){_0x388188[_0x689a('0x18')][_0x7dfff4['id']]=new VtigerAccount(_0x7dfff4);}else{_0x388188[_0x689a('0x39')](_0x388188[_0x689a('0x18')][_0x7dfff4['id']],_0x7dfff4);}}}return _0x388188['vtigerAccounts'];};};Realtime[_0x689a('0x32')][_0x689a('0x48')]=function(){var _0x1fe561=this;return function(_0x473ae5){for(var _0x24ebea=0x0;_0x24ebea<_0x473ae5[_0x689a('0x38')];_0x24ebea+=0x1){_['merge'](_0x1fe561[_0x689a('0x11')][_0x473ae5[_0x24ebea][_0x689a('0x1e')]],_0x473ae5[_0x24ebea]);}return _0x1fe561['voiceQueues'];};};Realtime[_0x689a('0x32')][_0x689a('0x49')]=function(){var _0x19f85a=this;return function(_0x50ece6){clearVoiceQueues(_0x19f85a[_0x689a('0x11')]);if(_0x50ece6){_0x50ece6=_['groupBy'](_0x50ece6,_0x689a('0x4a'));for(var _0x54ba30 in _0x50ece6){if(_0x50ece6[_0x689a('0x1b')](_0x54ba30)){var _0x29ee62={};for(var _0x3ad8df=0x0;_0x3ad8df<_0x50ece6[_0x54ba30][_0x689a('0x38')];_0x3ad8df+=0x1){var _0x51a6a2=_0x50ece6[_0x54ba30][_0x3ad8df][_0x689a('0x4b')];if(_0x19f85a[_0x689a('0x11')][_0x51a6a2]){if(_0x50ece6[_0x54ba30][_0x3ad8df][_0x689a('0x4c')]){_0x19f85a[_0x689a('0x11')][_0x51a6a2]['unmanaged']+=0x1;}if(_0x50ece6[_0x54ba30][_0x3ad8df][_0x689a('0x4d')]){_0x19f85a[_0x689a('0x11')][_0x51a6a2][_0x689a('0x28')]+=0x1;}_0x19f85a[_0x689a('0x11')][_0x51a6a2][_0x689a('0x20')]+=moment(_0x50ece6[_0x54ba30][_0x3ad8df][_0x689a('0x4e')])['diff'](moment(_0x50ece6[_0x54ba30][_0x3ad8df][_0x689a('0x4f')]),'seconds')||0x0;if(_0x3ad8df===_0x50ece6[_0x54ba30][_0x689a('0x38')]-0x1){_0x19f85a[_0x689a('0x11')][_0x51a6a2]['sumDuration']+=moment(_0x50ece6[_0x54ba30][_0x3ad8df][_0x689a('0x50')]||_0x50ece6[_0x54ba30][_0x3ad8df][_0x689a('0x51')]||_0x50ece6[_0x54ba30][_0x3ad8df][_0x689a('0x52')])['diff'](moment(_0x50ece6[_0x54ba30][_0x3ad8df]['queuecallerjoinAt']),_0x689a('0x53'))||0x0;_0x19f85a[_0x689a('0x11')][_0x51a6a2][_0x689a('0x1f')]+=0x1;if(_0x50ece6[_0x54ba30][_0x3ad8df][_0x689a('0x54')]){_0x19f85a[_0x689a('0x11')][_0x51a6a2][_0x689a('0x26')]+=0x1;_0x19f85a[_0x689a('0x11')][_0x51a6a2][_0x689a('0x22')]+=moment(_0x50ece6[_0x54ba30][_0x3ad8df]['queuecallercompleteAt'])['diff'](moment(_0x50ece6[_0x54ba30][_0x3ad8df][_0x689a('0x4e')]),_0x689a('0x53'))||0x0;}}else{_0x19f85a['voiceQueues'][_0x51a6a2][_0x689a('0x21')]+=_0x19f85a[_0x689a('0x11')][_0x51a6a2][_0x689a('0x20')]||0x0;}}}}}}return _0x19f85a[_0x689a('0x11')];};};Realtime['prototype'][_0x689a('0x55')]=function(){var _0x501698=this;return function(_0x1ff8c4){clearVoiceCallReports(_0x501698['outbound']);if(_0x1ff8c4){for(var _0x5e174c=0x0;_0x5e174c<_0x1ff8c4[_0x689a('0x38')];_0x5e174c+=0x1){_0x501698['outbound']['total']+=0x1;_0x501698[_0x689a('0x56')][_0x689a('0x21')]+=_0x1ff8c4[_0x5e174c][_0x689a('0x57')];if(_0x1ff8c4[_0x5e174c]['disposition']===_0x689a('0x58')){_0x501698[_0x689a('0x56')]['answered']+=0x1;_0x501698['outbound'][_0x689a('0x20')]+=_0x1ff8c4[_0x5e174c][_0x689a('0x57')]-_0x1ff8c4[_0x5e174c]['billableseconds']||0x0;_0x501698[_0x689a('0x56')][_0x689a('0x22')]+=_0x1ff8c4[_0x5e174c][_0x689a('0x59')];}}}return _0x501698[_0x689a('0x56')];};};Realtime[_0x689a('0x32')][_0x689a('0x5a')]=function(){var _0x18459=this;return function(_0x3198c1){if(_0x3198c1){freeIsNotKey(_0x3198c1,_0x18459[_0x689a('0x5b')],_0x689a('0x1e'));for(var _0x29cff3=0x0,_0x1acbbf={};_0x29cff3<_0x3198c1[_0x689a('0x38')];_0x29cff3+=0x1){_0x1acbbf=_0x3198c1[_0x29cff3];if(_[_0x689a('0x36')](_0x18459[_0x689a('0x5b')][_0x1acbbf[_0x689a('0x1e')]])){_0x18459[_0x689a('0x5b')][_0x1acbbf[_0x689a('0x1e')]]=new Campaign(_0x1acbbf);}else{_0x18459[_0x689a('0x39')](_0x18459[_0x689a('0x5b')][_0x1acbbf[_0x689a('0x1e')]],_0x1acbbf);}}}return _0x18459[_0x689a('0x5b')];};};Realtime[_0x689a('0x32')]['initVoiceExtensions']=function(){var _0x28c15f=this;return function(_0x5875fa){if(_0x5875fa){freeIsNotKey(_0x5875fa,_0x28c15f[_0x689a('0x5c')],'id');for(var _0x2bbb2e=0x0,_0x101584={};_0x2bbb2e<_0x5875fa[_0x689a('0x38')];_0x2bbb2e+=0x1){_0x101584=_0x5875fa[_0x2bbb2e];if(_['isUndefined'](_0x28c15f[_0x689a('0x5c')][_0x101584['id']])){_0x28c15f[_0x689a('0x5c')][_0x101584['id']]=new VoiceExtension(_0x101584);}else{_0x28c15f['mergeFromDatabase'](_0x28c15f[_0x689a('0x5c')][_0x101584['id']],_0x101584);}}}return _0x28c15f[_0x689a('0x5c')];};};Realtime['prototype']['initCampaignHopperHistory']=function(){var _0x1240cb=this;return function(_0x49e565){clearCampaigns(_0x1240cb[_0x689a('0x5b')]);for(var _0x81cf43=0x0;_0x81cf43<_0x49e565[_0x689a('0x38')];_0x81cf43+=0x1){_['merge'](_0x1240cb[_0x689a('0x5b')][_0x49e565[_0x81cf43][_0x689a('0x1e')]],_0x49e565[_0x81cf43]);}return _0x1240cb[_0x689a('0x5b')];};};Realtime[_0x689a('0x32')][_0x689a('0x5d')]=function(){var _0x27cf16=this;return function(_0x4605e3){if(_0x4605e3){freeIsNotKey(_0x4605e3,_0x27cf16[_0x689a('0x19')],'id');for(var _0xbe4cbf=0x0,_0xc3b823={},_0x204021={};_0xbe4cbf<_0x4605e3['length'];_0xbe4cbf+=0x1){_0xc3b823=_0x4605e3[_0xbe4cbf];if(_[_0x689a('0x36')](_0x27cf16[_0x689a('0x19')][_0xc3b823['id']])){_0x27cf16[_0x689a('0x19')][_0xc3b823['id']]=new FaxAccount(_0xc3b823);}else{_0x27cf16[_0x689a('0x39')](_0x27cf16[_0x689a('0x19')][_0xc3b823['id']],_0xc3b823);}}}return _0x27cf16[_0x689a('0x19')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 5880d96..7e20293 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 _0x8405=['lodash','moment','util','ami','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','findAgent','find','accountcode','name','interface','format','SIP/%s','voiceQueueReport','connectedlinenum','assigned','lastAssignedTo','isNil','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','match','voiceCallReport','destination','type','dialer','lastapplication','lastdata','context','from-voip-provider','callerid','xcally-motion-preview','calleridnum','destinationchannel','channel','calleridpreview','originatecalleridnum','ANSWERED','\x22%s\x22\x20<%s>','calleridname','monitor','monitorFilename','monitors','filename','createdAt','membername','exten','startsWith','substring','indexOf','mobile','phone','blindTransfer','attendedTransfer','exports','bluebird'];(function(_0x5d9b08,_0x197fca){var _0x497d7b=function(_0x4d62f9){while(--_0x4d62f9){_0x5d9b08['push'](_0x5d9b08['shift']());}};_0x497d7b(++_0x197fca);}(_0x8405,0x167));var _0x5840=function(_0x428197,_0x15daa3){_0x428197=_0x428197-0x0;var _0x13fc6f=_0x8405[_0x428197];return _0x13fc6f;};'use strict';var BPromise=require(_0x5840('0x0'));var _=require(_0x5840('0x1'));var moment=require(_0x5840('0x2'));var util=require(_0x5840('0x3'));var logger=require('../../../config/logger')(_0x5840('0x4'));var ami=require(_0x5840('0x5'));var RpcVoiceAgentReport=require(_0x5840('0x6'));var RpcVoiceCallReport=require(_0x5840('0x7'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x5840('0x8'));var RpcVoiceQueueReport=require(_0x5840('0x9'));var RpcVoiceRecording=require(_0x5840('0xa'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x5840('0xb'));var VoiceCallReport=require(_0x5840('0xc'));var VoiceAgentReport=require(_0x5840('0xd'));var VoiceDialReport=require(_0x5840('0xe'));var UserReport=require(_0x5840('0xf'));function Report(_0x32b159){this[_0x5840('0x10')]=_0x32b159;this[_0x5840('0x11')]=_0x32b159[_0x5840('0x11')];this[_0x5840('0x12')]=_0x32b159[_0x5840('0x12')];}Report[_0x5840('0x13')]['sync']=function(_0x2ea8fd){var _0x24f3cb=new VoiceQueueReport(this['realtime']);var _0x23f555=new VoiceAgentReport(this[_0x5840('0x10')]);var _0x533164=new VoiceDialReport(this['realtime']);var _0x4bfca5=new VoiceCallReport(this[_0x5840('0x10')]);var _0x164017=new UserReport(this[_0x5840('0x10')]);};Report[_0x5840('0x13')][_0x5840('0x14')]=function(_0x5dcbd4){var _0x527011=undefined;_0x527011=_[_0x5840('0x15')](this[_0x5840('0x11')],function(_0x4a9bf7){return _0x4a9bf7[_0x5840('0x16')]==_0x5dcbd4||_0x4a9bf7[_0x5840('0x17')]==_0x5dcbd4;});if(_['isNil'](_0x527011)){var _0x3ab0a5=_[_0x5840('0x15')](this[_0x5840('0x12')],function(_0x47453d){return _0x47453d[_0x5840('0x16')]==_0x5dcbd4||_0x47453d[_0x5840('0x17')]==_0x5dcbd4;});if(_0x3ab0a5){_0x527011=_['find'](this[_0x5840('0x11')],function(_0x4c5222){return _0x4c5222[_0x5840('0x18')]==util[_0x5840('0x19')](_0x5840('0x1a'),_0x3ab0a5[_0x5840('0x17')]);});}}return _0x527011;};Report['prototype'][_0x5840('0x1b')]=function(_0x502b78){for(var _0x1ea2a6=0x0;_0x1ea2a6<_0x502b78['length'];_0x1ea2a6+=0x1){var _0x4253ab=this[_0x5840('0x14')](_0x502b78[_0x1ea2a6][_0x5840('0x1c')]);if(_0x4253ab){_0x502b78[_0x1ea2a6]['accountcode']=_0x4253ab[_0x5840('0x16')];_0x502b78[_0x1ea2a6][_0x5840('0x1d')]=!![];_0x502b78[_0x1ea2a6][_0x5840('0x1e')]=_0x4253ab[_0x5840('0x17')];_0x502b78[_0x1ea2a6][_0x5840('0x18')]=_[_0x5840('0x1f')](_0x4253ab[_0x5840('0x18')])?util[_0x5840('0x19')](_0x5840('0x1a'),_0x4253ab[_0x5840('0x17')]):_0x4253ab[_0x5840('0x18')];if(_0x502b78[_0x1ea2a6][_0x5840('0x20')]){_0x502b78[_0x1ea2a6][_0x5840('0x21')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x502b78[_0x1ea2a6][_0x5840('0x22')]){_0x502b78[_0x1ea2a6][_0x5840('0x23')]=moment()[_0x5840('0x19')](_0x5840('0x24'));}RpcMemberReport[_0x5840('0x1b')](_0x502b78[_0x1ea2a6]);}RpcVoiceQueueReport[_0x5840('0x25')](_0x502b78[_0x1ea2a6]);}};function extractCalleridNumber(_0x248336){var _0x1cea42=_0x248336[_0x5840('0x26')](/<(.*?)>/);return _0x1cea42?_0x1cea42[0x1]:_0x248336;}Report[_0x5840('0x13')][_0x5840('0x27')]=function(_0x17242d){_0x17242d[_0x5840('0x28')]=_0x17242d['destination']||_0x17242d['exten'];if(_0x17242d[_0x5840('0x29')]==_0x5840('0x2a')){_0x17242d[_0x5840('0x2b')]='queue';_0x17242d[_0x5840('0x2c')]=_0x17242d['queue'];if(_0x17242d[_0x5840('0x2d')]==_0x5840('0x2e')){_0x17242d[_0x5840('0x16')]='';_0x17242d['destination']=extractCalleridNumber(_0x17242d[_0x5840('0x2f')]);}else if(_0x17242d[_0x5840('0x2d')]=='from-sip'){if(_0x17242d['destination']==_0x5840('0x30')){_0x17242d[_0x5840('0x28')]=extractCalleridNumber(_0x17242d['calleridpreview']);_0x17242d[_0x5840('0x31')]=_0x17242d['originatecalleridnum'];_0x17242d[_0x5840('0x32')]=[_0x17242d[_0x5840('0x33')],_0x17242d[_0x5840('0x33')]=_0x17242d[_0x5840('0x32')]][0x0];_0x17242d['callerid']=_0x17242d[_0x5840('0x34')];}else{_0x17242d[_0x5840('0x28')]=_0x17242d[_0x5840('0x31')];_0x17242d[_0x5840('0x31')]=_0x17242d[_0x5840('0x35')];if(_0x17242d['disposition']==_0x5840('0x36')){_0x17242d[_0x5840('0x16')]=_0x17242d[_0x5840('0x1c')];}else{_0x17242d['accountcode']='';}}}}else{_0x17242d[_0x5840('0x2f')]=util[_0x5840('0x19')](_0x5840('0x37'),_0x17242d[_0x5840('0x38')],_0x17242d['calleridnum']);}RpcVoiceCallReport[_0x5840('0x25')](_0x17242d);if(_0x17242d[_0x5840('0x39')]){for(var _0x35f67c=0x0;_0x35f67c<_0x17242d['monitors']['length'];_0x35f67c+=0x1){_0x17242d[_0x5840('0x3a')]=_0x17242d[_0x5840('0x3b')][_0x35f67c][_0x5840('0x3c')];_0x17242d[_0x5840('0x3d')]=_0x17242d[_0x5840('0x3b')][_0x35f67c][_0x5840('0x3d')];if(_0x17242d['exten']=='xcally-motion-preview'){_0x17242d['calleridnum']=_0x17242d['connectedlinenum'];_0x17242d[_0x5840('0x38')]=_0x17242d['connectedlinename'];_0x17242d[_0x5840('0x1c')]=_0x17242d[_0x5840('0x16')];_0x17242d['connectedlinename']=_0x17242d[_0x5840('0x3e')];_0x17242d[_0x5840('0x3f')]=_0x17242d[_0x5840('0x35')];}else if(_0x17242d[_0x5840('0x3f')]=='xcally-motion-dialer'){_0x17242d['calleridnum']=_0x17242d[_0x5840('0x28')];_0x17242d[_0x5840('0x3f')]=_0x17242d[_0x5840('0x35')];}RpcVoiceRecording[_0x5840('0x25')](_0x17242d);}}};Report['prototype']['voiceAgentReport']=function(_0x5bc35a){RpcVoiceAgentReport[_0x5840('0x25')](_0x5bc35a);};Report[_0x5840('0x13')]['voiceDialReport']=function(_0x533950){RpcVoiceDialReport[_0x5840('0x25')](_0x533950);var _0x1fb346=undefined;var _0x29f494=_0x533950[_0x5840('0x33')];if(_[_0x5840('0x40')](_0x29f494,'Local')){var _0x20db1c=_0x29f494[_0x5840('0x41')](_0x29f494[_0x5840('0x42')]('/')+0x1,_0x29f494['indexOf']('@'));_0x1fb346=_['find'](this[_0x5840('0x11')],function(_0x2dd2cf){return _0x2dd2cf[_0x5840('0x43')]==_0x20db1c||_0x2dd2cf[_0x5840('0x44')]==_0x20db1c||_0x2dd2cf[_0x5840('0x16')]==_0x20db1c;});}else{var _0x20db1c=_0x29f494[_0x5840('0x41')](_0x29f494[_0x5840('0x42')]('/')+0x1,_0x29f494['lastIndexOf']('-'));_0x1fb346=this['findAgent'](_0x20db1c);}if(_0x1fb346){_0x533950[_0x5840('0x18')]=_[_0x5840('0x1f')](_0x1fb346[_0x5840('0x18')])?util['format'](_0x5840('0x1a'),_0x1fb346[_0x5840('0x17')]):_0x1fb346[_0x5840('0x18')];_0x533950[_0x5840('0x3e')]=_0x1fb346[_0x5840('0x17')];_0x533950[_0x5840('0x16')]=_0x1fb346[_0x5840('0x16')];RpcMemberReport['voiceDialReport'](_0x533950);}};Report['prototype'][_0x5840('0x45')]=function(_0x15b9cd){RpcVoiceTransferReport['blindTransfer'](_0x15b9cd);};Report['prototype'][_0x5840('0x46')]=function(_0x17060f){RpcVoiceTransferReport[_0x5840('0x46')](_0x17060f);};module[_0x5840('0x47')]=Report; \ No newline at end of file +var _0x69de=['agents','telephones','prototype','findAgent','find','accountcode','name','format','SIP/%s','voiceQueueReport','length','connectedlinenum','lastAssignedTo','interface','isNil','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','destination','exten','type','dialer','lastapplication','queue','context','callerid','calleridpreview','calleridnum','destinationchannel','channel','originatecalleridnum','disposition','ANSWERED','monitor','monitors','monitorFilename','createdAt','xcally-motion-preview','calleridname','connectedlinename','xcally-motion-dialer','voiceAgentReport','voiceDialReport','startsWith','Local','indexOf','mobile','phone','substring','lastIndexOf','blindTransfer','attendedTransfer','lodash','moment','util','../../../config/logger','ami','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceRecording','./voiceCallReport','./voiceAgentReport','./userReport','realtime'];(function(_0xf9e76,_0x2e6b9a){var _0x119a9b=function(_0x146396){while(--_0x146396){_0xf9e76['push'](_0xf9e76['shift']());}};_0x119a9b(++_0x2e6b9a);}(_0x69de,0xc2));var _0xe69d=function(_0x3299d1,_0x545733){_0x3299d1=_0x3299d1-0x0;var _0x44356e=_0x69de[_0x3299d1];return _0x44356e;};'use strict';var BPromise=require('bluebird');var _=require(_0xe69d('0x0'));var moment=require(_0xe69d('0x1'));var util=require(_0xe69d('0x2'));var logger=require(_0xe69d('0x3'))(_0xe69d('0x4'));var ami=require(_0xe69d('0x5'));var RpcVoiceAgentReport=require(_0xe69d('0x6'));var RpcVoiceCallReport=require(_0xe69d('0x7'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xe69d('0x8'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xe69d('0x9'));var VoiceAgentReport=require(_0xe69d('0xa'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xe69d('0xb'));function Report(_0x40838a){this[_0xe69d('0xc')]=_0x40838a;this[_0xe69d('0xd')]=_0x40838a[_0xe69d('0xd')];this[_0xe69d('0xe')]=_0x40838a['telephones'];}Report['prototype']['sync']=function(_0x1bf3b2){var _0x14b552=new VoiceQueueReport(this[_0xe69d('0xc')]);var _0x10f3c7=new VoiceAgentReport(this[_0xe69d('0xc')]);var _0x3f384b=new VoiceDialReport(this['realtime']);var _0x464069=new VoiceCallReport(this[_0xe69d('0xc')]);var _0xd4db83=new UserReport(this[_0xe69d('0xc')]);};Report[_0xe69d('0xf')][_0xe69d('0x10')]=function(_0x157ce2){var _0x3d9d8d=undefined;_0x3d9d8d=_[_0xe69d('0x11')](this[_0xe69d('0xd')],function(_0x310027){return _0x310027[_0xe69d('0x12')]==_0x157ce2||_0x310027['name']==_0x157ce2;});if(_['isNil'](_0x3d9d8d)){var _0x583218=_['find'](this[_0xe69d('0xe')],function(_0x21b2cd){return _0x21b2cd[_0xe69d('0x12')]==_0x157ce2||_0x21b2cd[_0xe69d('0x13')]==_0x157ce2;});if(_0x583218){_0x3d9d8d=_[_0xe69d('0x11')](this['agents'],function(_0x142b95){return _0x142b95['interface']==util[_0xe69d('0x14')](_0xe69d('0x15'),_0x583218['name']);});}}return _0x3d9d8d;};Report['prototype'][_0xe69d('0x16')]=function(_0x3682de){for(var _0x395b99=0x0;_0x395b99<_0x3682de[_0xe69d('0x17')];_0x395b99+=0x1){var _0x7d9d3a=this[_0xe69d('0x10')](_0x3682de[_0x395b99][_0xe69d('0x18')]);if(_0x7d9d3a){_0x3682de[_0x395b99]['accountcode']=_0x7d9d3a[_0xe69d('0x12')];_0x3682de[_0x395b99]['assigned']=!![];_0x3682de[_0x395b99][_0xe69d('0x19')]=_0x7d9d3a[_0xe69d('0x13')];_0x3682de[_0x395b99][_0xe69d('0x1a')]=_[_0xe69d('0x1b')](_0x7d9d3a[_0xe69d('0x1a')])?util['format'](_0xe69d('0x15'),_0x7d9d3a[_0xe69d('0x13')]):_0x7d9d3a['interface'];if(_0x3682de[_0x395b99][_0xe69d('0x1c')]){_0x3682de[_0x395b99][_0xe69d('0x1d')]=moment()[_0xe69d('0x14')](_0xe69d('0x1e'));}if(_0x3682de[_0x395b99][_0xe69d('0x1f')]){_0x3682de[_0x395b99][_0xe69d('0x20')]=moment()[_0xe69d('0x14')](_0xe69d('0x1e'));}RpcMemberReport[_0xe69d('0x16')](_0x3682de[_0x395b99]);}RpcVoiceQueueReport[_0xe69d('0x21')](_0x3682de[_0x395b99]);}};function extractCalleridNumber(_0x37792f){var _0x21df18=_0x37792f[_0xe69d('0x22')](/<(.*?)>/);return _0x21df18?_0x21df18[0x1]:_0x37792f;}Report['prototype']['voiceCallReport']=function(_0xad50d4){_0xad50d4['destination']=_0xad50d4[_0xe69d('0x23')]||_0xad50d4[_0xe69d('0x24')];if(_0xad50d4[_0xe69d('0x25')]==_0xe69d('0x26')){_0xad50d4[_0xe69d('0x27')]=_0xe69d('0x28');_0xad50d4['lastdata']=_0xad50d4['queue'];if(_0xad50d4[_0xe69d('0x29')]=='from-voip-provider'){_0xad50d4[_0xe69d('0x12')]='';_0xad50d4['destination']=extractCalleridNumber(_0xad50d4[_0xe69d('0x2a')]);}else if(_0xad50d4[_0xe69d('0x29')]=='from-sip'){if(_0xad50d4[_0xe69d('0x23')]=='xcally-motion-preview'){_0xad50d4[_0xe69d('0x23')]=extractCalleridNumber(_0xad50d4[_0xe69d('0x2b')]);_0xad50d4[_0xe69d('0x2c')]=_0xad50d4['originatecalleridnum'];_0xad50d4[_0xe69d('0x2d')]=[_0xad50d4[_0xe69d('0x2e')],_0xad50d4[_0xe69d('0x2e')]=_0xad50d4[_0xe69d('0x2d')]][0x0];_0xad50d4[_0xe69d('0x2a')]=_0xad50d4[_0xe69d('0x2b')];}else{_0xad50d4[_0xe69d('0x23')]=_0xad50d4[_0xe69d('0x2c')];_0xad50d4[_0xe69d('0x2c')]=_0xad50d4[_0xe69d('0x2f')];if(_0xad50d4[_0xe69d('0x30')]==_0xe69d('0x31')){_0xad50d4[_0xe69d('0x12')]=_0xad50d4[_0xe69d('0x18')];}else{_0xad50d4[_0xe69d('0x12')]='';}}}}else{_0xad50d4['callerid']=util[_0xe69d('0x14')]('\x22%s\x22\x20<%s>',_0xad50d4['calleridname'],_0xad50d4[_0xe69d('0x2c')]);}RpcVoiceCallReport[_0xe69d('0x21')](_0xad50d4);if(_0xad50d4[_0xe69d('0x32')]){for(var _0x7cb968=0x0;_0x7cb968<_0xad50d4[_0xe69d('0x33')][_0xe69d('0x17')];_0x7cb968+=0x1){_0xad50d4[_0xe69d('0x34')]=_0xad50d4[_0xe69d('0x33')][_0x7cb968]['filename'];_0xad50d4[_0xe69d('0x35')]=_0xad50d4[_0xe69d('0x33')][_0x7cb968][_0xe69d('0x35')];if(_0xad50d4['exten']==_0xe69d('0x36')){_0xad50d4[_0xe69d('0x2c')]=_0xad50d4[_0xe69d('0x18')];_0xad50d4[_0xe69d('0x37')]=_0xad50d4[_0xe69d('0x38')];_0xad50d4[_0xe69d('0x18')]=_0xad50d4[_0xe69d('0x12')];_0xad50d4['connectedlinename']=_0xad50d4['membername'];_0xad50d4['exten']=_0xad50d4['originatecalleridnum'];}else if(_0xad50d4[_0xe69d('0x24')]==_0xe69d('0x39')){_0xad50d4['calleridnum']=_0xad50d4[_0xe69d('0x23')];_0xad50d4[_0xe69d('0x24')]=_0xad50d4[_0xe69d('0x2f')];}RpcVoiceRecording[_0xe69d('0x21')](_0xad50d4);}}};Report[_0xe69d('0xf')][_0xe69d('0x3a')]=function(_0x2859a6){RpcVoiceAgentReport['create'](_0x2859a6);};Report['prototype'][_0xe69d('0x3b')]=function(_0x1efa9e){RpcVoiceDialReport[_0xe69d('0x21')](_0x1efa9e);var _0x523f02=undefined;var _0x2c066a=_0x1efa9e[_0xe69d('0x2e')];if(_[_0xe69d('0x3c')](_0x2c066a,_0xe69d('0x3d'))){var _0x27fb5b=_0x2c066a['substring'](_0x2c066a[_0xe69d('0x3e')]('/')+0x1,_0x2c066a[_0xe69d('0x3e')]('@'));_0x523f02=_[_0xe69d('0x11')](this[_0xe69d('0xd')],function(_0x4400de){return _0x4400de[_0xe69d('0x3f')]==_0x27fb5b||_0x4400de[_0xe69d('0x40')]==_0x27fb5b||_0x4400de[_0xe69d('0x12')]==_0x27fb5b;});}else{var _0x27fb5b=_0x2c066a[_0xe69d('0x41')](_0x2c066a['indexOf']('/')+0x1,_0x2c066a[_0xe69d('0x42')]('-'));_0x523f02=this[_0xe69d('0x10')](_0x27fb5b);}if(_0x523f02){_0x1efa9e['interface']=_[_0xe69d('0x1b')](_0x523f02[_0xe69d('0x1a')])?util[_0xe69d('0x14')](_0xe69d('0x15'),_0x523f02[_0xe69d('0x13')]):_0x523f02[_0xe69d('0x1a')];_0x1efa9e['membername']=_0x523f02[_0xe69d('0x13')];_0x1efa9e[_0xe69d('0x12')]=_0x523f02[_0xe69d('0x12')];RpcMemberReport[_0xe69d('0x3b')](_0x1efa9e);}};Report[_0xe69d('0xf')]['blindTransfer']=function(_0x5a5cb5){RpcVoiceTransferReport[_0xe69d('0x43')](_0x5a5cb5);};Report[_0xe69d('0xf')][_0xe69d('0x44')]=function(_0x266536){RpcVoiceTransferReport['attendedTransfer'](_0x266536);};module['exports']=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index bbd2b21..42327ab 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 _0x82f0=['trunk:save','[syncRegistry][UserReport]','syncDeviceState','device','toLowerCase','inuse','local','stateTime','toNumber','updateStatusRealtime','telephone:save','Queue','startsWith','Local','substring','indexOf','mobile','phone','[syncDeviceState][UserReport]','peerstatus','peer','registered','address','status','exports','lodash','moment','bluebird','util','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','trunks','agents','telephones','registryentry','syncRegistry','bind','devicestatechange','syncPeerStatus','loopSyncRealTimeShow','resolve','then','actionDeviceStateList','actionSipPeerStatus','catch','[loopSyncRealTimeShow]','error','inspect','actionSipShowRegistry','prototype','isNotNull','isUndefined','emit','find','username','stateRegistry','merge','omit','event','actionid','state','format','trunk:%s','name'];(function(_0x3a2337,_0x32e3db){var _0x306b4e=function(_0xef871a){while(--_0xef871a){_0x3a2337['push'](_0x3a2337['shift']());}};_0x306b4e(++_0x32e3db);}(_0x82f0,0x172));var _0x082f=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x82f0[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x082f('0x0'));var moment=require(_0x082f('0x1'));var BPromise=require(_0x082f('0x2'));var util=require(_0x082f('0x3'));var Redis=require('ioredis');var config=require(_0x082f('0x4'));var logger=require(_0x082f('0x5'))(_0x082f('0x6'));var ami=require(_0x082f('0x7'));config[_0x082f('0x8')]=_[_0x082f('0x9')](config['redis'],{'host':_0x082f('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x082f('0x8')]));function UserReport(_0x4aa77f){this['trunks']=_0x4aa77f[_0x082f('0xb')];this[_0x082f('0xc')]=_0x4aa77f[_0x082f('0xc')];this[_0x082f('0xd')]=_0x4aa77f['telephones'];ami['on'](_0x082f('0xe'),this[_0x082f('0xf')][_0x082f('0x10')](this));ami['on']('registry',this[_0x082f('0xf')]['bind'](this));ami['on'](_0x082f('0x11'),this['syncDeviceState'][_0x082f('0x10')](this));ami['on']('peerstatus',this[_0x082f('0x12')][_0x082f('0x10')](this));this[_0x082f('0x13')]();return BPromise[_0x082f('0x14')]()[_0x082f('0x15')](ami['actionSipShowRegistry']())['then'](ami[_0x082f('0x16')]())['then'](ami[_0x082f('0x17')]())[_0x082f('0x18')](loggerCatch(_0x082f('0x19')));}function loggerCatch(_0x3ec791){return function(_0x3474f1){logger[_0x082f('0x1a')](_0x3ec791,util[_0x082f('0x1b')](_0x3474f1,{'showHidden':![],'depth':null}));};}UserReport['prototype']['loopSyncRealTimeShow']=function(){setInterval(function(){BPromise['resolve']()[_0x082f('0x15')](ami[_0x082f('0x1c')]())[_0x082f('0x15')](ami[_0x082f('0x16')]())[_0x082f('0x15')](ami[_0x082f('0x17')]())[_0x082f('0x18')](loggerCatch(_0x082f('0x19')));},0x32c8);};UserReport[_0x082f('0x1d')][_0x082f('0x1e')]=function(_0x5c5bc5){return _0x5c5bc5!==null&&!_[_0x082f('0x1f')](_0x5c5bc5);};UserReport[_0x082f('0x1d')][_0x082f('0x20')]=function(_0x412187,_0x1152f9,_0x223017){io['to'](_0x412187)['emit'](_0x1152f9,_0x223017);};UserReport[_0x082f('0x1d')][_0x082f('0xf')]=function(_0x14357f){try{if(this['isNotNull'](_0x14357f)){var _0x712771=_[_0x082f('0x21')](this['trunks'],{'registry':_0x14357f[_0x082f('0x22')]});if(_0x712771){_0x14357f[_0x082f('0x23')]=_0x14357f['state'];_[_0x082f('0x24')](_0x712771,_[_0x082f('0x25')](_0x14357f,[_0x082f('0x26'),_0x082f('0x27'),_0x082f('0x22'),_0x082f('0x28')]));this[_0x082f('0x20')](util[_0x082f('0x29')](_0x082f('0x2a'),_0x712771[_0x082f('0x2b')]),_0x082f('0x2c'),_0x712771);}}}catch(_0x21f73b){logger[_0x082f('0x1a')](_0x082f('0x2d'),util[_0x082f('0x1b')](_0x21f73b,{'showHidden':![],'depth':null}));}};UserReport[_0x082f('0x1d')][_0x082f('0x2e')]=function(_0x40d710){try{if(this[_0x082f('0x1e')](_0x40d710)){if(this[_0x082f('0xc')][_0x40d710[_0x082f('0x2f')]]){if(!this[_0x082f('0xc')][_0x40d710[_0x082f('0x2f')]]['local']||_0x40d710['state'][_0x082f('0x30')]()==_0x082f('0x31')){this[_0x082f('0xc')][_0x40d710[_0x082f('0x2f')]][_0x082f('0x32')]=![];if(this[_0x082f('0xc')][_0x40d710['device']][_0x082f('0x28')]!==_0x40d710['state'][_0x082f('0x30')]()){this[_0x082f('0xc')][_0x40d710[_0x082f('0x2f')]][_0x082f('0x33')]=_[_0x082f('0x34')](moment()['format']('x'));}this[_0x082f('0xc')][_0x40d710[_0x082f('0x2f')]][_0x082f('0x28')]=_0x40d710[_0x082f('0x28')][_0x082f('0x30')]();this[_0x082f('0xc')][_0x40d710[_0x082f('0x2f')]][_0x082f('0x35')](_0x40d710);}}else if(this['telephones'][_0x40d710[_0x082f('0x2f')]]){if(this['telephones'][_0x40d710[_0x082f('0x2f')]][_0x082f('0x28')]!==_0x40d710[_0x082f('0x28')][_0x082f('0x30')]()){this['telephones'][_0x40d710[_0x082f('0x2f')]]['stateTime']=_[_0x082f('0x34')](moment()[_0x082f('0x29')]('x'));}this['telephones'][_0x40d710['device']][_0x082f('0x28')]=_0x40d710['state'][_0x082f('0x30')]();this[_0x082f('0x20')](util[_0x082f('0x29')]('telephone:%s',this[_0x082f('0xd')][_0x40d710[_0x082f('0x2f')]][_0x082f('0x2b')]),_0x082f('0x36'),this[_0x082f('0xd')][_0x40d710['device']]);}else if(this[_0x082f('0xb')][_0x40d710['device']]){if(this[_0x082f('0xb')][_0x40d710[_0x082f('0x2f')]]['state']!==_0x40d710[_0x082f('0x28')][_0x082f('0x30')]()){this[_0x082f('0xb')][_0x40d710[_0x082f('0x2f')]][_0x082f('0x33')]=_[_0x082f('0x34')](moment()[_0x082f('0x29')]('x'));}this[_0x082f('0xb')][_0x40d710[_0x082f('0x2f')]][_0x082f('0x28')]=_0x40d710['state'][_0x082f('0x30')]();this[_0x082f('0x20')](util['format'](_0x082f('0x2a'),this[_0x082f('0xb')][_0x40d710[_0x082f('0x2f')]]['name']),_0x082f('0x2c'),this[_0x082f('0xb')][_0x40d710[_0x082f('0x2f')]]);}else if(_['startsWith'](_0x40d710[_0x082f('0x2f')],_0x082f('0x37'))){}else if(_[_0x082f('0x38')](_0x40d710[_0x082f('0x2f')],_0x082f('0x39'))){var _0x492103=_0x40d710[_0x082f('0x2f')];var _0xd425f5=_0x492103[_0x082f('0x3a')](_0x492103['indexOf']('/')+0x1,_0x492103[_0x082f('0x3b')]('@'));var _0x176484=_['find'](this['agents'],function(_0x14a153){return _0x14a153[_0x082f('0x3c')]==_0xd425f5||_0x14a153[_0x082f('0x3d')]==_0xd425f5||_0x14a153['accountcode']==_0xd425f5;});if(_0x176484){if(_0x176484['state']!==_0x40d710['state'][_0x082f('0x30')]()){_0x176484[_0x082f('0x33')]=_[_0x082f('0x34')](moment()[_0x082f('0x29')]('x'));}_0x176484[_0x082f('0x28')]=_0x40d710[_0x082f('0x28')][_0x082f('0x30')]();_0x176484[_0x082f('0x32')]=!![];_0x176484[_0x082f('0x35')](_0x40d710);}}else{}}}catch(_0x5a2563){logger[_0x082f('0x1a')](_0x082f('0x3e'),util[_0x082f('0x1b')](_0x5a2563,{'showHidden':![],'depth':null}));}};UserReport[_0x082f('0x1d')][_0x082f('0x12')]=function(_0x5e7def){try{if(this[_0x082f('0x1e')](_0x5e7def)&&this[_0x082f('0x1e')](_0x5e7def[_0x082f('0x3f')])){if(this[_0x082f('0xc')][_0x5e7def[_0x082f('0x40')]]){if(!this[_0x082f('0xc')][_0x5e7def['peer']][_0x082f('0x32')]||_0x5e7def[_0x082f('0x3f')][_0x082f('0x30')]()==_0x082f('0x41')){this[_0x082f('0xc')][_0x5e7def[_0x082f('0x40')]][_0x082f('0x32')]=![];this['agents'][_0x5e7def[_0x082f('0x40')]]['status']=_0x5e7def['peerstatus']['toLowerCase']();this[_0x082f('0xc')][_0x5e7def[_0x082f('0x40')]][_0x082f('0x42')]=_0x5e7def['address'];this['agents'][_0x5e7def[_0x082f('0x40')]][_0x082f('0x35')](_0x5e7def);}}else if(this[_0x082f('0xd')][_0x5e7def[_0x082f('0x40')]]){this[_0x082f('0xd')][_0x5e7def['peer']][_0x082f('0x43')]=_0x5e7def[_0x082f('0x3f')]['toLowerCase']();this[_0x082f('0xd')][_0x5e7def[_0x082f('0x40')]][_0x082f('0x42')]=_0x5e7def[_0x082f('0x42')];this[_0x082f('0x20')](util[_0x082f('0x29')]('telephone:%s',this[_0x082f('0xd')][_0x5e7def[_0x082f('0x40')]][_0x082f('0x2b')]),_0x082f('0x36'),this[_0x082f('0xd')][_0x5e7def[_0x082f('0x40')]]);}else if(this['trunks'][_0x5e7def[_0x082f('0x40')]]){this[_0x082f('0xb')][_0x5e7def['peer']][_0x082f('0x43')]=_0x5e7def[_0x082f('0x3f')][_0x082f('0x30')]();this[_0x082f('0xb')][_0x5e7def['peer']][_0x082f('0x42')]=_0x5e7def['address'];this[_0x082f('0x20')](util[_0x082f('0x29')]('trunk:%s',this[_0x082f('0xb')][_0x5e7def[_0x082f('0x40')]][_0x082f('0x2b')]),_0x082f('0x2c'),this['trunks'][_0x5e7def['peer']]);}else{}}}catch(_0x54a9ed){logger[_0x082f('0x1a')]('[syncPeerStatus][UserReport]',util[_0x082f('0x1b')](_0x54a9ed,{'showHidden':![],'depth':null}));}};module[_0x082f('0x44')]=UserReport; \ No newline at end of file +var _0xa14b=['lodash','bluebird','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','registry','syncRegistry','bind','syncPeerStatus','loopSyncRealTimeShow','resolve','actionSipShowRegistry','then','actionDeviceStateList','actionSipPeerStatus','catch','[loopSyncRealTimeShow]','error','inspect','prototype','isNotNull','emit','find','username','state','merge','omit','format','trunk:%s','name','syncDeviceState','device','local','toLowerCase','inuse','toNumber','updateStatusRealtime','stateTime','telephone:save','Queue','startsWith','Local','substring','indexOf','phone','accountcode','[syncDeviceState][UserReport]','peerstatus','peer','status','address','telephone:%s','trunk:save','[syncPeerStatus][UserReport]','exports'];(function(_0x1c8982,_0x1dfb9c){var _0x325939=function(_0x18f6f4){while(--_0x18f6f4){_0x1c8982['push'](_0x1c8982['shift']());}};_0x325939(++_0x1dfb9c);}(_0xa14b,0x1c7));var _0xba14=function(_0x53960b,_0x5a5fec){_0x53960b=_0x53960b-0x0;var _0xfef10e=_0xa14b[_0x53960b];return _0xfef10e;};'use strict';var _=require(_0xba14('0x0'));var moment=require('moment');var BPromise=require(_0xba14('0x1'));var util=require(_0xba14('0x2'));var Redis=require(_0xba14('0x3'));var config=require(_0xba14('0x4'));var logger=require(_0xba14('0x5'))('ami');var ami=require(_0xba14('0x6'));config[_0xba14('0x7')]=_[_0xba14('0x8')](config[_0xba14('0x7')],{'host':_0xba14('0x9'),'port':0x18eb});var io=require(_0xba14('0xa'))(new Redis(config[_0xba14('0x7')]));function UserReport(_0x36b385){this[_0xba14('0xb')]=_0x36b385[_0xba14('0xb')];this['agents']=_0x36b385[_0xba14('0xc')];this[_0xba14('0xd')]=_0x36b385[_0xba14('0xd')];ami['on'](_0xba14('0xe'),this['syncRegistry']['bind'](this));ami['on'](_0xba14('0xf'),this[_0xba14('0x10')][_0xba14('0x11')](this));ami['on']('devicestatechange',this['syncDeviceState'][_0xba14('0x11')](this));ami['on']('peerstatus',this[_0xba14('0x12')][_0xba14('0x11')](this));this[_0xba14('0x13')]();return BPromise[_0xba14('0x14')]()['then'](ami[_0xba14('0x15')]())[_0xba14('0x16')](ami[_0xba14('0x17')]())[_0xba14('0x16')](ami[_0xba14('0x18')]())[_0xba14('0x19')](loggerCatch(_0xba14('0x1a')));}function loggerCatch(_0x1c6f73){return function(_0x4c30d8){logger[_0xba14('0x1b')](_0x1c6f73,util[_0xba14('0x1c')](_0x4c30d8,{'showHidden':![],'depth':null}));};}UserReport[_0xba14('0x1d')][_0xba14('0x13')]=function(){setInterval(function(){BPromise[_0xba14('0x14')]()[_0xba14('0x16')](ami['actionSipShowRegistry']())[_0xba14('0x16')](ami[_0xba14('0x17')]())[_0xba14('0x16')](ami[_0xba14('0x18')]())[_0xba14('0x19')](loggerCatch(_0xba14('0x1a')));},0x32c8);};UserReport[_0xba14('0x1d')][_0xba14('0x1e')]=function(_0x4df96f){return _0x4df96f!==null&&!_['isUndefined'](_0x4df96f);};UserReport[_0xba14('0x1d')][_0xba14('0x1f')]=function(_0x3d748b,_0x570d88,_0x4b5cf4){io['to'](_0x3d748b)['emit'](_0x570d88,_0x4b5cf4);};UserReport[_0xba14('0x1d')]['syncRegistry']=function(_0x3a7663){try{if(this[_0xba14('0x1e')](_0x3a7663)){var _0x573174=_[_0xba14('0x20')](this[_0xba14('0xb')],{'registry':_0x3a7663[_0xba14('0x21')]});if(_0x573174){_0x3a7663['stateRegistry']=_0x3a7663[_0xba14('0x22')];_[_0xba14('0x23')](_0x573174,_[_0xba14('0x24')](_0x3a7663,['event','actionid','username',_0xba14('0x22')]));this[_0xba14('0x1f')](util[_0xba14('0x25')](_0xba14('0x26'),_0x573174[_0xba14('0x27')]),'trunk:save',_0x573174);}}}catch(_0x138cb4){logger[_0xba14('0x1b')]('[syncRegistry][UserReport]',util[_0xba14('0x1c')](_0x138cb4,{'showHidden':![],'depth':null}));}};UserReport[_0xba14('0x1d')][_0xba14('0x28')]=function(_0x5593fd){try{if(this[_0xba14('0x1e')](_0x5593fd)){if(this[_0xba14('0xc')][_0x5593fd[_0xba14('0x29')]]){if(!this[_0xba14('0xc')][_0x5593fd[_0xba14('0x29')]][_0xba14('0x2a')]||_0x5593fd[_0xba14('0x22')][_0xba14('0x2b')]()==_0xba14('0x2c')){this['agents'][_0x5593fd[_0xba14('0x29')]][_0xba14('0x2a')]=![];if(this[_0xba14('0xc')][_0x5593fd[_0xba14('0x29')]]['state']!==_0x5593fd[_0xba14('0x22')][_0xba14('0x2b')]()){this[_0xba14('0xc')][_0x5593fd[_0xba14('0x29')]]['stateTime']=_[_0xba14('0x2d')](moment()[_0xba14('0x25')]('x'));}this[_0xba14('0xc')][_0x5593fd[_0xba14('0x29')]][_0xba14('0x22')]=_0x5593fd[_0xba14('0x22')][_0xba14('0x2b')]();this['agents'][_0x5593fd[_0xba14('0x29')]][_0xba14('0x2e')](_0x5593fd);}}else if(this['telephones'][_0x5593fd[_0xba14('0x29')]]){if(this['telephones'][_0x5593fd['device']][_0xba14('0x22')]!==_0x5593fd[_0xba14('0x22')][_0xba14('0x2b')]()){this[_0xba14('0xd')][_0x5593fd[_0xba14('0x29')]][_0xba14('0x2f')]=_[_0xba14('0x2d')](moment()['format']('x'));}this[_0xba14('0xd')][_0x5593fd['device']][_0xba14('0x22')]=_0x5593fd[_0xba14('0x22')]['toLowerCase']();this[_0xba14('0x1f')](util[_0xba14('0x25')]('telephone:%s',this[_0xba14('0xd')][_0x5593fd['device']]['name']),_0xba14('0x30'),this[_0xba14('0xd')][_0x5593fd[_0xba14('0x29')]]);}else if(this['trunks'][_0x5593fd[_0xba14('0x29')]]){if(this[_0xba14('0xb')][_0x5593fd[_0xba14('0x29')]][_0xba14('0x22')]!==_0x5593fd[_0xba14('0x22')][_0xba14('0x2b')]()){this[_0xba14('0xb')][_0x5593fd['device']][_0xba14('0x2f')]=_[_0xba14('0x2d')](moment()[_0xba14('0x25')]('x'));}this[_0xba14('0xb')][_0x5593fd[_0xba14('0x29')]][_0xba14('0x22')]=_0x5593fd['state'][_0xba14('0x2b')]();this[_0xba14('0x1f')](util['format']('trunk:%s',this[_0xba14('0xb')][_0x5593fd['device']][_0xba14('0x27')]),'trunk:save',this[_0xba14('0xb')][_0x5593fd[_0xba14('0x29')]]);}else if(_['startsWith'](_0x5593fd['device'],_0xba14('0x31'))){}else if(_[_0xba14('0x32')](_0x5593fd['device'],_0xba14('0x33'))){var _0x3ca1d4=_0x5593fd[_0xba14('0x29')];var _0x596f12=_0x3ca1d4[_0xba14('0x34')](_0x3ca1d4[_0xba14('0x35')]('/')+0x1,_0x3ca1d4['indexOf']('@'));var _0x26fd60=_[_0xba14('0x20')](this['agents'],function(_0x3bf349){return _0x3bf349['mobile']==_0x596f12||_0x3bf349[_0xba14('0x36')]==_0x596f12||_0x3bf349[_0xba14('0x37')]==_0x596f12;});if(_0x26fd60){if(_0x26fd60[_0xba14('0x22')]!==_0x5593fd['state'][_0xba14('0x2b')]()){_0x26fd60[_0xba14('0x2f')]=_[_0xba14('0x2d')](moment()[_0xba14('0x25')]('x'));}_0x26fd60['state']=_0x5593fd[_0xba14('0x22')][_0xba14('0x2b')]();_0x26fd60[_0xba14('0x2a')]=!![];_0x26fd60[_0xba14('0x2e')](_0x5593fd);}}else{}}}catch(_0x96e759){logger[_0xba14('0x1b')](_0xba14('0x38'),util[_0xba14('0x1c')](_0x96e759,{'showHidden':![],'depth':null}));}};UserReport[_0xba14('0x1d')]['syncPeerStatus']=function(_0xb7dbcd){try{if(this['isNotNull'](_0xb7dbcd)&&this['isNotNull'](_0xb7dbcd[_0xba14('0x39')])){if(this[_0xba14('0xc')][_0xb7dbcd[_0xba14('0x3a')]]){if(!this[_0xba14('0xc')][_0xb7dbcd['peer']][_0xba14('0x2a')]||_0xb7dbcd[_0xba14('0x39')][_0xba14('0x2b')]()=='registered'){this[_0xba14('0xc')][_0xb7dbcd[_0xba14('0x3a')]][_0xba14('0x2a')]=![];this[_0xba14('0xc')][_0xb7dbcd[_0xba14('0x3a')]][_0xba14('0x3b')]=_0xb7dbcd[_0xba14('0x39')][_0xba14('0x2b')]();this['agents'][_0xb7dbcd[_0xba14('0x3a')]][_0xba14('0x3c')]=_0xb7dbcd[_0xba14('0x3c')];this[_0xba14('0xc')][_0xb7dbcd[_0xba14('0x3a')]][_0xba14('0x2e')](_0xb7dbcd);}}else if(this['telephones'][_0xb7dbcd[_0xba14('0x3a')]]){this['telephones'][_0xb7dbcd['peer']][_0xba14('0x3b')]=_0xb7dbcd[_0xba14('0x39')][_0xba14('0x2b')]();this[_0xba14('0xd')][_0xb7dbcd[_0xba14('0x3a')]]['address']=_0xb7dbcd[_0xba14('0x3c')];this[_0xba14('0x1f')](util[_0xba14('0x25')](_0xba14('0x3d'),this[_0xba14('0xd')][_0xb7dbcd[_0xba14('0x3a')]][_0xba14('0x27')]),'telephone:save',this[_0xba14('0xd')][_0xb7dbcd[_0xba14('0x3a')]]);}else if(this[_0xba14('0xb')][_0xb7dbcd[_0xba14('0x3a')]]){this[_0xba14('0xb')][_0xb7dbcd['peer']]['status']=_0xb7dbcd[_0xba14('0x39')]['toLowerCase']();this[_0xba14('0xb')][_0xb7dbcd[_0xba14('0x3a')]][_0xba14('0x3c')]=_0xb7dbcd[_0xba14('0x3c')];this[_0xba14('0x1f')](util[_0xba14('0x25')](_0xba14('0x26'),this[_0xba14('0xb')][_0xb7dbcd[_0xba14('0x3a')]][_0xba14('0x27')]),_0xba14('0x3e'),this['trunks'][_0xb7dbcd[_0xba14('0x3a')]]);}else{}}}catch(_0x270fbe){logger[_0xba14('0x1b')](_0xba14('0x3f'),util[_0xba14('0x1c')](_0x270fbe,{'showHidden':![],'depth':null}));}};module[_0xba14('0x40')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index f59d990..6a5ea9d 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 _0x60f1=['prototype','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','interface','isNil','assign','user:save','destchannel','calleridname','destcalleridnum','destcalleridname','destaccountcode','channel','uniqueid','context','priority','inbound','membername','agent','called','emit','custom:agentcalled','user:%s','CALLED','ringtime','agentcalledAt','custom:agentconnect','user:agentconnect','CONNECT','stack','syncMusicOnHoldStart','find','onhold','error','syncMusicOnHoldStop','updateStatusRealtime','rejected','agentringnoanswerAt','custom:agentringnoanswer','RINGNOANSWER','holdtime','originalposition','abandoned','syncAgentComplete','talktime','reason','acw','acwTimeout','agentcompleteAt','agentconnectAt','COMPLETE','clear','cause','destuniqueid','custom:agentansweredelsewhere','custom:agentcomplete','user:agentcomplete','HANGUP','custom:voiceAgentReport','syncHangup','recalculate','origtransfererchannel','ATTENDED','secondtransfereruniqueid','secondtransfererexten','transfer','complete','transfertargetchannel','syncBlindTransfer','transfererchannel','transfereeuniqueid','extension','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberinterface','memberpenalty','memberrealtime','keys','variable','includes','value','exports','lodash','util','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','voiceQueues','agents','channels','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','varset','syncAttendedTransfer','musiconholdstart','log','format','%s|%s','queue','exten','calleridnum','join'];(function(_0xd134a3,_0x5eff37){var _0x44f12f=function(_0x136719){while(--_0x136719){_0xd134a3['push'](_0xd134a3['shift']());}};_0x44f12f(++_0x5eff37);}(_0x60f1,0x1dc));var _0x160f=function(_0x358806,_0x322b66){_0x358806=_0x358806-0x0;var _0x19fdcb=_0x60f1[_0x358806];return _0x19fdcb;};'use strict';var _=require(_0x160f('0x0'));var moment=require('moment');var util=require(_0x160f('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x160f('0x2'))(_0x160f('0x3'));var ami=require(_0x160f('0x4'));config['redis']=_['defaults'](config[_0x160f('0x5')],{'host':_0x160f('0x6'),'port':0x18eb});var io=require(_0x160f('0x7'))(new Redis(config[_0x160f('0x5')]));function VoiceAgentReport(_0x412060){this[_0x160f('0x8')]=_0x412060[_0x160f('0x8')];this['agents']=_0x412060[_0x160f('0x9')];this[_0x160f('0xa')]={};this[_0x160f('0xb')]={};ami['on'](_0x160f('0xc'),this[_0x160f('0xd')][_0x160f('0xe')](this));ami['on'](_0x160f('0xf'),this[_0x160f('0x10')]['bind'](this));ami['on'](_0x160f('0x11'),this[_0x160f('0x12')][_0x160f('0xe')](this));ami['on'](_0x160f('0x13'),this[_0x160f('0x14')][_0x160f('0xe')](this));ami['on'](_0x160f('0x15'),this['syncAgentComplete'][_0x160f('0xe')](this));ami['on'](_0x160f('0x16'),this['syncVarSet']['bind'](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on']('attendedtransfer',this[_0x160f('0x17')][_0x160f('0xe')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x160f('0xe')](this));ami['on'](_0x160f('0x18'),this['syncMusicOnHoldStart'][_0x160f('0xe')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0x160f('0xe')](this));}VoiceAgentReport['prototype'][_0x160f('0x19')]=function(_0xed90c4,_0x416163){logger['info'](util[_0x160f('0x1a')](_0x160f('0x1b'),_0xed90c4,[_0x416163['uniqueid'],_0x416163['membername'],_0x416163[_0x160f('0x1c')],_0x416163[_0x160f('0x1d')],_0x416163[_0x160f('0x1e')]][_0x160f('0x1f')]('|')));};VoiceAgentReport[_0x160f('0x20')][_0x160f('0x21')]=function(_0x39a9d6,_0x23666a){return moment(_0x39a9d6)[_0x160f('0x22')](_0x23666a,_0x160f('0x23'))[_0x160f('0x1a')](_0x160f('0x24'));};VoiceAgentReport[_0x160f('0x20')][_0x160f('0x25')]=function(_0x2b2fd2,_0x2d024f){return moment(_0x2b2fd2)[_0x160f('0x26')](moment(_0x2d024f),'seconds');};VoiceAgentReport[_0x160f('0x20')][_0x160f('0xd')]=function(_0x1f9961){try{var _0x203564=this[_0x160f('0x9')][_0x1f9961[_0x160f('0x27')]];if(!_[_0x160f('0x28')](_0x203564)){_0x203564=_[_0x160f('0x29')](_0x203564,{'queue':_0x1f9961[_0x160f('0x1c')],'destconnectedlinenum':_0x1f9961['calleridnum']});io['emit'](_0x160f('0x2a'),_0x203564);}var _0x50a710=this[_0x160f('0xa')][_0x1f9961[_0x160f('0x2b')]]={'agentcalledAt':moment()[_0x160f('0x1a')](_0x160f('0x24')),'calleridnum':_0x1f9961['calleridnum'],'calleridname':_0x1f9961[_0x160f('0x2c')],'connectedlinenum':_0x1f9961[_0x160f('0x2d')],'connectedlinename':_0x1f9961[_0x160f('0x2e')],'accountcode':_0x1f9961['accountcode'],'destaccountcode':_0x1f9961[_0x160f('0x2f')],'channel':_0x1f9961[_0x160f('0x30')],'destchannel':_0x1f9961[_0x160f('0x2b')],'uniqueid':_0x1f9961[_0x160f('0x31')],'destuniqueid':_0x1f9961['destuniqueid'],'context':_0x1f9961[_0x160f('0x32')],'exten':_0x1f9961[_0x160f('0x1d')],'priority':_0x1f9961[_0x160f('0x33')],'queue':_0x1f9961[_0x160f('0x1c')],'type':this[_0x160f('0x8')][_0x1f9961[_0x160f('0x1c')]]?this['voiceQueues'][_0x1f9961[_0x160f('0x1c')]]['type']||'inbound':_0x160f('0x34'),'interface':_0x1f9961['interface'],'membername':_0x1f9961[_0x160f('0x35')],'agentconnect':![],'agentconnectAt':null,'holdtime':0x0,'ringtime':0x0,'agentcomplete':![],'agentcompleteAt':null,'talktime':0x0,'agentringnoanswer':![],'agentringnoanswerAt':null,'reason':_0x160f('0x36'),'transfer':![],'transferAt':null,'transfertype':null,'transferuniqueid':null,'transfercontext':null,'transferextension':null,'position':null,'originalposition':null,'cause':'','cause-txt':'','UserId':this['agents'][_0x1f9961[_0x160f('0x27')]]?this[_0x160f('0x9')][_0x1f9961[_0x160f('0x27')]]['id']:null,'lastevent':_0x160f('0x37'),'agentacw':![],'acwtime':0x0,'variables':this[_0x160f('0xb')][_0x1f9961['channel']]?this['variables'][_0x1f9961[_0x160f('0x30')]]:{}};ami[_0x160f('0x38')](_0x160f('0x39'),_0x50a710);io['to'](util['format'](_0x160f('0x3a'),_0x50a710['membername']))[_0x160f('0x38')]('user:called',_0x50a710);this[_0x160f('0x19')](_0x160f('0x3b'),this['channels'][_0x1f9961[_0x160f('0x2b')]]);}catch(_0x1461ab){logger['error'](_0x1461ab['stack']);}};VoiceAgentReport[_0x160f('0x20')][_0x160f('0x10')]=function(_0x4a841e){try{var _0x3a62e2=this['channels'][_0x4a841e[_0x160f('0x2b')]];if(!_[_0x160f('0x28')](_0x3a62e2)){_0x3a62e2=_[_0x160f('0x29')](_0x3a62e2,{'holdtime':parseInt(_0x4a841e['holdtime'],0xa),'ringtime':parseInt(_0x4a841e[_0x160f('0x3c')],0xa),'agentconnect':!![],'lastevent':'connect'});_0x3a62e2['agentconnectAt']=this[_0x160f('0x21')](_0x3a62e2[_0x160f('0x3d')],_0x3a62e2[_0x160f('0x3c')]);ami[_0x160f('0x38')](_0x160f('0x3e'),_0x3a62e2);io['to'](util['format'](_0x160f('0x3a'),_0x3a62e2[_0x160f('0x35')]))[_0x160f('0x38')](_0x160f('0x3f'),_0x3a62e2);this[_0x160f('0x19')](_0x160f('0x40'),_0x3a62e2);}}catch(_0x3cfb4d){logger['error'](_0x3cfb4d[_0x160f('0x41')]);}};VoiceAgentReport[_0x160f('0x20')][_0x160f('0x42')]=function(_0x10c451){try{var _0x4feaaa=_[_0x160f('0x43')](this['channels'],{'channel':_0x10c451[_0x160f('0x30')],'agentconnect':!![]});if(!_[_0x160f('0x28')](_0x4feaaa)){if(!_['isNil'](this[_0x160f('0x9')][_0x4feaaa[_0x160f('0x27')]])){this[_0x160f('0x9')][_0x4feaaa[_0x160f('0x27')]][_0x160f('0x44')]=!![];this[_0x160f('0x9')][_0x4feaaa['interface']]['updateStatusRealtime']();}}}catch(_0x1fa3e8){logger[_0x160f('0x45')](_0x1fa3e8['stack']);}};VoiceAgentReport[_0x160f('0x20')][_0x160f('0x46')]=function(_0x5e6e61){try{var _0x25bbf3=_[_0x160f('0x43')](this[_0x160f('0xa')],{'channel':_0x5e6e61[_0x160f('0x30')],'agentconnect':!![]});if(!_[_0x160f('0x28')](_0x25bbf3)){if(!_['isNil'](this['agents'][_0x25bbf3[_0x160f('0x27')]])){this[_0x160f('0x9')][_0x25bbf3['interface']][_0x160f('0x44')]=![];this[_0x160f('0x9')][_0x25bbf3['interface']][_0x160f('0x47')]();}}}catch(_0x37220a){logger['error'](_0x37220a['stack']);}};VoiceAgentReport[_0x160f('0x20')][_0x160f('0x12')]=function(_0x2be949){try{var _0x2c2e0e=this[_0x160f('0xa')][_0x2be949[_0x160f('0x2b')]];if(!_[_0x160f('0x28')](_0x2c2e0e)){_0x2c2e0e=_[_0x160f('0x29')](_0x2c2e0e,{'ringtime':parseInt(_0x2be949[_0x160f('0x3c')],0xa)/0x3e8,'agentringnoanswer':!![],'reason':_0x160f('0x48'),'lastevent':'rejected'});_0x2c2e0e[_0x160f('0x49')]=this['addTime'](_0x2c2e0e[_0x160f('0x3d')],_0x2c2e0e[_0x160f('0x3c')]);ami['emit'](_0x160f('0x4a'),_0x2c2e0e);this[_0x160f('0x19')](_0x160f('0x4b'),_0x2c2e0e);}}catch(_0x3bde70){logger[_0x160f('0x45')](_0x3bde70[_0x160f('0x41')]);}};VoiceAgentReport[_0x160f('0x20')][_0x160f('0x14')]=function(_0x25bfe9){try{for(var _0x3af408 in this[_0x160f('0xa')]){var _0x2fac6b=this[_0x160f('0xa')][_0x3af408];if(!_[_0x160f('0x28')](_0x2fac6b)&&_0x2fac6b[_0x160f('0x30')]==_0x25bfe9[_0x160f('0x30')]){_0x2fac6b=_[_0x160f('0x29')](_0x2fac6b,{'holdtime':parseInt(_0x25bfe9[_0x160f('0x4c')],0xa),'position':parseInt(_0x25bfe9['position'],0xa),'originalposition':parseInt(_0x25bfe9[_0x160f('0x4d')],0xa),'agentringnoanswer':!![],'agentringnoanswerAt':moment()[_0x160f('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x160f('0x4e'),'lastevent':_0x160f('0x4e')});ami['emit']('custom:agentqueuecallerabandon',_0x2fac6b);this['log']('CALLERABANDON',_0x2fac6b);}}}catch(_0x4ae3b9){logger[_0x160f('0x45')](_0x4ae3b9[_0x160f('0x41')]);}};VoiceAgentReport['prototype'][_0x160f('0x4f')]=function(_0x32c3da){try{var _0x26e62b=this[_0x160f('0xa')][_0x32c3da[_0x160f('0x2b')]];if(!_[_0x160f('0x28')](_0x26e62b)){_0x26e62b=_[_0x160f('0x29')](_0x26e62b,{'talktime':parseInt(_0x32c3da[_0x160f('0x50')],0xa),'reason':_0x32c3da['reason']=='transfer'?_0x160f('0x36'):_0x32c3da[_0x160f('0x51')],'agentcomplete':!![],'lastevent':'complete','agentacw':this['voiceQueues'][_0x26e62b[_0x160f('0x1c')]]&&this[_0x160f('0x8')][_0x26e62b[_0x160f('0x1c')]][_0x160f('0x52')]?!![]:![],'acwtime':this[_0x160f('0x8')][_0x26e62b[_0x160f('0x1c')]]&&this[_0x160f('0x8')][_0x26e62b[_0x160f('0x1c')]][_0x160f('0x52')]?this['voiceQueues'][_0x26e62b[_0x160f('0x1c')]][_0x160f('0x53')]:0x0});_0x26e62b[_0x160f('0x54')]=this['addTime'](_0x26e62b[_0x160f('0x55')],_0x26e62b['talktime']);this[_0x160f('0x19')](_0x160f('0x56'),_0x26e62b);}}catch(_0x2b0801){logger[_0x160f('0x45')](_0x2b0801[_0x160f('0x41')]);}};VoiceAgentReport[_0x160f('0x20')][_0x160f('0x57')]=function(_0x5e7f7b){try{switch(_0x5e7f7b[_0x160f('0x58')]){case 0x1a:_0x5e7f7b=_[_0x160f('0x29')](_0x5e7f7b,{'agentringnoanswer':!![],'reason':'answered_elsewhere','lastevent':'answered_elsewhere'});var _0x476725=_[_0x160f('0x43')](this[_0x160f('0xa')],{'channel':_0x5e7f7b[_0x160f('0x30')],'agentconnect':!![]});if(!_[_0x160f('0x28')](_0x476725)){_0x5e7f7b=_['assign'](_0x5e7f7b,{'agentringnoanswerAt':_0x476725['agentconnectAt'],'answeredelsewheremembername':_0x476725[_0x160f('0x35')],'answeredelsewheredestinationuniqueid':_0x476725[_0x160f('0x59')]});}ami[_0x160f('0x38')](_0x160f('0x5a'),_0x5e7f7b);break;}if(_0x5e7f7b[_0x160f('0x15')]){ami[_0x160f('0x38')](_0x160f('0x5b'),_0x5e7f7b);io['to'](util[_0x160f('0x1a')](_0x160f('0x3a'),_0x5e7f7b[_0x160f('0x35')]))[_0x160f('0x38')](_0x160f('0x5c'),_0x5e7f7b);}this['log'](_0x160f('0x5d'),_0x5e7f7b);ami[_0x160f('0x38')](_0x160f('0x5e'),_0x5e7f7b);if(this[_0x160f('0xa')][_0x5e7f7b['destchannel']]){delete this[_0x160f('0xa')][_0x5e7f7b['destchannel']];}}catch(_0x43f23e){logger[_0x160f('0x45')](_0x43f23e);}};VoiceAgentReport['prototype'][_0x160f('0x5f')]=function(_0x38039d){try{var _0x36b549=this[_0x160f('0xa')][_0x38039d[_0x160f('0x30')]];if(!_[_0x160f('0x28')](_0x36b549)){_0x36b549=_[_0x160f('0x29')](_0x36b549,{'cause':parseInt(_0x38039d[_0x160f('0x58')],0xa),'cause-txt':_0x38039d['cause-txt']});if(_0x36b549[_0x160f('0x60')]){_0x36b549=_[_0x160f('0x29')](_0x36b549,{'agentcomplete':!![],'agentcompleteAt':moment()[_0x160f('0x1a')](_0x160f('0x24')),'lastevent':'complete','agentacw':this[_0x160f('0x8')][_0x36b549[_0x160f('0x1c')]]&&this['voiceQueues'][_0x36b549[_0x160f('0x1c')]][_0x160f('0x52')]?!![]:![],'acwtime':this[_0x160f('0x8')][_0x36b549[_0x160f('0x1c')]]&&this[_0x160f('0x8')][_0x36b549[_0x160f('0x1c')]][_0x160f('0x52')]?this[_0x160f('0x8')][_0x36b549[_0x160f('0x1c')]]['acwTimeout']:0x0});_0x36b549[_0x160f('0x50')]=this['diffTime'](_0x36b549['agentcompleteAt'],_0x36b549[_0x160f('0x55')]);}var _0x306f87=this['agents'][_0x36b549[_0x160f('0x27')]];if(!_[_0x160f('0x28')](_0x306f87)){_0x306f87=_[_0x160f('0x29')](_0x306f87,{'queue':null,'destconnectedlinenum':null});io[_0x160f('0x38')](_0x160f('0x2a'),_0x306f87);}setTimeout(this[_0x160f('0x57')][_0x160f('0xe')](this,_0x36b549),0x3e8);}if(this['variables'][_0x38039d[_0x160f('0x30')]]){delete this[_0x160f('0xb')][_0x38039d[_0x160f('0x30')]];}}catch(_0x3c0fbd){logger[_0x160f('0x45')](_0x3c0fbd[_0x160f('0x41')]);}};VoiceAgentReport[_0x160f('0x20')]['syncAttendedTransfer']=function(_0x4b5b37){try{var _0xaa32c=this['channels'][_0x4b5b37[_0x160f('0x61')]];if(!_[_0x160f('0x28')](_0xaa32c)){_0xaa32c=_[_0x160f('0x29')](_0xaa32c,{'transfer':!![],'transferAt':moment()[_0x160f('0x1a')](_0x160f('0x24')),'transfertype':_0x160f('0x62'),'agentcomplete':!![],'agentcompleteAt':moment()['format'](_0x160f('0x24')),'transferuniqueid':_0x4b5b37[_0x160f('0x63')],'transfercontext':_0x4b5b37[_0x160f('0x64')],'transferextension':_0x4b5b37['secondtransferercontext'],'reason':_0x160f('0x65'),'lastevent':_0x160f('0x66'),'agentacw':this['voiceQueues'][_0xaa32c[_0x160f('0x1c')]]&&this[_0x160f('0x8')][_0xaa32c['queue']][_0x160f('0x52')]?!![]:![],'acwtime':this[_0x160f('0x8')][_0xaa32c['queue']]&&this[_0x160f('0x8')][_0xaa32c['queue']][_0x160f('0x52')]?this[_0x160f('0x8')][_0xaa32c[_0x160f('0x1c')]][_0x160f('0x53')]:0x0});_0xaa32c[_0x160f('0x50')]=this[_0x160f('0x25')](_0xaa32c[_0x160f('0x54')],_0xaa32c[_0x160f('0x55')]);this[_0x160f('0x19')]('ATTENDED',_0xaa32c);}if(!_[_0x160f('0x28')](this[_0x160f('0xa')][_0x4b5b37[_0x160f('0x67')]])){this[_0x160f('0xa')][_0x4b5b37[_0x160f('0x67')]][_0x160f('0x60')]=!![];}}catch(_0x265e80){logger[_0x160f('0x45')](_0x265e80[_0x160f('0x41')]);}};VoiceAgentReport[_0x160f('0x20')][_0x160f('0x68')]=function(_0x403a9e){try{var _0x235928=this[_0x160f('0xa')][_0x403a9e[_0x160f('0x69')]];if(!_['isNil'](_0x235928)){_0x235928=_[_0x160f('0x29')](_0x235928,{'transfer':!![],'transferAt':moment()[_0x160f('0x1a')](_0x160f('0x24')),'transfertype':'BLIND','transferuniqueid':_0x403a9e[_0x160f('0x6a')],'transfercontext':_0x403a9e[_0x160f('0x32')],'transferextension':_0x403a9e[_0x160f('0x6b')],'agentcomplete':!![],'agentcompleteAt':moment()[_0x160f('0x1a')](_0x160f('0x24')),'reason':_0x160f('0x65'),'lastevent':_0x160f('0x66'),'agentacw':this[_0x160f('0x8')][_0x235928[_0x160f('0x1c')]]&&this[_0x160f('0x8')][_0x235928[_0x160f('0x1c')]][_0x160f('0x52')]?!![]:![],'acwtime':this['voiceQueues'][_0x235928[_0x160f('0x1c')]]&&this[_0x160f('0x8')][_0x235928[_0x160f('0x1c')]][_0x160f('0x52')]?this[_0x160f('0x8')][_0x235928['queue']][_0x160f('0x53')]:0x0});_0x235928[_0x160f('0x60')]=!![];this['log']('BLIND',_0x235928);}}catch(_0x3c620f){logger[_0x160f('0x45')](_0x3c620f['stack']);}};VoiceAgentReport[_0x160f('0x20')]['syncVarSet']=function(_0x24b390){var _0x1ae9bb=[_0x160f('0x6c'),_0x160f('0x6d'),_0x160f('0x6e'),_0x160f('0x6f'),'rtpaudioqosloss',_0x160f('0x70'),_0x160f('0x71'),_0x160f('0x72'),_0x160f('0x73'),_0x160f('0x74'),_0x160f('0x75'),'bridgepvtcallid',_0x160f('0x76'),'memberdynamic',_0x160f('0x77'),'memberlastcall',_0x160f('0x35'),_0x160f('0x78'),_0x160f('0x79')];try{var _0x1aff86=_[_0x160f('0x7a')](_0x24b390[_0x160f('0x7b')])[0x0];if(!_[_0x160f('0x28')](_0x1aff86)&&!_[_0x160f('0x7c')](_0x1ae9bb,_0x1aff86)){if(!this[_0x160f('0xb')][_0x24b390['channel']]){this[_0x160f('0xb')][_0x24b390['channel']]={};}this['variables'][_0x24b390[_0x160f('0x30')]][_0x1aff86]=_0x24b390[_0x160f('0x7d')];}}catch(_0x1e9db7){logger[_0x160f('0x45')](_0x1e9db7[_0x160f('0x41')]);}};module[_0x160f('0x7e')]=VoiceAgentReport; \ No newline at end of file +var _0x9cb0=['transfertargetchannel','recalculate','transfererchannel','BLIND','transfereeuniqueid','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','keys','value','exports','lodash','util','../../../config/environment','../ami','redis','defaults','localhost','socket.io-emitter','voiceQueues','agents','channels','variables','agentcalled','agentconnect','bind','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','syncVarSet','hangup','syncHangup','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStop','prototype','log','info','membername','join','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','syncAgentCalled','interface','isNil','assign','calleridnum','emit','user:save','destchannel','calleridname','destcalleridnum','destcalleridname','accountcode','destaccountcode','uniqueid','context','exten','priority','queue','type','inbound','agent','channel','custom:agentcalled','user:%s','user:called','error','stack','holdtime','ringtime','connect','agentconnectAt','agentcalledAt','custom:agentconnect','user:agentconnect','CONNECT','syncMusicOnHoldStart','updateStatusRealtime','find','onhold','rejected','agentringnoanswerAt','custom:agentringnoanswer','RINGNOANSWER','position','originalposition','abandoned','custom:agentqueuecallerabandon','reason','transfer','complete','acw','acwTimeout','agentcompleteAt','talktime','COMPLETE','clear','answered_elsewhere','custom:agentansweredelsewhere','custom:agentcomplete','HANGUP','custom:voiceAgentReport','cause','cause-txt','origtransfererchannel','ATTENDED','secondtransfereruniqueid','secondtransfererexten'];(function(_0x13ff11,_0x33281a){var _0x3ef4b2=function(_0x3551b4){while(--_0x3551b4){_0x13ff11['push'](_0x13ff11['shift']());}};_0x3ef4b2(++_0x33281a);}(_0x9cb0,0x97));var _0x09cb=function(_0x29631f,_0xdb767){_0x29631f=_0x29631f-0x0;var _0x486d87=_0x9cb0[_0x29631f];return _0x486d87;};'use strict';var _=require(_0x09cb('0x0'));var moment=require('moment');var util=require(_0x09cb('0x1'));var Redis=require('ioredis');var config=require(_0x09cb('0x2'));var logger=require('../../../config/logger')('ami');var ami=require(_0x09cb('0x3'));config[_0x09cb('0x4')]=_[_0x09cb('0x5')](config[_0x09cb('0x4')],{'host':_0x09cb('0x6'),'port':0x18eb});var io=require(_0x09cb('0x7'))(new Redis(config[_0x09cb('0x4')]));function VoiceAgentReport(_0x42c41e){this[_0x09cb('0x8')]=_0x42c41e['voiceQueues'];this[_0x09cb('0x9')]=_0x42c41e[_0x09cb('0x9')];this[_0x09cb('0xa')]={};this[_0x09cb('0xb')]={};ami['on'](_0x09cb('0xc'),this['syncAgentCalled']['bind'](this));ami['on'](_0x09cb('0xd'),this['syncAgentConnect'][_0x09cb('0xe')](this));ami['on']('agentringnoanswer',this[_0x09cb('0xf')][_0x09cb('0xe')](this));ami['on'](_0x09cb('0x10'),this[_0x09cb('0x11')][_0x09cb('0xe')](this));ami['on'](_0x09cb('0x12'),this[_0x09cb('0x13')][_0x09cb('0xe')](this));ami['on']('varset',this[_0x09cb('0x14')][_0x09cb('0xe')](this));ami['on'](_0x09cb('0x15'),this[_0x09cb('0x16')][_0x09cb('0xe')](this));ami['on'](_0x09cb('0x17'),this[_0x09cb('0x18')][_0x09cb('0xe')](this));ami['on']('blindtransfer',this[_0x09cb('0x19')][_0x09cb('0xe')](this));ami['on'](_0x09cb('0x1a'),this['syncMusicOnHoldStart'][_0x09cb('0xe')](this));ami['on']('musiconholdstop',this[_0x09cb('0x1b')][_0x09cb('0xe')](this));}VoiceAgentReport[_0x09cb('0x1c')][_0x09cb('0x1d')]=function(_0x357d06,_0x27d016){logger[_0x09cb('0x1e')](util['format']('%s|%s',_0x357d06,[_0x27d016['uniqueid'],_0x27d016[_0x09cb('0x1f')],_0x27d016['queue'],_0x27d016['exten'],_0x27d016['calleridnum']][_0x09cb('0x20')]('|')));};VoiceAgentReport['prototype'][_0x09cb('0x21')]=function(_0x5a149e,_0x1c1b55){return moment(_0x5a149e)[_0x09cb('0x22')](_0x1c1b55,_0x09cb('0x23'))[_0x09cb('0x24')](_0x09cb('0x25'));};VoiceAgentReport['prototype'][_0x09cb('0x26')]=function(_0x43bb3d,_0x5e2576){return moment(_0x43bb3d)[_0x09cb('0x27')](moment(_0x5e2576),_0x09cb('0x23'));};VoiceAgentReport[_0x09cb('0x1c')][_0x09cb('0x28')]=function(_0x314c13){try{var _0xe0874e=this[_0x09cb('0x9')][_0x314c13[_0x09cb('0x29')]];if(!_[_0x09cb('0x2a')](_0xe0874e)){_0xe0874e=_[_0x09cb('0x2b')](_0xe0874e,{'queue':_0x314c13['queue'],'destconnectedlinenum':_0x314c13[_0x09cb('0x2c')]});io[_0x09cb('0x2d')](_0x09cb('0x2e'),_0xe0874e);}var _0x5b94a5=this['channels'][_0x314c13[_0x09cb('0x2f')]]={'agentcalledAt':moment()['format'](_0x09cb('0x25')),'calleridnum':_0x314c13[_0x09cb('0x2c')],'calleridname':_0x314c13[_0x09cb('0x30')],'connectedlinenum':_0x314c13[_0x09cb('0x31')],'connectedlinename':_0x314c13[_0x09cb('0x32')],'accountcode':_0x314c13[_0x09cb('0x33')],'destaccountcode':_0x314c13[_0x09cb('0x34')],'channel':_0x314c13['channel'],'destchannel':_0x314c13[_0x09cb('0x2f')],'uniqueid':_0x314c13[_0x09cb('0x35')],'destuniqueid':_0x314c13['destuniqueid'],'context':_0x314c13[_0x09cb('0x36')],'exten':_0x314c13[_0x09cb('0x37')],'priority':_0x314c13[_0x09cb('0x38')],'queue':_0x314c13[_0x09cb('0x39')],'type':this[_0x09cb('0x8')][_0x314c13[_0x09cb('0x39')]]?this[_0x09cb('0x8')][_0x314c13[_0x09cb('0x39')]][_0x09cb('0x3a')]||_0x09cb('0x3b'):'inbound','interface':_0x314c13[_0x09cb('0x29')],'membername':_0x314c13['membername'],'agentconnect':![],'agentconnectAt':null,'holdtime':0x0,'ringtime':0x0,'agentcomplete':![],'agentcompleteAt':null,'talktime':0x0,'agentringnoanswer':![],'agentringnoanswerAt':null,'reason':_0x09cb('0x3c'),'transfer':![],'transferAt':null,'transfertype':null,'transferuniqueid':null,'transfercontext':null,'transferextension':null,'position':null,'originalposition':null,'cause':'','cause-txt':'','UserId':this[_0x09cb('0x9')][_0x314c13['interface']]?this[_0x09cb('0x9')][_0x314c13['interface']]['id']:null,'lastevent':'called','agentacw':![],'acwtime':0x0,'variables':this[_0x09cb('0xb')][_0x314c13[_0x09cb('0x3d')]]?this[_0x09cb('0xb')][_0x314c13[_0x09cb('0x3d')]]:{}};ami['emit'](_0x09cb('0x3e'),_0x5b94a5);io['to'](util[_0x09cb('0x24')](_0x09cb('0x3f'),_0x5b94a5[_0x09cb('0x1f')]))[_0x09cb('0x2d')](_0x09cb('0x40'),_0x5b94a5);this[_0x09cb('0x1d')]('CALLED',this[_0x09cb('0xa')][_0x314c13[_0x09cb('0x2f')]]);}catch(_0x4af14a){logger[_0x09cb('0x41')](_0x4af14a[_0x09cb('0x42')]);}};VoiceAgentReport[_0x09cb('0x1c')]['syncAgentConnect']=function(_0x2bfb24){try{var _0x161d68=this[_0x09cb('0xa')][_0x2bfb24[_0x09cb('0x2f')]];if(!_['isNil'](_0x161d68)){_0x161d68=_['assign'](_0x161d68,{'holdtime':parseInt(_0x2bfb24[_0x09cb('0x43')],0xa),'ringtime':parseInt(_0x2bfb24[_0x09cb('0x44')],0xa),'agentconnect':!![],'lastevent':_0x09cb('0x45')});_0x161d68[_0x09cb('0x46')]=this[_0x09cb('0x21')](_0x161d68[_0x09cb('0x47')],_0x161d68['ringtime']);ami['emit'](_0x09cb('0x48'),_0x161d68);io['to'](util[_0x09cb('0x24')]('user:%s',_0x161d68[_0x09cb('0x1f')]))[_0x09cb('0x2d')](_0x09cb('0x49'),_0x161d68);this[_0x09cb('0x1d')](_0x09cb('0x4a'),_0x161d68);}}catch(_0x107b50){logger['error'](_0x107b50[_0x09cb('0x42')]);}};VoiceAgentReport[_0x09cb('0x1c')][_0x09cb('0x4b')]=function(_0x391ca0){try{var _0x34af78=_['find'](this[_0x09cb('0xa')],{'channel':_0x391ca0['channel'],'agentconnect':!![]});if(!_[_0x09cb('0x2a')](_0x34af78)){if(!_['isNil'](this[_0x09cb('0x9')][_0x34af78[_0x09cb('0x29')]])){this[_0x09cb('0x9')][_0x34af78[_0x09cb('0x29')]]['onhold']=!![];this[_0x09cb('0x9')][_0x34af78[_0x09cb('0x29')]][_0x09cb('0x4c')]();}}}catch(_0xa6cb8c){logger[_0x09cb('0x41')](_0xa6cb8c[_0x09cb('0x42')]);}};VoiceAgentReport[_0x09cb('0x1c')][_0x09cb('0x1b')]=function(_0x55b2d7){try{var _0x2225f5=_[_0x09cb('0x4d')](this[_0x09cb('0xa')],{'channel':_0x55b2d7[_0x09cb('0x3d')],'agentconnect':!![]});if(!_[_0x09cb('0x2a')](_0x2225f5)){if(!_[_0x09cb('0x2a')](this[_0x09cb('0x9')][_0x2225f5['interface']])){this[_0x09cb('0x9')][_0x2225f5['interface']][_0x09cb('0x4e')]=![];this[_0x09cb('0x9')][_0x2225f5['interface']][_0x09cb('0x4c')]();}}}catch(_0x495dcf){logger[_0x09cb('0x41')](_0x495dcf[_0x09cb('0x42')]);}};VoiceAgentReport['prototype'][_0x09cb('0xf')]=function(_0x40ab37){try{var _0x300d25=this['channels'][_0x40ab37[_0x09cb('0x2f')]];if(!_['isNil'](_0x300d25)){_0x300d25=_[_0x09cb('0x2b')](_0x300d25,{'ringtime':parseInt(_0x40ab37[_0x09cb('0x44')],0xa)/0x3e8,'agentringnoanswer':!![],'reason':'rejected','lastevent':_0x09cb('0x4f')});_0x300d25[_0x09cb('0x50')]=this[_0x09cb('0x21')](_0x300d25[_0x09cb('0x47')],_0x300d25['ringtime']);ami['emit'](_0x09cb('0x51'),_0x300d25);this['log'](_0x09cb('0x52'),_0x300d25);}}catch(_0x58e864){logger[_0x09cb('0x41')](_0x58e864[_0x09cb('0x42')]);}};VoiceAgentReport[_0x09cb('0x1c')][_0x09cb('0x11')]=function(_0x2ae379){try{for(var _0x184bb8 in this[_0x09cb('0xa')]){var _0x434a90=this[_0x09cb('0xa')][_0x184bb8];if(!_[_0x09cb('0x2a')](_0x434a90)&&_0x434a90[_0x09cb('0x3d')]==_0x2ae379[_0x09cb('0x3d')]){_0x434a90=_[_0x09cb('0x2b')](_0x434a90,{'holdtime':parseInt(_0x2ae379[_0x09cb('0x43')],0xa),'position':parseInt(_0x2ae379[_0x09cb('0x53')],0xa),'originalposition':parseInt(_0x2ae379[_0x09cb('0x54')],0xa),'agentringnoanswer':!![],'agentringnoanswerAt':moment()[_0x09cb('0x24')](_0x09cb('0x25')),'reason':_0x09cb('0x55'),'lastevent':'abandoned'});ami['emit'](_0x09cb('0x56'),_0x434a90);this[_0x09cb('0x1d')]('CALLERABANDON',_0x434a90);}}}catch(_0x387282){logger['error'](_0x387282[_0x09cb('0x42')]);}};VoiceAgentReport[_0x09cb('0x1c')][_0x09cb('0x13')]=function(_0x497630){try{var _0x59ef95=this[_0x09cb('0xa')][_0x497630['destchannel']];if(!_[_0x09cb('0x2a')](_0x59ef95)){_0x59ef95=_['assign'](_0x59ef95,{'talktime':parseInt(_0x497630['talktime'],0xa),'reason':_0x497630[_0x09cb('0x57')]==_0x09cb('0x58')?_0x09cb('0x3c'):_0x497630['reason'],'agentcomplete':!![],'lastevent':_0x09cb('0x59'),'agentacw':this[_0x09cb('0x8')][_0x59ef95['queue']]&&this[_0x09cb('0x8')][_0x59ef95['queue']][_0x09cb('0x5a')]?!![]:![],'acwtime':this[_0x09cb('0x8')][_0x59ef95[_0x09cb('0x39')]]&&this[_0x09cb('0x8')][_0x59ef95[_0x09cb('0x39')]][_0x09cb('0x5a')]?this[_0x09cb('0x8')][_0x59ef95[_0x09cb('0x39')]][_0x09cb('0x5b')]:0x0});_0x59ef95[_0x09cb('0x5c')]=this[_0x09cb('0x21')](_0x59ef95[_0x09cb('0x46')],_0x59ef95[_0x09cb('0x5d')]);this[_0x09cb('0x1d')](_0x09cb('0x5e'),_0x59ef95);}}catch(_0x25a1b2){logger[_0x09cb('0x41')](_0x25a1b2[_0x09cb('0x42')]);}};VoiceAgentReport[_0x09cb('0x1c')][_0x09cb('0x5f')]=function(_0x28640b){try{switch(_0x28640b['cause']){case 0x1a:_0x28640b=_[_0x09cb('0x2b')](_0x28640b,{'agentringnoanswer':!![],'reason':_0x09cb('0x60'),'lastevent':_0x09cb('0x60')});var _0x19a439=_[_0x09cb('0x4d')](this[_0x09cb('0xa')],{'channel':_0x28640b[_0x09cb('0x3d')],'agentconnect':!![]});if(!_[_0x09cb('0x2a')](_0x19a439)){_0x28640b=_[_0x09cb('0x2b')](_0x28640b,{'agentringnoanswerAt':_0x19a439[_0x09cb('0x46')],'answeredelsewheremembername':_0x19a439[_0x09cb('0x1f')],'answeredelsewheredestinationuniqueid':_0x19a439['destuniqueid']});}ami[_0x09cb('0x2d')](_0x09cb('0x61'),_0x28640b);break;}if(_0x28640b['agentcomplete']){ami['emit'](_0x09cb('0x62'),_0x28640b);io['to'](util[_0x09cb('0x24')](_0x09cb('0x3f'),_0x28640b[_0x09cb('0x1f')]))[_0x09cb('0x2d')]('user:agentcomplete',_0x28640b);}this[_0x09cb('0x1d')](_0x09cb('0x63'),_0x28640b);ami[_0x09cb('0x2d')](_0x09cb('0x64'),_0x28640b);if(this[_0x09cb('0xa')][_0x28640b['destchannel']]){delete this[_0x09cb('0xa')][_0x28640b[_0x09cb('0x2f')]];}}catch(_0x54fb1a){logger[_0x09cb('0x41')](_0x54fb1a);}};VoiceAgentReport[_0x09cb('0x1c')][_0x09cb('0x16')]=function(_0x19b143){try{var _0x1e80a8=this[_0x09cb('0xa')][_0x19b143['channel']];if(!_['isNil'](_0x1e80a8)){_0x1e80a8=_[_0x09cb('0x2b')](_0x1e80a8,{'cause':parseInt(_0x19b143[_0x09cb('0x65')],0xa),'cause-txt':_0x19b143[_0x09cb('0x66')]});if(_0x1e80a8['recalculate']){_0x1e80a8=_[_0x09cb('0x2b')](_0x1e80a8,{'agentcomplete':!![],'agentcompleteAt':moment()[_0x09cb('0x24')](_0x09cb('0x25')),'lastevent':_0x09cb('0x59'),'agentacw':this[_0x09cb('0x8')][_0x1e80a8[_0x09cb('0x39')]]&&this['voiceQueues'][_0x1e80a8['queue']][_0x09cb('0x5a')]?!![]:![],'acwtime':this[_0x09cb('0x8')][_0x1e80a8[_0x09cb('0x39')]]&&this[_0x09cb('0x8')][_0x1e80a8[_0x09cb('0x39')]][_0x09cb('0x5a')]?this['voiceQueues'][_0x1e80a8[_0x09cb('0x39')]]['acwTimeout']:0x0});_0x1e80a8[_0x09cb('0x5d')]=this[_0x09cb('0x26')](_0x1e80a8[_0x09cb('0x5c')],_0x1e80a8[_0x09cb('0x46')]);}var _0x54bfa1=this['agents'][_0x1e80a8[_0x09cb('0x29')]];if(!_[_0x09cb('0x2a')](_0x54bfa1)){_0x54bfa1=_[_0x09cb('0x2b')](_0x54bfa1,{'queue':null,'destconnectedlinenum':null});io[_0x09cb('0x2d')](_0x09cb('0x2e'),_0x54bfa1);}setTimeout(this['clear'][_0x09cb('0xe')](this,_0x1e80a8),0x3e8);}if(this[_0x09cb('0xb')][_0x19b143['channel']]){delete this[_0x09cb('0xb')][_0x19b143[_0x09cb('0x3d')]];}}catch(_0x124809){logger[_0x09cb('0x41')](_0x124809[_0x09cb('0x42')]);}};VoiceAgentReport[_0x09cb('0x1c')][_0x09cb('0x18')]=function(_0x461079){try{var _0x39ab6d=this[_0x09cb('0xa')][_0x461079[_0x09cb('0x67')]];if(!_[_0x09cb('0x2a')](_0x39ab6d)){_0x39ab6d=_[_0x09cb('0x2b')](_0x39ab6d,{'transfer':!![],'transferAt':moment()[_0x09cb('0x24')](_0x09cb('0x25')),'transfertype':_0x09cb('0x68'),'agentcomplete':!![],'agentcompleteAt':moment()[_0x09cb('0x24')]('YYYY-MM-DD\x20HH:mm:ss'),'transferuniqueid':_0x461079[_0x09cb('0x69')],'transfercontext':_0x461079[_0x09cb('0x6a')],'transferextension':_0x461079['secondtransferercontext'],'reason':_0x09cb('0x58'),'lastevent':'complete','agentacw':this[_0x09cb('0x8')][_0x39ab6d[_0x09cb('0x39')]]&&this[_0x09cb('0x8')][_0x39ab6d[_0x09cb('0x39')]][_0x09cb('0x5a')]?!![]:![],'acwtime':this[_0x09cb('0x8')][_0x39ab6d['queue']]&&this[_0x09cb('0x8')][_0x39ab6d['queue']][_0x09cb('0x5a')]?this[_0x09cb('0x8')][_0x39ab6d[_0x09cb('0x39')]]['acwTimeout']:0x0});_0x39ab6d['talktime']=this['diffTime'](_0x39ab6d[_0x09cb('0x5c')],_0x39ab6d[_0x09cb('0x46')]);this[_0x09cb('0x1d')](_0x09cb('0x68'),_0x39ab6d);}if(!_['isNil'](this[_0x09cb('0xa')][_0x461079[_0x09cb('0x6b')]])){this[_0x09cb('0xa')][_0x461079[_0x09cb('0x6b')]][_0x09cb('0x6c')]=!![];}}catch(_0x50b343){logger['error'](_0x50b343['stack']);}};VoiceAgentReport['prototype'][_0x09cb('0x19')]=function(_0x28812b){try{var _0x12a619=this[_0x09cb('0xa')][_0x28812b[_0x09cb('0x6d')]];if(!_[_0x09cb('0x2a')](_0x12a619)){_0x12a619=_['assign'](_0x12a619,{'transfer':!![],'transferAt':moment()[_0x09cb('0x24')](_0x09cb('0x25')),'transfertype':_0x09cb('0x6e'),'transferuniqueid':_0x28812b[_0x09cb('0x6f')],'transfercontext':_0x28812b[_0x09cb('0x36')],'transferextension':_0x28812b['extension'],'agentcomplete':!![],'agentcompleteAt':moment()[_0x09cb('0x24')](_0x09cb('0x25')),'reason':_0x09cb('0x58'),'lastevent':_0x09cb('0x59'),'agentacw':this[_0x09cb('0x8')][_0x12a619[_0x09cb('0x39')]]&&this['voiceQueues'][_0x12a619[_0x09cb('0x39')]][_0x09cb('0x5a')]?!![]:![],'acwtime':this[_0x09cb('0x8')][_0x12a619[_0x09cb('0x39')]]&&this[_0x09cb('0x8')][_0x12a619['queue']][_0x09cb('0x5a')]?this[_0x09cb('0x8')][_0x12a619[_0x09cb('0x39')]]['acwTimeout']:0x0});_0x12a619[_0x09cb('0x6c')]=!![];this[_0x09cb('0x1d')](_0x09cb('0x6e'),_0x12a619);}}catch(_0x47c3cf){logger['error'](_0x47c3cf[_0x09cb('0x42')]);}};VoiceAgentReport['prototype']['syncVarSet']=function(_0x77050b){var _0x20e60e=[_0x09cb('0x70'),_0x09cb('0x71'),'rtpaudioqosjitter','rtpaudioqosjitterbridged',_0x09cb('0x72'),'rtpaudioqoslossbridged',_0x09cb('0x73'),_0x09cb('0x74'),_0x09cb('0x75'),_0x09cb('0x76'),_0x09cb('0x77'),'bridgepvtcallid',_0x09cb('0x78'),_0x09cb('0x79'),_0x09cb('0x7a'),_0x09cb('0x7b'),_0x09cb('0x1f'),_0x09cb('0x7c'),_0x09cb('0x7d')];try{var _0x4bb43d=_[_0x09cb('0x7e')](_0x77050b['variable'])[0x0];if(!_[_0x09cb('0x2a')](_0x4bb43d)&&!_['includes'](_0x20e60e,_0x4bb43d)){if(!this[_0x09cb('0xb')][_0x77050b['channel']]){this[_0x09cb('0xb')][_0x77050b[_0x09cb('0x3d')]]={};}this[_0x09cb('0xb')][_0x77050b[_0x09cb('0x3d')]][_0x4bb43d]=_0x77050b[_0x09cb('0x7f')];}}catch(_0x5306cf){logger[_0x09cb('0x41')](_0x5306cf[_0x09cb('0x42')]);}};module[_0x09cb('0x80')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 0a2147a..def95c9 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 _0x3c1c=['xmd-callerid','callerid','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','destination','calleridpreview','xmcs-queue','sipcallid','sipcalluniqueid','mixmonitor_filename','sipcalllinkedid','endtime','billableseconds','omit','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','syncBlindTransfer','transfereecalleridnum','extension','BlindTransfer','[syncBlindTransfer][VoiceCallReport]','syncMusicOnHoldStart','answertime','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','mohtime','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','bluebird','lodash','moment','path','ioredis','../../../config/logger','../ami','../model/channel','not_inuse','inuse','invalid','unavailable','ringing','ringinuse','onhold','set','queue','agi','playback','voicemail','NO\x20ANSWER','ANSWERED','BUSY','FAILED','redis','defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','bind','newexten','syncNewExten','newchannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','musiconholdstop','syncMusicOnHoldStop','resolve','then','actionCoreShowChannels','catch','log','prototype','isUndefined','emit','syncNewCallerId','uniqueid','merge','pick','keys','error','[syncNewCallerId][VoiceCallReport]','inspect','syncNewChannel','isNotNull','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','context','from-sip','channel','split','destconnectedlinenum','exten','user:%s','name','accountcode','[syncNewChannel][VoiceCallReport]','linkedid','OutgoingSpoolFailed','application','applicationdata','toLowerCase','duration','subtract','seconds','includes','lastapplication','lastdata','cdr(','[syncNewExten][VoiceCallReport]','answered','holdtime','diff','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','calleridname','destinationchannel','UserId','membername','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','endsWith','.wav49','.WAV','find','monitors','isNil','rec','variable','value','xmd-phone'];(function(_0x1f5b90,_0x446ddd){var _0x26ce7c=function(_0x37ea54){while(--_0x37ea54){_0x1f5b90['push'](_0x1f5b90['shift']());}};_0x26ce7c(++_0x446ddd);}(_0x3c1c,0x162));var _0xc3c1=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x3c1c[_0x3947c9];return _0x2e7871;};'use strict';var BPromise=require(_0xc3c1('0x0'));var _=require(_0xc3c1('0x1'));var moment=require(_0xc3c1('0x2'));var util=require('util');var path=require(_0xc3c1('0x3'));var Redis=require(_0xc3c1('0x4'));var config=require('../../../config/environment');var logger=require(_0xc3c1('0x5'))('ami');var ami=require(_0xc3c1('0x6'));var Channel=require(_0xc3c1('0x7'));var statusDesc=['unknown',_0xc3c1('0x8'),_0xc3c1('0x9'),'busy',_0xc3c1('0xa'),_0xc3c1('0xb'),_0xc3c1('0xc'),_0xc3c1('0xd'),_0xc3c1('0xe')];var applications=[_0xc3c1('0xf'),_0xc3c1('0x10'),_0xc3c1('0x11'),'dial',_0xc3c1('0x12'),_0xc3c1('0x13')];var dispositions=[_0xc3c1('0x14'),'FAILED','FAILED',_0xc3c1('0x14'),_0xc3c1('0x14'),'NO\x20ANSWER',_0xc3c1('0x15'),_0xc3c1('0x16'),_0xc3c1('0x17'),_0xc3c1('0x17'),_0xc3c1('0x17')];var actions={};config[_0xc3c1('0x18')]=_[_0xc3c1('0x19')](config[_0xc3c1('0x18')],{'host':_0xc3c1('0x1a'),'port':0x18eb});var io=require(_0xc3c1('0x1b'))(new Redis(config[_0xc3c1('0x18')]));function VoiceCallReport(_0x18180f){this[_0xc3c1('0x1c')]=_0x18180f['channels'];this[_0xc3c1('0x1d')]=_0x18180f[_0xc3c1('0x1d')];ami['on'](_0xc3c1('0x1e'),this['syncNewExten'][_0xc3c1('0x1f')](this));ami['on'](_0xc3c1('0x20'),this[_0xc3c1('0x21')][_0xc3c1('0x1f')](this));ami['on'](_0xc3c1('0x22'),this['syncNewChannel']['bind'](this));ami['on'](_0xc3c1('0x23'),this[_0xc3c1('0x24')]['bind'](this));ami['on'](_0xc3c1('0x25'),this[_0xc3c1('0x26')]['bind'](this));ami['on'](_0xc3c1('0x27'),this[_0xc3c1('0x28')][_0xc3c1('0x1f')](this));ami['on'](_0xc3c1('0x29'),this['syncNewCallerId']['bind'](this));ami['on'](_0xc3c1('0x2a'),this[_0xc3c1('0x2b')][_0xc3c1('0x1f')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xc3c1('0x1f')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0xc3c1('0x1f')](this));ami['on'](_0xc3c1('0x2c'),this[_0xc3c1('0x2d')][_0xc3c1('0x1f')](this));return BPromise[_0xc3c1('0x2e')]()[_0xc3c1('0x2f')](ami[_0xc3c1('0x30')]())[_0xc3c1('0x31')](function(_0x6910aa){console[_0xc3c1('0x32')](_0x6910aa);});}VoiceCallReport[_0xc3c1('0x33')]['isNotNull']=function(_0x23f762){return _0x23f762!==null&&!_[_0xc3c1('0x34')](_0x23f762);};VoiceCallReport[_0xc3c1('0x33')][_0xc3c1('0x35')]=function(_0x71443b,_0x2650cc,_0x1b85ef){io['to'](_0x71443b)['emit'](_0x2650cc,_0x1b85ef);};VoiceCallReport[_0xc3c1('0x33')][_0xc3c1('0x36')]=function(_0x3cc10e){try{if(this['isNotNull'](_0x3cc10e)){if(_0x3cc10e[_0xc3c1('0x37')]===_0x3cc10e['linkedid']){if(!_['isUndefined'](this['channels'][_0x3cc10e[_0xc3c1('0x37')]])){_[_0xc3c1('0x38')](this[_0xc3c1('0x1c')][_0x3cc10e[_0xc3c1('0x37')]],_[_0xc3c1('0x39')](_0x3cc10e,_[_0xc3c1('0x3a')](this[_0xc3c1('0x1c')][_0x3cc10e[_0xc3c1('0x37')]])));}}}}catch(_0x5c545c){logger[_0xc3c1('0x3b')](_0xc3c1('0x3c'),util[_0xc3c1('0x3d')](_0x5c545c,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xc3c1('0x3e')]=function(_0x5028f9){try{if(this[_0xc3c1('0x3f')](_0x5028f9)){if(_0x5028f9[_0xc3c1('0x37')]===_0x5028f9['linkedid']&&_0x5028f9['channel']!='OutgoingSpoolFailed'){if(_['isUndefined'](this[_0xc3c1('0x1c')][_0x5028f9[_0xc3c1('0x37')]])){this[_0xc3c1('0x1c')][_0x5028f9[_0xc3c1('0x37')]]=new Channel();this['channels'][_0x5028f9[_0xc3c1('0x37')]][_0xc3c1('0x40')]=moment()[_0xc3c1('0x41')](_0xc3c1('0x42'));this['channels'][_0x5028f9[_0xc3c1('0x37')]][_0xc3c1('0x43')]=dispositions[_[_0xc3c1('0x44')](_0x5028f9[_0xc3c1('0x45')])];_[_0xc3c1('0x38')](this[_0xc3c1('0x1c')][_0x5028f9['uniqueid']],_[_0xc3c1('0x39')](_0x5028f9,_[_0xc3c1('0x3a')](this[_0xc3c1('0x1c')][_0x5028f9[_0xc3c1('0x37')]])));if(_0x5028f9[_0xc3c1('0x46')]===_0xc3c1('0x47')){if(this[_0xc3c1('0x1d')][_0x5028f9[_0xc3c1('0x48')][_0xc3c1('0x49')]('-')[0x0]]){this[_0xc3c1('0x1d')][_0x5028f9['channel'][_0xc3c1('0x49')]('-')[0x0]][_0xc3c1('0x4a')]=_0x5028f9[_0xc3c1('0x4b')];this['emit'](util['format'](_0xc3c1('0x4c'),this['agents'][_0x5028f9[_0xc3c1('0x48')][_0xc3c1('0x49')]('-')[0x0]][_0xc3c1('0x4d')]),'user:agentconnect',{'destaccountcode':this[_0xc3c1('0x1d')][_0x5028f9[_0xc3c1('0x48')][_0xc3c1('0x49')]('-')[0x0]][_0xc3c1('0x4e')],'destconnectedlinenum':_0x5028f9[_0xc3c1('0x4b')]});}}}}}}catch(_0x2953b4){logger[_0xc3c1('0x3b')](_0xc3c1('0x4f'),util['inspect'](_0x2953b4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc3c1('0x33')]['syncNewExten']=function(_0x48fc26){try{if(this[_0xc3c1('0x3f')](_0x48fc26)){if(_0x48fc26[_0xc3c1('0x37')]===_0x48fc26[_0xc3c1('0x50')]&&_0x48fc26['exten']!='h'&&_0x48fc26[_0xc3c1('0x48')]!=_0xc3c1('0x51')){_0x48fc26['application']=_0x48fc26[_0xc3c1('0x52')]['toLowerCase']();_0x48fc26['applicationdata']=(_0x48fc26['appdata']||_0x48fc26[_0xc3c1('0x53')])[_0xc3c1('0x54')]();if(_[_0xc3c1('0x34')](this[_0xc3c1('0x1c')][_0x48fc26[_0xc3c1('0x37')]])){this[_0xc3c1('0x1c')][_0x48fc26[_0xc3c1('0x37')]]=new Channel();this[_0xc3c1('0x1c')][_0x48fc26[_0xc3c1('0x37')]][_0xc3c1('0x40')]=_0x48fc26[_0xc3c1('0x55')]?moment()[_0xc3c1('0x56')](moment[_0xc3c1('0x55')](_0x48fc26[_0xc3c1('0x55')])['seconds'](),_0xc3c1('0x57'))[_0xc3c1('0x41')](_0xc3c1('0x42')):moment()[_0xc3c1('0x41')](_0xc3c1('0x42'));this[_0xc3c1('0x1c')][_0x48fc26[_0xc3c1('0x37')]]['disposition']=_0xc3c1('0x14');}_[_0xc3c1('0x38')](this['channels'][_0x48fc26['uniqueid']],_[_0xc3c1('0x39')](_0x48fc26,_[_0xc3c1('0x3a')](this[_0xc3c1('0x1c')][_0x48fc26[_0xc3c1('0x37')]])));if(_[_0xc3c1('0x58')](applications,_0x48fc26[_0xc3c1('0x52')])){this[_0xc3c1('0x1c')][_0x48fc26[_0xc3c1('0x37')]][_0xc3c1('0x59')]=_0x48fc26['application'];this[_0xc3c1('0x1c')][_0x48fc26[_0xc3c1('0x37')]][_0xc3c1('0x5a')]=_0x48fc26[_0xc3c1('0x53')];if(_0x48fc26[_0xc3c1('0x52')]===_0xc3c1('0xf')&&_['startsWith'](_0x48fc26[_0xc3c1('0x53')],_0xc3c1('0x5b'))){var _0x404ed4=_0x48fc26[_0xc3c1('0x53')][_0xc3c1('0x49')]('=');var _0x261ee7=_0x404ed4[0x0]['match'](/cdr\((.*)\)/);if(_0x261ee7){this[_0xc3c1('0x1c')][_0x48fc26[_0xc3c1('0x37')]][_0x261ee7[0x1]]=_0x404ed4[0x1];}}else if(_0x48fc26[_0xc3c1('0x52')]===_0xc3c1('0x10')){this[_0xc3c1('0x1c')][_0x48fc26['uniqueid']][_0xc3c1('0x10')]=_0x48fc26[_0xc3c1('0x53')][_0xc3c1('0x49')](',')[0x0];}}}}}catch(_0x579398){logger['error'](_0xc3c1('0x5c'),util[_0xc3c1('0x3d')](_0x579398,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc3c1('0x33')][_0xc3c1('0x24')]=function(_0x2b17e1){try{if(this[_0xc3c1('0x3f')](_0x2b17e1)){if(_0x2b17e1[_0xc3c1('0x37')]!==_0x2b17e1[_0xc3c1('0x50')]){if(this[_0xc3c1('0x1c')][_0x2b17e1[_0xc3c1('0x50')]]){if(_0x2b17e1[_0xc3c1('0x45')]==='6'){if(!this['channels'][_0x2b17e1[_0xc3c1('0x50')]][_0xc3c1('0x5d')]){var _0x40610e=moment();this['channels'][_0x2b17e1[_0xc3c1('0x50')]][_0xc3c1('0x5d')]=!![];this[_0xc3c1('0x1c')][_0x2b17e1['linkedid']]['answertime']=_0x40610e[_0xc3c1('0x41')](_0xc3c1('0x42'));if(this[_0xc3c1('0x1c')][_0x2b17e1[_0xc3c1('0x50')]][_0xc3c1('0x40')]){this[_0xc3c1('0x1c')][_0x2b17e1[_0xc3c1('0x50')]][_0xc3c1('0x5e')]=_0x40610e[_0xc3c1('0x5f')](this[_0xc3c1('0x1c')][_0x2b17e1[_0xc3c1('0x50')]][_0xc3c1('0x40')],_0xc3c1('0x57'));}}this[_0xc3c1('0x1c')][_0x2b17e1['linkedid']]['linkedid']=_0x2b17e1[_0xc3c1('0x37')];if(_0x2b17e1[_0xc3c1('0x60')]!==_0xc3c1('0x61')){this['channels'][_0x2b17e1[_0xc3c1('0x50')]][_0xc3c1('0x62')]=_0x2b17e1[_0xc3c1('0x60')];}this[_0xc3c1('0x1c')][_0x2b17e1['linkedid']][_0xc3c1('0x63')]=_0x2b17e1[_0xc3c1('0x64')];this[_0xc3c1('0x1c')][_0x2b17e1[_0xc3c1('0x50')]][_0xc3c1('0x65')]=_0x2b17e1[_0xc3c1('0x48')];this[_0xc3c1('0x1c')][_0x2b17e1['linkedid']][_0xc3c1('0x43')]=dispositions[_[_0xc3c1('0x44')](_0x2b17e1[_0xc3c1('0x45')])];if(this['agents'][_0x2b17e1[_0xc3c1('0x48')][_0xc3c1('0x49')]('-')[0x0]]){this[_0xc3c1('0x1c')][_0x2b17e1[_0xc3c1('0x50')]][_0xc3c1('0x66')]=this[_0xc3c1('0x1d')][_0x2b17e1['channel']['split']('-')[0x0]]['id'];this['channels'][_0x2b17e1['linkedid']][_0xc3c1('0x67')]=this[_0xc3c1('0x1d')][_0x2b17e1[_0xc3c1('0x48')][_0xc3c1('0x49')]('-')[0x0]]['name'];}}}}else{if(this[_0xc3c1('0x1c')][_0x2b17e1[_0xc3c1('0x37')]]){if(_0x2b17e1['channelstate']==='6'){if(this[_0xc3c1('0x1d')][_0x2b17e1[_0xc3c1('0x48')][_0xc3c1('0x49')]('-')[0x0]]){this[_0xc3c1('0x1c')][_0x2b17e1[_0xc3c1('0x37')]][_0xc3c1('0x66')]=this['agents'][_0x2b17e1[_0xc3c1('0x48')]['split']('-')[0x0]]['id'];this['channels'][_0x2b17e1[_0xc3c1('0x37')]][_0xc3c1('0x67')]=this[_0xc3c1('0x1d')][_0x2b17e1[_0xc3c1('0x48')][_0xc3c1('0x49')]('-')[0x0]][_0xc3c1('0x4d')];}}}}}}catch(_0x5bc0dc){logger[_0xc3c1('0x3b')](_0xc3c1('0x68'),util['inspect'](_0x5bc0dc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc3c1('0x33')][_0xc3c1('0x69')]=function(_0x43fb2c,_0x18d685){if(this[_0xc3c1('0x1c')][_0x43fb2c]){this[_0xc3c1('0x1c')][_0x43fb2c][_0xc3c1('0x6a')]=!![];if(_[_0xc3c1('0x6b')](_0x18d685,_0xc3c1('0x6c'))){_0x18d685=_0x18d685['replace'](_0xc3c1('0x6c'),_0xc3c1('0x6d'));}this[_0xc3c1('0x1c')][_0x43fb2c]['monitorFilename']=_0x18d685;var _0x2d4bf2=_[_0xc3c1('0x6e')](this['channels'][_0x43fb2c][_0xc3c1('0x6f')],{'filename':_0x18d685});if(_[_0xc3c1('0x70')](_0x2d4bf2)){this[_0xc3c1('0x1c')][_0x43fb2c]['monitors']['push']({'filename':_0x18d685,'createdAt':moment()[_0xc3c1('0x41')](_0xc3c1('0x42')),'mixmonitorid':'','status':_0xc3c1('0x71')});}}};VoiceCallReport[_0xc3c1('0x33')][_0xc3c1('0x26')]=function(_0x6694aa){try{if(this[_0xc3c1('0x3f')](_0x6694aa)){if(this[_0xc3c1('0x1c')][_0x6694aa[_0xc3c1('0x37')]]&&_0x6694aa[_0xc3c1('0x48')]!=_0xc3c1('0x51')){if(this[_0xc3c1('0x3f')](_0x6694aa[_0xc3c1('0x72')])){if(this[_0xc3c1('0x3f')](_0x6694aa[_0xc3c1('0x72')]['mixmonitor_filename'])){this[_0xc3c1('0x69')](_0x6694aa[_0xc3c1('0x37')],_0x6694aa[_0xc3c1('0x73')]);}else if(this[_0xc3c1('0x3f')](_0x6694aa[_0xc3c1('0x72')][_0xc3c1('0x74')])){this[_0xc3c1('0x1c')][_0x6694aa['uniqueid']][_0xc3c1('0x60')]=_0x6694aa['value'];}else if(this[_0xc3c1('0x3f')](_0x6694aa[_0xc3c1('0x72')][_0xc3c1('0x75')])){this[_0xc3c1('0x1c')][_0x6694aa[_0xc3c1('0x37')]][_0xc3c1('0x76')]=_0x6694aa[_0xc3c1('0x73')];}else if(this['isNotNull'](_0x6694aa['variable']['xmd-cdrtype'])){this[_0xc3c1('0x1c')][_0x6694aa[_0xc3c1('0x37')]][_0xc3c1('0x77')]=_0x6694aa[_0xc3c1('0x73')];}else if(this[_0xc3c1('0x3f')](_0x6694aa[_0xc3c1('0x72')][_0xc3c1('0x78')])){this[_0xc3c1('0x1c')][_0x6694aa[_0xc3c1('0x37')]][_0xc3c1('0x10')]=_0x6694aa['value'][_0xc3c1('0x49')](',')[0x0];}else if(this[_0xc3c1('0x3f')](_0x6694aa['variable'][_0xc3c1('0x79')])){this[_0xc3c1('0x1c')][_0x6694aa[_0xc3c1('0x37')]][_0xc3c1('0x7a')]=_0x6694aa[_0xc3c1('0x73')];}else if(this['isNotNull'](_0x6694aa['variable']['xmd-destination'])){this['channels'][_0x6694aa['uniqueid']][_0xc3c1('0x7b')]=_0x6694aa[_0xc3c1('0x73')];}else if(this['isNotNull'](_0x6694aa[_0xc3c1('0x72')]['xmd-callerid-preview'])){this['channels'][_0x6694aa[_0xc3c1('0x37')]][_0xc3c1('0x7c')]=_0x6694aa[_0xc3c1('0x73')];}else if(this[_0xc3c1('0x3f')](_0x6694aa[_0xc3c1('0x72')][_0xc3c1('0x7d')])){this[_0xc3c1('0x1c')][_0x6694aa[_0xc3c1('0x37')]][_0xc3c1('0x10')]=_0x6694aa[_0xc3c1('0x73')];}else if(this[_0xc3c1('0x3f')](_0x6694aa[_0xc3c1('0x72')][_0xc3c1('0x7e')])){this[_0xc3c1('0x1c')][_0x6694aa[_0xc3c1('0x37')]][_0xc3c1('0x7f')]=_0x6694aa[_0xc3c1('0x73')];}}}else if(this[_0xc3c1('0x3f')](_0x6694aa[_0xc3c1('0x72')][_0xc3c1('0x80')])){if(_0x6694aa[_0xc3c1('0x73')]){var _0x3e26f3=path['parse'](_0x6694aa[_0xc3c1('0x73')])['name'];this[_0xc3c1('0x69')](_0x3e26f3,_0x6694aa[_0xc3c1('0x73')]);}}else if(this['channels'][_0x6694aa[_0xc3c1('0x50')]]){if(this[_0xc3c1('0x3f')](_0x6694aa['variable'])){if(this[_0xc3c1('0x3f')](_0x6694aa['variable'][_0xc3c1('0x7e')])){this['channels'][_0x6694aa[_0xc3c1('0x50')]][_0xc3c1('0x81')]=_0x6694aa['value'];}}}}}catch(_0x4c85bd){logger[_0xc3c1('0x3b')]('[syncVarSet][VoiceCallReport]',util[_0xc3c1('0x3d')](_0x4c85bd,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncHangup']=function(_0x4dc894){try{if(this[_0xc3c1('0x3f')](_0x4dc894)){if(this[_0xc3c1('0x1c')][_0x4dc894[_0xc3c1('0x37')]]){var _0x38e06f=moment();this[_0xc3c1('0x1c')][_0x4dc894[_0xc3c1('0x37')]][_0xc3c1('0x82')]=_0x38e06f['format'](_0xc3c1('0x42'));this['channels'][_0x4dc894['uniqueid']]['duration']=_0x38e06f[_0xc3c1('0x5f')](this['channels'][_0x4dc894[_0xc3c1('0x37')]][_0xc3c1('0x40')],_0xc3c1('0x57'));if(this['channels'][_0x4dc894[_0xc3c1('0x37')]][_0xc3c1('0x5d')]){this[_0xc3c1('0x1c')][_0x4dc894[_0xc3c1('0x37')]][_0xc3c1('0x83')]=_0x38e06f[_0xc3c1('0x5f')](this[_0xc3c1('0x1c')][_0x4dc894['uniqueid']]['answertime'],_0xc3c1('0x57'));this[_0xc3c1('0x1c')][_0x4dc894[_0xc3c1('0x37')]][_0xc3c1('0x5e')]=this[_0xc3c1('0x1c')][_0x4dc894['uniqueid']][_0xc3c1('0x55')]-this[_0xc3c1('0x1c')][_0x4dc894['uniqueid']]['billableseconds'];}if(_0x4dc894['context']===_0xc3c1('0x47')){if(this['agents'][_0x4dc894[_0xc3c1('0x48')][_0xc3c1('0x49')]('-')[0x0]]){this[_0xc3c1('0x1d')][_0x4dc894[_0xc3c1('0x48')][_0xc3c1('0x49')]('-')[0x0]]=_[_0xc3c1('0x84')](this[_0xc3c1('0x1d')][_0x4dc894['channel']['split']('-')[0x0]],[_0xc3c1('0x4a')]);this[_0xc3c1('0x35')](util[_0xc3c1('0x41')](_0xc3c1('0x4c'),this[_0xc3c1('0x1d')][_0x4dc894[_0xc3c1('0x48')][_0xc3c1('0x49')]('-')[0x0]][_0xc3c1('0x4d')]),_0xc3c1('0x85'),{'destaccountcode':this[_0xc3c1('0x1d')][_0x4dc894[_0xc3c1('0x48')][_0xc3c1('0x49')]('-')[0x0]][_0xc3c1('0x4e')]});}}ami['emit'](_0xc3c1('0x86'),this[_0xc3c1('0x1c')][_0x4dc894['uniqueid']]);delete this[_0xc3c1('0x1c')][_0x4dc894['uniqueid']];}}}catch(_0x2d01ea){logger['error'](_0xc3c1('0x87'),util['inspect'](_0x2d01ea,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc3c1('0x33')][_0xc3c1('0x2b')]=function(_0x2537c1){try{if(this[_0xc3c1('0x3f')](_0x2537c1)){if(this[_0xc3c1('0x1c')][_0x2537c1[_0xc3c1('0x88')]]){this[_0xc3c1('0x1c')][_0x2537c1[_0xc3c1('0x88')]][_0xc3c1('0x89')]=_0x2537c1[_0xc3c1('0x8a')];this[_0xc3c1('0x1c')][_0x2537c1[_0xc3c1('0x88')]]['transferconnectedlinenum']=_0x2537c1[_0xc3c1('0x8b')];if(this[_0xc3c1('0x1c')][_0x2537c1[_0xc3c1('0x8c')]]){var _0x3dfc8d=this[_0xc3c1('0x1c')][_0x2537c1[_0xc3c1('0x8c')]];this['channels'][_0x2537c1[_0xc3c1('0x8c')]]=this[_0xc3c1('0x1c')][_0x2537c1[_0xc3c1('0x88')]];this['channels'][_0x2537c1[_0xc3c1('0x88')]]=_0x3dfc8d;}}else if(this[_0xc3c1('0x1c')][_0x2537c1['transfertargetuniqueid']]){this[_0xc3c1('0x1c')][_0x2537c1['transfertargetuniqueid']][_0xc3c1('0x89')]=_0x2537c1[_0xc3c1('0x8a')];this[_0xc3c1('0x1c')][_0x2537c1[_0xc3c1('0x8d')]][_0xc3c1('0x8e')]=_0x2537c1[_0xc3c1('0x8b')];if(this[_0xc3c1('0x1c')][_0x2537c1[_0xc3c1('0x8f')]]){var _0x3dfc8d=this['channels'][_0x2537c1['origtransfereruniqueid']];this[_0xc3c1('0x1c')][_0x2537c1[_0xc3c1('0x8f')]]=this[_0xc3c1('0x1c')][_0x2537c1[_0xc3c1('0x8d')]];this[_0xc3c1('0x1c')][_0x2537c1[_0xc3c1('0x8d')]]=_0x3dfc8d;}}}}catch(_0x4d0a30){logger[_0xc3c1('0x3b')](_0xc3c1('0x90'),util['inspect'](_0x4d0a30,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc3c1('0x33')][_0xc3c1('0x91')]=function(_0x250b9f){try{if(this[_0xc3c1('0x3f')](_0x250b9f)){if(this[_0xc3c1('0x1c')][_0x250b9f[_0xc3c1('0x88')]]){this['channels'][_0x250b9f[_0xc3c1('0x88')]][_0xc3c1('0x89')]=_0x250b9f[_0xc3c1('0x92')];this[_0xc3c1('0x1c')][_0x250b9f[_0xc3c1('0x88')]][_0xc3c1('0x8e')]=_0x250b9f[_0xc3c1('0x93')];this[_0xc3c1('0x28')]({'event':_0xc3c1('0x94'),'uniqueid':_0x250b9f[_0xc3c1('0x88')],'context':_0x250b9f['context'],'channel':_0x250b9f['transfererchannel']});}}}catch(_0x56649a){logger['error'](_0xc3c1('0x95'),util[_0xc3c1('0x3d')](_0x56649a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc3c1('0x33')][_0xc3c1('0x96')]=function(_0x2a0599){try{if(this['isNotNull'](_0x2a0599)){if(this['channels'][_0x2a0599[_0xc3c1('0x37')]]){if(!_['isNil'](this[_0xc3c1('0x1c')][_0x2a0599[_0xc3c1('0x37')]][_0xc3c1('0x97')])){this[_0xc3c1('0x1c')][_0x2a0599['uniqueid']][_0xc3c1('0x98')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}}}catch(_0x3643a1){logger[_0xc3c1('0x3b')](_0xc3c1('0x99'),util[_0xc3c1('0x3d')](_0x3643a1,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMusicOnHoldStop']=function(_0x48c992){try{if(this[_0xc3c1('0x3f')](_0x48c992)){if(this[_0xc3c1('0x1c')][_0x48c992[_0xc3c1('0x37')]]){if(!_['isNil'](this['channels'][_0x48c992[_0xc3c1('0x37')]]['mohstarttime'])){this[_0xc3c1('0x1c')][_0x48c992[_0xc3c1('0x37')]][_0xc3c1('0x9a')]+=moment()[_0xc3c1('0x9b')](0x0)['diff'](this[_0xc3c1('0x1c')][_0x48c992[_0xc3c1('0x37')]][_0xc3c1('0x98')],_0xc3c1('0x57'));delete this[_0xc3c1('0x1c')][_0x48c992[_0xc3c1('0x37')]]['mohstarttime'];}}}}catch(_0xc9b107){logger['error'](_0xc3c1('0x9c'),util[_0xc3c1('0x3d')](_0xc9b107,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file +var _0x7662=['answered','answertime','holdtime','xcally-motion-preview','connectedlinenum','calleridnum','connectedlinename','calleridname','destinationchannel','UserId','membername','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','endsWith','.wav49','replace','monitorFilename','monitors','isNil','push','rec','variable','mixmonitor_filename','value','xmd-callerid','xmd-cdrtype','type','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','xmcs-queue','sipcalluniqueid','parse','sipcallid','sipcalllinkedid','[syncVarSet][VoiceCallReport]','endtime','diff','billableseconds','context','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','syncAttendedTransfer','transfercalleridnum','origtransferercalleridnum','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','transfertargetcalleridnum','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','extension','BlindTransfer','[syncBlindTransfer][VoiceCallReport]','mohstarttime','mohtime','[syncMusicOnHoldStop][VoiceCallReport]','bluebird','lodash','moment','path','ioredis','../../../config/environment','../../../config/logger','../ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','unavailable','ringinuse','queue','agi','playback','NO\x20ANSWER','FAILED','BUSY','redis','localhost','socket.io-emitter','channels','agents','syncNewExten','bind','syncNewChannel','syncNewState','syncVarSet','hangup','syncHangup','newcallerid','attendedtransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','then','actionCoreShowChannels','catch','log','prototype','isUndefined','emit','syncNewCallerId','linkedid','merge','pick','keys','error','isNotNull','uniqueid','channel','OutgoingSpoolFailed','starttime','format','disposition','toNumber','from-sip','split','destconnectedlinenum','exten','user:%s','name','user:agentconnect','accountcode','inspect','application','applicationdata','toLowerCase','duration','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastapplication','lastdata','set','cdr(','match','[syncNewExten][VoiceCallReport]','channelstate'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x7662,0xd2));var _0x2766=function(_0x2afae7,_0x54a66b){_0x2afae7=_0x2afae7-0x0;var _0x360aee=_0x7662[_0x2afae7];return _0x360aee;};'use strict';var BPromise=require(_0x2766('0x0'));var _=require(_0x2766('0x1'));var moment=require(_0x2766('0x2'));var util=require('util');var path=require(_0x2766('0x3'));var Redis=require(_0x2766('0x4'));var config=require(_0x2766('0x5'));var logger=require(_0x2766('0x6'))('ami');var ami=require(_0x2766('0x7'));var Channel=require(_0x2766('0x8'));var statusDesc=[_0x2766('0x9'),_0x2766('0xa'),_0x2766('0xb'),_0x2766('0xc'),_0x2766('0xd'),_0x2766('0xe'),'ringing',_0x2766('0xf'),'onhold'];var applications=['set',_0x2766('0x10'),_0x2766('0x11'),'dial',_0x2766('0x12'),'voicemail'];var dispositions=[_0x2766('0x13'),_0x2766('0x14'),'FAILED',_0x2766('0x13'),_0x2766('0x13'),'NO\x20ANSWER','ANSWERED',_0x2766('0x15'),_0x2766('0x14'),_0x2766('0x14'),_0x2766('0x14')];var actions={};config[_0x2766('0x16')]=_['defaults'](config['redis'],{'host':_0x2766('0x17'),'port':0x18eb});var io=require(_0x2766('0x18'))(new Redis(config[_0x2766('0x16')]));function VoiceCallReport(_0x4e14e2){this[_0x2766('0x19')]=_0x4e14e2['channels'];this['agents']=_0x4e14e2[_0x2766('0x1a')];ami['on']('coreshowchannel',this[_0x2766('0x1b')][_0x2766('0x1c')](this));ami['on']('newexten',this[_0x2766('0x1b')][_0x2766('0x1c')](this));ami['on']('newchannel',this[_0x2766('0x1d')][_0x2766('0x1c')](this));ami['on']('newstate',this[_0x2766('0x1e')][_0x2766('0x1c')](this));ami['on']('varset',this[_0x2766('0x1f')]['bind'](this));ami['on'](_0x2766('0x20'),this[_0x2766('0x21')][_0x2766('0x1c')](this));ami['on'](_0x2766('0x22'),this['syncNewCallerId'][_0x2766('0x1c')](this));ami['on'](_0x2766('0x23'),this['syncAttendedTransfer'][_0x2766('0x1c')](this));ami['on']('blindtransfer',this[_0x2766('0x24')]['bind'](this));ami['on'](_0x2766('0x25'),this['syncMusicOnHoldStart'][_0x2766('0x1c')](this));ami['on'](_0x2766('0x26'),this[_0x2766('0x27')][_0x2766('0x1c')](this));return BPromise['resolve']()[_0x2766('0x28')](ami[_0x2766('0x29')]())[_0x2766('0x2a')](function(_0x20d8c){console[_0x2766('0x2b')](_0x20d8c);});}VoiceCallReport[_0x2766('0x2c')]['isNotNull']=function(_0xfb075d){return _0xfb075d!==null&&!_[_0x2766('0x2d')](_0xfb075d);};VoiceCallReport[_0x2766('0x2c')][_0x2766('0x2e')]=function(_0x36b3e1,_0x2ac9bb,_0x1cb4fb){io['to'](_0x36b3e1)[_0x2766('0x2e')](_0x2ac9bb,_0x1cb4fb);};VoiceCallReport[_0x2766('0x2c')][_0x2766('0x2f')]=function(_0x49aeca){try{if(this['isNotNull'](_0x49aeca)){if(_0x49aeca['uniqueid']===_0x49aeca[_0x2766('0x30')]){if(!_[_0x2766('0x2d')](this['channels'][_0x49aeca['uniqueid']])){_[_0x2766('0x31')](this[_0x2766('0x19')][_0x49aeca['uniqueid']],_[_0x2766('0x32')](_0x49aeca,_[_0x2766('0x33')](this['channels'][_0x49aeca['uniqueid']])));}}}}catch(_0x15db29){logger[_0x2766('0x34')]('[syncNewCallerId][VoiceCallReport]',util['inspect'](_0x15db29,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2766('0x2c')][_0x2766('0x1d')]=function(_0x20976a){try{if(this[_0x2766('0x35')](_0x20976a)){if(_0x20976a[_0x2766('0x36')]===_0x20976a['linkedid']&&_0x20976a[_0x2766('0x37')]!=_0x2766('0x38')){if(_[_0x2766('0x2d')](this['channels'][_0x20976a['uniqueid']])){this['channels'][_0x20976a[_0x2766('0x36')]]=new Channel();this[_0x2766('0x19')][_0x20976a[_0x2766('0x36')]][_0x2766('0x39')]=moment()[_0x2766('0x3a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x2766('0x19')][_0x20976a[_0x2766('0x36')]][_0x2766('0x3b')]=dispositions[_[_0x2766('0x3c')](_0x20976a['channelstate'])];_[_0x2766('0x31')](this[_0x2766('0x19')][_0x20976a[_0x2766('0x36')]],_[_0x2766('0x32')](_0x20976a,_[_0x2766('0x33')](this[_0x2766('0x19')][_0x20976a[_0x2766('0x36')]])));if(_0x20976a['context']===_0x2766('0x3d')){if(this[_0x2766('0x1a')][_0x20976a[_0x2766('0x37')][_0x2766('0x3e')]('-')[0x0]]){this[_0x2766('0x1a')][_0x20976a[_0x2766('0x37')]['split']('-')[0x0]][_0x2766('0x3f')]=_0x20976a[_0x2766('0x40')];this[_0x2766('0x2e')](util[_0x2766('0x3a')](_0x2766('0x41'),this['agents'][_0x20976a[_0x2766('0x37')][_0x2766('0x3e')]('-')[0x0]][_0x2766('0x42')]),_0x2766('0x43'),{'destaccountcode':this[_0x2766('0x1a')][_0x20976a['channel']['split']('-')[0x0]][_0x2766('0x44')],'destconnectedlinenum':_0x20976a['exten']});}}}}}}catch(_0x4b0a8e){logger[_0x2766('0x34')]('[syncNewChannel][VoiceCallReport]',util[_0x2766('0x45')](_0x4b0a8e,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x2766('0x1b')]=function(_0x5769a6){try{if(this[_0x2766('0x35')](_0x5769a6)){if(_0x5769a6['uniqueid']===_0x5769a6[_0x2766('0x30')]&&_0x5769a6[_0x2766('0x40')]!='h'&&_0x5769a6[_0x2766('0x37')]!='OutgoingSpoolFailed'){_0x5769a6['application']=_0x5769a6[_0x2766('0x46')]['toLowerCase']();_0x5769a6['applicationdata']=(_0x5769a6['appdata']||_0x5769a6[_0x2766('0x47')])[_0x2766('0x48')]();if(_[_0x2766('0x2d')](this[_0x2766('0x19')][_0x5769a6[_0x2766('0x36')]])){this['channels'][_0x5769a6[_0x2766('0x36')]]=new Channel();this['channels'][_0x5769a6[_0x2766('0x36')]][_0x2766('0x39')]=_0x5769a6[_0x2766('0x49')]?moment()['subtract'](moment[_0x2766('0x49')](_0x5769a6[_0x2766('0x49')])[_0x2766('0x4a')](),'seconds')[_0x2766('0x3a')](_0x2766('0x4b')):moment()[_0x2766('0x3a')](_0x2766('0x4b'));this[_0x2766('0x19')][_0x5769a6['uniqueid']][_0x2766('0x3b')]=_0x2766('0x13');}_['merge'](this[_0x2766('0x19')][_0x5769a6[_0x2766('0x36')]],_[_0x2766('0x32')](_0x5769a6,_[_0x2766('0x33')](this['channels'][_0x5769a6[_0x2766('0x36')]])));if(_[_0x2766('0x4c')](applications,_0x5769a6[_0x2766('0x46')])){this['channels'][_0x5769a6['uniqueid']][_0x2766('0x4d')]=_0x5769a6[_0x2766('0x46')];this[_0x2766('0x19')][_0x5769a6['uniqueid']][_0x2766('0x4e')]=_0x5769a6['applicationdata'];if(_0x5769a6[_0x2766('0x46')]===_0x2766('0x4f')&&_['startsWith'](_0x5769a6['applicationdata'],_0x2766('0x50'))){var _0x56afa6=_0x5769a6['applicationdata'][_0x2766('0x3e')]('=');var _0x8798e9=_0x56afa6[0x0][_0x2766('0x51')](/cdr\((.*)\)/);if(_0x8798e9){this[_0x2766('0x19')][_0x5769a6['uniqueid']][_0x8798e9[0x1]]=_0x56afa6[0x1];}}else if(_0x5769a6['application']==='queue'){this[_0x2766('0x19')][_0x5769a6[_0x2766('0x36')]][_0x2766('0x10')]=_0x5769a6[_0x2766('0x47')][_0x2766('0x3e')](',')[0x0];}}}}}catch(_0x372cc8){logger[_0x2766('0x34')](_0x2766('0x52'),util[_0x2766('0x45')](_0x372cc8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2766('0x2c')][_0x2766('0x1e')]=function(_0x473a3e){try{if(this[_0x2766('0x35')](_0x473a3e)){if(_0x473a3e[_0x2766('0x36')]!==_0x473a3e[_0x2766('0x30')]){if(this[_0x2766('0x19')][_0x473a3e['linkedid']]){if(_0x473a3e[_0x2766('0x53')]==='6'){if(!this[_0x2766('0x19')][_0x473a3e['linkedid']]['answered']){var _0x3d7815=moment();this[_0x2766('0x19')][_0x473a3e['linkedid']][_0x2766('0x54')]=!![];this[_0x2766('0x19')][_0x473a3e[_0x2766('0x30')]][_0x2766('0x55')]=_0x3d7815[_0x2766('0x3a')]('YYYY-MM-DD\x20HH:mm:ss');if(this['channels'][_0x473a3e['linkedid']][_0x2766('0x39')]){this[_0x2766('0x19')][_0x473a3e[_0x2766('0x30')]][_0x2766('0x56')]=_0x3d7815['diff'](this[_0x2766('0x19')][_0x473a3e['linkedid']][_0x2766('0x39')],'seconds');}}this[_0x2766('0x19')][_0x473a3e['linkedid']][_0x2766('0x30')]=_0x473a3e[_0x2766('0x36')];if(_0x473a3e['calleridnum']!==_0x2766('0x57')){this[_0x2766('0x19')][_0x473a3e['linkedid']][_0x2766('0x58')]=_0x473a3e[_0x2766('0x59')];}this['channels'][_0x473a3e[_0x2766('0x30')]][_0x2766('0x5a')]=_0x473a3e[_0x2766('0x5b')];this[_0x2766('0x19')][_0x473a3e['linkedid']][_0x2766('0x5c')]=_0x473a3e[_0x2766('0x37')];this['channels'][_0x473a3e[_0x2766('0x30')]][_0x2766('0x3b')]=dispositions[_['toNumber'](_0x473a3e['channelstate'])];if(this[_0x2766('0x1a')][_0x473a3e[_0x2766('0x37')]['split']('-')[0x0]]){this[_0x2766('0x19')][_0x473a3e[_0x2766('0x30')]]['UserId']=this[_0x2766('0x1a')][_0x473a3e['channel']['split']('-')[0x0]]['id'];this[_0x2766('0x19')][_0x473a3e[_0x2766('0x30')]]['membername']=this[_0x2766('0x1a')][_0x473a3e['channel'][_0x2766('0x3e')]('-')[0x0]][_0x2766('0x42')];}}}}else{if(this[_0x2766('0x19')][_0x473a3e['uniqueid']]){if(_0x473a3e[_0x2766('0x53')]==='6'){if(this[_0x2766('0x1a')][_0x473a3e[_0x2766('0x37')][_0x2766('0x3e')]('-')[0x0]]){this[_0x2766('0x19')][_0x473a3e[_0x2766('0x36')]][_0x2766('0x5d')]=this[_0x2766('0x1a')][_0x473a3e[_0x2766('0x37')][_0x2766('0x3e')]('-')[0x0]]['id'];this[_0x2766('0x19')][_0x473a3e[_0x2766('0x36')]][_0x2766('0x5e')]=this[_0x2766('0x1a')][_0x473a3e[_0x2766('0x37')][_0x2766('0x3e')]('-')[0x0]][_0x2766('0x42')];}}}}}}catch(_0x380f48){logger[_0x2766('0x34')](_0x2766('0x5f'),util['inspect'](_0x380f48,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2766('0x2c')][_0x2766('0x60')]=function(_0xef6151,_0x140460){if(this['channels'][_0xef6151]){this['channels'][_0xef6151][_0x2766('0x61')]=!![];if(_[_0x2766('0x62')](_0x140460,_0x2766('0x63'))){_0x140460=_0x140460[_0x2766('0x64')](_0x2766('0x63'),'.WAV');}this[_0x2766('0x19')][_0xef6151][_0x2766('0x65')]=_0x140460;var _0x310680=_['find'](this[_0x2766('0x19')][_0xef6151][_0x2766('0x66')],{'filename':_0x140460});if(_[_0x2766('0x67')](_0x310680)){this['channels'][_0xef6151][_0x2766('0x66')][_0x2766('0x68')]({'filename':_0x140460,'createdAt':moment()['format'](_0x2766('0x4b')),'mixmonitorid':'','status':_0x2766('0x69')});}}};VoiceCallReport['prototype'][_0x2766('0x1f')]=function(_0x3a5352){try{if(this[_0x2766('0x35')](_0x3a5352)){if(this[_0x2766('0x19')][_0x3a5352[_0x2766('0x36')]]&&_0x3a5352[_0x2766('0x37')]!=_0x2766('0x38')){if(this['isNotNull'](_0x3a5352[_0x2766('0x6a')])){if(this[_0x2766('0x35')](_0x3a5352[_0x2766('0x6a')][_0x2766('0x6b')])){this[_0x2766('0x60')](_0x3a5352['uniqueid'],_0x3a5352[_0x2766('0x6c')]);}else if(this[_0x2766('0x35')](_0x3a5352[_0x2766('0x6a')]['xmd-phone'])){this['channels'][_0x3a5352[_0x2766('0x36')]][_0x2766('0x59')]=_0x3a5352[_0x2766('0x6c')];}else if(this[_0x2766('0x35')](_0x3a5352['variable'][_0x2766('0x6d')])){this[_0x2766('0x19')][_0x3a5352[_0x2766('0x36')]]['callerid']=_0x3a5352[_0x2766('0x6c')];}else if(this[_0x2766('0x35')](_0x3a5352[_0x2766('0x6a')][_0x2766('0x6e')])){this['channels'][_0x3a5352['uniqueid']][_0x2766('0x6f')]=_0x3a5352[_0x2766('0x6c')];}else if(this[_0x2766('0x35')](_0x3a5352[_0x2766('0x6a')]['xmd-queue'])){this[_0x2766('0x19')][_0x3a5352[_0x2766('0x36')]][_0x2766('0x10')]=_0x3a5352[_0x2766('0x6c')]['split'](',')[0x0];}else if(this[_0x2766('0x35')](_0x3a5352[_0x2766('0x6a')][_0x2766('0x70')])){this[_0x2766('0x19')][_0x3a5352[_0x2766('0x36')]][_0x2766('0x71')]=_0x3a5352[_0x2766('0x6c')];}else if(this[_0x2766('0x35')](_0x3a5352[_0x2766('0x6a')][_0x2766('0x72')])){this[_0x2766('0x19')][_0x3a5352[_0x2766('0x36')]][_0x2766('0x73')]=_0x3a5352[_0x2766('0x6c')];}else if(this[_0x2766('0x35')](_0x3a5352[_0x2766('0x6a')][_0x2766('0x74')])){this['channels'][_0x3a5352[_0x2766('0x36')]]['calleridpreview']=_0x3a5352[_0x2766('0x6c')];}else if(this['isNotNull'](_0x3a5352[_0x2766('0x6a')][_0x2766('0x75')])){this[_0x2766('0x19')][_0x3a5352[_0x2766('0x36')]][_0x2766('0x10')]=_0x3a5352[_0x2766('0x6c')];}else if(this['isNotNull'](_0x3a5352[_0x2766('0x6a')]['sipcallid'])){this[_0x2766('0x19')][_0x3a5352[_0x2766('0x36')]][_0x2766('0x76')]=_0x3a5352[_0x2766('0x6c')];}}}else if(this['isNotNull'](_0x3a5352['variable'][_0x2766('0x6b')])){if(_0x3a5352['value']){var _0x34b233=path[_0x2766('0x77')](_0x3a5352['value'])[_0x2766('0x42')];this[_0x2766('0x60')](_0x34b233,_0x3a5352['value']);}}else if(this['channels'][_0x3a5352[_0x2766('0x30')]]){if(this[_0x2766('0x35')](_0x3a5352[_0x2766('0x6a')])){if(this['isNotNull'](_0x3a5352[_0x2766('0x6a')][_0x2766('0x78')])){this['channels'][_0x3a5352[_0x2766('0x30')]][_0x2766('0x79')]=_0x3a5352['value'];}}}}}catch(_0x59bab1){logger[_0x2766('0x34')](_0x2766('0x7a'),util[_0x2766('0x45')](_0x59bab1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2766('0x2c')][_0x2766('0x21')]=function(_0x3d6389){try{if(this[_0x2766('0x35')](_0x3d6389)){if(this['channels'][_0x3d6389[_0x2766('0x36')]]){var _0x16ef14=moment();this['channels'][_0x3d6389[_0x2766('0x36')]][_0x2766('0x7b')]=_0x16ef14[_0x2766('0x3a')](_0x2766('0x4b'));this[_0x2766('0x19')][_0x3d6389[_0x2766('0x36')]]['duration']=_0x16ef14[_0x2766('0x7c')](this[_0x2766('0x19')][_0x3d6389[_0x2766('0x36')]]['starttime'],_0x2766('0x4a'));if(this['channels'][_0x3d6389['uniqueid']][_0x2766('0x54')]){this[_0x2766('0x19')][_0x3d6389[_0x2766('0x36')]][_0x2766('0x7d')]=_0x16ef14['diff'](this[_0x2766('0x19')][_0x3d6389[_0x2766('0x36')]][_0x2766('0x55')],_0x2766('0x4a'));this['channels'][_0x3d6389[_0x2766('0x36')]][_0x2766('0x56')]=this[_0x2766('0x19')][_0x3d6389[_0x2766('0x36')]][_0x2766('0x49')]-this[_0x2766('0x19')][_0x3d6389[_0x2766('0x36')]][_0x2766('0x7d')];}if(_0x3d6389[_0x2766('0x7e')]===_0x2766('0x3d')){if(this[_0x2766('0x1a')][_0x3d6389['channel'][_0x2766('0x3e')]('-')[0x0]]){this['agents'][_0x3d6389[_0x2766('0x37')]['split']('-')[0x0]]=_['omit'](this[_0x2766('0x1a')][_0x3d6389['channel'][_0x2766('0x3e')]('-')[0x0]],[_0x2766('0x3f')]);this[_0x2766('0x2e')](util['format'](_0x2766('0x41'),this[_0x2766('0x1a')][_0x3d6389[_0x2766('0x37')][_0x2766('0x3e')]('-')[0x0]]['name']),_0x2766('0x7f'),{'destaccountcode':this[_0x2766('0x1a')][_0x3d6389[_0x2766('0x37')]['split']('-')[0x0]][_0x2766('0x44')]});}}ami['emit'](_0x2766('0x80'),this[_0x2766('0x19')][_0x3d6389[_0x2766('0x36')]]);delete this['channels'][_0x3d6389['uniqueid']];}}}catch(_0x469ba7){logger[_0x2766('0x34')](_0x2766('0x81'),util[_0x2766('0x45')](_0x469ba7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2766('0x2c')][_0x2766('0x82')]=function(_0x8df74f){try{if(this['isNotNull'](_0x8df74f)){if(this[_0x2766('0x19')][_0x8df74f['transfereeuniqueid']]){this[_0x2766('0x19')][_0x8df74f['transfereeuniqueid']][_0x2766('0x83')]=_0x8df74f[_0x2766('0x84')];this[_0x2766('0x19')][_0x8df74f[_0x2766('0x85')]][_0x2766('0x86')]=_0x8df74f['transfertargetcalleridnum'];if(this['channels'][_0x8df74f[_0x2766('0x87')]]){var _0x2e136f=this['channels'][_0x8df74f[_0x2766('0x87')]];this[_0x2766('0x19')][_0x8df74f[_0x2766('0x87')]]=this[_0x2766('0x19')][_0x8df74f[_0x2766('0x85')]];this[_0x2766('0x19')][_0x8df74f[_0x2766('0x85')]]=_0x2e136f;}}else if(this[_0x2766('0x19')][_0x8df74f[_0x2766('0x88')]]){this[_0x2766('0x19')][_0x8df74f[_0x2766('0x88')]]['transfercalleridnum']=_0x8df74f['origtransferercalleridnum'];this['channels'][_0x8df74f['transfertargetuniqueid']]['transferconnectedlinenum']=_0x8df74f[_0x2766('0x89')];if(this[_0x2766('0x19')][_0x8df74f['origtransfereruniqueid']]){var _0x2e136f=this[_0x2766('0x19')][_0x8df74f[_0x2766('0x8a')]];this[_0x2766('0x19')][_0x8df74f[_0x2766('0x8a')]]=this[_0x2766('0x19')][_0x8df74f[_0x2766('0x88')]];this[_0x2766('0x19')][_0x8df74f['transfertargetuniqueid']]=_0x2e136f;}}}}catch(_0x45587b){logger[_0x2766('0x34')](_0x2766('0x8b'),util['inspect'](_0x45587b,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x2766('0x24')]=function(_0x22058d){try{if(this[_0x2766('0x35')](_0x22058d)){if(this[_0x2766('0x19')][_0x22058d[_0x2766('0x85')]]){this[_0x2766('0x19')][_0x22058d[_0x2766('0x85')]][_0x2766('0x83')]=_0x22058d[_0x2766('0x8c')];this[_0x2766('0x19')][_0x22058d[_0x2766('0x85')]][_0x2766('0x86')]=_0x22058d[_0x2766('0x8d')];this[_0x2766('0x21')]({'event':_0x2766('0x8e'),'uniqueid':_0x22058d[_0x2766('0x85')],'context':_0x22058d['context'],'channel':_0x22058d['transfererchannel']});}}}catch(_0x44921c){logger[_0x2766('0x34')](_0x2766('0x8f'),util[_0x2766('0x45')](_0x44921c,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMusicOnHoldStart']=function(_0x835872){try{if(this[_0x2766('0x35')](_0x835872)){if(this[_0x2766('0x19')][_0x835872[_0x2766('0x36')]]){if(!_[_0x2766('0x67')](this[_0x2766('0x19')][_0x835872[_0x2766('0x36')]][_0x2766('0x55')])){this[_0x2766('0x19')][_0x835872['uniqueid']][_0x2766('0x90')]=moment()[_0x2766('0x3a')](_0x2766('0x4b'));}}}}catch(_0x5628d3){logger[_0x2766('0x34')]('[syncMusicOnHoldStart][VoiceCallReport]',util[_0x2766('0x45')](_0x5628d3,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMusicOnHoldStop']=function(_0x8cec4f){try{if(this[_0x2766('0x35')](_0x8cec4f)){if(this[_0x2766('0x19')][_0x8cec4f[_0x2766('0x36')]]){if(!_['isNil'](this[_0x2766('0x19')][_0x8cec4f[_0x2766('0x36')]]['mohstarttime'])){this[_0x2766('0x19')][_0x8cec4f[_0x2766('0x36')]][_0x2766('0x91')]+=moment()['milliseconds'](0x0)['diff'](this[_0x2766('0x19')][_0x8cec4f[_0x2766('0x36')]][_0x2766('0x90')],'seconds');delete this['channels'][_0x8cec4f[_0x2766('0x36')]][_0x2766('0x90')];}}}}catch(_0x16359f){logger['error'](_0x2766('0x92'),util[_0x2766('0x45')](_0x16359f,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 6e1b014..a6e4503 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 _0x5731=['variables','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','includes','endtime','duration','diff','seconds','complete','total','answered','holdtime','starttime','billableseconds','custom:dialend','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','lodash','moment','util','ioredis','../../../config/logger','ami','../ami','defaults','localhost','socket.io-emitter','redis','channels','outboundChannels','outbound','syncDialBegin','dialend','syncDialEnd','bind','varset','syncVarSet','syncHangup','prototype','isNotNull','isUndefined','emit','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','event','privilege','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','custom:dialconnect','[syncDialEnd][VoiceDialReport]','addVariable','keys','value','variable','outboundrouteid'];(function(_0x3130be,_0x54990e){var _0x484c5b=function(_0x5d3277){while(--_0x5d3277){_0x3130be['push'](_0x3130be['shift']());}};_0x484c5b(++_0x54990e);}(_0x5731,0x125));var _0x1573=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x5731[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x1573('0x0'));var moment=require(_0x1573('0x1'));var util=require(_0x1573('0x2'));var Redis=require(_0x1573('0x3'));var config=require('../../../config/environment');var logger=require(_0x1573('0x4'))(_0x1573('0x5'));var ami=require(_0x1573('0x6'));config['redis']=_[_0x1573('0x7')](config['redis'],{'host':_0x1573('0x8'),'port':0x18eb});var io=require(_0x1573('0x9'))(new Redis(config[_0x1573('0xa')]));function VoiceDialReport(_0x773a7b){this[_0x1573('0xb')]=_0x773a7b[_0x1573('0xc')];this[_0x1573('0xd')]=_0x773a7b[_0x1573('0xd')];this['variables']={};ami['on']('dialbegin',this[_0x1573('0xe')]['bind'](this));ami['on'](_0x1573('0xf'),this[_0x1573('0x10')][_0x1573('0x11')](this));ami['on'](_0x1573('0x12'),this[_0x1573('0x13')][_0x1573('0x11')](this));ami['on']('hangup',this[_0x1573('0x14')]['bind'](this));}VoiceDialReport[_0x1573('0x15')][_0x1573('0x16')]=function(_0x323ed8){return _0x323ed8!==null&&!_[_0x1573('0x17')](_0x323ed8);};VoiceDialReport[_0x1573('0x15')][_0x1573('0x18')]=function(_0x5e2e2f,_0x1a7926,_0x59ef19){io['to'](_0x5e2e2f)['emit'](_0x1a7926,_0x59ef19);};VoiceDialReport[_0x1573('0x15')][_0x1573('0xe')]=function(_0x47adfd){try{if(this[_0x1573('0x16')](_0x47adfd)){if(this[_0x1573('0xb')][_0x47adfd[_0x1573('0x19')]]){_[_0x1573('0x1a')](this[_0x1573('0xb')][_0x47adfd['uniqueid']],{'starttime':moment()[_0x1573('0x1b')](_0x1573('0x1c')),'lastevent':_0x1573('0x1d'),'interface':_0x47adfd[_0x1573('0x1e')][_0x1573('0x1f')](0x0,_0x47adfd['channel'][_0x1573('0x20')]('-')),'membername':_0x47adfd[_0x1573('0x1e')][_0x1573('0x1f')](_0x47adfd[_0x1573('0x1e')][_0x1573('0x20')]('/')+0x1,_0x47adfd['channel'][_0x1573('0x20')]('-'))},_['omit'](_0x47adfd,[_0x1573('0x21'),_0x1573('0x22')]));this[_0x1573('0x18')](_0x1573('0x23'),_0x1573('0x24'),this[_0x1573('0xb')][_0x47adfd[_0x1573('0x19')]]);ami[_0x1573('0x18')](_0x1573('0x25'),this[_0x1573('0xb')][_0x47adfd[_0x1573('0x19')]]);}}}catch(_0x419920){logger[_0x1573('0x26')](_0x1573('0x27'),util[_0x1573('0x28')](_0x419920,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x1573('0x10')]=function(_0x568afc){try{if(this[_0x1573('0x16')](_0x568afc)){if(this['channels'][_0x568afc[_0x1573('0x19')]]){this[_0x1573('0xb')][_0x568afc[_0x1573('0x19')]]['dialstatus']=_0x568afc[_0x1573('0x29')];if(_0x568afc[_0x1573('0x29')]===_0x1573('0x2a')){this[_0x1573('0xb')][_0x568afc[_0x1573('0x19')]][_0x1573('0x2b')]=_0x568afc[_0x1573('0x2b')];this['channels'][_0x568afc[_0x1573('0x19')]][_0x1573('0x2c')]=_0x568afc[_0x1573('0x2c')];this['channels'][_0x568afc[_0x1573('0x19')]][_0x1573('0x2d')]=moment()[_0x1573('0x1b')](_0x1573('0x1c'));this[_0x1573('0xb')][_0x568afc[_0x1573('0x19')]][_0x1573('0x2e')]=_0x1573('0x2f');ami['emit'](_0x1573('0x30'),this[_0x1573('0xb')][_0x568afc[_0x1573('0x19')]]);}this[_0x1573('0x18')](_0x1573('0x23'),'voice_outbound_channel:save',this['channels'][_0x568afc[_0x1573('0x19')]]);}}}catch(_0xda7fee){logger[_0x1573('0x26')](_0x1573('0x31'),util['inspect'](_0xda7fee,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x1573('0x15')][_0x1573('0x13')]=function(_0x3afa5b){try{if(this[_0x1573('0x16')](_0x3afa5b)){this[_0x1573('0x32')](_0x3afa5b['uniqueid'],_[_0x1573('0x33')](_0x3afa5b['variable'])[0x0],_0x3afa5b[_0x1573('0x34')]);if(this[_0x1573('0x16')](_0x3afa5b[_0x1573('0x35')])&&this[_0x1573('0x16')](_0x3afa5b['variable'][_0x1573('0x36')])){if(_[_0x1573('0x17')](this[_0x1573('0xb')][_0x3afa5b['uniqueid']])){this['channels'][_0x3afa5b[_0x1573('0x19')]]={'routeId':_0x3afa5b[_0x1573('0x34')],'variables':this[_0x1573('0x37')][_0x3afa5b['uniqueid']]};this[_0x1573('0x18')](_0x1573('0x23'),_0x1573('0x24'),this[_0x1573('0xb')][_0x3afa5b[_0x1573('0x19')]]);}}}}catch(_0x39b711){logger[_0x1573('0x26')](_0x1573('0x38'),util[_0x1573('0x28')](_0x39b711,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x1573('0x32')]=function(_0x35ee09,_0x48d369,_0x47c341){var _0x45a78e=[_0x1573('0x39'),'rtpaudioqosbridged',_0x1573('0x3a'),_0x1573('0x3b'),'rtpaudioqosloss',_0x1573('0x3c'),_0x1573('0x3d'),_0x1573('0x3e'),_0x1573('0x3f'),_0x1573('0x40'),'bridgepeer','bridgepvtcallid',_0x1573('0x41'),_0x1573('0x42'),_0x1573('0x43'),_0x1573('0x44'),_0x1573('0x45'),_0x1573('0x46'),_0x1573('0x47')];if(!_['isNil'](_0x48d369)&&!_[_0x1573('0x48')](_0x45a78e,_0x48d369)){if(_[_0x1573('0x17')](this['variables'][_0x35ee09])){this[_0x1573('0x37')][_0x35ee09]={};}this['variables'][_0x35ee09][_0x48d369]=_0x47c341;}};VoiceDialReport[_0x1573('0x15')][_0x1573('0x14')]=function(_0x50f382){try{if(this['isNotNull'](_0x50f382)){if(this[_0x1573('0xb')][_0x50f382[_0x1573('0x19')]]){this['channels'][_0x50f382['uniqueid']][_0x1573('0x49')]=moment()[_0x1573('0x1b')](_0x1573('0x1c'));this[_0x1573('0xb')][_0x50f382['uniqueid']][_0x1573('0x4a')]=moment(this[_0x1573('0xb')][_0x50f382[_0x1573('0x19')]][_0x1573('0x49')])[_0x1573('0x4b')](this[_0x1573('0xb')][_0x50f382[_0x1573('0x19')]]['starttime'],_0x1573('0x4c'));this[_0x1573('0xb')][_0x50f382[_0x1573('0x19')]][_0x1573('0x2e')]=_0x1573('0x4d');this[_0x1573('0xd')][_0x1573('0x4e')]+=0x1;if(this[_0x1573('0xb')][_0x50f382[_0x1573('0x19')]][_0x1573('0x2d')]){this['outbound'][_0x1573('0x4f')]+=0x1;this[_0x1573('0xb')][_0x50f382[_0x1573('0x19')]][_0x1573('0x50')]=moment(this[_0x1573('0xb')][_0x50f382['uniqueid']]['answertime'])[_0x1573('0x4b')](this[_0x1573('0xb')][_0x50f382['uniqueid']][_0x1573('0x51')],'seconds');this[_0x1573('0xb')][_0x50f382[_0x1573('0x19')]][_0x1573('0x52')]=moment(this[_0x1573('0xb')][_0x50f382[_0x1573('0x19')]][_0x1573('0x49')])[_0x1573('0x4b')](this['channels'][_0x50f382[_0x1573('0x19')]][_0x1573('0x2d')],_0x1573('0x4c'));this[_0x1573('0xd')]['sumHoldTime']+=this[_0x1573('0xb')][_0x50f382['uniqueid']]['holdtime']||0x0;this[_0x1573('0xd')]['sumBillable']+=this[_0x1573('0xb')][_0x50f382['uniqueid']]['billableseconds'];}this[_0x1573('0xd')]['sumDuration']+=this[_0x1573('0xb')][_0x50f382[_0x1573('0x19')]][_0x1573('0x4a')];ami['emit']('custom:voiceDialReport',this['channels'][_0x50f382[_0x1573('0x19')]]);ami['emit'](_0x1573('0x53'),this[_0x1573('0xb')][_0x50f382[_0x1573('0x19')]]);this['emit'](_0x1573('0x23'),'voice_outbound:save',this[_0x1573('0xd')]);this[_0x1573('0x18')](_0x1573('0x23'),_0x1573('0x54'),this['channels'][_0x50f382[_0x1573('0x19')]]);delete this[_0x1573('0xb')][_0x50f382[_0x1573('0x19')]];}if(this[_0x1573('0x37')][_0x50f382[_0x1573('0x19')]]){delete this[_0x1573('0x37')][_0x50f382[_0x1573('0x19')]];}}}catch(_0x1414bf){logger[_0x1573('0x26')](_0x1573('0x55'),util[_0x1573('0x28')](_0x1414bf,{'showHidden':![],'depth':null}));}};module[_0x1573('0x56')]=VoiceDialReport; \ No newline at end of file +var _0xe3b8=['connectedlinename','answertime','lastevent','connect','custom:dialconnect','[syncDialEnd][VoiceDialReport]','syncVarSet','addVariable','keys','variable','value','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','isNil','includes','duration','endtime','diff','starttime','seconds','total','answered','holdtime','sumHoldTime','sumBillable','billableseconds','sumDuration','custom:voiceDialReport','[syncHangup][VoiceDialReport]','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','hangup','prototype','isNotNull','isUndefined','emit','channels','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','connectedlinenum'];(function(_0x229de0,_0x2d9878){var _0x20bb99=function(_0x30fa4a){while(--_0x30fa4a){_0x229de0['push'](_0x229de0['shift']());}};_0x20bb99(++_0x2d9878);}(_0xe3b8,0xd9));var _0x8e3b=function(_0x42598e,_0x21214c){_0x42598e=_0x42598e-0x0;var _0xc13070=_0xe3b8[_0x42598e];return _0xc13070;};'use strict';var _=require(_0x8e3b('0x0'));var moment=require(_0x8e3b('0x1'));var util=require('util');var Redis=require(_0x8e3b('0x2'));var config=require(_0x8e3b('0x3'));var logger=require(_0x8e3b('0x4'))('ami');var ami=require(_0x8e3b('0x5'));config[_0x8e3b('0x6')]=_[_0x8e3b('0x7')](config['redis'],{'host':_0x8e3b('0x8'),'port':0x18eb});var io=require(_0x8e3b('0x9'))(new Redis(config['redis']));function VoiceDialReport(_0x290cb4){this['channels']=_0x290cb4[_0x8e3b('0xa')];this[_0x8e3b('0xb')]=_0x290cb4['outbound'];this[_0x8e3b('0xc')]={};ami['on'](_0x8e3b('0xd'),this[_0x8e3b('0xe')][_0x8e3b('0xf')](this));ami['on'](_0x8e3b('0x10'),this[_0x8e3b('0x11')]['bind'](this));ami['on'](_0x8e3b('0x12'),this['syncVarSet']['bind'](this));ami['on'](_0x8e3b('0x13'),this['syncHangup'][_0x8e3b('0xf')](this));}VoiceDialReport[_0x8e3b('0x14')][_0x8e3b('0x15')]=function(_0x33bb2f){return _0x33bb2f!==null&&!_[_0x8e3b('0x16')](_0x33bb2f);};VoiceDialReport[_0x8e3b('0x14')][_0x8e3b('0x17')]=function(_0x37c5dd,_0x129e14,_0x2b95d7){io['to'](_0x37c5dd)['emit'](_0x129e14,_0x2b95d7);};VoiceDialReport[_0x8e3b('0x14')]['syncDialBegin']=function(_0x3ba571){try{if(this[_0x8e3b('0x15')](_0x3ba571)){if(this[_0x8e3b('0x18')][_0x3ba571[_0x8e3b('0x19')]]){_[_0x8e3b('0x1a')](this[_0x8e3b('0x18')][_0x3ba571[_0x8e3b('0x19')]],{'starttime':moment()[_0x8e3b('0x1b')](_0x8e3b('0x1c')),'lastevent':_0x8e3b('0x1d'),'interface':_0x3ba571[_0x8e3b('0x1e')][_0x8e3b('0x1f')](0x0,_0x3ba571['channel'][_0x8e3b('0x20')]('-')),'membername':_0x3ba571[_0x8e3b('0x1e')][_0x8e3b('0x1f')](_0x3ba571[_0x8e3b('0x1e')][_0x8e3b('0x20')]('/')+0x1,_0x3ba571[_0x8e3b('0x1e')][_0x8e3b('0x20')]('-'))},_[_0x8e3b('0x21')](_0x3ba571,[_0x8e3b('0x22'),_0x8e3b('0x23')]));this['emit'](_0x8e3b('0x24'),_0x8e3b('0x25'),this['channels'][_0x3ba571[_0x8e3b('0x19')]]);ami[_0x8e3b('0x17')](_0x8e3b('0x26'),this[_0x8e3b('0x18')][_0x3ba571[_0x8e3b('0x19')]]);}}}catch(_0x229d04){logger[_0x8e3b('0x27')](_0x8e3b('0x28'),util[_0x8e3b('0x29')](_0x229d04,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8e3b('0x14')][_0x8e3b('0x11')]=function(_0x5efa2f){try{if(this[_0x8e3b('0x15')](_0x5efa2f)){if(this[_0x8e3b('0x18')][_0x5efa2f[_0x8e3b('0x19')]]){this[_0x8e3b('0x18')][_0x5efa2f[_0x8e3b('0x19')]][_0x8e3b('0x2a')]=_0x5efa2f['dialstatus'];if(_0x5efa2f[_0x8e3b('0x2a')]==='ANSWER'){this[_0x8e3b('0x18')][_0x5efa2f[_0x8e3b('0x19')]][_0x8e3b('0x2b')]=_0x5efa2f[_0x8e3b('0x2b')];this[_0x8e3b('0x18')][_0x5efa2f['uniqueid']][_0x8e3b('0x2c')]=_0x5efa2f['connectedlinename'];this['channels'][_0x5efa2f[_0x8e3b('0x19')]][_0x8e3b('0x2d')]=moment()[_0x8e3b('0x1b')](_0x8e3b('0x1c'));this[_0x8e3b('0x18')][_0x5efa2f[_0x8e3b('0x19')]][_0x8e3b('0x2e')]=_0x8e3b('0x2f');ami[_0x8e3b('0x17')](_0x8e3b('0x30'),this[_0x8e3b('0x18')][_0x5efa2f['uniqueid']]);}this[_0x8e3b('0x17')]('voice:outbound',_0x8e3b('0x25'),this['channels'][_0x5efa2f[_0x8e3b('0x19')]]);}}}catch(_0x3bc88c){logger[_0x8e3b('0x27')](_0x8e3b('0x31'),util[_0x8e3b('0x29')](_0x3bc88c,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8e3b('0x14')][_0x8e3b('0x32')]=function(_0x2d0dd3){try{if(this['isNotNull'](_0x2d0dd3)){this[_0x8e3b('0x33')](_0x2d0dd3[_0x8e3b('0x19')],_[_0x8e3b('0x34')](_0x2d0dd3[_0x8e3b('0x35')])[0x0],_0x2d0dd3[_0x8e3b('0x36')]);if(this[_0x8e3b('0x15')](_0x2d0dd3[_0x8e3b('0x35')])&&this[_0x8e3b('0x15')](_0x2d0dd3[_0x8e3b('0x35')]['outboundrouteid'])){if(_[_0x8e3b('0x16')](this['channels'][_0x2d0dd3[_0x8e3b('0x19')]])){this[_0x8e3b('0x18')][_0x2d0dd3[_0x8e3b('0x19')]]={'routeId':_0x2d0dd3[_0x8e3b('0x36')],'variables':this[_0x8e3b('0xc')][_0x2d0dd3[_0x8e3b('0x19')]]};this[_0x8e3b('0x17')](_0x8e3b('0x24'),_0x8e3b('0x25'),this[_0x8e3b('0x18')][_0x2d0dd3['uniqueid']]);}}}}catch(_0x35c5df){logger[_0x8e3b('0x27')](_0x8e3b('0x37'),util[_0x8e3b('0x29')](_0x35c5df,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8e3b('0x14')][_0x8e3b('0x33')]=function(_0x3d646a,_0x5c0633,_0x35673a){var _0x1d9693=[_0x8e3b('0x38'),_0x8e3b('0x39'),'rtpaudioqosjitter',_0x8e3b('0x3a'),'rtpaudioqosloss',_0x8e3b('0x3b'),_0x8e3b('0x3c'),'rtpaudioqosrttbridged','sipcallid',_0x8e3b('0x3d'),_0x8e3b('0x3e'),_0x8e3b('0x3f'),_0x8e3b('0x40'),_0x8e3b('0x41'),_0x8e3b('0x42'),_0x8e3b('0x43'),_0x8e3b('0x44'),_0x8e3b('0x45'),'memberrealtime'];if(!_[_0x8e3b('0x46')](_0x5c0633)&&!_[_0x8e3b('0x47')](_0x1d9693,_0x5c0633)){if(_[_0x8e3b('0x16')](this[_0x8e3b('0xc')][_0x3d646a])){this[_0x8e3b('0xc')][_0x3d646a]={};}this[_0x8e3b('0xc')][_0x3d646a][_0x5c0633]=_0x35673a;}};VoiceDialReport[_0x8e3b('0x14')]['syncHangup']=function(_0x4ece14){try{if(this['isNotNull'](_0x4ece14)){if(this[_0x8e3b('0x18')][_0x4ece14[_0x8e3b('0x19')]]){this[_0x8e3b('0x18')][_0x4ece14['uniqueid']]['endtime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x4ece14['uniqueid']][_0x8e3b('0x48')]=moment(this[_0x8e3b('0x18')][_0x4ece14[_0x8e3b('0x19')]][_0x8e3b('0x49')])[_0x8e3b('0x4a')](this[_0x8e3b('0x18')][_0x4ece14['uniqueid']][_0x8e3b('0x4b')],_0x8e3b('0x4c'));this[_0x8e3b('0x18')][_0x4ece14['uniqueid']][_0x8e3b('0x2e')]='complete';this[_0x8e3b('0xb')][_0x8e3b('0x4d')]+=0x1;if(this['channels'][_0x4ece14['uniqueid']]['answertime']){this[_0x8e3b('0xb')][_0x8e3b('0x4e')]+=0x1;this[_0x8e3b('0x18')][_0x4ece14[_0x8e3b('0x19')]][_0x8e3b('0x4f')]=moment(this['channels'][_0x4ece14[_0x8e3b('0x19')]][_0x8e3b('0x2d')])['diff'](this[_0x8e3b('0x18')][_0x4ece14[_0x8e3b('0x19')]][_0x8e3b('0x4b')],_0x8e3b('0x4c'));this[_0x8e3b('0x18')][_0x4ece14[_0x8e3b('0x19')]]['billableseconds']=moment(this[_0x8e3b('0x18')][_0x4ece14['uniqueid']][_0x8e3b('0x49')])[_0x8e3b('0x4a')](this[_0x8e3b('0x18')][_0x4ece14[_0x8e3b('0x19')]]['answertime'],_0x8e3b('0x4c'));this[_0x8e3b('0xb')][_0x8e3b('0x50')]+=this['channels'][_0x4ece14[_0x8e3b('0x19')]]['holdtime']||0x0;this['outbound'][_0x8e3b('0x51')]+=this[_0x8e3b('0x18')][_0x4ece14[_0x8e3b('0x19')]][_0x8e3b('0x52')];}this[_0x8e3b('0xb')][_0x8e3b('0x53')]+=this[_0x8e3b('0x18')][_0x4ece14[_0x8e3b('0x19')]][_0x8e3b('0x48')];ami[_0x8e3b('0x17')](_0x8e3b('0x54'),this[_0x8e3b('0x18')][_0x4ece14[_0x8e3b('0x19')]]);ami[_0x8e3b('0x17')]('custom:dialend',this[_0x8e3b('0x18')][_0x4ece14[_0x8e3b('0x19')]]);this[_0x8e3b('0x17')](_0x8e3b('0x24'),'voice_outbound:save',this['outbound']);this['emit'](_0x8e3b('0x24'),'voice_outbound_channel:remove',this[_0x8e3b('0x18')][_0x4ece14[_0x8e3b('0x19')]]);delete this[_0x8e3b('0x18')][_0x4ece14['uniqueid']];}if(this[_0x8e3b('0xc')][_0x4ece14[_0x8e3b('0x19')]]){delete this['variables'][_0x4ece14[_0x8e3b('0x19')]];}}}catch(_0x22d095){logger[_0x8e3b('0x27')](_0x8e3b('0x55'),util['inspect'](_0x22d095,{'showHidden':![],'depth':null}));}};module[_0x8e3b('0x56')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 629b661..4290b05 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 _0x6b0b=['blindtransfer','syncBlindTransfer','isUndefined','isEmpty','hasOwnProperty','originated','talking','queueStatusComplete','unlockRR','clearZombieChannels','enqueue','isNil','Action','status','channel','catch','No\x20such\x20channel','error','[voiceQueueReport][checkChannel]','[voiceQueueReport][checkQueueReport]','[voiceQueueReport][checkVariables]','syncFullyBooted','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','inspect','emit','emitVoiceQueueChannelSave','format','voice:queue:%s','name','voice_queue_channel:save','voice_queue_channel:remove','emitVoiceQueueSummary','type','inbound','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','Trunk','active','callerid','Interval','stringify','voice_queue:save','isNotNull','loopQueueShow','queues','[queues]','loopQueueSummary','then','queue','countBy','callers','toNumber','loggedin','custom:queuesummary','[syncQueueSummary][VoiceQueueReport]','syncNewExten','uniqueid','position','count','merge','pick','push','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandon','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','ABANDONED','lastAssignedTo','[syncQueueCallerAbandon][VoiceQueueReport]','syncQueueCallerLeave','queuecallerleaveAt','connectedlinenum','connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','COMPLETEDBYAGENT','assigned','membername','queuecallerexit','queuecallerexitAt','transfer','reason','queuecallerexitreason','COMPLETED','local/','add','FORWARD','transferexten','destexten','transferuniqueid','linkedid','COMPLETEDBY','toUpperCase','[syncAgentComplete][VoiceQueueReport]','syncVarSet','addVariable','keys','variable','value','variables','[syncVarSet][VoiceQueueReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberrealtime','includes','queuecallerjoinAt','length','milliseconds','diff','seconds','sumBillable','lastevent','custom:queuecallerunmanaged','[syncHangup][VoiceQueueReport]','syncAttendedTransfer','transfereeuniqueid','secondtransfererexten','ATTENDEDTRANSFER','secondtransfereruniqueid','switch','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','transfertype','ATTENDED','[syncAttendedTransfer][VoiceQueueReport]','BLINDTRANSFER','BLIND','BlindTransfer','context','transfererchannel','[syncBlindTransfer][VoiceQueueReport]','mohstarttime','[syncMusicOnHoldStart][VoiceQueueReport]','mohtime','[syncMusicOnHoldStop][VoiceQueueReport]','lodash','bluebird','util','md5','ioredis','../../../config/environment','../../../config/logger','../model/queueReport','defaults','redis','localhost','socket.io-emitter','prototype','tail','sequence','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','queuesummary','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','syncQueueCallerAbandon','queuecallerleave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','hangup','syncHangup','fullybooted','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6b0b,0x16d));var _0xb6b0=function(_0x1e3beb,_0x210425){_0x1e3beb=_0x1e3beb-0x0;var _0x5d6411=_0x6b0b[_0x1e3beb];return _0x5d6411;};'use strict';var _=require(_0xb6b0('0x0'));var moment=require('moment');var BPromise=require(_0xb6b0('0x1'));var util=require(_0xb6b0('0x2'));var md5=require(_0xb6b0('0x3'));var Redis=require(_0xb6b0('0x4'));var config=require(_0xb6b0('0x5'));var logger=require(_0xb6b0('0x6'))('ami');var ami=require('../ami');var QueueReport=require(_0xb6b0('0x7'));config['redis']=_[_0xb6b0('0x8')](config[_0xb6b0('0x9')],{'host':_0xb6b0('0xa'),'port':0x18eb});var io=require(_0xb6b0('0xb'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xb6b0('0xc')]['enqueue']=function(_0x116057){this[_0xb6b0('0xd')]=this[_0xb6b0('0xd')]?this[_0xb6b0('0xd')]['finally'](_0x116057):_0x116057();};function VoiceQueueReport(_0x599796){this[_0xb6b0('0xe')]=new Sequence();this[_0xb6b0('0xf')]={};this[_0xb6b0('0x10')]=_0x599796[_0xb6b0('0x10')];this[_0xb6b0('0x11')]=_0x599796[_0xb6b0('0x12')];this[_0xb6b0('0x13')]=_0x599796['voiceQueues'];this[_0xb6b0('0x14')]=!![];this['campaigns']=_0x599796[_0xb6b0('0x15')];this['variables']={};ami['on'](_0xb6b0('0x16'),this[_0xb6b0('0x17')][_0xb6b0('0x18')](this));ami['on'](_0xb6b0('0x19'),this[_0xb6b0('0x1a')][_0xb6b0('0x18')](this));ami['on'](_0xb6b0('0x1b'),this[_0xb6b0('0x1c')][_0xb6b0('0x18')](this));ami['on']('queuecallerabandon',this[_0xb6b0('0x1d')][_0xb6b0('0x18')](this));ami['on'](_0xb6b0('0x1e'),this['syncQueueCallerLeave']['bind'](this));ami['on'](_0xb6b0('0x1f'),this[_0xb6b0('0x20')][_0xb6b0('0x18')](this));ami['on'](_0xb6b0('0x21'),this[_0xb6b0('0x22')][_0xb6b0('0x18')](this));ami['on'](_0xb6b0('0x23'),this['syncVarSet'][_0xb6b0('0x18')](this));ami['on'](_0xb6b0('0x24'),this[_0xb6b0('0x25')][_0xb6b0('0x18')](this));ami['on'](_0xb6b0('0x26'),this['syncFullyBooted'][_0xb6b0('0x18')](this));ami['on'](_0xb6b0('0x27'),this[_0xb6b0('0x28')][_0xb6b0('0x18')](this));ami['on']('musiconholdstop',this[_0xb6b0('0x29')][_0xb6b0('0x18')](this));ami['on'](_0xb6b0('0x2a'),this['syncAttendedTransfer'][_0xb6b0('0x18')](this));ami['on'](_0xb6b0('0x2b'),this[_0xb6b0('0x2c')][_0xb6b0('0x18')](this));this['loopQueueSummary']();this['loopQueueShow']();}function isNotNull(_0x47f56d){return _0x47f56d!==null&&!_[_0xb6b0('0x2d')](_0x47f56d);}function clearChannels(_0x5744b9){if(!_[_0xb6b0('0x2e')](_0x5744b9)){for(var _0xcb58ec in _0x5744b9){if(_0x5744b9[_0xb6b0('0x2f')](_0xcb58ec)){delete _0x5744b9[_0xcb58ec];}}}}function clearCampaigns(_0x3dde65){if(!_[_0xb6b0('0x2e')](_0x3dde65)){for(var _0x59fd9e in _0x3dde65){if(_0x3dde65['hasOwnProperty'](_0x59fd9e)){_0x3dde65[_0x59fd9e][_0xb6b0('0x30')]=0x0;}}}}function clearVoiceQueues(_0x2dbf5a){if(!_[_0xb6b0('0x2e')](_0x2dbf5a)){for(var _0x3e115a in _0x2dbf5a){if(_0x2dbf5a[_0xb6b0('0x2f')](_0x3e115a)){_0x2dbf5a[_0x3e115a][_0xb6b0('0x30')]=0x0;_0x2dbf5a[_0x3e115a][_0xb6b0('0x31')]=0x0;_0x2dbf5a[_0x3e115a]['pTalking']=0x0;_0x2dbf5a[_0x3e115a]['waiting']=0x0;_0x2dbf5a[_0x3e115a][_0xb6b0('0x32')]=!![];}}}}function clearAgentBooked(_0x3921f4){if(!_[_0xb6b0('0x2e')](_0x3921f4)){for(var _0x5aab6e in _0x3921f4){if(_0x3921f4[_0xb6b0('0x2f')](_0x5aab6e)){_0x3921f4[_0x5aab6e][_0xb6b0('0x33')]=!![];}}}}VoiceQueueReport[_0xb6b0('0xc')][_0xb6b0('0x34')]=function(){var _0x512283=this;for(var _0x4b8213 in this[_0xb6b0('0x11')]){if(this[_0xb6b0('0x11')][_0xb6b0('0x2f')](_0x4b8213)&&!this[_0xb6b0('0x11')][_0x4b8213]['switch']){this['sequence'][_0xb6b0('0x35')](function(){if(!_[_0xb6b0('0x36')](_0x512283[_0xb6b0('0x11')][_0x4b8213])){return ami[_0xb6b0('0x37')]({'action':_0xb6b0('0x38'),'channel':_0x512283[_0xb6b0('0x11')][_0x4b8213][_0xb6b0('0x39')]})[_0xb6b0('0x3a')](function(_0x2ee4d6){if(_0x2ee4d6['message']===_0xb6b0('0x3b')){setTimeout(function(){if(_0x512283[_0xb6b0('0x11')][_0x4b8213]){delete _0x512283[_0xb6b0('0x11')][_0x4b8213];logger[_0xb6b0('0x3c')](_0xb6b0('0x3d'),_0x4b8213);}if(_0x512283['queueReports'][_0x4b8213]){delete _0x512283['queueReports'][_0x4b8213];logger[_0xb6b0('0x3c')](_0xb6b0('0x3e'),_0x4b8213);}if(_0x512283['variables'][_0x4b8213]){delete _0x512283['variables'][_0x4b8213];logger[_0xb6b0('0x3c')](_0xb6b0('0x3f'),_0x4b8213);}},0x1f40);}});}});}}};VoiceQueueReport[_0xb6b0('0xc')][_0xb6b0('0x40')]=function(){logger['error'](_0xb6b0('0x41'));clearChannels(this['channels']);this[_0xb6b0('0x42')](this['queueReports']);clearAgentBooked(this[_0xb6b0('0x10')]);clearVoiceQueues(this[_0xb6b0('0x13')]);clearCampaigns(this[_0xb6b0('0x15')]);};VoiceQueueReport['prototype']['clearQueueReport']=function(_0xea82d2){var _0x4ba530=this;if(!_['isEmpty'](_0xea82d2)){for(var _0x7b0464 in _0xea82d2){if(_0xea82d2[_0xb6b0('0x2f')](_0x7b0464)){_0x4ba530[_0xb6b0('0x43')](_0xea82d2[_0x7b0464]);delete _0xea82d2[_0x7b0464];}}}};function loggerCatch(_0x409d38){return function(_0x2fa6d5){logger['error'](_0x409d38,util[_0xb6b0('0x44')](_0x2fa6d5,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0xb6b0('0xc')][_0xb6b0('0x45')]=function(_0x290cf0,_0x3a43b8,_0x1379cf){io['to'](_0x290cf0)[_0xb6b0('0x45')](_0x3a43b8,_0x1379cf);};VoiceQueueReport['prototype'][_0xb6b0('0x46')]=function(_0x44b903){this['emit'](util[_0xb6b0('0x47')](_0xb6b0('0x48'),_0x44b903[_0xb6b0('0x49')]),_0xb6b0('0x4a'),_0x44b903);};VoiceQueueReport[_0xb6b0('0xc')][_0xb6b0('0x43')]=function(_0x103810){this[_0xb6b0('0x45')](util[_0xb6b0('0x47')]('voice:queue:%s',_0x103810[_0xb6b0('0x49')]),_0xb6b0('0x4b'),_0x103810);};VoiceQueueReport[_0xb6b0('0xc')][_0xb6b0('0x4c')]=function(_0x1d891a){if(_0x1d891a[_0xb6b0('0x4d')]===_0xb6b0('0x4e')){var _0x5c0d3f={'id':_0x1d891a['id'],'name':_0x1d891a[_0xb6b0('0x49')],'strategy':_0x1d891a[_0xb6b0('0x4f')],'answered':_0x1d891a[_0xb6b0('0x50')],'available':_0x1d891a[_0xb6b0('0x51')],'loggedIn':_0x1d891a[_0xb6b0('0x52')],'pTalking':_0x1d891a[_0xb6b0('0x53')],'sumBillable':_0x1d891a['sumBillable'],'sumDuration':_0x1d891a[_0xb6b0('0x54')],'sumHoldTime':_0x1d891a[_0xb6b0('0x55')]||0x0,'talking':_0x1d891a[_0xb6b0('0x31')],'total':_0x1d891a[_0xb6b0('0x56')],'type':_0x1d891a[_0xb6b0('0x4d')],'unmanaged':_0x1d891a[_0xb6b0('0x57')],'abandoned':_0x1d891a[_0xb6b0('0x58')],'waiting':_0x1d891a[_0xb6b0('0x59')]};if(_0x1d891a[_0xb6b0('0x5a')]){_0x5c0d3f['Trunk']={'id':_0x1d891a[_0xb6b0('0x5a')]['id'],'name':_0x1d891a[_0xb6b0('0x5a')][_0xb6b0('0x49')],'active':_0x1d891a['Trunk'][_0xb6b0('0x5b')],'callerid':_0x1d891a[_0xb6b0('0x5a')][_0xb6b0('0x5c')]};}if(_0x1d891a['Interval']){_0x5c0d3f[_0xb6b0('0x5d')]={'id':_0x1d891a[_0xb6b0('0x5d')]['id'],'name':_0x1d891a['Interval'][_0xb6b0('0x49')]};}var _0x26f075=md5(JSON[_0xb6b0('0x5e')](_0x5c0d3f));if(_0x1d891a[_0xb6b0('0x3')]!==_0x26f075){_0x1d891a[_0xb6b0('0x3')]=_0x26f075;this['emit'](util[_0xb6b0('0x47')](_0xb6b0('0x48'),_0x5c0d3f[_0xb6b0('0x49')]),_0xb6b0('0x5f'),_0x5c0d3f);}}};VoiceQueueReport['prototype'][_0xb6b0('0x60')]=function(_0xe4154a){return _0xe4154a!==null&&!_[_0xb6b0('0x2d')](_0xe4154a);};VoiceQueueReport[_0xb6b0('0xc')][_0xb6b0('0x61')]=function(){var _0x2207fe=this;setInterval(function(){_0x2207fe['clearZombieChannels']();ami[_0xb6b0('0x37')]({'action':_0xb6b0('0x62')})[_0xb6b0('0x3a')](loggerCatch(_0xb6b0('0x63')));},0x2710);};VoiceQueueReport[_0xb6b0('0xc')][_0xb6b0('0x64')]=function(){var _0x5e3bd4=this;setInterval(function(){if(_0x5e3bd4[_0xb6b0('0x14')]){return ami[_0xb6b0('0x37')]({'action':_0xb6b0('0x16')})[_0xb6b0('0x65')](function(_0x54d102){_0x5e3bd4[_0xb6b0('0x14')]=![];})[_0xb6b0('0x3a')](loggerCatch('[queuesummary]'));}},0x3e8);};VoiceQueueReport[_0xb6b0('0xc')][_0xb6b0('0x17')]=function(_0x304558){try{if(this[_0xb6b0('0x60')](_0x304558)&&this[_0xb6b0('0x60')](_0x304558['queue'])){if(this['voiceQueues'][_0x304558[_0xb6b0('0x66')]]){var _0x97ba73=_[_0xb6b0('0x67')](this[_0xb6b0('0x11')],_0xb6b0('0x66'))[_0x304558[_0xb6b0('0x66')]]||0x0;var _0x3a72c9=_0x97ba73-_0x304558[_0xb6b0('0x68')];if(this[_0xb6b0('0x13')][_0x304558[_0xb6b0('0x66')]][_0xb6b0('0x59')]!==_['toNumber'](_0x304558['callers'])||this[_0xb6b0('0x13')][_0x304558[_0xb6b0('0x66')]][_0xb6b0('0x52')]!==_[_0xb6b0('0x69')](_0x304558[_0xb6b0('0x6a')])||this[_0xb6b0('0x13')][_0x304558[_0xb6b0('0x66')]][_0xb6b0('0x51')]!==_[_0xb6b0('0x69')](_0x304558[_0xb6b0('0x51')])||this['voiceQueues'][_0x304558['queue']][_0xb6b0('0x31')]!==_0x3a72c9){this[_0xb6b0('0x13')][_0x304558[_0xb6b0('0x66')]][_0xb6b0('0x59')]=_[_0xb6b0('0x69')](_0x304558[_0xb6b0('0x68')]);this['voiceQueues'][_0x304558[_0xb6b0('0x66')]][_0xb6b0('0x52')]=_['toNumber'](_0x304558[_0xb6b0('0x6a')]);this[_0xb6b0('0x13')][_0x304558['queue']][_0xb6b0('0x51')]=_[_0xb6b0('0x69')](_0x304558['available']);this[_0xb6b0('0x13')][_0x304558['queue']][_0xb6b0('0x31')]=_0x3a72c9>0x0?_0x3a72c9:0x0;this[_0xb6b0('0x13')][_0x304558['queue']][_0xb6b0('0x31')]=this[_0xb6b0('0x13')][_0x304558[_0xb6b0('0x66')]][_0xb6b0('0x31')]>_[_0xb6b0('0x69')](_0x304558[_0xb6b0('0x6a')])?_['toNumber'](_0x304558[_0xb6b0('0x6a')]):this['voiceQueues'][_0x304558['queue']]['talking'];this[_0xb6b0('0x4c')](this[_0xb6b0('0x13')][_0x304558[_0xb6b0('0x66')]]);}ami[_0xb6b0('0x45')](_0xb6b0('0x6b'),this[_0xb6b0('0x13')][_0x304558[_0xb6b0('0x66')]]);}}}catch(_0x374b8c){logger[_0xb6b0('0x3c')](_0xb6b0('0x6c'),util[_0xb6b0('0x44')](_0x374b8c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xb6b0('0x1a')]=function(_0x212e0d){this[_0xb6b0('0x14')]=!![];};VoiceQueueReport[_0xb6b0('0xc')][_0xb6b0('0x6d')]=function(_0x5f0aaa){};VoiceQueueReport[_0xb6b0('0xc')][_0xb6b0('0x1c')]=function(_0x5e9a56){try{if(this[_0xb6b0('0x60')](_0x5e9a56)){if(_['isUndefined'](this['queueReports'][_0x5e9a56[_0xb6b0('0x6e')]])){this[_0xb6b0('0xf')][_0x5e9a56[_0xb6b0('0x6e')]]=[];this[_0xb6b0('0x11')][_0x5e9a56[_0xb6b0('0x6e')]]={};}var _0x2b70e3=new QueueReport();_0x2b70e3[_0xb6b0('0x49')]=_0x5e9a56[_0xb6b0('0x66')];_0x2b70e3[_0xb6b0('0x4d')]=this['voiceQueues'][_0x2b70e3[_0xb6b0('0x49')]]&&this[_0xb6b0('0x13')][_0x2b70e3['name']]['type']?this[_0xb6b0('0x13')][_0x2b70e3[_0xb6b0('0x49')]][_0xb6b0('0x4d')]||_0xb6b0('0x4e'):'inbound';_0x2b70e3['queue']=_0x5e9a56[_0xb6b0('0x66')];_0x2b70e3['queuecallerjoinAt']=moment()[_0xb6b0('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x2b70e3[_0xb6b0('0x6f')]=_0x5e9a56[_0xb6b0('0x6f')];_0x2b70e3[_0xb6b0('0x70')]=_0x5e9a56[_0xb6b0('0x70')];_[_0xb6b0('0x71')](_0x2b70e3,_[_0xb6b0('0x72')](_0x5e9a56,_['keys'](_0x2b70e3)));this[_0xb6b0('0xf')][_0x5e9a56[_0xb6b0('0x6e')]][_0xb6b0('0x73')](_0x2b70e3);this[_0xb6b0('0x11')][_0x5e9a56[_0xb6b0('0x6e')]]=_0x2b70e3;this['emitVoiceQueueChannelSave'](_0x2b70e3);}}catch(_0x8815b5){logger['error']('[syncQueueCallerJoin][VoiceQueueReport]',util[_0xb6b0('0x44')](_0x8815b5,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xb6b0('0x1d')]=function(_0xc11644){try{if(this[_0xb6b0('0x60')](_0xc11644)){if(this[_0xb6b0('0xf')][_0xc11644[_0xb6b0('0x6e')]]){var _0x39215f=_[_0xb6b0('0x74')](this['queueReports'][_0xc11644[_0xb6b0('0x6e')]]);_0x39215f[_0xb6b0('0x75')]=![];_0x39215f[_0xb6b0('0x76')]=null;_0x39215f[_0xb6b0('0x77')]=_0xc11644['holdtime'];_0x39215f[_0xb6b0('0x78')]=_0xc11644[_0xb6b0('0x78')];_0x39215f[_0xb6b0('0x79')]=!![];_0x39215f[_0xb6b0('0x7a')]=moment()[_0xb6b0('0x47')](_0xb6b0('0x7b'));_0x39215f['queuecallerexitreason']=_0xb6b0('0x7c');_0x39215f[_0xb6b0('0x7d')]=null;this['channels'][_0xc11644['uniqueid']]=_0x39215f;this[_0xb6b0('0x43')](_0x39215f);}}}catch(_0x5a7b36){logger[_0xb6b0('0x3c')](_0xb6b0('0x7e'),util[_0xb6b0('0x44')](_0x5a7b36,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb6b0('0xc')][_0xb6b0('0x7f')]=function(_0x4451ea){try{if(this[_0xb6b0('0x60')](_0x4451ea)){if(this['queueReports'][_0x4451ea['uniqueid']]){var _0x1c8c9f=_[_0xb6b0('0x74')](this['queueReports'][_0x4451ea['uniqueid']]);_0x1c8c9f[_0xb6b0('0x80')]=moment()[_0xb6b0('0x47')](_0xb6b0('0x7b'));_0x1c8c9f[_0xb6b0('0x81')]=_0x4451ea[_0xb6b0('0x81')];_0x1c8c9f[_0xb6b0('0x82')]=_0x4451ea[_0xb6b0('0x82')];this[_0xb6b0('0x11')][_0x4451ea[_0xb6b0('0x6e')]]=_0x1c8c9f;this[_0xb6b0('0x46')](_0x1c8c9f);}}}catch(_0x57eb19){logger[_0xb6b0('0x3c')](_0xb6b0('0x83'),util[_0xb6b0('0x44')](_0x57eb19,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb6b0('0xc')][_0xb6b0('0x22')]=function(_0x2011ad){try{if(this[_0xb6b0('0x60')](_0x2011ad)){if(this['queueReports'][_0x2011ad[_0xb6b0('0x6e')]]){var _0x1f3e7a=_[_0xb6b0('0x74')](this[_0xb6b0('0xf')][_0x2011ad[_0xb6b0('0x6e')]]);_0x1f3e7a[_0xb6b0('0x75')]=!![];_0x1f3e7a['queuecallerexitreason']=_0xb6b0('0x84');}}}catch(_0x3ef4a9){logger[_0xb6b0('0x3c')]('[syncAgentConnect][VoiceQueueReport]',util['inspect'](_0x3ef4a9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb6b0('0xc')][_0xb6b0('0x20')]=function(_0x16d81a){try{if(this[_0xb6b0('0x60')](_0x16d81a)){if(this[_0xb6b0('0xf')][_0x16d81a[_0xb6b0('0x6e')]]){var _0x193fa0=_[_0xb6b0('0x74')](this[_0xb6b0('0xf')][_0x16d81a[_0xb6b0('0x6e')]]);_0x193fa0[_0xb6b0('0x79')]=![];_0x193fa0[_0xb6b0('0x7a')]=null;_0x193fa0[_0xb6b0('0x85')]=!![];_0x193fa0['lastAssignedTo']=_0x16d81a[_0xb6b0('0x86')];_0x193fa0[_0xb6b0('0x77')]=_0x16d81a['holdtime'];_0x193fa0[_0xb6b0('0x75')]=!![];_0x193fa0[_0xb6b0('0x87')]=![];_0x193fa0[_0xb6b0('0x88')]=null;if(!_0x193fa0[_0xb6b0('0x89')]){if(_0x16d81a[_0xb6b0('0x8a')]==_0xb6b0('0x89')){_0x193fa0[_0xb6b0('0x8b')]=_0xb6b0('0x8c');}else{if(_['startsWith'](_0x16d81a[_0xb6b0('0x39')]['toLowerCase'](),_0xb6b0('0x8d'))){if(this[_0xb6b0('0xf')][_0x16d81a['linkedid']]){var _0x2a9670=_['last'](this[_0xb6b0('0xf')][_0x16d81a['linkedid']]);_0x2a9670[_0xb6b0('0x75')]=![];_0x2a9670[_0xb6b0('0x87')]=!![];_0x2a9670[_0xb6b0('0x88')]=moment(_0x193fa0['queuecallerjoinAt'])[_0xb6b0('0x8e')](_0x16d81a['holdtime'],'seconds')['format'](_0xb6b0('0x7b'));_0x2a9670[_0xb6b0('0x8b')]='FORWARDTRANSFER';_0x2a9670[_0xb6b0('0x89')]=!![];_0x2a9670['transfertype']=_0xb6b0('0x8f');_0x2a9670[_0xb6b0('0x90')]=_0x16d81a[_0xb6b0('0x91')];_0x2a9670[_0xb6b0('0x92')]=_0x16d81a[_0xb6b0('0x6e')];var _0x1057a7=this[_0xb6b0('0xf')][_0x16d81a[_0xb6b0('0x93')]];this['queueReports'][_0x16d81a[_0xb6b0('0x93')]]=this['queueReports'][_0x16d81a[_0xb6b0('0x6e')]];this['queueReports'][_0x16d81a['uniqueid']]=_0x1057a7;}}else{_0x193fa0[_0xb6b0('0x8b')]=_0xb6b0('0x94')+_0x16d81a[_0xb6b0('0x8a')][_0xb6b0('0x95')]();}}}this['channels'][_0x16d81a['uniqueid']]=_0x193fa0;this['emitVoiceQueueChannelRemove'](_0x193fa0);}}}catch(_0x25d62a){logger[_0xb6b0('0x3c')](_0xb6b0('0x96'),util[_0xb6b0('0x44')](_0x25d62a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb6b0('0xc')][_0xb6b0('0x97')]=function(_0x25955a){try{if(this[_0xb6b0('0x60')](_0x25955a)){this[_0xb6b0('0x98')](_0x25955a['uniqueid'],_[_0xb6b0('0x99')](_0x25955a[_0xb6b0('0x9a')])[0x0],_0x25955a['value']);if(this[_0xb6b0('0xf')][_0x25955a[_0xb6b0('0x6e')]]){var _0x25f844=_[_0xb6b0('0x74')](this['queueReports'][_0x25955a[_0xb6b0('0x6e')]]);if(_0x25f844){if(this[_0xb6b0('0x60')](_0x25955a[_0xb6b0('0x9a')])&&this[_0xb6b0('0x60')](_0x25955a[_0xb6b0('0x9a')]['queuestatus'])){switch(_0x25955a[_0xb6b0('0x9b')]){case'CONTINUE':_0x25f844[_0xb6b0('0x87')]=![];_0x25f844[_0xb6b0('0x88')]=null;break;default:_0x25f844['queuecallerexit']=!![];_0x25f844[_0xb6b0('0x88')]=moment()[_0xb6b0('0x47')](_0xb6b0('0x7b'));_0x25f844[_0xb6b0('0x80')]=moment()['format'](_0xb6b0('0x7b'));}_0x25f844[_0xb6b0('0x79')]=![];_0x25f844['queuecallerabandonAt']=null;_0x25f844[_0xb6b0('0x8b')]=_0x25955a[_0xb6b0('0x9b')];this['channels'][_0x25955a['uniqueid']]=_0x25f844;this[_0xb6b0('0x43')](_0x25f844);}else if(this['isNotNull'](_0x25955a[_0xb6b0('0x9a')])&&this[_0xb6b0('0x60')](_0x25955a[_0xb6b0('0x9a')]['queueposition'])){if(!_0x25f844[_0xb6b0('0x79')]){_0x25f844[_0xb6b0('0x87')]=!![];_0x25f844['queuecallerexitAt']=moment()['format'](_0xb6b0('0x7b'));_0x25f844['queuecallerexitreason']='EXITWITHKEY';_0x25f844[_0xb6b0('0x80')]=moment()[_0xb6b0('0x47')](_0xb6b0('0x7b'));this[_0xb6b0('0x11')][_0x25955a[_0xb6b0('0x6e')]]=_0x25f844;}}_0x25f844[_0xb6b0('0x9c')]=this[_0xb6b0('0x9c')][_0x25955a[_0xb6b0('0x6e')]];}}}}catch(_0x3af13a){logger[_0xb6b0('0x3c')](_0xb6b0('0x9d'),util[_0xb6b0('0x44')](_0x3af13a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb6b0('0xc')][_0xb6b0('0x98')]=function(_0x9d949c,_0x192dcd,_0x1ffed9){var _0x413a3e=[_0xb6b0('0x9e'),_0xb6b0('0x9f'),_0xb6b0('0xa0'),_0xb6b0('0xa1'),_0xb6b0('0xa2'),_0xb6b0('0xa3'),_0xb6b0('0xa4'),'rtpaudioqosrttbridged',_0xb6b0('0xa5'),'sipuri',_0xb6b0('0xa6'),_0xb6b0('0xa7'),_0xb6b0('0xa8'),_0xb6b0('0xa9'),_0xb6b0('0xaa'),'memberlastcall','membername','memberpenalty',_0xb6b0('0xab')];if(!_[_0xb6b0('0x36')](_0x192dcd)&&!_[_0xb6b0('0xac')](_0x413a3e,_0x192dcd)){if(_[_0xb6b0('0x2d')](this['variables'][_0x9d949c])){this[_0xb6b0('0x9c')][_0x9d949c]={};}this[_0xb6b0('0x9c')][_0x9d949c][_0x192dcd]=_0x1ffed9;}};VoiceQueueReport[_0xb6b0('0xc')][_0xb6b0('0x25')]=function(_0x1cc01e){try{if(this[_0xb6b0('0x60')](_0x1cc01e)){if(this[_0xb6b0('0xf')][_0x1cc01e[_0xb6b0('0x6e')]]){for(var _0x42ae2b=0x0,_0x57ad87={};_0x42ae2b0x0?_0x267939:0x0;this['voiceQueues'][_0x346b22[_0x44cf('0x5b')]][_0x44cf('0x2d')]=this['voiceQueues'][_0x346b22[_0x44cf('0x5b')]][_0x44cf('0x2d')]>_['toNumber'](_0x346b22[_0x44cf('0x5f')])?_[_0x44cf('0x5d')](_0x346b22['loggedin']):this['voiceQueues'][_0x346b22[_0x44cf('0x5b')]]['talking'];this[_0x44cf('0x46')](this[_0x44cf('0x10')][_0x346b22[_0x44cf('0x5b')]]);}ami[_0x44cf('0x3f')](_0x44cf('0x60'),this[_0x44cf('0x10')][_0x346b22['queue']]);}}}catch(_0x18a122){logger[_0x44cf('0x38')]('[syncQueueSummary][VoiceQueueReport]',util[_0x44cf('0x3e')](_0x18a122,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x44cf('0xb')]['syncQueueSummaryComplete']=function(_0x3d6ce3){this[_0x44cf('0x11')]=!![];};VoiceQueueReport[_0x44cf('0xb')][_0x44cf('0x61')]=function(_0x499da5){};VoiceQueueReport[_0x44cf('0xb')][_0x44cf('0x62')]=function(_0x322487){try{if(this['isNotNull'](_0x322487)){if(_[_0x44cf('0x29')](this[_0x44cf('0x3a')][_0x322487['uniqueid']])){this['queueReports'][_0x322487[_0x44cf('0x63')]]=[];this[_0x44cf('0xf')][_0x322487[_0x44cf('0x63')]]={};}var _0x20486b=new QueueReport();_0x20486b[_0x44cf('0x43')]=_0x322487[_0x44cf('0x5b')];_0x20486b[_0x44cf('0x4f')]=this['voiceQueues'][_0x20486b[_0x44cf('0x43')]]&&this[_0x44cf('0x10')][_0x20486b[_0x44cf('0x43')]][_0x44cf('0x4f')]?this[_0x44cf('0x10')][_0x20486b['name']][_0x44cf('0x4f')]||_0x44cf('0x47'):_0x44cf('0x47');_0x20486b[_0x44cf('0x5b')]=_0x322487[_0x44cf('0x5b')];_0x20486b['queuecallerjoinAt']=moment()[_0x44cf('0x41')](_0x44cf('0x64'));_0x20486b['position']=_0x322487[_0x44cf('0x65')];_0x20486b[_0x44cf('0x66')]=_0x322487[_0x44cf('0x66')];_['merge'](_0x20486b,_[_0x44cf('0x67')](_0x322487,_[_0x44cf('0x68')](_0x20486b)));this['queueReports'][_0x322487[_0x44cf('0x63')]][_0x44cf('0x69')](_0x20486b);this[_0x44cf('0xf')][_0x322487[_0x44cf('0x63')]]=_0x20486b;this[_0x44cf('0x40')](_0x20486b);}}catch(_0x428ec4){logger['error'](_0x44cf('0x6a'),util[_0x44cf('0x3e')](_0x428ec4,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0x203c16){try{if(this[_0x44cf('0x56')](_0x203c16)){if(this[_0x44cf('0x3a')][_0x203c16[_0x44cf('0x63')]]){var _0x2533cc=_['last'](this[_0x44cf('0x3a')][_0x203c16[_0x44cf('0x63')]]);_0x2533cc[_0x44cf('0x6b')]=![];_0x2533cc['queuecallercompleteAt']=null;_0x2533cc['holdtime']=_0x203c16[_0x44cf('0x6c')];_0x2533cc[_0x44cf('0x6d')]=_0x203c16['originalposition'];_0x2533cc[_0x44cf('0x6e')]=!![];_0x2533cc[_0x44cf('0x6f')]=moment()[_0x44cf('0x41')]('YYYY-MM-DD\x20HH:mm:ss');_0x2533cc[_0x44cf('0x70')]=_0x44cf('0x71');_0x2533cc[_0x44cf('0x72')]=null;this[_0x44cf('0xf')][_0x203c16[_0x44cf('0x63')]]=_0x2533cc;this[_0x44cf('0x3d')](_0x2533cc);}}}catch(_0x4e67ed){logger[_0x44cf('0x38')](_0x44cf('0x73'),util['inspect'](_0x4e67ed,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x44cf('0xb')][_0x44cf('0x1a')]=function(_0x3764f1){try{if(this[_0x44cf('0x56')](_0x3764f1)){if(this[_0x44cf('0x3a')][_0x3764f1[_0x44cf('0x63')]]){var _0x4260b8=_[_0x44cf('0x74')](this[_0x44cf('0x3a')][_0x3764f1['uniqueid']]);_0x4260b8[_0x44cf('0x75')]=moment()[_0x44cf('0x41')](_0x44cf('0x64'));_0x4260b8[_0x44cf('0x76')]=_0x3764f1[_0x44cf('0x76')];_0x4260b8[_0x44cf('0x77')]=_0x3764f1[_0x44cf('0x77')];this[_0x44cf('0xf')][_0x3764f1[_0x44cf('0x63')]]=_0x4260b8;this[_0x44cf('0x40')](_0x4260b8);}}}catch(_0x1ce191){logger[_0x44cf('0x38')](_0x44cf('0x78'),util[_0x44cf('0x3e')](_0x1ce191,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x44cf('0xb')]['syncAgentConnect']=function(_0xc43c57){try{if(this[_0x44cf('0x56')](_0xc43c57)){if(this[_0x44cf('0x3a')][_0xc43c57[_0x44cf('0x63')]]){var _0x47b365=_['last'](this[_0x44cf('0x3a')][_0xc43c57['uniqueid']]);_0x47b365[_0x44cf('0x6b')]=!![];_0x47b365[_0x44cf('0x70')]=_0x44cf('0x79');}}}catch(_0x1db717){logger['error'](_0x44cf('0x7a'),util[_0x44cf('0x3e')](_0x1db717,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x44cf('0x1b')]=function(_0x599bd8){try{if(this[_0x44cf('0x56')](_0x599bd8)){if(this[_0x44cf('0x3a')][_0x599bd8[_0x44cf('0x63')]]){var _0xdd3d03=_[_0x44cf('0x74')](this['queueReports'][_0x599bd8[_0x44cf('0x63')]]);_0xdd3d03[_0x44cf('0x6e')]=![];_0xdd3d03[_0x44cf('0x6f')]=null;_0xdd3d03[_0x44cf('0x7b')]=!![];_0xdd3d03[_0x44cf('0x72')]=_0x599bd8[_0x44cf('0x7c')];_0xdd3d03[_0x44cf('0x6c')]=_0x599bd8[_0x44cf('0x6c')];_0xdd3d03[_0x44cf('0x6b')]=!![];_0xdd3d03[_0x44cf('0x7d')]=![];_0xdd3d03[_0x44cf('0x7e')]=null;if(!_0xdd3d03[_0x44cf('0x7f')]){if(_0x599bd8[_0x44cf('0x80')]==_0x44cf('0x7f')){_0xdd3d03[_0x44cf('0x70')]=_0x44cf('0x81');}else{if(_['startsWith'](_0x599bd8[_0x44cf('0x82')]['toLowerCase'](),_0x44cf('0x83'))){if(this[_0x44cf('0x3a')][_0x599bd8[_0x44cf('0x84')]]){var _0x148715=_[_0x44cf('0x74')](this[_0x44cf('0x3a')][_0x599bd8[_0x44cf('0x84')]]);_0x148715[_0x44cf('0x6b')]=![];_0x148715[_0x44cf('0x7d')]=!![];_0x148715[_0x44cf('0x7e')]=moment(_0xdd3d03[_0x44cf('0x85')])[_0x44cf('0x86')](_0x599bd8[_0x44cf('0x6c')],_0x44cf('0x87'))[_0x44cf('0x41')](_0x44cf('0x64'));_0x148715[_0x44cf('0x70')]='FORWARDTRANSFER';_0x148715[_0x44cf('0x7f')]=!![];_0x148715[_0x44cf('0x88')]=_0x44cf('0x89');_0x148715[_0x44cf('0x8a')]=_0x599bd8[_0x44cf('0x8b')];_0x148715[_0x44cf('0x8c')]=_0x599bd8[_0x44cf('0x63')];var _0x45fb2e=this[_0x44cf('0x3a')][_0x599bd8[_0x44cf('0x84')]];this['queueReports'][_0x599bd8[_0x44cf('0x84')]]=this[_0x44cf('0x3a')][_0x599bd8[_0x44cf('0x63')]];this['queueReports'][_0x599bd8[_0x44cf('0x63')]]=_0x45fb2e;}}else{_0xdd3d03[_0x44cf('0x70')]=_0x44cf('0x8d')+_0x599bd8['reason']['toUpperCase']();}}}this[_0x44cf('0xf')][_0x599bd8['uniqueid']]=_0xdd3d03;this[_0x44cf('0x3d')](_0xdd3d03);}}}catch(_0x50e866){logger[_0x44cf('0x38')](_0x44cf('0x8e'),util[_0x44cf('0x3e')](_0x50e866,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x44cf('0xb')][_0x44cf('0x8f')]=function(_0x4b50e0){try{if(this[_0x44cf('0x56')](_0x4b50e0)){this[_0x44cf('0x90')](_0x4b50e0[_0x44cf('0x63')],_[_0x44cf('0x68')](_0x4b50e0['variable'])[0x0],_0x4b50e0[_0x44cf('0x91')]);if(this[_0x44cf('0x3a')][_0x4b50e0[_0x44cf('0x63')]]){var _0x45e517=_['last'](this[_0x44cf('0x3a')][_0x4b50e0[_0x44cf('0x63')]]);if(_0x45e517){if(this[_0x44cf('0x56')](_0x4b50e0['variable'])&&this[_0x44cf('0x56')](_0x4b50e0[_0x44cf('0x92')][_0x44cf('0x93')])){switch(_0x4b50e0['value']){case _0x44cf('0x94'):_0x45e517[_0x44cf('0x7d')]=![];_0x45e517[_0x44cf('0x7e')]=null;break;default:_0x45e517[_0x44cf('0x7d')]=!![];_0x45e517['queuecallerexitAt']=moment()[_0x44cf('0x41')](_0x44cf('0x64'));_0x45e517[_0x44cf('0x75')]=moment()[_0x44cf('0x41')]('YYYY-MM-DD\x20HH:mm:ss');}_0x45e517[_0x44cf('0x6e')]=![];_0x45e517[_0x44cf('0x6f')]=null;_0x45e517[_0x44cf('0x70')]=_0x4b50e0[_0x44cf('0x91')];this[_0x44cf('0xf')][_0x4b50e0[_0x44cf('0x63')]]=_0x45e517;this[_0x44cf('0x3d')](_0x45e517);}else if(this['isNotNull'](_0x4b50e0['variable'])&&this[_0x44cf('0x56')](_0x4b50e0['variable']['queueposition'])){if(!_0x45e517[_0x44cf('0x6e')]){_0x45e517[_0x44cf('0x7d')]=!![];_0x45e517[_0x44cf('0x7e')]=moment()[_0x44cf('0x41')]('YYYY-MM-DD\x20HH:mm:ss');_0x45e517[_0x44cf('0x70')]=_0x44cf('0x95');_0x45e517[_0x44cf('0x75')]=moment()[_0x44cf('0x41')](_0x44cf('0x64'));this[_0x44cf('0xf')][_0x4b50e0[_0x44cf('0x63')]]=_0x45e517;}}_0x45e517[_0x44cf('0x13')]=this[_0x44cf('0x13')][_0x4b50e0[_0x44cf('0x63')]];}}}}catch(_0xcff95f){logger['error'](_0x44cf('0x96'),util[_0x44cf('0x3e')](_0xcff95f,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x44cf('0x90')]=function(_0x58d8a6,_0x900b1b,_0x4cb5a5){var _0x52cfa5=[_0x44cf('0x97'),_0x44cf('0x98'),_0x44cf('0x99'),_0x44cf('0x9a'),_0x44cf('0x9b'),'rtpaudioqoslossbridged',_0x44cf('0x9c'),_0x44cf('0x9d'),_0x44cf('0x9e'),_0x44cf('0x9f'),'bridgepeer','bridgepvtcallid',_0x44cf('0xa0'),_0x44cf('0xa1'),_0x44cf('0xa2'),_0x44cf('0xa3'),_0x44cf('0x7c'),_0x44cf('0xa4'),_0x44cf('0xa5')];if(!_['isNil'](_0x900b1b)&&!_[_0x44cf('0xa6')](_0x52cfa5,_0x900b1b)){if(_[_0x44cf('0x29')](this[_0x44cf('0x13')][_0x58d8a6])){this[_0x44cf('0x13')][_0x58d8a6]={};}this[_0x44cf('0x13')][_0x58d8a6][_0x900b1b]=_0x4cb5a5;}};VoiceQueueReport['prototype'][_0x44cf('0x20')]=function(_0x464109){try{if(this[_0x44cf('0x56')](_0x464109)){if(this['queueReports'][_0x464109['uniqueid']]){for(var _0x3ba1b7=0x0,_0x1b0b3f={};_0x3ba1b7=0x0?moment(_0xcb3556[_0xda9c('0x19')])['diff'](_0xcb3556['starttime'],_0xda9c('0xe')):null,'data1':_0xda9c('0x1b'),'data2':_0xcb3556[_0xda9c('0x13')],'data3':_0xcb3556[_0xda9c('0x11')],'data4':_0xcb3556[_0xda9c('0x1c')]||null,'role':_0xda9c('0x1d'),'internal':_0xcb3556[_0xda9c('0x13')]?_[_0xda9c('0x1e')](_0xcb3556['accountcode']):undefined,'uniqueid':_0xcb3556[_0xda9c('0x14')]},'log':_0xda9c('0x5')});}; \ No newline at end of file +var _0xa83c=['membername','starttime','endtime','diff','outbound','dialstring','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','voice','lastAssignedTo','isNil','interface','SIP/%s','TALKING','queuecallerleaveAt','seconds','inbound','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','CreateMemberReport','voiceDialReport'];(function(_0x37b851,_0x469969){var _0x574599=function(_0x4e6ab8){while(--_0x4e6ab8){_0x37b851['push'](_0x37b851['shift']());}};_0x574599(++_0x469969);}(_0xa83c,0x16e));var _0xca83=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0xa83c[_0x5ddaac];return _0x2a9c58;};'use strict';var moment=require('moment');var _=require('lodash');var util=require(_0xca83('0x0'));var client=require(_0xca83('0x1'));exports[_0xca83('0x2')]=function(_0x3b2f31){var _0x5ae941=_0x3b2f31[_0xca83('0x3')]||_0x3b2f31[_0xca83('0x4')];return client[_0xca83('0x5')]('CreateMemberReport',{'body':{'channel':_0xca83('0x6'),'membername':_0x3b2f31[_0xca83('0x7')],'interface':_[_0xca83('0x8')](_0x3b2f31[_0xca83('0x9')])?util['format'](_0xca83('0xa'),_0x3b2f31[_0xca83('0x7')]):_0x3b2f31['interface'],'type':_0xca83('0xb'),'enterAt':_0x3b2f31[_0xca83('0xc')],'exitAt':_0x5ae941,'duration':moment(_0x5ae941)['diff'](_0x3b2f31[_0xca83('0xc')],_0xca83('0xd')),'data1':_0xca83('0xe'),'data2':_0x3b2f31[_0xca83('0xf')],'data3':_0x3b2f31[_0xca83('0x10')],'data4':null,'data5':_0x3b2f31[_0xca83('0x11')],'role':_0xca83('0x12'),'internal':_0x3b2f31[_0xca83('0x13')]?_[_0xca83('0x14')](_0x3b2f31['accountcode']):undefined,'uniqueid':_0x3b2f31[_0xca83('0x15')]},'log':_0xca83('0x16')});};exports[_0xca83('0x17')]=function(_0x31f019){return client[_0xca83('0x5')]('CreateMemberReport',{'body':{'channel':_0xca83('0x6'),'membername':_0x31f019[_0xca83('0x18')],'interface':_0x31f019['interface'],'type':_0xca83('0xb'),'enterAt':_0x31f019[_0xca83('0x19')],'exitAt':_0x31f019[_0xca83('0x1a')],'duration':moment(_0x31f019[_0xca83('0x1a')])[_0xca83('0x1b')](_0x31f019[_0xca83('0x19')],_0xca83('0xd'))>=0x0?moment(_0x31f019[_0xca83('0x1a')])[_0xca83('0x1b')](_0x31f019[_0xca83('0x19')],_0xca83('0xd')):null,'data1':_0xca83('0x1c'),'data2':_0x31f019['accountcode'],'data3':_0x31f019[_0xca83('0x10')],'data4':_0x31f019[_0xca83('0x1d')]||null,'role':_0xca83('0x12'),'internal':_0x31f019[_0xca83('0x13')]?_[_0xca83('0x14')](_0x31f019['accountcode']):undefined,'uniqueid':_0x31f019[_0xca83('0x15')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 5aefb71..737b9a5 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 _0xf2d7=['html','../client','getTemplates','GetTemplate'];(function(_0x2b56d1,_0x5c7c41){var _0xa98af7=function(_0x5edf66){while(--_0x5edf66){_0x2b56d1['push'](_0x2b56d1['shift']());}};_0xa98af7(++_0x5c7c41);}(_0xf2d7,0xc9));var _0x7f2d=function(_0x2378a8,_0x4191eb){_0x2378a8=_0x2378a8-0x0;var _0x4f1dd9=_0xf2d7[_0x2378a8];return _0x4f1dd9;};'use strict';var client=require(_0x7f2d('0x0'));exports[_0x7f2d('0x1')]=function(_0x468e48){return function(_0x3f343a){return client['Request'](_0x7f2d('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0x7f2d('0x3')]},'log':_0x7f2d('0x2')});};}; \ No newline at end of file +var _0x32be=['Request','GetTemplate','name','html','getTemplates'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x32be,0xbd));var _0xe32b=function(_0x33cfe6,_0x3e215c){_0x33cfe6=_0x33cfe6-0x0;var _0x34b6cf=_0x32be[_0x33cfe6];return _0x34b6cf;};'use strict';var client=require('../client');exports[_0xe32b('0x0')]=function(_0x17fdd3){return function(_0x2145d3){return client[_0xe32b('0x1')](_0xe32b('0x2'),{'options':{'raw':!![],'attributes':['id',_0xe32b('0x3'),_0xe32b('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 6393551..43bb5d5 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 _0xa9e0=['data3','data4','data5','../client','getTriggers','GetTrigger','channel','status','Condition','AllConditions','field','value','AnyConditions','action','data1','data2'];(function(_0x5f8e79,_0x112697){var _0x3ece15=function(_0x2765f1){while(--_0x2765f1){_0x5f8e79['push'](_0x5f8e79['shift']());}};_0x3ece15(++_0x112697);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(_0x29929c){return function(_0x5dd881){return client['Request'](_0x0a9e('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),_0x0a9e('0x4')],'include':[{'model':_0x0a9e('0x5'),'as':_0x0a9e('0x6'),'attributes':['id',_0x0a9e('0x7'),'operator',_0x0a9e('0x8')]},{'model':_0x0a9e('0x5'),'as':_0x0a9e('0x9'),'attributes':['id','field','operator',_0x0a9e('0x8')]},{'model':'Action','as':'Actions','attributes':['id',_0x0a9e('0xa'),_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),'data6','data7']}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0xa9e0=['data3','data4','data5','../client','getTriggers','GetTrigger','channel','status','Condition','AllConditions','field','value','AnyConditions','action','data1','data2'];(function(_0x39c8f0,_0xec8a20){var _0x4f7bbc=function(_0x20698a){while(--_0x20698a){_0x39c8f0['push'](_0x39c8f0['shift']());}};_0x4f7bbc(++_0xec8a20);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(_0x29929c){return function(_0x5dd881){return client['Request'](_0x0a9e('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),_0x0a9e('0x4')],'include':[{'model':_0x0a9e('0x5'),'as':_0x0a9e('0x6'),'attributes':['id',_0x0a9e('0x7'),'operator',_0x0a9e('0x8')]},{'model':_0x0a9e('0x5'),'as':_0x0a9e('0x9'),'attributes':['id','field','operator',_0x0a9e('0x8')]},{'model':'Action','as':'Actions','attributes':['id',_0x0a9e('0xa'),_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),'data6','data7']}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 23d7c07..24502ae 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 _0x3a86=['name','registry','getTrunks','Request','GetTrunk'];(function(_0x4b4198,_0x4be68d){var _0x43ed01=function(_0x33b7d7){while(--_0x33b7d7){_0x4b4198['push'](_0x4b4198['shift']());}};_0x43ed01(++_0x4be68d);}(_0x3a86,0x18d));var _0x63a8=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x3a86[_0x13e741];return _0x3f8bb3;};'use strict';var client=require('../client');exports[_0x63a8('0x0')]=function(_0x4ac708){return function(_0x144f45){return client[_0x63a8('0x1')](_0x63a8('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x63a8('0x3'),_0x63a8('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0xe316=['getTrunks','Request','GetTrunk','name','registry','../client'];(function(_0x596dca,_0x487294){var _0x382621=function(_0x2547ef){while(--_0x2547ef){_0x596dca['push'](_0x596dca['shift']());}};_0x382621(++_0x487294);}(_0xe316,0x107));var _0x6e31=function(_0x222c49,_0x1e8a56){_0x222c49=_0x222c49-0x0;var _0x540de7=_0xe316[_0x222c49];return _0x540de7;};'use strict';var client=require(_0x6e31('0x0'));exports[_0x6e31('0x1')]=function(_0x3e0a28){return function(_0x24ed55){return client[_0x6e31('0x2')](_0x6e31('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x6e31('0x4'),_0x6e31('0x5')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 4fdaabe..1c921ca 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 _0x82a9=['email','online','lastLoginAt','voicePause','../client','Request','GetUser','agent','accountcode','fullname','pauseType','lastPauseAt','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','name'];(function(_0x1e44c3,_0x333ffc){var _0x3acce9=function(_0x172fde){while(--_0x172fde){_0x1e44c3['push'](_0x1e44c3['shift']());}};_0x3acce9(++_0x333ffc);}(_0x82a9,0x16c));var _0x982a=function(_0x107f4d,_0x4d7d36){_0x107f4d=_0x107f4d-0x0;var _0x5b7799=_0x82a9[_0x107f4d];return _0x5b7799;};'use strict';var client=require(_0x982a('0x0'));exports['getAgents']=function(){return function(){return client[_0x982a('0x1')](_0x982a('0x2'),{'options':{'raw':![],'where':{'role':_0x982a('0x3')},'attributes':['id','name','email',_0x982a('0x4'),_0x982a('0x5'),'online','lastLoginAt',_0x982a('0x6'),_0x982a('0x7'),'voicePause',_0x982a('0x8'),_0x982a('0x9'),_0x982a('0xa')]},'log':'getAgents'});};};exports[_0x982a('0xb')]=function(){return function(){return client[_0x982a('0x1')](_0x982a('0x2'),{'options':{'raw':!![],'where':{'role':_0x982a('0xc')},'attributes':['id','name',_0x982a('0x4'),_0x982a('0xd')]},'log':_0x982a('0xb')});};};exports['savePause']=function(_0x2e550a,_0x5392fe,_0x47387d){return client['Request'](_0x982a('0xe'),{'body':{'type':_0x5392fe,'uniqueid':_0x47387d},'options':{'where':{'id':_0x2e550a['id']}},'log':'savePause'});};exports[_0x982a('0xf')]=function(_0x32a0d0){return client['Request'](_0x982a('0x10'),{'body':{},'options':{'where':{'id':_0x32a0d0['id']}},'log':'savePause'});};exports[_0x982a('0x11')]=function(_0x58efa7){return client[_0x982a('0x1')](_0x982a('0x12'),{'options':{'raw':![],'where':{'role':_0x982a('0x3'),'id':_0x58efa7},'attributes':['id',_0x982a('0x13'),_0x982a('0x14'),'accountcode',_0x982a('0x5'),_0x982a('0x15'),_0x982a('0x16'),_0x982a('0x6'),'lastPauseAt',_0x982a('0x17'),_0x982a('0xa')]},'log':_0x982a('0x11')});}; \ No newline at end of file +var _0xa1be=['getAgents','Request','GetUser','name','fullname','pauseType','lastPauseAt','phone','mobile','telephone','accountcode','internal','getTelephones','savePause','saveUnpause','getAgent','ShowUser','agent','email','online','lastLoginAt','../client'];(function(_0x401b2f,_0x12d95d){var _0x1dee28=function(_0x39f7fc){while(--_0x39f7fc){_0x401b2f['push'](_0x401b2f['shift']());}};_0x1dee28(++_0x12d95d);}(_0xa1be,0x133));var _0xea1b=function(_0x55bb7b,_0x24f082){_0x55bb7b=_0x55bb7b-0x0;var _0x580c3a=_0xa1be[_0x55bb7b];return _0x580c3a;};'use strict';var client=require(_0xea1b('0x0'));exports[_0xea1b('0x1')]=function(){return function(){return client[_0xea1b('0x2')](_0xea1b('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0xea1b('0x4'),'email','accountcode',_0xea1b('0x5'),'online','lastLoginAt',_0xea1b('0x6'),_0xea1b('0x7'),'voicePause',_0xea1b('0x8'),_0xea1b('0x9'),'interface']},'log':_0xea1b('0x1')});};};exports['getTelephones']=function(){return function(){return client[_0xea1b('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':_0xea1b('0xa')},'attributes':['id',_0xea1b('0x4'),_0xea1b('0xb'),_0xea1b('0xc')]},'log':_0xea1b('0xd')});};};exports[_0xea1b('0xe')]=function(_0x4bc192,_0x16f03d,_0x5c7c73){return client['Request']('PauseUser',{'body':{'type':_0x16f03d,'uniqueid':_0x5c7c73},'options':{'where':{'id':_0x4bc192['id']}},'log':'savePause'});};exports[_0xea1b('0xf')]=function(_0x31328){return client['Request']('UnpauseUser',{'body':{},'options':{'where':{'id':_0x31328['id']}},'log':_0xea1b('0xe')});};exports[_0xea1b('0x10')]=function(_0xc3332b){return client[_0xea1b('0x2')](_0xea1b('0x11'),{'options':{'raw':![],'where':{'role':_0xea1b('0x12'),'id':_0xc3332b},'attributes':['id',_0xea1b('0x4'),_0xea1b('0x13'),_0xea1b('0xb'),_0xea1b('0x5'),_0xea1b('0x14'),_0xea1b('0x15'),'pauseType','lastPauseAt','voicePause','interface']},'log':_0xea1b('0x10')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index c27ae5a..f5a2bd4 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 _0x81b8=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0xc873c6,_0x560ba8){var _0xf70f17=function(_0xf24e2b){while(--_0xf24e2b){_0xc873c6['push'](_0xc873c6['shift']());}};_0xf70f17(++_0x560ba8);}(_0x81b8,0x88));var _0x881b=function(_0x152742,_0x4dffe0){_0x152742=_0x152742-0x0;var _0x569653=_0x81b8[_0x152742];return _0x569653;};'use strict';var client=require(_0x881b('0x0'));exports[_0x881b('0x1')]=function(_0x88574f){return client[_0x881b('0x2')](_0x881b('0x3'),{'body':_0x88574f,'log':_0x881b('0x3')});};exports['update']=function(_0x18cf73,_0x3327ce,_0x8793c3){return client[_0x881b('0x2')](_0x881b('0x4'),{'body':_0x18cf73,'options':{'where':{'uniqueid':_0x3327ce,'interface':_0x8793c3}},'log':_0x881b('0x4')});}; \ No newline at end of file +var _0x4aca=['../client','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x5b9ac9,_0x374422){var _0x7e6db3=function(_0x3e835b){while(--_0x3e835b){_0x5b9ac9['push'](_0x5b9ac9['shift']());}};_0x7e6db3(++_0x374422);}(_0x4aca,0x195));var _0xa4ac=function(_0xce21a0,_0x2754f3){_0xce21a0=_0xce21a0-0x0;var _0x4ef203=_0x4aca[_0xce21a0];return _0x4ef203;};'use strict';var client=require(_0xa4ac('0x0'));exports['create']=function(_0x3eafd9){return client[_0xa4ac('0x1')](_0xa4ac('0x2'),{'body':_0x3eafd9,'log':_0xa4ac('0x2')});};exports[_0xa4ac('0x3')]=function(_0x3b65ac,_0x1e2e42,_0x1e9758){return client[_0xa4ac('0x1')](_0xa4ac('0x4'),{'body':_0x3b65ac,'options':{'where':{'uniqueid':_0x1e2e42,'interface':_0x1e9758}},'log':_0xa4ac('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 6311f10..a5863fa 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 _0x43ba=['calleridnum','context','GetVoiceCallReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','create','CreateVoiceCallReport','merge'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x43ba,0x163));var _0xa43b=function(_0x4793a0,_0x414843){_0x4793a0=_0x4793a0-0x0;var _0x34cd9c=_0x43ba[_0x4793a0];return _0x34cd9c;};'use strict';var moment=require(_0xa43b('0x0'));var util=require(_0xa43b('0x1'));var _=require('lodash');var client=require('../client');exports[_0xa43b('0x2')]=function(_0x24e400){return client['Request'](_0xa43b('0x3'),{'body':_[_0xa43b('0x4')](_0x24e400,{'source':_0x24e400[_0xa43b('0x5')],'destinationcontext':_0x24e400[_0xa43b('0x6')],'callerid':_0x24e400['callerid'],'amaflags':'DOCUMENTATION'}),'log':'CreateVoiceCallReport'});};exports['getVoiceCallReports']=function(){return function(){return client['Request'](_0xa43b('0x7'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xa43b('0x8')](_0xa43b('0x9'))[_0xa43b('0xa')](_0xa43b('0xb')),moment()[_0xa43b('0xc')]('day')['format'](_0xa43b('0xb'))]}},'attributes':[_0xa43b('0xd'),_0xa43b('0xe'),_0xa43b('0xf'),_0xa43b('0x10')]},'log':_0xa43b('0x11')});};}; \ No newline at end of file +var _0x446f=['context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','duration','moment','util','lodash','create','CreateVoiceCallReport','merge','calleridnum'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x446f,0x175));var _0xf446=function(_0x51c969,_0x38d8d9){_0x51c969=_0x51c969-0x0;var _0x1c3640=_0x446f[_0x51c969];return _0x1c3640;};'use strict';var moment=require(_0xf446('0x0'));var util=require(_0xf446('0x1'));var _=require(_0xf446('0x2'));var client=require('../client');exports[_0xf446('0x3')]=function(_0xd4c7aa){return client['Request'](_0xf446('0x4'),{'body':_[_0xf446('0x5')](_0xd4c7aa,{'source':_0xd4c7aa[_0xf446('0x6')],'destinationcontext':_0xd4c7aa[_0xf446('0x7')],'callerid':_0xd4c7aa[_0xf446('0x8')],'amaflags':_0xf446('0x9')}),'log':_0xf446('0x4')});};exports[_0xf446('0xa')]=function(){return function(){return client['Request'](_0xf446('0xb'),{'options':{'where':{'type':[_0xf446('0xc')],'createdAt':{'$between':[moment()[_0xf446('0xd')](_0xf446('0xe'))['format'](_0xf446('0xf')),moment()[_0xf446('0x10')](_0xf446('0xe'))['format'](_0xf446('0xf'))]}},'attributes':['type',_0xf446('0x11'),_0xf446('0x12'),'billableseconds']},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 8c8d089..1f7525f 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 _0xbf53=['Request','../client'];(function(_0x423097,_0x8a09f4){var _0x3a73f1=function(_0x9314f0){while(--_0x9314f0){_0x423097['push'](_0x423097['shift']());}};_0x3a73f1(++_0x8a09f4);}(_0xbf53,0xff));var _0x3bf5=function(_0x4e045f,_0x3c6807){_0x4e045f=_0x4e045f-0x0;var _0x5b5b9a=_0xbf53[_0x4e045f];return _0x5b5b9a;};'use strict';var client=require(_0x3bf5('0x0'));exports['create']=function(_0x22ae58){return client[_0x3bf5('0x1')]('CreateVoiceDialReport',{'body':_0x22ae58,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x91ba=['../client','create','Request','CreateVoiceDialReport'];(function(_0x2036c3,_0x64526c){var _0x3d1799=function(_0x52023a){while(--_0x52023a){_0x2036c3['push'](_0x2036c3['shift']());}};_0x3d1799(++_0x64526c);}(_0x91ba,0x140));var _0xa91b=function(_0x115845,_0x5aa5f3){_0x115845=_0x115845-0x0;var _0x54d872=_0x91ba[_0x115845];return _0x54d872;};'use strict';var client=require(_0xa91b('0x0'));exports[_0xa91b('0x1')]=function(_0x4839ae){return client[_0xa91b('0x2')](_0xa91b('0x3'),{'body':_0x4839ae,'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 cb07895..caf0918 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 _0x04ca=['Request','GetVoiceExtension','exten','recordingFormat','../client','getVoiceExtensions'];(function(_0x24ed12,_0x12b2f0){var _0x2e9c55=function(_0x3d18d){while(--_0x3d18d){_0x24ed12['push'](_0x24ed12['shift']());}};_0x2e9c55(++_0x12b2f0);}(_0x04ca,0x172));var _0xa04c=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x04ca[_0x19950b];return _0x3c6b41;};'use strict';var client=require(_0xa04c('0x0'));exports[_0xa04c('0x1')]=function(){return function(){return client[_0xa04c('0x2')](_0xa04c('0x3'),{'options':{'raw':!![],'attributes':['id',_0xa04c('0x4'),_0xa04c('0x5')],'where':{'VoiceExtensionId':null}},'log':_0xa04c('0x1')});};}; \ No newline at end of file +var _0x6460=['../client','exten','recordingFormat','getVoiceExtensions'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x6460,0xb4));var _0x0646=function(_0x164442,_0x5279ea){_0x164442=_0x164442-0x0;var _0x349e25=_0x6460[_0x164442];return _0x349e25;};'use strict';var client=require(_0x0646('0x0'));exports['getVoiceExtensions']=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x0646('0x1'),_0x0646('0x2')],'where':{'VoiceExtensionId':null}},'log':_0x0646('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index b407b70..8cb1cba 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 _0x3da6=['GetVoiceQueue','name','acw','acwTimeout','monitor_format','type','dialMethod','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','Trunk','callerid','TrunkBackup','active','Interval','Intervals','interval','../client','getVoiceQueues','Request'];(function(_0xfa7932,_0x503995){var _0x3d72e3=function(_0x2c169c){while(--_0x2c169c){_0xfa7932['push'](_0xfa7932['shift']());}};_0x3d72e3(++_0x503995);}(_0x3da6,0xc1));var _0x63da=function(_0x384c23,_0x30cd65){_0x384c23=_0x384c23-0x0;var _0x1fdf67=_0x3da6[_0x384c23];return _0x1fdf67;};'use strict';var client=require(_0x63da('0x0'));exports[_0x63da('0x1')]=function(){return function(){return client[_0x63da('0x2')](_0x63da('0x3'),{'options':{'raw':![],'attributes':['id',_0x63da('0x4'),_0x63da('0x5'),_0x63da('0x6'),'autopause',_0x63da('0x7'),_0x63da('0x8'),'dialActive',_0x63da('0x9'),'dialLimitChannel',_0x63da('0xa'),'dialPowerLevel',_0x63da('0xb'),_0x63da('0xc'),_0x63da('0xd'),_0x63da('0xe'),'dialOriginateCallerIdNumber',_0x63da('0xf'),_0x63da('0x10'),'dialQueueTimeout',_0x63da('0x11'),'dialCongestionMaxRetry',_0x63da('0x12'),_0x63da('0x13'),_0x63da('0x14'),_0x63da('0x15'),_0x63da('0x16'),'dialGlobalMaxRetry',_0x63da('0x17'),'dialGlobalInterval',_0x63da('0x18'),_0x63da('0x19'),_0x63da('0x1a'),_0x63da('0x1b'),_0x63da('0x1c'),_0x63da('0x1d'),_0x63da('0x1e'),_0x63da('0x1f'),_0x63da('0x20'),_0x63da('0x21'),_0x63da('0x22'),_0x63da('0x23'),_0x63da('0x24'),'dialRecallMeTimeout','dialRecallInQueue',_0x63da('0x25'),'dialAgiAfterHangupAgent',_0x63da('0x26'),_0x63da('0x27'),_0x63da('0x7'),_0x63da('0x28'),_0x63da('0x29'),'dialCutDigit'],'include':[{'model':_0x63da('0x2a'),'as':'Trunk','attributes':['id','name',_0x63da('0x2b'),'active']},{'model':_0x63da('0x2a'),'as':_0x63da('0x2c'),'attributes':['id',_0x63da('0x4'),'callerid',_0x63da('0x2d')]},{'model':_0x63da('0x2e'),'as':'Interval','attributes':['id',_0x63da('0x4')],'include':[{'model':_0x63da('0x2e'),'as':_0x63da('0x2f'),'attributes':['id',_0x63da('0x4'),_0x63da('0x30')]}]}]},'log':_0x63da('0x1')});};}; \ No newline at end of file +var _0x6888=['autopause','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy','Trunk','active','TrunkBackup','callerid','Interval','Intervals','interval','getVoiceQueues','../client','Request','GetVoiceQueue','name','acw','acwTimeout'];(function(_0x4350c2,_0x112f3c){var _0x8b6406=function(_0x49e845){while(--_0x49e845){_0x4350c2['push'](_0x4350c2['shift']());}};_0x8b6406(++_0x112f3c);}(_0x6888,0xd2));var _0x8688=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x6888[_0xa148b7];return _0x51efd3;};'use strict';var client=require(_0x8688('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x8688('0x1')](_0x8688('0x2'),{'options':{'raw':![],'attributes':['id',_0x8688('0x3'),_0x8688('0x4'),_0x8688('0x5'),_0x8688('0x6'),'monitor_format','type',_0x8688('0x7'),_0x8688('0x8'),_0x8688('0x9'),_0x8688('0xa'),_0x8688('0xb'),_0x8688('0xc'),'dialPredictiveOptimizationPercentage',_0x8688('0xd'),_0x8688('0xe'),_0x8688('0xf'),_0x8688('0x10'),_0x8688('0x11'),'dialQueueTimeout','dialQueueProject',_0x8688('0x12'),_0x8688('0x13'),_0x8688('0x14'),_0x8688('0x15'),_0x8688('0x16'),_0x8688('0x17'),_0x8688('0x18'),_0x8688('0x19'),_0x8688('0x1a'),'dialPrefix',_0x8688('0x1b'),_0x8688('0x1c'),_0x8688('0x1d'),_0x8688('0x1e'),_0x8688('0x1f'),_0x8688('0x20'),_0x8688('0x21'),_0x8688('0x22'),_0x8688('0x23'),_0x8688('0x24'),_0x8688('0x25'),_0x8688('0x26'),'dialRecallMeTimeout',_0x8688('0x27'),_0x8688('0x28'),_0x8688('0x29'),_0x8688('0x2a'),_0x8688('0x2b'),_0x8688('0x2c'),_0x8688('0x2d'),'dialRandomLastDigitCallerIdNumber','dialCutDigit'],'include':[{'model':_0x8688('0x2e'),'as':_0x8688('0x2e'),'attributes':['id','name','callerid',_0x8688('0x2f')]},{'model':_0x8688('0x2e'),'as':_0x8688('0x30'),'attributes':['id',_0x8688('0x3'),_0x8688('0x31'),_0x8688('0x2f')]},{'model':_0x8688('0x32'),'as':_0x8688('0x32'),'attributes':['id',_0x8688('0x3')],'include':[{'model':'Interval','as':_0x8688('0x33'),'attributes':['id','name',_0x8688('0x34')]}]}]},'log':_0x8688('0x35')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index fefd105..224cd22 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 _0x862d=['endOf','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerabandonAt','moment','lodash','../client','create','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xe7fce,_0x5af25a){var _0x3add4=function(_0x50da42){while(--_0x50da42){_0xe7fce['push'](_0xe7fce['shift']());}};_0x3add4(++_0x5af25a);}(_0x862d,0x184));var _0xd862=function(_0x357e50,_0x589f8e){_0x357e50=_0x357e50-0x0;var _0xdb0b14=_0x862d[_0x357e50];return _0xdb0b14;};'use strict';var moment=require(_0xd862('0x0'));var _=require(_0xd862('0x1'));var client=require(_0xd862('0x2'));exports[_0xd862('0x3')]=function(_0xce19a5){return client['Request'](_0xd862('0x4'),{'body':_0xce19a5,'log':'CreateVoiceQueueReport'});};exports[_0xd862('0x5')]=function(){return function(){return client['Request'](_0xd862('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xd862('0x7')](_0xd862('0x8'))[_0xd862('0x9')](_0xd862('0xa')),moment()[_0xd862('0xb')](_0xd862('0x8'))[_0xd862('0x9')](_0xd862('0xa'))]}},'attributes':['uniqueid',_0xd862('0xc'),_0xd862('0xd'),_0xd862('0xe'),_0xd862('0xf'),_0xd862('0x10'),_0xd862('0x11'),'queuecallerexitAt','queuecallerabandon',_0xd862('0x12')]},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0xb4d2=['queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','lodash','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','startOf','format','YYYY-MM-DD\x20HH:mm:ss','day','uniqueid','queue','queuecallerleaveAt','queuecallercompleteAt'];(function(_0xdf3db6,_0x2a1952){var _0x4b7a65=function(_0x2953be){while(--_0x2953be){_0xdf3db6['push'](_0xdf3db6['shift']());}};_0x4b7a65(++_0x2a1952);}(_0xb4d2,0x1ba));var _0x2b4d=function(_0x3d56a4,_0x5da8c5){_0x3d56a4=_0x3d56a4-0x0;var _0x56894c=_0xb4d2[_0x3d56a4];return _0x56894c;};'use strict';var moment=require('moment');var _=require(_0x2b4d('0x0'));var client=require(_0x2b4d('0x1'));exports[_0x2b4d('0x2')]=function(_0x434616){return client[_0x2b4d('0x3')](_0x2b4d('0x4'),{'body':_0x434616,'log':'CreateVoiceQueueReport'});};exports[_0x2b4d('0x5')]=function(){return function(){return client[_0x2b4d('0x3')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0x2b4d('0x6')]('day')[_0x2b4d('0x7')](_0x2b4d('0x8')),moment()['endOf'](_0x2b4d('0x9'))[_0x2b4d('0x7')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x2b4d('0xa'),_0x2b4d('0xb'),'queuecallerjoinAt',_0x2b4d('0xc'),'queuecallercomplete',_0x2b4d('0xd'),_0x2b4d('0xe'),_0x2b4d('0xf'),_0x2b4d('0x10'),_0x2b4d('0x11')]},'log':_0x2b4d('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index bac2e2f..242394a 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 _0xa046=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x1d8679,_0x32a98f){var _0x427125=function(_0x5466eb){while(--_0x5466eb){_0x1d8679['push'](_0x1d8679['shift']());}};_0x427125(++_0x32a98f);}(_0xa046,0x1ba));var _0x6a04=function(_0x32b1b6,_0x31851e){_0x32b1b6=_0x32b1b6-0x0;var _0x3c8540=_0xa046[_0x32b1b6];return _0x3c8540;};'use strict';var client=require(_0x6a04('0x0'));exports[_0x6a04('0x1')]=function(_0x337f4b){return function(){return client['Request'](_0x6a04('0x2'),{'options':{'where':{'VoiceQueueId':_0x337f4b,'paused':!![]},'raw':!![]},'log':_0x6a04('0x1')});};}; \ No newline at end of file +var _0xde20=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xde20,0x65));var _0x0de2=function(_0x334d0a,_0x314a28){_0x334d0a=_0x334d0a-0x0;var _0x5134cc=_0xde20[_0x334d0a];return _0x5134cc;};'use strict';var client=require(_0x0de2('0x0'));exports[_0x0de2('0x1')]=function(_0x55b47f){return function(){return client[_0x0de2('0x2')](_0x0de2('0x3'),{'options':{'where':{'VoiceQueueId':_0x55b47f,'paused':!![]},'raw':!![]},'log':_0x0de2('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 54c1f50..3875f70 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 _0x3aa0=['CreateVoiceRecording','merge','../client','Request'];(function(_0x5174ce,_0x1e7977){var _0x3be8e4=function(_0x3070c0){while(--_0x3070c0){_0x5174ce['push'](_0x5174ce['shift']());}};_0x3be8e4(++_0x1e7977);}(_0x3aa0,0x116));var _0x03aa=function(_0x50eafa,_0x461914){_0x50eafa=_0x50eafa-0x0;var _0x25aad5=_0x3aa0[_0x50eafa];return _0x25aad5;};'use strict';var _=require('lodash');var client=require(_0x03aa('0x0'));exports['create']=function(_0x57616d){return client[_0x03aa('0x1')](_0x03aa('0x2'),{'body':_[_0x03aa('0x3')](_0x57616d,{'value':_0x57616d['monitorFilename']}),'log':'CreateVoiceRecording'});}; \ No newline at end of file +var _0xc937=['CreateVoiceRecording','merge','monitorFilename','../client','create','Request'];(function(_0x57b107,_0x2ba49d){var _0x23b46b=function(_0x16161d){while(--_0x16161d){_0x57b107['push'](_0x57b107['shift']());}};_0x23b46b(++_0x2ba49d);}(_0xc937,0x11d));var _0x7c93=function(_0x1fcce2,_0x1c6376){_0x1fcce2=_0x1fcce2-0x0;var _0x46ccb2=_0xc937[_0x1fcce2];return _0x46ccb2;};'use strict';var _=require('lodash');var client=require(_0x7c93('0x0'));exports[_0x7c93('0x1')]=function(_0xf4d5da){return client[_0x7c93('0x2')](_0x7c93('0x3'),{'body':_[_0x7c93('0x4')](_0xf4d5da,{'value':_0xf4d5da[_0x7c93('0x5')]}),'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 b7564cf..5264838 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 _0x0945=['transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridnum','transfererconnectedlinenum','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','context','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransfereraccountcode','secondtransferercontext','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum'];(function(_0x49ae44,_0x470ae5){var _0x20b9d7=function(_0x7f4407){while(--_0x7f4407){_0x49ae44['push'](_0x49ae44['shift']());}};_0x20b9d7(++_0x470ae5);}(_0x0945,0x1ac));var _0x5094=function(_0x1f047e,_0x23b312){_0x1f047e=_0x1f047e-0x0;var _0x206db5=_0x0945[_0x1f047e];return _0x206db5;};'use strict';var client=require(_0x5094('0x0'));exports[_0x5094('0x1')]=function(_0x1c7ce0){return client[_0x5094('0x2')](_0x5094('0x3'),{'body':{'result':_0x1c7ce0[_0x5094('0x4')],'transfererchannel':_0x1c7ce0['transfererchannel'],'transferercalleridnum':_0x1c7ce0[_0x5094('0x5')],'transferercalleridname':_0x1c7ce0['transferercalleridname'],'transfererconnectedlinenum':_0x1c7ce0[_0x5094('0x6')],'transfererconnectedlinename':_0x1c7ce0['transfererconnectedlinename'],'transfereraccountcode':_0x1c7ce0['transfereraccountcode'],'transferercontext':_0x1c7ce0[_0x5094('0x7')],'transfererexten':_0x1c7ce0['transfererexten'],'transfererlinkedid':_0x1c7ce0[_0x5094('0x8')],'transfereechannel':_0x1c7ce0[_0x5094('0x9')],'transfereecalleridnum':_0x1c7ce0[_0x5094('0xa')],'transfereecalleridname':_0x1c7ce0[_0x5094('0xb')],'transfereeconnectedlinenum':_0x1c7ce0[_0x5094('0xc')],'transfereeconnectedlinename':_0x1c7ce0[_0x5094('0xd')],'transfereeaccountcode':_0x1c7ce0[_0x5094('0xe')],'transfereecontext':_0x1c7ce0[_0x5094('0xf')],'transfereeexten':_0x1c7ce0['transfereeexten'],'transfereelinkedid':_0x1c7ce0[_0x5094('0x10')],'isexternal':_0x1c7ce0[_0x5094('0x11')],'context':_0x1c7ce0[_0x5094('0x12')],'extension':_0x1c7ce0['extension'],'type':'blind'},'log':_0x5094('0x3')});};exports[_0x5094('0x13')]=function(_0x5119cd){return client[_0x5094('0x2')](_0x5094('0x3'),{'body':{'result':_0x5119cd['result'],'transfererchannel':_0x5119cd[_0x5094('0x14')],'transferercalleridnum':_0x5119cd[_0x5094('0x15')],'transferercalleridname':_0x5119cd['origtransferercalleridname'],'transfererconnectedlinenum':_0x5119cd['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x5119cd['secondtransfererconnectedlinename'],'transfereraccountcode':_0x5119cd[_0x5094('0x16')],'transferercontext':_0x5119cd[_0x5094('0x17')],'transfererexten':_0x5119cd['secondtransfererexten'],'transfererlinkedid':_0x5119cd['origtransfererlinkedid'],'transfereechannel':_0x5119cd[_0x5094('0x18')],'transfereecalleridnum':_0x5119cd[_0x5094('0x19')],'transfereecalleridname':_0x5119cd['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x5119cd[_0x5094('0x1a')],'transfereeconnectedlinename':_0x5119cd[_0x5094('0x1b')],'transfereeaccountcode':_0x5119cd[_0x5094('0x1c')],'transfereecontext':_0x5119cd[_0x5094('0x1d')],'transfereeexten':_0x5119cd[_0x5094('0x1e')],'transfereelinkedid':_0x5119cd[_0x5094('0x1f')],'isexternal':_0x5119cd['isexternal'],'context':_0x5119cd[_0x5094('0x20')],'extension':_0x5119cd[_0x5094('0x21')],'type':_0x5094('0x22')},'log':_0x5094('0x3')});}; \ No newline at end of file +var _0x5c15=['origtransfereraccountcode','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','../client','blindTransfer','Request','result','transfererchannel','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename'];(function(_0x5638e5,_0x229eb7){var _0x54781b=function(_0xa86e73){while(--_0xa86e73){_0x5638e5['push'](_0x5638e5['shift']());}};_0x54781b(++_0x229eb7);}(_0x5c15,0x192));var _0x55c1=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x5c15[_0x8c43de];return _0xa6591b;};'use strict';var client=require(_0x55c1('0x0'));exports[_0x55c1('0x1')]=function(_0x2653d9){return client[_0x55c1('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x2653d9[_0x55c1('0x3')],'transfererchannel':_0x2653d9[_0x55c1('0x4')],'transferercalleridnum':_0x2653d9['transferercalleridnum'],'transferercalleridname':_0x2653d9['transferercalleridname'],'transfererconnectedlinenum':_0x2653d9[_0x55c1('0x5')],'transfererconnectedlinename':_0x2653d9[_0x55c1('0x6')],'transfereraccountcode':_0x2653d9[_0x55c1('0x7')],'transferercontext':_0x2653d9[_0x55c1('0x8')],'transfererexten':_0x2653d9[_0x55c1('0x9')],'transfererlinkedid':_0x2653d9[_0x55c1('0xa')],'transfereechannel':_0x2653d9[_0x55c1('0xb')],'transfereecalleridnum':_0x2653d9[_0x55c1('0xc')],'transfereecalleridname':_0x2653d9['transfereecalleridname'],'transfereeconnectedlinenum':_0x2653d9[_0x55c1('0xd')],'transfereeconnectedlinename':_0x2653d9['transfereeconnectedlinename'],'transfereeaccountcode':_0x2653d9[_0x55c1('0xe')],'transfereecontext':_0x2653d9['transfereecontext'],'transfereeexten':_0x2653d9[_0x55c1('0xf')],'transfereelinkedid':_0x2653d9[_0x55c1('0x10')],'isexternal':_0x2653d9[_0x55c1('0x11')],'context':_0x2653d9[_0x55c1('0x12')],'extension':_0x2653d9[_0x55c1('0x13')],'type':_0x55c1('0x14')},'log':_0x55c1('0x15')});};exports[_0x55c1('0x16')]=function(_0x474f73){return client[_0x55c1('0x2')](_0x55c1('0x15'),{'body':{'result':_0x474f73[_0x55c1('0x3')],'transfererchannel':_0x474f73[_0x55c1('0x17')],'transferercalleridnum':_0x474f73['origtransferercalleridnum'],'transferercalleridname':_0x474f73[_0x55c1('0x18')],'transfererconnectedlinenum':_0x474f73[_0x55c1('0x19')],'transfererconnectedlinename':_0x474f73[_0x55c1('0x1a')],'transfereraccountcode':_0x474f73[_0x55c1('0x1b')],'transferercontext':_0x474f73['secondtransferercontext'],'transfererexten':_0x474f73['secondtransfererexten'],'transfererlinkedid':_0x474f73[_0x55c1('0x1c')],'transfereechannel':_0x474f73[_0x55c1('0x1d')],'transfereecalleridnum':_0x474f73[_0x55c1('0x1e')],'transfereecalleridname':_0x474f73[_0x55c1('0x1f')],'transfereeconnectedlinenum':_0x474f73[_0x55c1('0x20')],'transfereeconnectedlinename':_0x474f73['transfertargetconnectedlinename'],'transfereeaccountcode':_0x474f73[_0x55c1('0x21')],'transfereecontext':_0x474f73[_0x55c1('0x22')],'transfereeexten':_0x474f73[_0x55c1('0x23')],'transfereelinkedid':_0x474f73[_0x55c1('0x24')],'isexternal':_0x474f73[_0x55c1('0x11')],'context':_0x474f73[_0x55c1('0x25')],'extension':_0x474f73[_0x55c1('0x26')],'type':'attended'},'log':_0x55c1('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index c27db73..881956e 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 _0x9f78=['dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalLowerLimit','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','Trunk','active','Interval','push','length','values','channels','voicechannel','map','find','uniqueid','channel','%s.%s','filename','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','validate','resolve','destinationchannel','StopMixMonitor','stop','wav','queueChannels','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','event','emit','custom:','faxAccounts','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','updateAcw','agents','pause','QueuePause','isConnected','asterisk','username','ami\x20disconnected','join','keys','action','Reload','then','message','catch','error','command','Action','content','hasOwnProperty','voiceQueues','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','abandoned','waiting','loggedInDb','type','outbound','dialActive'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f78,0xca));var _0x89f7=function(_0x3ebbcd,_0x1afc61){_0x3ebbcd=_0x3ebbcd-0x0;var _0x210c43=_0x9f78[_0x3ebbcd];return _0x210c43;};'use strict';var _=require(_0x89f7('0x0'));var util=require(_0x89f7('0x1'));var jayson=require(_0x89f7('0x2'));var schema=require('validate');var BPromise=require(_0x89f7('0x3'));var moment=require(_0x89f7('0x4'));var config=require(_0x89f7('0x5'));var properties=require(_0x89f7('0x6'));var ami=require(_0x89f7('0x7'));exports[_0x89f7('0x8')]=function(_0x2cdd7d,_0x410caf,_0x2ec710){return new BPromise(function(_0x69cbd8,_0x251400){var _0x1fd83b={'QueuePause':function(_0x44f6d5){return new Promise(function(_0x4f2db2,_0xe228f0){var _0x2c76d1=util[_0x89f7('0x9')](_0x89f7('0xa'),_0x89f7('0xb'),_0x44f6d5[_0x89f7('0xc')]);if(_0x2cdd7d[_0x89f7('0xd')]&&_0x2cdd7d[_0x89f7('0xd')][_0x2c76d1]&&_0x2cdd7d[_0x89f7('0xd')][_0x2c76d1]['timer']){_0x2cdd7d[_0x89f7('0xd')][_0x2c76d1][_0x89f7('0xe')]();}if(_0x2cdd7d['agents'][_0x2c76d1]){_0x2cdd7d[_0x89f7('0xf')][_0x2c76d1]['updateStatusRealtime']({'statePause':_0x44f6d5[_0x89f7('0x10')]?!![]:![]});}_0x4f2db2({'code':0xc8,'message':_0x89f7('0x11')});});},'Reload':function(_0x2d8312){var _0x4070e2=this;return new Promise(function(_0x27e300,_0x10778d){if(ami[_0x89f7('0x12')]()==![]){return _0x10778d(_0x4070e2['error'](0x1f4,[config[_0x89f7('0x13')]['ip'],config['asterisk'][_0x89f7('0x14')],_0x89f7('0x15')][_0x89f7('0x16')]('\x20')));}_0x2d8312=_['pick'](_0x2d8312,_[_0x89f7('0x17')](properties['module']));_0x2d8312[_0x89f7('0x18')]=_0x89f7('0x19');return ami['Action'](_0x2d8312)[_0x89f7('0x1a')](function(_0x439320){_0x27e300({'code':0xc8,'message':_0x439320[_0x89f7('0x1b')]});})[_0x89f7('0x1c')](function(_0x2e73ef){_0x10778d(_0x4070e2['error'](0x1f5,_0x2e73ef[_0x89f7('0x1b')]));});});},'Command':function(_0x45f0d9){var _0x58d542=this;return new Promise(function(_0x2c7206,_0x557575){if(ami[_0x89f7('0x12')]()==![]){return _0x557575(_0x58d542[_0x89f7('0x1d')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x89f7('0x14')],'ami\x20disconnected'][_0x89f7('0x16')]('\x20')));}_0x45f0d9=_['pick'](_0x45f0d9,_0x89f7('0x1e'));_0x45f0d9['action']='Command';return ami[_0x89f7('0x1f')](_0x45f0d9)['then'](function(_0x181a2b){_0x2c7206({'code':0xc8,'message':_0x181a2b[_0x89f7('0x20')]});})[_0x89f7('0x1c')](function(_0xc1c7a9){_0x557575(_0x58d542[_0x89f7('0x1d')](0x1f5,_0xc1c7a9[_0x89f7('0x1b')]));});});},'VoiceQueues':function(_0x5ca6f8){return new Promise(function(_0x4e2c99,_0xb400d5){var _0x20aa58=[];for(var _0x29b5d4 in _0x2cdd7d['voiceQueues']){if(_0x2cdd7d['voiceQueues'][_0x89f7('0x21')](_0x29b5d4)){var _0x578770=_0x2cdd7d[_0x89f7('0x22')][_0x29b5d4];var _0x11aac1={'id':_0x578770['id'],'name':_0x578770[_0x89f7('0xc')],'strategy':_0x578770[_0x89f7('0x23')],'answered':_0x578770[_0x89f7('0x24')],'available':_0x578770[_0x89f7('0x25')],'loggedIn':_0x578770[_0x89f7('0x26')],'pTalking':_0x578770[_0x89f7('0x27')],'sumBillable':_0x578770['sumBillable'],'sumDuration':_0x578770[_0x89f7('0x28')],'sumHoldTime':_0x578770[_0x89f7('0x29')]||0x0,'talking':_0x578770['talking'],'total':_0x578770['total'],'type':_0x578770['type'],'unmanaged':_0x578770['unmanaged'],'abandoned':_0x578770[_0x89f7('0x2a')],'waiting':_0x578770[_0x89f7('0x2b')],'loggedInDb':_0x578770[_0x89f7('0x2c')]};if(_0x578770[_0x89f7('0x2d')]===_0x89f7('0x2e')){_0x11aac1[_0x89f7('0x2f')]=_0x578770[_0x89f7('0x2f')];_0x11aac1[_0x89f7('0x30')]=_0x578770[_0x89f7('0x30')];_0x11aac1[_0x89f7('0x31')]=_0x578770['dialOriginateCallerIdName'];_0x11aac1[_0x89f7('0x32')]=_0x578770[_0x89f7('0x32')];_0x11aac1[_0x89f7('0x33')]=_0x578770['dialOriginateTimeout'];_0x11aac1[_0x89f7('0x34')]=_0x578770[_0x89f7('0x34')];_0x11aac1[_0x89f7('0x35')]=_0x578770[_0x89f7('0x35')];_0x11aac1['outboundAnswerCallsDay']=_0x578770[_0x89f7('0x36')];_0x11aac1[_0x89f7('0x37')]=_0x578770['outboundBlacklistCallsDay'];_0x11aac1[_0x89f7('0x38')]=_0x578770[_0x89f7('0x38')];_0x11aac1['outboundCongestionCallsDay']=_0x578770['outboundCongestionCallsDay'];_0x11aac1[_0x89f7('0x39')]=_0x578770[_0x89f7('0x39')];_0x11aac1['outboundDropCallsDayCallersExit']=_0x578770[_0x89f7('0x3a')];_0x11aac1[_0x89f7('0x3b')]=_0x578770[_0x89f7('0x3b')];_0x11aac1[_0x89f7('0x3c')]=_0x578770[_0x89f7('0x3c')];_0x11aac1['outboundNoSuchCallsDay']=_0x578770[_0x89f7('0x3d')];_0x11aac1[_0x89f7('0x3e')]=_0x578770[_0x89f7('0x3e')];_0x11aac1[_0x89f7('0x3f')]=_0x578770[_0x89f7('0x3f')];_0x11aac1[_0x89f7('0x40')]=_0x578770['outboundRejectCallsDay'];_0x11aac1[_0x89f7('0x41')]=_0x578770['outboundUnknownCallsDay'];_0x11aac1[_0x89f7('0x42')]=_0x578770[_0x89f7('0x42')];_0x11aac1[_0x89f7('0x43')]=_0x578770[_0x89f7('0x43')];_0x11aac1[_0x89f7('0x44')]=_0x578770[_0x89f7('0x44')];_0x11aac1[_0x89f7('0x45')]=_0x578770[_0x89f7('0x45')];_0x11aac1['predictiveIntervalDroppedCallsTimeout']=_0x578770[_0x89f7('0x46')];_0x11aac1['predictiveIntervalErlangCalls']=_0x578770[_0x89f7('0x47')];_0x11aac1[_0x89f7('0x48')]=_0x578770['predictiveIntervalErlangCallsDroppedCalls'];_0x11aac1[_0x89f7('0x49')]=_0x578770[_0x89f7('0x49')];_0x11aac1['predictiveIntervalLowerLimit']=_0x578770[_0x89f7('0x4a')];_0x11aac1[_0x89f7('0x4b')]=_0x578770[_0x89f7('0x4b')];_0x11aac1[_0x89f7('0x4c')]=_0x578770[_0x89f7('0x4c')];_0x11aac1['predictiveIntervalTotalCalls']=_0x578770['predictiveIntervalTotalCalls'];_0x11aac1['message']=_0x578770[_0x89f7('0x1b')];_0x11aac1['originated']=_0x578770['originated'];}if(_0x578770[_0x89f7('0x4d')]){_0x11aac1[_0x89f7('0x4d')]={'id':_0x578770[_0x89f7('0x4d')]['id'],'name':_0x578770[_0x89f7('0x4d')]['name'],'active':_0x578770[_0x89f7('0x4d')][_0x89f7('0x4e')],'callerid':_0x578770['Trunk']['callerid']};}if(_0x578770[_0x89f7('0x4f')]){_0x11aac1[_0x89f7('0x4f')]={'id':_0x578770[_0x89f7('0x4f')]['id'],'name':_0x578770[_0x89f7('0x4f')][_0x89f7('0xc')]};}_0x20aa58[_0x89f7('0x50')](_0x11aac1);}}_0x4e2c99({'count':_0x20aa58[_0x89f7('0x51')],'rows':_0x20aa58});});},'VoiceChannels':function(_0x2e0428){return new Promise(function(_0x24a9a4,_0x274351){var _0x1927b4=_[_0x89f7('0x52')](_0x2cdd7d[_0x89f7('0x53')]);_0x24a9a4({'count':_0x1927b4['length'],'rows':_0x1927b4});});},'VoiceChannelMixMonitor':function(_0x90de03){var _0x28272b=this;return new Promise(function(_0x3fceb2,_0x266abb){if(ami[_0x89f7('0x12')]()==![]){return _0x266abb(_0x28272b[_0x89f7('0x1d')](0x1f4,[config['asterisk']['ip'],config[_0x89f7('0x13')]['username'],'ami\x20disconnected'][_0x89f7('0x16')]('\x20')));}var _0x260180=schema(properties[_0x89f7('0x54')])['validate'](_0x90de03);if(_0x260180[_0x89f7('0x51')]>0x0){return _0x266abb(_0x28272b[_0x89f7('0x1d')](0x1f4,_[_0x89f7('0x55')](_0x260180,_0x89f7('0x1b'))[_0x89f7('0x16')](',\x20')));}var _0x7be32b=_[_0x89f7('0x56')](_0x2cdd7d[_0x89f7('0x53')],{'uniqueid':_0x90de03[_0x89f7('0x57')]});if(_0x7be32b&&_0x7be32b[_0x89f7('0x58')]){var _0x351eed=util[_0x89f7('0x9')](_0x89f7('0x59'),_0x90de03[_0x89f7('0x5a')]||_0x90de03[_0x89f7('0x57')],_0x90de03[_0x89f7('0x9')]||'wav');return ami['Action']({'action':'MixMonitor','channel':_0x7be32b['channel'],'file':_0x351eed,'options':'ai(mixmonitorid)'})[_0x89f7('0x1a')](function(_0x50bc1c){var _0x5b1915=_[_0x89f7('0x56')](_0x7be32b[_0x89f7('0x5b')],{'filename':_0x89f7('0x5c')+_0x351eed[_0x89f7('0x5d')]()});if(_[_0x89f7('0x5e')](_0x5b1915)){_0x7be32b['monitors'][_0x89f7('0x50')]({'filename':_0x89f7('0x5c')+_0x351eed[_0x89f7('0x5d')](),'createdAt':moment()[_0x89f7('0x9')](_0x89f7('0x5f')),'mixmonitorid':_0x50bc1c[_0x89f7('0x60')],'status':_0x89f7('0x61')});}else{_0x5b1915['mixmonitorid']=_0x50bc1c[_0x89f7('0x60')];_0x5b1915[_0x89f7('0x62')]='rec';}_0x3fceb2({'code':0xc8,'message':[_0x90de03[_0x89f7('0x57')],_0x89f7('0x63'),_0x50bc1c[_0x89f7('0x60')]]['join']('\x20'),'mixmonitorid':_0x50bc1c[_0x89f7('0x60')]});})[_0x89f7('0x1c')](function(_0x1171e5){_0x266abb(_0x28272b['error'](0x1f5,[_0x90de03[_0x89f7('0x57')],_0x1171e5[_0x89f7('0x1b')][_0x89f7('0x5d')]()][_0x89f7('0x16')]('\x20')));});}else{return _0x266abb(_0x28272b[_0x89f7('0x1d')](0x1f5,_0x89f7('0x64')));}});},'VoiceChannelStopMixMonitor':function(_0x474e38){var _0x1e8d40=this;return new Promise(function(_0x15cf4f,_0x25090d){if(ami['isConnected']()==![]){return _0x25090d(_0x1e8d40['error'](0x1f4,[config[_0x89f7('0x13')]['ip'],config[_0x89f7('0x13')][_0x89f7('0x14')],_0x89f7('0x15')][_0x89f7('0x16')]('\x20')));}var _0x49311e=schema(properties['voicechannel'])[_0x89f7('0x65')](_0x474e38);if(_0x49311e[_0x89f7('0x51')]>0x0){return _0x25090d(_0x1e8d40[_0x89f7('0x1d')](0x1f4,_[_0x89f7('0x55')](_0x49311e,_0x89f7('0x1b'))[_0x89f7('0x16')](',\x20')));}var _0x9e8edc=_[_0x89f7('0x56')](_0x2cdd7d[_0x89f7('0x53')],{'uniqueid':_0x474e38[_0x89f7('0x57')]});if(_0x9e8edc){return BPromise[_0x89f7('0x66')]()[_0x89f7('0x1a')](function(){if(_0x9e8edc[_0x89f7('0x58')]){return ami[_0x89f7('0x1f')]({'action':'StopMixMonitor','channel':_0x9e8edc[_0x89f7('0x58')],'mixmonitorid':_0x474e38[_0x89f7('0x60')]})[_0x89f7('0x1c')](function(_0x17d415){});}})[_0x89f7('0x1a')](function(){if(_0x9e8edc[_0x89f7('0x67')]){return ami[_0x89f7('0x1f')]({'action':_0x89f7('0x68'),'channel':_0x9e8edc['destinationchannel'],'mixmonitorid':_0x474e38[_0x89f7('0x60')]})[_0x89f7('0x1c')](function(_0x24c638){});}})['then'](function(_0x115aa6){var _0xc04973=_[_0x89f7('0x56')](_0x9e8edc[_0x89f7('0x5b')],{'mixmonitorid':_0x474e38[_0x89f7('0x60')]});if(_0xc04973){_0xc04973[_0x89f7('0x62')]=_0x89f7('0x69');}})[_0x89f7('0x1a')](function(){var _0x340f61=util[_0x89f7('0x9')](_0x89f7('0x59'),_0x474e38[_0x89f7('0x5a')]||_0x474e38[_0x89f7('0x57')],_0x474e38[_0x89f7('0x9')]||_0x89f7('0x6a'));var _0x236432=_[_0x89f7('0x56')](_0x9e8edc['monitors'],{'filename':_0x89f7('0x5c')+_0x340f61[_0x89f7('0x5d')]()});if(_0x236432){_0x236432[_0x89f7('0x62')]='stop';}})['then'](function(){_0x15cf4f({'code':0xc8,'message':[_0x474e38['uniqueid'],'StopMixMonitor\x20Success'][_0x89f7('0x16')]('\x20')});})['catch'](function(_0x27f88a){_0x25090d(_0x1e8d40[_0x89f7('0x1d')](0x1f5,[_0x474e38[_0x89f7('0x57')],_0x27f88a[_0x89f7('0x1b')]['toLowerCase']()][_0x89f7('0x16')]('\x20')));});}else{return _0x25090d(_0x1e8d40[_0x89f7('0x1d')](0x1f5,_0x89f7('0x64')));}});},'VoiceQueuesChannels':function(_0xabeedc){return new Promise(function(_0x10f6d0,_0x255af1){var _0x1ebc80=_[_0x89f7('0x52')](_0x2cdd7d[_0x89f7('0x6b')]);_0x10f6d0({'count':_0x1ebc80[_0x89f7('0x51')],'rows':_0x1ebc80});});},'VoiceQueuesChannel':function(_0x39f339){var _0x432921=this;return new Promise(function(_0x365629,_0x160b89){var _0x3c0387=schema(properties['voicequeuechannel'])[_0x89f7('0x65')](_0x39f339);if(_0x3c0387[_0x89f7('0x51')]>0x0){return _0x160b89(_0x432921[_0x89f7('0x1d')](0x1f4,_[_0x89f7('0x55')](_0x3c0387,'message')['join'](',\x20')));}var _0x4ae3a8=_[_0x89f7('0x56')](_0x2cdd7d[_0x89f7('0x6b')],{'uniqueid':_0x39f339[_0x89f7('0x57')]});if(_0x4ae3a8){_0x365629(_0x4ae3a8);}else{return _0x160b89(_0x432921[_0x89f7('0x1d')](0x1f5,_0x89f7('0x64')));}});},'VoiceQueuesChannelHangup':function(_0x4e00d2){var _0x2c979e=this;return new Promise(function(_0x4b8308,_0x2c4c77){if(ami['isConnected']()==![]){return _0x2c4c77(_0x2c979e[_0x89f7('0x1d')](0x1f4,[config[_0x89f7('0x13')]['ip'],config[_0x89f7('0x13')]['username'],_0x89f7('0x15')][_0x89f7('0x16')]('\x20')));}var _0xc6244f=schema(properties['voicequeuechannelhangup'])[_0x89f7('0x65')](_0x4e00d2);if(_0xc6244f['length']>0x0){return _0x2c4c77(_0x2c979e[_0x89f7('0x1d')](0x1f4,_['map'](_0xc6244f,'message')['join'](',\x20')));}var _0x594b41=_[_0x89f7('0x56')](_0x2cdd7d[_0x89f7('0x6b')],{'uniqueid':_0x4e00d2[_0x89f7('0x57')]});if(_0x594b41&&_0x594b41['channel']){return ami[_0x89f7('0x1f')]({'action':'Hangup','channel':_0x594b41[_0x89f7('0x58')]})['then'](function(_0x3f4862){_0x4b8308({'code':0xc8,'message':[_0x4e00d2[_0x89f7('0x57')],_0x3f4862['message']['toLowerCase']()][_0x89f7('0x16')]('\x20')});})['catch'](function(_0x12a614){_0x2c4c77(_0x2c979e[_0x89f7('0x1d')](0x1f5,[_0x4e00d2[_0x89f7('0x57')],_0x12a614[_0x89f7('0x1b')]['toLowerCase']()][_0x89f7('0x16')]('\x20')));});}else{return _0x2c4c77(_0x2c979e[_0x89f7('0x1d')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x535c4a){var _0x5dd272=this;return new Promise(function(_0x47ba99,_0x532ede){if(ami[_0x89f7('0x12')]()==![]){return _0x532ede(_0x5dd272[_0x89f7('0x1d')](0x1f4,[config[_0x89f7('0x13')]['ip'],config[_0x89f7('0x13')]['username'],_0x89f7('0x15')][_0x89f7('0x16')]('\x20')));}var _0x3f0327=schema(properties[_0x89f7('0x6c')])['validate'](_0x535c4a);if(_0x3f0327['length']>0x0){return _0x532ede(_0x5dd272[_0x89f7('0x1d')](0x1f4,_[_0x89f7('0x55')](_0x3f0327,_0x89f7('0x1b'))[_0x89f7('0x16')](',\x20')));}var _0x3a7bb3=_['find'](_0x2cdd7d[_0x89f7('0x6b')],{'uniqueid':_0x535c4a['uniqueid']});if(_0x3a7bb3&&_0x3a7bb3[_0x89f7('0x58')]){return ami[_0x89f7('0x1f')]({'action':_0x89f7('0x6d'),'channel':_0x3a7bb3[_0x89f7('0x58')],'exten':_0x535c4a[_0x89f7('0x6e')],'context':_0x535c4a[_0x89f7('0x6f')]||_0x3a7bb3[_0x89f7('0x6f')],'priority':0x1})[_0x89f7('0x1a')](function(_0x5ac8a9){_0x47ba99({'code':0xc8,'message':[_0x535c4a[_0x89f7('0x57')],_0x5ac8a9[_0x89f7('0x1b')]['toLowerCase']()][_0x89f7('0x16')]('\x20')});})['catch'](function(_0x59393b){_0x532ede(_0x5dd272[_0x89f7('0x1d')](0x1f5,[_0x535c4a[_0x89f7('0x57')],_0x59393b[_0x89f7('0x1b')][_0x89f7('0x5d')]()][_0x89f7('0x16')]('\x20')));});}else{return _0x532ede(_0x5dd272[_0x89f7('0x1d')](0x1f5,_0x89f7('0x64')));}});},'Agents':function(_0x26d8bb){return new Promise(function(_0x301821,_0x25f0ca){var _0x34ddda=_['values'](_0x2cdd7d['agents']);_0x301821({'count':_0x34ddda[_0x89f7('0x51')],'rows':_0x34ddda});});},'Telephones':function(_0x1939db){return new Promise(function(_0x1a99fb,_0x2fcd05){var _0x26b5cc=_['values'](_0x2cdd7d[_0x89f7('0x70')]);_0x1a99fb({'count':_0x26b5cc['length'],'rows':_0x26b5cc});});},'Trunks':function(_0x1afc00){return new Promise(function(_0x10174b,_0x5bdb59){var _0x26227e=_['values'](_0x2cdd7d[_0x89f7('0x71')]);_0x10174b({'count':_0x26227e['length'],'rows':_0x26227e});});},'OutboundChannels':function(_0x357ed7){return new Promise(function(_0x28b040,_0x2c883e){var _0x123975=_['values'](_0x2cdd7d[_0x89f7('0x72')]);_0x28b040({'count':_0x123975[_0x89f7('0x51')],'rows':_0x123975});});},'Outbound':function(_0x56dcb8){return new Promise(function(_0x56813a,_0x371985){_0x56813a(_0x2cdd7d[_0x89f7('0x2e')]);});},'Campaigns':function(_0x6bd576){return new Promise(function(_0x2dd127,_0x582fc5){var _0x5c920b=_[_0x89f7('0x52')](_0x2cdd7d[_0x89f7('0x73')]);_0x2dd127({'count':_0x5c920b[_0x89f7('0x51')],'rows':_0x5c920b});});},'VoiceQueuesPreview':function(_0x2dcca6){var _0x279df9=this;return new Promise(function(_0x238f04,_0x1986da){_0x410caf['run'](_0x2dcca6['id'])[_0x89f7('0x1a')](function(_0x16a2cf){_0x238f04({'code':0xc8,'message':_0x16a2cf[_0x89f7('0x1b')]});})['catch'](function(_0x50e17f){_0x1986da(_0x279df9['error'](0x1f4,_0x50e17f['message']));});});},'EventManager':function(_0x3f02fe){var _0x576def=this;return new Promise(function(_0x4a023c,_0x244ffb){if(!_0x3f02fe[_0x89f7('0x74')]){return _0x244ffb(_0x576def[_0x89f7('0x1d')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x89f7('0x75')](_0x89f7('0x76')+_0x3f02fe[_0x89f7('0x74')],_0x3f02fe['message']);_0x4a023c({'code':0xc8,'message':_0x3f02fe});});},'FaxAccounts':function(_0x27239a){return new Promise(function(_0x9e6afa,_0x1bd205){var _0x146819=_[_0x89f7('0x52')](_0x2cdd7d[_0x89f7('0x77')]);_0x9e6afa({'count':_0x146819['length'],'rows':_0x146819});});},'SendFax':function(_0x6b3cc8){var _0x5d9202=this;return new Promise(function(_0x41068d,_0x281ccf){_0x2ec710['send'](_0x6b3cc8)[_0x89f7('0x1a')](function(_0x31dee5){_0x41068d({'code':0xc8,'message':_0x31dee5[_0x89f7('0x1b')]});})[_0x89f7('0x1c')](function(_0x5f578d){_0x281ccf(_0x5d9202[_0x89f7('0x1d')](0x1f4,_0x5f578d['message']));});});},'CheckAfterSend':function(_0xada65d){var _0x43d2a1=this;return new Promise(function(_0x55aa49,_0x45b0cc){_0x2ec710[_0x89f7('0x78')](_0xada65d)['then'](function(_0x47c4eb){_0x55aa49({'code':0xc8,'message':_0x47c4eb[_0x89f7('0x1b')]});})['catch'](function(_0xda9cb5){_0x45b0cc(_0x43d2a1[_0x89f7('0x1d')](0x1f4,_0xda9cb5['message']));});});}};var _0x168044=jayson[_0x89f7('0x79')](_0x1fd83b)[_0x89f7('0x7a')]();_0x168044['on'](_0x89f7('0x1d'),function(_0x423a0b){return _0x251400(_0x423a0b);});_0x168044[_0x89f7('0x8')](0x232a,_0x89f7('0x7b'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x69cbd8(_0x89f7('0x7c')+0x232a);});});}; \ No newline at end of file +var _0x4514=['agents','updateStatusRealtime','pause','isConnected','asterisk','username','ami\x20disconnected','pick','keys','module','action','Reload','Action','then','message','error','join','command','content','catch','voiceQueues','hasOwnProperty','name','strategy','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','type','abandoned','loggedInDb','outbound','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalLowerLimit','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','originated','Trunk','callerid','Interval','length','values','channels','voicechannel','find','uniqueid','channel','filename','MixMonitor','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','push','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','rec','Channel\x20doesn\x27t\x20exist','map','resolve','destinationchannel','StopMixMonitor','stop','%s.%s','wav','StopMixMonitor\x20Success','voicequeuechannel','validate','queueChannels','voicequeuechannelhangup','Hangup','exten','trunks','outboundChannels','campaigns','run','event','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','moment','../../../config/environment','../properties','../ami','listen','format','SIP','timers','timer','updateAcw'];(function(_0x482046,_0xdfe37f){var _0x423e95=function(_0x587ba2){while(--_0x587ba2){_0x482046['push'](_0x482046['shift']());}};_0x423e95(++_0xdfe37f);}(_0x4514,0xf0));var _0x4451=function(_0x58c16d,_0xf75142){_0x58c16d=_0x58c16d-0x0;var _0x30da50=_0x4514[_0x58c16d];return _0x30da50;};'use strict';var _=require('lodash');var util=require(_0x4451('0x0'));var jayson=require(_0x4451('0x1'));var schema=require('validate');var BPromise=require('bluebird');var moment=require(_0x4451('0x2'));var config=require(_0x4451('0x3'));var properties=require(_0x4451('0x4'));var ami=require(_0x4451('0x5'));exports[_0x4451('0x6')]=function(_0x44f02d,_0x3718e9,_0xfd1afe){return new BPromise(function(_0x108fae,_0x2654b2){var _0x2d2e32={'QueuePause':function(_0x19e67e){return new Promise(function(_0x52e1ab,_0x4ec38c){var _0x55bb97=util[_0x4451('0x7')]('%s/%s',_0x4451('0x8'),_0x19e67e['name']);if(_0x44f02d[_0x4451('0x9')]&&_0x44f02d[_0x4451('0x9')][_0x55bb97]&&_0x44f02d[_0x4451('0x9')][_0x55bb97][_0x4451('0xa')]){_0x44f02d[_0x4451('0x9')][_0x55bb97][_0x4451('0xb')]();}if(_0x44f02d[_0x4451('0xc')][_0x55bb97]){_0x44f02d['agents'][_0x55bb97][_0x4451('0xd')]({'statePause':_0x19e67e[_0x4451('0xe')]?!![]:![]});}_0x52e1ab({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x93b4b){var _0xabc291=this;return new Promise(function(_0x46d0ac,_0x30f627){if(ami[_0x4451('0xf')]()==![]){return _0x30f627(_0xabc291['error'](0x1f4,[config[_0x4451('0x10')]['ip'],config['asterisk'][_0x4451('0x11')],_0x4451('0x12')]['join']('\x20')));}_0x93b4b=_[_0x4451('0x13')](_0x93b4b,_[_0x4451('0x14')](properties[_0x4451('0x15')]));_0x93b4b[_0x4451('0x16')]=_0x4451('0x17');return ami[_0x4451('0x18')](_0x93b4b)[_0x4451('0x19')](function(_0xb2a54){_0x46d0ac({'code':0xc8,'message':_0xb2a54[_0x4451('0x1a')]});})['catch'](function(_0x40b76f){_0x30f627(_0xabc291[_0x4451('0x1b')](0x1f5,_0x40b76f['message']));});});},'Command':function(_0x39b2ab){var _0xa75369=this;return new Promise(function(_0x23db3d,_0x3dd9ba){if(ami[_0x4451('0xf')]()==![]){return _0x3dd9ba(_0xa75369[_0x4451('0x1b')](0x1f4,[config[_0x4451('0x10')]['ip'],config[_0x4451('0x10')][_0x4451('0x11')],_0x4451('0x12')][_0x4451('0x1c')]('\x20')));}_0x39b2ab=_['pick'](_0x39b2ab,_0x4451('0x1d'));_0x39b2ab[_0x4451('0x16')]='Command';return ami[_0x4451('0x18')](_0x39b2ab)[_0x4451('0x19')](function(_0x5023e9){_0x23db3d({'code':0xc8,'message':_0x5023e9[_0x4451('0x1e')]});})[_0x4451('0x1f')](function(_0xd51657){_0x3dd9ba(_0xa75369['error'](0x1f5,_0xd51657[_0x4451('0x1a')]));});});},'VoiceQueues':function(_0x45f3b1){return new Promise(function(_0x3d83c3,_0x40219f){var _0x1b4b41=[];for(var _0x57ab4c in _0x44f02d[_0x4451('0x20')]){if(_0x44f02d[_0x4451('0x20')][_0x4451('0x21')](_0x57ab4c)){var _0x2ba919=_0x44f02d[_0x4451('0x20')][_0x57ab4c];var _0x26ceed={'id':_0x2ba919['id'],'name':_0x2ba919[_0x4451('0x22')],'strategy':_0x2ba919[_0x4451('0x23')],'answered':_0x2ba919[_0x4451('0x24')],'available':_0x2ba919[_0x4451('0x25')],'loggedIn':_0x2ba919[_0x4451('0x26')],'pTalking':_0x2ba919['pTalking'],'sumBillable':_0x2ba919[_0x4451('0x27')],'sumDuration':_0x2ba919[_0x4451('0x28')],'sumHoldTime':_0x2ba919[_0x4451('0x29')]||0x0,'talking':_0x2ba919[_0x4451('0x2a')],'total':_0x2ba919[_0x4451('0x2b')],'type':_0x2ba919[_0x4451('0x2c')],'unmanaged':_0x2ba919['unmanaged'],'abandoned':_0x2ba919[_0x4451('0x2d')],'waiting':_0x2ba919['waiting'],'loggedInDb':_0x2ba919[_0x4451('0x2e')]};if(_0x2ba919[_0x4451('0x2c')]===_0x4451('0x2f')){_0x26ceed['dialActive']=_0x2ba919['dialActive'];_0x26ceed[_0x4451('0x30')]=_0x2ba919[_0x4451('0x30')];_0x26ceed[_0x4451('0x31')]=_0x2ba919['dialOriginateCallerIdName'];_0x26ceed[_0x4451('0x32')]=_0x2ba919[_0x4451('0x32')];_0x26ceed['dialOriginateTimeout']=_0x2ba919[_0x4451('0x33')];_0x26ceed[_0x4451('0x34')]=_0x2ba919[_0x4451('0x34')];_0x26ceed[_0x4451('0x35')]=_0x2ba919[_0x4451('0x35')];_0x26ceed['outboundAnswerCallsDay']=_0x2ba919['outboundAnswerCallsDay'];_0x26ceed['outboundBlacklistCallsDay']=_0x2ba919[_0x4451('0x36')];_0x26ceed[_0x4451('0x37')]=_0x2ba919['outboundBusyCallsDay'];_0x26ceed[_0x4451('0x38')]=_0x2ba919[_0x4451('0x38')];_0x26ceed['outboundDropCallsDayACS']=_0x2ba919[_0x4451('0x39')];_0x26ceed[_0x4451('0x3a')]=_0x2ba919[_0x4451('0x3a')];_0x26ceed[_0x4451('0x3b')]=_0x2ba919[_0x4451('0x3b')];_0x26ceed[_0x4451('0x3c')]=_0x2ba919[_0x4451('0x3c')];_0x26ceed[_0x4451('0x3d')]=_0x2ba919[_0x4451('0x3d')];_0x26ceed[_0x4451('0x3e')]=_0x2ba919['outboundOriginateFailureCallsDay'];_0x26ceed['outboundReCallsDay']=_0x2ba919[_0x4451('0x3f')];_0x26ceed[_0x4451('0x40')]=_0x2ba919[_0x4451('0x40')];_0x26ceed[_0x4451('0x41')]=_0x2ba919['outboundUnknownCallsDay'];_0x26ceed[_0x4451('0x42')]=_0x2ba919['predictiveIntervalAnsweredCalls'];_0x26ceed[_0x4451('0x43')]=_0x2ba919[_0x4451('0x43')];_0x26ceed[_0x4451('0x44')]=_0x2ba919[_0x4451('0x44')];_0x26ceed['predictiveIntervalDroppedCallsCallersExit']=_0x2ba919[_0x4451('0x45')];_0x26ceed[_0x4451('0x46')]=_0x2ba919[_0x4451('0x46')];_0x26ceed[_0x4451('0x47')]=_0x2ba919['predictiveIntervalErlangCalls'];_0x26ceed[_0x4451('0x48')]=_0x2ba919[_0x4451('0x48')];_0x26ceed['predictiveIntervalHitRate']=_0x2ba919['predictiveIntervalHitRate'];_0x26ceed['predictiveIntervalLowerLimit']=_0x2ba919[_0x4451('0x49')];_0x26ceed[_0x4451('0x4a')]=_0x2ba919[_0x4451('0x4a')];_0x26ceed[_0x4451('0x4b')]=_0x2ba919[_0x4451('0x4b')];_0x26ceed['predictiveIntervalTotalCalls']=_0x2ba919['predictiveIntervalTotalCalls'];_0x26ceed[_0x4451('0x1a')]=_0x2ba919[_0x4451('0x1a')];_0x26ceed[_0x4451('0x4c')]=_0x2ba919[_0x4451('0x4c')];}if(_0x2ba919[_0x4451('0x4d')]){_0x26ceed[_0x4451('0x4d')]={'id':_0x2ba919[_0x4451('0x4d')]['id'],'name':_0x2ba919[_0x4451('0x4d')][_0x4451('0x22')],'active':_0x2ba919[_0x4451('0x4d')]['active'],'callerid':_0x2ba919[_0x4451('0x4d')][_0x4451('0x4e')]};}if(_0x2ba919[_0x4451('0x4f')]){_0x26ceed[_0x4451('0x4f')]={'id':_0x2ba919[_0x4451('0x4f')]['id'],'name':_0x2ba919[_0x4451('0x4f')]['name']};}_0x1b4b41['push'](_0x26ceed);}}_0x3d83c3({'count':_0x1b4b41[_0x4451('0x50')],'rows':_0x1b4b41});});},'VoiceChannels':function(_0x38d621){return new Promise(function(_0x109e98,_0x47a50e){var _0x44ff06=_[_0x4451('0x51')](_0x44f02d[_0x4451('0x52')]);_0x109e98({'count':_0x44ff06[_0x4451('0x50')],'rows':_0x44ff06});});},'VoiceChannelMixMonitor':function(_0x2b8bd6){var _0x239470=this;return new Promise(function(_0x249538,_0x1bd390){if(ami[_0x4451('0xf')]()==![]){return _0x1bd390(_0x239470[_0x4451('0x1b')](0x1f4,[config[_0x4451('0x10')]['ip'],config[_0x4451('0x10')]['username'],'ami\x20disconnected'][_0x4451('0x1c')]('\x20')));}var _0x26f79d=schema(properties[_0x4451('0x53')])['validate'](_0x2b8bd6);if(_0x26f79d[_0x4451('0x50')]>0x0){return _0x1bd390(_0x239470[_0x4451('0x1b')](0x1f4,_['map'](_0x26f79d,_0x4451('0x1a'))[_0x4451('0x1c')](',\x20')));}var _0x2a9fe2=_[_0x4451('0x54')](_0x44f02d['channels'],{'uniqueid':_0x2b8bd6[_0x4451('0x55')]});if(_0x2a9fe2&&_0x2a9fe2[_0x4451('0x56')]){var _0x561ddf=util['format']('%s.%s',_0x2b8bd6[_0x4451('0x57')]||_0x2b8bd6[_0x4451('0x55')],_0x2b8bd6['format']||'wav');return ami[_0x4451('0x18')]({'action':_0x4451('0x58'),'channel':_0x2a9fe2[_0x4451('0x56')],'file':_0x561ddf,'options':'ai(mixmonitorid)'})['then'](function(_0xb9db78){var _0x3dc09f=_[_0x4451('0x54')](_0x2a9fe2[_0x4451('0x59')],{'filename':_0x4451('0x5a')+_0x561ddf[_0x4451('0x5b')]()});if(_[_0x4451('0x5c')](_0x3dc09f)){_0x2a9fe2[_0x4451('0x59')][_0x4451('0x5d')]({'filename':_0x4451('0x5a')+_0x561ddf[_0x4451('0x5b')](),'createdAt':moment()[_0x4451('0x7')](_0x4451('0x5e')),'mixmonitorid':_0xb9db78[_0x4451('0x5f')],'status':'rec'});}else{_0x3dc09f[_0x4451('0x5f')]=_0xb9db78['mixmonitorid'];_0x3dc09f[_0x4451('0x60')]=_0x4451('0x61');}_0x249538({'code':0xc8,'message':[_0x2b8bd6['uniqueid'],'MixMonitor\x20Success',_0xb9db78['mixmonitorid']]['join']('\x20'),'mixmonitorid':_0xb9db78[_0x4451('0x5f')]});})['catch'](function(_0x3bcc86){_0x1bd390(_0x239470[_0x4451('0x1b')](0x1f5,[_0x2b8bd6[_0x4451('0x55')],_0x3bcc86[_0x4451('0x1a')][_0x4451('0x5b')]()]['join']('\x20')));});}else{return _0x1bd390(_0x239470[_0x4451('0x1b')](0x1f5,_0x4451('0x62')));}});},'VoiceChannelStopMixMonitor':function(_0x3c26e5){var _0x1c7a0a=this;return new Promise(function(_0x3f9095,_0x40c075){if(ami[_0x4451('0xf')]()==![]){return _0x40c075(_0x1c7a0a['error'](0x1f4,[config[_0x4451('0x10')]['ip'],config[_0x4451('0x10')][_0x4451('0x11')],_0x4451('0x12')][_0x4451('0x1c')]('\x20')));}var _0x3a7d4d=schema(properties[_0x4451('0x53')])['validate'](_0x3c26e5);if(_0x3a7d4d['length']>0x0){return _0x40c075(_0x1c7a0a[_0x4451('0x1b')](0x1f4,_[_0x4451('0x63')](_0x3a7d4d,_0x4451('0x1a'))[_0x4451('0x1c')](',\x20')));}var _0x1f1234=_[_0x4451('0x54')](_0x44f02d[_0x4451('0x52')],{'uniqueid':_0x3c26e5[_0x4451('0x55')]});if(_0x1f1234){return BPromise[_0x4451('0x64')]()[_0x4451('0x19')](function(){if(_0x1f1234['channel']){return ami[_0x4451('0x18')]({'action':'StopMixMonitor','channel':_0x1f1234[_0x4451('0x56')],'mixmonitorid':_0x3c26e5[_0x4451('0x5f')]})[_0x4451('0x1f')](function(_0x5dc188){});}})[_0x4451('0x19')](function(){if(_0x1f1234[_0x4451('0x65')]){return ami[_0x4451('0x18')]({'action':_0x4451('0x66'),'channel':_0x1f1234[_0x4451('0x65')],'mixmonitorid':_0x3c26e5[_0x4451('0x5f')]})[_0x4451('0x1f')](function(_0x56be97){});}})[_0x4451('0x19')](function(_0x26558d){var _0x32c772=_[_0x4451('0x54')](_0x1f1234[_0x4451('0x59')],{'mixmonitorid':_0x3c26e5['mixmonitorid']});if(_0x32c772){_0x32c772[_0x4451('0x60')]=_0x4451('0x67');}})[_0x4451('0x19')](function(){var _0x2e00c5=util[_0x4451('0x7')](_0x4451('0x68'),_0x3c26e5[_0x4451('0x57')]||_0x3c26e5['uniqueid'],_0x3c26e5[_0x4451('0x7')]||_0x4451('0x69'));var _0x3f1a01=_['find'](_0x1f1234[_0x4451('0x59')],{'filename':'/var/spool/asterisk/monitor/'+_0x2e00c5[_0x4451('0x5b')]()});if(_0x3f1a01){_0x3f1a01[_0x4451('0x60')]=_0x4451('0x67');}})[_0x4451('0x19')](function(){_0x3f9095({'code':0xc8,'message':[_0x3c26e5[_0x4451('0x55')],_0x4451('0x6a')][_0x4451('0x1c')]('\x20')});})[_0x4451('0x1f')](function(_0x555f25){_0x40c075(_0x1c7a0a['error'](0x1f5,[_0x3c26e5[_0x4451('0x55')],_0x555f25[_0x4451('0x1a')]['toLowerCase']()][_0x4451('0x1c')]('\x20')));});}else{return _0x40c075(_0x1c7a0a[_0x4451('0x1b')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x194803){return new Promise(function(_0x27a5cd,_0x5f21ba){var _0x2b0a3e=_[_0x4451('0x51')](_0x44f02d['queueChannels']);_0x27a5cd({'count':_0x2b0a3e['length'],'rows':_0x2b0a3e});});},'VoiceQueuesChannel':function(_0x1335d3){var _0x1ea701=this;return new Promise(function(_0x2dfb34,_0x3e2927){var _0x3bb2c8=schema(properties[_0x4451('0x6b')])[_0x4451('0x6c')](_0x1335d3);if(_0x3bb2c8[_0x4451('0x50')]>0x0){return _0x3e2927(_0x1ea701[_0x4451('0x1b')](0x1f4,_[_0x4451('0x63')](_0x3bb2c8,_0x4451('0x1a'))[_0x4451('0x1c')](',\x20')));}var _0x243c0f=_[_0x4451('0x54')](_0x44f02d[_0x4451('0x6d')],{'uniqueid':_0x1335d3[_0x4451('0x55')]});if(_0x243c0f){_0x2dfb34(_0x243c0f);}else{return _0x3e2927(_0x1ea701[_0x4451('0x1b')](0x1f5,_0x4451('0x62')));}});},'VoiceQueuesChannelHangup':function(_0x195e7e){var _0x5bb18b=this;return new Promise(function(_0x512253,_0x4854af){if(ami[_0x4451('0xf')]()==![]){return _0x4854af(_0x5bb18b[_0x4451('0x1b')](0x1f4,[config[_0x4451('0x10')]['ip'],config['asterisk'][_0x4451('0x11')],_0x4451('0x12')][_0x4451('0x1c')]('\x20')));}var _0x4edb1b=schema(properties[_0x4451('0x6e')])[_0x4451('0x6c')](_0x195e7e);if(_0x4edb1b[_0x4451('0x50')]>0x0){return _0x4854af(_0x5bb18b[_0x4451('0x1b')](0x1f4,_[_0x4451('0x63')](_0x4edb1b,_0x4451('0x1a'))[_0x4451('0x1c')](',\x20')));}var _0x520083=_['find'](_0x44f02d[_0x4451('0x6d')],{'uniqueid':_0x195e7e[_0x4451('0x55')]});if(_0x520083&&_0x520083[_0x4451('0x56')]){return ami['Action']({'action':_0x4451('0x6f'),'channel':_0x520083[_0x4451('0x56')]})[_0x4451('0x19')](function(_0x1ccdc4){_0x512253({'code':0xc8,'message':[_0x195e7e[_0x4451('0x55')],_0x1ccdc4[_0x4451('0x1a')][_0x4451('0x5b')]()]['join']('\x20')});})[_0x4451('0x1f')](function(_0x29265a){_0x4854af(_0x5bb18b['error'](0x1f5,[_0x195e7e[_0x4451('0x55')],_0x29265a['message'][_0x4451('0x5b')]()]['join']('\x20')));});}else{return _0x4854af(_0x5bb18b[_0x4451('0x1b')](0x1f5,_0x4451('0x62')));}});},'VoiceQueuesChannelRedirect':function(_0x3ed3e1){var _0x358d56=this;return new Promise(function(_0x57293c,_0x5dacc7){if(ami[_0x4451('0xf')]()==![]){return _0x5dacc7(_0x358d56[_0x4451('0x1b')](0x1f4,[config[_0x4451('0x10')]['ip'],config[_0x4451('0x10')][_0x4451('0x11')],'ami\x20disconnected'][_0x4451('0x1c')]('\x20')));}var _0x5c7bb6=schema(properties['voicequeuechannelredirect'])[_0x4451('0x6c')](_0x3ed3e1);if(_0x5c7bb6[_0x4451('0x50')]>0x0){return _0x5dacc7(_0x358d56[_0x4451('0x1b')](0x1f4,_[_0x4451('0x63')](_0x5c7bb6,_0x4451('0x1a'))[_0x4451('0x1c')](',\x20')));}var _0x1563c7=_[_0x4451('0x54')](_0x44f02d[_0x4451('0x6d')],{'uniqueid':_0x3ed3e1[_0x4451('0x55')]});if(_0x1563c7&&_0x1563c7['channel']){return ami[_0x4451('0x18')]({'action':'Redirect','channel':_0x1563c7[_0x4451('0x56')],'exten':_0x3ed3e1[_0x4451('0x70')],'context':_0x3ed3e1['context']||_0x1563c7['context'],'priority':0x1})[_0x4451('0x19')](function(_0x102f46){_0x57293c({'code':0xc8,'message':[_0x3ed3e1['uniqueid'],_0x102f46[_0x4451('0x1a')][_0x4451('0x5b')]()][_0x4451('0x1c')]('\x20')});})[_0x4451('0x1f')](function(_0x551c43){_0x5dacc7(_0x358d56['error'](0x1f5,[_0x3ed3e1[_0x4451('0x55')],_0x551c43[_0x4451('0x1a')][_0x4451('0x5b')]()]['join']('\x20')));});}else{return _0x5dacc7(_0x358d56['error'](0x1f5,_0x4451('0x62')));}});},'Agents':function(_0x2521ae){return new Promise(function(_0x3dc553,_0xd264ec){var _0x17e9ac=_[_0x4451('0x51')](_0x44f02d[_0x4451('0xc')]);_0x3dc553({'count':_0x17e9ac['length'],'rows':_0x17e9ac});});},'Telephones':function(_0x24fc27){return new Promise(function(_0x249b3f,_0xa18df0){var _0x10234f=_['values'](_0x44f02d['telephones']);_0x249b3f({'count':_0x10234f['length'],'rows':_0x10234f});});},'Trunks':function(_0x20f2b3){return new Promise(function(_0x43ef92,_0x11654e){var _0x568fb7=_[_0x4451('0x51')](_0x44f02d[_0x4451('0x71')]);_0x43ef92({'count':_0x568fb7[_0x4451('0x50')],'rows':_0x568fb7});});},'OutboundChannels':function(_0x34e4cc){return new Promise(function(_0x436cb1,_0x431541){var _0x2ebfda=_[_0x4451('0x51')](_0x44f02d[_0x4451('0x72')]);_0x436cb1({'count':_0x2ebfda[_0x4451('0x50')],'rows':_0x2ebfda});});},'Outbound':function(_0x9bda0e){return new Promise(function(_0x30c0cc,_0x17f6ff){_0x30c0cc(_0x44f02d[_0x4451('0x2f')]);});},'Campaigns':function(_0x1ec3a9){return new Promise(function(_0x3d5df1,_0x5f1851){var _0x3e581e=_[_0x4451('0x51')](_0x44f02d[_0x4451('0x73')]);_0x3d5df1({'count':_0x3e581e[_0x4451('0x50')],'rows':_0x3e581e});});},'VoiceQueuesPreview':function(_0x5b05df){var _0x2939b9=this;return new Promise(function(_0x3442cb,_0x1c2d4f){_0x3718e9[_0x4451('0x74')](_0x5b05df['id'])[_0x4451('0x19')](function(_0x4526d0){_0x3442cb({'code':0xc8,'message':_0x4526d0[_0x4451('0x1a')]});})[_0x4451('0x1f')](function(_0x255796){_0x1c2d4f(_0x2939b9[_0x4451('0x1b')](0x1f4,_0x255796[_0x4451('0x1a')]));});});},'EventManager':function(_0x388d48){var _0x419f38=this;return new Promise(function(_0x3d84a6,_0x44d633){if(!_0x388d48[_0x4451('0x75')]){return _0x44d633(_0x419f38[_0x4451('0x1b')](0x1f4,'Event\x20name\x20mandatory'));}ami['emit']('custom:'+_0x388d48['event'],_0x388d48['message']);_0x3d84a6({'code':0xc8,'message':_0x388d48});});},'FaxAccounts':function(_0x37b3f1){return new Promise(function(_0x3a7086,_0x191906){var _0x3827ad=_[_0x4451('0x51')](_0x44f02d[_0x4451('0x76')]);_0x3a7086({'count':_0x3827ad[_0x4451('0x50')],'rows':_0x3827ad});});},'SendFax':function(_0x3873ba){var _0x4d68ac=this;return new Promise(function(_0x25a210,_0x3e0bf2){_0xfd1afe[_0x4451('0x77')](_0x3873ba)[_0x4451('0x19')](function(_0x17bb22){_0x25a210({'code':0xc8,'message':_0x17bb22[_0x4451('0x1a')]});})[_0x4451('0x1f')](function(_0x1a087b){_0x3e0bf2(_0x4d68ac[_0x4451('0x1b')](0x1f4,_0x1a087b[_0x4451('0x1a')]));});});},'CheckAfterSend':function(_0x47bf2f){var _0x2464ce=this;return new Promise(function(_0x328c03,_0x367f49){_0xfd1afe[_0x4451('0x78')](_0x47bf2f)[_0x4451('0x19')](function(_0x217666){_0x328c03({'code':0xc8,'message':_0x217666[_0x4451('0x1a')]});})[_0x4451('0x1f')](function(_0x36f52f){_0x367f49(_0x2464ce[_0x4451('0x1b')](0x1f4,_0x36f52f[_0x4451('0x1a')]));});});}};var _0x33a769=jayson[_0x4451('0x79')](_0x2d2e32)[_0x4451('0x7a')]();_0x33a769['on'](_0x4451('0x1b'),function(_0x4ec8aa){return _0x2654b2(_0x4ec8aa);});_0x33a769['listen'](0x232a,_0x4451('0x7b'),function(){console['log'](_0x4451('0x7c'),0x232a);return _0x108fae(_0x4451('0x7d')+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 d95b99c..8ba5654 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 _0x48ff=['routeId','firstName','calleridname','','uniqueid','destcalleridname','phone','destcalleridnum','resolve','then','showContact','omit','xmd-contactid2','format','user:%s','name','trigger:%s','toLowerCase','createContact','action','merge','error','Error\x20creating\x20contact','bluebird','util','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','stringify','exec','autoCreate','data2','data1','calleridnum','isNil'];(function(_0xb36e10,_0x570f27){var _0x2a2025=function(_0x275c8b){while(--_0x275c8b){_0xb36e10['push'](_0xb36e10['shift']());}};_0x2a2025(++_0x570f27);}(_0x48ff,0x86));var _0xf48f=function(_0xb39b05,_0x2f21cd){_0xb39b05=_0xb39b05-0x0;var _0x383a48=_0x48ff[_0xb39b05];return _0x383a48;};'use strict';var BPromise=require(_0xf48f('0x0'));var util=require(_0xf48f('0x1'));var _=require('lodash');var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0xf48f('0x2'))(_0xf48f('0x3'));var cmContactRpc=require(_0xf48f('0x4'));config[_0xf48f('0x5')]=_[_0xf48f('0x6')](config[_0xf48f('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf48f('0x5')]));function emit(_0x18ef7d,_0x434991,_0x370bac){logger['info'](_0x18ef7d,_0x434991,JSON[_0xf48f('0x7')](_0x370bac));io['to'](_0x18ef7d)['emit'](_0x434991,_0x370bac);}exports[_0xf48f('0x8')]=function(_0x3fa28c,_0x2bce22,_0x1f3324){_0x1f3324[_0xf48f('0x9')]=0x0;if(_0x2bce22[_0xf48f('0xa')]&&parseInt(_0x2bce22[_0xf48f('0xa')],0xa)){var _0x18677e={'ListId':parseInt(_0x2bce22[_0xf48f('0xb')],0xa),'phone':_0x1f3324[_0xf48f('0xc')]};if(_[_0xf48f('0xd')](_0x1f3324[_0xf48f('0xe')])){_0x18677e[_0xf48f('0xf')]=_0x1f3324[_0xf48f('0x10')]&&_0x1f3324[_0xf48f('0x10')]!==_0xf48f('0x11')?_0x1f3324[_0xf48f('0x10')]:_0x1f3324['calleridnum']||_0x1f3324[_0xf48f('0x12')];}else{_0x18677e[_0xf48f('0xf')]=_0x1f3324[_0xf48f('0x13')]&&_0x1f3324['destcalleridname']!==_0xf48f('0x11')?_0x1f3324[_0xf48f('0x13')]:_0x1f3324['destcalleridnum']||_0x1f3324[_0xf48f('0x12')];_0x18677e[_0xf48f('0x14')]=_0x1f3324['destcalleridname']&&_0x1f3324['destcalleridname']!==_0xf48f('0x11')?_0x1f3324['destcalleridname']:_0x1f3324[_0xf48f('0x15')]||_0x1f3324[_0xf48f('0x12')];}BPromise[_0xf48f('0x16')]()[_0xf48f('0x17')](cmContactRpc[_0xf48f('0x18')]({'where':_[_0xf48f('0x19')](_0x18677e,[_0xf48f('0xf')])}))[_0xf48f('0x17')](function(_0x190813){if(_0x190813){_0x1f3324[_0xf48f('0x1a')]=_0x190813['id'];emit(util[_0xf48f('0x1b')](_0xf48f('0x1c'),_0x3fa28c[_0xf48f('0x1d')]),util[_0xf48f('0x1b')](_0xf48f('0x1e'),_0x2bce22['action'][_0xf48f('0x1f')]()),_['merge'](_0x1f3324,{'ListId':parseInt(_0x2bce22[_0xf48f('0xb')],0xa)}));return;}else{return BPromise[_0xf48f('0x16')]()['then'](cmContactRpc[_0xf48f('0x20')](_0x18677e));}})[_0xf48f('0x17')](function(_0x58a1aa){if(_0x58a1aa){_0x1f3324[_0xf48f('0x1a')]=_0x58a1aa['id'];emit(util[_0xf48f('0x1b')](_0xf48f('0x1c'),_0x3fa28c['name']),util[_0xf48f('0x1b')](_0xf48f('0x1e'),_0x2bce22[_0xf48f('0x21')][_0xf48f('0x1f')]()),_[_0xf48f('0x22')](_0x1f3324,{'ListId':parseInt(_0x2bce22[_0xf48f('0xb')],0xa)}));}})['catch'](function(_0x5154b9){logger[_0xf48f('0x23')](_0xf48f('0x24'),JSON[_0xf48f('0x7')](_0x5154b9));});}else{if(_0x3fa28c){emit(util['format'](_0xf48f('0x1c'),_0x3fa28c[_0xf48f('0x1d')]),util[_0xf48f('0x1b')](_0xf48f('0x1e'),_0x2bce22[_0xf48f('0x21')][_0xf48f('0x1f')]()),_[_0xf48f('0x22')]({'ListId':parseInt(_0x2bce22['data1'],0xa)},_0x1f3324));}}}; \ No newline at end of file +var _0x5825=['toLowerCase','createContact','xmd-contactid2','error','bluebird','util','ioredis','trigger','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','info','stringify','exec','autoCreate','data2','data1','calleridnum','routeId','firstName','calleridname','','destcalleridname','destcalleridnum','uniqueid','phone','resolve','then','showContact','format','user:%s','name','trigger:%s','action'];(function(_0x147656,_0x205a15){var _0x37e1e9=function(_0xea78b){while(--_0xea78b){_0x147656['push'](_0x147656['shift']());}};_0x37e1e9(++_0x205a15);}(_0x5825,0x94));var _0x5582=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5825[_0x321bb2];return _0x9c12ed;};'use strict';var BPromise=require(_0x5582('0x0'));var util=require(_0x5582('0x1'));var _=require('lodash');var Redis=require(_0x5582('0x2'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x5582('0x3'));var cmContactRpc=require(_0x5582('0x4'));config['redis']=_[_0x5582('0x5')](config[_0x5582('0x6')],{'host':_0x5582('0x7'),'port':0x18eb});var io=require(_0x5582('0x8'))(new Redis(config[_0x5582('0x6')]));function emit(_0x350fce,_0x534844,_0x1fd9ed){logger[_0x5582('0x9')](_0x350fce,_0x534844,JSON[_0x5582('0xa')](_0x1fd9ed));io['to'](_0x350fce)['emit'](_0x534844,_0x1fd9ed);}exports[_0x5582('0xb')]=function(_0xc3e927,_0x4f9605,_0x3e1865){_0x3e1865[_0x5582('0xc')]=0x0;if(_0x4f9605[_0x5582('0xd')]&&parseInt(_0x4f9605[_0x5582('0xd')],0xa)){var _0x103654={'ListId':parseInt(_0x4f9605[_0x5582('0xe')],0xa),'phone':_0x3e1865[_0x5582('0xf')]};if(_['isNil'](_0x3e1865[_0x5582('0x10')])){_0x103654[_0x5582('0x11')]=_0x3e1865[_0x5582('0x12')]&&_0x3e1865[_0x5582('0x12')]!==_0x5582('0x13')?_0x3e1865[_0x5582('0x12')]:_0x3e1865[_0x5582('0xf')]||_0x3e1865['uniqueid'];}else{_0x103654[_0x5582('0x11')]=_0x3e1865[_0x5582('0x14')]&&_0x3e1865['destcalleridname']!==_0x5582('0x13')?_0x3e1865[_0x5582('0x14')]:_0x3e1865[_0x5582('0x15')]||_0x3e1865[_0x5582('0x16')];_0x103654[_0x5582('0x17')]=_0x3e1865[_0x5582('0x14')]&&_0x3e1865['destcalleridname']!==_0x5582('0x13')?_0x3e1865[_0x5582('0x14')]:_0x3e1865[_0x5582('0x15')]||_0x3e1865[_0x5582('0x16')];}BPromise[_0x5582('0x18')]()[_0x5582('0x19')](cmContactRpc[_0x5582('0x1a')]({'where':_['omit'](_0x103654,[_0x5582('0x11')])}))[_0x5582('0x19')](function(_0x1d4753){if(_0x1d4753){_0x3e1865['xmd-contactid2']=_0x1d4753['id'];emit(util[_0x5582('0x1b')](_0x5582('0x1c'),_0xc3e927[_0x5582('0x1d')]),util['format'](_0x5582('0x1e'),_0x4f9605[_0x5582('0x1f')][_0x5582('0x20')]()),_['merge'](_0x3e1865,{'ListId':parseInt(_0x4f9605[_0x5582('0xe')],0xa)}));return;}else{return BPromise[_0x5582('0x18')]()[_0x5582('0x19')](cmContactRpc[_0x5582('0x21')](_0x103654));}})[_0x5582('0x19')](function(_0x1a72e8){if(_0x1a72e8){_0x3e1865[_0x5582('0x22')]=_0x1a72e8['id'];emit(util['format']('user:%s',_0xc3e927[_0x5582('0x1d')]),util['format'](_0x5582('0x1e'),_0x4f9605[_0x5582('0x1f')][_0x5582('0x20')]()),_['merge'](_0x3e1865,{'ListId':parseInt(_0x4f9605[_0x5582('0xe')],0xa)}));}})['catch'](function(_0x5ed0a0){logger[_0x5582('0x23')]('Error\x20creating\x20contact',JSON['stringify'](_0x5ed0a0));});}else{if(_0xc3e927){emit(util['format'](_0x5582('0x1c'),_0xc3e927[_0x5582('0x1d')]),util[_0x5582('0x1b')]('trigger:%s',_0x4f9605[_0x5582('0x1f')]['toLowerCase']()),_['merge']({'ListId':parseInt(_0x4f9605[_0x5582('0xe')],0xa)},_0x3e1865));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 6b28a12..194c986 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 _0xfcce=['merge','Actions','length','interface','action','toLowerCase','contactmanager','motionbar','browser','data1','popup','TemplateId','data2','html','template\x20not\x20found','uri','isNil','data3','data4','location','uriLocation','windowWidth','data5','windowHeight','data6','600','winApplication','render','winArguments','format','user:%s','name','trigger:%s:%s','jscripty','trigger:%s','exec','routeId','urlforward','buildUri','parse','search','AllConditions','every','checkConditions','channel','AnyConditions','some','field','chat','ChatWebsiteId','value','upperFirst','AccountId','interaction','message','queue','lastevent','operator','util','url','mustache','ioredis','./urlforward','./integration','../../../config/logger','trigger','../ami','redis','defaults','socket.io-emitter','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','accounts','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:queuecallerabandon','custom:dialbegin','custom:dialconnect','custom:closedinteraction','custom:acceptmessage','prototype','emit','stringify','clone','checkTriggers','hasOwnProperty','status','checkTrigger'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xfcce,0x104));var _0xefcc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfcce[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xefcc('0x0'));var _=require('lodash');var url=require(_0xefcc('0x1'));var Mustache=require(_0xefcc('0x2'));var Redis=require(_0xefcc('0x3'));var urlforward=require(_0xefcc('0x4'));var integration=require(_0xefcc('0x5'));var cmContact=require('./cmContact');var cmContactRpc=require('../rpc/cmContact');var config=require('../../../config/environment');var logger=require(_0xefcc('0x6'))(_0xefcc('0x7'));var ami=require(_0xefcc('0x8'));config[_0xefcc('0x9')]=_[_0xefcc('0xa')](config[_0xefcc('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xefcc('0xb'))(new Redis(config[_0xefcc('0x9')]));var operators={'equals':function(_0x5a9334,_0x3e9e45){return _0x5a9334==_0x3e9e45;},'not_equals':function(_0x8abde,_0xaa6756){return _0x8abde!=_0xaa6756;}};var barAndWebActions=['popup',_0xefcc('0x1'),'winapp'];function Trigger(_0x23ab16){this[_0xefcc('0xc')]=_0x23ab16[_0xefcc('0xc')];this[_0xefcc('0xd')]=_0x23ab16[_0xefcc('0xd')];this[_0xefcc('0xe')]=_0x23ab16['voiceQueues'];this[_0xefcc('0xf')]=_0x23ab16[_0xefcc('0xf')];this[_0xefcc('0x10')]=_0x23ab16[_0xefcc('0x10')];this[_0xefcc('0x11')]=_0x23ab16[_0xefcc('0x11')];this[_0xefcc('0x12')]=_0x23ab16[_0xefcc('0x12')];this[_0xefcc('0x13')]=_0x23ab16[_0xefcc('0x13')];this[_0xefcc('0x14')]=_0x23ab16[_0xefcc('0x14')];this[_0xefcc('0x15')]=_0x23ab16['zohoAccounts'];this[_0xefcc('0x16')]=_0x23ab16[_0xefcc('0x16')];this[_0xefcc('0x17')]=_0x23ab16[_0xefcc('0x17')];this[_0xefcc('0x18')]={'zendesk':this[_0xefcc('0x11')],'salesforce':this[_0xefcc('0x13')],'freshdesk':this[_0xefcc('0x12')],'sugarcrm':this[_0xefcc('0x14')],'zoho':this[_0xefcc('0x15')],'desk':this[_0xefcc('0x16')],'vtiger':this[_0xefcc('0x17')]};ami['on']('custom:agentcalled',this[_0xefcc('0x19')][_0xefcc('0x1a')](this));ami['on'](_0xefcc('0x1b'),this['syncCustomEvent'][_0xefcc('0x1a')](this));ami['on'](_0xefcc('0x1c'),this['syncCustomEvent'][_0xefcc('0x1a')](this));ami['on'](_0xefcc('0x1d'),this[_0xefcc('0x19')][_0xefcc('0x1a')](this));ami['on'](_0xefcc('0x1e'),this[_0xefcc('0x19')][_0xefcc('0x1a')](this));ami['on'](_0xefcc('0x1f'),this['syncCustomEvent']['bind'](this));ami['on'](_0xefcc('0x20'),this[_0xefcc('0x19')][_0xefcc('0x1a')](this));ami['on']('custom:dialend',this[_0xefcc('0x19')]['bind'](this));ami['on']('custom:newinteraction',this[_0xefcc('0x19')][_0xefcc('0x1a')](this));ami['on'](_0xefcc('0x21'),this[_0xefcc('0x19')][_0xefcc('0x1a')](this));ami['on']('custom:incomingmessage',this[_0xefcc('0x19')][_0xefcc('0x1a')](this));ami['on']('custom:outgoingmessage',this[_0xefcc('0x19')][_0xefcc('0x1a')](this));ami['on'](_0xefcc('0x22'),this[_0xefcc('0x19')]['bind'](this));ami['on']('custom:rejectmessage',this[_0xefcc('0x19')][_0xefcc('0x1a')](this));}Trigger[_0xefcc('0x23')][_0xefcc('0x24')]=function(_0x554d38,_0x3b4f9b,_0x56b002){logger['info'](_0x554d38,_0x3b4f9b,JSON[_0xefcc('0x25')](_0x56b002));io['to'](_0x554d38)[_0xefcc('0x24')](_0x3b4f9b,_0x56b002);};Trigger[_0xefcc('0x23')][_0xefcc('0x19')]=function(_0x2bbc78){var _0x3616c6=_[_0xefcc('0x26')](_0x2bbc78);this[_0xefcc('0x27')](_0x3616c6);};Trigger['prototype']['checkTriggers']=function(_0x4eb110){var _0x2d6736;for(var _0x477120 in this[_0xefcc('0xc')]){if(this[_0xefcc('0xc')][_0xefcc('0x28')](_0x477120)){if(this[_0xefcc('0xc')][_0x477120][_0xefcc('0x29')]){_0x2d6736=this[_0xefcc('0x2a')](this['triggers'][_0x477120],_0x4eb110);if(_0x2d6736){_[_0xefcc('0x2b')](_0x4eb110,_0x4eb110['variables']);for(var _0x570020=0x0,_0x2cbb14,_0x5b9e81,_0x34b989;_0x5700200x0){_0x4c0ed6=_[_0xaac6('0x2a')](_0xc4b235,_0x321cbc);}return _0x4c0ed6;}function getCustomFields(_0x512d93,_0x225dc5){var _0x41090a=[];var _0x15dfee={'custom_fields':{}};if(_0x512d93[_0xaac6('0x2b')]>0x0){_[_0xaac6('0x2c')](_0x512d93,function(_0x5d6950){if(_0x5d6950[_0xaac6('0x2d')]===_0xaac6('0x2e')&&_0x5d6950[_0xaac6('0x2f')]&&!_0x5d6950['customField']){_0x15dfee[_0x5d6950[_0xaac6('0x2f')][_0xaac6('0x30')]()]=_0x5d6950[_0xaac6('0x31')][_0xaac6('0x32')]();}else if(_0x5d6950[_0xaac6('0x2d')]==='string'&&_0x5d6950['idField']&&_0x5d6950[_0xaac6('0x33')]){_0x15dfee[_0xaac6('0x34')][_0x5d6950[_0xaac6('0x35')]]=_0x5d6950['content'][_0xaac6('0x32')]();}else if(_0x5d6950[_0xaac6('0x2d')]===_0xaac6('0x36')&&_0x5d6950['variableName']&&_0x5d6950[_0xaac6('0x35')]&&_0x5d6950[_0xaac6('0x33')]){_0x225dc5[_0x5d6950[_0xaac6('0x37')]]&&(_0x15dfee[_0xaac6('0x34')][_0x5d6950[_0xaac6('0x35')]]=_0x225dc5[_0x5d6950['variableName']][_0xaac6('0x32')]());}else if(_0x5d6950[_0xaac6('0x2d')]==='customVariable'&&_0x5d6950[_0xaac6('0x38')]&&_0x5d6950[_0xaac6('0x38')]['name']&&_0x5d6950[_0xaac6('0x35')]&&_0x5d6950[_0xaac6('0x33')]){_0x225dc5[_0x5d6950[_0xaac6('0x38')][_0xaac6('0x39')][_0xaac6('0x30')]()]&&(_0x15dfee['custom_fields'][_0x5d6950[_0xaac6('0x35')]]=_0x225dc5[_0x5d6950[_0xaac6('0x38')][_0xaac6('0x39')][_0xaac6('0x30')]()][_0xaac6('0x32')]());}});}if(_0x15dfee['priority']){_0x15dfee['priority']=Number(_0x15dfee['priority']);}return _0x15dfee;}function getTicket(_0x52fe68,_0x492827,_0x3d3938,_0x53ba2c,_0x2f9294){logger[_0xaac6('0xd')](_0xaac6('0x3a'));var _0x2aa206=_[_0xaac6('0x3b')]({'subject':intUtil[_0xaac6('0x3c')](_0x53ba2c[_0xaac6('0x3d')],_0x2f9294,'\x20'),'type':_0xaac6('0x3e'),'status':_0xaac6('0x3f'),'labels':[_0xaac6('0x40'),'Motion','CTI']['concat'](getTags(_0x53ba2c[_0xaac6('0x41')],_0xaac6('0x39'))),'description':intUtil['getString'](_0x53ba2c[_0xaac6('0x42')],_0x2f9294,'\x0a'),'_links':{'assigned_user':{'href':util[_0xaac6('0xf')](_0xaac6('0x43'),_0x492827['id']),'class':_0xaac6('0x44')}},'message':{'direction':'in','body':intUtil[_0xaac6('0x3c')](_0x53ba2c['Descriptions'],_0x2f9294,'\x0a')}},getCustomFields(_0x53ba2c[_0xaac6('0x45')],_0x2f9294));return request({'uri':util[_0xaac6('0xf')](_0xaac6('0x46'),_0x52fe68['remoteUri'],_0x3d3938['id']),'method':'POST','body':_0x2aa206});}exports['queue']=function(_0x18b95d,_0x1680ea,_0x1cdcca,_0x39126a,_0x553a98,_0x598359){var _0x188dbf,_0xfbab0c;_0x598359[_0xaac6('0x17')]=intUtil[_0xaac6('0x47')](_0x598359[_0xaac6('0x17')]);_0x598359[_0xaac6('0x48')]=intUtil[_0xaac6('0x47')](_0x598359[_0xaac6('0x48')]);if(_0x553a98&&_0x553a98['monitor_format']){logger[_0xaac6('0xd')](_0xaac6('0x49'),_0xaac6('0x4a'));_0x1680ea[_0xaac6('0x4b')]=util[_0xaac6('0xf')](_0xaac6('0x4c'),_0x598359[_0xaac6('0x48')],_0x1680ea[_0xaac6('0x4d')],md5(_0x1680ea['uniqueid']));}else{_0x1680ea[_0xaac6('0x4b')]='';}headers['Authorization']=getAuth(_0x598359);return getUser(_0x598359,_0x39126a[_0xaac6('0x4e')])[_0xaac6('0x11')](function(_0x3f75b8){_0x188dbf=_0x3f75b8;logger[_0xaac6('0xd')](_0xaac6('0x4f'),_0x188dbf['id']);return getEndUser(_0x598359,_0x1680ea['calleridname'],_0x1680ea[_0xaac6('0x50')]);})[_0xaac6('0x11')](function(_0x274ef7){_0xfbab0c=_0x274ef7;logger[_0xaac6('0xd')](_0xaac6('0x51'),_0xfbab0c['id']);return getTicket(_0x598359,_0x188dbf,_0xfbab0c,_0x1cdcca,_0x1680ea);})[_0xaac6('0x11')](function(_0x23d8a4){if(_0x23d8a4){logger[_0xaac6('0xd')]('Ticket\x20created!');logger[_0xaac6('0xd')](_0xaac6('0x52'),_0x23d8a4['id']);switch(_0x598359[_0xaac6('0x2d')]){case'integrationTab':logger[_0xaac6('0xd')](_0xaac6('0x49'),_0xaac6('0x53'));emit(util[_0xaac6('0xf')](_0xaac6('0x54'),_0x39126a[_0xaac6('0x39')]),'trigger:desk:display',{'recordId':_0x23d8a4['id']});break;case _0xaac6('0x55'):logger[_0xaac6('0xd')](_0xaac6('0x49'),_0xaac6('0x56'));emit(util['format']('user:%s',_0x39126a[_0xaac6('0x39')]),_0xaac6('0x57'),{'uri':util['format'](_0xaac6('0x58'),_0x23d8a4['id'])});break;default:logger[_0xaac6('0x59')](_0xaac6('0x49'),_0xaac6('0x5a'));}}})[_0xaac6('0x5b')](function(_0x265850){console['error'](_0x265850);logger[_0xaac6('0x59')](_0xaac6('0x49'),JSON['stringify'](_0x265850));});};exports[_0xaac6('0x5c')]=function(_0x9c325,_0x5a125b,_0x5bc213,_0x101078,_0x16a6f0,_0x53776d,_0x1a4636){var _0xd0917e,_0x20feb3;_0x53776d[_0xaac6('0x17')]=intUtil[_0xaac6('0x47')](_0x53776d[_0xaac6('0x17')]);_0x53776d['serverUrl']=intUtil[_0xaac6('0x47')](_0x53776d[_0xaac6('0x48')]);if(_0x1a4636&&_0x1a4636['recordingFormat']&&_0x1a4636[_0xaac6('0x5d')]!==_0xaac6('0x5e')){logger[_0xaac6('0xd')](_0xaac6('0x5f'),'Recording\x20is\x20enabled!');_0x5a125b['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x53776d[_0xaac6('0x48')],_0x5a125b[_0xaac6('0x4d')],md5(_0x5a125b[_0xaac6('0x4d')]));}headers['Authorization']=getAuth(_0x53776d);return getUser(_0x53776d,_0x101078[_0xaac6('0x4e')])[_0xaac6('0x11')](function(_0x934c99){_0xd0917e=_0x934c99;logger[_0xaac6('0xd')](_0xaac6('0x4f'),_0xd0917e['id']);return getEndUser(_0x53776d,_0x5a125b['destcalleridname'],_0x5a125b['destcalleridnum']);})[_0xaac6('0x11')](function(_0x212e82){_0x20feb3=_0x212e82;logger[_0xaac6('0xd')]('The\x20Enduser\x20ID\x20is:',_0x20feb3['id']);return getTicket(_0x53776d,_0xd0917e,_0x20feb3,_0x5bc213,_0x5a125b);})[_0xaac6('0x11')](function(_0x26d1a3){if(_0x26d1a3){logger[_0xaac6('0xd')](_0xaac6('0x60'));logger[_0xaac6('0xd')](_0xaac6('0x52'),_0x26d1a3['id']);switch(_0x53776d[_0xaac6('0x2d')]){case _0xaac6('0x61'):logger[_0xaac6('0xd')]('[QUEUE]',_0xaac6('0x53'));emit(util[_0xaac6('0xf')](_0xaac6('0x54'),_0x101078[_0xaac6('0x39')]),'trigger:desk:display',{'recordId':_0x26d1a3['id']});break;case _0xaac6('0x55'):logger[_0xaac6('0xd')](_0xaac6('0x49'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xaac6('0xf')](_0xaac6('0x54'),_0x101078[_0xaac6('0x39')]),_0xaac6('0x57'),{'uri':util[_0xaac6('0xf')](_0xaac6('0x62'),_0x53776d[_0xaac6('0x17')],_0x26d1a3['id'])});break;default:logger[_0xaac6('0x59')]('[OUTBOUND]',_0xaac6('0x5a'));}}})[_0xaac6('0x5b')](function(_0x13cea8){logger[_0xaac6('0x59')](_0xaac6('0x5f'),JSON[_0xaac6('0x1a')](_0x13cea8));});};exports[_0xaac6('0x63')]=function(_0x25bc13,_0x567198,_0x1dc489,_0x40075a,_0x1371df,_0x33b90e){var _0x5acf6d,_0x3b45f0;_0x33b90e[_0xaac6('0x17')]=intUtil[_0xaac6('0x47')](_0x33b90e[_0xaac6('0x17')]);_0x33b90e['serverUrl']=intUtil[_0xaac6('0x47')](_0x33b90e['serverUrl']);if(_0x1371df&&_0x1371df[_0xaac6('0x64')]){logger[_0xaac6('0xd')](_0xaac6('0x65'),_0xaac6('0x4a'));_0x567198['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x33b90e['serverUrl'],_0x567198['uniqueid'],md5(_0x567198[_0xaac6('0x4d')]));}else{_0x567198['recordingURL']='';}headers['Authorization']=getAuth(_0x33b90e);return getUser(_0x33b90e)['then'](function(_0x1027ae){_0x5acf6d=_0x1027ae;logger[_0xaac6('0xd')](_0xaac6('0x4f'),_0x5acf6d['id']);return getEndUser(_0x33b90e,_0x567198['calleridname'],_0x567198[_0xaac6('0x50')]);})[_0xaac6('0x11')](function(_0x2ad73d){_0x3b45f0=_0x2ad73d;logger['info'](_0xaac6('0x51'),_0x3b45f0['id']);return getTicket(_0x33b90e,_0x5acf6d,_0x3b45f0,_0x1dc489,_0x567198);})[_0xaac6('0x11')](function(_0x2df344){if(_0x2df344){logger[_0xaac6('0xd')]('Ticket\x20created!');logger[_0xaac6('0xd')](_0xaac6('0x52'),_0x2df344['id']);}})['catch'](function(_0x44ddaa){logger[_0xaac6('0x59')](_0xaac6('0x65'),JSON[_0xaac6('0x1a')](_0x44ddaa));});}; \ No newline at end of file +var _0xaf0d=['outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','newTab','abandoned','[ABANDONED]','Ticket\x20created!','request-promise','md5','desk','redis','defaults','localhost','socket.io-emitter','emit','application/json','Getting\x20agent\x20with\x20email','format','remoteUri','then','total_entries','_embedded','entries','info','Agent\x20found!','[HTTP]','GET','basic','%s:%s','authType','token','%s/token:%s','username','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','length','forEach','type','string','nameField','customField','content','idField','variable','variableName','custom_fields','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY','concat','Tags','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://xcally.desk.com/web/agent/case/%d','Desk\x20account\x20type\x20not\x20recognized','catch','error','stringify'];(function(_0x3bdab7,_0x4c4595){var _0x5de6b9=function(_0x367a16){while(--_0x367a16){_0x3bdab7['push'](_0x3bdab7['shift']());}};_0x5de6b9(++_0x4c4595);}(_0xaf0d,0x6d));var _0xdaf0=function(_0x96916,_0x2dc0c9){_0x96916=_0x96916-0x0;var _0x43815f=_0xaf0d[_0x96916];return _0x43815f;};'use strict';var _=require('lodash');var rp=require(_0xdaf0('0x0'));var md5=require(_0xdaf0('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xdaf0('0x2'));config[_0xdaf0('0x3')]=_[_0xdaf0('0x4')](config['redis'],{'host':_0xdaf0('0x5'),'port':0x18eb});var io=require(_0xdaf0('0x6'))(new Redis(config['redis']));function emit(_0x5ad050,_0x26bda3,_0x1dc345){io['to'](_0x5ad050)[_0xdaf0('0x7')](_0x26bda3,_0x1dc345);}var headers={'Content-Type':_0xdaf0('0x8'),'Accept':'application/json'};function getUser(_0x528d8a,_0x481ee3){logger['info'](_0xdaf0('0x9'),_0x481ee3);return request({'uri':util[_0xdaf0('0xa')]('%s/users',_0x528d8a[_0xdaf0('0xb')])})[_0xdaf0('0xc')](function(_0x682267){if(_0x682267[_0xdaf0('0xd')]){return _['find'](_0x682267[_0xdaf0('0xe')][_0xdaf0('0xf')],{'email':_0x481ee3});}})[_0xdaf0('0xc')](function(_0x4fbd9c){if(_0x4fbd9c){logger[_0xdaf0('0x10')](_0xdaf0('0x11'));return _0x4fbd9c;}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/users/me',_0x528d8a['remoteUri'])});}});}function request(_0x3221f6){logger['debug'](_0xdaf0('0x12'),JSON['stringify'](_0x3221f6));return rp(_['defaults'](_0x3221f6,{'method':_0xdaf0('0x13'),'headers':headers,'json':!![]}));}function getAuth(_0xeefdcd){var _0x370345;if(_0xeefdcd['authType']===_0xdaf0('0x14')){_0x370345=util[_0xdaf0('0xa')](_0xdaf0('0x15'),_0xeefdcd['username'],_0xeefdcd['password']);}else if(_0xeefdcd[_0xdaf0('0x16')]===_0xdaf0('0x17')){_0x370345=util[_0xdaf0('0xa')](_0xdaf0('0x18'),_0xeefdcd[_0xdaf0('0x19')],_0xeefdcd[_0xdaf0('0x17')]);}return util[_0xdaf0('0xa')]('Basic\x20%s',new Buffer(_0x370345)[_0xdaf0('0x1a')](_0xdaf0('0x1b')));}function getEndUser(_0x164632,_0x452bb6,_0x5c39f9){logger[_0xdaf0('0x10')](_0xdaf0('0x1c'),_0x5c39f9);return request({'uri':util[_0xdaf0('0xa')](_0xdaf0('0x1d'),_0x164632['remoteUri']),'qs':{'phone':_0x5c39f9}})[_0xdaf0('0xc')](function(_0x3f886f){if(_0x3f886f[_0xdaf0('0xd')]){logger[_0xdaf0('0x10')](_0xdaf0('0x1e'));return _0x3f886f[_0xdaf0('0xe')][_0xdaf0('0xf')][0x0];}else{logger['info'](_0xdaf0('0x1f'));return request({'uri':util[_0xdaf0('0xa')](_0xdaf0('0x20'),_0x164632[_0xdaf0('0xb')]),'method':_0xdaf0('0x21'),'body':{'first_name':_0x452bb6,'title':_0x452bb6,'phone_numbers':[{'type':_0xdaf0('0x22'),'value':_0x5c39f9}]}});}});}function getTags(_0x2efd93,_0x4d3347){var _0x2dcf40=[];if(_0x2efd93&&_0x2efd93['length']>0x0){_0x2dcf40=_[_0xdaf0('0x23')](_0x2efd93,_0x4d3347);}return _0x2dcf40;}function getCustomFields(_0x740ff,_0x4e6974){var _0x39a5b2=[];var _0x5762cc={'custom_fields':{}};if(_0x740ff[_0xdaf0('0x24')]>0x0){_[_0xdaf0('0x25')](_0x740ff,function(_0x5dbb6d){if(_0x5dbb6d[_0xdaf0('0x26')]===_0xdaf0('0x27')&&_0x5dbb6d[_0xdaf0('0x28')]&&!_0x5dbb6d[_0xdaf0('0x29')]){_0x5762cc[_0x5dbb6d[_0xdaf0('0x28')]['toLowerCase']()]=_0x5dbb6d[_0xdaf0('0x2a')][_0xdaf0('0x1a')]();}else if(_0x5dbb6d[_0xdaf0('0x26')]==='string'&&_0x5dbb6d[_0xdaf0('0x2b')]&&_0x5dbb6d[_0xdaf0('0x29')]){_0x5762cc['custom_fields'][_0x5dbb6d[_0xdaf0('0x2b')]]=_0x5dbb6d[_0xdaf0('0x2a')]['toString']();}else if(_0x5dbb6d[_0xdaf0('0x26')]===_0xdaf0('0x2c')&&_0x5dbb6d[_0xdaf0('0x2d')]&&_0x5dbb6d[_0xdaf0('0x2b')]&&_0x5dbb6d[_0xdaf0('0x29')]){_0x4e6974[_0x5dbb6d[_0xdaf0('0x2d')]]&&(_0x5762cc[_0xdaf0('0x2e')][_0x5dbb6d[_0xdaf0('0x2b')]]=_0x4e6974[_0x5dbb6d[_0xdaf0('0x2d')]][_0xdaf0('0x1a')]());}else if(_0x5dbb6d[_0xdaf0('0x26')]==='customVariable'&&_0x5dbb6d['Variable']&&_0x5dbb6d['Variable'][_0xdaf0('0x2f')]&&_0x5dbb6d[_0xdaf0('0x2b')]&&_0x5dbb6d['customField']){_0x4e6974[_0x5dbb6d[_0xdaf0('0x30')][_0xdaf0('0x2f')][_0xdaf0('0x31')]()]&&(_0x5762cc[_0xdaf0('0x2e')][_0x5dbb6d[_0xdaf0('0x2b')]]=_0x4e6974[_0x5dbb6d[_0xdaf0('0x30')][_0xdaf0('0x2f')][_0xdaf0('0x31')]()][_0xdaf0('0x1a')]());}});}if(_0x5762cc[_0xdaf0('0x32')]){_0x5762cc[_0xdaf0('0x32')]=Number(_0x5762cc[_0xdaf0('0x32')]);}return _0x5762cc;}function getTicket(_0x116fed,_0x258f39,_0x370849,_0xae1660,_0x3c37b1){logger['info'](_0xdaf0('0x33'));var _0x21fa86=_[_0xdaf0('0x34')]({'subject':intUtil[_0xdaf0('0x35')](_0xae1660[_0xdaf0('0x36')],_0x3c37b1,'\x20'),'type':_0xdaf0('0x37'),'status':_0xdaf0('0x38'),'labels':[_0xdaf0('0x39'),'Motion','CTI'][_0xdaf0('0x3a')](getTags(_0xae1660[_0xdaf0('0x3b')],_0xdaf0('0x2f'))),'description':intUtil['getString'](_0xae1660[_0xdaf0('0x3c')],_0x3c37b1,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xdaf0('0x3d'),_0x258f39['id']),'class':_0xdaf0('0x3e')}},'message':{'direction':'in','body':intUtil[_0xdaf0('0x35')](_0xae1660[_0xdaf0('0x3c')],_0x3c37b1,'\x0a')}},getCustomFields(_0xae1660[_0xdaf0('0x3f')],_0x3c37b1));return request({'uri':util[_0xdaf0('0xa')](_0xdaf0('0x40'),_0x116fed['remoteUri'],_0x370849['id']),'method':_0xdaf0('0x21'),'body':_0x21fa86});}exports[_0xdaf0('0x41')]=function(_0x58acf7,_0x2a9209,_0x5b5f3b,_0x480b2b,_0x60218a,_0x57a251){var _0x2b969a,_0x50f02e;_0x57a251[_0xdaf0('0xb')]=intUtil[_0xdaf0('0x42')](_0x57a251[_0xdaf0('0xb')]);_0x57a251['serverUrl']=intUtil[_0xdaf0('0x42')](_0x57a251[_0xdaf0('0x43')]);if(_0x60218a&&_0x60218a[_0xdaf0('0x44')]){logger['info'](_0xdaf0('0x45'),_0xdaf0('0x46'));_0x2a9209[_0xdaf0('0x47')]=util[_0xdaf0('0xa')](_0xdaf0('0x48'),_0x57a251[_0xdaf0('0x43')],_0x2a9209[_0xdaf0('0x49')],md5(_0x2a9209[_0xdaf0('0x49')]));}else{_0x2a9209['recordingURL']='';}headers[_0xdaf0('0x4a')]=getAuth(_0x57a251);return getUser(_0x57a251,_0x480b2b[_0xdaf0('0x4b')])['then'](function(_0x1e242a){_0x2b969a=_0x1e242a;logger[_0xdaf0('0x10')](_0xdaf0('0x4c'),_0x2b969a['id']);return getEndUser(_0x57a251,_0x2a9209[_0xdaf0('0x4d')],_0x2a9209[_0xdaf0('0x4e')]);})[_0xdaf0('0xc')](function(_0x203161){_0x50f02e=_0x203161;logger['info'](_0xdaf0('0x4f'),_0x50f02e['id']);return getTicket(_0x57a251,_0x2b969a,_0x50f02e,_0x5b5f3b,_0x2a9209);})[_0xdaf0('0xc')](function(_0x58b3d8){if(_0x58b3d8){logger['info']('Ticket\x20created!');logger[_0xdaf0('0x10')](_0xdaf0('0x50'),_0x58b3d8['id']);switch(_0x57a251[_0xdaf0('0x26')]){case _0xdaf0('0x51'):logger[_0xdaf0('0x10')](_0xdaf0('0x45'),_0xdaf0('0x52'));emit(util[_0xdaf0('0xa')](_0xdaf0('0x53'),_0x480b2b[_0xdaf0('0x2f')]),_0xdaf0('0x54'),{'recordId':_0x58b3d8['id']});break;case'newTab':logger[_0xdaf0('0x10')](_0xdaf0('0x45'),_0xdaf0('0x55'));emit(util['format'](_0xdaf0('0x53'),_0x480b2b[_0xdaf0('0x2f')]),'trigger:browser:url',{'uri':util[_0xdaf0('0xa')](_0xdaf0('0x56'),_0x58b3d8['id'])});break;default:logger['error'](_0xdaf0('0x45'),_0xdaf0('0x57'));}}})[_0xdaf0('0x58')](function(_0x2438e0){console[_0xdaf0('0x59')](_0x2438e0);logger['error'](_0xdaf0('0x45'),JSON[_0xdaf0('0x5a')](_0x2438e0));});};exports[_0xdaf0('0x5b')]=function(_0x2ed97e,_0x3884e6,_0x304daa,_0x50f2b6,_0x8dac49,_0x10fc69,_0x16acbf){var _0x13f28e,_0x2697ee;_0x10fc69['remoteUri']=intUtil[_0xdaf0('0x42')](_0x10fc69[_0xdaf0('0xb')]);_0x10fc69[_0xdaf0('0x43')]=intUtil[_0xdaf0('0x42')](_0x10fc69[_0xdaf0('0x43')]);if(_0x16acbf&&_0x16acbf[_0xdaf0('0x5c')]&&_0x16acbf['recordingFormat']!==_0xdaf0('0x5d')){logger[_0xdaf0('0x10')](_0xdaf0('0x5e'),'Recording\x20is\x20enabled!');_0x3884e6[_0xdaf0('0x47')]=util[_0xdaf0('0xa')](_0xdaf0('0x48'),_0x10fc69[_0xdaf0('0x43')],_0x3884e6[_0xdaf0('0x49')],md5(_0x3884e6[_0xdaf0('0x49')]));}headers[_0xdaf0('0x4a')]=getAuth(_0x10fc69);return getUser(_0x10fc69,_0x50f2b6[_0xdaf0('0x4b')])['then'](function(_0x12f177){_0x13f28e=_0x12f177;logger['info']('The\x20User\x20ID\x20is:',_0x13f28e['id']);return getEndUser(_0x10fc69,_0x3884e6['destcalleridname'],_0x3884e6[_0xdaf0('0x5f')]);})[_0xdaf0('0xc')](function(_0x4ebb37){_0x2697ee=_0x4ebb37;logger[_0xdaf0('0x10')]('The\x20Enduser\x20ID\x20is:',_0x2697ee['id']);return getTicket(_0x10fc69,_0x13f28e,_0x2697ee,_0x304daa,_0x3884e6);})['then'](function(_0xb2b01d){if(_0xb2b01d){logger[_0xdaf0('0x10')]('Ticket\x20created!');logger['info'](_0xdaf0('0x50'),_0xb2b01d['id']);switch(_0x10fc69[_0xdaf0('0x26')]){case _0xdaf0('0x51'):logger[_0xdaf0('0x10')](_0xdaf0('0x45'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xdaf0('0xa')](_0xdaf0('0x53'),_0x50f2b6[_0xdaf0('0x2f')]),'trigger:desk:display',{'recordId':_0xb2b01d['id']});break;case _0xdaf0('0x60'):logger[_0xdaf0('0x10')](_0xdaf0('0x45'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xdaf0('0xa')]('user:%s',_0x50f2b6[_0xdaf0('0x2f')]),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x10fc69['remoteUri'],_0xb2b01d['id'])});break;default:logger['error'](_0xdaf0('0x5e'),_0xdaf0('0x57'));}}})[_0xdaf0('0x58')](function(_0x245924){logger[_0xdaf0('0x59')]('[OUTBOUND]',JSON[_0xdaf0('0x5a')](_0x245924));});};exports[_0xdaf0('0x61')]=function(_0x183242,_0x1c147a,_0x240436,_0xd18392,_0x462994,_0xba1787){var _0x2b2400,_0x1b5e75;_0xba1787[_0xdaf0('0xb')]=intUtil[_0xdaf0('0x42')](_0xba1787[_0xdaf0('0xb')]);_0xba1787[_0xdaf0('0x43')]=intUtil['stripTrailingSlash'](_0xba1787[_0xdaf0('0x43')]);if(_0x462994&&_0x462994[_0xdaf0('0x44')]){logger['info'](_0xdaf0('0x62'),_0xdaf0('0x46'));_0x1c147a[_0xdaf0('0x47')]=util[_0xdaf0('0xa')](_0xdaf0('0x48'),_0xba1787[_0xdaf0('0x43')],_0x1c147a[_0xdaf0('0x49')],md5(_0x1c147a[_0xdaf0('0x49')]));}else{_0x1c147a[_0xdaf0('0x47')]='';}headers['Authorization']=getAuth(_0xba1787);return getUser(_0xba1787)[_0xdaf0('0xc')](function(_0x223dd3){_0x2b2400=_0x223dd3;logger[_0xdaf0('0x10')](_0xdaf0('0x4c'),_0x2b2400['id']);return getEndUser(_0xba1787,_0x1c147a['calleridname'],_0x1c147a[_0xdaf0('0x4e')]);})[_0xdaf0('0xc')](function(_0x47122c){_0x1b5e75=_0x47122c;logger[_0xdaf0('0x10')]('The\x20Enduser\x20ID\x20is:',_0x1b5e75['id']);return getTicket(_0xba1787,_0x2b2400,_0x1b5e75,_0x240436,_0x1c147a);})[_0xdaf0('0xc')](function(_0x37f8cf){if(_0x37f8cf){logger['info'](_0xdaf0('0x63'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x37f8cf['id']);}})[_0xdaf0('0x58')](function(_0x2a2cfe){logger[_0xdaf0('0x59')](_0xdaf0('0x62'),JSON[_0xdaf0('0x5a')](_0x2a2cfe));});}; \ 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 9ac1cfa..9d2884e 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 _0x8e41=['toLowerCase','content','push','idField','variable','variableName','type','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','outbound','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','catch','error','[ABANDONED]','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','info','merge','Caller\x20-\x20%s','getString','Subjects','Tags','name','custom_fields','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','Getting\x20agent\x20with\x20email','format','length','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','[HTTP]','stringify','GET','map','forEach','string','nameField','customField'];(function(_0x2d78b6,_0x2a88f1){var _0x176586=function(_0x3f5d12){while(--_0x3f5d12){_0x2d78b6['push'](_0x2d78b6['shift']());}};_0x176586(++_0x2a88f1);}(_0x8e41,0xd8));var _0x18e4=function(_0x6470a2,_0x3b5f44){_0x6470a2=_0x6470a2-0x0;var _0x24ac61=_0x8e41[_0x6470a2];return _0x24ac61;};'use strict';var _=require(_0x18e4('0x0'));var rp=require(_0x18e4('0x1'));var md5=require(_0x18e4('0x2'));var util=require(_0x18e4('0x3'));var Redis=require(_0x18e4('0x4'));var intUtil=require(_0x18e4('0x5'));var config=require(_0x18e4('0x6'));var logger=require(_0x18e4('0x7'))(_0x18e4('0x8'));config[_0x18e4('0x9')]=_[_0x18e4('0xa')](config[_0x18e4('0x9')],{'host':_0x18e4('0xb'),'port':0x18eb});var io=require(_0x18e4('0xc'))(new Redis(config[_0x18e4('0x9')]));var headers={'Content-Type':_0x18e4('0xd'),'Accept':'application/json'};function emit(_0x3a4c74,_0x595983,_0xf08ba4){io['to'](_0x3a4c74)['emit'](_0x595983,_0xf08ba4);}function getTicket(_0x43c4b9,_0x3b996d,_0x413c95,_0x75267f,_0x1bb1a9){logger[_0x18e4('0xe')]('Creating\x20new\x20ticket...');var _0x4aef0e=_[_0x18e4('0xf')]({'responder_id':_0x3b996d['id'],'requester_id':_0x413c95['id'],'name':util['format'](_0x18e4('0x10'),_0x1bb1a9['calleridname']),'phone':_0x1bb1a9['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x18e4('0x11')](_0x75267f[_0x18e4('0x12')],_0x1bb1a9,'\x20'),'description':intUtil['getString'](_0x75267f['Descriptions'],_0x1bb1a9,'
'),'tags':getTags(_0x75267f[_0x18e4('0x13')],_0x18e4('0x14'))},getCustomFields(_0x75267f['Fields'],_0x1bb1a9));_0x4aef0e[_0x18e4('0x15')]=_['mapValues'](_[_0x18e4('0x16')](_0x4aef0e[_0x18e4('0x15')],'id'),_0x18e4('0x17'));return request({'uri':util['format'](_0x18e4('0x18'),_0x43c4b9[_0x18e4('0x19')]),'method':_0x18e4('0x1a'),'body':_0x4aef0e})[_0x18e4('0x1b')](function(_0x590caa){logger[_0x18e4('0xe')](_0x18e4('0x1c'));return _0x590caa;});}function getUser(_0x129253,_0x1a8e6a){logger['info'](_0x18e4('0x1d'),_0x1a8e6a);return request({'uri':util[_0x18e4('0x1e')]('%s/api/v2/agents',_0x129253[_0x18e4('0x19')]),'qs':{'email':_0x1a8e6a}})['then'](function(_0x33f81e){if(_0x33f81e[_0x18e4('0x1f')]){logger['info'](_0x18e4('0x20'));return _[_0x18e4('0x21')](_0x33f81e,function(_0x3dabfc){return _0x3dabfc[_0x18e4('0x22')]['email']===_0x1a8e6a;});}else{logger[_0x18e4('0xe')](_0x18e4('0x23'));return request({'uri':util[_0x18e4('0x1e')](_0x18e4('0x24'),_0x129253['remoteUri'])})[_0x18e4('0x1b')](function(_0x400631){logger[_0x18e4('0xe')](_0x18e4('0x25'));return _0x400631;});}});}function getEndUser(_0x59ca7f,_0x21c129,_0x1422b5){logger[_0x18e4('0xe')](_0x18e4('0x26'),_0x1422b5);return request({'uri':util['format'](_0x18e4('0x27'),_0x59ca7f[_0x18e4('0x19')]),'qs':{'phone':_0x1422b5}})[_0x18e4('0x1b')](function(_0x1661b6){if(_0x1661b6['length']){logger[_0x18e4('0xe')]('Enduser\x20found!');return _[_0x18e4('0x21')](_0x1661b6,{'phone':_0x1422b5});}else{logger['info'](_0x18e4('0x28'));return request({'uri':util['format']('%s/api/v2/contacts',_0x59ca7f[_0x18e4('0x19')]),'method':'POST','body':{'name':_0x21c129,'phone':_0x1422b5}})[_0x18e4('0x1b')](function(_0x1a17bb){logger['info'](_0x18e4('0x29'));return _0x1a17bb;});}});}function getAuth(_0x2d9c52){return util['format'](_0x18e4('0x2a'),new Buffer(_0x2d9c52[_0x18e4('0x2b')]+':X')[_0x18e4('0x2c')]('base64'));}function request(_0x277ba6){logger[_0x18e4('0x2d')](_0x18e4('0x2e'),JSON[_0x18e4('0x2f')](_0x277ba6));return rp(_[_0x18e4('0xa')](_0x277ba6,{'method':_0x18e4('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x2ea0f9,_0x260c8a){var _0x528fde=[];if(_0x2ea0f9&&_0x2ea0f9[_0x18e4('0x1f')]>0x0){_0x528fde=_[_0x18e4('0x31')](_0x2ea0f9,_0x260c8a);}return _0x528fde;}function getCustomFields(_0xbff679,_0x5d5e2c){var _0x53d2c6=[];var _0x61891a={'custom_fields':[]};if(_0xbff679['length']>0x0){_[_0x18e4('0x32')](_0xbff679,function(_0x485d8f){if(_0x485d8f['type']===_0x18e4('0x33')&&_0x485d8f[_0x18e4('0x34')]&&!_0x485d8f[_0x18e4('0x35')]){_0x61891a[_0x485d8f[_0x18e4('0x34')][_0x18e4('0x36')]()]=_0x485d8f[_0x18e4('0x37')][_0x18e4('0x2c')]();}else if(_0x485d8f['type']===_0x18e4('0x33')&&_0x485d8f['idField']&&_0x485d8f[_0x18e4('0x35')]){_0x61891a[_0x18e4('0x15')][_0x18e4('0x38')]({'id':_0x485d8f[_0x18e4('0x39')],'value':_0x485d8f[_0x18e4('0x37')][_0x18e4('0x2c')]()});}else if(_0x485d8f['type']===_0x18e4('0x3a')&&_0x485d8f[_0x18e4('0x3b')]&&_0x485d8f[_0x18e4('0x39')]&&_0x485d8f[_0x18e4('0x35')]){_0x5d5e2c[_0x485d8f[_0x18e4('0x3b')]]&&_0x61891a['custom_fields']['push']({'id':_0x485d8f[_0x18e4('0x39')],'value':_0x5d5e2c[_0x485d8f[_0x18e4('0x3b')]][_0x18e4('0x2c')]()});}else if(_0x485d8f[_0x18e4('0x3c')]===_0x18e4('0x3d')&&_0x485d8f[_0x18e4('0x3e')]&&_0x485d8f['Variable'][_0x18e4('0x14')]&&_0x485d8f[_0x18e4('0x39')]&&_0x485d8f[_0x18e4('0x35')]){_0x5d5e2c[_0x485d8f[_0x18e4('0x3e')][_0x18e4('0x14')]['toLowerCase']()]&&_0x61891a['custom_fields'][_0x18e4('0x38')]({'id':_0x485d8f[_0x18e4('0x39')],'value':_0x5d5e2c[_0x485d8f['Variable'][_0x18e4('0x14')][_0x18e4('0x36')]()]['toString']()});}});}return _0x61891a;}exports['queue']=function(_0x181583,_0x7f16d3,_0x331dfb,_0x475497,_0x4aa595,_0x24f3bf){var _0x16fd14,_0x58a4b9;_0x24f3bf[_0x18e4('0x19')]=intUtil[_0x18e4('0x3f')](_0x24f3bf['remoteUri']);_0x24f3bf[_0x18e4('0x40')]=intUtil[_0x18e4('0x3f')](_0x24f3bf['serverUrl']);if(_0x4aa595&&_0x4aa595[_0x18e4('0x41')]){logger[_0x18e4('0xe')](_0x18e4('0x42'),_0x18e4('0x43'));_0x7f16d3[_0x18e4('0x44')]=util[_0x18e4('0x1e')](_0x18e4('0x45'),_0x24f3bf[_0x18e4('0x40')],_0x7f16d3[_0x18e4('0x46')],md5(_0x7f16d3[_0x18e4('0x46')]));}else{_0x7f16d3['recordingURL']='';}headers[_0x18e4('0x47')]=getAuth(_0x24f3bf);return getUser(_0x24f3bf,_0x475497[_0x18e4('0x48')])['then'](function(_0x377f6a){_0x16fd14=_0x377f6a;logger['info']('The\x20User\x20ID\x20is:',_0x16fd14['id']);return getEndUser(_0x24f3bf,_0x7f16d3[_0x18e4('0x49')],_0x7f16d3[_0x18e4('0x4a')]);})[_0x18e4('0x1b')](function(_0x42fb98){_0x58a4b9=_0x42fb98;logger[_0x18e4('0xe')](_0x18e4('0x4b'),_0x58a4b9['id']);return getTicket(_0x24f3bf,_0x16fd14,_0x58a4b9,_0x331dfb,_0x7f16d3);})[_0x18e4('0x1b')](function(_0x49d33e){if(_0x49d33e&&_0x49d33e['id']){logger[_0x18e4('0xe')](_0x18e4('0x1c'));logger[_0x18e4('0xe')](_0x18e4('0x4c'),_0x49d33e['id']);logger['info'](_0x18e4('0x42'),_0x18e4('0x4d'));emit(util[_0x18e4('0x1e')](_0x18e4('0x4e'),_0x475497[_0x18e4('0x14')]),_0x18e4('0x4f'),{'uri':util[_0x18e4('0x1e')](_0x18e4('0x50'),_0x24f3bf[_0x18e4('0x19')],_0x49d33e['id'])});}})['catch'](function(_0x22e39b){logger['error'](_0x18e4('0x42'),JSON['stringify'](_0x22e39b));});};exports[_0x18e4('0x51')]=function(_0x4c7aa5,_0x8d0574,_0x3980a9,_0x15b72b,_0x224868,_0x476303,_0x191902){var _0x1b1ffd,_0x1a1f51;_0x476303[_0x18e4('0x19')]=intUtil[_0x18e4('0x3f')](_0x476303['remoteUri']);_0x476303[_0x18e4('0x40')]=intUtil[_0x18e4('0x3f')](_0x476303['serverUrl']);if(_0x191902&&_0x191902['recordingFormat']&&_0x191902['recordingFormat']!==_0x18e4('0x52')){logger[_0x18e4('0xe')](_0x18e4('0x53'),_0x18e4('0x43'));_0x8d0574[_0x18e4('0x44')]=util['format'](_0x18e4('0x45'),_0x476303[_0x18e4('0x40')],_0x8d0574[_0x18e4('0x46')],md5(_0x8d0574[_0x18e4('0x46')]));}headers[_0x18e4('0x47')]=getAuth(_0x476303);return getUser(_0x476303,_0x15b72b['email'])[_0x18e4('0x1b')](function(_0x5b1ce1){_0x1b1ffd=_0x5b1ce1;logger[_0x18e4('0xe')](_0x18e4('0x54'),_0x1b1ffd['id']);return getEndUser(_0x476303,_0x8d0574[_0x18e4('0x55')],_0x8d0574[_0x18e4('0x56')]);})['then'](function(_0x4da4f0){_0x1a1f51=_0x4da4f0;logger[_0x18e4('0xe')](_0x18e4('0x4b'),_0x1a1f51['id']);return getTicket(_0x476303,_0x1b1ffd,_0x1a1f51,_0x3980a9,_0x8d0574);})[_0x18e4('0x1b')](function(_0x5885ba){if(_0x5885ba&&_0x5885ba['id']){logger['info'](_0x18e4('0x1c'));logger[_0x18e4('0xe')](_0x18e4('0x4c'),_0x5885ba['id']);logger[_0x18e4('0xe')](_0x18e4('0x53'),_0x18e4('0x4d'));emit(util[_0x18e4('0x1e')](_0x18e4('0x4e'),_0x15b72b[_0x18e4('0x14')]),'trigger:browser:url',{'uri':util[_0x18e4('0x1e')](_0x18e4('0x50'),_0x476303[_0x18e4('0x19')],_0x5885ba['id'])});}})[_0x18e4('0x57')](function(_0x3e4720){logger[_0x18e4('0x58')]('[OUTBOUND]',JSON[_0x18e4('0x2f')](_0x3e4720));});};exports['abandoned']=function(_0x51ed62,_0x441359,_0xdf6315,_0xef4117,_0xab1fd9,_0x504265){var _0x47d5a1,_0x551448;_0x504265[_0x18e4('0x19')]=intUtil[_0x18e4('0x3f')](_0x504265[_0x18e4('0x19')]);_0x504265['serverUrl']=intUtil[_0x18e4('0x3f')](_0x504265['serverUrl']);if(_0xab1fd9&&_0xab1fd9[_0x18e4('0x41')]){logger[_0x18e4('0xe')](_0x18e4('0x59'),_0x18e4('0x43'));_0x441359[_0x18e4('0x44')]=util[_0x18e4('0x1e')](_0x18e4('0x45'),_0x504265[_0x18e4('0x40')],_0x441359[_0x18e4('0x46')],md5(_0x441359[_0x18e4('0x46')]));}else{_0x441359[_0x18e4('0x44')]='';}headers[_0x18e4('0x47')]=getAuth(_0x504265);return getUser(_0x504265,_0xef4117['email'])['then'](function(_0x31a6db){_0x47d5a1=_0x31a6db;logger[_0x18e4('0xe')](_0x18e4('0x54'),_0x47d5a1['id']);return getEndUser(_0x504265,_0x441359[_0x18e4('0x49')],_0x441359[_0x18e4('0x4a')]);})[_0x18e4('0x1b')](function(_0x33f622){_0x551448=_0x33f622;logger['info'](_0x18e4('0x4b'),_0x551448['id']);return getTicket(_0x504265,_0x47d5a1,_0x551448,_0xdf6315,_0x441359);})[_0x18e4('0x1b')](function(_0x19c9a8){if(_0x19c9a8){logger['info'](_0x18e4('0x1c'));logger[_0x18e4('0xe')](_0x18e4('0x4c'),_0x19c9a8['id']);}})['catch'](function(_0x224bf2){logger[_0x18e4('0x58')](_0x18e4('0x59'),JSON['stringify'](_0x224bf2));});}; \ No newline at end of file +var _0xa277=['idField','push','type','variable','variableName','customVariable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','[OUTBOUND]','destcalleridnum','abandoned','[ABANDONED]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridnum','getString','Subjects','
','Tags','name','custom_fields','mapValues','keyBy','format','%s/api/v2/tickets','remoteUri','POST','then','info','Getting\x20agent\x20with\x20email','%s/api/v2/agents','length','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','apiKey','toString','base64','debug','[HTTP]','stringify','GET','string','nameField','customField','toLowerCase','content'];(function(_0x5c5406,_0x26b93d){var _0x5b44d4=function(_0x2bef3e){while(--_0x2bef3e){_0x5c5406['push'](_0x5c5406['shift']());}};_0x5b44d4(++_0x26b93d);}(_0xa277,0xca));var _0x7a27=function(_0x3e7e15,_0x1e8973){_0x3e7e15=_0x3e7e15-0x0;var _0xe2f225=_0xa277[_0x3e7e15];return _0xe2f225;};'use strict';var _=require('lodash');var rp=require(_0x7a27('0x0'));var md5=require('md5');var util=require(_0x7a27('0x1'));var Redis=require(_0x7a27('0x2'));var intUtil=require(_0x7a27('0x3'));var config=require(_0x7a27('0x4'));var logger=require(_0x7a27('0x5'))(_0x7a27('0x6'));config['redis']=_['defaults'](config[_0x7a27('0x7')],{'host':_0x7a27('0x8'),'port':0x18eb});var io=require(_0x7a27('0x9'))(new Redis(config[_0x7a27('0x7')]));var headers={'Content-Type':_0x7a27('0xa'),'Accept':_0x7a27('0xa')};function emit(_0xf79094,_0x34b367,_0x1c3400){io['to'](_0xf79094)[_0x7a27('0xb')](_0x34b367,_0x1c3400);}function getTicket(_0x1334ab,_0x1baf46,_0x1ec3a5,_0x37491e,_0x102cf3){logger['info'](_0x7a27('0xc'));var _0x148223=_[_0x7a27('0xd')]({'responder_id':_0x1baf46['id'],'requester_id':_0x1ec3a5['id'],'name':util['format'](_0x7a27('0xe'),_0x102cf3['calleridname']),'phone':_0x102cf3[_0x7a27('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x7a27('0x10')](_0x37491e[_0x7a27('0x11')],_0x102cf3,'\x20'),'description':intUtil['getString'](_0x37491e['Descriptions'],_0x102cf3,_0x7a27('0x12')),'tags':getTags(_0x37491e[_0x7a27('0x13')],_0x7a27('0x14'))},getCustomFields(_0x37491e['Fields'],_0x102cf3));_0x148223[_0x7a27('0x15')]=_[_0x7a27('0x16')](_[_0x7a27('0x17')](_0x148223[_0x7a27('0x15')],'id'),'value');return request({'uri':util[_0x7a27('0x18')](_0x7a27('0x19'),_0x1334ab[_0x7a27('0x1a')]),'method':_0x7a27('0x1b'),'body':_0x148223})[_0x7a27('0x1c')](function(_0x4ddc5f){logger[_0x7a27('0x1d')]('Ticket\x20created!');return _0x4ddc5f;});}function getUser(_0x306551,_0x41f073){logger[_0x7a27('0x1d')](_0x7a27('0x1e'),_0x41f073);return request({'uri':util['format'](_0x7a27('0x1f'),_0x306551[_0x7a27('0x1a')]),'qs':{'email':_0x41f073}})['then'](function(_0x6be614){if(_0x6be614[_0x7a27('0x20')]){logger[_0x7a27('0x1d')]('Agent\x20found!');return _[_0x7a27('0x21')](_0x6be614,function(_0x3a1295){return _0x3a1295[_0x7a27('0x22')][_0x7a27('0x23')]===_0x41f073;});}else{logger['info'](_0x7a27('0x24'));return request({'uri':util[_0x7a27('0x18')]('%s/api/v2/agents/me',_0x306551[_0x7a27('0x1a')])})[_0x7a27('0x1c')](function(_0x1da9a3){logger['info'](_0x7a27('0x25'));return _0x1da9a3;});}});}function getEndUser(_0x2b4f4a,_0x1675cb,_0x15cf69){logger[_0x7a27('0x1d')]('Searching\x20enduser\x20with\x20phone',_0x15cf69);return request({'uri':util[_0x7a27('0x18')]('%s/api/v2/contacts',_0x2b4f4a[_0x7a27('0x1a')]),'qs':{'phone':_0x15cf69}})[_0x7a27('0x1c')](function(_0x8726fd){if(_0x8726fd[_0x7a27('0x20')]){logger['info'](_0x7a27('0x26'));return _[_0x7a27('0x21')](_0x8726fd,{'phone':_0x15cf69});}else{logger[_0x7a27('0x1d')](_0x7a27('0x27'));return request({'uri':util[_0x7a27('0x18')](_0x7a27('0x28'),_0x2b4f4a[_0x7a27('0x1a')]),'method':_0x7a27('0x1b'),'body':{'name':_0x1675cb,'phone':_0x15cf69}})[_0x7a27('0x1c')](function(_0x2520c8){logger[_0x7a27('0x1d')]('Enduser\x20created.');return _0x2520c8;});}});}function getAuth(_0x24ddf3){return util['format']('Basic\x20%s',new Buffer(_0x24ddf3[_0x7a27('0x29')]+':X')[_0x7a27('0x2a')](_0x7a27('0x2b')));}function request(_0x14c195){logger[_0x7a27('0x2c')](_0x7a27('0x2d'),JSON[_0x7a27('0x2e')](_0x14c195));return rp(_['defaults'](_0x14c195,{'method':_0x7a27('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x479c29,_0x2fc249){var _0x407126=[];if(_0x479c29&&_0x479c29[_0x7a27('0x20')]>0x0){_0x407126=_['map'](_0x479c29,_0x2fc249);}return _0x407126;}function getCustomFields(_0x4bb0f5,_0x2c96db){var _0x27e217=[];var _0x3dd878={'custom_fields':[]};if(_0x4bb0f5['length']>0x0){_['forEach'](_0x4bb0f5,function(_0x3aeb0c){if(_0x3aeb0c['type']===_0x7a27('0x30')&&_0x3aeb0c[_0x7a27('0x31')]&&!_0x3aeb0c[_0x7a27('0x32')]){_0x3dd878[_0x3aeb0c[_0x7a27('0x31')][_0x7a27('0x33')]()]=_0x3aeb0c[_0x7a27('0x34')][_0x7a27('0x2a')]();}else if(_0x3aeb0c['type']===_0x7a27('0x30')&&_0x3aeb0c[_0x7a27('0x35')]&&_0x3aeb0c[_0x7a27('0x32')]){_0x3dd878[_0x7a27('0x15')][_0x7a27('0x36')]({'id':_0x3aeb0c[_0x7a27('0x35')],'value':_0x3aeb0c[_0x7a27('0x34')][_0x7a27('0x2a')]()});}else if(_0x3aeb0c[_0x7a27('0x37')]===_0x7a27('0x38')&&_0x3aeb0c[_0x7a27('0x39')]&&_0x3aeb0c[_0x7a27('0x35')]&&_0x3aeb0c['customField']){_0x2c96db[_0x3aeb0c[_0x7a27('0x39')]]&&_0x3dd878[_0x7a27('0x15')][_0x7a27('0x36')]({'id':_0x3aeb0c[_0x7a27('0x35')],'value':_0x2c96db[_0x3aeb0c[_0x7a27('0x39')]][_0x7a27('0x2a')]()});}else if(_0x3aeb0c[_0x7a27('0x37')]===_0x7a27('0x3a')&&_0x3aeb0c['Variable']&&_0x3aeb0c['Variable'][_0x7a27('0x14')]&&_0x3aeb0c['idField']&&_0x3aeb0c[_0x7a27('0x32')]){_0x2c96db[_0x3aeb0c['Variable'][_0x7a27('0x14')][_0x7a27('0x33')]()]&&_0x3dd878['custom_fields'][_0x7a27('0x36')]({'id':_0x3aeb0c[_0x7a27('0x35')],'value':_0x2c96db[_0x3aeb0c['Variable'][_0x7a27('0x14')][_0x7a27('0x33')]()][_0x7a27('0x2a')]()});}});}return _0x3dd878;}exports['queue']=function(_0x50248d,_0x341faa,_0x3e8301,_0x158531,_0x2a4ff0,_0xe02151){var _0xebc335,_0x630841;_0xe02151[_0x7a27('0x1a')]=intUtil[_0x7a27('0x3b')](_0xe02151['remoteUri']);_0xe02151[_0x7a27('0x3c')]=intUtil['stripTrailingSlash'](_0xe02151[_0x7a27('0x3c')]);if(_0x2a4ff0&&_0x2a4ff0[_0x7a27('0x3d')]){logger[_0x7a27('0x1d')](_0x7a27('0x3e'),_0x7a27('0x3f'));_0x341faa[_0x7a27('0x40')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xe02151[_0x7a27('0x3c')],_0x341faa['uniqueid'],md5(_0x341faa[_0x7a27('0x41')]));}else{_0x341faa['recordingURL']='';}headers[_0x7a27('0x42')]=getAuth(_0xe02151);return getUser(_0xe02151,_0x158531['email'])['then'](function(_0x1f5d6b){_0xebc335=_0x1f5d6b;logger[_0x7a27('0x1d')](_0x7a27('0x43'),_0xebc335['id']);return getEndUser(_0xe02151,_0x341faa[_0x7a27('0x44')],_0x341faa['calleridnum']);})[_0x7a27('0x1c')](function(_0x4ffa8a){_0x630841=_0x4ffa8a;logger['info'](_0x7a27('0x45'),_0x630841['id']);return getTicket(_0xe02151,_0xebc335,_0x630841,_0x3e8301,_0x341faa);})[_0x7a27('0x1c')](function(_0x40fef4){if(_0x40fef4&&_0x40fef4['id']){logger['info'](_0x7a27('0x46'));logger[_0x7a27('0x1d')](_0x7a27('0x47'),_0x40fef4['id']);logger[_0x7a27('0x1d')](_0x7a27('0x3e'),_0x7a27('0x48'));emit(util[_0x7a27('0x18')](_0x7a27('0x49'),_0x158531['name']),_0x7a27('0x4a'),{'uri':util[_0x7a27('0x18')](_0x7a27('0x4b'),_0xe02151['remoteUri'],_0x40fef4['id'])});}})[_0x7a27('0x4c')](function(_0x2beee7){logger[_0x7a27('0x4d')]('[QUEUE]',JSON[_0x7a27('0x2e')](_0x2beee7));});};exports[_0x7a27('0x4e')]=function(_0x16696d,_0x353c4f,_0x5e085a,_0x4d480e,_0x280a2e,_0x4156b4,_0x1203cd){var _0x283c2a,_0x10ddb5;_0x4156b4[_0x7a27('0x1a')]=intUtil[_0x7a27('0x3b')](_0x4156b4[_0x7a27('0x1a')]);_0x4156b4['serverUrl']=intUtil[_0x7a27('0x3b')](_0x4156b4[_0x7a27('0x3c')]);if(_0x1203cd&&_0x1203cd['recordingFormat']&&_0x1203cd[_0x7a27('0x4f')]!=='none'){logger['info'](_0x7a27('0x50'),_0x7a27('0x3f'));_0x353c4f[_0x7a27('0x40')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4156b4[_0x7a27('0x3c')],_0x353c4f[_0x7a27('0x41')],md5(_0x353c4f['uniqueid']));}headers[_0x7a27('0x42')]=getAuth(_0x4156b4);return getUser(_0x4156b4,_0x4d480e[_0x7a27('0x23')])[_0x7a27('0x1c')](function(_0x5eda29){_0x283c2a=_0x5eda29;logger[_0x7a27('0x1d')](_0x7a27('0x43'),_0x283c2a['id']);return getEndUser(_0x4156b4,_0x353c4f['destcalleridname'],_0x353c4f[_0x7a27('0x51')]);})[_0x7a27('0x1c')](function(_0x3bd091){_0x10ddb5=_0x3bd091;logger[_0x7a27('0x1d')]('The\x20Enduser\x20ID\x20is:',_0x10ddb5['id']);return getTicket(_0x4156b4,_0x283c2a,_0x10ddb5,_0x5e085a,_0x353c4f);})[_0x7a27('0x1c')](function(_0x4aa8fb){if(_0x4aa8fb&&_0x4aa8fb['id']){logger[_0x7a27('0x1d')](_0x7a27('0x46'));logger[_0x7a27('0x1d')](_0x7a27('0x47'),_0x4aa8fb['id']);logger[_0x7a27('0x1d')]('[OUTBOUND]',_0x7a27('0x48'));emit(util['format'](_0x7a27('0x49'),_0x4d480e[_0x7a27('0x14')]),_0x7a27('0x4a'),{'uri':util[_0x7a27('0x18')]('%s/helpdesk/tickets/%d',_0x4156b4[_0x7a27('0x1a')],_0x4aa8fb['id'])});}})[_0x7a27('0x4c')](function(_0x300e5e){logger[_0x7a27('0x4d')](_0x7a27('0x50'),JSON['stringify'](_0x300e5e));});};exports[_0x7a27('0x52')]=function(_0x108b4b,_0x4b0c01,_0x2a37eb,_0x43b720,_0x3e3bb6,_0xc7952f){var _0x5405df,_0x4a0d1e;_0xc7952f['remoteUri']=intUtil['stripTrailingSlash'](_0xc7952f[_0x7a27('0x1a')]);_0xc7952f[_0x7a27('0x3c')]=intUtil[_0x7a27('0x3b')](_0xc7952f[_0x7a27('0x3c')]);if(_0x3e3bb6&&_0x3e3bb6[_0x7a27('0x3d')]){logger[_0x7a27('0x1d')](_0x7a27('0x53'),'Recording\x20is\x20enabled!');_0x4b0c01[_0x7a27('0x40')]=util['format'](_0x7a27('0x54'),_0xc7952f[_0x7a27('0x3c')],_0x4b0c01[_0x7a27('0x41')],md5(_0x4b0c01[_0x7a27('0x41')]));}else{_0x4b0c01['recordingURL']='';}headers['Authorization']=getAuth(_0xc7952f);return getUser(_0xc7952f,_0x43b720[_0x7a27('0x23')])[_0x7a27('0x1c')](function(_0x5bb485){_0x5405df=_0x5bb485;logger[_0x7a27('0x1d')](_0x7a27('0x43'),_0x5405df['id']);return getEndUser(_0xc7952f,_0x4b0c01[_0x7a27('0x44')],_0x4b0c01[_0x7a27('0xf')]);})[_0x7a27('0x1c')](function(_0x1e6700){_0x4a0d1e=_0x1e6700;logger[_0x7a27('0x1d')]('The\x20Enduser\x20ID\x20is:',_0x4a0d1e['id']);return getTicket(_0xc7952f,_0x5405df,_0x4a0d1e,_0x2a37eb,_0x4b0c01);})[_0x7a27('0x1c')](function(_0x144776){if(_0x144776){logger[_0x7a27('0x1d')](_0x7a27('0x46'));logger[_0x7a27('0x1d')]('The\x20Ticket\x20ID\x20is:',_0x144776['id']);}})[_0x7a27('0x4c')](function(_0xe94964){logger['error'](_0x7a27('0x53'),JSON[_0x7a27('0x2e')](_0xe94964));});}; \ 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 146427c..9484b5d 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 _0xa1f7=['toLowerCase','data1','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','abandoned','unknown\x20integration','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','format','%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./sugarcrm','./desk','./vtiger','zendesk','sugarcrm','freshdesk','zoho','desk','vtiger','exec','includes'];(function(_0x53b31e,_0x59bb1b){var _0x5e28be=function(_0x5e3389){while(--_0x5e3389){_0x53b31e['push'](_0x53b31e['shift']());}};_0x5e28be(++_0x59bb1b);}(_0xa1f7,0x167));var _0x7a1f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa1f7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7a1f('0x0'));var util=require(_0x7a1f('0x1'));var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0x7a1f('0x2'));var freshdesk=require('./freshdesk');var zoho=require('./zoho');var desk=require(_0x7a1f('0x3'));var vtiger=require(_0x7a1f('0x4'));var integrations=[_0x7a1f('0x5'),'salesforce',_0x7a1f('0x6'),_0x7a1f('0x7'),_0x7a1f('0x8'),_0x7a1f('0x9'),_0x7a1f('0xa')];exports[_0x7a1f('0xb')]=function(_0x339b78,_0x15eee8,_0x3b405f,_0x2a95c8,_0x30e36c,_0x479425){if(_0x3b405f){if(_[_0x7a1f('0xc')](integrations,_0x339b78['data1'][_0x7a1f('0xd')]())){try{var _0x4578e8=null;var _0x18528a='';var _0x4a2396=_0x3b405f[_0x339b78[_0x7a1f('0xe')][_0x7a1f('0xd')]()];if(_0x4a2396){var _0x599906=_0x4a2396[_0x339b78['data2']];if(_0x599906){var _0x38dd38=_['find'](_0x599906[_0x7a1f('0xf')],{'id':parseInt(_0x339b78[_0x7a1f('0x10')],0xa)});if(_0x38dd38){if(_0x2a95c8){if(_0x30e36c&&_0x15eee8[_0x7a1f('0x11')]){_0x18528a=_0x7a1f('0x11');}else if(_0x15eee8[_0x7a1f('0x12')]){_0x18528a=_0x7a1f('0x13');}else{console[_0x7a1f('0x14')](_0x7a1f('0x15'),_0x15eee8);}}else{_0x18528a=_0x7a1f('0x16');}switch(_0x339b78[_0x7a1f('0xe')][_0x7a1f('0xd')]()){case'zendesk':zendesk[_0x18528a](_0x339b78,_0x15eee8,_0x38dd38,_0x2a95c8,_0x30e36c,_0x599906,_0x479425);break;case'salesforce':salesforce[_0x18528a](_0x339b78,_0x15eee8,_0x38dd38,_0x2a95c8,_0x30e36c,_0x599906,_0x479425);break;case _0x7a1f('0x6'):sugarcrm[_0x18528a](_0x339b78,_0x15eee8,_0x38dd38,_0x2a95c8,_0x30e36c,_0x599906,_0x479425);break;case _0x7a1f('0x7'):freshdesk[_0x18528a](_0x339b78,_0x15eee8,_0x38dd38,_0x2a95c8,_0x30e36c,_0x599906,_0x479425);break;case _0x7a1f('0x8'):zoho[_0x18528a](_0x339b78,_0x15eee8,_0x38dd38,_0x2a95c8,_0x30e36c,_0x599906,_0x479425);break;case _0x7a1f('0x9'):desk[_0x18528a](_0x339b78,_0x15eee8,_0x38dd38,_0x2a95c8,_0x30e36c,_0x599906,_0x479425);break;case _0x7a1f('0xa'):vtiger[_0x18528a](_0x339b78,_0x15eee8,_0x38dd38,_0x2a95c8,_0x30e36c,_0x599906,_0x479425);break;default:console['log'](_0x7a1f('0x17'));}}else{_0x4578e8=require('../../../../config/logger')(_0x339b78[_0x7a1f('0xe')][_0x7a1f('0xd')]());_0x4578e8[_0x7a1f('0x18')](_0x7a1f('0x19'),util['format'](_0x7a1f('0x1a'),_0x339b78[_0x7a1f('0xe')]['toLowerCase'](),_0x339b78['data3']));}}else{_0x4578e8=require(_0x7a1f('0x1b'))(_0x339b78['data1'][_0x7a1f('0xd')]());_0x4578e8[_0x7a1f('0x18')]('[EXEC]',util[_0x7a1f('0x1c')](_0x7a1f('0x1d'),_0x339b78['data1']['toLowerCase'](),_0x339b78[_0x7a1f('0x1e')]));}}else{}}catch(_0x445bb6){console['error'](_0x445bb6);}}}}; \ No newline at end of file +var _0x5333=['../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','error','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','zendesk','salesforce','sugarcrm','freshdesk','desk','exec','data1','toLowerCase','data2','Configurations','queue','routeId','outbound','log','EVENT\x20UNKNOWN','abandoned','zoho','vtiger','unknown\x20integration'];(function(_0x1e8c36,_0xec9669){var _0x4acddf=function(_0xd222f9){while(--_0xd222f9){_0x1e8c36['push'](_0x1e8c36['shift']());}};_0x4acddf(++_0xec9669);}(_0x5333,0x8a));var _0x3533=function(_0x1168e4,_0x491eda){_0x1168e4=_0x1168e4-0x0;var _0x5da51c=_0x5333[_0x1168e4];return _0x5da51c;};'use strict';var _=require(_0x3533('0x0'));var util=require(_0x3533('0x1'));var zendesk=require(_0x3533('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0x3533('0x3'));var freshdesk=require(_0x3533('0x4'));var zoho=require(_0x3533('0x5'));var desk=require(_0x3533('0x6'));var vtiger=require(_0x3533('0x7'));var integrations=[_0x3533('0x8'),_0x3533('0x9'),_0x3533('0xa'),_0x3533('0xb'),'zoho',_0x3533('0xc'),'vtiger'];exports[_0x3533('0xd')]=function(_0x640da6,_0x2394f1,_0x4de100,_0x5d7390,_0x11d8ff,_0x626353){if(_0x4de100){if(_['includes'](integrations,_0x640da6[_0x3533('0xe')]['toLowerCase']())){try{var _0x29c61f=null;var _0x6dca03='';var _0xef66d5=_0x4de100[_0x640da6[_0x3533('0xe')][_0x3533('0xf')]()];if(_0xef66d5){var _0x56a0be=_0xef66d5[_0x640da6[_0x3533('0x10')]];if(_0x56a0be){var _0x50c544=_['find'](_0x56a0be[_0x3533('0x11')],{'id':parseInt(_0x640da6['data3'],0xa)});if(_0x50c544){if(_0x5d7390){if(_0x11d8ff&&_0x2394f1[_0x3533('0x12')]){_0x6dca03=_0x3533('0x12');}else if(_0x2394f1[_0x3533('0x13')]){_0x6dca03=_0x3533('0x14');}else{console[_0x3533('0x15')](_0x3533('0x16'),_0x2394f1);}}else{_0x6dca03=_0x3533('0x17');}switch(_0x640da6[_0x3533('0xe')][_0x3533('0xf')]()){case _0x3533('0x8'):zendesk[_0x6dca03](_0x640da6,_0x2394f1,_0x50c544,_0x5d7390,_0x11d8ff,_0x56a0be,_0x626353);break;case _0x3533('0x9'):salesforce[_0x6dca03](_0x640da6,_0x2394f1,_0x50c544,_0x5d7390,_0x11d8ff,_0x56a0be,_0x626353);break;case'sugarcrm':sugarcrm[_0x6dca03](_0x640da6,_0x2394f1,_0x50c544,_0x5d7390,_0x11d8ff,_0x56a0be,_0x626353);break;case _0x3533('0xb'):freshdesk[_0x6dca03](_0x640da6,_0x2394f1,_0x50c544,_0x5d7390,_0x11d8ff,_0x56a0be,_0x626353);break;case _0x3533('0x18'):zoho[_0x6dca03](_0x640da6,_0x2394f1,_0x50c544,_0x5d7390,_0x11d8ff,_0x56a0be,_0x626353);break;case'desk':desk[_0x6dca03](_0x640da6,_0x2394f1,_0x50c544,_0x5d7390,_0x11d8ff,_0x56a0be,_0x626353);break;case _0x3533('0x19'):vtiger[_0x6dca03](_0x640da6,_0x2394f1,_0x50c544,_0x5d7390,_0x11d8ff,_0x56a0be,_0x626353);break;default:console['log'](_0x3533('0x1a'));}}else{_0x29c61f=require(_0x3533('0x1b'))(_0x640da6[_0x3533('0xe')]['toLowerCase']());_0x29c61f['error'](_0x3533('0x1c'),util[_0x3533('0x1d')](_0x3533('0x1e'),_0x640da6[_0x3533('0xe')][_0x3533('0xf')](),_0x640da6['data3']));}}else{_0x29c61f=require(_0x3533('0x1b'))(_0x640da6[_0x3533('0xe')]['toLowerCase']());_0x29c61f[_0x3533('0x1f')](_0x3533('0x1c'),util[_0x3533('0x1d')](_0x3533('0x20'),_0x640da6[_0x3533('0xe')]['toLowerCase'](),_0x640da6[_0x3533('0x10')]));}}else{}}catch(_0x28d3c8){console['error'](_0x28d3c8);}}}}; \ 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 a1ece1c..50a521a 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 _0x5dfe=['string','idField','content','variable','variableName','toString','type','Variable','name','toLowerCase','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientSecret','username','Connection\x20established.','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','calleridnum','Fields','[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','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','email','[OUTBOUND]\x20Ticket\x20%s\x20created.','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','stringify','monitor_format','[ABANDONED]\x20Ticket\x20%s\x20created.','[ABANDONED]\x20Integration\x20account\x20type\x20%s.','[ABANDONED]','lodash','moment','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','merge','utc','Subjects','getString','Descriptions','WhoId','sobject','Task','create','User','find','then','length','Email','info','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','execute','Lead','contact','Phone','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','lead','Company','No\x20Company','upperFirst','forEach'];(function(_0x352452,_0x36065e){var _0x4bfe87=function(_0x2fe303){while(--_0x2fe303){_0x352452['push'](_0x352452['shift']());}};_0x4bfe87(++_0x36065e);}(_0x5dfe,0x1d8));var _0xe5df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5dfe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe5df('0x0'));var rp=require('request-promise');var moment=require(_0xe5df('0x1'));var BPromise=require('bluebird');var md5=require(_0xe5df('0x2'));var jsforce=require('jsforce');var util=require(_0xe5df('0x3'));var Redis=require(_0xe5df('0x4'));var intUtil=require(_0xe5df('0x5'));var config=require(_0xe5df('0x6'));var logger=require(_0xe5df('0x7'))(_0xe5df('0x8'));config[_0xe5df('0x9')]=_['defaults'](config[_0xe5df('0x9')],{'host':_0xe5df('0xa'),'port':0x18eb});var io=require(_0xe5df('0xb'))(new Redis(config[_0xe5df('0x9')]));function emit(_0x1be60f,_0x3c0317,_0x526b53){io['to'](_0x1be60f)['emit'](_0x3c0317,_0x526b53);}function getTicket(_0x212f2c,_0x21c47f,_0x256d80,_0x1e2f39,_0x2cb63b,_0x3f8b4d,_0xd53ca){var _0x2a286f=_[_0xe5df('0xc')]({'OwnerId':_0x21c47f['id'],'ActivityDate':moment[_0xe5df('0xd')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil['getString'](_0x1e2f39[_0xe5df('0xe')],_0x2cb63b,'\x20'),'Description':intUtil[_0xe5df('0xf')](_0x1e2f39[_0xe5df('0x10')],_0x2cb63b,'\x0a')},getCustomFields(_0x3f8b4d,_0x2cb63b));if(_0x256d80){_0x2a286f[_0xe5df('0x11')]=_0x256d80['id'];}return _0xd53ca[_0xe5df('0x12')](_0xe5df('0x13'))[_0xe5df('0x14')](_0x2a286f);}function getUser(_0x37166b,_0x2dc477,_0x40b9af){var _0x450251={'Email':_0x2dc477};var _0x17fa61={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x40b9af['sobject'](_0xe5df('0x15'))[_0xe5df('0x16')](_0x450251,_0x17fa61)['execute']()[_0xe5df('0x17')](function(_0x454b1b){if(_0x454b1b[_0xe5df('0x18')]){var _0x54bb23=_[_0xe5df('0x16')](_0x454b1b,function(_0x4cc271){return _0x4cc271[_0xe5df('0x19')]===_0x2dc477;});if(_0x54bb23){logger[_0xe5df('0x1a')](_0xe5df('0x1b'),_0x2dc477);return BPromise['resolve']({'id':_0x54bb23['Id'],'name':_0x54bb23[_0xe5df('0x1c')]});}}else{logger[_0xe5df('0x1a')](_0xe5df('0x1d'),_0x2dc477);return _0x40b9af[_0xe5df('0x1e')]()[_0xe5df('0x17')](function(_0x5cc5e7){return BPromise[_0xe5df('0x1f')]({'id':_0x5cc5e7[_0xe5df('0x20')],'name':_0x5cc5e7[_0xe5df('0x21')]});});}});}function getEndUser(_0x5296bf,_0x40534d,_0x1bb425,_0x4fc148,_0x210bef){var _0x5c3ee2={'Phone':_0x4fc148};var _0x2b8e4c={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xe5df('0x1f')]()[_0xe5df('0x17')](function(){logger[_0xe5df('0x1a')](_0xe5df('0x22'),_0x4fc148,_0x40534d[_0xe5df('0x23')]);switch(_0x40534d['moduleSearch']){case _0xe5df('0x24'):return _0x210bef['sobject'](_0xe5df('0x25'))[_0xe5df('0x16')](_0x5c3ee2,_0x2b8e4c)[_0xe5df('0x26')]()[_0xe5df('0x17')](function(_0x55df5f){if(_0x55df5f&&_0x55df5f[_0xe5df('0x18')]){return _0x55df5f;}else{return _0x210bef[_0xe5df('0x12')](_0xe5df('0x27'))['find'](_0x5c3ee2,_0x2b8e4c);}});case _0xe5df('0x28'):return _0x210bef[_0xe5df('0x12')]('Contact')[_0xe5df('0x16')](_0x5c3ee2,_0x2b8e4c)['execute']();case'lead':return _0x210bef[_0xe5df('0x12')]('Lead')[_0xe5df('0x16')](_0x5c3ee2,_0x2b8e4c);default:return null;}})[_0xe5df('0x17')](function(_0x9a4612){if(_0x9a4612&&_0x9a4612['length']){var _0x532040=_[_0xe5df('0x16')](_0x9a4612,function(_0x3e715d){return _0x3e715d[_0xe5df('0x29')]===_0x4fc148;});if(_0x532040){return BPromise[_0xe5df('0x1f')]({'id':_0x532040['Id'],'name':_0x532040[_0xe5df('0x1c')],'phone':_0x532040[_0xe5df('0x29')]});}}})[_0xe5df('0x17')](function(_0x2c99e7){if(_0x2c99e7){logger['info']('Enduser\x20with\x20phone\x20%s\x20found.',_0x4fc148);return BPromise['resolve'](_0x2c99e7);}else{logger[_0xe5df('0x1a')](_0xe5df('0x2a'),_0x4fc148);var _0x560f92={'LastName':_0x1bb425!==_0xe5df('0x2b')?_0x1bb425:util[_0xe5df('0x2c')](_0xe5df('0x2d'),_0x4fc148),'Phone':_0x4fc148};if(_0x40534d[_0xe5df('0x2e')]){switch(_0x40534d[_0xe5df('0x2e')]){case _0xe5df('0x28'):logger[_0xe5df('0x1a')](_0xe5df('0x2f'),_0x4fc148,_0x40534d[_0xe5df('0x2e')]);break;case _0xe5df('0x30'):logger[_0xe5df('0x1a')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x4fc148,_0x40534d['moduleCreate']);_0x560f92[_0xe5df('0x31')]=_0xe5df('0x32');break;default:return null;}}return _0x210bef[_0xe5df('0x12')](_[_0xe5df('0x33')](_0x40534d[_0xe5df('0x2e')]))[_0xe5df('0x14')](_0x560f92);}});}function getCustomFields(_0xa79248,_0x59509d){var _0x3d50cc={};if(_0xa79248[_0xe5df('0x18')]>0x0){_[_0xe5df('0x34')](_0xa79248,function(_0x18bc6a){if(_0x18bc6a['type']===_0xe5df('0x35')&&_0x18bc6a[_0xe5df('0x36')]){_0x3d50cc[_0x18bc6a[_0xe5df('0x36')]]=_0x18bc6a[_0xe5df('0x37')]['toString']();}else if(_0x18bc6a['type']===_0xe5df('0x38')&&_0x18bc6a['variableName']&&_0x18bc6a[_0xe5df('0x36')]){_0x59509d[_0x18bc6a[_0xe5df('0x39')]]&&(_0x3d50cc[_0x18bc6a[_0xe5df('0x36')]]=_0x59509d[_0x18bc6a[_0xe5df('0x39')]][_0xe5df('0x3a')]());}else if(_0x18bc6a[_0xe5df('0x3b')]==='customVariable'&&_0x18bc6a[_0xe5df('0x3c')]&&_0x18bc6a['Variable']['name']&&_0x18bc6a[_0xe5df('0x36')]){_0x59509d[_0x18bc6a[_0xe5df('0x3c')][_0xe5df('0x3d')]['toLowerCase']()]&&(_0x3d50cc[_0x18bc6a[_0xe5df('0x36')]]=_0x59509d[_0x18bc6a[_0xe5df('0x3c')][_0xe5df('0x3d')][_0xe5df('0x3e')]()][_0xe5df('0x3a')]());}});}return _0x3d50cc;}function getConnection(_0x1953ce){var _0x298798=_0x1953ce[_0xe5df('0x3f')][_0xe5df('0x40')](_0x1953ce[_0xe5df('0x41')]);var _0x1fc5a2=new jsforce['Connection']({'oauth2':{'loginUrl':_0x1953ce[_0xe5df('0x42')]||_0xe5df('0x43'),'clientId':_0x1953ce['clientId'],'clientSecret':_0x1953ce[_0xe5df('0x44')]}});return _0x1fc5a2['login'](_0x1953ce[_0xe5df('0x45')],_0x298798)[_0xe5df('0x17')](function(){logger['info'](_0xe5df('0x46'));return _0x1fc5a2;});}exports['queue']=function(_0x1e0483,_0x200cb2,_0x2df4b9,_0x1dd1c4,_0x25f393,_0xcec6d3){var _0x6a07cb,_0x78924d,_0x14a356,_0xc76ffc;_0xcec6d3[_0xe5df('0x47')]=intUtil[_0xe5df('0x48')](_0xcec6d3[_0xe5df('0x47')]);if(_0x25f393&&_0x25f393['monitor_format']){logger['info'](_0xe5df('0x49'),_0xe5df('0x4a'));_0x200cb2['recordingURL']=util[_0xe5df('0x2c')](_0xe5df('0x4b'),_0xcec6d3[_0xe5df('0x47')],_0x200cb2[_0xe5df('0x4c')],md5(_0x200cb2['uniqueid']));}else{_0x200cb2[_0xe5df('0x4d')]='';}return getConnection(_0xcec6d3)[_0xe5df('0x17')](function(_0x1dd578){_0xc76ffc=_0x1dd578;return getUser(_0xcec6d3,_0x1dd1c4['email'],_0xc76ffc);})[_0xe5df('0x17')](function(_0x4ba82d){_0x6a07cb=_0x4ba82d;return getEndUser(_0xcec6d3,_0x2df4b9,_0x200cb2[_0xe5df('0x4e')],_0x200cb2[_0xe5df('0x4f')],_0xc76ffc);})[_0xe5df('0x17')](function(_0x3c8a20){_0x78924d=_0x3c8a20;return getTicket(_0xcec6d3,_0x6a07cb,_0x78924d,_0x2df4b9,_0x200cb2,_0x2df4b9[_0xe5df('0x50')],_0xc76ffc);})[_0xe5df('0x17')](function(_0x3f60e1){_0x14a356=_0x3f60e1;logger[_0xe5df('0x1a')](_0xe5df('0x51'),_0x14a356['id']);logger[_0xe5df('0x1a')](_0xe5df('0x52'),_0x14a356['id'],_0x1dd1c4[_0xe5df('0x3d')],_0xcec6d3['type']);switch(_0xcec6d3[_0xe5df('0x3b')]){case _0xe5df('0x53'):emit(util['format'](_0xe5df('0x54'),_0x1dd1c4[_0xe5df('0x3d')]),_0xe5df('0x55'),{'recordId':_0x14a356['id']});break;case _0xe5df('0x56'):emit(util['format'](_0xe5df('0x54'),_0x1dd1c4[_0xe5df('0x3d')]),_0xe5df('0x57'),{'uri':util[_0xe5df('0x2c')]('%s/%s/e',_0xc76ffc[_0xe5df('0x58')],_0x14a356['id'])});break;default:logger[_0xe5df('0x59')](_0xe5df('0x5a'));}})[_0xe5df('0x5b')](function(_0x2c6170){logger[_0xe5df('0x59')](_0xe5df('0x49'),JSON['stringify'](_0x2c6170));});};exports[_0xe5df('0x5c')]=function(_0x485642,_0x4e46bd,_0x6c846f,_0x1d14a2,_0x409b7f,_0x23120f,_0x2acd9f){var _0x148e5d,_0x2ea277,_0x5d306c,_0x752906;_0x23120f[_0xe5df('0x47')]=intUtil[_0xe5df('0x48')](_0x23120f[_0xe5df('0x47')]);if(_0x2acd9f&&_0x2acd9f[_0xe5df('0x5d')]&&_0x2acd9f[_0xe5df('0x5d')]!==_0xe5df('0x5e')){logger['info'](_0xe5df('0x5f'),_0xe5df('0x4a'));_0x4e46bd[_0xe5df('0x4d')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x23120f[_0xe5df('0x47')],_0x4e46bd[_0xe5df('0x4c')],md5(_0x4e46bd[_0xe5df('0x4c')]));}return getConnection(_0x23120f)[_0xe5df('0x17')](function(_0x13e7bc){_0x752906=_0x13e7bc;return getUser(_0x23120f,_0x1d14a2[_0xe5df('0x60')],_0x752906);})[_0xe5df('0x17')](function(_0x58e693){_0x148e5d=_0x58e693;return getEndUser(_0x23120f,_0x6c846f,_0x4e46bd['destcalleridname'],_0x4e46bd['destcalleridnum'],_0x752906);})[_0xe5df('0x17')](function(_0x434ead){_0x2ea277=_0x434ead;return getTicket(_0x23120f,_0x148e5d,_0x2ea277,_0x6c846f,_0x4e46bd,_0x6c846f[_0xe5df('0x50')],_0x752906);})[_0xe5df('0x17')](function(_0x3c51e0){_0x5d306c=_0x3c51e0;logger[_0xe5df('0x1a')](_0xe5df('0x61'),_0x5d306c['id']);logger['info']('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x5d306c['id'],_0x1d14a2[_0xe5df('0x3d')],_0x23120f[_0xe5df('0x3b')]);switch(_0x23120f['type']){case _0xe5df('0x53'):emit(util['format']('user:%s',_0x1d14a2[_0xe5df('0x3d')]),_0xe5df('0x55'),{'recordId':_0x5d306c['id']});break;case _0xe5df('0x56'):emit(util[_0xe5df('0x2c')](_0xe5df('0x54'),_0x1d14a2[_0xe5df('0x3d')]),_0xe5df('0x57'),{'uri':util[_0xe5df('0x2c')](_0xe5df('0x62'),_0x752906[_0xe5df('0x58')],_0x5d306c['id'])});break;default:logger[_0xe5df('0x59')]('[OUTBOUND]',_0xe5df('0x63'));}})[_0xe5df('0x5b')](function(_0x2b2b08){logger[_0xe5df('0x59')](_0xe5df('0x5f'),JSON[_0xe5df('0x64')](_0x2b2b08));});};exports['abandoned']=function(_0x398775,_0x5e3b51,_0x1de647,_0x18f9da,_0x35517b,_0x38c920){var _0x23bb4a,_0x3bbfc1,_0x351e22,_0x5afd04;_0x38c920[_0xe5df('0x47')]=intUtil[_0xe5df('0x48')](_0x38c920['serverUrl']);if(_0x35517b&&_0x35517b[_0xe5df('0x65')]){logger[_0xe5df('0x1a')]('[ABANDONED]','Recording\x20is\x20enabled!');_0x5e3b51[_0xe5df('0x4d')]=util[_0xe5df('0x2c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x38c920[_0xe5df('0x47')],_0x5e3b51[_0xe5df('0x4c')],md5(_0x5e3b51['uniqueid']));}else{_0x5e3b51[_0xe5df('0x4d')]='';}return getConnection(_0x38c920)['then'](function(_0x1df911){_0x5afd04=_0x1df911;return getUser(_0x38c920,_0x18f9da[_0xe5df('0x60')],_0x5afd04);})['then'](function(_0x2be3d2){_0x23bb4a=_0x2be3d2;return getEndUser(_0x38c920,_0x1de647,_0x5e3b51[_0xe5df('0x4e')],_0x5e3b51[_0xe5df('0x4f')],_0x5afd04);})[_0xe5df('0x17')](function(_0x55dc9c){_0x3bbfc1=_0x55dc9c;return getTicket(_0x38c920,_0x23bb4a,_0x3bbfc1,_0x1de647,_0x5e3b51,_0x1de647['Fields'],_0x5afd04);})[_0xe5df('0x17')](function(_0x2970d8){_0x351e22=_0x2970d8;logger[_0xe5df('0x1a')](_0xe5df('0x66'),_0x351e22['id']);logger[_0xe5df('0x1a')](_0xe5df('0x67'),_0x38c920['type']);})[_0xe5df('0x5b')](function(_0x3d8cdc){logger[_0xe5df('0x59')](_0xe5df('0x68'),JSON[_0xe5df('0x64')](_0x3d8cdc));});}; \ No newline at end of file +var _0xdb24=['jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','merge','utc','getString','Subjects','Descriptions','sobject','User','then','length','find','Email','Agent\x20%s\x20found.','resolve','Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','Contact','execute','Lead','contact','lead','Phone','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','forEach','type','string','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','concat','securityToken','Connection','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','stringify','outbound','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','%s/%s/e','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','abandoned','monitor_format','[ABANDONED]\x20Integration\x20account\x20type\x20%s.','lodash','bluebird','md5'];(function(_0x25d263,_0x26b9c1){var _0x41b9aa=function(_0x2174ee){while(--_0x2174ee){_0x25d263['push'](_0x25d263['shift']());}};_0x41b9aa(++_0x26b9c1);}(_0xdb24,0x135));var _0x4db2=function(_0x4435bb,_0x218869){_0x4435bb=_0x4435bb-0x0;var _0x59a982=_0xdb24[_0x4435bb];return _0x59a982;};'use strict';var _=require(_0x4db2('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4db2('0x1'));var md5=require(_0x4db2('0x2'));var jsforce=require(_0x4db2('0x3'));var util=require('util');var Redis=require(_0x4db2('0x4'));var intUtil=require(_0x4db2('0x5'));var config=require(_0x4db2('0x6'));var logger=require(_0x4db2('0x7'))('salesforce');config[_0x4db2('0x8')]=_[_0x4db2('0x9')](config[_0x4db2('0x8')],{'host':_0x4db2('0xa'),'port':0x18eb});var io=require(_0x4db2('0xb'))(new Redis(config['redis']));function emit(_0x5b082f,_0x3641a4,_0x27602e){io['to'](_0x5b082f)['emit'](_0x3641a4,_0x27602e);}function getTicket(_0x5fe83a,_0x1f0d1f,_0x5257a8,_0x1e8f72,_0x12b9d2,_0xfca85a,_0x526f5e){var _0x2604c0=_[_0x4db2('0xc')]({'OwnerId':_0x1f0d1f['id'],'ActivityDate':moment[_0x4db2('0xd')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x4db2('0xe')](_0x1e8f72[_0x4db2('0xf')],_0x12b9d2,'\x20'),'Description':intUtil['getString'](_0x1e8f72[_0x4db2('0x10')],_0x12b9d2,'\x0a')},getCustomFields(_0xfca85a,_0x12b9d2));if(_0x5257a8){_0x2604c0['WhoId']=_0x5257a8['id'];}return _0x526f5e[_0x4db2('0x11')]('Task')['create'](_0x2604c0);}function getUser(_0x48abe6,_0x4487b5,_0x22eda9){var _0xeb34ae={'Email':_0x4487b5};var _0x486ff6={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x22eda9['sobject'](_0x4db2('0x12'))['find'](_0xeb34ae,_0x486ff6)['execute']()[_0x4db2('0x13')](function(_0x36abd0){if(_0x36abd0[_0x4db2('0x14')]){var _0x24c4d4=_[_0x4db2('0x15')](_0x36abd0,function(_0x37c695){return _0x37c695[_0x4db2('0x16')]===_0x4487b5;});if(_0x24c4d4){logger['info'](_0x4db2('0x17'),_0x4487b5);return BPromise[_0x4db2('0x18')]({'id':_0x24c4d4['Id'],'name':_0x24c4d4[_0x4db2('0x19')]});}}else{logger[_0x4db2('0x1a')](_0x4db2('0x1b'),_0x4487b5);return _0x22eda9[_0x4db2('0x1c')]()[_0x4db2('0x13')](function(_0x47a6da){return BPromise[_0x4db2('0x18')]({'id':_0x47a6da[_0x4db2('0x1d')],'name':_0x47a6da[_0x4db2('0x1e')]});});}});}function getEndUser(_0x1cbbc8,_0x1f2ef0,_0x294952,_0x407774,_0x362349){var _0x3f8f67={'Phone':_0x407774};var _0x59e239={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x4db2('0x18')]()['then'](function(){logger[_0x4db2('0x1a')](_0x4db2('0x1f'),_0x407774,_0x1f2ef0[_0x4db2('0x20')]);switch(_0x1f2ef0[_0x4db2('0x20')]){case'contact_lead':return _0x362349['sobject'](_0x4db2('0x21'))[_0x4db2('0x15')](_0x3f8f67,_0x59e239)[_0x4db2('0x22')]()['then'](function(_0x5227a5){if(_0x5227a5&&_0x5227a5[_0x4db2('0x14')]){return _0x5227a5;}else{return _0x362349[_0x4db2('0x11')](_0x4db2('0x23'))[_0x4db2('0x15')](_0x3f8f67,_0x59e239);}});case _0x4db2('0x24'):return _0x362349[_0x4db2('0x11')](_0x4db2('0x21'))['find'](_0x3f8f67,_0x59e239)[_0x4db2('0x22')]();case _0x4db2('0x25'):return _0x362349[_0x4db2('0x11')](_0x4db2('0x23'))['find'](_0x3f8f67,_0x59e239);default:return null;}})[_0x4db2('0x13')](function(_0x5bc1ef){if(_0x5bc1ef&&_0x5bc1ef[_0x4db2('0x14')]){var _0x1aa5df=_[_0x4db2('0x15')](_0x5bc1ef,function(_0x30eb01){return _0x30eb01['Phone']===_0x407774;});if(_0x1aa5df){return BPromise['resolve']({'id':_0x1aa5df['Id'],'name':_0x1aa5df[_0x4db2('0x19')],'phone':_0x1aa5df[_0x4db2('0x26')]});}}})['then'](function(_0x1150e1){if(_0x1150e1){logger[_0x4db2('0x1a')]('Enduser\x20with\x20phone\x20%s\x20found.',_0x407774);return BPromise[_0x4db2('0x18')](_0x1150e1);}else{logger[_0x4db2('0x1a')](_0x4db2('0x27'),_0x407774);var _0x485742={'LastName':_0x294952!==_0x4db2('0x28')?_0x294952:util['format'](_0x4db2('0x29'),_0x407774),'Phone':_0x407774};if(_0x1f2ef0[_0x4db2('0x2a')]){switch(_0x1f2ef0[_0x4db2('0x2a')]){case _0x4db2('0x24'):logger[_0x4db2('0x1a')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x407774,_0x1f2ef0[_0x4db2('0x2a')]);break;case _0x4db2('0x25'):logger[_0x4db2('0x1a')](_0x4db2('0x2b'),_0x407774,_0x1f2ef0[_0x4db2('0x2a')]);_0x485742[_0x4db2('0x2c')]=_0x4db2('0x2d');break;default:return null;}}return _0x362349[_0x4db2('0x11')](_[_0x4db2('0x2e')](_0x1f2ef0[_0x4db2('0x2a')]))['create'](_0x485742);}});}function getCustomFields(_0x566b8f,_0x536d1b){var _0x1a9f83={};if(_0x566b8f[_0x4db2('0x14')]>0x0){_[_0x4db2('0x2f')](_0x566b8f,function(_0x22d251){if(_0x22d251[_0x4db2('0x30')]===_0x4db2('0x31')&&_0x22d251[_0x4db2('0x32')]){_0x1a9f83[_0x22d251[_0x4db2('0x32')]]=_0x22d251[_0x4db2('0x33')][_0x4db2('0x34')]();}else if(_0x22d251[_0x4db2('0x30')]==='variable'&&_0x22d251['variableName']&&_0x22d251[_0x4db2('0x32')]){_0x536d1b[_0x22d251[_0x4db2('0x35')]]&&(_0x1a9f83[_0x22d251['idField']]=_0x536d1b[_0x22d251[_0x4db2('0x35')]][_0x4db2('0x34')]());}else if(_0x22d251[_0x4db2('0x30')]===_0x4db2('0x36')&&_0x22d251['Variable']&&_0x22d251[_0x4db2('0x37')][_0x4db2('0x38')]&&_0x22d251[_0x4db2('0x32')]){_0x536d1b[_0x22d251['Variable'][_0x4db2('0x38')][_0x4db2('0x39')]()]&&(_0x1a9f83[_0x22d251[_0x4db2('0x32')]]=_0x536d1b[_0x22d251[_0x4db2('0x37')][_0x4db2('0x38')][_0x4db2('0x39')]()]['toString']());}});}return _0x1a9f83;}function getConnection(_0x4395bb){var _0x28e409=_0x4395bb['password'][_0x4db2('0x3a')](_0x4395bb[_0x4db2('0x3b')]);var _0x1767e4=new jsforce[(_0x4db2('0x3c'))]({'oauth2':{'loginUrl':_0x4395bb['remoteUri']||'https://login.salesforce.com','clientId':_0x4395bb[_0x4db2('0x3d')],'clientSecret':_0x4395bb[_0x4db2('0x3e')]}});return _0x1767e4[_0x4db2('0x3f')](_0x4395bb[_0x4db2('0x40')],_0x28e409)['then'](function(){logger['info'](_0x4db2('0x41'));return _0x1767e4;});}exports[_0x4db2('0x42')]=function(_0x190a31,_0x1e078a,_0x1122a4,_0x147b7b,_0x51711d,_0x41978c){var _0x56a02f,_0x282ccc,_0x233231,_0x2274f4;_0x41978c[_0x4db2('0x43')]=intUtil[_0x4db2('0x44')](_0x41978c[_0x4db2('0x43')]);if(_0x51711d&&_0x51711d['monitor_format']){logger['info'](_0x4db2('0x45'),'Recording\x20is\x20enabled!');_0x1e078a[_0x4db2('0x46')]=util[_0x4db2('0x47')](_0x4db2('0x48'),_0x41978c[_0x4db2('0x43')],_0x1e078a['uniqueid'],md5(_0x1e078a[_0x4db2('0x49')]));}else{_0x1e078a['recordingURL']='';}return getConnection(_0x41978c)['then'](function(_0x1e986f){_0x2274f4=_0x1e986f;return getUser(_0x41978c,_0x147b7b[_0x4db2('0x4a')],_0x2274f4);})['then'](function(_0x41f02a){_0x56a02f=_0x41f02a;return getEndUser(_0x41978c,_0x1122a4,_0x1e078a[_0x4db2('0x4b')],_0x1e078a[_0x4db2('0x4c')],_0x2274f4);})[_0x4db2('0x13')](function(_0x986ab3){_0x282ccc=_0x986ab3;return getTicket(_0x41978c,_0x56a02f,_0x282ccc,_0x1122a4,_0x1e078a,_0x1122a4[_0x4db2('0x4d')],_0x2274f4);})['then'](function(_0x9b5257){_0x233231=_0x9b5257;logger['info'](_0x4db2('0x4e'),_0x233231['id']);logger[_0x4db2('0x1a')](_0x4db2('0x4f'),_0x233231['id'],_0x147b7b['name'],_0x41978c[_0x4db2('0x30')]);switch(_0x41978c['type']){case _0x4db2('0x50'):emit(util[_0x4db2('0x47')](_0x4db2('0x51'),_0x147b7b[_0x4db2('0x38')]),'trigger:salesforce:display',{'recordId':_0x233231['id']});break;case _0x4db2('0x52'):emit(util['format']('user:%s',_0x147b7b[_0x4db2('0x38')]),_0x4db2('0x53'),{'uri':util['format']('%s/%s/e',_0x2274f4[_0x4db2('0x54')],_0x233231['id'])});break;default:logger['error'](_0x4db2('0x55'));}})[_0x4db2('0x56')](function(_0x27f0c5){logger[_0x4db2('0x57')](_0x4db2('0x45'),JSON[_0x4db2('0x58')](_0x27f0c5));});};exports[_0x4db2('0x59')]=function(_0x72d3d2,_0x35701f,_0x7428ad,_0x2df696,_0x572348,_0x51c733,_0x191aaa){var _0x1772a7,_0x150399,_0xc83585,_0x34730a;_0x51c733[_0x4db2('0x43')]=intUtil[_0x4db2('0x44')](_0x51c733['serverUrl']);if(_0x191aaa&&_0x191aaa[_0x4db2('0x5a')]&&_0x191aaa['recordingFormat']!==_0x4db2('0x5b')){logger['info']('[OUTBOUND]',_0x4db2('0x5c'));_0x35701f[_0x4db2('0x46')]=util[_0x4db2('0x47')](_0x4db2('0x48'),_0x51c733[_0x4db2('0x43')],_0x35701f['uniqueid'],md5(_0x35701f[_0x4db2('0x49')]));}return getConnection(_0x51c733)['then'](function(_0x3f8fb3){_0x34730a=_0x3f8fb3;return getUser(_0x51c733,_0x2df696[_0x4db2('0x4a')],_0x34730a);})[_0x4db2('0x13')](function(_0x3042c5){_0x1772a7=_0x3042c5;return getEndUser(_0x51c733,_0x7428ad,_0x35701f[_0x4db2('0x5d')],_0x35701f[_0x4db2('0x5e')],_0x34730a);})[_0x4db2('0x13')](function(_0x4c3dc4){_0x150399=_0x4c3dc4;return getTicket(_0x51c733,_0x1772a7,_0x150399,_0x7428ad,_0x35701f,_0x7428ad[_0x4db2('0x4d')],_0x34730a);})[_0x4db2('0x13')](function(_0x24f297){_0xc83585=_0x24f297;logger[_0x4db2('0x1a')](_0x4db2('0x5f'),_0xc83585['id']);logger[_0x4db2('0x1a')](_0x4db2('0x60'),_0xc83585['id'],_0x2df696['name'],_0x51c733[_0x4db2('0x30')]);switch(_0x51c733[_0x4db2('0x30')]){case _0x4db2('0x50'):emit(util[_0x4db2('0x47')](_0x4db2('0x51'),_0x2df696[_0x4db2('0x38')]),_0x4db2('0x61'),{'recordId':_0xc83585['id']});break;case _0x4db2('0x52'):emit(util[_0x4db2('0x47')](_0x4db2('0x51'),_0x2df696[_0x4db2('0x38')]),_0x4db2('0x53'),{'uri':util[_0x4db2('0x47')](_0x4db2('0x62'),_0x34730a['instanceUrl'],_0xc83585['id'])});break;default:logger[_0x4db2('0x57')](_0x4db2('0x63'),_0x4db2('0x64'));}})['catch'](function(_0x50406c){logger['error'](_0x4db2('0x63'),JSON[_0x4db2('0x58')](_0x50406c));});};exports[_0x4db2('0x65')]=function(_0x4e129b,_0x3ef393,_0x437351,_0x184878,_0xb3503d,_0xa21df9){var _0x501244,_0x5946cb,_0x38ac0e,_0x10c78e;_0xa21df9[_0x4db2('0x43')]=intUtil[_0x4db2('0x44')](_0xa21df9['serverUrl']);if(_0xb3503d&&_0xb3503d[_0x4db2('0x66')]){logger[_0x4db2('0x1a')]('[ABANDONED]','Recording\x20is\x20enabled!');_0x3ef393[_0x4db2('0x46')]=util[_0x4db2('0x47')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xa21df9['serverUrl'],_0x3ef393['uniqueid'],md5(_0x3ef393[_0x4db2('0x49')]));}else{_0x3ef393[_0x4db2('0x46')]='';}return getConnection(_0xa21df9)[_0x4db2('0x13')](function(_0x257514){_0x10c78e=_0x257514;return getUser(_0xa21df9,_0x184878['email'],_0x10c78e);})['then'](function(_0x349325){_0x501244=_0x349325;return getEndUser(_0xa21df9,_0x437351,_0x3ef393[_0x4db2('0x4b')],_0x3ef393['calleridnum'],_0x10c78e);})['then'](function(_0x5e3da7){_0x5946cb=_0x5e3da7;return getTicket(_0xa21df9,_0x501244,_0x5946cb,_0x437351,_0x3ef393,_0x437351[_0x4db2('0x4d')],_0x10c78e);})[_0x4db2('0x13')](function(_0x406eac){_0x38ac0e=_0x406eac;logger[_0x4db2('0x1a')]('[ABANDONED]\x20Ticket\x20%s\x20created.',_0x38ac0e['id']);logger[_0x4db2('0x1a')](_0x4db2('0x67'),_0xa21df9['type']);})[_0x4db2('0x56')](function(_0x532125){logger['error']('[ABANDONED]',JSON[_0x4db2('0x58')](_0x532125));});}; \ 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 33323f7..83ba9eb 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 _0x5430=['xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','Recording\x20is\x20enabled!','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','catch','error','outbound','%s/service/v4_1/rest.php','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Ticket\x20created!','charAt','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','[ABANDONED]','lodash','request-promise','bluebird','md5','util','ioredis','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','date_start','toISOString','duration_hours','duration_minutes','parent_id','parent_type','Contacts','length','forEach','variableName','push','idField','set_entry','stringify','Calls','Basic\x20%s','toString','base64','get_server_info','JSON','get_entry_list','Employees','format','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','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','','Caller\x20-\x20%s','first_name','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','custom_fields','content','variable','Variable','login','username','password','PLAIN'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5430,0x10c));var _0x0543=function(_0x21351d,_0x49584e){_0x21351d=_0x21351d-0x0;var _0x26e1fa=_0x5430[_0x21351d];return _0x26e1fa;};'use strict';var _=require(_0x0543('0x0'));var rp=require(_0x0543('0x1'));var BPromise=require(_0x0543('0x2'));var md5=require(_0x0543('0x3'));var util=require(_0x0543('0x4'));var Redis=require(_0x0543('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x0543('0x6'))('sugarcrm');config['redis']=_[_0x0543('0x7')](config[_0x0543('0x8')],{'host':_0x0543('0x9'),'port':0x18eb});var io=require(_0x0543('0xa'))(new Redis(config[_0x0543('0x8')]));var def={'method':'POST','json':!![]};function emit(_0x372974,_0x7b8280,_0x2955ea){io['to'](_0x372974)[_0x0543('0xb')](_0x7b8280,_0x2955ea);}function getTicket(_0x2fb723,_0x94b9e7,_0x56003c,_0x1ed7cc,_0x1ac048,_0x52c9b7,_0x46bbc1){logger[_0x0543('0xc')](_0x0543('0xd'));var _0x43b934=new Date();var _0x3f74f8=[{'name':_0x0543('0xe'),'value':intUtil[_0x0543('0xf')](_0x1ed7cc[_0x0543('0x10')],_0x1ac048,'\x20')},{'name':_0x0543('0x11'),'value':_0x94b9e7['id']},{'name':_0x0543('0x12'),'value':_0x94b9e7['id']},{'name':_0x0543('0x13'),'value':intUtil[_0x0543('0xf')](_0x1ed7cc['Descriptions'],_0x1ac048,'\x0a')},{'name':_0x0543('0x14'),'value':_0x43b934[_0x0543('0x15')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0x0543('0x16'),'value':'0'},{'name':_0x0543('0x17'),'value':'15'},{'name':_0x0543('0x18'),'value':_0x56003c['id']},{'name':_0x0543('0x19'),'value':_0x0543('0x1a')},{'name':'parent_name','value':_0x56003c[_0x0543('0xe')]}];if(_0x52c9b7[_0x0543('0x1b')]){_[_0x0543('0x1c')](_0x52c9b7,function(_0x25254e){if(_0x1ac048[_0x25254e[_0x0543('0x1d')]]){_0x3f74f8[_0x0543('0x1e')]({'name':_0x25254e[_0x0543('0x1f')],'value':_0x1ac048[_0x25254e['variableName']]});}});}return request({'form':{'method':_0x0543('0x20'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x0543('0x21')]({'session':_0x46bbc1['id'],'module_name':_0x0543('0x22'),'name_value_list':_0x3f74f8})}});}function getAuth(_0x1aece5){return util['format'](_0x0543('0x23'),new Buffer(_0x1aece5['apiKey']+':X')[_0x0543('0x24')](_0x0543('0x25')));}function getServerInfo(_0x543677){return request({'form':{'method':_0x0543('0x26'),'input_type':_0x0543('0x27'),'response_type':_0x0543('0x27'),'rest_data':JSON[_0x0543('0x21')]({'session':_0x543677['id']})}});}function getUser(_0x37347e,_0xe14f94,_0x4adba7){logger['info']('Getting\x20agent\x20with\x20name',_0xe14f94);return request({'form':{'method':_0x0543('0x28'),'input_type':_0x0543('0x27'),'response_type':_0x0543('0x27'),'rest_data':JSON[_0x0543('0x21')]({'session':_0x4adba7['id'],'module_name':_0x0543('0x29'),'query':util[_0x0543('0x2a')](_0x0543('0x2b'),_0xe14f94),'order_by':'','offset':'0','select_fields':['id',_0x0543('0xe'),_0x0543('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x0543('0x2d')](function(_0x40a261){if(_0x40a261[_0x0543('0x2e')]['length']){var _0x25e6f1=_[_0x0543('0x2f')](_0x40a261[_0x0543('0x2e')],function(_0x4f2592){return _0x4f2592[_0x0543('0x30')][_0x0543('0x2c')][_0x0543('0x31')]===_0xe14f94;});if(_0x25e6f1){logger[_0x0543('0xc')]('Agent\x20found!');return BPromise[_0x0543('0x32')]({'id':_0x25e6f1[_0x0543('0x30')]['id']['value'],'name':_0x25e6f1['name_value_list'][_0x0543('0xe')][_0x0543('0x31')]});}}else{logger['info'](_0x0543('0x33'));return BPromise[_0x0543('0x32')]({'id':_0x4adba7[_0x0543('0x30')][_0x0543('0x34')]['id'],'name':_0x4adba7[_0x0543('0x30')][_0x0543('0x2c')]['id']});}});}function getEndUser(_0x164bbf,_0x4f9b63,_0x45ac71,_0x4f6ded){logger[_0x0543('0xc')](_0x0543('0x35'),_0x45ac71);return request({'form':{'method':_0x0543('0x28'),'input_type':_0x0543('0x27'),'response_type':_0x0543('0x27'),'rest_data':JSON['stringify']({'session':_0x4f6ded['id'],'module_name':_0x0543('0x1a'),'query':util['format'](_0x0543('0x36'),_0x45ac71),'order_by':'','offset':'0','select_fields':['id',_0x0543('0xe'),_0x0543('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x0543('0x2d')](function(_0x57c5c4){if(_0x57c5c4[_0x0543('0x2e')]['length']){var _0x6ec1c2=_[_0x0543('0x2f')](_0x57c5c4[_0x0543('0x2e')],function(_0x316c6f){return _0x316c6f[_0x0543('0x30')][_0x0543('0x37')][_0x0543('0x31')]===_0x45ac71;});if(_0x6ec1c2){logger[_0x0543('0xc')](_0x0543('0x38'));return BPromise[_0x0543('0x32')]({'id':_0x6ec1c2['name_value_list']['id'][_0x0543('0x31')],'name':_0x6ec1c2[_0x0543('0x30')]['name'][_0x0543('0x31')],'phone':_0x6ec1c2['name_value_list'][_0x0543('0x37')][_0x0543('0x31')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x0543('0x20'),'input_type':_0x0543('0x27'),'response_type':'JSON','rest_data':JSON[_0x0543('0x21')]({'session':_0x4f6ded['id'],'module_name':_0x0543('0x1a'),'name_value_list':[{'name':'first_name','value':_0x4f9b63!==_0x0543('0x39')?_0x4f9b63:util[_0x0543('0x2a')](_0x0543('0x3a'),_0x45ac71)},{'name':_0x0543('0x37'),'value':_0x45ac71}]})}})[_0x0543('0x2d')](function(_0x4b78c3){logger['info']('Enduser\x20created.');return BPromise[_0x0543('0x32')]({'id':_0x4b78c3['id'],'name':_0x4b78c3[_0x0543('0x2e')][_0x0543('0x3b')][_0x0543('0x31')],'phone':_0x4b78c3['entry_list'][_0x0543('0x37')][_0x0543('0x31')]});});}});}function request(_0xe3936f){logger[_0x0543('0x3c')](_0x0543('0x3d'),JSON[_0x0543('0x21')](_0xe3936f));return rp(_[_0x0543('0x3e')](def,_0xe3936f));}function getTags(_0x58e779,_0x24a891){var _0x32d031=[];if(_0x58e779&&_0x58e779[_0x0543('0x1b')]>0x0){_0x32d031=_[_0x0543('0x3f')](_0x58e779,_0x24a891);}return _0x32d031;}function getCustomFields(_0xd14214,_0x43b7e8){var _0x5bf53d=[];var _0x53dfb8={'custom_fields':[]};if(_0xd14214[_0x0543('0x1b')]>0x0){_[_0x0543('0x1c')](_0xd14214,function(_0x1e4818){if(_0x1e4818[_0x0543('0x40')]===_0x0543('0x41')&&_0x1e4818[_0x0543('0x42')]&&!_0x1e4818[_0x0543('0x43')]){_0x53dfb8[_0x1e4818[_0x0543('0x42')][_0x0543('0x44')]()]=_0x1e4818['content']['toString']();}else if(_0x1e4818[_0x0543('0x40')]===_0x0543('0x41')&&_0x1e4818['idField']&&_0x1e4818['customField']){_0x53dfb8[_0x0543('0x45')][_0x0543('0x1e')]({'id':_0x1e4818['idField'],'value':_0x1e4818[_0x0543('0x46')]['toString']()});}else if(_0x1e4818[_0x0543('0x40')]===_0x0543('0x47')&&_0x1e4818['variableName']&&_0x1e4818['idField']&&_0x1e4818[_0x0543('0x43')]){_0x43b7e8[_0x1e4818['variableName']]&&_0x53dfb8[_0x0543('0x45')][_0x0543('0x1e')]({'id':_0x1e4818[_0x0543('0x1f')],'value':_0x43b7e8[_0x1e4818[_0x0543('0x1d')]][_0x0543('0x24')]()});}else if(_0x1e4818[_0x0543('0x40')]==='customVariable'&&_0x1e4818[_0x0543('0x48')]&&_0x1e4818[_0x0543('0x48')][_0x0543('0xe')]&&_0x1e4818[_0x0543('0x1f')]&&_0x1e4818[_0x0543('0x43')]){_0x43b7e8[_0x1e4818['Variable'][_0x0543('0xe')]['toLowerCase']()]&&_0x53dfb8[_0x0543('0x45')][_0x0543('0x1e')]({'id':_0x1e4818[_0x0543('0x1f')],'value':_0x43b7e8[_0x1e4818[_0x0543('0x48')][_0x0543('0xe')][_0x0543('0x44')]()]['toString']()});}});}return _0x53dfb8;}function getConnection(_0x54de11){return request({'method':'POST','form':{'method':_0x0543('0x49'),'input_type':_0x0543('0x27'),'response_type':'JSON','rest_data':JSON[_0x0543('0x21')]({'user_auth':{'user_name':_0x54de11[_0x0543('0x4a')],'password':_0x54de11[_0x0543('0x4b')],'encryption':_0x0543('0x4c')},'application':_0x0543('0x4d')})}})[_0x0543('0x2d')](function(_0x5dc3e4){var _0x3f2c4b=_0x5dc3e4;if(_0x3f2c4b['id']){def[_0x0543('0x4e')]=_0x3f2c4b['id'];return BPromise[_0x0543('0x32')](_0x3f2c4b);}else{throw new Error(util[_0x0543('0x2a')](_0x0543('0x4f'),_0x54de11['id']));}});}function setRelationship(_0x449150,_0x265bc1,_0xe59d99,_0x38e589){return request({'form':{'method':_0x0543('0x50'),'input_type':_0x0543('0x27'),'response_type':_0x0543('0x27'),'rest_data':JSON[_0x0543('0x21')]({'session':_0x449150['id'],'module_name':_0x0543('0x22'),'module_id':_0xe59d99['id'],'link_field_name':_0x38e589,'related_ids':[_0x265bc1['id']]})}});}exports['queue']=function(_0x14358d,_0x3c5acc,_0x1aa689,_0x3d2088,_0x1b03b4,_0x2980ad){var _0x3a6022,_0xce1de9,_0x194c3e,_0x40b9dc;_0x2980ad[_0x0543('0x51')]=intUtil[_0x0543('0x52')](_0x2980ad[_0x0543('0x51')]);_0x2980ad[_0x0543('0x53')]=intUtil[_0x0543('0x52')](_0x2980ad['serverUrl']);def[_0x0543('0x54')]=util[_0x0543('0x2a')]('%s/service/v4_1/rest.php',_0x2980ad[_0x0543('0x51')]);if(_0x1b03b4&&_0x1b03b4[_0x0543('0x55')]){logger[_0x0543('0xc')]('[QUEUE]',_0x0543('0x56'));_0x3c5acc['recordingURL']=util[_0x0543('0x2a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2980ad[_0x0543('0x53')],_0x3c5acc['uniqueid'],md5(_0x3c5acc[_0x0543('0x57')]));}else{_0x3c5acc[_0x0543('0x58')]='';}return getConnection(_0x2980ad)[_0x0543('0x2d')](function(_0x5e6b95){_0x40b9dc=_0x5e6b95;return getUser(_0x2980ad,_0x3d2088[_0x0543('0xe')],_0x40b9dc);})[_0x0543('0x2d')](function(_0x20ccee){_0x3a6022=_0x20ccee;logger[_0x0543('0xc')](_0x0543('0x59'),_0x3a6022['id']);return getEndUser(_0x2980ad,_0x3c5acc[_0x0543('0x5a')],_0x3c5acc[_0x0543('0x5b')],_0x40b9dc);})[_0x0543('0x2d')](function(_0x2bf1f9){_0xce1de9=_0x2bf1f9;logger[_0x0543('0xc')](_0x0543('0x5c'),_0xce1de9['id']);return getTicket(_0x2980ad,_0x3a6022,_0xce1de9,_0x1aa689,_0x3c5acc,_0x1aa689[_0x0543('0x5d')],_0x40b9dc);})[_0x0543('0x2d')](function(_0x21504b){_0x194c3e=_0x21504b;logger[_0x0543('0xc')]('Ticket\x20created!');logger['info'](_0x0543('0x5e'),_0x194c3e['id']);return setRelationship(_0x40b9dc,_0x3a6022,_0x194c3e,_0x0543('0x5f'));})[_0x0543('0x2d')](function(){return setRelationship(_0x40b9dc,_0xce1de9,_0x194c3e,_0x0543('0x60'));})[_0x0543('0x2d')](function(){return getServerInfo(_0x40b9dc);})[_0x0543('0x2d')](function(_0x4c4e49){var _0x31213d=parseInt(_0x4c4e49[_0x0543('0x61')]['charAt'](0x0));var _0x1f459b=util[_0x0543('0x2a')](_0x0543('0x62'),_0x2980ad[_0x0543('0x51')],_0x194c3e['id']);if(_0x31213d>0x6){_0x1f459b=util['format'](_0x0543('0x63'),_0x2980ad[_0x0543('0x51')],_0x194c3e['id']);}logger[_0x0543('0xc')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x0543('0x2a')](_0x0543('0x64'),_0x3d2088[_0x0543('0xe')]),'trigger:browser:url',{'uri':_0x1f459b});})[_0x0543('0x65')](function(_0x1dfdd7){logger[_0x0543('0x66')]('[QUEUE]',JSON[_0x0543('0x21')](_0x1dfdd7));});};exports[_0x0543('0x67')]=function(_0x274254,_0x183b8f,_0x2cd2e9,_0x1e694e,_0x16da76,_0x2fb930,_0x41cac7){var _0x3aefe8,_0x29020b,_0x6167e6,_0x1057b5;_0x2fb930[_0x0543('0x51')]=intUtil['stripTrailingSlash'](_0x2fb930['remoteUri']);_0x2fb930[_0x0543('0x53')]=intUtil[_0x0543('0x52')](_0x2fb930[_0x0543('0x53')]);def[_0x0543('0x54')]=util['format'](_0x0543('0x68'),_0x2fb930['remoteUri']);if(_0x41cac7&&_0x41cac7[_0x0543('0x69')]&&_0x41cac7[_0x0543('0x69')]!==_0x0543('0x6a')){logger['info']('[OUTBOUND]',_0x0543('0x56'));_0x183b8f['recordingURL']=util['format'](_0x0543('0x6b'),_0x2fb930[_0x0543('0x53')],_0x183b8f[_0x0543('0x57')],md5(_0x183b8f[_0x0543('0x57')]));}return getConnection(_0x2fb930)[_0x0543('0x2d')](function(_0x4481d4){_0x1057b5=_0x4481d4;return getUser(_0x2fb930,_0x1e694e[_0x0543('0xe')],_0x1057b5);})[_0x0543('0x2d')](function(_0x236c40){_0x3aefe8=_0x236c40;logger['info'](_0x0543('0x59'),_0x3aefe8['id']);return getEndUser(_0x2fb930,_0x183b8f[_0x0543('0x6c')],_0x183b8f[_0x0543('0x6d')],_0x1057b5);})[_0x0543('0x2d')](function(_0x3d918d){_0x29020b=_0x3d918d;logger['info'](_0x0543('0x5c'),_0x29020b['id']);return getTicket(_0x2fb930,_0x3aefe8,_0x29020b,_0x2cd2e9,_0x183b8f,_0x2cd2e9['Fields'],_0x1057b5);})[_0x0543('0x2d')](function(_0x85a666){_0x6167e6=_0x85a666;logger[_0x0543('0xc')](_0x0543('0x6e'));logger['info'](_0x0543('0x5e'),_0x6167e6['id']);return setRelationship(_0x1057b5,_0x3aefe8,_0x6167e6,_0x0543('0x5f'));})[_0x0543('0x2d')](function(){return setRelationship(_0x1057b5,_0x29020b,_0x6167e6,'contacts');})[_0x0543('0x2d')](function(){return getServerInfo(_0x1057b5);})['then'](function(_0x367201){var _0x3f8fb5=parseInt(_0x367201[_0x0543('0x61')][_0x0543('0x6f')](0x0));var _0x25aecd=util[_0x0543('0x2a')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x2fb930['remoteUri'],_0x6167e6['id']);if(_0x3f8fb5>0x6){_0x25aecd=util['format'](_0x0543('0x63'),_0x2fb930[_0x0543('0x51')],_0x6167e6['id']);}logger[_0x0543('0xc')](_0x0543('0x70'),_0x0543('0x71'));emit(util[_0x0543('0x2a')](_0x0543('0x64'),_0x1e694e[_0x0543('0xe')]),'trigger:browser:url',{'uri':_0x25aecd});})['catch'](function(_0x30390b){logger[_0x0543('0x66')]('[OUTBOUND]',JSON[_0x0543('0x21')](_0x30390b));});};exports['abandoned']=function(_0x136760,_0x130901,_0x1905d0,_0x258015,_0xb68fe6,_0x5d0528){var _0x13c620,_0x33947c,_0x494855,_0x30992a;_0x5d0528[_0x0543('0x51')]=intUtil[_0x0543('0x52')](_0x5d0528['remoteUri']);_0x5d0528[_0x0543('0x53')]=intUtil[_0x0543('0x52')](_0x5d0528[_0x0543('0x53')]);def['uri']=util[_0x0543('0x2a')](_0x0543('0x68'),_0x5d0528[_0x0543('0x51')]);if(_0xb68fe6&&_0xb68fe6[_0x0543('0x55')]){logger['info'](_0x0543('0x72'),_0x0543('0x56'));_0x130901[_0x0543('0x58')]=util[_0x0543('0x2a')](_0x0543('0x6b'),_0x5d0528[_0x0543('0x53')],_0x130901[_0x0543('0x57')],md5(_0x130901[_0x0543('0x57')]));}else{_0x130901[_0x0543('0x58')]='';}return getConnection(_0x5d0528)[_0x0543('0x2d')](function(_0x375b22){_0x30992a=_0x375b22;return getUser(_0x5d0528,_0x258015[_0x0543('0xe')],_0x30992a);})[_0x0543('0x2d')](function(_0x20df70){_0x13c620=_0x20df70;logger[_0x0543('0xc')](_0x0543('0x59'),_0x13c620['id']);return getEndUser(_0x5d0528,_0x130901[_0x0543('0x5a')],_0x130901['calleridnum'],_0x30992a);})[_0x0543('0x2d')](function(_0x25265c){_0x33947c=_0x25265c;logger[_0x0543('0xc')](_0x0543('0x5c'),_0x33947c['id']);return getTicket(_0x5d0528,_0x13c620,_0x33947c,_0x1905d0,_0x130901,_0x1905d0[_0x0543('0x5d')],_0x30992a);})[_0x0543('0x2d')](function(_0x320617){_0x494855=_0x320617;logger[_0x0543('0xc')](_0x0543('0x6e'));logger[_0x0543('0xc')](_0x0543('0x5e'),_0x494855['id']);return setRelationship(_0x30992a,_0x13c620,_0x494855,'users');})[_0x0543('0x2d')](function(){return setRelationship(_0x30992a,_0x33947c,_0x494855,_0x0543('0x60'));})[_0x0543('0x2d')](function(){return getServerInfo(_0x30992a);})['catch'](function(_0x40b27f){logger['error']('[ABANDONED]',JSON[_0x0543('0x21')](_0x40b27f));});}; \ No newline at end of file +var _0x7ee1=['%s/service/v4_1/rest.php','monitor_format','recordingURL','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','abandoned','[ABANDONED]','lodash','util','ioredis','./util','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','replace','Contacts','parent_name','name','length','forEach','variableName','idField','set_entry','JSON','Calls','format','apiKey','toString','base64','get_server_info','stringify','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','Agent\x20found!','resolve','user_id','phone_home','Enduser\x20found!','first_name','','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','customField','nameField','toLowerCase','content','custom_fields','push','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','stripTrailingSlash','remoteUri','serverUrl','uri'];(function(_0x4be8ba,_0x5d10ba){var _0x1af822=function(_0x40ed8a){while(--_0x40ed8a){_0x4be8ba['push'](_0x4be8ba['shift']());}};_0x1af822(++_0x5d10ba);}(_0x7ee1,0x8d));var _0x17ee=function(_0x14994f,_0x227a98){_0x14994f=_0x14994f-0x0;var _0x384599=_0x7ee1[_0x14994f];return _0x384599;};'use strict';var _=require(_0x17ee('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require('md5');var util=require(_0x17ee('0x1'));var Redis=require(_0x17ee('0x2'));var intUtil=require(_0x17ee('0x3'));var config=require('../../../../config/environment');var logger=require(_0x17ee('0x4'))(_0x17ee('0x5'));config[_0x17ee('0x6')]=_[_0x17ee('0x7')](config['redis'],{'host':_0x17ee('0x8'),'port':0x18eb});var io=require(_0x17ee('0x9'))(new Redis(config['redis']));var def={'method':_0x17ee('0xa'),'json':!![]};function emit(_0x57e1d1,_0x3d767b,_0xfa5096){io['to'](_0x57e1d1)[_0x17ee('0xb')](_0x3d767b,_0xfa5096);}function getTicket(_0x4af369,_0x4b6374,_0x4d6bb5,_0x17f935,_0x4ee1e0,_0x155964,_0x378a78){logger[_0x17ee('0xc')](_0x17ee('0xd'));var _0x57fae0=new Date();var _0x1acde5=[{'name':'name','value':intUtil[_0x17ee('0xe')](_0x17f935[_0x17ee('0xf')],_0x4ee1e0,'\x20')},{'name':_0x17ee('0x10'),'value':_0x4b6374['id']},{'name':_0x17ee('0x11'),'value':_0x4b6374['id']},{'name':_0x17ee('0x12'),'value':intUtil[_0x17ee('0xe')](_0x17f935[_0x17ee('0x13')],_0x4ee1e0,'\x0a')},{'name':_0x17ee('0x14'),'value':_0x57fae0[_0x17ee('0x15')]()[_0x17ee('0x16')](0x0,0x13)[_0x17ee('0x17')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':'parent_id','value':_0x4d6bb5['id']},{'name':'parent_type','value':_0x17ee('0x18')},{'name':_0x17ee('0x19'),'value':_0x4d6bb5[_0x17ee('0x1a')]}];if(_0x155964[_0x17ee('0x1b')]){_[_0x17ee('0x1c')](_0x155964,function(_0x236d18){if(_0x4ee1e0[_0x236d18[_0x17ee('0x1d')]]){_0x1acde5['push']({'name':_0x236d18[_0x17ee('0x1e')],'value':_0x4ee1e0[_0x236d18[_0x17ee('0x1d')]]});}});}return request({'form':{'method':_0x17ee('0x1f'),'input_type':_0x17ee('0x20'),'response_type':_0x17ee('0x20'),'rest_data':JSON['stringify']({'session':_0x378a78['id'],'module_name':_0x17ee('0x21'),'name_value_list':_0x1acde5})}});}function getAuth(_0x587784){return util[_0x17ee('0x22')]('Basic\x20%s',new Buffer(_0x587784[_0x17ee('0x23')]+':X')[_0x17ee('0x24')](_0x17ee('0x25')));}function getServerInfo(_0xdbeb6a){return request({'form':{'method':_0x17ee('0x26'),'input_type':_0x17ee('0x20'),'response_type':_0x17ee('0x20'),'rest_data':JSON[_0x17ee('0x27')]({'session':_0xdbeb6a['id']})}});}function getUser(_0x1425e5,_0x1f3d6d,_0x37fe4e){logger['info']('Getting\x20agent\x20with\x20name',_0x1f3d6d);return request({'form':{'method':_0x17ee('0x28'),'input_type':_0x17ee('0x20'),'response_type':_0x17ee('0x20'),'rest_data':JSON[_0x17ee('0x27')]({'session':_0x37fe4e['id'],'module_name':_0x17ee('0x29'),'query':util[_0x17ee('0x22')](_0x17ee('0x2a'),_0x1f3d6d),'order_by':'','offset':'0','select_fields':['id',_0x17ee('0x1a'),_0x17ee('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x17ee('0x2c')](function(_0xfcfade){if(_0xfcfade[_0x17ee('0x2d')]['length']){var _0x3634c9=_[_0x17ee('0x2e')](_0xfcfade[_0x17ee('0x2d')],function(_0x258018){return _0x258018[_0x17ee('0x2f')]['user_name'][_0x17ee('0x30')]===_0x1f3d6d;});if(_0x3634c9){logger[_0x17ee('0xc')](_0x17ee('0x31'));return BPromise['resolve']({'id':_0x3634c9[_0x17ee('0x2f')]['id'][_0x17ee('0x30')],'name':_0x3634c9['name_value_list'][_0x17ee('0x1a')]['value']});}}else{logger[_0x17ee('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x17ee('0x32')]({'id':_0x37fe4e[_0x17ee('0x2f')][_0x17ee('0x33')]['id'],'name':_0x37fe4e['name_value_list'][_0x17ee('0x2b')]['id']});}});}function getEndUser(_0x7fb525,_0x57bfd4,_0xf20ed7,_0x118b31){logger[_0x17ee('0xc')]('Searching\x20enduser\x20with\x20phone',_0xf20ed7);return request({'form':{'method':'get_entry_list','input_type':_0x17ee('0x20'),'response_type':_0x17ee('0x20'),'rest_data':JSON[_0x17ee('0x27')]({'session':_0x118b31['id'],'module_name':_0x17ee('0x18'),'query':util['format']('contacts.phone_home\x20=\x20\x22%s\x22',_0xf20ed7),'order_by':'','offset':'0','select_fields':['id',_0x17ee('0x1a'),_0x17ee('0x34')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x17ee('0x2c')](function(_0x7e2957){if(_0x7e2957[_0x17ee('0x2d')][_0x17ee('0x1b')]){var _0x150e99=_['find'](_0x7e2957['entry_list'],function(_0x55330a){return _0x55330a[_0x17ee('0x2f')]['phone_home'][_0x17ee('0x30')]===_0xf20ed7;});if(_0x150e99){logger[_0x17ee('0xc')](_0x17ee('0x35'));return BPromise['resolve']({'id':_0x150e99[_0x17ee('0x2f')]['id'][_0x17ee('0x30')],'name':_0x150e99['name_value_list']['name'][_0x17ee('0x30')],'phone':_0x150e99[_0x17ee('0x2f')][_0x17ee('0x34')][_0x17ee('0x30')]});}}else{logger[_0x17ee('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':_0x17ee('0x20'),'response_type':_0x17ee('0x20'),'rest_data':JSON[_0x17ee('0x27')]({'session':_0x118b31['id'],'module_name':_0x17ee('0x18'),'name_value_list':[{'name':_0x17ee('0x36'),'value':_0x57bfd4!==_0x17ee('0x37')?_0x57bfd4:util['format']('Caller\x20-\x20%s',_0xf20ed7)},{'name':_0x17ee('0x34'),'value':_0xf20ed7}]})}})[_0x17ee('0x2c')](function(_0x2580b4){logger[_0x17ee('0xc')](_0x17ee('0x38'));return BPromise[_0x17ee('0x32')]({'id':_0x2580b4['id'],'name':_0x2580b4[_0x17ee('0x2d')][_0x17ee('0x36')][_0x17ee('0x30')],'phone':_0x2580b4[_0x17ee('0x2d')]['phone_home']['value']});});}});}function request(_0x4c3954){logger[_0x17ee('0x39')](_0x17ee('0x3a'),JSON[_0x17ee('0x27')](_0x4c3954));return rp(_[_0x17ee('0x3b')](def,_0x4c3954));}function getTags(_0x4f0735,_0x4516c5){var _0x10134a=[];if(_0x4f0735&&_0x4f0735[_0x17ee('0x1b')]>0x0){_0x10134a=_[_0x17ee('0x3c')](_0x4f0735,_0x4516c5);}return _0x10134a;}function getCustomFields(_0x546b5c,_0x451dba){var _0x55b4e2=[];var _0x2b9f50={'custom_fields':[]};if(_0x546b5c[_0x17ee('0x1b')]>0x0){_[_0x17ee('0x1c')](_0x546b5c,function(_0x192809){if(_0x192809[_0x17ee('0x3d')]===_0x17ee('0x3e')&&_0x192809['nameField']&&!_0x192809[_0x17ee('0x3f')]){_0x2b9f50[_0x192809[_0x17ee('0x40')][_0x17ee('0x41')]()]=_0x192809[_0x17ee('0x42')][_0x17ee('0x24')]();}else if(_0x192809[_0x17ee('0x3d')]===_0x17ee('0x3e')&&_0x192809[_0x17ee('0x1e')]&&_0x192809[_0x17ee('0x3f')]){_0x2b9f50[_0x17ee('0x43')][_0x17ee('0x44')]({'id':_0x192809[_0x17ee('0x1e')],'value':_0x192809['content'][_0x17ee('0x24')]()});}else if(_0x192809[_0x17ee('0x3d')]==='variable'&&_0x192809['variableName']&&_0x192809['idField']&&_0x192809[_0x17ee('0x3f')]){_0x451dba[_0x192809[_0x17ee('0x1d')]]&&_0x2b9f50[_0x17ee('0x43')][_0x17ee('0x44')]({'id':_0x192809[_0x17ee('0x1e')],'value':_0x451dba[_0x192809['variableName']][_0x17ee('0x24')]()});}else if(_0x192809[_0x17ee('0x3d')]===_0x17ee('0x45')&&_0x192809[_0x17ee('0x46')]&&_0x192809[_0x17ee('0x46')][_0x17ee('0x1a')]&&_0x192809[_0x17ee('0x1e')]&&_0x192809[_0x17ee('0x3f')]){_0x451dba[_0x192809[_0x17ee('0x46')][_0x17ee('0x1a')][_0x17ee('0x41')]()]&&_0x2b9f50[_0x17ee('0x43')]['push']({'id':_0x192809['idField'],'value':_0x451dba[_0x192809[_0x17ee('0x46')][_0x17ee('0x1a')]['toLowerCase']()]['toString']()});}});}return _0x2b9f50;}function getConnection(_0xdc6e){return request({'method':'POST','form':{'method':_0x17ee('0x47'),'input_type':_0x17ee('0x20'),'response_type':_0x17ee('0x20'),'rest_data':JSON[_0x17ee('0x27')]({'user_auth':{'user_name':_0xdc6e[_0x17ee('0x48')],'password':_0xdc6e[_0x17ee('0x49')],'encryption':_0x17ee('0x4a')},'application':_0x17ee('0x4b')})}})[_0x17ee('0x2c')](function(_0xc368c3){var _0x368676=_0xc368c3;if(_0x368676['id']){def[_0x17ee('0x4c')]=_0x368676['id'];return BPromise[_0x17ee('0x32')](_0x368676);}else{throw new Error(util['format'](_0x17ee('0x4d'),_0xdc6e['id']));}});}function setRelationship(_0x1231cd,_0x49b39e,_0x5e66b1,_0x1082dc){return request({'form':{'method':'set_relationship','input_type':_0x17ee('0x20'),'response_type':_0x17ee('0x20'),'rest_data':JSON[_0x17ee('0x27')]({'session':_0x1231cd['id'],'module_name':_0x17ee('0x21'),'module_id':_0x5e66b1['id'],'link_field_name':_0x1082dc,'related_ids':[_0x49b39e['id']]})}});}exports[_0x17ee('0x4e')]=function(_0x10a021,_0x2c2df5,_0x58bab0,_0x1407a7,_0x5a0978,_0x509f25){var _0x12870e,_0x266bd5,_0xd323f4,_0x5604c9;_0x509f25['remoteUri']=intUtil[_0x17ee('0x4f')](_0x509f25[_0x17ee('0x50')]);_0x509f25[_0x17ee('0x51')]=intUtil[_0x17ee('0x4f')](_0x509f25[_0x17ee('0x51')]);def[_0x17ee('0x52')]=util[_0x17ee('0x22')](_0x17ee('0x53'),_0x509f25['remoteUri']);if(_0x5a0978&&_0x5a0978[_0x17ee('0x54')]){logger[_0x17ee('0xc')]('[QUEUE]','Recording\x20is\x20enabled!');_0x2c2df5[_0x17ee('0x55')]=util[_0x17ee('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x509f25['serverUrl'],_0x2c2df5['uniqueid'],md5(_0x2c2df5[_0x17ee('0x56')]));}else{_0x2c2df5[_0x17ee('0x55')]='';}return getConnection(_0x509f25)[_0x17ee('0x2c')](function(_0x4a00db){_0x5604c9=_0x4a00db;return getUser(_0x509f25,_0x1407a7[_0x17ee('0x1a')],_0x5604c9);})[_0x17ee('0x2c')](function(_0x407317){_0x12870e=_0x407317;logger[_0x17ee('0xc')]('The\x20User\x20ID\x20is:',_0x12870e['id']);return getEndUser(_0x509f25,_0x2c2df5[_0x17ee('0x57')],_0x2c2df5[_0x17ee('0x58')],_0x5604c9);})['then'](function(_0x431b6a){_0x266bd5=_0x431b6a;logger[_0x17ee('0xc')](_0x17ee('0x59'),_0x266bd5['id']);return getTicket(_0x509f25,_0x12870e,_0x266bd5,_0x58bab0,_0x2c2df5,_0x58bab0[_0x17ee('0x5a')],_0x5604c9);})[_0x17ee('0x2c')](function(_0x29bd29){_0xd323f4=_0x29bd29;logger[_0x17ee('0xc')](_0x17ee('0x5b'));logger[_0x17ee('0xc')](_0x17ee('0x5c'),_0xd323f4['id']);return setRelationship(_0x5604c9,_0x12870e,_0xd323f4,_0x17ee('0x5d'));})['then'](function(){return setRelationship(_0x5604c9,_0x266bd5,_0xd323f4,_0x17ee('0x5e'));})[_0x17ee('0x2c')](function(){return getServerInfo(_0x5604c9);})['then'](function(_0x3cc10b){var _0x288f55=parseInt(_0x3cc10b[_0x17ee('0x5f')]['charAt'](0x0));var _0x465718=util[_0x17ee('0x22')](_0x17ee('0x60'),_0x509f25[_0x17ee('0x50')],_0xd323f4['id']);if(_0x288f55>0x6){_0x465718=util['format'](_0x17ee('0x61'),_0x509f25[_0x17ee('0x50')],_0xd323f4['id']);}logger['info'](_0x17ee('0x62'),_0x17ee('0x63'));emit(util[_0x17ee('0x22')](_0x17ee('0x64'),_0x1407a7[_0x17ee('0x1a')]),_0x17ee('0x65'),{'uri':_0x465718});})[_0x17ee('0x66')](function(_0xeabfa){logger[_0x17ee('0x67')](_0x17ee('0x62'),JSON[_0x17ee('0x27')](_0xeabfa));});};exports['outbound']=function(_0xd0ddb3,_0x567893,_0x420eee,_0x38fd73,_0x97b640,_0x5a1ee3,_0x5c6c48){var _0x2e3bb3,_0x7c21d,_0x1ee84b,_0x31cb27;_0x5a1ee3['remoteUri']=intUtil[_0x17ee('0x4f')](_0x5a1ee3['remoteUri']);_0x5a1ee3['serverUrl']=intUtil[_0x17ee('0x4f')](_0x5a1ee3[_0x17ee('0x51')]);def['uri']=util['format'](_0x17ee('0x53'),_0x5a1ee3[_0x17ee('0x50')]);if(_0x5c6c48&&_0x5c6c48['recordingFormat']&&_0x5c6c48[_0x17ee('0x68')]!==_0x17ee('0x69')){logger[_0x17ee('0xc')](_0x17ee('0x6a'),_0x17ee('0x6b'));_0x567893[_0x17ee('0x55')]=util[_0x17ee('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5a1ee3[_0x17ee('0x51')],_0x567893[_0x17ee('0x56')],md5(_0x567893[_0x17ee('0x56')]));}return getConnection(_0x5a1ee3)[_0x17ee('0x2c')](function(_0xe8e105){_0x31cb27=_0xe8e105;return getUser(_0x5a1ee3,_0x38fd73[_0x17ee('0x1a')],_0x31cb27);})[_0x17ee('0x2c')](function(_0x44a5f3){_0x2e3bb3=_0x44a5f3;logger[_0x17ee('0xc')](_0x17ee('0x6c'),_0x2e3bb3['id']);return getEndUser(_0x5a1ee3,_0x567893[_0x17ee('0x6d')],_0x567893['destcalleridnum'],_0x31cb27);})[_0x17ee('0x2c')](function(_0x402e70){_0x7c21d=_0x402e70;logger[_0x17ee('0xc')](_0x17ee('0x59'),_0x7c21d['id']);return getTicket(_0x5a1ee3,_0x2e3bb3,_0x7c21d,_0x420eee,_0x567893,_0x420eee[_0x17ee('0x5a')],_0x31cb27);})[_0x17ee('0x2c')](function(_0x4c3af8){_0x1ee84b=_0x4c3af8;logger[_0x17ee('0xc')](_0x17ee('0x5b'));logger['info'](_0x17ee('0x5c'),_0x1ee84b['id']);return setRelationship(_0x31cb27,_0x2e3bb3,_0x1ee84b,_0x17ee('0x5d'));})[_0x17ee('0x2c')](function(){return setRelationship(_0x31cb27,_0x7c21d,_0x1ee84b,_0x17ee('0x5e'));})[_0x17ee('0x2c')](function(){return getServerInfo(_0x31cb27);})[_0x17ee('0x2c')](function(_0x582f11){var _0x4c8c91=parseInt(_0x582f11[_0x17ee('0x5f')]['charAt'](0x0));var _0x11b5a9=util[_0x17ee('0x22')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x5a1ee3['remoteUri'],_0x1ee84b['id']);if(_0x4c8c91>0x6){_0x11b5a9=util[_0x17ee('0x22')](_0x17ee('0x61'),_0x5a1ee3[_0x17ee('0x50')],_0x1ee84b['id']);}logger['info'](_0x17ee('0x6a'),_0x17ee('0x63'));emit(util[_0x17ee('0x22')](_0x17ee('0x64'),_0x38fd73['name']),_0x17ee('0x65'),{'uri':_0x11b5a9});})[_0x17ee('0x66')](function(_0x2e933f){logger[_0x17ee('0x67')](_0x17ee('0x6a'),JSON[_0x17ee('0x27')](_0x2e933f));});};exports[_0x17ee('0x6e')]=function(_0x466ca3,_0x209608,_0x1146b8,_0x2cb795,_0x5d0787,_0x207833){var _0x98eabf,_0xcb4b4f,_0x28c113,_0x14edbf;_0x207833[_0x17ee('0x50')]=intUtil[_0x17ee('0x4f')](_0x207833['remoteUri']);_0x207833[_0x17ee('0x51')]=intUtil[_0x17ee('0x4f')](_0x207833[_0x17ee('0x51')]);def[_0x17ee('0x52')]=util[_0x17ee('0x22')](_0x17ee('0x53'),_0x207833['remoteUri']);if(_0x5d0787&&_0x5d0787[_0x17ee('0x54')]){logger[_0x17ee('0xc')](_0x17ee('0x6f'),_0x17ee('0x6b'));_0x209608[_0x17ee('0x55')]=util[_0x17ee('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x207833[_0x17ee('0x51')],_0x209608[_0x17ee('0x56')],md5(_0x209608[_0x17ee('0x56')]));}else{_0x209608[_0x17ee('0x55')]='';}return getConnection(_0x207833)[_0x17ee('0x2c')](function(_0x88b697){_0x14edbf=_0x88b697;return getUser(_0x207833,_0x2cb795[_0x17ee('0x1a')],_0x14edbf);})[_0x17ee('0x2c')](function(_0x93efa6){_0x98eabf=_0x93efa6;logger[_0x17ee('0xc')](_0x17ee('0x6c'),_0x98eabf['id']);return getEndUser(_0x207833,_0x209608[_0x17ee('0x57')],_0x209608['calleridnum'],_0x14edbf);})[_0x17ee('0x2c')](function(_0x3d2c2e){_0xcb4b4f=_0x3d2c2e;logger['info'](_0x17ee('0x59'),_0xcb4b4f['id']);return getTicket(_0x207833,_0x98eabf,_0xcb4b4f,_0x1146b8,_0x209608,_0x1146b8[_0x17ee('0x5a')],_0x14edbf);})[_0x17ee('0x2c')](function(_0x53ddb7){_0x28c113=_0x53ddb7;logger[_0x17ee('0xc')](_0x17ee('0x5b'));logger[_0x17ee('0xc')](_0x17ee('0x5c'),_0x28c113['id']);return setRelationship(_0x14edbf,_0x98eabf,_0x28c113,_0x17ee('0x5d'));})[_0x17ee('0x2c')](function(){return setRelationship(_0x14edbf,_0xcb4b4f,_0x28c113,_0x17ee('0x5e'));})['then'](function(){return getServerInfo(_0x14edbf);})[_0x17ee('0x66')](function(_0x11ea4f){logger[_0x17ee('0x67')]('[ABANDONED]',JSON[_0x17ee('0x27')](_0x11ea4f));});}; \ 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 8018ec5..cc02961 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 _0x65bd=['getString','sortBy','string','push','type','variableName','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','variable','customVariable','join','stripTrailingSlash','substr','lodash'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x65bd,0x179));var _0xd65b=function(_0x1c29f7,_0x10b87b){_0x1c29f7=_0x1c29f7-0x0;var _0x42460a=_0x65bd[_0x1c29f7];return _0x42460a;};'use strict';var _=require(_0xd65b('0x0'));var util=require('util');exports[_0xd65b('0x1')]=function(_0x5c36be,_0x3d95c7,_0x1923dd){var _0x75c5d9=[];if(_0x5c36be['length']>0x0){var _0x5baee4=_[_0xd65b('0x2')](_0x5c36be,['id']);for(var _0x220e71=0x0;_0x220e71<_0x5baee4['length'];_0x220e71++){var _0x59d3a8=_0x5baee4[_0x220e71];if(_0x59d3a8['type']===_0xd65b('0x3')){_0x75c5d9[_0xd65b('0x4')](_0x59d3a8['content']);}else if(_0x59d3a8[_0xd65b('0x5')]==='variable'&&_0x59d3a8[_0xd65b('0x6')]){_0x3d95c7[_0x59d3a8[_0xd65b('0x6')]]&&_0x75c5d9[_0xd65b('0x4')](_0x3d95c7[_0x59d3a8[_0xd65b('0x6')]]['toString']());}else if(_0x59d3a8[_0xd65b('0x5')]==='customVariable'&&_0x59d3a8[_0xd65b('0x7')]&&_0x59d3a8['Variable'][_0xd65b('0x8')]){_0x3d95c7[_0x59d3a8['Variable']['name'][_0xd65b('0x9')]()]&&_0x75c5d9[_0xd65b('0x4')](_0x3d95c7[_0x59d3a8[_0xd65b('0x7')][_0xd65b('0x8')][_0xd65b('0x9')]()]['toString']());}else if(_0x59d3a8[_0xd65b('0x5')]===_0xd65b('0xa')){if(_0x59d3a8[_0xd65b('0xb')]==='string'&&_0x59d3a8[_0xd65b('0xc')]){_0x75c5d9[_0xd65b('0x4')](util[_0xd65b('0xd')](_0xd65b('0xe'),_0x59d3a8[_0xd65b('0xc')],_0x59d3a8[_0xd65b('0xf')]));}else if(_0x59d3a8[_0xd65b('0xb')]===_0xd65b('0x10')&&_0x59d3a8[_0xd65b('0x6')]&&_0x59d3a8[_0xd65b('0xc')]){_0x3d95c7[_0x59d3a8['variableName']]&&_0x75c5d9[_0xd65b('0x4')](util[_0xd65b('0xd')](_0xd65b('0xe'),_0x59d3a8[_0xd65b('0xc')],_0x3d95c7[_0x59d3a8['variableName']]));}else if(_0x59d3a8[_0xd65b('0xb')]===_0xd65b('0x11')&&_0x59d3a8['Variable']&&_0x59d3a8[_0xd65b('0x7')][_0xd65b('0x8')]&&_0x59d3a8['key']){_0x3d95c7[_0x59d3a8[_0xd65b('0x7')][_0xd65b('0x8')][_0xd65b('0x9')]()]&&_0x75c5d9['push'](util[_0xd65b('0xd')]('%s:\x20%s',_0x59d3a8[_0xd65b('0xc')],_0x3d95c7[_0x59d3a8[_0xd65b('0x7')][_0xd65b('0x8')][_0xd65b('0x9')]()]));}}}}return _0x75c5d9[_0xd65b('0x12')](_0x1923dd);};exports[_0xd65b('0x13')]=function(_0x585d36){if(_0x585d36&&_0x585d36[_0xd65b('0x14')](-0x1)==='/'){return _0x585d36[_0xd65b('0x14')](0x0,_0x585d36['length']-0x1);}return _0x585d36;}; \ No newline at end of file +var _0xfe91=['getString','length','sortBy','push','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','string','key','format','%s:\x20%s','keyContent','keyType','join','stripTrailingSlash','substr','lodash','util'];(function(_0x1fbf2e,_0x5b53b6){var _0x1c3255=function(_0x5bb1fd){while(--_0x5bb1fd){_0x1fbf2e['push'](_0x1fbf2e['shift']());}};_0x1c3255(++_0x5b53b6);}(_0xfe91,0xa6));var _0x1fe9=function(_0x503cd5,_0x57774a){_0x503cd5=_0x503cd5-0x0;var _0x1fdf1e=_0xfe91[_0x503cd5];return _0x1fdf1e;};'use strict';var _=require(_0x1fe9('0x0'));var util=require(_0x1fe9('0x1'));exports[_0x1fe9('0x2')]=function(_0x2aedae,_0x561ac6,_0x2ed282){var _0x2ce28f=[];if(_0x2aedae[_0x1fe9('0x3')]>0x0){var _0x21c0ed=_[_0x1fe9('0x4')](_0x2aedae,['id']);for(var _0x1b0ba3=0x0;_0x1b0ba3<_0x21c0ed['length'];_0x1b0ba3++){var _0x5326e6=_0x21c0ed[_0x1b0ba3];if(_0x5326e6['type']==='string'){_0x2ce28f[_0x1fe9('0x5')](_0x5326e6[_0x1fe9('0x6')]);}else if(_0x5326e6[_0x1fe9('0x7')]===_0x1fe9('0x8')&&_0x5326e6[_0x1fe9('0x9')]){_0x561ac6[_0x5326e6[_0x1fe9('0x9')]]&&_0x2ce28f[_0x1fe9('0x5')](_0x561ac6[_0x5326e6[_0x1fe9('0x9')]][_0x1fe9('0xa')]());}else if(_0x5326e6[_0x1fe9('0x7')]===_0x1fe9('0xb')&&_0x5326e6[_0x1fe9('0xc')]&&_0x5326e6[_0x1fe9('0xc')][_0x1fe9('0xd')]){_0x561ac6[_0x5326e6['Variable'][_0x1fe9('0xd')][_0x1fe9('0xe')]()]&&_0x2ce28f[_0x1fe9('0x5')](_0x561ac6[_0x5326e6[_0x1fe9('0xc')][_0x1fe9('0xd')][_0x1fe9('0xe')]()][_0x1fe9('0xa')]());}else if(_0x5326e6[_0x1fe9('0x7')]==='keyValue'){if(_0x5326e6['keyType']===_0x1fe9('0xf')&&_0x5326e6[_0x1fe9('0x10')]){_0x2ce28f[_0x1fe9('0x5')](util[_0x1fe9('0x11')](_0x1fe9('0x12'),_0x5326e6[_0x1fe9('0x10')],_0x5326e6[_0x1fe9('0x13')]));}else if(_0x5326e6[_0x1fe9('0x14')]===_0x1fe9('0x8')&&_0x5326e6[_0x1fe9('0x9')]&&_0x5326e6['key']){_0x561ac6[_0x5326e6[_0x1fe9('0x9')]]&&_0x2ce28f[_0x1fe9('0x5')](util['format'](_0x1fe9('0x12'),_0x5326e6[_0x1fe9('0x10')],_0x561ac6[_0x5326e6[_0x1fe9('0x9')]]));}else if(_0x5326e6[_0x1fe9('0x14')]==='customVariable'&&_0x5326e6[_0x1fe9('0xc')]&&_0x5326e6[_0x1fe9('0xc')][_0x1fe9('0xd')]&&_0x5326e6[_0x1fe9('0x10')]){_0x561ac6[_0x5326e6[_0x1fe9('0xc')][_0x1fe9('0xd')][_0x1fe9('0xe')]()]&&_0x2ce28f[_0x1fe9('0x5')](util[_0x1fe9('0x11')](_0x1fe9('0x12'),_0x5326e6[_0x1fe9('0x10')],_0x561ac6[_0x5326e6['Variable'][_0x1fe9('0xd')][_0x1fe9('0xe')]()]));}}}}return _0x2ce28f[_0x1fe9('0x15')](_0x2ed282);};exports[_0x1fe9('0x16')]=function(_0x30a3c2){if(_0x30a3c2&&_0x30a3c2[_0x1fe9('0x17')](-0x1)==='/'){return _0x30a3c2[_0x1fe9('0x17')](0x0,_0x30a3c2[_0x1fe9('0x3')]-0x1);}return _0x30a3c2;}; \ 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 386713f..a6575b2 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 _0x9c44=['admin','sessionName','HelpDesk','stringify','success','resolve','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','test','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','info','Getting\x20agent\x20with\x20email','GET','remoteUri','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','then','result','Agent\x20found!','first_name','last_name','userId','username','getUser','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','length','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','create','Contacts','Enduser\x20created.','catch','getEndUser','getchallenge','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','recordingFormat','none','uniqueid','destcalleridnum','Ticket\x20created!','[OUTBOUND]','abandoned','[ABANDONED]','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','idField','toString','type','variableName','customVariable','Variable','name','toLowerCase','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','Descriptions','%s/webservice.php'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_0x313e73['type']===_0x49c4('0xb')&&_0x313e73[_0x49c4('0xc')]){_0x4c7d3a[_0x313e73['idField']]=_0x313e73['content'][_0x49c4('0xd')]();}else if(_0x313e73[_0x49c4('0xe')]==='variable'&&_0x313e73[_0x49c4('0xf')]&&_0x313e73[_0x49c4('0xc')]&&_0x4487ca[_0x313e73['variableName']]){_0x4c7d3a[_0x313e73[_0x49c4('0xc')]]=_0x4487ca[_0x313e73[_0x49c4('0xf')]][_0x49c4('0xd')]();}else if(_0x313e73[_0x49c4('0xe')]===_0x49c4('0x10')&&_0x313e73[_0x49c4('0x11')]&&_0x313e73[_0x49c4('0x11')][_0x49c4('0x12')]&&_0x313e73['idField']&&_0x4487ca[_0x313e73[_0x49c4('0x11')][_0x49c4('0x12')][_0x49c4('0x13')]()]){_0x4c7d3a[_0x313e73[_0x49c4('0xc')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]['name'][_0x49c4('0x13')]()][_0x49c4('0xd')]();}});}return _0x4c7d3a;}function createTicket(_0x4c3253,_0x512650,_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d){logger['info'](_0x49c4('0x14'));var _0x1806c2=_[_0x49c4('0x15')]({'parent_id':'','assigned_user_id':_0x512650['id'],'ticketpriorities':_0x49c4('0x16'),'ticketstatus':_0x49c4('0x17'),'ticket_title':intUtil[_0x49c4('0x18')](_0x2f82d5[_0x49c4('0x19')],_0x3addb2,'\x20'),'description':intUtil[_0x49c4('0x18')](_0x2f82d5[_0x49c4('0x1a')],_0x3addb2,'\x0a'),'contact_id':_0x3c782d['id']},getCustomFields(_0x59f29b,_0x3addb2));var _0x578447={'method':'POST','uri':util['format'](_0x49c4('0x1b'),_0x4c3253['remoteUri']),'form':{'operation':'create','username':_0x49c4('0x1c'),'sessionName':_0x24856d[_0x49c4('0x1d')],'elementType':_0x49c4('0x1e'),'element':JSON[_0x49c4('0x1f')](_0x1806c2)},'json':!![]};return request(_0x578447)['then'](function(_0x5850f2){if(_0x5850f2[_0x49c4('0x20')]){return BPromise[_0x49c4('0x21')]({'id':_0x5850f2['result']['id']});}else{throw new Error(util[_0x49c4('0x22')](_0x49c4('0x23'),JSON[_0x49c4('0x1f')](_0x5850f2[_0x49c4('0x24')])));}})['catch'](function(_0x543ea2){var _0x449960=req['query'][_0x49c4('0x25')]?0x1f4:_0x543ea2[_0x49c4('0x26')]||0x1f4;logger[_0x49c4('0x24')](_0x49c4('0x27'),'createTicket',_0x449960,JSON[_0x49c4('0x1f')](_0x543ea2));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){logger[_0x49c4('0x28')](_0x49c4('0x29'),_0x46e04d);return request({'method':_0x49c4('0x2a'),'uri':util[_0x49c4('0x22')](_0x49c4('0x1b'),_0x2b2793[_0x49c4('0x2b')]),'qs':{'operation':_0x49c4('0x2c'),'username':'admin','sessionName':_0x4f28a2['sessionName'],'query':util['format'](_0x49c4('0x2d'),_0x46e04d)},'json':!![]})[_0x49c4('0x2e')](function(_0x1eb035){if(_0x1eb035[_0x49c4('0x20')]&&_0x1eb035[_0x49c4('0x2f')]['length']){logger[_0x49c4('0x28')](_0x49c4('0x30'));return BPromise[_0x49c4('0x21')]({'id':_0x1eb035[_0x49c4('0x2f')][0x0]['id'],'email':_0x1eb035['result'][0x0]['email1'],'name':_0x1eb035[_0x49c4('0x2f')][0x0][_0x49c4('0x31')]+'\x20'+_0x1eb035[_0x49c4('0x2f')][_0x49c4('0x32')]});}else{logger[_0x49c4('0x28')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x21')]({'id':_0x4f28a2[_0x49c4('0x33')],'email':_0x2b2793[_0x49c4('0x34')],'name':'admin'});}})['catch'](function(_0x85dce2){var _0x1991e9=req[_0x49c4('0x2c')][_0x49c4('0x25')]?0x1f4:_0x85dce2[_0x49c4('0x26')]||0x1f4;logger[_0x49c4('0x24')](_0x49c4('0x27'),_0x49c4('0x35'),_0x1991e9,JSON[_0x49c4('0x1f')](_0x85dce2));});}function getEndUser(_0x4e0209,_0x2d34ca,_0x5b96df,_0xdda586){logger[_0x49c4('0x28')](_0x49c4('0x36'),_0x5b96df);return request({'method':_0x49c4('0x2a'),'uri':util['format'](_0x49c4('0x1b'),_0x4e0209[_0x49c4('0x2b')]),'qs':{'operation':_0x49c4('0x2c'),'username':'admin','sessionName':_0xdda586[_0x49c4('0x1d')],'query':util[_0x49c4('0x22')](_0x49c4('0x37'),_0x5b96df,_0x5b96df,_0x5b96df,_0x5b96df,_0x5b96df)},'json':!![]})[_0x49c4('0x2e')](function(_0x1ba7a0){if(_0x1ba7a0[_0x49c4('0x20')]&&_0x1ba7a0[_0x49c4('0x2f')][_0x49c4('0x38')]){logger[_0x49c4('0x28')](_0x49c4('0x39'));return BPromise[_0x49c4('0x21')]({'id':_0x1ba7a0['result'][0x0]['id'],'name':_0x1ba7a0[_0x49c4('0x2f')][0x0][_0x49c4('0x3a')]+'\x20'+_0x1ba7a0[_0x49c4('0x2f')][0x0][_0x49c4('0x3b')],'phone':_0x5b96df});}else{logger[_0x49c4('0x28')](_0x49c4('0x3c'));return request({'method':_0x49c4('0x3d'),'uri':util[_0x49c4('0x22')](_0x49c4('0x1b'),_0x4e0209[_0x49c4('0x2b')]),'form':{'operation':_0x49c4('0x3e'),'sessionName':_0xdda586[_0x49c4('0x1d')],'elementType':_0x49c4('0x3f'),'element':JSON['stringify']({'lastname':_0x2d34ca,'phone':_0x5b96df,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x2e')](function(_0x49829e){logger[_0x49c4('0x28')](_0x49c4('0x40'));return BPromise[_0x49c4('0x21')]({'id':_0x49829e[_0x49c4('0x2f')]['id'],'name':_0x49829e[_0x49c4('0x2f')][_0x49c4('0x3b')],'phone':_0x49829e['result']['phone']});})[_0x49c4('0x41')](function(_0x1e7bdc){var _0x38349b=req[_0x49c4('0x2c')]['test']?0x1f4:_0x1e7bdc[_0x49c4('0x26')]||0x1f4;logger[_0x49c4('0x24')](_0x49c4('0x27'),_0x49c4('0x42'),_0x38349b,JSON[_0x49c4('0x1f')](_0x1e7bdc));});}});}function getConnection(_0x3bde49){var _0x1a9593=_0x3bde49[_0x49c4('0x34')];var _0x3c4a1d=_0x3bde49['accessKey'];return request({'method':_0x49c4('0x2a'),'uri':util['format'](_0x49c4('0x1b'),_0x3bde49[_0x49c4('0x2b')]),'qs':{'operation':_0x49c4('0x43'),'username':_0x1a9593},'json':!![]})[_0x49c4('0x2e')](function(_0x2d93d8){if(_0x2d93d8['success']){return request({'method':_0x49c4('0x3d'),'uri':util[_0x49c4('0x22')](_0x49c4('0x1b'),_0x3bde49[_0x49c4('0x2b')]),'form':{'operation':_0x49c4('0x44'),'username':_0x49c4('0x1c'),'accessKey':md5(_0x2d93d8[_0x49c4('0x2f')]['token']+_0x3c4a1d)},'json':!![]});}})[_0x49c4('0x2e')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x20')]){return BPromise[_0x49c4('0x21')](_0x5cfff9[_0x49c4('0x2f')]);}else{throw new Error(util[_0x49c4('0x22')](_0x49c4('0x45'),_0x3bde49['id']));}})[_0x49c4('0x41')](function(_0x2c6be1){var _0x506c71=req[_0x49c4('0x2c')][_0x49c4('0x25')]?0x1f4:_0x2c6be1['statusCode']||0x1f4;logger[_0x49c4('0x24')](_0x49c4('0x27'),_0x49c4('0x46'),_0x506c71,JSON[_0x49c4('0x1f')](_0x2c6be1));});}function request(_0x52a8f7){logger['info'](_0x49c4('0x47'),JSON['stringify'](_0x52a8f7));return rp(_0x52a8f7);}exports[_0x49c4('0x48')]=function(_0x1f941f,_0x3811b2,_0x23d500,_0x240c20,_0x286651,_0x394baa){var _0x563f0b,_0x1f26c2,_0x1550ce,_0x3936d3;_0x394baa[_0x49c4('0x2b')]=intUtil[_0x49c4('0x49')](_0x394baa[_0x49c4('0x2b')]);if(_0x286651&&_0x286651[_0x49c4('0x4a')]){logger[_0x49c4('0x28')](_0x49c4('0x4b'),_0x49c4('0x4c'));_0x3811b2['recordingURL']=util['format'](_0x49c4('0x4d'),_0x394baa[_0x49c4('0x4e')],_0x3811b2['uniqueid'],md5(_0x3811b2['uniqueid']));}else{_0x3811b2[_0x49c4('0x4f')]='';}return getConnection(_0x394baa)['then'](function(_0x54dda8){_0x3936d3=_0x54dda8;return getUser(_0x394baa,_0x240c20?_0x240c20[_0x49c4('0x50')]:'',_0x3936d3);})[_0x49c4('0x2e')](function(_0x4a0a93){_0x563f0b=_0x4a0a93;logger[_0x49c4('0x28')](_0x49c4('0x51'),_0x563f0b['id']);return getEndUser(_0x394baa,_0x3811b2[_0x49c4('0x52')],_0x3811b2[_0x49c4('0x53')],_0x3936d3);})['then'](function(_0x859dde){_0x1f26c2=_0x859dde;logger[_0x49c4('0x28')](_0x49c4('0x54'),_0x1f26c2['id']);return createTicket(_0x394baa,_0x563f0b,_0x1f26c2,_0x23d500,_0x3811b2,_0x23d500[_0x49c4('0x55')],_0x3936d3);})[_0x49c4('0x2e')](function(_0xa431d){_0x1550ce=_0xa431d;logger['info']('Ticket\x20created!');logger[_0x49c4('0x28')](_0x49c4('0x56'),_0x1550ce['id']);var _0x2a6308=util[_0x49c4('0x22')](_0x49c4('0x57'),_0x394baa[_0x49c4('0x2b')],_[_0x49c4('0x58')](_0x1550ce['id'],'x')[0x1]);logger['info'](_0x49c4('0x4b'),_0x49c4('0x59'));emit(util['format'](_0x49c4('0x5a'),_0x240c20['name']),_0x49c4('0x5b'),{'uri':_0x2a6308});})[_0x49c4('0x41')](function(_0x9eaa84){logger[_0x49c4('0x24')](_0x49c4('0x4b'),JSON[_0x49c4('0x1f')](_0x9eaa84));});};exports[_0x49c4('0x5c')]=function(_0x2f520f,_0x483770,_0x3894e0,_0x27b9c2,_0x59dc8d,_0x10dec7,_0x299e74){var _0x4fefbd,_0x39c455,_0x42e0e6,_0x4f50bf;_0x10dec7['remoteUri']=intUtil['stripTrailingSlash'](_0x10dec7['remoteUri']);_0x10dec7[_0x49c4('0x4e')]=intUtil['stripTrailingSlash'](_0x10dec7[_0x49c4('0x4e')]);if(_0x299e74&&_0x299e74[_0x49c4('0x5d')]&&_0x299e74['recordingFormat']!==_0x49c4('0x5e')){logger[_0x49c4('0x28')]('[OUTBOUND]',_0x49c4('0x4c'));_0x483770[_0x49c4('0x4f')]=util[_0x49c4('0x22')](_0x49c4('0x4d'),_0x10dec7['serverUrl'],_0x483770[_0x49c4('0x5f')],md5(_0x483770[_0x49c4('0x5f')]));}return getConnection(_0x10dec7)[_0x49c4('0x2e')](function(_0x20e97d){_0x4f50bf=_0x20e97d;return getUser(_0x10dec7,_0x27b9c2?_0x27b9c2['email']:'',_0x4f50bf);})[_0x49c4('0x2e')](function(_0x4a93bc){_0x4fefbd=_0x4a93bc;logger['info']('The\x20User\x20ID\x20is:',_0x4fefbd['id']);return getEndUser(_0x10dec7,_0x483770['destcalleridname'],_0x483770[_0x49c4('0x60')],_0x4f50bf);})[_0x49c4('0x2e')](function(_0x2ac7df){_0x39c455=_0x2ac7df;logger[_0x49c4('0x28')]('The\x20Enduser\x20ID\x20is:',_0x39c455['id']);return createTicket(_0x10dec7,_0x4fefbd,_0x39c455,_0x3894e0,_0x483770,_0x3894e0['Fields'],_0x4f50bf);})[_0x49c4('0x2e')](function(_0x109b81){_0x42e0e6=_0x109b81;logger[_0x49c4('0x28')](_0x49c4('0x61'));logger[_0x49c4('0x28')](_0x49c4('0x56'),_0x42e0e6['id']);var _0x3ba0d6=util[_0x49c4('0x22')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x10dec7[_0x49c4('0x2b')],_['split'](_0x42e0e6['id'],'x')[0x1]);logger[_0x49c4('0x28')](_0x49c4('0x62'),_0x49c4('0x59'));emit(util[_0x49c4('0x22')](_0x49c4('0x5a'),_0x27b9c2[_0x49c4('0x12')]),_0x49c4('0x5b'),{'uri':_0x3ba0d6});})[_0x49c4('0x41')](function(_0x13d951){logger[_0x49c4('0x24')](_0x49c4('0x62'),JSON[_0x49c4('0x1f')](_0x13d951));});};exports[_0x49c4('0x63')]=function(_0x14bd09,_0x2d5f63,_0x453cf2,_0x371e49,_0x3485c0,_0x4e1544){var _0x5ec201,_0x10f2ec,_0x16b3e8,_0x4af680;_0x4e1544[_0x49c4('0x2b')]=intUtil[_0x49c4('0x49')](_0x4e1544[_0x49c4('0x2b')]);_0x4e1544[_0x49c4('0x4e')]=intUtil['stripTrailingSlash'](_0x4e1544['serverUrl']);if(_0x3485c0&&_0x3485c0['monitor_format']){logger[_0x49c4('0x28')](_0x49c4('0x64'),_0x49c4('0x4c'));_0x2d5f63[_0x49c4('0x4f')]=util[_0x49c4('0x22')](_0x49c4('0x4d'),_0x4e1544[_0x49c4('0x4e')],_0x2d5f63[_0x49c4('0x5f')],md5(_0x2d5f63[_0x49c4('0x5f')]));}else{_0x2d5f63['recordingURL']='';}return getConnection(_0x4e1544)[_0x49c4('0x2e')](function(_0x10fb84){_0x4af680=_0x10fb84;return getUser(_0x4e1544,_0x371e49?_0x371e49[_0x49c4('0x50')]:'',_0x4af680);})['then'](function(_0x4448b9){_0x5ec201=_0x4448b9;logger[_0x49c4('0x28')](_0x49c4('0x51'),_0x5ec201['id']);return getEndUser(_0x4e1544,_0x2d5f63[_0x49c4('0x52')],_0x2d5f63[_0x49c4('0x53')],_0x4af680);})[_0x49c4('0x2e')](function(_0x35fa39){_0x10f2ec=_0x35fa39;logger[_0x49c4('0x28')]('The\x20Enduser\x20ID\x20is:',_0x10f2ec['id']);return createTicket(_0x4e1544,_0x5ec201,_0x10f2ec,_0x453cf2,_0x2d5f63,_0x453cf2[_0x49c4('0x55')],_0x4af680);})[_0x49c4('0x2e')](function(_0x85540f){_0x16b3e8=_0x85540f;logger[_0x49c4('0x28')](_0x49c4('0x61'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x16b3e8['id']);})[_0x49c4('0x41')](function(_0x59aa67){logger[_0x49c4('0x24')]('[ABANDONED]',JSON[_0x49c4('0x1f')](_0x59aa67));});}; \ No newline at end of file +var _0x0713=['result','error','catch','query','test','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','GET','admin','info','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','getUser','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','create','phone','accessKey','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','serverUrl','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[ABANDONED]','Recording\x20is\x20enabled!','bluebird','md5','util','ioredis','./util','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','type','idField','content','toString','variableName','Variable','name','toLowerCase','Creating\x20new\x20ticket...','merge','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','remoteUri','sessionName','HelpDesk','stringify','then','success','resolve'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x3071('0x0'));var md5=require(_0x3071('0x1'));var util=require(_0x3071('0x2'));var Redis=require(_0x3071('0x3'));var intUtil=require(_0x3071('0x4'));var config=require('../../../../config/environment');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));config[_0x3071('0x7')]=_[_0x3071('0x8')](config[_0x3071('0x7')],{'host':_0x3071('0x9'),'port':0x18eb});var io=require(_0x3071('0xa'))(new Redis(config[_0x3071('0x7')]));function emit(_0xbd737f,_0x22274c,_0x3e9a5e){io['to'](_0xbd737f)[_0x3071('0xb')](_0x22274c,_0x3e9a5e);}function getCustomFields(_0x1a868e,_0x4a36ec){var _0x3457cd={};if(_0x1a868e[_0x3071('0xc')]>0x0){_[_0x3071('0xd')](_0x1a868e,function(_0xff9a29){if(_0xff9a29[_0x3071('0xe')]==='string'&&_0xff9a29[_0x3071('0xf')]){_0x3457cd[_0xff9a29[_0x3071('0xf')]]=_0xff9a29[_0x3071('0x10')][_0x3071('0x11')]();}else if(_0xff9a29[_0x3071('0xe')]==='variable'&&_0xff9a29['variableName']&&_0xff9a29[_0x3071('0xf')]&&_0x4a36ec[_0xff9a29['variableName']]){_0x3457cd[_0xff9a29[_0x3071('0xf')]]=_0x4a36ec[_0xff9a29[_0x3071('0x12')]]['toString']();}else if(_0xff9a29[_0x3071('0xe')]==='customVariable'&&_0xff9a29[_0x3071('0x13')]&&_0xff9a29[_0x3071('0x13')][_0x3071('0x14')]&&_0xff9a29[_0x3071('0xf')]&&_0x4a36ec[_0xff9a29[_0x3071('0x13')][_0x3071('0x14')][_0x3071('0x15')]()]){_0x3457cd[_0xff9a29[_0x3071('0xf')]]=_0x4a36ec[_0xff9a29[_0x3071('0x13')][_0x3071('0x14')]['toLowerCase']()][_0x3071('0x11')]();}});}return _0x3457cd;}function createTicket(_0x17dbda,_0x1068d9,_0x108a83,_0x3acf0e,_0x17aee2,_0x105bbb,_0x26f113){logger['info'](_0x3071('0x16'));var _0x2bfa33=_[_0x3071('0x17')]({'parent_id':'','assigned_user_id':_0x1068d9['id'],'ticketpriorities':'Normal','ticketstatus':_0x3071('0x18'),'ticket_title':intUtil['getString'](_0x3acf0e[_0x3071('0x19')],_0x17aee2,'\x20'),'description':intUtil[_0x3071('0x1a')](_0x3acf0e[_0x3071('0x1b')],_0x17aee2,'\x0a'),'contact_id':_0x108a83['id']},getCustomFields(_0x105bbb,_0x17aee2));var _0x457b57={'method':_0x3071('0x1c'),'uri':util[_0x3071('0x1d')](_0x3071('0x1e'),_0x17dbda[_0x3071('0x1f')]),'form':{'operation':'create','username':'admin','sessionName':_0x26f113[_0x3071('0x20')],'elementType':_0x3071('0x21'),'element':JSON[_0x3071('0x22')](_0x2bfa33)},'json':!![]};return request(_0x457b57)[_0x3071('0x23')](function(_0x2793ef){if(_0x2793ef[_0x3071('0x24')]){return BPromise[_0x3071('0x25')]({'id':_0x2793ef[_0x3071('0x26')]['id']});}else{throw new Error(util[_0x3071('0x1d')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x3071('0x22')](_0x2793ef[_0x3071('0x27')])));}})[_0x3071('0x28')](function(_0x4d5c4b){var _0x4fb1ca=req[_0x3071('0x29')][_0x3071('0x2a')]?0x1f4:_0x4d5c4b[_0x3071('0x2b')]||0x1f4;logger[_0x3071('0x27')](_0x3071('0x2c'),_0x3071('0x2d'),_0x4fb1ca,JSON[_0x3071('0x22')](_0x4d5c4b));});}function getUser(_0x32f1b4,_0x292205,_0x254fc8){logger['info']('Getting\x20agent\x20with\x20email',_0x292205);return request({'method':_0x3071('0x2e'),'uri':util[_0x3071('0x1d')](_0x3071('0x1e'),_0x32f1b4[_0x3071('0x1f')]),'qs':{'operation':_0x3071('0x29'),'username':_0x3071('0x2f'),'sessionName':_0x254fc8[_0x3071('0x20')],'query':util[_0x3071('0x1d')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x292205)},'json':!![]})['then'](function(_0x4ab983){if(_0x4ab983[_0x3071('0x24')]&&_0x4ab983[_0x3071('0x26')]['length']){logger[_0x3071('0x30')](_0x3071('0x31'));return BPromise[_0x3071('0x25')]({'id':_0x4ab983[_0x3071('0x26')][0x0]['id'],'email':_0x4ab983['result'][0x0][_0x3071('0x32')],'name':_0x4ab983[_0x3071('0x26')][0x0][_0x3071('0x33')]+'\x20'+_0x4ab983[_0x3071('0x26')][_0x3071('0x34')]});}else{logger[_0x3071('0x30')](_0x3071('0x35'));return BPromise[_0x3071('0x25')]({'id':_0x254fc8['userId'],'email':_0x32f1b4[_0x3071('0x36')],'name':'admin'});}})['catch'](function(_0x1a1a64){var _0xa3a7ae=req['query'][_0x3071('0x2a')]?0x1f4:_0x1a1a64[_0x3071('0x2b')]||0x1f4;logger[_0x3071('0x27')](_0x3071('0x2c'),_0x3071('0x37'),_0xa3a7ae,JSON[_0x3071('0x22')](_0x1a1a64));});}function getEndUser(_0x5610ab,_0x36afdc,_0xd7971f,_0x4ce6d4){logger[_0x3071('0x30')]('Searching\x20end\x20user\x20with\x20phone',_0xd7971f);return request({'method':_0x3071('0x2e'),'uri':util[_0x3071('0x1d')]('%s/webservice.php',_0x5610ab['remoteUri']),'qs':{'operation':_0x3071('0x29'),'username':_0x3071('0x2f'),'sessionName':_0x4ce6d4[_0x3071('0x20')],'query':util['format'](_0x3071('0x38'),_0xd7971f,_0xd7971f,_0xd7971f,_0xd7971f,_0xd7971f)},'json':!![]})['then'](function(_0x1ac90a){if(_0x1ac90a['success']&&_0x1ac90a[_0x3071('0x26')][_0x3071('0xc')]){logger[_0x3071('0x30')](_0x3071('0x39'));return BPromise[_0x3071('0x25')]({'id':_0x1ac90a['result'][0x0]['id'],'name':_0x1ac90a['result'][0x0][_0x3071('0x3a')]+'\x20'+_0x1ac90a[_0x3071('0x26')][0x0][_0x3071('0x3b')],'phone':_0xd7971f});}else{logger[_0x3071('0x30')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0x3071('0x1c'),'uri':util[_0x3071('0x1d')](_0x3071('0x1e'),_0x5610ab[_0x3071('0x1f')]),'form':{'operation':_0x3071('0x3c'),'sessionName':_0x4ce6d4[_0x3071('0x20')],'elementType':'Contacts','element':JSON[_0x3071('0x22')]({'lastname':_0x36afdc,'phone':_0xd7971f,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x4c8b1f){logger['info']('Enduser\x20created.');return BPromise[_0x3071('0x25')]({'id':_0x4c8b1f[_0x3071('0x26')]['id'],'name':_0x4c8b1f[_0x3071('0x26')][_0x3071('0x3b')],'phone':_0x4c8b1f[_0x3071('0x26')][_0x3071('0x3d')]});})[_0x3071('0x28')](function(_0x2e6c70){var _0x56589e=req[_0x3071('0x29')][_0x3071('0x2a')]?0x1f4:_0x2e6c70[_0x3071('0x2b')]||0x1f4;logger[_0x3071('0x27')](_0x3071('0x2c'),'getEndUser',_0x56589e,JSON['stringify'](_0x2e6c70));});}});}function getConnection(_0x1721d0){var _0x3c2f5e=_0x1721d0[_0x3071('0x36')];var _0x5c5865=_0x1721d0[_0x3071('0x3e')];return request({'method':'GET','uri':util[_0x3071('0x1d')]('%s/webservice.php',_0x1721d0[_0x3071('0x1f')]),'qs':{'operation':'getchallenge','username':_0x3c2f5e},'json':!![]})['then'](function(_0x874522){if(_0x874522['success']){return request({'method':_0x3071('0x1c'),'uri':util['format'](_0x3071('0x1e'),_0x1721d0[_0x3071('0x1f')]),'form':{'operation':_0x3071('0x3f'),'username':_0x3071('0x2f'),'accessKey':md5(_0x874522['result'][_0x3071('0x40')]+_0x5c5865)},'json':!![]});}})['then'](function(_0xd273ec){if(_0xd273ec['success']){return BPromise[_0x3071('0x25')](_0xd273ec[_0x3071('0x26')]);}else{throw new Error(util['format'](_0x3071('0x41'),_0x1721d0['id']));}})[_0x3071('0x28')](function(_0x224a70){var _0x38bcc2=req[_0x3071('0x29')][_0x3071('0x2a')]?0x1f4:_0x224a70[_0x3071('0x2b')]||0x1f4;logger['error'](_0x3071('0x2c'),_0x3071('0x42'),_0x38bcc2,JSON[_0x3071('0x22')](_0x224a70));});}function request(_0xda07a4){logger['info'](_0x3071('0x43'),JSON[_0x3071('0x22')](_0xda07a4));return rp(_0xda07a4);}exports[_0x3071('0x44')]=function(_0x2307dd,_0x22aade,_0x26c8e4,_0x3ab6d4,_0x390944,_0xbf014e){var _0x886f7,_0x4371e7,_0x111115,_0x24977b;_0xbf014e[_0x3071('0x1f')]=intUtil[_0x3071('0x45')](_0xbf014e[_0x3071('0x1f')]);if(_0x390944&&_0x390944['monitor_format']){logger['info'](_0x3071('0x46'),'Recording\x20is\x20enabled!');_0x22aade[_0x3071('0x47')]=util[_0x3071('0x1d')](_0x3071('0x48'),_0xbf014e['serverUrl'],_0x22aade[_0x3071('0x49')],md5(_0x22aade[_0x3071('0x49')]));}else{_0x22aade['recordingURL']='';}return getConnection(_0xbf014e)['then'](function(_0x1b89ea){_0x24977b=_0x1b89ea;return getUser(_0xbf014e,_0x3ab6d4?_0x3ab6d4[_0x3071('0x4a')]:'',_0x24977b);})[_0x3071('0x23')](function(_0x3206c3){_0x886f7=_0x3206c3;logger['info'](_0x3071('0x4b'),_0x886f7['id']);return getEndUser(_0xbf014e,_0x22aade[_0x3071('0x4c')],_0x22aade[_0x3071('0x4d')],_0x24977b);})[_0x3071('0x23')](function(_0x123323){_0x4371e7=_0x123323;logger['info'](_0x3071('0x4e'),_0x4371e7['id']);return createTicket(_0xbf014e,_0x886f7,_0x4371e7,_0x26c8e4,_0x22aade,_0x26c8e4[_0x3071('0x4f')],_0x24977b);})[_0x3071('0x23')](function(_0x27bad1){_0x111115=_0x27bad1;logger[_0x3071('0x30')](_0x3071('0x50'));logger[_0x3071('0x30')]('The\x20Ticket\x20ID\x20is:',_0x111115['id']);var _0x4d6ed0=util[_0x3071('0x1d')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0xbf014e[_0x3071('0x1f')],_[_0x3071('0x51')](_0x111115['id'],'x')[0x1]);logger['info'](_0x3071('0x46'),_0x3071('0x52'));emit(util['format'](_0x3071('0x53'),_0x3ab6d4[_0x3071('0x14')]),_0x3071('0x54'),{'uri':_0x4d6ed0});})[_0x3071('0x28')](function(_0x2aaccb){logger['error'](_0x3071('0x46'),JSON[_0x3071('0x22')](_0x2aaccb));});};exports[_0x3071('0x55')]=function(_0x48ee42,_0x1b0f81,_0x238fa9,_0x291e28,_0x25680e,_0x379723,_0x210123){var _0xe93f28,_0x2e39ff,_0x3b47e8,_0x5cb3b3;_0x379723[_0x3071('0x1f')]=intUtil[_0x3071('0x45')](_0x379723[_0x3071('0x1f')]);_0x379723[_0x3071('0x56')]=intUtil[_0x3071('0x45')](_0x379723[_0x3071('0x56')]);if(_0x210123&&_0x210123[_0x3071('0x57')]&&_0x210123[_0x3071('0x57')]!==_0x3071('0x58')){logger[_0x3071('0x30')](_0x3071('0x59'),'Recording\x20is\x20enabled!');_0x1b0f81[_0x3071('0x47')]=util[_0x3071('0x1d')](_0x3071('0x48'),_0x379723[_0x3071('0x56')],_0x1b0f81[_0x3071('0x49')],md5(_0x1b0f81[_0x3071('0x49')]));}return getConnection(_0x379723)[_0x3071('0x23')](function(_0xd77655){_0x5cb3b3=_0xd77655;return getUser(_0x379723,_0x291e28?_0x291e28['email']:'',_0x5cb3b3);})[_0x3071('0x23')](function(_0x1ebd77){_0xe93f28=_0x1ebd77;logger['info']('The\x20User\x20ID\x20is:',_0xe93f28['id']);return getEndUser(_0x379723,_0x1b0f81[_0x3071('0x5a')],_0x1b0f81[_0x3071('0x5b')],_0x5cb3b3);})[_0x3071('0x23')](function(_0x38bc1f){_0x2e39ff=_0x38bc1f;logger['info']('The\x20Enduser\x20ID\x20is:',_0x2e39ff['id']);return createTicket(_0x379723,_0xe93f28,_0x2e39ff,_0x238fa9,_0x1b0f81,_0x238fa9[_0x3071('0x4f')],_0x5cb3b3);})['then'](function(_0x518bb5){_0x3b47e8=_0x518bb5;logger['info']('Ticket\x20created!');logger[_0x3071('0x30')](_0x3071('0x5c'),_0x3b47e8['id']);var _0xd928e8=util['format'](_0x3071('0x5d'),_0x379723[_0x3071('0x1f')],_[_0x3071('0x51')](_0x3b47e8['id'],'x')[0x1]);logger[_0x3071('0x30')]('[OUTBOUND]',_0x3071('0x52'));emit(util[_0x3071('0x1d')]('user:%s',_0x291e28[_0x3071('0x14')]),_0x3071('0x54'),{'uri':_0xd928e8});})[_0x3071('0x28')](function(_0x40c258){logger[_0x3071('0x27')](_0x3071('0x59'),JSON[_0x3071('0x22')](_0x40c258));});};exports['abandoned']=function(_0x5dde93,_0x21c1e3,_0x168025,_0x1456ce,_0x4bf839,_0x53ebfe){var _0x9f49f0,_0x3d91cf,_0x3bad84,_0x3e733c;_0x53ebfe[_0x3071('0x1f')]=intUtil[_0x3071('0x45')](_0x53ebfe[_0x3071('0x1f')]);_0x53ebfe[_0x3071('0x56')]=intUtil['stripTrailingSlash'](_0x53ebfe[_0x3071('0x56')]);if(_0x4bf839&&_0x4bf839['monitor_format']){logger[_0x3071('0x30')](_0x3071('0x5e'),_0x3071('0x5f'));_0x21c1e3[_0x3071('0x47')]=util[_0x3071('0x1d')](_0x3071('0x48'),_0x53ebfe[_0x3071('0x56')],_0x21c1e3[_0x3071('0x49')],md5(_0x21c1e3['uniqueid']));}else{_0x21c1e3[_0x3071('0x47')]='';}return getConnection(_0x53ebfe)[_0x3071('0x23')](function(_0x1da477){_0x3e733c=_0x1da477;return getUser(_0x53ebfe,_0x1456ce?_0x1456ce['email']:'',_0x3e733c);})[_0x3071('0x23')](function(_0x22ec7b){_0x9f49f0=_0x22ec7b;logger[_0x3071('0x30')]('The\x20User\x20ID\x20is:',_0x9f49f0['id']);return getEndUser(_0x53ebfe,_0x21c1e3['calleridname'],_0x21c1e3[_0x3071('0x4d')],_0x3e733c);})['then'](function(_0x288bfc){_0x3d91cf=_0x288bfc;logger[_0x3071('0x30')](_0x3071('0x4e'),_0x3d91cf['id']);return createTicket(_0x53ebfe,_0x9f49f0,_0x3d91cf,_0x168025,_0x21c1e3,_0x168025[_0x3071('0x4f')],_0x3e733c);})[_0x3071('0x23')](function(_0x437098){_0x3bad84=_0x437098;logger[_0x3071('0x30')]('Ticket\x20created!');logger[_0x3071('0x30')](_0x3071('0x5c'),_0x3bad84['id']);})[_0x3071('0x28')](function(_0x3cc937){logger[_0x3071('0x27')](_0x3071('0x5e'),JSON[_0x3071('0x22')](_0x3cc937));});}; \ 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 e3dcddd..97f883c 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 _0x1704=['none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','user:%s','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','abandoned','monitor_format','[ABANDONED]','calleridname','The\x20Ticket\x20ID\x20is:','lodash','request-promise','md5','ioredis','../../../../config/environment','zendesk','redis','localhost','socket.io-emitter','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','merge','Tags','name','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','info','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','filter','end-user','length','Enduser\x20found!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','type','string','customField','toLowerCase','content','idField','push','variable','variableName','custom_fields','Variable','queue','remoteUri','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','The\x20User\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','error','catch','inspect','outbound','recordingFormat'];(function(_0x47da2b,_0x2f0d65){var _0x147a1d=function(_0x2b1c0e){while(--_0x2b1c0e){_0x47da2b['push'](_0x47da2b['shift']());}};_0x147a1d(++_0x2f0d65);}(_0x1704,0x1b2));var _0x4170=function(_0x4577b8,_0x4b23b8){_0x4577b8=_0x4577b8-0x0;var _0x474a5b=_0x1704[_0x4577b8];return _0x474a5b;};'use strict';var _=require(_0x4170('0x0'));var rp=require(_0x4170('0x1'));var md5=require(_0x4170('0x2'));var util=require('util');var Redis=require(_0x4170('0x3'));var intUtil=require('./util');var config=require(_0x4170('0x4'));var logger=require('../../../../config/logger')(_0x4170('0x5'));config[_0x4170('0x6')]=_['defaults'](config[_0x4170('0x6')],{'host':_0x4170('0x7'),'port':0x18eb});var io=require(_0x4170('0x8'))(new Redis(config[_0x4170('0x6')]));function emit(_0x359969,_0x54d549,_0xa71189){io['to'](_0x359969)['emit'](_0x54d549,_0xa71189);}var headers={'Content-Type':_0x4170('0x9'),'Accept':'application/json'};function getTicket(_0x17c1cd,_0x1aaeae,_0x3c948c,_0x2e2bef,_0xadfade){logger['info'](_0x4170('0xa'));return request({'uri':util[_0x4170('0xb')](_0x4170('0xc'),_0x17c1cd['remoteUri']),'method':'POST','body':{'ticket':_[_0x4170('0xd')]({'requester_id':_0x3c948c['id'],'submitter_id':_0x1aaeae?_0x1aaeae['id']:undefined,'assignee_id':_0x1aaeae?_0x1aaeae['id']:undefined,'tags':getTags(_0x2e2bef[_0x4170('0xe')],_0x4170('0xf')),'subject':intUtil[_0x4170('0x10')](_0x2e2bef[_0x4170('0x11')],_0xadfade,'\x20'),'description':intUtil[_0x4170('0x10')](_0x2e2bef[_0x4170('0x12')],_0xadfade,'\x0a'),'comment':{'public':![],'body':intUtil[_0x4170('0x10')](_0x2e2bef[_0x4170('0x12')],_0xadfade,'\x0a')}},getCustomFields(_0x2e2bef['Fields'],_0xadfade))}})[_0x4170('0x13')](function(_0x5c195c){logger['info'](_0x4170('0x14'));return _0x5c195c[_0x4170('0x15')];});}function getUser(_0x3411a6,_0x130084){logger[_0x4170('0x16')](_0x4170('0x17'),_0x130084);return request({'uri':util[_0x4170('0xb')]('%s/search.json',_0x3411a6['remoteUri']),'qs':{'query':util[_0x4170('0xb')](_0x4170('0x18'),_0x130084)}})[_0x4170('0x13')](function(_0x1cfff7){if(_0x1cfff7[_0x4170('0x19')]){logger[_0x4170('0x16')](_0x4170('0x1a'));return _[_0x4170('0x1b')](_0x1cfff7[_0x4170('0x1c')],{'email':_0x130084,'role':_0x4170('0x1d')});}else{logger[_0x4170('0x16')](_0x4170('0x1e'));return request({'uri':util[_0x4170('0xb')](_0x4170('0x1f'),_0x3411a6['remoteUri'])})[_0x4170('0x13')](function(_0x273d33){logger['info'](_0x4170('0x20'));return _0x273d33[_0x4170('0x21')];});}});}function getEndUser(_0x38c5e7,_0x1f4258,_0x30bb11){logger['info'](_0x4170('0x22'),_0x30bb11);return request({'uri':util['format']('%s/search.json',_0x38c5e7['remoteUri']),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x30bb11)}})[_0x4170('0x13')](function(_0x17983b){var _0x548b02;if(_0x17983b[_0x4170('0x1c')]['length']){_0x17983b[_0x4170('0x1c')]=_[_0x4170('0x23')](_0x17983b[_0x4170('0x1c')],{'suspended':![],'role':_0x4170('0x24')});if(_0x17983b[_0x4170('0x1c')][_0x4170('0x25')]){_0x548b02=_['first'](_0x17983b[_0x4170('0x1c')]);}}if(_0x548b02){logger[_0x4170('0x16')](_0x4170('0x26'));return _0x548b02;}else{logger[_0x4170('0x16')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x4170('0xb')](_0x4170('0x27'),_0x38c5e7['remoteUri']),'method':_0x4170('0x28'),'body':{'user':{'role':_0x4170('0x24'),'name':util[_0x4170('0xb')](_0x4170('0x29'),_0x1f4258||_0x30bb11),'phone':_0x30bb11}}})[_0x4170('0x13')](function(_0x2a387b){logger[_0x4170('0x16')](_0x4170('0x2a'));return _0x2a387b[_0x4170('0x21')];});}});}function getAuth(_0x513f3e){var _0x3f9371;if(_0x513f3e[_0x4170('0x2b')]===_0x4170('0x2c')){_0x3f9371=util[_0x4170('0xb')](_0x4170('0x2d'),_0x513f3e[_0x4170('0x2e')],_0x513f3e[_0x4170('0x2c')]);}else if(_0x513f3e[_0x4170('0x2b')]===_0x4170('0x2f')){_0x3f9371=util[_0x4170('0xb')](_0x4170('0x30'),_0x513f3e[_0x4170('0x2e')],_0x513f3e['token']);}return util[_0x4170('0xb')](_0x4170('0x31'),new Buffer(_0x3f9371)[_0x4170('0x32')](_0x4170('0x33')));}function request(_0x5e3670){logger[_0x4170('0x34')](_0x4170('0x35'),JSON[_0x4170('0x36')](_0x5e3670));return rp(_['defaults'](_0x5e3670,{'method':_0x4170('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x540458,_0xcdfc93){var _0x110202=[];if(_0x540458&&_0x540458[_0x4170('0x25')]>0x0){_0x110202=_[_0x4170('0x38')](_0x540458,_0xcdfc93);}return _0x110202;}function getCustomFields(_0x265b22,_0x3c62ce){var _0x90569e=[];var _0x5effd7={'custom_fields':[]};if(_0x265b22['length']>0x0){_[_0x4170('0x39')](_0x265b22,function(_0x339b39){if(_0x339b39[_0x4170('0x3a')]===_0x4170('0x3b')&&_0x339b39['nameField']&&!_0x339b39[_0x4170('0x3c')]){_0x5effd7[_0x339b39['nameField'][_0x4170('0x3d')]()]=_0x339b39[_0x4170('0x3e')][_0x4170('0x32')]();}else if(_0x339b39[_0x4170('0x3a')]===_0x4170('0x3b')&&_0x339b39[_0x4170('0x3f')]&&_0x339b39[_0x4170('0x3c')]){_0x5effd7['custom_fields'][_0x4170('0x40')]({'id':_0x339b39[_0x4170('0x3f')],'value':_0x339b39[_0x4170('0x3e')][_0x4170('0x32')]()});}else if(_0x339b39[_0x4170('0x3a')]===_0x4170('0x41')&&_0x339b39[_0x4170('0x42')]&&_0x339b39[_0x4170('0x3f')]&&_0x339b39['customField']){_0x3c62ce[_0x339b39[_0x4170('0x42')]]&&_0x5effd7[_0x4170('0x43')][_0x4170('0x40')]({'id':_0x339b39[_0x4170('0x3f')],'value':_0x3c62ce[_0x339b39[_0x4170('0x42')]][_0x4170('0x32')]()});}else if(_0x339b39[_0x4170('0x3a')]==='customVariable'&&_0x339b39['Variable']&&_0x339b39[_0x4170('0x44')]['name']&&_0x339b39[_0x4170('0x3f')]&&_0x339b39['customField']){_0x3c62ce[_0x339b39['Variable']['name'][_0x4170('0x3d')]()]&&_0x5effd7[_0x4170('0x43')][_0x4170('0x40')]({'id':_0x339b39[_0x4170('0x3f')],'value':_0x3c62ce[_0x339b39[_0x4170('0x44')][_0x4170('0xf')][_0x4170('0x3d')]()]['toString']()});}});}return _0x5effd7;}exports[_0x4170('0x45')]=function(_0x522437,_0x1cfe4f,_0x173ec6,_0x13285f,_0x1af6fb,_0x4b7ca6){var _0x116858,_0x1cd342;_0x4b7ca6[_0x4170('0x46')]=intUtil[_0x4170('0x47')](_0x4b7ca6[_0x4170('0x46')]);_0x4b7ca6[_0x4170('0x48')]=intUtil['stripTrailingSlash'](_0x4b7ca6[_0x4170('0x48')]);if(_0x1af6fb&&_0x1af6fb['monitor_format']){logger[_0x4170('0x16')](_0x4170('0x49'),_0x4170('0x4a'));_0x1cfe4f[_0x4170('0x4b')]=util[_0x4170('0xb')](_0x4170('0x4c'),_0x4b7ca6[_0x4170('0x48')],_0x1cfe4f['uniqueid'],md5(_0x1cfe4f['uniqueid']));}else{_0x1cfe4f[_0x4170('0x4b')]='';}headers['Authorization']=getAuth(_0x4b7ca6);return getUser(_0x4b7ca6,_0x13285f[_0x4170('0x4d')])[_0x4170('0x13')](function(_0x2d7695){_0x116858=_0x2d7695;logger[_0x4170('0x16')](_0x4170('0x4e'),_0x116858['id']);return getEndUser(_0x4b7ca6,_0x1cfe4f['calleridname'],_0x1cfe4f['calleridnum']);})[_0x4170('0x13')](function(_0x1e1a4b){_0x1cd342=_0x1e1a4b;logger[_0x4170('0x16')]('The\x20Enduser\x20ID\x20is:',_0x1cd342['id']);return getTicket(_0x4b7ca6,_0x116858,_0x1cd342,_0x173ec6,_0x1cfe4f);})['then'](function(_0x5c3d30){if(_0x5c3d30){logger[_0x4170('0x16')]('The\x20Ticket\x20ID\x20is:',_0x5c3d30['id']);switch(_0x4b7ca6[_0x4170('0x3a')]){case _0x4170('0x4f'):logger[_0x4170('0x16')](_0x4170('0x49'),_0x4170('0x50'));return request({'uri':util['format'](_0x4170('0x51'),_0x4b7ca6[_0x4170('0x46')],_0x116858['id'],_0x5c3d30['id']),'method':_0x4170('0x28')});case _0x4170('0x52'):logger['info'](_0x4170('0x49'),_0x4170('0x53'));emit(util[_0x4170('0xb')]('user:%s',_0x13285f[_0x4170('0xf')]),_0x4170('0x54'),{'uri':util[_0x4170('0xb')](_0x4170('0x55'),_0x4b7ca6[_0x4170('0x46')],_0x5c3d30['id'])});break;default:logger[_0x4170('0x56')](_0x4170('0x49'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x4170('0x57')](function(_0x5c3d3b){logger[_0x4170('0x56')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x4170('0x58')](_0x5c3d3b,{'showHidden':!![],'depth':null}));});};exports[_0x4170('0x59')]=function(_0x26f569,_0x27a31f,_0x34e97e,_0x43ecd9,_0xff9b24,_0x3c93b5,_0x3751a8){var _0x4d7042,_0x16c991;_0x3c93b5['remoteUri']=intUtil[_0x4170('0x47')](_0x3c93b5['remoteUri']);_0x3c93b5[_0x4170('0x48')]=intUtil[_0x4170('0x47')](_0x3c93b5['serverUrl']);if(_0x3751a8&&_0x3751a8[_0x4170('0x5a')]&&_0x3751a8['recordingFormat']!==_0x4170('0x5b')){logger['info'](_0x4170('0x5c'),'Recording\x20is\x20enabled!');_0x27a31f[_0x4170('0x4b')]=util[_0x4170('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3c93b5[_0x4170('0x48')],_0x27a31f[_0x4170('0x5d')],md5(_0x27a31f[_0x4170('0x5d')]));}headers['Authorization']=getAuth(_0x3c93b5);return getUser(_0x3c93b5,_0x43ecd9[_0x4170('0x4d')])[_0x4170('0x13')](function(_0x629443){_0x4d7042=_0x629443;logger[_0x4170('0x16')](_0x4170('0x4e'),_0x4d7042['id']);return getEndUser(_0x3c93b5,_0x27a31f[_0x4170('0x5e')],_0x27a31f[_0x4170('0x5f')]);})[_0x4170('0x13')](function(_0x120242){_0x16c991=_0x120242;logger['info'](_0x4170('0x60'),_0x16c991['id']);return getTicket(_0x3c93b5,_0x4d7042,_0x16c991,_0x34e97e,_0x27a31f);})[_0x4170('0x13')](function(_0x5e59ca){if(_0x5e59ca){logger[_0x4170('0x16')]('The\x20Ticket\x20ID\x20is:',_0x5e59ca['id']);switch(_0x3c93b5[_0x4170('0x3a')]){case'integrationTab':logger[_0x4170('0x16')](_0x4170('0x5c'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x4170('0x51'),_0x3c93b5[_0x4170('0x46')],_0x4d7042['id'],_0x5e59ca['id']),'method':_0x4170('0x28')});case _0x4170('0x52'):logger[_0x4170('0x16')](_0x4170('0x5c'),_0x4170('0x53'));emit(util[_0x4170('0xb')](_0x4170('0x61'),_0x43ecd9[_0x4170('0xf')]),_0x4170('0x54'),{'uri':util[_0x4170('0xb')](_0x4170('0x55'),_0x3c93b5[_0x4170('0x46')],_0x5e59ca['id'])});break;default:logger[_0x4170('0x56')](_0x4170('0x5c'),_0x4170('0x62'));}}})['catch'](function(_0xd0b01b){logger[_0x4170('0x56')](_0x4170('0x63'),util[_0x4170('0x58')](_0xd0b01b,{'showHidden':!![],'depth':null}));});};exports[_0x4170('0x64')]=function(_0x1eaa74,_0x309ca0,_0x1bac92,_0x14c231,_0x491b0e,_0x437835){var _0x12b26e,_0xfd8049;_0x437835[_0x4170('0x46')]=intUtil[_0x4170('0x47')](_0x437835[_0x4170('0x46')]);_0x437835[_0x4170('0x48')]=intUtil['stripTrailingSlash'](_0x437835[_0x4170('0x48')]);if(_0x491b0e&&_0x491b0e[_0x4170('0x65')]){logger['info'](_0x4170('0x66'),_0x4170('0x4a'));_0x309ca0[_0x4170('0x4b')]=util[_0x4170('0xb')](_0x4170('0x4c'),_0x437835['serverUrl'],_0x309ca0[_0x4170('0x5d')],md5(_0x309ca0[_0x4170('0x5d')]));}else{_0x309ca0[_0x4170('0x4b')]='';}headers['Authorization']=getAuth(_0x437835);return getUser(_0x437835)[_0x4170('0x13')](function(_0x1694bb){_0x12b26e=_0x1694bb;logger[_0x4170('0x16')](_0x4170('0x4e'),_0x12b26e['id']);return getEndUser(_0x437835,_0x309ca0[_0x4170('0x67')],_0x309ca0['calleridnum']);})[_0x4170('0x13')](function(_0x451879){_0xfd8049=_0x451879;logger[_0x4170('0x16')](_0x4170('0x60'),_0xfd8049['id']);return getTicket(_0x437835,_0x12b26e,_0xfd8049,_0x1bac92,_0x309ca0);})[_0x4170('0x13')](function(_0x61d889){if(_0x61d889){logger[_0x4170('0x16')](_0x4170('0x68'),_0x61d889['id']);}})[_0x4170('0x57')](function(_0x2a4753){logger[_0x4170('0x56')]('[ABANDONED]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x2a4753,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xacd2=['trigger:browser:url','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','abandoned','[ABANDONED]','[ABANDONED]\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','name','Subjects','getString','Descriptions','Fields','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','then','count','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','%s/token:%s','token','Basic\x20%s','toString','debug','[HTTP]','stringify','GET','map','type','string','nameField','toLowerCase','content','idField','customField','custom_fields','push','variable','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum'];(function(_0x5d8e0a,_0x5b865c){var _0x393dc8=function(_0x49e2ca){while(--_0x49e2ca){_0x5d8e0a['push'](_0x5d8e0a['shift']());}};_0x393dc8(++_0x5b865c);}(_0xacd2,0xde));var _0x2acd=function(_0x4dcb4e,_0x51c91c){_0x4dcb4e=_0x4dcb4e-0x0;var _0x62da44=_0xacd2[_0x4dcb4e];return _0x62da44;};'use strict';var _=require(_0x2acd('0x0'));var rp=require(_0x2acd('0x1'));var md5=require('md5');var util=require(_0x2acd('0x2'));var Redis=require(_0x2acd('0x3'));var intUtil=require('./util');var config=require(_0x2acd('0x4'));var logger=require(_0x2acd('0x5'))(_0x2acd('0x6'));config[_0x2acd('0x7')]=_[_0x2acd('0x8')](config[_0x2acd('0x7')],{'host':_0x2acd('0x9'),'port':0x18eb});var io=require(_0x2acd('0xa'))(new Redis(config[_0x2acd('0x7')]));function emit(_0x465e7b,_0x5a4cfc,_0x3f4e41){io['to'](_0x465e7b)[_0x2acd('0xb')](_0x5a4cfc,_0x3f4e41);}var headers={'Content-Type':_0x2acd('0xc'),'Accept':_0x2acd('0xc')};function getTicket(_0x43a833,_0x29f531,_0x26f2cf,_0xe5e70b,_0x629d99){logger[_0x2acd('0xd')](_0x2acd('0xe'));return request({'uri':util[_0x2acd('0xf')](_0x2acd('0x10'),_0x43a833[_0x2acd('0x11')]),'method':_0x2acd('0x12'),'body':{'ticket':_[_0x2acd('0x13')]({'requester_id':_0x26f2cf['id'],'submitter_id':_0x29f531?_0x29f531['id']:undefined,'assignee_id':_0x29f531?_0x29f531['id']:undefined,'tags':getTags(_0xe5e70b['Tags'],_0x2acd('0x14')),'subject':intUtil['getString'](_0xe5e70b[_0x2acd('0x15')],_0x629d99,'\x20'),'description':intUtil[_0x2acd('0x16')](_0xe5e70b[_0x2acd('0x17')],_0x629d99,'\x0a'),'comment':{'public':![],'body':intUtil[_0x2acd('0x16')](_0xe5e70b[_0x2acd('0x17')],_0x629d99,'\x0a')}},getCustomFields(_0xe5e70b[_0x2acd('0x18')],_0x629d99))}})['then'](function(_0x25cb7f){logger[_0x2acd('0xd')]('Ticket\x20created!');return _0x25cb7f[_0x2acd('0x19')];});}function getUser(_0x226103,_0xb9fd59){logger[_0x2acd('0xd')](_0x2acd('0x1a'),_0xb9fd59);return request({'uri':util[_0x2acd('0xf')](_0x2acd('0x1b'),_0x226103['remoteUri']),'qs':{'query':util['format'](_0x2acd('0x1c'),_0xb9fd59)}})[_0x2acd('0x1d')](function(_0x569834){if(_0x569834[_0x2acd('0x1e')]){logger[_0x2acd('0xd')](_0x2acd('0x1f'));return _[_0x2acd('0x20')](_0x569834[_0x2acd('0x21')],{'email':_0xb9fd59,'role':'agent'});}else{logger[_0x2acd('0xd')](_0x2acd('0x22'));return request({'uri':util[_0x2acd('0xf')](_0x2acd('0x23'),_0x226103[_0x2acd('0x11')])})['then'](function(_0x1e719c){logger[_0x2acd('0xd')]('Admin\x20account\x20selected.');return _0x1e719c[_0x2acd('0x24')];});}});}function getEndUser(_0xfca052,_0x537504,_0x16f81d){logger[_0x2acd('0xd')](_0x2acd('0x25'),_0x16f81d);return request({'uri':util['format']('%s/search.json',_0xfca052['remoteUri']),'qs':{'query':util[_0x2acd('0xf')](_0x2acd('0x26'),_0x16f81d)}})['then'](function(_0x3d82e5){var _0x1c4d42;if(_0x3d82e5[_0x2acd('0x21')][_0x2acd('0x27')]){_0x3d82e5['results']=_[_0x2acd('0x28')](_0x3d82e5[_0x2acd('0x21')],{'suspended':![],'role':_0x2acd('0x29')});if(_0x3d82e5[_0x2acd('0x21')][_0x2acd('0x27')]){_0x1c4d42=_[_0x2acd('0x2a')](_0x3d82e5[_0x2acd('0x21')]);}}if(_0x1c4d42){logger['info'](_0x2acd('0x2b'));return _0x1c4d42;}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x2acd('0xf')]('%s/users.json',_0xfca052[_0x2acd('0x11')]),'method':'POST','body':{'user':{'role':_0x2acd('0x29'),'name':util[_0x2acd('0xf')](_0x2acd('0x2c'),_0x537504||_0x16f81d),'phone':_0x16f81d}}})[_0x2acd('0x1d')](function(_0x2290fe){logger[_0x2acd('0xd')](_0x2acd('0x2d'));return _0x2290fe[_0x2acd('0x24')];});}});}function getAuth(_0x16381a){var _0x59390b;if(_0x16381a[_0x2acd('0x2e')]===_0x2acd('0x2f')){_0x59390b=util[_0x2acd('0xf')](_0x2acd('0x30'),_0x16381a[_0x2acd('0x31')],_0x16381a['password']);}else if(_0x16381a[_0x2acd('0x2e')]==='token'){_0x59390b=util[_0x2acd('0xf')](_0x2acd('0x32'),_0x16381a[_0x2acd('0x31')],_0x16381a[_0x2acd('0x33')]);}return util['format'](_0x2acd('0x34'),new Buffer(_0x59390b)[_0x2acd('0x35')]('base64'));}function request(_0x36b055){logger[_0x2acd('0x36')](_0x2acd('0x37'),JSON[_0x2acd('0x38')](_0x36b055));return rp(_[_0x2acd('0x8')](_0x36b055,{'method':_0x2acd('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x216bac,_0x22c357){var _0x43d2a8=[];if(_0x216bac&&_0x216bac[_0x2acd('0x27')]>0x0){_0x43d2a8=_[_0x2acd('0x3a')](_0x216bac,_0x22c357);}return _0x43d2a8;}function getCustomFields(_0x5743d1,_0x305865){var _0x18fe77=[];var _0x343d49={'custom_fields':[]};if(_0x5743d1['length']>0x0){_['forEach'](_0x5743d1,function(_0x57cd4d){if(_0x57cd4d[_0x2acd('0x3b')]===_0x2acd('0x3c')&&_0x57cd4d[_0x2acd('0x3d')]&&!_0x57cd4d['customField']){_0x343d49[_0x57cd4d['nameField'][_0x2acd('0x3e')]()]=_0x57cd4d[_0x2acd('0x3f')][_0x2acd('0x35')]();}else if(_0x57cd4d['type']==='string'&&_0x57cd4d[_0x2acd('0x40')]&&_0x57cd4d[_0x2acd('0x41')]){_0x343d49[_0x2acd('0x42')][_0x2acd('0x43')]({'id':_0x57cd4d[_0x2acd('0x40')],'value':_0x57cd4d[_0x2acd('0x3f')]['toString']()});}else if(_0x57cd4d[_0x2acd('0x3b')]===_0x2acd('0x44')&&_0x57cd4d[_0x2acd('0x45')]&&_0x57cd4d[_0x2acd('0x40')]&&_0x57cd4d[_0x2acd('0x41')]){_0x305865[_0x57cd4d[_0x2acd('0x45')]]&&_0x343d49[_0x2acd('0x42')][_0x2acd('0x43')]({'id':_0x57cd4d[_0x2acd('0x40')],'value':_0x305865[_0x57cd4d[_0x2acd('0x45')]][_0x2acd('0x35')]()});}else if(_0x57cd4d[_0x2acd('0x3b')]===_0x2acd('0x46')&&_0x57cd4d[_0x2acd('0x47')]&&_0x57cd4d[_0x2acd('0x47')]['name']&&_0x57cd4d[_0x2acd('0x40')]&&_0x57cd4d[_0x2acd('0x41')]){_0x305865[_0x57cd4d[_0x2acd('0x47')][_0x2acd('0x14')][_0x2acd('0x3e')]()]&&_0x343d49['custom_fields']['push']({'id':_0x57cd4d[_0x2acd('0x40')],'value':_0x305865[_0x57cd4d['Variable'][_0x2acd('0x14')][_0x2acd('0x3e')]()][_0x2acd('0x35')]()});}});}return _0x343d49;}exports['queue']=function(_0x57a075,_0x207cf4,_0x566f86,_0x2b9cfe,_0x141fd7,_0x2c4bb4){var _0x1684b8,_0x557967;_0x2c4bb4['remoteUri']=intUtil[_0x2acd('0x48')](_0x2c4bb4[_0x2acd('0x11')]);_0x2c4bb4[_0x2acd('0x49')]=intUtil[_0x2acd('0x48')](_0x2c4bb4[_0x2acd('0x49')]);if(_0x141fd7&&_0x141fd7[_0x2acd('0x4a')]){logger[_0x2acd('0xd')]('[QUEUE]',_0x2acd('0x4b'));_0x207cf4[_0x2acd('0x4c')]=util[_0x2acd('0xf')](_0x2acd('0x4d'),_0x2c4bb4[_0x2acd('0x49')],_0x207cf4[_0x2acd('0x4e')],md5(_0x207cf4['uniqueid']));}else{_0x207cf4[_0x2acd('0x4c')]='';}headers[_0x2acd('0x4f')]=getAuth(_0x2c4bb4);return getUser(_0x2c4bb4,_0x2b9cfe[_0x2acd('0x50')])[_0x2acd('0x1d')](function(_0x17838f){_0x1684b8=_0x17838f;logger['info'](_0x2acd('0x51'),_0x1684b8['id']);return getEndUser(_0x2c4bb4,_0x207cf4['calleridname'],_0x207cf4[_0x2acd('0x52')]);})[_0x2acd('0x1d')](function(_0x3d6ec6){_0x557967=_0x3d6ec6;logger[_0x2acd('0xd')](_0x2acd('0x53'),_0x557967['id']);return getTicket(_0x2c4bb4,_0x1684b8,_0x557967,_0x566f86,_0x207cf4);})[_0x2acd('0x1d')](function(_0x131bba){if(_0x131bba){logger['info'](_0x2acd('0x54'),_0x131bba['id']);switch(_0x2c4bb4[_0x2acd('0x3b')]){case'integrationTab':logger[_0x2acd('0xd')](_0x2acd('0x55'),_0x2acd('0x56'));return request({'uri':util[_0x2acd('0xf')](_0x2acd('0x57'),_0x2c4bb4['remoteUri'],_0x1684b8['id'],_0x131bba['id']),'method':_0x2acd('0x12')});case _0x2acd('0x58'):logger[_0x2acd('0xd')](_0x2acd('0x55'),_0x2acd('0x59'));emit(util[_0x2acd('0xf')](_0x2acd('0x5a'),_0x2b9cfe['name']),'trigger:browser:url',{'uri':util['format'](_0x2acd('0x5b'),_0x2c4bb4[_0x2acd('0x11')],_0x131bba['id'])});break;default:logger[_0x2acd('0x5c')](_0x2acd('0x55'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x2acd('0x5d')](function(_0x1893a1){logger[_0x2acd('0x5c')](_0x2acd('0x5e'),util[_0x2acd('0x5f')](_0x1893a1,{'showHidden':!![],'depth':null}));});};exports[_0x2acd('0x60')]=function(_0xf97579,_0x26c367,_0x33e081,_0x2b42e4,_0x1cac78,_0x12c66d,_0x599540){var _0x108ad6,_0x102a59;_0x12c66d[_0x2acd('0x11')]=intUtil[_0x2acd('0x48')](_0x12c66d[_0x2acd('0x11')]);_0x12c66d['serverUrl']=intUtil['stripTrailingSlash'](_0x12c66d[_0x2acd('0x49')]);if(_0x599540&&_0x599540[_0x2acd('0x61')]&&_0x599540[_0x2acd('0x61')]!==_0x2acd('0x62')){logger['info'](_0x2acd('0x63'),_0x2acd('0x4b'));_0x26c367['recordingURL']=util[_0x2acd('0xf')](_0x2acd('0x4d'),_0x12c66d['serverUrl'],_0x26c367[_0x2acd('0x4e')],md5(_0x26c367[_0x2acd('0x4e')]));}headers[_0x2acd('0x4f')]=getAuth(_0x12c66d);return getUser(_0x12c66d,_0x2b42e4[_0x2acd('0x50')])[_0x2acd('0x1d')](function(_0x2d6114){_0x108ad6=_0x2d6114;logger[_0x2acd('0xd')]('The\x20User\x20ID\x20is:',_0x108ad6['id']);return getEndUser(_0x12c66d,_0x26c367[_0x2acd('0x64')],_0x26c367[_0x2acd('0x65')]);})[_0x2acd('0x1d')](function(_0x50d449){_0x102a59=_0x50d449;logger[_0x2acd('0xd')]('The\x20Enduser\x20ID\x20is:',_0x102a59['id']);return getTicket(_0x12c66d,_0x108ad6,_0x102a59,_0x33e081,_0x26c367);})[_0x2acd('0x1d')](function(_0x2c1537){if(_0x2c1537){logger[_0x2acd('0xd')]('The\x20Ticket\x20ID\x20is:',_0x2c1537['id']);switch(_0x12c66d['type']){case'integrationTab':logger[_0x2acd('0xd')](_0x2acd('0x63'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x2acd('0x57'),_0x12c66d[_0x2acd('0x11')],_0x108ad6['id'],_0x2c1537['id']),'method':'POST'});case _0x2acd('0x58'):logger[_0x2acd('0xd')](_0x2acd('0x63'),_0x2acd('0x59'));emit(util[_0x2acd('0xf')]('user:%s',_0x2b42e4[_0x2acd('0x14')]),_0x2acd('0x66'),{'uri':util[_0x2acd('0xf')](_0x2acd('0x5b'),_0x12c66d[_0x2acd('0x11')],_0x2c1537['id'])});break;default:logger[_0x2acd('0x5c')](_0x2acd('0x63'),_0x2acd('0x67'));}}})[_0x2acd('0x5d')](function(_0x5077c6){logger[_0x2acd('0x5c')](_0x2acd('0x68'),util['inspect'](_0x5077c6,{'showHidden':!![],'depth':null}));});};exports[_0x2acd('0x69')]=function(_0x1d60ce,_0x27cb46,_0x40a787,_0x24d62c,_0x28a1fd,_0x2e5f5a){var _0x35dce3,_0x2989d5;_0x2e5f5a[_0x2acd('0x11')]=intUtil[_0x2acd('0x48')](_0x2e5f5a['remoteUri']);_0x2e5f5a[_0x2acd('0x49')]=intUtil[_0x2acd('0x48')](_0x2e5f5a[_0x2acd('0x49')]);if(_0x28a1fd&&_0x28a1fd['monitor_format']){logger['info'](_0x2acd('0x6a'),'Recording\x20is\x20enabled!');_0x27cb46['recordingURL']=util[_0x2acd('0xf')](_0x2acd('0x4d'),_0x2e5f5a[_0x2acd('0x49')],_0x27cb46[_0x2acd('0x4e')],md5(_0x27cb46[_0x2acd('0x4e')]));}else{_0x27cb46[_0x2acd('0x4c')]='';}headers[_0x2acd('0x4f')]=getAuth(_0x2e5f5a);return getUser(_0x2e5f5a)[_0x2acd('0x1d')](function(_0x1df5bf){_0x35dce3=_0x1df5bf;logger[_0x2acd('0xd')](_0x2acd('0x51'),_0x35dce3['id']);return getEndUser(_0x2e5f5a,_0x27cb46['calleridname'],_0x27cb46['calleridnum']);})[_0x2acd('0x1d')](function(_0x2a405a){_0x2989d5=_0x2a405a;logger[_0x2acd('0xd')](_0x2acd('0x53'),_0x2989d5['id']);return getTicket(_0x2e5f5a,_0x35dce3,_0x2989d5,_0x40a787,_0x27cb46);})[_0x2acd('0x1d')](function(_0x100af9){if(_0x100af9){logger[_0x2acd('0xd')]('The\x20Ticket\x20ID\x20is:',_0x100af9['id']);}})[_0x2acd('0x5d')](function(_0x2c5cc3){logger[_0x2acd('0x5c')](_0x2acd('0x6b'),util[_0x2acd('0x5f')](_0x2c5cc3,{'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 18d63bc..5449e6e 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 _0x326f=['Abandoned','talktime','endtime','CONTACTID','LEADID','SEMODULE','Leads','','hasOwnProperty','%s','encodeXML','','POST','host','then','parse','response','result','recorddetail','info','Call\x20created!','Error\x20on\x20call\x20creation:\x20','stringify','Getting\x20agent\x20with\x20email','https://crm.%s/crm/private/json/Users/getUsers','crmapi','users','user','find','Standard','Agent\x20found!','Using\x20the\x20admin\x20account!','error','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','Searching\x20enduser\x20with\x20phone','GET','https://crm.%s/crm/private/json/Contacts/searchRecords','authToken','((Phone:%s))','Enduser\x20found\x20in\x20Contacts!','Contacts','row','length','val','content','Enduser\x20found\x20in\x20Leads!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','https://crm.%s/crm/private/xml/Leads/insertRecords','toJson','Enduser\x20created.','Error\x20on\x20Lead\x20creation:\x20','Error\x20on\x20Lead\x20retrieve:\x20','debug','type','idField','toString','variable','variableName','Variable','name','toLowerCase','indexOf','split','queue','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://crm.%s/crm/EntityInfo.do?module=Calls&id=%s','catch','recordingFormat','[OUTBOUND]','uniqueid','The\x20User\x20ID\x20is:','destcalleridnum','Outbound','user:%s','trigger:browser:url','monitor_format','[ABANDONED]','The\x20Call\x20ID\x20is:','lodash','util','./util','xml2json','entities','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20call...','merge','inbound','starttime','agentcalledAt','format','YYYY-MM-DD\x20HH:mm:ss','Subjects','Fields','lastevent','called','Call\x20Result','Called','complete','connect','rejected','Rejected','abandoned'];(function(_0x5563ff,_0x3f584a){var _0x4efaa4=function(_0x57370f){while(--_0x57370f){_0x5563ff['push'](_0x5563ff['shift']());}};_0x4efaa4(++_0x3f584a);}(_0x326f,0xd1));var _0xf326=function(_0x3537db,_0x1b4c98){_0x3537db=_0x3537db-0x0;var _0x1baf3e=_0x326f[_0x3537db];return _0x1baf3e;};'use strict';var _=require(_0xf326('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xf326('0x1'));var intUtil=require(_0xf326('0x2'));var parser=require(_0xf326('0x3'));var entities=require(_0xf326('0x4'));var moment=require(_0xf326('0x5'));var Redis=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var logger=require(_0xf326('0x8'))(_0xf326('0x9'));config[_0xf326('0xa')]=_['defaults'](config[_0xf326('0xa')],{'host':_0xf326('0xb'),'port':0x18eb});var io=require(_0xf326('0xc'))(new Redis(config[_0xf326('0xa')]));function emit(_0x515bfa,_0x4c206c,_0x592975){io['to'](_0x515bfa)[_0xf326('0xd')](_0x4c206c,_0x592975);}var headers={'Content-Type':_0xf326('0xe'),'Accept':_0xf326('0xe')};function getCall(_0x2686e1,_0x1f3a33,_0x5db9d7,_0x136e2d,_0x53cbcd,_0x1cf441){logger['info'](_0xf326('0xf'));var _0x518ab5=_[_0xf326('0x10')]({'SMOWNERID':_0x1f3a33['id'],'Call Type':_0x1cf441||_0xf326('0x11'),'Call Start Time':(_0x1cf441==='outbound'?_0x53cbcd[_0xf326('0x12')]:_0x53cbcd[_0xf326('0x13')])||moment()[_0xf326('0x14')](_0xf326('0x15')),'Subject':intUtil['getString'](_0x136e2d[_0xf326('0x16')],_0x53cbcd,'\x20'),'Description':intUtil['getString'](_0x136e2d['Descriptions'],_0x53cbcd,'\x0a')},getCustomFields(_0x136e2d[_0xf326('0x17')],_0x53cbcd));switch(_0x53cbcd[_0xf326('0x18')]){case _0xf326('0x19'):_0x518ab5[_0xf326('0x1a')]=_0xf326('0x1b');break;case _0xf326('0x1c'):case _0xf326('0x1d'):_0x518ab5[_0xf326('0x1a')]='Answered';break;case _0xf326('0x1e'):_0x518ab5[_0xf326('0x1a')]=_0xf326('0x1f');break;case _0xf326('0x20'):_0x518ab5[_0xf326('0x1a')]=_0xf326('0x21');break;default:}if(_0x53cbcd['talktime']){_0x518ab5['Call\x20Duration']=moment['utc'](parseInt(_0x53cbcd[_0xf326('0x22')])*0x3e8)[_0xf326('0x14')]('mm:ss');}else if(_0x53cbcd['answertime']&&_0x53cbcd[_0xf326('0x23')]){_0x518ab5['Call\x20Duration']=moment['utc'](moment(_0x53cbcd[_0xf326('0x23')],_0xf326('0x15'))['diff'](moment(_0x53cbcd['starttime'],_0xf326('0x15'))))[_0xf326('0x14')]('mm:ss');}if(_0x5db9d7[_0xf326('0x24')]){_0x518ab5[_0xf326('0x24')]=_0x5db9d7[_0xf326('0x24')];}else if(_0x5db9d7[_0xf326('0x25')]){_0x518ab5[_0xf326('0x26')]=_0xf326('0x27');_0x518ab5['SEID']=_0x5db9d7['LEADID'];}var _0x4f31f6=_0xf326('0x28');for(var _0x1a2c4e in _0x518ab5){if(_0x518ab5[_0xf326('0x29')](_0x1a2c4e)){_0x4f31f6+=util[_0xf326('0x14')](_0xf326('0x2a'),entities[_0xf326('0x2b')](_0x1a2c4e),entities['encodeXML'](_0x518ab5[_0x1a2c4e]));}}_0x4f31f6+=_0xf326('0x2c');return request({'method':_0xf326('0x2d'),'uri':util[_0xf326('0x14')]('https://crm.%s/crm/private/xml/Calls/insertRecords',_0x2686e1[_0xf326('0x2e')]),'qs':{'authtoken':_0x2686e1['authToken'],'scope':'crmapi','xmlData':_0x4f31f6},'json':!![]})[_0xf326('0x2f')](function(_0x1ae23a){_0x1ae23a=JSON[_0xf326('0x30')](parser['toJson'](_0x1ae23a));if(_0x1ae23a[_0xf326('0x31')]){if(_0x1ae23a[_0xf326('0x31')]['result']&&_0x1ae23a[_0xf326('0x31')][_0xf326('0x32')][_0xf326('0x33')]){logger[_0xf326('0x34')](_0xf326('0x35'));return{'id':_0x1ae23a[_0xf326('0x31')][_0xf326('0x32')][_0xf326('0x33')]['FL'][0x0]['$t']};}}throw new Error(_0xf326('0x36')+JSON[_0xf326('0x37')](_0x1ae23a));});}function getUser(_0x4b52f2,_0x1035ed){_0x1035ed&&logger[_0xf326('0x34')](_0xf326('0x38'),_0x1035ed);return request({'method':'GET','uri':util[_0xf326('0x14')](_0xf326('0x39'),_0x4b52f2[_0xf326('0x2e')]),'qs':{'type':'AllUsers','authtoken':_0x4b52f2['authToken'],'scope':_0xf326('0x3a')},'json':!![]})[_0xf326('0x2f')](function(_0x9c3039){if(_0x9c3039[_0xf326('0x3b')]&&_0x9c3039[_0xf326('0x3b')][_0xf326('0x3c')]){var _0x62585a;if(_0x1035ed){_0x62585a=_[_0xf326('0x3d')](_0x9c3039['users'][_0xf326('0x3c')],{'email':_0x1035ed,'profile':_0xf326('0x3e')});}if(_0x62585a){logger['info'](_0xf326('0x3f'));}else{logger['info'](_0xf326('0x40'));_0x62585a=_['find'](_0x9c3039['users'][_0xf326('0x3c')],{'profile':'Administrator'});}return _0x62585a;}else{logger[_0xf326('0x41')]('The\x20failing\x20result\x20is',JSON[_0xf326('0x37')](_0x9c3039));throw new Error(_0xf326('0x42')+JSON[_0xf326('0x37')](_0x9c3039));}});}function getEndUser(_0x529cbb,_0x3dcc7e,_0x4095e6){logger['info'](_0xf326('0x43'),_0x4095e6);return request({'method':_0xf326('0x44'),'uri':util[_0xf326('0x14')](_0xf326('0x45'),_0x529cbb['host']),'qs':{'authtoken':_0x529cbb[_0xf326('0x46')],'scope':_0xf326('0x3a'),'criteria':util[_0xf326('0x14')](_0xf326('0x47'),_0x4095e6)},'json':!![]})[_0xf326('0x2f')](function(_0x5f02b5){if(_0x5f02b5[_0xf326('0x31')]&&_0x5f02b5[_0xf326('0x31')]['result']){logger['info'](_0xf326('0x48'));var _0x577634={};var _0x55dfa8=_0x5f02b5[_0xf326('0x31')]['result'][_0xf326('0x49')][_0xf326('0x4a')]['no']?_0x5f02b5[_0xf326('0x31')][_0xf326('0x32')]['Contacts'][_0xf326('0x4a')]['FL']:_0x5f02b5[_0xf326('0x31')][_0xf326('0x32')][_0xf326('0x49')][_0xf326('0x4a')][0x0]['FL'];for(var _0x28f857=0x0,_0x2ad841=_0x55dfa8[_0xf326('0x4b')];_0x28f857<_0x2ad841;_0x28f857++){_0x577634[_0x55dfa8[_0x28f857][_0xf326('0x4c')]]=_0x55dfa8[_0x28f857][_0xf326('0x4d')];}return _0x577634;}else{return request({'method':_0xf326('0x44'),'uri':util[_0xf326('0x14')]('https://crm.%s/crm/private/json/Leads/searchRecords',_0x529cbb[_0xf326('0x2e')]),'qs':{'authtoken':_0x529cbb[_0xf326('0x46')],'scope':_0xf326('0x3a'),'criteria':util[_0xf326('0x14')](_0xf326('0x47'),_0x4095e6)},'json':!![]})[_0xf326('0x2f')](function(_0x4f4c51){if(_0x4f4c51[_0xf326('0x31')]&&_0x4f4c51[_0xf326('0x31')]['result']){logger[_0xf326('0x34')](_0xf326('0x4e'));var _0x130c56={};var _0x305863=_0x4f4c51[_0xf326('0x31')]['result']['Leads'][_0xf326('0x4a')]['no']?_0x4f4c51[_0xf326('0x31')]['result']['Leads'][_0xf326('0x4a')]['FL']:_0x4f4c51[_0xf326('0x31')][_0xf326('0x32')]['Leads'][_0xf326('0x4a')][0x0]['FL'];for(var _0xe96e1e=0x0,_0x2180d6=_0x305863[_0xf326('0x4b')];_0xe96e1e<_0x2180d6;_0xe96e1e++){_0x130c56[_0x305863[_0xe96e1e][_0xf326('0x4c')]]=_0x305863[_0xe96e1e][_0xf326('0x4d')];}return _0x130c56;}else{logger[_0xf326('0x34')](_0xf326('0x4f'));_0x3dcc7e=getName(_0x3dcc7e);return request({'method':_0xf326('0x2d'),'uri':util[_0xf326('0x14')](_0xf326('0x50'),_0x529cbb[_0xf326('0x2e')]),'qs':{'authtoken':_0x529cbb[_0xf326('0x46')],'scope':_0xf326('0x3a'),'xmlData':util[_0xf326('0x14')]('%s%s%s',entities[_0xf326('0x2b')](_0x3dcc7e[0x0]),entities[_0xf326('0x2b')](_0x3dcc7e[0x1]),_0x4095e6)},'json':!![]})[_0xf326('0x2f')](function(_0x28dde6){_0x28dde6=JSON['parse'](parser[_0xf326('0x51')](_0x28dde6));if(_0x28dde6[_0xf326('0x31')]){if(_0x28dde6[_0xf326('0x31')][_0xf326('0x32')]&&_0x28dde6['response'][_0xf326('0x32')][_0xf326('0x33')]){logger[_0xf326('0x34')](_0xf326('0x52'));return request({'method':_0xf326('0x44'),'uri':util['format']('https://crm.%s/crm/private/json/Leads/getRecordById',_0x529cbb[_0xf326('0x2e')]),'qs':{'authtoken':_0x529cbb[_0xf326('0x46')],'scope':_0xf326('0x3a'),'id':_0x28dde6['response'][_0xf326('0x32')][_0xf326('0x33')]['FL'][0x0]['$t']},'json':!![]});}}throw new Error(_0xf326('0x53')+JSON['stringify'](_0x28dde6));})['then'](function(_0x36ef89){if(_0x36ef89['response']){if(_0x36ef89[_0xf326('0x31')]['result']){var _0x458e5f={};for(var _0x7ee57=0x0,_0x28c959=_0x36ef89[_0xf326('0x31')][_0xf326('0x32')][_0xf326('0x27')][_0xf326('0x4a')]['FL']['length'];_0x7ee57<_0x28c959;_0x7ee57++){_0x458e5f[_0x36ef89[_0xf326('0x31')][_0xf326('0x32')][_0xf326('0x27')]['row']['FL'][_0x7ee57][_0xf326('0x4c')]]=_0x36ef89[_0xf326('0x31')][_0xf326('0x32')][_0xf326('0x27')][_0xf326('0x4a')]['FL'][_0x7ee57]['content'];}return _0x458e5f;}}throw new Error(_0xf326('0x54')+JSON[_0xf326('0x37')](_0x36ef89));});}});}});}function request(_0x287a97){logger[_0xf326('0x55')]('[HTTP]',JSON[_0xf326('0x37')](_0x287a97));return rp(_0x287a97);}function getCustomFields(_0x2c362f,_0x227850){var _0x29e52e={};if(_0x2c362f['length']>0x0){_['forEach'](_0x2c362f,function(_0x18b46e){if(_0x18b46e[_0xf326('0x56')]==='string'&&_0x18b46e[_0xf326('0x57')]){_0x29e52e[_0x18b46e[_0xf326('0x57')]]=_0x18b46e[_0xf326('0x4d')][_0xf326('0x58')]();}else if(_0x18b46e['type']===_0xf326('0x59')&&_0x18b46e['variableName']&&_0x18b46e['idField']&&_0x227850[_0x18b46e[_0xf326('0x5a')]]){_0x29e52e[_0x18b46e['idField']]=_0x227850[_0x18b46e[_0xf326('0x5a')]][_0xf326('0x58')]();}else if(_0x18b46e[_0xf326('0x56')]==='customVariable'&&_0x18b46e['Variable']&&_0x18b46e[_0xf326('0x5b')][_0xf326('0x5c')]&&_0x18b46e[_0xf326('0x57')]&&_0x227850[_0x18b46e['Variable'][_0xf326('0x5c')]['toLowerCase']()]){_0x29e52e[_0x18b46e[_0xf326('0x57')]]=_0x227850[_0x18b46e[_0xf326('0x5b')][_0xf326('0x5c')][_0xf326('0x5d')]()][_0xf326('0x58')]();}});}return _0x29e52e;}function getName(_0x18dbfc){if(_0x18dbfc[_0xf326('0x5e')]('\x20')>0x0){var _0x3aeb20=_0x18dbfc[_0xf326('0x5f')](/ (.+)/);if(_0x3aeb20[0x1]){return _0x3aeb20;}}return[_0x18dbfc,_0x18dbfc];}exports[_0xf326('0x60')]=function(_0x33ffb8,_0x1e56fb,_0x40f7cb,_0x4ca1b8,_0x25a429,_0x5ae666){var _0x6ac6,_0x32d173;if(_0x25a429&&_0x25a429['monitor_format']){logger[_0xf326('0x34')]('[QUEUE]',_0xf326('0x61'));_0x1e56fb[_0xf326('0x62')]=util[_0xf326('0x14')](_0xf326('0x63'),_0x5ae666[_0xf326('0x64')],_0x1e56fb['uniqueid'],md5(_0x1e56fb['uniqueid']));}else{_0x1e56fb[_0xf326('0x62')]='';}return getUser(_0x5ae666,_0x4ca1b8[_0xf326('0x65')])[_0xf326('0x2f')](function(_0x21b3cc){_0x6ac6=_0x21b3cc;logger[_0xf326('0x34')]('The\x20User\x20ID\x20is:',_0x6ac6['id']);return getEndUser(_0x5ae666,_0x1e56fb[_0xf326('0x66')],_0x1e56fb[_0xf326('0x67')]);})['then'](function(_0x50319a){_0x32d173=_0x50319a;logger['info'](_0xf326('0x68'),_0x32d173[_0xf326('0x24')]||_0x32d173[_0xf326('0x25')]);return getCall(_0x5ae666,_0x6ac6,_0x32d173,_0x40f7cb,_0x1e56fb,_0xf326('0x69'));})[_0xf326('0x2f')](function(_0x23a56e){if(_0x23a56e){logger[_0xf326('0x34')]('The\x20Call\x20ID\x20is:',_0x23a56e['id']);logger[_0xf326('0x34')](_0xf326('0x6a'),_0xf326('0x6b'));emit(util[_0xf326('0x14')]('user:%s',_0x4ca1b8[_0xf326('0x5c')]),'trigger:browser:url',{'uri':util['format'](_0xf326('0x6c'),_0x5ae666['host'],_0x23a56e['id'])});}})[_0xf326('0x6d')](function(_0x3411a4){logger[_0xf326('0x41')](_0xf326('0x6a'),JSON[_0xf326('0x37')](_0x3411a4));});};exports['outbound']=function(_0x4a053c,_0x48d84a,_0xeeea57,_0x307441,_0x229a34,_0x180616,_0xec5857){var _0x5e874b,_0x1ed961;if(_0xec5857&&_0xec5857[_0xf326('0x6e')]&&_0xec5857[_0xf326('0x6e')]!=='none'){logger['info'](_0xf326('0x6f'),_0xf326('0x61'));_0x48d84a['recordingURL']=util['format'](_0xf326('0x63'),_0x180616['serverUrl'],_0x48d84a[_0xf326('0x70')],md5(_0x48d84a['uniqueid']));}return getUser(_0x180616,_0x307441['email'])['then'](function(_0x1bb63e){_0x5e874b=_0x1bb63e;logger[_0xf326('0x34')](_0xf326('0x71'),_0x5e874b['id']);return getEndUser(_0x180616,_0x48d84a['destcalleridname'],_0x48d84a[_0xf326('0x72')]);})[_0xf326('0x2f')](function(_0x35e34d){_0x1ed961=_0x35e34d;logger[_0xf326('0x34')](_0xf326('0x68'),_0x1ed961[_0xf326('0x24')]||_0x1ed961[_0xf326('0x25')]);return getCall(_0x180616,_0x5e874b,_0x1ed961,_0xeeea57,_0x48d84a,_0xf326('0x73'));})[_0xf326('0x2f')](function(_0x5290da){if(_0x5290da){logger[_0xf326('0x34')]('The\x20Call\x20ID\x20is:',_0x5290da['id']);logger[_0xf326('0x34')](_0xf326('0x6f'),_0xf326('0x6b'));emit(util['format'](_0xf326('0x74'),_0x307441[_0xf326('0x5c')]),_0xf326('0x75'),{'uri':util['format'](_0xf326('0x6c'),_0x180616[_0xf326('0x2e')],_0x5290da['id'])});}})[_0xf326('0x6d')](function(_0x42c7cf){logger['error'](_0xf326('0x6f'),JSON['stringify'](_0x42c7cf));});};exports['abandoned']=function(_0x32d9c5,_0x2c36d3,_0x5af6b7,_0x49f239,_0x4b8f8d,_0x2bd990){var _0x543689,_0x102d03;if(_0x4b8f8d&&_0x4b8f8d[_0xf326('0x76')]){logger[_0xf326('0x34')](_0xf326('0x77'),_0xf326('0x61'));_0x2c36d3[_0xf326('0x62')]=util['format'](_0xf326('0x63'),_0x2bd990[_0xf326('0x64')],_0x2c36d3['uniqueid'],md5(_0x2c36d3['uniqueid']));}else{_0x2c36d3[_0xf326('0x62')]='';}return getUser(_0x2bd990)['then'](function(_0x35a7c9){_0x543689=_0x35a7c9;logger[_0xf326('0x34')](_0xf326('0x71'),_0x543689['id']);return getEndUser(_0x2bd990,_0x2c36d3[_0xf326('0x66')],_0x2c36d3[_0xf326('0x67')]);})[_0xf326('0x2f')](function(_0x293600){_0x102d03=_0x293600;logger[_0xf326('0x34')](_0xf326('0x68'),_0x102d03['CONTACTID']||_0x102d03[_0xf326('0x25')]);return getCall(_0x2bd990,_0x543689,_0x102d03,_0x5af6b7,_0x2c36d3,_0xf326('0x69'));})['then'](function(_0x3c82cf){if(_0x3c82cf){logger['info'](_0xf326('0x78'),_0x3c82cf['id']);}})[_0xf326('0x6d')](function(_0x14e8c0){logger['error'](_0xf326('0x77'),JSON[_0xf326('0x37')](_0x14e8c0));});}; \ No newline at end of file +var _0x8ef6=['abandoned','[ABANDONED]','lodash','request-promise','md5','util','./util','xml2json','entities','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20call...','merge','inbound','outbound','starttime','format','YYYY-MM-DD\x20HH:mm:ss','getString','Descriptions','Fields','called','Call\x20Result','Called','complete','Rejected','Abandoned','talktime','Call\x20Duration','mm:ss','endtime','diff','CONTACTID','LEADID','SEMODULE','Leads','SEID','encodeXML','','POST','host','authToken','crmapi','then','parse','toJson','response','result','info','stringify','Getting\x20agent\x20with\x20email','GET','AllUsers','users','user','find','Standard','Administrator','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','Searching\x20enduser\x20with\x20phone','((Phone:%s))','Enduser\x20found\x20in\x20Contacts!','Contacts','row','length','val','https://crm.%s/crm/private/json/Leads/searchRecords','content','https://crm.%s/crm/private/xml/Leads/insertRecords','%s%s%s','Enduser\x20created.','https://crm.%s/crm/private/json/Leads/getRecordById','Error\x20on\x20Lead\x20creation:\x20','Error\x20on\x20Lead\x20retrieve:\x20','[HTTP]','forEach','type','string','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','queue','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','[QUEUE]','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','https://crm.%s/crm/EntityInfo.do?module=Calls&id=%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ef6,0xf2));var _0x68ef=function(_0x4493e3,_0xad82b3){_0x4493e3=_0x4493e3-0x0;var _0x45d77a=_0x8ef6[_0x4493e3];return _0x45d77a;};'use strict';var _=require(_0x68ef('0x0'));var rp=require(_0x68ef('0x1'));var md5=require(_0x68ef('0x2'));var util=require(_0x68ef('0x3'));var intUtil=require(_0x68ef('0x4'));var parser=require(_0x68ef('0x5'));var entities=require(_0x68ef('0x6'));var moment=require('moment');var Redis=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var logger=require(_0x68ef('0x9'))(_0x68ef('0xa'));config['redis']=_['defaults'](config[_0x68ef('0xb')],{'host':_0x68ef('0xc'),'port':0x18eb});var io=require(_0x68ef('0xd'))(new Redis(config['redis']));function emit(_0x228967,_0x31007e,_0x1bee73){io['to'](_0x228967)[_0x68ef('0xe')](_0x31007e,_0x1bee73);}var headers={'Content-Type':_0x68ef('0xf'),'Accept':_0x68ef('0xf')};function getCall(_0x304a60,_0x23da00,_0x1f6747,_0x255c85,_0x3afc1d,_0xfa6763){logger['info'](_0x68ef('0x10'));var _0x46356f=_[_0x68ef('0x11')]({'SMOWNERID':_0x23da00['id'],'Call Type':_0xfa6763||_0x68ef('0x12'),'Call Start Time':(_0xfa6763===_0x68ef('0x13')?_0x3afc1d[_0x68ef('0x14')]:_0x3afc1d['agentcalledAt'])||moment()[_0x68ef('0x15')](_0x68ef('0x16')),'Subject':intUtil[_0x68ef('0x17')](_0x255c85['Subjects'],_0x3afc1d,'\x20'),'Description':intUtil[_0x68ef('0x17')](_0x255c85[_0x68ef('0x18')],_0x3afc1d,'\x0a')},getCustomFields(_0x255c85[_0x68ef('0x19')],_0x3afc1d));switch(_0x3afc1d['lastevent']){case _0x68ef('0x1a'):_0x46356f[_0x68ef('0x1b')]=_0x68ef('0x1c');break;case _0x68ef('0x1d'):case'connect':_0x46356f[_0x68ef('0x1b')]='Answered';break;case'rejected':_0x46356f[_0x68ef('0x1b')]=_0x68ef('0x1e');break;case'abandoned':_0x46356f['Call\x20Result']=_0x68ef('0x1f');break;default:}if(_0x3afc1d[_0x68ef('0x20')]){_0x46356f[_0x68ef('0x21')]=moment['utc'](parseInt(_0x3afc1d[_0x68ef('0x20')])*0x3e8)[_0x68ef('0x15')](_0x68ef('0x22'));}else if(_0x3afc1d['answertime']&&_0x3afc1d[_0x68ef('0x23')]){_0x46356f[_0x68ef('0x21')]=moment['utc'](moment(_0x3afc1d[_0x68ef('0x23')],_0x68ef('0x16'))[_0x68ef('0x24')](moment(_0x3afc1d['starttime'],'YYYY-MM-DD\x20HH:mm:ss')))['format'](_0x68ef('0x22'));}if(_0x1f6747[_0x68ef('0x25')]){_0x46356f[_0x68ef('0x25')]=_0x1f6747[_0x68ef('0x25')];}else if(_0x1f6747[_0x68ef('0x26')]){_0x46356f[_0x68ef('0x27')]=_0x68ef('0x28');_0x46356f[_0x68ef('0x29')]=_0x1f6747[_0x68ef('0x26')];}var _0x13280b='';for(var _0x178460 in _0x46356f){if(_0x46356f['hasOwnProperty'](_0x178460)){_0x13280b+=util['format']('%s',entities[_0x68ef('0x2a')](_0x178460),entities[_0x68ef('0x2a')](_0x46356f[_0x178460]));}}_0x13280b+=_0x68ef('0x2b');return request({'method':_0x68ef('0x2c'),'uri':util['format']('https://crm.%s/crm/private/xml/Calls/insertRecords',_0x304a60[_0x68ef('0x2d')]),'qs':{'authtoken':_0x304a60[_0x68ef('0x2e')],'scope':_0x68ef('0x2f'),'xmlData':_0x13280b},'json':!![]})[_0x68ef('0x30')](function(_0x22ef25){_0x22ef25=JSON[_0x68ef('0x31')](parser[_0x68ef('0x32')](_0x22ef25));if(_0x22ef25[_0x68ef('0x33')]){if(_0x22ef25['response'][_0x68ef('0x34')]&&_0x22ef25[_0x68ef('0x33')][_0x68ef('0x34')]['recorddetail']){logger[_0x68ef('0x35')]('Call\x20created!');return{'id':_0x22ef25[_0x68ef('0x33')][_0x68ef('0x34')]['recorddetail']['FL'][0x0]['$t']};}}throw new Error('Error\x20on\x20call\x20creation:\x20'+JSON[_0x68ef('0x36')](_0x22ef25));});}function getUser(_0x5fa72a,_0x4b8fc8){_0x4b8fc8&&logger[_0x68ef('0x35')](_0x68ef('0x37'),_0x4b8fc8);return request({'method':_0x68ef('0x38'),'uri':util[_0x68ef('0x15')]('https://crm.%s/crm/private/json/Users/getUsers',_0x5fa72a[_0x68ef('0x2d')]),'qs':{'type':_0x68ef('0x39'),'authtoken':_0x5fa72a['authToken'],'scope':_0x68ef('0x2f')},'json':!![]})['then'](function(_0x14581d){if(_0x14581d[_0x68ef('0x3a')]&&_0x14581d['users'][_0x68ef('0x3b')]){var _0x4a0763;if(_0x4b8fc8){_0x4a0763=_[_0x68ef('0x3c')](_0x14581d['users'][_0x68ef('0x3b')],{'email':_0x4b8fc8,'profile':_0x68ef('0x3d')});}if(_0x4a0763){logger[_0x68ef('0x35')]('Agent\x20found!');}else{logger[_0x68ef('0x35')]('Using\x20the\x20admin\x20account!');_0x4a0763=_[_0x68ef('0x3c')](_0x14581d['users'][_0x68ef('0x3b')],{'profile':_0x68ef('0x3e')});}return _0x4a0763;}else{logger[_0x68ef('0x3f')](_0x68ef('0x40'),JSON[_0x68ef('0x36')](_0x14581d));throw new Error(_0x68ef('0x41')+JSON['stringify'](_0x14581d));}});}function getEndUser(_0x294fba,_0x15a6ab,_0x32074a){logger['info'](_0x68ef('0x42'),_0x32074a);return request({'method':_0x68ef('0x38'),'uri':util[_0x68ef('0x15')]('https://crm.%s/crm/private/json/Contacts/searchRecords',_0x294fba['host']),'qs':{'authtoken':_0x294fba[_0x68ef('0x2e')],'scope':_0x68ef('0x2f'),'criteria':util[_0x68ef('0x15')](_0x68ef('0x43'),_0x32074a)},'json':!![]})[_0x68ef('0x30')](function(_0x129c82){if(_0x129c82[_0x68ef('0x33')]&&_0x129c82['response'][_0x68ef('0x34')]){logger[_0x68ef('0x35')](_0x68ef('0x44'));var _0x2158f={};var _0x492b74=_0x129c82[_0x68ef('0x33')][_0x68ef('0x34')][_0x68ef('0x45')][_0x68ef('0x46')]['no']?_0x129c82[_0x68ef('0x33')][_0x68ef('0x34')]['Contacts'][_0x68ef('0x46')]['FL']:_0x129c82[_0x68ef('0x33')][_0x68ef('0x34')][_0x68ef('0x45')][_0x68ef('0x46')][0x0]['FL'];for(var _0x32d5c3=0x0,_0x13ee90=_0x492b74[_0x68ef('0x47')];_0x32d5c3<_0x13ee90;_0x32d5c3++){_0x2158f[_0x492b74[_0x32d5c3][_0x68ef('0x48')]]=_0x492b74[_0x32d5c3]['content'];}return _0x2158f;}else{return request({'method':_0x68ef('0x38'),'uri':util[_0x68ef('0x15')](_0x68ef('0x49'),_0x294fba[_0x68ef('0x2d')]),'qs':{'authtoken':_0x294fba[_0x68ef('0x2e')],'scope':_0x68ef('0x2f'),'criteria':util[_0x68ef('0x15')]('((Phone:%s))',_0x32074a)},'json':!![]})[_0x68ef('0x30')](function(_0x5dcde1){if(_0x5dcde1[_0x68ef('0x33')]&&_0x5dcde1[_0x68ef('0x33')][_0x68ef('0x34')]){logger[_0x68ef('0x35')]('Enduser\x20found\x20in\x20Leads!');var _0x428456={};var _0x5a8231=_0x5dcde1[_0x68ef('0x33')]['result'][_0x68ef('0x28')][_0x68ef('0x46')]['no']?_0x5dcde1[_0x68ef('0x33')]['result']['Leads'][_0x68ef('0x46')]['FL']:_0x5dcde1[_0x68ef('0x33')]['result']['Leads']['row'][0x0]['FL'];for(var _0xe547c=0x0,_0x15c753=_0x5a8231[_0x68ef('0x47')];_0xe547c<_0x15c753;_0xe547c++){_0x428456[_0x5a8231[_0xe547c][_0x68ef('0x48')]]=_0x5a8231[_0xe547c][_0x68ef('0x4a')];}return _0x428456;}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');_0x15a6ab=getName(_0x15a6ab);return request({'method':_0x68ef('0x2c'),'uri':util[_0x68ef('0x15')](_0x68ef('0x4b'),_0x294fba[_0x68ef('0x2d')]),'qs':{'authtoken':_0x294fba['authToken'],'scope':_0x68ef('0x2f'),'xmlData':util[_0x68ef('0x15')](_0x68ef('0x4c'),entities[_0x68ef('0x2a')](_0x15a6ab[0x0]),entities['encodeXML'](_0x15a6ab[0x1]),_0x32074a)},'json':!![]})['then'](function(_0x16e247){_0x16e247=JSON[_0x68ef('0x31')](parser['toJson'](_0x16e247));if(_0x16e247[_0x68ef('0x33')]){if(_0x16e247[_0x68ef('0x33')][_0x68ef('0x34')]&&_0x16e247[_0x68ef('0x33')][_0x68ef('0x34')]['recorddetail']){logger[_0x68ef('0x35')](_0x68ef('0x4d'));return request({'method':_0x68ef('0x38'),'uri':util['format'](_0x68ef('0x4e'),_0x294fba[_0x68ef('0x2d')]),'qs':{'authtoken':_0x294fba[_0x68ef('0x2e')],'scope':'crmapi','id':_0x16e247[_0x68ef('0x33')]['result']['recorddetail']['FL'][0x0]['$t']},'json':!![]});}}throw new Error(_0x68ef('0x4f')+JSON['stringify'](_0x16e247));})[_0x68ef('0x30')](function(_0xb33afd){if(_0xb33afd[_0x68ef('0x33')]){if(_0xb33afd[_0x68ef('0x33')][_0x68ef('0x34')]){var _0x45ae42={};for(var _0x363498=0x0,_0x1d1d6e=_0xb33afd[_0x68ef('0x33')][_0x68ef('0x34')]['Leads']['row']['FL'][_0x68ef('0x47')];_0x363498<_0x1d1d6e;_0x363498++){_0x45ae42[_0xb33afd[_0x68ef('0x33')][_0x68ef('0x34')][_0x68ef('0x28')][_0x68ef('0x46')]['FL'][_0x363498][_0x68ef('0x48')]]=_0xb33afd[_0x68ef('0x33')][_0x68ef('0x34')][_0x68ef('0x28')]['row']['FL'][_0x363498]['content'];}return _0x45ae42;}}throw new Error(_0x68ef('0x50')+JSON['stringify'](_0xb33afd));});}});}});}function request(_0x459b21){logger['debug'](_0x68ef('0x51'),JSON[_0x68ef('0x36')](_0x459b21));return rp(_0x459b21);}function getCustomFields(_0x552736,_0xa42737){var _0x4e097e={};if(_0x552736[_0x68ef('0x47')]>0x0){_[_0x68ef('0x52')](_0x552736,function(_0x3319ea){if(_0x3319ea[_0x68ef('0x53')]===_0x68ef('0x54')&&_0x3319ea[_0x68ef('0x55')]){_0x4e097e[_0x3319ea['idField']]=_0x3319ea[_0x68ef('0x4a')][_0x68ef('0x56')]();}else if(_0x3319ea[_0x68ef('0x53')]===_0x68ef('0x57')&&_0x3319ea[_0x68ef('0x58')]&&_0x3319ea[_0x68ef('0x55')]&&_0xa42737[_0x3319ea['variableName']]){_0x4e097e[_0x3319ea[_0x68ef('0x55')]]=_0xa42737[_0x3319ea[_0x68ef('0x58')]]['toString']();}else if(_0x3319ea[_0x68ef('0x53')]===_0x68ef('0x59')&&_0x3319ea[_0x68ef('0x5a')]&&_0x3319ea['Variable'][_0x68ef('0x5b')]&&_0x3319ea['idField']&&_0xa42737[_0x3319ea['Variable'][_0x68ef('0x5b')]['toLowerCase']()]){_0x4e097e[_0x3319ea[_0x68ef('0x55')]]=_0xa42737[_0x3319ea['Variable'][_0x68ef('0x5b')][_0x68ef('0x5c')]()][_0x68ef('0x56')]();}});}return _0x4e097e;}function getName(_0x3fbd39){if(_0x3fbd39[_0x68ef('0x5d')]('\x20')>0x0){var _0x19a9c4=_0x3fbd39['split'](/ (.+)/);if(_0x19a9c4[0x1]){return _0x19a9c4;}}return[_0x3fbd39,_0x3fbd39];}exports[_0x68ef('0x5e')]=function(_0x4ed1eb,_0x2cbd99,_0x4b0c3e,_0x2f97c5,_0x17700a,_0x212ec4){var _0xf0a40f,_0x2f409c;if(_0x17700a&&_0x17700a[_0x68ef('0x5f')]){logger[_0x68ef('0x35')]('[QUEUE]',_0x68ef('0x60'));_0x2cbd99[_0x68ef('0x61')]=util[_0x68ef('0x15')](_0x68ef('0x62'),_0x212ec4[_0x68ef('0x63')],_0x2cbd99['uniqueid'],md5(_0x2cbd99[_0x68ef('0x64')]));}else{_0x2cbd99['recordingURL']='';}return getUser(_0x212ec4,_0x2f97c5[_0x68ef('0x65')])['then'](function(_0x490b42){_0xf0a40f=_0x490b42;logger[_0x68ef('0x35')](_0x68ef('0x66'),_0xf0a40f['id']);return getEndUser(_0x212ec4,_0x2cbd99[_0x68ef('0x67')],_0x2cbd99[_0x68ef('0x68')]);})['then'](function(_0x124b49){_0x2f409c=_0x124b49;logger['info'](_0x68ef('0x69'),_0x2f409c[_0x68ef('0x25')]||_0x2f409c[_0x68ef('0x26')]);return getCall(_0x212ec4,_0xf0a40f,_0x2f409c,_0x4b0c3e,_0x2cbd99,'Inbound');})['then'](function(_0x3e74d2){if(_0x3e74d2){logger[_0x68ef('0x35')](_0x68ef('0x6a'),_0x3e74d2['id']);logger[_0x68ef('0x35')]('[QUEUE]',_0x68ef('0x6b'));emit(util[_0x68ef('0x15')](_0x68ef('0x6c'),_0x2f97c5[_0x68ef('0x5b')]),'trigger:browser:url',{'uri':util[_0x68ef('0x15')]('https://crm.%s/crm/EntityInfo.do?module=Calls&id=%s',_0x212ec4[_0x68ef('0x2d')],_0x3e74d2['id'])});}})[_0x68ef('0x6d')](function(_0x90e1a6){logger[_0x68ef('0x3f')](_0x68ef('0x6e'),JSON['stringify'](_0x90e1a6));});};exports[_0x68ef('0x13')]=function(_0x2caed7,_0x147695,_0x595e79,_0x1001ed,_0x4de108,_0x69b1c,_0x535f65){var _0x4c70c0,_0x100345;if(_0x535f65&&_0x535f65[_0x68ef('0x6f')]&&_0x535f65[_0x68ef('0x6f')]!==_0x68ef('0x70')){logger['info'](_0x68ef('0x71'),_0x68ef('0x60'));_0x147695[_0x68ef('0x61')]=util['format'](_0x68ef('0x62'),_0x69b1c[_0x68ef('0x63')],_0x147695[_0x68ef('0x64')],md5(_0x147695[_0x68ef('0x64')]));}return getUser(_0x69b1c,_0x1001ed[_0x68ef('0x65')])[_0x68ef('0x30')](function(_0x139557){_0x4c70c0=_0x139557;logger[_0x68ef('0x35')](_0x68ef('0x66'),_0x4c70c0['id']);return getEndUser(_0x69b1c,_0x147695[_0x68ef('0x72')],_0x147695[_0x68ef('0x73')]);})[_0x68ef('0x30')](function(_0x50e298){_0x100345=_0x50e298;logger[_0x68ef('0x35')](_0x68ef('0x69'),_0x100345['CONTACTID']||_0x100345['LEADID']);return getCall(_0x69b1c,_0x4c70c0,_0x100345,_0x595e79,_0x147695,_0x68ef('0x74'));})['then'](function(_0x467d70){if(_0x467d70){logger[_0x68ef('0x35')]('The\x20Call\x20ID\x20is:',_0x467d70['id']);logger['info'](_0x68ef('0x71'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x68ef('0x15')]('user:%s',_0x1001ed[_0x68ef('0x5b')]),'trigger:browser:url',{'uri':util[_0x68ef('0x15')](_0x68ef('0x75'),_0x69b1c['host'],_0x467d70['id'])});}})[_0x68ef('0x6d')](function(_0x357be7){logger[_0x68ef('0x3f')](_0x68ef('0x71'),JSON['stringify'](_0x357be7));});};exports[_0x68ef('0x76')]=function(_0x26bda2,_0x5b2e89,_0x3bb3b6,_0x299de3,_0x21f32b,_0x4de1d1){var _0x3d2a3d,_0x596311;if(_0x21f32b&&_0x21f32b[_0x68ef('0x5f')]){logger[_0x68ef('0x35')]('[ABANDONED]','Recording\x20is\x20enabled!');_0x5b2e89['recordingURL']=util['format'](_0x68ef('0x62'),_0x4de1d1[_0x68ef('0x63')],_0x5b2e89[_0x68ef('0x64')],md5(_0x5b2e89[_0x68ef('0x64')]));}else{_0x5b2e89[_0x68ef('0x61')]='';}return getUser(_0x4de1d1)[_0x68ef('0x30')](function(_0x842cfe){_0x3d2a3d=_0x842cfe;logger[_0x68ef('0x35')](_0x68ef('0x66'),_0x3d2a3d['id']);return getEndUser(_0x4de1d1,_0x5b2e89[_0x68ef('0x67')],_0x5b2e89[_0x68ef('0x68')]);})[_0x68ef('0x30')](function(_0x717d7b){_0x596311=_0x717d7b;logger['info'](_0x68ef('0x69'),_0x596311['CONTACTID']||_0x596311[_0x68ef('0x26')]);return getCall(_0x4de1d1,_0x3d2a3d,_0x596311,_0x3bb3b6,_0x5b2e89,'Inbound');})['then'](function(_0x4532e2){if(_0x4532e2){logger[_0x68ef('0x35')](_0x68ef('0x6a'),_0x4532e2['id']);}})[_0x68ef('0x6d')](function(_0x518c9a){logger['error'](_0x68ef('0x77'),JSON[_0x68ef('0x36')](_0x518c9a));});}; \ 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 0863a2a..cd4a65a 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 _0x78ea=['body','data7','then','info','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20body:\x20%s','%s\x20%s\x20%s\x20[%s]:%s','name','message','request-promise','util','mustache','trigger','data1','toUpperCase','render','data2','GET','POST'];(function(_0x304c47,_0x4e0e20){var _0x2dbd2c=function(_0x4f7049){while(--_0x4f7049){_0x304c47['push'](_0x304c47['shift']());}};_0x2dbd2c(++_0x4e0e20);}(_0x78ea,0x8e));var _0xa78e=function(_0x4c799c,_0x553f73){_0x4c799c=_0x4c799c-0x0;var _0x50385e=_0x78ea[_0x4c799c];return _0x50385e;};'use strict';var rp=require(_0xa78e('0x0'));var util=require(_0xa78e('0x1'));var Mustache=require(_0xa78e('0x2'));var logger=require('../../../../config/logger')(_0xa78e('0x3'));exports['exec']=function(_0x3867e2,_0x58f172){var _0x5d56c8={'method':_0x3867e2[_0xa78e('0x4')][_0xa78e('0x5')](),'uri':encodeURI(Mustache[_0xa78e('0x6')](_0x3867e2[_0xa78e('0x7')],_0x58f172)),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3867e2[_0xa78e('0x4')][_0xa78e('0x5')]()){case _0xa78e('0x8'):_0x5d56c8['qs']=_0x58f172;break;case _0xa78e('0x9'):_0x5d56c8[_0xa78e('0xa')]=_0x3867e2['data7']?Mustache[_0xa78e('0x6')](_0x3867e2[_0xa78e('0xb')],_0x58f172):_0x58f172;break;}rp(_0x5d56c8)[_0xa78e('0xc')](function(_0xa0b9a2){logger[_0xa78e('0xd')](util[_0xa78e('0xe')](_0xa78e('0xf'),_0x3867e2['data1'],_0x3867e2[_0xa78e('0x7')],_0xa0b9a2['statusCode'],_0xa0b9a2[_0xa78e('0xa')]));})['catch'](function(_0x5c8b13){logger['error'](util[_0xa78e('0xe')](_0xa78e('0x10'),_0x3867e2[_0xa78e('0x4')],_0x3867e2[_0xa78e('0x7')],_0x5c8b13['statusCode'],_0x5c8b13[_0xa78e('0x11')],_0x5c8b13[_0xa78e('0x12')]));});}; \ No newline at end of file +var _0x8a90=['format','statusCode','name','request-promise','util','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','body','data7','then','info'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x8a90,0x179));var _0x08a9=function(_0x55b69e,_0x3ce1f9){_0x55b69e=_0x55b69e-0x0;var _0x403210=_0x8a90[_0x55b69e];return _0x403210;};'use strict';var rp=require(_0x08a9('0x0'));var util=require(_0x08a9('0x1'));var Mustache=require(_0x08a9('0x2'));var logger=require(_0x08a9('0x3'))(_0x08a9('0x4'));exports[_0x08a9('0x5')]=function(_0x3de832,_0x3fb82d){var _0x2af6d2={'method':_0x3de832[_0x08a9('0x6')][_0x08a9('0x7')](),'uri':encodeURI(Mustache[_0x08a9('0x8')](_0x3de832[_0x08a9('0x9')],_0x3fb82d)),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3de832[_0x08a9('0x6')][_0x08a9('0x7')]()){case'GET':_0x2af6d2['qs']=_0x3fb82d;break;case'POST':_0x2af6d2[_0x08a9('0xa')]=_0x3de832['data7']?Mustache[_0x08a9('0x8')](_0x3de832[_0x08a9('0xb')],_0x3fb82d):_0x3fb82d;break;}rp(_0x2af6d2)[_0x08a9('0xc')](function(_0x1937cd){logger[_0x08a9('0xd')](util[_0x08a9('0xe')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20body:\x20%s',_0x3de832[_0x08a9('0x6')],_0x3de832[_0x08a9('0x9')],_0x1937cd[_0x08a9('0xf')],_0x1937cd['body']));})['catch'](function(_0x1cbf8b){logger['error'](util['format']('%s\x20%s\x20%s\x20[%s]:%s',_0x3de832[_0x08a9('0x6')],_0x3de832[_0x08a9('0x9')],_0x1cbf8b[_0x08a9('0xf')],_0x1cbf8b[_0x08a9('0x10')],_0x1cbf8b['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 5effe3a..93e580d 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 _0x7d9f=['routing','client','Request','debug','error','rpc','message','result','catch','exports','jayson/promise','bluebird','../../config/logger'];(function(_0x1d8739,_0xb2e451){var _0x3565d0=function(_0x55a314){while(--_0x55a314){_0x1d8739['push'](_0x1d8739['shift']());}};_0x3565d0(++_0xb2e451);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x3b1705,_0x17bf2e){_0x3b1705=_0x3b1705-0x0;var _0x5157a3=_0x7d9f[_0x3b1705];return _0x5157a3;};'use strict';var jayson=require(_0xf7d9('0x0'));var BPromise=require(_0xf7d9('0x1'));var logger=require(_0xf7d9('0x2'))(_0xf7d9('0x3'));var client=jayson[_0xf7d9('0x4')]['http']({'port':0x2329});client[_0xf7d9('0x5')]=function(_0x1051a9,_0xd43b74){return new BPromise(function(_0x159e95,_0x23cb4c){return client['request'](_0x1051a9,_0xd43b74)['then'](function(_0x2eb0f1){logger[_0xf7d9('0x6')]('rpc',_0xf7d9('0x3'),_0x1051a9,_0xd43b74,_0x2eb0f1);if(_0x2eb0f1[_0xf7d9('0x7')]){logger['error'](_0xf7d9('0x8'),'routing',_0x1051a9,_0x2eb0f1[_0xf7d9('0x7')][_0xf7d9('0x9')],_0xd43b74);return _0x23cb4c(_0x2eb0f1['error']['message']);}else{return _0x159e95(_0x2eb0f1[_0xf7d9('0xa')]);}})[_0xf7d9('0xb')](function(_0x2a14e2){logger['error']('rpc',_0xf7d9('0x3'),_0x1051a9,_0x2a14e2,_0xd43b74);return _0x23cb4c(_0x2a14e2);});});};module[_0xf7d9('0xc')]=client; \ No newline at end of file +var _0x4849=['bluebird','routing','client','http','Request','request','then','debug','rpc','error','message','result','catch','exports','jayson/promise'];(function(_0x4edffa,_0x45d234){var _0x3d490f=function(_0x887d0){while(--_0x887d0){_0x4edffa['push'](_0x4edffa['shift']());}};_0x3d490f(++_0x45d234);}(_0x4849,0x86));var _0x9484=function(_0x1cd279,_0x33bf90){_0x1cd279=_0x1cd279-0x0;var _0x58612b=_0x4849[_0x1cd279];return _0x58612b;};'use strict';var jayson=require(_0x9484('0x0'));var BPromise=require(_0x9484('0x1'));var logger=require('../../config/logger')(_0x9484('0x2'));var client=jayson[_0x9484('0x3')][_0x9484('0x4')]({'port':0x2329});client[_0x9484('0x5')]=function(_0x1f7bd1,_0x3f3057){return new BPromise(function(_0x6ea4d8,_0x47b8ab){return client[_0x9484('0x6')](_0x1f7bd1,_0x3f3057)[_0x9484('0x7')](function(_0x4d8ab1){logger[_0x9484('0x8')](_0x9484('0x9'),_0x9484('0x2'),_0x1f7bd1,_0x3f3057,_0x4d8ab1);if(_0x4d8ab1[_0x9484('0xa')]){logger[_0x9484('0xa')]('rpc',_0x9484('0x2'),_0x1f7bd1,_0x4d8ab1[_0x9484('0xa')][_0x9484('0xb')],_0x3f3057);return _0x47b8ab(_0x4d8ab1[_0x9484('0xa')]['message']);}else{return _0x6ea4d8(_0x4d8ab1[_0x9484('0xc')]);}})[_0x9484('0xd')](function(_0xaeb858){logger[_0x9484('0xa')](_0x9484('0x9'),_0x9484('0x2'),_0x1f7bd1,_0xaeb858,_0x3f3057);return _0x47b8ab(_0xaeb858);});});};module[_0x9484('0xe')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 0e695d2..1e85365 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 _0x8b72=['./rpc/mailAccount','resolve','then','initMailAccounts','log','bluebird','./realtime','./lib/email'];(function(_0x179b53,_0x31f6fe){var _0x38a146=function(_0x33f0c2){while(--_0x33f0c2){_0x179b53['push'](_0x179b53['shift']());}};_0x38a146(++_0x31f6fe);}(_0x8b72,0x155));var _0x28b7=function(_0x3c5b95,_0x51a044){_0x3c5b95=_0x3c5b95-0x0;var _0x3fd575=_0x8b72[_0x3c5b95];return _0x3fd575;};'use strict';var BPromise=require(_0x28b7('0x0'));var server=require('./server');var Realtime=require(_0x28b7('0x1'));var EmailChannel=require(_0x28b7('0x2'));var mailAccount=require(_0x28b7('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x28b7('0x4')]()[_0x28b7('0x5')](mailAccount['getMailAccounts']())[_0x28b7('0x5')](realtime[_0x28b7('0x6')]())['then'](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server['listen'](realtime,email)[_0x28b7('0x5')](function(_0x249511){return initRealtime();})[_0x28b7('0x5')](function(_0xbedcd2){return setInterval(initRealtime,0x2710);})['catch'](function(_0x1875e6){console[_0x28b7('0x7')](_0x1875e6);});}main(); \ No newline at end of file +var _0xe1ae=['then','getMailAccounts','initMailAccounts','listen','catch','log','bluebird','./server','./lib/email','./rpc/mailAccount'];(function(_0x374078,_0x137bb1){var _0x3d1b67=function(_0x136a79){while(--_0x136a79){_0x374078['push'](_0x374078['shift']());}};_0x3d1b67(++_0x137bb1);}(_0xe1ae,0xe2));var _0xee1a=function(_0x5af528,_0x58e09b){_0x5af528=_0x5af528-0x0;var _0x5ad4be=_0xe1ae[_0x5af528];return _0x5ad4be;};'use strict';var BPromise=require(_0xee1a('0x0'));var server=require(_0xee1a('0x1'));var Realtime=require('./realtime');var EmailChannel=require(_0xee1a('0x2'));var mailAccount=require(_0xee1a('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise['resolve']()[_0xee1a('0x4')](mailAccount[_0xee1a('0x5')]())[_0xee1a('0x4')](realtime[_0xee1a('0x6')]())[_0xee1a('0x4')](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xee1a('0x7')](realtime,email)[_0xee1a('0x4')](function(_0x29a760){return initRealtime();})['then'](function(_0x2350fc){return setInterval(initRealtime,0x2710);})[_0xee1a('0x8')](function(_0x3a6876){console[_0xee1a('0x9')](_0x3a6876);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index a9c8086..0f08798 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 _0x7880=['New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','error','messageStatus','send','verifySmtp','Smtp','verify','exports','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','smtp','prototype','emit','name','key','active','Imap','status','total','isNil','mailAccount:update','refresh','imapAccounts','hasOwnProperty','box','bind','email','end','handleImapEnd','handleImapError','handleImapBox','connected','messages','handleImapEmail','info'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7880,0x1f4));var _0x0788=function(_0x416df5,_0x5cd9e7){_0x416df5=_0x416df5-0x0;var _0x53235b=_0x7880[_0x416df5];return _0x53235b;};'use strict';var _=require('lodash');var moment=require(_0x0788('0x0'));var BPromise=require(_0x0788('0x1'));var md5=require(_0x0788('0x2'));var Redis=require(_0x0788('0x3'));var config=require(_0x0788('0x4'));var logger=require(_0x0788('0x5'))('email');config[_0x0788('0x6')]=_[_0x0788('0x7')](config[_0x0788('0x6')],{'host':_0x0788('0x8'),'port':0x18eb});var io=require(_0x0788('0x9'))(new Redis(config[_0x0788('0x6')]));var EmailImap=require(_0x0788('0xa'));var EmailSmtp=require(_0x0788('0xb'));var mailAccount=require(_0x0788('0xc'));var md5Accounts={};function EmailChannel(_0x422f8b){logger['info'](_0x0788('0xd'));this['mailAccounts']=_0x422f8b[_0x0788('0xe')];this['imapAccounts']={};this[_0x0788('0xf')]=new EmailSmtp();}EmailChannel[_0x0788('0x10')][_0x0788('0x11')]=function(_0xee8670){var _0x469ebe=this['mailAccounts'][_0xee8670];var _0x1920b3={'id':_0x469ebe['id'],'name':_0x469ebe[_0x0788('0x12')],'key':_0x469ebe[_0x0788('0x13')],'active':_0x469ebe[_0x0788('0x14')],'Imap':{'status':_0x469ebe[_0x0788('0x15')][_0x0788('0x16')],'messageStatus':_0x469ebe[_0x0788('0x15')]['messageStatus'],'total':_0x469ebe[_0x0788('0x15')][_0x0788('0x17')]}};if(_[_0x0788('0x18')](md5Accounts[_0xee8670])){md5Accounts[_0xee8670]={};}var _0x13cf07=md5(JSON['stringify'](_0x1920b3));if(md5Accounts[_0xee8670][_0x0788('0x2')]!==_0x13cf07){md5Accounts[_0xee8670]['md5']=_0x13cf07;io[_0x0788('0x11')](_0x0788('0x19'),_0x1920b3);}};EmailChannel[_0x0788('0x10')][_0x0788('0x1a')]=function(_0x2ddd1a){for(var _0x430e34 in _0x2ddd1a){if(_0x2ddd1a['hasOwnProperty'](_0x430e34)){if(_0x2ddd1a[_0x430e34]['Imap']&&_0x2ddd1a[_0x430e34][_0x0788('0x14')]){var _0x461d9d=_0x2ddd1a[_0x430e34]['Imap'];if(!this[_0x0788('0x1b')][_0x0788('0x1c')](_0x461d9d['id'])){this[_0x0788('0x1b')][_0x461d9d['id']]=new EmailImap(_0x461d9d,_0x2ddd1a[_0x430e34]['email']);this[_0x0788('0x1b')][_0x461d9d['id']]['on'](_0x0788('0x1d'),this['handleImapBox'][_0x0788('0x1e')](this,_0x430e34));this['imapAccounts'][_0x461d9d['id']]['on'](_0x0788('0x1f'),this['handleImapEmail'][_0x0788('0x1e')](this,_0x430e34));this[_0x0788('0x1b')][_0x461d9d['id']]['on'](_0x0788('0x20'),this[_0x0788('0x21')][_0x0788('0x1e')](this,_0x430e34));this['imapAccounts'][_0x461d9d['id']]['on']('error',this[_0x0788('0x22')][_0x0788('0x1e')](this,_0x430e34));}}else{if(_[_0x0788('0x18')](this[_0x0788('0xe')][_0x430e34]['Imap'])){this['mailAccounts'][_0x430e34][_0x0788('0x15')]={};}this[_0x0788('0xe')][_0x430e34][_0x0788('0x15')]['status']='disabled';this[_0x0788('0xe')][_0x430e34][_0x0788('0x15')]['messageStatus']='';this['emit'](_0x430e34);}}}};EmailChannel[_0x0788('0x10')][_0x0788('0x23')]=function(_0x57fda1,_0x286730){if(this[_0x0788('0xe')][_0x57fda1]){this[_0x0788('0xe')][_0x57fda1][_0x0788('0x15')][_0x0788('0x16')]=_0x0788('0x24');this[_0x0788('0xe')][_0x57fda1][_0x0788('0x15')]['messageStatus']=_0x286730['name'];if(_0x286730[_0x0788('0x25')]){this[_0x0788('0xe')][_0x57fda1]['Imap']['total']=_0x286730[_0x0788('0x25')][_0x0788('0x17')];}return this[_0x0788('0x11')](_0x57fda1);}};EmailChannel[_0x0788('0x10')][_0x0788('0x26')]=function(_0x44bff2,_0x327d67){logger[_0x0788('0x27')](_0x0788('0x28'),_0x327d67[_0x0788('0x29')],_0x327d67['lastName'],_0x327d67[_0x0788('0x2a')],_0x44bff2);if(this[_0x0788('0xe')][_0x44bff2]){return mailAccount[_0x0788('0x2b')](_0x44bff2,_0x327d67)[_0x0788('0x2c')](function(_0xce4534){if(_0xce4534){logger[_0x0788('0x27')](_0x0788('0x2d'));}})[_0x0788('0x2e')](function(_0x1cb6c0){logger[_0x0788('0x2f')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON['stringify'](_0x1cb6c0));});}};EmailChannel['prototype']['handleImapEnd']=function(_0x516cce){if(this['mailAccounts'][_0x516cce]&&this[_0x0788('0xe')][_0x516cce][_0x0788('0x15')]){if(this[_0x0788('0x1b')][this['mailAccounts'][_0x516cce][_0x0788('0x15')]['id']]){delete this[_0x0788('0x1b')][this[_0x0788('0xe')][_0x516cce][_0x0788('0x15')]['id']];}this['mailAccounts'][_0x516cce][_0x0788('0x15')]['lastSync']=moment();this[_0x0788('0x11')](_0x516cce);}};EmailChannel['prototype'][_0x0788('0x22')]=function(_0x1beb1f,_0x498e16){if(this[_0x0788('0xe')][_0x1beb1f]){this[_0x0788('0xe')][_0x1beb1f]['Imap'][_0x0788('0x16')]='error';this[_0x0788('0xe')][_0x1beb1f]['Imap'][_0x0788('0x30')]=_0x498e16;return this['emit'](_0x1beb1f);}};EmailChannel[_0x0788('0x10')]['sendMail']=function(_0x5dc77e,_0x3e31f8){return this[_0x0788('0xf')][_0x0788('0x31')](_0x5dc77e,_0x3e31f8);};EmailChannel[_0x0788('0x10')][_0x0788('0x32')]=function(_0x53da74){var _0x530c5a=this;if(this['mailAccounts'][_0x53da74['id']]){if(_['isNil'](this[_0x0788('0xe')][_0x53da74['id']][_0x0788('0x33')])){this[_0x0788('0xe')][_0x53da74['id']][_0x0788('0x33')]={};}this[_0x0788('0xe')][_0x53da74['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x3d03a4,_0x6770a8){return _0x530c5a[_0x0788('0xf')][_0x0788('0x34')](_0x53da74)[_0x0788('0x2c')](function(_0x4316aa){_0x530c5a[_0x0788('0xe')][_0x53da74['id']][_0x0788('0x33')][_0x0788('0x16')]='verified';_0x530c5a['mailAccounts'][_0x53da74['id']][_0x0788('0x33')][_0x0788('0x30')]='';_0x530c5a[_0x0788('0x11')](_0x53da74['id']);_0x3d03a4(_0x4316aa);})['catch'](function(_0x5ab353){_0x530c5a['mailAccounts'][_0x53da74['id']][_0x0788('0x33')][_0x0788('0x16')]=_0x0788('0x2f');_0x530c5a[_0x0788('0xe')][_0x53da74['id']][_0x0788('0x33')][_0x0788('0x30')]=_0x5ab353;_0x530c5a[_0x0788('0x11')](_0x53da74['id']);_0x6770a8(_0x5ab353);});});}return this[_0x0788('0xf')]['verify'](_0x53da74);};module[_0x0788('0x35')]=EmailChannel; \ No newline at end of file +var _0x82d8=['info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','emit','name','key','active','Imap','status','total','isNil','stringify','md5','mailAccount:update','prototype','refresh','hasOwnProperty','box','handleImapBox','handleImapEmail','end','handleImapEnd','bind','error','handleImapError','disabled','connected','messageStatus','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','verifySmtp','Smtp','verify','verified','lodash','bluebird','../../../config/environment','email','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount'];(function(_0x42198b,_0x1ddbac){var _0x29e902=function(_0x6efaf5){while(--_0x6efaf5){_0x42198b['push'](_0x42198b['shift']());}};_0x29e902(++_0x1ddbac);}(_0x82d8,0xff));var _0x882d=function(_0x5a6fc9,_0x14d507){_0x5a6fc9=_0x5a6fc9-0x0;var _0x32b4e4=_0x82d8[_0x5a6fc9];return _0x32b4e4;};'use strict';var _=require(_0x882d('0x0'));var moment=require('moment');var BPromise=require(_0x882d('0x1'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x882d('0x2'));var logger=require('../../../config/logger')(_0x882d('0x3'));config['redis']=_['defaults'](config[_0x882d('0x4')],{'host':_0x882d('0x5'),'port':0x18eb});var io=require(_0x882d('0x6'))(new Redis(config[_0x882d('0x4')]));var EmailImap=require(_0x882d('0x7'));var EmailSmtp=require(_0x882d('0x8'));var mailAccount=require(_0x882d('0x9'));var md5Accounts={};function EmailChannel(_0x4ea710){logger[_0x882d('0xa')](_0x882d('0xb'));this[_0x882d('0xc')]=_0x4ea710['mailAccounts'];this[_0x882d('0xd')]={};this[_0x882d('0xe')]=new EmailSmtp();}EmailChannel['prototype'][_0x882d('0xf')]=function(_0xa2ca7f){var _0x31d4fe=this['mailAccounts'][_0xa2ca7f];var _0x287672={'id':_0x31d4fe['id'],'name':_0x31d4fe[_0x882d('0x10')],'key':_0x31d4fe[_0x882d('0x11')],'active':_0x31d4fe[_0x882d('0x12')],'Imap':{'status':_0x31d4fe[_0x882d('0x13')][_0x882d('0x14')],'messageStatus':_0x31d4fe[_0x882d('0x13')]['messageStatus'],'total':_0x31d4fe['Imap'][_0x882d('0x15')]}};if(_[_0x882d('0x16')](md5Accounts[_0xa2ca7f])){md5Accounts[_0xa2ca7f]={};}var _0x28170b=md5(JSON[_0x882d('0x17')](_0x287672));if(md5Accounts[_0xa2ca7f][_0x882d('0x18')]!==_0x28170b){md5Accounts[_0xa2ca7f]['md5']=_0x28170b;io[_0x882d('0xf')](_0x882d('0x19'),_0x287672);}};EmailChannel[_0x882d('0x1a')][_0x882d('0x1b')]=function(_0xb217da){for(var _0x202e88 in _0xb217da){if(_0xb217da[_0x882d('0x1c')](_0x202e88)){if(_0xb217da[_0x202e88][_0x882d('0x13')]&&_0xb217da[_0x202e88][_0x882d('0x12')]){var _0x55c09f=_0xb217da[_0x202e88]['Imap'];if(!this[_0x882d('0xd')]['hasOwnProperty'](_0x55c09f['id'])){this[_0x882d('0xd')][_0x55c09f['id']]=new EmailImap(_0x55c09f,_0xb217da[_0x202e88]['email']);this[_0x882d('0xd')][_0x55c09f['id']]['on'](_0x882d('0x1d'),this[_0x882d('0x1e')]['bind'](this,_0x202e88));this[_0x882d('0xd')][_0x55c09f['id']]['on'](_0x882d('0x3'),this[_0x882d('0x1f')]['bind'](this,_0x202e88));this[_0x882d('0xd')][_0x55c09f['id']]['on'](_0x882d('0x20'),this[_0x882d('0x21')][_0x882d('0x22')](this,_0x202e88));this[_0x882d('0xd')][_0x55c09f['id']]['on'](_0x882d('0x23'),this[_0x882d('0x24')][_0x882d('0x22')](this,_0x202e88));}}else{if(_[_0x882d('0x16')](this['mailAccounts'][_0x202e88][_0x882d('0x13')])){this['mailAccounts'][_0x202e88][_0x882d('0x13')]={};}this[_0x882d('0xc')][_0x202e88][_0x882d('0x13')][_0x882d('0x14')]=_0x882d('0x25');this['mailAccounts'][_0x202e88][_0x882d('0x13')]['messageStatus']='';this[_0x882d('0xf')](_0x202e88);}}}};EmailChannel[_0x882d('0x1a')]['handleImapBox']=function(_0x4e68af,_0x508003){if(this['mailAccounts'][_0x4e68af]){this[_0x882d('0xc')][_0x4e68af][_0x882d('0x13')][_0x882d('0x14')]=_0x882d('0x26');this['mailAccounts'][_0x4e68af][_0x882d('0x13')][_0x882d('0x27')]=_0x508003[_0x882d('0x10')];if(_0x508003[_0x882d('0x28')]){this[_0x882d('0xc')][_0x4e68af]['Imap']['total']=_0x508003['messages'][_0x882d('0x15')];}return this[_0x882d('0xf')](_0x4e68af);}};EmailChannel[_0x882d('0x1a')]['handleImapEmail']=function(_0x4488fd,_0x199e38){logger[_0x882d('0xa')](_0x882d('0x29'),_0x199e38[_0x882d('0x2a')],_0x199e38[_0x882d('0x2b')],_0x199e38['from'],_0x4488fd);if(this[_0x882d('0xc')][_0x4488fd]){return mailAccount['notify'](_0x4488fd,_0x199e38)[_0x882d('0x2c')](function(_0x5c3efb){if(_0x5c3efb){logger[_0x882d('0xa')]('Mail\x20accepted\x20from\x20routing');}})[_0x882d('0x2d')](function(_0x296a1f){logger[_0x882d('0x23')](_0x882d('0x2e'),JSON[_0x882d('0x17')](_0x296a1f));});}};EmailChannel['prototype'][_0x882d('0x21')]=function(_0x4a4a72){if(this[_0x882d('0xc')][_0x4a4a72]&&this[_0x882d('0xc')][_0x4a4a72][_0x882d('0x13')]){if(this[_0x882d('0xd')][this[_0x882d('0xc')][_0x4a4a72][_0x882d('0x13')]['id']]){delete this['imapAccounts'][this['mailAccounts'][_0x4a4a72]['Imap']['id']];}this[_0x882d('0xc')][_0x4a4a72][_0x882d('0x13')][_0x882d('0x2f')]=moment();this[_0x882d('0xf')](_0x4a4a72);}};EmailChannel[_0x882d('0x1a')]['handleImapError']=function(_0x3f6d2f,_0x1751b5){if(this[_0x882d('0xc')][_0x3f6d2f]){this[_0x882d('0xc')][_0x3f6d2f][_0x882d('0x13')][_0x882d('0x14')]=_0x882d('0x23');this[_0x882d('0xc')][_0x3f6d2f][_0x882d('0x13')]['messageStatus']=_0x1751b5;return this['emit'](_0x3f6d2f);}};EmailChannel['prototype'][_0x882d('0x30')]=function(_0x3fca04,_0x1aec6f){return this[_0x882d('0xe')]['send'](_0x3fca04,_0x1aec6f);};EmailChannel['prototype'][_0x882d('0x31')]=function(_0x21dd0e){var _0x31b4bf=this;if(this['mailAccounts'][_0x21dd0e['id']]){if(_[_0x882d('0x16')](this[_0x882d('0xc')][_0x21dd0e['id']]['Smtp'])){this[_0x882d('0xc')][_0x21dd0e['id']][_0x882d('0x32')]={};}this['mailAccounts'][_0x21dd0e['id']][_0x882d('0x32')][_0x882d('0x2f')]=moment();return new BPromise(function(_0x3c9f3a,_0x39a18e){return _0x31b4bf[_0x882d('0xe')][_0x882d('0x33')](_0x21dd0e)[_0x882d('0x2c')](function(_0x5d5a61){_0x31b4bf[_0x882d('0xc')][_0x21dd0e['id']][_0x882d('0x32')][_0x882d('0x14')]=_0x882d('0x34');_0x31b4bf[_0x882d('0xc')][_0x21dd0e['id']]['Smtp'][_0x882d('0x27')]='';_0x31b4bf[_0x882d('0xf')](_0x21dd0e['id']);_0x3c9f3a(_0x5d5a61);})[_0x882d('0x2d')](function(_0x263525){_0x31b4bf[_0x882d('0xc')][_0x21dd0e['id']][_0x882d('0x32')][_0x882d('0x14')]=_0x882d('0x23');_0x31b4bf[_0x882d('0xc')][_0x21dd0e['id']]['Smtp']['messageStatus']=_0x263525;_0x31b4bf[_0x882d('0xf')](_0x21dd0e['id']);_0x39a18e(_0x263525);});});}return this[_0x882d('0xe')][_0x882d('0x33')](_0x21dd0e);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 935dc8d..1bdc820 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 _0xde36=['handleSimpleParser','stringify','textCode','exports','path','util','imap','lodash','randomstring','mailparser','simpleParser','EventEmitter','../../../config/logger','email','INBOX','account','getAccount','ready','handleReady','once','end','bind','error','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','openBox','mailbox','handleOpenBox','handleError','emit','box','readUnseen','handleCloseBox','search','handleReadUnseen','fetch','handleFetchError','closeBox','handleFetchMessage','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody'];(function(_0x344d6d,_0x264fd6){var _0xc6f1b2=function(_0x4642bb){while(--_0x4642bb){_0x344d6d['push'](_0x344d6d['shift']());}};_0xc6f1b2(++_0x264fd6);}(_0xde36,0x1d4));var _0x6de3=function(_0x50d59f,_0x4046f1){_0x50d59f=_0x50d59f-0x0;var _0x4ec085=_0xde36[_0x50d59f];return _0x4ec085;};'use strict';var fs=require('fs');var path=require(_0x6de3('0x0'));var util=require(_0x6de3('0x1'));var Imap=require(_0x6de3('0x2'));var _=require(_0x6de3('0x3'));var rs=require(_0x6de3('0x4'));var simpleParser=require(_0x6de3('0x5'))[_0x6de3('0x6')];var EventEmitter=require('events')[_0x6de3('0x7')];var utils=require('./utils');var logger=require(_0x6de3('0x8'))(_0x6de3('0x9'));function EmailImap(_0x5062a8,_0x47cd1b){this['mailbox']=_0x6de3('0xa');this[_0x6de3('0xb')]=this[_0x6de3('0xc')](_0x5062a8,_0x47cd1b);this['imap']=new Imap(this[_0x6de3('0xb')]);this['imap']['once'](_0x6de3('0xd'),this[_0x6de3('0xe')]['bind'](this));this[_0x6de3('0x2')][_0x6de3('0xf')](_0x6de3('0x10'),this['handleEnd'][_0x6de3('0x11')](this));this[_0x6de3('0x2')]['on'](_0x6de3('0x12'),this['handleError']['bind'](this));this[_0x6de3('0x2')]['connect']();}util[_0x6de3('0x13')](EmailImap,EventEmitter);EmailImap[_0x6de3('0x14')][_0x6de3('0xc')]=function(_0x55f035,_0x524241){var _0x11c1aa={'connTimeout':_0x55f035[_0x6de3('0x15')]?_0x55f035[_0x6de3('0x15')]*0x3e8:0x2710,'authTimeout':_0x55f035[_0x6de3('0x16')]?_0x55f035[_0x6de3('0x16')]*0x3e8:0x1388};if(_[_0x6de3('0x17')](_0x55f035[_0x6de3('0x18')])){if(_0x55f035[_0x6de3('0x19')]){_0x11c1aa['user']=_0x55f035[_0x6de3('0x1a')];_0x11c1aa[_0x6de3('0x1b')]=_0x55f035[_0x6de3('0x1b')];}_0x11c1aa[_0x6de3('0x1c')]=_0x55f035['host'];_0x11c1aa[_0x6de3('0x1d')]=_0x55f035[_0x6de3('0x1d')]||0x3e1;if(_0x55f035[_0x6de3('0x1e')]){_0x11c1aa['tls']=!![];}else{_0x11c1aa[_0x6de3('0x1e')]=![];_0x11c1aa[_0x6de3('0x1f')]=_0x6de3('0x20');}}else{_0x11c1aa['user']=_0x55f035[_0x6de3('0x1a')];_0x11c1aa[_0x6de3('0x1b')]=_0x55f035[_0x6de3('0x1b')];_0x11c1aa['host']=utils[_0x6de3('0x21')](_0x55f035[_0x6de3('0x18')]);_0x11c1aa[_0x6de3('0x1d')]=0x3e1;_0x11c1aa[_0x6de3('0x1e')]=!![];}_0x11c1aa['email']=_0x524241||_0x55f035[_0x6de3('0x1a')]||_0x6de3('0x22');return _0x11c1aa;};EmailImap['prototype'][_0x6de3('0xe')]=function(){this[_0x6de3('0x2')][_0x6de3('0x23')](this[_0x6de3('0x24')],![],this['handleOpenBox'][_0x6de3('0x11')](this));};EmailImap['prototype'][_0x6de3('0x25')]=function(_0x3e06bc,_0x59f469){if(_0x3e06bc){this[_0x6de3('0x26')](_0x3e06bc,!![]);}else{this[_0x6de3('0x27')](_0x6de3('0x28'),_0x59f469);this[_0x6de3('0x29')]();}};EmailImap[_0x6de3('0x14')][_0x6de3('0x2a')]=function(_0x166bcb){if(_0x166bcb){this[_0x6de3('0x26')](_0x166bcb,!![]);}else{this['imap'][_0x6de3('0x10')]();}};EmailImap[_0x6de3('0x14')][_0x6de3('0x29')]=function(){this['imap'][_0x6de3('0x2b')](['UNSEEN'],this['handleReadUnseen'][_0x6de3('0x11')](this));};EmailImap[_0x6de3('0x14')][_0x6de3('0x2c')]=function(_0x54c71b,_0x464099){if(_0x54c71b){this['handleError'](_0x54c71b,!![]);}else{if(_0x464099['length']){try{var _0x671b92=this['imap'][_0x6de3('0x2d')](_0x464099,{'bodies':'','markSeen':!![]});_0x671b92['on']('message',this['handleFetchMessage'][_0x6de3('0x11')](this));_0x671b92['once'](_0x6de3('0x12'),this[_0x6de3('0x2e')][_0x6de3('0x11')](this));_0x671b92['once']('end',this['handleFetchEnd'][_0x6de3('0x11')](this));}catch(_0x317695){logger['error'](_0x317695);}}else{this[_0x6de3('0x2')][_0x6de3('0x2f')](!![],this['handleCloseBox'][_0x6de3('0x11')](this));}}};EmailImap[_0x6de3('0x14')][_0x6de3('0x30')]=function(_0x1214c1,_0x3e490c){_0x1214c1['on'](_0x6de3('0x31'),this['handleMessageBody']['bind'](this));_0x1214c1[_0x6de3('0xf')](_0x6de3('0x32'),this[_0x6de3('0x33')][_0x6de3('0x11')](this));_0x1214c1[_0x6de3('0xf')](_0x6de3('0x10'),this[_0x6de3('0x34')][_0x6de3('0x11')](this));};EmailImap[_0x6de3('0x14')][_0x6de3('0x35')]=function(_0xbff762,_0x6ca03b){simpleParser(_0xbff762,this[_0x6de3('0x36')]['bind'](this));};EmailImap['prototype'][_0x6de3('0x33')]=function(_0x210782){};EmailImap[_0x6de3('0x14')][_0x6de3('0x34')]=function(){};EmailImap[_0x6de3('0x14')]['handleSimpleParser']=function(_0x3b57e0,_0xd472e2){if(_0x3b57e0){logger[_0x6de3('0x12')](_0x3b57e0);}else{var _0x41ee57=this;utils['parser'](this[_0x6de3('0xb')],_0xd472e2,function(_0xb7b2ff){_0x41ee57[_0x6de3('0x27')]('email',_0xb7b2ff);});}};EmailImap[_0x6de3('0x14')]['handleFetchEnd']=function(){this[_0x6de3('0x2')][_0x6de3('0x2f')](!![],this['handleCloseBox'][_0x6de3('0x11')](this));};EmailImap[_0x6de3('0x14')][_0x6de3('0x2e')]=function(_0xab733f){this[_0x6de3('0x26')](_0xab733f);this[_0x6de3('0x2')]['closeBox'](!![],this[_0x6de3('0x2a')][_0x6de3('0x11')](this));};EmailImap['prototype']['handleEnd']=function(){this['emit'](_0x6de3('0x10'));};EmailImap[_0x6de3('0x14')]['handleError']=function(_0x2d5aec,_0x38b9d8){logger[_0x6de3('0x12')]('handleError',this[_0x6de3('0xb')][_0x6de3('0x9')],JSON[_0x6de3('0x37')](_0x2d5aec));var _0x15215c='';if(_0x2d5aec){if(_0x2d5aec[_0x6de3('0x38')]){_0x15215c=_0x2d5aec[_0x6de3('0x38')];}else{for(var _0xc17253 in _0x2d5aec){if(_0x2d5aec['hasOwnProperty'](_0xc17253)){_0x15215c+=_['upperFirst'](_0xc17253)+':\x20'+_0x2d5aec[_0xc17253]+'\x0a';}}}}if(_0x38b9d8){this[_0x6de3('0x2')][_0x6de3('0x10')]();}else{this[_0x6de3('0x27')](_0x6de3('0x12'),_0x15215c);this[_0x6de3('0x27')](_0x6de3('0x10'));}};module[_0x6de3('0x39')]=EmailImap; \ No newline at end of file +var _0x2bbe=['inherits','prototype','connTimeout','isNil','service','password','host','port','tls','autotls','required','user','getHost','anonymous@xcally.com','handleOpenBox','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','error','handleFetchError','end','handleFetchEnd','closeBox','handleCloseBox','body','handleMessageBody','handleSimpleParser','handleMessageAttributes','parser','handleEnd','stringify','textCode','exports','util','lodash','randomstring','mailparser','simpleParser','events','EventEmitter','./utils','../../../config/logger','email','mailbox','account','getAccount','imap','ready','handleReady','once','bind','handleError','connect'];(function(_0x57dd6b,_0x2576b2){var _0x33b58f=function(_0x57953a){while(--_0x57953a){_0x57dd6b['push'](_0x57dd6b['shift']());}};_0x33b58f(++_0x2576b2);}(_0x2bbe,0x1cc));var _0xe2bb=function(_0x5d4742,_0x5a5b5f){_0x5d4742=_0x5d4742-0x0;var _0x2a9cf0=_0x2bbe[_0x5d4742];return _0x2a9cf0;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0xe2bb('0x0'));var Imap=require('imap');var _=require(_0xe2bb('0x1'));var rs=require(_0xe2bb('0x2'));var simpleParser=require(_0xe2bb('0x3'))[_0xe2bb('0x4')];var EventEmitter=require(_0xe2bb('0x5'))[_0xe2bb('0x6')];var utils=require(_0xe2bb('0x7'));var logger=require(_0xe2bb('0x8'))(_0xe2bb('0x9'));function EmailImap(_0x350ab3,_0x2b95c9){this[_0xe2bb('0xa')]='INBOX';this[_0xe2bb('0xb')]=this[_0xe2bb('0xc')](_0x350ab3,_0x2b95c9);this[_0xe2bb('0xd')]=new Imap(this[_0xe2bb('0xb')]);this['imap']['once'](_0xe2bb('0xe'),this[_0xe2bb('0xf')]['bind'](this));this['imap'][_0xe2bb('0x10')]('end',this['handleEnd'][_0xe2bb('0x11')](this));this[_0xe2bb('0xd')]['on']('error',this[_0xe2bb('0x12')][_0xe2bb('0x11')](this));this[_0xe2bb('0xd')][_0xe2bb('0x13')]();}util[_0xe2bb('0x14')](EmailImap,EventEmitter);EmailImap[_0xe2bb('0x15')][_0xe2bb('0xc')]=function(_0x4ecfb5,_0x2e65b1){var _0x3120e5={'connTimeout':_0x4ecfb5[_0xe2bb('0x16')]?_0x4ecfb5[_0xe2bb('0x16')]*0x3e8:0x2710,'authTimeout':_0x4ecfb5['authTimeout']?_0x4ecfb5['authTimeout']*0x3e8:0x1388};if(_[_0xe2bb('0x17')](_0x4ecfb5[_0xe2bb('0x18')])){if(_0x4ecfb5['authentication']){_0x3120e5['user']=_0x4ecfb5['user'];_0x3120e5[_0xe2bb('0x19')]=_0x4ecfb5[_0xe2bb('0x19')];}_0x3120e5[_0xe2bb('0x1a')]=_0x4ecfb5[_0xe2bb('0x1a')];_0x3120e5[_0xe2bb('0x1b')]=_0x4ecfb5[_0xe2bb('0x1b')]||0x3e1;if(_0x4ecfb5[_0xe2bb('0x1c')]){_0x3120e5[_0xe2bb('0x1c')]=!![];}else{_0x3120e5[_0xe2bb('0x1c')]=![];_0x3120e5[_0xe2bb('0x1d')]=_0xe2bb('0x1e');}}else{_0x3120e5[_0xe2bb('0x1f')]=_0x4ecfb5[_0xe2bb('0x1f')];_0x3120e5[_0xe2bb('0x19')]=_0x4ecfb5[_0xe2bb('0x19')];_0x3120e5[_0xe2bb('0x1a')]=utils[_0xe2bb('0x20')](_0x4ecfb5['service']);_0x3120e5['port']=0x3e1;_0x3120e5[_0xe2bb('0x1c')]=!![];}_0x3120e5[_0xe2bb('0x9')]=_0x2e65b1||_0x4ecfb5[_0xe2bb('0x1f')]||_0xe2bb('0x21');return _0x3120e5;};EmailImap[_0xe2bb('0x15')]['handleReady']=function(){this[_0xe2bb('0xd')]['openBox'](this['mailbox'],![],this[_0xe2bb('0x22')][_0xe2bb('0x11')](this));};EmailImap[_0xe2bb('0x15')][_0xe2bb('0x22')]=function(_0x1fb62c,_0x457f19){if(_0x1fb62c){this[_0xe2bb('0x12')](_0x1fb62c,!![]);}else{this[_0xe2bb('0x23')](_0xe2bb('0x24'),_0x457f19);this[_0xe2bb('0x25')]();}};EmailImap['prototype']['handleCloseBox']=function(_0x88c22e){if(_0x88c22e){this[_0xe2bb('0x12')](_0x88c22e,!![]);}else{this[_0xe2bb('0xd')]['end']();}};EmailImap[_0xe2bb('0x15')][_0xe2bb('0x25')]=function(){this[_0xe2bb('0xd')][_0xe2bb('0x26')]([_0xe2bb('0x27')],this[_0xe2bb('0x28')]['bind'](this));};EmailImap[_0xe2bb('0x15')][_0xe2bb('0x28')]=function(_0x4af12a,_0x2a1322){if(_0x4af12a){this['handleError'](_0x4af12a,!![]);}else{if(_0x2a1322[_0xe2bb('0x29')]){try{var _0x3d9d3b=this[_0xe2bb('0xd')][_0xe2bb('0x2a')](_0x2a1322,{'bodies':'','markSeen':!![]});_0x3d9d3b['on'](_0xe2bb('0x2b'),this[_0xe2bb('0x2c')][_0xe2bb('0x11')](this));_0x3d9d3b[_0xe2bb('0x10')](_0xe2bb('0x2d'),this[_0xe2bb('0x2e')][_0xe2bb('0x11')](this));_0x3d9d3b['once'](_0xe2bb('0x2f'),this[_0xe2bb('0x30')]['bind'](this));}catch(_0x7112c5){logger[_0xe2bb('0x2d')](_0x7112c5);}}else{this[_0xe2bb('0xd')][_0xe2bb('0x31')](!![],this[_0xe2bb('0x32')][_0xe2bb('0x11')](this));}}};EmailImap[_0xe2bb('0x15')][_0xe2bb('0x2c')]=function(_0x14e378,_0x53e0eb){_0x14e378['on'](_0xe2bb('0x33'),this[_0xe2bb('0x34')][_0xe2bb('0x11')](this));_0x14e378[_0xe2bb('0x10')]('attributes',this['handleMessageAttributes'][_0xe2bb('0x11')](this));_0x14e378[_0xe2bb('0x10')](_0xe2bb('0x2f'),this['handleMessageEnd'][_0xe2bb('0x11')](this));};EmailImap[_0xe2bb('0x15')][_0xe2bb('0x34')]=function(_0xb060c9,_0xbaeee6){simpleParser(_0xb060c9,this[_0xe2bb('0x35')][_0xe2bb('0x11')](this));};EmailImap['prototype'][_0xe2bb('0x36')]=function(_0x4725be){};EmailImap[_0xe2bb('0x15')]['handleMessageEnd']=function(){};EmailImap[_0xe2bb('0x15')][_0xe2bb('0x35')]=function(_0x27e1e,_0x37675f){if(_0x27e1e){logger[_0xe2bb('0x2d')](_0x27e1e);}else{var _0x41148b=this;utils[_0xe2bb('0x37')](this[_0xe2bb('0xb')],_0x37675f,function(_0x20f14d){_0x41148b[_0xe2bb('0x23')](_0xe2bb('0x9'),_0x20f14d);});}};EmailImap[_0xe2bb('0x15')][_0xe2bb('0x30')]=function(){this[_0xe2bb('0xd')][_0xe2bb('0x31')](!![],this['handleCloseBox'][_0xe2bb('0x11')](this));};EmailImap[_0xe2bb('0x15')]['handleFetchError']=function(_0x3ba16d){this[_0xe2bb('0x12')](_0x3ba16d);this[_0xe2bb('0xd')][_0xe2bb('0x31')](!![],this[_0xe2bb('0x32')][_0xe2bb('0x11')](this));};EmailImap['prototype'][_0xe2bb('0x38')]=function(){this[_0xe2bb('0x23')](_0xe2bb('0x2f'));};EmailImap[_0xe2bb('0x15')]['handleError']=function(_0x5643e2,_0x3043e1){logger[_0xe2bb('0x2d')](_0xe2bb('0x12'),this['account'][_0xe2bb('0x9')],JSON[_0xe2bb('0x39')](_0x5643e2));var _0x27102d='';if(_0x5643e2){if(_0x5643e2[_0xe2bb('0x3a')]){_0x27102d=_0x5643e2['textCode'];}else{for(var _0x55ad06 in _0x5643e2){if(_0x5643e2['hasOwnProperty'](_0x55ad06)){_0x27102d+=_['upperFirst'](_0x55ad06)+':\x20'+_0x5643e2[_0x55ad06]+'\x0a';}}}}if(_0x3043e1){this[_0xe2bb('0xd')][_0xe2bb('0x2f')]();}else{this['emit'](_0xe2bb('0x2d'),_0x27102d);this[_0xe2bb('0x23')](_0xe2bb('0x2f'));}};module[_0xe2bb('0x3b')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 2d97955..96d8d07 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 _0xb63e=['bluebird','nodemailer-plugin-inline-base64','prototype','send','compile','toString','verify','createTransport','Not\x20verifired'];(function(_0x3268b6,_0x1ce753){var _0x15a59b=function(_0x1012e){while(--_0x1012e){_0x3268b6['push'](_0x3268b6['shift']());}};_0x15a59b(++_0x1ce753);}(_0xb63e,0x129));var _0xeb63=function(_0x20ed6d,_0x13b54b){_0x20ed6d=_0x20ed6d-0x0;var _0x342ce9=_0xb63e[_0x20ed6d];return _0x342ce9;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0xeb63('0x0'));var inlineBase64=require(_0xeb63('0x1'));function EmailSmtp(){}EmailSmtp[_0xeb63('0x2')][_0xeb63('0x3')]=function(_0x2ad5e2,_0x19b289){return new BPromise(function(_0x1d6e1a,_0x3650f7){var _0x1c4963=nodemailer['createTransport'](_0x2ad5e2);_0x1c4963['use'](_0xeb63('0x4'),inlineBase64());_0x1c4963['sendMail'](_0x19b289,function(_0x2b8602,_0xa094ea){if(_0x2b8602){_0x3650f7(_0x2b8602[_0xeb63('0x5')]());}else{_0x1d6e1a(_0xa094ea);}});});};EmailSmtp['prototype'][_0xeb63('0x6')]=function(_0x203c4c){return new BPromise(function(_0x1b7d82,_0x5dffce){var _0xf6c48d=nodemailer[_0xeb63('0x7')](_0x203c4c);_0xf6c48d[_0xeb63('0x6')](function(_0x2f1205,_0x50a580){if(_0x2f1205){_0x5dffce(_0x2f1205[_0xeb63('0x5')]());}else{if(_0x50a580){_0x1b7d82(_0x50a580);}else{_0x5dffce(_0xeb63('0x8'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x482a=['verify','Not\x20verifired','nodemailer','bluebird','send','createTransport','use','compile','sendMail','toString'];(function(_0x167b19,_0x56081a){var _0x1fcca2=function(_0x544ca4){while(--_0x544ca4){_0x167b19['push'](_0x167b19['shift']());}};_0x1fcca2(++_0x56081a);}(_0x482a,0xd4));var _0xa482=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x482a[_0x1f9f37];return _0x21c080;};'use strict';var nodemailer=require(_0xa482('0x0'));var BPromise=require(_0xa482('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp['prototype'][_0xa482('0x2')]=function(_0x37be32,_0x11d42c){return new BPromise(function(_0x5b68c5,_0x5ba3a1){var _0x4b3ad7=nodemailer[_0xa482('0x3')](_0x37be32);_0x4b3ad7[_0xa482('0x4')](_0xa482('0x5'),inlineBase64());_0x4b3ad7[_0xa482('0x6')](_0x11d42c,function(_0x5d75b7,_0x5815d5){if(_0x5d75b7){_0x5ba3a1(_0x5d75b7[_0xa482('0x7')]());}else{_0x5b68c5(_0x5815d5);}});});};EmailSmtp['prototype'][_0xa482('0x8')]=function(_0x5d9e15){return new BPromise(function(_0x195d19,_0x38f80f){var _0x127aa8=nodemailer[_0xa482('0x3')](_0x5d9e15);_0x127aa8[_0xa482('0x8')](function(_0x514b41,_0x109981){if(_0x514b41){_0x38f80f(_0x514b41['toString']());}else{if(_0x109981){_0x195d19(_0x109981);}else{_0x38f80f(_0xa482('0x9'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index e74dd91..def3f31 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 _0x22e9=['Attachments','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','util','../../../config/logger','email','../../../config/environment','value','address','anonymous','generate','@xcally.com','head','name','slice','join','Anonymous','pop','length','isEmpty','html','test','replace','body','textAsHtml','Empty\x20message

'];(function(_0x26e727,_0x3e65be){var _0x563800=function(_0xbcf999){while(--_0xbcf999){_0x26e727['push'](_0x26e727['shift']());}};_0x563800(++_0x3e65be);}(_0x22e9,0x10e));var _0x922e=function(_0x36daf3,_0x2ea0dd){_0x36daf3=_0x36daf3-0x0;var _0x3e4e26=_0x22e9[_0x36daf3];return _0x3e4e26;};'use strict';var _=require(_0x922e('0x0'));var moment=require(_0x922e('0x1'));var random=require('randomstring');var fs=require('fs');var path=require('path');var util=require(_0x922e('0x2'));var tnef=require('node-tnef');var logger=require(_0x922e('0x3'))(_0x922e('0x4'));var config=require(_0x922e('0x5'));function getAddress(_0x3adab7){var _0x464edf=_['head'](_0x3adab7[_0x922e('0x6')]);return _0x464edf&&_0x464edf[_0x922e('0x7')]?_0x464edf[_0x922e('0x7')]:_0x922e('0x8')+random[_0x922e('0x9')](0x6)+_0x922e('0xa');}function getFirstName(_0x472379){var _0x2cf152=_[_0x922e('0xb')](_0x472379[_0x922e('0x6')]);if(_0x2cf152&&_0x2cf152[_0x922e('0xc')]){var _0x485803=_0x2cf152[_0x922e('0xc')]['split'](/\s+/);return _0x485803['length']?_0x485803[_0x922e('0xd')](0x0,-0x1)[_0x922e('0xe')]('\x20'):_0x2cf152['name'];}return _0x922e('0xf');}function getLastName(_0x2618f5){var _0x373511=_[_0x922e('0xb')](_0x2618f5[_0x922e('0x6')]);if(_0x373511&&_0x373511[_0x922e('0xc')]){var _0x314526=_0x373511[_0x922e('0xc')]['split'](/\s+/);return _0x314526['length']>0x1?_0x314526[_0x922e('0x10')]():'';}return'';}function getMails(_0x46df86,_0x51274e){var _0x568f7e='';for(var _0x2aa155=0x0;_0x2aa155<_0x51274e[_0x922e('0x6')][_0x922e('0x11')];_0x2aa155+=0x1){if(_0x51274e['value'][_0x2aa155][_0x922e('0x7')]!==_0x46df86){if(!_[_0x922e('0x12')](_0x568f7e)){_0x568f7e+=',';}_0x568f7e+=_0x51274e[_0x922e('0x6')][_0x2aa155][_0x922e('0xc')]||_0x51274e['value'][_0x2aa155][_0x922e('0x7')]||'';_0x568f7e+='\x20<';_0x568f7e+=_0x51274e[_0x922e('0x6')][_0x2aa155][_0x922e('0x7')]?_0x51274e[_0x922e('0x6')][_0x2aa155][_0x922e('0x7')]:_0x922e('0x8')+random[_0x922e('0x9')](0x6)+_0x922e('0xa');_0x568f7e+='>';}}return _0x568f7e;}function parseEmail(_0x4bfc38,_0x458fb9,_0x5b6e39){if(_0x458fb9[_0x922e('0x13')]){var _0x40f4a6=/)<[^<]*)*<\/script>/gi;while(_0x40f4a6[_0x922e('0x14')](_0x458fb9['html'])){_0x458fb9[_0x922e('0x13')]=_0x458fb9[_0x922e('0x13')][_0x922e('0x15')](_0x40f4a6,'');}_0x5b6e39[_0x922e('0x16')]=_0x458fb9[_0x922e('0x13')];}else{_0x5b6e39[_0x922e('0x16')]=_0x458fb9[_0x922e('0x17')];}if(_0x5b6e39[_0x922e('0x16')]){_0x5b6e39[_0x922e('0x16')]=_0x5b6e39[_0x922e('0x16')]['replace'](/Empty\x20message

','getHost','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail'];(function(_0x5da97f,_0x2f868e){var _0x24133f=function(_0x2d5243){while(--_0x2d5243){_0x5da97f['push'](_0x5da97f['shift']());}};_0x24133f(++_0x2f868e);}(_0x6599,0x8e));var _0x9659=function(_0x19f5fc,_0x4c658a){_0x19f5fc=_0x19f5fc-0x0;var _0x315fa3=_0x6599[_0x19f5fc];return _0x315fa3;};'use strict';var _=require(_0x9659('0x0'));var moment=require(_0x9659('0x1'));var random=require(_0x9659('0x2'));var fs=require('fs');var path=require('path');var util=require(_0x9659('0x3'));var tnef=require(_0x9659('0x4'));var logger=require('../../../config/logger')(_0x9659('0x5'));var config=require(_0x9659('0x6'));function getAddress(_0x5a1f90){var _0x296b14=_[_0x9659('0x7')](_0x5a1f90['value']);return _0x296b14&&_0x296b14[_0x9659('0x8')]?_0x296b14[_0x9659('0x8')]:_0x9659('0x9')+random[_0x9659('0xa')](0x6)+_0x9659('0xb');}function getFirstName(_0x4916e1){var _0x4f11b8=_[_0x9659('0x7')](_0x4916e1[_0x9659('0xc')]);if(_0x4f11b8&&_0x4f11b8[_0x9659('0xd')]){var _0x1e149c=_0x4f11b8['name'][_0x9659('0xe')](/\s+/);return _0x1e149c[_0x9659('0xf')]?_0x1e149c[_0x9659('0x10')](0x0,-0x1)[_0x9659('0x11')]('\x20'):_0x4f11b8[_0x9659('0xd')];}return _0x9659('0x12');}function getLastName(_0x1da54c){var _0x24fbfd=_[_0x9659('0x7')](_0x1da54c[_0x9659('0xc')]);if(_0x24fbfd&&_0x24fbfd[_0x9659('0xd')]){var _0x34bbcd=_0x24fbfd[_0x9659('0xd')][_0x9659('0xe')](/\s+/);return _0x34bbcd[_0x9659('0xf')]>0x1?_0x34bbcd[_0x9659('0x13')]():'';}return'';}function getMails(_0x34ea3d,_0x3d0651){var _0x228a3c='';for(var _0x468347=0x0;_0x468347<_0x3d0651['value']['length'];_0x468347+=0x1){if(_0x3d0651[_0x9659('0xc')][_0x468347][_0x9659('0x8')]!==_0x34ea3d){if(!_['isEmpty'](_0x228a3c)){_0x228a3c+=',';}_0x228a3c+=_0x3d0651[_0x9659('0xc')][_0x468347][_0x9659('0xd')]||_0x3d0651[_0x9659('0xc')][_0x468347][_0x9659('0x8')]||'';_0x228a3c+='\x20<';_0x228a3c+=_0x3d0651[_0x9659('0xc')][_0x468347][_0x9659('0x8')]?_0x3d0651[_0x9659('0xc')][_0x468347][_0x9659('0x8')]:_0x9659('0x9')+random[_0x9659('0xa')](0x6)+_0x9659('0xb');_0x228a3c+='>';}}return _0x228a3c;}function parseEmail(_0x58fcc2,_0x148112,_0x581960){if(_0x148112[_0x9659('0x14')]){var _0x30e5b6=/)<[^<]*)*<\/script>/gi;while(_0x30e5b6[_0x9659('0x15')](_0x148112['html'])){_0x148112[_0x9659('0x14')]=_0x148112['html'][_0x9659('0x16')](_0x30e5b6,'');}_0x581960['body']=_0x148112[_0x9659('0x14')];}else{_0x581960[_0x9659('0x17')]=_0x148112[_0x9659('0x18')];}if(_0x581960[_0x9659('0x17')]){_0x581960[_0x9659('0x17')]=_0x581960[_0x9659('0x17')][_0x9659('0x16')](/Empty\x20message

';if(_0x84642b[_0x9659('0x37')]){for(var _0x3d67cb=0x0;_0x3d67cb<_0x84642b[_0x9659('0x37')][_0x9659('0xf')];_0x3d67cb++){var _0x4d1d39=_0x84642b[_0x9659('0x37')][_0x3d67cb];_0x44c7e6[_0x9659('0x1c')][_0x9659('0x20')][_0x9659('0x38')]({'filename':_0x4d1d39[_0x9659('0x39')],'content':new Buffer(_0x4d1d39[_0x9659('0x3a')])});}}}_0x1cb79d(parseEmail(_0x3a8f14,_0x4b566e,_0x44c7e6));});}else{_0x4b566e[_0x9659('0x14')]=_0x9659('0x3b');_0x1cb79d(parseEmail(_0x3a8f14,_0x4b566e,_0x44c7e6));}}else{_0x1cb79d(parseEmail(_0x3a8f14,_0x4b566e,_0x44c7e6));}};exports[_0x9659('0x3c')]=function(_0x5646e6){switch(_0x5646e6){case _0x9659('0x3d'):return _0x9659('0x3e');case'yahoo':return _0x9659('0x3f');case _0x9659('0x40'):return _0x9659('0x41');case _0x9659('0x42'):return _0x9659('0x43');}return _0x9659('0x44');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index f46f884..001adc6 100644 --- a/server/services/email/model/mailAccount.js +++ b/server/services/email/model/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcfd2=['Smtp','lodash','name','Service','key','SERV','active','Imap'];(function(_0x532234,_0x2153ed){var _0x5c9a5d=function(_0x4ad8a0){while(--_0x4ad8a0){_0x532234['push'](_0x532234['shift']());}};_0x5c9a5d(++_0x2153ed);}(_0xcfd2,0xe9));var _0x2cfd=function(_0x4aba25,_0x43eac0){_0x4aba25=_0x4aba25-0x0;var _0x104dd1=_0xcfd2[_0x4aba25];return _0x104dd1;};'use strict';var _=require(_0x2cfd('0x0'));function MailAccount(_0x305627){this['id']=_0x305627['id']||0x0;this[_0x2cfd('0x1')]=_0x305627[_0x2cfd('0x1')]||_0x2cfd('0x2');this[_0x2cfd('0x3')]=_0x305627['key']||_0x2cfd('0x4');this[_0x2cfd('0x5')]=_0x305627[_0x2cfd('0x5')]||![];this[_0x2cfd('0x6')]=_0x305627['Imap']||[];this[_0x2cfd('0x7')]=_0x305627[_0x2cfd('0x7')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x5ddc=['SERV','active','Imap','Smtp','exports','name','Service','key'];(function(_0x139b39,_0x54e5ff){var _0x453730=function(_0x477e3d){while(--_0x477e3d){_0x139b39['push'](_0x139b39['shift']());}};_0x453730(++_0x54e5ff);}(_0x5ddc,0x13d));var _0xc5dd=function(_0x5d25df,_0x237636){_0x5d25df=_0x5d25df-0x0;var _0x92f972=_0x5ddc[_0x5d25df];return _0x92f972;};'use strict';var _=require('lodash');function MailAccount(_0x2ece55){this['id']=_0x2ece55['id']||0x0;this[_0xc5dd('0x0')]=_0x2ece55[_0xc5dd('0x0')]||_0xc5dd('0x1');this[_0xc5dd('0x2')]=_0x2ece55[_0xc5dd('0x2')]||_0xc5dd('0x3');this[_0xc5dd('0x4')]=_0x2ece55[_0xc5dd('0x4')]||![];this[_0xc5dd('0x5')]=_0x2ece55[_0xc5dd('0x5')]||[];this[_0xc5dd('0x6')]=_0x2ece55[_0xc5dd('0x6')]||[];}module[_0xc5dd('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 80180c7..822baaf 100644 --- a/server/services/email/realtime/index.js +++ b/server/services/email/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9582=['prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty'];(function(_0x10bcc4,_0x4400e2){var _0x2da988=function(_0x2ee849){while(--_0x2ee849){_0x10bcc4['push'](_0x10bcc4['shift']());}};_0x2da988(++_0x4400e2);}(_0x9582,0x95));var _0x2958=function(_0x3528e2,_0xb88709){_0x3528e2=_0x3528e2-0x0;var _0x186226=_0x9582[_0x3528e2];return _0x186226;};'use strict';var _=require(_0x2958('0x0'));var MailAccount=require(_0x2958('0x1'));var Realtime=function(){this[_0x2958('0x2')]={};};function freeIsNotKey(_0x3d6d1f,_0x42752c,_0x176287){var _0x559a01=_[_0x2958('0x3')](_0x3d6d1f,function(_0x3b907e,_0x136c77){return _0x3b907e[_0x176287];});for(var _0x195138 in _0x42752c){if(_0x42752c[_0x2958('0x4')](_0x195138)){if(!_0x559a01[_0x195138]){delete _0x42752c[_0x195138];}}}}Realtime[_0x2958('0x5')][_0x2958('0x6')]=function(_0x309525,_0xa385ec){for(var _0x2e571b in _0xa385ec){if(_0x309525['hasOwnProperty'](_0x2e571b)){_0x309525[_0x2e571b]=_0xa385ec[_0x2e571b];}}};Realtime['prototype'][_0x2958('0x7')]=function(){var _0x52076d=this;return function(_0x10db1e){if(_0x10db1e){freeIsNotKey(_0x10db1e,_0x52076d['mailAccounts'],'id');for(var _0x44cccc=0x0,_0x5ef23c={},_0x3aacfa={};_0x44cccc<_0x10db1e[_0x2958('0x8')];_0x44cccc+=0x1){_0x5ef23c=_0x10db1e[_0x44cccc];if(_[_0x2958('0x9')](_0x52076d[_0x2958('0x2')][_0x5ef23c['id']])){_0x52076d[_0x2958('0x2')][_0x5ef23c['id']]=new MailAccount(_0x5ef23c);}else{_['merge'](_0x52076d[_0x2958('0x2')][_0x5ef23c['id']],_0x5ef23c);}}}return _0x52076d[_0x2958('0x2')];};};module[_0x2958('0xa')]=Realtime; \ No newline at end of file +var _0xd943=['../model/mailAccount','mailAccounts','mapKeys','prototype','hasOwnProperty','length','isUndefined','merge','exports','lodash'];(function(_0x33154d,_0x854047){var _0x3b2f03=function(_0x35f7a6){while(--_0x35f7a6){_0x33154d['push'](_0x33154d['shift']());}};_0x3b2f03(++_0x854047);}(_0xd943,0x15d));var _0x3d94=function(_0x10fa69,_0x1ce92a){_0x10fa69=_0x10fa69-0x0;var _0x2edc4c=_0xd943[_0x10fa69];return _0x2edc4c;};'use strict';var _=require(_0x3d94('0x0'));var MailAccount=require(_0x3d94('0x1'));var Realtime=function(){this[_0x3d94('0x2')]={};};function freeIsNotKey(_0x440dd8,_0x5495df,_0x691e28){var _0x3edd1b=_[_0x3d94('0x3')](_0x440dd8,function(_0xc13b61,_0xaf8962){return _0xc13b61[_0x691e28];});for(var _0x5751f6 in _0x5495df){if(_0x5495df['hasOwnProperty'](_0x5751f6)){if(!_0x3edd1b[_0x5751f6]){delete _0x5495df[_0x5751f6];}}}}Realtime[_0x3d94('0x4')]['mergeFromDatabase']=function(_0x54e81f,_0x4d29e7){for(var _0x20f4d1 in _0x4d29e7){if(_0x54e81f[_0x3d94('0x5')](_0x20f4d1)){_0x54e81f[_0x20f4d1]=_0x4d29e7[_0x20f4d1];}}};Realtime['prototype']['initMailAccounts']=function(){var _0x3984a3=this;return function(_0x27e381){if(_0x27e381){freeIsNotKey(_0x27e381,_0x3984a3[_0x3d94('0x2')],'id');for(var _0x5908a7=0x0,_0x182066={},_0x4ac968={};_0x5908a7<_0x27e381[_0x3d94('0x6')];_0x5908a7+=0x1){_0x182066=_0x27e381[_0x5908a7];if(_[_0x3d94('0x7')](_0x3984a3['mailAccounts'][_0x182066['id']])){_0x3984a3[_0x3d94('0x2')][_0x182066['id']]=new MailAccount(_0x182066);}else{_[_0x3d94('0x8')](_0x3984a3[_0x3d94('0x2')][_0x182066['id']],_0x182066);}}}return _0x3984a3[_0x3d94('0x2')];};};module[_0x3d94('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 57cc705..c927b96 100644 --- a/server/services/email/rpc/mailAccount.js +++ b/server/services/email/rpc/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8218=['Smtp','getMailAccount','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','key','ListId','TemplateId','Imap'];(function(_0x37ea7f,_0x24e456){var _0x449bdd=function(_0x16bf5e){while(--_0x16bf5e){_0x37ea7f['push'](_0x37ea7f['shift']());}};_0x449bdd(++_0x24e456);}(_0x8218,0xb3));var _0x8821=function(_0x47d11c,_0x4815d2){_0x47d11c=_0x47d11c-0x0;var _0x45b959=_0x8218[_0x47d11c];return _0x45b959;};'use strict';var client=require(_0x8821('0x0'));exports[_0x8821('0x1')]=function(){return function(){return client[_0x8821('0x2')](_0x8821('0x3'),{'options':{'attributes':['id','name','service','email','active',_0x8821('0x4'),_0x8821('0x5'),_0x8821('0x6')],'raw':![],'include':[{'model':'MailServerIn','as':_0x8821('0x7')},{'model':'MailServerOut','as':_0x8821('0x8')}]},'log':_0x8821('0x9')});};};exports['notify']=function(_0x387f3a,_0x58ca1c){return client[_0x8821('0x2')](_0x8821('0xa'),{'account':{'id':_0x387f3a},'body':_0x58ca1c,'log':_0x8821('0xa')});}; \ No newline at end of file +var _0xdcab=['ListId','TemplateId','MailServerIn','Imap','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','active','key'];(function(_0x1460f6,_0x59051a){var _0x46ce94=function(_0x1c3ddf){while(--_0x1c3ddf){_0x1460f6['push'](_0x1460f6['shift']());}};_0x46ce94(++_0x59051a);}(_0xdcab,0x1e9));var _0xbdca=function(_0x29797a,_0x153c8a){_0x29797a=_0x29797a-0x0;var _0x211150=_0xdcab[_0x29797a];return _0x211150;};'use strict';var client=require(_0xbdca('0x0'));exports[_0xbdca('0x1')]=function(){return function(){return client[_0xbdca('0x2')](_0xbdca('0x3'),{'options':{'attributes':['id',_0xbdca('0x4'),'service','email',_0xbdca('0x5'),_0xbdca('0x6'),_0xbdca('0x7'),_0xbdca('0x8')],'raw':![],'include':[{'model':_0xbdca('0x9'),'as':_0xbdca('0xa')},{'model':_0xbdca('0xb'),'as':_0xbdca('0xc')}]},'log':_0xbdca('0xd')});};};exports[_0xbdca('0xe')]=function(_0x4cde25,_0x1e46b9){return client['Request'](_0xbdca('0xf'),{'account':{'id':_0x4cde25},'body':_0x1e46b9,'log':_0xbdca('0xf')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index fc137db..cb5614f 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x94d4=['length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','../../../config/logger','email','listen','message','then','error','verifySmtp','values','mailAccounts'];(function(_0x546a64,_0x3218be){var _0x55fb81=function(_0xce20d1){while(--_0xce20d1){_0x546a64['push'](_0x546a64['shift']());}};_0x55fb81(++_0x3218be);}(_0x94d4,0xa5));var _0x494d=function(_0x27c96e,_0x2074ef){_0x27c96e=_0x27c96e-0x0;var _0x1dea73=_0x94d4[_0x27c96e];return _0x1dea73;};'use strict';var jayson=require(_0x494d('0x0'));var BPromise=require(_0x494d('0x1'));var _=require('lodash');var logger=require(_0x494d('0x2'))(_0x494d('0x3'));exports[_0x494d('0x4')]=function(_0x48923d,_0x196e00){return new BPromise(function(_0xc32573,_0x1849e0){var _0x38f96d={'SendMail':function(_0x46b8d8){var _0x1772bd=this;return new Promise(function(_0x595c04,_0x4c53d7){_0x196e00['sendMail'](_0x46b8d8['account'],_0x46b8d8[_0x494d('0x5')])[_0x494d('0x6')](function(_0x5408b3){_0x595c04({'code':0xc8,'message':_0x5408b3});})['catch'](function(_0x456fe8){_0x4c53d7(_0x1772bd[_0x494d('0x7')](0x1f4,_0x456fe8));});});},'VerifySmtp':function(_0x4f99d0){var _0x376694=this;return new Promise(function(_0x28bff7,_0x163bdb){_0x196e00[_0x494d('0x8')](_0x4f99d0['account'])[_0x494d('0x6')](function(_0x1bcfb8){_0x28bff7({'code':0xc8,'message':'Verified'});})['catch'](function(_0x56fc3a){_0x163bdb(_0x376694[_0x494d('0x7')](0x1f4,_0x56fc3a));});});},'MailAccounts':function(_0x41e92f){return new Promise(function(_0xfba01a,_0x25f188){var _0x3bc5c9=_[_0x494d('0x9')](_0x48923d[_0x494d('0xa')]);for(var _0x1529ca=0x0;_0x1529ca<_0x3bc5c9[_0x494d('0xb')];_0x1529ca+=0x1){if(_0x3bc5c9[_0x1529ca][_0x494d('0xc')]&&_0x3bc5c9[_0x1529ca][_0x494d('0xc')]['password']){delete _0x3bc5c9[_0x1529ca][_0x494d('0xc')][_0x494d('0xd')];}if(_0x3bc5c9[_0x1529ca][_0x494d('0xe')]&&_0x3bc5c9[_0x1529ca][_0x494d('0xe')][_0x494d('0xf')]){delete _0x3bc5c9[_0x1529ca][_0x494d('0xe')][_0x494d('0xf')];}}_0xfba01a({'count':_0x3bc5c9[_0x494d('0xb')],'rows':_0x3bc5c9});});}};var _0x4301fc=jayson[_0x494d('0x10')](_0x38f96d)[_0x494d('0x11')]();_0x4301fc['on'](_0x494d('0x7'),function(_0xb2fc39){logger[_0x494d('0x7')](JSON[_0x494d('0x12')](_0xb2fc39));return _0x1849e0(_0xb2fc39);});_0x4301fc[_0x494d('0x4')](0x232b,_0x494d('0x13'),function(){console['log'](_0x494d('0x14'),0x232b);return _0xc32573(_0x494d('0x15')+0x232b);});});}; \ No newline at end of file +var _0x5fdc=['length','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','jayson/promise','bluebird','lodash','../../../config/logger','email','listen','then','catch','verifySmtp','account','Verified','error','values','mailAccounts','Imap','password','pass'];(function(_0x235486,_0x3f1886){var _0x5480f6=function(_0x1814c7){while(--_0x1814c7){_0x235486['push'](_0x235486['shift']());}};_0x5480f6(++_0x3f1886);}(_0x5fdc,0x127));var _0xc5fd=function(_0x170507,_0x669120){_0x170507=_0x170507-0x0;var _0x29be07=_0x5fdc[_0x170507];return _0x29be07;};'use strict';var jayson=require(_0xc5fd('0x0'));var BPromise=require(_0xc5fd('0x1'));var _=require(_0xc5fd('0x2'));var logger=require(_0xc5fd('0x3'))(_0xc5fd('0x4'));exports[_0xc5fd('0x5')]=function(_0x3be451,_0x4d015c){return new BPromise(function(_0xfdf928,_0x1b6205){var _0xca27a0={'SendMail':function(_0xea5748){var _0x44722b=this;return new Promise(function(_0x216902,_0x15ffe7){_0x4d015c['sendMail'](_0xea5748['account'],_0xea5748['message'])[_0xc5fd('0x6')](function(_0x46bce3){_0x216902({'code':0xc8,'message':_0x46bce3});})[_0xc5fd('0x7')](function(_0x45c91f){_0x15ffe7(_0x44722b['error'](0x1f4,_0x45c91f));});});},'VerifySmtp':function(_0x4e1e94){var _0x3442dd=this;return new Promise(function(_0x1edeec,_0x39a95a){_0x4d015c[_0xc5fd('0x8')](_0x4e1e94[_0xc5fd('0x9')])[_0xc5fd('0x6')](function(_0x484bbd){_0x1edeec({'code':0xc8,'message':_0xc5fd('0xa')});})['catch'](function(_0x558939){_0x39a95a(_0x3442dd[_0xc5fd('0xb')](0x1f4,_0x558939));});});},'MailAccounts':function(_0x1bc6d1){return new Promise(function(_0x3fa7c4,_0x23ac5d){var _0x2e77a8=_[_0xc5fd('0xc')](_0x3be451[_0xc5fd('0xd')]);for(var _0xa7a954=0x0;_0xa7a954<_0x2e77a8['length'];_0xa7a954+=0x1){if(_0x2e77a8[_0xa7a954][_0xc5fd('0xe')]&&_0x2e77a8[_0xa7a954][_0xc5fd('0xe')][_0xc5fd('0xf')]){delete _0x2e77a8[_0xa7a954][_0xc5fd('0xe')]['password'];}if(_0x2e77a8[_0xa7a954]['Smtp']&&_0x2e77a8[_0xa7a954]['Smtp']['pass']){delete _0x2e77a8[_0xa7a954]['Smtp'][_0xc5fd('0x10')];}}_0x3fa7c4({'count':_0x2e77a8[_0xc5fd('0x11')],'rows':_0x2e77a8});});}};var _0x27f611=jayson[_0xc5fd('0x12')](_0xca27a0)[_0xc5fd('0x13')]();_0x27f611['on'](_0xc5fd('0xb'),function(_0xfd14c7){logger['error'](JSON[_0xc5fd('0x14')](_0xfd14c7));return _0x1b6205(_0xfd14c7);});_0x27f611[_0xc5fd('0x5')](0x232b,_0xc5fd('0x15'),function(){console[_0xc5fd('0x16')](_0xc5fd('0x17'),0x232b);return _0xfdf928('RPC\x20listening\x20on\x20port:'+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index ccd7f1a..f86243b 100644 --- a/server/services/express/index.js +++ b/server/services/express/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x22fb=['../../config/express','../../routes','log','express','ioredis','../../config/environment','createServer','timeout','listen','socket.io','websocket','polling','redis','defaults','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio'];(function(_0x151259,_0x353230){var _0x4d3afc=function(_0x447eee){while(--_0x447eee){_0x151259['push'](_0x151259['shift']());}};_0x4d3afc(++_0x353230);}(_0x22fb,0x192));var _0xb22f=function(_0x5b365e,_0x143400){_0x5b365e=_0x5b365e-0x0;var _0x24048a=_0x22fb[_0x5b365e];return _0x24048a;};'use strict';var _=require('lodash');var http=require('http');var express=require(_0xb22f('0x0'));var sticky=require('sticky-session');var Redis=require(_0xb22f('0x1'));var config=require(_0xb22f('0x2'));var app=express();var server=http[_0xb22f('0x3')](app);server[_0xb22f('0x4')]=0xdbba0;if(sticky[_0xb22f('0x5')](server,config['port'])){var socketio=require(_0xb22f('0x6'))(server,{'transports':[_0xb22f('0x7'),_0xb22f('0x8')]});config[_0xb22f('0x9')]=_[_0xb22f('0xa')](config[_0xb22f('0x9')],{'host':'localhost','port':0x18eb});socketio[_0xb22f('0xb')](require(_0xb22f('0xc'))({'pubClient':new Redis(config[_0xb22f('0x9')]),'subClient':new Redis(config[_0xb22f('0x9')])}));require(_0xb22f('0xd'))[_0xb22f('0xe')]();require(_0xb22f('0xf'))[_0xb22f('0xe')](socketio);require(_0xb22f('0x10'))[_0xb22f('0xe')](app);require(_0xb22f('0x11'))['default'](app);}else{server['once']('listening',function(){console[_0xb22f('0x12')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config['port']);});}exports=module['exports']=app; \ No newline at end of file +var _0x0faf=['socket.io','polling','redis','defaults','localhost','socket.io-redis','default','../../config/socketio','../../config/express','../../routes','once','log','lodash','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port'];(function(_0x31bab3,_0x44554f){var _0x4fd382=function(_0x42b336){while(--_0x42b336){_0x31bab3['push'](_0x31bab3['shift']());}};_0x4fd382(++_0x44554f);}(_0x0faf,0x132));var _0xf0fa=function(_0x3be7ff,_0x12e714){_0x3be7ff=_0x3be7ff-0x0;var _0x186721=_0x0faf[_0x3be7ff];return _0x186721;};'use strict';var _=require(_0xf0fa('0x0'));var http=require('http');var express=require(_0xf0fa('0x1'));var sticky=require(_0xf0fa('0x2'));var Redis=require(_0xf0fa('0x3'));var config=require(_0xf0fa('0x4'));var app=express();var server=http[_0xf0fa('0x5')](app);server[_0xf0fa('0x6')]=0xdbba0;if(sticky[_0xf0fa('0x7')](server,config[_0xf0fa('0x8')])){var socketio=require(_0xf0fa('0x9'))(server,{'transports':['websocket',_0xf0fa('0xa')]});config[_0xf0fa('0xb')]=_[_0xf0fa('0xc')](config[_0xf0fa('0xb')],{'host':_0xf0fa('0xd'),'port':0x18eb});socketio['adapter'](require(_0xf0fa('0xe'))({'pubClient':new Redis(config[_0xf0fa('0xb')]),'subClient':new Redis(config['redis'])}));require('../../config/triggers')[_0xf0fa('0xf')]();require(_0xf0fa('0x10'))[_0xf0fa('0xf')](socketio);require(_0xf0fa('0x11'))[_0xf0fa('0xf')](app);require(_0xf0fa('0x12'))[_0xf0fa('0xf')](app);}else{server[_0xf0fa('0x13')]('listening',function(){console[_0xf0fa('0x14')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0xf0fa('0x8')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 912cc3f..1a9b263 100644 --- a/server/services/routing/client.js +++ b/server/services/routing/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4d9=['routing','client','http','Request','then','debug','error','message','result','catch','rpc','exports','jayson/promise','../../config/logger'];(function(_0x56f7e2,_0x145392){var _0x36240b=function(_0x216ff7){while(--_0x216ff7){_0x56f7e2['push'](_0x56f7e2['shift']());}};_0x36240b(++_0x145392);}(_0xf4d9,0x7c));var _0x9f4d=function(_0x270b3f,_0x28b81a){_0x270b3f=_0x270b3f-0x0;var _0x2e3391=_0xf4d9[_0x270b3f];return _0x2e3391;};'use strict';var jayson=require(_0x9f4d('0x0'));var BPromise=require('bluebird');var logger=require(_0x9f4d('0x1'))(_0x9f4d('0x2'));var client=jayson[_0x9f4d('0x3')][_0x9f4d('0x4')]({'port':0x2329});client[_0x9f4d('0x5')]=function(_0x47aa76,_0x179d90){return new BPromise(function(_0x9ee061,_0x10086a){return client['request'](_0x47aa76,_0x179d90)[_0x9f4d('0x6')](function(_0x370059){logger[_0x9f4d('0x7')]('rpc',_0x9f4d('0x2'),_0x47aa76,_0x179d90,_0x370059);if(_0x370059['error']){logger[_0x9f4d('0x8')]('rpc',_0x9f4d('0x2'),_0x47aa76,_0x370059[_0x9f4d('0x8')][_0x9f4d('0x9')],_0x179d90);return _0x10086a(_0x370059[_0x9f4d('0x8')]['message']);}else{return _0x9ee061(_0x370059[_0x9f4d('0xa')]);}})[_0x9f4d('0xb')](function(_0x474cc6){logger[_0x9f4d('0x8')](_0x9f4d('0xc'),_0x9f4d('0x2'),_0x47aa76,_0x474cc6,_0x179d90);return _0x10086a(_0x474cc6);});});};module[_0x9f4d('0xd')]=client; \ No newline at end of file +var _0x9a22=['routing','client','http','Request','request','then','debug','rpc','error','message','result','exports','jayson/promise','bluebird','../../config/logger'];(function(_0x473ee7,_0x4dd754){var _0x30f0d4=function(_0x4d961d){while(--_0x4d961d){_0x473ee7['push'](_0x473ee7['shift']());}};_0x30f0d4(++_0x4dd754);}(_0x9a22,0x75));var _0x29a2=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x9a22[_0x92c450];return _0x2a9599;};'use strict';var jayson=require(_0x29a2('0x0'));var BPromise=require(_0x29a2('0x1'));var logger=require(_0x29a2('0x2'))(_0x29a2('0x3'));var client=jayson[_0x29a2('0x4')][_0x29a2('0x5')]({'port':0x2329});client[_0x29a2('0x6')]=function(_0x4cbd7e,_0x4e617e){return new BPromise(function(_0x427d51,_0x2855c8){return client[_0x29a2('0x7')](_0x4cbd7e,_0x4e617e)[_0x29a2('0x8')](function(_0x261835){logger[_0x29a2('0x9')](_0x29a2('0xa'),_0x29a2('0x3'),_0x4cbd7e,_0x4e617e,_0x261835);if(_0x261835['error']){logger[_0x29a2('0xb')](_0x29a2('0xa'),'routing',_0x4cbd7e,_0x261835[_0x29a2('0xb')][_0x29a2('0xc')],_0x4e617e);return _0x2855c8(_0x261835['error'][_0x29a2('0xc')]);}else{return _0x427d51(_0x261835[_0x29a2('0xd')]);}})['catch'](function(_0x18acae){logger[_0x29a2('0xb')](_0x29a2('0xa'),_0x29a2('0x3'),_0x4cbd7e,_0x18acae,_0x4e617e);return _0x2855c8(_0x18acae);});});};module[_0x29a2('0xe')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 5106951..50033b8 100644 --- a/server/services/routing/index.js +++ b/server/services/routing/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x72d4=['initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','getMailQueues','getFaxQueues','initFaxQueues','catch','log','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','getAgents','then'];(function(_0x58c3ea,_0x292bb0){var _0x46ba72=function(_0x222bc4){while(--_0x222bc4){_0x58c3ea['push'](_0x58c3ea['shift']());}};_0x46ba72(++_0x292bb0);}(_0x72d4,0xfd));var _0x472d=function(_0x491677,_0x11aa43){_0x491677=_0x491677-0x0;var _0x5a3dcb=_0x72d4[_0x491677];return _0x5a3dcb;};'use strict';var BPromise=require('bluebird');var server=require(_0x472d('0x0'));var Realtime=require(_0x472d('0x1'));var user=require(_0x472d('0x2'));var interval=require(_0x472d('0x3'));var openchannelQueue=require(_0x472d('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x472d('0x5'));var mailQueue=require(_0x472d('0x6'));var faxQueue=require(_0x472d('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x472d('0x8')]()['then'](user[_0x472d('0x9')]())[_0x472d('0xa')](realtime['initAgents']())[_0x472d('0xa')](interval['getIntervals']())[_0x472d('0xa')](realtime[_0x472d('0xb')]())[_0x472d('0xa')](openchannelQueue[_0x472d('0xc')]())['then'](realtime[_0x472d('0xd')]())[_0x472d('0xa')](chatQueue[_0x472d('0xe')]())[_0x472d('0xa')](realtime[_0x472d('0xf')]())[_0x472d('0xa')](smsQueue[_0x472d('0x10')]())['then'](realtime['initSmsQueues']())[_0x472d('0xa')](mailQueue[_0x472d('0x11')]())[_0x472d('0xa')](realtime['initMailQueues']())[_0x472d('0xa')](faxQueue[_0x472d('0x12')]())['then'](realtime[_0x472d('0x13')]())[_0x472d('0xa')](function(){return realtime;});}function main(){return server['listen'](realtime)['then'](function(_0x4929f6){return initRealtime();})[_0x472d('0xa')](function(_0x516306){return setInterval(initRealtime,0x1388);})[_0x472d('0x14')](function(_0x2c954b){console[_0x472d('0x15')](_0x2c954b);});}main(); \ No newline at end of file +var _0xa148=['initAgents','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','listen','catch','log','bluebird','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','resolve','then','getAgents'];(function(_0x7d62cb,_0x7622c){var _0x3a6266=function(_0x1cc5fa){while(--_0x1cc5fa){_0x7d62cb['push'](_0x7d62cb['shift']());}};_0x3a6266(++_0x7622c);}(_0xa148,0x12e));var _0x8a14=function(_0x1a8f48,_0x2b7159){_0x1a8f48=_0x1a8f48-0x0;var _0x3ff375=_0xa148[_0x1a8f48];return _0x3ff375;};'use strict';var BPromise=require(_0x8a14('0x0'));var server=require('./server');var Realtime=require('./realtime');var user=require(_0x8a14('0x1'));var interval=require(_0x8a14('0x2'));var openchannelQueue=require(_0x8a14('0x3'));var chatQueue=require(_0x8a14('0x4'));var smsQueue=require(_0x8a14('0x5'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x8a14('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x8a14('0x7')]()[_0x8a14('0x8')](user[_0x8a14('0x9')]())[_0x8a14('0x8')](realtime[_0x8a14('0xa')]())[_0x8a14('0x8')](interval['getIntervals']())['then'](realtime[_0x8a14('0xb')]())[_0x8a14('0x8')](openchannelQueue[_0x8a14('0xc')]())['then'](realtime[_0x8a14('0xd')]())[_0x8a14('0x8')](chatQueue[_0x8a14('0xe')]())[_0x8a14('0x8')](realtime['initChatQueues']())['then'](smsQueue[_0x8a14('0xf')]())[_0x8a14('0x8')](realtime[_0x8a14('0x10')]())[_0x8a14('0x8')](mailQueue[_0x8a14('0x11')]())[_0x8a14('0x8')](realtime[_0x8a14('0x12')]())[_0x8a14('0x8')](faxQueue[_0x8a14('0x13')]())[_0x8a14('0x8')](realtime[_0x8a14('0x14')]())[_0x8a14('0x8')](function(){return realtime;});}function main(){return server[_0x8a14('0x15')](realtime)[_0x8a14('0x8')](function(_0xb0123d){return initRealtime();})[_0x8a14('0x8')](function(_0x36b54e){return setInterval(initRealtime,0x1388);})[_0x8a14('0x16')](function(_0x4915e2){console[_0x8a14('0x17')](_0x4915e2);});}main(); \ No newline at end of file diff --git a/server/services/routing/lib/rule-engine.js b/server/services/routing/lib/rule-engine.js index 96d5d57..3e43d83 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4420=['lodash','util','events','EventEmitter','init','isNil','register','ignoreFactChanges','prototype','rules','isArray','concat','isObject','sync','activeRules','filter','asc','execute','clone','ruleRef','index_','nextTick','push','call','next','isEqual','restart','condition','matchPath','noop','matches','turn','findRules','prioritize','length','toJSON','toString','consequence','isString','parse','map','exports'];(function(_0x2338bd,_0x3fd343){var _0x195b13=function(_0xdf461e){while(--_0xdf461e){_0x2338bd['push'](_0x2338bd['shift']());}};_0x195b13(++_0x3fd343);}(_0x4420,0x126));var _0x0442=function(_0x466968,_0x42f1a6){_0x466968=_0x466968-0x0;var _0x270d27=_0x4420[_0x466968];return _0x270d27;};'use strict';var _=require(_0x0442('0x0'));var util=require(_0x0442('0x1'));var EventEmitter=require(_0x0442('0x2'))[_0x0442('0x3')];function RuleEngine(_0x322a63,_0x263b49){this[_0x0442('0x4')]();if(!_[_0x0442('0x5')](_0x322a63)){this[_0x0442('0x6')](_0x322a63);}if(_0x263b49){this[_0x0442('0x7')]=_0x263b49[_0x0442('0x7')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine[_0x0442('0x8')][_0x0442('0x4')]=function(_0x12eb69){this[_0x0442('0x9')]=[];this['activeRules']=[];};RuleEngine[_0x0442('0x8')][_0x0442('0x6')]=function(_0x2f600b){if(Array[_0x0442('0xa')](_0x2f600b)){this[_0x0442('0x9')]=this['rules'][_0x0442('0xb')](_0x2f600b);}else if(_0x2f600b!==null&&_[_0x0442('0xc')](_0x2f600b)){this[_0x0442('0x9')]['push'](_0x2f600b);}this[_0x0442('0xd')]();};RuleEngine[_0x0442('0x8')][_0x0442('0xd')]=function(){this[_0x0442('0xe')]=this[_0x0442('0x9')][_0x0442('0xf')](function(_0x241ef0){if(_['isNil'](_0x241ef0['on'])){_0x241ef0['on']=!![];}if(_0x241ef0['on']===!![]){return _0x241ef0;}});this[_0x0442('0xe')]=_['orderBy'](this['activeRules'],['p'],[_0x0442('0x10')]);};RuleEngine[_0x0442('0x8')][_0x0442('0x11')]=function(_0x59f1fb,_0x425939){var _0x37e3ba=![];_0x59f1fb['result']=!![];var _0x73cf46=_['clone'](_0x59f1fb);var _0x1671d2=_[_0x0442('0x12')](_0x59f1fb);var _0x5543db=this[_0x0442('0xe')];var _0x2edffa=[];var _0x1f4aa1=this[_0x0442('0x7')];(function FnRuleLoop(_0x595585){var _0x598ecf={'rules':function(){return _0x5543db;},'rule':function(){return _0x5543db[_0x595585];},'when':function(_0x19b9b5){if(_0x19b9b5){var _0x48b5f2=_0x5543db[_0x595585]['consequence'];_0x48b5f2[_0x0442('0x13')]=_0x5543db[_0x595585]['id']||_0x5543db[_0x595585]['name']||_0x0442('0x14')+_0x595585;process[_0x0442('0x15')](function(){_0x2edffa[_0x0442('0x16')](_0x48b5f2[_0x0442('0x13')]);_0x48b5f2[_0x0442('0x17')](_0x73cf46,_0x598ecf);});}else{process['nextTick'](function(){_0x598ecf[_0x0442('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x37e3ba=!![];return FnRuleLoop(0x0);},'next':function(_0x24bb00){if(!_0x1f4aa1&&!_[_0x0442('0x19')](_0x1671d2,_0x73cf46)){_0x1671d2=_[_0x0442('0x12')](_0x73cf46);process[_0x0442('0x15')](function(){_0x598ecf[_0x0442('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x0442('0x5')](_0x24bb00)){return FnRuleLoop(_0x595585+0x1);}else{return FnRuleLoop(_0x24bb00);}});}}};if(_0x595585<_0x5543db['length']&&_0x37e3ba===![]){var _0x1e70fd=_0x5543db[_0x595585][_0x0442('0x1b')];_0x1e70fd[_0x0442('0x17')](_0x73cf46,_0x598ecf);}else{process[_0x0442('0x15')](function(){_0x73cf46[_0x0442('0x1c')]=_0x2edffa;return _0x425939?_0x425939(_0x73cf46):_[_0x0442('0x1d')]();});}}(0x0));};RuleEngine[_0x0442('0x8')]['findRules']=function(_0x103a76){if(_[_0x0442('0x5')](_0x103a76)){return this[_0x0442('0x9')];}else{var _0x2e6cb9=_[_0x0442('0x1e')](_0x103a76);return _['filter'](this[_0x0442('0x9')],_0x2e6cb9);}};RuleEngine[_0x0442('0x8')][_0x0442('0x1f')]=function(_0x41f6f4,_0xdf8fef){var _0x41f6f4=_0x41f6f4==='on'||_0x41f6f4==='ON'?!![]:![];var _0x853d76=this[_0x0442('0x20')](_0xdf8fef);for(var _0x46a2a2=0x0,_0x128fc8=_0x853d76['length'];_0x46a2a2<_0x128fc8;_0x46a2a2+=0x1){_0x853d76[_0x46a2a2]['on']=_0x41f6f4;}this['sync']();};RuleEngine['prototype'][_0x0442('0x21')]=function(_0xaff4d5,_0x1f5f48){_0xaff4d5=parseInt(_0xaff4d5,0xa);var _0x2cad8f=this['findRules'](_0x1f5f48);for(var _0x440694=0x0,_0xcd48ed=_0x2cad8f[_0x0442('0x22')];_0x440694<_0xcd48ed;_0x440694+=0x1){_0x2cad8f[_0x440694]['priority']=_0xaff4d5;}this[_0x0442('0xd')]();};RuleEngine[_0x0442('0x8')][_0x0442('0x23')]=function(){var _0x8b1d53=this[_0x0442('0x9')];if(_0x8b1d53 instanceof Array){_0x8b1d53=_0x8b1d53['map'](function(_0x424f7c){_0x424f7c[_0x0442('0x1b')]=_0x424f7c['condition'][_0x0442('0x24')]();_0x424f7c[_0x0442('0x25')]=_0x424f7c['consequence']['toString']();return _0x424f7c;});}else if(!_[_0x0442('0x5')](_0x8b1d53)){_0x8b1d53[_0x0442('0x1b')]=_0x8b1d53[_0x0442('0x1b')]['toString']();_0x8b1d53[_0x0442('0x25')]=_0x8b1d53['consequence'][_0x0442('0x24')]();}return _0x8b1d53;};RuleEngine[_0x0442('0x8')]['fromJSON']=function(_0x3cf4f4){this[_0x0442('0x4')]();if(_[_0x0442('0x26')](_0x3cf4f4)){_0x3cf4f4=JSON[_0x0442('0x27')](_0x3cf4f4);}if(_0x3cf4f4 instanceof Array){_0x3cf4f4=_0x3cf4f4[_0x0442('0x28')](function(_0x1122ed){_0x1122ed[_0x0442('0x1b')]=eval('('+_0x1122ed[_0x0442('0x1b')]+')');_0x1122ed['consequence']=eval('('+_0x1122ed[_0x0442('0x25')]+')');return _0x1122ed;});}else if(_0x3cf4f4!==null&&typeof _0x3cf4f4=='object'){_0x3cf4f4[_0x0442('0x1b')]=eval('('+_0x3cf4f4['condition']+')');_0x3cf4f4[_0x0442('0x25')]=eval('('+_0x3cf4f4[_0x0442('0x25')]+')');}this[_0x0442('0x6')](_0x3cf4f4);};module[_0x0442('0x29')]=RuleEngine; \ No newline at end of file +var _0xfdf2=['toJSON','map','toString','fromJSON','parse','object','exports','lodash','util','events','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','concat','isObject','push','sync','activeRules','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call','next','length','condition','matchPath','findRules','matches','turn','prioritize'];(function(_0x26cbe8,_0x188e8f){var _0x5ef53a=function(_0xdad142){while(--_0xdad142){_0x26cbe8['push'](_0x26cbe8['shift']());}};_0x5ef53a(++_0x188e8f);}(_0xfdf2,0x1b5));var _0x2fdf=function(_0x26315a,_0x377bf2){_0x26315a=_0x26315a-0x0;var _0x286929=_0xfdf2[_0x26315a];return _0x286929;};'use strict';var _=require(_0x2fdf('0x0'));var util=require(_0x2fdf('0x1'));var EventEmitter=require(_0x2fdf('0x2'))[_0x2fdf('0x3')];function RuleEngine(_0x3bcbbd,_0xc343aa){this[_0x2fdf('0x4')]();if(!_[_0x2fdf('0x5')](_0x3bcbbd)){this[_0x2fdf('0x6')](_0x3bcbbd);}if(_0xc343aa){this[_0x2fdf('0x7')]=_0xc343aa[_0x2fdf('0x7')];}return this;}util[_0x2fdf('0x8')](RuleEngine,EventEmitter);RuleEngine[_0x2fdf('0x9')][_0x2fdf('0x4')]=function(_0x7733de){this['rules']=[];this['activeRules']=[];};RuleEngine[_0x2fdf('0x9')][_0x2fdf('0x6')]=function(_0x14ff72){if(Array['isArray'](_0x14ff72)){this[_0x2fdf('0xa')]=this[_0x2fdf('0xa')][_0x2fdf('0xb')](_0x14ff72);}else if(_0x14ff72!==null&&_[_0x2fdf('0xc')](_0x14ff72)){this[_0x2fdf('0xa')][_0x2fdf('0xd')](_0x14ff72);}this[_0x2fdf('0xe')]();};RuleEngine[_0x2fdf('0x9')][_0x2fdf('0xe')]=function(){this[_0x2fdf('0xf')]=this[_0x2fdf('0xa')][_0x2fdf('0x10')](function(_0x53149d){if(_[_0x2fdf('0x5')](_0x53149d['on'])){_0x53149d['on']=!![];}if(_0x53149d['on']===!![]){return _0x53149d;}});this[_0x2fdf('0xf')]=_[_0x2fdf('0x11')](this['activeRules'],['p'],[_0x2fdf('0x12')]);};RuleEngine['prototype'][_0x2fdf('0x13')]=function(_0x61e62a,_0x2dfa61){var _0x2f6f17=![];_0x61e62a[_0x2fdf('0x14')]=!![];var _0x59b0a7=_['clone'](_0x61e62a);var _0x45e6a0=_[_0x2fdf('0x15')](_0x61e62a);var _0x54df01=this[_0x2fdf('0xf')];var _0x1d2c7e=[];var _0x18bd85=this['ignoreFactChanges'];(function FnRuleLoop(_0x5bc741){var _0x2664e6={'rules':function(){return _0x54df01;},'rule':function(){return _0x54df01[_0x5bc741];},'when':function(_0x58904d){if(_0x58904d){var _0x28d63d=_0x54df01[_0x5bc741][_0x2fdf('0x16')];_0x28d63d[_0x2fdf('0x17')]=_0x54df01[_0x5bc741]['id']||_0x54df01[_0x5bc741][_0x2fdf('0x18')]||_0x2fdf('0x19')+_0x5bc741;process[_0x2fdf('0x1a')](function(){_0x1d2c7e[_0x2fdf('0xd')](_0x28d63d[_0x2fdf('0x17')]);_0x28d63d[_0x2fdf('0x1b')](_0x59b0a7,_0x2664e6);});}else{process['nextTick'](function(){_0x2664e6[_0x2fdf('0x1c')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x2f6f17=!![];return FnRuleLoop(0x0);},'next':function(_0x30ab3d){if(!_0x18bd85&&!_['isEqual'](_0x45e6a0,_0x59b0a7)){_0x45e6a0=_[_0x2fdf('0x15')](_0x59b0a7);process[_0x2fdf('0x1a')](function(){_0x2664e6['restart']();});}else{process[_0x2fdf('0x1a')](function(){if(_['isNil'](_0x30ab3d)){return FnRuleLoop(_0x5bc741+0x1);}else{return FnRuleLoop(_0x30ab3d);}});}}};if(_0x5bc741<_0x54df01[_0x2fdf('0x1d')]&&_0x2f6f17===![]){var _0x45e8b6=_0x54df01[_0x5bc741][_0x2fdf('0x1e')];_0x45e8b6[_0x2fdf('0x1b')](_0x59b0a7,_0x2664e6);}else{process[_0x2fdf('0x1a')](function(){_0x59b0a7[_0x2fdf('0x1f')]=_0x1d2c7e;return _0x2dfa61?_0x2dfa61(_0x59b0a7):_['noop']();});}}(0x0));};RuleEngine[_0x2fdf('0x9')][_0x2fdf('0x20')]=function(_0x47a561){if(_[_0x2fdf('0x5')](_0x47a561)){return this[_0x2fdf('0xa')];}else{var _0x13ee38=_[_0x2fdf('0x21')](_0x47a561);return _[_0x2fdf('0x10')](this['rules'],_0x13ee38);}};RuleEngine[_0x2fdf('0x9')][_0x2fdf('0x22')]=function(_0x1997f8,_0x1da2ff){var _0x1997f8=_0x1997f8==='on'||_0x1997f8==='ON'?!![]:![];var _0x522983=this[_0x2fdf('0x20')](_0x1da2ff);for(var _0x1e2873=0x0,_0x5ef871=_0x522983['length'];_0x1e2873<_0x5ef871;_0x1e2873+=0x1){_0x522983[_0x1e2873]['on']=_0x1997f8;}this['sync']();};RuleEngine[_0x2fdf('0x9')][_0x2fdf('0x23')]=function(_0x4093c7,_0x4dad9f){_0x4093c7=parseInt(_0x4093c7,0xa);var _0x252ef2=this[_0x2fdf('0x20')](_0x4dad9f);for(var _0x39d22b=0x0,_0x1d0eae=_0x252ef2[_0x2fdf('0x1d')];_0x39d22b<_0x1d0eae;_0x39d22b+=0x1){_0x252ef2[_0x39d22b]['priority']=_0x4093c7;}this[_0x2fdf('0xe')]();};RuleEngine['prototype'][_0x2fdf('0x24')]=function(){var _0x5b541f=this['rules'];if(_0x5b541f instanceof Array){_0x5b541f=_0x5b541f[_0x2fdf('0x25')](function(_0x19b4ba){_0x19b4ba[_0x2fdf('0x1e')]=_0x19b4ba[_0x2fdf('0x1e')][_0x2fdf('0x26')]();_0x19b4ba[_0x2fdf('0x16')]=_0x19b4ba[_0x2fdf('0x16')]['toString']();return _0x19b4ba;});}else if(!_[_0x2fdf('0x5')](_0x5b541f)){_0x5b541f[_0x2fdf('0x1e')]=_0x5b541f[_0x2fdf('0x1e')][_0x2fdf('0x26')]();_0x5b541f[_0x2fdf('0x16')]=_0x5b541f[_0x2fdf('0x16')]['toString']();}return _0x5b541f;};RuleEngine[_0x2fdf('0x9')][_0x2fdf('0x27')]=function(_0x2d13f6){this['init']();if(_['isString'](_0x2d13f6)){_0x2d13f6=JSON[_0x2fdf('0x28')](_0x2d13f6);}if(_0x2d13f6 instanceof Array){_0x2d13f6=_0x2d13f6[_0x2fdf('0x25')](function(_0x4c78e6){_0x4c78e6['condition']=eval('('+_0x4c78e6[_0x2fdf('0x1e')]+')');_0x4c78e6[_0x2fdf('0x16')]=eval('('+_0x4c78e6[_0x2fdf('0x16')]+')');return _0x4c78e6;});}else if(_0x2d13f6!==null&&typeof _0x2d13f6==_0x2fdf('0x29')){_0x2d13f6[_0x2fdf('0x1e')]=eval('('+_0x2d13f6[_0x2fdf('0x1e')]+')');_0x2d13f6[_0x2fdf('0x16')]=eval('('+_0x2d13f6['consequence']+')');}this[_0x2fdf('0x6')](_0x2d13f6);};module[_0x2fdf('0x2a')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 55633d9..fd1d332 100644 --- a/server/services/routing/mailRpc/index.js +++ b/server/services/routing/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x5330b4,_0x1b668d){var _0x552cea=function(_0x129977){while(--_0x129977){_0x5330b4['push'](_0x5330b4['shift']());}};_0x552cea(++_0x1b668d);}(_0x814b,0x1a2));var _0xb814=function(_0x2125f0,_0x2f23b9){_0x2125f0=_0x2125f0-0x0;var _0x12d6eb=_0x814b[_0x2125f0];return _0x12d6eb;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file +var _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x3a8de3,_0x531e5c){var _0x4f1819=function(_0x4f4a0a){while(--_0x4f4a0a){_0x3a8de3['push'](_0x3a8de3['shift']());}};_0x4f1819(++_0x531e5c);}(_0x814b,0x1a2));var _0xb814=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x814b[_0x1203f];return _0x365f0a;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index c6b828e..e6caf30 100644 --- a/server/services/routing/model/agent.js +++ b/server/services/routing/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb66=['faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailStatus','mailCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','openchannel','sms','length','Status','StatusTime','toNumber','chatCurrentCapacity','mailStatusTime','faxStatus','openchannelStatus','stringify','emit','user:save','md5','../../../config/environment','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause'];(function(_0x27ccb6,_0x103913){var _0x412043=function(_0x3c1624){while(--_0x3c1624){_0x27ccb6['push'](_0x27ccb6['shift']());}};_0x412043(++_0x103913);}(_0xcb66,0xff));var _0x6cb6=function(_0x1bd323,_0x1c16ab){_0x1bd323=_0x1bd323-0x0;var _0x13097b=_0xcb66[_0x1bd323];return _0x13097b;};'use strict';var _=require('lodash');var moment=require('moment');var md5=require(_0x6cb6('0x0'));var Redis=require('ioredis');var config=require(_0x6cb6('0x1'));config['redis']=_['defaults'](config[_0x6cb6('0x2')],{'host':_0x6cb6('0x3'),'port':0x18eb});var io=require(_0x6cb6('0x4'))(new Redis(config[_0x6cb6('0x2')]));function Agent(_0x464f72){this['id']=_0x464f72['id']||0x0;this[_0x6cb6('0x5')]=_0x464f72[_0x6cb6('0x5')]||'';this['online']=_0x464f72[_0x6cb6('0x6')]||!![];this[_0x6cb6('0x7')]=_0x464f72['voicePause']||![];this[_0x6cb6('0x8')]=_0x464f72['chatPause']||![];this['mailPause']=_0x464f72[_0x6cb6('0x9')]||![];this[_0x6cb6('0xa')]=_0x464f72[_0x6cb6('0xa')]||![];this[_0x6cb6('0xb')]=_0x464f72[_0x6cb6('0xb')]||![];this[_0x6cb6('0xc')]=_0x464f72[_0x6cb6('0xc')]||![];this[_0x6cb6('0xd')]=_0x6cb6('0xe');this[_0x6cb6('0xf')]=0x0;this[_0x6cb6('0x10')]=_0x464f72['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this[_0x6cb6('0x11')]=_0x6cb6('0xe');this['mailStatusTime']=0x0;this['mailCapacity']=_0x464f72[_0x6cb6('0x12')]||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']=_0x6cb6('0xe');this[_0x6cb6('0x13')]=0x0;this[_0x6cb6('0x14')]=_0x464f72['faxCapacity']||0x0;this[_0x6cb6('0x15')]=0x0;this[_0x6cb6('0x16')]=_0x6cb6('0xe');this[_0x6cb6('0x17')]=0x0;this[_0x6cb6('0x18')]=_0x464f72['smsCapacity']||0x0;this[_0x6cb6('0x19')]=0x0;this['openchannelStatus']=_0x6cb6('0xe');this[_0x6cb6('0x1a')]=0x0;this[_0x6cb6('0x1b')]=_0x464f72[_0x6cb6('0x1b')]||0x0;this[_0x6cb6('0x1c')]=0x0;this[_0x6cb6('0x1d')]=![];this[_0x6cb6('0x1e')]=undefined;this['md5']='';this[_0x6cb6('0x1f')]();}Agent[_0x6cb6('0x20')][_0x6cb6('0x21')]=function(_0x445825){if(this[_0x445825+_0x6cb6('0x22')]>0x0){if(this[_0x445825+_0x6cb6('0x23')]>0x0&&this[_0x445825+'CurrentCapacity']>=this[_0x445825+_0x6cb6('0x23')]){return _0x6cb6('0x24');}else{return _0x6cb6('0x25');}}else{return _0x6cb6('0x26');}};Agent['prototype']['updateRealtime']=function(){var _0x256629=[_0x6cb6('0x27'),'chat',_0x6cb6('0x28'),'fax',_0x6cb6('0x29')];for(var _0x2cb4c8=0x0;_0x2cb4c8<_0x256629[_0x6cb6('0x2a')];_0x2cb4c8+=0x1){var _0x5e14b4=this[_0x6cb6('0x21')](_0x256629[_0x2cb4c8]);if(this[_0x256629[_0x2cb4c8]+_0x6cb6('0x2b')]!==_0x5e14b4){this[_0x256629[_0x2cb4c8]+_0x6cb6('0x2c')]=_[_0x6cb6('0x2d')](moment()['format']('x'));}this[_0x256629[_0x2cb4c8]+_0x6cb6('0x2b')]=_0x5e14b4;}var _0xb1336a={'id':this['id'],'name':this[_0x6cb6('0x5')],'online':this[_0x6cb6('0x6')],'voicePause':this[_0x6cb6('0x7')],'chatPause':this['chatPause'],'mailPause':this[_0x6cb6('0x9')],'smsPause':this[_0x6cb6('0xb')],'faxPause':this[_0x6cb6('0xa')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x6cb6('0xd')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x6cb6('0x10')],'chatCurrentCapacity':this[_0x6cb6('0x2e')],'mailStatus':this[_0x6cb6('0x11')],'mailStatusTime':this[_0x6cb6('0x2f')],'mailCapacity':this[_0x6cb6('0x12')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x6cb6('0x30')],'faxStatusTime':this[_0x6cb6('0x13')],'faxCapacity':this[_0x6cb6('0x14')],'faxCurrentCapacity':this[_0x6cb6('0x15')],'smsStatus':this[_0x6cb6('0x16')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x6cb6('0x19')],'openchannelStatus':this[_0x6cb6('0x31')],'openchannelStatusTime':this[_0x6cb6('0x1a')],'openchannelCapacity':this[_0x6cb6('0x1b')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x6cb6('0x1d')],'busyQueue':this['busyQueue']};var _0x4147a1=md5(JSON[_0x6cb6('0x32')](_0xb1336a));if(this['md5']!==_0x4147a1){this[_0x6cb6('0x0')]=_0x4147a1;io[_0x6cb6('0x33')](_0x6cb6('0x34'),_0xb1336a);}};module['exports']=Agent; \ No newline at end of file +var _0xdbc7=['moment','md5','ioredis','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','openchannelPause','chatStatus','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','chat','fax','sms','length','Status','StatusTime','toNumber','format','faxPause','chatStatusTime','smsStatus','openchannelStatusTime','stringify','emit','user:save','exports','lodash'];(function(_0x29771f,_0x1189ae){var _0x279baf=function(_0xd66325){while(--_0xd66325){_0x29771f['push'](_0x29771f['shift']());}};_0x279baf(++_0x1189ae);}(_0xdbc7,0x6f));var _0x7dbc=function(_0x5179a5,_0x419746){_0x5179a5=_0x5179a5-0x0;var _0x15c8ce=_0xdbc7[_0x5179a5];return _0x15c8ce;};'use strict';var _=require(_0x7dbc('0x0'));var moment=require(_0x7dbc('0x1'));var md5=require(_0x7dbc('0x2'));var Redis=require(_0x7dbc('0x3'));var config=require('../../../config/environment');config[_0x7dbc('0x4')]=_[_0x7dbc('0x5')](config[_0x7dbc('0x4')],{'host':_0x7dbc('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x33c397){this['id']=_0x33c397['id']||0x0;this[_0x7dbc('0x7')]=_0x33c397[_0x7dbc('0x7')]||'';this[_0x7dbc('0x8')]=_0x33c397['online']||!![];this[_0x7dbc('0x9')]=_0x33c397[_0x7dbc('0x9')]||![];this['chatPause']=_0x33c397[_0x7dbc('0xa')]||![];this[_0x7dbc('0xb')]=_0x33c397[_0x7dbc('0xb')]||![];this['faxPause']=_0x33c397['faxPause']||![];this['smsPause']=_0x33c397['smsPause']||![];this[_0x7dbc('0xc')]=_0x33c397[_0x7dbc('0xc')]||![];this[_0x7dbc('0xd')]='unknown';this['chatStatusTime']=0x0;this[_0x7dbc('0xe')]=_0x33c397[_0x7dbc('0xe')]||0x0;this[_0x7dbc('0xf')]=0x0;this[_0x7dbc('0x10')]=_0x7dbc('0x11');this[_0x7dbc('0x12')]=0x0;this[_0x7dbc('0x13')]=_0x33c397[_0x7dbc('0x13')]||0x0;this[_0x7dbc('0x14')]=0x0;this[_0x7dbc('0x15')]=_0x7dbc('0x11');this[_0x7dbc('0x16')]=0x0;this[_0x7dbc('0x17')]=_0x33c397[_0x7dbc('0x17')]||0x0;this[_0x7dbc('0x18')]=0x0;this['smsStatus']='unknown';this[_0x7dbc('0x19')]=0x0;this['smsCapacity']=_0x33c397[_0x7dbc('0x1a')]||0x0;this[_0x7dbc('0x1b')]=0x0;this[_0x7dbc('0x1c')]=_0x7dbc('0x11');this['openchannelStatusTime']=0x0;this[_0x7dbc('0x1d')]=_0x33c397[_0x7dbc('0x1d')]||0x0;this[_0x7dbc('0x1e')]=0x0;this[_0x7dbc('0x1f')]=![];this[_0x7dbc('0x20')]=undefined;this[_0x7dbc('0x2')]='';this[_0x7dbc('0x21')]();}Agent[_0x7dbc('0x22')][_0x7dbc('0x23')]=function(_0x51269a){if(this[_0x51269a+_0x7dbc('0x24')]>0x0){if(this[_0x51269a+'Capacity']>0x0&&this[_0x51269a+_0x7dbc('0x24')]>=this[_0x51269a+_0x7dbc('0x25')]){return _0x7dbc('0x26');}else{return _0x7dbc('0x27');}}else{return'idle';}};Agent[_0x7dbc('0x22')][_0x7dbc('0x21')]=function(){var _0xdf307=['mail',_0x7dbc('0x28'),'openchannel',_0x7dbc('0x29'),_0x7dbc('0x2a')];for(var _0x12f24a=0x0;_0x12f24a<_0xdf307[_0x7dbc('0x2b')];_0x12f24a+=0x1){var _0x2bd0ac=this[_0x7dbc('0x23')](_0xdf307[_0x12f24a]);if(this[_0xdf307[_0x12f24a]+_0x7dbc('0x2c')]!==_0x2bd0ac){this[_0xdf307[_0x12f24a]+_0x7dbc('0x2d')]=_[_0x7dbc('0x2e')](moment()[_0x7dbc('0x2f')]('x'));}this[_0xdf307[_0x12f24a]+_0x7dbc('0x2c')]=_0x2bd0ac;}var _0x4aaf4d={'id':this['id'],'name':this[_0x7dbc('0x7')],'online':this['online'],'voicePause':this[_0x7dbc('0x9')],'chatPause':this[_0x7dbc('0xa')],'mailPause':this[_0x7dbc('0xb')],'smsPause':this['smsPause'],'faxPause':this[_0x7dbc('0x30')],'openchannelPause':this[_0x7dbc('0xc')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x7dbc('0x31')],'chatCapacity':this[_0x7dbc('0xe')],'chatCurrentCapacity':this[_0x7dbc('0xf')],'mailStatus':this[_0x7dbc('0x10')],'mailStatusTime':this[_0x7dbc('0x12')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x7dbc('0x14')],'faxStatus':this[_0x7dbc('0x15')],'faxStatusTime':this[_0x7dbc('0x16')],'faxCapacity':this[_0x7dbc('0x17')],'faxCurrentCapacity':this[_0x7dbc('0x18')],'smsStatus':this[_0x7dbc('0x32')],'smsStatusTime':this[_0x7dbc('0x19')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x7dbc('0x1b')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x7dbc('0x33')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x7dbc('0x1e')],'busy':this[_0x7dbc('0x1f')],'busyQueue':this[_0x7dbc('0x20')]};var _0x558443=md5(JSON[_0x7dbc('0x34')](_0x4aaf4d));if(this[_0x7dbc('0x2')]!==_0x558443){this[_0x7dbc('0x2')]=_0x558443;io[_0x7dbc('0x35')](_0x7dbc('0x36'),_0x4aaf4d);}};module[_0x7dbc('0x37')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index a3ab99c..e54df5a 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 _0xe8d8=['available','stringify','chat:queue:%s','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','paused','length','loggedIn','chatPause'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xe8d8,0x17e));var _0x8e8d=function(_0x44116e,_0x29c1c2){_0x44116e=_0x44116e-0x0;var _0x5cd768=_0xe8d8[_0x44116e];return _0x5cd768;};'use strict';var _=require(_0x8e8d('0x0'));var md5=require(_0x8e8d('0x1'));var util=require(_0x8e8d('0x2'));var Redis=require(_0x8e8d('0x3'));var config=require(_0x8e8d('0x4'));config['redis']=_[_0x8e8d('0x5')](config[_0x8e8d('0x6')],{'host':_0x8e8d('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x578f1e){this['id']=_0x578f1e['id']||0x0;this[_0x8e8d('0x8')]=_0x578f1e[_0x8e8d('0x8')]||'';this[_0x8e8d('0x9')]=_0x578f1e[_0x8e8d('0x9')]||0xa;this[_0x8e8d('0xa')]=_0x578f1e[_0x8e8d('0xa')]||_0x8e8d('0xb');this[_0x8e8d('0xc')]=_0x578f1e[_0x8e8d('0xc')];this[_0x8e8d('0xd')]={};this[_0x8e8d('0xe')]=0x0;this[_0x8e8d('0x1')]='';this['updateRouting']();this[_0x8e8d('0xf')]();}ChatQueue[_0x8e8d('0x10')][_0x8e8d('0x11')]=function(){var _0x4ae98f=this[_0x8e8d('0xd')][_0x8e8d('0x12')];this['mapAgentsId']=_[_0x8e8d('0x13')](this['Agents'],'id');this[_0x8e8d('0xd')][_0x8e8d('0x12')]=_0x4ae98f;};ChatQueue[_0x8e8d('0x10')][_0x8e8d('0xf')]=function(){this['loggedIn']=0x0;this[_0x8e8d('0x14')]=0x0;for(var _0x1a5875=0x0;_0x1a5875=0x0?this[_0x8e8d('0x18')]:0x0;var _0x423d4a={'id':this['id'],'available':this[_0x8e8d('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x8e8d('0x8')],'paused':this['paused'],'waiting':this[_0x8e8d('0xe')]};var _0x211424=md5(JSON[_0x8e8d('0x19')](_0x423d4a));if(this[_0x8e8d('0x1')]!==_0x211424){this['md5']=_0x211424;io['to'](util['format'](_0x8e8d('0x1a'),_0x423d4a[_0x8e8d('0x8')]))['emit'](_0x8e8d('0x1b'),_0x423d4a);}};module[_0x8e8d('0x1c')]=ChatQueue; \ No newline at end of file +var _0x37c9=['loggedIn','chatPause','available','name','stringify','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','../../../config/environment','defaults','socket.io-emitter','redis','timeout','strategy','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','Agents','paused','length'];(function(_0x5c8e1d,_0x4edafb){var _0x2d6b61=function(_0x4df7a4){while(--_0x4df7a4){_0x5c8e1d['push'](_0x5c8e1d['shift']());}};_0x2d6b61(++_0x4edafb);}(_0x37c9,0x1c9));var _0x937c=function(_0x7f7a5,_0x15b6cb){_0x7f7a5=_0x7f7a5-0x0;var _0x235eff=_0x37c9[_0x7f7a5];return _0x235eff;};'use strict';var _=require(_0x937c('0x0'));var md5=require(_0x937c('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x937c('0x2'));config['redis']=_[_0x937c('0x3')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x937c('0x4'))(new Redis(config[_0x937c('0x5')]));function ChatQueue(_0x2e8b78){this['id']=_0x2e8b78['id']||0x0;this['name']=_0x2e8b78['name']||'';this[_0x937c('0x6')]=_0x2e8b78[_0x937c('0x6')]||0xa;this[_0x937c('0x7')]=_0x2e8b78[_0x937c('0x7')]||_0x937c('0x8');this['Agents']=_0x2e8b78['Agents'];this[_0x937c('0x9')]={};this[_0x937c('0xa')]=0x0;this[_0x937c('0x1')]='';this[_0x937c('0xb')]();this[_0x937c('0xc')]();}ChatQueue[_0x937c('0xd')]['updateRouting']=function(){var _0x51631d=this['mapAgentsId'][_0x937c('0xe')];this[_0x937c('0x9')]=_[_0x937c('0xf')](this[_0x937c('0x10')],'id');this[_0x937c('0x9')][_0x937c('0xe')]=_0x51631d;};ChatQueue[_0x937c('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x937c('0x11')]=0x0;for(var _0x364a30=0x0;_0x364a30=0x0?this[_0x937c('0x15')]:0x0;var _0x4e5549={'id':this['id'],'available':this[_0x937c('0x15')],'loggedIn':this[_0x937c('0x13')],'name':this[_0x937c('0x16')],'paused':this[_0x937c('0x11')],'waiting':this[_0x937c('0xa')]};var _0x2a4f20=md5(JSON[_0x937c('0x17')](_0x4e5549));if(this[_0x937c('0x1')]!==_0x2a4f20){this[_0x937c('0x1')]=_0x2a4f20;io['to'](util['format'](_0x937c('0x18'),_0x4e5549[_0x937c('0x16')]))[_0x937c('0x19')](_0x937c('0x1a'),_0x4e5549);}};module[_0x937c('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 480b177..9a55905 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 _0xda03=['localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','paused','length','online','loggedIn','available','stringify','format','fax:queue:%s','emit','exports','util','ioredis','../../../config/environment','redis','defaults'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0xda03,0x1ae));var _0x3da0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xda03[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x3da0('0x0'));var Redis=require(_0x3da0('0x1'));var config=require(_0x3da0('0x2'));config[_0x3da0('0x3')]=_[_0x3da0('0x4')](config[_0x3da0('0x3')],{'host':_0x3da0('0x5'),'port':0x18eb});var io=require(_0x3da0('0x6'))(new Redis(config[_0x3da0('0x3')]));function FaxQueue(_0x2268bf){this['id']=_0x2268bf['id']||0x0;this[_0x3da0('0x7')]=_0x2268bf[_0x3da0('0x7')]||'';this[_0x3da0('0x8')]=_0x2268bf[_0x3da0('0x8')]||0xa;this[_0x3da0('0x9')]=_0x2268bf[_0x3da0('0x9')]||_0x3da0('0xa');this[_0x3da0('0xb')]=_0x2268bf[_0x3da0('0xb')];this[_0x3da0('0xc')]={};this[_0x3da0('0xd')]=0x0;this[_0x3da0('0xe')]='';this[_0x3da0('0xf')]();this[_0x3da0('0x10')]();}FaxQueue[_0x3da0('0x11')][_0x3da0('0xf')]=function(){var _0x48a345=this[_0x3da0('0xc')][_0x3da0('0x12')];this[_0x3da0('0xc')]=_['map'](this[_0x3da0('0xb')],'id');this[_0x3da0('0xc')][_0x3da0('0x12')]=_0x48a345;};FaxQueue[_0x3da0('0x11')][_0x3da0('0x10')]=function(){this['loggedIn']=0x0;this[_0x3da0('0x13')]=0x0;for(var _0x2e68ca=0x0;_0x2e68ca=0x0?this[_0x3da0('0x17')]:0x0;var _0x1e0734={'id':this['id'],'available':this[_0x3da0('0x17')],'loggedIn':this[_0x3da0('0x16')],'name':this[_0x3da0('0x7')],'paused':this[_0x3da0('0x13')],'waiting':this[_0x3da0('0xd')]};var _0x25291a=md5(JSON[_0x3da0('0x18')](_0x1e0734));if(this[_0x3da0('0xe')]!==_0x25291a){this[_0x3da0('0xe')]=_0x25291a;io['to'](util[_0x3da0('0x19')](_0x3da0('0x1a'),_0x1e0734[_0x3da0('0x7')]))[_0x3da0('0x1b')]('fax_queue:save',_0x1e0734);}};module[_0x3da0('0x1c')]=FaxQueue; \ No newline at end of file +var _0xd941=['emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','loggedIn','paused','online','faxPause','available','stringify','fax:queue:%s'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xd941,0x7b));var _0x1d94=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xd941[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0x1d94('0x0'));var md5=require(_0x1d94('0x1'));var util=require(_0x1d94('0x2'));var Redis=require(_0x1d94('0x3'));var config=require(_0x1d94('0x4'));config[_0x1d94('0x5')]=_[_0x1d94('0x6')](config[_0x1d94('0x5')],{'host':_0x1d94('0x7'),'port':0x18eb});var io=require(_0x1d94('0x8'))(new Redis(config[_0x1d94('0x5')]));function FaxQueue(_0x2442c0){this['id']=_0x2442c0['id']||0x0;this[_0x1d94('0x9')]=_0x2442c0['name']||'';this['timeout']=_0x2442c0[_0x1d94('0xa')]||0xa;this[_0x1d94('0xb')]=_0x2442c0[_0x1d94('0xb')]||_0x1d94('0xc');this['Agents']=_0x2442c0[_0x1d94('0xd')];this[_0x1d94('0xe')]={};this[_0x1d94('0xf')]=0x0;this[_0x1d94('0x1')]='';this[_0x1d94('0x10')]();this[_0x1d94('0x11')]();}FaxQueue['prototype'][_0x1d94('0x10')]=function(){var _0x401d69=this[_0x1d94('0xe')][_0x1d94('0x12')];this[_0x1d94('0xe')]=_[_0x1d94('0x13')](this[_0x1d94('0xd')],'id');this[_0x1d94('0xe')][_0x1d94('0x12')]=_0x401d69;};FaxQueue['prototype'][_0x1d94('0x11')]=function(){this[_0x1d94('0x14')]=0x0;this[_0x1d94('0x15')]=0x0;for(var _0x1231a5=0x0;_0x1231a5=0x0?this[_0x1d94('0x18')]:0x0;var _0x57f437={'id':this['id'],'available':this[_0x1d94('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x1d94('0x9')],'paused':this[_0x1d94('0x15')],'waiting':this[_0x1d94('0xf')]};var _0x404783=md5(JSON[_0x1d94('0x19')](_0x57f437));if(this[_0x1d94('0x1')]!==_0x404783){this['md5']=_0x404783;io['to'](util['format'](_0x1d94('0x1a'),_0x57f437['name']))[_0x1d94('0x1b')](_0x1d94('0x1c'),_0x57f437);}};module[_0x1d94('0x1d')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 9c75df8..0d15e93 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 _0xc468=['Intervals','exports'];(function(_0x3e7e96,_0x5683ca){var _0x13f6f0=function(_0x320767){while(--_0x320767){_0x3e7e96['push'](_0x3e7e96['shift']());}};_0x13f6f0(++_0x5683ca);}(_0xc468,0x11c));var _0x8c46=function(_0x137d9e,_0x53651e){_0x137d9e=_0x137d9e-0x0;var _0x2c697e=_0xc468[_0x137d9e];return _0x2c697e;};'use strict';function Interval(_0x56bd3f){this['id']=_0x56bd3f['id']||0x0;this['name']=_0x56bd3f['name']||'';this['Intervals']=_0x56bd3f[_0x8c46('0x0')]||{};}module[_0x8c46('0x1')]=Interval; \ No newline at end of file +var _0xfcfe=['Intervals','exports','name'];(function(_0x21105c,_0x133653){var _0x2840d5=function(_0x5557cb){while(--_0x5557cb){_0x21105c['push'](_0x21105c['shift']());}};_0x2840d5(++_0x133653);}(_0xfcfe,0xe3));var _0xefcf=function(_0x385bc2,_0x29c648){_0x385bc2=_0x385bc2-0x0;var _0x476fc0=_0xfcfe[_0x385bc2];return _0x476fc0;};'use strict';function Interval(_0x37ff57){this['id']=_0x37ff57['id']||0x0;this[_0xefcf('0x0')]=_0x37ff57[_0xefcf('0x0')]||'';this[_0xefcf('0x1')]=_0x37ff57[_0xefcf('0x1')]||{};}module[_0xefcf('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 92d3a1e..ddacd3f 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 _0xb923=['updateRealtime','prototype','map','_rr','loggedIn','length','online','mailPause','paused','available','waiting','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','../../../config/environment','redis','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','updateRouting'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xb923,0xa2));var _0x3b92=function(_0x41c270,_0x1d802f){_0x41c270=_0x41c270-0x0;var _0x31437c=_0xb923[_0x41c270];return _0x31437c;};'use strict';var _=require(_0x3b92('0x0'));var md5=require(_0x3b92('0x1'));var util=require(_0x3b92('0x2'));var Redis=require('ioredis');var config=require(_0x3b92('0x3'));config[_0x3b92('0x4')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x3b92('0x5'))(new Redis(config[_0x3b92('0x4')]));function MailQueue(_0x3916b4){this['id']=_0x3916b4['id']||0x0;this[_0x3b92('0x6')]=_0x3916b4[_0x3b92('0x6')]||'';this[_0x3b92('0x7')]=_0x3916b4[_0x3b92('0x7')]||0xa;this['strategy']=_0x3916b4['strategy']||_0x3b92('0x8');this['Agents']=_0x3916b4[_0x3b92('0x9')];this[_0x3b92('0xa')]={};this['waiting']=0x0;this[_0x3b92('0x1')]='';this[_0x3b92('0xb')]();this[_0x3b92('0xc')]();}MailQueue[_0x3b92('0xd')][_0x3b92('0xb')]=function(){var _0x5b815b=this[_0x3b92('0xa')]['_rr'];this['mapAgentsId']=_[_0x3b92('0xe')](this[_0x3b92('0x9')],'id');this[_0x3b92('0xa')][_0x3b92('0xf')]=_0x5b815b;};MailQueue['prototype']['updateRealtime']=function(){this[_0x3b92('0x10')]=0x0;this['paused']=0x0;for(var _0x51143b=0x0;_0x51143b=0x0?this[_0x3b92('0x15')]:0x0;var _0x3d7f80={'id':this['id'],'available':this[_0x3b92('0x15')],'loggedIn':this[_0x3b92('0x10')],'name':this[_0x3b92('0x6')],'paused':this[_0x3b92('0x14')],'waiting':this[_0x3b92('0x16')]};var _0x316b82=md5(JSON[_0x3b92('0x17')](_0x3d7f80));if(this[_0x3b92('0x1')]!==_0x316b82){this['md5']=_0x316b82;io['to'](util[_0x3b92('0x18')](_0x3b92('0x19'),_0x3d7f80[_0x3b92('0x6')]))[_0x3b92('0x1a')](_0x3b92('0x1b'),_0x3d7f80);}};module[_0x3b92('0x1c')]=MailQueue; \ No newline at end of file +var _0xfd20=['map','prototype','paused','length','online','mailPause','available','stringify','format','mail:queue:%s','md5','../../../config/environment','redis','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr'];(function(_0x21c4e0,_0x5759af){var _0xfcd321=function(_0x58de8f){while(--_0x58de8f){_0x21c4e0['push'](_0x21c4e0['shift']());}};_0xfcd321(++_0x5759af);}(_0xfd20,0x66));var _0x0fd2=function(_0x9bca53,_0x59b4f8){_0x9bca53=_0x9bca53-0x0;var _0x3894bc=_0xfd20[_0x9bca53];return _0x3894bc;};'use strict';var _=require('lodash');var md5=require(_0x0fd2('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0x0fd2('0x1'));config[_0x0fd2('0x2')]=_['defaults'](config[_0x0fd2('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0x0fd2('0x3'))(new Redis(config[_0x0fd2('0x2')]));function MailQueue(_0x2ef0c3){this['id']=_0x2ef0c3['id']||0x0;this[_0x0fd2('0x4')]=_0x2ef0c3[_0x0fd2('0x4')]||'';this['timeout']=_0x2ef0c3['timeout']||0xa;this[_0x0fd2('0x5')]=_0x2ef0c3[_0x0fd2('0x5')]||_0x0fd2('0x6');this[_0x0fd2('0x7')]=_0x2ef0c3[_0x0fd2('0x7')];this[_0x0fd2('0x8')]={};this[_0x0fd2('0x9')]=0x0;this['md5']='';this[_0x0fd2('0xa')]();this[_0x0fd2('0xb')]();}MailQueue['prototype'][_0x0fd2('0xa')]=function(){var _0x56dfa2=this[_0x0fd2('0x8')][_0x0fd2('0xc')];this[_0x0fd2('0x8')]=_[_0x0fd2('0xd')](this[_0x0fd2('0x7')],'id');this[_0x0fd2('0x8')][_0x0fd2('0xc')]=_0x56dfa2;};MailQueue[_0x0fd2('0xe')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x0fd2('0xf')]=0x0;for(var _0x99de24=0x0;_0x99de24=0x0?this[_0x0fd2('0x13')]:0x0;var _0x53787a={'id':this['id'],'available':this[_0x0fd2('0x13')],'loggedIn':this['loggedIn'],'name':this[_0x0fd2('0x4')],'paused':this[_0x0fd2('0xf')],'waiting':this[_0x0fd2('0x9')]};var _0x11b423=md5(JSON[_0x0fd2('0x14')](_0x53787a));if(this[_0x0fd2('0x0')]!==_0x11b423){this[_0x0fd2('0x0')]=_0x11b423;io['to'](util[_0x0fd2('0x15')](_0x0fd2('0x16'),_0x53787a[_0x0fd2('0x4')]))['emit']('mail_queue:save',_0x53787a);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index b78aa49..41d4598 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 _0x2e07=['lodash','md5','ioredis','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting','prototype','mapAgentsId','_rr','updateRealtime','paused','length','loggedIn','openchannelPause','available','format','openchannel:queue:%s','emit','openchannel_queue:save','exports'];(function(_0x142ef0,_0x559d7b){var _0x26ea18=function(_0x4720e7){while(--_0x4720e7){_0x142ef0['push'](_0x142ef0['shift']());}};_0x26ea18(++_0x559d7b);}(_0x2e07,0x152));var _0x72e0=function(_0x301bc6,_0xd8d96a){_0x301bc6=_0x301bc6-0x0;var _0x2a63db=_0x2e07[_0x301bc6];return _0x2a63db;};'use strict';var _=require(_0x72e0('0x0'));var md5=require(_0x72e0('0x1'));var util=require('util');var Redis=require(_0x72e0('0x2'));var config=require('../../../config/environment');config[_0x72e0('0x3')]=_[_0x72e0('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x72e0('0x5'))(new Redis(config[_0x72e0('0x3')]));function OpenchannelQueue(_0x4aa1d1){this['id']=_0x4aa1d1['id']||0x0;this['name']=_0x4aa1d1[_0x72e0('0x6')]||'';this[_0x72e0('0x7')]=_0x4aa1d1[_0x72e0('0x7')]||0xa;this['strategy']=_0x4aa1d1[_0x72e0('0x8')]||'beepall';this[_0x72e0('0x9')]=_0x4aa1d1[_0x72e0('0x9')];this['mapAgentsId']={};this[_0x72e0('0xa')]=0x0;this[_0x72e0('0x1')]='';this[_0x72e0('0xb')]();this['updateRealtime']();}OpenchannelQueue[_0x72e0('0xc')]['updateRouting']=function(){var _0x116e0f=this[_0x72e0('0xd')]['_rr'];this[_0x72e0('0xd')]=_['map'](this[_0x72e0('0x9')],'id');this['mapAgentsId'][_0x72e0('0xe')]=_0x116e0f;};OpenchannelQueue['prototype'][_0x72e0('0xf')]=function(){this['loggedIn']=0x0;this[_0x72e0('0x10')]=0x0;for(var _0x2277a9=0x0;_0x2277a9=0x0?this[_0x72e0('0x14')]:0x0;var _0x1738d3={'id':this['id'],'available':this[_0x72e0('0x14')],'loggedIn':this[_0x72e0('0x12')],'name':this[_0x72e0('0x6')],'paused':this[_0x72e0('0x10')],'waiting':this[_0x72e0('0xa')]};var _0x1c5e4f=md5(JSON['stringify'](_0x1738d3));if(this[_0x72e0('0x1')]!==_0x1c5e4f){this[_0x72e0('0x1')]=_0x1c5e4f;io['to'](util[_0x72e0('0x15')](_0x72e0('0x16'),_0x1738d3[_0x72e0('0x6')]))[_0x72e0('0x17')](_0x72e0('0x18'),_0x1738d3);}};module[_0x72e0('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x9003=['stringify','openchannel:queue:%s','emit','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','paused','online','loggedIn','openchannelPause','available'];(function(_0x199687,_0xb51e87){var _0x24308a=function(_0xf856e1){while(--_0xf856e1){_0x199687['push'](_0x199687['shift']());}};_0x24308a(++_0xb51e87);}(_0x9003,0xb4));var _0x3900=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9003[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var md5=require(_0x3900('0x0'));var util=require(_0x3900('0x1'));var Redis=require(_0x3900('0x2'));var config=require(_0x3900('0x3'));config[_0x3900('0x4')]=_['defaults'](config[_0x3900('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x3900('0x5'))(new Redis(config[_0x3900('0x4')]));function OpenchannelQueue(_0x1bbff1){this['id']=_0x1bbff1['id']||0x0;this['name']=_0x1bbff1[_0x3900('0x6')]||'';this['timeout']=_0x1bbff1['timeout']||0xa;this['strategy']=_0x1bbff1['strategy']||_0x3900('0x7');this[_0x3900('0x8')]=_0x1bbff1[_0x3900('0x8')];this[_0x3900('0x9')]={};this[_0x3900('0xa')]=0x0;this['md5']='';this[_0x3900('0xb')]();this[_0x3900('0xc')]();}OpenchannelQueue[_0x3900('0xd')][_0x3900('0xb')]=function(){var _0x1f721=this[_0x3900('0x9')][_0x3900('0xe')];this[_0x3900('0x9')]=_['map'](this[_0x3900('0x8')],'id');this[_0x3900('0x9')][_0x3900('0xe')]=_0x1f721;};OpenchannelQueue['prototype'][_0x3900('0xc')]=function(){this['loggedIn']=0x0;this[_0x3900('0xf')]=0x0;for(var _0x5258bf=0x0;_0x5258bf=0x0?this[_0x3900('0x13')]:0x0;var _0x4a879b={'id':this['id'],'available':this[_0x3900('0x13')],'loggedIn':this[_0x3900('0x11')],'name':this[_0x3900('0x6')],'paused':this[_0x3900('0xf')],'waiting':this[_0x3900('0xa')]};var _0x44fba6=md5(JSON[_0x3900('0x14')](_0x4a879b));if(this[_0x3900('0x0')]!==_0x44fba6){this[_0x3900('0x0')]=_0x44fba6;io['to'](util['format'](_0x3900('0x15'),_0x4a879b[_0x3900('0x6')]))[_0x3900('0x16')](_0x3900('0x17'),_0x4a879b);}};module[_0x3900('0x18')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 9e98f4e..038954a 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 _0x615a=['updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','smsPause','available','stringify','format','sms:queue:%s','sms_queue:save','md5','util','ioredis','redis','defaults','name','timeout','Agents','mapAgentsId','waiting'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x615a,0x1d1));var _0xa615=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x615a[_0x31e29a];return _0x32d892;};'use strict';var _=require('lodash');var md5=require(_0xa615('0x0'));var util=require(_0xa615('0x1'));var Redis=require(_0xa615('0x2'));var config=require('../../../config/environment');config[_0xa615('0x3')]=_[_0xa615('0x4')](config[_0xa615('0x3')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function SmsQueue(_0x524919){this['id']=_0x524919['id']||0x0;this['name']=_0x524919[_0xa615('0x5')]||'';this[_0xa615('0x6')]=_0x524919[_0xa615('0x6')]||0xa;this['strategy']=_0x524919['strategy']||'beepall';this[_0xa615('0x7')]=_0x524919[_0xa615('0x7')];this[_0xa615('0x8')]={};this[_0xa615('0x9')]=0x0;this[_0xa615('0x0')]='';this[_0xa615('0xa')]();this[_0xa615('0xb')]();}SmsQueue[_0xa615('0xc')]['updateRouting']=function(){var _0x580804=this[_0xa615('0x8')][_0xa615('0xd')];this[_0xa615('0x8')]=_[_0xa615('0xe')](this[_0xa615('0x7')],'id');this['mapAgentsId'][_0xa615('0xd')]=_0x580804;};SmsQueue[_0xa615('0xc')][_0xa615('0xb')]=function(){this[_0xa615('0xf')]=0x0;this[_0xa615('0x10')]=0x0;for(var _0x551386=0x0;_0x551386=0x0?this[_0xa615('0x14')]:0x0;var _0x13aede={'id':this['id'],'available':this[_0xa615('0x14')],'loggedIn':this[_0xa615('0xf')],'name':this[_0xa615('0x5')],'paused':this[_0xa615('0x10')],'waiting':this['waiting']};var _0x1d2126=md5(JSON[_0xa615('0x15')](_0x13aede));if(this[_0xa615('0x0')]!==_0x1d2126){this[_0xa615('0x0')]=_0x1d2126;io['to'](util[_0xa615('0x16')](_0xa615('0x17'),_0x13aede['name']))['emit'](_0xa615('0x18'),_0x13aede);}};module['exports']=SmsQueue; \ No newline at end of file +var _0xa9ca=['prototype','_rr','map','updateRealtime','loggedIn','paused','online','smsPause','available','waiting','stringify','sms:queue:%s','emit','sms_queue:save','exports','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting'];(function(_0x29c3b2,_0x3c12ac){var _0x4b3aa7=function(_0x622a9d){while(--_0x622a9d){_0x29c3b2['push'](_0x29c3b2['shift']());}};_0x4b3aa7(++_0x3c12ac);}(_0xa9ca,0x131));var _0xaa9c=function(_0x3d64c8,_0x26ea78){_0x3d64c8=_0x3d64c8-0x0;var _0x571201=_0xa9ca[_0x3d64c8];return _0x571201;};'use strict';var _=require('lodash');var md5=require(_0xaa9c('0x0'));var util=require('util');var Redis=require(_0xaa9c('0x1'));var config=require(_0xaa9c('0x2'));config[_0xaa9c('0x3')]=_[_0xaa9c('0x4')](config['redis'],{'host':_0xaa9c('0x5'),'port':0x18eb});var io=require(_0xaa9c('0x6'))(new Redis(config[_0xaa9c('0x3')]));function SmsQueue(_0x5a5e6a){this['id']=_0x5a5e6a['id']||0x0;this[_0xaa9c('0x7')]=_0x5a5e6a[_0xaa9c('0x7')]||'';this['timeout']=_0x5a5e6a[_0xaa9c('0x8')]||0xa;this[_0xaa9c('0x9')]=_0x5a5e6a['strategy']||_0xaa9c('0xa');this[_0xaa9c('0xb')]=_0x5a5e6a[_0xaa9c('0xb')];this[_0xaa9c('0xc')]={};this['waiting']=0x0;this[_0xaa9c('0x0')]='';this[_0xaa9c('0xd')]();this['updateRealtime']();}SmsQueue[_0xaa9c('0xe')][_0xaa9c('0xd')]=function(){var _0x4721ec=this[_0xaa9c('0xc')][_0xaa9c('0xf')];this[_0xaa9c('0xc')]=_[_0xaa9c('0x10')](this[_0xaa9c('0xb')],'id');this[_0xaa9c('0xc')][_0xaa9c('0xf')]=_0x4721ec;};SmsQueue['prototype'][_0xaa9c('0x11')]=function(){this[_0xaa9c('0x12')]=0x0;this[_0xaa9c('0x13')]=0x0;for(var _0x5e454d=0x0;_0x5e454d=0x0?this['available']:0x0;var _0x4348c2={'id':this['id'],'available':this[_0xaa9c('0x16')],'loggedIn':this[_0xaa9c('0x12')],'name':this[_0xaa9c('0x7')],'paused':this['paused'],'waiting':this[_0xaa9c('0x17')]};var _0x4e1a00=md5(JSON[_0xaa9c('0x18')](_0x4348c2));if(this[_0xaa9c('0x0')]!==_0x4e1a00){this[_0xaa9c('0x0')]=_0x4e1a00;io['to'](util['format'](_0xaa9c('0x19'),_0x4348c2[_0xaa9c('0x7')]))[_0xaa9c('0x1a')](_0xaa9c('0x1b'),_0x4348c2);}};module[_0xaa9c('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 73ad1d6..d7b5c1c 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 _0xd184=['chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','prototype','mergeFromDatabase','hasOwnProperty','initAgents','agents','length','isUndefined','initIntervals','updateRouting','updateRealtime','initSmsQueues','initFaxQueues','exports','util','lodash','moment','../model/agent','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','intervals','openchannelQueues','chatQueues','smsQueues','mailQueues','faxQueues'];(function(_0x5549de,_0x6e07d0){var _0x20a518=function(_0x338653){while(--_0x338653){_0x5549de['push'](_0x5549de['shift']());}};_0x20a518(++_0x6e07d0);}(_0xd184,0x9a));var _0x4d18=function(_0x27c959,_0x273d04){_0x27c959=_0x27c959-0x0;var _0x48b87f=_0xd184[_0x27c959];return _0x48b87f;};'use strict';var BPromise=require('bluebird');var util=require(_0x4d18('0x0'));var _=require(_0x4d18('0x1'));var moment=require(_0x4d18('0x2'));var Agent=require(_0x4d18('0x3'));var Interval=require(_0x4d18('0x4'));var OpenchannelQueue=require(_0x4d18('0x5'));var ChatQueue=require(_0x4d18('0x6'));var SmsQueue=require(_0x4d18('0x7'));var MailQueue=require(_0x4d18('0x8'));var FaxQueue=require(_0x4d18('0x9'));var Realtime=function(){this['agents']={};this[_0x4d18('0xa')]={};this[_0x4d18('0xb')]={};this[_0x4d18('0xc')]={};this[_0x4d18('0xd')]={};this[_0x4d18('0xe')]={};this[_0x4d18('0xf')]={};this[_0x4d18('0x10')]={};this[_0x4d18('0x11')]={};this[_0x4d18('0x12')]={};this[_0x4d18('0x13')]={};this[_0x4d18('0x14')]={};};function freeIsNotKey(_0x68828d,_0x4b1731,_0x1cb733){var _0x510adc=_['mapKeys'](_0x68828d,function(_0x341ca3,_0xf5bfd6){return _0x341ca3[_0x1cb733];});for(var _0x40f5d3 in _0x4b1731){if(_0x4b1731['hasOwnProperty'](_0x40f5d3)){if(!_0x510adc[_0x40f5d3]){delete _0x4b1731[_0x40f5d3];}}}}Realtime[_0x4d18('0x15')][_0x4d18('0x16')]=function(_0x31cabe,_0x2bcff6){for(var _0x1e5fe6 in _0x2bcff6){if(_0x31cabe[_0x4d18('0x17')](_0x1e5fe6)){_0x31cabe[_0x1e5fe6]=_0x2bcff6[_0x1e5fe6];}}};Realtime['prototype'][_0x4d18('0x18')]=function(){var _0xdd9def=this;return function(_0x295e25){if(_0x295e25){freeIsNotKey(_0x295e25,_0xdd9def[_0x4d18('0x19')],'id');for(var _0x2892ab=0x0,_0x54d0f9={},_0x456900={};_0x2892ab<_0x295e25[_0x4d18('0x1a')];_0x2892ab+=0x1){_0x54d0f9=_0x295e25[_0x2892ab];if(_[_0x4d18('0x1b')](_0xdd9def[_0x4d18('0x19')][_0x54d0f9['id']])){_0xdd9def[_0x4d18('0x19')][_0x54d0f9['id']]=new Agent(_0x54d0f9);}else{_0xdd9def[_0x4d18('0x16')](_0xdd9def[_0x4d18('0x19')][_0x54d0f9['id']],_0x54d0f9);}}}return _0xdd9def['agents'];};};Realtime[_0x4d18('0x15')][_0x4d18('0x1c')]=function(){var _0x3ef752=this;return function(_0x2d431c){if(_0x2d431c){freeIsNotKey(_0x2d431c,_0x3ef752[_0x4d18('0xa')],'id');for(var _0xa11263=0x0,_0x3be868={},_0x1334f4={};_0xa11263<_0x2d431c[_0x4d18('0x1a')];_0xa11263+=0x1){_0x3be868=_0x2d431c[_0xa11263];if(_['isUndefined'](_0x3ef752['intervals'][_0x3be868['id']])){_0x3ef752[_0x4d18('0xa')][_0x3be868['id']]=new Interval(_0x3be868);}else{_0x3ef752[_0x4d18('0x16')](_0x3ef752['intervals'][_0x3be868['id']],_0x3be868);}}}return _0x3ef752[_0x4d18('0xa')];};};Realtime[_0x4d18('0x15')]['initOpenchannelQueues']=function(){var _0x27cea5=this;return function(_0x356073){if(_0x356073){freeIsNotKey(_0x356073,_0x27cea5[_0x4d18('0xb')],'id');for(var _0x2efa5a=0x0,_0x9c3514={},_0x2dde27={};_0x2efa5a<_0x356073[_0x4d18('0x1a')];_0x2efa5a+=0x1){_0x9c3514=_0x356073[_0x2efa5a];if(_['isUndefined'](_0x27cea5[_0x4d18('0xb')][_0x9c3514['id']])){_0x27cea5[_0x4d18('0xb')][_0x9c3514['id']]=new OpenchannelQueue(_0x9c3514);}else{_0x27cea5['mergeFromDatabase'](_0x27cea5[_0x4d18('0xb')][_0x9c3514['id']],_0x9c3514);}_0x27cea5[_0x4d18('0xb')][_0x9c3514['id']][_0x4d18('0x1d')]();_0x27cea5[_0x4d18('0xb')][_0x9c3514['id']][_0x4d18('0x1e')]();}}return _0x27cea5[_0x4d18('0xb')];};};Realtime[_0x4d18('0x15')]['initChatQueues']=function(){var _0x4a622d=this;return function(_0x5d9c55){if(_0x5d9c55){freeIsNotKey(_0x5d9c55,_0x4a622d[_0x4d18('0xc')],'id');for(var _0x17c595=0x0,_0x5b5f57={},_0x1b96f9={};_0x17c595<_0x5d9c55['length'];_0x17c595+=0x1){_0x5b5f57=_0x5d9c55[_0x17c595];if(_[_0x4d18('0x1b')](_0x4a622d[_0x4d18('0xc')][_0x5b5f57['id']])){_0x4a622d[_0x4d18('0xc')][_0x5b5f57['id']]=new ChatQueue(_0x5b5f57);}else{_0x4a622d[_0x4d18('0x16')](_0x4a622d[_0x4d18('0xc')][_0x5b5f57['id']],_0x5b5f57);}_0x4a622d[_0x4d18('0xc')][_0x5b5f57['id']]['updateRouting']();_0x4a622d[_0x4d18('0xc')][_0x5b5f57['id']][_0x4d18('0x1e')]();}}return _0x4a622d[_0x4d18('0xc')];};};Realtime[_0x4d18('0x15')][_0x4d18('0x1f')]=function(){var _0x9f5c36=this;return function(_0x5804aa){if(_0x5804aa){freeIsNotKey(_0x5804aa,_0x9f5c36[_0x4d18('0xd')],'id');for(var _0x65ce49=0x0,_0x37143b={},_0x57a567={};_0x65ce49<_0x5804aa['length'];_0x65ce49+=0x1){_0x37143b=_0x5804aa[_0x65ce49];if(_[_0x4d18('0x1b')](_0x9f5c36['smsQueues'][_0x37143b['id']])){_0x9f5c36[_0x4d18('0xd')][_0x37143b['id']]=new SmsQueue(_0x37143b);}else{_0x9f5c36[_0x4d18('0x16')](_0x9f5c36[_0x4d18('0xd')][_0x37143b['id']],_0x37143b);}_0x9f5c36['smsQueues'][_0x37143b['id']][_0x4d18('0x1d')]();_0x9f5c36[_0x4d18('0xd')][_0x37143b['id']][_0x4d18('0x1e')]();}}return _0x9f5c36[_0x4d18('0xd')];};};Realtime['prototype']['initMailQueues']=function(){var _0x202896=this;return function(_0x5ab6a0){if(_0x5ab6a0){freeIsNotKey(_0x5ab6a0,_0x202896[_0x4d18('0xe')],'id');for(var _0x1bf7d6=0x0,_0x3131e8={},_0xa88b2c={};_0x1bf7d6<_0x5ab6a0['length'];_0x1bf7d6+=0x1){_0x3131e8=_0x5ab6a0[_0x1bf7d6];if(_['isUndefined'](_0x202896[_0x4d18('0xe')][_0x3131e8['id']])){_0x202896['mailQueues'][_0x3131e8['id']]=new MailQueue(_0x3131e8);}else{_0x202896['mergeFromDatabase'](_0x202896['mailQueues'][_0x3131e8['id']],_0x3131e8);}_0x202896[_0x4d18('0xe')][_0x3131e8['id']]['updateRouting']();_0x202896[_0x4d18('0xe')][_0x3131e8['id']][_0x4d18('0x1e')]();}}return _0x202896[_0x4d18('0xe')];};};Realtime[_0x4d18('0x15')][_0x4d18('0x20')]=function(){var _0x9840d3=this;return function(_0x41449d){if(_0x41449d){freeIsNotKey(_0x41449d,_0x9840d3['faxQueues'],'id');for(var _0x18e274=0x0,_0x371f71={},_0x5cb160={};_0x18e274<_0x41449d['length'];_0x18e274+=0x1){_0x371f71=_0x41449d[_0x18e274];if(_[_0x4d18('0x1b')](_0x9840d3[_0x4d18('0xf')][_0x371f71['id']])){_0x9840d3[_0x4d18('0xf')][_0x371f71['id']]=new FaxQueue(_0x371f71);}else{_0x9840d3['mergeFromDatabase'](_0x9840d3[_0x4d18('0xf')][_0x371f71['id']],_0x371f71);}_0x9840d3[_0x4d18('0xf')][_0x371f71['id']][_0x4d18('0x1d')]();_0x9840d3[_0x4d18('0xf')][_0x371f71['id']][_0x4d18('0x1e')]();}}return _0x9840d3[_0x4d18('0xf')];};};module[_0x4d18('0x21')]=Realtime; \ No newline at end of file +var _0x2fd3=['smsQueues','mailQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','mapKeys','prototype','hasOwnProperty','initAgents','length','isUndefined','mergeFromDatabase','initIntervals','initOpenchannelQueues','updateRouting','updateRealtime','chatQueues','initSmsQueues','initMailQueues','exports','bluebird','util','lodash','moment','../model/agent','../model/interval','../model/openchannelQueue','../model/chatQueue','agents','intervals','openchannelQueues'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x2fd3,0xbb));var _0x32fd=function(_0x4e4711,_0x156a28){_0x4e4711=_0x4e4711-0x0;var _0x4a1a24=_0x2fd3[_0x4e4711];return _0x4a1a24;};'use strict';var BPromise=require(_0x32fd('0x0'));var util=require(_0x32fd('0x1'));var _=require(_0x32fd('0x2'));var moment=require(_0x32fd('0x3'));var Agent=require(_0x32fd('0x4'));var Interval=require(_0x32fd('0x5'));var OpenchannelQueue=require(_0x32fd('0x6'));var ChatQueue=require(_0x32fd('0x7'));var SmsQueue=require('../model/smsQueue');var MailQueue=require('../model/mailQueue');var FaxQueue=require('../model/faxQueue');var Realtime=function(){this[_0x32fd('0x8')]={};this[_0x32fd('0x9')]={};this[_0x32fd('0xa')]={};this['chatQueues']={};this[_0x32fd('0xb')]={};this[_0x32fd('0xc')]={};this[_0x32fd('0xd')]={};this[_0x32fd('0xe')]={};this[_0x32fd('0xf')]={};this[_0x32fd('0x10')]={};this['smsQueuesWaitingInteractions']={};this[_0x32fd('0x11')]={};};function freeIsNotKey(_0x2da0c9,_0x1431a1,_0x31c223){var _0x3701ef=_[_0x32fd('0x12')](_0x2da0c9,function(_0x5858f1,_0x509df4){return _0x5858f1[_0x31c223];});for(var _0x34d8dd in _0x1431a1){if(_0x1431a1['hasOwnProperty'](_0x34d8dd)){if(!_0x3701ef[_0x34d8dd]){delete _0x1431a1[_0x34d8dd];}}}}Realtime[_0x32fd('0x13')]['mergeFromDatabase']=function(_0x3ba238,_0x5da4de){for(var _0x189a07 in _0x5da4de){if(_0x3ba238[_0x32fd('0x14')](_0x189a07)){_0x3ba238[_0x189a07]=_0x5da4de[_0x189a07];}}};Realtime['prototype'][_0x32fd('0x15')]=function(){var _0x2ef3b=this;return function(_0x484f30){if(_0x484f30){freeIsNotKey(_0x484f30,_0x2ef3b[_0x32fd('0x8')],'id');for(var _0x54afd8=0x0,_0x4f435e={},_0x598a36={};_0x54afd8<_0x484f30[_0x32fd('0x16')];_0x54afd8+=0x1){_0x4f435e=_0x484f30[_0x54afd8];if(_[_0x32fd('0x17')](_0x2ef3b['agents'][_0x4f435e['id']])){_0x2ef3b[_0x32fd('0x8')][_0x4f435e['id']]=new Agent(_0x4f435e);}else{_0x2ef3b[_0x32fd('0x18')](_0x2ef3b['agents'][_0x4f435e['id']],_0x4f435e);}}}return _0x2ef3b[_0x32fd('0x8')];};};Realtime['prototype'][_0x32fd('0x19')]=function(){var _0x2c0147=this;return function(_0x5b3510){if(_0x5b3510){freeIsNotKey(_0x5b3510,_0x2c0147[_0x32fd('0x9')],'id');for(var _0xa3d795=0x0,_0x2ee70b={},_0x252f4b={};_0xa3d795<_0x5b3510[_0x32fd('0x16')];_0xa3d795+=0x1){_0x2ee70b=_0x5b3510[_0xa3d795];if(_[_0x32fd('0x17')](_0x2c0147[_0x32fd('0x9')][_0x2ee70b['id']])){_0x2c0147[_0x32fd('0x9')][_0x2ee70b['id']]=new Interval(_0x2ee70b);}else{_0x2c0147[_0x32fd('0x18')](_0x2c0147[_0x32fd('0x9')][_0x2ee70b['id']],_0x2ee70b);}}}return _0x2c0147['intervals'];};};Realtime[_0x32fd('0x13')][_0x32fd('0x1a')]=function(){var _0xe10703=this;return function(_0x153fe6){if(_0x153fe6){freeIsNotKey(_0x153fe6,_0xe10703['openchannelQueues'],'id');for(var _0x5003f8=0x0,_0x134ad6={},_0x3640bd={};_0x5003f8<_0x153fe6[_0x32fd('0x16')];_0x5003f8+=0x1){_0x134ad6=_0x153fe6[_0x5003f8];if(_[_0x32fd('0x17')](_0xe10703[_0x32fd('0xa')][_0x134ad6['id']])){_0xe10703[_0x32fd('0xa')][_0x134ad6['id']]=new OpenchannelQueue(_0x134ad6);}else{_0xe10703[_0x32fd('0x18')](_0xe10703[_0x32fd('0xa')][_0x134ad6['id']],_0x134ad6);}_0xe10703['openchannelQueues'][_0x134ad6['id']][_0x32fd('0x1b')]();_0xe10703[_0x32fd('0xa')][_0x134ad6['id']][_0x32fd('0x1c')]();}}return _0xe10703[_0x32fd('0xa')];};};Realtime['prototype']['initChatQueues']=function(){var _0x4a0937=this;return function(_0x3e43a1){if(_0x3e43a1){freeIsNotKey(_0x3e43a1,_0x4a0937[_0x32fd('0x1d')],'id');for(var _0x26ed87=0x0,_0x320a90={},_0x3ece5c={};_0x26ed87<_0x3e43a1[_0x32fd('0x16')];_0x26ed87+=0x1){_0x320a90=_0x3e43a1[_0x26ed87];if(_['isUndefined'](_0x4a0937['chatQueues'][_0x320a90['id']])){_0x4a0937[_0x32fd('0x1d')][_0x320a90['id']]=new ChatQueue(_0x320a90);}else{_0x4a0937[_0x32fd('0x18')](_0x4a0937[_0x32fd('0x1d')][_0x320a90['id']],_0x320a90);}_0x4a0937[_0x32fd('0x1d')][_0x320a90['id']][_0x32fd('0x1b')]();_0x4a0937[_0x32fd('0x1d')][_0x320a90['id']][_0x32fd('0x1c')]();}}return _0x4a0937[_0x32fd('0x1d')];};};Realtime[_0x32fd('0x13')][_0x32fd('0x1e')]=function(){var _0x112854=this;return function(_0x358562){if(_0x358562){freeIsNotKey(_0x358562,_0x112854[_0x32fd('0xb')],'id');for(var _0x205477=0x0,_0x6933fe={},_0x4f2244={};_0x205477<_0x358562[_0x32fd('0x16')];_0x205477+=0x1){_0x6933fe=_0x358562[_0x205477];if(_[_0x32fd('0x17')](_0x112854[_0x32fd('0xb')][_0x6933fe['id']])){_0x112854[_0x32fd('0xb')][_0x6933fe['id']]=new SmsQueue(_0x6933fe);}else{_0x112854[_0x32fd('0x18')](_0x112854[_0x32fd('0xb')][_0x6933fe['id']],_0x6933fe);}_0x112854[_0x32fd('0xb')][_0x6933fe['id']][_0x32fd('0x1b')]();_0x112854[_0x32fd('0xb')][_0x6933fe['id']][_0x32fd('0x1c')]();}}return _0x112854['smsQueues'];};};Realtime[_0x32fd('0x13')][_0x32fd('0x1f')]=function(){var _0xac3e71=this;return function(_0x1165f1){if(_0x1165f1){freeIsNotKey(_0x1165f1,_0xac3e71[_0x32fd('0xc')],'id');for(var _0x3e52b9=0x0,_0xf116ce={},_0x2c1746={};_0x3e52b9<_0x1165f1[_0x32fd('0x16')];_0x3e52b9+=0x1){_0xf116ce=_0x1165f1[_0x3e52b9];if(_[_0x32fd('0x17')](_0xac3e71[_0x32fd('0xc')][_0xf116ce['id']])){_0xac3e71[_0x32fd('0xc')][_0xf116ce['id']]=new MailQueue(_0xf116ce);}else{_0xac3e71[_0x32fd('0x18')](_0xac3e71[_0x32fd('0xc')][_0xf116ce['id']],_0xf116ce);}_0xac3e71[_0x32fd('0xc')][_0xf116ce['id']]['updateRouting']();_0xac3e71['mailQueues'][_0xf116ce['id']][_0x32fd('0x1c')]();}}return _0xac3e71['mailQueues'];};};Realtime[_0x32fd('0x13')]['initFaxQueues']=function(){var _0x5c9fcc=this;return function(_0x440cea){if(_0x440cea){freeIsNotKey(_0x440cea,_0x5c9fcc[_0x32fd('0xd')],'id');for(var _0x22758b=0x0,_0x53815d={},_0x1eff5c={};_0x22758b<_0x440cea[_0x32fd('0x16')];_0x22758b+=0x1){_0x53815d=_0x440cea[_0x22758b];if(_[_0x32fd('0x17')](_0x5c9fcc[_0x32fd('0xd')][_0x53815d['id']])){_0x5c9fcc[_0x32fd('0xd')][_0x53815d['id']]=new FaxQueue(_0x53815d);}else{_0x5c9fcc[_0x32fd('0x18')](_0x5c9fcc[_0x32fd('0xd')][_0x53815d['id']],_0x53815d);}_0x5c9fcc[_0x32fd('0xd')][_0x53815d['id']][_0x32fd('0x1b')]();_0x5c9fcc['faxQueues'][_0x53815d['id']][_0x32fd('0x1c')]();}}return _0x5c9fcc[_0x32fd('0xd')];};};module[_0x32fd('0x20')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index ef0f316..14145e9 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 _0x705c=['addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x1b2f27,_0x499b97){var _0x1a8e6b=function(_0x282725){while(--_0x282725){_0x1b2f27['push'](_0x1b2f27['shift']());}};_0x1a8e6b(++_0x499b97);}(_0x705c,0x145));var _0xc705=function(_0x241110,_0x4ffdb2){_0x241110=_0x241110-0x0;var _0x4a693e=_0x705c[_0x241110];return _0x4a693e;};'use strict';var client=require(_0xc705('0x0'));exports['update']=function(_0x495fa3,_0x350f79){return client[_0xc705('0x1')](_0xc705('0x2'),{'body':_0x350f79,'options':{'where':{'id':_0x495fa3}},'log':_0xc705('0x3')});};exports[_0xc705('0x4')]=function(_0xdccbb0,_0x92eb64){return client[_0xc705('0x1')](_0xc705('0x5'),{'body':_0x92eb64,'options':{'where':{'id':_0xdccbb0}},'log':_0xc705('0x6')});}; \ No newline at end of file +var _0x2721=['Request','updateChatInteraction','addTags','../client'];(function(_0x33069b,_0x319a71){var _0x2c780b=function(_0x42ca7d){while(--_0x42ca7d){_0x33069b['push'](_0x33069b['shift']());}};_0x2c780b(++_0x319a71);}(_0x2721,0x93));var _0x1272=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x2721[_0x2070da];return _0x4f9fe1;};'use strict';var client=require(_0x1272('0x0'));exports['update']=function(_0x1726ef,_0x36ccae){return client[_0x1272('0x1')]('UpdateChatInteraction',{'body':_0x36ccae,'options':{'where':{'id':_0x1726ef}},'log':_0x1272('0x2')});};exports[_0x1272('0x3')]=function(_0x5997ef,_0x16de43){return client[_0x1272('0x1')]('AddTagsToChatInteraction',{'body':_0x16de43,'options':{'where':{'id':_0x5997ef}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index e96fe41..1660da0 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 _0xad0b=['Request','CreateChatMessage','createChatMessage','../client','create'];(function(_0x4a1ffd,_0x542f9b){var _0x21c510=function(_0x48ab48){while(--_0x48ab48){_0x4a1ffd['push'](_0x4a1ffd['shift']());}};_0x21c510(++_0x542f9b);}(_0xad0b,0xfd));var _0xbad0=function(_0x16c8e1,_0x1c04c1){_0x16c8e1=_0x16c8e1-0x0;var _0x27bfef=_0xad0b[_0x16c8e1];return _0x27bfef;};'use strict';var client=require(_0xbad0('0x0'));exports[_0xbad0('0x1')]=function(_0x4b2640){return client[_0xbad0('0x2')](_0xbad0('0x3'),{'body':_0x4b2640,'log':_0xbad0('0x4')});}; \ No newline at end of file +var _0x49bd=['Request','createChatMessage','../client','create'];(function(_0x142e16,_0x35c05f){var _0x5e12d9=function(_0x37c4c1){while(--_0x37c4c1){_0x142e16['push'](_0x142e16['shift']());}};_0x5e12d9(++_0x35c05f);}(_0x49bd,0xf6));var _0xd49b=function(_0x36c438,_0x3af9cb){_0x36c438=_0x36c438-0x0;var _0x1883a6=_0x49bd[_0x36c438];return _0x1883a6;};'use strict';var client=require(_0xd49b('0x0'));exports[_0xd49b('0x1')]=function(_0x238dd3){return client[_0xd49b('0x2')]('CreateChatMessage',{'body':_0x238dd3,'log':_0xd49b('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 923536f..5919374 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 _0x252a=['online','chatPause','getChatQueues','../client','Request','GetChatQueue','name','User','Agents'];(function(_0x420c57,_0x210bf1){var _0x25c7e2=function(_0x735917){while(--_0x735917){_0x420c57['push'](_0x420c57['shift']());}};_0x25c7e2(++_0x210bf1);}(_0x252a,0x123));var _0xa252=function(_0x3accad,_0x353cdd){_0x3accad=_0x3accad-0x0;var _0x11a599=_0x252a[_0x3accad];return _0x11a599;};'use strict';var client=require(_0xa252('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xa252('0x1')](_0xa252('0x2'),{'options':{'raw':![],'attributes':['id',_0xa252('0x3'),'timeout','strategy'],'include':[{'model':_0xa252('0x4'),'as':_0xa252('0x5'),'attributes':['id',_0xa252('0x3'),_0xa252('0x6'),_0xa252('0x7')]}]},'log':_0xa252('0x8')});};}; \ No newline at end of file +var _0xce3b=['../client','Request','GetChatQueue','name','timeout','strategy','User','online','chatPause'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xce3b,0x75));var _0xbce3=function(_0x21d620,_0x5a581f){_0x21d620=_0x21d620-0x0;var _0x3da081=_0xce3b[_0x21d620];return _0x3da081;};'use strict';var client=require(_0xbce3('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xbce3('0x1')](_0xbce3('0x2'),{'options':{'raw':![],'attributes':['id',_0xbce3('0x3'),_0xbce3('0x4'),_0xbce3('0x5')],'include':[{'model':_0xbce3('0x6'),'as':'Agents','attributes':['id',_0xbce3('0x3'),_0xbce3('0x7'),_0xbce3('0x8')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 2f58a9b..b142fad 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 _0x3402=['DESC','../client','Request','CreateChatQueueReport','UpdateChatQueueReport'];(function(_0x3d090f,_0x17f018){var _0x5be79f=function(_0x15edb7){while(--_0x15edb7){_0x3d090f['push'](_0x3d090f['shift']());}};_0x5be79f(++_0x17f018);}(_0x3402,0x1f0));var _0x2340=function(_0x190745,_0x1df565){_0x190745=_0x190745-0x0;var _0x4aefc2=_0x3402[_0x190745];return _0x4aefc2;};'use strict';var client=require(_0x2340('0x0'));exports['create']=function(_0x18220c){return client[_0x2340('0x1')](_0x2340('0x2'),{'body':_0x18220c,'log':'CreateChatQueueReport'});};exports['update']=function(_0x277b67,_0x1180ff){return client[_0x2340('0x1')](_0x2340('0x3'),{'body':_0x1180ff,'options':{'where':{'uniqueid':_0x277b67},'order':[['id',_0x2340('0x4')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x502a=['../client','create','Request','CreateChatQueueReport','UpdateChatQueueReport','DESC'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x502a,0xd8));var _0xa502=function(_0x5b3b31,_0x380458){_0x5b3b31=_0x5b3b31-0x0;var _0x28822b=_0x502a[_0x5b3b31];return _0x28822b;};'use strict';var client=require(_0xa502('0x0'));exports[_0xa502('0x1')]=function(_0x547597){return client[_0xa502('0x2')](_0xa502('0x3'),{'body':_0x547597,'log':'CreateChatQueueReport'});};exports['update']=function(_0x309222,_0x5c89a6){return client[_0xa502('0x2')](_0xa502('0x4'),{'body':_0x5c89a6,'options':{'where':{'uniqueid':_0x309222},'order':[['id',_0xa502('0x5')]],'limit':0x1},'log':_0xa502('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 76915d3..de206ad 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 _0xe2b1=['../client','update','updateFaxInteraction','addTags','Request','AddTagsToFaxInteraction'];(function(_0x34c7f7,_0x4d6dd7){var _0x510d9c=function(_0x26f3df){while(--_0x26f3df){_0x34c7f7['push'](_0x34c7f7['shift']());}};_0x510d9c(++_0x4d6dd7);}(_0xe2b1,0x1a4));var _0x1e2b=function(_0x2db211,_0x2e6337){_0x2db211=_0x2db211-0x0;var _0x182948=_0xe2b1[_0x2db211];return _0x182948;};'use strict';var client=require(_0x1e2b('0x0'));exports[_0x1e2b('0x1')]=function(_0x2e7ac7,_0x1a7c49){return client['Request']('UpdateFaxInteraction',{'body':_0x1a7c49,'options':{'where':{'id':_0x2e7ac7}},'log':_0x1e2b('0x2')});};exports[_0x1e2b('0x3')]=function(_0x25346d,_0x50a023){return client[_0x1e2b('0x4')](_0x1e2b('0x5'),{'body':_0x50a023,'options':{'where':{'id':_0x25346d}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x0f68=['addTags','AddTagsToFaxInteraction','../client','update','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0f68,0x84));var _0x80f6=function(_0x3a6692,_0x3f6740){_0x3a6692=_0x3a6692-0x0;var _0x1fc8b7=_0x0f68[_0x3a6692];return _0x1fc8b7;};'use strict';var client=require(_0x80f6('0x0'));exports[_0x80f6('0x1')]=function(_0x207e6b,_0x1b69fc){return client[_0x80f6('0x2')]('UpdateFaxInteraction',{'body':_0x1b69fc,'options':{'where':{'id':_0x207e6b}},'log':'updateFaxInteraction'});};exports[_0x80f6('0x3')]=function(_0x2535dd,_0x10e979){return client[_0x80f6('0x2')](_0x80f6('0x4'),{'body':_0x10e979,'options':{'where':{'id':_0x2535dd}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index ff49cdd..d9777aa 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 _0x984e=['create','Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x984e,0xcc));var _0xe984=function(_0xcb69a6,_0x4ae2d7){_0xcb69a6=_0xcb69a6-0x0;var _0x202168=_0x984e[_0xcb69a6];return _0x202168;};'use strict';var client=require(_0xe984('0x0'));exports[_0xe984('0x1')]=function(_0xf13914){return client[_0xe984('0x2')](_0xe984('0x3'),{'body':_0xf13914,'log':_0xe984('0x4')});}; \ No newline at end of file +var _0xe9fd=['../client','create','createFaxMessage'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0xe9fd,0xc9));var _0xde9f=function(_0x46921e,_0x393893){_0x46921e=_0x46921e-0x0;var _0xd20215=_0xe9fd[_0x46921e];return _0xd20215;};'use strict';var client=require(_0xde9f('0x0'));exports[_0xde9f('0x1')]=function(_0x173559){return client['Request']('CreateFaxMessage',{'body':_0x173559,'log':_0xde9f('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index b33d667..ad0ea6b 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 _0x50ab=['Agents','online','faxPause','../client','getFaxQueues','GetFaxQueue','name','User'];(function(_0x2d6d60,_0xd16046){var _0x32e585=function(_0x34f0b4){while(--_0x34f0b4){_0x2d6d60['push'](_0x2d6d60['shift']());}};_0x32e585(++_0xd16046);}(_0x50ab,0x1f3));var _0xb50a=function(_0x10a18d,_0x460b58){_0x10a18d=_0x10a18d-0x0;var _0x352317=_0x50ab[_0x10a18d];return _0x352317;};'use strict';var client=require(_0xb50a('0x0'));exports[_0xb50a('0x1')]=function(){return function(){return client['Request'](_0xb50a('0x2'),{'options':{'raw':![],'attributes':['id',_0xb50a('0x3'),'timeout','strategy'],'include':[{'model':_0xb50a('0x4'),'as':_0xb50a('0x5'),'attributes':['id',_0xb50a('0x3'),_0xb50a('0x6'),_0xb50a('0x7')]}]},'log':_0xb50a('0x1')});};}; \ No newline at end of file +var _0xd2a8=['User','online','faxPause','../client','getFaxQueues','name','timeout','strategy'];(function(_0xb59ec,_0x250e4a){var _0xca4203=function(_0x5814af){while(--_0x5814af){_0xb59ec['push'](_0xb59ec['shift']());}};_0xca4203(++_0x250e4a);}(_0xd2a8,0x1b3));var _0x8d2a=function(_0x5ae282,_0x2747f8){_0x5ae282=_0x5ae282-0x0;var _0x544456=_0xd2a8[_0x5ae282];return _0x544456;};'use strict';var client=require(_0x8d2a('0x0'));exports[_0x8d2a('0x1')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x8d2a('0x2'),_0x8d2a('0x3'),_0x8d2a('0x4')],'include':[{'model':_0x8d2a('0x5'),'as':'Agents','attributes':['id',_0x8d2a('0x2'),_0x8d2a('0x6'),_0x8d2a('0x7')]}]},'log':_0x8d2a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index d03be0e..8635aa2 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 _0xb833=['Request','UpdateFaxQueueReport','DESC','../client','create','CreateFaxQueueReport'];(function(_0x21fe98,_0x55db4c){var _0x19dde3=function(_0x3c38ae){while(--_0x3c38ae){_0x21fe98['push'](_0x21fe98['shift']());}};_0x19dde3(++_0x55db4c);}(_0xb833,0x105));var _0x3b83=function(_0x4c19b2,_0x260a62){_0x4c19b2=_0x4c19b2-0x0;var _0x13bb6b=_0xb833[_0x4c19b2];return _0x13bb6b;};'use strict';var client=require(_0x3b83('0x0'));exports[_0x3b83('0x1')]=function(_0x3469af){return client['Request'](_0x3b83('0x2'),{'body':_0x3469af,'log':_0x3b83('0x2')});};exports['update']=function(_0x1cfca9,_0x1e0a10){return client[_0x3b83('0x3')](_0x3b83('0x4'),{'body':_0x1e0a10,'options':{'where':{'uniqueid':_0x1cfca9},'order':[['id',_0x3b83('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0xa74d=['Request','UpdateFaxQueueReport','DESC','../client','create','CreateFaxQueueReport'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0xa74d,0xcf));var _0xda74=function(_0x100fae,_0x274d1f){_0x100fae=_0x100fae-0x0;var _0xeecfb9=_0xa74d[_0x100fae];return _0xeecfb9;};'use strict';var client=require(_0xda74('0x0'));exports[_0xda74('0x1')]=function(_0x2f6164){return client['Request'](_0xda74('0x2'),{'body':_0x2f6164,'log':_0xda74('0x2')});};exports['update']=function(_0x5b893b,_0x1a15cf){return client[_0xda74('0x3')](_0xda74('0x4'),{'body':_0x1a15cf,'options':{'where':{'uniqueid':_0x5b893b},'order':[['id',_0xda74('0x5')]],'limit':0x1},'log':_0xda74('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index dc3c34e..e31a94c 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 _0x42f4=['Request','GetInterval','name','Interval','Intervals','../client'];(function(_0x3aace9,_0x200660){var _0x4b2671=function(_0x58d193){while(--_0x58d193){_0x3aace9['push'](_0x3aace9['shift']());}};_0x4b2671(++_0x200660);}(_0x42f4,0x19d));var _0x442f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x42f4[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x442f('0x0'));exports['getIntervals']=function(){return function(){return client[_0x442f('0x1')](_0x442f('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x442f('0x3')],'include':[{'model':_0x442f('0x4'),'as':_0x442f('0x5'),'attributes':['id','name','interval']}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x6324=['Request','GetInterval','Interval','name','../client','getIntervals'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x6324,0x142));var _0x4632=function(_0x3891de,_0x55cfe5){_0x3891de=_0x3891de-0x0;var _0x521696=_0x6324[_0x3891de];return _0x521696;};'use strict';var client=require(_0x4632('0x0'));exports[_0x4632('0x1')]=function(){return function(){return client[_0x4632('0x2')](_0x4632('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x4632('0x4'),'as':'Intervals','attributes':['id',_0x4632('0x5'),'interval']}]},'log':_0x4632('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 5d51566..d172066 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 _0x39bc=['updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction'];(function(_0x5cb97e,_0x132a39){var _0x1714b4=function(_0x384210){while(--_0x384210){_0x5cb97e['push'](_0x5cb97e['shift']());}};_0x1714b4(++_0x132a39);}(_0x39bc,0x144));var _0xc39b=function(_0x38b859,_0x415b2e){_0x38b859=_0x38b859-0x0;var _0x518d24=_0x39bc[_0x38b859];return _0x518d24;};'use strict';var client=require(_0xc39b('0x0'));exports[_0xc39b('0x1')]=function(_0x5e68bd,_0x1842e4){return client[_0xc39b('0x2')](_0xc39b('0x3'),{'body':_0x1842e4,'options':{'where':{'id':_0x5e68bd}},'log':_0xc39b('0x4')});};exports[_0xc39b('0x5')]=function(_0x130037,_0x5a1e45){return client[_0xc39b('0x2')](_0xc39b('0x6'),{'body':_0x5a1e45,'options':{'where':{'id':_0x130037}},'log':_0xc39b('0x7')});}; \ No newline at end of file +var _0x6da3=['updateMailInteraction','addTags','addTagsToChatInteraction','update','Request','UpdateMailInteraction'];(function(_0x90eae9,_0x3b7bbe){var _0x5f5a7a=function(_0x19b991){while(--_0x19b991){_0x90eae9['push'](_0x90eae9['shift']());}};_0x5f5a7a(++_0x3b7bbe);}(_0x6da3,0xc9));var _0x36da=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6da3[_0xa464c9];return _0x3d73c4;};'use strict';var client=require('../client');exports[_0x36da('0x0')]=function(_0x5c46b1,_0x3f2942){return client[_0x36da('0x1')](_0x36da('0x2'),{'body':_0x3f2942,'options':{'where':{'id':_0x5c46b1}},'log':_0x36da('0x3')});};exports[_0x36da('0x4')]=function(_0x26bbd3,_0x381665){return client[_0x36da('0x1')]('AddTagsToMailInteraction',{'body':_0x381665,'options':{'where':{'id':_0x26bbd3}},'log':_0x36da('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index c25c3d8..2496422 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 _0xe0e6=['Request','CreateMailMessage','createMailMessage'];(function(_0x1e6c85,_0x59c747){var _0x16ec9b=function(_0xcdeb9e){while(--_0xcdeb9e){_0x1e6c85['push'](_0x1e6c85['shift']());}};_0x16ec9b(++_0x59c747);}(_0xe0e6,0x1bf));var _0x6e0e=function(_0x47410f,_0x53d9b2){_0x47410f=_0x47410f-0x0;var _0x272541=_0xe0e6[_0x47410f];return _0x272541;};'use strict';var client=require('../client');exports['create']=function(_0x4d6151){return client[_0x6e0e('0x0')](_0x6e0e('0x1'),{'body':_0x4d6151,'log':_0x6e0e('0x2')});}; \ No newline at end of file +var _0xa0c4=['create','CreateMailMessage','createMailMessage'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa0c4,0x150));var _0x4a0c=function(_0x369001,_0x31a52a){_0x369001=_0x369001-0x0;var _0x2b6942=_0xa0c4[_0x369001];return _0x2b6942;};'use strict';var client=require('../client');exports[_0x4a0c('0x0')]=function(_0x78f874){return client['Request'](_0x4a0c('0x1'),{'body':_0x78f874,'log':_0x4a0c('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index cff3a12..30fede7 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 _0xec67=['strategy','User','name','online','getMailQueues','Request'];(function(_0x40bb38,_0x5e57e1){var _0x26dd37=function(_0x4eb55f){while(--_0x4eb55f){_0x40bb38['push'](_0x40bb38['shift']());}};_0x26dd37(++_0x5e57e1);}(_0xec67,0xb2));var _0x7ec6=function(_0x2650e9,_0xb91cc){_0x2650e9=_0x2650e9-0x0;var _0x3511c8=_0xec67[_0x2650e9];return _0x3511c8;};'use strict';var client=require('../client');exports[_0x7ec6('0x0')]=function(){return function(){return client[_0x7ec6('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0x7ec6('0x2')],'include':[{'model':_0x7ec6('0x3'),'as':'Agents','attributes':['id',_0x7ec6('0x4'),_0x7ec6('0x5'),'mailPause']}]},'log':_0x7ec6('0x0')});};}; \ No newline at end of file +var _0xdbda=['getMailQueues','Request','GetMailQueue','name','timeout','strategy','User','Agents','online','mailPause','../client'];(function(_0x382f7e,_0x4c41fd){var _0x3abb72=function(_0x1da9b6){while(--_0x1da9b6){_0x382f7e['push'](_0x382f7e['shift']());}};_0x3abb72(++_0x4c41fd);}(_0xdbda,0x18b));var _0xadbd=function(_0x5352e3,_0x556688){_0x5352e3=_0x5352e3-0x0;var _0x5166d2=_0xdbda[_0x5352e3];return _0x5166d2;};'use strict';var client=require(_0xadbd('0x0'));exports[_0xadbd('0x1')]=function(){return function(){return client[_0xadbd('0x2')](_0xadbd('0x3'),{'options':{'raw':![],'attributes':['id',_0xadbd('0x4'),_0xadbd('0x5'),_0xadbd('0x6')],'include':[{'model':_0xadbd('0x7'),'as':_0xadbd('0x8'),'attributes':['id',_0xadbd('0x4'),_0xadbd('0x9'),_0xadbd('0xa')]}]},'log':_0xadbd('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 7862172..f8abb11 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 _0xf14d=['CreateMailQueueReport','UpdateMailQueueReport','DESC','../client','create','Request'];(function(_0x42377e,_0xb8ad32){var _0x264d67=function(_0x461ecd){while(--_0x461ecd){_0x42377e['push'](_0x42377e['shift']());}};_0x264d67(++_0xb8ad32);}(_0xf14d,0x153));var _0xdf14=function(_0x659a10,_0x2a070c){_0x659a10=_0x659a10-0x0;var _0x4be7ae=_0xf14d[_0x659a10];return _0x4be7ae;};'use strict';var client=require(_0xdf14('0x0'));exports[_0xdf14('0x1')]=function(_0x5cef17){return client[_0xdf14('0x2')]('CreateMailQueueReport',{'body':_0x5cef17,'log':_0xdf14('0x3')});};exports['update']=function(_0x2f7fde,_0x2deeae){return client[_0xdf14('0x2')](_0xdf14('0x4'),{'body':_0x2deeae,'options':{'where':{'uniqueid':_0x2f7fde},'order':[['id',_0xdf14('0x5')]],'limit':0x1},'log':_0xdf14('0x4')});}; \ No newline at end of file +var _0x02df=['../client','create','CreateMailQueueReport','update','UpdateMailQueueReport','DESC'];(function(_0x936966,_0x38472d){var _0x11a898=function(_0x21eedd){while(--_0x21eedd){_0x936966['push'](_0x936966['shift']());}};_0x11a898(++_0x38472d);}(_0x02df,0xf6));var _0xf02d=function(_0x5b5a4f,_0x1e27c3){_0x5b5a4f=_0x5b5a4f-0x0;var _0x2a2f85=_0x02df[_0x5b5a4f];return _0x2a2f85;};'use strict';var client=require(_0xf02d('0x0'));exports[_0xf02d('0x1')]=function(_0x194a9a){return client['Request']('CreateMailQueueReport',{'body':_0x194a9a,'log':_0xf02d('0x2')});};exports[_0xf02d('0x3')]=function(_0x20cc2b,_0x33cbf0){return client['Request'](_0xf02d('0x4'),{'body':_0x33cbf0,'options':{'where':{'uniqueid':_0x20cc2b},'order':[['id',_0xf02d('0x5')]],'limit':0x1},'log':_0xf02d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 842be2c..36faf22 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 _0xb38d=['../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','addTagsToChatInteraction'];(function(_0x260789,_0x8da74d){var _0x20791a=function(_0x56dcb2){while(--_0x56dcb2){_0x260789['push'](_0x260789['shift']());}};_0x20791a(++_0x8da74d);}(_0xb38d,0x11f));var _0xdb38=function(_0x2d1314,_0x567214){_0x2d1314=_0x2d1314-0x0;var _0x34f655=_0xb38d[_0x2d1314];return _0x34f655;};'use strict';var client=require(_0xdb38('0x0'));exports[_0xdb38('0x1')]=function(_0xec2fa6,_0x1adc85){return client[_0xdb38('0x2')](_0xdb38('0x3'),{'body':_0x1adc85,'options':{'where':{'id':_0xec2fa6}},'log':_0xdb38('0x4')});};exports[_0xdb38('0x5')]=function(_0x392859,_0x3fda86){return client[_0xdb38('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x3fda86,'options':{'where':{'id':_0x392859}},'log':_0xdb38('0x6')});}; \ No newline at end of file +var _0x7821=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x2c95ce,_0x50ba75){var _0x1554d6=function(_0x6d80c8){while(--_0x6d80c8){_0x2c95ce['push'](_0x2c95ce['shift']());}};_0x1554d6(++_0x50ba75);}(_0x7821,0xc3));var _0x1782=function(_0x3c5aa6,_0x4c4f86){_0x3c5aa6=_0x3c5aa6-0x0;var _0x49e397=_0x7821[_0x3c5aa6];return _0x49e397;};'use strict';var client=require(_0x1782('0x0'));exports['update']=function(_0x18e1dd,_0x5d7608){return client[_0x1782('0x1')](_0x1782('0x2'),{'body':_0x5d7608,'options':{'where':{'id':_0x18e1dd}},'log':_0x1782('0x3')});};exports[_0x1782('0x4')]=function(_0x4d2a06,_0x124bbe){return client['Request'](_0x1782('0x5'),{'body':_0x124bbe,'options':{'where':{'id':_0x4d2a06}},'log':_0x1782('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 43e2375..9512bce 100644 --- a/server/services/routing/rpc/openchannelMessage.js +++ b/server/services/routing/rpc/openchannelMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['../client','create','Request','createOpenchannelMessage'];(function(_0x41abfd,_0x48fa95){var _0x346c75=function(_0x2244ac){while(--_0x2244ac){_0x41abfd['push'](_0x41abfd['shift']());}};_0x346c75(++_0x48fa95);}(_0x34e8,0x12c));var _0x834e=function(_0x590ff2,_0x43c659){_0x590ff2=_0x590ff2-0x0;var _0x591fdf=_0x34e8[_0x590ff2];return _0x591fdf;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateOpenchannelMessage',{'body':_0x8b339,'log':_0x834e('0x3')});}; \ No newline at end of file +var _0x0bb5=['../client','create','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x501246,_0x133017){var _0x4fa399=function(_0xfaef6c){while(--_0xfaef6c){_0x501246['push'](_0x501246['shift']());}};_0x4fa399(++_0x133017);}(_0x0bb5,0x148));var _0x50bb=function(_0x309a7b,_0x57fffa){_0x309a7b=_0x309a7b-0x0;var _0x18013c=_0x0bb5[_0x309a7b];return _0x18013c;};'use strict';var client=require(_0x50bb('0x0'));exports[_0x50bb('0x1')]=function(_0x5e61cf){return client['Request'](_0x50bb('0x2'),{'body':_0x5e61cf,'log':_0x50bb('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index cb836c2..1a2e507 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 _0xd055=['GetOpenchannelQueue','strategy','getOpenchannelQueues','../client'];(function(_0x2478fd,_0x55708e){var _0x52ec7f=function(_0x5c6ef2){while(--_0x5c6ef2){_0x2478fd['push'](_0x2478fd['shift']());}};_0x52ec7f(++_0x55708e);}(_0xd055,0x13f));var _0x5d05=function(_0x268c4c,_0x5cce8d){_0x268c4c=_0x268c4c-0x0;var _0x37e96e=_0xd055[_0x268c4c];return _0x37e96e;};'use strict';var client=require(_0x5d05('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client['Request'](_0x5d05('0x1'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x5d05('0x2')],'include':[{'model':'User','as':'Agents','attributes':['id','name','online','openchannelPause']}]},'log':_0x5d05('0x3')});};}; \ No newline at end of file +var _0xee17=['getOpenchannelQueues','GetOpenchannelQueue','name','timeout','User','openchannelPause','../client'];(function(_0x4f9a47,_0x381d54){var _0x2e6d3d=function(_0x3750ea){while(--_0x3750ea){_0x4f9a47['push'](_0x4f9a47['shift']());}};_0x2e6d3d(++_0x381d54);}(_0xee17,0xae));var _0x7ee1=function(_0x5c8d8e,_0x2615f5){_0x5c8d8e=_0x5c8d8e-0x0;var _0x4c0d99=_0xee17[_0x5c8d8e];return _0x4c0d99;};'use strict';var client=require(_0x7ee1('0x0'));exports[_0x7ee1('0x1')]=function(){return function(){return client['Request'](_0x7ee1('0x2'),{'options':{'raw':![],'attributes':['id',_0x7ee1('0x3'),_0x7ee1('0x4'),'strategy'],'include':[{'model':_0x7ee1('0x5'),'as':'Agents','attributes':['id',_0x7ee1('0x3'),'online',_0x7ee1('0x6')]}]},'log':_0x7ee1('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index becd903..2a6579d 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 _0x983e=['UpdateOpenchannelQueueReport','../client','Request','CreateOpenchannelQueueReport','update'];(function(_0x39ff10,_0x438446){var _0x2f71a2=function(_0x525dd5){while(--_0x525dd5){_0x39ff10['push'](_0x39ff10['shift']());}};_0x2f71a2(++_0x438446);}(_0x983e,0x8d));var _0xe983=function(_0x39aed8,_0xe8799c){_0x39aed8=_0x39aed8-0x0;var _0x4faa9a=_0x983e[_0x39aed8];return _0x4faa9a;};'use strict';var client=require(_0xe983('0x0'));exports['create']=function(_0x5618f7){return client[_0xe983('0x1')]('CreateOpenchannelQueueReport',{'body':_0x5618f7,'log':_0xe983('0x2')});};exports[_0xe983('0x3')]=function(_0x2e5bbf,_0x464bc7){return client[_0xe983('0x1')](_0xe983('0x4'),{'body':_0x464bc7,'options':{'where':{'uniqueid':_0x2e5bbf},'order':[['id','DESC']],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x30fb=['CreateOpenchannelQueueReport','update','DESC','UpdateOpenchannelQueueReport','../client','create','Request'];(function(_0x509e6a,_0x9755d8){var _0x48bc04=function(_0x38774d){while(--_0x38774d){_0x509e6a['push'](_0x509e6a['shift']());}};_0x48bc04(++_0x9755d8);}(_0x30fb,0x19a));var _0xb30f=function(_0x2e0def,_0x359c85){_0x2e0def=_0x2e0def-0x0;var _0x119e85=_0x30fb[_0x2e0def];return _0x119e85;};'use strict';var client=require(_0xb30f('0x0'));exports[_0xb30f('0x1')]=function(_0x144b03){return client[_0xb30f('0x2')](_0xb30f('0x3'),{'body':_0x144b03,'log':_0xb30f('0x3')});};exports[_0xb30f('0x4')]=function(_0x21782e,_0x294be5){return client[_0xb30f('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x294be5,'options':{'where':{'uniqueid':_0x21782e},'order':[['id',_0xb30f('0x5')]],'limit':0x1},'log':_0xb30f('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 265456b..d4f807c 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 _0x4e32=['update','Request','UpdateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x4a9247,_0x11f7ac){var _0x53cef9=function(_0xd387d6){while(--_0xd387d6){_0x4a9247['push'](_0x4a9247['shift']());}};_0x53cef9(++_0x11f7ac);}(_0x4e32,0x1b0));var _0x24e3=function(_0x5ce2c5,_0xa19f29){_0x5ce2c5=_0x5ce2c5-0x0;var _0x3e9adc=_0x4e32[_0x5ce2c5];return _0x3e9adc;};'use strict';var client=require('../client');exports[_0x24e3('0x0')]=function(_0x638426,_0x3410e6){return client[_0x24e3('0x1')](_0x24e3('0x2'),{'body':_0x3410e6,'options':{'where':{'id':_0x638426}},'log':'updateSmsInteraction'});};exports[_0x24e3('0x3')]=function(_0x263b70,_0x4f2943){return client[_0x24e3('0x1')](_0x24e3('0x4'),{'body':_0x4f2943,'options':{'where':{'id':_0x263b70}},'log':_0x24e3('0x5')});}; \ No newline at end of file +var _0xb052=['UpdateSmsInteraction','updateSmsInteraction','addTags','addTagsToSmsInteraction','../client','update','Request'];(function(_0x592238,_0xc8ff1e){var _0x4bdf33=function(_0x525784){while(--_0x525784){_0x592238['push'](_0x592238['shift']());}};_0x4bdf33(++_0xc8ff1e);}(_0xb052,0x1bd));var _0x2b05=function(_0x5d9ceb,_0x1a49f5){_0x5d9ceb=_0x5d9ceb-0x0;var _0x33ce82=_0xb052[_0x5d9ceb];return _0x33ce82;};'use strict';var client=require(_0x2b05('0x0'));exports[_0x2b05('0x1')]=function(_0xfb3651,_0x26f8dc){return client[_0x2b05('0x2')](_0x2b05('0x3'),{'body':_0x26f8dc,'options':{'where':{'id':_0xfb3651}},'log':_0x2b05('0x4')});};exports[_0x2b05('0x5')]=function(_0x723e41,_0xbce038){return client['Request']('AddTagsToSmsInteraction',{'body':_0xbce038,'options':{'where':{'id':_0x723e41}},'log':_0x2b05('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 3068f35..34eca72 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 _0xaf55=['CreateSmsMessage','createSmsMessage','../client','create'];(function(_0xd95a69,_0x1342ba){var _0x1108c6=function(_0x30d2f9){while(--_0x30d2f9){_0xd95a69['push'](_0xd95a69['shift']());}};_0x1108c6(++_0x1342ba);}(_0xaf55,0x1a2));var _0x5af5=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0xaf55[_0x45bf86];return _0x1f02b7;};'use strict';var client=require(_0x5af5('0x0'));exports[_0x5af5('0x1')]=function(_0x435cb7){return client['Request'](_0x5af5('0x2'),{'body':_0x435cb7,'log':_0x5af5('0x3')});}; \ No newline at end of file +var _0x1f61=['createSmsMessage','../client','create','Request','CreateSmsMessage'];(function(_0x1399d0,_0xb11468){var _0x3e7a98=function(_0x18f1ef){while(--_0x18f1ef){_0x1399d0['push'](_0x1399d0['shift']());}};_0x3e7a98(++_0xb11468);}(_0x1f61,0x83));var _0x11f6=function(_0x198885,_0x2f71b6){_0x198885=_0x198885-0x0;var _0x3b0ca0=_0x1f61[_0x198885];return _0x3b0ca0;};'use strict';var client=require(_0x11f6('0x0'));exports[_0x11f6('0x1')]=function(_0x5930b1){return client[_0x11f6('0x2')](_0x11f6('0x3'),{'body':_0x5930b1,'log':_0x11f6('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index d153c8e..3eea4e1 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 _0x6816=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','../client'];(function(_0x267bfd,_0x4d699a){var _0x4c8719=function(_0x4caafa){while(--_0x4caafa){_0x267bfd['push'](_0x267bfd['shift']());}};_0x4c8719(++_0x4d699a);}(_0x6816,0x97));var _0x6681=function(_0x2b1ce5,_0x439cc1){_0x2b1ce5=_0x2b1ce5-0x0;var _0x34703d=_0x6816[_0x2b1ce5];return _0x34703d;};'use strict';var client=require(_0x6681('0x0'));exports[_0x6681('0x1')]=function(){return function(){return client[_0x6681('0x2')](_0x6681('0x3'),{'options':{'raw':![],'attributes':['id',_0x6681('0x4'),_0x6681('0x5'),_0x6681('0x6')],'include':[{'model':'User','as':_0x6681('0x7'),'attributes':['id','name','online','smsPause']}]},'log':_0x6681('0x1')});};}; \ No newline at end of file +var _0x46e4=['getSmsQueues','../client','Request','GetSmsQueue','name','timeout','strategy','User','Agents','online','smsPause'];(function(_0x3762f3,_0x44398f){var _0x47bf7e=function(_0xa89247){while(--_0xa89247){_0x3762f3['push'](_0x3762f3['shift']());}};_0x47bf7e(++_0x44398f);}(_0x46e4,0xdd));var _0x446e=function(_0x5d6482,_0x1c9b00){_0x5d6482=_0x5d6482-0x0;var _0x32e681=_0x46e4[_0x5d6482];return _0x32e681;};'use strict';var client=require(_0x446e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x446e('0x1')](_0x446e('0x2'),{'options':{'raw':![],'attributes':['id',_0x446e('0x3'),_0x446e('0x4'),_0x446e('0x5')],'include':[{'model':_0x446e('0x6'),'as':_0x446e('0x7'),'attributes':['id',_0x446e('0x3'),_0x446e('0x8'),_0x446e('0x9')]}]},'log':_0x446e('0xa')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index af8b7c1..b813183 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 _0xe5af=['UpdateSmsQueueReport','create','CreateSmsQueueReport','update','DESC'];(function(_0x188029,_0x186038){var _0x259bef=function(_0x406b52){while(--_0x406b52){_0x188029['push'](_0x188029['shift']());}};_0x259bef(++_0x186038);}(_0xe5af,0x9c));var _0xfe5a=function(_0x3e2bb7,_0x2b4f07){_0x3e2bb7=_0x3e2bb7-0x0;var _0x4b1aee=_0xe5af[_0x3e2bb7];return _0x4b1aee;};'use strict';var client=require('../client');exports[_0xfe5a('0x0')]=function(_0x189c37){return client['Request'](_0xfe5a('0x1'),{'body':_0x189c37,'log':_0xfe5a('0x1')});};exports[_0xfe5a('0x2')]=function(_0x4adbd1,_0x1165e3){return client['Request']('UpdateSmsQueueReport',{'body':_0x1165e3,'options':{'where':{'uniqueid':_0x4adbd1},'order':[['id',_0xfe5a('0x3')]],'limit':0x1},'log':_0xfe5a('0x4')});}; \ No newline at end of file +var _0xbb59=['CreateSmsQueueReport','update','Request','DESC','UpdateSmsQueueReport','../client','create'];(function(_0x26b717,_0xfb8e0b){var _0x265986=function(_0x339c43){while(--_0x339c43){_0x26b717['push'](_0x26b717['shift']());}};_0x265986(++_0xfb8e0b);}(_0xbb59,0xec));var _0x9bb5=function(_0x5c8774,_0xe24dce){_0x5c8774=_0x5c8774-0x0;var _0x491f92=_0xbb59[_0x5c8774];return _0x491f92;};'use strict';var client=require(_0x9bb5('0x0'));exports[_0x9bb5('0x1')]=function(_0xc97996){return client['Request']('CreateSmsQueueReport',{'body':_0xc97996,'log':_0x9bb5('0x2')});};exports[_0x9bb5('0x3')]=function(_0x15b5c2,_0x9087d){return client[_0x9bb5('0x4')]('UpdateSmsQueueReport',{'body':_0x9087d,'options':{'where':{'uniqueid':_0x15b5c2},'order':[['id',_0x9bb5('0x5')]],'limit':0x1},'log':_0x9bb5('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index b9757ce..f8048ec 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 _0x6b1f=['openchannelPause','mailCapacity','faxCapacity','../client','Request','GetUser','agent','name','online','pauseType','lastPauseAt','chatPause','mailPause','faxPause','smsPause'];(function(_0x47568e,_0x5ccdaf){var _0x33815b=function(_0x56b026){while(--_0x56b026){_0x47568e['push'](_0x47568e['shift']());}};_0x33815b(++_0x5ccdaf);}(_0x6b1f,0x1e3));var _0xf6b1=function(_0x1f4365,_0x5cea7c){_0x1f4365=_0x1f4365-0x0;var _0x36b664=_0x6b1f[_0x1f4365];return _0x36b664;};'use strict';var client=require(_0xf6b1('0x0'));exports['getAgents']=function(){return function(){return client[_0xf6b1('0x1')](_0xf6b1('0x2'),{'options':{'raw':!![],'where':{'role':_0xf6b1('0x3')},'attributes':['id',_0xf6b1('0x4'),_0xf6b1('0x5'),_0xf6b1('0x6'),_0xf6b1('0x7'),'voicePause',_0xf6b1('0x8'),_0xf6b1('0x9'),_0xf6b1('0xa'),_0xf6b1('0xb'),_0xf6b1('0xc'),'chatCapacity',_0xf6b1('0xd'),_0xf6b1('0xe'),'smsCapacity','openchannelCapacity']},'log':'getAgents'});};}; \ No newline at end of file +var _0xee08=['GetUser','agent','pauseType','lastPauseAt','faxPause','smsPause','openchannelPause','chatCapacity','mailCapacity','smsCapacity','openchannelCapacity','../client','getAgents'];(function(_0x5449df,_0xd281ce){var _0x29decb=function(_0x38c25f){while(--_0x38c25f){_0x5449df['push'](_0x5449df['shift']());}};_0x29decb(++_0xd281ce);}(_0xee08,0x11c));var _0x8ee0=function(_0x7279ec,_0x41828b){_0x7279ec=_0x7279ec-0x0;var _0x14eeb4=_0xee08[_0x7279ec];return _0x14eeb4;};'use strict';var client=require(_0x8ee0('0x0'));exports[_0x8ee0('0x1')]=function(){return function(){return client['Request'](_0x8ee0('0x2'),{'options':{'raw':!![],'where':{'role':_0x8ee0('0x3')},'attributes':['id','name','online',_0x8ee0('0x4'),_0x8ee0('0x5'),'voicePause','chatPause','mailPause',_0x8ee0('0x6'),_0x8ee0('0x7'),_0x8ee0('0x8'),_0x8ee0('0x9'),_0x8ee0('0xa'),'faxCapacity',_0x8ee0('0xb'),_0x8ee0('0xc')]},'log':'getAgents'});};}; \ 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 ad2efe3..078307b 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 _0xc836=['name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','util','seq-queue','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xc836,0x155));var _0x6c83=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc836[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x6c83('0x0'));var _=require('lodash');var util=require(_0x6c83('0x1'));var seqqueue=require(_0x6c83('0x2'));var logger=require('../../../../config/logger')(_0x6c83('0x3'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x6c83('0x4'),'required':!![],'message':_0x6c83('0x5')},'timeout':{'type':_0x6c83('0x6'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x5dd51e,_0x4a4abf,_0x111131){return logger[_0x6c83('0x7')](util[_0x6c83('0x8')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x5dd51e,_0x4a4abf['name'],_0x111131));}function handleFindAgent(_0x410e1a){return function(_0x5ded8d){return _0x5ded8d[_0x6c83('0x9')]['toLowerCase']()===_0x410e1a[_0x6c83('0xa')]();};}exports[_0x6c83('0xb')]=function(_0x1e3b99,_0x13e02b,_0xcdf439,_0x15146f){return function(_0x4aaada){try{var _0x47e3b8={'name':_0x13e02b[0x0],'timeout':_0x13e02b[0x1]};var _0x38c70a=queue['validate'](_0x47e3b8,{'typecast':!![]});if(_0x38c70a[_0x6c83('0xc')]){logger[_0x6c83('0xd')](_0x6c83('0xe'),_0x1e3b99,_[_0x6c83('0xf')](_0x38c70a,_0x6c83('0x10'))[_0x6c83('0x11')](',\x20'));_0x4aaada[_0x6c83('0x12')]();}else{var _0x54e301=_[_0x6c83('0x13')](_0xcdf439['agents'],handleFindAgent(_0x47e3b8[_0x6c83('0x9')]));if(_0x54e301){var _0x279bcf=(_0x47e3b8[_0x6c83('0x14')]||0xa)*0x3e8;var _0x3546a1,_0x5e5a1e;var _0x40d1a9=seqqueue[_0x6c83('0x15')](_0x279bcf);_0x40d1a9['id']=_0x1e3b99;_0x40d1a9[_0x6c83('0x16')]=_0x279bcf;_0x40d1a9[_0x6c83('0x17')]=_0x15146f[_0x6c83('0x17')];writeLog(_0x1e3b99,_0x54e301,util[_0x6c83('0x8')](_0x6c83('0x18'),_0x279bcf));_0xcdf439[_0x6c83('0x19')][_0x1e3b99]['on'](_0x6c83('0x1a'),function(){_0x40d1a9['close']();clearTimeout(_0x5e5a1e);_0x5e5a1e=undefined;if(_0xcdf439[_0x6c83('0x19')][_0x1e3b99]){delete _0xcdf439[_0x6c83('0x19')][_0x1e3b99];}logger[_0x6c83('0x7')](_0x6c83('0x1b'),_0x1e3b99);_0x4aaada[_0x6c83('0x12')]();});_0x5e5a1e=setTimeout(function(){clearTimeout(_0x5e5a1e);_0x40d1a9[_0x6c83('0x1c')]();logger[_0x6c83('0x7')](_0x6c83('0x1d'),_0x1e3b99);_0x4aaada[_0x6c83('0x1e')]();},_0x279bcf);strategy[_0x6c83('0x1f')](_0x40d1a9,_0x54e301,_0xcdf439,_0x15146f);}else{logger[_0x6c83('0xd')](_0x6c83('0x20'),_0x1e3b99,_0x47e3b8[_0x6c83('0x9')]);_0x4aaada[_0x6c83('0x12')]();}}}catch(_0x321db8){console[_0x6c83('0x21')](_0x321db8);logger[_0x6c83('0xd')]('[%s][QUEUE]\x20%s',_0x1e3b99,_0x321db8[_0x6c83('0x22')]);_0x4aaada[_0x6c83('0x12')]();}};}; \ No newline at end of file +var _0x301c=['[%s][AGENT]\x20ROUTING\x20STOPPED','[%s][AGENT]\x20ROUTING\x20END','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','join','stop','find','agents','timeout','createQueue','channel','START:%s','rules','end','close'];(function(_0x39e0f1,_0x5e3205){var _0x10de18=function(_0xb31ff7){while(--_0xb31ff7){_0x39e0f1['push'](_0x39e0f1['shift']());}};_0x10de18(++_0x5e3205);}(_0x301c,0x120));var _0xc301=function(_0x29bf80,_0x4af855){_0x29bf80=_0x29bf80-0x0;var _0x932096=_0x301c[_0x29bf80];return _0x932096;};'use strict';var schema=require(_0xc301('0x0'));var _=require(_0xc301('0x1'));var util=require(_0xc301('0x2'));var seqqueue=require(_0xc301('0x3'));var logger=require('../../../../config/logger')(_0xc301('0x4'));var strategy=require(_0xc301('0x5'));var queue=schema({'name':{'type':_0xc301('0x6'),'required':!![],'message':_0xc301('0x7')},'timeout':{'type':_0xc301('0x8'),'message':_0xc301('0x9')}});function writeLog(_0x49641a,_0x26f8c0,_0x162437){return logger[_0xc301('0xa')](util['format'](_0xc301('0xb'),_0x49641a,_0x26f8c0[_0xc301('0xc')],_0x162437));}function handleFindAgent(_0x4fe25a){return function(_0x5323c0){return _0x5323c0['name']['toLowerCase']()===_0x4fe25a[_0xc301('0xd')]();};}exports[_0xc301('0xe')]=function(_0x1f95a6,_0x40b163,_0x474769,_0x3515f9){return function(_0x466697){try{var _0x3cac45={'name':_0x40b163[0x0],'timeout':_0x40b163[0x1]};var _0x1855d9=queue[_0xc301('0x0')](_0x3cac45,{'typecast':!![]});if(_0x1855d9[_0xc301('0xf')]){logger['error']('[%s][AGENT]\x20%s',_0x1f95a6,_['map'](_0x1855d9,'message')[_0xc301('0x10')](',\x20'));_0x466697[_0xc301('0x11')]();}else{var _0xfcbe65=_[_0xc301('0x12')](_0x474769[_0xc301('0x13')],handleFindAgent(_0x3cac45['name']));if(_0xfcbe65){var _0x9dd1cb=(_0x3cac45[_0xc301('0x14')]||0xa)*0x3e8;var _0x4ec4c7,_0x7c459;var _0x395c66=seqqueue[_0xc301('0x15')](_0x9dd1cb);_0x395c66['id']=_0x1f95a6;_0x395c66['atimeout']=_0x9dd1cb;_0x395c66[_0xc301('0x16')]=_0x3515f9[_0xc301('0x16')];writeLog(_0x1f95a6,_0xfcbe65,util['format'](_0xc301('0x17'),_0x9dd1cb));_0x474769[_0xc301('0x18')][_0x1f95a6]['on'](_0xc301('0x19'),function(){_0x395c66[_0xc301('0x1a')]();clearTimeout(_0x7c459);_0x7c459=undefined;if(_0x474769['rules'][_0x1f95a6]){delete _0x474769[_0xc301('0x18')][_0x1f95a6];}logger[_0xc301('0xa')](_0xc301('0x1b'),_0x1f95a6);_0x466697[_0xc301('0x11')]();});_0x7c459=setTimeout(function(){clearTimeout(_0x7c459);_0x395c66[_0xc301('0x1a')]();logger['info'](_0xc301('0x1c'),_0x1f95a6);_0x466697['next']();},_0x9dd1cb);strategy[_0xc301('0x1d')](_0x395c66,_0xfcbe65,_0x474769,_0x3515f9);}else{logger[_0xc301('0x1e')](_0xc301('0x1f'),_0x1f95a6,_0x3cac45['name']);_0x466697['stop']();}}}catch(_0x4d973c){console[_0xc301('0x20')](_0x4d973c);logger[_0xc301('0x1e')](_0xc301('0x21'),_0x1f95a6,_0x4d973c[_0xc301('0x22')]);_0x466697[_0xc301('0x11')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 71ea545..2e4bea8 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 _0x5bb7=['Message','then','info','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','message','toString','postText','amazonlex','create','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','chat','ChatWebsiteId','account','AccountId','InteractionId','interaction','isEmpty','body','getMustacheRender'];(function(_0x13182e,_0x45e0f4){var _0x464946=function(_0x1a2816){while(--_0x1a2816){_0x13182e['push'](_0x13182e['shift']());}};_0x464946(++_0x45e0f4);}(_0x5bb7,0xe9));var _0x75bb=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x5bb7[_0x1fc122];return _0xa2cb13;};'use strict';var _=require(_0x75bb('0x0'));var moment=require(_0x75bb('0x1'));var AWS=require(_0x75bb('0x2'));var utils=require(_0x75bb('0x3'));var logger=require(_0x75bb('0x4'))('routing');var rpc={'chatMessage':require(_0x75bb('0x5')),'openchannelMessage':require(_0x75bb('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x75bb('0x7')),'faxMessage':require('../../rpc/faxMessage')};exports['consequence']=function(_0x19ba1f,_0x33b060){return function(_0x51edd5){try{if(!_['isNil'](this['interaction'][_0x75bb('0x8')])){logger['info'](_0x75bb('0x9'),_0x19ba1f,_0x75bb('0xa'));return _0x51edd5[_0x75bb('0xb')]();}var _0x1ea772={'ContactId':this[_0x75bb('0xc')]['id'],'sentAt':moment()[_0x75bb('0xd')](_0x75bb('0xe')),'direction':_0x75bb('0xf')};var _0xa2efef=this['channel'];if(_0xa2efef===_0x75bb('0x10')){_0x1ea772[_0x75bb('0x11')]=this[_0x75bb('0x12')]['id'];}else{_0x1ea772[_['upperFirst'](_0xa2efef)+_0x75bb('0x13')]=this[_0x75bb('0x12')]['id'];}_0x1ea772[_['upperFirst'](_0xa2efef)+_0x75bb('0x14')]=this[_0x75bb('0x15')]['id'];if(this[_0x75bb('0x15')]['created']){var _0x1209ec=_0x33b060[0x4];if(!_[_0x75bb('0x16')](_0x1209ec)){_0x1ea772[_0x75bb('0x17')]=utils[_0x75bb('0x18')](_0x1209ec,this);return rpc[_0xa2efef+_0x75bb('0x19')]['create'](_0x1ea772)[_0x75bb('0x1a')](function(_0x9072e5){logger[_0x75bb('0x1b')]('[%s][AMAZONLEX]\x20%s',_0x19ba1f,_0x1ea772['body']);})[_0x75bb('0x1c')](function(_0x126733){logger[_0x75bb('0x1d')](_0x75bb('0x9'),_0x19ba1f,JSON[_0x75bb('0x1e')](_0x126733));})['finally'](function(){logger[_0x75bb('0x1b')](_0x75bb('0x1f'),_0x19ba1f);_0x51edd5[_0x75bb('0x20')]();});}else{logger[_0x75bb('0x1b')](_0x75bb('0x21'),_0x19ba1f);_0x51edd5['stop']();}}else{var _0x38abf7=this;var _0x3458cb=new AWS[(_0x75bb('0x22'))]({'accessKeyId':_0x33b060[0x0],'secretAccessKey':_0x33b060[0x1],'region':_0x33b060[0x2]});var _0x4595ae={'botAlias':_0x75bb('0x23'),'botName':_0x33b060[0x3],'inputText':this[_0x75bb('0x24')][_0x75bb('0x17')],'userId':this['interaction']['id'][_0x75bb('0x25')]()};_0x3458cb[_0x75bb('0x26')](_0x4595ae,function(_0x2174f8,_0x418ea0){if(_0x2174f8){logger[_0x75bb('0x1d')](_0x75bb('0x9'),_0x19ba1f,_0x2174f8['message']);_0x51edd5[_0x75bb('0xb')]();}else if(_0x418ea0&&_0x418ea0['message']){_0x38abf7[_0x75bb('0x17')][_0x75bb('0x27')]=_0x418ea0;_0x1ea772[_0x75bb('0x17')]=_0x418ea0[_0x75bb('0x24')];return rpc[_0xa2efef+_0x75bb('0x19')][_0x75bb('0x28')](_0x1ea772)[_0x75bb('0x1a')](function(_0x274bd8){logger[_0x75bb('0x1b')](_0x75bb('0x9'),_0x19ba1f,_0x1ea772['body']);if(_0x418ea0[_0x75bb('0x29')]==_0x75bb('0x2a')){_0x51edd5['next']();}else{_0x51edd5[_0x75bb('0x20')]();}})['catch'](function(_0x3c8af6){logger[_0x75bb('0x1d')](_0x75bb('0x9'),_0x19ba1f,JSON[_0x75bb('0x1e')](_0x3c8af6));_0x51edd5[_0x75bb('0xb')]();});}else{_0x51edd5[_0x75bb('0xb')]();}});}}catch(_0x3af587){logger[_0x75bb('0x1d')]('[%s][AMAZONLEX]\x20%s',_0x19ba1f,JSON[_0x75bb('0x1e')](_0x3af587));_0x51edd5['stop']();}};}; \ No newline at end of file +var _0x62c0=['Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','created','isEmpty','body','getMustacheRender','Message','create','then','catch','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','toString','amazonlex','dialogState','Failed','error','moment','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s'];(function(_0x22f576,_0x13e427){var _0x4953ae=function(_0x59457c){while(--_0x59457c){_0x22f576['push'](_0x22f576['shift']());}};_0x4953ae(++_0x13e427);}(_0x62c0,0x14d));var _0x062c=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x62c0[_0x11ce46];return _0x368a1e;};'use strict';var _=require('lodash');var moment=require(_0x062c('0x0'));var AWS=require('aws-sdk');var utils=require(_0x062c('0x1'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x062c('0x2')),'openchannelMessage':require(_0x062c('0x3')),'mailMessage':require(_0x062c('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x062c('0x5'))};exports[_0x062c('0x6')]=function(_0x5448d1,_0x40ed23){return function(_0x80f9c5){try{if(!_[_0x062c('0x7')](this['interaction'][_0x062c('0x8')])){logger[_0x062c('0x9')](_0x062c('0xa'),_0x5448d1,_0x062c('0xb'));return _0x80f9c5[_0x062c('0xc')]();}var _0x2e2dbe={'ContactId':this[_0x062c('0xd')]['id'],'sentAt':moment()[_0x062c('0xe')](_0x062c('0xf')),'direction':_0x062c('0x10')};var _0x44faea=this['channel'];if(_0x44faea===_0x062c('0x11')){_0x2e2dbe[_0x062c('0x12')]=this[_0x062c('0x13')]['id'];}else{_0x2e2dbe[_[_0x062c('0x14')](_0x44faea)+_0x062c('0x15')]=this[_0x062c('0x13')]['id'];}_0x2e2dbe[_[_0x062c('0x14')](_0x44faea)+_0x062c('0x16')]=this[_0x062c('0x17')]['id'];if(this[_0x062c('0x17')][_0x062c('0x18')]){var _0x42b22d=_0x40ed23[0x4];if(!_[_0x062c('0x19')](_0x42b22d)){_0x2e2dbe[_0x062c('0x1a')]=utils[_0x062c('0x1b')](_0x42b22d,this);return rpc[_0x44faea+_0x062c('0x1c')][_0x062c('0x1d')](_0x2e2dbe)[_0x062c('0x1e')](function(_0x217a23){logger[_0x062c('0x9')](_0x062c('0xa'),_0x5448d1,_0x2e2dbe[_0x062c('0x1a')]);})[_0x062c('0x1f')](function(_0x5650ce){logger['error'](_0x062c('0xa'),_0x5448d1,JSON[_0x062c('0x20')](_0x5650ce));})[_0x062c('0x21')](function(){logger[_0x062c('0x9')](_0x062c('0x22'),_0x5448d1);_0x80f9c5[_0x062c('0x23')]();});}else{logger[_0x062c('0x9')](_0x062c('0x24'),_0x5448d1);_0x80f9c5[_0x062c('0x23')]();}}else{var _0x18ee49=this;var _0x305f5c=new AWS['LexRuntime']({'accessKeyId':_0x40ed23[0x0],'secretAccessKey':_0x40ed23[0x1],'region':_0x40ed23[0x2]});var _0x2fd76d={'botAlias':'$LATEST','botName':_0x40ed23[0x3],'inputText':this[_0x062c('0x25')]['body'],'userId':this[_0x062c('0x17')]['id'][_0x062c('0x26')]()};_0x305f5c['postText'](_0x2fd76d,function(_0x42b5ba,_0x3ebe80){if(_0x42b5ba){logger['error'](_0x062c('0xa'),_0x5448d1,_0x42b5ba[_0x062c('0x25')]);_0x80f9c5[_0x062c('0xc')]();}else if(_0x3ebe80&&_0x3ebe80[_0x062c('0x25')]){_0x18ee49[_0x062c('0x1a')][_0x062c('0x27')]=_0x3ebe80;_0x2e2dbe[_0x062c('0x1a')]=_0x3ebe80['message'];return rpc[_0x44faea+_0x062c('0x1c')]['create'](_0x2e2dbe)['then'](function(_0x9f002b){logger[_0x062c('0x9')](_0x062c('0xa'),_0x5448d1,_0x2e2dbe[_0x062c('0x1a')]);if(_0x3ebe80[_0x062c('0x28')]==_0x062c('0x29')){_0x80f9c5[_0x062c('0xc')]();}else{_0x80f9c5[_0x062c('0x23')]();}})[_0x062c('0x1f')](function(_0x5cec30){logger['error'](_0x062c('0xa'),_0x5448d1,JSON[_0x062c('0x20')](_0x5cec30));_0x80f9c5[_0x062c('0xc')]();});}else{_0x80f9c5[_0x062c('0xc')]();}});}}catch(_0x1d90a5){logger[_0x062c('0x2a')](_0x062c('0xa'),_0x5448d1,JSON[_0x062c('0x20')](_0x1d90a5));_0x80f9c5[_0x062c('0x23')]();}};}; \ 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 b450dd7..b5d4d3b 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 _0x0713=['authentication','auth','user','pass','inReplyTo','messageId','replace','body','','sendMailMessage','then','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','Message','[%s][AUTOREPLY]\x20%s','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../mailRpc','consequence','isNil','interaction','created','info','Autoreply\x20already\x20sent','next','channel','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','message','phone','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','mail','Smtp','service','host','port','secure'];(function(_0x5dd621,_0x5472d5){var _0x2d60a0=function(_0x225969){while(--_0x225969){_0x5dd621['push'](_0x5dd621['shift']());}};_0x2d60a0(++_0x5472d5);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require('moment');var utils=require(_0x3071('0x0'));var logger=require(_0x3071('0x1'))(_0x3071('0x2'));var rpc={'chatMessage':require(_0x3071('0x3')),'openchannelMessage':require(_0x3071('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x3071('0x5')),'faxMessage':require(_0x3071('0x6'))};var mailRpc=require(_0x3071('0x7'));exports[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return function(_0x1d3dd6){try{if(_0x41cf76[0x0]==='1'&&(_[_0x3071('0x9')](this[_0x3071('0xa')][_0x3071('0xb')])||!this[_0x3071('0xa')][_0x3071('0xb')])){logger[_0x3071('0xc')]('[%s][AUTOREPLY]\x20%s',_0xabd7b6,_0x3071('0xd'));return _0x1d3dd6[_0x3071('0xe')]();}var _0x937259=this[_0x3071('0xf')];var _0x1ce844={'body':utils['getMustacheRender'](_0x41cf76[0x1],this),'ContactId':this[_0x3071('0x10')]['id'],'sentAt':moment()[_0x3071('0x11')](_0x3071('0x12')),'direction':_0x3071('0x13')};if(this[_0x3071('0x14')]){_0x1ce844['to']=this['message']['from']||'';_0x1ce844['cc']=this[_0x3071('0x14')]['cc']||'';_0x1ce844['from']=this[_0x3071('0x14')]['to']||'';_0x1ce844[_0x3071('0x15')]=this['message'][_0x3071('0x15')]||'';_0x1ce844['read']=!![];if(this[_0x3071('0x14')][_0x3071('0x16')]){_0x1ce844[_0x3071('0x16')]='';_0x1ce844[_0x3071('0x16')]+=_[_0x3071('0x17')](this[_0x3071('0x14')][_0x3071('0x16')],_0x3071('0x18'))?'':_0x3071('0x19');_0x1ce844[_0x3071('0x16')]+=this['message'][_0x3071('0x16')];}}if(this[_0x3071('0xf')]===_0x3071('0x1a')){_0x1ce844[_0x3071('0x1b')]=this[_0x3071('0x1c')]['id'];}else{_0x1ce844[_[_0x3071('0x1d')](this[_0x3071('0xf')])+_0x3071('0x1e')]=this['account']['id'];}_0x1ce844[_[_0x3071('0x1d')](this[_0x3071('0xf')])+_0x3071('0x1f')]=this['interaction']['id'];if(rpc[this[_0x3071('0xf')]+'Message']){if(this[_0x3071('0xf')]===_0x3071('0x20')){var _0x3762d8={'tls':{'rejectUnauthorized':![]}};if(this[_0x3071('0x1c')][_0x3071('0x21')][_0x3071('0x22')]){_0x3762d8[_0x3071('0x22')]=this[_0x3071('0x1c')]['Smtp']['service'];}else{_0x3762d8[_0x3071('0x23')]=this[_0x3071('0x1c')][_0x3071('0x21')][_0x3071('0x23')];_0x3762d8[_0x3071('0x24')]=this[_0x3071('0x1c')][_0x3071('0x21')][_0x3071('0x24')];_0x3762d8[_0x3071('0x25')]=this['account'][_0x3071('0x21')][_0x3071('0x25')];}if(this[_0x3071('0x1c')]['Smtp'][_0x3071('0x26')]){_0x3762d8[_0x3071('0x27')]={'user':this[_0x3071('0x1c')][_0x3071('0x21')][_0x3071('0x28')],'pass':this[_0x3071('0x1c')][_0x3071('0x21')][_0x3071('0x29')]};}_0x1ce844[_0x3071('0x2a')]=this[_0x3071('0x14')][_0x3071('0x2b')];_0x1ce844['html']=''+_[_0x3071('0x2c')](_0x1ce844[_0x3071('0x2d')],_0x3071('0x2e'),_0x3071('0x2f'))+_0x3071('0x30');return mailRpc[_0x3071('0x31')](_0x3762d8,_0x1ce844)[_0x3071('0x32')](function(_0x1ccc41){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0xabd7b6);_0x1ce844['messageId']=_0x1ccc41[_0x3071('0x14')][_0x3071('0x2b')];return rpc[_0x937259+'Message'][_0x3071('0x33')](_0x1ce844);})[_0x3071('0x32')](function(_0x25250e){logger[_0x3071('0xc')]('[%s][AUTOREPLY]\x20%s',_0xabd7b6,JSON[_0x3071('0x34')](_0x25250e));})[_0x3071('0x35')](function(_0x602719){logger[_0x3071('0x36')](_0x3071('0x37'),_0xabd7b6,JSON[_0x3071('0x34')](_0x602719));})[_0x3071('0x38')](function(){_0x1d3dd6[_0x3071('0xe')]();});}else{return rpc[this['channel']+_0x3071('0x39')]['create'](_0x1ce844)['then'](function(_0x1a1a64){logger[_0x3071('0xc')]('[%s][AUTOREPLY]\x20%s',_0xabd7b6,_0x1ce844[_0x3071('0x2d')]);})[_0x3071('0x35')](function(_0x265d76){logger[_0x3071('0x36')](_0x3071('0x3a'),_0xabd7b6,JSON[_0x3071('0x34')](_0x265d76));})['finally'](function(){_0x1d3dd6[_0x3071('0xe')]();});}}}catch(_0xd7971f){logger['error'](_0x3071('0x3a'),_0xabd7b6,JSON['stringify'](_0xd7971f));_0x1d3dd6[_0x3071('0x3b')]();}};}; \ No newline at end of file +var _0x9c44=['message','from','phone','read','subject','startsWith','Re:','Re:\x20','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','mail','service','host','Smtp','secure','authentication','user','pass','inReplyTo','messageId','html','','replace','body','','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','then','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','next','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../mailRpc','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','channel','getMustacheRender','contact','out'];(function(_0x14594a,_0x399bde){var _0x238ea0=function(_0x3fb821){while(--_0x3fb821){_0x14594a['push'](_0x14594a['shift']());}};_0x238ea0(++_0x399bde);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'use strict';var _=require('lodash');var moment=require('moment');var utils=require(_0x49c4('0x0'));var logger=require(_0x49c4('0x1'))(_0x49c4('0x2'));var rpc={'chatMessage':require(_0x49c4('0x3')),'openchannelMessage':require(_0x49c4('0x4')),'mailMessage':require(_0x49c4('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage')};var mailRpc=require(_0x49c4('0x6'));exports['consequence']=function(_0xc1278f,_0x6030ae){return function(_0x69bc41){try{if(_0x6030ae[0x0]==='1'&&(_[_0x49c4('0x7')](this[_0x49c4('0x8')]['created'])||!this[_0x49c4('0x8')][_0x49c4('0x9')])){logger[_0x49c4('0xa')](_0x49c4('0xb'),_0xc1278f,'Autoreply\x20already\x20sent');return _0x69bc41['next']();}var _0x451ea6=this[_0x49c4('0xc')];var _0x58cad7={'body':utils[_0x49c4('0xd')](_0x6030ae[0x1],this),'ContactId':this[_0x49c4('0xe')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x49c4('0xf')};if(this[_0x49c4('0x10')]){_0x58cad7['to']=this['message'][_0x49c4('0x11')]||'';_0x58cad7['cc']=this[_0x49c4('0x10')]['cc']||'';_0x58cad7['from']=this[_0x49c4('0x10')]['to']||'';_0x58cad7[_0x49c4('0x12')]=this[_0x49c4('0x10')][_0x49c4('0x12')]||'';_0x58cad7[_0x49c4('0x13')]=!![];if(this[_0x49c4('0x10')][_0x49c4('0x14')]){_0x58cad7[_0x49c4('0x14')]='';_0x58cad7['subject']+=_[_0x49c4('0x15')](this[_0x49c4('0x10')][_0x49c4('0x14')],_0x49c4('0x16'))?'':_0x49c4('0x17');_0x58cad7['subject']+=this[_0x49c4('0x10')][_0x49c4('0x14')];}}if(this['channel']==='chat'){_0x58cad7[_0x49c4('0x18')]=this[_0x49c4('0x19')]['id'];}else{_0x58cad7[_[_0x49c4('0x1a')](this['channel'])+_0x49c4('0x1b')]=this['account']['id'];}_0x58cad7[_[_0x49c4('0x1a')](this[_0x49c4('0xc')])+_0x49c4('0x1c')]=this[_0x49c4('0x8')]['id'];if(rpc[this[_0x49c4('0xc')]+_0x49c4('0x1d')]){if(this[_0x49c4('0xc')]===_0x49c4('0x1e')){var _0x2197d2={'tls':{'rejectUnauthorized':![]}};if(this['account']['Smtp']['service']){_0x2197d2[_0x49c4('0x1f')]=this['account']['Smtp'][_0x49c4('0x1f')];}else{_0x2197d2[_0x49c4('0x20')]=this[_0x49c4('0x19')][_0x49c4('0x21')]['host'];_0x2197d2['port']=this[_0x49c4('0x19')][_0x49c4('0x21')]['port'];_0x2197d2[_0x49c4('0x22')]=this[_0x49c4('0x19')][_0x49c4('0x21')][_0x49c4('0x22')];}if(this['account']['Smtp'][_0x49c4('0x23')]){_0x2197d2['auth']={'user':this[_0x49c4('0x19')][_0x49c4('0x21')][_0x49c4('0x24')],'pass':this[_0x49c4('0x19')]['Smtp'][_0x49c4('0x25')]};}_0x58cad7[_0x49c4('0x26')]=this[_0x49c4('0x10')][_0x49c4('0x27')];_0x58cad7[_0x49c4('0x28')]=_0x49c4('0x29')+_[_0x49c4('0x2a')](_0x58cad7[_0x49c4('0x2b')],_0x49c4('0x2c'),_0x49c4('0x2d'))+_0x49c4('0x2e');return mailRpc['sendMailMessage'](_0x2197d2,_0x58cad7)['then'](function(_0x59eb84){logger[_0x49c4('0xa')](_0x49c4('0x2f'),_0xc1278f);_0x58cad7[_0x49c4('0x27')]=_0x59eb84[_0x49c4('0x10')][_0x49c4('0x27')];return rpc[_0x451ea6+'Message'][_0x49c4('0x30')](_0x58cad7);})[_0x49c4('0x31')](function(_0x2e7a69){logger[_0x49c4('0xa')]('[%s][AUTOREPLY]\x20%s',_0xc1278f,JSON['stringify'](_0x2e7a69));})[_0x49c4('0x32')](function(_0x9a1bed){logger[_0x49c4('0x33')](_0x49c4('0x34'),_0xc1278f,JSON[_0x49c4('0x35')](_0x9a1bed));})['finally'](function(){_0x69bc41[_0x49c4('0x36')]();});}else{return rpc[this[_0x49c4('0xc')]+_0x49c4('0x1d')]['create'](_0x58cad7)['then'](function(_0x85dce2){logger[_0x49c4('0xa')](_0x49c4('0xb'),_0xc1278f,_0x58cad7[_0x49c4('0x2b')]);})[_0x49c4('0x32')](function(_0x2cf897){logger[_0x49c4('0x33')](_0x49c4('0xb'),_0xc1278f,JSON[_0x49c4('0x35')](_0x2cf897));})['finally'](function(){_0x69bc41[_0x49c4('0x36')]();});}}}catch(_0x5b96df){logger[_0x49c4('0x33')](_0x49c4('0xb'),_0xc1278f,JSON[_0x49c4('0x35')](_0x5b96df));_0x69bc41[_0x49c4('0x37')]();}};}; \ 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 5274064..eea126b 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 _0x2116=['format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','stop','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','consequence','[%s][CLOSE]\x20reason\x20%s'];(function(_0x42d2af,_0x3961b5){var _0x1d6d63=function(_0x10833e){while(--_0x10833e){_0x42d2af['push'](_0x42d2af['shift']());}};_0x1d6d63(++_0x3961b5);}(_0x2116,0x67));var _0x6211=function(_0x2bbc75,_0x2510bf){_0x2bbc75=_0x2bbc75-0x0;var _0x27347f=_0x2116[_0x2bbc75];return _0x27347f;};'use strict';var moment=require('moment');var logger=require(_0x6211('0x0'))('routing');var rpc={'chatInteraction':require(_0x6211('0x1')),'openchannelInteraction':require(_0x6211('0x2')),'smsInteraction':require(_0x6211('0x3')),'mailInteraction':require(_0x6211('0x4')),'faxInteraction':require('../../rpc/faxInteraction')};exports[_0x6211('0x5')]=function(_0x2bf1b1,_0x1d468e,_0x1f35dd,_0x5cac18){return function(_0x37d71a){try{logger['info'](_0x6211('0x6'),_0x2bf1b1,_0x1d468e[0x0]);var _0x320562={'closed':0x1,'closedAt':moment()[_0x6211('0x7')](_0x6211('0x8')),'closeReason':_0x6211('0x9'),'disposition':_0x1d468e[0x0]};if(rpc[_0x5cac18[_0x6211('0xa')]+_0x6211('0xb')]){rpc[_0x5cac18['channel']+_0x6211('0xb')][_0x6211('0xc')](_0x5cac18[_0x6211('0xd')]['id'],_0x320562)[_0x6211('0xe')](function(_0x45e2ca){logger[_0x6211('0xf')](_0x6211('0x10'),_0x2bf1b1,_0x5cac18['interaction']['id']);})[_0x6211('0x11')](function(_0x53af36){logger[_0x6211('0x12')](_0x6211('0x13'),_0x2bf1b1,JSON[_0x6211('0x14')](_0x53af36));})['finally'](function(){_0x37d71a[_0x6211('0x15')]();});}}catch(_0x417bd7){logger[_0x6211('0x12')]('[%s][CLOSE]\x20%s',_0x2bf1b1,JSON['stringify'](_0x417bd7));_0x37d71a[_0x6211('0x15')]();}};}; \ No newline at end of file +var _0x7a40=['interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','finally','stop','moment','../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','format','YYYY-MM-DD\x20HH:mm:ss','Interaction','channel'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x7a40,0x197));var _0x07a4=function(_0x9b6526,_0x509a6b){_0x9b6526=_0x9b6526-0x0;var _0xe98f21=_0x7a40[_0x9b6526];return _0xe98f21;};'use strict';var moment=require(_0x07a4('0x0'));var logger=require(_0x07a4('0x1'))(_0x07a4('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x07a4('0x3')),'smsInteraction':require(_0x07a4('0x4')),'mailInteraction':require(_0x07a4('0x5')),'faxInteraction':require(_0x07a4('0x6'))};exports[_0x07a4('0x7')]=function(_0x48a3da,_0x334e7a,_0x130748,_0x3a53fb){return function(_0x399d0f){try{logger[_0x07a4('0x8')]('[%s][CLOSE]\x20reason\x20%s',_0x48a3da,_0x334e7a[0x0]);var _0xd06c30={'closed':0x1,'closedAt':moment()[_0x07a4('0x9')](_0x07a4('0xa')),'closeReason':'system','disposition':_0x334e7a[0x0]};if(rpc[_0x3a53fb['channel']+_0x07a4('0xb')]){rpc[_0x3a53fb[_0x07a4('0xc')]+'Interaction']['update'](_0x3a53fb[_0x07a4('0xd')]['id'],_0xd06c30)['then'](function(_0x44342a){logger['info'](_0x07a4('0xe'),_0x48a3da,_0x3a53fb['interaction']['id']);})[_0x07a4('0xf')](function(_0x224bf9){logger[_0x07a4('0x10')](_0x07a4('0x11'),_0x48a3da,JSON['stringify'](_0x224bf9));})[_0x07a4('0x12')](function(){_0x399d0f[_0x07a4('0x13')]();});}}catch(_0x1f75b2){logger['error'](_0x07a4('0x11'),_0x48a3da,JSON['stringify'](_0x1f75b2));_0x399d0f[_0x07a4('0x13')]();}};}; \ 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 fd106d9..7d3ca5d 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 _0xce9d=['md5','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','consequence','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','chat','ChatWebsiteId','account','upperFirst','created','isEmpty','getMustacheRender','create','then','body','catch','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','speech','Message','metadata','stringify','lodash','moment'];(function(_0x11980a,_0x29e162){var _0x1e480d=function(_0x1c2238){while(--_0x1c2238){_0x11980a['push'](_0x11980a['shift']());}};_0x1e480d(++_0x29e162);}(_0xce9d,0x181));var _0xdce9=function(_0x9047c3,_0x1fbb76){_0x9047c3=_0x9047c3-0x0;var _0x31fba7=_0xce9d[_0x9047c3];return _0x31fba7;};'use strict';var _=require(_0xdce9('0x0'));var moment=require(_0xdce9('0x1'));var apiai=require('apiai-promise');var md5=require(_0xdce9('0x2'));var utils=require(_0xdce9('0x3'));var logger=require('../../../../config/logger')(_0xdce9('0x4'));var rpc={'chatMessage':require(_0xdce9('0x5')),'openchannelMessage':require(_0xdce9('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xdce9('0x7'))};exports[_0xdce9('0x8')]=function(_0x44a339,_0x42aa09){return function(_0x46872d){try{if(!_['isNil'](this[_0xdce9('0x9')][_0xdce9('0xa')])){logger[_0xdce9('0xb')](_0xdce9('0xc'),_0x44a339,_0xdce9('0xd'));return _0x46872d[_0xdce9('0xe')]();}var _0x49f873={'ContactId':this[_0xdce9('0xf')]['id'],'sentAt':moment()[_0xdce9('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xdce9('0x11')};var _0x509d71=this['channel'];if(_0x509d71===_0xdce9('0x12')){_0x49f873[_0xdce9('0x13')]=this[_0xdce9('0x14')]['id'];}else{_0x49f873[_['upperFirst'](_0x509d71)+'AccountId']=this[_0xdce9('0x14')]['id'];}_0x49f873[_[_0xdce9('0x15')](_0x509d71)+'InteractionId']=this[_0xdce9('0x9')]['id'];if(this['interaction'][_0xdce9('0x16')]){var _0x44b9ce=_0x42aa09[0x2];if(!_[_0xdce9('0x17')](_0x44b9ce)){_0x49f873['body']=utils[_0xdce9('0x18')](_0x44b9ce,this);return rpc[_0x509d71+'Message'][_0xdce9('0x19')](_0x49f873)[_0xdce9('0x1a')](function(_0x4978d9){logger[_0xdce9('0xb')](_0xdce9('0xc'),_0x44a339,_0x49f873[_0xdce9('0x1b')]);})[_0xdce9('0x1c')](function(_0x14f4a8){logger[_0xdce9('0x1d')]('[%s][DIALOGFLOW]\x20%s',_0x44a339,JSON['stringify'](_0x14f4a8));})[_0xdce9('0x1e')](function(){logger[_0xdce9('0xb')](_0xdce9('0x1f'),_0x44a339);_0x46872d[_0xdce9('0x20')]();});}else{logger[_0xdce9('0xb')](_0xdce9('0x21'),_0x44a339);_0x46872d[_0xdce9('0x20')]();}}else{var _0x5835da=this;var _0x18d8d3=apiai(_0x42aa09[0x0],{'language':_0x42aa09[0x1]||'en'});return _0x18d8d3[_0xdce9('0x22')](this[_0xdce9('0x23')][_0xdce9('0x1b')],{'sessionId':md5(this[_0xdce9('0x9')]['id'])})[_0xdce9('0x1a')](function(_0x1f7e67){_0x5835da[_0xdce9('0x1b')][_0xdce9('0x24')]=_0x1f7e67;_0x49f873[_0xdce9('0x1b')]=_0x1f7e67[_0xdce9('0x25')][_0xdce9('0x26')][_0xdce9('0x27')];return rpc[_0x509d71+_0xdce9('0x28')][_0xdce9('0x19')](_0x49f873)[_0xdce9('0x1a')](function(_0x205f04){logger[_0xdce9('0xb')](_0xdce9('0xc'),_0x44a339,_0x49f873[_0xdce9('0x1b')]);if(_0x1f7e67[_0xdce9('0x25')][_0xdce9('0x29')]['endConversation']){_0x46872d[_0xdce9('0xe')]();}else{_0x46872d[_0xdce9('0x20')]();}})[_0xdce9('0x1c')](function(_0x27bce8){logger[_0xdce9('0x1d')](_0xdce9('0xc'),_0x44a339,JSON[_0xdce9('0x2a')](_0x27bce8));_0x46872d['next']();});})[_0xdce9('0x1c')](function(_0x2cc708){logger['error'](_0xdce9('0xc'),_0x44a339,_0x2cc708['message']);_0x46872d[_0xdce9('0xe')]();});}}catch(_0x367c05){logger[_0xdce9('0x1d')](_0xdce9('0xc'),_0x44a339,JSON[_0xdce9('0x2a')](_0x367c05));_0x46872d[_0xdce9('0x20')]();}};}; \ No newline at end of file +var _0xaef7=['isEmpty','Message','create','then','info','body','catch','[%s][DIALOGFLOW]\x20%s','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','result','fulfillment','metadata','endConversation','error','stringify','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','ChatWebsiteId','account','upperFirst'];(function(_0x3c62ad,_0x2d9871){var _0x474e0c=function(_0x262b56){while(--_0x262b56){_0x3c62ad['push'](_0x3c62ad['shift']());}};_0x474e0c(++_0x2d9871);}(_0xaef7,0x6c));var _0x7aef=function(_0x580c7f,_0x2ecf18){_0x580c7f=_0x580c7f-0x0;var _0x3b90e1=_0xaef7[_0x580c7f];return _0x3b90e1;};'use strict';var _=require(_0x7aef('0x0'));var moment=require(_0x7aef('0x1'));var apiai=require(_0x7aef('0x2'));var md5=require(_0x7aef('0x3'));var utils=require(_0x7aef('0x4'));var logger=require(_0x7aef('0x5'))(_0x7aef('0x6'));var rpc={'chatMessage':require(_0x7aef('0x7')),'openchannelMessage':require(_0x7aef('0x8')),'mailMessage':require(_0x7aef('0x9')),'smsMessage':require(_0x7aef('0xa')),'faxMessage':require(_0x7aef('0xb'))};exports[_0x7aef('0xc')]=function(_0x8ea66e,_0x394d89){return function(_0x3dbb56){try{if(!_['isNil'](this[_0x7aef('0xd')][_0x7aef('0xe')])){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x8ea66e,_0x7aef('0xf'));return _0x3dbb56[_0x7aef('0x10')]();}var _0x59fb36={'ContactId':this[_0x7aef('0x11')]['id'],'sentAt':moment()['format'](_0x7aef('0x12')),'direction':_0x7aef('0x13')};var _0x4d69f4=this[_0x7aef('0x14')];if(_0x4d69f4==='chat'){_0x59fb36[_0x7aef('0x15')]=this[_0x7aef('0x16')]['id'];}else{_0x59fb36[_[_0x7aef('0x17')](_0x4d69f4)+'AccountId']=this[_0x7aef('0x16')]['id'];}_0x59fb36[_[_0x7aef('0x17')](_0x4d69f4)+'InteractionId']=this[_0x7aef('0xd')]['id'];if(this[_0x7aef('0xd')]['created']){var _0x1b1376=_0x394d89[0x2];if(!_[_0x7aef('0x18')](_0x1b1376)){_0x59fb36['body']=utils['getMustacheRender'](_0x1b1376,this);return rpc[_0x4d69f4+_0x7aef('0x19')][_0x7aef('0x1a')](_0x59fb36)[_0x7aef('0x1b')](function(_0x374d18){logger[_0x7aef('0x1c')]('[%s][DIALOGFLOW]\x20%s',_0x8ea66e,_0x59fb36[_0x7aef('0x1d')]);})[_0x7aef('0x1e')](function(_0x96bfea){logger['error'](_0x7aef('0x1f'),_0x8ea66e,JSON['stringify'](_0x96bfea));})[_0x7aef('0x20')](function(){logger[_0x7aef('0x1c')](_0x7aef('0x21'),_0x8ea66e);_0x3dbb56[_0x7aef('0x22')]();});}else{logger[_0x7aef('0x1c')](_0x7aef('0x23'),_0x8ea66e);_0x3dbb56['stop']();}}else{var _0xdb95da=this;var _0x15c355=apiai(_0x394d89[0x0],{'language':_0x394d89[0x1]||'en'});return _0x15c355[_0x7aef('0x24')](this[_0x7aef('0x25')][_0x7aef('0x1d')],{'sessionId':md5(this[_0x7aef('0xd')]['id'])})['then'](function(_0x3a9b36){_0xdb95da[_0x7aef('0x1d')]['dialogflow']=_0x3a9b36;_0x59fb36[_0x7aef('0x1d')]=_0x3a9b36[_0x7aef('0x26')][_0x7aef('0x27')]['speech'];return rpc[_0x4d69f4+_0x7aef('0x19')]['create'](_0x59fb36)[_0x7aef('0x1b')](function(_0x424ad3){logger['info'](_0x7aef('0x1f'),_0x8ea66e,_0x59fb36['body']);if(_0x3a9b36['result'][_0x7aef('0x28')][_0x7aef('0x29')]){_0x3dbb56['next']();}else{_0x3dbb56[_0x7aef('0x22')]();}})[_0x7aef('0x1e')](function(_0xfc5341){logger[_0x7aef('0x2a')](_0x7aef('0x1f'),_0x8ea66e,JSON[_0x7aef('0x2b')](_0xfc5341));_0x3dbb56[_0x7aef('0x10')]();});})['catch'](function(_0x4d56e1){logger[_0x7aef('0x2a')]('[%s][DIALOGFLOW]\x20%s',_0x8ea66e,_0x4d56e1[_0x7aef('0x25')]);_0x3dbb56['next']();});}}catch(_0x472859){logger[_0x7aef('0x2a')](_0x7aef('0x1f'),_0x8ea66e,JSON[_0x7aef('0x2b')](_0x472859));_0x3dbb56[_0x7aef('0x22')]();}};}; \ 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 92b5031..17033da 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 _0x6af1=['html-to-text','./utils','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','consequence','fromString','replace','error','map','message','join','stop','condition','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate'];(function(_0x5cbf3a,_0x31b32b){var _0x360805=function(_0x13b23a){while(--_0x13b23a){_0x5cbf3a['push'](_0x5cbf3a['shift']());}};_0x360805(++_0x31b32b);}(_0x6af1,0xcf));var _0x16af=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6af1[_0x20a584];return _0x4b41a8;};'use strict';var schema=require(_0x16af('0x0'));var _=require('lodash');var htmlToText=require(_0x16af('0x1'));var utils=require(_0x16af('0x2'));var logger=require(_0x16af('0x3'))(_0x16af('0x4'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x16af('0x5')},'priorityTrue':{'type':_0x16af('0x6'),'message':_0x16af('0x7')},'priorityFalse':{'type':_0x16af('0x6'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x16af('0x8')]=function(_0x3f5b3a,_0x4dcfc9){return function(_0xb9a503){try{var _0x18b240={'condition':htmlToText[_0x16af('0x9')](utils['getMustacheRender'](_0x4dcfc9[0x0],this),{'wordwrap':![]})[_0x16af('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4dcfc9[0x1],'priorityFalse':_0x4dcfc9[0x2]};var _0x4c03ea=gotoif[_0x16af('0x0')](_0x18b240,{'typecast':!![]});if(_0x4c03ea['length']){logger[_0x16af('0xb')]('[%s][GOTOIF]\x20%s',_0x3f5b3a,_[_0x16af('0xc')](_0x4c03ea,_0x16af('0xd'))[_0x16af('0xe')](',\x20'));_0xb9a503[_0x16af('0xf')]();}else{try{var _0x113fd9=eval('('+_0x18b240[_0x16af('0x10')]+')');var _0xc0ac01=_0x113fd9?_0x18b240[_0x16af('0x11')]:_0x18b240['priorityFalse'];logger[_0x16af('0x12')](_0x16af('0x13'),_0x3f5b3a,_0x18b240['condition'],_0x113fd9,_0xc0ac01||_0x16af('0x14'));if(_0xc0ac01){var _0x2989af=_[_0x16af('0x15')](_0xb9a503[_0x16af('0x16')](),{'p':_0xc0ac01});if(_0x2989af>=0x0){logger[_0x16af('0x12')](_0x16af('0x17'),_0x3f5b3a,_0xc0ac01||_0x16af('0x14'),_0x2989af);_0xb9a503[_0x16af('0x14')](_0x2989af);}else{logger[_0x16af('0x12')](_0x16af('0x18'),_0x3f5b3a,_0xc0ac01||_0x16af('0x14'));_0xb9a503['stop']();}}else{_0xb9a503[_0x16af('0x14')]();}}catch(_0x4f8cf){logger[_0x16af('0xb')](_0x16af('0x19'),_0x3f5b3a,_0x4f8cf[_0x16af('0xd')]);_0xb9a503[_0x16af('0xf')]();}}}catch(_0x563616){logger[_0x16af('0xb')]('[%s][GOTOIF]\x20%s',_0x3f5b3a,JSON['stringify'](_0x563616));_0xb9a503[_0x16af('0xf')]();}};}; \ No newline at end of file +var _0x4db4=['map','message','join','stop','condition','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','priority\x20true\x20is\x20a\x20number','number','fromString','getMustacheRender','length','error','[%s][GOTOIF]\x20%s'];(function(_0x4882cd,_0x191d77){var _0x4b6cb0=function(_0x3da62a){while(--_0x3da62a){_0x4882cd['push'](_0x4882cd['shift']());}};_0x4b6cb0(++_0x191d77);}(_0x4db4,0x151));var _0x44db=function(_0x2a6795,_0x31a21c){_0x2a6795=_0x2a6795-0x0;var _0x8956de=_0x4db4[_0x2a6795];return _0x8956de;};'use strict';var schema=require(_0x44db('0x0'));var _=require(_0x44db('0x1'));var htmlToText=require(_0x44db('0x2'));var utils=require(_0x44db('0x3'));var logger=require(_0x44db('0x4'))(_0x44db('0x5'));var gotoif=schema({'condition':{'type':_0x44db('0x6'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':'number','message':_0x44db('0x7')},'priorityFalse':{'type':_0x44db('0x8'),'message':'priority\x20false\x20is\x20a\x20number'}});exports['consequence']=function(_0x4851d2,_0x281c70){return function(_0x38cddb){try{var _0x29d3f4={'condition':htmlToText[_0x44db('0x9')](utils[_0x44db('0xa')](_0x281c70[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x281c70[0x1],'priorityFalse':_0x281c70[0x2]};var _0xc1b991=gotoif[_0x44db('0x0')](_0x29d3f4,{'typecast':!![]});if(_0xc1b991[_0x44db('0xb')]){logger[_0x44db('0xc')](_0x44db('0xd'),_0x4851d2,_[_0x44db('0xe')](_0xc1b991,_0x44db('0xf'))[_0x44db('0x10')](',\x20'));_0x38cddb[_0x44db('0x11')]();}else{try{var _0x135ddc=eval('('+_0x29d3f4[_0x44db('0x12')]+')');var _0x3be2fc=_0x135ddc?_0x29d3f4[_0x44db('0x13')]:_0x29d3f4['priorityFalse'];logger[_0x44db('0x14')](_0x44db('0x15'),_0x4851d2,_0x29d3f4[_0x44db('0x12')],_0x135ddc,_0x3be2fc||_0x44db('0x16'));if(_0x3be2fc){var _0x210f62=_[_0x44db('0x17')](_0x38cddb[_0x44db('0x18')](),{'p':_0x3be2fc});if(_0x210f62>=0x0){logger[_0x44db('0x14')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x4851d2,_0x3be2fc||_0x44db('0x16'),_0x210f62);_0x38cddb[_0x44db('0x16')](_0x210f62);}else{logger[_0x44db('0x14')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x4851d2,_0x3be2fc||_0x44db('0x16'));_0x38cddb[_0x44db('0x11')]();}}else{_0x38cddb['next']();}}catch(_0x1f4a81){logger[_0x44db('0xc')](_0x44db('0x19'),_0x4851d2,_0x1f4a81['message']);_0x38cddb['stop']();}}}catch(_0x4bb8c4){logger[_0x44db('0xc')]('[%s][GOTOIF]\x20%s',_0x4851d2,JSON[_0x44db('0x1a')](_0x4bb8c4));_0x38cddb['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 12da900..2d38ae2 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 _0x6353=['rules','priority','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','validate','lodash','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','[%s][GOTOP]\x20%s','map','message','join','stop','[%s][GOTOP]\x20priority\x20%s','findIndex'];(function(_0x408555,_0x8ca998){var _0x1fd70c=function(_0x3e599e){while(--_0x3e599e){_0x408555['push'](_0x408555['shift']());}};_0x1fd70c(++_0x8ca998);}(_0x6353,0x1c8));var _0x3635=function(_0x24955f,_0x2eb32e){_0x24955f=_0x24955f-0x0;var _0x20ec55=_0x6353[_0x24955f];return _0x20ec55;};'use strict';var schema=require(_0x3635('0x0'));var _=require(_0x3635('0x1'));var logger=require('../../../../config/logger')(_0x3635('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x3635('0x3')}});exports[_0x3635('0x4')]=function(_0x3b5df3,_0x406133){return function(_0x2ab76f){try{var _0xf82f00={'priority':_0x406133[0x0]};var _0x5f0d0c=gotop[_0x3635('0x0')](_0xf82f00,{'typecast':!![]});if(_0x5f0d0c['length']){logger['error'](_0x3635('0x5'),_0x3b5df3,_[_0x3635('0x6')](_0x5f0d0c,_0x3635('0x7'))[_0x3635('0x8')](',\x20'));_0x2ab76f[_0x3635('0x9')]();}else{logger['info'](_0x3635('0xa'),_0x3b5df3,_0xf82f00['priority']);if(_0xf82f00['priority']){var _0x4c1b9b=_[_0x3635('0xb')](_0x2ab76f[_0x3635('0xc')](),{'p':_0xf82f00[_0x3635('0xd')]});if(_0x4c1b9b>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x3b5df3,_0xf82f00[_0x3635('0xd')]||_0x3635('0xe'),_0x4c1b9b);_0x2ab76f[_0x3635('0xe')](_0x4c1b9b);}else{logger['info'](_0x3635('0xf'),_0x3b5df3,_0xf82f00[_0x3635('0xd')]||_0x3635('0xe'));_0x2ab76f[_0x3635('0x9')]();}}else{_0x2ab76f[_0x3635('0xe')]();}}}catch(_0x39880f){logger[_0x3635('0x10')](_0x3635('0x5'),_0x3b5df3,JSON[_0x3635('0x11')](_0x39880f));_0x2ab76f[_0x3635('0x9')]();}};}; \ No newline at end of file +var _0x68f3=['message','join','stop','info','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','[%s][GOTOP]\x20%s','map'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x68f3,0xd6));var _0x368f=function(_0x249f20,_0x2c8cb4){_0x249f20=_0x249f20-0x0;var _0x75b27b=_0x68f3[_0x249f20];return _0x75b27b;};'use strict';var schema=require(_0x368f('0x0'));var _=require('lodash');var logger=require(_0x368f('0x1'))(_0x368f('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x368f('0x3')}});exports[_0x368f('0x4')]=function(_0x13da55,_0x8b2315){return function(_0x21ead6){try{var _0x34353e={'priority':_0x8b2315[0x0]};var _0x4e0e9c=gotop[_0x368f('0x0')](_0x34353e,{'typecast':!![]});if(_0x4e0e9c['length']){logger['error'](_0x368f('0x5'),_0x13da55,_[_0x368f('0x6')](_0x4e0e9c,_0x368f('0x7'))[_0x368f('0x8')](',\x20'));_0x21ead6[_0x368f('0x9')]();}else{logger[_0x368f('0xa')]('[%s][GOTOP]\x20priority\x20%s',_0x13da55,_0x34353e['priority']);if(_0x34353e[_0x368f('0xb')]){var _0x136f24=_[_0x368f('0xc')](_0x21ead6['rules'](),{'p':_0x34353e['priority']});if(_0x136f24>=0x0){logger[_0x368f('0xa')](_0x368f('0xd'),_0x13da55,_0x34353e[_0x368f('0xb')]||_0x368f('0xe'),_0x136f24);_0x21ead6[_0x368f('0xe')](_0x136f24);}else{logger[_0x368f('0xa')](_0x368f('0xf'),_0x13da55,_0x34353e[_0x368f('0xb')]||_0x368f('0xe'));_0x21ead6[_0x368f('0x9')]();}}else{_0x21ead6[_0x368f('0xe')]();}}}catch(_0x512261){logger['error'](_0x368f('0x5'),_0x13da55,JSON[_0x368f('0x10')](_0x512261));_0x21ead6[_0x368f('0x9')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 1935fbf..67c3f76 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 _0x0a06=['channel','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact'];(function(_0x506cbe,_0x818678){var _0x4fdaa7=function(_0x28db18){while(--_0x28db18){_0x506cbe['push'](_0x506cbe['shift']());}};_0x4fdaa7(++_0x818678);}(_0x0a06,0x1ec));var _0x60a0=function(_0x285fff,_0x4fb54f){_0x285fff=_0x285fff-0x0;var _0x44e78f=_0x0a06[_0x285fff];return _0x44e78f;};'use strict';var _=require(_0x60a0('0x0'));var utils=require(_0x60a0('0x1'));var logger=require(_0x60a0('0x2'))(_0x60a0('0x3'));var rpc={'chatMessage':require(_0x60a0('0x4')),'openchannelMessage':require(_0x60a0('0x5')),'mailMessage':require(_0x60a0('0x6')),'smsMessage':require(_0x60a0('0x7')),'faxMessage':require(_0x60a0('0x8'))};exports[_0x60a0('0x9')]=function(_0x31b4ac,_0x3684ad){return function(_0x3bab72){try{var _0x56ece3={'body':utils[_0x60a0('0xa')](_0x3684ad[0x0],this),'ContactId':this[_0x60a0('0xb')]['id']};if(this[_0x60a0('0xc')]==='chat'){_0x56ece3[_0x60a0('0xd')]=this[_0x60a0('0xe')]['id'];}else{_0x56ece3[_[_0x60a0('0xf')](this['channel'])+_0x60a0('0x10')]=this[_0x60a0('0xe')]['id'];}_0x56ece3[_[_0x60a0('0xf')](this[_0x60a0('0xc')])+_0x60a0('0x11')]=this['interaction']['id'];if(rpc[this[_0x60a0('0xc')]+_0x60a0('0x12')]){return rpc[this[_0x60a0('0xc')]+_0x60a0('0x12')][_0x60a0('0x13')](_0x56ece3)[_0x60a0('0x14')](function(_0x8fe043){logger[_0x60a0('0x15')](_0x60a0('0x16'),_0x31b4ac,_0x56ece3[_0x60a0('0x17')]);_0x3bab72[_0x60a0('0x18')]();})['catch'](function(_0x26a1fb){logger[_0x60a0('0x19')](_0x60a0('0x16'),_0x31b4ac,JSON[_0x60a0('0x1a')](_0x26a1fb));_0x3bab72['stop']();});}}catch(_0x33b58e){logger[_0x60a0('0x19')](_0x60a0('0x16'),_0x31b4ac,JSON[_0x60a0('0x1a')](_0x33b58e));_0x3bab72[_0x60a0('0x1b')]();}};}; \ No newline at end of file +var _0x0c04=['channel','chat','account','upperFirst','AccountId','InteractionId','Message','create','info','[%s][MESSAGE]\x20%s','body','next','stringify','stop','error','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact'];(function(_0x4f22c3,_0x2b63ec){var _0x53e3fb=function(_0x4de3f8){while(--_0x4de3f8){_0x4f22c3['push'](_0x4f22c3['shift']());}};_0x53e3fb(++_0x2b63ec);}(_0x0c04,0xab));var _0x40c0=function(_0x43f2d5,_0x7ab059){_0x43f2d5=_0x43f2d5-0x0;var _0x5af550=_0x0c04[_0x43f2d5];return _0x5af550;};'use strict';var _=require(_0x40c0('0x0'));var utils=require('./utils');var logger=require(_0x40c0('0x1'))(_0x40c0('0x2'));var rpc={'chatMessage':require(_0x40c0('0x3')),'openchannelMessage':require(_0x40c0('0x4')),'mailMessage':require(_0x40c0('0x5')),'smsMessage':require(_0x40c0('0x6')),'faxMessage':require(_0x40c0('0x7'))};exports[_0x40c0('0x8')]=function(_0x44ba8f,_0x1753d0){return function(_0x2c0cc3){try{var _0xb0a74={'body':utils[_0x40c0('0x9')](_0x1753d0[0x0],this),'ContactId':this[_0x40c0('0xa')]['id']};if(this[_0x40c0('0xb')]===_0x40c0('0xc')){_0xb0a74['ChatWebsiteId']=this[_0x40c0('0xd')]['id'];}else{_0xb0a74[_[_0x40c0('0xe')](this[_0x40c0('0xb')])+_0x40c0('0xf')]=this[_0x40c0('0xd')]['id'];}_0xb0a74[_[_0x40c0('0xe')](this['channel'])+_0x40c0('0x10')]=this['interaction']['id'];if(rpc[this[_0x40c0('0xb')]+_0x40c0('0x11')]){return rpc[this[_0x40c0('0xb')]+_0x40c0('0x11')][_0x40c0('0x12')](_0xb0a74)['then'](function(_0x16d02d){logger[_0x40c0('0x13')](_0x40c0('0x14'),_0x44ba8f,_0xb0a74[_0x40c0('0x15')]);_0x2c0cc3[_0x40c0('0x16')]();})['catch'](function(_0x10d656){logger['error']('[%s][MESSAGE]\x20%s',_0x44ba8f,JSON[_0x40c0('0x17')](_0x10d656));_0x2c0cc3[_0x40c0('0x18')]();});}}catch(_0x236865){logger[_0x40c0('0x19')](_0x40c0('0x14'),_0x44ba8f,JSON['stringify'](_0x236865));_0x2c0cc3['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index f332f97..a314cae 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 _0xcbcc=['getMustacheRender','error','stringify','stop','routing','info','[%s][NOOP]\x20%s'];(function(_0x2e37e3,_0x58c21e){var _0x744411=function(_0x1d3da3){while(--_0x1d3da3){_0x2e37e3['push'](_0x2e37e3['shift']());}};_0x744411(++_0x58c21e);}(_0xcbcc,0x18c));var _0xccbc=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xcbcc[_0x45783c];return _0x1161da;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')(_0xccbc('0x0'));exports['consequence']=function(_0x284f39,_0x52940e){return function(_0xa8f81c){try{logger[_0xccbc('0x1')](_0xccbc('0x2'),_0x284f39,utils[_0xccbc('0x3')](_0x52940e[0x0],this));_0xa8f81c['next']();}catch(_0x5bf343){logger[_0xccbc('0x4')](_0xccbc('0x2'),_0x284f39,JSON[_0xccbc('0x5')](_0x5bf343));_0xa8f81c[_0xccbc('0x6')]();}};}; \ No newline at end of file +var _0xa79a=['[%s][NOOP]\x20%s','stop','routing','consequence','info','getMustacheRender','next','error'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0xa79a,0x92));var _0xaa79=function(_0x465ba9,_0x3778c8){_0x465ba9=_0x465ba9-0x0;var _0x26d02a=_0xa79a[_0x465ba9];return _0x26d02a;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')(_0xaa79('0x0'));exports[_0xaa79('0x1')]=function(_0xe8c4eb,_0x392e44){return function(_0x2fc811){try{logger[_0xaa79('0x2')]('[%s][NOOP]\x20%s',_0xe8c4eb,utils[_0xaa79('0x3')](_0x392e44[0x0],this));_0x2fc811[_0xaa79('0x4')]();}catch(_0x4dad37){logger[_0xaa79('0x5')](_0xaa79('0x6'),_0xe8c4eb,JSON['stringify'](_0x4dad37));_0x2fc811[_0xaa79('0x7')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 0393018..5026ab6 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 _0x2fe6=['remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../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','upperFirst','channel','InteractionId','interaction','message','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','error','accepted','[%s][STOP:QUEUE][NAME:%s]','catch','timeout','update\x20queue\x20report','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','stop','Queues','qtimeout','close','rules','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','localhost','socket.io-emitter','queue','from','joinAt','emit','account','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save'];(function(_0x2bfe52,_0x43946e){var _0x1cf649=function(_0xc8300c){while(--_0xc8300c){_0x2bfe52['push'](_0x2bfe52['shift']());}};_0x1cf649(++_0x43946e);}(_0x2fe6,0x1cb));var _0x62fe=function(_0x28504d,_0x2596d2){_0x28504d=_0x28504d-0x0;var _0x55f68b=_0x2fe6[_0x28504d];return _0x55f68b;};'use strict';var schema=require(_0x62fe('0x0'));var _=require(_0x62fe('0x1'));var util=require(_0x62fe('0x2'));var seqqueue=require(_0x62fe('0x3'));var moment=require(_0x62fe('0x4'));var Redis=require(_0x62fe('0x5'));var config=require(_0x62fe('0x6'));var logger=require(_0x62fe('0x7'))(_0x62fe('0x8'));var strategy=require(_0x62fe('0x9'));config[_0x62fe('0xa')]=_['defaults'](config[_0x62fe('0xa')],{'host':_0x62fe('0xb'),'port':0x18eb});var io=require(_0x62fe('0xc'))(new Redis(config[_0x62fe('0xa')]));var attributes=['id','queue_id','account',_0x62fe('0xd'),_0x62fe('0xe'),_0x62fe('0xf')];function emit(_0xdacf42,_0x5bacff,_0x2b055){io['to'](_0xdacf42)[_0x62fe('0x10')](_0x5bacff,_0x2b055);}function emitChannelQueueInteraction(_0x3a436d,_0x413c28,_0x1f08bb,_0x1c3190,_0x51c75d,_0x32ada6,_0x5cb211,_0x437b31){_0x1f08bb['queue_id']=_0x437b31;_0x1f08bb[_0x62fe('0xd')]=_0x413c28;_0x1f08bb[_0x62fe('0x11')]=_0x1c3190;_0x1f08bb['id']=_0x51c75d;if(_0x32ada6){_0x5cb211[util['format'](_0x62fe('0x12'),_0x3a436d)][_0x51c75d]=_[_0x62fe('0x13')](_0x1f08bb,attributes);}else{delete _0x5cb211[util[_0x62fe('0x14')](_0x62fe('0x12'),_0x3a436d)][_0x51c75d];}emit(util[_0x62fe('0x14')](_0x62fe('0x15'),_0x3a436d,_0x413c28),util['format'](_0x62fe('0x16'),_0x3a436d,_0x32ada6?_0x62fe('0x17'):_0x62fe('0x18')),_[_0x62fe('0x13')](_0x1f08bb,attributes));}var rpc={'openchannelQueueReport':require(_0x62fe('0x19')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x62fe('0x1a')),'smsQueueReport':require(_0x62fe('0x1b')),'faxQueueReport':require(_0x62fe('0x1c'))};var queue=schema({'name':{'type':_0x62fe('0x1d'),'required':!![],'message':_0x62fe('0x1e')},'timeout':{'type':_0x62fe('0x1f'),'message':_0x62fe('0x20')}});function startRouting(_0x19d264,_0x2614fd,_0x2fbbf4,_0x4d096f){if(_0x19d264&&_0x2614fd&&_0x2fbbf4){_0x2614fd[_0x62fe('0x21')]+=0x1;var _0x446280={'uniqueid':_0x19d264,'from':_0x2fbbf4[_0x62fe('0x22')]?_0x2fbbf4[_0x62fe('0x22')][_0x62fe('0xe')]:'','joinAt':moment()['format'](_0x62fe('0x23')),'ContactId':_0x2fbbf4['contact']?_0x2fbbf4[_0x62fe('0x24')]['id']:null,'ListId':_0x2fbbf4['list']?_0x2fbbf4['list']['id']:null};_0x446280[_[_0x62fe('0x25')](_0x2fbbf4[_0x62fe('0x26')])+'QueueId']=_0x2614fd['id']||null;_0x446280[_[_0x62fe('0x25')](_0x2fbbf4['channel'])+_0x62fe('0x27')]=_0x2fbbf4[_0x62fe('0x28')]?_0x2fbbf4[_0x62fe('0x28')]['id']:null;_0x446280[_['upperFirst'](_0x2fbbf4[_0x62fe('0x26')])+'MessageId']=_0x2fbbf4[_0x62fe('0x29')]?_0x2fbbf4['message']['id']:null;_0x446280[_[_0x62fe('0x25')](_0x2fbbf4[_0x62fe('0x26')])+(_0x2fbbf4[_0x62fe('0x26')]!=='chat'?_0x62fe('0x2a'):_0x62fe('0x2b'))]=_0x2fbbf4[_0x62fe('0x11')]?_0x2fbbf4['account']['id']:null;logger[_0x62fe('0x2c')](util[_0x62fe('0x14')](_0x62fe('0x2d'),_0x19d264,_0x2614fd[_0x62fe('0x2e')]));emitChannelQueueInteraction(_0x2fbbf4['channel'],_0x2614fd['name'],_0x446280,_0x2fbbf4[_0x62fe('0x11')][_0x62fe('0x2e')],_0x2fbbf4[_0x62fe('0x29')]['id'],!![],_0x4d096f,_0x2614fd['id']);if(rpc[_0x2fbbf4[_0x62fe('0x26')]+_0x62fe('0x2f')]){return rpc[_0x2fbbf4[_0x62fe('0x26')]+_0x62fe('0x2f')]['create'](_0x446280)['catch'](function(_0x5e7586){logger[_0x62fe('0x30')]('create\x20queue\x20report');});}}}function stopRouting(_0xb20b66,_0x555250,_0x580745,_0x4e0d3d){if(_0xb20b66&&_0x555250){_0x555250[_0x62fe('0x21')]-=0x1;var _0x51cfa8={'leaveAt':moment()[_0x62fe('0x14')](_0x62fe('0x23')),'acceptAt':moment()[_0x62fe('0x14')](_0x62fe('0x23')),'reason':_0x62fe('0x31')};logger[_0x62fe('0x2c')](util[_0x62fe('0x14')](_0x62fe('0x32'),_0xb20b66,_0x555250['name']));emitChannelQueueInteraction(_0x580745[_0x62fe('0x26')],_0x555250[_0x62fe('0x2e')],_0x580745['body'],_0x580745['account'][_0x62fe('0x2e')],_0x580745[_0x62fe('0x29')]['id'],![],_0x4e0d3d,_0x555250['id']);if(rpc[_0x580745[_0x62fe('0x26')]+_0x62fe('0x2f')]){return rpc[_0x580745[_0x62fe('0x26')]+_0x62fe('0x2f')]['update'](_0xb20b66,_0x51cfa8)[_0x62fe('0x33')](function(_0x3031a8){logger['error']('update\x20queue\x20report');});}}}function endRouting(_0x4493b7,_0x28b50a,_0x494a51,_0x2ed589){if(_0x4493b7&&_0x28b50a){_0x28b50a[_0x62fe('0x21')]-=0x1;var _0x28e0f7={'leaveAt':moment()[_0x62fe('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x62fe('0x23')),'reason':_0x62fe('0x34')};logger['info'](util['format']('[%s][END:QUEUE][NAME:%s]',_0x4493b7,_0x28b50a[_0x62fe('0x2e')]));emitChannelQueueInteraction(_0x494a51['channel'],_0x28b50a[_0x62fe('0x2e')],_0x494a51[_0x62fe('0x22')],_0x494a51[_0x62fe('0x11')][_0x62fe('0x2e')],_0x494a51[_0x62fe('0x29')]['id'],![],_0x2ed589);if(rpc[_0x494a51['channel']+'QueueReport']){return rpc[_0x494a51[_0x62fe('0x26')]+'QueueReport']['update'](_0x4493b7,_0x28e0f7)['catch'](function(_0x3720d0){logger[_0x62fe('0x30')](_0x62fe('0x35'));});}}}function handleFindQueue(_0x223333){return function(_0xfc2c3a){return _0xfc2c3a[_0x62fe('0x2e')][_0x62fe('0x36')]()===_0x223333[_0x62fe('0x36')]();};}exports['consequence']=function(_0x3a6aab,_0x477870,_0x4318e9,_0x3e9752){return function(_0x566dde){try{var _0x521510={'name':_0x477870[0x0],'timeout':_0x477870[0x1]};var _0x1e6e7d=queue[_0x62fe('0x0')](_0x521510,{'typecast':!![]});if(_0x1e6e7d[_0x62fe('0x37')]){logger[_0x62fe('0x30')](_0x62fe('0x38'),_0x3a6aab,_[_0x62fe('0x39')](_0x1e6e7d,'message')[_0x62fe('0x3a')](',\x20'));_0x566dde[_0x62fe('0x3b')]();}else{var _0xd3969f=_['find'](_0x4318e9[_0x3e9752['channel']+_0x62fe('0x3c')],handleFindQueue(_0x521510['name']));if(_0xd3969f){startRouting(_0x3a6aab,_0xd3969f,_0x3e9752,_0x4318e9);var _0x2f2776=(_0xd3969f[_0x62fe('0x34')]||0xa)*0x3e8;var _0x4f29b5=(_0x521510[_0x62fe('0x34')]||0x14)*0x3e8;var _0x1819f5,_0xa505f1;if(_0x2f2776>_0x4f29b5){_0x4f29b5=_0x2f2776;}var _0x53ed25=seqqueue['createQueue'](_0x2f2776);_0x53ed25['id']=_0x3a6aab;_0x53ed25['atimeout']=_0x2f2776;_0x53ed25[_0x62fe('0x3d')]=_0x4f29b5;_0x53ed25['channel']=_0x3e9752[_0x62fe('0x26')];_0x4318e9['rules'][_0x3a6aab]['on']('end',function(){stopRouting(_0x3a6aab,_0xd3969f,_0x3e9752,_0x4318e9);_0x53ed25[_0x62fe('0x3e')](!![]);clearTimeout(_0x1819f5);_0x1819f5=undefined;if(_0x4318e9['rules'][_0x3a6aab]){delete _0x4318e9[_0x62fe('0x3f')][_0x3a6aab];}logger[_0x62fe('0x2c')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x3a6aab);_0x566dde[_0x62fe('0x3b')]();});_0x1819f5=setTimeout(function(){endRouting(_0x3a6aab,_0xd3969f,_0x3e9752,_0x4318e9);clearTimeout(_0x1819f5);_0x53ed25[_0x62fe('0x3e')](!![]);logger['info']('[%s][QUEUE]\x20ROUTING\x20END',_0x3a6aab);_0x566dde['next']();},_0x4f29b5);switch(_0xd3969f[_0x62fe('0x40')]){case _0x62fe('0x41'):strategy[_0x62fe('0x41')](_0x53ed25,_0xd3969f,_0x4318e9,_0x3e9752);break;default:strategy[_0x62fe('0x42')](_0x53ed25,_0xd3969f,_0x4318e9,_0x3e9752);}}else{logger[_0x62fe('0x30')](_0x62fe('0x43'),_0x3a6aab,_0x521510[_0x62fe('0x2e')]);_0x566dde['stop']();}}}catch(_0xfdcfd4){console['log'](_0xfdcfd4);logger[_0x62fe('0x30')](_0x62fe('0x38'),_0x3a6aab,_0xfdcfd4[_0x62fe('0x44')]);_0x566dde[_0x62fe('0x3b')]();}};}; \ No newline at end of file +var _0x6ab8=['close','[%s][QUEUE]\x20ROUTING\x20STOPPED','stop','[%s][QUEUE]\x20ROUTING\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','localhost','queue_id','account','queue','from','joinAt','emit','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','pick','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','find','Queues','createQueue','qtimeout','rules'];(function(_0x187b8b,_0x599b8b){var _0x2e39db=function(_0x5edae6){while(--_0x5edae6){_0x187b8b['push'](_0x187b8b['shift']());}};_0x2e39db(++_0x599b8b);}(_0x6ab8,0xa8));var _0x86ab=function(_0x397c32,_0x1dbb84){_0x397c32=_0x397c32-0x0;var _0x59fbd3=_0x6ab8[_0x397c32];return _0x59fbd3;};'use strict';var schema=require(_0x86ab('0x0'));var _=require(_0x86ab('0x1'));var util=require(_0x86ab('0x2'));var seqqueue=require(_0x86ab('0x3'));var moment=require(_0x86ab('0x4'));var Redis=require(_0x86ab('0x5'));var config=require(_0x86ab('0x6'));var logger=require(_0x86ab('0x7'))(_0x86ab('0x8'));var strategy=require(_0x86ab('0x9'));config[_0x86ab('0xa')]=_['defaults'](config[_0x86ab('0xa')],{'host':_0x86ab('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x86ab('0xa')]));var attributes=['id',_0x86ab('0xc'),_0x86ab('0xd'),_0x86ab('0xe'),_0x86ab('0xf'),_0x86ab('0x10')];function emit(_0x1651c2,_0x3c7b73,_0x587465){io['to'](_0x1651c2)[_0x86ab('0x11')](_0x3c7b73,_0x587465);}function emitChannelQueueInteraction(_0x25e94a,_0x47afe7,_0xa3fa79,_0x1427c8,_0x5e28e1,_0x556e13,_0x14d308,_0x120f2e){_0xa3fa79[_0x86ab('0xc')]=_0x120f2e;_0xa3fa79[_0x86ab('0xe')]=_0x47afe7;_0xa3fa79[_0x86ab('0xd')]=_0x1427c8;_0xa3fa79['id']=_0x5e28e1;if(_0x556e13){_0x14d308[util[_0x86ab('0x12')](_0x86ab('0x13'),_0x25e94a)][_0x5e28e1]=_['pick'](_0xa3fa79,attributes);}else{delete _0x14d308[util[_0x86ab('0x12')](_0x86ab('0x13'),_0x25e94a)][_0x5e28e1];}emit(util['format'](_0x86ab('0x14'),_0x25e94a,_0x47afe7),util[_0x86ab('0x12')](_0x86ab('0x15'),_0x25e94a,_0x556e13?_0x86ab('0x16'):'remove'),_[_0x86ab('0x17')](_0xa3fa79,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x86ab('0x18')),'chatQueueReport':require(_0x86ab('0x19')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x86ab('0x1a'))};var queue=schema({'name':{'type':_0x86ab('0x1b'),'required':!![],'message':_0x86ab('0x1c')},'timeout':{'type':_0x86ab('0x1d'),'message':_0x86ab('0x1e')}});function startRouting(_0x25af61,_0x8c80fc,_0x48287b,_0x324164){if(_0x25af61&&_0x8c80fc&&_0x48287b){_0x8c80fc[_0x86ab('0x1f')]+=0x1;var _0x3e21db={'uniqueid':_0x25af61,'from':_0x48287b[_0x86ab('0x20')]?_0x48287b[_0x86ab('0x20')][_0x86ab('0xf')]:'','joinAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x48287b[_0x86ab('0x21')]?_0x48287b[_0x86ab('0x21')]['id']:null,'ListId':_0x48287b[_0x86ab('0x22')]?_0x48287b[_0x86ab('0x22')]['id']:null};_0x3e21db[_[_0x86ab('0x23')](_0x48287b[_0x86ab('0x24')])+_0x86ab('0x25')]=_0x8c80fc['id']||null;_0x3e21db[_[_0x86ab('0x23')](_0x48287b[_0x86ab('0x24')])+_0x86ab('0x26')]=_0x48287b[_0x86ab('0x27')]?_0x48287b['interaction']['id']:null;_0x3e21db[_[_0x86ab('0x23')](_0x48287b[_0x86ab('0x24')])+_0x86ab('0x28')]=_0x48287b[_0x86ab('0x29')]?_0x48287b[_0x86ab('0x29')]['id']:null;_0x3e21db[_[_0x86ab('0x23')](_0x48287b[_0x86ab('0x24')])+(_0x48287b[_0x86ab('0x24')]!==_0x86ab('0x2a')?'AccountId':_0x86ab('0x2b'))]=_0x48287b['account']?_0x48287b['account']['id']:null;logger[_0x86ab('0x2c')](util['format'](_0x86ab('0x2d'),_0x25af61,_0x8c80fc[_0x86ab('0x2e')]));emitChannelQueueInteraction(_0x48287b[_0x86ab('0x24')],_0x8c80fc[_0x86ab('0x2e')],_0x3e21db,_0x48287b[_0x86ab('0xd')][_0x86ab('0x2e')],_0x48287b[_0x86ab('0x29')]['id'],!![],_0x324164,_0x8c80fc['id']);if(rpc[_0x48287b[_0x86ab('0x24')]+'QueueReport']){return rpc[_0x48287b[_0x86ab('0x24')]+_0x86ab('0x2f')][_0x86ab('0x30')](_0x3e21db)[_0x86ab('0x31')](function(_0x20d2bc){logger[_0x86ab('0x32')](_0x86ab('0x33'));});}}}function stopRouting(_0x19fc23,_0x17f9a3,_0x14f860,_0x59977a){if(_0x19fc23&&_0x17f9a3){_0x17f9a3['waiting']-=0x1;var _0x133064={'leaveAt':moment()['format'](_0x86ab('0x34')),'acceptAt':moment()[_0x86ab('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger[_0x86ab('0x2c')](util[_0x86ab('0x12')](_0x86ab('0x35'),_0x19fc23,_0x17f9a3[_0x86ab('0x2e')]));emitChannelQueueInteraction(_0x14f860['channel'],_0x17f9a3[_0x86ab('0x2e')],_0x14f860[_0x86ab('0x20')],_0x14f860['account']['name'],_0x14f860[_0x86ab('0x29')]['id'],![],_0x59977a,_0x17f9a3['id']);if(rpc[_0x14f860[_0x86ab('0x24')]+_0x86ab('0x2f')]){return rpc[_0x14f860[_0x86ab('0x24')]+_0x86ab('0x2f')][_0x86ab('0x36')](_0x19fc23,_0x133064)[_0x86ab('0x31')](function(_0x4e19ac){logger['error'](_0x86ab('0x37'));});}}}function endRouting(_0x32317e,_0x23a43f,_0x38764b,_0x222236){if(_0x32317e&&_0x23a43f){_0x23a43f[_0x86ab('0x1f')]-=0x1;var _0x1215a9={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x86ab('0x12')](_0x86ab('0x34')),'reason':_0x86ab('0x38')};logger[_0x86ab('0x2c')](util[_0x86ab('0x12')](_0x86ab('0x39'),_0x32317e,_0x23a43f[_0x86ab('0x2e')]));emitChannelQueueInteraction(_0x38764b[_0x86ab('0x24')],_0x23a43f[_0x86ab('0x2e')],_0x38764b[_0x86ab('0x20')],_0x38764b[_0x86ab('0xd')][_0x86ab('0x2e')],_0x38764b[_0x86ab('0x29')]['id'],![],_0x222236);if(rpc[_0x38764b['channel']+'QueueReport']){return rpc[_0x38764b[_0x86ab('0x24')]+_0x86ab('0x2f')][_0x86ab('0x36')](_0x32317e,_0x1215a9)[_0x86ab('0x31')](function(_0x1ef25b){logger['error'](_0x86ab('0x37'));});}}}function handleFindQueue(_0xdbdb86){return function(_0x5ba994){return _0x5ba994[_0x86ab('0x2e')][_0x86ab('0x3a')]()===_0xdbdb86[_0x86ab('0x3a')]();};}exports[_0x86ab('0x3b')]=function(_0x3f390e,_0x663f9c,_0x2b138c,_0x5d3063){return function(_0x5c5ace){try{var _0x5f1e0d={'name':_0x663f9c[0x0],'timeout':_0x663f9c[0x1]};var _0x4e9efb=queue[_0x86ab('0x0')](_0x5f1e0d,{'typecast':!![]});if(_0x4e9efb[_0x86ab('0x3c')]){logger['error'](_0x86ab('0x3d'),_0x3f390e,_[_0x86ab('0x3e')](_0x4e9efb,_0x86ab('0x29'))[_0x86ab('0x3f')](',\x20'));_0x5c5ace['stop']();}else{var _0x517041=_[_0x86ab('0x40')](_0x2b138c[_0x5d3063[_0x86ab('0x24')]+_0x86ab('0x41')],handleFindQueue(_0x5f1e0d[_0x86ab('0x2e')]));if(_0x517041){startRouting(_0x3f390e,_0x517041,_0x5d3063,_0x2b138c);var _0x1fe153=(_0x517041[_0x86ab('0x38')]||0xa)*0x3e8;var _0x4a786b=(_0x5f1e0d[_0x86ab('0x38')]||0x14)*0x3e8;var _0x21b091,_0x6a1841;if(_0x1fe153>_0x4a786b){_0x4a786b=_0x1fe153;}var _0x3f2396=seqqueue[_0x86ab('0x42')](_0x1fe153);_0x3f2396['id']=_0x3f390e;_0x3f2396['atimeout']=_0x1fe153;_0x3f2396[_0x86ab('0x43')]=_0x4a786b;_0x3f2396[_0x86ab('0x24')]=_0x5d3063[_0x86ab('0x24')];_0x2b138c[_0x86ab('0x44')][_0x3f390e]['on']('end',function(){stopRouting(_0x3f390e,_0x517041,_0x5d3063,_0x2b138c);_0x3f2396[_0x86ab('0x45')](!![]);clearTimeout(_0x21b091);_0x21b091=undefined;if(_0x2b138c['rules'][_0x3f390e]){delete _0x2b138c['rules'][_0x3f390e];}logger[_0x86ab('0x2c')](_0x86ab('0x46'),_0x3f390e);_0x5c5ace[_0x86ab('0x47')]();});_0x21b091=setTimeout(function(){endRouting(_0x3f390e,_0x517041,_0x5d3063,_0x2b138c);clearTimeout(_0x21b091);_0x3f2396[_0x86ab('0x45')](!![]);logger['info'](_0x86ab('0x48'),_0x3f390e);_0x5c5ace[_0x86ab('0x49')]();},_0x4a786b);switch(_0x517041[_0x86ab('0x4a')]){case _0x86ab('0x4b'):strategy[_0x86ab('0x4b')](_0x3f2396,_0x517041,_0x2b138c,_0x5d3063);break;default:strategy[_0x86ab('0x4c')](_0x3f2396,_0x517041,_0x2b138c,_0x5d3063);}}else{logger[_0x86ab('0x32')](_0x86ab('0x4d'),_0x3f390e,_0x5f1e0d['name']);_0x5c5ace[_0x86ab('0x47')]();}}}catch(_0x4080cb){console['log'](_0x4080cb);logger[_0x86ab('0x32')](_0x86ab('0x3d'),_0x3f390e,_0x4080cb[_0x86ab('0x4e')]);_0x5c5ace[_0x86ab('0x47')]();}};}; \ 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 4c33712..aa31669 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 _0x5c88=['handleRun','bind','handleTimeout','timeout','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','realtime','channel','busy','busyQueue','RINGING','forcedOwnership','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','writeLog','STOP','TIMEOUT','lodash','uuid','../../../../../config/logger','routing','notificationId','agent','squeue','push'];(function(_0xdf30eb,_0x3cb65f){var _0x4d2fa9=function(_0x2b123c){while(--_0x2b123c){_0xdf30eb['push'](_0xdf30eb['shift']());}};_0x4d2fa9(++_0x3cb65f);}(_0x5c88,0x158));var _0x85c8=function(_0x2c9893,_0x4de09d){_0x2c9893=_0x2c9893-0x0;var _0x33ea57=_0x5c88[_0x2c9893];return _0x33ea57;};'use strict';var _=require(_0x85c8('0x0'));var uuid=require(_0x85c8('0x1'));var util=require('./util');var logger=require(_0x85c8('0x2'))(_0x85c8('0x3'));var Agent=function(_0x45f453,_0x137bdc,_0x30e2c1,_0x317355){this[_0x85c8('0x4')]=uuid['v4']();this['squeue']=_0x45f453;this[_0x85c8('0x5')]=_0x137bdc;this['realtime']=_0x30e2c1;this[_0x85c8('0x3')]=_0x317355;this[_0x85c8('0x6')][_0x85c8('0x7')](this[_0x85c8('0x8')][_0x85c8('0x9')](this),this[_0x85c8('0xa')][_0x85c8('0x9')](this));this['squeue']['on'](_0x85c8('0xb'),this[_0x85c8('0xa')][_0x85c8('0x9')](this));this['squeue']['on']('drained',this[_0x85c8('0xc')][_0x85c8('0x9')](this));};Agent[_0x85c8('0xd')][_0x85c8('0x7')]=function(){this[_0x85c8('0x6')]['push'](this['handleRun'][_0x85c8('0x9')](this),this['handleTimeout'][_0x85c8('0x9')](this));};Agent['prototype'][_0x85c8('0xc')]=function(){this[_0x85c8('0xa')](!![]);};Agent['prototype'][_0x85c8('0x8')]=function(_0x2cc2c5){logger[_0x85c8('0xe')](_0x85c8('0xf'),this[_0x85c8('0x6')]['id'],this[_0x85c8('0x5')]['id']);if(_['isNil'](this['realtime'][_0x85c8('0x10')][this[_0x85c8('0x5')]['id']])){logger[_0x85c8('0xe')](_0x85c8('0x11'),this[_0x85c8('0x6')]['id'],this[_0x85c8('0x5')]['id']);setTimeout(this[_0x85c8('0x7')][_0x85c8('0x9')](this),0x3e8);}else{if(this[_0x85c8('0x3')]['forcedOwnership']||util[_0x85c8('0x12')](this['squeue']['id'],this[_0x85c8('0x13')][_0x85c8('0x10')][this[_0x85c8('0x5')]['id']],this[_0x85c8('0x6')][_0x85c8('0x14')],![])){this[_0x85c8('0x13')][_0x85c8('0x10')][this[_0x85c8('0x5')]['id']][_0x85c8('0x15')]=!![];this[_0x85c8('0x13')]['agents'][this['agent']['id']][_0x85c8('0x16')]=undefined;util['showNotification'](this[_0x85c8('0x4')],this[_0x85c8('0x6')]['id'],this['realtime'][_0x85c8('0x10')][this[_0x85c8('0x5')]['id']],null,this[_0x85c8('0x3')]);util['writeLog'](this['squeue']['id'],this[_0x85c8('0x13')]['agents'][this['agent']['id']],_0x85c8('0x17')+(this[_0x85c8('0x3')][_0x85c8('0x18')]?':FORCED':''));}else{logger[_0x85c8('0xe')](_0x85c8('0x19'),this[_0x85c8('0x6')]['id'],this[_0x85c8('0x5')]['id']);setTimeout(this[_0x85c8('0x7')][_0x85c8('0x9')](this),0x3e8);}}};Agent['prototype'][_0x85c8('0xa')]=function(_0x30b50b){if(_[_0x85c8('0x1a')](this[_0x85c8('0x13')][_0x85c8('0x10')][this[_0x85c8('0x5')]['id']])){return logger[_0x85c8('0xe')](_0x85c8('0x11'),this['squeue']['id'],this[_0x85c8('0x5')]['id']);}else{logger[_0x85c8('0xe')](_0x85c8('0x1b'),this[_0x85c8('0x6')]['id'],this['agent']['id']);util[_0x85c8('0x1c')](this[_0x85c8('0x4')],this['squeue']['id'],this[_0x85c8('0x13')][_0x85c8('0x10')][this['agent']['id']],null,this[_0x85c8('0x3')]);this[_0x85c8('0x13')]['agents'][this['agent']['id']]['busy']=![];this[_0x85c8('0x13')]['agents'][this[_0x85c8('0x5')]['id']][_0x85c8('0x16')]=undefined;util[_0x85c8('0x1d')](this[_0x85c8('0x6')]['id'],this['realtime']['agents'][this[_0x85c8('0x5')]['id']],_0x30b50b?_0x85c8('0x1e'):_0x85c8('0x1f'));}if(!_0x30b50b){setTimeout(this[_0x85c8('0x7')][_0x85c8('0x9')](this),0x3e8);}};function agent(_0x46966c,_0x587861,_0xf81c48,_0x1e86d8){return new Agent(_0x46966c,_0x587861,_0xf81c48,_0x1e86d8);}module['exports']=agent; \ No newline at end of file +var _0x54bf=['./util','routing','notificationId','squeue','agent','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','agents','channel','busy','busyQueue','showNotification','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','writeLog','STOP','TIMEOUT','exports','lodash','uuid'];(function(_0x5b92a8,_0x2c5c1b){var _0x5f5fae=function(_0x156400){while(--_0x156400){_0x5b92a8['push'](_0x5b92a8['shift']());}};_0x5f5fae(++_0x2c5c1b);}(_0x54bf,0x106));var _0xf54b=function(_0x4bbe46,_0x25ed71){_0x4bbe46=_0x4bbe46-0x0;var _0x5bbecc=_0x54bf[_0x4bbe46];return _0x5bbecc;};'use strict';var _=require(_0xf54b('0x0'));var uuid=require(_0xf54b('0x1'));var util=require(_0xf54b('0x2'));var logger=require('../../../../../config/logger')(_0xf54b('0x3'));var Agent=function(_0xde56e8,_0x23a97e,_0x5dd917,_0x1222f0){this[_0xf54b('0x4')]=uuid['v4']();this[_0xf54b('0x5')]=_0xde56e8;this[_0xf54b('0x6')]=_0x23a97e;this['realtime']=_0x5dd917;this[_0xf54b('0x3')]=_0x1222f0;this[_0xf54b('0x5')][_0xf54b('0x7')](this[_0xf54b('0x8')][_0xf54b('0x9')](this),this[_0xf54b('0xa')][_0xf54b('0x9')](this));this[_0xf54b('0x5')]['on'](_0xf54b('0xb'),this[_0xf54b('0xa')][_0xf54b('0x9')](this));this['squeue']['on'](_0xf54b('0xc'),this[_0xf54b('0xd')]['bind'](this));};Agent[_0xf54b('0xe')][_0xf54b('0x7')]=function(){this[_0xf54b('0x5')][_0xf54b('0x7')](this[_0xf54b('0x8')]['bind'](this),this['handleTimeout'][_0xf54b('0x9')](this));};Agent['prototype']['handleDrained']=function(){this[_0xf54b('0xa')](!![]);};Agent[_0xf54b('0xe')]['handleRun']=function(_0x240e47){logger['info'](_0xf54b('0xf'),this[_0xf54b('0x5')]['id'],this[_0xf54b('0x6')]['id']);if(_[_0xf54b('0x10')](this[_0xf54b('0x11')]['agents'][this[_0xf54b('0x6')]['id']])){logger[_0xf54b('0x12')](_0xf54b('0x13'),this[_0xf54b('0x5')]['id'],this['agent']['id']);setTimeout(this['push']['bind'](this),0x3e8);}else{if(this[_0xf54b('0x3')][_0xf54b('0x14')]||util['isAgentAvailable'](this['squeue']['id'],this[_0xf54b('0x11')][_0xf54b('0x15')][this['agent']['id']],this[_0xf54b('0x5')][_0xf54b('0x16')],![])){this['realtime'][_0xf54b('0x15')][this[_0xf54b('0x6')]['id']][_0xf54b('0x17')]=!![];this[_0xf54b('0x11')]['agents'][this[_0xf54b('0x6')]['id']][_0xf54b('0x18')]=undefined;util[_0xf54b('0x19')](this[_0xf54b('0x4')],this['squeue']['id'],this[_0xf54b('0x11')][_0xf54b('0x15')][this['agent']['id']],null,this[_0xf54b('0x3')]);util['writeLog'](this[_0xf54b('0x5')]['id'],this[_0xf54b('0x11')][_0xf54b('0x15')][this[_0xf54b('0x6')]['id']],_0xf54b('0x1a')+(this[_0xf54b('0x3')][_0xf54b('0x14')]?':FORCED':''));}else{logger[_0xf54b('0x12')](_0xf54b('0x1b'),this['squeue']['id'],this[_0xf54b('0x6')]['id']);setTimeout(this[_0xf54b('0x7')]['bind'](this),0x3e8);}}};Agent[_0xf54b('0xe')][_0xf54b('0xa')]=function(_0x17b7eb){if(_[_0xf54b('0x10')](this[_0xf54b('0x11')]['agents'][this[_0xf54b('0x6')]['id']])){return logger[_0xf54b('0x12')](_0xf54b('0x13'),this['squeue']['id'],this[_0xf54b('0x6')]['id']);}else{logger[_0xf54b('0x12')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xf54b('0x5')]['id'],this[_0xf54b('0x6')]['id']);util[_0xf54b('0x1c')](this[_0xf54b('0x4')],this[_0xf54b('0x5')]['id'],this[_0xf54b('0x11')][_0xf54b('0x15')][this['agent']['id']],null,this[_0xf54b('0x3')]);this[_0xf54b('0x11')][_0xf54b('0x15')][this[_0xf54b('0x6')]['id']][_0xf54b('0x17')]=![];this[_0xf54b('0x11')][_0xf54b('0x15')][this[_0xf54b('0x6')]['id']][_0xf54b('0x18')]=undefined;util[_0xf54b('0x1d')](this[_0xf54b('0x5')]['id'],this['realtime']['agents'][this[_0xf54b('0x6')]['id']],_0x17b7eb?_0xf54b('0x1e'):_0xf54b('0x1f'));}if(!_0x17b7eb){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x275893,_0x2ac7ee,_0x1800ad,_0x16ef37){return new Agent(_0x275893,_0x2ac7ee,_0x1800ad,_0x16ef37);}module[_0xf54b('0x20')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 9a0ddbb..76f698e 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 _0x50d9=['handleRun','isNil','Agents','realtime','agents','info','writeLog','RINGING','busy','busyQueue','name','showNotification','routing','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','length','hideNotification','STOP','TIMEOUT','lodash','uuid','../../../../../config/logger','notificationId','squeue','queue','push','bind','timeout','drained','handleDrained','prototype','handleTimeout'];(function(_0x5a9e07,_0x4f88d6){var _0x4a7f68=function(_0x47cd69){while(--_0x47cd69){_0x5a9e07['push'](_0x5a9e07['shift']());}};_0x4a7f68(++_0x4f88d6);}(_0x50d9,0x73));var _0x950d=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x50d9[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x950d('0x0'));var uuid=require(_0x950d('0x1'));var util=require('./util');var logger=require(_0x950d('0x2'))('routing');var Beepall=function(_0x227219,_0x5c2bb5,_0x4212a7,_0x13953a){this[_0x950d('0x3')]=uuid['v4']();this[_0x950d('0x4')]=_0x227219;this[_0x950d('0x5')]=_0x5c2bb5;this['realtime']=_0x4212a7;this['routing']=_0x13953a;this['squeue'][_0x950d('0x6')](this['handleRun'][_0x950d('0x7')](this),this['handleTimeout']['bind'](this));this['squeue']['on'](_0x950d('0x8'),this['handleTimeout'][_0x950d('0x7')](this));this[_0x950d('0x4')]['on'](_0x950d('0x9'),this[_0x950d('0xa')][_0x950d('0x7')](this));};Beepall[_0x950d('0xb')][_0x950d('0x6')]=function(){this[_0x950d('0x4')][_0x950d('0x6')](this['handleRun'][_0x950d('0x7')](this),this[_0x950d('0xc')][_0x950d('0x7')](this));};Beepall[_0x950d('0xb')]['handleDrained']=function(_0x11f5f6){this['handleTimeout'](!![]);};Beepall['prototype'][_0x950d('0xd')]=function(_0x568e73){var _0x1a0a9a=!![];if(!_[_0x950d('0xe')](this[_0x950d('0x5')])&&!_[_0x950d('0xe')](this[_0x950d('0x5')][_0x950d('0xf')])&&this[_0x950d('0x5')][_0x950d('0xf')]['length']>0x0){for(var _0x4f1a48=0x0,_0x5e2a59;_0x4f1a480x0){for(var _0x5860c6=0x0,_0x435f23;_0x5860c60x0&&_0x43287d[_0x12750a+_0xb8b5('0x22')]>=_0x43287d[_0x12750a+_0xb8b5('0x21')]){writeLog(_0x29550e,_0x43287d,_0x12750a[_0xb8b5('0x23')]()+_0xb8b5('0x24'));return![];}}return!![];};exports['showNotification']=function(_0x8764e1,_0x57150b,_0x306bcf,_0x423e35,_0x10431b){return sendNotification(!![],_0x8764e1,_0x57150b,_0x306bcf,_0x423e35,_0x10431b);};exports[_0xb8b5('0x25')]=function(_0xe45b4,_0x3312d3,_0x1fce5b,_0x22ae89,_0x412bc0){return sendNotification(![],_0xe45b4,_0x3312d3,_0x1fce5b,_0x22ae89,_0x412bc0);};exports[_0xb8b5('0x26')]=writeLog; \ No newline at end of file +var _0x70f3=['online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','lodash','../utils','mustache','ioredis','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','format','user:%s','name','emit','user:save','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','BUSY'];(function(_0x37e7a4,_0xb7a496){var _0x269b2a=function(_0x19ee3f){while(--_0x19ee3f){_0x37e7a4['push'](_0x37e7a4['shift']());}};_0x269b2a(++_0xb7a496);}(_0x70f3,0xc3));var _0x370f=function(_0x12f4d8,_0x1f6d82){_0x12f4d8=_0x12f4d8-0x0;var _0x265413=_0x70f3[_0x12f4d8];return _0x265413;};'use strict';var _=require(_0x370f('0x0'));var util=require('util');var utils=require(_0x370f('0x1'));var Mustache=require(_0x370f('0x2'));var Redis=require(_0x370f('0x3'));var config=require('../../../../../config/environment');var logger=require(_0x370f('0x4'))(_0x370f('0x5'));config[_0x370f('0x6')]=_[_0x370f('0x7')](config['redis'],{'host':_0x370f('0x8'),'port':0x18eb});var io=require(_0x370f('0x9'))(new Redis(config[_0x370f('0x6')]));function emit(_0xf314b1,_0x51286e,_0x1a9f15){io['to'](_0xf314b1)['emit'](_0x51286e,_0x1a9f15);}function sendNotification(_0x306023,_0x587cc4,_0x35ad39,_0x1ecfc2,_0xe68e94,_0x1c8456){io['to'](util[_0x370f('0xa')](_0x370f('0xb'),_0x1ecfc2[_0x370f('0xc')]))[_0x370f('0xd')](_0x370f('0xe'),_0x1ecfc2);var _0x13b1da=_0x1c8456||{};var _0x3516a4=_0x35ad39[_0x370f('0xf')]('.');var _0x5811a5={'uniqueid':_0x587cc4,'channel':_0x3516a4[0x0],'id':_0x3516a4[0x1],'title':_0x3516a4[0x0]+_0x370f('0x10'),'interactionId':_0x3516a4[0x2],'queue':_0xe68e94?_0xe68e94[_0x370f('0xc')]:null,'sound':_0x13b1da[_0x370f('0x11')][_0x370f('0x12')],'shake':_0x13b1da[_0x370f('0x11')][_0x370f('0x13')]};try{if(!_0x13b1da[_0x370f('0x14')]){_0x13b1da['body']={};}if(_0xe68e94){_0x13b1da[_0x370f('0x14')][_0x370f('0x15')]=_0xe68e94;}else if(_0x13b1da['body'][_0x370f('0x15')]){delete _0x13b1da[_0x370f('0x14')]['queue'];}_0x5811a5[_0x370f('0x16')]=utils[_0x370f('0x17')](_0x13b1da[_0x370f('0x11')][_0x370f('0x18')],_0x13b1da);}catch(_0x3c5384){_0x5811a5[_0x370f('0x16')]=_0x370f('0x19');logger[_0x370f('0x1a')](util['format'](_0x370f('0x1b'),_0x587cc4,_0x3c5384['message']));}io['to'](util['format']('user:%s',_0x1ecfc2['name']))[_0x370f('0xd')](util[_0x370f('0xa')](_0x370f('0x1c'),_0x306023?_0x370f('0x1d'):_0x370f('0x1e')),_0x5811a5);}function writeLog(_0x1e3081,_0x2785f8,_0x226c06){return logger[_0x370f('0x1f')](util[_0x370f('0xa')](_0x370f('0x20'),_0x1e3081,_0x2785f8['name'],_0x226c06));}exports['isAgentAvailable']=function(_0x1aa76c,_0x4d2e64,_0xd4392d,_0x56d921){if(_0x4d2e64[_0x370f('0x21')]){writeLog(_0x1aa76c,_0x4d2e64,_0x370f('0x22'));return![];}if(!_0x4d2e64[_0x370f('0x23')]){writeLog(_0x1aa76c,_0x4d2e64,_0x370f('0x24'));return![];}if(_0x4d2e64[_0xd4392d+_0x370f('0x25')]){writeLog(_0x1aa76c,_0x4d2e64,_0x370f('0x26'));return![];}if(_0x56d921&&_0x4d2e64[_0x370f('0x27')](_0xd4392d+_0x370f('0x28'))&&_0x4d2e64['hasOwnProperty'](_0xd4392d+'CurrentCapacity')){if(_0x4d2e64[_0xd4392d+'Capacity']>0x0&&_0x4d2e64[_0xd4392d+_0x370f('0x29')]>=_0x4d2e64[_0xd4392d+'Capacity']){writeLog(_0x1aa76c,_0x4d2e64,_0xd4392d[_0x370f('0x2a')]()+_0x370f('0x2b'));return![];}}return!![];};exports[_0x370f('0x2c')]=function(_0x25fff3,_0x50f4e1,_0x108009,_0xd1eca9,_0x5bcf6a){return sendNotification(!![],_0x25fff3,_0x50f4e1,_0x108009,_0xd1eca9,_0x5bcf6a);};exports[_0x370f('0x2d')]=function(_0x344a8b,_0x460c84,_0x167c1e,_0x461cb8,_0x235922){return sendNotification(![],_0x344a8b,_0x460c84,_0x167c1e,_0x461cb8,_0x235922);};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index e6e8578..35d1450 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 _0xaf47=['[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][SYSTEM]\x20%s','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty'];(function(_0x4faa0a,_0x331beb){var _0x58eeba=function(_0x23bf5d){while(--_0x23bf5d){_0x4faa0a['push'](_0x4faa0a['shift']());}};_0x58eeba(++_0x331beb);}(_0xaf47,0xa7));var _0x7af4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaf47[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x7af4('0x0'));var sh=require(_0x7af4('0x1'));var _=require('lodash');var utils=require('./utils');var logger=require(_0x7af4('0x2'))(_0x7af4('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':_0x7af4('0x4')}});exports[_0x7af4('0x5')]=function(_0x43f9b2,_0x1ef4b0){return function(_0x5c96fa){try{var _0x2733f5={'command':_0x1ef4b0[0x0]};var _0x37165c=system['validate'](_0x2733f5,{'typecast':!![]});if(_0x37165c[_0x7af4('0x6')]){logger['error'](_0x7af4('0x7'),_0x43f9b2,_[_0x7af4('0x8')](_0x37165c,_0x7af4('0x9'))[_0x7af4('0xa')](',\x20'));logger['info'](_0x7af4('0xb'),_0x43f9b2);_0x5c96fa[_0x7af4('0xc')]();}else{var _0x2586e2=this;var _0x408417=utils[_0x7af4('0xd')](_0x1ef4b0[0x0],this);logger[_0x7af4('0xe')](_0x7af4('0xf'),_0x43f9b2,_0x408417);sh[_0x7af4('0x10')](_[_0x7af4('0x11')](_0x408417),function(_0x3e29e6,_0x1020b6){logger[_0x7af4('0xe')](_0x7af4('0x12'),_0x43f9b2,_0x3e29e6);if(_0x3e29e6==0x0){var _0x489916=_0x1020b6[_0x7af4('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0x7af4('0x14')](_0x1ef4b0[0x1])||_[_0x7af4('0x15')](_0x1ef4b0[0x1])){logger[_0x7af4('0xe')](_0x7af4('0x16'),_0x43f9b2);_0x2586e2[_0x7af4('0x17')][_0x1ef4b0[0x1]]=_0x489916;}else{logger[_0x7af4('0xe')](_0x7af4('0x18'),_0x43f9b2,_0x1ef4b0[0x1],_0x489916);_0x2586e2[_0x7af4('0x17')][_0x1ef4b0[0x1]]=_0x489916;}}_0x5c96fa[_0x7af4('0xc')]();});}}catch(_0x4a8632){logger['error'](_0x7af4('0x7'),_0x43f9b2,_[_0x7af4('0x19')](_0x4a8632)?JSON[_0x7af4('0x1a')](_0x4a8632):_0x4a8632);logger[_0x7af4('0xe')](_0x7af4('0xb'),_0x43f9b2);_0x5c96fa['next']();}};}; \ No newline at end of file +var _0x1354=['string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','isObject','stringify','validate','shelljs','./utils','../../../../config/logger','routing'];(function(_0x2f92d8,_0x2ef7f4){var _0x200ef1=function(_0x24f52e){while(--_0x24f52e){_0x2f92d8['push'](_0x2f92d8['shift']());}};_0x200ef1(++_0x2ef7f4);}(_0x1354,0x78));var _0x4135=function(_0x1e03a6,_0xf0349){_0x1e03a6=_0x1e03a6-0x0;var _0x295b64=_0x1354[_0x1e03a6];return _0x295b64;};'use strict';var schema=require(_0x4135('0x0'));var sh=require(_0x4135('0x1'));var _=require('lodash');var utils=require(_0x4135('0x2'));var logger=require(_0x4135('0x3'))(_0x4135('0x4'));var system=schema({'command':{'type':_0x4135('0x5'),'required':!![],'message':_0x4135('0x6')}});exports[_0x4135('0x7')]=function(_0x44c391,_0x4a5825){return function(_0x4e9190){try{var _0x539fe8={'command':_0x4a5825[0x0]};var _0x1e3448=system[_0x4135('0x0')](_0x539fe8,{'typecast':!![]});if(_0x1e3448[_0x4135('0x8')]){logger['error']('[%s][SYSTEM]\x20%s',_0x44c391,_['map'](_0x1e3448,'message')[_0x4135('0x9')](',\x20'));logger[_0x4135('0xa')](_0x4135('0xb'),_0x44c391);_0x4e9190[_0x4135('0xc')]();}else{var _0x4f0adc=this;var _0xe6055e=utils[_0x4135('0xd')](_0x4a5825[0x0],this);logger[_0x4135('0xa')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x44c391,_0xe6055e);sh[_0x4135('0xe')](_['trim'](_0xe6055e),function(_0x36059f,_0x4ace35){logger[_0x4135('0xa')](_0x4135('0xf'),_0x44c391,_0x36059f);if(_0x36059f==0x0){var _0x43ad2f=_0x4ace35[_0x4135('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0x4135('0x11')](_0x4a5825[0x1])||_[_0x4135('0x12')](_0x4a5825[0x1])){logger[_0x4135('0xa')](_0x4135('0x13'),_0x44c391);_0x4f0adc[_0x4135('0x14')][_0x4a5825[0x1]]=_0x43ad2f;}else{logger[_0x4135('0xa')](_0x4135('0x15'),_0x44c391,_0x4a5825[0x1],_0x43ad2f);_0x4f0adc[_0x4135('0x14')][_0x4a5825[0x1]]=_0x43ad2f;}}_0x4e9190[_0x4135('0xc')]();});}}catch(_0x2033ee){logger[_0x4135('0x16')]('[%s][SYSTEM]\x20%s',_0x44c391,_[_0x4135('0x17')](_0x2033ee)?JSON[_0x4135('0x18')](_0x2033ee):_0x2033ee);logger['info'](_0x4135('0xb'),_0x44c391);_0x4e9190[_0x4135('0xc')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 776567e..3b41620 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 _0x7a54=['finally','error','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][TAG]\x20%s','map','join','next','channel','Interaction','addTags','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x309919,_0x4c8eac){var _0x1ebc85=function(_0x150eab){while(--_0x150eab){_0x309919['push'](_0x309919['shift']());}};_0x1ebc85(++_0x4c8eac);}(_0x7a54,0x106));var _0x47a5=function(_0x489275,_0x2cae51){_0x489275=_0x489275-0x0;var _0x942b4e=_0x7a54[_0x489275];return _0x942b4e;};'use strict';var schema=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var rpc={'chatInteraction':require(_0x47a5('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x47a5('0x3')),'mailInteraction':require(_0x47a5('0x4')),'faxInteraction':require('../../rpc/faxInteraction')};var logger=require(_0x47a5('0x5'))(_0x47a5('0x6'));var tag=schema({'tag':{'type':_0x47a5('0x7'),'required':!![],'message':_0x47a5('0x8')}});exports[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629,_0x59199c,_0x343372){return function(_0x30e405){try{var _0x506eda={'tag':_0x3d5629[0x0]};var _0x194fb0=tag['validate'](_0x506eda,{'typecast':!![]});if(_0x194fb0['length']){logger['error'](_0x47a5('0xa'),_0x545a97,_[_0x47a5('0xb')](_0x194fb0,'message')[_0x47a5('0xc')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x545a97);_0x30e405[_0x47a5('0xd')]();}else{var _0x69e4d4={'ids':[_0x3d5629[0x0]]};if(rpc[_0x343372[_0x47a5('0xe')]+_0x47a5('0xf')]){rpc[_0x343372[_0x47a5('0xe')]+_0x47a5('0xf')][_0x47a5('0x10')](_0x343372['interaction']['id'],_0x69e4d4)[_0x47a5('0x11')](function(_0x221b54){logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x545a97,_0x3d5629[0x1],_0x343372[_0x47a5('0xe')],_0x343372[_0x47a5('0x14')]['id']);})[_0x47a5('0x15')](function(_0x190faa){logger['error'](_0x47a5('0xa'),_0x545a97,JSON[_0x47a5('0x16')](_0x190faa));logger[_0x47a5('0x12')](_0x47a5('0x17'),_0x545a97);})[_0x47a5('0x18')](function(){_0x30e405['next']();});}}}catch(_0x549de3){logger[_0x47a5('0x19')]('[%s][TAG]\x20%s',_0x545a97,_['isObject'](_0x549de3)?JSON[_0x47a5('0x16')](_0x549de3):_0x549de3);logger[_0x47a5('0x12')](_0x47a5('0x17'),_0x545a97);_0x30e405[_0x47a5('0xd')]();}};}; \ No newline at end of file +var _0x7a54=['finally','error','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][TAG]\x20%s','map','join','next','channel','Interaction','addTags','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x57a46a,_0x53899e){var _0x4b0512=function(_0x808813){while(--_0x808813){_0x57a46a['push'](_0x57a46a['shift']());}};_0x4b0512(++_0x53899e);}(_0x7a54,0x106));var _0x47a5=function(_0xe0abdc,_0x556e9d){_0xe0abdc=_0xe0abdc-0x0;var _0x1ef5b6=_0x7a54[_0xe0abdc];return _0x1ef5b6;};'use strict';var schema=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var rpc={'chatInteraction':require(_0x47a5('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x47a5('0x3')),'mailInteraction':require(_0x47a5('0x4')),'faxInteraction':require('../../rpc/faxInteraction')};var logger=require(_0x47a5('0x5'))(_0x47a5('0x6'));var tag=schema({'tag':{'type':_0x47a5('0x7'),'required':!![],'message':_0x47a5('0x8')}});exports[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629,_0x59199c,_0x343372){return function(_0x30e405){try{var _0x506eda={'tag':_0x3d5629[0x0]};var _0x194fb0=tag['validate'](_0x506eda,{'typecast':!![]});if(_0x194fb0['length']){logger['error'](_0x47a5('0xa'),_0x545a97,_[_0x47a5('0xb')](_0x194fb0,'message')[_0x47a5('0xc')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x545a97);_0x30e405[_0x47a5('0xd')]();}else{var _0x69e4d4={'ids':[_0x3d5629[0x0]]};if(rpc[_0x343372[_0x47a5('0xe')]+_0x47a5('0xf')]){rpc[_0x343372[_0x47a5('0xe')]+_0x47a5('0xf')][_0x47a5('0x10')](_0x343372['interaction']['id'],_0x69e4d4)[_0x47a5('0x11')](function(_0x221b54){logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x545a97,_0x3d5629[0x1],_0x343372[_0x47a5('0xe')],_0x343372[_0x47a5('0x14')]['id']);})[_0x47a5('0x15')](function(_0x190faa){logger['error'](_0x47a5('0xa'),_0x545a97,JSON[_0x47a5('0x16')](_0x190faa));logger[_0x47a5('0x12')](_0x47a5('0x17'),_0x545a97);})[_0x47a5('0x18')](function(){_0x30e405['next']();});}}}catch(_0x549de3){logger[_0x47a5('0x19')]('[%s][TAG]\x20%s',_0x545a97,_['isObject'](_0x549de3)?JSON[_0x47a5('0x16')](_0x549de3):_0x549de3);logger[_0x47a5('0x12')](_0x47a5('0x17'),_0x545a97);_0x30e405[_0x47a5('0xd')]();}};}; \ 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 afe0deb..f66bf5f 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 _0x3fec=['interaction','list','mustache','merge','message'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x3fec,0x1ba));var _0xc3fe=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3fec[_0x14add3];return _0x4a174f;};'use strict';var Mustache=require(_0xc3fe('0x0'));var _=require('lodash');module['exports']={'getMustacheRender':function(_0x3096c1,_0x1cd663){return Mustache['render'](_0x3096c1,_[_0xc3fe('0x1')](_0x1cd663['body'],{'contact':_0x1cd663['contact'],'message':_0x1cd663[_0xc3fe('0x2')],'account':_0x1cd663['account'],'interaction':_0x1cd663[_0xc3fe('0x3')],'list':_0x1cd663[_0xc3fe('0x4')]}))||'';}}; \ No newline at end of file +var _0xc43c=['body','contact','account','interaction','list','mustache','lodash','exports','render'];(function(_0x53ff3b,_0x58f396){var _0x4d7ac2=function(_0x13e433){while(--_0x13e433){_0x53ff3b['push'](_0x53ff3b['shift']());}};_0x4d7ac2(++_0x58f396);}(_0xc43c,0x152));var _0xcc43=function(_0x5a896d,_0x1bbe3e){_0x5a896d=_0x5a896d-0x0;var _0x2e0112=_0xc43c[_0x5a896d];return _0x2e0112;};'use strict';var Mustache=require(_0xcc43('0x0'));var _=require(_0xcc43('0x1'));module[_0xcc43('0x2')]={'getMustacheRender':function(_0x3d90f5,_0x14352d){return Mustache[_0xcc43('0x3')](_0x3d90f5,_['merge'](_0x14352d[_0xcc43('0x4')],{'contact':_0x14352d[_0xcc43('0x5')],'message':_0x14352d['message'],'account':_0x14352d[_0xcc43('0x6')],'interaction':_0x14352d[_0xcc43('0x7')],'list':_0x14352d[_0xcc43('0x8')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 148edc0..d2155f7 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 _0xa87a=['server','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','bluebird','uuid','../../../config/environment','../../../config/logger','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','isNil','IntervalId','map','Intervals','interval','listen','rules','channel','message','interaction','applications','isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','split','push','slice','dialogflow','appdata','amazonlex','tag','%s:%s:%s','./interval','condition','intervals','priority','info','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','stringify','emit','end','stack','routing\x20is\x20empty','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busyQueue','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','available','smsQueues','faxQueues','values','mailQueuesWaitingInteractions','faxQueuesWaitingInteractions'];(function(_0x1f7584,_0x114b68){var _0x501b34=function(_0x1e3bbd){while(--_0x1e3bbd){_0x1f7584['push'](_0x1f7584['shift']());}};_0x501b34(++_0x114b68);}(_0xa87a,0x104));var _0xaa87=function(_0x2a56ad,_0x2b94bf){_0x2a56ad=_0x2a56ad-0x0;var _0x425175=_0xa87a[_0x2a56ad];return _0x425175;};'use strict';var _=require(_0xaa87('0x0'));var util=require(_0xaa87('0x1'));var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xaa87('0x2'));var uuid=require(_0xaa87('0x3'));var config=require(_0xaa87('0x4'));var logger=require(_0xaa87('0x5'))('routing');var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport')};var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xaa87('0x6')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0xaa87('0x7')),'faxQueueReport':require(_0xaa87('0x8'))};var RuleEngine=require(_0xaa87('0x9'));function getId(_0x4bff7a,_0x12ef84,_0x625ec1){return util[_0xaa87('0xa')]('%s.%s.%s',_0x4bff7a,_0x12ef84||0x0,_0x625ec1||0x0);}function getIntervals(_0x50877a,_0x178286){var _0x5a370e=[];if(!_[_0xaa87('0xb')](_0x178286['IntervalId'])&&!_[_0xaa87('0xb')](_0x50877a[_0x178286[_0xaa87('0xc')]])&&!_['isNil'](_0x50877a[_0x178286['IntervalId']]['Intervals'])){_0x5a370e=_[_0xaa87('0xd')](_0x50877a[_0x178286[_0xaa87('0xc')]][_0xaa87('0xe')],'interval');}else if(!_['isNil'](_0x178286[_0xaa87('0xf')])){_0x5a370e=[_0x178286['interval']];}return _0x5a370e;}exports[_0xaa87('0x10')]=function(_0x8db576){_0x8db576[_0xaa87('0x11')]={};return new BPromise(function(_0x3ec220,_0x41ffdd){var _0x1fe736={'Start':function(_0x1956b3){var _0x313384=this;return new Promise(function(_0x377bb1,_0x27e99f){if(_0x1956b3){try{var _0x399267=[];var _0x153665=getId(_0x1956b3[_0xaa87('0x12')],_0x1956b3[_0xaa87('0x13')]?_0x1956b3[_0xaa87('0x13')]['id']:0x0,_0x1956b3[_0xaa87('0x14')]?_0x1956b3['interaction']['id']:0x0);if(_0x1956b3[_0xaa87('0x15')]&&_[_0xaa87('0x16')](_0x1956b3[_0xaa87('0x15')])&&_0x1956b3['applications'][_0xaa87('0x17')]){for(var _0x2cf7a2=0x0;_0x2cf7a2<_0x1956b3[_0xaa87('0x15')][_0xaa87('0x17')];_0x2cf7a2+=0x1){var _0x5c7ed4=_0x1956b3[_0xaa87('0x15')][_0x2cf7a2];if(fs[_0xaa87('0x18')](path[_0xaa87('0x19')](__dirname,'applications',_0x5c7ed4[_0xaa87('0x1a')]+_0xaa87('0x1b')))){var _0x1e24e0=[];switch(_0x5c7ed4[_0xaa87('0x1a')][_0xaa87('0x1c')]()){case _0xaa87('0x1d'):var _0x17e68e=_0x5c7ed4['appdata'][_0xaa87('0x1e')](',');_0x1e24e0[_0xaa87('0x1f')](_0x17e68e[0x0]);_0x1e24e0[_0xaa87('0x1f')](_0x17e68e[_0xaa87('0x20')](0x1,_0x17e68e[_0xaa87('0x17')])[_0xaa87('0x19')](','));break;case _0xaa87('0x21'):var _0x17e68e=_0x5c7ed4[_0xaa87('0x22')]['split'](',');_0x1e24e0[_0xaa87('0x1f')](_0x17e68e[0x0]);_0x1e24e0[_0xaa87('0x1f')](_0x17e68e[0x1]);_0x1e24e0[_0xaa87('0x1f')](_0x17e68e[_0xaa87('0x20')](0x2,_0x17e68e['length'])[_0xaa87('0x19')](','));break;case _0xaa87('0x23'):var _0x17e68e=_0x5c7ed4[_0xaa87('0x22')][_0xaa87('0x1e')](',');_0x1e24e0[_0xaa87('0x1f')](_0x17e68e[0x0]);_0x1e24e0['push'](_0x17e68e[0x1]);_0x1e24e0[_0xaa87('0x1f')](_0x17e68e[0x2]);_0x1e24e0[_0xaa87('0x1f')](_0x17e68e[0x3]);_0x1e24e0[_0xaa87('0x1f')](_0x17e68e['slice'](0x4,_0x17e68e[_0xaa87('0x17')])[_0xaa87('0x19')](','));break;case _0xaa87('0x13'):_0x1e24e0[_0xaa87('0x1f')](_0x5c7ed4[_0xaa87('0x22')]);break;case _0xaa87('0x24'):_0x1e24e0[_0xaa87('0x1f')](_0x5c7ed4['TagId']);_0x1e24e0[_0xaa87('0x1f')](_0x5c7ed4['appdata']);break;default:_0x1e24e0=_['isNil'](_0x5c7ed4[_0xaa87('0x22')])?[]:_0x5c7ed4['appdata'][_0xaa87('0x1e')](',');}var _0x3a1894={'id':util[_0xaa87('0xa')](_0xaa87('0x25'),_0x153665,_0x5c7ed4['id'],_0x5c7ed4[_0xaa87('0x1a')]),'condition':require(_0xaa87('0x26'))[_0xaa87('0x27')](_0x153665,getIntervals(_0x8db576[_0xaa87('0x28')],_0x5c7ed4),_0x8db576),'consequence':require('./applications/'+_0x5c7ed4[_0xaa87('0x1a')])['consequence'](_0x153665,_0x1e24e0,_0x8db576,_0x1956b3),'p':_0x5c7ed4[_0xaa87('0x29')]||0x0};logger[_0xaa87('0x2a')]('Push\x20new\x20rule',_0x3a1894['id'],_0xaa87('0x2b'),getIntervals(_0x8db576[_0xaa87('0x28')],_0x5c7ed4)[_0xaa87('0x19')](_0xaa87('0x2c')));_0x399267[_0xaa87('0x1f')](_0x3a1894);}else{logger[_0xaa87('0x2d')](_0xaa87('0x2e'),path[_0xaa87('0x19')](__dirname,_0xaa87('0x15'),_0x5c7ed4[_0xaa87('0x1a')]+_0xaa87('0x1b')));}}_0x8db576[_0xaa87('0x11')][_0x153665]=new RuleEngine(_0x399267);_0x8db576['rules'][_0x153665]['execute'](_0x1956b3,function(_0x398f4c){logger[_0xaa87('0x2a')](_0xaa87('0x2f'),JSON[_0xaa87('0x30')](_0x398f4c['matchPath']));if(_0x8db576[_0xaa87('0x11')][_0x153665]){_0x8db576[_0xaa87('0x11')][_0x153665][_0xaa87('0x31')](_0xaa87('0x32'));}});return _0x377bb1({'code':0xc8,'message':_0x1956b3});}else{logger['info']('No\x20applications\x20to\x20execute');return _0x377bb1({'code':0xc8,'message':_0x1956b3});}}catch(_0x29fe03){logger[_0xaa87('0x2d')](_0x29fe03[_0xaa87('0x33')]);return _0x27e99f(_0x313384[_0xaa87('0x2d')](0x1f4,_0x29fe03));}}return _0x27e99f(_0xaa87('0x34'));});},'AcceptMessage':function(_0x213daf){var _0x24f84c=this;return new Promise(function(_0x1cb590,_0x1a6c48){if(_0x213daf[_0xaa87('0x13')]&&_0x213daf['message']['id']){try{var _0x550a88=getId(_0x213daf['channel'],_0x213daf[_0xaa87('0x13')]?_0x213daf[_0xaa87('0x13')]['id']:0x0,_0x213daf['interaction']?_0x213daf['interaction']['id']:0x0);if(_0x8db576['rules'][_0x550a88]){_0x8db576[_0xaa87('0x11')][_0x550a88][_0xaa87('0x31')](_0xaa87('0x32'));if(rpc[_0x213daf['channel']+_0xaa87('0x35')]){rpc[_0x213daf[_0xaa87('0x12')]+_0xaa87('0x35')][_0xaa87('0x36')](_0x550a88,{'UserId':_0x213daf[_0xaa87('0x13')][_0xaa87('0x37')]})[_0xaa87('0x38')](function(_0x2d17ae){logger[_0xaa87('0x2d')](_0xaa87('0x39'));});}}return _0x1cb590({'code':0xc8,'message':_0x213daf});}catch(_0x524d06){logger[_0xaa87('0x2d')](_0x524d06[_0xaa87('0x33')]);return _0x1a6c48(_0x24f84c[_0xaa87('0x2d')](0x1f4,_0x524d06));}}logger[_0xaa87('0x2d')](_0xaa87('0x3a'));return _0x1a6c48(_0x24f84c[_0xaa87('0x2d')](0x1f4,_0xaa87('0x3a')));});},'RejectMessage':function(_0x32c576){var _0xca1b5b=this;return new Promise(function(_0x1e32b8,_0x1bc80e){if(_0x32c576[_0xaa87('0x3b')]&&_0x32c576[_0xaa87('0x3b')]['id']){try{if(_0x8db576[_0xaa87('0x3c')][_0x32c576[_0xaa87('0x3b')]['id']]){_0x8db576['agents'][_0x32c576[_0xaa87('0x3b')]['id']]['busy']=![];_0x8db576['agents'][_0x32c576[_0xaa87('0x3b')]['id']][_0xaa87('0x3d')]=undefined;}return _0x1e32b8({'code':0xc8,'message':_0x32c576});}catch(_0x344980){logger[_0xaa87('0x2d')](_0x344980[_0xaa87('0x33')]);return _0x1bc80e(_0xca1b5b[_0xaa87('0x2d')](0x1f4,_0x344980));}}logger[_0xaa87('0x2d')]('message\x20is\x20empty');return _0x1bc80e(_0xca1b5b['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x47e5cd){var _0x3ec0cf=this;return new Promise(function(_0x35aa4e,_0x189ede){if(_0x47e5cd[_0xaa87('0x12')]&&_0x47e5cd['interaction']&&_0x47e5cd[_0xaa87('0x14')]['id']){try{var _0x4e501f=getId(_0x47e5cd['channel'],_0x47e5cd[_0xaa87('0x13')]?_0x47e5cd[_0xaa87('0x13')]['id']:0x0,_0x47e5cd[_0xaa87('0x14')]?_0x47e5cd[_0xaa87('0x14')]['id']:0x0);if(_0x8db576['rules'][_0x4e501f]){_0x8db576[_0xaa87('0x11')][_0x4e501f][_0xaa87('0x31')](_0xaa87('0x32'));}return _0x35aa4e({'code':0xc8,'message':_0x47e5cd});}catch(_0x106d85){logger[_0xaa87('0x2d')](_0x106d85[_0xaa87('0x33')]);return _0x189ede(_0x3ec0cf[_0xaa87('0x2d')](0x1f4,_0x106d85));}}logger[_0xaa87('0x2d')]('message\x20is\x20empty');return _0x189ede(_0x3ec0cf[_0xaa87('0x2d')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x456ae3){var _0x122898=this;return new Promise(function(_0x40ddbe,_0x362d1b){if(_0x8db576[_0xaa87('0x3c')]['hasOwnProperty'](_0x456ae3['id'])){for(var _0x2f9d16 in _0x456ae3[_0xaa87('0x3e')]){if(_0x456ae3['capacity'][_0xaa87('0x3f')](_0x2f9d16)){if(_0x8db576['agents'][_0x456ae3['id']][_0xaa87('0x3f')](_0x2f9d16+_0xaa87('0x40'))){_0x8db576[_0xaa87('0x3c')][_0x456ae3['id']][_0x2f9d16+_0xaa87('0x40')]=parseInt(_0x456ae3[_0xaa87('0x3e')][_0x2f9d16],0xa);}}}_0x8db576['agents'][_0x456ae3['id']][_0xaa87('0x41')]();return _0x40ddbe({'code':0xc8,'message':_0x8db576[_0xaa87('0x3c')][_0x456ae3['id']]});}else{return _0x362d1b(_0x122898[_0xaa87('0x2d')](0x1f4,_0xaa87('0x42')));}});},'Agents':function(_0x1ab0f2){return new Promise(function(_0x88a6dd,_0xab5731){var _0x12e0ef=_['values'](_0x8db576['agents']);_0x88a6dd({'count':_0x12e0ef[_0xaa87('0x17')],'rows':_0x12e0ef});});},'ChatQueues':function(_0x3bac9b){return new Promise(function(_0x54f269,_0x39c824){var _0x58ab37=[];for(var _0x143989 in _0x8db576[_0xaa87('0x43')]){if(_0x8db576[_0xaa87('0x43')]['hasOwnProperty'](_0x143989)){var _0x260611=_0x8db576[_0xaa87('0x43')][_0x143989];var _0x4da38c={'id':_0x260611['id'],'available':_0x260611['available'],'loggedIn':_0x260611[_0xaa87('0x44')],'name':_0x260611[_0xaa87('0x45')],'paused':_0x260611[_0xaa87('0x46')],'waiting':_0x260611[_0xaa87('0x47')]};_0x58ab37['push'](_0x4da38c);}}_0x54f269({'count':_0x58ab37[_0xaa87('0x17')],'rows':_0x58ab37});});},'MailQueues':function(_0x5eae7a){return new Promise(function(_0x383d47,_0x1fbcf9){var _0x3cb8ae=[];for(var _0x5478a2 in _0x8db576[_0xaa87('0x48')]){if(_0x8db576['mailQueues']['hasOwnProperty'](_0x5478a2)){var _0x4feffa=_0x8db576['mailQueues'][_0x5478a2];var _0x4be178={'id':_0x4feffa['id'],'available':_0x4feffa['available'],'loggedIn':_0x4feffa[_0xaa87('0x44')],'name':_0x4feffa[_0xaa87('0x45')],'paused':_0x4feffa[_0xaa87('0x46')],'waiting':_0x4feffa[_0xaa87('0x47')]};_0x3cb8ae[_0xaa87('0x1f')](_0x4be178);}}_0x383d47({'count':_0x3cb8ae[_0xaa87('0x17')],'rows':_0x3cb8ae});});},'OpenchannelQueues':function(_0x1d47ba){return new Promise(function(_0x26aa5f,_0x12028e){var _0x124368=[];for(var _0x56dd3d in _0x8db576[_0xaa87('0x49')]){if(_0x8db576[_0xaa87('0x49')]['hasOwnProperty'](_0x56dd3d)){var _0x3251b1=_0x8db576['openchannelQueues'][_0x56dd3d];var _0x339b9f={'id':_0x3251b1['id'],'available':_0x3251b1[_0xaa87('0x4a')],'loggedIn':_0x3251b1[_0xaa87('0x44')],'name':_0x3251b1[_0xaa87('0x45')],'paused':_0x3251b1[_0xaa87('0x46')],'waiting':_0x3251b1['waiting']};_0x124368[_0xaa87('0x1f')](_0x339b9f);}}_0x26aa5f({'count':_0x124368[_0xaa87('0x17')],'rows':_0x124368});});},'SmsQueues':function(_0x40889c){return new Promise(function(_0x2dc682,_0x256f3e){var _0x59cf4c=[];for(var _0x23046d in _0x8db576['smsQueues']){if(_0x8db576[_0xaa87('0x4b')][_0xaa87('0x3f')](_0x23046d)){var _0x32637b=_0x8db576[_0xaa87('0x4b')][_0x23046d];var _0x1a6e3e={'id':_0x32637b['id'],'available':_0x32637b[_0xaa87('0x4a')],'loggedIn':_0x32637b[_0xaa87('0x44')],'name':_0x32637b[_0xaa87('0x45')],'paused':_0x32637b[_0xaa87('0x46')],'waiting':_0x32637b[_0xaa87('0x47')]};_0x59cf4c[_0xaa87('0x1f')](_0x1a6e3e);}}_0x2dc682({'count':_0x59cf4c[_0xaa87('0x17')],'rows':_0x59cf4c});});},'FaxQueues':function(_0x452db6){return new Promise(function(_0x2e21f0,_0x4c404d){var _0x30dd1f=[];for(var _0x5b2fc2 in _0x8db576[_0xaa87('0x4c')]){if(_0x8db576[_0xaa87('0x4c')][_0xaa87('0x3f')](_0x5b2fc2)){var _0x1f47fa=_0x8db576[_0xaa87('0x4c')][_0x5b2fc2];var _0x3732cb={'id':_0x1f47fa['id'],'available':_0x1f47fa[_0xaa87('0x4a')],'loggedIn':_0x1f47fa[_0xaa87('0x44')],'name':_0x1f47fa[_0xaa87('0x45')],'paused':_0x1f47fa[_0xaa87('0x46')],'waiting':_0x1f47fa[_0xaa87('0x47')]};_0x30dd1f['push'](_0x3732cb);}}_0x2e21f0({'count':_0x30dd1f['length'],'rows':_0x30dd1f});});},'ChatQueuesWaitingInteractions':function(_0xbc12ac){return new Promise(function(_0x207cd8,_0x560444){var _0x2189ed=_[_0xaa87('0x4d')](_0x8db576['chatQueuesWaitingInteractions']);_0x207cd8({'count':_0x2189ed[_0xaa87('0x17')],'rows':_0x2189ed});});},'MailQueuesWaitingInteractions':function(_0x3d8c9c){return new Promise(function(_0x3431bf,_0x17f8d0){var _0x5ee38d=_[_0xaa87('0x4d')](_0x8db576[_0xaa87('0x4e')]);_0x3431bf({'count':_0x5ee38d[_0xaa87('0x17')],'rows':_0x5ee38d});});},'OpenchannelQueuesWaitingInteractions':function(_0x84f5e8){return new Promise(function(_0x3df75c,_0xbd9e13){var _0x518f8e=_[_0xaa87('0x4d')](_0x8db576['openchannelQueuesWaitingInteractions']);_0x3df75c({'count':_0x518f8e[_0xaa87('0x17')],'rows':_0x518f8e});});},'SmsQueuesWaitingInteractions':function(_0x395549){return new Promise(function(_0x4f6a4d,_0x1cfe6a){var _0x11ed58=_['values'](_0x8db576['smsQueuesWaitingInteractions']);_0x4f6a4d({'count':_0x11ed58[_0xaa87('0x17')],'rows':_0x11ed58});});},'FaxQueuesWaitingInteractions':function(_0x3fc013){return new Promise(function(_0x547c1a,_0x215d6b){var _0x2eca84=_[_0xaa87('0x4d')](_0x8db576[_0xaa87('0x4f')]);_0x547c1a({'count':_0x2eca84[_0xaa87('0x17')],'rows':_0x2eca84});});}};var _0x253187=jayson[_0xaa87('0x50')](_0x1fe736)['http']();_0x253187['on'](_0xaa87('0x2d'),function(_0x591a39){logger['error'](JSON['stringify'](_0x591a39));return _0x41ffdd(_0x591a39);});_0x253187[_0xaa87('0x10')](0x232c,_0xaa87('0x51'),function(){console[_0xaa87('0x52')](_0xaa87('0x53'),0x232c);return _0x3ec220(_0xaa87('0x54')+0x232c);});});}; \ No newline at end of file +var _0x2620=['isNil','IntervalId','map','Intervals','interval','listen','rules','channel','message','interaction','applications','isArray','length','existsSync','join','.js','appdata','split','push','slice','amazonlex','tag','TagId','app','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','execute','matchPath','emit','end','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','QueueReport','update','UserId','catch','message\x20is\x20empty','agent','agents','busy','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','chatQueues','available','loggedIn','paused','mailQueues','name','waiting','openchannelQueues','smsQueues','faxQueues','values','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','server','127.0.0.1','lodash','util','path','jayson/promise','uuid','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','format','%s.%s.%s'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x2620,0xee));var _0x0262=function(_0x1a37e3,_0x5db8f6){_0x1a37e3=_0x1a37e3-0x0;var _0x4db78a=_0x2620[_0x1a37e3];return _0x4db78a;};'use strict';var _=require(_0x0262('0x0'));var util=require(_0x0262('0x1'));var path=require(_0x0262('0x2'));var fs=require('fs');var jayson=require(_0x0262('0x3'));var BPromise=require('bluebird');var uuid=require(_0x0262('0x4'));var config=require(_0x0262('0x5'));var logger=require(_0x0262('0x6'))('routing');var rpc={'openchannelQueueReport':require(_0x0262('0x7'))};var rpc={'openchannelQueueReport':require(_0x0262('0x7')),'mailQueueReport':require(_0x0262('0x8')),'chatQueueReport':require(_0x0262('0x9')),'smsQueueReport':require(_0x0262('0xa')),'faxQueueReport':require(_0x0262('0xb'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x9d94c9,_0x5d00ce,_0x3bc78e){return util[_0x0262('0xc')](_0x0262('0xd'),_0x9d94c9,_0x5d00ce||0x0,_0x3bc78e||0x0);}function getIntervals(_0x2c015c,_0x2ba26b){var _0xda0fde=[];if(!_[_0x0262('0xe')](_0x2ba26b[_0x0262('0xf')])&&!_[_0x0262('0xe')](_0x2c015c[_0x2ba26b[_0x0262('0xf')]])&&!_[_0x0262('0xe')](_0x2c015c[_0x2ba26b[_0x0262('0xf')]]['Intervals'])){_0xda0fde=_[_0x0262('0x10')](_0x2c015c[_0x2ba26b[_0x0262('0xf')]][_0x0262('0x11')],_0x0262('0x12'));}else if(!_[_0x0262('0xe')](_0x2ba26b[_0x0262('0x12')])){_0xda0fde=[_0x2ba26b['interval']];}return _0xda0fde;}exports[_0x0262('0x13')]=function(_0x44469e){_0x44469e[_0x0262('0x14')]={};return new BPromise(function(_0x3fff83,_0x102e25){var _0x223061={'Start':function(_0x5190f2){var _0x303ed9=this;return new Promise(function(_0x27e37b,_0x2cb06e){if(_0x5190f2){try{var _0x392b74=[];var _0x1b4319=getId(_0x5190f2[_0x0262('0x15')],_0x5190f2[_0x0262('0x16')]?_0x5190f2['message']['id']:0x0,_0x5190f2['interaction']?_0x5190f2[_0x0262('0x17')]['id']:0x0);if(_0x5190f2[_0x0262('0x18')]&&_[_0x0262('0x19')](_0x5190f2[_0x0262('0x18')])&&_0x5190f2[_0x0262('0x18')]['length']){for(var _0x307368=0x0;_0x307368<_0x5190f2[_0x0262('0x18')][_0x0262('0x1a')];_0x307368+=0x1){var _0x2e2460=_0x5190f2[_0x0262('0x18')][_0x307368];if(fs[_0x0262('0x1b')](path[_0x0262('0x1c')](__dirname,'applications',_0x2e2460['app']+_0x0262('0x1d')))){var _0x1715b9=[];switch(_0x2e2460['app']['toLowerCase']()){case'autoreply':var _0x35f6b7=_0x2e2460[_0x0262('0x1e')][_0x0262('0x1f')](',');_0x1715b9[_0x0262('0x20')](_0x35f6b7[0x0]);_0x1715b9[_0x0262('0x20')](_0x35f6b7[_0x0262('0x21')](0x1,_0x35f6b7[_0x0262('0x1a')])[_0x0262('0x1c')](','));break;case'dialogflow':var _0x35f6b7=_0x2e2460[_0x0262('0x1e')]['split'](',');_0x1715b9[_0x0262('0x20')](_0x35f6b7[0x0]);_0x1715b9[_0x0262('0x20')](_0x35f6b7[0x1]);_0x1715b9['push'](_0x35f6b7[_0x0262('0x21')](0x2,_0x35f6b7['length'])[_0x0262('0x1c')](','));break;case _0x0262('0x22'):var _0x35f6b7=_0x2e2460['appdata'][_0x0262('0x1f')](',');_0x1715b9[_0x0262('0x20')](_0x35f6b7[0x0]);_0x1715b9[_0x0262('0x20')](_0x35f6b7[0x1]);_0x1715b9[_0x0262('0x20')](_0x35f6b7[0x2]);_0x1715b9[_0x0262('0x20')](_0x35f6b7[0x3]);_0x1715b9[_0x0262('0x20')](_0x35f6b7['slice'](0x4,_0x35f6b7[_0x0262('0x1a')])[_0x0262('0x1c')](','));break;case _0x0262('0x16'):_0x1715b9[_0x0262('0x20')](_0x2e2460[_0x0262('0x1e')]);break;case _0x0262('0x23'):_0x1715b9[_0x0262('0x20')](_0x2e2460[_0x0262('0x24')]);_0x1715b9[_0x0262('0x20')](_0x2e2460[_0x0262('0x1e')]);break;default:_0x1715b9=_[_0x0262('0xe')](_0x2e2460[_0x0262('0x1e')])?[]:_0x2e2460['appdata']['split'](',');}var _0x274b31={'id':util['format']('%s:%s:%s',_0x1b4319,_0x2e2460['id'],_0x2e2460[_0x0262('0x25')]),'condition':require(_0x0262('0x26'))[_0x0262('0x27')](_0x1b4319,getIntervals(_0x44469e[_0x0262('0x28')],_0x2e2460),_0x44469e),'consequence':require(_0x0262('0x29')+_0x2e2460[_0x0262('0x25')])[_0x0262('0x2a')](_0x1b4319,_0x1715b9,_0x44469e,_0x5190f2),'p':_0x2e2460[_0x0262('0x2b')]||0x0};logger[_0x0262('0x2c')](_0x0262('0x2d'),_0x274b31['id'],_0x0262('0x2e'),getIntervals(_0x44469e['intervals'],_0x2e2460)[_0x0262('0x1c')](_0x0262('0x2f')));_0x392b74[_0x0262('0x20')](_0x274b31);}else{logger[_0x0262('0x30')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x0262('0x1c')](__dirname,'applications',_0x2e2460['app']+_0x0262('0x1d')));}}_0x44469e[_0x0262('0x14')][_0x1b4319]=new RuleEngine(_0x392b74);_0x44469e[_0x0262('0x14')][_0x1b4319][_0x0262('0x31')](_0x5190f2,function(_0x10a125){logger[_0x0262('0x2c')]('Applications\x20executed',JSON['stringify'](_0x10a125[_0x0262('0x32')]));if(_0x44469e[_0x0262('0x14')][_0x1b4319]){_0x44469e[_0x0262('0x14')][_0x1b4319][_0x0262('0x33')](_0x0262('0x34'));}});return _0x27e37b({'code':0xc8,'message':_0x5190f2});}else{logger[_0x0262('0x2c')](_0x0262('0x35'));return _0x27e37b({'code':0xc8,'message':_0x5190f2});}}catch(_0x6fcad5){logger[_0x0262('0x30')](_0x6fcad5[_0x0262('0x36')]);return _0x2cb06e(_0x303ed9[_0x0262('0x30')](0x1f4,_0x6fcad5));}}return _0x2cb06e(_0x0262('0x37'));});},'AcceptMessage':function(_0x5abaf7){var _0x3c9895=this;return new Promise(function(_0x580cec,_0x1692d0){if(_0x5abaf7[_0x0262('0x16')]&&_0x5abaf7[_0x0262('0x16')]['id']){try{var _0xa0ea8a=getId(_0x5abaf7[_0x0262('0x15')],_0x5abaf7[_0x0262('0x16')]?_0x5abaf7[_0x0262('0x16')]['id']:0x0,_0x5abaf7[_0x0262('0x17')]?_0x5abaf7[_0x0262('0x17')]['id']:0x0);if(_0x44469e['rules'][_0xa0ea8a]){_0x44469e[_0x0262('0x14')][_0xa0ea8a][_0x0262('0x33')]('end');if(rpc[_0x5abaf7['channel']+_0x0262('0x38')]){rpc[_0x5abaf7[_0x0262('0x15')]+_0x0262('0x38')][_0x0262('0x39')](_0xa0ea8a,{'UserId':_0x5abaf7[_0x0262('0x16')][_0x0262('0x3a')]})[_0x0262('0x3b')](function(_0xb5f51e){logger[_0x0262('0x30')]('error\x20update\x20queue\x20report');});}}return _0x580cec({'code':0xc8,'message':_0x5abaf7});}catch(_0x2da21b){logger['error'](_0x2da21b[_0x0262('0x36')]);return _0x1692d0(_0x3c9895['error'](0x1f4,_0x2da21b));}}logger['error'](_0x0262('0x3c'));return _0x1692d0(_0x3c9895[_0x0262('0x30')](0x1f4,_0x0262('0x3c')));});},'RejectMessage':function(_0xd831d8){var _0x300753=this;return new Promise(function(_0x29afa9,_0x1bee86){if(_0xd831d8[_0x0262('0x3d')]&&_0xd831d8[_0x0262('0x3d')]['id']){try{if(_0x44469e[_0x0262('0x3e')][_0xd831d8['agent']['id']]){_0x44469e['agents'][_0xd831d8['agent']['id']][_0x0262('0x3f')]=![];_0x44469e[_0x0262('0x3e')][_0xd831d8['agent']['id']]['busyQueue']=undefined;}return _0x29afa9({'code':0xc8,'message':_0xd831d8});}catch(_0x3d6412){logger[_0x0262('0x30')](_0x3d6412[_0x0262('0x36')]);return _0x1bee86(_0x300753[_0x0262('0x30')](0x1f4,_0x3d6412));}}logger[_0x0262('0x30')](_0x0262('0x3c'));return _0x1bee86(_0x300753[_0x0262('0x30')](0x1f4,_0x0262('0x3c')));});},'AbandonInteraction':function(_0x37173d){var _0x1d9551=this;return new Promise(function(_0x46566e,_0x3027ec){if(_0x37173d[_0x0262('0x15')]&&_0x37173d['interaction']&&_0x37173d[_0x0262('0x17')]['id']){try{var _0x2c75db=getId(_0x37173d[_0x0262('0x15')],_0x37173d[_0x0262('0x16')]?_0x37173d[_0x0262('0x16')]['id']:0x0,_0x37173d[_0x0262('0x17')]?_0x37173d[_0x0262('0x17')]['id']:0x0);if(_0x44469e[_0x0262('0x14')][_0x2c75db]){_0x44469e['rules'][_0x2c75db][_0x0262('0x33')]('end');}return _0x46566e({'code':0xc8,'message':_0x37173d});}catch(_0x39a4cf){logger[_0x0262('0x30')](_0x39a4cf['stack']);return _0x3027ec(_0x1d9551[_0x0262('0x30')](0x1f4,_0x39a4cf));}}logger[_0x0262('0x30')](_0x0262('0x3c'));return _0x3027ec(_0x1d9551[_0x0262('0x30')](0x1f4,_0x0262('0x3c')));});},'AgentCapacity':function(_0x27f8a7){var _0x5398c4=this;return new Promise(function(_0x214385,_0x3a65ff){if(_0x44469e[_0x0262('0x3e')][_0x0262('0x40')](_0x27f8a7['id'])){for(var _0x455c42 in _0x27f8a7['capacity']){if(_0x27f8a7[_0x0262('0x41')][_0x0262('0x40')](_0x455c42)){if(_0x44469e[_0x0262('0x3e')][_0x27f8a7['id']][_0x0262('0x40')](_0x455c42+_0x0262('0x42'))){_0x44469e[_0x0262('0x3e')][_0x27f8a7['id']][_0x455c42+_0x0262('0x42')]=parseInt(_0x27f8a7[_0x0262('0x41')][_0x455c42],0xa);}}}_0x44469e[_0x0262('0x3e')][_0x27f8a7['id']]['updateRealtime']();return _0x214385({'code':0xc8,'message':_0x44469e[_0x0262('0x3e')][_0x27f8a7['id']]});}else{return _0x3a65ff(_0x5398c4[_0x0262('0x30')](0x1f4,_0x0262('0x43')));}});},'Agents':function(_0x11b027){return new Promise(function(_0x4856f6,_0x126ab2){var _0x47bc7b=_['values'](_0x44469e[_0x0262('0x3e')]);_0x4856f6({'count':_0x47bc7b[_0x0262('0x1a')],'rows':_0x47bc7b});});},'ChatQueues':function(_0x37af62){return new Promise(function(_0xe587a4,_0x8cfeaa){var _0x4c8fd2=[];for(var _0x405957 in _0x44469e['chatQueues']){if(_0x44469e['chatQueues'][_0x0262('0x40')](_0x405957)){var _0x57ef9d=_0x44469e[_0x0262('0x44')][_0x405957];var _0x23ef65={'id':_0x57ef9d['id'],'available':_0x57ef9d[_0x0262('0x45')],'loggedIn':_0x57ef9d[_0x0262('0x46')],'name':_0x57ef9d['name'],'paused':_0x57ef9d[_0x0262('0x47')],'waiting':_0x57ef9d['waiting']};_0x4c8fd2[_0x0262('0x20')](_0x23ef65);}}_0xe587a4({'count':_0x4c8fd2[_0x0262('0x1a')],'rows':_0x4c8fd2});});},'MailQueues':function(_0x5c4d5a){return new Promise(function(_0x3d5b76,_0x1b2f06){var _0x5d50a9=[];for(var _0x967374 in _0x44469e['mailQueues']){if(_0x44469e[_0x0262('0x48')][_0x0262('0x40')](_0x967374)){var _0x4feaa7=_0x44469e[_0x0262('0x48')][_0x967374];var _0x3e8b3d={'id':_0x4feaa7['id'],'available':_0x4feaa7[_0x0262('0x45')],'loggedIn':_0x4feaa7['loggedIn'],'name':_0x4feaa7[_0x0262('0x49')],'paused':_0x4feaa7[_0x0262('0x47')],'waiting':_0x4feaa7[_0x0262('0x4a')]};_0x5d50a9['push'](_0x3e8b3d);}}_0x3d5b76({'count':_0x5d50a9[_0x0262('0x1a')],'rows':_0x5d50a9});});},'OpenchannelQueues':function(_0x5d310f){return new Promise(function(_0x57b264,_0x399e8e){var _0x38ee60=[];for(var _0x1bbc39 in _0x44469e['openchannelQueues']){if(_0x44469e[_0x0262('0x4b')][_0x0262('0x40')](_0x1bbc39)){var _0x2b5cbb=_0x44469e['openchannelQueues'][_0x1bbc39];var _0x40b75c={'id':_0x2b5cbb['id'],'available':_0x2b5cbb['available'],'loggedIn':_0x2b5cbb[_0x0262('0x46')],'name':_0x2b5cbb[_0x0262('0x49')],'paused':_0x2b5cbb[_0x0262('0x47')],'waiting':_0x2b5cbb[_0x0262('0x4a')]};_0x38ee60[_0x0262('0x20')](_0x40b75c);}}_0x57b264({'count':_0x38ee60[_0x0262('0x1a')],'rows':_0x38ee60});});},'SmsQueues':function(_0x43e956){return new Promise(function(_0x50cd8d,_0x576dcd){var _0x5b79e6=[];for(var _0x210b0c in _0x44469e[_0x0262('0x4c')]){if(_0x44469e[_0x0262('0x4c')][_0x0262('0x40')](_0x210b0c)){var _0x591ea3=_0x44469e[_0x0262('0x4c')][_0x210b0c];var _0x26b059={'id':_0x591ea3['id'],'available':_0x591ea3[_0x0262('0x45')],'loggedIn':_0x591ea3[_0x0262('0x46')],'name':_0x591ea3[_0x0262('0x49')],'paused':_0x591ea3[_0x0262('0x47')],'waiting':_0x591ea3[_0x0262('0x4a')]};_0x5b79e6['push'](_0x26b059);}}_0x50cd8d({'count':_0x5b79e6[_0x0262('0x1a')],'rows':_0x5b79e6});});},'FaxQueues':function(_0x3015b5){return new Promise(function(_0x3f0dac,_0x1e9822){var _0x49795b=[];for(var _0x2efc4a in _0x44469e[_0x0262('0x4d')]){if(_0x44469e[_0x0262('0x4d')]['hasOwnProperty'](_0x2efc4a)){var _0x11eac7=_0x44469e['faxQueues'][_0x2efc4a];var _0x26081b={'id':_0x11eac7['id'],'available':_0x11eac7[_0x0262('0x45')],'loggedIn':_0x11eac7[_0x0262('0x46')],'name':_0x11eac7[_0x0262('0x49')],'paused':_0x11eac7['paused'],'waiting':_0x11eac7[_0x0262('0x4a')]};_0x49795b[_0x0262('0x20')](_0x26081b);}}_0x3f0dac({'count':_0x49795b['length'],'rows':_0x49795b});});},'ChatQueuesWaitingInteractions':function(_0xffa19a){return new Promise(function(_0x4aca17,_0x14e20a){var _0x53e08b=_[_0x0262('0x4e')](_0x44469e[_0x0262('0x4f')]);_0x4aca17({'count':_0x53e08b[_0x0262('0x1a')],'rows':_0x53e08b});});},'MailQueuesWaitingInteractions':function(_0x4c2478){return new Promise(function(_0x22ba1f,_0x49d3df){var _0x47503f=_[_0x0262('0x4e')](_0x44469e['mailQueuesWaitingInteractions']);_0x22ba1f({'count':_0x47503f[_0x0262('0x1a')],'rows':_0x47503f});});},'OpenchannelQueuesWaitingInteractions':function(_0x55bbbd){return new Promise(function(_0x42aa07,_0x497276){var _0x333196=_[_0x0262('0x4e')](_0x44469e[_0x0262('0x50')]);_0x42aa07({'count':_0x333196['length'],'rows':_0x333196});});},'SmsQueuesWaitingInteractions':function(_0xa231e7){return new Promise(function(_0x27a8cf,_0x24160e){var _0xfdb46f=_[_0x0262('0x4e')](_0x44469e[_0x0262('0x51')]);_0x27a8cf({'count':_0xfdb46f[_0x0262('0x1a')],'rows':_0xfdb46f});});},'FaxQueuesWaitingInteractions':function(_0x1cbddc){return new Promise(function(_0x138f02,_0x1b07e4){var _0x51b775=_['values'](_0x44469e['faxQueuesWaitingInteractions']);_0x138f02({'count':_0x51b775[_0x0262('0x1a')],'rows':_0x51b775});});}};var _0x4ca05e=jayson[_0x0262('0x52')](_0x223061)['http']();_0x4ca05e['on'](_0x0262('0x30'),function(_0x42ac0c){logger[_0x0262('0x30')](JSON['stringify'](_0x42ac0c));return _0x102e25(_0x42ac0c);});_0x4ca05e[_0x0262('0x13')](0x232c,_0x0262('0x53'),function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x3fff83('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 a65d5f1..31a317a 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 _0x1bce=['then','error','message','catch','rules','stop','length','push','Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','util','bluebird','jayson/promise','../../../config/logger','routing','client','http','request'];(function(_0x3ed8ae,_0x5cee12){var _0x109b37=function(_0x4bfda5){while(--_0x4bfda5){_0x3ed8ae['push'](_0x3ed8ae['shift']());}};_0x109b37(++_0x5cee12);}(_0x1bce,0x160));var _0xe1bc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1bce[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0xe1bc('0x0'));var BPromise=require(_0xe1bc('0x1'));var jayson=require(_0xe1bc('0x2'));var _=require('lodash');var logger=require(_0xe1bc('0x3'))(_0xe1bc('0x4'));var client=jayson[_0xe1bc('0x5')][_0xe1bc('0x6')]({'port':0x232a});function request(_0x20f3f3,_0x5a913f){return new BPromise(function(_0xb0f75b,_0x468724){return client[_0xe1bc('0x7')](_0x20f3f3,_0x5a913f)[_0xe1bc('0x8')](function(_0x4aa95c){if(_0x4aa95c['error']){return _0x468724(_0x4aa95c[_0xe1bc('0x9')][_0xe1bc('0xa')]);}else{return _0xb0f75b(_0x4aa95c['result']);}})[_0xe1bc('0xb')](function(_0x618ccc){return _0x468724(_0x618ccc);});});}exports['condition']=function(_0x3b38dc,_0x5e609e,_0x406fb5){return function(_0x44b8a5){if(_0x406fb5[_0xe1bc('0xc')]&&!_0x406fb5['rules'][_0x3b38dc]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x3b38dc);return _0x44b8a5[_0xe1bc('0xd')]();}var _0x192ffb=[];for(var _0x19017a=0x0;_0x19017a<_0x5e609e[_0xe1bc('0xe')];_0x19017a+=0x1){_0x192ffb[_0xe1bc('0xf')](request(_0xe1bc('0x10'),{'command':util[_0xe1bc('0x11')](_0xe1bc('0x12'),_0x5e609e[_0x19017a])})['then'](function(_0x36371d){return _0x36371d&&_0x36371d['message']&&_0x36371d['message'][_0xe1bc('0x13')](_0xe1bc('0x14'))>=0x0?!![]:![];})[_0xe1bc('0xb')](function(_0x3abf9b){logger['error'](_0xe1bc('0x15'),_0x3b38dc,_0x5e609e[_0x19017a]);}));}BPromise[_0xe1bc('0x16')](_0x192ffb)['then'](function(_0x22a4e0){var _0x2d97ce=_[_0xe1bc('0x17')](_0x22a4e0);logger[_0xe1bc('0x18')](_0xe1bc('0x19'),_0x3b38dc,_0x5e609e[_0xe1bc('0x1a')](_0xe1bc('0x1b')),_0x2d97ce);_0x44b8a5[_0xe1bc('0x1c')](_0x2d97ce);})[_0xe1bc('0xb')](function(_0x4dd8f6){console['log'](_0x4dd8f6);logger[_0xe1bc('0x9')]('[%s][INTERVAL]\x20%s\x20%s',_0x3b38dc,_0x5e609e['join'](_0xe1bc('0x1b')),_0x4dd8f6[_0xe1bc('0x1d')]);_0x44b8a5[_0xe1bc('0xd')]();});};}; \ No newline at end of file +var _0x53df=['bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','result','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','message','indexOf','[%s][INTERVAL]\x20%s','all','some','join','\x20|\x20','when','log','[%s][INTERVAL]\x20%s\x20%s','stack','util'];(function(_0xc2fc17,_0x2b78be){var _0x5b4fe0=function(_0x5f1e00){while(--_0x5f1e00){_0xc2fc17['push'](_0xc2fc17['shift']());}};_0x5b4fe0(++_0x2b78be);}(_0x53df,0x149));var _0xf53d=function(_0x264545,_0x214037){_0x264545=_0x264545-0x0;var _0x114d10=_0x53df[_0x264545];return _0x114d10;};'use strict';var util=require(_0xf53d('0x0'));var BPromise=require(_0xf53d('0x1'));var jayson=require(_0xf53d('0x2'));var _=require(_0xf53d('0x3'));var logger=require(_0xf53d('0x4'))(_0xf53d('0x5'));var client=jayson[_0xf53d('0x6')][_0xf53d('0x7')]({'port':0x232a});function request(_0x25947e,_0x32a2ab){return new BPromise(function(_0x2456b9,_0x93e4d0){return client[_0xf53d('0x8')](_0x25947e,_0x32a2ab)[_0xf53d('0x9')](function(_0x376950){if(_0x376950[_0xf53d('0xa')]){return _0x93e4d0(_0x376950[_0xf53d('0xa')]['message']);}else{return _0x2456b9(_0x376950[_0xf53d('0xb')]);}})[_0xf53d('0xc')](function(_0x30a03a){return _0x93e4d0(_0x30a03a);});});}exports['condition']=function(_0x5ab66f,_0xcc106a,_0x12d71a){return function(_0x5b4907){if(_0x12d71a[_0xf53d('0xd')]&&!_0x12d71a[_0xf53d('0xd')][_0x5ab66f]){logger[_0xf53d('0xe')](_0xf53d('0xf'),_0x5ab66f);return _0x5b4907[_0xf53d('0x10')]();}var _0x35d776=[];for(var _0x15088d=0x0;_0x15088d<_0xcc106a[_0xf53d('0x11')];_0x15088d+=0x1){_0x35d776[_0xf53d('0x12')](request(_0xf53d('0x13'),{'command':util[_0xf53d('0x14')](_0xf53d('0x15'),_0xcc106a[_0x15088d])})[_0xf53d('0x9')](function(_0x32fe5a){return _0x32fe5a&&_0x32fe5a[_0xf53d('0x16')]&&_0x32fe5a[_0xf53d('0x16')][_0xf53d('0x17')]('true')>=0x0?!![]:![];})['catch'](function(_0x337c98){logger[_0xf53d('0xa')](_0xf53d('0x18'),_0x5ab66f,_0xcc106a[_0x15088d]);}));}BPromise[_0xf53d('0x19')](_0x35d776)[_0xf53d('0x9')](function(_0x5c56db){var _0x3a3b19=_[_0xf53d('0x1a')](_0x5c56db);logger[_0xf53d('0xe')]('[%s][INTERVAL]\x20%s\x20%s',_0x5ab66f,_0xcc106a[_0xf53d('0x1b')](_0xf53d('0x1c')),_0x3a3b19);_0x5b4907[_0xf53d('0x1d')](_0x3a3b19);})['catch'](function(_0xf27b1b){console[_0xf53d('0x1e')](_0xf27b1b);logger[_0xf53d('0xa')](_0xf53d('0x1f'),_0x5ab66f,_0xcc106a[_0xf53d('0x1b')](_0xf53d('0x1c')),_0xf27b1b[_0xf53d('0x20')]);_0x5b4907[_0xf53d('0x10')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 2d461cc..bb8dbee 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 _0x06c9=['destinationchannel','diffTime','agentconnectAt','endtime','agentringnoanswerAt','answertime','starttime','unknown','transfer','util','./utils','info','format','channel','membername','interface','calleridnum','connectedlinenum','lastevent','queue','getVoiceQueueByName','then','type','agentcomplete','acw','agentacw','request','CreateVoiceAgentReport','destchannel','agentcalled','assign','now','called','isNil','rejected','queuecallerabandon','forIn','abandon','agentconnect','connect','answered_elsewhere','destuniqueid','complete','blindtransfer','cdr','attendedtransfer','clone','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','secondtransfererchannel','transfereechannel','transfereecalleridname'];(function(_0x102ff9,_0x907658){var _0x24fa97=function(_0x3622ff){while(--_0x3622ff){_0x102ff9['push'](_0x102ff9['shift']());}};_0x24fa97(++_0x907658);}(_0x06c9,0x1e6));var _0x906c=function(_0x5b5f85,_0x311a0d){_0x5b5f85=_0x5b5f85-0x0;var _0x4687ea=_0x06c9[_0x5b5f85];return _0x4687ea;};'use strict';var _=require('lodash');var util=require(_0x906c('0x0'));var utils=require(_0x906c('0x1'));var agents={};var transfers={};function writeDB(_0x27ca55){utils[_0x906c('0x2')](util[_0x906c('0x3')]('AGENT|%s|%s|%s|%s|%s|%s|%s|%s',_0x27ca55['uniqueid'],_0x27ca55[_0x906c('0x4')],_0x27ca55['queue'],_0x27ca55[_0x906c('0x5')],_0x27ca55[_0x906c('0x6')],_0x27ca55[_0x906c('0x7')],_0x27ca55[_0x906c('0x8')],_0x27ca55[_0x906c('0x9')]));if(_0x27ca55[_0x906c('0xa')]){utils[_0x906c('0xb')](_0x27ca55[_0x906c('0xa')])[_0x906c('0xc')](function(_0xceff1e){if(_0xceff1e){_0x27ca55[_0x906c('0xd')]=_0xceff1e[_0x906c('0xd')];_0x27ca55['agentacw']=_0x27ca55[_0x906c('0xe')]?_0xceff1e[_0x906c('0xf')]:![];_0x27ca55['acwtime']=_0x27ca55[_0x906c('0x10')]?_0xceff1e['acwTimeout']:null;}utils[_0x906c('0x11')]('CreateVoiceAgentReport',_0x27ca55);});}else{utils[_0x906c('0x11')](_0x906c('0x12'),_0x27ca55);}delete agents[_0x27ca55[_0x906c('0x13')]];}function isClosed(_0x2585cc){return _0x2585cc['agentringnoanswer']||_0x2585cc['agentconnect']||_0x2585cc[_0x906c('0xe')];}exports[_0x906c('0x14')]=function(_0x3ea15c){agents[_0x3ea15c['destchannel']]=_[_0x906c('0x15')](_0x3ea15c,{'agentcalled':!![],'agentcalledAt':utils[_0x906c('0x16')](),'lastevent':_0x906c('0x17')});};exports['agentringnoanswer']=function(_0x53afe7){if(!_[_0x906c('0x18')](agents[_0x53afe7[_0x906c('0x13')]])){agents[_0x53afe7['destchannel']]=_[_0x906c('0x15')](agents[_0x53afe7[_0x906c('0x13')]],_0x53afe7,{'agentringnoanswer':!![],'agentringnoanswerAt':utils[_0x906c('0x16')](),'lastevent':_0x906c('0x19'),'reason':_0x906c('0x19')});}};exports[_0x906c('0x1a')]=function(_0x1b6c1f){_[_0x906c('0x1b')](agents,function(_0x503714,_0x53f9a4){if(_0x503714[_0x906c('0x4')]==_0x1b6c1f[_0x906c('0x4')]){if(!isClosed(_0x503714)){_0x503714=_['assign'](_0x503714,{'agentringnoanswer':!![],'agentringnoanswerAt':utils[_0x906c('0x16')](),'lastevent':_0x906c('0x1c'),'reason':'abandon'});}}});};exports[_0x906c('0x1d')]=function(_0x311e18){if(!_[_0x906c('0x18')](agents[_0x311e18[_0x906c('0x13')]])){agents[_0x311e18[_0x906c('0x13')]]=_[_0x906c('0x15')](agents[_0x311e18[_0x906c('0x13')]],_0x311e18,{'agentconnect':!![],'agentconnectAt':utils['now'](),'lastevent':_0x906c('0x1e')});_['forIn'](agents,function(_0x1c2db9,_0x2b4309){if(_0x1c2db9[_0x906c('0x4')]==_0x311e18['channel']){if(!isClosed(_0x1c2db9)){_0x1c2db9=_['assign'](_0x1c2db9,{'agentringnoanswer':!![],'agentringnoanswerAt':utils[_0x906c('0x16')](),'lastevent':_0x906c('0x1f'),'reason':_0x906c('0x1f'),'answeredelsewheredestinationuniqueid':_0x311e18[_0x906c('0x20')],'answeredelsewheremembername':_0x311e18[_0x906c('0x5')]});}}});}};exports[_0x906c('0xe')]=function(_0x51b4b6){if(!_[_0x906c('0x18')](agents[_0x51b4b6['destchannel']])){agents[_0x51b4b6['destchannel']]=_[_0x906c('0x15')](agents[_0x51b4b6[_0x906c('0x13')]],_0x51b4b6,{'agentcomplete':!![],'agentcompleteAt':utils[_0x906c('0x16')](),'lastevent':_0x906c('0x21')});}};exports[_0x906c('0x22')]=function(_0x54db80){if(!_[_0x906c('0x18')](agents[_0x54db80['transfererchannel']])){this[_0x906c('0x23')]({'destinationchannel':_0x54db80['transfererchannel']});}};exports[_0x906c('0x24')]=function(_0x39e38e){_[_0x906c('0x1b')](agents,function(_0x1c9e01){if(_0x1c9e01[_0x906c('0x4')]==_0x39e38e['origtransfererchannel']){transfers[_0x1c9e01[_0x906c('0x13')]]=_[_0x906c('0x25')](_0x1c9e01);transfers[_0x1c9e01[_0x906c('0x13')]]=_[_0x906c('0x15')](transfers[_0x1c9e01[_0x906c('0x13')]],{'channel':_0x39e38e[_0x906c('0x26')],'calleridname':_0x39e38e[_0x906c('0x27')],'calleridnum':_0x39e38e[_0x906c('0x28')]});}else if(_0x1c9e01[_0x906c('0x4')]==_0x39e38e[_0x906c('0x29')]){transfers[_0x1c9e01[_0x906c('0x13')]]=_['clone'](_0x1c9e01);transfers[_0x1c9e01[_0x906c('0x13')]]=_[_0x906c('0x15')](transfers[_0x1c9e01[_0x906c('0x13')]],{'channel':_0x39e38e[_0x906c('0x2a')],'calleridname':_0x39e38e[_0x906c('0x2b')],'calleridnum':_0x39e38e['transfereeconnectedlinenum']});}});};exports[_0x906c('0x23')]=function(_0x585714){if(!_[_0x906c('0x18')](agents[_0x585714['destinationchannel']])){if(!_[_0x906c('0x18')](agents[_0x585714[_0x906c('0x2c')]]['agentconnectAt'])){agents[_0x585714[_0x906c('0x2c')]]=_[_0x906c('0x15')](agents[_0x585714[_0x906c('0x2c')]],{'agentcomplete':!![],'agentcompleteAt':_0x585714['endtime'],'holdtime':utils[_0x906c('0x2d')](agents[_0x585714[_0x906c('0x2c')]][_0x906c('0x2e')],agents[_0x585714[_0x906c('0x2c')]]['agentcalledAt']),'talktime':utils[_0x906c('0x2d')](_0x585714[_0x906c('0x2f')],agents[_0x585714['destinationchannel']][_0x906c('0x2e')]),'lastevent':_0x906c('0x21')});}else if(_[_0x906c('0x18')](agents[_0x585714[_0x906c('0x2c')]][_0x906c('0x30')])){agents[_0x585714[_0x906c('0x2c')]]=_[_0x906c('0x15')](agents[_0x585714[_0x906c('0x2c')]],{'agentringnoanswer':!![],'agentringnoanswerAt':_0x585714[_0x906c('0x31')]||_0x585714[_0x906c('0x32')],'reason':_0x906c('0x33')});}writeDB(agents[_0x585714['destinationchannel']]);if(!_[_0x906c('0x18')](transfers[_0x585714[_0x906c('0x2c')]])){agents[_0x585714[_0x906c('0x2c')]]=_[_0x906c('0x15')](transfers[_0x585714[_0x906c('0x2c')]],{'agentcalledAt':utils['now'](),'agentconnectAt':transfers[_0x585714[_0x906c('0x2c')]][_0x906c('0x1d')]?utils[_0x906c('0x16')]():null,'lastevent':_0x906c('0x1e'),'reason':_0x906c('0x34')});delete transfers[_0x585714[_0x906c('0x2c')]];}}}; \ No newline at end of file +var _0xb13e=['acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','agentcalled','assign','now','called','agentringnoanswer','destchannel','rejected','queuecallerabandon','agentconnect','isNil','connect','forIn','answered_elsewhere','destuniqueid','blindtransfer','cdr','transfererchannel','origtransfererchannel','clone','transfertargetcalleridname','transfertargetconnectedlinenum','secondtransfererchannel','transfereecalleridname','transfereeconnectedlinenum','destinationchannel','agentconnectAt','endtime','diffTime','agentcalledAt','complete','agentringnoanswerAt','answertime','starttime','unknown','transfer','util','./utils','info','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','channel','queue','membername','calleridnum','connectedlinenum','lastevent','then','type','agentcomplete'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xb13e,0x136));var _0xeb13=function(_0x30a13a,_0x3322eb){_0x30a13a=_0x30a13a-0x0;var _0x4bdb25=_0xb13e[_0x30a13a];return _0x4bdb25;};'use strict';var _=require('lodash');var util=require(_0xeb13('0x0'));var utils=require(_0xeb13('0x1'));var agents={};var transfers={};function writeDB(_0x352bdd){utils[_0xeb13('0x2')](util[_0xeb13('0x3')](_0xeb13('0x4'),_0x352bdd['uniqueid'],_0x352bdd[_0xeb13('0x5')],_0x352bdd[_0xeb13('0x6')],_0x352bdd[_0xeb13('0x7')],_0x352bdd['interface'],_0x352bdd[_0xeb13('0x8')],_0x352bdd[_0xeb13('0x9')],_0x352bdd[_0xeb13('0xa')]));if(_0x352bdd[_0xeb13('0x6')]){utils['getVoiceQueueByName'](_0x352bdd[_0xeb13('0x6')])[_0xeb13('0xb')](function(_0x2d1aa7){if(_0x2d1aa7){_0x352bdd[_0xeb13('0xc')]=_0x2d1aa7['type'];_0x352bdd['agentacw']=_0x352bdd[_0xeb13('0xd')]?_0x2d1aa7['acw']:![];_0x352bdd[_0xeb13('0xe')]=_0x352bdd[_0xeb13('0xf')]?_0x2d1aa7[_0xeb13('0x10')]:null;}utils[_0xeb13('0x11')]('CreateVoiceAgentReport',_0x352bdd);});}else{utils[_0xeb13('0x11')](_0xeb13('0x12'),_0x352bdd);}delete agents[_0x352bdd['destchannel']];}function isClosed(_0x3cefc9){return _0x3cefc9['agentringnoanswer']||_0x3cefc9['agentconnect']||_0x3cefc9[_0xeb13('0xd')];}exports[_0xeb13('0x13')]=function(_0x221c3f){agents[_0x221c3f['destchannel']]=_[_0xeb13('0x14')](_0x221c3f,{'agentcalled':!![],'agentcalledAt':utils[_0xeb13('0x15')](),'lastevent':_0xeb13('0x16')});};exports[_0xeb13('0x17')]=function(_0x1f00bf){if(!_['isNil'](agents[_0x1f00bf['destchannel']])){agents[_0x1f00bf[_0xeb13('0x18')]]=_['assign'](agents[_0x1f00bf[_0xeb13('0x18')]],_0x1f00bf,{'agentringnoanswer':!![],'agentringnoanswerAt':utils[_0xeb13('0x15')](),'lastevent':_0xeb13('0x19'),'reason':_0xeb13('0x19')});}};exports[_0xeb13('0x1a')]=function(_0x530e88){_['forIn'](agents,function(_0x5803ec,_0xa5a4dc){if(_0x5803ec['channel']==_0x530e88['channel']){if(!isClosed(_0x5803ec)){_0x5803ec=_[_0xeb13('0x14')](_0x5803ec,{'agentringnoanswer':!![],'agentringnoanswerAt':utils[_0xeb13('0x15')](),'lastevent':'abandon','reason':'abandon'});}}});};exports[_0xeb13('0x1b')]=function(_0x1b6dd7){if(!_[_0xeb13('0x1c')](agents[_0x1b6dd7[_0xeb13('0x18')]])){agents[_0x1b6dd7['destchannel']]=_[_0xeb13('0x14')](agents[_0x1b6dd7['destchannel']],_0x1b6dd7,{'agentconnect':!![],'agentconnectAt':utils[_0xeb13('0x15')](),'lastevent':_0xeb13('0x1d')});_[_0xeb13('0x1e')](agents,function(_0x28a0e9,_0x34ef85){if(_0x28a0e9[_0xeb13('0x5')]==_0x1b6dd7['channel']){if(!isClosed(_0x28a0e9)){_0x28a0e9=_[_0xeb13('0x14')](_0x28a0e9,{'agentringnoanswer':!![],'agentringnoanswerAt':utils['now'](),'lastevent':_0xeb13('0x1f'),'reason':_0xeb13('0x1f'),'answeredelsewheredestinationuniqueid':_0x1b6dd7[_0xeb13('0x20')],'answeredelsewheremembername':_0x1b6dd7[_0xeb13('0x7')]});}}});}};exports['agentcomplete']=function(_0x36294e){if(!_[_0xeb13('0x1c')](agents[_0x36294e[_0xeb13('0x18')]])){agents[_0x36294e['destchannel']]=_['assign'](agents[_0x36294e[_0xeb13('0x18')]],_0x36294e,{'agentcomplete':!![],'agentcompleteAt':utils[_0xeb13('0x15')](),'lastevent':'complete'});}};exports[_0xeb13('0x21')]=function(_0x5020e3){if(!_[_0xeb13('0x1c')](agents[_0x5020e3['transfererchannel']])){this[_0xeb13('0x22')]({'destinationchannel':_0x5020e3[_0xeb13('0x23')]});}};exports['attendedtransfer']=function(_0x301608){_[_0xeb13('0x1e')](agents,function(_0x15e838){if(_0x15e838[_0xeb13('0x5')]==_0x301608[_0xeb13('0x24')]){transfers[_0x15e838[_0xeb13('0x18')]]=_[_0xeb13('0x25')](_0x15e838);transfers[_0x15e838[_0xeb13('0x18')]]=_[_0xeb13('0x14')](transfers[_0x15e838[_0xeb13('0x18')]],{'channel':_0x301608['transfertargetchannel'],'calleridname':_0x301608[_0xeb13('0x26')],'calleridnum':_0x301608[_0xeb13('0x27')]});}else if(_0x15e838['channel']==_0x301608[_0xeb13('0x28')]){transfers[_0x15e838['destchannel']]=_[_0xeb13('0x25')](_0x15e838);transfers[_0x15e838[_0xeb13('0x18')]]=_[_0xeb13('0x14')](transfers[_0x15e838['destchannel']],{'channel':_0x301608['transfereechannel'],'calleridname':_0x301608[_0xeb13('0x29')],'calleridnum':_0x301608[_0xeb13('0x2a')]});}});};exports[_0xeb13('0x22')]=function(_0x33beae){if(!_[_0xeb13('0x1c')](agents[_0x33beae['destinationchannel']])){if(!_[_0xeb13('0x1c')](agents[_0x33beae[_0xeb13('0x2b')]][_0xeb13('0x2c')])){agents[_0x33beae['destinationchannel']]=_[_0xeb13('0x14')](agents[_0x33beae['destinationchannel']],{'agentcomplete':!![],'agentcompleteAt':_0x33beae[_0xeb13('0x2d')],'holdtime':utils[_0xeb13('0x2e')](agents[_0x33beae[_0xeb13('0x2b')]][_0xeb13('0x2c')],agents[_0x33beae[_0xeb13('0x2b')]][_0xeb13('0x2f')]),'talktime':utils[_0xeb13('0x2e')](_0x33beae[_0xeb13('0x2d')],agents[_0x33beae['destinationchannel']][_0xeb13('0x2c')]),'lastevent':_0xeb13('0x30')});}else if(_[_0xeb13('0x1c')](agents[_0x33beae[_0xeb13('0x2b')]][_0xeb13('0x31')])){agents[_0x33beae[_0xeb13('0x2b')]]=_[_0xeb13('0x14')](agents[_0x33beae[_0xeb13('0x2b')]],{'agentringnoanswer':!![],'agentringnoanswerAt':_0x33beae[_0xeb13('0x32')]||_0x33beae[_0xeb13('0x33')],'reason':_0xeb13('0x34')});}writeDB(agents[_0x33beae['destinationchannel']]);if(!_[_0xeb13('0x1c')](transfers[_0x33beae['destinationchannel']])){agents[_0x33beae[_0xeb13('0x2b')]]=_[_0xeb13('0x14')](transfers[_0x33beae[_0xeb13('0x2b')]],{'agentcalledAt':utils[_0xeb13('0x15')](),'agentconnectAt':transfers[_0x33beae['destinationchannel']]['agentconnect']?utils['now']():null,'lastevent':'connect','reason':_0xeb13('0x35')});delete transfers[_0x33beae[_0xeb13('0x2b')]];}}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 28ea4bd..66ddfe9 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 _0x7cde=['destinationchannel','Local/_attended@transfer','billableseconds','lastapplication','toLowerCase','hangup','lodash','./utils','answertime','info','uniqueid','channel','accountcode','source','destination','callerid','disposition','then','request','CreateVoiceCallReport','isNil','musiconholdstartAt','mohtime','diffTime','now','varset','variable','xmd-originatecalleridnum','value','xmd-phone','xmd-callerid-preview','xmd-callerid','Queue','lastdata','queue','xmd-contactid','ContactId','outboundrouteid','routeid','application','set','appdata','split','substring','lastIndexOf','agentcomplete','connectedlinenum','cdr','assign','isBefore','starttime','isAfter','endtime','startsWith'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x7cde,0x180));var _0xe7cd=function(_0x527d69,_0x4cc795){_0x527d69=_0x527d69-0x0;var _0x260b4e=_0x7cde[_0x527d69];return _0x260b4e;};'use strict';var _=require(_0xe7cd('0x0'));var util=require('util');var utils=require(_0xe7cd('0x1'));var channels={};var timeouts={};function writeDB(_0x28f112){return function(){_0x28f112['answertime']=_0x28f112[_0xe7cd('0x2')]||null;utils[_0xe7cd('0x3')](util['format']('CALL|%s|%s|%s|%s|%s|%s|%s|%s',_0x28f112[_0xe7cd('0x4')],_0x28f112[_0xe7cd('0x5')],_0x28f112['type'],_0x28f112[_0xe7cd('0x6')],_0x28f112[_0xe7cd('0x7')],_0x28f112[_0xe7cd('0x8')],_0x28f112[_0xe7cd('0x9')],_0x28f112[_0xe7cd('0xa')]));if(_0x28f112[_0xe7cd('0x6')]){utils['getUserByInternal'](_0x28f112[_0xe7cd('0x6')])[_0xe7cd('0xb')](function(_0x484e33){if(_0x484e33){_0x28f112['UserId']=_0x484e33['id'];}utils[_0xe7cd('0xc')](_0xe7cd('0xd'),_0x28f112);});}else{utils[_0xe7cd('0xc')](_0xe7cd('0xd'),_0x28f112);}if(channels[_0x28f112[_0xe7cd('0x5')]]){delete channels[_0x28f112[_0xe7cd('0x5')]];}if(timeouts[_0x28f112['channel']]){delete timeouts[_0x28f112['channel']];}};}exports['newchannel']=function(_0x4f9de3){if(_[_0xe7cd('0xe')](channels[_0x4f9de3['channel']])){channels[_0x4f9de3[_0xe7cd('0x5')]]={'mohtime':0x0};}};exports['musiconholdstart']=function(_0x425c89){if(!_[_0xe7cd('0xe')](channels[_0x425c89[_0xe7cd('0x5')]])){channels[_0x425c89[_0xe7cd('0x5')]][_0xe7cd('0xf')]=utils['now']();}};exports['musiconholdstop']=function(_0xf18b2a){if(!_[_0xe7cd('0xe')](channels[_0xf18b2a[_0xe7cd('0x5')]])){if(!_[_0xe7cd('0xe')](channels[_0xf18b2a[_0xe7cd('0x5')]][_0xe7cd('0xf')])){channels[_0xf18b2a[_0xe7cd('0x5')]][_0xe7cd('0x10')]+=utils[_0xe7cd('0x11')](utils[_0xe7cd('0x12')](),channels[_0xf18b2a[_0xe7cd('0x5')]][_0xe7cd('0xf')]);delete channels[_0xf18b2a[_0xe7cd('0x5')]][_0xe7cd('0xf')];}}};exports[_0xe7cd('0x13')]=function(_0x18a7a0){if(!_[_0xe7cd('0xe')](channels[_0x18a7a0[_0xe7cd('0x5')]])){if(!_[_0xe7cd('0xe')](_0x18a7a0[_0xe7cd('0x14')][_0xe7cd('0x15')])){channels[_0x18a7a0['channel']][_0xe7cd('0x7')]=_0x18a7a0[_0xe7cd('0x16')];}if(!_[_0xe7cd('0xe')](_0x18a7a0[_0xe7cd('0x14')][_0xe7cd('0x17')])){channels[_0x18a7a0['channel']][_0xe7cd('0x8')]=_0x18a7a0[_0xe7cd('0x16')];}if(!_[_0xe7cd('0xe')](_0x18a7a0[_0xe7cd('0x14')][_0xe7cd('0x18')])||!_['isNil'](_0x18a7a0[_0xe7cd('0x14')][_0xe7cd('0x19')])){channels[_0x18a7a0[_0xe7cd('0x5')]][_0xe7cd('0x9')]=_0x18a7a0['value'];}if(!_[_0xe7cd('0xe')](_0x18a7a0[_0xe7cd('0x14')]['xmd-queue'])){channels[_0x18a7a0[_0xe7cd('0x5')]]['lastapplication']=_0xe7cd('0x1a');channels[_0x18a7a0[_0xe7cd('0x5')]][_0xe7cd('0x1b')]=_0x18a7a0['value'];channels[_0x18a7a0[_0xe7cd('0x5')]][_0xe7cd('0x1c')]=!![];}if(!_['isNil'](_0x18a7a0[_0xe7cd('0x14')][_0xe7cd('0x1d')])){channels[_0x18a7a0[_0xe7cd('0x5')]][_0xe7cd('0x1e')]=_0x18a7a0[_0xe7cd('0x16')];}if(!_['isNil'](_0x18a7a0[_0xe7cd('0x14')][_0xe7cd('0x1f')])){channels[_0x18a7a0[_0xe7cd('0x5')]][_0xe7cd('0x20')]=_0x18a7a0['value'];}}};exports['newexten']=function(_0x4aa63c){if(!_[_0xe7cd('0xe')](channels[_0x4aa63c[_0xe7cd('0x5')]])){if(_0x4aa63c[_0xe7cd('0x21')]['toLowerCase']()==_0xe7cd('0x22')&&_['startsWith'](_0x4aa63c[_0xe7cd('0x23')]['toLowerCase'](),'cdr')){var _0x4ebd61=_0x4aa63c[_0xe7cd('0x23')][_0xe7cd('0x24')]('=');var _0x1ff087=_0x4ebd61[0x0][_0xe7cd('0x25')](_0x4ebd61[0x0][_0xe7cd('0x26')]('(')+0x1,_0x4ebd61[0x0][_0xe7cd('0x26')](')'));var _0x16b874=_0x4ebd61[0x1];channels[_0x4aa63c[_0xe7cd('0x5')]][_0x1ff087]=_0x16b874;}}};exports[_0xe7cd('0x27')]=function(_0x3352fd){if(!_[_0xe7cd('0xe')](channels[_0x3352fd[_0xe7cd('0x5')]])&&!_[_0xe7cd('0xe')](channels[_0x3352fd[_0xe7cd('0x5')]][_0xe7cd('0x1c')])){channels[_0x3352fd[_0xe7cd('0x5')]][_0xe7cd('0x6')]=_0x3352fd[_0xe7cd('0x28')];}};exports[_0xe7cd('0x29')]=function(_0x22965d){if(!_[_0xe7cd('0xe')](channels[_0x22965d[_0xe7cd('0x5')]])){if(_['isNil'](timeouts[_0x22965d[_0xe7cd('0x5')]])){channels[_0x22965d['channel']]=_['assign'](_0x22965d,channels[_0x22965d[_0xe7cd('0x5')]]);}else{clearTimeout(timeouts[_0x22965d[_0xe7cd('0x5')]]);channels[_0x22965d['channel']]=_[_0xe7cd('0x2a')](channels[_0x22965d[_0xe7cd('0x5')]],{'starttime':utils[_0xe7cd('0x2b')](_0x22965d['starttime'],channels[_0x22965d[_0xe7cd('0x5')]]['starttime'])?_0x22965d['starttime']:channels[_0x22965d[_0xe7cd('0x5')]][_0xe7cd('0x2c')],'answertime':utils['isBefore'](_0x22965d[_0xe7cd('0x2')],channels[_0x22965d[_0xe7cd('0x5')]][_0xe7cd('0x2')])?_0x22965d[_0xe7cd('0x2')]:channels[_0x22965d[_0xe7cd('0x5')]][_0xe7cd('0x2')]});if(utils[_0xe7cd('0x2d')](_0x22965d['endtime'],channels[_0x22965d[_0xe7cd('0x5')]][_0xe7cd('0x2e')])){channels[_0x22965d['channel']]=_[_0xe7cd('0x2a')](channels[_0x22965d[_0xe7cd('0x5')]],{'endtime':_0x22965d[_0xe7cd('0x2e')],'destinationchannel':_[_0xe7cd('0x2f')](_0x22965d[_0xe7cd('0x30')],_0xe7cd('0x31'))?channels[_0x22965d['channel']][_0xe7cd('0x30')]:_0x22965d[_0xe7cd('0x30')]});}channels[_0x22965d[_0xe7cd('0x5')]]['duration']=utils[_0xe7cd('0x11')](channels[_0x22965d[_0xe7cd('0x5')]]['endtime'],channels[_0x22965d[_0xe7cd('0x5')]][_0xe7cd('0x2c')]);channels[_0x22965d[_0xe7cd('0x5')]][_0xe7cd('0x32')]=utils[_0xe7cd('0x11')](channels[_0x22965d[_0xe7cd('0x5')]][_0xe7cd('0x2e')],channels[_0x22965d[_0xe7cd('0x5')]][_0xe7cd('0x2')]);if(_0x22965d[_0xe7cd('0x33')][_0xe7cd('0x34')]()!=_0xe7cd('0x35')){channels[_0x22965d[_0xe7cd('0x5')]][_0xe7cd('0x1b')]=_0x22965d[_0xe7cd('0x1b')];channels[_0x22965d['channel']][_0xe7cd('0x33')]=_0x22965d[_0xe7cd('0x33')];}}timeouts[_0x22965d[_0xe7cd('0x5')]]=setTimeout(writeDB(channels[_0x22965d[_0xe7cd('0x5')]]),0x3e8);}}; \ No newline at end of file +var _0x97fd=['channel','type','source','destination','callerid','disposition','accountcode','getUserByInternal','then','UserId','CreateVoiceCallReport','request','newchannel','isNil','musiconholdstart','musiconholdstartAt','now','musiconholdstop','diffTime','variable','value','xmd-phone','xmd-callerid-preview','xmd-callerid','lastapplication','lastdata','queue','xmd-contactid','ContactId','outboundrouteid','routeid','newexten','application','toLowerCase','startsWith','cdr','appdata','split','substring','lastIndexOf','connectedlinenum','assign','starttime','isBefore','answertime','isAfter','endtime','duration','billableseconds','hangup','lodash','./utils','info','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid'];(function(_0xe61d22,_0x2f3a30){var _0x1bebbb=function(_0xdaf0de){while(--_0xdaf0de){_0xe61d22['push'](_0xe61d22['shift']());}};_0x1bebbb(++_0x2f3a30);}(_0x97fd,0x6a));var _0xd97f=function(_0x5859b0,_0x19fcc2){_0x5859b0=_0x5859b0-0x0;var _0xf6fa71=_0x97fd[_0x5859b0];return _0xf6fa71;};'use strict';var _=require(_0xd97f('0x0'));var util=require('util');var utils=require(_0xd97f('0x1'));var channels={};var timeouts={};function writeDB(_0x4e7b17){return function(){_0x4e7b17['answertime']=_0x4e7b17['answertime']||null;utils[_0xd97f('0x2')](util[_0xd97f('0x3')](_0xd97f('0x4'),_0x4e7b17[_0xd97f('0x5')],_0x4e7b17[_0xd97f('0x6')],_0x4e7b17[_0xd97f('0x7')],_0x4e7b17['accountcode'],_0x4e7b17[_0xd97f('0x8')],_0x4e7b17[_0xd97f('0x9')],_0x4e7b17[_0xd97f('0xa')],_0x4e7b17[_0xd97f('0xb')]));if(_0x4e7b17[_0xd97f('0xc')]){utils[_0xd97f('0xd')](_0x4e7b17[_0xd97f('0xc')])[_0xd97f('0xe')](function(_0x59265d){if(_0x59265d){_0x4e7b17[_0xd97f('0xf')]=_0x59265d['id'];}utils['request'](_0xd97f('0x10'),_0x4e7b17);});}else{utils[_0xd97f('0x11')](_0xd97f('0x10'),_0x4e7b17);}if(channels[_0x4e7b17[_0xd97f('0x6')]]){delete channels[_0x4e7b17[_0xd97f('0x6')]];}if(timeouts[_0x4e7b17['channel']]){delete timeouts[_0x4e7b17[_0xd97f('0x6')]];}};}exports[_0xd97f('0x12')]=function(_0x3aa552){if(_[_0xd97f('0x13')](channels[_0x3aa552['channel']])){channels[_0x3aa552[_0xd97f('0x6')]]={'mohtime':0x0};}};exports[_0xd97f('0x14')]=function(_0x533819){if(!_[_0xd97f('0x13')](channels[_0x533819[_0xd97f('0x6')]])){channels[_0x533819[_0xd97f('0x6')]][_0xd97f('0x15')]=utils[_0xd97f('0x16')]();}};exports[_0xd97f('0x17')]=function(_0x27a5ef){if(!_['isNil'](channels[_0x27a5ef['channel']])){if(!_['isNil'](channels[_0x27a5ef[_0xd97f('0x6')]][_0xd97f('0x15')])){channels[_0x27a5ef[_0xd97f('0x6')]]['mohtime']+=utils[_0xd97f('0x18')](utils[_0xd97f('0x16')](),channels[_0x27a5ef[_0xd97f('0x6')]][_0xd97f('0x15')]);delete channels[_0x27a5ef[_0xd97f('0x6')]]['musiconholdstartAt'];}}};exports['varset']=function(_0x30cd21){if(!_[_0xd97f('0x13')](channels[_0x30cd21[_0xd97f('0x6')]])){if(!_[_0xd97f('0x13')](_0x30cd21[_0xd97f('0x19')]['xmd-originatecalleridnum'])){channels[_0x30cd21[_0xd97f('0x6')]]['source']=_0x30cd21[_0xd97f('0x1a')];}if(!_[_0xd97f('0x13')](_0x30cd21['variable'][_0xd97f('0x1b')])){channels[_0x30cd21[_0xd97f('0x6')]][_0xd97f('0x9')]=_0x30cd21['value'];}if(!_[_0xd97f('0x13')](_0x30cd21[_0xd97f('0x19')][_0xd97f('0x1c')])||!_[_0xd97f('0x13')](_0x30cd21[_0xd97f('0x19')][_0xd97f('0x1d')])){channels[_0x30cd21[_0xd97f('0x6')]][_0xd97f('0xa')]=_0x30cd21[_0xd97f('0x1a')];}if(!_[_0xd97f('0x13')](_0x30cd21[_0xd97f('0x19')]['xmd-queue'])){channels[_0x30cd21[_0xd97f('0x6')]][_0xd97f('0x1e')]='Queue';channels[_0x30cd21['channel']][_0xd97f('0x1f')]=_0x30cd21[_0xd97f('0x1a')];channels[_0x30cd21[_0xd97f('0x6')]][_0xd97f('0x20')]=!![];}if(!_['isNil'](_0x30cd21[_0xd97f('0x19')][_0xd97f('0x21')])){channels[_0x30cd21[_0xd97f('0x6')]][_0xd97f('0x22')]=_0x30cd21[_0xd97f('0x1a')];}if(!_[_0xd97f('0x13')](_0x30cd21['variable'][_0xd97f('0x23')])){channels[_0x30cd21[_0xd97f('0x6')]][_0xd97f('0x24')]=_0x30cd21[_0xd97f('0x1a')];}}};exports[_0xd97f('0x25')]=function(_0x3f0248){if(!_[_0xd97f('0x13')](channels[_0x3f0248['channel']])){if(_0x3f0248[_0xd97f('0x26')][_0xd97f('0x27')]()=='set'&&_[_0xd97f('0x28')](_0x3f0248['appdata'][_0xd97f('0x27')](),_0xd97f('0x29'))){var _0x158c9b=_0x3f0248[_0xd97f('0x2a')][_0xd97f('0x2b')]('=');var _0x3da998=_0x158c9b[0x0][_0xd97f('0x2c')](_0x158c9b[0x0][_0xd97f('0x2d')]('(')+0x1,_0x158c9b[0x0][_0xd97f('0x2d')](')'));var _0x224342=_0x158c9b[0x1];channels[_0x3f0248['channel']][_0x3da998]=_0x224342;}}};exports['agentcomplete']=function(_0x235f47){if(!_[_0xd97f('0x13')](channels[_0x235f47['channel']])&&!_['isNil'](channels[_0x235f47[_0xd97f('0x6')]]['queue'])){channels[_0x235f47[_0xd97f('0x6')]][_0xd97f('0xc')]=_0x235f47[_0xd97f('0x2e')];}};exports[_0xd97f('0x29')]=function(_0x309319){if(!_['isNil'](channels[_0x309319[_0xd97f('0x6')]])){if(_[_0xd97f('0x13')](timeouts[_0x309319[_0xd97f('0x6')]])){channels[_0x309319[_0xd97f('0x6')]]=_[_0xd97f('0x2f')](_0x309319,channels[_0x309319['channel']]);}else{clearTimeout(timeouts[_0x309319['channel']]);channels[_0x309319[_0xd97f('0x6')]]=_[_0xd97f('0x2f')](channels[_0x309319[_0xd97f('0x6')]],{'starttime':utils['isBefore'](_0x309319[_0xd97f('0x30')],channels[_0x309319[_0xd97f('0x6')]]['starttime'])?_0x309319[_0xd97f('0x30')]:channels[_0x309319[_0xd97f('0x6')]][_0xd97f('0x30')],'answertime':utils[_0xd97f('0x31')](_0x309319[_0xd97f('0x32')],channels[_0x309319[_0xd97f('0x6')]][_0xd97f('0x32')])?_0x309319[_0xd97f('0x32')]:channels[_0x309319[_0xd97f('0x6')]]['answertime']});if(utils[_0xd97f('0x33')](_0x309319[_0xd97f('0x34')],channels[_0x309319[_0xd97f('0x6')]]['endtime'])){channels[_0x309319[_0xd97f('0x6')]]=_[_0xd97f('0x2f')](channels[_0x309319[_0xd97f('0x6')]],{'endtime':_0x309319['endtime'],'destinationchannel':_['startsWith'](_0x309319['destinationchannel'],'Local/_attended@transfer')?channels[_0x309319['channel']]['destinationchannel']:_0x309319['destinationchannel']});}channels[_0x309319[_0xd97f('0x6')]][_0xd97f('0x35')]=utils[_0xd97f('0x18')](channels[_0x309319[_0xd97f('0x6')]]['endtime'],channels[_0x309319[_0xd97f('0x6')]]['starttime']);channels[_0x309319[_0xd97f('0x6')]][_0xd97f('0x36')]=utils[_0xd97f('0x18')](channels[_0x309319[_0xd97f('0x6')]]['endtime'],channels[_0x309319[_0xd97f('0x6')]]['answertime']);if(_0x309319[_0xd97f('0x1e')]['toLowerCase']()!=_0xd97f('0x37')){channels[_0x309319['channel']][_0xd97f('0x1f')]=_0x309319[_0xd97f('0x1f')];channels[_0x309319['channel']][_0xd97f('0x1e')]=_0x309319[_0xd97f('0x1e')];}}timeouts[_0x309319[_0xd97f('0x6')]]=setTimeout(writeDB(channels[_0x309319[_0xd97f('0x6')]]),0x3e8);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 18f8366..7e24482 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 _0xe42b=['managerevent','./utils','connect','info','CONNECTED','shutdown','fullybooted','FULLYBOOTED','error','close','CLOSE'];(function(_0x88db83,_0x4441a1){var _0x4233ca=function(_0x25ee11){while(--_0x25ee11){_0x88db83['push'](_0x88db83['shift']());}};_0x4233ca(++_0x4441a1);}(_0xe42b,0xe8));var _0xbe42=function(_0x1bfb29,_0x1d6359){_0x1bfb29=_0x1bfb29-0x0;var _0x28ff29=_0xe42b[_0x1bfb29];return _0x28ff29;};'use strict';var utils=require(_0xbe42('0x0'));exports[_0xbe42('0x1')]=function(){utils[_0xbe42('0x2')](_0xbe42('0x3'));};exports[_0xbe42('0x4')]=function(){utils[_0xbe42('0x2')]('SHUTDOWN');};exports[_0xbe42('0x5')]=function(){utils[_0xbe42('0x2')](_0xbe42('0x6'));};exports[_0xbe42('0x7')]=function(_0x34b8f7){utils[_0xbe42('0x7')](_0x34b8f7);};exports[_0xbe42('0x8')]=function(){utils[_0xbe42('0x2')](_0xbe42('0x9'));};exports[_0xbe42('0xa')]=function(_0x5ee2f9){}; \ No newline at end of file +var _0x61af=['shutdown','SHUTDOWN','error','close','CLOSE','managerevent','./utils','connect','info','CONNECTED'];(function(_0x53bd18,_0x2abe7e){var _0x205340=function(_0x549365){while(--_0x549365){_0x53bd18['push'](_0x53bd18['shift']());}};_0x205340(++_0x2abe7e);}(_0x61af,0xc4));var _0xf61a=function(_0x27ab58,_0x48c638){_0x27ab58=_0x27ab58-0x0;var _0x3daff0=_0x61af[_0x27ab58];return _0x3daff0;};'use strict';var utils=require(_0xf61a('0x0'));exports[_0xf61a('0x1')]=function(){utils[_0xf61a('0x2')](_0xf61a('0x3'));};exports[_0xf61a('0x4')]=function(){utils['info'](_0xf61a('0x5'));};exports['fullybooted']=function(){utils[_0xf61a('0x2')]('FULLYBOOTED');};exports['error']=function(_0x5012b0){utils[_0xf61a('0x6')](_0x5012b0);};exports[_0xf61a('0x7')]=function(){utils[_0xf61a('0x2')](_0xf61a('0x8'));};exports[_0xf61a('0x9')]=function(_0x2143ca){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index f0dcad7..64a7a08 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 _0xa9e0=['application','toLowerCase','cdr(routeid)','appdata','split','routeid','variable','outboundrouteid','dialbegin','destcontext','from-voip-provider','assign','called','dialend','dialstatus','ANSWER','now','connect','complete','duration','diffTime','starttime','holdtime','billableseconds','answertime','lodash','util','./utils','format','uniqueid','channel','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','isNil','newexten'];(function(_0x47bb19,_0x17a096){var _0x4ef57a=function(_0x9f35cd){while(--_0x9f35cd){_0x47bb19['push'](_0x47bb19['shift']());}};_0x4ef57a(++_0x17a096);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var utils=require(_0x0a9e('0x2'));var dials={};var channels={};function writeDB(_0x5dd881){utils['info'](util[_0x0a9e('0x3')]('DIAL|%s|%s|%s|%s|%s|%s',_0x5dd881[_0x0a9e('0x4')],_0x5dd881[_0x0a9e('0x5')],_0x5dd881[_0x0a9e('0x6')],_0x5dd881[_0x0a9e('0x7')],_0x5dd881[_0x0a9e('0x8')],_0x5dd881['dialstatus']));utils[_0x0a9e('0x9')](_0x0a9e('0xa'),_0x5dd881);delete dials[_0x5dd881[_0x0a9e('0x5')]];}exports['newchannel']=function(_0x503809){if(_[_0x0a9e('0xb')](channels[_0x503809['channel']])){channels[_0x503809['channel']]={'routeid':null};}};exports[_0x0a9e('0xc')]=function(_0xf81284){if(!_[_0x0a9e('0xb')](channels[_0xf81284[_0x0a9e('0x5')]])){if(_0xf81284[_0x0a9e('0xd')][_0x0a9e('0xe')]()=='set'&&_['startsWith'](_0xf81284['appdata']['toLowerCase'](),_0x0a9e('0xf'))){var _0x36471c=_0xf81284[_0x0a9e('0x10')][_0x0a9e('0x11')]('=');channels[_0xf81284[_0x0a9e('0x5')]][_0x0a9e('0x12')]=_0x36471c[0x1];}}};exports['varset']=function(_0x4283ce){if(!_[_0x0a9e('0xb')](channels[_0x4283ce[_0x0a9e('0x5')]])){if(!_[_0x0a9e('0xb')](_0x4283ce[_0x0a9e('0x13')][_0x0a9e('0x14')])){channels[_0x4283ce['channel']][_0x0a9e('0x12')]=_0x4283ce['value'];}}};exports[_0x0a9e('0x15')]=function(_0x519dfd){if(_0x519dfd[_0x0a9e('0x16')]==_0x0a9e('0x17')){dials[_0x519dfd['channel']]=_[_0x0a9e('0x18')](_0x519dfd,{'starttime':utils['now'](),'lastevent':_0x0a9e('0x19')});}};exports[_0x0a9e('0x1a')]=function(_0x106033){if(!_[_0x0a9e('0xb')](dials[_0x106033[_0x0a9e('0x5')]])){dials[_0x106033[_0x0a9e('0x5')]]=_[_0x0a9e('0x18')](dials[_0x106033[_0x0a9e('0x5')]],_0x106033,{'answertime':_0x106033[_0x0a9e('0x1b')]==_0x0a9e('0x1c')?utils[_0x0a9e('0x1d')]():null,'lastevent':_0x106033[_0x0a9e('0x1b')]=='ANSWER'?_0x0a9e('0x1e'):_0x0a9e('0x19')});}};exports['cdr']=function(_0x20f109){if(!_['isNil'](channels[_0x20f109['channel']])){if(!_[_0x0a9e('0xb')](dials[_0x20f109[_0x0a9e('0x5')]])){dials[_0x20f109[_0x0a9e('0x5')]]=_[_0x0a9e('0x18')](dials[_0x20f109['channel']],{'endtime':utils[_0x0a9e('0x1d')](),'routeId':channels[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x12')],'lastevent':_0x0a9e('0x1f')});dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x20')]=utils[_0x0a9e('0x21')](dials[_0x20f109['channel']]['endtime'],dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x22')]);dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x23')]=utils['diffTime'](dials[_0x20f109[_0x0a9e('0x5')]]['answertime']||dials[_0x20f109[_0x0a9e('0x5')]]['endtime'],dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x22')]);dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x24')]=dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x25')]?utils[_0x0a9e('0x21')](dials[_0x20f109[_0x0a9e('0x5')]]['endtime'],dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x25')]):0x0;writeDB(dials[_0x20f109[_0x0a9e('0x5')]]);}delete channels[_0x20f109[_0x0a9e('0x5')]];}}; \ No newline at end of file +var _0xa9e0=['application','toLowerCase','cdr(routeid)','appdata','split','routeid','variable','outboundrouteid','dialbegin','destcontext','from-voip-provider','assign','called','dialend','dialstatus','ANSWER','now','connect','complete','duration','diffTime','starttime','holdtime','billableseconds','answertime','lodash','util','./utils','format','uniqueid','channel','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','isNil','newexten'];(function(_0x8806f5,_0x259bc6){var _0x39a9a8=function(_0x5c1806){while(--_0x5c1806){_0x8806f5['push'](_0x8806f5['shift']());}};_0x39a9a8(++_0x259bc6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var utils=require(_0x0a9e('0x2'));var dials={};var channels={};function writeDB(_0x5dd881){utils['info'](util[_0x0a9e('0x3')]('DIAL|%s|%s|%s|%s|%s|%s',_0x5dd881[_0x0a9e('0x4')],_0x5dd881[_0x0a9e('0x5')],_0x5dd881[_0x0a9e('0x6')],_0x5dd881[_0x0a9e('0x7')],_0x5dd881[_0x0a9e('0x8')],_0x5dd881['dialstatus']));utils[_0x0a9e('0x9')](_0x0a9e('0xa'),_0x5dd881);delete dials[_0x5dd881[_0x0a9e('0x5')]];}exports['newchannel']=function(_0x503809){if(_[_0x0a9e('0xb')](channels[_0x503809['channel']])){channels[_0x503809['channel']]={'routeid':null};}};exports[_0x0a9e('0xc')]=function(_0xf81284){if(!_[_0x0a9e('0xb')](channels[_0xf81284[_0x0a9e('0x5')]])){if(_0xf81284[_0x0a9e('0xd')][_0x0a9e('0xe')]()=='set'&&_['startsWith'](_0xf81284['appdata']['toLowerCase'](),_0x0a9e('0xf'))){var _0x36471c=_0xf81284[_0x0a9e('0x10')][_0x0a9e('0x11')]('=');channels[_0xf81284[_0x0a9e('0x5')]][_0x0a9e('0x12')]=_0x36471c[0x1];}}};exports['varset']=function(_0x4283ce){if(!_[_0x0a9e('0xb')](channels[_0x4283ce[_0x0a9e('0x5')]])){if(!_[_0x0a9e('0xb')](_0x4283ce[_0x0a9e('0x13')][_0x0a9e('0x14')])){channels[_0x4283ce['channel']][_0x0a9e('0x12')]=_0x4283ce['value'];}}};exports[_0x0a9e('0x15')]=function(_0x519dfd){if(_0x519dfd[_0x0a9e('0x16')]==_0x0a9e('0x17')){dials[_0x519dfd['channel']]=_[_0x0a9e('0x18')](_0x519dfd,{'starttime':utils['now'](),'lastevent':_0x0a9e('0x19')});}};exports[_0x0a9e('0x1a')]=function(_0x106033){if(!_[_0x0a9e('0xb')](dials[_0x106033[_0x0a9e('0x5')]])){dials[_0x106033[_0x0a9e('0x5')]]=_[_0x0a9e('0x18')](dials[_0x106033[_0x0a9e('0x5')]],_0x106033,{'answertime':_0x106033[_0x0a9e('0x1b')]==_0x0a9e('0x1c')?utils[_0x0a9e('0x1d')]():null,'lastevent':_0x106033[_0x0a9e('0x1b')]=='ANSWER'?_0x0a9e('0x1e'):_0x0a9e('0x19')});}};exports['cdr']=function(_0x20f109){if(!_['isNil'](channels[_0x20f109['channel']])){if(!_[_0x0a9e('0xb')](dials[_0x20f109[_0x0a9e('0x5')]])){dials[_0x20f109[_0x0a9e('0x5')]]=_[_0x0a9e('0x18')](dials[_0x20f109['channel']],{'endtime':utils[_0x0a9e('0x1d')](),'routeId':channels[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x12')],'lastevent':_0x0a9e('0x1f')});dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x20')]=utils[_0x0a9e('0x21')](dials[_0x20f109['channel']]['endtime'],dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x22')]);dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x23')]=utils['diffTime'](dials[_0x20f109[_0x0a9e('0x5')]]['answertime']||dials[_0x20f109[_0x0a9e('0x5')]]['endtime'],dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x22')]);dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x24')]=dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x25')]?utils[_0x0a9e('0x21')](dials[_0x20f109[_0x0a9e('0x5')]]['endtime'],dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x25')]):0x0;writeDB(dials[_0x20f109[_0x0a9e('0x5')]]);}delete channels[_0x20f109[_0x0a9e('0x5')]];}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 7f46bdb..d532c0a 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 _0x7bae=['musiconholdstart','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','./agents.controller','./calls.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','./utils','asterisk','port','username','password','keepConnected','connect','shutdown','fullybooted','error','close','managerevent','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave'];(function(_0x168f17,_0x371e7b){var _0x527037=function(_0x224a72){while(--_0x224a72){_0x168f17['push'](_0x168f17['shift']());}};_0x527037(++_0x371e7b);}(_0x7bae,0x13b));var _0xe7ba=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x7bae[_0x134c2e];return _0x2825db;};var AsteriskManager=require('asterisk-manager');var config=require('../../config/environment');var agents=require(_0xe7ba('0x0'));var calls=require(_0xe7ba('0x1'));var queues=require('./queues.controller');var recordings=require(_0xe7ba('0x2'));var members=require('./members.controller');var dials=require(_0xe7ba('0x3'));var transfers=require(_0xe7ba('0x4'));var core=require(_0xe7ba('0x5'));var utils=require(_0xe7ba('0x6'));var ami=new AsteriskManager(config[_0xe7ba('0x7')][_0xe7ba('0x8')],config[_0xe7ba('0x7')]['ip'],config[_0xe7ba('0x7')][_0xe7ba('0x9')],config[_0xe7ba('0x7')][_0xe7ba('0xa')],!![]);ami[_0xe7ba('0xb')]();ami['on'](_0xe7ba('0xc'),core[_0xe7ba('0xc')]);ami['on']('shutdown',core[_0xe7ba('0xd')]);ami['on'](_0xe7ba('0xe'),core[_0xe7ba('0xe')]);ami['on'](_0xe7ba('0xf'),core[_0xe7ba('0xf')]);ami['on'](_0xe7ba('0x10'),core[_0xe7ba('0x10')]);ami['on'](_0xe7ba('0x11'),core[_0xe7ba('0x11')]);ami['on']('devicestatechange',function(_0xf4fcb0){try{members['devicestatechange'](_0xf4fcb0);}catch(_0x602b1){utils[_0xe7ba('0xf')](_0x602b1);}});ami['on'](_0xe7ba('0x12'),function(_0x17e4e6){try{agents[_0xe7ba('0x12')](_0x17e4e6);}catch(_0x41369f){utils['error'](_0x41369f);}});ami['on']('agentringnoanswer',function(_0x2a5183){try{agents[_0xe7ba('0x13')](_0x2a5183);}catch(_0x359f6f){utils['error'](_0x359f6f);}});ami['on'](_0xe7ba('0x14'),function(_0x4b20fd){try{agents['agentconnect'](_0x4b20fd);recordings['agentconnect'](_0x4b20fd);queues[_0xe7ba('0x14')](_0x4b20fd);}catch(_0x4e87f5){utils[_0xe7ba('0xf')](_0x4e87f5);}});ami['on']('agentcomplete',function(_0x4e3021){try{agents['agentcomplete'](_0x4e3021);queues[_0xe7ba('0x15')](_0x4e3021);members[_0xe7ba('0x15')](_0x4e3021);calls[_0xe7ba('0x15')](_0x4e3021);}catch(_0x3c06c3){utils[_0xe7ba('0xf')](_0x3c06c3);}});ami['on']('queuecallerabandon',function(_0x149c62){try{agents[_0xe7ba('0x16')](_0x149c62);queues[_0xe7ba('0x16')](_0x149c62);}catch(_0x136ec6){utils['error'](_0x136ec6);}});ami['on'](_0xe7ba('0x17'),function(_0x2936b7){try{queues['queuecallerjoin'](_0x2936b7);}catch(_0x191863){utils[_0xe7ba('0xf')](_0x191863);}});ami['on'](_0xe7ba('0x18'),function(_0x7ab9e4){try{queues[_0xe7ba('0x18')](_0x7ab9e4);}catch(_0x2acfc2){utils[_0xe7ba('0xf')](_0x2acfc2);}});ami['on'](_0xe7ba('0x19'),function(_0x41cbd9){try{queues[_0xe7ba('0x19')](_0x41cbd9);calls['musiconholdstart'](_0x41cbd9);}catch(_0x48b481){utils['error'](_0x48b481);}});ami['on']('musiconholdstop',function(_0x4363a8){try{queues['musiconholdstop'](_0x4363a8);calls['musiconholdstop'](_0x4363a8);}catch(_0x5ece11){utils[_0xe7ba('0xf')](_0x5ece11);}});ami['on'](_0xe7ba('0x1a'),function(_0xe32862){try{calls[_0xe7ba('0x1a')](_0xe32862);agents[_0xe7ba('0x1a')](_0xe32862);queues[_0xe7ba('0x1a')](_0xe32862);recordings[_0xe7ba('0x1a')](_0xe32862);dials[_0xe7ba('0x1a')](_0xe32862);members['cdr'](_0xe32862);}catch(_0x43c500){utils['error'](_0x43c500);}});ami['on'](_0xe7ba('0x1b'),function(_0x92fe7){try{queues[_0xe7ba('0x1b')](_0x92fe7);agents['blindtransfer'](_0x92fe7);transfers['blindtransfer'](_0x92fe7);}catch(_0x1735da){utils[_0xe7ba('0xf')](_0x1735da);}});ami['on'](_0xe7ba('0x1c'),function(_0x20b6cd){try{queues[_0xe7ba('0x1c')](_0x20b6cd);transfers['attendedtransfer'](_0x20b6cd);agents[_0xe7ba('0x1c')](_0x20b6cd);}catch(_0x339f53){utils['error'](_0x339f53);}});ami['on'](_0xe7ba('0x1d'),function(_0x530227){try{queues['varset'](_0x530227);recordings[_0xe7ba('0x1d')](_0x530227);calls[_0xe7ba('0x1d')](_0x530227);dials[_0xe7ba('0x1d')](_0x530227);}catch(_0x52f90e){utils[_0xe7ba('0xf')](_0x52f90e);}});ami['on']('newexten',function(_0x45ae82){try{calls[_0xe7ba('0x1e')](_0x45ae82);dials[_0xe7ba('0x1e')](_0x45ae82);}catch(_0x27a8d4){utils[_0xe7ba('0xf')](_0x27a8d4);}});ami['on']('newchannel',function(_0x327c9){try{calls[_0xe7ba('0x1f')](_0x327c9);dials['newchannel'](_0x327c9);}catch(_0x295455){utils[_0xe7ba('0xf')](_0x295455);}});ami['on'](_0xe7ba('0x20'),function(_0x524726){try{dials[_0xe7ba('0x20')](_0x524726);}catch(_0x23c36e){utils['error'](_0x23c36e);}});ami['on'](_0xe7ba('0x21'),function(_0x2f7e03){try{dials[_0xe7ba('0x21')](_0x2f7e03);}catch(_0x4c1325){utils[_0xe7ba('0xf')](_0x4c1325);}}); \ No newline at end of file +var _0x8ce3=['varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','../../config/environment','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','./utils','port','asterisk','username','password','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','cdr','blindtransfer','attendedtransfer'];(function(_0x3efca8,_0x316ddd){var _0x24f991=function(_0x41bc29){while(--_0x41bc29){_0x3efca8['push'](_0x3efca8['shift']());}};_0x24f991(++_0x316ddd);}(_0x8ce3,0xc3));var _0x38ce=function(_0x2b9607,_0x3b5e1d){_0x2b9607=_0x2b9607-0x0;var _0x3044eb=_0x8ce3[_0x2b9607];return _0x3044eb;};var AsteriskManager=require(_0x38ce('0x0'));var config=require(_0x38ce('0x1'));var agents=require('./agents.controller');var calls=require(_0x38ce('0x2'));var queues=require(_0x38ce('0x3'));var recordings=require(_0x38ce('0x4'));var members=require(_0x38ce('0x5'));var dials=require(_0x38ce('0x6'));var transfers=require(_0x38ce('0x7'));var core=require(_0x38ce('0x8'));var utils=require(_0x38ce('0x9'));var ami=new AsteriskManager(config['asterisk'][_0x38ce('0xa')],config[_0x38ce('0xb')]['ip'],config['asterisk'][_0x38ce('0xc')],config[_0x38ce('0xb')][_0x38ce('0xd')],!![]);ami['keepConnected']();ami['on'](_0x38ce('0xe'),core['connect']);ami['on'](_0x38ce('0xf'),core['shutdown']);ami['on'](_0x38ce('0x10'),core[_0x38ce('0x10')]);ami['on'](_0x38ce('0x11'),core[_0x38ce('0x11')]);ami['on'](_0x38ce('0x12'),core[_0x38ce('0x12')]);ami['on'](_0x38ce('0x13'),core[_0x38ce('0x13')]);ami['on'](_0x38ce('0x14'),function(_0xe33aec){try{members[_0x38ce('0x14')](_0xe33aec);}catch(_0x3ef662){utils[_0x38ce('0x11')](_0x3ef662);}});ami['on'](_0x38ce('0x15'),function(_0x2e661b){try{agents[_0x38ce('0x15')](_0x2e661b);}catch(_0x56a09f){utils['error'](_0x56a09f);}});ami['on'](_0x38ce('0x16'),function(_0x2aabd8){try{agents[_0x38ce('0x16')](_0x2aabd8);}catch(_0x55be6a){utils[_0x38ce('0x11')](_0x55be6a);}});ami['on']('agentconnect',function(_0x2771ec){try{agents[_0x38ce('0x17')](_0x2771ec);recordings['agentconnect'](_0x2771ec);queues[_0x38ce('0x17')](_0x2771ec);}catch(_0x2dddc1){utils[_0x38ce('0x11')](_0x2dddc1);}});ami['on']('agentcomplete',function(_0xe4099a){try{agents[_0x38ce('0x18')](_0xe4099a);queues[_0x38ce('0x18')](_0xe4099a);members[_0x38ce('0x18')](_0xe4099a);calls[_0x38ce('0x18')](_0xe4099a);}catch(_0x117d0d){utils[_0x38ce('0x11')](_0x117d0d);}});ami['on']('queuecallerabandon',function(_0x2a9447){try{agents[_0x38ce('0x19')](_0x2a9447);queues[_0x38ce('0x19')](_0x2a9447);}catch(_0x303391){utils[_0x38ce('0x11')](_0x303391);}});ami['on'](_0x38ce('0x1a'),function(_0x323490){try{queues[_0x38ce('0x1a')](_0x323490);}catch(_0xe13739){utils[_0x38ce('0x11')](_0xe13739);}});ami['on'](_0x38ce('0x1b'),function(_0x580cf3){try{queues[_0x38ce('0x1b')](_0x580cf3);}catch(_0x28c37e){utils[_0x38ce('0x11')](_0x28c37e);}});ami['on'](_0x38ce('0x1c'),function(_0x4a56b0){try{queues[_0x38ce('0x1c')](_0x4a56b0);calls[_0x38ce('0x1c')](_0x4a56b0);}catch(_0x5ae8f8){utils[_0x38ce('0x11')](_0x5ae8f8);}});ami['on'](_0x38ce('0x1d'),function(_0x43b479){try{queues['musiconholdstop'](_0x43b479);calls['musiconholdstop'](_0x43b479);}catch(_0x3f3516){utils[_0x38ce('0x11')](_0x3f3516);}});ami['on'](_0x38ce('0x1e'),function(_0x21d4e7){try{calls[_0x38ce('0x1e')](_0x21d4e7);agents[_0x38ce('0x1e')](_0x21d4e7);queues[_0x38ce('0x1e')](_0x21d4e7);recordings[_0x38ce('0x1e')](_0x21d4e7);dials[_0x38ce('0x1e')](_0x21d4e7);members[_0x38ce('0x1e')](_0x21d4e7);}catch(_0xfc590a){utils[_0x38ce('0x11')](_0xfc590a);}});ami['on']('blindtransfer',function(_0x1212dd){try{queues[_0x38ce('0x1f')](_0x1212dd);agents['blindtransfer'](_0x1212dd);transfers[_0x38ce('0x1f')](_0x1212dd);}catch(_0x3cbead){utils['error'](_0x3cbead);}});ami['on'](_0x38ce('0x20'),function(_0x282ee4){try{queues['attendedtransfer'](_0x282ee4);transfers[_0x38ce('0x20')](_0x282ee4);agents['attendedtransfer'](_0x282ee4);}catch(_0x1aa8fb){utils[_0x38ce('0x11')](_0x1aa8fb);}});ami['on'](_0x38ce('0x21'),function(_0xa9d304){try{queues[_0x38ce('0x21')](_0xa9d304);recordings[_0x38ce('0x21')](_0xa9d304);calls[_0x38ce('0x21')](_0xa9d304);dials[_0x38ce('0x21')](_0xa9d304);}catch(_0x4ec0d3){utils['error'](_0x4ec0d3);}});ami['on'](_0x38ce('0x22'),function(_0xc4dd0f){try{calls[_0x38ce('0x22')](_0xc4dd0f);dials[_0x38ce('0x22')](_0xc4dd0f);}catch(_0x3fe430){utils['error'](_0x3fe430);}});ami['on'](_0x38ce('0x23'),function(_0x12c68b){try{calls[_0x38ce('0x23')](_0x12c68b);dials[_0x38ce('0x23')](_0x12c68b);}catch(_0x3a4895){utils[_0x38ce('0x11')](_0x3a4895);}});ami['on'](_0x38ce('0x24'),function(_0x54050a){try{dials[_0x38ce('0x24')](_0x54050a);}catch(_0x73cbd2){utils['error'](_0x73cbd2);}});ami['on'](_0x38ce('0x25'),function(_0x190000){try{dials[_0x38ce('0x25')](_0x190000);}catch(_0x3e236d){utils[_0x38ce('0x11')](_0x3e236d);}}); \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 7ca02d3..9cbbcd0 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 _0xa3b3=['agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','assign','channel','data1','source','data3','destinationchannel','destination','lodash','Local/_attended@transfer','Queue:','info','format','uniqueid','interface','data2','type','getUserByInterface','then','membername','name','internal','CreateMemberReport','getUserByName','split','request','catch','error','startsWith','state','INUSE','device','voice','TALKING','now'];(function(_0x108172,_0x1178c5){var _0x41c081=function(_0x4b9080){while(--_0x4b9080){_0x108172['push'](_0x108172['shift']());}};_0x41c081(++_0x1178c5);}(_0xa3b3,0x189));var _0x3a3b=function(_0x2596fa,_0x189c14){_0x2596fa=_0x2596fa-0x0;var _0x159184=_0xa3b3[_0x2596fa];return _0x159184;};'use strict';var _=require(_0x3a3b('0x0'));var util=require('util');var utils=require('./utils');var members={};var exclude=[_0x3a3b('0x1'),_0x3a3b('0x2')];function writeDB(_0x28fc51){utils[_0x3a3b('0x3')](util[_0x3a3b('0x4')]('MEMBER|%s|%s|%s|%s|%s|%s',_0x28fc51[_0x3a3b('0x5')],_0x28fc51[_0x3a3b('0x6')],_0x28fc51['channel'],_0x28fc51[_0x3a3b('0x7')],_0x28fc51['membername'],_0x28fc51[_0x3a3b('0x8')]));if(_0x28fc51[_0x3a3b('0x6')]){utils[_0x3a3b('0x9')](_0x28fc51['interface'])[_0x3a3b('0xa')](function(_0x2076db){if(_0x2076db){_0x28fc51[_0x3a3b('0xb')]=_0x2076db[_0x3a3b('0xc')];_0x28fc51[_0x3a3b('0xd')]=_0x2076db['internal'];utils['request'](_0x3a3b('0xe'),_0x28fc51);}else{utils[_0x3a3b('0xf')](_0x28fc51[_0x3a3b('0x6')][_0x3a3b('0x10')]('/')[0x1])[_0x3a3b('0xa')](function(_0x24cdc6){if(_0x24cdc6){_0x28fc51['membername']=_0x24cdc6[_0x3a3b('0xc')];_0x28fc51[_0x3a3b('0xd')]=_0x24cdc6['internal'];utils[_0x3a3b('0x11')](_0x3a3b('0xe'),_0x28fc51);}});}})[_0x3a3b('0x12')](function(_0x6c6bc3){utils[_0x3a3b('0x13')](_0x6c6bc3);});}delete members[_0x28fc51[_0x3a3b('0x6')]];}function startsWith(_0x8383cb,_0x4f0b72){return _['some'](_0x8383cb,function(_0x5bac5b){return _[_0x3a3b('0x14')](_0x4f0b72,_0x5bac5b);});}exports['devicestatechange']=function(_0x5af323){switch(_0x5af323[_0x3a3b('0x15')]){case _0x3a3b('0x16'):if(!startsWith(exclude,_0x5af323['device'])){members[_0x5af323[_0x3a3b('0x17')]]={'channel':_0x3a3b('0x18'),'interface':_0x5af323[_0x3a3b('0x17')],'type':_0x3a3b('0x19'),'enterAt':utils[_0x3a3b('0x1a')](),'role':_0x3a3b('0x1b'),'data1':_0x3a3b('0xd')};}break;case _0x3a3b('0x1c'):if(!_[_0x3a3b('0x1d')](members[_0x5af323[_0x3a3b('0x17')]])){members[_0x5af323[_0x3a3b('0x17')]][_0x3a3b('0x1e')]=utils[_0x3a3b('0x1a')]();members[_0x5af323[_0x3a3b('0x17')]][_0x3a3b('0x1f')]=utils[_0x3a3b('0x20')](members[_0x5af323[_0x3a3b('0x17')]][_0x3a3b('0x1e')],members[_0x5af323['device']][_0x3a3b('0x21')]);}default:break;}};exports[_0x3a3b('0x22')]=function(_0x3d4f30){if(!_[_0x3a3b('0x1d')](members[_0x3d4f30[_0x3a3b('0x6')]])){members[_0x3d4f30[_0x3a3b('0x6')]]=_[_0x3a3b('0x23')](members[_0x3d4f30[_0x3a3b('0x6')]],{'data4':_0x3d4f30['queue']});}};exports['cdr']=function(_0x3391c4){if(_0x3391c4[_0x3a3b('0x24')]){var _0x46fc59=_0x3391c4[_0x3a3b('0x24')][_0x3a3b('0x10')]('-')[0x0];if(!_[_0x3a3b('0x1d')](members[_0x46fc59])){members[_0x46fc59]=_[_0x3a3b('0x23')](members[_0x46fc59],{'data1':members[_0x46fc59][_0x3a3b('0x25')]||_0x3391c4[_0x3a3b('0x8')],'data2':members[_0x46fc59][_0x3a3b('0x7')]||_0x3391c4[_0x3a3b('0x26')],'data3':members[_0x46fc59][_0x3a3b('0x27')]||_0x3391c4['destination'],'uniqueid':members[_0x46fc59][_0x3a3b('0x5')]||_0x3391c4['uniqueid']});if(members[_0x46fc59]['exitAt']){writeDB(members[_0x46fc59]);}}}if(_0x3391c4[_0x3a3b('0x28')]){var _0x4566d5=_0x3391c4[_0x3a3b('0x28')][_0x3a3b('0x10')]('-')[0x0];if(!_[_0x3a3b('0x1d')](members[_0x4566d5])){members[_0x4566d5]=_[_0x3a3b('0x23')](members[_0x4566d5],{'data1':members[_0x4566d5][_0x3a3b('0x25')]||_0x3391c4[_0x3a3b('0x8')],'data2':members[_0x4566d5][_0x3a3b('0x7')]||_0x3391c4['source'],'data3':members[_0x4566d5][_0x3a3b('0x27')]||_0x3391c4[_0x3a3b('0x29')],'uniqueid':members[_0x4566d5][_0x3a3b('0x5')]||_0x3391c4[_0x3a3b('0x5')]});if(members[_0x4566d5][_0x3a3b('0x1e')]){writeDB(members[_0x4566d5]);}}}}; \ No newline at end of file +var _0xad67=['name','request','catch','error','some','startsWith','state','INUSE','device','voice','now','agent','isNil','exitAt','enterAt','agentcomplete','assign','queue','cdr','type','destination','destinationchannel','data1','source','data3','lodash','util','./utils','Local/_attended@transfer','Queue:','info','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface','channel','data2','membername','getUserByInterface','internal','CreateMemberReport','getUserByName','split','then'];(function(_0x3040ba,_0x41df4f){var _0x2bdae7=function(_0x138931){while(--_0x138931){_0x3040ba['push'](_0x3040ba['shift']());}};_0x2bdae7(++_0x41df4f);}(_0xad67,0xf0));var _0x7ad6=function(_0x30597e,_0x3d3e66){_0x30597e=_0x30597e-0x0;var _0x17b1cf=_0xad67[_0x30597e];return _0x17b1cf;};'use strict';var _=require(_0x7ad6('0x0'));var util=require(_0x7ad6('0x1'));var utils=require(_0x7ad6('0x2'));var members={};var exclude=[_0x7ad6('0x3'),_0x7ad6('0x4')];function writeDB(_0x58f800){utils[_0x7ad6('0x5')](util['format'](_0x7ad6('0x6'),_0x58f800[_0x7ad6('0x7')],_0x58f800[_0x7ad6('0x8')],_0x58f800[_0x7ad6('0x9')],_0x58f800[_0x7ad6('0xa')],_0x58f800[_0x7ad6('0xb')],_0x58f800['type']));if(_0x58f800['interface']){utils[_0x7ad6('0xc')](_0x58f800[_0x7ad6('0x8')])['then'](function(_0x193125){if(_0x193125){_0x58f800[_0x7ad6('0xb')]=_0x193125['name'];_0x58f800[_0x7ad6('0xd')]=_0x193125[_0x7ad6('0xd')];utils['request'](_0x7ad6('0xe'),_0x58f800);}else{utils[_0x7ad6('0xf')](_0x58f800[_0x7ad6('0x8')][_0x7ad6('0x10')]('/')[0x1])[_0x7ad6('0x11')](function(_0xfec030){if(_0xfec030){_0x58f800[_0x7ad6('0xb')]=_0xfec030[_0x7ad6('0x12')];_0x58f800[_0x7ad6('0xd')]=_0xfec030['internal'];utils[_0x7ad6('0x13')](_0x7ad6('0xe'),_0x58f800);}});}})[_0x7ad6('0x14')](function(_0x29f3fd){utils[_0x7ad6('0x15')](_0x29f3fd);});}delete members[_0x58f800[_0x7ad6('0x8')]];}function startsWith(_0x1f15cb,_0x1b84eb){return _[_0x7ad6('0x16')](_0x1f15cb,function(_0x4d6fec){return _[_0x7ad6('0x17')](_0x1b84eb,_0x4d6fec);});}exports['devicestatechange']=function(_0x87014f){switch(_0x87014f[_0x7ad6('0x18')]){case _0x7ad6('0x19'):if(!startsWith(exclude,_0x87014f[_0x7ad6('0x1a')])){members[_0x87014f['device']]={'channel':_0x7ad6('0x1b'),'interface':_0x87014f[_0x7ad6('0x1a')],'type':'TALKING','enterAt':utils[_0x7ad6('0x1c')](),'role':_0x7ad6('0x1d'),'data1':_0x7ad6('0xd')};}break;case'NOT_INUSE':if(!_[_0x7ad6('0x1e')](members[_0x87014f[_0x7ad6('0x1a')]])){members[_0x87014f[_0x7ad6('0x1a')]][_0x7ad6('0x1f')]=utils[_0x7ad6('0x1c')]();members[_0x87014f['device']]['duration']=utils['diffTime'](members[_0x87014f[_0x7ad6('0x1a')]][_0x7ad6('0x1f')],members[_0x87014f[_0x7ad6('0x1a')]][_0x7ad6('0x20')]);}default:break;}};exports[_0x7ad6('0x21')]=function(_0x1da346){if(!_[_0x7ad6('0x1e')](members[_0x1da346[_0x7ad6('0x8')]])){members[_0x1da346[_0x7ad6('0x8')]]=_[_0x7ad6('0x22')](members[_0x1da346[_0x7ad6('0x8')]],{'data4':_0x1da346[_0x7ad6('0x23')]});}};exports[_0x7ad6('0x24')]=function(_0x4646e9){if(_0x4646e9[_0x7ad6('0x9')]){var _0x11f6d9=_0x4646e9[_0x7ad6('0x9')][_0x7ad6('0x10')]('-')[0x0];if(!_[_0x7ad6('0x1e')](members[_0x11f6d9])){members[_0x11f6d9]=_[_0x7ad6('0x22')](members[_0x11f6d9],{'data1':members[_0x11f6d9]['data1']||_0x4646e9[_0x7ad6('0x25')],'data2':members[_0x11f6d9][_0x7ad6('0xa')]||_0x4646e9['source'],'data3':members[_0x11f6d9]['data3']||_0x4646e9[_0x7ad6('0x26')],'uniqueid':members[_0x11f6d9][_0x7ad6('0x7')]||_0x4646e9['uniqueid']});if(members[_0x11f6d9]['exitAt']){writeDB(members[_0x11f6d9]);}}}if(_0x4646e9[_0x7ad6('0x27')]){var _0x45a192=_0x4646e9[_0x7ad6('0x27')][_0x7ad6('0x10')]('-')[0x0];if(!_[_0x7ad6('0x1e')](members[_0x45a192])){members[_0x45a192]=_[_0x7ad6('0x22')](members[_0x45a192],{'data1':members[_0x45a192][_0x7ad6('0x28')]||_0x4646e9[_0x7ad6('0x25')],'data2':members[_0x45a192][_0x7ad6('0xa')]||_0x4646e9[_0x7ad6('0x29')],'data3':members[_0x45a192][_0x7ad6('0x2a')]||_0x4646e9[_0x7ad6('0x26')],'uniqueid':members[_0x45a192][_0x7ad6('0x7')]||_0x4646e9[_0x7ad6('0x7')]});if(members[_0x45a192][_0x7ad6('0x1f')]){writeDB(members[_0x45a192]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index aef3203..3438992 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 _0x61c1=['request','queuecallerjoin','isNil','clone','assign','position','now','varset','variable','queuestatus','value','CONTINUE','toUpperCase','queuecallerleave','diffTime','queuecallerjoinAt','agentconnect','connectedlinenum','connectedlinename','agentcomplete','reason','transfer','COMPLETEDBY','blindtransfer','transfereechannel','BLIND','extension','BLINDTRANSFER','attendedtransfer','forIn','origtransfererchannel','transfertargetchannel','transfertargetcalleridname','transfertargetcalleridnum','ATTENDED','ATTENDEDTRANSFER','origtransfererexten','secondtransfererchannel','transfereecalleridnum','secondtransfererexten','secondtransfereruniqueid','musiconholdstart','musiconholdstartAt','musiconholdstop','mohtime','cdr','util','./utils','info','format','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','CreateVoiceQueueReport'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x61c1,0xa8));var _0x161c=function(_0x36679e,_0x5d4b95){_0x36679e=_0x36679e-0x0;var _0x286aa9=_0x61c1[_0x36679e];return _0x286aa9;};'use strict';var _=require('lodash');var util=require(_0x161c('0x0'));var utils=require(_0x161c('0x1'));var queues={};var transfers={};function writeDB(_0x4498eb,_0x5d8068){utils[_0x161c('0x2')](util[_0x161c('0x3')]('QUEUE|%s|%s|%s|%s|%s|%s|%s',_0x4498eb[_0x161c('0x4')],_0x4498eb[_0x161c('0x5')],_0x4498eb[_0x161c('0x6')],_0x4498eb[_0x161c('0x7')],_0x4498eb[_0x161c('0x8')],_0x4498eb[_0x161c('0x9')],_0x4498eb[_0x161c('0xa')]));if(_0x4498eb[_0x161c('0x6')]){utils[_0x161c('0xb')](_0x4498eb['queue'])[_0x161c('0xc')](function(_0x4f7aa5){if(_0x4f7aa5){_0x4498eb['type']=_0x4f7aa5[_0x161c('0xd')];}utils['request'](_0x161c('0xe'),_0x4498eb);});}else{utils[_0x161c('0xf')]('CreateVoiceQueueReport',_0x4498eb);}if(_0x5d8068){delete queues[_0x4498eb[_0x161c('0x5')]];}}exports[_0x161c('0x10')]=function(_0x549e70){if(!_[_0x161c('0x11')](queues[_0x549e70[_0x161c('0x5')]])){writeDB(_[_0x161c('0x12')](queues[_0x549e70[_0x161c('0x5')]]),![]);}queues[_0x549e70[_0x161c('0x5')]]=_[_0x161c('0x13')](_0x549e70,{'originalposition':_0x549e70[_0x161c('0x14')],'queuecallerjoinAt':utils[_0x161c('0x15')](),'mohtime':0x0});};exports[_0x161c('0x16')]=function(_0x506191){if(!_[_0x161c('0x11')](queues[_0x506191[_0x161c('0x5')]])){if(!_[_0x161c('0x11')](_0x506191[_0x161c('0x17')][_0x161c('0x18')])){if(_0x506191[_0x161c('0x19')]!=_0x161c('0x1a')){queues[_0x506191['channel']]=_[_0x161c('0x13')](queues[_0x506191[_0x161c('0x5')]],{'queuecallerabandon':![],'queuecallerabandonAt':null,'queuecallerexit':!![],'queuecallerexitAt':utils[_0x161c('0x15')](),'queuecallerexitreason':_0x506191[_0x161c('0x19')][_0x161c('0x1b')]()});}}}};exports['queuecallerabandon']=function(_0x163e67){var _0x52fc87={'queuecallerabandon':!![],'queuecallerabandonAt':utils[_0x161c('0x15')](),'queuecallerexitreason':'ABANDONED'};if(!_[_0x161c('0x11')](queues[_0x163e67[_0x161c('0x5')]])){queues[_0x163e67[_0x161c('0x5')]]=_['assign'](queues[_0x163e67[_0x161c('0x5')]],_0x52fc87);}if(!_[_0x161c('0x11')](transfers[_0x163e67[_0x161c('0x5')]])){transfers[_0x163e67[_0x161c('0x5')]]=_[_0x161c('0x13')](transfers[_0x163e67['channel']],_0x52fc87);}};exports[_0x161c('0x1c')]=function(_0x5b5277){if(!_['isNil'](queues[_0x5b5277[_0x161c('0x5')]])){queues[_0x5b5277['channel']]=_['assign'](queues[_0x5b5277['channel']],{'queuecallerleave':!![],'queuecallerleaveAt':utils[_0x161c('0x15')](),'holdtime':utils[_0x161c('0x1d')](utils['now'](),queues[_0x5b5277[_0x161c('0x5')]]['queuecallerjoinAt'])});}if(!_[_0x161c('0x11')](transfers[_0x5b5277[_0x161c('0x5')]])){transfers[_0x5b5277[_0x161c('0x5')]]=_['assign'](transfers[_0x5b5277[_0x161c('0x5')]],{'queuecallerleave':!![],'queuecallerleaveAt':utils['now'](),'holdtime':utils[_0x161c('0x1d')](utils[_0x161c('0x15')](),transfers[_0x5b5277['channel']][_0x161c('0x1e')])});}};exports[_0x161c('0x1f')]=function(_0x1e7527){var _0x14b880={'connectedlinenum':_0x1e7527[_0x161c('0x20')],'connectedlinename':_0x1e7527[_0x161c('0x21')],'assigned':!![],'lastAssignedTo':_0x1e7527['membername']};if(!_['isNil'](queues[_0x1e7527[_0x161c('0x5')]])){queues[_0x1e7527['channel']]=_[_0x161c('0x13')](queues[_0x1e7527[_0x161c('0x5')]],_0x14b880);}if(!_[_0x161c('0x11')](transfers[_0x1e7527['channel']])){transfers[_0x1e7527[_0x161c('0x5')]]=_[_0x161c('0x13')](transfers[_0x1e7527[_0x161c('0x5')]],_0x14b880);}};exports[_0x161c('0x22')]=function(_0xdf099c){var _0x6f5d06={'queuecallercomplete':!![],'queuecallercompleteAt':utils[_0x161c('0x15')]()};if(_0xdf099c[_0x161c('0x23')]!=_0x161c('0x24')){_0x6f5d06[_0x161c('0xa')]=_0x161c('0x25')+_0xdf099c['reason'][_0x161c('0x1b')]();}if(!_[_0x161c('0x11')](queues[_0xdf099c[_0x161c('0x5')]])){queues[_0xdf099c[_0x161c('0x5')]]=_[_0x161c('0x13')](queues[_0xdf099c[_0x161c('0x5')]],_0x6f5d06);writeDB(queues[_0xdf099c[_0x161c('0x5')]],!![]);}};exports[_0x161c('0x26')]=function(_0x50dfc2){if(!_['isNil'](queues[_0x50dfc2['transfereechannel']])){queues[_0x50dfc2[_0x161c('0x27')]]=_['assign'](queues[_0x50dfc2[_0x161c('0x27')]],{'transfer':!![],'transfertype':_0x161c('0x28'),'transferexten':_0x50dfc2[_0x161c('0x29')],'transferuniqueid':_0x50dfc2['transfereeuniqueid'],'queuecallerexitreason':_0x161c('0x2a')});}};exports[_0x161c('0x2b')]=function(_0x3bfc57){_[_0x161c('0x2c')](queues,function(_0x1cc715){if(_0x1cc715[_0x161c('0x5')]==_0x3bfc57[_0x161c('0x2d')]){transfers[_0x3bfc57['transfertargetchannel']]=_[_0x161c('0x12')](_0x1cc715);transfers[_0x3bfc57[_0x161c('0x2e')]]=_[_0x161c('0x13')](transfers[_0x3bfc57[_0x161c('0x2e')]],{'queuecallerjoinAt':utils[_0x161c('0x15')](),'queuecallerleaveAt':utils[_0x161c('0x15')](),'channel':_0x3bfc57[_0x161c('0x2e')],'calleridname':_0x3bfc57[_0x161c('0x2f')],'calleridnum':_0x3bfc57[_0x161c('0x30')],'queuecallerenterreason':0x2});queues[_0x3bfc57[_0x161c('0x2e')]]=_[_0x161c('0x13')](queues[_0x3bfc57[_0x161c('0x2e')]],{'transfer':!![],'transfertype':_0x161c('0x31'),'queuecallerexitreason':_0x161c('0x32'),'transferexten':_0x3bfc57[_0x161c('0x33')],'transferuniqueid':_0x3bfc57['origtransfereruniqueid']});queues[_0x3bfc57[_0x161c('0x2d')]]=_[_0x161c('0x13')](queues[_0x3bfc57[_0x161c('0x2d')]],{'queuecallerexitreason':_0x161c('0x31'),'queuecallerenterreason':0x1});}else if(_0x1cc715[_0x161c('0x5')]==_0x3bfc57[_0x161c('0x34')]){transfers[_0x3bfc57[_0x161c('0x27')]]=_[_0x161c('0x12')](_0x1cc715);transfers[_0x3bfc57[_0x161c('0x27')]]=_[_0x161c('0x13')](transfers[_0x3bfc57['transfereechannel']],{'queuecallerjoinAt':utils[_0x161c('0x15')](),'queuecallerleaveAt':utils['now'](),'channel':_0x3bfc57['transfereechannel'],'calleridname':_0x3bfc57['transfereecalleridname'],'calleridnum':_0x3bfc57[_0x161c('0x35')],'queuecallerenterreason':0x2});queues[_0x3bfc57['transfereechannel']]=_[_0x161c('0x13')](queues[_0x3bfc57['transfereechannel']],{'transfer':!![],'transfertype':_0x161c('0x31'),'queuecallerexitreason':_0x161c('0x32'),'transferexten':_0x3bfc57[_0x161c('0x36')],'transferuniqueid':_0x3bfc57[_0x161c('0x37')]});queues[_0x3bfc57['secondtransfererchannel']]=_[_0x161c('0x13')](queues[_0x3bfc57[_0x161c('0x34')]],{'queuecallerexitreason':_0x161c('0x31'),'queuecallerenterreason':0x1});}});};exports[_0x161c('0x38')]=function(_0x26b8d3){if(!_[_0x161c('0x11')](queues[_0x26b8d3[_0x161c('0x5')]])){queues[_0x26b8d3[_0x161c('0x5')]][_0x161c('0x39')]=utils[_0x161c('0x15')]();}};exports[_0x161c('0x3a')]=function(_0x188dd3){if(!_[_0x161c('0x11')](queues[_0x188dd3['channel']])){if(!_[_0x161c('0x11')](queues[_0x188dd3[_0x161c('0x5')]][_0x161c('0x39')])){queues[_0x188dd3[_0x161c('0x5')]][_0x161c('0x3b')]+=utils['diffTime'](utils[_0x161c('0x15')](),queues[_0x188dd3[_0x161c('0x5')]]['musiconholdstartAt']);delete queues[_0x188dd3[_0x161c('0x5')]]['musiconholdstartAt'];}}};exports[_0x161c('0x3c')]=function(_0x56d8b3){if(!_[_0x161c('0x11')](queues[_0x56d8b3[_0x161c('0x5')]])){writeDB(queues[_0x56d8b3[_0x161c('0x5')]],!![]);}if(!_['isNil'](transfers[_0x56d8b3[_0x161c('0x5')]])){if(transfers[_0x56d8b3['channel']]['assigned']){transfers[_0x56d8b3[_0x161c('0x5')]]=_[_0x161c('0x13')](transfers[_0x56d8b3[_0x161c('0x5')]],{'queuecallercomplete':!![],'queuecallercompleteAt':utils[_0x161c('0x15')](),'queuecallerexitreason':'COMPLETED'});}writeDB(transfers[_0x56d8b3['channel']],![]);delete transfers[_0x56d8b3[_0x161c('0x5')]];}}; \ No newline at end of file +var _0x194f=['calleridnum','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','channel','queuecallerjoin','isNil','clone','now','variable','queuestatus','value','CONTINUE','toUpperCase','queuecallerabandon','ABANDONED','assign','queuecallerleave','diffTime','agentconnect','connectedlinenum','connectedlinename','membername','transfer','COMPLETEDBY','reason','blindtransfer','transfereechannel','BLIND','extension','transfereeuniqueid','BLINDTRANSFER','attendedtransfer','origtransfererchannel','transfertargetchannel','transfertargetcalleridname','transfertargetcalleridnum','origtransfererexten','ATTENDED','secondtransfererchannel','transfereecalleridnum','ATTENDEDTRANSFER','secondtransfereruniqueid','musiconholdstartAt','mohtime','assigned','COMPLETED','lodash','util','./utils','info','format','uniqueid','queue'];(function(_0x1bba9f,_0x5b591a){var _0x3d53c1=function(_0x12cfc4){while(--_0x12cfc4){_0x1bba9f['push'](_0x1bba9f['shift']());}};_0x3d53c1(++_0x5b591a);}(_0x194f,0x116));var _0xf194=function(_0x2b399a,_0x363cb6){_0x2b399a=_0x2b399a-0x0;var _0x5088f0=_0x194f[_0x2b399a];return _0x5088f0;};'use strict';var _=require(_0xf194('0x0'));var util=require(_0xf194('0x1'));var utils=require(_0xf194('0x2'));var queues={};var transfers={};function writeDB(_0x2f89dc,_0x5c25f6){utils[_0xf194('0x3')](util[_0xf194('0x4')]('QUEUE|%s|%s|%s|%s|%s|%s|%s',_0x2f89dc[_0xf194('0x5')],_0x2f89dc['channel'],_0x2f89dc[_0xf194('0x6')],_0x2f89dc['lastAssignedTo'],_0x2f89dc[_0xf194('0x7')],_0x2f89dc['accountcode'],_0x2f89dc[_0xf194('0x8')]));if(_0x2f89dc['queue']){utils[_0xf194('0x9')](_0x2f89dc[_0xf194('0x6')])[_0xf194('0xa')](function(_0x534edb){if(_0x534edb){_0x2f89dc[_0xf194('0xb')]=_0x534edb[_0xf194('0xb')];}utils[_0xf194('0xc')](_0xf194('0xd'),_0x2f89dc);});}else{utils[_0xf194('0xc')]('CreateVoiceQueueReport',_0x2f89dc);}if(_0x5c25f6){delete queues[_0x2f89dc[_0xf194('0xe')]];}}exports[_0xf194('0xf')]=function(_0x52e28c){if(!_[_0xf194('0x10')](queues[_0x52e28c[_0xf194('0xe')]])){writeDB(_[_0xf194('0x11')](queues[_0x52e28c['channel']]),![]);}queues[_0x52e28c[_0xf194('0xe')]]=_['assign'](_0x52e28c,{'originalposition':_0x52e28c['position'],'queuecallerjoinAt':utils[_0xf194('0x12')](),'mohtime':0x0});};exports['varset']=function(_0x5ec20c){if(!_[_0xf194('0x10')](queues[_0x5ec20c[_0xf194('0xe')]])){if(!_[_0xf194('0x10')](_0x5ec20c[_0xf194('0x13')][_0xf194('0x14')])){if(_0x5ec20c[_0xf194('0x15')]!=_0xf194('0x16')){queues[_0x5ec20c[_0xf194('0xe')]]=_['assign'](queues[_0x5ec20c[_0xf194('0xe')]],{'queuecallerabandon':![],'queuecallerabandonAt':null,'queuecallerexit':!![],'queuecallerexitAt':utils['now'](),'queuecallerexitreason':_0x5ec20c['value'][_0xf194('0x17')]()});}}}};exports[_0xf194('0x18')]=function(_0x1fb6b4){var _0x25fb27={'queuecallerabandon':!![],'queuecallerabandonAt':utils['now'](),'queuecallerexitreason':_0xf194('0x19')};if(!_[_0xf194('0x10')](queues[_0x1fb6b4[_0xf194('0xe')]])){queues[_0x1fb6b4['channel']]=_[_0xf194('0x1a')](queues[_0x1fb6b4[_0xf194('0xe')]],_0x25fb27);}if(!_[_0xf194('0x10')](transfers[_0x1fb6b4[_0xf194('0xe')]])){transfers[_0x1fb6b4['channel']]=_[_0xf194('0x1a')](transfers[_0x1fb6b4[_0xf194('0xe')]],_0x25fb27);}};exports[_0xf194('0x1b')]=function(_0xdd7f23){if(!_['isNil'](queues[_0xdd7f23['channel']])){queues[_0xdd7f23[_0xf194('0xe')]]=_[_0xf194('0x1a')](queues[_0xdd7f23[_0xf194('0xe')]],{'queuecallerleave':!![],'queuecallerleaveAt':utils[_0xf194('0x12')](),'holdtime':utils[_0xf194('0x1c')](utils[_0xf194('0x12')](),queues[_0xdd7f23[_0xf194('0xe')]]['queuecallerjoinAt'])});}if(!_['isNil'](transfers[_0xdd7f23[_0xf194('0xe')]])){transfers[_0xdd7f23['channel']]=_[_0xf194('0x1a')](transfers[_0xdd7f23[_0xf194('0xe')]],{'queuecallerleave':!![],'queuecallerleaveAt':utils[_0xf194('0x12')](),'holdtime':utils[_0xf194('0x1c')](utils[_0xf194('0x12')](),transfers[_0xdd7f23[_0xf194('0xe')]]['queuecallerjoinAt'])});}};exports[_0xf194('0x1d')]=function(_0xe457ed){var _0x1027e8={'connectedlinenum':_0xe457ed[_0xf194('0x1e')],'connectedlinename':_0xe457ed[_0xf194('0x1f')],'assigned':!![],'lastAssignedTo':_0xe457ed[_0xf194('0x20')]};if(!_[_0xf194('0x10')](queues[_0xe457ed['channel']])){queues[_0xe457ed['channel']]=_[_0xf194('0x1a')](queues[_0xe457ed[_0xf194('0xe')]],_0x1027e8);}if(!_[_0xf194('0x10')](transfers[_0xe457ed['channel']])){transfers[_0xe457ed[_0xf194('0xe')]]=_[_0xf194('0x1a')](transfers[_0xe457ed[_0xf194('0xe')]],_0x1027e8);}};exports['agentcomplete']=function(_0xb1d85c){var _0x134d91={'queuecallercomplete':!![],'queuecallercompleteAt':utils[_0xf194('0x12')]()};if(_0xb1d85c['reason']!=_0xf194('0x21')){_0x134d91[_0xf194('0x8')]=_0xf194('0x22')+_0xb1d85c[_0xf194('0x23')][_0xf194('0x17')]();}if(!_['isNil'](queues[_0xb1d85c[_0xf194('0xe')]])){queues[_0xb1d85c['channel']]=_[_0xf194('0x1a')](queues[_0xb1d85c[_0xf194('0xe')]],_0x134d91);writeDB(queues[_0xb1d85c[_0xf194('0xe')]],!![]);}};exports[_0xf194('0x24')]=function(_0x310fa1){if(!_['isNil'](queues[_0x310fa1[_0xf194('0x25')]])){queues[_0x310fa1[_0xf194('0x25')]]=_[_0xf194('0x1a')](queues[_0x310fa1[_0xf194('0x25')]],{'transfer':!![],'transfertype':_0xf194('0x26'),'transferexten':_0x310fa1[_0xf194('0x27')],'transferuniqueid':_0x310fa1[_0xf194('0x28')],'queuecallerexitreason':_0xf194('0x29')});}};exports[_0xf194('0x2a')]=function(_0x5de2b1){_['forIn'](queues,function(_0xf0004f){if(_0xf0004f[_0xf194('0xe')]==_0x5de2b1[_0xf194('0x2b')]){transfers[_0x5de2b1[_0xf194('0x2c')]]=_[_0xf194('0x11')](_0xf0004f);transfers[_0x5de2b1[_0xf194('0x2c')]]=_[_0xf194('0x1a')](transfers[_0x5de2b1[_0xf194('0x2c')]],{'queuecallerjoinAt':utils[_0xf194('0x12')](),'queuecallerleaveAt':utils['now'](),'channel':_0x5de2b1[_0xf194('0x2c')],'calleridname':_0x5de2b1[_0xf194('0x2d')],'calleridnum':_0x5de2b1[_0xf194('0x2e')],'queuecallerenterreason':0x2});queues[_0x5de2b1['transfertargetchannel']]=_[_0xf194('0x1a')](queues[_0x5de2b1['transfertargetchannel']],{'transfer':!![],'transfertype':'ATTENDED','queuecallerexitreason':'ATTENDEDTRANSFER','transferexten':_0x5de2b1[_0xf194('0x2f')],'transferuniqueid':_0x5de2b1['origtransfereruniqueid']});queues[_0x5de2b1[_0xf194('0x2b')]]=_['assign'](queues[_0x5de2b1[_0xf194('0x2b')]],{'queuecallerexitreason':_0xf194('0x30'),'queuecallerenterreason':0x1});}else if(_0xf0004f[_0xf194('0xe')]==_0x5de2b1[_0xf194('0x31')]){transfers[_0x5de2b1[_0xf194('0x25')]]=_['clone'](_0xf0004f);transfers[_0x5de2b1[_0xf194('0x25')]]=_[_0xf194('0x1a')](transfers[_0x5de2b1['transfereechannel']],{'queuecallerjoinAt':utils[_0xf194('0x12')](),'queuecallerleaveAt':utils[_0xf194('0x12')](),'channel':_0x5de2b1[_0xf194('0x25')],'calleridname':_0x5de2b1['transfereecalleridname'],'calleridnum':_0x5de2b1[_0xf194('0x32')],'queuecallerenterreason':0x2});queues[_0x5de2b1[_0xf194('0x25')]]=_[_0xf194('0x1a')](queues[_0x5de2b1['transfereechannel']],{'transfer':!![],'transfertype':'ATTENDED','queuecallerexitreason':_0xf194('0x33'),'transferexten':_0x5de2b1['secondtransfererexten'],'transferuniqueid':_0x5de2b1[_0xf194('0x34')]});queues[_0x5de2b1[_0xf194('0x31')]]=_[_0xf194('0x1a')](queues[_0x5de2b1[_0xf194('0x31')]],{'queuecallerexitreason':_0xf194('0x30'),'queuecallerenterreason':0x1});}});};exports['musiconholdstart']=function(_0x16b3c8){if(!_['isNil'](queues[_0x16b3c8[_0xf194('0xe')]])){queues[_0x16b3c8[_0xf194('0xe')]][_0xf194('0x35')]=utils[_0xf194('0x12')]();}};exports['musiconholdstop']=function(_0x29611f){if(!_[_0xf194('0x10')](queues[_0x29611f[_0xf194('0xe')]])){if(!_['isNil'](queues[_0x29611f['channel']][_0xf194('0x35')])){queues[_0x29611f[_0xf194('0xe')]][_0xf194('0x36')]+=utils[_0xf194('0x1c')](utils['now'](),queues[_0x29611f[_0xf194('0xe')]]['musiconholdstartAt']);delete queues[_0x29611f[_0xf194('0xe')]][_0xf194('0x35')];}}};exports['cdr']=function(_0x450d39){if(!_['isNil'](queues[_0x450d39[_0xf194('0xe')]])){writeDB(queues[_0x450d39[_0xf194('0xe')]],!![]);}if(!_[_0xf194('0x10')](transfers[_0x450d39[_0xf194('0xe')]])){if(transfers[_0x450d39[_0xf194('0xe')]][_0xf194('0x37')]){transfers[_0x450d39[_0xf194('0xe')]]=_[_0xf194('0x1a')](transfers[_0x450d39[_0xf194('0xe')]],{'queuecallercomplete':!![],'queuecallercompleteAt':utils['now'](),'queuecallerexitreason':_0xf194('0x38')});}writeDB(transfers[_0x450d39[_0xf194('0xe')]],![]);delete transfers[_0x450d39['channel']];}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index b951978..5915964 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 _0x6a63=['connectedlinenum','type','destinationchannel','uniqueid','calleridnum','lodash','./utils','debug','accountcode','getUserByInternal','then','request','CreateVoiceRecording','channel','varset','isNil','variable','mixmonitor_filename','value','.wav49','replace','.WAV','assign','queue'];(function(_0x61217,_0x3b77ec){var _0x352a2a=function(_0x38f929){while(--_0x38f929){_0x61217['push'](_0x61217['shift']());}};_0x352a2a(++_0x3b77ec);}(_0x6a63,0x19d));var _0x36a6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x6a63[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x36a6('0x0'));var utils=require(_0x36a6('0x1'));var recordings={};function writeDB(_0x517b84){utils[_0x36a6('0x2')](_0x517b84);if(_0x517b84[_0x36a6('0x3')]){utils[_0x36a6('0x4')](_0x517b84[_0x36a6('0x3')])[_0x36a6('0x5')](function(_0x3afe39){if(_0x3afe39){_0x517b84['membername']=_0x3afe39['name'];_0x517b84['UserId']=_0x3afe39['id'];}utils[_0x36a6('0x6')](_0x36a6('0x7'),_0x517b84);});}else{utils[_0x36a6('0x6')]('CreateVoiceRecording',_0x517b84);}if(recordings[_0x517b84[_0x36a6('0x8')]]){delete recordings[_0x517b84['channel']];}}exports[_0x36a6('0x9')]=function(_0x1efcf7){if(!_[_0x36a6('0xa')](_0x1efcf7['variable'])&&!_['isNil'](_0x1efcf7[_0x36a6('0xb')][_0x36a6('0xc')])){if(!_[_0x36a6('0xa')](recordings[_0x1efcf7[_0x36a6('0x8')]])){writeDB(recordings[_0x1efcf7[_0x36a6('0x8')]]);}if(_['endsWith'](_0x1efcf7[_0x36a6('0xd')],_0x36a6('0xe'))){_0x1efcf7[_0x36a6('0xd')]=_0x1efcf7[_0x36a6('0xd')][_0x36a6('0xf')](_0x36a6('0xe'),_0x36a6('0x10'));}recordings[_0x1efcf7[_0x36a6('0x8')]]=_[_0x36a6('0x11')](_0x1efcf7,{});}};exports['agentconnect']=function(_0x429a50){if(!_['isNil'](recordings[_0x429a50[_0x36a6('0x8')]])){recordings[_0x429a50[_0x36a6('0x8')]]=_['assign'](recordings[_0x429a50['channel']],{'membername':_0x429a50['membername'],'queue':_0x429a50[_0x36a6('0x12')],'accountcode':_0x429a50[_0x36a6('0x13')]});}};exports['cdr']=function(_0x4b625f){if(!_['isNil'](recordings[_0x4b625f[_0x36a6('0x8')]])){recordings[_0x4b625f['channel']]=_[_0x36a6('0x11')](recordings[_0x4b625f[_0x36a6('0x8')]],{'type':_0x4b625f[_0x36a6('0x14')]});writeDB(recordings[_0x4b625f[_0x36a6('0x8')]]);}else if(!_[_0x36a6('0xa')](recordings[_0x4b625f['destinationchannel']])){recordings[_0x4b625f['channel']]=recordings[_0x4b625f[_0x36a6('0x15')]];delete recordings[_0x4b625f[_0x36a6('0x15')]];recordings[_0x4b625f['channel']]=_[_0x36a6('0x11')](recordings[_0x4b625f[_0x36a6('0x8')]],{'type':_0x4b625f['type'],'channel':_0x4b625f[_0x36a6('0x8')],'exten':_0x4b625f['destination'],'context':_0x4b625f['destinationcontext'],'uniqueid':_0x4b625f[_0x36a6('0x16')],'calleridnum':recordings[_0x4b625f['channel']][_0x36a6('0x13')],'calleridname':recordings[_0x4b625f[_0x36a6('0x8')]]['connectedlinename'],'connectedlinenum':recordings[_0x4b625f[_0x36a6('0x8')]][_0x36a6('0x17')],'connectedlinename':recordings[_0x4b625f[_0x36a6('0x8')]]['calleridname']});writeDB(recordings[_0x4b625f[_0x36a6('0x8')]]);}}; \ No newline at end of file +var _0x1157=['uniqueid','connectedlinename','calleridnum','lodash','debug','accountcode','getUserByInternal','then','membername','request','CreateVoiceRecording','channel','isNil','variable','mixmonitor_filename','endsWith','value','.wav49','replace','.WAV','assign','agentconnect','queue','connectedlinenum','cdr','destinationchannel','destination','destinationcontext'];(function(_0x51e70e,_0x349d51){var _0x1f7a49=function(_0x58db08){while(--_0x58db08){_0x51e70e['push'](_0x51e70e['shift']());}};_0x1f7a49(++_0x349d51);}(_0x1157,0x137));var _0x7115=function(_0x2dc5ec,_0x449e41){_0x2dc5ec=_0x2dc5ec-0x0;var _0x26015f=_0x1157[_0x2dc5ec];return _0x26015f;};'use strict';var _=require(_0x7115('0x0'));var utils=require('./utils');var recordings={};function writeDB(_0x5d3c6b){utils[_0x7115('0x1')](_0x5d3c6b);if(_0x5d3c6b[_0x7115('0x2')]){utils[_0x7115('0x3')](_0x5d3c6b[_0x7115('0x2')])[_0x7115('0x4')](function(_0x57664f){if(_0x57664f){_0x5d3c6b[_0x7115('0x5')]=_0x57664f['name'];_0x5d3c6b['UserId']=_0x57664f['id'];}utils[_0x7115('0x6')](_0x7115('0x7'),_0x5d3c6b);});}else{utils['request'](_0x7115('0x7'),_0x5d3c6b);}if(recordings[_0x5d3c6b['channel']]){delete recordings[_0x5d3c6b[_0x7115('0x8')]];}}exports['varset']=function(_0x5cace5){if(!_[_0x7115('0x9')](_0x5cace5['variable'])&&!_[_0x7115('0x9')](_0x5cace5[_0x7115('0xa')][_0x7115('0xb')])){if(!_[_0x7115('0x9')](recordings[_0x5cace5[_0x7115('0x8')]])){writeDB(recordings[_0x5cace5['channel']]);}if(_[_0x7115('0xc')](_0x5cace5[_0x7115('0xd')],_0x7115('0xe'))){_0x5cace5[_0x7115('0xd')]=_0x5cace5['value'][_0x7115('0xf')](_0x7115('0xe'),_0x7115('0x10'));}recordings[_0x5cace5[_0x7115('0x8')]]=_[_0x7115('0x11')](_0x5cace5,{});}};exports[_0x7115('0x12')]=function(_0x47f8cc){if(!_[_0x7115('0x9')](recordings[_0x47f8cc[_0x7115('0x8')]])){recordings[_0x47f8cc[_0x7115('0x8')]]=_[_0x7115('0x11')](recordings[_0x47f8cc['channel']],{'membername':_0x47f8cc[_0x7115('0x5')],'queue':_0x47f8cc[_0x7115('0x13')],'accountcode':_0x47f8cc[_0x7115('0x14')]});}};exports[_0x7115('0x15')]=function(_0x5d5226){if(!_[_0x7115('0x9')](recordings[_0x5d5226['channel']])){recordings[_0x5d5226[_0x7115('0x8')]]=_[_0x7115('0x11')](recordings[_0x5d5226[_0x7115('0x8')]],{'type':_0x5d5226['type']});writeDB(recordings[_0x5d5226[_0x7115('0x8')]]);}else if(!_[_0x7115('0x9')](recordings[_0x5d5226[_0x7115('0x16')]])){recordings[_0x5d5226['channel']]=recordings[_0x5d5226[_0x7115('0x16')]];delete recordings[_0x5d5226['destinationchannel']];recordings[_0x5d5226[_0x7115('0x8')]]=_[_0x7115('0x11')](recordings[_0x5d5226[_0x7115('0x8')]],{'type':_0x5d5226['type'],'channel':_0x5d5226[_0x7115('0x8')],'exten':_0x5d5226[_0x7115('0x17')],'context':_0x5d5226[_0x7115('0x18')],'uniqueid':_0x5d5226[_0x7115('0x19')],'calleridnum':recordings[_0x5d5226[_0x7115('0x8')]][_0x7115('0x14')],'calleridname':recordings[_0x5d5226[_0x7115('0x8')]][_0x7115('0x1a')],'connectedlinenum':recordings[_0x5d5226['channel']][_0x7115('0x1b')],'connectedlinename':recordings[_0x5d5226[_0x7115('0x8')]]['calleridname']});writeDB(recordings[_0x5d5226['channel']]);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 7efe9e7..faadda4 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 _0xaae1=['transfertargetcontext','transfertargetlinkedid','util','./utils','info','format','TRANSFER|%s','type','request','CreateVoiceTransferReport','blindtransfer','attendedtransfer','origtransferercalleridname','origtransfereraccountcode','secondtransferercontext','origtransferercontext','attended','isNil','transfereechannel','assign','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode'];(function(_0x50421c,_0x56c129){var _0xb010f7=function(_0x2c652e){while(--_0x2c652e){_0x50421c['push'](_0x50421c['shift']());}};_0xb010f7(++_0x56c129);}(_0xaae1,0x1ab));var _0x1aae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaae1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x1aae('0x0'));var utils=require(_0x1aae('0x1'));function writeDB(_0x14f536){utils[_0x1aae('0x2')](util[_0x1aae('0x3')](_0x1aae('0x4'),_0x14f536[_0x1aae('0x5')]));utils[_0x1aae('0x6')](_0x1aae('0x7'),_0x14f536);}exports[_0x1aae('0x8')]=function(_0x557d95){_0x557d95['type']='blind';writeDB(_0x557d95);};exports[_0x1aae('0x9')]=function(_0x575a9c){_0x575a9c=_['assign'](_0x575a9c,{'transfererchannel':_0x575a9c['origtransfererchannel'],'transferercalleridnum':_0x575a9c['origtransferercalleridnum'],'transferercalleridname':_0x575a9c[_0x1aae('0xa')],'transfererconnectedlinenum':_0x575a9c['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x575a9c['secondtransfererconnectedlinename'],'transfereraccountcode':_0x575a9c[_0x1aae('0xb')],'transferercontext':_0x575a9c[_0x1aae('0xc')],'transfererexten':_0x575a9c['secondtransfererexten'],'transfererlinkedid':_0x575a9c['origtransfererlinkedid'],'context':_0x575a9c[_0x1aae('0xd')],'extension':_0x575a9c['origtransfererexten'],'type':_0x1aae('0xe')});if(_[_0x1aae('0xf')](_0x575a9c[_0x1aae('0x10')])){_0x575a9c=_[_0x1aae('0x11')](_0x575a9c,{'transfereechannel':_0x575a9c[_0x1aae('0x12')],'transfereecalleridnum':_0x575a9c[_0x1aae('0x13')],'transfereecalleridname':_0x575a9c['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x575a9c[_0x1aae('0x14')],'transfereeconnectedlinename':_0x575a9c[_0x1aae('0x15')],'transfereeaccountcode':_0x575a9c[_0x1aae('0x16')],'transfereecontext':_0x575a9c[_0x1aae('0x17')],'transfereeexten':_0x575a9c['transfertargetexten'],'transfereelinkedid':_0x575a9c[_0x1aae('0x18')]});}writeDB(_0x575a9c);}; \ No newline at end of file +var _0x04b1=['origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','lodash','util','./utils','info','format','TRANSFER|%s','type','blind','attendedtransfer','assign','origtransfererchannel'];(function(_0x4a5dbb,_0x44e40c){var _0x2b5ce1=function(_0x3e09e6){while(--_0x3e09e6){_0x4a5dbb['push'](_0x4a5dbb['shift']());}};_0x2b5ce1(++_0x44e40c);}(_0x04b1,0x65));var _0x104b=function(_0x228641,_0x25d636){_0x228641=_0x228641-0x0;var _0x5d5d78=_0x04b1[_0x228641];return _0x5d5d78;};'use strict';var _=require(_0x104b('0x0'));var util=require(_0x104b('0x1'));var utils=require(_0x104b('0x2'));function writeDB(_0x40a45e){utils[_0x104b('0x3')](util[_0x104b('0x4')](_0x104b('0x5'),_0x40a45e[_0x104b('0x6')]));utils['request']('CreateVoiceTransferReport',_0x40a45e);}exports['blindtransfer']=function(_0xe86083){_0xe86083[_0x104b('0x6')]=_0x104b('0x7');writeDB(_0xe86083);};exports[_0x104b('0x8')]=function(_0x4ff645){_0x4ff645=_[_0x104b('0x9')](_0x4ff645,{'transfererchannel':_0x4ff645[_0x104b('0xa')],'transferercalleridnum':_0x4ff645['origtransferercalleridnum'],'transferercalleridname':_0x4ff645[_0x104b('0xb')],'transfererconnectedlinenum':_0x4ff645[_0x104b('0xc')],'transfererconnectedlinename':_0x4ff645[_0x104b('0xd')],'transfereraccountcode':_0x4ff645['origtransfereraccountcode'],'transferercontext':_0x4ff645[_0x104b('0xe')],'transfererexten':_0x4ff645[_0x104b('0xf')],'transfererlinkedid':_0x4ff645[_0x104b('0x10')],'context':_0x4ff645[_0x104b('0x11')],'extension':_0x4ff645[_0x104b('0x12')],'type':_0x104b('0x13')});if(_[_0x104b('0x14')](_0x4ff645['transfereechannel'])){_0x4ff645=_[_0x104b('0x9')](_0x4ff645,{'transfereechannel':_0x4ff645[_0x104b('0x15')],'transfereecalleridnum':_0x4ff645[_0x104b('0x16')],'transfereecalleridname':_0x4ff645[_0x104b('0x17')],'transfereeconnectedlinenum':_0x4ff645[_0x104b('0x18')],'transfereeconnectedlinename':_0x4ff645[_0x104b('0x19')],'transfereeaccountcode':_0x4ff645[_0x104b('0x1a')],'transfereecontext':_0x4ff645['transfertargetcontext'],'transfereeexten':_0x4ff645[_0x104b('0x1b')],'transfereelinkedid':_0x4ff645['transfertargetlinkedid']});}writeDB(_0x4ff645);}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 2a2ec26..3007b4f 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 _0xd221=['interface','GETUSER|','result','length','FOUND','NOTFOUND','getUserByInternal','getUserByInterface','getUserByName','getVoiceQueueByName','GetVoiceQueue','type','GETVOICEQUEUEBYNAME|','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','diffTime','diff','sumTime','now','isAfter','isBefore','moment','bluebird','http','../../config/logger','xdr','info','debug','error','stack','request','then','stringify','catch','GetUser','internal','name'];(function(_0x40a5ad,_0x5a9d01){var _0xffbab3=function(_0x31c9ff){while(--_0x31c9ff){_0x40a5ad['push'](_0x40a5ad['shift']());}};_0xffbab3(++_0x5a9d01);}(_0xd221,0x90));var _0x1d22=function(_0x196852,_0x171c6b){_0x196852=_0x196852-0x0;var _0x509fc1=_0xd221[_0x196852];return _0x509fc1;};'use strict';var jayson=require('jayson/promise');var moment=require(_0x1d22('0x0'));var BPromise=require(_0x1d22('0x1'));var client=jayson['client'][_0x1d22('0x2')]({'port':0x2329});var logger=require(_0x1d22('0x3'))(_0x1d22('0x4'));exports['info']=function(_0x1af236){logger[_0x1d22('0x5')](_0x1af236);};exports[_0x1d22('0x6')]=function(_0x4877bb){logger[_0x1d22('0x6')](JSON['stringify'](_0x4877bb));};exports[_0x1d22('0x7')]=function(_0x4c6d82){logger[_0x1d22('0x7')](_0x4c6d82[_0x1d22('0x8')]);};exports[_0x1d22('0x9')]=function(_0x49c184,_0x81f7ee){return client['request'](_0x49c184,{'body':_0x81f7ee})[_0x1d22('0xa')](function(_0x2b3460){logger[_0x1d22('0x6')](JSON[_0x1d22('0xb')](_0x2b3460));})[_0x1d22('0xc')](function(_0x5290e3){logger['error'](_0x5290e3[_0x1d22('0x8')]);});};function getUser(_0x33b8ea){return client[_0x1d22('0x9')](_0x1d22('0xd'),{'options':{'raw':!![],'attributes':['id',_0x1d22('0xe'),_0x1d22('0xf'),_0x1d22('0x10')],'where':_0x33b8ea,'limit':0x1}})[_0x1d22('0xa')](function(_0x43bc93){logger[_0x1d22('0x5')](_0x1d22('0x11')+JSON[_0x1d22('0xb')](_0x33b8ea)+'|'+(_0x43bc93[_0x1d22('0x12')][_0x1d22('0x13')]?_0x1d22('0x14'):_0x1d22('0x15')));return _0x43bc93[_0x1d22('0x12')][_0x1d22('0x13')]?_0x43bc93[_0x1d22('0x12')][0x0]:null;});}exports[_0x1d22('0x16')]=function(_0x2d6000){return new BPromise(function(_0x785838,_0x3ebe5f){if(_0x2d6000){return getUser({'internal':_0x2d6000})['then'](function(_0x1e4d31){return _0x785838(_0x1e4d31);})['catch'](function(_0x3ce5ca){logger[_0x1d22('0x7')](_0x3ce5ca[_0x1d22('0x8')]);return _0x785838(null);});}else{return _0x785838(null);}});};exports[_0x1d22('0x17')]=function(_0x4aca16){return new BPromise(function(_0x562e67,_0x5aafb4){if(_0x4aca16){return getUser({'interface':_0x4aca16})['then'](function(_0x42853c){return _0x562e67(_0x42853c);})[_0x1d22('0xc')](function(_0x40ed2d){logger['error'](_0x40ed2d[_0x1d22('0x8')]);return _0x562e67(null);});}else{return _0x562e67(null);}});};exports[_0x1d22('0x18')]=function(_0x1756b6){return new BPromise(function(_0x3615b1,_0x57d744){if(_0x1756b6){return getUser({'name':_0x1756b6})['then'](function(_0x58d781){return _0x3615b1(_0x58d781);})['catch'](function(_0x4ebb3a){logger[_0x1d22('0x7')](_0x4ebb3a[_0x1d22('0x8')]);return _0x3615b1(null);});}else{return _0x3615b1(null);}});};exports[_0x1d22('0x19')]=function(_0x5b206e){return new BPromise(function(_0x106c9b,_0x3913e5){if(_0x5b206e){return client[_0x1d22('0x9')](_0x1d22('0x1a'),{'options':{'raw':!![],'attributes':['id','name',_0x1d22('0x1b'),'acw','acwTimeout'],'where':{'name':_0x5b206e},'limit':0x1}})[_0x1d22('0xa')](function(_0x254bbf){logger['info'](_0x1d22('0x1c')+_0x5b206e+'|'+(_0x254bbf[_0x1d22('0x12')]['length']?_0x1d22('0x14'):_0x1d22('0x15')));return _0x106c9b(_0x254bbf['result']['length']?_0x254bbf[_0x1d22('0x12')][0x0]:null);})[_0x1d22('0xc')](function(_0x188ddb){logger[_0x1d22('0x7')](_0x188ddb[_0x1d22('0x8')]);return _0x106c9b(null);});}else{return _0x106c9b(null);}});};exports['addTime']=function(_0x624c24,_0x80e600){return moment(_0x624c24)[_0x1d22('0x1d')](_0x80e600,_0x1d22('0x1e'))[_0x1d22('0x1f')](_0x1d22('0x20'));};exports[_0x1d22('0x21')]=function(_0x8e056a,_0x5b4f49){return moment(_0x8e056a)['subtract'](_0x5b4f49,_0x1d22('0x1e'))['format'](_0x1d22('0x20'));};exports[_0x1d22('0x22')]=function(_0x5d2307,_0x3961f9){return moment(_0x5d2307)[_0x1d22('0x23')](moment(_0x3961f9),_0x1d22('0x1e'));};exports[_0x1d22('0x24')]=function(_0x40ad78,_0x57d3de){return parseInt(_0x40ad78,0xa)+parseInt(_0x57d3de,0xa);};exports[_0x1d22('0x25')]=function(){return moment()[_0x1d22('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x1d22('0x26')]=function(_0x2f5895,_0x52c2c0){if(_0x52c2c0){return moment(_0x2f5895)['isAfter'](_0x52c2c0);}else{return!![];}};exports[_0x1d22('0x27')]=function(_0x113835,_0x332de4){if(_0x332de4){return moment(_0x113835)[_0x1d22('0x27')](_0x332de4);}else if(_0x113835){return!![];}else{return![];}}; \ No newline at end of file +var _0xfbbf=['getUserByInterface','getUserByName','getVoiceQueueByName','GetVoiceQueue','name','type','acw','result','addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diff','sumTime','now','isAfter','jayson/promise','moment','bluebird','client','http','../../config/logger','xdr','info','debug','stringify','error','stack','request','then','GetUser','internal','interface','FOUND','NOTFOUND','length','getUserByInternal','catch'];(function(_0x59cba9,_0x1e8f27){var _0xae4206=function(_0x1d86e6){while(--_0x1d86e6){_0x59cba9['push'](_0x59cba9['shift']());}};_0xae4206(++_0x1e8f27);}(_0xfbbf,0x152));var _0xffbb=function(_0x7e5471,_0x8aab4e){_0x7e5471=_0x7e5471-0x0;var _0x37449e=_0xfbbf[_0x7e5471];return _0x37449e;};'use strict';var jayson=require(_0xffbb('0x0'));var moment=require(_0xffbb('0x1'));var BPromise=require(_0xffbb('0x2'));var client=jayson[_0xffbb('0x3')][_0xffbb('0x4')]({'port':0x2329});var logger=require(_0xffbb('0x5'))(_0xffbb('0x6'));exports['info']=function(_0x1ff802){logger[_0xffbb('0x7')](_0x1ff802);};exports[_0xffbb('0x8')]=function(_0x413403){logger[_0xffbb('0x8')](JSON[_0xffbb('0x9')](_0x413403));};exports['error']=function(_0x1f349a){logger[_0xffbb('0xa')](_0x1f349a[_0xffbb('0xb')]);};exports[_0xffbb('0xc')]=function(_0x244ece,_0x538958){return client[_0xffbb('0xc')](_0x244ece,{'body':_0x538958})[_0xffbb('0xd')](function(_0x2558a2){logger[_0xffbb('0x8')](JSON[_0xffbb('0x9')](_0x2558a2));})['catch'](function(_0x733260){logger[_0xffbb('0xa')](_0x733260[_0xffbb('0xb')]);});};function getUser(_0x5e5645){return client['request'](_0xffbb('0xe'),{'options':{'raw':!![],'attributes':['id',_0xffbb('0xf'),'name',_0xffbb('0x10')],'where':_0x5e5645,'limit':0x1}})[_0xffbb('0xd')](function(_0x3f71ac){logger[_0xffbb('0x7')]('GETUSER|'+JSON[_0xffbb('0x9')](_0x5e5645)+'|'+(_0x3f71ac['result']['length']?_0xffbb('0x11'):_0xffbb('0x12')));return _0x3f71ac['result'][_0xffbb('0x13')]?_0x3f71ac['result'][0x0]:null;});}exports[_0xffbb('0x14')]=function(_0x3b5993){return new BPromise(function(_0xc2b7fd,_0x23f044){if(_0x3b5993){return getUser({'internal':_0x3b5993})['then'](function(_0x82cd10){return _0xc2b7fd(_0x82cd10);})[_0xffbb('0x15')](function(_0x3b1097){logger[_0xffbb('0xa')](_0x3b1097[_0xffbb('0xb')]);return _0xc2b7fd(null);});}else{return _0xc2b7fd(null);}});};exports[_0xffbb('0x16')]=function(_0x47d0f1){return new BPromise(function(_0x148fb1,_0x36a101){if(_0x47d0f1){return getUser({'interface':_0x47d0f1})['then'](function(_0x1d72c3){return _0x148fb1(_0x1d72c3);})[_0xffbb('0x15')](function(_0x18eedd){logger[_0xffbb('0xa')](_0x18eedd[_0xffbb('0xb')]);return _0x148fb1(null);});}else{return _0x148fb1(null);}});};exports[_0xffbb('0x17')]=function(_0x3002cd){return new BPromise(function(_0x5e28ab,_0x2386c3){if(_0x3002cd){return getUser({'name':_0x3002cd})[_0xffbb('0xd')](function(_0x134e45){return _0x5e28ab(_0x134e45);})['catch'](function(_0x17fbec){logger[_0xffbb('0xa')](_0x17fbec[_0xffbb('0xb')]);return _0x5e28ab(null);});}else{return _0x5e28ab(null);}});};exports[_0xffbb('0x18')]=function(_0xda76ab){return new BPromise(function(_0x412e7f,_0x41af06){if(_0xda76ab){return client[_0xffbb('0xc')](_0xffbb('0x19'),{'options':{'raw':!![],'attributes':['id',_0xffbb('0x1a'),_0xffbb('0x1b'),_0xffbb('0x1c'),'acwTimeout'],'where':{'name':_0xda76ab},'limit':0x1}})['then'](function(_0x2839cb){logger[_0xffbb('0x7')]('GETVOICEQUEUEBYNAME|'+_0xda76ab+'|'+(_0x2839cb[_0xffbb('0x1d')][_0xffbb('0x13')]?'FOUND':_0xffbb('0x12')));return _0x412e7f(_0x2839cb[_0xffbb('0x1d')][_0xffbb('0x13')]?_0x2839cb[_0xffbb('0x1d')][0x0]:null);})[_0xffbb('0x15')](function(_0x2a802e){logger[_0xffbb('0xa')](_0x2a802e[_0xffbb('0xb')]);return _0x412e7f(null);});}else{return _0x412e7f(null);}});};exports[_0xffbb('0x1e')]=function(_0x2bd640,_0x589d1a){return moment(_0x2bd640)['add'](_0x589d1a,_0xffbb('0x1f'))[_0xffbb('0x20')](_0xffbb('0x21'));};exports[_0xffbb('0x22')]=function(_0x3e977a,_0x4d7473){return moment(_0x3e977a)[_0xffbb('0x23')](_0x4d7473,'seconds')[_0xffbb('0x20')](_0xffbb('0x21'));};exports['diffTime']=function(_0x119037,_0x1d4585){return moment(_0x119037)[_0xffbb('0x24')](moment(_0x1d4585),'seconds');};exports[_0xffbb('0x25')]=function(_0x2ca21b,_0x211d15){return parseInt(_0x2ca21b,0xa)+parseInt(_0x211d15,0xa);};exports[_0xffbb('0x26')]=function(){return moment()[_0xffbb('0x20')](_0xffbb('0x21'));};exports[_0xffbb('0x27')]=function(_0x11d8bf,_0x18caf3){if(_0x18caf3){return moment(_0x11d8bf)['isAfter'](_0x18caf3);}else{return!![];}};exports['isBefore']=function(_0x325d9f,_0x36257e){if(_0x36257e){return moment(_0x325d9f)['isBefore'](_0x36257e);}else if(_0x325d9f){return!![];}else{return![];}}; \ No newline at end of file